@punks/cli 1.0.7 → 2.0.0-beta.1

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 +2 -2
  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 +14368 -3445
  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 +17 -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,225 +0,0 @@
1
- # `punks` Requirements
2
-
3
- This document captures the durable requirements agreed for the `punks` CLI so the implementation can evolve without losing the product contract.
4
-
5
- ## Goal
6
-
7
- `punks` is an AI-first scaffolding CLI for agent-ready projects.
8
-
9
- It should:
10
-
11
- - scaffold the right AI operating context for the current project phase
12
- - keep pre-boilerplate flows lightweight and language-agnostic
13
- - keep repo-aware setup deterministic once a repo and stack exist
14
- - emit operator prompts that guide the next agent through the current gate
15
-
16
- ## Core Principles
17
-
18
- - The lifecycle is explicit.
19
- - Pre-boilerplate scaffolding is stage-driven.
20
- - Repo-aware setup is pack-driven.
21
- - Skill selection is curated by the CLI, not exposed as a raw chooser.
22
- - Shared bundled assets come from this repo, not network fetches at runtime.
23
-
24
- ## Command Contract
25
-
26
- `punks scaffold` is the lifecycle index. It explains the available scaffold phases and is no longer an alias for repo setup.
27
-
28
- The current scaffold namespace is:
29
-
30
- - `punks scaffold init`
31
- requirements gate; scaffolds `requirements-grill`, `write-backlog`, and seeds the wiki tree
32
- - `punks scaffold backlog`
33
- backlog gate; currently prints guidance only
34
- - `punks scaffold setup`
35
- repo-aware setup; detects technologies, resolves packs, and emits prompts/manifests/hooks
36
-
37
- ## Pre-Boilerplate Contract
38
-
39
- `punks scaffold init` and `punks scaffold backlog` assume the operator is already inside the target workspace or repository folder.
40
-
41
- They should:
42
-
43
- - copy only their exact stage-owned skills into `.agents/skills/`
44
- - overwrite those scaffolded files on rerun for idempotency
45
- - let `init` seed the dedicated wiki tree early so later planning/docs skills have a concrete schema root
46
- - avoid pack detection, stack evaluation, or other side effects beyond the minimal repo-shape sniff needed to choose `apps/wiki` vs `wiki`
47
- - print a fixed operator prompt to stdout that explains how to use the newly scaffolded skills
48
- - make the requirements grill the canonical gate before backlog creation, with `write-backlog` available after the grill handoff closes
49
-
50
- They should not:
51
-
52
- - write a root `AGENTS.md`
53
- - scan for PRDs yet
54
- - create issues, call external services, or mutate anything beyond the bundled scaffold files they own
55
-
56
- The dedicated wiki tree is part of that bundled stage output:
57
-
58
- - monorepo-shaped target => `apps/wiki/`
59
- - single-repo target => `wiki/`
60
-
61
- That wiki tree is not the same thing as `docs/`. It owns specs, raw inputs, and synthesized domain knowledge.
62
-
63
- ## Repo-Aware Setup Contract
64
-
65
- `punks scaffold setup` remains the deterministic repo-aware scaffold flow.
66
-
67
- It should:
68
-
69
- - detect repo facts, not ask the agent to invent them
70
- - resolve those facts to predefined Devpunks packs
71
- - scaffold the shared AI setup
72
- - emit instructions/specs the next agent can use to generate repo-scoped prompts and subagent config
73
-
74
- The CLI must stay deterministic at the detection/mapping layer and flexible at the final repo-reconciliation layer.
75
-
76
- ## Repository Model
77
-
78
- `punks scaffold setup` must support both:
79
-
80
- - monorepos
81
- - single-repo package layouts
82
-
83
- Repo shape remains an invariant used during scaffold generation and must stay overrideable with:
84
-
85
- - `auto`
86
- - `monorepo`
87
- - `single`
88
-
89
- ## Detection Contract
90
-
91
- Initial setup detection is JS/TS manifest based.
92
-
93
- Primary sources:
94
-
95
- - repo `package.json` files discovered recursively, with ignore rules for generated/non-source trees
96
-
97
- Initial technology mapping:
98
-
99
- - `next` -> `nextjs`, `react`
100
- - `react`, `react-dom` -> `react`
101
- - `@tanstack/react-query` and related query packages -> `tanstack-query`
102
- - `elysia` -> `elysia`
103
- - `@trpc/*` -> `trpc`
104
- - `drizzle-orm`, `drizzle-kit` -> `drizzle`
105
- - `better-auth` -> `better-auth`
106
- - `turbo` -> `turborepo`
107
- - `effect`, `@effect/*` -> `effect`
108
-
109
- `drizzle` is data-layer detection only. It must not imply Effect skills or Effect source references unless the `effect` pack is selected independently.
110
-
111
- ## Pack Contract
112
-
113
- Pack resolution happens at pack level only during `punks scaffold setup`.
114
-
115
- The CLI must never ask the user or agent to choose raw skills in the repo-aware setup flow.
116
-
117
- ### Default packs
118
-
119
- Default packs are always preselected and visually distinguished. They are not removable.
120
-
121
- Current default packs:
122
-
123
- - `docs`
124
- `docs-maintenance`
125
- - `planning`
126
- `grill-me`, `create-spec`, `create-plan`, `implement-spec`
127
- - `subagents`
128
- `domain-plan`, `domain-execute`, `parallel-task`, `swarm-planner`
129
- - `quality`
130
- `tdd`, `simplify`
131
- - `research`
132
- `parallel-research`
133
- - `requirements`
134
- `requirements-grill`, `write-backlog`
135
-
136
- ### Surface packs
137
-
138
- Frontend-oriented skills should be grouped into a single detected frontend surface pack:
139
-
140
- - `frontend`
141
- `agent-browser`, `frontend-design`, `web-design-guidelines`
142
-
143
- Framework/data packs may layer on top of that surface:
144
-
145
- - `react`
146
- `async-react-patterns`, `react-domain-structure`, `vercel-composition-patterns`, `vercel-react-best-practices`
147
- - `nextjs`
148
- `next-best-practices`, `next-cache-components`
149
- - `tanstack-query`
150
- `tanstack-query`
151
-
152
- Backend-oriented agnostic skills should be grouped into a single detected backend surface pack:
153
-
154
- - `backend`
155
- `backend-domain-structure`, `backend-recoverable-actions`, `logging-best-practices`
156
-
157
- ## Prompt Contract
158
-
159
- Pre-boilerplate commands use fixed stdout operator prompts.
160
-
161
- `punks scaffold setup` must not hardcode all final repo-scoped prompts as static bundled prompt bodies. Instead it should:
162
-
163
- - directly scaffold only shared global harness prompts
164
- - emit prompt specs for root/docs/workspace scopes
165
- - instruct the next agent how to turn those specs into final scoped `AGENTS.md` files
166
-
167
- ## Subagent Manifest Contract
168
-
169
- `punks scaffold setup` must emit structured guidance for `.agents/subagents/manifest.mjs`.
170
-
171
- That guidance must let the next agent derive:
172
-
173
- - which specialists should exist
174
- - owned paths
175
- - guidance files
176
- - packs
177
- - explicit skills
178
- - scope boundaries
179
-
180
- It should also scaffold the neutral harness-sync layer around that manifest:
181
-
182
- - shared hooks under `.agents/hooks/`
183
- - harness sync entrypoint under `.agents/scripts/sync-subagents.mjs`
184
- - generated harness-native agent/config/mirror surfaces for `.claude`, `.codex`, `.cursor`, and `.opencode`
185
-
186
- ## Tool Bootstrap Contract
187
-
188
- If a bundled skill or scaffold baseline depends on a global external tool, the CLI should model that dependency explicitly and ensure the tool is installed during `punks scaffold setup`.
189
-
190
- Current examples:
191
-
192
- - `agent-browser`
193
- - `opensrc`
194
- - `portless`
195
-
196
- The scaffold output should also record the resolved tool requirements in a machine-readable manifest.
197
-
198
- `punks scaffold setup` should check base required tools before repo detection so missing `skills` or `portless` is surfaced immediately. Tools required only by selected packs can be checked after pack confirmation.
199
-
200
- Scaffold output should not preselect concrete opensrc repositories. The generated post-scaffold instructions should require the next agent to identify the core detected libraries whose source behavior matters, ask the user when that set is ambiguous, and run `opensrc path <package>` or `opensrc path owner/repo` for only that focused set.
201
-
202
- ## Lint Scaffold Contract
203
-
204
- The shipped starter/root lint baseline should exclude generated and non-source surfaces by default, including:
205
-
206
- - all lock files
207
- - all dot-directories
208
- - generated agent/harness folders unless a target repo explicitly opts them back into lint scope
209
-
210
- When scaffold guidance leads an agent to adopt Oxlint or Oxfmt, it must tell the agent to replace existing lint/format entrypoints deliberately: package scripts, task pipelines, CI, editor/docs references, and agent hooks should agree on the new tools.
211
-
212
- Until additional lint/format stacks are supported, repo-aware setup should emit Oxlint specs/starter config only when `oxlint` is declared in scanned package manifests and emit the Oxfmt/Oxlint format hook only when `oxfmt` is declared. Repos without those packages should get no lint/format scaffold surfaces.
213
-
214
- ## Dedicated CLI Repo Contract
215
-
216
- The standalone private `wearedevpunks/cli` repo remains the source of truth for:
217
-
218
- - pack registry
219
- - stage-owned scaffold prompts
220
- - subagent templates
221
- - hook base files
222
- - root/shared prompt assets
223
- - examples
224
-
225
- The public `wearedevpunks/skills` repo remains the source of truth for the shareable skill directories. This private CLI syncs that public tree into local `skills/` through a local cache clone and scaffolds from the local copy. Runtime scaffold behavior must not depend on network fetches.
@@ -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.