akm-cli 0.9.7 → 0.9.8-beta.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 (117) hide show
  1. package/CHANGELOG.md +218 -0
  2. package/dist/commands/env/env.js +2 -21
  3. package/dist/commands/health/checks.js +0 -25
  4. package/dist/commands/health/improve-metrics.js +8 -34
  5. package/dist/commands/health/windows.js +0 -4
  6. package/dist/commands/health.js +1 -35
  7. package/dist/commands/improve/consolidate/eligibility.js +11 -5
  8. package/dist/commands/improve/extract.js +36 -32
  9. package/dist/commands/improve/memory/memory-belief.js +15 -5
  10. package/dist/commands/improve/memory/memory-contradiction-detect.js +16 -25
  11. package/dist/commands/improve/memory/memory-improve.js +7 -19
  12. package/dist/commands/improve/preparation.js +52 -36
  13. package/dist/commands/improve/reflect.js +13 -17
  14. package/dist/commands/lint/base-linter.js +42 -2
  15. package/dist/commands/lint/index.js +4 -5
  16. package/dist/commands/migrate/config-extra-params.js +61 -0
  17. package/dist/commands/migrate/dead-residue.js +113 -0
  18. package/dist/commands/migrate/stale-txn.js +49 -0
  19. package/dist/commands/migrate-cli.js +42 -1
  20. package/dist/commands/proposal/proposal.js +1 -21
  21. package/dist/commands/proposal/repository.js +0 -4
  22. package/dist/commands/proposal/validators/proposal-quality-validators.js +0 -6
  23. package/dist/commands/read/curate.js +4 -18
  24. package/dist/commands/read/show.js +2 -1
  25. package/dist/commands/sources/installed-stashes.js +5 -1
  26. package/dist/commands/sources/self-update.js +38 -1
  27. package/dist/commands/sources/sources-cli.js +17 -1
  28. package/dist/commands/tasks/tasks.js +0 -8
  29. package/dist/commands/url-checker.js +20 -28
  30. package/dist/core/adapter/adapters/agent-skills-adapter.js +2 -6
  31. package/dist/core/adapter/adapters/akm-adapter.js +2 -3
  32. package/dist/core/adapter/adapters/akm-lint.js +2 -20
  33. package/dist/core/adapter/adapters/akm-task-adapter.js +2 -6
  34. package/dist/core/adapter/adapters/akm-workflow-adapter.js +2 -6
  35. package/dist/core/adapter/adapters/dotenv-adapter.js +2 -22
  36. package/dist/core/adapter/adapters/generic-files-adapter.js +3 -9
  37. package/dist/core/adapter/adapters/llm-wiki-adapter.js +2 -6
  38. package/dist/core/adapter/adapters/okf-adapter.js +7 -18
  39. package/dist/core/adapter/adapters/shared.js +2 -0
  40. package/dist/core/adapter/adapters/tool-dir-shared.js +3 -9
  41. package/dist/core/adapter/adapters/website-snapshot-adapter.js +2 -6
  42. package/dist/core/adapter/validate-context.js +1 -3
  43. package/dist/core/asset/asset-placement.js +1 -3
  44. package/dist/core/asset/frontmatter.js +96 -0
  45. package/dist/core/common.js +66 -2
  46. package/dist/core/config/config-walker.js +6 -10
  47. package/dist/core/config/config.js +11 -8
  48. package/dist/core/extra-params.js +17 -13
  49. package/dist/core/improve-result.js +1 -3
  50. package/dist/core/json-schema.js +9 -11
  51. package/dist/core/state/migrations.js +52 -2
  52. package/dist/core/state-db.js +2 -1
  53. package/dist/execution/executable-identity.js +1 -3
  54. package/dist/execution/guarded-source.js +1 -6
  55. package/dist/indexer/bundle-identity-guard.js +6 -1
  56. package/dist/indexer/db/graph-db.js +139 -154
  57. package/dist/indexer/ensure-index.js +11 -19
  58. package/dist/indexer/graph/graph-boost.js +23 -34
  59. package/dist/indexer/graph/graph-extraction.js +12 -2
  60. package/dist/indexer/indexer.js +1 -1
  61. package/dist/indexer/lookup/adapter-concept-owner.js +12 -9
  62. package/dist/indexer/passes/memory-inference.js +7 -2
  63. package/dist/indexer/scan/drain-dir.js +2 -4
  64. package/dist/indexer/search/db-search.js +3 -3
  65. package/dist/indexer/search/fts-query.js +10 -15
  66. package/dist/indexer/search/search-source.js +0 -13
  67. package/dist/indexer/usage/usage-events.js +9 -1
  68. package/dist/indexer/walk/walker.js +11 -6
  69. package/dist/integrations/harnesses/claude/result-extractor.js +30 -15
  70. package/dist/integrations/harnesses/codex/result-extractor.js +43 -6
  71. package/dist/integrations/harnesses/copilot/result-extractor.js +39 -12
  72. package/dist/integrations/harnesses/gemini/result-extractor.js +40 -12
  73. package/dist/integrations/harnesses/index.js +0 -4
  74. package/dist/integrations/harnesses/openhands/result-extractor.js +51 -19
  75. package/dist/integrations/harnesses/pi/result-extractor.js +45 -12
  76. package/dist/integrations/lockfile.js +0 -14
  77. package/dist/integrations/session-logs/index.js +0 -81
  78. package/dist/llm/client.js +0 -12
  79. package/dist/llm/memory-infer.js +1 -3
  80. package/dist/llm/usage-telemetry.js +1 -3
  81. package/dist/registry/create-provider-registry.js +4 -0
  82. package/dist/registry/factory.js +4 -0
  83. package/dist/registry/resolve.js +23 -8
  84. package/dist/runtime.js +0 -12
  85. package/dist/scripts/akm-migrate-node.js +142 -244
  86. package/dist/scripts/akm-migrate.js +142 -244
  87. package/dist/setup/setup.js +6 -12
  88. package/dist/sources/providers/git-install.js +7 -2
  89. package/dist/sources/providers/tar-utils.js +1 -7
  90. package/dist/sources/snapshot-fetchers/content-extract.js +0 -17
  91. package/dist/storage/managed-db.js +20 -7
  92. package/dist/storage/repositories/events-repository.js +0 -81
  93. package/dist/storage/repositories/index-entries-repository.js +0 -17
  94. package/dist/storage/repositories/index-fts-repository.js +24 -30
  95. package/dist/storage/repositories/index-utility-repository.js +0 -57
  96. package/dist/storage/repositories/index-vec-repository.js +25 -27
  97. package/dist/storage/repositories/task-history-repository.js +9 -3
  98. package/dist/tasks/backends/launchd.js +8 -18
  99. package/dist/tasks/run/task-history.js +21 -31
  100. package/dist/tasks/scheduler-sync.js +1 -6
  101. package/dist/tasks/source/bounded-document.js +1 -14
  102. package/dist/workflows/exec/child-workflow.js +1 -1
  103. package/dist/workflows/exec/native-executor.js +2 -2
  104. package/dist/workflows/exec/step-work.js +5 -17
  105. package/dist/workflows/exec/worktree.js +40 -6
  106. package/dist/workflows/freeze/task-bindings.js +2 -4
  107. package/dist/workflows/ir/compile.js +3 -14
  108. package/dist/workflows/ir/schema-v4.js +4 -6
  109. package/dist/workflows/ir/schema.js +2 -5
  110. package/dist/workflows/parser.js +23 -26
  111. package/dist/workflows/source-files.js +8 -13
  112. package/dist/workflows/source-ir/schema.js +1 -19
  113. package/docs/migration/v0.9.0-troubleshooting.md +12 -2
  114. package/docs/reference/cli.md +2 -0
  115. package/docs/reference/workflow-schema.md +24 -0
  116. package/package.json +2 -5
  117. package/dist/workflows/source-ir/compare.js +0 -17
