gsd-pi 2.80.0-dev.c5c38454b → 2.80.0-dev.e146beb20

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 (120) hide show
  1. package/dist/resources/.managed-resources-content-hash +1 -1
  2. package/dist/resources/GSD-WORKFLOW.md +2 -2
  3. package/dist/resources/extensions/gsd/auto/loop.js +32 -1
  4. package/dist/resources/extensions/gsd/auto/phases.js +37 -30
  5. package/dist/resources/extensions/gsd/auto-post-unit.js +10 -10
  6. package/dist/resources/extensions/gsd/auto-prompts.js +111 -1
  7. package/dist/resources/extensions/gsd/auto.js +9 -1
  8. package/dist/resources/extensions/gsd/clean-root-preflight.js +42 -4
  9. package/dist/resources/extensions/gsd/commands/dispatcher.js +5 -0
  10. package/dist/resources/extensions/gsd/crash-recovery.js +56 -10
  11. package/dist/resources/extensions/gsd/detection.js +106 -0
  12. package/dist/resources/extensions/gsd/guided-flow.js +47 -10
  13. package/dist/resources/extensions/gsd/planning-path-scope.js +26 -0
  14. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +7 -8
  15. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +3 -1
  16. package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  17. package/dist/resources/extensions/gsd/safety/evidence-collector.js +10 -2
  18. package/dist/resources/extensions/gsd/tools/plan-slice.js +9 -0
  19. package/dist/resources/extensions/gsd/tools/plan-task.js +9 -0
  20. package/dist/resources/extensions/gsd/unit-runtime.js +11 -0
  21. package/dist/resources/extensions/gsd/worktree-manager.js +16 -14
  22. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  23. package/dist/web/standalone/.next/BUILD_ID +1 -1
  24. package/dist/web/standalone/.next/app-path-routes-manifest.json +16 -16
  25. package/dist/web/standalone/.next/build-manifest.json +2 -2
  26. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  27. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  28. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  29. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  30. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  31. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  32. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  33. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  34. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  35. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  36. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  37. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  38. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  39. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  40. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  41. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  42. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  43. package/dist/web/standalone/.next/server/app/index.html +1 -1
  44. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  45. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  46. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  47. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  48. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  49. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  50. package/dist/web/standalone/.next/server/app-paths-manifest.json +16 -16
  51. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  52. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  53. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  54. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  55. package/package.json +1 -1
  56. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +30 -0
  57. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  58. package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts +15 -0
  59. package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts.map +1 -0
  60. package/packages/pi-coding-agent/dist/core/db-snapshot.js +66 -0
  61. package/packages/pi-coding-agent/dist/core/db-snapshot.js.map +1 -0
  62. package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts +2 -0
  63. package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts.map +1 -0
  64. package/packages/pi-coding-agent/dist/core/db-snapshot.test.js +24 -0
  65. package/packages/pi-coding-agent/dist/core/db-snapshot.test.js.map +1 -0
  66. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  67. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +2 -0
  68. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  69. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts +2 -0
  70. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts.map +1 -0
  71. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js +10 -0
  72. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js.map +1 -0
  73. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.d.ts.map +1 -1
  74. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js +3 -2
  75. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js.map +1 -1
  76. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +36 -0
  77. package/packages/pi-coding-agent/src/core/db-snapshot.test.ts +32 -0
  78. package/packages/pi-coding-agent/src/core/db-snapshot.ts +66 -0
  79. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +2 -0
  80. package/packages/pi-coding-agent/src/resources/extensions/memory/storage-safety-guard.test.ts +14 -0
  81. package/packages/pi-coding-agent/src/resources/extensions/memory/storage.ts +3 -2
  82. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  83. package/src/resources/GSD-WORKFLOW.md +2 -2
  84. package/src/resources/extensions/gsd/auto/loop-deps.ts +1 -0
  85. package/src/resources/extensions/gsd/auto/loop.ts +50 -8
  86. package/src/resources/extensions/gsd/auto/phases.ts +42 -28
  87. package/src/resources/extensions/gsd/auto-post-unit.ts +10 -10
  88. package/src/resources/extensions/gsd/auto-prompts.ts +116 -1
  89. package/src/resources/extensions/gsd/auto.ts +12 -1
  90. package/src/resources/extensions/gsd/clean-root-preflight.ts +41 -3
  91. package/src/resources/extensions/gsd/commands/dispatcher.ts +6 -0
  92. package/src/resources/extensions/gsd/crash-recovery.ts +67 -10
  93. package/src/resources/extensions/gsd/detection.ts +128 -0
  94. package/src/resources/extensions/gsd/guided-flow.ts +47 -10
  95. package/src/resources/extensions/gsd/planning-path-scope.ts +35 -0
  96. package/src/resources/extensions/gsd/prompts/complete-milestone.md +7 -8
  97. package/src/resources/extensions/gsd/prompts/plan-milestone.md +3 -1
  98. package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  99. package/src/resources/extensions/gsd/safety/evidence-collector.ts +11 -2
  100. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +1 -1
  101. package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +88 -2
  102. package/src/resources/extensions/gsd/tests/crash-handler-secondary.test.ts +55 -0
  103. package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +22 -0
  104. package/src/resources/extensions/gsd/tests/detection.test.ts +140 -0
  105. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +50 -0
  106. package/src/resources/extensions/gsd/tests/plan-task.test.ts +21 -0
  107. package/src/resources/extensions/gsd/tests/right-sized-workflow-prompts.test.ts +192 -0
  108. package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +29 -0
  109. package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +38 -0
  110. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +46 -2
  111. package/src/resources/extensions/gsd/tests/unit-runtime.test.ts +7 -0
  112. package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +37 -6
  113. package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +7 -0
  114. package/src/resources/extensions/gsd/tests/worktree-nested-git-safety.test.ts +9 -2
  115. package/src/resources/extensions/gsd/tools/plan-slice.ts +13 -0
  116. package/src/resources/extensions/gsd/tools/plan-task.ts +10 -0
  117. package/src/resources/extensions/gsd/unit-runtime.ts +14 -0
  118. package/src/resources/extensions/gsd/worktree-manager.ts +15 -4
  119. /package/dist/web/standalone/.next/static/{TCSim36ZpcPu2WgeoC45g → y73quA-XdLo9n41nxphjW}/_buildManifest.js +0 -0
  120. /package/dist/web/standalone/.next/static/{TCSim36ZpcPu2WgeoC45g → y73quA-XdLo9n41nxphjW}/_ssgManifest.js +0 -0
