akm-cli 0.9.31 → 0.10.261002-beta

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 (270) hide show
  1. package/CHANGELOG.md +420 -0
  2. package/STABILITY.md +99 -57
  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 +15 -29
  7. package/dist/assets/hints/cli-hints-short.md +2 -2
  8. package/dist/assets/improve-strategies/default.json +3 -3
  9. package/dist/assets/prompts/consolidate-pair.md +9 -7
  10. package/dist/assets/stash-skeleton/README.md +1 -1
  11. package/dist/assets/tasks/improve/akm-improve-consolidate.yml +1 -1
  12. package/dist/cli/shared.js +31 -48
  13. package/dist/cli/unknown-flags.js +6 -43
  14. package/dist/cli.js +8 -34
  15. package/dist/commands/agent/contribute-cli.js +1 -1
  16. package/dist/commands/completions.js +1 -2
  17. package/dist/commands/config-cli.js +5 -28
  18. package/dist/commands/env/env-cli.js +5 -5
  19. package/dist/commands/env/secret-cli.js +2 -2
  20. package/dist/commands/feedback-cli.js +75 -49
  21. package/dist/commands/health/checks.js +41 -16
  22. package/dist/commands/health/plugin-staleness.js +52 -22
  23. package/dist/commands/improve/autonomy-gate.js +5 -3
  24. package/dist/commands/improve/consolidate/chunking.js +3 -10
  25. package/dist/commands/improve/consolidate/continuity-check.js +4 -4
  26. package/dist/commands/improve/consolidate/pair-pass.js +29 -10
  27. package/dist/commands/improve/consolidate.js +10 -65
  28. package/dist/commands/improve/distill/lesson-update.js +91 -0
  29. package/dist/commands/improve/distill-guards.js +1 -43
  30. package/dist/commands/improve/distill.js +148 -21
  31. package/dist/commands/improve/eligibility.js +14 -1
  32. package/dist/commands/improve/extract-cli.js +1 -1
  33. package/dist/commands/improve/extract-prompt.js +17 -7
  34. package/dist/commands/improve/extract.js +5 -7
  35. package/dist/commands/improve/improve-cli.js +92 -106
  36. package/dist/commands/improve/improve-strategies.js +8 -12
  37. package/dist/commands/improve/improve.js +134 -52
  38. package/dist/commands/improve/loop-stages.js +18 -5
  39. package/dist/commands/improve/planner.js +0 -1
  40. package/dist/commands/improve/preparation.js +40 -99
  41. package/dist/commands/improve/proactive-maintenance.js +2 -2
  42. package/dist/commands/improve/reflect-noise.js +3 -55
  43. package/dist/commands/improve/reflect.js +29 -34
  44. package/dist/commands/improve/retrieval-queries.js +37 -0
  45. package/dist/commands/improve/retrieval-scope.js +2 -2
  46. package/dist/commands/improve/salience.js +2 -9
  47. package/dist/commands/improve/session-asset.js +4 -1
  48. package/dist/commands/improve/stage.js +23 -12
  49. package/dist/commands/lint/index.js +5 -20
  50. package/dist/commands/observability-cli.js +3 -9
  51. package/dist/commands/proposal/drain.js +43 -6
  52. package/dist/commands/proposal/proposal-cli.js +11 -31
  53. package/dist/commands/proposal/repository.js +20 -14
  54. package/dist/commands/proposal/validators/proposal-quality-validators.js +0 -3
  55. package/dist/commands/read/knowledge.js +3 -3
  56. package/dist/commands/read/remember-cli.js +0 -13
  57. package/dist/commands/read/search-cli.js +29 -97
  58. package/dist/commands/read/search.js +0 -11
  59. package/dist/commands/read/show.js +0 -19
  60. package/dist/commands/sources/plugin-upgrade.js +164 -101
  61. package/dist/commands/sources/sources-cli.js +1 -15
  62. package/dist/commands/sources/stash-cli.js +6 -14
  63. package/dist/commands/tasks/tasks-cli.js +4 -115
  64. package/dist/commands/workflow/plan.js +11 -33
  65. package/dist/commands/workflow-cli.js +2 -7
  66. package/dist/core/adapter/adapter-ids.js +1 -2
  67. package/dist/core/adapter/adapters/agent-skills-adapter.js +0 -4
  68. package/dist/core/adapter/adapters/akm-adapter.js +9 -48
  69. package/dist/core/adapter/adapters/akm-lint.js +10 -26
  70. package/dist/core/adapter/adapters/akm-metadata.js +2 -72
  71. package/dist/core/adapter/adapters/akm-task-adapter.js +0 -5
  72. package/dist/core/adapter/adapters/akm-workflow-adapter.js +9 -28
  73. package/dist/core/adapter/adapters/dotenv-adapter.js +1 -20
  74. package/dist/core/adapter/adapters/generic-files-adapter.js +0 -10
  75. package/dist/core/adapter/adapters/llm-wiki-adapter.js +0 -4
  76. package/dist/core/adapter/adapters/tool-dir-shared.js +0 -24
  77. package/dist/core/adapter/adapters/website-snapshot-adapter.js +4 -4
  78. package/dist/core/adapter/recognize-match.js +3 -4
  79. package/dist/core/common.js +18 -2
  80. package/dist/core/config/config-schema.js +12 -15
  81. package/dist/core/config/config-types.js +6 -15
  82. package/dist/core/config/config-walker.js +6 -23
  83. package/dist/core/config/config.js +17 -80
  84. package/dist/core/config/engine-semantics.js +7 -3
  85. package/dist/core/config/schema/engines.js +7 -7
  86. package/dist/core/config/schema/improve-processes.js +10 -63
  87. package/dist/core/config/schema/improve.js +2 -21
  88. package/dist/core/config/schema/index-config.js +6 -39
  89. package/dist/core/env-secret-ref.js +2 -45
  90. package/dist/core/errors.js +1 -2
  91. package/dist/core/extra-params.js +2 -86
  92. package/dist/core/file-lock.js +2 -6
  93. package/dist/core/improve-result.js +13 -1
  94. package/dist/core/mutation-target.js +2 -2
  95. package/dist/core/paths.js +4 -0
  96. package/dist/core/recognition-util.js +4 -5
  97. package/dist/core/run-lock.js +1 -1
  98. package/dist/core/subprocess.js +49 -0
  99. package/dist/core/warn.js +21 -4
  100. package/dist/core/write-source.js +3 -3
  101. package/dist/execution/target-ref.js +1 -2
  102. package/dist/indexer/indexer.js +15 -6
  103. package/dist/indexer/passes/memory-inference.js +15 -6
  104. package/dist/indexer/search/db-search.js +49 -36
  105. package/dist/indexer/search/fts-query.js +0 -19
  106. package/dist/indexer/search/ranking.js +29 -1
  107. package/dist/indexer/usage/usage-events.js +21 -16
  108. package/dist/integrations/agent/engine-resolution.js +5 -2
  109. package/dist/integrations/agent/index.js +1 -1
  110. package/dist/integrations/agent/profiles.js +41 -98
  111. package/dist/integrations/agent/request-lowering.js +3 -3
  112. package/dist/integrations/harnesses/aider/index.js +5 -0
  113. package/dist/integrations/harnesses/amazonq/index.js +1 -0
  114. package/dist/integrations/harnesses/claude/config-import.js +2 -3
  115. package/dist/integrations/harnesses/claude/index.js +5 -0
  116. package/dist/integrations/harnesses/codex/index.js +1 -0
  117. package/dist/integrations/harnesses/copilot/index.js +1 -0
  118. package/dist/integrations/harnesses/gemini/index.js +1 -0
  119. package/dist/integrations/harnesses/index.js +18 -39
  120. package/dist/integrations/harnesses/opencode/agent-builder.js +60 -35
  121. package/dist/integrations/harnesses/opencode/config-import.js +121 -52
  122. package/dist/integrations/harnesses/opencode/index.js +22 -0
  123. package/dist/integrations/harnesses/opencode/plugin-layout.js +68 -0
  124. package/dist/integrations/harnesses/opencode/session-log-types.js +12 -0
  125. package/dist/integrations/harnesses/opencode/session-log-v1.js +72 -0
  126. package/dist/integrations/harnesses/opencode/session-log-v2.js +140 -0
  127. package/dist/integrations/harnesses/opencode/session-log.js +104 -115
  128. package/dist/integrations/harnesses/opencode/version.js +98 -0
  129. package/dist/integrations/harnesses/opencode-sdk/{harness.js → index.js} +5 -17
  130. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +105 -206
  131. package/dist/integrations/harnesses/opencode-sdk/v1-adapter.js +199 -0
  132. package/dist/integrations/harnesses/opencode-sdk/v2-adapter.js +254 -0
  133. package/dist/integrations/harnesses/opencode-sdk/wire.js +66 -0
  134. package/dist/integrations/harnesses/openhands/index.js +1 -0
  135. package/dist/integrations/harnesses/pi/index.js +1 -0
  136. package/dist/integrations/harnesses/shared.js +2 -0
  137. package/dist/integrations/harnesses/types.js +2 -0
  138. package/dist/llm/client.js +41 -11
  139. package/dist/output/cli-hints.js +1 -1
  140. package/dist/output/context.js +10 -19
  141. package/dist/output/format-exempt.js +5 -8
  142. package/dist/output/shapes/helpers.js +1 -22
  143. package/dist/output/shapes/passthrough.js +0 -1
  144. package/dist/output/shapes.js +3 -31
  145. package/dist/output/stdout.js +5 -1
  146. package/dist/output/text/command-format.js +6 -1
  147. package/dist/output/text/workflow-format.js +4 -22
  148. package/dist/scripts/akm-migrate-node.js +15745 -16711
  149. package/dist/scripts/akm-migrate.js +16318 -17280
  150. package/dist/setup/detect.js +10 -4
  151. package/dist/setup/harness-config-import.js +5 -14
  152. package/dist/setup/setup.js +1 -1
  153. package/dist/setup/steps/tasks.js +12 -13
  154. package/dist/sources/providers/git-stash.js +113 -16
  155. package/dist/storage/repositories/index-utility-repository.js +2 -32
  156. package/dist/storage/repositories/index-vec-repository.js +4 -0
  157. package/dist/storage/repositories/task-history-repository.js +0 -5
  158. package/dist/storage/repositories/workflow-runs-repository.js +5 -15
  159. package/dist/tasks/embedded.js +2 -1
  160. package/dist/tasks/run/run-command-task.js +9 -1
  161. package/dist/tasks/run/run-workflow-task.js +4 -3
  162. package/dist/tasks/run/task-history.js +0 -2
  163. package/dist/tasks/run/task-log.js +38 -1
  164. package/dist/tasks/schedule-gates.js +39 -0
  165. package/dist/tasks/scheduler-binding.js +0 -16
  166. package/dist/tasks/scheduler-sync.js +3 -97
  167. package/dist/tasks/source/bounded-document.js +1 -1
  168. package/dist/tasks/source/task-source-v4.js +2 -12
  169. package/dist/tasks/task-run-reserved-flags.js +2 -31
  170. package/dist/workflows/authoring/authoring.js +6 -6
  171. package/dist/workflows/compile.js +8 -65
  172. package/dist/workflows/exec/child-workflow.js +22 -3
  173. package/dist/workflows/exec/native-executor.js +12 -147
  174. package/dist/workflows/exec/run-workflow.js +31 -103
  175. package/dist/workflows/exec/step-work.js +9 -178
  176. package/dist/workflows/exec/unit-dispatch.js +0 -10
  177. package/dist/workflows/freeze/environment.js +3 -44
  178. package/dist/workflows/freeze/freeze.js +8 -41
  179. package/dist/workflows/freeze/targets/child-workflow.js +27 -63
  180. package/dist/workflows/freeze/targets/command.js +2 -16
  181. package/dist/workflows/freeze/targets/shell.js +0 -2
  182. package/dist/workflows/freeze/task-bindings.js +2 -28
  183. package/dist/workflows/ir/params.js +12 -2
  184. package/dist/workflows/parser.js +82 -232
  185. package/dist/workflows/plan.js +1 -1
  186. package/dist/workflows/renderer.js +10 -19
  187. package/dist/workflows/runtime/run-plan.js +11 -53
  188. package/dist/workflows/runtime/runs.js +4 -27
  189. package/dist/workflows/source-files.js +12 -16
  190. package/dist/workflows/source-semantics.js +1 -93
  191. package/docs/README.md +1 -1
  192. package/docs/agents/README.md +3 -3
  193. package/docs/agents/agent-install.md +1 -1
  194. package/docs/architecture/0.10-process-rules.md +827 -0
  195. package/docs/architecture/adapters.md +17 -31
  196. package/docs/architecture/architecture.md +4 -5
  197. package/docs/architecture/improvement.md +115 -76
  198. package/docs/architecture/internals/improve-workflow.md +22 -16
  199. package/docs/architecture/internals/indexing.md +1 -1
  200. package/docs/architecture/internals/search.md +1 -2
  201. package/docs/architecture/internals/storage-locations.md +6 -6
  202. package/docs/architecture/persisted-data-compat.md +13 -4
  203. package/docs/architecture/specs/0.9.0-decisions.md +6 -2
  204. package/docs/architecture/specs/improve-collapse-churn-detector-design.md +2 -2
  205. package/docs/architecture/specs/workflow-format-unification.md +1 -6
  206. package/docs/architecture/testing/manual-testing-checklist.md +21 -30
  207. package/docs/architecture/testing/task-workflow-manual-tests.md +106 -203
  208. package/docs/architecture/testing/testing-workflow.md +1 -1
  209. package/docs/architecture/workflow-engine.md +5 -56
  210. package/docs/guides/author-workflows.md +39 -69
  211. package/docs/guides/bundles.md +3 -1
  212. package/docs/guides/capture-knowledge.md +1 -1
  213. package/docs/guides/claude-code-vs-akm-workflows.md +1 -2
  214. package/docs/guides/discover-and-load.md +4 -4
  215. package/docs/guides/getting-started.md +1 -1
  216. package/docs/guides/improve-the-library.md +10 -9
  217. package/docs/guides/recipes/headless-install.md +2 -2
  218. package/docs/guides/run-workflows.md +1 -1
  219. package/docs/guides/scheduling.md +9 -1
  220. package/docs/guides/use-with-any-agent.md +49 -4
  221. package/docs/integration/bundling-akm.md +7 -6
  222. package/docs/maintainers/curate-workmap.md +1 -2
  223. package/docs/maintainers/release-checklist.md +33 -1
  224. package/docs/migration/README.md +2 -0
  225. package/docs/migration/release-notes/0.10.0.md +201 -0
  226. package/docs/migration/release-notes/README.md +1 -0
  227. package/docs/migration/v0.9-to-v0.10.md +507 -0
  228. package/docs/posts/akm-command-tour.md +3 -3
  229. package/docs/product-surface.md +1 -1
  230. package/docs/reference/README.md +1 -0
  231. package/docs/reference/api.md +65 -0
  232. package/docs/reference/asset-types.md +3 -5
  233. package/docs/reference/bundle-types.md +2 -4
  234. package/docs/reference/cli.md +160 -188
  235. package/docs/reference/configuration.md +101 -20
  236. package/docs/reference/data-and-telemetry.md +2 -2
  237. package/docs/reference/env-and-secrets.md +2 -2
  238. package/docs/reference/supported-formats.md +3 -4
  239. package/docs/reference/tasks.md +12 -19
  240. package/docs/reference/website-sources.md +1 -1
  241. package/docs/reference/workflow-schema.md +89 -317
  242. package/docs/reference/workflows.md +20 -48
  243. package/package.json +12 -2
  244. package/schemas/akm-config.json +2 -243
  245. package/schemas/akm-task.json +2 -3
  246. package/schemas/akm-workflow.json +47 -84
  247. package/dist/assets/improve-strategies/catchup.json +0 -41
  248. package/dist/assets/improve-strategies/proactive-maintenance.json +0 -24
  249. package/dist/assets/improve-strategies/quick.json +0 -17
  250. package/dist/assets/improve-strategies/reflect-distill.json +0 -29
  251. package/dist/assets/improve-strategies/thorough.json +0 -49
  252. package/dist/assets/prompts/retrieval-relevance-judge.md +0 -6
  253. package/dist/assets/tasks/improve/akm-improve-catchup.yml +0 -6
  254. package/dist/assets/tasks/improve/akm-improve-frequent.yml +0 -4
  255. package/dist/assets/tasks/improve/akm-improve-nightly.yml +0 -4
  256. package/dist/cli/retired-commands.js +0 -118
  257. package/dist/commands/improve/retrieval-gate.js +0 -132
  258. package/dist/commands/tasks/validate.js +0 -176
  259. package/dist/core/config/legacy-source-shape-shim.js +0 -117
  260. package/dist/indexer/feedback/utility-policy.js +0 -75
  261. package/dist/integrations/harnesses/ids.js +0 -28
  262. package/dist/tasks/source/task-source-v3-frozen.js +0 -424
  263. package/dist/tasks/source/task-to-v4.js +0 -863
  264. package/dist/workflows/exec/worktree.js +0 -372
  265. package/dist/workflows/freeze/child-output-references.js +0 -83
  266. package/dist/workflows/freeze/identity.js +0 -22
  267. package/dist/workflows/freeze/targets/script.js +0 -50
  268. package/dist/workflows/freeze/targets/task.js +0 -124
  269. package/dist/workflows/github-yaml.js +0 -506
  270. package/dist/workflows/runtime/run-outputs.js +0 -80
