@punks/cli 1.0.1 → 1.0.3

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 (31) hide show
  1. package/README.md +47 -4
  2. package/dist/data/AGENTS.md +0 -6
  3. package/dist/data/catalog/hooks.ts +26 -0
  4. package/dist/data/catalog/lint.ts +11 -26
  5. package/dist/data/catalog/packs.ts +5 -3
  6. package/dist/data/catalog/skills.ts +9 -1
  7. package/dist/data/catalog/tools.ts +13 -1
  8. package/dist/data/scripts/sync-subagents.mjs +163 -120
  9. package/dist/data/subagents/manifest.mjs +148 -0
  10. package/dist/index.js +2589 -1944
  11. package/dist/skills/agnostic/backend/logging-best-practices/SKILL.md +127 -0
  12. package/dist/skills/agnostic/backend/logging-best-practices/rules/context.md +157 -0
  13. package/dist/skills/agnostic/backend/logging-best-practices/rules/pitfalls.md +118 -0
  14. package/dist/skills/agnostic/backend/logging-best-practices/rules/structure.md +193 -0
  15. package/dist/skills/agnostic/backend/logging-best-practices/rules/wide-events.md +113 -0
  16. package/dist/skills/agnostic/cli/dp-cli/SKILL.md +84 -0
  17. package/dist/skills/agnostic/cli/dp-cli/references/commands.md +33 -0
  18. package/dist/skills/agnostic/cli/dp-cli/references/post-command-flow.md +47 -0
  19. package/dist/skills/agnostic/debug/debug-agent/SKILL.md +184 -0
  20. package/dist/skills/agnostic/requirements/write-backlog/REFERENCE.md +1 -1
  21. package/dist/skills/languages/python/async-python-patterns/SKILL.md +735 -0
  22. package/dist/skills/languages/python/python-code-style/SKILL.md +360 -0
  23. package/dist/skills/languages/python/python-design-patterns/SKILL.md +433 -0
  24. package/dist/skills/languages/python/python-project-structure/SKILL.md +252 -0
  25. package/dist/skills/languages/python/python-testing-patterns/SKILL.md +622 -0
  26. package/dist/skills/languages/python/python-testing-patterns/references/advanced-patterns.md +411 -0
  27. package/dist/skills/languages/typescript/quality-types/SKILL.md +93 -0
  28. package/docs/README.md +14 -4
  29. package/docs/reference/dp-requirements.md +16 -1
  30. package/docs/runbooks/dp-cli-scaffolding.md +82 -10
  31. package/package.json +5 -2
