@markjaquith/agency 2.71.26 → 2.71.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markjaquith/agency",
3
- "version": "2.71.26",
3
+ "version": "2.71.27",
4
4
  "description": "Manage agentic work across repositories with durable workbases",
5
5
  "keywords": [
6
6
  "agents",
package/src/cli.test.ts CHANGED
@@ -507,6 +507,49 @@ describe("CLI", () => {
507
507
  })
508
508
  })
509
509
 
510
+ test("preserves the JSON error contract when archiving an already archived task", async () => {
511
+ const root = await createTempDir()
512
+ tempDirs.push(root)
513
+ await Bun.write(join(root, "agency.json"), '{"version":2}\n')
514
+ expect(
515
+ Bun.spawnSync(["git", "init", "--bare", join(root, "repos/agency")])
516
+ .exitCode,
517
+ ).toBe(0)
518
+ await mkdir(join(root, "tasks/example"), { recursive: true })
519
+ await Bun.write(
520
+ join(root, "tasks/example/TASK.md"),
521
+ `---
522
+ ticketUrl: null
523
+ repo: agency
524
+ branch: task/example
525
+ base: main
526
+ pr: null
527
+ status: dropped
528
+ ---
529
+
530
+ # Example
531
+ `,
532
+ )
533
+
534
+ expect((await runCli(["archive", "task", "example"], root)).exitCode).toBe(
535
+ 0,
536
+ )
537
+ const result = await runCli(["archive", "task", "example", "--json"], root)
538
+
539
+ expect(result.exitCode).toBe(1)
540
+ expect(result.stderr).toBe("")
541
+ expect(JSON.parse(result.stdout)).toEqual({
542
+ version: 1,
543
+ ok: false,
544
+ error: {
545
+ code: "TASK_ERROR",
546
+ message: "Task 'example' is already archived",
547
+ fields: {},
548
+ retryable: false,
549
+ },
550
+ })
551
+ })
552
+
510
553
  test("rejects malformed input before running a command", async () => {
511
554
  const parent = await createTempDir()
512
555
  tempDirs.push(parent)
@@ -93,6 +93,23 @@ describe("archive command", () => {
93
93
  )
94
94
  })
95
95
 
96
+ test("reports an already archived task", async () => {
97
+ await runTestEffect(
98
+ archive({ type: "task", args: ["example"], cwd: root, silent: true }),
99
+ )
100
+
101
+ await expect(
102
+ runTestEffect(
103
+ archive({
104
+ type: "task",
105
+ args: ["example"],
106
+ cwd: root,
107
+ silent: true,
108
+ }),
109
+ ),
110
+ ).rejects.toThrow("Task 'example' is already archived")
111
+ })
112
+
96
113
  test("outputs one deterministic bulk archive object and a concise human summary", async () => {
97
114
  const jsonLogs = await captureLogs(() =>
98
115
  runTestEffect(
@@ -589,7 +589,9 @@ export class TaskService extends Effect.Service<TaskService>()("TaskService", {
589
589
  const path = join(root, "tasks", validId, "TASK.md")
590
590
  if (!(yield* fs.exists(path))) {
591
591
  return yield* new TaskError({
592
- message: `Task '${validId}' does not exist`,
592
+ message: (yield* fs.exists(archivedTaskDirectory(root, validId)))
593
+ ? `Task '${validId}' is already archived`
594
+ : `Task '${validId}' does not exist`,
593
595
  })
594
596
  }
595
597
  const content = yield* fs.readFile(path)