@punks/cli 2.0.0-beta.3 → 2.0.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 (31) hide show
  1. package/AGENTS.md +4 -0
  2. package/dist/data/catalog/hooks.ts +0 -7
  3. package/dist/data/catalog/packs.ts +31 -2
  4. package/dist/data/catalog/skills.ts +15 -7
  5. package/dist/data/hooks/format-edited-file.mjs +26 -5
  6. package/dist/data/hooks.test.ts +0 -29
  7. package/dist/data/scripts/sync-subagents.mjs +29 -87
  8. package/dist/data/subagents/manifest.mjs +9 -9
  9. package/dist/data/subagents/manifest.test.ts +40 -0
  10. package/dist/index.js +3280 -1779
  11. package/dist/skills/agnostic/planning/create-spec/references/discovery.md +3 -3
  12. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +1 -1
  13. package/dist/skills/agnostic/requirements/requirements-grill/references/wiki-output.md +1 -1
  14. package/dist/skills/{agnostic/docs → phases}/docs-ingest-phase/SKILL.md +16 -16
  15. package/dist/skills/phases/docs-ingest-phase/references/concept-pages.md +70 -0
  16. package/dist/skills/phases/docs-ingest-phase/references/flow-pages.md +56 -0
  17. package/dist/skills/phases/docs-ingest-phase/references/fumadocs-routing.md +76 -0
  18. package/dist/skills/{agnostic/docs → phases}/docs-ingest-phase/references/wiki-ingest.md +5 -5
  19. package/dist/skills/{agnostic/planning → phases}/resolve-debt-phase/SKILL.md +4 -4
  20. package/package.json +12 -3
  21. package/dist/skills/agnostic/docs/docs-ingest-phase/references/concept-pages.md +0 -48
  22. package/dist/skills/agnostic/docs/docs-ingest-phase/references/flow-pages.md +0 -41
  23. package/dist/skills/agnostic/docs/docs-ingest-phase/references/fumadocs-routing.md +0 -88
  24. /package/dist/skills/{agnostic/debug → phases}/debugging-phase/SKILL.md +0 -0
  25. /package/dist/skills/{agnostic/planning → phases}/delivery-phase/SKILL.md +0 -0
  26. /package/dist/skills/{agnostic/docs → phases}/docs-ingest-phase/agents/openai.yaml +0 -0
  27. /package/dist/skills/{agnostic/docs → phases}/docs-ingest-phase/references/repo-docs.md +0 -0
  28. /package/dist/skills/{agnostic/planning → phases}/goalify/EXAMPLES.md +0 -0
  29. /package/dist/skills/{agnostic/planning → phases}/goalify/SKILL.md +0 -0
  30. /package/dist/skills/{agnostic/requirements → phases}/requirements-phase/SKILL.md +0 -0
  31. /package/dist/skills/{agnostic/research → phases}/review-phase/SKILL.md +0 -0
package/AGENTS.md CHANGED
@@ -6,4 +6,8 @@ This app owns the `punks`/`dp` executable, repo detection flow, local scaffold a
6
6
 
7
7
  Keep consumer-repo product logic out of the CLI. The future backend owns registry, provenance, auth, telemetry, and artifact access; the CLI remains the local scanner, cache, prompt/skill/hook placer, and filesystem writer.
8
8
 
9
+ For direct CLI UX, packaging, and release behavior guidance, inspect:
10
+
11
+ - `opensrc path cevr/sentry-cli` (`https://github.com/cevr/sentry-cli`)
12
+
9
13
  If work here changes operator workflow, setup, or AI scaffolding behavior, update `docs/README.md` and `docs/runbooks/dp-cli-scaffolding.md` in the same task.
@@ -15,11 +15,4 @@ export const hookCatalog = [
15
15
  "Shared hook that auto-formats edited JS/TS/JSON files and lint-checks product files after tool use.",
16
16
  sourcePath: "hooks/format-edited-file.mjs",
17
17
  },
