@shrkcrft/cli 0.1.0-alpha.21 → 0.1.0-alpha.23
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/command-registry.d.ts +9 -0
- package/dist/command-registry.d.ts.map +1 -1
- package/dist/command-registry.js +15 -0
- package/dist/commands/ai-status.command.d.ts.map +1 -1
- package/dist/commands/ai-status.command.js +10 -0
- package/dist/commands/apply.command.d.ts.map +1 -1
- package/dist/commands/apply.command.js +9 -2
- package/dist/commands/ask.command.d.ts.map +1 -1
- package/dist/commands/ask.command.js +2 -1
- package/dist/commands/changes.command.d.ts.map +1 -1
- package/dist/commands/changes.command.js +14 -4
- package/dist/commands/check.command.d.ts.map +1 -1
- package/dist/commands/check.command.js +119 -3
- package/dist/commands/command-catalog.d.ts.map +1 -1
- package/dist/commands/command-catalog.js +224 -0
- package/dist/commands/commands.command.d.ts +15 -0
- package/dist/commands/commands.command.d.ts.map +1 -1
- package/dist/commands/commands.command.js +162 -3
- package/dist/commands/compress.command.d.ts.map +1 -1
- package/dist/commands/compress.command.js +39 -4
- package/dist/commands/constructs.command.d.ts.map +1 -1
- package/dist/commands/constructs.command.js +40 -9
- package/dist/commands/context.command.d.ts.map +1 -1
- package/dist/commands/context.command.js +3 -1
- package/dist/commands/daily.commands.d.ts.map +1 -1
- package/dist/commands/daily.commands.js +48 -5
- package/dist/commands/diff-check.command.d.ts.map +1 -1
- package/dist/commands/diff-check.command.js +6 -2
- package/dist/commands/feedback.command.d.ts.map +1 -1
- package/dist/commands/feedback.command.js +4 -0
- package/dist/commands/framework.command.d.ts.map +1 -1
- package/dist/commands/framework.command.js +20 -3
- package/dist/commands/gate.command.d.ts.map +1 -1
- package/dist/commands/gate.command.js +99 -2
- package/dist/commands/graph-code-subverbs.d.ts.map +1 -1
- package/dist/commands/graph-code-subverbs.js +183 -68
- package/dist/commands/graph.command.d.ts.map +1 -1
- package/dist/commands/graph.command.js +6 -0
- package/dist/commands/impact.command.d.ts.map +1 -1
- package/dist/commands/impact.command.js +91 -1
- package/dist/commands/knowledge.command.d.ts.map +1 -1
- package/dist/commands/knowledge.command.js +21 -1
- package/dist/commands/onboard.command.d.ts.map +1 -1
- package/dist/commands/onboard.command.js +11 -2
- package/dist/commands/orchestrate.command.d.ts.map +1 -1
- package/dist/commands/orchestrate.command.js +6 -1
- package/dist/commands/pack-author.command.d.ts.map +1 -1
- package/dist/commands/pack-author.command.js +13 -1
- package/dist/commands/packs.command.d.ts.map +1 -1
- package/dist/commands/packs.command.js +95 -17
- package/dist/commands/paths.command.d.ts.map +1 -1
- package/dist/commands/paths.command.js +8 -1
- package/dist/commands/pipelines.command.d.ts.map +1 -1
- package/dist/commands/pipelines.command.js +2 -1
- package/dist/commands/plan-context.command.d.ts.map +1 -1
- package/dist/commands/plan-context.command.js +6 -3
- package/dist/commands/plan-simulate.command.js +1 -1
- package/dist/commands/policy-lint.command.d.ts +3 -0
- package/dist/commands/policy-lint.command.d.ts.map +1 -0
- package/dist/commands/policy-lint.command.js +135 -0
- package/dist/commands/recommend.command.d.ts.map +1 -1
- package/dist/commands/recommend.command.js +10 -2
- package/dist/commands/registry.command.d.ts.map +1 -1
- package/dist/commands/registry.command.js +117 -9
- package/dist/commands/report.command.js +1 -1
- package/dist/commands/reuse.command.d.ts +3 -0
- package/dist/commands/reuse.command.d.ts.map +1 -0
- package/dist/commands/reuse.command.js +202 -0
- package/dist/commands/review.command.d.ts.map +1 -1
- package/dist/commands/review.command.js +20 -2
- package/dist/commands/rule-graph-subverbs.d.ts.map +1 -1
- package/dist/commands/rule-graph-subverbs.js +31 -4
- package/dist/commands/search-structural.command.d.ts.map +1 -1
- package/dist/commands/search-structural.command.js +2 -2
- package/dist/commands/search.command.d.ts.map +1 -1
- package/dist/commands/search.command.js +19 -1
- package/dist/commands/simulate.command.d.ts.map +1 -1
- package/dist/commands/simulate.command.js +6 -1
- package/dist/commands/smart-context.command.d.ts.map +1 -1
- package/dist/commands/smart-context.command.js +87 -4
- package/dist/commands/spec.command.d.ts.map +1 -1
- package/dist/commands/spec.command.js +73 -13
- package/dist/commands/task-context.command.d.ts.map +1 -1
- package/dist/commands/task-context.command.js +26 -2
- package/dist/commands/test.command.d.ts.map +1 -1
- package/dist/commands/test.command.js +17 -0
- package/dist/commands/trace.command.d.ts.map +1 -1
- package/dist/commands/trace.command.js +14 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +19 -1
- package/dist/status/freshness.d.ts +30 -0
- package/dist/status/freshness.d.ts.map +1 -0
- package/dist/status/freshness.js +81 -0
- package/package.json +33 -33
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { readdirSync, statSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Source-mtime freshness — a small shared CLI helper.
|
|
5
|
+
*
|
|
6
|
+
* Several `… status` commands (`framework status`, `context status`) need to
|
|
7
|
+
* answer the same question: "is this stored artefact stale relative to the
|
|
8
|
+
* source tree it was built from?" They all walk the workspace for the newest
|
|
9
|
+
* source-file mtime and compare it to a stored build timestamp. This module
|
|
10
|
+
* is the single home for that walk so the commands stay byte-identical.
|
|
11
|
+
*
|
|
12
|
+
* NOTE: this is deliberately CLI-local and distinct from
|
|
13
|
+
* `@shrkcrft/graph`'s `detectGraphFreshness` — that one models the graph
|
|
14
|
+
* store's own freshness and graph sits BELOW cli in the layer order, so it
|
|
15
|
+
* cannot be reused here.
|
|
16
|
+
*/
|
|
17
|
+
export const FRESHNESS_SKIP_DIRS = new Set([
|
|
18
|
+
'node_modules', 'dist', 'build', 'coverage', '.git', '.sharkcraft',
|
|
19
|
+
'.next', '.cache', '.tmp-pack', 'out', 'target',
|
|
20
|
+
]);
|
|
21
|
+
export const FRESHNESS_SOURCE_EXTS = new Set([
|
|
22
|
+
'.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs',
|
|
23
|
+
'.java', '.cs', '.py', '.go', '.rs', '.kt', '.swift',
|
|
24
|
+
]);
|
|
25
|
+
/** Newest source-file mtime (ms) under `root`, ignoring build/output dirs. 0
|
|
26
|
+
* when nothing matched. */
|
|
27
|
+
export function newestSourceMtimeMs(root) {
|
|
28
|
+
let newest = 0;
|
|
29
|
+
const stack = [root];
|
|
30
|
+
while (stack.length > 0) {
|
|
31
|
+
const dir = stack.pop();
|
|
32
|
+
let entries;
|
|
33
|
+
try {
|
|
34
|
+
entries = readdirSync(dir);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
for (const name of entries) {
|
|
40
|
+
if (FRESHNESS_SKIP_DIRS.has(name) || name.startsWith('.'))
|
|
41
|
+
continue;
|
|
42
|
+
const full = nodePath.join(dir, name);
|
|
43
|
+
let st;
|
|
44
|
+
try {
|
|
45
|
+
st = statSync(full);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (st.isDirectory()) {
|
|
51
|
+
stack.push(full);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (!st.isFile())
|
|
55
|
+
continue;
|
|
56
|
+
if (!FRESHNESS_SOURCE_EXTS.has(nodePath.extname(full).toLowerCase()))
|
|
57
|
+
continue;
|
|
58
|
+
if (st.mtimeMs > newest)
|
|
59
|
+
newest = st.mtimeMs;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return newest;
|
|
63
|
+
}
|
|
64
|
+
/** Compare a stored build timestamp to the newest source mtime in `scope`.
|
|
65
|
+
* `stale` when a source file is newer than the build; `unknown` when the
|
|
66
|
+
* build timestamp can't be parsed. */
|
|
67
|
+
export function computeMtimeFreshness(scope, builtAtIso) {
|
|
68
|
+
const newestMs = newestSourceMtimeMs(scope);
|
|
69
|
+
const lastChangedAt = newestMs > 0 ? new Date(newestMs).toISOString() : null;
|
|
70
|
+
const builtMs = builtAtIso ? Date.parse(builtAtIso) : NaN;
|
|
71
|
+
if (!Number.isFinite(builtMs)) {
|
|
72
|
+
return { state: 'unknown', lastBuiltAt: builtAtIso ?? null, lastChangedAt, behindMs: 0 };
|
|
73
|
+
}
|
|
74
|
+
const behindMs = newestMs > builtMs ? Math.round(newestMs - builtMs) : 0;
|
|
75
|
+
return {
|
|
76
|
+
state: behindMs > 0 ? 'stale' : 'fresh',
|
|
77
|
+
lastBuiltAt: builtAtIso ?? null,
|
|
78
|
+
lastChangedAt,
|
|
79
|
+
behindMs,
|
|
80
|
+
};
|
|
81
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.23",
|
|
4
4
|
"description": "SharkCraft CLI (`shrk`): structured project intelligence for AI coding agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SharkCraft contributors",
|
|
@@ -47,38 +47,38 @@
|
|
|
47
47
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
51
|
-
"@shrkcrft/compress": "^0.1.0-alpha.
|
|
52
|
-
"@shrkcrft/config": "^0.1.0-alpha.
|
|
53
|
-
"@shrkcrft/workspace": "^0.1.0-alpha.
|
|
54
|
-
"@shrkcrft/knowledge": "^0.1.0-alpha.
|
|
55
|
-
"@shrkcrft/context": "^0.1.0-alpha.
|
|
56
|
-
"@shrkcrft/rules": "^0.1.0-alpha.
|
|
57
|
-
"@shrkcrft/paths": "^0.1.0-alpha.
|
|
58
|
-
"@shrkcrft/templates": "^0.1.0-alpha.
|
|
59
|
-
"@shrkcrft/plugin-api": "^0.1.0-alpha.
|
|
60
|
-
"@shrkcrft/dashboard": "^0.1.0-alpha.
|
|
61
|
-
"@shrkcrft/dashboard-api": "^0.1.0-alpha.
|
|
62
|
-
"@shrkcrft/pipelines": "^0.1.0-alpha.
|
|
63
|
-
"@shrkcrft/presets": "^0.1.0-alpha.
|
|
64
|
-
"@shrkcrft/boundaries": "^0.1.0-alpha.
|
|
65
|
-
"@shrkcrft/graph": "^0.1.0-alpha.
|
|
66
|
-
"@shrkcrft/rule-graph": "^0.1.0-alpha.
|
|
67
|
-
"@shrkcrft/structural-search": "^0.1.0-alpha.
|
|
68
|
-
"@shrkcrft/impact-engine": "^0.1.0-alpha.
|
|
69
|
-
"@shrkcrft/context-planner": "^0.1.0-alpha.
|
|
70
|
-
"@shrkcrft/architecture-guard": "^0.1.0-alpha.
|
|
71
|
-
"@shrkcrft/framework-scanners": "^0.1.0-alpha.
|
|
72
|
-
"@shrkcrft/api-surface-diff": "^0.1.0-alpha.
|
|
73
|
-
"@shrkcrft/quality-gates": "^0.1.0-alpha.
|
|
74
|
-
"@shrkcrft/migrate": "^0.1.0-alpha.
|
|
75
|
-
"@shrkcrft/generator": "^0.1.0-alpha.
|
|
76
|
-
"@shrkcrft/importer": "^0.1.0-alpha.
|
|
77
|
-
"@shrkcrft/inspector": "^0.1.0-alpha.
|
|
78
|
-
"@shrkcrft/ai": "^0.1.0-alpha.
|
|
79
|
-
"@shrkcrft/embeddings": "^0.1.0-alpha.
|
|
80
|
-
"@shrkcrft/shared": "^0.1.0-alpha.
|
|
81
|
-
"@shrkcrft/mcp-server": "^0.1.0-alpha.
|
|
50
|
+
"@shrkcrft/core": "^0.1.0-alpha.23",
|
|
51
|
+
"@shrkcrft/compress": "^0.1.0-alpha.23",
|
|
52
|
+
"@shrkcrft/config": "^0.1.0-alpha.23",
|
|
53
|
+
"@shrkcrft/workspace": "^0.1.0-alpha.23",
|
|
54
|
+
"@shrkcrft/knowledge": "^0.1.0-alpha.23",
|
|
55
|
+
"@shrkcrft/context": "^0.1.0-alpha.23",
|
|
56
|
+
"@shrkcrft/rules": "^0.1.0-alpha.23",
|
|
57
|
+
"@shrkcrft/paths": "^0.1.0-alpha.23",
|
|
58
|
+
"@shrkcrft/templates": "^0.1.0-alpha.23",
|
|
59
|
+
"@shrkcrft/plugin-api": "^0.1.0-alpha.23",
|
|
60
|
+
"@shrkcrft/dashboard": "^0.1.0-alpha.23",
|
|
61
|
+
"@shrkcrft/dashboard-api": "^0.1.0-alpha.23",
|
|
62
|
+
"@shrkcrft/pipelines": "^0.1.0-alpha.23",
|
|
63
|
+
"@shrkcrft/presets": "^0.1.0-alpha.23",
|
|
64
|
+
"@shrkcrft/boundaries": "^0.1.0-alpha.23",
|
|
65
|
+
"@shrkcrft/graph": "^0.1.0-alpha.23",
|
|
66
|
+
"@shrkcrft/rule-graph": "^0.1.0-alpha.23",
|
|
67
|
+
"@shrkcrft/structural-search": "^0.1.0-alpha.23",
|
|
68
|
+
"@shrkcrft/impact-engine": "^0.1.0-alpha.23",
|
|
69
|
+
"@shrkcrft/context-planner": "^0.1.0-alpha.23",
|
|
70
|
+
"@shrkcrft/architecture-guard": "^0.1.0-alpha.23",
|
|
71
|
+
"@shrkcrft/framework-scanners": "^0.1.0-alpha.23",
|
|
72
|
+
"@shrkcrft/api-surface-diff": "^0.1.0-alpha.23",
|
|
73
|
+
"@shrkcrft/quality-gates": "^0.1.0-alpha.23",
|
|
74
|
+
"@shrkcrft/migrate": "^0.1.0-alpha.23",
|
|
75
|
+
"@shrkcrft/generator": "^0.1.0-alpha.23",
|
|
76
|
+
"@shrkcrft/importer": "^0.1.0-alpha.23",
|
|
77
|
+
"@shrkcrft/inspector": "^0.1.0-alpha.23",
|
|
78
|
+
"@shrkcrft/ai": "^0.1.0-alpha.23",
|
|
79
|
+
"@shrkcrft/embeddings": "^0.1.0-alpha.23",
|
|
80
|
+
"@shrkcrft/shared": "^0.1.0-alpha.23",
|
|
81
|
+
"@shrkcrft/mcp-server": "^0.1.0-alpha.23",
|
|
82
82
|
"@huggingface/transformers": "^3.7.5"
|
|
83
83
|
},
|
|
84
84
|
"publishConfig": {
|