gsd-pi 2.75.0-dev.2203010a0 → 2.75.0-dev.96d4bb599

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/onboarding.d.ts +5 -1
  2. package/dist/onboarding.js +5 -3
  3. package/dist/resources/extensions/gsd/auto-model-selection.js +1 -1
  4. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +23 -19
  5. package/dist/resources/extensions/gsd/bootstrap/memory-tools.js +128 -0
  6. package/dist/resources/extensions/gsd/bootstrap/register-extension.js +2 -0
  7. package/dist/resources/extensions/gsd/bootstrap/system-context.js +17 -4
  8. package/dist/resources/extensions/gsd/commands/handlers/onboarding.js +52 -68
  9. package/dist/resources/extensions/gsd/commands/handlers/ops.js +5 -0
  10. package/dist/resources/extensions/gsd/commands-memory.js +462 -0
  11. package/dist/resources/extensions/gsd/gsd-db.js +237 -4
  12. package/dist/resources/extensions/gsd/memory-embeddings.js +219 -0
  13. package/dist/resources/extensions/gsd/memory-extractor.js +78 -27
  14. package/dist/resources/extensions/gsd/memory-ingest.js +218 -0
  15. package/dist/resources/extensions/gsd/memory-relations.js +189 -0
  16. package/dist/resources/extensions/gsd/memory-source-store.js +113 -0
  17. package/dist/resources/extensions/gsd/memory-store.js +299 -6
  18. package/dist/resources/extensions/gsd/model-router.js +9 -5
  19. package/dist/resources/extensions/gsd/notification-overlay.js +7 -22
  20. package/dist/resources/extensions/gsd/tools/memory-tools.js +306 -0
  21. package/dist/resources/extensions/gsd/tools/skip-slice.js +78 -0
  22. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  23. package/dist/web/standalone/.next/BUILD_ID +1 -1
  24. package/dist/web/standalone/.next/app-path-routes-manifest.json +14 -14
  25. package/dist/web/standalone/.next/build-manifest.json +2 -2
  26. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  27. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  28. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  29. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  30. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  31. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  32. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  33. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  34. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  35. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  36. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  37. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  38. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  39. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  40. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  41. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  42. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  43. package/dist/web/standalone/.next/server/app/index.html +1 -1
  44. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  45. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  46. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  47. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  48. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  49. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  50. package/dist/web/standalone/.next/server/app-paths-manifest.json +14 -14
  51. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  52. package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
  53. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  54. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  55. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  56. package/package.json +1 -1
  57. package/packages/mcp-server/dist/server.d.ts.map +1 -1
  58. package/packages/mcp-server/dist/server.js +12 -10
  59. package/packages/mcp-server/dist/server.js.map +1 -1
  60. package/packages/mcp-server/dist/session-manager.d.ts.map +1 -1
  61. package/packages/mcp-server/dist/session-manager.js +8 -1
  62. package/packages/mcp-server/dist/session-manager.js.map +1 -1
  63. package/packages/mcp-server/dist/workflow-tools.d.ts +1 -0
  64. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  65. package/packages/mcp-server/dist/workflow-tools.js +113 -14
  66. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  67. package/packages/mcp-server/src/mcp-server.test.ts +40 -4
  68. package/packages/mcp-server/src/server.ts +12 -10
  69. package/packages/mcp-server/src/session-manager.ts +10 -3
  70. package/packages/mcp-server/src/workflow-tools.test.ts +91 -1
  71. package/packages/mcp-server/src/workflow-tools.ts +128 -18
  72. package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
  73. package/src/resources/extensions/gsd/auto-model-selection.ts +1 -1
  74. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +24 -20
  75. package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +158 -0
  76. package/src/resources/extensions/gsd/bootstrap/register-extension.ts +2 -0
  77. package/src/resources/extensions/gsd/bootstrap/system-context.ts +20 -4
  78. package/src/resources/extensions/gsd/commands/handlers/onboarding.ts +65 -98
  79. package/src/resources/extensions/gsd/commands/handlers/ops.ts +5 -0
  80. package/src/resources/extensions/gsd/commands-memory.ts +551 -0
  81. package/src/resources/extensions/gsd/gsd-db.ts +273 -4
  82. package/src/resources/extensions/gsd/memory-embeddings.ts +235 -0
  83. package/src/resources/extensions/gsd/memory-extractor.ts +100 -34
  84. package/src/resources/extensions/gsd/memory-ingest.ts +286 -0
  85. package/src/resources/extensions/gsd/memory-relations.ts +240 -0
  86. package/src/resources/extensions/gsd/memory-source-store.ts +138 -0
  87. package/src/resources/extensions/gsd/memory-store.ts +351 -7
  88. package/src/resources/extensions/gsd/model-router.ts +10 -5
  89. package/src/resources/extensions/gsd/notification-overlay.ts +9 -19
  90. package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +12 -0
  91. package/src/resources/extensions/gsd/tests/complete-slice.test.ts +2 -2
  92. package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
  93. package/src/resources/extensions/gsd/tests/escalation.test.ts +2 -2
  94. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +1 -1
  95. package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
  96. package/src/resources/extensions/gsd/tests/memory-embeddings.test.ts +213 -0
  97. package/src/resources/extensions/gsd/tests/memory-ingest.test.ts +153 -0
  98. package/src/resources/extensions/gsd/tests/memory-maintenance.test.ts +107 -0
  99. package/src/resources/extensions/gsd/tests/memory-relations.test.ts +175 -0
  100. package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
  101. package/src/resources/extensions/gsd/tests/memory-tools.test.ts +295 -0
  102. package/src/resources/extensions/gsd/tests/model-router.test.ts +50 -0
  103. package/src/resources/extensions/gsd/tests/notification-overlay.test.ts +56 -37
  104. package/src/resources/extensions/gsd/tests/skip-slice-cascades-tasks.test.ts +125 -0
  105. package/src/resources/extensions/gsd/tools/memory-tools.ts +380 -0
  106. package/src/resources/extensions/gsd/tools/skip-slice.ts +133 -0
  107. package/src/resources/extensions/gsd/workflow-logger.ts +3 -1
  108. /package/dist/web/standalone/.next/static/{8FZqxNe9FxQDmsbRzR8tA → o61X3klsB6C0UE0X1x3PA}/_buildManifest.js +0 -0
  109. /package/dist/web/standalone/.next/static/{8FZqxNe9FxQDmsbRzR8tA → o61X3klsB6C0UE0X1x3PA}/_ssgManifest.js +0 -0
