akm-cli 0.7.4 → 0.8.0-rc.3
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 → .github/CHANGELOG.md} +34 -1
- package/.github/LICENSE +374 -0
- package/dist/cli/parse-args.js +86 -0
- package/dist/cli.js +1223 -650
- package/dist/commands/agent-dispatch.js +107 -0
- package/dist/commands/agent-support.js +62 -0
- package/dist/commands/config-cli.js +68 -84
- package/dist/commands/consolidate.js +812 -0
- package/dist/commands/curate.js +1 -0
- package/dist/commands/distill-promotion-policy.js +658 -0
- package/dist/commands/distill.js +224 -39
- package/dist/commands/eval-cases.js +40 -0
- package/dist/commands/events.js +12 -24
- package/dist/commands/graph.js +222 -0
- package/dist/commands/health.js +376 -0
- package/dist/commands/help/help-accept.md +9 -0
- package/dist/commands/help/help-improve.md +53 -0
- package/dist/commands/help/help-proposals.md +15 -0
- package/dist/commands/help/help-propose.md +17 -0
- package/dist/commands/help/help-reject.md +8 -0
- package/dist/commands/history.js +3 -30
- package/dist/commands/improve.js +1161 -0
- package/dist/commands/info.js +2 -2
- package/dist/commands/init.js +2 -2
- package/dist/commands/install-audit.js +5 -1
- package/dist/commands/installed-stashes.js +118 -138
- package/dist/commands/knowledge.js +133 -0
- package/dist/commands/lint/agent-linter.js +46 -0
- package/dist/commands/lint/base-linter.js +291 -0
- package/dist/commands/lint/command-linter.js +46 -0
- package/dist/commands/lint/default-linter.js +13 -0
- package/dist/commands/lint/index.js +145 -0
- package/dist/commands/lint/knowledge-linter.js +13 -0
- package/dist/commands/lint/memory-linter.js +58 -0
- package/dist/commands/lint/registry.js +33 -0
- package/dist/commands/lint/skill-linter.js +42 -0
- package/dist/commands/lint/task-linter.js +47 -0
- package/dist/commands/lint/types.js +1 -0
- package/dist/commands/lint/vault-key-rules.js +67 -0
- package/dist/commands/lint/workflow-linter.js +53 -0
- package/dist/commands/lint.js +1 -0
- package/dist/commands/migration-help.js +2 -2
- package/dist/commands/proposal.js +8 -7
- package/dist/commands/propose.js +106 -43
- package/dist/commands/reflect.js +167 -41
- package/dist/commands/registry-search.js +2 -2
- package/dist/commands/remember.js +55 -1
- package/dist/commands/schema-repair.js +130 -0
- package/dist/commands/search.js +21 -5
- package/dist/commands/show.js +135 -55
- package/dist/commands/source-add.js +10 -10
- package/dist/commands/source-manage.js +11 -19
- package/dist/commands/tasks.js +385 -0
- package/dist/commands/url-checker.js +39 -0
- package/dist/commands/vault.js +173 -87
- package/dist/core/action-contributors.js +25 -0
- package/dist/core/asset-ref.js +4 -0
- package/dist/core/asset-registry.js +5 -17
- package/dist/core/asset-spec.js +11 -1
- package/dist/core/common.js +100 -0
- package/dist/core/concurrent.js +22 -0
- package/dist/core/config.js +240 -127
- package/dist/core/events.js +87 -123
- package/dist/core/frontmatter.js +0 -6
- package/dist/core/markdown.js +17 -0
- package/dist/core/memory-improve.js +678 -0
- package/dist/core/parse.js +155 -0
- package/dist/core/paths.js +101 -3
- package/dist/core/proposal-validators.js +61 -0
- package/dist/core/proposals.js +49 -38
- package/dist/core/state-db.js +731 -0
- package/dist/core/time.js +51 -0
- package/dist/core/warn.js +59 -1
- package/dist/indexer/db-search.js +86 -472
- package/dist/indexer/db.js +418 -59
- package/dist/indexer/ensure-index.js +133 -0
- package/dist/indexer/graph-boost.js +247 -94
- package/dist/indexer/graph-db.js +201 -0
- package/dist/indexer/graph-dedup.js +99 -0
- package/dist/indexer/graph-extraction.js +417 -74
- package/dist/indexer/index-context.js +10 -0
- package/dist/indexer/indexer.js +480 -298
- package/dist/indexer/llm-cache.js +47 -0
- package/dist/indexer/matchers.js +124 -160
- package/dist/indexer/memory-inference.js +63 -29
- package/dist/indexer/metadata-contributors.js +26 -0
- package/dist/indexer/metadata.js +196 -197
- package/dist/indexer/path-resolver.js +89 -0
- package/dist/indexer/ranking-contributors.js +204 -0
- package/dist/indexer/ranking.js +74 -0
- package/dist/indexer/search-hit-enrichers.js +22 -0
- package/dist/indexer/search-source.js +24 -9
- package/dist/indexer/semantic-status.js +2 -16
- package/dist/indexer/walker.js +25 -0
- package/dist/integrations/agent/builders.js +109 -0
- package/dist/integrations/agent/config.js +203 -3
- package/dist/integrations/agent/index.js +5 -2
- package/dist/integrations/agent/model-aliases.js +63 -0
- package/dist/integrations/agent/profiles.js +67 -5
- package/dist/integrations/agent/prompts.js +114 -29
- package/dist/integrations/agent/sdk-runner.js +120 -0
- package/dist/integrations/agent/spawn.js +158 -34
- package/dist/integrations/lockfile.js +10 -18
- package/dist/integrations/session-logs/index.js +65 -0
- package/dist/integrations/session-logs/providers/claude-code.js +56 -0
- package/dist/integrations/session-logs/providers/opencode.js +52 -0
- package/dist/integrations/session-logs/types.js +1 -0
- package/dist/llm/call-ai.js +74 -0
- package/dist/llm/client.js +63 -86
- package/dist/llm/feature-gate.js +27 -16
- package/dist/llm/graph-extract.js +297 -64
- package/dist/llm/memory-infer.js +52 -71
- package/dist/llm/metadata-enhance.js +39 -22
- package/dist/llm/prompts/graph-extract-user-prompt.md +12 -0
- package/dist/output/cli-hints-full.md +277 -0
- package/dist/output/cli-hints-short.md +65 -0
- package/dist/output/cli-hints.js +2 -309
- package/dist/output/renderers.js +226 -257
- package/dist/output/shapes.js +109 -96
- package/dist/output/text.js +274 -36
- package/dist/registry/providers/skills-sh.js +61 -49
- package/dist/registry/providers/static-index.js +44 -48
- package/dist/registry/resolve.js +8 -16
- package/dist/setup/setup.js +510 -11
- package/dist/sources/provider-factory.js +2 -1
- package/dist/sources/providers/filesystem.js +16 -23
- package/dist/sources/providers/git.js +45 -4
- package/dist/sources/providers/website.js +15 -22
- package/dist/sources/website-ingest.js +4 -0
- package/dist/tasks/backends/cron.js +200 -0
- package/dist/tasks/backends/exec-utils.js +25 -0
- package/dist/tasks/backends/index.js +32 -0
- package/dist/tasks/backends/launchd-template.xml +19 -0
- package/dist/tasks/backends/launchd.js +184 -0
- package/dist/tasks/backends/schtasks-template.xml +29 -0
- package/dist/tasks/backends/schtasks.js +212 -0
- package/dist/tasks/parser.js +198 -0
- package/dist/tasks/resolveAkmBin.js +84 -0
- package/dist/tasks/runner.js +432 -0
- package/dist/tasks/schedule.js +208 -0
- package/dist/tasks/schema.js +13 -0
- package/dist/tasks/validator.js +59 -0
- package/dist/wiki/index-template.md +12 -0
- package/dist/wiki/ingest-workflow-template.md +54 -0
- package/dist/wiki/log-template.md +8 -0
- package/dist/wiki/schema-template.md +61 -0
- package/dist/wiki/wiki-templates.js +12 -0
- package/dist/wiki/wiki.js +10 -61
- package/dist/workflows/authoring.js +5 -25
- package/dist/workflows/db.js +9 -0
- package/dist/workflows/renderer.js +8 -3
- package/dist/workflows/runs.js +73 -88
- package/dist/workflows/scope-key.js +76 -0
- package/dist/workflows/validator.js +1 -1
- package/dist/workflows/workflow-template.md +24 -0
- package/docs/README.md +5 -2
- package/docs/migration/release-notes/0.7.0.md +1 -1
- package/docs/migration/release-notes/0.7.4.md +1 -1
- package/docs/migration/release-notes/0.7.5.md +20 -0
- package/docs/migration/release-notes/0.8.0.md +43 -0
- package/package.json +4 -3
- package/dist/templates/wiki-templates.js +0 -100
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared time and date utilities.
|
|
3
|
+
*
|
|
4
|
+
* Centralises parsing of user-facing `--since` values so that all consumers
|
|
5
|
+
* interpret the same set of formats (ISO-8601, epoch ms, plain date strings)
|
|
6
|
+
* consistently without private re-implementations drifting apart.
|
|
7
|
+
*/
|
|
8
|
+
import { UsageError } from "./errors";
|
|
9
|
+
// ── Since-flag parsing ───────────────────────────────────────────────────────
|
|
10
|
+
/**
|
|
11
|
+
* Parse a user-supplied `--since` value and return an ISO-8601 timestamp
|
|
12
|
+
* string (e.g. `"2026-01-15T10:30:00.000Z"`).
|
|
13
|
+
*
|
|
14
|
+
* Accepted input formats:
|
|
15
|
+
* - ISO-8601 timestamp (preferred): `"2026-04-01T00:00:00Z"`
|
|
16
|
+
* - Plain date: `"2026-04-01"` (interpreted as start-of-day UTC)
|
|
17
|
+
* - Epoch milliseconds (pure digit string): `"1744329600000"`
|
|
18
|
+
* - Any other value parseable by `new Date()`
|
|
19
|
+
*
|
|
20
|
+
* Callers that need a different wire format (e.g. SQLite `"YYYY-MM-DD HH:MM:SS"`)
|
|
21
|
+
* should convert the returned ISO string themselves.
|
|
22
|
+
*
|
|
23
|
+
* @throws {UsageError} when `since` is empty or cannot be parsed as a date.
|
|
24
|
+
*/
|
|
25
|
+
export function parseSinceToIso(since) {
|
|
26
|
+
const trimmed = since.trim();
|
|
27
|
+
if (!trimmed) {
|
|
28
|
+
throw new UsageError("--since cannot be empty.", "INVALID_FLAG_VALUE");
|
|
29
|
+
}
|
|
30
|
+
// Pure-digit input → epoch milliseconds
|
|
31
|
+
if (/^\d+$/.test(trimmed)) {
|
|
32
|
+
const ms = Number.parseInt(trimmed, 10);
|
|
33
|
+
const d = new Date(ms);
|
|
34
|
+
if (Number.isNaN(d.getTime())) {
|
|
35
|
+
throw new UsageError(`Invalid --since value: ${since}`, "INVALID_FLAG_VALUE");
|
|
36
|
+
}
|
|
37
|
+
return d.toISOString();
|
|
38
|
+
}
|
|
39
|
+
const parsed = new Date(trimmed);
|
|
40
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
41
|
+
throw new UsageError(`Invalid --since value: ${since}. Expected ISO timestamp (e.g. 2026-04-01T00:00:00Z) or epoch ms.`, "INVALID_FLAG_VALUE");
|
|
42
|
+
}
|
|
43
|
+
return parsed.toISOString();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Convert an ISO-8601 timestamp string to the SQLite datetime format
|
|
47
|
+
* `"YYYY-MM-DD HH:MM:SS"` used by `datetime('now')`.
|
|
48
|
+
*/
|
|
49
|
+
export function isoToSqlite(iso) {
|
|
50
|
+
return iso.replace("T", " ").replace(/\.\d+Z$/, "");
|
|
51
|
+
}
|
package/dist/core/warn.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Module-level quiet/verbose flags for stderr
|
|
2
|
+
* Module-level quiet/verbose flags and optional file sink for stderr output.
|
|
3
3
|
*
|
|
4
4
|
* `quiet` is controlled by the CLI `--quiet`/`-q` flag.
|
|
5
5
|
* `verbose` is controlled by the CLI `--verbose` flag, with `AKM_VERBOSE`
|
|
6
6
|
* (env var) winning regardless: env > flag > default (false).
|
|
7
|
+
*
|
|
8
|
+
* Call `setLogFile(path)` to tee all warn/error/info output to a file in
|
|
9
|
+
* addition to stderr. The file sink is written even when `--quiet` suppresses
|
|
10
|
+
* console output, so logs remain available for post-run inspection.
|
|
7
11
|
*/
|
|
12
|
+
import fs from "node:fs";
|
|
13
|
+
import path from "node:path";
|
|
8
14
|
let quiet = false;
|
|
9
15
|
let verbose = false;
|
|
16
|
+
let logFilePath;
|
|
10
17
|
export function setQuiet(value) {
|
|
11
18
|
quiet = value;
|
|
12
19
|
}
|
|
@@ -51,15 +58,66 @@ export function isVerbose() {
|
|
|
51
58
|
return false;
|
|
52
59
|
return verbose;
|
|
53
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Direct all warn/error/info output to `filePath` in addition to stderr.
|
|
63
|
+
* The directory is created if it does not exist. Pass `undefined` to disable.
|
|
64
|
+
* The file is written even when `--quiet` suppresses console output.
|
|
65
|
+
*/
|
|
66
|
+
export function setLogFile(filePath) {
|
|
67
|
+
logFilePath = filePath;
|
|
68
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
69
|
+
}
|
|
70
|
+
export function clearLogFile() {
|
|
71
|
+
logFilePath = undefined;
|
|
72
|
+
}
|
|
73
|
+
export function getLogFile() {
|
|
74
|
+
return logFilePath;
|
|
75
|
+
}
|
|
76
|
+
function appendToLogFile(level, args) {
|
|
77
|
+
if (!logFilePath)
|
|
78
|
+
return;
|
|
79
|
+
const ts = new Date().toISOString();
|
|
80
|
+
const msg = args.map((a) => (typeof a === "string" ? a : JSON.stringify(a))).join(" ");
|
|
81
|
+
try {
|
|
82
|
+
fs.appendFileSync(logFilePath, `[${ts}] [${level}] ${msg}\n`);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Never throw from a logging function — log failures are silent.
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Emit an info/progress line to stderr unless --quiet is active.
|
|
90
|
+
* Always written to the log file if one is active.
|
|
91
|
+
* Use for progress counters and status lines (replaces console.error used for progress).
|
|
92
|
+
*/
|
|
93
|
+
export function info(...args) {
|
|
94
|
+
appendToLogFile("INFO", args);
|
|
95
|
+
if (!quiet) {
|
|
96
|
+
console.warn(...args);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
54
99
|
/**
|
|
55
100
|
* Emit a warning to stderr unless --quiet is active.
|
|
101
|
+
* Always written to the log file if one is active.
|
|
56
102
|
* Drop-in replacement for console.warn() across the codebase.
|
|
57
103
|
*/
|
|
58
104
|
export function warn(...args) {
|
|
105
|
+
appendToLogFile("WARN", args);
|
|
59
106
|
if (!quiet) {
|
|
60
107
|
console.warn(...args);
|
|
61
108
|
}
|
|
62
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Emit an error to stderr unless --quiet is active.
|
|
112
|
+
* Always written to the log file if one is active.
|
|
113
|
+
* Drop-in replacement for console.error() used for diagnostic failures.
|
|
114
|
+
*/
|
|
115
|
+
export function error(...args) {
|
|
116
|
+
appendToLogFile("ERROR", args);
|
|
117
|
+
if (!quiet) {
|
|
118
|
+
console.error(...args);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
63
121
|
/**
|
|
64
122
|
* Emit a warning only when verbose output is requested. Use for noisy
|
|
65
123
|
* per-item diagnostics that should be replaced by a one-line summary at
|