@punks/cli 2.1.5 → 2.1.7

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.
package/AGENTS.md CHANGED
@@ -6,6 +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
+ When pushing a new npm executable release, update `CHANGELOG.md` first with a non-empty section for the exact `apps/cli/package.json` version. `bun run release:publish` must publish `@punks/cli`, push the matching `v<version>` tag, and create the GitHub release from that changelog entry. Baseline-only releases stay on `baseline/stable/*` and do not require package changelog entries.
10
+
9
11
  For direct CLI UX, packaging, and release behavior guidance, inspect:
10
12
 
11
13
  - `opensrc path cevr/sentry-cli` (`https://github.com/cevr/sentry-cli`)
package/README.md CHANGED
@@ -11,7 +11,7 @@ At runtime, scaffold content resolves from the latest stable GitHub release base
11
11
  - `punks scaffold`
12
12
  show the scaffold lifecycle index
13
13
  - `punks scaffold init`
14
- scaffold requirements/backlog skills and seed the initial wiki tree
14
+ choose a backlog provider, scaffold requirements/backlog skills, and seed the initial wiki tree
15
15
  - `punks scaffold setup`
16
16
  detect the target repo, confirm or auto-accept pack selection, and write repo-aware scaffold output
17
17
  - `punks report`
@@ -34,7 +34,7 @@ bun run baseline:build
34
34
 
35
35
  `bun run sync:skills` updates a local cache clone of `wearedevpunks/skills` and then replaces only `skills/`, overwriting any local changes there.
36
36
 
37
- `punks scaffold init` copies `.agents/skills/requirements-grill` and `.agents/skills/write-backlog`, seeds an initial wiki tree at `apps/wiki` for monorepos or `wiki` for single-repo layouts, and then prints a fixed post-command prompt. Agents should activate `$dp-cli`, reconcile generated init output with the real repo layout, and only start requirements/backlog generation when the user asks for that workflow.
37
+ `punks scaffold init` asks for the backlog provider, defaults to GitHub Projects/Issues, copies `.agents/skills/requirements-grill` and `.agents/skills/write-backlog`, seeds an initial Mermaid-enabled wiki tree at `apps/wiki` for monorepos or `wiki` for single-repo layouts, writes `<wiki-root>/backlog-provider.md`, and then prints a fixed post-command prompt. Agents should activate `$dp-cli`, reconcile generated init output with the real repo layout, keep the pinned backlog provider unless the user changes it, and only start requirements/backlog generation when the user asks for that workflow.
38
38
 
39
39
  `punks scaffold setup` scans the target repo from `cwd` or `-i`, resolves the active scaffold baseline, writes scaffold output into the scan root or `-o`, copies the selected baseline skills, resolves pack-owned lint assets into `.devpunks/specs/lint/`, and ensures required global tool prerequisites for those skills. Use `--yes` in non-interactive harnesses to accept the resolved default pack selection without prompts.
40
40
 
@@ -92,7 +92,7 @@ bun run release:publish
92
92
 
93
93
  `bun run baseline:publish` builds the current scaffold baseline, creates or updates the `baseline/stable/<date>-<sha>` GitHub release, and uploads the baseline manifest plus tarball. Use it when scaffold data changes but the npm executable does not need a new version.
94
94
 
95
- `bun run release:publish` builds the CLI, publishes a sanitized npm package from the built `dist/` output, updates the `latest` dist-tag, also updates `next` for latest releases, and pushes the matching `v<version>` git tag. Commit and push the version bump before running it; the script refuses dirty worktrees and existing tags that point at another commit. Set `NPM_TAG=beta` for beta prereleases without moving `latest`.
95
+ `bun run release:publish` builds the CLI, publishes a sanitized npm package from the built `dist/` output, updates the `latest` dist-tag, also updates `next` for latest releases, pushes the matching `v<version>` git tag, and creates the GitHub release from `CHANGELOG.md`. Commit the version bump and changelog entry before running it; the script refuses dirty worktrees, missing changelog entries, and existing tags that point at another commit. Set `NPM_TAG=beta` for beta prereleases without moving `latest`.
96
96
 
97
97
  Before npm releases, authenticate against the public npm registry:
98
98
 
@@ -299,7 +299,7 @@ export const packCatalog = [
299
299
  "python-testing-patterns",
300
300
  ],
301
301
  lintAssets: [],
302
- hooks: [],
302
+ hooks: ["format-edited-file"],
303
303
  promptSurfaces: [],
304
304
  promptDetails: [],
305
305
  },
@@ -7,11 +7,25 @@ import path from "node:path";
7
7
  import { spawnSync } from "node:child_process";
8
8
  import { fileURLToPath } from "node:url";
9
9
 
10
- const formattableSuffixes = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".json"]);
11
- const lintableSuffixes = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"]);
10
+ const javascriptFormattableSuffixes = new Set([
11
+ ".ts",
12
+ ".tsx",
13
+ ".js",
14
+ ".jsx",
15
+ ".mjs",
16
+ ".cjs",
17
+ ".json",
18
+ ]);
19
+ const javascriptLintableSuffixes = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"]);
20
+ const pythonFormattableSuffixes = new Set([".py"]);
21
+ const formattableSuffixes = new Set([
22
+ ...javascriptFormattableSuffixes,
23
+ ...pythonFormattableSuffixes,
24
+ ]);
12
25
  const ignoredParts = new Set([".git", "node_modules", ".next", "dist"]);
13
26
  const productRoots = new Set(["apps", "packages"]);
14
27
  const packageManagers = new Set(["bun", "pnpm", "npm", "yarn"]);
28
+ const backendWorkspaceSegments = new Set(["api", "backend", "server", "services"]);
15
29
 
