@gonovus-ai/spec-flow-cli 1.2.1 → 1.3.1

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 (55) hide show
  1. package/README.md +20 -2
  2. package/dist/agent-commands.d.ts +30 -0
  3. package/dist/agent-commands.js +14 -17
  4. package/dist/agent-commands.js.map +1 -1
  5. package/dist/cli.d.ts +3 -0
  6. package/dist/cli.js.map +1 -1
  7. package/dist/credential-store.js +9 -8
  8. package/dist/credential-store.js.map +1 -1
  9. package/dist/index.js +16 -13
  10. package/dist/index.js.map +1 -1
  11. package/dist/input/text-source.js +5 -4
  12. package/dist/input/text-source.js.map +1 -1
  13. package/dist/runner/adapters/acp-adapter.d.ts +14 -0
  14. package/dist/runner/adapters/acp-adapter.js +593 -0
  15. package/dist/runner/adapters/acp-adapter.js.map +1 -0
  16. package/dist/runner/adapters/claude-stream.d.ts +7 -0
  17. package/dist/runner/adapters/claude-stream.js +324 -0
  18. package/dist/runner/adapters/claude-stream.js.map +1 -0
  19. package/dist/runner/adapters/codex-app-server.d.ts +8 -0
  20. package/dist/runner/adapters/codex-app-server.js +821 -0
  21. package/dist/runner/adapters/codex-app-server.js.map +1 -0
  22. package/dist/runner/adapters/exec-adapter.d.ts +13 -0
  23. package/dist/runner/adapters/exec-adapter.js +212 -0
  24. package/dist/runner/adapters/exec-adapter.js.map +1 -0
  25. package/dist/runner/orchestrator.d.ts +65 -0
  26. package/dist/runner/orchestrator.js +1166 -0
  27. package/dist/runner/orchestrator.js.map +1 -0
  28. package/dist/runner/process-utils.d.ts +22 -0
  29. package/dist/runner/process-utils.js +105 -0
  30. package/dist/runner/process-utils.js.map +1 -0
  31. package/dist/runner/redact.d.ts +26 -0
  32. package/dist/runner/redact.js +119 -0
  33. package/dist/runner/redact.js.map +1 -0
  34. package/dist/runner/run-command.d.ts +3 -0
  35. package/dist/runner/run-command.js +508 -0
  36. package/dist/runner/run-command.js.map +1 -0
  37. package/dist/runner/state-store.d.ts +18 -0
  38. package/dist/runner/state-store.js +156 -0
  39. package/dist/runner/state-store.js.map +1 -0
  40. package/dist/runner/telemetry-bridge.d.ts +44 -0
  41. package/dist/runner/telemetry-bridge.js +357 -0
  42. package/dist/runner/telemetry-bridge.js.map +1 -0
  43. package/dist/runner/types.d.ts +182 -0
  44. package/dist/runner/types.js +2 -0
  45. package/dist/runner/types.js.map +1 -0
  46. package/dist/runner/workflow.d.ts +4 -0
  47. package/dist/runner/workflow.js +272 -0
  48. package/dist/runner/workflow.js.map +1 -0
  49. package/dist/runner/workspace-manager.d.ts +29 -0
  50. package/dist/runner/workspace-manager.js +196 -0
  51. package/dist/runner/workspace-manager.js.map +1 -0
  52. package/dist/work-item-exchange-file.js +1 -1
  53. package/guides/agent-sessions.md +47 -2
  54. package/guides/boards.md +25 -6
  55. package/package.json +2 -1