@@ -1,17 +1,19 @@
1
- // GSD — /gsd onboarding command handler (re-entry, --resume, --reset, --step)
1
+ // GSD — /gsd onboarding command handler (re-entry hub)
2
2
  //
3
- // Provides the discoverable re-entry point for the onboarding wizard. The
4
- // first-run wizard in src/onboarding.ts is hidden behind shouldRunOnboarding;
5
- // this handler lets users re-launch it on demand.
3
+ // The first-run wizard in src/onboarding.ts uses @clack/prompts and takes over
4
+ // raw stdin. Running it from inside the pi-coding-agent TUI wedges the TUI
5
+ // (clack leaves stdin paused + cooked, pi-tui's data handler then receives no
6
+ // keypresses). So re-entry cannot replay the clack wizard — instead it routes
7
+ // to a setup hub built from ctx.ui.select, which the TUI owns.
8
+ //
9
+ // Clack-only steps (llm/search/remote/tool-keys via the first-run wizard) are
10
+ // surfaced as notifications pointing the user at the canonical per-step
11
+ // commands (/login, /gsd keys, /gsd remote) that are already ctx.ui-safe.
6
12
 
7
13
  import type { ExtensionCommandContext } from "@gsd/pi-coding-agent"
8
- import { AuthStorage } from "@gsd/pi-coding-agent"
9
- import { homedir } from "node:os"
10
- import { join } from "node:path"
11
14
  import {
12
15
  ONBOARDING_STEPS,
13
16
  isValidStepId,
14
- nearestResumeStep,
15
17
  type OnboardingStepId,
16
18
  } from "../../setup-catalog.js"
