nexus-agents 2.167.1 → 2.168.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/dist/{child-mcp-config-X4YLQKGK.js → child-mcp-config-FAWSJFMQ.js} +2 -2
- package/dist/{chunk-KM3YEIEN.js → chunk-2ANAH2UU.js} +4 -4
- package/dist/{chunk-7USEQLMS.js → chunk-2Z4QECP7.js} +2 -2
- package/dist/{chunk-7K5LSUEU.js → chunk-3KID7AIF.js} +3 -3
- package/dist/{chunk-2S7T66IQ.js → chunk-52T2MJDS.js} +34 -34
- package/dist/{chunk-PC4Y4VPX.js → chunk-5LPPJIZ4.js} +2 -2
- package/dist/{chunk-XUMLVCFL.js → chunk-6ERIC5NJ.js} +2 -2
- package/dist/{chunk-S6HCREYY.js → chunk-7IUVW67T.js} +7 -7
- package/dist/{chunk-ZIC6ZZFU.js → chunk-CJLMB7MO.js} +3 -3
- package/dist/{chunk-O6VL6LA4.js → chunk-CPS2HN4T.js} +2 -2
- package/dist/{chunk-TGAVZ2ZL.js → chunk-ELWMGKVP.js} +8 -8
- package/dist/{chunk-JKUX73VD.js → chunk-EQLJYWLP.js} +3 -3
- package/dist/{chunk-GGYQTV2Y.js → chunk-ETFCT2CH.js} +4 -4
- package/dist/{chunk-BB7KSLNA.js → chunk-F5JDQXHJ.js} +2 -2
- package/dist/{chunk-STMW5BSR.js → chunk-G7NDNFIE.js} +3 -3
- package/dist/{chunk-GRWHPG72.js → chunk-GNCUZDQI.js} +7 -7
- package/dist/{chunk-ZSUN7BHE.js → chunk-HJA3Z56H.js} +696 -14
- package/dist/chunk-HJA3Z56H.js.map +1 -0
- package/dist/{chunk-COIZLMGV.js → chunk-HZNOSJOO.js} +3 -3
- package/dist/{chunk-3T6KLPGT.js → chunk-I3LGUSZ3.js} +5 -5
- package/dist/{chunk-UNIDAVVR.js → chunk-IAGLVGHN.js} +2 -2
- package/dist/{chunk-7YD3TRDX.js → chunk-LNPKBBPG.js} +4 -4
- package/dist/{chunk-IFSIKGHI.js → chunk-MSBYVBPX.js} +2 -2
- package/dist/{chunk-QPSYBHK6.js → chunk-MX3XD2ML.js} +2 -2
- package/dist/{chunk-VNVGGM73.js → chunk-N56C2MWI.js} +2 -2
- package/dist/{chunk-CURHM4TH.js → chunk-OKAHIWG4.js} +3 -3
- package/dist/{chunk-6KCZA3IO.js → chunk-OLCDGMEO.js} +4 -4
- package/dist/{chunk-EUQNHT7O.js → chunk-P7RBQUAG.js} +12 -8
- package/dist/chunk-P7RBQUAG.js.map +1 -0
- package/dist/{chunk-QV52AXTF.js → chunk-RJHLNI37.js} +2 -2
- package/dist/{chunk-GVNY4ZB6.js → chunk-RQNBJ7AS.js} +2 -2
- package/dist/{chunk-ZAPCPHGZ.js → chunk-TORS5V2C.js} +2 -2
- package/dist/{chunk-RKIPSMCN.js → chunk-TZK7VQAW.js} +5 -5
- package/dist/{chunk-ZTTUXPBQ.js → chunk-UGJRDFMN.js} +2 -2
- package/dist/{chunk-SRNAXDOT.js → chunk-UN7PYUJB.js} +2 -2
- package/dist/{chunk-2NU774CB.js → chunk-VQE3OSUW.js} +2 -2
- package/dist/{cli-circuit-breaker-2AAHSCHR.js → cli-circuit-breaker-JDGZ25MD.js} +4 -4
- package/dist/cli.js +391 -892
- package/dist/cli.js.map +1 -1
- package/dist/{composite-router-WOVGICBS.js → composite-router-EZPPVCMD.js} +2 -2
- package/dist/{consensus-vote-322S65GQ.js → consensus-vote-YKKJHLOD.js} +15 -15
- package/dist/{context-retriever-YMJY6YBJ.js → context-retriever-EGMARBAC.js} +8 -8
- package/dist/{doctor-deep-DALT3OXC.js → doctor-deep-QTBDR3VV.js} +3 -3
- package/dist/{expert-bridge-WNV3ST2T.js → expert-bridge-FZYJ3XAL.js} +4 -4
- package/dist/{factory-TLSTFONW.js → factory-NDMPXPYE.js} +5 -5
- package/dist/{factory-33HQYVCK.js → factory-SABHBAHC.js} +8 -8
- package/dist/{improvement-review-2W6LKP74.js → improvement-review-WYFGNEVP.js} +5 -5
- package/dist/index.js +30 -30
- package/dist/{init-opencode-XVTVJ6FN.js → init-opencode-CMGJ3TXZ.js} +5 -5
- package/dist/{issue-triage-CVMVZ3IV.js → issue-triage-NHRZGMKC.js} +6 -6
- package/dist/{pr-reviewer-helpers-SAMOVLNJ.js → pr-reviewer-helpers-HJRFRUZX.js} +4 -4
- package/dist/{registry-command-5D2DJT53.js → registry-command-JCOZA7TM.js} +2 -2
- package/dist/{repo-security-plan-F7V5SHAQ.js → repo-security-plan-OMY33VHA.js} +3 -3
- package/dist/{research-helpers-synthesize-F4PV4B4B.js → research-helpers-synthesize-DFINP3KN.js} +4 -4
- package/dist/{routing-memory-G6YBK4WI.js → routing-memory-KK4GPB64.js} +2 -2
- package/dist/{session-memory-DAJHLPOY.js → session-memory-QTHGU2XM.js} +3 -3
- package/dist/{setup-command-NUNIRAFN.js → setup-command-CURZCHSQ.js} +13 -13
- package/dist/{setup-config-HKUWFV5N.js → setup-config-FX6SJXGQ.js} +3 -3
- package/dist/{setup-custom-api-XRUPWEPF.js → setup-custom-api-MYN4EVT2.js} +3 -3
- package/dist/{tool-memory-XJ5VRMNQ.js → tool-memory-3W5NXR4P.js} +5 -5
- package/dist/{unified-registry-ETKPTZBU.js → unified-registry-PKPNJ3G7.js} +9 -9
- package/dist/{weather-report-TWBLIHPZ.js → weather-report-46ZY3X2Z.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-EUQNHT7O.js.map +0 -1
- package/dist/chunk-ZSUN7BHE.js.map +0 -1
- /package/dist/{child-mcp-config-X4YLQKGK.js.map → child-mcp-config-FAWSJFMQ.js.map} +0 -0
- /package/dist/{chunk-KM3YEIEN.js.map → chunk-2ANAH2UU.js.map} +0 -0
- /package/dist/{chunk-7USEQLMS.js.map → chunk-2Z4QECP7.js.map} +0 -0
- /package/dist/{chunk-7K5LSUEU.js.map → chunk-3KID7AIF.js.map} +0 -0
- /package/dist/{chunk-2S7T66IQ.js.map → chunk-52T2MJDS.js.map} +0 -0
- /package/dist/{chunk-PC4Y4VPX.js.map → chunk-5LPPJIZ4.js.map} +0 -0
- /package/dist/{chunk-XUMLVCFL.js.map → chunk-6ERIC5NJ.js.map} +0 -0
- /package/dist/{chunk-S6HCREYY.js.map → chunk-7IUVW67T.js.map} +0 -0
- /package/dist/{chunk-ZIC6ZZFU.js.map → chunk-CJLMB7MO.js.map} +0 -0
- /package/dist/{chunk-O6VL6LA4.js.map → chunk-CPS2HN4T.js.map} +0 -0
- /package/dist/{chunk-TGAVZ2ZL.js.map → chunk-ELWMGKVP.js.map} +0 -0
- /package/dist/{chunk-JKUX73VD.js.map → chunk-EQLJYWLP.js.map} +0 -0
- /package/dist/{chunk-GGYQTV2Y.js.map → chunk-ETFCT2CH.js.map} +0 -0
- /package/dist/{chunk-BB7KSLNA.js.map → chunk-F5JDQXHJ.js.map} +0 -0
- /package/dist/{chunk-STMW5BSR.js.map → chunk-G7NDNFIE.js.map} +0 -0
- /package/dist/{chunk-GRWHPG72.js.map → chunk-GNCUZDQI.js.map} +0 -0
- /package/dist/{chunk-COIZLMGV.js.map → chunk-HZNOSJOO.js.map} +0 -0
- /package/dist/{chunk-3T6KLPGT.js.map → chunk-I3LGUSZ3.js.map} +0 -0
- /package/dist/{chunk-UNIDAVVR.js.map → chunk-IAGLVGHN.js.map} +0 -0
- /package/dist/{chunk-7YD3TRDX.js.map → chunk-LNPKBBPG.js.map} +0 -0
- /package/dist/{chunk-IFSIKGHI.js.map → chunk-MSBYVBPX.js.map} +0 -0
- /package/dist/{chunk-QPSYBHK6.js.map → chunk-MX3XD2ML.js.map} +0 -0
- /package/dist/{chunk-VNVGGM73.js.map → chunk-N56C2MWI.js.map} +0 -0
- /package/dist/{chunk-CURHM4TH.js.map → chunk-OKAHIWG4.js.map} +0 -0
- /package/dist/{chunk-6KCZA3IO.js.map → chunk-OLCDGMEO.js.map} +0 -0
- /package/dist/{chunk-QV52AXTF.js.map → chunk-RJHLNI37.js.map} +0 -0
- /package/dist/{chunk-GVNY4ZB6.js.map → chunk-RQNBJ7AS.js.map} +0 -0
- /package/dist/{chunk-ZAPCPHGZ.js.map → chunk-TORS5V2C.js.map} +0 -0
- /package/dist/{chunk-RKIPSMCN.js.map → chunk-TZK7VQAW.js.map} +0 -0
- /package/dist/{chunk-ZTTUXPBQ.js.map → chunk-UGJRDFMN.js.map} +0 -0
- /package/dist/{chunk-SRNAXDOT.js.map → chunk-UN7PYUJB.js.map} +0 -0
- /package/dist/{chunk-2NU774CB.js.map → chunk-VQE3OSUW.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-2AAHSCHR.js.map → cli-circuit-breaker-JDGZ25MD.js.map} +0 -0
- /package/dist/{composite-router-WOVGICBS.js.map → composite-router-EZPPVCMD.js.map} +0 -0
- /package/dist/{consensus-vote-322S65GQ.js.map → consensus-vote-YKKJHLOD.js.map} +0 -0
- /package/dist/{context-retriever-YMJY6YBJ.js.map → context-retriever-EGMARBAC.js.map} +0 -0
- /package/dist/{doctor-deep-DALT3OXC.js.map → doctor-deep-QTBDR3VV.js.map} +0 -0
- /package/dist/{expert-bridge-WNV3ST2T.js.map → expert-bridge-FZYJ3XAL.js.map} +0 -0
- /package/dist/{factory-33HQYVCK.js.map → factory-NDMPXPYE.js.map} +0 -0
- /package/dist/{factory-TLSTFONW.js.map → factory-SABHBAHC.js.map} +0 -0
- /package/dist/{improvement-review-2W6LKP74.js.map → improvement-review-WYFGNEVP.js.map} +0 -0
- /package/dist/{init-opencode-XVTVJ6FN.js.map → init-opencode-CMGJ3TXZ.js.map} +0 -0
- /package/dist/{issue-triage-CVMVZ3IV.js.map → issue-triage-NHRZGMKC.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-SAMOVLNJ.js.map → pr-reviewer-helpers-HJRFRUZX.js.map} +0 -0
- /package/dist/{registry-command-5D2DJT53.js.map → registry-command-JCOZA7TM.js.map} +0 -0
- /package/dist/{repo-security-plan-F7V5SHAQ.js.map → repo-security-plan-OMY33VHA.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-F4PV4B4B.js.map → research-helpers-synthesize-DFINP3KN.js.map} +0 -0
- /package/dist/{routing-memory-G6YBK4WI.js.map → routing-memory-KK4GPB64.js.map} +0 -0
- /package/dist/{session-memory-DAJHLPOY.js.map → session-memory-QTHGU2XM.js.map} +0 -0
- /package/dist/{setup-command-NUNIRAFN.js.map → setup-command-CURZCHSQ.js.map} +0 -0
- /package/dist/{setup-config-HKUWFV5N.js.map → setup-config-FX6SJXGQ.js.map} +0 -0
- /package/dist/{setup-custom-api-XRUPWEPF.js.map → setup-custom-api-MYN4EVT2.js.map} +0 -0
- /package/dist/{tool-memory-XJ5VRMNQ.js.map → tool-memory-3W5NXR4P.js.map} +0 -0
- /package/dist/{unified-registry-ETKPTZBU.js.map → unified-registry-PKPNJ3G7.js.map} +0 -0
- /package/dist/{weather-report-TWBLIHPZ.js.map → weather-report-46ZY3X2Z.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
generateSummary,
|
|
14
14
|
parseFindings,
|
|
15
15
|
sumFindings
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-EQLJYWLP.js";
|
|
17
|
+
import "./chunk-CPS2HN4T.js";
|
|
18
18
|
import {
|
|
19
19
|
setupCommandAsync,
|
|
20
20
|
verifyCommand
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-I3LGUSZ3.js";
|
|
22
|
+
import "./chunk-6ERIC5NJ.js";
|
|
23
23
|
import {
|
|
24
24
|
AuthHandler,
|
|
25
25
|
DEFAULT_EXPERTS,
|
|
@@ -138,8 +138,8 @@ import {
|
|
|
138
138
|
validateCommand,
|
|
139
139
|
validateWorkflow,
|
|
140
140
|
wrapInMarkdownFence
|
|
141
|
-
} from "./chunk-
|
|
142
|
-
import "./chunk-
|
|
141
|
+
} from "./chunk-52T2MJDS.js";
|
|
142
|
+
import "./chunk-N56C2MWI.js";
|
|
143
143
|
import "./chunk-HFOQKCD2.js";
|
|
144
144
|
import "./chunk-AO4X3BMP.js";
|
|
145
145
|
import {
|
|
@@ -165,15 +165,15 @@ import {
|
|
|
165
165
|
loadConfig,
|
|
166
166
|
runDoctor,
|
|
167
167
|
validateNexusEnv
|
|
168
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-P7RBQUAG.js";
|
|
169
169
|
import {
|
|
170
170
|
buildOpenAICompatAdapters,
|
|
171
171
|
readOpenAICompatEnv
|
|
172
|
-
} from "./chunk-
|
|
173
|
-
import "./chunk-
|
|
172
|
+
} from "./chunk-OLCDGMEO.js";
|
|
173
|
+
import "./chunk-HZNOSJOO.js";
|
|
174
174
|
import {
|
|
175
175
|
shutdownExpertBridge
|
|
176
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-GNCUZDQI.js";
|
|
177
177
|
import {
|
|
178
178
|
ConsensusVoteInputSchema,
|
|
179
179
|
DEFAULT_VOTE_TIMEOUT_MS,
|
|
@@ -183,25 +183,25 @@ import {
|
|
|
183
183
|
executeVoting,
|
|
184
184
|
mapOutcomeToDecision,
|
|
185
185
|
registerConsensusVoteTool
|
|
186
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-ELWMGKVP.js";
|
|
187
187
|
import {
|
|
188
188
|
loadUsageEvents,
|
|
189
189
|
rollupByModel
|
|
190
|
-
} from "./chunk-
|
|
190
|
+
} from "./chunk-TORS5V2C.js";
|
|
191
191
|
import {
|
|
192
192
|
synthesizeResearch
|
|
193
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-3KID7AIF.js";
|
|
194
194
|
import {
|
|
195
195
|
classifyTrust,
|
|
196
196
|
createFullGitHubProvider,
|
|
197
197
|
evaluatePolicy,
|
|
198
198
|
parsePRUrl
|
|
199
|
-
} from "./chunk-
|
|
200
|
-
import "./chunk-
|
|
199
|
+
} from "./chunk-TZK7VQAW.js";
|
|
200
|
+
import "./chunk-F5JDQXHJ.js";
|
|
201
201
|
import {
|
|
202
202
|
ReputationCache,
|
|
203
203
|
sanitizeInput
|
|
204
|
-
} from "./chunk-
|
|
204
|
+
} from "./chunk-UN7PYUJB.js";
|
|
205
205
|
import {
|
|
206
206
|
ImprovementReviewInputSchema,
|
|
207
207
|
calculateFitnessScore,
|
|
@@ -215,13 +215,15 @@ import {
|
|
|
215
215
|
registerImprovementReviewTool,
|
|
216
216
|
runImprovementReview,
|
|
217
217
|
scanForSecrets
|
|
218
|
-
} from "./chunk-
|
|
218
|
+
} from "./chunk-CJLMB7MO.js";
|
|
219
219
|
import {
|
|
220
220
|
createDefaultPolicyFirewall
|
|
221
|
-
} from "./chunk-
|
|
222
|
-
import "./chunk-
|
|
221
|
+
} from "./chunk-G7NDNFIE.js";
|
|
222
|
+
import "./chunk-RJHLNI37.js";
|
|
223
223
|
import {
|
|
224
|
+
CodebaseIndexSchema,
|
|
224
225
|
PaperStatusSchema,
|
|
226
|
+
buildIndex,
|
|
225
227
|
createResearchIssue,
|
|
226
228
|
discoverDeepMind,
|
|
227
229
|
discoverGitHubRepos,
|
|
@@ -231,6 +233,7 @@ import {
|
|
|
231
233
|
discoverOpenAlex,
|
|
232
234
|
discoverPapersWithCode,
|
|
233
235
|
discoverSemanticScholar,
|
|
236
|
+
extractProject,
|
|
234
237
|
findOverlaps,
|
|
235
238
|
formatOverlapResult,
|
|
236
239
|
formatResearchIssueBody,
|
|
@@ -242,32 +245,31 @@ import {
|
|
|
242
245
|
loadSourcesRegistry,
|
|
243
246
|
rankDiscoveredItems,
|
|
244
247
|
saveSourcesRegistry
|
|
245
|
-
} from "./chunk-
|
|
248
|
+
} from "./chunk-HJA3Z56H.js";
|
|
246
249
|
import {
|
|
247
250
|
resolveToken
|
|
248
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-IAGLVGHN.js";
|
|
249
252
|
import {
|
|
250
253
|
loadPapersRegistry,
|
|
251
254
|
loadTechniquesRegistry,
|
|
252
255
|
savePapersRegistry
|
|
253
|
-
} from "./chunk-
|
|
256
|
+
} from "./chunk-5LPPJIZ4.js";
|
|
254
257
|
import "./chunk-NUBSJGQZ.js";
|
|
255
258
|
import {
|
|
256
259
|
MemoryError,
|
|
257
260
|
shutdownToolMemory
|
|
258
|
-
} from "./chunk-
|
|
261
|
+
} from "./chunk-2ANAH2UU.js";
|
|
259
262
|
import {
|
|
260
263
|
capitalize,
|
|
261
|
-
capitalizeKebab
|
|
262
|
-
truncateSentence
|
|
264
|
+
capitalizeKebab
|
|
263
265
|
} from "./chunk-6T3EPABN.js";
|
|
264
|
-
import "./chunk-
|
|
266
|
+
import "./chunk-MX3XD2ML.js";
|
|
265
267
|
import "./chunk-ZM4O442V.js";
|
|
266
268
|
import "./chunk-PINS44XA.js";
|
|
267
269
|
import "./chunk-KSQSWEFH.js";
|
|
268
270
|
import {
|
|
269
271
|
createUnifiedRegistry
|
|
270
|
-
} from "./chunk-
|
|
272
|
+
} from "./chunk-ETFCT2CH.js";
|
|
271
273
|
import {
|
|
272
274
|
NEXUS_SUBPROCESS_DEPTH_ENV,
|
|
273
275
|
createAllAdapters,
|
|
@@ -275,15 +277,15 @@ import {
|
|
|
275
277
|
isRecord,
|
|
276
278
|
probeAllClis,
|
|
277
279
|
readSubprocessDepth
|
|
278
|
-
} from "./chunk-
|
|
279
|
-
import "./chunk-
|
|
280
|
+
} from "./chunk-7IUVW67T.js";
|
|
281
|
+
import "./chunk-MSBYVBPX.js";
|
|
280
282
|
import {
|
|
281
283
|
DEFAULTS
|
|
282
|
-
} from "./chunk-
|
|
283
|
-
import "./chunk-
|
|
284
|
-
import "./chunk-
|
|
284
|
+
} from "./chunk-VQE3OSUW.js";
|
|
285
|
+
import "./chunk-RQNBJ7AS.js";
|
|
286
|
+
import "./chunk-UGJRDFMN.js";
|
|
285
287
|
import "./chunk-QZUG667L.js";
|
|
286
|
-
import "./chunk-
|
|
288
|
+
import "./chunk-2Z4QECP7.js";
|
|
287
289
|
import {
|
|
288
290
|
API_TIMEOUTS,
|
|
289
291
|
AgentCapability,
|
|
@@ -357,7 +359,7 @@ import {
|
|
|
357
359
|
validateTimeout,
|
|
358
360
|
writeEmptyLine,
|
|
359
361
|
writeLine
|
|
360
|
-
} from "./chunk-
|
|
362
|
+
} from "./chunk-OKAHIWG4.js";
|
|
361
363
|
import "./chunk-AXTD4TFK.js";
|
|
362
364
|
import {
|
|
363
365
|
applyPortableMode,
|
|
@@ -645,8 +647,8 @@ function resolveOutputPath(output2) {
|
|
|
645
647
|
}
|
|
646
648
|
return resolve(process.cwd(), DEFAULT_CONFIG_REL_PATH);
|
|
647
649
|
}
|
|
648
|
-
function fileExists(
|
|
649
|
-
return existsSync(
|
|
650
|
+
function fileExists(path18) {
|
|
651
|
+
return existsSync(path18);
|
|
650
652
|
}
|
|
651
653
|
async function ensureDirectory(filePath) {
|
|
652
654
|
const dir = dirname(filePath);
|
|
@@ -654,9 +656,9 @@ async function ensureDirectory(filePath) {
|
|
|
654
656
|
await mkdir(dir, { recursive: true });
|
|
655
657
|
}
|
|
656
658
|
}
|
|
657
|
-
async function writeConfigFile(
|
|
658
|
-
await ensureDirectory(
|
|
659
|
-
await writeFile(
|
|
659
|
+
async function writeConfigFile(path18) {
|
|
660
|
+
await ensureDirectory(path18);
|
|
661
|
+
await writeFile(path18, renderConfigTemplate() + CONFIG_TEMPLATE_TAIL, "utf-8");
|
|
660
662
|
}
|
|
661
663
|
async function runConfigInit(options = {}) {
|
|
662
664
|
const outputPath = resolveOutputPath(options.output);
|
|
@@ -1636,14 +1638,14 @@ ${colors.dim}Session ended.${colors.reset}
|
|
|
1636
1638
|
});
|
|
1637
1639
|
});
|
|
1638
1640
|
rl.prompt();
|
|
1639
|
-
return new Promise((
|
|
1641
|
+
return new Promise((resolve13) => {
|
|
1640
1642
|
rl.on("line", (line) => {
|
|
1641
1643
|
void (async () => {
|
|
1642
1644
|
try {
|
|
1643
1645
|
const shouldExit = await processLine(line, session, logger19);
|
|
1644
1646
|
if (shouldExit) {
|
|
1645
1647
|
rl.close();
|
|
1646
|
-
|
|
1648
|
+
resolve13();
|
|
1647
1649
|
return;
|
|
1648
1650
|
}
|
|
1649
1651
|
} catch (error) {
|
|
@@ -1655,7 +1657,7 @@ ${colors.dim}Session ended.${colors.reset}
|
|
|
1655
1657
|
})();
|
|
1656
1658
|
});
|
|
1657
1659
|
rl.on("close", () => {
|
|
1658
|
-
|
|
1660
|
+
resolve13();
|
|
1659
1661
|
});
|
|
1660
1662
|
});
|
|
1661
1663
|
}
|
|
@@ -2701,9 +2703,9 @@ async function evaluateDirectory(target, timeoutMs, store = getOutcomeStore()) {
|
|
|
2701
2703
|
}
|
|
2702
2704
|
const aggregator = createAggregator();
|
|
2703
2705
|
const results = [];
|
|
2704
|
-
for (const [
|
|
2706
|
+
for (const [path18, evaluations] of evaluationsByComponent) {
|
|
2705
2707
|
if (evaluations.length > 0) {
|
|
2706
|
-
results.push(aggregator.aggregate(
|
|
2708
|
+
results.push(aggregator.aggregate(path18, evaluations));
|
|
2707
2709
|
}
|
|
2708
2710
|
}
|
|
2709
2711
|
const priority = { deprecate: 0, refactor: 1, review: 2, retain: 3 };
|
|
@@ -4035,7 +4037,7 @@ ${file.patch}
|
|
|
4035
4037
|
violations: policyResult.violations
|
|
4036
4038
|
});
|
|
4037
4039
|
}
|
|
4038
|
-
const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-
|
|
4040
|
+
const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-HJRFRUZX.js");
|
|
4039
4041
|
const body = formatReviewComment2(result);
|
|
4040
4042
|
const postResult = await provider.createReview(pr.prNumber, body, result.decision);
|
|
4041
4043
|
if (!postResult.ok) {
|
|
@@ -5081,27 +5083,27 @@ var CliAdapterAgent = class {
|
|
|
5081
5083
|
};
|
|
5082
5084
|
|
|
5083
5085
|
// src/cli/orchestrate-puppeteer.ts
|
|
5084
|
-
function loadPolicyParameters(
|
|
5086
|
+
function loadPolicyParameters(path18, logger19) {
|
|
5085
5087
|
try {
|
|
5086
|
-
if (fs2.existsSync(
|
|
5087
|
-
const content = fs2.readFileSync(
|
|
5088
|
+
if (fs2.existsSync(path18)) {
|
|
5089
|
+
const content = fs2.readFileSync(path18, "utf-8");
|
|
5088
5090
|
const params = JSON.parse(content);
|
|
5089
|
-
logger19.info("Loaded policy parameters", { path:
|
|
5091
|
+
logger19.info("Loaded policy parameters", { path: path18 });
|
|
5090
5092
|
return params;
|
|
5091
5093
|
}
|
|
5092
5094
|
} catch (error) {
|
|
5093
5095
|
const message = getErrorMessage(error);
|
|
5094
|
-
logger19.warn("Failed to load policy parameters", { path:
|
|
5096
|
+
logger19.warn("Failed to load policy parameters", { path: path18, error: message });
|
|
5095
5097
|
}
|
|
5096
5098
|
return void 0;
|
|
5097
5099
|
}
|
|
5098
|
-
function savePolicyParameters(
|
|
5100
|
+
function savePolicyParameters(path18, params, logger19) {
|
|
5099
5101
|
try {
|
|
5100
|
-
fs2.writeFileSync(
|
|
5101
|
-
logger19.info("Saved policy parameters", { path:
|
|
5102
|
+
fs2.writeFileSync(path18, JSON.stringify(params, null, 2));
|
|
5103
|
+
logger19.info("Saved policy parameters", { path: path18 });
|
|
5102
5104
|
} catch (error) {
|
|
5103
5105
|
const message = getErrorMessage(error);
|
|
5104
|
-
logger19.warn("Failed to save policy parameters", { path:
|
|
5106
|
+
logger19.warn("Failed to save policy parameters", { path: path18, error: message });
|
|
5105
5107
|
}
|
|
5106
5108
|
}
|
|
5107
5109
|
function createAgentsFromAdapters(adapters) {
|
|
@@ -9800,515 +9802,12 @@ async function researchCommand(subcommand, args, options) {
|
|
|
9800
9802
|
|
|
9801
9803
|
// src/cli/index-command.ts
|
|
9802
9804
|
import * as fs13 from "fs/promises";
|
|
9803
|
-
import * as
|
|
9805
|
+
import * as path14 from "path";
|
|
9804
9806
|
import * as yaml6 from "yaml";
|
|
9805
9807
|
|
|
9806
|
-
// src/indexer/types.ts
|
|
9807
|
-
import { z as z4 } from "zod";
|
|
9808
|
-
var SCHEMA_VERSION = "1.0";
|
|
9809
|
-
var ExportEntrySchema = z4.object({
|
|
9810
|
-
name: z4.string(),
|
|
9811
|
-
kind: z4.enum(["type", "interface", "class", "function", "const", "enum", "unknown"]),
|
|
9812
|
-
isReExport: z4.boolean(),
|
|
9813
|
-
sourceModule: z4.string().optional()
|
|
9814
|
-
});
|
|
9815
|
-
var DependencyEntrySchema = z4.object({
|
|
9816
|
-
specifier: z4.string(),
|
|
9817
|
-
isExternal: z4.boolean(),
|
|
9818
|
-
imports: z4.array(z4.string()).readonly()
|
|
9819
|
-
});
|
|
9820
|
-
var FileEntrySchema = z4.object({
|
|
9821
|
-
path: z4.string(),
|
|
9822
|
-
lines: z4.number().int().nonnegative(),
|
|
9823
|
-
category: z4.enum(["types", "implementation", "test", "config", "cli", "util", "index"]),
|
|
9824
|
-
exports: z4.array(ExportEntrySchema).readonly(),
|
|
9825
|
-
dependencies: z4.array(DependencyEntrySchema).readonly(),
|
|
9826
|
-
description: z4.string().optional()
|
|
9827
|
-
});
|
|
9828
|
-
var ModuleStatsSchema = z4.object({
|
|
9829
|
-
fileCount: z4.number().int().nonnegative(),
|
|
9830
|
-
totalLines: z4.number().int().nonnegative(),
|
|
9831
|
-
exportCount: z4.number().int().nonnegative(),
|
|
9832
|
-
internalDeps: z4.number().int().nonnegative(),
|
|
9833
|
-
externalDeps: z4.number().int().nonnegative()
|
|
9834
|
-
});
|
|
9835
|
-
var ModuleEntrySchema = z4.object({
|
|
9836
|
-
name: z4.string(),
|
|
9837
|
-
path: z4.string(),
|
|
9838
|
-
purpose: z4.string(),
|
|
9839
|
-
files: z4.array(FileEntrySchema).readonly(),
|
|
9840
|
-
stats: ModuleStatsSchema,
|
|
9841
|
-
dependsOn: z4.array(z4.string()).readonly()
|
|
9842
|
-
});
|
|
9843
|
-
var IndexStatsSchema = z4.object({
|
|
9844
|
-
totalFiles: z4.number().int().nonnegative(),
|
|
9845
|
-
totalLines: z4.number().int().nonnegative(),
|
|
9846
|
-
totalExports: z4.number().int().nonnegative(),
|
|
9847
|
-
moduleCount: z4.number().int().nonnegative(),
|
|
9848
|
-
externalPackages: z4.array(z4.string()).readonly()
|
|
9849
|
-
});
|
|
9850
|
-
var CodebaseIndexSchema = z4.object({
|
|
9851
|
-
schemaVersion: z4.literal(SCHEMA_VERSION),
|
|
9852
|
-
generatedAt: z4.string(),
|
|
9853
|
-
stats: IndexStatsSchema,
|
|
9854
|
-
modules: z4.record(z4.string(), ModuleEntrySchema)
|
|
9855
|
-
});
|
|
9856
|
-
var DEFAULT_EXTRACTOR_OPTIONS = {
|
|
9857
|
-
rootDir: "src",
|
|
9858
|
-
include: ["**/*.ts"],
|
|
9859
|
-
exclude: ["**/*.test.ts", "**/*.d.ts", "**/node_modules/**"],
|
|
9860
|
-
extractDescriptions: true
|
|
9861
|
-
};
|
|
9862
|
-
|
|
9863
|
-
// src/indexer/category-detection.ts
|
|
9864
|
-
import * as path8 from "path";
|
|
9865
|
-
var FILE_SUFFIX_PATTERNS = [
|
|
9866
|
-
[".test.ts", "test"],
|
|
9867
|
-
[".spec.ts", "test"],
|
|
9868
|
-
["-types.ts", "types"],
|
|
9869
|
-
[".types.ts", "types"],
|
|
9870
|
-
["-command.ts", "cli"]
|
|
9871
|
-
];
|
|
9872
|
-
var FILE_PATH_PATTERNS = [
|
|
9873
|
-
{ test: (f) => f === "index.ts", category: "index" },
|
|
9874
|
-
{ test: (_, d) => d.includes("/cli"), category: "cli" },
|
|
9875
|
-
{ test: (f, d) => d.includes("config") || f.includes("config"), category: "config" },
|
|
9876
|
-
{ test: (f) => f.includes("helper") || f.includes("util"), category: "util" }
|
|
9877
|
-
];
|
|
9878
|
-
function detectCategoryFromPath(fileName, dirName) {
|
|
9879
|
-
for (const [suffix, category] of FILE_SUFFIX_PATTERNS) {
|
|
9880
|
-
if (fileName.endsWith(suffix)) return category;
|
|
9881
|
-
}
|
|
9882
|
-
for (const { test, category } of FILE_PATH_PATTERNS) {
|
|
9883
|
-
if (test(fileName, dirName)) return category;
|
|
9884
|
-
}
|
|
9885
|
-
return void 0;
|
|
9886
|
-
}
|
|
9887
|
-
function isTypesOnlyFile(sourceFile) {
|
|
9888
|
-
const typeCount = sourceFile.getTypeAliases().length + sourceFile.getInterfaces().length;
|
|
9889
|
-
const implCount = sourceFile.getFunctions().length + sourceFile.getClasses().length + sourceFile.getVariableDeclarations().length;
|
|
9890
|
-
return typeCount > 0 && implCount === 0;
|
|
9891
|
-
}
|
|
9892
|
-
function detectFileCategory(filePath, sourceFile) {
|
|
9893
|
-
const pathCategory = detectCategoryFromPath(path8.basename(filePath), path8.dirname(filePath));
|
|
9894
|
-
if (pathCategory !== void 0) return pathCategory;
|
|
9895
|
-
if (isTypesOnlyFile(sourceFile)) return "types";
|
|
9896
|
-
return "implementation";
|
|
9897
|
-
}
|
|
9898
|
-
|
|
9899
|
-
// src/indexer/export-extraction.ts
|
|
9900
|
-
function addExport(state, name, kind, reExportInfo) {
|
|
9901
|
-
if (state.seenNames.has(name)) return;
|
|
9902
|
-
state.seenNames.add(name);
|
|
9903
|
-
const entry = { name, kind, isReExport: reExportInfo !== void 0 };
|
|
9904
|
-
if (reExportInfo !== void 0)
|
|
9905
|
-
entry.sourceModule = reExportInfo.sourceModule;
|
|
9906
|
-
state.exports.push(entry);
|
|
9907
|
-
}
|
|
9908
|
-
function extractFunctionClassExports(sourceFile, state) {
|
|
9909
|
-
for (const fn of sourceFile.getFunctions()) {
|
|
9910
|
-
if (fn.isExported()) {
|
|
9911
|
-
const name = fn.getName();
|
|
9912
|
-
if (name !== void 0) addExport(state, name, "function");
|
|
9913
|
-
}
|
|
9914
|
-
}
|
|
9915
|
-
for (const cls of sourceFile.getClasses()) {
|
|
9916
|
-
if (cls.isExported()) {
|
|
9917
|
-
const name = cls.getName();
|
|
9918
|
-
if (name !== void 0) addExport(state, name, "class");
|
|
9919
|
-
}
|
|
9920
|
-
}
|
|
9921
|
-
}
|
|
9922
|
-
function extractTypeExports(sourceFile, state) {
|
|
9923
|
-
for (const iface of sourceFile.getInterfaces()) {
|
|
9924
|
-
if (iface.isExported()) addExport(state, iface.getName(), "interface");
|
|
9925
|
-
}
|
|
9926
|
-
for (const typeAlias of sourceFile.getTypeAliases()) {
|
|
9927
|
-
if (typeAlias.isExported()) addExport(state, typeAlias.getName(), "type");
|
|
9928
|
-
}
|
|
9929
|
-
for (const enumDecl of sourceFile.getEnums()) {
|
|
9930
|
-
if (enumDecl.isExported()) addExport(state, enumDecl.getName(), "enum");
|
|
9931
|
-
}
|
|
9932
|
-
}
|
|
9933
|
-
function extractVariableExports(sourceFile, state) {
|
|
9934
|
-
for (const varStmt of sourceFile.getVariableStatements()) {
|
|
9935
|
-
if (varStmt.isExported()) {
|
|
9936
|
-
for (const decl of varStmt.getDeclarations()) addExport(state, decl.getName(), "const");
|
|
9937
|
-
}
|
|
9938
|
-
}
|
|
9939
|
-
}
|
|
9940
|
-
function extractReExports(sourceFile, state) {
|
|
9941
|
-
for (const exportDecl of sourceFile.getExportDeclarations()) {
|
|
9942
|
-
const moduleSpecifier = exportDecl.getModuleSpecifierValue();
|
|
9943
|
-
const namedExports = exportDecl.getNamedExports();
|
|
9944
|
-
const reExportInfo = moduleSpecifier !== void 0 ? { sourceModule: moduleSpecifier } : void 0;
|
|
9945
|
-
for (const namedExport of namedExports) {
|
|
9946
|
-
const name = namedExport.getAliasNode()?.getText() ?? namedExport.getName();
|
|
9947
|
-
addExport(state, name, "unknown", reExportInfo);
|
|
9948
|
-
}
|
|
9949
|
-
if (namedExports.length === 0 && reExportInfo !== void 0) {
|
|
9950
|
-
addExport(state, "*", "unknown", reExportInfo);
|
|
9951
|
-
}
|
|
9952
|
-
}
|
|
9953
|
-
}
|
|
9954
|
-
function extractExports(sourceFile) {
|
|
9955
|
-
const state = { exports: [], seenNames: /* @__PURE__ */ new Set() };
|
|
9956
|
-
extractFunctionClassExports(sourceFile, state);
|
|
9957
|
-
extractTypeExports(sourceFile, state);
|
|
9958
|
-
extractVariableExports(sourceFile, state);
|
|
9959
|
-
extractReExports(sourceFile, state);
|
|
9960
|
-
return state.exports;
|
|
9961
|
-
}
|
|
9962
|
-
|
|
9963
|
-
// src/indexer/dependency-extraction.ts
|
|
9964
|
-
function isExternalImport(specifier) {
|
|
9965
|
-
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
9966
|
-
return false;
|
|
9967
|
-
}
|
|
9968
|
-
if (specifier.startsWith("node:")) {
|
|
9969
|
-
return true;
|
|
9970
|
-
}
|
|
9971
|
-
return true;
|
|
9972
|
-
}
|
|
9973
|
-
function extractDependencies(sourceFile) {
|
|
9974
|
-
const deps = [];
|
|
9975
|
-
const seenSpecifiers = /* @__PURE__ */ new Set();
|
|
9976
|
-
for (const importDecl of sourceFile.getImportDeclarations()) {
|
|
9977
|
-
const specifier = importDecl.getModuleSpecifierValue();
|
|
9978
|
-
if (seenSpecifiers.has(specifier)) continue;
|
|
9979
|
-
seenSpecifiers.add(specifier);
|
|
9980
|
-
const imports = [];
|
|
9981
|
-
const namedImports = importDecl.getNamedImports();
|
|
9982
|
-
for (const namedImport of namedImports) {
|
|
9983
|
-
imports.push(namedImport.getName());
|
|
9984
|
-
}
|
|
9985
|
-
const defaultImport = importDecl.getDefaultImport();
|
|
9986
|
-
if (defaultImport !== void 0) {
|
|
9987
|
-
imports.push(defaultImport.getText());
|
|
9988
|
-
}
|
|
9989
|
-
const namespaceImport = importDecl.getNamespaceImport();
|
|
9990
|
-
if (namespaceImport !== void 0) {
|
|
9991
|
-
imports.push(`* as ${namespaceImport.getText()}`);
|
|
9992
|
-
}
|
|
9993
|
-
deps.push({
|
|
9994
|
-
specifier,
|
|
9995
|
-
isExternal: isExternalImport(specifier),
|
|
9996
|
-
imports
|
|
9997
|
-
});
|
|
9998
|
-
}
|
|
9999
|
-
return deps;
|
|
10000
|
-
}
|
|
10001
|
-
|
|
10002
|
-
// src/indexer/description-extraction.ts
|
|
10003
|
-
function isPlainBlockComment(trimmed) {
|
|
10004
|
-
return trimmed.startsWith("/*") && trimmed.endsWith("*/");
|
|
10005
|
-
}
|
|
10006
|
-
function classifyOutsideComment(trimmed) {
|
|
10007
|
-
if (isPlainBlockComment(trimmed)) return "skip";
|
|
10008
|
-
if (trimmed.length > 0 && !trimmed.startsWith("//")) return "stop";
|
|
10009
|
-
return "skip";
|
|
10010
|
-
}
|
|
10011
|
-
function classifyInsideComment(trimmed) {
|
|
10012
|
-
if (trimmed.endsWith("*/")) return "end";
|
|
10013
|
-
if (trimmed.startsWith("* @") || trimmed.startsWith("@")) return "skip";
|
|
10014
|
-
return "content";
|
|
10015
|
-
}
|
|
10016
|
-
function classifyJsDocLine(trimmed, inComment) {
|
|
10017
|
-
if (trimmed.startsWith("/**")) {
|
|
10018
|
-
return trimmed.endsWith("*/") ? "startEnd" : "start";
|
|
10019
|
-
}
|
|
10020
|
-
return inComment ? classifyInsideComment(trimmed) : classifyOutsideComment(trimmed);
|
|
10021
|
-
}
|
|
10022
|
-
function extractJsDocLineContent(trimmed) {
|
|
10023
|
-
return trimmed.startsWith("*") ? trimmed.slice(1).trim() : trimmed;
|
|
10024
|
-
}
|
|
10025
|
-
function extractInlineJsDocContent(trimmed) {
|
|
10026
|
-
return trimmed.slice(3, -2).trim();
|
|
10027
|
-
}
|
|
10028
|
-
function truncateDescription(full) {
|
|
10029
|
-
return truncateSentence(full, 150);
|
|
10030
|
-
}
|
|
10031
|
-
function extractDescription(sourceFile) {
|
|
10032
|
-
const lines = sourceFile.getFullText().split("\n");
|
|
10033
|
-
let inComment = false;
|
|
10034
|
-
const description = [];
|
|
10035
|
-
for (const line of lines) {
|
|
10036
|
-
const trimmed = line.trim();
|
|
10037
|
-
const result = classifyJsDocLine(trimmed, inComment);
|
|
10038
|
-
if (result === "start") {
|
|
10039
|
-
inComment = true;
|
|
10040
|
-
continue;
|
|
10041
|
-
}
|
|
10042
|
-
if (result === "startEnd") {
|
|
10043
|
-
const inline = extractInlineJsDocContent(trimmed);
|
|
10044
|
-
if (inline.length > 0) description.push(inline);
|
|
10045
|
-
break;
|
|
10046
|
-
}
|
|
10047
|
-
if (result === "end" || result === "stop") break;
|
|
10048
|
-
if (result === "skip") continue;
|
|
10049
|
-
const content = extractJsDocLineContent(trimmed);
|
|
10050
|
-
if (content.length > 0) description.push(content);
|
|
10051
|
-
}
|
|
10052
|
-
if (description.length === 0) return void 0;
|
|
10053
|
-
return truncateDescription(description.join(" "));
|
|
10054
|
-
}
|
|
10055
|
-
|
|
10056
|
-
// src/indexer/project-extraction.ts
|
|
10057
|
-
import { Project } from "ts-morph";
|
|
10058
|
-
import * as path9 from "path";
|
|
10059
|
-
function extractFileEntry(sourceFile, rootDir, extractDescriptions) {
|
|
10060
|
-
const absolutePath = sourceFile.getFilePath();
|
|
10061
|
-
const relativePath = path9.relative(rootDir, absolutePath);
|
|
10062
|
-
const lineCount = sourceFile.getEndLineNumber();
|
|
10063
|
-
const entry = {
|
|
10064
|
-
path: relativePath,
|
|
10065
|
-
lines: lineCount,
|
|
10066
|
-
category: detectFileCategory(relativePath, sourceFile),
|
|
10067
|
-
exports: extractExports(sourceFile),
|
|
10068
|
-
dependencies: extractDependencies(sourceFile)
|
|
10069
|
-
};
|
|
10070
|
-
if (extractDescriptions) {
|
|
10071
|
-
const desc = extractDescription(sourceFile);
|
|
10072
|
-
if (desc !== void 0) {
|
|
10073
|
-
entry.description = desc;
|
|
10074
|
-
}
|
|
10075
|
-
}
|
|
10076
|
-
return entry;
|
|
10077
|
-
}
|
|
10078
|
-
function processSourceFiles(project, rootDir, extractDescriptions) {
|
|
10079
|
-
const files = [];
|
|
10080
|
-
const errors = [];
|
|
10081
|
-
for (const sourceFile of project.getSourceFiles()) {
|
|
10082
|
-
const filePath = sourceFile.getFilePath();
|
|
10083
|
-
try {
|
|
10084
|
-
files.push(extractFileEntry(sourceFile, rootDir, extractDescriptions));
|
|
10085
|
-
} catch (err2) {
|
|
10086
|
-
const message = err2 instanceof Error ? err2.message : String(err2);
|
|
10087
|
-
errors.push(`Error extracting ${filePath}: ${message}`);
|
|
10088
|
-
}
|
|
10089
|
-
}
|
|
10090
|
-
return { files, errors };
|
|
10091
|
-
}
|
|
10092
|
-
function extractProject(options = {}) {
|
|
10093
|
-
const opts = { ...DEFAULT_EXTRACTOR_OPTIONS, ...options };
|
|
10094
|
-
const startTime = getTimeProvider().now();
|
|
10095
|
-
const project = new Project({
|
|
10096
|
-
skipAddingFilesFromTsConfig: true,
|
|
10097
|
-
skipFileDependencyResolution: true
|
|
10098
|
-
});
|
|
10099
|
-
const rootDir = path9.resolve(process.cwd(), opts.rootDir);
|
|
10100
|
-
const includePatterns = opts.include.map((p) => path9.join(rootDir, p));
|
|
10101
|
-
const excludePatterns = opts.exclude.map((p) => `!${path9.join(rootDir, p)}`);
|
|
10102
|
-
try {
|
|
10103
|
-
project.addSourceFilesAtPaths([...includePatterns, ...excludePatterns]);
|
|
10104
|
-
const { files, errors } = processSourceFiles(project, rootDir, opts.extractDescriptions);
|
|
10105
|
-
return { files, errors, durationMs: getTimeProvider().now() - startTime };
|
|
10106
|
-
} catch (err2) {
|
|
10107
|
-
const message = err2 instanceof Error ? err2.message : String(err2);
|
|
10108
|
-
return {
|
|
10109
|
-
files: [],
|
|
10110
|
-
errors: [`Error loading project: ${message}`],
|
|
10111
|
-
durationMs: getTimeProvider().now() - startTime
|
|
10112
|
-
};
|
|
10113
|
-
}
|
|
10114
|
-
}
|
|
10115
|
-
|
|
10116
|
-
// src/indexer/analyzer.ts
|
|
10117
|
-
import * as path10 from "path";
|
|
10118
|
-
var MODULE_PURPOSES = {
|
|
10119
|
-
core: "Types, Result<T,E>, errors, logger",
|
|
10120
|
-
config: "Configuration loading, validation, Zod schemas",
|
|
10121
|
-
adapters: "Model adapters (Claude, OpenAI, Gemini, Ollama)",
|
|
10122
|
-
agents: "Agent framework, Orchestrator, Experts, collaboration",
|
|
10123
|
-
workflows: "Workflow engine, templates, execution",
|
|
10124
|
-
mcp: "MCP server, tool definitions",
|
|
10125
|
-
cli: "CLI interface, mode detection, commands",
|
|
10126
|
-
"cli-adapters": "External CLI integrations (Claude, Gemini, Codex)",
|
|
10127
|
-
context: "Context management, token counting, memory",
|
|
10128
|
-
consensus: "Multi-agent consensus, voting strategies",
|
|
10129
|
-
learning: "Feedback collection, outcome tracking",
|
|
10130
|
-
indexer: "Codebase indexing and documentation",
|
|
10131
|
-
security: "Sandbox execution, secrets management"
|
|
10132
|
-
};
|
|
10133
|
-
function detectModulePurpose(moduleName, files) {
|
|
10134
|
-
const known = MODULE_PURPOSES[moduleName];
|
|
10135
|
-
if (known !== void 0) {
|
|
10136
|
-
return known;
|
|
10137
|
-
}
|
|
10138
|
-
const descriptions = files.filter((f) => f.description !== void 0).map((f) => f.description).slice(0, 3);
|
|
10139
|
-
if (descriptions.length > 0) {
|
|
10140
|
-
return descriptions.join("; ");
|
|
10141
|
-
}
|
|
10142
|
-
return `${moduleName} module`;
|
|
10143
|
-
}
|
|
10144
|
-
function extractPackageName(specifier) {
|
|
10145
|
-
if (specifier.startsWith("@")) {
|
|
10146
|
-
const parts2 = specifier.split("/");
|
|
10147
|
-
const scope = parts2[0];
|
|
10148
|
-
const name = parts2[1];
|
|
10149
|
-
if (scope !== void 0 && name !== void 0) {
|
|
10150
|
-
return `${scope}/${name}`;
|
|
10151
|
-
}
|
|
10152
|
-
return void 0;
|
|
10153
|
-
}
|
|
10154
|
-
if (specifier.startsWith("node:")) {
|
|
10155
|
-
return specifier;
|
|
10156
|
-
}
|
|
10157
|
-
const parts = specifier.split("/");
|
|
10158
|
-
return parts[0];
|
|
10159
|
-
}
|
|
10160
|
-
function groupFilesByModule(files) {
|
|
10161
|
-
const modules = /* @__PURE__ */ new Map();
|
|
10162
|
-
for (const file of files) {
|
|
10163
|
-
const parts = file.path.split("/");
|
|
10164
|
-
const moduleName = parts.length > 1 ? parts[0] ?? "root" : "root";
|
|
10165
|
-
const existing = modules.get(moduleName);
|
|
10166
|
-
if (existing !== void 0) {
|
|
10167
|
-
existing.push(file);
|
|
10168
|
-
} else {
|
|
10169
|
-
modules.set(moduleName, [file]);
|
|
10170
|
-
}
|
|
10171
|
-
}
|
|
10172
|
-
return modules;
|
|
10173
|
-
}
|
|
10174
|
-
function collectExternalPackages(file, packages) {
|
|
10175
|
-
for (const dep of file.dependencies) {
|
|
10176
|
-
if (dep.isExternal) {
|
|
10177
|
-
const pkgName = extractPackageName(dep.specifier);
|
|
10178
|
-
if (pkgName !== void 0) {
|
|
10179
|
-
packages.add(pkgName);
|
|
10180
|
-
}
|
|
10181
|
-
}
|
|
10182
|
-
}
|
|
10183
|
-
}
|
|
10184
|
-
function computeModuleStats(files) {
|
|
10185
|
-
let totalLines = 0;
|
|
10186
|
-
let exportCount = 0;
|
|
10187
|
-
let internalDeps = 0;
|
|
10188
|
-
let externalDeps = 0;
|
|
10189
|
-
for (const file of files) {
|
|
10190
|
-
totalLines += file.lines;
|
|
10191
|
-
exportCount += file.exports.length;
|
|
10192
|
-
for (const dep of file.dependencies) {
|
|
10193
|
-
if (dep.isExternal) {
|
|
10194
|
-
externalDeps++;
|
|
10195
|
-
} else {
|
|
10196
|
-
internalDeps++;
|
|
10197
|
-
}
|
|
10198
|
-
}
|
|
10199
|
-
}
|
|
10200
|
-
return {
|
|
10201
|
-
fileCount: files.length,
|
|
10202
|
-
totalLines,
|
|
10203
|
-
exportCount,
|
|
10204
|
-
internalDeps,
|
|
10205
|
-
externalDeps
|
|
10206
|
-
};
|
|
10207
|
-
}
|
|
10208
|
-
function resolveTargetModule(filePath, specifier) {
|
|
10209
|
-
if (!specifier.startsWith(".")) return void 0;
|
|
10210
|
-
const resolved = path10.join(path10.dirname(filePath), specifier);
|
|
10211
|
-
const parts = resolved.split("/");
|
|
10212
|
-
return parts[0];
|
|
10213
|
-
}
|
|
10214
|
-
function isValidModuleDep(targetModule, moduleName, allModules) {
|
|
10215
|
-
return targetModule !== void 0 && targetModule !== moduleName && allModules.has(targetModule);
|
|
10216
|
-
}
|
|
10217
|
-
function detectModuleDependencies(moduleName, files, allModules) {
|
|
10218
|
-
const deps = /* @__PURE__ */ new Set();
|
|
10219
|
-
for (const file of files) {
|
|
10220
|
-
for (const dep of file.dependencies) {
|
|
10221
|
-
if (dep.isExternal) continue;
|
|
10222
|
-
const targetModule = resolveTargetModule(file.path, dep.specifier);
|
|
10223
|
-
if (isValidModuleDep(targetModule, moduleName, allModules)) {
|
|
10224
|
-
deps.add(targetModule);
|
|
10225
|
-
}
|
|
10226
|
-
}
|
|
10227
|
-
}
|
|
10228
|
-
return Array.from(deps).sort();
|
|
10229
|
-
}
|
|
10230
|
-
function analyzeModules(files) {
|
|
10231
|
-
const filesByModule = groupFilesByModule(files);
|
|
10232
|
-
const moduleNames = new Set(filesByModule.keys());
|
|
10233
|
-
const modules = /* @__PURE__ */ new Map();
|
|
10234
|
-
for (const [moduleName, moduleFiles] of filesByModule) {
|
|
10235
|
-
modules.set(moduleName, {
|
|
10236
|
-
name: moduleName,
|
|
10237
|
-
path: moduleName === "root" ? "." : moduleName,
|
|
10238
|
-
purpose: detectModulePurpose(moduleName, moduleFiles),
|
|
10239
|
-
files: moduleFiles,
|
|
10240
|
-
stats: computeModuleStats(moduleFiles),
|
|
10241
|
-
dependsOn: detectModuleDependencies(moduleName, moduleFiles, moduleNames)
|
|
10242
|
-
});
|
|
10243
|
-
}
|
|
10244
|
-
return modules;
|
|
10245
|
-
}
|
|
10246
|
-
function computeIndexStats(modules) {
|
|
10247
|
-
let totalFiles = 0;
|
|
10248
|
-
let totalLines = 0;
|
|
10249
|
-
let totalExports = 0;
|
|
10250
|
-
const externalPackages = /* @__PURE__ */ new Set();
|
|
10251
|
-
for (const module of modules.values()) {
|
|
10252
|
-
totalFiles += module.stats.fileCount;
|
|
10253
|
-
totalLines += module.stats.totalLines;
|
|
10254
|
-
totalExports += module.stats.exportCount;
|
|
10255
|
-
for (const file of module.files) {
|
|
10256
|
-
collectExternalPackages(file, externalPackages);
|
|
10257
|
-
}
|
|
10258
|
-
}
|
|
10259
|
-
return {
|
|
10260
|
-
totalFiles,
|
|
10261
|
-
totalLines,
|
|
10262
|
-
totalExports,
|
|
10263
|
-
moduleCount: modules.size,
|
|
10264
|
-
externalPackages: Array.from(externalPackages).sort()
|
|
10265
|
-
};
|
|
10266
|
-
}
|
|
10267
|
-
function buildIndex(files) {
|
|
10268
|
-
const modules = analyzeModules(files);
|
|
10269
|
-
const stats = computeIndexStats(modules);
|
|
10270
|
-
const now = new Date(getTimeProvider().now());
|
|
10271
|
-
const etFormatter = new Intl.DateTimeFormat("en-US", {
|
|
10272
|
-
timeZone: "America/New_York",
|
|
10273
|
-
year: "numeric",
|
|
10274
|
-
month: "2-digit",
|
|
10275
|
-
day: "2-digit",
|
|
10276
|
-
hour: "2-digit",
|
|
10277
|
-
minute: "2-digit",
|
|
10278
|
-
second: "2-digit",
|
|
10279
|
-
hour12: false
|
|
10280
|
-
});
|
|
10281
|
-
const parts = etFormatter.formatToParts(now);
|
|
10282
|
-
const getPart = (type) => parts.find((p) => p.type === type)?.value ?? "00";
|
|
10283
|
-
const utcFormatter = new Intl.DateTimeFormat("en-US", {
|
|
10284
|
-
timeZone: "UTC",
|
|
10285
|
-
hour: "numeric",
|
|
10286
|
-
hour12: false
|
|
10287
|
-
});
|
|
10288
|
-
const utcHour = Number(
|
|
10289
|
-
utcFormatter.formatToParts(now).find((p) => p.type === "hour")?.value ?? "0"
|
|
10290
|
-
);
|
|
10291
|
-
const etHour = Number(getPart("hour"));
|
|
10292
|
-
const rawDiff = etHour - utcHour;
|
|
10293
|
-
const offsetHours = rawDiff > 12 ? rawDiff - 24 : rawDiff < -12 ? rawDiff + 24 : rawDiff;
|
|
10294
|
-
const offsetSign = offsetHours <= 0 ? "-" : "+";
|
|
10295
|
-
const absOffset = String(Math.abs(offsetHours)).padStart(2, "0");
|
|
10296
|
-
const timestamp = `${getPart("year")}-${getPart("month")}-${getPart("day")}T${getPart("hour")}:${getPart("minute")}:${getPart("second")}${offsetSign}${absOffset}:00`;
|
|
10297
|
-
const modulesRecord = {};
|
|
10298
|
-
for (const [name, entry] of modules) {
|
|
10299
|
-
modulesRecord[name] = entry;
|
|
10300
|
-
}
|
|
10301
|
-
return {
|
|
10302
|
-
schemaVersion: SCHEMA_VERSION,
|
|
10303
|
-
generatedAt: timestamp,
|
|
10304
|
-
stats,
|
|
10305
|
-
modules: modulesRecord
|
|
10306
|
-
};
|
|
10307
|
-
}
|
|
10308
|
-
|
|
10309
9808
|
// src/indexer/generator.ts
|
|
10310
9809
|
import * as fs10 from "fs/promises";
|
|
10311
|
-
import * as
|
|
9810
|
+
import * as path8 from "path";
|
|
10312
9811
|
import * as yaml4 from "yaml";
|
|
10313
9812
|
function indexToYaml(index) {
|
|
10314
9813
|
const doc = new yaml4.Document(index);
|
|
@@ -10438,43 +9937,43 @@ function validateIndex(index, currentFiles) {
|
|
|
10438
9937
|
}
|
|
10439
9938
|
|
|
10440
9939
|
// src/indexer/entrypoint-types.ts
|
|
10441
|
-
import { z as
|
|
9940
|
+
import { z as z4 } from "zod";
|
|
10442
9941
|
var ENTRYPOINT_SCHEMA_VERSION = "1.0";
|
|
10443
|
-
var OptionSpecSchema =
|
|
10444
|
-
name:
|
|
10445
|
-
type:
|
|
10446
|
-
description:
|
|
10447
|
-
required:
|
|
10448
|
-
default:
|
|
10449
|
-
short:
|
|
9942
|
+
var OptionSpecSchema = z4.object({
|
|
9943
|
+
name: z4.string(),
|
|
9944
|
+
type: z4.string(),
|
|
9945
|
+
description: z4.string().optional(),
|
|
9946
|
+
required: z4.boolean().optional(),
|
|
9947
|
+
default: z4.string().optional(),
|
|
9948
|
+
short: z4.string().optional()
|
|
10450
9949
|
});
|
|
10451
|
-
var ParameterSpecSchema =
|
|
10452
|
-
name:
|
|
10453
|
-
type:
|
|
10454
|
-
description:
|
|
10455
|
-
required:
|
|
10456
|
-
default:
|
|
9950
|
+
var ParameterSpecSchema = z4.object({
|
|
9951
|
+
name: z4.string(),
|
|
9952
|
+
type: z4.string(),
|
|
9953
|
+
description: z4.string().optional(),
|
|
9954
|
+
required: z4.boolean().optional(),
|
|
9955
|
+
default: z4.string().optional()
|
|
10457
9956
|
});
|
|
10458
|
-
var CliCommandSpecSchema =
|
|
10459
|
-
name:
|
|
10460
|
-
description:
|
|
10461
|
-
subcommands:
|
|
10462
|
-
options:
|
|
10463
|
-
source_file:
|
|
10464
|
-
source_line:
|
|
9957
|
+
var CliCommandSpecSchema = z4.object({
|
|
9958
|
+
name: z4.string(),
|
|
9959
|
+
description: z4.string(),
|
|
9960
|
+
subcommands: z4.array(z4.string()).readonly().optional(),
|
|
9961
|
+
options: z4.array(OptionSpecSchema).readonly().optional(),
|
|
9962
|
+
source_file: z4.string(),
|
|
9963
|
+
source_line: z4.number().int().positive()
|
|
10465
9964
|
});
|
|
10466
|
-
var McpToolSpecSchema =
|
|
10467
|
-
name:
|
|
10468
|
-
description:
|
|
10469
|
-
parameters:
|
|
10470
|
-
source_file:
|
|
10471
|
-
source_line:
|
|
9965
|
+
var McpToolSpecSchema = z4.object({
|
|
9966
|
+
name: z4.string(),
|
|
9967
|
+
description: z4.string(),
|
|
9968
|
+
parameters: z4.array(ParameterSpecSchema).readonly(),
|
|
9969
|
+
source_file: z4.string(),
|
|
9970
|
+
source_line: z4.number().int().positive()
|
|
10472
9971
|
});
|
|
10473
|
-
var EntrypointManifestSchema =
|
|
10474
|
-
schema_version:
|
|
10475
|
-
generated_at:
|
|
10476
|
-
cli_commands:
|
|
10477
|
-
mcp_tools:
|
|
9972
|
+
var EntrypointManifestSchema = z4.object({
|
|
9973
|
+
schema_version: z4.literal(ENTRYPOINT_SCHEMA_VERSION),
|
|
9974
|
+
generated_at: z4.string(),
|
|
9975
|
+
cli_commands: z4.array(CliCommandSpecSchema).readonly(),
|
|
9976
|
+
mcp_tools: z4.array(McpToolSpecSchema).readonly()
|
|
10478
9977
|
});
|
|
10479
9978
|
var DEFAULT_ENTRYPOINT_EXTRACTOR_OPTIONS = {
|
|
10480
9979
|
packageRoot: "packages/nexus-agents",
|
|
@@ -10484,8 +9983,8 @@ var DEFAULT_ENTRYPOINT_EXTRACTOR_OPTIONS = {
|
|
|
10484
9983
|
};
|
|
10485
9984
|
|
|
10486
9985
|
// src/indexer/entrypoint-extractor.ts
|
|
10487
|
-
import { Project
|
|
10488
|
-
import * as
|
|
9986
|
+
import { Project } from "ts-morph";
|
|
9987
|
+
import * as path11 from "path";
|
|
10489
9988
|
import * as yaml5 from "yaml";
|
|
10490
9989
|
|
|
10491
9990
|
// src/indexer/entrypoint-sanitizer.ts
|
|
@@ -10582,7 +10081,7 @@ function sanitizeTool(tool) {
|
|
|
10582
10081
|
|
|
10583
10082
|
// src/indexer/entrypoint-cli-extractor.ts
|
|
10584
10083
|
import { SyntaxKind } from "ts-morph";
|
|
10585
|
-
import * as
|
|
10084
|
+
import * as path9 from "path";
|
|
10586
10085
|
function extractCliOptions(sourceFile) {
|
|
10587
10086
|
const options = /* @__PURE__ */ new Map();
|
|
10588
10087
|
const configVar = sourceFile.getVariableDeclaration("PARSE_ARGS_CONFIG");
|
|
@@ -10698,7 +10197,7 @@ function buildCommandSpec(entry, ctx) {
|
|
|
10698
10197
|
return cmdSpec;
|
|
10699
10198
|
}
|
|
10700
10199
|
function extractCliCommands(project, packageRoot, cliCommandsPath, cliTypesPath, warnings) {
|
|
10701
|
-
const typesFullPath =
|
|
10200
|
+
const typesFullPath = path9.join(packageRoot, cliTypesPath);
|
|
10702
10201
|
const typesFile = project.getSourceFile(typesFullPath);
|
|
10703
10202
|
if (typesFile === void 0 && warnings !== void 0) {
|
|
10704
10203
|
warnings.push(
|
|
@@ -10706,7 +10205,7 @@ function extractCliCommands(project, packageRoot, cliCommandsPath, cliTypesPath,
|
|
|
10706
10205
|
);
|
|
10707
10206
|
}
|
|
10708
10207
|
const cliOptions = typesFile !== void 0 ? extractCliOptions(typesFile) : /* @__PURE__ */ new Map();
|
|
10709
|
-
const commandsFullPath =
|
|
10208
|
+
const commandsFullPath = path9.join(packageRoot, cliCommandsPath);
|
|
10710
10209
|
const commandsFile = project.getSourceFile(commandsFullPath);
|
|
10711
10210
|
if (commandsFile === void 0) {
|
|
10712
10211
|
if (warnings !== void 0) {
|
|
@@ -10718,7 +10217,7 @@ function extractCliCommands(project, packageRoot, cliCommandsPath, cliTypesPath,
|
|
|
10718
10217
|
}
|
|
10719
10218
|
const ctx = {
|
|
10720
10219
|
commandsFile,
|
|
10721
|
-
relativePath:
|
|
10220
|
+
relativePath: path9.relative(process.cwd(), commandsFullPath),
|
|
10722
10221
|
cliOptions,
|
|
10723
10222
|
cliCommandsPath,
|
|
10724
10223
|
...warnings !== void 0 && { warnings }
|
|
@@ -10728,7 +10227,7 @@ function extractCliCommands(project, packageRoot, cliCommandsPath, cliTypesPath,
|
|
|
10728
10227
|
|
|
10729
10228
|
// src/indexer/entrypoint-mcp-extractor.ts
|
|
10730
10229
|
import { SyntaxKind as SyntaxKind2 } from "ts-morph";
|
|
10731
|
-
import * as
|
|
10230
|
+
import * as path10 from "path";
|
|
10732
10231
|
function inferZodType(zodExpr) {
|
|
10733
10232
|
if (zodExpr.includes("z.string()")) return "string";
|
|
10734
10233
|
if (zodExpr.includes("z.number()")) return "number";
|
|
@@ -10771,7 +10270,7 @@ function extractZodParameters(schemaObj) {
|
|
|
10771
10270
|
}
|
|
10772
10271
|
function extractMcpTools(project, packageRoot, mcpToolsPath, warnings) {
|
|
10773
10272
|
const tools = [];
|
|
10774
|
-
const toolsDir =
|
|
10273
|
+
const toolsDir = path10.join(packageRoot, mcpToolsPath);
|
|
10775
10274
|
const toolFiles = project.getSourceFiles(`${toolsDir}/*.ts`);
|
|
10776
10275
|
if (toolFiles.length === 0 && warnings !== void 0) {
|
|
10777
10276
|
warnings.push(
|
|
@@ -10780,9 +10279,9 @@ function extractMcpTools(project, packageRoot, mcpToolsPath, warnings) {
|
|
|
10780
10279
|
}
|
|
10781
10280
|
for (const sourceFile of toolFiles) {
|
|
10782
10281
|
const filePath = sourceFile.getFilePath();
|
|
10783
|
-
const fileName =
|
|
10282
|
+
const fileName = path10.basename(filePath);
|
|
10784
10283
|
if (fileName.endsWith(".test.ts") || fileName === "index.ts") continue;
|
|
10785
|
-
const relativePath =
|
|
10284
|
+
const relativePath = path10.relative(process.cwd(), filePath);
|
|
10786
10285
|
const extractedTools = extractToolsFromFile(sourceFile, relativePath, warnings);
|
|
10787
10286
|
tools.push(...extractedTools);
|
|
10788
10287
|
}
|
|
@@ -10910,19 +10409,19 @@ function generateTimestamp() {
|
|
|
10910
10409
|
});
|
|
10911
10410
|
}
|
|
10912
10411
|
function createProject(opts) {
|
|
10913
|
-
const project = new
|
|
10914
|
-
tsConfigFilePath:
|
|
10412
|
+
const project = new Project({
|
|
10413
|
+
tsConfigFilePath: path11.join(opts.packageRoot, "tsconfig.json"),
|
|
10915
10414
|
skipAddingFilesFromTsConfig: true
|
|
10916
10415
|
});
|
|
10917
10416
|
project.addSourceFilesAtPaths([
|
|
10918
|
-
|
|
10919
|
-
|
|
10417
|
+
path11.join(opts.packageRoot, opts.cliCommandsPath),
|
|
10418
|
+
path11.join(opts.packageRoot, "src/cli-types.ts"),
|
|
10920
10419
|
// HELP_TEXT was extracted to cli-help-text.ts in #293 (Jan 2026) and
|
|
10921
10420
|
// cli-types.ts now only re-exports it. The extractor reads it via AST,
|
|
10922
10421
|
// so we have to load the defining file — a bare re-export isn't enough.
|
|
10923
10422
|
// Without this line the CLI command list silently came back empty.
|
|
10924
|
-
|
|
10925
|
-
|
|
10423
|
+
path11.join(opts.packageRoot, "src/cli-help-text.ts"),
|
|
10424
|
+
path11.join(opts.packageRoot, opts.mcpToolsPath, "*.ts")
|
|
10926
10425
|
]);
|
|
10927
10426
|
return project;
|
|
10928
10427
|
}
|
|
@@ -10969,17 +10468,17 @@ function manifestToJson(manifest) {
|
|
|
10969
10468
|
|
|
10970
10469
|
// src/cli/index-command-link-validator.ts
|
|
10971
10470
|
import * as fs12 from "fs/promises";
|
|
10972
|
-
import * as
|
|
10471
|
+
import * as path13 from "path";
|
|
10973
10472
|
|
|
10974
10473
|
// src/cli/index-command-link-validation-helpers.ts
|
|
10975
10474
|
import * as fs11 from "fs/promises";
|
|
10976
|
-
import * as
|
|
10475
|
+
import * as path12 from "path";
|
|
10977
10476
|
async function validateInternalLink(url, sourceFile) {
|
|
10978
10477
|
const [filePath, anchor] = url.split("#");
|
|
10979
10478
|
if (filePath === void 0 || filePath === "") {
|
|
10980
10479
|
return { valid: true };
|
|
10981
10480
|
}
|
|
10982
|
-
const resolvedPath =
|
|
10481
|
+
const resolvedPath = path12.resolve(path12.dirname(sourceFile), filePath);
|
|
10983
10482
|
try {
|
|
10984
10483
|
await fs11.access(resolvedPath);
|
|
10985
10484
|
if (anchor !== void 0 && anchor !== "") {
|
|
@@ -11064,9 +10563,9 @@ async function validateAnchorInFile(anchor, targetFile) {
|
|
|
11064
10563
|
return { valid: true };
|
|
11065
10564
|
}
|
|
11066
10565
|
}
|
|
11067
|
-
return { valid: false, error: `Anchor '#${anchor}' not found in ${
|
|
10566
|
+
return { valid: false, error: `Anchor '#${anchor}' not found in ${path12.basename(targetFile)}` };
|
|
11068
10567
|
} catch {
|
|
11069
|
-
return { valid: false, error: `Failed to read ${
|
|
10568
|
+
return { valid: false, error: `Failed to read ${path12.basename(targetFile)} for anchor check` };
|
|
11070
10569
|
}
|
|
11071
10570
|
}
|
|
11072
10571
|
async function validateAnchorLink(anchor, sourceFile) {
|
|
@@ -11158,7 +10657,7 @@ async function findMarkdownFiles(dir) {
|
|
|
11158
10657
|
try {
|
|
11159
10658
|
const entries = await fs12.readdir(dir, { withFileTypes: true });
|
|
11160
10659
|
for (const entry of entries) {
|
|
11161
|
-
const fullPath =
|
|
10660
|
+
const fullPath = path13.join(dir, entry.name);
|
|
11162
10661
|
if (entry.name === "node_modules" || entry.name === "dist") {
|
|
11163
10662
|
continue;
|
|
11164
10663
|
}
|
|
@@ -11353,7 +10852,7 @@ async function generateIndex(options) {
|
|
|
11353
10852
|
`Extracted ${String(extraction.files.length)} files in ${String(extraction.durationMs)}ms`
|
|
11354
10853
|
);
|
|
11355
10854
|
const index = buildIndex(extraction.files);
|
|
11356
|
-
const outputDir =
|
|
10855
|
+
const outputDir = path14.dirname(outputPath);
|
|
11357
10856
|
await fs13.mkdir(outputDir, { recursive: true });
|
|
11358
10857
|
const content = format === "yaml" ? indexToYaml(index) : indexToJson(index);
|
|
11359
10858
|
await fs13.writeFile(outputPath, content, "utf-8");
|
|
@@ -11424,7 +10923,7 @@ async function generateDiagram(options) {
|
|
|
11424
10923
|
CodebaseIndexSchema.parse(parsed);
|
|
11425
10924
|
const index = parsed;
|
|
11426
10925
|
const diagram = generateDiagramMarkdown(index);
|
|
11427
|
-
await fs13.mkdir(
|
|
10926
|
+
await fs13.mkdir(path14.dirname(diagramPath), { recursive: true });
|
|
11428
10927
|
await fs13.writeFile(diagramPath, diagram, "utf-8");
|
|
11429
10928
|
logger10.info(`Wrote diagram to ${diagramPath}`);
|
|
11430
10929
|
return {
|
|
@@ -11530,7 +11029,7 @@ async function entrypointsCommand(options) {
|
|
|
11530
11029
|
for (const warning of result.warnings) {
|
|
11531
11030
|
logger10.warn(warning);
|
|
11532
11031
|
}
|
|
11533
|
-
const outputDir =
|
|
11032
|
+
const outputDir = path14.dirname(outputPath);
|
|
11534
11033
|
await fs13.mkdir(outputDir, { recursive: true });
|
|
11535
11034
|
const content = format === "yaml" ? manifestToYaml(manifest) : manifestToJson(manifest);
|
|
11536
11035
|
await fs13.writeFile(outputPath, content, "utf-8");
|
|
@@ -11552,7 +11051,7 @@ async function freshnessCommand(options) {
|
|
|
11552
11051
|
const hasIssues = summary.stale > 0 || summary.warning > 0 || summary.unknown > 0;
|
|
11553
11052
|
const output2 = options.format === "json" ? formatFreshnessJson(result) : formatFreshnessTable(result);
|
|
11554
11053
|
if (options.output !== void 0) {
|
|
11555
|
-
const outputDir =
|
|
11054
|
+
const outputDir = path14.dirname(options.output);
|
|
11556
11055
|
await fs13.mkdir(outputDir, { recursive: true });
|
|
11557
11056
|
await fs13.writeFile(options.output, output2, "utf-8");
|
|
11558
11057
|
logger10.info(`Wrote freshness report to ${options.output}`);
|
|
@@ -11586,7 +11085,7 @@ async function linksCommand(options) {
|
|
|
11586
11085
|
const hasBrokenLinks = summary.brokenLinks > 0;
|
|
11587
11086
|
const output2 = options.format === "json" ? formatLinkValidationJson(result) : formatLinkValidationTable(result);
|
|
11588
11087
|
if (options.output !== void 0) {
|
|
11589
|
-
const outputDir =
|
|
11088
|
+
const outputDir = path14.dirname(options.output);
|
|
11590
11089
|
await fs13.mkdir(outputDir, { recursive: true });
|
|
11591
11090
|
await fs13.writeFile(options.output, output2, "utf-8");
|
|
11592
11091
|
logger10.info(`Wrote link validation report to ${options.output}`);
|
|
@@ -12082,32 +11581,32 @@ function learningMetricsCommand(options, context) {
|
|
|
12082
11581
|
}
|
|
12083
11582
|
|
|
12084
11583
|
// src/cli/config-command-types.ts
|
|
12085
|
-
import { z as
|
|
11584
|
+
import { z as z5 } from "zod";
|
|
12086
11585
|
var CONFIG_ACTIONS = ["get", "set", "list", "reset", "export", "import"];
|
|
12087
11586
|
var CONFIG_FORMATS = ["json", "yaml"];
|
|
12088
|
-
var ConfigCommandOptionsSchema =
|
|
11587
|
+
var ConfigCommandOptionsSchema = z5.object({
|
|
12089
11588
|
/** Command action */
|
|
12090
|
-
action:
|
|
11589
|
+
action: z5.enum(CONFIG_ACTIONS),
|
|
12091
11590
|
/** Configuration key (dot notation supported) */
|
|
12092
|
-
key:
|
|
11591
|
+
key: z5.string().optional(),
|
|
12093
11592
|
/** Value to set */
|
|
12094
|
-
value:
|
|
11593
|
+
value: z5.string().optional(),
|
|
12095
11594
|
/** File path for import/export */
|
|
12096
|
-
file:
|
|
11595
|
+
file: z5.string().optional(),
|
|
12097
11596
|
/** Export format */
|
|
12098
|
-
format:
|
|
11597
|
+
format: z5.enum(CONFIG_FORMATS).default("json"),
|
|
12099
11598
|
/** Force overwrite without backup */
|
|
12100
|
-
force:
|
|
11599
|
+
force: z5.boolean().default(false),
|
|
12101
11600
|
/** Show verbose output */
|
|
12102
|
-
verbose:
|
|
11601
|
+
verbose: z5.boolean().default(false)
|
|
12103
11602
|
});
|
|
12104
|
-
var ParsedConfigKeySchema =
|
|
11603
|
+
var ParsedConfigKeySchema = z5.object({
|
|
12105
11604
|
/** Full key string */
|
|
12106
|
-
fullKey:
|
|
11605
|
+
fullKey: z5.string(),
|
|
12107
11606
|
/** Category portion */
|
|
12108
|
-
category:
|
|
11607
|
+
category: z5.string(),
|
|
12109
11608
|
/** Key within category */
|
|
12110
|
-
key:
|
|
11609
|
+
key: z5.string()
|
|
12111
11610
|
});
|
|
12112
11611
|
var ConfigCommandError = class extends Error {
|
|
12113
11612
|
code;
|
|
@@ -12123,7 +11622,7 @@ function isValidConfigAction(value) {
|
|
|
12123
11622
|
|
|
12124
11623
|
// src/cli/config-command-helpers.ts
|
|
12125
11624
|
import * as fs14 from "fs/promises";
|
|
12126
|
-
import * as
|
|
11625
|
+
import * as path15 from "path";
|
|
12127
11626
|
import { existsSync as existsSync10 } from "fs";
|
|
12128
11627
|
|
|
12129
11628
|
// src/cli/config-command-formatting.ts
|
|
@@ -12391,10 +11890,10 @@ function parseValueFromString(stringValue, defaultValue) {
|
|
|
12391
11890
|
}
|
|
12392
11891
|
function resolveFilePath(filePath, allowedBase) {
|
|
12393
11892
|
const base = allowedBase ?? process.cwd();
|
|
12394
|
-
const resolved =
|
|
12395
|
-
const normalizedResolved =
|
|
12396
|
-
const normalizedBase =
|
|
12397
|
-
const isWithinBase = normalizedResolved === normalizedBase || normalizedResolved.startsWith(normalizedBase +
|
|
11893
|
+
const resolved = path15.isAbsolute(filePath) ? filePath : path15.resolve(base, filePath);
|
|
11894
|
+
const normalizedResolved = path15.normalize(resolved);
|
|
11895
|
+
const normalizedBase = path15.normalize(base);
|
|
11896
|
+
const isWithinBase = normalizedResolved === normalizedBase || normalizedResolved.startsWith(normalizedBase + path15.sep);
|
|
12398
11897
|
if (!isWithinBase) {
|
|
12399
11898
|
throw new ConfigCommandError(
|
|
12400
11899
|
"PATH_TRAVERSAL",
|
|
@@ -12405,7 +11904,7 @@ function resolveFilePath(filePath, allowedBase) {
|
|
|
12405
11904
|
}
|
|
12406
11905
|
function getDefaultExportPath(format) {
|
|
12407
11906
|
const extension = format === "json" ? "json" : "yaml";
|
|
12408
|
-
return
|
|
11907
|
+
return path15.resolve(process.cwd(), `nexus-config.${extension}`);
|
|
12409
11908
|
}
|
|
12410
11909
|
|
|
12411
11910
|
// src/cli/config-command-handlers.ts
|
|
@@ -12775,8 +12274,8 @@ async function configCommand(options) {
|
|
|
12775
12274
|
}
|
|
12776
12275
|
|
|
12777
12276
|
// src/cli/hooks/hook-types.ts
|
|
12778
|
-
import { z as
|
|
12779
|
-
var HookEventName =
|
|
12277
|
+
import { z as z6 } from "zod";
|
|
12278
|
+
var HookEventName = z6.enum([
|
|
12780
12279
|
"SessionStart",
|
|
12781
12280
|
"UserPromptSubmit",
|
|
12782
12281
|
"PreToolUse",
|
|
@@ -12791,100 +12290,100 @@ var HookEventName = z7.enum([
|
|
|
12791
12290
|
"Notification",
|
|
12792
12291
|
"Setup"
|
|
12793
12292
|
]);
|
|
12794
|
-
var PermissionMode =
|
|
12293
|
+
var PermissionMode = z6.enum([
|
|
12795
12294
|
"default",
|
|
12796
12295
|
"plan",
|
|
12797
12296
|
"acceptEdits",
|
|
12798
12297
|
"dontAsk",
|
|
12799
12298
|
"bypassPermissions"
|
|
12800
12299
|
]);
|
|
12801
|
-
var HookInputBaseSchema =
|
|
12802
|
-
session_id:
|
|
12803
|
-
transcript_path:
|
|
12804
|
-
cwd:
|
|
12300
|
+
var HookInputBaseSchema = z6.object({
|
|
12301
|
+
session_id: z6.string(),
|
|
12302
|
+
transcript_path: z6.string(),
|
|
12303
|
+
cwd: z6.string(),
|
|
12805
12304
|
permission_mode: PermissionMode,
|
|
12806
12305
|
hook_event_name: HookEventName
|
|
12807
12306
|
});
|
|
12808
|
-
var SessionStartSource =
|
|
12307
|
+
var SessionStartSource = z6.enum(["startup", "resume", "clear", "compact"]);
|
|
12809
12308
|
var SessionStartInputSchema = HookInputBaseSchema.extend({
|
|
12810
|
-
hook_event_name:
|
|
12309
|
+
hook_event_name: z6.literal("SessionStart"),
|
|
12811
12310
|
source: SessionStartSource,
|
|
12812
|
-
model:
|
|
12813
|
-
agent_type:
|
|
12311
|
+
model: z6.string().optional(),
|
|
12312
|
+
agent_type: z6.string().optional()
|
|
12814
12313
|
});
|
|
12815
|
-
var SessionEndReason =
|
|
12314
|
+
var SessionEndReason = z6.enum(["clear", "logout", "prompt_input_exit", "other"]);
|
|
12816
12315
|
var SessionEndInputSchema = HookInputBaseSchema.extend({
|
|
12817
|
-
hook_event_name:
|
|
12316
|
+
hook_event_name: z6.literal("SessionEnd"),
|
|
12818
12317
|
reason: SessionEndReason
|
|
12819
12318
|
});
|
|
12820
12319
|
var PreToolUseInputSchema = HookInputBaseSchema.extend({
|
|
12821
|
-
hook_event_name:
|
|
12822
|
-
tool_name:
|
|
12823
|
-
tool_input:
|
|
12824
|
-
tool_use_id:
|
|
12320
|
+
hook_event_name: z6.literal("PreToolUse"),
|
|
12321
|
+
tool_name: z6.string(),
|
|
12322
|
+
tool_input: z6.record(z6.string(), z6.unknown()),
|
|
12323
|
+
tool_use_id: z6.string()
|
|
12825
12324
|
});
|
|
12826
12325
|
var PostToolUseInputSchema = HookInputBaseSchema.extend({
|
|
12827
|
-
hook_event_name:
|
|
12828
|
-
tool_name:
|
|
12829
|
-
tool_input:
|
|
12830
|
-
tool_response:
|
|
12831
|
-
tool_use_id:
|
|
12326
|
+
hook_event_name: z6.literal("PostToolUse"),
|
|
12327
|
+
tool_name: z6.string(),
|
|
12328
|
+
tool_input: z6.record(z6.string(), z6.unknown()),
|
|
12329
|
+
tool_response: z6.record(z6.string(), z6.unknown()),
|
|
12330
|
+
tool_use_id: z6.string()
|
|
12832
12331
|
});
|
|
12833
12332
|
var PostToolUseFailureInputSchema = HookInputBaseSchema.extend({
|
|
12834
|
-
hook_event_name:
|
|
12835
|
-
tool_name:
|
|
12836
|
-
tool_input:
|
|
12837
|
-
tool_use_id:
|
|
12838
|
-
error:
|
|
12333
|
+
hook_event_name: z6.literal("PostToolUseFailure"),
|
|
12334
|
+
tool_name: z6.string(),
|
|
12335
|
+
tool_input: z6.record(z6.string(), z6.unknown()),
|
|
12336
|
+
tool_use_id: z6.string(),
|
|
12337
|
+
error: z6.string().optional()
|
|
12839
12338
|
});
|
|
12840
12339
|
var StopInputSchema = HookInputBaseSchema.extend({
|
|
12841
|
-
hook_event_name:
|
|
12842
|
-
stop_hook_active:
|
|
12340
|
+
hook_event_name: z6.literal("Stop"),
|
|
12341
|
+
stop_hook_active: z6.boolean()
|
|
12843
12342
|
});
|
|
12844
12343
|
var SubagentStopInputSchema = HookInputBaseSchema.extend({
|
|
12845
|
-
hook_event_name:
|
|
12846
|
-
stop_hook_active:
|
|
12847
|
-
agent_id:
|
|
12848
|
-
agent_transcript_path:
|
|
12344
|
+
hook_event_name: z6.literal("SubagentStop"),
|
|
12345
|
+
stop_hook_active: z6.boolean(),
|
|
12346
|
+
agent_id: z6.string(),
|
|
12347
|
+
agent_transcript_path: z6.string()
|
|
12849
12348
|
});
|
|
12850
12349
|
var UserPromptSubmitInputSchema = HookInputBaseSchema.extend({
|
|
12851
|
-
hook_event_name:
|
|
12852
|
-
prompt:
|
|
12350
|
+
hook_event_name: z6.literal("UserPromptSubmit"),
|
|
12351
|
+
prompt: z6.string()
|
|
12853
12352
|
});
|
|
12854
|
-
var NotificationType =
|
|
12353
|
+
var NotificationType = z6.enum([
|
|
12855
12354
|
"permission_prompt",
|
|
12856
12355
|
"idle_prompt",
|
|
12857
12356
|
"auth_success",
|
|
12858
12357
|
"elicitation_dialog"
|
|
12859
12358
|
]);
|
|
12860
12359
|
var NotificationInputSchema = HookInputBaseSchema.extend({
|
|
12861
|
-
hook_event_name:
|
|
12862
|
-
message:
|
|
12360
|
+
hook_event_name: z6.literal("Notification"),
|
|
12361
|
+
message: z6.string(),
|
|
12863
12362
|
notification_type: NotificationType
|
|
12864
12363
|
});
|
|
12865
|
-
var PreCompactTrigger =
|
|
12364
|
+
var PreCompactTrigger = z6.enum(["manual", "auto"]);
|
|
12866
12365
|
var PreCompactInputSchema = HookInputBaseSchema.extend({
|
|
12867
|
-
hook_event_name:
|
|
12366
|
+
hook_event_name: z6.literal("PreCompact"),
|
|
12868
12367
|
trigger: PreCompactTrigger,
|
|
12869
|
-
custom_instructions:
|
|
12368
|
+
custom_instructions: z6.string().optional()
|
|
12870
12369
|
});
|
|
12871
|
-
var SetupTrigger =
|
|
12370
|
+
var SetupTrigger = z6.enum(["init", "maintenance"]);
|
|
12872
12371
|
var SetupInputSchema = HookInputBaseSchema.extend({
|
|
12873
|
-
hook_event_name:
|
|
12372
|
+
hook_event_name: z6.literal("Setup"),
|
|
12874
12373
|
trigger: SetupTrigger
|
|
12875
12374
|
});
|
|
12876
12375
|
var SubagentStartInputSchema = HookInputBaseSchema.extend({
|
|
12877
|
-
hook_event_name:
|
|
12878
|
-
agent_id:
|
|
12879
|
-
agent_type:
|
|
12376
|
+
hook_event_name: z6.literal("SubagentStart"),
|
|
12377
|
+
agent_id: z6.string(),
|
|
12378
|
+
agent_type: z6.string()
|
|
12880
12379
|
});
|
|
12881
12380
|
var PermissionRequestInputSchema = HookInputBaseSchema.extend({
|
|
12882
|
-
hook_event_name:
|
|
12883
|
-
tool_name:
|
|
12884
|
-
tool_input:
|
|
12885
|
-
tool_use_id:
|
|
12381
|
+
hook_event_name: z6.literal("PermissionRequest"),
|
|
12382
|
+
tool_name: z6.string(),
|
|
12383
|
+
tool_input: z6.record(z6.string(), z6.unknown()),
|
|
12384
|
+
tool_use_id: z6.string()
|
|
12886
12385
|
});
|
|
12887
|
-
var HookInputSchema =
|
|
12386
|
+
var HookInputSchema = z6.discriminatedUnion("hook_event_name", [
|
|
12888
12387
|
SessionStartInputSchema,
|
|
12889
12388
|
SessionEndInputSchema,
|
|
12890
12389
|
PreToolUseInputSchema,
|
|
@@ -12899,57 +12398,57 @@ var HookInputSchema = z7.discriminatedUnion("hook_event_name", [
|
|
|
12899
12398
|
SubagentStartInputSchema,
|
|
12900
12399
|
PermissionRequestInputSchema
|
|
12901
12400
|
]);
|
|
12902
|
-
var PermissionDecision =
|
|
12903
|
-
var HookDecision =
|
|
12904
|
-
var HookOutputBaseSchema =
|
|
12905
|
-
continue:
|
|
12906
|
-
stopReason:
|
|
12907
|
-
suppressOutput:
|
|
12908
|
-
systemMessage:
|
|
12401
|
+
var PermissionDecision = z6.enum(["allow", "deny", "ask"]);
|
|
12402
|
+
var HookDecision = z6.enum(["block"]);
|
|
12403
|
+
var HookOutputBaseSchema = z6.object({
|
|
12404
|
+
continue: z6.boolean().optional(),
|
|
12405
|
+
stopReason: z6.string().optional(),
|
|
12406
|
+
suppressOutput: z6.boolean().optional(),
|
|
12407
|
+
systemMessage: z6.string().optional()
|
|
12909
12408
|
});
|
|
12910
12409
|
var PreToolUseOutputSchema = HookOutputBaseSchema.extend({
|
|
12911
|
-
hookSpecificOutput:
|
|
12912
|
-
hookEventName:
|
|
12410
|
+
hookSpecificOutput: z6.object({
|
|
12411
|
+
hookEventName: z6.literal("PreToolUse"),
|
|
12913
12412
|
permissionDecision: PermissionDecision.optional(),
|
|
12914
|
-
permissionDecisionReason:
|
|
12915
|
-
updatedInput:
|
|
12916
|
-
additionalContext:
|
|
12413
|
+
permissionDecisionReason: z6.string().optional(),
|
|
12414
|
+
updatedInput: z6.record(z6.string(), z6.unknown()).optional(),
|
|
12415
|
+
additionalContext: z6.string().optional()
|
|
12917
12416
|
}).optional()
|
|
12918
12417
|
});
|
|
12919
12418
|
var PostToolUseOutputSchema = HookOutputBaseSchema.extend({
|
|
12920
12419
|
decision: HookDecision.optional(),
|
|
12921
|
-
reason:
|
|
12922
|
-
hookSpecificOutput:
|
|
12923
|
-
hookEventName:
|
|
12924
|
-
additionalContext:
|
|
12420
|
+
reason: z6.string().optional(),
|
|
12421
|
+
hookSpecificOutput: z6.object({
|
|
12422
|
+
hookEventName: z6.literal("PostToolUse"),
|
|
12423
|
+
additionalContext: z6.string().optional()
|
|
12925
12424
|
}).optional()
|
|
12926
12425
|
});
|
|
12927
12426
|
var StopOutputSchema = HookOutputBaseSchema.extend({
|
|
12928
12427
|
decision: HookDecision.optional(),
|
|
12929
|
-
reason:
|
|
12428
|
+
reason: z6.string().optional()
|
|
12930
12429
|
});
|
|
12931
12430
|
var UserPromptSubmitOutputSchema = HookOutputBaseSchema.extend({
|
|
12932
12431
|
decision: HookDecision.optional(),
|
|
12933
|
-
reason:
|
|
12934
|
-
hookSpecificOutput:
|
|
12935
|
-
hookEventName:
|
|
12936
|
-
additionalContext:
|
|
12432
|
+
reason: z6.string().optional(),
|
|
12433
|
+
hookSpecificOutput: z6.object({
|
|
12434
|
+
hookEventName: z6.literal("UserPromptSubmit"),
|
|
12435
|
+
additionalContext: z6.string().optional()
|
|
12937
12436
|
}).optional()
|
|
12938
12437
|
});
|
|
12939
12438
|
var SessionStartOutputSchema = HookOutputBaseSchema.extend({
|
|
12940
|
-
hookSpecificOutput:
|
|
12941
|
-
hookEventName:
|
|
12942
|
-
additionalContext:
|
|
12439
|
+
hookSpecificOutput: z6.object({
|
|
12440
|
+
hookEventName: z6.literal("SessionStart"),
|
|
12441
|
+
additionalContext: z6.string().optional()
|
|
12943
12442
|
}).optional()
|
|
12944
12443
|
});
|
|
12945
12444
|
var PermissionRequestOutputSchema = HookOutputBaseSchema.extend({
|
|
12946
|
-
hookSpecificOutput:
|
|
12947
|
-
hookEventName:
|
|
12948
|
-
decision:
|
|
12949
|
-
behavior:
|
|
12950
|
-
updatedInput:
|
|
12951
|
-
message:
|
|
12952
|
-
interrupt:
|
|
12445
|
+
hookSpecificOutput: z6.object({
|
|
12446
|
+
hookEventName: z6.literal("PermissionRequest"),
|
|
12447
|
+
decision: z6.object({
|
|
12448
|
+
behavior: z6.enum(["allow", "deny"]),
|
|
12449
|
+
updatedInput: z6.record(z6.string(), z6.unknown()).optional(),
|
|
12450
|
+
message: z6.string().optional(),
|
|
12451
|
+
interrupt: z6.boolean().optional()
|
|
12953
12452
|
})
|
|
12954
12453
|
}).optional()
|
|
12955
12454
|
});
|
|
@@ -13035,7 +12534,7 @@ function writeResultAndExit(result) {
|
|
|
13035
12534
|
|
|
13036
12535
|
// src/cli/hooks/hook-router.ts
|
|
13037
12536
|
async function readStdin() {
|
|
13038
|
-
return new Promise((
|
|
12537
|
+
return new Promise((resolve13, reject) => {
|
|
13039
12538
|
let data = "";
|
|
13040
12539
|
process.stdin.setEncoding("utf8");
|
|
13041
12540
|
process.stdin.on("readable", () => {
|
|
@@ -13046,24 +12545,24 @@ async function readStdin() {
|
|
|
13046
12545
|
}
|
|
13047
12546
|
});
|
|
13048
12547
|
process.stdin.on("end", () => {
|
|
13049
|
-
|
|
12548
|
+
resolve13(data);
|
|
13050
12549
|
});
|
|
13051
12550
|
process.stdin.on("error", (err2) => {
|
|
13052
12551
|
reject(err2);
|
|
13053
12552
|
});
|
|
13054
12553
|
if (process.stdin.isTTY) {
|
|
13055
|
-
|
|
12554
|
+
resolve13("");
|
|
13056
12555
|
}
|
|
13057
12556
|
});
|
|
13058
12557
|
}
|
|
13059
12558
|
async function readStdinWithTimeout(timeoutMs = 5e3) {
|
|
13060
|
-
return new Promise((
|
|
12559
|
+
return new Promise((resolve13, reject) => {
|
|
13061
12560
|
const timeout2 = setTimeout(() => {
|
|
13062
12561
|
reject(new Error(`Stdin read timeout after ${String(timeoutMs)}ms`));
|
|
13063
12562
|
}, timeoutMs);
|
|
13064
12563
|
readStdin().then((data) => {
|
|
13065
12564
|
clearTimeout(timeout2);
|
|
13066
|
-
|
|
12565
|
+
resolve13(data);
|
|
13067
12566
|
}).catch((err2) => {
|
|
13068
12567
|
clearTimeout(timeout2);
|
|
13069
12568
|
reject(err2 instanceof Error ? err2 : new Error(String(err2)));
|
|
@@ -14553,9 +14052,9 @@ function interactiveIO() {
|
|
|
14553
14052
|
write: (text) => {
|
|
14554
14053
|
process.stdout.write(text);
|
|
14555
14054
|
},
|
|
14556
|
-
prompt: (question) => new Promise((
|
|
14055
|
+
prompt: (question) => new Promise((resolve13) => {
|
|
14557
14056
|
rl.question(question, (answer) => {
|
|
14558
|
-
|
|
14057
|
+
resolve13(answer.trim());
|
|
14559
14058
|
});
|
|
14560
14059
|
}),
|
|
14561
14060
|
close: () => {
|
|
@@ -14577,8 +14076,8 @@ function scriptedIO() {
|
|
|
14577
14076
|
// src/governance/claims-registry.ts
|
|
14578
14077
|
import { existsSync as existsSync12, readFileSync as readFileSync6 } from "fs";
|
|
14579
14078
|
import { parse as parseYaml2 } from "yaml";
|
|
14580
|
-
import { z as
|
|
14581
|
-
var VerificationMethodSchema =
|
|
14079
|
+
import { z as z7 } from "zod";
|
|
14080
|
+
var VerificationMethodSchema = z7.enum([
|
|
14582
14081
|
"file-exists",
|
|
14583
14082
|
"file-contains",
|
|
14584
14083
|
"source-contains-all",
|
|
@@ -14586,7 +14085,7 @@ var VerificationMethodSchema = z8.enum([
|
|
|
14586
14085
|
"manifest-tool-count",
|
|
14587
14086
|
"roadmap-status"
|
|
14588
14087
|
]);
|
|
14589
|
-
var ClaimStatusSchema =
|
|
14088
|
+
var ClaimStatusSchema = z7.enum([
|
|
14590
14089
|
"verified",
|
|
14591
14090
|
// backed by live evidence the runner checks every CI run
|
|
14592
14091
|
"partial",
|
|
@@ -14596,25 +14095,25 @@ var ClaimStatusSchema = z8.enum([
|
|
|
14596
14095
|
"stale"
|
|
14597
14096
|
// known-broken backing; tracked, must not regress to silent
|
|
14598
14097
|
]);
|
|
14599
|
-
var EvidenceTypeSchema =
|
|
14600
|
-
var VerificationSchema =
|
|
14098
|
+
var EvidenceTypeSchema = z7.enum(["test", "gate", "eval-artifact", "adr", "source"]);
|
|
14099
|
+
var VerificationSchema = z7.object({
|
|
14601
14100
|
method: VerificationMethodSchema,
|
|
14602
14101
|
/** Repo-root-relative path to the live backing evidence. */
|
|
14603
|
-
path:
|
|
14102
|
+
path: z7.string().min(1),
|
|
14604
14103
|
/**
|
|
14605
14104
|
* Expected value. Numeric for `enum-member-count` / `manifest-tool-count`,
|
|
14606
14105
|
* string for `file-contains` / `roadmap-status`. Unused by `file-exists`.
|
|
14607
14106
|
*/
|
|
14608
|
-
expected:
|
|
14107
|
+
expected: z7.union([z7.number().int().nonnegative(), z7.string().min(1)]).optional(),
|
|
14609
14108
|
/** Target symbol name (e.g. the exported `z.enum` const) for count methods. */
|
|
14610
|
-
symbol:
|
|
14109
|
+
symbol: z7.string().min(1).optional(),
|
|
14611
14110
|
/**
|
|
14612
14111
|
* Literal the claim's `subject` doc must contain (#3877). When present, the
|
|
14613
14112
|
* runner verifies the doc making the claim — not just the source of truth —
|
|
14614
14113
|
* so README/ARCHITECTURE drift fails the gate. Omit only for claims whose
|
|
14615
14114
|
* `subject` IS the verification `path` (e.g. `roadmap-status`).
|
|
14616
14115
|
*/
|
|
14617
|
-
subjectContains:
|
|
14116
|
+
subjectContains: z7.string().min(1).optional()
|
|
14618
14117
|
}).strict().superRefine((v, ctx) => {
|
|
14619
14118
|
const needsNumber = v.method === "enum-member-count" || v.method === "manifest-tool-count";
|
|
14620
14119
|
const needsString = v.method === "file-contains" || v.method === "source-contains-all" || v.method === "roadmap-status";
|
|
@@ -14640,24 +14139,24 @@ var VerificationSchema = z8.object({
|
|
|
14640
14139
|
});
|
|
14641
14140
|
}
|
|
14642
14141
|
});
|
|
14643
|
-
var ClaimEntrySchema =
|
|
14142
|
+
var ClaimEntrySchema = z7.object({
|
|
14644
14143
|
/** Stable, kebab-case identifier; never reused. */
|
|
14645
|
-
id:
|
|
14144
|
+
id: z7.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, "id must be kebab-case"),
|
|
14646
14145
|
/** Human-readable claim text (<=25 words). */
|
|
14647
|
-
claim:
|
|
14146
|
+
claim: z7.string().min(1).refine((s) => s.trim().split(/\s+/).length <= 25, "claim must be <=25 words"),
|
|
14648
14147
|
/** Repo-root-relative doc that makes the claim (e.g. README.md). */
|
|
14649
|
-
subject:
|
|
14148
|
+
subject: z7.string().min(1),
|
|
14650
14149
|
status: ClaimStatusSchema,
|
|
14651
14150
|
evidenceType: EvidenceTypeSchema,
|
|
14652
14151
|
verification: VerificationSchema,
|
|
14653
14152
|
/** ISO date (YYYY-MM-DD) the claim was last manually verified. */
|
|
14654
|
-
lastVerified:
|
|
14153
|
+
lastVerified: z7.string().regex(/^\d{4}-\d{2}-\d{2}$/, "lastVerified must be YYYY-MM-DD"),
|
|
14655
14154
|
/** Optional caveat surfaced in reports (required-ish for `partial`). */
|
|
14656
|
-
caveat:
|
|
14155
|
+
caveat: z7.string().optional()
|
|
14657
14156
|
}).strict();
|
|
14658
|
-
var ClaimsRegistrySchema =
|
|
14659
|
-
version:
|
|
14660
|
-
claims:
|
|
14157
|
+
var ClaimsRegistrySchema = z7.object({
|
|
14158
|
+
version: z7.number().int().positive(),
|
|
14159
|
+
claims: z7.array(ClaimEntrySchema).min(1).superRefine((claims, ctx) => {
|
|
14661
14160
|
const seen = /* @__PURE__ */ new Set();
|
|
14662
14161
|
for (const [i, c] of claims.entries()) {
|
|
14663
14162
|
if (seen.has(c.id)) {
|
|
@@ -14674,7 +14173,7 @@ var ClaimsRegistrySchema = z8.object({
|
|
|
14674
14173
|
|
|
14675
14174
|
// src/governance/claims-verify.ts
|
|
14676
14175
|
import { existsSync as existsSync13, readFileSync as readFileSync7 } from "fs";
|
|
14677
|
-
import { isAbsolute as isAbsolute2, join as
|
|
14176
|
+
import { isAbsolute as isAbsolute2, join as join10 } from "path";
|
|
14678
14177
|
|
|
14679
14178
|
// src/cli/fitness-audit.ts
|
|
14680
14179
|
var COLORS = colors;
|
|
@@ -15879,7 +15378,7 @@ async function releaseAnnounceCommand(args) {
|
|
|
15879
15378
|
|
|
15880
15379
|
// src/cli/scaffold.ts
|
|
15881
15380
|
import * as fs16 from "fs";
|
|
15882
|
-
import * as
|
|
15381
|
+
import * as path16 from "path";
|
|
15883
15382
|
|
|
15884
15383
|
// src/cli/scaffold-templates.ts
|
|
15885
15384
|
function toolImportsAndSchema(name, pascal) {
|
|
@@ -16215,8 +15714,8 @@ ${lines}`;
|
|
|
16215
15714
|
function writeFiles(files) {
|
|
16216
15715
|
const createdPaths = [];
|
|
16217
15716
|
for (const file of files) {
|
|
16218
|
-
const fullPath =
|
|
16219
|
-
const dir =
|
|
15717
|
+
const fullPath = path16.resolve(process.cwd(), file.path);
|
|
15718
|
+
const dir = path16.dirname(fullPath);
|
|
16220
15719
|
fs16.mkdirSync(dir, { recursive: true });
|
|
16221
15720
|
if (fs16.existsSync(fullPath)) {
|
|
16222
15721
|
return {
|
|
@@ -17013,11 +16512,11 @@ import {
|
|
|
17013
16512
|
appendFileSync as appendFileSync2,
|
|
17014
16513
|
readFileSync as readFileSync13
|
|
17015
16514
|
} from "fs";
|
|
17016
|
-
import { resolve as
|
|
16515
|
+
import { resolve as resolve9, join as join14, isAbsolute as isAbsolute3 } from "path";
|
|
17017
16516
|
|
|
17018
16517
|
// src/cli/mcp-config-emitter.ts
|
|
17019
16518
|
import { existsSync as existsSync18, readFileSync as readFileSync11, writeFileSync as writeFileSync5, appendFileSync } from "fs";
|
|
17020
|
-
import { join as
|
|
16519
|
+
import { join as join11 } from "path";
|
|
17021
16520
|
var MCP_CONFIG_FILENAME = ".mcp.json";
|
|
17022
16521
|
var NEXUS_SERVER_KEY = "nexus-agents";
|
|
17023
16522
|
function buildNexusServerEntry(dataDir, commandPath) {
|
|
@@ -17039,23 +16538,23 @@ function entriesEqual(a, b) {
|
|
|
17039
16538
|
for (const k of aKeys) if (aEnv[k] !== bEnv[k]) return false;
|
|
17040
16539
|
return true;
|
|
17041
16540
|
}
|
|
17042
|
-
function loadExistingConfig(
|
|
17043
|
-
if (!existsSync18(
|
|
16541
|
+
function loadExistingConfig(path18) {
|
|
16542
|
+
if (!existsSync18(path18)) return { ok: true, value: void 0 };
|
|
17044
16543
|
let raw;
|
|
17045
16544
|
try {
|
|
17046
|
-
raw = readFileSync11(
|
|
16545
|
+
raw = readFileSync11(path18, "utf-8");
|
|
17047
16546
|
} catch (e) {
|
|
17048
16547
|
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
17049
16548
|
}
|
|
17050
16549
|
try {
|
|
17051
16550
|
const parsed = JSON.parse(raw);
|
|
17052
16551
|
if (typeof parsed !== "object" || parsed === null) {
|
|
17053
|
-
return { ok: false, error: `${
|
|
16552
|
+
return { ok: false, error: `${path18}: top-level JSON must be an object` };
|
|
17054
16553
|
}
|
|
17055
16554
|
return { ok: true, value: parsed };
|
|
17056
16555
|
} catch (e) {
|
|
17057
16556
|
const msg = e instanceof Error ? e.message : String(e);
|
|
17058
|
-
return { ok: false, error: `${
|
|
16557
|
+
return { ok: false, error: `${path18}: invalid JSON \u2014 ${msg}` };
|
|
17059
16558
|
}
|
|
17060
16559
|
}
|
|
17061
16560
|
function decideEmission(existing, desired, force) {
|
|
@@ -17077,9 +16576,9 @@ function decideEmission(existing, desired, force) {
|
|
|
17077
16576
|
return { kind: "write", nextConfig: { ...existing, mcpServers: nextServers } };
|
|
17078
16577
|
}
|
|
17079
16578
|
function autoGitignoreMcpConfig(workspaceDir, dryRun) {
|
|
17080
|
-
const gitDir =
|
|
16579
|
+
const gitDir = join11(workspaceDir, ".git");
|
|
17081
16580
|
if (!existsSync18(gitDir)) return false;
|
|
17082
|
-
const gitignorePath =
|
|
16581
|
+
const gitignorePath = join11(workspaceDir, ".gitignore");
|
|
17083
16582
|
let existing = "";
|
|
17084
16583
|
if (existsSync18(gitignorePath)) {
|
|
17085
16584
|
existing = readFileSync11(gitignorePath, "utf-8");
|
|
@@ -17094,7 +16593,7 @@ function autoGitignoreMcpConfig(workspaceDir, dryRun) {
|
|
|
17094
16593
|
return true;
|
|
17095
16594
|
}
|
|
17096
16595
|
function emitMcpConfig(options) {
|
|
17097
|
-
const mcpConfigPath =
|
|
16596
|
+
const mcpConfigPath = join11(options.workspaceDir, MCP_CONFIG_FILENAME);
|
|
17098
16597
|
const dryRun = options.dryRun === true;
|
|
17099
16598
|
const force = options.force === true;
|
|
17100
16599
|
const desired = buildNexusServerEntry(options.dataDir, options.commandPath);
|
|
@@ -17133,12 +16632,12 @@ function makeFailure(mcpConfigPath, error) {
|
|
|
17133
16632
|
// src/cli/portable-installer.ts
|
|
17134
16633
|
import { execFile as execFile2 } from "child_process";
|
|
17135
16634
|
import { existsSync as existsSync20, mkdirSync as mkdirSync4, rmSync, writeFileSync as writeFileSync7 } from "fs";
|
|
17136
|
-
import { join as
|
|
16635
|
+
import { join as join13 } from "path";
|
|
17137
16636
|
import { promisify as promisify2 } from "util";
|
|
17138
16637
|
|
|
17139
16638
|
// src/cli/bin-shim.ts
|
|
17140
16639
|
import { existsSync as existsSync19, readFileSync as readFileSync12, writeFileSync as writeFileSync6, chmodSync as chmodSync2, mkdirSync as mkdirSync3 } from "fs";
|
|
17141
|
-
import { join as
|
|
16640
|
+
import { join as join12 } from "path";
|
|
17142
16641
|
var SHIM_BASENAME = "nexus-agents";
|
|
17143
16642
|
var SHIM_MODE = 493;
|
|
17144
16643
|
function buildShimContents(cliEntryPath) {
|
|
@@ -17152,7 +16651,7 @@ function buildShimContents(cliEntryPath) {
|
|
|
17152
16651
|
return lines.join("\n");
|
|
17153
16652
|
}
|
|
17154
16653
|
function writeBinShim(options) {
|
|
17155
|
-
const shimPath =
|
|
16654
|
+
const shimPath = join12(options.binDir, SHIM_BASENAME);
|
|
17156
16655
|
const desired = buildShimContents(options.cliEntryPath);
|
|
17157
16656
|
const dryRun = options.dryRun === true;
|
|
17158
16657
|
try {
|
|
@@ -17198,10 +16697,10 @@ function writeInstallManifest(cliDir, version) {
|
|
|
17198
16697
|
description: "Local install root for portable nexus-agents (generated; do not commit)",
|
|
17199
16698
|
dependencies: { "nexus-agents": version }
|
|
17200
16699
|
};
|
|
17201
|
-
writeFileSync7(
|
|
16700
|
+
writeFileSync7(join13(cliDir, "package.json"), JSON.stringify(manifest, null, 2) + "\n", "utf-8");
|
|
17202
16701
|
}
|
|
17203
16702
|
function isAlreadyInstalled(cliDir) {
|
|
17204
|
-
return existsSync20(
|
|
16703
|
+
return existsSync20(join13(cliDir, "node_modules", "nexus-agents", "package.json"));
|
|
17205
16704
|
}
|
|
17206
16705
|
async function spawnNpmInstall(cliDir) {
|
|
17207
16706
|
await execFileAsync2("npm", ["install", "--no-audit", "--no-fund", "--silent"], {
|
|
@@ -17228,8 +16727,8 @@ async function runNpmStep(ctx) {
|
|
|
17228
16727
|
}
|
|
17229
16728
|
}
|
|
17230
16729
|
async function installPortable(options) {
|
|
17231
|
-
const cliDir =
|
|
17232
|
-
const binDir =
|
|
16730
|
+
const cliDir = join13(options.dataDir, CLI_SUBDIR);
|
|
16731
|
+
const binDir = join13(options.dataDir, BIN_SUBDIR);
|
|
17233
16732
|
const versionResolution = resolveInstallVersion(options.version);
|
|
17234
16733
|
if (!versionResolution.ok) {
|
|
17235
16734
|
return {
|
|
@@ -17250,7 +16749,7 @@ async function installPortable(options) {
|
|
|
17250
16749
|
}
|
|
17251
16750
|
const npmFailure = await runNpmStep(ctx);
|
|
17252
16751
|
if (npmFailure !== void 0) return npmFailure;
|
|
17253
|
-
const shim = writeBinShim({ binDir, cliEntryPath:
|
|
16752
|
+
const shim = writeBinShim({ binDir, cliEntryPath: join13(cliDir, CLI_ENTRY_RELATIVE) });
|
|
17254
16753
|
if (!shim.success) {
|
|
17255
16754
|
cleanupOnFailure(cliDir);
|
|
17256
16755
|
return {
|
|
@@ -17264,8 +16763,8 @@ async function installPortable(options) {
|
|
|
17264
16763
|
return { success: true, ...ctx, shim, skipped: false, error: null };
|
|
17265
16764
|
}
|
|
17266
16765
|
function uninstallPortable(options) {
|
|
17267
|
-
const cliDir =
|
|
17268
|
-
const binDir =
|
|
16766
|
+
const cliDir = join13(options.dataDir, CLI_SUBDIR);
|
|
16767
|
+
const binDir = join13(options.dataDir, BIN_SUBDIR);
|
|
17269
16768
|
const removed = [];
|
|
17270
16769
|
const notPresent = [];
|
|
17271
16770
|
const dryRun = options.dryRun === true;
|
|
@@ -17285,7 +16784,7 @@ function uninstallPortable(options) {
|
|
|
17285
16784
|
}
|
|
17286
16785
|
}
|
|
17287
16786
|
function findBinShim(dataDir) {
|
|
17288
|
-
const shimPath =
|
|
16787
|
+
const shimPath = join13(dataDir, BIN_SUBDIR, "nexus-agents");
|
|
17289
16788
|
return existsSync20(shimPath) ? shimPath : void 0;
|
|
17290
16789
|
}
|
|
17291
16790
|
|
|
@@ -17294,9 +16793,9 @@ var DEFAULT_PORTABLE_DIRNAME = ".nexus-agents";
|
|
|
17294
16793
|
var RESTRICTED_SUBDIRS = /* @__PURE__ */ new Set(["auth"]);
|
|
17295
16794
|
function resolveTargetPath(rawPath) {
|
|
17296
16795
|
if (rawPath === void 0 || rawPath === "") {
|
|
17297
|
-
return
|
|
16796
|
+
return resolve9(process.cwd(), DEFAULT_PORTABLE_DIRNAME);
|
|
17298
16797
|
}
|
|
17299
|
-
return isAbsolute3(rawPath) ? rawPath :
|
|
16798
|
+
return isAbsolute3(rawPath) ? rawPath : resolve9(process.cwd(), rawPath);
|
|
17300
16799
|
}
|
|
17301
16800
|
function isNonEmpty(dir) {
|
|
17302
16801
|
if (!existsSync21(dir)) return false;
|
|
@@ -17304,20 +16803,20 @@ function isNonEmpty(dir) {
|
|
|
17304
16803
|
if (!stat2.isDirectory()) return true;
|
|
17305
16804
|
return readdirSync(dir).length > 0;
|
|
17306
16805
|
}
|
|
17307
|
-
function ensureDir(
|
|
17308
|
-
if (existsSync21(
|
|
17309
|
-
alreadyExisted.push(
|
|
16806
|
+
function ensureDir(path18, dryRun, created, alreadyExisted, mode) {
|
|
16807
|
+
if (existsSync21(path18)) {
|
|
16808
|
+
alreadyExisted.push(path18);
|
|
17310
16809
|
return;
|
|
17311
16810
|
}
|
|
17312
16811
|
if (!dryRun) {
|
|
17313
|
-
mkdirSync5(
|
|
16812
|
+
mkdirSync5(path18, { recursive: true, ...mode !== void 0 ? { mode } : {} });
|
|
17314
16813
|
}
|
|
17315
|
-
created.push(
|
|
16814
|
+
created.push(path18);
|
|
17316
16815
|
}
|
|
17317
16816
|
function maybeUpdateGitignore(workspaceDir, portableDirName, dryRun) {
|
|
17318
|
-
const gitDir =
|
|
16817
|
+
const gitDir = join14(workspaceDir, ".git");
|
|
17319
16818
|
if (!existsSync21(gitDir)) return false;
|
|
17320
|
-
const gitignorePath =
|
|
16819
|
+
const gitignorePath = join14(workspaceDir, ".gitignore");
|
|
17321
16820
|
const entry = `${portableDirName}/`;
|
|
17322
16821
|
let existing = "";
|
|
17323
16822
|
if (existsSync21(gitignorePath)) {
|
|
@@ -17338,14 +16837,14 @@ function inspectTarget(target) {
|
|
|
17338
16837
|
if (!exists) return { exists: false, nonEmpty: false, isExistingNexusDir: false };
|
|
17339
16838
|
const nonEmpty = isNonEmpty(target);
|
|
17340
16839
|
const stat2 = statSync2(target);
|
|
17341
|
-
const isExistingNexusDir = stat2.isDirectory() && existsSync21(
|
|
16840
|
+
const isExistingNexusDir = stat2.isDirectory() && existsSync21(join14(target, "audit"));
|
|
17342
16841
|
return { exists, nonEmpty, isExistingNexusDir };
|
|
17343
16842
|
}
|
|
17344
16843
|
function createDataLayout(target, dryRun, created, alreadyExisted) {
|
|
17345
16844
|
ensureDir(target, dryRun, created, alreadyExisted);
|
|
17346
16845
|
for (const subdir of DATA_SUBDIRECTORIES) {
|
|
17347
16846
|
const mode = RESTRICTED_SUBDIRS.has(subdir) ? 448 : void 0;
|
|
17348
|
-
ensureDir(
|
|
16847
|
+
ensureDir(join14(target, subdir), dryRun, created, alreadyExisted, mode);
|
|
17349
16848
|
}
|
|
17350
16849
|
}
|
|
17351
16850
|
function makeResult(opts) {
|
|
@@ -17364,13 +16863,13 @@ function makeResult(opts) {
|
|
|
17364
16863
|
}
|
|
17365
16864
|
function applyGitignoreOption(target, options, dryRun) {
|
|
17366
16865
|
if (options.gitignore !== true) return false;
|
|
17367
|
-
const workspaceDir =
|
|
16866
|
+
const workspaceDir = resolve9(target, "..");
|
|
17368
16867
|
const portableName = target.slice(workspaceDir.length + 1);
|
|
17369
16868
|
return maybeUpdateGitignore(workspaceDir, portableName, dryRun);
|
|
17370
16869
|
}
|
|
17371
16870
|
function applyMcpConfigOption(target, options, dryRun) {
|
|
17372
16871
|
if (options.mcpConfig !== true) return void 0;
|
|
17373
|
-
const workspaceDir =
|
|
16872
|
+
const workspaceDir = resolve9(target, "..");
|
|
17374
16873
|
const shimPath = findBinShim(target);
|
|
17375
16874
|
return emitMcpConfig({
|
|
17376
16875
|
workspaceDir,
|
|
@@ -17886,7 +17385,7 @@ function startImprovementReviewScheduler(options) {
|
|
|
17886
17385
|
let running = false;
|
|
17887
17386
|
const runOnce = async () => {
|
|
17888
17387
|
try {
|
|
17889
|
-
const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-
|
|
17388
|
+
const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-WYFGNEVP.js");
|
|
17890
17389
|
const input = ImprovementReviewInputSchema2.parse({ fileIssues });
|
|
17891
17390
|
const result = await runImprovementReview2(input, { logger: logger19 });
|
|
17892
17391
|
logger19.info("Scheduled improvement_review complete", {
|
|
@@ -18307,8 +17806,8 @@ async function initUpstreamServers(gatewayConfig, server, logger19) {
|
|
|
18307
17806
|
servers: upstreamServers.length,
|
|
18308
17807
|
tools: tools.length
|
|
18309
17808
|
});
|
|
18310
|
-
const { z:
|
|
18311
|
-
const passthroughSchema =
|
|
17809
|
+
const { z: z13 } = await import("zod");
|
|
17810
|
+
const passthroughSchema = z13.looseObject({});
|
|
18312
17811
|
for (const tool of tools) {
|
|
18313
17812
|
const toolName = tool.name;
|
|
18314
17813
|
const desc = tool.description ?? `Upstream tool: ${toolName}`;
|
|
@@ -18568,21 +18067,21 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
18568
18067
|
|
|
18569
18068
|
// src/mcp/workspace-roots.ts
|
|
18570
18069
|
import { existsSync as existsSync22 } from "fs";
|
|
18571
|
-
import { join as
|
|
18070
|
+
import { join as join15 } from "path";
|
|
18572
18071
|
import { fileURLToPath } from "url";
|
|
18573
18072
|
function deriveWorkspaceRootFromRoots(roots) {
|
|
18574
18073
|
let first = null;
|
|
18575
18074
|
let gitRoot = null;
|
|
18576
18075
|
for (const root of roots) {
|
|
18577
18076
|
if (typeof root.uri !== "string" || !root.uri.startsWith("file://")) continue;
|
|
18578
|
-
let
|
|
18077
|
+
let path18;
|
|
18579
18078
|
try {
|
|
18580
|
-
|
|
18079
|
+
path18 = fileURLToPath(root.uri);
|
|
18581
18080
|
} catch {
|
|
18582
18081
|
continue;
|
|
18583
18082
|
}
|
|
18584
|
-
first ??=
|
|
18585
|
-
if (gitRoot === null && existsSync22(
|
|
18083
|
+
first ??= path18;
|
|
18084
|
+
if (gitRoot === null && existsSync22(join15(path18, ".git"))) gitRoot = path18;
|
|
18586
18085
|
}
|
|
18587
18086
|
return gitRoot ?? first;
|
|
18588
18087
|
}
|
|
@@ -18765,7 +18264,7 @@ async function executeReplTask(task, options, logger19, rl) {
|
|
|
18765
18264
|
}
|
|
18766
18265
|
}
|
|
18767
18266
|
function runOrchestratorRepl(options, logger19) {
|
|
18768
|
-
return new Promise((
|
|
18267
|
+
return new Promise((resolve13) => {
|
|
18769
18268
|
const rl = readline2.createInterface({
|
|
18770
18269
|
input: process.stdin,
|
|
18771
18270
|
output: process.stdout,
|
|
@@ -18788,7 +18287,7 @@ function runOrchestratorRepl(options, logger19) {
|
|
|
18788
18287
|
});
|
|
18789
18288
|
rl.on("close", () => {
|
|
18790
18289
|
logger19.info("Orchestrator REPL closed");
|
|
18791
|
-
|
|
18290
|
+
resolve13();
|
|
18792
18291
|
});
|
|
18793
18292
|
});
|
|
18794
18293
|
}
|
|
@@ -19939,7 +19438,7 @@ function adaptConfigToLibrary(config) {
|
|
|
19939
19438
|
}
|
|
19940
19439
|
function createBeliefPromoter() {
|
|
19941
19440
|
return async (event) => {
|
|
19942
|
-
const { getToolMemory } = await import("./tool-memory-
|
|
19441
|
+
const { getToolMemory } = await import("./tool-memory-3W5NXR4P.js");
|
|
19943
19442
|
const tm = getToolMemory();
|
|
19944
19443
|
await tm.recordBelief(
|
|
19945
19444
|
`skill:${event.name}`,
|
|
@@ -21115,7 +20614,7 @@ async function handleResearchCommand(args) {
|
|
|
21115
20614
|
}
|
|
21116
20615
|
}
|
|
21117
20616
|
async function handleRegistryCommand(args) {
|
|
21118
|
-
const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-
|
|
20617
|
+
const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-JCOZA7TM.js");
|
|
21119
20618
|
const subcommand = args.subcommand;
|
|
21120
20619
|
if (!isValidRegistrySubcommand(subcommand)) {
|
|
21121
20620
|
process.stdout.write(`${formatRegistryUsage()}
|
|
@@ -21163,7 +20662,7 @@ async function handleVerifyCommand(args) {
|
|
|
21163
20662
|
async function handleDoctorCommand(args) {
|
|
21164
20663
|
const exitCode = await doctorCommand({ fix: args.options.fix });
|
|
21165
20664
|
if (args.options.deep) {
|
|
21166
|
-
const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-
|
|
20665
|
+
const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-QTBDR3VV.js");
|
|
21167
20666
|
const diag = runDeepDiagnostics2();
|
|
21168
20667
|
process.stdout.write(formatDeepDiagnostics2(diag) + "\n");
|
|
21169
20668
|
}
|
|
@@ -21213,7 +20712,7 @@ async function runInitPortableFlow(args) {
|
|
|
21213
20712
|
return cliExit(result.success ? EXIT_CODES.SUCCESS : EXIT_CODES.SERVER_START_FAILED);
|
|
21214
20713
|
}
|
|
21215
20714
|
async function runInitOpencodeFlow(args) {
|
|
21216
|
-
const { runInitOpencode } = await import("./init-opencode-
|
|
20715
|
+
const { runInitOpencode } = await import("./init-opencode-CMGJ3TXZ.js");
|
|
21217
20716
|
const opencodePath = args.options.opencode;
|
|
21218
20717
|
if (opencodePath === void 0 || opencodePath === "") {
|
|
21219
20718
|
process.stderr.write("Error: --opencode requires a path argument.\n");
|
|
@@ -21239,7 +20738,7 @@ async function runInitOpencodeFlow(args) {
|
|
|
21239
20738
|
return cliExit(EXIT_CODES.SUCCESS);
|
|
21240
20739
|
}
|
|
21241
20740
|
async function renderOpencodeValidate(opencodePath) {
|
|
21242
|
-
const { runOpencodeValidate } = await import("./init-opencode-
|
|
20741
|
+
const { runOpencodeValidate } = await import("./init-opencode-CMGJ3TXZ.js");
|
|
21243
20742
|
const result = await runOpencodeValidate(opencodePath);
|
|
21244
20743
|
if (!result.ok) {
|
|
21245
20744
|
process.stderr.write(`init --opencode --validate: ${result.reason ?? "failed"}
|
|
@@ -21278,7 +20777,7 @@ async function handleSetupCommandAsync(args) {
|
|
|
21278
20777
|
return cliExitFromStatus(exitCode);
|
|
21279
20778
|
}
|
|
21280
20779
|
async function runCustomApiSetup(args) {
|
|
21281
|
-
const { configureCustomApi } = await import("./setup-custom-api-
|
|
20780
|
+
const { configureCustomApi } = await import("./setup-custom-api-MYN4EVT2.js");
|
|
21282
20781
|
const baseUrl = args.options.customApi;
|
|
21283
20782
|
if (baseUrl === void 0) return EXIT_CODES.SERVER_START_FAILED;
|
|
21284
20783
|
const input = {
|
|
@@ -21640,13 +21139,13 @@ function handleScaffoldCommand(args) {
|
|
|
21640
21139
|
|
|
21641
21140
|
// src/cli/visualize-summary.ts
|
|
21642
21141
|
import * as fs17 from "fs";
|
|
21643
|
-
import * as
|
|
21142
|
+
import * as path17 from "path";
|
|
21644
21143
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
21645
21144
|
function findPackageRoot(startDir) {
|
|
21646
21145
|
let dir = startDir;
|
|
21647
21146
|
for (let i = 0; i < 5; i++) {
|
|
21648
|
-
if (fs17.existsSync(
|
|
21649
|
-
const parent =
|
|
21147
|
+
if (fs17.existsSync(path17.join(dir, "package.json"))) return dir;
|
|
21148
|
+
const parent = path17.dirname(dir);
|
|
21650
21149
|
if (parent === dir) break;
|
|
21651
21150
|
dir = parent;
|
|
21652
21151
|
}
|
|
@@ -21657,7 +21156,7 @@ function countFiles(dir, pattern) {
|
|
|
21657
21156
|
let count = 0;
|
|
21658
21157
|
for (const entry of fs17.readdirSync(dir, { withFileTypes: true })) {
|
|
21659
21158
|
if (entry.isDirectory() && entry.name !== "node_modules" && entry.name !== "dist") {
|
|
21660
|
-
count += countFiles(
|
|
21159
|
+
count += countFiles(path17.join(dir, entry.name), pattern);
|
|
21661
21160
|
} else if (entry.isFile() && pattern.test(entry.name)) {
|
|
21662
21161
|
count++;
|
|
21663
21162
|
}
|
|
@@ -21666,7 +21165,7 @@ function countFiles(dir, pattern) {
|
|
|
21666
21165
|
}
|
|
21667
21166
|
function readVersion(pkgRoot) {
|
|
21668
21167
|
try {
|
|
21669
|
-
const raw = fs17.readFileSync(
|
|
21168
|
+
const raw = fs17.readFileSync(path17.join(pkgRoot, "package.json"), "utf-8");
|
|
21670
21169
|
const pkg = JSON.parse(raw);
|
|
21671
21170
|
return pkg.version ?? "unknown";
|
|
21672
21171
|
} catch {
|
|
@@ -21687,13 +21186,13 @@ var LAYER_DIRS = [
|
|
|
21687
21186
|
];
|
|
21688
21187
|
function gatherSystemSummary() {
|
|
21689
21188
|
const thisFile = fileURLToPath2(import.meta.url);
|
|
21690
|
-
const pkgRoot = findPackageRoot(
|
|
21691
|
-
const srcDir =
|
|
21189
|
+
const pkgRoot = findPackageRoot(path17.dirname(thisFile));
|
|
21190
|
+
const srcDir = path17.resolve(pkgRoot, "src");
|
|
21692
21191
|
const allTs = countFiles(srcDir, /\.ts$/);
|
|
21693
21192
|
const testTs = countFiles(srcDir, /\.test\.ts$/);
|
|
21694
21193
|
const layers = LAYER_DIRS.map(({ name, dir }) => ({
|
|
21695
21194
|
name,
|
|
21696
|
-
files: countFiles(
|
|
21195
|
+
files: countFiles(path17.join(srcDir, dir), /\.ts$/)
|
|
21697
21196
|
})).filter((l) => l.files > 0);
|
|
21698
21197
|
return {
|
|
21699
21198
|
version: readVersion(pkgRoot),
|
|
@@ -22851,7 +22350,7 @@ function handleStatusCommand2(args) {
|
|
|
22851
22350
|
|
|
22852
22351
|
// src/cli/scenario-command.ts
|
|
22853
22352
|
import { readdir as readdir4 } from "fs/promises";
|
|
22854
|
-
import { join as
|
|
22353
|
+
import { join as join17, resolve as resolve11 } from "path";
|
|
22855
22354
|
|
|
22856
22355
|
// src/testing/e2e/scenario-runner.ts
|
|
22857
22356
|
import { readFile as readFile7 } from "fs/promises";
|
|
@@ -22982,9 +22481,9 @@ function checkCircularDependencies(workflow) {
|
|
|
22982
22481
|
for (const step of workflow.steps) {
|
|
22983
22482
|
stepMap.set(step.id, step);
|
|
22984
22483
|
}
|
|
22985
|
-
const visit = (stepId,
|
|
22484
|
+
const visit = (stepId, path18) => {
|
|
22986
22485
|
if (visiting.has(stepId)) {
|
|
22987
|
-
errors.push(`Circular dependency detected: ${[...
|
|
22486
|
+
errors.push(`Circular dependency detected: ${[...path18, stepId].join(" -> ")}`);
|
|
22988
22487
|
return false;
|
|
22989
22488
|
}
|
|
22990
22489
|
if (visited.has(stepId)) return true;
|
|
@@ -22992,7 +22491,7 @@ function checkCircularDependencies(workflow) {
|
|
|
22992
22491
|
const step = stepMap.get(stepId);
|
|
22993
22492
|
if (step?.dependsOn) {
|
|
22994
22493
|
for (const dep of step.dependsOn) {
|
|
22995
|
-
if (!visit(dep, [...
|
|
22494
|
+
if (!visit(dep, [...path18, stepId])) {
|
|
22996
22495
|
return false;
|
|
22997
22496
|
}
|
|
22998
22497
|
}
|
|
@@ -23011,7 +22510,7 @@ function checkCircularDependencies(workflow) {
|
|
|
23011
22510
|
var defaultStubFactory = {
|
|
23012
22511
|
createAgentStub(agentType, action) {
|
|
23013
22512
|
return async (inputs) => {
|
|
23014
|
-
await new Promise((
|
|
22513
|
+
await new Promise((resolve13) => setTimeout(resolve13, 10));
|
|
23015
22514
|
return {
|
|
23016
22515
|
stepId: `${agentType}-${action}`,
|
|
23017
22516
|
status: "success",
|
|
@@ -23036,8 +22535,8 @@ var ScenarioRunner = class {
|
|
|
23036
22535
|
/**
|
|
23037
22536
|
* Load a scenario fixture from a YAML file.
|
|
23038
22537
|
*/
|
|
23039
|
-
async loadFixture(
|
|
23040
|
-
const content = await readFile7(
|
|
22538
|
+
async loadFixture(path18) {
|
|
22539
|
+
const content = await readFile7(path18, "utf-8");
|
|
23041
22540
|
const data = yaml7.parse(content);
|
|
23042
22541
|
return ScenarioFixtureSchema.parse(data);
|
|
23043
22542
|
}
|
|
@@ -23170,7 +22669,7 @@ function createScenarioRunner(stubFactory) {
|
|
|
23170
22669
|
}
|
|
23171
22670
|
|
|
23172
22671
|
// src/cli/scenario-command.ts
|
|
23173
|
-
var FIXTURES_DIR =
|
|
22672
|
+
var FIXTURES_DIR = resolve11(import.meta.dirname, "../testing/e2e/fixtures");
|
|
23174
22673
|
var SCENARIO_SUFFIX = ".scenario.yaml";
|
|
23175
22674
|
async function listScenarios() {
|
|
23176
22675
|
try {
|
|
@@ -23221,7 +22720,7 @@ async function handleRun(args) {
|
|
|
23221
22720
|
return cliExit(EXIT_CODES.SERVER_START_FAILED);
|
|
23222
22721
|
}
|
|
23223
22722
|
const runner = createScenarioRunner();
|
|
23224
|
-
const fixturePath =
|
|
22723
|
+
const fixturePath = join17(FIXTURES_DIR, `${name}${SCENARIO_SUFFIX}`);
|
|
23225
22724
|
try {
|
|
23226
22725
|
const fixture = await runner.loadFixture(fixturePath);
|
|
23227
22726
|
const result = await runner.run(fixture);
|
|
@@ -23776,10 +23275,10 @@ function stripRefsPrefix(ref) {
|
|
|
23776
23275
|
import { execFile as execFile4 } from "child_process";
|
|
23777
23276
|
import { promisify as promisify4 } from "util";
|
|
23778
23277
|
import { writeFile as writeFile6, mkdir as mkdir5 } from "fs/promises";
|
|
23779
|
-
import { join as
|
|
23278
|
+
import { join as join18, dirname as dirname9 } from "path";
|
|
23780
23279
|
|
|
23781
23280
|
// src/mcp/tools/improvement-remediation-capability.ts
|
|
23782
|
-
import { z as
|
|
23281
|
+
import { z as z8 } from "zod";
|
|
23783
23282
|
var PHASE_CAPABILITIES = {
|
|
23784
23283
|
research: /* @__PURE__ */ new Set(["untrusted-input", "secrets"]),
|
|
23785
23284
|
implement: /* @__PURE__ */ new Set(["repo-write", "secrets"])
|
|
@@ -23820,7 +23319,7 @@ var CapabilityLedger = class {
|
|
|
23820
23319
|
}
|
|
23821
23320
|
}
|
|
23822
23321
|
};
|
|
23823
|
-
var RemediationActionKindSchema =
|
|
23322
|
+
var RemediationActionKindSchema = z8.enum([
|
|
23824
23323
|
"investigate",
|
|
23825
23324
|
"adjust-routing",
|
|
23826
23325
|
"add-test",
|
|
@@ -23828,17 +23327,17 @@ var RemediationActionKindSchema = z9.enum([
|
|
|
23828
23327
|
"update-docs",
|
|
23829
23328
|
"fix-bug"
|
|
23830
23329
|
]);
|
|
23831
|
-
var RemediationStepSchema =
|
|
23330
|
+
var RemediationStepSchema = z8.object({
|
|
23832
23331
|
kind: RemediationActionKindSchema,
|
|
23833
|
-
description:
|
|
23332
|
+
description: z8.string().min(1).max(500),
|
|
23834
23333
|
/** Optional path hint; bounded inert string, validated for traversal at use. */
|
|
23835
|
-
targetPath:
|
|
23334
|
+
targetPath: z8.string().min(1).max(300).optional()
|
|
23836
23335
|
}).strict();
|
|
23837
|
-
var RemediationPlanSchema =
|
|
23336
|
+
var RemediationPlanSchema = z8.object({
|
|
23838
23337
|
/** Source signal key (mirrors ImprovementSignal.signalKey). */
|
|
23839
|
-
signalKey:
|
|
23338
|
+
signalKey: z8.string().min(1).max(200),
|
|
23840
23339
|
/** Signal category (mirrors SignalCategory; 'tool-fitness' #3852, 'perf-regression' #3692). */
|
|
23841
|
-
category:
|
|
23340
|
+
category: z8.enum([
|
|
23842
23341
|
"routing",
|
|
23843
23342
|
"tech-debt",
|
|
23844
23343
|
"bug",
|
|
@@ -23847,8 +23346,8 @@ var RemediationPlanSchema = z9.object({
|
|
|
23847
23346
|
"tool-fitness",
|
|
23848
23347
|
"perf-regression"
|
|
23849
23348
|
]),
|
|
23850
|
-
summary:
|
|
23851
|
-
steps:
|
|
23349
|
+
summary: z8.string().min(1).max(1e3),
|
|
23350
|
+
steps: z8.array(RemediationStepSchema).min(1).max(20)
|
|
23852
23351
|
}).strict();
|
|
23853
23352
|
function parseRemediationPlan(raw) {
|
|
23854
23353
|
const result = RemediationPlanSchema.safeParse(raw);
|
|
@@ -23935,13 +23434,13 @@ function makeGitWorktreeOps(repoRoot) {
|
|
|
23935
23434
|
};
|
|
23936
23435
|
return {
|
|
23937
23436
|
async addWorktree(branch, baseBranch) {
|
|
23938
|
-
const
|
|
23939
|
-
await git2(["worktree", "add", "-b", branch,
|
|
23940
|
-
return
|
|
23437
|
+
const path18 = join18(repoRoot, ".nexus-worktrees", branch.replace(/\//g, "_"));
|
|
23438
|
+
await git2(["worktree", "add", "-b", branch, path18, baseBranch], repoRoot);
|
|
23439
|
+
return path18;
|
|
23941
23440
|
},
|
|
23942
23441
|
async writeFileIn(worktreePath, relPath, content) {
|
|
23943
|
-
const abs =
|
|
23944
|
-
await mkdir5(
|
|
23442
|
+
const abs = join18(worktreePath, relPath);
|
|
23443
|
+
await mkdir5(dirname9(abs), { recursive: true });
|
|
23945
23444
|
await writeFile6(abs, content, "utf8");
|
|
23946
23445
|
},
|
|
23947
23446
|
async commitAll(worktreePath, message) {
|
|
@@ -23978,25 +23477,25 @@ function makeGhPrCreator() {
|
|
|
23978
23477
|
}
|
|
23979
23478
|
|
|
23980
23479
|
// src/mcp/tools/remediation-review.ts
|
|
23981
|
-
import { z as
|
|
23480
|
+
import { z as z9 } from "zod";
|
|
23982
23481
|
function soakRefOf(record) {
|
|
23983
23482
|
return `${record.signalKey}::${record.timestamp}`;
|
|
23984
23483
|
}
|
|
23985
|
-
var ReviewRecordSchema =
|
|
23484
|
+
var ReviewRecordSchema = z9.object({
|
|
23986
23485
|
/** Reference to the reviewed soak selection (`signalKey::timestamp`). */
|
|
23987
|
-
soakRef:
|
|
23486
|
+
soakRef: z9.string(),
|
|
23988
23487
|
/** ISO-8601 time the review was recorded. */
|
|
23989
|
-
reviewedAt:
|
|
23488
|
+
reviewedAt: z9.string(),
|
|
23990
23489
|
/** Always true — a persisted record is, by construction, a review. */
|
|
23991
|
-
reviewed:
|
|
23490
|
+
reviewed: z9.literal(true),
|
|
23992
23491
|
/** Whether the evaluator assessed the selection SOUND. */
|
|
23993
|
-
sound:
|
|
23492
|
+
sound: z9.boolean(),
|
|
23994
23493
|
/** Named evaluator who performed the review (required — the gate's named-evaluator criterion). */
|
|
23995
|
-
evaluator:
|
|
23494
|
+
evaluator: z9.string().min(1),
|
|
23996
23495
|
/** Named owner accepting enforcement, recorded at sign-off time (optional per record). */
|
|
23997
|
-
owner:
|
|
23496
|
+
owner: z9.string().min(1).optional(),
|
|
23998
23497
|
/** Free-text note (secret-scrubbed). */
|
|
23999
|
-
note:
|
|
23498
|
+
note: z9.string().optional()
|
|
24000
23499
|
});
|
|
24001
23500
|
var REVIEW_MAX_RECORDS = 1e4;
|
|
24002
23501
|
function getRemediationReviewFile() {
|
|
@@ -24141,14 +23640,14 @@ import { createHash as createHash4 } from "crypto";
|
|
|
24141
23640
|
import { createHash as createHash3 } from "crypto";
|
|
24142
23641
|
import { mkdtempSync, mkdirSync as mkdirSync6, writeFileSync as writeFileSync8, rmSync as rmSync2, realpathSync as realpathSync2 } from "fs";
|
|
24143
23642
|
import { tmpdir } from "os";
|
|
24144
|
-
import { dirname as
|
|
23643
|
+
import { dirname as dirname11, join as join19 } from "path";
|
|
24145
23644
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
24146
|
-
import { z as
|
|
23645
|
+
import { z as z11 } from "zod";
|
|
24147
23646
|
|
|
24148
23647
|
// src/mcp/tools/codepr-guards.ts
|
|
24149
23648
|
import { realpathSync } from "fs";
|
|
24150
|
-
import { isAbsolute as isAbsolute4, resolve as
|
|
24151
|
-
import { z as
|
|
23649
|
+
import { isAbsolute as isAbsolute4, resolve as resolve12, relative as relative4, sep as sep3, dirname as dirname10, basename as basename4 } from "path";
|
|
23650
|
+
import { z as z10 } from "zod";
|
|
24152
23651
|
function deny(reason, detail) {
|
|
24153
23652
|
return { ok: false, reason, detail };
|
|
24154
23653
|
}
|
|
@@ -24169,7 +23668,7 @@ function confinePath(worktreeRoot, candidatePath, realpath = realpathSync) {
|
|
|
24169
23668
|
} catch {
|
|
24170
23669
|
return deny("path_escape", "worktreeRoot could not be resolved (fail-closed)");
|
|
24171
23670
|
}
|
|
24172
|
-
const joined = isAbsolute4(candidatePath) ? candidatePath :
|
|
23671
|
+
const joined = isAbsolute4(candidatePath) ? candidatePath : resolve12(resolvedRoot, candidatePath);
|
|
24173
23672
|
const reassembled = resolveNewFilePath(joined, realpath);
|
|
24174
23673
|
if (reassembled === void 0) {
|
|
24175
23674
|
return deny("path_escape", "candidate path could not be resolved (fail-closed)");
|
|
@@ -24188,17 +23687,17 @@ function resolveNewFilePath(joined, realpath) {
|
|
|
24188
23687
|
break;
|
|
24189
23688
|
} catch (err2) {
|
|
24190
23689
|
if (errnoCode(err2) !== "ENOENT") return void 0;
|
|
24191
|
-
const parent =
|
|
23690
|
+
const parent = dirname10(existing);
|
|
24192
23691
|
if (parent === existing) return void 0;
|
|
24193
|
-
trailing.push(
|
|
23692
|
+
trailing.push(basename4(existing));
|
|
24194
23693
|
existing = parent;
|
|
24195
23694
|
}
|
|
24196
23695
|
}
|
|
24197
|
-
return trailing.length === 0 ? existing :
|
|
23696
|
+
return trailing.length === 0 ? existing : resolve12(existing, ...trailing.reverse());
|
|
24198
23697
|
}
|
|
24199
23698
|
function isWithin(parent, child) {
|
|
24200
23699
|
if (child === parent) return true;
|
|
24201
|
-
const rel =
|
|
23700
|
+
const rel = relative4(parent, child);
|
|
24202
23701
|
if (rel === "") return true;
|
|
24203
23702
|
if (rel === ".." || rel.startsWith(".." + sep3)) return false;
|
|
24204
23703
|
if (isAbsolute4(rel)) return false;
|
|
@@ -24294,11 +23793,11 @@ function classifyPath(relPath) {
|
|
|
24294
23793
|
}
|
|
24295
23794
|
return { sensitive: false };
|
|
24296
23795
|
}
|
|
24297
|
-
var BlastRadiusLimitsSchema =
|
|
23796
|
+
var BlastRadiusLimitsSchema = z10.object({
|
|
24298
23797
|
/** Max number of files the change may touch. Default 20. */
|
|
24299
|
-
maxFiles:
|
|
23798
|
+
maxFiles: z10.number().int().positive().default(20),
|
|
24300
23799
|
/** Max total changed lines (added + removed across all files). Default 400. */
|
|
24301
|
-
maxLines:
|
|
23800
|
+
maxLines: z10.number().int().positive().default(400)
|
|
24302
23801
|
}).strict();
|
|
24303
23802
|
var DEFAULT_BLAST_RADIUS_LIMITS = Object.freeze(
|
|
24304
23803
|
BlastRadiusLimitsSchema.parse({})
|
|
@@ -24376,13 +23875,13 @@ function auditAutonomousEvent(logger19, record) {
|
|
|
24376
23875
|
}
|
|
24377
23876
|
return { ok: true };
|
|
24378
23877
|
}
|
|
24379
|
-
var ResourceBudgetLimitsSchema =
|
|
23878
|
+
var ResourceBudgetLimitsSchema = z10.object({
|
|
24380
23879
|
/** Wall-clock ceiling in ms. Default 600000 (10 min). */
|
|
24381
|
-
maxWallClockMs:
|
|
23880
|
+
maxWallClockMs: z10.number().int().positive().default(6e5),
|
|
24382
23881
|
/** Token ceiling. Default 200000. */
|
|
24383
|
-
maxTokens:
|
|
23882
|
+
maxTokens: z10.number().int().positive().default(2e5),
|
|
24384
23883
|
/** Tool-call ceiling. Default 200. */
|
|
24385
|
-
maxToolCalls:
|
|
23884
|
+
maxToolCalls: z10.number().int().positive().default(200)
|
|
24386
23885
|
}).strict();
|
|
24387
23886
|
var DEFAULT_RESOURCE_BUDGET_LIMITS = Object.freeze(
|
|
24388
23887
|
ResourceBudgetLimitsSchema.parse({})
|
|
@@ -24442,19 +23941,19 @@ function runGuard(name, fn) {
|
|
|
24442
23941
|
}
|
|
24443
23942
|
|
|
24444
23943
|
// src/mcp/tools/codepr-orchestrator.ts
|
|
24445
|
-
var ProposedChangeSchema =
|
|
23944
|
+
var ProposedChangeSchema = z11.object({
|
|
24446
23945
|
/** Repo-relative path the change would write. */
|
|
24447
|
-
relPath:
|
|
23946
|
+
relPath: z11.string().min(1),
|
|
24448
23947
|
/** The full new file content. */
|
|
24449
|
-
newContent:
|
|
23948
|
+
newContent: z11.string()
|
|
24450
23949
|
}).strict();
|
|
24451
|
-
var CodePrRunInputSchema =
|
|
23950
|
+
var CodePrRunInputSchema = z11.object({
|
|
24452
23951
|
/** Correlates all audit events for this run. */
|
|
24453
|
-
runId:
|
|
23952
|
+
runId: z11.string().min(1),
|
|
24454
23953
|
/** Hash of the source signal (fitness/improvement) that triggered the run. */
|
|
24455
|
-
sourceSignalHash:
|
|
23954
|
+
sourceSignalHash: z11.string().min(1),
|
|
24456
23955
|
/** The proposed change set. */
|
|
24457
|
-
changes:
|
|
23956
|
+
changes: z11.array(ProposedChangeSchema).min(1)
|
|
24458
23957
|
}).strict();
|
|
24459
23958
|
var ORCHESTRATOR_USAGE_ZERO = { wallClockMs: 0, tokens: 0, toolCalls: 0 };
|
|
24460
23959
|
function sha256(s) {
|
|
@@ -24471,9 +23970,9 @@ function parseNumstat(numstat) {
|
|
|
24471
23970
|
if (parts.length < 3) continue;
|
|
24472
23971
|
const added = parts[0] === "-" ? 0 : Number.parseInt(parts[0] ?? "0", 10);
|
|
24473
23972
|
const removed = parts[1] === "-" ? 0 : Number.parseInt(parts[1] ?? "0", 10);
|
|
24474
|
-
const
|
|
23973
|
+
const path18 = parts.slice(2).join(" ");
|
|
24475
23974
|
files.push({
|
|
24476
|
-
path:
|
|
23975
|
+
path: path18,
|
|
24477
23976
|
addedLines: Number.isFinite(added) ? added : 0,
|
|
24478
23977
|
removedLines: Number.isFinite(removed) ? removed : 0
|
|
24479
23978
|
});
|
|
@@ -24528,7 +24027,7 @@ function applyChanges(worktreeRoot, run) {
|
|
|
24528
24027
|
for (const change of run.changes) {
|
|
24529
24028
|
const confined = confinePath(worktreeRoot, change.relPath);
|
|
24530
24029
|
if (!confined.ok) throw new Error(`apply: ${confined.detail}`);
|
|
24531
|
-
mkdirSync6(
|
|
24030
|
+
mkdirSync6(dirname11(confined.resolvedPath), { recursive: true });
|
|
24532
24031
|
writeFileSync8(confined.resolvedPath, change.newContent);
|
|
24533
24032
|
}
|
|
24534
24033
|
}
|
|
@@ -24590,8 +24089,8 @@ function runGuardsAndPlan(args, logger19) {
|
|
|
24590
24089
|
function runInWorktree(run, logger19, options, handle) {
|
|
24591
24090
|
const fault = options.faultInjector;
|
|
24592
24091
|
const repoRoot = options.repoRoot ?? process.cwd();
|
|
24593
|
-
handle.tempParent = realpathSync2(mkdtempSync(
|
|
24594
|
-
handle.worktreeRoot =
|
|
24092
|
+
handle.tempParent = realpathSync2(mkdtempSync(join19(tmpdir(), "codepr-orchestrator-")));
|
|
24093
|
+
handle.worktreeRoot = join19(handle.tempParent, "wt");
|
|
24595
24094
|
git(repoRoot, ["worktree", "add", "--detach", handle.worktreeRoot]);
|
|
24596
24095
|
fault?.("after-worktree");
|
|
24597
24096
|
const precheck = precheckChanges(handle.worktreeRoot, run, logger19);
|
|
@@ -24657,20 +24156,20 @@ function planCodePrRun(input, logger19, options = {}) {
|
|
|
24657
24156
|
}
|
|
24658
24157
|
|
|
24659
24158
|
// src/mcp/tools/codepr-soak-store.ts
|
|
24660
|
-
import { z as
|
|
24661
|
-
var CodePrSoakRecordSchema =
|
|
24159
|
+
import { z as z12 } from "zod";
|
|
24160
|
+
var CodePrSoakRecordSchema = z12.object({
|
|
24662
24161
|
/** ISO-8601 capture time. */
|
|
24663
|
-
timestamp:
|
|
24162
|
+
timestamp: z12.string(),
|
|
24664
24163
|
/** Correlates the data point to the dry-run's orchestrator runId. */
|
|
24665
|
-
runId:
|
|
24164
|
+
runId: z12.string(),
|
|
24666
24165
|
/** The improvement signal's stable key that triggered the dry-run. */
|
|
24667
|
-
signalKey:
|
|
24166
|
+
signalKey: z12.string(),
|
|
24668
24167
|
/** True when the dry-run plan succeeded with ZERO guard denial. */
|
|
24669
|
-
green:
|
|
24168
|
+
green: z12.boolean(),
|
|
24670
24169
|
/** The guard denial reason when `green` is false; omitted for a green plan. */
|
|
24671
|
-
denialReason:
|
|
24170
|
+
denialReason: z12.string().optional(),
|
|
24672
24171
|
/** Files the dry-run plan touched (0 on denial before the diff was realized). */
|
|
24673
|
-
filesTouched:
|
|
24172
|
+
filesTouched: z12.number().int().nonnegative()
|
|
24674
24173
|
}).strict();
|
|
24675
24174
|
var CODEPR_SOAK_MAX_RECORDS = 1e4;
|
|
24676
24175
|
function getCodePrSoakFile() {
|
|
@@ -24736,11 +24235,11 @@ function deriveProposedChanges(plan) {
|
|
|
24736
24235
|
const changes = [];
|
|
24737
24236
|
for (const step of plan.steps) {
|
|
24738
24237
|
if (!CODE_TOUCHING_KINDS.has(step.kind)) continue;
|
|
24739
|
-
const
|
|
24740
|
-
if (seen.has(
|
|
24741
|
-
seen.add(
|
|
24238
|
+
const path18 = step.targetPath !== void 0 && step.targetPath !== "" ? step.targetPath : placeholderPathFor(plan, step.kind);
|
|
24239
|
+
if (seen.has(path18)) continue;
|
|
24240
|
+
seen.add(path18);
|
|
24742
24241
|
changes.push({
|
|
24743
|
-
relPath:
|
|
24242
|
+
relPath: path18,
|
|
24744
24243
|
newContent: `// codepr soak dry-run placeholder for ${plan.signalKey} (${step.kind})
|
|
24745
24244
|
`
|
|
24746
24245
|
});
|
|
@@ -25016,11 +24515,11 @@ var PROTECTED_PATH_FRAGMENTS = [
|
|
|
25016
24515
|
"secret",
|
|
25017
24516
|
"credential"
|
|
25018
24517
|
];
|
|
25019
|
-
function normalize2(
|
|
25020
|
-
return
|
|
24518
|
+
function normalize2(path18) {
|
|
24519
|
+
return path18.replace(/\\/g, "/").replace(/^\.\//, "").toLowerCase();
|
|
25021
24520
|
}
|
|
25022
|
-
function isProtectedPath(
|
|
25023
|
-
const p = normalize2(
|
|
24521
|
+
function isProtectedPath(path18) {
|
|
24522
|
+
const p = normalize2(path18);
|
|
25024
24523
|
return PROTECTED_PATH_FRAGMENTS.some((frag) => p.includes(frag));
|
|
25025
24524
|
}
|
|
25026
24525
|
function planTouchesProtectedPath(plan) {
|
|
@@ -25460,16 +24959,16 @@ async function handleRemediationReviewCommand(args) {
|
|
|
25460
24959
|
// src/cli/migrate-command.ts
|
|
25461
24960
|
import { cpSync, existsSync as existsSync24, mkdirSync as mkdirSync7, readdirSync as readdirSync3 } from "fs";
|
|
25462
24961
|
import { homedir } from "os";
|
|
25463
|
-
import { join as
|
|
24962
|
+
import { join as join20 } from "path";
|
|
25464
24963
|
var logger18 = createLogger({ component: "migrate-command" });
|
|
25465
|
-
var HOMEDIR_DEFAULT_BASE =
|
|
24964
|
+
var HOMEDIR_DEFAULT_BASE = join20(homedir(), ".nexus-agents");
|
|
25466
24965
|
function countItems(dir) {
|
|
25467
24966
|
if (!existsSync24(dir)) return 0;
|
|
25468
24967
|
try {
|
|
25469
24968
|
const entries = readdirSync3(dir, { withFileTypes: true });
|
|
25470
24969
|
let n = 0;
|
|
25471
24970
|
for (const e of entries) {
|
|
25472
|
-
const p =
|
|
24971
|
+
const p = join20(dir, e.name);
|
|
25473
24972
|
if (e.isDirectory()) {
|
|
25474
24973
|
n += countItems(p);
|
|
25475
24974
|
} else {
|
|
@@ -25524,8 +25023,8 @@ function checkEarlyExits(fromBase, toBase, dryRun) {
|
|
|
25524
25023
|
return null;
|
|
25525
25024
|
}
|
|
25526
25025
|
function planAndExecuteEntry(name, fromBase, toBase, perRepoSet, dryRun) {
|
|
25527
|
-
const source =
|
|
25528
|
-
const target =
|
|
25026
|
+
const source = join20(fromBase, name);
|
|
25027
|
+
const target = join20(toBase, name);
|
|
25529
25028
|
if (!perRepoSet.has(name)) {
|
|
25530
25029
|
return { subdir: name, status: "skipped-not-per-repo", source, target: "", itemsCopied: 0 };
|
|
25531
25030
|
}
|
|
@@ -25545,7 +25044,7 @@ function planAndExecuteEntry(name, fromBase, toBase, perRepoSet, dryRun) {
|
|
|
25545
25044
|
function resolveDefaultTarget(cwd) {
|
|
25546
25045
|
const repoRoot = findRepoRoot(cwd);
|
|
25547
25046
|
if (repoRoot === null) return null;
|
|
25548
|
-
return
|
|
25047
|
+
return join20(repoRoot, ".nexus-agents");
|
|
25549
25048
|
}
|
|
25550
25049
|
function formatMigrationResult(result) {
|
|
25551
25050
|
if (!result.success) {
|
|
@@ -25588,7 +25087,7 @@ async function handleMigrateCommand(args) {
|
|
|
25588
25087
|
|
|
25589
25088
|
// src/cli/first-run-hint.ts
|
|
25590
25089
|
import { existsSync as existsSync25, mkdirSync as mkdirSync8, writeFileSync as writeFileSync9 } from "fs";
|
|
25591
|
-
import { dirname as
|
|
25090
|
+
import { dirname as dirname12 } from "path";
|
|
25592
25091
|
var HINT_SUPPRESSED_COMMANDS = /* @__PURE__ */ new Set(["version", "help", "setup"]);
|
|
25593
25092
|
function firstRunMarkerPath() {
|
|
25594
25093
|
return nexusSharedPath(".first-run-done");
|
|
@@ -25605,7 +25104,7 @@ function maybeShowFirstRunHint(command) {
|
|
|
25605
25104
|
"\x1B[36mnexus-agents\x1B[0m: First time? Run \x1B[1mnexus-agents setup\x1B[0m to configure.\n (This one-time hint is now dismissed.)\n"
|
|
25606
25105
|
);
|
|
25607
25106
|
try {
|
|
25608
|
-
mkdirSync8(
|
|
25107
|
+
mkdirSync8(dirname12(marker), { recursive: true });
|
|
25609
25108
|
writeFileSync9(marker, `${(/* @__PURE__ */ new Date()).toISOString()}
|
|
25610
25109
|
`, { flag: "w" });
|
|
25611
25110
|
} catch {
|