@markjaquith/agency 3.2.2 → 3.2.3
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 +20 -58
- package/cli-main.ts +0 -72
- package/fixtures/protocol/orchestration-recipes.json +9 -34
- package/package.json +1 -4
- package/schemas/agency-graph-v1.schema.json +2 -31
- package/src/cli-parser.test.ts +13 -132
- package/src/cli-parser.ts +10 -101
- package/src/cli.test.ts +12 -111
- package/src/commands/act.ts +2 -6
- package/src/commands/sync.ts +3 -3
- package/src/commands/validate.ts +3 -1
- package/src/commands/work.test.ts +70 -8
- package/src/commands/work.ts +15 -8
- package/src/graph-schema.ts +0 -2
- package/src/protocol.test.ts +0 -25
- package/src/protocol.ts +0 -11
- package/src/readiness.test.ts +2 -2
- package/src/services/ArchiveBulkService.test.ts +0 -88
- package/src/services/ArchiveService.ts +0 -32
- package/src/services/GraphMutationService.ts +0 -26
- package/src/services/GraphService.test.ts +1 -1
- package/src/services/IntegrationService.test.ts +4 -4
- package/src/services/LifecycleTransaction.ts +5 -1
- package/src/services/PhaseService.ts +1 -8
- package/src/services/ReadinessService.test.ts +0 -34
- package/src/services/ReadinessService.ts +1 -20
- package/src/services/ReviewService.test.ts +0 -64
- package/src/services/ReviewService.ts +0 -5
- package/src/services/SyncService.test.ts +75 -88
- package/src/services/SyncService.ts +52 -123
- package/src/services/TaskPhaseService.test.ts +13 -1
- package/src/services/TaskService.ts +1 -7
- package/src/services/WorkbaseService.ts +0 -3
- package/src/services/WorktreeService.test.ts +192 -1
- package/src/services/WorktreeService.ts +169 -34
- package/src/test-utils.ts +0 -2
- package/src/workbase/AGENTS.md +9 -15
- package/src/workbase/agent-command.test.ts +0 -3
- package/src/workbase/agent-command.ts +0 -6
- package/src/workbase/document-revision.ts +0 -4
- package/src/workbase/schemas.test.ts +12 -25
- package/src/workbase/schemas.ts +0 -16
- package/src/commands/claim.ts +0 -122
- package/src/services/ClaimService.test.ts +0 -415
- package/src/services/ClaimService.ts +0 -608
package/README.md
CHANGED
|
@@ -336,19 +336,18 @@ Custom agents are direct argv commands, never shell snippets:
|
|
|
336
336
|
```
|
|
337
337
|
|
|
338
338
|
Available placeholders are `{prompt}`, `{workbase}`, `{target}`, `{task}`,
|
|
339
|
-
`{phase}`,
|
|
339
|
+
`{phase}`, and `{sessionId}`. Task and phase
|
|
340
340
|
placeholders are empty when they do not apply. `{prompt}` is empty unless
|
|
341
341
|
`--auto` is set. If `resumeCommand` is omitted, the fresh command is also used
|
|
342
342
|
for resumed sessions. If `autoResumeCommand` is omitted, `autoCommand` is used;
|
|
343
343
|
configured agents without `autoCommand` reject `--auto`.
|
|
344
344
|
|
|
345
|
-
Every agent receives the same `AGENCY_AGENT`, `
|
|
346
|
-
`
|
|
345
|
+
Every agent receives the same `AGENCY_AGENT`, `AGENCY_SESSION_ID`,
|
|
346
|
+
`AGENCY_WORKBASE`, `AGENCY_TARGET`,
|
|
347
347
|
`AGENCY_TASK_ID`, `AGENCY_PHASE_ID`, and `AGENCY_PROMPT` environment. Configured
|
|
348
348
|
environment is added without overriding these normalized values.
|
|
349
349
|
Execution-unit agents also receive `AGENCY_WRITABLE_CHECKOUT` with the
|
|
350
350
|
authoritative writable checkout path.
|
|
351
|
-
`AGENCY_CLAIM_REVISION` is empty for local `agency work` launches.
|
|
352
351
|
`AGENCY_PROMPT` is empty unless `--auto` is set.
|
|
353
352
|
Autonomous prompts begin `Agency worker launch target: <target>.`, carrying the
|
|
354
353
|
same canonical target as `AGENCY_TARGET`. This is the process-local fallback for
|
|
@@ -624,8 +623,8 @@ untargeted `agency pr` invocations leave command semantics to `gh`.
|
|
|
624
623
|
|
|
625
624
|
`agency sync` first compares portable repository declarations with local
|
|
626
625
|
materializations, then compares every execution declaration with local branch
|
|
627
|
-
and worktree registration, checkout dirtiness, resolved reference commits,
|
|
628
|
-
|
|
626
|
+
and worktree registration, checkout dirtiness, resolved reference commits, and
|
|
627
|
+
pull request state, merge state, and mergeability. It reports
|
|
629
628
|
structured `changes`, `warnings`, `unresolved`, and per-execution evidence. The
|
|
630
629
|
default mode applies safe reconciliation transitions; `--dry-run` is explicitly
|
|
631
630
|
observational.
|
|
@@ -639,13 +638,12 @@ phase. Scoped sync does not query, materialize, or reconcile unrelated work.
|
|
|
639
638
|
- materialize declared but missing repositories from their canonical remotes;
|
|
640
639
|
- adopt legacy materializations only when they have an unambiguous portable origin;
|
|
641
640
|
- materialize missing checkouts when no registration, branch, or path conflicts;
|
|
642
|
-
- release an active claim only after its declared expiry has passed;
|
|
643
641
|
- record or refresh a single PR whose head and base match the declaration; and
|
|
644
|
-
- mark work done after its authoritative PR is merged
|
|
642
|
+
- mark work done after its authoritative PR is merged.
|
|
645
643
|
|
|
646
644
|
Apply never overwrites linked or invalid repositories, repairs remote drift,
|
|
647
645
|
modifies dirty checkouts, moves worktrees, switches branches, resets reference
|
|
648
|
-
commits, chooses among conflicting remotes or PRs
|
|
646
|
+
commits, or chooses among conflicting remotes or PRs.
|
|
649
647
|
Those conditions remain visible in `warnings` or `unresolved` with a suggested
|
|
650
648
|
action.
|
|
651
649
|
|
|
@@ -836,8 +834,8 @@ fork pull requests exposed through that ref. Review workspaces contain one
|
|
|
836
834
|
detached checkout and no writable branch. Source movement is observed separately
|
|
837
835
|
from the pin and applied only by `review refresh`; sync, doctor, work, cleanup,
|
|
838
836
|
and archive never move the pin implicitly. Dirty or structurally unexpected
|
|
839
|
-
review checkouts block refresh and cleanup. Review tasks support normal status
|
|
840
|
-
|
|
837
|
+
review checkouts block refresh and cleanup. Review tasks support the normal status
|
|
838
|
+
lifecycle, but reject phase conversion and delivery PR operations.
|
|
841
839
|
Each active or archived review task owns one internal task-scoped pin ref. A
|
|
842
840
|
refresh advances that ref transactionally; failed creation removes it. Archiving
|
|
843
841
|
retains the pin so a deleted source can still be restored and inspected.
|
|
@@ -926,23 +924,20 @@ writing anything.
|
|
|
926
924
|
|
|
927
925
|
Single-phase tasks and phases store status in YAML. New execution units start
|
|
928
926
|
`open`, and `agency work` marks the selected execution unit `working` immediately
|
|
929
|
-
before launch. Running `agency work` again can relaunch
|
|
927
|
+
before launch. Running `agency work` again can relaunch `working` work.
|
|
930
928
|
By default, `done` requires an authoritative merged pull request and is applied
|
|
931
929
|
by `agency sync`. Work whose intended outcome genuinely requires no pull
|
|
932
930
|
request may instead use an explicit `--no-pull-request --summary <text>` status
|
|
933
931
|
transition. Agency records the summary, completion time, and optional evidence
|
|
934
932
|
URL durably; reopening removes that evidence. This exceptional path refuses work
|
|
935
933
|
that already has a recorded pull request.
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
or assigned a terminal outcome. Done and dropped work are terminal and may only
|
|
934
|
+
The interactive work selector displays status markers before execution units.
|
|
935
|
+
Existing working and delegated work may be returned to `open` or assigned a
|
|
936
|
+
terminal outcome. Done and dropped work are terminal and may only
|
|
940
937
|
remain unchanged or transition to open; reopen terminal work before changing its
|
|
941
938
|
outcome.
|
|
942
939
|
|
|
943
940
|
`delegated` remains readable for existing workbases but cannot be newly assigned.
|
|
944
|
-
Delegation is now explicit: the claimant identifies the orchestrator and the
|
|
945
|
-
agent identifies the assigned agent.
|
|
946
941
|
|
|
947
942
|
Human list output is a compact table with lifecycle, readiness, parent,
|
|
948
943
|
repository, branch, recorded PR, and worktree state where applicable. List and
|
|
@@ -951,37 +946,6 @@ filters, plus `--ready`, `--blocked`, `--pr`, and `--no-pr`. Status and reposito
|
|
|
951
946
|
filters are repeatable. Rows follow task and phase declaration order; plain text
|
|
952
947
|
labels remain complete without color or icon fonts.
|
|
953
948
|
|
|
954
|
-
### Claims
|
|
955
|
-
|
|
956
|
-
Claim mutations require the SHA-256 revision exposed by `agency context` or
|
|
957
|
-
`agency graph`. Every operation compares that revision while holding an exclusive
|
|
958
|
-
document lock and atomically replaces the execution document.
|
|
959
|
-
|
|
960
|
-
```text
|
|
961
|
-
agency claim <task-id> [phase-id] --claimant <id> --agent <id>
|
|
962
|
-
--session-id <id> --revision <sha256> [--expires-at <timestamp>] [--json]
|
|
963
|
-
agency release <task-id> [phase-id] --session-id <id>
|
|
964
|
-
--revision <sha256> [--json]
|
|
965
|
-
agency finish <task-id> [phase-id] --session-id <id>
|
|
966
|
-
--revision <sha256> --outcome <done|dropped>
|
|
967
|
-
[--no-pull-request --summary <text> [--evidence-url <url>]] [--json]
|
|
968
|
-
```
|
|
969
|
-
|
|
970
|
-
An active claim sets status to `working`. Release returns it to `open`. Finish
|
|
971
|
-
records the claim outcome and ownership history; a `done` claim outcome leaves
|
|
972
|
-
the execution unit `working` until its pull request is merged, while `dropped`
|
|
973
|
-
remains terminal. For a genuine non-PR outcome, `--no-pull-request` atomically
|
|
974
|
-
records completion evidence, finishes the claim, and sets the execution unit to
|
|
975
|
-
`done`; `--summary` is required and `--evidence-url` is optional. Conflicts return
|
|
976
|
-
the current revision and complete ownership record in the machine error envelope
|
|
977
|
-
rather than overwriting it. Expired claims may be replaced with a
|
|
978
|
-
revision-guarded claim.
|
|
979
|
-
|
|
980
|
-
`agency work` does not claim execution units. It refuses active explicit claims,
|
|
981
|
-
marks open execution work `working`, and launches the agent. External
|
|
982
|
-
orchestrators use `agency claim`, launch and monitor their agent separately, and
|
|
983
|
-
later call `agency release` or `agency finish`.
|
|
984
|
-
|
|
985
949
|
### Archive
|
|
986
950
|
|
|
987
951
|
```text
|
|
@@ -1012,8 +976,8 @@ default; `--dry-run` performs the same preflight without mutation. A dependency
|
|
|
1012
976
|
is work required by a candidate, while a dependent is work that requires the
|
|
1013
977
|
candidate. Dependencies within the selected cohort can be archived together,
|
|
1014
978
|
but a retained dependent excludes its dependency, including exclusions that
|
|
1015
|
-
propagate through a dependency chain.
|
|
1016
|
-
|
|
979
|
+
propagate through a dependency chain. Dirty or otherwise unsafe managed
|
|
980
|
+
checkouts and occupied archive destinations are reported as per-task
|
|
1017
981
|
skips. Invalid workbase structure and infrastructure failures abort the command.
|
|
1018
982
|
|
|
1019
983
|
Task and phase archiving update active parent documents. Agency removes
|
|
@@ -1047,7 +1011,8 @@ promptless by default; use `--auto` to send Agency's generated context prompt.
|
|
|
1047
1011
|
|
|
1048
1012
|
`agency work prepare` resolves an execution unit and creates or reuses its
|
|
1049
1013
|
writable and reference worktrees, or its single pinned review checkout, without
|
|
1050
|
-
launching an agent or changing status.
|
|
1014
|
+
launching an agent or changing status. Its target may be a task ID or any path
|
|
1015
|
+
inside the task or phase, including its `TASK.md` or `PHASE.md` document.
|
|
1051
1016
|
Managed workbase guidance provides exact fast paths for 15 common intents:
|
|
1052
1017
|
single-phase creation; create-and-start; materialization; remote PR sync; phase
|
|
1053
1018
|
conversion; archive; review creation and start; status inspection; drop;
|
|
@@ -1065,8 +1030,8 @@ either. Use `--dry-run` to report planned fetch, branch, and worktree changes
|
|
|
1065
1030
|
without applying them. Use `--force` to prepare work blocked by readiness, such
|
|
1066
1031
|
as a follow-on phase whose dependency is still active; preparation still does
|
|
1067
1032
|
not launch an agent or change lifecycle status. Validation reuse never skips
|
|
1068
|
-
readiness,
|
|
1069
|
-
|
|
1033
|
+
readiness, repository, ownership, reference-drift, dirty-workspace, or worktree
|
|
1034
|
+
safety checks.
|
|
1070
1035
|
|
|
1071
1036
|
The authoritative implementation locations for this contract are
|
|
1072
1037
|
`src/commands/task.ts` (creation output),
|
|
@@ -1193,10 +1158,7 @@ recovery action. Version 1 defines these codes:
|
|
|
1193
1158
|
| `EPIC_ERROR` | Epic operation failed |
|
|
1194
1159
|
| `TASK_ERROR` | Task operation failed |
|
|
1195
1160
|
| `PHASE_ERROR` | Phase operation failed |
|
|
1196
|
-
| `CLAIM_ERROR` | Claim input or lifecycle state is invalid |
|
|
1197
|
-
| `CLAIM_CONFLICT` | Active or legacy ownership conflicts with an operation |
|
|
1198
1161
|
| `REVISION_CONFLICT` | A durable document changed since inspection |
|
|
1199
|
-
| `CLAIM_OWNERSHIP` | The session does not own the active claim |
|
|
1200
1162
|
| `ARCHIVE_ERROR` | Archive operation failed |
|
|
1201
1163
|
| `WORKTREE_ERROR` | Worktree operation failed |
|
|
1202
1164
|
| `PULL_REQUEST_ERROR` | Pull request operation failed |
|
|
@@ -1219,7 +1181,7 @@ Success, help, and version output exit `0`; usage and command failures exit `1`.
|
|
|
1219
1181
|
There are no error-specific exit statuses. `graph --jsonl` streams versioned
|
|
1220
1182
|
records on success instead of wrapping them in an envelope; JSONL failures still
|
|
1221
1183
|
use one error envelope. Revision and concurrency behavior is documented under
|
|
1222
|
-
Tasks
|
|
1184
|
+
Tasks and Phases; selector behavior under Noninteractive Use; projection
|
|
1223
1185
|
behavior under Target Context and Workbase Graph; and retry behavior in the
|
|
1224
1186
|
machine error contract above.
|
|
1225
1187
|
|
package/cli-main.ts
CHANGED
|
@@ -40,7 +40,6 @@ import { ArchiveService } from "./src/services/ArchiveService"
|
|
|
40
40
|
import { IntegrationService } from "./src/services/IntegrationService"
|
|
41
41
|
import { ContextService } from "./src/services/ContextService"
|
|
42
42
|
import { GraphService } from "./src/services/GraphService"
|
|
43
|
-
import { ClaimService } from "./src/services/ClaimService"
|
|
44
43
|
import { SyncService } from "./src/services/SyncService"
|
|
45
44
|
import { ReadinessService } from "./src/services/ReadinessService"
|
|
46
45
|
import { GraphMutationService } from "./src/services/GraphMutationService"
|
|
@@ -52,12 +51,6 @@ import {
|
|
|
52
51
|
} from "./src/services/VersionControlService"
|
|
53
52
|
import { review, help as reviewHelp } from "./src/commands/review"
|
|
54
53
|
import { act, help as actHelp } from "./src/commands/act"
|
|
55
|
-
import {
|
|
56
|
-
claimCommand,
|
|
57
|
-
claimHelp,
|
|
58
|
-
releaseHelp,
|
|
59
|
-
finishHelp,
|
|
60
|
-
} from "./src/commands/claim"
|
|
61
54
|
import {
|
|
62
55
|
collectCommandResult,
|
|
63
56
|
errorEnvelope,
|
|
@@ -83,7 +76,6 @@ const CliLayer = Layer.mergeAll(
|
|
|
83
76
|
IntegrationService.Default,
|
|
84
77
|
ContextService.Default,
|
|
85
78
|
GraphService.Default,
|
|
86
|
-
ClaimService.Default,
|
|
87
79
|
SyncService.Default,
|
|
88
80
|
ReadinessService.Default,
|
|
89
81
|
GraphMutationService.Default,
|
|
@@ -199,67 +191,6 @@ const commands: Record<string, Command> = {
|
|
|
199
191
|
)
|
|
200
192
|
},
|
|
201
193
|
},
|
|
202
|
-
claim: {
|
|
203
|
-
run: async (args: string[], options: Record<string, any>) => {
|
|
204
|
-
if (options.help) return console.log(claimHelp)
|
|
205
|
-
await runCommand(
|
|
206
|
-
claimCommand({
|
|
207
|
-
operation: "claim",
|
|
208
|
-
taskId: args[0],
|
|
209
|
-
phaseId: args[1],
|
|
210
|
-
claimant: options.claimant,
|
|
211
|
-
agent: options.agent,
|
|
212
|
-
sessionId: options["session-id"],
|
|
213
|
-
revision: options.revision,
|
|
214
|
-
expiresAt: options["expires-at"],
|
|
215
|
-
json: options.json,
|
|
216
|
-
silent: options.silent,
|
|
217
|
-
verbose: options.verbose,
|
|
218
|
-
cwd: options.cwd,
|
|
219
|
-
}),
|
|
220
|
-
)
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
release: {
|
|
224
|
-
run: async (args: string[], options: Record<string, any>) => {
|
|
225
|
-
if (options.help) return console.log(releaseHelp)
|
|
226
|
-
await runCommand(
|
|
227
|
-
claimCommand({
|
|
228
|
-
operation: "release",
|
|
229
|
-
taskId: args[0],
|
|
230
|
-
phaseId: args[1],
|
|
231
|
-
sessionId: options["session-id"],
|
|
232
|
-
revision: options.revision,
|
|
233
|
-
json: options.json,
|
|
234
|
-
silent: options.silent,
|
|
235
|
-
verbose: options.verbose,
|
|
236
|
-
cwd: options.cwd,
|
|
237
|
-
}),
|
|
238
|
-
)
|
|
239
|
-
},
|
|
240
|
-
},
|
|
241
|
-
finish: {
|
|
242
|
-
run: async (args: string[], options: Record<string, any>) => {
|
|
243
|
-
if (options.help) return console.log(finishHelp)
|
|
244
|
-
await runCommand(
|
|
245
|
-
claimCommand({
|
|
246
|
-
operation: "finish",
|
|
247
|
-
taskId: args[0],
|
|
248
|
-
phaseId: args[1],
|
|
249
|
-
sessionId: options["session-id"],
|
|
250
|
-
revision: options.revision,
|
|
251
|
-
outcome: options.outcome,
|
|
252
|
-
noPullRequest: options["no-pull-request"],
|
|
253
|
-
summary: options.summary,
|
|
254
|
-
evidenceUrl: options["evidence-url"],
|
|
255
|
-
json: options.json,
|
|
256
|
-
silent: options.silent,
|
|
257
|
-
verbose: options.verbose,
|
|
258
|
-
cwd: options.cwd,
|
|
259
|
-
}),
|
|
260
|
-
)
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
194
|
init: {
|
|
264
195
|
run: async (args: string[], options: Record<string, any>) => {
|
|
265
196
|
if (options.help) {
|
|
@@ -779,9 +710,6 @@ Commands:
|
|
|
779
710
|
usage export Export local usage events as JSON Lines
|
|
780
711
|
epic <subcommand> Manage epics
|
|
781
712
|
phase <subcommand> Manage task phases
|
|
782
|
-
claim <task> [phase] Claim an execution unit
|
|
783
|
-
release <task> [phase] Release an execution unit
|
|
784
|
-
finish <task> [phase] Finish an execution unit
|
|
785
713
|
archive <type> Archive a work item
|
|
786
714
|
task <subcommand> Manage tasks
|
|
787
715
|
work [directory|task] Work on an epic, task, or phase
|
|
@@ -22,20 +22,6 @@
|
|
|
22
22
|
"agency",
|
|
23
23
|
"--json"
|
|
24
24
|
],
|
|
25
|
-
[
|
|
26
|
-
"claim",
|
|
27
|
-
"checkout",
|
|
28
|
-
"ui",
|
|
29
|
-
"--claimant",
|
|
30
|
-
"orchestrator-1",
|
|
31
|
-
"--agent",
|
|
32
|
-
"opencode",
|
|
33
|
-
"--session-id",
|
|
34
|
-
"session-123",
|
|
35
|
-
"--revision",
|
|
36
|
-
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
37
|
-
"--json"
|
|
38
|
-
],
|
|
39
25
|
[
|
|
40
26
|
"work",
|
|
41
27
|
"prepare",
|
|
@@ -50,29 +36,18 @@
|
|
|
50
36
|
["work", "tasks/checkout/phases/ui", "--agent", "opencode"],
|
|
51
37
|
["sync", "--dry-run", "--json"],
|
|
52
38
|
["sync", "--json"],
|
|
53
|
-
["pr", "create", "checkout", "ui", "--json"],
|
|
54
39
|
[
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"--session-id",
|
|
59
|
-
"session-123",
|
|
60
|
-
"--revision",
|
|
61
|
-
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
62
|
-
"--outcome",
|
|
40
|
+
"task",
|
|
41
|
+
"status",
|
|
42
|
+
"implement-checkout",
|
|
63
43
|
"done",
|
|
44
|
+
"--no-pull-request",
|
|
45
|
+
"--summary",
|
|
46
|
+
"Completed without a pull request",
|
|
64
47
|
"--json"
|
|
65
48
|
],
|
|
49
|
+
["pr", "create", "checkout", "ui", "--json"],
|
|
50
|
+
["sync", "checkout", "ui", "--json"],
|
|
66
51
|
["doctor", "--json"],
|
|
67
|
-
["worktree", "repair", "checkout", "ui", "--dry-run", "--json"]
|
|
68
|
-
[
|
|
69
|
-
"release",
|
|
70
|
-
"checkout",
|
|
71
|
-
"ui",
|
|
72
|
-
"--session-id",
|
|
73
|
-
"session-123",
|
|
74
|
-
"--revision",
|
|
75
|
-
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
76
|
-
"--json"
|
|
77
|
-
]
|
|
52
|
+
["worktree", "repair", "checkout", "ui", "--dry-run", "--json"]
|
|
78
53
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markjaquith/agency",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"description": "Manage agentic work across repositories with durable workbases",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
"preuninstall": "bun scripts/install-pi-extension.ts uninstall",
|
|
68
68
|
"benchmark:act": "bun scripts/benchmark-act.ts",
|
|
69
69
|
"benchmark:pr": "bun scripts/benchmark-pr.ts",
|
|
70
|
-
"benchmark:release": "bun scripts/benchmark-release.ts",
|
|
71
70
|
"benchmark:repositories": "bun scripts/benchmark-repositories.ts",
|
|
72
71
|
"benchmark:status": "bun scripts/benchmark-status.ts",
|
|
73
72
|
"benchmark:next": "bun scripts/benchmark-next.ts",
|
|
@@ -76,8 +75,6 @@
|
|
|
76
75
|
"benchmark:workbase": "bun scripts/benchmark-workbase.ts",
|
|
77
76
|
"benchmark:doctor": "bun scripts/benchmark-doctor.ts",
|
|
78
77
|
"benchmark:context": "bun scripts/benchmark-context.ts",
|
|
79
|
-
"benchmark:claim": "bun scripts/benchmark-claim.ts",
|
|
80
|
-
"benchmark:finish": "bun scripts/benchmark-finish.ts",
|
|
81
78
|
"benchmark:epic": "bun scripts/benchmark-epic.ts",
|
|
82
79
|
"benchmark:phase": "bun scripts/benchmark-phase.ts",
|
|
83
80
|
"benchmark:graph": "bun scripts/benchmark-graph.ts",
|
|
@@ -344,7 +344,6 @@
|
|
|
344
344
|
"base": { "type": "string" },
|
|
345
345
|
"pr": { "type": ["string", "null"] },
|
|
346
346
|
"status": { "$ref": "#/$defs/status" },
|
|
347
|
-
"claim": { "$ref": "#/$defs/claim" },
|
|
348
347
|
"sha256": { "type": "string" }
|
|
349
348
|
}
|
|
350
349
|
},
|
|
@@ -424,7 +423,6 @@
|
|
|
424
423
|
"handoff": { "$ref": "#/$defs/taskHandoff" },
|
|
425
424
|
"review": { "$ref": "#/$defs/reviewRecord" },
|
|
426
425
|
"status": { "$ref": "#/$defs/status" },
|
|
427
|
-
"claim": { "$ref": "#/$defs/claim" },
|
|
428
426
|
"sha256": { "type": "string" }
|
|
429
427
|
}
|
|
430
428
|
},
|
|
@@ -443,7 +441,6 @@
|
|
|
443
441
|
"base": { "type": "string" },
|
|
444
442
|
"pr": { "type": ["string", "null"] },
|
|
445
443
|
"status": { "$ref": "#/$defs/status" },
|
|
446
|
-
"claim": { "$ref": "#/$defs/claim" },
|
|
447
444
|
"sha256": { "type": "string" }
|
|
448
445
|
}
|
|
449
446
|
},
|
|
@@ -469,8 +466,7 @@
|
|
|
469
466
|
"branch": { "type": "string" },
|
|
470
467
|
"base": { "type": "string" },
|
|
471
468
|
"pr": { "type": ["string", "null"] },
|
|
472
|
-
"status": { "$ref": "#/$defs/status" }
|
|
473
|
-
"claim": { "$ref": "#/$defs/claim" }
|
|
469
|
+
"status": { "$ref": "#/$defs/status" }
|
|
474
470
|
}
|
|
475
471
|
},
|
|
476
472
|
{
|
|
@@ -485,8 +481,7 @@
|
|
|
485
481
|
"purpose": { "$ref": "#/$defs/taskPurpose" },
|
|
486
482
|
"handoff": { "$ref": "#/$defs/taskHandoff" },
|
|
487
483
|
"review": { "$ref": "#/$defs/reviewRecord" },
|
|
488
|
-
"status": { "$ref": "#/$defs/status" }
|
|
489
|
-
"claim": { "$ref": "#/$defs/claim" }
|
|
484
|
+
"status": { "$ref": "#/$defs/status" }
|
|
490
485
|
}
|
|
491
486
|
}
|
|
492
487
|
]
|
|
@@ -534,30 +529,6 @@
|
|
|
534
529
|
"sourceRevision": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
|
|
535
530
|
}
|
|
536
531
|
},
|
|
537
|
-
"claim": {
|
|
538
|
-
"type": "object",
|
|
539
|
-
"additionalProperties": false,
|
|
540
|
-
"required": [
|
|
541
|
-
"claimant",
|
|
542
|
-
"agent",
|
|
543
|
-
"sessionId",
|
|
544
|
-
"startedAt",
|
|
545
|
-
"targetRevision",
|
|
546
|
-
"state"
|
|
547
|
-
],
|
|
548
|
-
"properties": {
|
|
549
|
-
"claimant": { "type": "string", "minLength": 1 },
|
|
550
|
-
"agent": { "type": "string", "minLength": 1 },
|
|
551
|
-
"sessionId": { "type": "string", "minLength": 1 },
|
|
552
|
-
"startedAt": { "type": "string", "format": "date-time" },
|
|
553
|
-
"targetRevision": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
|
554
|
-
"expiresAt": { "type": "string", "format": "date-time" },
|
|
555
|
-
"state": { "enum": ["active", "released", "finished"] },
|
|
556
|
-
"releasedAt": { "type": "string", "format": "date-time" },
|
|
557
|
-
"finishedAt": { "type": "string", "format": "date-time" },
|
|
558
|
-
"outcome": { "enum": ["done", "dropped"] }
|
|
559
|
-
}
|
|
560
|
-
},
|
|
561
532
|
"repositoryData": {
|
|
562
533
|
"type": "object",
|
|
563
534
|
"additionalProperties": false,
|
package/src/cli-parser.test.ts
CHANGED
|
@@ -338,51 +338,6 @@ describe("strict CLI parsing", () => {
|
|
|
338
338
|
[["graph", "extra"], "agency graph"],
|
|
339
339
|
[["next", "extra"], "agency next"],
|
|
340
340
|
[["sync", "one", "two", "three"], "agency sync"],
|
|
341
|
-
[
|
|
342
|
-
[
|
|
343
|
-
"claim",
|
|
344
|
-
"one",
|
|
345
|
-
"two",
|
|
346
|
-
"three",
|
|
347
|
-
"--claimant",
|
|
348
|
-
"a",
|
|
349
|
-
"--agent",
|
|
350
|
-
"r",
|
|
351
|
-
"--session-id",
|
|
352
|
-
"s",
|
|
353
|
-
"--revision",
|
|
354
|
-
"0".repeat(64),
|
|
355
|
-
],
|
|
356
|
-
"agency claim",
|
|
357
|
-
],
|
|
358
|
-
[
|
|
359
|
-
[
|
|
360
|
-
"release",
|
|
361
|
-
"one",
|
|
362
|
-
"two",
|
|
363
|
-
"three",
|
|
364
|
-
"--session-id",
|
|
365
|
-
"s",
|
|
366
|
-
"--revision",
|
|
367
|
-
"0".repeat(64),
|
|
368
|
-
],
|
|
369
|
-
"agency release",
|
|
370
|
-
],
|
|
371
|
-
[
|
|
372
|
-
[
|
|
373
|
-
"finish",
|
|
374
|
-
"one",
|
|
375
|
-
"two",
|
|
376
|
-
"three",
|
|
377
|
-
"--session-id",
|
|
378
|
-
"s",
|
|
379
|
-
"--revision",
|
|
380
|
-
"0".repeat(64),
|
|
381
|
-
"--outcome",
|
|
382
|
-
"done",
|
|
383
|
-
],
|
|
384
|
-
"agency finish",
|
|
385
|
-
],
|
|
386
341
|
] as const) {
|
|
387
342
|
expectUsageError([...args], usage)
|
|
388
343
|
}
|
|
@@ -500,76 +455,10 @@ describe("strict CLI parsing", () => {
|
|
|
500
455
|
)
|
|
501
456
|
})
|
|
502
457
|
|
|
503
|
-
test("
|
|
504
|
-
const
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
"claim",
|
|
508
|
-
"task",
|
|
509
|
-
"phase",
|
|
510
|
-
"--claimant",
|
|
511
|
-
"orchestrator",
|
|
512
|
-
"--agent",
|
|
513
|
-
"agent",
|
|
514
|
-
"--session-id",
|
|
515
|
-
"job-1",
|
|
516
|
-
"--revision",
|
|
517
|
-
revision,
|
|
518
|
-
"--expires-at",
|
|
519
|
-
"2026-07-17T13:00:00.000Z",
|
|
520
|
-
]),
|
|
521
|
-
).toMatchObject({ commandName: "claim", args: ["task", "phase"] })
|
|
522
|
-
expect(() =>
|
|
523
|
-
parseCli(["release", "task", "--session-id", "job-1"]),
|
|
524
|
-
).toThrow("--revision' is required")
|
|
525
|
-
expect(() =>
|
|
526
|
-
parseCli([
|
|
527
|
-
"finish",
|
|
528
|
-
"task",
|
|
529
|
-
"--session-id",
|
|
530
|
-
"job-1",
|
|
531
|
-
"--revision",
|
|
532
|
-
revision,
|
|
533
|
-
"--outcome",
|
|
534
|
-
"working",
|
|
535
|
-
]),
|
|
536
|
-
).toThrow("must be 'done' or 'dropped'")
|
|
537
|
-
expect(
|
|
538
|
-
parseCli([
|
|
539
|
-
"finish",
|
|
540
|
-
"task",
|
|
541
|
-
"--session-id",
|
|
542
|
-
"job-1",
|
|
543
|
-
"--revision",
|
|
544
|
-
revision,
|
|
545
|
-
"--outcome",
|
|
546
|
-
"done",
|
|
547
|
-
"--no-pull-request",
|
|
548
|
-
"--summary",
|
|
549
|
-
"Investigation completed",
|
|
550
|
-
"--evidence-url",
|
|
551
|
-
"https://example.com/result",
|
|
552
|
-
]),
|
|
553
|
-
).toMatchObject({
|
|
554
|
-
values: {
|
|
555
|
-
"no-pull-request": true,
|
|
556
|
-
summary: "Investigation completed",
|
|
557
|
-
"evidence-url": "https://example.com/result",
|
|
558
|
-
},
|
|
559
|
-
})
|
|
560
|
-
expect(() =>
|
|
561
|
-
parseCli([
|
|
562
|
-
"finish",
|
|
563
|
-
"task",
|
|
564
|
-
"--session-id",
|
|
565
|
-
"job-1",
|
|
566
|
-
"--revision",
|
|
567
|
-
revision,
|
|
568
|
-
"--outcome",
|
|
569
|
-
"done",
|
|
570
|
-
"--no-pull-request",
|
|
571
|
-
]),
|
|
572
|
-
).toThrow("--summary' is required")
|
|
458
|
+
test("rejects removed claim protocol commands", () => {
|
|
459
|
+
for (const command of ["claim", "release", "finish"]) {
|
|
460
|
+
expect(() => parseCli([command])).toThrow(`Unknown command '${command}'`)
|
|
461
|
+
}
|
|
573
462
|
expect(() =>
|
|
574
463
|
parseCli([
|
|
575
464
|
"task",
|
|
@@ -649,6 +538,15 @@ describe("strict CLI parsing", () => {
|
|
|
649
538
|
expect(() => parseCli(["work", "prepare", "--opencode"])).toThrow(
|
|
650
539
|
"cannot be combined",
|
|
651
540
|
)
|
|
541
|
+
expect(() => parseCli(["work", "prepare", "first", "second"])).toThrow(
|
|
542
|
+
"Expected 0-2 positional arguments",
|
|
543
|
+
)
|
|
544
|
+
expect(() =>
|
|
545
|
+
parseCli(["work", "prepare", "example", "--task", "other"]),
|
|
546
|
+
).toThrow("Entity selector options cannot be combined")
|
|
547
|
+
expect(() => parseCli(["work", "prepare", "--phase", "build"])).toThrow(
|
|
548
|
+
"requires '--task'",
|
|
549
|
+
)
|
|
652
550
|
})
|
|
653
551
|
|
|
654
552
|
test("parses worktree lifecycle commands and selectors", () => {
|
|
@@ -977,23 +875,6 @@ describe("strict CLI parsing", () => {
|
|
|
977
875
|
commandName: "phase",
|
|
978
876
|
args: ["status", "ship", "release", "done"],
|
|
979
877
|
})
|
|
980
|
-
expect(
|
|
981
|
-
parseCli([
|
|
982
|
-
"claim",
|
|
983
|
-
"--task",
|
|
984
|
-
"ship",
|
|
985
|
-
"--phase",
|
|
986
|
-
"release",
|
|
987
|
-
"--claimant",
|
|
988
|
-
"agent",
|
|
989
|
-
"--agent",
|
|
990
|
-
"opencode",
|
|
991
|
-
"--session-id",
|
|
992
|
-
"session",
|
|
993
|
-
"--revision",
|
|
994
|
-
"0".repeat(64),
|
|
995
|
-
]),
|
|
996
|
-
).toMatchObject({ args: ["ship", "release"] })
|
|
997
878
|
expect(parseCli(["context", "--epic", "delivery"]).values.epic).toBe(
|
|
998
879
|
"delivery",
|
|
999
880
|
)
|