Update CLAUDE.md for submodule workflow
Replaces the earlier subtree docs with submodule clone/pull/push flow and notes where local-only files live. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4db2ce5607
commit
64babc0d91
49
CLAUDE.md
49
CLAUDE.md
@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||||||
|
|
||||||
## Repository layout
|
## Repository layout
|
||||||
|
|
||||||
`sunnymh` is the umbrella repo for the 晴天漫画 · Sunny MH product. Each sub-project is its own git repo with its own remote on Gitea (`gitea.04080616.xyz/yiekheng/sunnymh-*`). The umbrella ties them together via **git subtree** so a single clone contains the whole system, while the sub-repos remain independently pushable.
|
`sunnymh` is the umbrella repo for the 晴天漫画 · Sunny MH product. Each sub-project is its own git repo with its own remote on Gitea (`gitea.04080616.xyz/yiekheng/sunnymh-*`). The umbrella ties them together via **git submodules** — the umbrella pins a commit SHA per sub-project, and `cd`-ing into a sub-dir gives you that sub-repo's own `.git`, history, and branch.
|
||||||
|
|
||||||
| Path | Role | Remote | Detailed guide |
|
| Path | Role | Remote | Detailed guide |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
@ -13,32 +13,45 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||||||
|
|
||||||
More sub-projects may be added over time. Always read the sub-project's own `CLAUDE.md` before touching its code — the two stacks have very different invariants (Playwright/CDP anti-bot in `manga-dl`; placeholder-shift invariants in `manga-site/PageReader.tsx`).
|
More sub-projects may be added over time. Always read the sub-project's own `CLAUDE.md` before touching its code — the two stacks have very different invariants (Playwright/CDP anti-bot in `manga-dl`; placeholder-shift invariants in `manga-site/PageReader.tsx`).
|
||||||
|
|
||||||
## Subtree workflow
|
## Submodule workflow
|
||||||
|
|
||||||
The sub-dirs currently still hold their own `.git` (independent clones). To convert a sub-dir into a tracked subtree of this umbrella:
|
First clone — must recurse, otherwise the sub-dirs come up empty:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# one-time, per sub-project — run from sunnymh root
|
git clone --recurse-submodules https://gitea.04080616.xyz/yiekheng/sunnymh.git
|
||||||
git remote add manga-dl-origin https://gitea.04080616.xyz/yiekheng/sunnymh-manga-dl.git
|
# or, after a plain clone:
|
||||||
git remote add manga-site-origin https://gitea.04080616.xyz/yiekheng/sunnymh-manga-site.git
|
git submodule update --init --recursive
|
||||||
|
|
||||||
# archive the existing working copy, then subtree-add from the remote
|
|
||||||
mv manga-dl manga-dl.bak && rm -rf manga-dl.bak/.git # keep local-only files like .env, .browser-data
|
|
||||||
git subtree add --prefix=manga-dl manga-dl-origin main --squash
|
|
||||||
# then copy .env / .browser-data / cookies.txt / debug/ back into manga-dl/
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Day-to-day:
|
Day-to-day inside a sub-project:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# pull upstream changes for one sub-project
|
cd manga-dl
|
||||||
git subtree pull --prefix=manga-dl manga-dl-origin main --squash
|
# sub-dir has its own .git file pointing to ../.git/modules/manga-dl/
|
||||||
|
# `git log`, `git status`, `git commit`, `git push` all talk to the sub-repo's remote (sunnymh-manga-dl.git)
|
||||||
# push umbrella-side edits back to the sub-repo's remote
|
git pull origin main
|
||||||
git subtree push --prefix=manga-dl manga-dl-origin main
|
# edit, commit, push — this goes to the sub-repo's remote, NOT the umbrella
|
||||||
```
|
```
|
||||||
|
|
||||||
Local-only files that must NOT be pushed to the sub-repo remote (already in each sub-repo's own `.gitignore`): `.env`, `manga-dl/.browser-data/`, `manga-dl/cookies.txt`, `manga-site/node_modules/`, `manga-site/.next/`, `manga-site/tsconfig.tsbuildinfo`.
|
After a sub-repo is updated, bump the pinned SHA in the umbrella:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd .. # back to umbrella root
|
||||||
|
git add manga-dl # stages the new submodule SHA
|
||||||
|
git commit -m "Bump manga-dl to <short-sha>"
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
Pull upstream updates that bumped submodule SHAs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git pull
|
||||||
|
git submodule update --recursive # check out the SHAs the umbrella now points at
|
||||||
|
```
|
||||||
|
|
||||||
|
Local-only files inside each submodule (gitignored at the sub-repo level, never pushed anywhere): `.env`, `manga-dl/.browser-data/`, `manga-dl/cookies.txt`, `manga-site/node_modules/`, `manga-site/.next/`, `manga-site/tsconfig.tsbuildinfo`, `manga-site/.claude/`, `manga-site/.agents/`, `manga-site/reference/`.
|
||||||
|
|
||||||
|
The umbrella also has a root-level `.env` — shared R2 + DB credentials, single source of truth. It's untracked (not in a remote). Sub-projects currently still read their own `.env` copies; see the migration note in `MEMORY.md` / conversation history.
|
||||||
|
|
||||||
## Cross-project invariants
|
## Cross-project invariants
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user