@punks/cli 1.0.7 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/AGENTS.md +4 -5
  2. package/README.md +1 -1
  3. package/dist/data/catalog/hooks.ts +7 -0
  4. package/dist/data/catalog/lint.ts +7 -21
  5. package/dist/data/catalog/packs.ts +263 -21
  6. package/dist/data/catalog/skills.ts +352 -38
  7. package/dist/data/hooks/require-tests-for-pr.mjs +206 -0
  8. package/dist/data/hooks.test.ts +29 -0
  9. package/dist/data/scripts/sync-subagents.mjs +64 -6
  10. package/dist/data/subagents/manifest.mjs +15 -49
  11. package/dist/index.js +14302 -3443
  12. package/dist/skills/agnostic/debug/debugging-phase/SKILL.md +87 -0
  13. package/dist/skills/agnostic/docs/docs-ingest-phase/SKILL.md +87 -0
  14. package/dist/skills/agnostic/docs/docs-ingest-phase/agents/openai.yaml +4 -0
  15. package/dist/skills/agnostic/docs/{docs-maintenance → docs-ingest-phase}/references/concept-pages.md +1 -1
  16. package/dist/skills/agnostic/docs/{docs-maintenance → docs-ingest-phase}/references/flow-pages.md +1 -1
  17. package/dist/skills/agnostic/docs/docs-ingest-phase/references/fumadocs-routing.md +88 -0
  18. package/dist/skills/agnostic/docs/docs-ingest-phase/references/repo-docs.md +38 -0
  19. package/dist/skills/agnostic/docs/docs-ingest-phase/references/wiki-ingest.md +131 -0
  20. package/dist/skills/agnostic/planning/create-plan/SKILL.md +11 -9
  21. package/dist/skills/agnostic/planning/create-spec/SKILL.md +20 -18
  22. package/dist/skills/agnostic/planning/delivery-phase/SKILL.md +82 -0
  23. package/dist/skills/agnostic/planning/goalify/EXAMPLES.md +72 -0
  24. package/dist/skills/agnostic/planning/goalify/SKILL.md +97 -0
  25. package/dist/skills/agnostic/planning/implement-spec/SKILL.md +3 -3
  26. package/dist/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +6 -0
  27. package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +23 -2
  28. package/dist/skills/agnostic/planning/resolve-debt-phase/SKILL.md +87 -0
  29. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +4 -3
  30. package/dist/skills/agnostic/requirements/requirements-grill/references/artifact-output.md +56 -2
  31. package/dist/skills/agnostic/requirements/requirements-grill/references/grilling-flow.md +16 -4
  32. package/dist/skills/agnostic/requirements/requirements-grill/references/wiki-output.md +6 -2
  33. package/dist/skills/agnostic/requirements/requirements-phase/SKILL.md +67 -0
  34. package/dist/skills/agnostic/research/review-phase/SKILL.md +99 -0
  35. package/package.json +16 -7
  36. package/dist/skills/agnostic/docs/docs-maintenance/SKILL.md +0 -193
  37. package/dist/skills/agnostic/docs/docs-maintenance/agents/openai.yaml +0 -4
  38. package/docs/README.md +0 -35
  39. package/docs/harness-intelligence-grill-log.md +0 -39
  40. package/docs/harness-intelligence-grill-status.md +0 -25
  41. package/docs/reference/dp-requirements.md +0 -225
  42. package/docs/runbooks/dp-cli-scaffolding.md +0 -261
