@markjaquith/agency 3.2.13 → 3.2.15

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 (69) hide show
  1. package/package.json +7 -2
  2. package/src/workbase/schemas.ts +12 -0
  3. package/fixtures/protocol/orchestration-recipes.json +0 -53
  4. package/pi-extensions/agency.test.ts +0 -117
  5. package/src/check-commits.test.ts +0 -58
  6. package/src/cli-parser.test.ts +0 -945
  7. package/src/cli.test.ts +0 -1889
  8. package/src/commands/act.test.ts +0 -418
  9. package/src/commands/archive.test.ts +0 -236
  10. package/src/commands/context.test.ts +0 -665
  11. package/src/commands/description.test.ts +0 -103
  12. package/src/commands/doctor.test.ts +0 -185
  13. package/src/commands/epic.test.ts +0 -196
  14. package/src/commands/init.test.ts +0 -117
  15. package/src/commands/integration.test.ts +0 -165
  16. package/src/commands/pr.test.ts +0 -248
  17. package/src/commands/push.test.ts +0 -56
  18. package/src/commands/read-only.test.ts +0 -161
  19. package/src/commands/repo.test.ts +0 -199
  20. package/src/commands/restore.test.ts +0 -106
  21. package/src/commands/status.test.ts +0 -113
  22. package/src/commands/sync.test.ts +0 -200
  23. package/src/commands/task-phase.test.ts +0 -410
  24. package/src/commands/task.test.ts +0 -281
  25. package/src/commands/validate.test.ts +0 -186
  26. package/src/commands/work.test.ts +0 -1375
  27. package/src/commands/workbase.test.ts +0 -170
  28. package/src/graph-schema.test.ts +0 -124
  29. package/src/protocol.test.ts +0 -163
  30. package/src/readiness.test.ts +0 -105
  31. package/src/services/ArchiveBulkService.test.ts +0 -384
  32. package/src/services/ArchiveService.test.ts +0 -1092
  33. package/src/services/EpicService.test.ts +0 -74
  34. package/src/services/FileSystemService.test.ts +0 -81
  35. package/src/services/GraphMutationService.test.ts +0 -486
  36. package/src/services/GraphService.test.ts +0 -494
  37. package/src/services/IntegrationService.test.ts +0 -1091
  38. package/src/services/LifecycleTransaction.test.ts +0 -145
  39. package/src/services/PullRequestService.test.ts +0 -716
  40. package/src/services/PushService.test.ts +0 -408
  41. package/src/services/ReadinessService.test.ts +0 -290
  42. package/src/services/RepositoryService.test.ts +0 -789
  43. package/src/services/ReviewService.test.ts +0 -408
  44. package/src/services/SyncService.test.ts +0 -1377
  45. package/src/services/TaskPhaseService.test.ts +0 -852
  46. package/src/services/VersionControlService.test.ts +0 -62
  47. package/src/services/WorkbaseService.test.ts +0 -910
  48. package/src/services/WorktreeLock.test.ts +0 -205
  49. package/src/services/WorktreePerformance.test.ts +0 -71
  50. package/src/services/WorktreeService.test.ts +0 -2292
  51. package/src/test-utils.ts +0 -110
  52. package/src/usage-log.test.ts +0 -188
  53. package/src/utils/chooser.test.ts +0 -192
  54. package/src/utils/effect.test.ts +0 -30
  55. package/src/utils/interactive.pty.test.ts +0 -128
  56. package/src/utils/interactive.test.tsx +0 -860
  57. package/src/utils/process.test.ts +0 -132
  58. package/src/utils/progress.test.ts +0 -37
  59. package/src/work-view.test.ts +0 -151
  60. package/src/workbase/agent-command.test.ts +0 -128
  61. package/src/workbase/checkout-command.test.ts +0 -62
  62. package/src/workbase/delivery-command.test.ts +0 -180
  63. package/src/workbase/dependency-graph.test.ts +0 -50
  64. package/src/workbase/execution-contract.test.ts +0 -161
  65. package/src/workbase/frontmatter.test.ts +0 -67
  66. package/src/workbase/repository-reference.test.ts +0 -25
  67. package/src/workbase/schemas.test.ts +0 -543
  68. package/src/workbase/work-target.test.ts +0 -108
  69. package/src/workbase/worktree-command.test.ts +0 -61
