@raybase/cli 0.0.1 → 0.3.3

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 (321) hide show
  1. package/LICENSE +21 -0
  2. package/dist/admin-assets.d.ts +22 -0
  3. package/dist/admin-assets.d.ts.map +1 -0
  4. package/dist/admin-assets.js +285 -0
  5. package/dist/admin-assets.js.map +1 -0
  6. package/dist/agent-remote-mcp-cli.d.ts +71 -0
  7. package/dist/agent-remote-mcp-cli.d.ts.map +1 -0
  8. package/dist/agent-remote-mcp-cli.js +466 -0
  9. package/dist/agent-remote-mcp-cli.js.map +1 -0
  10. package/dist/agent-skills-cli.d.ts +4 -0
  11. package/dist/agent-skills-cli.d.ts.map +1 -0
  12. package/dist/agent-skills-cli.js +144 -0
  13. package/dist/agent-skills-cli.js.map +1 -0
  14. package/dist/agent.d.ts +169 -0
  15. package/dist/agent.d.ts.map +1 -0
  16. package/dist/agent.js +531 -0
  17. package/dist/agent.js.map +1 -0
  18. package/dist/app-manifest.d.ts +41 -0
  19. package/dist/app-manifest.d.ts.map +1 -0
  20. package/dist/app-manifest.js +294 -0
  21. package/dist/app-manifest.js.map +1 -0
  22. package/dist/dev-cron-backstop.d.ts +53 -0
  23. package/dist/dev-cron-backstop.d.ts.map +1 -0
  24. package/dist/dev-cron-backstop.js +364 -0
  25. package/dist/dev-cron-backstop.js.map +1 -0
  26. package/dist/dev-do-watchdog.d.ts +37 -0
  27. package/dist/dev-do-watchdog.d.ts.map +1 -0
  28. package/dist/dev-do-watchdog.js +75 -0
  29. package/dist/dev-do-watchdog.js.map +1 -0
  30. package/dist/dev-inference-tape.d.ts +35 -0
  31. package/dist/dev-inference-tape.d.ts.map +1 -0
  32. package/dist/dev-inference-tape.js +502 -0
  33. package/dist/dev-inference-tape.js.map +1 -0
  34. package/dist/dev-ports.d.ts +25 -0
  35. package/dist/dev-ports.d.ts.map +1 -0
  36. package/dist/dev-ports.js +84 -0
  37. package/dist/dev-ports.js.map +1 -0
  38. package/dist/dev-project-lock.d.ts +24 -0
  39. package/dist/dev-project-lock.d.ts.map +1 -0
  40. package/dist/dev-project-lock.js +307 -0
  41. package/dist/dev-project-lock.js.map +1 -0
  42. package/dist/env-files.d.ts +10 -0
  43. package/dist/env-files.d.ts.map +1 -0
  44. package/dist/env-files.js +108 -0
  45. package/dist/env-files.js.map +1 -0
  46. package/dist/external-json.d.ts +3 -0
  47. package/dist/external-json.d.ts.map +1 -0
  48. package/dist/external-json.js +21 -0
  49. package/dist/external-json.js.map +1 -0
  50. package/dist/frameworks.d.ts +67 -0
  51. package/dist/frameworks.d.ts.map +1 -0
  52. package/dist/frameworks.js +210 -0
  53. package/dist/frameworks.js.map +1 -0
  54. package/dist/guide-corpus-doctor.d.ts +24 -0
  55. package/dist/guide-corpus-doctor.d.ts.map +1 -0
  56. package/dist/guide-corpus-doctor.js +111 -0
  57. package/dist/guide-corpus-doctor.js.map +1 -0
  58. package/dist/hosting.d.ts +85 -0
  59. package/dist/hosting.d.ts.map +1 -0
  60. package/dist/hosting.js +136 -0
  61. package/dist/hosting.js.map +1 -0
  62. package/dist/index.d.ts +253 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +11475 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/kit-doctor.d.ts +19 -0
  67. package/dist/kit-doctor.d.ts.map +1 -0
  68. package/dist/kit-doctor.js +255 -0
  69. package/dist/kit-doctor.js.map +1 -0
  70. package/dist/kit-install.d.ts +67 -0
  71. package/dist/kit-install.d.ts.map +1 -0
  72. package/dist/kit-install.js +409 -0
  73. package/dist/kit-install.js.map +1 -0
  74. package/dist/kit-manifest.d.ts +154 -0
  75. package/dist/kit-manifest.d.ts.map +1 -0
  76. package/dist/kit-manifest.js +252 -0
  77. package/dist/kit-manifest.js.map +1 -0
  78. package/dist/kit-registry.d.ts +42 -0
  79. package/dist/kit-registry.d.ts.map +1 -0
  80. package/dist/kit-registry.js +231 -0
  81. package/dist/kit-registry.js.map +1 -0
  82. package/dist/kit-spec.d.ts +37 -0
  83. package/dist/kit-spec.d.ts.map +1 -0
  84. package/dist/kit-spec.js +48 -0
  85. package/dist/kit-spec.js.map +1 -0
  86. package/dist/kit-state.d.ts +57 -0
  87. package/dist/kit-state.d.ts.map +1 -0
  88. package/dist/kit-state.js +31 -0
  89. package/dist/kit-state.js.map +1 -0
  90. package/dist/kits.d.ts +82 -0
  91. package/dist/kits.d.ts.map +1 -0
  92. package/dist/kits.js +255 -0
  93. package/dist/kits.js.map +1 -0
  94. package/dist/license-keys.d.ts +3 -0
  95. package/dist/license-keys.d.ts.map +1 -0
  96. package/dist/license-keys.js +10 -0
  97. package/dist/license-keys.js.map +1 -0
  98. package/dist/licensing.d.ts +269 -0
  99. package/dist/licensing.d.ts.map +1 -0
  100. package/dist/licensing.js +474 -0
  101. package/dist/licensing.js.map +1 -0
  102. package/dist/local-codex-relay.d.ts +19 -0
  103. package/dist/local-codex-relay.d.ts.map +1 -0
  104. package/dist/local-codex-relay.js +203 -0
  105. package/dist/local-codex-relay.js.map +1 -0
  106. package/dist/module-doctor.d.ts +35 -0
  107. package/dist/module-doctor.d.ts.map +1 -0
  108. package/dist/module-doctor.js +966 -0
  109. package/dist/module-doctor.js.map +1 -0
  110. package/dist/module-install.d.ts +71 -0
  111. package/dist/module-install.d.ts.map +1 -0
  112. package/dist/module-install.js +1133 -0
  113. package/dist/module-install.js.map +1 -0
  114. package/dist/module-manifest.d.ts +33 -0
  115. package/dist/module-manifest.d.ts.map +1 -0
  116. package/dist/module-manifest.js +301 -0
  117. package/dist/module-manifest.js.map +1 -0
  118. package/dist/module-state.d.ts +76 -0
  119. package/dist/module-state.d.ts.map +1 -0
  120. package/dist/module-state.js +162 -0
  121. package/dist/module-state.js.map +1 -0
  122. package/dist/modules.d.ts +52 -0
  123. package/dist/modules.d.ts.map +1 -0
  124. package/dist/modules.js +110 -0
  125. package/dist/modules.js.map +1 -0
  126. package/dist/palette-check.d.ts +42 -0
  127. package/dist/palette-check.d.ts.map +1 -0
  128. package/dist/palette-check.js +217 -0
  129. package/dist/palette-check.js.map +1 -0
  130. package/dist/palette-compile.d.ts +30 -0
  131. package/dist/palette-compile.d.ts.map +1 -0
  132. package/dist/palette-compile.js +149 -0
  133. package/dist/palette-compile.js.map +1 -0
  134. package/dist/pm.d.ts +11 -0
  135. package/dist/pm.d.ts.map +1 -0
  136. package/dist/pm.js +30 -0
  137. package/dist/pm.js.map +1 -0
  138. package/dist/project-local-codex-relay.d.ts +11 -0
  139. package/dist/project-local-codex-relay.d.ts.map +1 -0
  140. package/dist/project-local-codex-relay.js +95 -0
  141. package/dist/project-local-codex-relay.js.map +1 -0
  142. package/dist/shared.d.ts +4 -0
  143. package/dist/shared.d.ts.map +1 -0
  144. package/dist/shared.js +38 -0
  145. package/dist/shared.js.map +1 -0
  146. package/dist/shell-match.d.ts +29 -0
  147. package/dist/shell-match.d.ts.map +1 -0
  148. package/dist/shell-match.js +160 -0
  149. package/dist/shell-match.js.map +1 -0
  150. package/dist/template-doctor.d.ts +40 -0
  151. package/dist/template-doctor.d.ts.map +1 -0
  152. package/dist/template-doctor.js +722 -0
  153. package/dist/template-doctor.js.map +1 -0
  154. package/dist/template-install.d.ts +135 -0
  155. package/dist/template-install.d.ts.map +1 -0
  156. package/dist/template-install.js +1311 -0
  157. package/dist/template-install.js.map +1 -0
  158. package/dist/template-manifest.d.ts +328 -0
  159. package/dist/template-manifest.d.ts.map +1 -0
  160. package/dist/template-manifest.js +533 -0
  161. package/dist/template-manifest.js.map +1 -0
  162. package/dist/template-registry.d.ts +76 -0
  163. package/dist/template-registry.d.ts.map +1 -0
  164. package/dist/template-registry.js +365 -0
  165. package/dist/template-registry.js.map +1 -0
  166. package/dist/template-spec.d.ts +24 -0
  167. package/dist/template-spec.d.ts.map +1 -0
  168. package/dist/template-spec.js +38 -0
  169. package/dist/template-spec.js.map +1 -0
  170. package/dist/template-state.d.ts +108 -0
  171. package/dist/template-state.d.ts.map +1 -0
  172. package/dist/template-state.js +93 -0
  173. package/dist/template-state.js.map +1 -0
  174. package/dist/templates.d.ts +123 -0
  175. package/dist/templates.d.ts.map +1 -0
  176. package/dist/templates.js +541 -0
  177. package/dist/templates.js.map +1 -0
  178. package/dist/theme-match.d.ts +41 -0
  179. package/dist/theme-match.d.ts.map +1 -0
  180. package/dist/theme-match.js +92 -0
  181. package/dist/theme-match.js.map +1 -0
  182. package/dist/wrangler-secrets.d.ts +15 -0
  183. package/dist/wrangler-secrets.d.ts.map +1 -0
  184. package/dist/wrangler-secrets.js +97 -0
  185. package/dist/wrangler-secrets.js.map +1 -0
  186. package/kits/datasheet-grid/file-manifest.json +65 -0
  187. package/kits/datasheet-grid/files/AGENTS.md +6 -0
  188. package/kits/datasheet-grid/files/docs/datasheet-grid.md +15 -0
  189. package/kits/datasheet-grid/files/files/src/kits/datasheet-grid/DatasheetGridRoute.tsx +35 -0
  190. package/kits/datasheet-grid/files/files/src/kits/datasheet-grid/README.md +10 -0
  191. package/kits/datasheet-grid/files/files/src/kits/datasheet-grid/grid-adapter.ts +30 -0
  192. package/kits/datasheet-grid/files/files/src/kits/datasheet-grid/grid-metadata.ts +19 -0
  193. package/kits/datasheet-grid/files/files/src/kits/datasheet-grid/grid-state.ts +24 -0
  194. package/kits/datasheet-grid/files/kit.json +119 -0
  195. package/kits/datasheet-grid/files/skills/datasheet-grid/SKILL.md +16 -0
  196. package/kits/datasheet-grid/files/tests/datasheet-grid.test.ts +15 -0
  197. package/kits/datasheet-grid/kit.json +146 -0
  198. package/kits/index.json +71 -0
  199. package/kits/resend-email/file-manifest.json +47 -0
  200. package/kits/resend-email/files/AGENTS.md +7 -0
  201. package/kits/resend-email/files/docs/resend-email.md +13 -0
  202. package/kits/resend-email/files/files/src/kits/resend-email/README.md +17 -0
  203. package/kits/resend-email/files/files/src/kits/resend-email/send-email.ts +44 -0
  204. package/kits/resend-email/files/kit.json +128 -0
  205. package/kits/resend-email/files/skills/resend-email/SKILL.md +20 -0
  206. package/kits/resend-email/files/tests/resend-email.test.ts +54 -0
  207. package/kits/resend-email/kit.json +159 -0
  208. package/modules/docs/templates/astro-emdash/content/docs/getting-started.mdx +13 -0
  209. package/modules/docs/templates/astro-emdash/content/docs/index.mdx +13 -0
  210. package/modules/docs/templates/astro-emdash/content/docs/mcp.mdx +11 -0
  211. package/modules/docs/templates/astro-emdash/content/docs/meta.json +4 -0
  212. package/modules/docs/templates/astro-emdash/site/content/docs/getting-started.mdx +12 -0
  213. package/modules/docs/templates/astro-emdash/site/content/docs/index.mdx +12 -0
  214. package/modules/docs/templates/astro-emdash/site/content/docs/mcp.mdx +10 -0
  215. package/modules/docs/templates/astro-emdash/site/content/docs/meta.json +4 -0
  216. package/modules/docs/templates/astro-emdash/site/source.config.ts +10 -0
  217. package/modules/docs/templates/astro-emdash/site/src/docs/docs-assets.ts +1 -0
  218. package/modules/docs/templates/astro-emdash/site/src/docs/docs-client.tsx +22 -0
  219. package/modules/docs/templates/astro-emdash/site/src/docs/docs-data.ts +24 -0
  220. package/modules/docs/templates/astro-emdash/site/src/docs/docs-handler.tsx +105 -0
  221. package/modules/docs/templates/astro-emdash/site/src/docs/docs-layout.tsx +56 -0
  222. package/modules/docs/templates/astro-emdash/site/src/docs/docs-mdx.tsx +79 -0
  223. package/modules/docs/templates/astro-emdash/site/src/docs/docs-page-actions.tsx +146 -0
  224. package/modules/docs/templates/astro-emdash/site/src/docs/docs-page.tsx +70 -0
  225. package/modules/docs/templates/astro-emdash/site/src/docs/llm-text.ts +61 -0
  226. package/modules/docs/templates/astro-emdash/site/src/docs/source.ts +7 -0
  227. package/modules/docs/templates/astro-emdash/site/src/pages/docs/[...slug].ts +6 -0
  228. package/modules/docs/templates/astro-emdash/site/src/pages/docs/api/markdown.ts +4 -0
  229. package/modules/docs/templates/astro-emdash/site/src/pages/docs/api/search.ts +4 -0
  230. package/modules/docs/templates/astro-emdash/site/src/pages/llms.txt.ts +8 -0
  231. package/modules/docs/templates/astro-emdash/site/src/styles-docs.css +3 -0
  232. package/modules/docs/templates/astro-emdash/source.config.ts +10 -0
  233. package/modules/docs/templates/astro-emdash/src/docs/docs-assets.ts +1 -0
  234. package/modules/docs/templates/astro-emdash/src/docs/docs-client.tsx +22 -0
  235. package/modules/docs/templates/astro-emdash/src/docs/docs-data.ts +24 -0
  236. package/modules/docs/templates/astro-emdash/src/docs/docs-handler.tsx +105 -0
  237. package/modules/docs/templates/astro-emdash/src/docs/docs-layout.tsx +56 -0
  238. package/modules/docs/templates/astro-emdash/src/docs/docs-mdx.tsx +79 -0
  239. package/modules/docs/templates/astro-emdash/src/docs/docs-page-actions.tsx +146 -0
  240. package/modules/docs/templates/astro-emdash/src/docs/docs-page.tsx +70 -0
  241. package/modules/docs/templates/astro-emdash/src/docs/llm-text.ts +61 -0
  242. package/modules/docs/templates/astro-emdash/src/docs/source.ts +7 -0
  243. package/modules/docs/templates/astro-emdash/src/routes/docs/$.tsx +22 -0
  244. package/modules/docs/templates/astro-emdash/src/routes/docs/api/markdown.ts +12 -0
  245. package/modules/docs/templates/astro-emdash/src/routes/docs/api/search.ts +12 -0
  246. package/modules/docs/templates/astro-emdash/src/routes/docs.index.tsx +22 -0
  247. package/modules/docs/templates/astro-emdash/src/routes/docs.tsx +22 -0
  248. package/modules/docs/templates/astro-emdash/src/styles-docs.css +3 -0
  249. package/modules/docs/templates/react-router/app/components/mdx.tsx +79 -0
  250. package/modules/docs/templates/react-router/app/lib/layout.shared.tsx +54 -0
  251. package/modules/docs/templates/react-router/app/lib/source.ts +7 -0
  252. package/modules/docs/templates/react-router/app/routes/docs.$.tsx +49 -0
  253. package/modules/docs/templates/react-router/app/routes/docs.api.search.ts +10 -0
  254. package/modules/docs/templates/react-router/app/routes/docs.tsx +13 -0
  255. package/modules/docs/templates/react-router/content/docs/getting-started.mdx +8 -0
  256. package/modules/docs/templates/react-router/content/docs/index.mdx +8 -0
  257. package/modules/docs/templates/react-router/content/docs/mcp.mdx +121 -0
  258. package/modules/docs/templates/react-router/content/docs/meta.json +4 -0
  259. package/modules/docs/templates/react-router/source.config.ts +5 -0
  260. package/modules/docs/templates/tanstack-start/content/docs/getting-started.mdx +10 -0
  261. package/modules/docs/templates/tanstack-start/content/docs/index.mdx +8 -0
  262. package/modules/docs/templates/tanstack-start/content/docs/mcp.mdx +121 -0
  263. package/modules/docs/templates/tanstack-start/content/docs/meta.json +4 -0
  264. package/modules/docs/templates/tanstack-start/source.config.ts +10 -0
  265. package/modules/docs/templates/tanstack-start/src/docs/docs-assets.ts +1 -0
  266. package/modules/docs/templates/tanstack-start/src/docs/docs-client.tsx +22 -0
  267. package/modules/docs/templates/tanstack-start/src/docs/docs-data.ts +24 -0
  268. package/modules/docs/templates/tanstack-start/src/docs/docs-handler.tsx +105 -0
  269. package/modules/docs/templates/tanstack-start/src/docs/docs-layout.tsx +56 -0
  270. package/modules/docs/templates/tanstack-start/src/docs/docs-mdx.tsx +79 -0
  271. package/modules/docs/templates/tanstack-start/src/docs/docs-page-actions.tsx +146 -0
  272. package/modules/docs/templates/tanstack-start/src/docs/docs-page.tsx +70 -0
  273. package/modules/docs/templates/tanstack-start/src/docs/llm-text.ts +61 -0
  274. package/modules/docs/templates/tanstack-start/src/docs/source.ts +7 -0
  275. package/modules/docs/templates/tanstack-start/src/routes/docs/$.tsx +22 -0
  276. package/modules/docs/templates/tanstack-start/src/routes/docs/api/markdown.ts +12 -0
  277. package/modules/docs/templates/tanstack-start/src/routes/docs/api/search.ts +12 -0
  278. package/modules/docs/templates/tanstack-start/src/routes/docs.index.tsx +22 -0
  279. package/modules/docs/templates/tanstack-start/src/routes/docs.tsx +22 -0
  280. package/modules/docs/templates/tanstack-start/src/styles-docs.css +3 -0
  281. package/modules/guide/templates/astro-emdash/content/guide/capability-map.md +17 -0
  282. package/modules/guide/templates/astro-emdash/src/components/guide-widget.tsx +41 -0
  283. package/modules/guide/templates/astro-emdash/src/guide/actions.ts +8 -0
  284. package/modules/guide/templates/astro-emdash/src/guide/config.ts +21 -0
  285. package/modules/guide/templates/astro-emdash/src/guide/corpus.gen.ts +4 -0
  286. package/modules/guide/templates/astro-emdash/src/guide/corpus.manifest.json +72 -0
  287. package/modules/guide/templates/astro-emdash/src/guide/corpus.ts +4 -0
  288. package/modules/guide/templates/astro-emdash/src/guide/resources.json +4 -0
  289. package/modules/guide/templates/react-router/app/components/guide-widget.tsx +29 -0
  290. package/modules/guide/templates/react-router/app/guide/actions.ts +3 -0
  291. package/modules/guide/templates/react-router/app/guide/config.ts +21 -0
  292. package/modules/guide/templates/react-router/app/guide/corpus.gen.ts +4 -0
  293. package/modules/guide/templates/react-router/app/guide/corpus.manifest.json +22 -0
  294. package/modules/guide/templates/react-router/app/guide/corpus.ts +4 -0
  295. package/modules/guide/templates/react-router/app/guide/resources.json +4 -0
  296. package/modules/guide/templates/react-router/content/guide/capability-map.md +13 -0
  297. package/modules/guide/templates/tanstack-start/content/guide/capability-map.md +17 -0
  298. package/modules/guide/templates/tanstack-start/src/components/guide-widget.tsx +41 -0
  299. package/modules/guide/templates/tanstack-start/src/guide/actions.ts +17 -0
  300. package/modules/guide/templates/tanstack-start/src/guide/config.ts +21 -0
  301. package/modules/guide/templates/tanstack-start/src/guide/corpus.gen.ts +4 -0
  302. package/modules/guide/templates/tanstack-start/src/guide/corpus.manifest.json +22 -0
  303. package/modules/guide/templates/tanstack-start/src/guide/corpus.ts +4 -0
  304. package/modules/guide/templates/tanstack-start/src/guide/resources.json +4 -0
  305. package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/SKILL.md +57 -0
  306. package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/references/compatibility-and-testing.md +129 -0
  307. package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/references/module-contract.md +133 -0
  308. package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/references/structured-outputs.md +159 -0
  309. package/modules/openai-subscription/templates/astro-emdash/src/openai-subscription.ts +11 -0
  310. package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/SKILL.md +57 -0
  311. package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/references/compatibility-and-testing.md +129 -0
  312. package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/references/module-contract.md +133 -0
  313. package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/references/structured-outputs.md +159 -0
  314. package/modules/openai-subscription/templates/react-router/app/openai-subscription.ts +11 -0
  315. package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/SKILL.md +57 -0
  316. package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/references/compatibility-and-testing.md +129 -0
  317. package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/references/module-contract.md +133 -0
  318. package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/references/structured-outputs.md +159 -0
  319. package/modules/openai-subscription/templates/tanstack-start/src/openai-subscription.ts +11 -0
  320. package/package.json +34 -8
  321. package/README.md +0 -3
