akm-cli 0.9.0-beta.53 → 0.9.0-beta.54
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/dist/cli/clack.js +56 -0
- package/dist/cli/confirm.js +1 -1
- package/dist/commands/health/html-report.js +33 -10
- package/dist/commands/health.js +154 -21
- package/dist/commands/improve/outcome-loop.js +18 -16
- package/dist/commands/improve/preparation.js +19 -3
- package/dist/commands/read/curate.js +4 -4
- package/dist/commands/read/search-cli.js +6 -4
- package/dist/commands/read/search.js +7 -3
- package/dist/commands/read/show.js +3 -5
- package/dist/commands/sources/add-cli.js +1 -1
- package/dist/commands/sources/init.js +12 -0
- package/dist/commands/sources/stash-cli.js +1 -1
- package/dist/commands/tasks/default-tasks.js +12 -0
- package/dist/core/config/config.js +12 -0
- package/dist/core/warn.js +21 -0
- package/dist/indexer/db/db.js +6 -0
- package/dist/indexer/ensure-index.js +3 -2
- package/dist/indexer/index-writer-lock.js +9 -0
- package/dist/indexer/indexer.js +16 -4
- package/dist/indexer/read-preflight.js +23 -0
- package/dist/indexer/walk/walker.js +21 -13
- package/dist/integrations/agent/detect.js +9 -0
- package/dist/integrations/agent/index.js +1 -1
- package/dist/llm/client.js +12 -0
- package/dist/llm/embedder.js +26 -2
- package/dist/llm/embedders/local.js +7 -1
- package/dist/scripts/migrate-storage.js +26 -2
- package/dist/scripts/migrations/import-fs-improve-runs-to-db.js +5 -1
- package/dist/setup/detect.js +9 -0
- package/dist/setup/registry-stash-loader.js +12 -0
- package/dist/setup/setup.js +1 -1
- package/dist/tasks/backends/index.js +9 -0
- package/dist/tasks/runner.js +9 -0
- package/package.json +2 -2
|
@@ -44,6 +44,13 @@ const FALLBACK_STASHES = [
|
|
|
44
44
|
defaultSelected: false,
|
|
45
45
|
},
|
|
46
46
|
];
|
|
47
|
+
// ── Test seam ────────────────────────────────────────────────────────────────
|
|
48
|
+
// Swap-and-restore override. Inert in production; only tests call the setter.
|
|
49
|
+
let loadSetupStashesOverride;
|
|
50
|
+
/** TEST-ONLY. Swap the implementation of `loadSetupStashes`; pass undefined to restore. */
|
|
51
|
+
export function _setLoadSetupStashesForTests(fake) {
|
|
52
|
+
loadSetupStashesOverride = fake;
|
|
53
|
+
}
|
|
47
54
|
// ── Loader ──────────────────────────────────────────────────────────────────
|
|
48
55
|
/**
|
|
49
56
|
* Fetch available stashes from the registry and map to SetupStashEntry[].
|
|
@@ -55,6 +62,11 @@ const FALLBACK_STASHES = [
|
|
|
55
62
|
* @param timeoutMs Fetch timeout in ms (default: 4000).
|
|
56
63
|
*/
|
|
57
64
|
export async function loadSetupStashes(registryUrl, timeoutMs = 4000) {
|
|
65
|
+
if (loadSetupStashesOverride)
|
|
66
|
+
return loadSetupStashesOverride(registryUrl, timeoutMs);
|
|
67
|
+
return loadSetupStashesReal(registryUrl, timeoutMs);
|
|
68
|
+
}
|
|
69
|
+
async function loadSetupStashesReal(registryUrl, timeoutMs = 4000) {
|
|
58
70
|
try {
|
|
59
71
|
const response = await fetch(registryUrl, {
|
|
60
72
|
signal: AbortSignal.timeout(timeoutMs),
|
package/dist/setup/setup.js
CHANGED
|
@@ -12,7 +12,7 @@ import { promises as dnsPromises } from "node:dns";
|
|
|
12
12
|
import fs from "node:fs";
|
|
13
13
|
import os from "node:os";
|
|
14
14
|
import path from "node:path";
|
|
15
|
-
import * as p from "
|
|
15
|
+
import * as p from "../cli/clack.js";
|
|
16
16
|
import { akmInit } from "../commands/sources/init.js";
|
|
17
17
|
import { detectServerDefault, isCiEnvironment, registerDefaultTasks } from "../commands/tasks/default-tasks.js";
|
|
18
18
|
import { akmTasksAdd, akmTasksList, akmTasksSetEnabled, akmTasksSync } from "../commands/tasks/tasks.js";
|
|
@@ -4,7 +4,14 @@
|
|
|
4
4
|
import { CRON_BACKEND } from "./cron.js";
|
|
5
5
|
import { LAUNCHD_BACKEND } from "./launchd.js";
|
|
6
6
|
import { SCHTASKS_BACKEND } from "./schtasks.js";
|
|
7
|
+
let backendsOverrides;
|
|
8
|
+
/** TEST-ONLY. Swap backend selection; pass undefined to restore the real implementations. */
|
|
9
|
+
export function _setBackendsForTests(fakes) {
|
|
10
|
+
backendsOverrides = fakes;
|
|
11
|
+
}
|
|
7
12
|
export function selectBackend(options = {}) {
|
|
13
|
+
if (backendsOverrides?.selectBackend)
|
|
14
|
+
return backendsOverrides.selectBackend(options);
|
|
8
15
|
const platform = options.platform ?? process.platform;
|
|
9
16
|
switch (platform) {
|
|
10
17
|
case "win32":
|
|
@@ -16,6 +23,8 @@ export function selectBackend(options = {}) {
|
|
|
16
23
|
}
|
|
17
24
|
}
|
|
18
25
|
export function backendNameForPlatform(platform = process.platform) {
|
|
26
|
+
if (backendsOverrides?.backendNameForPlatform)
|
|
27
|
+
return backendsOverrides.backendNameForPlatform(platform);
|
|
19
28
|
if (platform === "win32")
|
|
20
29
|
return "schtasks";
|
|
21
30
|
if (platform === "darwin")
|
package/dist/tasks/runner.js
CHANGED
|
@@ -131,6 +131,11 @@ async function runCommandTask(input) {
|
|
|
131
131
|
stdout: "pipe",
|
|
132
132
|
stderr: "pipe",
|
|
133
133
|
cwd: process.env.HOME ?? "/tmp",
|
|
134
|
+
// Stamp task-runner provenance so any akm invocation in the command tree
|
|
135
|
+
// records usage events as machine traffic, not user demand (DRIFT-6).
|
|
136
|
+
// A more specific stamp already in the environment (e.g. improve's
|
|
137
|
+
// AKM_EVENT_SOURCE=improve on its child spawns) still wins in children.
|
|
138
|
+
env: { ...process.env, AKM_EVENT_SOURCE: process.env.AKM_EVENT_SOURCE ?? "task" },
|
|
134
139
|
});
|
|
135
140
|
let timer;
|
|
136
141
|
let timedOut = false;
|
|
@@ -351,6 +356,10 @@ async function runPromptTask(input) {
|
|
|
351
356
|
timeoutMs: agentTimeoutMs,
|
|
352
357
|
cwd: stashDir,
|
|
353
358
|
...agentOptions,
|
|
359
|
+
// Stamp task-runner provenance for any akm invocation the agent makes
|
|
360
|
+
// (DRIFT-6: agent-task traffic must not be recorded as user demand).
|
|
361
|
+
// Caller-supplied env still wins on conflicts.
|
|
362
|
+
env: { AKM_EVENT_SOURCE: "task", ...agentOptions?.env },
|
|
354
363
|
});
|
|
355
364
|
const finishedAt = now();
|
|
356
365
|
const log = renderPromptLog({ task, profileName: profile.name, result });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akm-cli",
|
|
3
|
-
"version": "0.9.0-beta.
|
|
3
|
+
"version": "0.9.0-beta.54",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "akm (Agent Knowledge Management) — 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": [
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"sweep:tmp": "bun scripts/sweep-test-tmp.ts",
|
|
59
59
|
"test": "bash scripts/test-unit.sh",
|
|
60
60
|
"test:unit": "bash scripts/test-unit.sh",
|
|
61
|
-
"test:integration": "bun run sweep:tmp && bun test --
|
|
61
|
+
"test:integration": "bun run sweep:tmp && bun test --timeout=30000 ./tests/integration",
|
|
62
62
|
"test:node-smoke": "bun scripts/node-smoke.ts",
|
|
63
63
|
"test:node-compat": "AKM_NODE_COMPAT_TESTS=1 bun test --timeout=120000 tests/integration/node-compat.test.ts",
|
|
64
64
|
"test:time": "bun scripts/test-timing-report.ts",
|