agentplane 0.3.1 → 0.3.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/assets/AGENTS.md +5 -4
- package/assets/agents/CODER.json +4 -3
- package/assets/agents/DOCS.json +1 -1
- package/assets/agents/INTEGRATOR.json +1 -1
- package/assets/agents/ORCHESTRATOR.json +1 -0
- package/assets/agents/PLANNER.json +1 -0
- package/assets/agents/TESTER.json +3 -1
- package/assets/policy/dod.code.md +2 -2
- package/assets/policy/dod.core.md +16 -2
- package/assets/policy/dod.docs.md +2 -2
- package/assets/policy/incidents.md +44 -1
- package/assets/policy/workflow.direct.md +10 -5
- package/bin/agentplane.js +116 -18
- package/bin/dist-guard.js +78 -10
- package/bin/runtime-context.d.ts +23 -0
- package/bin/runtime-context.js +94 -0
- package/bin/runtime-watch.d.ts +26 -0
- package/bin/runtime-watch.js +116 -0
- package/bin/stale-dist-policy.d.ts +6 -0
- package/bin/stale-dist-policy.js +44 -0
- package/dist/.build-manifest.json +2480 -5
- package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/local-backend.js +9 -12
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine-backend.js +23 -18
- package/dist/backends/task-backend/shared/constants.d.ts +1 -0
- package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/constants.js +1 -0
- package/dist/backends/task-backend/shared/doc.d.ts +1 -0
- package/dist/backends/task-backend/shared/doc.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/doc.js +4 -1
- package/dist/backends/task-backend/shared/export.js +3 -3
- package/dist/cli/bootstrap-guide.d.ts +16 -0
- package/dist/cli/bootstrap-guide.d.ts.map +1 -0
- package/dist/cli/bootstrap-guide.js +112 -0
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +62 -203
- package/dist/cli/command-snippets.d.ts +2 -2
- package/dist/cli/command-snippets.js +2 -2
- package/dist/cli/run-cli/catalog.d.ts +7 -0
- package/dist/cli/run-cli/catalog.d.ts.map +1 -0
- package/dist/cli/run-cli/catalog.js +22 -0
- package/dist/cli/run-cli/command-catalog.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog.js +11 -0
- package/dist/cli/run-cli/commands/core.js +1 -1
- package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/write-config.js +2 -0
- package/dist/cli/run-cli/commands/init.js +5 -14
- package/dist/cli/run-cli/error-guidance.d.ts +9 -0
- package/dist/cli/run-cli/error-guidance.d.ts.map +1 -0
- package/dist/cli/run-cli/error-guidance.js +180 -0
- package/dist/cli/run-cli/globals.d.ts +22 -0
- package/dist/cli/run-cli/globals.d.ts.map +1 -0
- package/dist/cli/run-cli/globals.js +197 -0
- package/dist/cli/run-cli/update-warning.d.ts +6 -0
- package/dist/cli/run-cli/update-warning.d.ts.map +1 -0
- package/dist/cli/run-cli/update-warning.js +64 -0
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +5 -476
- package/dist/cli/spec/docs-render.d.ts.map +1 -1
- package/dist/cli/spec/docs-render.js +14 -1
- package/dist/commands/doctor/archive.d.ts +4 -0
- package/dist/commands/doctor/archive.d.ts.map +1 -0
- package/dist/commands/doctor/archive.js +211 -0
- package/dist/commands/doctor/fixes.d.ts +9 -0
- package/dist/commands/doctor/fixes.d.ts.map +1 -0
- package/dist/commands/doctor/fixes.js +40 -0
- package/dist/commands/doctor/layering.d.ts +2 -0
- package/dist/commands/doctor/layering.d.ts.map +1 -0
- package/dist/commands/doctor/layering.js +87 -0
- package/dist/commands/doctor/runtime.d.ts +4 -0
- package/dist/commands/doctor/runtime.d.ts.map +1 -0
- package/dist/commands/doctor/runtime.js +56 -0
- package/dist/commands/doctor/workflow.d.ts +6 -0
- package/dist/commands/doctor/workflow.d.ts.map +1 -0
- package/dist/commands/doctor/workflow.js +62 -0
- package/dist/commands/doctor/workspace.d.ts +2 -0
- package/dist/commands/doctor/workspace.d.ts.map +1 -0
- package/dist/commands/doctor/workspace.js +165 -0
- package/dist/commands/doctor.run.d.ts.map +1 -1
- package/dist/commands/doctor.run.js +16 -305
- package/dist/commands/doctor.spec.d.ts +1 -0
- package/dist/commands/doctor.spec.d.ts.map +1 -1
- package/dist/commands/doctor.spec.js +15 -1
- package/dist/commands/finish.run.d.ts.map +1 -1
- package/dist/commands/finish.run.js +1 -0
- package/dist/commands/finish.spec.d.ts +1 -0
- package/dist/commands/finish.spec.d.ts.map +1 -1
- package/dist/commands/finish.spec.js +23 -2
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +19 -0
- package/dist/commands/release/apply.command.d.ts +2 -7
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +159 -382
- package/dist/commands/release/apply.mutation.d.ts +7 -0
- package/dist/commands/release/apply.mutation.d.ts.map +1 -0
- package/dist/commands/release/apply.mutation.js +107 -0
- package/dist/commands/release/apply.preflight.d.ts +25 -0
- package/dist/commands/release/apply.preflight.d.ts.map +1 -0
- package/dist/commands/release/apply.preflight.js +338 -0
- package/dist/commands/release/apply.reporting.d.ts +4 -0
- package/dist/commands/release/apply.reporting.d.ts.map +1 -0
- package/dist/commands/release/apply.reporting.js +24 -0
- package/dist/commands/release/apply.types.d.ts +46 -0
- package/dist/commands/release/apply.types.d.ts.map +1 -0
- package/dist/commands/release/apply.types.js +1 -0
- package/dist/commands/runtime.command.d.ts +28 -0
- package/dist/commands/runtime.command.d.ts.map +1 -0
- package/dist/commands/runtime.command.js +169 -0
- package/dist/commands/shared/task-store.d.ts.map +1 -1
- package/dist/commands/shared/task-store.js +7 -3
- package/dist/commands/task/add.d.ts.map +1 -1
- package/dist/commands/task/add.js +3 -33
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +2 -2
- package/dist/commands/task/close-duplicate.d.ts.map +1 -1
- package/dist/commands/task/close-duplicate.js +2 -2
- package/dist/commands/task/close-noop.d.ts.map +1 -1
- package/dist/commands/task/close-noop.js +2 -2
- package/dist/commands/task/comment.js +2 -2
- package/dist/commands/task/derive.d.ts.map +1 -1
- package/dist/commands/task/derive.js +3 -3
- package/dist/commands/task/doc-template.d.ts +10 -0
- package/dist/commands/task/doc-template.d.ts.map +1 -0
- package/dist/commands/task/doc-template.js +104 -0
- package/dist/commands/task/doc.d.ts.map +1 -1
- package/dist/commands/task/doc.js +36 -1
- package/dist/commands/task/finish.d.ts +1 -0
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +26 -10
- package/dist/commands/task/migrate-doc.command.d.ts.map +1 -1
- package/dist/commands/task/migrate-doc.command.js +5 -1
- package/dist/commands/task/migrate-doc.d.ts.map +1 -1
- package/dist/commands/task/migrate-doc.js +136 -2
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +4 -110
- package/dist/commands/task/new.spec.js +3 -3
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +5 -4
- package/dist/commands/task/scaffold.d.ts.map +1 -1
- package/dist/commands/task/scaffold.js +7 -52
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +2 -2
- package/dist/commands/task/shared/dependencies.d.ts +15 -0
- package/dist/commands/task/shared/dependencies.d.ts.map +1 -0
- package/dist/commands/task/shared/dependencies.js +143 -0
- package/dist/commands/task/shared/docs.d.ts +21 -0
- package/dist/commands/task/shared/docs.d.ts.map +1 -0
- package/dist/commands/task/shared/docs.js +121 -0
- package/dist/commands/task/shared/listing.d.ts +20 -0
- package/dist/commands/task/shared/listing.d.ts.map +1 -0
- package/dist/commands/task/shared/listing.js +127 -0
- package/dist/commands/task/shared/tags.d.ts +24 -0
- package/dist/commands/task/shared/tags.d.ts.map +1 -0
- package/dist/commands/task/shared/tags.js +177 -0
- package/dist/commands/task/shared/transitions.d.ts +42 -0
- package/dist/commands/task/shared/transitions.d.ts.map +1 -0
- package/dist/commands/task/shared/transitions.js +175 -0
- package/dist/commands/task/shared.d.ts +5 -106
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +5 -681
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +7 -5
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +9 -25
- package/dist/commands/task/verify-show.command.d.ts.map +1 -1
- package/dist/commands/task/verify-show.command.js +5 -1
- package/dist/commands/upgrade/apply.d.ts +44 -0
- package/dist/commands/upgrade/apply.d.ts.map +1 -0
- package/dist/commands/upgrade/apply.js +180 -0
- package/dist/commands/upgrade/report.d.ts +21 -0
- package/dist/commands/upgrade/report.d.ts.map +1 -0
- package/dist/commands/upgrade/report.js +81 -0
- package/dist/commands/upgrade/source.d.ts +35 -0
- package/dist/commands/upgrade/source.d.ts.map +1 -0
- package/dist/commands/upgrade/source.js +109 -0
- package/dist/commands/upgrade/types.d.ts +31 -0
- package/dist/commands/upgrade/types.d.ts.map +1 -0
- package/dist/commands/upgrade/types.js +1 -0
- package/dist/commands/upgrade.command.d.ts.map +1 -1
- package/dist/commands/upgrade.command.js +11 -7
- package/dist/commands/upgrade.d.ts +1 -35
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +54 -320
- package/dist/shared/diagnostics.d.ts +23 -0
- package/dist/shared/diagnostics.d.ts.map +1 -0
- package/dist/shared/diagnostics.js +57 -0
- package/dist/shared/errors.d.ts +2 -0
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +2 -0
- package/dist/shared/repo-cli-version.d.ts +13 -0
- package/dist/shared/repo-cli-version.d.ts.map +1 -0
- package/dist/shared/repo-cli-version.js +63 -0
- package/dist/shared/runtime-source.d.ts +33 -0
- package/dist/shared/runtime-source.d.ts.map +1 -0
- package/dist/shared/runtime-source.js +156 -0
- package/dist/shared/version-compare.d.ts +7 -0
- package/dist/shared/version-compare.d.ts.map +1 -0
- package/dist/shared/version-compare.js +30 -0
- package/package.json +2 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {{
|
|
6
|
+
* repoRoot: string;
|
|
7
|
+
* packageRoot: string;
|
|
8
|
+
* repoBin: string;
|
|
9
|
+
* repoCli: string;
|
|
10
|
+
* }} FrameworkCheckout
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {{
|
|
15
|
+
* cwd: string;
|
|
16
|
+
* thisBin: string;
|
|
17
|
+
* }} FrameworkBinaryContextOptions
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {{
|
|
22
|
+
* inFrameworkCheckout: boolean;
|
|
23
|
+
* isRepoLocalBinary: boolean;
|
|
24
|
+
* isRepoLocalRuntime: boolean;
|
|
25
|
+
* checkout: FrameworkCheckout | null;
|
|
26
|
+
* thisBin: string;
|
|
27
|
+
* }} FrameworkBinaryContext
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
function fileExists(p) {
|
|
31
|
+
return existsSync(p);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {string} startDir
|
|
36
|
+
* @returns {FrameworkCheckout | null}
|
|
37
|
+
*/
|
|
38
|
+
export function findFrameworkCheckout(startDir) {
|
|
39
|
+
let dir = path.resolve(startDir);
|
|
40
|
+
for (;;) {
|
|
41
|
+
const packageRoot = path.join(dir, "packages", "agentplane");
|
|
42
|
+
const repoBin = path.join(packageRoot, "bin", "agentplane.js");
|
|
43
|
+
const repoCli = path.join(packageRoot, "src", "cli.ts");
|
|
44
|
+
if (fileExists(repoBin) && fileExists(repoCli)) {
|
|
45
|
+
return {
|
|
46
|
+
repoRoot: dir,
|
|
47
|
+
packageRoot,
|
|
48
|
+
repoBin,
|
|
49
|
+
repoCli,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const parent = path.dirname(dir);
|
|
54
|
+
if (parent === dir) return null;
|
|
55
|
+
dir = parent;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @param {string} baseDir
|
|
61
|
+
* @param {string} targetPath
|
|
62
|
+
* @returns {boolean}
|
|
63
|
+
*/
|
|
64
|
+
export function isPathInside(baseDir, targetPath) {
|
|
65
|
+
const rel = path.relative(path.resolve(baseDir), path.resolve(targetPath));
|
|
66
|
+
return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @param {FrameworkBinaryContextOptions} options
|
|
71
|
+
* @returns {FrameworkBinaryContext}
|
|
72
|
+
*/
|
|
73
|
+
export function resolveFrameworkBinaryContext(options) {
|
|
74
|
+
const cwd = path.resolve(options.cwd);
|
|
75
|
+
const thisBin = path.resolve(options.thisBin);
|
|
76
|
+
const checkout = findFrameworkCheckout(cwd);
|
|
77
|
+
if (!checkout) {
|
|
78
|
+
return {
|
|
79
|
+
inFrameworkCheckout: false,
|
|
80
|
+
isRepoLocalBinary: false,
|
|
81
|
+
isRepoLocalRuntime: false,
|
|
82
|
+
checkout: null,
|
|
83
|
+
thisBin,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
inFrameworkCheckout: true,
|
|
89
|
+
isRepoLocalBinary: path.resolve(checkout.repoBin) === thisBin,
|
|
90
|
+
isRepoLocalRuntime: isPathInside(checkout.packageRoot, thisBin),
|
|
91
|
+
checkout,
|
|
92
|
+
thisBin,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type WatchedRuntimeSnapshotFile = {
|
|
2
|
+
path: string;
|
|
3
|
+
sha256: string;
|
|
4
|
+
size_bytes: number;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type WatchedRuntimeSnapshot = {
|
|
8
|
+
watchedPaths: string[];
|
|
9
|
+
files: WatchedRuntimeSnapshotFile[];
|
|
10
|
+
snapshotHash: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type WatchedRuntimeSnapshotComparison = {
|
|
14
|
+
ok: boolean;
|
|
15
|
+
changedPaths: string[];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function getWatchedRuntimePathsForPackage(packageName: string): string[];
|
|
19
|
+
export function collectWatchedRuntimeSnapshot(
|
|
20
|
+
packageDir: string,
|
|
21
|
+
watchedPaths: string[],
|
|
22
|
+
): Promise<WatchedRuntimeSnapshot>;
|
|
23
|
+
export function compareWatchedRuntimeSnapshots(
|
|
24
|
+
recordedSnapshot: WatchedRuntimeSnapshot,
|
|
25
|
+
currentSnapshot: WatchedRuntimeSnapshot,
|
|
26
|
+
): WatchedRuntimeSnapshotComparison;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readdir, readFile, stat } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
const WATCHED_RUNTIME_PATHS = {
|
|
6
|
+
agentplane: [
|
|
7
|
+
"src",
|
|
8
|
+
"bin/agentplane.js",
|
|
9
|
+
"bin/dist-guard.js",
|
|
10
|
+
"bin/runtime-context.js",
|
|
11
|
+
"bin/stale-dist-policy.js",
|
|
12
|
+
],
|
|
13
|
+
"@agentplaneorg/core": ["src"],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function normalizePath(value) {
|
|
17
|
+
return value.split(path.sep).join("/");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function exists(targetPath) {
|
|
21
|
+
try {
|
|
22
|
+
await stat(targetPath);
|
|
23
|
+
return true;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function walkFiles(targetPath) {
|
|
30
|
+
const targetStat = await stat(targetPath);
|
|
31
|
+
if (targetStat.isFile()) return [targetPath];
|
|
32
|
+
if (!targetStat.isDirectory()) return [];
|
|
33
|
+
|
|
34
|
+
const entries = await readdir(targetPath, { withFileTypes: true });
|
|
35
|
+
const files = [];
|
|
36
|
+
for (const entry of entries.toSorted((a, b) => a.name.localeCompare(b.name))) {
|
|
37
|
+
const childPath = path.join(targetPath, entry.name);
|
|
38
|
+
if (entry.isDirectory()) {
|
|
39
|
+
files.push(...(await walkFiles(childPath)));
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (entry.isFile()) files.push(childPath);
|
|
43
|
+
}
|
|
44
|
+
return files;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function fileHash(content) {
|
|
48
|
+
return createHash("sha256").update(content).digest("hex");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function snapshotHash(files) {
|
|
52
|
+
const digest = createHash("sha256");
|
|
53
|
+
for (const file of files) {
|
|
54
|
+
digest.update(file.path);
|
|
55
|
+
digest.update(":");
|
|
56
|
+
digest.update(file.sha256);
|
|
57
|
+
digest.update("\n");
|
|
58
|
+
}
|
|
59
|
+
return digest.digest("hex");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function getWatchedRuntimePathsForPackage(packageName) {
|
|
63
|
+
return [...(WATCHED_RUNTIME_PATHS[packageName] ?? ["src"])];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export async function collectWatchedRuntimeSnapshot(packageDir, watchedPaths) {
|
|
67
|
+
const normalizedWatchedPaths = [...new Set(watchedPaths.map((entry) => normalizePath(entry)))];
|
|
68
|
+
|
|
69
|
+
const absoluteFiles = [];
|
|
70
|
+
for (const watchedPath of normalizedWatchedPaths) {
|
|
71
|
+
const absolutePath = path.join(packageDir, watchedPath);
|
|
72
|
+
if (!(await exists(absolutePath))) continue;
|
|
73
|
+
absoluteFiles.push(...(await walkFiles(absolutePath)));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const uniqueAbsoluteFiles = [...new Set(absoluteFiles)].toSorted((a, b) => a.localeCompare(b));
|
|
77
|
+
const files = [];
|
|
78
|
+
for (const absolutePath of uniqueAbsoluteFiles) {
|
|
79
|
+
const content = await readFile(absolutePath);
|
|
80
|
+
files.push({
|
|
81
|
+
path: normalizePath(path.relative(packageDir, absolutePath)),
|
|
82
|
+
sha256: fileHash(content),
|
|
83
|
+
size_bytes: content.byteLength,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
watchedPaths: normalizedWatchedPaths,
|
|
89
|
+
files,
|
|
90
|
+
snapshotHash: snapshotHash(files),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function snapshotFileMap(snapshot) {
|
|
95
|
+
return new Map(snapshot.files.map((file) => [file.path, file.sha256]));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function compareWatchedRuntimeSnapshots(recordedSnapshot, currentSnapshot) {
|
|
99
|
+
if (
|
|
100
|
+
recordedSnapshot.snapshotHash === currentSnapshot.snapshotHash &&
|
|
101
|
+
recordedSnapshot.files.length === currentSnapshot.files.length
|
|
102
|
+
) {
|
|
103
|
+
return { ok: true, changedPaths: [] };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const recordedMap = snapshotFileMap(recordedSnapshot);
|
|
107
|
+
const currentMap = snapshotFileMap(currentSnapshot);
|
|
108
|
+
const changedPaths = [...new Set([...recordedMap.keys(), ...currentMap.keys()])]
|
|
109
|
+
.filter((filePath) => recordedMap.get(filePath) !== currentMap.get(filePath))
|
|
110
|
+
.toSorted((a, b) => a.localeCompare(b));
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
ok: changedPaths.length === 0,
|
|
114
|
+
changedPaths,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
function normalizeArgs(argv) {
|
|
2
|
+
return argv
|
|
3
|
+
.slice(2)
|
|
4
|
+
.map((value) => String(value ?? "").trim())
|
|
5
|
+
.filter(Boolean);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function isHelpOrVersionCommand(args) {
|
|
9
|
+
return (
|
|
10
|
+
args.length === 0 ||
|
|
11
|
+
args[0] === "--help" ||
|
|
12
|
+
args[0] === "-h" ||
|
|
13
|
+
args[0] === "--version" ||
|
|
14
|
+
args[0] === "-v" ||
|
|
15
|
+
args[0] === "help"
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isConfigInspectionCommand(args) {
|
|
20
|
+
return args[0] === "config" && args[1] === "show";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function isTaskInspectionCommand(args) {
|
|
24
|
+
return args[0] === "task" && ["list", "show", "verify-show"].includes(args[1] ?? "");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isRoleOrQuickstartCommand(args) {
|
|
28
|
+
return args[0] === "quickstart" || args[0] === "role";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function classifyStaleDistPolicy(argv = process.argv) {
|
|
32
|
+
const args = normalizeArgs(argv);
|
|
33
|
+
if (
|
|
34
|
+
args[0] === "doctor" ||
|
|
35
|
+
(args[0] === "runtime" && args[1] === "explain") ||
|
|
36
|
+
isHelpOrVersionCommand(args) ||
|
|
37
|
+
isRoleOrQuickstartCommand(args) ||
|
|
38
|
+
isConfigInspectionCommand(args) ||
|
|
39
|
+
isTaskInspectionCommand(args)
|
|
40
|
+
) {
|
|
41
|
+
return { mode: "warn_and_run", reason: "read_only_diagnostic" };
|
|
42
|
+
}
|
|
43
|
+
return { mode: "strict", reason: "default" };
|
|
44
|
+
}
|