@gonovus-ai/spec-flow-cli 1.2.0 → 1.3.0

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 (54) 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 +62 -14
  54. package/package.json +2 -1
@@ -0,0 +1,182 @@
1
+ import type { paths } from "@spec-flow/api-client";
2
+ export type RunnerKind = "codex" | "claude" | "acp" | "exec";
3
+ export type WorkspaceMode = "worktree" | "shared";
4
+ export type ApprovalMode = "auto" | "ask" | "never";
5
+ export type SandboxMode = "read-only" | "workspace-write" | "danger-full-access";
6
+ export type CommentMode = "final" | "none";
7
+ export type AgentEventRecord = paths["/v1/workspaces/{workspaceId}/agents/{agentId}/events"]["get"]["responses"][200]["content"]["application/json"]["events"][number];
8
+ export type PlanStepStatus = "pending" | "in_progress" | "completed" | "failed" | "skipped";
9
+ export interface PlanStepInput {
10
+ readonly id: string;
11
+ readonly title: string;
12
+ readonly status: PlanStepStatus;
13
+ readonly detail?: string | null;
14
+ }
15
+ export interface ActionStepInput {
16
+ readonly title: string;
17
+ readonly status: "running" | "completed" | "failed";
18
+ readonly body?: string;
19
+ readonly tool?: string;
20
+ readonly durationMs?: number;
21
+ readonly command?: string;
22
+ readonly outputSummary?: string;
23
+ }
24
+ export interface ElicitationOptionInput {
25
+ readonly id: string;
26
+ readonly label: string;
27
+ readonly description?: string | null;
28
+ }
29
+ export interface ElicitationRequestInput {
30
+ readonly prompt: string;
31
+ readonly options: readonly ElicitationOptionInput[];
32
+ readonly allowFreeText?: boolean;
33
+ }
34
+ export interface ElicitationAnswer {
35
+ readonly elicitationId: string;
36
+ readonly selectedOptionId: string | null;
37
+ readonly selectedOptionLabel: string | null;
38
+ readonly freeText: string | null;
39
+ readonly cancelled: boolean;
40
+ }
41
+ export interface WorkItemContext {
42
+ readonly workspaceId: string;
43
+ readonly projectId: string;
44
+ readonly workItemId: string;
45
+ readonly workItemKey: string;
46
+ readonly title: string;
47
+ readonly description: string | null;
48
+ readonly status: string | null;
49
+ readonly priority: string | null;
50
+ readonly url: string | null;
51
+ readonly recentComments: readonly {
52
+ readonly id: string;
53
+ readonly authorName: string;
54
+ readonly authorIsAgent: boolean;
55
+ readonly content: string;
56
+ readonly createdAt: string;
57
+ }[];
58
+ readonly triggeringEvent: AgentEventRecord;
59
+ }
60
+ export interface WorkflowHooks {
61
+ readonly afterCreate?: string;
62
+ readonly beforeRun?: string;
63
+ readonly afterRun?: string;
64
+ readonly timeoutMs: number;
65
+ }
66
+ export interface WorkflowDefinition {
67
+ readonly sourcePath: string;
68
+ readonly mtimeMs: number;
69
+ readonly runner?: RunnerKind;
70
+ readonly model?: string;
71
+ readonly sandbox?: SandboxMode;
72
+ readonly approval?: ApprovalMode;
73
+ readonly workspaceMode?: WorkspaceMode;
74
+ readonly worktreeRoot?: string;
75
+ readonly concurrency?: number;
76
+ readonly commentMode?: CommentMode;
77
+ readonly acpCommand?: string;
78
+ readonly execCommand?: string;
79
+ readonly stallTimeoutMs?: number;
80
+ readonly hooks: WorkflowHooks;
81
+ readonly promptTemplate: string | null;
82
+ }
83
+ export type RunnerCliOverrideKey = "runner" | "model" | "sandbox" | "approval" | "workspaceMode" | "worktreeRoot" | "concurrency" | "commentMode" | "acpCommand" | "execCommand" | "stallTimeoutMs";
84
+ export interface RunnerConfig {
85
+ readonly workspaceId: string;
86
+ readonly agent: string;
87
+ readonly runner: RunnerKind;
88
+ readonly cwd: string;
89
+ readonly workspaceMode: WorkspaceMode;
90
+ readonly worktreeRoot?: string;
91
+ readonly concurrency: number;
92
+ readonly sandbox: SandboxMode;
93
+ readonly approval: ApprovalMode;
94
+ readonly commentMode: CommentMode;
95
+ readonly model?: string;
96
+ readonly acpCommand?: string;
97
+ readonly execCommand?: string;
98
+ readonly codexCommand: string;
99
+ readonly claudeCommand: string;
100
+ readonly workflowPath?: string;
101
+ readonly trustWorkflow?: boolean;
102
+ readonly cliOverrides?: ReadonlySet<RunnerCliOverrideKey>;
103
+ readonly cursorFile?: string;
104
+ readonly stateFile?: string;
105
+ readonly after?: number;
106
+ readonly limit: number;
107
+ readonly wait: number;
108
+ readonly once: boolean;
109
+ readonly dryRun: boolean;
110
+ readonly autoRegister: boolean;
111
+ readonly name?: string;
112
+ readonly projectIds: readonly string[];
113
+ readonly stallTimeoutMs: number;
114
+ readonly extraArgs: readonly string[];
115
+ }
116
+ export interface RunnerTurnResult {
117
+ readonly outcome: "completed" | "interrupted" | "failed";
118
+ readonly finalMessage: string;
119
+ readonly summary?: string;
120
+ readonly errorMessage?: string;
121
+ readonly errorCode?: string;
122
+ readonly checksSummary?: string;
123
+ readonly pullRequestUrl?: string;
124
+ readonly pullRequestTitle?: string;
125
+ readonly runnerThreadId?: string;
126
+ }
127
+ export interface RunnerAdapterCallbacks {
128
+ readonly onThreadId: (threadId: string) => void;
129
+ readonly onPlan: (steps: readonly PlanStepInput[], summary?: string) => Promise<void>;
130
+ readonly onThought: (body: string, title?: string) => Promise<void>;
131
+ readonly onStep: (step: ActionStepInput) => Promise<void>;
132
+ readonly onAsk: (request: ElicitationRequestInput) => Promise<ElicitationAnswer>;
133
+ readonly onAuthRequired: (scopeSummary: string, provider?: "github") => Promise<boolean>;
134
+ readonly onActivity: () => void;
135
+ readonly onDiagnostic: (message: string) => void;
136
+ }
137
+ export interface RunnerStartInput {
138
+ readonly sessionId: string;
139
+ readonly workItemKey: string;
140
+ readonly workItemTitle: string;
141
+ readonly cwd: string;
142
+ readonly prompt: string;
143
+ readonly resumeThreadId?: string;
144
+ readonly model?: string;
145
+ readonly sandbox: SandboxMode;
146
+ readonly approval: ApprovalMode;
147
+ readonly extraArgs: readonly string[];
148
+ readonly environment: Readonly<Record<string, string | undefined>>;
149
+ readonly event: AgentEventRecord;
150
+ readonly callbacks: RunnerAdapterCallbacks;
151
+ }
152
+ export interface RunnerSessionHandle {
153
+ /** Wait for the active turn to finish (completed, interrupted, or failed). */
154
+ readonly completion: Promise<RunnerTurnResult>;
155
+ /** Inject a live steering instruction into the active turn when supported; returns true if accepted live. */
156
+ readonly steer: (message: string) => Promise<boolean>;
157
+ /** Request cooperative stop of the active turn, escalating to process termination if needed. */
158
+ readonly stop: () => Promise<void>;
159
+ /** Terminate immediately (used on shutdown or stall timeout). */
160
+ readonly kill: () => Promise<void>;
161
+ }
162
+ export interface RunnerAdapter {
163
+ readonly kind: RunnerKind;
164
+ readonly startTurn: (input: RunnerStartInput) => Promise<RunnerSessionHandle>;
165
+ }
166
+ export interface PersistedWorkItemState {
167
+ readonly workItemId: string;
168
+ readonly workItemKey: string;
169
+ readonly projectId: string;
170
+ readonly lastSessionId: string;
171
+ readonly activeSessionId: string | null;
172
+ readonly runnerKind: RunnerKind;
173
+ readonly runnerThreadId: string | null;
174
+ readonly workspacePath: string | null;
175
+ readonly pid: number | null;
176
+ readonly updatedAt: string;
177
+ }
178
+ export interface PersistedRunnerState {
179
+ readonly workspaceId: string;
180
+ readonly agent: string;
181
+ readonly workItems: Readonly<Record<string, PersistedWorkItemState>>;
182
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runner/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { WorkItemContext, WorkflowDefinition } from "./types.js";
2
+ export declare function parseWorkflowMarkdown(rawContent: string, sourcePath: string, mtimeMs: number, baseDir: string, environment: Readonly<Record<string, string | undefined>>): WorkflowDefinition;
3
+ export declare function loadWorkflowIfPresent(cwd: string, explicitPath: string | undefined, environment: Readonly<Record<string, string | undefined>>, previous?: WorkflowDefinition | null): Promise<WorkflowDefinition | null>;
4
+ export declare function renderWorkItemPrompt(context: WorkItemContext, workflow: WorkflowDefinition | null, isFollowUpMention: boolean): string;
@@ -0,0 +1,272 @@
1
+ import { readFile, stat } from "node:fs/promises";
2
+ import { homedir } from "node:os";
3
+ import { isAbsolute, join, resolve } from "node:path";
4
+ const DEFAULT_HOOK_TIMEOUT_MS = 60_000;
5
+ function unquoteScalar(raw) {
6
+ const trimmed = raw.trim();
7
+ if ((trimmed.startsWith('"') && trimmed.endsWith('"') && trimmed.length >= 2) ||
8
+ (trimmed.startsWith("'") && trimmed.endsWith("'") && trimmed.length >= 2)) {
9
+ return trimmed.slice(1, -1);
10
+ }
11
+ return trimmed;
12
+ }
13
+ function parseScalarValue(raw) {
14
+ const trimmed = raw.trim();
15
+ if (trimmed === "" || trimmed === "null" || trimmed === "~")
16
+ return null;
17
+ if (trimmed === "true")
18
+ return true;
19
+ if (trimmed === "false")
20
+ return false;
21
+ if (/^-?\d+$/u.test(trimmed)) {
22
+ const parsed = Number(trimmed);
23
+ if (Number.isSafeInteger(parsed))
24
+ return parsed;
25
+ }
26
+ return unquoteScalar(trimmed);
27
+ }
28
+ /**
29
+ * Minimal, dependency-free YAML frontmatter parser supporting nested maps and
30
+ * block scalars (`|` / `>`) used by Symphony-style `WORKFLOW.md` files.
31
+ */
32
+ function parseFrontmatterYaml(yamlText) {
33
+ const root = {};
34
+ const lines = yamlText.replace(/\r\n/gu, "\n").split("\n");
35
+ const stack = [
36
+ { indent: -1, obj: root },
37
+ ];
38
+ let index = 0;
39
+ while (index < lines.length) {
40
+ const rawLine = lines[index] ?? "";
41
+ index += 1;
42
+ const trimmed = rawLine.trim();
43
+ if (trimmed.length === 0 || trimmed.startsWith("#"))
44
+ continue;
45
+ const indent = rawLine.length - rawLine.trimStart().length;
46
+ while (stack.length > 1 && (stack[stack.length - 1]?.indent ?? -1) >= indent) {
47
+ stack.pop();
48
+ }
49
+ const parent = stack[stack.length - 1]?.obj;
50
+ if (parent === undefined)
51
+ continue;
52
+ const colonIndex = trimmed.indexOf(":");
53
+ if (colonIndex <= 0)
54
+ continue;
55
+ const key = trimmed.slice(0, colonIndex).trim();
56
+ const rest = trimmed.slice(colonIndex + 1).trim();
57
+ if (rest === "|" || rest === ">") {
58
+ const blockLines = [];
59
+ let blockIndent = null;
60
+ while (index < lines.length) {
61
+ const nextLine = lines[index] ?? "";
62
+ if (nextLine.trim().length === 0) {
63
+ blockLines.push("");
64
+ index += 1;
65
+ continue;
66
+ }
67
+ const nextIndent = nextLine.length - nextLine.trimStart().length;
68
+ if (nextIndent <= indent)
69
+ break;
70
+ blockIndent ??= nextIndent;
71
+ blockLines.push(nextLine.slice(Math.min(blockIndent, nextIndent)));
72
+ index += 1;
73
+ }
74
+ parent[key] =
75
+ rest === ">"
76
+ ? blockLines.join(" ").replace(/\s+/gu, " ").trim()
77
+ : blockLines.join("\n").trimEnd();
78
+ continue;
79
+ }
80
+ if (rest.length === 0) {
81
+ const child = {};
82
+ parent[key] = child;
83
+ stack.push({ indent, obj: child });
84
+ continue;
85
+ }
86
+ parent[key] = parseScalarValue(rest);
87
+ }
88
+ return root;
89
+ }
90
+ function asRecord(value) {
91
+ return typeof value === "object" && value !== null && !Array.isArray(value)
92
+ ? value
93
+ : undefined;
94
+ }
95
+ function asString(value) {
96
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
97
+ }
98
+ function asPositiveInt(value) {
99
+ return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : undefined;
100
+ }
101
+ function expandPathToken(raw, baseDir, environment) {
102
+ const expandedEnv = raw.replace(/\$([A-Z0-9_]+)/gu, (_match, name) => {
103
+ return environment[name] ?? "";
104
+ });
105
+ const expandedHome = expandedEnv === "~"
106
+ ? (environment.HOME ?? homedir())
107
+ : expandedEnv.startsWith("~/")
108
+ ? join(environment.HOME ?? homedir(), expandedEnv.slice(2))
109
+ : expandedEnv;
110
+ return isAbsolute(expandedHome) ? expandedHome : resolve(baseDir, expandedHome);
111
+ }
112
+ function parseRunnerKind(value) {
113
+ return value === "codex" || value === "claude" || value === "acp" || value === "exec"
114
+ ? value
115
+ : undefined;
116
+ }
117
+ function parseSandboxMode(value) {
118
+ return value === "read-only" || value === "workspace-write" || value === "danger-full-access"
119
+ ? value
120
+ : undefined;
121
+ }
122
+ function parseApprovalMode(value) {
123
+ return value === "auto" || value === "ask" || value === "never" ? value : undefined;
124
+ }
125
+ function parseWorkspaceMode(value) {
126
+ return value === "worktree" || value === "shared" ? value : undefined;
127
+ }
128
+ function parseCommentMode(value) {
129
+ return value === "final" || value === "none" ? value : undefined;
130
+ }
131
+ export function parseWorkflowMarkdown(rawContent, sourcePath, mtimeMs, baseDir, environment) {
132
+ const normalized = rawContent.replace(/\r\n/gu, "\n");
133
+ let config = {};
134
+ let body = normalized.trim();
135
+ if (normalized.startsWith("---\n")) {
136
+ const endFence = normalized.indexOf("\n---", 4);
137
+ if (endFence !== -1) {
138
+ const yamlPart = normalized.slice(4, endFence);
139
+ const afterFence = normalized.slice(endFence + 4);
140
+ const bodyStart = afterFence.startsWith("\n") ? afterFence.slice(1) : afterFence;
141
+ config = parseFrontmatterYaml(yamlPart);
142
+ body = bodyStart.trim();
143
+ }
144
+ }
145
+ const agentSection = asRecord(config.agent);
146
+ const runnerSection = asRecord(config.runner);
147
+ const codexSection = asRecord(config.codex);
148
+ const workspaceSection = asRecord(config.workspace);
149
+ const hooksSection = asRecord(config.hooks);
150
+ const afterCreate = asString(hooksSection?.after_create);
151
+ const beforeRun = asString(hooksSection?.before_run);
152
+ const afterRun = asString(hooksSection?.after_run);
153
+ const hooks = {
154
+ ...(afterCreate === undefined ? {} : { afterCreate }),
155
+ ...(beforeRun === undefined ? {} : { beforeRun }),
156
+ ...(afterRun === undefined ? {} : { afterRun }),
157
+ timeoutMs: asPositiveInt(hooksSection?.timeout_ms) ?? DEFAULT_HOOK_TIMEOUT_MS,
158
+ };
159
+ const rawRoot = asString(workspaceSection?.root);
160
+ const runner = parseRunnerKind(runnerSection?.kind ?? config.runner);
161
+ const model = asString(runnerSection?.model ?? codexSection?.model ?? config.model);
162
+ const sandbox = parseSandboxMode(runnerSection?.sandbox ?? codexSection?.thread_sandbox ?? config.sandbox);
163
+ const approval = parseApprovalMode(runnerSection?.approval ?? codexSection?.approval_policy ?? config.approval);
164
+ const workspaceMode = parseWorkspaceMode(workspaceSection?.mode);
165
+ const worktreeRoot = rawRoot === undefined ? undefined : expandPathToken(rawRoot, baseDir, environment);
166
+ const concurrency = asPositiveInt(agentSection?.max_concurrent_agents ?? config.concurrency);
167
+ const commentMode = parseCommentMode(agentSection?.comment_mode ?? config.comment_mode);
168
+ const acpCommand = asString(runnerSection?.acp_command);
169
+ const execCommand = asString(runnerSection?.exec_command);
170
+ const stallTimeoutMs = asPositiveInt(codexSection?.stall_timeout_ms ?? runnerSection?.stall_timeout_ms);
171
+ return {
172
+ sourcePath,
173
+ mtimeMs,
174
+ ...(runner === undefined ? {} : { runner }),
175
+ ...(model === undefined ? {} : { model }),
176
+ ...(sandbox === undefined ? {} : { sandbox }),
177
+ ...(approval === undefined ? {} : { approval }),
178
+ ...(workspaceMode === undefined ? {} : { workspaceMode }),
179
+ ...(worktreeRoot === undefined ? {} : { worktreeRoot }),
180
+ ...(concurrency === undefined ? {} : { concurrency }),
181
+ ...(commentMode === undefined ? {} : { commentMode }),
182
+ ...(acpCommand === undefined ? {} : { acpCommand }),
183
+ ...(execCommand === undefined ? {} : { execCommand }),
184
+ ...(stallTimeoutMs === undefined ? {} : { stallTimeoutMs }),
185
+ hooks,
186
+ promptTemplate: body.length > 0 ? body : null,
187
+ };
188
+ }
189
+ export async function loadWorkflowIfPresent(cwd, explicitPath, environment, previous) {
190
+ const candidate = explicitPath !== undefined
191
+ ? isAbsolute(explicitPath)
192
+ ? explicitPath
193
+ : resolve(cwd, explicitPath)
194
+ : join(cwd, "WORKFLOW.md");
195
+ let fileStat;
196
+ try {
197
+ fileStat = await stat(candidate);
198
+ }
199
+ catch (error) {
200
+ if (explicitPath !== undefined) {
201
+ throw new Error(`Workflow file not found: ${candidate}`, { cause: error });
202
+ }
203
+ return null;
204
+ }
205
+ if (previous?.sourcePath === candidate && previous.mtimeMs === fileStat.mtimeMs) {
206
+ return previous;
207
+ }
208
+ const raw = await readFile(candidate, "utf8");
209
+ return parseWorkflowMarkdown(raw, candidate, fileStat.mtimeMs, cwd, environment);
210
+ }
211
+ export function renderWorkItemPrompt(context, workflow, isFollowUpMention) {
212
+ const commentsBlock = context.recentComments.length === 0
213
+ ? "(No comments yet)"
214
+ : context.recentComments
215
+ .map((comment) => `- ${comment.authorName}${comment.authorIsAgent ? " [Agent]" : ""} (${comment.createdAt}):\n ${comment.content.replace(/\n/gu, "\n ")}`)
216
+ .join("\n");
217
+ if (workflow?.promptTemplate !== null && workflow?.promptTemplate !== undefined) {
218
+ const variables = {
219
+ "issue.id": context.workItemId,
220
+ "issue.identifier": context.workItemKey,
221
+ "issue.key": context.workItemKey,
222
+ "issue.title": context.title,
223
+ "issue.description": context.description ?? "",
224
+ "issue.status": context.status ?? "",
225
+ "issue.priority": context.priority ?? "",
226
+ "issue.url": context.url ?? "",
227
+ "issue.comments": commentsBlock,
228
+ "work_item.id": context.workItemId,
229
+ "work_item.identifier": context.workItemKey,
230
+ "work_item.key": context.workItemKey,
231
+ "work_item.title": context.title,
232
+ "work_item.description": context.description ?? "",
233
+ "work_item.status": context.status ?? "",
234
+ "work_item.priority": context.priority ?? "",
235
+ "work_item.url": context.url ?? "",
236
+ "work_item.comments": commentsBlock,
237
+ comments: commentsBlock,
238
+ is_follow_up: isFollowUpMention ? "true" : "false",
239
+ "event.type": context.triggeringEvent.eventType,
240
+ "project.id": context.projectId,
241
+ "workspace.id": context.workspaceId,
242
+ };
243
+ return workflow.promptTemplate.replace(/\{\{\s*([a-zA-Z0-9_.]+)\s*\}\}/gu, (_m, key) => {
244
+ return variables[key] ?? "";
245
+ });
246
+ }
247
+ const header = isFollowUpMention
248
+ ? `You were @mentioned on SpecFlow Work Item ${context.workItemKey}. Review the latest comment and respond or apply the requested follow-up changes.`
249
+ : `You have been assigned SpecFlow Work Item ${context.workItemKey}. Complete the requested work cleanly in this repository.`;
250
+ const lines = [header, "", `Work Item: ${context.workItemKey} — ${context.title}`];
251
+ if (context.status !== null)
252
+ lines.push(`Status: ${context.status}`);
253
+ if (context.priority !== null)
254
+ lines.push(`Priority: ${context.priority}`);
255
+ if (context.url !== null)
256
+ lines.push(`URL: ${context.url}`);
257
+ lines.push("");
258
+ lines.push("## Description");
259
+ lines.push(context.description?.trim() ? context.description.trim() : "(No description provided)");
260
+ if (context.recentComments.length > 0) {
261
+ lines.push("");
262
+ lines.push("## Recent Discussion");
263
+ lines.push(commentsBlock);
264
+ }
265
+ lines.push("");
266
+ lines.push("## Execution Guidelines");
267
+ lines.push("- Work directly inside the provided repository workspace and run focused verification tests for any code changes.");
268
+ lines.push("- Never output raw API keys, tokens, cookies, or secrets in your final response.");
269
+ lines.push("- End with a concise, clear summary of what was investigated, changed, verified, and any PR URL or remaining follow-up.");
270
+ return lines.join("\n");
271
+ }
272
+ //# sourceMappingURL=workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/runner/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAatD,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAIvC,SAAS,aAAa,CAAC,GAAW;IAChC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IACE,CAAC,OAAO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C;IACf,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC7B,KAAK,CAAC,IAAI,CACR,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,2BAA2B,CACvF,CAAC;IACF,IAAI,OAAO,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC5B,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACtC,KAAK,CAAC,IAAI,CACR,mHAAmH,CACpH,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAC;IAC/F,KAAK,CAAC,IAAI,CACR,yHAAyH,CAC1H,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { WorkflowHooks, WorkspaceMode } from "./types.js";
2
+ export interface PreparedWorkspace {
3
+ readonly path: string;
4
+ readonly mode: WorkspaceMode;
5
+ readonly createdNow: boolean;
6
+ readonly worktreeBranch?: string;
7
+ }
8
+ /**
9
+ * Sanitize a Work Item key into a collision-resistant directory name following
10
+ * Symphony Section 9.5 invariants (only `[A-Za-z0-9._-]`).
11
+ */
12
+ export declare function deriveWorkspaceKey(workItemKey: string): string;
13
+ /**
14
+ * Enforce Symphony Invariant 2: a per-issue workspace path must strictly reside
15
+ * beneath the normalized workspace root (no traversal, cross-drive, or root escape).
16
+ */
17
+ export declare function assertWithinWorkspaceRoot(rootDir: string, candidatePath: string): string;
18
+ export declare function resolveEffectiveWorkspaceMode(cwd: string, requestedMode: WorkspaceMode): Promise<WorkspaceMode>;
19
+ export declare function runLifecycleHook(hookScript: string | undefined, cwd: string, timeoutMs: number, env: NodeJS.ProcessEnv): Promise<void>;
20
+ export declare function prepareWorkItemWorkspace(options: {
21
+ readonly baseCwd: string;
22
+ readonly mode: WorkspaceMode;
23
+ readonly worktreeRoot?: string;
24
+ readonly workItemKey: string;
25
+ readonly hooks?: WorkflowHooks;
26
+ readonly hookEnv: NodeJS.ProcessEnv;
27
+ readonly onDiagnostic: (message: string) => void;
28
+ }): Promise<PreparedWorkspace>;
29
+ export declare function summarizeWorkspaceChanges(cwd: string): Promise<string | undefined>;