akm-cli 0.6.0-rc1 → 0.6.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +9 -9
  3. package/dist/cli.js +199 -114
  4. package/dist/{completions.js → commands/completions.js} +1 -1
  5. package/dist/{config-cli.js → commands/config-cli.js} +109 -11
  6. package/dist/{curate.js → commands/curate.js} +8 -3
  7. package/dist/{info.js → commands/info.js} +15 -9
  8. package/dist/{init.js → commands/init.js} +4 -4
  9. package/dist/{install-audit.js → commands/install-audit.js} +4 -7
  10. package/dist/{installed-stashes.js → commands/installed-stashes.js} +77 -31
  11. package/dist/{migration-help.js → commands/migration-help.js} +2 -2
  12. package/dist/{registry-search.js → commands/registry-search.js} +8 -6
  13. package/dist/{remember.js → commands/remember.js} +55 -49
  14. package/dist/{stash-search.js → commands/search.js} +28 -69
  15. package/dist/{self-update.js → commands/self-update.js} +69 -3
  16. package/dist/{stash-show.js → commands/show.js} +104 -84
  17. package/dist/{stash-add.js → commands/source-add.js} +42 -32
  18. package/dist/{stash-clone.js → commands/source-clone.js} +12 -10
  19. package/dist/{stash-source-manage.js → commands/source-manage.js} +24 -24
  20. package/dist/{vault.js → commands/vault.js} +43 -0
  21. package/dist/{stash-ref.js → core/asset-ref.js} +4 -4
  22. package/dist/{asset-registry.js → core/asset-registry.js} +1 -1
  23. package/dist/{asset-spec.js → core/asset-spec.js} +1 -1
  24. package/dist/{config.js → core/config.js} +133 -56
  25. package/dist/core/errors.js +90 -0
  26. package/dist/{frontmatter.js → core/frontmatter.js} +5 -3
  27. package/dist/core/write-source.js +280 -0
  28. package/dist/{db-search.js → indexer/db-search.js} +25 -19
  29. package/dist/{db.js → indexer/db.js} +79 -47
  30. package/dist/{file-context.js → indexer/file-context.js} +3 -3
  31. package/dist/{indexer.js → indexer/indexer.js} +132 -33
  32. package/dist/{manifest.js → indexer/manifest.js} +10 -10
  33. package/dist/{matchers.js → indexer/matchers.js} +3 -6
  34. package/dist/{metadata.js → indexer/metadata.js} +9 -5
  35. package/dist/{search-source.js → indexer/search-source.js} +52 -41
  36. package/dist/{semantic-status.js → indexer/semantic-status.js} +2 -2
  37. package/dist/{walker.js → indexer/walker.js} +1 -1
  38. package/dist/{lockfile.js → integrations/lockfile.js} +1 -1
  39. package/dist/{llm-client.js → llm/client.js} +1 -1
  40. package/dist/{embedders → llm/embedders}/local.js +2 -2
  41. package/dist/{embedders → llm/embedders}/remote.js +1 -1
  42. package/dist/{embedders → llm/embedders}/types.js +1 -1
  43. package/dist/{metadata-enhance.js → llm/metadata-enhance.js} +2 -2
  44. package/dist/{cli-hints.js → output/cli-hints.js} +3 -0
  45. package/dist/{output-context.js → output/context.js} +21 -3
  46. package/dist/{renderers.js → output/renderers.js} +9 -65
  47. package/dist/{output-shapes.js → output/shapes.js} +18 -4
  48. package/dist/{output-text.js → output/text.js} +2 -2
  49. package/dist/{registry-build-index.js → registry/build-index.js} +16 -7
  50. package/dist/{create-provider-registry.js → registry/create-provider-registry.js} +6 -2
  51. package/dist/registry/factory.js +33 -0
  52. package/dist/{origin-resolve.js → registry/origin-resolve.js} +1 -1
  53. package/dist/{providers → registry/providers}/index.js +1 -1
  54. package/dist/{providers → registry/providers}/skills-sh.js +59 -3
  55. package/dist/{providers → registry/providers}/static-index.js +80 -12
  56. package/dist/registry/providers/types.js +25 -0
  57. package/dist/{registry-resolve.js → registry/resolve.js} +3 -3
  58. package/dist/{detect.js → setup/detect.js} +0 -27
  59. package/dist/{ripgrep-install.js → setup/ripgrep-install.js} +1 -1
  60. package/dist/{ripgrep-resolve.js → setup/ripgrep-resolve.js} +2 -2
  61. package/dist/{setup.js → setup/setup.js} +16 -56
  62. package/dist/{stash-include.js → sources/include.js} +1 -1
  63. package/dist/sources/provider-factory.js +36 -0
  64. package/dist/sources/provider.js +21 -0
  65. package/dist/sources/providers/filesystem.js +35 -0
  66. package/dist/{stash-providers → sources/providers}/git.js +53 -64
  67. package/dist/{stash-providers → sources/providers}/index.js +3 -4
  68. package/dist/sources/providers/install-types.js +14 -0
  69. package/dist/{stash-providers → sources/providers}/npm.js +42 -41
  70. package/dist/{stash-providers → sources/providers}/provider-utils.js +3 -3
  71. package/dist/{stash-providers → sources/providers}/sync-from-ref.js +2 -2
  72. package/dist/{stash-providers → sources/providers}/tar-utils.js +11 -8
  73. package/dist/{stash-providers → sources/providers}/website.js +29 -65
  74. package/dist/{stash-resolve.js → sources/resolve.js} +8 -7
  75. package/dist/{wiki.js → wiki/wiki.js} +34 -18
  76. package/dist/{workflow-authoring.js → workflows/authoring.js} +37 -14
  77. package/dist/{workflow-cli.js → workflows/cli.js} +2 -1
  78. package/dist/{workflow-db.js → workflows/db.js} +1 -1
  79. package/dist/workflows/document-cache.js +20 -0
  80. package/dist/workflows/parser.js +379 -0
  81. package/dist/workflows/renderer.js +78 -0
  82. package/dist/{workflow-runs.js → workflows/runs.js} +72 -28
  83. package/dist/workflows/schema.js +11 -0
  84. package/dist/workflows/validator.js +48 -0
  85. package/docs/migration/release-notes/0.6.0.md +91 -23
  86. package/package.json +1 -1
  87. package/dist/errors.js +0 -45
  88. package/dist/llm.js +0 -16
  89. package/dist/registry-factory.js +0 -19
  90. package/dist/ripgrep.js +0 -2
  91. package/dist/stash-provider-factory.js +0 -35
  92. package/dist/stash-provider.js +0 -3
  93. package/dist/stash-providers/filesystem.js +0 -71
  94. package/dist/stash-providers/openviking.js +0 -348
  95. package/dist/stash-types.js +0 -1
  96. package/dist/workflow-markdown.js +0 -260
  97. /package/dist/{common.js → core/common.js} +0 -0
  98. /package/dist/{markdown.js → core/markdown.js} +0 -0
  99. /package/dist/{paths.js → core/paths.js} +0 -0
  100. /package/dist/{warn.js → core/warn.js} +0 -0
  101. /package/dist/{search-fields.js → indexer/search-fields.js} +0 -0
  102. /package/dist/{usage-events.js → indexer/usage-events.js} +0 -0
  103. /package/dist/{github.js → integrations/github.js} +0 -0
  104. /package/dist/{embedder.js → llm/embedder.js} +0 -0
  105. /package/dist/{embedders → llm/embedders}/cache.js +0 -0
  106. /package/dist/{registry-provider.js → registry/types.js} +0 -0
  107. /package/dist/{setup-steps.js → setup/steps.js} +0 -0
  108. /package/dist/{registry-types.js → sources/types.js} +0 -0