@@ -24,7 +24,17 @@ before that migration and tells you to run:
24
24
  akm upgrade --force
25
25
  ```
26
26
 
27
- Only a successful executable upgrade admits migration 018. Immediately before
27
+ Where akm cannot reinstall itself a container that ships the CLI globally,
28
+ an unprivileged runtime user — that command fails at its install step
29
+ (`EACCES` on the global module directory) before it ever reaches the
30
+ migration. Use the install-free route instead:
31
+
32
+ ```sh
33
+ akm upgrade --state-only
34
+ ```
35
+
36
+ Both admit migration 018 and both take the same verified safety copy described
37
+ below; `--state-only` simply skips the executable replacement. Immediately before
28
38
  the migration, AKM takes a SQLite writer-exclusion lock, rechecks the exact
29
39
  ledger, and writes a consistent SQLite snapshot beside the database as
30
40
  `state.db.pre-018-drop-dead-lane-schema.<UTC-digits>.<UUID>.bak`. The randomized
@@ -41,7 +51,7 @@ general storage migrator.
41
51
 
42
52
  An existing database with no applied migration IDs is never treated as a fresh
43
53
  install, whether its `schema_migrations` table is absent or empty. Ordinary
44
- commands reject it without writing. The explicit `akm upgrade --force` path
54
+ commands reject it without writing. The explicit `akm upgrade --force` (or `--state-only`) path
45
55
  takes and verifies a descriptor-bound snapshot named
46
56
  `state.db.pre-001-initial-schema.<UTC-digits>.<UUID>.bak` before it creates the
47
57
  ledger or applies any migration from 001 through 022. A truly new database is
@@ -1022,12 +1022,14 @@ computed, with a 256 MiB binary limit. Release/checksum metadata is capped at
1022
1022
  akm upgrade # Download and replace the running binary
1023
1023
  akm upgrade --check # Check for updates without installing
1024
1024
  akm upgrade --force # Force upgrade even if already on latest
1025
+ akm upgrade --state-only # Apply pending state.db migrations; install nothing
1025
1026
  ```
