gsd-pi 2.41.0-dev.0acbce9 → 2.41.0-dev.5a170d0
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 +1 -1
- package/dist/cli-web-branch.d.ts +6 -0
- package/dist/cli-web-branch.js +17 -0
- package/dist/onboarding.js +2 -1
- package/dist/resources/extensions/gsd/auto/loop.js +89 -1
- package/dist/resources/extensions/gsd/auto/phases.js +28 -10
- package/dist/resources/extensions/gsd/auto/session.js +6 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +8 -2
- package/dist/resources/extensions/gsd/auto-dispatch.js +19 -2
- package/dist/resources/extensions/gsd/auto-post-unit.js +7 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +12 -4
- package/dist/resources/extensions/gsd/auto-start.js +8 -3
- package/dist/resources/extensions/gsd/auto-worktree.js +147 -13
- package/dist/resources/extensions/gsd/auto.js +64 -2
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +199 -164
- package/dist/resources/extensions/gsd/bootstrap/journal-tools.js +62 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +2 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +16 -0
- package/dist/resources/extensions/gsd/bootstrap/tool-call-loop-guard.js +7 -2
- package/dist/resources/extensions/gsd/commands/catalog.js +40 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +1 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +5 -0
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +146 -0
- package/dist/resources/extensions/gsd/context-injector.js +74 -0
- package/dist/resources/extensions/gsd/context-store.js +4 -3
- package/dist/resources/extensions/gsd/custom-execution-policy.js +47 -0
- package/dist/resources/extensions/gsd/custom-verification.js +145 -0
- package/dist/resources/extensions/gsd/custom-workflow-engine.js +164 -0
- package/dist/resources/extensions/gsd/dashboard-overlay.js +1 -0
- package/dist/resources/extensions/gsd/db-writer.js +5 -2
- package/dist/resources/extensions/gsd/definition-loader.js +352 -0
- package/dist/resources/extensions/gsd/detection.js +1 -1
- package/dist/resources/extensions/gsd/dev-execution-policy.js +24 -0
- package/dist/resources/extensions/gsd/dev-workflow-engine.js +82 -0
- package/dist/resources/extensions/gsd/doctor.js +11 -1
- package/dist/resources/extensions/gsd/engine-resolver.js +40 -0
- package/dist/resources/extensions/gsd/engine-types.js +8 -0
- package/dist/resources/extensions/gsd/execution-policy.js +8 -0
- package/dist/resources/extensions/gsd/exit-command.js +12 -2
- package/dist/resources/extensions/gsd/export.js +9 -13
- package/dist/resources/extensions/gsd/extension-manifest.json +2 -2
- package/dist/resources/extensions/gsd/files.js +28 -11
- package/dist/resources/extensions/gsd/forensics.js +10 -3
- package/dist/resources/extensions/gsd/git-service.js +5 -1
- package/dist/resources/extensions/gsd/graph.js +225 -0
- package/dist/resources/extensions/gsd/gsd-db.js +25 -8
- package/dist/resources/extensions/gsd/guided-flow-queue.js +1 -1
- package/dist/resources/extensions/gsd/guided-flow.js +7 -3
- package/dist/resources/extensions/gsd/journal.js +85 -0
- package/dist/resources/extensions/gsd/md-importer.js +5 -0
- package/dist/resources/extensions/gsd/milestone-ids.js +1 -1
- package/dist/resources/extensions/gsd/native-git-bridge.js +2 -2
- package/dist/resources/extensions/gsd/post-unit-hooks.js +24 -412
- package/dist/resources/extensions/gsd/preferences-types.js +1 -0
- package/dist/resources/extensions/gsd/preferences.js +1 -0
- package/dist/resources/extensions/gsd/prompt-loader.js +34 -4
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +11 -10
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +2 -2
- package/dist/resources/extensions/gsd/prompts/discuss.md +1 -1
- package/dist/resources/extensions/gsd/prompts/queue.md +1 -1
- package/dist/resources/extensions/gsd/repo-identity.js +46 -2
- package/dist/resources/extensions/gsd/rule-registry.js +489 -0
- package/dist/resources/extensions/gsd/rule-types.js +6 -0
- package/dist/resources/extensions/gsd/run-manager.js +134 -0
- package/dist/resources/extensions/gsd/service-tier.js +138 -0
- package/dist/resources/extensions/gsd/structured-data-formatter.js +2 -1
- package/dist/resources/extensions/gsd/templates/decisions.md +2 -2
- package/dist/resources/extensions/gsd/workflow-engine.js +7 -0
- package/dist/resources/extensions/gsd/workflow-templates.js +13 -1
- package/dist/resources/extensions/gsd/worktree-manager.js +20 -6
- package/dist/resources/extensions/gsd/worktree-resolver.js +19 -2
- package/dist/resources/extensions/subagent/index.js +7 -3
- package/dist/resources/extensions/voice/index.js +4 -4
- package/dist/resources/skills/create-workflow/SKILL.md +103 -0
- package/dist/resources/skills/create-workflow/references/feature-patterns.md +128 -0
- package/dist/resources/skills/create-workflow/references/verification-policies.md +76 -0
- package/dist/resources/skills/create-workflow/references/yaml-schema-v1.md +46 -0
- package/dist/resources/skills/create-workflow/templates/blog-post-pipeline.yaml +60 -0
- package/dist/resources/skills/create-workflow/templates/code-audit.yaml +60 -0
- package/dist/resources/skills/create-workflow/templates/release-checklist.yaml +66 -0
- package/dist/resources/skills/create-workflow/templates/workflow-definition.yaml +32 -0
- package/dist/resources/skills/create-workflow/workflows/create-from-scratch.md +104 -0
- package/dist/resources/skills/create-workflow/workflows/create-from-template.md +72 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +16 -16
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
- 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/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +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 +16 -16
- package/dist/web/standalone/.next/server/chunks/229.js +3 -3
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +2 -2
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/4024.c195dc1fdd2adbea.js +9 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-9afaaebf6042a1d7.js → webpack-fa307370fcf9fb2c.js} +1 -1
- package/dist/web-mode.d.ts +2 -0
- package/dist/web-mode.js +29 -7
- package/package.json +1 -1
- package/packages/native/src/__tests__/text.test.mjs +33 -0
- package/packages/pi-coding-agent/dist/core/discovery-cache.test.js +3 -1
- package/packages/pi-coding-agent/dist/core/discovery-cache.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +10 -7
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.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 +4 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/src/core/discovery-cache.test.ts +4 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/login-dialog.ts +11 -7
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +5 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +5 -1
- package/src/resources/extensions/gsd/auto/loop.ts +101 -1
- package/src/resources/extensions/gsd/auto/phases.ts +30 -10
- package/src/resources/extensions/gsd/auto/session.ts +6 -0
- package/src/resources/extensions/gsd/auto/types.ts +4 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +9 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +25 -5
- package/src/resources/extensions/gsd/auto-post-unit.ts +8 -0
- package/src/resources/extensions/gsd/auto-recovery.ts +12 -4
- package/src/resources/extensions/gsd/auto-start.ts +8 -3
- package/src/resources/extensions/gsd/auto-worktree.ts +162 -18
- package/src/resources/extensions/gsd/auto.ts +71 -2
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +209 -162
- package/src/resources/extensions/gsd/bootstrap/journal-tools.ts +62 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +2 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +13 -0
- package/src/resources/extensions/gsd/bootstrap/tool-call-loop-guard.ts +9 -2
- package/src/resources/extensions/gsd/commands/catalog.ts +40 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +1 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +5 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +164 -0
- package/src/resources/extensions/gsd/context-injector.ts +100 -0
- package/src/resources/extensions/gsd/context-store.ts +4 -3
- package/src/resources/extensions/gsd/custom-execution-policy.ts +73 -0
- package/src/resources/extensions/gsd/custom-verification.ts +180 -0
- package/src/resources/extensions/gsd/custom-workflow-engine.ts +216 -0
- package/src/resources/extensions/gsd/dashboard-overlay.ts +1 -0
- package/src/resources/extensions/gsd/db-writer.ts +6 -2
- package/src/resources/extensions/gsd/definition-loader.ts +462 -0
- package/src/resources/extensions/gsd/detection.ts +1 -1
- package/src/resources/extensions/gsd/dev-execution-policy.ts +51 -0
- package/src/resources/extensions/gsd/dev-workflow-engine.ts +110 -0
- package/src/resources/extensions/gsd/doctor.ts +12 -1
- package/src/resources/extensions/gsd/engine-resolver.ts +57 -0
- package/src/resources/extensions/gsd/engine-types.ts +71 -0
- package/src/resources/extensions/gsd/execution-policy.ts +43 -0
- package/src/resources/extensions/gsd/exit-command.ts +14 -2
- package/src/resources/extensions/gsd/export.ts +8 -15
- package/src/resources/extensions/gsd/extension-manifest.json +2 -2
- package/src/resources/extensions/gsd/files.ts +29 -12
- package/src/resources/extensions/gsd/forensics.ts +9 -3
- package/src/resources/extensions/gsd/git-service.ts +5 -4
- package/src/resources/extensions/gsd/graph.ts +312 -0
- package/src/resources/extensions/gsd/gsd-db.ts +37 -8
- package/src/resources/extensions/gsd/guided-flow-queue.ts +1 -1
- package/src/resources/extensions/gsd/guided-flow.ts +7 -3
- package/src/resources/extensions/gsd/journal.ts +134 -0
- package/src/resources/extensions/gsd/md-importer.ts +6 -0
- package/src/resources/extensions/gsd/milestone-ids.ts +1 -1
- package/src/resources/extensions/gsd/native-git-bridge.ts +2 -2
- package/src/resources/extensions/gsd/post-unit-hooks.ts +24 -462
- package/src/resources/extensions/gsd/preferences-types.ts +3 -0
- package/src/resources/extensions/gsd/preferences.ts +1 -0
- package/src/resources/extensions/gsd/prompt-loader.ts +35 -4
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +11 -10
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +2 -2
- package/src/resources/extensions/gsd/prompts/discuss.md +1 -1
- package/src/resources/extensions/gsd/prompts/queue.md +1 -1
- package/src/resources/extensions/gsd/repo-identity.ts +47 -2
- package/src/resources/extensions/gsd/rule-registry.ts +599 -0
- package/src/resources/extensions/gsd/rule-types.ts +68 -0
- package/src/resources/extensions/gsd/run-manager.ts +180 -0
- package/src/resources/extensions/gsd/service-tier.ts +171 -0
- package/src/resources/extensions/gsd/structured-data-formatter.ts +3 -1
- package/src/resources/extensions/gsd/templates/decisions.md +2 -2
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +103 -120
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/auto-secrets-gate.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +202 -0
- package/src/resources/extensions/gsd/tests/bundled-workflow-defs.test.ts +180 -0
- package/src/resources/extensions/gsd/tests/captures.test.ts +12 -1
- package/src/resources/extensions/gsd/tests/commands-workflow-custom.test.ts +283 -0
- package/src/resources/extensions/gsd/tests/context-injector.test.ts +313 -0
- package/src/resources/extensions/gsd/tests/context-store.test.ts +10 -5
- package/src/resources/extensions/gsd/tests/continue-here.test.ts +20 -20
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +540 -0
- package/src/resources/extensions/gsd/tests/custom-verification.test.ts +382 -0
- package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +339 -0
- package/src/resources/extensions/gsd/tests/dashboard-custom-engine.test.ts +87 -0
- package/src/resources/extensions/gsd/tests/db-writer.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/definition-loader.test.ts +778 -0
- package/src/resources/extensions/gsd/tests/dev-engine-wrapper.test.ts +318 -0
- package/src/resources/extensions/gsd/tests/doctor-completion-deferral.test.ts +15 -10
- package/src/resources/extensions/gsd/tests/doctor-fixlevel.test.ts +5 -4
- package/src/resources/extensions/gsd/tests/doctor-roadmap-summary-atomicity.test.ts +167 -0
- package/src/resources/extensions/gsd/tests/doctor-task-done-missing-summary-slice-loop.test.ts +174 -0
- package/src/resources/extensions/gsd/tests/e2e-workflow-pipeline-integration.test.ts +476 -0
- package/src/resources/extensions/gsd/tests/engine-interfaces-contract.test.ts +271 -0
- package/src/resources/extensions/gsd/tests/exit-command.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/graph-operations.test.ts +599 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +8 -1
- package/src/resources/extensions/gsd/tests/gsd-tools.test.ts +7 -7
- package/src/resources/extensions/gsd/tests/iterate-engine-integration.test.ts +429 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +513 -0
- package/src/resources/extensions/gsd/tests/journal-query-tool.test.ts +147 -0
- package/src/resources/extensions/gsd/tests/journal.test.ts +386 -0
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +31 -1
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/milestone-id-reservation.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/parsers.test.ts +110 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +47 -25
- package/src/resources/extensions/gsd/tests/prompt-db.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/repo-identity-worktree.test.ts +61 -1
- package/src/resources/extensions/gsd/tests/routing-history.test.ts +11 -22
- package/src/resources/extensions/gsd/tests/rule-registry.test.ts +413 -0
- package/src/resources/extensions/gsd/tests/run-manager.test.ts +229 -0
- package/src/resources/extensions/gsd/tests/service-tier.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/skill-lifecycle.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/stalled-tool-recovery.test.ts +102 -0
- package/src/resources/extensions/gsd/tests/structured-data-formatter.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/tool-call-loop-guard.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/tool-naming.test.ts +117 -0
- package/src/resources/extensions/gsd/tests/triage-dispatch.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/windows-path-normalization.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/worktree-db-integration.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/worktree-db.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +178 -0
- package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +195 -105
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +78 -3
- package/src/resources/extensions/gsd/tests/worktree-symlink-removal.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +74 -0
- package/src/resources/extensions/gsd/types.ts +3 -0
- package/src/resources/extensions/gsd/workflow-engine.ts +38 -0
- package/src/resources/extensions/gsd/workflow-templates.ts +12 -1
- package/src/resources/extensions/gsd/worktree-manager.ts +21 -6
- package/src/resources/extensions/gsd/worktree-resolver.ts +30 -9
- package/src/resources/extensions/subagent/index.ts +7 -3
- package/src/resources/extensions/voice/index.ts +4 -4
- package/src/resources/skills/create-workflow/SKILL.md +103 -0
- package/src/resources/skills/create-workflow/references/feature-patterns.md +128 -0
- package/src/resources/skills/create-workflow/references/verification-policies.md +76 -0
- package/src/resources/skills/create-workflow/references/yaml-schema-v1.md +46 -0
- package/src/resources/skills/create-workflow/templates/blog-post-pipeline.yaml +60 -0
- package/src/resources/skills/create-workflow/templates/code-audit.yaml +60 -0
- package/src/resources/skills/create-workflow/templates/release-checklist.yaml +66 -0
- package/src/resources/skills/create-workflow/templates/workflow-definition.yaml +32 -0
- package/src/resources/skills/create-workflow/workflows/create-from-scratch.md +104 -0
- package/src/resources/skills/create-workflow/workflows/create-from-template.md +72 -0
- package/dist/web/standalone/.next/static/chunks/4024.279c423e4661ece1.js +0 -9
- /package/dist/web/standalone/.next/static/{SwbKZ7JPNFlEmU4f8pKEv → K7GYOOPvQWX6TKYEKhODM}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{SwbKZ7JPNFlEmU4f8pKEv → K7GYOOPvQWX6TKYEKhODM}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* run-manager.ts — Create and list isolated workflow run directories.
|
|
3
|
+
*
|
|
4
|
+
* Each run lives under `.gsd/workflow-runs/<name>/<timestamp>/` and contains:
|
|
5
|
+
* - DEFINITION.yaml — frozen snapshot of the workflow definition at run-creation time
|
|
6
|
+
* - GRAPH.yaml — initialized step graph with all steps pending
|
|
7
|
+
* - PARAMS.json — (optional) parameter overrides used for this run
|
|
8
|
+
*
|
|
9
|
+
* Observability:
|
|
10
|
+
* - All run state is on disk in human-readable YAML/JSON — inspectable with cat/less.
|
|
11
|
+
* - `listRuns()` returns structured metadata including step counts and overall status.
|
|
12
|
+
* - Timestamp directory names are filesystem-safe (ISO with hyphens replacing colons).
|
|
13
|
+
* - Errors include the full path context for diagnosis.
|
|
14
|
+
*/
|
|
15
|
+
import { mkdirSync, writeFileSync, existsSync, readdirSync, statSync } from "node:fs";
|
|
16
|
+
import { join } from "node:path";
|
|
17
|
+
import { stringify } from "yaml";
|
|
18
|
+
import { loadDefinition, substituteParams } from "./definition-loader.js";
|
|
19
|
+
import { initializeGraph, writeGraph, readGraph } from "./graph.js";
|
|
20
|
+
// ─── Constants ───────────────────────────────────────────────────────────
|
|
21
|
+
const RUNS_DIR = "workflow-runs";
|
|
22
|
+
const DEFS_DIR = "workflow-defs";
|
|
23
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────
|
|
24
|
+
/**
|
|
25
|
+
* Generate a filesystem-safe timestamp: `YYYY-MM-DDTHH-MM-SS`.
|
|
26
|
+
* Replaces colons with hyphens so the string is safe as a directory name
|
|
27
|
+
* on all platforms (Windows forbids colons in paths).
|
|
28
|
+
*/
|
|
29
|
+
function makeTimestamp(date = new Date()) {
|
|
30
|
+
return date.toISOString().replace(/:/g, "-").replace(/\.\d{3}Z$/, "");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Derive overall status from a graph's step statuses.
|
|
34
|
+
*/
|
|
35
|
+
function deriveStatus(graph) {
|
|
36
|
+
const hasActive = graph.steps.some((s) => s.status === "active");
|
|
37
|
+
const allDone = graph.steps.every((s) => s.status === "complete" || s.status === "expanded");
|
|
38
|
+
if (allDone)
|
|
39
|
+
return "complete";
|
|
40
|
+
if (hasActive)
|
|
41
|
+
return "running";
|
|
42
|
+
return "pending";
|
|
43
|
+
}
|
|
44
|
+
// ─── Public API ──────────────────────────────────────────────────────────
|
|
45
|
+
/**
|
|
46
|
+
* Create a new isolated run directory for a workflow definition.
|
|
47
|
+
*
|
|
48
|
+
* 1. Loads the definition from `<basePath>/.gsd/workflow-defs/<defName>.yaml`
|
|
49
|
+
* 2. Applies parameter substitution if overrides are provided
|
|
50
|
+
* 3. Creates `<basePath>/.gsd/workflow-runs/<defName>/<timestamp>/`
|
|
51
|
+
* 4. Writes frozen DEFINITION.yaml, initialized GRAPH.yaml, and optional PARAMS.json
|
|
52
|
+
*
|
|
53
|
+
* @param basePath — project root directory
|
|
54
|
+
* @param defName — definition filename (without .yaml extension)
|
|
55
|
+
* @param overrides — optional parameter overrides (merged with definition defaults)
|
|
56
|
+
* @returns Full path to the created run directory
|
|
57
|
+
* @throws Error if the definition file doesn't exist or is invalid
|
|
58
|
+
*/
|
|
59
|
+
export function createRun(basePath, defName, overrides) {
|
|
60
|
+
const defsDir = join(basePath, ".gsd", DEFS_DIR);
|
|
61
|
+
// Load and validate the definition
|
|
62
|
+
const rawDef = loadDefinition(defsDir, defName);
|
|
63
|
+
// Apply parameter substitution if overrides provided
|
|
64
|
+
const def = overrides
|
|
65
|
+
? substituteParams(rawDef, overrides)
|
|
66
|
+
: substituteParams(rawDef); // still resolve default params if any
|
|
67
|
+
// Create the run directory
|
|
68
|
+
const timestamp = makeTimestamp();
|
|
69
|
+
const runDir = join(basePath, ".gsd", RUNS_DIR, defName, timestamp);
|
|
70
|
+
mkdirSync(runDir, { recursive: true });
|
|
71
|
+
// Freeze the definition as DEFINITION.yaml
|
|
72
|
+
writeFileSync(join(runDir, "DEFINITION.yaml"), stringify(def), "utf-8");
|
|
73
|
+
// Initialize and write GRAPH.yaml
|
|
74
|
+
const graph = initializeGraph(def);
|
|
75
|
+
writeGraph(runDir, graph);
|
|
76
|
+
// Write PARAMS.json if overrides were provided
|
|
77
|
+
if (overrides && Object.keys(overrides).length > 0) {
|
|
78
|
+
writeFileSync(join(runDir, "PARAMS.json"), JSON.stringify(overrides, null, 2), "utf-8");
|
|
79
|
+
}
|
|
80
|
+
return runDir;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* List existing workflow runs with metadata.
|
|
84
|
+
*
|
|
85
|
+
* Scans `<basePath>/.gsd/workflow-runs/` for run directories. Each run's
|
|
86
|
+
* GRAPH.yaml is read to derive step counts and overall status.
|
|
87
|
+
*
|
|
88
|
+
* @param basePath — project root directory
|
|
89
|
+
* @param defName — optional filter: only list runs for this definition name
|
|
90
|
+
* @returns Array of run metadata, sorted newest-first within each definition
|
|
91
|
+
*/
|
|
92
|
+
export function listRuns(basePath, defName) {
|
|
93
|
+
const runsRoot = join(basePath, ".gsd", RUNS_DIR);
|
|
94
|
+
if (!existsSync(runsRoot))
|
|
95
|
+
return [];
|
|
96
|
+
const results = [];
|
|
97
|
+
// Get workflow name directories
|
|
98
|
+
const nameDirs = defName ? [defName] : readdirSync(runsRoot).filter((entry) => {
|
|
99
|
+
const full = join(runsRoot, entry);
|
|
100
|
+
return statSync(full).isDirectory();
|
|
101
|
+
});
|
|
102
|
+
for (const name of nameDirs) {
|
|
103
|
+
const nameDir = join(runsRoot, name);
|
|
104
|
+
if (!existsSync(nameDir))
|
|
105
|
+
continue;
|
|
106
|
+
const timestamps = readdirSync(nameDir).filter((entry) => {
|
|
107
|
+
const full = join(nameDir, entry);
|
|
108
|
+
return statSync(full).isDirectory();
|
|
109
|
+
});
|
|
110
|
+
// Sort newest-first (ISO strings sort lexicographically)
|
|
111
|
+
timestamps.sort().reverse();
|
|
112
|
+
for (const ts of timestamps) {
|
|
113
|
+
const runDir = join(nameDir, ts);
|
|
114
|
+
try {
|
|
115
|
+
const graph = readGraph(runDir);
|
|
116
|
+
const total = graph.steps.length;
|
|
117
|
+
const completed = graph.steps.filter((s) => s.status === "complete").length;
|
|
118
|
+
const pending = graph.steps.filter((s) => s.status === "pending").length;
|
|
119
|
+
const active = graph.steps.filter((s) => s.status === "active").length;
|
|
120
|
+
results.push({
|
|
121
|
+
name,
|
|
122
|
+
timestamp: ts,
|
|
123
|
+
runDir,
|
|
124
|
+
steps: { total, completed, pending, active },
|
|
125
|
+
status: deriveStatus(graph),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
// Skip runs with invalid/missing GRAPH.yaml
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return results;
|
|
134
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service Tier — gating, status formatting, icon resolution, and
|
|
3
|
+
* the /gsd fast command handler.
|
|
4
|
+
*
|
|
5
|
+
* Service tiers (priority/flex) are an OpenAI feature that only applies
|
|
6
|
+
* to gpt-5.4 variants. This module centralizes the model-gating logic
|
|
7
|
+
* so that icons, preferences, and the before_provider_request hook all
|
|
8
|
+
* use a single source of truth.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
11
|
+
import { saveFile } from "./files.js";
|
|
12
|
+
import { getGlobalGSDPreferencesPath, loadEffectiveGSDPreferences, loadGlobalGSDPreferences, } from "./preferences.js";
|
|
13
|
+
import { ensurePreferencesFile, serializePreferencesToFrontmatter } from "./commands-prefs-wizard.js";
|
|
14
|
+
// ─── Gating ──────────────────────────────────────────────────────────────────
|
|
15
|
+
/**
|
|
16
|
+
* Returns true when the given model ID supports OpenAI service tiers.
|
|
17
|
+
* Currently only gpt-5.4 variants qualify.
|
|
18
|
+
*/
|
|
19
|
+
export function supportsServiceTier(modelId) {
|
|
20
|
+
if (!modelId)
|
|
21
|
+
return false;
|
|
22
|
+
// Strip provider prefix if present (e.g. "openai/gpt-5.4" → "gpt-5.4")
|
|
23
|
+
const bare = modelId.includes("/") ? modelId.split("/").pop() : modelId;
|
|
24
|
+
return bare.startsWith("gpt-5.4");
|
|
25
|
+
}
|
|
26
|
+
// ─── Status Formatting ───────────────────────────────────────────────────────
|
|
27
|
+
/**
|
|
28
|
+
* Human-readable description of the current service tier setting.
|
|
29
|
+
*/
|
|
30
|
+
export function formatServiceTierStatus(tier) {
|
|
31
|
+
if (!tier) {
|
|
32
|
+
return [
|
|
33
|
+
"Service tier: disabled",
|
|
34
|
+
"",
|
|
35
|
+
"Usage:",
|
|
36
|
+
" /gsd fast on Set to priority (2x cost, faster)",
|
|
37
|
+
" /gsd fast flex Set to flex (0.5x cost, slower)",
|
|
38
|
+
" /gsd fast off Disable service tier",
|
|
39
|
+
"",
|
|
40
|
+
"Only affects gpt-5.4 models.",
|
|
41
|
+
].join("\n");
|
|
42
|
+
}
|
|
43
|
+
const label = tier === "priority" ? "priority (2x cost, faster)" : "flex (0.5x cost, slower)";
|
|
44
|
+
return [
|
|
45
|
+
`Service tier: ${label}`,
|
|
46
|
+
"",
|
|
47
|
+
"Usage:",
|
|
48
|
+
" /gsd fast on Set to priority (2x cost, faster)",
|
|
49
|
+
" /gsd fast flex Set to flex (0.5x cost, slower)",
|
|
50
|
+
" /gsd fast off Disable service tier",
|
|
51
|
+
"",
|
|
52
|
+
"Only affects gpt-5.4 models.",
|
|
53
|
+
].join("\n");
|
|
54
|
+
}
|
|
55
|
+
// ─── Icon Resolution ─────────────────────────────────────────────────────────
|
|
56
|
+
/**
|
|
57
|
+
* Returns the appropriate icon for the active service tier and model.
|
|
58
|
+
* Returns empty string when the tier is inactive or the model doesn't
|
|
59
|
+
* support service tiers.
|
|
60
|
+
*/
|
|
61
|
+
export function resolveServiceTierIcon(tier, modelId) {
|
|
62
|
+
if (!tier || !supportsServiceTier(modelId))
|
|
63
|
+
return "";
|
|
64
|
+
return tier === "priority" ? "⚡" : "💰";
|
|
65
|
+
}
|
|
66
|
+
// ─── Preference Read ─────────────────────────────────────────────────────────
|
|
67
|
+
/**
|
|
68
|
+
* Read the effective service_tier setting from preferences.
|
|
69
|
+
*/
|
|
70
|
+
export function getEffectiveServiceTier() {
|
|
71
|
+
const prefs = loadEffectiveGSDPreferences()?.preferences;
|
|
72
|
+
const raw = prefs?.service_tier;
|
|
73
|
+
if (raw === "priority" || raw === "flex")
|
|
74
|
+
return raw;
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
// ─── Preference Write ────────────────────────────────────────────────────────
|
|
78
|
+
function extractBodyAfterFrontmatter(content) {
|
|
79
|
+
const start = content.startsWith("---\n") ? 4 : content.startsWith("---\r\n") ? 5 : -1;
|
|
80
|
+
if (start === -1)
|
|
81
|
+
return null;
|
|
82
|
+
const closingIdx = content.indexOf("\n---", start);
|
|
83
|
+
if (closingIdx === -1)
|
|
84
|
+
return null;
|
|
85
|
+
const after = content.slice(closingIdx + 4);
|
|
86
|
+
return after.trim() ? after : null;
|
|
87
|
+
}
|
|
88
|
+
async function writeGlobalServiceTier(ctx, tier) {
|
|
89
|
+
const path = getGlobalGSDPreferencesPath();
|
|
90
|
+
await ensurePreferencesFile(path, ctx, "global");
|
|
91
|
+
const existing = loadGlobalGSDPreferences();
|
|
92
|
+
const prefs = existing?.preferences ? { ...existing.preferences } : {};
|
|
93
|
+
prefs.version = prefs.version || 1;
|
|
94
|
+
if (tier) {
|
|
95
|
+
prefs.service_tier = tier;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
delete prefs.service_tier;
|
|
99
|
+
}
|
|
100
|
+
const frontmatter = serializePreferencesToFrontmatter(prefs);
|
|
101
|
+
let body = "\n# GSD Skill Preferences\n\nSee `~/.gsd/agent/extensions/gsd/docs/preferences-reference.md` for full field documentation and examples.\n";
|
|
102
|
+
if (existsSync(path)) {
|
|
103
|
+
const preserved = extractBodyAfterFrontmatter(readFileSync(path, "utf-8"));
|
|
104
|
+
if (preserved)
|
|
105
|
+
body = preserved;
|
|
106
|
+
}
|
|
107
|
+
await saveFile(path, `---\n${frontmatter}---${body}`);
|
|
108
|
+
await ctx.waitForIdle();
|
|
109
|
+
await ctx.reload();
|
|
110
|
+
}
|
|
111
|
+
// ─── Command Handler ─────────────────────────────────────────────────────────
|
|
112
|
+
/**
|
|
113
|
+
* Handle `/gsd fast [on|off|flex|status]`.
|
|
114
|
+
*/
|
|
115
|
+
export async function handleFast(args, ctx) {
|
|
116
|
+
const trimmed = args.trim().toLowerCase();
|
|
117
|
+
if (!trimmed || trimmed === "status") {
|
|
118
|
+
const tier = getEffectiveServiceTier();
|
|
119
|
+
ctx.ui.notify(formatServiceTierStatus(tier), "info");
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (trimmed === "on") {
|
|
123
|
+
await writeGlobalServiceTier(ctx, "priority");
|
|
124
|
+
ctx.ui.notify("Service tier set to priority (2x cost, faster responses). Only affects gpt-5.4 models.", "info");
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (trimmed === "off") {
|
|
128
|
+
await writeGlobalServiceTier(ctx, undefined);
|
|
129
|
+
ctx.ui.notify("Service tier disabled.", "info");
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (trimmed === "flex") {
|
|
133
|
+
await writeGlobalServiceTier(ctx, "flex");
|
|
134
|
+
ctx.ui.notify("Service tier set to flex (0.5x cost, slower responses). Only affects gpt-5.4 models.", "info");
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
ctx.ui.notify("Usage: /gsd fast [on|off|flex|status]\n\n on Priority tier (2x cost, faster)\n off Disable service tier\n flex Flex tier (0.5x cost, slower)\n status Show current setting", "warning");
|
|
138
|
+
}
|
|
@@ -25,6 +25,7 @@ export function formatDecisionCompact(decision) {
|
|
|
25
25
|
decision.choice,
|
|
26
26
|
decision.rationale,
|
|
27
27
|
decision.revisable,
|
|
28
|
+
decision.made_by ?? 'agent',
|
|
28
29
|
].join(" | ");
|
|
29
30
|
}
|
|
30
31
|
/** Format multiple decisions in compact notation with a Fields header. */
|
|
@@ -32,7 +33,7 @@ export function formatDecisionsCompact(decisions) {
|
|
|
32
33
|
if (decisions.length === 0) {
|
|
33
34
|
return "# Decisions (compact)\n(none)";
|
|
34
35
|
}
|
|
35
|
-
const header = "# Decisions (compact)\nFields: id | when | scope | decision | choice | rationale | revisable";
|
|
36
|
+
const header = "# Decisions (compact)\nFields: id | when | scope | decision | choice | rationale | revisable | made_by";
|
|
36
37
|
const lines = decisions.map(formatDecisionCompact);
|
|
37
38
|
return `${header}\n\n${lines.join("\n")}`;
|
|
38
39
|
}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
To reverse a decision, add a new row that supersedes it.
|
|
5
5
|
Read this file at the start of any planning or research phase. -->
|
|
6
6
|
|
|
7
|
-
| # | When | Scope | Decision | Choice | Rationale | Revisable? |
|
|
8
|
-
|
|
7
|
+
| # | When | Scope | Decision | Choice | Rationale | Revisable? | Made By |
|
|
8
|
+
|---|------|-------|----------|--------|-----------|------------|---------|
|
|
@@ -7,8 +7,20 @@
|
|
|
7
7
|
import { readFileSync, existsSync } from "node:fs";
|
|
8
8
|
import { join, dirname } from "node:path";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
|
-
|
|
10
|
+
import { homedir } from "node:os";
|
|
11
|
+
const __extensionDir = resolveGsdExtensionDir();
|
|
11
12
|
const registryPath = join(__extensionDir, "workflow-templates", "registry.json");
|
|
13
|
+
/** Resolve the GSD extension dir with fallback to ~/.gsd/agent/extensions/gsd/. */
|
|
14
|
+
function resolveGsdExtensionDir() {
|
|
15
|
+
const moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
if (existsSync(join(moduleDir, "workflow-templates")))
|
|
17
|
+
return moduleDir;
|
|
18
|
+
const gsdHome = process.env.GSD_HOME || join(homedir(), ".gsd");
|
|
19
|
+
const agentGsdDir = join(gsdHome, "agent", "extensions", "gsd");
|
|
20
|
+
if (existsSync(join(agentGsdDir, "workflow-templates")))
|
|
21
|
+
return agentGsdDir;
|
|
22
|
+
return moduleDir;
|
|
23
|
+
}
|
|
12
24
|
// ─── Registry Cache ──────────────────────────────────────────────────────────
|
|
13
25
|
let cachedRegistry = null;
|
|
14
26
|
/**
|
|
@@ -206,10 +206,24 @@ export function listWorktrees(basePath) {
|
|
|
206
206
|
* If the process is currently inside the worktree, chdir out first.
|
|
207
207
|
*/
|
|
208
208
|
export function removeWorktree(basePath, name, opts = {}) {
|
|
209
|
-
|
|
210
|
-
const resolvedWtPath = existsSync(wtPath) ? realpathSync(wtPath) : wtPath;
|
|
209
|
+
let wtPath = worktreePath(basePath, name);
|
|
211
210
|
const branch = opts.branch ?? worktreeBranchName(name);
|
|
212
211
|
const { deleteBranch = true, force = true } = opts;
|
|
212
|
+
// Resolve the ACTUAL worktree path from git's worktree list.
|
|
213
|
+
// The computed path may differ when .gsd/ is (or was) a symlink to an
|
|
214
|
+
// external state directory — git resolves symlinks at worktree creation
|
|
215
|
+
// time, so its registered path points to the resolved external location.
|
|
216
|
+
// If syncStateToProjectRoot later creates a real .gsd/ directory that
|
|
217
|
+
// shadows the symlink, the computed path diverges from git's record.
|
|
218
|
+
try {
|
|
219
|
+
const entries = nativeWorktreeList(basePath);
|
|
220
|
+
const entry = entries.find(e => e.branch === branch);
|
|
221
|
+
if (entry?.path) {
|
|
222
|
+
wtPath = entry.path;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
catch { /* fall back to computed path */ }
|
|
226
|
+
const resolvedWtPath = existsSync(wtPath) ? realpathSync(wtPath) : wtPath;
|
|
213
227
|
// If we're inside the worktree, move out first — git can't remove an in-use directory
|
|
214
228
|
const cwd = process.cwd();
|
|
215
229
|
const resolvedCwd = existsSync(cwd) ? realpathSync(cwd) : cwd;
|
|
@@ -226,15 +240,15 @@ export function removeWorktree(basePath, name, opts = {}) {
|
|
|
226
240
|
}
|
|
227
241
|
return;
|
|
228
242
|
}
|
|
229
|
-
// Remove worktree (force if requested, to handle dirty worktrees)
|
|
243
|
+
// Remove worktree using the resolved path (force if requested, to handle dirty worktrees)
|
|
230
244
|
try {
|
|
231
|
-
nativeWorktreeRemove(basePath,
|
|
245
|
+
nativeWorktreeRemove(basePath, resolvedWtPath, force);
|
|
232
246
|
}
|
|
233
247
|
catch { /* may fail */ }
|
|
234
248
|
// If the directory is still there (e.g. locked), try harder with force
|
|
235
|
-
if (existsSync(
|
|
249
|
+
if (existsSync(resolvedWtPath)) {
|
|
236
250
|
try {
|
|
237
|
-
nativeWorktreeRemove(basePath,
|
|
251
|
+
nativeWorktreeRemove(basePath, resolvedWtPath, true);
|
|
238
252
|
}
|
|
239
253
|
catch { /* may fail */ }
|
|
240
254
|
}
|
|
@@ -253,7 +253,18 @@ export class WorktreeResolver {
|
|
|
253
253
|
if (roadmapPath) {
|
|
254
254
|
const roadmapContent = this.deps.readFileSync(roadmapPath, "utf-8");
|
|
255
255
|
const mergeResult = this.deps.mergeMilestoneToMain(originalBase, milestoneId, roadmapContent);
|
|
256
|
-
|
|
256
|
+
if (mergeResult.codeFilesChanged) {
|
|
257
|
+
ctx.notify(`Milestone ${milestoneId} merged to main.${mergeResult.pushed ? " Pushed to remote." : ""}`, "info");
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
// (#1906) Milestone produced only .gsd/ metadata — no actual code was
|
|
261
|
+
// merged. This typically means the LLM wrote planning artifacts
|
|
262
|
+
// (summaries, roadmaps) but never implemented the code. Surface this
|
|
263
|
+
// clearly so the user knows the milestone is not truly complete.
|
|
264
|
+
ctx.notify(`WARNING: Milestone ${milestoneId} merged to main but contained NO code changes — only .gsd/ metadata files. ` +
|
|
265
|
+
`The milestone summary may describe planned work that was never implemented. ` +
|
|
266
|
+
`Review the milestone output and re-run if code is missing.`, "warning");
|
|
267
|
+
}
|
|
257
268
|
}
|
|
258
269
|
else {
|
|
259
270
|
// No roadmap at either location — teardown but PRESERVE the branch so
|
|
@@ -339,7 +350,13 @@ export class WorktreeResolver {
|
|
|
339
350
|
const mergeResult = this.deps.mergeMilestoneToMain(this.s.basePath, milestoneId, roadmapContent);
|
|
340
351
|
// Rebuild GitService after merge (branch HEAD changed)
|
|
341
352
|
this.rebuildGitService();
|
|
342
|
-
|
|
353
|
+
if (mergeResult.codeFilesChanged) {
|
|
354
|
+
ctx.notify(`Milestone ${milestoneId} merged (branch mode).${mergeResult.pushed ? " Pushed to remote." : ""}`, "info");
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
ctx.notify(`WARNING: Milestone ${milestoneId} merged (branch mode) but contained NO code changes — only .gsd/ metadata. ` +
|
|
358
|
+
`Review the milestone output and re-run if code is missing.`, "warning");
|
|
359
|
+
}
|
|
343
360
|
debugLog("WorktreeResolver", {
|
|
344
361
|
action: "mergeAndExit",
|
|
345
362
|
milestoneId,
|
|
@@ -409,12 +409,16 @@ async function runSingleAgentInCmuxSplit(cmuxClient, directionOrSurfaceId, defau
|
|
|
409
409
|
const bundledPaths = (process.env.GSD_BUNDLED_EXTENSION_PATHS ?? "").split(path.delimiter).map((s) => s.trim()).filter(Boolean);
|
|
410
410
|
const extensionArgs = bundledPaths.flatMap((p) => ["--extension", p]);
|
|
411
411
|
const processArgs = [process.env.GSD_BIN_PATH, ...extensionArgs, ...buildSubagentProcessArgs(agent, task, tmpPromptPath)];
|
|
412
|
+
// Normalize all paths to forward slashes before embedding in bash strings.
|
|
413
|
+
// On Windows, backslashes are interpreted as escape characters by bash,
|
|
414
|
+
// mangling paths like C:\Users\user into C:Useruser (#1436).
|
|
415
|
+
const bashPath = (p) => shellEscape(p.replaceAll("\\", "/"));
|
|
412
416
|
const innerScript = [
|
|
413
|
-
`cd ${
|
|
417
|
+
`cd ${bashPath(cwd ?? defaultCwd)}`,
|
|
414
418
|
"set -o pipefail",
|
|
415
|
-
`${
|
|
419
|
+
`${bashPath(process.execPath)} ${processArgs.map(a => bashPath(a)).join(" ")} 2> >(tee ${bashPath(stderrPath)} >&2) | tee ${bashPath(stdoutPath)}`,
|
|
416
420
|
"status=${PIPESTATUS[0]}",
|
|
417
|
-
`printf '%s' "$status" > ${
|
|
421
|
+
`printf '%s' "$status" > ${bashPath(exitPath)}`,
|
|
418
422
|
].join("; ");
|
|
419
423
|
const sent = await cmuxClient.sendSurface(cmuxSurfaceId, `bash -lc ${shellEscape(innerScript)}`);
|
|
420
424
|
if (!sent) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { shortcutDesc } from "../shared/mod.js";
|
|
2
2
|
import { isKeyRelease, Key, matchesKey, truncateToWidth, visibleWidth } from "@gsd/pi-tui";
|
|
3
|
-
import { spawn,
|
|
3
|
+
import { spawn, execFileSync } from "node:child_process";
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
5
|
import * as os from "node:os";
|
|
6
6
|
import * as path from "node:path";
|
|
@@ -22,7 +22,7 @@ function ensureBinary() {
|
|
|
22
22
|
if (fs.existsSync(RECOGNIZER_BIN))
|
|
23
23
|
return true;
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
execFileSync("swiftc", [SWIFT_SRC, "-o", RECOGNIZER_BIN, "-framework", "Speech", "-framework", "AVFoundation"], {
|
|
26
26
|
timeout: 60000,
|
|
27
27
|
});
|
|
28
28
|
return true;
|
|
@@ -42,7 +42,7 @@ function ensureLinuxReady(ctx) {
|
|
|
42
42
|
}
|
|
43
43
|
// Check python3 exists
|
|
44
44
|
try {
|
|
45
|
-
|
|
45
|
+
execFileSync("which", ["python3"], { stdio: "pipe" });
|
|
46
46
|
}
|
|
47
47
|
catch {
|
|
48
48
|
ctx.ui.notify("Voice: python3 not found — install with: sudo apt install python3", "error");
|
|
@@ -51,7 +51,7 @@ function ensureLinuxReady(ctx) {
|
|
|
51
51
|
// Check that sounddevice is importable
|
|
52
52
|
const py = linuxPython();
|
|
53
53
|
try {
|
|
54
|
-
|
|
54
|
+
execFileSync(py, ["-c", "import sounddevice"], {
|
|
55
55
|
stdio: "pipe",
|
|
56
56
|
timeout: 10000,
|
|
57
57
|
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-workflow
|
|
3
|
+
description: Conversational guide for creating valid YAML workflow definitions. Use when asked to "create a workflow", "new workflow definition", "build a workflow", "workflow YAML", "define workflow steps", or "workflow from template".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<essential_principles>
|
|
7
|
+
You are a workflow definition author. You help users create valid V1 YAML workflow definitions that the GSD workflow engine can execute.
|
|
8
|
+
|
|
9
|
+
**V1 Schema Basics:**
|
|
10
|
+
|
|
11
|
+
- Every definition requires `version: 1`, a non-empty `name`, and at least one step in `steps[]`.
|
|
12
|
+
- Optional top-level fields: `description` (string), `params` (key-value defaults for `{{ key }}` substitution).
|
|
13
|
+
- Each step requires: `id` (unique string), `name` (non-empty string), `prompt` (non-empty string).
|
|
14
|
+
- Each step optionally has: `requires` or `depends_on` (array of step IDs), `produces` (array of artifact paths), `context_from` (array of step IDs), `verify` (verification policy object), `iterate` (fan-out config object).
|
|
15
|
+
- YAML uses **snake_case** keys: `depends_on`, `context_from`. The engine converts to camelCase internally.
|
|
16
|
+
|
|
17
|
+
**Validation Rules:**
|
|
18
|
+
|
|
19
|
+
- Step IDs must be unique across the workflow.
|
|
20
|
+
- Dependencies (`requires`/`depends_on`) must reference existing step IDs — no dangling refs.
|
|
21
|
+
- A step cannot depend on itself.
|
|
22
|
+
- The dependency graph must be acyclic (no circular dependencies).
|
|
23
|
+
- `produces` paths must not contain `..` (path traversal rejected).
|
|
24
|
+
- `iterate.source` must not contain `..` (path traversal rejected).
|
|
25
|
+
- `iterate.pattern` must be a valid regex with at least one capture group.
|
|
26
|
+
|
|
27
|
+
**Four Verification Policies:**
|
|
28
|
+
|
|
29
|
+
1. `content-heuristic` — Checks artifact content. Optional: `minSize` (number), `pattern` (string).
|
|
30
|
+
2. `shell-command` — Runs a shell command. Required: `command` (non-empty string).
|
|
31
|
+
3. `prompt-verify` — Asks an LLM to verify. Required: `prompt` (non-empty string).
|
|
32
|
+
4. `human-review` — Pauses for human approval. No extra fields required.
|
|
33
|
+
|
|
34
|
+
**Parameter Substitution:**
|
|
35
|
+
|
|
36
|
+
- Define defaults in top-level `params: { key: "default_value" }`.
|
|
37
|
+
- Use `{{ key }}` placeholders in step prompts — the engine replaces them at runtime.
|
|
38
|
+
- CLI overrides take precedence over definition defaults.
|
|
39
|
+
- Parameter values must not contain `..` (path traversal guard).
|
|
40
|
+
- Any unresolved `{{ key }}` after substitution causes an error.
|
|
41
|
+
|
|
42
|
+
**Path Traversal Guard:**
|
|
43
|
+
|
|
44
|
+
- The engine rejects any `produces` path or `iterate.source` containing `..`.
|
|
45
|
+
- Parameter values are also checked for `..` during substitution.
|
|
46
|
+
|
|
47
|
+
**Output Location:**
|
|
48
|
+
|
|
49
|
+
- Finished definitions go in `.gsd/workflow-defs/<name>.yaml`.
|
|
50
|
+
- After writing, tell the user to validate with `/gsd workflow validate <name>`.
|
|
51
|
+
</essential_principles>
|
|
52
|
+
|
|
53
|
+
<routing>
|
|
54
|
+
Determine the user's intent and route to the appropriate workflow:
|
|
55
|
+
|
|
56
|
+
**"I want to create a workflow from scratch" / "new workflow" / "build a workflow":**
|
|
57
|
+
→ Read `workflows/create-from-scratch.md` and follow it.
|
|
58
|
+
|
|
59
|
+
**"I want to start from a template" / "from an example" / "customize a template":**
|
|
60
|
+
→ Read `workflows/create-from-template.md` and follow it.
|
|
61
|
+
|
|
62
|
+
**"Help me understand the schema" / "what fields are available?":**
|
|
63
|
+
→ Read `references/yaml-schema-v1.md` and explain the relevant parts.
|
|
64
|
+
|
|
65
|
+
**"How does verification work?" / "verify policies":**
|
|
66
|
+
→ Read `references/verification-policies.md` and explain.
|
|
67
|
+
|
|
68
|
+
**"How do I use context_from / iterate / params?":**
|
|
69
|
+
→ Read `references/feature-patterns.md` and explain the relevant feature.
|
|
70
|
+
|
|
71
|
+
**If intent is unclear, ask one clarifying question:**
|
|
72
|
+
- "Do you want to create a workflow from scratch, or start from an existing template?"
|
|
73
|
+
- Then route based on the answer.
|
|
74
|
+
</routing>
|
|
75
|
+
|
|
76
|
+
<reference_index>
|
|
77
|
+
Read these files when you need detailed schema knowledge during workflow authoring:
|
|
78
|
+
|
|
79
|
+
- `references/yaml-schema-v1.md` — Complete field-by-field V1 schema reference. Read when you need to explain any field's type, constraints, or defaults.
|
|
80
|
+
- `references/verification-policies.md` — All four verify policies with complete YAML examples. Read when helping the user choose or configure verification for a step.
|
|
81
|
+
- `references/feature-patterns.md` — Usage patterns for `context_from`, `iterate`, and `params` with complete YAML examples. Read when the user wants context chaining, fan-out iteration, or parameterized workflows.
|
|
82
|
+
</reference_index>
|
|
83
|
+
|
|
84
|
+
<templates_index>
|
|
85
|
+
Available templates in `templates/`:
|
|
86
|
+
|
|
87
|
+
- `workflow-definition.yaml` — Blank scaffold with all fields shown as comments. Copy and fill for a quick start.
|
|
88
|
+
- `blog-post-pipeline.yaml` — Linear chain with params and content-heuristic verification.
|
|
89
|
+
- `code-audit.yaml` — Iterate-based fan-out with shell-command verification.
|
|
90
|
+
- `release-checklist.yaml` — Diamond dependency graph with human-review verification.
|
|
91
|
+
</templates_index>
|
|
92
|
+
|
|
93
|
+
<output_conventions>
|
|
94
|
+
When assembling the final YAML:
|
|
95
|
+
|
|
96
|
+
1. Use 2-space indentation consistently.
|
|
97
|
+
2. Quote string values that contain special YAML characters (`:`, `{`, `}`, `[`, `]`, `#`).
|
|
98
|
+
3. Always include `version: 1` as the first field.
|
|
99
|
+
4. Order top-level fields: `version`, `name`, `description`, `params`, `steps`.
|
|
100
|
+
5. Order step fields: `id`, `name`, `prompt`, `requires`, `produces`, `context_from`, `verify`, `iterate`.
|
|
101
|
+
6. Write the file to `.gsd/workflow-defs/<name>.yaml`.
|
|
102
|
+
7. After writing, tell the user: "Run `/gsd workflow validate <name>` to check the definition."
|
|
103
|
+
</output_conventions>
|