@@ -38,6 +38,7 @@ import { _getAdapter, isDbAvailable } from "./gsd-db.js";
38
38
  import { gsdRoot, normalizeRealPath } from "./paths.js";
39
39
  import { atomicWriteSync } from "./atomic-write.js";
40
40
  import { effectiveLockFile } from "./session-lock.js";
41
+ import { isInFlightRuntimePhase, listUnitRuntimeRecords, type AutoUnitRuntimeRecord } from "./unit-runtime.js";
41
42
 
42
43
  export interface LockData {
43
44
  pid: number;
@@ -103,10 +104,40 @@ function getLatestDispatchForWorker(workerId: string):
103
104
  return row ?? null;
104
105
  }
105
106
 
106
- function workerToLockData(worker: AutoWorkerRow): LockData {
107
+ function latestInFlightRuntimeRecord(basePath: string): AutoUnitRuntimeRecord | null {
108
+ const records = listUnitRuntimeRecords(basePath).filter((record) =>
109
+ isInFlightRuntimePhase(record.phase),
110
+ );
111
+ if (records.length === 0) return null;
112
+ return records.sort((a, b) => {
113
+ const bTime = b.updatedAt || b.startedAt || 0;
114
+ const aTime = a.updatedAt || a.startedAt || 0;
115
+ return bTime - aTime;
116
+ })[0] ?? null;
117
+ }
118
+
119
+ function runtimeRecordToLockData(worker: AutoWorkerRow, record: AutoUnitRuntimeRecord, sessionFile?: string): LockData {
120
+ const startedAt = Number.isFinite(record.startedAt)
121
+ ? new Date(record.startedAt).toISOString()
122
+ : worker.started_at;
123
+ return {
124
+ pid: worker.pid,
125
+ startedAt: worker.started_at,
126
+ unitType: record.unitType,
127
+ unitId: record.unitId,
128
+ unitStartedAt: startedAt,
129
+ sessionFile,
130
+ };
131
+ }
132
+
133
+ function workerToLockData(basePath: string, worker: AutoWorkerRow): LockData {
107
134
  const dispatch = getLatestDispatchForWorker(worker.worker_id);
108
135
  const sessionFile =
109
136
  getRuntimeKv<string>("worker", worker.worker_id, SESSION_FILE_KV_KEY) ?? undefined;
137
+ if (!dispatch) {
138
+ const runtimeRecord = latestInFlightRuntimeRecord(basePath);
139
+ if (runtimeRecord) return runtimeRecordToLockData(worker, runtimeRecord, sessionFile);
140
+ }
110
141
  return {
111
142
  pid: worker.pid,
112
143
  startedAt: worker.started_at,
@@ -204,7 +235,7 @@ export function readCrashLock(basePath: string): LockData | null {
204
235
  try {
205
236
  const projectRoot = normalizeRealPath(basePath);
206
237
  const stale = findStaleWorkerForProject(projectRoot);
207
- if (stale) return workerToLockData(stale);
238
+ if (stale) return workerToLockData(basePath, stale);
208
239
  } catch {
209
240
  // Fall through to the legacy lock-file compatibility path.
210
241
  }
@@ -260,25 +291,48 @@ export function formatCrashInfo(lock: LockData): string {
260
291
  */
261
292
  export function emitCrashRecoveredUnitEnd(basePath: string, lock: LockData): void {
262
293
  if (!lock.unitType || !lock.unitId || lock.unitType === "starting") return;
294
+ emitOpenUnitEndForUnit(basePath, lock.unitType, lock.unitId, "crash-recovered");
295
+ }
263
296
 
297
+ export function emitOpenUnitEndForUnit(
298
+ basePath: string,
299
+ unitType: string,
300
+ unitId: string,
301
+ status: string,
302
+ errorContext?: { message: string; category: string; stopReason?: string; isTransient?: boolean; retryAfterMs?: number },
303
+ ): boolean {
264
304
  try {
265
305
  const all = queryJournal(basePath);
266
306
 
267
307
  const starts = all.filter(
268
- (e) => e.eventType === "unit-start" && e.data?.unitId === lock.unitId,
308
+ (e) =>
309
+ e.eventType === "unit-start" &&
310
+ e.data?.unitType === unitType &&
311
+ e.data?.unitId === unitId,
269
312
  );
270
- if (starts.length === 0) return;
313
+ if (starts.length === 0) return false;
271
314
 
272
- const lastStart = starts[starts.length - 1];
315
+ const lastStart = [...starts].reverse().find((start) => {
316
+ return !all.some(
317
+ (e) =>
318
+ e.eventType === "unit-end" &&
319
+ e.data?.unitType === unitType &&
320
+ e.data?.unitId === unitId &&
321
+ e.causedBy?.flowId === start.flowId &&
322
+ e.causedBy?.seq === start.seq,
323
+ );
324
+ });
325
+ if (!lastStart) return false;
273
326
 
274
327
  const alreadyClosed = all.some(
275
328
  (e) =>
276
329
  e.eventType === "unit-end" &&
277
- e.data?.unitId === lock.unitId &&
330
+ e.data?.unitType === unitType &&
331
+ e.data?.unitId === unitId &&
278
332
  e.causedBy?.flowId === lastStart.flowId &&
279
333
  e.causedBy?.seq === lastStart.seq,
280
334
  );
281
- if (alreadyClosed) return;
335
+ if (alreadyClosed) return false;
282
336
 
283
337
  const maxSeq = all
284
338
  .filter((e) => e.flowId === lastStart.flowId)
@@ -290,15 +344,18 @@ export function emitCrashRecoveredUnitEnd(basePath: string, lock: LockData): voi
290
344
  seq: maxSeq + 1,
291
345
  eventType: "unit-end",
292
346
  data: {
293
- unitType: lock.unitType,
294
- unitId: lock.unitId,
295
- status: "crash-recovered",
347
+ unitType,
348
+ unitId,
349
+ status,
296
350
  artifactVerified: false,
351
+ ...(errorContext ? { errorContext } : {}),
297
352
  },
298
353
  causedBy: { flowId: lastStart.flowId, seq: lastStart.seq },
299
354
  });
355
+ return true;
300
356
  } catch {
301
357
  // Never throw from crash recovery path.
358
+ return false;
302
359
  }
303
360
  }
304
361
 
@@ -6,6 +6,7 @@
6
6
  * flow to show when entering a project directory.
7
7
  */
8
8
 
9
+ import { execFileSync } from "node:child_process";
9
10
  import { existsSync, openSync, readSync, closeSync, readdirSync, readFileSync, statSync } from "node:fs";
10
11
  import { dirname, join, parse as parsePath } from "node:path";
11
12
  import { homedir } from "node:os";
@@ -72,6 +73,22 @@ export interface ProjectSignals {
72
73
  verificationCommands: string[];
73
74
  }
74
75
 
76
+ export type ProjectClassificationKind =
77
+ | "invalid-repo"
78
+ | "greenfield"
79
+ | "untyped-existing"
80
+ | "typed-existing";
81
+
82
+ export interface ProjectClassification {
83
+ kind: ProjectClassificationKind;
84
+ signals: ProjectSignals;
85
+ trackedFiles: string[];
86
+ untrackedFiles: string[];
87
+ contentFiles: string[];
88
+ markers: string[];
89
+ reason: string;
90
+ }
91
+
75
92
  // ─── Project File Markers ───────────────────────────────────────────────────────
76
93
 
77
94
  export const PROJECT_FILES = [
@@ -243,6 +260,7 @@ const TEST_MARKERS = [
243
260
  const RECURSIVE_SCAN_IGNORED_DIRS = new Set([
244
261
  ".git",
245
262
  ".gsd",
263
+ ".bg-shell",
246
264
  ".planning",
247
265
  ".plans",
248
266
  ".claude",
@@ -267,6 +285,8 @@ const RECURSIVE_SCAN_IGNORED_DIRS = new Set([
267
285
  "out",
268
286
  ]) as ReadonlySet<string>;
269
287
 
288
+ const PROJECT_CONTENT_EXCLUDE_DIRS = RECURSIVE_SCAN_IGNORED_DIRS;
289
+
270
290
  /** Project file markers safe to detect recursively via suffix matching. */
271
291
  const ROOT_ONLY_PROJECT_FILES = new Set<string>([
272
292
  ".github/workflows",
@@ -536,6 +556,114 @@ export function detectProjectSignals(basePath: string): ProjectSignals {
536
556
  };
537
557
  }
538
558
 
559
+ function normalizeGitPath(file: string): string {
560
+ return file.replaceAll("\\", "/").replace(/^\.\//, "");
561
+ }
562
+
563
+ function isProjectContentFile(file: string): boolean {
564
+ const normalized = normalizeGitPath(file);
565
+ if (!normalized || normalized.endsWith("/")) return false;
566
+ if (normalized === ".gitignore" || normalized === ".gitattributes") return false;
567
+ const parts = normalized.split("/");
568
+ if (parts.some((part) => PROJECT_CONTENT_EXCLUDE_DIRS.has(part))) return false;
569
+ if (normalized.endsWith(".DS_Store")) return false;
570
+ return true;
571
+ }
572
+
573
+ function runGitLines(basePath: string, args: string[]): string[] {
574
+ try {
575
+ const output = execFileSync("git", args, {
576
+ cwd: basePath,
577
+ stdio: ["ignore", "pipe", "ignore"],
578
+ encoding: "utf-8",
579
+ }).trim();
580
+ return output ? output.split("\n").map((line) => line.trim()).filter(Boolean) : [];
581
+ } catch {
582
+ return [];
583
+ }
584
+ }
585
+
586
+ function listTrackedProjectFiles(basePath: string): string[] {
587
+ return runGitLines(basePath, ["ls-files"])
588
+ .map(normalizeGitPath)
589
+ .filter(isProjectContentFile);
590
+ }
591
+
592
+ function listUntrackedProjectFiles(basePath: string): string[] {
593
+ return runGitLines(basePath, ["ls-files", "--others", "--exclude-standard"])
594
+ .map(normalizeGitPath)
595
+ .filter(isProjectContentFile);
596
+ }
597
+
598
+ function hasKnownProjectMarkers(basePath: string, signals: ProjectSignals): boolean {
599
+ if (signals.detectedFiles.length > 0) return true;
600
+ if (signals.xcodePlatforms.length > 0) return true;
601
+ return false;
602
+ }
603
+
604
+ /**
605
+ * Classify repo presence separately from ecosystem/tooling markers.
606
+ *
607
+ * Known project files identify tooling. Git-tracked/non-ignored content
608
+ * identifies whether this is an existing project at all. This keeps small
609
+ * static or documentation repos from being mislabeled as greenfield.
610
+ */
611
+ export function classifyProject(basePath: string): ProjectClassification {
612
+ const signals = detectProjectSignals(basePath);
613
+ const markers = [...signals.detectedFiles];
614
+
615
+ if (!signals.isGitRepo) {
616
+ return {
617
+ kind: "invalid-repo",
618
+ signals,
619
+ trackedFiles: [],
620
+ untrackedFiles: [],
621
+ contentFiles: [],
622
+ markers,
623
+ reason: "missing .git",
624
+ };
625
+ }
626
+
627
+ const trackedFiles = listTrackedProjectFiles(basePath);
628
+ const untrackedFiles = listUntrackedProjectFiles(basePath);
629
+ const contentFiles = [...new Set([...trackedFiles, ...untrackedFiles])];
630
+ const hasMarkers = hasKnownProjectMarkers(basePath, signals);
631
+
632
+ if (hasMarkers) {
633
+ return {
634
+ kind: "typed-existing",
635
+ signals,
636
+ trackedFiles,
637
+ untrackedFiles,
638
+ contentFiles,
639
+ markers,
640
+ reason: markers.length > 0 ? `detected markers: ${markers.join(", ")}` : "detected project structure",
641
+ };
642
+ }
643
+
644
+ if (contentFiles.length > 0) {
645
+ return {
646
+ kind: "untyped-existing",
647
+ signals,
648
+ trackedFiles,
649
+ untrackedFiles,
650
+ contentFiles,
651
+ markers,
652
+ reason: "project content exists but no recognized tooling markers were found",
653
+ };
654
+ }
655
+
656
+ return {
657
+ kind: "greenfield",
658
+ signals,
659
+ trackedFiles,
660
+ untrackedFiles,
661
+ contentFiles,
662
+ markers,
663
+ reason: "no tracked or non-ignored project content",
664
+ };
665
+ }
666
+
539
667
  // ─── Xcode Platform Detection ───────────────────────────────────────────────────
540
668
 
541
669
  /** Known SDKROOT values → canonical platform names. */
@@ -30,7 +30,7 @@ import {
30
30
  formatInterruptedSessionRunningMessage,
31
31
  formatInterruptedSessionSummary,
32
32
  } from "./interrupted-session.js";
33
- import { listUnitRuntimeRecords, clearUnitRuntimeRecord } from "./unit-runtime.js";
33
+ import { listUnitRuntimeRecords, clearUnitRuntimeRecord, isInFlightRuntimePhase } from "./unit-runtime.js";
34
34
  import { resolveExpectedArtifactPath } from "./auto.js";
35
35
  import { gsdHome } from "./gsd-home.js";
36
36
  import {
@@ -118,6 +118,22 @@ export function resolveExpectedArtifactPathForScope(
118
118
  return resolveExpectedArtifactPath(unitType, unitId, scope.workspace.projectRoot);
119
119
  }
120
120
 
121
+ async function runQuickTaskChoice(ctx: ExtensionCommandContext, pi: ExtensionAPI): Promise<void> {
122
+ if (!ctx.hasUI) {
123
+ ctx.ui.notify("Run /gsd quick <task> for small bounded work, or /gsd do <task> for natural-language routing.", "info");
124
+ return;
125
+ }
126
+
127
+ const task = (await ctx.ui.input("Quick task", "Describe the small task to run with /gsd quick"))?.trim();
128
+ if (!task) {
129
+ ctx.ui.notify("Quick task cancelled.", "info");
130
+ return;
131
+ }
132
+
133
+ const { handleQuick } = await import("./quick.js");
134
+ await handleQuick(task, ctx, pi);
135
+ }
136
+
121
137
  /**
122
138
  * Scope-based overload of isGhostMilestone.
123
139
  * Binds basePath and milestoneId from the scope, ensuring path resolution
@@ -1786,8 +1802,8 @@ function selfHealRuntimeRecords(basePath: string, ctx: ExtensionContext): { clea
1786
1802
  cleared++;
1787
1803
  continue;
1788
1804
  }
1789
- // Clear records stuck in dispatched or timeout phase (process died mid-unit)
1790
- if (phase === "dispatched" || phase === "timeout") {
1805
+ // Clear records stuck in an in-flight phase (process died mid-unit).
1806
+ if (isInFlightRuntimePhase(phase)) {
1791
1807
  clearUnitRuntimeRecord(basePath, unitType, unitId);
1792
1808
  cleared++;
1793
1809
  }
@@ -2134,17 +2150,24 @@ export async function showSmartEntry(
2134
2150
  title: "GSD — Get Shit Done",
2135
2151
  summary: ["No active milestone."],
2136
2152
  actions: [
2153
+ {
2154
+ id: "quick_task",
2155
+ label: "Quick task",
2156
+ description: "For small bounded work, run /gsd quick <task> or /gsd do <task>.",
2157
+ recommended: true,
2158
+ },
2137
2159
  {
2138
2160
  id: "new_milestone",
2139
2161
  label: "Create next milestone",
2140
- description: "Define what to build next.",
2141
- recommended: true,
2162
+ description: "Define a larger body of work with planning artifacts.",
2142
2163
  },
2143
2164
  ],
2144
2165
  notYetMessage: "Run /gsd when ready.",
2145
2166
  });
2146
2167
 
2147
- if (choice === "new_milestone") {
2168
+ if (choice === "quick_task") {
2169
+ await runQuickTaskChoice(ctx, pi);
2170
+ } else if (choice === "new_milestone") {
2148
2171
  setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: nextId, step: stepMode });
2149
2172
  await dispatchWorkflow(pi, await prepareAndBuildDiscussPrompt(ctx, pi, nextId,
2150
2173
  `New milestone ${nextId}.`,
@@ -2181,11 +2204,16 @@ export async function showSmartEntry(
2181
2204
  title: `GSD — ${milestoneId}: ${milestoneTitle}`,
2182
2205
  summary: ["All milestones complete."],
2183
2206
  actions: [
2207
+ {
2208
+ id: "quick_task",
2209
+ label: "Quick task",
2210
+ description: "Do a small bounded task without opening a milestone.",
2211
+ recommended: true,
2212
+ },
2184
2213
  {
2185
2214
  id: "new_milestone",
2186
2215
  label: "Start new milestone",
2187
2216
  description: "Define and plan the next milestone.",
2188
- recommended: true,
2189
2217
  },
2190
2218
  {
2191
2219
  id: "status",
@@ -2196,7 +2224,9 @@ export async function showSmartEntry(
2196
2224
  notYetMessage: "Run /gsd when ready.",
2197
2225
  });
2198
2226
 
2199
- if (choice === "new_milestone") {
2227
+ if (choice === "quick_task") {
2228
+ await runQuickTaskChoice(ctx, pi);
2229
+ } else if (choice === "new_milestone") {
2200
2230
  const milestoneIds = findMilestoneIds(basePath);
2201
2231
  const uniqueMilestoneIds = !!loadEffectiveGSDPreferences()?.preferences?.unique_milestone_ids;
2202
2232
  const nextId = nextMilestoneIdReserved(milestoneIds, uniqueMilestoneIds, basePath);
@@ -2300,13 +2330,18 @@ export async function showSmartEntry(
2300
2330
  const hasContext = !!(contextFile && await loadFile(contextFile));
2301
2331
 
2302
2332
  const actions = [
2333
+ {
2334
+ id: "quick_task",
2335
+ label: "Quick task instead",
2336
+ description: "Use this when the work is small and should not become a milestone.",
2337
+ recommended: true,
2338
+ },
2303
2339
  {
2304
2340
  id: "plan",
2305
2341
  label: "Create roadmap",
2306
2342
  description: hasContext
2307
2343
  ? "Context captured. Decompose into slices with a boundary map."
2308
2344
  : "Decompose the milestone into slices with a boundary map.",
2309
- recommended: true,
2310
2345
  },
2311
2346
  ...(!hasContext ? [{
2312
2347
  id: "discuss",
@@ -2332,7 +2367,9 @@ export async function showSmartEntry(
2332
2367
  notYetMessage: "Run /gsd when ready.",
2333
2368
  });
2334
2369
 
2335
- if (choice === "plan") {
2370
+ if (choice === "quick_task") {
2371
+ await runQuickTaskChoice(ctx, pi);
2372
+ } else if (choice === "plan") {
2336
2373
  setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId, step: stepMode });
2337
2374
  await dispatchWorkflow(
2338
2375
  pi,
@@ -0,0 +1,35 @@
1
+ import { isAbsolute, relative, resolve } from "node:path";
2
+ import { normalizePlannedFileReference } from "./files.js";
3
+
4
+ export interface PlanningPathScopeField {
5
+ field: string;
6
+ values: string[];
7
+ }
8
+
9
+ function isInsideBase(basePath: string, candidate: string): boolean {
10
+ const base = resolve(basePath);
11
+ const abs = resolve(candidate);
12
+ const rel = relative(base, abs);
13
+ return rel === "" || (!!rel && !rel.startsWith("..") && !isAbsolute(rel));
14
+ }
15
+
16
+ /**
17
+ * Planning IO fields are execution contracts. Absolute paths are only safe when
18
+ * they stay inside the active working directory; in worktree mode, an absolute
19
+ * path to the original checkout makes executors edit the wrong tree.
20
+ */
21
+ export function validatePlanningPathScope(
22
+ basePath: string,
23
+ fields: PlanningPathScopeField[],
24
+ ): string | null {
25
+ for (const { field, values } of fields) {
26
+ for (const raw of values) {
27
+ const candidate = normalizePlannedFileReference(raw);
28
+ if (!isAbsolute(candidate)) continue;
29
+ if (isInsideBase(basePath, candidate)) continue;
30
+ return `${field} contains absolute path outside working directory: ${candidate}. Use a path relative to ${basePath}.`;
31
+ }
32
+ }
33
+
34
+ return null;
35
+ }
@@ -16,15 +16,14 @@ Start with what the excerpts give you. Read full files when the section heads si
16
16
 
17
17
  **On-demand Read ordering:** Complete all slice SUMMARY Reads you need for cross-slice synthesis, the Decision Re-evaluation table, and LEARNINGS **before** calling `gsd_complete_milestone` (step 12). Once that tool runs, the milestone is marked complete in the DB, so it must be the final persistent milestone-closeout write.
18
18
 
19
- ### Delegate Review Work
19
+ ### Closeout Review Mode
20
20
 
21
- Use `subagent` for review work needing fresh context, before drafting LEARNINGS:
21
+ The inlined context includes a validation status block.
22
22
 
23
- - Cross-slice integrations or new public APIs -> **reviewer** with milestone diff and roadmap.
24
- - Auth, network, parsing, file IO, shell exec, or crypto -> **security** audit.
25
- - Significant tests added or changed -> **tester** coverage check against success criteria.
23
+ - If it says a passing validation artifact is present, treat that artifact as authoritative for success criteria, requirement coverage, verification classes, and cross-slice integration. Do not delegate fresh reviewer/security/tester audits unless the validation artifact is internally inconsistent with the inlined summaries.
24
+ - If validation is missing, stale, non-pass, or internally inconsistent, use `subagent` for review work needing fresh context before drafting LEARNINGS: cross-slice integrations or new public APIs -> **reviewer**; auth, network, parsing, file IO, shell exec, or crypto -> **security**; significant tests added or changed -> **tester**.
26
25
 
27
- Subagents report only; they do not write user source. Fold findings into Decision Re-evaluation and LEARNINGS before completion.
26
+ Subagents report only; they do not write user source. Fold any findings into Decision Re-evaluation and LEARNINGS before completion.
28
27
 
29
28
  {{inlinedContext}}
30
29
 
@@ -33,8 +32,8 @@ Subagents report only; they do not write user source. Fold findings into Decisio
33
32
  1. Use the **Milestone Summary** output template from the inlined context above
34
33
  2. {{skillActivation}}
35
34
  3. **Verify code changes exist.** Compare milestone work against the integration branch (`main`, `master`, or recorded branch), using merge-base as older revision and `HEAD` as newer. If the diff lists non-`.gsd/` files, pass. If `HEAD` equals the integration branch/merge-base, treat it as a self-diff retry: inspect milestone-scoped commit evidence (`GSD-Unit: {{milestoneId}}` or production `GSD-Task: Sxx/Tyy` trailers touching `.gsd/milestones/{{milestoneId}}/`) and verify those commits touched non-`.gsd/` files. Record **verification failure** only when neither source shows implementation files.
36
- 4. Verify every **success criterion** from `{{roadmapPath}}` with evidence from summaries, tests, or observable behavior. Record unmet criteria as **verification failure**.
37
- 5. Verify **definition of done**: all slices `[x]`, summaries exist, and integrations work. Record unmet items as **verification failure**.
35
+ 4. Verify every **success criterion** from `{{roadmapPath}}`. If passing validation is present, summarize the validation evidence instead of re-auditing it; otherwise verify with evidence from summaries, tests, or observable behavior. Record unmet criteria as **verification failure**.
36
+ 5. Verify **definition of done**: all slices `[x]`, summaries exist, and integrations work. If passing validation is present, trust its integration/verification verdict unless inconsistent with current artifacts. Record unmet items as **verification failure**.
38
37
  6. If the roadmap includes a **Horizontal Checklist**, verify each item and note unchecked items in the summary.
39
38
  7. Fill the **Decision Re-evaluation** table: compare each key `.gsd/DECISIONS.md` decision from this milestone with what shipped, and flag decisions to revisit.
40
39
  8. Validate **requirement status transitions**. For each changed requirement, confirm evidence supports the new status. Requirements may move between Active, Validated, Deferred, Blocked, or Out of Scope only with proof.
@@ -48,7 +48,7 @@ Narrate decomposition reasoning in complete sentences: grouping, risk order, ver
48
48
  Then:
49
49
  1. Use the **Roadmap** output template from the inlined context above
50
50
  2. {{skillActivation}}
51
- 3. Create only as many demoable vertical slices as the work genuinely needs.
51
+ 3. Create only as many demoable vertical slices as the work genuinely needs. Use 1-10 slices, sized to the work; tiny/single-file/static work should usually be one slice.
52
52
  4. Order by risk, high-risk first.
53
53
  5. Call `gsd_plan_milestone` to persist milestone fields, slice rows, and **Horizontal Checklist** through the DB-backed path. Fill checklist concerns considered during planning: requirements, decisions, shutdown, revenue, auth, shared resources, reconnection. Omit for trivial milestones. Do **not** write `{{outputPath}}`, `ROADMAP.md`, or other planning artifacts manually; the tool owns rendering and persistence.
54
54
  6. If planning produced structural decisions (slice ordering, technology choices, scope exclusions), call `gsd_decision_save` for each; the tool assigns IDs and regenerates `.gsd/DECISIONS.md`.
@@ -78,6 +78,8 @@ Apply these when decomposing and ordering slices:
78
78
  - Ship features, not proofs; use clearly marked realistic stubs only when necessary.
79
79
  - **Dependency format is comma-separated, never range syntax.** Write `depends:[S01,S02,S03]`, not `depends:[S01-S03]`.
80
80
  - Roadmap ambition must match the milestone; right-size decomposition.
81
+ - Missing ecosystem markers are not a reason to over-plan. If Project Classification says `untyped-existing`, treat the listed content files as the project surface and use generic file-level workflow guidance.
82
+ - For `untyped-existing` projects with 1-2 content files, prefer exactly one slice unless the request clearly spans multiple independent user-visible capabilities. For 3-5 content files, prefer 1-2 slices.
81
83
 
82
84
  ## Progressive Planning (ADR-011)
83
85
 
@@ -39,7 +39,7 @@ If slice research is inlined, trust it. Explore enough code to confirm paths, bo
39
39
  5. Define slice verification before tasks. Non-trivial slices need real tests or executable assertions; boundary contracts need contract-exercising checks. Tests must not read .gitignore/gitignored paths such as `.gsd/`, `.planning/`, or `.audits/`.
40
40
  6. Include Threat Surface (Q3), Requirement Impact (Q4), proof level, observability, integration closure, Failure Modes (Q5), Load Profile (Q6), and Negative Tests (Q7) only where applicable.
41
41
  7. Right-size tasks. Simple slices can be one task; split only when context, ownership, or verification boundaries justify it.
42
- 8. Each task needs a concrete title, Why / Files / Do / Verify / Done when, plus task-plan description, steps, must-haves, verification, inputs, and expected output. Inputs and Expected Output must include concrete backtick-wrapped paths; each task needs at least one output path.
42
+ 8. Each task needs a concrete title, Why / Files / Do / Verify / Done when, plus task-plan description, steps, must-haves, verification, inputs, and expected output. Inputs and Expected Output must include concrete backtick-wrapped paths; each task needs at least one output path. Use paths relative to `{{workingDirectory}}`; do not put absolute paths to the original checkout or any directory outside `{{workingDirectory}}` in `files`, `inputs`, `expectedOutput`, or verification commands.
43
43
  9. Persist with `gsd_plan_slice` using goal, successCriteria, optional proofLevel/integrationClosure/observabilityImpact, and tasks. `gsd_plan_slice` handles task persistence transactionally and renders `{{outputPath}}` plus task plans; do not call `gsd_plan_task`. The DB-backed tool is the canonical write path. Do **not** rely on direct `PLAN.md` writes as the source of truth.
44
44
  10. Self-audit before finishing: goal/demo closure, requirement coverage, locked decisions, concrete paths, dependency order, wiring, scope size, proof truthfulness, feature completeness, and quality gates. Quality gates: non-trivial slices/tasks include specific Q3-Q7 coverage where applicable.
45
45
  11. If planning creates structural decisions, append them to `.gsd/DECISIONS.md`.
@@ -50,6 +50,15 @@ export interface FileEditEvidence {
50
50
 
51
51
  export type EvidenceEntry = BashEvidence | FileWriteEvidence | FileEditEvidence;
52
52
 
53
+ const EXECUTION_TOOL_NAMES = new Set([
54
+ "bash",
55
+ "Bash",
56
+ "gsd_exec",
57
+ "gsd_exec_search",
58
+ "mcp__gsd-workflow__gsd_exec",
59
+ "mcp__gsd-workflow__gsd_exec_search",
60
+ ]);
61
+
53
62
  // ─── Module State ───────────────────────────────────────────────────────────
54
63
 
55
64
  let unitEvidence: EvidenceEntry[] = [];
@@ -188,11 +197,11 @@ export function clearEvidenceFromDisk(
188
197
  * Exit codes and output are filled in by recordToolResult after execution.
189
198
  */
190
199
  export function recordToolCall(toolCallId: string, toolName: string, input: Record<string, unknown>): void {
191
- if (toolName === "bash" || toolName === "Bash") {
200
+ if (EXECUTION_TOOL_NAMES.has(toolName)) {
192
201
  unitEvidence.push({
193
202
  kind: "bash",
194
203
  toolCallId,
195
- command: String(input.command ?? ""),
204
+ command: String(input.command ?? input.cmd ?? input.query ?? ""),
196
205
  exitCode: -1,
197
206
  outputSnippet: "",
198
207
  timestamp: Date.now(),
@@ -2556,7 +2556,7 @@ test("autoLoop warns but proceeds for greenfield project (no project files) (#18
2556
2556
  "should not stop with health check failure for greenfield project",
2557
2557
  );
2558
2558
  const greenfieldWarning = notifications.find(
2559
- (n) => n.includes("no recognized project files") && n.includes("greenfield"),
2559
+ (n) => n.includes("no project content yet") && n.includes("greenfield"),
2560
2560
  );
2561
2561
  assert.ok(
2562
2562
  greenfieldWarning,