@gonovus-ai/spec-flow-cli 2.5.1 → 2.6.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 (81) hide show
  1. package/README.md +16 -3
  2. package/dist/acceptance-commands.js +20 -2
  3. package/dist/acceptance-commands.js.map +1 -1
  4. package/dist/agent-commands.js +2 -0
  5. package/dist/agent-commands.js.map +1 -1
  6. package/dist/agent-preference-commands.d.ts +12 -0
  7. package/dist/agent-preference-commands.js +126 -0
  8. package/dist/agent-preference-commands.js.map +1 -0
  9. package/dist/capability-commands.d.ts +3 -0
  10. package/dist/capability-commands.js +92 -0
  11. package/dist/capability-commands.js.map +1 -0
  12. package/dist/cli-command-context.d.ts +31 -0
  13. package/dist/cli-command-context.js +2 -0
  14. package/dist/cli-command-context.js.map +1 -0
  15. package/dist/cli-command-support.d.ts +62 -0
  16. package/dist/cli-command-support.js +118 -0
  17. package/dist/cli-command-support.js.map +1 -0
  18. package/dist/cli.js +68 -3817
  19. package/dist/cli.js.map +1 -1
  20. package/dist/global-search-commands.d.ts +4 -0
  21. package/dist/global-search-commands.js +23 -0
  22. package/dist/global-search-commands.js.map +1 -0
  23. package/dist/notification-commands.d.ts +3 -0
  24. package/dist/notification-commands.js +184 -0
  25. package/dist/notification-commands.js.map +1 -0
  26. package/dist/project-commands.d.ts +4 -0
  27. package/dist/project-commands.js +127 -0
  28. package/dist/project-commands.js.map +1 -0
  29. package/dist/proposal-commands.d.ts +3 -0
  30. package/dist/proposal-commands.js +165 -0
  31. package/dist/proposal-commands.js.map +1 -0
  32. package/dist/resource-command-runtime.d.ts +2 -0
  33. package/dist/runner/orchestrator.js +3 -1
  34. package/dist/runner/orchestrator.js.map +1 -1
  35. package/dist/runner/telemetry-bridge.d.ts +13 -1
  36. package/dist/runner/telemetry-bridge.js +29 -2
  37. package/dist/runner/telemetry-bridge.js.map +1 -1
  38. package/dist/runner/types.d.ts +2 -0
  39. package/dist/runner/workflow.js +6 -0
  40. package/dist/runner/workflow.js.map +1 -1
  41. package/dist/spec-commands.d.ts +4 -0
  42. package/dist/spec-commands.js +347 -0
  43. package/dist/spec-commands.js.map +1 -0
  44. package/dist/token-commands.d.ts +3 -0
  45. package/dist/token-commands.js +79 -0
  46. package/dist/token-commands.js.map +1 -0
  47. package/dist/work-item-commands.d.ts +4 -0
  48. package/dist/work-item-commands.js +978 -0
  49. package/dist/work-item-commands.js.map +1 -0
  50. package/dist/work-item-comment-commands.d.ts +4 -0
  51. package/dist/work-item-comment-commands.js +160 -0
  52. package/dist/work-item-comment-commands.js.map +1 -0
  53. package/dist/work-item-custom-field-commands.d.ts +3 -0
  54. package/dist/work-item-custom-field-commands.js +209 -0
  55. package/dist/work-item-custom-field-commands.js.map +1 -0
  56. package/dist/work-item-label-commands.d.ts +3 -0
  57. package/dist/work-item-label-commands.js +224 -0
  58. package/dist/work-item-label-commands.js.map +1 -0
  59. package/dist/work-item-relation-commands.d.ts +4 -0
  60. package/dist/work-item-relation-commands.js +209 -0
  61. package/dist/work-item-relation-commands.js.map +1 -0
  62. package/dist/workflow-column-commands.d.ts +3 -0
  63. package/dist/workflow-column-commands.js +206 -0
  64. package/dist/workflow-column-commands.js.map +1 -0
  65. package/dist/workspace-commands.d.ts +4 -0
  66. package/dist/workspace-commands.js +299 -0
  67. package/dist/workspace-commands.js.map +1 -0
  68. package/dist/workspace-finding-commands.d.ts +4 -0
  69. package/dist/workspace-finding-commands.js +303 -0
  70. package/dist/workspace-finding-commands.js.map +1 -0
  71. package/dist/workspace-glossary-commands.d.ts +4 -0
  72. package/dist/workspace-glossary-commands.js +121 -0
  73. package/dist/workspace-glossary-commands.js.map +1 -0
  74. package/dist/workspace-review-commands.d.ts +4 -0
  75. package/dist/workspace-review-commands.js +108 -0
  76. package/dist/workspace-review-commands.js.map +1 -0
  77. package/guides/acceptance.md +8 -1
  78. package/guides/agent-sessions.md +34 -0
  79. package/guides/versions.md +5 -1
  80. package/guides/work-items.md +26 -2
  81. package/package.json +1 -1