17
19
  import {
@@ -20,37 +22,7 @@ import {
20
22
  resetOnboarding,
21
23
  } from "../../onboarding-state.js"
22
24
 
23
- // Inline auth path (mirrors src/app-paths.ts) — keep this module rootDir-clean
24
- // for the resources tsconfig. Importing from src/ pulls files outside
25
- // src/resources and breaks the build.
26
- const AUTH_FILE_PATH = join(
27
- process.env.GSD_CODING_AGENT_DIR ||
28
- join(process.env.GSD_HOME || join(homedir(), ".gsd"), "agent"),
29
- "auth.json",
30
- )
31
-
32
- /**
33
- * Dynamic import shim for the first-run wizard.
34
- *
35
- * src/onboarding.ts lives outside the resources rootDir, so a static import
36
- * pulls it into this tsconfig project and triggers TS6059. We resolve the
37
- * specifier through a variable + opaque type so TS can't pull the file at
38
- * compile time; the path resolves correctly at runtime via dist/onboarding.js.
39
- */
40
- type FirstRunWizardModule = {
41
- runOnboarding: (storage: AuthStorage) => Promise<void>
42
- runLlmStep: (...args: unknown[]) => Promise<unknown>
43
- runWebSearchStep: (...args: unknown[]) => Promise<unknown>
44
- runRemoteQuestionsStep: (...args: unknown[]) => Promise<unknown>
45
- runToolKeysStep: (...args: unknown[]) => Promise<unknown>
46
- }
47
- async function loadFirstRunWizard(): Promise<FirstRunWizardModule> {
48
- const specifier = "../../../../../onboarding.js"
49
- return (await import(/* @vite-ignore */ specifier)) as FirstRunWizardModule
50
- }
51
-
52
25
  interface ParsedArgs {
53
- resume: boolean
54
26
  reset: boolean
55
27
  step: string | null
56
28
  stepValid: boolean | null
@@ -58,11 +30,13 @@ interface ParsedArgs {
58
30
 
59
31
  function parseArgs(raw: string): ParsedArgs {
60
32
  const tokens = raw.split(/\s+/).filter(Boolean)
61
- const out: ParsedArgs = { resume: false, reset: false, step: null, stepValid: null }
33
+ const out: ParsedArgs = { reset: false, step: null, stepValid: null }
62
34
  for (let i = 0; i < tokens.length; i++) {
63
35
  const t = tokens[i]
64
- if (t === "--resume" || t === "resume") out.resume = true
65
- else if (t === "--reset" || t === "reset") out.reset = true
36
+ if (t === "--reset" || t === "reset") out.reset = true
37
+ else if (t === "--resume" || t === "resume") {
38
+ // Re-entry no longer replays the wizard; --resume collapses into the hub.
39
+ }
66
40
  else if (t === "--step" || t === "step") {
67
41
  const next = tokens[i + 1]
68
42
  if (next) {
@@ -79,52 +53,39 @@ function parseArgs(raw: string): ParsedArgs {
79
53
  return out
80
54
  }
81
55
 
82
- async function getAuthStorage(): Promise<AuthStorage> {
83
- return AuthStorage.create(AUTH_FILE_PATH)
84
- }
85
-
86
- async function runWholeWizard(ctx: ExtensionCommandContext, fromStep?: OnboardingStepId): Promise<void> {
87
- const authStorage = await getAuthStorage()
88
- // The first-run wizard ignores the resume hint today — it always walks the
89
- // full sequence with skip prompts. We still mark completion at the end and
90
- // record the resume hint for next time. This keeps the wizard linear and
91
- // simple; per-step jump support comes via --step.
92
- if (fromStep) {
93
- ctx.ui.notify(
94
- `Resuming from step: ${fromStep}. The wizard runs all remaining steps; press skip on any you've already configured.`,
95
- "info",
96
- )
97
- }
98
- const { runOnboarding } = await loadFirstRunWizard()
99
- await runOnboarding(authStorage)
100
- }
101
-
102
- async function runSingleStep(ctx: ExtensionCommandContext, stepId: OnboardingStepId): Promise<void> {
103
- const authStorage = await getAuthStorage()
104
- const ob = await loadFirstRunWizard()
105
- // Lazy-load clack + chalk via the same path the wizard uses
106
- const p = await import("@clack/prompts")
107
- const { default: chalk } = await import("chalk")
108
- const pc = {
109
- cyan: chalk.cyan, green: chalk.green, yellow: chalk.yellow,
110
- dim: chalk.dim, bold: chalk.bold, red: chalk.red, reset: chalk.reset,
111
- }
56
+ // ─── Per-step routing ────────────────────────────────────────────────────────
57
+ //
58
+ // Clack-based steps are surfaced as notifications — running them inline from
59
+ // the TUI would wedge stdin (see header comment). Everything else routes to an
60
+ // existing ctx.ui-safe handler.
112
61
 
62
+ async function runStep(ctx: ExtensionCommandContext, stepId: OnboardingStepId): Promise<void> {
113
63
  switch (stepId) {
114
64
  case "llm":
115
- await ob.runLlmStep(p as any, pc as any, authStorage)
65
+ ctx.ui.notify(
66
+ "LLM provider setup: run /login to sign in via OAuth, or /gsd keys add to paste an API key.",
67
+ "info",
68
+ )
116
69
  return
117
70
  case "search":
118
- await ob.runWebSearchStep(p as any, pc as any, authStorage, false)
71
+ ctx.ui.notify(
72
+ "Web search setup: run /gsd keys add and pick a search provider (brave, tavily, etc.).",
73
+ "info",
74
+ )
119
75
  return
120
76
  case "remote":
121
- await ob.runRemoteQuestionsStep(p as any, pc as any, authStorage)
77
+ ctx.ui.notify(
78
+ "Remote questions setup: run /gsd remote to configure Discord / Slack / Telegram notifications.",
79
+ "info",
80
+ )
122
81
  return
123
82
  case "tool-keys":
124
- await ob.runToolKeysStep(p as any, pc as any, authStorage)
83
+ ctx.ui.notify(
84
+ "Tool keys setup: run /gsd keys add to save API keys for Context7, Jina, Groq voice, etc.",
85
+ "info",
86
+ )
125
87
  return
126
88
  case "model": {
127
- // Delegate to /gsd model picker
128
89
  const { handleCoreCommand } = await import("./core.js")
129
90
  await handleCoreCommand("model", ctx)
130
91
  return
@@ -137,7 +98,6 @@ async function runSingleStep(ctx: ExtensionCommandContext, stepId: OnboardingSte
137
98
  return
138
99
  }
139
100
  case "doctor": {
140
- // Best-effort: surface provider doctor results inline
141
101
  try {
142
102
  const { runProviderDoctor } = await import("../../doctor-providers.js") as any
143
103
  if (typeof runProviderDoctor === "function") {
@@ -148,10 +108,9 @@ async function runSingleStep(ctx: ExtensionCommandContext, stepId: OnboardingSte
148
108
  ctx.ui.notify("Run /gsd doctor to validate your setup.", "info")
149
109
  return
150
110
  }
151
- case "skills": {
152
- ctx.ui.notify("Skill install runs automatically during /gsd init. Use /gsd init or /skill manage.", "info")
111
+ case "skills":
112
+ ctx.ui.notify("Skill install runs during /gsd init. Use /gsd init or /skill manage.", "info")
153
113
  return
154
- }
155
114
  case "project": {
156
115
  const { handleCoreCommand } = await import("./core.js")
157
116
  await handleCoreCommand("init", ctx)
@@ -160,6 +119,27 @@ async function runSingleStep(ctx: ExtensionCommandContext, stepId: OnboardingSte
160
119
  }
161
120
  }
162
121
 
122
+ // ─── Setup hub ───────────────────────────────────────────────────────────────
123
+
124
+ async function renderSetupHub(ctx: ExtensionCommandContext): Promise<void> {
125
+ const record = readOnboardingRecord()
126
+ const completed = new Set(record.completedSteps)
127
+ const skipped = new Set(record.skippedSteps)
128
+
129
+ const labels = ONBOARDING_STEPS.map(step => {
130
+ const mark = completed.has(step.id) ? "✓" : skipped.has(step.id) ? "↷" : "○"
131
+ const req = step.required ? " (required)" : ""
132
+ return `${mark} ${step.label}${req} — ${step.hint}`
133
+ })
134
+ const labelToStep = new Map(labels.map((label, i) => [label, ONBOARDING_STEPS[i].id]))
135
+
136
+ const choice = await ctx.ui.select("GSD Setup — pick a step to configure", labels)
137
+ if (typeof choice !== "string") return
138
+ const stepId = labelToStep.get(choice)
139
+ if (!stepId) return
140
+ await runStep(ctx, stepId)
141
+ }
142
+
163
143
  function renderStatus(): string {
164
144
  const r = readOnboardingRecord()
165
145
  const lines: string[] = ["GSD Onboarding\n"]
@@ -192,38 +172,25 @@ export async function handleOnboarding(rawArgs: string, ctx: ExtensionCommandCon
192
172
  ctx.ui.notify(`Unknown step "${args.step}". Valid: ${validIds}`, "warning")
193
173
  return
194
174
  }
195
- await runSingleStep(ctx, args.step as OnboardingStepId)
175
+ await runStep(ctx, args.step as OnboardingStepId)
196
176
  return
197
177
  }
198
178
 
199
179
  if (args.reset) {
200
180
  resetOnboarding()
201
181
  ctx.ui.notify(
202
- "Onboarding reset. Existing API keys/credentials are unchanged — manage them with /gsd keys.",
182
+ "Onboarding state cleared. API keys/credentials are unchanged — manage them with /gsd keys. Restart GSD to re-run the first-run wizard, or pick a step below.",
203
183
  "info",
204
184
  )
205
- await runWholeWizard(ctx)
185
+ await renderSetupHub(ctx)
206
186
  return
207
187
  }
208
188
 
209
- if (args.resume) {
210
- const r = readOnboardingRecord()
211
- const next = nearestResumeStep(r.lastResumePoint, r.completedSteps)
212
- await runWholeWizard(ctx, next)
213
- return
214
- }
215
-
216
- // No flags. If already complete, show status + offer choice.
189
+ // No flags (or --resume). Show status if complete, then open the hub.
217
190
  if (isOnboardingComplete()) {
218
191
  ctx.ui.notify(renderStatus(), "info")
219
- ctx.ui.notify(
220
- "Onboarding already complete. Use /gsd onboarding --reset to start over, or --step <name> to redo one section.",
221
- "info",
222
- )
223
- return
224
192
  }
225
-
226
- await runWholeWizard(ctx)
193
+ await renderSetupHub(ctx)
227
194
  }
228
195
 
229
196
  export { renderStatus as renderOnboardingStatus }
@@ -251,6 +251,11 @@ Examples:
251
251
  await handleExtractLearnings(trimmed.replace(/^extract-learnings\s*/, "").trim(), ctx, pi);
252
252
  return true;
253
253
  }
254
+ if (trimmed === "memory" || trimmed.startsWith("memory ") || trimmed === "memory help") {
255
+ const { handleMemory } = await import("../../commands-memory.js");
256
+ await handleMemory(trimmed.replace(/^memory\s*/, "").trim(), ctx, pi);
257
+ return true;
258
+ }
254
259
  if (trimmed === "scan" || trimmed.startsWith("scan ")) {
255
260
  const { handleScan } = await import("../../commands-scan.js");
256
261
  // \s* (not \s+) is intentional: handles both /gsd scan (no args) and /gsd scan --focus X