18
- {
19
- id: "require-tests-for-pr",
20
- harness: "shared",
21
- outputPath: ".agents/hooks/require-tests-for-pr.mjs",
22
- description: "Shared hook that blocks PR creation while tests are failing.",
23
- sourcePath: "hooks/require-tests-for-pr.mjs",
24
- },
25
18
  ] as const satisfies ReadonlyArray<HookDefinition>;
@@ -1,8 +1,9 @@
1
1
  import type { PackCategory, PackId } from "../../core/models";
2
2
  import type { LintAssetId } from "./lint";
3
3
  import type { SkillId } from "./skills";
4
+ import type { ScaffoldExampleRepository } from "@punks/scaffold";
4
5
 
5
- export type PackHookId = "format-edited-file" | "require-tests-for-pr";
6
+ export type PackHookId = "format-edited-file";
6
7
  export type PackPromptSurfaceId =
7
8
  | "shared-agents"
8
9
  | "root-prompt-spec"
@@ -20,6 +21,7 @@ export interface PackCatalogEntry {
20
21
  readonly hooks: ReadonlyArray<PackHookId>;
21
22
  readonly promptSurfaces: ReadonlyArray<PackPromptSurfaceId>;
22
23
  readonly promptDetails: ReadonlyArray<string>;
24
+ readonly exampleRepositories?: ReadonlyArray<ScaffoldExampleRepository>;
23
25
  }
24
26
 
