@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,543 +0,0 @@
1
- import { describe, expect, test } from "bun:test"
2
- import { Schema } from "@effect/schema"
3
- import {
4
- EntityId,
5
- EpicFrontmatter,
6
- PhaseFrontmatter,
7
- TaskFrontmatter,
8
- WorkStatus,
9
- WorkbaseConfig,
10
- WorkbaseRegistry,
11
- RepositoryRemote,
12
- } from "./schemas"
13
-
14
- describe("portable repository declarations", () => {
15
- test("accepts provider-neutral network Git remotes", () => {
16
- for (const remote of [
17
- "https://example.com/team/repository.git",
18
- "ssh://git@example.com/team/repository.git",
19
- "git://example.com/team/repository.git",
20
- "git@example.com:team/repository.git",
21
- "ssh://[2001:db8::1]/team/repository.git",
22
- ]) {
23
- expect(Schema.decodeUnknownSync(RepositoryRemote)(remote)).toBe(remote)
24
- }
25
- })
26
-
27
- test("rejects local paths, unsupported protocols, and credential-bearing URLs", () => {
28
- for (const remote of [
29
- "/Users/person/repository.git",
30
- "../repository.git",
31
- "file:///tmp/repository.git",
32
- "https://token@example.com/team/repository.git",
33
- "https://user:password@example.com/team/repository.git",
34
- "ssh://user:password@example.com/team/repository.git",
35
- "ftp://example.com/team/repository.git",
36
- "custom://example.com/team/repository.git",
37
- "C:/repository.git",
38
- "https://example.com/repository.git?token=secret",
39
- "ext::printf",
40
- "foo::bar",
41
- "-host:repository.git",
42
- "-oProxyCommand=x@host:repository.git",
43
- ]) {
44
- expect(() => Schema.decodeUnknownSync(RepositoryRemote)(remote)).toThrow()
45
- }
46
- })
47
-
48
- test("decodes repository declarations in version 2 configs", () => {
49
- expect(
50
- Schema.decodeUnknownSync(WorkbaseConfig)({
51
- version: 2,
52
- repositories: {
53
- agency: { remote: "https://example.com/agency.git" },
54
- },
55
- }),
56
- ).toEqual({
57
- version: 2,
58
- repositories: {
59
- agency: { remote: "https://example.com/agency.git" },
60
- },
61
- })
62
- })
63
- })
64
-
65
- describe("body-of-work descriptions", () => {
66
- test("decodes strict task purpose and handoff provenance", () => {
67
- const handoff = {
68
- source: { kind: "phase", taskId: "investigate", phaseId: "evidence" },
69
- sourceRevision: "a".repeat(64),
70
- }
71
- const task = Schema.decodeUnknownSync(TaskFrontmatter, {
72
- onExcessProperty: "error",
73
- })({
74
- ticketUrl: null,
75
- purpose: "implementation",
76
- handoff,
77
- repo: "agency",
78
- branch: "task/implement",
79
- base: "main",
80
- pr: null,
81
- })
82
- expect(task).toMatchObject({ purpose: "implementation", handoff })
83
-
84
- for (const invalid of [
85
- { ...handoff, sourceRevision: "short" },
86
- { ...handoff, source: { kind: "phase", taskId: "investigate" } },
87
- { ...handoff, source: { kind: "task", taskId: "../unsafe" } },
88
- ]) {
89
- expect(() =>
90
- Schema.decodeUnknownSync(TaskFrontmatter, {
91
- onExcessProperty: "error",
92
- })({
93
- ticketUrl: null,
94
- purpose: "implementation",
95
- handoff: invalid,
96
- phases: [],
97
- }),
98
- ).toThrow()
99
- }
100
- })
101
-
102
- test("decodes review tasks strictly and rejects writable execution fields", () => {
103
- const review = {
104
- ticketUrl: null,
105
- review: {
106
- repo: "agency",
107
- source: { kind: "branch", ref: "refs/heads/feature/review" },
108
- commit: "a".repeat(40),
109
- refreshedAt: "2026-07-23T12:00:00.000Z",
110
- },
111
- }
112
- expect(
113
- Schema.decodeUnknownSync(TaskFrontmatter, { onExcessProperty: "error" })(
114
- review,
115
- ),
116
- ).toMatchObject({ status: "open", review: review.review })
117
- for (const field of ["repo", "repos", "branch", "base", "pr"]) {
118
- expect(() =>
119
- Schema.decodeUnknownSync(TaskFrontmatter, {
120
- onExcessProperty: "error",
121
- })({ ...review, [field]: field === "repos" ? [] : "forbidden" }),
122
- ).toThrow()
123
- }
124
- })
125
-
126
- test("rejects inconsistent pull request source provenance", () => {
127
- const source = {
128
- kind: "pull-request",
129
- provider: "github",
130
- repository: "owner/repo",
131
- identifier: "42",
132
- url: "https://github.com/owner/repo/pull/42",
133
- fetchRef: "refs/pull/42/head",
134
- }
135
- const review = {
136
- ticketUrl: null,
137
- review: {
138
- repo: "agency",
139
- source,
140
- commit: "a".repeat(40),
141
- refreshedAt: "2026-07-23T12:00:00.000Z",
142
- },
143
- }
144
- expect(Schema.decodeUnknownSync(TaskFrontmatter)(review)).toBeDefined()
145
- for (const inconsistent of [
146
- { ...source, url: "https://github.com/owner/repo/pull/41" },
147
- { ...source, repository: "other/repo" },
148
- { ...source, fetchRef: "refs/pull/41/head" },
149
- ]) {
150
- expect(() =>
151
- Schema.decodeUnknownSync(TaskFrontmatter)({
152
- ...review,
153
- review: { ...review.review, source: inconsistent },
154
- }),
155
- ).toThrow()
156
- }
157
- })
158
-
159
- test("accepts descriptions on epics, tasks, and phases", () => {
160
- const epic = Schema.decodeUnknownSync(EpicFrontmatter)({
161
- ticketUrl: "https://example.com/epic",
162
- description: "Coordinate the rollout.",
163
- repos: [{ repo: "agency", ref: "main" }],
164
- tasks: [],
165
- })
166
- const singlePhaseTask = Schema.decodeUnknownSync(TaskFrontmatter)({
167
- ticketUrl: "https://example.com/task",
168
- description: "Deliver the rollout.",
169
- repo: "agency",
170
- branch: "task/rollout",
171
- base: "main",
172
- pr: null,
173
- })
174
- const multiPhaseTask = Schema.decodeUnknownSync(TaskFrontmatter)({
175
- ticketUrl: "https://example.com/task",
176
- description: "Deliver the rollout in phases.",
177
- phases: [],
178
- })
179
- const phase = Schema.decodeUnknownSync(PhaseFrontmatter)({
180
- description: "Introduce the service contract.",
181
- repo: "agency",
182
- branch: "task/contract",
183
- base: "main",
184
- pr: null,
185
- })
186
-
187
- expect(epic.description).toBe("Coordinate the rollout.")
188
- expect(singlePhaseTask.description).toBe("Deliver the rollout.")
189
- expect(multiPhaseTask.description).toBe("Deliver the rollout in phases.")
190
- expect(phase.description).toBe("Introduce the service contract.")
191
- })
192
-
193
- test("allows omitted descriptions for existing documents", () => {
194
- const epic = Schema.decodeUnknownSync(EpicFrontmatter)({
195
- ticketUrl: "https://example.com/epic",
196
- repos: [{ repo: "agency", ref: "main" }],
197
- tasks: [],
198
- })
199
-
200
- expect(epic.description).toBeUndefined()
201
- })
202
-
203
- test("allows tasks without an external ticket", () => {
204
- const task = Schema.decodeUnknownSync(TaskFrontmatter)({
205
- ticketUrl: null,
206
- phases: [],
207
- })
208
-
209
- expect(task.ticketUrl).toBeNull()
210
- })
211
-
212
- test("rejects an empty description when present", () => {
213
- expect(() =>
214
- Schema.decodeUnknownSync(PhaseFrontmatter)({
215
- description: "",
216
- repo: "agency",
217
- branch: "task/contract",
218
- base: "main",
219
- pr: null,
220
- }),
221
- ).toThrow()
222
- })
223
- })
224
-
225
- describe("repository post-checkout configuration", () => {
226
- test("accepts a per-repository argv command", () => {
227
- const config = Schema.decodeUnknownSync(WorkbaseConfig)({
228
- version: 2,
229
- repositories: {
230
- agency: {
231
- remote: "https://example.com/agency.git",
232
- postCheckoutCommand: ["bun", "install", "--frozen-lockfile"],
233
- },
234
- },
235
- })
236
-
237
- expect(config.repositories?.agency?.postCheckoutCommand).toEqual([
238
- "bun",
239
- "install",
240
- "--frozen-lockfile",
241
- ])
242
- })
243
-
244
- test("rejects shell strings in place of argv arrays", () => {
245
- expect(() =>
246
- Schema.decodeUnknownSync(WorkbaseConfig)({
247
- version: 2,
248
- repositories: {
249
- agency: {
250
- remote: "https://example.com/agency.git",
251
- postCheckoutCommand: "bun install",
252
- },
253
- },
254
- }),
255
- ).toThrow()
256
- })
257
- })
258
-
259
- describe("agent configuration", () => {
260
- test("accepts named argv commands with resume commands and environment", () => {
261
- const config = Schema.decodeUnknownSync(WorkbaseConfig)({
262
- version: 2,
263
- agents: {
264
- custom: {
265
- command: ["agent"],
266
- autoCommand: ["agent", "{prompt}"],
267
- resumeCommand: ["agent", "resume", "{sessionId}"],
268
- autoResumeCommand: ["agent", "resume", "{sessionId}", "{prompt}"],
269
- environment: { CUSTOM_TARGET: "{target}" },
270
- },
271
- },
272
- })
273
-
274
- expect(config.agents?.custom?.autoCommand).toEqual(["agent", "{prompt}"])
275
- })
276
-
277
- test("rejects shell strings in place of argv arrays", () => {
278
- expect(() =>
279
- Schema.decodeUnknownSync(WorkbaseConfig)({
280
- version: 2,
281
- agents: { custom: { command: "agent {prompt}" } },
282
- }),
283
- ).toThrow()
284
- })
285
- })
286
-
287
- describe("delivery configuration", () => {
288
- test("accepts an argv-based create and query provider", () => {
289
- const config = Schema.decodeUnknownSync(WorkbaseConfig)({
290
- version: 2,
291
- delivery: {
292
- provider: "forge",
293
- remote: "upstream",
294
- createCommand: ["forge", "create", "{branch}"],
295
- queryCommand: ["forge", "query", "{identifier}"],
296
- },
297
- })
298
- expect(config.delivery?.remote).toBe("upstream")
299
- })
300
-
301
- test("accepts normalized non-GitHub pull request records", () => {
302
- const phase = Schema.decodeUnknownSync(PhaseFrontmatter)({
303
- repo: "agency",
304
- branch: "feat/example",
305
- base: "main",
306
- pr: {
307
- provider: "forge",
308
- repository: "example/agency",
309
- identifier: "17",
310
- url: "https://forge.example/example/agency/pulls/17",
311
- state: "open",
312
- draft: false,
313
- merged: false,
314
- mergeable: false,
315
- },
316
- })
317
- expect(phase.pr && typeof phase.pr !== "string" && phase.pr.provider).toBe(
318
- "forge",
319
- )
320
- expect(phase.pr && typeof phase.pr !== "string" && phase.pr.mergeable).toBe(
321
- false,
322
- )
323
- })
324
- })
325
-
326
- describe("work status", () => {
327
- const supportedStatuses: Record<WorkStatus, true> = {
328
- open: true,
329
- working: true,
330
- delegated: true,
331
- done: true,
332
- dropped: true,
333
- }
334
-
335
- test("defaults execution units to open", () => {
336
- const task = Schema.decodeUnknownSync(TaskFrontmatter)({
337
- ticketUrl: "https://example.com/task",
338
- repo: "agency",
339
- branch: "task/default-status",
340
- base: "main",
341
- pr: null,
342
- })
343
- const phase = Schema.decodeUnknownSync(PhaseFrontmatter)({
344
- repo: "agency",
345
- branch: "task/default-phase-status",
346
- base: "main",
347
- pr: null,
348
- })
349
-
350
- expect("status" in task && task.status).toBe("open")
351
- expect(phase.status).toBe("open")
352
- })
353
-
354
- test("accepts every supported status on tasks and phases", () => {
355
- for (const status of Object.keys(supportedStatuses) as WorkStatus[]) {
356
- expect(Schema.decodeUnknownSync(WorkStatus)(status)).toBe(status)
357
-
358
- const task = Schema.decodeUnknownSync(TaskFrontmatter)({
359
- ticketUrl: null,
360
- repo: "agency",
361
- branch: `task/${status}`,
362
- base: "main",
363
- pr: null,
364
- status,
365
- })
366
- const phase = Schema.decodeUnknownSync(PhaseFrontmatter)({
367
- repo: "agency",
368
- branch: `phase/${status}`,
369
- base: "main",
370
- pr: null,
371
- status,
372
- })
373
-
374
- expect("status" in task && task.status).toBe(status)
375
- expect(phase.status).toBe(status)
376
- }
377
- })
378
-
379
- test("rejects unsupported statuses on tasks and phases", () => {
380
- expect(() => Schema.decodeUnknownSync(WorkStatus)("blocked")).toThrow()
381
- expect(() =>
382
- Schema.decodeUnknownSync(TaskFrontmatter)({
383
- ticketUrl: null,
384
- repo: "agency",
385
- branch: "task/invalid",
386
- base: "main",
387
- pr: null,
388
- status: "blocked",
389
- }),
390
- ).toThrow()
391
- expect(() =>
392
- Schema.decodeUnknownSync(PhaseFrontmatter)({
393
- repo: "agency",
394
- branch: "phase/invalid",
395
- base: "main",
396
- pr: null,
397
- status: "blocked",
398
- }),
399
- ).toThrow()
400
- })
401
- })
402
-
403
- test("rejects removed claim frontmatter", () => {
404
- expect(() =>
405
- Schema.decodeUnknownSync(TaskFrontmatter, { onExcessProperty: "error" })({
406
- ticketUrl: null,
407
- repo: "agency",
408
- branch: "task/example",
409
- base: "main",
410
- pr: null,
411
- status: "working",
412
- claim: { state: "active" },
413
- }),
414
- ).toThrow()
415
- })
416
-
417
- describe("workbase registry", () => {
418
- test("accepts registered paths", () => {
419
- expect(
420
- Schema.decodeUnknownSync(WorkbaseRegistry)({
421
- version: 2,
422
- workbases: [
423
- { id: "wb-one", name: "one", path: "/work/one" },
424
- { id: "wb-two", path: "/work/two" },
425
- ],
426
- defaultId: "wb-one",
427
- }),
428
- ).toEqual({
429
- version: 2,
430
- workbases: [
431
- { id: "wb-one", name: "one", path: "/work/one" },
432
- { id: "wb-two", path: "/work/two" },
433
- ],
434
- defaultId: "wb-one",
435
- })
436
- })
437
-
438
- test("rejects invalid versions and empty paths", () => {
439
- expect(() =>
440
- Schema.decodeUnknownSync(WorkbaseRegistry)({
441
- version: 3,
442
- workbases: [],
443
- }),
444
- ).toThrow()
445
- expect(() =>
446
- Schema.decodeUnknownSync(WorkbaseRegistry)({
447
- version: 2,
448
- workbases: [{ id: "wb-one", path: "" }],
449
- }),
450
- ).toThrow()
451
- })
452
- })
453
-
454
- describe("schema boundaries", () => {
455
- const rejects = <S extends Schema.Schema.AnyNoContext>(
456
- schema: S,
457
- input: unknown,
458
- ) => {
459
- expect(() =>
460
- Schema.decodeUnknownSync(schema, { onExcessProperty: "error" })(input),
461
- ).toThrow()
462
- }
463
-
464
- test("rejects invalid boundary values", () => {
465
- const cases = [
466
- {
467
- name: "unsupported config version",
468
- schema: WorkbaseConfig,
469
- input: { version: 1 },
470
- },
471
- {
472
- name: "excess config fields",
473
- schema: WorkbaseConfig,
474
- input: { version: 2, legacy: true },
475
- },
476
- {
477
- name: "invalid entity ID",
478
- schema: EntityId,
479
- input: "invalid/id",
480
- },
481
- {
482
- name: "empty epic repositories",
483
- schema: EpicFrontmatter,
484
- input: {
485
- ticketUrl: "https://example.com/epic",
486
- repos: [],
487
- tasks: [],
488
- },
489
- },
490
- {
491
- name: "mixed task union",
492
- schema: TaskFrontmatter,
493
- input: {
494
- ticketUrl: "https://example.com/task",
495
- phases: [],
496
- repo: "agency",
497
- branch: "task/mixed",
498
- base: "main",
499
- pr: null,
500
- },
501
- },
502
- {
503
- name: "single-phase task missing pr",
504
- schema: TaskFrontmatter,
505
- input: {
506
- ticketUrl: "https://example.com/task",
507
- repo: "agency",
508
- branch: "task/missing-pr",
509
- base: "main",
510
- },
511
- },
512
- {
513
- name: "invalid phase PR URL",
514
- schema: PhaseFrontmatter,
515
- input: {
516
- repo: "agency",
517
- branch: "task/invalid-pr",
518
- base: "main",
519
- pr: "https://example.com/pull/1",
520
- },
521
- },
522
- ] as const
523
-
524
- for (const fixture of cases) {
525
- expect(
526
- () => rejects(fixture.schema, fixture.input),
527
- fixture.name,
528
- ).not.toThrow()
529
- }
530
- })
531
-
532
- test("accepts a configured chooser argv", () => {
533
- expect(
534
- Schema.decodeUnknownSync(WorkbaseConfig)({
535
- version: 2,
536
- chooserCommand: ["fzf", "--accept-nth=1"],
537
- }),
538
- ).toEqual({
539
- version: 2,
540
- chooserCommand: ["fzf", "--accept-nth=1"],
541
- })
542
- })
543
- })
@@ -1,108 +0,0 @@
1
- import { describe, expect, test } from "bun:test"
2
- import { buildWorkTargetChoices } from "./work-target"
3
-
4
- describe("work target choices", () => {
5
- test("builds an ordered hierarchy with standalone tasks", () => {
6
- const choices = buildWorkTargetChoices(
7
- [
8
- {
9
- id: "delivery",
10
- path: "/workbase/epics/delivery/EPIC.md",
11
- data: {
12
- description: "Ship the release",
13
- tasks: [{ id: "multi" }, { id: "single" }],
14
- },
15
- },
16
- ],
17
- [
18
- {
19
- id: "multi",
20
- path: "/workbase/tasks/multi/TASK.md",
21
- data: {
22
- phases: [{ id: "build" }, { id: "verify" }],
23
- },
24
- },
25
- {
26
- id: "single",
27
- path: "/workbase/tasks/single/TASK.md",
28
- data: { status: "done" },
29
- },
30
- {
31
- id: "standalone",
32
- path: "/workbase/tasks/standalone/TASK.md",
33
- data: { description: "Independent work" },
34
- },
35
- {
36
- id: "delegated",
37
- path: "/workbase/tasks/delegated/TASK.md",
38
- data: { status: "delegated" },
39
- },
40
- ],
41
- [
42
- {
43
- taskId: "multi",
44
- id: "verify",
45
- path: "/workbase/tasks/multi/phases/verify/PHASE.md",
46
- data: { status: "done" },
47
- },
48
- {
49
- taskId: "multi",
50
- id: "build",
51
- path: "/workbase/tasks/multi/phases/build/PHASE.md",
52
- data: { status: "working" },
53
- },
54
- {
55
- taskId: "multi",
56
- id: "unlisted",
57
- path: "/workbase/tasks/multi/phases/unlisted/PHASE.md",
58
- data: { status: "dropped" },
59
- },
60
- ],
61
- )
62
-
63
- expect(choices.map((choice) => choice.label)).toEqual([
64
- "\x1b[38;2;198;160;246m\x1b[0m delivery\x1b[2m - Ship the release\x1b[0m",
65
- "\x1b[38;2;125;196;228m󰗡\x1b[0m multi",
66
- "\x1b[38;2;138;173;244m󰔟\x1b[0m \x1b[38;2;238;212;159m󰔚\x1b[0m build",
67
- "\x1b[38;2;166;218;149m󰄬\x1b[0m \x1b[38;2;238;212;159m󰔚\x1b[0m verify",
68
- "\x1b[38;2;237;135;150m󰅖\x1b[0m \x1b[38;2;238;212;159m󰔚\x1b[0m unlisted",
69
- "\x1b[38;2;166;218;149m󰄬\x1b[0m \x1b[38;2;125;196;228m󰗡\x1b[0m single",
70
- "\x1b[38;2;128;135;162m󰄱\x1b[0m \x1b[38;2;125;196;228m󰗡\x1b[0m standalone\x1b[2m - Independent work\x1b[0m",
71
- "\x1b[38;2;198;160;246m󰁕\x1b[0m \x1b[38;2;125;196;228m󰗡\x1b[0m delegated",
72
- ])
73
- expect(choices.map((choice) => choice.target.kind)).toEqual([
74
- "epic",
75
- "task",
76
- "phase",
77
- "phase",
78
- "phase",
79
- "task",
80
- "task",
81
- "task",
82
- ])
83
- expect(choices.map((choice) => choice.plainLabel)).toEqual([
84
- "epic delivery - Ship the release",
85
- "task multi",
86
- "[working] phase build",
87
- "[done] phase verify",
88
- "[dropped] phase unlisted",
89
- "[done] task single",
90
- "[open] task standalone - Independent work",
91
- "[delegated] task delegated",
92
- ])
93
- expect(choices.map((choice) => choice.depth)).toEqual([
94
- 0, 1, 2, 2, 2, 1, 0, 0,
95
- ])
96
- expect(choices[0]!.segments).toEqual([
97
- { text: "", color: "#c6a0f6" },
98
- { text: " delivery" },
99
- { text: " - Ship the release", color: "#6e738d" },
100
- ])
101
- expect(choices[2]!.segments).toEqual([
102
- { text: "󰔟", color: "#8aadf4" },
103
- { text: " " },
104
- { text: "󰔚", color: "#eed49f" },
105
- { text: " build" },
106
- ])
107
- })
108
- })
@@ -1,61 +0,0 @@
1
- import { describe, expect, test } from "bun:test"
2
- import {
3
- expandWorktreeCreateCommand,
4
- worktreeCommandEnvironment,
5
- } from "./worktree-command"
6
-
7
- const variables = {
8
- repo: "/work/repos/app",
9
- worktree: "/work/tasks/example/code/app",
10
- branch: "task/example",
11
- base: "main",
12
- }
13
-
14
- describe("worktree command templates", () => {
15
- test("expands argv placeholders without shell interpolation", () => {
16
- expect(
17
- expandWorktreeCreateCommand(
18
- [
19
- "tool",
20
- "--repo={repo}",
21
- "--worktree",
22
- "{worktree}",
23
- "{branch}",
24
- "{base}",
25
- ],
26
- variables,
27
- ),
28
- ).toEqual([
29
- "tool",
30
- "--repo=/work/repos/app",
31
- "--worktree",
32
- "/work/tasks/example/code/app",
33
- "task/example",
34
- "main",
35
- ])
36
- })
37
-
38
- test("requires repo and worktree placeholders", () => {
39
- expect(() =>
40
- expandWorktreeCreateCommand(["tool", "{repo}"], variables),
41
- ).toThrow("{worktree}")
42
- })
43
-
44
- test("rejects unknown placeholders", () => {
45
- expect(() =>
46
- expandWorktreeCreateCommand(
47
- ["tool", "{repo}", "{worktree}", "{unknown}"],
48
- variables,
49
- ),
50
- ).toThrow("{unknown}")
51
- })
52
-
53
- test("provides equivalent environment variables", () => {
54
- expect(worktreeCommandEnvironment(variables)).toEqual({
55
- AGENCY_REPO: variables.repo,
56
- AGENCY_WORKTREE: variables.worktree,
57
- AGENCY_BRANCH: variables.branch,
58
- AGENCY_BASE: variables.base,
59
- })
60
- })
61
- })