@punks/cli 2.1.9 → 2.1.11

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 (63) hide show
  1. package/README.md +1 -1
  2. package/dist/data/catalog/hooks.ts +8 -0
  3. package/dist/data/catalog/packs.ts +11 -3
  4. package/dist/data/catalog/skills.ts +48 -0
  5. package/dist/data/catalog/tools.ts +9 -1
  6. package/dist/data/hooks/scaffold-update-check.mjs +181 -0
  7. package/dist/data/hooks.test.ts +17 -0
  8. package/dist/data/scripts/sync-subagents.mjs +104 -32
  9. package/dist/data/subagents/manifest.mjs +120 -0
  10. package/dist/index.js +600 -85
  11. package/dist/skills/agnostic/cli/dp-cli/SKILL.md +3 -3
  12. package/dist/skills/agnostic/cli/dp-cli/references/commands.md +1 -1
  13. package/dist/skills/agnostic/cli/dp-cli/references/post-command-flow.md +1 -1
  14. package/dist/skills/agnostic/docs/docs-onboarding/SKILL.md +46 -0
  15. package/dist/skills/agnostic/docs/docs-onboarding/agents/openai.yaml +4 -0
  16. package/dist/skills/agnostic/docs/docs-onboarding/references/artifact-contract.md +67 -0
  17. package/dist/skills/agnostic/docs/writing-beats/SKILL.md +69 -0
  18. package/dist/skills/agnostic/docs/writing-fragments/SKILL.md +76 -0
  19. package/dist/skills/agnostic/docs/writing-shape/SKILL.md +75 -0
  20. package/dist/skills/agnostic/generic/handoff/SKILL.md +15 -0
  21. package/dist/skills/agnostic/planning/create-plan/SKILL.md +24 -8
  22. package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +20 -0
  23. package/dist/skills/agnostic/planning/create-plan/references/planner-phase.md +1 -1
  24. package/dist/skills/agnostic/planning/create-plan/references/tdd-phase.md +23 -1
  25. package/dist/skills/agnostic/planning/create-spec/SKILL.md +63 -17
  26. package/dist/skills/agnostic/planning/create-spec/references/discovery.md +24 -16
  27. package/dist/skills/agnostic/planning/create-spec/references/folder-naming.md +6 -2
  28. package/dist/skills/agnostic/planning/create-spec/references/wiki-bookkeeping.md +29 -5
  29. package/dist/skills/agnostic/planning/implement-spec/SKILL.md +20 -2
  30. package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +7 -1
  31. package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +15 -8
  32. package/dist/skills/agnostic/planning/implement-spec/references/sequential.md +8 -3
  33. package/dist/skills/agnostic/planning/stack/SKILL.md +89 -0
  34. package/dist/skills/agnostic/quality/tdd/SKILL.md +31 -0
  35. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +1 -0
  36. package/dist/skills/agnostic/requirements/write-backlog/SKILL.md +7 -5
  37. package/dist/skills/frameworks/tanstack-query/tanstack-query/SKILL.md +621 -830
  38. package/dist/skills/frameworks/tanstack-start/tanstack-start/SKILL.md +250 -0
  39. package/dist/skills/phases/bug-discovery-phase/REFERENCE.md +30 -0
  40. package/dist/skills/phases/bug-discovery-phase/SKILL.md +8 -1
  41. package/dist/skills/phases/debugging-phase/SKILL.md +1 -0
  42. package/dist/skills/phases/delivery-phase/SKILL.md +33 -65
  43. package/dist/skills/phases/delivery-phase/phases/closeout.md +33 -0
  44. package/dist/skills/phases/delivery-phase/phases/debug.md +30 -0
  45. package/dist/skills/phases/delivery-phase/phases/docs-ingest.md +27 -0
  46. package/dist/skills/phases/delivery-phase/phases/implement.md +30 -0
  47. package/dist/skills/phases/delivery-phase/phases/plan.md +27 -0
  48. package/dist/skills/phases/delivery-phase/phases/review.md +29 -0
  49. package/dist/skills/phases/delivery-phase/phases/router.md +46 -0
  50. package/dist/skills/phases/delivery-phase/phases/spec.md +26 -0
  51. package/dist/skills/phases/delivery-phase/references/artifact-state.md +42 -0
  52. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +25 -0
  53. package/dist/skills/phases/docs-ingest-phase/SKILL.md +28 -70
  54. package/dist/skills/phases/docs-ingest-phase/agents/openai.yaml +2 -2
  55. package/dist/skills/phases/docs-ingest-phase/phases/private-internal.md +57 -0
  56. package/dist/skills/phases/docs-ingest-phase/phases/public-docs.md +52 -0
  57. package/dist/skills/phases/docs-ingest-phase/phases/router.md +42 -0
  58. package/dist/skills/phases/docs-ingest-phase/references/fumadocs-routing.md +8 -5
  59. package/dist/skills/phases/docs-ingest-phase/references/learning-artifacts.md +96 -0
  60. package/dist/skills/phases/docs-ingest-phase/references/public-docs.md +90 -0
  61. package/dist/skills/phases/requirements-phase/SKILL.md +3 -0
  62. package/dist/skills/phases/review-phase/SKILL.md +5 -0
  63. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -52324,7 +52324,7 @@ import { execFileSync } from "child_process";
52324
52324
 
52325
52325
  // package.json
52326
52326
  var name = "@punks/cli";
52327
- var version = "2.1.9";
52327
+ var version = "2.1.11";
52328
52328
  // src/telemetry/product.ts