@@ -0,0 +1,196 @@
1
+ import { execFile } from "node:child_process";
2
+ import { createHash } from "node:crypto";
3
+ import { access, mkdir, realpath, rm } from "node:fs/promises";
4
+ import { isAbsolute, join, relative, resolve, sep } from "node:path";
5
+ import { promisify } from "node:util";
6
+ const execFileAsync = promisify(execFile);
7
+ /**
8
+ * Sanitize a Work Item key into a collision-resistant directory name following
9
+ * Symphony Section 9.5 invariants (only `[A-Za-z0-9._-]`).
10
+ */
11
+ export function deriveWorkspaceKey(workItemKey) {
12
+ const cleaned = workItemKey.trim().replace(/[^A-Za-z0-9._-]/gu, "_");
13
+ const safeBase = cleaned.length > 0 ? cleaned : "work-item";
14
+ if (safeBase === workItemKey.trim() && safeBase !== "." && safeBase !== "..") {
15
+ return safeBase;
16
+ }
17
+ const digest = createHash("sha256").update(workItemKey).digest("hex").slice(0, 16);
18
+ const normalizedBase = safeBase.replace(/^\.+/u, "_") || "work-item";
19
+ return `${normalizedBase}-${digest}`;
20
+ }
21
+ /**
22
+ * Enforce Symphony Invariant 2: a per-issue workspace path must strictly reside
23
+ * beneath the normalized workspace root (no traversal, cross-drive, or root escape).
24
+ */
25
+ export function assertWithinWorkspaceRoot(rootDir, candidatePath) {
26
+ const normalizedRoot = resolve(rootDir);
27
+ const normalizedCandidate = resolve(candidatePath);
28
+ const rel = relative(normalizedRoot, normalizedCandidate);
29
+ if (rel.length === 0 ||
30
+ isAbsolute(rel) ||
31
+ rel === ".." ||
32
+ rel.startsWith(`..${sep}`) ||
33
+ rel.startsWith("../") ||
34
+ rel.startsWith("..\\")) {
35
+ throw new Error(`Refusing workspace path outside root: ${normalizedCandidate} is not within ${normalizedRoot}`);
36
+ }
37
+ return normalizedCandidate;
38
+ }
39
+ async function pathExists(targetPath) {
40
+ try {
41
+ await access(targetPath);
42
+ return true;
43
+ }
44
+ catch {
45
+ return false;
46
+ }
47
+ }
48
+ async function resolveGitTopLevel(cwd) {
49
+ try {
50
+ const { stdout } = await execFileAsync("git", ["rev-parse", "--show-toplevel"], {
51
+ cwd,
52
+ timeout: 10_000,
53
+ });
54
+ const top = stdout.trim();
55
+ return top.length > 0 ? top : null;
56
+ }
57
+ catch {
58
+ return null;
59
+ }
60
+ }
61
+ export async function resolveEffectiveWorkspaceMode(cwd, requestedMode) {
62
+ if (requestedMode === "shared") {
63
+ return "shared";
64
+ }
65
+ const gitRoot = await resolveGitTopLevel(cwd);
66
+ return gitRoot === null ? "shared" : "worktree";
67
+ }
68
+ async function resolveCurrentHeadRef(gitRoot) {
69
+ try {
70
+ const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], {
71
+ cwd: gitRoot,
72
+ timeout: 10_000,
73
+ });
74
+ const sha = stdout.trim();
75
+ return sha.length > 0 ? sha : "HEAD";
76
+ }
77
+ catch {
78
+ return "HEAD";
79
+ }
80
+ }
81
+ async function cleanupFailedWorktree(gitRoot, worktreePath) {
82
+ try {
83
+ await execFileAsync("git", ["worktree", "remove", "--force", worktreePath], {
84
+ cwd: gitRoot,
85
+ timeout: 15_000,
86
+ });
87
+ }
88
+ catch {
89
+ await rm(worktreePath, { recursive: true, force: true }).catch(() => undefined);
90
+ await execFileAsync("git", ["worktree", "prune"], {
91
+ cwd: gitRoot,
92
+ timeout: 10_000,
93
+ }).catch(() => undefined);
94
+ }
95
+ }
96
+ export async function runLifecycleHook(hookScript, cwd, timeoutMs, env) {
97
+ if (hookScript === undefined || hookScript.trim().length === 0)
98
+ return;
99
+ const shell = process.platform === "win32" ? "cmd" : "bash";
100
+ const args = process.platform === "win32" ? ["/c", hookScript] : ["-c", hookScript];
101
+ await execFileAsync(shell, args, {
102
+ cwd,
103
+ env,
104
+ timeout: timeoutMs,
105
+ maxBuffer: 2 * 1024 * 1024,
106
+ });
107
+ }
108
+ export async function prepareWorkItemWorkspace(options) {
109
+ const normalizedBase = resolve(options.baseCwd);
110
+ if (options.mode === "shared") {
111
+ return { path: normalizedBase, mode: "shared", createdNow: false };
112
+ }
113
+ const gitRoot = await resolveGitTopLevel(normalizedBase);
114
+ if (gitRoot === null) {
115
+ options.onDiagnostic(`Directory ${normalizedBase} is not a Git repository; falling back to shared workspace mode.`);
116
+ return { path: normalizedBase, mode: "shared", createdNow: false };
117
+ }
118
+ const rootDir = resolve(options.worktreeRoot ?? join(gitRoot, ".specflow", "worktrees"));
119
+ await mkdir(rootDir, { recursive: true });
120
+ const realRootDir = await realpath(rootDir);
121
+ const workspaceKey = deriveWorkspaceKey(options.workItemKey);
122
+ const worktreePath = assertWithinWorkspaceRoot(realRootDir, join(realRootDir, workspaceKey));
123
+ const branchName = `specflow/${workspaceKey.toLowerCase()}`;
124
+ if (await pathExists(worktreePath)) {
125
+ const resolvedExisting = await realpath(worktreePath);
126
+ assertWithinWorkspaceRoot(realRootDir, resolvedExisting);
127
+ return {
128
+ path: resolvedExisting,
129
+ mode: "worktree",
130
+ createdNow: false,
131
+ worktreeBranch: branchName,
132
+ };
133
+ }
134
+ const baseRef = await resolveCurrentHeadRef(gitRoot);
135
+ try {
136
+ await execFileAsync("git", ["worktree", "add", "-b", branchName, worktreePath, baseRef], {
137
+ cwd: gitRoot,
138
+ timeout: 30_000,
139
+ });
140
+ }
141
+ catch {
142
+ // If branch already exists from an earlier run, check out detached or reuse existing branch.
143
+ try {
144
+ await execFileAsync("git", ["worktree", "add", worktreePath, branchName], {
145
+ cwd: gitRoot,
146
+ timeout: 30_000,
147
+ });
148
+ }
149
+ catch {
150
+ await execFileAsync("git", ["worktree", "add", "--detach", worktreePath, baseRef], {
151
+ cwd: gitRoot,
152
+ timeout: 30_000,
153
+ });
154
+ }
155
+ }
156
+ const resolvedCreated = await realpath(worktreePath);
157
+ assertWithinWorkspaceRoot(realRootDir, resolvedCreated);
158
+ if (options.hooks?.afterCreate !== undefined) {
159
+ try {
160
+ await runLifecycleHook(options.hooks.afterCreate, resolvedCreated, options.hooks.timeoutMs, options.hookEnv);
161
+ }
162
+ catch (error) {
163
+ await cleanupFailedWorktree(gitRoot, resolvedCreated);
164
+ throw error;
165
+ }
166
+ }
167
+ return {
168
+ path: resolvedCreated,
169
+ mode: "worktree",
170
+ createdNow: true,
171
+ worktreeBranch: branchName,
172
+ };
173
+ }
174
+ export async function summarizeWorkspaceChanges(cwd) {
175
+ try {
176
+ const { stdout } = await execFileAsync("git", ["status", "--short"], {
177
+ cwd,
178
+ timeout: 5_000,
179
+ });
180
+ const lines = stdout
181
+ .split("\n")
182
+ .map((line) => line.trim())
183
+ .filter((line) => line.length > 0);
184
+ if (lines.length === 0) {
185
+ return "Working tree clean (no uncommitted local edits).";
186
+ }
187
+ const preview = lines.slice(0, 6).join(", ");
188
+ return lines.length > 6
189
+ ? `${String(lines.length)} modified paths preserved in workspace (${preview}, …)`
190
+ : `${String(lines.length)} modified path(s) preserved in workspace (${preview})`;
191
+ }
192
+ catch {
193
+ return undefined;
194
+ }
195
+ }
196
+ //# sourceMappingURL=workspace-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-manager.js","sourceRoot":"","sources":["../../src/runner/workspace-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAA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E,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACrC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,kDAAkD,CAAC;QAC5D,CAAC;QACD,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC;YACrB,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,2CAA2C,OAAO,MAAM;YACjF,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,6CAA6C,OAAO,GAAG,CAAC;IACrF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -10,7 +10,7 @@ const documentSchema = z
10
10
  .array(z
11
11
  .object({
12
12
  title: z.string().max(300),
13
- description: z.string().max(20_000).optional(),
13
+ description: z.string().max(65_536).optional(),
14
14
  status: z.string().max(200),
15
15
  priority: z.string().max(200).optional(),
16
16
  startDate: z.string().max(40).nullable().optional(),
@@ -16,10 +16,55 @@ Agent event listening, live execution sessions, structured plans, steps, elicita
16
16
  - Workspace read-only Tokens (`SPEC_FLOW_WORKSPACE_READ_TOKEN`) are rejected on all Agent
17
17
  event and session endpoints.
18
18
 
19
+ ## Running a local coding Agent worker (recommended)
20
+
21
+ Start a single-command local worker that listens for assignments, `@agent` mentions, and
22
+ live session controls (`prompt`, `answer`, `auth`, `stop`), runs a local coding agent
23
+ adapter, and streams live plans, reasoning summaries, tool steps, and confirmation cards
24
+ into the SpecFlow execution drawer:
25
+
26
+ ```sh
27
+ specflow agent run --workspace-id WORKSPACE_ID --agent my-agent --runner codex
28
+ specflow agent run --workspace-id WORKSPACE_ID --agent my-agent --runner claude
29
+ specflow agent run --workspace-id WORKSPACE_ID --agent my-agent --runner acp --acp-command 'gemini --experimental-acp'
30
+ specflow agent run --workspace-id WORKSPACE_ID --agent my-agent --runner exec --exec './scripts/worker.sh'
31
+ specflow agent run --workspace-id WORKSPACE_ID --agent my-agent --once --dry-run
32
+ ```
33
+
34
+ - Supported `--runner` adapters:
35
+ - `codex` (default): drives `codex app-server` over JSON-RPC 2.0 with live mid-turn
36
+ steering (`turn/steer`), cooperative stop (`turn/interrupt`), plan/reasoning/tool
37
+ streaming, and bidirectional confirmation/approval cards.
38
+ - `claude`: drives `claude -p --output-format stream-json --verbose` with `--resume`
39
+ thread continuity, `TodoWrite` plan mapping, and queued follow-up steering.
40
+ - `acp`: drives any Agent Client Protocol (ACP) agent via `--acp-command <cmd>` using
41
+ `@agentclientprotocol/sdk` (e.g. Gemini CLI, Goose, OpenHands, Copilot CLI).
42
+ - `exec`: runs a custom shell command via `--exec <cmd>` receiving a JSON task envelope
43
+ on stdin and emitting optional NDJSON events (`plan`, `thought`, `step`, `thread`,
44
+ `complete`) or plain text on stdout.
45
+ - Defaults and isolation:
46
+ - `--workspace-mode worktree` (default for Git repositories) creates an isolated
47
+ per-Work-Item Git worktree under `.specflow/worktrees/<SAFE_KEY>` and falls back to
48
+ `shared` for non-Git directories.
49
+ - `--sandbox workspace-write` and `--approval-policy auto` auto-approve operations inside
50
+ the sandbox while still surfacing explicit user questions (`requestUserInput` /
51
+ elicitation) as interactive cards in the SpecFlow Web drawer. Pass
52
+ `--approval-policy ask` to prompt on every command or file-change approval.
53
+ - Optional Symphony-style `WORKFLOW.md` (auto-loaded from `--cwd` or `--workflow <path>`)
54
+ configures prompt templates, concurrency, and hot-reloading. Explicit CLI flags always
55
+ override `WORKFLOW.md`. For safety, executable settings (`runner`, `sandbox`, `approval`,
56
+ `workspaceMode`, `worktreeRoot`, `acpCommand`, `execCommand`) and lifecycle hooks
57
+ (`after_create`, `before_run`, `after_run`) are only honored when `--workflow <path>` or
58
+ `--trust-workflow` is passed, and remain frozen after startup in `--workspace-mode shared`.
59
+ - Secrets (`Bearer`, API keys, tokens, JWTs, URL credentials) are redacted locally before
60
+ streaming to SpecFlow, and `SPEC_FLOW_API_KEY` / `SPEC_FLOW_WORKSPACE_READ_TOKEN` are
61
+ stripped from child agent environments and `WORKFLOW.md` expansion.
62
+
19
63
  ## Listening for durable Agent events
20
64
 
21
- Listen for assignments, `@agent` mentions, and live session control signals with cursor
22
- locking and atomic local cursor persistence:
65
+ For custom external schedulers or low-level integrations, listen for assignments, `@agent`
66
+ mentions, and live session control signals with cursor locking and atomic local cursor
67
+ persistence:
23
68
 
24
69
  ```sh
25
70
  specflow agent listen --workspace-id WORKSPACE_ID --agent my-agent
package/guides/boards.md CHANGED
@@ -84,12 +84,28 @@ specflow board import --workspace-id WORKSPACE --document-id PAY-D3 --file topol
84
84
 
85
85
  Run the replace write only after the User agrees to lose the existing layout.
86
86
  `--file` is a Mermaid flowchart (`.mmd`: `flowchart LR`, `subgraph`, node shapes
87
- `[box]`, `(round)`, `{decision}`, `[(database)]`, edges `-->` with `|label|`) or
88
- topology JSON (`.json`, also a `board read` result). `new` adds a board, `append`
87
+ `[box]`, `(round)`, `{decision}`, `[(database)]`, edges `-->`, `-.->` dashed, `==>`
88
+ thick with `|label|`, plus `classDef`, `class`, `:::class`, `style`, and `linkStyle`)
89
+ or topology JSON (`.json`, also a `board read` result). `new` adds a board, `append`
89
90
  lays new nodes beside an existing board and may connect them to its node IDs,
90
91
  `replace` keeps the board's ID and title and lays it out anew (the old picture stays
91
92
  in earlier Revisions).
92
93
 
94
+ ## Colors and styles
95
+
96
+ Colors align directly with the Web board (Excalidraw) palette so light and dark themes
97
+ match manual drawings:
98
+
99
+ - Built-in `color` presets: `gray`, `bronze`, `cyan`, `blue`, `violet`, `grape`, `pink`,
100
+ `green`, `teal`, `yellow`, `orange`, `red`. Pass `null` in `board edit` to reset to
101
+ the default board color.
102
+ - Exact passthrough fields for custom Web pairings: `strokeColor` and `backgroundColor`
103
+ (`#rrggbb`, `black`, `white`, or `transparent`), `fillStyle` (`solid`, `hachure`,
104
+ `cross-hatch`) on nodes and groups, `strokeStyle` (`solid`, `dashed`, `dotted`) on
105
+ edges, and `strokeWidth` (`1`, `2`, `4`) on nodes, groups, and edges.
106
+ - In Mermaid `.mmd`, external Hex colors in `classDef` / `style` / `linkStyle` map to
107
+ the nearest Excalidraw palette swatch and report the mapping in `warnings`.
108
+
93
109
  ## Edit
94
110
 
95
111
  ```sh
@@ -98,10 +114,13 @@ specflow board edit --workspace-id WORKSPACE --document-id PAY-D3 --board-id BOA
98
114
  ```
99
115
 
100
116
  `--ops` is a JSON array (or `{"operations": [...]}`) applied in order, all or
101
- nothing: `setNodeLabel`, `setNodeShape`, `removeNode` (also removes its edges),
102
- `addEdge` (between existing nodes), `removeEdge`, `setEdgeLabel`, `moveNodeToGroup`,
103
- `removeNodeFromGroup`, `setGroupLabel`, `renameBoard`, `deleteBoard`. For example
104
- `[{"op": "setNodeLabel", "nodeId": "api", "label": "Gateway"}]`. A refused operation
117
+ nothing: `setNodeLabel`, `setNodeShape`, `setNodeColor`, `removeNode` (also removes
118
+ its edges), `addEdge` (between existing nodes; accepts optional `color`, `strokeColor`,
119
+ `strokeStyle`, `strokeWidth`), `removeEdge`, `setEdgeLabel`, `setEdgeStyle`,
120
+ `moveNodeToGroup`, `removeNodeFromGroup`, `setGroupLabel`, `setGroupColor`,
121
+ `renameBoard`, `deleteBoard`. For example:
122
+ `[{"op": "setNodeColor", "nodeId": "api", "color": "blue"}, {"op": "setEdgeStyle", "edgeId": "e1", "color": "red", "strokeStyle": "dashed"}]`.
123
+ Style operations preserve existing coordinates and routing. A refused operation
105
124
  is named in the error; nothing is applied. Ask the User before `deleteBoard`.
106
125
 
107
126
  ## Dry runs, keys and versions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gonovus-ai/spec-flow-cli",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
4
4
  "description": "SpecFlow supported command-line client",
5
5
  "repository": {
6
6
  "type": "git",
@@ -44,6 +44,7 @@
44
44
  "typecheck": "tsc -p tsconfig.json --noEmit"
45
45
  },
46
46
  "dependencies": {
47
+ "@agentclientprotocol/sdk": "^2.9.1",
47
48
  "@napi-rs/keyring": "1.3.0",
48
49
  "commander": "15.0.0",
49
50
  "open": "11.0.0",