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