agentplane 0.2.2 → 0.2.4

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 (124) hide show
  1. package/assets/AGENTS.md +58 -32
  2. package/assets/framework.manifest.json +89 -0
  3. package/dist/adapters/clock/system-clock-adapter.d.ts +5 -0
  4. package/dist/adapters/clock/system-clock-adapter.d.ts.map +1 -0
  5. package/dist/adapters/clock/system-clock-adapter.js +5 -0
  6. package/dist/adapters/fs/node-fs-adapter.d.ts +15 -0
  7. package/dist/adapters/fs/node-fs-adapter.d.ts.map +1 -0
  8. package/dist/adapters/fs/node-fs-adapter.js +47 -0
  9. package/dist/adapters/git/git-context-adapter.d.ts +21 -0
  10. package/dist/adapters/git/git-context-adapter.d.ts.map +1 -0
  11. package/dist/adapters/git/git-context-adapter.js +27 -0
  12. package/dist/adapters/index.d.ts +13 -0
  13. package/dist/adapters/index.d.ts.map +1 -0
  14. package/dist/adapters/index.js +12 -0
  15. package/dist/adapters/task-backend/task-backend-adapter.d.ts +12 -0
  16. package/dist/adapters/task-backend/task-backend-adapter.d.ts.map +1 -0
  17. package/dist/adapters/task-backend/task-backend-adapter.js +22 -0
  18. package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
  19. package/dist/backends/task-backend/local-backend.js +39 -34
  20. package/dist/backends/task-index.d.ts +9 -3
  21. package/dist/backends/task-index.d.ts.map +1 -1
  22. package/dist/backends/task-index.js +64 -14
  23. package/dist/cli/cli-error.d.ts +9 -0
  24. package/dist/cli/cli-error.d.ts.map +1 -0
  25. package/dist/cli/cli-error.js +13 -0
  26. package/dist/cli/http.d.ts.map +1 -1
  27. package/dist/cli/http.js +18 -6
  28. package/dist/cli/parse/lifecycle.d.ts.map +1 -1
  29. package/dist/cli/parse/lifecycle.js +6 -1
  30. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  31. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  32. package/dist/cli/run-cli/command-catalog.js +8 -0
  33. package/dist/cli/run-cli/commands/init/conflicts.d.ts.map +1 -1
  34. package/dist/cli/run-cli/commands/init/conflicts.js +2 -1
  35. package/dist/cli/run-cli/commands/init/write-agents.d.ts.map +1 -1
  36. package/dist/cli/run-cli/commands/init/write-agents.js +27 -4
  37. package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -1
  38. package/dist/cli/run-cli/commands/init/write-config.js +0 -4
  39. package/dist/cli/run-cli.d.ts.map +1 -1
  40. package/dist/cli/run-cli.js +14 -5
  41. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  42. package/dist/cli/run-cli.test-helpers.js +35 -1
  43. package/dist/commands/branch/internal/work-validate.d.ts.map +1 -1
  44. package/dist/commands/branch/internal/work-validate.js +13 -4
  45. package/dist/commands/branch/status.d.ts.map +1 -1
  46. package/dist/commands/branch/status.js +9 -4
  47. package/dist/commands/doctor.command.d.ts +8 -0
  48. package/dist/commands/doctor.command.d.ts.map +1 -0
  49. package/dist/commands/doctor.command.js +137 -0
  50. package/dist/commands/guard/impl/allow.d.ts.map +1 -1
  51. package/dist/commands/guard/impl/allow.js +7 -2
  52. package/dist/commands/guard/impl/close-message.d.ts.map +1 -1
  53. package/dist/commands/guard/impl/close-message.js +7 -2
  54. package/dist/commands/pr/check.d.ts.map +1 -1
  55. package/dist/commands/pr/check.js +7 -2
  56. package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -1
  57. package/dist/commands/pr/integrate/artifacts.js +6 -1
  58. package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
  59. package/dist/commands/pr/integrate/internal/merge.js +7 -6
  60. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  61. package/dist/commands/pr/integrate/internal/prepare.js +9 -4
  62. package/dist/commands/pr/integrate/verify.d.ts.map +1 -1
  63. package/dist/commands/pr/integrate/verify.js +3 -1
  64. package/dist/commands/pr/note.d.ts.map +1 -1
  65. package/dist/commands/pr/note.js +13 -4
  66. package/dist/commands/pr/open.d.ts.map +1 -1
  67. package/dist/commands/pr/open.js +8 -3
  68. package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
  69. package/dist/commands/recipes/impl/apply.js +2 -1
  70. package/dist/commands/recipes/impl/commands/explain.d.ts.map +1 -1
  71. package/dist/commands/recipes/impl/commands/explain.js +2 -1
  72. package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -1
  73. package/dist/commands/recipes/impl/commands/info.js +2 -1
  74. package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
  75. package/dist/commands/recipes/impl/commands/install.js +5 -4
  76. package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
  77. package/dist/commands/recipes/impl/commands/remove.js +2 -1
  78. package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
  79. package/dist/commands/scenario/impl/commands.js +8 -7
  80. package/dist/commands/shared/git-ops.d.ts.map +1 -1
  81. package/dist/commands/shared/git-ops.js +4 -3
  82. package/dist/commands/shared/task-store.d.ts.map +1 -1
  83. package/dist/commands/shared/task-store.js +7 -2
  84. package/dist/commands/task/list.command.d.ts.map +1 -1
  85. package/dist/commands/task/list.command.js +4 -5
  86. package/dist/commands/task/migrate-doc.d.ts.map +1 -1
  87. package/dist/commands/task/migrate-doc.js +2 -1
  88. package/dist/commands/task/new.command.d.ts.map +1 -1
  89. package/dist/commands/task/new.command.js +2 -8
  90. package/dist/commands/task/rebuild-index.command.d.ts +6 -0
  91. package/dist/commands/task/rebuild-index.command.d.ts.map +1 -0
  92. package/dist/commands/task/rebuild-index.command.js +18 -0
  93. package/dist/commands/task/shared.d.ts.map +1 -1
  94. package/dist/commands/task/shared.js +15 -6
  95. package/dist/commands/upgrade.command.d.ts.map +1 -1
  96. package/dist/commands/upgrade.command.js +52 -4
  97. package/dist/commands/upgrade.d.ts +10 -0
  98. package/dist/commands/upgrade.d.ts.map +1 -1
  99. package/dist/commands/upgrade.js +337 -95
  100. package/dist/policy/engine.d.ts +21 -0
  101. package/dist/policy/engine.d.ts.map +1 -0
  102. package/dist/policy/engine.js +32 -0
  103. package/dist/ports/clock-port.d.ts +4 -0
  104. package/dist/ports/clock-port.d.ts.map +1 -0
  105. package/dist/ports/clock-port.js +1 -0
  106. package/dist/ports/fs-port.d.ts +18 -0
  107. package/dist/ports/fs-port.d.ts.map +1 -0
  108. package/dist/ports/fs-port.js +1 -0
  109. package/dist/ports/git-port.d.ts +18 -0
  110. package/dist/ports/git-port.d.ts.map +1 -0
  111. package/dist/ports/git-port.js +1 -0
  112. package/dist/ports/task-backend-port.d.ts +8 -0
  113. package/dist/ports/task-backend-port.d.ts.map +1 -0
  114. package/dist/ports/task-backend-port.js +1 -0
  115. package/dist/usecases/context/resolve-context.d.ts +14 -0
  116. package/dist/usecases/context/resolve-context.d.ts.map +1 -0
  117. package/dist/usecases/context/resolve-context.js +13 -0
  118. package/dist/usecases/task/task-list-usecase.d.ts +9 -0
  119. package/dist/usecases/task/task-list-usecase.d.ts.map +1 -0
  120. package/dist/usecases/task/task-list-usecase.js +17 -0
  121. package/dist/usecases/task/task-new-usecase.d.ts +9 -0
  122. package/dist/usecases/task/task-new-usecase.d.ts.map +1 -0
  123. package/dist/usecases/task/task-new-usecase.js +17 -0
  124. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../../src/commands/recipes/impl/commands/install.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAM3E,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,GAAG,EAAE,OAAO,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAkMlB"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../../src/commands/recipes/impl/commands/install.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAM3E,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,GAAG,EAAE,OAAO,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAkMlB"}