@@ -0,0 +1,303 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { z } from "zod";
3
+ import { invalidArgument, parseOpaqueVersion, parseSearchLimit, rejectTokenWrite, } from "./cli-command-support.js";
4
+ import { writeSkillError } from "./runtime/errors.js";
5
+ import { hasWorkspaceReadToken } from "./runtime/session.js";
6
+ const findingReferenceSchema = z
7
+ .object({
8
+ kind: z.enum(["SharedPrecondition", "ExampleTable", "Title", "Rule", "Scenario", "Line"]),
9
+ text: z.string().trim().min(1).max(20_000),
10
+ })
11
+ .strict();
12
+ const findingTargetSchema = z
13
+ .object({
14
+ references: z.array(findingReferenceSchema).min(1).max(50),
15
+ specId: z
16
+ .string()
17
+ .trim()
18
+ .toUpperCase()
19
+ .regex(/^[A-Z]{2,10}-S[1-9]\d*$/u),
20
+ })
21
+ .strict();
22
+ const findingEvidenceSchema = z.discriminatedUnion("kind", [
23
+ z
24
+ .object({
25
+ incompatibleClaims: z.tuple([
26
+ z.string().trim().min(1).max(4_000),
27
+ z.string().trim().min(1).max(4_000),
28
+ ]),
29
+ kind: z.literal("Contradiction"),
30
+ })
31
+ .strict(),
32
+ z
33
+ .object({
34
+ incompatibleRequirements: z.tuple([
35
+ z.string().trim().min(1).max(4_000),
36
+ z.string().trim().min(1).max(4_000),
37
+ ]),
38
+ kind: z.literal("Conflict"),
39
+ })
40
+ .strict(),
41
+ z
42
+ .object({
43
+ duplicatedBehavior: z.string().trim().min(1).max(4_000),
44
+ kind: z.literal("Duplicate"),
45
+ })
46
+ .strict(),
47
+ z
48
+ .object({
49
+ interpretations: z.tuple([
50
+ z
51
+ .object({
52
+ behavior: z.string().trim().min(1).max(4_000),
53
+ meaning: z.string().trim().min(1).max(4_000),
54
+ })
55
+ .strict(),
56
+ z
57
+ .object({
58
+ behavior: z.string().trim().min(1).max(4_000),
59
+ meaning: z.string().trim().min(1).max(4_000),
60
+ })
61
+ .strict(),
62
+ ]),
63
+ kind: z.literal("Ambiguity"),
64
+ })
65
+ .strict(),
66
+ z
67
+ .object({
68
+ glossaryEntryIds: z.array(z.string().trim().min(1).max(200)).max(20),
69
+ issue: z.enum(["MissingDefinition", "GlossaryConflict", "MultipleMeanings"]),
70
+ kind: z.literal("Terminology"),
71
+ term: z.string().trim().min(1).max(200),
72
+ })
73
+ .strict(),
74
+ z
75
+ .object({
76
+ kind: z.literal("Unverifiable"),
77
+ missingCriterion: z.string().trim().min(1).max(4_000),
78
+ })
79
+ .strict(),
80
+ ]);
81
+ const findingCreateInputSchema = z
82
+ .object({
83
+ affectedScenarios: z.array(z.string().trim().min(1).max(300)).max(50),
84
+ conclusion: z.string().trim().min(1).max(4_000),
85
+ evidence: findingEvidenceSchema,
86
+ explanation: z.string().trim().min(1).max(8_000),
87
+ targets: z.array(findingTargetSchema).min(1).max(10),
88
+ })
89
+ .strict();
90
+ /** Older names stay accepted: the server reads Confirmed as open and Stale as awaiting a recheck. */
91
+ function parseFindingStatus(value) {
92
+ if (value === "Confirmed" ||
93
+ value === "Dismissed" ||
94
+ value === "Proposed" ||
95
+ value === "Resolved" ||
96
+ value === "Stale" ||
97
+ value === "Unresolved") {
98
+ return value;
99
+ }
100
+ throw invalidArgument("Finding status is not supported");
101
+ }
102
+ function parseFindingInput(value) {
103
+ let parsed;
104
+ try {
105
+ parsed = JSON.parse(value);
106
+ }
107
+ catch {
108
+ throw invalidArgument("Finding input must be valid JSON");
109
+ }
110
+ const finding = findingCreateInputSchema.safeParse(parsed);
111
+ if (!finding.success) {
112
+ throw invalidArgument("Finding input does not match the supported contract");
113
+ }
114
+ return finding.data;
115
+ }
116
+ /** Registers workspace review Findings. */
117
+ export function registerWorkspaceFindingCommands(context, workspace) {
118
+ const { dependencies, run, setExitCode } = context;
119
+ const workspaceFinding = workspace.command("finding");
120
+ workspaceFinding
121
+ .command("list")
122
+ .requiredOption("--workspace-id <workspaceId>")
123
+ .option("--spec-id <specId>")
124
+ .option("--status <status>", "Unresolved (or Proposed), Resolved or Dismissed; Confirmed and Stale are accepted as older names", parseFindingStatus)
125
+ .option("--awaiting-recheck", "Only open Findings whose cited content changed and await a recheck")
126
+ .option("--limit <limit>", "Maximum results", parseSearchLimit, 20)
127
+ .option("--cursor <cursor>")
128
+ .action(async (options) => {
129
+ setExitCode(await run((client) => options.specId === undefined
130
+ ? client.GET("/v1/workspaces/{workspaceId}/findings", {
131
+ params: {
132
+ path: { workspaceId: options.workspaceId },
133
+ query: {
134
+ limit: options.limit,
135
+ ...(options.cursor === undefined ? {} : { cursor: options.cursor }),
136
+ ...(options.status === undefined ? {} : { status: options.status }),
137
+ ...(options.awaitingRecheck === true ? { awaitingRecheck: "true" } : {}),
138
+ },
139
+ },
140
+ })
141
+ : client.GET("/v1/workspaces/{workspaceId}/specs/{specId}/findings", {
142
+ params: {
143
+ path: { workspaceId: options.workspaceId, specId: options.specId },
144
+ query: {
145
+ limit: options.limit,
146
+ ...(options.cursor === undefined ? {} : { cursor: options.cursor }),
147
+ ...(options.status === undefined ? {} : { status: options.status }),
148
+ ...(options.awaitingRecheck === true ? { awaitingRecheck: "true" } : {}),
149
+ },
150
+ },
151
+ }), { rejectWorkspaceReadToken: true }));
152
+ });
153
+ workspaceFinding
154
+ .command("read")
155
+ .requiredOption("--workspace-id <workspaceId>")
156
+ .requiredOption("--finding-id <findingId>")
157
+ .action(async (options) => {
158
+ setExitCode(await run((client) => client.GET("/v1/workspaces/{workspaceId}/findings/{findingId}", {
159
+ params: { path: options },
160
+ }), { rejectWorkspaceReadToken: true }));
161
+ });
162
+ workspaceFinding
163
+ .command("create")
164
+ .requiredOption("--workspace-id <workspaceId>")
165
+ .requiredOption("--input <input>")
166
+ .action(async (options) => {
167
+ if (hasWorkspaceReadToken(dependencies.environment)) {
168
+ setExitCode(rejectTokenWrite(dependencies));
169
+ return;
170
+ }
171
+ const idempotencyKey = randomUUID();
172
+ const input = parseFindingInput(options.input);
173
+ setExitCode(await run((client) => client.POST("/v1/workspaces/{workspaceId}/findings", {
174
+ body: input,
175
+ params: {
176
+ header: { "idempotency-key": idempotencyKey },
177
+ path: { workspaceId: options.workspaceId },
178
+ },
179
+ }), {
180
+ ambiguousOutcomeMessage: "Finding Creation outcome is unknown; inspect the Finding list before retrying",
181
+ retryTransportOnce: true,
182
+ }));
183
+ });
184
+ for (const [commandName, status, description] of [
185
+ [
186
+ "confirm",
187
+ "Confirmed",
188
+ "Deprecated: an open Finding needs no confirmation; returns it unchanged",
189
+ ],
190
+ ["dismiss", "Dismissed", "Close an open Finding as not worth fixing"],
191
+ ["resolve", "Resolved", "Close an open Finding as fixed"],
192
+ ["reopen", "Proposed", "Reopen a Resolved or Dismissed Finding"],
193
+ ]) {
194
+ const command = workspaceFinding
195
+ .command(commandName)
196
+ .description(description)
197
+ .requiredOption("--workspace-id <workspaceId>")
198
+ .requiredOption("--finding-id <findingId>")
199
+ .requiredOption("--expected-version <expectedVersion>", "Opaque version returned by SpecFlow", parseOpaqueVersion);
200
+ if (status === "Proposed")
201
+ command.option("--note <note>", "Why it is reopened; the next recheck reads it");
202
+ command.action(async (options) => {
203
+ if (hasWorkspaceReadToken(dependencies.environment)) {
204
+ setExitCode(rejectTokenWrite(dependencies));
205
+ return;
206
+ }
207
+ const idempotencyKey = randomUUID();
208
+ setExitCode(await run((client) => client.PATCH("/v1/workspaces/{workspaceId}/findings/{findingId}/status", {
209
+ body: {
210
+ status,
211
+ ...(options.note === undefined ? {} : { note: options.note }),
212
+ },
213
+ params: {
214
+ header: {
215
+ "idempotency-key": idempotencyKey,
216
+ "if-match": options.expectedVersion,
217
+ },
218
+ path: { findingId: options.findingId, workspaceId: options.workspaceId },
219
+ },
220
+ }), {
221
+ ambiguousOutcomeMessage: "Finding disposition outcome is unknown; read the Finding before retrying",
222
+ retryTransportOnce: true,
223
+ }));
224
+ });
225
+ }
226
+ workspaceFinding
227
+ .command("persists")
228
+ .description("Say a Finding awaiting a recheck still applies to the current Revision")
229
+ .requiredOption("--workspace-id <workspaceId>")
230
+ .requiredOption("--finding-id <findingId>")
231
+ .requiredOption("--expected-version <expectedVersion>", "Opaque version returned by SpecFlow", parseOpaqueVersion)
232
+ .action(async (options) => {
233
+ if (hasWorkspaceReadToken(dependencies.environment)) {
234
+ setExitCode(rejectTokenWrite(dependencies));
235
+ return;
236
+ }
237
+ const idempotencyKey = randomUUID();
238
+ setExitCode(await run((client) => client.PATCH("/v1/workspaces/{workspaceId}/findings/{findingId}/recheck", {
239
+ body: { outcome: "Persists" },
240
+ params: {
241
+ header: {
242
+ "idempotency-key": idempotencyKey,
243
+ "if-match": options.expectedVersion,
244
+ },
245
+ path: { findingId: options.findingId, workspaceId: options.workspaceId },
246
+ },
247
+ }), {
248
+ ambiguousOutcomeMessage: "Finding recheck answer outcome is unknown; read the Finding before retrying",
249
+ retryTransportOnce: true,
250
+ }));
251
+ });
252
+ workspaceFinding
253
+ .command("handler")
254
+ .description("Retired: Findings no longer have a Handler")
255
+ .allowUnknownOption()
256
+ .allowExcessArguments()
257
+ .action(() => {
258
+ writeSkillError(dependencies, {
259
+ message: "Findings no longer have a Handler. Resolve or dismiss the Finding, or turn it into a Work Item with `finding follow-up`.",
260
+ reason: "Invalid Operation",
261
+ retryable: false,
262
+ });
263
+ setExitCode(2);
264
+ });
265
+ workspaceFinding
266
+ .command("follow-up")
267
+ .requiredOption("--workspace-id <workspaceId>")
268
+ .requiredOption("--finding-id <findingId>")
269
+ .requiredOption("--project-id <projectId>")
270
+ .requiredOption("--idempotency-key <key>")
271
+ .action(async (options) => {
272
+ setExitCode(await run((client) => client.POST("/v1/workspaces/{workspaceId}/findings/{findingId}/work-item", {
273
+ body: { projectId: options.projectId },
274
+ params: {
275
+ path: { workspaceId: options.workspaceId, findingId: options.findingId },
276
+ header: { "idempotency-key": options.idempotencyKey },
277
+ },
278
+ }), { rejectWorkspaceReadToken: true }));
279
+ });
280
+ workspaceFinding
281
+ .command("discussion")
282
+ .requiredOption("--workspace-id <workspaceId>")
283
+ .requiredOption("--finding-id <findingId>")
284
+ .action(async (options) => {
285
+ setExitCode(await run((client) => client.GET("/v1/workspaces/{workspaceId}/findings/{findingId}/discussion", {
286
+ params: { path: options },
287
+ }), { rejectWorkspaceReadToken: true }));
288
+ });
289
+ workspaceFinding
290
+ .command("comment")
291
+ .requiredOption("--workspace-id <workspaceId>")
292
+ .requiredOption("--finding-id <findingId>")
293
+ .requiredOption("--body <body>")
294
+ .option("--parent-id <parentId>")
295
+ .requiredOption("--idempotency-key <key>")
296
+ .action(async (options) => {
297
+ setExitCode(await run((client) => client.POST("/v1/workspaces/{workspaceId}/findings/{findingId}/discussion", {
298
+ body: { body: options.body, parentId: options.parentId ?? null },
299
+ params: { path: options, header: { "idempotency-key": options.idempotencyKey } },
300
+ }), { rejectWorkspaceReadToken: true }));
301
+ });
302
+ }
303
+ //# sourceMappingURL=workspace-finding-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-finding-commands.js","sourceRoot":"","sources":["../src/workspace-finding-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GAGjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAyB7D,MAAM,sBAAsB,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,oBAAoB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACzF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;CAC3C,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ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,CAAC,MAAM,EAAE,EAAE,CACT,MAAM,CAAC,GAAG,CAAC,8DAA8D,EAAE;YACzE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;SAC1B,CAAC,EACJ,EAAE,wBAAwB,EAAE,IAAI,EAAE,CACnC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;IACL,gBAAgB;SACb,OAAO,CAAC,SAAS,CAAC;SAClB,cAAc,CAAC,8BAA8B,CAAC;SAC9C,cAAc,CAAC,0BAA0B,CAAC;SAC1C,cAAc,CAAC,eAAe,CAAC;SAC/B,MAAM,CAAC,wBAAwB,CAAC;SAChC,cAAc,CAAC,yBAAyB,CAAC;SACzC,MAAM,CACL,KAAK,EACH,OAKC,EACD,EAAE;QACF,WAAW,CACT,MAAM,GAAG,CACP,CAAC,MAAM,EAAE,EAAE,CACT,MAAM,CAAC,IAAI,CAAC,8DAA8D,EAAE;YAC1E,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE;YAChE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAAE,OAAO,CAAC,cAAc,EAAE,EAAE;SACjF,CAAC,EACJ,EAAE,wBAAwB,EAAE,IAAI,EAAE,CACnC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;AACN,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Command } from "commander";
2
+ import type { CliCommandContext } from "./cli-command-context.js";
3
+ /** Registers workspace Glossary and knowledge context. */
4
+ export declare function registerWorkspaceGlossaryCommands(context: CliCommandContext, workspace: Command): void;
@@ -0,0 +1,121 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { parseGlossaryEntries, rejectTokenWrite, toAgentProvenance, } from "./cli-command-support.js";
3
+ import { hasWorkspaceReadToken } from "./runtime/session.js";
4
+ /** Registers workspace Glossary and knowledge context. */
5
+ export function registerWorkspaceGlossaryCommands(context, workspace) {
6
+ const { dependencies, run, setExitCode } = context;
7
+ const workspaceGlossary = workspace.command("glossary");
8
+ workspaceGlossary
9
+ .command("revision")
10
+ .requiredOption("--workspace-id <workspaceId>")
11
+ .requiredOption("--revision-id <revisionId>")
12
+ .action(async (options) => {
13
+ setExitCode(await run((client) => client.GET(hasWorkspaceReadToken(dependencies.environment)
14
+ ? "/v1/workspaces/{workspaceId}/published/glossary/revisions/{revisionId}"
15
+ : "/v1/workspaces/{workspaceId}/glossary/revisions/{revisionId}", { params: { path: options } })));
16
+ });
17
+ workspaceGlossary
18
+ .command("read")
19
+ .requiredOption("--workspace-id <workspaceId>")
20
+ .action(async (options) => {
21
+ setExitCode(await run((client) => client.GET("/v1/workspaces/{workspaceId}/glossary", {
22
+ params: { path: { workspaceId: options.workspaceId } },
23
+ }), { rejectWorkspaceReadToken: true }));
24
+ });
25
+ workspaceGlossary
26
+ .command("changelog")
27
+ .requiredOption("--workspace-id <workspaceId>")
28
+ .action(async (options) => {
29
+ setExitCode(await run((client) => client.GET("/v1/workspaces/{workspaceId}/glossary/changelog", {
30
+ params: { path: { workspaceId: options.workspaceId } },
31
+ }), { rejectWorkspaceReadToken: true }));
32
+ });
33
+ workspaceGlossary
34
+ .command("draft")
35
+ .requiredOption("--workspace-id <workspaceId>")
36
+ .action(async (options) => {
37
+ if (hasWorkspaceReadToken(dependencies.environment)) {
38
+ setExitCode(rejectTokenWrite(dependencies));
39
+ return;
40
+ }
41
+ const idempotencyKey = randomUUID();
42
+ setExitCode(await run((client) => client.POST("/v1/workspaces/{workspaceId}/glossary/draft-session", {
43
+ params: {
44
+ header: { "idempotency-key": idempotencyKey },
45
+ path: { workspaceId: options.workspaceId },
46
+ },
47
+ }), {
48
+ ambiguousOutcomeMessage: "Glossary Draft Session outcome is unknown; read the Glossary before retrying",
49
+ retryTransportOnce: true,
50
+ }));
51
+ });
52
+ workspaceGlossary
53
+ .command("edit")
54
+ .requiredOption("--workspace-id <workspaceId>")
55
+ .requiredOption("--entries <entries>")
56
+ .option("--agent-revision <agentRevision>")
57
+ .option("--agent-model <agentModel>")
58
+ .option("--source-reference-ids <sourceReferenceIds>")
59
+ .action(async (options) => {
60
+ if (hasWorkspaceReadToken(dependencies.environment)) {
61
+ setExitCode(rejectTokenWrite(dependencies));
62
+ return;
63
+ }
64
+ const entries = parseGlossaryEntries(options.entries);
65
+ setExitCode(await run((client) => client.PUT("/v1/workspaces/{workspaceId}/glossary/draft", {
66
+ body: { entries, provenance: toAgentProvenance(options) },
67
+ params: { path: { workspaceId: options.workspaceId } },
68
+ })));
69
+ });
70
+ workspaceGlossary
71
+ .command("publish")
72
+ .requiredOption("--workspace-id <workspaceId>")
73
+ .option("--entry-ids <entryIds...>", "Publish only the selected term changes")
74
+ .action(async (options) => {
75
+ if (hasWorkspaceReadToken(dependencies.environment)) {
76
+ setExitCode(rejectTokenWrite(dependencies));
77
+ return;
78
+ }
79
+ const idempotencyKey = randomUUID();
80
+ setExitCode(await run((client) => client.POST("/v1/workspaces/{workspaceId}/glossary/publish", {
81
+ body: options.entryIds === undefined ? {} : { entryIds: options.entryIds },
82
+ params: {
83
+ header: { "idempotency-key": idempotencyKey },
84
+ path: { workspaceId: options.workspaceId },
85
+ },
86
+ }), {
87
+ ambiguousOutcomeMessage: "Glossary Publish outcome is unknown; inspect the Glossary Changelog before retrying",
88
+ retryTransportOnce: true,
89
+ }));
90
+ });
91
+ workspaceGlossary
92
+ .command("rollback")
93
+ .requiredOption("--workspace-id <workspaceId>")
94
+ .requiredOption("--revision-id <revisionId>")
95
+ .action(async (options) => {
96
+ if (hasWorkspaceReadToken(dependencies.environment)) {
97
+ setExitCode(rejectTokenWrite(dependencies));
98
+ return;
99
+ }
100
+ const idempotencyKey = randomUUID();
101
+ setExitCode(await run((client) => client.POST("/v1/workspaces/{workspaceId}/glossary/rollback", {
102
+ body: { revisionId: options.revisionId },
103
+ params: {
104
+ header: { "idempotency-key": idempotencyKey },
105
+ path: { workspaceId: options.workspaceId },
106
+ },
107
+ }), {
108
+ ambiguousOutcomeMessage: "Glossary Rollback outcome is unknown; inspect the Glossary Changelog before retrying",
109
+ retryTransportOnce: true,
110
+ }));
111
+ });
112
+ workspace
113
+ .command("context")
114
+ .requiredOption("--workspace-id <workspaceId>")
115
+ .action(async (options) => {
116
+ setExitCode(await run((client) => client.GET("/v1/workspaces/{workspaceId}/knowledge-context", {
117
+ params: { path: { workspaceId: options.workspaceId } },
118
+ }), { rejectWorkspaceReadToken: true }));
119
+ });
120
+ }
121
+ //# sourceMappingURL=workspace-glossary-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-glossary-commands.js","sourceRoot":"","sources":["../src/workspace-glossary-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,GAIlB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAM7D,0DAA0D;AAC1D,MAAM,UAAU,iCAAiC,CAC/C,OAA0B,EAC1B,SAAkB;IAElB,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,iBAAiB,GAAG,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxD,iBAAiB;SACd,OAAO,CAAC,UAAU,CAAC;SACnB,cAAc,CAAC,8BAA8B,CAAC;SAC9C,cAAc,CAAC,4BAA4B,CAAC;SAC5C,MAAM,CAAC,KAAK,EAAE,OAAiE,EAAE,EAAE;QAClF,WAAW,CACT,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACnB,MAAM,CAAC,GAAG,CACR,qBAAqB,CAAC,YAAY,CAAC,WAAW,CAAC;YAC7C,CAAC,CAAC,wEAAwE;YAC1E,CAAC,CAAC,8DAA8D,EAClE,EAAE,MAAM,EAAE,EAAE,IAAI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EAAE;gBACN,MAAM,EAAE,EAAE,iBAAiB,EAAE,cAAc,EAAE;gBAC7C,IAAI,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE;aAC3C;SACF,CAAC,EACJ;YACE,uBAAuB,EACrB,sFAAsF;YACxF,kBAAkB,EAAE,IAAI;SACzB,CACF,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEL,SAAS;SACN,OAAO,CAAC,SAAS,CAAC;SAClB,cAAc,CAAC,8BAA8B,CAAC;SAC9C,MAAM,CAAC,KAAK,EAAE,OAA+B,EAAE,EAAE;QAChD,WAAW,CACT,MAAM,GAAG,CACP,CAAC,MAAM,EAAE,EAAE,CACT,MAAM,CAAC,GAAG,CAAC,gDAAgD,EAAE;YAC3D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE;SACvD,CAAC,EACJ,EAAE,wBAAwB,EAAE,IAAI,EAAE,CACnC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Command } from "commander";
2
+ import type { CliCommandContext } from "./cli-command-context.js";
3
+ /** Registers workspace review plans and runs. */
4
+ export declare function registerWorkspaceReviewCommands(context: CliCommandContext, workspace: Command): void;
@@ -0,0 +1,108 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { z } from "zod";
3
+ import { invalidArgument, parseOpaqueVersion, } from "./cli-command-support.js";
4
+ const reviewPlanInputSchema = z.discriminatedUnion("cadence", [
5
+ z.object({ cadence: z.literal("Disabled") }).strict(),
6
+ z.object({ cadence: z.literal("Daily"), timeOfDay: z.string(), timeZone: z.string() }).strict(),
7
+ z
8
+ .object({
9
+ cadence: z.literal("Weekly"),
10
+ dayOfWeek: z.number().int().min(1).max(7),
11
+ timeOfDay: z.string(),
12
+ timeZone: z.string(),
13
+ })
14
+ .strict(),
15
+ ]);
16
+ const reviewFindingTypes = [
17
+ "Contradiction",
18
+ "Conflict",
19
+ "Duplicate",
20
+ "Terminology",
21
+ "Unverifiable",
22
+ "Ambiguity",
23
+ ];
24
+ function parseFindingTypeList(value) {
25
+ const names = value
26
+ .split(",")
27
+ .map((name) => name.trim())
28
+ .filter((name) => name.length > 0);
29
+ const types = reviewFindingTypes.filter((type) => names.includes(type));
30
+ if (names.length === 0 || types.length !== new Set(names).size)
31
+ throw invalidArgument(`Finding types must be among ${reviewFindingTypes.join(", ")}`);
32
+ return types;
33
+ }
34
+ /** Registers workspace review plans and runs. */
35
+ export function registerWorkspaceReviewCommands(context, workspace) {
36
+ const { run, setExitCode } = context;
37
+ const workspaceReview = workspace.command("review");
38
+ workspaceReview
39
+ .command("request")
40
+ .requiredOption("--workspace-id <workspaceId>")
41
+ .requiredOption("--spec-id <specId>")
42
+ .option("--idempotency-key <key>")
43
+ .action(async (options) => {
44
+ setExitCode(await run((client) => client.POST("/v1/workspaces/{workspaceId}/specs/{specId}/reviews", {
45
+ params: {
46
+ path: options,
47
+ header: { "idempotency-key": options.idempotencyKey ?? randomUUID() },
48
+ },
49
+ }), { rejectWorkspaceReadToken: true }));
50
+ });
51
+ workspaceReview
52
+ .command("history")
53
+ .requiredOption("--workspace-id <workspaceId>")
54
+ .action(async (options) => {
55
+ setExitCode(await run((client) => client.GET("/v1/workspaces/{workspaceId}/reviews", { params: { path: options } }), { rejectWorkspaceReadToken: true }));
56
+ });
57
+ workspaceReview
58
+ .command("read")
59
+ .requiredOption("--workspace-id <workspaceId>")
60
+ .requiredOption("--review-id <reviewId>")
61
+ .action(async (options) => {
62
+ setExitCode(await run((client) => client.GET("/v1/workspaces/{workspaceId}/reviews/{reviewId}", {
63
+ params: { path: options },
64
+ }), { rejectWorkspaceReadToken: true }));
65
+ });
66
+ workspaceReview
67
+ .command("plan")
68
+ .requiredOption("--workspace-id <workspaceId>")
69
+ .action(async (options) => {
70
+ setExitCode(await run((client) => client.GET("/v1/workspaces/{workspaceId}/review-schedule", {
71
+ params: { path: options },
72
+ }), { rejectWorkspaceReadToken: true }));
73
+ });
74
+ workspaceReview
75
+ .command("configure")
76
+ .requiredOption("--workspace-id <workspaceId>")
77
+ .requiredOption("--expected-version <expectedVersion>", "Opaque version", parseOpaqueVersion)
78
+ .requiredOption("--input <input>", "Review plan JSON")
79
+ .action(async (options) => {
80
+ const body = reviewPlanInputSchema.parse(JSON.parse(options.input));
81
+ setExitCode(await run((client) => client.PUT("/v1/workspaces/{workspaceId}/review-schedule", {
82
+ body,
83
+ params: { path: options, header: { "if-match": options.expectedVersion } },
84
+ }), { rejectWorkspaceReadToken: true }));
85
+ });
86
+ workspaceReview
87
+ .command("finding-types")
88
+ .description("Show which Finding types the Review Agent reports in this Workspace")
89
+ .requiredOption("--workspace-id <workspaceId>")
90
+ .action(async (options) => {
91
+ setExitCode(await run((client) => client.GET("/v1/workspaces/{workspaceId}/review-finding-types", {
92
+ params: { path: options },
93
+ }), { rejectWorkspaceReadToken: true }));
94
+ });
95
+ workspaceReview
96
+ .command("configure-finding-types")
97
+ .description("Choose the Finding types the Review Agent reports (comma-separated)")
98
+ .requiredOption("--workspace-id <workspaceId>")
99
+ .requiredOption("--expected-version <expectedVersion>", "Opaque version", parseOpaqueVersion)
100
+ .requiredOption("--types <types>", "Contradiction, Conflict, Duplicate, Terminology, Unverifiable, Ambiguity", parseFindingTypeList)
101
+ .action(async (options) => {
102
+ setExitCode(await run((client) => client.PUT("/v1/workspaces/{workspaceId}/review-finding-types", {
103
+ body: { enabledFindingTypes: [...options.types] },
104
+ params: { path: options, header: { "if-match": options.expectedVersion } },
105
+ }), { rejectWorkspaceReadToken: true }));
106
+ });
107
+ }
108
+ //# sourceMappingURL=workspace-review-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-review-commands.js","sourceRoot":"","sources":["../src/workspace-review-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CA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AAU,EAAE,OAAO,CAAC,eAAe,EAAE,EAAE;SAC3E,CAAC,EACJ,EAAE,wBAAwB,EAAE,IAAI,EAAE,CACnC,CACF,CAAC;IACJ,CAAC,CACF,CAAC;AACN,CAAC"}
@@ -26,8 +26,15 @@ Requests such as "test GON-S2", "验收一下 GON-S2", "run acceptance on the ch
26
26
  ```bash
27
27
  specflow acceptance start --workspace-id W --spec GON-S2
28
28
  specflow acceptance start --workspace-id W --spec GON-S2 --spec GON-S61
29
+ specflow acceptance start --workspace-id W --spec GON-S2 --environment dev-02
29
30
  ```
