akm-cli 0.6.1 → 0.7.0
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.
- package/CHANGELOG.md +66 -0
- package/dist/{cli.js → src/cli.js} +712 -34
- package/dist/{commands → src/commands}/config-cli.js +47 -4
- package/dist/src/commands/distill.js +283 -0
- package/dist/src/commands/events.js +108 -0
- package/dist/src/commands/history.js +191 -0
- package/dist/{commands → src/commands}/installed-stashes.js +1 -1
- package/dist/src/commands/proposal.js +119 -0
- package/dist/src/commands/propose.js +171 -0
- package/dist/src/commands/reflect.js +193 -0
- package/dist/{commands → src/commands}/registry-search.js +71 -7
- package/dist/{commands → src/commands}/remember.js +12 -0
- package/dist/{commands → src/commands}/search.js +104 -4
- package/dist/{commands → src/commands}/self-update.js +4 -3
- package/dist/{commands → src/commands}/show.js +73 -0
- package/dist/{commands → src/commands}/source-add.js +5 -1
- package/dist/{commands → src/commands}/source-manage.js +7 -1
- package/dist/{core → src/core}/asset-ref.js +5 -5
- package/dist/{core → src/core}/asset-spec.js +12 -0
- package/dist/{core → src/core}/common.js +1 -1
- package/dist/{core → src/core}/config.js +203 -121
- package/dist/{core → src/core}/errors.js +4 -0
- package/dist/src/core/events.js +239 -0
- package/dist/src/core/lesson-lint.js +86 -0
- package/dist/src/core/proposals.js +406 -0
- package/dist/src/core/warn.js +72 -0
- package/dist/{core → src/core}/write-source.js +80 -5
- package/dist/{indexer → src/indexer}/db-search.js +114 -24
- package/dist/{indexer → src/indexer}/db.js +76 -23
- package/dist/{indexer → src/indexer}/file-context.js +0 -3
- package/dist/src/indexer/graph-boost.js +179 -0
- package/dist/src/indexer/graph-extraction.js +212 -0
- package/dist/{indexer → src/indexer}/indexer.js +88 -7
- package/dist/{indexer → src/indexer}/matchers.js +1 -1
- package/dist/src/indexer/memory-inference.js +263 -0
- package/dist/{indexer → src/indexer}/metadata.js +111 -3
- package/dist/{indexer → src/indexer}/search-source.js +4 -2
- package/dist/src/integrations/agent/config.js +292 -0
- package/dist/src/integrations/agent/detect.js +94 -0
- package/dist/src/integrations/agent/index.js +17 -0
- package/dist/src/integrations/agent/profiles.js +65 -0
- package/dist/src/integrations/agent/prompts.js +167 -0
- package/dist/src/integrations/agent/spawn.js +272 -0
- package/dist/{integrations → src/integrations}/github.js +9 -3
- package/dist/{integrations → src/integrations}/lockfile.js +0 -26
- package/dist/{llm → src/llm}/client.js +33 -2
- package/dist/{llm → src/llm}/embedders/remote.js +37 -3
- package/dist/src/llm/feature-gate.js +108 -0
- package/dist/src/llm/graph-extract.js +107 -0
- package/dist/src/llm/index-passes.js +35 -0
- package/dist/src/llm/memory-infer.js +86 -0
- package/dist/{output → src/output}/cli-hints.js +15 -2
- package/dist/{output → src/output}/renderers.js +63 -2
- package/dist/src/output/shapes.js +523 -0
- package/dist/src/output/text.js +1116 -0
- package/dist/{registry → src/registry}/build-index.js +19 -8
- package/dist/{registry → src/registry}/factory.js +0 -8
- package/dist/{registry → src/registry}/providers/static-index.js +6 -3
- package/dist/{registry → src/registry}/resolve.js +68 -2
- package/dist/{setup → src/setup}/setup.js +52 -5
- package/dist/{sources → src/sources}/providers/git.js +7 -15
- package/dist/{wiki → src/wiki}/wiki.js +54 -6
- package/dist/{workflows → src/workflows}/runs.js +37 -3
- package/dist/tests/add-website-source.test.js +119 -0
- package/dist/tests/agent/agent-config-loader.test.js +70 -0
- package/dist/tests/agent/agent-config.test.js +221 -0
- package/dist/tests/agent/agent-detect.test.js +100 -0
- package/dist/tests/agent/agent-spawn.test.js +234 -0
- package/dist/tests/agent-output.test.js +186 -0
- package/dist/tests/architecture/agent-no-llm-sdk-guard.test.js +103 -0
- package/dist/tests/architecture/agent-spawn-seam.test.js +193 -0
- package/dist/tests/architecture/llm-stateless-seam.test.js +112 -0
- package/dist/tests/asset-ref.test.js +192 -0
- package/dist/tests/asset-registry.test.js +103 -0
- package/dist/tests/asset-spec.test.js +241 -0
- package/dist/tests/bench/attribution.test.js +996 -0
- package/dist/tests/bench/cleanup-sigint.test.js +83 -0
- package/dist/tests/bench/cleanup.js +234 -0
- package/dist/tests/bench/cleanup.test.js +166 -0
- package/dist/tests/bench/cli.js +1018 -0
- package/dist/tests/bench/cli.test.js +445 -0
- package/dist/tests/bench/compare.test.js +556 -0
- package/dist/tests/bench/corpus.js +317 -0
- package/dist/tests/bench/corpus.test.js +258 -0
- package/dist/tests/bench/doctor.js +525 -0
- package/dist/tests/bench/driver.js +401 -0
- package/dist/tests/bench/driver.test.js +584 -0
- package/dist/tests/bench/environment.js +233 -0
- package/dist/tests/bench/environment.test.js +199 -0
- package/dist/tests/bench/evolve-metrics.js +179 -0
- package/dist/tests/bench/evolve-metrics.test.js +187 -0
- package/dist/tests/bench/evolve.js +647 -0
- package/dist/tests/bench/evolve.test.js +624 -0
- package/dist/tests/bench/failure-modes.test.js +349 -0
- package/dist/tests/bench/feedback-integrity.test.js +457 -0
- package/dist/tests/bench/leakage.test.js +228 -0
- package/dist/tests/bench/learning-curve.test.js +134 -0
- package/dist/tests/bench/metrics.js +2395 -0
- package/dist/tests/bench/metrics.test.js +1150 -0
- package/dist/tests/bench/no-os-tmpdir-invariant.test.js +43 -0
- package/dist/tests/bench/opencode-config.js +194 -0
- package/dist/tests/bench/opencode-config.test.js +370 -0
- package/dist/tests/bench/report.js +1885 -0
- package/dist/tests/bench/report.test.js +1038 -0
- package/dist/tests/bench/run-config.js +355 -0
- package/dist/tests/bench/run-config.test.js +298 -0
- package/dist/tests/bench/run-curate-test.js +32 -0
- package/dist/tests/bench/run-failing-tasks.js +56 -0
- package/dist/tests/bench/run-full-bench.js +51 -0
- package/dist/tests/bench/run-items36-targeted.js +69 -0
- package/dist/tests/bench/run-nano-quick.js +42 -0
- package/dist/tests/bench/run-waveg-targeted.js +62 -0
- package/dist/tests/bench/runner.js +699 -0
- package/dist/tests/bench/runner.test.js +958 -0
- package/dist/tests/bench/search-bridge.test.js +331 -0
- package/dist/tests/bench/tmp.js +131 -0
- package/dist/tests/bench/trajectory.js +116 -0
- package/dist/tests/bench/trajectory.test.js +127 -0
- package/dist/tests/bench/verifier.js +114 -0
- package/dist/tests/bench/verifier.test.js +118 -0
- package/dist/tests/bench/workflow-evaluator.js +557 -0
- package/dist/tests/bench/workflow-evaluator.test.js +421 -0
- package/dist/tests/bench/workflow-spec.js +345 -0
- package/dist/tests/bench/workflow-spec.test.js +363 -0
- package/dist/tests/bench/workflow-trace.js +472 -0
- package/dist/tests/bench/workflow-trace.test.js +254 -0
- package/dist/tests/benchmark-search-quality.js +536 -0
- package/dist/tests/benchmark-suite.js +1441 -0
- package/dist/tests/capture-cli.test.js +112 -0
- package/dist/tests/cli-errors.test.js +204 -0
- package/dist/tests/commands/events.test.js +370 -0
- package/dist/tests/commands/history.test.js +418 -0
- package/dist/tests/commands/import.test.js +103 -0
- package/dist/tests/commands/proposal-cli.test.js +209 -0
- package/dist/tests/commands/reflect-propose-cli.test.js +333 -0
- package/dist/tests/commands/remember.test.js +97 -0
- package/dist/tests/commands/scope-flags.test.js +300 -0
- package/dist/tests/commands/search.test.js +537 -0
- package/dist/tests/commands/show-indexer-parity.test.js +117 -0
- package/dist/tests/commands/show.test.js +294 -0
- package/dist/tests/common.test.js +266 -0
- package/dist/tests/completions.test.js +142 -0
- package/dist/tests/config-cli.test.js +193 -0
- package/dist/tests/config-llm-features.test.js +139 -0
- package/dist/tests/config.test.js +569 -0
- package/dist/tests/contracts/migration-baseline.test.js +43 -0
- package/dist/tests/contracts/reflect-propose-envelope.test.js +139 -0
- package/dist/tests/contracts/spec-helpers.js +46 -0
- package/dist/tests/contracts/v1-spec-section-11-proposal-queue.test.js +228 -0
- package/dist/tests/contracts/v1-spec-section-12-agent-config.test.js +56 -0
- package/dist/tests/contracts/v1-spec-section-13-lesson-type.test.js +34 -0
- package/dist/tests/contracts/v1-spec-section-14-llm-features.test.js +94 -0
- package/dist/tests/contracts/v1-spec-section-4-1-asset-types.test.js +39 -0
- package/dist/tests/contracts/v1-spec-section-4-2-quality-rules.test.js +44 -0
- package/dist/tests/contracts/v1-spec-section-5-configuration.test.js +47 -0
- package/dist/tests/contracts/v1-spec-section-6-orchestration.test.js +40 -0
- package/dist/tests/contracts/v1-spec-section-7-module-layout.test.js +58 -0
- package/dist/tests/contracts/v1-spec-section-8-extension-points.test.js +34 -0
- package/dist/tests/contracts/v1-spec-section-9-4-cli-surface.test.js +75 -0
- package/dist/tests/contracts/v1-spec-section-9-7-llm-agent-boundary.test.js +36 -0
- package/dist/tests/core/write-source.test.js +366 -0
- package/dist/tests/curate-command.test.js +87 -0
- package/dist/tests/db-scoring.test.js +201 -0
- package/dist/tests/db.test.js +654 -0
- package/dist/tests/distill-cli-flag.test.js +208 -0
- package/dist/tests/distill.test.js +515 -0
- package/dist/tests/docker-install.test.js +120 -0
- package/dist/tests/e2e.test.js +1419 -0
- package/dist/tests/embedder.test.js +340 -0
- package/dist/tests/embedding-model-config.test.js +379 -0
- package/dist/tests/feedback-command.test.js +172 -0
- package/dist/tests/file-context.test.js +552 -0
- package/dist/tests/fixtures/scripts/git/summarize-diff.js +9 -0
- package/dist/tests/fixtures/scripts/lint/eslint-check.js +7 -0
- package/dist/tests/fixtures/stashes/load.js +166 -0
- package/dist/tests/fixtures/stashes/load.test.js +97 -0
- package/dist/tests/fixtures/stashes/ranking-baseline/scripts/mem0-search.js +12 -0
- package/dist/tests/frontmatter.test.js +190 -0
- package/dist/tests/fts-field-weighting.test.js +254 -0
- package/dist/tests/fuzzy-search.test.js +230 -0
- package/dist/tests/git-provider-clone.test.js +45 -0
- package/dist/tests/github.test.js +161 -0
- package/dist/tests/graph-boost-ranking.test.js +305 -0
- package/dist/tests/graph-extraction.test.js +282 -0
- package/dist/tests/helpers/usage-events.js +8 -0
- package/dist/tests/index-pass-llm.test.js +161 -0
- package/dist/tests/indexer.test.js +570 -0
- package/dist/tests/info-command.test.js +166 -0
- package/dist/tests/init.test.js +69 -0
- package/dist/tests/install-script.test.js +246 -0
- package/dist/tests/integration/agent-real-profile.test.js +94 -0
- package/dist/tests/issue-36-repro.test.js +304 -0
- package/dist/tests/issues-191-194.test.js +160 -0
- package/dist/tests/lesson-lint.test.js +111 -0
- package/dist/tests/llm-client.test.js +115 -0
- package/dist/tests/llm-feature-gate.test.js +151 -0
- package/dist/tests/llm.test.js +139 -0
- package/dist/tests/lockfile.test.js +216 -0
- package/dist/tests/manifest.test.js +205 -0
- package/dist/tests/markdown.test.js +126 -0
- package/dist/tests/matchers-unit.test.js +189 -0
- package/dist/tests/memory-inference.test.js +299 -0
- package/dist/tests/merge-scoring.test.js +136 -0
- package/dist/tests/metadata.test.js +313 -0
- package/dist/tests/migration-help.test.js +89 -0
- package/dist/tests/origin-resolve.test.js +124 -0
- package/dist/tests/output-baseline.test.js +218 -0
- package/dist/tests/output-shapes-unit.test.js +478 -0
- package/dist/tests/parallel-search.test.js +272 -0
- package/dist/tests/parameter-metadata.test.js +365 -0
- package/dist/tests/paths.test.js +177 -0
- package/dist/tests/progressive-disclosure.test.js +280 -0
- package/dist/tests/proposals.test.js +279 -0
- package/dist/tests/proposed-quality.test.js +271 -0
- package/dist/tests/provider-registry.test.js +32 -0
- package/dist/tests/ranking-regression.test.js +548 -0
- package/dist/tests/reflect-propose.test.js +455 -0
- package/dist/tests/registry-build-index.test.js +394 -0
- package/dist/tests/registry-cli.test.js +290 -0
- package/dist/tests/registry-index-v2.test.js +430 -0
- package/dist/tests/registry-install.test.js +728 -0
- package/dist/tests/registry-providers/parity.test.js +189 -0
- package/dist/tests/registry-providers/skills-sh.test.js +309 -0
- package/dist/tests/registry-providers/static-index.test.js +238 -0
- package/dist/tests/registry-resolve.test.js +126 -0
- package/dist/tests/registry-search.test.js +923 -0
- package/dist/tests/remember-frontmatter.test.js +378 -0
- package/dist/tests/remember-unit.test.js +123 -0
- package/dist/tests/ripgrep-install.test.js +251 -0
- package/dist/tests/ripgrep-resolve.test.js +108 -0
- package/dist/tests/ripgrep.test.js +163 -0
- package/dist/tests/save-command.test.js +94 -0
- package/dist/tests/save-trust-qa-fixes.test.js +270 -0
- package/dist/tests/scoring-pipeline.test.js +648 -0
- package/dist/tests/search-include-proposed-cli.test.js +118 -0
- package/dist/tests/self-update.test.js +442 -0
- package/dist/tests/semantic-search-e2e.test.js +512 -0
- package/dist/tests/semantic-status.test.js +471 -0
- package/dist/tests/setup-run.integration.js +877 -0
- package/dist/tests/setup-wizard.test.js +198 -0
- package/dist/tests/setup.test.js +131 -0
- package/dist/tests/source-add.test.js +11 -0
- package/dist/tests/source-clone.test.js +254 -0
- package/dist/tests/source-manage.test.js +366 -0
- package/dist/tests/source-providers/filesystem.test.js +82 -0
- package/dist/tests/source-providers/git.test.js +252 -0
- package/dist/tests/source-providers/website.test.js +128 -0
- package/dist/tests/source-qa-fixes.test.js +286 -0
- package/dist/tests/source-registry.test.js +350 -0
- package/dist/tests/source-resolve.test.js +100 -0
- package/dist/tests/source-source.test.js +281 -0
- package/dist/tests/source.test.js +533 -0
- package/dist/tests/tar-utils-scan.test.js +73 -0
- package/dist/tests/toggle-components.test.js +73 -0
- package/dist/tests/usage-telemetry.test.js +265 -0
- package/dist/tests/utility-scoring.test.js +558 -0
- package/dist/tests/vault-load-error.test.js +78 -0
- package/dist/tests/vault-qa-fixes.test.js +194 -0
- package/dist/tests/vault.test.js +429 -0
- package/dist/tests/vector-search.test.js +608 -0
- package/dist/tests/walker.test.js +252 -0
- package/dist/tests/wave2-cluster-bc.test.js +228 -0
- package/dist/tests/wave2-cluster-d.test.js +180 -0
- package/dist/tests/wave2-cluster-e.test.js +179 -0
- package/dist/tests/wiki-qa-fixes.test.js +270 -0
- package/dist/tests/wiki.test.js +529 -0
- package/dist/tests/workflow-cli.test.js +271 -0
- package/dist/tests/workflow-markdown.test.js +171 -0
- package/dist/tests/workflow-path-escape.test.js +132 -0
- package/dist/tests/workflow-qa-fixes.test.js +395 -0
- package/dist/tests/workflows/indexer-rejection.test.js +213 -0
- package/docs/README.md +8 -0
- package/docs/migration/release-notes/0.7.0.md +244 -0
- package/package.json +2 -2
- package/dist/core/warn.js +0 -27
- package/dist/output/shapes.js +0 -212
- package/dist/output/text.js +0 -520
- /package/dist/{commands → src/commands}/completions.js +0 -0
- /package/dist/{commands → src/commands}/curate.js +0 -0
- /package/dist/{commands → src/commands}/info.js +0 -0
- /package/dist/{commands → src/commands}/init.js +0 -0
- /package/dist/{commands → src/commands}/install-audit.js +0 -0
- /package/dist/{commands → src/commands}/migration-help.js +0 -0
- /package/dist/{commands → src/commands}/source-clone.js +0 -0
- /package/dist/{commands → src/commands}/vault.js +0 -0
- /package/dist/{core → src/core}/asset-registry.js +0 -0
- /package/dist/{core → src/core}/frontmatter.js +0 -0
- /package/dist/{core → src/core}/markdown.js +0 -0
- /package/dist/{core → src/core}/paths.js +0 -0
- /package/dist/{indexer → src/indexer}/manifest.js +0 -0
- /package/dist/{indexer → src/indexer}/search-fields.js +0 -0
- /package/dist/{indexer → src/indexer}/semantic-status.js +0 -0
- /package/dist/{indexer → src/indexer}/usage-events.js +0 -0
- /package/dist/{indexer → src/indexer}/walker.js +0 -0
- /package/dist/{llm → src/llm}/embedder.js +0 -0
- /package/dist/{llm → src/llm}/embedders/cache.js +0 -0
- /package/dist/{llm → src/llm}/embedders/local.js +0 -0
- /package/dist/{llm → src/llm}/embedders/types.js +0 -0
- /package/dist/{llm → src/llm}/metadata-enhance.js +0 -0
- /package/dist/{output → src/output}/context.js +0 -0
- /package/dist/{registry → src/registry}/create-provider-registry.js +0 -0
- /package/dist/{registry → src/registry}/origin-resolve.js +0 -0
- /package/dist/{registry → src/registry}/providers/index.js +0 -0
- /package/dist/{registry → src/registry}/providers/skills-sh.js +0 -0
- /package/dist/{registry → src/registry}/providers/types.js +0 -0
- /package/dist/{registry → src/registry}/types.js +0 -0
- /package/dist/{setup → src/setup}/detect.js +0 -0
- /package/dist/{setup → src/setup}/ripgrep-install.js +0 -0
- /package/dist/{setup → src/setup}/ripgrep-resolve.js +0 -0
- /package/dist/{setup → src/setup}/steps.js +0 -0
- /package/dist/{sources → src/sources}/include.js +0 -0
- /package/dist/{sources → src/sources}/provider-factory.js +0 -0
- /package/dist/{sources → src/sources}/provider.js +0 -0
- /package/dist/{sources → src/sources}/providers/filesystem.js +0 -0
- /package/dist/{sources → src/sources}/providers/index.js +0 -0
- /package/dist/{sources → src/sources}/providers/install-types.js +0 -0
- /package/dist/{sources → src/sources}/providers/npm.js +0 -0
- /package/dist/{sources → src/sources}/providers/provider-utils.js +0 -0
- /package/dist/{sources → src/sources}/providers/sync-from-ref.js +0 -0
- /package/dist/{sources → src/sources}/providers/tar-utils.js +0 -0
- /package/dist/{sources → src/sources}/providers/website.js +0 -0
- /package/dist/{sources → src/sources}/resolve.js +0 -0
- /package/dist/{sources → src/sources}/types.js +0 -0
- /package/dist/{templates → src/templates}/wiki-templates.js +0 -0
- /package/dist/{version.js → src/version.js} +0 -0
- /package/dist/{workflows → src/workflows}/authoring.js +0 -0
- /package/dist/{workflows → src/workflows}/cli.js +0 -0
- /package/dist/{workflows → src/workflows}/db.js +0 -0
- /package/dist/{workflows → src/workflows}/document-cache.js +0 -0
- /package/dist/{workflows → src/workflows}/parser.js +0 -0
- /package/dist/{workflows → src/workflows}/renderer.js +0 -0
- /package/dist/{workflows → src/workflows}/schema.js +0 -0
- /package/dist/{workflows → src/workflows}/validator.js +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { extractSection, readDoc, SPEC_PATH } from "./spec-helpers";
|
|
3
|
+
// Pins v1 spec §4.2 — Asset quality rules (open set, default-filtered).
|
|
4
|
+
//
|
|
5
|
+
// The freeze rule is:
|
|
6
|
+
// * `generated` and `curated` are well-known and included in default search.
|
|
7
|
+
// * `proposed` is well-known and excluded from default search; surfaced via
|
|
8
|
+
// `--include-proposed` or `akm proposal *`.
|
|
9
|
+
// * Unknown values parse, warn, and remain searchable.
|
|
10
|
+
describe("v1 spec §4.2 — asset quality rules", () => {
|
|
11
|
+
const spec = readDoc(SPEC_PATH);
|
|
12
|
+
const section = extractSection(spec, "### 4.2 Asset quality rules");
|
|
13
|
+
test("§4.2 exists in the spec", () => {
|
|
14
|
+
expect(section).not.toBe("");
|
|
15
|
+
});
|
|
16
|
+
test("§4.2 names the three well-known quality values", () => {
|
|
17
|
+
expect(section).toContain('"generated"');
|
|
18
|
+
expect(section).toContain('"curated"');
|
|
19
|
+
expect(section).toContain('"proposed"');
|
|
20
|
+
});
|
|
21
|
+
test("§4.2 declares `proposed` is excluded from default search", () => {
|
|
22
|
+
// Either phrasing is fine; we want both pieces of the rule present.
|
|
23
|
+
expect(section).toMatch(/Excluded from default search/i);
|
|
24
|
+
expect(section).toMatch(/--include-proposed|akm proposal/);
|
|
25
|
+
});
|
|
26
|
+
test("§4.2 names the `--include-proposed` opt-in flag explicitly", () => {
|
|
27
|
+
// Locked CLI surface — this flag is the single way to surface
|
|
28
|
+
// `proposed`-quality rows from `akm search` without going through
|
|
29
|
+
// `akm proposal *`. Renaming is a major bump.
|
|
30
|
+
expect(section).toContain("--include-proposed");
|
|
31
|
+
});
|
|
32
|
+
test("§4.2 declares unknown quality values parse-warn-include", () => {
|
|
33
|
+
expect(section).toMatch(/Unknown quality values/i);
|
|
34
|
+
expect(section).toMatch(/parse,?\s*warn/i);
|
|
35
|
+
});
|
|
36
|
+
test("§4.2 declares the legacy registry `curated` boolean is removed", () => {
|
|
37
|
+
expect(section).toMatch(/legacy registry boolean `curated`/i);
|
|
38
|
+
expect(section).toMatch(/parses and ignores/i);
|
|
39
|
+
});
|
|
40
|
+
test("§4.2 names the new optional SearchHit fields", () => {
|
|
41
|
+
expect(section).toContain("quality?");
|
|
42
|
+
expect(section).toContain("warnings?");
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { extractSection, readDoc, SPEC_PATH } from "./spec-helpers";
|
|
3
|
+
// Pins v1 spec §5 — Configuration.
|
|
4
|
+
//
|
|
5
|
+
// The freeze rule:
|
|
6
|
+
// * The JSON schema names `sources[]`, `registries[]`, `embedder`, `scorer`,
|
|
7
|
+
// `agent` (Planned), `llm` + `llm.features` (Planned), and
|
|
8
|
+
// `defaultWriteTarget`.
|
|
9
|
+
// * Value forms: literal or `{ env: "VAR" }`.
|
|
10
|
+
// * `writable: true` is rejected on `website` / `npm`.
|
|
11
|
+
// * Per-provider option schemas validate at config-load time.
|
|
12
|
+
describe("v1 spec §5 — configuration", () => {
|
|
13
|
+
const spec = readDoc(SPEC_PATH);
|
|
14
|
+
const section = extractSection(spec, "## 5. Configuration");
|
|
15
|
+
test("§5 exists in the spec", () => {
|
|
16
|
+
expect(section).not.toBe("");
|
|
17
|
+
});
|
|
18
|
+
test("§5.1 names every locked top-level config key", () => {
|
|
19
|
+
expect(section).toContain('"sources"');
|
|
20
|
+
expect(section).toContain('"registries"');
|
|
21
|
+
expect(section).toContain('"embedder"');
|
|
22
|
+
expect(section).toContain('"scorer"');
|
|
23
|
+
expect(section).toContain('"agent"');
|
|
24
|
+
expect(section).toContain('"llm"');
|
|
25
|
+
expect(section).toContain('"features"');
|
|
26
|
+
expect(section).toContain('"defaultWriteTarget"');
|
|
27
|
+
});
|
|
28
|
+
test("§5.2 declares the literal-or-env value form", () => {
|
|
29
|
+
expect(section).toMatch(/literal/i);
|
|
30
|
+
expect(section).toMatch(/\{\s*"env":\s*"VAR_NAME"\s*\}/);
|
|
31
|
+
expect(section).toMatch(/Missing required env vars produce `ConfigError`/i);
|
|
32
|
+
});
|
|
33
|
+
test("§5.3 declares per-provider option JSON schemas validated at load", () => {
|
|
34
|
+
expect(section).toMatch(/JSON Schema/);
|
|
35
|
+
expect(section).toMatch(/Missing required fields fail at load/i);
|
|
36
|
+
});
|
|
37
|
+
test("§5.4 declares the `writable` defaults and rejection rule", () => {
|
|
38
|
+
expect(section).toMatch(/`true`\s*for\s*`filesystem`/);
|
|
39
|
+
expect(section).toMatch(/`false`\s*for everything else/);
|
|
40
|
+
expect(section).toMatch(/rejected at config load.*for `website` and `npm`/s);
|
|
41
|
+
expect(section).toContain("ConfigError");
|
|
42
|
+
});
|
|
43
|
+
test("§5 stops before §6 (helper boundary check)", () => {
|
|
44
|
+
expect(section).not.toContain("## 6.");
|
|
45
|
+
expect(section).not.toContain("## 7.");
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { extractSection, readDoc, SPEC_PATH } from "./spec-helpers";
|
|
3
|
+
// Pins v1 spec §6 — Orchestration.
|
|
4
|
+
//
|
|
5
|
+
// The freeze rule:
|
|
6
|
+
// * search → indexer.search(q); registry hits never merge into source hits.
|
|
7
|
+
// * show → indexer.lookup(ref) then read file from disk.
|
|
8
|
+
// * remember/import target resolution: --target → defaultWriteTarget →
|
|
9
|
+
// working stash → ConfigError.
|
|
10
|
+
// * `index.db` is ephemeral; `usage_events` is preserved across schema bumps.
|
|
11
|
+
describe("v1 spec §6 — orchestration", () => {
|
|
12
|
+
const spec = readDoc(SPEC_PATH);
|
|
13
|
+
const section = extractSection(spec, "## 6. Orchestration");
|
|
14
|
+
test("§6 exists in the spec", () => {
|
|
15
|
+
expect(section).not.toBe("");
|
|
16
|
+
});
|
|
17
|
+
test("§6.1 says search uses indexer.search and registry hits stay separate", () => {
|
|
18
|
+
expect(section).toMatch(/indexer\.search/);
|
|
19
|
+
expect(section).toMatch(/--include-registry/);
|
|
20
|
+
expect(section).toMatch(/never merge into source hits/i);
|
|
21
|
+
});
|
|
22
|
+
test("§6.2 says show uses indexer.lookup and reads the file from disk", () => {
|
|
23
|
+
expect(section).toMatch(/indexer\.lookup/);
|
|
24
|
+
expect(section).toMatch(/readFile/);
|
|
25
|
+
});
|
|
26
|
+
test("§6.5 declares the write-target resolution order", () => {
|
|
27
|
+
const flat = section.replace(/\s+/g, " ");
|
|
28
|
+
expect(flat).toMatch(/--target.*defaultWriteTarget.*working stash.*ConfigError/);
|
|
29
|
+
expect(section).toMatch(/akm init/);
|
|
30
|
+
});
|
|
31
|
+
test("§6.7 declares index.db is ephemeral and usage_events is preserved", () => {
|
|
32
|
+
expect(section).toMatch(/index\.db.*ephemeral/i);
|
|
33
|
+
expect(section).toMatch(/preserving `usage_events`/);
|
|
34
|
+
expect(section).toMatch(/workflow\.db.*never\s*touched/i);
|
|
35
|
+
});
|
|
36
|
+
test("§6 stops before §7 (helper boundary check)", () => {
|
|
37
|
+
expect(section).not.toContain("## 7.");
|
|
38
|
+
expect(section).not.toContain("## 8.");
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { extractSection, readDoc, SPEC_PATH } from "./spec-helpers";
|
|
5
|
+
// Pins v1 spec §7 — Module layout.
|
|
6
|
+
//
|
|
7
|
+
// We don't enforce the literal tree the spec sketches (the spec uses a
|
|
8
|
+
// schematic, the actual tree has more files). We DO enforce the named
|
|
9
|
+
// anchor modules — moving or renaming any of these is a contract change.
|
|
10
|
+
// The spec's §7 schematic uses idealized names (`refs.ts`, `types.ts`); the
|
|
11
|
+
// shipped tree has slightly different file names but the same concepts. We
|
|
12
|
+
// pin the actually-shipped anchors — moving any of these is a real
|
|
13
|
+
// contract change, not a rename of a doc-only schematic.
|
|
14
|
+
const REQUIRED_FILES = [
|
|
15
|
+
"src/cli.ts",
|
|
16
|
+
"src/core/asset-ref.ts",
|
|
17
|
+
"src/core/errors.ts",
|
|
18
|
+
"src/core/config.ts",
|
|
19
|
+
"src/core/write-source.ts",
|
|
20
|
+
];
|
|
21
|
+
const REQUIRED_DIRS = ["src/commands", "src/sources", "src/registry", "src/indexer", "src/output"];
|
|
22
|
+
const repoRoot = path.resolve(import.meta.dir, "..", "..");
|
|
23
|
+
describe("v1 spec §7 — module layout", () => {
|
|
24
|
+
const spec = readDoc(SPEC_PATH);
|
|
25
|
+
const section = extractSection(spec, "## 7. Module layout");
|
|
26
|
+
test("§7 exists in the spec", () => {
|
|
27
|
+
expect(section).not.toBe("");
|
|
28
|
+
});
|
|
29
|
+
test("§7 names the locked anchor modules in the schematic", () => {
|
|
30
|
+
// The schematic in the spec uses these names; renaming requires a major
|
|
31
|
+
// bump. (Some files ship under slightly different names; see the
|
|
32
|
+
// on-disk anchor check below.)
|
|
33
|
+
expect(section).toContain("write-source.ts");
|
|
34
|
+
expect(section).toContain("config.ts");
|
|
35
|
+
expect(section).toContain("errors.ts");
|
|
36
|
+
expect(section).toContain("cli.ts");
|
|
37
|
+
});
|
|
38
|
+
test("locked anchor files exist on disk", () => {
|
|
39
|
+
for (const rel of REQUIRED_FILES) {
|
|
40
|
+
expect(fs.existsSync(path.join(repoRoot, rel))).toBe(true);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
test("locked anchor directories exist on disk", () => {
|
|
44
|
+
for (const rel of REQUIRED_DIRS) {
|
|
45
|
+
const stat = fs.statSync(path.join(repoRoot, rel));
|
|
46
|
+
expect(stat.isDirectory()).toBe(true);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
test("§7 lists what was removed from 0.6.0", () => {
|
|
50
|
+
expect(section).toMatch(/Removed from 0\.6\.0/);
|
|
51
|
+
expect(section).toMatch(/openviking/i);
|
|
52
|
+
expect(section).toMatch(/stash-search\.ts|stash-show\.ts/);
|
|
53
|
+
});
|
|
54
|
+
test("§7 stops before §8 (helper boundary check)", () => {
|
|
55
|
+
expect(section).not.toContain("## 8.");
|
|
56
|
+
expect(section).not.toContain("## 9.");
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { extractSection, readDoc, SPEC_PATH } from "./spec-helpers";
|
|
3
|
+
// Pins v1 spec §8 — Extension points.
|
|
4
|
+
//
|
|
5
|
+
// The freeze rule: six surfaces are pluggable at v1; four are deliberately
|
|
6
|
+
// not. Removing or adding a surface to either list after v1.0 is a major
|
|
7
|
+
// bump.
|
|
8
|
+
const PLUGGABLE = ["SourceProvider", "RegistryProvider", "Asset type", "Embedder", "Renderer", "Ingest transformer"];
|
|
9
|
+
const NOT_EXTENSIBLE = ["API-backed sources", "Vault", "Scorer algorithm", "Output format"];
|
|
10
|
+
describe("v1 spec §8 — extension points", () => {
|
|
11
|
+
const spec = readDoc(SPEC_PATH);
|
|
12
|
+
const section = extractSection(spec, "## 8. Extension points");
|
|
13
|
+
test("§8 exists in the spec", () => {
|
|
14
|
+
expect(section).not.toBe("");
|
|
15
|
+
});
|
|
16
|
+
test("§8 names every pluggable surface at v1", () => {
|
|
17
|
+
for (const surface of PLUGGABLE) {
|
|
18
|
+
expect(section).toContain(surface);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
test("§8 names every surface deliberately not extensible at v1", () => {
|
|
22
|
+
for (const surface of NOT_EXTENSIBLE) {
|
|
23
|
+
expect(section).toContain(surface);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
test("§8 declares output format is text/json only", () => {
|
|
27
|
+
expect(section).toMatch(/`text` and `json` only/);
|
|
28
|
+
expect(section).toMatch(/ndjson.*tsv.*mcp/);
|
|
29
|
+
});
|
|
30
|
+
test("§8 stops before §9 (helper boundary check)", () => {
|
|
31
|
+
expect(section).not.toContain("## 9.");
|
|
32
|
+
expect(section).not.toContain("## 10.");
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { CLI_DOC_PATH, extractSection, readDoc, SPEC_PATH } from "./spec-helpers";
|
|
3
|
+
// Pins v1 spec §9.4 — CLI command surface.
|
|
4
|
+
//
|
|
5
|
+
// The locked surface is exhaustive. The shipped pre-release set and the
|
|
6
|
+
// planned-for-v1 additions together form the v1.0 freeze. Renaming or
|
|
7
|
+
// removing any command after v1.0 is a major version bump.
|
|
8
|
+
const SHIPPED_COMMANDS = [
|
|
9
|
+
"add",
|
|
10
|
+
"remove",
|
|
11
|
+
"list",
|
|
12
|
+
"update",
|
|
13
|
+
"search",
|
|
14
|
+
"show",
|
|
15
|
+
"clone",
|
|
16
|
+
"index",
|
|
17
|
+
"setup",
|
|
18
|
+
"remember",
|
|
19
|
+
"import",
|
|
20
|
+
"feedback",
|
|
21
|
+
"info",
|
|
22
|
+
"curate",
|
|
23
|
+
"workflow",
|
|
24
|
+
"vault",
|
|
25
|
+
"wiki",
|
|
26
|
+
"enable",
|
|
27
|
+
"disable",
|
|
28
|
+
"completions",
|
|
29
|
+
"upgrade",
|
|
30
|
+
"save",
|
|
31
|
+
"help",
|
|
32
|
+
"hints",
|
|
33
|
+
"config",
|
|
34
|
+
];
|
|
35
|
+
const PLANNED_FOR_V1 = ["agent", "reflect", "propose", "proposal", "distill"];
|
|
36
|
+
describe("v1 spec §9.4 — CLI command surface", () => {
|
|
37
|
+
const spec = readDoc(SPEC_PATH);
|
|
38
|
+
const section = extractSection(spec, "### 9.4 CLI command surface");
|
|
39
|
+
test("§9.4 exists in the spec", () => {
|
|
40
|
+
expect(section).not.toBe("");
|
|
41
|
+
});
|
|
42
|
+
test("§9.4 lists every shipped pre-release command", () => {
|
|
43
|
+
// The shipped set is rendered as a pipe-joined inline-code block; tokens
|
|
44
|
+
// appear as standalone words. We assert each command word appears in
|
|
45
|
+
// the section text without caring about its surrounding backticks.
|
|
46
|
+
for (const cmd of SHIPPED_COMMANDS) {
|
|
47
|
+
const re = new RegExp(`\\b${cmd}\\b`);
|
|
48
|
+
expect(re.test(section)).toBe(true);
|
|
49
|
+
}
|
|
50
|
+
expect(section).toMatch(/\bregistry\b/);
|
|
51
|
+
});
|
|
52
|
+
test("§9.4 declares each planned-for-v1 command", () => {
|
|
53
|
+
for (const cmd of PLANNED_FOR_V1) {
|
|
54
|
+
// accept either `cmd` or `cmd <args>` patterns
|
|
55
|
+
const re = new RegExp(`\`${cmd}\\b`);
|
|
56
|
+
expect(re.test(section)).toBe(true);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
test("§9.4 explicitly says renaming or removing is major", () => {
|
|
60
|
+
expect(section).toMatch(/major version bump/i);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
describe("v1 spec §9.4 — cli.md mirrors the surface", () => {
|
|
64
|
+
const cli = readDoc(CLI_DOC_PATH);
|
|
65
|
+
test("cli.md has an Available-since-0.7.0 section listing the 0.7.0 commands", () => {
|
|
66
|
+
const planned = extractSection(cli, "## Agent reflection and proposal queue (0.7.0+)");
|
|
67
|
+
expect(planned).not.toBe("");
|
|
68
|
+
for (const cmd of PLANNED_FOR_V1) {
|
|
69
|
+
expect(planned).toContain(`### ${cmd}`);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
test("cli.md uses the documented status legend", () => {
|
|
73
|
+
expect(cli).toMatch(/Available since 0\.7\.0/);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { extractSection, readDoc, SPEC_PATH } from "./spec-helpers";
|
|
3
|
+
// Pins v1 spec §9.7 — LLM/agent boundary.
|
|
4
|
+
//
|
|
5
|
+
// Two locked invariants:
|
|
6
|
+
// * In-tree LLM helpers are bounded, single-shot, stateless — no shells,
|
|
7
|
+
// no long-running processes, no caches keyed on prior responses.
|
|
8
|
+
// * External agents are invoked via CLI shell-out only. akm never imports
|
|
9
|
+
// a vendor SDK.
|
|
10
|
+
describe("v1 spec §9.7 — LLM/agent boundary", () => {
|
|
11
|
+
const spec = readDoc(SPEC_PATH);
|
|
12
|
+
const section = extractSection(spec, "### 9.7 LLM/agent boundary");
|
|
13
|
+
test("§9.7 exists in the spec", () => {
|
|
14
|
+
expect(section).not.toBe("");
|
|
15
|
+
});
|
|
16
|
+
test("§9.7 declares in-tree LLM is bounded, single-shot, stateless", () => {
|
|
17
|
+
expect(section).toMatch(/bounded/i);
|
|
18
|
+
expect(section).toMatch(/single-shot/i);
|
|
19
|
+
expect(section).toMatch(/stateless/i);
|
|
20
|
+
});
|
|
21
|
+
test("§9.7 declares external agents are CLI shell-out only", () => {
|
|
22
|
+
// Tolerate markdown line-wrapping by collapsing whitespace + emphasis
|
|
23
|
+
// markers when matching.
|
|
24
|
+
const flat = section.replace(/[*\s]+/g, " ");
|
|
25
|
+
expect(flat).toMatch(/CLI shell-out only/i);
|
|
26
|
+
expect(flat).toMatch(/never imports vendor SDKs/i);
|
|
27
|
+
});
|
|
28
|
+
test("§9.7 names a `llm.features.*` per-call-site gate", () => {
|
|
29
|
+
expect(section).toMatch(/llm\.features\.\*/);
|
|
30
|
+
expect(section).toMatch(/exactly one/i);
|
|
31
|
+
});
|
|
32
|
+
test("§9.7 says crossing the boundary is a contract violation", () => {
|
|
33
|
+
const flat = section.replace(/\s+/g, " ");
|
|
34
|
+
expect(flat).toMatch(/contract violation/i);
|
|
35
|
+
});
|
|
36
|
+
});
|