agentplane 0.3.2 → 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 +1 -1
- 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 +8 -4
- package/bin/agentplane.js +59 -9
- package/bin/dist-guard.js +78 -10
- package/bin/runtime-context.d.ts +3 -0
- package/bin/runtime-context.js +13 -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 +1 -3
- package/dist/cli/bootstrap-guide.d.ts.map +1 -1
- package/dist/cli/bootstrap-guide.js +13 -33
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +27 -34
- 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/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 -342
- 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/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 -8
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +158 -387
- 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.map +1 -1
- package/dist/commands/task/finish.js +7 -4
- 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.d.ts +1 -35
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +46 -331
- 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,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
|
+
}
|