@punks/cli 2.1.2 → 2.1.4

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/dist/index.js CHANGED
@@ -10891,9 +10891,9 @@ var require_public_api = __commonJS((exports) => {
10891
10891
 
10892
10892
  // src/index.ts
10893
10893
  import { spawn as spawn2 } from "child_process";
10894
- import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
10894
+ import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "fs";
10895
10895
  import { homedir as homedir3 } from "os";
10896
- import path15 from "path";
10896
+ import path16 from "path";
10897
10897
 
10898
10898
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Array.js
10899
10899
  var exports_Array = {};
@@ -52291,11 +52291,14 @@ class ObservedRepositorySummary extends exports_Schema.Class("ObservedRepository
52291
52291
  class ProjectUsageEventSummary extends exports_Schema.Class("ProjectUsageEventSummary")({
52292
52292
  id: exports_Schema.String,
52293
52293
  eventId: exports_Schema.String,
52294
- name: ProductTelemetryEventName,
52295
- source: TelemetrySource,
52294
+ name: exports_Schema.String,
52295
+ source: exports_Schema.String,
52296
52296
  counted: exports_Schema.Boolean,
52297
52297
  cliVersion: exports_Schema.String,
52298
- baseline: exports_Schema.optional(TelemetryBaselineContext),
52298
+ baseline: exports_Schema.optional(exports_Schema.Struct({
52299
+ channel: exports_Schema.optional(exports_Schema.String),
52300
+ version: exports_Schema.optional(exports_Schema.String)
52301
+ })),
52299
52302
  occurredAt: IsoDateTimeString,
52300
52303
  operator: exports_Schema.optional(BackofficeOperatorSummary)
52301
52304
  }) {
@@ -52307,9 +52310,9 @@ class HarnessReportSummary extends exports_Schema.Class("HarnessReportSummary")(
52307
52310
  observedRepositoryId: exports_Schema.optional(exports_Schema.String),
52308
52311
  title: exports_Schema.String,
52309
52312
  body: exports_Schema.optional(exports_Schema.String),
52310
- type: HarnessReportType,
52311
- severity: HarnessReportSeverity,
52312
- status: HarnessReportStatus,
52313
+ type: exports_Schema.String,
52314
+ severity: exports_Schema.String,
52315
+ status: exports_Schema.String,
52313
52316
  githubUrl: exports_Schema.optional(exports_Schema.String),
52314
52317
  createdAt: IsoDateTimeString,
52315
52318
  updatedAt: IsoDateTimeString,
@@ -52324,7 +52327,7 @@ class ProjectUsageSummary extends exports_Schema.Class("ProjectUsageSummary")({
52324
52327
  countedEventCount: exports_Schema.Number,
52325
52328
  openReportCount: exports_Schema.Number,
52326
52329
  latestCliVersion: exports_Schema.optional(exports_Schema.String),
52327
- latestBaselineChannel: exports_Schema.optional(BaselineChannel),
52330
+ latestBaselineChannel: exports_Schema.optional(exports_Schema.String),
52328
52331
  latestBaselineVersion: exports_Schema.optional(exports_Schema.String),
52329
52332
  lastActivityAt: exports_Schema.optional(IsoDateTimeString),
52330
52333
  initializedBy: exports_Schema.optional(BackofficeOperatorSummary),
@@ -52402,7 +52405,7 @@ var recordProductTelemetryEvent = (options9) => exports_Effect.gen(function* ()
52402
52405
 
52403
52406
  // package.json
52404
52407
  var name = "@punks/cli";
52405
- var version = "2.1.2";
52408
+ var version = "2.1.4";
52406
52409
  // src/telemetry/product.ts
52407
52410
  var git = (cwd, args2) => {
52408
52411
  try {
@@ -52995,7 +52998,7 @@ var reportCommand = exports_Command.make("report", {
52995
52998
  })).pipe(exports_Command.withDescription("Create a GitHub issue in the Harness Intelligence repository for maintainer triage."));
52996
52999
 
52997
53000
  // src/cli/scaffold-command.ts
52998
- import path12 from "path";
53001
+ import path13 from "path";
52999
53002
 
53000
53003
  // src/baseline/resolve.ts
53001
53004
  import { createHash } from "crypto";
@@ -54484,9 +54487,9 @@ var PromptLive = exports_Effect.acquireRelease(exports_Effect.sync(() => createI
54484
54487
 
54485
54488
  // src/scaffold/run.ts
54486
54489
  import { execFileSync as execFileSync6 } from "child_process";
54487
- import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
54490
+ import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
54488
54491
  import { homedir as homedir2 } from "os";
54489
- import path10 from "path";
54492
+ import path11 from "path";
54490
54493
 
54491
54494
  // src/content/packs.ts
54492
54495
  var packContents = packCatalog;
@@ -54864,7 +54867,155 @@ var hasBackendWorkspaceName = (manifest) => {
54864
54867
  var hasBackendSurface = (result) => exports_Array.some(result.detectedTechnologies, (technology) => technology === "better-auth" || technology === "drizzle" || technology === "elysia" || technology === "trpc") || result.manifests.some(hasBackendWorkspaceName);
54865
54868
 
54866
54869
  // src/core/format-summary.ts
54870
+ import path8 from "path";
54871
+
54872
+ // src/core/tools.ts
54873
+ import { execFileSync as execFileSync4 } from "child_process";
54874
+ import { accessSync, constants as constants2 } from "fs";
54875
+ import { homedir } from "os";
54867
54876
  import path7 from "path";
54877
+ var commandExistsOnPath = (command, env2 = process.env, platform = process.platform) => {
54878
+ const pathValue = env2.PATH ?? env2.Path;
54879
+ if (pathValue === undefined || pathValue.length === 0) {
54880
+ return false;
54881
+ }
54882
+ const isWindows = platform === "win32";
54883
+ const pathSeparator = isWindows ? ";" : ":";
54884
+ const pathEntries = pathValue.split(pathSeparator).filter((entry) => entry.length > 0);
54885
+ const pathExtensions = isWindows ? (env2.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((extension) => extension.length > 0) : [""];
54886
+ const commandExtensions = isWindows && path7.extname(command).length === 0 ? pathExtensions : [""];
54887
+ const hasPathSegment = command.includes("/") || command.includes("\\");
54888
+ const candidates = (hasPathSegment ? [""] : pathEntries).flatMap((entry) => commandExtensions.map((extension) => hasPathSegment ? `${command}${extension}` : path7.join(entry, `${command}${extension}`)));
54889
+ return candidates.some((candidate) => {
54890
+ try {
54891
+ accessSync(candidate, isWindows ? constants2.F_OK : constants2.X_OK);
54892
+ return true;
54893
+ } catch {
54894
+ return false;
54895
+ }
54896
+ });
54897
+ };
54898
+ var defaultRuntime3 = {
54899
+ cwd: homedir(),
54900
+ commandExists: commandExistsOnPath,
54901
+ execFile: (command, args2, options9) => {
54902
+ execFileSync4(command, [...args2], {
54903
+ cwd: options9?.cwd,
54904
+ stdio: options9?.stdio ?? "inherit"
54905
+ });
54906
+ }
54907
+ };
54908
+ var detectGlobalPackageManager = (runtime5) => {
54909
+ if (runtime5.commandExists("bun")) {
54910
+ return "bun";
54911
+ }
54912
+ if (runtime5.commandExists("pnpm")) {
54913
+ return "pnpm";
54914
+ }
54915
+ if (runtime5.commandExists("npm")) {
54916
+ return "npm";
54917
+ }
54918
+ return null;
54919
+ };
54920
+ var globalInstallCommandFor = (packageManager, packageName) => {
54921
+ switch (packageManager) {
54922
+ case "bun":
54923
+ return ["bun", "add", "-g", packageName];
54924
+ case "pnpm":
54925
+ return ["pnpm", "add", "-g", packageName];
54926
+ case "npm":
54927
+ return ["npm", "install", "-g", packageName];
54928
+ }
54929
+ };
54930
+ var ensureToolsInstalled = (toolIds, baseline = bundledBaseline, runtime5 = defaultRuntime3) => {
54931
+ const packageManager = detectGlobalPackageManager(runtime5);
54932
+ const statuses = [];
54933
+ const toolCatalogById = Object.fromEntries(baseline.tools.map((tool) => [tool.id, tool]));
54934
+ if (toolIds.length > 0 && packageManager === null) {
54935
+ throw new Error("Cannot install required tools because no supported global package manager was found on PATH. Install Bun, pnpm, or npm first.");
54936
+ }
54937
+ const globalPackageManager = packageManager;
54938
+ const cwd = runtime5.cwd ?? homedir();
54939
+ for (const toolId of toolIds) {
54940
+ const tool = toolCatalogById[toolId];
54941
+ if (tool === undefined) {
54942
+ throw new Error(`Unknown required tool \`${toolId}\` in baseline.`);
54943
+ }
54944
+ const missingPrerequisites = tool.requiredBins.filter((command) => !runtime5.commandExists(command));
54945
+ if (missingPrerequisites.length > 0) {
54946
+ throw new Error(`Cannot install required tool \`${toolId}\` because ${missingPrerequisites.join(", ")} is not available on PATH.`);
54947
+ }
54948
+ const alreadyPresent = runtime5.commandExists(toolId);
54949
+ if (!alreadyPresent) {
54950
+ const [command, ...args2] = globalInstallCommandFor(globalPackageManager, tool.packageName);
54951
+ runtime5.execFile(command, args2, {
54952
+ cwd,
54953
+ stdio: "inherit"
54954
+ });
54955
+ if (!runtime5.commandExists(toolId)) {
54956
+ throw new Error(`Tried to install required tool \`${toolId}\`, but the binary is still not available on PATH afterwards.`);
54957
+ }
54958
+ }
54959
+ for (const [command, ...args2] of tool.ensureCommands) {
54960
+ runtime5.execFile(command, args2, {
54961
+ cwd,
54962
+ stdio: "inherit"
54963
+ });
54964
+ }
54965
+ statuses.push({
54966
+ toolId,
54967
+ status: alreadyPresent ? "already-present" : "installed"
54968
+ });
54969
+ }
54970
+ return statuses;
54971
+ };
54972
+ var errorMessage = (cause3) => cause3 instanceof Error ? cause3.message : String(cause3);
54973
+ var errorStack = (cause3) => cause3 instanceof Error ? cause3.stack ?? cause3.message : String(cause3);
54974
+ var ensureToolsInstalledBestEffort = (toolIds, baseline = bundledBaseline, runtime5 = defaultRuntime3) => toolIds.flatMap((toolId) => {
54975
+ try {
54976
+ return ensureToolsInstalled([toolId], baseline, runtime5);
54977
+ } catch (cause3) {
54978
+ return [
54979
+ {
54980
+ toolId,
54981
+ status: "failed",
54982
+ errorMessage: errorMessage(cause3),
54983
+ errorStack: errorStack(cause3)
54984
+ }
54985
+ ];
54986
+ }
54987
+ });
54988
+ var formatToolBootstrapStatus = (entry) => {
54989
+ switch (entry.status) {
54990
+ case "already-present":
54991
+ return "already present";
54992
+ case "installed":
54993
+ return "installed during scaffold";
54994
+ case "failed":
54995
+ return "bootstrap failed";
54996
+ }
54997
+ };
54998
+ var formatToolBootstrapFailureDetails = (statuses) => {
54999
+ const failures2 = statuses.filter((entry) => entry.status === "failed");
55000
+ if (failures2.length === 0)
55001
+ return null;
55002
+ return [
55003
+ "Required tool bootstrap failed, but scaffold/update output can still be written.",
55004
+ "",
55005
+ "Agent recovery prompt:",
55006
+ "Read `.devpunks/required-tools.json`, verify each listed tool manually, then fix the failed install before deeper repo work. If `agent-browser` failed while installing Chromium, install or repair that browser dependency outside the scaffold command, then rerun `agent-browser install` or the documented tool check.",
55007
+ "",
55008
+ "Failure stack traces:",
55009
+ ...failures2.flatMap((failure) => [
55010
+ "",
55011
+ `--- ${failure.toolId} ---`,
55012
+ failure.errorStack ?? failure.errorMessage ?? "Unknown tool bootstrap failure."
55013
+ ])
55014
+ ].join(`
55015
+ `);
55016
+ };
55017
+
55018
+ // src/core/format-summary.ts
54868
55019
  var formatList = (values4) => values4.length === 0 ? [" \u2205"] : values4.map((value6) => ` \u2022 ${value6}`);
54869
55020
  var wrapInlineValues = ({
54870
55021
  values: values4,
@@ -54935,8 +55086,8 @@ var formatDetectionSummary = (detection) => [
54935
55086
  `cwd: ${detection.cwd}`,
54936
55087
  ...section("detected languages:", formatList(detection.detectedLanguages)),
54937
55088
  ...section("detected technologies:", formatList(detection.detectedTechnologies)),
54938
- ...section("manifest files:", formatList(detection.manifests.map((manifest) => path7.relative(detection.cwd, manifest.path) || "package.json"))),
54939
- ...section("monorepo signals:", formatList(detection.monorepoSignals.map((signal) => `${signal.type} (${path7.relative(detection.cwd, signal.path) || "."})`)))
55089
+ ...section("manifest files:", formatList(detection.manifests.map((manifest) => path8.relative(detection.cwd, manifest.path) || "package.json"))),
55090
+ ...section("monorepo signals:", formatList(detection.monorepoSignals.map((signal) => `${signal.type} (${path8.relative(detection.cwd, signal.path) || "."})`)))
54940
55091
  ].join(`
54941
55092
  `);
54942
55093
  var formatConfirmationSummary = (result, baseline = bundledBaseline) => [
@@ -54966,7 +55117,7 @@ var formatConfirmationSummary = (result, baseline = bundledBaseline) => [
54966
55117
  ...maybeSection("hidden output directories:", formatList(result.hiddenOutputDirectories)),
54967
55118
  ...section("agent handoff file:", formatList([result.agentHandoffFile])),
54968
55119
  ...section("required tools file:", formatList([result.requiredToolsFile])),
54969
- ...maybeSection("tool bootstrap:", formatList(result.toolBootstrapStatuses.map((entry) => `${entry.toolId}: ${entry.status === "already-present" ? "already present" : "installed during scaffold"}`))),
55120
+ ...maybeSection("tool bootstrap:", formatList(result.toolBootstrapStatuses.map((entry) => `${entry.toolId}: ${formatToolBootstrapStatus(entry)}`))),
54970
55121
  ...section("scaffold manifest:", formatList([result.scaffoldManifestFile]))
54971
55122
  ].join(`
54972
55123
  `);
@@ -54982,9 +55133,15 @@ var formatAgentHandoffSummary = (result) => [
54982
55133
  "",
54983
55134
  ...result.toolBootstrapStatuses.length === 0 ? [] : [
54984
55135
  "Tool bootstrap status:",
54985
- ...result.toolBootstrapStatuses.map((entry) => ` \u2022 \`${entry.toolId}\`: ${entry.status === "already-present" ? "already present" : "installed during scaffold"}`),
55136
+ ...result.toolBootstrapStatuses.map((entry) => ` \u2022 \`${entry.toolId}\`: ${formatToolBootstrapStatus(entry)}`),
54986
55137
  ""
54987
55138
  ],
55139
+ ...result.toolBootstrapStatuses.some((entry) => entry.status === "failed") ? [
55140
+ "Tool bootstrap recovery:",
55141
+ " \u2022 Read `.devpunks/required-tools.json` and manually verify every listed tool before deeper repo work.",
55142
+ " \u2022 Repair failed installs outside the scaffold command. For `agent-browser` Chromium failures, rerun `agent-browser install` after fixing the local browser dependency.",
55143
+ ""
55144
+ ] : [],
54988
55145
  "What was scaffolded:",
54989
55146
  " \u2022 final scoped/root prompt files were not written yet",
54990
55147
  ...formatList([
@@ -55041,6 +55198,47 @@ var formatResolvedPackSummary = (options9) => options9.optionalPacks.length ===
55041
55198
  ].join(`
55042
55199
  `);
55043
55200
 
55201
+ // src/core/gitignore.ts
55202
+ import { existsSync as existsSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "fs";
55203
+ import path9 from "path";
55204
+ var harnessDirectories = new Set([".agents", ".claude", ".codex", ".cursor", ".opencode"]);
55205
+ var normalizeGitignorePattern = (line4) => {
55206
+ const trimmed2 = line4.trim();
55207
+ if (trimmed2 === "" || trimmed2.startsWith("#") || trimmed2.startsWith("!")) {
55208
+ return null;
55209
+ }
55210
+ return trimmed2.replace(/^\//, "").replace(/\/\*\*?$/, "").replace(/\/$/, "");
55211
+ };
55212
+ var isHarnessDirectoryIgnore = (line4) => {
55213
+ const normalized = normalizeGitignorePattern(line4);
55214
+ return normalized !== null && harnessDirectories.has(normalized);
55215
+ };
55216
+ var removeHarnessDirectoriesFromGitignore = (rootDirectory) => {
55217
+ const gitignorePath = path9.join(rootDirectory, ".gitignore");
55218
+ if (!existsSync4(gitignorePath)) {
55219
+ return { gitignorePath, removedPatterns: [] };
55220
+ }
55221
+ const original = readFileSync5(gitignorePath, "utf8");
55222
+ const hadFinalNewline = original.endsWith(`
55223
+ `);
55224
+ const removedPatterns = [];
55225
+ const keptLines = original.split(/\r?\n/).filter((line4, index, lines3) => {
55226
+ if (index === lines3.length - 1 && line4 === "")
55227
+ return false;
55228
+ if (!isHarnessDirectoryIgnore(line4))
55229
+ return true;
55230
+ removedPatterns.push(line4.trim());
55231
+ return false;
55232
+ });
55233
+ if (removedPatterns.length === 0) {
55234
+ return { gitignorePath, removedPatterns };
55235
+ }
55236
+ writeFileSync2(gitignorePath, `${keptLines.join(`
55237
+ `)}${hadFinalNewline ? `
55238
+ ` : ""}`, "utf8");
55239
+ return { gitignorePath, removedPatterns };
55240
+ };
55241
+
55044
55242
  // src/core/pack-registry.ts
55045
55243
  var defaultPackIds2 = defaultPackIdsForBaseline();
55046
55244
  var detectedPackIds2 = detectedPackIdsForBaseline();
@@ -55122,122 +55320,21 @@ var finalizePackSelection = (resolved, additions, removals) => {
55122
55320
  };
55123
55321
  var canRemovePack = (resolved, packId) => resolved.preselectedPacks.includes(packId) && !resolved.defaultPacks.includes(packId);
55124
55322
 
55125
- // src/core/tools.ts
55126
- import { execFileSync as execFileSync4 } from "child_process";
55127
- import { accessSync, constants as constants2 } from "fs";
55128
- import { homedir } from "os";
55129
- import path8 from "path";
55130
- var commandExistsOnPath = (command, env2 = process.env, platform = process.platform) => {
55131
- const pathValue = env2.PATH ?? env2.Path;
55132
- if (pathValue === undefined || pathValue.length === 0) {
55133
- return false;
55134
- }
55135
- const isWindows = platform === "win32";
55136
- const pathSeparator = isWindows ? ";" : ":";
55137
- const pathEntries = pathValue.split(pathSeparator).filter((entry) => entry.length > 0);
55138
- const pathExtensions = isWindows ? (env2.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((extension) => extension.length > 0) : [""];
55139
- const commandExtensions = isWindows && path8.extname(command).length === 0 ? pathExtensions : [""];
55140
- const hasPathSegment = command.includes("/") || command.includes("\\");
55141
- const candidates = (hasPathSegment ? [""] : pathEntries).flatMap((entry) => commandExtensions.map((extension) => hasPathSegment ? `${command}${extension}` : path8.join(entry, `${command}${extension}`)));
55142
- return candidates.some((candidate) => {
55143
- try {
55144
- accessSync(candidate, isWindows ? constants2.F_OK : constants2.X_OK);
55145
- return true;
55146
- } catch {
55147
- return false;
55148
- }
55149
- });
55150
- };
55151
- var defaultRuntime3 = {
55152
- cwd: homedir(),
55153
- commandExists: commandExistsOnPath,
55154
- execFile: (command, args2, options9) => {
55155
- execFileSync4(command, [...args2], {
55156
- cwd: options9?.cwd,
55157
- stdio: options9?.stdio ?? "inherit"
55158
- });
55159
- }
55160
- };
55161
- var detectGlobalPackageManager = (runtime5) => {
55162
- if (runtime5.commandExists("bun")) {
55163
- return "bun";
55164
- }
55165
- if (runtime5.commandExists("pnpm")) {
55166
- return "pnpm";
55167
- }
55168
- if (runtime5.commandExists("npm")) {
55169
- return "npm";
55170
- }
55171
- return null;
55172
- };
55173
- var globalInstallCommandFor = (packageManager, packageName) => {
55174
- switch (packageManager) {
55175
- case "bun":
55176
- return ["bun", "add", "-g", packageName];
55177
- case "pnpm":
55178
- return ["pnpm", "add", "-g", packageName];
55179
- case "npm":
55180
- return ["npm", "install", "-g", packageName];
55181
- }
55182
- };
55183
- var ensureToolsInstalled = (toolIds, baseline = bundledBaseline, runtime5 = defaultRuntime3) => {
55184
- const packageManager = detectGlobalPackageManager(runtime5);
55185
- const statuses = [];
55186
- const toolCatalogById = Object.fromEntries(baseline.tools.map((tool) => [tool.id, tool]));
55187
- if (toolIds.length > 0 && packageManager === null) {
55188
- throw new Error("Cannot install required tools because no supported global package manager was found on PATH. Install Bun, pnpm, or npm first.");
55189
- }
55190
- const globalPackageManager = packageManager;
55191
- const cwd = runtime5.cwd ?? homedir();
55192
- for (const toolId of toolIds) {
55193
- const tool = toolCatalogById[toolId];
55194
- if (tool === undefined) {
55195
- throw new Error(`Unknown required tool \`${toolId}\` in baseline.`);
55196
- }
55197
- const missingPrerequisites = tool.requiredBins.filter((command) => !runtime5.commandExists(command));
55198
- if (missingPrerequisites.length > 0) {
55199
- throw new Error(`Cannot install required tool \`${toolId}\` because ${missingPrerequisites.join(", ")} is not available on PATH.`);
55200
- }
55201
- const alreadyPresent = runtime5.commandExists(toolId);
55202
- if (!alreadyPresent) {
55203
- const [command, ...args2] = globalInstallCommandFor(globalPackageManager, tool.packageName);
55204
- runtime5.execFile(command, args2, {
55205
- cwd,
55206
- stdio: "inherit"
55207
- });
55208
- if (!runtime5.commandExists(toolId)) {
55209
- throw new Error(`Tried to install required tool \`${toolId}\`, but the binary is still not available on PATH afterwards.`);
55210
- }
55211
- }
55212
- for (const [command, ...args2] of tool.ensureCommands) {
55213
- runtime5.execFile(command, args2, {
55214
- cwd,
55215
- stdio: "inherit"
55216
- });
55217
- }
55218
- statuses.push({
55219
- toolId,
55220
- status: alreadyPresent ? "already-present" : "installed"
55221
- });
55222
- }
55223
- return statuses;
55224
- };
55225
-
55226
55323
  // src/scaffold/output.ts
55227
55324
  import { execFileSync as execFileSync5 } from "child_process";
55228
55325
  import { createHash as createHash2 } from "crypto";
55229
55326
  import {
55230
55327
  cpSync,
55231
- existsSync as existsSync4,
55328
+ existsSync as existsSync5,
55232
55329
  lstatSync,
55233
55330
  mkdirSync as mkdirSync2,
55234
55331
  readdirSync as readdirSync2,
55235
- readFileSync as readFileSync5,
55332
+ readFileSync as readFileSync6,
55236
55333
  readlinkSync,
55237
55334
  rmSync as rmSync2,
55238
- writeFileSync as writeFileSync2
55335
+ writeFileSync as writeFileSync3
55239
55336
  } from "fs";
55240
- import path9 from "path";
55337
+ import path10 from "path";
55241
55338
 
55242
55339
  // src/content/prompts.ts
55243
55340
  var phaseSkillIds = [
@@ -55512,7 +55609,10 @@ var renderAgentHandoffMarkdown = ({
55512
55609
  "- Subagent manifest scaffolding/specs under `.agents/subagents/` and `.devpunks/specs/subagents/`.",
55513
55610
  `- Scaffold manifest at \`${scaffoldManifestFile}\`.`,
55514
55611
  `- Required tools manifest at \`${requiredToolsFile}\`.`,
55515
- ...toolBootstrapStatuses.map((entry) => `- Tool bootstrap: \`${entry.toolId}\` was ${entry.status === "already-present" ? "already present" : "installed during scaffold"}.`),
55612
+ ...toolBootstrapStatuses.map((entry) => `- Tool bootstrap: \`${entry.toolId}\` was ${formatToolBootstrapStatus(entry)}.`),
55613
+ ...toolBootstrapStatuses.some((entry) => entry.status === "failed") ? [
55614
+ "- Tool bootstrap recovery: read `.devpunks/required-tools.json`, manually verify every listed tool, and repair failed installs before deeper repo work. For `agent-browser` Chromium failures, rerun `agent-browser install` after fixing the local browser dependency."
55615
+ ] : [],
55516
55616
  "",
55517
55617
  "## Repo shape",
55518
55618
  "",
@@ -55761,9 +55861,9 @@ var sortSubagentSpecialists = (spec) => ({
55761
55861
 
55762
55862
  // src/scaffold/output.ts
55763
55863
  var encodeJson = encodeSync(parseJson(Unknown));
55764
- var toPosixPath = (value6) => value6.split(path9.sep).join("/");
55864
+ var toPosixPath = (value6) => value6.split(path10.sep).join("/");
55765
55865
  var relativePosixPath = (from, to) => {
55766
- const relativePath = path9.relative(from, to);
55866
+ const relativePath = path10.relative(from, to);
55767
55867
  return relativePath === "" ? "." : toPosixPath(relativePath);
55768
55868
  };
55769
55869
  var specPathForPromptTarget = (relativePath) => {
@@ -55777,7 +55877,7 @@ var specPathForPromptTarget = (relativePath) => {
55777
55877
  if (promptTargetPath === "docs/AGENTS.md") {
55778
55878
  return ".devpunks/specs/prompts/docs.md";
55779
55879
  }
55780
- return path9.posix.join(".devpunks/specs/prompts", path9.posix.dirname(promptTargetPath), "prompt.md");
55880
+ return path10.posix.join(".devpunks/specs/prompts", path10.posix.dirname(promptTargetPath), "prompt.md");
55781
55881
  };
55782
55882
  var uniqueSorted = (values4) => [...new Set(values4)].toSorted();
55783
55883
  var collectOpensrcReferences = (promptSpecs) => uniqueSorted(promptSpecs.flatMap((spec) => spec.opensrcReferences));
@@ -55786,7 +55886,7 @@ var detectionHasPackage = (detection, packageName) => detection.manifests.some((
55786
55886
  var selectedSkills = (finalPacks, baseline) => uniqueSorted(finalPacks.flatMap((packId) => skillsForPack(packId, baseline)));
55787
55887
  var selectedHookIds = (finalPacks, baseline) => uniqueSorted(finalPacks.flatMap((packId) => hooksForPack(packId, baseline)));
55788
55888
  var oxlintConfigCandidates = [".oxlintrc.json", ".oxlintrc.jsonc", "oxlint.config.ts"];
55789
- var existingOxlintConfigFiles = (scanDirectory) => oxlintConfigCandidates.filter((candidate) => existsSync4(path9.join(scanDirectory, candidate)));
55889
+ var existingOxlintConfigFiles = (scanDirectory) => oxlintConfigCandidates.filter((candidate) => existsSync5(path10.join(scanDirectory, candidate)));
55790
55890
  var oxlintStarterConfig = {
55791
55891
  $schema: "./node_modules/oxlint/configuration_schema.json",
55792
55892
  env: {
@@ -55812,7 +55912,7 @@ var oxlintStarterConfig = {
55812
55912
  ],
55813
55913
  overrides: []
55814
55914
  };
55815
- var detectedWorkspaces = (scanDirectory, detection) => detection.manifests.map((manifest) => path9.posix.dirname(relativePosixPath(scanDirectory, manifest.path))).filter((workspace) => workspace !== "" && workspace !== ".").toSorted();
55915
+ var detectedWorkspaces = (scanDirectory, detection) => detection.manifests.map((manifest) => path10.posix.dirname(relativePosixPath(scanDirectory, manifest.path))).filter((workspace) => workspace !== "" && workspace !== ".").toSorted();
55816
55916
  var packsForWorkspace = ({
55817
55917
  relativeWorkspacePath,
55818
55918
  manifest,
@@ -55967,9 +56067,9 @@ var buildPromptSpec = ({
55967
56067
  finalPacks,
55968
56068
  baseline
55969
56069
  }) => {
55970
- const sourcePath = path9.join(scanDirectory, relativePath);
55971
- const source = existsSync4(sourcePath) ? "copied" : "generated";
55972
- const workspacePath = relativePath === ".agents/AGENTS.md" ? ".agents" : relativePath === "AGENTS.md" ? "." : relativePath === "docs/AGENTS.md" ? "docs" : path9.dirname(relativePath);
56070
+ const sourcePath = path10.join(scanDirectory, relativePath);
56071
+ const source = existsSync5(sourcePath) ? "copied" : "generated";
56072
+ const workspacePath = relativePath === ".agents/AGENTS.md" ? ".agents" : relativePath === "AGENTS.md" ? "." : relativePath === "docs/AGENTS.md" ? "docs" : path10.dirname(relativePath);
55973
56073
  const packs = packsForWorkspace({
55974
56074
  relativeWorkspacePath: workspacePath,
55975
56075
  manifest,
@@ -56037,9 +56137,9 @@ var writeArtifact = ({
56037
56137
  relativePath,
56038
56138
  content
56039
56139
  }) => {
56040
- const absolutePath = path9.join(outputDirectory, relativePath);
56041
- mkdirSync2(path9.dirname(absolutePath), { recursive: true });
56042
- writeFileSync2(absolutePath, content, "utf8");
56140
+ const absolutePath = path10.join(outputDirectory, relativePath);
56141
+ mkdirSync2(path10.dirname(absolutePath), { recursive: true });
56142
+ writeFileSync3(absolutePath, content, "utf8");
56043
56143
  return relativePath;
56044
56144
  };
56045
56145
  var resolvePromptContent = ({
@@ -56050,9 +56150,9 @@ var resolvePromptContent = ({
56050
56150
  baseline,
56051
56151
  preserveExistingManagedFiles
56052
56152
  }) => {
56053
- const sourcePath = path9.join(scanDirectory, relativePath);
56054
- if (preserveExistingManagedFiles && existsSync4(sourcePath)) {
56055
- return readFileSync5(sourcePath, "utf8");
56153
+ const sourcePath = path10.join(scanDirectory, relativePath);
56154
+ if (preserveExistingManagedFiles && existsSync5(sourcePath)) {
56155
+ return readFileSync6(sourcePath, "utf8");
56056
56156
  }
56057
56157
  if (relativePath === ".agents/AGENTS.md") {
56058
56158
  return sharedAgentsPromptTemplate;
@@ -56064,7 +56164,7 @@ var resolvePromptContent = ({
56064
56164
  return docsPromptTemplate;
56065
56165
  }
56066
56166
  if (manifest) {
56067
- const relativeWorkspacePath = path9.dirname(relativePath);
56167
+ const relativeWorkspacePath = path10.dirname(relativePath);
56068
56168
  const packs = packsForWorkspace({
56069
56169
  relativeWorkspacePath,
56070
56170
  manifest,
@@ -56085,15 +56185,15 @@ var resolvePromptContent = ({
56085
56185
  return "";
56086
56186
  };
56087
56187
  var collectRelativeFiles = (outputDirectory, relativeDirectory) => {
56088
- const absoluteDirectory = path9.join(outputDirectory, relativeDirectory);
56089
- if (!existsSync4(absoluteDirectory)) {
56188
+ const absoluteDirectory = path10.join(outputDirectory, relativeDirectory);
56189
+ if (!existsSync5(absoluteDirectory)) {
56090
56190
  return [];
56091
56191
  }
56092
56192
  const files = [];
56093
56193
  const visit2 = (currentDirectory) => {
56094
56194
  for (const entry of readdirSync2(currentDirectory, { withFileTypes: true })) {
56095
- const absolutePath = path9.join(currentDirectory, entry.name);
56096
- const relativePath = path9.relative(outputDirectory, absolutePath).split(path9.sep).join("/");
56195
+ const absolutePath = path10.join(currentDirectory, entry.name);
56196
+ const relativePath = path10.relative(outputDirectory, absolutePath).split(path10.sep).join("/");
56097
56197
  const stat3 = lstatSync(absolutePath);
56098
56198
  if (stat3.isSymbolicLink()) {
56099
56199
  files.push(relativePath);
@@ -56148,8 +56248,8 @@ var managedKindForPath = (relativePath) => {
56148
56248
  var expandManagedFiles = (outputDirectory, relativePaths) => {
56149
56249
  const files = new Set;
56150
56250
  for (const relativePath of relativePaths) {
56151
- const absolutePath = path9.join(outputDirectory, relativePath);
56152
- if (!existsSync4(absolutePath)) {
56251
+ const absolutePath = path10.join(outputDirectory, relativePath);
56252
+ if (!existsSync5(absolutePath)) {
56153
56253
  continue;
56154
56254
  }
56155
56255
  const stat3 = lstatSync(absolutePath);
@@ -56164,9 +56264,9 @@ var expandManagedFiles = (outputDirectory, relativePaths) => {
56164
56264
  }
56165
56265
  }
56166
56266
  return [...files].toSorted().map((relativePath) => {
56167
- const absolutePath = path9.join(outputDirectory, relativePath);
56267
+ const absolutePath = path10.join(outputDirectory, relativePath);
56168
56268
  const stat3 = lstatSync(absolutePath);
56169
- const content = stat3.isSymbolicLink() ? `symlink:${readlinkSync(absolutePath)}` : readFileSync5(absolutePath);
56269
+ const content = stat3.isSymbolicLink() ? `symlink:${readlinkSync(absolutePath)}` : readFileSync6(absolutePath);
56170
56270
  return {
56171
56271
  path: relativePath,
56172
56272
  sha256: hashContent(content),
@@ -56179,7 +56279,7 @@ var promptTargetsForDetection = (scanDirectory, detection) => {
56179
56279
  { relativePath: ".agents/AGENTS.md", manifest: null },
56180
56280
  { relativePath: "AGENTS.md", manifest: null }
56181
56281
  ];
56182
- if (existsSync4(path9.join(scanDirectory, "docs"))) {
56282
+ if (existsSync5(path10.join(scanDirectory, "docs"))) {
56183
56283
  targets.push({ relativePath: "docs/AGENTS.md", manifest: null });
56184
56284
  }
56185
56285
  if (!detection.monorepo) {
@@ -56191,7 +56291,7 @@ var promptTargetsForDetection = (scanDirectory, detection) => {
56191
56291
  continue;
56192
56292
  }
56193
56293
  targets.push({
56194
- relativePath: path9.posix.join(path9.posix.dirname(relativeManifestPath), "AGENTS.md"),
56294
+ relativePath: path10.posix.join(path10.posix.dirname(relativeManifestPath), "AGENTS.md"),
56195
56295
  manifest
56196
56296
  });
56197
56297
  }
@@ -56307,9 +56407,9 @@ var writeScaffoldOutput = ({
56307
56407
  }
56308
56408
  for (const skillId of finalSkills) {
56309
56409
  const sourceDirectory = skillRegistryByIdForBaseline(baseline)[skillId].sourceDirectory;
56310
- const targetDirectory = path9.posix.join(".agents/skills", skillId);
56311
- const absoluteTargetDirectory = path9.join(outputDirectory, targetDirectory);
56312
- mkdirSync2(path9.join(outputDirectory, ".agents/skills"), { recursive: true });
56410
+ const targetDirectory = path10.posix.join(".agents/skills", skillId);
56411
+ const absoluteTargetDirectory = path10.join(outputDirectory, targetDirectory);
56412
+ mkdirSync2(path10.join(outputDirectory, ".agents/skills"), { recursive: true });
56313
56413
  rmSync2(absoluteTargetDirectory, { recursive: true, force: true });
56314
56414
  cpSync(resolveBaselinePath({
56315
56415
  baselineRoot: baseline.root,
@@ -56347,11 +56447,11 @@ var writeScaffoldOutput = ({
56347
56447
  content: encodeJson(subagentManifestSpec)
56348
56448
  }));
56349
56449
  subagentFiles.push(subagentManifestSpec.specFile);
56350
- const sourceManifestPath = path9.join(scanDirectory, ".agents/subagents/manifest.mjs");
56450
+ const sourceManifestPath = path10.join(scanDirectory, ".agents/subagents/manifest.mjs");
56351
56451
  generatedFiles.push(writeArtifact({
56352
56452
  outputDirectory,
56353
56453
  relativePath: ".agents/subagents/manifest.mjs",
56354
- content: shouldPreserveExistingManagedFiles && existsSync4(sourceManifestPath) ? readFileSync5(sourceManifestPath, "utf8") : renderSubagentManifestModule({
56454
+ content: shouldPreserveExistingManagedFiles && existsSync5(sourceManifestPath) ? readFileSync6(sourceManifestPath, "utf8") : renderSubagentManifestModule({
56355
56455
  spec: subagentManifestSpec,
56356
56456
  baseline,
56357
56457
  fallback: defaultSubagentManifestTemplate
@@ -56366,7 +56466,7 @@ var writeScaffoldOutput = ({
56366
56466
  }));
56367
56467
  hookFiles.push(hook.outputPath);
56368
56468
  }
56369
- execFileSync5(process.execPath, [path9.join(outputDirectory, syncScriptFile)], {
56469
+ execFileSync5(process.execPath, [path10.join(outputDirectory, syncScriptFile)], {
56370
56470
  cwd: outputDirectory,
56371
56471
  stdio: "ignore"
56372
56472
  });
@@ -56486,9 +56586,9 @@ var writeAgentSystemPrompt = ({
56486
56586
  outputDirectory,
56487
56587
  content
56488
56588
  }) => {
56489
- const absolutePath = path10.join(outputDirectory, agentSystemPromptFile);
56490
- mkdirSync3(path10.dirname(absolutePath), { recursive: true });
56491
- writeFileSync3(absolutePath, `${content}
56589
+ const absolutePath = path11.join(outputDirectory, agentSystemPromptFile);
56590
+ mkdirSync3(path11.dirname(absolutePath), { recursive: true });
56591
+ writeFileSync4(absolutePath, `${content}
56492
56592
  `, "utf8");
56493
56593
  return agentSystemPromptFile;
56494
56594
  };
@@ -56555,25 +56655,27 @@ var runScaffold = ({
56555
56655
  prompt: prompt4,
56556
56656
  outputDirectory,
56557
56657
  ensureTools = true,
56558
- baseline = bundledBaseline
56658
+ baseline = bundledBaseline,
56659
+ assumeYes = false,
56660
+ toolRuntime
56559
56661
  }) => exports_Effect.gen(function* () {
56560
56662
  const baseRequiredTools = requiredToolsForSkills([], baseline);
56561
56663
  let toolBootstrapStatuses = [];
56562
- const resolvedOutputDirectory = path10.resolve(outputDirectory ?? scanDirectory);
56664
+ const resolvedOutputDirectory = path11.resolve(outputDirectory ?? scanDirectory);
56563
56665
  yield* prompt4.writeLine(renderScaffoldTitle());
56564
56666
  yield* prompt4.writeLine("");
56565
56667
  yield* prompt4.writeLine(renderSetupIntro());
56566
56668
  if (ensureTools && baseRequiredTools.length > 0) {
56567
56669
  yield* prompt4.writeLine("");
56568
56670
  yield* prompt4.writeLine(renderHint(`Checking base scaffold tools: ${baseRequiredTools.join(", ")}`));
56569
- toolBootstrapStatuses = yield* exports_Effect.try({
56570
- try: () => ensureToolsInstalled(baseRequiredTools, baseline),
56571
- catch: (cause3) => new CliValidationError({
56572
- message: cause3 instanceof Error ? cause3.message : "Failed to install required base scaffold tools."
56573
- })
56574
- });
56575
- yield* prompt4.writeLine(renderCommandSection("Base tool check", toolBootstrapStatuses.map((entry) => `\u2022 ${entry.toolId}: ${entry.status === "already-present" ? "already present" : "installed during scaffold"}`).join(`
56671
+ toolBootstrapStatuses = ensureToolsInstalledBestEffort(baseRequiredTools, baseline, toolRuntime);
56672
+ yield* prompt4.writeLine(renderCommandSection("Base tool check", toolBootstrapStatuses.map((entry) => `\u2022 ${entry.toolId}: ${formatToolBootstrapStatus(entry)}`).join(`
56576
56673
  `)));
56674
+ const failureDetails = formatToolBootstrapFailureDetails(toolBootstrapStatuses);
56675
+ if (failureDetails !== null) {
56676
+ yield* prompt4.writeLine("");
56677
+ yield* prompt4.writeLine(renderCommandSection("Tool Bootstrap Warning", failureDetails));
56678
+ }
56577
56679
  }
56578
56680
  const detection = applyRepoShapeMode(yield* detectRepository(scanDirectory), repoShapeMode);
56579
56681
  const resolved = resolvePackSelection(detection, baseline);
@@ -56591,7 +56693,11 @@ var runScaffold = ({
56591
56693
  let additions = [];
56592
56694
  let removals = [];
56593
56695
  let finalPacks = resolved.preselectedPacks;
56594
- while (true) {
56696
+ if (assumeYes) {
56697
+ yield* prompt4.writeLine("");
56698
+ yield* prompt4.writeLine(renderHint("Non-interactive mode: accepting prefilled pack selection."));
56699
+ }
56700
+ while (!assumeYes) {
56595
56701
  const shouldKeepPrefilledSelection = (yield* prompt4.readLine(renderQuestion("Keep the prefilled pack selection as-is? [Y/n]: "))).trim().toLowerCase();
56596
56702
  const shouldEditSelection = !yesValues.has(shouldKeepPrefilledSelection);
56597
56703
  additions = shouldEditSelection ? resolved.optionalPacks.length === 0 ? [] : yield* promptForPackMultiSelect(prompt4, {
@@ -56637,18 +56743,18 @@ var runScaffold = ({
56637
56743
  if (ensureTools && remainingRequiredTools.length > 0) {
56638
56744
  yield* prompt4.writeLine("");
56639
56745
  yield* prompt4.writeLine(renderHint(`Ensuring selected-pack tools: ${remainingRequiredTools.join(", ")}`));
56640
- const remainingToolBootstrapStatuses = yield* exports_Effect.try({
56641
- try: () => ensureToolsInstalled(remainingRequiredTools, baseline),
56642
- catch: (cause3) => new CliValidationError({
56643
- message: cause3 instanceof Error ? cause3.message : "Failed to install required scaffold tools."
56644
- })
56645
- });
56746
+ const remainingToolBootstrapStatuses = ensureToolsInstalledBestEffort(remainingRequiredTools, baseline, toolRuntime);
56646
56747
  toolBootstrapStatuses = [
56647
56748
  ...toolBootstrapStatuses,
56648
56749
  ...remainingToolBootstrapStatuses
56649
56750
  ].toSorted((left3, right3) => left3.toolId.localeCompare(right3.toolId));
56650
- yield* prompt4.writeLine(renderCommandSection("Tool bootstrap", remainingToolBootstrapStatuses.map((entry) => `\u2022 ${entry.toolId}: ${entry.status === "already-present" ? "already present" : "installed during scaffold"}`).join(`
56751
+ yield* prompt4.writeLine(renderCommandSection("Tool bootstrap", remainingToolBootstrapStatuses.map((entry) => `\u2022 ${entry.toolId}: ${formatToolBootstrapStatus(entry)}`).join(`
56651
56752
  `)));
56753
+ const failureDetails = formatToolBootstrapFailureDetails(remainingToolBootstrapStatuses);
56754
+ if (failureDetails !== null) {
56755
+ yield* prompt4.writeLine("");
56756
+ yield* prompt4.writeLine(renderCommandSection("Tool Bootstrap Warning", failureDetails));
56757
+ }
56652
56758
  }
56653
56759
  const scaffoldOutput = yield* writeScaffoldOutput({
56654
56760
  scanDirectory,
@@ -56659,6 +56765,7 @@ var runScaffold = ({
56659
56765
  toolBootstrapStatuses,
56660
56766
  baseline
56661
56767
  });
56768
+ removeHarnessDirectoriesFromGitignore(scaffoldOutput.outputDirectory);
56662
56769
  const renderedAgentSystemPrompt = formatAgentHandoffSummary({
56663
56770
  cwd: scanDirectory,
56664
56771
  repoShapeMode,
@@ -56779,8 +56886,17 @@ var runScaffold = ({
56779
56886
  });
56780
56887
 
56781
56888
  // src/scaffold/stage.ts
56782
- import { cpSync as cpSync2, existsSync as existsSync5, mkdirSync as mkdirSync4, rmSync as rmSync3, symlinkSync, writeFileSync as writeFileSync4 } from "fs";
56783
- import path11 from "path";
56889
+ import {
56890
+ cpSync as cpSync2,
56891
+ existsSync as existsSync6,
56892
+ mkdirSync as mkdirSync4,
56893
+ readFileSync as readFileSync7,
56894
+ readdirSync as readdirSync3,
56895
+ rmSync as rmSync3,
56896
+ symlinkSync,
56897
+ writeFileSync as writeFileSync5
56898
+ } from "fs";
56899
+ import path12 from "path";
56784
56900
 
56785
56901
  // src/content/wiki.ts
56786
56902
  var makeWikiScaffoldTemplate = (wikiRoot) => ({
@@ -56925,9 +57041,9 @@ When processing source material into routed domain knowledge:
56925
57041
  "version": "0.0.0",
56926
57042
  "private": true,
56927
57043
  "scripts": {
56928
- "build": "fumadocs-mdx && next build",
57044
+ "build": "node ./scripts/sync-content.mjs && fumadocs-mdx && next build",
56929
57045
  "check": "oxlint . && oxfmt --check .",
56930
- "check-types": "fumadocs-mdx && next typegen && tsc --noEmit",
57046
+ "check-types": "node ./scripts/sync-content.mjs && fumadocs-mdx && next typegen && tsc --noEmit",
56931
57047
  "dev": "next dev --turbopack --port=4000",
56932
57048
  "postinstall": "fumadocs-mdx",
56933
57049
  "start": "next start"
@@ -56976,6 +57092,210 @@ const config = {
56976
57092
  };
56977
57093
 
56978
57094
  export default withMDX(config);
57095
+ `
57096
+ },
57097
+ {
57098
+ path: "scripts/sync-content.mjs",
57099
+ content: `import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
57100
+ import path from "node:path";
57101
+ import { fileURLToPath } from "node:url";
57102
+
57103
+ const wikiRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
57104
+ const contentRoot = path.join(wikiRoot, "content", "docs");
57105
+
57106
+ const possibleRepoRoots = [
57107
+ path.resolve(wikiRoot, "..", ".."),
57108
+ path.resolve(wikiRoot, ".."),
57109
+ ];
57110
+
57111
+ const repoRoot = possibleRepoRoots.find(
57112
+ (candidate) => existsSync(path.join(candidate, "docs")) || existsSync(path.join(candidate, "package.json")),
57113
+ );
57114
+
57115
+ const copiedTopLevelPages = new Set(["project"]);
57116
+
57117
+ syncTree(path.join(wikiRoot, "specs"), path.join(contentRoot, "project", "specs"), "Specs");
57118
+ syncTree(path.join(wikiRoot, "domains"), path.join(contentRoot, "wiki"), "Wiki");
57119
+
57120
+ if (repoRoot) {
57121
+ syncTree(path.join(repoRoot, "docs", "requirements"), path.join(contentRoot, "project", "requirements"), "Requirements");
57122
+ syncTree(path.join(repoRoot, "docs", "reference"), path.join(contentRoot, "project", "reference"), "Reference");
57123
+ syncTree(path.join(repoRoot, "docs", "runbooks"), path.join(contentRoot, "project", "runbooks"), "Runbooks");
57124
+ syncFile(path.join(repoRoot, "docs", "tech-decisions.md"), path.join(contentRoot, "project", "decisions", "tech-decisions.mdx"));
57125
+ }
57126
+
57127
+ mergeMeta(contentRoot, {
57128
+ title: "Project Docs",
57129
+ pages: Array.from(copiedTopLevelPages),
57130
+ });
57131
+
57132
+ mergeMeta(path.join(contentRoot, "project"), {
57133
+ title: "Project",
57134
+ description: "Internal project operations",
57135
+ pages: [
57136
+ "index",
57137
+ "grilling",
57138
+ "specs",
57139
+ "tech-debt",
57140
+ "maintenance",
57141
+ "runbooks",
57142
+ "decisions",
57143
+ "repo-guidance",
57144
+ ...(existsSync(path.join(contentRoot, "project", "requirements")) ? ["requirements"] : []),
57145
+ ...(existsSync(path.join(contentRoot, "project", "reference")) ? ["reference"] : []),
57146
+ ],
57147
+ });
57148
+
57149
+ function syncTree(sourceDirectory, targetDirectory, title) {
57150
+ if (!existsSync(sourceDirectory)) return;
57151
+
57152
+ copyMarkdownTree(sourceDirectory, targetDirectory);
57153
+ writeMetaTree(targetDirectory, title);
57154
+
57155
+ const relativeTarget = path.relative(contentRoot, targetDirectory);
57156
+ const topLevel = relativeTarget.split(path.sep)[0];
57157
+ if (topLevel) copiedTopLevelPages.add(topLevel);
57158
+ }
57159
+
57160
+ function copyMarkdownTree(sourceDirectory, targetDirectory) {
57161
+ for (const entry of readdirSync(sourceDirectory, { withFileTypes: true })) {
57162
+ if (entry.name.startsWith(".")) continue;
57163
+
57164
+ const sourcePath = path.join(sourceDirectory, entry.name);
57165
+ const targetPath = path.join(targetDirectory, entry.name);
57166
+
57167
+ if (entry.isDirectory()) {
57168
+ copyMarkdownTree(sourcePath, targetPath);
57169
+ continue;
57170
+ }
57171
+
57172
+ if (!entry.isFile()) continue;
57173
+ if (!entry.name.endsWith(".md") && !entry.name.endsWith(".mdx")) continue;
57174
+
57175
+ syncFile(sourcePath, targetPath);
57176
+ }
57177
+ }
57178
+
57179
+ function syncFile(sourcePath, targetPath) {
57180
+ if (!existsSync(sourcePath)) return;
57181
+ if (existsSync(targetPath) && hasFrontmatter(readFileSync(targetPath, "utf8"))) return;
57182
+
57183
+ mkdirSync(path.dirname(targetPath), { recursive: true });
57184
+ writeFileSync(targetPath, sanitizeMdx(readFileSync(sourcePath, "utf8"), targetPath));
57185
+ }
57186
+
57187
+ function hasFrontmatter(content) {
57188
+ return content.startsWith("---\\n");
57189
+ }
57190
+
57191
+ function writeMetaTree(directory, title) {
57192
+ if (!existsSync(directory)) return;
57193
+
57194
+ const entries = readdirSync(directory, { withFileTypes: true }).filter((entry) => !entry.name.startsWith("."));
57195
+ const files = entries
57196
+ .filter((entry) => entry.isFile() && (entry.name.endsWith(".md") || entry.name.endsWith(".mdx")))
57197
+ .map((entry) => stripMarkdownExtension(entry.name))
57198
+ .filter((name) => name !== "meta");
57199
+ const folders = entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
57200
+ const pages = orderPages([...files, ...folders]);
57201
+
57202
+ if (pages.length > 0) mergeMeta(directory, { title, pages });
57203
+
57204
+ for (const folder of folders) {
57205
+ writeMetaTree(path.join(directory, folder), titleFromSegment(folder));
57206
+ }
57207
+ }
57208
+
57209
+ function mergeMeta(directory, nextMeta) {
57210
+ mkdirSync(directory, { recursive: true });
57211
+
57212
+ const metaPath = path.join(directory, "meta.json");
57213
+ const existing = readJson(metaPath);
57214
+ const mergedPages = mergePages(existing.pages ?? [], nextMeta.pages);
57215
+
57216
+ writeFileSync(
57217
+ metaPath,
57218
+ formatMetaJson({
57219
+ ...nextMeta,
57220
+ ...existing,
57221
+ pages: mergedPages,
57222
+ }),
57223
+ );
57224
+ }
57225
+
57226
+ function formatMetaJson(meta) {
57227
+ const lines = Object.entries(meta).map(
57228
+ ([key, value]) => " \\"" + key + "\\": " + JSON.stringify(value),
57229
+ );
57230
+
57231
+ return "{\\n" + lines.join(",\\n") + "\\n}\\n";
57232
+ }
57233
+
57234
+ function readJson(filePath) {
57235
+ if (!existsSync(filePath)) return {};
57236
+
57237
+ return JSON.parse(readFileSync(filePath, "utf8"));
57238
+ }
57239
+
57240
+ function orderPages(pages) {
57241
+ return mergePages([], pages).sort((left, right) => {
57242
+ if (left === "index") return -1;
57243
+ if (right === "index") return 1;
57244
+
57245
+ return left.localeCompare(right);
57246
+ });
57247
+ }
57248
+
57249
+ function mergePages(existingPages, nextPages) {
57250
+ const existing = Array.isArray(existingPages) ? existingPages : [];
57251
+ const additions = nextPages.filter((page) => !existing.includes(page));
57252
+ const pages = [...existing, ...additions];
57253
+
57254
+ if (!pages.includes("index")) return pages;
57255
+
57256
+ return ["index", ...pages.filter((page) => page !== "index")];
57257
+ }
57258
+
57259
+ function stripMarkdownExtension(fileName) {
57260
+ return fileName.replace(/\\.mdx?$/, "");
57261
+ }
57262
+
57263
+ function titleFromSegment(segment) {
57264
+ return segment
57265
+ .split(/[-_]/)
57266
+ .filter(Boolean)
57267
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
57268
+ .join(" ");
57269
+ }
57270
+
57271
+ function sanitizeMdx(content, targetPath) {
57272
+ const sanitized = content.replace(/<([A-Z_][A-Z0-9_-]*)>/g, "\\\\<$1\\\\>");
57273
+ if (hasFrontmatter(sanitized)) return sanitized;
57274
+
57275
+ return [
57276
+ "---",
57277
+ "title: \\"" + titleFromDocument(sanitized, targetPath) + "\\"",
57278
+ "surface: project",
57279
+ "permission: project",
57280
+ "---",
57281
+ "",
57282
+ sanitized,
57283
+ ].join("\\n");
57284
+ }
57285
+
57286
+ function titleFromDocument(content, targetPath) {
57287
+ const heading = content.match(/^#\\s+(.+)$/m)?.[1]?.trim();
57288
+ if (heading) return heading.replace(/"/g, "\\\\\\"");
57289
+
57290
+ return titleFromSegment(stripMarkdownExtension(path.basename(targetPath))).replace(/"/g, "\\\\\\"");
57291
+ }
57292
+
57293
+ if (repoRoot) {
57294
+ const displayedRoot = path.relative(wikiRoot, repoRoot) || ".";
57295
+ console.log(\`Synced wiki content from \${displayedRoot}\`);
57296
+ } else {
57297
+ console.log("No repository root detected; using checked-in wiki content.");
57298
+ }
56979
57299
  `
56980
57300
  },
56981
57301
  {
@@ -57533,15 +57853,7 @@ var stageScaffoldCatalog = [
57533
57853
  wikiRoot
57534
57854
  }) => `You are the operator agent continuing a \`punks scaffold init\` run.
57535
57855
 
57536
- Use the scaffolded skills now available under \`.agents/skills/\` to run the canonical requirements-to-backlog flow.
57537
-
57538
- Goals:
57539
- - use \`requirements-grill\` to pin down the project idea, requirements, and open branches
57540
- - use \`write-backlog\` only after the grill handoff says the requirements grill is done
57541
-
57542
- Required skills:
57543
- - \`requirements-grill\`
57544
- - \`write-backlog\`
57856
+ Do not start requirements discovery by default. First reconcile the generated output with this repository.
57545
57857
 
57546
57858
  Scaffolded wiki base:
57547
57859
  - treat \`${wikiRoot}\` as the dedicated wiki root for specs, raw inputs, routed project docs, and ingest bookkeeping
@@ -57550,17 +57862,18 @@ Scaffolded wiki base:
57550
57862
  - if the CLI guessed the wrong root, move or refactor the scaffolded wiki before creating specs, plans, or ingesting domain knowledge
57551
57863
  - keep using the reconciled wiki root when later steps create specs, plans, or ingest domain knowledge
57552
57864
 
57553
- Execution order:
57554
- 1. Start with \`requirements-grill\` and run the requirements grill session.
57555
- 2. Follow the skill's artifact and wiki-synthesis guidance.
57556
- 3. Run \`write-backlog\` only after the grill gate is closed.
57557
- 4. Use \`punks scaffold setup\` only after the repo shape is ready for repo-aware AI setup.
57865
+ Generated skills:
57866
+ - \`.agents/skills/requirements-grill\`
57867
+ - \`.agents/skills/write-backlog\`
57558
57868
 
57559
- Gate:
57560
- - do not create backlog items while active requirement branches remain unresolved
57561
- - treat this as the canonical step before backlog creation
57869
+ Post-command guidance:
57870
+ 1. Read the repository guidance and inspect the generated files.
57871
+ 2. Move, rename, or refactor the generated wiki and skill output when needed so it matches the actual repo layout.
57872
+ 3. Report what changed and what remains unresolved.
57873
+ 4. Use \`requirements-grill\` and then \`write-backlog\` only when the user actually asks for requirements or backlog generation.
57874
+ 5. Use \`punks scaffold setup\` only after the repo shape is ready for repo-aware AI setup.
57562
57875
 
57563
- When this gate is complete, the next CLI step is:
57876
+ When the generated init output matches the repo, the next CLI step is:
57564
57877
  - \`punks scaffold setup\``
57565
57878
  }
57566
57879
  ];
@@ -57573,9 +57886,9 @@ var copySkillDirectory = ({
57573
57886
  baseline
57574
57887
  }) => {
57575
57888
  const sourceDirectory = skillRegistryByIdForBaseline(baseline)[skillId].sourceDirectory;
57576
- const targetDirectory = path11.posix.join(".agents/skills", skillId);
57577
- const absoluteTargetDirectory = path11.join(outputDirectory, targetDirectory);
57578
- mkdirSync4(path11.join(outputDirectory, ".agents/skills"), { recursive: true });
57889
+ const targetDirectory = path12.posix.join(".agents/skills", skillId);
57890
+ const absoluteTargetDirectory = path12.join(outputDirectory, targetDirectory);
57891
+ mkdirSync4(path12.join(outputDirectory, ".agents/skills"), { recursive: true });
57579
57892
  rmSync3(absoluteTargetDirectory, { recursive: true, force: true });
57580
57893
  cpSync2(resolveBaselinePath({
57581
57894
  baselineRoot: baseline.root,
@@ -57584,19 +57897,77 @@ var copySkillDirectory = ({
57584
57897
  }), absoluteTargetDirectory, { recursive: true });
57585
57898
  return targetDirectory;
57586
57899
  };
57587
- var relativePosixPath2 = (from, to) => path11.relative(from, to).split(path11.sep).join("/");
57900
+ var relativePosixPath2 = (from, to) => path12.relative(from, to).split(path12.sep).join("/");
57588
57901
  var writeMissingFile = ({
57589
57902
  outputDirectory,
57590
57903
  targetPath,
57591
57904
  content
57592
57905
  }) => {
57593
- if (existsSync5(targetPath)) {
57906
+ if (existsSync6(targetPath)) {
57907
+ return null;
57908
+ }
57909
+ mkdirSync4(path12.dirname(targetPath), { recursive: true });
57910
+ writeFileSync5(targetPath, content);
57911
+ return relativePosixPath2(outputDirectory, targetPath);
57912
+ };
57913
+ var directoryHasEntries = (directoryPath) => existsSync6(directoryPath) && readdirSync3(directoryPath).some((entry) => !entry.startsWith("."));
57914
+ var writeManagedFile = ({
57915
+ outputDirectory,
57916
+ targetPath,
57917
+ content
57918
+ }) => {
57919
+ if (existsSync6(targetPath) && readFileSync7(targetPath, "utf8") === content) {
57594
57920
  return null;
57595
57921
  }
57596
- mkdirSync4(path11.dirname(targetPath), { recursive: true });
57597
- writeFileSync4(targetPath, content);
57922
+ mkdirSync4(path12.dirname(targetPath), { recursive: true });
57923
+ writeFileSync5(targetPath, content);
57598
57924
  return relativePosixPath2(outputDirectory, targetPath);
57599
57925
  };
57926
+ var syncContentPrefix = "node ./scripts/sync-content.mjs && ";
57927
+ var withSyncContentPrefix = (script) => {
57928
+ if (typeof script !== "string")
57929
+ return script;
57930
+ if (script.includes("scripts/sync-content.mjs"))
57931
+ return script;
57932
+ return `${syncContentPrefix}${script}`;
57933
+ };
57934
+ var updateExistingWikiPackage = ({
57935
+ outputDirectory,
57936
+ packagePath
57937
+ }) => {
57938
+ if (!existsSync6(packagePath))
57939
+ return null;
57940
+ const packageJson = JSON.parse(readFileSync7(packagePath, "utf8"));
57941
+ const scripts = packageJson.scripts;
57942
+ if (!scripts)
57943
+ return null;
57944
+ const nextScripts = {
57945
+ ...scripts,
57946
+ build: withSyncContentPrefix(scripts.build),
57947
+ "check-types": withSyncContentPrefix(scripts["check-types"]),
57948
+ "types:check": withSyncContentPrefix(scripts["types:check"])
57949
+ };
57950
+ const changed = Object.entries(nextScripts).some(([key, value6]) => scripts[key] !== value6);
57951
+ if (!changed)
57952
+ return null;
57953
+ writeFileSync5(packagePath, JSON.stringify({
57954
+ ...packageJson,
57955
+ scripts: nextScripts
57956
+ }, null, 2) + `
57957
+ `);
57958
+ return relativePosixPath2(outputDirectory, packagePath);
57959
+ };
57960
+ var hasFlatRoutePage = (directoryPath) => existsSync6(`${directoryPath}.md`) || existsSync6(`${directoryPath}.mdx`);
57961
+ var isNestedRouteSeedBlockedByFlatPage = ({
57962
+ wikiDirectory,
57963
+ filePath
57964
+ }) => {
57965
+ const normalized = filePath.split(path12.sep).join(path12.posix.sep);
57966
+ const match19 = normalized.match(/^content\/docs\/project\/([^/]+)\/(?:index\.mdx|meta\.json)$/);
57967
+ if (!match19)
57968
+ return false;
57969
+ return hasFlatRoutePage(path12.join(wikiDirectory, "content", "docs", "project", match19[1]));
57970
+ };
57600
57971
  var scaffoldWiki = ({
57601
57972
  outputDirectory,
57602
57973
  wikiRoot,
@@ -57604,41 +57975,58 @@ var scaffoldWiki = ({
57604
57975
  }) => {
57605
57976
  const template = makeWikiScaffoldTemplate(wikiRoot);
57606
57977
  const createdFiles = [];
57607
- const wikiDirectory = path11.join(outputDirectory, targetRoot);
57978
+ const wikiDirectory = path12.join(outputDirectory, targetRoot);
57608
57979
  for (const directory3 of template.topLevelDirectories) {
57609
- mkdirSync4(path11.join(wikiDirectory, directory3), { recursive: true });
57980
+ mkdirSync4(path12.join(wikiDirectory, directory3), { recursive: true });
57610
57981
  }
57611
57982
  for (const rawSubdirectory of template.rawSubdirectories) {
57612
- mkdirSync4(path11.join(wikiDirectory, "raw", rawSubdirectory), {
57983
+ mkdirSync4(path12.join(wikiDirectory, "raw", rawSubdirectory), {
57613
57984
  recursive: true
57614
57985
  });
57615
- const keepFile = path11.join(wikiDirectory, "raw", rawSubdirectory, ".gitkeep");
57986
+ const keepFile = path12.join(wikiDirectory, "raw", rawSubdirectory, ".gitkeep");
57616
57987
  const createdFile = writeMissingFile({ outputDirectory, targetPath: keepFile, content: "" });
57617
57988
  if (createdFile !== null) {
57618
57989
  createdFiles.push(createdFile);
57619
57990
  }
57620
57991
  }
57621
57992
  const directoryKeepFiles = [
57622
- path11.join(wikiDirectory, "content", "docs", "project", ".gitkeep"),
57623
- path11.join(wikiDirectory, "specs", ".gitkeep")
57993
+ path12.join(wikiDirectory, "content", "docs", "project", ".gitkeep"),
57994
+ path12.join(wikiDirectory, "specs", ".gitkeep")
57624
57995
  ];
57625
57996
  for (const keepFile of directoryKeepFiles) {
57997
+ if (directoryHasEntries(path12.dirname(keepFile))) {
57998
+ continue;
57999
+ }
57626
58000
  const createdFile = writeMissingFile({ outputDirectory, targetPath: keepFile, content: "" });
57627
58001
  if (createdFile !== null) {
57628
58002
  createdFiles.push(createdFile);
57629
58003
  }
57630
58004
  }
57631
58005
  for (const file6 of template.files) {
57632
- const createdFile = writeMissingFile({
58006
+ if (isNestedRouteSeedBlockedByFlatPage({
58007
+ wikiDirectory,
58008
+ filePath: file6.path
58009
+ })) {
58010
+ continue;
58011
+ }
58012
+ const writeFile3 = file6.path === "scripts/sync-content.mjs" ? writeManagedFile : writeMissingFile;
58013
+ const createdFile = writeFile3({
57633
58014
  outputDirectory,
57634
- targetPath: path11.join(wikiDirectory, file6.path),
58015
+ targetPath: path12.join(wikiDirectory, file6.path),
57635
58016
  content: file6.content
57636
58017
  });
57637
58018
  if (createdFile !== null) {
57638
58019
  createdFiles.push(createdFile);
57639
58020
  }
57640
58021
  }
57641
- const agentsPath = path11.join(wikiDirectory, "AGENTS.md");
58022
+ const updatedPackageFile = updateExistingWikiPackage({
58023
+ outputDirectory,
58024
+ packagePath: path12.join(wikiDirectory, "package.json")
58025
+ });
58026
+ if (updatedPackageFile !== null && !createdFiles.includes(updatedPackageFile)) {
58027
+ createdFiles.push(updatedPackageFile);
58028
+ }
58029
+ const agentsPath = path12.join(wikiDirectory, "AGENTS.md");
57642
58030
  const agentsFile = writeMissingFile({
57643
58031
  outputDirectory,
57644
58032
  targetPath: agentsPath,
@@ -57647,12 +58035,12 @@ var scaffoldWiki = ({
57647
58035
  if (agentsFile !== null) {
57648
58036
  createdFiles.push(agentsFile);
57649
58037
  }
57650
- const claudePath = path11.join(wikiDirectory, "CLAUDE.md");
57651
- if (!existsSync5(claudePath)) {
58038
+ const claudePath = path12.join(wikiDirectory, "CLAUDE.md");
58039
+ if (!existsSync6(claudePath)) {
57652
58040
  symlinkSync("AGENTS.md", claudePath);
57653
58041
  createdFiles.push(relativePosixPath2(outputDirectory, claudePath));
57654
58042
  }
57655
- const indexPath = path11.join(wikiDirectory, "index.md");
58043
+ const indexPath = path12.join(wikiDirectory, "index.md");
57656
58044
  const indexFile = writeMissingFile({
57657
58045
  outputDirectory,
57658
58046
  targetPath: indexPath,
@@ -57661,7 +58049,7 @@ var scaffoldWiki = ({
57661
58049
  if (indexFile !== null) {
57662
58050
  createdFiles.push(indexFile);
57663
58051
  }
57664
- const logPath = path11.join(wikiDirectory, "log.md");
58052
+ const logPath = path12.join(wikiDirectory, "log.md");
57665
58053
  const logFile = writeMissingFile({
57666
58054
  outputDirectory,
57667
58055
  targetPath: logPath,
@@ -57672,16 +58060,30 @@ var scaffoldWiki = ({
57672
58060
  }
57673
58061
  return createdFiles.toSorted();
57674
58062
  };
58063
+ var scaffoldWikiForDirectory = ({
58064
+ outputDirectory,
58065
+ monorepo
58066
+ }) => {
58067
+ const wikiTarget = stageWikiTarget({
58068
+ outputDirectory,
58069
+ monorepo
58070
+ });
58071
+ return scaffoldWiki({
58072
+ outputDirectory,
58073
+ wikiRoot: wikiTarget.wikiRoot,
58074
+ targetRoot: wikiTarget.targetRoot
58075
+ });
58076
+ };
57675
58077
  var isWikiOutputDirectory = (outputDirectory) => {
57676
- const normalized = path11.resolve(outputDirectory);
57677
- return path11.basename(normalized) === "wiki";
58078
+ const normalized = path12.resolve(outputDirectory);
58079
+ return path12.basename(normalized) === "wiki";
57678
58080
  };
57679
58081
  var stageWikiTarget = ({
57680
58082
  outputDirectory,
57681
58083
  monorepo
57682
58084
  }) => {
57683
58085
  if (isWikiOutputDirectory(outputDirectory)) {
57684
- const parent = path11.basename(path11.dirname(path11.resolve(outputDirectory)));
58086
+ const parent = path12.basename(path12.dirname(path12.resolve(outputDirectory)));
57685
58087
  return {
57686
58088
  wikiRoot: parent === "apps" ? "apps/wiki" : "wiki",
57687
58089
  targetRoot: "."
@@ -57700,20 +58102,20 @@ var runStageScaffold = ({
57700
58102
  }) => exports_Effect.gen(function* () {
57701
58103
  const stage = stageScaffoldById[commandId];
57702
58104
  const detection = yield* detectRepository(outputDirectory).pipe(exports_Effect.catchAll(() => exports_Effect.succeed(null)));
57703
- const wikiTarget = stageWikiTarget({
57704
- outputDirectory,
57705
- monorepo: detection?.monorepo === true
57706
- });
57707
58105
  const skillFiles = stage.skills.map((skillId) => copySkillDirectory({
57708
58106
  outputDirectory,
57709
58107
  skillId,
57710
58108
  baseline
57711
58109
  }));
58110
+ const wikiTarget = stageWikiTarget({
58111
+ outputDirectory,
58112
+ monorepo: detection?.monorepo === true
58113
+ });
57712
58114
  const wikiFiles = scaffoldWiki({
57713
58115
  outputDirectory,
57714
- wikiRoot: wikiTarget.wikiRoot,
57715
- targetRoot: wikiTarget.targetRoot
58116
+ ...wikiTarget
57716
58117
  });
58118
+ removeHarnessDirectoriesFromGitignore(outputDirectory);
57717
58119
  const operatorPrompt = stage.renderPrompt({ wikiRoot: wikiTarget.wikiRoot });
57718
58120
  yield* prompt4.writeLine(renderScaffoldTitle());
57719
58121
  yield* prompt4.writeLine("");
@@ -57754,9 +58156,10 @@ var jsonOption2 = exports_Options.boolean("json").pipe(exports_Options.withDescr
57754
58156
  var repoShapeOption = exports_Options.optional(exports_Options.choice("repo-shape", ["auto", "monorepo", "single"]).pipe(exports_Options.withDescription("Override repo shape detection. Use 'monorepo' or 'single' when auto-detection is not the desired scaffold mode.")));
57755
58157
  var baselineOption = exports_Options.optional(exports_Options.choice("baseline", ["stable", "bundled"]).pipe(exports_Options.withDescription("Scaffold baseline to use. Defaults to latest stable remote baseline with bundled fallback.")));
57756
58158
  var refreshBaselineOption = exports_Options.boolean("refresh-baseline").pipe(exports_Options.withDescription("Refetch the stable baseline instead of reusing the local cache."));
58159
+ var yesOption = exports_Options.boolean("yes").pipe(exports_Options.withDescription("Run non-interactively and accept the resolved default scaffold selection."));
57757
58160
  var stageCommand = (id2, description) => exports_Command.make(id2, { output: outputOption, baseline: baselineOption, refreshBaseline: refreshBaselineOption }, ({ output: output2, baseline, refreshBaseline }) => exports_Effect.scoped(exports_Effect.gen(function* () {
57758
58161
  const prompt4 = yield* PromptLive;
57759
- const outputDirectory = path12.resolve(process.cwd(), getOrElse(output2, () => "."));
58162
+ const outputDirectory = path13.resolve(process.cwd(), getOrElse(output2, () => "."));
57760
58163
  const resolvedBaseline = yield* exports_Effect.promise(() => resolveBaseline(baselineResolveOptions(baseline, refreshBaseline, outputDirectory)));
57761
58164
  yield* runStageScaffold({
57762
58165
  commandId: id2,
@@ -57771,12 +58174,13 @@ var setupCommand = exports_Command.make("setup", {
57771
58174
  json: jsonOption2,
57772
58175
  repoShape: repoShapeOption,
57773
58176
  baseline: baselineOption,
57774
- refreshBaseline: refreshBaselineOption
57775
- }, ({ input: input2, output: output2, json: json2, repoShape, baseline, refreshBaseline }) => exports_Effect.scoped(exports_Effect.gen(function* () {
58177
+ refreshBaseline: refreshBaselineOption,
58178
+ yes: yesOption
58179
+ }, ({ input: input2, output: output2, json: json2, repoShape, baseline, refreshBaseline, yes }) => exports_Effect.scoped(exports_Effect.gen(function* () {
57776
58180
  const prompt4 = yield* PromptLive;
57777
- const scanDirectory = path12.resolve(process.cwd(), getOrElse(input2, () => "."));
58181
+ const scanDirectory = path13.resolve(process.cwd(), getOrElse(input2, () => "."));
57778
58182
  const resolvedBaseline = yield* exports_Effect.promise(() => resolveBaseline(baselineResolveOptions(baseline, refreshBaseline, scanDirectory)));
57779
- const outputDirectory = map2(output2, (value6) => path12.resolve(process.cwd(), value6));
58183
+ const outputDirectory = map2(output2, (value6) => path13.resolve(process.cwd(), value6));
57780
58184
  const resolvedRepoShape = getOrElse(repoShape, () => "auto");
57781
58185
  yield* runScaffold(isSome2(outputDirectory) ? {
57782
58186
  scanDirectory,
@@ -57784,13 +58188,15 @@ var setupCommand = exports_Command.make("setup", {
57784
58188
  prompt: prompt4,
57785
58189
  outputDirectory: outputDirectory.value,
57786
58190
  repoShapeMode: resolvedRepoShape,
57787
- baseline: resolvedBaseline
58191
+ baseline: resolvedBaseline,
58192
+ assumeYes: yes
57788
58193
  } : {
57789
58194
  scanDirectory,
57790
58195
  emitJson: json2,
57791
58196
  prompt: prompt4,
57792
58197
  repoShapeMode: resolvedRepoShape,
57793
- baseline: resolvedBaseline
58198
+ baseline: resolvedBaseline,
58199
+ assumeYes: yes
57794
58200
  });
57795
58201
  }).pipe(exports_Effect.catchTag("CliValidationError", (error4) => exports_Effect.sync(() => {
57796
58202
  console.log(renderHint(error4.message));
@@ -57806,23 +58212,25 @@ var scaffoldCommand = exports_Command.make("scaffold", {}, () => exports_Effect.
57806
58212
  ]));
57807
58213
 
57808
58214
  // src/cli/update-command.ts
57809
- import path14 from "path";
58215
+ import path15 from "path";
57810
58216
 
57811
58217
  // src/update/run.ts
57812
58218
  import { createHash as createHash3 } from "crypto";
58219
+ import { execFileSync as execFileSync7 } from "child_process";
57813
58220
  import {
57814
58221
  cpSync as cpSync3,
57815
- existsSync as existsSync6,
58222
+ existsSync as existsSync7,
57816
58223
  lstatSync as lstatSync2,
57817
58224
  mkdirSync as mkdirSync5,
57818
58225
  mkdtempSync as mkdtempSync2,
57819
- readFileSync as readFileSync6,
58226
+ readdirSync as readdirSync4,
58227
+ readFileSync as readFileSync8,
57820
58228
  readlinkSync as readlinkSync2,
57821
58229
  rmSync as rmSync4,
57822
58230
  symlinkSync as symlinkSync2
57823
58231
  } from "fs";
57824
58232
  import { tmpdir as tmpdir3 } from "os";
57825
- import path13 from "path";
58233
+ import path14 from "path";
57826
58234
 
57827
58235
  // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/base.js
57828
58236
  class Diff {
@@ -57924,16 +58332,16 @@ class Diff {
57924
58332
  }
57925
58333
  }
57926
58334
  }
57927
- addToPath(path13, added, removed, oldPosInc, options9) {
57928
- const last5 = path13.lastComponent;
58335
+ addToPath(path14, added, removed, oldPosInc, options9) {
58336
+ const last5 = path14.lastComponent;
57929
58337
  if (last5 && !options9.oneChangePerToken && last5.added === added && last5.removed === removed) {
57930
58338
  return {
57931
- oldPos: path13.oldPos + oldPosInc,
58339
+ oldPos: path14.oldPos + oldPosInc,
57932
58340
  lastComponent: { count: last5.count + 1, added, removed, previousComponent: last5.previousComponent }
57933
58341
  };
57934
58342
  } else {
57935
58343
  return {
57936
- oldPos: path13.oldPos + oldPosInc,
58344
+ oldPos: path14.oldPos + oldPosInc,
57937
58345
  lastComponent: { count: 1, added, removed, previousComponent: last5 }
57938
58346
  };
57939
58347
  }
@@ -58766,15 +59174,15 @@ var selectedSkills3 = (finalPacks, baseline) => [
58766
59174
  ...new Set(finalPacks.flatMap((packId) => skillsForPack(packId, baseline)))
58767
59175
  ].toSorted();
58768
59176
  var readManifest = (rootDirectory) => {
58769
- const manifestPath = path13.join(rootDirectory, scaffoldManifestFile);
58770
- if (!existsSync6(manifestPath)) {
59177
+ const manifestPath = path14.join(rootDirectory, scaffoldManifestFile);
59178
+ if (!existsSync7(manifestPath)) {
58771
59179
  throw new Error(`Missing ${scaffoldManifestFile}. Run \`punks scaffold setup\` first.`);
58772
59180
  }
58773
- return parseManifest(readFileSync6(manifestPath, "utf8"));
59181
+ return parseManifest(readFileSync8(manifestPath, "utf8"));
58774
59182
  };
58775
59183
  var contentForDiff = (rootDirectory, relativePath) => {
58776
- const absolutePath = path13.join(rootDirectory, relativePath);
58777
- if (!existsSync6(absolutePath)) {
59184
+ const absolutePath = path14.join(rootDirectory, relativePath);
59185
+ if (!existsSync7(absolutePath)) {
58778
59186
  return "";
58779
59187
  }
58780
59188
  const stat3 = lstatSync2(absolutePath);
@@ -58782,27 +59190,49 @@ var contentForDiff = (rootDirectory, relativePath) => {
58782
59190
  return `symlink:${readlinkSync2(absolutePath)}
58783
59191
  `;
58784
59192
  }
58785
- return readFileSync6(absolutePath, "utf8");
59193
+ return readFileSync8(absolutePath, "utf8");
58786
59194
  };
58787
59195
  var hashPath = (rootDirectory, relativePath) => {
58788
- const absolutePath = path13.join(rootDirectory, relativePath);
58789
- if (!existsSync6(absolutePath)) {
59196
+ const absolutePath = path14.join(rootDirectory, relativePath);
59197
+ if (!existsSync7(absolutePath)) {
58790
59198
  return null;
58791
59199
  }
58792
59200
  const stat3 = lstatSync2(absolutePath);
58793
- const content = stat3.isSymbolicLink() ? `symlink:${readlinkSync2(absolutePath)}` : readFileSync6(absolutePath);
59201
+ const content = stat3.isSymbolicLink() ? `symlink:${readlinkSync2(absolutePath)}` : readFileSync8(absolutePath);
58794
59202
  return hashContent2(content);
58795
59203
  };
59204
+ var collectRelativeFiles2 = (rootDirectory, relativeDirectory) => {
59205
+ const absoluteDirectory = path14.join(rootDirectory, relativeDirectory);
59206
+ if (!existsSync7(absoluteDirectory)) {
59207
+ return [];
59208
+ }
59209
+ const files = [];
59210
+ const visit2 = (currentDirectory) => {
59211
+ for (const entry of readdirSync4(currentDirectory, { withFileTypes: true })) {
59212
+ const absolutePath = path14.join(currentDirectory, entry.name);
59213
+ const relativePath = path14.relative(rootDirectory, absolutePath).split(path14.sep).join("/");
59214
+ if (entry.isDirectory()) {
59215
+ visit2(absolutePath);
59216
+ continue;
59217
+ }
59218
+ if (entry.isFile() || entry.isSymbolicLink()) {
59219
+ files.push(relativePath);
59220
+ }
59221
+ }
59222
+ };
59223
+ visit2(absoluteDirectory);
59224
+ return files.toSorted();
59225
+ };
58796
59226
  var copyManagedFile = ({
58797
59227
  fromDirectory,
58798
59228
  toDirectory,
58799
59229
  relativePath
58800
59230
  }) => {
58801
- const sourcePath = path13.join(fromDirectory, relativePath);
58802
- const targetPath = path13.join(toDirectory, relativePath);
59231
+ const sourcePath = path14.join(fromDirectory, relativePath);
59232
+ const targetPath = path14.join(toDirectory, relativePath);
58803
59233
  const stat3 = lstatSync2(sourcePath);
58804
- mkdirSync5(path13.dirname(targetPath), { recursive: true });
58805
- if (existsSync6(targetPath)) {
59234
+ mkdirSync5(path14.dirname(targetPath), { recursive: true });
59235
+ if (existsSync7(targetPath)) {
58806
59236
  rmSync4(targetPath, { recursive: true, force: true });
58807
59237
  }
58808
59238
  if (stat3.isSymbolicLink()) {
@@ -58890,14 +59320,88 @@ var buildChanges = ({
58890
59320
  ];
58891
59321
  }).toSorted((left3, right3) => left3.path.localeCompare(right3.path));
58892
59322
  };
59323
+ var copyIfExists = ({
59324
+ rootDirectory,
59325
+ targetDirectory,
59326
+ relativePath
59327
+ }) => {
59328
+ const sourcePath = path14.join(rootDirectory, relativePath);
59329
+ if (!existsSync7(sourcePath))
59330
+ return;
59331
+ const targetPath = path14.join(targetDirectory, relativePath);
59332
+ mkdirSync5(path14.dirname(targetPath), { recursive: true });
59333
+ cpSync3(sourcePath, targetPath, { recursive: true });
59334
+ };
59335
+ var buildWikiAlignment = ({
59336
+ rootDirectory,
59337
+ detection
59338
+ }) => {
59339
+ const expectedDirectory = mkdtempSync2(path14.join(tmpdir3(), "punks-wiki-update-"));
59340
+ const wikiRoot = detection.monorepo ? "apps/wiki" : "wiki";
59341
+ copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: wikiRoot });
59342
+ copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: "docs" });
59343
+ scaffoldWikiForDirectory({
59344
+ outputDirectory: expectedDirectory,
59345
+ monorepo: detection.monorepo
59346
+ });
59347
+ const syncScript = path14.join(expectedDirectory, wikiRoot, "scripts", "sync-content.mjs");
59348
+ if (existsSync7(syncScript)) {
59349
+ execFileSync7(process.execPath, [syncScript], {
59350
+ cwd: expectedDirectory,
59351
+ stdio: "ignore"
59352
+ });
59353
+ }
59354
+ const expectedFiles = collectRelativeFiles2(expectedDirectory, wikiRoot).map((relativePath) => ({
59355
+ path: relativePath,
59356
+ sha256: hashPath(expectedDirectory, relativePath) ?? "",
59357
+ kind: "harness"
59358
+ }));
59359
+ return {
59360
+ expectedDirectory,
59361
+ changes: buildChanges({
59362
+ rootDirectory,
59363
+ expectedDirectory,
59364
+ expectedFiles,
59365
+ previousFiles: []
59366
+ })
59367
+ };
59368
+ };
59369
+ var buildGitignoreCleanup = ({
59370
+ rootDirectory,
59371
+ expectedDirectory
59372
+ }) => {
59373
+ const relativePath = ".gitignore";
59374
+ if (!existsSync7(path14.join(rootDirectory, relativePath))) {
59375
+ return [];
59376
+ }
59377
+ copyManagedFile({ fromDirectory: rootDirectory, toDirectory: expectedDirectory, relativePath });
59378
+ const cleanup = removeHarnessDirectoriesFromGitignore(expectedDirectory);
59379
+ if (cleanup.removedPatterns.length === 0) {
59380
+ return [];
59381
+ }
59382
+ return buildChanges({
59383
+ rootDirectory,
59384
+ expectedDirectory,
59385
+ expectedFiles: [
59386
+ {
59387
+ path: relativePath,
59388
+ sha256: hashPath(expectedDirectory, relativePath) ?? "",
59389
+ kind: "harness"
59390
+ }
59391
+ ],
59392
+ previousFiles: []
59393
+ });
59394
+ };
58893
59395
  var runUpdate = ({
58894
59396
  rootDirectory,
58895
59397
  prompt: prompt4,
58896
59398
  check: check2 = false,
58897
59399
  write: write4 = false,
59400
+ yes = false,
58898
59401
  emitJson = false,
58899
59402
  ensureTools = true,
58900
- baseline = bundledBaseline
59403
+ baseline = bundledBaseline,
59404
+ toolRuntime
58901
59405
  }) => exports_Effect.gen(function* () {
58902
59406
  const manifest = yield* exports_Effect.try({
58903
59407
  try: () => readManifest(rootDirectory),
@@ -58920,7 +59424,7 @@ var runUpdate = ({
58920
59424
  const baselineDrift = typeof manifestBaseline?.version === "string" && manifestBaseline.version !== baseline.summary.version;
58921
59425
  const resolvedPacks = resolved.preselectedPacks;
58922
59426
  const packDrift = !comparePacks(finalPacks, resolvedPacks);
58923
- const expectedDirectory = mkdtempSync2(path13.join(tmpdir3(), "punks-update-"));
59427
+ const expectedDirectory = mkdtempSync2(path14.join(tmpdir3(), "punks-update-"));
58924
59428
  const expected = yield* writeScaffoldOutput({
58925
59429
  scanDirectory: rootDirectory,
58926
59430
  detection,
@@ -58938,9 +59442,18 @@ var runUpdate = ({
58938
59442
  expectedFiles: expected.managedFiles,
58939
59443
  previousFiles
58940
59444
  });
59445
+ const gitignoreChanges = buildGitignoreCleanup({
59446
+ rootDirectory,
59447
+ expectedDirectory
59448
+ });
59449
+ const wikiAlignment = buildWikiAlignment({
59450
+ rootDirectory,
59451
+ detection
59452
+ });
59453
+ const allChanges = [...changes2, ...gitignoreChanges, ...wikiAlignment.changes].toSorted((left3, right3) => left3.path.localeCompare(right3.path));
58941
59454
  const expectedPaths = new Set(expected.managedFiles.map((file6) => file6.path));
58942
59455
  const staleFiles = previousFiles.map((file6) => file6.path).filter((file6) => !expectedPaths.has(file6)).toSorted();
58943
- const hasManagedUpdates = changes2.length > 0 || staleFiles.length > 0;
59456
+ const hasManagedUpdates = allChanges.length > 0 || staleFiles.length > 0;
58944
59457
  const needsAttention = hasManagedUpdates || packDrift || baselineDrift;
58945
59458
  const driftPrompt = packDrift ? packDriftPrompt({ rootDirectory, finalPacks, resolvedPacks }) : null;
58946
59459
  yield* prompt4.writeLine(renderCommandSection("Update Detection", formatDetectionSummary(detection)));
@@ -58974,36 +59487,37 @@ var runUpdate = ({
58974
59487
  `)));
58975
59488
  }
58976
59489
  yield* prompt4.writeLine("");
58977
- yield* prompt4.writeLine(renderCommandSection("Managed Changes", summarizeChanges(changes2)));
59490
+ yield* prompt4.writeLine(renderCommandSection("Managed Changes", summarizeChanges(allChanges)));
58978
59491
  if (staleFiles.length > 0) {
58979
59492
  yield* prompt4.writeLine("");
58980
59493
  yield* prompt4.writeLine(renderCommandSection("Stale Managed Files", summarizeStaleFiles(staleFiles)));
58981
59494
  }
58982
- const patchPreview = diffableChanges(changes2);
59495
+ const patchPreview = diffableChanges(allChanges);
58983
59496
  if (patchPreview.length > 0) {
58984
59497
  yield* prompt4.writeLine("");
58985
59498
  yield* prompt4.writeLine(renderCommandSection("Diff Preview", [
58986
59499
  ...patchPreview.map((change) => change.patch),
58987
- ...changes2.length > patchPreview.length ? [
59500
+ ...allChanges.length > patchPreview.length ? [
58988
59501
  `Showing ${patchPreview.length} focused diffs. Full structured details are available with --json.`
58989
59502
  ] : []
58990
59503
  ].join(`
58991
59504
  `)));
58992
59505
  }
58993
- const shouldApply = write4 ? true : check2 || !hasManagedUpdates ? false : yesValues2.has((yield* prompt4.readLine(renderQuestion("Apply managed scaffold updates? [Y/n]: "))).trim().toLowerCase());
59506
+ const shouldApply = write4 || yes ? true : check2 || !hasManagedUpdates ? false : yesValues2.has((yield* prompt4.readLine(renderQuestion("Apply managed scaffold updates? [Y/n]: "))).trim().toLowerCase());
58994
59507
  let toolBootstrapStatuses = [];
58995
59508
  if (shouldApply && ensureTools) {
58996
59509
  const requiredTools = requiredToolsForSkills(selectedSkills3(finalPacks, baseline), baseline);
58997
59510
  if (requiredTools.length > 0) {
58998
59511
  yield* prompt4.writeLine("");
58999
59512
  yield* prompt4.writeLine(renderHint(`Ensuring required tools: ${requiredTools.join(", ")}`));
59000
- toolBootstrapStatuses = yield* exports_Effect.try({
59001
- try: () => ensureToolsInstalled(requiredTools, baseline),
59002
- catch: (cause3) => new CliValidationError({
59003
- cause: cause3,
59004
- message: cause3 instanceof Error ? cause3.message : "Failed to install required scaffold tools."
59005
- })
59006
- });
59513
+ toolBootstrapStatuses = ensureToolsInstalledBestEffort(requiredTools, baseline, toolRuntime);
59514
+ yield* prompt4.writeLine(renderCommandSection("Tool bootstrap", toolBootstrapStatuses.map((entry) => `\u2022 ${entry.toolId}: ${formatToolBootstrapStatus(entry)}`).join(`
59515
+ `)));
59516
+ const failureDetails = formatToolBootstrapFailureDetails(toolBootstrapStatuses);
59517
+ if (failureDetails !== null) {
59518
+ yield* prompt4.writeLine("");
59519
+ yield* prompt4.writeLine(renderCommandSection("Tool Bootstrap Warning", failureDetails));
59520
+ }
59007
59521
  }
59008
59522
  }
59009
59523
  if (shouldApply) {
@@ -59014,9 +59528,24 @@ var runUpdate = ({
59014
59528
  relativePath: change.path
59015
59529
  });
59016
59530
  }
59531
+ for (const change of gitignoreChanges) {
59532
+ copyManagedFile({
59533
+ fromDirectory: expectedDirectory,
59534
+ toDirectory: rootDirectory,
59535
+ relativePath: change.path
59536
+ });
59537
+ }
59538
+ for (const change of wikiAlignment.changes) {
59539
+ copyManagedFile({
59540
+ fromDirectory: wikiAlignment.expectedDirectory,
59541
+ toDirectory: rootDirectory,
59542
+ relativePath: change.path
59543
+ });
59544
+ }
59017
59545
  for (const staleFile of staleFiles) {
59018
- rmSync4(path13.join(rootDirectory, staleFile), { recursive: true, force: true });
59546
+ rmSync4(path14.join(rootDirectory, staleFile), { recursive: true, force: true });
59019
59547
  }
59548
+ removeHarnessDirectoriesFromGitignore(rootDirectory);
59020
59549
  }
59021
59550
  if (check2 && needsAttention) {
59022
59551
  process.exitCode = 1;
@@ -59028,7 +59557,7 @@ var runUpdate = ({
59028
59557
  finalPacks,
59029
59558
  resolvedPacks,
59030
59559
  packDrift,
59031
- changedFiles: changes2,
59560
+ changedFiles: allChanges,
59032
59561
  staleFiles,
59033
59562
  applied: shouldApply,
59034
59563
  checkFailed: check2 && needsAttention,
@@ -59039,7 +59568,7 @@ var runUpdate = ({
59039
59568
  yield* prompt4.writeLine("");
59040
59569
  yield* prompt4.writeLine(renderCommandSection("Update Complete", [
59041
59570
  shouldApply ? "Managed scaffold files updated." : "No files were written.",
59042
- `Changed files: ${changes2.length}`,
59571
+ `Changed files: ${allChanges.length}`,
59043
59572
  `Stale files: ${staleFiles.length}`,
59044
59573
  `Manifests scanned: ${manifestPaths(detection).join(", ") || "\u2205"}`,
59045
59574
  "Guidance: keep phase skills out of scoped `AGENTS.md` primary-skill lines; invoke them from the parent goal/handoff flow."
@@ -59051,6 +59580,7 @@ var runUpdate = ({
59051
59580
  yield* prompt4.writeLine(encodePrettyJson2(result));
59052
59581
  }
59053
59582
  rmSync4(expectedDirectory, { recursive: true, force: true });
59583
+ rmSync4(wikiAlignment.expectedDirectory, { recursive: true, force: true });
59054
59584
  if (result.applied) {
59055
59585
  yield* submitCliEventEffect("cli.scaffold.update.applied", {
59056
59586
  cwd: rootDirectory,
@@ -59066,6 +59596,7 @@ var runUpdate = ({
59066
59596
  var inputOption2 = exports_Options.optional(exports_Options.text("input").pipe(exports_Options.withAlias("i"), exports_Options.withDescription("Scaffolded repository root to update. Defaults to the current working directory.")));
59067
59597
  var checkOption = exports_Options.boolean("check").pipe(exports_Options.withDescription("Preview managed scaffold updates, write nothing, and exit nonzero when updates are available."));
59068
59598
  var writeOption = exports_Options.boolean("write").pipe(exports_Options.withDescription("Apply managed scaffold updates without asking for confirmation."));
59599
+ var yesOption2 = exports_Options.boolean("yes").pipe(exports_Options.withDescription("Apply managed scaffold updates without asking for confirmation."));
59069
59600
  var jsonOption3 = exports_Options.boolean("json").pipe(exports_Options.withDescription("Print the machine-readable update payload to stdout."));
59070
59601
  var baselineOption2 = exports_Options.optional(exports_Options.choice("baseline", ["stable", "bundled"]).pipe(exports_Options.withDescription("Scaffold baseline to use. Defaults to latest stable remote baseline with bundled fallback.")));
59071
59602
  var refreshBaselineOption2 = exports_Options.boolean("refresh-baseline").pipe(exports_Options.withDescription("Refetch the stable baseline instead of reusing the local cache."));
@@ -59073,18 +59604,20 @@ var updateCommand = exports_Command.make("update", {
59073
59604
  input: inputOption2,
59074
59605
  check: checkOption,
59075
59606
  write: writeOption,
59607
+ yes: yesOption2,
59076
59608
  json: jsonOption3,
59077
59609
  baseline: baselineOption2,
59078
59610
  refreshBaseline: refreshBaselineOption2
59079
- }, ({ input: input2, check: check2, write: write4, json: json2, baseline, refreshBaseline }) => exports_Effect.scoped(exports_Effect.gen(function* () {
59611
+ }, ({ input: input2, check: check2, write: write4, yes, json: json2, baseline, refreshBaseline }) => exports_Effect.scoped(exports_Effect.gen(function* () {
59080
59612
  const prompt4 = yield* PromptLive;
59081
- const rootDirectory = path14.resolve(process.cwd(), getOrElse(input2, () => "."));
59613
+ const rootDirectory = path15.resolve(process.cwd(), getOrElse(input2, () => "."));
59082
59614
  const resolvedBaseline = yield* exports_Effect.promise(() => resolveBaseline(baselineResolveOptions(baseline, refreshBaseline, rootDirectory)));
59083
59615
  yield* runUpdate({
59084
59616
  rootDirectory,
59085
59617
  prompt: prompt4,
59086
59618
  check: check2,
59087
59619
  write: write4,
59620
+ yes,
59088
59621
  emitJson: json2,
59089
59622
  baseline: resolvedBaseline
59090
59623
  });
@@ -59503,7 +60036,7 @@ var startupCheckWorkerEnv = "DP_STARTUP_CHECK_WORKER";
59503
60036
  var startupCheckCliEnv = "DP_STARTUP_CHECK_CLI";
59504
60037
  var startupCheckSkillEnv = "DP_STARTUP_CHECK_SKILL";
59505
60038
  var startupCheckIntervalMs = Number.parseInt(process.env.DP_STARTUP_CHECK_INTERVAL_MS ?? String(12 * 60 * 60 * 1000), 10);
59506
- var startupCheckCacheFile = path15.join(homedir3(), ".cache", "punks", "startup-check.json");
60039
+ var startupCheckCacheFile = path16.join(homedir3(), ".cache", "punks", "startup-check.json");
59507
60040
  var app = exports_Command.make("punks", {}, () => exports_Effect.sync(() => console.log(renderCommandGuide()))).pipe(exports_Command.withDescription("Harness Intelligence CLI. Agents: activate $dp-cli before acting on generated .devpunks output."), exports_Command.withSubcommands([reportCommand, scaffoldCommand, updateCommand, upgradeCommand]));
59508
60041
  var cli = exports_Command.run(app, {
59509
60042
  name: "punks",
@@ -59551,15 +60084,15 @@ var hasFreshStartupCheck = () => {
59551
60084
  return false;
59552
60085
  }
59553
60086
  try {
59554
- const parsed = JSON.parse(readFileSync7(startupCheckCacheFile, "utf8"));
60087
+ const parsed = JSON.parse(readFileSync9(startupCheckCacheFile, "utf8"));
59555
60088
  return typeof parsed.checkedAt === "number" && Date.now() - parsed.checkedAt < startupCheckIntervalMs;
59556
60089
  } catch {
59557
60090
  return false;
59558
60091
  }
59559
60092
  };
59560
60093
  var markStartupCheckStarted = () => {
59561
- mkdirSync6(path15.dirname(startupCheckCacheFile), { recursive: true });
59562
- writeFileSync5(startupCheckCacheFile, JSON.stringify({ checkedAt: Date.now() }, null, 2));
60094
+ mkdirSync6(path16.dirname(startupCheckCacheFile), { recursive: true });
60095
+ writeFileSync6(startupCheckCacheFile, JSON.stringify({ checkedAt: Date.now() }, null, 2));
59563
60096
  };
59564
60097
  var startBackgroundStartupChecks = () => {
59565
60098
  const checkCli = shouldCheckSelfUpdate();
@@ -59568,7 +60101,7 @@ var startBackgroundStartupChecks = () => {
59568
60101
  return;
59569
60102
  }
59570
60103
  const entrypoint = process.argv[1];
59571
- if (entrypoint === undefined || !existsSync7(entrypoint)) {
60104
+ if (entrypoint === undefined || !existsSync8(entrypoint)) {
59572
60105
  return;
59573
60106
  }
59574
60107
  markStartupCheckStarted();