akm-cli 0.7.0 → 0.7.1

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 (327) hide show
  1. package/package.json +8 -8
  2. package/dist/tests/add-website-source.test.js +0 -119
  3. package/dist/tests/agent/agent-config-loader.test.js +0 -70
  4. package/dist/tests/agent/agent-config.test.js +0 -221
  5. package/dist/tests/agent/agent-detect.test.js +0 -100
  6. package/dist/tests/agent/agent-spawn.test.js +0 -234
  7. package/dist/tests/agent-output.test.js +0 -186
  8. package/dist/tests/architecture/agent-no-llm-sdk-guard.test.js +0 -103
  9. package/dist/tests/architecture/agent-spawn-seam.test.js +0 -193
  10. package/dist/tests/architecture/llm-stateless-seam.test.js +0 -112
  11. package/dist/tests/asset-ref.test.js +0 -192
  12. package/dist/tests/asset-registry.test.js +0 -103
  13. package/dist/tests/asset-spec.test.js +0 -241
  14. package/dist/tests/bench/attribution.test.js +0 -996
  15. package/dist/tests/bench/cleanup-sigint.test.js +0 -83
  16. package/dist/tests/bench/cleanup.js +0 -234
  17. package/dist/tests/bench/cleanup.test.js +0 -166
  18. package/dist/tests/bench/cli.js +0 -1018
  19. package/dist/tests/bench/cli.test.js +0 -445
  20. package/dist/tests/bench/compare.test.js +0 -556
  21. package/dist/tests/bench/corpus.js +0 -317
  22. package/dist/tests/bench/corpus.test.js +0 -258
  23. package/dist/tests/bench/doctor.js +0 -525
  24. package/dist/tests/bench/driver.js +0 -401
  25. package/dist/tests/bench/driver.test.js +0 -584
  26. package/dist/tests/bench/environment.js +0 -233
  27. package/dist/tests/bench/environment.test.js +0 -199
  28. package/dist/tests/bench/evolve-metrics.js +0 -179
  29. package/dist/tests/bench/evolve-metrics.test.js +0 -187
  30. package/dist/tests/bench/evolve.js +0 -647
  31. package/dist/tests/bench/evolve.test.js +0 -624
  32. package/dist/tests/bench/failure-modes.test.js +0 -349
  33. package/dist/tests/bench/feedback-integrity.test.js +0 -457
  34. package/dist/tests/bench/leakage.test.js +0 -228
  35. package/dist/tests/bench/learning-curve.test.js +0 -134
  36. package/dist/tests/bench/metrics.js +0 -2395
  37. package/dist/tests/bench/metrics.test.js +0 -1150
  38. package/dist/tests/bench/no-os-tmpdir-invariant.test.js +0 -43
  39. package/dist/tests/bench/opencode-config.js +0 -194
  40. package/dist/tests/bench/opencode-config.test.js +0 -370
  41. package/dist/tests/bench/report.js +0 -1885
  42. package/dist/tests/bench/report.test.js +0 -1038
  43. package/dist/tests/bench/run-config.js +0 -355
  44. package/dist/tests/bench/run-config.test.js +0 -298
  45. package/dist/tests/bench/run-curate-test.js +0 -32
  46. package/dist/tests/bench/run-failing-tasks.js +0 -56
  47. package/dist/tests/bench/run-full-bench.js +0 -51
  48. package/dist/tests/bench/run-items36-targeted.js +0 -69
  49. package/dist/tests/bench/run-nano-quick.js +0 -42
  50. package/dist/tests/bench/run-waveg-targeted.js +0 -62
  51. package/dist/tests/bench/runner.js +0 -699
  52. package/dist/tests/bench/runner.test.js +0 -958
  53. package/dist/tests/bench/search-bridge.test.js +0 -331
  54. package/dist/tests/bench/tmp.js +0 -131
  55. package/dist/tests/bench/trajectory.js +0 -116
  56. package/dist/tests/bench/trajectory.test.js +0 -127
  57. package/dist/tests/bench/verifier.js +0 -114
  58. package/dist/tests/bench/verifier.test.js +0 -118
  59. package/dist/tests/bench/workflow-evaluator.js +0 -557
  60. package/dist/tests/bench/workflow-evaluator.test.js +0 -421
  61. package/dist/tests/bench/workflow-spec.js +0 -345
  62. package/dist/tests/bench/workflow-spec.test.js +0 -363
  63. package/dist/tests/bench/workflow-trace.js +0 -472
  64. package/dist/tests/bench/workflow-trace.test.js +0 -254
  65. package/dist/tests/benchmark-search-quality.js +0 -536
  66. package/dist/tests/benchmark-suite.js +0 -1441
  67. package/dist/tests/capture-cli.test.js +0 -112
  68. package/dist/tests/cli-errors.test.js +0 -204
  69. package/dist/tests/commands/events.test.js +0 -370
  70. package/dist/tests/commands/history.test.js +0 -418
  71. package/dist/tests/commands/import.test.js +0 -103
  72. package/dist/tests/commands/proposal-cli.test.js +0 -209
  73. package/dist/tests/commands/reflect-propose-cli.test.js +0 -333
  74. package/dist/tests/commands/remember.test.js +0 -97
  75. package/dist/tests/commands/scope-flags.test.js +0 -300
  76. package/dist/tests/commands/search.test.js +0 -537
  77. package/dist/tests/commands/show-indexer-parity.test.js +0 -117
  78. package/dist/tests/commands/show.test.js +0 -294
  79. package/dist/tests/common.test.js +0 -266
  80. package/dist/tests/completions.test.js +0 -142
  81. package/dist/tests/config-cli.test.js +0 -193
  82. package/dist/tests/config-llm-features.test.js +0 -139
  83. package/dist/tests/config.test.js +0 -569
  84. package/dist/tests/contracts/migration-baseline.test.js +0 -43
  85. package/dist/tests/contracts/reflect-propose-envelope.test.js +0 -139
  86. package/dist/tests/contracts/spec-helpers.js +0 -46
  87. package/dist/tests/contracts/v1-spec-section-11-proposal-queue.test.js +0 -228
  88. package/dist/tests/contracts/v1-spec-section-12-agent-config.test.js +0 -56
  89. package/dist/tests/contracts/v1-spec-section-13-lesson-type.test.js +0 -34
  90. package/dist/tests/contracts/v1-spec-section-14-llm-features.test.js +0 -94
  91. package/dist/tests/contracts/v1-spec-section-4-1-asset-types.test.js +0 -39
  92. package/dist/tests/contracts/v1-spec-section-4-2-quality-rules.test.js +0 -44
  93. package/dist/tests/contracts/v1-spec-section-5-configuration.test.js +0 -47
  94. package/dist/tests/contracts/v1-spec-section-6-orchestration.test.js +0 -40
  95. package/dist/tests/contracts/v1-spec-section-7-module-layout.test.js +0 -58
  96. package/dist/tests/contracts/v1-spec-section-8-extension-points.test.js +0 -34
  97. package/dist/tests/contracts/v1-spec-section-9-4-cli-surface.test.js +0 -75
  98. package/dist/tests/contracts/v1-spec-section-9-7-llm-agent-boundary.test.js +0 -36
  99. package/dist/tests/core/write-source.test.js +0 -366
  100. package/dist/tests/curate-command.test.js +0 -87
  101. package/dist/tests/db-scoring.test.js +0 -201
  102. package/dist/tests/db.test.js +0 -654
  103. package/dist/tests/distill-cli-flag.test.js +0 -208
  104. package/dist/tests/distill.test.js +0 -515
  105. package/dist/tests/docker-install.test.js +0 -120
  106. package/dist/tests/e2e.test.js +0 -1419
  107. package/dist/tests/embedder.test.js +0 -340
  108. package/dist/tests/embedding-model-config.test.js +0 -379
  109. package/dist/tests/feedback-command.test.js +0 -172
  110. package/dist/tests/file-context.test.js +0 -552
  111. package/dist/tests/fixtures/scripts/git/summarize-diff.js +0 -9
  112. package/dist/tests/fixtures/scripts/lint/eslint-check.js +0 -7
  113. package/dist/tests/fixtures/stashes/load.js +0 -166
  114. package/dist/tests/fixtures/stashes/load.test.js +0 -97
  115. package/dist/tests/fixtures/stashes/ranking-baseline/scripts/mem0-search.js +0 -12
  116. package/dist/tests/frontmatter.test.js +0 -190
  117. package/dist/tests/fts-field-weighting.test.js +0 -254
  118. package/dist/tests/fuzzy-search.test.js +0 -230
  119. package/dist/tests/git-provider-clone.test.js +0 -45
  120. package/dist/tests/github.test.js +0 -161
  121. package/dist/tests/graph-boost-ranking.test.js +0 -305
  122. package/dist/tests/graph-extraction.test.js +0 -282
  123. package/dist/tests/helpers/usage-events.js +0 -8
  124. package/dist/tests/index-pass-llm.test.js +0 -161
  125. package/dist/tests/indexer.test.js +0 -570
  126. package/dist/tests/info-command.test.js +0 -166
  127. package/dist/tests/init.test.js +0 -69
  128. package/dist/tests/install-script.test.js +0 -246
  129. package/dist/tests/integration/agent-real-profile.test.js +0 -94
  130. package/dist/tests/issue-36-repro.test.js +0 -304
  131. package/dist/tests/issues-191-194.test.js +0 -160
  132. package/dist/tests/lesson-lint.test.js +0 -111
  133. package/dist/tests/llm-client.test.js +0 -115
  134. package/dist/tests/llm-feature-gate.test.js +0 -151
  135. package/dist/tests/llm.test.js +0 -139
  136. package/dist/tests/lockfile.test.js +0 -216
  137. package/dist/tests/manifest.test.js +0 -205
  138. package/dist/tests/markdown.test.js +0 -126
  139. package/dist/tests/matchers-unit.test.js +0 -189
  140. package/dist/tests/memory-inference.test.js +0 -299
  141. package/dist/tests/merge-scoring.test.js +0 -136
  142. package/dist/tests/metadata.test.js +0 -313
  143. package/dist/tests/migration-help.test.js +0 -89
  144. package/dist/tests/origin-resolve.test.js +0 -124
  145. package/dist/tests/output-baseline.test.js +0 -218
  146. package/dist/tests/output-shapes-unit.test.js +0 -478
  147. package/dist/tests/parallel-search.test.js +0 -272
  148. package/dist/tests/parameter-metadata.test.js +0 -365
  149. package/dist/tests/paths.test.js +0 -177
  150. package/dist/tests/progressive-disclosure.test.js +0 -280
  151. package/dist/tests/proposals.test.js +0 -279
  152. package/dist/tests/proposed-quality.test.js +0 -271
  153. package/dist/tests/provider-registry.test.js +0 -32
  154. package/dist/tests/ranking-regression.test.js +0 -548
  155. package/dist/tests/reflect-propose.test.js +0 -455
  156. package/dist/tests/registry-build-index.test.js +0 -394
  157. package/dist/tests/registry-cli.test.js +0 -290
  158. package/dist/tests/registry-index-v2.test.js +0 -430
  159. package/dist/tests/registry-install.test.js +0 -728
  160. package/dist/tests/registry-providers/parity.test.js +0 -189
  161. package/dist/tests/registry-providers/skills-sh.test.js +0 -309
  162. package/dist/tests/registry-providers/static-index.test.js +0 -238
  163. package/dist/tests/registry-resolve.test.js +0 -126
  164. package/dist/tests/registry-search.test.js +0 -923
  165. package/dist/tests/remember-frontmatter.test.js +0 -378
  166. package/dist/tests/remember-unit.test.js +0 -123
  167. package/dist/tests/ripgrep-install.test.js +0 -251
  168. package/dist/tests/ripgrep-resolve.test.js +0 -108
  169. package/dist/tests/ripgrep.test.js +0 -163
  170. package/dist/tests/save-command.test.js +0 -94
  171. package/dist/tests/save-trust-qa-fixes.test.js +0 -270
  172. package/dist/tests/scoring-pipeline.test.js +0 -648
  173. package/dist/tests/search-include-proposed-cli.test.js +0 -118
  174. package/dist/tests/self-update.test.js +0 -442
  175. package/dist/tests/semantic-search-e2e.test.js +0 -512
  176. package/dist/tests/semantic-status.test.js +0 -471
  177. package/dist/tests/setup-run.integration.js +0 -877
  178. package/dist/tests/setup-wizard.test.js +0 -198
  179. package/dist/tests/setup.test.js +0 -131
  180. package/dist/tests/source-add.test.js +0 -11
  181. package/dist/tests/source-clone.test.js +0 -254
  182. package/dist/tests/source-manage.test.js +0 -366
  183. package/dist/tests/source-providers/filesystem.test.js +0 -82
  184. package/dist/tests/source-providers/git.test.js +0 -252
  185. package/dist/tests/source-providers/website.test.js +0 -128
  186. package/dist/tests/source-qa-fixes.test.js +0 -286
  187. package/dist/tests/source-registry.test.js +0 -350
  188. package/dist/tests/source-resolve.test.js +0 -100
  189. package/dist/tests/source-source.test.js +0 -281
  190. package/dist/tests/source.test.js +0 -533
  191. package/dist/tests/tar-utils-scan.test.js +0 -73
  192. package/dist/tests/toggle-components.test.js +0 -73
  193. package/dist/tests/usage-telemetry.test.js +0 -265
  194. package/dist/tests/utility-scoring.test.js +0 -558
  195. package/dist/tests/vault-load-error.test.js +0 -78
  196. package/dist/tests/vault-qa-fixes.test.js +0 -194
  197. package/dist/tests/vault.test.js +0 -429
  198. package/dist/tests/vector-search.test.js +0 -608
  199. package/dist/tests/walker.test.js +0 -252
  200. package/dist/tests/wave2-cluster-bc.test.js +0 -228
  201. package/dist/tests/wave2-cluster-d.test.js +0 -180
  202. package/dist/tests/wave2-cluster-e.test.js +0 -179
  203. package/dist/tests/wiki-qa-fixes.test.js +0 -270
  204. package/dist/tests/wiki.test.js +0 -529
  205. package/dist/tests/workflow-cli.test.js +0 -271
  206. package/dist/tests/workflow-markdown.test.js +0 -171
  207. package/dist/tests/workflow-path-escape.test.js +0 -132
  208. package/dist/tests/workflow-qa-fixes.test.js +0 -395
  209. package/dist/tests/workflows/indexer-rejection.test.js +0 -213
  210. /package/dist/{src/cli.js → cli.js} +0 -0
  211. /package/dist/{src/commands → commands}/completions.js +0 -0
  212. /package/dist/{src/commands → commands}/config-cli.js +0 -0
  213. /package/dist/{src/commands → commands}/curate.js +0 -0
  214. /package/dist/{src/commands → commands}/distill.js +0 -0
  215. /package/dist/{src/commands → commands}/events.js +0 -0
  216. /package/dist/{src/commands → commands}/history.js +0 -0
  217. /package/dist/{src/commands → commands}/info.js +0 -0
  218. /package/dist/{src/commands → commands}/init.js +0 -0
  219. /package/dist/{src/commands → commands}/install-audit.js +0 -0
  220. /package/dist/{src/commands → commands}/installed-stashes.js +0 -0
  221. /package/dist/{src/commands → commands}/migration-help.js +0 -0
  222. /package/dist/{src/commands → commands}/proposal.js +0 -0
  223. /package/dist/{src/commands → commands}/propose.js +0 -0
  224. /package/dist/{src/commands → commands}/reflect.js +0 -0
  225. /package/dist/{src/commands → commands}/registry-search.js +0 -0
  226. /package/dist/{src/commands → commands}/remember.js +0 -0
  227. /package/dist/{src/commands → commands}/search.js +0 -0
  228. /package/dist/{src/commands → commands}/self-update.js +0 -0
  229. /package/dist/{src/commands → commands}/show.js +0 -0
  230. /package/dist/{src/commands → commands}/source-add.js +0 -0
  231. /package/dist/{src/commands → commands}/source-clone.js +0 -0
  232. /package/dist/{src/commands → commands}/source-manage.js +0 -0
  233. /package/dist/{src/commands → commands}/vault.js +0 -0
  234. /package/dist/{src/core → core}/asset-ref.js +0 -0
  235. /package/dist/{src/core → core}/asset-registry.js +0 -0
  236. /package/dist/{src/core → core}/asset-spec.js +0 -0
  237. /package/dist/{src/core → core}/common.js +0 -0
  238. /package/dist/{src/core → core}/config.js +0 -0
  239. /package/dist/{src/core → core}/errors.js +0 -0
  240. /package/dist/{src/core → core}/events.js +0 -0
  241. /package/dist/{src/core → core}/frontmatter.js +0 -0
  242. /package/dist/{src/core → core}/lesson-lint.js +0 -0
  243. /package/dist/{src/core → core}/markdown.js +0 -0
  244. /package/dist/{src/core → core}/paths.js +0 -0
  245. /package/dist/{src/core → core}/proposals.js +0 -0
  246. /package/dist/{src/core → core}/warn.js +0 -0
  247. /package/dist/{src/core → core}/write-source.js +0 -0
  248. /package/dist/{src/indexer → indexer}/db-search.js +0 -0
  249. /package/dist/{src/indexer → indexer}/db.js +0 -0
  250. /package/dist/{src/indexer → indexer}/file-context.js +0 -0
  251. /package/dist/{src/indexer → indexer}/graph-boost.js +0 -0
  252. /package/dist/{src/indexer → indexer}/graph-extraction.js +0 -0
  253. /package/dist/{src/indexer → indexer}/indexer.js +0 -0
  254. /package/dist/{src/indexer → indexer}/manifest.js +0 -0
  255. /package/dist/{src/indexer → indexer}/matchers.js +0 -0
  256. /package/dist/{src/indexer → indexer}/memory-inference.js +0 -0
  257. /package/dist/{src/indexer → indexer}/metadata.js +0 -0
  258. /package/dist/{src/indexer → indexer}/search-fields.js +0 -0
  259. /package/dist/{src/indexer → indexer}/search-source.js +0 -0
  260. /package/dist/{src/indexer → indexer}/semantic-status.js +0 -0
  261. /package/dist/{src/indexer → indexer}/usage-events.js +0 -0
  262. /package/dist/{src/indexer → indexer}/walker.js +0 -0
  263. /package/dist/{src/integrations → integrations}/agent/config.js +0 -0
  264. /package/dist/{src/integrations → integrations}/agent/detect.js +0 -0
  265. /package/dist/{src/integrations → integrations}/agent/index.js +0 -0
  266. /package/dist/{src/integrations → integrations}/agent/profiles.js +0 -0
  267. /package/dist/{src/integrations → integrations}/agent/prompts.js +0 -0
  268. /package/dist/{src/integrations → integrations}/agent/spawn.js +0 -0
  269. /package/dist/{src/integrations → integrations}/github.js +0 -0
  270. /package/dist/{src/integrations → integrations}/lockfile.js +0 -0
  271. /package/dist/{src/llm → llm}/client.js +0 -0
  272. /package/dist/{src/llm → llm}/embedder.js +0 -0
  273. /package/dist/{src/llm → llm}/embedders/cache.js +0 -0
  274. /package/dist/{src/llm → llm}/embedders/local.js +0 -0
  275. /package/dist/{src/llm → llm}/embedders/remote.js +0 -0
  276. /package/dist/{src/llm → llm}/embedders/types.js +0 -0
  277. /package/dist/{src/llm → llm}/feature-gate.js +0 -0
  278. /package/dist/{src/llm → llm}/graph-extract.js +0 -0
  279. /package/dist/{src/llm → llm}/index-passes.js +0 -0
  280. /package/dist/{src/llm → llm}/memory-infer.js +0 -0
  281. /package/dist/{src/llm → llm}/metadata-enhance.js +0 -0
  282. /package/dist/{src/output → output}/cli-hints.js +0 -0
  283. /package/dist/{src/output → output}/context.js +0 -0
  284. /package/dist/{src/output → output}/renderers.js +0 -0
  285. /package/dist/{src/output → output}/shapes.js +0 -0
  286. /package/dist/{src/output → output}/text.js +0 -0
  287. /package/dist/{src/registry → registry}/build-index.js +0 -0
  288. /package/dist/{src/registry → registry}/create-provider-registry.js +0 -0
  289. /package/dist/{src/registry → registry}/factory.js +0 -0
  290. /package/dist/{src/registry → registry}/origin-resolve.js +0 -0
  291. /package/dist/{src/registry → registry}/providers/index.js +0 -0
  292. /package/dist/{src/registry → registry}/providers/skills-sh.js +0 -0
  293. /package/dist/{src/registry → registry}/providers/static-index.js +0 -0
  294. /package/dist/{src/registry → registry}/providers/types.js +0 -0
  295. /package/dist/{src/registry → registry}/resolve.js +0 -0
  296. /package/dist/{src/registry → registry}/types.js +0 -0
  297. /package/dist/{src/setup → setup}/detect.js +0 -0
  298. /package/dist/{src/setup → setup}/ripgrep-install.js +0 -0
  299. /package/dist/{src/setup → setup}/ripgrep-resolve.js +0 -0
  300. /package/dist/{src/setup → setup}/setup.js +0 -0
  301. /package/dist/{src/setup → setup}/steps.js +0 -0
  302. /package/dist/{src/sources → sources}/include.js +0 -0
  303. /package/dist/{src/sources → sources}/provider-factory.js +0 -0
  304. /package/dist/{src/sources → sources}/provider.js +0 -0
  305. /package/dist/{src/sources → sources}/providers/filesystem.js +0 -0
  306. /package/dist/{src/sources → sources}/providers/git.js +0 -0
  307. /package/dist/{src/sources → sources}/providers/index.js +0 -0
  308. /package/dist/{src/sources → sources}/providers/install-types.js +0 -0
  309. /package/dist/{src/sources → sources}/providers/npm.js +0 -0
  310. /package/dist/{src/sources → sources}/providers/provider-utils.js +0 -0
  311. /package/dist/{src/sources → sources}/providers/sync-from-ref.js +0 -0
  312. /package/dist/{src/sources → sources}/providers/tar-utils.js +0 -0
  313. /package/dist/{src/sources → sources}/providers/website.js +0 -0
  314. /package/dist/{src/sources → sources}/resolve.js +0 -0
  315. /package/dist/{src/sources → sources}/types.js +0 -0
  316. /package/dist/{src/templates → templates}/wiki-templates.js +0 -0
  317. /package/dist/{src/version.js → version.js} +0 -0
  318. /package/dist/{src/wiki → wiki}/wiki.js +0 -0
  319. /package/dist/{src/workflows → workflows}/authoring.js +0 -0
  320. /package/dist/{src/workflows → workflows}/cli.js +0 -0
  321. /package/dist/{src/workflows → workflows}/db.js +0 -0
  322. /package/dist/{src/workflows → workflows}/document-cache.js +0 -0
  323. /package/dist/{src/workflows → workflows}/parser.js +0 -0
  324. /package/dist/{src/workflows → workflows}/renderer.js +0 -0
  325. /package/dist/{src/workflows → workflows}/runs.js +0 -0
  326. /package/dist/{src/workflows → workflows}/schema.js +0 -0
  327. /package/dist/{src/workflows → workflows}/validator.js +0 -0
