@reticlehq/server 2.13.1 → 2.14.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 (449) hide show
  1. package/SKILL.md +8 -18
  2. package/bin/reticle.js +3 -0
  3. package/dist/bridge/auth-failure-reason.js +12 -1
  4. package/dist/bridge/bridge-security.d.ts +8 -0
  5. package/dist/bridge/bridge-security.js +6 -1
  6. package/dist/bridge/bridge.d.ts +3 -0
  7. package/dist/bridge/bridge.js +23 -1
  8. package/dist/bridge/bridge.test-harness.d.ts +10 -1
  9. package/dist/bridge/bridge.test-harness.js +7 -1
  10. package/dist/bridge/pairing-token.d.ts +17 -0
  11. package/dist/bridge/pairing-token.js +26 -0
  12. package/dist/bridge/token-auth.d.ts +7 -0
  13. package/dist/bridge/token-auth.js +7 -1
  14. package/dist/capsule/capsule-store.d.ts +4 -4
  15. package/dist/capsule/capsule.d.ts +1 -1
  16. package/dist/capsule/capsule.js +3 -3
  17. package/dist/capsule/causal-summary.d.ts +21 -1
  18. package/dist/capsule/causal-summary.js +8 -6
  19. package/dist/capsule/divergence.d.ts +1 -1
  20. package/dist/capsule/divergence.js +26 -10
  21. package/dist/chromium-launch-options.d.ts +2 -1
  22. package/dist/cli/adhoc-verdict.d.ts +58 -0
  23. package/dist/cli/adhoc-verdict.js +115 -0
  24. package/dist/cli/chromium-hint.d.ts +18 -4
  25. package/dist/cli/chromium-hint.js +54 -6
  26. package/dist/cli/cli-doctor.js +1 -2
  27. package/dist/cli/cli-flow-commands.d.ts +16 -2
  28. package/dist/cli/cli-flow-commands.js +28 -9
  29. package/dist/cli/cli-parse-feedback.js +1 -1
  30. package/dist/cli/cli-parse.d.ts +2 -1
  31. package/dist/cli/cli-parse.js +38 -0
  32. package/dist/cli/cli-port.d.ts +5 -13
  33. package/dist/cli/cli-port.js +5 -38
  34. package/dist/cli/cli-update-commands.js +4 -4
  35. package/dist/cli/cli-verify.d.ts +24 -7
  36. package/dist/cli/cli-verify.js +87 -13
  37. package/dist/cli/cloud-keystore.d.ts +2 -1
  38. package/dist/cli/cloud-login.d.ts +2 -1
  39. package/dist/cli/cloud-session.d.ts +2 -1
  40. package/dist/cli/cloud-session.js +1 -1
  41. package/dist/cli/daemon-start-options.d.ts +2 -1
  42. package/dist/cli/device-flow.d.ts +2 -2
  43. package/dist/cli/doctor-daemon-line.d.ts +2 -1
  44. package/dist/cli/doctor-project-line.d.ts +2 -1
  45. package/dist/cli/doctor-rows.d.ts +2 -1
  46. package/dist/cli/drive-attach.d.ts +4 -3
  47. package/dist/cli/gate-hook-message.d.ts +2 -1
  48. package/dist/cli/status-next-action.js +10 -11
  49. package/dist/cli.d.ts +1 -0
  50. package/dist/cli.js +21 -9
  51. package/dist/cloud/account-state.d.ts +20 -0
  52. package/dist/cloud/account-state.js +65 -0
  53. package/dist/cloud/cloud-sync.d.ts +46 -3
  54. package/dist/cloud/cloud-sync.js +116 -0
  55. package/dist/cloud/sync-cycle.d.ts +5 -4
  56. package/dist/cloud/sync-cycle.js +1 -1
  57. package/dist/cloud/sync-daemon.d.ts +3 -19
  58. package/dist/cloud/sync-daemon.js +2 -2
  59. package/dist/crawl/crawl-tools.js +1 -1
  60. package/dist/crawl/crawl.d.ts +5 -5
  61. package/dist/crawl/crawl.js +138 -4
  62. package/dist/daemon/daemon-resilience.d.ts +3 -2
  63. package/dist/daemon/daemon-resilience.js +43 -4
  64. package/dist/daemon/daemon-resolve.d.ts +0 -9
  65. package/dist/daemon/daemon-resolve.js +2 -2
  66. package/dist/daemon/dev-servers.d.ts +1 -1
  67. package/dist/daemon/dev-servers.js +1 -1
  68. package/dist/daemon/loopback-alias.d.ts +2 -1
  69. package/dist/daemon/startup-failure.d.ts +11 -0
  70. package/dist/daemon/startup-failure.js +46 -0
  71. package/dist/events/contradictions.d.ts +10 -16
  72. package/dist/events/contradictions.js +149 -17
  73. package/dist/events/declared.d.ts +13 -1
  74. package/dist/events/declared.js +59 -3
  75. package/dist/events/echo-mismatch.js +75 -6
  76. package/dist/events/lineage.d.ts +52 -0
  77. package/dist/events/lineage.js +122 -0
  78. package/dist/events/net-evidence.d.ts +21 -0
  79. package/dist/events/net-evidence.js +81 -0
  80. package/dist/events/predicate-console.d.ts +13 -0
  81. package/dist/events/predicate-console.js +138 -0
  82. package/dist/events/predicate-element.d.ts +13 -0
  83. package/dist/events/predicate-element.js +214 -0
  84. package/dist/events/predicate-eval.d.ts +15 -3
  85. package/dist/events/predicate-eval.js +128 -110
  86. package/dist/events/predicate-parse.js +34 -1
  87. package/dist/events/predicate-request-body.d.ts +50 -0
  88. package/dist/events/predicate-request-body.js +120 -0
  89. package/dist/events/predicate-route.d.ts +21 -1
  90. package/dist/events/predicate-route.js +149 -21
  91. package/dist/events/predicate-schema.d.ts +8 -1
  92. package/dist/events/predicate-schema.js +34 -0
  93. package/dist/events/predicate.d.ts +2 -0
  94. package/dist/events/predicate.js +52 -159
  95. package/dist/events/split-text-miss.d.ts +6 -4
  96. package/dist/events/split-text-miss.js +12 -5
  97. package/dist/flows/affected-tools.js +22 -9
  98. package/dist/flows/annotate.d.ts +2 -1
  99. package/dist/flows/annotate.js +19 -1
  100. package/dist/flows/coverage.d.ts +2 -2
  101. package/dist/flows/flake.d.ts +3 -3
  102. package/dist/flows/flow-expect-grammar.d.ts +33 -0
  103. package/dist/flows/flow-expect-grammar.js +155 -0
  104. package/dist/flows/flow-replay-run.d.ts +1 -1
  105. package/dist/flows/flow-replay-run.js +28 -15
  106. package/dist/flows/flow-replay.d.ts +10 -0
  107. package/dist/flows/flow-replay.js +57 -22
  108. package/dist/flows/flow-secret-field.d.ts +14 -0
  109. package/dist/flows/flow-secret-field.js +22 -0
  110. package/dist/flows/flow-step-runners.d.ts +1 -0
  111. package/dist/flows/flow-step-runners.js +91 -34
  112. package/dist/flows/flow-success.js +22 -0
  113. package/dist/flows/flow-tools.js +27 -8
  114. package/dist/flows/flow-upload-resolve.d.ts +23 -0
  115. package/dist/flows/flow-upload-resolve.js +46 -0
  116. package/dist/flows/flows.d.ts +15 -0
  117. package/dist/flows/flows.js +17 -14
  118. package/dist/flows/git-changed.d.ts +23 -4
  119. package/dist/flows/git-changed.js +32 -6
  120. package/dist/flows/heal-run.js +2 -2
  121. package/dist/flows/predicate-to-expect.d.ts +3 -2
  122. package/dist/flows/predicate-to-expect.js +11 -5
  123. package/dist/flows/recording-backtrack.d.ts +24 -0
  124. package/dist/flows/recording-backtrack.js +73 -0
  125. package/dist/flows/recordings.d.ts +6 -0
  126. package/dist/flows/replay-halt.d.ts +26 -0
  127. package/dist/flows/replay-halt.js +30 -0
  128. package/dist/flows/replay.d.ts +0 -8
  129. package/dist/flows/replay.js +15 -3
  130. package/dist/flows/suite-flakes.d.ts +2 -1
  131. package/dist/flows/verify-change-tools.js +16 -4
  132. package/dist/honesty/already-true.d.ts +14 -0
  133. package/dist/honesty/already-true.js +47 -4
  134. package/dist/honesty/blind-spots.d.ts +3 -1
  135. package/dist/honesty/blind-spots.js +24 -1
  136. package/dist/honesty/body-capture-remedy.d.ts +42 -0
  137. package/dist/honesty/body-capture-remedy.js +95 -0
  138. package/dist/honesty/feature-capture.d.ts +3 -2
  139. package/dist/honesty/feature-capture.js +1 -1
  140. package/dist/honesty/gap-ledger.d.ts +1 -1
  141. package/dist/honesty/gap-ledger.js +1 -1
  142. package/dist/honesty/instrumentation-gaps.d.ts +8 -1
  143. package/dist/honesty/instrumentation-gaps.js +12 -2
  144. package/dist/honesty/observability.d.ts +4 -3
  145. package/dist/honesty/tool-hit-rate.d.ts +3 -2
  146. package/dist/honesty/uncaptured-bodies.d.ts +3 -1
  147. package/dist/honesty/uncaptured-bodies.js +6 -2
  148. package/dist/honesty/unsettled.d.ts +9 -0
  149. package/dist/honesty/unsettled.js +45 -0
  150. package/dist/honesty/verified.d.ts +32 -1
  151. package/dist/honesty/verified.js +37 -10
  152. package/dist/impact/impact-store.d.ts +5 -14
  153. package/dist/impact/impact-store.js +49 -6
  154. package/dist/index.js +1 -1
  155. package/dist/input/network-detail.d.ts +26 -1
  156. package/dist/input/network-detail.js +44 -12
  157. package/dist/input/network-mock-tools.js +24 -17
  158. package/dist/input/real-input.js +1 -1
  159. package/dist/input/viewport-tools.js +25 -13
  160. package/dist/intent/inline-intent.d.ts +0 -10
  161. package/dist/intent/inline-intent.js +1 -1
  162. package/dist/intent/intent-shard-store.d.ts +3 -2
  163. package/dist/intent/intent-shard-store.js +1 -1
  164. package/dist/intent/intent-shard.d.ts +14 -14
  165. package/dist/intent/intent-shard.js +4 -4
  166. package/dist/intent/intent-store.d.ts +1 -1
  167. package/dist/intent/intent-store.js +1 -1
  168. package/dist/intent/intent-subject.d.ts +2 -1
  169. package/dist/intent/open-intents.d.ts +3 -2
  170. package/dist/license/license.d.ts +4 -4
  171. package/dist/license/license.js +1 -1
  172. package/dist/mcp/attach-memory.d.ts +2 -1
  173. package/dist/mcp/client-identity.d.ts +2 -1
  174. package/dist/mcp/mcp-outage.d.ts +1 -1
  175. package/dist/mcp/mcp-outage.js +1 -1
  176. package/dist/mcp/mcp-proxy.d.ts +3 -1
  177. package/dist/mcp/mcp-proxy.js +32 -7
  178. package/dist/mcp/mcp.js +3 -1
  179. package/dist/mcp/proxy-handshake.d.ts +2 -1
  180. package/dist/mcp/proxy-idle-exit.d.ts +45 -0
  181. package/dist/mcp/proxy-idle-exit.js +94 -0
  182. package/dist/mcp/server-instructions.d.ts +2 -1
  183. package/dist/memory/project-memory.d.ts +2 -3
  184. package/dist/memory/project-memory.js +1 -1
  185. package/dist/oracles/propose-consequences.js +5 -5
  186. package/dist/oracles/self-instrument.d.ts +2 -2
  187. package/dist/oracles/self-instrument.js +1 -1
  188. package/dist/platform.d.ts +3 -5
  189. package/dist/platform.js +3 -5
  190. package/dist/pool/browser-pool.d.ts +92 -0
  191. package/dist/pool/browser-pool.js +119 -5
  192. package/dist/pool/playwright-launcher.js +29 -2
  193. package/dist/pool/storage-seed.d.ts +23 -0
  194. package/dist/pool/storage-seed.js +198 -0
  195. package/dist/project/artifact-root.d.ts +2 -1
  196. package/dist/project/memory-fs.d.ts +2 -1
  197. package/dist/project/reticle-dir.js +1 -1
  198. package/dist/project/session-root.d.ts +8 -0
  199. package/dist/project/session-root.js +9 -2
  200. package/dist/runs/reticle-runner.d.ts +14 -1
  201. package/dist/runs/reticle-runner.js +39 -2
  202. package/dist/session/attachment-history.d.ts +2 -1
  203. package/dist/session/fake-session.d.ts +37 -0
  204. package/dist/session/fake-session.js +81 -0
  205. package/dist/session/lease-visibility.d.ts +2 -1
  206. package/dist/session/live-control-tools.js +6 -0
  207. package/dist/session/no-session-diagnosis.d.ts +17 -1
  208. package/dist/session/no-session-diagnosis.js +32 -6
  209. package/dist/session/no-session-next-action.d.ts +14 -0
  210. package/dist/session/no-session-next-action.js +18 -0
  211. package/dist/session/no-session-watch.js +46 -3
  212. package/dist/session/registered-projects.d.ts +54 -0
  213. package/dist/session/registered-projects.js +73 -0
  214. package/dist/session/review-store.d.ts +2 -1
  215. package/dist/session/session-health.d.ts +62 -1
  216. package/dist/session/session-health.js +82 -2
  217. package/dist/session/session-manager.d.ts +11 -1
  218. package/dist/session/session-manager.js +18 -3
  219. package/dist/session/session-replaced.d.ts +24 -0
  220. package/dist/session/session-replaced.js +29 -0
  221. package/dist/session/session-successor.js +20 -4
  222. package/dist/session/session.d.ts +13 -5
  223. package/dist/session/session.js +31 -23
  224. package/dist/setup/agent-configs.d.ts +3 -2
  225. package/dist/setup/agent-writer.d.ts +3 -2
  226. package/dist/setup/approval-migration.d.ts +2 -1
  227. package/dist/setup/approval-migration.js +1 -1
  228. package/dist/setup/auto-approve.d.ts +11 -19
  229. package/dist/setup/auto-approve.js +15 -12
  230. package/dist/{init → setup}/confirm.js +1 -1
  231. package/dist/setup/desktop-shape.d.ts +3 -2
  232. package/dist/setup/drive-agent.d.ts +2 -3
  233. package/dist/setup/drive-agent.js +1 -1
  234. package/dist/setup/drive-plan.d.ts +3 -2
  235. package/dist/setup/ensure-daemon.d.ts +2 -1
  236. package/dist/setup/existing-app.d.ts +12 -0
  237. package/dist/setup/existing-app.js +13 -0
  238. package/dist/setup/init-host.d.ts +11 -0
  239. package/dist/setup/init-host.js +26 -0
  240. package/dist/setup/init-runtime.d.ts +4 -10
  241. package/dist/setup/init-runtime.js +23 -16
  242. package/dist/setup/license-key.d.ts +2 -1
  243. package/dist/setup/listeners.d.ts +2 -1
  244. package/dist/setup/loopback-probe-urls.d.ts +18 -0
  245. package/dist/setup/loopback-probe-urls.js +52 -0
  246. package/dist/setup/node-effects.d.ts +3 -0
  247. package/dist/setup/node-effects.js +26 -11
  248. package/dist/setup/page-probe.d.ts +5 -0
  249. package/dist/setup/relaunch.d.ts +2 -1
  250. package/dist/setup/run-setup.d.ts +5 -1
  251. package/dist/setup/run-setup.js +141 -50
  252. package/dist/setup/setup-command.d.ts +3 -2
  253. package/dist/setup/setup-command.js +8 -0
  254. package/dist/setup/setup-options.d.ts +5 -3
  255. package/dist/setup/setup-options.js +3 -2
  256. package/dist/setup/wait-progress.d.ts +28 -0
  257. package/dist/setup/wait-progress.js +43 -0
  258. package/dist/telemetry/app-instrumented.d.ts +2 -1
  259. package/dist/telemetry/app-instrumented.js +1 -1
  260. package/dist/telemetry/automation-hint.d.ts +1 -1
  261. package/dist/telemetry/automation-hint.js +1 -1
  262. package/dist/telemetry/cli-telemetry.js +1 -1
  263. package/dist/telemetry/connect-failure.d.ts +1 -1
  264. package/dist/telemetry/connect-failure.js +1 -1
  265. package/dist/telemetry/crash-cause.d.ts +3 -2
  266. package/dist/telemetry/crash-cause.js +1 -1
  267. package/dist/telemetry/daemon-telemetry.d.ts +3 -2
  268. package/dist/telemetry/daemon-telemetry.js +1 -1
  269. package/dist/telemetry/error-class.d.ts +3 -2
  270. package/dist/telemetry/error-class.js +1 -1
  271. package/dist/telemetry/feedback-cli.js +1 -1
  272. package/dist/telemetry/feedback-context.d.ts +3 -2
  273. package/dist/telemetry/feedback-context.js +5 -4
  274. package/dist/telemetry/feedback-local.d.ts +3 -2
  275. package/dist/telemetry/feedback.d.ts +4 -3
  276. package/dist/telemetry/feedback.js +1 -1
  277. package/dist/telemetry/git-facts.d.ts +2 -2
  278. package/dist/telemetry/git-facts.js +1 -1
  279. package/dist/telemetry/identify.d.ts +1 -1
  280. package/dist/telemetry/identify.js +1 -1
  281. package/dist/telemetry/init-telemetry.d.ts +2 -14
  282. package/dist/telemetry/init-telemetry.js +4 -13
  283. package/dist/telemetry/install-source.d.ts +7 -13
  284. package/dist/telemetry/install-source.js +7 -29
  285. package/dist/telemetry/license-activation.d.ts +3 -2
  286. package/dist/telemetry/license-activation.js +1 -1
  287. package/dist/telemetry/machine-snapshot.d.ts +1 -1
  288. package/dist/telemetry/mcp-connection.js +1 -1
  289. package/dist/telemetry/project-profile.d.ts +0 -14
  290. package/dist/telemetry/project-profile.js +1 -1
  291. package/dist/telemetry/proxy-telemetry.js +1 -1
  292. package/dist/telemetry/session-metrics.d.ts +1 -1
  293. package/dist/telemetry/session-metrics.js +1 -1
  294. package/dist/telemetry/telemetry.d.ts +1 -17
  295. package/dist/telemetry/telemetry.js +4 -4
  296. package/dist/telemetry/tool-refused.d.ts +1 -1
  297. package/dist/telemetry/tool-refused.js +1 -1
  298. package/dist/tools/act-observation.d.ts +3 -2
  299. package/dist/tools/act-preflight.js +8 -3
  300. package/dist/tools/act-target.d.ts +4 -0
  301. package/dist/tools/act-target.js +14 -5
  302. package/dist/tools/act-tools.d.ts +0 -2
  303. package/dist/tools/act-tools.js +45 -15
  304. package/dist/tools/assert-source.d.ts +30 -0
  305. package/dist/tools/assert-source.js +21 -0
  306. package/dist/tools/assert-verdict.d.ts +1 -1
  307. package/dist/tools/assert-verdict.js +14 -4
  308. package/dist/tools/browser-tools.js +28 -8
  309. package/dist/tools/complete-snapshot.d.ts +3 -2
  310. package/dist/tools/dynamic-tools.js +8 -0
  311. package/dist/tools/error-recovery.d.ts +10 -0
  312. package/dist/tools/error-recovery.js +23 -0
  313. package/dist/tools/feedback-tools.js +1 -1
  314. package/dist/tools/invoke-tool.js +2 -0
  315. package/dist/tools/lease-tools.d.ts +48 -20
  316. package/dist/tools/lease-tools.js +311 -76
  317. package/dist/tools/lineage-tools.d.ts +14 -0
  318. package/dist/tools/lineage-tools.js +64 -0
  319. package/dist/tools/merge-tools.js +1 -3
  320. package/dist/tools/navigate-arrival.d.ts +45 -1
  321. package/dist/tools/navigate-arrival.js +39 -6
  322. package/dist/tools/navigate-result.d.ts +8 -1
  323. package/dist/tools/navigate-result.js +14 -4
  324. package/dist/tools/numeric-bounds.d.ts +0 -11
  325. package/dist/tools/numeric-bounds.js +4 -4
  326. package/dist/tools/observe-tools.js +22 -26
  327. package/dist/tools/observed-nothing.d.ts +9 -0
  328. package/dist/tools/observed-nothing.js +2 -1
  329. package/dist/tools/read-tools.js +12 -17
  330. package/dist/tools/real-input-attempt.d.ts +14 -6
  331. package/dist/tools/real-input-attempt.js +75 -18
  332. package/dist/tools/reconcile-tools.js +2 -1
  333. package/dist/tools/reload-result.d.ts +6 -1
  334. package/dist/tools/reload-result.js +7 -2
  335. package/dist/tools/resolve-target.d.ts +7 -1
  336. package/dist/tools/resolve-target.js +72 -9
  337. package/dist/tools/settle-in-flight.d.ts +1 -1
  338. package/dist/tools/settle-in-flight.js +9 -2
  339. package/dist/tools/snapshot-delta.d.ts +24 -1
  340. package/dist/tools/snapshot-delta.js +66 -7
  341. package/dist/tools/tool-names.d.ts +1 -0
  342. package/dist/tools/tool-names.js +1 -0
  343. package/dist/tools/tool-surface.js +20 -2
  344. package/dist/tools/tools.js +120 -11
  345. package/dist/tools/verify-next-baton.d.ts +2 -1
  346. package/dist/update/sdk-sync.d.ts +1 -1
  347. package/dist/update/sdk-sync.js +1 -1
  348. package/dist/update/updater.js +1 -1
  349. package/dist/version/sdk-fix.d.ts +2 -1
  350. package/dist/version/version-skew.d.ts +0 -8
  351. package/dist/version/version-skew.js +1 -1
  352. package/docs/README.md +8 -6
  353. package/docs/actions.mdx +1 -1
  354. package/docs/agent-cheatsheet.md +4 -2
  355. package/docs/architecture.md +1 -1
  356. package/docs/cli/mcp.mdx +3 -1
  357. package/docs/cli/watch.mdx +1 -1
  358. package/docs/cli.mdx +1 -1
  359. package/docs/desktop.mdx +1 -1
  360. package/docs/docs.json +8 -3
  361. package/docs/faq.mdx +9 -0
  362. package/docs/first-drive.md +136 -0
  363. package/docs/frameworks.mdx +29 -7
  364. package/docs/gate-plan.md +2 -2
  365. package/docs/gates.md +19 -11
  366. package/docs/getting-started.md +7 -1
  367. package/docs/http-transport.md +164 -0
  368. package/docs/index.mdx +5 -3
  369. package/docs/install-manual.mdx +1 -1
  370. package/docs/packages/tauri.mdx +1 -1
  371. package/docs/packages.mdx +15 -3
  372. package/docs/platform-integration.md +1 -1
  373. package/docs/predicates.mdx +2 -0
  374. package/docs/system-map.md +2 -2
  375. package/docs/telemetry-contract.md +4 -4
  376. package/docs/telemetry-events.mdx +1 -1
  377. package/docs/telemetry.md +3 -3
  378. package/docs/tools-navigate.mdx +14 -6
  379. package/docs/usage.md +4 -4
  380. package/package.json +7 -4
  381. package/dist/init/agent-rules.d.ts +0 -116
  382. package/dist/init/agent-rules.js +0 -279
  383. package/dist/init/app-choice.d.ts +0 -20
  384. package/dist/init/app-choice.js +0 -25
  385. package/dist/init/astro-host.d.ts +0 -21
  386. package/dist/init/astro-host.js +0 -27
  387. package/dist/init/astro-patch.d.ts +0 -33
  388. package/dist/init/astro-patch.js +0 -300
  389. package/dist/init/capabilities.d.ts +0 -40
  390. package/dist/init/capabilities.js +0 -150
  391. package/dist/init/closing-hint.d.ts +0 -36
  392. package/dist/init/closing-hint.js +0 -120
  393. package/dist/init/connect-steps.d.ts +0 -2
  394. package/dist/init/connect-steps.js +0 -50
  395. package/dist/init/cra.d.ts +0 -79
  396. package/dist/init/cra.js +0 -178
  397. package/dist/init/csp-check.d.ts +0 -38
  398. package/dist/init/csp-check.js +0 -107
  399. package/dist/init/csp-doctor.d.ts +0 -32
  400. package/dist/init/csp-doctor.js +0 -54
  401. package/dist/init/desktop-doctor.d.ts +0 -41
  402. package/dist/init/desktop-doctor.js +0 -198
  403. package/dist/init/detect.d.ts +0 -96
  404. package/dist/init/detect.js +0 -209
  405. package/dist/init/dev-script.d.ts +0 -50
  406. package/dist/init/dev-script.js +0 -66
  407. package/dist/init/format-generated.d.ts +0 -18
  408. package/dist/init/format-generated.js +0 -39
  409. package/dist/init/install-hint.d.ts +0 -9
  410. package/dist/init/install-hint.js +0 -29
  411. package/dist/init/mcp-clients.d.ts +0 -89
  412. package/dist/init/mcp-clients.js +0 -299
  413. package/dist/init/mcp-registered.d.ts +0 -12
  414. package/dist/init/mcp-registered.js +0 -14
  415. package/dist/init/mcp.d.ts +0 -89
  416. package/dist/init/mcp.js +0 -129
  417. package/dist/init/next-patch.d.ts +0 -39
  418. package/dist/init/next-patch.js +0 -196
  419. package/dist/init/node-io.d.ts +0 -7
  420. package/dist/init/node-io.js +0 -117
  421. package/dist/init/non-js-project.d.ts +0 -27
  422. package/dist/init/non-js-project.js +0 -84
  423. package/dist/init/patch-kind.d.ts +0 -20
  424. package/dist/init/patch-kind.js +0 -10
  425. package/dist/init/plan-framework.d.ts +0 -64
  426. package/dist/init/plan-framework.js +0 -565
  427. package/dist/init/plan.d.ts +0 -242
  428. package/dist/init/plan.js +0 -703
  429. package/dist/init/preflight.d.ts +0 -28
  430. package/dist/init/preflight.js +0 -38
  431. package/dist/init/project-id.d.ts +0 -12
  432. package/dist/init/project-id.js +0 -25
  433. package/dist/init/refresh-rules.d.ts +0 -39
  434. package/dist/init/refresh-rules.js +0 -51
  435. package/dist/init/run.d.ts +0 -117
  436. package/dist/init/run.js +0 -806
  437. package/dist/init/slash-command.d.ts +0 -27
  438. package/dist/init/slash-command.js +0 -132
  439. package/dist/init/snippets.d.ts +0 -134
  440. package/dist/init/snippets.js +0 -572
  441. package/dist/init/vite-config.d.ts +0 -18
  442. package/dist/init/vite-config.js +0 -114
  443. package/dist/init/windows-quote.d.ts +0 -38
  444. package/dist/init/windows-quote.js +0 -70
  445. package/dist/init/workspace-apps.d.ts +0 -30
  446. package/dist/init/workspace-apps.js +0 -178
  447. package/dist/project/remember-project.d.ts +0 -24
  448. package/dist/project/remember-project.js +0 -40
  449. /package/dist/{init → setup}/confirm.d.ts +0 -0