@@ -5,6 +5,7 @@ import { defaultConfig, loadConfig } from "@agentplaneorg/core";
5
5
  import { extractArchive } from "../../../../cli/archive.js";
6
6
  import { sha256File } from "../../../../cli/checksum.js";
7
7
  import { mapCoreError } from "../../../../cli/error-map.js";
8
+ import { exitCodeForError } from "../../../../cli/exit-codes.js";
8
9
  import { fileExists, getPathKind } from "../../../../cli/fs-utils.js";
9
10
  import { downloadToFile } from "../../../../cli/http.js";
10
11
  import { CliError } from "../../../../shared/errors.js";
@@ -61,7 +62,7 @@ export async function cmdRecipeInstall(opts) {
61
62
  const entry = index.recipes.find((recipe) => recipe.id === recipeId);
62
63
  if (!entry) {
63
64
  throw new CliError({
64
- exitCode: 5,
65
+ exitCode: exitCodeForError("E_IO"),
65
66
  code: "E_IO",
66
67
  message: `Recipe not found in remote index: ${recipeId}`,
67
68
  });
@@ -90,7 +91,7 @@ export async function cmdRecipeInstall(opts) {
90
91
  const resolved = path.resolve(opts.cwd, latest.url);
91
92
  if (!(await fileExists(resolved))) {
92
93
  throw new CliError({
93
- exitCode: 5,
94
+ exitCode: exitCodeForError("E_IO"),
94
95
  code: "E_IO",
95
96
  message: `Recipe archive not found: ${latest.url}`,
96
97
  });
@@ -113,7 +114,7 @@ export async function cmdRecipeInstall(opts) {
113
114
  const candidate = await resolvePathFallback(source.value);
114
115
  if (!(await fileExists(candidate))) {
115
116
  throw new CliError({
116
- exitCode: 5,
117
+ exitCode: exitCodeForError("E_IO"),
117
118
  code: "E_IO",
118
119
  message: `Recipe archive not found: ${source.value}`,
119
120
  });
@@ -153,7 +154,7 @@ export async function cmdRecipeInstall(opts) {
153
154
  const installKind = await getPathKind(installDir);
154
155
  if (installKind && installKind !== "dir") {
155
156
  throw new CliError({
156
- exitCode: 5,
157
+ exitCode: exitCodeForError("E_IO"),
157
158
  code: "E_IO",
158
159
  message: `Recipe install path is not a directory: ${installDir}`,
159
160
  });
@@ -1 +1 @@
1
- {"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../../../src/commands/recipes/impl/commands/remove.ts"],"names":[],"mappings":"AASA,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BlB"}
1
+ {"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../../../src/commands/recipes/impl/commands/remove.ts"],"names":[],"mappings":"AAUA,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BlB"}
@@ -1,5 +1,6 @@
1
1
  import { rm } from "node:fs/promises";
2
2
  import { mapCoreError } from "../../../../cli/error-map.js";
3
+ import { exitCodeForError } from "../../../../cli/exit-codes.js";
3
4
  import { successMessage } from "../../../../cli/output.js";
4
5
  import { CliError } from "../../../../shared/errors.js";
5
6
  import { readInstalledRecipesFile, writeInstalledRecipesFile } from "../installed-recipes.js";
@@ -11,7 +12,7 @@ export async function cmdRecipeRemoveParsed(opts) {
11
12
  const entry = installed.recipes.find((recipe) => recipe.id === opts.id);
12
13
  if (!entry) {
13
14
  throw new CliError({
14
- exitCode: 5,
15
+ exitCode: exitCodeForError("E_IO"),
15
16
  code: "E_IO",
16
17
  message: `Recipe not installed: ${opts.id}`,
17
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/scenario/impl/commands.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA+BtE,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoDlB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoElB;AAkCD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;CACvD,GAAG,OAAO,CAAC,MAAM,CAAC,CAqNlB"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/scenario/impl/commands.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAgCtE,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoDlB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoElB;AAkCD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;CACvD,GAAG,OAAO,CAAC,MAAM,CAAC,CAqNlB"}
@@ -4,6 +4,7 @@ import path from "node:path";
4
4
  import { promisify } from "node:util";
5
5
  import { atomicWriteFile, resolveProject } from "@agentplaneorg/core";
6
6
  import { mapCoreError } from "../../../cli/error-map.js";
7
+ import { exitCodeForError } from "../../../cli/exit-codes.js";
7
8
  import { fileExists, getPathKind } from "../../../cli/fs-utils.js";
8
9
  import { emptyStateMessage } from "../../../cli/output.js";
9
10
  import { CliError } from "../../../shared/errors.js";
@@ -66,7 +67,7 @@ export async function cmdScenarioInfoParsed(opts) {
66
67
  const entry = installed.recipes.find((recipe) => recipe.id === recipeId);
67
68
  if (!entry) {
68
69
  throw new CliError({
69
- exitCode: 5,
70
+ exitCode: exitCodeForError("E_IO"),
70
71
  code: "E_IO",
71
72
  message: `Recipe not installed: ${recipeId}`,
72
73
  });
@@ -96,7 +97,7 @@ export async function cmdScenarioInfoParsed(opts) {
96
97
  }
97
98
  if (!scenario && !summary) {
98
99
  throw new CliError({
99
- exitCode: 5,
100
+ exitCode: exitCodeForError("E_IO"),
100
101
  code: "E_IO",
101
102
  message: `Scenario not found: ${recipeId}:${scenarioId}`,
102
103
  });
@@ -166,7 +167,7 @@ export async function cmdScenarioRunParsed(opts) {
166
167
  const entry = installed.recipes.find((recipe) => recipe.id === recipeId);
167
168
  if (!entry) {
168
169
  throw new CliError({
169
- exitCode: 5,
170
+ exitCode: exitCodeForError("E_IO"),
170
171
  code: "E_IO",
171
172
  message: `Recipe not installed: ${recipeId}`,
172
173
  });
@@ -177,7 +178,7 @@ export async function cmdScenarioRunParsed(opts) {
177
178
  const scenariosDir = path.join(recipeDir, RECIPES_SCENARIOS_DIR_NAME);
178
179
  if ((await getPathKind(scenariosDir)) !== "dir") {
179
180
  throw new CliError({
180
- exitCode: 5,
181
+ exitCode: exitCodeForError("E_IO"),
181
182
  code: "E_IO",
182
183
  message: `Scenario definitions not found for recipe: ${recipeId}`,
183
184
  });
@@ -194,7 +195,7 @@ export async function cmdScenarioRunParsed(opts) {
194
195
  }
195
196
  if (!scenario) {
196
197
  throw new CliError({
197
- exitCode: 5,
198
+ exitCode: exitCodeForError("E_IO"),
198
199
  code: "E_IO",
199
200
  message: `Scenario not found: ${recipeId}:${scenarioId}`,
200
201
  });
@@ -217,7 +218,7 @@ export async function cmdScenarioRunParsed(opts) {
217
218
  const toolEntry = manifest.tools?.find((tool) => tool?.id === step.tool);
218
219
  if (!toolEntry) {
219
220
  throw new CliError({
220
- exitCode: 5,
221
+ exitCode: exitCodeForError("E_IO"),
221
222
  code: "E_IO",
222
223
  message: `Tool not found in recipe manifest: ${step.tool}`,
223
224
  });
@@ -237,7 +238,7 @@ export async function cmdScenarioRunParsed(opts) {
237
238
  const entrypointPath = path.join(recipeDir, entrypoint);
238
239
  if (!(await fileExists(entrypointPath))) {
239
240
  throw new CliError({
240
- exitCode: 5,
241
+ exitCode: exitCodeForError("E_IO"),
241
242
  code: "E_IO",
242
243
  message: `Tool entrypoint not found: ${entrypoint}`,
243
244
  });
@@ -1 +1 @@
1
- {"version":3,"file":"git-ops.d.ts","sourceRoot":"","sources":["../../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,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAe9F;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiDlB;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhB"}
@@ -1,5 +1,6 @@
1
1
  import { execFileAsync, gitEnv } from "./git.js";
2
2
  import { setPinnedBaseBranch } from "@agentplaneorg/core";
3
+ import { exitCodeForError } from "../../cli/exit-codes.js";
3
4
  import { promptChoice, promptInput } from "../../cli/prompts.js";
4
5
  import { CliError } from "../../shared/errors.js";
5
6
  export async function gitRevParse(cwd, args) {
@@ -130,7 +131,7 @@ export async function promptInitBaseBranch(opts) {
130
131
  const candidate = raw.trim() || opts.fallback;
131
132
  if (!candidate) {
132
133
  throw new CliError({
133
- exitCode: 2,
134
+ exitCode: exitCodeForError("E_USAGE"),
134
135
  code: "E_USAGE",
135
136
  message: "Base branch name cannot be empty",
136
137
  });
@@ -142,7 +143,7 @@ export async function promptInitBaseBranch(opts) {
142
143
  }
143
144
  catch (err) {
144
145
  const message = err instanceof Error ? err.message : `Failed to create branch ${candidate}`;
145
- throw new CliError({ exitCode: 5, code: "E_GIT", message });
146
+ throw new CliError({ exitCode: exitCodeForError("E_GIT"), code: "E_GIT", message });
146
147
  }
147
148
  return candidate;
148
149
  };
@@ -161,7 +162,7 @@ export async function ensureInitCommit(opts) {
161
162
  const stagedBefore = await gitStagedPaths(opts.gitRoot);
162
163
  if (stagedBefore.length > 0) {
163
164
  throw new CliError({
164
- exitCode: 5,
165
+ exitCode: exitCodeForError("E_GIT"),
165
166
  code: "E_GIT",
166
167
  message: "Git index has staged changes; commit or unstage them before running agentplane init.",
167
168
  });
@@ -1 +1 @@
1
- {"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-store.ts"],"names":[],"mappings":"AAYA,OAAO,EAAgB,KAAK,QAAQ,EAAoB,MAAM,gCAAgC,CAAC;AAG/F,OAAO,EAA8C,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA0DpG,qBAAa,SAAS;IACpB,OAAO,CAAC,GAAG,CAAiB;IAC5B,OAAO,CAAC,KAAK,CAA0C;gBAE3C,GAAG,EAAE,cAAc;IAIzB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;YAK9B,SAAS;IAkBjB,MAAM,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAC3D,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;CAwEjD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,SAAS,CAI3D;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAEtE"}
1
+ {"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-store.ts"],"names":[],"mappings":"AAYA,OAAO,EAAgB,KAAK,QAAQ,EAAoB,MAAM,gCAAgC,CAAC;AAI/F,OAAO,EAA8C,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA0DpG,qBAAa,SAAS;IACpB,OAAO,CAAC,GAAG,CAAiB;IAC5B,OAAO,CAAC,KAAK,CAA0C;gBAE3C,GAAG,EAAE,cAAc;IAIzB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;YAK9B,SAAS;IAsBjB,MAAM,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAC3D,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;CAwEjD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,SAAS,CAI3D;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAEtE"}
@@ -2,6 +2,7 @@ import { readFile, stat } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { docChanged, extractTaskDoc, mergeTaskDoc, parseTaskReadme, renderTaskReadme, } from "@agentplaneorg/core";
4
4
  import { LocalBackend, taskRecordToData } from "../../backends/task-backend.js";
5
+ import { exitCodeForError } from "../../cli/exit-codes.js";
5
6
  import { CliError } from "../../shared/errors.js";
6
7
  import { writeTextIfChanged } from "../../shared/write-if-changed.js";
7
8
  import { resolveDocUpdatedBy, taskDataToFrontmatter } from "./task-backend.js";
@@ -40,7 +41,7 @@ async function ensureUnchangedOnDisk(opts) {
40
41
  const st = await stat(opts.readmePath);
41
42
  if (st.mtimeMs !== opts.expectedMtimeMs) {
42
43
  throw new CliError({
43
- exitCode: 4,
44
+ exitCode: exitCodeForError("E_IO"),
44
45
  code: "E_IO",
45
46
  message: `Task README changed concurrently: ${opts.readmePath}`,
46
47
  });
@@ -59,7 +60,11 @@ export class TaskStore {
59
60
  async getCached(taskId) {
60
61
  const key = taskId.trim();
61
62
  if (!key) {
62
- throw new CliError({ exitCode: 2, code: "E_USAGE", message: "task id is required" });
63
+ throw new CliError({
64
+ exitCode: exitCodeForError("E_USAGE"),
65
+ code: "E_USAGE",
66
+ message: "task id is required",
67
+ });
63
68
  }
64
69
  const existing = this.cache.get(key);
65
70
  if (existing)
@@ -1 +1 @@
1
- {"version":3,"file":"list.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/list.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG;IAAE,OAAO,EAAE,eAAe,CAAA;CAAE,CAAC;AAQ1D,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,cAAc,CAgDpD,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACvE,KAAK,UAAU,EAAE,GAAG,cAAc,KAAG,OAAO,CAAC,MAAM,CAAC,CAQnE"}
1
+ {"version":3,"file":"list.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/list.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,MAAM,MAAM,cAAc,GAAG;IAAE,OAAO,EAAE,eAAe,CAAA;CAAE,CAAC;AAQ1D,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,cAAc,CAgDpD,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACvE,KAAK,UAAU,EAAE,GAAG,cAAc,KAAG,OAAO,CAAC,MAAM,CAAC,CAOnE"}
@@ -1,5 +1,5 @@
1
1
  import { usageError } from "../../cli/spec/errors.js";
2
- import { cmdTaskList } from "./list.js";
2
+ import { taskListUsecase } from "../../usecases/task/task-list-usecase.js";
3
3
  function toStringList(v) {
4
4
  if (typeof v === "string")
5
5
  return [v];
@@ -58,10 +58,9 @@ export const taskListSpec = {
58
58
  };
59
59
  export function makeRunTaskListHandler(getCtx) {
60
60
  return async (ctx, p) => {
61
- return await cmdTaskList({
62
- ctx: await getCtx("task list"),
63
- cwd: ctx.cwd,
64
- rootOverride: ctx.rootOverride,
61
+ return await taskListUsecase({
62
+ cli: ctx,
63
+ command: await getCtx("task list"),
65
64
  filters: p.filters,
66
65
  });
67
66
  };
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-doc.d.ts","sourceRoot":"","sources":["../../../src/commands/task/migrate-doc.ts"],"names":[],"mappings":"AAkIA,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwClB"}
1
+ {"version":3,"file":"migrate-doc.d.ts","sourceRoot":"","sources":["../../../src/commands/task/migrate-doc.ts"],"names":[],"mappings":"AAmIA,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwClB"}
@@ -2,6 +2,7 @@ import { readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { atomicWriteFile, ensureDocSections, extractTaskDoc, loadConfig, mergeTaskDoc, normalizeTaskDoc, parseTaskReadme, renderTaskReadme, resolveProject, } from "@agentplaneorg/core";
4
4
  import { mapCoreError } from "../../cli/error-map.js";
5
+ import { exitCodeForError } from "../../cli/exit-codes.js";
5
6
  import { fileExists, getPathKind } from "../../cli/fs-utils.js";
6
7
  import { successMessage } from "../../cli/output.js";
7
8
  import { CliError } from "../../shared/errors.js";
@@ -114,7 +115,7 @@ export async function cmdTaskMigrateDoc(opts) {
114
115
  if (!(await fileExists(readmePath))) {
115
116
  const taskId = path.basename(path.dirname(readmePath));
116
117
  throw new CliError({
117
- exitCode: 5,
118
+ exitCode: exitCodeForError("E_IO"),
118
119
  code: "E_IO",
119
120
  message: `Task README not found: ${taskId}`,
120
121
  });
@@ -1 +1 @@
1
- {"version":3,"file":"new.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/new.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,wBAAwB,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,GAClE,cAAc,CAAC,aAAa,CAAC,CAU/B"}
1
+ {"version":3,"file":"new.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/new.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,wBAAwB,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,GAClE,cAAc,CAAC,aAAa,CAAC,CAI/B"}
@@ -1,13 +1,7 @@
1
- import { runTaskNewParsed } from "./new.js";
1
+ import { taskNewUsecase } from "../../usecases/task/task-new-usecase.js";
2
2
  export { taskNewSpec } from "./new.spec.js";
3
3
  export function makeRunTaskNewHandler(getCtx) {
4
4
  return async (ctx, p) => {
5
- const commandCtx = await getCtx("task new");
6
- return await runTaskNewParsed({
7
- ctx: commandCtx,
8
- cwd: ctx.cwd,
9
- rootOverride: ctx.rootOverride,
10
- parsed: p,
11
- });
5
+ return await taskNewUsecase({ cli: ctx, command: await getCtx("task new"), parsed: p });
12
6
  };
13
7
  }
@@ -0,0 +1,6 @@
1
+ import type { CommandHandler, CommandSpec } from "../../cli/spec/spec.js";
2
+ import type { CommandContext } from "../shared/task-backend.js";
3
+ export type TaskRebuildIndexParsed = Record<string, never>;
4
+ export declare const taskRebuildIndexSpec: CommandSpec<TaskRebuildIndexParsed>;
5
+ export declare function makeRunTaskRebuildIndexHandler(getCtx: (commandForErrorContext: string) => Promise<CommandContext>): CommandHandler<TaskRebuildIndexParsed>;
6
+ //# sourceMappingURL=rebuild-index.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rebuild-index.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/rebuild-index.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE3D,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAMpE,CAAC;AAEF,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,GAClE,cAAc,CAAC,sBAAsB,CAAC,CAWxC"}
@@ -0,0 +1,18 @@
1
+ import { successMessage } from "../../cli/output.js";
2
+ export const taskRebuildIndexSpec = {
3
+ id: ["task", "rebuild-index"],
4
+ group: "Task",
5
+ summary: "Rebuild the task index cache for the configured backend (best-effort).",
6
+ examples: [{ cmd: "agentplane task rebuild-index", why: "Rebuild tasks index cache." }],
7
+ parse: () => ({}),
8
+ };
9
+ export function makeRunTaskRebuildIndexHandler(getCtx) {
10
+ return async (_cliCtx, _p) => {
11
+ const ctx = await getCtx("task rebuild-index");
12
+ // Local backend rebuilds the index as a side-effect of listing tasks.
13
+ // Other backends may ignore the cache.
14
+ await ctx.taskBackend.listTasks();
15
+ console.log(successMessage("rebuild-index", undefined, "OK"));
16
+ return 0;
17
+ };
18
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/commands/task/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAK9C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAS5D,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAI/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,eAAO,MAAM,aAAa,+BAAsB,CAAC;AAEjD,wBAAgB,MAAM,IAAI,MAAM,CAE/B;AAED,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAE3E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBjF;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAKvE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAI/D;AAID,wBAAgB,mBAAmB,CAAC,KAAK,EAA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,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC9B,eAAe,CA8EjB;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAiBnD"}
@@ -4,6 +4,7 @@ import { readdir } from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import { invalidValueForFlag, invalidValueMessage, missingValueMessage, warnMessage, } from "../../cli/output.js";
6
6
  import { fileExists } from "../../cli/fs-utils.js";
7
+ import { exitCodeForError } from "../../cli/exit-codes.js";
7
8
  import { CliError } from "../../shared/errors.js";
8
9
  import { dedupeStrings } from "../../shared/strings.js";
9
10
  import { parseGitLogHashSubject } from "../../shared/git-log.js";
@@ -269,7 +270,7 @@ export function parseTaskListFilters(args, opts) {
269
270
  const next = args[i + 1];
270
271
  if (!next) {
271
272
  throw new CliError({
272
- exitCode: 2,
273
+ exitCode: exitCodeForError("E_USAGE"),
273
274
  code: "E_USAGE",
274
275
  message: missingValueMessage("--status"),
275
276
  });
@@ -282,7 +283,7 @@ export function parseTaskListFilters(args, opts) {
282
283
  const next = args[i + 1];
283
284
  if (!next) {
284
285
  throw new CliError({
285
- exitCode: 2,
286
+ exitCode: exitCodeForError("E_USAGE"),
286
287
  code: "E_USAGE",
287
288
  message: missingValueMessage("--owner"),
288
289
  });
@@ -294,7 +295,11 @@ export function parseTaskListFilters(args, opts) {
294
295
  if (arg === "--tag") {
295
296
  const next = args[i + 1];
296
297
  if (!next) {
297
- throw new CliError({ exitCode: 2, code: "E_USAGE", message: missingValueMessage("--tag") });
298
+ throw new CliError({
299
+ exitCode: exitCodeForError("E_USAGE"),
300
+ code: "E_USAGE",
301
+ message: missingValueMessage("--tag"),
302
+ });
298
303
  }
299
304
  out.tag.push(next);
300
305
  i++;
@@ -304,7 +309,7 @@ export function parseTaskListFilters(args, opts) {
304
309
  const next = args[i + 1];
305
310
  if (!next) {
306
311
  throw new CliError({
307
- exitCode: 2,
312
+ exitCode: exitCodeForError("E_USAGE"),
308
313
  code: "E_USAGE",
309
314
  message: missingValueMessage("--limit"),
310
315
  });
@@ -312,7 +317,7 @@ export function parseTaskListFilters(args, opts) {
312
317
  const parsed = Number.parseInt(next, 10);
313
318
  if (!Number.isFinite(parsed)) {
314
319
  throw new CliError({
315
- exitCode: 2,
320
+ exitCode: exitCodeForError("E_USAGE"),
316
321
  code: "E_USAGE",
317
322
  message: invalidValueForFlag("--limit", next, "integer"),
318
323
  });
@@ -322,7 +327,11 @@ export function parseTaskListFilters(args, opts) {
322
327
  continue;
323
328
  }
324
329
  if (arg.startsWith("--")) {
325
- throw new CliError({ exitCode: 2, code: "E_USAGE", message: `Unknown flag: ${arg}` });
330
+ throw new CliError({
331
+ exitCode: exitCodeForError("E_USAGE"),
332
+ code: "E_USAGE",
333
+ message: `Unknown flag: ${arg}`,
334
+ });
326
335
  }
327
336
  }
328
337
  return out;
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.command.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnE,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC;AAEzC,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,aAAa,CAqGlD,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,aAAa,CACsB,CAAC"}
1
+ {"version":3,"file":"upgrade.command.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnE,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC;AAEzC,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,aAAa,CA0JlD,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,aAAa,CACsB,CAAC"}
@@ -4,8 +4,32 @@ export const upgradeSpec = {
4
4
  id: ["upgrade"],
5
5
  group: "Setup",
6
6
  summary: "Upgrade the local agentplane framework bundle in the repo.",
7
- description: "Downloads (or reads) an upgrade bundle, verifies checksum, and applies allowed files into the repo. Network access is gated by config approvals; use --yes when allowed.",
7
+ description: "Upgrades the local agentplane framework bundle in the repo using a strict manifest of managed files. By default, upgrade generates an agent-assisted plan from the locally installed agentplane package assets (no network) and does not modify files. Use --auto to apply changes. Use --remote to fetch a GitHub release bundle; network access is gated by config approvals.",
8
8
  options: [
9
+ {
10
+ kind: "boolean",
11
+ name: "agent",
12
+ default: false,
13
+ description: "Generate an agent-assisted upgrade plan (no files are modified). This is the default mode.",
14
+ },
15
+ {
16
+ kind: "boolean",
17
+ name: "auto",
18
+ default: false,
19
+ description: "Apply the upgrade automatically (writes managed files).",
20
+ },
21
+ {
22
+ kind: "boolean",
23
+ name: "remote",
24
+ default: false,
25
+ description: "Fetch the framework bundle from GitHub releases (requires network approvals).",
26
+ },
27
+ {
28
+ kind: "boolean",
29
+ name: "allow-tarball",
30
+ default: false,
31
+ description: "Allow falling back to a GitHub repo tarball when release assets are missing (no checksum verification).",
32
+ },
9
33
  {
10
34
  kind: "string",
11
35
  name: "tag",
@@ -61,14 +85,27 @@ export const upgradeSpec = {
61
85
  description: "Auto-approve network access prompts (subject to config approvals).",
62
86
  },
63
87
  ],
88
+ validateRaw: (raw) => {
89
+ if (raw.opts.agent === true && raw.opts.auto === true) {
90
+ throw usageError({
91
+ spec: upgradeSpec,
92
+ command: "upgrade",
93
+ message: "Options --agent and --auto are mutually exclusive.",
94
+ });
95
+ }
96
+ },
64
97
  examples: [
65
98
  {
66
99
  cmd: "agentplane upgrade",
67
- why: "Upgrade to the latest release using config.framework.source.",
100
+ why: "Generate an agent-assisted plan using locally installed assets (no network).",
68
101
  },
69
102
  {
70
- cmd: "agentplane upgrade --tag v0.1.9 --dry-run",
71
- why: "Preview changes for a specific release tag.",
103
+ cmd: "agentplane upgrade --auto",
104
+ why: "Apply the upgrade automatically (writes managed files).",
105
+ },
106
+ {
107
+ cmd: "agentplane upgrade --remote --tag v0.1.9 --dry-run",
108
+ why: "Preview changes for a specific GitHub release tag (no writes).",
72
109
  },
73
110
  {
74
111
  cmd: "agentplane upgrade --bundle ./agentplane-upgrade.tar.gz --checksum ./agentplane-upgrade.tar.gz.sha256",
@@ -78,6 +115,9 @@ export const upgradeSpec = {
78
115
  parse: (raw) => {
79
116
  const noBackup = raw.opts["no-backup"] === true;
80
117
  return {
118
+ mode: raw.opts.auto === true ? "auto" : "agent",
119
+ remote: raw.opts.remote === true,
120
+ allowTarball: raw.opts["allow-tarball"] === true,
81
121
  source: raw.opts.source,
82
122
  tag: raw.opts.tag,
83
123
  bundle: raw.opts.bundle,
@@ -99,6 +139,14 @@ export const upgradeSpec = {
99
139
  message: "Options --bundle and --checksum must be provided together (or omitted together).",
100
140
  });
101
141
  }
142
+ const hasRemoteHints = Boolean(p.source) || Boolean(p.tag) || Boolean(p.asset) || Boolean(p.checksumAsset);
143
+ if (!p.remote && hasRemoteHints && !hasBundle) {
144
+ throw usageError({
145
+ spec: upgradeSpec,
146
+ command: "upgrade",
147
+ message: "Remote upgrade options (--tag/--source/--asset/--checksum-asset) require --remote.",
148
+ });
149
+ }
102
150
  },
103
151
  };
104
152
  export const runUpgrade = (ctx, flags) => cmdUpgradeParsed({ cwd: ctx.cwd, rootOverride: ctx.rootOverride, flags });
@@ -5,11 +5,15 @@ export type UpgradeFlags = {
5
5
  checksum?: string;
6
6
  asset?: string;
7
7
  checksumAsset?: string;
8
+ mode: "agent" | "auto";
9
+ remote: boolean;
10
+ allowTarball: boolean;
8
11
  dryRun: boolean;
9
12
  backup: boolean;
10
13
  yes: boolean;
11
14
  };
12
15
  type GitHubRelease = {
16
+ tag_name?: string;
13
17
  assets?: {
14
18
  name?: string;
15
19
  browser_download_url?: string;
@@ -36,6 +40,12 @@ export declare function resolveUpgradeDownloadFromRelease(opts: {
36
40
  kind: "tarball";
37
41
  tarballUrl: string;
38
42
  };
43
+ export declare function resolveRepoTarballUrl(opts: {
44
+ release: GitHubRelease;
45
+ owner: string;
46
+ repo: string;
47
+ explicitTag?: string;
48
+ }): string;
39
49
  export declare function cmdUpgradeParsed(opts: {
40
50
  cwd: string;
41
51
  rootOverride?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAmBF,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,MAAM,GAAG;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,CAWA;AAED,wBAAgB,iCAAiC,CAAC,IAAI,EAAE;IACtD,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC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