projscan 4.3.1 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (699) hide show
  1. package/CONTRIBUTING.md +5 -1
  2. package/PRIVACY.md +1 -0
  3. package/README.md +278 -231
  4. package/THIRD-PARTY-NOTICES.md +31 -31
  5. package/dist/analyzers/architectureCheck.js.map +1 -1
  6. package/dist/analyzers/crossPackageImportCheck.js +3 -2
  7. package/dist/analyzers/crossPackageImportCheck.js.map +1 -1
  8. package/dist/analyzers/deadCodeCheck.js +10 -2
  9. package/dist/analyzers/deadCodeCheck.js.map +1 -1
  10. package/dist/analyzers/dependencyRiskCheck.js +1 -5
  11. package/dist/analyzers/dependencyRiskCheck.js.map +1 -1
  12. package/dist/analyzers/eslintCheck.js +3 -1
  13. package/dist/analyzers/eslintCheck.js.map +1 -1
  14. package/dist/analyzers/prettierCheck.js +16 -3
  15. package/dist/analyzers/prettierCheck.js.map +1 -1
  16. package/dist/analyzers/pythonDependencyRiskCheck.js +4 -17
  17. package/dist/analyzers/pythonDependencyRiskCheck.js.map +1 -1
  18. package/dist/analyzers/pythonLinterCheck.js +2 -12
  19. package/dist/analyzers/pythonLinterCheck.js.map +1 -1
  20. package/dist/analyzers/securityCheck.js +26 -9
  21. package/dist/analyzers/securityCheck.js.map +1 -1
  22. package/dist/analyzers/supplyChainCheck.js +6 -2
  23. package/dist/analyzers/supplyChainCheck.js.map +1 -1
  24. package/dist/analyzers/testCheck.js +10 -1
  25. package/dist/analyzers/testCheck.js.map +1 -1
  26. package/dist/analyzers/unusedDependencyCheck.js +8 -8
  27. package/dist/analyzers/unusedDependencyCheck.js.map +1 -1
  28. package/dist/cli/_shared.d.ts +2 -1
  29. package/dist/cli/_shared.js +14 -2
  30. package/dist/cli/_shared.js.map +1 -1
  31. package/dist/cli/commands/agentBrief.js +7 -1
  32. package/dist/cli/commands/agentBrief.js.map +1 -1
  33. package/dist/cli/commands/analyze.js +12 -2
  34. package/dist/cli/commands/analyze.js.map +1 -1
  35. package/dist/cli/commands/applyFix.js +1 -1
  36. package/dist/cli/commands/applyFix.js.map +1 -1
  37. package/dist/cli/commands/audit.js +4 -2
  38. package/dist/cli/commands/audit.js.map +1 -1
  39. package/dist/cli/commands/badge.js.map +1 -1
  40. package/dist/cli/commands/bugHunt.js +2 -2
  41. package/dist/cli/commands/bugHunt.js.map +1 -1
  42. package/dist/cli/commands/ci.js +11 -0
  43. package/dist/cli/commands/ci.js.map +1 -1
  44. package/dist/cli/commands/claim.js +3 -3
  45. package/dist/cli/commands/claim.js.map +1 -1
  46. package/dist/cli/commands/collision.js +4 -2
  47. package/dist/cli/commands/collision.js.map +1 -1
  48. package/dist/cli/commands/coordinate.js +4 -2
  49. package/dist/cli/commands/coordinate.js.map +1 -1
  50. package/dist/cli/commands/coupling.js.map +1 -1
  51. package/dist/cli/commands/coverage.js.map +1 -1
  52. package/dist/cli/commands/dataflow.js.map +1 -1
  53. package/dist/cli/commands/dependencies.js +1 -1
  54. package/dist/cli/commands/dependencies.js.map +1 -1
  55. package/dist/cli/commands/diff.js.map +1 -1
  56. package/dist/cli/commands/doctor.js +11 -0
  57. package/dist/cli/commands/doctor.js.map +1 -1
  58. package/dist/cli/commands/dogfood.js +30 -5
  59. package/dist/cli/commands/dogfood.js.map +1 -1
  60. package/dist/cli/commands/evidencePack.js.map +1 -1
  61. package/dist/cli/commands/explainIssue.js +1 -1
  62. package/dist/cli/commands/explainIssue.js.map +1 -1
  63. package/dist/cli/commands/feedback.js +19 -5
  64. package/dist/cli/commands/feedback.js.map +1 -1
  65. package/dist/cli/commands/file.js +1 -1
  66. package/dist/cli/commands/file.js.map +1 -1
  67. package/dist/cli/commands/fix.js.map +1 -1
  68. package/dist/cli/commands/fixSuggest.js +12 -4
  69. package/dist/cli/commands/fixSuggest.js.map +1 -1
  70. package/dist/cli/commands/hotspots.js.map +1 -1
  71. package/dist/cli/commands/impact.js +1 -1
  72. package/dist/cli/commands/impact.js.map +1 -1
  73. package/dist/cli/commands/init.js +13 -5
  74. package/dist/cli/commands/init.js.map +1 -1
  75. package/dist/cli/commands/installHook.js +2 -2
  76. package/dist/cli/commands/installHook.js.map +1 -1
  77. package/dist/cli/commands/mcp.js.map +1 -1
  78. package/dist/cli/commands/memory.js +5 -2
  79. package/dist/cli/commands/memory.js.map +1 -1
  80. package/dist/cli/commands/mergeRisk.js +1 -1
  81. package/dist/cli/commands/mergeRisk.js.map +1 -1
  82. package/dist/cli/commands/missionProof.js +13 -12
  83. package/dist/cli/commands/missionProof.js.map +1 -1
  84. package/dist/cli/commands/outdated.js +1 -1
  85. package/dist/cli/commands/outdated.js.map +1 -1
  86. package/dist/cli/commands/plugin.js +10 -6
  87. package/dist/cli/commands/plugin.js.map +1 -1
  88. package/dist/cli/commands/prDiff.js +1 -1
  89. package/dist/cli/commands/prDiff.js.map +1 -1
  90. package/dist/cli/commands/preflight.js +1 -5
  91. package/dist/cli/commands/preflight.js.map +1 -1
  92. package/dist/cli/commands/privacyCheck.js +3 -1
  93. package/dist/cli/commands/privacyCheck.js.map +1 -1
  94. package/dist/cli/commands/qualityScorecard.js.map +1 -1
  95. package/dist/cli/commands/recipes.js.map +1 -1
  96. package/dist/cli/commands/regressionPlan.js.map +1 -1
  97. package/dist/cli/commands/releaseTrain.js.map +1 -1
  98. package/dist/cli/commands/review.js +1 -1
  99. package/dist/cli/commands/review.js.map +1 -1
  100. package/dist/cli/commands/route.js.map +1 -1
  101. package/dist/cli/commands/search.js +5 -2
  102. package/dist/cli/commands/search.js.map +1 -1
  103. package/dist/cli/commands/semanticGraph.js.map +1 -1
  104. package/dist/cli/commands/session.js +2 -2
  105. package/dist/cli/commands/session.js.map +1 -1
  106. package/dist/cli/commands/start.js +3 -1177
  107. package/dist/cli/commands/start.js.map +1 -1
  108. package/dist/cli/commands/startAction.d.ts +36 -0
  109. package/dist/cli/commands/startAction.js +70 -0
  110. package/dist/cli/commands/startAction.js.map +1 -0
  111. package/dist/cli/commands/startConsole.d.ts +7 -0
  112. package/dist/cli/commands/startConsole.js +309 -0
  113. package/dist/cli/commands/startConsole.js.map +1 -0
  114. package/dist/cli/commands/startMissionBundle.d.ts +41 -0
  115. package/dist/cli/commands/startMissionBundle.js +645 -0
  116. package/dist/cli/commands/startMissionBundle.js.map +1 -0
  117. package/dist/cli/commands/startOutput.d.ts +31 -0
  118. package/dist/cli/commands/startOutput.js +232 -0
  119. package/dist/cli/commands/startOutput.js.map +1 -0
  120. package/dist/cli/commands/startShortcuts.d.ts +26 -0
  121. package/dist/cli/commands/startShortcuts.js +117 -0
  122. package/dist/cli/commands/startShortcuts.js.map +1 -0
  123. package/dist/cli/commands/telemetry.js +2 -1
  124. package/dist/cli/commands/telemetry.js.map +1 -1
  125. package/dist/cli/commands/trial.js +19 -4
  126. package/dist/cli/commands/trial.js.map +1 -1
  127. package/dist/cli/commands/understand.js +3 -1
  128. package/dist/cli/commands/understand.js.map +1 -1
  129. package/dist/cli/commands/upgrade.js +1 -1
  130. package/dist/cli/commands/upgrade.js.map +1 -1
  131. package/dist/cli/commands/watch.js +1 -1
  132. package/dist/cli/commands/watch.js.map +1 -1
  133. package/dist/cli/commands/workplan.js.map +1 -1
  134. package/dist/cli/commands/workspace.js +1 -1
  135. package/dist/cli/commands/workspace.js.map +1 -1
  136. package/dist/cli/commands/workspaces.js +1 -1
  137. package/dist/cli/commands/workspaces.js.map +1 -1
  138. package/dist/cli/index.js +2 -117
  139. package/dist/cli/index.js.map +1 -1
  140. package/dist/cli/registerCommands.d.ts +4 -0
  141. package/dist/cli/registerCommands.js +125 -0
  142. package/dist/cli/registerCommands.js.map +1 -0
  143. package/dist/core/adoption.d.ts +2 -1
  144. package/dist/core/adoption.js +40 -13
  145. package/dist/core/adoption.js.map +1 -1
  146. package/dist/core/agentBrief.js +19 -6
  147. package/dist/core/agentBrief.js.map +1 -1
  148. package/dist/core/applyFix.js.map +1 -1
  149. package/dist/core/ast.d.ts +5 -0
  150. package/dist/core/ast.js +38 -20
  151. package/dist/core/ast.js.map +1 -1
  152. package/dist/core/auditRunner.js.map +1 -1
  153. package/dist/core/bugHunt.js +119 -17
  154. package/dist/core/bugHunt.js.map +1 -1
  155. package/dist/core/claims.js +5 -2
  156. package/dist/core/claims.js.map +1 -1
  157. package/dist/core/codeGraph.js +10 -0
  158. package/dist/core/codeGraph.js.map +1 -1
  159. package/dist/core/codeGraphReexports.d.ts +9 -0
  160. package/dist/core/codeGraphReexports.js +59 -0
  161. package/dist/core/codeGraphReexports.js.map +1 -0
  162. package/dist/core/collisionDetector.js +14 -4
  163. package/dist/core/collisionDetector.js.map +1 -1
  164. package/dist/core/coordination.js +4 -6
  165. package/dist/core/coordination.js.map +1 -1
  166. package/dist/core/couplingAnalyzer.d.ts +2 -1
  167. package/dist/core/couplingAnalyzer.js.map +1 -1
  168. package/dist/core/coverageParser.js.map +1 -1
  169. package/dist/core/dataflow.js +13 -3
  170. package/dist/core/dataflow.js.map +1 -1
  171. package/dist/core/dataflowFilters.js +8 -3
  172. package/dist/core/dataflowFilters.js.map +1 -1
  173. package/dist/core/dependencyAnalyzer.js +4 -1
  174. package/dist/core/dependencyAnalyzer.js.map +1 -1
  175. package/dist/core/dogfood.d.ts +1 -1
  176. package/dist/core/dogfood.js +39 -5
  177. package/dist/core/dogfood.js.map +1 -1
  178. package/dist/core/embeddings.js.map +1 -1
  179. package/dist/core/evidenceComment.js +34 -12
  180. package/dist/core/evidenceComment.js.map +1 -1
  181. package/dist/core/explainIssue.js +1 -2
  182. package/dist/core/explainIssue.js.map +1 -1
  183. package/dist/core/feedback.d.ts +1 -1
  184. package/dist/core/feedback.js +15 -4
  185. package/dist/core/feedback.js.map +1 -1
  186. package/dist/core/fileInspector.js +8 -2
  187. package/dist/core/fileInspector.js.map +1 -1
  188. package/dist/core/fixFirst.d.ts +3 -1
  189. package/dist/core/fixFirst.js +17 -4
  190. package/dist/core/fixFirst.js.map +1 -1
  191. package/dist/core/fixSuggest.js +20 -12
  192. package/dist/core/fixSuggest.js.map +1 -1
  193. package/dist/core/frameworkDetector.js +5 -3
  194. package/dist/core/frameworkDetector.js.map +1 -1
  195. package/dist/core/frameworkSources.d.ts +1 -1
  196. package/dist/core/frameworkSources.js +114 -4
  197. package/dist/core/frameworkSources.js.map +1 -1
  198. package/dist/core/graphCorpus.d.ts +1 -1
  199. package/dist/core/graphCorpus.js +9 -1
  200. package/dist/core/graphCorpus.js.map +1 -1
  201. package/dist/core/graphQuery.js.map +1 -1
  202. package/dist/core/hotspotAnalyzer.js +26 -6
  203. package/dist/core/hotspotAnalyzer.js.map +1 -1
  204. package/dist/core/impact.d.ts +1 -1
  205. package/dist/core/impact.js.map +1 -1
  206. package/dist/core/importGraph.js.map +1 -1
  207. package/dist/core/indexCache.js +2 -1
  208. package/dist/core/indexCache.js.map +1 -1
  209. package/dist/core/intent.d.ts +1 -1
  210. package/dist/core/intent.js +143 -46
  211. package/dist/core/intent.js.map +1 -1
  212. package/dist/core/intentRouter.js +5467 -445
  213. package/dist/core/intentRouter.js.map +1 -1
  214. package/dist/core/issueEngine.js +1 -1
  215. package/dist/core/issueEngine.js.map +1 -1
  216. package/dist/core/languageDetector.js +1 -9
  217. package/dist/core/languageDetector.js.map +1 -1
  218. package/dist/core/languages/cppAdapter.js +3 -1
  219. package/dist/core/languages/cppAdapter.js.map +1 -1
  220. package/dist/core/languages/cppExports.js +6 -1
  221. package/dist/core/languages/cppExports.js.map +1 -1
  222. package/dist/core/languages/cppFunctions.js +3 -1
  223. package/dist/core/languages/cppFunctions.js.map +1 -1
  224. package/dist/core/languages/csharpAdapter.js.map +1 -1
  225. package/dist/core/languages/csharpFunctions.js +3 -1
  226. package/dist/core/languages/csharpFunctions.js.map +1 -1
  227. package/dist/core/languages/csharpImports.js +2 -1
  228. package/dist/core/languages/csharpImports.js.map +1 -1
  229. package/dist/core/languages/goAdapter.js.map +1 -1
  230. package/dist/core/languages/goExports.js.map +1 -1
  231. package/dist/core/languages/goFunctions.js +9 -3
  232. package/dist/core/languages/goFunctions.js.map +1 -1
  233. package/dist/core/languages/javaAdapter.js +1 -2
  234. package/dist/core/languages/javaAdapter.js.map +1 -1
  235. package/dist/core/languages/javaFunctions.js +6 -2
  236. package/dist/core/languages/javaFunctions.js.map +1 -1
  237. package/dist/core/languages/javascriptAdapter.js +43 -8
  238. package/dist/core/languages/javascriptAdapter.js.map +1 -1
  239. package/dist/core/languages/kotlinAdapter.js +5 -2
  240. package/dist/core/languages/kotlinAdapter.js.map +1 -1
  241. package/dist/core/languages/kotlinFunctions.js +5 -6
  242. package/dist/core/languages/kotlinFunctions.js.map +1 -1
  243. package/dist/core/languages/kotlinImports.js +3 -1
  244. package/dist/core/languages/kotlinImports.js.map +1 -1
  245. package/dist/core/languages/kotlinManifests.js +7 -1
  246. package/dist/core/languages/kotlinManifests.js.map +1 -1
  247. package/dist/core/languages/phpAdapter.js +4 -1
  248. package/dist/core/languages/phpAdapter.js.map +1 -1
  249. package/dist/core/languages/phpExports.js.map +1 -1
  250. package/dist/core/languages/phpFunctions.js +18 -6
  251. package/dist/core/languages/phpFunctions.js.map +1 -1
  252. package/dist/core/languages/phpManifests.js.map +1 -1
  253. package/dist/core/languages/pythonAdapter.js.map +1 -1
  254. package/dist/core/languages/pythonFunctions.js +9 -3
  255. package/dist/core/languages/pythonFunctions.js.map +1 -1
  256. package/dist/core/languages/pythonManifests.d.ts +11 -0
  257. package/dist/core/languages/pythonManifests.js +34 -19
  258. package/dist/core/languages/pythonManifests.js.map +1 -1
  259. package/dist/core/languages/rubyAdapter.js.map +1 -1
  260. package/dist/core/languages/rubyFunctions.js +6 -2
  261. package/dist/core/languages/rubyFunctions.js.map +1 -1
  262. package/dist/core/languages/rustAdapter.js.map +1 -1
  263. package/dist/core/languages/rustFunctions.js +6 -2
  264. package/dist/core/languages/rustFunctions.js.map +1 -1
  265. package/dist/core/languages/swiftAdapter.js +3 -1
  266. package/dist/core/languages/swiftAdapter.js.map +1 -1
  267. package/dist/core/languages/swiftCyclomatic.js.map +1 -1
  268. package/dist/core/languages/swiftFunctions.js +3 -1
  269. package/dist/core/languages/swiftFunctions.js.map +1 -1
  270. package/dist/core/languages/swiftImports.js.map +1 -1
  271. package/dist/core/mergeRisk.js +5 -1
  272. package/dist/core/mergeRisk.js.map +1 -1
  273. package/dist/core/missionOutcome.d.ts +1 -1
  274. package/dist/core/missionOutcome.js +9 -4
  275. package/dist/core/missionOutcome.js.map +1 -1
  276. package/dist/core/missionProof.d.ts +1 -1
  277. package/dist/core/missionProof.js +8 -6
  278. package/dist/core/missionProof.js.map +1 -1
  279. package/dist/core/missionProofBaseline.d.ts +1 -1
  280. package/dist/core/missionProofBaseline.js +8 -2
  281. package/dist/core/missionProofBaseline.js.map +1 -1
  282. package/dist/core/missionProofMarkdown.d.ts +1 -1
  283. package/dist/core/missionProofMarkdown.js +4 -1
  284. package/dist/core/missionProofMarkdown.js.map +1 -1
  285. package/dist/core/missionProofSummary.d.ts +1 -1
  286. package/dist/core/monorepo.d.ts +1 -1
  287. package/dist/core/monorepo.js +4 -2
  288. package/dist/core/monorepo.js.map +1 -1
  289. package/dist/core/onboarding.d.ts +2 -1
  290. package/dist/core/onboarding.js.map +1 -1
  291. package/dist/core/outdatedDetector.js +5 -1
  292. package/dist/core/outdatedDetector.js.map +1 -1
  293. package/dist/core/ownership.js +3 -1
  294. package/dist/core/ownership.js.map +1 -1
  295. package/dist/core/pathClassifiers.js.map +1 -1
  296. package/dist/core/pluginDx.js +2 -1
  297. package/dist/core/pluginDx.js.map +1 -1
  298. package/dist/core/pluginTrust.js +1 -3
  299. package/dist/core/pluginTrust.js.map +1 -1
  300. package/dist/core/plugins.js +5 -5
  301. package/dist/core/plugins.js.map +1 -1
  302. package/dist/core/prDiff.d.ts +1 -2
  303. package/dist/core/prDiff.js +5 -1
  304. package/dist/core/prDiff.js.map +1 -1
  305. package/dist/core/preflight.js +15 -6
  306. package/dist/core/preflight.js.map +1 -1
  307. package/dist/core/privacy.js.map +1 -1
  308. package/dist/core/qualityScorecard.d.ts +1 -1
  309. package/dist/core/qualityScorecard.js +43 -11
  310. package/dist/core/qualityScorecard.js.map +1 -1
  311. package/dist/core/regressionPlan.js +25 -7
  312. package/dist/core/regressionPlan.js.map +1 -1
  313. package/dist/core/releaseEvidence.js +41 -17
  314. package/dist/core/releaseEvidence.js.map +1 -1
  315. package/dist/core/releaseTrain.js +66 -38
  316. package/dist/core/releaseTrain.js.map +1 -1
  317. package/dist/core/reportScope.d.ts +17 -0
  318. package/dist/core/reportScope.js +143 -0
  319. package/dist/core/reportScope.js.map +1 -0
  320. package/dist/core/repositoryScanner.js +1 -3
  321. package/dist/core/repositoryScanner.js.map +1 -1
  322. package/dist/core/review.d.ts +1 -1
  323. package/dist/core/review.js +72 -10
  324. package/dist/core/review.js.map +1 -1
  325. package/dist/core/reviewDataflow.js +7 -1
  326. package/dist/core/reviewDataflow.js.map +1 -1
  327. package/dist/core/reviewPublicSurface.d.ts +13 -0
  328. package/dist/core/reviewPublicSurface.js +134 -0
  329. package/dist/core/reviewPublicSurface.js.map +1 -0
  330. package/dist/core/roadmapCatalog.d.ts +1 -0
  331. package/dist/core/roadmapCatalog.js +349 -30
  332. package/dist/core/roadmapCatalog.js.map +1 -1
  333. package/dist/core/searchIndex.js +124 -17
  334. package/dist/core/searchIndex.js.map +1 -1
  335. package/dist/core/semanticGraph.js.map +1 -1
  336. package/dist/core/semanticSearch.js +20 -4
  337. package/dist/core/semanticSearch.js.map +1 -1
  338. package/dist/core/session.js +1 -2
  339. package/dist/core/session.js.map +1 -1
  340. package/dist/core/sessionResources.js +6 -2
  341. package/dist/core/sessionResources.js.map +1 -1
  342. package/dist/core/start.d.ts +3 -9
  343. package/dist/core/start.js +23 -3237
  344. package/dist/core/start.js.map +1 -1
  345. package/dist/core/startAdoptionLoop.d.ts +2 -0
  346. package/dist/core/startAdoptionLoop.js +41 -0
  347. package/dist/core/startAdoptionLoop.js.map +1 -0
  348. package/dist/core/startEvidence.d.ts +5 -0
  349. package/dist/core/startEvidence.js +62 -0
  350. package/dist/core/startEvidence.js.map +1 -0
  351. package/dist/core/startExecutionPlan.d.ts +16 -0
  352. package/dist/core/startExecutionPlan.js +185 -0
  353. package/dist/core/startExecutionPlan.js.map +1 -0
  354. package/dist/core/startHarness.d.ts +3 -0
  355. package/dist/core/startHarness.js +47 -0
  356. package/dist/core/startHarness.js.map +1 -0
  357. package/dist/core/startIntentTargets.d.ts +24 -0
  358. package/dist/core/startIntentTargets.js +1106 -0
  359. package/dist/core/startIntentTargets.js.map +1 -0
  360. package/dist/core/startMissionControl.d.ts +16 -0
  361. package/dist/core/startMissionControl.js +145 -0
  362. package/dist/core/startMissionControl.js.map +1 -0
  363. package/dist/core/startMissionPolicy.d.ts +19 -0
  364. package/dist/core/startMissionPolicy.js +246 -0
  365. package/dist/core/startMissionPolicy.js.map +1 -0
  366. package/dist/core/startMode.d.ts +11 -0
  367. package/dist/core/startMode.js +139 -0
  368. package/dist/core/startMode.js.map +1 -0
  369. package/dist/core/startNextActions.d.ts +13 -0
  370. package/dist/core/startNextActions.js +19 -0
  371. package/dist/core/startNextActions.js.map +1 -0
  372. package/dist/core/startOptions.d.ts +18 -0
  373. package/dist/core/startOptions.js +29 -0
  374. package/dist/core/startOptions.js.map +1 -0
  375. package/dist/core/startResume.d.ts +7 -0
  376. package/dist/core/startResume.js +468 -0
  377. package/dist/core/startResume.js.map +1 -0
  378. package/dist/core/startReviewGate.d.ts +11 -0
  379. package/dist/core/startReviewGate.js +200 -0
  380. package/dist/core/startReviewGate.js.map +1 -0
  381. package/dist/core/startRouteActions.d.ts +7 -0
  382. package/dist/core/startRouteActions.js +497 -0
  383. package/dist/core/startRouteActions.js.map +1 -0
  384. package/dist/core/startRunbook.d.ts +24 -0
  385. package/dist/core/startRunbook.js +271 -0
  386. package/dist/core/startRunbook.js.map +1 -0
  387. package/dist/core/startSuccessCriteria.d.ts +14 -0
  388. package/dist/core/startSuccessCriteria.js +497 -0
  389. package/dist/core/startSuccessCriteria.js.map +1 -0
  390. package/dist/core/taint.js +22 -12
  391. package/dist/core/taint.js.map +1 -1
  392. package/dist/core/telemetry.js +19 -5
  393. package/dist/core/telemetry.js.map +1 -1
  394. package/dist/core/trial.d.ts +1 -1
  395. package/dist/core/trial.js +15 -6
  396. package/dist/core/trial.js.map +1 -1
  397. package/dist/core/understand.d.ts +1 -1
  398. package/dist/core/understand.js +165 -51
  399. package/dist/core/understand.js.map +1 -1
  400. package/dist/core/upgradePreview.js +73 -1
  401. package/dist/core/upgradePreview.js.map +1 -1
  402. package/dist/core/watcher.js +18 -3
  403. package/dist/core/watcher.js.map +1 -1
  404. package/dist/core/workplan.js +87 -17
  405. package/dist/core/workplan.js.map +1 -1
  406. package/dist/core/workspace.js.map +1 -1
  407. package/dist/index.d.ts +9 -9
  408. package/dist/index.js +7 -7
  409. package/dist/index.js.map +1 -1
  410. package/dist/mcp/pagination.js.map +1 -1
  411. package/dist/mcp/prompts.js +28 -20
  412. package/dist/mcp/prompts.js.map +1 -1
  413. package/dist/mcp/server.js +6 -74
  414. package/dist/mcp/server.js.map +1 -1
  415. package/dist/mcp/serverPayload.d.ts +13 -0
  416. package/dist/mcp/serverPayload.js +61 -0
  417. package/dist/mcp/serverPayload.js.map +1 -0
  418. package/dist/mcp/tokenBudget.js.map +1 -1
  419. package/dist/mcp/tools/_shared.js.map +1 -1
  420. package/dist/mcp/tools/agentBrief.js +7 -1
  421. package/dist/mcp/tools/agentBrief.js.map +1 -1
  422. package/dist/mcp/tools/applyFix.js +1 -1
  423. package/dist/mcp/tools/applyFix.js.map +1 -1
  424. package/dist/mcp/tools/audit.js.map +1 -1
  425. package/dist/mcp/tools/bugHunt.js +2 -2
  426. package/dist/mcp/tools/bugHunt.js.map +1 -1
  427. package/dist/mcp/tools/claim.js +8 -3
  428. package/dist/mcp/tools/claim.js.map +1 -1
  429. package/dist/mcp/tools/collision.js +3 -1
  430. package/dist/mcp/tools/collision.js.map +1 -1
  431. package/dist/mcp/tools/coordinate.js.map +1 -1
  432. package/dist/mcp/tools/coordinateWatch.js +5 -2
  433. package/dist/mcp/tools/coordinateWatch.js.map +1 -1
  434. package/dist/mcp/tools/costSummary.js.map +1 -1
  435. package/dist/mcp/tools/coupling.js.map +1 -1
  436. package/dist/mcp/tools/coverage.js.map +1 -1
  437. package/dist/mcp/tools/dataflow.js.map +1 -1
  438. package/dist/mcp/tools/dependencies.js +4 -1
  439. package/dist/mcp/tools/dependencies.js.map +1 -1
  440. package/dist/mcp/tools/doctor.js.map +1 -1
  441. package/dist/mcp/tools/explainIssue.js +4 -1
  442. package/dist/mcp/tools/explainIssue.js.map +1 -1
  443. package/dist/mcp/tools/fixSuggest.js +5 -2
  444. package/dist/mcp/tools/fixSuggest.js.map +1 -1
  445. package/dist/mcp/tools/hotspots.js +4 -1
  446. package/dist/mcp/tools/hotspots.js.map +1 -1
  447. package/dist/mcp/tools/impact.js +10 -3
  448. package/dist/mcp/tools/impact.js.map +1 -1
  449. package/dist/mcp/tools/mergeRisk.js.map +1 -1
  450. package/dist/mcp/tools/plugin.js +6 -1
  451. package/dist/mcp/tools/plugin.js.map +1 -1
  452. package/dist/mcp/tools/prDiff.js.map +1 -1
  453. package/dist/mcp/tools/preflight.js +1 -5
  454. package/dist/mcp/tools/preflight.js.map +1 -1
  455. package/dist/mcp/tools/review.js.map +1 -1
  456. package/dist/mcp/tools/reviewWatch.d.ts +1 -1
  457. package/dist/mcp/tools/reviewWatch.js +9 -9
  458. package/dist/mcp/tools/reviewWatch.js.map +1 -1
  459. package/dist/mcp/tools/route.js +1 -1
  460. package/dist/mcp/tools/route.js.map +1 -1
  461. package/dist/mcp/tools/search.js.map +1 -1
  462. package/dist/mcp/tools/semanticGraph.js +8 -2
  463. package/dist/mcp/tools/semanticGraph.js.map +1 -1
  464. package/dist/mcp/tools/start.js.map +1 -1
  465. package/dist/mcp/tools/structure.js +7 -1
  466. package/dist/mcp/tools/structure.js.map +1 -1
  467. package/dist/mcp/tools/understand.js.map +1 -1
  468. package/dist/mcp/tools/upgrade.d.ts +1 -1
  469. package/dist/mcp/tools/upgrade.js +2 -16
  470. package/dist/mcp/tools/upgrade.js.map +1 -1
  471. package/dist/mcp/tools/workspaceGraph.js +10 -1
  472. package/dist/mcp/tools/workspaceGraph.js.map +1 -1
  473. package/dist/mcp/tools.js +3 -1
  474. package/dist/mcp/tools.js.map +1 -1
  475. package/dist/projscan-sbom.cdx.json +2136 -904
  476. package/dist/reporters/consoleAnalysisReporter.d.ts +2 -0
  477. package/dist/reporters/consoleAnalysisReporter.js +89 -0
  478. package/dist/reporters/consoleAnalysisReporter.js.map +1 -0
  479. package/dist/reporters/consoleArchitectureReporter.d.ts +3 -0
  480. package/dist/reporters/consoleArchitectureReporter.js +47 -0
  481. package/dist/reporters/consoleArchitectureReporter.js.map +1 -0
  482. package/dist/reporters/consoleAuditReporter.d.ts +2 -0
  483. package/dist/reporters/consoleAuditReporter.js +46 -0
  484. package/dist/reporters/consoleAuditReporter.js.map +1 -0
  485. package/dist/reporters/consoleCiReporter.d.ts +2 -0
  486. package/dist/reporters/consoleCiReporter.js +27 -0
  487. package/dist/reporters/consoleCiReporter.js.map +1 -0
  488. package/dist/reporters/consoleCouplingReporter.d.ts +2 -0
  489. package/dist/reporters/consoleCouplingReporter.js +53 -0
  490. package/dist/reporters/consoleCouplingReporter.js.map +1 -0
  491. package/dist/reporters/consoleCoverageReporter.d.ts +2 -0
  492. package/dist/reporters/consoleCoverageReporter.js +62 -0
  493. package/dist/reporters/consoleCoverageReporter.js.map +1 -0
  494. package/dist/reporters/consoleDependencyReporter.d.ts +2 -0
  495. package/dist/reporters/consoleDependencyReporter.js +64 -0
  496. package/dist/reporters/consoleDependencyReporter.js.map +1 -0
  497. package/dist/reporters/consoleDiffReporter.d.ts +2 -0
  498. package/dist/reporters/consoleDiffReporter.js +80 -0
  499. package/dist/reporters/consoleDiffReporter.js.map +1 -0
  500. package/dist/reporters/consoleExplanationReporter.d.ts +2 -0
  501. package/dist/reporters/consoleExplanationReporter.js +33 -0
  502. package/dist/reporters/consoleExplanationReporter.js.map +1 -0
  503. package/dist/reporters/consoleFileReporter.d.ts +2 -0
  504. package/dist/reporters/consoleFileReporter.js +133 -0
  505. package/dist/reporters/consoleFileReporter.js.map +1 -0
  506. package/dist/reporters/consoleFixGuidanceReporter.d.ts +8 -0
  507. package/dist/reporters/consoleFixGuidanceReporter.js +135 -0
  508. package/dist/reporters/consoleFixGuidanceReporter.js.map +1 -0
  509. package/dist/reporters/consoleHealthReporter.d.ts +13 -0
  510. package/dist/reporters/consoleHealthReporter.js +111 -0
  511. package/dist/reporters/consoleHealthReporter.js.map +1 -0
  512. package/dist/reporters/consoleHotspotReporter.d.ts +2 -0
  513. package/dist/reporters/consoleHotspotReporter.js +68 -0
  514. package/dist/reporters/consoleHotspotReporter.js.map +1 -0
  515. package/dist/reporters/consoleImpactReporter.d.ts +2 -0
  516. package/dist/reporters/consoleImpactReporter.js +65 -0
  517. package/dist/reporters/consoleImpactReporter.js.map +1 -0
  518. package/dist/reporters/consoleOutdatedReporter.d.ts +2 -0
  519. package/dist/reporters/consoleOutdatedReporter.js +54 -0
  520. package/dist/reporters/consoleOutdatedReporter.js.map +1 -0
  521. package/dist/reporters/consolePrDiffReporter.d.ts +2 -0
  522. package/dist/reporters/consolePrDiffReporter.js +75 -0
  523. package/dist/reporters/consolePrDiffReporter.js.map +1 -0
  524. package/dist/reporters/consoleReporter.d.ts +21 -38
  525. package/dist/reporters/consoleReporter.js +19 -1000
  526. package/dist/reporters/consoleReporter.js.map +1 -1
  527. package/dist/reporters/consoleReviewReporter.d.ts +2 -0
  528. package/dist/reporters/consoleReviewReporter.js +101 -0
  529. package/dist/reporters/consoleReviewReporter.js.map +1 -0
  530. package/dist/reporters/consoleUpgradeReporter.d.ts +2 -0
  531. package/dist/reporters/consoleUpgradeReporter.js +89 -0
  532. package/dist/reporters/consoleUpgradeReporter.js.map +1 -0
  533. package/dist/reporters/consoleWorkspaceReporter.d.ts +2 -0
  534. package/dist/reporters/consoleWorkspaceReporter.js +24 -0
  535. package/dist/reporters/consoleWorkspaceReporter.js.map +1 -0
  536. package/dist/reporters/htmlReporter.d.ts +2 -1
  537. package/dist/reporters/htmlReporter.js +9 -3
  538. package/dist/reporters/htmlReporter.js.map +1 -1
  539. package/dist/reporters/jsonReporter.d.ts +2 -1
  540. package/dist/reporters/jsonReporter.js.map +1 -1
  541. package/dist/reporters/markdownAnalysisReporter.d.ts +2 -0
  542. package/dist/reporters/markdownAnalysisReporter.js +40 -0
  543. package/dist/reporters/markdownAnalysisReporter.js.map +1 -0
  544. package/dist/reporters/markdownAuditReporter.d.ts +2 -0
  545. package/dist/reporters/markdownAuditReporter.js +27 -0
  546. package/dist/reporters/markdownAuditReporter.js.map +1 -0
  547. package/dist/reporters/markdownDependencyReporter.d.ts +2 -0
  548. package/dist/reporters/markdownDependencyReporter.js +33 -0
  549. package/dist/reporters/markdownDependencyReporter.js.map +1 -0
  550. package/dist/reporters/markdownDiffReporter.d.ts +2 -0
  551. package/dist/reporters/markdownDiffReporter.js +65 -0
  552. package/dist/reporters/markdownDiffReporter.js.map +1 -0
  553. package/dist/reporters/markdownFileReporter.d.ts +2 -0
  554. package/dist/reporters/markdownFileReporter.js +92 -0
  555. package/dist/reporters/markdownFileReporter.js.map +1 -0
  556. package/dist/reporters/markdownFixGuidanceReporter.d.ts +8 -0
  557. package/dist/reporters/markdownFixGuidanceReporter.js +95 -0
  558. package/dist/reporters/markdownFixGuidanceReporter.js.map +1 -0
  559. package/dist/reporters/markdownImpactReporter.d.ts +2 -0
  560. package/dist/reporters/markdownImpactReporter.js +52 -0
  561. package/dist/reporters/markdownImpactReporter.js.map +1 -0
  562. package/dist/reporters/markdownReporter.d.ts +10 -16
  563. package/dist/reporters/markdownReporter.js +9 -452
  564. package/dist/reporters/markdownReporter.js.map +1 -1
  565. package/dist/reporters/markdownReviewReporter.d.ts +2 -0
  566. package/dist/reporters/markdownReviewReporter.js +84 -0
  567. package/dist/reporters/markdownReviewReporter.js.map +1 -0
  568. package/dist/reporters/markdownUpgradeReporter.d.ts +2 -0
  569. package/dist/reporters/markdownUpgradeReporter.js +62 -0
  570. package/dist/reporters/markdownUpgradeReporter.js.map +1 -0
  571. package/dist/reporters/sarifReporter.js.map +1 -1
  572. package/dist/tool-manifest.json +5 -5
  573. package/dist/types/agentBrief.d.ts +48 -0
  574. package/dist/types/agentBrief.js +2 -0
  575. package/dist/types/agentBrief.js.map +1 -0
  576. package/dist/types/analysis.d.ts +32 -0
  577. package/dist/types/analysis.js +2 -0
  578. package/dist/types/analysis.js.map +1 -0
  579. package/dist/types/baseline.d.ts +59 -0
  580. package/dist/types/baseline.js +2 -0
  581. package/dist/types/baseline.js.map +1 -0
  582. package/dist/types/bugHunt.d.ts +41 -0
  583. package/dist/types/bugHunt.js +2 -0
  584. package/dist/types/bugHunt.js.map +1 -0
  585. package/dist/types/common.d.ts +34 -0
  586. package/dist/types/common.js +2 -0
  587. package/dist/types/common.js.map +1 -0
  588. package/dist/types/config.d.ts +66 -0
  589. package/dist/types/config.js +2 -0
  590. package/dist/types/config.js.map +1 -0
  591. package/dist/types/coupling.d.ts +40 -0
  592. package/dist/types/coupling.js +2 -0
  593. package/dist/types/coupling.js.map +1 -0
  594. package/dist/types/coverage.d.ts +32 -0
  595. package/dist/types/coverage.js +2 -0
  596. package/dist/types/coverage.js.map +1 -0
  597. package/dist/types/dependencyHealth.d.ts +73 -0
  598. package/dist/types/dependencyHealth.js +2 -0
  599. package/dist/types/dependencyHealth.js.map +1 -0
  600. package/dist/types/dogfood.d.ts +185 -0
  601. package/dist/types/dogfood.js +2 -0
  602. package/dist/types/dogfood.js.map +1 -0
  603. package/dist/types/evidencePack.d.ts +76 -0
  604. package/dist/types/evidencePack.js +2 -0
  605. package/dist/types/evidencePack.js.map +1 -0
  606. package/dist/types/fixes.d.ts +77 -0
  607. package/dist/types/fixes.js +2 -0
  608. package/dist/types/fixes.js.map +1 -0
  609. package/dist/types/graph.d.ts +80 -0
  610. package/dist/types/graph.js +2 -0
  611. package/dist/types/graph.js.map +1 -0
  612. package/dist/types/graphCorpus.d.ts +16 -0
  613. package/dist/types/graphCorpus.js +2 -0
  614. package/dist/types/graphCorpus.js.map +1 -0
  615. package/dist/types/hotspots.d.ts +42 -0
  616. package/dist/types/hotspots.js +2 -0
  617. package/dist/types/hotspots.js.map +1 -0
  618. package/dist/types/impact.d.ts +62 -0
  619. package/dist/types/impact.js +2 -0
  620. package/dist/types/impact.js.map +1 -0
  621. package/dist/types/inspection.d.ts +47 -0
  622. package/dist/types/inspection.js +2 -0
  623. package/dist/types/inspection.js.map +1 -0
  624. package/dist/types/mcp.d.ts +39 -0
  625. package/dist/types/mcp.js +2 -0
  626. package/dist/types/mcp.js.map +1 -0
  627. package/dist/types/pluginDx.d.ts +42 -0
  628. package/dist/types/pluginDx.js +2 -0
  629. package/dist/types/pluginDx.js.map +1 -0
  630. package/dist/types/prDiff.d.ts +41 -0
  631. package/dist/types/prDiff.js +2 -0
  632. package/dist/types/prDiff.js.map +1 -0
  633. package/dist/types/preflight.d.ts +122 -0
  634. package/dist/types/preflight.js +2 -0
  635. package/dist/types/preflight.js.map +1 -0
  636. package/dist/types/qualityScorecard.d.ts +34 -0
  637. package/dist/types/qualityScorecard.js +2 -0
  638. package/dist/types/qualityScorecard.js.map +1 -0
  639. package/dist/types/regressionPlan.d.ts +32 -0
  640. package/dist/types/regressionPlan.js +2 -0
  641. package/dist/types/regressionPlan.js.map +1 -0
  642. package/dist/types/releaseTrain.d.ts +37 -0
  643. package/dist/types/releaseTrain.js +2 -0
  644. package/dist/types/releaseTrain.js.map +1 -0
  645. package/dist/types/review.d.ts +203 -0
  646. package/dist/types/review.js +2 -0
  647. package/dist/types/review.js.map +1 -0
  648. package/dist/types/reviewContract.d.ts +9 -0
  649. package/dist/types/reviewContract.js +2 -0
  650. package/dist/types/reviewContract.js.map +1 -0
  651. package/dist/types/scanning.d.ts +111 -0
  652. package/dist/types/scanning.js +2 -0
  653. package/dist/types/scanning.js.map +1 -0
  654. package/dist/types/session.d.ts +42 -0
  655. package/dist/types/session.js +2 -0
  656. package/dist/types/session.js.map +1 -0
  657. package/dist/types/start.d.ts +437 -0
  658. package/dist/types/start.js +2 -0
  659. package/dist/types/start.js.map +1 -0
  660. package/dist/types/trial.d.ts +27 -0
  661. package/dist/types/trial.js +2 -0
  662. package/dist/types/trial.js.map +1 -0
  663. package/dist/types/understand.d.ts +153 -0
  664. package/dist/types/understand.js +2 -0
  665. package/dist/types/understand.js.map +1 -0
  666. package/dist/types/workplan.d.ts +67 -0
  667. package/dist/types/workplan.js +2 -0
  668. package/dist/types/workplan.js.map +1 -0
  669. package/dist/types/workplanHandoff.d.ts +11 -0
  670. package/dist/types/workplanHandoff.js +2 -0
  671. package/dist/types/workplanHandoff.js.map +1 -0
  672. package/dist/types/workspace.d.ts +18 -0
  673. package/dist/types/workspace.js +2 -0
  674. package/dist/types/workspace.js.map +1 -0
  675. package/dist/types.d.ts +34 -2348
  676. package/dist/types.js +0 -1
  677. package/dist/types.js.map +1 -1
  678. package/dist/utils/banner.js +15 -6
  679. package/dist/utils/banner.js.map +1 -1
  680. package/dist/utils/baseline.js +11 -9
  681. package/dist/utils/baseline.js.map +1 -1
  682. package/dist/utils/changedFiles.js +1 -1
  683. package/dist/utils/changedFiles.js.map +1 -1
  684. package/dist/utils/config.d.ts +2 -1
  685. package/dist/utils/config.js +32 -0
  686. package/dist/utils/config.js.map +1 -1
  687. package/dist/utils/formatSupport.d.ts +1 -1
  688. package/dist/utils/formatSupport.js +7 -1
  689. package/dist/utils/formatSupport.js.map +1 -1
  690. package/dist/utils/packageJsonLocator.js.map +1 -1
  691. package/docs/GUIDE.md +211 -147
  692. package/docs/PLUGIN-GALLERY.md +9 -1
  693. package/docs/ROADMAP.md +120 -86
  694. package/docs/demos/projscan-4-1-demo.html +46 -79
  695. package/docs/examples/adoption-workflows.md +128 -0
  696. package/docs/examples/plugins/graph-context.mjs +1 -2
  697. package/docs/examples/plugins/security-sensitive-files.mjs +2 -1
  698. package/docs/examples/swarm-coordination.md +109 -0
  699. package/package.json +12 -5