@@ -1,29 +1,97 @@
1
1
  Migration notes for akm v0.6.0
2
2
 
3
- This release is a clean break: the runtime "kit" / "source" concept is renamed to **stash**, the registry wire format moves from `kits[]` to `stashes[]` (schema v3), and the discovery keyword/topic is renamed from `akm-kit` to `akm-stash`.
3
+ This release ships the v1 architecture refactor on top of the earlier 0.6
4
+ terminology cut (`kit` → `stash` in the registry wire format). The CLI
5
+ command surface is unchanged. Most users have nothing to do.
6
+
7
+ ## Workflows: schema-driven indexing
8
+
9
+ Workflows are now compiled into a validated `WorkflowDocument` JSON shape
10
+ with line-anchored `SourceRef`s back into the source markdown, cached in a
11
+ new `workflow_documents` table in `index.db`. `akm workflow next` reads from
12
+ the cache instead of re-parsing markdown each step.
13
+
14
+ A new `akm workflow validate <ref|path>` subcommand surfaces every error in
15
+ one pass (without running a full reindex), formatted as `path:line — message`.
16
+
17
+ `DB_VERSION` is bumped 8 → 9 to introduce the table; first run after upgrade
18
+ drops + recreates all `index.db` tables (preserving `usage_events`). The next
19
+ `akm index` rebuilds. Run-state in `workflow.db` is untouched.
20
+
21
+ ## Feedback expanded to any indexed ref
22
+
23
+ `akm feedback <ref>` now accepts any indexed ref — `memory:`, `vault:`,
24
+ `workflow:`, `wiki:` etc. The ref must be present in the local index.
25
+ Vault feedback never echoes vault values. Telemetry persists both
26
+ `entry_ref` and `entry_id` so signals survive a reindex, and feedback
27
+ events now feed into utility recomputation alongside search/show signals.
28
+
29
+ Locked v1 decisions:
30
+ - `writable` defaults to `true` on `filesystem`, `false` on `git` /
31
+ `website` / `npm`.
32
+ - Registry results are off by default in `akm search`; pass
33
+ `--include-registry` (or `--source registry|both`) to include them.
34
+ - Write target resolves as: `--target` flag → `defaultWriteTarget` config
35
+ key → `stashDir` (working stash) → `ConfigError`.
36
+ - `writable: true` on `website` / `npm` is rejected at config load.
37
+
38
+ Manual actions required:
39
+ - If your config contains an `openviking` source, remove it. akm exits at
40
+ load with `ConfigError` and points to `akm config sources remove <name>`.
41
+ API-backed sources will return as a separate `QuerySource` tier post-v1.
42
+ - If your config sets `writable: true` on a `website` or `npm` source,
43
+ drop the flag or re-add the path as a `filesystem` source.
44
+ - If you previously ran `akm enable context-hub` / `akm disable
45
+ context-hub`, those toggles are gone. Add Context Hub as a regular git
46
+ source with `akm add github:andrewyng/context-hub`, or list it as a kit
47
+ entry in your registry.
4
48
 