1026
1027
 
1027
1028
  | Flag | Description |
1028
1029
  | --- | --- |
1029
1030
  | `--check` | Check for updates without installing |
1030
1031
  | `--force` | Force upgrade even if on latest version |
1032
+ | `--state-only` | Apply pending `state.db` migrations without installing a new akm. For installs that cannot rewrite their own binary — a container shipping akm globally, an unprivileged runtime user — where the install step would fail `EACCES` before the migration could run. Takes the same verified safety copy as `--force`; it changes who may request the migration, not what it does. |
1031
1033
  | `--skip-post-upgrade` | Skip the post-upgrade index rebuild |
1032
1034
 
1033
1035
  Checksum verification is not optional and has no flag. If a release's
@@ -572,6 +572,30 @@ that declares an `output` schema is unaffected — an empty response is not
572
572
  valid JSON, so it fails as a parse error and can never satisfy a schema as a
573
573
  silent `null`.
574
574
 
575
+ ### When a step declares no `output:` schema
576
+
577
+ A step-level `output:` schema is **optional**, and omitting it is a supported
578
+ mode, not a deficiency. The step artifact is then exactly the value described
579
+ above — the unit's result for a solo step, the collected array for a `map`
580
+ step — carried untyped and never validated.
581
+
582
+ The shape is stable either way: it does not depend on whether a schema is
583
+ present, and it does not vary between a live run and a resume. `steps.<id>.output`
584
+ resolves the same in both cases, so downstream references work with or without
585
+ a schema.
586
+
587
+ What a schema adds is **enforcement**, not shape. With one, the promoted
588
+ artifact is checked against it and the step fails on mismatch; without one, a
589
+ downstream reference to a field the artifact happens not to carry surfaces at
590
+ resolution time instead (`steps.X.output is not an object — cannot resolve
591
+ property "y"`). Declare `output:` when you want that mismatch caught at the
592
+ producing step rather than at the consuming one.
593
+
594
+ akm does not warn about a missing step `output:` schema. It briefly did, and
595
+ the advisory was removed: it fired on essentially every step, could not be
596
+ enforced (advisories never reach `--fail-on-flagged`), and flagged a state
597
+ that is legitimate.
598
+
575
599
  ## Workflow outputs
