mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-09-17 16:22:23 -07:00
e57dad052c
Align release notes, version metadata, installation guidance, and maintainer documentation with the canonical skills workflow. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
5.6 KiB
5.6 KiB
Code Style & Gotchas
Part of AGENTS.md — project guidance for AI coding agents.
Code Style
- install.js: CommonJS, Node.js built-ins only (no external deps), ANSI colors via
COLORSconstant, readline-based prompts - plan2code-loop & plan2code-metrics: TypeScript + ESM, built with tsup (target ES2022, moduleResolution: bundler)
- External deps:
@inquirer/prompts,chalk,execa,ora - Interactive CLI via
@inquirer/prompts(select, input, confirm)
- External deps:
- File operations: Synchronous fs in all packages
Gotchas / Pitfalls
- Version sync: When adding a new version to
CHANGELOG.md, also updateversion.jsonandpackage.json(root) to match. CheckREADME.mdfor any version badges or references that need updating. The installer displays the version fromversion.jsonin its header. All three files (CHANGELOG.md,version.json,package.json) must always show the same version number. - CHANGELOG ordering: Entries in
CHANGELOG.mdmust be in reverse-chronological order — newest version at the top, oldest at the bottom. New entries are always inserted immediately after the file header. - CHANGELOG house format is not Keep a Changelog: version headings are
## vX.Y.Z— with avprefix and no date. The release date is recorded only inversion.json'sreleaseDate. Category headings carry emoji:### ✨ Added,### 🔧 Changed,### 🐛 Fixed,### 💥 Breaking,### 🗑️ Removed,### 📚 Documentation. Older entries contain one-off variants (🎁 Added,📦 Updated,📝 Documentation,🏎️ Improved,🧪 Testing) — do not introduce new ones. The.claude/skills/plan2code-changelog/skill automates version selection and formatting; use it rather than hand-rolling an entry. - PowerShell mangles the CHANGELOG emoji:
Get-Content/Select-Stringrender the###heading emoji as?under the default Windows console encoding, so a heading audit done that way reports garbage. ReadCHANGELOG.mdwith a file-read or grep tool instead. .claude/skills/is tracked, not ignored: repo-local skills (plan2code-changelog,plan2code-publish,sync-repo) live there and are committed. Nothing in.gitignoretouches.claude/, so a new skill only needsgit add. Per the Failure Log convention inAGENTS.md, a correction that is a workflow rather than a rule belongs here as a skill, linked from AGENTS.md — not as a Failure log line.- Loop
.gitignoresetup:ensureGitignore()runs at startup inController.run()as a pre-flight step, not just insidecreateTaskCommit(). This is critical for phase mode where the Node controller doesn't handle commits — without it,git add -Awould stage spec files. - Workflow file character limit: All
src/plan2code-*.mdfiles must be ≤ 11,000 characters. A husky pre-commit hook enforces this. The limit predates v2.2.0's single-format skill build and is retained as prompt-size discipline; generatedSKILL.mdfiles add a small YAML header. skills/is a committed build artifact: editsrc/, runnpm run build:skills, and commit the regenerated skills in the same change.npm testrunsinstall.js --verify-skillsand fails on missing, unexpected, or stale files. Never editskills/by hand.- Metrics internal prompts have no char limit: Files in
plan2code-metrics/src/prompts/are NOT subject to the 11,000 char limit — onlysrc/plan2code-*.mdconsumer-facing prompts are. - User Feedback table format: The
## User Feedbackmarkdown table inoverview.mdhas a strict format the collector regex depends on. Field names must be exactlyRating,Reason,Went Well,Went Poorly. Pipe characters in values must be escaped as\|. - PLAN-DRAFT confidence numbers are scraped by regex: when a
specs/<feature>/PLAN-DRAFT-*.mdcontains no<!-- METRICS_JSON ... -->comment,collector.tsfalls back to prose scraping (collector.ts:186-241). The overall-confidence pattern requires a literal%, but the four breakdown patterns (collector.ts:201-204) do not —/[Rr]equirements?[:\s|]+(\d{1,2})/and its siblings match a bare dimension word followed by whitespace, a colon, or a pipe and then digits. So a PLAN-DRAFT written by anything other than/plan2code-1-planPhase 7 must keep both the%sign and bareRequirements/Feasibility/Integration/Riskfollowed by a number off the page — including innocent table rows like| Requirements | 11 |. Otherwise the metrics pipeline records a planning-step confidence that no planning step produced./plan2code-0-pathfinderworks around this by hyphenating the labels (Requirements-clarity 22/25), which breaks the character class. - Reference file sizing guideline: Files in
src/plan2code-*-references/directories target ~100-200 lines each (soft guideline; evaluate splitting above 300). They are NOT subject to the 11,000 character limit. The pre-commit hook (validate-char-count.js) only checkssrc/plan2code-*.mdflat files — subdirectory contents are automatically excluded. - The splitting guideline has a hard ceiling — reference files cannot always be split: each new reference costs the orchestrator a
Read references/<file>.mdline plus its fallback blockquote (~150-200 chars), and orchestrators near the 11,000 limit have no room to spend. References now stay nested under every generated skill, so the old flat-file path-rewrite constraint no longer applies. When a reference legitimately exceeds 300 lines (e.g.plan2code-0-pathfinder-references/chart.md), that is an accepted trade-off, not an oversight.