akm-cli 0.9.30 → 0.9.32

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 (165) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +10 -10
  3. package/ROADMAP.md +112 -0
  4. package/dist/commands/feedback-cli.js +21 -13
  5. package/dist/commands/improve/improve-cli.js +33 -12
  6. package/dist/core/errors.js +1 -0
  7. package/dist/core/file-lock.js +10 -1
  8. package/dist/indexer/usage/usage-events.js +6 -2
  9. package/dist/llm/client.js +33 -3
  10. package/dist/scripts/akm-migrate-node.js +6 -1
  11. package/dist/scripts/akm-migrate.js +6 -1
  12. package/docs/README.md +42 -41
  13. package/docs/agents/README.md +15 -0
  14. package/docs/agents/agent-install.md +14 -0
  15. package/docs/architecture/README.md +67 -0
  16. package/docs/architecture/adapters.md +272 -0
  17. package/docs/architecture/akm-architecture-decision-history.md +2055 -0
  18. package/docs/architecture/akm-core-principles.md +126 -0
  19. package/docs/architecture/architecture.md +579 -0
  20. package/docs/architecture/comparisons/claude-code-vs-akm-workflows-full.md +550 -0
  21. package/docs/architecture/decisions/0001-no-interpolation-attached-structured-context.md +72 -0
  22. package/docs/architecture/decisions/0002-unit-reuse-and-input-hash-scope.md +142 -0
  23. package/docs/architecture/decisions/0003-child-env-allowlist-and-provenance.md +189 -0
  24. package/docs/architecture/decisions/0004-task-input-contract-and-flag-coercion.md +97 -0
  25. package/docs/architecture/decisions/0005-task-result-vocabulary-and-legacy-read-mapping.md +108 -0
  26. package/docs/architecture/decisions/0006-task-source-version-routing.md +124 -0
  27. package/docs/architecture/decisions/0007-workflow-composition-bounds.md +83 -0
  28. package/docs/architecture/decisions/0008-task-binding-normalization.md +88 -0
  29. package/docs/architecture/decisions/0009-child-run-publication-column-parity.md +80 -0
  30. package/docs/architecture/decisions/0010-driver-protocol-cut.md +36 -0
  31. package/docs/architecture/decisions/0011-engine-run-loop-invariants.md +125 -0
  32. package/docs/architecture/decisions/README.md +62 -0
  33. package/docs/architecture/improvement.md +440 -0
  34. package/docs/architecture/internals/classification.md +154 -0
  35. package/docs/architecture/internals/fresh-host-rebuild-runbook.md +40 -0
  36. package/docs/architecture/internals/functional-contract-patterns.md +340 -0
  37. package/docs/architecture/internals/health-advisories.md +110 -0
  38. package/docs/architecture/internals/improve-workflow.md +713 -0
  39. package/docs/architecture/internals/indexing.md +498 -0
  40. package/docs/architecture/internals/registry-network-boundary.md +57 -0
  41. package/docs/architecture/internals/search.md +249 -0
  42. package/docs/architecture/internals/storage-locations.md +943 -0
  43. package/docs/architecture/persisted-data-compat.md +59 -0
  44. package/docs/architecture/reviews/env-secret-access.md +319 -0
  45. package/docs/architecture/runtime-boundary-design.md +153 -0
  46. package/docs/architecture/specs/0.9.0-close-out-plan.md +361 -0
  47. package/docs/architecture/specs/0.9.0-decisions.md +528 -0
  48. package/docs/architecture/specs/0.9.0-docs-code-drift-register.md +745 -0
  49. package/docs/architecture/specs/0.9.0-open-items-register.md +135 -0
  50. package/docs/architecture/specs/0.9.0-public-api-issue-backlog.md +740 -0
  51. package/docs/architecture/specs/0.9.0-release-surface-review.md +636 -0
  52. package/docs/architecture/specs/agent-command-engine-model-design.md +513 -0
  53. package/docs/architecture/specs/akm-0.9.0-bundle-adapter-spec.md +501 -0
  54. package/docs/architecture/specs/akm-0.9.0-ref-grammar-decision.md +291 -0
  55. package/docs/architecture/specs/akm-format-neutral-bundle-workspace-spec.md +2059 -0
  56. package/docs/architecture/specs/di-seams-plan.md +539 -0
  57. package/docs/architecture/specs/driver-protocol-keep-or-cut.md +275 -0
  58. package/docs/architecture/specs/fact-asset-type.md +142 -0
  59. package/docs/architecture/specs/improve-collapse-churn-detector-design.md +634 -0
  60. package/docs/architecture/specs/okf-support.md +148 -0
  61. package/docs/architecture/specs/ref.md +329 -0
  62. package/docs/architecture/specs/reviews/task-workflow-unification/README.md +72 -0
  63. package/docs/architecture/specs/reviews/task-workflow-unification/findings-consolidated.md +152 -0
  64. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-alternatives.md +352 -0
  65. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-bunqueue.md +300 -0
  66. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-openworkflow.md +402 -0
  67. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-1.md +758 -0
  68. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-2.md +645 -0
  69. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-3.md +602 -0
  70. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-adversarial.md +27 -0
  71. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-architecture.md +27 -0
  72. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-coverage.md +74 -0
  73. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-security.md +15 -0
  74. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-adversarial.md +132 -0
  75. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-verification.md +147 -0
  76. package/docs/architecture/specs/stash-conventions-code-spec.md +275 -0
  77. package/docs/architecture/specs/stash-organization-conventions.md +377 -0
  78. package/docs/architecture/specs/task-workflow-format-unification.md +721 -0
  79. package/docs/architecture/specs/workflow-engine-buy-vs-build.md +231 -0
  80. package/docs/architecture/specs/workflow-format-unification.md +437 -0
  81. package/docs/architecture/testing/manual-testing-checklist.md +3420 -0
  82. package/docs/architecture/testing/okf-v0.2-conformance-runbook.md +924 -0
  83. package/docs/architecture/testing/task-workflow-manual-tests.md +1817 -0
  84. package/docs/architecture/testing/testing-workflow.md +446 -0
  85. package/docs/architecture/workflow-engine.md +274 -0
  86. package/docs/guides/README.md +33 -0
  87. package/docs/guides/author-bundles.md +310 -0
  88. package/docs/guides/author-workflows.md +520 -0
  89. package/docs/guides/bundles.md +321 -0
  90. package/docs/guides/capture-knowledge.md +136 -0
  91. package/docs/guides/claude-code-vs-akm-workflows.md +30 -0
  92. package/docs/guides/concepts.md +93 -0
  93. package/docs/guides/discover-and-load.md +158 -0
  94. package/docs/guides/getting-started.md +240 -0
  95. package/docs/guides/improve-the-library.md +246 -0
  96. package/docs/guides/knowledge-management.md +18 -0
  97. package/docs/guides/recipes/headless-install.md +97 -0
  98. package/docs/guides/recipes/website-source.md +28 -0
  99. package/docs/guides/run-workflows.md +279 -0
  100. package/docs/guides/scheduling.md +123 -0
  101. package/docs/guides/use-with-any-agent.md +129 -0
  102. package/docs/guides/wikis.md +81 -0
  103. package/docs/maintainers/README.md +19 -0
  104. package/docs/maintainers/curate-workmap.md +336 -0
  105. package/docs/maintainers/eval.md +3 -0
  106. package/docs/maintainers/local-development.md +108 -0
  107. package/docs/maintainers/release-checklist.md +103 -0
  108. package/docs/migration/README.md +2 -2
  109. package/docs/migration/release-notes/0.0.13.md +1 -1
  110. package/docs/migration/release-notes/0.1.0.md +1 -1
  111. package/docs/migration/release-notes/0.2.0.md +1 -1
  112. package/docs/migration/release-notes/0.3.0.md +1 -1
  113. package/docs/migration/release-notes/0.5.0.md +1 -1
  114. package/docs/migration/release-notes/0.6.0.md +1 -1
  115. package/docs/migration/release-notes/0.7.0.md +1 -1
  116. package/docs/migration/release-notes/0.7.3.md +2 -2
  117. package/docs/migration/release-notes/0.7.4.md +1 -1
  118. package/docs/migration/release-notes/0.7.5.md +1 -1
  119. package/docs/migration/release-notes/0.8.0.md +1 -1
  120. package/docs/migration/release-notes/0.9.0.md +1 -1
  121. package/docs/migration/release-notes/0.9.14.md +1 -1
  122. package/docs/migration/release-notes/0.9.15.md +1 -1
  123. package/docs/migration/release-notes/0.9.16.md +1 -1
  124. package/docs/migration/release-notes/0.9.17.md +1 -1
  125. package/docs/migration/release-notes/0.9.19.md +1 -1
  126. package/docs/migration/release-notes/0.9.2.md +1 -1
  127. package/docs/migration/release-notes/README.md +27 -31
  128. package/docs/migration/v0.5-to-v0.6.md +759 -0
  129. package/docs/migration/v0.8-to-v0.9.md +1 -1
  130. package/docs/plans/0.9.2-agent-command-workflow-plan.md +423 -0
  131. package/docs/posts/README.md +30 -0
  132. package/docs/posts/akm-command-tour.md +495 -0
  133. package/docs/posts/akm-logo-sized.webp +0 -0
  134. package/docs/posts/belief-aware-memory-12.md +139 -0
  135. package/docs/posts/config-v2-lessons-16.md +191 -0
  136. package/docs/posts/improve-loop-autonomous-10.md +225 -0
  137. package/docs/posts/improve-pipeline-debugging-0803.md +179 -0
  138. package/docs/posts/intro-part-01.md +76 -0
  139. package/docs/posts/intro-part-02.md +221 -0
  140. package/docs/posts/intro-part-03.md +190 -0
  141. package/docs/posts/intro-part-04.md +221 -0
  142. package/docs/posts/llm-mode-reflect-13.md +166 -0
  143. package/docs/posts/openpalm-built-on-akm.md +86 -0
  144. package/docs/posts/progressive-disclosure-06.md +129 -0
  145. package/docs/posts/proposal-safety-net-15.md +112 -0
  146. package/docs/posts/release-0.5.0.md +247 -0
  147. package/docs/posts/release-0.6.0.md +117 -0
  148. package/docs/posts/release-0.7.0.md +159 -0
  149. package/docs/posts/release-0.8.0.md +332 -0
  150. package/docs/posts/scattered-skills-05.md +100 -0
  151. package/docs/posts/task-assets-persistent-workflows-11.md +222 -0
  152. package/docs/posts/team-skills-07.md +198 -0
  153. package/docs/posts/wiki-agent-knowledge-08.md +223 -0
  154. package/docs/posts/workflows-vaults-09.md +321 -0
  155. package/docs/product-surface.md +54 -0
  156. package/docs/reference/README.md +1 -2
  157. package/docs/reference/asset-types.md +168 -0
  158. package/docs/reference/cli.md +5 -6
  159. package/docs/reference/data-and-telemetry.md +6 -0
  160. package/docs/reference/env-and-secrets.md +126 -0
  161. package/docs/reference/memory.md +124 -0
  162. package/docs/reference/refs.md +156 -0
  163. package/docs/reference/registry.md +489 -0
  164. package/docs/reference/website-sources.md +141 -0
  165. package/package.json +12 -15
