@actiondock/core 2.0.11 → 2.2.0
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/README.md +61 -30
- package/dist/app/app.d.ts +73 -0
- package/dist/app/app.js +700 -0
- package/dist/app/index.d.ts +2 -0
- package/dist/app/index.js +2 -0
- package/dist/app/types.d.ts +283 -0
- package/dist/app/types.js +1 -0
- package/dist/catalog/action-index.d.ts +9 -0
- package/dist/catalog/action-index.js +93 -0
- package/dist/catalog/action-resolver.d.ts +20 -0
- package/dist/catalog/action-resolver.js +95 -0
- package/dist/catalog/index.d.ts +5 -0
- package/dist/catalog/index.js +5 -0
- package/dist/catalog/location-registry.d.ts +15 -0
- package/dist/catalog/location-registry.js +138 -0
- package/dist/catalog/package-catalog.d.ts +7 -0
- package/dist/catalog/package-catalog.js +76 -0
- package/dist/catalog/types.d.ts +68 -0
- package/dist/catalog/types.js +1 -0
- package/dist/doctor/doctor.d.ts +7 -0
- package/dist/doctor/doctor.js +613 -0
- package/dist/doctor/index.d.ts +2 -0
- package/dist/doctor/index.js +2 -0
- package/dist/doctor/types.d.ts +23 -0
- package/dist/doctor/types.js +1 -0
- package/dist/errors.d.ts +122 -0
- package/dist/errors.js +123 -0
- package/dist/execution/index.d.ts +2 -0
- package/dist/execution/index.js +2 -0
- package/dist/execution/service.d.ts +79 -0
- package/dist/execution/service.js +633 -0
- package/dist/execution/types.d.ts +131 -0
- package/dist/execution/types.js +1 -0
- package/dist/export/index.d.ts +1 -0
- package/dist/export/index.js +1 -0
- package/dist/export/templates.d.ts +71 -0
- package/dist/export/templates.js +621 -0
- package/dist/filter/index.d.ts +1 -0
- package/dist/filter/index.js +1 -0
- package/dist/filter/intent.d.ts +33 -0
- package/dist/filter/intent.js +123 -0
- package/dist/host/host.d.ts +55 -0
- package/dist/host/host.js +740 -0
- package/dist/host/index.d.ts +2 -0
- package/dist/host/index.js +2 -0
- package/dist/host/types.d.ts +81 -0
- package/dist/host/types.js +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +20 -0
- package/dist/ipc/diagnostic.d.ts +65 -0
- package/dist/ipc/diagnostic.js +129 -0
- package/dist/ipc/host.d.ts +7 -0
- package/dist/ipc/host.js +93 -0
- package/dist/ipc/index.d.ts +4 -0
- package/dist/ipc/index.js +4 -0
- package/dist/ipc/target.d.ts +56 -0
- package/dist/ipc/target.js +297 -0
- package/dist/ipc/types.d.ts +42 -0
- package/dist/ipc/types.js +1 -0
- package/dist/platform/default.d.ts +32 -0
- package/dist/platform/default.js +40 -0
- package/dist/platform/index.d.ts +3 -0
- package/dist/platform/index.js +3 -0
- package/dist/platform/node-fs.d.ts +37 -0
- package/dist/platform/node-fs.js +81 -0
- package/dist/platform/types.d.ts +104 -0
- package/dist/platform/types.js +1 -0
- package/dist/profile/client.d.ts +162 -0
- package/dist/profile/client.js +467 -0
- package/dist/profile/index.d.ts +3 -0
- package/dist/profile/index.js +3 -0
- package/dist/profile/manager.d.ts +47 -0
- package/dist/profile/manager.js +294 -0
- package/dist/profile/types.d.ts +61 -0
- package/dist/profile/types.js +1 -0
- package/dist/project/closure.d.ts +25 -0
- package/dist/project/closure.js +68 -0
- package/dist/project/digest.d.ts +29 -0
- package/dist/project/digest.js +324 -0
- package/dist/project/index.d.ts +10 -0
- package/dist/project/index.js +10 -0
- package/dist/project/init.d.ts +26 -0
- package/dist/project/init.js +175 -0
- package/dist/project/loader.d.ts +99 -0
- package/dist/project/loader.js +484 -0
- package/dist/project/lockfile.d.ts +55 -0
- package/dist/project/lockfile.js +175 -0
- package/dist/project/manifest.d.ts +22 -0
- package/dist/project/manifest.js +220 -0
- package/dist/project/resolver.d.ts +116 -0
- package/dist/project/resolver.js +376 -0
- package/dist/project/transactions.d.ts +103 -0
- package/dist/project/transactions.js +1203 -0
- package/dist/project/types-generator.d.ts +33 -0
- package/dist/project/types-generator.js +168 -0
- package/dist/project/types.d.ts +107 -0
- package/dist/project/types.js +1 -0
- package/dist/registry/index.d.ts +5 -0
- package/dist/registry/index.js +5 -0
- package/dist/registry/lock.d.ts +27 -0
- package/dist/registry/lock.js +93 -0
- package/dist/registry/registry.d.ts +45 -0
- package/dist/registry/registry.js +611 -0
- package/dist/registry/resolve.d.ts +62 -0
- package/dist/registry/resolve.js +195 -0
- package/dist/registry/scan.d.ts +38 -0
- package/dist/registry/scan.js +135 -0
- package/dist/registry/types.d.ts +117 -0
- package/dist/registry/types.js +1 -0
- package/dist/runtime/action-collection.d.ts +27 -0
- package/dist/runtime/action-collection.js +57 -0
- package/dist/runtime/clock.d.ts +19 -0
- package/dist/runtime/clock.js +17 -0
- package/dist/runtime/context.d.ts +86 -0
- package/dist/runtime/context.js +242 -0
- package/dist/runtime/env.d.ts +56 -0
- package/dist/runtime/env.js +159 -0
- package/dist/runtime/events.d.ts +93 -0
- package/dist/runtime/events.js +604 -0
- package/dist/runtime/execution-manager.d.ts +48 -0
- package/dist/runtime/execution-manager.js +66 -0
- package/dist/runtime/index.d.ts +10 -0
- package/dist/runtime/index.js +10 -0
- package/dist/runtime/module-loader.d.ts +34 -0
- package/dist/runtime/module-loader.js +16 -0
- package/dist/runtime/process.d.ts +9 -0
- package/dist/runtime/process.js +146 -0
- package/dist/runtime/runner.d.ts +293 -0
- package/dist/runtime/runner.js +984 -0
- package/dist/runtime/standalone.d.ts +89 -0
- package/dist/runtime/standalone.js +536 -0
- package/dist/schema/validator.d.ts +28 -0
- package/dist/schema/validator.js +116 -0
- package/dist/server/body.d.ts +40 -0
- package/dist/server/body.js +93 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +5 -0
- package/dist/server/routes/actions.d.ts +5 -0
- package/dist/server/routes/actions.js +298 -0
- package/dist/server/routes/common.d.ts +47 -0
- package/dist/server/routes/common.js +104 -0
- package/dist/server/routes/config.d.ts +6 -0
- package/dist/server/routes/config.js +173 -0
- package/dist/server/routes/doctor.d.ts +5 -0
- package/dist/server/routes/doctor.js +63 -0
- package/dist/server/routes/health.d.ts +5 -0
- package/dist/server/routes/health.js +35 -0
- package/dist/server/routes/index.d.ts +9 -0
- package/dist/server/routes/index.js +9 -0
- package/dist/server/routes/info.d.ts +7 -0
- package/dist/server/routes/info.js +158 -0
- package/dist/server/routes/playbooks.d.ts +5 -0
- package/dist/server/routes/playbooks.js +134 -0
- package/dist/server/routes/runs.d.ts +5 -0
- package/dist/server/routes/runs.js +343 -0
- package/dist/server/routes/state.d.ts +6 -0
- package/dist/server/routes/state.js +169 -0
- package/dist/server/security.d.ts +44 -0
- package/dist/server/security.js +101 -0
- package/dist/server/server.d.ts +15 -0
- package/dist/server/server.js +355 -0
- package/dist/server/types.d.ts +78 -0
- package/dist/server/types.js +1 -0
- package/dist/storage/data-dir-lock.d.ts +119 -0
- package/dist/storage/data-dir-lock.js +1016 -0
- package/dist/storage/driver.d.ts +9 -0
- package/dist/storage/driver.js +59 -0
- package/dist/storage/index.d.ts +64 -0
- package/dist/storage/index.js +98 -0
- package/dist/storage/lazy.d.ts +8 -0
- package/dist/storage/lazy.js +44 -0
- package/dist/storage/mask.d.ts +26 -0
- package/dist/storage/mask.js +48 -0
- package/dist/storage/params.d.ts +13 -0
- package/dist/storage/params.js +32 -0
- package/dist/storage/sqlite.d.ts +79 -0
- package/dist/storage/sqlite.js +689 -0
- package/dist/storage/types.d.ts +172 -0
- package/dist/storage/types.js +14 -0
- package/dist/target/index.d.ts +4 -0
- package/dist/target/index.js +4 -0
- package/dist/target/local.d.ts +52 -0
- package/dist/target/local.js +343 -0
- package/dist/target/remote.d.ts +76 -0
- package/dist/target/remote.js +839 -0
- package/dist/target/target.d.ts +6 -0
- package/dist/target/target.js +35 -0
- package/dist/target/types.d.ts +246 -0
- package/dist/target/types.js +34 -0
- package/dist/utils/index.d.ts +49 -0
- package/dist/utils/index.js +180 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +4 -0
- package/package.json +13 -13
- package/src/build/index.ts +0 -1
- package/src/build/templates.ts +0 -59
- package/src/catalog/action-index.ts +0 -92
- package/src/catalog/action-resolver.ts +0 -120
- package/src/catalog/index.ts +0 -5
- package/src/catalog/location-registry.ts +0 -134
- package/src/catalog/package-catalog.ts +0 -87
- package/src/catalog/types.ts +0 -75
- package/src/doctor/doctor.ts +0 -419
- package/src/doctor/index.ts +0 -2
- package/src/doctor/types.ts +0 -25
- package/src/execution/index.ts +0 -2
- package/src/execution/service.ts +0 -322
- package/src/execution/types.ts +0 -73
- package/src/export/index.ts +0 -1
- package/src/export/templates.ts +0 -590
- package/src/filter/index.ts +0 -1
- package/src/filter/intent.ts +0 -154
- package/src/index.ts +0 -16
- package/src/profile/client.ts +0 -552
- package/src/profile/index.ts +0 -3
- package/src/profile/manager.ts +0 -341
- package/src/profile/types.ts +0 -71
- package/src/project/index.ts +0 -4
- package/src/project/init.ts +0 -242
- package/src/project/loader.ts +0 -479
- package/src/project/manifest.ts +0 -299
- package/src/project/types.ts +0 -141
- package/src/registry/index.ts +0 -2
- package/src/registry/registry.ts +0 -940
- package/src/registry/types.ts +0 -127
- package/src/runtime/clock.ts +0 -41
- package/src/runtime/context.ts +0 -259
- package/src/runtime/env.ts +0 -172
- package/src/runtime/events.ts +0 -142
- package/src/runtime/execution-manager.ts +0 -74
- package/src/runtime/index.ts +0 -10
- package/src/runtime/module-loader.ts +0 -67
- package/src/runtime/process.ts +0 -245
- package/src/runtime/runner.ts +0 -527
- package/src/runtime/standalone.ts +0 -429
- package/src/schema/validator.ts +0 -61
- package/src/server/body.ts +0 -112
- package/src/server/index.ts +0 -7
- package/src/server/routes/actions.ts +0 -262
- package/src/server/routes/common.ts +0 -126
- package/src/server/routes/config.ts +0 -147
- package/src/server/routes/doctor.ts +0 -29
- package/src/server/routes/health.ts +0 -40
- package/src/server/routes/index.ts +0 -9
- package/src/server/routes/info.ts +0 -221
- package/src/server/routes/playbooks.ts +0 -109
- package/src/server/routes/runs.ts +0 -301
- package/src/server/routes/state.ts +0 -133
- package/src/server/runtime-registry.ts +0 -115
- package/src/server/security.ts +0 -115
- package/src/server/server.ts +0 -251
- package/src/server/types.ts +0 -57
- package/src/storage/driver.ts +0 -126
- package/src/storage/index.ts +0 -81
- package/src/storage/mask.ts +0 -34
- package/src/storage/sqlite.ts +0 -714
- package/src/storage/types.ts +0 -139
- package/src/utils/index.ts +0 -62
package/src/doctor/doctor.ts
DELETED
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
import { existsSync, statSync } from "node:fs";
|
|
2
|
-
import { delimiter, join, relative } from "node:path";
|
|
3
|
-
import { discoverActionFiles, findProjectRoot, loadActions, loadPlaybooks, loadProjectConfig } from "../project/loader";
|
|
4
|
-
import { loadManifest, MANIFEST_FILE_NAME } from "../project/manifest";
|
|
5
|
-
import { getRegistryStatus } from "../registry/registry";
|
|
6
|
-
import { createGlobalStorage, createStorage } from "../storage";
|
|
7
|
-
import { findExecutable, getActionDockHome } from "../utils";
|
|
8
|
-
import type { DoctorCheckItem, DoctorReport } from "./types";
|
|
9
|
-
|
|
10
|
-
function compareSemver(v1: string, v2: string): number {
|
|
11
|
-
const p1 = v1.replace(/^v/, "").split(".").map(Number);
|
|
12
|
-
const p2 = v2.replace(/^v/, "").split(".").map(Number);
|
|
13
|
-
for (let i = 0; i < Math.max(p1.length, p2.length); i++) {
|
|
14
|
-
const num1 = p1[i] || 0;
|
|
15
|
-
const num2 = p2[i] || 0;
|
|
16
|
-
if (num1 > num2) return 1;
|
|
17
|
-
if (num1 < num2) return -1;
|
|
18
|
-
}
|
|
19
|
-
return 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export async function runDoctorChecks(options?: {
|
|
23
|
-
cwd?: string;
|
|
24
|
-
packageIdOrPath?: string;
|
|
25
|
-
customHome?: string;
|
|
26
|
-
}): Promise<DoctorReport> {
|
|
27
|
-
const cwd = options?.cwd || process.cwd();
|
|
28
|
-
const checks: DoctorCheckItem[] = [];
|
|
29
|
-
|
|
30
|
-
// 1. Check Node.js Runtime
|
|
31
|
-
const nodeVersion = process.versions.node;
|
|
32
|
-
if (nodeVersion) {
|
|
33
|
-
const isGte22 = compareSemver(nodeVersion, "22.12.0") >= 0;
|
|
34
|
-
checks.push({
|
|
35
|
-
id: "runtime.node",
|
|
36
|
-
category: "runtime",
|
|
37
|
-
name: "Node.js Runtime",
|
|
38
|
-
status: isGte22 ? "ok" : "warn",
|
|
39
|
-
message: `v${nodeVersion} (${isGte22 ? ">= 22.12.0 supported" : ">= 22.12.0 recommended"})`,
|
|
40
|
-
fix: isGte22 ? undefined : "Upgrade Node.js to v22.12.0 or higher",
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 2. Check Bun Runtime (Optional compiler for standalone binaries)
|
|
45
|
-
const bunVersion = (typeof (globalThis as any).Bun !== "undefined" && (globalThis as any).Bun.version) || (process.versions as any).bun;
|
|
46
|
-
if (bunVersion) {
|
|
47
|
-
checks.push({
|
|
48
|
-
id: "runtime.bun",
|
|
49
|
-
category: "runtime",
|
|
50
|
-
name: "Bun Runtime",
|
|
51
|
-
status: "ok",
|
|
52
|
-
message: `v${bunVersion} (available for standalone binary compilation)`,
|
|
53
|
-
});
|
|
54
|
-
} else {
|
|
55
|
-
checks.push({
|
|
56
|
-
id: "runtime.bun",
|
|
57
|
-
category: "runtime",
|
|
58
|
-
name: "Bun Runtime",
|
|
59
|
-
status: "ok",
|
|
60
|
-
message: "Bun compiler not detected (optional, required only for 'ad build' standalone binaries)",
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// 3. Check CLI in PATH
|
|
65
|
-
const adPath = findExecutable("ad");
|
|
66
|
-
|
|
67
|
-
if (adPath) {
|
|
68
|
-
checks.push({
|
|
69
|
-
id: "runtime.cli",
|
|
70
|
-
category: "runtime",
|
|
71
|
-
name: "CLI Executable",
|
|
72
|
-
status: "ok",
|
|
73
|
-
message: `Found 'ad' in PATH at ${adPath}`,
|
|
74
|
-
});
|
|
75
|
-
} else {
|
|
76
|
-
checks.push({
|
|
77
|
-
id: "runtime.cli",
|
|
78
|
-
category: "runtime",
|
|
79
|
-
name: "CLI Executable",
|
|
80
|
-
status: "warn",
|
|
81
|
-
message: "'ad' command not found in PATH",
|
|
82
|
-
fix: "Run 'npm install -g @actiondock/cli' or in SDK workspace run 'cd packages/cli && npm link'",
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// 3. Check Global Storage
|
|
87
|
-
const globalHome = getActionDockHome(options?.customHome);
|
|
88
|
-
try {
|
|
89
|
-
const globalStorage = createGlobalStorage(options?.customHome);
|
|
90
|
-
await globalStorage.setConfig("_doctor_probe_", "ok");
|
|
91
|
-
await globalStorage.deleteConfig("_doctor_probe_");
|
|
92
|
-
globalStorage.close();
|
|
93
|
-
|
|
94
|
-
checks.push({
|
|
95
|
-
id: "storage.global",
|
|
96
|
-
category: "storage",
|
|
97
|
-
name: "Global Storage",
|
|
98
|
-
status: "ok",
|
|
99
|
-
message: `Global SQLite database verified at ${globalHome}`,
|
|
100
|
-
});
|
|
101
|
-
} catch (err: any) {
|
|
102
|
-
checks.push({
|
|
103
|
-
id: "storage.global",
|
|
104
|
-
category: "storage",
|
|
105
|
-
name: "Global Storage",
|
|
106
|
-
status: "error",
|
|
107
|
-
message: `Failed to access global storage: ${err.message}`,
|
|
108
|
-
fix: `Ensure directory '${globalHome}' is writable`,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// 4. Check Global Registry Health
|
|
113
|
-
try {
|
|
114
|
-
const regStatus = getRegistryStatus(options?.customHome);
|
|
115
|
-
if (regStatus.staleCount > 0) {
|
|
116
|
-
checks.push({
|
|
117
|
-
id: "registry.global",
|
|
118
|
-
category: "registry",
|
|
119
|
-
name: "Global Registry",
|
|
120
|
-
status: "warn",
|
|
121
|
-
message: `${regStatus.totalPackagesCount} package(s), ${regStatus.workspaces.length} workspace(s), but ${regStatus.staleCount} stale path(s) detected`,
|
|
122
|
-
fix: "Run 'ad unlink --prune' to clean up stale entries from registry",
|
|
123
|
-
});
|
|
124
|
-
} else {
|
|
125
|
-
checks.push({
|
|
126
|
-
id: "registry.global",
|
|
127
|
-
category: "registry",
|
|
128
|
-
name: "Global Registry",
|
|
129
|
-
status: "ok",
|
|
130
|
-
message: `${regStatus.totalPackagesCount} linked package(s), ${regStatus.workspaces.length} workspace(s) (0 stale)`,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
} catch (err: any) {
|
|
134
|
-
checks.push({
|
|
135
|
-
id: "registry.global",
|
|
136
|
-
category: "registry",
|
|
137
|
-
name: "Global Registry",
|
|
138
|
-
status: "error",
|
|
139
|
-
message: `Failed to read registry: ${err.message}`,
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// 5. Check Project Context
|
|
144
|
-
let projectRoot: string | null = null;
|
|
145
|
-
if (options?.packageIdOrPath) {
|
|
146
|
-
projectRoot = findProjectRoot(options.packageIdOrPath);
|
|
147
|
-
} else {
|
|
148
|
-
projectRoot = findProjectRoot(cwd);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
let packageId: string | undefined;
|
|
152
|
-
|
|
153
|
-
if (projectRoot) {
|
|
154
|
-
try {
|
|
155
|
-
const config = loadProjectConfig(projectRoot);
|
|
156
|
-
packageId = config.id;
|
|
157
|
-
|
|
158
|
-
// Project Config Check
|
|
159
|
-
checks.push({
|
|
160
|
-
id: "project.config",
|
|
161
|
-
category: "project",
|
|
162
|
-
name: "Project Configuration",
|
|
163
|
-
status: "ok",
|
|
164
|
-
message: `Valid (${config.id} v${config.version})`,
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
// SDK Resolution Check
|
|
168
|
-
const hasSdkInNodeModules =
|
|
169
|
-
existsSync(join(projectRoot, "node_modules", "@actiondock", "sdk")) ||
|
|
170
|
-
existsSync(join(projectRoot, "node_modules", "@actiondock", "sdk", "package.json"));
|
|
171
|
-
|
|
172
|
-
if (hasSdkInNodeModules) {
|
|
173
|
-
checks.push({
|
|
174
|
-
id: "project.sdk",
|
|
175
|
-
category: "project",
|
|
176
|
-
name: "SDK Dependency",
|
|
177
|
-
status: "ok",
|
|
178
|
-
message: "Resolved @actiondock/sdk in node_modules",
|
|
179
|
-
});
|
|
180
|
-
} else {
|
|
181
|
-
checks.push({
|
|
182
|
-
id: "project.sdk",
|
|
183
|
-
category: "project",
|
|
184
|
-
name: "SDK Dependency",
|
|
185
|
-
status: "warn",
|
|
186
|
-
message: "@actiondock/sdk not found in project node_modules",
|
|
187
|
-
fix: "Run 'bun link @actiondock/sdk' or 'bun install' in project directory",
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// Project Runtime Database Check
|
|
192
|
-
try {
|
|
193
|
-
const projectStorage = createStorage(config.id, { projectRoot });
|
|
194
|
-
await projectStorage.setConfig("_doctor_probe_", "ok");
|
|
195
|
-
await projectStorage.deleteConfig("_doctor_probe_");
|
|
196
|
-
projectStorage.close();
|
|
197
|
-
|
|
198
|
-
checks.push({
|
|
199
|
-
id: "project.storage",
|
|
200
|
-
category: "project",
|
|
201
|
-
name: "Project Database",
|
|
202
|
-
status: "ok",
|
|
203
|
-
message: `Database writable at ${join(projectRoot, ".actiondock", "runtime.db")}`,
|
|
204
|
-
});
|
|
205
|
-
} catch (err: any) {
|
|
206
|
-
checks.push({
|
|
207
|
-
id: "project.storage",
|
|
208
|
-
category: "project",
|
|
209
|
-
name: "Project Database",
|
|
210
|
-
status: "error",
|
|
211
|
-
message: `Failed to write project runtime database: ${err.message}`,
|
|
212
|
-
fix: `Check write permissions for '${join(projectRoot, ".actiondock")}'`,
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Actions Check
|
|
217
|
-
try {
|
|
218
|
-
const manifest = loadManifest(projectRoot);
|
|
219
|
-
let actionsCount = 0;
|
|
220
|
-
if (manifest?.actions) {
|
|
221
|
-
actionsCount = Object.keys(manifest.actions).length;
|
|
222
|
-
} else {
|
|
223
|
-
const actions = await loadActions(projectRoot, config.actionsDir, { autoInstall: false });
|
|
224
|
-
actionsCount = actions.size;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (actionsCount === 0) {
|
|
228
|
-
checks.push({
|
|
229
|
-
id: "project.actions",
|
|
230
|
-
category: "project",
|
|
231
|
-
name: "Actions",
|
|
232
|
-
status: "warn",
|
|
233
|
-
message: `No actions found in '${config.actionsDir || "actions"}'`,
|
|
234
|
-
fix: "Run 'ad action new <id>' to create your first action",
|
|
235
|
-
});
|
|
236
|
-
} else {
|
|
237
|
-
checks.push({
|
|
238
|
-
id: "project.actions",
|
|
239
|
-
category: "project",
|
|
240
|
-
name: "Actions",
|
|
241
|
-
status: "ok",
|
|
242
|
-
message: `${actionsCount} action(s) valid and loaded`,
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
} catch (err: any) {
|
|
246
|
-
checks.push({
|
|
247
|
-
id: "project.actions",
|
|
248
|
-
category: "project",
|
|
249
|
-
name: "Actions",
|
|
250
|
-
status: "error",
|
|
251
|
-
message: `Failed to load actions: ${err.message}`,
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// Project Manifest Check (Lightweight Static Detection)
|
|
256
|
-
try {
|
|
257
|
-
const manifestPath = join(projectRoot, MANIFEST_FILE_NAME);
|
|
258
|
-
const manifest = loadManifest(projectRoot);
|
|
259
|
-
const actionFiles = discoverActionFiles(projectRoot, config.actionsDir || "actions");
|
|
260
|
-
|
|
261
|
-
if (!existsSync(manifestPath)) {
|
|
262
|
-
if (actionFiles.length > 0) {
|
|
263
|
-
checks.push({
|
|
264
|
-
id: "project.manifest",
|
|
265
|
-
category: "project",
|
|
266
|
-
name: "Action Manifest",
|
|
267
|
-
status: "warn",
|
|
268
|
-
message: `${MANIFEST_FILE_NAME} not found (${actionFiles.length} action source file(s) exist)`,
|
|
269
|
-
fix: "Run 'ad action sync' to generate manifest",
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
} else if (manifest && manifest.actions) {
|
|
273
|
-
const missingFiles = Object.entries(manifest.actions)
|
|
274
|
-
.filter(([_, item]) => !existsSync(join(projectRoot, item.entry)))
|
|
275
|
-
.map(([id, item]) => `${id} (${item.entry})`);
|
|
276
|
-
|
|
277
|
-
const manifestEntries = new Set(
|
|
278
|
-
Object.values(manifest.actions).map((a) => a.entry.replace(/\\/g, "/"))
|
|
279
|
-
);
|
|
280
|
-
const untracked = actionFiles
|
|
281
|
-
.map((f) => relative(projectRoot, f).replace(/\\/g, "/"))
|
|
282
|
-
.filter((rel) => !manifestEntries.has(rel));
|
|
283
|
-
|
|
284
|
-
if (missingFiles.length > 0) {
|
|
285
|
-
checks.push({
|
|
286
|
-
id: "project.manifest",
|
|
287
|
-
category: "project",
|
|
288
|
-
name: "Action Manifest",
|
|
289
|
-
status: "warn",
|
|
290
|
-
message: `${missingFiles.length} action(s) in manifest point to missing files: ${missingFiles.join(", ")}`,
|
|
291
|
-
fix: "Run 'ad action sync' to synchronize manifest",
|
|
292
|
-
});
|
|
293
|
-
} else if (untracked.length > 0) {
|
|
294
|
-
checks.push({
|
|
295
|
-
id: "project.manifest",
|
|
296
|
-
category: "project",
|
|
297
|
-
name: "Action Manifest",
|
|
298
|
-
status: "warn",
|
|
299
|
-
message: `${untracked.length} action file(s) not declared in manifest: ${untracked.join(", ")}`,
|
|
300
|
-
fix: "Run 'ad action sync' to synchronize manifest",
|
|
301
|
-
});
|
|
302
|
-
} else {
|
|
303
|
-
const manifestStat = statSync(manifestPath);
|
|
304
|
-
const newerFiles = actionFiles.filter(
|
|
305
|
-
(f) => statSync(f).mtimeMs > manifestStat.mtimeMs + 2000
|
|
306
|
-
);
|
|
307
|
-
if (newerFiles.length > 0) {
|
|
308
|
-
checks.push({
|
|
309
|
-
id: "project.manifest",
|
|
310
|
-
category: "project",
|
|
311
|
-
name: "Action Manifest",
|
|
312
|
-
status: "ok",
|
|
313
|
-
message: `Manifest valid (Note: ${newerFiles.length} action file(s) modified after manifest; run 'ad action sync' if definitions changed)`,
|
|
314
|
-
});
|
|
315
|
-
} else {
|
|
316
|
-
checks.push({
|
|
317
|
-
id: "project.manifest",
|
|
318
|
-
category: "project",
|
|
319
|
-
name: "Action Manifest",
|
|
320
|
-
status: "ok",
|
|
321
|
-
message: "Manifest synchronized with action files",
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
} catch (err: any) {
|
|
327
|
-
checks.push({
|
|
328
|
-
id: "project.manifest",
|
|
329
|
-
category: "project",
|
|
330
|
-
name: "Action Manifest",
|
|
331
|
-
status: "error",
|
|
332
|
-
message: `Failed to inspect manifest: ${err.message}`,
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
// Playbooks Check
|
|
338
|
-
try {
|
|
339
|
-
const playbooks = loadPlaybooks(projectRoot, config.playbooksDir);
|
|
340
|
-
checks.push({
|
|
341
|
-
id: "project.playbooks",
|
|
342
|
-
category: "project",
|
|
343
|
-
name: "Playbooks",
|
|
344
|
-
status: "ok",
|
|
345
|
-
message: `${playbooks.size} playbook(s) valid`,
|
|
346
|
-
});
|
|
347
|
-
} catch (err: any) {
|
|
348
|
-
checks.push({
|
|
349
|
-
id: "project.playbooks",
|
|
350
|
-
category: "project",
|
|
351
|
-
name: "Playbooks",
|
|
352
|
-
status: "warn",
|
|
353
|
-
message: `Playbooks issue: ${err.message}`,
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
// Config readiness check
|
|
358
|
-
if (config.config && Object.keys(config.config).length > 0) {
|
|
359
|
-
const missingKeys: string[] = [];
|
|
360
|
-
const projectStorage = createStorage(config.id, { projectRoot });
|
|
361
|
-
for (const [key, def] of Object.entries(config.config)) {
|
|
362
|
-
const inStorage = await projectStorage.getConfig(key);
|
|
363
|
-
const envNames = Array.isArray(def.env) ? def.env : def.env ? [def.env] : [key];
|
|
364
|
-
const inEnv = envNames.some((e) => process.env[e] !== undefined);
|
|
365
|
-
const isRequired = (def as any).required || (def.default === undefined && def.secret);
|
|
366
|
-
if ((isRequired || def.default === undefined) && inStorage === undefined && !inEnv) {
|
|
367
|
-
missingKeys.push(key);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
projectStorage.close();
|
|
371
|
-
|
|
372
|
-
if (missingKeys.length > 0) {
|
|
373
|
-
checks.push({
|
|
374
|
-
id: "project.config_readiness",
|
|
375
|
-
category: "project",
|
|
376
|
-
name: "Config Readiness",
|
|
377
|
-
status: "warn",
|
|
378
|
-
message: `Required config item(s) missing: ${missingKeys.join(", ")}`,
|
|
379
|
-
fix: `Run 'ad config set <KEY> <VALUE>' to configure missing keys`,
|
|
380
|
-
});
|
|
381
|
-
} else {
|
|
382
|
-
checks.push({
|
|
383
|
-
id: "project.config_readiness",
|
|
384
|
-
category: "project",
|
|
385
|
-
name: "Config Readiness",
|
|
386
|
-
status: "ok",
|
|
387
|
-
message: "All declared configuration dependencies satisfied",
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
} catch (err: any) {
|
|
392
|
-
checks.push({
|
|
393
|
-
id: "project.config",
|
|
394
|
-
category: "project",
|
|
395
|
-
name: "Project Configuration",
|
|
396
|
-
status: "error",
|
|
397
|
-
message: `Invalid actiondock.json: ${err.message}`,
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
const okCount = checks.filter((c) => c.status === "ok").length;
|
|
403
|
-
const warnCount = checks.filter((c) => c.status === "warn").length;
|
|
404
|
-
const errorCount = checks.filter((c) => c.status === "error").length;
|
|
405
|
-
|
|
406
|
-
return {
|
|
407
|
-
ok: errorCount === 0,
|
|
408
|
-
hasProject: !!projectRoot,
|
|
409
|
-
projectRoot: projectRoot || undefined,
|
|
410
|
-
packageId,
|
|
411
|
-
summary: {
|
|
412
|
-
total: checks.length,
|
|
413
|
-
ok: okCount,
|
|
414
|
-
warn: warnCount,
|
|
415
|
-
error: errorCount,
|
|
416
|
-
},
|
|
417
|
-
checks,
|
|
418
|
-
};
|
|
419
|
-
}
|
package/src/doctor/index.ts
DELETED
package/src/doctor/types.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export type CheckStatus = "ok" | "warn" | "error";
|
|
2
|
-
|
|
3
|
-
export interface DoctorCheckItem {
|
|
4
|
-
id: string;
|
|
5
|
-
category: "runtime" | "storage" | "registry" | "project";
|
|
6
|
-
name: string;
|
|
7
|
-
status: CheckStatus;
|
|
8
|
-
message: string;
|
|
9
|
-
detail?: string;
|
|
10
|
-
fix?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface DoctorReport {
|
|
14
|
-
ok: boolean;
|
|
15
|
-
hasProject: boolean;
|
|
16
|
-
projectRoot?: string;
|
|
17
|
-
packageId?: string;
|
|
18
|
-
summary: {
|
|
19
|
-
total: number;
|
|
20
|
-
ok: number;
|
|
21
|
-
warn: number;
|
|
22
|
-
error: number;
|
|
23
|
-
};
|
|
24
|
-
checks: DoctorCheckItem[];
|
|
25
|
-
}
|
package/src/execution/index.ts
DELETED