@gonovus-ai/spec-flow-cli 2.0.0 → 2.1.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.
- package/README.md +4 -4
- package/dist/agent-session-commands.js +2 -0
- package/dist/agent-session-commands.js.map +1 -1
- package/dist/cli.js +11 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/work-item-output.d.ts +24 -0
- package/dist/github-connection-commands.js +2 -6
- package/dist/github-connection-commands.js.map +1 -1
- package/dist/group-notification-commands.d.ts +7 -0
- package/dist/group-notification-commands.js +245 -0
- package/dist/group-notification-commands.js.map +1 -0
- package/dist/runner/adapters/acp-adapter.js +2 -0
- package/dist/runner/adapters/acp-adapter.js.map +1 -1
- package/dist/runner/adapters/claude-stream.js +4 -1
- package/dist/runner/adapters/claude-stream.js.map +1 -1
- package/dist/runner/adapters/codex-app-server.js +5 -0
- package/dist/runner/adapters/codex-app-server.js.map +1 -1
- package/dist/runner/adapters/exec-adapter.js +2 -0
- package/dist/runner/adapters/exec-adapter.js.map +1 -1
- package/dist/runner/orchestrator.js +7 -1
- package/dist/runner/orchestrator.js.map +1 -1
- package/dist/runner/redact.d.ts +1 -0
- package/dist/runner/redact.js +1 -0
- package/dist/runner/redact.js.map +1 -1
- package/dist/runner/telemetry-bridge.d.ts +12 -0
- package/dist/runner/telemetry-bridge.js +58 -2
- package/dist/runner/telemetry-bridge.js.map +1 -1
- package/dist/runner/types.d.ts +5 -0
- package/dist/runtime/execute.d.ts +5 -0
- package/dist/runtime/execute.js +35 -12
- package/dist/runtime/execute.js.map +1 -1
- package/guides/agent-sessions.md +11 -2
- package/guides/errors.md +4 -2
- package/guides/work-items.md +53 -2
- package/package.json +1 -1
package/dist/runtime/execute.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { mapHttpFailure } from "./errors.js";
|
|
2
2
|
export async function execute(request, client, options = {}) {
|
|
3
|
+
let sentKey = null;
|
|
4
|
+
const tracker = {
|
|
5
|
+
onRequest({ request: sent }) {
|
|
6
|
+
sentKey = sent.headers.get("idempotency-key");
|
|
7
|
+
return undefined;
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
client.use(tracker);
|
|
11
|
+
// Only a key the failing request actually sent is reported: a preview read, a
|
|
12
|
+
// continuation under a fresh key or a second key never borrows the command's key.
|
|
13
|
+
const reportedKey = () => [options.idempotencyKey, options.commandKey].find((key) => key !== undefined && key === sentKey);
|
|
3
14
|
let result;
|
|
4
15
|
try {
|
|
5
16
|
result = await request(client);
|
|
@@ -13,9 +24,12 @@ export async function execute(request, client, options = {}) {
|
|
|
13
24
|
message: "SpecFlow is temporarily unavailable",
|
|
14
25
|
reason: "Temporary Failure",
|
|
15
26
|
retryable: true,
|
|
16
|
-
},
|
|
27
|
+
}, reportedKey()),
|
|
17
28
|
};
|
|
18
29
|
}
|
|
30
|
+
finally {
|
|
31
|
+
client.eject(tracker);
|
|
32
|
+
}
|
|
19
33
|
if (result.response.ok && result.data !== undefined) {
|
|
20
34
|
const error = options.validateSuccess?.(result.data) ?? null;
|
|
21
35
|
return error === null ? { ok: true, data: result.data } : { ok: false, error };
|
|
@@ -27,24 +41,33 @@ export async function execute(request, client, options = {}) {
|
|
|
27
41
|
ok: false,
|
|
28
42
|
error: withCommandKey(uncertain
|
|
29
43
|
? ambiguousMutationError(options.ambiguousOutcomeMessage)
|
|
30
|
-
: mapHttpFailure(result.response, result.error),
|
|
44
|
+
: mapHttpFailure(result.response, result.error), reportedKey()),
|
|
31
45
|
};
|
|
32
46
|
}
|
|
33
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* A keyed write that may have committed, or that may be retried, names the key to retry it
|
|
49
|
+
* with: an unknown outcome is reread first, a retryable Temporary Failure is retried as is.
|
|
50
|
+
*/
|
|
34
51
|
function withCommandKey(error, idempotencyKey) {
|
|
35
|
-
if (idempotencyKey === undefined
|
|
36
|
-
(error.reason !== "Temporary Failure" && error.code !== "EXECUTION_OUTCOME_UNKNOWN"))
|
|
52
|
+
if (idempotencyKey === undefined)
|
|
37
53
|
return error;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
54
|
+
const retry = `retry with --idempotency-key ${idempotencyKey} and the same inputs`;
|
|
55
|
+
if (error.code === "EXECUTION_OUTCOME_UNKNOWN")
|
|
56
|
+
return {
|
|
57
|
+
...error,
|
|
58
|
+
message: error.message === UNKNOWN_OUTCOME
|
|
59
|
+
? `Write outcome is unknown; read the target resource, and if the write did not land, ${retry}`
|
|
60
|
+
: `${error.message} (if the write did not land, ${retry})`,
|
|
61
|
+
idempotencyKey,
|
|
62
|
+
};
|
|
63
|
+
if (error.reason === "Temporary Failure" && error.retryable)
|
|
64
|
+
return { ...error, message: `${error.message} (${retry})`, idempotencyKey };
|
|
65
|
+
return error;
|
|
43
66
|
}
|
|
67
|
+
const UNKNOWN_OUTCOME = "Write outcome is unknown; read the target resource before trying a new command identity";
|
|
44
68
|
function ambiguousMutationError(message) {
|
|
45
69
|
return {
|
|
46
|
-
message: message ??
|
|
47
|
-
"Write outcome is unknown; read the target resource before trying a new command identity",
|
|
70
|
+
message: message ?? UNKNOWN_OUTCOME,
|
|
48
71
|
code: "EXECUTION_OUTCOME_UNKNOWN",
|
|
49
72
|
reason: "Temporary Failure",
|
|
50
73
|
retryable: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/runtime/execute.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAmB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/runtime/execute.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAmB,MAAM,aAAa,CAAC;AA8B9D,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,OAAkF,EAClF,MAA8C,EAC9C,UAA0B,EAAE;IAE5B,IAAI,OAAO,GAAkB,IAAI,C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AK,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,KAAK,KAAK,GAAG,EAAE,cAAc,EAAE,CAAC;IAC9E,OAAO,KAAK,CAAC;AACf,CAAC;AACD,MAAM,eAAe,GACnB,yFAAyF,CAAC;AAC5F,SAAS,sBAAsB,CAAC,OAAgB;IAC9C,OAAO;QACL,OAAO,EAAE,OAAO,IAAI,eAAe;QACnC,IAAI,EAAE,2BAA2B;QACjC,MAAM,EAAE,mBAAmB;QAC3B,SAAS,EAAE,KAAK;KACjB,CAAC;AACJ,CAAC"}
|
package/guides/agent-sessions.md
CHANGED
|
@@ -41,7 +41,8 @@ specflow agent run --workspace-id WORKSPACE_ID --agent my-agent --once --dry-run
|
|
|
41
41
|
`@agentclientprotocol/sdk` (e.g. Gemini CLI, Goose, OpenHands, Copilot CLI).
|
|
42
42
|
- `exec`: runs a custom shell command via `--exec <cmd>` receiving a JSON task envelope
|
|
43
43
|
on stdin and emitting optional NDJSON events (`plan`, `thought`, `step`, `thread`,
|
|
44
|
-
`complete`) or plain text on stdout.
|
|
44
|
+
`complete`) or plain text on stdout. A `step` with the same `stepId` as an earlier
|
|
45
|
+
one updates that step instead of adding a line.
|
|
45
46
|
- Defaults and isolation:
|
|
46
47
|
- `--workspace-mode worktree` (default for Git repositories) creates an isolated
|
|
47
48
|
per-Work-Item Git worktree under `.specflow/worktrees/<SAFE_KEY>` and falls back to
|
|
@@ -105,10 +106,18 @@ explicitly mentions the Agent in comments), and link it with `--result-comment-i
|
|
|
105
106
|
SPEC_FLOW_AGENT=my-agent specflow agent session start --project-id PROJECT_ID --work-item-id PAY-12 --summary 'Inspecting task requirements'
|
|
106
107
|
SPEC_FLOW_AGENT=my-agent specflow agent session plan --project-id PROJECT_ID --session-id RUN_ID --steps-json '[{"id":"s1","title":"Inspect codebase","status":"in_progress"},{"id":"s2","title":"Run tests","status":"pending"}]' --summary 'Planned 2 steps'
|
|
107
108
|
SPEC_FLOW_AGENT=my-agent specflow agent session thought --project-id PROJECT_ID --session-id RUN_ID --title 'Root cause' --body 'Sanitized summary of findings'
|
|
108
|
-
SPEC_FLOW_AGENT=my-agent specflow agent session step --project-id PROJECT_ID --session-id RUN_ID --title 'Run unit tests' --tool vitest --status
|
|
109
|
+
SPEC_FLOW_AGENT=my-agent specflow agent session step --project-id PROJECT_ID --session-id RUN_ID --step-id tests-1 --title 'Run unit tests' --tool vitest --status running --command 'pnpm test'
|
|
110
|
+
SPEC_FLOW_AGENT=my-agent specflow agent session step --project-id PROJECT_ID --session-id RUN_ID --step-id tests-1 --title 'Run unit tests' --tool vitest --status completed --duration-ms 1420 --command 'pnpm test' --output-summary '12 passed'
|
|
109
111
|
SPEC_FLOW_AGENT=my-agent specflow agent session complete --project-id PROJECT_ID --session-id RUN_ID --summary 'Implemented fix and verified tests' --result-comment-id COMMENT_ID --checks-summary 'unit + typecheck passed'
|
|
110
112
|
```
|
|
111
113
|
|
|
114
|
+
- Thoughts are messages a person reads in the drawer: report one when the Agent has a new
|
|
115
|
+
finding, decision, or summary. Never mirror a terminal status bar, spinner, or elapsed
|
|
116
|
+
timer as thoughts; every report adds a line.
|
|
117
|
+
- Give each step a stable `--step-id` (for example the tool call id). Reporting the same
|
|
118
|
+
`--step-id` again, such as `running` and then `completed` or `failed`, updates that step
|
|
119
|
+
in place instead of adding a second line. Use it for live "what is running now" status
|
|
120
|
+
too: keep one id for the current command and update its title and status.
|
|
112
121
|
- `specflow agent session start` attaches to an existing `pending` session for the same
|
|
113
122
|
Agent on that Work Item (for example, a session created by `retry`) unless `--new` is
|
|
114
123
|
passed.
|
package/guides/errors.md
CHANGED
|
@@ -12,7 +12,9 @@ with `location`, `path`, `rule` and `message`. Use those fields to correct input
|
|
|
12
12
|
never assume a missing HTTP status means the server accepted the command. Existing
|
|
13
13
|
`reason`, exit codes and Markdown `diagnostics` remain the compatibility contract.
|
|
14
14
|
If `code=EXECUTION_OUTCOME_UNKNOWN`, first reread the target resource; do not create
|
|
15
|
-
a new command identity and blindly repeat the write.
|
|
15
|
+
a new command identity and blindly repeat the write. When the error names an
|
|
16
|
+
`idempotencyKey` and the reread shows the write did not land, retry with that key and
|
|
17
|
+
the same inputs, never a fresh key: the earlier attempt may still commit. A 413 requires smaller input;
|
|
16
18
|
a 428 requires the current observed version, not waiting and retrying unchanged.
|
|
17
19
|
|
|
18
20
|
- `Authentication Failed`: stop and ask the User to authenticate again.
|
|
@@ -30,7 +32,7 @@ a 428 requires the current observed version, not waiting and retrying unchanged.
|
|
|
30
32
|
it to the Working Draft, run `specflow spec assign-scenario-ids`, and Publish
|
|
31
33
|
instead. Never hand-edit Scenario IDs; assignment is the only repair path.
|
|
32
34
|
- `Temporary Failure`: retry only when `retryable` is true, and honor `retryAfter` when
|
|
33
|
-
present.
|
|
35
|
+
present. A write retried after a Temporary Failure keeps its `idempotencyKey` and inputs.
|
|
34
36
|
|
|
35
37
|
Disabled Users, revoked or expired Sessions, Role downgrade, Project Archive, and
|
|
36
38
|
stale expected versions are authoritative current-state failures. Do not reuse cached
|
package/guides/work-items.md
CHANGED
|
@@ -16,7 +16,8 @@ people who pick it up understand the real problem, not a guessed implementation.
|
|
|
16
16
|
`work-item relation create --type related`.
|
|
17
17
|
- Pick the format by what the item is, not by who files it, judging from the content.
|
|
18
18
|
Ask the User when it is unclear. Use Technical task only for engineering work the
|
|
19
|
-
User asks for as such, such as an upgrade
|
|
19
|
+
User asks for as such, such as an upgrade, a refactor or the engineering pieces of a
|
|
20
|
+
Requirement breakdown; never turn a Bug or
|
|
20
21
|
Requirement into one. When rewriting, keep the Task's format unless the User asks to
|
|
21
22
|
change it. The format shapes the title and description only: there is no type
|
|
22
23
|
field, so do not invent a title prefix, label or custom field the Project lacks.
|
|
@@ -44,6 +45,56 @@ people who pick it up understand the real problem, not a guessed implementation.
|
|
|
44
45
|
and verification notes in comments or a section of their own, never over the
|
|
45
46
|
product description.
|
|
46
47
|
|
|
48
|
+
### A Requirement is the parent of the work that delivers it
|
|
49
|
+
|
|
50
|
+
SpecFlow tracks a Requirement and the Tasks that deliver it as one tree: the
|
|
51
|
+
Requirement is the parent, each Task that delivers it is a subtask. The parent then
|
|
52
|
+
shows the children's progress, and the `hasParent`/`hasChildren` filters and the
|
|
53
|
+
`parent` view grouping keep the work together.
|
|
54
|
+
|
|
55
|
+
- When the User breaks a Requirement into work, or files work that delivers one (an
|
|
56
|
+
implementation, design or test Task, a Technical task, a Bug whose fix is part of
|
|
57
|
+
delivering it), search for the Requirement and for delivery Tasks that already exist,
|
|
58
|
+
then link each new or existing one as a child: `work-item subtask link --project-id
|
|
59
|
+
PARENT_PROJECT --parent REQ --child TASK --idempotency-key KEY`, adding
|
|
60
|
+
`--child-project-id` for a child in another Project. Do not use `related` for this,
|
|
61
|
+
and do not fold the children into the Requirement's description. File a missing
|
|
62
|
+
Requirement only when the User's request includes it; otherwise file the requested
|
|
63
|
+
Tasks unlinked, say which Requirement you could not find, and ask where they belong.
|
|
64
|
+
- Each child is one deliverable with its own owner and verifiable result. Existing
|
|
65
|
+
children keep their format; a new child takes the format that fits it: Technical
|
|
66
|
+
task for engineering work in a breakdown the User asked for, Requirement for a
|
|
67
|
+
user-facing sub-capability, Bug for a defect. Keep the Requirement's description on
|
|
68
|
+
the user problem and expected behavior; the how goes in the children.
|
|
69
|
+
- Prefer one level of subtasks; add another level only when the User asks.
|
|
70
|
+
- A Bug found after the Requirement was done is a separate follow-up: search for an
|
|
71
|
+
existing one first, and link it (or a new one) `related`, not as a child of a
|
|
72
|
+
finished Requirement.
|
|
73
|
+
- Do not move the Requirement to done because its children are: its owner accepts it.
|
|
74
|
+
|
|
75
|
+
### Every Task has one owner
|
|
76
|
+
|
|
77
|
+
A Task's assignee is its owner: the one person who answers for getting it done. It
|
|
78
|
+
has at most one, and other roles are not assignees.
|
|
79
|
+
|
|
80
|
+
- The Requirement's owner answers for the outcome and accepts it, usually whoever
|
|
81
|
+
owns the product decision. Each child's owner is whoever does that piece. They may
|
|
82
|
+
be different people; when you report, say who owns the Requirement (outcome and
|
|
83
|
+
acceptance) and who owns each child.
|
|
84
|
+
- People with another role on the Task (reviewer, tester, the person who reported
|
|
85
|
+
it) can watch it; add them as watchers when the User asks, never as co-owners, a
|
|
86
|
+
title prefix or a label. Watcher commands take User IDs only (from `work-item
|
|
87
|
+
watcher-candidates`), not names or `me`; when you pass `--initial-watcher-ids`,
|
|
88
|
+
include the creator's User ID (`auth whoami`) if they should keep watching.
|
|
89
|
+
- Assign only owners the User named (`--assignee` takes a User ID, exact name or
|
|
90
|
+
Member Alias). Do not assign
|
|
91
|
+
the User or yourself by default; use `--assignee me` only when the User says they
|
|
92
|
+
take it and the selected credential is theirs.
|
|
93
|
+
- A missing owner alone never blocks filing: file without an assignee. An unclear
|
|
94
|
+
format or problem still needs the User's answer before you file. In your reply, ask
|
|
95
|
+
once about the items whose owner is still undecided, all of them together. Respect
|
|
96
|
+
a User who says to leave an item unassigned.
|
|
97
|
+
|
|
47
98
|
## Links, watchers and comments
|
|
48
99
|
|
|
49
100
|
- When the User asks to associate a Task with supporting resources, use
|
|
@@ -152,7 +203,7 @@ that omits `url` still yields a successful business result with one stderr warni
|
|
|
152
203
|
|
|
153
204
|
```sh
|
|
154
205
|
specflow auth whoami
|
|
155
|
-
specflow work-item create --project-id PROJECT --title 'Prepare release' --assignee me --description-file ./release.md --output summary
|
|
206
|
+
specflow work-item create --project-id PROJECT --title 'Prepare release' --assignee me --description-file ./release.md --output summary # the User takes it
|
|
156
207
|
cat ./release.md | specflow work-item update --project-id PROJECT --work-item-id GON-78 --expected-version '"3"' --description-file - --output summary
|
|
157
208
|
specflow work-item subtask link --project-id PROJECT --parent GON-78 --child GON-79 --child-project-id OTHER_PROJECT --idempotency-key KEY
|
|
158
209
|
```
|