@@ -0,0 +1,446 @@
1
+ # Testing Workflow
2
+
3
+ This project is a CLI with three risk-heavy areas:
4
+
5
+ - command behavior across real files, config, and cache directories
6
+ - managed-source install/update flows
7
+ - binary deployment and self-upgrade behavior
8
+
9
+ The safest way to test it is in layers: fast local checks first, then end-to-end
10
+ CLI coverage, then Docker-based deployment and upgrade validation. This document
11
+ owns automated test workflow and test-authoring guidance only. The authoritative
12
+ manual setup, command matrix, expected behavior, release gates, evidence, and
13
+ cleanup live in [AKM Manual Testing Runbook](./manual-testing-checklist.md).
14
+
15
+ ## What To Validate
16
+
17
+ - core CLI flows: `setup`, `index`, `search`, `show`, `info`, `bundle list`, `config`
18
+ - asset lifecycle: add assets, re-index, search, show, and incremental refresh
19
+ - managed-source lifecycle: `akm bundle add`, `akm bundle list`, `akm bundle update`, `akm bundle remove`
20
+ - binary lifecycle: install, run, `akm upgrade --check`, `akm upgrade`
21
+ - cross-environment behavior on Ubuntu, Debian, Alpine, and Fedora containers
22
+
23
+ ## Test Layers In This Repo
24
+
25
+ ### 1. Fast local correctness
26
+
27
+ Run these before any release candidate or merge:
28
+
29
+ ```sh
30
+ bun run test:unit
31
+ bunx biome check --write src/ tests/
32
+ bunx tsc --noEmit
33
+ ```
34
+
35
+ Use this when you want the shortest full-project signal:
36
+
37
+ ```sh
38
+ bun run check
39
+ ```
40
+
41
+ Relevant coverage:
42
+
43
+ - `tests/integration/self-update.test.ts` - self-upgrade detection and checksum enforcement
44
+ - `tests/integration/registry-*.test.ts`, `tests/provider-registry.test.ts` - `list`, `remove`, `update`, cache cleanup, install resolution, tar safety, local/git/npm paths
45
+ - `tests/integration/setup-run.test.ts` - full setup wizard orchestration and failure handling
46
+ - `tests/integration/install-script.test.ts` - repeatable `install.sh` edge cases and permission paths
47
+
48
+ ### Writing deterministic, isolated tests
49
+
50
+ Both `scripts/test-unit.sh` (`bun run test:unit`) and `scripts/test-integration.sh`
51
+ (`bun run test:integration`) shard their target across up to `min(nproc, 8)`
52
+ concurrent `bun test` processes, splitting the file list round-robin — neither
53
+ runner is a single shared process, and neither is "the unit suite" alone.
54
+ Within one shard, every file assigned to that process still runs in **one
55
+ shared process**: one `process.env`, one module-singleton namespace, and
56
+ (under fake timers) one global clock for every file in that shard. A test that
57
+ mutates shared state without restoring it, or that asserts on a wall-clock
58
+ measurement, can pass on one scheduling and
59
+ fail on another — the two release/0.8.0 flakes (scoring-pipeline Issue #14
60
+ reading the wrong index DB after a sibling mutated `XDG_DATA_HOME`; the
61
+ llm-client timeout test racing real timers) were both this class.
62
+
63
+ Rules (conventions, not statically enforced — the lint script that policed
64
+ them was deleted in 0.9.8; the runtime guard in `src/core/paths.ts` throws
65
+ `TEST_ISOLATION_MISSING` and the preload tripwire catches leaks):
66
+
67
+ 1. **Never mutate `AKM_*` / `XDG_*` / `HOME` on `process.env` directly.** Use the
68
+ sanctioned helpers in `tests/_helpers/sandbox.ts`:
69
+ - `sandboxStashDir`, `sandboxXdgConfigHome`, `sandboxXdgDataHome`,
70
+ `sandboxXdgCacheHome`, `sandboxXdgStateHome`, `sandboxHome` — set the env var
71
+ to an isolated temp dir and return a `cleanup` that restores the prior value.
72
+ Chain them and call `cleanup()` in `afterEach`.
73
+ - `withEnv({ AKM_BUNDLE_DIR }, async () => …)` — scoped override that always
74
+ restores in a `finally`, even on throw. Use this for per-call overrides
75
+ around an in-process CLI invocation.
76
+ - `makeStashDir` / `makeSandboxDir` — temp dirs that are NOT wired into env
77
+ (pass them to `withEnv` or a subprocess env object yourself).
78
+
79
+ The DB path resolves from `XDG_DATA_HOME`; if you `akmIndex` then `akmSearch`,
80
+ both must see the **same** sandboxed `XDG_DATA_HOME` or the search reads a
81
+ different (empty/stale) DB. Sandbox it in `beforeEach`.
82
+
83
+ 2. **Do not assert on a measured wall-clock delta.** `expect(Date.now() - start)
84
+ .toBeLessThan(N)` races the scheduler. Assert the *observable result* instead
85
+ (e.g. `result.reason === "timeout"`), or drive time deterministically with
86
+ `jest.useFakeTimers()` + `jest.advanceTimersByTime(...)` and a fetch/spawn stub.
87
+ Asserting on a `durationMs` field computed from injected fixture timestamps is
88
+ fine (it is deterministic).
89
+
90
+ 3. **Sort/compare on the value the user sees.** When a test asserts ordering,
91
+ make the production sort key the same quantized value that is displayed
92
+ (`db-search.ts` sorts on the clamped+rounded score, then breaks ties by name),
93
+ so an invisible sub-display-precision epsilon can never reorder visible ties.
94
+
95
+ 4. **Avoid stateful feedback within one test.** Re-running `akmSearch` without
96
+ `skipLogging: true` writes utility/recency rows that perturb the next search's
97
+ ranking. Pass `skipLogging: true` when you need repeatable ranking across
98
+ calls in a single test.
99
+
100
+ If a file legitimately needs a literal env value (e.g. pure path-resolution unit
101
+ tests) and restores via its own save/restore wrapper, add it to the linter's
102
+ `ENV_ASSIGN_ALLOWED` set with a one-line justification — the list may only shrink.
103
+
104
+ ### 2. End-to-end CLI validation
105
+
106
+ Run the full integration suite when changing CLI behavior, indexing, search,
107
+ config, source management, or output shaping:
108
+
109
+ ```sh
110
+ bun run test:integration
111
+ ```
112
+
113
+ Collectively, these suites (`tests/integration/`) exercise real flows,
114
+ including:
115
+
116
+ - fallback search without an index
117
+ - `index -> search -> show`
118
+ - CLI subprocess execution through `src/cli.ts`
119
+ - config read/write behavior
120
+ - registry-source compatibility
121
+ - progressive indexing and re-indexing
122
+ - update and upgrade command error paths
123
+ - knowledge `#fragment` selection and mixed asset discovery
124
+
125
+ ## Semantic Search States
126
+
127
+ Semantic search does not behave as a simple on/off feature at runtime. Testing
128
+ should distinguish between saved-config state and actual readiness.
129
+
130
+ ### Config intent
131
+
132
+ Semantic search intent is saved independently as `semanticSearchMode`:
133
+
134
+ - `off` when the user opts out explicitly
135
+ - `auto` when the user wants semantic search enabled
136
+
137
+ Setup should not flip intent from `auto` back to `off` because preparation or
138
+ verification fails transiently.
139
+
140
+ ### Runtime readiness
141
+
142
+ Actual semantic readiness is tracked separately from config intent. Runtime state
143
+ can be:
144
+
145
+ - `pending` when semantic search is enabled but not yet verified
146
+ - `ready-js` when every entry has a vector (the name is historical; there is no other vector path)
147
+ - `blocked` when semantic search cannot run with the current provider/setup
148
+
149
+ These cases are covered by `tests/integration/setup-run.test.ts` and the focused
150
+ semantic/config suites.
151
+
152
+ The real-model gate (`AKM_SEMANTIC_TESTS=1`) honors an explicit `HF_HOME` and
153
+ otherwise uses the ignored, repo-local `.ci-cache/huggingface` directory. That
154
+ path is outside the preload's disposable test `HOME`, so a second local run
155
+ reuses the model without exposing the developer's normal AKM cache. Gated CI
156
+ sets the same path and restores it from a model/source-identified Actions
157
+ cache. Candidate tags and manual runs are restore-only; only the scheduled
158
+ default-branch run may save a cache entry.
159
+
160
+ The same gate runs real semantic index/search round-trips against the declared
161
+ external dependency. Package acceptance separately verifies the ordinary npm
162
+ package surface; there is no installed-consumer compatibility architecture or
163
+ copied semantic runtime to audit.
164
+
165
+ ### What to test explicitly
166
+
167
+ - config stays `off` only when the user disables semantic search intentionally
168
+ - config stays `auto` when preparation is skipped intentionally
169
+ - config stays `auto` when preparation fails but runtime status becomes `blocked`
170
+ - runtime status becomes `pending`, `ready-js`, or `blocked` as appropriate
171
+ - index and info output report readiness state instead of only config intent
172
+
173
+ ### 3. Docker deployment validation
174
+
175
+ Run the Docker matrix when changing install, packaging, startup, runtime
176
+ dependencies, or platform behavior:
177
+
178
+ ```sh
179
+ AKM_DOCKER_TESTS=1 bun test tests/integration/docker-install.test.ts
180
+ ```
181
+
182
+ Or run the shell orchestrator directly:
183
+
184
+ ```sh
185
+ ./tests/docker/run-docker-tests.sh
186
+ ```
187
+
188
+ This validates two deployment methods across four Linux families:
189
+
190
+ - bun-based install: Ubuntu, Debian, Alpine, Fedora
191
+ - compiled binary install: Ubuntu, Debian, Fedora
192
+
193
+ Binary validation currently excludes Alpine. The compiled Linux binary used in
194
+ this repo's Docker tests is not packaged for Alpine/musl compatibility, so the
195
+ binary deployment gate focuses on the glibc-based targets we currently support.
196
+
197
+ The Docker smoke test in `tests/docker/smoke-test.sh` verifies:
198
+
199
+ - `akm --help`
200
+ - `akm bundle create`
201
+ - bundle directory creation
202
+ - `akm index`
203
+ - `akm search`
204
+ - `akm show`
205
+ - `akm info`
206
+ - `akm bundle list`
207
+ - incremental re-index after adding a new asset
208
+
209
+ ### 4. Benchmark (agent utility)
210
+
211
+ The LLM-provider-driven, multi-seed agent-utility benchmark (`akm-bench`) now
212
+ lives in the standalone repo **[itlackey/akm-bench](https://github.com/itlackey/akm-bench)**.
213
+ Run it from there after any change to `src/output/`, `src/commands/read/show.ts`,
214
+ APPLY directives, or other content that affects what agents see.
215
+
216
+ For curate/search ranking quality, run the retrieval eval of
217
+ **[itlackey/akm-eval](https://github.com/itlackey/akm-eval)**
218
+ (`evals/retrieval/run --corpus public`, with `AKM_BIN` naming the build under
219
+ test). It scores `akm search` and `akm curate` against graded judgments and
220
+ calls no model service. The in-repo curate benchmark that used to do this,
221
+ `akm-eval-curate-bench`, left with the rest of `scripts/akm-eval/`; see
222
+ `docs/maintainers/eval.md`.
223
+
224
+ ## Recommended Workflow
225
+
226
+ ### Normal change
227
+
228
+ Use this for most code changes:
229
+
230
+ ```sh
231
+ bun run test:unit
232
+ bun run test:integration
233
+ bunx biome check --write src/ tests/
234
+ bunx tsc --noEmit
235
+ ```
236
+
237
+ ### Install, packaging, or release-related change
238
+
239
+ Use this when touching `src/cli.ts`, `src/commands/sources/self-update.ts`, install flows,
240
+ source management, or Docker assets:
241
+
242
+ ```sh
243
+ bun run test:unit
244
+ bun test tests/integration/self-update.test.ts tests/integration/setup-run.test.ts tests/integration/install-script.test.ts
245
+ ./tests/docker/run-docker-tests.sh
246
+ bunx biome check --write src/ tests/
247
+ bunx tsc --noEmit
248
+ ```
249
+
250
+ ### Release gate
251
+
252
+ Use this before publishing a release:
253
+
254
+ ```sh
255
+ bun run release:check
256
+ ```
257
+
258
+ If Docker is available, prefer `./tests/docker/run-docker-tests.sh` over a
259
+ single-variant container run so both bun and binary installs are covered.
260
+
261
+ For a local release gate without Docker, use:
262
+
263
+ ```sh
264
+ ./tests/release-check.sh --skip-docker
265
+ ```
266
+
267
+ That script now runs a dedicated install/setup regression suite before the full
268
+ test run so first-run, installer, and wizard failures surface early.
269
+
270
+ The local script is only one half of release validation. Follow the
271
+ [maintainer release checklist](../../maintainers/release-checklist.md) to
272
+ run **Gated CI** from a `gated-ci/candidate-*` tag targeting the exact candidate
273
+ commit, or manually dispatch it with the full candidate
274
+ SHA after the workflow reaches the default branch. Its real-embedding, Docker,
275
+ and Linux/macOS/Windows scheduler jobs must all succeed, and the release PR
276
+ must link the resulting Actions run. The weekly scheduled run detects
277
+ default-branch drift; it cannot attest a different release-candidate commit.
278
+
279
+ ## Manual QA Authority
280
+
281
+ Use [AKM Manual Testing Runbook](./manual-testing-checklist.md) for every manual
282
+ flow. Its full sandbox is mandatory; the smaller historical XDG-only setup is
283
+ unsafe because `AKM_CONFIG_DIR` can bypass it. The runbook also owns expected
284
+ exits/channels, fixtures, release evidence, platform gates, and cleanup.
285
+
286
+ ## Docker Deployment Validation
287
+
288
+ ### Automated matrix
289
+
290
+ The repo already contains Dockerfiles for:
291
+
292
+ - `tests/docker/Dockerfile.ubuntu-bun`
293
+ - `tests/docker/Dockerfile.debian-bun`
294
+ - `tests/docker/Dockerfile.alpine-bun`
295
+ - `tests/docker/Dockerfile.fedora-bun`
296
+ - `tests/docker/Dockerfile.ubuntu-binary`
297
+ - `tests/docker/Dockerfile.debian-binary`
298
+ - `tests/docker/Dockerfile.fedora-binary`
299
+
300
+ `Dockerfile.alpine-binary` does not exist and is deliberately not part of this
301
+ matrix: binary validation excludes Alpine (see above) because the compiled
302
+ binary targets glibc and Alpine is musl-based.
303
+
304
+ Run one variant if you need a focused repro:
305
+
306
+ ```sh
307
+ ./tests/docker/run-docker-tests.sh ubuntu-binary
308
+ ./tests/docker/run-docker-tests.sh --bun-only
309
+ ./tests/docker/run-docker-tests.sh --binary-only
310
+ ```
311
+
312
+ ### What the Docker matrix proves
313
+
314
+ - the CLI starts in minimal Linux images
315
+ - runtime dependencies are sufficient for `bundle create`, `index`, `search`, and `show`
316
+ - bun-linked installs work after building from source
317
+ - compiled Linux binaries run correctly when copied into the image
318
+ - the CLI can create a fresh bundle, build an index, and discover new assets
319
+
320
+ Treat this matrix as a release gate for shell-level regressions too. The Docker
321
+ smoke path exercises real entrypoint scripts and container command execution,
322
+ which can catch failures that unit and subprocess tests miss.
323
+
324
+ ### What it does not prove by itself
325
+
326
+ - that the published release artifact matches the local compiled binary
327
+ - that `install.sh` works against a real GitHub release
328
+ - that self-upgrade can replace the running binary in-place
329
+
330
+ Those should be validated in disposable containers as described next.
331
+
332
+ ## Published Artifact Acceptance
333
+
334
+ Published binary, installer, checksum, native-platform, and self-upgrade
335
+ procedures are release-facing manual gates. Run sections 21-22 of the
336
+ [manual runbook](./manual-testing-checklist.md); do not validate release bytes
337
+ with an installer fetched from raw `main`.
338
+
339
+ ## Upgrade Regression Coverage
340
+
341
+ Managed-source updates and CLI self-upgrade are separate implementations.
342
+ Provider/registry suites cover source add/update/remove/cache behavior;
343
+ `tests/integration/self-update.test.ts` covers install-method detection,
344
+ orchestration, checksum, and failure paths. Real managed-source and self-upgrade
345
+ acceptance is manual and lives in section 21 of the
346
+ [manual runbook](./manual-testing-checklist.md).
347
+
348
+ ### Upgrade rehearsal gate
349
+
350
+ `tests/integration/upgrade-rehearsal/` installs the PREVIOUS published stable
351
+ `akm-cli` release as a real global npm package (real `npm pack` / `npm
352
+ install --global` into a throwaway prefix — see `scripts/package-install.ts`)
353
+ under the label `live`, drives it to build a realistic home — a filesystem
354
+ bundle, a git bundle (with an in-bundle symlink at its root), a website
355
+ bundle, an npm bundle, three scheduled tasks (two granted, one left
356
+ ungranted) plus a manual task, and a synced native (fake) crontab — then
357
+ installs the CANDIDATE build OVER `live`, in the SAME prefix: an in-place
358
+ swap, the same thing a real `npm i -g akm-cli@…`/`bun add -g` upgrade does,
359
+ not a side-by-side install. It then runs the CANDIDATE against that home
360
+ (`migrate status`/`apply`, `bundle list` with every bundle confirmed enabled,
361
+ `search`/`show`, `task sync` dry-run and real — plain, no `--rebind`, as an
362
+ upgrading user actually runs it — executing the generated cron command and
363
+ confirming it ran the candidate, `task run`, `health`, `improve --plan`), and
364
+ finally installs a separate untouched copy of the PREVIOUS release and runs
365
+ it back against the candidate-written home to prove read-back still works.
366
+ It exists because no other suite drives a real prior release against a real
367
+ candidate build: the symlink-abort regression fixed in 0.9.17-alpha.3
368
+ (`d76af0a7b`) went undetected by the full unit/integration suite,
369
+ `tests/release-check.sh`, and the Docker matrix, because no fixture combined
370
+ a git bundle with an in-bundle symlink, a website bundle, an npm bundle, an
371
+ ungranted task, and a real crontab row in one home. Plain `task sync` proves
372
+ clean specifically because the candidate lands inside the SAME prefix the
373
+ previous release's scheduler rows already point at — no launcher path moves,
374
+ so nothing needs rebinding; a side-by-side install (a separate prefix) would
375
+ need `--rebind` instead, which is not what an in-place package-manager
376
+ upgrade does. `tests/integration/previous-release-corpus.test.ts` covers
377
+ persisted-data shapes read in isolation; this gate covers the whole CLI
378
+ surface driven end to end across two real installed releases.
379
+
380
+ Run it locally with:
381
+
382
+ ```sh
383
+ bun run build
384
+ AKM_UPGRADE_REHEARSAL=1 TMPDIR=/tmp bun test --timeout=900000 tests/integration/upgrade-rehearsal/
385
+ ```
386
+
387
+ Unset (the default), the suite logs one line and skips — it never fails
388
+ "inconclusively" (#795): every missing capability (no `npm` on `PATH`, no
389
+ network reachable to resolve/fetch the previous release, no candidate build)
390
+ throws naming the fix instead. Env overrides:
391
+
392
+ - `AKM_UPGRADE_FROM=<version>` — pin the previous release instead of
393
+ resolving the highest published stable version below the candidate's
394
+ `package.json` version.
395
+ - `AKM_CANDIDATE_TARBALL=<path>` — use an already-packed candidate tarball
396
+ (`tests/release-check.sh` passes `$PACKAGE_CANDIDATE`) instead of running
397
+ `npm pack` on the working tree (which requires `dist/cli.js` — run
398
+ `bun run build` first).
399
+
400
+ Fetched previous-release tarballs are cached under
401
+ `${TMPDIR:-/tmp}/akm-upgrade-rehearsal/previous-release/<version>/` so repeat
402
+ runs do not re-hit the network. It is wired into CI as the `upgrade-rehearsal`
403
+ job (`.github/workflows/ci.yml`) and into `tests/release-check.sh` right
404
+ after packing the release candidate.
405
+
406
+ ## Coverage Gap Guide
407
+
408
+ This repo now has broad coverage across the major CLI, indexing, registry, and
409
+ semantic-search paths. Use this file as a current gap guide, not a greenfield
410
+ test plan.
411
+
412
+ ### Areas With Strong Existing Coverage
413
+
414
+ - database and scoring (`tests/integration/db.test.ts`, `tests/integration/db-scoring.test.ts`, `tests/integration/fts-field-weighting.test.ts`)
415
+ - search/show CLI surfaces (`tests/integration/commands/search-cli-envelope.test.ts`, `tests/integration/commands/show.test.ts`, and the other `search-*`/`show-*` suites under `tests/integration/`)
416
+ - registry install/search/update/list flows
417
+ - workflow, vault, and wiki behavior
418
+ - semantic status, vector search, and embedding config behavior
419
+ - CLI error handling and output shaping
420
+ - Docker install validation
421
+
422
+ ### Highest-Value Remaining Gaps
423
+
424
+ 1. corrupt or version-mismatched DB fallback behavior during search
425
+ 2. local model download and ONNX startup failures
426
+ 3. partial embedding-generation failures during indexing
427
+ 4. concurrent search/embedder behavior under load
428
+ 5. semantic readiness reporting parity between `setup`, `search`, and `info`
429
+ 6. broader platform CI for Alpine/musl, ARM, and Windows edge cases
430
+
431
+ ### When Adding Tests
432
+
433
+ - prefer focused `bun:test` files under `tests/`
434
+ - use isolated temp config/cache/stash dirs
435
+ - cover the user-visible CLI behavior when the risk is output shaping or command routing
436
+ - cover internal units directly when the risk is scoring, metadata extraction, or persistence
437
+
438
+ ### Useful Existing Suites To Extend
439
+
440
+ - `tests/integration/commands/search-cli-envelope.test.ts`
441
+ - `tests/integration/commands/show.test.ts`
442
+ - `tests/integration/vector-search.test.ts`
443
+ - `tests/integration/semantic-status.test.ts`
444
+ - `tests/setup-wizard.test.ts`, `tests/setup-scheduled-tasks.test.ts`
445
+ - `tests/integration/info-command.test.ts`
446
+ - `tests/integration/docker-install.test.ts`