akm-cli 0.9.31 → 0.10.26101002-alpha

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 (236) hide show
  1. package/CHANGELOG.md +265 -0
  2. package/STABILITY.md +79 -53
  3. package/dist/api-node.mjs +20 -0
  4. package/dist/api.d.ts +23 -0
  5. package/dist/api.js +45 -0
  6. package/dist/assets/hints/cli-hints-full.md +13 -27
  7. package/dist/assets/hints/cli-hints-short.md +1 -1
  8. package/dist/assets/improve-strategies/default.json +3 -3
  9. package/dist/assets/prompts/consolidate-pair.md +9 -7
  10. package/dist/cli/shared.js +31 -48
  11. package/dist/cli/unknown-flags.js +6 -43
  12. package/dist/cli.js +8 -34
  13. package/dist/commands/agent/contribute-cli.js +1 -1
  14. package/dist/commands/completions.js +1 -2
  15. package/dist/commands/config-cli.js +5 -28
  16. package/dist/commands/env/env-cli.js +5 -5
  17. package/dist/commands/env/secret-cli.js +2 -2
  18. package/dist/commands/health/checks.js +41 -16
  19. package/dist/commands/health/plugin-staleness.js +52 -22
  20. package/dist/commands/improve/autonomy-gate.js +5 -3
  21. package/dist/commands/improve/consolidate/pair-pass.js +7 -1
  22. package/dist/commands/improve/consolidate.js +6 -35
  23. package/dist/commands/improve/distill/lesson-update.js +91 -0
  24. package/dist/commands/improve/distill-guards.js +1 -43
  25. package/dist/commands/improve/distill.js +140 -20
  26. package/dist/commands/improve/eligibility.js +14 -1
  27. package/dist/commands/improve/extract-cli.js +1 -1
  28. package/dist/commands/improve/improve-cli.js +87 -102
  29. package/dist/commands/improve/improve-strategies.js +8 -12
  30. package/dist/commands/improve/improve.js +2 -2
  31. package/dist/commands/improve/loop-stages.js +0 -1
  32. package/dist/commands/improve/planner.js +0 -1
  33. package/dist/commands/improve/preparation.js +40 -99
  34. package/dist/commands/improve/proactive-maintenance.js +2 -2
  35. package/dist/commands/improve/reflect-noise.js +3 -55
  36. package/dist/commands/improve/reflect.js +3 -8
  37. package/dist/commands/improve/retrieval-scope.js +2 -2
  38. package/dist/commands/improve/salience.js +2 -9
  39. package/dist/commands/improve/stage.js +14 -9
  40. package/dist/commands/lint/index.js +5 -20
  41. package/dist/commands/observability-cli.js +3 -9
  42. package/dist/commands/proposal/drain.js +39 -6
  43. package/dist/commands/proposal/proposal-cli.js +11 -31
  44. package/dist/commands/proposal/repository.js +3 -3
  45. package/dist/commands/read/knowledge.js +3 -3
  46. package/dist/commands/read/remember-cli.js +0 -13
  47. package/dist/commands/read/search-cli.js +29 -97
  48. package/dist/commands/read/search.js +0 -11
  49. package/dist/commands/read/show.js +0 -19
  50. package/dist/commands/sources/plugin-upgrade.js +164 -101
  51. package/dist/commands/sources/sources-cli.js +1 -15
  52. package/dist/commands/sources/stash-cli.js +4 -12
  53. package/dist/commands/tasks/tasks-cli.js +4 -115
  54. package/dist/commands/workflow/plan.js +11 -33
  55. package/dist/commands/workflow-cli.js +2 -7
  56. package/dist/core/adapter/adapter-ids.js +1 -2
  57. package/dist/core/adapter/adapters/agent-skills-adapter.js +0 -4
  58. package/dist/core/adapter/adapters/akm-adapter.js +9 -48
  59. package/dist/core/adapter/adapters/akm-lint.js +10 -26
  60. package/dist/core/adapter/adapters/akm-metadata.js +2 -72
  61. package/dist/core/adapter/adapters/akm-task-adapter.js +0 -5
  62. package/dist/core/adapter/adapters/akm-workflow-adapter.js +9 -28
  63. package/dist/core/adapter/adapters/dotenv-adapter.js +1 -20
  64. package/dist/core/adapter/adapters/generic-files-adapter.js +0 -10
  65. package/dist/core/adapter/adapters/llm-wiki-adapter.js +0 -4
  66. package/dist/core/adapter/adapters/tool-dir-shared.js +0 -24
  67. package/dist/core/adapter/adapters/website-snapshot-adapter.js +4 -4
  68. package/dist/core/adapter/recognize-match.js +3 -4
  69. package/dist/core/common.js +18 -2
  70. package/dist/core/config/config-schema.js +12 -15
  71. package/dist/core/config/config-types.js +6 -15
  72. package/dist/core/config/config-walker.js +6 -23
  73. package/dist/core/config/config.js +17 -80
  74. package/dist/core/config/engine-semantics.js +7 -3
  75. package/dist/core/config/schema/engines.js +7 -7
  76. package/dist/core/config/schema/improve-processes.js +8 -61
  77. package/dist/core/config/schema/improve.js +2 -21
  78. package/dist/core/config/schema/index-config.js +6 -39
  79. package/dist/core/env-secret-ref.js +2 -45
  80. package/dist/core/errors.js +1 -2
  81. package/dist/core/extra-params.js +2 -86
  82. package/dist/core/improve-result.js +11 -1
  83. package/dist/core/mutation-target.js +2 -2
  84. package/dist/core/recognition-util.js +4 -5
  85. package/dist/core/warn.js +21 -4
  86. package/dist/core/write-source.js +3 -3
  87. package/dist/execution/target-ref.js +1 -2
  88. package/dist/indexer/search/db-search.js +4 -19
  89. package/dist/indexer/search/fts-query.js +0 -19
  90. package/dist/integrations/agent/engine-resolution.js +5 -2
  91. package/dist/integrations/agent/index.js +1 -1
  92. package/dist/integrations/agent/profiles.js +41 -98
  93. package/dist/integrations/agent/request-lowering.js +3 -3
  94. package/dist/integrations/harnesses/aider/index.js +5 -0
  95. package/dist/integrations/harnesses/amazonq/index.js +1 -0
  96. package/dist/integrations/harnesses/claude/config-import.js +2 -3
  97. package/dist/integrations/harnesses/claude/index.js +5 -0
  98. package/dist/integrations/harnesses/codex/index.js +1 -0
  99. package/dist/integrations/harnesses/copilot/index.js +1 -0
  100. package/dist/integrations/harnesses/gemini/index.js +1 -0
  101. package/dist/integrations/harnesses/index.js +18 -39
  102. package/dist/integrations/harnesses/opencode/agent-builder.js +60 -35
  103. package/dist/integrations/harnesses/opencode/config-import.js +121 -52
  104. package/dist/integrations/harnesses/opencode/index.js +22 -0
  105. package/dist/integrations/harnesses/opencode/plugin-layout.js +68 -0
  106. package/dist/integrations/harnesses/opencode/session-log-types.js +12 -0
  107. package/dist/integrations/harnesses/opencode/session-log-v1.js +72 -0
  108. package/dist/integrations/harnesses/opencode/session-log-v2.js +140 -0
  109. package/dist/integrations/harnesses/opencode/session-log.js +104 -115
  110. package/dist/integrations/harnesses/opencode/version.js +98 -0
  111. package/dist/integrations/harnesses/opencode-sdk/{harness.js → index.js} +5 -17
  112. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +105 -206
  113. package/dist/integrations/harnesses/opencode-sdk/v1-adapter.js +199 -0
  114. package/dist/integrations/harnesses/opencode-sdk/v2-adapter.js +228 -0
  115. package/dist/integrations/harnesses/opencode-sdk/wire.js +66 -0
  116. package/dist/integrations/harnesses/openhands/index.js +1 -0
  117. package/dist/integrations/harnesses/pi/index.js +1 -0
  118. package/dist/integrations/harnesses/shared.js +2 -0
  119. package/dist/integrations/harnesses/types.js +2 -0
  120. package/dist/llm/client.js +41 -11
  121. package/dist/output/cli-hints.js +1 -1
  122. package/dist/output/context.js +10 -19
  123. package/dist/output/format-exempt.js +5 -8
  124. package/dist/output/shapes/helpers.js +1 -22
  125. package/dist/output/shapes/passthrough.js +0 -1
  126. package/dist/output/shapes.js +3 -31
  127. package/dist/output/stdout.js +5 -1
  128. package/dist/output/text/command-format.js +6 -1
  129. package/dist/output/text/workflow-format.js +4 -22
  130. package/dist/scripts/akm-migrate-node.js +13049 -14013
  131. package/dist/scripts/akm-migrate.js +16316 -17276
  132. package/dist/setup/detect.js +10 -4
  133. package/dist/setup/harness-config-import.js +5 -14
  134. package/dist/setup/setup.js +1 -1
  135. package/dist/setup/steps/tasks.js +12 -13
  136. package/dist/storage/repositories/task-history-repository.js +0 -5
  137. package/dist/storage/repositories/workflow-runs-repository.js +5 -15
  138. package/dist/tasks/embedded.js +2 -1
  139. package/dist/tasks/run/task-history.js +0 -2
  140. package/dist/tasks/schedule-gates.js +39 -0
  141. package/dist/tasks/scheduler-binding.js +0 -16
  142. package/dist/tasks/scheduler-sync.js +3 -97
  143. package/dist/tasks/source/bounded-document.js +1 -1
  144. package/dist/tasks/source/task-source-v4.js +2 -12
  145. package/dist/tasks/task-run-reserved-flags.js +2 -31
  146. package/dist/workflows/authoring/authoring.js +6 -6
  147. package/dist/workflows/compile.js +8 -65
  148. package/dist/workflows/exec/child-workflow.js +22 -3
  149. package/dist/workflows/exec/native-executor.js +12 -147
  150. package/dist/workflows/exec/run-workflow.js +31 -103
  151. package/dist/workflows/exec/step-work.js +9 -178
  152. package/dist/workflows/exec/unit-dispatch.js +0 -10
  153. package/dist/workflows/freeze/environment.js +3 -44
  154. package/dist/workflows/freeze/freeze.js +8 -41
  155. package/dist/workflows/freeze/targets/child-workflow.js +27 -63
  156. package/dist/workflows/freeze/targets/command.js +2 -16
  157. package/dist/workflows/freeze/targets/shell.js +0 -2
  158. package/dist/workflows/freeze/task-bindings.js +2 -28
  159. package/dist/workflows/ir/params.js +12 -2
  160. package/dist/workflows/parser.js +82 -232
  161. package/dist/workflows/plan.js +1 -1
  162. package/dist/workflows/renderer.js +10 -19
  163. package/dist/workflows/runtime/run-plan.js +11 -53
  164. package/dist/workflows/runtime/runs.js +4 -27
  165. package/dist/workflows/source-files.js +12 -16
  166. package/dist/workflows/source-semantics.js +1 -93
  167. package/docs/README.md +1 -1
  168. package/docs/agents/README.md +3 -3
  169. package/docs/agents/agent-install.md +1 -1
  170. package/docs/architecture/adapters.md +17 -31
  171. package/docs/architecture/architecture.md +4 -5
  172. package/docs/architecture/improvement.md +52 -21
  173. package/docs/architecture/internals/improve-workflow.md +15 -8
  174. package/docs/architecture/internals/indexing.md +1 -1
  175. package/docs/architecture/internals/search.md +1 -2
  176. package/docs/architecture/internals/storage-locations.md +5 -5
  177. package/docs/architecture/persisted-data-compat.md +13 -4
  178. package/docs/architecture/specs/0.9.0-decisions.md +6 -2
  179. package/docs/architecture/specs/improve-collapse-churn-detector-design.md +2 -2
  180. package/docs/architecture/specs/workflow-format-unification.md +1 -6
  181. package/docs/architecture/testing/manual-testing-checklist.md +20 -29
  182. package/docs/architecture/testing/task-workflow-manual-tests.md +106 -203
  183. package/docs/architecture/testing/testing-workflow.md +1 -1
  184. package/docs/architecture/workflow-engine.md +5 -56
  185. package/docs/guides/author-workflows.md +39 -69
  186. package/docs/guides/capture-knowledge.md +1 -1
  187. package/docs/guides/claude-code-vs-akm-workflows.md +1 -2
  188. package/docs/guides/discover-and-load.md +4 -4
  189. package/docs/guides/getting-started.md +1 -1
  190. package/docs/guides/improve-the-library.md +7 -7
  191. package/docs/guides/recipes/headless-install.md +2 -2
  192. package/docs/guides/run-workflows.md +1 -1
  193. package/docs/guides/use-with-any-agent.md +49 -4
  194. package/docs/integration/bundling-akm.md +7 -6
  195. package/docs/maintainers/curate-workmap.md +1 -2
  196. package/docs/maintainers/release-checklist.md +30 -1
  197. package/docs/posts/akm-command-tour.md +3 -3
  198. package/docs/product-surface.md +1 -1
  199. package/docs/reference/README.md +1 -0
  200. package/docs/reference/api.md +65 -0
  201. package/docs/reference/asset-types.md +3 -5
  202. package/docs/reference/bundle-types.md +2 -4
  203. package/docs/reference/cli.md +129 -171
  204. package/docs/reference/configuration.md +84 -19
  205. package/docs/reference/data-and-telemetry.md +1 -1
  206. package/docs/reference/env-and-secrets.md +2 -2
  207. package/docs/reference/supported-formats.md +3 -4
  208. package/docs/reference/tasks.md +12 -19
  209. package/docs/reference/website-sources.md +1 -1
  210. package/docs/reference/workflow-schema.md +89 -317
  211. package/docs/reference/workflows.md +20 -48
  212. package/package.json +12 -2
  213. package/schemas/akm-config.json +2 -243
  214. package/schemas/akm-task.json +2 -3
  215. package/schemas/akm-workflow.json +47 -84
  216. package/dist/assets/improve-strategies/catchup.json +0 -41
  217. package/dist/assets/improve-strategies/proactive-maintenance.json +0 -24
  218. package/dist/assets/improve-strategies/quick.json +0 -17
  219. package/dist/assets/improve-strategies/reflect-distill.json +0 -29
  220. package/dist/assets/improve-strategies/thorough.json +0 -49
  221. package/dist/assets/tasks/improve/akm-improve-catchup.yml +0 -6
  222. package/dist/assets/tasks/improve/akm-improve-frequent.yml +0 -4
  223. package/dist/assets/tasks/improve/akm-improve-nightly.yml +0 -4
  224. package/dist/cli/retired-commands.js +0 -118
  225. package/dist/commands/tasks/validate.js +0 -176
  226. package/dist/core/config/legacy-source-shape-shim.js +0 -117
  227. package/dist/integrations/harnesses/ids.js +0 -28
  228. package/dist/tasks/source/task-source-v3-frozen.js +0 -424
  229. package/dist/tasks/source/task-to-v4.js +0 -863
  230. package/dist/workflows/exec/worktree.js +0 -372
  231. package/dist/workflows/freeze/child-output-references.js +0 -83
  232. package/dist/workflows/freeze/identity.js +0 -22
  233. package/dist/workflows/freeze/targets/script.js +0 -50
  234. package/dist/workflows/freeze/targets/task.js +0 -124
  235. package/dist/workflows/github-yaml.js +0 -506
  236. package/dist/workflows/runtime/run-outputs.js +0 -80
