@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
@@ -0,0 +1,278 @@
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
+
18
+ import {
19
+ existsSync,
20
+ lstatSync,
21
+ readFileSync,
22
+ readlinkSync,
23
+ realpathSync,
24
+ renameSync,
25
+ rmSync,
26
+ writeFileSync,
27
+ } from 'node:fs';
28
+ import { dirname, join, relative, resolve, sep } from 'node:path';
29
+
30
+ export const BLOCK_START = '<!-- timber:start -->';
31
+ export const BLOCK_END = '<!-- timber:end -->';
32
+
33
+ /** Where the guide lives, relative to the project root, in a non-hoisted install. */
34
+ export const AGENT_GUIDE_PATH = 'node_modules/@timber-js/app/agent-skill.md';
35
+
36
+ /** The AGENTS.md block: a plain pointer, for every AGENTS.md-reading tool. */
37
+ export function agentsBlock(guide: string = AGENT_GUIDE_PATH): string {
38
+ return [
39
+ BLOCK_START,
40
+ `This is a timber.js app. Before working, read \`${guide}\`.`,
41
+ 'It matches the installed timber version and updates when timber is upgraded.',
42
+ BLOCK_END,
43
+ ].join('\n');
44
+ }
45
+
46
+ /**
47
+ * The CLAUDE.md block: Claude Code's `@path` imports, so the guide is
48
+ * loaded into every session instead of relying on the agent following a
49
+ * pointer. `@AGENTS.md` carries the user's own AGENTS.md content to Claude.
50
+ * A missing import target is skipped silently, so the block is harmless
51
+ * before `node_modules` exists.
52
+ */
53
+ export function claudeBlock(guide: string = AGENT_GUIDE_PATH): string {
54
+ return [BLOCK_START, `@${guide}`, '@AGENTS.md', BLOCK_END].join('\n');
55
+ }
56
+
57
+ /** A freshly created AGENTS.md: just the block. */
58
+ export function agentsFileContent(): string {
59
+ return agentsBlock() + '\n';
60
+ }
61
+
62
+ /** A freshly created CLAUDE.md: just the block. */
63
+ export function claudeFileContent(): string {
64
+ return claudeBlock() + '\n';
65
+ }
66
+
67
+ /**
68
+ * Files timber wrote before the pointer model. A file matching one of
69
+ * these is timber's, not the user's, and is replaced (after a backup)
70
+ * rather than appended to. Anything else is user-authored.
71
+ */
72
+ function isLegacyCopy(content: string): boolean {
73
+ const trimmed = content.replace(/^\uFEFF/, '').trim();
74
+ const firstLine = trimmed.split(/\r?\n/, 1)[0].trim();
75
+ return (
76
+ // Old `timber init`: the full agent-skill.md copied into AGENTS.md.
77
+ firstLine === '# timber.js — AI Agent Skill' ||
78
+ // Old create-timber-app AGENTS.md.
79
+ firstLine === '# timber.js Project' ||
80
+ // Old create-timber-app CLAUDE.md, and old `init`'s Windows fallback.
81
+ trimmed === 'Read AGENTS.md for project context and conventions.' ||
82
+ // Old `init`'s CLAUDE.md symlink, checked out with core.symlinks=false:
83
+ // a regular file whose whole content is the link target.
84
+ trimmed === 'AGENTS.md'
85
+ );
86
+ }
87
+
88
+ export type InitOutcome =
89
+ | { kind: 'created' }
90
+ | { kind: 'updated' }
91
+ | { kind: 'appended' }
92
+ | { kind: 'unchanged' }
93
+ | { kind: 'replaced-legacy'; backup: string }
94
+ | { kind: 'replaced-symlink' }
95
+ | { kind: 'skipped-symlink'; target: string };
96
+
97
+ /** What `init` will do to one file, decided before anything is written. */
98
+ interface Plan {
99
+ outcome: InitOutcome;
100
+ apply(): void;
101
+ }
102
+
103
+ /** Indices of lines that are exactly `marker` (surrounding whitespace allowed). */
104
+ function markerLines(lines: string[], marker: string): number[] {
105
+ return lines.flatMap((line, i) => (line.trim() === marker ? [i] : []));
106
+ }
107
+
108
+ /**
109
+ * Replace the contents of an existing block, or return null when the file
110
+ * has none. A marker counts only on a line of its own, so prose or a code
111
+ * sample that mentions one is ordinary content. A start without an end (or
112
+ * the reverse, or two blocks) is a hand-edit we cannot interpret: fail
113
+ * loudly rather than append a second block or guess where the user's
114
+ * content ends. `eol` keeps a CRLF file CRLF.
115
+ */
116
+ function replaceBlock(content: string, block: string, file: string, eol: string): string | null {
117
+ // Split on \n only: a CRLF file's lines keep their \r, so every line
118
+ // outside the block is reassembled byte-for-byte.
119
+ const lines = content.split('\n');
120
+ const starts = markerLines(lines, BLOCK_START);
121
+ const ends = markerLines(lines, BLOCK_END);
122
+ if (starts.length === 0 && ends.length === 0) return null;
123
+ if (starts.length !== 1 || ends.length !== 1 || ends[0] < starts[0]) {
124
+ throw new Error(
125
+ `[timber] ${file} has malformed timber markers — expected exactly one ` +
126
+ `${BLOCK_START} line followed by one ${BLOCK_END} line. ` +
127
+ `Fix or remove them, then re-run \`timber init\`. Nothing was written.`
128
+ );
129
+ }
130
+ const blockLines = block.split('\n').map((line) => (eol === '\r\n' ? line + '\r' : line));
131
+ // The end-marker line carried its own \r; the block's last line now does.
132
+ return [...lines.slice(0, starts[0]), ...blockLines, ...lines.slice(ends[0] + 1)].join('\n');
133
+ }
134
+
135
+ /** `<file>.bak`, or `.bak.1`, `.bak.2`, … — never overwrites a backup. */
136
+ function freeBackupPath(path: string): string {
137
+ if (!existsSync(`${path}.bak`)) return `${path}.bak`;
138
+ for (let i = 1; ; i++) {
139
+ const candidate = `${path}.bak.${i}`;
140
+ if (!existsSync(candidate)) return candidate;
141
+ }
142
+ }
143
+
144
+ /** Both paths name the same file (case-insensitive filesystems included). */
145
+ function sameFile(a: string, b: string): boolean {
146
+ try {
147
+ return realpathSync.native(a) === realpathSync.native(b);
148
+ } catch {
149
+ return false;
150
+ }
151
+ }
152
+
153
+ /**
154
+ * Decide what to do with one file. Pure: reads, never writes. `runInit`
155
+ * plans both files before applying either, so an error in one (malformed
156
+ * markers) leaves both untouched.
157
+ */
158
+ export function planBlock(root: string, name: string, block: string): Plan {
159
+ const path = join(root, name);
160
+ const stat = lstatSync(path, { throwIfNoEntry: false });
161
+ const write = (content: string) => () => writeFileSync(path, content);
162
+
163
+ // timber never writes through a symlink: the target may be the sibling
164
+ // agent file (the CLAUDE block would land in AGENTS.md) or a file shared
165
+ // outside the project.
166
+ if (stat?.isSymbolicLink()) {
167
+ const agentsPath = join(root, 'AGENTS.md');
168
+ const target = resolve(root, readlinkSync(path));
169
+ // Old `init` made CLAUDE.md a symlink to AGENTS.md: that one is timber's,
170
+ // so it becomes a regular file (which also sidesteps Windows symlink
171
+ // EPERM). Its content still reaches Claude through the block's
172
+ // @AGENTS.md. Matched by real path too, for case-insensitive filesystems.
173
+ if (name === 'CLAUDE.md' && (target === agentsPath || sameFile(path, agentsPath))) {
174
+ return {
175
+ outcome: { kind: 'replaced-symlink' },
176
+ apply: () => {
177
+ rmSync(path);
178
+ writeFileSync(path, block + '\n');
179
+ },
180
+ };
181
+ }
182
+ // Any other link (a user's own, or dangling) is left alone.
183
+ return { outcome: { kind: 'skipped-symlink', target }, apply: () => {} };
184
+ }
185
+
186
+ if (!stat) return { outcome: { kind: 'created' }, apply: write(block + '\n') };
187
+
188
+ const content = readFileSync(path, 'utf8');
189
+ const eol = content.includes('\r\n') ? '\r\n' : '\n';
190
+ const replaced = replaceBlock(content, block, name, eol);
191
+ if (replaced !== null) {
192
+ return replaced === content
193
+ ? { outcome: { kind: 'unchanged' }, apply: () => {} }
194
+ : { outcome: { kind: 'updated' }, apply: write(replaced) };
195
+ }
196
+
197
+ if (isLegacyCopy(content)) {
198
+ const backup = freeBackupPath(path);
199
+ return {
200
+ outcome: { kind: 'replaced-legacy', backup },
201
+ apply: () => {
202
+ // Back up first, then replace: the copy may carry the user's edits.
203
+ // rename keeps the original bytes and fails before anything is lost.
204
+ renameSync(path, backup);
205
+ writeFileSync(path, block + '\n');
206
+ },
207
+ };
208
+ }
209
+
210
+ const separator = content.length === 0 ? '' : content.endsWith('\n') ? eol : eol + eol;
211
+ const appended = content + separator + block.split('\n').join(eol) + eol;
212
+ return { outcome: { kind: 'appended' }, apply: write(appended) };
213
+ }
214
+
215
+ function outcomeLine(name: string, outcome: InitOutcome, root: string): string {
216
+ const rel = (path: string) => relative(root, path) || '.';
217
+ switch (outcome.kind) {
218
+ case 'created':
219
+ return `${name}: created`;
220
+ case 'updated':
221
+ return `${name}: updated timber block`;
222
+ case 'appended':
223
+ return `${name}: appended timber block`;
224
+ case 'unchanged':
225
+ return `${name}: unchanged`;
226
+ case 'replaced-symlink':
227
+ return `${name}: replaced symlink to AGENTS.md with a regular file`;
228
+ case 'replaced-legacy':
229
+ return `${name}: replaced old timber-generated copy (backup: ${rel(outcome.backup)})`;
230
+ case 'skipped-symlink':
231
+ return (
232
+ `${name}: skipped — it is a symlink to ${rel(outcome.target)}, and timber does not ` +
233
+ `write through links. Add the block to the file you want it in, or replace the link.`
234
+ );
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Where the installed guide is, relative to `root`: `node_modules` in the
240
+ * project, or one a package manager hoisted to an ancestor (npm/yarn/bun
241
+ * workspaces). Null when no install is found (not installed yet, or Yarn PnP).
242
+ */
243
+ export function findAgentGuide(root: string): string | null {
244
+ for (let dir = root; ; dir = dirname(dir)) {
245
+ if (existsSync(join(dir, AGENT_GUIDE_PATH))) {
246
+ return relative(root, join(dir, AGENT_GUIDE_PATH)).split(sep).join('/');
247
+ }
248
+ if (dirname(dir) === dir) return null;
249
+ }
250
+ }
251
+
252
+ /** Run `timber init` in `root`: plan both files, then write them. */
253
+ export function runInit(root: string): void {
254
+ const found = findAgentGuide(root);
255
+ const guide = found ?? AGENT_GUIDE_PATH;
256
+ const plans: Array<[string, Plan]> = [
257
+ ['AGENTS.md', planBlock(root, 'AGENTS.md', agentsBlock(guide))],
258
+ ['CLAUDE.md', planBlock(root, 'CLAUDE.md', claudeBlock(guide))],
259
+ ];
260
+ // AGENTS.md first: a legacy CLAUDE.md link to it is replaced only after
261
+ // AGENTS.md is in its final state.
262
+ for (const [name, plan] of plans) {
263
+ plan.apply();
264
+ console.log(`[timber] ${outcomeLine(name, plan.outcome, root)}`);
265
+ }
266
+ console.log(`[timber] Agent guide: ${guide}`);
267
+ if (found === null) {
268
+ console.log(
269
+ `[timber] Note: ${AGENT_GUIDE_PATH} does not exist yet. Install @timber-js/app ` +
270
+ `(Yarn PnP has no node_modules, so the pointer cannot resolve there).`
271
+ );
272
+ } else if (found.startsWith('../')) {
273
+ console.log(
274
+ '[timber] Note: the guide is hoisted above this project. Claude Code may not load an ' +
275
+ '@import from outside the project directory without approval; AGENTS.md still points at it.'
276
+ );
277
+ }
278
+ }
package/src/cli.ts CHANGED
@@ -11,6 +11,8 @@
11
11
  // timber preview — Serve the production build
12
12
  // timber check — Validate types + routes without building
13
13
  // timber graph — Classify a file's module environment(s) (design/47)
14
+ // timber dev status — List running dev servers for this checkout (design/21)
15
+ // timber init — Point AGENTS.md / CLAUDE.md at the installed agent guide
14
16
 
15
17
  // Type-only — the implementation is imported dynamically inside runCheck so the
16
18
  // CLI's other commands never load the route scanner.
@@ -27,11 +29,11 @@ export interface ParsedArgs {
27
29
  config: string | undefined;
28
30
  /** `--project`: the tsconfig `timber check` passes to tsgo. */
29
31
  project: string | undefined;
30
- /** `timber graph` only: emit the machine-readable JSON contract. */
32
+ /** `timber graph` and `timber dev status`: emit the machine-readable JSON contract. */
31
33
  json: boolean;
32
34
  /** `timber graph` only: classify the whole project. */
33
35
  all: boolean;
34
- /** Positional arguments after the command (`schema sync`, `graph <file>`). */
36
+ /** Positional arguments after the command (`schema sync`, `dev status`, `graph <file>`). */
35
37
  rest: string[];
36
38
  }
37
39
 
@@ -63,7 +65,8 @@ export interface CommandOptions {
63
65
  *
64
66
  * Each subcommand declares its exact flags (the `check --project` precedent,
65
67
  * TIM-1332): `graph` additionally accepts a file positional plus `--json` and
66
- * `--all`, and those two are rejected everywhere else.
68
+ * `--all`, and those two are rejected everywhere else — except `--json`,
69
+ * which `dev status` accepts too.
67
70
  */
68
71
  export function parseArgs(args: string[]): ParsedArgs {
69
72
  if (args.length === 0) {
@@ -89,14 +92,13 @@ export function parseArgs(args: string[]): ParsedArgs {
89
92
  if (!config) {
90
93
  throw new Error('--config requires a path argument');
91
94
  }
92
- } else if (arg === '--json' || arg === '--all') {
95
+ } else if (arg === '--json') {
96
+ json = true;
97
+ } else if (arg === '--all') {
93
98
  if (command !== 'graph') {
94
- throw new Error(
95
- `${arg} is only valid for \`timber graph\` (the module-environment query).`
96
- );
99
+ throw new Error(`--all is only valid for \`timber graph\` (the module-environment query).`);
97
100
  }
98
- if (arg === '--json') json = true;
99
- else all = true;
101
+ all = true;
100
102
  } else if (arg === '--project') {
101
103
  if (command !== 'check') {
102
104
  throw new Error(
@@ -118,13 +120,24 @@ export function parseArgs(args: string[]): ParsedArgs {
118
120
  `Unknown option: ${arg}. The timber CLI accepts --config <path>` +
119
121
  ` (and --project <path> for \`check\`).${portHint}`
120
122
  );
121
- } else if (command === 'schema' || command === 'init' || command === 'graph') {
123
+ } else if (
124
+ command === 'schema' ||
125
+ command === 'init' ||
126
+ command === 'graph' ||
127
+ (command === 'dev' && rest.length === 0 && arg === 'status')
128
+ ) {
122
129
  rest.push(arg);
123
130
  } else {
124
131
  throw new Error(`Unexpected argument: ${arg}. Usage: timber ${command} [--config <path>]`);
125
132
  }
126
133
  }
127
134
 
135
+ // Checked after the loop so flag order does not matter (`dev --json status`).
136
+ const devStatus = command === 'dev' && rest[0] === 'status';
137
+ if (json && command !== 'graph' && !devStatus) {
138
+ throw new Error(`--json is only valid for \`timber graph\` and \`timber dev status\`.`);
139
+ }
140
+
128
141
  if (command === 'graph' && rest.length > 1) {
129
142
  throw new Error(
130
143
  `timber graph takes one file. Usage: timber graph <file> [--json], or timber graph --all --json`
@@ -344,72 +357,6 @@ export async function runSchema(args: string[]): Promise<void> {
344
357
  }
345
358
  }
346
359
 
347
- // ─── Init Subcommand ─────────────────────────────────────────────────────────
348
-
349
- /**
350
- * `timber init` — write AGENTS.md (and a CLAUDE.md symlink to it) to the
351
- * project root so AI coding agents can discover timber.js documentation and
352
- * conventions.
353
- *
354
- * The content is read from the installed @timber-js/app package itself, so it
355
- * stays in sync with the installed version.
356
- */
357
- export async function runInit(): Promise<void> {
358
- const { readFileSync, writeFileSync, existsSync, symlinkSync } = await import('node:fs');
359
- const { resolve, dirname } = await import('node:path');
360
- const { fileURLToPath } = await import('node:url');
361
-
362
- const root = process.cwd();
363
- const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
364
-
365
- const agentSkillPath = resolve(packageRoot, 'agent-skill.md');
366
- if (!existsSync(agentSkillPath)) {
367
- throw new Error(
368
- 'agent-skill.md not found in @timber-js/app package. ' +
369
- 'This may be a development install — try reinstalling.'
370
- );
371
- }
372
-
373
- const agentSkill = readFileSync(agentSkillPath, 'utf-8');
374
-
375
- const agentsPath = resolve(root, 'AGENTS.md');
376
- const claudePath = resolve(root, 'CLAUDE.md');
377
-
378
- const wrote: string[] = [];
379
-
380
- if (existsSync(agentsPath)) {
381
- console.log('[timber] AGENTS.md already exists — skipping (delete it first to regenerate)');
382
- } else {
383
- writeFileSync(agentsPath, agentSkill);
384
- wrote.push('AGENTS.md');
385
- }
386
-
387
- if (existsSync(claudePath)) {
388
- console.log('[timber] CLAUDE.md already exists — skipping (delete it first to regenerate)');
389
- } else {
390
- try {
391
- // Relative target so the link survives the project directory moving.
392
- // The 'file' type argument is required for Windows (ignored elsewhere).
393
- symlinkSync('AGENTS.md', claudePath, 'file');
394
- wrote.push('CLAUDE.md (symlink)');
395
- } catch {
396
- // Windows without Developer Mode or admin rights can't create symlinks
397
- // (EPERM) — fall back to a plain pointer file.
398
- writeFileSync(claudePath, 'Read AGENTS.md for project context and conventions.\n');
399
- wrote.push('CLAUDE.md');
400
- }
401
- }
402
-
403
- if (wrote.length > 0) {
404
- console.log(
405
- `[timber] Created ${wrote.join(' and ')} — AI agents can now discover timber.js docs.`
406
- );
407
- console.log('[timber] Full documentation: node_modules/@timber-js/app/docs/');
408
- } else {
409
- console.log('[timber] Nothing to do — both files already exist.');
410
- }
411
- }
412
-
413
360
  // ─── Main Entry Point ────────────────────────────────────────────────────────
414
361
 
415
362
  async function main(): Promise<void> {
@@ -418,7 +365,12 @@ async function main(): Promise<void> {
418
365
 
419
366
  switch (parsed.command) {
420
367
  case 'dev':
421
- await runDev(options);
368
+ if (parsed.rest[0] === 'status') {
369
+ const { runDevStatus } = await import('./cli-dev-status.ts');
370
+ await runDevStatus({ config: parsed.config, json: parsed.json });
371
+ } else {
372
+ await runDev(options);
373
+ }
422
374
  break;
423
375
  case 'build':
424
376
  await runBuild(options);
@@ -432,9 +384,11 @@ async function main(): Promise<void> {
432
384
  case 'schema':
433
385
  await runSchema(parsed.rest);
434
386
  break;
435
- case 'init':
436
- await runInit();
387
+ case 'init': {
388
+ const { runInit } = await import('./cli-init.ts');
389
+ runInit(process.cwd());
437
390
  break;
391
+ }
438
392
  case 'graph': {
439
393
  // Lazy import — the graph implementation (and, on a cache miss,
440
394
  // Vite + the crawl child) never loads for the other commands.
@@ -58,6 +58,12 @@ interface DenyDigest {
58
58
  * first *reachable* owner via its ancestry context.
59
59
  */
60
60
  owners?: string[];
61
+ /**
62
+ * A deny no boundary in this tree may place: a gate for a segment of the
63
+ * URL's own route that an intercepted navigation did not render (TIM-1607).
64
+ * Every boundary declines it but the terminal, which leaves the SPA.
65
+ */
66
+ leaveSpa?: boolean;
61
67
  }
62
68
 
63
69
  /** Structured digest returned by RSC onError for RedirectSignal. */
@@ -261,6 +267,16 @@ export class TimberErrorBoundary extends Component<
261
267
  return this.markStatusPage(null);
262
268
  }
263
269
 
270
+ // A deny the tree cannot hold: its deny pages, and the layouts they
271
+ // render in, belong to a route this tree is not. Nothing here may claim
272
+ // it — not a keyed owner, not a slot, not a status filter — so it passes
273
+ // every boundary to the terminal, which leaves the SPA below and lets the
274
+ // document request render the URL's own answer (TIM-1607).
275
+ const leavesSpa = parsed?.type !== 'deny' || parsed.leaveSpa === true;
276
+ if (parsed?.type === 'deny' && parsed.leaveSpa && !this.props.lastResort) {
277
+ throw error;
278
+ }
279
+
264
280
  // Owner-addressed denies: the digest carries an ordered `owners` list
265
281
  // of segment keys with matching deny pages. This boundary claims the
266
282
  // deny only when it is the first *reachable* owner — i.e. its
@@ -299,8 +315,9 @@ export class TimberErrorBoundary extends Component<
299
315
  // the Fizz shell fails and the pipeline serves that page directly. The
300
316
  // envelope still covers errors that land inside Flight's opening window;
301
317
  // this covers the ones that land after it, which used to be held for
302
- // (TIM-1495, TIM-1497).
303
- if (this.props.lastResort && parsed?.type !== 'deny') {
318
+ // (TIM-1495, TIM-1497). A deny the tree cannot hold (above) leaves the
319
+ // same way, for the same reason: no page for it exists in this SPA.
320
+ if (this.props.lastResort && leavesSpa) {
304
321
  if (typeof window === 'undefined') {
305
322
  throw error;
306
323
  }
@@ -8,24 +8,52 @@
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
 
14
- 'use client';
15
-
16
22
  import React from 'react';
17
23
 
18
- export function createGlobalContext<T>(key: string, defaultValue: T): React.Context<T> {
19
- const g = globalThis as Record<symbol, unknown>;
20
- const sym = Symbol.for(key);
21
- const existing = g[sym] as React.Context<T> | undefined;
22
- if (existing !== undefined) return existing;
23
- if (typeof React.createContext === 'function') {
24
- const ctx = React.createContext<T>(defaultValue);
25
- g[sym] = ctx;
26
- return ctx;
24
+ /** The part of a React instance a context comes from. */
25
+ export interface ContextFactory {
26
+ createContext?: typeof React.createContext;
27
+ }
28
+
29
+ /**
30
+ * The context `key` names for this React instance, created on first use.
31
+ * Pass the key as a `Symbol.for('…')` literal at the call site, so each key
32
+ * stays greppable in the build output (tests/bundle-singleton-audit.test.ts
33
+ * checks `__timber_nav_ctx`).
34
+ */
35
+ export function createGlobalContext<T>(key: symbol, defaultValue: T): React.Context<T> {
36
+ return createGlobalContextFor(React, key, defaultValue);
37
+ }
38
+
39
+ /** createGlobalContext for a given React instance. Exported for tests. */
40
+ export function createGlobalContextFor<T>(
41
+ react: ContextFactory,
42
+ key: symbol,
43
+ defaultValue: T
44
+ ): React.Context<T> {
45
+ if (typeof react.createContext !== 'function') {
46
+ // RSC environment — createContext not available. Return a dummy that
47
+ // won't be used (the consumers only render on the client / during SSR).
48
+ return undefined as unknown as React.Context<T>;
49
+ }
50
+ const slot: unknown = Reflect.get(globalThis, key);
51
+ const byReact = slot instanceof WeakMap ? slot : new WeakMap<object, React.Context<T>>();
52
+ if (byReact !== slot) Reflect.set(globalThis, key, byReact);
53
+ let ctx: React.Context<T> | undefined = byReact.get(react);
54
+ if (!ctx) {
55
+ ctx = react.createContext<T>(defaultValue);
56
+ byReact.set(react, ctx);
27
57
  }
28
- // RSC environment — createContext not available. Return a dummy that
29
- // won't be used (the consumers only render on the client / during SSR).
30
- return undefined as unknown as React.Context<T>;
58
+ return ctx;
31
59
  }
@@ -42,7 +42,8 @@
42
42
  * See design/19-client-navigation.md §"NavigationContext"
43
43
  */
44
44
 
45
- import { createContext, useContext, createElement, type ReactNode } from 'react';
45
+ import { useContext, createElement, type ReactNode } from 'react';
46
+ import { createGlobalContext } from './global-context.ts';
46
47
 
47
48
  // ---------------------------------------------------------------------------
48
49
  // Context type
@@ -80,19 +81,11 @@ export interface NavigationState {
80
81
  * The shims plugin resolves next/navigation to navigation-rsc.ts in RSC,
81
82
  * which has throwing stubs for the hooks (TIM-1420).
82
83
  *
83
- * See design/27-chunking-strategy.md §"Singleton Safety"
84
+ * See design/19-client-navigation.md §"Singleton Guarantee via globalThis"
84
85
  */
85
86
 
86
- const NAV_CTX_KEY = Symbol.for('__timber_nav_ctx');
87
-
88
87
  function getOrCreateContext(): import('react').Context<NavigationState | null> {
89
- const existing = (globalThis as Record<symbol, unknown>)[NAV_CTX_KEY] as
90
- | import('react').Context<NavigationState | null>
91
- | undefined;
92
- if (existing !== undefined) return existing;
93
- const ctx = createContext<NavigationState | null>(null);
94
- (globalThis as Record<symbol, unknown>)[NAV_CTX_KEY] = ctx;
95
- return ctx;
88
+ return createGlobalContext<NavigationState | null>(Symbol.for('__timber_nav_ctx'), null);
96
89
  }
97
90
 
98
91
  /**
@@ -34,6 +34,7 @@ import React, { createElement, useMemo, use } from 'react';
34
34
  import { toNullProtoRecord, type CoercedParams } from '../shared/param-value.ts';
35
35
  import { readPublishedParams, type PublishedParams } from '../shared/payload-root.ts';
36
36
  import type { SlotParamsRecord } from '../shared/slot-params.ts';
37
+ import { createGlobalContext } from './global-context.ts';
37
38
 
38
39
  // ─── Types ───────────────────────────────────────────────────────
39
40
 
@@ -72,23 +73,10 @@ export type ParamsContextValue = PublishedParams;
72
73
  *
73
74
  * See design/19-client-navigation.md §"Singleton Guarantee via globalThis"
74
75
  */
75
- const PARAMS_CTX_KEY = Symbol.for('__timber_params_ctx');
76
-
77
- function getOrCreateContext(): React.Context<ParamsContextValue | null> {
78
- const store = globalThis as Record<symbol, unknown>;
79
- const existing = store[PARAMS_CTX_KEY] as React.Context<ParamsContextValue | null> | undefined;
80
- if (existing !== undefined) return existing;
81
- if (typeof React.createContext !== 'function') {
82
- // RSC environment — no contexts here. Nothing in this module runs on that
83
- // side; it only has to import cleanly.
84
- return undefined as unknown as React.Context<ParamsContextValue | null>;
85
- }
86
- const ctx = React.createContext<ParamsContextValue | null>(null);
87
- store[PARAMS_CTX_KEY] = ctx;
88
- return ctx;
89
- }
90
-
91
- const ParamsContext = getOrCreateContext();
76
+ const ParamsContext = createGlobalContext<ParamsContextValue | null>(
77
+ Symbol.for('__timber_params_ctx'),
78
+ null
79
+ );
92
80
 
93
81
  /**
94
82
  * Read the params provided by the tree. Returns null only when no provider
@@ -18,6 +18,6 @@ import { createGlobalContext } from './global-context.ts';
18
18
  export const EMPTY_SEGMENT_UPDATES = new Map<string, ReactNode>();
19
19
 
20
20
  export const SegmentUpdateContext = createGlobalContext<Map<string, ReactNode>>(
21
- '__timber_segment_update_ctx',
21
+ Symbol.for('__timber_segment_update_ctx'),
22
22
  EMPTY_SEGMENT_UPDATES
23
23
  );
@@ -38,6 +38,6 @@ import { createGlobalContext } from './global-context.ts';
38
38
  export type SlotContentCache = Map<string, ReactNode>;
39
39
 
40
40
  export const SlotContentCacheContext = createGlobalContext<SlotContentCache | null>(
41
- '__timber_slot_content_cache_ctx',
41
+ Symbol.for('__timber_slot_content_cache_ctx'),
42
42
  null
43
43
  );