patchwork-os 0.2.0-alpha.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 (721) hide show
  1. package/LICENSE +21 -0
  2. package/README.bridge.md +352 -0
  3. package/README.md +72 -0
  4. package/deploy/README.md +172 -0
  5. package/deploy/bootstrap-new-vps.sh +364 -0
  6. package/deploy/claude-ide-bridge.service.template +67 -0
  7. package/deploy/claude-ide-bridge@.service +31 -0
  8. package/deploy/ecosystem.config.js.example +36 -0
  9. package/deploy/install-vps-service.sh +240 -0
  10. package/deploy/nginx-claude-bridge.conf.template +129 -0
  11. package/dist/activityLog.d.ts +112 -0
  12. package/dist/activityLog.js +399 -0
  13. package/dist/activityLog.js.map +1 -0
  14. package/dist/activityTypes.d.ts +28 -0
  15. package/dist/activityTypes.js +9 -0
  16. package/dist/activityTypes.js.map +1 -0
  17. package/dist/adapters/base.d.ts +78 -0
  18. package/dist/adapters/base.js +14 -0
  19. package/dist/adapters/base.js.map +1 -0
  20. package/dist/adapters/claude.d.ts +18 -0
  21. package/dist/adapters/claude.js +276 -0
  22. package/dist/adapters/claude.js.map +1 -0
  23. package/dist/adapters/gemini.d.ts +17 -0
  24. package/dist/adapters/gemini.js +218 -0
  25. package/dist/adapters/gemini.js.map +1 -0
  26. package/dist/adapters/grok.d.ts +7 -0
  27. package/dist/adapters/grok.js +21 -0
  28. package/dist/adapters/grok.js.map +1 -0
  29. package/dist/adapters/index.d.ts +5 -0
  30. package/dist/adapters/index.js +37 -0
  31. package/dist/adapters/index.js.map +1 -0
  32. package/dist/adapters/local.d.ts +7 -0
  33. package/dist/adapters/local.js +22 -0
  34. package/dist/adapters/local.js.map +1 -0
  35. package/dist/adapters/openai.d.ts +22 -0
  36. package/dist/adapters/openai.js +284 -0
  37. package/dist/adapters/openai.js.map +1 -0
  38. package/dist/adapters/sse.d.ts +13 -0
  39. package/dist/adapters/sse.js +58 -0
  40. package/dist/adapters/sse.js.map +1 -0
  41. package/dist/analyticsAggregator.d.ts +28 -0
  42. package/dist/analyticsAggregator.js +133 -0
  43. package/dist/analyticsAggregator.js.map +1 -0
  44. package/dist/analyticsPrefs.d.ts +9 -0
  45. package/dist/analyticsPrefs.js +50 -0
  46. package/dist/analyticsPrefs.js.map +1 -0
  47. package/dist/analyticsSend.d.ts +12 -0
  48. package/dist/analyticsSend.js +34 -0
  49. package/dist/analyticsSend.js.map +1 -0
  50. package/dist/approvalHttp.d.ts +46 -0
  51. package/dist/approvalHttp.js +370 -0
  52. package/dist/approvalHttp.js.map +1 -0
  53. package/dist/approvalQueue.d.ts +49 -0
  54. package/dist/approvalQueue.js +84 -0
  55. package/dist/approvalQueue.js.map +1 -0
  56. package/dist/automation.d.ts +675 -0
  57. package/dist/automation.js +1038 -0
  58. package/dist/automation.js.map +1 -0
  59. package/dist/bridge.d.ts +85 -0
  60. package/dist/bridge.js +1535 -0
  61. package/dist/bridge.js.map +1 -0
  62. package/dist/bridgeLockDiscovery.d.ts +11 -0
  63. package/dist/bridgeLockDiscovery.js +49 -0
  64. package/dist/bridgeLockDiscovery.js.map +1 -0
  65. package/dist/bridgeToken.d.ts +22 -0
  66. package/dist/bridgeToken.js +114 -0
  67. package/dist/bridgeToken.js.map +1 -0
  68. package/dist/bridgeToolsRules.d.ts +20 -0
  69. package/dist/bridgeToolsRules.js +79 -0
  70. package/dist/bridgeToolsRules.js.map +1 -0
  71. package/dist/ccPermissions.d.ts +59 -0
  72. package/dist/ccPermissions.js +163 -0
  73. package/dist/ccPermissions.js.map +1 -0
  74. package/dist/claudeDriver.d.ts +129 -0
  75. package/dist/claudeDriver.js +459 -0
  76. package/dist/claudeDriver.js.map +1 -0
  77. package/dist/claudeMdPatch.d.ts +29 -0
  78. package/dist/claudeMdPatch.js +164 -0
  79. package/dist/claudeMdPatch.js.map +1 -0
  80. package/dist/claudeOrchestrator.d.ts +171 -0
  81. package/dist/claudeOrchestrator.js +591 -0
  82. package/dist/claudeOrchestrator.js.map +1 -0
  83. package/dist/commands/install.d.ts +1 -0
  84. package/dist/commands/install.js +158 -0
  85. package/dist/commands/install.js.map +1 -0
  86. package/dist/commands/marketplace.d.ts +11 -0
  87. package/dist/commands/marketplace.js +120 -0
  88. package/dist/commands/marketplace.js.map +1 -0
  89. package/dist/commands/patchworkInit.d.ts +14 -0
  90. package/dist/commands/patchworkInit.js +155 -0
  91. package/dist/commands/patchworkInit.js.map +1 -0
  92. package/dist/commands/task.d.ts +14 -0
  93. package/dist/commands/task.js +289 -0
  94. package/dist/commands/task.js.map +1 -0
  95. package/dist/commands/tokenEfficiency.d.ts +9 -0
  96. package/dist/commands/tokenEfficiency.js +211 -0
  97. package/dist/commands/tokenEfficiency.js.map +1 -0
  98. package/dist/commands/tools.d.ts +28 -0
  99. package/dist/commands/tools.js +326 -0
  100. package/dist/commands/tools.js.map +1 -0
  101. package/dist/commitIssueLinkLog.d.ts +77 -0
  102. package/dist/commitIssueLinkLog.js +142 -0
  103. package/dist/commitIssueLinkLog.js.map +1 -0
  104. package/dist/companions/registry.d.ts +12 -0
  105. package/dist/companions/registry.js +71 -0
  106. package/dist/companions/registry.js.map +1 -0
  107. package/dist/config.d.ts +105 -0
  108. package/dist/config.js +720 -0
  109. package/dist/config.js.map +1 -0
  110. package/dist/crypto.d.ts +16 -0
  111. package/dist/crypto.js +34 -0
  112. package/dist/crypto.js.map +1 -0
  113. package/dist/dashboard.d.ts +12 -0
  114. package/dist/dashboard.js +149 -0
  115. package/dist/dashboard.js.map +1 -0
  116. package/dist/decisionTraceLog.d.ts +77 -0
  117. package/dist/decisionTraceLog.js +147 -0
  118. package/dist/decisionTraceLog.js.map +1 -0
  119. package/dist/errors.d.ts +32 -0
  120. package/dist/errors.js +34 -0
  121. package/dist/errors.js.map +1 -0
  122. package/dist/extensionClient.d.ts +279 -0
  123. package/dist/extensionClient.js +1253 -0
  124. package/dist/extensionClient.js.map +1 -0
  125. package/dist/fileLock.d.ts +36 -0
  126. package/dist/fileLock.js +121 -0
  127. package/dist/fileLock.js.map +1 -0
  128. package/dist/fp/activityAnalytics.d.ts +39 -0
  129. package/dist/fp/activityAnalytics.js +111 -0
  130. package/dist/fp/activityAnalytics.js.map +1 -0
  131. package/dist/fp/async.d.ts +48 -0
  132. package/dist/fp/async.js +60 -0
  133. package/dist/fp/async.js.map +1 -0
  134. package/dist/fp/automationInterpreter.d.ts +37 -0
  135. package/dist/fp/automationInterpreter.js +523 -0
  136. package/dist/fp/automationInterpreter.js.map +1 -0
  137. package/dist/fp/automationProgram.d.ts +89 -0
  138. package/dist/fp/automationProgram.js +29 -0
  139. package/dist/fp/automationProgram.js.map +1 -0
  140. package/dist/fp/automationState.d.ts +135 -0
  141. package/dist/fp/automationState.js +206 -0
  142. package/dist/fp/automationState.js.map +1 -0
  143. package/dist/fp/automationUtils.d.ts +31 -0
  144. package/dist/fp/automationUtils.js +61 -0
  145. package/dist/fp/automationUtils.js.map +1 -0
  146. package/dist/fp/brandedTypes.d.ts +32 -0
  147. package/dist/fp/brandedTypes.js +41 -0
  148. package/dist/fp/brandedTypes.js.map +1 -0
  149. package/dist/fp/commandDescription.d.ts +18 -0
  150. package/dist/fp/commandDescription.js +125 -0
  151. package/dist/fp/commandDescription.js.map +1 -0
  152. package/dist/fp/extensionSnapshot.d.ts +10 -0
  153. package/dist/fp/extensionSnapshot.js +14 -0
  154. package/dist/fp/extensionSnapshot.js.map +1 -0
  155. package/dist/fp/index.d.ts +8 -0
  156. package/dist/fp/index.js +9 -0
  157. package/dist/fp/index.js.map +1 -0
  158. package/dist/fp/interpreterContext.d.ts +69 -0
  159. package/dist/fp/interpreterContext.js +56 -0
  160. package/dist/fp/interpreterContext.js.map +1 -0
  161. package/dist/fp/policyParser.d.ts +16 -0
  162. package/dist/fp/policyParser.js +334 -0
  163. package/dist/fp/policyParser.js.map +1 -0
  164. package/dist/fp/result.d.ts +38 -0
  165. package/dist/fp/result.js +57 -0
  166. package/dist/fp/result.js.map +1 -0
  167. package/dist/fp/tokenBucket.d.ts +27 -0
  168. package/dist/fp/tokenBucket.js +36 -0
  169. package/dist/fp/tokenBucket.js.map +1 -0
  170. package/dist/index.d.ts +2 -0
  171. package/dist/index.js +1465 -0
  172. package/dist/index.js.map +1 -0
  173. package/dist/instructionsUtils.d.ts +17 -0
  174. package/dist/instructionsUtils.js +38 -0
  175. package/dist/instructionsUtils.js.map +1 -0
  176. package/dist/lockfile.d.ts +16 -0
  177. package/dist/lockfile.js +172 -0
  178. package/dist/lockfile.js.map +1 -0
  179. package/dist/logger.d.ts +16 -0
  180. package/dist/logger.js +68 -0
  181. package/dist/logger.js.map +1 -0
  182. package/dist/oauth.d.ts +105 -0
  183. package/dist/oauth.js +880 -0
  184. package/dist/oauth.js.map +1 -0
  185. package/dist/orchestrator/childBridgeClient.d.ts +33 -0
  186. package/dist/orchestrator/childBridgeClient.js +321 -0
  187. package/dist/orchestrator/childBridgeClient.js.map +1 -0
  188. package/dist/orchestrator/childBridgeRegistry.d.ts +67 -0
  189. package/dist/orchestrator/childBridgeRegistry.js +297 -0
  190. package/dist/orchestrator/childBridgeRegistry.js.map +1 -0
  191. package/dist/orchestrator/index.d.ts +3 -0
  192. package/dist/orchestrator/index.js +3 -0
  193. package/dist/orchestrator/index.js.map +1 -0
  194. package/dist/orchestrator/orchestratorBridge.d.ts +32 -0
  195. package/dist/orchestrator/orchestratorBridge.js +412 -0
  196. package/dist/orchestrator/orchestratorBridge.js.map +1 -0
  197. package/dist/orchestrator/orchestratorConfig.d.ts +11 -0
  198. package/dist/orchestrator/orchestratorConfig.js +85 -0
  199. package/dist/orchestrator/orchestratorConfig.js.map +1 -0
  200. package/dist/orchestrator/orchestratorTools.d.ts +16 -0
  201. package/dist/orchestrator/orchestratorTools.js +272 -0
  202. package/dist/orchestrator/orchestratorTools.js.map +1 -0
  203. package/dist/patchworkCli.d.ts +15 -0
  204. package/dist/patchworkCli.js +41 -0
  205. package/dist/patchworkCli.js.map +1 -0
  206. package/dist/patchworkConfig.d.ts +28 -0
  207. package/dist/patchworkConfig.js +30 -0
  208. package/dist/patchworkConfig.js.map +1 -0
  209. package/dist/plugin.d.ts +106 -0
  210. package/dist/plugin.js +31 -0
  211. package/dist/plugin.js.map +1 -0
  212. package/dist/pluginLoader.d.ts +44 -0
  213. package/dist/pluginLoader.js +357 -0
  214. package/dist/pluginLoader.js.map +1 -0
  215. package/dist/pluginWatcher.d.ts +24 -0
  216. package/dist/pluginWatcher.js +139 -0
  217. package/dist/pluginWatcher.js.map +1 -0
  218. package/dist/preToolUseHook.d.ts +10 -0
  219. package/dist/preToolUseHook.js +57 -0
  220. package/dist/preToolUseHook.js.map +1 -0
  221. package/dist/probe.d.ts +35 -0
  222. package/dist/probe.js +143 -0
  223. package/dist/probe.js.map +1 -0
  224. package/dist/prompts.d.ts +27 -0
  225. package/dist/prompts.js +1680 -0
  226. package/dist/prompts.js.map +1 -0
  227. package/dist/quickTaskPresets.d.ts +64 -0
  228. package/dist/quickTaskPresets.js +156 -0
  229. package/dist/quickTaskPresets.js.map +1 -0
  230. package/dist/recipes/compiler.d.ts +44 -0
  231. package/dist/recipes/compiler.js +140 -0
  232. package/dist/recipes/compiler.js.map +1 -0
  233. package/dist/recipes/installer.d.ts +25 -0
  234. package/dist/recipes/installer.js +62 -0
  235. package/dist/recipes/installer.js.map +1 -0
  236. package/dist/recipes/parser.d.ts +18 -0
  237. package/dist/recipes/parser.js +160 -0
  238. package/dist/recipes/parser.js.map +1 -0
  239. package/dist/recipes/scheduler.d.ts +45 -0
  240. package/dist/recipes/scheduler.js +110 -0
  241. package/dist/recipes/scheduler.js.map +1 -0
  242. package/dist/recipes/schema.d.ts +71 -0
  243. package/dist/recipes/schema.js +11 -0
  244. package/dist/recipes/schema.js.map +1 -0
  245. package/dist/recipesHttp.d.ts +63 -0
  246. package/dist/recipesHttp.js +183 -0
  247. package/dist/recipesHttp.js.map +1 -0
  248. package/dist/resources.d.ts +33 -0
  249. package/dist/resources.js +266 -0
  250. package/dist/resources.js.map +1 -0
  251. package/dist/riskTier.d.ts +40 -0
  252. package/dist/riskTier.js +142 -0
  253. package/dist/riskTier.js.map +1 -0
  254. package/dist/runLog.d.ts +90 -0
  255. package/dist/runLog.js +143 -0
  256. package/dist/runLog.js.map +1 -0
  257. package/dist/server.d.ts +160 -0
  258. package/dist/server.js +1244 -0
  259. package/dist/server.js.map +1 -0
  260. package/dist/sessionCheckpoint.d.ts +37 -0
  261. package/dist/sessionCheckpoint.js +123 -0
  262. package/dist/sessionCheckpoint.js.map +1 -0
  263. package/dist/streamableHttp.d.ts +86 -0
  264. package/dist/streamableHttp.js +702 -0
  265. package/dist/streamableHttp.js.map +1 -0
  266. package/dist/telemetry.d.ts +18 -0
  267. package/dist/telemetry.js +95 -0
  268. package/dist/telemetry.js.map +1 -0
  269. package/dist/tools/activityLog.d.ts +140 -0
  270. package/dist/tools/activityLog.js +204 -0
  271. package/dist/tools/activityLog.js.map +1 -0
  272. package/dist/tools/auditDependencies.d.ts +67 -0
  273. package/dist/tools/auditDependencies.js +298 -0
  274. package/dist/tools/auditDependencies.js.map +1 -0
  275. package/dist/tools/batchLsp.d.ts +262 -0
  276. package/dist/tools/batchLsp.js +328 -0
  277. package/dist/tools/batchLsp.js.map +1 -0
  278. package/dist/tools/blame-utils.d.ts +30 -0
  279. package/dist/tools/blame-utils.js +60 -0
  280. package/dist/tools/blame-utils.js.map +1 -0
  281. package/dist/tools/bridgeDoctor.d.ts +78 -0
  282. package/dist/tools/bridgeDoctor.js +542 -0
  283. package/dist/tools/bridgeDoctor.js.map +1 -0
  284. package/dist/tools/bridgeStatus.d.ts +122 -0
  285. package/dist/tools/bridgeStatus.js +250 -0
  286. package/dist/tools/bridgeStatus.js.map +1 -0
  287. package/dist/tools/cancelClaudeTask.d.ts +48 -0
  288. package/dist/tools/cancelClaudeTask.js +56 -0
  289. package/dist/tools/cancelClaudeTask.js.map +1 -0
  290. package/dist/tools/checkDocumentDirty.d.ts +56 -0
  291. package/dist/tools/checkDocumentDirty.js +74 -0
  292. package/dist/tools/checkDocumentDirty.js.map +1 -0
  293. package/dist/tools/clipboard.d.ts +80 -0
  294. package/dist/tools/clipboard.js +211 -0
  295. package/dist/tools/clipboard.js.map +1 -0
  296. package/dist/tools/closeTabs.d.ts +84 -0
  297. package/dist/tools/closeTabs.js +97 -0
  298. package/dist/tools/closeTabs.js.map +1 -0
  299. package/dist/tools/codeLens.d.ts +50 -0
  300. package/dist/tools/codeLens.js +47 -0
  301. package/dist/tools/codeLens.js.map +1 -0
  302. package/dist/tools/contextBundle.d.ts +75 -0
  303. package/dist/tools/contextBundle.js +218 -0
  304. package/dist/tools/contextBundle.js.map +1 -0
  305. package/dist/tools/createIssueFromAIComment.d.ts +75 -0
  306. package/dist/tools/createIssueFromAIComment.js +119 -0
  307. package/dist/tools/createIssueFromAIComment.js.map +1 -0
  308. package/dist/tools/ctxGetTaskContext.d.ts +103 -0
  309. package/dist/tools/ctxGetTaskContext.js +274 -0
  310. package/dist/tools/ctxGetTaskContext.js.map +1 -0
  311. package/dist/tools/ctxQueryTraces.d.ts +142 -0
  312. package/dist/tools/ctxQueryTraces.js +194 -0
  313. package/dist/tools/ctxQueryTraces.js.map +1 -0
  314. package/dist/tools/ctxSaveTrace.d.ts +87 -0
  315. package/dist/tools/ctxSaveTrace.js +94 -0
  316. package/dist/tools/ctxSaveTrace.js.map +1 -0
  317. package/dist/tools/debug.d.ts +206 -0
  318. package/dist/tools/debug.js +234 -0
  319. package/dist/tools/debug.js.map +1 -0
  320. package/dist/tools/decorations.d.ts +130 -0
  321. package/dist/tools/decorations.js +160 -0
  322. package/dist/tools/decorations.js.map +1 -0
  323. package/dist/tools/detectUnusedCode.d.ts +78 -0
  324. package/dist/tools/detectUnusedCode.js +173 -0
  325. package/dist/tools/detectUnusedCode.js.map +1 -0
  326. package/dist/tools/documentLinks.d.ts +62 -0
  327. package/dist/tools/documentLinks.js +55 -0
  328. package/dist/tools/documentLinks.js.map +1 -0
  329. package/dist/tools/editText.d.ts +108 -0
  330. package/dist/tools/editText.js +318 -0
  331. package/dist/tools/editText.js.map +1 -0
  332. package/dist/tools/enrichCommit.d.ts +89 -0
  333. package/dist/tools/enrichCommit.js +201 -0
  334. package/dist/tools/enrichCommit.js.map +1 -0
  335. package/dist/tools/enrichStackTrace.d.ts +121 -0
  336. package/dist/tools/enrichStackTrace.js +194 -0
  337. package/dist/tools/enrichStackTrace.js.map +1 -0
  338. package/dist/tools/explainDiagnostic.d.ts +137 -0
  339. package/dist/tools/explainDiagnostic.js +230 -0
  340. package/dist/tools/explainDiagnostic.js.map +1 -0
  341. package/dist/tools/explainSymbol.d.ts +119 -0
  342. package/dist/tools/explainSymbol.js +177 -0
  343. package/dist/tools/explainSymbol.js.map +1 -0
  344. package/dist/tools/fileOperations.d.ts +186 -0
  345. package/dist/tools/fileOperations.js +330 -0
  346. package/dist/tools/fileOperations.js.map +1 -0
  347. package/dist/tools/fileWatcher.d.ts +107 -0
  348. package/dist/tools/fileWatcher.js +121 -0
  349. package/dist/tools/fileWatcher.js.map +1 -0
  350. package/dist/tools/findFiles.d.ts +65 -0
  351. package/dist/tools/findFiles.js +142 -0
  352. package/dist/tools/findFiles.js.map +1 -0
  353. package/dist/tools/findRelatedTests.d.ts +83 -0
  354. package/dist/tools/findRelatedTests.js +196 -0
  355. package/dist/tools/findRelatedTests.js.map +1 -0
  356. package/dist/tools/fixAllLintErrors.d.ts +66 -0
  357. package/dist/tools/fixAllLintErrors.js +128 -0
  358. package/dist/tools/fixAllLintErrors.js.map +1 -0
  359. package/dist/tools/foldingRanges.d.ts +50 -0
  360. package/dist/tools/foldingRanges.js +51 -0
  361. package/dist/tools/foldingRanges.js.map +1 -0
  362. package/dist/tools/formatAndSave.d.ts +57 -0
  363. package/dist/tools/formatAndSave.js +87 -0
  364. package/dist/tools/formatAndSave.js.map +1 -0
  365. package/dist/tools/formatDocument.d.ts +61 -0
  366. package/dist/tools/formatDocument.js +144 -0
  367. package/dist/tools/formatDocument.js.map +1 -0
  368. package/dist/tools/generateAPIDocumentation.d.ts +62 -0
  369. package/dist/tools/generateAPIDocumentation.js +249 -0
  370. package/dist/tools/generateAPIDocumentation.js.map +1 -0
  371. package/dist/tools/generateTests.d.ts +75 -0
  372. package/dist/tools/generateTests.js +226 -0
  373. package/dist/tools/generateTests.js.map +1 -0
  374. package/dist/tools/getAIComments.d.ts +79 -0
  375. package/dist/tools/getAIComments.js +93 -0
  376. package/dist/tools/getAIComments.js.map +1 -0
  377. package/dist/tools/getAnalyticsReport.d.ts +102 -0
  378. package/dist/tools/getAnalyticsReport.js +137 -0
  379. package/dist/tools/getAnalyticsReport.js.map +1 -0
  380. package/dist/tools/getArchitectureContext.d.ts +85 -0
  381. package/dist/tools/getArchitectureContext.js +135 -0
  382. package/dist/tools/getArchitectureContext.js.map +1 -0
  383. package/dist/tools/getBufferContent.d.ts +80 -0
  384. package/dist/tools/getBufferContent.js +207 -0
  385. package/dist/tools/getBufferContent.js.map +1 -0
  386. package/dist/tools/getChangeImpact.d.ts +76 -0
  387. package/dist/tools/getChangeImpact.js +184 -0
  388. package/dist/tools/getChangeImpact.js.map +1 -0
  389. package/dist/tools/getClaudeTaskStatus.d.ts +87 -0
  390. package/dist/tools/getClaudeTaskStatus.js +89 -0
  391. package/dist/tools/getClaudeTaskStatus.js.map +1 -0
  392. package/dist/tools/getCodeCoverage.d.ts +86 -0
  393. package/dist/tools/getCodeCoverage.js +237 -0
  394. package/dist/tools/getCodeCoverage.js.map +1 -0
  395. package/dist/tools/getCommitsForIssue.d.ts +98 -0
  396. package/dist/tools/getCommitsForIssue.js +106 -0
  397. package/dist/tools/getCommitsForIssue.js.map +1 -0
  398. package/dist/tools/getCurrentSelection.d.ts +123 -0
  399. package/dist/tools/getCurrentSelection.js +113 -0
  400. package/dist/tools/getCurrentSelection.js.map +1 -0
  401. package/dist/tools/getDebugState.d.ts +140 -0
  402. package/dist/tools/getDebugState.js +109 -0
  403. package/dist/tools/getDebugState.js.map +1 -0
  404. package/dist/tools/getDependencyTree.d.ts +59 -0
  405. package/dist/tools/getDependencyTree.js +207 -0
  406. package/dist/tools/getDependencyTree.js.map +1 -0
  407. package/dist/tools/getDiagnostics.d.ts +108 -0
  408. package/dist/tools/getDiagnostics.js +371 -0
  409. package/dist/tools/getDiagnostics.js.map +1 -0
  410. package/dist/tools/getDiffFromHandoff.d.ts +89 -0
  411. package/dist/tools/getDiffFromHandoff.js +163 -0
  412. package/dist/tools/getDiffFromHandoff.js.map +1 -0
  413. package/dist/tools/getDocumentSymbols.d.ts +74 -0
  414. package/dist/tools/getDocumentSymbols.js +177 -0
  415. package/dist/tools/getDocumentSymbols.js.map +1 -0
  416. package/dist/tools/getFileTree.d.ts +66 -0
  417. package/dist/tools/getFileTree.js +131 -0
  418. package/dist/tools/getFileTree.js.map +1 -0
  419. package/dist/tools/getGitDiff.d.ts +50 -0
  420. package/dist/tools/getGitDiff.js +73 -0
  421. package/dist/tools/getGitDiff.js.map +1 -0
  422. package/dist/tools/getGitHotspots.d.ts +88 -0
  423. package/dist/tools/getGitHotspots.js +145 -0
  424. package/dist/tools/getGitHotspots.js.map +1 -0
  425. package/dist/tools/getGitLog.d.ts +62 -0
  426. package/dist/tools/getGitLog.js +87 -0
  427. package/dist/tools/getGitLog.js.map +1 -0
  428. package/dist/tools/getGitStatus.d.ts +72 -0
  429. package/dist/tools/getGitStatus.js +126 -0
  430. package/dist/tools/getGitStatus.js.map +1 -0
  431. package/dist/tools/getImportTree.d.ts +73 -0
  432. package/dist/tools/getImportTree.js +223 -0
  433. package/dist/tools/getImportTree.js.map +1 -0
  434. package/dist/tools/getImportedSignatures.d.ts +62 -0
  435. package/dist/tools/getImportedSignatures.js +255 -0
  436. package/dist/tools/getImportedSignatures.js.map +1 -0
  437. package/dist/tools/getOpenEditors.d.ts +62 -0
  438. package/dist/tools/getOpenEditors.js +126 -0
  439. package/dist/tools/getOpenEditors.js.map +1 -0
  440. package/dist/tools/getPRTemplate.d.ts +68 -0
  441. package/dist/tools/getPRTemplate.js +187 -0
  442. package/dist/tools/getPRTemplate.js.map +1 -0
  443. package/dist/tools/getProjectContext.d.ts +114 -0
  444. package/dist/tools/getProjectContext.js +344 -0
  445. package/dist/tools/getProjectContext.js.map +1 -0
  446. package/dist/tools/getProjectInfo.d.ts +51 -0
  447. package/dist/tools/getProjectInfo.js +325 -0
  448. package/dist/tools/getProjectInfo.js.map +1 -0
  449. package/dist/tools/getSecurityAdvisories.d.ts +105 -0
  450. package/dist/tools/getSecurityAdvisories.js +472 -0
  451. package/dist/tools/getSecurityAdvisories.js.map +1 -0
  452. package/dist/tools/getSessionUsage.d.ts +58 -0
  453. package/dist/tools/getSessionUsage.js +57 -0
  454. package/dist/tools/getSessionUsage.js.map +1 -0
  455. package/dist/tools/getSymbolHistory.d.ts +157 -0
  456. package/dist/tools/getSymbolHistory.js +256 -0
  457. package/dist/tools/getSymbolHistory.js.map +1 -0
  458. package/dist/tools/getToolCapabilities.d.ts +69 -0
  459. package/dist/tools/getToolCapabilities.js +298 -0
  460. package/dist/tools/getToolCapabilities.js.map +1 -0
  461. package/dist/tools/getTypeSignature.d.ts +70 -0
  462. package/dist/tools/getTypeSignature.js +132 -0
  463. package/dist/tools/getTypeSignature.js.map +1 -0
  464. package/dist/tools/getWorkspaceFolders.d.ts +58 -0
  465. package/dist/tools/getWorkspaceFolders.js +69 -0
  466. package/dist/tools/getWorkspaceFolders.js.map +1 -0
  467. package/dist/tools/getWorkspaceSettings.d.ts +44 -0
  468. package/dist/tools/getWorkspaceSettings.js +70 -0
  469. package/dist/tools/getWorkspaceSettings.js.map +1 -0
  470. package/dist/tools/git-utils.d.ts +16 -0
  471. package/dist/tools/git-utils.js +46 -0
  472. package/dist/tools/git-utils.js.map +1 -0
  473. package/dist/tools/gitHistory.d.ts +110 -0
  474. package/dist/tools/gitHistory.js +167 -0
  475. package/dist/tools/gitHistory.js.map +1 -0
  476. package/dist/tools/gitWrite.d.ts +612 -0
  477. package/dist/tools/gitWrite.js +983 -0
  478. package/dist/tools/gitWrite.js.map +1 -0
  479. package/dist/tools/github/actions.d.ts +152 -0
  480. package/dist/tools/github/actions.js +195 -0
  481. package/dist/tools/github/actions.js.map +1 -0
  482. package/dist/tools/github/index.d.ts +3 -0
  483. package/dist/tools/github/index.js +4 -0
  484. package/dist/tools/github/index.js.map +1 -0
  485. package/dist/tools/github/issues.d.ts +281 -0
  486. package/dist/tools/github/issues.js +340 -0
  487. package/dist/tools/github/issues.js.map +1 -0
  488. package/dist/tools/github/pr.d.ts +433 -0
  489. package/dist/tools/github/pr.js +588 -0
  490. package/dist/tools/github/pr.js.map +1 -0
  491. package/dist/tools/github/shared.d.ts +4 -0
  492. package/dist/tools/github/shared.js +12 -0
  493. package/dist/tools/github/shared.js.map +1 -0
  494. package/dist/tools/handoffNote.d.ts +106 -0
  495. package/dist/tools/handoffNote.js +232 -0
  496. package/dist/tools/handoffNote.js.map +1 -0
  497. package/dist/tools/headless/lspClient.d.ts +26 -0
  498. package/dist/tools/headless/lspClient.js +221 -0
  499. package/dist/tools/headless/lspClient.js.map +1 -0
  500. package/dist/tools/headless/lspFallback.d.ts +28 -0
  501. package/dist/tools/headless/lspFallback.js +122 -0
  502. package/dist/tools/headless/lspFallback.js.map +1 -0
  503. package/dist/tools/hoverAtCursor.d.ts +54 -0
  504. package/dist/tools/hoverAtCursor.js +68 -0
  505. package/dist/tools/hoverAtCursor.js.map +1 -0
  506. package/dist/tools/httpClient.d.ts +141 -0
  507. package/dist/tools/httpClient.js +486 -0
  508. package/dist/tools/httpClient.js.map +1 -0
  509. package/dist/tools/index.d.ts +49 -0
  510. package/dist/tools/index.js +672 -0
  511. package/dist/tools/index.js.map +1 -0
  512. package/dist/tools/inlayHints.d.ts +81 -0
  513. package/dist/tools/inlayHints.js +76 -0
  514. package/dist/tools/inlayHints.js.map +1 -0
  515. package/dist/tools/issueRefs.d.ts +14 -0
  516. package/dist/tools/issueRefs.js +27 -0
  517. package/dist/tools/issueRefs.js.map +1 -0
  518. package/dist/tools/jumpToFirstError.d.ts +63 -0
  519. package/dist/tools/jumpToFirstError.js +124 -0
  520. package/dist/tools/jumpToFirstError.js.map +1 -0
  521. package/dist/tools/launchQuickTask.d.ts +76 -0
  522. package/dist/tools/launchQuickTask.js +170 -0
  523. package/dist/tools/launchQuickTask.js.map +1 -0
  524. package/dist/tools/linters/biome.d.ts +2 -0
  525. package/dist/tools/linters/biome.js +44 -0
  526. package/dist/tools/linters/biome.js.map +1 -0
  527. package/dist/tools/linters/cargo.d.ts +2 -0
  528. package/dist/tools/linters/cargo.js +45 -0
  529. package/dist/tools/linters/cargo.js.map +1 -0
  530. package/dist/tools/linters/eslint.d.ts +2 -0
  531. package/dist/tools/linters/eslint.js +59 -0
  532. package/dist/tools/linters/eslint.js.map +1 -0
  533. package/dist/tools/linters/govet.d.ts +2 -0
  534. package/dist/tools/linters/govet.js +37 -0
  535. package/dist/tools/linters/govet.js.map +1 -0
  536. package/dist/tools/linters/pyright.d.ts +2 -0
  537. package/dist/tools/linters/pyright.js +34 -0
  538. package/dist/tools/linters/pyright.js.map +1 -0
  539. package/dist/tools/linters/ruff.d.ts +2 -0
  540. package/dist/tools/linters/ruff.js +30 -0
  541. package/dist/tools/linters/ruff.js.map +1 -0
  542. package/dist/tools/linters/types.d.ts +16 -0
  543. package/dist/tools/linters/types.js +2 -0
  544. package/dist/tools/linters/types.js.map +1 -0
  545. package/dist/tools/linters/typescript.d.ts +2 -0
  546. package/dist/tools/linters/typescript.js +38 -0
  547. package/dist/tools/linters/typescript.js.map +1 -0
  548. package/dist/tools/listClaudeTasks.d.ts +84 -0
  549. package/dist/tools/listClaudeTasks.js +88 -0
  550. package/dist/tools/listClaudeTasks.js.map +1 -0
  551. package/dist/tools/listTerminals.d.ts +55 -0
  552. package/dist/tools/listTerminals.js +78 -0
  553. package/dist/tools/listTerminals.js.map +1 -0
  554. package/dist/tools/lsp.d.ts +1086 -0
  555. package/dist/tools/lsp.js +1339 -0
  556. package/dist/tools/lsp.js.map +1 -0
  557. package/dist/tools/navigateToSymbolByName.d.ts +56 -0
  558. package/dist/tools/navigateToSymbolByName.js +170 -0
  559. package/dist/tools/navigateToSymbolByName.js.map +1 -0
  560. package/dist/tools/openDiff.d.ts +66 -0
  561. package/dist/tools/openDiff.js +126 -0
  562. package/dist/tools/openDiff.js.map +1 -0
  563. package/dist/tools/openFile.d.ts +69 -0
  564. package/dist/tools/openFile.js +129 -0
  565. package/dist/tools/openFile.js.map +1 -0
  566. package/dist/tools/openInBrowser.d.ts +55 -0
  567. package/dist/tools/openInBrowser.js +129 -0
  568. package/dist/tools/openInBrowser.js.map +1 -0
  569. package/dist/tools/organizeImports.d.ts +56 -0
  570. package/dist/tools/organizeImports.js +115 -0
  571. package/dist/tools/organizeImports.js.map +1 -0
  572. package/dist/tools/performanceReport.d.ts +133 -0
  573. package/dist/tools/performanceReport.js +218 -0
  574. package/dist/tools/performanceReport.js.map +1 -0
  575. package/dist/tools/planPersistence.d.ts +306 -0
  576. package/dist/tools/planPersistence.js +485 -0
  577. package/dist/tools/planPersistence.js.map +1 -0
  578. package/dist/tools/previewEdit.d.ts +107 -0
  579. package/dist/tools/previewEdit.js +270 -0
  580. package/dist/tools/previewEdit.js.map +1 -0
  581. package/dist/tools/recentTracesDigest.d.ts +35 -0
  582. package/dist/tools/recentTracesDigest.js +98 -0
  583. package/dist/tools/recentTracesDigest.js.map +1 -0
  584. package/dist/tools/refactorAnalyze.d.ts +78 -0
  585. package/dist/tools/refactorAnalyze.js +141 -0
  586. package/dist/tools/refactorAnalyze.js.map +1 -0
  587. package/dist/tools/refactorExtractFunction.d.ts +52 -0
  588. package/dist/tools/refactorExtractFunction.js +121 -0
  589. package/dist/tools/refactorExtractFunction.js.map +1 -0
  590. package/dist/tools/refactorPreview.d.ts +75 -0
  591. package/dist/tools/refactorPreview.js +93 -0
  592. package/dist/tools/refactorPreview.js.map +1 -0
  593. package/dist/tools/replaceBlock.d.ts +62 -0
  594. package/dist/tools/replaceBlock.js +125 -0
  595. package/dist/tools/replaceBlock.js.map +1 -0
  596. package/dist/tools/resumeClaudeTask.d.ts +75 -0
  597. package/dist/tools/resumeClaudeTask.js +149 -0
  598. package/dist/tools/resumeClaudeTask.js.map +1 -0
  599. package/dist/tools/runClaudeTask.d.ts +97 -0
  600. package/dist/tools/runClaudeTask.js +224 -0
  601. package/dist/tools/runClaudeTask.js.map +1 -0
  602. package/dist/tools/runCommand.d.ts +82 -0
  603. package/dist/tools/runCommand.js +101 -0
  604. package/dist/tools/runCommand.js.map +1 -0
  605. package/dist/tools/runTests.d.ts +146 -0
  606. package/dist/tools/runTests.js +315 -0
  607. package/dist/tools/runTests.js.map +1 -0
  608. package/dist/tools/saveDocument.d.ts +50 -0
  609. package/dist/tools/saveDocument.js +73 -0
  610. package/dist/tools/saveDocument.js.map +1 -0
  611. package/dist/tools/screenshot.d.ts +23 -0
  612. package/dist/tools/screenshot.js +43 -0
  613. package/dist/tools/screenshot.js.map +1 -0
  614. package/dist/tools/screenshotAndAnnotate.d.ts +103 -0
  615. package/dist/tools/screenshotAndAnnotate.js +192 -0
  616. package/dist/tools/screenshotAndAnnotate.js.map +1 -0
  617. package/dist/tools/searchAndReplace.d.ts +108 -0
  618. package/dist/tools/searchAndReplace.js +281 -0
  619. package/dist/tools/searchAndReplace.js.map +1 -0
  620. package/dist/tools/searchTools.d.ts +61 -0
  621. package/dist/tools/searchTools.js +85 -0
  622. package/dist/tools/searchTools.js.map +1 -0
  623. package/dist/tools/searchWorkspace.d.ts +99 -0
  624. package/dist/tools/searchWorkspace.js +189 -0
  625. package/dist/tools/searchWorkspace.js.map +1 -0
  626. package/dist/tools/selectionRanges.d.ts +58 -0
  627. package/dist/tools/selectionRanges.js +61 -0
  628. package/dist/tools/selectionRanges.js.map +1 -0
  629. package/dist/tools/semanticTokens.d.ts +87 -0
  630. package/dist/tools/semanticTokens.js +86 -0
  631. package/dist/tools/semanticTokens.js.map +1 -0
  632. package/dist/tools/setActiveWorkspaceFolder.d.ts +41 -0
  633. package/dist/tools/setActiveWorkspaceFolder.js +38 -0
  634. package/dist/tools/setActiveWorkspaceFolder.js.map +1 -0
  635. package/dist/tools/signatureHelp.d.ts +86 -0
  636. package/dist/tools/signatureHelp.js +79 -0
  637. package/dist/tools/signatureHelp.js.map +1 -0
  638. package/dist/tools/spawnWorkspace.d.ts +103 -0
  639. package/dist/tools/spawnWorkspace.js +268 -0
  640. package/dist/tools/spawnWorkspace.js.map +1 -0
  641. package/dist/tools/stackTraceParser.d.ts +43 -0
  642. package/dist/tools/stackTraceParser.js +139 -0
  643. package/dist/tools/stackTraceParser.js.map +1 -0
  644. package/dist/tools/terminal.d.ts +352 -0
  645. package/dist/tools/terminal.js +670 -0
  646. package/dist/tools/terminal.js.map +1 -0
  647. package/dist/tools/testRunners/cargoTest.d.ts +2 -0
  648. package/dist/tools/testRunners/cargoTest.js +129 -0
  649. package/dist/tools/testRunners/cargoTest.js.map +1 -0
  650. package/dist/tools/testRunners/goTest.d.ts +2 -0
  651. package/dist/tools/testRunners/goTest.js +108 -0
  652. package/dist/tools/testRunners/goTest.js.map +1 -0
  653. package/dist/tools/testRunners/pytest.d.ts +2 -0
  654. package/dist/tools/testRunners/pytest.js +135 -0
  655. package/dist/tools/testRunners/pytest.js.map +1 -0
  656. package/dist/tools/testRunners/types.d.ts +18 -0
  657. package/dist/tools/testRunners/types.js +2 -0
  658. package/dist/tools/testRunners/types.js.map +1 -0
  659. package/dist/tools/testRunners/vitestJest.d.ts +3 -0
  660. package/dist/tools/testRunners/vitestJest.js +215 -0
  661. package/dist/tools/testRunners/vitestJest.js.map +1 -0
  662. package/dist/tools/testTraceToSource.d.ts +80 -0
  663. package/dist/tools/testTraceToSource.js +206 -0
  664. package/dist/tools/testTraceToSource.js.map +1 -0
  665. package/dist/tools/transaction.d.ts +243 -0
  666. package/dist/tools/transaction.js +309 -0
  667. package/dist/tools/transaction.js.map +1 -0
  668. package/dist/tools/typeHierarchy.d.ts +77 -0
  669. package/dist/tools/typeHierarchy.js +86 -0
  670. package/dist/tools/typeHierarchy.js.map +1 -0
  671. package/dist/tools/utils.d.ts +124 -0
  672. package/dist/tools/utils.js +566 -0
  673. package/dist/tools/utils.js.map +1 -0
  674. package/dist/tools/vscodeCommands.d.ts +90 -0
  675. package/dist/tools/vscodeCommands.js +112 -0
  676. package/dist/tools/vscodeCommands.js.map +1 -0
  677. package/dist/tools/vscodeTasks.d.ts +102 -0
  678. package/dist/tools/vscodeTasks.js +110 -0
  679. package/dist/tools/vscodeTasks.js.map +1 -0
  680. package/dist/tools/watchDiagnostics.d.ts +64 -0
  681. package/dist/tools/watchDiagnostics.js +270 -0
  682. package/dist/tools/watchDiagnostics.js.map +1 -0
  683. package/dist/tools/workspaceSettings.d.ts +57 -0
  684. package/dist/tools/workspaceSettings.js +80 -0
  685. package/dist/tools/workspaceSettings.js.map +1 -0
  686. package/dist/transport.d.ts +207 -0
  687. package/dist/transport.js +1272 -0
  688. package/dist/transport.js.map +1 -0
  689. package/dist/version.d.ts +13 -0
  690. package/dist/version.js +31 -0
  691. package/dist/version.js.map +1 -0
  692. package/dist/wsUtils.d.ts +8 -0
  693. package/dist/wsUtils.js +54 -0
  694. package/dist/wsUtils.js.map +1 -0
  695. package/package.json +118 -0
  696. package/scripts/gen-claude-desktop-config.sh +124 -0
  697. package/scripts/gen-mcp-config.sh +390 -0
  698. package/scripts/install-extension.sh +106 -0
  699. package/scripts/mcp-stdio-shim.cjs +482 -0
  700. package/scripts/postinstall.mjs +68 -0
  701. package/scripts/start-all.sh +502 -0
  702. package/scripts/start-orchestrator.sh +186 -0
  703. package/scripts/start-remote.sh +126 -0
  704. package/scripts/start-vps.sh +116 -0
  705. package/templates/CLAUDE.bridge.md +125 -0
  706. package/templates/automation-policies/security-first.json +46 -0
  707. package/templates/automation-policies/strict-lint.json +41 -0
  708. package/templates/automation-policies/test-driven.json +54 -0
  709. package/templates/automation-policy.example.json +105 -0
  710. package/templates/bridge-tools.md +111 -0
  711. package/templates/dispatch-context.md +33 -0
  712. package/templates/managed-agent/code-review-agent.md +50 -0
  713. package/templates/managed-agent/managed-agent-mcp.json +102 -0
  714. package/templates/recipes/ambient-journal.yaml +11 -0
  715. package/templates/recipes/daily-status.yaml +21 -0
  716. package/templates/recipes/lint-on-save.yaml +13 -0
  717. package/templates/recipes/stale-branches.yaml +18 -0
  718. package/templates/recipes/watch-failing-tests.yaml +15 -0
  719. package/templates/scheduled-tasks/dependency-audit/SKILL.md +77 -0
  720. package/templates/scheduled-tasks/health-check/SKILL.md +73 -0
  721. package/templates/scheduled-tasks/nightly-review/SKILL.md +69 -0