@@ -1,64 +0,0 @@
1
- /**
2
- * How each framework gets wired: the Vite plugin, the three Next files, the SvelteKit client hook.
3
- * Split out of `plan.ts` — that file is the plan's SHAPE (statuses, ordering, the agent/MCP steps),
4
- * this one is the per-framework detail, and they grow for different reasons.
5
- */
6
- import { type PlanInput, type Step } from './plan.js';
7
- /** What adding `reticle()` to a Vite config buys, which differs by framework. */
8
- export declare const VITE_PLUGIN_DETAIL: {
9
- /** A plain Vite app gets both halves from the plugin. */
10
- readonly VITE: "add reticle() to plugins (also injects connect())";
11
- /**
12
- * SvelteKit renders through app.html, so the plugin's HTML injection never fires and connect()
13
- * comes from the client hook instead. The plugin is still required: it is what stamps
14
- * data-reticle-source into .svelte components, and without it every verdict on a SvelteKit app
15
- * comes back with no file:line at all.
16
- */
17
- readonly SVELTEKIT: "add reticle() to plugins (stamps data-reticle-source in .svelte components)";
18
- };
19
- export declare function viteSteps(input: PlanInput, detail?: string): Step[];
20
- export declare function nextSteps(input: PlanInput): Step[];
21
- /**
22
- * SvelteKit is WIRED but not SUPPORTED, and the plan says so out loud.
23
- *
24
- * There is no SvelteKit app in `apps/` and no CI gate for one, so nothing proves this hook still
25
- * registers a session — every other framework init offers (React, Next, Remix, Astro) has both. The
26
- * wiring is real and may well work; what is missing is anything that would tell us when it stops.
27
- * Silently emitting it reads as a support claim, which is the thing this project exists to not do.
28
- */
29
- /**
30
- * Create React App: the connect goes in `src/index.tsx`, the token in `.env.development.local`.
31
- *
32
- * The previous plan pointed at `index.html`, which cannot work — CRA's is a static template the
33
- * bundler never processes for modules. Reported from a real cra-redux-saga app.
34
- */
35
- export declare function craSteps(input: PlanInput): Step[];
36
- /**
37
- * Nuxt: one manual step carrying the whole recipe, and no pretence of more.
38
- *
39
- * There is no Nuxt app in `apps/` and no CI gate for one, so an auto-written plugin would be a
40
- * support claim nothing backs — the same reasoning SvelteKit already carries. What this DOES fix is
41
- * everything that made the previous fall-through actively wrong: Nuxt was classified as `html`, so
42
- * it was handed the React kit and a localhost-guarded snippet that cannot run in a Vue app.
43
- */
44
- export declare function nuxtSteps(input: PlanInput): Step[];
45
- export declare function svelteKitSteps(input: PlanInput): Step[];
46
- /**
47
- * Astro: the config define + build target, and the connect script in ONE layout.
48
- *
49
- * Astro was the last gated stack left printing a recipe it did not apply. It still falls back to the
50
- * printed one whenever the choice is not obvious — no config, no single layout, or a shape the
51
- * patchers do not fully recognise — because which page or layout to instrument is a real decision
52
- * and a half-edited build config is worse than a documented manual step.
53
- */
54
- export declare function astroSteps(input: PlanInput): Step[];
55
- /**
56
- * A Content-Security-Policy whose `connect-src` excludes the bridge, said out loud at install time.
57
- *
58
- * Both reported cases were Next apps where `init` printed success for every step and the app then
59
- * never connected: the browser blocked the WebSocket and reported it in its own console, which
60
- * nothing on this side reads. A NOTICE rather than a step, because editing someone's security policy
61
- * is theirs to do — but it carries the exact text to paste, which is the difference between a
62
- * warning and a fix.
63
- */
64
- export declare function cspStep(input: PlanInput): Step[];
@@ -1,565 +0,0 @@
1
- /**
2
- * How each framework gets wired: the Vite plugin, the three Next files, the SvelteKit client hook.
3
- * Split out of `plan.ts` — that file is the plan's SHAPE (statuses, ordering, the agent/MCP steps),
4
- * this one is the per-framework detail, and they grow for different reasons.
5
- */
6
- import { bridgeWsUrl } from '@reticlehq/core';
7
- import { patchViteConfig, VitePatchKind } from './vite-config.js';
8
- import { patchNextConfig, patchRootLayout, patchPagesApp } from './next-patch.js';
9
- import { ASTRO_ENV_DTS_PATH, patchAstroConfig, patchAstroEnvDts, patchAstroLayout, } from './astro-patch.js';
10
- import { CRA_DEV_MODULE_IMPORT, CRA_ENV_PATH, CRA_TOKEN_PER_MACHINE_NOTICE, TOKEN_VAR, craDevModuleFile, craDevModulePath, craEnvPatch, craImportPatch, } from './cra.js';
11
- import { PatchKind } from './patch-kind.js';
12
- import { viteManual, NEXT_LAYOUT_MANUAL, NEXT_LAYOUT_PATH, viteDevModuleFile, VITE_DEV_MODULE_PATH, nextReticleDevFile, NEXT_RETICLE_DEV_PATH, nextConfigManual, svelteKitHooksFile, SVELTEKIT_HOOKS_PATH, UNVERIFIED_FRAMEWORK_NOTE, astroManual, nuxtManual, NUXT_PLUGIN_PATH, } from './snippets.js';
13
- import { StepStatus } from './plan.js';
14
- import { RETICLE_DEFAULT_PORT } from '@reticlehq/core';
15
- import { CSP_STEP_TITLE } from './csp-check.js';
16
- import { diagnoseWebCsp } from './csp-doctor.js';
17
- /** What adding `reticle()` to a Vite config buys, which differs by framework. */
18
- export const VITE_PLUGIN_DETAIL = {
19
- /** A plain Vite app gets both halves from the plugin. */
20
- VITE: 'add reticle() to plugins (also injects connect())',
21
- /**
22
- * SvelteKit renders through app.html, so the plugin's HTML injection never fires and connect()
23
- * comes from the client hook instead. The plugin is still required: it is what stamps
24
- * data-reticle-source into .svelte components, and without it every verdict on a SvelteKit app
25
- * comes back with no file:line at all.
26
- */
27
- SVELTEKIT: 'add reticle() to plugins (stamps data-reticle-source in .svelte components)',
28
- };
29
- const CAPABILITIES_TITLE = 'Capabilities + store';
30
- /**
31
- * The one step `init` genuinely cannot finish, addressed to the AGENT reading this report.
32
- *
33
- * It used to read "Capabilities are empty until you edit that file" and describe the consequence to
34
- * a human — homework, in a report a human mostly does not read, naming no file to open and no thing
35
- * to look for. The agent that ran `init` is right there, has the codebase, and can finish this in
36
- * the same minute; what it needed was the specific instruction, not the rationale.
37
- *
38
- * What is left is exactly what could not be PROVEN from source: which atoms/actor/queryClient an
39
- * adapter-wrapped store should be built from, and which elements matter enough to name. `init`
40
- * emits nothing it cannot prove, because a wrong import here throws on every dev page load — worse
41
- * than an empty file.
42
- */
43
- const CAPABILITIES_TODO_TITLE = 'AGENT: finish the capabilities file';
44
- function capabilitiesTodo(path, stores) {
45
- return (`This app's state lives in a library nothing in the running app points at, so it is the one ` +
46
- `thing Reticle cannot find for itself — reticle_state will not see it until you say where it ` +
47
- `is.\n` +
48
- `Do this now, before driving anything:\n` +
49
- ` 1. In ${path}, uncomment the suggested line and complete it: ${stores.join('; ')}.\n` +
50
- ` 2. Prove it: drive one flow and check reticle_state returns your key. An empty state read ` +
51
- `means the line is still not doing anything, whatever else went green.`);
52
- }
53
- /**
54
- * The dev module carrying `registerCapabilities` / `registerStore`.
55
- *
56
- * Without it every app came up `hasCapabilities: false` with a `reticle_state` holding nothing but
57
- * `__reticle_renders` — the state-truth read was unavailable on every app out of the box. Written
58
- * only when absent, because it is the one generated file a user is expected to EDIT.
59
- */
60
- /**
61
- * Is there state left that ONLY the app can hand over?
62
- *
63
- * This used to ask a much bigger question — "does the generated file register anything at all?" —
64
- * and fired on almost every install, because almost every install generated a file whose testids
65
- * and stores were both empty. The answer was homework: go read the source, uncomment a line, add
66
- * data-testid attributes, then drive to prove it. Several turns, on every onboarding.
67
- *
68
- * Two of those three are no longer anyone's homework. Testids are read from the live DOM, and a
69
- * store passed through a React context provider (Redux, TanStack Query) is discovered and
70
- * registered on the first commit. What is left is the genuinely unreachable case: a module-scope
71
- * store, or one needing an argument only the source supplies — Zustand, Jotai atoms, an XState
72
- * actor. Nothing in the running app points at those, so the notice still has to fire, and it now
73
- * fires ONLY there.
74
- *
75
- * `wired` are stores init resolved and wrote a live `registerStore` call for. Hints are not
76
- * registrations: they land in the file as a commented line, and counting one as a registration
77
- * silences the notice whose whole purpose is to say "act on the hint".
78
- */
79
- function needsManualStore(hints, wired) {
80
- return hints.length > 0 && 0 === wired.length;
81
- }
82
- function capabilitiesStep(input) {
83
- if (true === input.viteDevModuleExists) {
84
- return [
85
- {
86
- title: CAPABILITIES_TITLE,
87
- target: VITE_DEV_MODULE_PATH,
88
- status: StepStatus.ALREADY,
89
- detail: 'file exists, left alone, it is yours to edit',
90
- },
91
- ];
92
- }
93
- const testids = input.testids ?? [];
94
- const stores = input.storeHints ?? [];
95
- const wired = input.foundStores ?? [];
96
- // Testids no longer need counting here. They are read from the live DOM at announce time, so a
97
- // number printed at install time would be a stale claim about a codebase that is about to change —
98
- // which is exactly what "no data-testid values yet" used to be on an app whose testids arrive with
99
- // a lazy route.
100
- const found = 'testids read from the live DOM';
101
- // A store we found and WIRED is a registration, so the notice must not fire. A store HINT is not:
102
- // `stores` holds suggestions, written into the file as a commented line of the form
103
- // `// import your store, then: registerStore(...)`. Counting a suggestion as a registration let
104
- // the hint silence the notice whose entire job is to say "act on the hint".
105
- //
106
- // Measured against a real product UI (rowy — 70+ deps, jotai, a whole src/atoms tree): init
107
- // detected jotai, offered one commented line, emitted NO notice, and wrote
108
- // `registerCapabilities({ testids: [], signals: [], stores: [] })`. So `hasCapabilities` stayed
109
- // false, `reticle_state` was empty forever, and the install gate reported "connected: 1,
110
- // manual ⚠: none". Every check green, state observability zero.
111
- //
112
- // jotai is still exactly that case. A Redux or TanStack app is not, any more: its store rides a
113
- // context provider and the React adapter registers it on the first commit, so `storeHints` no
114
- // longer names either one and this notice no longer fires for them.
115
- const nothingToRegister = needsManualStore(stores, wired);
116
- return [
117
- {
118
- title: CAPABILITIES_TITLE,
119
- target: VITE_DEV_MODULE_PATH,
120
- status: StepStatus.APPLY,
121
- detail: `${found}; ${wired.length > 0
122
- ? `registered ${wired.map((s) => `'${s.key}'`).join(', ')} from your source`
123
- : stores.length > 0
124
- ? `store: uncomment the ${String(stores.length)} suggested line(s)`
125
- : 'no state library detected'}`,
126
- write: {
127
- path: VITE_DEV_MODULE_PATH,
128
- content: viteDevModuleFile(testids, stores, wired, input.detection.uiLibrary),
129
- },
130
- dependsOnInstall: true,
131
- },
132
- // The write is real; what it registers is not. `registerCapabilities({ testids: [], signals: [],
133
- // stores: [] })` registers nothing, so `hasCapabilities` stays false — correctly — and the ✓
134
- // above reads as if the feature is on. Reported as exactly that confusion: "hasCapabilities false
135
- // on every session while init said ✓ Capabilities + store".
136
- //
137
- // Beside the write rather than replacing it, for two reasons: only APPLY steps are written
138
- // (run.ts), and SKILL.md tells the reader to skip ✓ lines — so a caveat carried on the ✓ is a
139
- // caveat nobody reads.
140
- ...(nothingToRegister
141
- ? [
142
- {
143
- title: CAPABILITIES_TODO_TITLE,
144
- target: VITE_DEV_MODULE_PATH,
145
- status: StepStatus.NOTICE,
146
- detail: capabilitiesTodo(VITE_DEV_MODULE_PATH, stores),
147
- },
148
- ]
149
- : []),
150
- ];
151
- }
152
- export function viteSteps(input, detail = VITE_PLUGIN_DETAIL.VITE) {
153
- // Capabilities are independent of whether the config needed patching. Attaching them to the APPLY
154
- // branch meant a re-run on an already-wired app silently never created the module.
155
- return [...viteConfigSteps(input, detail), ...capabilitiesStep(input)];
156
- }
157
- function viteConfigSteps(input, detail) {
158
- const cfg = input.viteConfig;
159
- const port = input.options.port;
160
- if (null === cfg) {
161
- return [
162
- {
163
- title: 'Vite plugin',
164
- target: 'vite.config',
165
- status: StepStatus.MANUAL,
166
- detail: viteManual(port, input.detection.uiLibrary),
167
- },
168
- ];
169
- }
170
- const patch = patchViteConfig(cfg.source, port, true === input.captureBodies);
171
- if (patch.kind === VitePatchKind.ALREADY) {
172
- return [
173
- {
174
- title: 'Vite plugin',
175
- target: cfg.path,
176
- status: StepStatus.ALREADY,
177
- detail: 'reticle() already in plugins',
178
- },
179
- ];
180
- }
181
- if (patch.kind === VitePatchKind.MANUAL) {
182
- return [
183
- {
184
- title: 'Vite plugin',
185
- target: cfg.path,
186
- status: StepStatus.MANUAL,
187
- detail: `${patch.reason}\n\n${viteManual(port, input.detection.uiLibrary)}`,
188
- },
189
- ];
190
- }
191
- return [
192
- {
193
- title: 'Vite plugin',
194
- target: cfg.path,
195
- status: StepStatus.APPLY,
196
- detail,
197
- write: { path: cfg.path, content: patch.code },
198
- dependsOnInstall: true,
199
- },
200
- ];
201
- }
202
- /**
203
- * Turn a conservative source patch into a step: applied when it patched, already when the wiring is
204
- * there, and the hand-edit instructions when the file shape wasn't one we recognise.
205
- */
206
- function patchStep(title, path, patch, applyDetail, manualDetail) {
207
- if (patch.kind === PatchKind.ALREADY) {
208
- return { title, target: path, status: StepStatus.ALREADY, detail: 'already wired' };
209
- }
210
- if (patch.kind === PatchKind.MANUAL) {
211
- return {
212
- title,
213
- target: path,
214
- status: StepStatus.MANUAL,
215
- detail: `${patch.reason}\n\n${manualDetail}`,
216
- };
217
- }
218
- return {
219
- title,
220
- target: path,
221
- status: StepStatus.APPLY,
222
- detail: applyDetail,
223
- write: { path, content: patch.code },
224
- dependsOnInstall: true,
225
- };
226
- }
227
- /**
228
- * Next used to be the ONLY stack with hand edits left over — and both of them fail silently when
229
- * skipped, so a Next user's app booted, connected to nothing, and said nothing about why. Both are
230
- * now patched by the same conservative rules the Vite config gets.
231
- */
232
- /** The env var withReticle sets from the discovered daemon, and the component must read. */
233
- const NEXT_DAEMON_URL_ENV = 'NEXT_PUBLIC_RETICLE_URL';
234
- /**
235
- * The two-line edit that unfreezes an existing install's port.
236
- *
237
- * Stated as the edit rather than as a problem, because the reader is an agent that can apply it in
238
- * one write and is otherwise going to ask what to do.
239
- */
240
- const NEXT_DEV_FILE_STALE_DETAIL = 'predates daemon discovery, so it dials the port init saw when it ran. In this file add ' +
241
- '`const url = process.env.NEXT_PUBLIC_RETICLE_URL;` and spread `...(url ? { url } : {})` into ' +
242
- 'reticle.connect(), after any url already there. Nothing else needs to change.';
243
- export function nextSteps(input) {
244
- const configFile = input.nextConfigFile ?? 'next.config.mjs';
245
- const devPath = input.nextReticleDevPath ?? NEXT_RETICLE_DEV_PATH;
246
- // An install that predates daemon discovery has a component that never reads the discovered URL,
247
- // so it keeps dialling whatever port `init` saw on the day it ran. Re-running `init` used to call
248
- // that "file exists" and move on, which is why the defect survives an upgrade. Named as work.
249
- //
250
- // Never overwritten: this file is the one an app owner edits — registered stores, capabilities,
251
- // their own signals. Rewriting it to fix two lines would take the rest with it. Undefined source
252
- // means it was not read, and an unread file stays ALREADY rather than becoming invented work.
253
- const devStale = true === input.nextReticleDevExists &&
254
- 'string' === typeof input.nextReticleDevSource &&
255
- !input.nextReticleDevSource.includes(NEXT_DAEMON_URL_ENV);
256
- const devFile = input.nextReticleDevExists
257
- ? devStale
258
- ? {
259
- title: 'ReticleDev component',
260
- target: devPath,
261
- status: StepStatus.MANUAL,
262
- detail: NEXT_DEV_FILE_STALE_DETAIL,
263
- }
264
- : {
265
- title: 'ReticleDev component',
266
- target: devPath,
267
- status: StepStatus.ALREADY,
268
- detail: 'file exists',
269
- }
270
- : {
271
- title: 'ReticleDev component',
272
- target: devPath,
273
- status: StepStatus.APPLY,
274
- detail: 'create dev-only connect component',
275
- write: {
276
- path: devPath,
277
- content: nextReticleDevFile(input.options.port, input.options.projectId, input.testids ?? [], input.storeHints ?? [],
278
- // Next's dev module is not a sibling of `src/` — its imports are resolved from wherever
279
- // the component actually lands (`app/`, or `src/app/` in a --src-dir app).
280
- input.nextFoundStores ?? []),
281
- },
282
- dependsOnInstall: true,
283
- };
284
- const configPatch = null === input.nextConfigSource || input.nextConfigSource === undefined
285
- ? { kind: PatchKind.MANUAL, reason: `no ${configFile} found` }
286
- : patchNextConfig(input.nextConfigSource);
287
- const layout = input.nextLayout ?? null;
288
- // Pages Router mounts through pages/_app, App Router through the root layout — different edits,
289
- // and picking by path is what stops a Pages app being handed the layout patch that cannot apply.
290
- const isPagesRouter = layout !== null && /(^|\/)pages\/_app\.[jt]sx?$/.test(layout.path);
291
- const layoutPatch = null === layout
292
- ? { kind: PatchKind.MANUAL, reason: 'no root layout (app/layout.tsx) or pages/_app found' }
293
- : isPagesRouter
294
- ? patchPagesApp(layout.source, input.nextReticleDevImport)
295
- : patchRootLayout(layout.source);
296
- // The same question the Vite path asks. Skipped when the module already exists: its contents are
297
- // the user's, and re-nagging about a file we did not write is noise.
298
- const nextTodo = true !== input.nextReticleDevExists &&
299
- needsManualStore(input.storeHints ?? [], input.nextFoundStores ?? [])
300
- ? [
301
- {
302
- title: CAPABILITIES_TODO_TITLE,
303
- target: devPath,
304
- status: StepStatus.NOTICE,
305
- detail: capabilitiesTodo(devPath, input.storeHints ?? []),
306
- },
307
- ]
308
- : [];
309
- return [
310
- devFile,
311
- ...nextTodo,
312
- patchStep('Next config (withReticle)', configFile, configPatch, 'wrap the export in withReticle (source mapping, dev-only)', nextConfigManual(configFile)),
313
- patchStep('Mount ReticleDev', layout?.path ?? NEXT_LAYOUT_PATH, layoutPatch, 'mount <ReticleDev /> in the root layout (dev-only)', NEXT_LAYOUT_MANUAL),
314
- ];
315
- }
316
- /**
317
- * SvelteKit is WIRED but not SUPPORTED, and the plan says so out loud.
318
- *
319
- * There is no SvelteKit app in `apps/` and no CI gate for one, so nothing proves this hook still
320
- * registers a session — every other framework init offers (React, Next, Remix, Astro) has both. The
321
- * wiring is real and may well work; what is missing is anything that would tell us when it stops.
322
- * Silently emitting it reads as a support claim, which is the thing this project exists to not do.
323
- */
324
- /**
325
- * Create React App: the connect goes in `src/index.tsx`, the token in `.env.development.local`.
326
- *
327
- * The previous plan pointed at `index.html`, which cannot work — CRA's is a static template the
328
- * bundler never processes for modules. Reported from a real cra-redux-saga app.
329
- */
330
- export function craSteps(input) {
331
- const entry = input.craEntry ?? null;
332
- // Match the project language the same way Next does (#675): a JS CRA app cannot resolve `.ts`.
333
- const modulePath = craDevModulePath(input.detection.typescript);
334
- const steps = [
335
- {
336
- title: 'Reticle connect module',
337
- target: modulePath,
338
- status: StepStatus.APPLY,
339
- detail: 'create the dev-only connect (CRA cannot inject through public/index.html)',
340
- write: {
341
- path: modulePath,
342
- content: craDevModuleFile(input.options.port, input.options.projectId, {
343
- typescript: input.detection.typescript,
344
- }),
345
- },
346
- dependsOnInstall: true,
347
- },
348
- ];
349
- const token = input.pairingToken ?? '';
350
- // The daemon that is live NOW, not the one baked into the module at first install. CRA has no
351
- // build hook, so this is refreshed by re-running `init` rather than by starting the dev server.
352
- const env = craEnvPatch(input.craEnv ?? null, token, input.options.port === undefined ? undefined : bridgeWsUrl(input.options.port));
353
- if (env !== null) {
354
- steps.push({
355
- title: 'Pairing token',
356
- target: CRA_ENV_PATH,
357
- status: StepStatus.APPLY,
358
- // REACT_APP_* is the only thing CRA inlines into browser code; without the token the bridge
359
- // refuses the connection and no session appears. Say the file is gitignored HERE, at the one
360
- // moment someone is looking: the token is per-machine and cannot travel, so every teammate
361
- // has to run init once or their clone is dead with no explanation.
362
- detail: `set ${TOKEN_VAR} (the only channel CRA inlines) — ${CRA_ENV_PATH} is gitignored, so each teammate must run \`reticle init\` on their own machine`,
363
- write: { path: CRA_ENV_PATH, content: env },
364
- });
365
- // Beside the write, not inside it. A ✓ line is one SKILL.md tells the reader to skip, and this
366
- // is the fact that decides whether the install works for anyone but the person running it.
367
- steps.push({
368
- title: 'Pairing token is per-machine',
369
- target: CRA_ENV_PATH,
370
- status: StepStatus.NOTICE,
371
- detail: CRA_TOKEN_PER_MACHINE_NOTICE,
372
- });
373
- }
374
- else if ('' === token) {
375
- // No daemon has ever run here, so there is no token to inline. Omitting the step entirely made
376
- // init report all-green for an app that could never pair.
377
- steps.push({
378
- title: 'Pairing token',
379
- target: CRA_ENV_PATH,
380
- status: StepStatus.MANUAL,
381
- // `reticle serve`, not `reticle start` — the latter is not a verb this CLI dispatches, and
382
- // this message is read by someone whose app boots and never pairs. Handing them a command
383
- // that errors is a second dead end on the first.
384
- detail: `no pairing token yet — the daemon writes one on first run. Start it with \`reticle serve\` (or let your agent run \`reticle mcp\`), then \`reticle init\` again to write ${TOKEN_VAR}`,
385
- });
386
- }
387
- if (null === entry) {
388
- steps.push({
389
- title: 'Connect snippet (CRA)',
390
- target: 'src/index.tsx',
391
- status: StepStatus.MANUAL,
392
- detail: `Add \`${CRA_DEV_MODULE_IMPORT}\` to your app entry (src/index.tsx or src/index.js), after the existing imports.`,
393
- });
394
- return steps;
395
- }
396
- const patched = craImportPatch(entry.source);
397
- steps.push(null === patched
398
- ? {
399
- title: 'Connect snippet (CRA)',
400
- target: entry.path,
401
- status: StepStatus.ALREADY,
402
- detail: 'already imported',
403
- }
404
- : {
405
- title: 'Connect snippet (CRA)',
406
- target: entry.path,
407
- status: StepStatus.APPLY,
408
- detail: 'import the dev-only connect module',
409
- write: { path: entry.path, content: patched },
410
- dependsOnInstall: true,
411
- });
412
- return steps;
413
- }
414
- /**
415
- * Nuxt: one manual step carrying the whole recipe, and no pretence of more.
416
- *
417
- * There is no Nuxt app in `apps/` and no CI gate for one, so an auto-written plugin would be a
418
- * support claim nothing backs — the same reasoning SvelteKit already carries. What this DOES fix is
419
- * everything that made the previous fall-through actively wrong: Nuxt was classified as `html`, so
420
- * it was handed the React kit and a localhost-guarded snippet that cannot run in a Vue app.
421
- */
422
- export function nuxtSteps(input) {
423
- return [
424
- {
425
- title: 'Connect snippet (Nuxt)',
426
- target: NUXT_PLUGIN_PATH,
427
- status: StepStatus.MANUAL,
428
- detail: nuxtManual(input.options.port, input.options.projectId),
429
- },
430
- ];
431
- }
432
- export function svelteKitSteps(input) {
433
- const unverified = {
434
- title: 'SvelteKit is UNVERIFIED',
435
- target: SVELTEKIT_HOOKS_PATH,
436
- status: StepStatus.NOTICE,
437
- detail: UNVERIFIED_FRAMEWORK_NOTE,
438
- };
439
- // SvelteKit can't use the Vite-plugin injection (it renders via app.html) — wire a client hook
440
- // that SvelteKit runs on startup, which is the path that can register a session at all.
441
- if (true === input.svelteKitHooksExists) {
442
- return [
443
- unverified,
444
- {
445
- title: 'Reticle client hook',
446
- target: SVELTEKIT_HOOKS_PATH,
447
- status: StepStatus.ALREADY,
448
- detail: 'file exists',
449
- },
450
- ];
451
- }
452
- return [
453
- unverified,
454
- {
455
- title: 'Reticle client hook',
456
- target: SVELTEKIT_HOOKS_PATH,
457
- status: StepStatus.APPLY,
458
- detail: 'create dev-only client connect (SvelteKit renders via app.html)',
459
- write: {
460
- path: SVELTEKIT_HOOKS_PATH,
461
- content: svelteKitHooksFile(input.options.port, input.options.projectId, input.detection.uiLibrary),
462
- },
463
- dependsOnInstall: true,
464
- },
465
- ];
466
- }
467
- /**
468
- * Astro: the config define + build target, and the connect script in ONE layout.
469
- *
470
- * Astro was the last gated stack left printing a recipe it did not apply. It still falls back to the
471
- * printed one whenever the choice is not obvious — no config, no single layout, or a shape the
472
- * patchers do not fully recognise — because which page or layout to instrument is a real decision
473
- * and a half-edited build config is worse than a documented manual step.
474
- */
475
- export function astroSteps(input) {
476
- const config = input.astroConfig ?? null;
477
- const layout = input.astroLayout ?? null;
478
- const manual = astroManual(input.options.port, input.options.projectId, layout?.path);
479
- if (null === config || null === layout) {
480
- return [
481
- {
482
- title: 'Connect snippet (Astro)',
483
- // Name what is actually there. `astro.config + layout` pointed at a layout this project may
484
- // not have — reported on a fixture with only src/pages/index.astro.
485
- target: null === layout ? 'astro.config + a page (no layout found)' : 'astro.config + layout',
486
- status: StepStatus.MANUAL,
487
- detail: manual,
488
- },
489
- ];
490
- }
491
- // ATOMIC. The connect snippet is useless without the config: the token is inlined by the config,
492
- // so a layout patched on its own gives an app that dials the bridge and is refused. Measured on a
493
- // real fixture — config ⚠, layout ✓ — which reads as one step done and one caveat when it is
494
- // actually a guaranteed non-connection. If either half cannot be applied, BOTH go manual with the
495
- // single recipe that does the whole job.
496
- const manualWithLayout = astroManual(input.options.port, input.options.projectId, layout.path);
497
- const configPatch = patchAstroConfig(config.source);
498
- const layoutPatch = patchAstroLayout(layout.source, input.options.port, input.options.projectId, input.detection.uiLibrary);
499
- if (configPatch.kind === PatchKind.MANUAL || layoutPatch.kind === PatchKind.MANUAL) {
500
- return [
501
- {
502
- title: 'Connect snippet (Astro)',
503
- target: `${config.path} + ${layout.path}`,
504
- status: StepStatus.MANUAL,
505
- detail: manualWithLayout,
506
- },
507
- ];
508
- }
509
- const envPatch = patchAstroEnvDts(input.astroEnvDts ?? null);
510
- return [
511
- patchStep('Astro config (token + build target)', config.path, configPatch, 'inline the pairing token and raise build.target to es2022', manualWithLayout),
512
- patchStep('Connect snippet (Astro)', layout.path, layoutPatch, 'add the dev-only connect <script> before </body>', manualWithLayout),
513
- // Declares the Vite define names so `astro check` (create-astro's default build) can see them
514
- // (#677). Independent of the two halves above: even an ALREADY config/layout still needs this
515
- // when the env file was never written.
516
- patchStep('Astro env types (Vite defines)', ASTRO_ENV_DTS_PATH, envPatch, 'declare __RETICLE_TOKEN__ / __RETICLE_ROOT__ for astro check', manualWithLayout),
517
- ];
518
- }
519
- /**
520
- * A Content-Security-Policy whose `connect-src` excludes the bridge, said out loud at install time.
521
- *
522
- * Both reported cases were Next apps where `init` printed success for every step and the app then
523
- * never connected: the browser blocked the WebSocket and reported it in its own console, which
524
- * nothing on this side reads. A NOTICE rather than a step, because editing someone's security policy
525
- * is theirs to do — but it carries the exact text to paste, which is the difference between a
526
- * warning and a fix.
527
- */
528
- export function cspStep(input) {
529
- // Reads the SAME list `reticle doctor` reads. It used to read a hand-written pair —
530
- // `[nextConfigSource, nextLayout?.source]` — while csp-doctor.ts already carried the full set
531
- // including `index.html`, which is where every Vite and Electron app declares its policy. So the
532
- // command you run BEFORE anything works checked less than the one you run after it has failed.
533
- //
534
- // Measured on MarkText, a production Electron editor: its renderer sets `default-src 'self'` with
535
- // no `connect-src`, the browser blocked the bridge WebSocket, and `init` printed a clean plan. The
536
- // daemon cannot see a dial that never left the page, so nothing anywhere said why — and the check
537
- // that would have said it was sitting one import away.
538
- // The pre-read Next sources are folded in ON TOP of the shared list, not replaced by it: init
539
- // resolves `nextConfigFile` across more spellings than CSP_FILES names (`.mts`, for one), and a
540
- // layout is found by search rather than by a fixed path. Two sources of the same truth is the
541
- // problem being fixed here — one of them being a SUPERSET is not.
542
- const extra = {
543
- ...(input.nextConfigFile !== null && input.nextConfigFile !== undefined
544
- ? { [input.nextConfigFile]: input.nextConfigSource ?? undefined }
545
- : {}),
546
- ...(input.nextLayout ? { [input.nextLayout.path]: input.nextLayout.source } : {}),
547
- };
548
- const read = (file) => extra[file] ?? input.cspSources?.[file];
549
- const findings = diagnoseWebCsp(read, input.options.port ?? RETICLE_DEFAULT_PORT, [
550
- ...Object.keys(extra),
551
- ]);
552
- const first = findings[0];
553
- if (first === undefined)
554
- return [];
555
- return [
556
- {
557
- title: CSP_STEP_TITLE,
558
- target: first.file,
559
- status: StepStatus.NOTICE,
560
- // `problem` already ends with the text to paste; `fix` is the same sentence for callers that
561
- // want it on its own (doctor renders them separately). Printing both said it twice.
562
- detail: first.problem,
563
- },
564
- ];
565
- }