@@ -4,7 +4,8 @@
4
4
  /**
5
5
  * Process-level output mode singleton.
6
6
  *
7
- * Output mode (format + detail + shape) is parsed once at startup from
7
+ * Output mode (format + detail, and the agent projection `--detail agent`
8
+ * selects) is parsed once at startup from
8
9
  * `process.argv` and the persisted user config. All subsequent `output()`
9
10
  * calls read from this in-memory singleton instead of re-scanning argv and
10
11
  * re-loading config on every call.
@@ -15,8 +16,7 @@
15
16
  */
16
17
  import { UsageError } from "../core/errors.js";
17
18
  const OUTPUT_FORMATS = ["json", "yaml", "text", "jsonl", "md", "html"];
18
- const DETAIL_LEVELS = ["brief", "normal", "full"];
19
- const SHAPE_MODES = ["human", "agent", "summary"];
19
+ const DETAIL_VALUES = ["brief", "normal", "full", "agent"];
20
20
  function parseOutputFormat(value) {
21
21
  if (!value)
22
22
  return undefined;
@@ -27,16 +27,9 @@ function parseOutputFormat(value) {
27
27
  export function parseDetailLevel(value) {
28
28
  if (!value)
29
29
  return undefined;
30
- if (DETAIL_LEVELS.includes(value))
30
+ if (DETAIL_VALUES.includes(value))
31
31
  return value;
32
- throw new UsageError(`Invalid value for --detail: ${value}. Expected one of: ${DETAIL_LEVELS.join("|")}`, "INVALID_DETAIL_VALUE");
33
- }
34
- function parseShapeMode(value) {
35
- if (!value)
36
- return undefined;
37
- if (SHAPE_MODES.includes(value))
38
- return value;
39
- throw new UsageError(`Invalid value for --shape: ${value}. Expected one of: ${SHAPE_MODES.join("|")}`, "INVALID_SHAPE_VALUE");
32
+ throw new UsageError(`Invalid value for --detail: ${value}. Expected one of: ${DETAIL_VALUES.join("|")}`, "INVALID_DETAIL_VALUE");
40
33
  }
41
34
  export function parseFlagValue(argv, flag) {
42
35
  for (let i = 0; i < argv.length; i++) {
@@ -88,13 +81,11 @@ export function getHyphenatedBoolean(args, key) {
88
81
  */
89
82
  export function resolveOutputMode(argv, defaults = {}) {
90
83
  const format = parseOutputFormat(parseFlagValue(argv, "--format")) ?? defaults?.format ?? "json";
91
- const rawDetail = parseFlagValue(argv, "--detail");
92
- const rawShape = parseFlagValue(argv, "--shape");
93
- // `--detail` is verbosity only (brief|normal|full); the projection presets
94
- // (`summary`/`agent`) and the `--for-agent` boolean were removed in 0.9.0 —
95
- // use `--shape`. Unknown `--detail` values fall through to the default.
96
- const detail = parseDetailLevel(rawDetail) ?? defaults?.detail ?? "brief";
97
- const shape = parseShapeMode(rawShape) ?? "human";
84
+ // `--detail agent` selects the agent projection; the verbosity then stays at
85
+ // the configured default (the projection ignores it).
86
+ const parsedDetail = parseDetailLevel(parseFlagValue(argv, "--detail"));
87
+ const shape = parsedDetail === "agent" ? "agent" : "human";
88
+ const detail = (parsedDetail === "agent" ? undefined : parsedDetail) ?? defaults?.detail ?? "brief";
98
89
  const outputPath = parseFlagValue(argv, "--output");
99
90
  return { format, detail, shape, ...(outputPath ? { outputPath } : {}) };
100
91
  }
@@ -35,12 +35,11 @@ const EXEMPT_COMMANDS = new Set([
35
35
  // progress-event lines the child prints during a real `apply` still print
36
36
  // verbatim ahead of the formatted result — those are operational logging,
37
37
  // not part of the result envelope, the same way a progress spinner would be.
38
- // Document payload group: bare `help` prints the sectioned overview,
39
- // `help migrate <version>` prints release notes, and `help agents` prints
40
- // the embedded CLI-reference guide (`src/output/cli-hints.ts`) — none of
41
- // the three render a result envelope.
38
+ // Document payload group: bare `help` prints the sectioned overview and
39
+ // `help migrate <version>` prints release notes — neither renders a result
40
+ // envelope.
42
41
  "help",
43
- // Embedded agent guide document.
42
+ // Embedded agent guide document (`src/output/cli-hints.ts`).
44
43
  "hints",
45
44
  ]);
46
45
  /**
@@ -57,9 +56,7 @@ const EXEMPT_SUBCOMMANDS = new Set([
57
56
  // envelope. Wrapping it broke every existing substitution silently: the
58
57
  // CLI's default format is `json`, so an un-flagged `akm env path <ref>`
59
58
  // (exactly how the substitution is always written) started emitting
60
- // `{"path":"..."}` instead of the raw path. Unlike `config path`, this
61
- // command has no `--all`-style multi-field variant, so the whole surface
62
- // can be exempt without wrongly warning on a real envelope case.
59
+ // `{"path":"..."}` instead of the raw path.
63
60
  "env path",
64
61
  ]);
65
62
  /**
@@ -310,7 +310,7 @@ export function shapeSearchHit(hit, detail) {
310
310
  }
311
311
  // Stash hit (local or remote)
312
312
  // `ref` is included at `brief` so agents can run `akm show <ref>` without
313
- // needing --detail full or --shape agent (REC-03).
313
+ // needing --detail full or --detail agent (REC-03).
314
314
  if (detail === "brief") {
315
315
  return pickFields(hit, ["type", "name", "ref", "action", "estimatedTokens", "keys"]);
316
316
  }
@@ -393,27 +393,6 @@ export function shapeShowOutput(result, detail, shape = "human") {
393
393
  delete shaped.editHint;
394
394
  return shaped;
395
395
  }
396
- if (shape === "summary") {
397
- return pickFields(result, [
398
- "type",
399
- "name",
400
- // ref is present on every show shape (human/summary/agent) — it is the
401
- // canonical identity of the asset, not an agent-only convenience field
402
- // (R-020).
403
- "ref",
404
- "description",
405
- "tags",
406
- "parameters",
407
- "workflowTitle",
408
- "action",
409
- "run",
410
- "origin",
411
- "keys",
412
- "links",
413
- ...FRAGMENT_PROVENANCE_FIELDS,
414
- ...FRAGMENT_CONTEXT_FIELDS,
415
- ]);
416
- }
417
396
  const base = pickFields(result, [
418
397
  "type",
419
398
  "name",
@@ -75,7 +75,6 @@ const PASSTHROUGH_COMMANDS = [
75
75
  "task-run",
76
76
  "task-sync",
77
77
  "task-sync-dry-run",
78
- "task-validate",
79
78
  "update",
80
79
  "upgrade",
81
80
  "workflow-abandon",
@@ -1,23 +1,6 @@
1
1
  // This Source Code Form is subject to the terms of the Mozilla Public
2
2
  // License, v. 2.0. If a copy of the MPL was not distributed with this
3
3
  // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
- /**
5
- * Pure shaping functions that select and trim fields from command result
6
- * objects according to the active detail level / agent mode.
7
- *
8
- * Every function in this module is side-effect free and operates on plain
9
- * `Record<string, unknown>` shapes, which makes them trivial to unit test.
10
- *
11
- * Output shapes are assembled EXPLICITLY here: each per-command module under
12
- * `src/output/shapes/` EXPORTS a pure `OutputShapeEntry[]` (no top-level
13
- * side effect), and this barrel imports those exports and registers them in a
14
- * single deterministic, order-independent pass (`BUILT_IN_OUTPUT_SHAPES`).
15
- * Dropping a module from the assembly array is a COMPILE error, not a silent
16
- * runtime gap. The central `shapeForCommand` dispatcher looks up the registry
17
- * and throws for unknown commands (v1 spec §9 — exhaustive registry, no silent
18
- * fallback).
19
- */
20
- import { warnOnce } from "../core/warn.js";
21
4
  import { curateShapes } from "./shapes/curate.js";
22
5
  import { envListShapes } from "./shapes/env-list.js";
23
6
  import { eventsShapes } from "./shapes/events.js";
@@ -64,12 +47,6 @@ const BUILT_IN_OUTPUT_SHAPES = [
64
47
  ...passthroughShapes,
65
48
  ];
66
49
  registerOutputShapes(BUILT_IN_OUTPUT_SHAPES);
67
- /**
68
- * Commands whose shape handler implements the `summary` projection. For every
69
- * other command, `--shape summary` is a usage error (v1 §5 — honest rejection
70
- * for a soon-frozen contract, not a silent fallback to `human`).
71
- */
72
- const SHAPE_SUMMARY_COMMANDS = new Set(["show"]);
73
50
  // ── `results` collection alias ──────────────────────────────────────────────
74
51
  //
75
52
  // Every list-returning command names its collection differently (`hits`,
@@ -80,8 +57,8 @@ const SHAPE_SUMMARY_COMMANDS = new Set(["show"]);
80
57
  //
81
58
  // This maps each list-returning command to the field already holding its
82
59
  // collection, and `withResultsAlias` below adds a `results` key pointing at
83
- // that SAME array (not a copy) to the shaped output — in every `--shape` /
84
- // `--detail` combination, `human` included, so `--shape agent` needs no
60
+ // that SAME array (not a copy) to the shaped output — in every
61
+ // `--detail` combination, `agent` included, so `--detail agent` needs no
85
62
  // separate handling to "guarantee" it. A new list-returning command MUST add
86
63
  // an entry here; there is no way to detect a missed one automatically, so the
87
64
  // survey deliberately lives in this one place rather than scattered per
@@ -118,14 +95,9 @@ function withResultsAlias(command, shaped) {
118
95
  return { ...obj, results: collection };
119
96
  }
120
97
  export function shapeForCommand(command, result, detail, shape = "human") {
121
- let effectiveShape = shape;
122
- if (shape === "summary" && !SHAPE_SUMMARY_COMMANDS.has(command)) {
123
- warnOnce(`shape-summary-unsupported:${command}`, `[output] '--shape summary' is not supported for 'akm ${command}' (only 'akm show' has a summary projection); falling back to 'agent'.`);
124
- effectiveShape = "agent";
125
- }
126
98
  const handler = getOutputShapeHandler(command);
127
99
  if (handler) {
128
- return withResultsAlias(command, handler(result, detail, effectiveShape));
100
+ return withResultsAlias(command, handler(result, detail, shape));
129
101
  }
130
102
  // v1 spec §9 (output-shape registry exhaustive): no silent JSON.stringify
131
103
  // fallback. A missing case here is a registration bug — fail loudly so
@@ -20,5 +20,9 @@
20
20
  * `tests/integration/output-baseline.test.ts` pins the bytes either way.
21
21
  */
22
22
  export function writeStdout(document) {
23
- process.stdout.write(`${document}\n`);
23
+ process.stdout.write(stdoutText(document));
24
+ }
25
+ /** The exact bytes {@link writeStdout} writes for `document`; in-process callers return this instead of writing. */
26
+ export function stdoutText(document) {
27
+ return `${document}\n`;
24
28
  }
@@ -662,7 +662,12 @@ export function formatUpdatePlain(r) {
662
662
  }
663
663
  return lines.length > 0 ? lines.join("\n") : `update: nothing to update`;
664
664
  }
665
- const HARNESS_LABELS = { "claude-code": "Claude Code", codex: "Codex", opencode: "OpenCode" };
665
+ const HARNESS_LABELS = {
666
+ "claude-code": "Claude Code",
667
+ codex: "Codex",
668
+ opencode: "OpenCode",
669
+ "opencode-v2": "OpenCode 2",
670
+ };
666
671
  /** The plugin lines worth printing: nothing for a plugin that is current or has no plugin to update. */
667
672
  function formatUpgradePluginLines(r) {
668
673
  const lines = [];
@@ -235,8 +235,7 @@ function formatInputBindingsList(bindings) {
235
235
  * expansion's own steps, recursively, indented one level per composition
236
236
  * boundary. A child step also carries the child's `planHash` on the step
237
237
  * line itself, and (when present) a `with:` line for the step's own
238
- * `inputBindings[]` and an `exports:` line for the child's declared output
239
- * names — §4.6's worked example.
238
+ * `inputBindings[]` — §4.6's worked example.
240
239
  */
241
240
  function renderPlanStepLines(step, ordinal, lines, prefix = " ") {
242
241
  const stepId = typeof step.stepId === "string" ? step.stepId : "unknown";
@@ -244,11 +243,9 @@ function renderPlanStepLines(step, ordinal, lines, prefix = " ") {
244
243
  const expansion = typeof step.expansion === "object" && step.expansion !== null ? step.expansion : {};
245
244
  const via = typeof expansion.via === "string" ? expansion.via : "direct";
246
245
  const childPlanHash = typeof expansion.childPlanHash === "string" ? expansion.childPlanHash : undefined;
247
- const viaText = via === "task"
248
- ? `via ${String(expansion.taskRef ?? "")}`
249
- : via === "child"
250
- ? `-> ${String(expansion.childRef ?? "")}${childPlanHash ? ` (plan ${childPlanHash})` : ""}`
251
- : "direct";
246
+ const viaText = via === "child"
247
+ ? `-> ${String(expansion.childRef ?? "")}${childPlanHash ? ` (plan ${childPlanHash})` : ""}`
248
+ : "direct";
252
249
  lines.push(`${prefix}${ordinal}. ${stepId} ${targetKind} ${viaText}`.replace(/ +/g, " ").trimEnd());
253
250
  const detailPrefix = `${prefix} `;
254
251
  const inputBindings = Array.isArray(step.inputBindings) ? step.inputBindings : [];
@@ -256,10 +253,6 @@ function renderPlanStepLines(step, ordinal, lines, prefix = " ") {
256
253
  lines.push(`${detailPrefix}with: ${formatInputBindingsList(inputBindings)}`);
257
254
  }
258
255
  if (via === "child") {
259
- const childOutputs = Array.isArray(expansion.childOutputs) ? expansion.childOutputs : [];
260
- if (childOutputs.length > 0) {
261
- lines.push(`${detailPrefix}exports: ${childOutputs.map(String).join(", ")}`);
262
- }
263
256
  const childSteps = Array.isArray(expansion.steps) ? expansion.steps : [];
264
257
  for (const [index, childStep] of childSteps.entries()) {
265
258
  renderPlanStepLines(childStep, index + 1, lines, `${prefix} ${ordinal}.`);
@@ -304,17 +297,6 @@ export function formatWorkflowPlanPlain(result) {
304
297
  const params = Array.isArray(result.params) ? result.params : undefined;
305
298
  if (params && params.length > 0)
306
299
  lines.push(`params: ${params.join(", ")}`);
307
- const outputs = typeof result.outputs === "object" && result.outputs !== null
308
- ? result.outputs
309
- : undefined;
310
- if (outputs) {
311
- for (const [name, declaration] of Object.entries(outputs)) {
312
- const from = typeof declaration === "object" && declaration !== null
313
- ? String(declaration.from ?? "")
314
- : "";
315
- lines.push(`outputs: ${name} <- ${from}`);
316
- }
317
- }
318
300
  const steps = Array.isArray(result.steps) ? result.steps : [];
319
301
  lines.push("steps:");
320
302
  for (const [index, step] of steps.entries()) {