gsd-pi 2.73.1-dev.1040fb0 → 2.73.1-dev.49397e5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-web-branch.d.ts +4 -3
- package/dist/cli-web-branch.js +10 -7
- package/dist/cli.js +99 -206
- package/dist/headless-query.js +4 -1
- package/dist/logo.d.ts +1 -1
- package/dist/logo.js +1 -1
- package/dist/onboarding.js +59 -53
- package/dist/resource-loader.js +2 -2
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +59 -1
- package/dist/resources/extensions/gsd/auto/detect-stuck.js +11 -4
- package/dist/resources/extensions/gsd/auto/phases.js +60 -10
- package/dist/resources/extensions/gsd/auto-dispatch.js +11 -3
- package/dist/resources/extensions/gsd/auto-post-unit.js +93 -57
- package/dist/resources/extensions/gsd/auto-start.js +3 -0
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +13 -0
- package/dist/resources/extensions/gsd/auto-verification.js +88 -3
- package/dist/resources/extensions/gsd/auto.js +37 -10
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +21 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +26 -1
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +20 -0
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +68 -9
- package/dist/resources/extensions/gsd/commands-add-tests.js +111 -0
- package/dist/resources/extensions/gsd/commands-backlog.js +140 -0
- package/dist/resources/extensions/gsd/commands-do.js +79 -0
- package/dist/resources/extensions/gsd/commands-maintenance.js +6 -6
- package/dist/resources/extensions/gsd/commands-pr-branch.js +180 -0
- package/dist/resources/extensions/gsd/commands-session-report.js +82 -0
- package/dist/resources/extensions/gsd/commands-ship.js +187 -0
- package/dist/resources/extensions/gsd/db-writer.js +3 -5
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/dist/resources/extensions/gsd/gsd-db.js +321 -0
- package/dist/resources/extensions/gsd/index.js +15 -2
- package/dist/resources/extensions/gsd/md-importer.js +3 -4
- package/dist/resources/extensions/gsd/memory-store.js +19 -51
- package/dist/resources/extensions/gsd/milestone-validation-gates.js +13 -12
- package/dist/resources/extensions/gsd/native-git-bridge.js +7 -4
- package/dist/resources/extensions/gsd/notification-widget.js +2 -2
- package/dist/resources/extensions/gsd/prompts/add-tests.md +35 -0
- package/dist/resources/extensions/gsd/state.js +66 -15
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +3 -14
- package/dist/resources/extensions/gsd/triage-resolution.js +2 -5
- package/dist/resources/extensions/gsd/workflow-manifest.js +8 -69
- package/dist/resources/extensions/gsd/workflow-migration.js +21 -22
- package/dist/resources/extensions/gsd/workflow-projections.js +4 -1
- package/dist/resources/extensions/gsd/workflow-reconcile.js +14 -11
- package/dist/tsconfig.extensions.tsbuildinfo +1 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +14 -14
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +14 -14
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/package.json +3 -3
- package/packages/mcp-server/tsconfig.json +1 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -0
- package/packages/native/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-agent-core/tsconfig.json +1 -0
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-ai/tsconfig.json +1 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +138 -0
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +10 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +2 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +9 -3
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js +52 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +21 -4
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +11 -3
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +157 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +12 -6
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.test.ts +73 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.ts +9 -3
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +21 -4
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +11 -3
- package/packages/pi-coding-agent/tsconfig.json +1 -0
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js +60 -1
- package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
- package/packages/pi-tui/dist/tui.d.ts +8 -0
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +32 -3
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/__tests__/tui.test.ts +76 -1
- package/packages/pi-tui/src/tui.ts +31 -3
- package/packages/pi-tui/tsconfig.json +1 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -0
- package/packages/rpc-client/tsconfig.json +1 -0
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +95 -1
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +88 -0
- package/src/resources/extensions/gsd/auto/detect-stuck.ts +12 -4
- package/src/resources/extensions/gsd/auto/loop-deps.ts +6 -0
- package/src/resources/extensions/gsd/auto/phases.ts +90 -10
- package/src/resources/extensions/gsd/auto-dispatch.ts +10 -4
- package/src/resources/extensions/gsd/auto-post-unit.ts +107 -58
- package/src/resources/extensions/gsd/auto-start.ts +3 -0
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +17 -0
- package/src/resources/extensions/gsd/auto-verification.ts +98 -3
- package/src/resources/extensions/gsd/auto.ts +38 -14
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +24 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +26 -1
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +20 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +74 -9
- package/src/resources/extensions/gsd/commands-add-tests.ts +137 -0
- package/src/resources/extensions/gsd/commands-backlog.ts +182 -0
- package/src/resources/extensions/gsd/commands-do.ts +109 -0
- package/src/resources/extensions/gsd/commands-maintenance.ts +6 -6
- package/src/resources/extensions/gsd/commands-pr-branch.ts +234 -0
- package/src/resources/extensions/gsd/commands-session-report.ts +101 -0
- package/src/resources/extensions/gsd/commands-ship.ts +219 -0
- package/src/resources/extensions/gsd/db-writer.ts +3 -5
- package/src/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/src/resources/extensions/gsd/gsd-db.ts +467 -0
- package/src/resources/extensions/gsd/index.ts +18 -2
- package/src/resources/extensions/gsd/md-importer.ts +3 -5
- package/src/resources/extensions/gsd/memory-store.ts +31 -62
- package/src/resources/extensions/gsd/milestone-validation-gates.ts +13 -14
- package/src/resources/extensions/gsd/native-git-bridge.ts +11 -12
- package/src/resources/extensions/gsd/notification-widget.ts +2 -2
- package/src/resources/extensions/gsd/prompts/add-tests.md +35 -0
- package/src/resources/extensions/gsd/state.ts +80 -17
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/commands-backlog.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/commands-do.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/commands-pr-branch.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/commands-session-report.test.ts +82 -0
- package/src/resources/extensions/gsd/tests/commands-ship.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/commands-workflow-custom.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/complete-milestone-false-merge.test.ts +142 -0
- package/src/resources/extensions/gsd/tests/completed-at-reconcile.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/derive-state-crossval.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +68 -8
- package/src/resources/extensions/gsd/tests/derive-state.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +154 -0
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +68 -1
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +180 -0
- package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +5 -7
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +223 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +3 -11
- package/src/resources/extensions/gsd/triage-resolution.ts +2 -7
- package/src/resources/extensions/gsd/workflow-manifest.ts +9 -104
- package/src/resources/extensions/gsd/workflow-migration.ts +21 -29
- package/src/resources/extensions/gsd/workflow-projections.ts +8 -1
- package/src/resources/extensions/gsd/workflow-reconcile.ts +15 -15
- /package/dist/web/standalone/.next/static/{5dzOW4v8Vz23I5xRsiNSk → tAsSblRKK1lG7MVOwsO92}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{5dzOW4v8Vz23I5xRsiNSk → tAsSblRKK1lG7MVOwsO92}/_ssgManifest.js +0 -0
package/dist/cli-web-branch.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { launchWebMode, stopWebMode, type WebModeLaunchStatus, type WebModeStopOptions, type WebModeStopResult } from './web-mode.js';
|
|
2
2
|
export interface CliFlags {
|
|
3
|
-
mode?: 'text' | 'json' | 'rpc';
|
|
3
|
+
mode?: 'text' | 'json' | 'rpc' | 'mcp';
|
|
4
4
|
print?: boolean;
|
|
5
5
|
continue?: boolean;
|
|
6
6
|
noSession?: boolean;
|
|
7
|
+
worktree?: boolean | string;
|
|
7
8
|
model?: string;
|
|
8
9
|
listModels?: string | true;
|
|
9
10
|
extensions: string[];
|
|
@@ -19,8 +20,8 @@ export interface CliFlags {
|
|
|
19
20
|
webPort?: number;
|
|
20
21
|
/** Additional allowed origins for CORS: `--allowed-origins http://192.168.1.10:8080` */
|
|
21
22
|
webAllowedOrigins?: string[];
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
/** Set by `gsd sessions` when the user picks a specific session to resume */
|
|
24
|
+
_selectedSessionPath?: string;
|
|
24
25
|
}
|
|
25
26
|
type WritableLike = Pick<typeof process.stderr, 'write'>;
|
|
26
27
|
export interface RunWebCliBranchDeps {
|
package/dist/cli-web-branch.js
CHANGED
|
@@ -10,7 +10,7 @@ export function parseCliArgs(argv) {
|
|
|
10
10
|
const arg = args[i];
|
|
11
11
|
if (arg === '--mode' && i + 1 < args.length) {
|
|
12
12
|
const mode = args[++i];
|
|
13
|
-
if (mode === 'text' || mode === 'json' || mode === 'rpc')
|
|
13
|
+
if (mode === 'text' || mode === 'json' || mode === 'rpc' || mode === 'mcp')
|
|
14
14
|
flags.mode = mode;
|
|
15
15
|
}
|
|
16
16
|
else if (arg === '--print' || arg === '-p') {
|
|
@@ -22,6 +22,15 @@ export function parseCliArgs(argv) {
|
|
|
22
22
|
else if (arg === '--no-session') {
|
|
23
23
|
flags.noSession = true;
|
|
24
24
|
}
|
|
25
|
+
else if (arg === '--worktree' || arg === '-w') {
|
|
26
|
+
// -w with no value → auto-generate name; -w <name> → use that name
|
|
27
|
+
if (i + 1 < args.length && !args[i + 1].startsWith('-')) {
|
|
28
|
+
flags.worktree = args[++i];
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
flags.worktree = true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
25
34
|
else if (arg === '--web') {
|
|
26
35
|
flags.web = true;
|
|
27
36
|
// Peek at next arg — if it looks like a path (not another flag), capture it
|
|
@@ -58,12 +67,6 @@ export function parseCliArgs(argv) {
|
|
|
58
67
|
else if (arg === '--list-models') {
|
|
59
68
|
flags.listModels = (i + 1 < args.length && !args[i + 1].startsWith('-')) ? args[++i] : true;
|
|
60
69
|
}
|
|
61
|
-
else if (arg === '--version' || arg === '-v') {
|
|
62
|
-
flags.version = true;
|
|
63
|
-
}
|
|
64
|
-
else if (arg === '--help' || arg === '-h') {
|
|
65
|
-
flags.help = true;
|
|
66
|
-
}
|
|
67
70
|
else if (!arg.startsWith('--') && !arg.startsWith('-')) {
|
|
68
71
|
flags.messages.push(arg);
|
|
69
72
|
}
|
package/dist/cli.js
CHANGED
|
@@ -5,13 +5,14 @@ import { agentDir, sessionsDir, authFilePath } from './app-paths.js';
|
|
|
5
5
|
import { initResources, buildResourceLoader, getNewerManagedResourceVersion } from './resource-loader.js';
|
|
6
6
|
import { ensureManagedTools } from './tool-bootstrap.js';
|
|
7
7
|
import { loadStoredEnvKeys } from './wizard.js';
|
|
8
|
-
import { migratePiCredentials
|
|
8
|
+
import { migratePiCredentials } from './pi-migration.js';
|
|
9
9
|
import { shouldRunOnboarding, runOnboarding } from './onboarding.js';
|
|
10
10
|
import chalk from 'chalk';
|
|
11
11
|
import { checkForUpdates } from './update-check.js';
|
|
12
12
|
import { printHelp, printSubcommandHelp } from './help-text.js';
|
|
13
13
|
import { applySecurityOverrides } from './security-overrides.js';
|
|
14
|
-
import {
|
|
14
|
+
import { validateConfiguredModel } from './startup-model-validation.js';
|
|
15
|
+
import { parseCliArgs, runWebCliBranch, migrateLegacyFlatSessions, } from './cli-web-branch.js';
|
|
15
16
|
import { stopWebMode } from './web-mode.js';
|
|
16
17
|
import { getProjectSessionsDir } from './project-sessions.js';
|
|
17
18
|
import { markStartup, printStartupTimings } from './startup-timings.js';
|
|
@@ -36,112 +37,85 @@ function exitIfManagedResourcesAreNewer(currentAgentDir) {
|
|
|
36
37
|
`[gsd] Run ${chalk.bold('npm install -g gsd-pi@latest')} or ${chalk.bold('gsd update')}, then try again.\n`);
|
|
37
38
|
process.exit(1);
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
flags.noSession = true;
|
|
57
|
-
}
|
|
58
|
-
else if (arg === '--model' && i + 1 < args.length) {
|
|
59
|
-
flags.model = args[++i];
|
|
60
|
-
}
|
|
61
|
-
else if (arg === '--extension' && i + 1 < args.length) {
|
|
62
|
-
flags.extensions.push(args[++i]);
|
|
63
|
-
}
|
|
64
|
-
else if (arg === '--append-system-prompt' && i + 1 < args.length) {
|
|
65
|
-
flags.appendSystemPrompt = args[++i];
|
|
66
|
-
}
|
|
67
|
-
else if (arg === '--tools' && i + 1 < args.length) {
|
|
68
|
-
flags.tools = args[++i].split(',');
|
|
69
|
-
}
|
|
70
|
-
else if (arg === '--list-models') {
|
|
71
|
-
flags.listModels = (i + 1 < args.length && !args[i + 1].startsWith('-')) ? args[++i] : true;
|
|
72
|
-
}
|
|
73
|
-
else if (arg === '--version' || arg === '-v') {
|
|
74
|
-
process.stdout.write((process.env.GSD_VERSION || '0.0.0') + '\n');
|
|
75
|
-
process.exit(0);
|
|
76
|
-
}
|
|
77
|
-
else if (arg === '--worktree' || arg === '-w') {
|
|
78
|
-
// -w with no value → auto-generate name; -w <name> → use that name
|
|
79
|
-
if (i + 1 < args.length && !args[i + 1].startsWith('-')) {
|
|
80
|
-
flags.worktree = args[++i];
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
flags.worktree = true;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else if (arg === '--help' || arg === '-h') {
|
|
87
|
-
printHelp(process.env.GSD_VERSION || '0.0.0');
|
|
88
|
-
process.exit(0);
|
|
89
|
-
}
|
|
90
|
-
else if (arg === '--web') {
|
|
91
|
-
flags.web = true;
|
|
92
|
-
// Capture optional project path after --web (not a flag)
|
|
93
|
-
if (i + 1 < args.length && !args[i + 1].startsWith('-')) {
|
|
94
|
-
flags.webPath = args[++i];
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
else if (!arg.startsWith('--') && !arg.startsWith('-')) {
|
|
98
|
-
flags.messages.push(arg);
|
|
99
|
-
}
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// Shared helpers used by both the print and interactive code paths
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
/**
|
|
44
|
+
* Print the non-interactive-mode error and exit. Called both from the early
|
|
45
|
+
* TTY gate (before heavy init) and from the interactive-mode TTY gate right
|
|
46
|
+
* before `InteractiveMode.run()`. The `includeWebHint` variant also lists
|
|
47
|
+
* `--web` and `headless` as alternatives.
|
|
48
|
+
*/
|
|
49
|
+
function printNonTtyErrorAndExit(missing, includeWebHint) {
|
|
50
|
+
const suffix = missing ? ` but ${missing} not a TTY` : '';
|
|
51
|
+
process.stderr.write(`[gsd] Error: Interactive mode requires a terminal (TTY)${suffix}.\n`);
|
|
52
|
+
process.stderr.write('[gsd] Non-interactive alternatives:\n');
|
|
53
|
+
process.stderr.write('[gsd] gsd auto Auto-mode (pipeable, no TUI)\n');
|
|
54
|
+
process.stderr.write('[gsd] gsd --print "your message" Single-shot prompt\n');
|
|
55
|
+
if (includeWebHint) {
|
|
56
|
+
process.stderr.write('[gsd] gsd --web [path] Browser-only web mode\n');
|
|
100
57
|
}
|
|
101
|
-
|
|
58
|
+
process.stderr.write('[gsd] gsd --mode rpc JSON-RPC over stdin/stdout\n');
|
|
59
|
+
process.stderr.write('[gsd] gsd --mode mcp MCP server over stdin/stdout\n');
|
|
60
|
+
process.stderr.write('[gsd] gsd --mode text "message" Text output mode\n');
|
|
61
|
+
if (includeWebHint) {
|
|
62
|
+
process.stderr.write('[gsd] gsd headless Auto-mode without TUI\n');
|
|
63
|
+
}
|
|
64
|
+
process.exit(1);
|
|
102
65
|
}
|
|
103
66
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* providers so that extension models (e.g. pi-claude-cli) are visible.
|
|
67
|
+
* Print extension load/conflict errors from an extensions result. Downgrades
|
|
68
|
+
* conflicts with built-in tools to warnings (#1347).
|
|
107
69
|
*/
|
|
108
|
-
function
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
70
|
+
function printExtensionErrors(errors) {
|
|
71
|
+
for (const err of errors) {
|
|
72
|
+
const isConflict = err.error.includes('supersedes') || err.error.includes('conflicts with');
|
|
73
|
+
const prefix = isConflict ? 'Extension conflict' : 'Extension load error';
|
|
74
|
+
process.stderr.write(`[gsd] ${prefix}: ${err.error}\n`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Re-apply the validated model to the session when `createAgentSession()`
|
|
79
|
+
* reports that it had to use a fallback. Prevents silently overriding the
|
|
80
|
+
* persisted model of resumed conversations (#3534).
|
|
81
|
+
*/
|
|
82
|
+
async function reapplyValidatedModelOnFallback(session, modelRegistry, settingsManager, fallbackMessage) {
|
|
83
|
+
if (!fallbackMessage)
|
|
84
|
+
return;
|
|
85
|
+
const validatedProvider = settingsManager.getDefaultProvider();
|
|
86
|
+
const validatedModelId = settingsManager.getDefaultModel();
|
|
87
|
+
if (!validatedProvider || !validatedModelId)
|
|
88
|
+
return;
|
|
89
|
+
const correctModel = modelRegistry.getAvailable()
|
|
90
|
+
.find((m) => m.provider === validatedProvider && m.id === validatedModelId);
|
|
91
|
+
if (!correctModel)
|
|
92
|
+
return;
|
|
93
|
+
try {
|
|
94
|
+
await session.setModel(correctModel);
|
|
133
95
|
}
|
|
134
|
-
|
|
135
|
-
|
|
96
|
+
catch {
|
|
97
|
+
// Provider not ready — leave session on its current model
|
|
136
98
|
}
|
|
137
99
|
}
|
|
138
100
|
const cliFlags = parseCliArgs(process.argv);
|
|
139
101
|
const isPrintMode = cliFlags.print || cliFlags.mode !== undefined;
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
102
|
+
// `gsd [subcommand] --help` / `-h` — print help before any subcommand runs.
|
|
103
|
+
// loader.ts only catches --help/-h as the *first* arg; here we handle the
|
|
104
|
+
// case where it appears later (e.g. `gsd update --help`, `gsd --foo --help`).
|
|
105
|
+
// Prefer subcommand-specific help when the first positional is a known
|
|
106
|
+
// subcommand, otherwise fall back to general help.
|
|
107
|
+
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
108
|
+
const helpSubcommand = cliFlags.messages[0];
|
|
109
|
+
const version = process.env.GSD_VERSION || '0.0.0';
|
|
110
|
+
if (!helpSubcommand || !printSubcommandHelp(helpSubcommand, version)) {
|
|
111
|
+
printHelp(version);
|
|
112
|
+
}
|
|
113
|
+
process.exit(0);
|
|
114
|
+
}
|
|
115
|
+
// RTK bootstrap — runs once per process, memoized via a module-level promise
|
|
116
|
+
// so concurrent callers await the same initialization.
|
|
117
|
+
let rtkBootstrapPromise;
|
|
118
|
+
async function doRtkBootstrap() {
|
|
145
119
|
// RTK is opt-in via experimental.rtk preference. Default: disabled.
|
|
146
120
|
// Honor GSD_RTK_DISABLED if already explicitly set in the environment
|
|
147
121
|
// (env var takes precedence over preferences for manual override).
|
|
@@ -149,16 +123,18 @@ async function ensureRtkBootstrap() {
|
|
|
149
123
|
const prefs = loadEffectiveGSDPreferences();
|
|
150
124
|
const rtkEnabled = prefs?.preferences.experimental?.rtk === true;
|
|
151
125
|
if (!rtkEnabled) {
|
|
152
|
-
process.env[GSD_RTK_DISABLED_ENV] =
|
|
126
|
+
process.env[GSD_RTK_DISABLED_ENV] = '1';
|
|
153
127
|
}
|
|
154
128
|
}
|
|
155
129
|
const rtkStatus = await bootstrapRtk();
|
|
156
|
-
ensureRtkBootstrap._done = true;
|
|
157
130
|
markStartup('bootstrapRtk');
|
|
158
131
|
if (!rtkStatus.available && rtkStatus.supported && rtkStatus.enabled && rtkStatus.reason) {
|
|
159
132
|
process.stderr.write(`[gsd] Warning: RTK unavailable — continuing without shell-command compression (${rtkStatus.reason}).\n`);
|
|
160
133
|
}
|
|
161
134
|
}
|
|
135
|
+
function ensureRtkBootstrap() {
|
|
136
|
+
return (rtkBootstrapPromise ??= doRtkBootstrap());
|
|
137
|
+
}
|
|
162
138
|
// `gsd update` — update to the latest version via npm
|
|
163
139
|
if (cliFlags.messages[0] === 'update') {
|
|
164
140
|
const { runUpdate } = await import('./update-cmd.js');
|
|
@@ -170,21 +146,7 @@ exitIfManagedResourcesAreNewer(agentDir);
|
|
|
170
146
|
// handles that prevent process.exit() from completing promptly.
|
|
171
147
|
const hasSubcommand = cliFlags.messages.length > 0;
|
|
172
148
|
if (!process.stdin.isTTY && !isPrintMode && !hasSubcommand && !cliFlags.listModels && !cliFlags.web) {
|
|
173
|
-
|
|
174
|
-
process.stderr.write('[gsd] Non-interactive alternatives:\n');
|
|
175
|
-
process.stderr.write('[gsd] gsd auto Auto-mode (pipeable, no TUI)\n');
|
|
176
|
-
process.stderr.write('[gsd] gsd --print "your message" Single-shot prompt\n');
|
|
177
|
-
process.stderr.write('[gsd] gsd --mode rpc JSON-RPC over stdin/stdout\n');
|
|
178
|
-
process.stderr.write('[gsd] gsd --mode mcp MCP server over stdin/stdout\n');
|
|
179
|
-
process.stderr.write('[gsd] gsd --mode text "message" Text output mode\n');
|
|
180
|
-
process.exit(1);
|
|
181
|
-
}
|
|
182
|
-
// `gsd <subcommand> --help` — show subcommand-specific help
|
|
183
|
-
const subcommand = cliFlags.messages[0];
|
|
184
|
-
if (subcommand && process.argv.includes('--help')) {
|
|
185
|
-
if (printSubcommandHelp(subcommand, process.env.GSD_VERSION || '0.0.0')) {
|
|
186
|
-
process.exit(0);
|
|
187
|
-
}
|
|
149
|
+
printNonTtyErrorAndExit(undefined, false);
|
|
188
150
|
}
|
|
189
151
|
const packageCommand = await runPackageCommand({
|
|
190
152
|
appName: 'gsd',
|
|
@@ -207,8 +169,7 @@ if (cliFlags.messages[0] === 'config') {
|
|
|
207
169
|
}
|
|
208
170
|
// `gsd web stop [path|all]` — stop web server before anything else
|
|
209
171
|
if (cliFlags.messages[0] === 'web' && cliFlags.messages[1] === 'stop') {
|
|
210
|
-
const
|
|
211
|
-
const webBranch = await runWebCliBranch(webFlags, {
|
|
172
|
+
const webBranch = await runWebCliBranch(cliFlags, {
|
|
212
173
|
stopWebMode,
|
|
213
174
|
stderr: process.stderr,
|
|
214
175
|
baseSessionsDir: sessionsDir,
|
|
@@ -221,8 +182,7 @@ if (cliFlags.messages[0] === 'web' && cliFlags.messages[1] === 'stop') {
|
|
|
221
182
|
// `gsd --web [path]` or `gsd web [start] [path]` — launch browser-only web mode
|
|
222
183
|
if (cliFlags.web || (cliFlags.messages[0] === 'web' && cliFlags.messages[1] !== 'stop')) {
|
|
223
184
|
await ensureRtkBootstrap();
|
|
224
|
-
const
|
|
225
|
-
const webBranch = await runWebCliBranch(webFlags, {
|
|
185
|
+
const webBranch = await runWebCliBranch(cliFlags, {
|
|
226
186
|
stderr: process.stderr,
|
|
227
187
|
baseSessionsDir: sessionsDir,
|
|
228
188
|
agentDir,
|
|
@@ -297,21 +257,23 @@ if (cliFlags.messages[0] === 'headless') {
|
|
|
297
257
|
await runHeadless(parseHeadlessArgs(process.argv));
|
|
298
258
|
process.exit(0);
|
|
299
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Run a headless command by invoking the headless entrypoint with a synthetic
|
|
262
|
+
* argv. Shared by the `auto` shorthand (#2732) and the auto-piped-stdout
|
|
263
|
+
* redirect so they use the same bootstrap + dynamic-import dance.
|
|
264
|
+
*/
|
|
265
|
+
async function runHeadlessFromAuto(headlessArgs) {
|
|
266
|
+
await ensureRtkBootstrap();
|
|
267
|
+
const { runHeadless, parseHeadlessArgs } = await import('./headless.js');
|
|
268
|
+
const argv = [process.argv[0], process.argv[1], 'headless', ...headlessArgs];
|
|
269
|
+
await runHeadless(parseHeadlessArgs(argv));
|
|
270
|
+
process.exit(0);
|
|
271
|
+
}
|
|
300
272
|
// `gsd auto [args...]` — shorthand for `gsd headless auto [args...]` (#2732)
|
|
301
273
|
// Without this, `gsd auto` falls through to the interactive TUI which hangs
|
|
302
274
|
// when stdin/stdout are piped (non-TTY environments).
|
|
303
275
|
if (cliFlags.messages[0] === 'auto') {
|
|
304
|
-
await
|
|
305
|
-
const { runHeadless, parseHeadlessArgs } = await import('./headless.js');
|
|
306
|
-
// Rewrite argv so parseHeadlessArgs sees: [node, gsd, headless, auto, ...rest]
|
|
307
|
-
const rewrittenArgv = [
|
|
308
|
-
process.argv[0],
|
|
309
|
-
process.argv[1],
|
|
310
|
-
'headless',
|
|
311
|
-
...cliFlags.messages, // ['auto', ...extra args]
|
|
312
|
-
];
|
|
313
|
-
await runHeadless(parseHeadlessArgs(rewrittenArgv));
|
|
314
|
-
process.exit(0);
|
|
276
|
+
await runHeadlessFromAuto(cliFlags.messages);
|
|
315
277
|
}
|
|
316
278
|
// Pi's tool bootstrap can mis-detect already-installed fd/rg on some systems
|
|
317
279
|
// because spawnSync(..., ["--version"]) returns EPERM despite a zero exit code.
|
|
@@ -458,37 +420,8 @@ if (isPrintMode) {
|
|
|
458
420
|
// Before this, extension-provided models (e.g. claude-code/*) were not yet in the
|
|
459
421
|
// registry, causing the user's valid choice to be silently overwritten.
|
|
460
422
|
validateConfiguredModel(modelRegistry, settingsManager);
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
// overriding the persisted model of resumed conversations (#3534).
|
|
464
|
-
if (modelFallbackMessage) {
|
|
465
|
-
const validatedProvider = settingsManager.getDefaultProvider();
|
|
466
|
-
const validatedModelId = settingsManager.getDefaultModel();
|
|
467
|
-
if (validatedProvider && validatedModelId) {
|
|
468
|
-
const correctModel = modelRegistry.getAvailable()
|
|
469
|
-
.find((m) => m.provider === validatedProvider && m.id === validatedModelId);
|
|
470
|
-
if (correctModel) {
|
|
471
|
-
try {
|
|
472
|
-
await session.setModel(correctModel);
|
|
473
|
-
}
|
|
474
|
-
catch {
|
|
475
|
-
// Provider not ready — leave session on its current model
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
if (extensionsResult.errors.length > 0) {
|
|
481
|
-
for (const err of extensionsResult.errors) {
|
|
482
|
-
// Downgrade conflicts with built-in tools to warnings (#1347)
|
|
483
|
-
const isConflict = err.error.includes("supersedes") || err.error.includes("conflicts with");
|
|
484
|
-
const prefix = isConflict ? "Extension conflict" : "Extension load error";
|
|
485
|
-
process.stderr.write(`[gsd] ${prefix}: ${err.error}\n`);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
// Validate configured model now that extension providers are registered.
|
|
489
|
-
// Must run after createAgentSession() which flushes pendingProviderRegistrations
|
|
490
|
-
// so extension models (e.g. pi-claude-cli) are visible in the registry.
|
|
491
|
-
validateConfiguredModel(modelRegistry, settingsManager);
|
|
423
|
+
await reapplyValidatedModelOnFallback(session, modelRegistry, settingsManager, modelFallbackMessage);
|
|
424
|
+
printExtensionErrors(extensionsResult.errors);
|
|
492
425
|
// Apply --model override if specified
|
|
493
426
|
if (cliFlags.model) {
|
|
494
427
|
const available = modelRegistry.getAvailable();
|
|
@@ -579,11 +512,8 @@ if (!cliFlags.worktree && !isPrintMode) {
|
|
|
579
512
|
// which handles non-interactive output gracefully.
|
|
580
513
|
// ---------------------------------------------------------------------------
|
|
581
514
|
if (cliFlags.messages[0] === 'auto' && !process.stdout.isTTY) {
|
|
582
|
-
await ensureRtkBootstrap();
|
|
583
|
-
const { runHeadless, parseHeadlessArgs } = await import('./headless.js');
|
|
584
515
|
process.stderr.write('[gsd] stdout is not a terminal — running auto-mode in headless mode.\n');
|
|
585
|
-
await
|
|
586
|
-
process.exit(0);
|
|
516
|
+
await runHeadlessFromAuto(cliFlags.messages.slice(1));
|
|
587
517
|
}
|
|
588
518
|
// ---------------------------------------------------------------------------
|
|
589
519
|
// Interactive mode — normal TTY session
|
|
@@ -627,36 +557,8 @@ markStartup('createAgentSession');
|
|
|
627
557
|
// Before this, extension-provided models (e.g. claude-code/*) were not yet in the
|
|
628
558
|
// registry, causing the user's valid choice to be silently overwritten.
|
|
629
559
|
validateConfiguredModel(modelRegistry, settingsManager);
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
// overriding the persisted model of resumed conversations (#3534).
|
|
633
|
-
if (interactiveFallbackMsg) {
|
|
634
|
-
const validatedProvider = settingsManager.getDefaultProvider();
|
|
635
|
-
const validatedModelId = settingsManager.getDefaultModel();
|
|
636
|
-
if (validatedProvider && validatedModelId) {
|
|
637
|
-
const correctModel = modelRegistry.getAvailable()
|
|
638
|
-
.find((m) => m.provider === validatedProvider && m.id === validatedModelId);
|
|
639
|
-
if (correctModel) {
|
|
640
|
-
try {
|
|
641
|
-
await session.setModel(correctModel);
|
|
642
|
-
}
|
|
643
|
-
catch {
|
|
644
|
-
// Provider not ready — leave session on its current model
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
if (extensionsResult.errors.length > 0) {
|
|
650
|
-
for (const err of extensionsResult.errors) {
|
|
651
|
-
const isConflict = err.error.includes("supersedes") || err.error.includes("conflicts with");
|
|
652
|
-
const prefix = isConflict ? "Extension conflict" : "Extension load error";
|
|
653
|
-
process.stderr.write(`[gsd] ${prefix}: ${err.error}\n`);
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
// Validate configured model now that extension providers are registered.
|
|
657
|
-
// Must run after createAgentSession() which flushes pendingProviderRegistrations
|
|
658
|
-
// so extension models (e.g. pi-claude-cli) are visible in the registry.
|
|
659
|
-
validateConfiguredModel(modelRegistry, settingsManager);
|
|
560
|
+
await reapplyValidatedModelOnFallback(session, modelRegistry, settingsManager, interactiveFallbackMsg);
|
|
561
|
+
printExtensionErrors(extensionsResult.errors);
|
|
660
562
|
// Restore scoped models from settings on startup.
|
|
661
563
|
// The upstream InteractiveMode reads enabledModels from settings when /scoped-models is opened,
|
|
662
564
|
// but doesn't apply them to the session at startup — so Ctrl+P cycles all models instead of
|
|
@@ -704,16 +606,7 @@ if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
|
704
606
|
: !process.stdin.isTTY
|
|
705
607
|
? 'stdin is'
|
|
706
608
|
: 'stdout is';
|
|
707
|
-
|
|
708
|
-
process.stderr.write('[gsd] Non-interactive alternatives:\n');
|
|
709
|
-
process.stderr.write('[gsd] gsd auto Auto-mode (pipeable, no TUI)\n');
|
|
710
|
-
process.stderr.write('[gsd] gsd --print "your message" Single-shot prompt\n');
|
|
711
|
-
process.stderr.write('[gsd] gsd --web [path] Browser-only web mode\n');
|
|
712
|
-
process.stderr.write('[gsd] gsd --mode rpc JSON-RPC over stdin/stdout\n');
|
|
713
|
-
process.stderr.write('[gsd] gsd --mode mcp MCP server over stdin/stdout\n');
|
|
714
|
-
process.stderr.write('[gsd] gsd --mode text "message" Text output mode\n');
|
|
715
|
-
process.stderr.write('[gsd] gsd headless Auto-mode without TUI\n');
|
|
716
|
-
process.exit(1);
|
|
609
|
+
printNonTtyErrorAndExit(missing, true);
|
|
717
610
|
}
|
|
718
611
|
// Welcome screen — shown on every fresh interactive session before TUI takes over.
|
|
719
612
|
// Skip when the first-run banner was already printed in loader.ts (prevents double banner).
|
package/dist/headless-query.js
CHANGED
|
@@ -33,7 +33,9 @@ async function loadExtensionModules() {
|
|
|
33
33
|
const dispatchModule = await jiti.import(gsdExtensionPath('auto-dispatch.ts'), {});
|
|
34
34
|
const sessionModule = await jiti.import(gsdExtensionPath('session-status-io.ts'), {});
|
|
35
35
|
const prefsModule = await jiti.import(gsdExtensionPath('preferences.ts'), {});
|
|
36
|
+
const autoStartModule = await jiti.import(gsdExtensionPath('auto-start.ts'), {});
|
|
36
37
|
return {
|
|
38
|
+
openProjectDbIfPresent: autoStartModule.openProjectDbIfPresent,
|
|
37
39
|
deriveState: stateModule.deriveState,
|
|
38
40
|
resolveDispatch: dispatchModule.resolveDispatch,
|
|
39
41
|
readAllSessionStatuses: sessionModule.readAllSessionStatuses,
|
|
@@ -42,7 +44,8 @@ async function loadExtensionModules() {
|
|
|
42
44
|
}
|
|
43
45
|
// ─── Implementation ─────────────────────────────────────────────────────────
|
|
44
46
|
export async function handleQuery(basePath) {
|
|
45
|
-
const { deriveState, resolveDispatch, readAllSessionStatuses, loadEffectiveGSDPreferences } = await loadExtensionModules();
|
|
47
|
+
const { openProjectDbIfPresent, deriveState, resolveDispatch, readAllSessionStatuses, loadEffectiveGSDPreferences, } = await loadExtensionModules();
|
|
48
|
+
await openProjectDbIfPresent(basePath);
|
|
46
49
|
const state = await deriveState(basePath);
|
|
47
50
|
// Derive next dispatch action
|
|
48
51
|
let next;
|
package/dist/logo.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const GSD_LOGO: readonly string[];
|
|
|
10
10
|
/**
|
|
11
11
|
* Render the logo block with a color function applied to each line.
|
|
12
12
|
*
|
|
13
|
-
* @param color — e.g. `(s) => `\x1b[36m${s}\x1b[0m`` or
|
|
13
|
+
* @param color — e.g. `(s) => `\x1b[36m${s}\x1b[0m`` or chalk.cyan
|
|
14
14
|
* @returns Ready-to-write string with leading/trailing newlines.
|
|
15
15
|
*/
|
|
16
16
|
export declare function renderLogo(color: (s: string) => string): string;
|
package/dist/logo.js
CHANGED
|
@@ -17,7 +17,7 @@ export const GSD_LOGO = [
|
|
|
17
17
|
/**
|
|
18
18
|
* Render the logo block with a color function applied to each line.
|
|
19
19
|
*
|
|
20
|
-
* @param color — e.g. `(s) => `\x1b[36m${s}\x1b[0m`` or
|
|
20
|
+
* @param color — e.g. `(s) => `\x1b[36m${s}\x1b[0m`` or chalk.cyan
|
|
21
21
|
* @returns Ready-to-write string with leading/trailing newlines.
|
|
22
22
|
*/
|
|
23
23
|
export function renderLogo(color) {
|