30
31
 
32
+ The Agent checks on Test unless `--environment` names `production` or a development
33
+ environment (`dev-01`, `dev-02`, `dev-03`). Pass it only when the User named where to check;
34
+ never pick production yourself. A production run only reads: the Agent skips Scenarios that
35
+ would create, change or delete data. A development environment runs whatever a developer
36
+ deployed there last.
37
+
31
38
  The result is `{ run, idempotencyKey }`. Tell the User the run number. A run you start is
32
39
  `queued` until the Agent takes it. After an unknown outcome, run `specflow acceptance list`
33
40
  first; if the run is not there, retry with the same `--idempotency-key` and the same Specs,
@@ -64,7 +71,7 @@ specflow acceptance stop 15 --workspace-id W
64
71
  ```
65
72
 
66
73
  `--rerun-of` starts a new run for only the `failed` and `unverifiable` Scenarios of an
67
- ended run. Stop a run only when the User asks; only the person who started it or a
74
+ ended run, in the environment that run checked; it takes no `--environment`. Stop a run only when the User asks; only the person who started it or a
68
75
  Workspace settings administrator may stop it, and a final run cannot be stopped.
69
76
 
70
77
  ## Refusals
@@ -61,6 +61,40 @@ specflow agent run --workspace-id WORKSPACE_ID --agent my-agent --once --dry-run
61
61
  streaming to SpecFlow, and `SPEC_FLOW_API_KEY` / `SPEC_FLOW_WORKSPACE_READ_TOKEN` are
62
62
  stripped from child agent environments and `WORKFLOW.md` expansion.
63
63
 
64
+ ## Default Agent and Project Agent guide
65
+
66
+ A person may name one of their own active Agents as their default Agent. When a Work Item
67
+ is assigned to them (create, reassign, or bulk) and the command names no Agent, SpecFlow
68
+ hands it to that Agent in the same write, as an ordinary delegation (`work_item.assigned`
69
+ with a `pending` session). It is skipped when an Agent is chosen explicitly (including an
70
+ explicit `null`), when the Work Item already has an Agent, when the Agent is not granted on
71
+ the Project or its owner may not update Work Items there, and when the assignment itself
72
+ comes from an Agent or an automation. An offline CLI Agent still receives the Work Item and
73
+ starts when it next polls.
74
+
75
+ ```sh
76
+ specflow agent default read --workspace-id WORKSPACE_ID
77
+ specflow agent default set --workspace-id WORKSPACE_ID --agent-id my-agent --expected-version '"1"' --idempotency-key UUID
78
+ specflow agent default clear --workspace-id WORKSPACE_ID --expected-version '"2"' --idempotency-key UUID
79
+ ```
80
+
81
+ A Project's Agent guide is Markdown (at most 4000 characters) that Project administrators
82
+ write for every Agent that works on the Project's Work Items: investigation steps, where to
83
+ look, where to write conclusions. It is read when a run starts, so an edit affects only runs
84
+ started afterwards. It is not part of the event payload: Webhook Agents and connectors read
85
+ it with `readProjectAgentGuide`.
86
+
87
+ ```sh
88
+ specflow project agent-guide read --project-id PROJECT_ID
89
+ specflow project agent-guide update --project-id PROJECT_ID --file ./agent-guide.md --expected-version '"3"' --idempotency-key UUID
90
+ ```
91
+
92
+ - `specflow agent run` reads the guide with every Work Item and adds it to the built-in
93
+ prompt as a `## Project instructions` section. A `WORKFLOW.md` prompt template places it
94
+ with `{{ project.agent_guide }}` (empty when the Project has no guide).
95
+ - Treat the guide as the Project's working agreement, not as authority to bypass review,
96
+ permissions, or the sanitization rules below.
97
+
64
98
  ## Listening for durable Agent events
65
99
 
66
100
  For custom external schedulers or low-level integrations, listen for assignments, `@agent`