@dadado/agent-kit-cli 5.15.1 → 5.17.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.
Files changed (72) hide show
  1. package/dashboard/dashboard-data.mjs +69 -65
  2. package/dashboard/lib/guards.d.mts +5 -0
  3. package/dashboard/lib/guards.mjs +31 -0
  4. package/dashboard/lib/identity-probe.mjs +56 -0
  5. package/dashboard/lib/pipeline-cache.mjs +58 -0
  6. package/dashboard/lib/processes.mjs +71 -0
  7. package/dashboard/serve.mjs +43 -1
  8. package/dashboard/start-broadcast.mjs +2 -12
  9. package/dashboard/start.mjs +2 -13
  10. package/dist/add-HTYIFKMN.js +150 -0
  11. package/dist/chunk-2IPXQFJE.js +253 -0
  12. package/dist/chunk-2RDRMGD3.js +82 -0
  13. package/dist/chunk-2YU2H7I6.js +42 -0
  14. package/dist/chunk-4IWG5CVE.js +214 -0
  15. package/dist/chunk-5VCOWTTP.js +6 -0
  16. package/dist/chunk-77V75A7O.js +39 -0
  17. package/dist/chunk-7HDQEK6T.js +26 -0
  18. package/dist/chunk-AW74INUW.js +1456 -0
  19. package/dist/chunk-B73KQ5KX.js +972 -0
  20. package/dist/chunk-CBCW5R5J.js +484 -0
  21. package/dist/chunk-DE3LQFSJ.js +18 -0
  22. package/dist/chunk-DQA434Y4.js +106 -0
  23. package/dist/chunk-F4VMYR7U.js +318 -0
  24. package/dist/chunk-F6C3GFKV.js +57 -0
  25. package/dist/chunk-HFUH3HVS.js +282 -0
  26. package/dist/chunk-HS7LVVLO.js +74 -0
  27. package/dist/chunk-IHROBTNM.js +135 -0
  28. package/dist/chunk-KD2MYBB6.js +213 -0
  29. package/dist/chunk-MAPOQEA2.js +43 -0
  30. package/dist/chunk-N3HTJVBR.js +341 -0
  31. package/dist/chunk-NQ7IQ5XT.js +26 -0
  32. package/dist/chunk-OUQZC744.js +1315 -0
  33. package/dist/chunk-PCCQUWE5.js +817 -0
  34. package/dist/chunk-PNFF6OU3.js +273 -0
  35. package/dist/chunk-PNG7LO2F.js +53 -0
  36. package/dist/chunk-QTON2GQX.js +203 -0
  37. package/dist/chunk-S6GMFDKV.js +50 -0
  38. package/dist/chunk-SMGFN3Z4.js +503 -0
  39. package/dist/chunk-STGFBAYT.js +641 -0
  40. package/dist/chunk-TFZ2JUXH.js +1081 -0
  41. package/dist/chunk-VY7MTPJ2.js +205 -0
  42. package/dist/chunk-W24CMQ32.js +525 -0
  43. package/dist/chunk-WW3YZKHW.js +165 -0
  44. package/dist/chunk-ZB43YMHW.js +20 -0
  45. package/dist/chunk-ZCTSUQRR.js +874 -0
  46. package/dist/chunk-ZXKZBTXE.js +17 -0
  47. package/dist/contribute-C6AW2P6J.js +367 -0
  48. package/dist/cursor-awareness-KTL2RGKD.js +77 -0
  49. package/dist/dashboard-YSNUGBFY.js +21 -0
  50. package/dist/dashboard-broadcast-M4CMW7RX.js +119 -0
  51. package/dist/diff-VHNR62SI.js +74 -0
  52. package/dist/doctor-PET2HRRJ.js +236 -0
  53. package/dist/dogfood-KKFVRWT6.js +366 -0
  54. package/dist/guard-EHXF76ID.js +530 -0
  55. package/dist/handoff-3UI6VKVG.js +302 -0
  56. package/dist/hook-DYIMKJYL.js +1074 -0
  57. package/dist/index.js +62 -14068
  58. package/dist/init-Q4LBM6KT.js +127 -0
  59. package/dist/install-RHOS3OYZ.js +34 -0
  60. package/dist/mission-control-LJACEVVN.js +89 -0
  61. package/dist/monitors-QV2IS3MP.js +176 -0
  62. package/dist/plan-index-JMC7Z4DW.js +44 -0
  63. package/dist/public-inbound-radar-WP3XF7GS.js +68 -0
  64. package/dist/remote-issues-SZ4HDQL5.js +44 -0
  65. package/dist/run-I3BFGULT.js +243 -0
  66. package/dist/run-plan-FO7CL4M3.js +118 -0
  67. package/dist/scan-NI2SWJ2E.js +33 -0
  68. package/dist/setup-global-M42GEODI.js +340 -0
  69. package/dist/status-XPVQVQMX.js +150 -0
  70. package/dist/update-FJ2EBZVO.js +283 -0
  71. package/dist/validate-V2CW7J4B.js +201 -0
  72. package/package.json +3 -3
