@timber-js/app 0.2.0-alpha.221 → 0.2.0-alpha.223

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 (380) hide show
  1. package/agent-skill.md +21 -5
  2. package/dist/_chunks/{actions-BDqn4Oxj.js → actions-7dTXYJfu.js} +53 -24
  3. package/dist/_chunks/actions-7dTXYJfu.js.map +1 -0
  4. package/dist/_chunks/{als-registry-BZqHCtq-.js → als-registry-DpygwCp0.js} +2 -3
  5. package/dist/_chunks/{als-registry-BZqHCtq-.js.map → als-registry-DpygwCp0.js.map} +1 -1
  6. package/dist/_chunks/{als-slots-BEEIPKYm.js → als-slots-kbQrHTzm.js} +2 -3
  7. package/dist/_chunks/{als-slots-BEEIPKYm.js.map → als-slots-kbQrHTzm.js.map} +1 -1
  8. package/dist/_chunks/{base-path-DaQrzbez.js → base-path-DDIx0FXe.js} +2 -3
  9. package/dist/_chunks/{base-path-DaQrzbez.js.map → base-path-DDIx0FXe.js.map} +1 -1
  10. package/dist/_chunks/{build-manifest-DWppEdLB.js → build-manifest-Y4jl7nwU.js} +2 -3
  11. package/dist/_chunks/{build-manifest-DWppEdLB.js.map → build-manifest-Y4jl7nwU.js.map} +1 -1
  12. package/dist/_chunks/{build-output-helper-RV_BRcF1.js → build-output-helper-B7wWGTfR.js} +14 -10
  13. package/dist/_chunks/build-output-helper-B7wWGTfR.js.map +1 -0
  14. package/dist/_chunks/{cache-api-GE4AOe2H.js → cache-api-TDZ4hlDc.js} +237 -37
  15. package/dist/_chunks/cache-api-TDZ4hlDc.js.map +1 -0
  16. package/dist/_chunks/{canonicalize-BAWkWiKK.js → canonicalize-CqK135BN.js} +29 -4
  17. package/dist/_chunks/{canonicalize-BAWkWiKK.js.map → canonicalize-CqK135BN.js.map} +1 -1
  18. package/dist/_chunks/chains-CwOr3Myj.js +1 -0
  19. package/dist/_chunks/{chains-e_Buf9vg.js → chains-Dgm3PrMe.js} +3 -4
  20. package/dist/_chunks/{chains-e_Buf9vg.js.map → chains-Dgm3PrMe.js.map} +1 -1
  21. package/dist/_chunks/{classify-2Yp3xJY1.js → classify--_kINHQV.js} +4 -5
  22. package/dist/_chunks/{classify-2Yp3xJY1.js.map → classify--_kINHQV.js.map} +1 -1
  23. package/dist/_chunks/{cli-check-DDwCkeDY.js → cli-check-Dv3f8d2j.js} +5 -6
  24. package/dist/_chunks/{cli-check-DDwCkeDY.js.map → cli-check-Dv3f8d2j.js.map} +1 -1
  25. package/dist/_chunks/{cli-context-_mPttGGY.js → cli-context-CbZp32SK.js} +3 -4
  26. package/dist/_chunks/{cli-context-_mPttGGY.js.map → cli-context-CbZp32SK.js.map} +1 -1
  27. package/dist/_chunks/cli-context-n5hmkdla.js +1 -0
  28. package/dist/_chunks/cli-dev-status-prPMLU8G.js +138 -0
  29. package/dist/_chunks/cli-dev-status-prPMLU8G.js.map +1 -0
  30. package/dist/_chunks/cli-init-BoXOYYil.js +196 -0
  31. package/dist/_chunks/cli-init-BoXOYYil.js.map +1 -0
  32. package/dist/_chunks/{cli-schema-sync-BdIebmk3.js → cli-schema-sync-DIPurq7X.js} +4 -5
  33. package/dist/_chunks/{cli-schema-sync-BdIebmk3.js.map → cli-schema-sync-DIPurq7X.js.map} +1 -1
  34. package/dist/_chunks/{cli-schema-sync-CLNfXQDK.js → cli-schema-sync-uq72EZmD.js} +1 -1
  35. package/dist/_chunks/{client-dep-entries-BOkpKjj1.js → client-dep-entries-CP7AkMCM.js} +4 -5
  36. package/dist/_chunks/{client-dep-entries-BOkpKjj1.js.map → client-dep-entries-CP7AkMCM.js.map} +1 -1
  37. package/dist/_chunks/{cloudflare-Byxl8FWP.js → cloudflare-B75X6u4O.js} +10 -13
  38. package/dist/_chunks/{cloudflare-Byxl8FWP.js.map → cloudflare-B75X6u4O.js.map} +1 -1
  39. package/dist/_chunks/{codec-registry-oOUxugz3.js → codec-registry-CPc6bjVl.js} +2 -3
  40. package/dist/_chunks/{codec-registry-oOUxugz3.js.map → codec-registry-CPc6bjVl.js.map} +1 -1
  41. package/dist/_chunks/{codegen-Bps1sLKJ.js → codegen-B9oWkWGf.js} +5 -8
  42. package/dist/_chunks/{codegen-Bps1sLKJ.js.map → codegen-B9oWkWGf.js.map} +1 -1
  43. package/dist/_chunks/{convention-lint-ByKJ6aqD.js → convention-lint-hZwz5wd4.js} +8 -11
  44. package/dist/_chunks/{convention-lint-ByKJ6aqD.js.map → convention-lint-hZwz5wd4.js.map} +1 -1
  45. package/dist/_chunks/dev-discovery-YnabkCKD.js +238 -0
  46. package/dist/_chunks/dev-discovery-YnabkCKD.js.map +1 -0
  47. package/dist/_chunks/{dev-server-DIy-SY-J.js → dev-server-C61GWpGg.js} +409 -51
  48. package/dist/_chunks/dev-server-C61GWpGg.js.map +1 -0
  49. package/dist/_chunks/dev-server-CBvvM7Lr.js +1 -0
  50. package/dist/_chunks/{dev-store-BOa304m_.js → dev-store-BvdqtHvK.js} +82 -38
  51. package/dist/_chunks/dev-store-BvdqtHvK.js.map +1 -0
  52. package/dist/_chunks/{dist-DtrJyBbw.js → dist-C1Rjlo6s.js} +3 -5
  53. package/dist/_chunks/{dist-DtrJyBbw.js.map → dist-C1Rjlo6s.js.map} +1 -1
  54. package/dist/_chunks/{error-boundary-Bc8QPZuq.js → error-boundary-DRQXGWCp.js} +20 -27
  55. package/dist/_chunks/{error-boundary-Bc8QPZuq.js.map → error-boundary-DRQXGWCp.js.map} +1 -1
  56. package/dist/_chunks/{fast-hash-C-tVYrLb.js → fast-hash-DddxkU5Y.js} +2 -3
  57. package/dist/_chunks/{fast-hash-C-tVYrLb.js.map → fast-hash-DddxkU5Y.js.map} +1 -1
  58. package/dist/_chunks/{flight-source-node-HptmGMT8.js → flight-source-node-0Tp6evlz.js} +6 -8
  59. package/dist/_chunks/flight-source-node-0Tp6evlz.js.map +1 -0
  60. package/dist/_chunks/{format-BKclgVbk.js → format-DuPOoXUP.js} +2 -3
  61. package/dist/_chunks/{format-BKclgVbk.js.map → format-DuPOoXUP.js.map} +1 -1
  62. package/dist/_chunks/{fs-identity-BRKuL215.js → fs-identity-BmQ_Agg-.js} +3 -5
  63. package/dist/_chunks/{fs-identity-BRKuL215.js.map → fs-identity-BmQ_Agg-.js.map} +1 -1
  64. package/dist/_chunks/global-context-DbxNWeBP.js +47 -0
  65. package/dist/_chunks/global-context-DbxNWeBP.js.map +1 -0
  66. package/dist/_chunks/{graph-cache-CYiUS2aS.js → graph-cache-B1LAg4t7.js} +5 -89
  67. package/dist/_chunks/graph-cache-B1LAg4t7.js.map +1 -0
  68. package/dist/_chunks/{href-validation-BIrxavIy.js → href-validation-CEZy1V-k.js} +4 -7
  69. package/dist/_chunks/{href-validation-BIrxavIy.js.map → href-validation-CEZy1V-k.js.map} +1 -1
  70. package/dist/_chunks/{json-lossy-check-C8zBY2uZ.js → json-lossy-check-DVkLUlfC.js} +3 -4
  71. package/dist/_chunks/{json-lossy-check-C8zBY2uZ.js.map → json-lossy-check-DVkLUlfC.js.map} +1 -1
  72. package/dist/_chunks/{live-graph-tSWrv8eH.js → live-graph-BcVjQ1Te.js} +6 -7
  73. package/dist/_chunks/{live-graph-tSWrv8eH.js.map → live-graph-BcVjQ1Te.js.map} +1 -1
  74. package/dist/_chunks/{logger-CbLdcy-W.js → logger-CWk44DLp.js} +97 -47
  75. package/dist/_chunks/logger-CWk44DLp.js.map +1 -0
  76. package/dist/_chunks/{metadata-routes-B3XJNyIH.js → metadata-routes-BL26HCDd.js} +2 -3
  77. package/dist/_chunks/{metadata-routes-B3XJNyIH.js.map → metadata-routes-BL26HCDd.js.map} +1 -1
  78. package/dist/_chunks/{navigation-root-BQfo1-kG.js → navigation-root-M3B2ZrdO.js} +6 -10
  79. package/dist/_chunks/{navigation-root-BQfo1-kG.js.map → navigation-root-M3B2ZrdO.js.map} +1 -1
  80. package/dist/_chunks/{node-response-rkQqcFGq.js → node-response-B9aviPDa.js} +43 -9
  81. package/dist/_chunks/node-response-B9aviPDa.js.map +1 -0
  82. package/dist/_chunks/{param-value-C8TNYchQ.js → param-value-DqlGfF57.js} +2 -3
  83. package/dist/_chunks/{param-value-C8TNYchQ.js.map → param-value-DqlGfF57.js.map} +1 -1
  84. package/dist/_chunks/{plugin-context-uDHFqHHJ.js → plugin-context-BfSRKJfz.js} +1 -1
  85. package/dist/_chunks/{plugin-context-DxMMvjUt.js → plugin-context-FCkaNLUB.js} +4 -6
  86. package/dist/_chunks/plugin-context-FCkaNLUB.js.map +1 -0
  87. package/dist/_chunks/{poison-rules-DoEhbqaY.js → poison-rules-Bmz-lCPi.js} +2 -3
  88. package/dist/_chunks/{poison-rules-DoEhbqaY.js.map → poison-rules-Bmz-lCPi.js.map} +1 -1
  89. package/dist/_chunks/{poison-scan-C4FgMxFl.js → poison-scan-DJYxZc_7.js} +4 -5
  90. package/dist/_chunks/{poison-scan-C4FgMxFl.js.map → poison-scan-DJYxZc_7.js.map} +1 -1
  91. package/dist/_chunks/{purge-store-WZaxu-3m.js → purge-store-8BqLAYZ1.js} +2 -3
  92. package/dist/_chunks/{purge-store-WZaxu-3m.js.map → purge-store-8BqLAYZ1.js.map} +1 -1
  93. package/dist/_chunks/{render-timeout-joFhz4KH.js → render-timeout-MrrqD1wd.js} +20 -4
  94. package/dist/_chunks/{render-timeout-joFhz4KH.js.map → render-timeout-MrrqD1wd.js.map} +1 -1
  95. package/dist/_chunks/{resolve-schema-CBR6Lm4i.js → resolve-schema-B-aCuTu3.js} +3 -4
  96. package/dist/_chunks/{resolve-schema-CBR6Lm4i.js.map → resolve-schema-B-aCuTu3.js.map} +1 -1
  97. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js → rsc-cache-key-D0cb0Gmc.js} +2 -3
  98. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js.map → rsc-cache-key-D0cb0Gmc.js.map} +1 -1
  99. package/dist/_chunks/{rsc-media-type-DDc7duTD.js → rsc-media-type-m8jz9u6_.js} +2 -3
  100. package/dist/_chunks/{rsc-media-type-DDc7duTD.js.map → rsc-media-type-m8jz9u6_.js.map} +1 -1
  101. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js → rsc-payload-path-EphpDB-J.js} +2 -3
  102. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js.map → rsc-payload-path-EphpDB-J.js.map} +1 -1
  103. package/dist/_chunks/{scan-BoP17W3w.js → scan-CyizcBiX.js} +2 -3
  104. package/dist/_chunks/{scan-BoP17W3w.js.map → scan-CyizcBiX.js.map} +1 -1
  105. package/dist/_chunks/{scanner-Cb3fSjAC.js → scanner-CJC-ScJU.js} +15 -23
  106. package/dist/_chunks/{scanner-Cb3fSjAC.js.map → scanner-CJC-ScJU.js.map} +1 -1
  107. package/dist/_chunks/{schema-bridge-C83xa9lT.js → schema-bridge-DyRs3cqy.js} +61 -25
  108. package/dist/_chunks/schema-bridge-DyRs3cqy.js.map +1 -0
  109. package/dist/_chunks/{segment-classify-C539Pa2O.js → segment-classify-Ho8jXWeC.js} +3 -5
  110. package/dist/_chunks/{segment-classify-C539Pa2O.js.map → segment-classify-Ho8jXWeC.js.map} +1 -1
  111. package/dist/_chunks/{segment-context-xtPUGfdq.js → segment-context-CYiGTi3K.js} +6 -12
  112. package/dist/_chunks/segment-context-CYiGTi3K.js.map +1 -0
  113. package/dist/_chunks/{segment-keys-D5hu1hz4.js → segment-keys-Y60KNc8C.js} +2 -3
  114. package/dist/_chunks/{segment-keys-D5hu1hz4.js.map → segment-keys-Y60KNc8C.js.map} +1 -1
  115. package/dist/_chunks/{singleflight-BeVMMKi0.js → singleflight-BChPMjwH.js} +2 -3
  116. package/dist/_chunks/{singleflight-BeVMMKi0.js.map → singleflight-BChPMjwH.js.map} +1 -1
  117. package/dist/_chunks/{sizeof-QPE5nd3u.js → sizeof-DG4W40lv.js} +3 -4
  118. package/dist/_chunks/{sizeof-QPE5nd3u.js.map → sizeof-DG4W40lv.js.map} +1 -1
  119. package/dist/_chunks/{ssr-data-nA3I70_n.js → ssr-data-9hPtcNOr.js} +3 -4
  120. package/dist/_chunks/{ssr-data-nA3I70_n.js.map → ssr-data-9hPtcNOr.js.map} +1 -1
  121. package/dist/_chunks/{state-BhNGPsdi.js → state-B-EBjeER.js} +2 -3
  122. package/dist/_chunks/{state-BhNGPsdi.js.map → state-B-EBjeER.js.map} +1 -1
  123. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js → status-page-marker-XIQXlTOb.js} +8 -13
  124. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js.map → status-page-marker-XIQXlTOb.js.map} +1 -1
  125. package/dist/_chunks/{tree-match-6yihorhk.js → tree-match-Bqdr9szG.js} +2 -3
  126. package/dist/_chunks/{tree-match-6yihorhk.js.map → tree-match-Bqdr9szG.js.map} +1 -1
  127. package/dist/_chunks/{use-query-states-I3JMng6J.js → use-query-states-pkDV-jSg.js} +4 -7
  128. package/dist/_chunks/{use-query-states-I3JMng6J.js.map → use-query-states-pkDV-jSg.js.map} +1 -1
  129. package/dist/_chunks/{walkers-qu8TpiLh.js → walkers-DIE203ir.js} +6 -8
  130. package/dist/_chunks/{walkers-qu8TpiLh.js.map → walkers-DIE203ir.js.map} +1 -1
  131. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js → write-file-atomic-DW8m_Atv.js} +2 -3
  132. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js.map → write-file-atomic-DW8m_Atv.js.map} +1 -1
  133. package/dist/adapters/build-output-helper.d.ts +10 -1
  134. package/dist/adapters/build-output-helper.d.ts.map +1 -1
  135. package/dist/adapters/cloudflare-dev.js +2 -3
  136. package/dist/adapters/cloudflare-kv-cache.js +3 -4
  137. package/dist/adapters/cloudflare.d.ts.map +1 -1
  138. package/dist/adapters/cloudflare.js +1 -1
  139. package/dist/adapters/nitro-presets.d.ts +6 -0
  140. package/dist/adapters/nitro-presets.d.ts.map +1 -1
  141. package/dist/adapters/nitro-preview.d.ts.map +1 -1
  142. package/dist/adapters/nitro.d.ts.map +1 -1
  143. package/dist/adapters/nitro.js +94 -57
  144. package/dist/adapters/nitro.js.map +1 -1
  145. package/dist/analyze/crawl-entry.js +7 -9
  146. package/dist/analyze/crawl-entry.js.map +1 -1
  147. package/dist/analyze/graph-command.d.ts.map +1 -1
  148. package/dist/analyze/graph-command.js +19 -105
  149. package/dist/analyze/graph-command.js.map +1 -1
  150. package/dist/cache/guarded-read.d.ts +29 -0
  151. package/dist/cache/guarded-read.d.ts.map +1 -0
  152. package/dist/cache/index.js +3 -3
  153. package/dist/cache/key-discipline.d.ts +61 -0
  154. package/dist/cache/key-discipline.d.ts.map +1 -0
  155. package/dist/cache/stores/cloudflare-kv.js +1 -2
  156. package/dist/cache/stores/memory.js +2 -3
  157. package/dist/cache/stores/redis.js +1 -2
  158. package/dist/cache/stores/vercel.js +1 -2
  159. package/dist/cache/timber-cache.d.ts +5 -1
  160. package/dist/cache/timber-cache.d.ts.map +1 -1
  161. package/dist/cdn/cloudflare-purge.js +1 -2
  162. package/dist/cdn/fastly-purge.js +1 -2
  163. package/dist/cdn/index.js +2 -3
  164. package/dist/cdn/workers-cache-purge.js +3 -5
  165. package/dist/cdn/workers-cache-purge.js.map +1 -1
  166. package/dist/cli-dev-status.d.ts +75 -0
  167. package/dist/cli-dev-status.d.ts.map +1 -0
  168. package/dist/cli-init.d.ts +72 -0
  169. package/dist/cli-init.d.ts.map +1 -0
  170. package/dist/cli.d.ts +4 -12
  171. package/dist/cli.d.ts.map +1 -1
  172. package/dist/cli.js +27 -54
  173. package/dist/cli.js.map +1 -1
  174. package/dist/client/error-boundary.d.ts.map +1 -1
  175. package/dist/client/error-boundary.js +1 -1
  176. package/dist/client/global-context.d.ts +21 -1
  177. package/dist/client/global-context.d.ts.map +1 -1
  178. package/dist/client/index.js +23 -44
  179. package/dist/client/index.js.map +1 -1
  180. package/dist/client/internal.js +13 -18
  181. package/dist/client/internal.js.map +1 -1
  182. package/dist/client/navigation-context.d.ts.map +1 -1
  183. package/dist/client/params-context.d.ts.map +1 -1
  184. package/dist/client/slot-context.d.ts +2 -2
  185. package/dist/client/slot-context.d.ts.map +1 -1
  186. package/dist/client/use-cookie.d.ts +18 -5
  187. package/dist/client/use-cookie.d.ts.map +1 -1
  188. package/dist/codec.js +2 -3
  189. package/dist/config-types.d.ts +22 -5
  190. package/dist/config-types.d.ts.map +1 -1
  191. package/dist/config-validation.d.ts.map +1 -1
  192. package/dist/cookies/define-cookie.d.ts.map +1 -1
  193. package/dist/cookies/index.js +40 -67
  194. package/dist/cookies/index.js.map +1 -1
  195. package/dist/cookies/json-cookie.d.ts +4 -4
  196. package/dist/index.js +266 -229
  197. package/dist/index.js.map +1 -1
  198. package/dist/params/index.js +3 -4
  199. package/dist/plugin-context.d.ts +7 -0
  200. package/dist/plugin-context.d.ts.map +1 -1
  201. package/dist/plugins/dev-discovery.d.ts +69 -5
  202. package/dist/plugins/dev-discovery.d.ts.map +1 -1
  203. package/dist/plugins/dev-hostname.d.ts +152 -0
  204. package/dist/plugins/dev-hostname.d.ts.map +1 -0
  205. package/dist/plugins/dev-server.d.ts +6 -2
  206. package/dist/plugins/dev-server.d.ts.map +1 -1
  207. package/dist/plugins/dev-store-clear.d.ts +83 -0
  208. package/dist/plugins/dev-store-clear.d.ts.map +1 -0
  209. package/dist/plugins/graph-endpoint.d.ts +4 -2
  210. package/dist/plugins/graph-endpoint.d.ts.map +1 -1
  211. package/dist/plugins/prebuilt.d.ts.map +1 -1
  212. package/dist/routing/index.js +4 -4
  213. package/dist/rsc-runtime/rsc.d.ts +2 -1
  214. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  215. package/dist/rsc-runtime/server-references.d.ts +8 -0
  216. package/dist/rsc-runtime/server-references.d.ts.map +1 -0
  217. package/dist/schema-bridge.d.ts +28 -19
  218. package/dist/schema-bridge.d.ts.map +1 -1
  219. package/dist/search-params/define.d.ts +1 -1
  220. package/dist/search-params/define.d.ts.map +1 -1
  221. package/dist/search-params/index.js +11 -14
  222. package/dist/search-params/index.js.map +1 -1
  223. package/dist/search-params/wrappers.d.ts +3 -3
  224. package/dist/server/access-gate.d.ts +12 -0
  225. package/dist/server/access-gate.d.ts.map +1 -1
  226. package/dist/server/canonicalize.d.ts +21 -0
  227. package/dist/server/canonicalize.d.ts.map +1 -1
  228. package/dist/server/cookie-context.d.ts +8 -1
  229. package/dist/server/cookie-context.d.ts.map +1 -1
  230. package/dist/server/flight-source-node.d.ts.map +1 -1
  231. package/dist/server/flight-source.d.ts.map +1 -1
  232. package/dist/server/index.d.ts +1 -1
  233. package/dist/server/index.d.ts.map +1 -1
  234. package/dist/server/index.js +8 -13
  235. package/dist/server/index.js.map +1 -1
  236. package/dist/server/interception-gates.d.ts +49 -0
  237. package/dist/server/interception-gates.d.ts.map +1 -0
  238. package/dist/server/internal.js +1080 -959
  239. package/dist/server/internal.js.map +1 -1
  240. package/dist/server/logger.d.ts +26 -0
  241. package/dist/server/logger.d.ts.map +1 -1
  242. package/dist/server/param-coercion.d.ts +8 -0
  243. package/dist/server/param-coercion.d.ts.map +1 -1
  244. package/dist/server/pipeline-interception.d.ts +34 -4
  245. package/dist/server/pipeline-interception.d.ts.map +1 -1
  246. package/dist/server/pipeline-metadata-route.d.ts +24 -0
  247. package/dist/server/pipeline-metadata-route.d.ts.map +1 -0
  248. package/dist/server/pipeline-metadata.d.ts +3 -2
  249. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  250. package/dist/server/pipeline-phases.d.ts +9 -3
  251. package/dist/server/pipeline-phases.d.ts.map +1 -1
  252. package/dist/server/pipeline.d.ts +18 -0
  253. package/dist/server/pipeline.d.ts.map +1 -1
  254. package/dist/server/prebuilt/dev-store.d.ts +68 -22
  255. package/dist/server/prebuilt/dev-store.d.ts.map +1 -1
  256. package/dist/server/prebuilt/overlay.d.ts +17 -3
  257. package/dist/server/prebuilt/overlay.d.ts.map +1 -1
  258. package/dist/server/prebuilt-runtime.d.ts.map +1 -1
  259. package/dist/server/primitives.d.ts +13 -0
  260. package/dist/server/primitives.d.ts.map +1 -1
  261. package/dist/server/render-utils.d.ts +21 -0
  262. package/dist/server/render-utils.d.ts.map +1 -1
  263. package/dist/server/request-context.d.ts +14 -0
  264. package/dist/server/request-context.d.ts.map +1 -1
  265. package/dist/server/route-element-builder.d.ts.map +1 -1
  266. package/dist/server/route-handler.d.ts +7 -0
  267. package/dist/server/route-handler.d.ts.map +1 -1
  268. package/dist/server/route-matcher.d.ts +14 -3
  269. package/dist/server/route-matcher.d.ts.map +1 -1
  270. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  271. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  272. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  273. package/dist/server/signal-identity.d.ts +6 -0
  274. package/dist/server/signal-identity.d.ts.map +1 -1
  275. package/dist/server/traced-access.d.ts +18 -0
  276. package/dist/server/traced-access.d.ts.map +1 -0
  277. package/dist/server/tracing.d.ts.map +1 -1
  278. package/dist/server/types.d.ts +5 -4
  279. package/dist/server/types.d.ts.map +1 -1
  280. package/dist/shims/font-google.js +1 -2
  281. package/dist/shims/font-local.js +1 -2
  282. package/dist/shims/headers.d.ts +11 -4
  283. package/dist/shims/headers.d.ts.map +1 -1
  284. package/docs/api/30-api-server.mdx +3 -1
  285. package/docs/api/32-api-cache.mdx +1 -1
  286. package/docs/api/33-api-search-params.mdx +3 -1
  287. package/docs/api/34-api-config.mdx +22 -0
  288. package/docs/api/36-cli.mdx +72 -6
  289. package/docs/learn/01-quick-start.mdx +1 -1
  290. package/docs/learn/06-typed-params.mdx +4 -4
  291. package/docs/learn/10-caching.mdx +26 -5
  292. package/llms.txt +1 -1
  293. package/package.json +12 -12
  294. package/src/adapters/build-output-helper.ts +26 -4
  295. package/src/adapters/cloudflare.ts +1 -0
  296. package/src/adapters/nitro-presets.ts +15 -0
  297. package/src/adapters/nitro-preview.ts +66 -34
  298. package/src/adapters/nitro.ts +14 -6
  299. package/src/analyze/graph-command.ts +25 -133
  300. package/src/cache/guarded-read.ts +44 -0
  301. package/src/cache/key-discipline.ts +218 -0
  302. package/src/cache/timber-cache.ts +46 -7
  303. package/src/cli-dev-status.ts +196 -0
  304. package/src/cli-init.ts +278 -0
  305. package/src/cli.ts +33 -79
  306. package/src/client/error-boundary.tsx +19 -2
  307. package/src/client/global-context.ts +42 -14
  308. package/src/client/navigation-context.ts +4 -11
  309. package/src/client/params-context.ts +5 -17
  310. package/src/client/segment-update-context.ts +1 -1
  311. package/src/client/slot-content-cache-context.ts +1 -1
  312. package/src/client/slot-context.ts +6 -17
  313. package/src/client/use-cookie.ts +33 -21
  314. package/src/config-types.ts +22 -5
  315. package/src/config-validation.ts +17 -0
  316. package/src/cookies/define-cookie.ts +10 -46
  317. package/src/cookies/json-cookie.ts +4 -4
  318. package/src/plugin-context.ts +7 -0
  319. package/src/plugins/dev-discovery.ts +216 -6
  320. package/src/plugins/dev-hostname.ts +322 -0
  321. package/src/plugins/dev-server.ts +130 -37
  322. package/src/plugins/dev-store-clear.ts +145 -0
  323. package/src/plugins/graph-endpoint.ts +15 -3
  324. package/src/plugins/prebuilt.ts +9 -0
  325. package/src/rsc-runtime/rsc.ts +7 -3
  326. package/src/rsc-runtime/server-references.ts +73 -0
  327. package/src/rsc-runtime/vendor-types.d.ts +17 -0
  328. package/src/schema-bridge.ts +93 -38
  329. package/src/search-params/define.ts +5 -6
  330. package/src/search-params/wrappers.ts +3 -3
  331. package/src/server/access-gate.tsx +32 -20
  332. package/src/server/action-handler.ts +58 -36
  333. package/src/server/canonicalize.ts +27 -0
  334. package/src/server/cookie-context.ts +11 -3
  335. package/src/server/flight-source-node.ts +5 -2
  336. package/src/server/flight-source.ts +4 -3
  337. package/src/server/index.ts +6 -1
  338. package/src/server/interception-gates.ts +94 -0
  339. package/src/server/logger.ts +32 -0
  340. package/src/server/param-coercion.ts +22 -0
  341. package/src/server/pipeline-interception.ts +64 -4
  342. package/src/server/pipeline-metadata-route.ts +242 -0
  343. package/src/server/pipeline-metadata.ts +7 -5
  344. package/src/server/pipeline-phases.ts +71 -131
  345. package/src/server/pipeline.ts +20 -2
  346. package/src/server/prebuilt/dev-store.ts +113 -34
  347. package/src/server/prebuilt/overlay.ts +32 -4
  348. package/src/server/prebuilt-runtime.ts +63 -45
  349. package/src/server/primitives.ts +14 -0
  350. package/src/server/render-utils.ts +25 -0
  351. package/src/server/request-context.ts +27 -3
  352. package/src/server/route-element-builder.ts +15 -2
  353. package/src/server/route-handler.ts +3 -2
  354. package/src/server/route-matcher.ts +48 -33
  355. package/src/server/rsc-entry/api-handler.ts +2 -33
  356. package/src/server/rsc-entry/index.ts +8 -3
  357. package/src/server/rsc-entry/rsc-stream.ts +7 -1
  358. package/src/server/signal-identity.ts +30 -12
  359. package/src/server/traced-access.ts +50 -0
  360. package/src/server/tracing.ts +18 -1
  361. package/src/server/types.ts +5 -4
  362. package/src/shims/headers.ts +12 -4
  363. package/dist/_chunks/actions-BDqn4Oxj.js.map +0 -1
  364. package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +0 -1
  365. package/dist/_chunks/cache-api-GE4AOe2H.js.map +0 -1
  366. package/dist/_chunks/chains-CDK1AWZQ.js +0 -1
  367. package/dist/_chunks/cli-context-BJQB6rtF.js +0 -1
  368. package/dist/_chunks/dev-server-BiWNMBVU.js +0 -1
  369. package/dist/_chunks/dev-server-DIy-SY-J.js.map +0 -1
  370. package/dist/_chunks/dev-store-BOa304m_.js.map +0 -1
  371. package/dist/_chunks/flight-source-node-HptmGMT8.js.map +0 -1
  372. package/dist/_chunks/graph-cache-CYiUS2aS.js.map +0 -1
  373. package/dist/_chunks/logger-CbLdcy-W.js.map +0 -1
  374. package/dist/_chunks/node-response-rkQqcFGq.js.map +0 -1
  375. package/dist/_chunks/plugin-context-DxMMvjUt.js.map +0 -1
  376. package/dist/_chunks/schema-bridge-C83xa9lT.js.map +0 -1
  377. package/dist/_chunks/segment-context-xtPUGfdq.js.map +0 -1
  378. package/dist/server/prebuilt/key-discipline.d.ts +0 -52
  379. package/dist/server/prebuilt/key-discipline.d.ts.map +0 -1
  380. package/src/server/prebuilt/key-discipline.ts +0 -122