@@ -0,0 +1,1680 @@
1
+ // MCP Prompts — reusable IDE workflow templates surfaced as slash commands
2
+ // in Claude Code chat: /mcp__bridge__<name>
3
+ import { readFileSync } from "node:fs";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ // Load the bridge-tools rules template so the orient prompt always stays in sync.
7
+ const _promptsDir = path.dirname(fileURLToPath(import.meta.url));
8
+ let _bridgeToolsTemplate;
9
+ try {
10
+ _bridgeToolsTemplate = readFileSync(path.resolve(_promptsDir, "..", "templates", "bridge-tools.md"), "utf-8").trim();
11
+ }
12
+ catch {
13
+ _bridgeToolsTemplate =
14
+ "See `.claude/rules/bridge-tools.md` for bridge tool override rules (run `claude-ide-bridge init` to generate it).";
15
+ }
16
+ // ── Prompt definitions ────────────────────────────────────────────────────────
17
+ export const PROMPTS = [
18
+ {
19
+ name: "review-changes",
20
+ description: "Review uncommitted changes to a specific file: diff, diagnostics, churn risk, and architectural context.",
21
+ arguments: [
22
+ {
23
+ name: "file",
24
+ description: "Path to the changed file to review (workspace-relative or absolute).",
25
+ required: true,
26
+ },
27
+ ],
28
+ },
29
+ {
30
+ name: "review-file",
31
+ description: "Code review: correctness, style, performance, security, and coverage gaps.",
32
+ arguments: [
33
+ {
34
+ name: "file",
35
+ description: "Path to the file to review (workspace-relative or absolute).",
36
+ required: true,
37
+ },
38
+ ],
39
+ },
40
+ {
41
+ name: "explain-diagnostics",
42
+ description: "Explain diagnostics (errors/warnings) for a file and suggest fixes.",
43
+ arguments: [
44
+ {
45
+ name: "file",
46
+ description: "Path to the file with diagnostics (workspace-relative or absolute).",
47
+ required: true,
48
+ },
49
+ ],
50
+ },
51
+ {
52
+ name: "generate-tests",
53
+ description: "Generate missing unit tests for a file using the project's test conventions.",
54
+ arguments: [
55
+ {
56
+ name: "file",
57
+ description: "Path to the file to generate tests for (workspace-relative or absolute).",
58
+ required: true,
59
+ },
60
+ ],
61
+ },
62
+ {
63
+ name: "debug-context",
64
+ description: "Snapshot IDE state (open editors, diagnostics, recent terminal output) as debugging context.",
65
+ arguments: [],
66
+ },
67
+ {
68
+ name: "git-review",
69
+ description: "Review uncommitted changes (staged + unstaged) against a base branch before commit or PR.",
70
+ arguments: [
71
+ {
72
+ name: "base",
73
+ description: "Base branch or ref to diff against (default: main).",
74
+ required: false,
75
+ },
76
+ ],
77
+ },
78
+ {
79
+ name: "cowork",
80
+ description: "Load IDE context (open files, diagnostics, git status, project info, handoff note) and propose a Cowork action plan. Run before any computer-use task.",
81
+ arguments: [
82
+ {
83
+ name: "task",
84
+ description: "Optional task description to focus context gathering (e.g. 'fix all TypeScript errors').",
85
+ required: false,
86
+ },
87
+ ],
88
+ },
89
+ {
90
+ name: "gen-claude-md",
91
+ description: "Generate bridge workflow rules and quick-reference table, then write them into CLAUDE.md.",
92
+ arguments: [],
93
+ },
94
+ {
95
+ name: "set-effort",
96
+ description: "Prepend a model-effort instruction to the next task. low=quick, medium=normal, high=complex refactors/deep analysis.",
97
+ arguments: [
98
+ {
99
+ name: "level",
100
+ description: "Effort level: low | medium | high (default: medium).",
101
+ required: false,
102
+ },
103
+ ],
104
+ },
105
+ // ── Dispatch prompts (phone-friendly, terse triggers) ───────────────────────
106
+ {
107
+ name: "project-status",
108
+ description: "Quick health check: git status, diagnostics, and test results. Terse output for Dispatch/mobile.",
109
+ arguments: [],
110
+ },
111
+ {
112
+ name: "quick-tests",
113
+ description: "Run tests and return a concise pass/fail summary with failure details.",
114
+ arguments: [
115
+ {
116
+ name: "filter",
117
+ description: "Optional test filter pattern (e.g. file name or test name substring).",
118
+ required: false,
119
+ },
120
+ ],
121
+ },
122
+ {
123
+ name: "quick-review",
124
+ description: "Git diff summary plus diagnostics for changed files. Concise output.",
125
+ arguments: [],
126
+ },
127
+ {
128
+ name: "build-check",
129
+ description: "Check if the project builds successfully. Returns pass/fail with error summary.",
130
+ arguments: [],
131
+ },
132
+ {
133
+ name: "recent-activity",
134
+ description: "Last N git log entries plus uncommitted changes summary.",
135
+ arguments: [
136
+ {
137
+ name: "count",
138
+ description: "Number of recent commits to show (default: 10).",
139
+ required: false,
140
+ },
141
+ ],
142
+ },
143
+ // ── Agent Teams & Scheduled Tasks prompts ───────────────────────────────────
144
+ {
145
+ name: "team-status",
146
+ description: "Active agent sessions and recent tool activity. For team leads coordinating parallel agents.",
147
+ arguments: [],
148
+ },
149
+ {
150
+ name: "health-check",
151
+ description: "Full health check: tests, diagnostics, security advisories, git status, dependency audit. For scheduled nightly/hourly runs.",
152
+ arguments: [],
153
+ },
154
+ // ── Setup prompts ─────────────────────────────────────────────────────────
155
+ {
156
+ name: "orient-project",
157
+ description: "Set up a project for Claude IDE Bridge: detects project type, generates/updates CLAUDE.md, scaffolds docs, and verifies connectivity. Idempotent.",
158
+ arguments: [
159
+ {
160
+ name: "style",
161
+ description: "Scaffolding depth: 'minimal' (CLAUDE.md only), 'standard' (+ documents/, docs/adr/, .claude/rules/), 'full' (+ commands, agents, use-cases). Default: standard.",
162
+ required: false,
163
+ },
164
+ ],
165
+ },
166
+ // ── LSP composition prompts (Round: LSP Leverage) ─────────────────────────
167
+ // These wrap the bridge's existing LSP primitives + composites (getChangeImpact,
168
+ // explainSymbol, refactorAnalyze, etc.) into one-call developer workflows.
169
+ {
170
+ name: "find-callers",
171
+ description: "Find every caller of a symbol with file:line locations. Wraps searchWorkspaceSymbols + getCallHierarchy(incoming) + findReferences.",
172
+ arguments: [
173
+ {
174
+ name: "symbol",
175
+ description: "Symbol name to look up (function, class, variable).",
176
+ required: true,
177
+ },
178
+ ],
179
+ },
180
+ {
181
+ name: "blast-radius",
182
+ description: "Blast radius at a position: diagnostics + reference counts + risk badge. Wraps getChangeImpact.",
183
+ arguments: [
184
+ {
185
+ name: "file",
186
+ description: "File path (workspace-relative or absolute).",
187
+ required: true,
188
+ },
189
+ {
190
+ name: "line",
191
+ description: "Line number (1-based).",
192
+ required: true,
193
+ },
194
+ {
195
+ name: "column",
196
+ description: "Column number (1-based).",
197
+ required: true,
198
+ },
199
+ ],
200
+ },
201
+ {
202
+ name: "why-error",
203
+ description: "Explain a diagnostic in plain English with surrounding type context. Wraps getDiagnostics + explainSymbol.",
204
+ arguments: [
205
+ {
206
+ name: "file",
207
+ description: "File path (workspace-relative or absolute).",
208
+ required: true,
209
+ },
210
+ {
211
+ name: "line",
212
+ description: "Line number to focus on (default: first error).",
213
+ required: false,
214
+ },
215
+ ],
216
+ },
217
+ {
218
+ name: "unused-in",
219
+ description: "List unused exports, parameters, and imports in a file. Wraps detectUnusedCode + findReferences.",
220
+ arguments: [
221
+ {
222
+ name: "file",
223
+ description: "File path (workspace-relative or absolute).",
224
+ required: true,
225
+ },
226
+ ],
227
+ },
228
+ {
229
+ name: "trace-to",
230
+ description: "Trace call chain to a target symbol with type signatures at each hop. Wraps getCallHierarchy(outgoing) + getImportedSignatures.",
231
+ arguments: [
232
+ {
233
+ name: "symbol",
234
+ description: "Target symbol name to trace toward.",
235
+ required: true,
236
+ },
237
+ ],
238
+ },
239
+ {
240
+ name: "imports-of",
241
+ description: "List files importing a symbol with reference counts. Wraps findReferences + getImportTree.",
242
+ arguments: [
243
+ {
244
+ name: "symbol",
245
+ description: "Symbol name to look up imports for.",
246
+ required: true,
247
+ },
248
+ ],
249
+ },
250
+ {
251
+ name: "circular-deps",
252
+ description: "Detect circular import dependencies. Wraps getImportTree with cycle detection.",
253
+ arguments: [],
254
+ },
255
+ {
256
+ name: "refactor-preview",
257
+ description: "Preview exact edits a rename would make plus blast-radius risk. Wraps refactorAnalyze + refactorPreview.",
258
+ arguments: [
259
+ {
260
+ name: "file",
261
+ description: "File path (workspace-relative or absolute).",
262
+ required: true,
263
+ },
264
+ {
265
+ name: "line",
266
+ description: "Line number (1-based).",
267
+ required: true,
268
+ },
269
+ {
270
+ name: "column",
271
+ description: "Column number (1-based).",
272
+ required: true,
273
+ },
274
+ {
275
+ name: "newName",
276
+ description: "Proposed new name for the symbol.",
277
+ required: true,
278
+ },
279
+ ],
280
+ },
281
+ {
282
+ name: "module-exports",
283
+ description: "List exported symbols with type signatures as Markdown. Wraps getDocumentSymbols + getHover.",
284
+ arguments: [
285
+ {
286
+ name: "file",
287
+ description: "File path (workspace-relative or absolute).",
288
+ required: true,
289
+ },
290
+ ],
291
+ },
292
+ {
293
+ name: "type-of",
294
+ description: "Type signature at a position (no docs). Wraps getHoverAtCursor + getTypeSignature.",
295
+ arguments: [
296
+ {
297
+ name: "file",
298
+ description: "File path (workspace-relative or absolute).",
299
+ required: true,
300
+ },
301
+ {
302
+ name: "line",
303
+ description: "Line number (1-based).",
304
+ required: true,
305
+ },
306
+ {
307
+ name: "column",
308
+ description: "Column number (1-based).",
309
+ required: true,
310
+ },
311
+ ],
312
+ },
313
+ {
314
+ name: "deprecations",
315
+ description: "Find @deprecated APIs and count callers. Wraps searchWorkspace + findReferences.",
316
+ arguments: [],
317
+ },
318
+ {
319
+ name: "coverage-gap",
320
+ description: "Identify untested functions by correlating coverage with document symbols. Wraps getCodeCoverage + getDocumentSymbols.",
321
+ arguments: [
322
+ {
323
+ name: "file",
324
+ description: "File path (workspace-relative or absolute).",
325
+ required: true,
326
+ },
327
+ ],
328
+ },
329
+ {
330
+ name: "explore-type",
331
+ description: "Explore a type: declaration, definition, and all implementations. Wraps getHover + goToDeclaration + goToTypeDefinition + findImplementations.",
332
+ arguments: [
333
+ {
334
+ name: "file",
335
+ description: "File path (workspace-relative or absolute).",
336
+ required: true,
337
+ },
338
+ {
339
+ name: "line",
340
+ description: "Line number (1-based).",
341
+ required: true,
342
+ },
343
+ {
344
+ name: "column",
345
+ description: "Column number (1-based).",
346
+ required: true,
347
+ },
348
+ ],
349
+ },
350
+ {
351
+ name: "ide-coverage",
352
+ description: "Generate an HTML coverage heatmap and open in browser. Requires --full mode (getCodeCoverage + openInBrowser).",
353
+ arguments: [],
354
+ },
355
+ {
356
+ name: "ide-deps",
357
+ description: "D3 force-directed dependency graph for an entry point, opened in browser. Requires --full mode.",
358
+ arguments: [
359
+ {
360
+ name: "file",
361
+ description: "Entry point file path.",
362
+ required: true,
363
+ },
364
+ {
365
+ name: "line",
366
+ description: "Line number (1-based).",
367
+ required: true,
368
+ },
369
+ {
370
+ name: "column",
371
+ description: "Column number (1-based).",
372
+ required: true,
373
+ },
374
+ ],
375
+ },
376
+ {
377
+ name: "ide-diagnostics-board",
378
+ description: "Workspace diagnostics grouped by severity/file, rendered as a sortable HTML table in the browser.",
379
+ arguments: [],
380
+ },
381
+ // ── Edit workflow prompts ─────────────────────────────────────────────────
382
+ {
383
+ name: "safe-refactor",
384
+ description: "Multi-file refactor with preview-before-apply: shows unified diff per file, asks for confirmation, then applies atomically via transaction.",
385
+ arguments: [
386
+ {
387
+ name: "description",
388
+ description: "What to refactor (e.g. 'rename UserService to AccountService').",
389
+ required: true,
390
+ },
391
+ {
392
+ name: "files",
393
+ description: "Comma-separated list of files to consider (optional, scopes the refactor).",
394
+ required: false,
395
+ },
396
+ ],
397
+ },
398
+ {
399
+ name: "diagnose-and-fix",
400
+ description: "Explain the first diagnostic error, propose and preview a fix, apply it, then re-check diagnostics.",
401
+ arguments: [
402
+ {
403
+ name: "filePath",
404
+ description: "File to scope diagnostics to (optional; omit for workspace-wide first error).",
405
+ required: false,
406
+ },
407
+ ],
408
+ },
409
+ {
410
+ name: "session-delta",
411
+ description: "Orient at session start: diff + diagnostic changes since last handoff note, with suggested next action.",
412
+ arguments: [],
413
+ },
414
+ ];
415
+ // ── Orient-project prompt text builder ────────────────────────────────────────
416
+ const ORIENT_PHASE_1 = `## Phase 1 — Discover the project
417
+
418
+ 1. Call \`getProjectInfo\` to detect:
419
+ - Language/runtime (TypeScript, Python, Rust, Go, etc.)
420
+ - Package manager (npm, pnpm, yarn, pip, cargo, go)
421
+ - Frameworks and key dependencies
422
+ - Build, test, lint, and dev scripts
423
+ - Monorepo structure (if any)
424
+
425
+ 2. Call \`getFileTree\` with depth 2 to see the directory layout
426
+
427
+ 3. Call \`getGitStatus\` to check if this is a git repo and its current state
428
+
429
+ 4. Call \`findFiles\` with these patterns to check what already exists:
430
+ - \`CLAUDE.md\`
431
+ - \`documents/*.md\`
432
+ - \`docs/adr/*.md\`
433
+ - \`.claude/rules/*.md\`
434
+ - \`.claude/settings.local.json\`
435
+ - \`README.md\`
436
+
437
+ Store all results mentally — you will use them in every subsequent phase.`;
438
+ function buildOrientPhase2(style) {
439
+ const lines = [
440
+ "## Phase 2 — Generate or update CLAUDE.md",
441
+ "",
442
+ "Based on the project info from Phase 1, create or update the project's CLAUDE.md.",
443
+ ];
444
+ if (style !== "minimal") {
445
+ lines.push("The CLAUDE.md follows a proven pattern: it is the **entry point** that directs Claude", "to `documents/` for reference documentation and `docs/adr/` for design decisions.");
446
+ }
447
+ lines.push("", "### If CLAUDE.md does NOT exist:", "", "Create it with `createFile` at the workspace root. The content should have TWO sections:", "", "**Section A — Project-specific context** (generate from `getProjectInfo` results):", "", "```markdown", "# <Project Name> — Project Instructions", "");
448
+ if (style !== "minimal") {
449
+ lines.push("## Documentation", "", "Read and comply with all documents in `/documents/`. Consult the relevant doc before making changes:", "", "- **[documents/architecture.md](documents/architecture.md)** — System architecture and data flows", "- **[documents/styleguide.md](documents/styleguide.md)** — Code conventions and patterns", "- **[documents/roadmap.md](documents/roadmap.md)** — Development direction and version history", "- **[docs/adr/](docs/adr/)** — Architecture Decision Records", "");
450
+ }
451
+ lines.push("## Tech Stack", "- Language: <detected language>", "- Framework: <detected framework(s)>", "- Package manager: <detected>", "- Test runner: <detected>", "", "## Key Commands", "| Task | Command |", "|------|---------|", "| Build | `<detected build command>` |", "| Test | `<detected test command>` |", "| Lint | `<detected lint command>` |", "| Dev | `<detected dev command>` |", "", "## Project Structure", "<Top-level directory listing with one-line descriptions based on getFileTree results>", "", "## Conventions", "<Infer 3-5 conventions from config files detected by getProjectInfo:", '- If tsconfig.json: "TypeScript strict mode" (check if strict: true)', '- If biome.json/eslint: "Linting with <tool>"', '- If prettier/.prettierrc: "Formatting with Prettier"', '- If vitest/jest: "Testing with <framework>"', '- If .github/workflows: "CI via GitHub Actions">', "```", "", "**Section B — Bridge workflow section:**", "", "Append the standard Claude IDE Bridge section. Include ALL of the following:", "- `## Claude IDE Bridge` header", '- "The bridge is connected via MCP. Call `getToolCapabilities` at the start of each session..."', "- Bug fix methodology (test-first: write failing test, fix, confirm)", "- Documentation & memory rules (update CLAUDE.md after arch changes, save decisions to memory, prune stale instructions)", "- Modular rules note (reference `.claude/rules/` directory)", "- Workflow rules (getDiagnostics after edits, runTests, bridge git tools, debugging, navigation)", "- Quick reference table (14 tasks mapped to tools)", "- Dispatch prompts table (phone message → prompt → tools)", "- Agent Teams & Scheduled Tasks table", "", "### If CLAUDE.md ALREADY exists:", "", "1. Read it with `getBufferContent`", "2. Check if it already has a `## Claude IDE Bridge` section", "3. If the bridge section is missing: append Section B (bridge section only) using `editText` — do NOT duplicate or overwrite existing project context", '4. If the bridge section already exists: report "Bridge section already present — no changes needed"');
452
+ if (style !== "minimal") {
453
+ lines.push("5. Check if the existing CLAUDE.md has a `## Documentation` section referencing `documents/`. If missing, suggest adding it but do NOT modify existing content without asking");
454
+ }
455
+ return lines.join("\n");
456
+ }
457
+ const ORIENT_PHASE_3_DOCS = `## Phase 3 — Scaffold documents/ directory
458
+
459
+ Create documentation stubs that do not already exist. These give Claude and developers
460
+ a structure to fill in over time. Populate what you can from \`getProjectInfo\` and
461
+ \`getFileTree\` results; leave \`<placeholders>\` for the rest.
462
+
463
+ ### documents/architecture.md
464
+
465
+ \`\`\`markdown
466
+ # Architecture
467
+
468
+ ## Overview
469
+ <Describe the system architecture, key components, and how they interact>
470
+
471
+ ## Data Flow
472
+ <Request lifecycle, state ownership, key flows>
473
+
474
+ ## Key Design Decisions
475
+ See [docs/adr/](../docs/adr/) for Architecture Decision Records.
476
+ \`\`\`
477
+
478
+ ### documents/styleguide.md
479
+
480
+ \`\`\`markdown
481
+ # Style Guide
482
+
483
+ ## Code Conventions
484
+ <Naming, formatting, file organization rules for this project>
485
+
486
+ ## Patterns
487
+ <Common patterns used across the codebase>
488
+
489
+ ## Anti-patterns
490
+ <What to avoid and why>
491
+ \`\`\`
492
+
493
+ ### documents/roadmap.md
494
+
495
+ \`\`\`markdown
496
+ # Roadmap
497
+
498
+ ## Current Version
499
+ <version> — <date>
500
+
501
+ ## Recent Changes
502
+ <What shipped recently>
503
+
504
+ ## Planned
505
+ <What's next>
506
+ \`\`\`
507
+
508
+ Use \`createFile\` for each file. If \`documents/\` does not exist, \`createFile\` will create intermediate directories.
509
+ Only create files that do NOT already exist (check Phase 1 results).`;
510
+ const ORIENT_PHASE_3_DOCS_FULL_EXTRA = `
511
+ ### documents/use-cases.md (full style only)
512
+
513
+ \`\`\`markdown
514
+ # Use Cases
515
+
516
+ ## Workflows
517
+ <Key user workflows and how they map to code paths>
518
+
519
+ ## Integration Points
520
+ <External systems, APIs, and how they connect>
521
+ \`\`\``;
522
+ const ORIENT_PHASE_3B_ADR = `## Phase 3b — Scaffold docs/adr/ directory
523
+
524
+ Create the ADR directory with a README template if it does not already exist.
525
+
526
+ ### docs/adr/README.md
527
+
528
+ \`\`\`markdown
529
+ # Architecture Decision Records
530
+
531
+ This directory contains Architecture Decision Records (ADRs) for non-obvious design decisions.
532
+
533
+ ## Format
534
+
535
+ Each ADR follows this template:
536
+
537
+ - **Status:** Proposed | Accepted | Deprecated | Superseded by ADR-NNNN
538
+ - **Date:** YYYY-MM-DD
539
+ - **Context:** The problem or situation
540
+ - **Decision:** The choice made
541
+ - **Consequences:** Positive and negative outcomes
542
+
543
+ ## Index
544
+
545
+ | ADR | Title | Status |
546
+ |-----|-------|--------|
547
+ | (none yet) | | |
548
+
549
+ ## When to write an ADR
550
+
551
+ Write an ADR when:
552
+ - A design decision is non-obvious and someone might question it later
553
+ - You chose between multiple valid approaches
554
+ - A constraint or trade-off shaped the design
555
+ - You are deprecating or replacing an existing pattern
556
+ \`\`\`
557
+
558
+ Do NOT create numbered ADR files — those are written by developers as decisions arise. The README gives them the template and format.`;
559
+ const ORIENT_PHASE_3C_RULES = `## Phase 3c — Scaffold .claude/rules/
560
+
561
+ Create rule files that do NOT already exist (check Phase 1 results).
562
+
563
+ ### For ALL project types, create:
564
+
565
+ **.claude/rules/bridge-tools.md** (skip if already exists — written by \`claude-ide-bridge init\`):
566
+ \`\`\`markdown
567
+ ${_bridgeToolsTemplate}
568
+ \`\`\`
569
+
570
+ Also add \`@import .claude/rules/bridge-tools.md\` to the top of the \`## Claude IDE Bridge\` section in CLAUDE.md if not already present.
571
+
572
+ **.claude/rules/testing.md:**
573
+ \`\`\`markdown
574
+ # Testing Rules
575
+
576
+ - Write tests BEFORE fixing bugs (test-first methodology)
577
+ - Use \`runTests\` bridge tool instead of shell commands
578
+ - After creating tests, call \`getDiagnostics\` to verify no type errors in test files
579
+ - Follow existing test file naming: \`<name>.test.<ext>\` (or \`<name>_test.<ext>\` for Go)
580
+ - Test edge cases: empty inputs, null/undefined, boundary values, error conditions
581
+ - Call \`getCodeCoverage\` (if available) to identify untested paths before writing tests
582
+ \`\`\`
583
+
584
+ **.claude/rules/security.md:**
585
+ \`\`\`markdown
586
+ # Security Rules
587
+
588
+ - Never commit secrets, API keys, tokens, or credentials
589
+ - Validate all user inputs at trust boundaries
590
+ - Use parameterized queries for database operations — never string concatenation
591
+ - Check \`getSecurityAdvisories\` and \`auditDependencies\` before releases
592
+ - Review authentication and authorization on every endpoint change
593
+ - Sanitize data before rendering in templates (XSS prevention)
594
+ \`\`\`
595
+
596
+ **.claude/rules/workflow.md:**
597
+ \`\`\`markdown
598
+ # Workflow Rules
599
+
600
+ - After editing ANY file, call \`getDiagnostics\` to catch regressions
601
+ - Use bridge git tools (\`getGitStatus\`, \`gitAdd\`, \`gitCommit\`) for auditable operations
602
+ - Call \`getProjectInfo\` at the start of each session for context
603
+ - Use \`goToDefinition\` and \`findReferences\` instead of grep for code navigation
604
+ - Check \`getOpenEditors\` for context on what the user is working on
605
+ - Run \`formatDocument\` before committing if a formatter is configured
606
+ \`\`\`
607
+
608
+ ### Language-specific rules (based on getProjectInfo detection):
609
+
610
+ **If TypeScript/JavaScript detected, also create .claude/rules/typescript.md:**
611
+ \`\`\`markdown
612
+ # TypeScript Rules
613
+
614
+ - Enable and respect \`strict\` mode in tsconfig.json
615
+ - Prefer \`interface\` over \`type\` for object shapes (unless union/intersection needed)
616
+ - Use \`as const\` for literal types and readonly arrays
617
+ - Never use \`any\` — use \`unknown\` with type guards instead
618
+ - Prefer \`??\` (nullish coalescing) over \`||\` for default values
619
+ - Handle Promise rejections — no unhandled promise warnings
620
+ \`\`\`
621
+
622
+ **If Python detected, also create .claude/rules/python.md:**
623
+ \`\`\`markdown
624
+ # Python Rules
625
+
626
+ - Use type hints on all function signatures
627
+ - Follow PEP 8 style conventions
628
+ - Prefer \`pathlib.Path\` over \`os.path\` for file operations
629
+ - Use context managers (\`with\` statements) for resource management
630
+ - Handle exceptions specifically — avoid bare \`except:\`
631
+ - Use \`dataclasses\` or \`pydantic\` for data structures
632
+ \`\`\`
633
+
634
+ **If Rust detected, also create .claude/rules/rust.md:**
635
+ \`\`\`markdown
636
+ # Rust Rules
637
+
638
+ - Follow the ownership model — minimize \`.clone()\` calls
639
+ - Use \`Result<T, E>\` for fallible operations, not panics
640
+ - Prefer \`&str\` over \`String\` in function parameters
641
+ - Use \`cargo clippy\` diagnostics (check via \`getDiagnostics\`)
642
+ - Implement \`Display\` and \`Error\` traits for custom error types
643
+ - Use \`#[must_use]\` on functions whose return values should not be ignored
644
+ \`\`\`
645
+
646
+ **If Go detected, also create .claude/rules/go.md:**
647
+ \`\`\`markdown
648
+ # Go Rules
649
+
650
+ - Follow effective Go conventions and Go proverbs
651
+ - Handle errors explicitly — never use \`_\` to discard errors
652
+ - Use \`context.Context\` as the first parameter for functions that do I/O
653
+ - Prefer table-driven tests
654
+ - Run \`go vet\` and \`golangci-lint\` via diagnostics tools
655
+ - Use meaningful variable names — avoid single-letter names outside loops
656
+ \`\`\`
657
+
658
+ Use \`createFile\` for each rule file. Only create files that do NOT already exist.`;
659
+ const ORIENT_PHASE_3D_FULL = `## Phase 3d — Additional scaffolding (full style only)
660
+
661
+ ### Create .claude/commands/orient.md:
662
+
663
+ \`\`\`markdown
664
+ Re-run project orientation: discover project type, update CLAUDE.md, and verify bridge connectivity.
665
+
666
+ Call the \`orient-project\` MCP prompt to re-orient this project. This is safe to run multiple times — it will only create files that don't already exist and will not overwrite existing content.
667
+ \`\`\`
668
+
669
+ This lets users re-run orientation via \`/project:orient\` in Claude Code.
670
+
671
+ ### Create .claude/agents/project-builder.md:
672
+
673
+ \`\`\`markdown
674
+ ---
675
+ name: project-builder
676
+ description: Build, test, and lint the project. Use when you need to verify changes compile and pass tests.
677
+ disallowedTools: Edit, Write
678
+ model: sonnet
679
+ ---
680
+
681
+ You are a build verification agent. Your job is to verify the project builds, tests pass, and linting is clean.
682
+
683
+ 1. Call \`getProjectInfo\` to detect build/test/lint commands
684
+ 2. Call \`runTests\` to run the test suite
685
+ 3. Call \`getDiagnostics\` to check for compilation errors
686
+ 4. If there is a build script, call \`runCommand\` with it
687
+ 5. Report results in a structured format:
688
+ - BUILD: PASS/FAIL
689
+ - TESTS: N passed, M failed
690
+ - LINT: N errors, M warnings
691
+ \`\`\`
692
+
693
+ For non-TypeScript/JavaScript projects, adapt the agent instructions to use the appropriate build/test tools (cargo build, go build, pytest, etc.).`;
694
+ const ORIENT_PHASE_4 = `## Phase 4 — Verify bridge connectivity
695
+
696
+ 1. Call \`getToolCapabilities\` to confirm:
697
+ - Which CLI tools are available (git, rg, fd)
698
+ - Whether the VS Code extension is connected
699
+ - Which linters and formatters are detected
700
+ - Which test runners are available
701
+
702
+ 2. If the extension is NOT connected:
703
+ - Note this in the summary but do NOT treat it as a failure
704
+ - Explain which tools will be limited (LSP features: goToDefinition, findReferences, getHover, debugging)
705
+
706
+ 3. If the extension IS connected:
707
+ - Call \`getDiagnostics\` with no file argument to verify it returns results
708
+ - Confirm full tool access
709
+
710
+ Report any issues found.`;
711
+ function buildOrientPhase5(style) {
712
+ const lines = [
713
+ "## Phase 5 — Summary report",
714
+ "",
715
+ "Produce a structured summary of everything that was done:",
716
+ "",
717
+ "```",
718
+ "# Orient Project — Summary",
719
+ "",
720
+ "## Project",
721
+ "- Name: <name>",
722
+ "- Type: <language/framework>",
723
+ "",
724
+ "## Files",
725
+ "- [ ] CLAUDE.md — <created | updated | already up to date>",
726
+ ];
727
+ if (style !== "minimal") {
728
+ lines.push("- [ ] documents/architecture.md — <created | already existed>", "- [ ] documents/styleguide.md — <created | already existed>", "- [ ] documents/roadmap.md — <created | already existed>", "- [ ] docs/adr/README.md — <created | already existed>", "- [ ] .claude/rules/bridge-tools.md — <created | already existed>", "- [ ] .claude/rules/testing.md — <created | already existed>", "- [ ] .claude/rules/security.md — <created | already existed>", "- [ ] .claude/rules/workflow.md — <created | already existed>", "- [ ] .claude/rules/<language>.md — <created | already existed | N/A>");
729
+ }
730
+ lines.push("", "## Bridge status", "- Extension: <connected | not connected>", "- CLI tools: <list available>", "- Test runner: <detected runner>", "", "## Next steps", "1. Review CLAUDE.md and fill in project-specific sections");
731
+ if (style !== "minimal") {
732
+ lines.push("2. Fill in documents/architecture.md with your system design", "3. Fill in documents/styleguide.md with your code conventions", "4. Review .claude/rules/ and adjust to match your team's preferences", "5. Run `/health-check` to verify tests and diagnostics", "6. Write your first ADR when you make a non-obvious design decision");
733
+ }
734
+ else {
735
+ lines.push("2. Run `/health-check` to verify tests and diagnostics", "3. Consider re-running with style=standard for full documentation scaffolding");
736
+ }
737
+ lines.push("```", "", 'Keep the summary concise. If everything was already set up, just say "Project already oriented — no changes needed" with a brief status confirmation.');
738
+ return lines.join("\n");
739
+ }
740
+ function buildOrientPromptText(style) {
741
+ const sections = [
742
+ "Set up this project to work with the Claude IDE Bridge.",
743
+ "This process is idempotent — safe to run multiple times. It will only create files that do not already exist and will not overwrite existing content.",
744
+ "",
745
+ ORIENT_PHASE_1,
746
+ "",
747
+ buildOrientPhase2(style),
748
+ ];
749
+ if (style !== "minimal") {
750
+ sections.push("", ORIENT_PHASE_3_DOCS);
751
+ if (style === "full") {
752
+ sections.push(ORIENT_PHASE_3_DOCS_FULL_EXTRA);
753
+ }
754
+ sections.push("", ORIENT_PHASE_3B_ADR);
755
+ sections.push("", ORIENT_PHASE_3C_RULES);
756
+ if (style === "full") {
757
+ sections.push("", ORIENT_PHASE_3D_FULL);
758
+ }
759
+ }
760
+ sections.push("", ORIENT_PHASE_4);
761
+ sections.push("", buildOrientPhase5(style));
762
+ return sections.join("\n");
763
+ }
764
+ // ── Prompt template strings ───────────────────────────────────────────────────
765
+ const TEMPLATES = {
766
+ "review-changes": ({ file }) => ({
767
+ description: `Review uncommitted changes to ${file}`,
768
+ messages: [
769
+ {
770
+ role: "user",
771
+ content: {
772
+ type: "text",
773
+ text: [
774
+ `Review uncommitted changes to \`${file}\`.`,
775
+ "",
776
+ "1. getGitDiff for the file — what changed",
777
+ "2. getDiagnostics for the file — current errors/warnings",
778
+ "3. getGitHotspots — is this a high-churn file?",
779
+ "",
780
+ "Format findings as one line each: [Category] file:line — issue — recommendation",
781
+ "Categories: Correctness | Style | Perf | Security | Tests | Design",
782
+ "End with a one-line commit message suggestion. No prose between findings.",
783
+ ].join("\n"),
784
+ },
785
+ },
786
+ ],
787
+ }),
788
+ "review-file": ({ file }) => ({
789
+ description: `Code review of ${file}`,
790
+ messages: [
791
+ {
792
+ role: "user",
793
+ content: {
794
+ type: "text",
795
+ text: [
796
+ `Code review: \`${file}\`.`,
797
+ "",
798
+ "getDiagnostics + getBufferContent first.",
799
+ "",
800
+ "Format each finding as one line: [Category] file:line — issue — fix",
801
+ "Categories: Correctness | Style | Perf | Security | Tests",
802
+ "Max 20 findings. No prose between findings.",
803
+ ].join("\n"),
804
+ },
805
+ },
806
+ ],
807
+ }),
808
+ "explain-diagnostics": ({ file }) => ({
809
+ description: `Explain diagnostics for ${file}`,
810
+ messages: [
811
+ {
812
+ role: "user",
813
+ content: {
814
+ type: "text",
815
+ text: [
816
+ `getDiagnostics for \`${file}\`.`,
817
+ "",
818
+ "Each error: 1-line cause + corrected code block. Apply fix with editText. No prose.",
819
+ ].join("\n"),
820
+ },
821
+ },
822
+ ],
823
+ }),
824
+ "generate-tests": ({ file }) => ({
825
+ description: `Generate tests for ${file}`,
826
+ messages: [
827
+ {
828
+ role: "user",
829
+ content: {
830
+ type: "text",
831
+ text: [
832
+ `Generate unit tests for \`${file}\`.`,
833
+ "",
834
+ "1. getBufferContent — read file",
835
+ "2. findFiles — check existing test conventions",
836
+ "3. getCodeCoverage (if available) — find uncovered paths",
837
+ "4. Write tests: happy paths, edge cases, error conditions, boundary values.",
838
+ "Match project testing framework + style exactly.",
839
+ ].join("\n"),
840
+ },
841
+ },
842
+ ],
843
+ }),
844
+ "debug-context": (_args) => ({
845
+ description: "Current IDE debug context",
846
+ messages: [
847
+ {
848
+ role: "user",
849
+ content: {
850
+ type: "text",
851
+ text: [
852
+ "IDE debug snapshot:",
853
+ "",
854
+ "1. getOpenEditors — open files",
855
+ "2. getDiagnostics — errors/warnings per open file",
856
+ "3. getTerminalOutput — active terminal output",
857
+ "4. getGitStatus — uncommitted changes",
858
+ "",
859
+ "Root causes of problems: 1 line each.",
860
+ ].join("\n"),
861
+ },
862
+ },
863
+ ],
864
+ }),
865
+ cowork: ({ task = "" }) => {
866
+ const taskLine = task ? `\nFocus: **${task}**\n` : "";
867
+ return {
868
+ description: task
869
+ ? `Cowork context — ${task}`
870
+ : "Cowork context — full IDE snapshot",
871
+ messages: [
872
+ {
873
+ role: "user",
874
+ content: {
875
+ type: "text",
876
+ text: [
877
+ "**Context check:** If bridge tools (getHandoffNote, getOpenEditors, etc.) are not in your available tools list, you are inside a Cowork session where MCP is unavailable. Exit Cowork, run this prompt in regular Claude Code or Desktop chat to collect context and set a handoff note, then return to Cowork.",
878
+ "",
879
+ "## Step 1 of 2 — Gather IDE context (you are here)",
880
+ "",
881
+ "⚠️ **Important:** Cowork (computer-use) sessions do NOT have access to MCP bridge tools.",
882
+ "This prompt must be run in a regular Claude Code or Claude Desktop chat BEFORE opening Cowork.",
883
+ taskLine,
884
+ "Collect full IDE context:",
885
+ "",
886
+ "1. Call `getHandoffNote` — check for prior session context or an in-progress task",
887
+ "2. Call `getOpenEditors` — list open files and any unsaved changes",
888
+ "3. Call `getDiagnostics` — surface errors and warnings across the workspace",
889
+ "4. Call `getGitStatus` — show staged, unstaged, and untracked changes",
890
+ "5. Call `getProjectInfo` — detect project type, key scripts, and dependencies",
891
+ "",
892
+ "After collecting context:",
893
+ "- Summarise the current workspace state in 3–5 bullet points",
894
+ "- Propose a concrete, step-by-step Cowork action plan",
895
+ "- Call out anything that needs clarification before starting",
896
+ "",
897
+ "## Step 2 of 2 — Hand off to Cowork",
898
+ "",
899
+ "Once the plan is clear, call `setHandoffNote` with a concise summary so the Cowork session",
900
+ "can pick up where you left off. Then open Cowork (Cmd+2 on Mac) and type:",
901
+ "",
902
+ " /mcp__bridge__cowork",
903
+ "",
904
+ "The Cowork session will read the handoff note and execute the plan using computer-use.",
905
+ "",
906
+ "---",
907
+ "After the tool calls above, end your response with a ready-to-use `setHandoffNote` call",
908
+ "that summarises the task, relevant file paths, and the action plan in 3–5 bullets.",
909
+ ].join("\n"),
910
+ },
911
+ },
912
+ ],
913
+ };
914
+ },
915
+ "set-effort": ({ level = "medium" }) => {
916
+ const validLevels = ["low", "medium", "high"];
917
+ const eff = validLevels.includes(level)
918
+ ? level
919
+ : "medium";
920
+ const guidance = {
921
+ low: "Respond concisely. Prefer quick, direct answers without extensive analysis or exhaustive edge-case coverage.",
922
+ medium: "Balance thoroughness with speed. Cover the main cases and explain your reasoning briefly.",
923
+ high: "Apply maximum effort. Think step by step, explore edge cases, and produce the most complete and correct result possible.",
924
+ };
925
+ return {
926
+ description: `Effort level set to: ${eff}`,
927
+ messages: [
928
+ {
929
+ role: "user",
930
+ content: {
931
+ type: "text",
932
+ text: `[Effort instruction for this task]\n${guidance[eff]}\n\nPlease acknowledge this effort level and apply it to all subsequent work in this conversation.`,
933
+ },
934
+ },
935
+ ],
936
+ };
937
+ },
938
+ "gen-claude-md": (_args) => ({
939
+ description: "Generate bridge workflow section for CLAUDE.md",
940
+ messages: [
941
+ {
942
+ role: "user",
943
+ content: {
944
+ type: "text",
945
+ text: [
946
+ "Add the Claude IDE Bridge workflow section to this project's `CLAUDE.md`.",
947
+ "",
948
+ "Steps:",
949
+ "1. Check if `CLAUDE.md` already exists in the workspace root using `findFiles`",
950
+ "2. If it exists, read it with `getBufferContent` to check for an existing `## Claude IDE Bridge` section",
951
+ "3. If the section already exists, report that no changes are needed",
952
+ "4. Otherwise, append the following content to `CLAUDE.md` (or create it if absent):",
953
+ "",
954
+ "---",
955
+ "## Claude IDE Bridge",
956
+ "",
957
+ "The bridge is connected via MCP. Call `getToolCapabilities` at the start of each session to confirm which tools are available and note any that require the VS Code extension.",
958
+ "",
959
+ "### Workflow rules",
960
+ "",
961
+ "- **After editing any file** — call `getDiagnostics` to catch errors introduced by the change",
962
+ "- **Running tests** — use `runTests` instead of shell commands; output streams in real time",
963
+ "- **Git operations** — use bridge git tools (`gitStatus`, `gitAdd`, `gitCommit`, `gitPush`) for structured, auditable operations",
964
+ "- **Debugging** — use `setDebugBreakpoints` → `startDebugging` → `evaluateInDebugger` for interactive debugging",
965
+ "- **Navigating code** — prefer `goToDefinition`, `findReferences`, and `getCallHierarchy` over grep",
966
+ "",
967
+ "### Quick reference",
968
+ "",
969
+ "| Task | Tool |",
970
+ "|---|---|",
971
+ "| Check errors / warnings | `getDiagnostics` |",
972
+ "| Run tests | `runTests` |",
973
+ "| Git status / diff | `gitStatus`, `gitDiff` |",
974
+ "| Stage, commit, push | `gitAdd`, `gitCommit`, `gitPush` |",
975
+ "| Open a pull request | `githubCreatePR` |",
976
+ "| Navigate to definition | `goToDefinition` |",
977
+ "| Find all references | `findReferences` |",
978
+ "| Call hierarchy | `getCallHierarchy` |",
979
+ "| File tree / symbols | `getFileTree`, `getDocumentSymbols` |",
980
+ "| Run a shell command | `runInTerminal`, `getTerminalOutput` |",
981
+ "| Interactive debug | `setDebugBreakpoints`, `startDebugging`, `evaluateInDebugger` |",
982
+ "| Lint / format | `fixAllLintErrors`, `formatDocument` |",
983
+ "| Security audit | `getSecurityAdvisories`, `auditDependencies` |",
984
+ "| Unused code | `detectUnusedCode` |",
985
+ "---",
986
+ ].join("\n"),
987
+ },
988
+ },
989
+ ],
990
+ }),
991
+ "git-review": ({ base = "main" }) => ({
992
+ description: `Review changes vs ${base}`,
993
+ messages: [
994
+ {
995
+ role: "user",
996
+ content: {
997
+ type: "text",
998
+ text: [
999
+ `getGitDiff (vs \`${base}\`) + getGitStatus + getDiagnostics (changed files).`,
1000
+ "",
1001
+ "Bugs/logic problems introduced.",
1002
+ "Style/consistency issues.",
1003
+ "Missing tests for new code.",
1004
+ "Suggested commit msg (conventional-commits).",
1005
+ ].join("\n"),
1006
+ },
1007
+ },
1008
+ ],
1009
+ }),
1010
+ // ── Dispatch prompts (phone-friendly, terse triggers) ───────────────────────
1011
+ "project-status": (_args) => ({
1012
+ description: "Project health check",
1013
+ messages: [
1014
+ {
1015
+ role: "user",
1016
+ content: {
1017
+ type: "text",
1018
+ text: [
1019
+ "getGitStatus + getDiagnostics + runTests. Report:",
1020
+ "```",
1021
+ "Branch: <name> (<clean|N uncommitted>)",
1022
+ "Diag: <N errors, M warnings | clear>",
1023
+ "Tests: <N passed, M failed | passing>",
1024
+ "```",
1025
+ "Broken → 1-line cause each. ≤20 lines total.",
1026
+ ].join("\n"),
1027
+ },
1028
+ },
1029
+ ],
1030
+ }),
1031
+ "quick-tests": ({ filter = "" }) => {
1032
+ const filterLine = filter ? `\nFilter: \`${filter}\`\n` : "";
1033
+ return {
1034
+ description: filter ? `Run tests: ${filter}` : "Run all tests",
1035
+ messages: [
1036
+ {
1037
+ role: "user",
1038
+ content: {
1039
+ type: "text",
1040
+ text: [
1041
+ "Run the project's tests and return a concise summary for mobile reading.",
1042
+ filterLine,
1043
+ filter
1044
+ ? `1. Call \`runTests\` with filter \`${filter}\``
1045
+ : "1. Call `runTests` with no filter (full suite)",
1046
+ "2. Report pass/fail counts and total duration",
1047
+ "3. For failures (up to 5): show test name + one-line reason",
1048
+ "4. If all pass, just say: 'All N tests passing (Xs)'",
1049
+ "",
1050
+ "Keep the response under 15 lines. No stack traces — just test name and failure reason.",
1051
+ ].join("\n"),
1052
+ },
1053
+ },
1054
+ ],
1055
+ };
1056
+ },
1057
+ "quick-review": (_args) => ({
1058
+ description: "Review uncommitted changes",
1059
+ messages: [
1060
+ {
1061
+ role: "user",
1062
+ content: {
1063
+ type: "text",
1064
+ text: [
1065
+ "getGitStatus + getGitDiff + getDiagnostics (changed files, ≤10).",
1066
+ "",
1067
+ "1 line per changed file: what changed.",
1068
+ "New errors/warnings introduced.",
1069
+ "1-line verdict: safe to commit?",
1070
+ "≤25 lines. Skip unchanged files.",
1071
+ ].join("\n"),
1072
+ },
1073
+ },
1074
+ ],
1075
+ }),
1076
+ "build-check": (_args) => ({
1077
+ description: "Build/compile check",
1078
+ messages: [
1079
+ {
1080
+ role: "user",
1081
+ content: {
1082
+ type: "text",
1083
+ text: [
1084
+ "getProjectInfo + getDiagnostics + runCommand (build script).",
1085
+ "",
1086
+ "BUILD PASSING or BUILD FAILING.",
1087
+ "Failing → file:line:msg, ≤10 errors.",
1088
+ "Passing → '0 errors'. ≤15 lines.",
1089
+ ].join("\n"),
1090
+ },
1091
+ },
1092
+ ],
1093
+ }),
1094
+ "recent-activity": ({ count = "10" }) => ({
1095
+ description: `Recent activity (last ${count} commits)`,
1096
+ messages: [
1097
+ {
1098
+ role: "user",
1099
+ content: {
1100
+ type: "text",
1101
+ text: [
1102
+ `getGitLog (limit ${count}) + getGitStatus.`,
1103
+ "",
1104
+ "Each commit: `<hash> <rel-time> <subject>` — 1 line.",
1105
+ "Uncommitted → append 'WIP' section.",
1106
+ "No author/full date.",
1107
+ ].join("\n"),
1108
+ },
1109
+ },
1110
+ ],
1111
+ }),
1112
+ // ── Agent Teams & Scheduled Tasks prompts ───────────────────────────────────
1113
+ "team-status": (_args) => ({
1114
+ description: "Agent team overview",
1115
+ messages: [
1116
+ {
1117
+ role: "user",
1118
+ content: {
1119
+ type: "text",
1120
+ text: [
1121
+ "getGitStatus + getDiagnostics + getOpenEditors + listClaudeTasks + getActivityLog (last 10).",
1122
+ "",
1123
+ "```",
1124
+ "## Workspace",
1125
+ "Branch: <name> (<clean|N uncommitted>)",
1126
+ "Diag: <N errors, M warnings>",
1127
+ "Open: <files>",
1128
+ "",
1129
+ "## Tasks",
1130
+ "<taskId> <status> <prompt[:60]>",
1131
+ "",
1132
+ "## Activity",
1133
+ "<time> <tool> <session> <result>",
1134
+ "```",
1135
+ "Skip unavailable sections. Flag conflicts (same file, multiple sessions).",
1136
+ ].join("\n"),
1137
+ },
1138
+ },
1139
+ ],
1140
+ }),
1141
+ "orient-project": ({ style = "standard" }) => {
1142
+ const validStyles = ["minimal", "standard", "full"];
1143
+ const s = validStyles.includes(style)
1144
+ ? style
1145
+ : "standard";
1146
+ return {
1147
+ description: "Orient project for Claude IDE Bridge",
1148
+ messages: [
1149
+ {
1150
+ role: "user",
1151
+ content: {
1152
+ type: "text",
1153
+ text: buildOrientPromptText(s),
1154
+ },
1155
+ },
1156
+ ],
1157
+ };
1158
+ },
1159
+ "health-check": (_args) => ({
1160
+ description: "Comprehensive project health check",
1161
+ messages: [
1162
+ {
1163
+ role: "user",
1164
+ content: {
1165
+ type: "text",
1166
+ text: [
1167
+ "Project health check. Terse output — counts + failures only, no prose.",
1168
+ "",
1169
+ "1. getGitStatus — branch, uncommitted, ahead/behind",
1170
+ "2. getDiagnostics — errors + warnings grouped by file",
1171
+ "3. runTests — pass/fail/skip counts + failures",
1172
+ "4. getSecurityAdvisories — CVEs in deps",
1173
+ "5. auditDependencies (if available) — pkg audit",
1174
+ "",
1175
+ "Format as a structured health report:",
1176
+ "```",
1177
+ "# Project Health Report",
1178
+ "",
1179
+ "## Git",
1180
+ "Branch: <name>",
1181
+ "Status: <clean | N uncommitted changes>",
1182
+ "Remote: <up to date | N ahead, M behind>",
1183
+ "",
1184
+ "## Diagnostics",
1185
+ "Errors: N | Warnings: M",
1186
+ "<file:line — message> (list all errors, up to 20)",
1187
+ "",
1188
+ "## Tests",
1189
+ "Result: <N passed, M failed, K skipped> (Xs)",
1190
+ "<failing test name — reason> (list all failures)",
1191
+ "",
1192
+ "## Security",
1193
+ "Advisories: <N critical, M high, K moderate | None found>",
1194
+ "<package — severity — advisory title> (list all)",
1195
+ "",
1196
+ "## Overall: HEALTHY | DEGRADED | FAILING",
1197
+ "```",
1198
+ "",
1199
+ "Use HEALTHY if: 0 errors, all tests pass, no critical/high advisories.",
1200
+ "Use DEGRADED if: warnings only, or moderate advisories.",
1201
+ "Use FAILING if: any errors, test failures, or critical/high advisories.",
1202
+ "",
1203
+ "If `getSecurityAdvisories` or `auditDependencies` are unavailable, note 'Security: not checked (tools unavailable)'.",
1204
+ ].join("\n"),
1205
+ },
1206
+ },
1207
+ ],
1208
+ }),
1209
+ // ── LSP composition prompts ──────────────────────────────────────────────
1210
+ "find-callers": ({ symbol }) => ({
1211
+ description: `Find callers of ${symbol}`,
1212
+ messages: [
1213
+ {
1214
+ role: "user",
1215
+ content: {
1216
+ type: "text",
1217
+ text: [
1218
+ `searchWorkspaceSymbols("${symbol}") → getCallHierarchy(incoming) → findReferences (cross-verify dynamic dispatch).`,
1219
+ "",
1220
+ "```",
1221
+ `Symbol: ${symbol} @ <file:line>`,
1222
+ "Callers (N):",
1223
+ " <file:line> <fn>",
1224
+ "```",
1225
+ "≤25 lines. Not found → stop.",
1226
+ ].join("\n"),
1227
+ },
1228
+ },
1229
+ ],
1230
+ }),
1231
+ "blast-radius": ({ file, line, column }) => ({
1232
+ description: `Blast radius at ${file}:${line}:${column}`,
1233
+ messages: [
1234
+ {
1235
+ role: "user",
1236
+ content: {
1237
+ type: "text",
1238
+ text: [
1239
+ `getChangeImpact(${file}:${line}:${column}) → blastRadius, referenceCount, affectedFiles, diagnostics.`,
1240
+ "",
1241
+ "```",
1242
+ `${file}:${line}:${column}`,
1243
+ "Risk: <LOW|MEDIUM|HIGH>",
1244
+ "Refs: N (M files)",
1245
+ "Diag: X errors, Y warnings",
1246
+ "Top affected: <file> (<refs> refs)",
1247
+ "```",
1248
+ "MEDIUM/HIGH → top 5 files. ≤20 lines.",
1249
+ ].join("\n"),
1250
+ },
1251
+ },
1252
+ ],
1253
+ }),
1254
+ "why-error": ({ file, line }) => {
1255
+ const lineHint = line ? ` (focus on line ${line})` : "";
1256
+ return {
1257
+ description: `Explain error in ${file}${lineHint}`,
1258
+ messages: [
1259
+ {
1260
+ role: "user",
1261
+ content: {
1262
+ type: "text",
1263
+ text: [
1264
+ `getDiagnostics(${file}) → ${line ? `nearest err to line ${line}` : "first error"} → explainSymbol + getHover at position.`,
1265
+ "",
1266
+ "What err says. Why wrong (use type info). Fix → corrected code.",
1267
+ "≤30 lines. No jargon without def.",
1268
+ ].join("\n"),
1269
+ },
1270
+ },
1271
+ ],
1272
+ };
1273
+ },
1274
+ "unused-in": ({ file }) => ({
1275
+ description: `Unused code in ${file}`,
1276
+ messages: [
1277
+ {
1278
+ role: "user",
1279
+ content: {
1280
+ type: "text",
1281
+ text: [
1282
+ `detectUnusedCode(${file}) → findReferences per candidate (verify 0 ext uses) → cross-check imports.`,
1283
+ "",
1284
+ "```",
1285
+ `## Unused in ${file}`,
1286
+ "### Dead (0 refs) — safe delete",
1287
+ "- <kind> <name> (<line>)",
1288
+ "### Local-only — consider private",
1289
+ "- <kind> <name> (<line>)",
1290
+ "### Unused imports — safe remove",
1291
+ "- <import> (<line>)",
1292
+ "```",
1293
+ "Nothing unused → stop. ≤30 lines.",
1294
+ ].join("\n"),
1295
+ },
1296
+ },
1297
+ ],
1298
+ }),
1299
+ "trace-to": ({ symbol }) => ({
1300
+ description: `Trace call chain to ${symbol}`,
1301
+ messages: [
1302
+ {
1303
+ role: "user",
1304
+ content: {
1305
+ type: "text",
1306
+ text: [
1307
+ `searchWorkspaceSymbols("${symbol}") → getCallHierarchy(incoming, ≤5 levels) → getHover per hop → getImportedSignatures on entry file.`,
1308
+ "",
1309
+ "```",
1310
+ "Entry: <fn>(<args>): <ret> @ <file:line>",
1311
+ " ↓",
1312
+ "<intermediate>(<args>): <ret> @ <file:line>",
1313
+ " ↓",
1314
+ `${symbol}(<args>): <ret> @ <file:line>`,
1315
+ "```",
1316
+ "≤35 lines. Multiple entry points → 2 shortest chains.",
1317
+ ].join("\n"),
1318
+ },
1319
+ },
1320
+ ],
1321
+ }),
1322
+ "imports-of": ({ symbol }) => ({
1323
+ description: `Files importing ${symbol}`,
1324
+ messages: [
1325
+ {
1326
+ role: "user",
1327
+ content: {
1328
+ type: "text",
1329
+ text: [
1330
+ `searchWorkspaceSymbols("${symbol}") → findReferences (filter to import statements) → count inline refs per file.`,
1331
+ "",
1332
+ "```",
1333
+ `${symbol} imported by N files:`,
1334
+ " <file> — <refs> uses",
1335
+ "```",
1336
+ "Sort by refs desc. ≤25 lines.",
1337
+ ].join("\n"),
1338
+ },
1339
+ },
1340
+ ],
1341
+ }),
1342
+ "circular-deps": (_args) => ({
1343
+ description: "Detect circular import dependencies",
1344
+ messages: [
1345
+ {
1346
+ role: "user",
1347
+ content: {
1348
+ type: "text",
1349
+ text: [
1350
+ "getProjectInfo → getImportTree(entry points, depth≥5) → cycles array. No entry points → getFileTree, pick top 3.",
1351
+ "",
1352
+ "```",
1353
+ "Cycle 1: <a>→<b>→<c>→<a>",
1354
+ "```",
1355
+ "No cycles → 'No circular deps found'. ≤20 lines.",
1356
+ ].join("\n"),
1357
+ },
1358
+ },
1359
+ ],
1360
+ }),
1361
+ "refactor-preview": ({ file, line, column, newName }) => ({
1362
+ description: `Preview rename to ${newName} at ${file}:${line}:${column}`,
1363
+ messages: [
1364
+ {
1365
+ role: "user",
1366
+ content: {
1367
+ type: "text",
1368
+ text: [
1369
+ `refactorAnalyze(${file}:${line}:${column}) → risk/referenceCount/callerCount. refactorPreview(newName:'${newName}') → edit list. Preview only — do NOT apply.`,
1370
+ "",
1371
+ "```",
1372
+ `Rename: <old>→${newName}`,
1373
+ "Risk: <LOW|MEDIUM|HIGH> | Refs: N | Callers: M",
1374
+ "Edits: K total, J files",
1375
+ " <file>: <count>",
1376
+ "```",
1377
+ "HIGH → recommend tests first. ≤25 lines.",
1378
+ ].join("\n"),
1379
+ },
1380
+ },
1381
+ ],
1382
+ }),
1383
+ "module-exports": ({ file }) => ({
1384
+ description: `Module exports of ${file}`,
1385
+ messages: [
1386
+ {
1387
+ role: "user",
1388
+ content: {
1389
+ type: "text",
1390
+ text: [
1391
+ `getDocumentSymbols(${file}) → filter top-level exports → getHover per export for type sig.`,
1392
+ "",
1393
+ "```markdown",
1394
+ `## Exports of \`${file}\``,
1395
+ "### Functions",
1396
+ "- `fn(args): ReturnType` — JSDoc desc",
1397
+ "### Classes / Types / Constants",
1398
+ "- `Name: Type`",
1399
+ "```",
1400
+ "Skip private/internal. Public API only.",
1401
+ ].join("\n"),
1402
+ },
1403
+ },
1404
+ ],
1405
+ }),
1406
+ "type-of": ({ file, line, column }) => ({
1407
+ description: `Type at ${file}:${line}:${column}`,
1408
+ messages: [
1409
+ {
1410
+ role: "user",
1411
+ content: {
1412
+ type: "text",
1413
+ text: [
1414
+ `getTypeSignature(${file}:${line}:${column}). Fallback: getHoverAtCursor → extract first code block.`,
1415
+ "",
1416
+ "Output: single fenced code block, nothing else.",
1417
+ "No info → 'No type info at this position.'",
1418
+ ].join("\n"),
1419
+ },
1420
+ },
1421
+ ],
1422
+ }),
1423
+ deprecations: (_args) => ({
1424
+ description: "Find deprecated APIs and their callers",
1425
+ messages: [
1426
+ {
1427
+ role: "user",
1428
+ content: {
1429
+ type: "text",
1430
+ text: [
1431
+ "searchWorkspace('@deprecated', **/*.{ts,tsx,js,jsx,py,go,rs}) → findReferences per symbol (caller count) → getHover (migration hint).",
1432
+ "",
1433
+ "```markdown",
1434
+ "## Deprecated APIs (N total, M in use)",
1435
+ "### High callers (urgent)",
1436
+ "- `sym` (K callers) @ <file:line> — Migration: <msg>",
1437
+ "### Low callers (easy cleanup)",
1438
+ "- `sym` (1 caller)",
1439
+ "### Unused (safe delete)",
1440
+ "- `sym` (0 callers)",
1441
+ "```",
1442
+ "Sort by callers desc. ≤50 lines.",
1443
+ ].join("\n"),
1444
+ },
1445
+ },
1446
+ ],
1447
+ }),
1448
+ "coverage-gap": ({ file }) => ({
1449
+ description: `Coverage gaps in ${file}`,
1450
+ messages: [
1451
+ {
1452
+ role: "user",
1453
+ content: {
1454
+ type: "text",
1455
+ text: [
1456
+ `getCodeCoverage(${file}) → getDocumentSymbols(${file}) → covered/total per fn. Sort asc (least-tested first).`,
1457
+ "",
1458
+ "```",
1459
+ `## Coverage gaps: ${file}`,
1460
+ "Untested (0%): - fn (L1-L2)",
1461
+ "Partial (<50%): - fn (L1-L2) N/M lines",
1462
+ "Covered (≥50%): <count> fns",
1463
+ "```",
1464
+ "No coverage → 'Run tests with coverage first'. ≤30 lines.",
1465
+ ].join("\n"),
1466
+ },
1467
+ },
1468
+ ],
1469
+ }),
1470
+ "explore-type": ({ file, line, column }) => ({
1471
+ messages: [
1472
+ {
1473
+ role: "user",
1474
+ content: {
1475
+ type: "text",
1476
+ text: [
1477
+ `getHover(${file}:${line}:${column}) → goToDeclaration → goToTypeDefinition → findImplementations → getHover per impl (≤5).`,
1478
+ "",
1479
+ `**Symbol:** <name> — <type sig>`,
1480
+ `**Declaration:** <file>:<line>`,
1481
+ `**Type defined:** <file>:<line>`,
1482
+ `**Impls (N):** 1. <file>:<line> — <sig>`,
1483
+ `No results → note clearly (e.g. "No declaration found").`,
1484
+ ].join("\n"),
1485
+ },
1486
+ },
1487
+ ],
1488
+ }),
1489
+ "ide-coverage": (_args) => ({
1490
+ messages: [
1491
+ {
1492
+ role: "user",
1493
+ content: {
1494
+ type: "text",
1495
+ text: [
1496
+ "Generate an HTML code-coverage heatmap and open it in the browser.",
1497
+ "",
1498
+ "⚠️ This prompt requires --full mode. First call `getToolCapabilities` — if `getCodeCoverage` or `openInBrowser` are absent, stop and respond: 'This prompt requires --full mode. Restart the bridge with --full.'",
1499
+ "",
1500
+ "Steps:",
1501
+ "1. Call `getCodeCoverage` with no arguments to fetch the full coverage report.",
1502
+ "2. Parse the returned file entries. For each file compute a coverage percentage (coveredLines / totalLines).",
1503
+ "3. Build a self-contained HTML page:",
1504
+ " - Title: 'Code Coverage Heatmap'",
1505
+ " - A sortable table with columns: File, Lines, Covered, Uncovered, Coverage %",
1506
+ " - Color rows: green (≥80%), yellow (50–79%), red (<50%)",
1507
+ " - A summary bar at the top showing overall coverage %",
1508
+ "4. Write the HTML to a temp file (e.g. /tmp/coverage-heatmap.html).",
1509
+ "5. Call `openInBrowser` with that file path.",
1510
+ ].join("\n"),
1511
+ },
1512
+ },
1513
+ ],
1514
+ }),
1515
+ "ide-deps": (args) => {
1516
+ const { file, line, column } = args;
1517
+ return {
1518
+ messages: [
1519
+ {
1520
+ role: "user",
1521
+ content: {
1522
+ type: "text",
1523
+ text: [
1524
+ `Build a D3 force-directed dependency graph for the symbol at ${file}:${line}:${column} and open it in the browser.`,
1525
+ "",
1526
+ "⚠️ This prompt requires --full mode for openInBrowser. First call `getToolCapabilities` — if `openInBrowser` is absent, stop and respond: 'This prompt requires --full mode. Restart the bridge with --full.'",
1527
+ "",
1528
+ "Steps:",
1529
+ `1. Call \`getCallHierarchy\` at ${file}:${line}:${column} with direction="outgoing" to collect direct callees.`,
1530
+ '2. For each callee (up to depth 2, max 30 nodes total), call `getCallHierarchy` with direction="outgoing" again.',
1531
+ "3. Build a JSON graph: { nodes: [{id, label, file}], links: [{source, target}] }",
1532
+ "4. Generate a self-contained HTML page with D3 v7 (use CDN) that renders a force-directed graph:",
1533
+ " - Nodes are labeled with the symbol name",
1534
+ " - Edges point from caller → callee",
1535
+ " - Hovering a node shows file:line in a tooltip",
1536
+ " - Include zoom/pan via d3.zoom()",
1537
+ "5. Write the HTML to /tmp/dep-graph.html",
1538
+ "6. Call `openInBrowser` with that path.",
1539
+ ].join("\n"),
1540
+ },
1541
+ },
1542
+ ],
1543
+ };
1544
+ },
1545
+ "ide-diagnostics-board": (_args) => ({
1546
+ messages: [
1547
+ {
1548
+ role: "user",
1549
+ content: {
1550
+ type: "text",
1551
+ text: [
1552
+ "Collect workspace-wide diagnostics and render a sortable HTML board in the browser.",
1553
+ "",
1554
+ "Steps:",
1555
+ "1. Call `getDiagnostics` with no file argument to get all workspace diagnostics.",
1556
+ "2. Group diagnostics by severity (error, warning, info, hint) and then by file.",
1557
+ "3. Build a self-contained HTML page:",
1558
+ " - Title: 'Diagnostics Board'",
1559
+ " - Severity summary pills at the top (e.g. '12 errors · 5 warnings')",
1560
+ " - A sortable table with columns: Severity, File, Line, Message",
1561
+ " - Color-code rows: red=error, orange=warning, blue=info/hint",
1562
+ " - Add a text filter input that filters rows by file or message",
1563
+ "4. Write HTML to /tmp/diagnostics-board.html",
1564
+ "5. Call `openInBrowser` with that path.",
1565
+ ].join("\n"),
1566
+ },
1567
+ },
1568
+ ],
1569
+ }),
1570
+ "safe-refactor": ({ description, files }) => ({
1571
+ description: `Safe refactor: ${description}`,
1572
+ messages: [
1573
+ {
1574
+ role: "user",
1575
+ content: {
1576
+ type: "text",
1577
+ text: [
1578
+ `Perform the following refactor safely: **${description}**`,
1579
+ files ? `Files to consider: ${files}` : "",
1580
+ "",
1581
+ "## Step 1 — Preview all edits",
1582
+ "For each file that needs to change:",
1583
+ "1. Call `previewEdit` with the proposed change",
1584
+ "2. Display the unified diff",
1585
+ "",
1586
+ "## Step 2 — Confirm with user",
1587
+ "Show a summary of all diffs and ask: 'Apply these changes? (yes / no)'",
1588
+ "Wait for the user's response before proceeding.",
1589
+ "",
1590
+ "## Step 3a — Apply (if confirmed)",
1591
+ "1. Call `beginTransaction` to open a transaction",
1592
+ "2. Call `stageEdit` for each file change",
1593
+ "3. Call `commitTransaction` to atomically write all edits",
1594
+ "4. Call `getDiagnostics` to confirm no new errors were introduced",
1595
+ "",
1596
+ "## Step 3b — Abort (if rejected)",
1597
+ "Call `rollbackTransaction` if a transaction was started, then explain what was skipped.",
1598
+ ]
1599
+ .filter((l) => l !== undefined)
1600
+ .join("\n"),
1601
+ },
1602
+ },
1603
+ ],
1604
+ }),
1605
+ "diagnose-and-fix": ({ filePath }) => ({
1606
+ description: filePath
1607
+ ? `Diagnose and fix errors in ${filePath}`
1608
+ : "Diagnose and fix first workspace error",
1609
+ messages: [
1610
+ {
1611
+ role: "user",
1612
+ content: {
1613
+ type: "text",
1614
+ text: [
1615
+ filePath
1616
+ ? `Diagnose and fix the first error in \`${filePath}\`.`
1617
+ : "Diagnose and fix the first error in the workspace.",
1618
+ "",
1619
+ "## Steps",
1620
+ `1. Call \`getDiagnostics\`${filePath ? ` with uri: "${filePath}"` : " (no uri — workspace-wide)"} to get current errors`,
1621
+ "2. Take the first error location (file, line, column)",
1622
+ "3. Call `explainDiagnostic` on that location — understand root cause",
1623
+ "4. Propose a fix based on the explanation",
1624
+ "5. Call `previewEdit` to show the unified diff before applying",
1625
+ "6. If the fix looks correct: apply with `editText`",
1626
+ " If multiple files need changes: `beginTransaction` → `stageEdit` each → `commitTransaction`",
1627
+ "7. Call `getDiagnostics` again to confirm the error is resolved",
1628
+ "8. Report: original error, fix applied, and whether diagnostics are now clean",
1629
+ ].join("\n"),
1630
+ },
1631
+ },
1632
+ ],
1633
+ }),
1634
+ "session-delta": (_args) => ({
1635
+ description: "Session start orientation — changes since last handoff",
1636
+ messages: [
1637
+ {
1638
+ role: "user",
1639
+ content: {
1640
+ type: "text",
1641
+ text: [
1642
+ "Orient me at the start of this session.",
1643
+ "",
1644
+ "## Steps",
1645
+ "1. Call `getDiffFromHandoff` to get git diff + diagnostic delta since the last handoff note",
1646
+ "2. Summarise:",
1647
+ " - Files changed (list each with +/- line counts)",
1648
+ " - New errors introduced (if any)",
1649
+ " - Errors resolved since last handoff (if any)",
1650
+ " - Net diagnostic change (+N errors / -N errors / no change)",
1651
+ "3. Suggest a concrete next action based on the delta",
1652
+ " (e.g. 'Fix 2 new TypeScript errors in auth.ts' or 'No issues — ready to continue feature X')",
1653
+ "",
1654
+ "Keep the summary under 20 lines.",
1655
+ ].join("\n"),
1656
+ },
1657
+ },
1658
+ ],
1659
+ }),
1660
+ };
1661
+ // ── Public API ────────────────────────────────────────────────────────────────
1662
+ /**
1663
+ * Retrieve a filled prompt template.
1664
+ * Returns null if the name is unknown or a required argument is missing.
1665
+ */
1666
+ export function getPrompt(name, args) {
1667
+ const def = PROMPTS.find((p) => p.name === name);
1668
+ if (!def)
1669
+ return null;
1670
+ // Validate required arguments
1671
+ for (const arg of def.arguments ?? []) {
1672
+ if (arg.required && !args[arg.name])
1673
+ return null;
1674
+ }
1675
+ const template = TEMPLATES[name];
1676
+ if (!template)
1677
+ return null;
1678
+ return template(args);
1679
+ }
1680
+ //# sourceMappingURL=prompts.js.map