52329
52329
  var git = (cwd, args2) => {
52330
52330
  try {
@@ -52588,15 +52588,15 @@ var renderCommandGuide = () => [
52588
52588
  "usage:",
52589
52589
  " \u2022 agents should activate `$dp-cli` before acting on `.devpunks` output",
52590
52590
  " \u2022 start with `punks scaffold` to inspect the lifecycle",
52591
- " \u2022 use `punks scaffold init` to choose the backlog provider and seed requirements/wiki output",
52591
+ " \u2022 use `punks scaffold init` to choose the backlog provider and start docs onboarding/wiki output",
52592
52592
  " \u2022 reconcile the seeded wiki into the real repo layout before writing durable docs",
52593
52593
  " \u2022 use `punks scaffold setup` for repo-aware pack detection after repo boilerplate is ready",
52594
52594
  " \u2022 use `punks update` after setup to pull newer scaffolded skills/prompts/manifests/hooks",
52595
- " \u2022 use `punks report` when reusable Harness friction should enter backoffice triage",
52596
- " \u2022 public reports are stored internally; GitHub issues require authenticated backoffice triage",
52595
+ " \u2022 use `punks report` when reusable Harness friction should open GitHub-backed triage",
52596
+ " \u2022 accepted reports return a GitHub issue URL; missing server GitHub credentials fail the command",
52597
52597
  "",
52598
52598
  "operator notes:",
52599
- " \u2022 init copies only requirements/backlog skills, backlog-provider pin, and the initial wiki structure",
52599
+ " \u2022 init copies docs-onboarding, requirements/backlog/spec skills, backlog-provider pin, and the initial wiki structure",
52600
52600
  " \u2022 `setup` remains the repo-aware pack-driven scaffold flow",
52601
52601
  " \u2022 each command prints an operator-facing next-step prompt"
52602
52602
  ].join(`
@@ -52617,7 +52617,7 @@ var renderStageIntro = ({
52617
52617
  "",
52618
52618
  "usage:",
52619
52619
  " \u2022 agents should activate `$dp-cli` before following generated output",
52620
- " \u2022 use this to choose the backlog provider, scaffold requirements/backlog skills, and seed the initial wiki tree",
52620
+ " \u2022 use this to choose the backlog provider, scaffold docs-onboarding plus requirements/backlog/spec skills, and seed the initial wiki tree",
52621
52621
  " \u2022 reconcile the wiki into the real repo layout, such as `apps/wiki` in a monorepo",
52622
52622
  " \u2022 rerunning this command overwrites only the files for this stage",
52623
52623
  " \u2022 read the generated prompt/output and follow it before running repo-aware setup"
@@ -52651,7 +52651,7 @@ var renderScaffoldGuide = () => [
52651
52651
  "",
52652
52652
  "commands:",
52653
52653
  " \u203A punks scaffold init",
52654
- " \u2514 requirements gate: pick backlog provider, scaffold `requirements-grill`/`write-backlog`, seed wiki",
52654
+ " \u2514 onboarding gate: pick backlog provider, scaffold `docs-onboarding`, reconstruct wiki/spec context",
52655
52655
  " \u203A punks scaffold setup",
52656
52656
  " \u2514 repo-aware setup: detect packs, scaffold prompts/manifests/hooks",
52657
52657
  "",
@@ -52864,6 +52864,9 @@ var reportCommand = exports_Command.make("report", {
52864
52864
  throw new Error("Harness report API URL is not configured.");
52865
52865
  }
52866
52866
  const submitted = await exports_Effect.runPromise(submitHarnessReport({ baseUrl: baseUrl2, report }));
52867
+ if (submitted.githubUrl === undefined) {
52868
+ throw new Error("Harness report API did not return a GitHub issue URL.");
52869
+ }
52867
52870
  await exports_Effect.runPromise(submitCliEventEffect("cli.harness.report.submitted", {
52868
52871
  cwd: repoRoot
52869
52872
  }));
@@ -52873,14 +52876,14 @@ var reportCommand = exports_Command.make("report", {
52873
52876
  return;
52874
52877
  }
52875
52878
  console.log(renderCommandSection(submitted.deduplicated === true ? "Harness report matched existing issue" : "Harness report submitted", [
52876
- submitted.githubUrl === undefined ? "Stored: Internal backoffice triage" : `Issue: ${submitted.githubUrl}`,
52879
+ `Issue: ${submitted.githubUrl}`,
52877
52880
  submitted.title === undefined ? undefined : `Title: ${submitted.title}`,
52878
52881
  `Status: ${submitted.status}`
52879
52882
  ].filter((line4) => line4 !== undefined).join(`
52880
52883
  `)));
52881
52884
  },
52882
52885
  catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("Harness report submission failed.")
52883
- })).pipe(exports_Command.withDescription("Submit reusable Harness friction to the report API for internal backoffice triage."));
52886
+ })).pipe(exports_Command.withDescription("Submit reusable Harness friction to GitHub-backed maintainer triage."));
52884
52887
 
52885
52888
  // src/cli/scaffold-command.ts
52886
52889
  import path13 from "path";
@@ -52897,6 +52900,13 @@ import path3 from "path";
52897
52900
 
52898
52901
  // src/data/catalog/hooks.ts
52899
52902
  var hookCatalog = [
52903
+ {
52904
+ id: "scaffold-update-check",
52905
+ harness: "shared",
52906
+ outputPath: ".agents/hooks/scaffold-update-check.mjs",
52907
+ description: "Shared session-start hook that reports whether managed Harness scaffold output is current.",
52908
+ sourcePath: "hooks/scaffold-update-check.mjs"
52909
+ },
52900
52910
  {
52901
52911
  id: "format-edited-file",
52902
52912
  harness: "shared",
@@ -53166,12 +53176,18 @@ var packCatalog = [
53166
53176
  id: "docs",
53167
53177
  category: "default",
53168
53178
  triggerPackages: [],
53169
- description: "Default docs pack: docs-ingest-phase.",
53170
- skills: ["docs-ingest-phase"],
53179
+ description: "Default docs pack: docs ingest plus public-doc writing primitives.",
53180
+ skills: [
53181
+ "docs-ingest-phase",
53182
+ "docs-onboarding",
53183
+ "writing-fragments",
53184
+ "writing-beats",
53185
+ "writing-shape"
53186
+ ],
53171
53187
  lintAssets: [],
53172
53188
  hooks: [],
53173
53189
  promptSurfaces: ["shared-agents", "root-prompt-spec", "docs-prompt-spec"],
53174
- promptDetails: ["shared docs baseline", "docs scope spec"]
53190
+ promptDetails: ["shared docs baseline", "public-doc writing flow", "docs scope spec"]
53175
53191
  },
53176
53192
  {
53177
53193
  id: "drizzle",
@@ -53273,9 +53289,11 @@ var packCatalog = [
53273
53289
  "delivery-phase",
53274
53290
  "goalify",
53275
53291
  "grill-me",
53292
+ "handoff",
53276
53293
  "create-spec",
53277
53294
  "create-plan",
53278
53295
  "implement-spec",
53296
+ "stack",
53279
53297
  "resolve-debt-phase"
53280
53298
  ],
53281
53299
  lintAssets: [],
@@ -53524,6 +53542,38 @@ var skillCatalog = [
53524
53542
  framework: null,
53525
53543
  requiresTools: []
53526
53544
  },
53545
+ {
53546
+ id: "docs-onboarding",
53547
+ sourceDirectory: "skills/agnostic/docs/docs-onboarding",
53548
+ tier: "agnostic",
53549
+ language: null,
53550
+ framework: null,
53551
+ requiresTools: []
53552
+ },
53553
+ {
53554
+ id: "writing-fragments",
53555
+ sourceDirectory: "skills/agnostic/docs/writing-fragments",
53556
+ tier: "agnostic",
53557
+ language: null,
53558
+ framework: null,
53559
+ requiresTools: []
53560
+ },
53561
+ {
53562
+ id: "writing-beats",
53563
+ sourceDirectory: "skills/agnostic/docs/writing-beats",
53564
+ tier: "agnostic",
53565
+ language: null,
53566
+ framework: null,
53567
+ requiresTools: []
53568
+ },
53569
+ {
53570
+ id: "writing-shape",
53571
+ sourceDirectory: "skills/agnostic/docs/writing-shape",
53572
+ tier: "agnostic",
53573
+ language: null,
53574
+ framework: null,
53575
+ requiresTools: []
53576
+ },
53527
53577
  {
53528
53578
  id: "effect-authoring",
53529
53579
  sourceDirectory: "skills/frameworks/effect/effect-authoring",
@@ -53596,6 +53646,14 @@ var skillCatalog = [
53596
53646
  framework: null,
53597
53647
  requiresTools: []
53598
53648
  },
53649
+ {
53650
+ id: "handoff",
53651
+ sourceDirectory: "skills/agnostic/generic/handoff",
53652
+ tier: "agnostic",
53653
+ language: null,
53654
+ framework: null,
53655
+ requiresTools: []
53656
+ },
53599
53657
  {
53600
53658
  id: "improve-codebase-architecture",
53601
53659
  sourceDirectory: "skills/agnostic/research/improve-codebase-architecture",
@@ -53612,6 +53670,14 @@ var skillCatalog = [
53612
53670
  framework: null,
53613
53671
  requiresTools: []
53614
53672
  },
53673
+ {
53674
+ id: "stack",
53675
+ sourceDirectory: "skills/agnostic/planning/stack",
53676
+ tier: "agnostic",
53677
+ language: null,
53678
+ framework: null,
53679
+ requiresTools: ["stack"]
53680
+ },
53615
53681
  {
53616
53682
  id: "next-best-practices",
53617
53683
  sourceDirectory: "skills/frameworks/nextjs/next-best-practices",
@@ -53820,9 +53886,11 @@ var toolCatalog = [
53820
53886
  },
53821
53887
  {
53822
53888
  id: "opensrc",
53823
- packageName: "opensrc",
53889
+ packageName: "opensrc@^0.7.2",
53824
53890
  requiredBins: ["node"],
53825
- ensureCommands: []
53891
+ ensureCommands: [],
53892
+ versionCommand: ["opensrc", "--version"],
53893
+ minimumVersion: "0.7.2"
53826
53894
  },
53827
53895
  {
53828
53896
  id: "portless",
@@ -53835,6 +53903,12 @@ var toolCatalog = [
53835
53903
  packageName: "skills",
53836
53904
  requiredBins: ["node"],
53837
53905
  ensureCommands: []
53906
+ },
53907
+ {
53908
+ id: "stack",
53909
+ packageName: "@kitlangton/stack",
53910
+ requiredBins: ["node"],
53911
+ ensureCommands: []
53838
53912
  }
53839
53913
  ];
53840
53914
 
@@ -54955,7 +55029,11 @@ var defaultRuntime3 = {
54955
55029
  cwd: options9?.cwd,
54956
55030
  stdio: options9?.stdio === "inherit" ? ["ignore", "inherit", "inherit"] : "ignore"
54957
55031
  });
54958
- }
55032
+ },
55033
+ execFileOutput: (command, args2, options9) => execFileSync3(command, [...args2], {
55034
+ cwd: options9?.cwd,
55035
+ encoding: "utf8"
55036
+ })
54959
55037
  };
54960
55038
  var detectGlobalPackageManager = (runtime5) => {
54961
55039
  if (runtime5.commandExists("bun")) {
@@ -54979,6 +55057,39 @@ var globalInstallCommandFor = (packageManager, packageName) => {
54979
55057
  return ["npm", "install", "-g", packageName];
54980
55058
  }
54981
55059
  };
55060
+ var parseVersionParts = (value6) => {
55061
+ const match19 = value6.match(/\d+(?:\.\d+){0,2}/u);
55062
+ if (match19 === null)
55063
+ return null;
55064
+ return match19[0].split(".").map((part) => Number.parseInt(part, 10));
55065
+ };
55066
+ var compareVersions = (actual, minimum) => {
55067
+ const length5 = Math.max(actual.length, minimum.length);
55068
+ for (let index = 0;index < length5; index += 1) {
55069
+ const actualPart = actual[index] ?? 0;
55070
+ const minimumPart = minimum[index] ?? 0;
55071
+ if (actualPart > minimumPart)
55072
+ return 1;
55073
+ if (actualPart < minimumPart)
55074
+ return -1;
55075
+ }
55076
+ return 0;
55077
+ };
55078
+ var isMinimumVersionSatisfied = (tool, runtime5, cwd) => {
55079
+ if (tool.minimumVersion === undefined || tool.versionCommand === undefined) {
55080
+ return true;
55081
+ }
55082
+ const [command, ...args2] = tool.versionCommand;
55083
+ if (command === undefined || runtime5.execFileOutput === undefined) {
55084
+ return true;
55085
+ }
55086
+ const actual = parseVersionParts(runtime5.execFileOutput(command, args2, { cwd }));
55087
+ const minimum = parseVersionParts(tool.minimumVersion);
55088
+ if (actual === null || minimum === null) {
55089
+ throw new Error(`Cannot verify required tool version from \`${tool.versionCommand.join(" ")}\`.`);
55090
+ }
55091
+ return compareVersions(actual, minimum) >= 0;
55092
+ };
54982
55093
  var ensureToolsInstalled = (toolIds, baseline = bundledBaseline, runtime5 = defaultRuntime3) => {
54983
55094
  const packageManager = detectGlobalPackageManager(runtime5);
54984
55095
  const statuses = [];
@@ -54997,7 +55108,8 @@ var ensureToolsInstalled = (toolIds, baseline = bundledBaseline, runtime5 = defa
54997
55108
  if (missingPrerequisites.length > 0) {
54998
55109
  throw new Error(`Cannot install required tool \`${toolId}\` because ${missingPrerequisites.join(", ")} is not available on PATH.`);
54999
55110
  }
55000
- const alreadyPresent = runtime5.commandExists(toolId);
55111
+ const versionContract = tool;
55112
+ const alreadyPresent = runtime5.commandExists(toolId) && isMinimumVersionSatisfied(versionContract, runtime5, cwd);
55001
55113
  if (!alreadyPresent) {
55002
55114
  const [command, ...args2] = globalInstallCommandFor(globalPackageManager, tool.packageName);
55003
55115
  runtime5.execFile(command, args2, {
@@ -55007,6 +55119,9 @@ var ensureToolsInstalled = (toolIds, baseline = bundledBaseline, runtime5 = defa
55007
55119
  if (!runtime5.commandExists(toolId)) {
55008
55120
  throw new Error(`Tried to install required tool \`${toolId}\`, but the binary is still not available on PATH afterwards.`);
55009
55121
  }
55122
+ if (!isMinimumVersionSatisfied(versionContract, runtime5, cwd)) {
55123
+ throw new Error(`Tried to install required tool \`${toolId}\`, but the installed version does not satisfy ${versionContract.minimumVersion}.`);
55124
+ }
55010
55125
  }
55011
55126
  for (const [command, ...args2] of tool.ensureCommands) {
55012
55127
  runtime5.execFile(command, args2, {
@@ -55160,6 +55275,7 @@ var formatConfirmationSummary = (result, baseline = bundledBaseline) => [
55160
55275
  `output directory: ${result.outputDirectory}`,
55161
55276
  ...section("shared core files:", formatList(result.promptOutputs)),
55162
55277
  ...section("lint spec files:", formatList(result.lintSpecFiles)),
55278
+ ...section("source guide files:", formatList(result.sourceGuideFiles)),
55163
55279
  ...section("skill files:", formatList(result.skillFiles)),
55164
55280
  ...section("prompt spec files:", formatList(result.promptSpecFiles)),
55165
55281
  ...section("subagent scaffold files:", formatList(result.subagentFiles)),
@@ -55199,6 +55315,7 @@ var formatAgentHandoffSummary = (result) => [
55199
55315
  ...formatList([
55200
55316
  ...result.promptOutputs,
55201
55317
  ...result.lintSpecFiles,
55318
+ ...result.sourceGuideFiles,
55202
55319
  ...result.skillFiles,
55203
55320
  ...result.promptSpecFiles,
55204
55321
  ...result.subagentFiles,
@@ -55222,7 +55339,8 @@ var formatAgentHandoffSummary = (result) => [
55222
55339
  " 11. Use `portless` as the local-dev URL baseline. Prefer stable subdomains over raw `localhost:<port>` values in env examples, endpoint defaults, callback URLs, allowed origins, CORS, and app-to-app proxies.",
55223
55340
  " 12. If adopting Oxlint or Oxfmt, replace existing lint/format setup deliberately: package scripts, task pipelines, CI, editor/docs references, and hooks should agree on the new tools.",
55224
55341
  " 13. Before authoring final prompts or implementation plans, identify the core detected libraries whose source behavior matters.",
55225
- " 14. Run `opensrc path <package>` or `opensrc path owner/repo` for those core libraries, then inspect the returned checkout paths. Clone the major framework/runtime libraries you will reason about; do not clone every dependency mechanically."
55342
+ " 14. If an `opensrc/<package>.md` guide exists for a package, read that card first, then run its `opensrc path --cwd . <package>` command or fallback repository lookup.",
55343
+ " 15. Inspect the returned checkout paths. Clone the major framework/runtime libraries you will reason about; do not clone every dependency mechanically."
55226
55344
  ].join(`
55227
55345
  `);
55228
55346
  var formatSelectionPreview = (options9) => [
@@ -55424,9 +55542,13 @@ For code review requests, take a review stance: findings first, severity ordered
55424
55542
 
55425
55543
  Use \`parallel-research\` for readonly repo orientation when the work can be split across independent questions, subsystems, artifacts, or hypotheses. Keep the immediate blocking path local, delegate sidecar reading only, synthesize findings before deciding, and skip it for code-writing or tightly coupled work.
55426
55544
 
55427
- Before delegating to subagents, verify the active harness global/project settings actually enable subagent execution, then verify repo-local routing. For Codex, \`.codex/config.toml\` should have an \`[agents]\` section with usable thread/depth limits. For Claude Code, OpenCode, Cursor, or other harnesses, check their equivalent global/project agent settings before trusting repo-local mirrors. Then confirm \`.agents/subagents/manifest.mjs\` exists and the selected specialist has matching owned paths, guidance files, and skills. If that guard fails, repair settings or execute locally; do not claim worker coverage from an inactive harness.
55545
+ When routed learning artifacts exist, consult relevant learnings during discovery, planning, debugging, and review.
55428
55546
 
55429
- When inspecting external library internals, prefer official docs first. If source context is needed, resolve cached read-only sources with \`opensrc path <package>\` for packages or \`opensrc path owner/repo\` for repositories, then inspect the returned absolute path. This applies broadly to third-party dependencies used here.
55547
+ Implementation work must be handed off to at least one scoped worker. Sequential implementation uses exactly one worker plus parent validation. Use multiple workers only when the user asks for parallelism or the plan declares explicit independent waves with disjoint write scopes. The main thread owns orchestration, context preservation, review, validation, and reporting.
55548
+
55549
+ Before handing work to subagents, verify the active harness global/project settings actually enable subagent execution, then verify repo-local routing. For Codex, \`.codex/config.toml\` should have an \`[agents]\` section with usable thread/depth limits. For Claude Code, OpenCode, Cursor, or other harnesses, check their equivalent global/project agent settings before trusting repo-local mirrors. Then confirm \`.agents/subagents/manifest.mjs\` exists and the selected specialist has matching owned paths, guidance files, and skills. If that guard fails, stop and repair settings or report the blocker; do not implement in the main thread or claim worker coverage from an inactive harness.
55550
+
55551
+ When inspecting external library internals, prefer official docs first. If \`opensrc/<package>.md\` exists, read that guide card before resolving cached source. Then use \`opensrc path --cwd . <package>\` for packages or \`opensrc path owner/repo\` for repositories, and inspect the returned absolute path.
55430
55552
 
55431
55553
  Use \`portless\` for local development URLs instead of baking raw \`localhost:<port>\` values into docs, env examples, endpoint defaults, callback URLs, allowed origins, CORS lists, or app-to-app proxy targets.
55432
55554
 
@@ -55613,7 +55735,7 @@ var renderPromptSpecMarkdown = (spec) => [
55613
55735
  "## Source inspection",
55614
55736
  "",
55615
55737
  "- No arbitrary concrete `opensrc` repositories are invented by scaffold.",
55616
- "- During post-scaffold setup, decide which detected core libraries materially affect prompt or lint authoring, then run `opensrc path <package>` or `opensrc path owner/repo` for those libraries before relying on source behavior.",
55738
+ "- During post-scaffold setup, decide which detected core libraries materially affect prompt or lint authoring, then read any matching `opensrc/<package>.md` guide before running `opensrc path --cwd . <package>` or `opensrc path owner/repo`.",
55617
55739
  ...spec.opensrcReferences.length === 0 ? [] : [
55618
55740
  "",
55619
55741
  "## Curated opensrc examples",
@@ -55642,6 +55764,7 @@ var renderAgentHandoffMarkdown = ({
55642
55764
  promptOutputs,
55643
55765
  promptSpecFiles,
55644
55766
  lintSpecFiles,
55767
+ sourceGuideFiles,
55645
55768
  skillFiles,
55646
55769
  subagentFiles,
55647
55770
  scriptFiles,
@@ -55661,6 +55784,7 @@ var renderAgentHandoffMarkdown = ({
55661
55784
  "- Shared global prompt scaffolding under `.agents/`.",
55662
55785
  "- Prompt specs under `.devpunks/specs/prompts/`.",
55663
55786
  "- Selected lint asset specs under `.devpunks/specs/lint/`.",
55787
+ "- Source guide cards under `opensrc/` when detected packages need `opensrc` context.",
55664
55788
  "- Subagent manifest scaffolding/specs under `.agents/subagents/` and `.devpunks/specs/subagents/`.",
55665
55789
  `- Scaffold manifest at \`${scaffoldManifestFile}\`.`,
55666
55790
  `- Required tools manifest at \`${requiredToolsFile}\`.`,
@@ -55693,7 +55817,8 @@ var renderAgentHandoffMarkdown = ({
55693
55817
  "11. Use `.agents/scripts/sync-subagents.mjs` to regenerate harness-native agents, hook mirrors, shared prompt mirrors, and the `.claude/skills` compatibility mirror when the neutral manifest changes.",
55694
55818
  "12. Populate or reconcile `.agents/subagents/manifest.mjs` using both the manifest spec JSON and the manifest prompt markdown.",
55695
55819
  "13. Adjust owned paths and guidance file references in the subagent manifest to match the real repo layout. Monorepo vs single-repo shape affects these paths.",
55696
- "14. Before authoring final prompts or implementation plans, identify the core detected libraries whose source behavior matters, run `opensrc path <package>` or `opensrc path owner/repo` for those libraries, then inspect the returned checkout paths. Clone the major framework/runtime libraries you will reason about; do not clone every dependency mechanically.",
55820
+ "14. Before authoring final prompts or implementation plans, identify the core detected libraries whose source behavior matters. If an `opensrc/<package>.md` guide exists for a package, read that card first, then run its `opensrc path --cwd . <package>` command or fallback repository lookup.",
55821
+ "15. Inspect the returned checkout paths. Clone the major framework/runtime libraries you will reason about; do not clone every dependency mechanically.",
55697
55822
  "",
55698
55823
  "## Shared core files",
55699
55824
  "",
@@ -55711,6 +55836,10 @@ var renderAgentHandoffMarkdown = ({
55711
55836
  "",
55712
55837
  ...lintSpecFiles.map((file6) => `- \`${file6}\``),
55713
55838
  "",
55839
+ "## Source guide files",
55840
+ "",
55841
+ ...sourceGuideFiles.map((file6) => `- \`${file6}\``),
55842
+ "",
55714
55843
  "## Subagent files",
55715
55844
  "",
55716
55845
  ...subagentFiles.map((file6) => `- \`${file6}\``),
@@ -55767,6 +55896,181 @@ var renderLintSpecMarkdown = ({
55767
55896
  ].join(`
55768
55897
  `);
55769
55898
 
55899
+ // src/content/source-guides.ts
55900
+ var sourceGuideCatalog = [
55901
+ {
55902
+ id: "effect",
55903
+ title: "Effect Source Guide",
55904
+ packageSpec: "effect",
55905
+ fallbackSpec: "Effect-TS/effect",
55906
+ technologies: ["effect"],
55907
+ packs: ["effect"],
55908
+ useWhen: [
55909
+ "Effect runtime, Schema, Layer, Stream, or service behavior affects implementation.",
55910
+ "Official docs are not specific enough for the call path being changed."
55911
+ ],
55912
+ inspectFirst: ["packages/effect/src", "packages/effect/test", "packages/platform/src"]
55913
+ },
55914
+ {
55915
+ id: "nextjs",
55916
+ title: "Next.js Source Guide",
55917
+ packageSpec: "next",
55918
+ fallbackSpec: "vercel/next.js",
55919
+ technologies: ["nextjs"],
55920
+ packs: ["nextjs"],
55921
+ useWhen: [
55922
+ "App Router, cache, middleware, route-handler, or build behavior affects implementation.",
55923
+ "Framework behavior differs across installed Next.js versions."
55924
+ ],
55925
+ inspectFirst: ["packages/next/src", "test/e2e", "test/integration"]
55926
+ },
55927
+ {
55928
+ id: "react",
55929
+ title: "React Source Guide",
55930
+ packageSpec: "react",
55931
+ fallbackSpec: "facebook/react",
55932
+ technologies: ["react"],
55933
+ packs: ["react"],
55934
+ useWhen: [
55935
+ "React rendering, hooks, suspense, or client/server integration behavior affects implementation.",
55936
+ "Docs explain the API but not the runtime edge case being debugged."
55937
+ ],
55938
+ inspectFirst: ["packages/react/src", "packages/react-reconciler/src"]
55939
+ },
55940
+ {
55941
+ id: "tanstack-query",
55942
+ title: "TanStack Query Source Guide",
55943
+ packageSpec: "@tanstack/react-query",
55944
+ fallbackSpec: "TanStack/query",
55945
+ technologies: ["tanstack-query"],
55946
+ packs: ["tanstack-query"],
55947
+ useWhen: [
55948
+ "Query invalidation, mutation, cache, hydration, or observer behavior affects implementation.",
55949
+ "A usage pattern depends on library internals or version-specific behavior."
55950
+ ],
55951
+ inspectFirst: ["packages/react-query/src", "packages/query-core/src"]
55952
+ },
55953
+ {
55954
+ id: "better-auth",
55955
+ title: "Better Auth Source Guide",
55956
+ packageSpec: "better-auth",
55957
+ fallbackSpec: "better-auth/better-auth",
55958
+ technologies: ["better-auth"],
55959
+ packs: ["better-auth"],
55960
+ useWhen: [
55961
+ "Session, adapter, plugin, OAuth, OTP, or cookie behavior affects implementation.",
55962
+ "Security-sensitive auth behavior needs source-backed verification."
55963
+ ],
55964
+ inspectFirst: ["packages/better-auth/src", "packages/cli/src"]
55965
+ },
55966
+ {
55967
+ id: "drizzle",
55968
+ title: "Drizzle Source Guide",
55969
+ packageSpec: "drizzle-orm",
55970
+ fallbackSpec: "drizzle-team/drizzle-orm",
55971
+ technologies: ["drizzle"],
55972
+ packs: ["drizzle"],
55973
+ useWhen: [
55974
+ "Query builder, migration, relation, or dialect behavior affects implementation.",
55975
+ "Database behavior depends on generated SQL or package-specific edge cases."
55976
+ ],
55977
+ inspectFirst: ["drizzle-orm/src", "drizzle-kit/src"]
55978
+ },
55979
+ {
55980
+ id: "trpc",
55981
+ title: "tRPC Source Guide",
55982
+ packageSpec: "@trpc/server",
55983
+ fallbackSpec: "trpc/trpc",
55984
+ technologies: ["trpc"],
55985
+ packs: ["trpc"],
55986
+ useWhen: [
55987
+ "Router, procedure, transformer, client, or middleware behavior affects implementation.",
55988
+ "Type-level contracts need source-backed verification."
55989
+ ],
55990
+ inspectFirst: ["packages/server/src", "packages/client/src", "packages/react-query/src"]
55991
+ },
55992
+ {
55993
+ id: "elysia",
55994
+ title: "Elysia Source Guide",
55995
+ packageSpec: "elysia",
55996
+ fallbackSpec: "elysiajs/elysia",
55997
+ technologies: ["elysia"],
55998
+ packs: ["elysia"],
55999
+ useWhen: [
56000
+ "Route, plugin, schema, context, or lifecycle behavior affects implementation.",
56001
+ "Runtime behavior needs verification beyond API docs."
56002
+ ],
56003
+ inspectFirst: ["src", "test"]
56004
+ }
56005
+ ];
56006
+ var sourceGuideFile = (guide) => `opensrc/${guide.id}.md`;
56007
+ var sourceGuidesForSelection = ({
56008
+ detectedTechnologies,
56009
+ finalPacks
56010
+ }) => {
56011
+ const technologies = new Set(detectedTechnologies);
56012
+ const packs = new Set(finalPacks);
56013
+ return sourceGuideCatalog.filter((guide) => guide.technologies.some((technology) => technologies.has(technology)) || guide.packs.some((pack2) => packs.has(pack2)));
56014
+ };
56015
+ var summarizeSourceGuide = (guide) => ({
56016
+ id: guide.id,
56017
+ title: guide.title,
56018
+ file: sourceGuideFile(guide),
56019
+ packageSpec: guide.packageSpec,
56020
+ ...guide.fallbackSpec === undefined ? {} : { fallbackSpec: guide.fallbackSpec }
56021
+ });
56022
+ var renderSourceGuideReadme = (guides) => `${[
56023
+ "# opensrc",
56024
+ "",
56025
+ "This directory is an index for source code inspected through the global `opensrc` cache.",
56026
+ "",
56027
+ "It does not contain cloned package source. Each guide card points agents to the right `opensrc path` command, why the source matters, and where to start reading.",
56028
+ "",
56029
+ "Use these cards before inspecting package internals. Prefer official docs first, then resolve live source with `opensrc path --cwd . <package>` or the fallback repository command.",
56030
+ "",
56031
+ "## Guides",
56032
+ "",
56033
+ ...guides.map((guide) => `- [${guide.title}](./${guide.id}.md)`)
56034
+ ].join(`
56035
+ `)}
56036
+ `;
56037
+ var renderSourceGuide = (guide) => `${[
56038
+ `# ${guide.title}`,
56039
+ "",
56040
+ "This is an index card for the global `opensrc` cache. Do not commit cloned source here.",
56041
+ "",
56042
+ "## Resolve Source",
56043
+ "",
56044
+ "```bash",
56045
+ `opensrc path --cwd . ${guide.packageSpec}`,
56046
+ "```",
56047
+ ...guide.fallbackSpec === undefined ? [] : [
56048
+ "",
56049
+ "Fallback repository lookup:",
56050
+ "",
56051
+ "```bash",
56052
+ `opensrc path ${guide.fallbackSpec}`,
56053
+ "```"
56054
+ ],
56055
+ "",
56056
+ "## Use When",
56057
+ "",
56058
+ ...guide.useWhen.map((item) => `- ${item}`),
56059
+ "",
56060
+ "## Inspect First",
56061
+ "",
56062
+ ...guide.inspectFirst.map((item) => `- \`${item}\``),
56063
+ "",
56064
+ "## Rules",
56065
+ "",
56066
+ "- Prefer official docs first when they answer the question.",
56067
+ "- Use `opensrc path --cwd .` so npm package resolution can use this repo's lockfile.",
56068
+ "- Keep the cloned source in the global `~/.opensrc` cache unless the user explicitly asks for a different cache root.",
56069
+ "- Do not copy upstream source into this directory."
56070
+ ].join(`
56071
+ `)}
56072
+ `;
56073
+
55770
56074
  // src/content/hooks.ts
55771
56075
  var hookRegistryForBaseline = (baseline = bundledBaseline) => baseline.hooks;
55772
56076
 
@@ -55827,6 +56131,70 @@ var subagentSpecialistNote = ({
55827
56131
  workspacePath,
55828
56132
  targetFile
55829
56133
  }) => scope5 === "docs" ? "Own docs maintenance and keep durable repo docs aligned with implemented reality." : `Own changes under ${workspacePath ?? targetFile} and defer cross-workspace orchestration to the root agent.`;
56134
+ var workflowCapabilityPacks = {
56135
+ "workflow-planning": {
56136
+ description: "Default workflow planning pack for spec discovery, spec review, and plan review.",
56137
+ skills: [
56138
+ "create-spec",
56139
+ "create-plan",
56140
+ "parallel-research",
56141
+ "swarm-planner",
56142
+ "tdd",
56143
+ "simplify",
56144
+ "stack"
56145
+ ]
56146
+ },
56147
+ "workflow-requirements": {
56148
+ description: "Default workflow requirements pack for grill synthesis and backlog shaping.",
56149
+ skills: ["requirements-phase", "requirements-grill", "write-backlog"]
56150
+ },
56151
+ "workflow-review": {
56152
+ description: "Default workflow review pack for readonly artifact checks.",
56153
+ skills: ["review-phase", "simplify"]
56154
+ }
56155
+ };
56156
+ var workflowSpecialists = [
56157
+ {
56158
+ id: "planning-discovery",
56159
+ ownedPaths: ["."],
56160
+ guidanceFiles: ["AGENTS.md"],
56161
+ packs: ["workflow-planning"],
56162
+ skills: ["parallel-research", "create-spec"],
56163
+ notes: "Use for bounded readonly orientation before spec or plan writing: gather evidence, contradictions, overlapping work, and open questions without solution design."
56164
+ },
56165
+ {
56166
+ id: "requirements-synthesizer",
56167
+ ownedPaths: ["."],
56168
+ guidanceFiles: ["AGENTS.md"],
56169
+ packs: ["workflow-requirements"],
56170
+ skills: ["requirements-phase", "requirements-grill", "write-backlog"],
56171
+ notes: "Use for readonly compression of grill/status/log artifacts into accepted, rejected, superseded, parked, and unresolved decisions."
56172
+ },
56173
+ {
56174
+ id: "backlog-shaper",
56175
+ ownedPaths: ["."],
56176
+ guidanceFiles: ["AGENTS.md"],
56177
+ packs: ["workflow-requirements"],
56178
+ skills: ["requirements-phase", "write-backlog"],
56179
+ notes: "Use for draft-only module, epic, and story shaping from closed requirements; provider sync and final backlog decisions stay with the parent."
56180
+ },
56181
+ {
56182
+ id: "spec-reviewer",
56183
+ ownedPaths: ["."],
56184
+ guidanceFiles: ["AGENTS.md"],
56185
+ packs: ["workflow-planning", "workflow-review"],
56186
+ skills: ["create-spec", "review-phase", "simplify"],
56187
+ notes: "Use for readonly review of drafted specs before user review, checking invented requirements, contradictions, missing constraints, and vague acceptance criteria."
56188
+ },
56189
+ {
56190
+ id: "plan-reviewer",
56191
+ ownedPaths: ["."],
56192
+ guidanceFiles: ["AGENTS.md"],
56193
+ packs: ["workflow-planning", "workflow-review"],
56194
+ skills: ["create-plan", "swarm-planner", "tdd", "simplify"],
56195
+ notes: "Use for readonly review of plans before yielding, checking dependencies, ordering, invalid parallelism, unsafe write overlap, RED targets, validation, and assigned skills."
56196
+ }
56197
+ ];
55830
56198
  var renderSubagentManifestPrompt = ({
55831
56199
  workspaces,
55832
56200
  finalPacks
@@ -55846,6 +56214,7 @@ var renderSubagentManifestPrompt = ({
55846
56214
  "## Requirements",
55847
56215
  "",
55848
56216
  "- Keep capability packs narrow and reusable.",
56217
+ "- Include default workflow archetypes for planning and requirements inner steps: `planning-discovery`, `requirements-synthesizer`, `backlog-shaper`, `spec-reviewer`, and `plan-reviewer`.",
55849
56218
  "- Keep specialist agents scoped by owned paths and guidance files.",
55850
56219
  "- Include `simplify` in every implementation-focused specialist.",
55851
56220
  "- Keep docs ownership in a dedicated docs specialist when `docs/` exists.",
@@ -55860,26 +56229,33 @@ var renderSubagentManifestModule = ({
55860
56229
  if (spec.specialists.length === 0) {
55861
56230
  return fallback;
55862
56231
  }
55863
- const baseSpecialists = spec.finalPacks.includes("research") && !spec.specialists.some((specialist) => specialist.id === "code-review") ? [
55864
- {
55865
- id: "code-review",
55866
- ownedPaths: ["."],
55867
- guidanceFiles: ["AGENTS.md"],
55868
- packs: ["research"],
55869
- skills: ["simplify", "improve-codebase-architecture"],
55870
- notes: "Use for findings-first review across changed code, simplification opportunities, and grounded architecture-friction findings."
55871
- }
55872
- ] : [];
56232
+ const baseWorkflowSpecialists = spec.finalPacks.includes("subagents") ? workflowSpecialists.filter((workflowSpecialist) => !spec.specialists.some((specialist) => specialist.id === workflowSpecialist.id)) : [];
56233
+ const baseSpecialists = [
56234
+ ...baseWorkflowSpecialists,
56235
+ ...spec.finalPacks.includes("research") && !spec.specialists.some((specialist) => specialist.id === "code-review") ? [
56236
+ {
56237
+ id: "code-review",
56238
+ ownedPaths: ["."],
56239
+ guidanceFiles: ["AGENTS.md"],
56240
+ packs: ["research"],
56241
+ skills: ["simplify", "improve-codebase-architecture"],
56242
+ notes: "Use for findings-first review across changed code, simplification opportunities, and grounded architecture-friction findings."
56243
+ }
56244
+ ] : []
56245
+ ];
55873
56246
  const specialists = [...baseSpecialists, ...spec.specialists];
55874
56247
  const selectedPacks = [...new Set(specialists.flatMap((specialist) => specialist.packs))];
55875
56248
  const packDescriptions = new Map(baseline.packs.map((pack2) => [pack2.id, pack2.description]));
55876
- const capabilityPacks = Object.fromEntries(selectedPacks.map((packId) => [
55877
- packId,
55878
- {
55879
- description: packDescriptions.get(packId) ?? `${packId} guidance pack.`,
55880
- skills: skillsForPack(packId, baseline)
55881
- }
55882
- ]));
56249
+ const capabilityPacks = Object.fromEntries(selectedPacks.map((packId) => {
56250
+ const workflowPack = workflowCapabilityPacks[packId];
56251
+ return [
56252
+ packId,
56253
+ workflowPack ?? {
56254
+ description: packDescriptions.get(packId) ?? `${packId} guidance pack.`,
56255
+ skills: skillsForPack(packId, baseline)
56256
+ }
56257
+ ];
56258
+ }));
55883
56259
  const agents = specialists.map((specialist) => ({
55884
56260
  name: specialist.id,
55885
56261
  description: specialist.notes,
@@ -55990,7 +56366,10 @@ var migrateLegacySkillDirectories = ({
55990
56366
  rmSync2(absoluteDirectory, { recursive: true, force: true });
55991
56367
  }
55992
56368
  };
55993
- var selectedHookIds = (finalPacks, baseline) => uniqueSorted(finalPacks.flatMap((packId) => hooksForPack(packId, baseline)));
56369
+ var selectedHookIds = (finalPacks, baseline) => uniqueSorted([
56370
+ "scaffold-update-check",
56371
+ ...finalPacks.flatMap((packId) => hooksForPack(packId, baseline))
56372
+ ]);
55994
56373
  var oxlintConfigCandidates = ["oxlint.config.ts", ".oxlintrc.json", ".oxlintrc.jsonc"];
55995
56374
  var existingOxlintConfigFiles = (scanDirectory) => oxlintConfigCandidates.filter((candidate) => existsSync5(path10.join(scanDirectory, candidate)));
55996
56375
  var oxlintStarterConfig = {
@@ -56233,6 +56612,32 @@ var existingJsonOxlintConfigPath = ({
56233
56612
  }
56234
56613
  return null;
56235
56614
  };
56615
+ var hasRootDocsContent = (scanDirectory) => {
56616
+ const docsDirectory = path10.join(scanDirectory, "docs");
56617
+ if (!existsSync5(docsDirectory)) {
56618
+ return false;
56619
+ }
56620
+ return readdirSync2(docsDirectory).some((entry) => entry !== "AGENTS.md");
56621
+ };
56622
+ var hasJavaScriptWorkspaceDependency = (manifest) => manifest.dependencies.some((dependency) => dependency === "next" || dependency === "react" || dependency === "react-dom" || dependency === "typescript" || dependency === "vite" || dependency.startsWith("@effect/") || dependency.startsWith("@tanstack/") || dependency.startsWith("@trpc/"));
56623
+ var isPythonUvWorkspace = ({
56624
+ scanDirectory,
56625
+ outputDirectory,
56626
+ workspacePath,
56627
+ manifest
56628
+ }) => {
56629
+ const prefix = workspacePath === "." ? "" : `${workspacePath}/`;
56630
+ const hasPythonProject = sourceOrOutputPath({
56631
+ scanDirectory,
56632
+ outputDirectory,
56633
+ relativePath: `${prefix}pyproject.toml`
56634
+ }) !== null || sourceOrOutputPath({
56635
+ scanDirectory,
56636
+ outputDirectory,
56637
+ relativePath: `${prefix}uv.lock`
56638
+ }) !== null;
56639
+ return hasPythonProject && !hasJavaScriptWorkspaceDependency(manifest);
56640
+ };
56236
56641
  var writeAppliedLintConfigs = ({
56237
56642
  scanDirectory,
56238
56643
  outputDirectory,
@@ -56246,6 +56651,14 @@ var writeAppliedLintConfigs = ({
56246
56651
  const manifestRelativePath = toPosixPath(manifest.relativePath);
56247
56652
  const workspacePath = path10.posix.dirname(manifestRelativePath);
56248
56653
  const normalizedWorkspacePath = workspacePath === "." ? "." : workspacePath;
56654
+ if (isPythonUvWorkspace({
56655
+ scanDirectory,
56656
+ outputDirectory,
56657
+ workspacePath: normalizedWorkspacePath,
56658
+ manifest
56659
+ })) {
56660
+ continue;
56661
+ }
56249
56662
  const workspacePacks = packsForWorkspace({
56250
56663
  relativeWorkspacePath: normalizedWorkspacePath,
56251
56664
  manifest,
@@ -56620,6 +57033,9 @@ var managedKindForPath = (relativePath) => {
56620
57033
  if (relativePath.startsWith(".devpunks/specs/lint/")) {
56621
57034
  return "lint-spec";
56622
57035
  }
57036
+ if (relativePath.startsWith("opensrc/")) {
57037
+ return "source-guide";
57038
+ }
56623
57039
  if (relativePath.startsWith(".agents/skills/")) {
56624
57040
  return "skill";
56625
57041
  }
@@ -56668,7 +57084,7 @@ var promptTargetsForDetection = (scanDirectory, detection) => {
56668
57084
  { relativePath: ".agents/AGENTS.md", manifest: null },
56669
57085
  { relativePath: "AGENTS.md", manifest: null }
56670
57086
  ];
56671
- if (existsSync5(path10.join(scanDirectory, "docs"))) {
57087
+ if (hasRootDocsContent(scanDirectory)) {
56672
57088
  targets.push({ relativePath: "docs/AGENTS.md", manifest: null });
56673
57089
  }
56674
57090
  if (!detection.monorepo) {
@@ -56704,6 +57120,7 @@ var writeScaffoldOutput = ({
56704
57120
  const promptOutputs = [];
56705
57121
  const promptSpecFiles = [];
56706
57122
  const lintSpecFiles = [];
57123
+ const sourceGuideFiles = [];
56707
57124
  const skillFiles = [];
56708
57125
  const subagentFiles = [];
56709
57126
  const scriptFiles = [];
@@ -56737,6 +57154,11 @@ var writeScaffoldOutput = ({
56737
57154
  baseline
56738
57155
  }));
56739
57156
  const opensrcReferences = collectOpensrcReferences(promptSpecs);
57157
+ const sourceGuides = sourceGuidesForSelection({
57158
+ detectedTechnologies: detection.detectedTechnologies,
57159
+ finalPacks
57160
+ });
57161
+ const sourceGuideSummaries = sourceGuides.map(summarizeSourceGuide);
56740
57162
  generatedFiles.push(writeArtifact({
56741
57163
  outputDirectory,
56742
57164
  relativePath: ".agents/AGENTS.md",
@@ -56758,6 +57180,24 @@ var writeScaffoldOutput = ({
56758
57180
  }));
56759
57181
  promptSpecFiles.push(promptSpec.specFile);
56760
57182
  }
57183
+ if (sourceGuides.length > 0) {
57184
+ const readmeFile = "opensrc/README.md";
57185
+ generatedFiles.push(writeArtifact({
57186
+ outputDirectory,
57187
+ relativePath: readmeFile,
57188
+ content: renderSourceGuideReadme(sourceGuides)
57189
+ }));
57190
+ sourceGuideFiles.push(readmeFile);
57191
+ for (const guide of sourceGuides) {
57192
+ const guideFile = sourceGuideFile(guide);
57193
+ generatedFiles.push(writeArtifact({
57194
+ outputDirectory,
57195
+ relativePath: guideFile,
57196
+ content: renderSourceGuide(guide)
57197
+ }));
57198
+ sourceGuideFiles.push(guideFile);
57199
+ }
57200
+ }
56761
57201
  if (lintAssets.length > 0) {
56762
57202
  const lintAssetsFile = ".devpunks/specs/lint/assets.json";
56763
57203
  generatedFiles.push(writeArtifact({
@@ -56878,12 +57318,14 @@ var writeScaffoldOutput = ({
56878
57318
  }
56879
57319
  generatedFiles.push(...harnessFiles);
56880
57320
  const requiredToolsFile = ".devpunks/required-tools.json";
57321
+ const requiredToolIds = requiredToolsForSkills(finalSkills, baseline);
56881
57322
  generatedFiles.push(writeArtifact({
56882
57323
  outputDirectory,
56883
57324
  relativePath: requiredToolsFile,
56884
57325
  content: encodeJson({
56885
57326
  skills: finalSkills,
56886
- tools: requiredToolsForSkills(finalSkills, baseline)
57327
+ tools: requiredToolIds,
57328
+ toolContracts: baseline.tools.filter((tool) => requiredToolIds.includes(tool.id))
56887
57329
  })
56888
57330
  }));
56889
57331
  const agentHandoffFile = ".devpunks/AGENT-HANDOFF.md";
@@ -56899,6 +57341,7 @@ var writeScaffoldOutput = ({
56899
57341
  promptOutputs: promptOutputs.toSorted(),
56900
57342
  promptSpecFiles: promptSpecFiles.toSorted(),
56901
57343
  lintSpecFiles: lintSpecFiles.toSorted(),
57344
+ sourceGuideFiles: sourceGuideFiles.toSorted(),
56902
57345
  skillFiles: skillFiles.toSorted(),
56903
57346
  scaffoldManifestFile: ".devpunks/scaffold-manifest.json",
56904
57347
  requiredToolsFile,
@@ -56932,6 +57375,7 @@ var writeScaffoldOutput = ({
56932
57375
  promptOutputs,
56933
57376
  promptSpecFiles,
56934
57377
  lintSpecFiles,
57378
+ sourceGuideFiles,
56935
57379
  skillFiles,
56936
57380
  subagentFiles,
56937
57381
  scriptFiles,
@@ -56941,6 +57385,7 @@ var writeScaffoldOutput = ({
56941
57385
  requiredToolsFile,
56942
57386
  promptSpecs,
56943
57387
  opensrcReferences,
57388
+ sourceGuides: sourceGuideSummaries,
56944
57389
  lintAssets,
56945
57390
  appliedLintConfigs,
56946
57391
  subagentManifestSpec,
@@ -56964,6 +57409,7 @@ var writeScaffoldOutput = ({
56964
57409
  promptOutputs: promptOutputs.toSorted(),
56965
57410
  promptSpecFiles: promptSpecFiles.toSorted(),
56966
57411
  lintSpecFiles: lintSpecFiles.toSorted(),
57412
+ sourceGuideFiles: sourceGuideFiles.toSorted(),
56967
57413
  skillFiles: skillFiles.toSorted(),
56968
57414
  subagentFiles: subagentFiles.toSorted(),
56969
57415
  scriptFiles: scriptFiles.toSorted(),
@@ -56976,6 +57422,7 @@ var writeScaffoldOutput = ({
56976
57422
  managedFiles: managedFilesWithManifest,
56977
57423
  promptSpecs,
56978
57424
  opensrcReferences,
57425
+ sourceGuides: sourceGuideSummaries,
56979
57426
  lintAssets,
56980
57427
  subagentManifestSpec,
56981
57428
  generatedFiles: generatedFiles.toSorted()
@@ -57208,6 +57655,7 @@ var runScaffold = ({
57208
57655
  promptOutputs: scaffoldOutput.promptOutputs,
57209
57656
  promptSpecFiles: scaffoldOutput.promptSpecFiles,
57210
57657
  lintSpecFiles: scaffoldOutput.lintSpecFiles,
57658
+ sourceGuideFiles: scaffoldOutput.sourceGuideFiles,
57211
57659
  skillFiles: scaffoldOutput.skillFiles,
57212
57660
  subagentFiles: scaffoldOutput.subagentFiles,
57213
57661
  scriptFiles: scaffoldOutput.scriptFiles,
@@ -57222,6 +57670,7 @@ var runScaffold = ({
57222
57670
  managedFiles: scaffoldOutput.managedFiles,
57223
57671
  promptSpecs: scaffoldOutput.promptSpecs,
57224
57672
  opensrcReferences: scaffoldOutput.opensrcReferences,
57673
+ sourceGuides: scaffoldOutput.sourceGuides,
57225
57674
  lintAssets: scaffoldOutput.lintAssets,
57226
57675
  subagentManifestSpec: scaffoldOutput.subagentManifestSpec,
57227
57676
  generatedFiles: [...scaffoldOutput.generatedFiles, agentSystemPromptFile],
@@ -57251,6 +57700,7 @@ var runScaffold = ({
57251
57700
  promptOutputs: scaffoldOutput.promptOutputs,
57252
57701
  promptSpecFiles: scaffoldOutput.promptSpecFiles,
57253
57702
  lintSpecFiles: scaffoldOutput.lintSpecFiles,
57703
+ sourceGuideFiles: scaffoldOutput.sourceGuideFiles,
57254
57704
  skillFiles: scaffoldOutput.skillFiles,
57255
57705
  subagentFiles: scaffoldOutput.subagentFiles,
57256
57706
  scriptFiles: scaffoldOutput.scriptFiles,
@@ -57265,6 +57715,7 @@ var runScaffold = ({
57265
57715
  managedFiles: scaffoldOutput.managedFiles,
57266
57716
  promptSpecs: scaffoldOutput.promptSpecs,
57267
57717
  opensrcReferences: scaffoldOutput.opensrcReferences,
57718
+ sourceGuides: scaffoldOutput.sourceGuides,
57268
57719
  lintAssets: scaffoldOutput.lintAssets,
57269
57720
  subagentManifestSpec: scaffoldOutput.subagentManifestSpec,
57270
57721
  generatedFiles: [...scaffoldOutput.generatedFiles, writtenAgentSystemPromptFile]
@@ -57492,11 +57943,42 @@ When processing source material into routed domain knowledge:
57492
57943
  "@types/node": "^25.6.0",
57493
57944
  "@types/react": "^19.2.14",
57494
57945
  "@types/react-dom": "^19.2.3",
57946
+ "oxfmt": "latest",
57947
+ "oxlint": "latest",
57495
57948
  "postcss": "^8.5.13",
57496
57949
  "tailwindcss": "^4.2.4",
57497
- "typescript": "^5.8.3"
57950
+ "typescript": "^5.8.3",
57951
+ "ultracite": "latest"
57498
57952
  }
57499
57953
  }
57954
+ `
57955
+ },
57956
+ {
57957
+ path: "oxlint.config.ts",
57958
+ content: `import { defineConfig } from "oxlint";
57959
+
57960
+ export default defineConfig({
57961
+ categories: {
57962
+ correctness: "error"
57963
+ },
57964
+ env: {
57965
+ builtin: true
57966
+ },
57967
+ ignorePatterns: [
57968
+ ".next/**",
57969
+ "node_modules/**"
57970
+ ],
57971
+ plugins: ["typescript", "unicorn", "oxc"],
57972
+ rules: {
57973
+ "curly": "off",
57974
+ "func-style": "off",
57975
+ "no-use-before-define": "off",
57976
+ "require-await": "off",
57977
+ "sort-keys": "off",
57978
+ "unicorn/filename-case": "off",
57979
+ "unicorn/prefer-top-level-await": "off"
57980
+ }
57981
+ });
57500
57982
  `
57501
57983
  },
57502
57984
  {
@@ -58826,15 +59308,15 @@ var wikiFrameworkLabels = {
58826
59308
  var stageScaffoldCatalog = [
58827
59309
  {
58828
59310
  id: "init",
58829
- summary: "Requirements grill, backlog authoring, and wiki docs seed.",
58830
- skills: ["requirements-grill", "write-backlog"],
59311
+ summary: "Docs onboarding, requirements grill, spec reconstruction, backlog authoring, and wiki docs seed.",
59312
+ skills: ["docs-onboarding", "requirements-grill", "write-backlog", "create-spec"],
58831
59313
  renderPrompt: ({
58832
59314
  wikiRoot,
58833
59315
  backlogProvider,
58834
59316
  wikiFramework
58835
59317
  }) => `You are the operator agent continuing a \`punks scaffold init\` run.
58836
59318
 
58837
- Do not start requirements discovery by default. First reconcile the generated output with this repository.
59319
+ Activate \`$docs-onboarding\` now. Inspect the codebase, existing docs, and the selected backlog provider. Build the Project Map, run the targeted requirements grill, then call \`create-spec\` to reconstruct evidence-backed specs into the scaffolded wiki.
58838
59320
 
58839
59321
  Scaffolded wiki base:
58840
59322
  - treat \`${wikiRoot}\` as the dedicated wiki root for specs, raw inputs, routed project docs, and ingest bookkeeping
@@ -58844,8 +59326,10 @@ Scaffolded wiki base:
58844
59326
  - keep using the reconciled wiki root when later steps create specs, plans, or ingest domain knowledge
58845
59327
 
58846
59328
  Generated skills:
59329
+ - \`.agents/skills/docs-onboarding\`
58847
59330
  - \`.agents/skills/requirements-grill\`
58848
59331
  - \`.agents/skills/write-backlog\`
59332
+ - \`.agents/skills/create-spec\`
58849
59333
 
58850
59334
  Backlog provider:
58851
59335
  - selected provider: ${backlogProviderLabels[backlogProvider]} (\`${backlogProvider}\`)
@@ -58861,8 +59345,10 @@ Post-command guidance:
58861
59345
  1. Read the repository guidance and inspect the generated files.
58862
59346
  2. Move, rename, or refactor the generated wiki and skill output when needed so it matches the actual repo layout.
58863
59347
  3. Report what changed and what remains unresolved.
58864
- 4. Use \`requirements-grill\` and then \`write-backlog\` only when the user actually asks for requirements or backlog generation.
58865
- 5. Use \`punks scaffold setup\` only after the repo shape is ready for repo-aware AI setup.
59348
+ 4. Activate \`$docs-onboarding\` immediately and let it inspect code, docs, and backlog context before writing onboarding artifacts.
59349
+ 5. Let \`docs-onboarding\` run the targeted requirements grill and call \`create-spec\` after grill closure.
59350
+ 6. Use \`write-backlog\` only after accepted requirements are ready for backlog mutation.
59351
+ 7. Use \`punks scaffold setup\` only after the repo shape is ready for repo-aware AI setup.
58866
59352
 
58867
59353
  When the generated init output matches the repo, the next CLI step is:
58868
59354
  - \`punks scaffold setup\``
@@ -58946,15 +59432,21 @@ var copySkillDirectory = ({
58946
59432
  skillId,
58947
59433
  baseline
58948
59434
  }) => {
58949
- const sourceDirectory = skillRegistryByIdForBaseline(baseline)[skillId].sourceDirectory;
59435
+ const baselineSkill = skillRegistryByIdForBaseline(baseline)[skillId];
59436
+ const bundledSkill = skillRegistryByIdForBaseline(bundledBaseline)[skillId];
59437
+ const skill = baselineSkill ?? bundledSkill;
59438
+ if (skill === undefined) {
59439
+ throw new Error(`Unknown scaffold skill: ${skillId}`);
59440
+ }
59441
+ const skillBaseline = baselineSkill === undefined ? bundledBaseline : baseline;
58950
59442
  const targetDirectory = path12.posix.join(".agents/skills", skillId);
58951
59443
  const absoluteTargetDirectory = path12.join(outputDirectory, targetDirectory);
58952
59444
  mkdirSync4(path12.join(outputDirectory, ".agents/skills"), { recursive: true });
58953
59445
  rmSync3(absoluteTargetDirectory, { recursive: true, force: true });
58954
59446
  cpSync2(resolveBaselinePath({
58955
- baselineRoot: baseline.root,
58956
- baselineSkillsRoot: baseline.skillsRoot,
58957
- relativePath: sourceDirectory
59447
+ baselineRoot: skillBaseline.root,
59448
+ baselineSkillsRoot: skillBaseline.skillsRoot,
59449
+ relativePath: skill.sourceDirectory
58958
59450
  }), absoluteTargetDirectory, { recursive: true });
58959
59451
  return targetDirectory;
58960
59452
  };
@@ -59023,6 +59515,11 @@ var tanstackStartDevDependencies = {
59023
59515
  vite: "^8.0.14",
59024
59516
  "vite-tsconfig-paths": "^5.1.4"
59025
59517
  };
59518
+ var nextWikiCheckDevDependencies = {
59519
+ oxfmt: "latest",
59520
+ oxlint: "latest",
59521
+ ultracite: "latest"
59522
+ };
59026
59523
  var updateExistingWikiPackage = ({
59027
59524
  outputDirectory,
59028
59525
  packagePath,
@@ -59038,7 +59535,7 @@ var updateExistingWikiPackage = ({
59038
59535
  mermaid: "11.15.0",
59039
59536
  "next-themes": "0.4.6"
59040
59537
  } : tanstackStartDependencies;
59041
- const expectedDevDependencies = wikiFramework === "next" ? {} : tanstackStartDevDependencies;
59538
+ const expectedDevDependencies = wikiFramework === "next" ? nextWikiCheckDevDependencies : tanstackStartDevDependencies;
59042
59539
  const nextDependencies = mergePackageSection(dependencies, expectedDependencies);
59043
59540
  const nextDevDependencies = mergePackageSection(devDependencies, expectedDevDependencies);
59044
59541
  const nextScripts = wikiFramework === "next" ? scripts === undefined ? undefined : {
@@ -59065,7 +59562,7 @@ var updateExistingWikiPackage = ({
59065
59562
  writeFileSync5(packagePath, JSON.stringify({
59066
59563
  ...packageJson,
59067
59564
  dependencies: nextDependencies,
59068
- ...packageJson.devDependencies === undefined && wikiFramework === "next" ? {} : { devDependencies: nextDevDependencies },
59565
+ devDependencies: nextDevDependencies,
59069
59566
  ...nextScripts === undefined ? {} : { scripts: nextScripts }
59070
59567
  }, null, 2) + `
59071
59568
  `);
@@ -59412,7 +59909,7 @@ var setupCommand = exports_Command.make("setup", {
59412
59909
  message: error4.message
59413
59910
  })))))).pipe(exports_Command.withDescription("Repo-aware AI setup. Agents: activate $dp-cli, then reconcile .devpunks output with the real repo layout."));
59414
59911
  var scaffoldCommand = exports_Command.make("scaffold", {}, () => exports_Effect.sync(() => console.log(renderScaffoldGuide()))).pipe(exports_Command.withDescription("Scaffold init or setup. Agents: activate $dp-cli before following generated handoffs."), exports_Command.withSubcommands([
59415
- stageCommand("init", "Seed requirements/backlog skills and wiki structure. Agents: activate $dp-cli and reconcile wiki layout."),
59912
+ stageCommand("init", "Seed docs onboarding, requirements/backlog/spec skills, and wiki structure. Agents: activate $dp-cli, then $docs-onboarding."),
59416
59913
  setupCommand
59417
59914
  ]));
59418
59915
 
@@ -60351,10 +60848,22 @@ var scaffoldManifestFile = ".devpunks/scaffold-manifest.json";
60351
60848
  var yesValues2 = new Set(["", "y", "yes"]);
60352
60849
  var encodeJson3 = encodeSync(parseJson(Unknown));
60353
60850
  var encodePrettyJson3 = (value6) => JSON.stringify(JSON.parse(encodeJson3(value6)), null, 2);
60851
+ var updateCompleteMessage = ({
60852
+ applyRequested,
60853
+ hasManagedUpdates
60854
+ }) => {
60855
+ if (applyRequested && hasManagedUpdates) {
60856
+ return "Managed scaffold files updated.";
60857
+ }
60858
+ if (applyRequested) {
60859
+ return "No managed scaffold changes were needed.";
60860
+ }
60861
+ return "No files were written.";
60862
+ };
60354
60863
  var managedFileSchema = Struct({
60355
60864
  path: String$,
60356
60865
  sha256: String$,
60357
- kind: Literal2("agent-prompt", "handoff", "harness", "hook", "lint-spec", "manifest", "prompt-spec", "required-tools", "script", "skill", "subagent")
60866
+ kind: Literal2("agent-prompt", "handoff", "harness", "hook", "lint-spec", "manifest", "prompt-spec", "required-tools", "script", "skill", "source-guide", "subagent")
60358
60867
  });
60359
60868
  var scaffoldManifestSchema = parseJson(Struct({
60360
60869
  repoShapeMode: optional(String$),
@@ -60547,21 +61056,26 @@ var copyIfExists = ({
60547
61056
  if (!existsSync7(sourcePath))
60548
61057
  return;
60549
61058
  const targetPath = path14.join(targetDirectory, relativePath);
61059
+ const stat3 = lstatSync2(sourcePath);
60550
61060
  mkdirSync5(path14.dirname(targetPath), { recursive: true });
60551
- cpSync3(sourcePath, targetPath, { recursive: true });
61061
+ if (stat3.isSymbolicLink()) {
61062
+ symlinkSync2(readlinkSync2(sourcePath), targetPath);
61063
+ return;
61064
+ }
61065
+ cpSync3(sourcePath, targetPath, { recursive: true, verbatimSymlinks: true });
60552
61066
  };
60553
61067
  var buildWikiAlignment = ({
60554
61068
  rootDirectory,
60555
61069
  detection
60556
61070
  }) => {
60557
61071
  const expectedDirectory = mkdtempSync2(path14.join(tmpdir3(), "punks-wiki-update-"));
60558
- const wikiRoot = detection.monorepo ? "apps/wiki" : "wiki";
61072
+ const wikiRoot = existsSync7(path14.join(rootDirectory, "apps/wiki")) ? "apps/wiki" : existsSync7(path14.join(rootDirectory, "wiki")) ? "wiki" : detection.monorepo ? "apps/wiki" : "wiki";
60559
61073
  copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: wikiRoot });
60560
61074
  copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: "docs" });
60561
61075
  const wikiFramework = readWikiFrameworkPin(path14.join(expectedDirectory, wikiRoot));
60562
61076
  scaffoldWikiForDirectory({
60563
61077
  outputDirectory: expectedDirectory,
60564
- monorepo: detection.monorepo,
61078
+ monorepo: wikiRoot === "apps/wiki",
60565
61079
  wikiFramework
60566
61080
  });
60567
61081
  const syncScript = path14.join(expectedDirectory, wikiRoot, "scripts", "sync-content.mjs");
@@ -60634,6 +61148,7 @@ var runUpdate = ({
60634
61148
  baseline = bundledBaseline,
60635
61149
  toolRuntime
60636
61150
  }) => exports_Effect.gen(function* () {
61151
+ const writeHuman = (line4) => emitJson ? exports_Effect.void : prompt4.writeLine(line4);
60637
61152
  const manifest = yield* exports_Effect.try({
60638
61153
  try: () => readManifest(rootDirectory),
60639
61154
  catch: (cause3) => new CliValidationError({
@@ -60687,20 +61202,20 @@ var runUpdate = ({
60687
61202
  const hasManagedUpdates = allChanges.length > 0 || staleFiles.length > 0;
60688
61203
  const needsAttention = hasManagedUpdates || packDrift || baselineDrift;
60689
61204
  const driftPrompt = packDrift ? packDriftPrompt({ rootDirectory, finalPacks, resolvedPacks }) : null;
60690
- yield* prompt4.writeLine(renderCommandSection("Update Detection", formatDetectionSummary(detection)));
60691
- yield* prompt4.writeLine("");
60692
- yield* prompt4.writeLine(renderCommandSection("Recorded Packs", finalPacks.length === 0 ? "\u2205" : finalPacks.map((pack2) => `\u2022 ${pack2}`).join(`
61205
+ yield* writeHuman(renderCommandSection("Update Detection", formatDetectionSummary(detection)));
61206
+ yield* writeHuman("");
61207
+ yield* writeHuman(renderCommandSection("Recorded Packs", finalPacks.length === 0 ? "\u2205" : finalPacks.map((pack2) => `\u2022 ${pack2}`).join(`
60693
61208
  `)));
60694
- yield* prompt4.writeLine("");
60695
- yield* prompt4.writeLine(renderCommandSection("Baseline", [
61209
+ yield* writeHuman("");
61210
+ yield* writeHuman(renderCommandSection("Baseline", [
60696
61211
  `active: ${baseline.summary.source}/${baseline.summary.channel} ${baseline.summary.version}`,
60697
61212
  `recorded: ${typeof manifestBaseline?.version === "string" ? manifestBaseline.version : "unknown"}`,
60698
61213
  `drift: ${baselineDrift ? "yes" : "no"}`
60699
61214
  ].join(`
60700
61215
  `)));
60701
61216
  if (packDrift) {
60702
- yield* prompt4.writeLine("");
60703
- yield* prompt4.writeLine(renderCommandSection("Pack Drift", [
61217
+ yield* writeHuman("");
61218
+ yield* writeHuman(renderCommandSection("Pack Drift", [
60704
61219
  "Current package manifests resolve to a different scaffold pack set.",
60705
61220
  "",
60706
61221
  formatResolvedPackSummary({
@@ -60717,16 +61232,16 @@ var runUpdate = ({
60717
61232
  ].join(`
60718
61233
  `)));
60719
61234
  }
60720
- yield* prompt4.writeLine("");
60721
- yield* prompt4.writeLine(renderCommandSection("Managed Changes", summarizeChanges(allChanges)));
61235
+ yield* writeHuman("");
61236
+ yield* writeHuman(renderCommandSection("Managed Changes", summarizeChanges(allChanges)));
60722
61237
  if (staleFiles.length > 0) {
60723
- yield* prompt4.writeLine("");
60724
- yield* prompt4.writeLine(renderCommandSection("Stale Managed Files", summarizeStaleFiles(staleFiles)));
61238
+ yield* writeHuman("");
61239
+ yield* writeHuman(renderCommandSection("Stale Managed Files", summarizeStaleFiles(staleFiles)));
60725
61240
  }
60726
61241
  const patchPreview = diffableChanges(allChanges);
60727
61242
  if (patchPreview.length > 0) {
60728
- yield* prompt4.writeLine("");
60729
- yield* prompt4.writeLine(renderCommandSection("Diff Preview", [
61243
+ yield* writeHuman("");
61244
+ yield* writeHuman(renderCommandSection("Diff Preview", [
60730
61245
  ...patchPreview.map((change) => change.patch),
60731
61246
  ...allChanges.length > patchPreview.length ? [
60732
61247
  `Showing ${patchPreview.length} focused diffs. Full structured details are available with --json.`
@@ -60734,20 +61249,21 @@ var runUpdate = ({
60734
61249
  ].join(`
60735
61250
  `)));
60736
61251
  }
60737
- const shouldApply = write4 || yes ? true : check2 || !hasManagedUpdates ? false : yesValues2.has((yield* prompt4.readLine(renderQuestion("Apply managed scaffold updates? [Y/n]: "))).trim().toLowerCase());
61252
+ const applyRequested = write4 || yes ? true : check2 || emitJson || !hasManagedUpdates ? false : yesValues2.has((yield* prompt4.readLine(renderQuestion("Apply managed scaffold updates? [Y/n]: "))).trim().toLowerCase());
61253
+ const shouldApply = applyRequested && hasManagedUpdates;
60738
61254
  let toolBootstrapStatuses = [];
60739
- if (shouldApply && ensureTools) {
61255
+ if (applyRequested && ensureTools) {
60740
61256
  const requiredTools = requiredToolsForSkills(selectedSkills3(finalPacks, baseline), baseline);
60741
61257
  if (requiredTools.length > 0) {
60742
- yield* prompt4.writeLine("");
60743
- yield* prompt4.writeLine(renderHint(`Ensuring required tools: ${requiredTools.join(", ")}`));
61258
+ yield* writeHuman("");
61259
+ yield* writeHuman(renderHint(`Ensuring required tools: ${requiredTools.join(", ")}`));
60744
61260
  toolBootstrapStatuses = ensureToolsInstalledBestEffort(requiredTools, baseline, toolRuntime);
60745
- yield* prompt4.writeLine(renderCommandSection("Tool bootstrap", toolBootstrapStatuses.map((entry) => `\u2022 ${entry.toolId}: ${formatToolBootstrapStatus(entry)}`).join(`
61261
+ yield* writeHuman(renderCommandSection("Tool bootstrap", toolBootstrapStatuses.map((entry) => `\u2022 ${entry.toolId}: ${formatToolBootstrapStatus(entry)}`).join(`
60746
61262
  `)));
60747
61263
  const failureDetails = formatToolBootstrapFailureDetails(toolBootstrapStatuses);
60748
61264
  if (failureDetails !== null) {
60749
- yield* prompt4.writeLine("");
60750
- yield* prompt4.writeLine(renderCommandSection("Tool Bootstrap Warning", failureDetails));
61265
+ yield* writeHuman("");
61266
+ yield* writeHuman(renderCommandSection("Tool Bootstrap Warning", failureDetails));
60751
61267
  }
60752
61268
  }
60753
61269
  }
@@ -60796,9 +61312,9 @@ var runUpdate = ({
60796
61312
  driftPrompt,
60797
61313
  baselineDrift
60798
61314
  };
60799
- yield* prompt4.writeLine("");
60800
- yield* prompt4.writeLine(renderCommandSection("Update Complete", [
60801
- shouldApply ? "Managed scaffold files updated." : "No files were written.",
61315
+ yield* writeHuman("");
61316
+ yield* writeHuman(renderCommandSection("Update Complete", [
61317
+ updateCompleteMessage({ applyRequested, hasManagedUpdates }),
60802
61318
  `Changed files: ${allChanges.length}`,
60803
61319
  `Stale files: ${staleFiles.length}`,
60804
61320
  `Manifests scanned: ${manifestPaths(detection).join(", ") || "\u2205"}`,
@@ -60806,8 +61322,6 @@ var runUpdate = ({
60806
61322
  ].join(`
60807
61323
  `)));
60808
61324
  if (emitJson) {
60809
- yield* prompt4.writeLine("");
60810
- yield* prompt4.writeLine(renderJsonLabel());
60811
61325
  yield* prompt4.writeLine(encodePrettyJson3(result));
60812
61326
  }
60813
61327
  rmSync4(expectedDirectory, { recursive: true, force: true });
@@ -60853,9 +61367,10 @@ var updateCommand = exports_Command.make("update", {
60853
61367
  baseline: resolvedBaseline
60854
61368
  });
60855
61369
  }).pipe(exports_Effect.catchTag("CliValidationError", (error4) => exports_Effect.sync(() => {
60856
- console.log(renderHint(error4.message));
61370
+ console.error(renderHint(error4.message));
61371
+ process.exitCode = 1;
60857
61372
  })), exports_Effect.catchTag("CliPromptError", (error4) => isPromptQuitSignal(error4.cause) ? exports_Effect.sync(() => {
60858
- console.log(renderHint("Update cancelled."));
61373
+ console.error(renderHint("Update cancelled."));
60859
61374
  }) : exports_Effect.fail(new CliPromptError({
60860
61375
  cause: error4.cause,
60861
61376
  message: error4.message