@@ -0,0 +1,1106 @@
1
+ function firstQuery(intent, extractors) {
2
+ for (const extract of extractors) {
3
+ const query = extract(intent);
4
+ if (query)
5
+ return query;
6
+ }
7
+ return undefined;
8
+ }
9
+ export function extractSearchQuery(intent) {
10
+ const trimmed = intent.trim();
11
+ return (searchQueryFromHighPrioritySignals(trimmed) ??
12
+ searchQueryFromDomainSignals(trimmed) ??
13
+ searchQueryFromTestAndRouteLookups(trimmed) ??
14
+ searchQueryFromGeneratedAndConfig(trimmed) ??
15
+ searchQueryFromOwnership(trimmed) ??
16
+ searchQueryFromImplementation(trimmed) ??
17
+ unwrapTarget((trimmed.match(/\b(?:search|find|locate|lookup)\s+(?:for\s+)?(.+)$/i)?.[1] ?? trimmed).trim()));
18
+ }
19
+ function searchQueryFromHighPrioritySignals(trimmed) {
20
+ const file = extractFileTarget(trimmed);
21
+ if (file && /\b(?:where|find|locate|search)\b/i.test(trimmed) && /\btests?\b/i.test(trimmed)) {
22
+ return `tests for ${file}`;
23
+ }
24
+ const envVar = extractEnvVarTarget(trimmed);
25
+ if (envVar && /\b(?:where|find|locate|search|lookup|used|referenced|process)\b/i.test(trimmed)) {
26
+ return envVar;
27
+ }
28
+ const envControl = trimmed.match(/\b(?:which|what|where|find|locate|search(?:\s+for)?|lookup)\s+(?:env(?:ironment)?\s+)?(?:var|vars|variable|variables)\s+(?:controls?|configures?|sets?|for)\s+(.+?)\s*[?!.]*$/i);
29
+ if (envControl?.[1])
30
+ return `${unwrapTarget(envControl[1].trim())} env var`;
31
+ const quotedDebugText = extractQuotedTextTarget(trimmed);
32
+ if (quotedDebugText &&
33
+ /\b(?:error|errors|message|messages|throws?|thrown|logs?|logged|logging)\b/i.test(trimmed)) {
34
+ return quotedDebugText;
35
+ }
36
+ return undefined;
37
+ }
38
+ function searchQueryFromDomainSignals(trimmed) {
39
+ return firstQuery(trimmed, [
40
+ extractObservabilityQuery,
41
+ extractBackgroundWorkQuery,
42
+ extractTestDataQuery,
43
+ extractAuthorizationQuery,
44
+ extractReliabilityQuery,
45
+ extractDataContractQuery,
46
+ extractUiInteractionQuery,
47
+ extractStyleSystemQuery,
48
+ extractNavigationLayoutQuery,
49
+ extractFrontendPageRouteQuery,
50
+ extractStateManagementQuery,
51
+ extractDataAccessQuery,
52
+ extractIntegrationQuery,
53
+ extractApiContractQuery,
54
+ extractInfraArtifactQuery,
55
+ extractCommunicationArtifactQuery,
56
+ extractDomainWorkflowQuery,
57
+ ]);
58
+ }
59
+ function searchQueryFromTestAndRouteLookups(trimmed) {
60
+ const testCoverageLookup = trimmed.match(/\b(?:which|what|find|locate|search(?:\s+for)?|where\s+(?:are|is))\s+(?:the\s+)?(?:tests?|specs?)\s+(?:that\s+)?(?:cover|covers|covering)\s+(.+?)\s*[?!.]*$/i);
61
+ if (testCoverageLookup?.[1])
62
+ return `tests for ${unwrapTarget(testCoverageLookup[1].trim())}`;
63
+ const testLocation = trimmed.match(/\b(?:where\s+(?:are|is)\s+|find\s+|locate\s+|search\s+(?:for\s+)?|lookup\s+)?(?:the\s+)?(?:tests?|specs?)\s+(?:for|of)\s+(.+?)\s*[?!.]*$/i);
64
+ if (testLocation?.[1])
65
+ return `tests for ${unwrapTarget(testLocation[1].trim())}`;
66
+ const routePath = trimmed.match(/(?:^|\s)((?:(?:GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD)\s+)?\/[A-Za-z0-9_./:{}-]+)/i);
67
+ if (routePath?.[1] &&
68
+ /\b(?:handler|handles?|handled|route|routes|endpoint|endpoints|where|find|locate|search)\b/i.test(trimmed)) {
69
+ return routePath[1].trim();
70
+ }
71
+ const codeHandler = trimmed.match(/\b(?:what|which)\s+(?:code|file|files)?\s*(?:handles?|contains|loads?|parses?|configures?|creates?)\s+(.+?)\s*[?!.]*$/i);
72
+ if (codeHandler?.[1])
73
+ return unwrapTarget(codeHandler[1].trim());
74
+ const featureFlags = trimmed.match(/\b(?:which|what|where|find|locate|search(?:\s+for)?|lookup)\s+(?:are\s+|is\s+|do\s+|does\s+)?(?:the\s+)?((?:feature\s+)?flags?)\s+(?:exist|exists|configured|loaded|defined)?\s*[?!.]*$/i);
75
+ if (featureFlags?.[1])
76
+ return featureFlags[1].toLowerCase().includes('feature') ? 'feature flags' : 'flags';
77
+ return migrationSearchQuery(trimmed);
78
+ }
79
+ function migrationSearchQuery(trimmed) {
80
+ const migrationLookup = trimmed.match(/\b(?:where\s+(?:are|is)|which|what|find|locate|search(?:\s+for)?|lookup|show)\s+(?:me\s+)?(?:the\s+)?((?:database\s+|prisma\s+)?migrations?|(?:database\s+)?migration\s+files?)\s*(?:exist|exists|ran|located|live)?\s*[?!.]*$/i);
81
+ if (migrationLookup?.[1]) {
82
+ const target = migrationLookup[1].trim().toLowerCase();
83
+ if (target.includes('prisma'))
84
+ return 'Prisma migrations';
85
+ if (target.includes('database'))
86
+ return target.includes('file') ? 'database migration files' : 'database migrations';
87
+ return target.includes('file') ? 'migration files' : 'migrations';
88
+ }
89
+ return undefined;
90
+ }
91
+ function searchQueryFromGeneratedAndConfig(trimmed) {
92
+ const generatedLookup = trimmed.match(/\b(?:show|find|locate|search(?:\s+for)?|where\s+(?:are|is)|which|what|is)\s+(?:me\s+)?(?:this\s+)?(?:the\s+)?(.+?)\s*[?!.]*$/i);
93
+ if (generatedLookup?.[1] && /\bgenerated\b/i.test(generatedLookup[1])) {
94
+ if (/\bfiles?\b/i.test(generatedLookup[1]))
95
+ return 'generated files';
96
+ if (/\bcode\b/i.test(generatedLookup[1]))
97
+ return 'generated code';
98
+ }
99
+ const toolingConfig = extractToolingConfigQuery(trimmed);
100
+ if (toolingConfig)
101
+ return toolingConfig;
102
+ const configDefinitionLookup = trimmed.match(/\bwhich\s+(?:config(?:uration)?\s+files?|files?)\s+(?:defines?|contains|sets?|configures?)\s+(.+?)\s*[?!.]*$/i);
103
+ if (configDefinitionLookup?.[1] && /\bconfig(?:uration)?\b/i.test(trimmed))
104
+ return `${unwrapTarget(configDefinitionLookup[1].trim())} config`;
105
+ const configLookup = trimmed.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup|show)\s+(?:the\s+)?(.+?\bconfig(?:uration)?(?:\s+files?)?)\s*[?!.]*$/i);
106
+ if (configLookup?.[1])
107
+ return unwrapTarget(configLookup[1].trim());
108
+ return undefined;
109
+ }
110
+ function searchQueryFromOwnership(trimmed) {
111
+ const ownership = trimmed.match(/\b(?:who|which\s+team)\s+owns?\s+(.+?)\s*[?!.]*$/i);
112
+ if (ownership?.[1])
113
+ return unwrapTarget(ownership[1].trim());
114
+ const ownershipHelp = trimmed.match(/\bwho\s+(?:should\s+i\s+ask|can\s+help|knows|is\s+(?:the\s+)?(?:expert|contact))\s*(?:about|with|for)?\s+(.+?)\s*[?!.]*$/i);
115
+ if (ownershipHelp?.[1])
116
+ return unwrapTarget(ownershipHelp[1].trim());
117
+ const expertLookup = trimmed.match(/\b(?:find|locate|search(?:\s+for)?|lookup)\s+(?:an?\s+)?(?:expert|experts|contact|contacts)\s+(?:for|on|about|with)\s+(.+?)\s*[?!.]*$/i);
118
+ if (expertLookup?.[1])
119
+ return unwrapTarget(expertLookup[1].trim());
120
+ const codeOwners = trimmed.match(/\b(?:find|locate|search(?:\s+for)?|lookup)\s+(?:code\s+)?owners?\s+(?:for|of)\s+(.+?)\s*[?!.]*$/i);
121
+ if (codeOwners?.[1])
122
+ return unwrapTarget(codeOwners[1].trim());
123
+ return undefined;
124
+ }
125
+ function searchQueryFromImplementation(trimmed) {
126
+ const whereImplemented = trimmed.match(/\bwhere\s+(?:is|are|do|does|we)?\s*(.+?)\s+(?:implemented|handled|configured|created|defined|loaded|parsed|documented)\b/i);
127
+ if (whereImplemented?.[1])
128
+ return unwrapTarget(whereImplemented[1].trim());
129
+ return undefined;
130
+ }
131
+ export function extractImpactTarget(intent) {
132
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
133
+ const usageMatch = compactIntent.match(/\bwhere\s+(?:is|are)\s+[`'"]?([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)?)[`'"]?\s+(?:used|referenced|called)\b/i);
134
+ if (usageMatch?.[1] && !isGenericReferenceTarget(usageMatch[1]))
135
+ return usageMatch[1];
136
+ const match = compactIntent.match(/\b(?:rename|change|modify|delete|remove)\s+(?:the\s+|a\s+|an\s+)?(.+)$/i);
137
+ const target = unwrapTarget((match?.[1] ?? '').trim());
138
+ if (target.length === 0)
139
+ return undefined;
140
+ const normalized = target
141
+ .replace(/\s+(?:in|from|inside)\s+(?:this\s+)?(?:repo|repository|codebase)$/i, '')
142
+ .trim();
143
+ if (isGenericReferenceTarget(normalized))
144
+ return undefined;
145
+ return normalized;
146
+ }
147
+ function isGenericReferenceTarget(target) {
148
+ return /^(?:it|this|that|thing|symbol|function|method|file|change|changes|break|breaks|breaking|safely|safe|carefully)$/i.test(target);
149
+ }
150
+ export function extractFileTarget(intent) {
151
+ const compactIntent = intent.trim().replace(/[?!\s]+$/g, '');
152
+ const wrapped = compactIntent.match(/[`'"]([^`'"]+\.[A-Za-z0-9]{1,12})[`'"]/);
153
+ if (wrapped?.[1] && isFilePathTarget(wrapped[1]))
154
+ return wrapped[1];
155
+ const pathMatch = compactIntent.match(/(?:^|\s)([A-Za-z0-9_./:@-]+\.[A-Za-z0-9]{1,12})(?:\s|$)/);
156
+ if (pathMatch?.[1] && isFilePathTarget(pathMatch[1]))
157
+ return unwrapTarget(pathMatch[1]);
158
+ const slashPathMatch = compactIntent.match(/(?:^|\s)([A-Za-z0-9_./:@-]+\/[A-Za-z0-9_./:@-]+)(?:\s|$)/);
159
+ if (slashPathMatch?.[1] && isFilePathTarget(slashPathMatch[1]))
160
+ return unwrapTarget(slashPathMatch[1]);
161
+ return undefined;
162
+ }
163
+ function extractEnvVarTarget(intent) {
164
+ const compactIntent = intent.trim().replace(/[?!\s]+$/g, '');
165
+ const processMatch = compactIntent.match(/\bprocess\.env\.[A-Za-z_][A-Za-z0-9_]*\b/);
166
+ if (processMatch?.[0])
167
+ return processMatch[0];
168
+ const envMatch = compactIntent.match(/\b([A-Z][A-Z0-9]*_[A-Z0-9_]+)\b/);
169
+ return envMatch?.[1];
170
+ }
171
+ export function extractClaimTarget(intent) {
172
+ return extractFileTarget(intent) ?? extractSymbolTarget(intent);
173
+ }
174
+ export function extractClaimAgent(intent) {
175
+ const compactIntent = intent.trim().replace(/[?!\s]+$/g, '');
176
+ const match = compactIntent.match(/\b(?:as|for|agent)\s+([A-Za-z0-9_.:@-]{2,64})\b/i);
177
+ const candidate = match?.[1];
178
+ if (!candidate || /^(?:me|myself|us|team|agent|owner)$/i.test(candidate))
179
+ return undefined;
180
+ return candidate;
181
+ }
182
+ export function extractIssueIdTarget(intent) {
183
+ const compactIntent = intent.trim().replace(/[?!\s]+$/g, '');
184
+ const wrapped = compactIntent.match(/[`'"]([^`'"]*[A-Za-z][^`'"]*-[^`'"]+)[`'"]/);
185
+ if (wrapped?.[1] && isIssueIdTarget(wrapped[1]))
186
+ return wrapped[1];
187
+ const labeled = compactIntent.match(/\b(?:issue(?:\s+id)?|id|rule)\s+(?:is\s+|named\s+)?([A-Za-z0-9_:@.-]*[A-Za-z][A-Za-z0-9_:@.-]*-[A-Za-z0-9_:@.-]+)\b/i);
188
+ if (labeled?.[1] && isIssueIdTarget(labeled[1]))
189
+ return labeled[1];
190
+ const issueLike = compactIntent.match(/\b([A-Za-z0-9_:@.-]*[A-Za-z][A-Za-z0-9_:@.-]*-[A-Za-z0-9_:@.-]+)\b/);
191
+ if (issueLike?.[1] && isIssueIdTarget(issueLike[1]))
192
+ return issueLike[1];
193
+ return undefined;
194
+ }
195
+ export function extractPackageTarget(intent) {
196
+ const compactIntent = intent.trim().replace(/[?!\s]+$/g, '');
197
+ const wrapped = compactIntent.match(/[`'"](@?[A-Za-z0-9][\w.-]*(?:\/[A-Za-z0-9][\w.-]*)?)[`'"]/);
198
+ if (wrapped?.[1] && isPackageNameTarget(wrapped[1]))
199
+ return normalizePackageName(wrapped[1]);
200
+ const actionMatch = compactIntent.match(/\b(?:bump|upgrade|update|remove|drop|uninstall)\s+(?:the\s+)?(?:(?:package|dependency)\s+)?(@?[A-Za-z0-9][\w.-]*(?:\/[A-Za-z0-9][\w.-]*)?)(?=\s|$)/i);
201
+ if (actionMatch?.[1] && isPackageNameTarget(actionMatch[1]))
202
+ return normalizePackageName(actionMatch[1]);
203
+ const removalSubject = compactIntent.match(/\b(@?[A-Za-z0-9][\w.-]*(?:\/[A-Za-z0-9][\w.-]*)?)\s+(?:safe\s+to\s+)?(?:remove|drop|uninstall)\b/i);
204
+ if (removalSubject?.[1] && isPackageNameTarget(removalSubject[1]))
205
+ return normalizePackageName(removalSubject[1]);
206
+ const labeled = compactIntent.match(/\b(?:package|dependency)\s+(?:named\s+|called\s+)?(@?[A-Za-z0-9][\w.-]*(?:\/[A-Za-z0-9][\w.-]*)?)(?=\s|$)/i);
207
+ if (labeled?.[1] && isPackageNameTarget(labeled[1]))
208
+ return normalizePackageName(labeled[1]);
209
+ return undefined;
210
+ }
211
+ export function extractAuditPackageTarget(intent) {
212
+ const packageName = extractPackageTarget(intent);
213
+ if (packageName)
214
+ return packageName;
215
+ const compactIntent = intent.trim().replace(/[?!\s]+$/g, '');
216
+ const subject = compactIntent.match(/\b(?:does|is|can)\s+(@?[A-Za-z0-9][\w.-]*(?:\/[A-Za-z0-9][\w.-]*)?)\s+(?:have|has|contain|contains|affected|vulnerable|secure|safe)\b/i);
217
+ if (subject?.[1] && isPackageNameTarget(subject[1]))
218
+ return normalizePackageName(subject[1]);
219
+ const command = compactIntent.match(/\b(?:audit|check|scan)\s+(@?[A-Za-z0-9][\w.-]*(?:\/[A-Za-z0-9][\w.-]*)?)\s+(?:for\s+)?(?:cve|cves|vulnerabilities|vulnerability|security)\b/i);
220
+ if (command?.[1] && isPackageNameTarget(command[1]))
221
+ return normalizePackageName(command[1]);
222
+ return undefined;
223
+ }
224
+ export function graphQueryFromIntent(intent) {
225
+ const file = extractFileTarget(intent);
226
+ const packageName = extractGraphPackageTarget(intent);
227
+ const symbol = extractSymbolTarget(intent);
228
+ const direction = graphDirectionFromIntent(intent);
229
+ return direction ? graphQueryForDirection(direction, { file, packageName, symbol }) : undefined;
230
+ }
231
+ function graphQueryForDirection(direction, target) {
232
+ if (['imports', 'exports', 'importers'].includes(direction) && target.file)
233
+ return { direction, file: target.file };
234
+ if (direction === 'package_importers' && target.packageName)
235
+ return { direction, symbol: target.packageName };
236
+ if (['symbol_defs', 'package_importers'].includes(direction) && target.symbol)
237
+ return { direction, symbol: target.symbol };
238
+ return { direction };
239
+ }
240
+ function graphDirectionFromIntent(intent) {
241
+ const text = intent.toLowerCase();
242
+ if (!extractFileTarget(intent) && packageImporterGraphIntent(text))
243
+ return 'package_importers';
244
+ return GRAPH_DIRECTION_RULES.find((rule) => rule.pattern.test(text))?.direction;
245
+ }
246
+ const GRAPH_DIRECTION_RULES = [
247
+ {
248
+ pattern: /\b(?:who|what|which)\s+(?:files\s+)?imports?\b|\bimporters\b/,
249
+ direction: 'importers',
250
+ },
251
+ { pattern: /\bexports?\b/, direction: 'exports' },
252
+ { pattern: /\bimports?\b/, direction: 'imports' },
253
+ { pattern: /\b(?:defined|definition|defines)\b/, direction: 'symbol_defs' },
254
+ ];
255
+ function packageImporterGraphIntent(text) {
256
+ return [
257
+ /\b(?:who|what|which)\s+uses?\b/,
258
+ /\b(?:who|what|which)\s+depends?\s+on\b/,
259
+ /\bwhy\b.*\b(?:depend\s+on|depends\s+on|installed)\b/,
260
+ /\b(?:who|what|which)\s+(?:files\s+)?imports?\b/,
261
+ ].some((pattern) => pattern.test(text));
262
+ }
263
+ export function graphQueryIsReady(query) {
264
+ if (query.direction === 'imports' ||
265
+ query.direction === 'exports' ||
266
+ query.direction === 'importers') {
267
+ return typeof query.file === 'string' && !isPlaceholder(query.file);
268
+ }
269
+ if (query.direction === 'symbol_defs' || query.direction === 'package_importers') {
270
+ return typeof query.symbol === 'string' && !isPlaceholder(query.symbol);
271
+ }
272
+ return false;
273
+ }
274
+ export function semanticGraphCommand(query) {
275
+ const parts = ['projscan semantic-graph', '--query', query.direction];
276
+ if (query.file)
277
+ parts.push('--file', isPlaceholder(query.file) ? query.file : quoteShellArg(query.file));
278
+ if (query.symbol)
279
+ parts.push('--symbol', isPlaceholder(query.symbol) ? query.symbol : quoteShellArg(query.symbol));
280
+ if (typeof query.limit === 'number')
281
+ parts.push('--limit', String(query.limit));
282
+ parts.push('--format', 'json');
283
+ return parts.join(' ');
284
+ }
285
+ function extractSymbolTarget(intent) {
286
+ const compactIntent = intent.trim().replace(/[?!\s]+$/g, '');
287
+ const wrapped = compactIntent.match(/[`'"]([A-Za-z_$][\w$]*)[`'"]/);
288
+ if (wrapped?.[1])
289
+ return wrapped[1];
290
+ const definitionMatch = compactIntent.match(/\bwhere\s+(?:is|are)\s+(?:the\s+)?([A-Za-z_$][\w$]*)\s+(?:defined|declared|implemented)\b/i);
291
+ if (definitionMatch?.[1] && isSymbolNameTarget(definitionMatch[1]))
292
+ return definitionMatch[1];
293
+ const match = compactIntent.match(/\b(?:symbol|function|class|const|type|interface)\s+([A-Za-z_$][\w$]*)\b/i);
294
+ return match?.[1] && isSymbolNameTarget(match[1]) ? match[1] : undefined;
295
+ }
296
+ function extractGraphPackageTarget(intent) {
297
+ const compactIntent = intent.trim().replace(/[?!\s]+$/g, '');
298
+ const importMatch = compactIntent.match(/\b(?:who|what|which)\s+(?:files\s+)?imports?\s+(?:(?:package|dependency)\s+)?(@?[A-Za-z0-9][\w.-]*(?:\/[A-Za-z0-9][\w.-]*)?)\b/i);
299
+ if (importMatch?.[1] && isPackageNameTarget(importMatch[1]))
300
+ return normalizePackageName(importMatch[1]);
301
+ const useMatch = compactIntent.match(/\b(?:who|what|which)\s+uses?\s+(?:(?:package|dependency)\s+)?(@?[A-Za-z0-9][\w.-]*(?:\/[A-Za-z0-9][\w.-]*)?)\b/i);
302
+ if (useMatch?.[1] && isPackageNameTarget(useMatch[1]))
303
+ return normalizePackageName(useMatch[1]);
304
+ const dependsMatch = compactIntent.match(/\b(?:who|what|which|why(?:\s+do\s+we)?)\s+depends?\s+on\s+(?:(?:package|dependency)\s+)?(@?[A-Za-z0-9][\w.-]*(?:\/[A-Za-z0-9][\w.-]*)?)\b/i);
305
+ if (dependsMatch?.[1] && isPackageNameTarget(dependsMatch[1]))
306
+ return normalizePackageName(dependsMatch[1]);
307
+ const installedMatch = compactIntent.match(/\bwhy\s+is\s+(@?[A-Za-z0-9][\w.-]*(?:\/[A-Za-z0-9][\w.-]*)?)\s+installed\b/i);
308
+ if (installedMatch?.[1] && isPackageNameTarget(installedMatch[1]))
309
+ return normalizePackageName(installedMatch[1]);
310
+ return undefined;
311
+ }
312
+ function isSymbolNameTarget(target) {
313
+ return ![
314
+ 'symbol',
315
+ 'function',
316
+ 'class',
317
+ 'const',
318
+ 'type',
319
+ 'interface',
320
+ 'defined',
321
+ 'declared',
322
+ 'implemented',
323
+ ].includes(target.toLowerCase());
324
+ }
325
+ function unwrapTarget(value) {
326
+ const trimmed = value.trim();
327
+ const wrapped = trimmed.match(/^([`'"])(.+)\1$/);
328
+ return (wrapped?.[2] ?? trimmed).trim();
329
+ }
330
+ function extractQuotedTextTarget(intent) {
331
+ const quoted = intent.match(/(["'`])(.{2,200}?)\1/);
332
+ const target = quoted?.[2]?.trim();
333
+ return target && !isGenericReferenceTarget(target) ? target : undefined;
334
+ }
335
+ function extractObservabilityQuery(intent) {
336
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
337
+ const logCheck = compactIntent.match(/\b(?:what|which)\s+logs?\s+should\s+i\s+check\s+(?:for|about|on)\s+(.+?)$/i);
338
+ if (logCheck?.[1])
339
+ return `${unwrapTarget(logCheck[1].trim())} logs`;
340
+ const dashboard = compactIntent.match(/\b(?:find|locate|search(?:\s+for)?|lookup|where\s+(?:is|are))\s+(?:the\s+)?dashboards?\s+(?:for|about|on)\s+(.+?)$/i);
341
+ if (dashboard?.[1])
342
+ return `${unwrapTarget(dashboard[1].trim())} dashboard`;
343
+ const serviceInit = compactIntent.match(/\b(?:where\s+(?:do|does)\s+(?:we\s+)?(?:initialize|initialise|init)|find|locate|search(?:\s+for)?|lookup)\s+(Sentry|Datadog|Prometheus)\b/i);
344
+ if (serviceInit?.[1])
345
+ return serviceInit[1];
346
+ const observabilityTarget = '(?:metrics?|prometheus\\s+metrics?|alerts?|analytics\\s+events?|events?|sentry\\s+errors?|datadog)';
347
+ const lookup = compactIntent.match(new RegExp(`\\b(?:where\\s+(?:are|is)|which|what|find|locate|search(?:\\s+for)?|lookup)\\s+(?:the\\s+)?(.*?\\b${observabilityTarget}\\b)(?:\\s+(?:emitted|sent|configured|handled|initialized|initialised|created|defined))?$`, 'i'));
348
+ if (lookup?.[1] && isObservabilityTarget(lookup[1]))
349
+ return unwrapTarget(lookup[1].trim()).replace(/^the\s+/i, '');
350
+ return undefined;
351
+ }
352
+ function isObservabilityTarget(target) {
353
+ return /\b(?:metric|metrics|prometheus|alert|alerts|analytics|events?|sentry|datadog|dashboard|dashboards|logs?)\b/i.test(target);
354
+ }
355
+ function extractBackgroundWorkQuery(intent) {
356
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
357
+ const subjectPattern = 'background\\s+jobs?|cron\\s+jobs?|scheduled\\s+tasks?|queues?\\s+processors?|workers?\\s+processors?|schedulers?|workers?|queues?|processors?';
358
+ const findMatch = compactIntent.match(new RegExp(`\\b(?:find|locate|search(?:\\s+for)?|lookup)\\s+(?:the\\s+)?(.*?\\b(?:${subjectPattern})\\b)`, 'i'));
359
+ if (findMatch?.[1] && isBackgroundWorkTarget(findMatch[1]))
360
+ return unwrapTarget(findMatch[1].trim()).replace(/^the\s+/i, '');
361
+ const lookupMatch = compactIntent.match(new RegExp(`\\b(?:where\\s+(?:are|is)|which|what)\\s+(?:the\\s+)?(.*?\\b(?:${subjectPattern})\\b)(?:\\s+(?:exist|exists|defined|located|handled|run|runs))?$`, 'i'));
362
+ if (lookupMatch?.[1] && isBackgroundWorkTarget(lookupMatch[1]))
363
+ return unwrapTarget(lookupMatch[1].trim()).replace(/^the\s+/i, '');
364
+ const processMatch = compactIntent.match(/\bwhich\s+(queues?|workers?|processors?)\s+(?:processes?|handles?)\s+(.+?)$/i);
365
+ if (processMatch?.[1] && processMatch[2])
366
+ return `${unwrapTarget(processMatch[2].trim())} ${processMatch[1].toLowerCase()}`;
367
+ return undefined;
368
+ }
369
+ function isBackgroundWorkTarget(target) {
370
+ return /\b(?:background|cron|scheduled|schedule|scheduler|worker|queue|processor)\b/i.test(target);
371
+ }
372
+ function extractTestDataQuery(intent) {
373
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
374
+ if (/\bseeds?\s+data\b|\bdata\s+seeds?\b|\bseed\s+database\b|\bdatabase\s+seed\b/i.test(compactIntent)) {
375
+ return 'seed data';
376
+ }
377
+ const storybook = compactIntent.match(/\b(?:where\s+(?:are|is)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(?:storybook\s+)?stories\s+(?:for|of)\s+(.+?)$/i);
378
+ if (storybook?.[1])
379
+ return `${unwrapTarget(storybook[1].trim())} Storybook stories`;
380
+ const storyRender = compactIntent.match(/\bwhich\s+stor(?:y|ies)\s+renders?\s+(.+?)$/i);
381
+ if (storyRender?.[1])
382
+ return `${unwrapTarget(storyRender[1].trim())} story`;
383
+ const fixtureLookup = compactIntent.match(/\b(?:where\s+(?:are|is)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(?:test\s+)?fixtures?\s+(?:for|of)\s+(.+?)$/i);
384
+ if (fixtureLookup?.[1])
385
+ return `${unwrapTarget(fixtureLookup[1].trim())} fixtures`;
386
+ const mockUsage = compactIntent.match(/\bwhich\s+mocks?\s+(?:are\s+)?(?:used|configured)\s+(?:for|by|in)\s+(.+?)$/i);
387
+ if (mockUsage?.[1])
388
+ return `${unwrapTarget(mockUsage[1].trim())} mocks`;
389
+ const factoryLookup = compactIntent.match(/\b(?:find|locate|search(?:\s+for)?|lookup|where\s+(?:are|is))\s+(?:the\s+)?(?:factories?|factory)\s+(?:for|of)\s+(.+?)$/i);
390
+ if (factoryLookup?.[1])
391
+ return `${unwrapTarget(factoryLookup[1].trim())} factory`;
392
+ return undefined;
393
+ }
394
+ function extractAuthorizationQuery(intent) {
395
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
396
+ const rbac = compactIntent.match(/\brbac\b/i);
397
+ if (rbac)
398
+ return rbac[0].toUpperCase();
399
+ const permissionScope = compactIntent.match(/\b(?:where\s+(?:are|is)|which|what|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?permissions?\s+(?:checked\s+)?(?:for|on|in)\s+(.+?)$/i);
400
+ if (permissionScope?.[1])
401
+ return `${unwrapTarget(permissionScope[1].trim())} permissions`;
402
+ const roleAccess = compactIntent.match(/\b(?:which|what)\s+roles?\s+(?:can\s+)?access\s+(.+?)$/i);
403
+ if (roleAccess?.[1])
404
+ return `${unwrapTarget(roleAccess[1].trim())} role access`;
405
+ const guard = compactIntent.match(/\b(?:what|which|where\s+(?:are|is))\s+guards?\s+(?:the\s+)?(.+?)$/i);
406
+ if (guard?.[1])
407
+ return `${unwrapTarget(guard[1].trim())} guard`;
408
+ const policy = compactIntent.match(/\b(?:find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(?:authorization\s+)?polic(?:y|ies)\s+(?:for|on|in)\s+(.+?)$/i);
409
+ if (policy?.[1])
410
+ return `${unwrapTarget(policy[1].trim())} authorization policy`;
411
+ if (/\b(?:what|which)\s+routes?\s+(?:require|requires|required)\s+login\b/i.test(compactIntent))
412
+ return 'login routes';
413
+ if (/\bwhere\s+(?:is|are)\s+login\s+required\b/i.test(compactIntent))
414
+ return 'login required';
415
+ return undefined;
416
+ }
417
+ function extractReliabilityQuery(intent) {
418
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
419
+ return firstQuery(compactIntent, [
420
+ extractRateLimitQuery,
421
+ extractCacheQuery,
422
+ extractRetryQuery,
423
+ extractTimeoutQuery,
424
+ extractResiliencePatternQuery,
425
+ ]);
426
+ }
427
+ function extractRateLimitQuery(compactIntent) {
428
+ const scopedRateLimit = compactIntent.match(/\b(?:what|which)\s+rate\s+limits?\s+(?:protects?|guards?|apply\s+to|for)\s+(.+?)$/i);
429
+ if (scopedRateLimit?.[1])
430
+ return `${unwrapTarget(scopedRateLimit[1].trim())} rate limits`;
431
+ if (/\brate\s+limiting\b/i.test(compactIntent))
432
+ return 'rate limiting';
433
+ if (/\brate\s+limits?\b/i.test(compactIntent))
434
+ return 'rate limits';
435
+ if (/\bthrottl(?:e|ing)\b/i.test(compactIntent))
436
+ return 'throttling';
437
+ return undefined;
438
+ }
439
+ function extractCacheQuery(compactIntent) {
440
+ const cacheFor = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?cache\s+(?:invalidated|cleared|expired|refreshed)\s+(?:for|on|in)\s+(.+?)$/i);
441
+ if (cacheFor?.[1])
442
+ return `${unwrapTarget(cacheFor[1].trim())} cache invalidation`;
443
+ const invalidatesCache = compactIntent.match(/\bwhat\s+invalidates\s+(?:the\s+)?(.+?)\s+cache$/i);
444
+ if (invalidatesCache?.[1])
445
+ return `${unwrapTarget(invalidatesCache[1].trim())} cache invalidation`;
446
+ const cacheConfigured = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(.+?\b(?:cache|redis)\b)\s+(?:configured|defined|created|used|handled)$/i);
447
+ if (cacheConfigured?.[1])
448
+ return unwrapTarget(cacheConfigured[1].trim());
449
+ return undefined;
450
+ }
451
+ function extractRetryQuery(compactIntent) {
452
+ const retryFor = compactIntent.match(/\b(?:find|locate|search(?:\s+for)?|lookup|where\s+(?:is|are))\s+(?:the\s+)?(?:retry|retries|backoff)\s+(?:logic\s+)?(?:for|on|in)\s+(.+?)$/i);
453
+ if (retryFor?.[1])
454
+ return `${unwrapTarget(retryFor[1].trim())} retry logic`;
455
+ const retriesTarget = compactIntent.match(/\b(?:which|what)\s+(?:code\s+)?retries\s+(.+?)$/i);
456
+ if (retriesTarget?.[1])
457
+ return `${unwrapTarget(retriesTarget[1].trim())} retries`;
458
+ if (/\bbackoff\b/i.test(compactIntent))
459
+ return 'backoff';
460
+ if (/\bretr(?:y|ies|ied)\b/i.test(compactIntent))
461
+ return 'retry logic';
462
+ return undefined;
463
+ }
464
+ function extractTimeoutQuery(compactIntent) {
465
+ const timeoutFor = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?timeouts?\s+(?:configured|defined|set)?\s*(?:for|on|in)\s+(.+?)$/i);
466
+ if (timeoutFor?.[1])
467
+ return `${unwrapTarget(timeoutFor[1].trim())} timeout`;
468
+ const timeoutTarget = compactIntent.match(/\b(?:what|which)\s+sets?\s+(.+?\btimeouts?)$/i);
469
+ if (timeoutTarget?.[1])
470
+ return unwrapTarget(timeoutTarget[1].trim());
471
+ return undefined;
472
+ }
473
+ function extractResiliencePatternQuery(compactIntent) {
474
+ if (/\bcircuit\s+breaker\b/i.test(compactIntent))
475
+ return 'circuit breaker';
476
+ const idempotency = compactIntent.match(/\b(?:find|locate|search(?:\s+for)?|lookup|where\s+(?:is|are))\s+(?:the\s+)?(.+?\bidempotenc(?:y|e)\b.*|idempotent\s+.+?)$/i);
477
+ if (idempotency?.[1])
478
+ return unwrapTarget(idempotency[1].trim());
479
+ if (/\bwebhook\b/i.test(compactIntent) &&
480
+ /\bsignatures?\b/i.test(compactIntent) &&
481
+ /\b(?:verified|verify|verification)\b/i.test(compactIntent)) {
482
+ return 'webhook signature verification';
483
+ }
484
+ if (/\bdebounce(?:d)?\b/i.test(compactIntent))
485
+ return 'debounce';
486
+ return undefined;
487
+ }
488
+ function extractDataContractQuery(intent) {
489
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
490
+ return firstQuery(compactIntent, [
491
+ extractValidationQuery,
492
+ extractSerializationQuery,
493
+ extractDatabaseConsistencyQuery,
494
+ extractPaginationQuery,
495
+ ]);
496
+ }
497
+ function extractValidationQuery(compactIntent) {
498
+ const inputValidation = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?input\s+validation\s+(?:for|on|in)\s+(.+?)$/i);
499
+ if (inputValidation?.[1])
500
+ return `${unwrapTarget(inputValidation[1].trim())} input validation`;
501
+ const schemaValidation = compactIntent.match(/\b(?:which|what|where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(?:zod\s+)?schemas?\s+(?:validates?|for|of)\s+(.+?)$/i);
502
+ if (schemaValidation?.[1])
503
+ return `${unwrapTarget(schemaValidation[1].trim())} validation schema`;
504
+ const validationTarget = compactIntent.match(/\b(?:what|which)\s+validates?\s+(.+?)$/i);
505
+ if (validationTarget?.[1]) {
506
+ const target = unwrapTarget(validationTarget[1].trim());
507
+ if (/\buniqueness\b/i.test(target))
508
+ return `${target} validation`;
509
+ return `${target} validation`;
510
+ }
511
+ if (/\brequest\s+params?\s+(?:are\s+)?parsed\b/i.test(compactIntent))
512
+ return 'request params parsing';
513
+ if (/\bquery\s+params?\b/i.test(compactIntent))
514
+ return 'query params parsing';
515
+ return undefined;
516
+ }
517
+ function extractSerializationQuery(compactIntent) {
518
+ const serializesResponse = compactIntent.match(/\b(?:what|which)\s+serializes?\s+(.+?\bresponse)\b/i);
519
+ if (serializesResponse?.[1])
520
+ return `${unwrapTarget(serializesResponse[1].trim())} serialization`;
521
+ const serialization = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(.+?\b(?:serialization|formatting|format)\b)(?:\s+(?:handled|defined|configured))?$/i);
522
+ if (serialization?.[1])
523
+ return unwrapTarget(serialization[1].trim());
524
+ return undefined;
525
+ }
526
+ function extractDatabaseConsistencyQuery(compactIntent) {
527
+ if (/\bdatabase\s+transactions?\b/i.test(compactIntent))
528
+ return 'database transaction';
529
+ const transactionTarget = compactIntent.match(/\b(?:what|which)\s+wraps?\s+(.+?)\s+in\s+(?:a\s+)?transactions?\b/i);
530
+ if (transactionTarget?.[1])
531
+ return `${unwrapTarget(transactionTarget[1].trim())} transaction`;
532
+ const rowLock = compactIntent.match(/\b(?:where\s+(?:do|does|is|are)(?:\s+we)?|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(?:code\s+that\s+)?locks?\s+(?:the\s+)?(.+?\brow)\b/i);
533
+ if (rowLock?.[1])
534
+ return `${unwrapTarget(rowLock[1].trim())} lock`;
535
+ if (/\boptimistic\s+locking\b/i.test(compactIntent))
536
+ return 'optimistic locking';
537
+ const uniquenessFor = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?uniqueness\s+(?:enforced|validated|checked)\s+(?:for|on|in)\s+(.+?)$/i);
538
+ if (uniquenessFor?.[1])
539
+ return `${unwrapTarget(uniquenessFor[1].trim())} uniqueness`;
540
+ return undefined;
541
+ }
542
+ function extractPaginationQuery(compactIntent) {
543
+ if (/\bpagination\b/i.test(compactIntent) && /\bcursors?\b/i.test(compactIntent))
544
+ return 'pagination cursors';
545
+ if (/\bpagination\b/i.test(compactIntent))
546
+ return 'pagination';
547
+ return undefined;
548
+ }
549
+ function extractUiInteractionQuery(intent) {
550
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
551
+ return uiInteractionFromRules(compactIntent) ?? fixedUiInteractionQuery(compactIntent);
552
+ }
553
+ const UI_INTERACTION_RULES = [
554
+ {
555
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(.+?)\s+forms?\s+(?:submitted|submit|handled)\b/i,
556
+ suffix: 'form submit',
557
+ },
558
+ {
559
+ pattern: /\b(?:what|which)\s+handles?\s+forms?\s+submit\s+(?:for|on|in)\s+(.+?)$/i,
560
+ suffix: 'form submit',
561
+ },
562
+ {
563
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?loading\s+state\s+(?:for|on|in)\s+(.+?)$/i,
564
+ suffix: 'loading state',
565
+ },
566
+ {
567
+ pattern: /\b(?:what|which)\s+renders?\s+empty\s+state\s+(?:for|of)\s+(.+?)$/i,
568
+ suffix: 'empty state',
569
+ },
570
+ {
571
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?error\s+boundary\s+(?:for|on|in)\s+(.+?)$/i,
572
+ suffix: 'error boundary',
573
+ },
574
+ {
575
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?toast(?:\s+(?:shown|displayed|triggered))?\s+(?:after|for|on|in)\s+(.+?)$/i,
576
+ suffix: 'toast',
577
+ },
578
+ {
579
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?keyboard\s+shortcuts?\s+(?:for|on)\s+(.+?)$/i,
580
+ suffix: 'keyboard shortcut',
581
+ },
582
+ {
583
+ pattern: /\b(?:what|which)\s+component\s+renders?\s+(?:the\s+)?(.+?)\s+page$/i,
584
+ suffix: 'page component',
585
+ },
586
+ {
587
+ pattern: /\b(?:where\s+(?:are|is)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(?:i18n\s+)?translations?\s+(?:for|of)\s+(.+?)$/i,
588
+ suffix: 'translations',
589
+ },
590
+ {
591
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?aria\s+labels?\s+(?:for|on)\s+(.+?)$/i,
592
+ suffix: 'aria label',
593
+ },
594
+ {
595
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?modal\s+(?:opened|shown|displayed)\s+(?:for|on)\s+(.+?)$/i,
596
+ suffix: 'modal',
597
+ },
598
+ ];
599
+ function uiInteractionFromRules(compactIntent) {
600
+ for (const rule of UI_INTERACTION_RULES) {
601
+ const match = compactIntent.match(rule.pattern);
602
+ if (match?.[1])
603
+ return `${unwrapTarget(match[1].trim())} ${rule.suffix}`;
604
+ }
605
+ return undefined;
606
+ }
607
+ function fixedUiInteractionQuery(compactIntent) {
608
+ if (/\bcommand\s+palette\s+actions?\b/i.test(compactIntent))
609
+ return 'command palette actions';
610
+ if (/\bfocus\s+trap\b/i.test(compactIntent))
611
+ return 'focus trap';
612
+ return undefined;
613
+ }
614
+ function extractStyleSystemQuery(intent) {
615
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
616
+ if (/\b(?:why|failing|failed|failure|failures|broken|error|errors|runtime|production|prod|outage|incident)\b/i.test(compactIntent)) {
617
+ return undefined;
618
+ }
619
+ if (/\bdesign\s+tokens?\b/i.test(compactIntent))
620
+ return 'design tokens';
621
+ if (/\btailwind\s+themes?\b/i.test(compactIntent))
622
+ return 'Tailwind theme';
623
+ if (/\bglobal\s+css\b/i.test(compactIntent))
624
+ return 'global CSS';
625
+ const cssModule = compactIntent.match(/\b(?:which|what)\s+css\s+modules?\s+styles?\s+(.+?)$/i);
626
+ if (cssModule?.[1])
627
+ return `${unwrapTarget(cssModule[1].trim())} CSS module`;
628
+ if (/\bdark\s+mode\b/i.test(compactIntent))
629
+ return 'dark mode';
630
+ if (/\bbreakpoints?\b/i.test(compactIntent))
631
+ return 'breakpoints';
632
+ return undefined;
633
+ }
634
+ function extractNavigationLayoutQuery(intent) {
635
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
636
+ const sidebarNav = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(?:sidebar\s+)?(?:nav|navigation|menu)\s+items?\s+(?:for|of|on|in)\s+(.+?)$/i);
637
+ if (sidebarNav?.[1])
638
+ return `${unwrapTarget(sidebarNav[1].trim())} sidebar nav item`;
639
+ const breadcrumb = compactIntent.match(/\b(?:which|what)\s+breadcrumbs?\s+(?:renders?|shows?|for|of)\s+(.+?)$/i);
640
+ if (breadcrumb?.[1])
641
+ return `${unwrapTarget(breadcrumb[1].trim())} breadcrumb`;
642
+ const pageTitle = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?page\s+(?:title|metadata|meta)\s+(?:set|sets|defined|configured)\s+(?:for|of|on|in)\s+(.+?)$/i);
643
+ if (pageTitle?.[1])
644
+ return `${unwrapTarget(pageTitle[1].trim())} page title`;
645
+ const nextLayout = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?next(?:\.js|js)?\s+layouts?\s+(?:for|of|on|in)\s+(.+?)$/i);
646
+ if (nextLayout?.[1])
647
+ return `${unwrapTarget(nextLayout[1].trim())} Next.js layout`;
648
+ return undefined;
649
+ }
650
+ function extractFrontendPageRouteQuery(intent) {
651
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
652
+ if (/\b(?:why|returning|returns|failing|failed|failure|failures|production|prod|down|outage|incident|runtime|crash|crashes|crashing)\b/i.test(compactIntent)) {
653
+ return undefined;
654
+ }
655
+ const pathPage = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(\/[A-Za-z0-9_./:{}-]+)\s+pages?\s+(?:rendered|handled|defined|located|live|lives)\b/i);
656
+ if (pathPage?.[1])
657
+ return `${pathPage[1].trim()} page`;
658
+ const pageRendersPath = compactIntent.match(/\b(?:which|what)\s+pages?\s+(?:renders?|shows?)\s+(\/[A-Za-z0-9_./:{}-]+)\b/i);
659
+ if (pageRendersPath?.[1])
660
+ return `${pageRendersPath[1].trim()} page`;
661
+ const routeSegment = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?routes?\s+segments?\s+(?:for|of|on|in)\s+(.+?)$/i);
662
+ if (routeSegment?.[1])
663
+ return `${unwrapTarget(routeSegment[1].trim())} route segment`;
664
+ if (/\bnot[-\s]?found\s+pages?\s+(?:handled|defined|located|live|lives)\b/i.test(compactIntent))
665
+ return 'not-found page';
666
+ if (/\b404\s+pages?\s+(?:handled|defined|located|live|lives)\b/i.test(compactIntent))
667
+ return '404 page';
668
+ return undefined;
669
+ }
670
+ function extractStateManagementQuery(intent) {
671
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
672
+ if (/\b(?:pii|gdpr|secret|secrets|token|tokens|password|customer|personal|leak|leaks|leaking|security|retention)\b/i.test(compactIntent))
673
+ return undefined;
674
+ return stateManagementFromRules(compactIntent) ?? frameworkStoreQuery(compactIntent);
675
+ }
676
+ const STATE_MANAGEMENT_RULES = [
677
+ {
678
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(.+?)\s+state\s+(?:stored|store|stores)\b/i,
679
+ suffix: 'state store',
680
+ },
681
+ {
682
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?redux\s+slices?\s+(?:for|of|on|in)\s+(.+?)$/i,
683
+ suffix: 'Redux slice',
684
+ },
685
+ {
686
+ pattern: /\b(?:which|what|where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:context\s+)?providers?\s+(?:supplies|supplied|provides|provided|for|of)\s+(.+?)$/i,
687
+ suffix: 'context provider',
688
+ },
689
+ {
690
+ pattern: /\b(?:which|what)\s+hooks?\s+(?:fetch|fetches|loads?|queries?)\s+(.+?)$/i,
691
+ suffix: 'hook',
692
+ },
693
+ {
694
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?react\s+query\s+mutations?\s+(?:for|of|on|in)\s+(.+?)$/i,
695
+ suffix: 'React Query mutation',
696
+ },
697
+ {
698
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?react\s+query\s+quer(?:y|ies)\s+(?:for|of|on|in)\s+(.+?)$/i,
699
+ suffix: 'React Query query',
700
+ },
701
+ ];
702
+ function stateManagementFromRules(compactIntent) {
703
+ for (const rule of STATE_MANAGEMENT_RULES) {
704
+ const match = compactIntent.match(rule.pattern);
705
+ if (match?.[1])
706
+ return `${unwrapTarget(match[1].trim())} ${rule.suffix}`;
707
+ }
708
+ return undefined;
709
+ }
710
+ function frameworkStoreQuery(compactIntent) {
711
+ const frameworkStore = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(redux|zustand|jotai|recoil)\s+stores?\s+(?:for|of|on|in)\s+(.+?)$/i);
712
+ if (frameworkStore?.[1] && frameworkStore[2]) {
713
+ return `${unwrapTarget(frameworkStore[2].trim())} ${normalizeStateFramework(frameworkStore[1])} store`;
714
+ }
715
+ return undefined;
716
+ }
717
+ function extractDataAccessQuery(intent) {
718
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
719
+ if (/\b(?:sink|sinks|source|taint|injection|xss|vulnerability|security|sanitize|sanitized|reach|reaches|drop|delete|remove)\b/i.test(compactIntent))
720
+ return undefined;
721
+ return ormModelQuery(compactIntent) ?? dataAccessFromRules(compactIntent);
722
+ }
723
+ function ormModelQuery(compactIntent) {
724
+ const ormModel = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(prisma|drizzle|typeorm|sequelize)\s+(models?|schemas?|entities?)\s+(?:for|of|on|in)\s+(.+?)$/i);
725
+ if (ormModel?.[1] && ormModel[2] && ormModel[3]) {
726
+ return `${unwrapTarget(ormModel[3].trim())} ${normalizeDataAccessFramework(ormModel[1])} ${normalizeDataAccessArtifact(ormModel[2])}`;
727
+ }
728
+ return undefined;
729
+ }
730
+ const DATA_ACCESS_RULES = [
731
+ {
732
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?sql\s+quer(?:y|ies)\s+(?:for|of|on|in)\s+(.+?)$/i,
733
+ format: (match) => (match[1] ? `${unwrapTarget(match[1].trim())} SQL query` : undefined),
734
+ },
735
+ {
736
+ pattern: /\b(?:which|what)\s+(?:repository|repositories|dao|daos)\s+(?:saves?|persists?)\s+(.+?)$/i,
737
+ format: (match) => (match[1] ? `${unwrapTarget(match[1].trim())} repository` : undefined),
738
+ },
739
+ {
740
+ pattern: /\b(?:find|locate|search(?:\s+for)?|lookup|where\s+(?:is|are))\s+(?:the\s+)?(repository|repositories|dao|daos)\s+(?:for|of|on|in)\s+(.+?)$/i,
741
+ format: (match) => match[1] && match[2]
742
+ ? `${unwrapTarget(match[2].trim())} ${/^dao/i.test(match[1]) ? 'DAO' : 'repository'}`
743
+ : undefined,
744
+ },
745
+ ];
746
+ function dataAccessFromRules(compactIntent) {
747
+ for (const rule of DATA_ACCESS_RULES) {
748
+ const match = compactIntent.match(rule.pattern);
749
+ const query = match ? rule.format(match) : undefined;
750
+ if (query)
751
+ return query;
752
+ }
753
+ return undefined;
754
+ }
755
+ function extractIntegrationQuery(intent) {
756
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
757
+ return firstQuery(compactIntent, [
758
+ serviceCallIntegrationQuery,
759
+ emailProviderIntegrationQuery,
760
+ storageUploadIntegrationQuery,
761
+ serviceClientIntegrationQuery,
762
+ graphQlIntegrationQuery,
763
+ websocketIntegrationQuery,
764
+ ]);
765
+ }
766
+ function serviceCallIntegrationQuery(compactIntent) {
767
+ const serviceCall = compactIntent.match(/\bwhere\s+(?:do|does)\s+(?:we\s+)?calls?\s+(.+?)$/i);
768
+ if (serviceCall?.[1]) {
769
+ const service = canonicalIntegrationTarget(serviceCall[1]);
770
+ if (service)
771
+ return `${service} API`;
772
+ }
773
+ return undefined;
774
+ }
775
+ function emailProviderIntegrationQuery(compactIntent) {
776
+ const emailProvider = compactIntent.match(/\b(?:which|what)\s+(?:code\s+)?sends?\s+email\s+(?:through|via|with|using)\s+(.+?)$/i);
777
+ if (emailProvider?.[1]) {
778
+ const service = canonicalIntegrationTarget(emailProvider[1]);
779
+ if (service)
780
+ return `${service} email`;
781
+ }
782
+ return undefined;
783
+ }
784
+ function storageUploadIntegrationQuery(compactIntent) {
785
+ const storageUpload = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(.+?\bs3\b.*?)\s+(?:upload|uploads|uploaded|implemented|handled|configured)\b/i);
786
+ if (storageUpload?.[1] && /\bs3\b/i.test(storageUpload[1]))
787
+ return 'S3 upload';
788
+ return undefined;
789
+ }
790
+ function serviceClientIntegrationQuery(compactIntent) {
791
+ const serviceClient = compactIntent.match(/\b(?:find|locate|search(?:\s+for)?|lookup|where\s+(?:is|are))\s+(?:the\s+)?(.+?\b(?:api\s+client|client|sdk)\b)$/i);
792
+ if (serviceClient?.[1] && isIntegrationTarget(serviceClient[1]))
793
+ return normalizeIntegrationPhrase(serviceClient[1]);
794
+ return undefined;
795
+ }
796
+ function graphQlIntegrationQuery(compactIntent) {
797
+ const graphQuery = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?graphql\s+quer(?:y|ies)\s+(?:for|of)\s+(.+?)$/i);
798
+ if (graphQuery?.[1])
799
+ return `${unwrapTarget(graphQuery[1].trim())} GraphQL query`;
800
+ return undefined;
801
+ }
802
+ function websocketIntegrationQuery(compactIntent) {
803
+ if (/\bwebsockets?\s+connections?\b/i.test(compactIntent) ||
804
+ /\bwebsockets?\s+connection\s+opened\b/i.test(compactIntent))
805
+ return 'websocket connection';
806
+ return undefined;
807
+ }
808
+ function extractApiContractQuery(intent) {
809
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
810
+ return (fixedApiContractQuery(compactIntent) ??
811
+ apiContractFromRules(compactIntent) ??
812
+ graphQlSchemaQuery(compactIntent));
813
+ }
814
+ function fixedApiContractQuery(compactIntent) {
815
+ if (/\bopenapi\b/i.test(compactIntent) && /\bspecs?\b/i.test(compactIntent))
816
+ return 'OpenAPI spec';
817
+ if (/\bswagger\b/i.test(compactIntent) && /\bdocs?\b/i.test(compactIntent))
818
+ return 'Swagger docs';
819
+ return undefined;
820
+ }
821
+ const API_CONTRACT_RULES = [
822
+ {
823
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?trpc\s+routers?\s+(?:for|of|on|in)\s+(.+?)$/i,
824
+ suffix: 'tRPC router',
825
+ },
826
+ {
827
+ pattern: /\b(?:which|what)\s+graphql\s+resolvers?\s+(?:handles?|for|of)\s+(.+?)$/i,
828
+ suffix: 'GraphQL resolver',
829
+ },
830
+ { pattern: /\b(?:which|what)\s+(?:protobuf|proto)\s+defines?\s+(.+?)$/i, suffix: 'protobuf' },
831
+ {
832
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?grpc\s+clients?\s+(?:for|of|on|in)\s+(.+?)$/i,
833
+ suffix: 'gRPC client',
834
+ },
835
+ ];
836
+ function apiContractFromRules(compactIntent) {
837
+ for (const rule of API_CONTRACT_RULES) {
838
+ const match = compactIntent.match(rule.pattern);
839
+ if (match?.[1])
840
+ return `${unwrapTarget(match[1].trim())} ${rule.suffix}`;
841
+ }
842
+ return undefined;
843
+ }
844
+ function graphQlSchemaQuery(compactIntent) {
845
+ const graphqlSchema = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?graphql\s+schemas?\s*(?:for|of)?\s*(.*?)$/i);
846
+ if (graphqlSchema) {
847
+ const target = unwrapTarget((graphqlSchema[1] ?? '').trim());
848
+ return target ? `${target} GraphQL schema` : 'GraphQL schema';
849
+ }
850
+ return undefined;
851
+ }
852
+ function extractInfraArtifactQuery(intent) {
853
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
854
+ return (fixedInfraArtifactQuery(compactIntent) ??
855
+ dockerComposeQuery(compactIntent) ??
856
+ infraArtifactFromRules(compactIntent));
857
+ }
858
+ function fixedInfraArtifactQuery(compactIntent) {
859
+ if (/\bdockerfile\b/i.test(compactIntent))
860
+ return 'Dockerfile';
861
+ if (/\b(?:kubernetes|k8s)\b/i.test(compactIntent) && /\bmanifests?\b/i.test(compactIntent))
862
+ return 'Kubernetes manifests';
863
+ return undefined;
864
+ }
865
+ function dockerComposeQuery(compactIntent) {
866
+ const dockerCompose = compactIntent.match(/\bdocker\s+compose(?:\s+(?:for|of)\s+(.+?))?$/i);
867
+ if (dockerCompose) {
868
+ const target = unwrapTarget((dockerCompose[1] ?? '').trim());
869
+ return target ? `${target} docker compose` : 'docker compose';
870
+ }
871
+ return undefined;
872
+ }
873
+ const INFRA_ARTIFACT_RULES = [
874
+ {
875
+ pattern: /\b(?:find|locate|search(?:\s+for)?|lookup|where\s+(?:is|are))\s+(?:the\s+)?helm\s+charts?\s+(?:for|of|on|in)\s+(.+?)$/i,
876
+ format: (match) => (match[1] ? `${unwrapTarget(match[1].trim())} Helm chart` : undefined),
877
+ },
878
+ {
879
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?terraform\s+modules?\s+(?:for|of|on|in)\s+(.+?)$/i,
880
+ format: (match) => match[1] ? `${normalizeInfraTarget(match[1])} Terraform module` : undefined,
881
+ },
882
+ {
883
+ pattern: /\b(?:which|what|where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+github\s+workflows?\s+(?:deploys?|for|of|on|in)\s+(.+?)$/i,
884
+ format: (match) => (match[1] ? `${unwrapTarget(match[1].trim())} GitHub workflow` : undefined),
885
+ },
886
+ {
887
+ pattern: /\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(vercel|netlify|railway|fly)\s+config(?:uration)?$/i,
888
+ format: (match) => (match[1] ? `${normalizeInfraTarget(match[1])} config` : undefined),
889
+ },
890
+ ];
891
+ function infraArtifactFromRules(compactIntent) {
892
+ for (const rule of INFRA_ARTIFACT_RULES) {
893
+ const match = compactIntent.match(rule.pattern);
894
+ const query = match ? rule.format(match) : undefined;
895
+ if (query)
896
+ return query;
897
+ }
898
+ return undefined;
899
+ }
900
+ function extractToolingConfigQuery(intent) {
901
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
902
+ if (/\b(?:why|failing|failed|failure|failures|broken|error|errors|runtime|production|prod|outage|incident)\b/i.test(compactIntent)) {
903
+ return undefined;
904
+ }
905
+ return toolingConfigFromRules(compactIntent) ?? lockfileQuery(compactIntent);
906
+ }
907
+ const TOOLING_CONFIG_RULES = [
908
+ {
909
+ pattern: /\btsconfig\b(?=.*\b(?:path|paths|alias|aliases)\b)/i,
910
+ query: 'tsconfig path aliases',
911
+ },
912
+ { pattern: /\bvitest\b(?=.*\bconfig(?:uration)?\b)/i, query: 'Vitest config' },
913
+ { pattern: /\bjest\b(?=.*\bconfig(?:uration)?\b)/i, query: 'Jest config' },
914
+ { pattern: /\bbabel\b(?=.*\bconfig(?:uration)?\b)/i, query: 'Babel config' },
915
+ { pattern: /\bwebpack\b(?=.*\bconfig(?:uration)?\b)/i, query: 'webpack config' },
916
+ { pattern: /\bpackage\s+manager\b/i, query: 'package manager' },
917
+ { pattern: /\bpnpm\s+workspaces?\b/i, query: 'pnpm workspace' },
918
+ { pattern: /\byarn\s+workspaces?\b/i, query: 'yarn workspace' },
919
+ ];
920
+ function toolingConfigFromRules(compactIntent) {
921
+ return TOOLING_CONFIG_RULES.find((rule) => rule.pattern.test(compactIntent))?.query;
922
+ }
923
+ function lockfileQuery(compactIntent) {
924
+ if (/\b(?:npm|pnpm|yarn)\s+lockfiles?\b/i.test(compactIntent)) {
925
+ const manager = compactIntent.match(/\b(npm|pnpm|yarn)\b/i)?.[1]?.toLowerCase();
926
+ return manager ? `${manager} lockfile` : 'lockfile';
927
+ }
928
+ return undefined;
929
+ }
930
+ function extractDomainWorkflowQuery(intent) {
931
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
932
+ if (/\bpassword\s+reset\b/i.test(compactIntent))
933
+ return 'password reset';
934
+ const invite = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(.+?\binvite\s+flow)\b/i);
935
+ if (invite?.[1])
936
+ return unwrapTarget(invite[1].trim());
937
+ if (/\bonboarding\s+flow\b/i.test(compactIntent))
938
+ return 'onboarding flow';
939
+ const csvExport = compactIntent.match(/\b(?:find|locate|search(?:\s+for)?|lookup|where\s+(?:is|are))\s+(?:the\s+)?csv\s+exports?\s+(?:for|of)\s+(.+?)$/i);
940
+ if (csvExport?.[1])
941
+ return `${unwrapTarget(csvExport[1].trim())} CSV export`;
942
+ if (/\baudit\s+logs?\s+entries\b/i.test(compactIntent) ||
943
+ /\baudit\s+log\s+entries\b/i.test(compactIntent))
944
+ return 'audit log entries';
945
+ const refund = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?refund\s+handling\s+(?:for|of|on|in)\s+(.+?)$/i);
946
+ if (refund?.[1])
947
+ return `${unwrapTarget(refund[1].trim())} refund handling`;
948
+ if (/\bsubscription\s+renewal\b/i.test(compactIntent))
949
+ return 'subscription renewal';
950
+ return undefined;
951
+ }
952
+ function extractCommunicationArtifactQuery(intent) {
953
+ const compactIntent = intent.trim().replace(/[?!.\s]+$/g, '');
954
+ const welcomeEmail = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(.+?\bemail\s+templates?)\b/i);
955
+ if (welcomeEmail?.[1])
956
+ return unwrapTarget(welcomeEmail[1].trim());
957
+ const emailCopy = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?(.+?\bemail\s+copy)\b/i);
958
+ if (emailCopy?.[1])
959
+ return unwrapTarget(emailCopy[1].trim());
960
+ const pushCopy = compactIntent.match(/\b(?:where\s+(?:is|are)|find|locate|search(?:\s+for)?|lookup)\s+(?:the\s+)?push\s+notifications?\s+copy\s+(?:for|of)\s+(.+?)$/i);
961
+ if (pushCopy?.[1])
962
+ return `${unwrapTarget(pushCopy[1].trim())} push notification copy`;
963
+ if (/\bsms\s+verification\s+templates?\b/i.test(compactIntent))
964
+ return 'SMS verification template';
965
+ if (/\breceipt\s+email\b/i.test(compactIntent) && /\btemplates?\b/i.test(compactIntent))
966
+ return 'receipt email template';
967
+ if (/\binvoice\s+pdf\b/i.test(compactIntent))
968
+ return 'invoice PDF';
969
+ return undefined;
970
+ }
971
+ function normalizeInfraTarget(value) {
972
+ return unwrapTarget(value.trim())
973
+ .replace(/\bs3\b/gi, 'S3')
974
+ .replace(/\bvercel\b/gi, 'Vercel')
975
+ .replace(/\bnetlify\b/gi, 'Netlify')
976
+ .replace(/\brailway\b/gi, 'Railway')
977
+ .replace(/\bfly\b/gi, 'Fly');
978
+ }
979
+ function canonicalIntegrationTarget(value) {
980
+ const target = unwrapTarget(value.trim()).replace(/^the\s+/i, '');
981
+ if (!isIntegrationTarget(target))
982
+ return undefined;
983
+ const lower = target.toLowerCase();
984
+ if (lower === 'stripe')
985
+ return 'Stripe';
986
+ if (lower === 'sendgrid')
987
+ return 'SendGrid';
988
+ if (lower === 's3' || lower === 'aws s3')
989
+ return 'S3';
990
+ if (lower === 'github')
991
+ return 'GitHub';
992
+ if (lower === 'graphql')
993
+ return 'GraphQL';
994
+ return target;
995
+ }
996
+ function normalizeIntegrationPhrase(value) {
997
+ return value
998
+ .trim()
999
+ .replace(/\bgithub\b/gi, 'GitHub')
1000
+ .replace(/\bgraphql\b/gi, 'GraphQL')
1001
+ .replace(/\bstripe\b/gi, 'Stripe')
1002
+ .replace(/\bsendgrid\b/gi, 'SendGrid')
1003
+ .replace(/\bs3\b/gi, 'S3');
1004
+ }
1005
+ function normalizeStateFramework(value) {
1006
+ return value
1007
+ .trim()
1008
+ .replace(/\bredux\b/gi, 'Redux')
1009
+ .replace(/\bzustand\b/gi, 'Zustand')
1010
+ .replace(/\bjotai\b/gi, 'Jotai')
1011
+ .replace(/\brecoil\b/gi, 'Recoil');
1012
+ }
1013
+ function normalizeDataAccessFramework(value) {
1014
+ return value
1015
+ .trim()
1016
+ .replace(/\bprisma\b/gi, 'Prisma')
1017
+ .replace(/\bdrizzle\b/gi, 'Drizzle')
1018
+ .replace(/\btypeorm\b/gi, 'TypeORM')
1019
+ .replace(/\bsequelize\b/gi, 'Sequelize');
1020
+ }
1021
+ function normalizeDataAccessArtifact(value) {
1022
+ const lower = value.trim().toLowerCase();
1023
+ if (lower.startsWith('entit'))
1024
+ return 'entity';
1025
+ if (lower.startsWith('schem'))
1026
+ return 'schema';
1027
+ return 'model';
1028
+ }
1029
+ function isIntegrationTarget(value) {
1030
+ return /\b(?:stripe|sendgrid|s3|aws\s+s3|github|graphql|websocket|websockets?|axios|fetch|rest|http|api\s+client|client|sdk)\b/i.test(value);
1031
+ }
1032
+ export function isFilePathTarget(target) {
1033
+ return ((target.includes('/') || target.startsWith('.') || /\.[A-Za-z0-9]{1,12}$/.test(target)) &&
1034
+ !/\s/.test(target));
1035
+ }
1036
+ export function isExactSymbolTarget(target) {
1037
+ return /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)?$/.test(target);
1038
+ }
1039
+ function isIssueIdTarget(target) {
1040
+ return (/^[A-Za-z0-9_:@.-]*[A-Za-z][A-Za-z0-9_:@.-]*-[A-Za-z0-9_:@.-]+$/.test(target) &&
1041
+ !target.includes('/') &&
1042
+ target.toLowerCase() !== 'fix-suggest');
1043
+ }
1044
+ function isPackageNameTarget(target) {
1045
+ const lower = target.toLowerCase();
1046
+ if ([
1047
+ 'package',
1048
+ 'dependency',
1049
+ 'dependencies',
1050
+ 'version',
1051
+ 'latest',
1052
+ 'upgrade',
1053
+ 'bump',
1054
+ 'update',
1055
+ 'for',
1056
+ 'doc',
1057
+ 'docs',
1058
+ 'document',
1059
+ 'documentation',
1060
+ 'documented',
1061
+ 'readme',
1062
+ 'changelog',
1063
+ 'example',
1064
+ 'examples',
1065
+ 'guide',
1066
+ 'should',
1067
+ 'could',
1068
+ 'would',
1069
+ 'can',
1070
+ 'what',
1071
+ 'which',
1072
+ 'the',
1073
+ 'this',
1074
+ 'that',
1075
+ 'it',
1076
+ 'my',
1077
+ ].includes(lower))
1078
+ return false;
1079
+ if (target.length === 0 || target.length > 214 || target !== target.trim())
1080
+ return false;
1081
+ if (target.includes('..') || target.includes('\\'))
1082
+ return false;
1083
+ return /^(?:@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*$/i.test(target);
1084
+ }
1085
+ function normalizePackageName(target) {
1086
+ return target.toLowerCase();
1087
+ }
1088
+ export function isPlaceholder(value) {
1089
+ return /^<[^<>]+>$/.test(value);
1090
+ }
1091
+ export function escapeDoubleQuoted(value) {
1092
+ return value
1093
+ .replace(/\\/g, '\\\\')
1094
+ .replace(/"/g, '\\"')
1095
+ .replace(/\$/g, '\\$')
1096
+ .replace(/`/g, '\\`');
1097
+ }
1098
+ export function quoteShellArg(value) {
1099
+ return /^[A-Za-z0-9_./:@-]+$/.test(value) ? value : `"${escapeDoubleQuoted(value)}"`;
1100
+ }
1101
+ export function quoteShellArgOrPlaceholder(value) {
1102
+ if (isPlaceholder(value))
1103
+ return value;
1104
+ return quoteShellArg(value);
1105
+ }
1106
+ //# sourceMappingURL=startIntentTargets.js.map