@@ -1,179 +0,0 @@
1
- /**
2
- * Wave-2 QA fixes tests — Cluster E (output shapes, remember, info, vault, registry brief).
3
- *
4
- * #2 — `akm info` populates sourceProviders from stashDir when sources[] is empty.
5
- * #7 — `akm show` JSON shape always includes path + editable.
6
- * #20 — `akm remember --description` persisted in frontmatter.
7
- * #28 — `registry search --detail brief` projects name + installRef + score.
8
- * #35 — Vault list returns entries:[{key,comment}] instead of parallel arrays.
9
- */
10
- import { describe, expect, test } from "bun:test";
11
- import fs from "node:fs";
12
- import os from "node:os";
13
- import path from "node:path";
14
- import { buildMemoryFrontmatter } from "../src/commands/remember";
15
- import { listEntries } from "../src/commands/vault";
16
- import { shapeSearchHit, shapeShowOutput } from "../src/output/shapes";
17
- // ── #7: show shape includes path + editable ───────────────────────────────────
18
- describe("shapeShowOutput — path + editable always included (#7)", () => {
19
- const showResult = {
20
- type: "skill",
21
- name: "deploy",
22
- origin: null,
23
- action: "akm show skill:deploy",
24
- description: "Deploy script",
25
- path: "/home/user/stash/skills/deploy/SKILL.md",
26
- editable: true,
27
- editHint: "vim /home/user/stash/skills/deploy/SKILL.md",
28
- content: "# Deploy\nRun deploy.",
29
- };
30
- test("default detail includes path and editable", () => {
31
- const out = shapeShowOutput(showResult, "normal");
32
- expect(out).toHaveProperty("path");
33
- expect(out).toHaveProperty("editable");
34
- expect(out.path).toBe("/home/user/stash/skills/deploy/SKILL.md");
35
- expect(out.editable).toBe(true);
36
- });
37
- test("brief detail also includes path and editable", () => {
38
- const out = shapeShowOutput(showResult, "brief");
39
- expect(out).toHaveProperty("path");
40
- expect(out).toHaveProperty("editable");
41
- });
42
- test("full detail includes path, editable, and editHint", () => {
43
- const out = shapeShowOutput(showResult, "full");
44
- expect(out).toHaveProperty("path");
45
- expect(out).toHaveProperty("editable");
46
- expect(out).toHaveProperty("editHint");
47
- });
48
- test("agent mode does NOT expose path (security: keep in non-agent shape only)", () => {
49
- const out = shapeShowOutput(showResult, "normal", /* forAgent */ true);
50
- // Agent mode picks a minimal subset; path is not in that subset
51
- expect(out.editable).toBeUndefined();
52
- expect(out.path).toBeUndefined();
53
- });
54
- });
55
- // ── #28: registry brief projects name + installRef + score ───────────────────
56
- describe("shapeSearchHit — registry brief projects name + score (#28)", () => {
57
- // v1 spec §4.2: registry hits no longer carry the legacy `curated` boolean.
58
- const registryHit = {
59
- type: "registry",
60
- title: "deploy-stash",
61
- name: "deploy-stash",
62
- installRef: "npm:@myorg/deploy-stash",
63
- description: "A deployment stash",
64
- action: "akm add npm:@myorg/deploy-stash -> then search again",
65
- score: 0.85,
66
- };
67
- test("brief includes name, installRef, score", () => {
68
- const out = shapeSearchHit(registryHit, "brief");
69
- expect(out.name).toBeTruthy();
70
- expect(out.score).toBe(0.85);
71
- // installRef should be present when it exists
72
- expect(out.installRef).toBe("npm:@myorg/deploy-stash");
73
- });
74
- test("brief with only title (no name field): normalises title → name", () => {
75
- const hit = {
76
- type: "registry",
77
- title: "some-kit",
78
- installRef: "github:org/some-kit",
79
- score: 0.5,
80
- };
81
- const out = shapeSearchHit(hit, "brief");
82
- expect(out.name).toBe("some-kit");
83
- });
84
- test("brief does NOT return empty object for registry hits", () => {
85
- const out = shapeSearchHit(registryHit, "brief");
86
- expect(Object.keys(out).length).toBeGreaterThan(0);
87
- });
88
- test("normal mode keeps description, action, installRef, score (curated removed in v1)", () => {
89
- const out = shapeSearchHit(registryHit, "normal");
90
- expect(out.description).toBeDefined();
91
- expect(out.installRef).toBeDefined();
92
- expect(out.score).toBe(0.85);
93
- expect(out).not.toHaveProperty("curated");
94
- });
95
- });
96
- // ── #20: --description persisted in frontmatter ──────────────────────────────
97
- describe("buildMemoryFrontmatter — description field (#20)", () => {
98
- test("description is included when present", () => {
99
- const fm = buildMemoryFrontmatter({
100
- description: "Short description of this memory",
101
- tags: ["test"],
102
- });
103
- expect(fm).toContain("description:");
104
- expect(fm).toContain("Short description of this memory");
105
- });
106
- test("description is omitted when not present", () => {
107
- const fm = buildMemoryFrontmatter({ tags: ["test"] });
108
- expect(fm).not.toContain("description:");
109
- });
110
- test("description is omitted when empty", () => {
111
- const fm = buildMemoryFrontmatter({ description: "", tags: ["test"] });
112
- expect(fm).not.toContain("description:");
113
- });
114
- test("description is omitted when whitespace only", () => {
115
- const fm = buildMemoryFrontmatter({ description: " ", tags: ["test"] });
116
- expect(fm).not.toContain("description:");
117
- });
118
- test("description with special chars is safely serialised", () => {
119
- const fm = buildMemoryFrontmatter({
120
- description: 'value with: "quotes" and \nnewlines',
121
- tags: ["test"],
122
- });
123
- expect(fm).toContain("description:");
124
- // Should be quoted to handle special chars
125
- });
126
- });
127
- // ── #35: vault list returns entries:[{key,comment}] ──────────────────────────
128
- describe("vault listEntries — entries shape (#35)", () => {
129
- function makeTmpVault(content) {
130
- const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "akm-vault-test-"));
131
- const vaultPath = path.join(tmpDir, "test.env");
132
- fs.writeFileSync(vaultPath, content);
133
- return vaultPath;
134
- }
135
- test("returns empty array for nonexistent vault", () => {
136
- const result = listEntries("/tmp/nonexistent-vault-file-xyz.env");
137
- expect(result).toEqual([]);
138
- });
139
- test("returns keys without comments for uncommented vault", () => {
140
- const vaultPath = makeTmpVault("DB_URL=postgres://localhost\nAPI_KEY=secret\n");
141
- const entries = listEntries(vaultPath);
142
- expect(entries.map((e) => e.key)).toEqual(["DB_URL", "API_KEY"]);
143
- expect(entries.every((e) => e.comment === undefined)).toBe(true);
144
- });
145
- test("associates comment with the following key", () => {
146
- const vaultPath = makeTmpVault("# Database connection URL\nDB_URL=postgres://localhost\n");
147
- const entries = listEntries(vaultPath);
148
- expect(entries).toHaveLength(1);
149
- expect(entries[0].key).toBe("DB_URL");
150
- expect(entries[0].comment).toBe("Database connection URL");
151
- });
152
- test("returns {key, comment} shape", () => {
153
- const vaultPath = makeTmpVault("# API key\nAPI_KEY=secret\n# DB\nDB_URL=pg://localhost\n");
154
- const entries = listEntries(vaultPath);
155
- expect(entries).toHaveLength(2);
156
- expect(entries[0]).toMatchObject({ key: "API_KEY", comment: "API key" });
157
- expect(entries[1]).toMatchObject({ key: "DB_URL", comment: "DB" });
158
- });
159
- test("duplicate keys: only first occurrence kept", () => {
160
- const vaultPath = makeTmpVault("DB_URL=first\nDB_URL=second\n");
161
- const entries = listEntries(vaultPath);
162
- expect(entries.map((e) => e.key)).toEqual(["DB_URL"]);
163
- });
164
- test("entry has no comment field when there's no preceding comment", () => {
165
- const vaultPath = makeTmpVault("API_KEY=abc\n");
166
- const entries = listEntries(vaultPath);
167
- expect(entries[0].comment).toBeUndefined();
168
- });
169
- });
170
- // ── #2: info sourceProviders from stashDir ────────────────────────────────────
171
- describe("assembleInfo — sourceProviders populated from stashDir (#2)", () => {
172
- test("sourceProviders includes stashDir when sources[] is empty", () => {
173
- const { assembleInfo } = require("../src/commands/info");
174
- // We can't easily override loadConfig, but we can verify the function shape.
175
- // The actual integration is tested via the info-command.test.ts suite.
176
- // This is a unit-level smoke test that the function signature is stable.
177
- expect(typeof assembleInfo).toBe("function");
178
- });
179
- });
@@ -1,270 +0,0 @@
1
- /**
2
- * Regression tests for the 0.5.0 QA wiki fixes.
3
- *
4
- * Covers:
5
- * 1. searchInWiki excludes schema.md, index.md, and log.md.
6
- * 2. stashRaw with explicitSlug: true throws UsageError on collision;
7
- * with explicitSlug: false auto-increments.
8
- * 3. lintWiki emits broken-source findings for dangling sources: refs.
9
- * 4. validateWikiName error message includes "lowercase".
10
- * 5. wiki search on a nonexistent wiki throws NotFoundError.
11
- */
12
- import { afterEach, describe, expect, test } from "bun:test";
13
- import fs from "node:fs";
14
- import os from "node:os";
15
- import path from "node:path";
16
- import { UsageError } from "../src/core/errors";
17
- import { createWiki, INDEX_MD, LOG_MD, lintWiki, SCHEMA_MD, searchInWiki, stashRaw, validateWikiName, WIKIS_SUBDIR, } from "../src/wiki/wiki";
18
- const tempDirs = [];
19
- function makeStash(prefix = "akm-wiki-qa-") {
20
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
21
- tempDirs.push(dir);
22
- return dir;
23
- }
24
- function writePage(wikiDir, relPath, body) {
25
- const abs = path.join(wikiDir, relPath);
26
- fs.mkdirSync(path.dirname(abs), { recursive: true });
27
- fs.writeFileSync(abs, body, "utf8");
28
- return abs;
29
- }
30
- afterEach(() => {
31
- for (const dir of tempDirs.splice(0)) {
32
- fs.rmSync(dir, { recursive: true, force: true });
33
- }
34
- });
35
- /**
36
- * Set up an isolated stash env for searchInWiki tests.
37
- * Returns the stash dir and a cleanup function.
38
- */
39
- function withIsolatedStash() {
40
- const stash = makeStash();
41
- const origStash = process.env.AKM_STASH_DIR;
42
- const origHome = process.env.XDG_CONFIG_HOME;
43
- const tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), "akm-wiki-qa-home-"));
44
- tempDirs.push(tmpHome);
45
- process.env.AKM_STASH_DIR = stash;
46
- process.env.XDG_CONFIG_HOME = tmpHome;
47
- return {
48
- stash,
49
- cleanup() {
50
- if (origStash === undefined)
51
- delete process.env.AKM_STASH_DIR;
52
- else
53
- process.env.AKM_STASH_DIR = origStash;
54
- if (origHome === undefined)
55
- delete process.env.XDG_CONFIG_HOME;
56
- else
57
- process.env.XDG_CONFIG_HOME = origHome;
58
- },
59
- };
60
- }
61
- // ── 1. searchInWiki excludes infrastructure files ───────────────────────────
62
- describe("searchInWiki — infrastructure file exclusion", () => {
63
- test("excludes schema.md, index.md, log.md from results", async () => {
64
- const { stash, cleanup } = withIsolatedStash();
65
- try {
66
- createWiki(stash, "research");
67
- const wikiDir = path.join(stash, WIKIS_SUBDIR, "research");
68
- writePage(wikiDir, "ml-basics.md", "---\ndescription: Machine learning basics\n---\n# ML Basics\nContent.\n");
69
- const response = await searchInWiki({
70
- stashDir: stash,
71
- wikiName: "research",
72
- query: "machine learning",
73
- });
74
- // All returned hits must not be special infrastructure files
75
- for (const hit of response.hits) {
76
- if (hit.type === "registry")
77
- continue;
78
- const stashHit = hit;
79
- if (!stashHit.path)
80
- continue;
81
- const basename = path.basename(stashHit.path);
82
- expect([SCHEMA_MD, INDEX_MD, LOG_MD]).not.toContain(basename);
83
- }
84
- }
85
- finally {
86
- cleanup();
87
- }
88
- });
89
- test("does not exclude real page files", async () => {
90
- const { stash, cleanup } = withIsolatedStash();
91
- try {
92
- createWiki(stash, "research");
93
- const wikiDir = path.join(stash, WIKIS_SUBDIR, "research");
94
- writePage(wikiDir, "valid-page.md", "---\ndescription: A real page\n---\n# Valid\n");
95
- // No assertion about hit presence (index may be absent); just no throw.
96
- const response = await searchInWiki({
97
- stashDir: stash,
98
- wikiName: "research",
99
- query: "real page",
100
- });
101
- expect(response).toBeDefined();
102
- expect(Array.isArray(response.hits)).toBe(true);
103
- }
104
- finally {
105
- cleanup();
106
- }
107
- });
108
- });
109
- // ── 2. stashRaw explicitSlug collision behaviour ─────────────────────────────
110
- describe("stashRaw — explicitSlug", () => {
111
- test("explicitSlug: true throws UsageError on collision", () => {
112
- const stash = makeStash();
113
- createWiki(stash, "research");
114
- // First write succeeds
115
- stashRaw({
116
- stashDir: stash,
117
- wikiName: "research",
118
- content: "first",
119
- preferredName: "mysource",
120
- explicitSlug: true,
121
- });
122
- // Second write with same slug and explicitSlug: true must throw
123
- expect(() => stashRaw({
124
- stashDir: stash,
125
- wikiName: "research",
126
- content: "second",
127
- preferredName: "mysource",
128
- explicitSlug: true,
129
- })).toThrow(UsageError);
130
- });
131
- test("UsageError message mentions the slug, 'already exists', and '--as'", () => {
132
- const stash = makeStash();
133
- createWiki(stash, "research");
134
- stashRaw({ stashDir: stash, wikiName: "research", content: "first", preferredName: "myslug", explicitSlug: true });
135
- let caught;
136
- try {
137
- stashRaw({
138
- stashDir: stash,
139
- wikiName: "research",
140
- content: "second",
141
- preferredName: "myslug",
142
- explicitSlug: true,
143
- });
144
- }
145
- catch (e) {
146
- caught = e;
147
- }
148
- expect(caught).toBeInstanceOf(UsageError);
149
- expect(caught?.message).toContain("myslug");
150
- expect(caught?.message).toContain("already exists");
151
- expect(caught?.message).toContain("--as");
152
- });
153
- test("explicitSlug: false auto-increments on collision (existing behaviour)", () => {
154
- const stash = makeStash();
155
- createWiki(stash, "research");
156
- const r1 = stashRaw({
157
- stashDir: stash,
158
- wikiName: "research",
159
- content: "a",
160
- preferredName: "dup",
161
- explicitSlug: false,
162
- });
163
- const r2 = stashRaw({
164
- stashDir: stash,
165
- wikiName: "research",
166
- content: "b",
167
- preferredName: "dup",
168
- explicitSlug: false,
169
- });
170
- expect(r1.slug).toBe("dup");
171
- expect(r2.slug).toBe("dup-1");
172
- });
173
- test("explicitSlug: undefined auto-increments (backward-compat)", () => {
174
- const stash = makeStash();
175
- createWiki(stash, "research");
176
- const r1 = stashRaw({ stashDir: stash, wikiName: "research", content: "a", preferredName: "nodups" });
177
- const r2 = stashRaw({ stashDir: stash, wikiName: "research", content: "b", preferredName: "nodups" });
178
- expect(r1.slug).toBe("nodups");
179
- expect(r2.slug).toBe("nodups-1");
180
- });
181
- test("explicitSlug: true on a new slug does NOT throw", () => {
182
- const stash = makeStash();
183
- createWiki(stash, "research");
184
- expect(() => stashRaw({ stashDir: stash, wikiName: "research", content: "x", preferredName: "brand-new", explicitSlug: true })).not.toThrow();
185
- });
186
- });
187
- // ── 3. lintWiki broken-source findings ──────────────────────────────────────
188
- describe("lintWiki — broken-source", () => {
189
- test("emits broken-source finding when sources: references a missing raw file", () => {
190
- const stash = makeStash();
191
- createWiki(stash, "research");
192
- const wikiDir = path.join(stash, WIKIS_SUBDIR, "research");
193
- // Page that references a raw file that doesn't exist
194
- writePage(wikiDir, "orphaned-page.md", "---\ndescription: Page with dangling source ref\nxrefs:\n - wiki:research/orphaned-page\nsources:\n - raw/ghost-paper\n---\n# Orphaned\n");
195
- const report = lintWiki(stash, "research");
196
- const brokenSrc = report.findings.filter((f) => f.kind === "broken-source");
197
- expect(brokenSrc.length).toBeGreaterThanOrEqual(1);
198
- expect(brokenSrc[0].refs[0]).toBe("wiki:research/orphaned-page");
199
- expect(brokenSrc[0].message).toContain("ghost-paper");
200
- });
201
- test("does NOT emit broken-source when raw file exists", () => {
202
- const stash = makeStash();
203
- createWiki(stash, "research");
204
- const wikiDir = path.join(stash, WIKIS_SUBDIR, "research");
205
- // Stash the raw file first
206
- stashRaw({ stashDir: stash, wikiName: "research", content: "raw content", preferredName: "real-paper" });
207
- // Page citing the existing raw file — must NOT trigger broken-source
208
- writePage(wikiDir, "good-page.md", "---\ndescription: Page with valid source ref\nxrefs:\n - wiki:research/good-page\nsources:\n - raw/real-paper\n---\n# Good\n");
209
- const report = lintWiki(stash, "research");
210
- const brokenSrc = report.findings.filter((f) => f.kind === "broken-source");
211
- expect(brokenSrc.length).toBe(0);
212
- });
213
- test("accepts both 'raw/slug' and 'raw/slug.md' source forms", () => {
214
- const stash = makeStash();
215
- createWiki(stash, "research");
216
- const wikiDir = path.join(stash, WIKIS_SUBDIR, "research");
217
- stashRaw({ stashDir: stash, wikiName: "research", content: "raw", preferredName: "existing-slug" });
218
- // Cite with .md extension — should not break
219
- writePage(wikiDir, "page-with-ext.md", "---\ndescription: Cites with .md extension\nxrefs:\n - wiki:research/page-with-ext\nsources:\n - raw/existing-slug.md\n---\n# Ext\n");
220
- const report = lintWiki(stash, "research");
221
- const brokenSrc = report.findings.filter((f) => f.kind === "broken-source");
222
- expect(brokenSrc.length).toBe(0);
223
- });
224
- });
225
- // ── 4. validateWikiName error message includes "lowercase" ───────────────────
226
- describe("validateWikiName — error message", () => {
227
- test("error message says 'lowercase' when name has uppercase letters", () => {
228
- let caught;
229
- try {
230
- validateWikiName("MyWiki");
231
- }
232
- catch (e) {
233
- caught = e;
234
- }
235
- expect(caught).toBeInstanceOf(UsageError);
236
- expect(caught?.message.toLowerCase()).toContain("lowercase");
237
- });
238
- test("error message says 'lowercase' for leading-hyphen names", () => {
239
- let caught;
240
- try {
241
- validateWikiName("-bad");
242
- }
243
- catch (e) {
244
- caught = e;
245
- }
246
- expect(caught).toBeInstanceOf(UsageError);
247
- expect(caught?.message.toLowerCase()).toContain("lowercase");
248
- });
249
- });
250
- // ── 5. searchInWiki on nonexistent wiki throws NotFoundError ─────────────────
251
- describe("searchInWiki — nonexistent wiki", () => {
252
- test("throws (via validateWikiName) for invalid wiki names", () => {
253
- const stash = makeStash();
254
- // An uppercase name fails validateWikiName, which is called by searchInWiki
255
- expect(() => searchInWiki({ stashDir: stash, wikiName: "BadName", query: "test" })).toThrow();
256
- });
257
- test("valid-but-missing wiki name returns zero hits (path-filter drops everything)", async () => {
258
- // searchInWiki itself does not throw for a valid-but-absent wiki dir — it
259
- // just returns zero hits because the path-filter drops all non-wiki-dir
260
- // paths. The CLI layer adds the explicit existence check.
261
- const { stash, cleanup } = withIsolatedStash();
262
- try {
263
- const response = await searchInWiki({ stashDir: stash, wikiName: "nonexistent", query: "test" });
264
- expect(response.hits).toEqual([]);
265
- }
266
- finally {
267
- cleanup();
268
- }
269
- });
270
- });