diff --git a/AGENTS.md b/AGENTS.md index fd42ece..372c61d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -87,6 +87,8 @@ When you make a mistake, get corrected, or discover something about this codebas 3. If this fix is a workflow rather than a rule, put it in `.claude/skills/` and link it from here. 4. Include the change in the same commit and mention it in your summary. 5. A skill rule broken twice becomes a script check (a `scripts/` test or a skill-script check), not more prose. +6. Before adding a line, look for one on the same topic: sharpen or extend that one rather than adding a near-duplicate. +7. Keep the log to 17 entries at most. Over the cap, first merge entries that share a cause, then drop the lowest-value ones: one-offs unlikely to recur, rules a test or script now enforces, and entries about code that no longer exists. ## Failure log @@ -94,11 +96,9 @@ When you make a mistake, get corrected, or discover something about this codebas - Sync upstream only through `/sync-repo`, and verify its baseline against the real tree before porting: an earlier sync silently skipped a whole upstream release (the `3-implement-review` skill) while the recorded version froze. Update the baseline with `.claude/skills/sync-repo/set-synced.mjs`, never with a shell pipe over the decrypted body. - After a sync merge, run `npm test` before trusting a "clean" file: when upstream and plan2code fixed the same bug, `git merge-file` keeps both copies without a conflict (a sync once left `let pattern` declared twice in `app.js`, caught only by `parse-check`). - When extracting upstream files in Git Bash, run `git show :` with `MSYS_NO_PATHCONV=1` and `C:/` style paths (never `/c/`): path conversion rewrites `origin/main:.readme/x.md` into `origin\main;.readme\x.md`, the show fails, and the merge silently runs against an empty "theirs". Check every extracted file is non-empty before merging. -- After a sync, grep the result for the upstream owner slug and company name in any case (the `/sync-repo` body lists them): the rebrand map only rewrites URLs, so a bare owner slug once slipped through into `feedback-payload.mjs` (and its test) until it was fixed by hand to `jparkerweb/plan2code`. No upstream name may appear in plain text anywhere in this repo. +- After a sync, grep the result for every upstream name the rebrand map can miss (the `/sync-repo` body lists them): the owner slug and company name in any case, the bare brand word inside identifiers and fixtures, and the ticket key followed by anything, not only digits. Each slipped through once: an owner slug in `feedback-payload.mjs` and its test (fixed by hand to `jparkerweb/plan2code`); in v2.7.0 a `KEPT__ENTRIES` constant, a `Dir` option, a `""` test folder and an owner slug in a git remote URL; in v2.8.0 git board fixtures built as `` `feature/-${11000 + i}-…` `` template literals, which a digits-only rewrite to `ABC-` misses. No upstream name may appear in plain text anywhere in this repo. - Keep plan2code's ticket-free `commit-msg.mjs` (``, `AI Assisted`) in every `/sync-repo`: upstream's ticket-from-branch rule was ported by mistake once and removed in v2.6.0. - When a new first-run dialog is added to the web console, set its seen flag in `scripts/capture-screenshots.mjs`'s `looks.json` too: the Welcome dialog once covered the regenerated dashboard screenshots until `welcomeSeen: true` was added. -- After a sync, grep for the upstream brand word on its own too, not only the full product name: the rebrand map misses a bare brand word inside identifiers and fixtures (a `KEPT__ENTRIES` constant, a `Dir` option, a `""` test folder, an owner slug in a git remote URL), and v2.7.0's sync let all four through until the residual grep caught them. -- After a sync, grep for the upstream ticket key followed by anything, not only by digits: v2.8.0's git board fixtures built branch names as `` `feature/-${11000 + i}-…` `` template literals, which a digits-only rewrite to `ABC-` misses. - Import `scripts/skill-script-helpers.mjs` in any test that builds git fixtures for a skill script or `git-repo.mjs`: it scrubs the whole test process's git config, so fixtures, imported modules and spawned scripts agree. Mixed configs broke `git plan switch` once (a global `core.autocrlf=true` checked fixtures out with CRLF the scrubbed script read as changed). - Before deleting a test file that upstream split or removed, diff plan2code's copy against the rebranded upstream base and port the plan2code-only tests: v2.7.0's split of the web console suite would otherwise have dropped seven hardening tests (now in `scripts/test-web-console-hardening.mjs`). - Register a new skill in `install.js` `SOURCE_PROMPTS` before running its `scripts/test-script-.mjs`: importing `scripts/skill-script-helpers.mjs` rebuilds `skills/` and prunes any skill folder `install.js` does not list, so the script under test vanishes. diff --git a/src/plan2code-init-update.md b/src/plan2code-init-update.md index fa9ae25..f8482c5 100644 --- a/src/plan2code-init-update.md +++ b/src/plan2code-init-update.md @@ -75,6 +75,9 @@ When you make a mistake, get corrected, or discover something about this codebas 2. Keep it specific to this repo. General advice belongs nowhere. 3. If this fix is a workflow rather than a rule, put it in `.claude/skills/` and link it from here. 4. Include the change in the same commit and mention it in your summary. +5. A rule broken twice becomes an automated check (a test, a lint rule or a script), not more prose. +6. Before adding a line, look for one on the same topic: sharpen or extend that one rather than adding a near-duplicate. +7. Keep the log to 17 entries at most. Over the cap, first merge entries that share a cause, then drop the lowest-value ones: one-offs unlikely to recur, rules a test or script now enforces, and entries about code that no longer exists. ## Failure log @@ -85,8 +88,12 @@ When you make a mistake, get corrected, or discover something about this codebas If the section is missing, flag it: > "Your Keeping this file current section is missing. Want me to add it?" +If it exists but lacks any of rules 5 to 7, offer to add them (keep the repo's own wording of rules it already has). + If user confirms, add/update the section before proceeding. If user declines, continue. +**Tidy the log** on every run, per rules 6 and 7: find entries that share a topic or cause, and, over 17 entries, the lowest-value ones. Propose merges (each merged line, and the lines it replaces) and removals (each with its reason) as one preview; apply only on yes. Nothing to merge and at or under 17: say so in one line. + Proceed to Step 2. --- @@ -149,7 +156,7 @@ Present the user with update options: | Testing | Commands? Fixtures? Mocking? | | Environment | Local/CI/deploy? Env vars/files? | | Rules | Project-wide or specific? Why? | -| Failure Log | What went wrong? Correct behaviour (imperative, one line)? | +| Failure Log | What went wrong? Correct behaviour (imperative, one line)? Merge into an entry on the same topic if one exists; over 17 entries, propose what to prune (rule 7). | | Other | "Tell me what to add." | | Sync & Maintain | Scope: all surfaces or specific? Then follow the Sync & Maintain section. | | Review | Per section: "Still accurate?" | diff --git a/src/plan2code-init.md b/src/plan2code-init.md index 0c7b39c..d871256 100644 --- a/src/plan2code-init.md +++ b/src/plan2code-init.md @@ -78,6 +78,9 @@ When you make a mistake, get corrected, or discover something about this codebas 2. Keep it specific to this repo. General advice belongs nowhere. 3. If this fix is a workflow rather than a rule, put it in `.claude/skills/` and link it from here. 4. Include the change in the same commit and mention it in your summary. +5. A rule broken twice becomes an automated check (a test, a lint rule or a script), not more prose. +6. Before adding a line, look for one on the same topic: sharpen or extend that one rather than adding a near-duplicate. +7. Keep the log to 17 entries at most. Over the cap, first merge entries that share a cause, then drop the lowest-value ones: one-offs unlikely to recur, rules a test or script now enforces, and entries about code that no longer exists. ## Failure log