-
Learn: When a non-obvious constraint causes a failure, leave a concise note here and a detailed comment at the relevant location
-
CLAUDE.mdis a symlink to this file, created bypnpm coworker -
Refer to yourself as "AI Coworker" in docs and comments, not by product or company name
-
Never add AI tool attribution or branding to PR descriptions, commit messages, or code comments
-
Do not install or use
ghCLI -
When a post-plan fix changes a documented decision, update the planning docs in the same commit
-
Copy to clipboard:
head -c -1 <<'EOF' | wl-copy content goes here EOF
- Routine Pre-PR Validation:
pnpm check:full, it wipes derived state and regenerates from scratch. If any fork clone has pending work, the wipe is skipped to prevent data loss — re-record or push fork changes first for a clean validation - Open a PR: Run
pnpm changesetto generate a changeset entry, then push the branch and present a clickable markdown link[title](url)where the URL is a GitHub compare URL (quick_pull=1). Base branch ismaster. Prefill "title" (concise, under 70 chars) and "body" (markdown with ## Why and ## Changes sections) - Fetch PR review comments: Use the GitHub REST API via curl. Fetch all three comment types (issue comments, reviews, and inline comments). Categorize feedback by actionability (action required / informational), not by source (human / bot). Reviewers reply asynchronously — poll every minute until comments arrive
The fork-scripts/ system uses a record/replay mechanism for deterministic builds of external repo forks. Each fork lives in a <name>-fork/ directory with a config.json specifying upstream URL, fork URL, merge refs, and workspace config. Scripts in fork-scripts/ are generic and accept the fork directory as their first argument.
Each <name>-fork/ contains:
config.json— upstream URL, fork URL, refs to merge, cloneDir, workspace include/excludepins/— committed to git (manifest + counted resolutions + local patches), regenerated bypnpm fork:record <name>-forkpins/HEAD— expected final SHA after full replaypins/manifest— base SHA + merge refs (TSV, one per line)pins/res-N.resolution— conflict resolution for merge step N (counted format:--- pathfile headers,CONFLICT ours=N base=M theirs=K resolution=Rconflict headers followed by R resolution lines; parser is purely positional — reads counts and skips lines, never inspects content)pins/local-*.patch— local development patches (applied after merges + patch.sh)
<cloneDir>/— not in git — rebuilt from pins onpnpm install
- The developer may have pending work in a fork clone. Run
pnpm fork:status <name>-fork(exit 0 = safe to wipe, exit 1 = has custom work) before any operation that would destroy it.fork:record,fork:clean, andfork:resetalready guard against this automatically .pnpmfile.cjsscans all*-fork/config.jsondirectories and silently rewrites matching dependencies toworkspace:*when clones exist. Local fork packages override published ones without any visible change in package.json filespnpm installhas a side effect: if<name>-fork/pins/manifestexists but the clone does not, it automatically runsfork-scripts/replay.shto rebuild from pins. This is intentionalfork-scripts/patch.shrewrites fork package exports to point at.tssource instead of.d.ts, then creates a deterministic git commit (fixed author/date) so record and replay produce the same HEAD hash. This is why imports from fork packages resolve to TypeScript source files — it is not a bugfork-scripts/tsgo-filter.shis a bash wrapper aroundtsgothat filters out diagnostics originating from all*-fork/clone paths. Fork source may not satisfy this repo's strict tsconfig, so the wrapper suppresses those errors while still reporting errors in stack sourcepnpm fork:save <name>-fork [description]captures local work as a patch inpins/. Patches survive re-records and replayspnpm fork:recordregenerates the fork workspace entries inpnpm-workspace.yaml(between@generatedmarkers) from all*-fork/config.jsonfiles — manual edits to that section are overwritten on re-record
Work locally via ccc-fork/ first. Only push to the fork (phroi/ccc) when changes are validated against the stack. Do not open PRs against ckb-devrel/ccc prematurely — keep changes on the fork until they are production-ready and the maintainer decides to upstream.
- Develop and test in
ccc-fork/ccc/on thewipbranch - When ready, use
pnpm fork:push ccc-forkto cherry-pick commits onto a PR branch - Push the PR branch to
phroi/cccfor review - Add the PR number to
refsinccc-fork/config.json— order PRs by target branch from upstream to downstream, so each group merges cleanly onto its base before the next layer begins - Run
pnpm fork:record ccc-forkandpnpm check:fullto verify - Only open an upstream PR against
ckb-devrel/cccwhen the maintainer explicitly decides to upstream
reference/ contains read-only clones (project knowledge, dependency sources, etc.) fetched via pnpm reference. To refresh, just re-run pnpm reference. If a task requires knowledge of an external repo not yet cloned, add it to reference/clone.sh and run pnpm reference to fetch it for consultation
- Always compare CKB scripts using full
Script.eq()(codeHash + hashType + args), never justcodeHash. Partial comparison silently matches wrong scripts