25
27
  export const packCatalog = [
@@ -100,6 +102,33 @@ export const packCatalog = [
100
102
  hooks: [],
101
103
  promptSurfaces: ["shared-agents", "root-prompt-spec", "workspace-prompt-spec"],
102
104
  promptDetails: ["shared effect authoring baseline", "workspace service/layer rules"],
105
+ exampleRepositories: [
106
+ {
107
+ repo: "AnswerOverflow/AnswerOverflow",
108
+ url: "https://github.com/AnswerOverflow/AnswerOverflow",
109
+ packs: [{ uid: "effect", version: "^3.20.0" }],
110
+ },
111
+ {
112
+ repo: "rhyssullivan/executor",
113
+ url: "https://github.com/rhyssullivan/executor",
114
+ packs: [{ uid: "effect", version: "4.0.0-beta.59" }],
115
+ },
116
+ {
117
+ repo: "alchemy-run/alchemy-effect",
118
+ url: "https://github.com/alchemy-run/alchemy-effect",
119
+ packs: [{ uid: "effect", version: ">=4.0.0-beta.66 || >=4.0.0" }],
120
+ },
121
+ {
122
+ repo: "anomalyco/opencode",
123
+ url: "https://github.com/anomalyco/opencode",
124
+ packs: [{ uid: "effect", version: "4.0.0-beta.65" }],
125
+ },
126
+ {
127
+ repo: "pingdotgg/t3code",
128
+ url: "https://github.com/pingdotgg/t3code",
129
+ packs: [{ uid: "effect", version: "4.0.0-beta.59" }],
130
+ },
131
+ ],
103
132
  },
104
133
  {
105
134
  id: "elysia",
@@ -281,7 +310,7 @@ export const packCatalog = [
281
310
  "Shared JavaScript / TypeScript language pack for hook and language-level scaffold assets.",
282
311
  skills: ["quality-types"],
283
312
  lintAssets: [],
284
- hooks: ["format-edited-file", "require-tests-for-pr"],
313
+ hooks: ["format-edited-file"],
285
314
  promptSurfaces: [],
286
315
  promptDetails: [],
287
316
  },
@@ -52,6 +52,14 @@ export const skillCatalog = [
52
52
  framework: "better-auth",
53
53
  requiresTools: [],
54
54
  },
55
+ {
56
+ id: "better-auth-security-best-practices",
57
+ sourceDirectory: "skills/frameworks/better-auth/better-auth-security-best-practices",
58
+ tier: "framework",
59
+ language: "typescript",
60
+ framework: "better-auth",
61
+ requiresTools: [],
62
+ },
55
63
  {
56
64
  id: "create-plan",
57
65
  sourceDirectory: "skills/agnostic/planning/create-plan",
@@ -70,7 +78,7 @@ export const skillCatalog = [
70
78
  },
71
79
  {
72
80
  id: "delivery-phase",
73
- sourceDirectory: "skills/agnostic/planning/delivery-phase",
81
+ sourceDirectory: "skills/phases/delivery-phase",
74
82
  tier: "agnostic",
75
83
  language: null,
76
84
  framework: null,
@@ -86,7 +94,7 @@ export const skillCatalog = [
86
94
  },
87
95
  {
88
96
  id: "debugging-phase",
89
- sourceDirectory: "skills/agnostic/debug/debugging-phase",
97
+ sourceDirectory: "skills/phases/debugging-phase",
90
98
  tier: "agnostic",
91
99
  language: null,
92
100
  framework: null,
@@ -94,7 +102,7 @@ export const skillCatalog = [
94
102
  },
95
103
  {
96
104
  id: "docs-ingest-phase",
97
- sourceDirectory: "skills/agnostic/docs/docs-ingest-phase",
105
+ sourceDirectory: "skills/phases/docs-ingest-phase",
98
106
  tier: "agnostic",
99
107
  language: null,
100
108
  framework: null,
@@ -158,7 +166,7 @@ export const skillCatalog = [
158
166
  },
159
167
  {
160
168
  id: "goalify",
161
- sourceDirectory: "skills/agnostic/planning/goalify",
169
+ sourceDirectory: "skills/phases/goalify",
162
170
  tier: "agnostic",
163
171
  language: null,
164
172
  framework: null,
@@ -278,7 +286,7 @@ export const skillCatalog = [
278
286
  },
279
287
  {
280
288
  id: "requirements-phase",
281
- sourceDirectory: "skills/agnostic/requirements/requirements-phase",
289
+ sourceDirectory: "skills/phases/requirements-phase",
282
290
  tier: "agnostic",
283
291
  language: null,
284
292
  framework: null,
@@ -286,7 +294,7 @@ export const skillCatalog = [
286
294
  },
287
295
  {
288
296
  id: "resolve-debt-phase",
289
- sourceDirectory: "skills/agnostic/planning/resolve-debt-phase",
297
+ sourceDirectory: "skills/phases/resolve-debt-phase",
290
298
  tier: "agnostic",
291
299
  language: null,
292
300
  framework: null,
@@ -294,7 +302,7 @@ export const skillCatalog = [
294
302
  },
295
303
  {
296
304
  id: "review-phase",
297
- sourceDirectory: "skills/agnostic/research/review-phase",
305
+ sourceDirectory: "skills/phases/review-phase",
298
306
  tier: "agnostic",
299
307
  language: null,
300
308
  framework: null,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { createHash } from "node:crypto";
4
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
+ import { accessSync, constants, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
5
5
  import os from "node:os";
6
6
  import path from "node:path";
7
7
  import { spawnSync } from "node:child_process";
@@ -87,11 +87,32 @@ function runCommand(root, args, stdio = "ignore") {
87
87
  }
88
88
 
89
89
  function commandExists(command) {
90
- return (
91
- spawnSync("which", [command], {
92
- stdio: "ignore",
93
- }).status === 0
90
+ const pathValue = process.env.PATH ?? process.env.Path;
91
+ if (!pathValue) {
92
+ return false;
93
+ }
94
+
95
+ const isWindows = os.platform() === "win32";
96
+ const pathEntries = pathValue.split(isWindows ? ";" : ":").filter(Boolean);
97
+ const pathExtensions = isWindows
98
+ ? (process.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean)
99
+ : [""];
100
+ const commandExtensions = isWindows && path.extname(command) === "" ? pathExtensions : [""];
101
+ const hasPathSegment = command.includes("/") || command.includes("\\");
102
+ const candidates = (hasPathSegment ? [""] : pathEntries).flatMap((entry) =>
103
+ commandExtensions.map((extension) =>
104
+ hasPathSegment ? `${command}${extension}` : path.join(entry, `${command}${extension}`),
105
+ ),
94
106
  );
107
+
108
+ return candidates.some((candidate) => {
109
+ try {
110
+ accessSync(candidate, isWindows ? constants.F_OK : constants.X_OK);
111
+ return true;
112
+ } catch {
113
+ return false;
114
+ }
115
+ });
95
116
  }
96
117
 
97
118
  function packageManagerFromPackageJson(root) {
@@ -31,35 +31,6 @@ const tempRepo = (files: Record<string, string>) => {
31
31
  };
32
32
 
33
33
  describe("scaffolded hooks", () => {
34
- it("runs the PR test gate with the repo package manager", async () => {
35
- const { testHooks } = await loadHookModule("require-tests-for-pr.mjs");
36
-
37
- expect(
38
- testHooks.testCommand?.(
39
- tempRepo({
40
- "package.json": JSON.stringify({ packageManager: "bun@1.3.5" }),
41
- }),
42
- ),
43
- ).toEqual(["bun", "run", "test"]);
44
-
45
- expect(
46
- testHooks.testCommand?.(
47
- tempRepo({
48
- "package.json": JSON.stringify({ packageManager: "pnpm@10.0.0" }),
49
- }),
50
- ),
51
- ).toEqual(["pnpm", "--silent", "test"]);
52
-
53
- expect(
54
- testHooks.testCommand?.(
55
- tempRepo({
56
- "package.json": "{}",
57
- "package-lock.json": "",
58
- }),
59
- ),
60
- ).toEqual(["npm", "--silent", "test"]);
61
- });
62
-
63
34
  it("executes formatter tools with the repo package manager", async () => {
64
35
  const { testHooks } = await loadHookModule("format-edited-file.mjs");
65
36
 
@@ -52,7 +52,7 @@ const cursorManagedComment =
52
52
  const opencodeManagedComment =
53
53
  "<!-- Generated by scripts/sync-subagents.mjs. Edit .agents/subagents/manifest.mjs instead. -->";
54
54
 
55
- function buildCodexAgentConfig({ hasFormatHook, hasTestHook }) {
55
+ function buildCodexAgentConfig({ hasFormatHook }) {
56
56
  const lines = [
57
57
  "[agents]",
58
58
  "max_threads = 6",
@@ -74,16 +74,6 @@ function buildCodexAgentConfig({ hasFormatHook, hasTestHook }) {
74
74
  );
75
75
  }
76
76
 
77
- if (hasTestHook) {
78
- lines.push(
79
- "PreToolUse = [",
80
- ' { matcher = "Bash|.*[Pp]ull.?[Rr]equest.*|.*[Pp][Rr].?[Cc]reate.*|.*create[_-]?pull[_-]?request.*", hooks = [',
81
- ' { type = "command", command = "node \\"$(git rev-parse --show-toplevel)/.codex/hooks/require-tests-for-pr.mjs\\" codex", statusMessage = "Checking tests before PR creation", timeout = 600 },',
82
- " ] },",
83
- "]",
84
- );
85
- }
86
-
87
77
  if (hasFormatHook) {
88
78
  lines.push(
89
79
  "PostToolUse = [",
@@ -98,86 +88,39 @@ function buildCodexAgentConfig({ hasFormatHook, hasTestHook }) {
98
88
  return lines.join("\n");
99
89
  }
100
90
 
101
- function buildClaudeSettingsConfig({ hasFormatHook, hasTestHook }) {
91
+ function buildClaudeSettingsConfig({ hasFormatHook }) {
102
92
  return {
103
- hooks: {
104
- ...(hasTestHook
105
- ? {
106
- PreToolUse: [
107
- {
108
- matcher: "mcp__github__create_pull_request",
109
- hooks: [
110
- {
111
- type: "command",
112
- command:
113
- 'node "$CLAUDE_PROJECT_DIR"/.claude/hooks/require-tests-for-pr.mjs claude',
114
- timeout: 600,
115
- },
116
- ],
117
- },
118
- {
119
- matcher: "Bash",
120
- hooks: [
121
- {
122
- type: "command",
123
- command:
124
- 'node "$CLAUDE_PROJECT_DIR"/.claude/hooks/require-tests-for-pr.mjs claude',
125
- timeout: 600,
126
- },
127
- ],
128
- },
129
- ],
130
- }
131
- : {}),
132
- ...(hasFormatHook
133
- ? {
134
- PostToolUse: [
135
- {
136
- matcher: "Edit|Write|MultiEdit",
137
- hooks: [
138
- {
139
- type: "command",
140
- command:
141
- 'node "$CLAUDE_PROJECT_DIR"/.claude/hooks/format-edited-file.mjs claude',
142
- timeout: 30,
143
- },
144
- ],
145
- },
146
- ],
147
- }
148
- : {}),
149
- },
93
+ hooks: hasFormatHook
94
+ ? {
95
+ PostToolUse: [
96
+ {
97
+ matcher: "Edit|Write|MultiEdit",
98
+ hooks: [
99
+ {
100
+ type: "command",
101
+ command: 'node "$CLAUDE_PROJECT_DIR"/.claude/hooks/format-edited-file.mjs claude',
102
+ timeout: 30,
103
+ },
104
+ ],
105
+ },
106
+ ],
107
+ }
108
+ : {},
150
109
  };
151
110
  }
152
111
 
153
- function buildCursorHooksConfig({ hasFormatHook, hasTestHook }) {
112
+ function buildCursorHooksConfig({ hasFormatHook }) {
154
113
  return {
155
114
  version: 1,
156
- hooks: {
157
- ...(hasTestHook
158
- ? {
159
- beforeMCPExecution: [
160
- {
161
- command: "node .cursor/hooks/require-tests-for-pr.mjs cursor",
162
- },
163
- ],
164
- beforeShellExecution: [
165
- {
166
- command: "node .cursor/hooks/require-tests-for-pr.mjs cursor",
167
- },
168
- ],
169
- }
170
- : {}),
171
- ...(hasFormatHook
172
- ? {
173
- afterFileEdit: [
174
- {
175
- command: "node .cursor/hooks/format-edited-file.mjs cursor",
176
- },
177
- ],
178
- }
179
- : {}),
180
- },
115
+ hooks: hasFormatHook
116
+ ? {
117
+ afterFileEdit: [
118
+ {
119
+ command: "node .cursor/hooks/format-edited-file.mjs cursor",
120
+ },
121
+ ],
122
+ }
123
+ : {},
181
124
  };
182
125
  }
183
126
 
@@ -394,7 +337,7 @@ async function syncHookSurface() {
394
337
  await mkdir(cursorHooksDir, { recursive: true });
395
338
  await mkdir(opencodePluginsDir, { recursive: true });
396
339
 
397
- for (const hookName of ["format-edited-file.mjs", "require-tests-for-pr.mjs"]) {
340
+ for (const hookName of ["format-edited-file.mjs"]) {
398
341
  const sourcePath = path.join(sharedHooksPath, hookName);
399
342
  const targetPaths = [
400
343
  path.join(codexHooksDir, hookName),
@@ -448,7 +391,6 @@ async function main() {
448
391
  await mkdir(path.dirname(cursorHooksJsonPath), { recursive: true });
449
392
  const availableHooks = {
450
393
  hasFormatHook: await pathExists(path.join(sharedHooksPath, "format-edited-file.mjs")),
451
- hasTestHook: await pathExists(path.join(sharedHooksPath, "require-tests-for-pr.mjs")),
452
394
  };
453
395
  await writeFile(codexConfigPath, buildCodexAgentConfig(availableHooks), "utf8");
454
396
  await rm(path.join(codexDir, "hooks.json"), { force: true });
@@ -4,7 +4,7 @@ const capabilityPacks = {
4
4
  skills: [
5
5
  "next-best-practices",
6
6
  "async-react-patterns",
7
- "react-domain-structure",
7
+ "frontend-domain-structure",
8
8
  "vercel-react-best-practices",
9
9
  ],
10
10
  },
@@ -16,8 +16,8 @@ const capabilityPacks = {
16
16
  description: "UI implementation, browser testing, visual quality, and composition patterns.",
17
17
  skills: [
18
18
  "agent-browser",
19
- "frontend-design",
20
- "web-design-guidelines",
19
+ "design-taste-frontend",
20
+ "frontend-domain-structure",
21
21
  "vercel-composition-patterns",
22
22
  ],
23
23
  },
@@ -145,7 +145,7 @@ const agents = [
145
145
  "vercel-composition-patterns",
146
146
  "vercel-react-best-practices",
147
147
  "tanstack-query",
148
- "react-domain-structure",
148
+ "frontend-domain-structure",
149
149
  "simplify",
150
150
  ],
151
151
  boundaries: [
@@ -167,13 +167,13 @@ const agents = [
167
167
  "agent-browser",
168
168
  "next-best-practices",
169
169
  "next-cache-components",
170
- "frontend-design",
171
- "web-design-guidelines",
170
+ "design-taste-frontend",
171
+ "frontend-domain-structure",
172
172
  "async-react-patterns",
173
173
  "vercel-composition-patterns",
174
174
  "vercel-react-best-practices",
175
175
  "tanstack-query",
176
- "react-domain-structure",
176
+ "frontend-domain-structure",
177
177
  "simplify",
178
178
  ],
179
179
  boundaries: [
@@ -198,7 +198,7 @@ const agents = [
198
198
  "vercel-composition-patterns",
199
199
  "vercel-react-best-practices",
200
200
  "tanstack-query",
201
- "react-domain-structure",
201
+ "frontend-domain-structure",
202
202
  "simplify",
203
203
  ],
204
204
  boundaries: [
@@ -223,7 +223,7 @@ const agents = [
223
223
  "vercel-composition-patterns",
224
224
  "vercel-react-best-practices",
225
225
  "tanstack-query",
226
- "react-domain-structure",
226
+ "frontend-domain-structure",
227
227
  "simplify",
228
228
  ],
229
229
  boundaries: [
@@ -0,0 +1,40 @@
1
+ import path from "node:path";
2
+ import { pathToFileURL } from "node:url";
3
+
4
+ import { describe, expect, it } from "@effect/vitest";
5
+
6
+ import { knownSkillIds } from "../../content/skills";
7
+
8
+ describe("subagent manifest", () => {
9
+ it("references only bundled skill ids", async () => {
10
+ const manifestUrl = pathToFileURL(path.resolve(import.meta.dirname, "manifest.mjs")).toString();
11
+ const manifest = (await import(manifestUrl)) as {
12
+ readonly agents: ReadonlyArray<{
13
+ readonly skills?: ReadonlyArray<string>;
14
+ readonly packs?: ReadonlyArray<string>;
15
+ }>;
16
+ readonly capabilityPacks: Record<string, { readonly skills: ReadonlyArray<string> }>;
17
+ };
18
+ const bundledSkills = new Set(knownSkillIds);
19
+ const referencedSkills = new Set<string>();
20
+
21
+ for (const pack of Object.values(manifest.capabilityPacks)) {
22
+ for (const skill of pack.skills) {
23
+ referencedSkills.add(skill);
24
+ }
25
+ }
26
+
27
+ for (const agent of manifest.agents) {
28
+ for (const skill of agent.skills ?? []) {
29
+ referencedSkills.add(skill);
30
+ }
31
+ for (const packId of agent.packs ?? []) {
32
+ expect(manifest.capabilityPacks[packId]).toBeDefined();
33
+ }
34
+ }
35
+
36
+ expect([...referencedSkills].filter((skill) => !bundledSkills.has(skill)).toSorted()).toEqual(
37
+ [],
38
+ );
39
+ });
40
+ });