576
600
 
577
601
  A workflow can declare a run-level export: the values a **completed run**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akm-cli",
3
- "version": "0.9.7",
3
+ "version": "0.9.8-beta.1",
4
4
  "type": "module",
5
5
  "description": "akm (Agent Knowledge Manager) — a portable, local-first capability library for AI agents. Discover, load, share, and improve reusable skills, scripts, workflows, and knowledge across any shell-capable coding agent, including Claude Code, OpenCode, and Cursor.",
6
6
  "keywords": [
@@ -77,15 +77,12 @@
77
77
  "test:integration": "bash scripts/test-integration.sh",
78
78
  "test:node-smoke": "bun scripts/node-smoke.ts",
79
79
  "test:node-compat": "AKM_NODE_COMPAT_TESTS=1 bun test --timeout=120000 tests/integration/node-compat.test.ts",
80
- "test:time": "bun scripts/test-timing-report.ts",
81
80
  "lint:isolation": "bun scripts/lint-tests-isolation.ts",
82
81
  "lint:doc-examples": "bun scripts/lint-doc-examples.ts",
83
82
  "lint:active-docs-terminology": "bun scripts/lint-active-docs-terminology.ts",
84
- "lint:devto-posts": "bun scripts/lint-devto-posts.ts",
85
- "lint:devto-posts:fix": "bun scripts/lint-devto-posts.ts --fix",
86
83
  "publish:devto": "npx -y @sinedied/devto-cli push \"docs/posts/**/*.md\" --token \"$DEVTO_TOKEN\" --repo \"$GITHUB_REPOSITORY\" --branch \"${GITHUB_REF_NAME:-main}\" --reconcile",
87
84
  "release:check": "./tests/release-check.sh",
88
- "lint": "bunx biome check src/ tests/ scripts/ && bun scripts/lint-tests-isolation.ts && bun scripts/lint-license-headers.ts && bun scripts/lint-runtime-boundary.ts && bun scripts/lint-write-source-chokepoint.ts && bun scripts/lint-secret-resolver-boundary.ts && bun scripts/lint-execution-boundary.ts && bun scripts/lint-process-argv.ts && bun scripts/lint-repository-sql.ts && bun scripts/lint-goldens-presence.ts && bun scripts/lint-golden-captured-at-head.ts && bun scripts/lint-shipped-assets.ts && bun scripts/lint-doc-examples.ts && bun scripts/gen-config-schema.ts --check && bun scripts/lint-active-docs-terminology.ts",
85
+ "lint": "bunx biome check src/ tests/ scripts/ && bun scripts/lint-secret-resolver-boundary.ts && bun scripts/lint-shipped-assets.ts && bun scripts/lint-doc-examples.ts",
89
86
  "lint:runtime-boundary": "bun scripts/lint-runtime-boundary.ts",
90
87
  "lint:tests-isolation": "bun scripts/lint-tests-isolation.ts",
91
88
  "lint:fix": "bunx biome check --write src/ tests/ scripts/",
@@ -1,17 +0,0 @@
1
- // This Source Code Form is subject to the terms of the Mozilla Public
2
- // License, v. 2.0. If a copy of the MPL was not distributed with this
3
- // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
- /**
5
- * Locale-independent code-point ordering, shared by the workflow source-IR
6
- * lane (job `needs` canonicalization) and `akm lint` (name sorting).
7
- *
8
- * Split out of the deleted `source-ir/ordering.ts` (P4 §3.3, docs/plans/specs/
9
- * p4-deletions-closeout.md): that file's other export,
10
- * `canonicalTopologicalJobs`, existed only to order MULTIPLE ready jobs —
11
- * moot once the adapter confines a workflow source to exactly one job. This
12
- * comparator has an unrelated consumer (`src/commands/lint/index.ts`) and
13
- * survives on its own.
14
- */
15
- export function compareWorkflowSourceCodePoints(left, right) {
16
- return left < right ? -1 : left > right ? 1 : 0;
17
- }