@@ -0,0 +1,966 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { parse } from "jsonc-parser";
5
+ import { readRaybaseAppManifest, raybaseAppManifestFile } from "./app-manifest.js";
6
+ import { sha256File } from "./kit-manifest.js";
7
+ import { guideDocsSurfaceCorpusIssue, inspectGuideCorpus } from "./guide-corpus-doctor.js";
8
+ import { localCodexRelaySecretEnv, localCodexRelayUrlEnv } from "./local-codex-relay.js";
9
+ import { moduleFileMode, packageAllDependencies, packageModuleDeclaration, packageProductionDependencies, readModuleLock, readModulePackageJson, resolveFirstPartyModuleState } from "./module-state.js";
10
+ import { missingWranglerRequiredSecretDeclarations, wranglerEnvironmentRequiredSecretsScope, wranglerRequiredSecretsScopes } from "./wrangler-secrets.js";
11
+ export function doctorModules(projectRoot, options) {
12
+ const issues = [];
13
+ const state = readModuleStateForDoctor(projectRoot);
14
+ if (state.error) {
15
+ const errorSource = state.errorSource ?? "module-declaration";
16
+ return {
17
+ ok: false,
18
+ issues: [{ level: "error", check: errorSource, message: state.error, fix: errorSource === "module-lock" ? "Repair .raybase/modules.json or restore it from app git history." : "Repair package.json raybase.modules and rerun doctor." }],
19
+ modules: []
20
+ };
21
+ }
22
+ for (const installed of Object.values(state.lock?.modules ?? {})) {
23
+ if (!installed.enabled)
24
+ continue;
25
+ for (const file of installed.files) {
26
+ if (moduleFileMode(installed, file) !== "copy")
27
+ continue;
28
+ const target = join(projectRoot, file.path);
29
+ if (!existsSync(target)) {
30
+ issues.push({
31
+ level: "warning",
32
+ check: "module-file",
33
+ message: `${file.path} installed by ${installed.id} is missing.`,
34
+ fix: `Restore ${file.path} or run raybase modules update ${installed.id} --dry-run.`
35
+ });
36
+ }
37
+ else if (sha256File(target) !== file.installedSha256) {
38
+ issues.push({
39
+ level: "warning",
40
+ check: "module-drift",
41
+ message: `${file.path} has local edits since ${installed.id} was installed.`,
42
+ fix: `Review local changes before running raybase modules update ${installed.id}.`
43
+ });
44
+ }
45
+ }
46
+ }
47
+ const moduleStates = new Map();
48
+ for (const id of ["docs", "guide", "api", "openai-subscription"]) {
49
+ try {
50
+ moduleStates.set(id, resolveFirstPartyModuleState(projectRoot, id, { lock: state.lock, packageJson: state.packageJson }));
51
+ }
52
+ catch (error) {
53
+ issues.push({
54
+ level: "error",
55
+ check: "module-declaration",
56
+ message: error instanceof Error ? error.message : String(error),
57
+ fix: `Repair package.json raybase.modules[${JSON.stringify(id)}] so it matches the installed or runtime module contract.`
58
+ });
59
+ }
60
+ }
61
+ const docsEnabled = moduleStates.get("docs")?.enabled === true;
62
+ const guideEnabled = moduleStates.get("guide")?.enabled === true;
63
+ const apiEnabled = moduleStates.get("api")?.enabled === true;
64
+ const openaiSubscription = moduleStates.get("openai-subscription");
65
+ issues.push(...docsDoctor(projectRoot, options.profile, docsEnabled, options.summary ?? null));
66
+ if (guideEnabled) {
67
+ issues.push(...guideDoctor(projectRoot, options.summary ?? null, options.profile, docsEnabled, options.appManifest, Boolean(options.suppressAppManifestIssue)));
68
+ }
69
+ if (apiEnabled)
70
+ issues.push(...apiDoctor(projectRoot, options.summary ?? null, options.profile));
71
+ if (openaiSubscription?.enabled) {
72
+ issues.push(...(openaiSubscription.integration === "runtime"
73
+ ? openaiSubscriptionRuntimeDoctor(projectRoot, state.packageJson, openaiSubscription)
74
+ : openaiSubscriptionInstalledDoctor(projectRoot, options.profile, options.summary ?? null, options.appManifest)));
75
+ }
76
+ else if (openaiSubscription &&
77
+ !openaiSubscription.declared &&
78
+ !openaiSubscription.exactInstallLock &&
79
+ packageProductionDependencies(state.packageJson)["@raybase/openai-subscription"]) {
80
+ issues.push({
81
+ level: "warning",
82
+ check: "openai-subscription-declaration",
83
+ message: '@raybase/openai-subscription is a direct dependency but has no module declaration, so the dev Codex relay will not start.',
84
+ fix: 'Declare raybase.modules["openai-subscription"] with { "enabled": true, "package": "@raybase/openai-subscription", "integration": "runtime" }, or run raybase modules add openai-subscription for the installed flavor.'
85
+ });
86
+ }
87
+ return {
88
+ ok: !issues.some((issue) => issue.level === "error"),
89
+ issues,
90
+ modules: ["docs", "guide", "api", "openai-subscription"].filter((id) => moduleStates.get(id)?.enabled === true)
91
+ };
92
+ }
93
+ const OPENAI_SUBSCRIPTION_PROVIDER = "openai-codex-subscription";
94
+ const OPENAI_SUBSCRIPTION_SECRET = "RAYBASE_OPENAI_SUBSCRIPTION_KEY";
95
+ const OPENAI_SUBSCRIPTION_EGRESS_BINDING = "CODEX_EGRESS";
96
+ const OPENAI_SUBSCRIPTION_USAGE_SCOPE = "Confirm that the selected credential scope matches the permitted use of the linked ChatGPT/Codex plan. Personal plans should not be pooled across unrelated users or tenants. For teams, use individually linked accounts or an appropriate Business, Enterprise, or API arrangement. Raybase informs but does not certify or enforce compliance.";
97
+ function openaiSubscriptionInstalledDoctor(cwd, profile, summary, appManifest) {
98
+ const issues = [];
99
+ const configFile = profile.kind === "react-router" ? "app/openai-subscription.ts" : "src/openai-subscription.ts";
100
+ const configPath = join(cwd, configFile);
101
+ const source = existsSync(configPath) ? readFileSync(configPath, "utf8") : "";
102
+ const appConfigFile = profile.kind === "react-router" ? "app/db/schema.ts" : "src/raybase.config.ts";
103
+ const appConfigPath = join(cwd, appConfigFile);
104
+ const appConfigSource = existsSync(appConfigPath) ? readFileSync(appConfigPath, "utf8") : "";
105
+ const providerSelected = summary
106
+ ? summary.config.ai?.enabled === true && summary.config.ai.provider === OPENAI_SUBSCRIPTION_PROVIDER
107
+ : /ai\s*:\s*\{[\s\S]*?enabled\s*:\s*true[\s\S]*?provider\s*:\s*"openai-codex-subscription"/.test(appConfigSource);
108
+ if (!providerSelected) {
109
+ issues.push({
110
+ level: "error",
111
+ check: "openai-subscription-provider",
112
+ message: `appConfig.ai.provider must select ${OPENAI_SUBSCRIPTION_PROVIDER} while the module is enabled.`,
113
+ fix: `Set appConfig.ai to { enabled: true, provider: "${OPENAI_SUBSCRIPTION_PROVIDER}" }.`
114
+ });
115
+ }
116
+ if (!/credentialMode\s*:\s*"(?:operator|user|organization)"/.test(source) ||
117
+ !/background\s*:\s*\{\s*strategy\s*:\s*"(?:disabled|run-as-operator|run-as-user|organization)"/.test(source)) {
118
+ issues.push({
119
+ level: "error",
120
+ check: "openai-subscription-scope-config",
121
+ message: `${configFile} must explicitly choose a credentialMode and background strategy.`,
122
+ fix: "Restore the module config or choose one documented credential mode and its matching background strategy."
123
+ });
124
+ }
125
+ const hasLocalRelay = /strategy\s*:\s*"local-relay"/.test(source);
126
+ const hasDeployVPC = /strategy\s*:\s*"cloudflare-vpc"[\s\S]*?binding\s*:\s*"CODEX_EGRESS"/.test(source);
127
+ if (!hasLocalRelay || !hasDeployVPC) {
128
+ issues.push({
129
+ level: "error",
130
+ check: "openai-subscription-egress-config",
131
+ message: `${configFile} must select local-relay only for local development and preserve cloudflare-vpc CODEX_EGRESS for deploy targets.`,
132
+ fix: "Use the installed import.meta.env.DEV local-relay/cloudflare-vpc egress branch. An unconditional local-relay strategy cannot be deployed."
133
+ });
134
+ }
135
+ const wrangler = wranglerConfig(cwd).parsed;
136
+ const productionEgress = openaiSubscriptionEgressStatus(wrangler);
137
+ if (!productionEgress.configured) {
138
+ issues.push({
139
+ level: "error",
140
+ check: "openai-subscription-egress-binding",
141
+ message: `wrangler.jsonc is missing the required production ${OPENAI_SUBSCRIPTION_EGRESS_BINDING} cf1:network VPC binding.`,
142
+ fix: `Add { "binding": "${OPENAI_SUBSCRIPTION_EGRESS_BINDING}", "network_id": "cf1:network", "remote": true } to the top-level vpc_networks array.`
143
+ });
144
+ }
145
+ if (!hasLocalSecretDeclaration(cwd, OPENAI_SUBSCRIPTION_SECRET) && !process.env[OPENAI_SUBSCRIPTION_SECRET]) {
146
+ issues.push({
147
+ level: "error",
148
+ check: "openai-subscription-secret",
149
+ message: `${OPENAI_SUBSCRIPTION_SECRET} is not configured for local doctor checks.`,
150
+ fix: `Add ${OPENAI_SUBSCRIPTION_SECRET} to .dev.vars for local development and configure the deployed value as a Worker secret.`
151
+ });
152
+ }
153
+ if (appManifest?.ok) {
154
+ const selected = appManifest.manifest.ai?.selectedProvider;
155
+ const provider = appManifest.manifest.ai?.inferenceProviders?.find((candidate) => candidate.id === OPENAI_SUBSCRIPTION_PROVIDER);
156
+ if (selected !== OPENAI_SUBSCRIPTION_PROVIDER || !provider?.capabilities?.chat || !provider.capabilities.stream || provider.capabilities.embed) {
157
+ issues.push({
158
+ level: "error",
159
+ check: "openai-subscription-manifest",
160
+ message: "The generated app manifest does not expose the selected subscription provider with chat/stream-only capabilities.",
161
+ fix: "Restore the module registration in the Raybase server, regenerate the app manifest, and rerun doctor."
162
+ });
163
+ }
164
+ }
165
+ issues.push({
166
+ level: "info",
167
+ check: "openai-subscription-usage-scope",
168
+ message: OPENAI_SUBSCRIPTION_USAGE_SCOPE,
169
+ fix: ""
170
+ });
171
+ return issues;
172
+ }
173
+ function openaiSubscriptionRuntimeDoctor(cwd, packageJson, state) {
174
+ const issues = [];
175
+ const expectedPackage = "@raybase/openai-subscription";
176
+ const productionDependencies = packageProductionDependencies(packageJson);
177
+ if (state.declaration?.package !== expectedPackage || !productionDependencies[expectedPackage]) {
178
+ issues.push({
179
+ level: "error",
180
+ check: "openai-subscription-dependency",
181
+ message: `Runtime registration must name ${expectedPackage} and list it as a direct production dependency in package.json dependencies.`,
182
+ fix: `Set the module declaration package to "${expectedPackage}" and add ${expectedPackage} to dependencies, not only devDependencies.`
183
+ });
184
+ }
185
+ let wrangler = {};
186
+ try {
187
+ wrangler = wranglerConfig(cwd).parsed;
188
+ }
189
+ catch {
190
+ // The focused runtime findings below explain both missing declaration surfaces.
191
+ }
192
+ const requiredScopes = wranglerRequiredSecretsScopes(wrangler);
193
+ if (requiredScopes.length === 0) {
194
+ issues.push({
195
+ level: "error",
196
+ check: "openai-subscription-secret-declaration",
197
+ message: `${OPENAI_SUBSCRIPTION_SECRET} has no secrets.required declaration surface in wrangler.jsonc.`,
198
+ fix: `Add a secrets.required array in every applicable Wrangler scope and declare ${OPENAI_SUBSCRIPTION_SECRET}.`
199
+ });
200
+ }
201
+ else {
202
+ const missing = missingWranglerRequiredSecretDeclarations(wrangler, [OPENAI_SUBSCRIPTION_SECRET])[0];
203
+ if (missing) {
204
+ issues.push({
205
+ level: "error",
206
+ check: "openai-subscription-secret-declaration",
207
+ message: `${OPENAI_SUBSCRIPTION_SECRET} is not declared in secrets.required for ${missing.scopes.join(", ")}.`,
208
+ fix: `Add ${OPENAI_SUBSCRIPTION_SECRET} to secrets.required in ${missing.scopes.join(" and ")}.`
209
+ });
210
+ }
211
+ }
212
+ const localDevScope = wranglerEnvironmentRequiredSecretsScope(wrangler, "local-dev");
213
+ if (!localDevScope) {
214
+ issues.push({
215
+ level: "error",
216
+ check: "openai-subscription-local-relay-declaration",
217
+ message: "env.local-dev.secrets.required is missing, so the local worker cannot receive the dev Codex relay values.",
218
+ fix: `Add env.local-dev.secrets.required and declare ${localCodexRelayUrlEnv} and ${localCodexRelaySecretEnv}.`
219
+ });
220
+ }
221
+ else {
222
+ for (const name of [localCodexRelayUrlEnv, localCodexRelaySecretEnv]) {
223
+ if (localDevScope.required.includes(name))
224
+ continue;
225
+ issues.push({
226
+ level: "error",
227
+ check: "openai-subscription-local-relay-declaration",
228
+ message: `${name} is missing from env.local-dev.secrets.required.`,
229
+ fix: `Add ${name} to env.local-dev.secrets.required so raybase dev can inject the relay value into the local worker.`
230
+ });
231
+ }
232
+ }
233
+ issues.push({
234
+ level: "info",
235
+ check: "openai-subscription-usage-scope",
236
+ message: OPENAI_SUBSCRIPTION_USAGE_SCOPE,
237
+ fix: ""
238
+ });
239
+ return issues;
240
+ }
241
+ function openaiSubscriptionEgressStatus(config) {
242
+ const bindings = Array.isArray(config.vpc_networks) ? config.vpc_networks : [];
243
+ return {
244
+ configured: bindings.some((candidate) => {
245
+ if (!candidate || typeof candidate !== "object")
246
+ return false;
247
+ const binding = candidate;
248
+ return binding.binding === OPENAI_SUBSCRIPTION_EGRESS_BINDING && binding.network_id === "cf1:network" && binding.remote === true;
249
+ })
250
+ };
251
+ }
252
+ function hasLocalSecretDeclaration(cwd, name) {
253
+ const file = join(cwd, ".dev.vars");
254
+ if (!existsSync(file))
255
+ return false;
256
+ return new RegExp(`^\\s*${name}\\s*=`, "m").test(readFileSync(file, "utf8"));
257
+ }
258
+ function readModuleStateForDoctor(projectRoot) {
259
+ let lock;
260
+ try {
261
+ lock = readModuleLock(projectRoot);
262
+ }
263
+ catch (error) {
264
+ return { lock: null, packageJson: {}, error: error instanceof Error ? error.message : String(error), errorSource: "module-lock" };
265
+ }
266
+ try {
267
+ return { lock, packageJson: readModulePackageJson(projectRoot) };
268
+ }
269
+ catch (error) {
270
+ return { lock, packageJson: {}, error: error instanceof Error ? error.message : String(error), errorSource: "module-declaration" };
271
+ }
272
+ }
273
+ function docsDoctor(cwd, profile, docsEnabled, summary) {
274
+ const issues = [];
275
+ const placement = readDocsPlacement(cwd);
276
+ const docsRequiredFiles = docsRequiredFilesForPlacement(profile, placement);
277
+ const docsRouteFiles = docsRouteFilesForPlacement(profile, placement);
278
+ const allDocsRouteFiles = [...new Set([...profile.docsRouteFiles, ...docsRouteFilesForPlacement(profile, "site")])];
279
+ const presentDocsRoutes = allDocsRouteFiles.filter((file) => existsSync(join(cwd, file)));
280
+ if (!docsEnabled) {
281
+ if (presentDocsRoutes.length > 0) {
282
+ issues.push({
283
+ level: "warning",
284
+ check: "docs-disabled",
285
+ message: `Docs are disabled but docs route files are still present: ${presentDocsRoutes.join(", ")}.`,
286
+ fix: "Remove docs route files or run raybase modules add docs."
287
+ });
288
+ }
289
+ return issues;
290
+ }
291
+ for (const file of docsRequiredFiles) {
292
+ if (!existsSync(join(cwd, file))) {
293
+ issues.push({
294
+ level: "error",
295
+ check: "docs-files",
296
+ message: `${file} is missing while docs are enabled.`,
297
+ fix: "Restore the Fumadocs files with raybase modules update docs --overwrite, or remove the docs module."
298
+ });
299
+ }
300
+ }
301
+ const dependencies = declaredDependencies(cwd);
302
+ const siteDependencies = placement === "site" ? safeDeclaredDependencies(join(cwd, "site")) : {};
303
+ const dependencySource = placement === "site" ? { "@raybase/docs": dependencies["@raybase/docs"], ...siteDependencies } : dependencies;
304
+ for (const dependency of ["@raybase/docs", "fumadocs-core", "fumadocs-ui", "lucide-react", "fumadocs-mdx", "@types/mdx"]) {
305
+ if (!dependencySource[dependency]) {
306
+ issues.push({
307
+ level: "error",
308
+ check: "docs-dependencies",
309
+ message: `${dependency} is missing while docs are enabled.`,
310
+ fix: `Install ${dependency} or run raybase modules update docs --overwrite.`
311
+ });
312
+ }
313
+ }
314
+ const sourceIgnoreRoot = placement === "site" ? join(cwd, "site") : cwd;
315
+ if (!sourceIgnored(sourceIgnoreRoot)) {
316
+ issues.push({
317
+ level: "warning",
318
+ check: "docs-source-ignore",
319
+ message: ".source/ is not ignored.",
320
+ fix: "Add .source/ to .gitignore so generated Fumadocs source files are not committed."
321
+ });
322
+ }
323
+ const trackedSource = spawnSync("git", ["ls-files", placement === "site" ? "site/.source" : ".source"], { cwd, encoding: "utf8" });
324
+ if (trackedSource.status === 0 && trackedSource.stdout.trim()) {
325
+ issues.push({
326
+ level: "warning",
327
+ check: "docs-source-ignore",
328
+ message: ".source/ contains tracked files.",
329
+ fix: `Remove ${placement === "site" ? "site/.source/" : ".source/"} from git; Fumadocs regenerates it from ${placement === "site" ? "site/content/docs" : "content/docs"}.`
330
+ });
331
+ }
332
+ // Raybase owns /api ahead of React Router, so a docs search route under
333
+ // /api/search never reaches the router.
334
+ if (profile.kind === "react-router") {
335
+ const wrongRoute = ["app/routes/api.search.ts", "app/routes/api.search.tsx", "app/routes/api/search.ts", "app/routes/api/search.tsx"].find((file) => existsSync(join(cwd, file)));
336
+ const rootSource = existsSync(join(cwd, "app/root.tsx")) ? readFileSync(join(cwd, "app/root.tsx"), "utf8") : "";
337
+ const docsSearchSource = existsSync(join(cwd, "app/routes/docs.api.search.ts")) ? readFileSync(join(cwd, "app/routes/docs.api.search.ts"), "utf8") : "";
338
+ if (wrongRoute || containsBareApiSearchRoute(rootSource) || containsBareApiSearchRoute(docsSearchSource)) {
339
+ issues.push({
340
+ level: "error",
341
+ check: "docs-search-route",
342
+ message: "Docs search is configured under /api/search, which Raybase owns ahead of React Router.",
343
+ fix: "Serve Fumadocs search from /docs/api/search."
344
+ });
345
+ }
346
+ }
347
+ if (placement === "site" && profile.docsRouteFiles.some((file) => existsSync(join(cwd, file)))) {
348
+ issues.push({
349
+ level: "error",
350
+ check: "docs-route-ownership",
351
+ message: "Docs placement is site, but spine docs route files are still present.",
352
+ fix: "Remove root src/routes/docs* and root docs UI files so public docs are served only by site/."
353
+ });
354
+ }
355
+ if (placement === "spine" && profile.kind === "astro-emdash" && docsRouteFilesForPlacement(profile, "site").some((file) => existsSync(join(cwd, file)))) {
356
+ issues.push({
357
+ level: "error",
358
+ check: "docs-route-ownership",
359
+ message: "Docs placement is spine, but site public docs route files are still present.",
360
+ fix: "Remove site/src/pages/docs* or switch the docs module placement to site in package.json and .raybase/modules.json."
361
+ });
362
+ }
363
+ if (placement === "spine")
364
+ issues.push(...docsTanstackStyleBoundaryDoctor(cwd, profile));
365
+ const docsRoot = placement === "site" ? "site/content/docs" : "content/docs";
366
+ issues.push(...docsPlaceholderWarnings(cwd, docsRoot));
367
+ issues.push(...docsMcpPageWarnings(cwd, summary, docsRoot));
368
+ issues.push(...docsUserSurfaceLeakageWarnings(cwd, docsRoot, placement));
369
+ return issues;
370
+ }
371
+ function docsTanstackStyleBoundaryDoctor(cwd, profile) {
372
+ if (profile.kind !== "tanstack-start")
373
+ return [];
374
+ const issues = [];
375
+ const root = readOptionalFile(cwd, "src/routes/__root.tsx");
376
+ const appLayout = readOptionalFile(cwd, "src/routes/_app.tsx");
377
+ const docsHandler = readOptionalFile(cwd, "src/docs/docs-handler.tsx");
378
+ const appStyles = readOptionalFile(cwd, "src/styles.css");
379
+ const docsStyles = readOptionalFile(cwd, "src/styles-docs.css");
380
+ if (/import\s+["']\.\.\/styles\.css["']/.test(root)) {
381
+ issues.push({
382
+ level: "error",
383
+ check: "docs-style-boundary",
384
+ message: "src/routes/__root.tsx imports src/styles.css, so app-owned styles apply to /docs.",
385
+ fix: "Move the src/styles.css import to src/routes/_app.tsx."
386
+ });
387
+ }
388
+ if (!/import\s+["']\.\.\/styles\.css["']/.test(appLayout)) {
389
+ issues.push({
390
+ level: "error",
391
+ check: "docs-style-boundary",
392
+ message: "src/routes/_app.tsx does not import src/styles.css.",
393
+ fix: "Import ../styles.css from the pathless app route layout."
394
+ });
395
+ }
396
+ if (!/import\s+\w+\s+from\s+["']\.\.\/styles-docs\.css\?inline["']/.test(docsHandler)) {
397
+ issues.push({
398
+ level: "error",
399
+ check: "docs-style-boundary",
400
+ message: "src/docs/docs-handler.tsx does not inline src/styles-docs.css.",
401
+ fix: "Import ../styles-docs.css?inline from the docs document handler."
402
+ });
403
+ }
404
+ if (/fumadocs-ui\/css\/(?:neutral|preset)|fumadocs-ui\/style\.css/.test(appStyles)) {
405
+ issues.push({
406
+ level: "error",
407
+ check: "docs-style-boundary",
408
+ message: "src/styles.css imports Fumadocs CSS.",
409
+ fix: "Keep Fumadocs CSS in src/styles-docs.css, not the app stylesheet."
410
+ });
411
+ }
412
+ if (/(?:\.\/|\.\.\/)themes\/|styles\.css/.test(docsStyles)) {
413
+ issues.push({
414
+ level: "error",
415
+ check: "docs-style-boundary",
416
+ message: "src/styles-docs.css imports app theme or app stylesheet files.",
417
+ fix: "Keep src/styles-docs.css limited to Tailwind and Fumadocs CSS imports."
418
+ });
419
+ }
420
+ return issues;
421
+ }
422
+ function readDocsPlacement(cwd) {
423
+ try {
424
+ const lock = readModuleLock(cwd);
425
+ const placement = lock?.modules.docs?.placement;
426
+ if (placement === "site")
427
+ return "site";
428
+ }
429
+ catch {
430
+ // package.json fallback below reports enough for doctor checks.
431
+ }
432
+ try {
433
+ const placement = packageModuleDeclaration(readModulePackageJson(cwd), "docs").declaration?.placement;
434
+ return placement === "site" ? "site" : "spine";
435
+ }
436
+ catch {
437
+ return "spine";
438
+ }
439
+ }
440
+ function docsRequiredFilesForPlacement(profile, placement) {
441
+ if (profile.kind === "astro-emdash" && placement === "site") {
442
+ return [
443
+ "site/source.config.ts",
444
+ "site/content/docs/index.mdx",
445
+ "site/content/docs/getting-started.mdx",
446
+ "site/content/docs/mcp.mdx",
447
+ "site/content/docs/meta.json",
448
+ "site/src/docs/docs-assets.ts",
449
+ "site/src/docs/docs-client.tsx",
450
+ "site/src/docs/docs-data.ts",
451
+ "site/src/docs/docs-handler.tsx",
452
+ "site/src/docs/docs-layout.tsx",
453
+ "site/src/docs/docs-mdx.tsx",
454
+ "site/src/docs/docs-page-actions.tsx",
455
+ "site/src/docs/docs-page.tsx",
456
+ "site/src/docs/llm-text.ts",
457
+ "site/src/docs/source.ts",
458
+ "site/src/pages/docs/[...slug].ts",
459
+ "site/src/pages/docs/api/markdown.ts",
460
+ "site/src/pages/docs/api/search.ts",
461
+ "site/src/pages/llms.txt.ts",
462
+ "site/src/styles-docs.css"
463
+ ];
464
+ }
465
+ return profile.docsRequiredFiles;
466
+ }
467
+ function docsRouteFilesForPlacement(profile, placement) {
468
+ if (profile.kind === "astro-emdash" && placement === "site") {
469
+ return ["site/src/pages/docs/[...slug].ts", "site/src/pages/docs/api/markdown.ts", "site/src/pages/docs/api/search.ts", "site/src/pages/llms.txt.ts"];
470
+ }
471
+ return profile.docsRouteFiles;
472
+ }
473
+ function readOptionalFile(cwd, file) {
474
+ const target = join(cwd, file);
475
+ return existsSync(target) ? readFileSync(target, "utf8") : "";
476
+ }
477
+ function apiDoctor(cwd, summary, profile) {
478
+ const issues = [];
479
+ for (const file of profile.apiRequiredFiles) {
480
+ if (!existsSync(join(cwd, file))) {
481
+ issues.push({
482
+ level: "error",
483
+ check: "api-files",
484
+ message: `${file} is missing while the API module is enabled.`,
485
+ fix: "Restore the API module files with raybase modules update api --overwrite, or remove the api module."
486
+ });
487
+ }
488
+ }
489
+ const dependencies = declaredDependencies(cwd);
490
+ if (!dependencies["@raybase/api"]) {
491
+ issues.push({
492
+ level: "error",
493
+ check: "api-dependencies",
494
+ message: "@raybase/api is missing while the API module is enabled.",
495
+ fix: "Install @raybase/api or run raybase modules update api --overwrite."
496
+ });
497
+ }
498
+ const secret = process.env.RAYBASE_API_KEY_SECRET ?? readDevVar(cwd, "RAYBASE_API_KEY_SECRET");
499
+ if (!secret || secret.length < 32) {
500
+ issues.push({
501
+ level: "error",
502
+ check: "api-key-secret",
503
+ message: "RAYBASE_API_KEY_SECRET is missing or shorter than 32 characters while the API module is enabled.",
504
+ fix: "Set RAYBASE_API_KEY_SECRET to a long random value in .dev.vars and your deployed Worker secrets."
505
+ });
506
+ }
507
+ const publicRoutes = summary?.config.auth?.publicRoutes ?? [];
508
+ for (const route of publicRoutes) {
509
+ if (route === "/api/*" || route === "/api/v1" || route === "/api/v1/*") {
510
+ issues.push({
511
+ level: "warning",
512
+ check: "api-public-route-overlap",
513
+ message: `auth.publicRoutes contains ${route}, which overlaps the default external API prefix.`,
514
+ fix: "Do not mark @raybase/api operation paths public through app auth config; the API module owns bearer-key validation itself."
515
+ });
516
+ }
517
+ }
518
+ return issues;
519
+ }
520
+ function docsPlaceholderWarnings(cwd, docsRoot = "content/docs") {
521
+ const markers = [
522
+ "Welcome to the docs",
523
+ "Start here when replacing the placeholder documentation",
524
+ "Replace this placeholder with the first workflow"
525
+ ];
526
+ const files = [`${docsRoot}/index.mdx`, `${docsRoot}/getting-started.mdx`];
527
+ const matches = files.filter((file) => {
528
+ const target = join(cwd, file);
529
+ if (!existsSync(target))
530
+ return false;
531
+ const source = readFileSync(target, "utf8");
532
+ return markers.some((marker) => source.includes(marker));
533
+ });
534
+ if (matches.length === 0)
535
+ return [];
536
+ return [
537
+ {
538
+ level: "warning",
539
+ check: "docs-placeholder-content",
540
+ message: `Docs are enabled but starter placeholder content remains in ${matches.join(", ")}.`,
541
+ fix: "Replace the starter documentation with app-specific app-user docs, or disable/remove the docs module."
542
+ }
543
+ ];
544
+ }
545
+ function docsMcpPageWarnings(cwd, summary, docsRoot = "content/docs") {
546
+ if (summary?.config.mcp?.enabled !== true)
547
+ return [];
548
+ const file = `${docsRoot}/mcp.mdx`;
549
+ const target = join(cwd, file);
550
+ if (!existsSync(target)) {
551
+ return [
552
+ {
553
+ level: "warning",
554
+ check: "docs-mcp-page",
555
+ message: `User MCP is enabled but ${file} is missing.`,
556
+ fix: `Restore ${file} from the docs template and document how users connect ChatGPT, Claude, and other MCP-capable agents.`
557
+ }
558
+ ];
559
+ }
560
+ const source = readFileSync(target, "utf8");
561
+ if (!source.includes("Replace this section before shipping the app"))
562
+ return [];
563
+ return [
564
+ {
565
+ level: "warning",
566
+ check: "docs-mcp-page",
567
+ message: `${file} still has starter MCP placeholder content.`,
568
+ fix: "Replace the placeholder server URL and tool-scope bullets with this app's deployed MCP URL and available read/write tool scope."
569
+ }
570
+ ];
571
+ }
572
+ function readGuideModuleConfig(cwd, profile) {
573
+ const file = join(cwd, profile.kind === "react-router" ? "app/guide/config.ts" : "src/guide/config.ts");
574
+ if (!existsSync(file))
575
+ return null;
576
+ const source = readFileSync(file, "utf8");
577
+ const surface = (name) => {
578
+ const match = source.match(new RegExp(`${name}:\\s*\\{([\\s\\S]*?)\\}`));
579
+ const body = match?.[1] ?? "";
580
+ return {
581
+ enabled: /enabled:\s*true/.test(body) ? true : /enabled:\s*false/.test(body) ? false : undefined,
582
+ audience: /audience:\s*["']public["']/.test(body) ? "public" : /audience:\s*["']signed-in["']/.test(body) ? "signed-in" : undefined
583
+ };
584
+ };
585
+ const limit = (name) => {
586
+ const match = source.match(new RegExp(`${name}:\\s*(\\d+)`));
587
+ return match ? Number(match[1]) : undefined;
588
+ };
589
+ return {
590
+ enabled: /enabled:\s*true/.test(source) ? true : /enabled:\s*false/.test(source) ? false : undefined,
591
+ endpoint: source.match(/endpoint:\s*["']([^"']+)["']/)?.[1],
592
+ surfaces: {
593
+ app: surface("app"),
594
+ docs: surface("docs")
595
+ },
596
+ limits: Object.fromEntries(["publicIpHourlyRequests", "publicIpHourlyOutputTokens", "publicDailyRequests", "publicDailyOutputTokens", "signedInDailyRequests", "maxCorpusSnippets"]
597
+ .map((key) => [key, limit(key)])
598
+ .filter(([, value]) => value !== undefined))
599
+ };
600
+ }
601
+ function guideDoctor(cwd, summary, profile, docsEnabled, appManifest, suppressAppManifestIssue) {
602
+ const issues = [];
603
+ const guide = readGuideModuleConfig(cwd, profile);
604
+ if (guide?.enabled === false) {
605
+ issues.push({
606
+ level: "warning",
607
+ check: "guide-config",
608
+ message: "Guide is enabled in module state but guideConfig.enabled is false.",
609
+ fix: "Keep .raybase/modules.json and guideConfig.enabled aligned."
610
+ });
611
+ }
612
+ if (summary && summary.config.ai?.enabled !== true) {
613
+ issues.push({
614
+ level: "error",
615
+ check: "guide-ai",
616
+ message: "Guide is enabled but appConfig.ai.enabled is not true.",
617
+ fix: "Run raybase ai enable before enabling Guide."
618
+ });
619
+ }
620
+ const dependencies = declaredDependencies(cwd);
621
+ for (const dependency of ["@raybase/agent-ui", "@assistant-ui/react"]) {
622
+ if (!dependencies[dependency]) {
623
+ issues.push({
624
+ level: "error",
625
+ check: "guide-agent-ui",
626
+ message: `${dependency} is missing while Guide is enabled.`,
627
+ fix: `Install ${dependency} or run raybase modules update guide --overwrite.`
628
+ });
629
+ }
630
+ }
631
+ if (existsSync(join(cwd, "wrangler.jsonc")) && !wranglerAiStatus(wranglerConfig(cwd).parsed).binding) {
632
+ issues.push({
633
+ level: "error",
634
+ check: "guide-ai-binding",
635
+ message: 'Guide is enabled but wrangler.jsonc has no "ai": { "binding": "AI" } binding.',
636
+ fix: "Run raybase guide enable or raybase ai enable."
637
+ });
638
+ }
639
+ const surfaces = {
640
+ app: { enabled: guide?.surfaces?.app?.enabled ?? true, audience: guide?.surfaces?.app?.audience ?? "signed-in" },
641
+ docs: { enabled: guide?.surfaces?.docs?.enabled ?? false, audience: guide?.surfaces?.docs?.audience ?? "signed-in" }
642
+ };
643
+ if (!surfaces.app.enabled && !surfaces.docs.enabled) {
644
+ issues.push({
645
+ level: "error",
646
+ check: "guide-surfaces",
647
+ message: "Guide is enabled but both app and docs surfaces are disabled.",
648
+ fix: "Enable guideConfig.surfaces.app, guideConfig.surfaces.docs, or disable Guide."
649
+ });
650
+ }
651
+ if (surfaces.docs.enabled) {
652
+ if (!docsEnabled) {
653
+ issues.push({
654
+ level: "error",
655
+ check: "guide-docs",
656
+ message: "Guide docs surface is enabled but docs are disabled.",
657
+ fix: "Enable docs or disable guideConfig.surfaces.docs."
658
+ });
659
+ }
660
+ const docsPlacement = readDocsPlacement(cwd);
661
+ const missingDocsFiles = docsRequiredFilesForPlacement(profile, docsPlacement).filter((file) => !existsSync(join(cwd, file)));
662
+ if (missingDocsFiles.length) {
663
+ issues.push({
664
+ level: "error",
665
+ check: "guide-docs-files",
666
+ message: `Guide docs surface is enabled but docs files are missing: ${missingDocsFiles.join(", ")}.`,
667
+ fix: "Restore the Fumadocs files or disable guideConfig.surfaces.docs."
668
+ });
669
+ }
670
+ }
671
+ for (const file of profile.guideRequiredFiles) {
672
+ if (!existsSync(join(cwd, file))) {
673
+ issues.push({
674
+ level: "error",
675
+ check: "guide-files",
676
+ message: `${file} is missing while Guide is enabled.`,
677
+ fix: "Restore the Guide files with raybase modules update guide --overwrite, or remove the guide module."
678
+ });
679
+ }
680
+ }
681
+ const serverFile = join(cwd, profile.serverFile);
682
+ const manifestResult = appManifest ?? readRaybaseAppManifest(cwd);
683
+ if (!existsSync(serverFile)) {
684
+ issues.push({
685
+ level: "error",
686
+ check: "guide-runtime",
687
+ message: `Guide is enabled but ${profile.serverFile} is missing.`,
688
+ fix: `Restore ${profile.serverFile} and register guideModule({ config: guideConfig, corpus: guideCorpus, actions: guideActions }) in createRaybaseApp.`
689
+ });
690
+ }
691
+ else if (!manifestResult.ok) {
692
+ if (!suppressAppManifestIssue) {
693
+ issues.push({
694
+ level: "warning",
695
+ check: "app-manifest",
696
+ message: manifestResult.missing
697
+ ? `${raybaseAppManifestFile} is missing, so Guide runtime wiring could not be checked.`
698
+ : `${raybaseAppManifestFile} is invalid, so Guide runtime wiring could not be checked: ${manifestResult.error}`,
699
+ fix: "Run raybase manifest write. Doctor uses this structured manifest to verify Guide runtime and action wiring."
700
+ });
701
+ }
702
+ }
703
+ else if (!manifestResult.manifest.guide?.enabled) {
704
+ issues.push({
705
+ level: "error",
706
+ check: "guide-runtime",
707
+ message: `Guide is enabled in module state but ${raybaseAppManifestFile} does not report an enabled Guide runtime.`,
708
+ fix: `Import guideModule, guideConfig, guideCorpus, and guideActions, then pass guideModule({ config: guideConfig, corpus: guideCorpus, actions: guideActions }) to createRaybaseApp.`
709
+ });
710
+ }
711
+ else if (!manifestResult.manifest.guide.hasExplicitCorpus) {
712
+ issues.push({
713
+ level: "error",
714
+ check: "guide-runtime",
715
+ message: `Guide is enabled but ${raybaseAppManifestFile} reports ${profile.serverFile} does not register guideModule with guideCorpus.`,
716
+ fix: `Import guideCorpus and guideActions, then pass guideModule({ config: guideConfig, corpus: guideCorpus, actions: guideActions }) to createRaybaseApp.`
717
+ });
718
+ }
719
+ else if ((manifestResult.manifest.actions?.names?.length ?? 0) > 0 &&
720
+ manifestResult.manifest.guide.mode !== "knowledge-only" &&
721
+ (manifestResult.manifest.guide.explicitActionNames?.length ?? 0) === 0) {
722
+ issues.push({
723
+ level: "warning",
724
+ check: "guide-actions",
725
+ message: "Guide is enabled and app actions are registered, but Guide is not passed any app-specific actions. Guide will only expose its built-in knowledge and support actions.",
726
+ fix: "Export narrow, user-safe app actions from src/guide/actions.ts or app/guide/actions.ts and pass guideActions to guideModule, or set mode: \"knowledge-only\" if Guide should deliberately avoid app actions."
727
+ });
728
+ }
729
+ if (manifestResult.ok) {
730
+ issues.push(...guideActionDiscoveryIssues(manifestResult.manifest));
731
+ }
732
+ const endpoint = normalizePath(guide?.endpoint ?? "/api/guide");
733
+ const publicRoutes = summary?.config.auth?.publicRoutes ?? [];
734
+ if (publicRoutes.includes(endpoint)) {
735
+ issues.push({
736
+ level: "warning",
737
+ check: "guide-public-route",
738
+ message: `Guide endpoint ${endpoint} is listed in auth.publicRoutes.`,
739
+ fix: "Remove the exact Guide endpoint from auth.publicRoutes. Raybase owns public Guide access internally."
740
+ });
741
+ }
742
+ const hasPublicSurface = (surfaces.app.enabled && surfaces.app.audience === "public") || (surfaces.docs.enabled && surfaces.docs.audience === "public");
743
+ if (hasPublicSurface) {
744
+ const limits = guide?.limits ?? {};
745
+ for (const key of ["publicIpHourlyRequests", "publicIpHourlyOutputTokens", "publicDailyRequests", "publicDailyOutputTokens"]) {
746
+ const value = Number(limits[key]);
747
+ if (!Number.isFinite(value) || value <= 0) {
748
+ issues.push({
749
+ level: "error",
750
+ check: "guide-public-limits",
751
+ message: `Public Guide limit ${key} must be a positive number.`,
752
+ fix: `Set guideConfig.limits.${key} to a non-zero value.`
753
+ });
754
+ }
755
+ }
756
+ }
757
+ const inspection = inspectGuideCorpus(cwd, profile);
758
+ const docsRoot = readDocsPlacement(cwd) === "site" ? "site/content/docs" : "content/docs";
759
+ if (!inspection.exists) {
760
+ issues.push({
761
+ level: hasPublicSurface ? "error" : "warning",
762
+ check: "guide-corpus",
763
+ message: `${inspection.manifestFile} is missing.`,
764
+ fix: "Run raybase guide index."
765
+ });
766
+ }
767
+ else {
768
+ if (inspection.parseError) {
769
+ issues.push({
770
+ level: "error",
771
+ check: "guide-corpus",
772
+ message: `${inspection.manifestFile} is not valid JSON: ${inspection.parseError}`,
773
+ fix: "Run raybase guide index."
774
+ });
775
+ }
776
+ else if (inspection.schemaErrors.length) {
777
+ issues.push({
778
+ level: "error",
779
+ check: "guide-corpus",
780
+ message: `${inspection.manifestFile} is invalid: ${inspection.schemaErrors[0]}`,
781
+ fix: "Run raybase guide index with the current Raybase CLI."
782
+ });
783
+ }
784
+ else if (!inspection.hasAnyDocuments) {
785
+ issues.push({
786
+ level: hasPublicSurface ? "error" : "warning",
787
+ check: "guide-corpus",
788
+ message: "Guide is enabled but the checked-in Guide corpus has no documents.",
789
+ fix: `Add app help docs in ${docsRoot} or Guide knowledge in content/guide, then run raybase guide index.`
790
+ });
791
+ }
792
+ else if (!inspection.hasAppCapabilityMap) {
793
+ issues.push({
794
+ level: "warning",
795
+ check: "guide-context",
796
+ message: "Guide is enabled but its checked-in corpus has no app capability map.",
797
+ fix: "Add content/guide/capability-map.md with guideContext: app-capability-map, then run raybase guide index."
798
+ });
799
+ }
800
+ if (hasPublicSurface && inspection.hasAnyDocuments && !inspection.hasPublicDocuments) {
801
+ issues.push({
802
+ level: "error",
803
+ check: "guide-corpus",
804
+ message: "Public Guide is enabled but the checked-in Guide corpus has no public documents.",
805
+ fix: "Mark safe docs or Guide knowledge public, then run raybase guide index."
806
+ });
807
+ }
808
+ const docsSurfaceIssue = surfaces.docs.enabled ? guideDocsSurfaceCorpusIssue(inspection, surfaces.docs.audience, docsRoot) : null;
809
+ if (docsSurfaceIssue)
810
+ issues.push(docsSurfaceIssue);
811
+ }
812
+ return issues;
813
+ }
814
+ function guideActionDiscoveryIssues(manifest) {
815
+ const guide = manifest.guide;
816
+ if (!guide?.enabled || guide.mode === "knowledge-only")
817
+ return [];
818
+ const descriptors = guideActionDescriptors(manifest);
819
+ if (!descriptors.length)
820
+ return [];
821
+ const discoveryResources = new Set(descriptors
822
+ .filter(isGuideDiscoveryAction)
823
+ .map((descriptor) => descriptor.resource?.name)
824
+ .filter((resource) => Boolean(resource)));
825
+ const missing = new Map();
826
+ for (const descriptor of descriptors) {
827
+ for (const ref of requiredInternalInputRefs(descriptor)) {
828
+ const resource = ref.resource ?? descriptor.resource?.name;
829
+ if (!resource || discoveryResources.has(resource))
830
+ continue;
831
+ const actions = missing.get(resource) ?? new Set();
832
+ if (descriptor.name)
833
+ actions.add(descriptor.name);
834
+ missing.set(resource, actions);
835
+ }
836
+ }
837
+ return Array.from(missing.entries()).map(([resource, actions]) => ({
838
+ level: "warning",
839
+ check: "guide-action-discovery",
840
+ message: `Guide action${actions.size === 1 ? "" : "s"} ${Array.from(actions).sort().join(", ")} ${actions.size === 1 ? "requires" : "require"} an internal ${resource} id, but Guide has no read-only discovery action for ${resource}.`,
841
+ fix: `Add a policy-scoped read-only action that lists or searches visible ${resource} records, include it in the Guide action allow-list, or remove the internal-id resource metadata if this id is supplied only by trusted UI context.`
842
+ }));
843
+ }
844
+ function guideActionDescriptors(manifest) {
845
+ const guideName = manifest.guide?.agentName;
846
+ const guideAgent = guideName ? manifest.agents?.find((agent) => agent.name === guideName) : undefined;
847
+ return guideAgent?.actionDescriptors ?? [];
848
+ }
849
+ function isGuideDiscoveryAction(descriptor) {
850
+ if (!descriptor.resource?.name)
851
+ return false;
852
+ if (requiredInternalInputRefs(descriptor).length > 0)
853
+ return false;
854
+ const operation = descriptor.resource.operation;
855
+ if (operation === "list" || operation === "search" || operation === "read" || operation === "get")
856
+ return true;
857
+ return descriptor.annotations?.readOnlyHint === true;
858
+ }
859
+ function requiredInternalInputRefs(descriptor) {
860
+ const refs = descriptor.resource?.inputRefs;
861
+ if (!refs)
862
+ return [];
863
+ const requiredInputKeys = new Set(descriptor.requiredInputKeys ?? []);
864
+ return Object.entries(refs).flatMap(([key, ref]) => {
865
+ if (ref.kind !== "internal-id")
866
+ return [];
867
+ const required = ref.required ?? requiredInputKeys.has(key);
868
+ return required ? [{ key, resource: ref.resource }] : [];
869
+ });
870
+ }
871
+ function declaredDependencies(cwd) {
872
+ return packageAllDependencies(readModulePackageJson(cwd));
873
+ }
874
+ function safeDeclaredDependencies(cwd) {
875
+ try {
876
+ return declaredDependencies(cwd);
877
+ }
878
+ catch {
879
+ return {};
880
+ }
881
+ }
882
+ function readDevVar(cwd, key) {
883
+ const file = join(cwd, ".dev.vars");
884
+ if (!existsSync(file))
885
+ return null;
886
+ const escaped = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
887
+ const match = readFileSync(file, "utf8").match(new RegExp(`^\\s*${escaped}\\s*=\\s*(.+?)\\s*$`, "m"));
888
+ return match?.[1]?.replace(/^["']|["']$/g, "") ?? null;
889
+ }
890
+ function sourceIgnored(cwd) {
891
+ const gitignore = join(cwd, ".gitignore");
892
+ if (!existsSync(gitignore))
893
+ return false;
894
+ return readFileSync(gitignore, "utf8")
895
+ .split(/\r?\n/)
896
+ .map((line) => line.trim())
897
+ .some((line) => line === ".source" || line === ".source/");
898
+ }
899
+ const docsUserSurfaceLeakageTerms = [
900
+ ["Raybase", /\bRaybase\b/],
901
+ ["Raybase package", /@raybase\b/],
902
+ ["Raybase identifier", /\braybase_[A-Za-z0-9_]*\b/],
903
+ ["admin route", /\/admin(?:\/|\b)/],
904
+ ["API route", /(^|[^\w/-])\/api(?:\/|\b)/m],
905
+ ["MCP route", /(?<!\.)(?<!\/docs)(?<!docs)\/mcp(?:\/|\b)/],
906
+ ["operator", /\boperator\b/i],
907
+ ["Cloudflare", /\bCloudflare\b/],
908
+ ["Durable Object", /\bDurable Objects?\b/],
909
+ ["D1", /\bD1\b/],
910
+ ["Workers", /\bWorkers?\b/],
911
+ ["wrangler", /\bwrangler\b/i]
912
+ ];
913
+ function docsUserSurfaceLeakageWarnings(cwd, docsRoot = "content/docs", placement = "spine") {
914
+ const docsDir = join(cwd, docsRoot);
915
+ if (!existsSync(docsDir))
916
+ return [];
917
+ const terms = placement === "site" ? docsUserSurfaceLeakageTerms.filter(([label]) => label !== "API route") : docsUserSurfaceLeakageTerms;
918
+ const matches = listDocsMarkdownFiles(docsDir).flatMap((file) => {
919
+ const source = readFileSync(file.absolutePath, "utf8");
920
+ const labels = terms
921
+ .filter(([label, pattern]) => !(file.relativePath === "mcp.mdx" && label === "MCP route") && pattern.test(source))
922
+ .map(([label]) => label);
923
+ return labels.length > 0 ? [`${file.relativePath} (${labels.join(", ")})`] : [];
924
+ });
925
+ if (matches.length === 0)
926
+ return [];
927
+ const blockedExamples = placement === "site"
928
+ ? "Raybase, /admin, Cloudflare, Durable Object, wrangler, and operator"
929
+ : "Raybase, /admin, /api, Cloudflare, Durable Object, wrangler, and operator";
930
+ return [
931
+ {
932
+ level: "warning",
933
+ check: "docs-user-surface-leakage",
934
+ message: `App-user docs in ${docsRoot} contain platform/admin terms in ${matches.join(", ")}.`,
935
+ fix: `Keep ${docsRoot} focused on app-user workflows. Remove platform/admin terms such as ${blockedExamples}; keep /mcp mentions only in ${docsRoot}/mcp.mdx; move operator runbooks outside docs content; or ignore true product-domain false positives.`
936
+ }
937
+ ];
938
+ }
939
+ function listDocsMarkdownFiles(root, dir = root) {
940
+ return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
941
+ const absolutePath = join(dir, entry.name);
942
+ if (entry.isDirectory())
943
+ return listDocsMarkdownFiles(root, absolutePath);
944
+ if (!entry.isFile() || !/\.(md|mdx)$/.test(entry.name))
945
+ return [];
946
+ return [{ absolutePath, relativePath: absolutePath.slice(root.length + 1).replace(/\\/g, "/") }];
947
+ });
948
+ }
949
+ function containsBareApiSearchRoute(source) {
950
+ return source.includes("\"/api/search\"") || source.includes("'/api/search'") || source.includes("`/api/search`");
951
+ }
952
+ function wranglerConfig(cwd) {
953
+ const file = join(cwd, "wrangler.jsonc");
954
+ const raw = readFileSync(file, "utf8");
955
+ const parsed = parse(raw);
956
+ return { raw, parsed };
957
+ }
958
+ function wranglerAiStatus(config) {
959
+ const ai = config.ai && typeof config.ai === "object" ? config.ai : null;
960
+ const bindingName = typeof ai?.binding === "string" ? ai.binding : null;
961
+ return { binding: bindingName === "AI", bindingName };
962
+ }
963
+ function normalizePath(path) {
964
+ return path.startsWith("/") ? path : `/${path}`;
965
+ }
966
+ //# sourceMappingURL=module-doctor.js.map