@@ -1,7 +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
- import { getParsedInvocation } from "../../cli/invocation.js";
5
4
  import { getStringArg } from "../../cli/parse-args.js";
6
5
  import { defineJsonCommand, output, parseAllFlagValues } from "../../cli/shared.js";
7
6
  import { UsageError } from "../../core/errors.js";
@@ -35,17 +34,6 @@ async function fetchSimilarMemories(query, excludeRef, eventSource) {
35
34
  }
36
35
  /** The flag `remember` takes for its destination, as its errors spell it. */
37
36
  const TARGET_FLAG = "--bundle";
38
- /**
39
- * `--target` was renamed to `--bundle` on `remember` in 0.9 (S8). citty is
40
- * non-strict, so the retired spelling is silently absorbed rather than
41
- * rejected — the memory then lands in the default bundle instead of the one
42
- * the caller named, with exit 0 and no error. Reject it explicitly instead.
43
- */
44
- function rejectRetiredTargetFlag() {
45
- if (!getParsedInvocation().hasFlag("--target"))
46
- return;
47
- throw new UsageError("`akm remember --target` was renamed to `--bundle` in 0.9. Use `--bundle <name>` instead.", "INVALID_FLAG_VALUE");
48
- }
49
37
  // ── Command definition ────────────────────────────────────────────────────────