5
49
  Automatic (no action required):
50
+ - Config key `stashes[]` is loaded as `sources[]` with one deprecation
51
+ warning. The new key is persisted on the next `akm config` write.
6
52
  - `stash.lock` is renamed to `akm.lock` on startup.
7
- - `config.installed[]` entries are mapped to `config.stashes[]` + `akm.lock` records.
8
- - `stashDir` is loaded as an implicit `primary: true` filesystem stash entry.
9
- - Stash type aliases `"context-hub"` and `"github"` normalize to `"git"` in memory.
53
+ - `config.installed[]` entries are mapped to `config.sources[]` plus
54
+ `akm.lock` records.
55
+ - `stashDir` is loaded as an implicit `primary: true` filesystem source.
56
+ - Stash type aliases `"context-hub"` and `"github"` normalize to `"git"`.
10
57
 
11
- Manual actions required:
12
- - Replace `akm enable context-hub` / `akm disable context-hub` with
13
- `akm add github:andrewyng/context-hub --name context-hub`.
14
- - Switch error-handling scripts from string-matching the `error` message
15
- to comparing the new machine-readable `code` field.
16
- - Replace `--for-agent` with `--detail=agent` (old flag is retained as a
17
- deprecated alias for one release cycle).
18
- - Replace `disableGlobalStashes: true` with `stashInheritance: "replace"`.
19
-
20
- Publishers:
21
- - The discovery keyword/topic was renamed from `akm-kit` to `akm-stash`.
22
- Update your npm `keywords` and GitHub topics. Legacy keywords are no
23
- longer honored clean break, no transition window.
24
-
25
- Self-hosted registries:
26
- - The wire format `kits[]` is renamed to `stashes[]`. Schema is bumped
27
- to v3 and `akm-cli >= 0.6.0` only parses v3.
28
-
29
- Full migration guide: https://github.com/itlackey/akm/blob/main/docs/migration/v0.5-to-v0.6.md
58
+ What changed under the hood (no user impact):
59
+ - `SourceProvider` interface simplified to `{ name, kind, init, path,
60
+ sync? }`. Plugin authors should re-read the v1 spec.
61
+ - Search and show consult the unified FTS5 index and read files from
62
+ disk; the per-provider fan-out is gone.
63
+ - Single write helper (`writeAssetToSource`) handles filesystem and git
64
+ destinations.
65
+ - Error classes own their `hint()` text. Hints now print to stderr inline
66
+ without `--verbose`.
67
+ - Registry providers (`static-index`, `skills-sh`) loop through a uniform
68
+ interface; the Context Hub special case was deleted.
69
+ - `src/` reorganized into purpose-named subdirectories (`commands/`,
70
+ `core/`, `indexer/`, `output/`, `registry/`, `setup/`, `sources/`,
71
+ `wiki/`, `workflows/`). akm has no public API, so external consumers
72
+ are unaffected.
73
+ - Removed legacy re-export shims: `src/llm.ts`, `src/registry-provider.ts`,
74
+ `src/ripgrep.ts`.
75
+
76
+ Earlier-in-cycle terminology cut (still applies):
77
+ - The registry wire format `kits[]` is renamed to `stashes[]` with schema
78
+ bumped to v3. `akm-cli >= 0.6.0` only parses v3 indexes.
79
+ - npm packages and GitHub repos are discovered via the `akm-stash`
80
+ keyword/topic only. `akm-kit` and `agentikit` are no longer honored.
81
+ - Internal types: `RegistryKitEntry` → `RegistryStashEntry`,
82
+ `InstalledKitEntry` → `InstalledStashEntry`,
83
+ `KitInstallStatus` → `StashInstallStatus`, `KitSource` → `StashSource`.
84
+ - Documentation: `docs/kit-makers.md` → `docs/stash-makers.md`.
85
+
86
+ CLI command surface (unchanged in 0.6.0):
87
+ add | remove | list | update | search | show | clone | index | setup |
88
+ remember | import | feedback | registry * | info | curate | workflow |
89
+ vault | wiki | enable | disable | completions | upgrade | save | help |
90
+ hints
91
+
92
+ Full migration guides:
93
+ - https://github.com/itlackey/akm/blob/main/docs/migration/v1.md (v1
94
+ architecture refactor — read this first if you are coming from 0.5.x or
95
+ an earlier 0.6 pre-release)
96
+ - https://github.com/itlackey/akm/blob/main/docs/migration/v0.5-to-v0.6.md
97
+ (terminology cut, registry schema v3, publisher changes)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akm-cli",
3
- "version": "0.6.0-rc1",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "akm (Agent Kit Manager) — A package manager for AI agent skills, commands, tools, and knowledge. Works with Claude Code, OpenCode, Cursor, and any AI coding assistant.",
6
6
  "keywords": [
package/dist/errors.js DELETED
@@ -1,45 +0,0 @@
1
- /**
2
- * Typed error classes for structured exit code classification.
3
- *
4
- * - ConfigError -> exit 78 (configuration / environment problems)
5
- * - UsageError -> exit 2 (bad CLI arguments or invalid input)
6
- * - NotFoundError -> exit 1 (requested resource missing)
7
- *
8
- * Each error carries a machine-readable `code` field. Codes are stable
9
- * identifiers safe to consume from scripts and JSON output. Existing throw
10
- * sites without an explicit code receive a default code per error class so
11
- * older call sites continue to compile and behave unchanged.
12
- */
13
- /** Raised when configuration or environment is invalid or missing. */
14
- export class ConfigError extends Error {
15
- code;
16
- constructor(msg, code = "INVALID_CONFIG_FILE") {
17
- super(msg);
18
- this.name = "ConfigError";
19
- this.code = code;
20
- // Fixes `instanceof` checks under ES5 transpilation targets.
21
- Object.setPrototypeOf(this, new.target.prototype);
22
- }
23
- }
24
- /** Raised when the user supplies invalid arguments or input. */
25
- export class UsageError extends Error {
26
- code;
27
- constructor(msg, code = "INVALID_FLAG_VALUE") {
28
- super(msg);
29
- this.name = "UsageError";
30
- this.code = code;
31
- // Fixes `instanceof` checks under ES5 transpilation targets.
32
- Object.setPrototypeOf(this, new.target.prototype);
33
- }
34
- }
35
- /** Raised when a requested resource (asset, entry, file) is not found. */
36
- export class NotFoundError extends Error {
37
- code;
38
- constructor(msg, code = "ASSET_NOT_FOUND") {
39
- super(msg);
40
- this.name = "NotFoundError";
41
- this.code = code;
42
- // Fixes `instanceof` checks under ES5 transpilation targets.
43
- Object.setPrototypeOf(this, new.target.prototype);
44
- }
45
- }
package/dist/llm.js DELETED
@@ -1,16 +0,0 @@
1
- /**
2
- * Backward-compatible facade for the LLM module.
3
- *
4
- * The implementation has been split into:
5
- * - `./llm-client` — transport (chatCompletion, parseJsonResponse,
6
- * isLlmAvailable, probeLlmCapabilities, ChatMessage,
7
- * ChatCompletionOptions, stripJsonFences)
8
- * - `./metadata-enhance` — higher-level metadata enhancement workflow
9
- * (enhanceMetadata)
10
- *
11
- * New code should import from those modules directly. This re-export barrel
12
- * exists so existing call sites and tests that import from `./llm` keep
13
- * working without modification.
14
- */
15
- export * from "./llm-client";
16
- export { enhanceMetadata } from "./metadata-enhance";
@@ -1,19 +0,0 @@
1
- /**
2
- * Registry provider factory map.
3
- *
4
- * Maps registry provider type identifiers (e.g. "static-index", "skills-sh")
5
- * to factory functions that create RegistryProvider instances.
6
- *
7
- * "Registry" here refers to the stash discovery registries (npm, GitHub, static
8
- * index files) — not to be confused with the stash provider factory map in
9
- * stash-provider-factory.ts or the installed-stash operations in installed-stashes.ts.
10
- */
11
- import { createProviderRegistry } from "./create-provider-registry";
12
- // ── Factory map ─────────────────────────────────────────────────────────────
13
- const registry = createProviderRegistry();
14
- export function registerProvider(type, factory) {
15
- registry.register(type, factory);
16
- }
17
- export function resolveProviderFactory(type) {
18
- return registry.resolve(type);
19
- }
package/dist/ripgrep.js DELETED
@@ -1,2 +0,0 @@
1
- export { ensureRg } from "./ripgrep-install";
2
- export { isRgAvailable, resolveRg } from "./ripgrep-resolve";
@@ -1,35 +0,0 @@
1
- /**
2
- * Stash provider factory map.
3
- *
4
- * Maps stash source type identifiers (e.g. "filesystem", "openviking") to
5
- * factory functions that create StashProvider instances from a StashConfigEntry.
6
- *
7
- * "Stash providers" are runtime data sources for the search and show commands —
8
- * distinct from the stash-discovery registries (registry-factory.ts) and the
9
- * installed-stash operations (installed-stashes.ts).
10
- */
11
- import { createProviderRegistry } from "./create-provider-registry";
12
- // ── Factory map ─────────────────────────────────────────────────────────────
13
- const registry = createProviderRegistry();
14
- export function registerStashProvider(type, factory) {
15
- registry.register(type, factory);
16
- }
17
- export function resolveStashProviderFactory(type) {
18
- return registry.resolve(type);
19
- }
20
- /**
21
- * Resolve all non-filesystem stash providers from config.
22
- * Filesystem entries are excluded — they are handled by resolveStashSources().
23
- */
24
- export function resolveStashProviders(config) {
25
- const providers = [];
26
- for (const entry of config.stashes ?? []) {
27
- if (entry.enabled === false)
28
- continue;
29
- const factory = registry.resolve(entry.type);
30
- if (factory) {
31
- providers.push(factory(entry));
32
- }
33
- }
34
- return providers;
35
- }
@@ -1,3 +0,0 @@
1
- export function isSyncable(p) {
2
- return p.kind === "syncable";
3
- }
@@ -1,71 +0,0 @@
1
- import { resolveStashDir } from "../common";
2
- import { loadConfig } from "../config";
3
- import { searchLocal } from "../db-search";
4
- import { ConfigError } from "../errors";
5
- import { resolveStashSources } from "../search-source";
6
- import { registerStashProvider } from "../stash-provider-factory";
7
- import { showLocal } from "../stash-show";
8
- import { detectStashRoot } from "./provider-utils";
9
- class FilesystemStashProvider {
10
- type = "filesystem";
11
- kind = "syncable";
12
- name;
13
- stashDir;
14
- constructor(entry) {
15
- this.stashDir = entry.path ?? resolveStashDir();
16
- this.name = entry.name ?? this.stashDir;
17
- }
18
- async search(options) {
19
- const config = loadConfig();
20
- const sources = resolveStashSources(this.stashDir, config);
21
- const result = await searchLocal({
22
- query: options.query.toLowerCase(),
23
- searchType: options.type ?? "any",
24
- limit: options.limit,
25
- stashDir: this.stashDir,
26
- sources,
27
- config,
28
- });
29
- return {
30
- hits: result.hits,
31
- warnings: result.warnings,
32
- embedMs: result.embedMs,
33
- rankMs: result.rankMs,
34
- };
35
- }
36
- async show(ref, view) {
37
- return showLocal({ ref, view });
38
- }
39
- canShow(ref) {
40
- return !ref.includes("://");
41
- }
42
- /** No-op: a filesystem stash already lives on disk. */
43
- async sync(config, options) {
44
- if (!config.path) {
45
- throw new ConfigError("filesystem stash entry must include a `path`");
46
- }
47
- const stashRoot = detectStashRoot(config.path);
48
- const syncedAt = (options?.now ?? new Date()).toISOString();
49
- return {
50
- id: stashRoot,
51
- source: "local",
52
- ref: stashRoot,
53
- artifactUrl: stashRoot,
54
- contentDir: stashRoot,
55
- cacheDir: stashRoot,
56
- extractedDir: stashRoot,
57
- syncedAt,
58
- };
59
- }
60
- getContentDir(config) {
61
- if (!config.path) {
62
- throw new ConfigError("filesystem stash entry must include a `path`");
63
- }
64
- return config.path;
65
- }
66
- async remove(_config) {
67
- // Filesystem stashes are user-managed; never delete the source on `akm remove`.
68
- }
69
- }
70
- // ── Self-register ───────────────────────────────────────────────────────────
71
- registerStashProvider("filesystem", (config) => new FilesystemStashProvider(config));