akm-cli 0.6.0-rc1 → 0.6.0-rc2

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 +21 -0
  2. package/README.md +9 -9
  3. package/dist/cli.js +181 -111
  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} +3 -3
  16. package/dist/{stash-show.js → commands/show.js} +103 -78
  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} +79 -31
  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} +70 -47
  30. package/dist/{file-context.js → indexer/file-context.js} +3 -3
  31. package/dist/{indexer.js → indexer/indexer.js} +123 -31
  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} +1 -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} +1 -1
  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} +12 -11
  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 +69 -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,15 +1,16 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import fs from "node:fs";
3
- import { loadConfig } from "./config";
4
- import { closeDatabase, openDatabase } from "./db";
5
- import { NotFoundError, UsageError } from "./errors";
6
- import { resolveSourcesForOrigin } from "./origin-resolve";
7
- import { getDbPath } from "./paths";
8
- import { resolveStashSources } from "./search-source";
9
- import { parseAssetRef } from "./stash-ref";
10
- import { resolveAssetPath } from "./stash-resolve";
11
- import { closeWorkflowDatabase, openWorkflowDatabase } from "./workflow-db";
12
- import { parseWorkflowMarkdown, WorkflowValidationError } from "./workflow-markdown";
3
+ import { parseAssetRef } from "../core/asset-ref";
4
+ import { loadConfig } from "../core/config";
5
+ import { NotFoundError, UsageError } from "../core/errors";
6
+ import { getDbPath } from "../core/paths";
7
+ import { closeDatabase, openDatabase } from "../indexer/db";
8
+ import { resolveSourceEntries } from "../indexer/search-source";
9
+ import { resolveSourcesForOrigin } from "../registry/origin-resolve";
10
+ import { resolveAssetPath } from "../sources/resolve";
11
+ import { formatWorkflowErrors } from "./authoring";
12
+ import { closeWorkflowDatabase, openWorkflowDatabase } from "./db";
13
+ import { parseWorkflow } from "./parser";
13
14
  export async function startWorkflowRun(ref, params = {}) {
14
15
  const asset = await loadWorkflowAsset(ref);
15
16
  const workflowDb = openWorkflowDatabase();
@@ -209,7 +210,7 @@ async function loadWorkflowAsset(ref) {
209
210
  throw new UsageError(`Expected a workflow ref (workflow:<name>), got "${ref}".`);
210
211
  }
211
212
  const config = loadConfig();
212
- const allSources = resolveStashSources(undefined, config);
213
+ const allSources = resolveSourceEntries(undefined, config);
213
214
  const searchSources = resolveSourcesForOrigin(parsed.origin, allSources);
214
215
  let assetPath;
215
216
  let sourcePath;
@@ -226,15 +227,69 @@ async function loadWorkflowAsset(ref) {
226
227
  if (!assetPath) {
227
228
  throw new NotFoundError(`Workflow not found for ref: workflow:${parsed.name}`);
228
229
  }
230
+ const resolvedSourcePath = sourcePath ?? loadConfig().stashDir ?? assetPath;
231
+ const fullRef = `${parsed.origin ? `${parsed.origin}//` : ""}workflow:${parsed.name}`;
232
+ const cached = readWorkflowDocumentFromIndex(resolvedSourcePath, fullRef);
233
+ const document = cached ?? loadWorkflowDocumentFromDisk(assetPath);
234
+ return projectAsset(document, fullRef, assetPath, resolvedSourcePath);
235
+ }
236
+ function loadWorkflowDocumentFromDisk(assetPath) {
229
237
  const content = fs.readFileSync(assetPath, "utf8");
230
- const workflow = parseWorkflowDocument(content);
238
+ const result = parseWorkflow(content, { path: assetPath });
239
+ if (!result.ok) {
240
+ throw new UsageError(formatWorkflowErrors(assetPath, result.errors));
241
+ }
242
+ return result.document;
243
+ }
244
+ function readWorkflowDocumentFromIndex(sourcePath, ref) {
245
+ const dbPath = getDbPath();
246
+ if (!fs.existsSync(dbPath))
247
+ return null;
248
+ const db = openDatabase(dbPath);
249
+ try {
250
+ const parsed = parseAssetRef(ref);
251
+ const entryKey = `${sourcePath}:${parsed.type}:${parsed.name}`;
252
+ const row = db
253
+ .prepare(`SELECT wd.document_json AS document_json
254
+ FROM workflow_documents wd
255
+ JOIN entries e ON e.id = wd.entry_id
256
+ WHERE e.entry_type = 'workflow' AND e.entry_key = ?
257
+ LIMIT 1`)
258
+ .get(entryKey);
259
+ if (!row)
260
+ return null;
261
+ try {
262
+ return JSON.parse(row.document_json);
263
+ }
264
+ catch {
265
+ return null;
266
+ }
267
+ }
268
+ finally {
269
+ closeDatabase(db);
270
+ }
271
+ }
272
+ function projectAsset(doc, ref, assetPath, sourcePath) {
231
273
  return {
232
- ref: `${parsed.origin ? `${parsed.origin}//` : ""}workflow:${parsed.name}`,
274
+ ref,
233
275
  path: assetPath,
234
- sourcePath: sourcePath ?? loadConfig().stashDir ?? assetPath,
235
- title: workflow.title,
236
- ...(workflow.parameters ? { parameters: workflow.parameters } : {}),
237
- steps: workflow.steps,
276
+ sourcePath,
277
+ title: doc.title,
278
+ ...(doc.parameters
279
+ ? {
280
+ parameters: doc.parameters.map((p) => ({
281
+ name: p.name,
282
+ ...(p.description ? { description: p.description } : {}),
283
+ })),
284
+ }
285
+ : {}),
286
+ steps: doc.steps.map((s) => ({
287
+ id: s.id,
288
+ title: s.title,
289
+ instructions: s.instructions.text,
290
+ ...(s.completionCriteria ? { completionCriteria: s.completionCriteria.map((c) => c.text) } : {}),
291
+ sequenceIndex: s.sequenceIndex,
292
+ })),
238
293
  };
239
294
  }
240
295
  function resolveWorkflowEntryId(sourcePath, ref) {
@@ -361,14 +416,3 @@ function parseJsonArray(value) {
361
416
  }
362
417
  return undefined;
363
418
  }
364
- function parseWorkflowDocument(content) {
365
- try {
366
- return parseWorkflowMarkdown(content);
367
- }
368
- catch (error) {
369
- if (error instanceof WorkflowValidationError) {
370
- throw new UsageError(error.message);
371
- }
372
- throw error;
373
- }
374
- }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Validated JSON shape for a workflow asset.
3
+ *
4
+ * `parseWorkflow` (parser.ts) converts a workflow markdown file into a
5
+ * `WorkflowDocument` plus a list of `WorkflowError`s. The document is the
6
+ * single source of truth consumed by the renderer, the indexer (cached
7
+ * into `workflow_documents` in `index.db`), and the run engine. Source
8
+ * markdown is referenced by `SourceRef` line spans so editors and agents
9
+ * can rewrite content in place without a full re-parse.
10
+ */
11
+ export const WORKFLOW_SCHEMA_VERSION = 1;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Cross-cutting semantic checks over an assembled WorkflowDocument draft.
3
+ *
4
+ * The parser handles per-line shape checks; this module runs rules that need
5
+ * the whole document or the raw frontmatter at once: duplicate step IDs,
6
+ * step-id format, and the frontmatter key whitelist.
7
+ */
8
+ const STEP_ID_REGEX = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
9
+ const ALLOWED_FRONTMATTER_KEYS = new Set(["description", "tags", "params"]);
10
+ export function runSemanticChecks(draft, frontmatterData, frontmatterEndLine, errors) {
11
+ checkFrontmatterKeys(frontmatterData, frontmatterEndLine, errors);
12
+ checkStepIdFormat(draft, errors);
13
+ checkDuplicateStepIds(draft, errors);
14
+ }
15
+ function checkFrontmatterKeys(data, fmEndLine, errors) {
16
+ for (const key of Object.keys(data)) {
17
+ if (ALLOWED_FRONTMATTER_KEYS.has(key))
18
+ continue;
19
+ errors.push({
20
+ line: fmEndLine,
21
+ message: `Workflow frontmatter "${key}" is not supported. Use only: description, tags, params.`,
22
+ });
23
+ }
24
+ }
25
+ function checkStepIdFormat(draft, errors) {
26
+ for (const step of draft.steps) {
27
+ if (STEP_ID_REGEX.test(step.id))
28
+ continue;
29
+ errors.push({
30
+ line: step.source.start,
31
+ message: `Step ID "${step.id}" is invalid. Use letters, numbers, ".", "_" or "-" (e.g. "deploy-job").`,
32
+ });
33
+ }
34
+ }
35
+ function checkDuplicateStepIds(draft, errors) {
36
+ const firstSeenLine = new Map();
37
+ for (const step of draft.steps) {
38
+ const previous = firstSeenLine.get(step.id);
39
+ if (previous !== undefined) {
40
+ errors.push({
41
+ line: step.source.start,
42
+ message: `Step ID "${step.id}" is already used on line ${previous}. Step IDs must be unique within a workflow.`,
43
+ });
44
+ continue;
45
+ }
46
+ firstSeenLine.set(step.id, step.source.start);
47
+ }
48
+ }
@@ -1,29 +1,75 @@
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
+ Locked v1 decisions:
8
+ - `writable` defaults to `true` on `filesystem`, `false` on `git` /
9
+ `website` / `npm`.
10
+ - Registry results are off by default in `akm search`; pass
11
+ `--include-registry` (or `--source registry|both`) to include them.
12
+ - Write target resolves as: `--target` flag → `defaultWriteTarget` config
13
+ key → `stashDir` (working stash) → `ConfigError`.
14
+ - `writable: true` on `website` / `npm` is rejected at config load.
15
+
16
+ Manual actions required:
17
+ - If your config contains an `openviking` source, remove it. akm exits at
18
+ load with `ConfigError` and points to `akm config sources remove <name>`.
19
+ API-backed sources will return as a separate `QuerySource` tier post-v1.
20
+ - If your config sets `writable: true` on a `website` or `npm` source,
21
+ drop the flag or re-add the path as a `filesystem` source.
22
+ - If you previously ran `akm enable context-hub` / `akm disable
23
+ context-hub`, those toggles are gone. Add Context Hub as a regular git
24
+ source with `akm add github:andrewyng/context-hub`, or list it as a kit
25
+ entry in your registry.
4
26
 
5
27
  Automatic (no action required):
28
+ - Config key `stashes[]` is loaded as `sources[]` with one deprecation
29
+ warning. The new key is persisted on the next `akm config` write.
6
30
  - `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.
31
+ - `config.installed[]` entries are mapped to `config.sources[]` plus
32
+ `akm.lock` records.
33
+ - `stashDir` is loaded as an implicit `primary: true` filesystem source.
34
+ - Stash type aliases `"context-hub"` and `"github"` normalize to `"git"`.
10
35
 
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
36
+ What changed under the hood (no user impact):
37
+ - `SourceProvider` interface simplified to `{ name, kind, init, path,
38
+ sync? }`. Plugin authors should re-read the v1 spec.
39
+ - Search and show consult the unified FTS5 index and read files from
40
+ disk; the per-provider fan-out is gone.
41
+ - Single write helper (`writeAssetToSource`) handles filesystem and git
42
+ destinations.
43
+ - Error classes own their `hint()` text. Hints now print to stderr inline
44
+ without `--verbose`.
45
+ - Registry providers (`static-index`, `skills-sh`) loop through a uniform
46
+ interface; the Context Hub special case was deleted.
47
+ - `src/` reorganized into purpose-named subdirectories (`commands/`,
48
+ `core/`, `indexer/`, `output/`, `registry/`, `setup/`, `sources/`,
49
+ `wiki/`, `workflows/`). akm has no public API, so external consumers
50
+ are unaffected.
51
+ - Removed legacy re-export shims: `src/llm.ts`, `src/registry-provider.ts`,
52
+ `src/ripgrep.ts`.
53
+
54
+ Earlier-in-cycle terminology cut (still applies):
55
+ - The registry wire format `kits[]` is renamed to `stashes[]` with schema
56
+ bumped to v3. `akm-cli >= 0.6.0` only parses v3 indexes.
57
+ - npm packages and GitHub repos are discovered via the `akm-stash`
58
+ keyword/topic only. `akm-kit` and `agentikit` are no longer honored.
59
+ - Internal types: `RegistryKitEntry` → `RegistryStashEntry`,
60
+ `InstalledKitEntry` → `InstalledStashEntry`,
61
+ `KitInstallStatus` → `StashInstallStatus`, `KitSource` → `StashSource`.
62
+ - Documentation: `docs/kit-makers.md` → `docs/stash-makers.md`.
63
+
64
+ CLI command surface (unchanged in 0.6.0):
65
+ add | remove | list | update | search | show | clone | index | setup |
66
+ remember | import | feedback | registry * | info | curate | workflow |
67
+ vault | wiki | enable | disable | completions | upgrade | save | help |
68
+ hints
69
+
70
+ Full migration guides:
71
+ - https://github.com/itlackey/akm/blob/main/docs/migration/v1.md (v1
72
+ architecture refactor — read this first if you are coming from 0.5.x or
73
+ an earlier 0.6 pre-release)
74
+ - https://github.com/itlackey/akm/blob/main/docs/migration/v0.5-to-v0.6.md
75
+ (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-rc2",
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));