gsd-pi 2.68.0 → 2.68.1-dev.abc8f2b
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 +66 -70
- package/dist/resources/extensions/gsd/auto-model-selection.js +27 -1
- package/dist/resources/extensions/gsd/auto.js +8 -2
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +7 -0
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +1 -5
- package/dist/resources/extensions/gsd/guided-flow.js +25 -70
- package/dist/resources/extensions/gsd/model-router.js +85 -2
- package/dist/resources/extensions/gsd/prompts/discuss.md +2 -0
- package/dist/resources/extensions/gsd/templates/context.md +34 -2
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +12 -12
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/required-server-files.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- 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/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- 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 +3 -3
- 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/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- 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 +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +12 -12
- package/dist/web/standalone/.next/server/chunks/63.js +3 -3
- package/dist/web/standalone/.next/server/chunks/6897.js +1 -1
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware.js +2 -2
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +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/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-f1e30ab6bb269149.js +1 -0
- package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
- package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
- package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
- package/dist/web/standalone/server.js +1 -1
- package/package.json +1 -1
- package/packages/pi-ai/dist/index.d.ts +3 -0
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +2 -0
- package/packages/pi-ai/dist/index.js.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.js +2 -2
- package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +2 -2
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js +2 -2
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/mistral.js +2 -2
- package/packages/pi-ai/dist/providers/mistral.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +2 -2
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses-shared.js +2 -2
- package/packages/pi-ai/dist/providers/openai-responses-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/provider-capabilities.d.ts +59 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.js +173 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.js.map +1 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.test.js +132 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/transform-messages-report.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/transform-messages-report.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/transform-messages-report.test.js +172 -0
- package/packages/pi-ai/dist/providers/transform-messages-report.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/transform-messages.d.ts +34 -1
- package/packages/pi-ai/dist/providers/transform-messages.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/transform-messages.js +73 -2
- package/packages/pi-ai/dist/providers/transform-messages.js.map +1 -1
- package/packages/pi-ai/src/index.ts +3 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.ts +2 -2
- package/packages/pi-ai/src/providers/anthropic-shared.ts +2 -2
- package/packages/pi-ai/src/providers/google-shared.ts +2 -2
- package/packages/pi-ai/src/providers/mistral.ts +2 -2
- package/packages/pi-ai/src/providers/openai-completions.ts +2 -2
- package/packages/pi-ai/src/providers/openai-responses-shared.ts +2 -2
- package/packages/pi-ai/src/providers/provider-capabilities.test.ts +174 -0
- package/packages/pi-ai/src/providers/provider-capabilities.ts +215 -0
- package/packages/pi-ai/src/providers/transform-messages-report.test.ts +189 -0
- package/packages/pi-ai/src/providers/transform-messages.ts +94 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +10 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +2 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +15 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +41 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.js +1 -0
- package/packages/pi-coding-agent/dist/core/tools/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/tool-compatibility-registry.d.ts +27 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-compatibility-registry.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-compatibility-registry.js +69 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-compatibility-registry.js.map +1 -0
- package/packages/pi-coding-agent/dist/index.d.ts +2 -2
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +3 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/extensions/index.ts +4 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +11 -1
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +18 -0
- package/packages/pi-coding-agent/src/core/extensions/types.ts +45 -0
- package/packages/pi-coding-agent/src/core/tools/index.ts +7 -0
- package/packages/pi-coding-agent/src/core/tools/tool-compatibility-registry.ts +83 -0
- package/packages/pi-coding-agent/src/index.ts +9 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/gsd/auto-model-selection.ts +36 -4
- package/src/resources/extensions/gsd/auto.ts +8 -2
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +8 -0
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +1 -5
- package/src/resources/extensions/gsd/guided-flow.ts +22 -84
- package/src/resources/extensions/gsd/model-router.ts +117 -10
- package/src/resources/extensions/gsd/preferences-types.ts +3 -1
- package/src/resources/extensions/gsd/prompts/discuss.md +2 -0
- package/src/resources/extensions/gsd/templates/context.md +34 -2
- package/src/resources/extensions/gsd/tests/capability-router.test.ts +31 -7
- package/src/resources/extensions/gsd/tests/discord-invite-links.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/model-router.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/resource-loader-import-path.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/tool-compatibility.test.ts +199 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +13 -16
- package/dist/resources/extensions/gsd/prompt-validation.js +0 -67
- package/dist/resources/extensions/gsd/prompts/discuss-prepared.md +0 -424
- package/dist/resources/extensions/gsd/templates/context-enhanced.md +0 -138
- package/dist/web/standalone/.next/static/chunks/app/page-7115e62689b5fd84.js +0 -1
- package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
- package/src/resources/extensions/gsd/prompt-validation.ts +0 -88
- package/src/resources/extensions/gsd/prompts/discuss-prepared.md +0 -424
- package/src/resources/extensions/gsd/templates/context-enhanced.md +0 -138
- package/src/resources/extensions/gsd/tests/adversarial-review-fixes.test.ts +0 -223
- package/src/resources/extensions/gsd/tests/integration/test-isolation.ts +0 -53
- package/src/resources/extensions/gsd/tests/integration-prepared-discussion.test.ts +0 -525
- package/src/resources/extensions/gsd/tests/preparation.test.ts +0 -1211
- package/src/resources/extensions/gsd/tests/prompt-builder.test.ts +0 -669
- /package/dist/web/standalone/.next/static/{ka3ShQTakcliYL-EXRRb6 → 3HMOXcBoys84RYd2F8a79}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{ka3ShQTakcliYL-EXRRb6 → 3HMOXcBoys84RYd2F8a79}/_ssgManifest.js +0 -0
|
@@ -1,525 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration tests for the prepared discussion system.
|
|
3
|
-
*
|
|
4
|
-
* Exercises the full preparation pipeline against the real GSD-2 codebase:
|
|
5
|
-
* - runPreparation() produces valid briefs
|
|
6
|
-
* - TypeScript is detected as primary language
|
|
7
|
-
* - Module structure includes top-level directories
|
|
8
|
-
* - Completes within R112 timing requirement (<60s)
|
|
9
|
-
* - prepareAndBuildDiscussPrompt() uses discuss-prepared template when enabled
|
|
10
|
-
* - Fallback to standard prompt when preparation is disabled
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import test from "node:test";
|
|
14
|
-
import assert from "node:assert/strict";
|
|
15
|
-
import { join } from "node:path";
|
|
16
|
-
import { existsSync } from "node:fs";
|
|
17
|
-
import {
|
|
18
|
-
runPreparation,
|
|
19
|
-
formatCodebaseBrief,
|
|
20
|
-
formatPriorContextBrief,
|
|
21
|
-
formatEcosystemBrief,
|
|
22
|
-
type PreparationUIContext,
|
|
23
|
-
type PreparationPreferences,
|
|
24
|
-
type PreparationResult,
|
|
25
|
-
} from "../preparation.ts";
|
|
26
|
-
import { validateEnhancedContext } from "../prompt-validation.ts";
|
|
27
|
-
import { getLastPreparationResult, clearPreparationResult } from "../guided-flow.ts";
|
|
28
|
-
|
|
29
|
-
// ─── Test Helpers ───────────────────────────────────────────────────────────────
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Mock UI context that captures notifications for testing.
|
|
33
|
-
* Follows the pattern from preparation.test.ts.
|
|
34
|
-
*/
|
|
35
|
-
function createMockUI(): PreparationUIContext & { notifications: Array<{ message: string; type?: string }> } {
|
|
36
|
-
const notifications: Array<{ message: string; type?: string }> = [];
|
|
37
|
-
return {
|
|
38
|
-
notifications,
|
|
39
|
-
notify(message: string, type?: "info" | "warning" | "error" | "success") {
|
|
40
|
-
notifications.push({ message, type });
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Get the GSD extension source directory for integration testing.
|
|
47
|
-
* This is the real codebase we'll analyze.
|
|
48
|
-
*/
|
|
49
|
-
function getGsdExtensionDir(): string {
|
|
50
|
-
// Navigate from tests/ up to gsd/ directory
|
|
51
|
-
return join(import.meta.dirname, "..");
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Get the GSD-2 project root for full codebase analysis.
|
|
56
|
-
*/
|
|
57
|
-
function getProjectRoot(): string {
|
|
58
|
-
// Navigate from tests/ up to the project root
|
|
59
|
-
// tests/ -> gsd/ -> extensions/ -> resources/ -> src/ -> gsd-2/
|
|
60
|
-
return join(import.meta.dirname, "..", "..", "..", "..", "..");
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// ─── R111 Validation: runPreparation against real codebase ──────────────────────
|
|
64
|
-
|
|
65
|
-
test("R111: runPreparation() produces valid codebase brief for GSD extension", async (t) => {
|
|
66
|
-
const dir = getGsdExtensionDir();
|
|
67
|
-
const ui = createMockUI();
|
|
68
|
-
const prefs: PreparationPreferences = {
|
|
69
|
-
discuss_preparation: true,
|
|
70
|
-
discuss_web_research: false, // Skip web research to avoid API key requirement
|
|
71
|
-
discuss_depth: "standard",
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const result = await runPreparation(dir, ui, prefs);
|
|
75
|
-
|
|
76
|
-
// Verify preparation completed successfully
|
|
77
|
-
assert.equal(result.enabled, true, "preparation should be enabled");
|
|
78
|
-
assert.ok(result.codebase, "should have codebase brief");
|
|
79
|
-
assert.ok(result.codebaseBrief, "should have formatted codebase brief");
|
|
80
|
-
|
|
81
|
-
// Verify TypeScript is detected as primary language
|
|
82
|
-
assert.equal(
|
|
83
|
-
result.codebase.techStack.primaryLanguage,
|
|
84
|
-
"javascript/typescript",
|
|
85
|
-
"should detect TypeScript as primary language",
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
// Verify module structure includes top-level directories
|
|
89
|
-
const topLevelDirs = result.codebase.moduleStructure.topLevelDirs;
|
|
90
|
-
assert.ok(topLevelDirs.length > 0, "should detect top-level directories");
|
|
91
|
-
|
|
92
|
-
// Common directories in the GSD extension
|
|
93
|
-
const expectedDirs = ["tests", "prompts", "templates", "migrate"];
|
|
94
|
-
const foundExpected = expectedDirs.filter(d => topLevelDirs.includes(d));
|
|
95
|
-
assert.ok(
|
|
96
|
-
foundExpected.length >= 2,
|
|
97
|
-
`should detect common directories, found: ${topLevelDirs.join(", ")}`,
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
// Verify sampled files exist
|
|
101
|
-
assert.ok(result.codebase.sampledFiles.length > 0, "should sample source files");
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test("R111: runPreparation() produces valid prior context brief", async (t) => {
|
|
105
|
-
const dir = getGsdExtensionDir();
|
|
106
|
-
const ui = createMockUI();
|
|
107
|
-
const prefs: PreparationPreferences = {
|
|
108
|
-
discuss_preparation: true,
|
|
109
|
-
discuss_web_research: false,
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const result = await runPreparation(dir, ui, prefs);
|
|
113
|
-
|
|
114
|
-
// Verify prior context brief structure
|
|
115
|
-
assert.ok(result.priorContext, "should have prior context");
|
|
116
|
-
assert.ok(result.priorContextBrief, "should have formatted prior context brief");
|
|
117
|
-
|
|
118
|
-
// Prior context aggregates decisions, requirements, knowledge, summaries
|
|
119
|
-
assert.ok("decisions" in result.priorContext, "should have decisions");
|
|
120
|
-
assert.ok("requirements" in result.priorContext, "should have requirements");
|
|
121
|
-
assert.ok("knowledge" in result.priorContext, "should have knowledge");
|
|
122
|
-
assert.ok("summaries" in result.priorContext, "should have summaries");
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
test("R111: runPreparation() produces valid ecosystem brief (skipped without API key)", async (t) => {
|
|
126
|
-
const dir = getGsdExtensionDir();
|
|
127
|
-
const ui = createMockUI();
|
|
128
|
-
const prefs: PreparationPreferences = {
|
|
129
|
-
discuss_preparation: true,
|
|
130
|
-
discuss_web_research: false, // Explicitly disable
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const result = await runPreparation(dir, ui, prefs);
|
|
134
|
-
|
|
135
|
-
// Verify ecosystem brief structure
|
|
136
|
-
assert.ok(result.ecosystem, "should have ecosystem brief");
|
|
137
|
-
assert.ok(result.ecosystemBrief, "should have formatted ecosystem brief");
|
|
138
|
-
assert.equal(result.ecosystem.available, false, "ecosystem should be unavailable when web research disabled");
|
|
139
|
-
assert.ok(result.ecosystem.skippedReason, "should have skip reason");
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
test("R112: runPreparation() completes within 60s requirement", async (t) => {
|
|
143
|
-
const dir = getGsdExtensionDir();
|
|
144
|
-
const prefs: PreparationPreferences = {
|
|
145
|
-
discuss_preparation: true,
|
|
146
|
-
discuss_web_research: false,
|
|
147
|
-
discuss_depth: "standard",
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const startTime = performance.now();
|
|
151
|
-
const result = await runPreparation(dir, null, prefs);
|
|
152
|
-
const elapsed = performance.now() - startTime;
|
|
153
|
-
|
|
154
|
-
// R112 requirement: preparation must complete within 60 seconds
|
|
155
|
-
assert.ok(result.durationMs < 60000, `should complete within 60s, took ${result.durationMs}ms`);
|
|
156
|
-
assert.ok(elapsed < 60000, `wall-clock time should be under 60s, was ${elapsed}ms`);
|
|
157
|
-
|
|
158
|
-
// Should be much faster for a local directory analysis
|
|
159
|
-
assert.ok(result.durationMs < 10000, `should typically complete within 10s, took ${result.durationMs}ms`);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
// ─── Codebase Pattern Detection ─────────────────────────────────────────────────
|
|
163
|
-
|
|
164
|
-
test("runPreparation() detects code patterns from GSD extension", async (t) => {
|
|
165
|
-
const dir = getGsdExtensionDir();
|
|
166
|
-
const prefs: PreparationPreferences = {
|
|
167
|
-
discuss_preparation: true,
|
|
168
|
-
discuss_web_research: false,
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
const result = await runPreparation(dir, null, prefs);
|
|
172
|
-
|
|
173
|
-
// The GSD extension uses async/await extensively
|
|
174
|
-
assert.ok(
|
|
175
|
-
result.codebase.patterns.asyncStyle === "async/await" || result.codebase.patterns.asyncStyle === "mixed",
|
|
176
|
-
`should detect async/await or mixed, got ${result.codebase.patterns.asyncStyle}`,
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
// The GSD extension uses try/catch for error handling
|
|
180
|
-
assert.ok(
|
|
181
|
-
result.codebase.patterns.errorHandling === "try/catch" || result.codebase.patterns.errorHandling === "mixed",
|
|
182
|
-
`should detect try/catch or mixed, got ${result.codebase.patterns.errorHandling}`,
|
|
183
|
-
);
|
|
184
|
-
|
|
185
|
-
// TypeScript uses camelCase or mixed naming
|
|
186
|
-
assert.ok(
|
|
187
|
-
result.codebase.patterns.namingConvention === "camelCase" || result.codebase.patterns.namingConvention === "mixed",
|
|
188
|
-
`should detect camelCase or mixed, got ${result.codebase.patterns.namingConvention}`,
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
// Evidence should be populated
|
|
192
|
-
assert.ok(result.codebase.patterns.evidence.asyncStyle.length > 0, "should have async style evidence");
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
test("runPreparation() samples TypeScript files from src/ or project root", async (t) => {
|
|
196
|
-
const dir = getGsdExtensionDir();
|
|
197
|
-
const prefs: PreparationPreferences = {
|
|
198
|
-
discuss_preparation: true,
|
|
199
|
-
discuss_web_research: false,
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const result = await runPreparation(dir, null, prefs);
|
|
203
|
-
|
|
204
|
-
// Should sample TypeScript files
|
|
205
|
-
const tsFiles = result.codebase.sampledFiles.filter(
|
|
206
|
-
f => f.endsWith(".ts") || f.endsWith(".tsx"),
|
|
207
|
-
);
|
|
208
|
-
assert.ok(tsFiles.length > 0, "should sample TypeScript files");
|
|
209
|
-
|
|
210
|
-
// Should exclude test files
|
|
211
|
-
const testFiles = result.codebase.sampledFiles.filter(
|
|
212
|
-
f => f.includes(".test.") || f.includes(".spec."),
|
|
213
|
-
);
|
|
214
|
-
assert.equal(testFiles.length, 0, "should not sample test files");
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
// ─── Brief Formatting ───────────────────────────────────────────────────────────
|
|
218
|
-
|
|
219
|
-
test("formatCodebaseBrief() produces LLM-readable markdown", async (t) => {
|
|
220
|
-
const dir = getGsdExtensionDir();
|
|
221
|
-
const prefs: PreparationPreferences = {
|
|
222
|
-
discuss_preparation: true,
|
|
223
|
-
discuss_web_research: false,
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
const result = await runPreparation(dir, null, prefs);
|
|
227
|
-
const formatted = formatCodebaseBrief(result.codebase);
|
|
228
|
-
|
|
229
|
-
// Should contain expected sections
|
|
230
|
-
assert.ok(formatted.includes("## Tech Stack"), "should have Tech Stack section");
|
|
231
|
-
assert.ok(formatted.includes("## Module Structure"), "should have Module Structure section");
|
|
232
|
-
assert.ok(formatted.includes("## Code Patterns"), "should have Code Patterns section");
|
|
233
|
-
|
|
234
|
-
// Should contain detected tech
|
|
235
|
-
assert.ok(formatted.includes("javascript/typescript"), "should include detected language");
|
|
236
|
-
|
|
237
|
-
// Should be within character limit
|
|
238
|
-
assert.ok(formatted.length <= 3000, `should cap at 3000 chars, got ${formatted.length}`);
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
test("formatPriorContextBrief() produces structured prior context output", async (t) => {
|
|
242
|
-
const dir = getGsdExtensionDir();
|
|
243
|
-
const prefs: PreparationPreferences = {
|
|
244
|
-
discuss_preparation: true,
|
|
245
|
-
discuss_web_research: false,
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
const result = await runPreparation(dir, null, prefs);
|
|
249
|
-
const formatted = formatPriorContextBrief(result.priorContext);
|
|
250
|
-
|
|
251
|
-
// Should contain expected sections
|
|
252
|
-
assert.ok(formatted.includes("## Prior Decisions"), "should have Prior Decisions section");
|
|
253
|
-
assert.ok(formatted.includes("## Prior Requirements"), "should have Prior Requirements section");
|
|
254
|
-
assert.ok(formatted.includes("## Prior Knowledge"), "should have Prior Knowledge section");
|
|
255
|
-
assert.ok(formatted.includes("## Prior Milestone Summaries"), "should have Prior Milestone Summaries section");
|
|
256
|
-
|
|
257
|
-
// Should be within character limit
|
|
258
|
-
assert.ok(formatted.length <= 6000, `should cap at 6000 chars, got ${formatted.length}`);
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
test("formatEcosystemBrief() returns simplified message (research happens during discussion)", async (t) => {
|
|
262
|
-
const dir = getGsdExtensionDir();
|
|
263
|
-
const prefs: PreparationPreferences = {
|
|
264
|
-
discuss_preparation: true,
|
|
265
|
-
discuss_web_research: false,
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
const result = await runPreparation(dir, null, prefs);
|
|
269
|
-
const formatted = formatEcosystemBrief(result.ecosystem);
|
|
270
|
-
|
|
271
|
-
// Should contain section header
|
|
272
|
-
assert.ok(formatted.includes("## Ecosystem Research"), "should have Ecosystem Research section");
|
|
273
|
-
|
|
274
|
-
// Should indicate research happens during discussion
|
|
275
|
-
assert.ok(formatted.includes("during the discussion"), "should mention research happens during discussion");
|
|
276
|
-
assert.ok(formatted.includes("web search tools"), "should mention web search tools");
|
|
277
|
-
|
|
278
|
-
// Should be within character limit
|
|
279
|
-
assert.ok(formatted.length <= 4000, `should cap at 4000 chars, got ${formatted.length}`);
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
// ─── Preparation Result Storage ─────────────────────────────────────────────────
|
|
283
|
-
|
|
284
|
-
test("getLastPreparationResult() returns null initially", async (t) => {
|
|
285
|
-
// Clear any existing state
|
|
286
|
-
clearPreparationResult();
|
|
287
|
-
|
|
288
|
-
const result = getLastPreparationResult();
|
|
289
|
-
assert.equal(result, null, "should return null when no preparation has run");
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
test("clearPreparationResult() clears stored result", async (t) => {
|
|
293
|
-
// This test verifies the clear function works
|
|
294
|
-
// We can't easily test the set behavior without running the full guided-flow
|
|
295
|
-
clearPreparationResult();
|
|
296
|
-
const result = getLastPreparationResult();
|
|
297
|
-
assert.equal(result, null, "should be null after clear");
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
// ─── TUI Progress Notifications ─────────────────────────────────────────────────
|
|
301
|
-
|
|
302
|
-
test("runPreparation() emits TUI progress notifications", async (t) => {
|
|
303
|
-
const dir = getGsdExtensionDir();
|
|
304
|
-
const ui = createMockUI();
|
|
305
|
-
const prefs: PreparationPreferences = {
|
|
306
|
-
discuss_preparation: true,
|
|
307
|
-
discuss_web_research: false,
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
await runPreparation(dir, ui, prefs);
|
|
311
|
-
|
|
312
|
-
// Should have notifications for each phase
|
|
313
|
-
assert.ok(ui.notifications.length > 0, "should have notifications");
|
|
314
|
-
|
|
315
|
-
// Verify codebase analysis notifications
|
|
316
|
-
assert.ok(
|
|
317
|
-
ui.notifications.some(n => n.message.includes("Analyzing codebase")),
|
|
318
|
-
"should show codebase analysis start",
|
|
319
|
-
);
|
|
320
|
-
assert.ok(
|
|
321
|
-
ui.notifications.some(n => n.message.includes("✓ Analyzed codebase")),
|
|
322
|
-
"should show codebase analysis complete",
|
|
323
|
-
);
|
|
324
|
-
|
|
325
|
-
// Verify prior context notifications
|
|
326
|
-
assert.ok(
|
|
327
|
-
ui.notifications.some(n => n.message.includes("Reviewing prior context")),
|
|
328
|
-
"should show prior context start",
|
|
329
|
-
);
|
|
330
|
-
assert.ok(
|
|
331
|
-
ui.notifications.some(n => n.message.includes("✓ Reviewed prior context")),
|
|
332
|
-
"should show prior context complete",
|
|
333
|
-
);
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
test("runPreparation() works in silent mode (no UI)", async (t) => {
|
|
337
|
-
const dir = getGsdExtensionDir();
|
|
338
|
-
const prefs: PreparationPreferences = {
|
|
339
|
-
discuss_preparation: true,
|
|
340
|
-
discuss_web_research: false,
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
// Pass null for UI
|
|
344
|
-
const result = await runPreparation(dir, null, prefs);
|
|
345
|
-
|
|
346
|
-
// Should complete without error
|
|
347
|
-
assert.equal(result.enabled, true, "should work without UI");
|
|
348
|
-
assert.ok(result.codebase, "should have codebase");
|
|
349
|
-
assert.ok(result.priorContext, "should have priorContext");
|
|
350
|
-
assert.ok(result.durationMs > 0, "should have duration");
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
// ─── Preference-Controlled Behavior ─────────────────────────────────────────────
|
|
354
|
-
|
|
355
|
-
test("runPreparation() returns early when discuss_preparation is false", async (t) => {
|
|
356
|
-
const dir = getGsdExtensionDir();
|
|
357
|
-
const ui = createMockUI();
|
|
358
|
-
const prefs: PreparationPreferences = {
|
|
359
|
-
discuss_preparation: false,
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
const result = await runPreparation(dir, ui, prefs);
|
|
363
|
-
|
|
364
|
-
assert.equal(result.enabled, false, "should indicate preparation disabled");
|
|
365
|
-
assert.equal(result.codebaseBrief, "", "should have empty codebase brief");
|
|
366
|
-
assert.equal(result.priorContextBrief, "", "should have empty prior context brief");
|
|
367
|
-
assert.equal(result.ecosystemBrief, "", "should have empty ecosystem brief");
|
|
368
|
-
assert.equal(ui.notifications.length, 0, "should not show any notifications");
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
test("runPreparation() ecosystem research always returns unavailable (happens during discussion)", async (t) => {
|
|
372
|
-
const dir = getGsdExtensionDir();
|
|
373
|
-
const ui = createMockUI();
|
|
374
|
-
const prefs: PreparationPreferences = {
|
|
375
|
-
discuss_preparation: true,
|
|
376
|
-
discuss_web_research: true, // Even with this enabled, ecosystem research returns unavailable
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
const result = await runPreparation(dir, ui, prefs);
|
|
380
|
-
|
|
381
|
-
assert.equal(result.enabled, true);
|
|
382
|
-
assert.equal(result.ecosystemResearchPerformed, false, "should not perform ecosystem research from preparation");
|
|
383
|
-
assert.equal(result.ecosystem.available, false);
|
|
384
|
-
assert.ok(
|
|
385
|
-
result.ecosystem.skippedReason?.includes("during the discussion"),
|
|
386
|
-
"should indicate research happens during discussion",
|
|
387
|
-
);
|
|
388
|
-
|
|
389
|
-
// Should NOT have ecosystem research notifications (no longer part of preparation)
|
|
390
|
-
assert.ok(
|
|
391
|
-
!ui.notifications.some(n => n.message.includes("Researching ecosystem")),
|
|
392
|
-
"should not show ecosystem research notification",
|
|
393
|
-
);
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
// ─── validateEnhancedContext Integration ────────────────────────────────────────
|
|
397
|
-
|
|
398
|
-
test("validateEnhancedContext() validates required sections", async (t) => {
|
|
399
|
-
// Test with valid enhanced context
|
|
400
|
-
const validContext = `# M001 — Test Milestone
|
|
401
|
-
|
|
402
|
-
## Scope
|
|
403
|
-
|
|
404
|
-
This milestone covers X, Y, Z.
|
|
405
|
-
|
|
406
|
-
## Architectural Decisions
|
|
407
|
-
|
|
408
|
-
### Decision 1: Use TypeScript
|
|
409
|
-
|
|
410
|
-
We will use TypeScript for type safety.
|
|
411
|
-
|
|
412
|
-
## Acceptance Criteria
|
|
413
|
-
|
|
414
|
-
- [ ] Feature A works
|
|
415
|
-
- [ ] Feature B works
|
|
416
|
-
`;
|
|
417
|
-
|
|
418
|
-
const validResult = validateEnhancedContext(validContext);
|
|
419
|
-
assert.equal(validResult.valid, true, "should validate complete context");
|
|
420
|
-
assert.deepEqual(validResult.missing, [], "should have no missing sections");
|
|
421
|
-
|
|
422
|
-
// Test with missing sections
|
|
423
|
-
const invalidContext = `# M001 — Test Milestone
|
|
424
|
-
|
|
425
|
-
## Scope
|
|
426
|
-
|
|
427
|
-
This milestone covers X, Y, Z.
|
|
428
|
-
`;
|
|
429
|
-
|
|
430
|
-
const invalidResult = validateEnhancedContext(invalidContext);
|
|
431
|
-
assert.equal(invalidResult.valid, false, "should reject incomplete context");
|
|
432
|
-
assert.ok(invalidResult.missing.length > 0, "should list missing sections");
|
|
433
|
-
assert.ok(
|
|
434
|
-
invalidResult.missing.some(m => m.includes("Architectural Decisions")),
|
|
435
|
-
"should report missing Architectural Decisions",
|
|
436
|
-
);
|
|
437
|
-
assert.ok(
|
|
438
|
-
invalidResult.missing.some(m => m.includes("Acceptance Criteria")),
|
|
439
|
-
"should report missing Acceptance Criteria",
|
|
440
|
-
);
|
|
441
|
-
});
|
|
442
|
-
|
|
443
|
-
test("validateEnhancedContext() requires decision entries in Architectural Decisions", async (t) => {
|
|
444
|
-
// Empty architectural decisions section
|
|
445
|
-
const emptyDecisions = `# M001 — Test Milestone
|
|
446
|
-
|
|
447
|
-
## Scope
|
|
448
|
-
|
|
449
|
-
This milestone covers X, Y, Z.
|
|
450
|
-
|
|
451
|
-
## Architectural Decisions
|
|
452
|
-
|
|
453
|
-
(No decisions yet)
|
|
454
|
-
|
|
455
|
-
## Acceptance Criteria
|
|
456
|
-
|
|
457
|
-
- [ ] Feature A works
|
|
458
|
-
`;
|
|
459
|
-
|
|
460
|
-
const result = validateEnhancedContext(emptyDecisions);
|
|
461
|
-
assert.equal(result.valid, false, "should reject empty decisions section");
|
|
462
|
-
assert.ok(
|
|
463
|
-
result.missing.some(m => m.includes("decision entry")),
|
|
464
|
-
"should report missing decision entry",
|
|
465
|
-
);
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
// ─── Full Pipeline Integration ──────────────────────────────────────────────────
|
|
469
|
-
|
|
470
|
-
test("Full pipeline: preparation produces consistent results across runs", async (t) => {
|
|
471
|
-
const dir = getGsdExtensionDir();
|
|
472
|
-
const prefs: PreparationPreferences = {
|
|
473
|
-
discuss_preparation: true,
|
|
474
|
-
discuss_web_research: false,
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
// Run preparation twice
|
|
478
|
-
const result1 = await runPreparation(dir, null, prefs);
|
|
479
|
-
const result2 = await runPreparation(dir, null, prefs);
|
|
480
|
-
|
|
481
|
-
// Results should be consistent (same codebase, same analysis)
|
|
482
|
-
assert.equal(
|
|
483
|
-
result1.codebase.techStack.primaryLanguage,
|
|
484
|
-
result2.codebase.techStack.primaryLanguage,
|
|
485
|
-
"primary language should be consistent",
|
|
486
|
-
);
|
|
487
|
-
|
|
488
|
-
assert.deepEqual(
|
|
489
|
-
result1.codebase.moduleStructure.topLevelDirs.sort(),
|
|
490
|
-
result2.codebase.moduleStructure.topLevelDirs.sort(),
|
|
491
|
-
"top-level directories should be consistent",
|
|
492
|
-
);
|
|
493
|
-
|
|
494
|
-
assert.equal(
|
|
495
|
-
result1.codebase.patterns.asyncStyle,
|
|
496
|
-
result2.codebase.patterns.asyncStyle,
|
|
497
|
-
"async style should be consistent",
|
|
498
|
-
);
|
|
499
|
-
});
|
|
500
|
-
|
|
501
|
-
test("Full pipeline: preparation handles empty .gsd directory gracefully", async (t) => {
|
|
502
|
-
// The GSD extension directory may or may not have a .gsd subdirectory
|
|
503
|
-
// Either way, preparation should not crash
|
|
504
|
-
const dir = getGsdExtensionDir();
|
|
505
|
-
const prefs: PreparationPreferences = {
|
|
506
|
-
discuss_preparation: true,
|
|
507
|
-
discuss_web_research: false,
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
let result: PreparationResult | undefined;
|
|
511
|
-
let error: unknown;
|
|
512
|
-
|
|
513
|
-
try {
|
|
514
|
-
result = await runPreparation(dir, null, prefs);
|
|
515
|
-
} catch (e) {
|
|
516
|
-
error = e;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
assert.equal(error, undefined, "should not throw");
|
|
520
|
-
assert.ok(result, "should return result");
|
|
521
|
-
assert.equal(result!.enabled, true, "should be enabled");
|
|
522
|
-
|
|
523
|
-
// Prior context should gracefully handle missing files
|
|
524
|
-
assert.ok(result!.priorContext, "should have prior context even if files missing");
|
|
525
|
-
});
|