@@ -1 +1 @@
1
- {"version":3,"file":"workers-cache-purge.js","names":[],"sources":["../../src/server/workers-cache-bridge.ts","../../src/cdn/workers-cache-purge.ts"],"sourcesContent":["/**\n * Per-request Workers Cache purge bridge — ALS bridge for Cloudflare adapter.\n *\n * The generated _worker.js wraps each request with `runWithWorkersCachePurge`,\n * binding `ctx.cache` from the Cloudflare ExecutionContext. The\n * `WorkersCachePurge` CDN purge handler reads from this ALS to call\n * `ctx.cache.purge({ tags })` without needing an API token.\n *\n * Design doc: design/06-caching.md, design/25-production-deployments.md\n */\n\nimport { workersCachePurgeAls } from './als-registry.ts';\nimport type { WorkersCachePurgeCtx } from './als-registry.ts';\n\n/**\n * Run a function with Workers Cache purge context available.\n *\n * Called by the generated Cloudflare _worker.js entry to bind\n * `ctx.cache` for the request duration.\n */\nexport function runWithWorkersCachePurge<T>(ctx: WorkersCachePurgeCtx, fn: () => T): T {\n return workersCachePurgeAls.run(ctx, fn);\n}\n\n/**\n * Get the current request's Workers Cache context, if available.\n *\n * Returns undefined outside a Cloudflare Workers request context\n * or on platforms without Workers Cache support.\n */\nexport function getWorkersCachePurgeCtx(): WorkersCachePurgeCtx | undefined {\n return workersCachePurgeAls.getStore();\n}\n","/**\n * Cloudflare Workers Cache purge handler — purges by cache tag via\n * ctx.cache.purge() on the ExecutionContext.\n *\n * Available on ALL Cloudflare plans (no Enterprise requirement).\n * No API token needed — uses the Workers runtime's built-in cache API.\n *\n * ctx.cache.purge() operates on the same underlying Cloudflare CDN cache\n * as caches.default — entries stored via cache.put() with matching\n * Cache-Tag headers are purged (TIM-1172). See design/25 §TIM-1172.\n *\n * Auto-wired by the Cloudflare adapter when no user-configured CDN\n * purge handler is set. Uses the Workers Cache ALS bridge to access\n * ctx.cache from within the request context.\n */\n\nimport type { CdnPurgeHandler } from './purge-store.ts';\nimport { getWorkersCachePurgeCtx } from '../server/workers-cache-bridge.ts';\n\nexport class WorkersCachePurge implements CdnPurgeHandler {\n async purgeTags(tags: string[]): Promise<void> {\n if (tags.length === 0) return;\n\n const ctx = getWorkersCachePurgeCtx();\n if (!ctx) {\n throw new Error(\n 'WorkersCachePurge: no Workers Cache context available. ' +\n 'This handler can only be used within a Cloudflare Workers request context.'\n );\n }\n\n await ctx.purge({ tags });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8BA,SAAgB,0BAA4D;CAC1E,OAAO,qBAAqB,SAAS;AACvC;;;ACbA,IAAa,oBAAb,MAA0D;CACxD,MAAM,UAAU,MAA+B;EAC7C,IAAI,KAAK,WAAW,GAAG;EAEvB,MAAM,MAAM,wBAAwB;EACpC,IAAI,CAAC,KACH,MAAM,IAAI,MACR,mIAEF;EAGF,MAAM,IAAI,MAAM,EAAE,KAAK,CAAC;CAC1B;AACF"}
1
+ {"version":3,"file":"workers-cache-purge.js","names":[],"sources":["../../src/server/workers-cache-bridge.ts","../../src/cdn/workers-cache-purge.ts"],"sourcesContent":["/**\n * Per-request Workers Cache purge bridge — ALS bridge for Cloudflare adapter.\n *\n * The generated _worker.js wraps each request with `runWithWorkersCachePurge`,\n * binding `ctx.cache` from the Cloudflare ExecutionContext. The\n * `WorkersCachePurge` CDN purge handler reads from this ALS to call\n * `ctx.cache.purge({ tags })` without needing an API token.\n *\n * Design doc: design/06-caching.md, design/25-production-deployments.md\n */\n\nimport { workersCachePurgeAls } from './als-registry.ts';\nimport type { WorkersCachePurgeCtx } from './als-registry.ts';\n\n/**\n * Run a function with Workers Cache purge context available.\n *\n * Called by the generated Cloudflare _worker.js entry to bind\n * `ctx.cache` for the request duration.\n */\nexport function runWithWorkersCachePurge<T>(ctx: WorkersCachePurgeCtx, fn: () => T): T {\n return workersCachePurgeAls.run(ctx, fn);\n}\n\n/**\n * Get the current request's Workers Cache context, if available.\n *\n * Returns undefined outside a Cloudflare Workers request context\n * or on platforms without Workers Cache support.\n */\nexport function getWorkersCachePurgeCtx(): WorkersCachePurgeCtx | undefined {\n return workersCachePurgeAls.getStore();\n}\n","/**\n * Cloudflare Workers Cache purge handler — purges by cache tag via\n * ctx.cache.purge() on the ExecutionContext.\n *\n * Available on ALL Cloudflare plans (no Enterprise requirement).\n * No API token needed — uses the Workers runtime's built-in cache API.\n *\n * ctx.cache.purge() operates on the same underlying Cloudflare CDN cache\n * as caches.default — entries stored via cache.put() with matching\n * Cache-Tag headers are purged (TIM-1172). See design/25 §TIM-1172.\n *\n * Auto-wired by the Cloudflare adapter when no user-configured CDN\n * purge handler is set. Uses the Workers Cache ALS bridge to access\n * ctx.cache from within the request context.\n */\n\nimport type { CdnPurgeHandler } from './purge-store.ts';\nimport { getWorkersCachePurgeCtx } from '../server/workers-cache-bridge.ts';\n\nexport class WorkersCachePurge implements CdnPurgeHandler {\n async purgeTags(tags: string[]): Promise<void> {\n if (tags.length === 0) return;\n\n const ctx = getWorkersCachePurgeCtx();\n if (!ctx) {\n throw new Error(\n 'WorkersCachePurge: no Workers Cache context available. ' +\n 'This handler can only be used within a Cloudflare Workers request context.'\n );\n }\n\n await ctx.purge({ tags });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8BA,SAAgB,0BAA4D;CAC1E,OAAO,qBAAqB,SAAS;AACvC;;ACbA,IAAa,oBAAb,MAA0D;CACxD,MAAM,UAAU,MAA+B;EAC7C,IAAI,KAAK,WAAW,GAAG;EAEvB,MAAM,MAAM,wBAAwB;EACpC,IAAI,CAAC,KACH,MAAM,IAAI,MACR,mIAEF;EAGF,MAAM,IAAI,MAAM,EAAE,KAAK,CAAC;CAC1B;AACF"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * `timber dev status [--json]` — which dev servers are running for this app.
3
+ *
4
+ * The agent-facing answer to "is a dev server already up?" Agents that
5
+ * skip the question start a second server, Vite bumps it to the next
6
+ * port, and the agent then tests a different server than the one the user
7
+ * is watching.
8
+ *
9
+ * Servers are found through their discovery records (plugins/dev-discovery.ts)
10
+ * and listed only after the full validation: pid alive AND the server
11
+ * answers the status probe with that pid. The record format stays private;
12
+ * this command is the public contract.
13
+ *
14
+ * Worktree-aware: `.timber/` is gitignored, so each git worktree has its own
15
+ * records. A server in another worktree serves that worktree's code — never
16
+ * reuse it — but it may be holding the port this checkout would have taken,
17
+ * so it is reported separately.
18
+ *
19
+ * See design/21-dev-server.md §"`timber dev status`".
20
+ */
21
+ /** Bumped only on a breaking change to the `--json` shape. */
22
+ export declare const DEV_STATUS_JSON_VERSION = 1;
23
+ export interface DevStatusServer {
24
+ /** The URL the server printed — open this in a browser (`http://blog.localhost:3000/`). */
25
+ url: string;
26
+ /**
27
+ * The same server through plain `localhost` (`http://localhost:3000/`), for
28
+ * HTTP clients that resolve through the OS, which may not map `*.localhost`.
29
+ * Equal to `url` when the server has no dev hostname, or when its https
30
+ * certificate does not cover `localhost` (the named URL is then the only
31
+ * one that verifies).
32
+ */
33
+ loopbackUrl: string;
34
+ port: number;
35
+ pid: number;
36
+ }
37
+ export interface DevStatusWorktree {
38
+ /** The other worktree's root directory. */
39
+ path: string;
40
+ /** Short branch name, or null for a detached HEAD. */
41
+ branch: string | null;
42
+ /** The same app, inside that worktree. */
43
+ appRoot: string;
44
+ servers: DevStatusServer[];
45
+ }
46
+ /** The `timber dev status --json` contract. */
47
+ export interface DevStatusReport {
48
+ version: typeof DEV_STATUS_JSON_VERSION;
49
+ /** The app this checkout's servers were looked up for. */
50
+ appRoot: string;
51
+ /** Live servers serving this checkout. Reuse one of these. */
52
+ servers: DevStatusServer[];
53
+ /** Live servers in other git worktrees of the same app — different code. */
54
+ otherWorktrees: DevStatusWorktree[];
55
+ }
56
+ interface Worktree {
57
+ path: string;
58
+ branch: string | null;
59
+ }
60
+ /** Parse `git worktree list --porcelain`, skipping bare entries. */
61
+ export declare function parseWorktreeList(porcelain: string): Worktree[];
62
+ export declare function collectDevStatus(appRoot: string): Promise<DevStatusReport>;
63
+ export declare function formatDevStatus(report: DevStatusReport): string;
64
+ /**
65
+ * Resolve the app root the way `timber graph` does — the directory of the
66
+ * Vite config, found by walking up from the cwd unless `--config` names it —
67
+ * then print the report. Exits 0 whether or not servers are found ("no server"
68
+ * is an answer); throws only when there is no config to anchor on.
69
+ */
70
+ export declare function runDevStatus(options: {
71
+ config?: string;
72
+ json: boolean;
73
+ }): Promise<void>;
74
+ export {};
75
+ //# sourceMappingURL=cli-dev-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-dev-status.d.ts","sourceRoot":"","sources":["../src/cli-dev-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAaH,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,MAAM,WAAW,eAAe;IAC9B,2FAA2F;IAC3F,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,uBAAuB,CAAC;IACxC,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,4EAA4E;IAC5E,cAAc,EAAE,iBAAiB,EAAE,CAAC;CACrC;AAeD,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,oEAAoE;AACpE,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,EAAE,CAgB/D;AAqCD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAMhF;AASD,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAkB/D;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAW7F"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * `timber init` — point a project's agent instruction files at the guide
3
+ * that ships inside the installed `@timber-js/app` package.
4
+ *
5
+ * The guide (`node_modules/@timber-js/app/agent-skill.md`) is never copied.
6
+ * A copy freezes at the version `init` ran with; a pointer always reads the
7
+ * installed version. Each of `AGENTS.md` and `CLAUDE.md` gets one
8
+ * marker-delimited block that timber owns; everything outside the markers
9
+ * belongs to the user and is never touched.
10
+ *
11
+ * This module is also the single source of the block text: the
12
+ * create-timber-app templates are generated from `agentsFileContent()` /
13
+ * `claudeFileContent()` and a test fails if they drift.
14
+ *
15
+ * See design/11-platform.md §"`timber init` — agent guide pointer blocks".
16
+ */
17
+ export declare const BLOCK_START = "<!-- timber:start -->";
18
+ export declare const BLOCK_END = "<!-- timber:end -->";
19
+ /** Where the guide lives, relative to the project root, in a non-hoisted install. */
20
+ export declare const AGENT_GUIDE_PATH = "node_modules/@timber-js/app/agent-skill.md";
21
+ /** The AGENTS.md block: a plain pointer, for every AGENTS.md-reading tool. */
22
+ export declare function agentsBlock(guide?: string): string;
23
+ /**
24
+ * The CLAUDE.md block: Claude Code's `@path` imports, so the guide is
25
+ * loaded into every session instead of relying on the agent following a
26
+ * pointer. `@AGENTS.md` carries the user's own AGENTS.md content to Claude.
27
+ * A missing import target is skipped silently, so the block is harmless
28
+ * before `node_modules` exists.
29
+ */
30
+ export declare function claudeBlock(guide?: string): string;
31
+ /** A freshly created AGENTS.md: just the block. */
32
+ export declare function agentsFileContent(): string;
33
+ /** A freshly created CLAUDE.md: just the block. */
34
+ export declare function claudeFileContent(): string;
35
+ export type InitOutcome = {
36
+ kind: 'created';
37
+ } | {
38
+ kind: 'updated';
39
+ } | {
40
+ kind: 'appended';
41
+ } | {
42
+ kind: 'unchanged';
43
+ } | {
44
+ kind: 'replaced-legacy';
45
+ backup: string;
46
+ } | {
47
+ kind: 'replaced-symlink';
48
+ } | {
49
+ kind: 'skipped-symlink';
50
+ target: string;
51
+ };
52
+ /** What `init` will do to one file, decided before anything is written. */
53
+ interface Plan {
54
+ outcome: InitOutcome;
55
+ apply(): void;
56
+ }
57
+ /**
58
+ * Decide what to do with one file. Pure: reads, never writes. `runInit`
59
+ * plans both files before applying either, so an error in one (malformed
60
+ * markers) leaves both untouched.
61
+ */
62
+ export declare function planBlock(root: string, name: string, block: string): Plan;
63
+ /**
64
+ * Where the installed guide is, relative to `root`: `node_modules` in the
65
+ * project, or one a package manager hoisted to an ancestor (npm/yarn/bun
66
+ * workspaces). Null when no install is found (not installed yet, or Yarn PnP).
67
+ */
68
+ export declare function findAgentGuide(root: string): string | null;
69
+ /** Run `timber init` in `root`: plan both files, then write them. */
70
+ export declare function runInit(root: string): void;
71
+ export {};
72
+ //# sourceMappingURL=cli-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-init.d.ts","sourceRoot":"","sources":["../src/cli-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAcH,eAAO,MAAM,WAAW,0BAA0B,CAAC;AACnD,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAE/C,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,+CAA+C,CAAC;AAE7E,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,KAAK,GAAE,MAAyB,GAAG,MAAM,CAOpE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,GAAE,MAAyB,GAAG,MAAM,CAEpE;AAED,mDAAmD;AACnD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,mDAAmD;AACnD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAuBD,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE,GAC5B;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhD,2EAA2E;AAC3E,UAAU,IAAI;IACZ,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,IAAI,IAAI,CAAC;CACf;AAoDD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAuDzE;AAyBD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO1D;AAED,qEAAqE;AACrE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAyB1C"}
package/dist/cli.d.ts CHANGED
@@ -9,11 +9,11 @@ export interface ParsedArgs {
9
9
  config: string | undefined;
10
10
  /** `--project`: the tsconfig `timber check` passes to tsgo. */
11
11
  project: string | undefined;
12
- /** `timber graph` only: emit the machine-readable JSON contract. */
12
+ /** `timber graph` and `timber dev status`: emit the machine-readable JSON contract. */
13
13
  json: boolean;
14
14
  /** `timber graph` only: classify the whole project. */
15
15
  all: boolean;
16
- /** Positional arguments after the command (`schema sync`, `graph <file>`). */
16
+ /** Positional arguments after the command (`schema sync`, `dev status`, `graph <file>`). */
17
17
  rest: string[];
18
18
  }
19
19
  export interface CommandOptions {
@@ -43,7 +43,8 @@ export interface CommandOptions {
43
43
  *
44
44
  * Each subcommand declares its exact flags (the `check --project` precedent,
45
45
  * TIM-1332): `graph` additionally accepts a file positional plus `--json` and
46
- * `--all`, and those two are rejected everywhere else.
46
+ * `--all`, and those two are rejected everywhere else — except `--json`,
47
+ * which `dev status` accepts too.
47
48
  */
48
49
  export declare function parseArgs(args: string[]): ParsedArgs;
49
50
  /** @internal Dependency injection for testing. */
@@ -110,13 +111,4 @@ export declare function runCheck(options: CommandOptions, _deps?: CheckDeps): Pr
110
111
  * See design/41-global-params.md §Auto-Scaffolding
111
112
  */
112
113
  export declare function runSchema(args: string[]): Promise<void>;
113
- /**
114
- * `timber init` — write AGENTS.md (and a CLAUDE.md symlink to it) to the
115
- * project root so AI coding agents can discover timber.js documentation and
116
- * conventions.
117
- *
118
- * The content is read from the installed @timber-js/app package itself, so it
119
- * stays in sync with the installed version.
120
- */
121
- export declare function runInit(): Promise<void>;
122
114
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,QAAA,MAAM,QAAQ,YAAI,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAC1F,KAAK,OAAO,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzC,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,+DAA+D;IAC/D,OAAO,EAAE,MAAM,GAAG,SAA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C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAwDrF;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAMvF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBzF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAMxF;AAID;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6C7D"}
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- //#region src/cli.ts
2
+ // src/cli.ts
3
3
  var COMMANDS = [
4
4
  "dev",
5
5
  "build",
@@ -30,7 +30,8 @@ var COMMANDS = [
30
30
  *
31
31
  * Each subcommand declares its exact flags (the `check --project` precedent,
32
32
  * TIM-1332): `graph` additionally accepts a file positional plus `--json` and
33
- * `--all`, and those two are rejected everywhere else.
33
+ * `--all`, and those two are rejected everywhere else — except `--json`,
34
+ * which `dev status` accepts too.
34
35
  */
35
36
  function parseArgs(args) {
36
37
  if (args.length === 0) throw new Error("No command provided. Usage: timber <dev|build|preview|check|schema|init|graph> [--config <path>]");
@@ -46,18 +47,20 @@ function parseArgs(args) {
46
47
  if (arg === "--config" || arg === "-c") {
47
48
  config = args[++i];
48
49
  if (!config) throw new Error("--config requires a path argument");
49
- } else if (arg === "--json" || arg === "--all") {
50
- if (command !== "graph") throw new Error(`${arg} is only valid for \`timber graph\` (the module-environment query).`);
51
- if (arg === "--json") json = true;
52
- else all = true;
50
+ } else if (arg === "--json") json = true;
51
+ else if (arg === "--all") {
52
+ if (command !== "graph") throw new Error(`--all is only valid for \`timber graph\` (the module-environment query).`);
53
+ all = true;
53
54
  } else if (arg === "--project") {
54
55
  if (command !== "check") throw new Error(`--project is only valid for \`timber check\` (it names the tsconfig to type-check). To point \`timber ${command}\` at a different Vite config, use --config <path>.`);
55
56
  project = args[++i];
56
57
  if (!project) throw new Error("--project requires a path argument");
57
58
  } else if (arg.startsWith("-")) throw new Error(`Unknown option: ${arg}. The timber CLI accepts --config <path> (and --project <path> for \`check\`).${arg === "--port" || arg === "-p" ? " To change the port, set the PORT environment variable (PORT=4000 timber dev) or server.port in vite.config.ts." : ""}`);
58
- else if (command === "schema" || command === "init" || command === "graph") rest.push(arg);
59
+ else if (command === "schema" || command === "init" || command === "graph" || command === "dev" && rest.length === 0 && arg === "status") rest.push(arg);
59
60
  else throw new Error(`Unexpected argument: ${arg}. Usage: timber ${command} [--config <path>]`);
60
61
  }
62
+ const devStatus = command === "dev" && rest[0] === "status";
63
+ if (json && command !== "graph" && !devStatus) throw new Error(`--json is only valid for \`timber graph\` and \`timber dev status\`.`);
61
64
  if (command === "graph" && rest.length > 1) throw new Error(`timber graph takes one file. Usage: timber graph <file> [--json], or timber graph --all --json`);
62
65
  return {
63
66
  command,
@@ -90,7 +93,7 @@ async function runDev(options, _deps) {
90
93
  return;
91
94
  }
92
95
  const { fork } = await import("node:child_process");
93
- const { RESTART_EXIT_CODE } = await import("./_chunks/dev-server-BiWNMBVU.js");
96
+ const { RESTART_EXIT_CODE } = await import("./_chunks/dev-server-CBvvM7Lr.js");
94
97
  while (true) {
95
98
  const result = await new Promise((resolve) => {
96
99
  const child = fork(process.argv[1], process.argv.slice(2), {
@@ -142,8 +145,8 @@ async function runBuild(options, _deps) {
142
145
  * exists but fails to load throws, naming the file (TIM-1066).
143
146
  */
144
147
  async function runPreview(options, _deps) {
145
- const { resolveTimberContext } = await import("./_chunks/cli-context-BJQB6rtF.js");
146
- const { adapterConfig, contextAdapter } = await import("./_chunks/plugin-context-uDHFqHHJ.js");
148
+ const { resolveTimberContext } = await import("./_chunks/cli-context-n5hmkdla.js");
149
+ const { adapterConfig, contextAdapter } = await import("./_chunks/plugin-context-BfSRKJfz.js");
147
150
  const ctx = await resolveTimberContext("preview", options.config, _deps?.resolveViteConfig);
148
151
  const adapter = contextAdapter(ctx);
149
152
  if (typeof adapter?.preview !== "function") {
@@ -170,7 +173,7 @@ async function runPreview(options, _deps) {
170
173
  * `--project` names the tsconfig handed to tsgo.
171
174
  */
172
175
  async function runCheck(options, _deps) {
173
- const { checkRoutes, runTypeCheck } = await import("./_chunks/cli-check-DDwCkeDY.js");
176
+ const { checkRoutes, runTypeCheck } = await import("./_chunks/cli-check-Dv3f8d2j.js");
174
177
  const { root } = await checkRoutes({ viteConfigFile: options.config }, _deps);
175
178
  await runTypeCheck({
176
179
  root,
@@ -186,7 +189,7 @@ async function runCheck(options, _deps) {
186
189
  async function runSchema(args) {
187
190
  const subcommand = args[0];
188
191
  if (subcommand !== "sync") throw new Error(`Unknown schema subcommand: ${subcommand ?? "(none)"}. Usage: timber schema sync`);
189
- const { runSchemaSync, defaultCodecForSegment } = await import("./_chunks/cli-schema-sync-CLNfXQDK.js");
192
+ const { runSchemaSync, defaultCodecForSegment } = await import("./_chunks/cli-schema-sync-uq72EZmD.js");
190
193
  const result = runSchemaSync(process.cwd());
191
194
  if (result.filesystemSegments.length === 0) {
192
195
  console.log("[timber] No dynamic segments found in app/.");
@@ -210,43 +213,6 @@ async function runSchema(args) {
210
213
  for (const seg of result.removedSegments) console.log(` - ${seg}`);
211
214
  }
212
215
  }
213
- /**
214
- * `timber init` — write AGENTS.md (and a CLAUDE.md symlink to it) to the
215
- * project root so AI coding agents can discover timber.js documentation and
216
- * conventions.
217
- *
218
- * The content is read from the installed @timber-js/app package itself, so it
219
- * stays in sync with the installed version.
220
- */
221
- async function runInit() {
222
- const { readFileSync, writeFileSync, existsSync, symlinkSync } = await import("node:fs");
223
- const { resolve, dirname } = await import("node:path");
224
- const { fileURLToPath } = await import("node:url");
225
- const root = process.cwd();
226
- const agentSkillPath = resolve(resolve(dirname(fileURLToPath(import.meta.url)), ".."), "agent-skill.md");
227
- if (!existsSync(agentSkillPath)) throw new Error("agent-skill.md not found in @timber-js/app package. This may be a development install — try reinstalling.");
228
- const agentSkill = readFileSync(agentSkillPath, "utf-8");
229
- const agentsPath = resolve(root, "AGENTS.md");
230
- const claudePath = resolve(root, "CLAUDE.md");
231
- const wrote = [];
232
- if (existsSync(agentsPath)) console.log("[timber] AGENTS.md already exists — skipping (delete it first to regenerate)");
233
- else {
234
- writeFileSync(agentsPath, agentSkill);
235
- wrote.push("AGENTS.md");
236
- }
237
- if (existsSync(claudePath)) console.log("[timber] CLAUDE.md already exists — skipping (delete it first to regenerate)");
238
- else try {
239
- symlinkSync("AGENTS.md", claudePath, "file");
240
- wrote.push("CLAUDE.md (symlink)");
241
- } catch {
242
- writeFileSync(claudePath, "Read AGENTS.md for project context and conventions.\n");
243
- wrote.push("CLAUDE.md");
244
- }
245
- if (wrote.length > 0) {
246
- console.log(`[timber] Created ${wrote.join(" and ")} — AI agents can now discover timber.js docs.`);
247
- console.log("[timber] Full documentation: node_modules/@timber-js/app/docs/");
248
- } else console.log("[timber] Nothing to do — both files already exist.");
249
- }
250
216
  async function main() {
251
217
  const parsed = parseArgs(process.argv.slice(2));
252
218
  const options = {
@@ -255,7 +221,13 @@ async function main() {
255
221
  };
256
222
  switch (parsed.command) {
257
223
  case "dev":
258
- await runDev(options);
224
+ if (parsed.rest[0] === "status") {
225
+ const { runDevStatus } = await import("./_chunks/cli-dev-status-prPMLU8G.js");
226
+ await runDevStatus({
227
+ config: parsed.config,
228
+ json: parsed.json
229
+ });
230
+ } else await runDev(options);
259
231
  break;
260
232
  case "build":
261
233
  await runBuild(options);
@@ -269,9 +241,11 @@ async function main() {
269
241
  case "schema":
270
242
  await runSchema(parsed.rest);
271
243
  break;
272
- case "init":
273
- await runInit();
244
+ case "init": {
245
+ const { runInit } = await import("./_chunks/cli-init-BoXOYYil.js");
246
+ runInit(process.cwd());
274
247
  break;
248
+ }
275
249
  case "graph": {
276
250
  const { runGraph } = await import("./analyze/graph-command.js");
277
251
  await runGraph({
@@ -288,7 +262,6 @@ if (typeof process !== "undefined" && process.argv[1] && (import.meta.url.endsWi
288
262
  console.error(err.message);
289
263
  process.exit(1);
290
264
  });
291
- //#endregion
292
- export { parseArgs, runBuild, runCheck, runDev, runInit, runPreview, runSchema };
265
+ export { parseArgs, runBuild, runCheck, runDev, runPreview, runSchema };
293
266
 
294
267
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n// timber.js CLI\n//\n// Wraps Vite commands with timber-specific behavior.\n// See design/18-build-system.md §\"CLI\".\n//\n// Commands:\n// timber dev — Start Vite dev server with HMR\n// timber build — Run multi-environment build via createBuilder/buildApp\n// timber preview — Serve the production build\n// timber check — Validate types + routes without building\n// timber graph — Classify a file's module environment(s) (design/47)\n\n// Type-only — the implementation is imported dynamically inside runCheck so the\n// CLI's other commands never load the route scanner.\nimport type { CheckDeps } from './cli-check.ts';\nimport type { ResolveViteConfig } from './cli-context.ts';\n\nexport type { CheckDeps };\n\nconst COMMANDS = ['dev', 'build', 'preview', 'check', 'schema', 'init', 'graph'] as const;\ntype Command = (typeof COMMANDS)[number];\n\nexport interface ParsedArgs {\n command: Command;\n config: string | undefined;\n /** `--project`: the tsconfig `timber check` passes to tsgo. */\n project: string | undefined;\n /** `timber graph` only: emit the machine-readable JSON contract. */\n json: boolean;\n /** `timber graph` only: classify the whole project. */\n all: boolean;\n /** Positional arguments after the command (`schema sync`, `graph <file>`). */\n rest: string[];\n}\n\nexport interface CommandOptions {\n /** Path to a Vite config file. Means the same thing for every command. */\n config?: string;\n /** `timber check` only: the tsconfig to type-check. */\n project?: string;\n}\n\n/**\n * Parse CLI arguments into a structured command + options.\n * Accepts: timber <command> [--config|-c <path>] [--project <path>]\n *\n * `--config` names a **Vite** config file for every command, `check` included\n * (TIM-1332): `check` resolves the project through Vite, so a project that\n * builds with `--config ./custom.vite.config.ts` has to be checkable the same\n * way. `--project` names the tsconfig, spelled as tsgo and tsc spell it, and\n * is meaningful only for `check`.\n *\n * Before TIM-1332 `--config` meant the tsconfig for `check` alone — one flag\n * with two meanings, which the docs had to carry a note to explain and which\n * left custom Vite configs unreachable from `check` entirely.\n *\n * Unknown flags are an error, not silently ignored — `timber dev --port 4000`\n * starting on the default port would contradict fail-loudly. The surface stays\n * deliberately small (design/11-platform.md §CLI); port selection goes through\n * the PORT env var or server.port in vite.config.ts.\n *\n * Each subcommand declares its exact flags (the `check --project` precedent,\n * TIM-1332): `graph` additionally accepts a file positional plus `--json` and\n * `--all`, and those two are rejected everywhere else.\n */\nexport function parseArgs(args: string[]): ParsedArgs {\n if (args.length === 0) {\n throw new Error(\n 'No command provided. Usage: timber <dev|build|preview|check|schema|init|graph> [--config <path>]'\n );\n }\n\n const command = args[0];\n if (!COMMANDS.includes(command as Command)) {\n throw new Error(`Unknown command: ${command}. Available commands: ${COMMANDS.join(', ')}`);\n }\n\n let config: string | undefined;\n let project: string | undefined;\n let json = false;\n let all = false;\n const rest: string[] = [];\n for (let i = 1; i < args.length; i++) {\n const arg = args[i];\n if (arg === '--config' || arg === '-c') {\n config = args[++i];\n if (!config) {\n throw new Error('--config requires a path argument');\n }\n } else if (arg === '--json' || arg === '--all') {\n if (command !== 'graph') {\n throw new Error(\n `${arg} is only valid for \\`timber graph\\` (the module-environment query).`\n );\n }\n if (arg === '--json') json = true;\n else all = true;\n } else if (arg === '--project') {\n if (command !== 'check') {\n throw new Error(\n `--project is only valid for \\`timber check\\` (it names the tsconfig to type-check). ` +\n `To point \\`timber ${command}\\` at a different Vite config, use --config <path>.`\n );\n }\n project = args[++i];\n if (!project) {\n throw new Error('--project requires a path argument');\n }\n } else if (arg.startsWith('-')) {\n const portHint =\n arg === '--port' || arg === '-p'\n ? ' To change the port, set the PORT environment variable (PORT=4000 timber dev) ' +\n 'or server.port in vite.config.ts.'\n : '';\n throw new Error(\n `Unknown option: ${arg}. The timber CLI accepts --config <path>` +\n ` (and --project <path> for \\`check\\`).${portHint}`\n );\n } else if (command === 'schema' || command === 'init' || command === 'graph') {\n rest.push(arg);\n } else {\n throw new Error(`Unexpected argument: ${arg}. Usage: timber ${command} [--config <path>]`);\n }\n }\n\n if (command === 'graph' && rest.length > 1) {\n throw new Error(\n `timber graph takes one file. Usage: timber graph <file> [--json], or timber graph --all --json`\n );\n }\n\n return { command: command as Command, config, project, json, all, rest };\n}\n\n// ─── Command Implementations ─────────────────────────────────────────────────\n\n/** @internal Dependency injection for testing. */\nexport interface ViteDeps {\n createServer?: typeof import('vite').createServer;\n createBuilder?: typeof import('vite').createBuilder;\n resolveViteConfig?: ResolveViteConfig;\n}\n\n/**\n * Start the Vite dev server with a supervisor that respawns the process\n * when timber.config.ts changes. Node's require cache for ESM modules\n * loaded via require() cannot be evicted, so an in-process restart\n * serves stale config. The supervisor forks a worker; when the worker\n * exits with RESTART_EXIT_CODE (set by timber-dev-server on config file\n * change), the supervisor spawns a fresh worker with a clean cache.\n *\n * The timber plugin binds the port immediately with a holding page\n * (in rootSync's config hook) so browsers see a \"starting...\" page\n * instead of ERR_CONNECTION_REFUSED during initialization.\n *\n * See design/21-dev-server.md, TIM-665, TIM-1444.\n */\nexport async function runDev(options: CommandOptions, _deps?: ViteDeps): Promise<void> {\n // Worker mode: run the dev server directly (forked by supervisor below)\n if (process.env.__TIMBER_DEV_WORKER) {\n const createServer = _deps?.createServer ?? (await import('vite')).createServer;\n const server = await createServer({\n configFile: options.config,\n });\n await server.listen();\n server.printUrls();\n return;\n }\n\n // Supervisor mode: fork a worker and respawn on config changes.\n const { fork } = await import('node:child_process');\n const { RESTART_EXIT_CODE } = await import('./plugins/dev-server.ts');\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const result = await new Promise<{ code: number | null; signal: NodeJS.Signals | null }>(\n (resolve) => {\n const child = fork(process.argv[1], process.argv.slice(2), {\n stdio: 'inherit',\n env: { ...process.env, __TIMBER_DEV_WORKER: '1' },\n });\n\n // Forward signals to the child. SIGINT from Ctrl+C is sent to\n // the entire process group, but a targeted SIGTERM (from a\n // process manager or test teardown) only reaches the parent.\n const onSigint = () => child.kill('SIGINT');\n const onSigterm = () => child.kill('SIGTERM');\n process.on('SIGINT', onSigint);\n process.on('SIGTERM', onSigterm);\n\n child.on('exit', (code, signal) => {\n process.off('SIGINT', onSigint);\n process.off('SIGTERM', onSigterm);\n resolve({ code, signal });\n });\n }\n );\n\n if (result.code === RESTART_EXIT_CODE) {\n continue;\n }\n\n // Child was killed by a signal (e.g. SIGTERM) — re-raise on ourselves\n if (result.signal) {\n process.kill(process.pid, result.signal);\n }\n\n if (result.code != null && result.code !== 0) {\n process.exit(result.code);\n }\n\n break;\n }\n}\n\n/**\n * Run the production build using createBuilder + buildApp.\n * Direct build() calls do NOT trigger the RSC plugin's multi-environment\n * pipeline — createBuilder/buildApp is required.\n */\nexport async function runBuild(options: CommandOptions, _deps?: ViteDeps): Promise<void> {\n const createBuilder = _deps?.createBuilder ?? (await import('vite')).createBuilder;\n const builder = await createBuilder({\n configFile: options.config,\n });\n await builder.buildApp();\n}\n\n/**\n * Serve the production build for local testing.\n * The adapter's preview() serves it; without one, preview fails (TIM-1565).\n * There is no fallback to Vite preview: it would serve the build directory\n * itself — the server bundles as static files, with no root `index.html` —\n * which is useless in either output mode.\n *\n * The project is resolved through Vite, as `timber check` resolves it\n * (`cli-context.ts`), so the adapter, the output mode, and the build\n * directory are the ones `timber build` used — including `--config`, inline\n * `timber({ ... })` options, Vite's `root`, and `build.outDir`, none of which\n * a re-read of `timber.config.ts` can see (TIM-1531). A config file that\n * exists but fails to load throws, naming the file (TIM-1066).\n */\nexport async function runPreview(options: CommandOptions, _deps?: ViteDeps): Promise<void> {\n const { resolveTimberContext } = await import('./cli-context.ts');\n const { adapterConfig, contextAdapter } = await import('./plugin-context.ts');\n\n const ctx = await resolveTimberContext('preview', options.config, _deps?.resolveViteConfig);\n const adapter = contextAdapter(ctx);\n\n if (typeof adapter?.preview !== 'function') {\n const missing = adapter\n ? `The adapter '${adapter.name}' has no preview(), so \\`timber preview\\` cannot serve this build.`\n : `No adapter is configured, so \\`timber preview\\` has nothing to serve this build with.`;\n throw new Error(\n `[timber] ${missing} Use an adapter that implements preview() — ` +\n `cloudflare() from '@timber-js/app/adapters/cloudflare', or nitro() from ` +\n `'@timber-js/app/adapters/nitro' (any preset for a static build; node-server or bun ` +\n `for a server build) — or serve the build with your platform's own tooling.`\n );\n }\n\n await adapter.preview(adapterConfig(ctx), {\n output: ctx.config.output ?? 'server',\n outputDir: ctx.buildDir,\n });\n}\n\n/**\n * Validate routes and types without producing build output.\n *\n * Runs the route pass first — resolve the project through Vite, scan it, fail\n * on proven-fatal convention errors, print warnings, and regenerate the route\n * types — then `tsgo --noEmit`. Codegen has to precede the type pass: the\n * generated `.timber/*.d.ts` files are what type `<Link href>` and\n * `useSegmentParams()`, and a fresh clone has never produced them. See\n * `cli-check.ts` for the full reasoning.\n *\n * `--config` names the **Vite** config, as it does for every other command, so\n * an app that builds with a custom one is checkable the same way.\n * `--project` names the tsconfig handed to tsgo.\n */\nexport async function runCheck(options: CommandOptions, _deps?: CheckDeps): Promise<void> {\n const { checkRoutes, runTypeCheck } = await import('./cli-check.ts');\n const { root } = await checkRoutes({ viteConfigFile: options.config }, _deps);\n // tsgo runs from the root the route pass resolved, not from cwd — that is\n // where it just wrote the declarations tsgo has to read.\n await runTypeCheck({ root, config: options.project }, _deps);\n}\n\n// ─── Schema Subcommand ───────────────────────────────────────────────────────\n\n/**\n * `timber schema sync` — scan filesystem for dynamic segments, diff against\n * app/schema.ts, and append missing entries with type-appropriate codec defaults.\n *\n * See design/41-global-params.md §Auto-Scaffolding\n */\nexport async function runSchema(args: string[]): Promise<void> {\n const subcommand = args[0];\n\n if (subcommand !== 'sync') {\n throw new Error(\n `Unknown schema subcommand: ${subcommand ?? '(none)'}. Usage: timber schema sync`\n );\n }\n\n const { runSchemaSync, defaultCodecForSegment } = await import('./cli-schema-sync.ts');\n const result = runSchemaSync(process.cwd());\n\n if (result.filesystemSegments.length === 0) {\n console.log('[timber] No dynamic segments found in app/.');\n return;\n }\n\n if (result.created) {\n console.log(`[timber] Created app/schema.ts with ${result.addedSegments.length} segment(s):`);\n for (const seg of result.addedSegments) {\n console.log(` + ${seg}: ${defaultCodecForSegment(seg)}`);\n }\n return;\n }\n\n if (result.addedSegments.length === 0 && result.removedSegments.length === 0) {\n console.log('[timber] Schema is up to date — all segments are registered.');\n return;\n }\n\n if (result.addedSegments.length > 0) {\n console.log(`[timber] Added ${result.addedSegments.length} segment(s) to app/schema.ts:`);\n for (const seg of result.addedSegments) {\n console.log(` + ${seg}: ${defaultCodecForSegment(seg)}`);\n }\n }\n\n if (result.removedSegments.length > 0) {\n console.log(\n `[timber] Removed ${result.removedSegments.length} stale segment(s) from app/schema.ts:`\n );\n for (const seg of result.removedSegments) {\n console.log(` - ${seg}`);\n }\n }\n}\n\n// ─── Init Subcommand ─────────────────────────────────────────────────────────\n\n/**\n * `timber init` — write AGENTS.md (and a CLAUDE.md symlink to it) to the\n * project root so AI coding agents can discover timber.js documentation and\n * conventions.\n *\n * The content is read from the installed @timber-js/app package itself, so it\n * stays in sync with the installed version.\n */\nexport async function runInit(): Promise<void> {\n const { readFileSync, writeFileSync, existsSync, symlinkSync } = await import('node:fs');\n const { resolve, dirname } = await import('node:path');\n const { fileURLToPath } = await import('node:url');\n\n const root = process.cwd();\n const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');\n\n const agentSkillPath = resolve(packageRoot, 'agent-skill.md');\n if (!existsSync(agentSkillPath)) {\n throw new Error(\n 'agent-skill.md not found in @timber-js/app package. ' +\n 'This may be a development install — try reinstalling.'\n );\n }\n\n const agentSkill = readFileSync(agentSkillPath, 'utf-8');\n\n const agentsPath = resolve(root, 'AGENTS.md');\n const claudePath = resolve(root, 'CLAUDE.md');\n\n const wrote: string[] = [];\n\n if (existsSync(agentsPath)) {\n console.log('[timber] AGENTS.md already exists — skipping (delete it first to regenerate)');\n } else {\n writeFileSync(agentsPath, agentSkill);\n wrote.push('AGENTS.md');\n }\n\n if (existsSync(claudePath)) {\n console.log('[timber] CLAUDE.md already exists — skipping (delete it first to regenerate)');\n } else {\n try {\n // Relative target so the link survives the project directory moving.\n // The 'file' type argument is required for Windows (ignored elsewhere).\n symlinkSync('AGENTS.md', claudePath, 'file');\n wrote.push('CLAUDE.md (symlink)');\n } catch {\n // Windows without Developer Mode or admin rights can't create symlinks\n // (EPERM) — fall back to a plain pointer file.\n writeFileSync(claudePath, 'Read AGENTS.md for project context and conventions.\\n');\n wrote.push('CLAUDE.md');\n }\n }\n\n if (wrote.length > 0) {\n console.log(\n `[timber] Created ${wrote.join(' and ')} — AI agents can now discover timber.js docs.`\n );\n console.log('[timber] Full documentation: node_modules/@timber-js/app/docs/');\n } else {\n console.log('[timber] Nothing to do — both files already exist.');\n }\n}\n\n// ─── Main Entry Point ────────────────────────────────────────────────────────\n\nasync function main(): Promise<void> {\n const parsed = parseArgs(process.argv.slice(2));\n const options: CommandOptions = { config: parsed.config, project: parsed.project };\n\n switch (parsed.command) {\n case 'dev':\n await runDev(options);\n break;\n case 'build':\n await runBuild(options);\n break;\n case 'preview':\n await runPreview(options);\n break;\n case 'check':\n await runCheck(options);\n break;\n case 'schema':\n await runSchema(parsed.rest);\n break;\n case 'init':\n await runInit();\n break;\n case 'graph': {\n // Lazy import — the graph implementation (and, on a cache miss,\n // Vite + the crawl child) never loads for the other commands.\n const { runGraph } = await import('./analyze/graph-command.ts');\n await runGraph({\n file: parsed.rest[0],\n config: parsed.config,\n json: parsed.json,\n all: parsed.all,\n });\n break;\n }\n }\n}\n\n// Run main when executed as a CLI (not imported in tests).\n// The bin shim (bin/timber.mjs) does `import '../dist/cli.js'`, so\n// process.argv[1] points to the shim, not this file. We check both:\n// direct execution AND being imported by the timber bin shim.\nconst isDirectExecution =\n typeof process !== 'undefined' &&\n process.argv[1] &&\n (import.meta.url.endsWith(process.argv[1]) ||\n process.argv[1].endsWith('bin/timber.mjs') ||\n process.argv[1].endsWith('bin/timber'));\n\nif (isDirectExecution) {\n main().catch((err) => {\n console.error(err.message);\n process.exit(1);\n });\n}\n"],"mappings":";;AAqBA,IAAM,WAAW;CAAC;CAAO;CAAS;CAAW;CAAS;CAAU;CAAQ;AAAO;;;;;;;;;;;;;;;;;;;;;;;;AA8C/E,SAAgB,UAAU,MAA4B;CACpD,IAAI,KAAK,WAAW,GAClB,MAAM,IAAI,MACR,kGACF;CAGF,MAAM,UAAU,KAAK;CACrB,IAAI,CAAC,SAAS,SAAS,OAAkB,GACvC,MAAM,IAAI,MAAM,oBAAoB,QAAQ,wBAAwB,SAAS,KAAK,IAAI,GAAG;CAG3F,IAAI;CACJ,IAAI;CACJ,IAAI,OAAO;CACX,IAAI,MAAM;CACV,MAAM,OAAiB,CAAC;CACxB,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,MAAM,KAAK;EACjB,IAAI,QAAQ,cAAc,QAAQ,MAAM;GACtC,SAAS,KAAK,EAAE;GAChB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,mCAAmC;EAEvD,OAAO,IAAI,QAAQ,YAAY,QAAQ,SAAS;GAC9C,IAAI,YAAY,SACd,MAAM,IAAI,MACR,GAAG,IAAI,oEACT;GAEF,IAAI,QAAQ,UAAU,OAAO;QACxB,MAAM;EACb,OAAO,IAAI,QAAQ,aAAa;GAC9B,IAAI,YAAY,SACd,MAAM,IAAI,MACR,yGACuB,QAAQ,oDACjC;GAEF,UAAU,KAAK,EAAE;GACjB,IAAI,CAAC,SACH,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BAAgB,KACzC,QAAQ,KAAK,EAAE,CAAC,SAAS,YAAY,IAGvC,KAAK,CAAC,CAAC,OAAO,QAAQ;CACpB,QAAQ,MAAM,IAAI,OAAO;CACzB,QAAQ,KAAK,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n// timber.js CLI\n//\n// Wraps Vite commands with timber-specific behavior.\n// See design/18-build-system.md §\"CLI\".\n//\n// Commands:\n// timber dev — Start Vite dev server with HMR\n// timber build — Run multi-environment build via createBuilder/buildApp\n// timber preview — Serve the production build\n// timber check — Validate types + routes without building\n// timber graph — Classify a file's module environment(s) (design/47)\n// timber dev status — List running dev servers for this checkout (design/21)\n// timber init — Point AGENTS.md / CLAUDE.md at the installed agent guide\n\n// Type-only — the implementation is imported dynamically inside runCheck so the\n// CLI's other commands never load the route scanner.\nimport type { CheckDeps } from './cli-check.ts';\nimport type { ResolveViteConfig } from './cli-context.ts';\n\nexport type { CheckDeps };\n\nconst COMMANDS = ['dev', 'build', 'preview', 'check', 'schema', 'init', 'graph'] as const;\ntype Command = (typeof COMMANDS)[number];\n\nexport interface ParsedArgs {\n command: Command;\n config: string | undefined;\n /** `--project`: the tsconfig `timber check` passes to tsgo. */\n project: string | undefined;\n /** `timber graph` and `timber dev status`: emit the machine-readable JSON contract. */\n json: boolean;\n /** `timber graph` only: classify the whole project. */\n all: boolean;\n /** Positional arguments after the command (`schema sync`, `dev status`, `graph <file>`). */\n rest: string[];\n}\n\nexport interface CommandOptions {\n /** Path to a Vite config file. Means the same thing for every command. */\n config?: string;\n /** `timber check` only: the tsconfig to type-check. */\n project?: string;\n}\n\n/**\n * Parse CLI arguments into a structured command + options.\n * Accepts: timber <command> [--config|-c <path>] [--project <path>]\n *\n * `--config` names a **Vite** config file for every command, `check` included\n * (TIM-1332): `check` resolves the project through Vite, so a project that\n * builds with `--config ./custom.vite.config.ts` has to be checkable the same\n * way. `--project` names the tsconfig, spelled as tsgo and tsc spell it, and\n * is meaningful only for `check`.\n *\n * Before TIM-1332 `--config` meant the tsconfig for `check` alone — one flag\n * with two meanings, which the docs had to carry a note to explain and which\n * left custom Vite configs unreachable from `check` entirely.\n *\n * Unknown flags are an error, not silently ignored — `timber dev --port 4000`\n * starting on the default port would contradict fail-loudly. The surface stays\n * deliberately small (design/11-platform.md §CLI); port selection goes through\n * the PORT env var or server.port in vite.config.ts.\n *\n * Each subcommand declares its exact flags (the `check --project` precedent,\n * TIM-1332): `graph` additionally accepts a file positional plus `--json` and\n * `--all`, and those two are rejected everywhere else — except `--json`,\n * which `dev status` accepts too.\n */\nexport function parseArgs(args: string[]): ParsedArgs {\n if (args.length === 0) {\n throw new Error(\n 'No command provided. Usage: timber <dev|build|preview|check|schema|init|graph> [--config <path>]'\n );\n }\n\n const command = args[0];\n if (!COMMANDS.includes(command as Command)) {\n throw new Error(`Unknown command: ${command}. Available commands: ${COMMANDS.join(', ')}`);\n }\n\n let config: string | undefined;\n let project: string | undefined;\n let json = false;\n let all = false;\n const rest: string[] = [];\n for (let i = 1; i < args.length; i++) {\n const arg = args[i];\n if (arg === '--config' || arg === '-c') {\n config = args[++i];\n if (!config) {\n throw new Error('--config requires a path argument');\n }\n } else if (arg === '--json') {\n json = true;\n } else if (arg === '--all') {\n if (command !== 'graph') {\n throw new Error(`--all is only valid for \\`timber graph\\` (the module-environment query).`);\n }\n all = true;\n } else if (arg === '--project') {\n if (command !== 'check') {\n throw new Error(\n `--project is only valid for \\`timber check\\` (it names the tsconfig to type-check). ` +\n `To point \\`timber ${command}\\` at a different Vite config, use --config <path>.`\n );\n }\n project = args[++i];\n if (!project) {\n throw new Error('--project requires a path argument');\n }\n } else if (arg.startsWith('-')) {\n const portHint =\n arg === '--port' || arg === '-p'\n ? ' To change the port, set the PORT environment variable (PORT=4000 timber dev) ' +\n 'or server.port in vite.config.ts.'\n : '';\n throw new Error(\n `Unknown option: ${arg}. The timber CLI accepts --config <path>` +\n ` (and --project <path> for \\`check\\`).${portHint}`\n );\n } else if (\n command === 'schema' ||\n command === 'init' ||\n command === 'graph' ||\n (command === 'dev' && rest.length === 0 && arg === 'status')\n ) {\n rest.push(arg);\n } else {\n throw new Error(`Unexpected argument: ${arg}. Usage: timber ${command} [--config <path>]`);\n }\n }\n\n // Checked after the loop so flag order does not matter (`dev --json status`).\n const devStatus = command === 'dev' && rest[0] === 'status';\n if (json && command !== 'graph' && !devStatus) {\n throw new Error(`--json is only valid for \\`timber graph\\` and \\`timber dev status\\`.`);\n }\n\n if (command === 'graph' && rest.length > 1) {\n throw new Error(\n `timber graph takes one file. Usage: timber graph <file> [--json], or timber graph --all --json`\n );\n }\n\n return { command: command as Command, config, project, json, all, rest };\n}\n\n// ─── Command Implementations ─────────────────────────────────────────────────\n\n/** @internal Dependency injection for testing. */\nexport interface ViteDeps {\n createServer?: typeof import('vite').createServer;\n createBuilder?: typeof import('vite').createBuilder;\n resolveViteConfig?: ResolveViteConfig;\n}\n\n/**\n * Start the Vite dev server with a supervisor that respawns the process\n * when timber.config.ts changes. Node's require cache for ESM modules\n * loaded via require() cannot be evicted, so an in-process restart\n * serves stale config. The supervisor forks a worker; when the worker\n * exits with RESTART_EXIT_CODE (set by timber-dev-server on config file\n * change), the supervisor spawns a fresh worker with a clean cache.\n *\n * The timber plugin binds the port immediately with a holding page\n * (in rootSync's config hook) so browsers see a \"starting...\" page\n * instead of ERR_CONNECTION_REFUSED during initialization.\n *\n * See design/21-dev-server.md, TIM-665, TIM-1444.\n */\nexport async function runDev(options: CommandOptions, _deps?: ViteDeps): Promise<void> {\n // Worker mode: run the dev server directly (forked by supervisor below)\n if (process.env.__TIMBER_DEV_WORKER) {\n const createServer = _deps?.createServer ?? (await import('vite')).createServer;\n const server = await createServer({\n configFile: options.config,\n });\n await server.listen();\n server.printUrls();\n return;\n }\n\n // Supervisor mode: fork a worker and respawn on config changes.\n const { fork } = await import('node:child_process');\n const { RESTART_EXIT_CODE } = await import('./plugins/dev-server.ts');\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const result = await new Promise<{ code: number | null; signal: NodeJS.Signals | null }>(\n (resolve) => {\n const child = fork(process.argv[1], process.argv.slice(2), {\n stdio: 'inherit',\n env: { ...process.env, __TIMBER_DEV_WORKER: '1' },\n });\n\n // Forward signals to the child. SIGINT from Ctrl+C is sent to\n // the entire process group, but a targeted SIGTERM (from a\n // process manager or test teardown) only reaches the parent.\n const onSigint = () => child.kill('SIGINT');\n const onSigterm = () => child.kill('SIGTERM');\n process.on('SIGINT', onSigint);\n process.on('SIGTERM', onSigterm);\n\n child.on('exit', (code, signal) => {\n process.off('SIGINT', onSigint);\n process.off('SIGTERM', onSigterm);\n resolve({ code, signal });\n });\n }\n );\n\n if (result.code === RESTART_EXIT_CODE) {\n continue;\n }\n\n // Child was killed by a signal (e.g. SIGTERM) — re-raise on ourselves\n if (result.signal) {\n process.kill(process.pid, result.signal);\n }\n\n if (result.code != null && result.code !== 0) {\n process.exit(result.code);\n }\n\n break;\n }\n}\n\n/**\n * Run the production build using createBuilder + buildApp.\n * Direct build() calls do NOT trigger the RSC plugin's multi-environment\n * pipeline — createBuilder/buildApp is required.\n */\nexport async function runBuild(options: CommandOptions, _deps?: ViteDeps): Promise<void> {\n const createBuilder = _deps?.createBuilder ?? (await import('vite')).createBuilder;\n const builder = await createBuilder({\n configFile: options.config,\n });\n await builder.buildApp();\n}\n\n/**\n * Serve the production build for local testing.\n * The adapter's preview() serves it; without one, preview fails (TIM-1565).\n * There is no fallback to Vite preview: it would serve the build directory\n * itself — the server bundles as static files, with no root `index.html` —\n * which is useless in either output mode.\n *\n * The project is resolved through Vite, as `timber check` resolves it\n * (`cli-context.ts`), so the adapter, the output mode, and the build\n * directory are the ones `timber build` used — including `--config`, inline\n * `timber({ ... })` options, Vite's `root`, and `build.outDir`, none of which\n * a re-read of `timber.config.ts` can see (TIM-1531). A config file that\n * exists but fails to load throws, naming the file (TIM-1066).\n */\nexport async function runPreview(options: CommandOptions, _deps?: ViteDeps): Promise<void> {\n const { resolveTimberContext } = await import('./cli-context.ts');\n const { adapterConfig, contextAdapter } = await import('./plugin-context.ts');\n\n const ctx = await resolveTimberContext('preview', options.config, _deps?.resolveViteConfig);\n const adapter = contextAdapter(ctx);\n\n if (typeof adapter?.preview !== 'function') {\n const missing = adapter\n ? `The adapter '${adapter.name}' has no preview(), so \\`timber preview\\` cannot serve this build.`\n : `No adapter is configured, so \\`timber preview\\` has nothing to serve this build with.`;\n throw new Error(\n `[timber] ${missing} Use an adapter that implements preview() — ` +\n `cloudflare() from '@timber-js/app/adapters/cloudflare', or nitro() from ` +\n `'@timber-js/app/adapters/nitro' (any preset for a static build; node-server or bun ` +\n `for a server build) — or serve the build with your platform's own tooling.`\n );\n }\n\n await adapter.preview(adapterConfig(ctx), {\n output: ctx.config.output ?? 'server',\n outputDir: ctx.buildDir,\n });\n}\n\n/**\n * Validate routes and types without producing build output.\n *\n * Runs the route pass first — resolve the project through Vite, scan it, fail\n * on proven-fatal convention errors, print warnings, and regenerate the route\n * types — then `tsgo --noEmit`. Codegen has to precede the type pass: the\n * generated `.timber/*.d.ts` files are what type `<Link href>` and\n * `useSegmentParams()`, and a fresh clone has never produced them. See\n * `cli-check.ts` for the full reasoning.\n *\n * `--config` names the **Vite** config, as it does for every other command, so\n * an app that builds with a custom one is checkable the same way.\n * `--project` names the tsconfig handed to tsgo.\n */\nexport async function runCheck(options: CommandOptions, _deps?: CheckDeps): Promise<void> {\n const { checkRoutes, runTypeCheck } = await import('./cli-check.ts');\n const { root } = await checkRoutes({ viteConfigFile: options.config }, _deps);\n // tsgo runs from the root the route pass resolved, not from cwd — that is\n // where it just wrote the declarations tsgo has to read.\n await runTypeCheck({ root, config: options.project }, _deps);\n}\n\n// ─── Schema Subcommand ───────────────────────────────────────────────────────\n\n/**\n * `timber schema sync` — scan filesystem for dynamic segments, diff against\n * app/schema.ts, and append missing entries with type-appropriate codec defaults.\n *\n * See design/41-global-params.md §Auto-Scaffolding\n */\nexport async function runSchema(args: string[]): Promise<void> {\n const subcommand = args[0];\n\n if (subcommand !== 'sync') {\n throw new Error(\n `Unknown schema subcommand: ${subcommand ?? '(none)'}. Usage: timber schema sync`\n );\n }\n\n const { runSchemaSync, defaultCodecForSegment } = await import('./cli-schema-sync.ts');\n const result = runSchemaSync(process.cwd());\n\n if (result.filesystemSegments.length === 0) {\n console.log('[timber] No dynamic segments found in app/.');\n return;\n }\n\n if (result.created) {\n console.log(`[timber] Created app/schema.ts with ${result.addedSegments.length} segment(s):`);\n for (const seg of result.addedSegments) {\n console.log(` + ${seg}: ${defaultCodecForSegment(seg)}`);\n }\n return;\n }\n\n if (result.addedSegments.length === 0 && result.removedSegments.length === 0) {\n console.log('[timber] Schema is up to date — all segments are registered.');\n return;\n }\n\n if (result.addedSegments.length > 0) {\n console.log(`[timber] Added ${result.addedSegments.length} segment(s) to app/schema.ts:`);\n for (const seg of result.addedSegments) {\n console.log(` + ${seg}: ${defaultCodecForSegment(seg)}`);\n }\n }\n\n if (result.removedSegments.length > 0) {\n console.log(\n `[timber] Removed ${result.removedSegments.length} stale segment(s) from app/schema.ts:`\n );\n for (const seg of result.removedSegments) {\n console.log(` - ${seg}`);\n }\n }\n}\n\n// ─── Main Entry Point ────────────────────────────────────────────────────────\n\nasync function main(): Promise<void> {\n const parsed = parseArgs(process.argv.slice(2));\n const options: CommandOptions = { config: parsed.config, project: parsed.project };\n\n switch (parsed.command) {\n case 'dev':\n if (parsed.rest[0] === 'status') {\n const { runDevStatus } = await import('./cli-dev-status.ts');\n await runDevStatus({ config: parsed.config, json: parsed.json });\n } else {\n await runDev(options);\n }\n break;\n case 'build':\n await runBuild(options);\n break;\n case 'preview':\n await runPreview(options);\n break;\n case 'check':\n await runCheck(options);\n break;\n case 'schema':\n await runSchema(parsed.rest);\n break;\n case 'init': {\n const { runInit } = await import('./cli-init.ts');\n runInit(process.cwd());\n break;\n }\n case 'graph': {\n // Lazy import — the graph implementation (and, on a cache miss,\n // Vite + the crawl child) never loads for the other commands.\n const { runGraph } = await import('./analyze/graph-command.ts');\n await runGraph({\n file: parsed.rest[0],\n config: parsed.config,\n json: parsed.json,\n all: parsed.all,\n });\n break;\n }\n }\n}\n\n// Run main when executed as a CLI (not imported in tests).\n// The bin shim (bin/timber.mjs) does `import '../dist/cli.js'`, so\n// process.argv[1] points to the shim, not this file. We check both:\n// direct execution AND being imported by the timber bin shim.\nconst isDirectExecution =\n typeof process !== 'undefined' &&\n process.argv[1] &&\n (import.meta.url.endsWith(process.argv[1]) ||\n process.argv[1].endsWith('bin/timber.mjs') ||\n process.argv[1].endsWith('bin/timber'));\n\nif (isDirectExecution) {\n main().catch((err) => {\n console.error(err.message);\n process.exit(1);\n });\n}\n"],"mappings":";;AAuBA,IAAM,WAAW;CAAC;CAAO;CAAS;CAAW;CAAS;CAAU;CAAQ;AAAO;;;;;;;;;;;;;;;;;;;;;;;;;AA+C/E,SAAgB,UAAU,MAA4B;CACpD,IAAI,KAAK,WAAW,GAClB,MAAM,IAAI,MACR,kGACF;CAGF,MAAM,UAAU,KAAK;CACrB,IAAI,CAAC,SAAS,SAAS,OAAkB,GACvC,MAAM,IAAI,MAAM,oBAAoB,QAAQ,wBAAwB,SAAS,KAAK,IAAI,GAAG;CAG3F,IAAI;CACJ,IAAI;CACJ,IAAI,OAAO;CACX,IAAI,MAAM;CACV,MAAM,OAAiB,CAAC;CACxB,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,MAAM,KAAK;EACjB,IAAI,QAAQ,cAAc,QAAQ,MAAM;GACtC,SAAS,KAAK,EAAE;GAChB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,mCAAmC;EAEvD,OAAO,IAAI,QAAQ,UACjB,OAAO;OACF,IAAI,QAAQ,SAAS;GAC1B,IAAI,YAAY,SACd,MAAM,IAAI,MAAM,0EAA0E;GAE5F,MAAM;EACR,OAAO,IAAI,QAAQ,aAAa;GAC9B,IAAI,YAAY,SACd,MAAM,I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unks/error-boundary-Bc8QPZuq.js";
3
+ export { t as DenyAncestryContext, n as TimberErrorBoundary } from "../_chunks/error-boundary-DRQXGWCp.js";
@@ -8,8 +8,28 @@
8
8
  * level would create separate instances per chunk. globalThis guarantees a
9
9
  * single instance regardless of duplication.
10
10
  *
11
+ * One context per React instance, not per process. Duplicated chunks share
12
+ * one React, so they share the context. A dev SSR program reload evaluates
13
+ * React and react-dom/server again, in the same process: the new renderer
14
+ * must get a context of its own. Handed the previous one, React logs
15
+ * "Detected multiple renderers concurrently rendering the same context
16
+ * provider" on every client-component edit, and the stale context keeps a
17
+ * piece of the discarded copy alive (TIM-1590).
18
+ *
11
19
  * See design/19-client-navigation.md §"Singleton Guarantee via globalThis"
12
20
  */
13
21
  import React from 'react';
14
- export declare function createGlobalContext<T>(key: string, defaultValue: T): React.Context<T>;
22
+ /** The part of a React instance a context comes from. */
23
+ export interface ContextFactory {
24
+ createContext?: typeof React.createContext;
25
+ }
26
+ /**
27
+ * The context `key` names for this React instance, created on first use.
28
+ * Pass the key as a `Symbol.for('…')` literal at the call site, so each key
29
+ * stays greppable in the build output (tests/bundle-singleton-audit.test.ts
30
+ * checks `__timber_nav_ctx`).
31
+ */
32
+ export declare function createGlobalContext<T>(key: symbol, defaultValue: T): React.Context<T>;
33
+ /** createGlobalContext for a given React instance. Exported for tests. */
34
+ export declare function createGlobalContextFor<T>(react: ContextFactory, key: symbol, defaultValue: T): React.Context<T>;
15
35
  //# sourceMappingURL=global-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"global-context.d.ts","sourceRoot":"","sources":["../../src/client/global-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAarF"}
1
+ {"version":3,"file":"global-context.d.ts","sourceRoot":"","sources":["../../src/client/global-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,OAAO,KAAK,CAAC,aAAa,CAAC;CAC5C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAErF;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,KAAK,EAAE,cAAc,EACrB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,CAAC,GACd,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAelB"}