16
30
  function readStdinJson() {
17
31
  try {
@@ -69,10 +83,14 @@ function isLintablePath(relativePath) {
69
83
  return (
70
84
  parts.length > 0 &&
71
85
  productRoots.has(parts[0]) &&
72
- lintableSuffixes.has(path.extname(relativePath))
86
+ javascriptLintableSuffixes.has(path.extname(relativePath))
73
87
  );
74
88
  }
75
89
 
90
+ function isPythonPath(relativePath) {
91
+ return pythonFormattableSuffixes.has(path.extname(relativePath));
92
+ }
93
+
76
94
  function runCommand(root, args, stdio = "ignore") {
77
95
  const result = spawnSync(args[0], args.slice(1), {
78
96
  cwd: root,
@@ -174,6 +192,60 @@ function toolCommand(root, tool, args) {
174
192
  return ["npx", tool, ...args];
175
193
  }
176
194
 
195
+ function nearestPythonProject(root, relativePath) {
196
+ const parts = relativePath.split("/");
197
+
198
+ for (let index = parts.length - 1; index > 0; index -= 1) {
199
+ const projectPath = parts.slice(0, index).join("/");
200
+ if (existsSync(path.join(root, projectPath, "pyproject.toml"))) {
201
+ return projectPath;
202
+ }
203
+ }
204
+
205
+ if (parts.length >= 2 && productRoots.has(parts[0]) && backendWorkspaceSegments.has(parts[1])) {
206
+ return `${parts[0]}/${parts[1]}`;
207
+ }
208
+
209
+ return ".";
210
+ }
211
+
212
+ function formatCommandForPath(root, relativePath) {
213
+ if (isPythonPath(relativePath)) {
214
+ return [
215
+ "uv",
216
+ "run",
217
+ "--project",
218
+ nearestPythonProject(root, relativePath),
219
+ "ruff",
220
+ "format",
221
+ relativePath,
222
+ ];
223
+ }
224
+
225
+ return toolCommand(root, "oxfmt", ["--write", relativePath]);
226
+ }
227
+
228
+ function lintCommandForPath(root, relativePath) {
229
+ if (isPythonPath(relativePath)) {
230
+ return [
231
+ "uv",
232
+ "run",
233
+ "--project",
234
+ nearestPythonProject(root, relativePath),
235
+ "ruff",
236
+ "check",
237
+ "--fix",
238
+ relativePath,
239
+ ];
240
+ }
241
+
242
+ if (!isLintablePath(relativePath)) {
243
+ return null;
244
+ }
245
+
246
+ return toolCommand(root, "oxlint", ["-c", ".oxlintrc.json", relativePath]);
247
+ }
248
+
177
249
  function formatAndLintFiles(root, filePaths) {
178
250
  const normalizedFiles = [];
179
251
 
@@ -189,7 +261,7 @@ function formatAndLintFiles(root, filePaths) {
189
261
  const lintFailed = [];
190
262
 
191
263
  for (const relativePath of normalizedFiles) {
192
- const formattedOk = runCommand(root, toolCommand(root, "oxfmt", ["--write", relativePath])).ok;
264
+ const formattedOk = runCommand(root, formatCommandForPath(root, relativePath)).ok;
193
265
 
194
266
  if (!formattedOk) {
195
267
  formatFailed.push(relativePath);
@@ -198,10 +270,8 @@ function formatAndLintFiles(root, filePaths) {
198
270
 
199
271
  formatted.push(relativePath);
200
272
 
201
- if (
202
- isLintablePath(relativePath) &&
203
- !runCommand(root, toolCommand(root, "oxlint", ["-c", ".oxlintrc.json", relativePath])).ok
204
- ) {
273
+ const lintCommand = lintCommandForPath(root, relativePath);
274
+ if (lintCommand !== null && !runCommand(root, lintCommand).ok) {
205
275
  lintFailed.push(relativePath);
206
276
  }
207
277
  }
@@ -594,6 +664,8 @@ export const FormatAndLintPlugin = async ({ client, worktree }) => {
594
664
  };
595
665
 
596
666
  export const testHooks = {
667
+ formatCommandForPath,
668
+ lintCommandForPath,
597
669
  toolCommand,
598
670
  };
599
671
 
@@ -1,4 +1,4 @@
1
- import { mkdtempSync, writeFileSync } from "node:fs";
1
+ import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
2
2
  import { tmpdir } from "node:os";
3
3
  import path from "node:path";
4
4
 
@@ -12,6 +12,11 @@ type HookModule = {
12
12
  tool: string,
13
13
  args: ReadonlyArray<string>,
14
14
  ) => ReadonlyArray<string>;
15
+ readonly formatCommandForPath?: (root: string, relativePath: string) => ReadonlyArray<string>;
16
+ readonly lintCommandForPath?: (
17
+ root: string,
18
+ relativePath: string,
19
+ ) => ReadonlyArray<string> | null;
15
20
  };
16
21
  };
17
22
 
@@ -24,6 +29,7 @@ const tempRepo = (files: Record<string, string>) => {
24
29
  const root = mkdtempSync(path.join(tmpdir(), "dp-hook-test-"));
25
30
 
26
31
  for (const [filePath, content] of Object.entries(files)) {
32
+ mkdirSync(path.dirname(path.join(root, filePath)), { recursive: true });
27
33
  writeFileSync(path.join(root, filePath), content);
28
34
  }
29
35
 
@@ -55,4 +61,32 @@ describe("scaffolded hooks", () => {
55
61
  ),
56
62
  ).toEqual(["pnpm", "exec", "oxlint", "-c", ".oxlintrc.json", "src/index.ts"]);
57
63
  });
64
+
65
+ it("routes Python backend files through Ruff in their project", async () => {
66
+ const { testHooks } = await loadHookModule("format-edited-file.mjs");
67
+ const root = tempRepo({
68
+ "apps/backend/pyproject.toml": '[project]\nname = "backend"\n',
69
+ "apps/backend/main.py": "print('hi')\n",
70
+ });
71
+
72
+ expect(testHooks.formatCommandForPath?.(root, "apps/backend/main.py")).toEqual([
73
+ "uv",
74
+ "run",
75
+ "--project",
76
+ "apps/backend",
77
+ "ruff",
78
+ "format",
79
+ "apps/backend/main.py",
80
+ ]);
81
+ expect(testHooks.lintCommandForPath?.(root, "apps/backend/main.py")).toEqual([
82
+ "uv",
83
+ "run",
84
+ "--project",
85
+ "apps/backend",
86
+ "ruff",
87
+ "check",
88
+ "--fix",
89
+ "apps/backend/main.py",
90
+ ]);
91
+ });
58
92
  });
@@ -40,6 +40,7 @@ const opencodeDir = path.join(repoRoot, ".opencode");
40
40
  const opencodeAgentsDir = path.join(opencodeDir, "agents");
41
41
  const opencodePluginsDir = path.join(opencodeDir, "plugins");
42
42
  const opencodeAgentsMirrorPath = path.join(opencodeDir, "AGENTS.md");
43
+ const opencodeConfigPath = path.join(repoRoot, "opencode.json");
43
44
 
44
45
  const managedHeader = [
45
46
  "# Generated by scripts/sync-subagents.mjs.",
@@ -124,6 +125,44 @@ function buildCursorHooksConfig({ hasFormatHook }) {
124
125
  };
125
126
  }
126
127
 
128
+ function buildOpenCodeConfig(existingConfig, { hasFormatHook }) {
129
+ const config = { ...existingConfig };
130
+
131
+ if (hasFormatHook) {
132
+ config.plugin = [
133
+ ...new Set([
134
+ ...(Array.isArray(config.plugin) ? config.plugin : []),
135
+ "./.opencode/plugins/format-edited-file.mjs",
136
+ ]),
137
+ ];
138
+ config.formatter = {
139
+ ...(typeof config.formatter === "object" && config.formatter !== null
140
+ ? config.formatter
141
+ : {}),
142
+ "harness-format-edited-file": {
143
+ command: ["node", ".agents/hooks/format-edited-file.mjs", "files", "$FILE"],
144
+ extensions: [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs", ".json", ".py"],
145
+ },
146
+ };
147
+ }
148
+
149
+ return {
150
+ $schema: "https://opencode.ai/config.json",
151
+ ...config,
152
+ };
153
+ }
154
+
155
+ async function readJsonFile(filePath) {
156
+ try {
157
+ return JSON.parse(await readFile(filePath, "utf8"));
158
+ } catch (error) {
159
+ if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
160
+ return {};
161
+ }
162
+ throw error;
163
+ }
164
+ }
165
+
127
166
  function getSkillNames(agent) {
128
167
  if (Array.isArray(agent.skills)) {
129
168
  return [...new Set(agent.skills)];
@@ -400,6 +439,13 @@ async function main() {
400
439
  "utf8",
401
440
  );
402
441
  await writeFile(cursorHooksJsonPath, encodeJson(buildCursorHooksConfig(availableHooks)), "utf8");
442
+ if (availableHooks.hasFormatHook || (await pathExists(opencodeConfigPath))) {
443
+ await writeFile(
444
+ opencodeConfigPath,
445
+ encodeJson(buildOpenCodeConfig(await readJsonFile(opencodeConfigPath), availableHooks)),
446
+ "utf8",
447
+ );
448
+ }
403
449
  await writeManagedFiles(claudeAgentsDir, "md", claudeFiles);
404
450
  await writeManagedFiles(codexAgentsDir, "toml", codexFiles);
405
451
  await writeManagedFiles(cursorAgentsDir, "md", cursorFiles);
package/dist/index.js CHANGED
@@ -52406,7 +52406,7 @@ var recordProductTelemetryEvent = (options9) => exports_Effect.gen(function* ()
52406
52406
 
52407
52407
  // package.json
52408
52408
  var name = "@punks/cli";
52409
- var version = "2.1.5";
52409
+ var version = "2.1.7";
52410
52410
  // src/telemetry/product.ts
52411
52411
  var git = (cwd, args2) => {
52412
52412
  try {
@@ -52670,7 +52670,7 @@ var renderCommandGuide = () => [
52670
52670
  "usage:",
52671
52671
  " \u2022 agents should activate `$dp-cli` before acting on `.devpunks` output",
52672
52672
  " \u2022 start with `punks scaffold` to inspect the lifecycle",
52673
- " \u2022 use `punks scaffold init` for requirements grilling, backlog authoring, and wiki schema seeding",
52673
+ " \u2022 use `punks scaffold init` to choose the backlog provider and seed requirements/wiki output",
52674
52674
  " \u2022 reconcile the seeded wiki into the real repo layout before writing durable docs",
52675
52675
  " \u2022 use `punks scaffold setup` for repo-aware pack detection after repo boilerplate is ready",
52676
52676
  " \u2022 use `punks update` after setup to pull newer scaffolded skills/prompts/manifests/hooks",
@@ -52678,7 +52678,7 @@ var renderCommandGuide = () => [
52678
52678
  " \u2022 reports open GitHub issues; authenticate with `gh auth login` or `GITHUB_TOKEN`",
52679
52679
  "",
52680
52680
  "operator notes:",
52681
- " \u2022 init copies only requirements/backlog skills and the initial wiki structure",
52681
+ " \u2022 init copies only requirements/backlog skills, backlog-provider pin, and the initial wiki structure",
52682
52682
  " \u2022 `setup` remains the repo-aware pack-driven scaffold flow",
52683
52683
  " \u2022 each command prints an operator-facing next-step prompt"
52684
52684
  ].join(`
@@ -52699,7 +52699,7 @@ var renderStageIntro = ({
52699
52699
  "",
52700
52700
  "usage:",
52701
52701
  " \u2022 agents should activate `$dp-cli` before following generated output",
52702
- " \u2022 use this to scaffold requirements grill/backlog skills and seed the initial wiki tree",
52702
+ " \u2022 use this to choose the backlog provider, scaffold requirements/backlog skills, and seed the initial wiki tree",
52703
52703
  " \u2022 reconcile the wiki into the real repo layout, such as `apps/wiki` in a monorepo",
52704
52704
  " \u2022 rerunning this command overwrites only the files for this stage",
52705
52705
  " \u2022 read the generated prompt/output and follow it before running repo-aware setup"
@@ -52733,14 +52733,14 @@ var renderScaffoldGuide = () => [
52733
52733
  "",
52734
52734
  "commands:",
52735
52735
  " \u203A punks scaffold init",
52736
- " \u2514 requirements gate: scaffold `requirements-grill`, `write-backlog`, and seed the wiki tree",
52736
+ " \u2514 requirements gate: pick backlog provider, scaffold `requirements-grill`/`write-backlog`, seed wiki",
52737
52737
  " \u203A punks scaffold setup",
52738
52738
  " \u2514 repo-aware setup: detect packs, scaffold prompts/manifests/hooks",
52739
52739
  "",
52740
52740
  "operator notes:",
52741
52741
  " \u2022 agents should activate `$dp-cli` before acting on generated scaffold output",
52742
52742
  " \u2022 `init` overwrites only its scaffolded skill files on rerun",
52743
- " \u2022 `init` seeds a wiki root that agents must reconcile with the real repo layout",
52743
+ " \u2022 `init` pins the backlog provider and seeds a wiki root agents must reconcile with the real repo layout",
52744
52744
  " \u2022 `setup` is the first repo-aware command in the lifecycle",
52745
52745
  " \u2022 setup output must be followed from `.devpunks`, not summarized from terminal text alone"
52746
52746
  ].join(`
@@ -53564,7 +53564,7 @@ var packCatalog = [
53564
53564
  "python-testing-patterns"
53565
53565
  ],
53566
53566
  lintAssets: [],
53567
- hooks: [],
53567
+ hooks: ["format-edited-file"],
53568
53568
  promptSurfaces: [],
53569
53569
  promptDetails: []
53570
53570
  },
@@ -54497,6 +54497,156 @@ var localMultiSelect = (options9) => {
54497
54497
  return exports_Prompt.run(prompt4).pipe(exports_Effect.map((values4) => values4.toSorted()));
54498
54498
  };
54499
54499
 
54500
+ // src/scaffold/single-select.ts
54501
+ var Action3 = taggedEnum();
54502
+ var figures3 = {
54503
+ arrowUp: text3("\u2191"),
54504
+ arrowDown: text3("\u2193"),
54505
+ bullet: text3("\u25C7"),
54506
+ pointer: text3("\u25C6"),
54507
+ stem: text3("\u2502"),
54508
+ tick: text3("\u25C6")
54509
+ };
54510
+ var eraseText3 = (text12, columns) => {
54511
+ if (columns === 0) {
54512
+ return cat2(eraseLine3, cursorTo3(0));
54513
+ }
54514
+ let rows = 0;
54515
+ for (const line4 of text12.split(/\r?\n/u)) {
54516
+ rows += 1 + Math.floor(Math.max(line4.length - 1, 0) / columns);
54517
+ }
54518
+ return eraseLines3(rows);
54519
+ };
54520
+ var entriesToDisplay3 = (cursor, total, maxVisible) => {
54521
+ let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));
54522
+ if (startIndex < 0) {
54523
+ startIndex = 0;
54524
+ }
54525
+ const endIndex = Math.min(startIndex + maxVisible, total);
54526
+ return { startIndex, endIndex };
54527
+ };
54528
+ var renderOutput9 = (message) => {
54529
+ const lines3 = message.split(/\r?\n/u);
54530
+ const [firstLine, ...rest] = lines3;
54531
+ return vsep2([
54532
+ annotate2(figures3.bullet, cyanBright2).pipe(cat2(space2), cat2(annotate2(text3(firstLine ?? ""), bold2))),
54533
+ ...rest.map((line4) => annotate2(figures3.stem, blackBright2).pipe(cat2(space2), cat2(space2), cat2(text3(line4)))),
54534
+ annotate2(figures3.stem, blackBright2).pipe(cat2(space2), cat2(space2))
54535
+ ]);
54536
+ };
54537
+ var withStem2 = (prefix) => prefix.pipe(cat2(space2), cat2(space2));
54538
+ var renderChoiceDescription4 = (choice4, isHighlighted) => choice4.description && isHighlighted ? char3("-").pipe(cat2(space2), cat2(text3(choice4.description)), annotate2(blackBright2)) : empty38;
54539
+ var renderChoices4 = (state, options9) => {
54540
+ const toDisplay = entriesToDisplay3(state.index, options9.choices.length, options9.maxPerPage);
54541
+ const documents = [];
54542
+ for (let index = toDisplay.startIndex;index < toDisplay.endIndex; index++) {
54543
+ const choice4 = options9.choices[index];
54544
+ const isHighlighted = state.index === index;
54545
+ let prefix = space2;
54546
+ if (index === toDisplay.startIndex && toDisplay.startIndex > 0) {
54547
+ prefix = figures3.arrowUp;
54548
+ } else if (index === toDisplay.endIndex - 1 && toDisplay.endIndex < options9.choices.length) {
54549
+ prefix = figures3.arrowDown;
54550
+ } else if (isHighlighted) {
54551
+ prefix = figures3.pointer;
54552
+ } else {
54553
+ prefix = figures3.stem;
54554
+ }
54555
+ const title = isHighlighted ? annotate2(text3(choice4.title), cyanBright2) : text3(choice4.title);
54556
+ const description = renderChoiceDescription4(choice4, isHighlighted);
54557
+ documents.push(withStem2(prefix).pipe(cat2(title), cat2(space2), cat2(description)));
54558
+ }
54559
+ return vsep2(documents);
54560
+ };
54561
+ var visiblePromptLines2 = (message) => {
54562
+ const lines3 = message.split(/\r?\n/u);
54563
+ const [firstLine, ...rest] = lines3;
54564
+ return [`\u25C7 ${firstLine ?? ""}`, ...rest.map((line4) => `\u2502 ${line4}`), "\u2502 "];
54565
+ };
54566
+ var visibleChoiceLines2 = (state, options9) => {
54567
+ const toDisplay = entriesToDisplay3(state.index, options9.choices.length, options9.maxPerPage);
54568
+ const lines3 = [];
54569
+ for (let index = toDisplay.startIndex;index < toDisplay.endIndex; index++) {
54570
+ const choice4 = options9.choices[index];
54571
+ let prefix = " ";
54572
+ if (index === toDisplay.startIndex && toDisplay.startIndex > 0) {
54573
+ prefix = "\u2191";
54574
+ } else if (index === toDisplay.endIndex - 1 && toDisplay.endIndex < options9.choices.length) {
54575
+ prefix = "\u2193";
54576
+ } else if (state.index === index) {
54577
+ prefix = "\u25C6";
54578
+ } else {
54579
+ prefix = "\u2502";
54580
+ }
54581
+ const description = choice4.description && state.index === index ? ` - ${choice4.description}` : "";
54582
+ lines3.push(`${prefix} ${choice4.title} ${description}`);
54583
+ }
54584
+ return lines3;
54585
+ };
54586
+ var visibleFrameText2 = (state, options9) => [...visiblePromptLines2(options9.message), ...visibleChoiceLines2(state, options9)].join(`
54587
+ `);
54588
+ var renderNextFrame10 = (state, options9) => exports_Effect.gen(function* () {
54589
+ const terminal = yield* Terminal;
54590
+ const columns = yield* terminal.columns;
54591
+ return cursorHide3.pipe(cat2(renderOutput9(options9.message)), cat2(hardLine2), cat2(renderChoices4(state, options9)), render3({ style: "pretty", options: { lineWidth: columns } }));
54592
+ });
54593
+ var renderSubmission10 = (state, options9) => exports_Effect.gen(function* () {
54594
+ const terminal = yield* Terminal;
54595
+ const columns = yield* terminal.columns;
54596
+ const selected = options9.choices[state.index];
54597
+ return renderOutput9(options9.message).pipe(cat2(annotate2(figures3.tick, green3)), cat2(space2), cat2(annotate2(text3(selected.title), white3)), cat2(hardLine2), render3({ style: "pretty", options: { lineWidth: columns } }));
54598
+ });
54599
+ var clearPrompt2 = (state, options9) => exports_Effect.gen(function* () {
54600
+ const terminal = yield* Terminal;
54601
+ const columns = yield* terminal.columns;
54602
+ return eraseText3(visibleFrameText2(state, options9), columns).pipe(cat2(eraseLine3), cat2(cursorLeft3), optimize3(Deep), render3({ style: "pretty", options: { lineWidth: columns } }));
54603
+ });
54604
+ var localSingleSelect = (options9) => {
54605
+ const defaultIndex = Math.max(0, options9.choices.findIndex((choice4) => choice4.value === options9.defaultValue));
54606
+ const resolvedOptions = {
54607
+ defaultValue: options9.choices[defaultIndex]?.value ?? "",
54608
+ maxPerPage: 10,
54609
+ ...options9
54610
+ };
54611
+ const prompt4 = exports_Prompt.custom({
54612
+ index: defaultIndex
54613
+ }, {
54614
+ render: (state, action) => Action3.$match(action, {
54615
+ Beep: () => exports_Effect.succeed(render3(beep3, { style: "pretty" })),
54616
+ NextFrame: ({ state: state2 }) => renderNextFrame10(state2, resolvedOptions),
54617
+ Submit: () => renderSubmission10(state, resolvedOptions)
54618
+ }),
54619
+ process: (input, state) => {
54620
+ switch (input.key.name) {
54621
+ case "k":
54622
+ case "up":
54623
+ return exports_Effect.succeed(Action3.NextFrame({
54624
+ state: {
54625
+ index: state.index === 0 ? resolvedOptions.choices.length - 1 : state.index - 1
54626
+ }
54627
+ }));
54628
+ case "j":
54629
+ case "down":
54630
+ case "tab":
54631
+ return exports_Effect.succeed(Action3.NextFrame({
54632
+ state: {
54633
+ index: (state.index + 1) % resolvedOptions.choices.length
54634
+ }
54635
+ }));
54636
+ case "enter":
54637
+ case "return":
54638
+ return exports_Effect.succeed(Action3.Submit({
54639
+ value: resolvedOptions.choices[state.index].value
54640
+ }));
54641
+ default:
54642
+ return exports_Effect.succeed(Action3.Beep());
54643
+ }
54644
+ },
54645
+ clear: (state) => clearPrompt2(state, resolvedOptions)
54646
+ });
54647
+ return exports_Prompt.run(prompt4);
54648
+ };
54649
+
54500
54650
  // src/scaffold/prompt.ts
54501
54651
  var isPromptQuitSignal = (cause3) => typeof cause3 === "object" && cause3 !== null && ("name" in cause3) && cause3.name === "QuitException";
54502
54652
  var restoreLineInput = (readline2) => {
@@ -54525,6 +54675,14 @@ var PromptLive = exports_Effect.acquireRelease(exports_Effect.sync(() => createI
54525
54675
  cause: cause3,
54526
54676
  message: "Failed to read checklist input."
54527
54677
  }))),
54678
+ singleSelect: ({ message, choices, defaultValue }) => exports_Effect.sync(() => readline2.pause()).pipe(exports_Effect.zipRight(localSingleSelect({
54679
+ message,
54680
+ choices,
54681
+ ...defaultValue ? { defaultValue } : {}
54682
+ })), exports_Effect.ensuring(exports_Effect.sync(() => restoreLineInput(readline2))), exports_Effect.mapError((cause3) => new CliPromptError({
54683
+ cause: cause3,
54684
+ message: "Failed to read selection input."
54685
+ }))),
54528
54686
  writeLine: (line4) => exports_Effect.async((resume2) => {
54529
54687
  output.write(`${line4}
54530
54688
  `, () => {
@@ -56424,7 +56582,8 @@ var writeScaffoldOutput = ({
56424
56582
  const finalSkills = selectedSkills(finalPacks, baseline);
56425
56583
  const hasOxlint = detectionHasPackage(detection, "oxlint");
56426
56584
  const hasOxfmt = detectionHasPackage(detection, "oxfmt");
56427
- const finalHookIds = selectedHookIds(finalPacks, baseline).filter((hookId) => hookId !== "format-edited-file" || hasOxfmt);
56585
+ const hasPython = detection.detectedLanguages.includes("python");
56586
+ const finalHookIds = selectedHookIds(finalPacks, baseline).filter((hookId) => hookId !== "format-edited-file" || hasOxfmt || hasPython);
56428
56587
  const lintAssets = hasOxlint ? resolveLintAssetsForPacks(finalPacks, baseline) : [];
56429
56588
  const lintAssetIdsByPack = Object.fromEntries(finalPacks.map((packId) => [
56430
56589
  packId,
@@ -56573,6 +56732,9 @@ var writeScaffoldOutput = ({
56573
56732
  stdio: "ignore"
56574
56733
  });
56575
56734
  harnessFiles.push(...collectRelativeFiles(outputDirectory, ".claude"), ...collectRelativeFiles(outputDirectory, ".codex"), ...collectRelativeFiles(outputDirectory, ".cursor"), ...collectRelativeFiles(outputDirectory, ".opencode"));
56735
+ if (existsSync5(path10.join(outputDirectory, "opencode.json"))) {
56736
+ harnessFiles.push("opencode.json");
56737
+ }
56576
56738
  generatedFiles.push(...harnessFiles);
56577
56739
  const requiredToolsFile = ".devpunks/required-tools.json";
56578
56740
  generatedFiles.push(writeArtifact({
@@ -56697,34 +56859,50 @@ var writeAgentSystemPrompt = ({
56697
56859
  var tryClipboardCommand = ({
56698
56860
  command,
56699
56861
  args: args2,
56700
- text: text12
56862
+ text: text12,
56863
+ runtime: runtime5
56701
56864
  }) => {
56702
- if (!commandExistsOnPath(command)) {
56865
+ if (!runtime5.commandExists(command)) {
56703
56866
  return { ok: false };
56704
56867
  }
56705
56868
  try {
56706
- execFileSync6(command, args2, {
56869
+ runtime5.execFile(command, args2, {
56707
56870
  cwd: clipboardWorkingDirectory,
56708
- input: text12,
56709
- stdio: ["pipe", "ignore", "ignore"]
56871
+ input: text12
56710
56872
  });
56711
56873
  return { ok: true, command };
56712
56874
  } catch {
56713
56875
  return { ok: false };
56714
56876
  }
56715
56877
  };
56716
- var copyToClipboard = (text12) => {
56717
- if (process.platform === "darwin") {
56718
- return tryClipboardCommand({ command: "pbcopy", args: [], text: text12 });
56878
+ var defaultClipboardExecFile = (command, args2, options9) => {
56879
+ execFileSync6(command, [...args2], {
56880
+ cwd: options9.cwd,
56881
+ input: options9.input,
56882
+ stdio: ["pipe", "ignore", "ignore"]
56883
+ });
56884
+ };
56885
+ var copyToClipboard = (text12, runtime5 = {}) => {
56886
+ const env2 = runtime5.env ?? process.env;
56887
+ if (env2.VITEST === "true" || env2.NODE_ENV === "test" || env2.DP_NO_CLIPBOARD === "1") {
56888
+ return { ok: false };
56889
+ }
56890
+ const commandRuntime = {
56891
+ commandExists: runtime5.commandExists ?? commandExistsOnPath,
56892
+ execFile: runtime5.execFile ?? defaultClipboardExecFile
56893
+ };
56894
+ const platform = runtime5.platform ?? process.platform;
56895
+ if (platform === "darwin") {
56896
+ return tryClipboardCommand({ command: "pbcopy", args: [], text: text12, runtime: commandRuntime });
56719
56897
  }
56720
- if (process.platform === "win32") {
56721
- return tryClipboardCommand({ command: "clip", args: [], text: text12 });
56898
+ if (platform === "win32") {
56899
+ return tryClipboardCommand({ command: "clip", args: [], text: text12, runtime: commandRuntime });
56722
56900
  }
56723
56901
  return [
56724
56902
  { command: "wl-copy", args: [] },
56725
56903
  { command: "xclip", args: ["-selection", "clipboard"] },
56726
56904
  { command: "xsel", args: ["--clipboard", "--input"] }
56727
- ].reduce((result, candidate) => result.ok ? result : tryClipboardCommand({ ...candidate, text: text12 }), { ok: false });
56905
+ ].reduce((result, candidate) => result.ok ? result : tryClipboardCommand({ ...candidate, text: text12, runtime: commandRuntime }), { ok: false });
56728
56906
  };
56729
56907
  var selectedSkills2 = (finalPacks, baseline) => [
56730
56908
  ...new Set(finalPacks.flatMap((packId) => skillsForPack(packId, baseline)))
@@ -56759,7 +56937,8 @@ var runScaffold = ({
56759
56937
  ensureTools = true,
56760
56938
  baseline = bundledBaseline,
56761
56939
  assumeYes = false,
56762
- toolRuntime
56940
+ toolRuntime,
56941
+ clipboardRuntime
56763
56942
  }) => exports_Effect.gen(function* () {
56764
56943
  const baseRequiredTools = requiredToolsForSkills([], baseline);
56765
56944
  let toolBootstrapStatuses = [];
@@ -56948,7 +57127,7 @@ var runScaffold = ({
56948
57127
  subagentManifestSpec: scaffoldOutput.subagentManifestSpec,
56949
57128
  generatedFiles: [...scaffoldOutput.generatedFiles, writtenAgentSystemPromptFile]
56950
57129
  };
56951
- const clipboardResult = copyToClipboard(renderedAgentSystemPrompt);
57130
+ const clipboardResult = copyToClipboard(renderedAgentSystemPrompt, clipboardRuntime);
56952
57131
  yield* prompt4.writeLine("");
56953
57132
  yield* prompt4.writeLine(renderCommandSection("Scaffold Complete", [
56954
57133
  "Scaffold files were written successfully.",
@@ -57016,6 +57195,7 @@ Primary skills here: \`create-spec\`, \`create-plan\`, \`implement-spec\`, \`sim
57016
57195
  - Use \`implement-spec\` to execute an approved spec folder. Choose the execution mode inside the skill: \`sequential\` or \`parallel\`.
57017
57196
  - Write canonical project operations under \`content/docs/project/\`.
57018
57197
  - Keep \`content/docs/project/\` as the default scaffolded route tree. Product/domain routes belong to the individual project and should be added only when the repo deliberately defines them.
57198
+ - Keep project-owned domain source indexes under \`content/docs/project/domains/\` when the repo defines routed domain surfaces.
57019
57199
  - Do not create or maintain a separate \`domains/\` article tree.
57020
57200
  - \`SPEC.md\` and \`IMPLEMENTATION-NOTES.md\` remain source material, but the ingest orchestrator may update their frontmatter/link bookkeeping (\`ingested\`, \`last_ingested\`, backlinks) as part of the pipeline.
57021
57201
 
@@ -57155,7 +57335,9 @@ When processing source material into routed domain knowledge:
57155
57335
  "fumadocs-mdx": "14.3.2",
57156
57336
  "fumadocs-ui": "16.8.7",
57157
57337
  "lucide-react": "^1.14.0",
57338
+ "mermaid": "11.15.0",
57158
57339
  "next": "16.2.4",
57340
+ "next-themes": "0.4.6",
57159
57341
  "react": "^19.2.5",
57160
57342
  "react-dom": "^19.2.5",
57161
57343
  "tailwind-merge": "^3.5.0",
@@ -57205,25 +57387,37 @@ import { fileURLToPath } from "node:url";
57205
57387
  const wikiRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
57206
57388
  const contentRoot = path.join(wikiRoot, "content", "docs");
57207
57389
 
57208
- const possibleRepoRoots = [
57209
- path.resolve(wikiRoot, "..", ".."),
57210
- path.resolve(wikiRoot, ".."),
57211
- ];
57390
+ const possibleRepoRoots = [path.resolve(wikiRoot, "..", ".."), path.resolve(wikiRoot, "..")];
57212
57391
 
57213
57392
  const repoRoot = possibleRepoRoots.find(
57214
- (candidate) => existsSync(path.join(candidate, "docs")) || existsSync(path.join(candidate, "package.json")),
57393
+ (candidate) =>
57394
+ existsSync(path.join(candidate, "docs")) || existsSync(path.join(candidate, "package.json")),
57215
57395
  );
57216
57396
 
57217
57397
  const copiedTopLevelPages = new Set(["project"]);
57218
57398
 
57219
57399
  syncTree(path.join(wikiRoot, "specs"), path.join(contentRoot, "project", "specs"), "Specs");
57220
- syncTree(path.join(wikiRoot, "domains"), path.join(contentRoot, "wiki"), "Wiki");
57221
57400
 
57222
57401
  if (repoRoot) {
57223
- syncTree(path.join(repoRoot, "docs", "requirements"), path.join(contentRoot, "project", "requirements"), "Requirements");
57224
- syncTree(path.join(repoRoot, "docs", "reference"), path.join(contentRoot, "project", "reference"), "Reference");
57225
- syncTree(path.join(repoRoot, "docs", "runbooks"), path.join(contentRoot, "project", "runbooks"), "Runbooks");
57226
- syncFile(path.join(repoRoot, "docs", "tech-decisions.md"), path.join(contentRoot, "project", "decisions", "tech-decisions.mdx"));
57402
+ syncTree(
57403
+ path.join(repoRoot, "docs", "requirements"),
57404
+ path.join(contentRoot, "project", "requirements"),
57405
+ "Requirements",
57406
+ );
57407
+ syncTree(
57408
+ path.join(repoRoot, "docs", "reference"),
57409
+ path.join(contentRoot, "project", "reference"),
57410
+ "Reference",
57411
+ );
57412
+ syncTree(
57413
+ path.join(repoRoot, "docs", "runbooks"),
57414
+ path.join(contentRoot, "project", "runbooks"),
57415
+ "Runbooks",
57416
+ );
57417
+ syncFile(
57418
+ path.join(repoRoot, "docs", "tech-decisions.md"),
57419
+ path.join(contentRoot, "project", "decisions", "tech-decisions.mdx"),
57420
+ );
57227
57421
  }
57228
57422
 
57229
57423
  mergeMeta(contentRoot, {
@@ -57236,6 +57430,7 @@ mergeMeta(path.join(contentRoot, "project"), {
57236
57430
  description: "Internal project operations",
57237
57431
  pages: [
57238
57432
  "index",
57433
+ "domains",
57239
57434
  "grilling",
57240
57435
  "specs",
57241
57436
  "tech-debt",
@@ -57293,9 +57488,13 @@ function hasFrontmatter(content) {
57293
57488
  function writeMetaTree(directory, title) {
57294
57489
  if (!existsSync(directory)) return;
57295
57490
 
57296
- const entries = readdirSync(directory, { withFileTypes: true }).filter((entry) => !entry.name.startsWith("."));
57491
+ const entries = readdirSync(directory, { withFileTypes: true }).filter(
57492
+ (entry) => !entry.name.startsWith("."),
57493
+ );
57297
57494
  const files = entries
57298
- .filter((entry) => entry.isFile() && (entry.name.endsWith(".md") || entry.name.endsWith(".mdx")))
57495
+ .filter(
57496
+ (entry) => entry.isFile() && (entry.name.endsWith(".md") || entry.name.endsWith(".mdx")),
57497
+ )
57299
57498
  .map((entry) => stripMarkdownExtension(entry.name))
57300
57499
  .filter((name) => name !== "meta");
57301
57500
  const folders = entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
@@ -57327,7 +57526,7 @@ function mergeMeta(directory, nextMeta) {
57327
57526
 
57328
57527
  function formatMetaJson(meta) {
57329
57528
  const lines = Object.entries(meta).map(
57330
- ([key, value]) => " \\"" + key + "\\": " + JSON.stringify(value),
57529
+ ([key, value]) => ' "' + key + '": ' + JSON.stringify(value),
57331
57530
  );
57332
57531
 
57333
57532
  return "{\\n" + lines.join(",\\n") + "\\n}\\n";
@@ -57376,7 +57575,7 @@ function sanitizeMdx(content, targetPath) {
57376
57575
 
57377
57576
  return [
57378
57577
  "---",
57379
- "title: \\"" + titleFromDocument(sanitized, targetPath) + "\\"",
57578
+ 'title: "' + titleFromDocument(sanitized, targetPath) + '"',
57380
57579
  "surface: project",
57381
57580
  "permission: project",
57382
57581
  "---",
@@ -57387,9 +57586,9 @@ function sanitizeMdx(content, targetPath) {
57387
57586
 
57388
57587
  function titleFromDocument(content, targetPath) {
57389
57588
  const heading = content.match(/^#\\s+(.+)$/m)?.[1]?.trim();
57390
- if (heading) return heading.replace(/"/g, "\\\\\\"");
57589
+ if (heading) return heading.replace(/"/g, '\\\\"');
57391
57590
 
57392
- return titleFromSegment(stripMarkdownExtension(path.basename(targetPath))).replace(/"/g, "\\\\\\"");
57591
+ return titleFromSegment(stripMarkdownExtension(path.basename(targetPath))).replace(/"/g, '\\\\"');
57393
57592
  }
57394
57593
 
57395
57594
  if (repoRoot) {
@@ -57414,6 +57613,7 @@ export default config;
57414
57613
  {
57415
57614
  path: "source.config.ts",
57416
57615
  content: `import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
57616
+ import { remarkMdxMermaid } from "fumadocs-core/mdx-plugins";
57417
57617
  import { defineConfig, defineDocs } from "fumadocs-mdx/config";
57418
57618
  import { z } from "zod";
57419
57619
 
@@ -57435,7 +57635,11 @@ export const docs = defineDocs({
57435
57635
  },
57436
57636
  });
57437
57637
 
57438
- export default defineConfig({});
57638
+ export default defineConfig({
57639
+ mdxOptions: {
57640
+ remarkPlugins: [remarkMdxMermaid],
57641
+ },
57642
+ });
57439
57643
  `
57440
57644
  },
57441
57645
  {
@@ -57641,9 +57845,12 @@ export const { GET } = createFromSource(source, {
57641
57845
  content: `import defaultMdxComponents from "fumadocs-ui/mdx";
57642
57846
  import type { MDXComponents } from "mdx/types";
57643
57847
 
57848
+ import { Mermaid } from "@/components/mdx/mermaid";
57849
+
57644
57850
  export function getMDXComponents(components?: MDXComponents) {
57645
57851
  return {
57646
57852
  ...defaultMdxComponents,
57853
+ Mermaid,
57647
57854
  ...components,
57648
57855
  } satisfies MDXComponents;
57649
57856
  }
@@ -57653,6 +57860,63 @@ export const useMDXComponents = getMDXComponents;
57653
57860
  declare global {
57654
57861
  type MDXProvidedComponents = ReturnType<typeof getMDXComponents>;
57655
57862
  }
57863
+ `
57864
+ },
57865
+ {
57866
+ path: "src/components/mdx/mermaid.tsx",
57867
+ content: `"use client";
57868
+
57869
+ import { use, useEffect, useId, useState } from "react";
57870
+ import { useTheme } from "next-themes";
57871
+
57872
+ const cache = new Map<string, Promise<unknown>>();
57873
+
57874
+ function cachePromise<T>(key: string, setPromise: () => Promise<T>): Promise<T> {
57875
+ const cached = cache.get(key);
57876
+ if (cached) return cached as Promise<T>;
57877
+
57878
+ const promise = setPromise();
57879
+ cache.set(key, promise);
57880
+ return promise;
57881
+ }
57882
+
57883
+ export function Mermaid({ chart }: { chart: string }) {
57884
+ const [mounted, setMounted] = useState(false);
57885
+
57886
+ useEffect(() => {
57887
+ setMounted(true);
57888
+ }, []);
57889
+
57890
+ if (!mounted) return null;
57891
+ return <MermaidContent chart={chart} />;
57892
+ }
57893
+
57894
+ function MermaidContent({ chart }: { chart: string }) {
57895
+ const id = \`mermaid-\${useId().replaceAll(":", "")}\`;
57896
+ const { resolvedTheme } = useTheme();
57897
+ const { default: mermaid } = use(cachePromise("mermaid", () => import("mermaid")));
57898
+
57899
+ mermaid.initialize({
57900
+ startOnLoad: false,
57901
+ securityLevel: "loose",
57902
+ fontFamily: "inherit",
57903
+ themeCSS: "margin: 1.5rem auto 0;",
57904
+ theme: resolvedTheme === "dark" ? "dark" : "default",
57905
+ });
57906
+
57907
+ const { svg, bindFunctions } = use(
57908
+ cachePromise(\`\${chart}-\${resolvedTheme}\`, () => mermaid.render(id, chart)),
57909
+ );
57910
+
57911
+ return (
57912
+ <div
57913
+ ref={(container) => {
57914
+ if (container) bindFunctions?.(container);
57915
+ }}
57916
+ dangerouslySetInnerHTML={{ __html: svg }}
57917
+ />
57918
+ );
57919
+ }
57656
57920
  `
57657
57921
  },
57658
57922
  {
@@ -57769,7 +58033,17 @@ export function getPageMarkdownUrl(page: (typeof source)["$inferPage"]) {
57769
58033
  content: `{
57770
58034
  "title": "Project",
57771
58035
  "description": "Internal project operations",
57772
- "pages": ["index", "grilling", "specs", "tech-debt", "maintenance", "runbooks", "decisions", "repo-guidance"]
58036
+ "pages": [
58037
+ "index",
58038
+ "domains",
58039
+ "grilling",
58040
+ "specs",
58041
+ "tech-debt",
58042
+ "maintenance",
58043
+ "runbooks",
58044
+ "decisions",
58045
+ "repo-guidance"
58046
+ ]
57773
58047
  }
57774
58048
  `
57775
58049
  },
@@ -57783,6 +58057,30 @@ permission: project
57783
58057
  ---
57784
58058
 
57785
58059
  This surface is for specs, implementation notes, maintenance logs, decisions, repo guidance, runbooks, and durable project context.
58060
+ `
58061
+ },
58062
+ {
58063
+ path: "content/docs/project/domains/meta.json",
58064
+ content: `{
58065
+ "title": "Domains",
58066
+ "pages": [
58067
+ "index"
58068
+ ]
58069
+ }
58070
+ `
58071
+ },
58072
+ {
58073
+ path: "content/docs/project/domains/index.mdx",
58074
+ content: `---
58075
+ title: Domains
58076
+ description: Project-owned domain source index
58077
+ surface: project
58078
+ permission: project
58079
+ ---
58080
+
58081
+ Use this section for project-side domain source indexes when the repo defines durable routed domain surfaces.
58082
+
58083
+ Readable domain articles should live at the project-owned routes the repo defines, such as \`/docs/cli\` or \`/docs/harness\`. Do not create \`${wikiRoot}/domains\`; domain source indexes belong here under \`${wikiRoot}/content/docs/project/domains\`.
57786
58084
  `
57787
58085
  },
57788
58086
  {
@@ -57946,13 +58244,20 @@ Append ingest activity here. Keep only the most recent 50 entries.
57946
58244
  });
57947
58245
 
57948
58246
  // src/content/stage-scaffold.ts
58247
+ var backlogProviderLabels = {
58248
+ "azure-devops": "Azure DevOps",
58249
+ github: "GitHub Projects and Issues",
58250
+ linear: "Linear",
58251
+ monday: "monday.com"
58252
+ };
57949
58253
  var stageScaffoldCatalog = [
57950
58254
  {
57951
58255
  id: "init",
57952
58256
  summary: "Requirements grill, backlog authoring, and wiki docs seed.",
57953
58257
  skills: ["requirements-grill", "write-backlog"],
57954
58258
  renderPrompt: ({
57955
- wikiRoot
58259
+ wikiRoot,
58260
+ backlogProvider
57956
58261
  }) => `You are the operator agent continuing a \`punks scaffold init\` run.
57957
58262
 
57958
58263
  Do not start requirements discovery by default. First reconcile the generated output with this repository.
@@ -57968,6 +58273,11 @@ Generated skills:
57968
58273
  - \`.agents/skills/requirements-grill\`
57969
58274
  - \`.agents/skills/write-backlog\`
57970
58275
 
58276
+ Backlog provider:
58277
+ - selected provider: ${backlogProviderLabels[backlogProvider]} (\`${backlogProvider}\`)
58278
+ - keep this provider pinned unless the user explicitly changes it
58279
+ - when backlog writing starts, use the matching \`write-backlog\` provider payload guidance
58280
+
57971
58281
  Post-command guidance:
57972
58282
  1. Read the repository guidance and inspect the generated files.
57973
58283
  2. Move, rename, or refactor the generated wiki and skill output when needed so it matches the actual repo layout.
@@ -57982,6 +58292,46 @@ When the generated init output matches the repo, the next CLI step is:
57982
58292
  var stageScaffoldById = Object.fromEntries(stageScaffoldCatalog.map((stage) => [stage.id, stage]));
57983
58293
 
57984
58294
  // src/scaffold/stage.ts
58295
+ var backlogProviderLabels2 = {
58296
+ "azure-devops": "Azure DevOps",
58297
+ github: "GitHub Projects and Issues",
58298
+ linear: "Linear",
58299
+ monday: "monday.com"
58300
+ };
58301
+ var promptBacklogProvider = ({
58302
+ prompt: prompt4
58303
+ }) => exports_Effect.gen(function* () {
58304
+ const answer = yield* prompt4.singleSelect({
58305
+ message: "Select backlog provider",
58306
+ defaultValue: "github",
58307
+ choices: [
58308
+ {
58309
+ title: "GitHub Projects and Issues",
58310
+ value: "github",
58311
+ description: "default"
58312
+ },
58313
+ {
58314
+ title: "Linear",
58315
+ value: "linear"
58316
+ },
58317
+ {
58318
+ title: "Azure DevOps",
58319
+ value: "azure-devops"
58320
+ },
58321
+ {
58322
+ title: "monday.com",
58323
+ value: "monday"
58324
+ }
58325
+ ]
58326
+ });
58327
+ return answer;
58328
+ });
58329
+ var renderBacklogProviderMarkdown = (provider) => `# Backlog Provider
58330
+
58331
+ Selected backlog provider: ${backlogProviderLabels2[provider]} (\`${provider}\`).
58332
+
58333
+ Keep this provider pinned unless the user explicitly changes it. When requirements are ready for backlog writing, use \`write-backlog\` with the matching provider payload guidance.
58334
+ `;
57985
58335
  var copySkillDirectory = ({
57986
58336
  outputDirectory,
57987
58337
  skillId,
@@ -58041,20 +58391,27 @@ var updateExistingWikiPackage = ({
58041
58391
  return null;
58042
58392
  const packageJson = JSON.parse(readFileSync7(packagePath, "utf8"));
58043
58393
  const scripts = packageJson.scripts;
58044
- if (!scripts)
58045
- return null;
58046
- const nextScripts = {
58394
+ const dependencies = packageJson.dependencies ?? {};
58395
+ const nextDependencies = {
58396
+ ...dependencies,
58397
+ mermaid: dependencies.mermaid ?? "11.15.0",
58398
+ "next-themes": dependencies["next-themes"] ?? "0.4.6"
58399
+ };
58400
+ const nextScripts = scripts && {
58047
58401
  ...scripts,
58048
58402
  build: withSyncContentPrefix(scripts.build),
58049
58403
  "check-types": withSyncContentPrefix(scripts["check-types"]),
58050
58404
  "types:check": withSyncContentPrefix(scripts["types:check"])
58051
58405
  };
58052
- const changed = Object.entries(nextScripts).some(([key, value6]) => scripts[key] !== value6);
58406
+ const dependenciesChanged = Object.entries(nextDependencies).some(([key, value6]) => dependencies[key] !== value6);
58407
+ const scriptsChanged = nextScripts !== undefined && Object.entries(nextScripts).some(([key, value6]) => scripts?.[key] !== value6);
58408
+ const changed = dependenciesChanged || scriptsChanged;
58053
58409
  if (!changed)
58054
58410
  return null;
58055
58411
  writeFileSync5(packagePath, JSON.stringify({
58056
58412
  ...packageJson,
58057
- scripts: nextScripts
58413
+ dependencies: nextDependencies,
58414
+ ...nextScripts === undefined ? {} : { scripts: nextScripts }
58058
58415
  }, null, 2) + `
58059
58416
  `);
58060
58417
  return relativePosixPath2(outputDirectory, packagePath);
@@ -58073,7 +58430,8 @@ var isNestedRouteSeedBlockedByFlatPage = ({
58073
58430
  var scaffoldWiki = ({
58074
58431
  outputDirectory,
58075
58432
  wikiRoot,
58076
- targetRoot
58433
+ targetRoot,
58434
+ backlogProvider
58077
58435
  }) => {
58078
58436
  const template = makeWikiScaffoldTemplate(wikiRoot);
58079
58437
  const createdFiles = [];
@@ -58160,6 +58518,14 @@ var scaffoldWiki = ({
58160
58518
  if (logFile !== null) {
58161
58519
  createdFiles.push(logFile);
58162
58520
  }
58521
+ const backlogProviderFile = writeMissingFile({
58522
+ outputDirectory,
58523
+ targetPath: path12.join(wikiDirectory, "backlog-provider.md"),
58524
+ content: renderBacklogProviderMarkdown(backlogProvider)
58525
+ });
58526
+ if (backlogProviderFile !== null) {
58527
+ createdFiles.push(backlogProviderFile);
58528
+ }
58163
58529
  return createdFiles.toSorted();
58164
58530
  };
58165
58531
  var scaffoldWikiForDirectory = ({
@@ -58173,7 +58539,8 @@ var scaffoldWikiForDirectory = ({
58173
58539
  return scaffoldWiki({
58174
58540
  outputDirectory,
58175
58541
  wikiRoot: wikiTarget.wikiRoot,
58176
- targetRoot: wikiTarget.targetRoot
58542
+ targetRoot: wikiTarget.targetRoot,
58543
+ backlogProvider: "github"
58177
58544
  });
58178
58545
  };
58179
58546
  var isWikiOutputDirectory = (outputDirectory) => {
@@ -58203,6 +58570,7 @@ var runStageScaffold = ({
58203
58570
  baseline = bundledBaseline
58204
58571
  }) => exports_Effect.gen(function* () {
58205
58572
  const stage = stageScaffoldById[commandId];
58573
+ const backlogProvider = yield* promptBacklogProvider({ prompt: prompt4 });
58206
58574
  const detection = yield* detectRepository(outputDirectory).pipe(exports_Effect.catchAll(() => exports_Effect.succeed(null)));
58207
58575
  const skillFiles = stage.skills.map((skillId) => copySkillDirectory({
58208
58576
  outputDirectory,
@@ -58215,10 +58583,11 @@ var runStageScaffold = ({
58215
58583
  });
58216
58584
  const wikiFiles = scaffoldWiki({
58217
58585
  outputDirectory,
58218
- ...wikiTarget
58586
+ ...wikiTarget,
58587
+ backlogProvider
58219
58588
  });
58220
58589
  removeHarnessDirectoriesFromGitignore(outputDirectory);
58221
- const operatorPrompt = stage.renderPrompt({ wikiRoot: wikiTarget.wikiRoot });
58590
+ const operatorPrompt = stage.renderPrompt({ wikiRoot: wikiTarget.wikiRoot, backlogProvider });
58222
58591
  yield* prompt4.writeLine(renderScaffoldTitle());
58223
58592
  yield* prompt4.writeLine("");
58224
58593
  yield* prompt4.writeLine(renderStageIntro({
@@ -58237,6 +58606,8 @@ var runStageScaffold = ({
58237
58606
  yield* prompt4.writeLine("");
58238
58607
  yield* prompt4.writeLine(renderNotes([`Output directory: ${outputDirectory}`, "Hidden output directories: .agents"]));
58239
58608
  yield* prompt4.writeLine("");
58609
+ yield* prompt4.writeLine(renderCommandSection("Backlog provider", `${backlogProviderLabels2[backlogProvider]} (${backlogProvider})`));
58610
+ yield* prompt4.writeLine("");
58240
58611
  yield* prompt4.writeLine(renderCommandSection("Operator prompt", operatorPrompt));
58241
58612
  yield* submitCliEventEffect("cli.scaffold.init.completed", {
58242
58613
  cwd: outputDirectory,
@@ -58247,7 +58618,8 @@ var runStageScaffold = ({
58247
58618
  return {
58248
58619
  outputDirectory,
58249
58620
  skillFiles,
58250
- wikiFiles
58621
+ wikiFiles,
58622
+ backlogProvider
58251
58623
  };
58252
58624
  });
58253
58625
 
@@ -58269,7 +58641,12 @@ var stageCommand = (id2, description) => exports_Command.make(id2, { output: out
58269
58641
  prompt: prompt4,
58270
58642
  baseline: resolvedBaseline
58271
58643
  });
58272
- }))).pipe(exports_Command.withDescription(description));
58644
+ }).pipe(exports_Effect.catchTag("CliPromptError", (error4) => isPromptQuitSignal(error4.cause) ? exports_Effect.sync(() => {
58645
+ console.log(renderHint("Scaffold cancelled."));
58646
+ }) : exports_Effect.fail(new CliPromptError({
58647
+ cause: error4.cause,
58648
+ message: error4.message
58649
+ })))))).pipe(exports_Command.withDescription(description));
58273
58650
  var setupCommand = exports_Command.make("setup", {
58274
58651
  input: inputOption,
58275
58652
  output: outputOption,
@@ -59294,6 +59671,13 @@ var contentForDiff = (rootDirectory, relativePath) => {
59294
59671
  }
59295
59672
  return readFileSync8(absolutePath, "utf8");
59296
59673
  };
59674
+ var jsonContentEquals = (left3, right3) => {
59675
+ try {
59676
+ return JSON.stringify(JSON.parse(left3)) === JSON.stringify(JSON.parse(right3));
59677
+ } catch {
59678
+ return false;
59679
+ }
59680
+ };
59297
59681
  var hashPath = (rootDirectory, relativePath) => {
59298
59682
  const absolutePath = path14.join(rootDirectory, relativePath);
59299
59683
  if (!existsSync7(absolutePath)) {
@@ -59313,6 +59697,9 @@ var collectRelativeFiles2 = (rootDirectory, relativeDirectory) => {
59313
59697
  for (const entry of readdirSync4(currentDirectory, { withFileTypes: true })) {
59314
59698
  const absolutePath = path14.join(currentDirectory, entry.name);
59315
59699
  const relativePath = path14.relative(rootDirectory, absolutePath).split(path14.sep).join("/");
59700
+ if (relativePath.split("/").includes("node_modules")) {
59701
+ continue;
59702
+ }
59316
59703
  if (entry.isDirectory()) {
59317
59704
  visit2(absolutePath);
59318
59705
  continue;
@@ -59410,6 +59797,9 @@ var buildChanges = ({
59410
59797
  if (currentHash === expected.sha256) {
59411
59798
  return [];
59412
59799
  }
59800
+ if (currentHash !== null && expected.path.endsWith("meta.json") && jsonContentEquals(contentForDiff(rootDirectory, expected.path), contentForDiff(expectedDirectory, expected.path))) {
59801
+ return [];
59802
+ }
59413
59803
  const previous = previousByPath.get(expected.path);
59414
59804
  const status2 = currentHash === null ? "missing" : previous !== undefined && currentHash !== previous.sha256 ? "local-edited" : "changed";
59415
59805
  return [
@@ -88,6 +88,13 @@ Provider mapping:
88
88
  - epic -> parent issue/work item/capability record
89
89
  - story -> child issue/sub-issue/work item
90
90
 
91
+ monday.com mapping:
92
+
93
+ - module/milestone -> board group
94
+ - epic/capability -> parent item
95
+ - story -> subitem
96
+ - story ordering -> dependency column when present
97
+
91
98
  Rules:
92
99
 
93
100
  - every story must be independently understandable
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: write-backlog
3
- description: Turns a large requirements discussion into a canonical backlog hierarchy of module/milestone -> epic/capability -> story and documents provider-specific backlog creation payloads. Use when structuring backlog from discovery, breaking requirements into milestones/epics/stories, consuming `requirements-grill` artifacts like `*-grill-log.md` and `*-grill-status.md`, or preparing Linear, GitHub Projects/Issues, or Azure DevOps creation payloads.
3
+ description: Turns a large requirements discussion into a canonical backlog hierarchy of module/milestone -> epic/capability -> story and documents provider-specific backlog creation payloads. Use when structuring backlog from discovery, breaking requirements into milestones/epics/stories, consuming `requirements-grill` artifacts like `*-grill-log.md` and `*-grill-status.md`, or preparing Linear, GitHub Projects/Issues, Azure DevOps, or monday.com creation payloads.
4
4
  ---
5
5
 
6
6
  # Write Backlog
@@ -56,6 +56,7 @@ description: Turns a large requirements discussion into a canonical backlog hier
56
56
  - [Linear](assets/providers/linear-create-payload.md)
57
57
  - [GitHub Projects and Issues](assets/providers/github-projects-create-payload.md)
58
58
  - [Azure DevOps](assets/providers/azure-devops-create-payload.md)
59
+ - [monday.com](assets/providers/monday-create-payload.md)
59
60
  2. Use the raw provider request shape documented there.
60
61
  3. Do not invent provider fields from memory when the asset already defines them.
61
62
 
@@ -0,0 +1,146 @@
1
+ # monday.com Create Payload
2
+
3
+ Connector source:
4
+
5
+ - monday.com MCP tools exposed through `@monday-com`
6
+
7
+ ## Intent
8
+
9
+ Use monday.com boards, groups, items, subitems, and dependency columns together.
10
+
11
+ Canonical mapping:
12
+
13
+ - module/milestone -> board group
14
+ - epic/capability -> parent item
15
+ - story -> subitem under the epic item
16
+ - story ordering -> dependency column when present
17
+
18
+ Do not flatten epics and stories into sibling items when subitems are available.
19
+
20
+ ## Required bootstrap
21
+
22
+ Resolve the target board before creating backlog items.
23
+
24
+ Before creating or updating items on a board, inspect board metadata with the connector's board info tool so column IDs, column types, status labels, subitem support, and dependency columns are known. Do not invent column IDs.
25
+
26
+ Expected board shape:
27
+
28
+ - one group per module/milestone
29
+ - parent items for epics/capabilities
30
+ - subitems for stories
31
+ - optional `Level` status or dropdown values `Epic` and `Story`
32
+ - optional `Module/Milestone` text/dropdown when groups alone are not enough
33
+ - optional dependency column for story blockers
34
+
35
+ If the target group for a module is missing, create it before creating epic items.
36
+
37
+ ## Create a module group
38
+
39
+ Tool:
40
+
41
+ ```json
42
+ {
43
+ "tool": "@monday-com.create_group",
44
+ "arguments": {
45
+ "boardId": "123456789",
46
+ "groupName": "M1 - Intake and Review"
47
+ }
48
+ }
49
+ ```
50
+
51
+ Required fields:
52
+
53
+ - `boardId`
54
+ - `groupName`
55
+
56
+ Use stable module names. Do not create implementation-phase groups such as backend, frontend, or polish unless those are true product modules.
57
+
58
+ ## Create an epic item
59
+
60
+ Create one parent item per epic/capability in the matching module group.
61
+
62
+ Tool:
63
+
64
+ ```json
65
+ {
66
+ "tool": "@monday-com.create_item",
67
+ "arguments": {
68
+ "boardId": 123456789,
69
+ "groupId": "topics",
70
+ "name": "Submission lifecycle management",
71
+ "columnValues": "{\"long_text\":\"Outcome: ...\\n\\nScope: ...\\n\\nCross-story constraints: ...\",\"status\":{\"label\":\"Epic\"}}"
72
+ }
73
+ }
74
+ ```
75
+
76
+ Epic body ownership:
77
+
78
+ - outcome
79
+ - scope
80
+ - cross-story constraints
81
+ - child story list
82
+ - links to source grill/status artifacts when relevant
83
+
84
+ Keep `columnValues` limited to known board columns from board metadata.
85
+
86
+ ## Create story subitems
87
+
88
+ Create each story as a subitem under its epic item.
89
+
90
+ Tool:
91
+
92
+ ```json
93
+ {
94
+ "tool": "@monday-com.create_item",
95
+ "arguments": {
96
+ "boardId": 123456789,
97
+ "parentItemId": 987654321,
98
+ "name": "Lead reassigns ownership to another reviewer",
99
+ "columnValues": "{\"long_text\":\"Outcome: ...\\n\\nAcceptance signals: ...\\n\\nNon-goals: ...\",\"status\":{\"label\":\"Story\"}}"
100
+ }
101
+ }
102
+ ```
103
+
104
+ Story body ownership:
105
+
106
+ - outcome
107
+ - acceptance signals
108
+ - non-goals
109
+ - links
110
+
111
+ If a board does not support subitems, stop and ask whether to add subitem support or use a different monday.com board. Do not silently degrade into flat story items.
112
+
113
+ ## Add story blockers
114
+
115
+ Use the board's dependency column when present. The exact column ID comes from board metadata.
116
+
117
+ Tool:
118
+
119
+ ```json
120
+ {
121
+ "tool": "@monday-com.change_item_column_values",
122
+ "arguments": {
123
+ "boardId": 123456789,
124
+ "itemId": 1122334455,
125
+ "columnValues": "{\"dependency\":{\"item_ids\":[5566778899]}}"
126
+ }
127
+ }
128
+ ```
129
+
130
+ `itemId` is the blocked story subitem. The dependency value references prerequisite story subitem IDs. If the connector requires a board-relation workflow before linking items, follow that workflow first.
131
+
132
+ ## Minimal creation order
133
+
134
+ 1. Resolve board ID.
135
+ 2. Inspect board metadata.
136
+ 3. Resolve or create groups for modules/milestones.
137
+ 4. Create epic parent items in the matching groups.
138
+ 5. Create story subitems with `parentItemId`.
139
+ 6. Set known board columns for level/module/epic metadata when available.
140
+ 7. Add dependency-column values for real story blockers.
141
+
142
+ ## Notes
143
+
144
+ - monday.com column IDs and label names are board-specific. Always inspect the board before emitting final create payloads.
145
+ - Groups are the primary milestone/module container. Use extra module columns only when the board already needs cross-group reporting.
146
+ - Keep product backlog content in item/subitem bodies. Do not put plan tasks, file paths, validation commands, or implementation handoffs in monday.com backlog records.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punks/cli",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "Harness Intelligence scaffolding CLI",
5
5
  "bin": {
6
6
  "devpunks": "dist/index.js",