gsd-pi 2.70.1-dev.ec24142 → 2.71.0-dev.06b86c6
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/README.md +24 -17
- package/dist/cli.js +12 -3
- package/dist/mcp-server.js +6 -6
- package/dist/provider-migrations.d.ts +10 -0
- package/dist/provider-migrations.js +12 -0
- package/dist/resource-loader.js +136 -13
- package/dist/resources/GSD-WORKFLOW.md +1 -1
- package/dist/resources/extensions/gsd/auto-start.js +1 -1
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +1 -1
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +2 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +6 -0
- package/dist/resources/extensions/gsd/commands/context.js +15 -6
- package/dist/resources/extensions/gsd/commands/dispatcher.js +12 -2
- package/dist/resources/extensions/gsd/custom-workflow-engine.js +16 -12
- package/dist/resources/extensions/gsd/dispatch-guard.js +18 -1
- package/dist/resources/extensions/gsd/error-classifier.js +1 -1
- package/dist/resources/extensions/gsd/file-lock.js +60 -0
- package/dist/resources/extensions/gsd/notification-store.js +21 -1
- package/dist/resources/extensions/gsd/notification-widget.js +1 -1
- package/dist/resources/extensions/gsd/pre-execution-checks.js +35 -2
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/discuss.md +2 -0
- package/dist/resources/extensions/gsd/prompts/execute-task.md +20 -19
- package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +2 -0
- package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +2 -0
- package/dist/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/queue.md +3 -2
- package/dist/resources/extensions/gsd/prompts/system.md +1 -0
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -1
- package/dist/resources/extensions/gsd/state.js +234 -332
- package/dist/resources/extensions/gsd/workflow-events.js +25 -13
- package/dist/resources/skills/create-skill/SKILL.md +2 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +7 -7
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +7 -7
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/package.json +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +21 -11
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/src/workflow-tools.test.ts +110 -0
- package/packages/mcp-server/src/workflow-tools.ts +31 -11
- package/packages/pi-ai/dist/providers/amazon-bedrock.js +11 -2
- package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts +4 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +8 -3
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.test.js +44 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +11 -0
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/src/providers/amazon-bedrock.ts +13 -1
- package/packages/pi-ai/src/providers/anthropic-shared.test.ts +55 -1
- package/packages/pi-ai/src/providers/anthropic-shared.ts +14 -3
- package/packages/pi-ai/src/providers/openai-completions.ts +14 -0
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +202 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +19 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +50 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +90 -2
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +57 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +249 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.ts +58 -2
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +96 -2
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +1 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +65 -1
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.js +66 -0
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.js.map +1 -0
- package/packages/pi-tui/dist/components/markdown.d.ts +3 -0
- package/packages/pi-tui/dist/components/markdown.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/markdown.js +17 -1
- package/packages/pi-tui/dist/components/markdown.js.map +1 -1
- package/packages/pi-tui/src/components/__tests__/markdown-maxlines.test.ts +75 -0
- package/packages/pi-tui/src/components/markdown.ts +22 -1
- package/pkg/package.json +1 -1
- package/src/resources/GSD-WORKFLOW.md +1 -1
- package/src/resources/extensions/gsd/auto-start.ts +1 -1
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +1 -1
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +2 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +7 -0
- package/src/resources/extensions/gsd/commands/context.ts +16 -5
- package/src/resources/extensions/gsd/commands/dispatcher.ts +14 -2
- package/src/resources/extensions/gsd/custom-workflow-engine.ts +19 -14
- package/src/resources/extensions/gsd/dispatch-guard.ts +18 -1
- package/src/resources/extensions/gsd/error-classifier.ts +1 -1
- package/src/resources/extensions/gsd/file-lock.ts +59 -0
- package/src/resources/extensions/gsd/notification-store.ts +19 -1
- package/src/resources/extensions/gsd/notification-widget.ts +1 -1
- package/src/resources/extensions/gsd/pre-execution-checks.ts +39 -2
- package/src/resources/extensions/gsd/prompts/complete-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/discuss.md +2 -0
- package/src/resources/extensions/gsd/prompts/execute-task.md +20 -19
- package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +2 -0
- package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +2 -0
- package/src/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/queue.md +3 -2
- package/src/resources/extensions/gsd/prompts/system.md +1 -0
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -1
- package/src/resources/extensions/gsd/state.ts +274 -344
- package/src/resources/extensions/gsd/tests/auto-start-worktree-db-path.test.ts +28 -0
- package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/complete-slice-prompt-task-summary-layout.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +436 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/execute-task-prompt-existing-artifact-guard.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/file-lock.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/gsd-no-project-error.test.ts +73 -0
- package/src/resources/extensions/gsd/tests/notification-store.test.ts +17 -0
- package/src/resources/extensions/gsd/tests/notification-widget.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/validate-milestone-prompt-verification-classes.test.ts +18 -0
- package/src/resources/extensions/gsd/workflow-events.ts +34 -25
- package/src/resources/skills/create-skill/SKILL.md +2 -0
- /package/dist/web/standalone/.next/static/{20e8bFnNjxQJflHNodEve → dYVdRaunb2ZSEA8fjkT-V}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{20e8bFnNjxQJflHNodEve → dYVdRaunb2ZSEA8fjkT-V}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
|
+
|
|
8
|
+
import { withFileLock, withFileLockSync } from "../file-lock.ts";
|
|
9
|
+
|
|
10
|
+
const require = createRequire(import.meta.url);
|
|
11
|
+
|
|
12
|
+
function hasProperLockfile(): boolean {
|
|
13
|
+
try {
|
|
14
|
+
require("proper-lockfile");
|
|
15
|
+
return true;
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
test("withFileLockSync: executes callback when file does not exist", () => {
|
|
22
|
+
const dir = mkdtempSync(join(tmpdir(), "gsd-file-lock-test-"));
|
|
23
|
+
try {
|
|
24
|
+
const missingPath = join(dir, "missing.txt");
|
|
25
|
+
let called = 0;
|
|
26
|
+
const result = withFileLockSync(missingPath, () => {
|
|
27
|
+
called++;
|
|
28
|
+
return "ok";
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
assert.equal(result, "ok");
|
|
32
|
+
assert.equal(called, 1, "callback should execute exactly once");
|
|
33
|
+
} finally {
|
|
34
|
+
rmSync(dir, { recursive: true, force: true });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("withFileLock: executes callback when file does not exist", async () => {
|
|
39
|
+
const dir = mkdtempSync(join(tmpdir(), "gsd-file-lock-test-"));
|
|
40
|
+
try {
|
|
41
|
+
const missingPath = join(dir, "missing.txt");
|
|
42
|
+
let called = 0;
|
|
43
|
+
const result = await withFileLock(missingPath, async () => {
|
|
44
|
+
called++;
|
|
45
|
+
return "ok";
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
assert.equal(result, "ok");
|
|
49
|
+
assert.equal(called, 1, "callback should execute exactly once");
|
|
50
|
+
} finally {
|
|
51
|
+
rmSync(dir, { recursive: true, force: true });
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("withFileLockSync: falls back to unlocked callback on ELOCKED", () => {
|
|
56
|
+
if (!hasProperLockfile() || process.platform === "win32") {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const lockfile = require("proper-lockfile");
|
|
61
|
+
const dir = mkdtempSync(join(tmpdir(), "gsd-file-lock-test-"));
|
|
62
|
+
const filePath = join(dir, "locked.jsonl");
|
|
63
|
+
writeFileSync(filePath, "{}\n", "utf-8");
|
|
64
|
+
|
|
65
|
+
const release = lockfile.lockSync(filePath, { retries: 0, stale: 10000 });
|
|
66
|
+
try {
|
|
67
|
+
let called = 0;
|
|
68
|
+
const result = withFileLockSync(filePath, () => {
|
|
69
|
+
called++;
|
|
70
|
+
return "fallback-ok";
|
|
71
|
+
});
|
|
72
|
+
assert.equal(result, "fallback-ok");
|
|
73
|
+
assert.equal(called, 1, "callback should run even when lock acquisition fails");
|
|
74
|
+
} finally {
|
|
75
|
+
release();
|
|
76
|
+
rmSync(dir, { recursive: true, force: true });
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test("withFileLock: falls back to unlocked callback on ELOCKED", async () => {
|
|
81
|
+
if (!hasProperLockfile() || process.platform === "win32") {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const lockfile = require("proper-lockfile");
|
|
86
|
+
const dir = mkdtempSync(join(tmpdir(), "gsd-file-lock-test-"));
|
|
87
|
+
const filePath = join(dir, "locked.jsonl");
|
|
88
|
+
writeFileSync(filePath, "{}\n", "utf-8");
|
|
89
|
+
|
|
90
|
+
const release = await lockfile.lock(filePath, { retries: 0, stale: 10000 });
|
|
91
|
+
try {
|
|
92
|
+
let called = 0;
|
|
93
|
+
const result = await withFileLock(filePath, async () => {
|
|
94
|
+
called++;
|
|
95
|
+
return "fallback-ok";
|
|
96
|
+
});
|
|
97
|
+
assert.equal(result, "fallback-ok");
|
|
98
|
+
assert.equal(called, 1, "callback should run even when lock acquisition fails");
|
|
99
|
+
} finally {
|
|
100
|
+
await release();
|
|
101
|
+
rmSync(dir, { recursive: true, force: true });
|
|
102
|
+
}
|
|
103
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSDNoProjectError — tests for friendly home-directory error handling.
|
|
3
|
+
*
|
|
4
|
+
* Verifies that GSDNoProjectError is thrown for blocked directories and
|
|
5
|
+
* that the dispatcher catches it with a user-friendly message.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import test from "node:test";
|
|
9
|
+
import assert from "node:assert/strict";
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
import { join, dirname } from "node:path";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
13
|
+
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
|
|
16
|
+
const contextSrc = readFileSync(join(__dirname, "..", "commands", "context.ts"), "utf-8");
|
|
17
|
+
const dispatcherSrc = readFileSync(join(__dirname, "..", "commands", "dispatcher.ts"), "utf-8");
|
|
18
|
+
|
|
19
|
+
// ─── GSDNoProjectError class ──────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
test("GSDNoProjectError class is exported from context.ts", () => {
|
|
22
|
+
assert.ok(
|
|
23
|
+
contextSrc.includes("export class GSDNoProjectError extends Error"),
|
|
24
|
+
"GSDNoProjectError should be an exported Error subclass",
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("GSDNoProjectError sets name property", () => {
|
|
29
|
+
assert.ok(
|
|
30
|
+
contextSrc.includes('this.name = "GSDNoProjectError"'),
|
|
31
|
+
"GSDNoProjectError should set its name for instanceof checks",
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// ─── projectRoot blocked directory handling ───────────────────────────────
|
|
36
|
+
|
|
37
|
+
test("projectRoot uses validateDirectory and checks for blocked severity", () => {
|
|
38
|
+
assert.ok(
|
|
39
|
+
contextSrc.includes("validateDirectory(pathToCheck)"),
|
|
40
|
+
"projectRoot should call validateDirectory",
|
|
41
|
+
);
|
|
42
|
+
assert.ok(
|
|
43
|
+
contextSrc.includes('result.severity === "blocked"'),
|
|
44
|
+
"projectRoot should check for blocked severity",
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("projectRoot throws GSDNoProjectError on blocked directory", () => {
|
|
49
|
+
assert.ok(
|
|
50
|
+
contextSrc.includes("throw new GSDNoProjectError"),
|
|
51
|
+
"projectRoot should throw GSDNoProjectError when directory is blocked",
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// ─── Dispatcher catch ─────────────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
test("dispatcher catches GSDNoProjectError with user-friendly message", () => {
|
|
58
|
+
assert.ok(
|
|
59
|
+
dispatcherSrc.includes("err instanceof GSDNoProjectError"),
|
|
60
|
+
"dispatcher should catch GSDNoProjectError specifically",
|
|
61
|
+
);
|
|
62
|
+
assert.ok(
|
|
63
|
+
dispatcherSrc.includes("cd"),
|
|
64
|
+
"error message should suggest cd-ing into a project directory",
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("dispatcher re-throws non-GSDNoProjectError exceptions", () => {
|
|
69
|
+
assert.ok(
|
|
70
|
+
dispatcherSrc.includes("throw err"),
|
|
71
|
+
"dispatcher should re-throw unexpected errors",
|
|
72
|
+
);
|
|
73
|
+
});
|
|
@@ -187,6 +187,23 @@ describe("notification-store", () => {
|
|
|
187
187
|
assert.ok(!entries.some((e) => e.message === "suppressed"));
|
|
188
188
|
});
|
|
189
189
|
|
|
190
|
+
test("appendNotification suppresses identical messages within the dedup window", (t) => {
|
|
191
|
+
initNotificationStore(tmp);
|
|
192
|
+
let now = 1_000;
|
|
193
|
+
t.mock.method(Date, "now", () => now);
|
|
194
|
+
|
|
195
|
+
appendNotification("same", "warning");
|
|
196
|
+
now += 1_000;
|
|
197
|
+
appendNotification("same", "warning");
|
|
198
|
+
now += 31_000;
|
|
199
|
+
appendNotification("same", "warning");
|
|
200
|
+
|
|
201
|
+
const entries = readNotifications();
|
|
202
|
+
assert.equal(entries.length, 2);
|
|
203
|
+
assert.equal(entries[0].message, "same");
|
|
204
|
+
assert.equal(entries[1].message, "same");
|
|
205
|
+
});
|
|
206
|
+
|
|
190
207
|
test("suppressPersistence is ref-counted", () => {
|
|
191
208
|
initNotificationStore(tmp);
|
|
192
209
|
suppressPersistence();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { mkdtempSync, mkdirSync, rmSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
|
|
7
|
+
import { initNotificationStore, appendNotification, _resetNotificationStore } from "../notification-store.js";
|
|
8
|
+
import { buildNotificationWidgetLines } from "../notification-widget.js";
|
|
9
|
+
|
|
10
|
+
test("buildNotificationWidgetLines includes slash-command fallback for unread notifications", () => {
|
|
11
|
+
const tmp = mkdtempSync(join(tmpdir(), "gsd-notification-widget-"));
|
|
12
|
+
try {
|
|
13
|
+
mkdirSync(join(tmp, ".gsd"), { recursive: true });
|
|
14
|
+
_resetNotificationStore();
|
|
15
|
+
initNotificationStore(tmp);
|
|
16
|
+
appendNotification("Need attention", "warning");
|
|
17
|
+
|
|
18
|
+
const lines = buildNotificationWidgetLines();
|
|
19
|
+
assert.equal(lines.length, 1);
|
|
20
|
+
assert.match(lines[0]!, /\/gsd notifications/);
|
|
21
|
+
} finally {
|
|
22
|
+
_resetNotificationStore();
|
|
23
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
24
|
+
}
|
|
25
|
+
});
|
|
@@ -1107,6 +1107,38 @@ describe("checkTaskOrdering false positive regression (#3677)", () => {
|
|
|
1107
1107
|
assert.equal(results[0].target, "`later.ts` — needed first");
|
|
1108
1108
|
assert.ok(results[0].message.includes("sequence violation"));
|
|
1109
1109
|
});
|
|
1110
|
+
|
|
1111
|
+
test("existing on-disk files do not trigger ordering violations just because a later task modifies them", () => {
|
|
1112
|
+
const tempDir = join(tmpdir(), `pre-exec-ordering-existing-file-${Date.now()}`);
|
|
1113
|
+
const existingFile = "frontend/src/__tests__/ProcurementPage29.test.tsx";
|
|
1114
|
+
|
|
1115
|
+
mkdirSync(join(tempDir, "frontend", "src", "__tests__"), { recursive: true });
|
|
1116
|
+
writeFileSync(join(tempDir, existingFile), "// existing file");
|
|
1117
|
+
|
|
1118
|
+
try {
|
|
1119
|
+
const tasks = [
|
|
1120
|
+
createTask({
|
|
1121
|
+
id: "T01",
|
|
1122
|
+
sequence: 0,
|
|
1123
|
+
files: [],
|
|
1124
|
+
inputs: ["`frontend/src/__tests__/ProcurementPage29.test.tsx` — contains matchMedia stub to remove"],
|
|
1125
|
+
expected_output: [],
|
|
1126
|
+
}),
|
|
1127
|
+
createTask({
|
|
1128
|
+
id: "T03",
|
|
1129
|
+
sequence: 2,
|
|
1130
|
+
files: [],
|
|
1131
|
+
inputs: [],
|
|
1132
|
+
expected_output: ["frontend/src/__tests__/ProcurementPage29.test.tsx"],
|
|
1133
|
+
}),
|
|
1134
|
+
];
|
|
1135
|
+
|
|
1136
|
+
const results = checkTaskOrdering(tasks, tempDir);
|
|
1137
|
+
assert.equal(results.length, 0, "Pre-existing files should not be treated as created by later tasks");
|
|
1138
|
+
} finally {
|
|
1139
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1110
1142
|
});
|
|
1111
1143
|
|
|
1112
1144
|
// ─── checkFilePathConsistency additional edge cases ──────────────────────────
|
|
@@ -1175,6 +1207,23 @@ describe("checkFilePathConsistency additional edge cases", () => {
|
|
|
1175
1207
|
assert.equal(results![0].blocking, true);
|
|
1176
1208
|
});
|
|
1177
1209
|
|
|
1210
|
+
test("multi-word prose inputs are ignored by path consistency checks", () => {
|
|
1211
|
+
const tasks = [
|
|
1212
|
+
createTask({
|
|
1213
|
+
id: "T01",
|
|
1214
|
+
files: [],
|
|
1215
|
+
inputs: [
|
|
1216
|
+
"Current WIZARD_PRODUCTS enum",
|
|
1217
|
+
"Existing test patterns in wizard.test.ts",
|
|
1218
|
+
],
|
|
1219
|
+
expected_output: [],
|
|
1220
|
+
}),
|
|
1221
|
+
];
|
|
1222
|
+
|
|
1223
|
+
const results = checkFilePathConsistency(tasks, "/tmp");
|
|
1224
|
+
assert.equal(results.length, 0, "Prose planning hints should not be treated as missing file paths");
|
|
1225
|
+
});
|
|
1226
|
+
|
|
1178
1227
|
test("empty inputs array produces no results", () => {
|
|
1179
1228
|
// A task with no inputs and only files should produce zero results from
|
|
1180
1229
|
// consistency check — files are not checked (#3626).
|
|
@@ -42,9 +42,19 @@ test("system prompt references CODEBASE.md and /gsd codebase", () => {
|
|
|
42
42
|
assert.match(prompt, /auto-refreshes it when tracked files change/i);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
+
test("system prompt hard rules forbid fabricating user responses", () => {
|
|
46
|
+
const prompt = readPrompt("system");
|
|
47
|
+
assert.match(prompt, /never fabricate, simulate, or role-play user responses/i);
|
|
48
|
+
assert.match(prompt, /never generate markers like `?\[User\]`?, `?\[Human\]`?, `?User:`?/i);
|
|
49
|
+
assert.match(prompt, /ask one question round \(1-3 questions\), then stop and wait for the user's actual response/i);
|
|
50
|
+
assert.match(prompt, /ask_user_questions.*only valid structured user input/i);
|
|
51
|
+
});
|
|
52
|
+
|
|
45
53
|
test("discuss prompt allows implementation questions when they materially matter", () => {
|
|
46
54
|
const prompt = readPrompt("discuss");
|
|
47
55
|
assert.match(prompt, /Lead with experience, but ask implementation when it materially matters/i);
|
|
56
|
+
assert.match(prompt, /Never fabricate, simulate, or role-play user responses/i);
|
|
57
|
+
assert.match(prompt, /Ask one question round \(1-3 questions\) per turn, then stop and wait for the user's actual response/i);
|
|
48
58
|
assert.match(prompt, /one gate, not two/i);
|
|
49
59
|
assert.doesNotMatch(prompt, /Questions must be about the experience, not the implementation/i);
|
|
50
60
|
});
|
|
@@ -56,6 +66,8 @@ test("guided discussion prompts avoid wrap-up prompts after every round", () =>
|
|
|
56
66
|
assert.match(slicePrompt, /Do \*\*not\*\* ask a meta "ready to wrap up\?" question after every round/i);
|
|
57
67
|
assert.doesNotMatch(milestonePrompt, /I think I have a solid picture of this milestone\. Ready to wrap up/i);
|
|
58
68
|
assert.doesNotMatch(slicePrompt, /I think I have a solid picture of this slice\. Ready to wrap up/i);
|
|
69
|
+
assert.match(milestonePrompt, /Never fabricate or simulate user input/i);
|
|
70
|
+
assert.match(slicePrompt, /Never fabricate or simulate user input/i);
|
|
59
71
|
});
|
|
60
72
|
|
|
61
73
|
test("guided milestone discussion scopes depth verification to the milestone id", () => {
|
|
@@ -64,6 +76,13 @@ test("guided milestone discussion scopes depth verification to the milestone id"
|
|
|
64
76
|
assert.doesNotMatch(prompt, /depth_verification_confirm" — this enables the write-gate downstream/i, "legacy global depth gate wording should be gone");
|
|
65
77
|
});
|
|
66
78
|
|
|
79
|
+
test("queue prompt requires waiting for user response between rounds", () => {
|
|
80
|
+
const prompt = readPrompt("queue");
|
|
81
|
+
assert.match(prompt, /Never fabricate or simulate user input during this discussion/i);
|
|
82
|
+
assert.match(prompt, /Ask 1-3 questions per round, then wait for the user's response before asking the next round\./i);
|
|
83
|
+
assert.doesNotMatch(prompt, /treat that as permission to continue/i);
|
|
84
|
+
});
|
|
85
|
+
|
|
67
86
|
test("guided-resume-task prompt preserves recovery state until work is superseded", () => {
|
|
68
87
|
const prompt = readPrompt("guided-resume-task");
|
|
69
88
|
assert.match(prompt, /Do \*\*not\*\* delete the continue file immediately/i);
|
|
@@ -101,6 +101,13 @@ test("classifyError detects quota exceeded as permanent", () => {
|
|
|
101
101
|
assert.ok(!isTransient(result));
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
+
test("classifyError treats plain 'Connection error.' as transient connection failure (#3594)", () => {
|
|
105
|
+
const result = classifyError("Connection error.");
|
|
106
|
+
assert.ok(isTransient(result));
|
|
107
|
+
assert.equal(result.kind, "connection");
|
|
108
|
+
assert.ok("retryAfterMs" in result && result.retryAfterMs === 15_000);
|
|
109
|
+
});
|
|
110
|
+
|
|
104
111
|
test("classifyError treats unknown error as not transient", () => {
|
|
105
112
|
const result = classifyError("something went wrong");
|
|
106
113
|
assert.ok(!isTransient(result));
|
|
@@ -61,6 +61,13 @@ describe("#2883: isToolInvocationError classification", () => {
|
|
|
61
61
|
);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
+
test("detects Node v18+ JSON parse variant with property-value text", () => {
|
|
65
|
+
assert.equal(
|
|
66
|
+
isToolInvocationError("Expected ',' or '}' after property value in JSON at position 4096"),
|
|
67
|
+
true,
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
64
71
|
test("detects Unexpected end of JSON input", () => {
|
|
65
72
|
assert.equal(
|
|
66
73
|
isToolInvocationError("Unexpected end of JSON input"),
|
package/src/resources/extensions/gsd/tests/validate-milestone-prompt-verification-classes.test.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
const promptPath = join(process.cwd(), "src/resources/extensions/gsd/prompts/validate-milestone.md");
|
|
7
|
+
const prompt = readFileSync(promptPath, "utf-8");
|
|
8
|
+
|
|
9
|
+
test("validate-milestone reviewer C requires canonical verification class names", () => {
|
|
10
|
+
assert.match(prompt, /\*\*Reviewer C[\s\S]*Verification Classes/i);
|
|
11
|
+
assert.match(prompt, /exact class names [`']?Contract[`']?, [`']?Integration[`']?, [`']?Operational[`']?, and [`']?UAT[`']?/i);
|
|
12
|
+
assert.match(prompt, /If no verification classes were planned, say that explicitly/i);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test("validate-milestone prompt routes verification class analysis into verificationClasses", () => {
|
|
16
|
+
assert.match(prompt, /pass it in `verificationClasses`/i);
|
|
17
|
+
assert.match(prompt, /Extract the `Verification Classes` subsection from Reviewer C and pass it verbatim in `verificationClasses`/);
|
|
18
|
+
});
|
|
@@ -2,6 +2,7 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
2
2
|
import { appendFileSync, readFileSync, existsSync, mkdirSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { atomicWriteSync } from "./atomic-write.js";
|
|
5
|
+
import { withFileLockSync } from "./file-lock.js";
|
|
5
6
|
import { logWarning } from "./workflow-logger.js";
|
|
6
7
|
|
|
7
8
|
// ─── Session ID ───────────────────────────────────────────────────────────
|
|
@@ -127,31 +128,39 @@ export function compactMilestoneEvents(
|
|
|
127
128
|
const logPath = join(basePath, ".gsd", "event-log.jsonl");
|
|
128
129
|
const archivePath = join(basePath, ".gsd", `event-log-${milestoneId}.jsonl.archived`);
|
|
129
130
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
131
|
+
return withFileLockSync(logPath, () => {
|
|
132
|
+
const allEvents = readEvents(logPath);
|
|
133
|
+
|
|
134
|
+
// Single-pass partition to halve the work (per reviewer agent)
|
|
135
|
+
const toArchive: WorkflowEvent[] = [];
|
|
136
|
+
const remaining: WorkflowEvent[] = [];
|
|
137
|
+
|
|
138
|
+
for (const e of allEvents) {
|
|
139
|
+
if ((e.params as { milestoneId?: string }).milestoneId === milestoneId) {
|
|
140
|
+
toArchive.push(e);
|
|
141
|
+
} else {
|
|
142
|
+
remaining.push(e);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
137
145
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
146
|
+
if (toArchive.length === 0) {
|
|
147
|
+
return { archived: 0 };
|
|
148
|
+
}
|
|
141
149
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
// Write archived events to .jsonl.archived file (crash-safe)
|
|
151
|
+
atomicWriteSync(
|
|
152
|
+
archivePath,
|
|
153
|
+
toArchive.map((e) => JSON.stringify(e)).join("\n") + "\n",
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
// Truncate active log to remaining events only
|
|
157
|
+
atomicWriteSync(
|
|
158
|
+
logPath,
|
|
159
|
+
remaining.length > 0
|
|
160
|
+
? remaining.map((e) => JSON.stringify(e)).join("\n") + "\n"
|
|
161
|
+
: "",
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
return { archived: toArchive.length };
|
|
165
|
+
});
|
|
157
166
|
}
|
|
@@ -78,6 +78,8 @@ Based on the user's message, route directly to the appropriate workflow:
|
|
|
78
78
|
**If user intent is unclear, ask minimal clarifying questions:**
|
|
79
79
|
- "Create a MIDI skill" → "Task-execution skill (does MIDI tasks) or domain expertise (complete MIDI knowledge base)?"
|
|
80
80
|
- "Work on my skill" → "Which skill? What do you want to do with it?"
|
|
81
|
+
- Ask one clarifying question round at a time, then wait for the user's actual response before asking another.
|
|
82
|
+
- Never fabricate or simulate user responses while clarifying (for example, fake `[User]` markers or imagined answers).
|
|
81
83
|
|
|
82
84
|
Then proceed directly to the workflow.
|
|
83
85
|
</routing>
|
|
File without changes
|
|
File without changes
|