@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,198 +0,0 @@
1
- import { RETICLE_IPC_GLOBAL } from '@reticlehq/core';
2
- /**
3
- * Setup RCA for desktop apps.
4
- *
5
- * Every failure this catches is SILENT. A Tauri app with the default CSP runs perfectly and simply
6
- * never appears in `reticle status` — the WebSocket is blocked before it opens, and nothing in the
7
- * app's own console says so. An Electron app missing the preload line works fine and reports zero
8
- * network activity forever, which reads as "the app makes no backend calls" rather than "you are
9
- * blind to all of them".
10
- *
11
- * Silent misconfiguration is the same disease as a false green: the tool answers confidently and the
12
- * answer is wrong. So the diagnosis names the file, the reason, and the exact line to add.
13
- *
14
- * Pure: a `read` function in, findings out. No fs, no cwd, no process.
15
- */
16
- export const DesktopFinding = {
17
- /** Tauri's CSP will block the bridge WebSocket — the app will never connect, with no error. */
18
- TAURI_CSP_BLOCKS_BRIDGE: 'tauri-csp-blocks-bridge',
19
- /** A custom CSP dropped the `ipc:` source Tauri needs for `invoke` itself. */
20
- TAURI_CSP_BLOCKS_IPC: 'tauri-csp-blocks-ipc',
21
- /** The preload never requires the shim, so every IPC call is invisible. */
22
- ELECTRON_PRELOAD_MISSING: 'electron-preload-missing',
23
- /** The main process never installs the capture helper, so screenshots are unavailable. */
24
- ELECTRON_CAPTURE_MISSING: 'electron-capture-missing',
25
- };
26
- const TAURI_CONF = 'src-tauri/tauri.conf.json';
27
- const PRELOAD_REQUIRE = '@reticlehq/electron/preload';
28
- const CAPTURE_REQUIRE = '@reticlehq/electron/main';
29
- function parseJson(text) {
30
- if (text === undefined)
31
- return undefined;
32
- try {
33
- const parsed = JSON.parse(text);
34
- return 'object' === typeof parsed && parsed !== null
35
- ? parsed
36
- : undefined;
37
- }
38
- catch {
39
- return undefined; // a malformed config is the app's problem, not something to crash the doctor on
40
- }
41
- }
42
- function record(value) {
43
- return 'object' === typeof value && value !== null ? value : {};
44
- }
45
- /**
46
- * Does this CSP permit the bridge WebSocket on `port`?
47
- *
48
- * A MISSING csp key is treated as blocking, not permissive: Tauri applies a restrictive default, so
49
- * reporting "no CSP, therefore fine" would be precisely the false green this tool exists to prevent.
50
- */
51
- function cspAllowsBridge(csp, port) {
52
- if (csp === undefined)
53
- return false;
54
- const exact = `ws://localhost:${String(port)}`;
55
- const loopback = `ws://127.0.0.1:${String(port)}`;
56
- // A BARE `ws:` scheme source allows any ws origin. It must be matched as a whole source, not as a
57
- // substring: `includes('ws:')` also matches `ws://localhost:4400`, which would make every port
58
- // look allowed and silently defeat the port check this function exists to perform.
59
- const bareScheme = /(^|[\s;])ws:(?!\/\/)/.test(csp);
60
- return (csp.includes(exact) ||
61
- csp.includes(loopback) ||
62
- csp.includes('ws://localhost:*') ||
63
- csp.includes('ws://127.0.0.1:*') ||
64
- bareScheme);
65
- }
66
- /** Tauri v2 needs `ipc:`/`http://ipc.localhost` in connect-src for `invoke` to work at all. */
67
- function cspAllowsIpc(csp) {
68
- return csp.includes('ipc:') || csp.includes('ipc.localhost');
69
- }
70
- function diagnoseTauri(read, port) {
71
- const conf = parseJson(read(TAURI_CONF));
72
- if (conf === undefined)
73
- return [];
74
- const security = record(record(conf['app'])['security']);
75
- const csp = 'string' === typeof security['csp'] ? security['csp'] : undefined;
76
- const findings = [];
77
- if (!cspAllowsBridge(csp, port)) {
78
- findings.push({
79
- code: DesktopFinding.TAURI_CSP_BLOCKS_BRIDGE,
80
- file: TAURI_CONF,
81
- problem: csp === undefined
82
- ? "no `app.security.csp` set, so Tauri's restrictive default applies and blocks the Reticle bridge — the app will run normally and never connect"
83
- : 'the CSP `connect-src` does not allow the Reticle bridge WebSocket — the app will run normally and never connect',
84
- fix: `add to app.security.csp connect-src: ws://localhost:${String(port)}`,
85
- });
86
- }
87
- if (csp !== undefined && !cspAllowsIpc(csp)) {
88
- findings.push({
89
- code: DesktopFinding.TAURI_CSP_BLOCKS_IPC,
90
- file: TAURI_CONF,
91
- problem: 'the CSP dropped the `ipc:` source Tauri needs — `invoke` itself will fail',
92
- fix: 'add to app.security.csp connect-src: ipc: http://ipc.localhost',
93
- });
94
- }
95
- return findings;
96
- }
97
- /** The directory portion of a path, without pulling in node:path (this module stays pure). */
98
- function dirOf(path) {
99
- const cut = path.lastIndexOf('/');
100
- return cut < 0 ? '' : path.slice(0, cut + 1);
101
- }
102
- /**
103
- * Where a preload SOURCE might live, in the order worth trying.
104
- *
105
- * Beside `main` first (the unbundled layout), then the usual source directories — a bundled setup
106
- * points `main` at `out/` or `dist/` while the real preload stays in `src/` or `electron/`.
107
- */
108
- function preloadCandidates(mainDir) {
109
- const names = ['preload.cjs', 'preload.js', 'preload.mjs', 'preload.ts', 'preload.mts'];
110
- const dirs = [mainDir, 'electron/', 'src/', 'src/preload/', 'src/main/', ''];
111
- return dirs.flatMap((dir) => names.map((name) => `${dir}${name}`));
112
- }
113
- /**
114
- * Where a BUNDLED preload's output lands. electron-vite's default layout mirrors `out/main` with
115
- * `out/preload`; Forge and hand-rolled setups favour `dist`/`build`.
116
- */
117
- function bundledPreloadCandidates(mainDir) {
118
- const roots = [mainDir.replace(/main\/?$/, ''), 'out/', 'dist/', 'build/', '.vite/build/'];
119
- const names = [
120
- 'preload/index.js',
121
- 'preload/index.mjs',
122
- 'preload/index.cjs',
123
- 'preload.js',
124
- 'preload.mjs',
125
- 'preload.cjs',
126
- ];
127
- return roots.flatMap((root) => names.map((name) => `${root}${name}`));
128
- }
129
- /**
130
- * Is the preload wired, judged from whatever evidence exists?
131
- *
132
- * Source first (the require is right there). Failing that, the BUILD OUTPUT: bundling inlines the
133
- * shim, and the shim carries the contract's own window global — finding that string in the artifact
134
- * proves the preload is wired even though the require has been compiled away. Undefined means no
135
- * evidence either way, and an unknown must never be reported as a fault.
136
- */
137
- function preloadWired(read, mainDir) {
138
- for (const candidate of preloadCandidates(mainDir)) {
139
- const source = read(candidate);
140
- if (source !== undefined)
141
- return { wired: source.includes(PRELOAD_REQUIRE), file: candidate };
142
- }
143
- for (const candidate of bundledPreloadCandidates(mainDir)) {
144
- const built = read(candidate);
145
- if (built !== undefined) {
146
- return { wired: built.includes(RETICLE_IPC_GLOBAL), file: candidate };
147
- }
148
- }
149
- return undefined;
150
- }
151
- function diagnoseElectron(read, main) {
152
- const findings = [];
153
- const dir = dirOf(main);
154
- // Undefined = no source AND no build output to judge from. An unknown is not a fault.
155
- const preload = preloadWired(read, dir);
156
- if (preload !== undefined && !preload.wired) {
157
- findings.push({
158
- code: DesktopFinding.ELECTRON_PRELOAD_MISSING,
159
- file: preload.file,
160
- problem: 'the preload never installs the Reticle IPC shim, so every ipcRenderer.invoke is invisible — reticle_network will report nothing and read as "this app makes no backend calls"',
161
- fix: `add as the FIRST line: require('${PRELOAD_REQUIRE}')`,
162
- });
163
- }
164
- const mainSource = read(main);
165
- if (mainSource !== undefined && !mainSource.includes(CAPTURE_REQUIRE)) {
166
- findings.push({
167
- code: DesktopFinding.ELECTRON_CAPTURE_MISSING,
168
- file: main,
169
- problem: 'the main process never installs the capture helper, so screenshots are unavailable',
170
- fix: `add: const { installReticleCapture } = require('${CAPTURE_REQUIRE}') then installReticleCapture(win)`,
171
- });
172
- }
173
- return findings;
174
- }
175
- /** Is this project a desktop shell at all? Used to print a positive result instead of silence. */
176
- export function isDesktopProject(read) {
177
- if (read(TAURI_CONF) !== undefined)
178
- return true;
179
- const pkg = parseJson(read('package.json'));
180
- if (pkg === undefined)
181
- return false;
182
- const deps = { ...record(pkg['dependencies']), ...record(pkg['devDependencies']) };
183
- return deps['electron'] !== undefined;
184
- }
185
- /** Which desktop shell (if any) this project is, and what is missing from its Reticle wiring. */
186
- export function diagnoseDesktop(read, port) {
187
- const tauri = diagnoseTauri(read, port);
188
- if (tauri.length > 0 || read(TAURI_CONF) !== undefined)
189
- return tauri;
190
- const pkg = parseJson(read('package.json'));
191
- if (pkg === undefined)
192
- return [];
193
- const deps = { ...record(pkg['dependencies']), ...record(pkg['devDependencies']) };
194
- if (deps['electron'] === undefined)
195
- return [];
196
- const main = 'string' === typeof pkg['main'] ? pkg['main'] : undefined;
197
- return main === undefined ? [] : diagnoseElectron(read, main);
198
- }
@@ -1,96 +0,0 @@
1
- /**
2
- * Pure framework + toolchain detection for `reticle init`. No filesystem access — callers pass in
3
- * the parsed package.json and the set of config/lock filenames present in the project root.
4
- */
5
- export declare const Framework: {
6
- readonly NEXT: "next";
7
- /**
8
- * Nuxt owns its own Vite instance and has no `vite.config`, so it used to fall all the way through
9
- * to HTML — and then be handed a React kit and a connect snippet guarded on
10
- * `window.location.hostname === 'localhost'`, which cannot work in a Vue app (the guard throws
11
- * during SSR, and never runs at all on a non-localhost dev host). Detected in its own right so it
12
- * gets the package and the recipe that actually fit it.
13
- */
14
- readonly NUXT: "nuxt";
15
- readonly VITE: "vite";
16
- readonly SVELTEKIT: "sveltekit";
17
- readonly ASTRO: "astro";
18
- /** Create React App. No config file exists, so `react-scripts` in the dependencies is the signal. */
19
- readonly CRA: "cra";
20
- readonly HTML: "html";
21
- };
22
- export type Framework = (typeof Framework)[keyof typeof Framework];
23
- export declare const PackageManager: {
24
- readonly PNPM: "pnpm";
25
- readonly YARN: "yarn";
26
- readonly BUN: "bun";
27
- readonly NPM: "npm";
28
- };
29
- export type PackageManager = (typeof PackageManager)[keyof typeof PackageManager];
30
- interface PackageJsonLike {
31
- dependencies?: Record<string, string>;
32
- devDependencies?: Record<string, string>;
33
- peerDependencies?: Record<string, string>;
34
- }
35
- export interface DetectInput {
36
- pkg: PackageJsonLike;
37
- /** Basenames of config files present in the project root (e.g. 'next.config.mjs'). */
38
- configFiles: ReadonlySet<string>;
39
- /** Lockfile basenames present in the project root. */
40
- lockfiles: ReadonlySet<string>;
41
- /** Marker basenames inside `node_modules` (`.modules.yaml`, `.yarn-state.yml`, …), if installed. */
42
- nodeModulesMarkers?: ReadonlySet<string>;
43
- }
44
- /**
45
- * The UI library the app renders with. Detection used to key on "vite is in package.json" and stop
46
- * there, so a Vue or Preact app got `@reticlehq/react` installed and an all-green report with no
47
- * mention that the React adapter has nothing to attach to.
48
- */
49
- export declare const UiLibrary: {
50
- readonly REACT: "react";
51
- readonly PREACT: "preact";
52
- readonly VUE: "vue";
53
- readonly SVELTE: "svelte";
54
- readonly UNKNOWN: "unknown";
55
- };
56
- export type UiLibrary = (typeof UiLibrary)[keyof typeof UiLibrary];
57
- export interface Detection {
58
- framework: Framework;
59
- uiLibrary: UiLibrary;
60
- /**
61
- * Whether the project is TypeScript. Not cosmetic: generating a `.tsx` file into a JavaScript
62
- * project makes Next auto-install TypeScript on the next `next dev`, which on Next 13 takes its
63
- * require-hook down with it and the dev server never starts.
64
- */
65
- typescript: boolean;
66
- reactMajor: number | undefined;
67
- /** React 19 dropped _debugSource, so it needs the build-time source-map stamp. */
68
- needsSourceMapping: boolean;
69
- packageManager: PackageManager;
70
- }
71
- /** Extract the leading major version from a semver range like "^19.0.0" or "19.1.1". */
72
- export declare function parseMajor(range: string | undefined): number | undefined;
73
- /**
74
- * Whether an installed tree identifies the manager that built it. Callers use this to decide whether
75
- * they still need weaker evidence — see `resolveLockfiles`, which stops inheriting an ancestor
76
- * lockfile once the project's own tree can answer the question.
77
- */
78
- export declare function namesAPackageManager(markers: ReadonlySet<string>): boolean;
79
- export declare function detectPackageManager(lockfiles: ReadonlySet<string>, nodeModulesMarkers: ReadonlySet<string>): PackageManager;
80
- export declare function detect(input: DetectInput): Detection;
81
- interface InstallCommand {
82
- command: string;
83
- args: string[];
84
- }
85
- /** Build a dev-dependency install command for one or more packages (e.g. the kit + its build plugin). */
86
- export declare function installCommandParts(pm: PackageManager, pkgs: string | readonly string[]): InstallCommand;
87
- /**
88
- * The install command as a human reads it — and deliberately NOT `installCommandParts` joined.
89
- *
90
- * This string is what the plan prints and what a user retypes when running the step by hand, so it
91
- * must not carry the flags we add only to quieten our own child process. Built from `INSTALL_ARGS`
92
- * directly for that reason; routing it through the parts would put `--no-audit --no-fund` in front of
93
- * every reader and teach them our noise-suppression as if it were part of installing Reticle.
94
- */
95
- export declare function installCommand(pm: PackageManager, pkgs: string | readonly string[]): string;
96
- export {};
@@ -1,209 +0,0 @@
1
- /**
2
- * Pure framework + toolchain detection for `reticle init`. No filesystem access — callers pass in
3
- * the parsed package.json and the set of config/lock filenames present in the project root.
4
- */
5
- export const Framework = {
6
- NEXT: 'next',
7
- /**
8
- * Nuxt owns its own Vite instance and has no `vite.config`, so it used to fall all the way through
9
- * to HTML — and then be handed a React kit and a connect snippet guarded on
10
- * `window.location.hostname === 'localhost'`, which cannot work in a Vue app (the guard throws
11
- * during SSR, and never runs at all on a non-localhost dev host). Detected in its own right so it
12
- * gets the package and the recipe that actually fit it.
13
- */
14
- NUXT: 'nuxt',
15
- VITE: 'vite',
16
- SVELTEKIT: 'sveltekit',
17
- ASTRO: 'astro',
18
- /** Create React App. No config file exists, so `react-scripts` in the dependencies is the signal. */
19
- CRA: 'cra',
20
- HTML: 'html',
21
- };
22
- export const PackageManager = {
23
- PNPM: 'pnpm',
24
- YARN: 'yarn',
25
- BUN: 'bun',
26
- NPM: 'npm',
27
- };
28
- /**
29
- * The UI library the app renders with. Detection used to key on "vite is in package.json" and stop
30
- * there, so a Vue or Preact app got `@reticlehq/react` installed and an all-green report with no
31
- * mention that the React adapter has nothing to attach to.
32
- */
33
- export const UiLibrary = {
34
- REACT: 'react',
35
- PREACT: 'preact',
36
- VUE: 'vue',
37
- SVELTE: 'svelte',
38
- UNKNOWN: 'unknown',
39
- };
40
- const NEXT_CONFIGS = ['next.config.js', 'next.config.mjs', 'next.config.ts', 'next.config.cjs'];
41
- const VITE_CONFIGS = ['vite.config.js', 'vite.config.ts', 'vite.config.mjs', 'vite.config.mts'];
42
- const SVELTE_CONFIGS = ['svelte.config.js', 'svelte.config.ts', 'svelte.config.mjs'];
43
- const NUXT_CONFIGS = ['nuxt.config.ts', 'nuxt.config.js', 'nuxt.config.mjs'];
44
- const ASTRO_CONFIGS = [
45
- 'astro.config.mjs',
46
- 'astro.config.js',
47
- 'astro.config.ts',
48
- 'astro.config.cjs',
49
- ];
50
- function depVersion(pkg, name) {
51
- return pkg.dependencies?.[name] ?? pkg.devDependencies?.[name] ?? pkg.peerDependencies?.[name];
52
- }
53
- function hasAnyConfig(files, candidates) {
54
- return candidates.some((c) => files.has(c));
55
- }
56
- /** Extract the leading major version from a semver range like "^19.0.0" or "19.1.1". */
57
- export function parseMajor(range) {
58
- if (range === undefined)
59
- return undefined;
60
- const match = range.match(/(\d+)/);
61
- if (null === match || match[1] === undefined)
62
- return undefined;
63
- const major = parseInt(match[1], 10);
64
- return isNaN(major) ? undefined : major;
65
- }
66
- /**
67
- * Markers each package manager leaves INSIDE `node_modules`. An installed tree is the strongest
68
- * evidence there is — stronger than a lockfile, which may simply not be committed.
69
- *
70
- * Without this, a pnpm-installed project with no committed lockfile was read as npm, and `npm i -D`
71
- * then died on pnpm's symlink layout with `Cannot read properties of null (reading 'matches')`. Worse,
72
- * it left the package present in `node_modules` but absent from `package.json`, so every later run
73
- * reported the same failure — a setup that could not be retried into working.
74
- */
75
- const NODE_MODULES_MARKERS = [
76
- ['.modules.yaml', PackageManager.PNPM],
77
- ['.yarn-state.yml', PackageManager.YARN],
78
- ['.package-lock.json', PackageManager.NPM],
79
- ];
80
- /** Marker basenames present inside the project's `node_modules`, if it has one. */
81
- function packageManagerFromNodeModules(markers) {
82
- for (const [name, pm] of NODE_MODULES_MARKERS)
83
- if (markers.has(name))
84
- return pm;
85
- return undefined;
86
- }
87
- /**
88
- * Whether an installed tree identifies the manager that built it. Callers use this to decide whether
89
- * they still need weaker evidence — see `resolveLockfiles`, which stops inheriting an ancestor
90
- * lockfile once the project's own tree can answer the question.
91
- */
92
- export function namesAPackageManager(markers) {
93
- return packageManagerFromNodeModules(markers) !== undefined;
94
- }
95
- export function detectPackageManager(lockfiles, nodeModulesMarkers) {
96
- if (lockfiles.has('pnpm-lock.yaml'))
97
- return PackageManager.PNPM;
98
- if (lockfiles.has('yarn.lock'))
99
- return PackageManager.YARN;
100
- if (lockfiles.has('bun.lockb') || lockfiles.has('bun.lock'))
101
- return PackageManager.BUN;
102
- // No lockfile is not the same as "npm". An already-installed tree says which manager built it.
103
- return packageManagerFromNodeModules(nodeModulesMarkers) ?? PackageManager.NPM;
104
- }
105
- function detectFramework(input) {
106
- const { pkg, configFiles } = input;
107
- if (depVersion(pkg, 'next') !== undefined || hasAnyConfig(configFiles, NEXT_CONFIGS)) {
108
- return Framework.NEXT;
109
- }
110
- // Nuxt before Vite: Nuxt apps can carry a `vite` dependency and even a vite.config, but the
111
- // generic Vite path would wire a plugin into a config Nuxt does not read, and inject connect into
112
- // an index.html Nuxt does not serve.
113
- if (depVersion(pkg, 'nuxt') !== undefined || hasAnyConfig(configFiles, NUXT_CONFIGS)) {
114
- return Framework.NUXT;
115
- }
116
- // SvelteKit is Vite-based but renders through app.html, so the Vite plugin's index.html injection
117
- // never fires (verified) — it needs a manual client connect. Check BEFORE the generic Vite branch.
118
- if (depVersion(pkg, '@sveltejs/kit') !== undefined || hasAnyConfig(configFiles, SVELTE_CONFIGS)) {
119
- return Framework.SVELTEKIT;
120
- }
121
- // Astro is Vite-based but SSRs its own HTML, so the plugin's index.html injection never fires and
122
- // `vite` is not a direct dependency — it used to fall all the way through to HTML and be handed
123
- // connect instructions for a bundler it does not have. Check BEFORE the generic Vite branch.
124
- if (depVersion(pkg, 'astro') !== undefined || hasAnyConfig(configFiles, ASTRO_CONFIGS)) {
125
- return Framework.ASTRO;
126
- }
127
- if (depVersion(pkg, 'vite') !== undefined || hasAnyConfig(configFiles, VITE_CONFIGS)) {
128
- return Framework.VITE;
129
- }
130
- // Checked after Vite, never before: a project migrating off CRA can carry both, and the Vite path
131
- // is the one that works. CRA has no config file at all, so the dependency is the only signal.
132
- if (depVersion(pkg, 'react-scripts') !== undefined)
133
- return Framework.CRA;
134
- return Framework.HTML;
135
- }
136
- /**
137
- * React first: a Preact app using preact/compat aliases React, and Next/Remix apps list both. The
138
- * order is the precedence — whichever the app actually renders through is the one it depends on
139
- * directly.
140
- */
141
- function detectUiLibrary(pkg) {
142
- if (depVersion(pkg, 'react') !== undefined)
143
- return UiLibrary.REACT;
144
- if (depVersion(pkg, 'preact') !== undefined)
145
- return UiLibrary.PREACT;
146
- if (depVersion(pkg, 'vue') !== undefined)
147
- return UiLibrary.VUE;
148
- if (depVersion(pkg, 'svelte') !== undefined)
149
- return UiLibrary.SVELTE;
150
- return UiLibrary.UNKNOWN;
151
- }
152
- const TS_CONFIGS = ['tsconfig.json'];
153
- export function detect(input) {
154
- const reactMajor = parseMajor(depVersion(input.pkg, 'react'));
155
- return {
156
- framework: detectFramework(input),
157
- uiLibrary: detectUiLibrary(input.pkg),
158
- typescript: hasAnyConfig(input.configFiles, TS_CONFIGS) ||
159
- depVersion(input.pkg, 'typescript') !== undefined,
160
- reactMajor,
161
- needsSourceMapping: reactMajor !== undefined && reactMajor >= 19,
162
- packageManager: detectPackageManager(input.lockfiles, input.nodeModulesMarkers ?? new Set()),
163
- };
164
- }
165
- const INSTALL_ARGS = {
166
- [PackageManager.PNPM]: ['add', '-D'],
167
- [PackageManager.YARN]: ['add', '-D'],
168
- [PackageManager.BUN]: ['add', '-d'],
169
- [PackageManager.NPM]: ['i', '-D'],
170
- };
171
- /**
172
- * Flags added only to the install we RUN, never to the one we print.
173
- *
174
- * The install is a child process whose output lands above ours. Measured on a real install: the run
175
- * opened with "added 602 packages", a funding notice, and "14 vulnerabilities (7 moderate, 7 high)"
176
- * with `npm audit fix` advice, before one line of Reticle output. A user's first impression of a
177
- * verification tool was a wall of somebody else's security warnings, at exactly the moment they are
178
- * deciding whether this tool is careful — and that audit summary describes their existing dependency
179
- * tree, which our two dev packages neither caused nor can fix.
180
- *
181
- * Kept off `installCommand`, which is the string shown in the plan and the one a user copies when
182
- * running it by hand: nobody should be taught to type our noise-suppression flags.
183
- *
184
- * Quieted, never silenced — the exit code and stderr are untouched, so a real failure of the step
185
- * everything downstream depends on stays as loud as it was.
186
- *
187
- * npm only: pnpm, yarn and bun reject these, and an unknown flag would turn a working install into a
188
- * hard failure, which is the opposite of the problem being fixed.
189
- */
190
- const QUIET_INSTALL_ARGS = {
191
- [PackageManager.NPM]: ['--no-audit', '--no-fund'],
192
- };
193
- /** Build a dev-dependency install command for one or more packages (e.g. the kit + its build plugin). */
194
- export function installCommandParts(pm, pkgs) {
195
- const list = 'string' === typeof pkgs ? [pkgs] : pkgs;
196
- return { command: pm, args: [...INSTALL_ARGS[pm], ...list, ...(QUIET_INSTALL_ARGS[pm] ?? [])] };
197
- }
198
- /**
199
- * The install command as a human reads it — and deliberately NOT `installCommandParts` joined.
200
- *
201
- * This string is what the plan prints and what a user retypes when running the step by hand, so it
202
- * must not carry the flags we add only to quieten our own child process. Built from `INSTALL_ARGS`
203
- * directly for that reason; routing it through the parts would put `--no-audit --no-fund` in front of
204
- * every reader and teach them our noise-suppression as if it were part of installing Reticle.
205
- */
206
- export function installCommand(pm, pkgs) {
207
- const list = 'string' === typeof pkgs ? [pkgs] : pkgs;
208
- return `${pm} ${[...INSTALL_ARGS[pm], ...list].join(' ')}`;
209
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * Which command starts this project, and should we start it ourselves?
3
- *
4
- * `init` finishes by telling the human to start or restart their dev server, in a closing
5
- * paragraph, in a terminal that is about to be cleared by the client restart it also asks for.
6
- * That is the second unmarked hand-off in the install, after the capabilities file, and it lands
7
- * on the same surface: prose nobody re-reads.
8
- *
9
- * Every fact needed to remove it is already in the project. `package.json` names the script; the
10
- * framework tells us the conventional port; a probe tells us whether something already answers
11
- * there. Nothing here needs a human.
12
- *
13
- * Kept as a PURE decision, separate from spawning, because the interesting part is the judgement —
14
- * which script, and whether to touch anything at all — and that is what wants testing. Spawning a
15
- * process is not.
16
- */
17
- /** Script names a JS project uses to run itself, in the order we would pick them. */
18
- export declare const DEV_SCRIPT_NAMES: readonly ["dev", "start", "serve"];
19
- export declare const DevScriptChoice: {
20
- /** Something already answers on the port. Use it; never replace a server the user is running. */
21
- readonly ALREADY_SERVING: "already-serving";
22
- /** We know the command and nothing is listening. Start it. */
23
- readonly START: "start";
24
- /** No script we recognise. Say so rather than guess a command. */
25
- readonly NO_SCRIPT: "no-script";
26
- };
27
- export type DevScriptChoice = (typeof DevScriptChoice)[keyof typeof DevScriptChoice];
28
- export interface DevScriptPlan {
29
- choice: DevScriptChoice;
30
- /** The npm script name, when there is one. */
31
- script?: string;
32
- /** What a human would type, for the line we print. */
33
- command?: string;
34
- }
35
- /**
36
- * Pick the script and decide whether to run it.
37
- *
38
- * `serving` is the probe result, passed in rather than measured here so the decision stays pure.
39
- * When something is already answering we do not care which script exists: the rule is never to
40
- * start a second server, because the one that is running may be the user's, with their state in it.
41
- */
42
- export declare function planDevScript(scripts: Readonly<Record<string, string>>, packageManager: string, serving: boolean): DevScriptPlan;
43
- /**
44
- * The command to print for this project, straight from its `package.json`.
45
- *
46
- * Lives here rather than in `run.ts` because it is the same judgement as `planDevScript` with the
47
- * parsing attached, and `run.ts` is at its cohesion limit. Returns undefined for anything it cannot
48
- * read: this phrasing decides nothing, so it must never be able to break an install.
49
- */
50
- export declare function devCommandFrom(pkg: unknown, packageManager: string): string | undefined;
@@ -1,66 +0,0 @@
1
- /**
2
- * Which command starts this project, and should we start it ourselves?
3
- *
4
- * `init` finishes by telling the human to start or restart their dev server, in a closing
5
- * paragraph, in a terminal that is about to be cleared by the client restart it also asks for.
6
- * That is the second unmarked hand-off in the install, after the capabilities file, and it lands
7
- * on the same surface: prose nobody re-reads.
8
- *
9
- * Every fact needed to remove it is already in the project. `package.json` names the script; the
10
- * framework tells us the conventional port; a probe tells us whether something already answers
11
- * there. Nothing here needs a human.
12
- *
13
- * Kept as a PURE decision, separate from spawning, because the interesting part is the judgement —
14
- * which script, and whether to touch anything at all — and that is what wants testing. Spawning a
15
- * process is not.
16
- */
17
- /** Script names a JS project uses to run itself, in the order we would pick them. */
18
- export const DEV_SCRIPT_NAMES = ['dev', 'start', 'serve'];
19
- const CANDIDATES = DEV_SCRIPT_NAMES;
20
- export const DevScriptChoice = {
21
- /** Something already answers on the port. Use it; never replace a server the user is running. */
22
- ALREADY_SERVING: 'already-serving',
23
- /** We know the command and nothing is listening. Start it. */
24
- START: 'start',
25
- /** No script we recognise. Say so rather than guess a command. */
26
- NO_SCRIPT: 'no-script',
27
- };
28
- /**
29
- * Pick the script and decide whether to run it.
30
- *
31
- * `serving` is the probe result, passed in rather than measured here so the decision stays pure.
32
- * When something is already answering we do not care which script exists: the rule is never to
33
- * start a second server, because the one that is running may be the user's, with their state in it.
34
- */
35
- export function planDevScript(scripts, packageManager, serving) {
36
- if (serving)
37
- return { choice: DevScriptChoice.ALREADY_SERVING };
38
- const name = CANDIDATES.find((c) => 'string' === typeof scripts[c] && scripts[c] !== '');
39
- if (name === undefined)
40
- return { choice: DevScriptChoice.NO_SCRIPT };
41
- // `npm` needs `run`; the others take the script name directly. Getting this wrong prints a
42
- // command that fails, which is worse than printing nothing.
43
- const command = 'npm' === packageManager ? `npm run ${name}` : `${packageManager} ${name}`;
44
- return { choice: DevScriptChoice.START, script: name, command };
45
- }
46
- /**
47
- * The command to print for this project, straight from its `package.json`.
48
- *
49
- * Lives here rather than in `run.ts` because it is the same judgement as `planDevScript` with the
50
- * parsing attached, and `run.ts` is at its cohesion limit. Returns undefined for anything it cannot
51
- * read: this phrasing decides nothing, so it must never be able to break an install.
52
- */
53
- export function devCommandFrom(pkg, packageManager) {
54
- try {
55
- // Takes the PARSED manifest. It used to take the raw string and parse it a fourth time — the
56
- // caller now reads the file once, through a guard, so there is one place a malformed manifest
57
- // can be noticed and it is not this one.
58
- const scripts = 'object' === typeof pkg && null !== pkg
59
- ? (pkg.scripts ?? {})
60
- : {};
61
- return planDevScript(scripts, packageManager, false).command;
62
- }
63
- catch {
64
- return undefined;
65
- }
66
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Format a file `init` is about to write, using the project's own Prettier when it is installed.
3
- *
4
- * Reported from the field (#684): a clean CRA install failed the project's own lint because
5
- * `src/reticle-dev.ts` was emitted as one long line. The project already had Prettier; init never
6
- * asked it. Best-effort: resolve Prettier from the app (not from ours — we do not ship it), apply
7
- * its config, and on any failure return the original content so init never fails because of a
8
- * formatter. Sync only — `applyEffects` is sync, and Prettier 3's async `format` cannot join here.
9
- */
10
- /** True when this write is a connect/dev module lint will treat as project source. */
11
- export declare function isGeneratedSourcePath(relPath: string): boolean;
12
- /**
13
- * Format `content` for `relPath` under `projectRoot`, or return it unchanged.
14
- *
15
- * Only the sync Prettier API is used. Prettier 3's async `format` is skipped (returns the original)
16
- * rather than holding init open on a promise `applyEffects` cannot await.
17
- */
18
- export declare function formatGeneratedSource(content: string, relPath: string, projectRoot: string): string;