50
38
  export const rememberCommand = defineJsonCommand({
51
39
  meta: {
@@ -140,7 +128,6 @@ export const rememberCommand = defineJsonCommand({
140
128
  },
141
129
  },
142
130
  async run({ args }) {
143
- rejectRetiredTargetFlag();
144
131
  const body = readMemoryContent(args.content);
145
132
  const eventSource = resolveUsageEventSource();
146
133
  // `--name` is a flat name; subdirectory placement is `--path`'s job.
@@ -24,24 +24,6 @@ import { deliverRendered } from "../../output/html-render.js";
24
24
  import { akmCurate, packCuratedHits } from "./curate.js";
25
25
  import { akmSearch, parseBeliefFilterMode, parseScopeFilterFlags, parseSearchSource } from "./search.js";
26
26
  import { akmShowUnified } from "./show.js";
27
- /**
28
- * `--source` was renamed to `--from` on `search`/`curate` in 0.9 (S8). citty
29
- * is non-strict, so the retired spelling is silently absorbed rather than
30
- * rejected — the command then runs against the DEFAULT `--from` value
31
- * (local) instead of the source the caller named, with exit 0 and no error.
32
- * Reject it explicitly instead.
33
- *
34
- * Exported so `akm task list` (`../tasks/tasks-cli.ts`, #951) — a pure
35
- * delegating alias for `akm search --type task` — applies the identical
36
- * guard rather than a second copy of it; a task-list-scoped `--source` must
37
- * fail exactly like `search`'s does, not fall through to citty's silent
38
- * unknown-flag absorption.
39
- */
40
- export function rejectRetiredSourceFlag() {
41
- if (!getParsedInvocation().hasFlag("--source"))
42
- return;
43
- throw new UsageError("`--source` was renamed to `--from` in 0.9. Use `--from local|registry|all` instead.", "INVALID_FLAG_VALUE");
44
- }
45
27
  export const searchCommand = defineJsonCommand({
46
28
  meta: { name: "search", description: "Search the bundle" },
47
29
  args: {
@@ -83,7 +65,6 @@ export const searchCommand = defineJsonCommand({
83
65
  },
84
66
  },
85
67
  async run({ args }) {
86
- rejectRetiredSourceFlag();
87
68
  const query = (args.query ?? "").trim();
88
69
  const type = args.type;
89
70
  const limit = parsePositiveIntFlag(args.limit ?? undefined);
@@ -140,24 +121,9 @@ export const curateCommand = defineJsonCommand({
140
121
  },
141
122
  },
142
123
  async run({ args }) {
143
- rejectRetiredSourceFlag();
144
- if (!args.query || !String(args.query).trim()) {
145
- throw new UsageError('A curate query is required. Usage: akm curate "<task or prompt>" [--type <type>] [--limit <n>]', "MISSING_REQUIRED_ARGUMENT", 'Describe the task you want assets for, e.g. `akm curate "deploy to prod"`.');
146
- }
147
- const type = args.type;
148
- const limitParsed = parsePositiveIntFlag(args.limit ?? undefined);
149
- const limit = limitParsed && limitParsed > 0 ? limitParsed : 4;
150
- const source = parseSearchSource(args.from ?? "local");
151
- const outputMode = getOutputMode();
152
124
  const packBudget = parsePositiveIntFlag(args.pack ?? undefined, "--pack");
153
- const curated = await akmCurate({
154
- query: args.query,
155
- type,
156
- limit,
157
- source,
158
- eventSource: resolveUsageEventSource(),
159
- attributionProjection: outputMode.shape === "agent" ? "agent" : outputMode.detail,
160
- });
125
+ const outputMode = getOutputMode();
126
+ const curated = await runCurate({ query: args.query, type: args.type, limit: args.limit, from: args.from }, outputMode);
161
127
  if (packBudget !== undefined) {
162
128
  const packed = await packCuratedHits(curated, packBudget);
163
129
  deliverRendered(outputMode.format === "text" ? formatCuratePackText(packed) : JSON.stringify(packed.items, null, 2), outputMode.outputPath);
@@ -166,6 +132,27 @@ export const curateCommand = defineJsonCommand({
166
132
  output("curate", curated);
167
133
  },
168
134
  });
135
+ /**
136
+ * Validate the curate arguments and run the curation. The one path both
137
+ * `akm curate` and the in-process `curate()` of `src/api.ts` go through, so
138
+ * argument errors and ranking cannot drift between them. Takes the output
139
+ * mode explicitly (it only picks the attribution projection) instead of
140
+ * reading the process-level singleton.
141
+ */
142
+ export async function runCurate(args, outputMode) {
143
+ if (!args.query || !String(args.query).trim()) {
144
+ throw new UsageError('A curate query is required. Usage: akm curate "<task or prompt>" [--type <type>] [--limit <n>]', "MISSING_REQUIRED_ARGUMENT", 'Describe the task you want assets for, e.g. `akm curate "deploy to prod"`.');
145
+ }
146
+ const limitParsed = parsePositiveIntFlag(args.limit ?? undefined);
147
+ return akmCurate({
148
+ query: args.query,
149
+ type: args.type,
150
+ limit: limitParsed && limitParsed > 0 ? limitParsed : 4,
151
+ source: parseSearchSource(args.from ?? "local"),
152
+ eventSource: resolveUsageEventSource(),
153
+ attributionProjection: outputMode.shape === "agent" ? "agent" : outputMode.detail,
154
+ });
155
+ }
169
156
  /** Human-readable rendering for `akm curate --pack`: concatenated content per hit under a `## <ref>` header. */
170
157
  function formatCuratePackText(packed) {
171
158
  if (packed.items.length === 0) {
@@ -174,62 +161,16 @@ function formatCuratePackText(packed) {
174
161
  return packed.items.map((item) => `## ${item.ref}\n\n${item.content}`).join("\n\n");
175
162
  }
176
163
  /**
177
- * Reject `--scope` (either spelling) on `akm show` (E-3). `--scope` was
178
- * removed in favor of `--filter` (R-047, guardrail 6 — no alias, must keep
179
- * failing loudly, not silently). It is deliberately NOT a declared flag on
180
- * this command, which means citty's default behavior for an undeclared flag
181
- * kicks in — and that default is silent acceptance:
182
- *
183
- * - `--scope=user=nobody` (equals form): citty consumes it as an unknown
184
- * flag's own inline value. It never reaches `args._`, so nothing downstream
185
- * ever notices — the command runs to completion and exits 0, having
186
- * silently ignored the caller's (unsatisfied) scope request. This is the
187
- * dangerous case: the caller believes a read was scoped when it was not,
188
- * and it directly violates guardrail 6's "removed spelling must fail
189
- * loudly, not silently".
190
- * - `--scope user=nobody` (space form): citty treats `--scope` as boolean
191
- * and pushes `user=nobody` into `args._` as a stray positional, which
192
- * incidentally trips `rejectExtraShowPositionals`'s arity check below —
193
- * but with the wrong diagnosis (it blames the unrelated retired
194
- * `toc|section|lines|frontmatter|full` view-mode grammar).
195
- *
196
- * This check runs FIRST, before the positional check, so both spellings are
197
- * caught by one explicit, correctly-worded error — it does NOT make `--scope`
198
- * work, it only makes the failure loud and the diagnosis accurate.
199
- *
200
- * NOTE (general issue, out of scope here): citty silently accepts ANY
201
- * undeclared flag on ANY command (e.g. `akm info --totallybogus` exits 0) —
202
- * this same silent-ignore failure mode applies repo-wide, not just to
203
- * `--scope` on `show`. Fixing that generally is a separate, wide-blast-radius
204
- * owner decision (same family as E-2, `akm list --type skill`); this function
205
- * only closes the `--scope`/`show` instance of it.
206
- */
207
- function rejectRemovedScopeFlag(ref) {
208
- const usedScopeFlag = getParsedInvocation().userArgs.some((token) => token === "--scope" || token.startsWith("--scope="));
209
- if (!usedScopeFlag)
210
- return;
211
- throw new UsageError("akm show has no --scope flag — it was removed in 0.9.0. Use --filter instead: " +
212
- "--filter user=<id> --filter agent=<id> --filter run=<id> --filter channel=<name>.", "INVALID_FLAG_VALUE", `\`akm show ${ref} --filter user=<id>\` narrows resolution to assets whose frontmatter scope matches.`);
213
- }
214
- /**
215
- * Reject any positional after the ref. The
216
- * `akm show <ref> toc|section "H"|lines A B|frontmatter|full` view grammar was
217
- * removed in 0.9.0; its keywords used to be rewritten into hidden flags before
218
- * citty saw argv, so without this guard a stale invocation would silently
219
- * render the whole item instead of the view the caller asked for.
220
- *
221
- * `--scope` is handled separately, and earlier, by {@link rejectRemovedScopeFlag}
222
- * — by the time this runs, a `--scope`-caused stray positional has already
223
- * been intercepted with the correct diagnosis, so this function's generic
224
- * message is reached only by genuine leftover view-grammar tokens.
164
+ * Reject any positional after the ref: `akm show` takes one ref, and a stray
165
+ * token would otherwise silently render the whole item instead of what the
166
+ * caller asked for.
225
167
  */
226
168
  function rejectExtraShowPositionals(positionals, ref) {
227
169
  const extra = (Array.isArray(positionals) ? positionals.map(String) : []).slice(1);
228
170
  if (extra.length === 0)
229
171
  return;
230
172
  throw new UsageError(`akm show takes a single ref, but got ${extra.map((token) => `"${token}"`).join(" ")} after "${ref}". ` +
231
- "The view-mode grammar (toc|section|lines|frontmatter|full) was removed in 0.9.0 — use " +
232
- `\`akm show ${ref}#<heading-slug>\` to read one section, or \`akm show ${ref}\` for the whole item.`, "INVALID_FLAG_VALUE", "An unmatched #fragment lists the available slugs.");
173
+ `Use \`akm show ${ref}#<heading-slug>\` to read one section, or \`akm show ${ref}\` for the whole item.`, "INVALID_FLAG_VALUE", "An unmatched #fragment lists the available slugs.");
233
174
  }
234
175
  export const showCommand = defineJsonCommand({
235
176
  meta: {
@@ -265,10 +206,8 @@ export const showCommand = defineJsonCommand({
265
206
  // direct-read it. (the ref parser would reject the non-type `meta`.)
266
207
  if (!parseMetaRef(args.ref))
267
208
  parseBundleRef(args.ref);
268
- rejectRemovedScopeFlag(args.ref);
269
209
  rejectExtraShowPositionals(args._, args.ref);
270
210
  const invocation = getParsedInvocation();
271
- const cliShape = getOutputMode().shape;
272
211
  // F6/R-021 — `show` deliberately does NOT inherit `output.detail` from
273
212
  // config the way `search`/`curate` do via `getOutputMode().detail`
274
213
  // (which merges an explicit `--detail` flag with the config default,
@@ -282,15 +221,8 @@ export const showCommand = defineJsonCommand({
282
221
  // `--detail full` (explicit or, since it's also the implicit default,
283
222
  // omitted) and any other value fall through to the full response.
284
223
  const explicitDetail = invocation.getFlagValue("--detail");
285
- // `--shape summary` selects the compact metadata projection for show.
286
- // `--detail brief` forces the brief response regardless of shape.
287
- const showDetail = explicitDetail === "brief"
288
- ? "brief"
289
- : explicitDetail === "full"
290
- ? "full"
291
- : cliShape === "summary"
292
- ? "summary"
293
- : undefined;
224
+ // `--detail brief` forces the brief response regardless of projection.
225
+ const showDetail = explicitDetail === "brief" ? "brief" : explicitDetail === "full" ? "full" : undefined;
294
226
  // `--filter` is repeatable — citty only exposes the last value, so read
295
227
  // every occurrence directly from argv (same helper as `akm search`; the two
296
228
  // commands share one spelling for the scope-narrowing axis).
@@ -366,17 +366,6 @@ export function parseSearchSource(source) {
366
366
  return source;
367
367
  if (typeof source === "undefined")
368
368
  return "local";
369
- // 0.9.0 (S8): `--source stash`/`--source both` renamed to `--from
370
- // local`/`--from all`. Reject the retired values explicitly — otherwise
371
- // they fall through to the named-source lookup below and surface as a
372
- // misleading "no source named stash/both" error instead of naming the
373
- // rename.
374
- if (source === "stash") {
375
- throw new UsageError('"stash" was renamed to "local" in 0.9. Use `--from local` instead.', "INVALID_FLAG_VALUE");
376
- }
377
- if (source === "both") {
378
- throw new UsageError('"both" was renamed to "all" in 0.9. Use `--from all` instead.', "INVALID_FLAG_VALUE");
379
- }
380
369
  // Pass through unknown strings — they may be valid named sources.
381
370
  // `akmSearch` will validate against config.sources and throw a UsageError
382
371
  // with a helpful message if the name isn't found.
@@ -67,11 +67,6 @@ export async function akmShowUnified(input) {
67
67
  if (metaRef)
68
68
  return showStashMeta(metaRef);
69
69
  }
70
- const legacyReplacement = legacyColonRefReplacement(ref);
71
- if (legacyReplacement) {
72
- throw new NotFoundError(`The legacy colon ref "${ref}" was removed in 0.9.0. Use the slash form instead: ` +
73
- `akm show ${legacyReplacement}`);
74
- }
75
70
  // Env/secret bodies have no safe fragment surface, and a fragment cannot
76
71
  // widen what the env/secret renderers expose: both always omit the body
77
72
  // (env — key names only; secret — never rendered), fragment or not. Warn
@@ -107,20 +102,6 @@ export async function akmShowUnified(input) {
107
102
  }
108
103
  return result;
109
104
  }
110
- /** Actionable migration guidance for the retired `[bundle//]type:name` spelling. */
111
- function legacyColonRefReplacement(ref) {
112
- const match = /^(?:(?<bundle>[^/#]+)\/\/)?(?<type>[a-z][a-z0-9-]*):(?<name>[^#]+)(?<fragment>#.*)?$/i.exec(ref);
113
- const type = match?.groups?.type?.toLowerCase();
114
- const name = match?.groups?.name;
115
- if (!type || !name)
116
- return undefined;
117
- const stashDir = stashDirFor(type);
118
- if (!stashDir)
119
- return undefined;
120
- const bundle = match?.groups?.bundle;
121
- const fragment = match?.groups?.fragment ?? "";
122
- return `${bundle ? `${bundle}//` : ""}${stashDir}/${name}${fragment}`;
123
- }
124
105
  /**
125
106
  * Resolve a stash `.meta/` doc and return it as a lightweight ShowResponse.
126
107
  *