@@ -72,7 +72,10 @@ Current scope:
72
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
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
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
- - keep all non-surface agnostic skill packs mandatory (`docs`, `planning`, `quality`, `research`, `requirements`, `subagents`)
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`)
76
79
  - detect monorepo signals from `pnpm-workspace.yaml`, `turbo.json`, root workspaces, and workspace package count
77
80
  - resolve predefined packs from those facts
78
81
  - run a branded interactive confirmation flow
@@ -81,11 +84,20 @@ Current scope:
81
84
  - support `-o, --output <path>` to target a different output location
82
85
  - support `--json` to print the full machine-readable scaffold payload on demand
83
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
84
89
  - copy shared prompt/manifest assets, selected skill directories, shared hook files, harness sync scripts, and subagent templates
85
90
  - generate harness-native agent/config/mirror surfaces for `.claude`, `.codex`, `.cursor`, and `.opencode`
86
91
  - emit prompt specs, selected lint asset specs, subagent manifest specs, a required-tools manifest, and an agent handoff file
87
92
  - write a paste-ready next-agent prompt file and try to copy it to the clipboard automatically
88
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
+ - 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
99
+ - seed Python subagent templates that combine the Python language skills into `python-app`, `python-async`, and `python-testing` specialists
100
+ - 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
89
101
 
90
102
  If `-o, --output` points at a path that does not exist yet, `punks scaffold setup` creates it before writing the generated files.
91
103
 
@@ -101,10 +113,10 @@ After confirmation, `punks scaffold setup` writes:
101
113
  - `.devpunks/AGENT-HANDOFF.md`
102
114
  - `.devpunks/AGENT-SYSTEM-PROMPT.md`
103
115
  - `.devpunks/required-tools.json`
104
- - `.devpunks/specs/lint/assets.json`
105
- - `.devpunks/specs/lint/selection.json`
106
- - `.devpunks/specs/lint/README.md`
107
- - `.devpunks/specs/lint/oxlint-starter.json` when no root Oxlint config already exists
116
+ - `.devpunks/specs/lint/assets.json` when `oxlint` is declared
117
+ - `.devpunks/specs/lint/selection.json` when `oxlint` is declared
118
+ - `.devpunks/specs/lint/README.md` when `oxlint` is declared
119
+ - `.devpunks/specs/lint/oxlint-starter.json` when `oxlint` is declared and no root Oxlint config already exists
108
120
  - `.devpunks/specs/prompts/shared-agents.md`
109
121
  - `.devpunks/specs/prompts/root.md`
110
122
  - `.devpunks/specs/prompts/docs.md`
@@ -120,13 +132,17 @@ It does **not** write final root/docs/workspace `AGENTS.md` files yet. Those rem
120
132
 
121
133
  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.
122
134
 
123
- Scaffolded guidance treats `portless` as the local-development URL baseline. Generated prompt specs and handoff text tell 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. In linked git worktrees, portless prefixes hostnames with the branch name, so local URLs must be modeled as stable origins that may vary by worktree. When a local frontend proxy targets another portless app, configure the proxy to rewrite the host/origin so the request reaches the intended service instead of looping back to the caller.
135
+ 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.
136
+
137
+ 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.
138
+
139
+ 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.
124
140
 
125
141
  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.
126
142
 
127
143
  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.
128
144
 
129
- It also does **not** mutate the repo's final Oxlint config. Lint is scaffolded as selected pack-owned assets plus placement guidance so the follow-up agent can fit the final `.oxlintrc.json` shape to the real repo layout.
145
+ 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.
130
146
 
131
147
  The scaffolded starter baseline excludes lock files and dot-directories by default so generated/vendor surfaces do not get linted as product code.
132
148
 
@@ -146,13 +162,69 @@ Current scope:
146
162
  - supports `--check` to write nothing and exit nonzero when managed updates are available
147
163
  - supports `--write` to apply without prompting
148
164
  - supports `--json` to print the machine-readable update result
165
+ - supports `--baseline stable|bundled` and `--refresh-baseline`, matching setup behavior
149
166
  - restores missing managed files that still belong to the current scaffold output
150
167
  - reports stale managed files from the old manifest but does not delete them
151
168
  - installs/ensures required tools when applying updates, matching setup behavior
152
169
 
153
170
  `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`.
154
171
 
155
- 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.
172
+ 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`.
173
+
174
+ ## Dynamic Baselines
175
+
176
+ The npm package is the executable engine. Scaffoldable content resolves through a baseline:
177
+
178
+ - default: latest remote stable baseline from `wearedevpunks/cli` GitHub releases
179
+ - fallback: bundled baseline shipped in npm when offline, invalid, or unavailable
180
+ - forced fallback: `--baseline bundled` or `DP_BASELINE=bundled`
181
+ - forced refresh: `--refresh-baseline` or `DP_BASELINE_REFRESH=1`
182
+ - local testing: `DP_BASELINE_URL=file:///absolute/path/to/scaffold-baseline`
183
+
184
+ Baseline artifacts include dynamic scaffoldable data:
185
+
186
+ - `data/catalog/packs.json`
187
+ - `data/catalog/skills.json`
188
+ - `data/catalog/tools.json`
189
+ - `data/catalog/hooks.json`
190
+ - `data/catalog/lint-assets.json`
191
+ - `data/hooks/`
192
+ - `data/scripts/`
193
+ - `data/subagents/`
194
+ - `skills/`
195
+
196
+ 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.
197
+
198
+ 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.
199
+
200
+ Build and publish the stable baseline release assets with:
201
+
202
+ ```bash
203
+ bun run baseline:build
204
+ bun run baseline:publish
205
+ ```
206
+
207
+ `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.
208
+
209
+ Publish npm executable releases with `bun run release:publish` from a clean worktree after authenticating with npm:
210
+
211
+ ```bash
212
+ npm login --registry=https://registry.npmjs.org/
213
+ npm whoami
214
+ ```
215
+
216
+ The npm account must have publish access to `@punks/cli`; otherwise npm may report a confusing scoped-package 404 during `npm publish`.
217
+
218
+ ## CLI Self-Update Detection
219
+
220
+ The CLI also performs best-effort startup checks on normal command startup. It checks the npm package version for `@punks/cli`, and it checks for the `dp-cli` skill through the global `skills` CLI, installing it when absent and updating it when present. These are separate from `punks update`, which updates scaffold-managed repo assets.
221
+
222
+ - checks `https://registry.npmjs.org/%40punks%2Fcli/latest`
223
+ - compares that dist-tag version with the bundled CLI version
224
+ - prints `npm install -g @punks/cli@latest` only when the registry version is newer
225
+ - silently skips the notice when npm is unreachable, the registry response is invalid, or the command is `--help` / `--version`
226
+ - skips in CI and when `DP_NO_UPDATE_CHECK=1`
227
+ - supports `DP_UPDATE_TAG=next` for canary/operator testing against another dist-tag
156
228
 
157
229
  To test the built command locally without preparing another repo first, use the committed fixtures:
158
230
 
@@ -167,7 +239,7 @@ Those fixtures include minimal `.devpunks/scaffold-manifest.json` files and inte
167
239
 
168
240
  ## Content Base
169
241
 
170
- The standalone CLI repo is the canonical source of scaffolded content.
242
+ The standalone CLI repo is the canonical source of scaffolded baseline content.
171
243
 
172
244
  Bundled source-of-truth assets live under:
173
245
 
@@ -178,7 +250,7 @@ Bundled source-of-truth assets live under:
178
250
  - `src/data/catalog/`
179
251
  - `src/content/stage-scaffold.ts`
180
252
 
181
- `skills/` is refreshed from the public [wearedevpunks/skills](https://github.com/wearedevpunks/skills) repo through a shallow local cache clone. Refresh it with:
253
+ `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:
182
254
 
183
255
  ```bash
184
256
  bun run sync:skills
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@punks/cli",
3
- "version": "1.0.1",
4
- "description": "DevPunks AI scaffolding CLI",
3
+ "version": "1.0.3",
4
+ "description": "Devpunks AI scaffolding CLI",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "devpunks": "dist/index.js",
@@ -15,8 +15,11 @@
15
15
  ],
16
16
  "scripts": {
17
17
  "build": "node ./scripts/build-dist.mjs",
18
+ "baseline:build": "bun ./scripts/build-baseline.mjs",
19
+ "baseline:publish": "node ./scripts/publish-baseline.mjs",
18
20
  "check-types": "tsc --noEmit",
19
21
  "dev": "bun run ./src/index.ts scaffold",
22
+ "local": "bun run build && bun run ./dist/index.js",
20
23
  "release:publish": "node ./scripts/publish-release.mjs",
21
24
  "sync:skills": "node ./scripts/sync-skills-repo.mjs",
22
25
  "test": "vitest run --config vitest.config.ts"