gsd-pi 2.38.0-dev.eeb3520 → 2.39.0-dev.64cd3ed
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 +15 -11
- package/dist/app-paths.js +1 -1
- package/dist/cli.js +9 -0
- package/dist/extension-discovery.d.ts +5 -3
- package/dist/extension-discovery.js +14 -9
- package/dist/extension-registry.js +2 -2
- package/dist/remote-questions-config.js +2 -2
- package/dist/resource-loader.js +34 -1
- package/dist/resources/extensions/async-jobs/index.js +10 -0
- package/dist/resources/extensions/browser-tools/index.js +3 -1
- package/dist/resources/extensions/browser-tools/package.json +3 -1
- package/dist/resources/extensions/browser-tools/tools/verify.js +97 -0
- package/dist/resources/extensions/cmux/index.js +55 -1
- package/dist/resources/extensions/context7/package.json +1 -1
- package/dist/resources/extensions/env-utils.js +29 -0
- package/dist/resources/extensions/get-secrets-from-user.js +5 -24
- package/dist/resources/extensions/github-sync/cli.js +284 -0
- package/dist/resources/extensions/github-sync/index.js +73 -0
- package/dist/resources/extensions/github-sync/mapping.js +67 -0
- package/dist/resources/extensions/github-sync/sync.js +424 -0
- package/dist/resources/extensions/github-sync/templates.js +118 -0
- package/dist/resources/extensions/github-sync/types.js +7 -0
- package/dist/resources/extensions/google-search/package.json +3 -1
- package/dist/resources/extensions/gsd/auto/session.js +6 -23
- package/dist/resources/extensions/gsd/auto-dispatch.js +8 -9
- package/dist/resources/extensions/gsd/auto-loop.js +650 -588
- package/dist/resources/extensions/gsd/auto-post-unit.js +99 -70
- package/dist/resources/extensions/gsd/auto-prompts.js +202 -48
- package/dist/resources/extensions/gsd/auto-start.js +13 -2
- package/dist/resources/extensions/gsd/auto-worktree-sync.js +13 -5
- package/dist/resources/extensions/gsd/auto-worktree.js +3 -3
- package/dist/resources/extensions/gsd/auto.js +143 -96
- package/dist/resources/extensions/gsd/captures.js +9 -1
- package/dist/resources/extensions/gsd/commands-extensions.js +3 -2
- package/dist/resources/extensions/gsd/commands-handlers.js +16 -3
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +1 -1
- package/dist/resources/extensions/gsd/commands.js +24 -3
- package/dist/resources/extensions/gsd/context-budget.js +2 -10
- package/dist/resources/extensions/gsd/detection.js +1 -2
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +0 -2
- package/dist/resources/extensions/gsd/doctor-checks.js +82 -0
- package/dist/resources/extensions/gsd/doctor-environment.js +78 -0
- package/dist/resources/extensions/gsd/doctor-format.js +15 -0
- package/dist/resources/extensions/gsd/doctor-providers.js +30 -11
- package/dist/resources/extensions/gsd/doctor.js +204 -12
- package/dist/resources/extensions/gsd/exit-command.js +2 -1
- package/dist/resources/extensions/gsd/export.js +1 -1
- package/dist/resources/extensions/gsd/files.js +48 -9
- package/dist/resources/extensions/gsd/forensics.js +1 -1
- package/dist/resources/extensions/gsd/git-service.js +30 -12
- package/dist/resources/extensions/gsd/gitignore.js +16 -3
- package/dist/resources/extensions/gsd/guided-flow.js +149 -38
- package/dist/resources/extensions/gsd/health-widget-core.js +32 -70
- package/dist/resources/extensions/gsd/health-widget.js +3 -86
- package/dist/resources/extensions/gsd/index.js +24 -20
- package/dist/resources/extensions/gsd/migrate/parsers.js +1 -1
- package/dist/resources/extensions/gsd/migrate-external.js +18 -1
- package/dist/resources/extensions/gsd/native-git-bridge.js +37 -0
- package/dist/resources/extensions/gsd/package.json +1 -1
- package/dist/resources/extensions/gsd/paths.js +3 -0
- package/dist/resources/extensions/gsd/preferences-models.js +0 -12
- package/dist/resources/extensions/gsd/preferences-types.js +1 -1
- package/dist/resources/extensions/gsd/preferences-validation.js +59 -11
- package/dist/resources/extensions/gsd/preferences.js +22 -11
- package/dist/resources/extensions/gsd/prompt-loader.js +6 -2
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/discuss.md +11 -14
- package/dist/resources/extensions/gsd/prompts/execute-task.md +5 -3
- package/dist/resources/extensions/gsd/prompts/guided-complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +11 -12
- package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +8 -10
- package/dist/resources/extensions/gsd/prompts/guided-execute-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-plan-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-research-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/queue.md +4 -8
- package/dist/resources/extensions/gsd/prompts/reactive-execute.md +11 -8
- package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
- package/dist/resources/extensions/gsd/prompts/research-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/run-uat.md +28 -11
- package/dist/resources/extensions/gsd/prompts/workflow-start.md +2 -2
- package/dist/resources/extensions/gsd/repo-identity.js +21 -4
- package/dist/resources/extensions/gsd/resource-version.js +2 -1
- package/dist/resources/extensions/gsd/roadmap-mutations.js +24 -0
- package/dist/resources/extensions/gsd/state.js +42 -23
- package/dist/resources/extensions/gsd/templates/runtime.md +21 -0
- package/dist/resources/extensions/gsd/templates/task-plan.md +3 -0
- package/dist/resources/extensions/gsd/visualizer-data.js +1 -1
- package/dist/resources/extensions/gsd/worktree.js +35 -16
- package/dist/resources/extensions/mcp-client/index.js +14 -1
- package/dist/resources/extensions/remote-questions/status.js +4 -1
- package/dist/resources/extensions/remote-questions/store.js +4 -1
- package/dist/resources/extensions/search-the-web/provider.js +2 -1
- package/dist/resources/extensions/shared/frontmatter.js +1 -1
- package/dist/resources/extensions/subagent/index.js +12 -3
- package/dist/resources/extensions/subagent/isolation.js +2 -1
- package/dist/resources/extensions/ttsr/rule-loader.js +2 -1
- package/dist/resources/extensions/universal-config/package.json +1 -1
- package/dist/welcome-screen.d.ts +12 -0
- package/dist/welcome-screen.js +53 -0
- package/package.json +1 -1
- package/packages/pi-ai/dist/utils/oauth/anthropic.js +2 -2
- package/packages/pi-ai/dist/utils/oauth/anthropic.js.map +1 -1
- package/packages/pi-ai/src/utils/oauth/anthropic.ts +2 -2
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +205 -7
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.js +8 -4
- package/packages/pi-coding-agent/dist/core/package-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.js +6 -1
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -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/loader.ts +223 -7
- package/packages/pi-coding-agent/src/core/package-manager.ts +8 -4
- package/packages/pi-coding-agent/src/core/skills.ts +9 -1
- package/packages/pi-coding-agent/src/index.ts +1 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/async-jobs/index.ts +11 -0
- package/src/resources/extensions/browser-tools/index.ts +3 -0
- package/src/resources/extensions/browser-tools/tools/verify.ts +117 -0
- package/src/resources/extensions/cmux/index.ts +57 -1
- package/src/resources/extensions/env-utils.ts +31 -0
- package/src/resources/extensions/get-secrets-from-user.ts +5 -24
- package/src/resources/extensions/github-sync/cli.ts +364 -0
- package/src/resources/extensions/github-sync/index.ts +93 -0
- package/src/resources/extensions/github-sync/mapping.ts +81 -0
- package/src/resources/extensions/github-sync/sync.ts +556 -0
- package/src/resources/extensions/github-sync/templates.ts +183 -0
- package/src/resources/extensions/github-sync/tests/cli.test.ts +20 -0
- package/src/resources/extensions/github-sync/tests/commit-linking.test.ts +39 -0
- package/src/resources/extensions/github-sync/tests/mapping.test.ts +104 -0
- package/src/resources/extensions/github-sync/tests/templates.test.ts +110 -0
- package/src/resources/extensions/github-sync/types.ts +47 -0
- package/src/resources/extensions/gsd/auto/session.ts +7 -25
- package/src/resources/extensions/gsd/auto-dispatch.ts +7 -9
- package/src/resources/extensions/gsd/auto-loop.ts +553 -546
- package/src/resources/extensions/gsd/auto-post-unit.ts +80 -44
- package/src/resources/extensions/gsd/auto-prompts.ts +247 -50
- package/src/resources/extensions/gsd/auto-start.ts +18 -2
- package/src/resources/extensions/gsd/auto-worktree-sync.ts +15 -4
- package/src/resources/extensions/gsd/auto-worktree.ts +3 -3
- package/src/resources/extensions/gsd/auto.ts +139 -101
- package/src/resources/extensions/gsd/captures.ts +10 -1
- package/src/resources/extensions/gsd/commands-extensions.ts +4 -2
- package/src/resources/extensions/gsd/commands-handlers.ts +17 -2
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +1 -1
- package/src/resources/extensions/gsd/commands.ts +26 -4
- package/src/resources/extensions/gsd/context-budget.ts +2 -12
- package/src/resources/extensions/gsd/detection.ts +2 -2
- package/src/resources/extensions/gsd/docs/preferences-reference.md +0 -2
- package/src/resources/extensions/gsd/doctor-checks.ts +75 -0
- package/src/resources/extensions/gsd/doctor-environment.ts +82 -1
- package/src/resources/extensions/gsd/doctor-format.ts +20 -0
- package/src/resources/extensions/gsd/doctor-providers.ts +30 -9
- package/src/resources/extensions/gsd/doctor-types.ts +16 -1
- package/src/resources/extensions/gsd/doctor.ts +199 -14
- package/src/resources/extensions/gsd/exit-command.ts +2 -2
- package/src/resources/extensions/gsd/export.ts +1 -1
- package/src/resources/extensions/gsd/files.ts +51 -11
- package/src/resources/extensions/gsd/forensics.ts +1 -1
- package/src/resources/extensions/gsd/git-service.ts +44 -10
- package/src/resources/extensions/gsd/gitignore.ts +17 -3
- package/src/resources/extensions/gsd/guided-flow.ts +177 -44
- package/src/resources/extensions/gsd/health-widget-core.ts +28 -80
- package/src/resources/extensions/gsd/health-widget.ts +3 -89
- package/src/resources/extensions/gsd/index.ts +24 -17
- package/src/resources/extensions/gsd/migrate/parsers.ts +1 -1
- package/src/resources/extensions/gsd/migrate-external.ts +18 -1
- package/src/resources/extensions/gsd/native-git-bridge.ts +37 -0
- package/src/resources/extensions/gsd/paths.ts +4 -0
- package/src/resources/extensions/gsd/preferences-models.ts +0 -12
- package/src/resources/extensions/gsd/preferences-types.ts +4 -4
- package/src/resources/extensions/gsd/preferences-validation.ts +51 -11
- package/src/resources/extensions/gsd/preferences.ts +25 -11
- package/src/resources/extensions/gsd/prompt-loader.ts +7 -2
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/discuss.md +11 -14
- package/src/resources/extensions/gsd/prompts/execute-task.md +5 -3
- package/src/resources/extensions/gsd/prompts/guided-complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +11 -12
- package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +8 -10
- package/src/resources/extensions/gsd/prompts/guided-execute-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-plan-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-research-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/queue.md +4 -8
- package/src/resources/extensions/gsd/prompts/reactive-execute.md +11 -8
- package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/run-uat.md +28 -11
- package/src/resources/extensions/gsd/prompts/workflow-start.md +2 -2
- package/src/resources/extensions/gsd/repo-identity.ts +23 -4
- package/src/resources/extensions/gsd/resource-version.ts +3 -1
- package/src/resources/extensions/gsd/roadmap-mutations.ts +29 -0
- package/src/resources/extensions/gsd/state.ts +39 -21
- package/src/resources/extensions/gsd/templates/runtime.md +21 -0
- package/src/resources/extensions/gsd/templates/task-plan.md +3 -0
- package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +21 -18
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +122 -68
- package/src/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/cmux.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/derive-state.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/doctor-enhancements.test.ts +266 -0
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +86 -3
- package/src/resources/extensions/gsd/tests/gitignore-tracked-gsd.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +16 -54
- package/src/resources/extensions/gsd/tests/parsers.test.ts +131 -14
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +209 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +2 -7
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +59 -0
- package/src/resources/extensions/gsd/tests/repo-identity-worktree.test.ts +21 -1
- package/src/resources/extensions/gsd/tests/run-uat.test.ts +16 -4
- package/src/resources/extensions/gsd/tests/skill-activation.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/worktree.test.ts +47 -0
- package/src/resources/extensions/gsd/types.ts +18 -1
- package/src/resources/extensions/gsd/verification-evidence.ts +16 -0
- package/src/resources/extensions/gsd/visualizer-data.ts +1 -1
- package/src/resources/extensions/gsd/worktree.ts +35 -15
- package/src/resources/extensions/mcp-client/index.ts +17 -1
- package/src/resources/extensions/remote-questions/status.ts +5 -1
- package/src/resources/extensions/remote-questions/store.ts +5 -1
- package/src/resources/extensions/search-the-web/provider.ts +2 -1
- package/src/resources/extensions/shared/frontmatter.ts +1 -1
- package/src/resources/extensions/subagent/index.ts +12 -3
- package/src/resources/extensions/subagent/isolation.ts +3 -1
- package/src/resources/extensions/ttsr/rule-loader.ts +3 -1
- package/dist/resources/extensions/gsd/prompt-compressor.js +0 -393
- package/dist/resources/extensions/gsd/semantic-chunker.js +0 -254
- package/dist/resources/extensions/gsd/summary-distiller.js +0 -212
- package/src/resources/extensions/gsd/prompt-compressor.ts +0 -508
- package/src/resources/extensions/gsd/semantic-chunker.ts +0 -336
- package/src/resources/extensions/gsd/summary-distiller.ts +0 -258
- package/src/resources/extensions/gsd/tests/context-compression.test.ts +0 -193
- package/src/resources/extensions/gsd/tests/prompt-compressor.test.ts +0 -529
- package/src/resources/extensions/gsd/tests/semantic-chunker.test.ts +0 -426
- package/src/resources/extensions/gsd/tests/summary-distiller.test.ts +0 -323
- package/src/resources/extensions/gsd/tests/token-optimization-benchmark.test.ts +0 -1272
- package/src/resources/extensions/gsd/tests/token-optimization-prefs.test.ts +0 -164
|
@@ -9,6 +9,7 @@ import { loadJsonFileOrNull } from "./json-persistence.js";
|
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { homedir } from "node:os";
|
|
11
11
|
import { resolveProjectRoot } from "./worktree.js";
|
|
12
|
+
const gsdHome = process.env.GSD_HOME || join(homedir(), ".gsd");
|
|
12
13
|
// ─── Resource Staleness ───────────────────────────────────────────────────
|
|
13
14
|
/**
|
|
14
15
|
* Read the resource version (semver) from the managed-resources manifest.
|
|
@@ -19,7 +20,7 @@ function isManifestWithVersion(data) {
|
|
|
19
20
|
return data !== null && typeof data === "object" && "gsdVersion" in data && typeof data.gsdVersion === "string";
|
|
20
21
|
}
|
|
21
22
|
export function readResourceVersion() {
|
|
22
|
-
const agentDir = process.env.GSD_CODING_AGENT_DIR || join(
|
|
23
|
+
const agentDir = process.env.GSD_CODING_AGENT_DIR || join(gsdHome, "agent");
|
|
23
24
|
const manifestPath = join(agentDir, "managed-resources.json");
|
|
24
25
|
const manifest = loadJsonFileOrNull(manifestPath, isManifestWithVersion);
|
|
25
26
|
return manifest?.gsdVersion ?? null;
|
|
@@ -32,6 +32,30 @@ export function markSliceDoneInRoadmap(basePath, mid, sid) {
|
|
|
32
32
|
clearParseCache();
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Mark a slice as not done ([ ]) in the milestone roadmap.
|
|
37
|
+
* Idempotent — no-op if already unchecked or if the slice isn't found.
|
|
38
|
+
*
|
|
39
|
+
* @returns true if the roadmap was modified, false if no change was needed
|
|
40
|
+
*/
|
|
41
|
+
export function markSliceUndoneInRoadmap(basePath, mid, sid) {
|
|
42
|
+
const roadmapFile = resolveMilestoneFile(basePath, mid, "ROADMAP");
|
|
43
|
+
if (!roadmapFile)
|
|
44
|
+
return false;
|
|
45
|
+
let content;
|
|
46
|
+
try {
|
|
47
|
+
content = readFileSync(roadmapFile, "utf-8");
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const updated = content.replace(new RegExp(`^(\\s*-\\s+)\\[x\\]\\s+\\*\\*${sid}:`, "m"), `$1[ ] **${sid}:`);
|
|
53
|
+
if (updated === content)
|
|
54
|
+
return false;
|
|
55
|
+
atomicWriteSync(roadmapFile, updated);
|
|
56
|
+
clearParseCache();
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
35
59
|
/**
|
|
36
60
|
* Mark a task as done ([x]) in the slice plan.
|
|
37
61
|
* Idempotent — no-op if already checked or if the task isn't found.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Pure TypeScript, zero Pi dependencies.
|
|
4
4
|
import { parseRoadmap, parsePlan, parseSummary, loadFile, parseRequirementCounts, parseContextDependsOn, } from './files.js';
|
|
5
5
|
import { resolveMilestoneFile, resolveSlicePath, resolveSliceFile, resolveTaskFile, resolveTasksDir, resolveGsdRootFile, gsdRoot, } from './paths.js';
|
|
6
|
-
import { findMilestoneIds } from './
|
|
6
|
+
import { findMilestoneIds } from './milestone-ids.js';
|
|
7
7
|
import { nativeBatchParseGsdFiles } from './native-parser-bridge.js';
|
|
8
8
|
import { join, resolve } from 'path';
|
|
9
9
|
import { existsSync, readdirSync } from 'node:fs';
|
|
@@ -82,8 +82,13 @@ export async function getActiveMilestoneId(basePath) {
|
|
|
82
82
|
// A draft milestone is still "active" — this function only determines which milestone is current.
|
|
83
83
|
}
|
|
84
84
|
const roadmap = parseRoadmap(content);
|
|
85
|
-
if (!isMilestoneComplete(roadmap))
|
|
86
|
-
|
|
85
|
+
if (!isMilestoneComplete(roadmap)) {
|
|
86
|
+
// Summary is the terminal artifact — if it exists, the milestone is
|
|
87
|
+
// complete even when roadmap checkboxes weren't ticked (#864).
|
|
88
|
+
const summaryFile = resolveMilestoneFile(basePath, mid, "SUMMARY");
|
|
89
|
+
if (!summaryFile)
|
|
90
|
+
return mid;
|
|
91
|
+
}
|
|
87
92
|
}
|
|
88
93
|
return null;
|
|
89
94
|
}
|
|
@@ -202,8 +207,14 @@ async function _deriveStateImpl(basePath) {
|
|
|
202
207
|
}
|
|
203
208
|
const rmap = parseRoadmap(rc);
|
|
204
209
|
roadmapCache.set(mid, rmap);
|
|
205
|
-
if (!isMilestoneComplete(rmap))
|
|
210
|
+
if (!isMilestoneComplete(rmap)) {
|
|
211
|
+
// Summary is the terminal artifact — if it exists, the milestone is
|
|
212
|
+
// complete even when roadmap checkboxes weren't ticked (#864).
|
|
213
|
+
const sf = resolveMilestoneFile(basePath, mid, "SUMMARY");
|
|
214
|
+
if (sf)
|
|
215
|
+
completeMilestoneIds.add(mid);
|
|
206
216
|
continue;
|
|
217
|
+
}
|
|
207
218
|
const sf = resolveMilestoneFile(basePath, mid, "SUMMARY");
|
|
208
219
|
if (sf)
|
|
209
220
|
completeMilestoneIds.add(mid);
|
|
@@ -303,29 +314,37 @@ async function _deriveStateImpl(basePath) {
|
|
|
303
314
|
registry.push({ id: mid, title, status: 'complete' });
|
|
304
315
|
}
|
|
305
316
|
}
|
|
306
|
-
else
|
|
307
|
-
//
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
//
|
|
317
|
+
else {
|
|
318
|
+
// Roadmap slices not all checked — but if a summary exists, the milestone
|
|
319
|
+
// is still complete. The summary is the terminal artifact (#864).
|
|
320
|
+
const summaryFile = resolveMilestoneFile(basePath, mid, "SUMMARY");
|
|
321
|
+
if (summaryFile) {
|
|
322
|
+
registry.push({ id: mid, title, status: 'complete' });
|
|
323
|
+
}
|
|
324
|
+
else if (!activeMilestoneFound) {
|
|
325
|
+
// Check milestone-level dependencies before promoting to active
|
|
326
|
+
const contextFile = resolveMilestoneFile(basePath, mid, "CONTEXT");
|
|
327
|
+
const contextContent = contextFile ? await cachedLoadFile(contextFile) : null;
|
|
328
|
+
const deps = parseContextDependsOn(contextContent);
|
|
329
|
+
const depsUnmet = deps.some(dep => !completeMilestoneIds.has(dep));
|
|
330
|
+
if (depsUnmet) {
|
|
331
|
+
registry.push({ id: mid, title, status: 'pending', dependsOn: deps });
|
|
332
|
+
// Do NOT set activeMilestoneFound — let the loop continue to the next milestone
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
activeMilestone = { id: mid, title };
|
|
336
|
+
activeRoadmap = roadmap;
|
|
337
|
+
activeMilestoneFound = true;
|
|
338
|
+
registry.push({ id: mid, title, status: 'active', ...(deps.length > 0 ? { dependsOn: deps } : {}) });
|
|
339
|
+
}
|
|
315
340
|
}
|
|
316
341
|
else {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
registry.push({ id: mid, title, status: '
|
|
342
|
+
const contextFile2 = resolveMilestoneFile(basePath, mid, "CONTEXT");
|
|
343
|
+
const contextContent2 = contextFile2 ? await cachedLoadFile(contextFile2) : null;
|
|
344
|
+
const deps2 = parseContextDependsOn(contextContent2);
|
|
345
|
+
registry.push({ id: mid, title, status: 'pending', ...(deps2.length > 0 ? { dependsOn: deps2 } : {}) });
|
|
321
346
|
}
|
|
322
347
|
}
|
|
323
|
-
else {
|
|
324
|
-
const contextFile2 = resolveMilestoneFile(basePath, mid, "CONTEXT");
|
|
325
|
-
const contextContent2 = contextFile2 ? await cachedLoadFile(contextFile2) : null;
|
|
326
|
-
const deps2 = parseContextDependsOn(contextContent2);
|
|
327
|
-
registry.push({ id: mid, title, status: 'pending', ...(deps2.length > 0 ? { dependsOn: deps2 } : {}) });
|
|
328
|
-
}
|
|
329
348
|
}
|
|
330
349
|
const milestoneProgress = {
|
|
331
350
|
done: registry.filter(entry => entry.status === 'complete').length,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Runtime Context
|
|
2
|
+
|
|
3
|
+
## Stack
|
|
4
|
+
- **Language:** (e.g., TypeScript, Python, Go)
|
|
5
|
+
- **Framework:** (e.g., Next.js, FastAPI, Gin)
|
|
6
|
+
- **Build:** (e.g., npm run build, cargo build)
|
|
7
|
+
- **Test:** (e.g., npm run test, pytest)
|
|
8
|
+
- **Lint:** (e.g., npm run lint, ruff check)
|
|
9
|
+
|
|
10
|
+
## Environment
|
|
11
|
+
- **Node version:** (e.g., 20.x)
|
|
12
|
+
- **Package manager:** (e.g., npm, pnpm, yarn)
|
|
13
|
+
- **Required env vars:** (list any needed for local dev)
|
|
14
|
+
|
|
15
|
+
## Dev Server
|
|
16
|
+
- **Start command:** (e.g., npm run dev)
|
|
17
|
+
- **Default port:** (e.g., 3000)
|
|
18
|
+
- **Health check:** (e.g., curl http://localhost:3000/health)
|
|
19
|
+
|
|
20
|
+
## Notes
|
|
21
|
+
(Any runtime-specific context the executor needs to know)
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
# Tasks with 10+ estimated steps or 12+ estimated files trigger a warning to consider splitting.
|
|
4
4
|
estimated_steps: {{estimatedSteps}}
|
|
5
5
|
estimated_files: {{estimatedFiles}}
|
|
6
|
+
# Installed skills the planner expects the executor to load before coding.
|
|
7
|
+
skills_used:
|
|
8
|
+
- {{skillName}}
|
|
6
9
|
---
|
|
7
10
|
|
|
8
11
|
# {{taskId}}: {{taskTitle}}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
3
3
|
import { deriveState } from './state.js';
|
|
4
4
|
import { parseRoadmap, parsePlan, parseSummary, loadFile } from './files.js';
|
|
5
|
-
import { findMilestoneIds } from './
|
|
5
|
+
import { findMilestoneIds } from './milestone-ids.js';
|
|
6
6
|
import { resolveMilestoneFile, resolveSliceFile, resolveGsdRootFile } from './paths.js';
|
|
7
7
|
import { getLedger, getProjectTotals, aggregateByPhase, aggregateBySlice, aggregateByModel, aggregateByTier, formatTierSavings, loadLedgerFromDisk, } from './metrics.js';
|
|
8
8
|
import { loadAllCaptures, countPendingCaptures } from './captures.js';
|
|
@@ -57,42 +57,61 @@ export function captureIntegrationBranch(basePath, milestoneId, options) {
|
|
|
57
57
|
writeIntegrationBranch(basePath, milestoneId, current, options);
|
|
58
58
|
}
|
|
59
59
|
// ─── Pure Utility Functions (unchanged) ────────────────────────────────────
|
|
60
|
+
/**
|
|
61
|
+
* Find the worktrees segment in a path, supporting both direct
|
|
62
|
+
* (`/.gsd/worktrees/`) and symlink-resolved (`/.gsd/projects/<hash>/worktrees/`)
|
|
63
|
+
* layouts. When `.gsd` is a symlink to `~/.gsd/projects/<hash>`, resolved
|
|
64
|
+
* paths contain the intermediate `projects/<hash>/` segment that the old
|
|
65
|
+
* single-marker check missed.
|
|
66
|
+
*/
|
|
67
|
+
function findWorktreeSegment(normalizedPath) {
|
|
68
|
+
// Direct layout: /.gsd/worktrees/<name>
|
|
69
|
+
const directMarker = "/.gsd/worktrees/";
|
|
70
|
+
const idx = normalizedPath.indexOf(directMarker);
|
|
71
|
+
if (idx !== -1) {
|
|
72
|
+
return { gsdIdx: idx, afterWorktrees: idx + directMarker.length };
|
|
73
|
+
}
|
|
74
|
+
// Symlink-resolved layout: /.gsd/projects/<hash>/worktrees/<name>
|
|
75
|
+
const symlinkRe = /\/\.gsd\/projects\/[a-f0-9]+\/worktrees\//;
|
|
76
|
+
const match = normalizedPath.match(symlinkRe);
|
|
77
|
+
if (match && match.index !== undefined) {
|
|
78
|
+
return { gsdIdx: match.index, afterWorktrees: match.index + match[0].length };
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
60
82
|
/**
|
|
61
83
|
* Detect the active worktree name from the current working directory.
|
|
62
84
|
* Returns null if not inside a GSD worktree (.gsd/worktrees/<name>/).
|
|
63
85
|
*/
|
|
64
86
|
export function detectWorktreeName(basePath) {
|
|
65
87
|
const normalizedPath = basePath.replaceAll("\\", "/");
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
if (idx === -1)
|
|
88
|
+
const seg = findWorktreeSegment(normalizedPath);
|
|
89
|
+
if (!seg)
|
|
69
90
|
return null;
|
|
70
|
-
const afterMarker = normalizedPath.slice(
|
|
91
|
+
const afterMarker = normalizedPath.slice(seg.afterWorktrees);
|
|
71
92
|
const name = afterMarker.split("/")[0];
|
|
72
93
|
return name || null;
|
|
73
94
|
}
|
|
74
95
|
/**
|
|
75
96
|
* Resolve the project root from a path that may be inside a worktree.
|
|
76
|
-
* If the path contains
|
|
77
|
-
*
|
|
97
|
+
* If the path contains a worktrees segment, returns the portion before
|
|
98
|
+
* `/.gsd/`. Otherwise returns the input unchanged.
|
|
78
99
|
*
|
|
79
100
|
* Use this in commands that call `process.cwd()` to ensure they always
|
|
80
101
|
* operate against the real project root, not a worktree subdirectory.
|
|
81
102
|
*/
|
|
82
103
|
export function resolveProjectRoot(basePath) {
|
|
83
104
|
const normalizedPath = basePath.replaceAll("\\", "/");
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
if (idx === -1)
|
|
105
|
+
const seg = findWorktreeSegment(normalizedPath);
|
|
106
|
+
if (!seg)
|
|
87
107
|
return basePath;
|
|
88
|
-
// Return the original path up to the
|
|
89
|
-
// Account for potential OS-specific separators
|
|
108
|
+
// Return the original path up to the /.gsd/ boundary
|
|
90
109
|
const sep = basePath.includes("\\") ? "\\" : "/";
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
return basePath.slice(0,
|
|
95
|
-
return basePath.slice(0,
|
|
110
|
+
const gsdMarker = `${sep}.gsd${sep}`;
|
|
111
|
+
const gsdIdx = basePath.indexOf(gsdMarker);
|
|
112
|
+
if (gsdIdx !== -1)
|
|
113
|
+
return basePath.slice(0, gsdIdx);
|
|
114
|
+
return basePath.slice(0, seg.gsdIdx);
|
|
96
115
|
}
|
|
97
116
|
/**
|
|
98
117
|
* Get the slice branch name, namespaced by worktree when inside one.
|
|
@@ -76,6 +76,19 @@ function readConfigs() {
|
|
|
76
76
|
function getServerConfig(name) {
|
|
77
77
|
return readConfigs().find((s) => s.name === name);
|
|
78
78
|
}
|
|
79
|
+
/** Resolve ${VAR} references in env values against process.env. */
|
|
80
|
+
function resolveEnv(env) {
|
|
81
|
+
const resolved = {};
|
|
82
|
+
for (const [key, value] of Object.entries(env)) {
|
|
83
|
+
if (typeof value === "string") {
|
|
84
|
+
resolved[key] = value.replace(/\$\{([^}]+)\}/g, (_match, varName) => process.env[varName] ?? "");
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
resolved[key] = value;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return resolved;
|
|
91
|
+
}
|
|
79
92
|
async function getOrConnect(name, signal) {
|
|
80
93
|
const existing = connections.get(name);
|
|
81
94
|
if (existing)
|
|
@@ -89,7 +102,7 @@ async function getOrConnect(name, signal) {
|
|
|
89
102
|
transport = new StdioClientTransport({
|
|
90
103
|
command: config.command,
|
|
91
104
|
args: config.args,
|
|
92
|
-
env: config.env ? { ...process.env, ...config.env } : undefined,
|
|
105
|
+
env: config.env ? { ...process.env, ...resolveEnv(config.env) } : undefined,
|
|
93
106
|
cwd: config.cwd,
|
|
94
107
|
stderr: "pipe",
|
|
95
108
|
});
|
|
@@ -5,8 +5,11 @@ import { existsSync, readdirSync } from "node:fs";
|
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { homedir } from "node:os";
|
|
7
7
|
import { readPromptRecord } from "./store.js";
|
|
8
|
+
function getGsdHome() {
|
|
9
|
+
return process.env.GSD_HOME || join(homedir(), ".gsd");
|
|
10
|
+
}
|
|
8
11
|
export function getLatestPromptSummary() {
|
|
9
|
-
const runtimeDir = join(
|
|
12
|
+
const runtimeDir = join(getGsdHome(), "runtime", "remote-questions");
|
|
10
13
|
if (!existsSync(runtimeDir))
|
|
11
14
|
return null;
|
|
12
15
|
const files = readdirSync(runtimeDir).filter((f) => f.endsWith(".json"));
|
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { homedir } from "node:os";
|
|
7
|
+
function getGsdHome() {
|
|
8
|
+
return process.env.GSD_HOME || join(homedir(), ".gsd");
|
|
9
|
+
}
|
|
7
10
|
function runtimeDir() {
|
|
8
|
-
return join(
|
|
11
|
+
return join(getGsdHome(), "runtime", "remote-questions");
|
|
9
12
|
}
|
|
10
13
|
function recordPath(id) {
|
|
11
14
|
return join(runtimeDir(), `${id}.json`);
|
|
@@ -15,7 +15,8 @@ import { resolveSearchProviderFromPreferences } from '../gsd/preferences.js';
|
|
|
15
15
|
// Compute authFilePath locally instead of importing from app-paths.ts,
|
|
16
16
|
// because extensions are copied to ~/.gsd/agent/extensions/ at runtime
|
|
17
17
|
// where the relative import '../../../app-paths.ts' doesn't resolve.
|
|
18
|
-
const
|
|
18
|
+
const gsdHome = process.env.GSD_HOME || join(homedir(), '.gsd');
|
|
19
|
+
const authFilePath = join(gsdHome, 'agent', 'auth.json');
|
|
19
20
|
const VALID_PREFERENCES = new Set(['tavily', 'brave', 'ollama', 'auto']);
|
|
20
21
|
const PREFERENCE_KEY = 'search_provider';
|
|
21
22
|
/** Returns the Tavily API key from the environment, or empty string if not set. */
|
|
@@ -45,7 +45,7 @@ export function parseFrontmatterMap(lines) {
|
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
47
|
// Array item (2-space indent)
|
|
48
|
-
const arrayMatch = line.match(/^ - (.*)$/);
|
|
48
|
+
const arrayMatch = line.match(/^ - ?(.*)$/);
|
|
49
49
|
if (arrayMatch && currentKey) {
|
|
50
50
|
// If there's a pending nested object, push it
|
|
51
51
|
if (currentObj && Object.keys(currentObj).length > 0) {
|
|
@@ -360,7 +360,7 @@ async function runSingleAgent(defaultCwd, agents, agentName, task, cwd, step, si
|
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
async function runSingleAgentInCmuxSplit(cmuxClient,
|
|
363
|
+
async function runSingleAgentInCmuxSplit(cmuxClient, directionOrSurfaceId, defaultCwd, agents, agentName, task, cwd, step, signal, onUpdate, makeDetails) {
|
|
364
364
|
const agent = agents.find((a) => a.name === agentName);
|
|
365
365
|
if (!agent) {
|
|
366
366
|
return runSingleAgent(defaultCwd, agents, agentName, task, cwd, step, signal, onUpdate, makeDetails);
|
|
@@ -397,7 +397,12 @@ async function runSingleAgentInCmuxSplit(cmuxClient, direction, defaultCwd, agen
|
|
|
397
397
|
const stdoutPath = path.join(tmpOutputDir, "stdout.jsonl");
|
|
398
398
|
const stderrPath = path.join(tmpOutputDir, "stderr.log");
|
|
399
399
|
const exitPath = path.join(tmpOutputDir, "exit.code");
|
|
400
|
-
|
|
400
|
+
// Accept either a pre-created surface ID or a direction to create a new split
|
|
401
|
+
const isDirection = directionOrSurfaceId === "right" || directionOrSurfaceId === "down"
|
|
402
|
+
|| directionOrSurfaceId === "left" || directionOrSurfaceId === "up";
|
|
403
|
+
const cmuxSurfaceId = isDirection
|
|
404
|
+
? await cmuxClient.createSplit(directionOrSurfaceId)
|
|
405
|
+
: directionOrSurfaceId;
|
|
401
406
|
if (!cmuxSurfaceId) {
|
|
402
407
|
return runSingleAgent(defaultCwd, agents, agentName, task, cwd, step, signal, onUpdate, makeDetails);
|
|
403
408
|
}
|
|
@@ -656,10 +661,14 @@ export default function (pi) {
|
|
|
656
661
|
const MAX_RETRIES = 1; // Retry failed tasks once
|
|
657
662
|
const batchId = crypto.randomUUID();
|
|
658
663
|
const batchSize = params.tasks.length;
|
|
664
|
+
// Pre-create a grid layout for cmux splits so agents get a clean tiled arrangement
|
|
665
|
+
const gridSurfaces = cmuxSplitsEnabled
|
|
666
|
+
? await cmuxClient.createGridLayout(Math.min(batchSize, MAX_CONCURRENCY))
|
|
667
|
+
: [];
|
|
659
668
|
const results = await mapWithConcurrencyLimit(params.tasks, MAX_CONCURRENCY, async (t, index) => {
|
|
660
669
|
const workerId = registerWorker(t.agent, t.task, index, batchSize, batchId);
|
|
661
670
|
const runTask = () => cmuxSplitsEnabled
|
|
662
|
-
? runSingleAgentInCmuxSplit(cmuxClient, index % 2 === 0 ? "right" : "down", ctx.cwd, agents, t.agent, t.task, t.cwd, undefined, signal, (partial) => {
|
|
671
|
+
? runSingleAgentInCmuxSplit(cmuxClient, gridSurfaces[index] ?? (index % 2 === 0 ? "right" : "down"), ctx.cwd, agents, t.agent, t.task, t.cwd, undefined, signal, (partial) => {
|
|
663
672
|
if (partial.details?.results[0]) {
|
|
664
673
|
allResults[index] = partial.details.results[0];
|
|
665
674
|
emitParallelUpdate();
|
|
@@ -17,8 +17,9 @@ const execFile = promisify(execFileCb);
|
|
|
17
17
|
function encodeCwd(cwd) {
|
|
18
18
|
return cwd.replace(/\//g, "--");
|
|
19
19
|
}
|
|
20
|
+
const gsdHome = process.env.GSD_HOME || path.join(os.homedir(), ".gsd");
|
|
20
21
|
function getIsolationBaseDir(cwd, taskId) {
|
|
21
|
-
return path.join(
|
|
22
|
+
return path.join(gsdHome, "wt", encodeCwd(cwd), taskId);
|
|
22
23
|
}
|
|
23
24
|
// Track active isolation dirs for cleanup on exit
|
|
24
25
|
const activeIsolations = new Set();
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { readdirSync, readFileSync, existsSync } from "node:fs";
|
|
9
9
|
import { join, basename } from "node:path";
|
|
10
10
|
import { homedir } from "node:os";
|
|
11
|
+
const gsdHome = process.env.GSD_HOME || join(homedir(), ".gsd");
|
|
11
12
|
import { splitFrontmatter, parseFrontmatterMap } from "../shared/frontmatter.js";
|
|
12
13
|
function parseRuleFile(filePath) {
|
|
13
14
|
let content;
|
|
@@ -56,7 +57,7 @@ function scanDir(dir) {
|
|
|
56
57
|
* Project rules override global rules with the same name.
|
|
57
58
|
*/
|
|
58
59
|
export function loadRules(cwd) {
|
|
59
|
-
const globalDir = join(
|
|
60
|
+
const globalDir = join(gsdHome, "agent", "rules");
|
|
60
61
|
const projectDir = join(cwd, ".gsd", "rules");
|
|
61
62
|
const globalRules = scanDir(globalDir);
|
|
62
63
|
const projectRules = scanDir(projectDir);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Welcome Screen
|
|
3
|
+
*
|
|
4
|
+
* Rendered to stderr before the TUI takes over.
|
|
5
|
+
* No box, no panels — logo with metadata alongside, dim hint below.
|
|
6
|
+
*/
|
|
7
|
+
export interface WelcomeScreenOptions {
|
|
8
|
+
version: string;
|
|
9
|
+
modelName?: string;
|
|
10
|
+
provider?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function printWelcomeScreen(opts: WelcomeScreenOptions): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Welcome Screen
|
|
3
|
+
*
|
|
4
|
+
* Rendered to stderr before the TUI takes over.
|
|
5
|
+
* No box, no panels — logo with metadata alongside, dim hint below.
|
|
6
|
+
*/
|
|
7
|
+
import os from 'node:os';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import { GSD_LOGO } from './logo.js';
|
|
10
|
+
function getShortCwd() {
|
|
11
|
+
const cwd = process.cwd();
|
|
12
|
+
const home = os.homedir();
|
|
13
|
+
return cwd.startsWith(home) ? '~' + cwd.slice(home.length) : cwd;
|
|
14
|
+
}
|
|
15
|
+
export function printWelcomeScreen(opts) {
|
|
16
|
+
if (!process.stderr.isTTY)
|
|
17
|
+
return;
|
|
18
|
+
const { version, modelName, provider } = opts;
|
|
19
|
+
const shortCwd = getShortCwd();
|
|
20
|
+
// Info lines to sit alongside the logo (one per logo row)
|
|
21
|
+
const modelLine = [modelName, provider].filter(Boolean).join(' · ');
|
|
22
|
+
const INFO = [
|
|
23
|
+
` ${chalk.bold('Get Shit Done')} ${chalk.dim('v' + version)}`,
|
|
24
|
+
undefined,
|
|
25
|
+
modelLine ? ` ${chalk.dim(modelLine)}` : undefined,
|
|
26
|
+
` ${chalk.dim(shortCwd)}`,
|
|
27
|
+
undefined,
|
|
28
|
+
undefined,
|
|
29
|
+
];
|
|
30
|
+
const lines = [''];
|
|
31
|
+
for (let i = 0; i < GSD_LOGO.length; i++) {
|
|
32
|
+
lines.push(chalk.cyan(GSD_LOGO[i]) + (INFO[i] ?? ''));
|
|
33
|
+
}
|
|
34
|
+
// Tool status + hint — dim, aligned under the info text
|
|
35
|
+
const pad = ' '.repeat(28) + ' '; // aligns with the info text column
|
|
36
|
+
const toolParts = [];
|
|
37
|
+
if (process.env.BRAVE_API_KEY)
|
|
38
|
+
toolParts.push('Brave ✓');
|
|
39
|
+
if (process.env.BRAVE_ANSWERS_KEY)
|
|
40
|
+
toolParts.push('Answers ✓');
|
|
41
|
+
if (process.env.JINA_API_KEY)
|
|
42
|
+
toolParts.push('Jina ✓');
|
|
43
|
+
if (process.env.TAVILY_API_KEY)
|
|
44
|
+
toolParts.push('Tavily ✓');
|
|
45
|
+
if (process.env.CONTEXT7_API_KEY)
|
|
46
|
+
toolParts.push('Context7 ✓');
|
|
47
|
+
if (toolParts.length > 0) {
|
|
48
|
+
lines.push(chalk.dim(pad + ['Web search loaded', ...toolParts].join(' · ')));
|
|
49
|
+
}
|
|
50
|
+
lines.push(chalk.dim(pad + '/gsd to begin · /gsd help for all commands'));
|
|
51
|
+
lines.push('');
|
|
52
|
+
process.stderr.write(lines.join('\n') + '\n');
|
|
53
|
+
}
|
package/package.json
CHANGED
|
@@ -5,8 +5,8 @@ import { generatePKCE } from "./pkce.js";
|
|
|
5
5
|
const decode = (s) => atob(s);
|
|
6
6
|
const CLIENT_ID = decode("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl");
|
|
7
7
|
const AUTHORIZE_URL = "https://claude.ai/oauth/authorize";
|
|
8
|
-
const TOKEN_URL = "https://
|
|
9
|
-
const REDIRECT_URI = "https://
|
|
8
|
+
const TOKEN_URL = "https://platform.claude.com/v1/oauth/token";
|
|
9
|
+
const REDIRECT_URI = "https://platform.claude.com/oauth/code/callback";
|
|
10
10
|
const SCOPES = "org:create_api_key user:profile user:inference";
|
|
11
11
|
/**
|
|
12
12
|
* Login with Anthropic OAuth (device code flow)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../../src/utils/oauth/anthropic.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,SAAS,GAAG,MAAM,CAAC,kDAAkD,CAAC,CAAC;AAC7E,MAAM,aAAa,GAAG,mCAAmC,CAAC;AAC1D,MAAM,SAAS,GAAG,
|
|
1
|
+
{"version":3,"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ks, OAuthProviderInterface } from \"./types.js\";\n\nconst decode = (s: string) => atob(s);\nconst CLIENT_ID = decode(\"OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl\");\nconst AUTHORIZE_URL = \"https://claude.ai/oauth/authorize\";\nconst TOKEN_URL = \"https://platform.claude.com/v1/oauth/token\";\nconst REDIRECT_URI = \"https://platform.claude.com/oauth/code/callback\";\nconst SCOPES = \"org:create_api_key user:profile user:inference\";\n\n/**\n * Login with Anthropic OAuth (device code flow)\n *\n * @param onAuthUrl - Callback to handle the authorization URL (e.g., open browser)\n * @param onPromptCode - Callback to prompt user for the authorization code\n */\nexport async function loginAnthropic(\n\tonAuthUrl: (url: string) => void,\n\tonPromptCode: () => Promise<string>,\n): Promise<OAuthCredentials> {\n\tconst { verifier, challenge } = await generatePKCE();\n\n\t// Build authorization URL\n\tconst authParams = new URLSearchParams({\n\t\tcode: \"true\",\n\t\tclient_id: CLIENT_ID,\n\t\tresponse_type: \"code\",\n\t\tredirect_uri: REDIRECT_URI,\n\t\tscope: SCOPES,\n\t\tcode_challenge: challenge,\n\t\tcode_challenge_method: \"S256\",\n\t\tstate: verifier,\n\t});\n\n\tconst authUrl = `${AUTHORIZE_URL}?${authParams.toString()}`;\n\n\t// Notify caller with URL to open\n\tonAuthUrl(authUrl);\n\n\t// Wait for user to paste authorization code (format: code#state)\n\tconst authCode = await onPromptCode();\n\tconst splits = authCode.split(\"#\");\n\tconst code = splits[0];\n\tconst state = splits[1];\n\n\t// Exchange code for tokens\n\tconst tokenResponse = await fetch(TOKEN_URL, {\n\t\tmethod: \"POST\",\n\t\theaders: {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t},\n\t\tbody: JSON.stringify({\n\t\t\tgrant_type: \"authorization_code\",\n\t\t\tclient_id: CLIENT_ID,\n\t\t\tcode: code,\n\t\t\tstate: state,\n\t\t\tredirect_uri: REDIRECT_URI,\n\t\t\tcode_verifier: verifier,\n\t\t}),\n\t\tsignal: AbortSignal.timeout(30_000),\n\t});\n\n\tif (!tokenResponse.ok) {\n\t\tconst error = await tokenResponse.text();\n\t\tthrow new Error(`Token exchange failed: ${error}`);\n\t}\n\n\tconst tokenData = (await tokenResponse.json()) as {\n\t\taccess_token: string;\n\t\trefresh_token: string;\n\t\texpires_in: number;\n\t};\n\n\t// Calculate expiry time (current time + expires_in seconds - 5 min buffer)\n\tconst expiresAt = Date.now() + tokenData.expires_in * 1000 - 5 * 60 * 1000;\n\n\t// Save credentials\n\treturn {\n\t\trefresh: tokenData.refresh_token,\n\t\taccess: tokenData.access_token,\n\t\texpires: expiresAt,\n\t};\n}\n\n/**\n * Refresh Anthropic OAuth token\n */\nexport async function refreshAnthropicToken(refreshToken: string): Promise<OAuthCredentials> {\n\tconst response = await fetch(TOKEN_URL, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\tbody: JSON.stringify({\n\t\t\tgrant_type: \"refresh_token\",\n\t\t\tclient_id: CLIENT_ID,\n\t\t\trefresh_token: refreshToken,\n\t\t}),\n\t\tsignal: AbortSignal.timeout(30_000),\n\t});\n\n\tif (!response.ok) {\n\t\tconst error = await response.text();\n\t\tthrow new Error(`Anthropic token refresh failed: ${error}`);\n\t}\n\n\tconst data = (await response.json()) as {\n\t\taccess_token: string;\n\t\trefresh_token: string;\n\t\texpires_in: number;\n\t};\n\n\treturn {\n\t\trefresh: data.refresh_token,\n\t\taccess: data.access_token,\n\t\texpires: Date.now() + data.expires_in * 1000 - 5 * 60 * 1000,\n\t};\n}\n\nexport const anthropicOAuthProvider: OAuthProviderInterface = {\n\tid: \"anthropic\",\n\tname: \"Anthropic (Claude Pro/Max)\",\n\n\tasync login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials> {\n\t\treturn loginAnthropic(\n\t\t\t(url) => callbacks.onAuth({ url }),\n\t\t\t() => callbacks.onPrompt({ message: \"Paste the authorization code:\" }),\n\t\t);\n\t},\n\n\tasync refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials> {\n\t\treturn refreshAnthropicToken(credentials.refresh);\n\t},\n\n\tgetApiKey(credentials: OAuthCredentials): string {\n\t\treturn credentials.access;\n\t},\n};\n"]}
|
|
@@ -8,8 +8,8 @@ import type { OAuthCredentials, OAuthLoginCallbacks, OAuthProviderInterface } fr
|
|
|
8
8
|
const decode = (s: string) => atob(s);
|
|
9
9
|
const CLIENT_ID = decode("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl");
|
|
10
10
|
const AUTHORIZE_URL = "https://claude.ai/oauth/authorize";
|
|
11
|
-
const TOKEN_URL = "https://
|
|
12
|
-
const REDIRECT_URI = "https://
|
|
11
|
+
const TOKEN_URL = "https://platform.claude.com/v1/oauth/token";
|
|
12
|
+
const REDIRECT_URI = "https://platform.claude.com/oauth/code/callback";
|
|
13
13
|
const SCOPES = "org:create_api_key user:profile user:inference";
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA+BH,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIhE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,KAAK,EACX,SAAS,EAET,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EAKpB,MAAM,YAAY,CAAC;AAsTpB,wBAAsB,qBAAqB,CAAC,CAAC,GAAG,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAI/G;AA6BD;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,gBAAgB,CAmCzD;AAkMD;;GAEG;AACH,wBAAsB,wBAAwB,CAC7C,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,gBAAgB,EACzB,aAAa,SAAa,GACxB,OAAO,CAAC,SAAS,CAAC,CAKpB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAyBrH;AAmHD;;GAEG;AACH,wBAAsB,yBAAyB,CAC9C,eAAe,EAAE,MAAM,EAAE,EACzB,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,MAAsB,EAChC,QAAQ,CAAC,EAAE,QAAQ,GACjB,OAAO,CAAC,oBAAoB,CAAC,CAoD/B"}
|