@@ -1,186 +0,0 @@
1
- import { afterEach, beforeEach, describe, expect, test } from "bun:test"
2
- import { Effect } from "effect"
3
- import { mkdir } from "node:fs/promises"
4
- import { join } from "node:path"
5
- import {
6
- captureLogs,
7
- cleanupTempDir,
8
- createTempDir,
9
- runTestEffect,
10
- } from "../test-utils"
11
- import { FileSystemService } from "../services/FileSystemService"
12
- import { WorkbaseService } from "../services/WorkbaseService"
13
- import type { PickWorkbase } from "../workbase/workbase-choice"
14
- import { validate } from "./validate"
15
-
16
- describe("validate command", () => {
17
- let root: string
18
-
19
- beforeEach(async () => {
20
- root = await createTempDir()
21
- await Bun.write(join(root, "agency.json"), '{"version":2}\n')
22
- await mkdir(join(root, "repos/agency"), { recursive: true })
23
- await mkdir(join(root, "tasks/example"), { recursive: true })
24
- })
25
-
26
- afterEach(async () => {
27
- await cleanupTempDir(root)
28
- })
29
-
30
- test("succeeds for a valid workbase", async () => {
31
- await Bun.write(
32
- join(root, "tasks/example/TASK.md"),
33
- `---
34
- ticketUrl: https://example.com/tasks/example
35
- repo: agency
36
- branch: task/example
37
- base: main
38
- pr: null
39
- ---
40
-
41
- # Example
42
- `,
43
- )
44
-
45
- await expect(
46
- runTestEffect(validate({ cwd: root, silent: true })),
47
- ).resolves.toBeUndefined()
48
- })
49
-
50
- test("validates an explicit workbase path", async () => {
51
- await Bun.write(
52
- join(root, "tasks/example/TASK.md"),
53
- `---
54
- ticketUrl: null
55
- repo: agency
56
- branch: task/example
57
- base: main
58
- pr: null
59
- ---
60
- `,
61
- )
62
-
63
- await expect(
64
- runTestEffect(
65
- validate({ path: root, cwd: join(root, "outside"), silent: true }),
66
- ),
67
- ).resolves.toBeUndefined()
68
- })
69
-
70
- test("selects a registered workbase when local discovery fails", async () => {
71
- const discovered: string[] = []
72
- const workbase = {
73
- discover: (path: string) => {
74
- discovered.push(path)
75
- return path === "/outside"
76
- ? Effect.fail({
77
- _tag: "WorkbaseNotFoundError" as const,
78
- message: "No Agency workbase found from /outside",
79
- })
80
- : Effect.succeed(path)
81
- },
82
- listRegistered: () => Effect.succeed(["/first", "/selected"]),
83
- getDefault: () => Effect.succeed(undefined),
84
- validate: (path: string) =>
85
- Effect.succeed({
86
- root: path,
87
- issues: [],
88
- epicCount: 0,
89
- taskCount: 0,
90
- phaseCount: 0,
91
- valid: true,
92
- }),
93
- }
94
- const fs = {
95
- runCommand: () => Effect.succeed({ exitCode: 0, stdout: "", stderr: "" }),
96
- }
97
- const pick: PickWorkbase = (workbases) => {
98
- expect(workbases).toEqual(["/first", "/selected"])
99
- return Effect.succeed("/selected")
100
- }
101
-
102
- await Effect.runPromise(
103
- validate({ cwd: "/outside", silent: true }, pick).pipe(
104
- Effect.provideService(WorkbaseService, workbase as never),
105
- Effect.provideService(FileSystemService, fs as never),
106
- ) as Effect.Effect<void, unknown, never>,
107
- )
108
-
109
- expect(discovered).toEqual(["/outside", "/selected"])
110
- })
111
-
112
- test("does not select a registered workbase when input is disabled", async () => {
113
- const workbase = {
114
- discover: () =>
115
- Effect.fail({
116
- _tag: "WorkbaseNotFoundError" as const,
117
- message: "No Agency workbase found from /outside",
118
- }),
119
- listRegistered: () => Effect.succeed(["/selected"]),
120
- getDefault: () => Effect.succeed(undefined),
121
- }
122
- const fs = {
123
- runCommand: () => Effect.fail(new Error("unexpected fzf probe")),
124
- }
125
- const pick: PickWorkbase = () =>
126
- Effect.fail(new Error("unexpected workbase selection"))
127
-
128
- await expect(
129
- Effect.runPromise(
130
- validate(
131
- { cwd: "/outside", silent: true, inputAllowed: false },
132
- pick,
133
- ).pipe(
134
- Effect.provideService(WorkbaseService, workbase as never),
135
- Effect.provideService(FileSystemService, fs as never),
136
- ) as Effect.Effect<void, unknown, never>,
137
- ),
138
- ).rejects.toThrow("provide an explicit path or run Agency from a workbase")
139
- })
140
-
141
- test("outputs the validation report as JSON", async () => {
142
- await Bun.write(
143
- join(root, "tasks/example/TASK.md"),
144
- `---
145
- ticketUrl: https://example.com/tasks/example
146
- repo: agency
147
- branch: task/example
148
- base: main
149
- pr: null
150
- ---
151
- `,
152
- )
153
- const logs = await captureLogs(() =>
154
- runTestEffect(validate({ cwd: root, json: true })),
155
- )
156
-
157
- expect(JSON.parse(logs[0]!)).toEqual({
158
- root,
159
- issues: [],
160
- epicCount: 0,
161
- taskCount: 1,
162
- phaseCount: 0,
163
- valid: true,
164
- })
165
- })
166
-
167
- test("fails with document diagnostics", async () => {
168
- await Bun.write(
169
- join(root, "tasks/example/TASK.md"),
170
- `---
171
- ticketUrl: https://example.com/tasks/example
172
- repo: missing
173
- branch: task/example
174
- base: main
175
- pr: null
176
- ---
177
-
178
- # Example
179
- `,
180
- )
181
-
182
- await expect(
183
- runTestEffect(validate({ cwd: root, silent: true })),
184
- ).rejects.toThrow("Unknown repository alias 'missing'")
185
- })
186
- })