@@ -1,261 +0,0 @@
1
- # `punks` CLI Scaffolding
2
-
3
- This repository owns the `punks` command used to scaffold AI operating context across the project lifecycle.
4
-
5
- For the durable product contract, see [requirements](../reference/dp-requirements.md). This runbook focuses on how the implementation behaves today.
6
-
7
- ## Current Command Surface
8
-
9
- - `punks scaffold`
10
- lifecycle index; prints the available scaffold phases
11
- - `punks scaffold init`
12
- scaffolds the requirements grill and backlog authoring skills, seeds the wiki tree, and prints the operator prompt
13
- - `punks scaffold backlog`
14
- prints the backlog-stage operator prompt; no backlog-stage packs are scaffolded today
15
- - `punks scaffold setup`
16
- runs the repo-aware scaffold flow: detect repo facts, resolve packs, confirm selection, and emit prompts/manifests/hooks
17
- - `punks update`
18
- refreshes scaffold-managed assets from the recorded `.devpunks/scaffold-manifest.json`
19
-
20
- ## `init` Behavior
21
-
22
- `punks scaffold init`:
23
-
24
- - writes into the current working directory by default
25
- - supports `-o, --output <path>` to target a different output directory
26
- - copies only:
27
- - `.agents/skills/requirements-grill`
28
- - `.agents/skills/write-backlog`
29
- - seeds a dedicated wiki tree:
30
- - monorepo-shaped target => `apps/wiki/`
31
- - single-repo target => `wiki/`
32
- - creates:
33
- - `<wiki-root>/AGENTS.md`
34
- - `<wiki-root>/CLAUDE.md` as a symlink mirror of `AGENTS.md`
35
- - `<wiki-root>/domains/.gitkeep`
36
- - `<wiki-root>/specs/.gitkeep`
37
- - `<wiki-root>/raw/assets/.gitkeep`
38
- - `<wiki-root>/raw/external/.gitkeep`
39
- - `<wiki-root>/raw/meetings/.gitkeep`
40
- - `<wiki-root>/index.md`
41
- - `<wiki-root>/log.md`
42
- - overwrites those scaffolded files on rerun
43
- - prints a fixed operator prompt that tells the next agent to run `requirements-grill`, then `write-backlog` after the grill handoff closes, and treat the scaffolded wiki root as distinct from `docs/`
44
-
45
- It does not:
46
-
47
- - write a root `AGENTS.md`
48
- - do full pack or technology detection
49
- - inspect existing repo shape only enough to choose `apps/wiki` vs `wiki`
50
- - inspect the PRD location
51
- - create external side effects
52
-
53
- ## `backlog` Behavior
54
-
55
- `punks scaffold backlog`:
56
-
57
- - writes into the current working directory by default
58
- - supports `-o, --output <path>` to target a different output directory
59
- - copies no stage-specific packs right now
60
- - prints a fixed operator prompt that makes the empty backlog stage explicit
61
-
62
- It does not scan for the PRD yet and does not scaffold planning skills.
63
-
64
- ## `setup` Behavior
65
-
66
- `punks scaffold setup` is the existing repo-aware scaffold flow.
67
-
68
- Current scope:
69
-
70
- - scan `package.json` manifests recursively across the target repo, with ignore rules for non-source trees
71
- - detect normalized technologies from dependency names
72
- - treat React, Next.js, and TanStack Query as separate frontend capability layers; React is the plain framework pack triggered by `react` / `react-dom` or implied by `next`, and pulls in `async-react-patterns` to prevent outdated manual async state modeling
73
- - include the `frontend` agnostic surface pack only when React or Next.js is detected; it carries product UI, browser validation, and frontend domain-structure guidance
74
- - include the `backend` agnostic surface pack when backend framework/data/auth packages are detected (`elysia`, `@trpc/*`, `drizzle-orm`, `drizzle-kit`, `better-auth`) or when package names/manifest paths clearly mark an API/backend/server/service workspace
75
- - assign backend packs only to backend-looking workspace prompt specs; do not add backend skills to frontend-looking workspaces just because backend/data/auth packs exist elsewhere in the repo
76
- - include backend logging guidance through `logging-best-practices` anywhere the backend surface pack applies, so backend prompts cover wide events, request context, and production debugging signals alongside structure and recoverability
77
- - keep Drizzle as data-layer guidance only; do not scaffold Effect skills or Effect opensrc references from Drizzle unless `effect` / `@effect/*` is also detected
78
- - keep all non-surface agnostic skill packs mandatory (`debug`, `docs`, `planning`, `quality`, `research`, `requirements`, `subagents`)
79
- - detect monorepo signals from `pnpm-workspace.yaml`, `turbo.json`, root workspaces, and workspace package count
80
- - resolve predefined packs from those facts
81
- - run a branded interactive confirmation flow
82
- - print a human summary plus optional JSON confirmation result to stdout
83
- - support `-i, --input <path>` to scan a different repository root
84
- - support `-o, --output <path>` to target a different output location
85
- - support `--json` to print the full machine-readable scaffold payload on demand
86
- - support `--repo-shape auto|monorepo|single` to override repo-shape detection when needed
87
- - support `--baseline stable|bundled` to choose the scaffold content baseline
88
- - support `--refresh-baseline` to refetch the stable remote baseline instead of reusing the cache
89
- - copy shared prompt/manifest assets, selected skill directories, shared hook files, harness sync scripts, and subagent templates
90
- - generate harness-native agent/config/mirror surfaces for `.claude`, `.codex`, `.cursor`, and `.opencode`
91
- - emit prompt specs, selected lint asset specs, subagent manifest specs, a required-tools manifest, and an agent handoff file
92
- - write a paste-ready next-agent prompt file and try to copy it to the clipboard automatically
93
- - include `portless` in the required tools manifest so follow-up agents can standardize local dev URLs across worktrees and avoid raw port collisions
94
- - include `skills` in the required tools manifest so follow-up agents can install/update public skill entrypoints such as `dp-cli`
95
- - check the base required tools (`portless`, `skills`) at the start of setup before repo detection, then check selected-pack tools after pack confirmation
96
- - include `debug-agent` through the default debug pack and install/verify the `debug-agent` CLI without running `debug-agent init`, because the CLI already scaffolds the project-local skill
97
- - scaffold Oxlint specs/starter config only when scanned package manifests declare `oxlint`, and scaffold the `format-edited-file` Oxfmt/Oxlint hook only when manifests declare `oxfmt`; repos without those tools keep their existing lint/format setup untouched
98
- - scaffolded hooks infer the target repo package manager from `packageManager` first, then lockfiles, so Oxfmt/Oxlint execution does not hardcode the CLI repo's package manager
99
- - select language packs separately from framework packs; TypeScript is selected from a `typescript` package dependency or nested `.ts` / `.tsx` files, and Python is selected from nested `.py` files, while ignoring root config files plus vendor, virtualenv, scaffold, docs, examples, scripts, `opensrc`, cache, and build output
100
- - seed Python subagent templates that combine the Python language skills into `python-app`, `python-async`, and `python-testing` specialists
101
- - seed a read-only `code-review` subagent template that uses `simplify` for changed-code cleanup review and `improve-codebase-architecture` for grounded architecture-friction findings
102
-
103
- If `-o, --output` points at a path that does not exist yet, `punks scaffold setup` creates it before writing the generated files.
104
-
105
- ## `setup` Output Contract
106
-
107
- After confirmation, `punks scaffold setup` writes:
108
-
109
- - `.agents/AGENTS.md`
110
- - `.agents/hooks/*`
111
- - `.agents/scripts/sync-subagents.mjs`
112
- - `.agents/skills/*`
113
- - `.claude/skills` as a symlink to `.agents/skills`
114
- - `.devpunks/AGENT-HANDOFF.md`
115
- - `.devpunks/AGENT-SYSTEM-PROMPT.md`
116
- - `.devpunks/required-tools.json`
117
- - `.devpunks/specs/lint/assets.json` when `oxlint` is declared
118
- - `.devpunks/specs/lint/selection.json` when `oxlint` is declared
119
- - `.devpunks/specs/lint/README.md` when `oxlint` is declared
120
- - `.devpunks/specs/lint/oxlint-starter.json` when `oxlint` is declared and no root Oxlint config already exists
121
- - `.devpunks/specs/prompts/shared-agents.md`
122
- - `.devpunks/specs/prompts/root.md`
123
- - `.devpunks/specs/prompts/docs.md`
124
- - `.devpunks/specs/prompts/apps/*/prompt.md`
125
- - `.devpunks/specs/prompts/packages/*/prompt.md`
126
- - `.devpunks/specs/subagents/manifest-spec.json`
127
- - `.agents/subagents/manifest.prompt.md`
128
- - `.agents/subagents/manifest.mjs`
129
- - generated harness surfaces under `.claude/`, `.codex/`, `.cursor/`, `.opencode/`
130
- - `.devpunks/scaffold-manifest.json`
131
-
132
- It does **not** write final root/docs/workspace `AGENTS.md` files yet. Those remain authored by the next agent from the generated prompt specs.
133
-
134
- After scaffold completes, the CLI writes `.devpunks/AGENT-SYSTEM-PROMPT.md`, tries to copy that prompt to the clipboard, and ends with a short terminal section telling the operator to paste that generated prompt into the next agent.
135
-
136
- Scaffolded guidance treats `portless` as the local-development URL baseline. Root/handoff guidance tells follow-up agents to prefer stable `*.localhost` subdomains over raw `localhost:<port>` values in env examples, endpoint defaults, callback URLs, allowed origins, CORS, and app-to-app proxy targets. Scoped prompts should repeat portless guidance only when that workspace directly owns URL, origin, callback, CORS, or proxy configuration.
137
-
138
- Scaffolded guidance does not emit concrete opensrc repository refs. The post-scaffold agent must identify the detected core libraries whose source behavior matters for prompt, plan, lint, or implementation decisions, ask the user when the priority is ambiguous, then run `opensrc path <package>` or `opensrc path owner/repo` for that focused set.
139
-
140
- Root prompt guidance routes code review requests to findings-first review with precise file/line references. It tells review agents to use `simplify` for clarity, naming, duplication, derivable state, and unnecessary abstraction, and to use `improve-codebase-architecture` only when observed review friction justifies candidate refactors or follow-up RFCs.
141
-
142
- When the next agent authors those final prompt files, each root/docs/workspace `AGENTS.md` should be treated as the neutral source of truth and mirrored by a sibling `CLAUDE.md` symlink. `.agents/AGENTS.md` remains the shared global neutral source, and `.claude/CLAUDE.md` should mirror it.
143
-
144
- Keep `.agents/skills/` as the main skill directory. Only `.claude/skills` is generated as a compatibility symlink; Codex, Cursor, and OpenCode should read skills from `.agents/skills` instead of maintaining `.codex/skills`, `.cursor/skills`, or `.opencode/skills` mirrors.
145
-
146
- It also does **not** mutate the repo's final Oxlint config. Lint is scaffolded as selected pack-owned assets plus placement guidance only when `oxlint` is already present in scanned package manifests, so the follow-up agent can fit the final `.oxlintrc.json` shape to the real repo layout. If the agent adopts Oxlint or Oxfmt, it must replace existing lint/format setup deliberately by updating package scripts, task pipelines, editor/docs references, CI, and agent hooks together instead of leaving stale ESLint/Prettier/Biome entrypoints behind.
147
-
148
- The scaffolded starter baseline excludes lock files and dot-directories by default so generated/vendor surfaces do not get linted as product code.
149
-
150
- ## `update` Behavior
151
-
152
- `punks update` is the maintenance path after `punks scaffold setup`.
153
-
154
- Current scope:
155
-
156
- - reads only `.devpunks/scaffold-manifest.json`
157
- - uses the recorded `finalPacks` as the update source of truth
158
- - re-scans package manifests to refresh repo facts and detect pack drift
159
- - renders the expected scaffold output into a temporary directory before touching the repo
160
- - diffs managed files with `diff`/jsdiff unified patches
161
- - asks before writing by default
162
- - supports `-i, --input <path>` to target a scaffolded repo root
163
- - supports `--check` to write nothing and exit nonzero when managed updates are available
164
- - supports `--write` to apply without prompting
165
- - supports `--json` to print the machine-readable update result
166
- - supports `--baseline stable|bundled` and `--refresh-baseline`, matching setup behavior
167
- - restores missing managed files that still belong to the current scaffold output
168
- - reports stale managed files from the old manifest but does not delete them
169
- - installs/ensures required tools when applying updates, matching setup behavior
170
-
171
- `punks update` updates scaffold-managed assets such as `.agents/AGENTS.md`, selected skills, prompt/lint/subagent specs, hook/script files, harness surfaces, required-tools metadata, handoff prompts, and `.devpunks/scaffold-manifest.json`.
172
-
173
- It does **not** silently accept a newly resolved pack set. When current package manifests resolve to different packs than the recorded manifest, update reports pack drift and prints an operator prompt for an agent to rerun `punks scaffold setup` intentionally. It also reports baseline drift when the active baseline version differs from the version recorded in `.devpunks/scaffold-manifest.json`.
174
-
175
- ## Dynamic Baselines
176
-
177
- The npm package is the executable engine. Scaffoldable content resolves through a baseline:
178
-
179
- - default: latest remote stable baseline from `wearedevpunks/cli` GitHub releases
180
- - fallback: bundled baseline shipped in npm when offline, invalid, or unavailable
181
- - forced fallback: `--baseline bundled` or `DP_BASELINE=bundled`
182
- - forced refresh: `--refresh-baseline` or `DP_BASELINE_REFRESH=1`
183
- - local testing: `DP_BASELINE_URL=file:///absolute/path/to/scaffold-baseline`
184
-
185
- Baseline artifacts include dynamic scaffoldable data:
186
-
187
- - `data/catalog/packs.json`
188
- - `data/catalog/skills.json`
189
- - `data/catalog/tools.json`
190
- - `data/catalog/hooks.json`
191
- - `data/catalog/lint-assets.json`
192
- - `data/hooks/`
193
- - `data/scripts/`
194
- - `data/subagents/`
195
- - `skills/`
196
-
197
- New packs in a baseline release appear in CLI pack resolution/output without an npm publish when they use the existing pack fields: `id`, `category`, `triggerPackages`, `skills`, `hooks`, `lintAssets`, `promptSurfaces`, and `promptDetails`. Brand-new detection algorithms still require an npm CLI release.
198
-
199
- Baseline release tags must never reuse npm semver tags. Use the `baseline/stable/*` namespace for baseline content releases and keep npm executable releases on `v*` tags.
200
-
201
- Build and publish the stable baseline release assets with:
202
-
203
- ```bash
204
- bun run baseline:build
205
- bun run baseline:publish
206
- ```
207
-
208
- `baseline:build` creates `dist/baseline/scaffold-baseline.json` and `dist/baseline/scaffold-baseline.tgz`. `baseline:publish` creates a GitHub release tag under `baseline/stable/*` and uploads both assets.
209
-
210
- Publish npm executable releases with `bun run release:publish` from a clean worktree after authenticating with npm:
211
-
212
- ```bash
213
- npm login --registry=https://registry.npmjs.org/
214
- npm whoami
215
- ```
216
-
217
- The npm account must have publish access to `@punks/cli`; otherwise npm may report a confusing scoped-package 404 during `npm publish`.
218
-
219
- ## CLI Self-Update Detection
220
-
221
- The CLI may start best-effort startup checks on normal command startup. The requested command must render immediately; checks run in a detached worker and are rate-limited by a local cache marker to at most once per 12 hours by default. The worker checks the npm package version for `@punks/cli`, and it checks the `dp-cli` skill through the `skills` CLI. It only prints advisory install/update commands. Startup must never install or update packages/skills while another CLI command is starting, and it must never run or suggest plain root `skills update`. These checks are separate from `punks update`, which updates scaffold-managed repo assets.
222
-
223
- - checks `https://registry.npmjs.org/%40punks%2Fcli/latest`
224
- - compares that dist-tag version with the bundled CLI version
225
- - prints the inferred package-manager update command only when the registry version is newer
226
- - silently skips the notice when npm is unreachable, the registry response is invalid, or the command is `--help` / `--version`
227
- - skips in CI and when `DP_NO_UPDATE_CHECK=1`
228
- - supports `DP_UPDATE_TAG=next` for canary/operator testing against another dist-tag
229
- - supports `DP_STARTUP_CHECK_INTERVAL_MS=0` to force the detached worker during local testing
230
-
231
- To test the built command locally without preparing another repo first, use the committed fixtures:
232
-
233
- ```bash
234
- bun run build
235
- bun ./dist/index.js update -i test-fixtures/single-package --check
236
- bun ./dist/index.js update -i test-fixtures/monorepo-root --check
237
- bun ./dist/index.js update -i test-fixtures/root-with-src-monorepo/src --check
238
- ```
239
-
240
- Those fixtures include minimal `.devpunks/scaffold-manifest.json` files and intentionally omit the generated managed assets, so `--check` should report missing managed files and exit nonzero.
241
-
242
- ## Content Base
243
-
244
- The standalone CLI repo is the canonical source of scaffolded baseline content.
245
-
246
- Bundled source-of-truth assets live under:
247
-
248
- - `skills/`
249
- - `src/data/subagents/`
250
- - `src/data/hooks/`
251
- - `src/data/scripts/`
252
- - `src/data/catalog/`
253
- - `src/content/stage-scaffold.ts`
254
-
255
- `skills/` is refreshed from the public [wearedevpunks/skills](https://github.com/wearedevpunks/skills) repo through a shallow local cache clone. That public repo remains the Vercel skills CLI interface, not the full scaffold baseline source. Refresh local skills with:
256
-
257
- ```bash
258
- bun run sync:skills
259
- ```
260
-
261
- The sync command replaces only `skills/` and overwrites any local changes there.