@markjaquith/agency 2.30.1 → 2.32.0

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 (38) hide show
  1. package/README.md +56 -38
  2. package/cli.ts +2 -1
  3. package/package.json +5 -2
  4. package/skills/agency/SKILL.md +7 -6
  5. package/skills/agency/references/commands.md +17 -14
  6. package/skills/agency/references/contracts.md +4 -5
  7. package/skills/agency/references/recipes.md +13 -10
  8. package/src/cli-parser.test.ts +12 -2
  9. package/src/cli-parser.ts +5 -2
  10. package/src/cli.test.ts +34 -10
  11. package/src/commands/doctor.test.ts +11 -1
  12. package/src/commands/phase.ts +1 -1
  13. package/src/commands/task.test.ts +34 -1
  14. package/src/commands/task.ts +16 -20
  15. package/src/commands/work.test.ts +65 -65
  16. package/src/commands/work.ts +43 -35
  17. package/src/opentui.d.ts +1 -0
  18. package/src/services/DoctorService.ts +22 -0
  19. package/src/services/EpicService.test.ts +3 -0
  20. package/src/services/EpicService.ts +2 -1
  21. package/src/services/IntegrationService.test.ts +2 -1
  22. package/src/services/PhaseService.ts +5 -4
  23. package/src/services/PullRequestService.test.ts +4 -1
  24. package/src/services/ReadinessService.test.ts +54 -0
  25. package/src/services/ReadinessService.ts +39 -2
  26. package/src/services/TaskPhaseService.test.ts +38 -11
  27. package/src/services/TaskService.ts +4 -3
  28. package/src/utils/chooser.test.ts +49 -12
  29. package/src/utils/chooser.ts +20 -37
  30. package/src/utils/interactive-loader.ts +6 -0
  31. package/src/utils/interactive.test.tsx +258 -0
  32. package/src/utils/interactive.tsx +290 -0
  33. package/src/workbase/AGENTS.md +5 -5
  34. package/src/workbase/frontmatter.ts +17 -0
  35. package/src/workbase/runner-command.test.ts +30 -4
  36. package/src/workbase/runner-command.ts +21 -6
  37. package/src/workbase/schemas.test.ts +4 -2
  38. package/src/workbase/schemas.ts +4 -0
@@ -13,7 +13,9 @@ export interface RunnerCommandVariables {
13
13
 
14
14
  interface RunnerDefinition {
15
15
  readonly command: readonly string[]
16
+ readonly autoCommand?: readonly string[]
16
17
  readonly resumeCommand?: readonly string[]
18
+ readonly autoResumeCommand?: readonly string[]
17
19
  readonly environment?: Readonly<Record<string, string>>
18
20
  }
19
21
 
@@ -30,12 +32,16 @@ const PLACEHOLDERS = new Set<keyof RunnerCommandVariables>([
30
32
 
31
33
  const BUILTIN_RUNNERS: Readonly<Record<string, RunnerDefinition>> = {
32
34
  opencode: {
33
- command: ["opencode", "--prompt", "{prompt}"],
34
- resumeCommand: ["opencode", "--continue", "--prompt", "{prompt}"],
35
+ command: ["opencode"],
36
+ autoCommand: ["opencode", "--prompt", "{prompt}"],
37
+ resumeCommand: ["opencode", "--continue"],
38
+ autoResumeCommand: ["opencode", "--continue", "--prompt", "{prompt}"],
35
39
  },
36
40
  claude: {
37
- command: ["claude", "{prompt}"],
38
- resumeCommand: ["claude", "--continue", "{prompt}"],
41
+ command: ["claude"],
42
+ autoCommand: ["claude", "{prompt}"],
43
+ resumeCommand: ["claude", "--continue"],
44
+ autoResumeCommand: ["claude", "--continue", "{prompt}"],
39
45
  },
40
46
  }
41
47
 
@@ -54,7 +60,9 @@ export const validateRunners = (runners: WorkbaseConfig["runners"]): void => {
54
60
  for (const [name, runner] of Object.entries(runners ?? {})) {
55
61
  for (const value of [
56
62
  ...runner.command,
63
+ ...(runner.autoCommand ?? []),
57
64
  ...(runner.resumeCommand ?? []),
65
+ ...(runner.autoResumeCommand ?? []),
58
66
  ...Object.values(runner.environment ?? {}),
59
67
  ]) {
60
68
  validateTemplate(name, value)
@@ -74,14 +82,21 @@ export const resolveRunnerCommand = (
74
82
  configured: WorkbaseConfig["runners"],
75
83
  variables: RunnerCommandVariables,
76
84
  resume: boolean,
85
+ auto = false,
77
86
  ) => {
78
87
  validateRunners(configured)
79
88
  const definition = configured?.[name] ?? BUILTIN_RUNNERS[name]
80
89
  if (!definition) throw new Error(`Unknown runner: ${name}`)
81
- const template =
82
- resume && definition.resumeCommand
90
+ const template = auto
91
+ ? resume
92
+ ? (definition.autoResumeCommand ?? definition.autoCommand)
93
+ : definition.autoCommand
94
+ : resume && definition.resumeCommand
83
95
  ? definition.resumeCommand
84
96
  : definition.command
97
+ if (!template) {
98
+ throw new Error(`Runner '${name}' does not support --auto`)
99
+ }
85
100
  const argv = template.map((argument) => expand(argument, variables))
86
101
  const environment = Object.fromEntries(
87
102
  Object.entries(definition.environment ?? {}).map(([key, value]) => [
@@ -136,14 +136,16 @@ describe("runner configuration", () => {
136
136
  version: 2,
137
137
  runners: {
138
138
  custom: {
139
- command: ["agent", "{prompt}"],
139
+ command: ["agent"],
140
+ autoCommand: ["agent", "{prompt}"],
140
141
  resumeCommand: ["agent", "resume", "{sessionId}"],
142
+ autoResumeCommand: ["agent", "resume", "{sessionId}", "{prompt}"],
141
143
  environment: { CUSTOM_TARGET: "{target}" },
142
144
  },
143
145
  },
144
146
  })
145
147
 
146
- expect(config.runners?.custom?.command).toEqual(["agent", "{prompt}"])
148
+ expect(config.runners?.custom?.autoCommand).toEqual(["agent", "{prompt}"])
147
149
  })
148
150
 
149
151
  test("rejects shell strings in place of argv arrays", () => {
@@ -96,7 +96,11 @@ export const WorkbaseConfig = Schema.Struct({
96
96
  key: EntityId,
97
97
  value: Schema.Struct({
98
98
  command: Schema.NonEmptyArray(NonEmptyString),
99
+ autoCommand: Schema.optional(Schema.NonEmptyArray(NonEmptyString)),
99
100
  resumeCommand: Schema.optional(Schema.NonEmptyArray(NonEmptyString)),
101
+ autoResumeCommand: Schema.optional(
102
+ Schema.NonEmptyArray(NonEmptyString),
103
+ ),
100
104
  environment: Schema.optional(
101
105
  Schema.Record({ key: EnvironmentName, value: Schema.String }),
102
106
  ),