@dadado/agent-kit-cli 6.23.0 → 6.26.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 +1 -0
- package/dashboard/dashboard-data.mjs +126 -5
- package/dashboard/dashboard.html +48 -7
- package/dashboard/lib/guards.mjs +1 -0
- package/dashboard/lib/live-refresh.mjs +1 -0
- package/dist/{add-RKZQX6ZK.js → add-G7KEZLWP.js} +17 -8
- package/dist/{chunk-7HDQEK6T.js → chunk-2G4K4ZI5.js} +7 -3
- package/dist/{chunk-5PSV76CQ.js → chunk-2GXN7HVG.js} +26 -7
- package/dist/chunk-2QYWMSI5.js +193 -0
- package/dist/{chunk-B3VR5YBQ.js → chunk-2TW7ENWC.js} +12 -11
- package/dist/{chunk-IESSMKOV.js → chunk-5A72LTR3.js} +7 -7
- package/dist/{chunk-R4DUO5DA.js → chunk-AXQMVQ6O.js} +61 -237
- package/dist/{chunk-6WUKLS4D.js → chunk-BIFTTL2O.js} +1 -1
- package/dist/{chunk-AWQ6KRFV.js → chunk-BVZDPVUL.js} +1 -1
- package/dist/{chunk-QNISTPPZ.js → chunk-ENRXS5O6.js} +19 -12
- package/dist/chunk-FB6G6OD6.js +519 -0
- package/dist/{chunk-MFKHIWEL.js → chunk-FOVHFMSH.js} +1 -1
- package/dist/{chunk-6BEFGKCU.js → chunk-FUSNEYGU.js} +29 -3
- package/dist/chunk-H7KAXI5R.js +357 -0
- package/dist/chunk-HGB4DHXV.js +138 -0
- package/dist/{chunk-W3ZJVBNY.js → chunk-HXV6VQD4.js} +2374 -983
- package/dist/{chunk-BGL5DRK2.js → chunk-I3FGWNU5.js} +4 -4
- package/dist/chunk-IHVJTGYR.js +144 -0
- package/dist/{chunk-5LNHRL5E.js → chunk-IUY24WPE.js} +93 -263
- package/dist/chunk-JG5MKMOM.js +248 -0
- package/dist/{chunk-SGTTC2JP.js → chunk-JWIJHO67.js} +17 -2
- package/dist/chunk-KMK4T4ZM.js +34 -0
- package/dist/{chunk-ZMYV6PRE.js → chunk-LEVNLHH3.js} +2 -1
- package/dist/{chunk-2IP4OO6R.js → chunk-MGVV6YC4.js} +1 -1
- package/dist/{chunk-7TYA3GMI.js → chunk-MWRYQLEG.js} +7 -4
- package/dist/chunk-NHJ4IAVN.js +435 -0
- package/dist/{chunk-C4Q77GGJ.js → chunk-O7VMHCNN.js} +6 -0
- package/dist/{chunk-5EBT3V7G.js → chunk-OVRGTHZD.js} +1 -1
- package/dist/{chunk-F7YAAKYP.js → chunk-PCIYXGB3.js} +7 -5
- package/dist/{chunk-UJCATSYO.js → chunk-PLLXFSN2.js} +46 -17
- package/dist/{chunk-OYFCBYMP.js → chunk-RJP47EGS.js} +18 -1
- package/dist/{chunk-KDJ4ML7I.js → chunk-RRJVC35Y.js} +4 -4
- package/dist/{chunk-DRZFWIBN.js → chunk-SWJJW624.js} +1 -1
- package/dist/{chunk-MJJBIOSY.js → chunk-SYRJ5TTK.js} +34 -12
- package/dist/{chunk-L5V3W3DY.js → chunk-TTUFIE26.js} +60 -14
- package/dist/{chunk-JFS4GKP7.js → chunk-XXPI4H4D.js} +2 -2
- package/dist/{chunk-CVZNSRXV.js → chunk-Y5526WCN.js} +84 -19
- package/dist/{chunk-CQHD6UKB.js → chunk-Y575INEC.js} +2 -1
- package/dist/{chunk-V2H57TFD.js → chunk-ZNZHDPS3.js} +80 -170
- package/dist/{commands-SAQEEE6V.js → commands-K4HSDML5.js} +8 -6
- package/dist/{conflicts-5JOP4GX2.js → conflicts-4SUWIPWP.js} +9 -10
- package/dist/{contribute-BQKRT5GN.js → contribute-HE4WCBRY.js} +7 -5
- package/dist/{countdown-25E5C7AR.js → countdown-TYQHVAIX.js} +305 -32
- package/dist/{dashboard-P65XHYCU.js → dashboard-6V6PCNYF.js} +1 -1
- package/dist/{dashboard-broadcast-GYK34QYL.js → dashboard-broadcast-PMVQ7PXU.js} +1 -1
- package/dist/{diff-6JSXBVSX.js → diff-3XUZM7ZT.js} +15 -6
- package/dist/{doctor-I3MTHS7F.js → doctor-KGUWU5SN.js} +106 -19
- package/dist/{engine-info-BBI5QO5Y.js → engine-info-VM4VPGQM.js} +2 -2
- package/dist/{ground-control-IDCXN5FK.js → ground-control-ZIDHEOPW.js} +7 -4
- package/dist/{guard-RJZEEKSL.js → guard-ZO4Z3LLB.js} +47 -9
- package/dist/{handoff-5AGE2D3T.js → handoff-LLT4CI6H.js} +4 -3
- package/dist/{hook-WNA42CXE.js → hook-UPZ3CPYS.js} +22 -20
- package/dist/index.js +51 -33
- package/dist/{init-FZ2UFPO7.js → init-ZHLVXEVT.js} +25 -18
- package/dist/install-XWOG64W3.js +42 -0
- package/dist/installs-2ROXPO6M.js +223 -0
- package/dist/{mission-control-CRMCRZUU.js → mission-control-IGOI3WHS.js} +2 -2
- package/dist/models-5BDXREWM.js +45 -0
- package/dist/paths-JTPV6SXH.js +107 -0
- package/dist/pi-DCMDOY65.js +248 -0
- package/dist/{plan-index-BNLUU6T5.js → plan-index-5QZJK4AG.js} +2 -3
- package/dist/{queue-JW4VR33H.js → queue-Z5VNNHM6.js} +10 -12
- package/dist/{run-X2WOONTB.js → run-QURAXAR2.js} +27 -33
- package/dist/{run-plan-4MOLLIES.js → run-plan-4MMHVCTS.js} +35 -23
- package/dist/{scan-K3T5RQLC.js → scan-7D3RMO34.js} +2 -1
- package/dist/{session-start-MV7A4263.js → session-start-NC2HE5X5.js} +20 -14
- package/dist/{sessions-UPFDWDMB.js → sessions-WWWLYPW6.js} +4 -4
- package/dist/{setup-global-VNADNTQ2.js → setup-global-WDMARD4Z.js} +12 -10
- package/dist/{status-SXA3OK5E.js → status-2WNJL7PP.js} +17 -13
- package/dist/update-YSVOYYK5.js +32 -0
- package/dist/update-all-5XLTCHPX.js +697 -0
- package/package.json +14 -4
- package/pi/agent-kit.ts +224 -0
- package/dist/chunk-4MR4QXMF.js +0 -52
- package/dist/chunk-7ABY6DYH.js +0 -89
- package/dist/chunk-C4LCOOL4.js +0 -71
- package/dist/chunk-DZCLMIAS.js +0 -391
- package/dist/chunk-HAFRAXGV.js +0 -17
- package/dist/chunk-MUTTNRX4.js +0 -53
- package/dist/install-CTLT3TSI.js +0 -38
- package/dist/update-RMAWXMCV.js +0 -304
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CI_PLATFORM_FILES
|
|
3
3
|
} from "./chunk-F6C3GFKV.js";
|
|
4
|
+
import {
|
|
5
|
+
REPOSITORY_PROFILE_REL,
|
|
6
|
+
detectGit,
|
|
7
|
+
listTrackedFiles
|
|
8
|
+
} from "./chunk-2QYWMSI5.js";
|
|
4
9
|
import {
|
|
5
10
|
fileExists,
|
|
6
11
|
listDirectory,
|
|
@@ -8,195 +13,14 @@ import {
|
|
|
8
13
|
} from "./chunk-5B4DVO6C.js";
|
|
9
14
|
|
|
10
15
|
// src/scanner/scan.ts
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
// src/scanner/detect-git.ts
|
|
14
|
-
import { execFile } from "child_process";
|
|
15
|
-
import path from "path";
|
|
16
|
-
import { promisify } from "util";
|
|
17
|
-
|
|
18
|
-
// src/scanner/paths.ts
|
|
19
|
-
var REPOSITORY_PROFILE_REL = ".cursor/agent-kit.config.json";
|
|
20
|
-
|
|
21
|
-
// src/scanner/detect-git.ts
|
|
22
|
-
var exec = promisify(execFile);
|
|
23
|
-
function remoteHostname(remoteUrl) {
|
|
24
|
-
const scpMatch = remoteUrl.match(/^[^@]+@([^:]+):/);
|
|
25
|
-
if (scpMatch?.[1]) return scpMatch[1].toLowerCase();
|
|
26
|
-
try {
|
|
27
|
-
return new URL(remoteUrl).hostname.toLowerCase();
|
|
28
|
-
} catch {
|
|
29
|
-
return void 0;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function sanitizeRemoteUrl(remoteUrl) {
|
|
33
|
-
try {
|
|
34
|
-
const parsed = new URL(remoteUrl);
|
|
35
|
-
parsed.username = "";
|
|
36
|
-
parsed.password = "";
|
|
37
|
-
return parsed.toString();
|
|
38
|
-
} catch {
|
|
39
|
-
return remoteUrl;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
async function detectProvider(rootDir, remoteUrl) {
|
|
43
|
-
const configuration = await readJson(
|
|
44
|
-
path.join(rootDir, REPOSITORY_PROFILE_REL)
|
|
45
|
-
);
|
|
46
|
-
const configuredProvider = configuration?.git?.provider;
|
|
47
|
-
if (configuredProvider) {
|
|
48
|
-
const configuredKind = configuration.git?.providerKind ?? (configuredProvider === "github" ? "github" : configuredProvider === "gitlab" ? remoteUrl && remoteHostname(remoteUrl) === "gitlab.com" ? "gitlab-saas" : "gitlab-self-hosted" : configuredProvider === "other" ? "custom" : "known-other");
|
|
49
|
-
return {
|
|
50
|
-
provider: configuredProvider,
|
|
51
|
-
providerKind: configuredKind,
|
|
52
|
-
confidence: "high",
|
|
53
|
-
evidence: [{ source: "configuration", value: `${REPOSITORY_PROFILE_REL}#git.provider` }]
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
if (!remoteUrl) {
|
|
57
|
-
return { providerKind: "unknown", confidence: "low", evidence: [] };
|
|
58
|
-
}
|
|
59
|
-
const hostname = remoteHostname(remoteUrl);
|
|
60
|
-
const remoteEvidence = [{ source: "git", value: `remote:${remoteUrl}` }];
|
|
61
|
-
if (hostname === "github.com") {
|
|
62
|
-
return {
|
|
63
|
-
provider: "github",
|
|
64
|
-
providerKind: "github",
|
|
65
|
-
confidence: "high",
|
|
66
|
-
evidence: remoteEvidence
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
if (hostname === "gitlab.com") {
|
|
70
|
-
return {
|
|
71
|
-
provider: "gitlab",
|
|
72
|
-
providerKind: "gitlab-saas",
|
|
73
|
-
confidence: "high",
|
|
74
|
-
evidence: remoteEvidence
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
if (hostname === "bitbucket.org") {
|
|
78
|
-
return {
|
|
79
|
-
provider: "bitbucket",
|
|
80
|
-
providerKind: "known-other",
|
|
81
|
-
confidence: "high",
|
|
82
|
-
evidence: remoteEvidence
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
if (hostname === "dev.azure.com" || hostname?.endsWith(".visualstudio.com")) {
|
|
86
|
-
return {
|
|
87
|
-
provider: "azure-devops",
|
|
88
|
-
providerKind: "known-other",
|
|
89
|
-
confidence: "high",
|
|
90
|
-
evidence: remoteEvidence
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
if (hostname === "codeberg.org") {
|
|
94
|
-
return {
|
|
95
|
-
provider: "gitea",
|
|
96
|
-
providerKind: "known-other",
|
|
97
|
-
confidence: "high",
|
|
98
|
-
evidence: remoteEvidence
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
if (await fileExists(path.join(rootDir, ".gitlab-ci.yml"))) {
|
|
102
|
-
return {
|
|
103
|
-
provider: "gitlab",
|
|
104
|
-
providerKind: "gitlab-self-hosted",
|
|
105
|
-
confidence: "medium",
|
|
106
|
-
evidence: [...remoteEvidence, { source: "file", value: ".gitlab-ci.yml" }]
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
provider: "other",
|
|
111
|
-
providerKind: hostname ? "custom" : "unknown",
|
|
112
|
-
confidence: "low",
|
|
113
|
-
evidence: remoteEvidence
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function inferWorkflow(currentBranch, hasLocalStaging, hasRemoteStaging) {
|
|
117
|
-
if (hasLocalStaging || hasRemoteStaging) return "homolog-prod";
|
|
118
|
-
if (!currentBranch) return "unknown";
|
|
119
|
-
if (currentBranch === "main" || currentBranch === "master") return "feature-pr";
|
|
120
|
-
if (currentBranch.includes("develop") || currentBranch.includes("release")) return "gitflow";
|
|
121
|
-
if (currentBranch.includes("staging") || currentBranch.includes("homolog")) return "homolog-prod";
|
|
122
|
-
return "feature-pr";
|
|
123
|
-
}
|
|
124
|
-
var GIT_MAX_BUFFER = 64 * 1024 * 1024;
|
|
125
|
-
async function runGit(args, rootDir) {
|
|
126
|
-
try {
|
|
127
|
-
const { stdout } = await exec("git", args, { cwd: rootDir, maxBuffer: GIT_MAX_BUFFER });
|
|
128
|
-
return stdout.trim();
|
|
129
|
-
} catch {
|
|
130
|
-
return void 0;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
async function listTrackedFiles(rootDir) {
|
|
134
|
-
return (await runGit(["ls-files"], rootDir))?.split("\n").filter(Boolean);
|
|
135
|
-
}
|
|
136
|
-
async function detectGitDirty(rootDir) {
|
|
137
|
-
return Boolean(await runGit(["status", "--porcelain"], rootDir));
|
|
138
|
-
}
|
|
139
|
-
async function detectGit(rootDir) {
|
|
140
|
-
const isGit = await runGit(["rev-parse", "--is-inside-work-tree"], rootDir) === "true";
|
|
141
|
-
if (!isGit) {
|
|
142
|
-
return {
|
|
143
|
-
providerKind: "unknown",
|
|
144
|
-
providerConfidence: "low",
|
|
145
|
-
providerEvidence: [],
|
|
146
|
-
remotes: [],
|
|
147
|
-
mode: "none",
|
|
148
|
-
workflow: "unknown",
|
|
149
|
-
isDirty: false,
|
|
150
|
-
hasLocalStaging: false,
|
|
151
|
-
hasRemoteStaging: false
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
const remoteNames = (await runGit(["remote"], rootDir))?.split("\n").filter(Boolean) ?? [];
|
|
155
|
-
const remotes = (await Promise.all(
|
|
156
|
-
remoteNames.map(async (name) => {
|
|
157
|
-
const url = await runGit(["remote", "get-url", name], rootDir);
|
|
158
|
-
return url ? { name, url: sanitizeRemoteUrl(url) } : void 0;
|
|
159
|
-
})
|
|
160
|
-
)).filter((remote) => remote !== void 0);
|
|
161
|
-
const primary = remotes.find((remote) => remote.name === "origin") ?? remotes[0];
|
|
162
|
-
const remoteUrl = primary?.url;
|
|
163
|
-
const [currentBranch, remoteHead, localBranchOutput, remoteBranchOutput, status, provider] = await Promise.all([
|
|
164
|
-
runGit(["branch", "--show-current"], rootDir),
|
|
165
|
-
primary ? runGit(["symbolic-ref", "--short", `refs/remotes/${primary.name}/HEAD`], rootDir) : Promise.resolve(void 0),
|
|
166
|
-
runGit(["for-each-ref", "--format=%(refname:short)", "refs/heads"], rootDir),
|
|
167
|
-
runGit(["for-each-ref", "--format=%(refname:short)", "refs/remotes"], rootDir),
|
|
168
|
-
runGit(["status", "--porcelain"], rootDir),
|
|
169
|
-
detectProvider(rootDir, remoteUrl)
|
|
170
|
-
]);
|
|
171
|
-
const localBranches = localBranchOutput?.split("\n").filter(Boolean);
|
|
172
|
-
const remoteBranches = remoteBranchOutput?.split("\n").filter(Boolean);
|
|
173
|
-
const defaultBranch = remoteHead?.split("/").slice(1).join("/") || (localBranches?.includes("main") ? "main" : localBranches?.includes("master") ? "master" : void 0);
|
|
174
|
-
const hasLocalStaging = localBranches?.includes("staging") ?? false;
|
|
175
|
-
const hasRemoteStaging = remoteBranches?.some((branch) => remoteNames.some((r) => branch === `${r}/staging`)) ?? false;
|
|
176
|
-
return {
|
|
177
|
-
provider: provider.provider,
|
|
178
|
-
providerKind: provider.providerKind,
|
|
179
|
-
providerConfidence: provider.confidence,
|
|
180
|
-
providerEvidence: provider.evidence,
|
|
181
|
-
remoteUrl,
|
|
182
|
-
remoteName: primary?.name,
|
|
183
|
-
remotes,
|
|
184
|
-
mode: remotes.length > 0 ? "remote-hosted" : "local-only",
|
|
185
|
-
currentBranch,
|
|
186
|
-
defaultBranch,
|
|
187
|
-
isDirty: Boolean(status),
|
|
188
|
-
hasLocalStaging,
|
|
189
|
-
hasRemoteStaging,
|
|
190
|
-
workflow: inferWorkflow(currentBranch, hasLocalStaging, hasRemoteStaging)
|
|
191
|
-
};
|
|
192
|
-
}
|
|
16
|
+
import path6 from "path";
|
|
193
17
|
|
|
194
18
|
// src/scanner/detect-ide.ts
|
|
195
|
-
import
|
|
19
|
+
import path from "path";
|
|
196
20
|
async function detectIde(rootDir) {
|
|
197
|
-
const hasCursor = await fileExists(
|
|
198
|
-
const hasVSCode = await fileExists(
|
|
199
|
-
const hasWindsurf = await fileExists(
|
|
21
|
+
const hasCursor = await fileExists(path.join(rootDir, ".cursor"));
|
|
22
|
+
const hasVSCode = await fileExists(path.join(rootDir, ".vscode"));
|
|
23
|
+
const hasWindsurf = await fileExists(path.join(rootDir, ".windsurfrules"));
|
|
200
24
|
if (hasCursor) return { ide: "cursor", plan: "cursor-pro" };
|
|
201
25
|
if (hasVSCode) return { ide: "vscode", plan: "vscode-pro" };
|
|
202
26
|
if (hasWindsurf) return { ide: "windsurf", plan: "windsurf" };
|
|
@@ -205,7 +29,7 @@ async function detectIde(rootDir) {
|
|
|
205
29
|
|
|
206
30
|
// src/scanner/detect-infra.ts
|
|
207
31
|
import { readdir, readFile } from "fs/promises";
|
|
208
|
-
import
|
|
32
|
+
import path2 from "path";
|
|
209
33
|
function extractRunCommands(yaml) {
|
|
210
34
|
const lines = yaml.split(/\r?\n/);
|
|
211
35
|
const commands = [];
|
|
@@ -231,7 +55,7 @@ function extractRunCommands(yaml) {
|
|
|
231
55
|
return Array.from(new Set(commands));
|
|
232
56
|
}
|
|
233
57
|
async function detectCiRunCommands(rootDir) {
|
|
234
|
-
const workflowsDir =
|
|
58
|
+
const workflowsDir = path2.join(rootDir, ".github", "workflows");
|
|
235
59
|
if (!await fileExists(workflowsDir)) return [];
|
|
236
60
|
let entries;
|
|
237
61
|
try {
|
|
@@ -243,7 +67,7 @@ async function detectCiRunCommands(rootDir) {
|
|
|
243
67
|
const perFile = await Promise.all(
|
|
244
68
|
workflowFiles.map(async (name) => {
|
|
245
69
|
try {
|
|
246
|
-
return extractRunCommands(await readFile(
|
|
70
|
+
return extractRunCommands(await readFile(path2.join(workflowsDir, name), "utf8"));
|
|
247
71
|
} catch {
|
|
248
72
|
return [];
|
|
249
73
|
}
|
|
@@ -252,12 +76,12 @@ async function detectCiRunCommands(rootDir) {
|
|
|
252
76
|
return Array.from(new Set(perFile.flat()));
|
|
253
77
|
}
|
|
254
78
|
async function detectInfra(rootDir) {
|
|
255
|
-
const docker = await fileExists(
|
|
256
|
-
const kubernetes = await fileExists(
|
|
79
|
+
const docker = await fileExists(path2.join(rootDir, "Dockerfile")) || await fileExists(path2.join(rootDir, "docker-compose.yml")) || await fileExists(path2.join(rootDir, "docker-compose.yaml"));
|
|
80
|
+
const kubernetes = await fileExists(path2.join(rootDir, "k8s")) || await fileExists(path2.join(rootDir, "kubernetes"));
|
|
257
81
|
let ci = "none";
|
|
258
82
|
const ciFiles = [];
|
|
259
83
|
for (const [platform, filePath] of Object.entries(CI_PLATFORM_FILES)) {
|
|
260
|
-
if (await fileExists(
|
|
84
|
+
if (await fileExists(path2.join(rootDir, filePath))) {
|
|
261
85
|
if (ci === "none") ci = platform;
|
|
262
86
|
ciFiles.push(filePath);
|
|
263
87
|
}
|
|
@@ -282,12 +106,12 @@ async function detectInfra(rootDir) {
|
|
|
282
106
|
];
|
|
283
107
|
const infrastructureFiles = (await Promise.all(
|
|
284
108
|
infrastructureCandidates.map(
|
|
285
|
-
async (file) => await fileExists(
|
|
109
|
+
async (file) => await fileExists(path2.join(rootDir, file)) ? file : void 0
|
|
286
110
|
)
|
|
287
111
|
)).filter((file) => file !== void 0);
|
|
288
112
|
const deploymentFiles = (await Promise.all(
|
|
289
113
|
deploymentCandidates.map(
|
|
290
|
-
async (file) => await fileExists(
|
|
114
|
+
async (file) => await fileExists(path2.join(rootDir, file)) ? file : void 0
|
|
291
115
|
)
|
|
292
116
|
)).filter((file) => file !== void 0);
|
|
293
117
|
const ciRunCommands = ci === "github-actions" ? await detectCiRunCommands(rootDir) : [];
|
|
@@ -296,7 +120,7 @@ async function detectInfra(rootDir) {
|
|
|
296
120
|
|
|
297
121
|
// src/scanner/detect-repository.ts
|
|
298
122
|
import { readFile as readFile2 } from "fs/promises";
|
|
299
|
-
import
|
|
123
|
+
import path3 from "path";
|
|
300
124
|
var CONTEXT_PATHS = [
|
|
301
125
|
["README.md", "README"],
|
|
302
126
|
["README", "README"],
|
|
@@ -315,7 +139,7 @@ var CONTEXT_PATHS = [
|
|
|
315
139
|
async function existingEvidence(rootDir, candidates) {
|
|
316
140
|
const evidence = await Promise.all(
|
|
317
141
|
candidates.map(
|
|
318
|
-
async ([relativePath, label]) => await fileExists(
|
|
142
|
+
async ([relativePath, label]) => await fileExists(path3.join(rootDir, relativePath)) ? { source: "file", value: `${relativePath}:${label}` } : void 0
|
|
319
143
|
)
|
|
320
144
|
);
|
|
321
145
|
return evidence.flatMap((item) => item ? [item] : []);
|
|
@@ -349,7 +173,7 @@ function isRepositoryPurpose(value) {
|
|
|
349
173
|
}
|
|
350
174
|
async function readConfirmedPurpose(rootDir) {
|
|
351
175
|
const configuration = await readJson(
|
|
352
|
-
|
|
176
|
+
path3.join(rootDir, REPOSITORY_PROFILE_REL)
|
|
353
177
|
);
|
|
354
178
|
const configuredPurpose = configuration?.purpose;
|
|
355
179
|
if (!configuredPurpose || !isRepositoryPurpose(configuredPurpose.value) || configuredPurpose.value === "unknown") {
|
|
@@ -369,7 +193,7 @@ async function detectPurpose(rootDir, stack) {
|
|
|
369
193
|
if (confirmed) return confirmed;
|
|
370
194
|
const entries = await listDirectory(rootDir);
|
|
371
195
|
const lowerEntries = entries.map((entry) => entry.toLowerCase());
|
|
372
|
-
const packageJson = await readJson(
|
|
196
|
+
const packageJson = await readJson(path3.join(rootDir, "package.json"));
|
|
373
197
|
const categories = [];
|
|
374
198
|
const evidence = [];
|
|
375
199
|
const add = (category, value2) => {
|
|
@@ -409,16 +233,16 @@ async function detectPurpose(rootDir, stack) {
|
|
|
409
233
|
}
|
|
410
234
|
async function detectAgentKit(rootDir) {
|
|
411
235
|
const manifestRelativePath = ".cursor/agent-kit.json";
|
|
412
|
-
const manifestPath =
|
|
236
|
+
const manifestPath = path3.join(rootDir, manifestRelativePath);
|
|
413
237
|
const installed = await fileExists(manifestPath);
|
|
414
238
|
const manifest = installed ? await readJson(manifestPath) : null;
|
|
415
239
|
return {
|
|
416
240
|
installed,
|
|
417
241
|
manifestPath: installed ? manifestRelativePath : void 0,
|
|
418
242
|
version: manifest?.version,
|
|
419
|
-
hasPlans: await fileExists(
|
|
420
|
-
hasHandoff: await fileExists(
|
|
421
|
-
hasMemory: await fileExists(
|
|
243
|
+
hasPlans: await fileExists(path3.join(rootDir, ".cursor/plans")),
|
|
244
|
+
hasHandoff: await fileExists(path3.join(rootDir, ".cursor/HANDOFF.md")),
|
|
245
|
+
hasMemory: await fileExists(path3.join(rootDir, ".cursor/memory"))
|
|
422
246
|
};
|
|
423
247
|
}
|
|
424
248
|
var REQUIRED_SECRET_PATTERNS = [
|
|
@@ -435,12 +259,14 @@ var KIT_OWNED_IGNORE_PATTERNS = [
|
|
|
435
259
|
".cursor/HANDOFF.md",
|
|
436
260
|
".cursor/dogfood/",
|
|
437
261
|
".cursor/context/readiness.json",
|
|
262
|
+
".cursor/context/install-health.json",
|
|
438
263
|
".cursor/context/flight-log.json",
|
|
439
264
|
".cursor/context/mission-timing.json",
|
|
440
265
|
".cursor/context/outcome-ledger.json",
|
|
441
266
|
".cursor/context/test-results.json",
|
|
442
267
|
".cursor/context/gate-exit.json",
|
|
443
268
|
".cursor/context/review-ledger.json",
|
|
269
|
+
".cursor/context/cost-ledger.ndjson",
|
|
444
270
|
".cursor/context/plan-index.json",
|
|
445
271
|
".cursor/context/run-plan-all.lock",
|
|
446
272
|
".cursor/loop-logs/"
|
|
@@ -457,7 +283,7 @@ function isTrackedSecretFile(file) {
|
|
|
457
283
|
return SECRET_FILE_MATCHERS.some((matcher) => matcher.test(base));
|
|
458
284
|
}
|
|
459
285
|
async function detectSafety(rootDir, trackedFiles) {
|
|
460
|
-
const gitignorePath =
|
|
286
|
+
const gitignorePath = path3.join(rootDir, ".gitignore");
|
|
461
287
|
const hasGitignore = await fileExists(gitignorePath);
|
|
462
288
|
const gitignore = hasGitignore ? await readFile2(gitignorePath, "utf8") : "";
|
|
463
289
|
const lines = gitignore.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
@@ -466,7 +292,7 @@ async function detectSafety(rootDir, trackedFiles) {
|
|
|
466
292
|
);
|
|
467
293
|
const trackedSensitiveFiles = (trackedFiles ?? []).filter(isTrackedSecretFile);
|
|
468
294
|
const hookPaths = [".husky", ".git/hooks/pre-commit", "git-hooks/pre-commit"];
|
|
469
|
-
const hasHooks = (await Promise.all(hookPaths.map((item) => fileExists(
|
|
295
|
+
const hasHooks = (await Promise.all(hookPaths.map((item) => fileExists(path3.join(rootDir, item))))).some(Boolean);
|
|
470
296
|
const guardCandidates = [
|
|
471
297
|
".husky/pre-commit",
|
|
472
298
|
".husky/pre-push",
|
|
@@ -475,7 +301,7 @@ async function detectSafety(rootDir, trackedFiles) {
|
|
|
475
301
|
];
|
|
476
302
|
const guardContents = await Promise.all(
|
|
477
303
|
guardCandidates.map(
|
|
478
|
-
async (item) => await fileExists(
|
|
304
|
+
async (item) => await fileExists(path3.join(rootDir, item)) ? readFile2(path3.join(rootDir, item), "utf8") : ""
|
|
479
305
|
)
|
|
480
306
|
);
|
|
481
307
|
return {
|
|
@@ -495,12 +321,12 @@ async function detectSafety(rootDir, trackedFiles) {
|
|
|
495
321
|
|
|
496
322
|
// src/scanner/detect-services.ts
|
|
497
323
|
import { readFile as readFile3 } from "fs/promises";
|
|
498
|
-
import
|
|
324
|
+
import path4 from "path";
|
|
499
325
|
async function detectProjectManagement(rootDir) {
|
|
500
326
|
const tools = [];
|
|
501
327
|
const mcpConfigPaths = [
|
|
502
|
-
|
|
503
|
-
|
|
328
|
+
path4.join(rootDir, ".cursor", "mcp.json"),
|
|
329
|
+
path4.join(rootDir, "mcp.json")
|
|
504
330
|
];
|
|
505
331
|
for (const configPath of mcpConfigPaths) {
|
|
506
332
|
if (!await fileExists(configPath)) continue;
|
|
@@ -516,20 +342,20 @@ async function detectProjectManagement(rootDir) {
|
|
|
516
342
|
} catch {
|
|
517
343
|
}
|
|
518
344
|
}
|
|
519
|
-
if (await fileExists(
|
|
345
|
+
if (await fileExists(path4.join(rootDir, ".github", "ISSUE_TEMPLATE"))) {
|
|
520
346
|
tools.push("github-issues");
|
|
521
347
|
}
|
|
522
|
-
if (await fileExists(
|
|
348
|
+
if (await fileExists(path4.join(rootDir, ".github", "projects"))) {
|
|
523
349
|
tools.push("github-projects");
|
|
524
350
|
}
|
|
525
351
|
return [...new Set(tools)];
|
|
526
352
|
}
|
|
527
353
|
async function detectServices(rootDir) {
|
|
528
|
-
const hasPrisma = await fileExists(
|
|
529
|
-
const hasSequelize = await fileExists(
|
|
530
|
-
const hasDrizzle = await fileExists(
|
|
531
|
-
const hasKnex = await fileExists(
|
|
532
|
-
const hasTypeorm = await fileExists(
|
|
354
|
+
const hasPrisma = await fileExists(path4.join(rootDir, "prisma/schema.prisma"));
|
|
355
|
+
const hasSequelize = await fileExists(path4.join(rootDir, "sequelize"));
|
|
356
|
+
const hasDrizzle = await fileExists(path4.join(rootDir, "drizzle.config.ts"));
|
|
357
|
+
const hasKnex = await fileExists(path4.join(rootDir, "knexfile.ts"));
|
|
358
|
+
const hasTypeorm = await fileExists(path4.join(rootDir, "ormconfig.json"));
|
|
533
359
|
const database = hasPrisma || hasSequelize || hasDrizzle || hasKnex || hasTypeorm ? "postgresql" : void 0;
|
|
534
360
|
const orm = hasPrisma ? "prisma" : hasDrizzle ? "drizzle" : hasSequelize ? "sequelize" : hasKnex ? "knex" : hasTypeorm ? "typeorm" : void 0;
|
|
535
361
|
const projectManagement = await detectProjectManagement(rootDir);
|
|
@@ -542,7 +368,7 @@ async function detectServices(rootDir) {
|
|
|
542
368
|
|
|
543
369
|
// src/scanner/detect-stack.ts
|
|
544
370
|
import { readdir as readdir2, readFile as readFile4 } from "fs/promises";
|
|
545
|
-
import
|
|
371
|
+
import path5 from "path";
|
|
546
372
|
var PROJECT_MARKERS = [
|
|
547
373
|
"package.json",
|
|
548
374
|
"requirements.txt",
|
|
@@ -568,7 +394,7 @@ async function scanSubdirectoryMarkers(rootDir) {
|
|
|
568
394
|
const candidates = dirs.flatMap((dir) => PROJECT_MARKERS.map((marker) => ({ dir, marker })));
|
|
569
395
|
const found = await Promise.all(
|
|
570
396
|
candidates.map(async (candidate) => {
|
|
571
|
-
const exists = await fileExists(
|
|
397
|
+
const exists = await fileExists(path5.join(rootDir, candidate.dir, candidate.marker));
|
|
572
398
|
return exists ? candidate : null;
|
|
573
399
|
})
|
|
574
400
|
);
|
|
@@ -584,7 +410,7 @@ var DART_VALIDATION_COMMANDS = [
|
|
|
584
410
|
async function detectDartFlavor(pubspecDir) {
|
|
585
411
|
let content = "";
|
|
586
412
|
try {
|
|
587
|
-
content = await readFile4(
|
|
413
|
+
content = await readFile4(path5.join(pubspecDir, "pubspec.yaml"), "utf8");
|
|
588
414
|
} catch {
|
|
589
415
|
}
|
|
590
416
|
return { isFlutter: isFlutterPubspec(content) };
|
|
@@ -597,7 +423,7 @@ async function detectStackFromSubdirHits(rootDir, hits) {
|
|
|
597
423
|
const dartHits = hits.filter((hit) => hit.marker === "pubspec.yaml");
|
|
598
424
|
if (dartHits.length > 0) {
|
|
599
425
|
const flavors = await Promise.all(
|
|
600
|
-
dartHits.map((hit) => detectDartFlavor(
|
|
426
|
+
dartHits.map((hit) => detectDartFlavor(path5.join(rootDir, hit.dir)))
|
|
601
427
|
);
|
|
602
428
|
const testCommands = Array.from(
|
|
603
429
|
new Set(flavors.map((flavor) => flavor.isFlutter ? "flutter test" : "dart test"))
|
|
@@ -614,8 +440,8 @@ async function detectStackFromSubdirHits(rootDir, hits) {
|
|
|
614
440
|
}
|
|
615
441
|
const nodeHit = hits.find((hit) => hit.marker === "package.json");
|
|
616
442
|
if (nodeHit) {
|
|
617
|
-
const subRoot =
|
|
618
|
-
const packageJson = await readJson(
|
|
443
|
+
const subRoot = path5.join(rootDir, nodeHit.dir);
|
|
444
|
+
const packageJson = await readJson(path5.join(subRoot, "package.json")) ?? {};
|
|
619
445
|
const scripts = packageJson.scripts ?? {};
|
|
620
446
|
const packageManager = await detectPackageManager(subRoot, packageJson);
|
|
621
447
|
const commands = commandsForScripts(scripts, packageManager.packageManager);
|
|
@@ -672,7 +498,7 @@ function isDetectionEvidenceArray(value) {
|
|
|
672
498
|
}
|
|
673
499
|
async function readConfirmedStack(rootDir) {
|
|
674
500
|
const configuration = await readJson(
|
|
675
|
-
|
|
501
|
+
path5.join(rootDir, REPOSITORY_PROFILE_REL)
|
|
676
502
|
);
|
|
677
503
|
const configured = configuration?.stack;
|
|
678
504
|
const language = configured?.language;
|
|
@@ -715,7 +541,7 @@ async function detectPackageManager(rootDir, packageJson) {
|
|
|
715
541
|
};
|
|
716
542
|
}
|
|
717
543
|
for (const [lockfile, packageManager] of LOCKFILES) {
|
|
718
|
-
if (await fileExists(
|
|
544
|
+
if (await fileExists(path5.join(rootDir, lockfile))) {
|
|
719
545
|
return {
|
|
720
546
|
packageManager,
|
|
721
547
|
evidence: [{ source: "file", value: lockfile }]
|
|
@@ -734,33 +560,33 @@ function commandsForScripts(scripts, packageManager) {
|
|
|
734
560
|
async function detectStack(rootDir) {
|
|
735
561
|
const confirmed = await readConfirmedStack(rootDir);
|
|
736
562
|
if (confirmed) return confirmed;
|
|
737
|
-
const hasAnyProjectMarker = (await Promise.all(PROJECT_MARKERS.map((item) => fileExists(
|
|
563
|
+
const hasAnyProjectMarker = (await Promise.all(PROJECT_MARKERS.map((item) => fileExists(path5.join(rootDir, item))))).some(Boolean);
|
|
738
564
|
if (!hasAnyProjectMarker) {
|
|
739
565
|
const subdirHits = await scanSubdirectoryMarkers(rootDir);
|
|
740
566
|
if (subdirHits.length > 0) {
|
|
741
567
|
return detectStackFromSubdirHits(rootDir, subdirHits);
|
|
742
568
|
}
|
|
743
569
|
}
|
|
744
|
-
const hasPackageJson = await fileExists(
|
|
570
|
+
const hasPackageJson = await fileExists(path5.join(rootDir, "package.json"));
|
|
745
571
|
if (hasPackageJson) {
|
|
746
|
-
const packageJson = await readJson(
|
|
572
|
+
const packageJson = await readJson(path5.join(rootDir, "package.json")) ?? {};
|
|
747
573
|
const scripts = packageJson.scripts ?? {};
|
|
748
574
|
const packageManager = await detectPackageManager(rootDir, packageJson);
|
|
749
575
|
const commands = commandsForScripts(scripts, packageManager.packageManager);
|
|
750
|
-
const hasNextConfig = await fileExists(
|
|
751
|
-
const hasNestConfig = await fileExists(
|
|
576
|
+
const hasNextConfig = await fileExists(path5.join(rootDir, "next.config.js")) || await fileExists(path5.join(rootDir, "next.config.mjs")) || await fileExists(path5.join(rootDir, "next.config.ts"));
|
|
577
|
+
const hasNestConfig = await fileExists(path5.join(rootDir, "nest-cli.json"));
|
|
752
578
|
return {
|
|
753
579
|
language: "node",
|
|
754
580
|
framework: hasNextConfig ? "nextjs" : hasNestConfig ? "nestjs" : "node",
|
|
755
581
|
packageManager: packageManager.packageManager,
|
|
756
582
|
packageManagerEvidence: packageManager.evidence,
|
|
757
583
|
scripts,
|
|
758
|
-
workspaces: packageJson.workspaces !== void 0 || await fileExists(
|
|
584
|
+
workspaces: packageJson.workspaces !== void 0 || await fileExists(path5.join(rootDir, "pnpm-workspace.yaml")),
|
|
759
585
|
...commands,
|
|
760
586
|
hasProjectFiles: hasAnyProjectMarker
|
|
761
587
|
};
|
|
762
588
|
}
|
|
763
|
-
if (await fileExists(
|
|
589
|
+
if (await fileExists(path5.join(rootDir, "pyproject.toml"))) {
|
|
764
590
|
return {
|
|
765
591
|
language: "python",
|
|
766
592
|
framework: "python",
|
|
@@ -770,7 +596,7 @@ async function detectStack(rootDir) {
|
|
|
770
596
|
hasProjectFiles: hasAnyProjectMarker
|
|
771
597
|
};
|
|
772
598
|
}
|
|
773
|
-
if (await fileExists(
|
|
599
|
+
if (await fileExists(path5.join(rootDir, "go.mod"))) {
|
|
774
600
|
return {
|
|
775
601
|
language: "go",
|
|
776
602
|
framework: "go",
|
|
@@ -780,7 +606,7 @@ async function detectStack(rootDir) {
|
|
|
780
606
|
hasProjectFiles: hasAnyProjectMarker
|
|
781
607
|
};
|
|
782
608
|
}
|
|
783
|
-
if (await fileExists(
|
|
609
|
+
if (await fileExists(path5.join(rootDir, "Cargo.toml"))) {
|
|
784
610
|
return {
|
|
785
611
|
language: "rust",
|
|
786
612
|
framework: "rust",
|
|
@@ -790,7 +616,7 @@ async function detectStack(rootDir) {
|
|
|
790
616
|
hasProjectFiles: hasAnyProjectMarker
|
|
791
617
|
};
|
|
792
618
|
}
|
|
793
|
-
if (await fileExists(
|
|
619
|
+
if (await fileExists(path5.join(rootDir, "composer.json"))) {
|
|
794
620
|
return {
|
|
795
621
|
language: "php",
|
|
796
622
|
framework: "php",
|
|
@@ -800,7 +626,7 @@ async function detectStack(rootDir) {
|
|
|
800
626
|
hasProjectFiles: hasAnyProjectMarker
|
|
801
627
|
};
|
|
802
628
|
}
|
|
803
|
-
if (await fileExists(
|
|
629
|
+
if (await fileExists(path5.join(rootDir, "pubspec.yaml"))) {
|
|
804
630
|
const { isFlutter } = await detectDartFlavor(rootDir);
|
|
805
631
|
return {
|
|
806
632
|
language: "dart",
|
|
@@ -834,7 +660,7 @@ function isGreenfieldByEntries(entries) {
|
|
|
834
660
|
return meaningful.length === 0;
|
|
835
661
|
}
|
|
836
662
|
async function runScanner(rootDir) {
|
|
837
|
-
const normalizedRoot =
|
|
663
|
+
const normalizedRoot = path6.resolve(rootDir);
|
|
838
664
|
const entries = await listDirectory(normalizedRoot);
|
|
839
665
|
const stack = await detectStack(normalizedRoot);
|
|
840
666
|
const purpose = await detectPurpose(normalizedRoot, stack);
|
|
@@ -873,8 +699,6 @@ async function runScanner(rootDir) {
|
|
|
873
699
|
|
|
874
700
|
export {
|
|
875
701
|
detectIde,
|
|
876
|
-
REPOSITORY_PROFILE_REL,
|
|
877
|
-
detectGitDirty,
|
|
878
702
|
REQUIRED_SECRET_PATTERNS,
|
|
879
703
|
KIT_OWNED_IGNORE_PATTERNS,
|
|
880
704
|
runScanner
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import { createInterface } from "readline";
|
|
7
7
|
import { StringDecoder } from "string_decoder";
|
|
8
8
|
var DRIVER_PROTOCOL_MAJOR = 1;
|
|
9
|
-
var DRIVER_PROTOCOL_VERSION = "1.
|
|
9
|
+
var DRIVER_PROTOCOL_VERSION = "1.6.0";
|
|
10
10
|
var DRIVER_EVENTS_FORMATS = ["ndjson"];
|
|
11
11
|
var INBOUND_MAX_CHARS = 64 * 1024;
|
|
12
12
|
var AGENT_PENDING_MAX_CHARS = 4 * 1024 * 1024;
|
|
@@ -5,37 +5,35 @@ import {
|
|
|
5
5
|
createDriverEmitter,
|
|
6
6
|
driverReplies,
|
|
7
7
|
driverStop
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
readRunQueueState
|
|
11
|
-
} from "./chunk-7ABY6DYH.js";
|
|
12
|
-
import {
|
|
13
|
-
detectAgentBackend
|
|
14
|
-
} from "./chunk-C4LCOOL4.js";
|
|
8
|
+
} from "./chunk-BIFTTL2O.js";
|
|
15
9
|
import {
|
|
16
10
|
classifyGateExit,
|
|
17
11
|
landGateExit
|
|
18
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-I3FGWNU5.js";
|
|
19
13
|
import {
|
|
20
14
|
QUEUE_LEASE_INTERRUPT_WAIT_MS,
|
|
21
15
|
QUEUE_LEASE_SESSION_ENV,
|
|
22
16
|
acquireQueueLease,
|
|
23
17
|
forwardTermination,
|
|
24
18
|
gateCheckIn
|
|
25
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-FOVHFMSH.js";
|
|
26
20
|
import {
|
|
27
21
|
buildDispatchPrompt,
|
|
28
22
|
ensureDispatchLogPath,
|
|
29
23
|
readCommandFile,
|
|
30
24
|
runHeadlessDispatch
|
|
31
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-JWIJHO67.js";
|
|
26
|
+
import {
|
|
27
|
+
detectAgentBackend,
|
|
28
|
+
readRunQueueState
|
|
29
|
+
} from "./chunk-HXV6VQD4.js";
|
|
32
30
|
import {
|
|
33
31
|
formatHitlSummary,
|
|
34
32
|
hitlExitCode
|
|
35
33
|
} from "./chunk-P7732A25.js";
|
|
36
34
|
import {
|
|
37
35
|
HANDOFF_REL
|
|
38
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-O7VMHCNN.js";
|
|
39
37
|
|
|
40
38
|
// src/plan-loop/dispatch-driver.ts
|
|
41
39
|
import { readFile } from "fs/promises";
|
|
@@ -279,7 +277,16 @@ async function runDispatchDriver(opts) {
|
|
|
279
277
|
write: writeErr,
|
|
280
278
|
checkIn: gateCheckIn(root, () => lease.session, opts.lease)
|
|
281
279
|
},
|
|
282
|
-
onSpawn: (info) => lease.setAgent(info.pid)
|
|
280
|
+
onSpawn: (info) => lease.setAgent(info.pid),
|
|
281
|
+
onProgress: (p) => emitter.emit({
|
|
282
|
+
type: "model_loading",
|
|
283
|
+
tick: DISPATCH_DRIVER_TICK,
|
|
284
|
+
backend: detected.id,
|
|
285
|
+
model: p.model,
|
|
286
|
+
phase: p.phase,
|
|
287
|
+
elapsedMs: p.elapsedMs,
|
|
288
|
+
...p.detail ? { detail: p.detail } : {}
|
|
289
|
+
})
|
|
283
290
|
});
|
|
284
291
|
} catch (err) {
|
|
285
292
|
say(String(err), "error");
|