@markjaquith/agency 2.27.0 → 2.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -24
- package/cli.ts +20 -0
- package/fixtures/protocol/orchestration-recipes.json +59 -0
- package/package.json +1 -1
- package/skills/agency/SKILL.md +112 -331
- package/skills/agency/references/commands.md +161 -0
- package/skills/agency/references/contracts.md +288 -0
- package/skills/agency/references/recipes.md +219 -0
- package/src/cli-parser.test.ts +8 -0
- package/src/cli-parser.ts +10 -0
- package/src/cli.test.ts +37 -4
- package/src/commands/doctor.test.ts +156 -0
- package/src/commands/doctor.ts +47 -0
- package/src/commands/init.test.ts +8 -4
- package/src/commands/init.ts +3 -0
- package/src/commands/read-only.test.ts +2 -0
- package/src/commands/work.test.ts +20 -0
- package/src/commands/work.ts +3 -0
- package/src/services/DoctorService.ts +419 -0
- package/src/services/IntegrationService.test.ts +80 -3
- package/src/services/IntegrationService.ts +2 -2
- package/src/test-utils.ts +2 -0
- package/src/workbase/AGENTS.md +53 -19
- package/src/workbase/opencode-file.ts +7 -8
package/README.md
CHANGED
|
@@ -73,9 +73,14 @@ workbase/
|
|
|
73
73
|
Agency keeps discovery and other observational commands read-only. Run
|
|
74
74
|
`agency integration status` to inspect `AGENTS.md` and
|
|
75
75
|
`.opencode/opencode.jsonc`, then `agency integration sync` to create missing
|
|
76
|
-
files or refresh checksum-safe managed files.
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
files or refresh checksum-safe managed files. Customized files are reported but
|
|
77
|
+
never overwritten.
|
|
78
|
+
|
|
79
|
+
The OpenCode config advertises only the task and epic directories as documented
|
|
80
|
+
references. OpenCode automatically grants those references scoped
|
|
81
|
+
external-directory access, so Agency does not add blanket permission rules that
|
|
82
|
+
could hide missing tool permissions. References provide context and never expand
|
|
83
|
+
the write authority reported by `agency context`.
|
|
79
84
|
|
|
80
85
|
Repository metadata comes directly from Git under `repos/{alias}`. Workbase
|
|
81
86
|
configuration may provide a custom writable-worktree creation command.
|
|
@@ -707,27 +712,34 @@ Every error contains a stable `code`, human-readable `message`, structured
|
|
|
707
712
|
`fields`, and `retryable`. `remediation` is included when Agency knows a specific
|
|
708
713
|
recovery action. Version 1 defines these codes:
|
|
709
714
|
|
|
710
|
-
| Code | Meaning
|
|
711
|
-
| ------------------------- |
|
|
712
|
-
| `CLI_USAGE` | Invalid command, option, argument, or option combination
|
|
713
|
-
| `WORKBASE_NOT_FOUND` | No workbase could be resolved
|
|
714
|
-
| `WORKBASE_CONFIG_INVALID` | Invalid workbase configuration
|
|
715
|
-
| `WORKBASE_REGISTRY_ERROR` | Invalid or inaccessible workbase registry
|
|
716
|
-
| `FILE_NOT_FOUND` | A required path does not exist
|
|
717
|
-
| `FILESYSTEM_ERROR` | A filesystem operation failed
|
|
718
|
-
| `FRONTMATTER_INVALID` | A durable document has invalid frontmatter
|
|
719
|
-
| `VALIDATION_FAILED` | Workbase validation reported issues
|
|
720
|
-
| `REPOSITORY_ERROR` | Repository operation failed
|
|
721
|
-
| `EPIC_ERROR` | Epic operation failed
|
|
722
|
-
| `TASK_ERROR` | Task operation failed
|
|
723
|
-
| `PHASE_ERROR` | Phase operation failed
|
|
724
|
-
| `
|
|
725
|
-
| `
|
|
726
|
-
| `
|
|
727
|
-
| `
|
|
728
|
-
| `
|
|
729
|
-
| `
|
|
730
|
-
| `
|
|
715
|
+
| Code | Meaning |
|
|
716
|
+
| ------------------------- | --------------------------------------------------------- |
|
|
717
|
+
| `CLI_USAGE` | Invalid command, option, argument, or option combination |
|
|
718
|
+
| `WORKBASE_NOT_FOUND` | No workbase could be resolved |
|
|
719
|
+
| `WORKBASE_CONFIG_INVALID` | Invalid workbase configuration |
|
|
720
|
+
| `WORKBASE_REGISTRY_ERROR` | Invalid or inaccessible workbase registry |
|
|
721
|
+
| `FILE_NOT_FOUND` | A required path does not exist |
|
|
722
|
+
| `FILESYSTEM_ERROR` | A filesystem operation failed |
|
|
723
|
+
| `FRONTMATTER_INVALID` | A durable document has invalid frontmatter |
|
|
724
|
+
| `VALIDATION_FAILED` | Workbase validation reported issues |
|
|
725
|
+
| `REPOSITORY_ERROR` | Repository operation failed |
|
|
726
|
+
| `EPIC_ERROR` | Epic operation failed |
|
|
727
|
+
| `TASK_ERROR` | Task operation failed |
|
|
728
|
+
| `PHASE_ERROR` | Phase operation failed |
|
|
729
|
+
| `CLAIM_ERROR` | Claim input or lifecycle state is invalid |
|
|
730
|
+
| `CLAIM_CONFLICT` | Active or legacy ownership conflicts with an operation |
|
|
731
|
+
| `REVISION_CONFLICT` | A durable document changed since inspection |
|
|
732
|
+
| `CLAIM_OWNERSHIP` | The session does not own the active claim |
|
|
733
|
+
| `ARCHIVE_ERROR` | Archive operation failed |
|
|
734
|
+
| `WORKTREE_ERROR` | Worktree operation failed |
|
|
735
|
+
| `PULL_REQUEST_ERROR` | Pull request operation failed |
|
|
736
|
+
| `CONTEXT_ERROR` | A context target or required document is invalid |
|
|
737
|
+
| `GRAPH_ERROR` | Workbase graph construction failed |
|
|
738
|
+
| `EXECUTION_BLOCKED` | Readiness or lifecycle blockers prevent execution |
|
|
739
|
+
| `SYNC_ERROR` | Reconciliation validation, inspection, or provider failed |
|
|
740
|
+
| `PROCESS_ERROR` | A child process failed and may be retried |
|
|
741
|
+
| `PROTOCOL_OUTPUT_ERROR` | A command violated the machine output contract |
|
|
742
|
+
| `COMMAND_FAILED` | An otherwise unclassified command failure |
|
|
731
743
|
|
|
732
744
|
The Effect schemas are exported from `@markjaquith/agency` and
|
|
733
745
|
`@markjaquith/agency/protocol`. The distributable JSON Schemas are exported as
|
|
@@ -736,6 +748,12 @@ The Effect schemas are exported from `@markjaquith/agency` and
|
|
|
736
748
|
payloads are exported as `@markjaquith/agency/fixtures/protocol/success.json` and
|
|
737
749
|
`@markjaquith/agency/fixtures/protocol/error.json`.
|
|
738
750
|
|
|
751
|
+
Success, help, and version output exit `0`; usage and command failures exit `1`.
|
|
752
|
+
There are no error-specific exit statuses. `graph --jsonl` streams versioned
|
|
753
|
+
records on success instead of wrapping them in an envelope; JSONL failures still
|
|
754
|
+
use one error envelope. See `skills/agency/references/contracts.md` for revision,
|
|
755
|
+
selector, projection, retry, and capability details.
|
|
756
|
+
|
|
739
757
|
## Agent Skill
|
|
740
758
|
|
|
741
759
|
`skills/agency/SKILL.md` contains an agent-oriented operating guide for Agency.
|
package/cli.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { pr, help as prHelp } from "./src/commands/pr"
|
|
|
9
9
|
import { work, workPrepare, help as workHelp } from "./src/commands/work"
|
|
10
10
|
import { worktree, help as worktreeHelp } from "./src/commands/worktree"
|
|
11
11
|
import { status, help as statusHelp } from "./src/commands/status"
|
|
12
|
+
import { doctor, help as doctorHelp } from "./src/commands/doctor"
|
|
12
13
|
import { validate, help as validateHelp } from "./src/commands/validate"
|
|
13
14
|
import { context, help as contextHelp } from "./src/commands/context"
|
|
14
15
|
import { graph, help as graphHelp } from "./src/commands/graph"
|
|
@@ -41,6 +42,7 @@ import { ClaimService } from "./src/services/ClaimService"
|
|
|
41
42
|
import { SyncService } from "./src/services/SyncService"
|
|
42
43
|
import { ReadinessService } from "./src/services/ReadinessService"
|
|
43
44
|
import { GraphMutationService } from "./src/services/GraphMutationService"
|
|
45
|
+
import { DoctorService } from "./src/services/DoctorService"
|
|
44
46
|
import {
|
|
45
47
|
claimCommand,
|
|
46
48
|
claimHelp,
|
|
@@ -72,6 +74,7 @@ const CliLayer = Layer.mergeAll(
|
|
|
72
74
|
SyncService.Default,
|
|
73
75
|
ReadinessService.Default,
|
|
74
76
|
GraphMutationService.Default,
|
|
77
|
+
DoctorService.Default,
|
|
75
78
|
)
|
|
76
79
|
|
|
77
80
|
/**
|
|
@@ -524,6 +527,22 @@ const commands: Record<string, Command> = {
|
|
|
524
527
|
)
|
|
525
528
|
},
|
|
526
529
|
},
|
|
530
|
+
doctor: {
|
|
531
|
+
run: async (_args: string[], options: Record<string, any>) => {
|
|
532
|
+
if (options.help) {
|
|
533
|
+
console.log(doctorHelp)
|
|
534
|
+
return
|
|
535
|
+
}
|
|
536
|
+
await runCommand(
|
|
537
|
+
doctor({
|
|
538
|
+
silent: options.silent,
|
|
539
|
+
verbose: options.verbose,
|
|
540
|
+
json: options.json,
|
|
541
|
+
cwd: options.cwd,
|
|
542
|
+
}),
|
|
543
|
+
)
|
|
544
|
+
},
|
|
545
|
+
},
|
|
527
546
|
validate: {
|
|
528
547
|
run: async (args: string[], options: Record<string, any>) => {
|
|
529
548
|
if (options.help) {
|
|
@@ -632,6 +651,7 @@ Commands:
|
|
|
632
651
|
pr create Create a pull request for an execution unit
|
|
633
652
|
repo <subcommand> Manage workbase repositories
|
|
634
653
|
status Show status for the current workbase
|
|
654
|
+
doctor Diagnose workbase health and integrations
|
|
635
655
|
validate [path] Validate a workbase
|
|
636
656
|
context [target] Return complete target context
|
|
637
657
|
graph Export the complete workbase graph
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[
|
|
2
|
+
["context", "--task", "checkout", "--phase", "ui", "--json"],
|
|
3
|
+
["worktree", "inspect", "checkout", "ui", "--json"],
|
|
4
|
+
["next", "--json"],
|
|
5
|
+
["graph", "--ready", "--json"],
|
|
6
|
+
[
|
|
7
|
+
"claim",
|
|
8
|
+
"checkout",
|
|
9
|
+
"ui",
|
|
10
|
+
"--claimant",
|
|
11
|
+
"orchestrator-1",
|
|
12
|
+
"--runner",
|
|
13
|
+
"opencode",
|
|
14
|
+
"--session-id",
|
|
15
|
+
"session-123",
|
|
16
|
+
"--revision",
|
|
17
|
+
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
18
|
+
"--json"
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
"work",
|
|
22
|
+
"prepare",
|
|
23
|
+
"--task",
|
|
24
|
+
"checkout",
|
|
25
|
+
"--phase",
|
|
26
|
+
"ui",
|
|
27
|
+
"--dry-run",
|
|
28
|
+
"--json"
|
|
29
|
+
],
|
|
30
|
+
["work", "prepare", "--task", "checkout", "--phase", "ui", "--json"],
|
|
31
|
+
["work", "tasks/checkout/phases/ui", "--runner", "opencode"],
|
|
32
|
+
["sync", "--dry-run", "--json"],
|
|
33
|
+
["sync", "--apply", "--json"],
|
|
34
|
+
["pr", "create", "checkout", "ui", "--json"],
|
|
35
|
+
[
|
|
36
|
+
"finish",
|
|
37
|
+
"checkout",
|
|
38
|
+
"ui",
|
|
39
|
+
"--session-id",
|
|
40
|
+
"session-123",
|
|
41
|
+
"--revision",
|
|
42
|
+
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
43
|
+
"--outcome",
|
|
44
|
+
"done",
|
|
45
|
+
"--json"
|
|
46
|
+
],
|
|
47
|
+
["doctor", "--json"],
|
|
48
|
+
["worktree", "repair", "checkout", "ui", "--dry-run", "--json"],
|
|
49
|
+
[
|
|
50
|
+
"release",
|
|
51
|
+
"checkout",
|
|
52
|
+
"ui",
|
|
53
|
+
"--session-id",
|
|
54
|
+
"session-123",
|
|
55
|
+
"--revision",
|
|
56
|
+
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
57
|
+
"--json"
|
|
58
|
+
]
|
|
59
|
+
]
|