@@ -0,0 +1,214 @@
1
+ // src/readiness/env-checks.ts
2
+ import { constants, access, readFile, realpath, stat } from "fs/promises";
3
+ import { homedir } from "os";
4
+ import path from "path";
5
+ var MIN_NODE_MAJOR = 20;
6
+ var CLI_PACKAGE_JSON_REL = path.join(
7
+ "lib",
8
+ "node_modules",
9
+ "@dadado",
10
+ "agent-kit-cli",
11
+ "package.json"
12
+ );
13
+ var DIST_INDEX_RE = /(?:\$\{basedir\}|\$basedir)?[^'"\s;]*dist\/index\.js/g;
14
+ function extractDistIndexFromBinScript(contents) {
15
+ const found = [];
16
+ DIST_INDEX_RE.lastIndex = 0;
17
+ for (const match of contents.matchAll(DIST_INDEX_RE)) {
18
+ const raw = match[0]?.trim();
19
+ if (raw) found.push(raw.replace(/\\/g, "/"));
20
+ }
21
+ return found;
22
+ }
23
+ function expandBinDirVars(raw, binDir) {
24
+ return raw.replace(/\$\{basedir\}/g, binDir).replace(/\$basedir/g, binDir);
25
+ }
26
+ var SHIM_MAX_BYTES = 4096;
27
+ function packageJsonFromDistIndex(distIndex) {
28
+ return path.join(path.dirname(distIndex), "..", "package.json");
29
+ }
30
+ function parsePackageVersion(contents) {
31
+ try {
32
+ const parsed = JSON.parse(contents);
33
+ return typeof parsed.version === "string" && parsed.version.length > 0 ? parsed.version : null;
34
+ } catch {
35
+ return null;
36
+ }
37
+ }
38
+ async function readBinVersion(binPath, options = {}) {
39
+ const readFileImpl = options.readFileImpl ?? ((filePath) => readFile(filePath, "utf8"));
40
+ const binDir = path.dirname(binPath);
41
+ const candidates = [];
42
+ let realBin = binPath;
43
+ try {
44
+ realBin = await realpath(binPath);
45
+ } catch {
46
+ }
47
+ if (path.basename(realBin) === "index.js" && path.basename(path.dirname(realBin)) === "dist") {
48
+ candidates.push(packageJsonFromDistIndex(realBin));
49
+ }
50
+ candidates.push(
51
+ path.join(binDir, "..", CLI_PACKAGE_JSON_REL),
52
+ path.join(binDir, "..", "node_modules", "@dadado", "agent-kit-cli", "package.json")
53
+ );
54
+ try {
55
+ if ((await stat(realBin)).size < SHIM_MAX_BYTES) {
56
+ const contents = await readFileImpl(binPath);
57
+ for (const raw of extractDistIndexFromBinScript(contents)) {
58
+ const distIndex = path.resolve(binDir, expandBinDirVars(raw, binDir));
59
+ candidates.push(packageJsonFromDistIndex(distIndex));
60
+ }
61
+ }
62
+ } catch {
63
+ }
64
+ const seen = /* @__PURE__ */ new Set();
65
+ for (const candidate of candidates) {
66
+ const resolved = path.resolve(candidate);
67
+ if (seen.has(resolved)) continue;
68
+ seen.add(resolved);
69
+ try {
70
+ const version = parsePackageVersion(await readFileImpl(resolved));
71
+ if (version) return version;
72
+ } catch {
73
+ }
74
+ }
75
+ return null;
76
+ }
77
+ async function resolveBinOnPath(binName, env, platform) {
78
+ const pathVar = env.PATH ?? env.Path ?? "";
79
+ if (!pathVar) return null;
80
+ const dirs = pathVar.split(path.delimiter).filter(Boolean);
81
+ const candidates = platform === "win32" ? [binName, `${binName}.cmd`, `${binName}.exe`, `${binName}.bat`] : [binName];
82
+ for (const dir of dirs) {
83
+ for (const candidate of candidates) {
84
+ const abs = path.join(dir, candidate);
85
+ try {
86
+ await access(abs, platform === "win32" ? void 0 : constants.X_OK);
87
+ return abs;
88
+ } catch {
89
+ }
90
+ }
91
+ }
92
+ return null;
93
+ }
94
+ function isNodeVersionOk(nodeVersion, minMajor = MIN_NODE_MAJOR) {
95
+ const match = /^v?(\d+)/.exec(nodeVersion);
96
+ if (!match) return false;
97
+ const major = Number(match[1]);
98
+ return Number.isFinite(major) && major >= minMajor;
99
+ }
100
+ function detectShellName(env, platform) {
101
+ if (platform === "win32") {
102
+ if (env.PSModulePath) return "powershell";
103
+ if (env.ComSpec) return "cmd";
104
+ return null;
105
+ }
106
+ const shellPath = env.SHELL;
107
+ if (!shellPath) return null;
108
+ const base = path.basename(shellPath).trim();
109
+ return base || null;
110
+ }
111
+ function detectShellProfile(env, platform, homeDir) {
112
+ const shellName = detectShellName(env, platform);
113
+ if (shellName === "zsh") return path.join(homeDir, ".zshrc");
114
+ if (shellName === "bash") return path.join(homeDir, ".bashrc");
115
+ return null;
116
+ }
117
+ function parseNpmrcPrefix(content, homeDir) {
118
+ const match = /^\s*prefix\s*=\s*(.+?)\s*$/m.exec(content);
119
+ const captured = match?.[1];
120
+ if (!captured) return null;
121
+ let value = captured.trim().replace(/^["']|["']$/g, "");
122
+ if (value.startsWith("~")) {
123
+ value = path.join(homeDir, value.slice(1));
124
+ }
125
+ return value || null;
126
+ }
127
+ function heuristicPrefixFromExecPath(execPath, platform) {
128
+ const p = platform === "win32" ? path.win32 : path.posix;
129
+ return platform === "win32" ? p.dirname(execPath) : p.dirname(p.dirname(execPath));
130
+ }
131
+ async function detectNpmPrefix(options = {}) {
132
+ const env = options.env ?? process.env;
133
+ const platform = options.platform ?? process.platform;
134
+ const homeDir = options.homeDir ?? homedir();
135
+ const execPath = options.execPath ?? process.execPath;
136
+ const readFileImpl = options.readFileImpl ?? ((filePath) => readFile(filePath, "utf8"));
137
+ const envPrefix = env.npm_config_prefix ?? env.NPM_CONFIG_PREFIX;
138
+ if (envPrefix?.trim()) {
139
+ return { prefix: envPrefix.trim(), source: "env" };
140
+ }
141
+ const userconfigPath = env.NPM_CONFIG_USERCONFIG ?? path.join(homeDir, ".npmrc");
142
+ try {
143
+ const content = await readFileImpl(userconfigPath);
144
+ const npmrcPrefix = parseNpmrcPrefix(content, homeDir);
145
+ if (npmrcPrefix) {
146
+ return { prefix: npmrcPrefix, source: "npmrc" };
147
+ }
148
+ } catch {
149
+ }
150
+ return { prefix: heuristicPrefixFromExecPath(execPath, platform), source: "heuristic" };
151
+ }
152
+ async function describeUnwritablePrefix(prefix) {
153
+ try {
154
+ const info = await stat(prefix);
155
+ const currentUid = typeof process.getuid === "function" ? process.getuid() : void 0;
156
+ if (process.platform !== "win32" && currentUid !== void 0 && info.uid === 0 && currentUid !== 0) {
157
+ return `root-owned prefix (${prefix}); the classic fresh-install PATH/EACCES blocker`;
158
+ }
159
+ } catch {
160
+ }
161
+ return `npm prefix is not writable: ${prefix}`;
162
+ }
163
+ async function checkNpmPrefixWritable(options = {}) {
164
+ let detected;
165
+ try {
166
+ detected = await detectNpmPrefix(options);
167
+ } catch {
168
+ return { prefix: null, writable: false, reason: "npm prefix could not be determined" };
169
+ }
170
+ try {
171
+ await access(detected.prefix, constants.W_OK);
172
+ return { prefix: detected.prefix, writable: true, source: detected.source };
173
+ } catch {
174
+ return {
175
+ prefix: detected.prefix,
176
+ writable: false,
177
+ source: detected.source,
178
+ reason: await describeUnwritablePrefix(detected.prefix)
179
+ };
180
+ }
181
+ }
182
+ async function assessEnvironment(options = {}) {
183
+ const env = options.env ?? process.env;
184
+ const platform = options.platform ?? process.platform;
185
+ const nodeVersion = options.nodeVersion ?? process.version;
186
+ const homeDir = options.homeDir ?? homedir();
187
+ const binName = options.binName ?? "agent-kit";
188
+ const [binPath, npmPrefix] = await Promise.all([
189
+ resolveBinOnPath(binName, env, platform).catch(() => null),
190
+ checkNpmPrefixWritable(options).catch(
191
+ () => ({
192
+ prefix: null,
193
+ writable: false,
194
+ reason: "npm prefix check failed unexpectedly"
195
+ })
196
+ )
197
+ ]);
198
+ const binVersion = binPath ? await readBinVersion(binPath, options).catch(() => null) : null;
199
+ return {
200
+ binOnPath: binPath != null,
201
+ binPath,
202
+ binVersion,
203
+ npmPrefixWritable: npmPrefix.writable,
204
+ npmPrefix,
205
+ nodeVersionOk: isNodeVersionOk(nodeVersion),
206
+ nodeVersion,
207
+ shell: detectShellName(env, platform),
208
+ shellProfile: detectShellProfile(env, platform, homeDir)
209
+ };
210
+ }
211
+
212
+ export {
213
+ assessEnvironment
214
+ };
@@ -0,0 +1,6 @@
1
+ // src/utils/kit-paths.ts
2
+ var HANDOFF_REL = ".cursor/HANDOFF.md";
3
+
4
+ export {
5
+ HANDOFF_REL
6
+ };
@@ -0,0 +1,39 @@
1
+ // src/utils/fs.ts
2
+ import { randomUUID } from "crypto";
3
+ import { constants } from "fs";
4
+ import { access, mkdir, readFile, readdir, rename, writeFile } from "fs/promises";
5
+ import path from "path";
6
+ async function fileExists(target) {
7
+ try {
8
+ await access(target, constants.F_OK);
9
+ return true;
10
+ } catch {
11
+ return false;
12
+ }
13
+ }
14
+ async function readJson(target) {
15
+ if (!await fileExists(target)) return null;
16
+ const raw = await readFile(target, "utf8");
17
+ return JSON.parse(raw);
18
+ }
19
+ async function writeJson(target, data) {
20
+ await ensureDir(path.dirname(target));
21
+ const tmp = `${target}.${randomUUID()}.tmp`;
22
+ await writeFile(tmp, `${JSON.stringify(data, null, 2)}
23
+ `, "utf8");
24
+ await rename(tmp, target);
25
+ }
26
+ async function ensureDir(target) {
27
+ await mkdir(target, { recursive: true });
28
+ }
29
+ async function listDirectory(rootDir) {
30
+ return readdir(rootDir);
31
+ }
32
+
33
+ export {
34
+ fileExists,
35
+ readJson,
36
+ writeJson,
37
+ ensureDir,
38
+ listDirectory
39
+ };
@@ -0,0 +1,26 @@
1
+ // src/lifecycle/version.ts
2
+ import { createRequire } from "module";
3
+ var require2 = createRequire(import.meta.url);
4
+ function loadPackageVersion() {
5
+ for (const packagePath of ["../package.json", "../../package.json"]) {
6
+ try {
7
+ const metadata = require2(packagePath);
8
+ if (typeof metadata.version === "string" && metadata.version.length > 0) {
9
+ return metadata.version;
10
+ }
11
+ } catch {
12
+ }
13
+ }
14
+ throw new Error("Unable to resolve the Agent Kit CLI package version");
15
+ }
16
+ var KIT_VERSION = loadPackageVersion();
17
+ var KIT_PACKAGE_SPEC = "@dadado/agent-kit-cli";
18
+ function pinnedCliSpec(version = KIT_VERSION) {
19
+ return `${KIT_PACKAGE_SPEC}@${version}`;
20
+ }
21
+
22
+ export {
23
+ KIT_VERSION,
24
+ KIT_PACKAGE_SPEC,
25
+ pinnedCliSpec
26
+ };