rcf-lite 0.0.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/CHANGELOG.md +344 -0
  2. package/LICENSE +202 -0
  3. package/README.md +92 -4
  4. package/bin/rcf-verify.js +122 -0
  5. package/bin/rcf.js +174 -0
  6. package/bin/view-supervisor-child.mjs +14 -0
  7. package/fixtures/canary-manifest.json +103 -0
  8. package/guidance/README.md +25 -0
  9. package/guidance/build-cycle-playbook.md +492 -0
  10. package/guidance/build-cycle.md +40 -0
  11. package/guidance/document-model.md +45 -0
  12. package/guidance/elicitation-playbook.md +442 -0
  13. package/guidance/harness-template.md +246 -0
  14. package/guidance/managed/README.md +63 -0
  15. package/guidance/managed/agent-instructions-block.hash +1 -0
  16. package/guidance/managed/agent-instructions-block.md +220 -0
  17. package/guidance/managed/legacy-fragment-hashes.json +22 -0
  18. package/guidance/manifest.json +21 -0
  19. package/guidance/overview.md +48 -0
  20. package/guidance/persona-programme.md +44 -0
  21. package/package.json +71 -8
  22. package/rcf/adrs/adr-001.json +25 -0
  23. package/rcf/adrs/adr-002.json +25 -0
  24. package/rcf/adrs/adr-003.json +25 -0
  25. package/rcf/adrs/adr-004.json +20 -0
  26. package/rcf/adrs/adr-005.json +20 -0
  27. package/rcf/adrs/adr-006.json +25 -0
  28. package/rcf/adrs/adr-007.json +25 -0
  29. package/rcf/adrs/adr-008.json +25 -0
  30. package/rcf/adrs/adr-009.json +25 -0
  31. package/rcf/build-sequence.json +11 -0
  32. package/rcf/code-nodes/cn-001.json +14 -0
  33. package/rcf/code-nodes/cn-002.json +14 -0
  34. package/rcf/code-nodes/cn-003.json +15 -0
  35. package/rcf/code-nodes/cn-004.json +17 -0
  36. package/rcf/code-nodes/cn-005.json +19 -0
  37. package/rcf/code-nodes/cn-006.json +17 -0
  38. package/rcf/code-nodes/cn-007.json +16 -0
  39. package/rcf/code-nodes/cn-008.json +19 -0
  40. package/rcf/code-nodes/cn-009.json +16 -0
  41. package/rcf/code-nodes/cn-010.json +18 -0
  42. package/rcf/code-nodes/cn-011.json +18 -0
  43. package/rcf/code-nodes/cn-012.json +18 -0
  44. package/rcf/code-nodes/cn-013.json +19 -0
  45. package/rcf/code-nodes/cn-014.json +16 -0
  46. package/rcf/code-nodes/cn-015.json +16 -0
  47. package/rcf/code-nodes/cn-016.json +16 -0
  48. package/rcf/code-nodes/cn-017.json +16 -0
  49. package/rcf/code-nodes/cn-018.json +15 -0
  50. package/rcf/code-nodes/cn-019.json +16 -0
  51. package/rcf/code-nodes/cn-020.json +16 -0
  52. package/rcf/code-nodes/cn-021.json +16 -0
  53. package/rcf/code-nodes/cn-022.json +16 -0
  54. package/rcf/code-nodes/cn-023.json +16 -0
  55. package/rcf/code-nodes/cn-024.json +16 -0
  56. package/rcf/code-nodes/cn-025.json +16 -0
  57. package/rcf/code-nodes/cn-026.json +16 -0
  58. package/rcf/code-nodes/cn-027.json +16 -0
  59. package/rcf/code-nodes/cn-028.json +16 -0
  60. package/rcf/code-nodes/cn-029.json +19 -0
  61. package/rcf/code-nodes/cn-030.json +14 -0
  62. package/rcf/code-nodes/cn-031.json +14 -0
  63. package/rcf/code-nodes/cn-032.json +14 -0
  64. package/rcf/code-nodes/cn-033.json +14 -0
  65. package/rcf/code-nodes/cn-034.json +14 -0
  66. package/rcf/code-nodes/cn-035.json +14 -0
  67. package/rcf/code-nodes/cn-036.json +14 -0
  68. package/rcf/code-nodes/cn-037.json +14 -0
  69. package/rcf/code-nodes/cn-038.json +14 -0
  70. package/rcf/code-nodes/cn-039.json +14 -0
  71. package/rcf/code-nodes/cn-040.json +14 -0
  72. package/rcf/code-nodes/cn-041.json +14 -0
  73. package/rcf/code-nodes/cn-042.json +14 -0
  74. package/rcf/code-nodes/cn-043.json +14 -0
  75. package/rcf/code-nodes/cn-044.json +14 -0
  76. package/rcf/code-nodes/cn-045.json +14 -0
  77. package/rcf/code-nodes/cn-046.json +14 -0
  78. package/rcf/code-nodes/cn-047.json +14 -0
  79. package/rcf/code-nodes/cn-048.json +14 -0
  80. package/rcf/code-nodes/cn-049.json +14 -0
  81. package/rcf/code-nodes/cn-050.json +14 -0
  82. package/rcf/code-nodes/cn-051.json +14 -0
  83. package/rcf/code-nodes/cn-052.json +14 -0
  84. package/rcf/code-nodes/cn-053.json +14 -0
  85. package/rcf/code-nodes/cn-054.json +14 -0
  86. package/rcf/code-nodes/cn-055.json +14 -0
  87. package/rcf/code-nodes/cn-056.json +14 -0
  88. package/rcf/code-nodes/cn-057.json +14 -0
  89. package/rcf/fbs/fbs-001.json +49 -0
  90. package/rcf/fbs/fbs-002.json +42 -0
  91. package/rcf/fbs/fbs-003.json +37 -0
  92. package/rcf/fbs/fbs-004.json +39 -0
  93. package/rcf/fbs/fbs-005.json +38 -0
  94. package/rcf/fbs/fbs-006.json +48 -0
  95. package/rcf/fbs/fbs-007.json +39 -0
  96. package/rcf/fbs/fbs-008.json +40 -0
  97. package/rcf/fbs/fbs-009.json +36 -0
  98. package/rcf/fbs/fbs-010.json +41 -0
  99. package/rcf/fbs/fbs-011.json +36 -0
  100. package/rcf/fbs/fbs-012.json +46 -0
  101. package/rcf/fbs/fbs-013.json +42 -0
  102. package/rcf/fbs/fbs-014.json +49 -0
  103. package/rcf/fbs/fbs-015.json +32 -0
  104. package/rcf/manifest.json +17 -0
  105. package/rcf/prd.json +47 -0
  106. package/rcf/requirements/req-001.json +19 -0
  107. package/rcf/requirements/req-002.json +19 -0
  108. package/rcf/requirements/req-003.json +19 -0
  109. package/rcf/requirements/req-004.json +19 -0
  110. package/rcf/requirements/req-005.json +19 -0
  111. package/rcf/requirements/req-006.json +19 -0
  112. package/rcf/requirements/req-007.json +19 -0
  113. package/rcf/requirements/req-008.json +19 -0
  114. package/rcf/requirements/req-009.json +19 -0
  115. package/rcf/tacs/tac-001.json +45 -0
  116. package/rcf/tacs/tac-002.json +109 -0
  117. package/rcf/tacs/tac-003.json +40 -0
  118. package/rcf/tacs/tac-004.json +51 -0
  119. package/rcf/tacs/tac-005.json +52 -0
  120. package/rcf/tacs/tac-006.json +104 -0
  121. package/rcf/tacs/tac-007.json +38 -0
  122. package/rcf/tacs/tac-008.json +51 -0
  123. package/rcf/tad.json +51 -0
  124. package/rcf/test-suites/PENDING.md +23 -0
  125. package/rcf/test-suites/ts-001.json +38 -0
  126. package/rcf/test-suites/ts-002.json +38 -0
  127. package/rcf/test-suites/ts-003.json +43 -0
  128. package/rcf/test-suites/ts-004.json +44 -0
  129. package/rcf/test-suites/ts-005.json +30 -0
  130. package/rcf/test-suites/ts-006.json +36 -0
  131. package/rcf/test-suites/ts-007.json +43 -0
  132. package/rcf/test-suites/ts-008.json +37 -0
  133. package/rcf/test-suites/ts-009.json +38 -0
  134. package/rcf/test-suites/ts-010.json +38 -0
  135. package/rcf/test-suites/ts-011.json +44 -0
  136. package/rcf/test-suites/ts-012.json +36 -0
  137. package/rcf/test-suites/ts-013.json +38 -0
  138. package/rcf/test-suites/ts-014.json +38 -0
  139. package/rcf/test-suites/ts-015.json +38 -0
  140. package/rcf/test-suites/ts-016.json +37 -0
  141. package/rcf/test-suites/ts-017.json +38 -0
  142. package/rcf/test-suites/ts-018.json +38 -0
  143. package/rcf/test-suites/ts-019.json +37 -0
  144. package/rcf/test-suites/ts-020.json +46 -0
  145. package/rcf/test-suites/ts-021.json +46 -0
  146. package/rcf/test-suites/ts-022.json +46 -0
  147. package/rcf/test-suites/ts-023.json +46 -0
  148. package/rcf/test-suites/ts-024.json +46 -0
  149. package/rcf/test-suites/ts-025.json +52 -0
  150. package/rcf/user-stories/us-101.json +40 -0
  151. package/rcf/user-stories/us-102.json +40 -0
  152. package/rcf/user-stories/us-201.json +40 -0
  153. package/rcf/user-stories/us-202.json +40 -0
  154. package/rcf/user-stories/us-203.json +32 -0
  155. package/rcf/user-stories/us-301.json +40 -0
  156. package/rcf/user-stories/us-302.json +40 -0
  157. package/rcf/user-stories/us-303.json +40 -0
  158. package/rcf/user-stories/us-304.json +40 -0
  159. package/rcf/user-stories/us-401.json +40 -0
  160. package/rcf/user-stories/us-402.json +40 -0
  161. package/rcf/user-stories/us-403.json +40 -0
  162. package/rcf/user-stories/us-501.json +40 -0
  163. package/rcf/user-stories/us-502.json +40 -0
  164. package/rcf/user-stories/us-503.json +40 -0
  165. package/rcf/user-stories/us-601.json +40 -0
  166. package/rcf/user-stories/us-602.json +40 -0
  167. package/rcf/user-stories/us-701.json +40 -0
  168. package/rcf/user-stories/us-702.json +40 -0
  169. package/rcf/user-stories/us-801.json +49 -0
  170. package/rcf/user-stories/us-802.json +49 -0
  171. package/rcf/user-stories/us-803.json +49 -0
  172. package/rcf/user-stories/us-804.json +49 -0
  173. package/rcf/user-stories/us-805.json +49 -0
  174. package/rcf/user-stories/us-901.json +40 -0
  175. package/src/.gitkeep +0 -0
  176. package/src/admissibility/enforce.js +142 -0
  177. package/src/admissibility/index.js +8 -0
  178. package/src/admissibility/markers.js +104 -0
  179. package/src/admissibility/scope-lint.js +163 -0
  180. package/src/browser-verify/auth-smoke.js +109 -0
  181. package/src/browser-verify/index.js +29 -0
  182. package/src/browser-verify/invariants.js +336 -0
  183. package/src/browser-verify/manifest-writer.js +189 -0
  184. package/src/browser-verify/runner.js +171 -0
  185. package/src/build/bundle.js +198 -0
  186. package/src/build/formatters/json.js +18 -0
  187. package/src/build/formatters/markdown.js +406 -0
  188. package/src/build/index.js +14 -0
  189. package/src/build/mark.js +177 -0
  190. package/src/build/queue.js +285 -0
  191. package/src/cli/browser-verify.js +231 -0
  192. package/src/cli/build.js +584 -0
  193. package/src/cli/coverage.js +219 -0
  194. package/src/cli/create.js +358 -0
  195. package/src/cli/delete.js +127 -0
  196. package/src/cli/design.js +353 -0
  197. package/src/cli/doctor.js +548 -0
  198. package/src/cli/fbs.js +171 -0
  199. package/src/cli/finalise.js +377 -0
  200. package/src/cli/guidance.js +206 -0
  201. package/src/cli/help.js +156 -0
  202. package/src/cli/impact.js +119 -0
  203. package/src/cli/init.js +282 -0
  204. package/src/cli/intake.js +153 -0
  205. package/src/cli/link.js +128 -0
  206. package/src/cli/mcp.js +160 -0
  207. package/src/cli/preflight.js +220 -0
  208. package/src/cli/read.js +168 -0
  209. package/src/cli/req-baseline.js +269 -0
  210. package/src/cli/req-classify.js +135 -0
  211. package/src/cli/review.js +295 -0
  212. package/src/cli/test-suite.js +221 -0
  213. package/src/cli/trace.js +172 -0
  214. package/src/cli/ui-baseline.js +292 -0
  215. package/src/cli/ui-classify.js +108 -0
  216. package/src/cli/update.js +197 -0
  217. package/src/cli/validate.js +168 -0
  218. package/src/cli/view.js +452 -0
  219. package/src/core/baseline-catalog/data/auth.json +42 -0
  220. package/src/core/baseline-catalog/data/http-api.json +42 -0
  221. package/src/core/baseline-catalog/data/notifications.json +33 -0
  222. package/src/core/baseline-catalog/data/persistence.json +33 -0
  223. package/src/core/baseline-catalog/data/web-ui.json +60 -0
  224. package/src/core/baseline-catalog/index.js +121 -0
  225. package/src/core/errors/index.js +167 -0
  226. package/src/core/fixtures/register-canary/canary-prompt-01.json +18 -0
  227. package/src/core/fixtures/register-canary/canary-prompt-02.json +21 -0
  228. package/src/core/fixtures/register-canary/canary-prompt-03.json +17 -0
  229. package/src/core/isolation/index.js +60 -0
  230. package/src/core/mcp/framing.js +103 -0
  231. package/src/core/mcp/index.js +8 -0
  232. package/src/core/mcp/server.js +228 -0
  233. package/src/core/patterns/register-canary.js +209 -0
  234. package/src/core/patterns/req-shapes.js +158 -0
  235. package/src/core/patterns/services.js +358 -0
  236. package/src/core/patterns/ui-shapes.js +166 -0
  237. package/src/core/store/cn-resolve.js +134 -0
  238. package/src/core/store/derive-deps.js +93 -0
  239. package/src/core/store/ids.js +78 -0
  240. package/src/core/store/index.js +20 -0
  241. package/src/core/store/init.js +255 -0
  242. package/src/core/store/loader.js +214 -0
  243. package/src/core/store/tp-resolve.js +176 -0
  244. package/src/core/store/validator.js +191 -0
  245. package/src/core/store/walker.js +944 -0
  246. package/src/core/store/writer.js +1879 -0
  247. package/src/design/index.js +11 -0
  248. package/src/design/writer.js +271 -0
  249. package/src/finalise/detect.js +151 -0
  250. package/src/finalise/index.js +31 -0
  251. package/src/finalise/ingest.js +160 -0
  252. package/src/finalise/install.js +119 -0
  253. package/src/finalise/ship-without-verified.js +131 -0
  254. package/src/finalise/spawn.js +84 -0
  255. package/src/intake/fidelity.js +105 -0
  256. package/src/intake/index.js +6 -0
  257. package/src/intake/manifest-writer.js +100 -0
  258. package/src/intake/orchestrator.js +138 -0
  259. package/src/intake/validate.js +80 -0
  260. package/src/mcp/map-errors.js +131 -0
  261. package/src/mcp/prompts.js +49 -0
  262. package/src/mcp/resources.js +244 -0
  263. package/src/mcp/tools.js +1212 -0
  264. package/src/preflight/design-shapes.js +185 -0
  265. package/src/preflight/index.js +90 -0
  266. package/src/preflight/manifest-writer.js +264 -0
  267. package/src/preflight/scanner.js +206 -0
  268. package/src/preflight/secrets.js +134 -0
  269. package/src/preflight/session.js +246 -0
  270. package/src/query/attestation.js +285 -0
  271. package/src/query/coverage.js +308 -0
  272. package/src/query/formatters/json.js +21 -0
  273. package/src/query/formatters/mermaid.js +209 -0
  274. package/src/query/formatters/table.js +203 -0
  275. package/src/query/impact.js +173 -0
  276. package/src/query/index.js +13 -0
  277. package/src/query/refuse-on-admissibility.js +73 -0
  278. package/src/query/trace.js +345 -0
  279. package/src/register-canary/fixture-loader.js +87 -0
  280. package/src/register-canary/index.js +10 -0
  281. package/src/register-canary/record-writer.js +132 -0
  282. package/src/register-canary/runner.js +156 -0
  283. package/src/req-baseline/gate.js +86 -0
  284. package/src/req-baseline/index.js +27 -0
  285. package/src/req-baseline/open-candidates.js +143 -0
  286. package/src/req-baseline/opt-out.js +195 -0
  287. package/src/req-baseline/sweep.js +230 -0
  288. package/src/req-detection/classifier.js +181 -0
  289. package/src/req-detection/index.js +9 -0
  290. package/src/req-detection/persist.js +55 -0
  291. package/src/review/index.js +325 -0
  292. package/src/review/mutation.js +117 -0
  293. package/src/review/ui-baseline-drift.js +138 -0
  294. package/src/ruleset/index.js +140 -0
  295. package/src/ruleset/ruleset.json +146 -0
  296. package/src/server/index.js +178 -0
  297. package/src/server/routes.js +110 -0
  298. package/src/server/sse.js +118 -0
  299. package/src/setup/agent-setup.js +362 -0
  300. package/src/setup/identity-seed.js +104 -0
  301. package/src/setup/knowledge-seed.js +123 -0
  302. package/src/setup/managed-block.js +193 -0
  303. package/src/setup/managed-gitignore.js +166 -0
  304. package/src/setup/managed-markers.js +49 -0
  305. package/src/ui-baseline/defaults.js +119 -0
  306. package/src/ui-baseline/index.js +25 -0
  307. package/src/ui-baseline/manifest-writer.js +282 -0
  308. package/src/ui-baseline/session.js +178 -0
  309. package/src/ui-detection/classifier.js +192 -0
  310. package/src/verify/chain/index.js +221 -0
  311. package/src/verify/cli/cleanup.js +61 -0
  312. package/src/verify/cli/help.js +56 -0
  313. package/src/verify/cli/mcp.js +98 -0
  314. package/src/verify/cli/provision.js +71 -0
  315. package/src/verify/cli/report.js +71 -0
  316. package/src/verify/cli/run.js +155 -0
  317. package/src/verify/engine/brief.js +87 -0
  318. package/src/verify/engine/index.js +177 -0
  319. package/src/verify/engine/launcher.js +307 -0
  320. package/src/verify/mcp/tools.js +107 -0
  321. package/src/verify/profile/index.js +146 -0
  322. package/src/verify/provision/index.js +256 -0
  323. package/src/verify/report/index.js +139 -0
  324. package/src/verify/report/renderer.js +118 -0
  325. package/src/verify/verdict/index.js +313 -0
  326. package/src/view/doc-renderers/adr.js +44 -0
  327. package/src/view/doc-renderers/build-sequence.js +40 -0
  328. package/src/view/doc-renderers/fbs.js +128 -0
  329. package/src/view/doc-renderers/helpers.js +159 -0
  330. package/src/view/doc-renderers/index.js +12 -0
  331. package/src/view/doc-renderers/prd.js +45 -0
  332. package/src/view/doc-renderers/req.js +43 -0
  333. package/src/view/doc-renderers/tac.js +38 -0
  334. package/src/view/doc-renderers/tad.js +74 -0
  335. package/src/view/doc-renderers/test-suite.js +45 -0
  336. package/src/view/doc-renderers/user-story.js +63 -0
  337. package/src/view/html-page.js +462 -0
  338. package/src/view/index.js +63 -0
  339. package/src/view/live-client.js +338 -0
  340. package/src/view/mermaid-diagram.js +178 -0
  341. package/src/view/style.css +735 -0
  342. package/src/view/tree-model.js +152 -0
  343. package/src/view/vendored/mermaid.min.js +2607 -0
  344. package/src/view-supervisor/index.js +26 -0
  345. package/src/view-supervisor/logs.js +32 -0
  346. package/src/view-supervisor/manifest-writer.js +178 -0
  347. package/src/view-supervisor/persist-until.js +85 -0
  348. package/src/view-supervisor/supervisor.js +276 -0
  349. package/src/watch/index.js +152 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Stravica
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,8 +1,96 @@
1
1
  # rcf-lite
2
2
 
3
- This package name is reserved for RCF Lite, the Requirements Confidence Framework lite suite from Stravica.
3
+ [![ci](https://github.com/Stravica/rcf-lite/actions/workflows/ci.yml/badge.svg)](https://github.com/Stravica/rcf-lite/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/rcf-lite)](https://www.npmjs.com/package/rcf-lite)
5
+ [![license](https://img.shields.io/badge/license-Apache--2.0-blue)](./LICENSE)
6
+ [![node](https://img.shields.io/badge/node-%3E%3D24-brightgreen)](https://nodejs.org)
4
7
 
5
- The first real release lands here as version 0.7.1, a repackage of the current published suite. Until then, install `@stravica-ai/rcf-build-lite`.
8
+ Build software with an AI coding agent without losing the plot.
6
9
 
7
- - Source: https://github.com/Stravica/rcf-lite
8
- - About RCF: https://stravica.ai
10
+ Anyone who has shipped with a coding agent knows the failure mode: the code arrives fast, but what the product is supposed to do lives in prompt history, and prompt history is not a spec. Three weeks later nobody can say what is covered, what is tested, or what breaks when something changes.
11
+
12
+ RCF Lite keeps those answers machine-checkable. It maintains a live chain from what you asked for, through requirements, user stories, acceptance criteria and tests, into the code itself, as plain JSON files in your own repository. Your agent works the chain instead of improvising; `rcf validate` catches drift the moment it happens; and when your app is deployed, `rcf verify` sends an independent verifier at it before anything gets called done.
13
+
14
+ It is the tooling for the [Requirements Confidence Framework (RCF)](https://stravica.ai/rcf-methodology): a method for keeping AI-built software honest.
15
+
16
+ ## Start here
17
+
18
+ Three steps before you start your coding agent, then one prompt inside the session.
19
+
20
+ 1. Install the CLI:
21
+
22
+ ```sh
23
+ npm install -g rcf-lite
24
+ ```
25
+
26
+ That single install brings both the build-stage CLI (`rcf`) and the ship-gate verifier (`rcf verify`, plus the transition-grace `rcf-verify` alias) in one package.
27
+
28
+ 2. In your project directory, run `rcf init` (or `npx rcf-lite init` without the install). One command sets everything up: the requirements files, the MCP server entry and your agent's instructions.
29
+
30
+ 3. Start your coding agent session in that directory (or restart the one you have open, so it picks up the new configuration).
31
+
32
+ Then hand your agent this prompt, filled in. The setup you just ran has already taught it how to work; all it needs from you is the idea:
33
+
34
+ ```text
35
+ I want to build [describe your product idea in a sentence or two].
36
+ Let's get started.
37
+ ```
38
+
39
+ If you'd rather drive it by hand, [docs/getting-started.md](docs/getting-started.md) covers the same ground at human pace. Prerequisites, install checks and agent-harness wiring live in [docs/install.md](docs/install.md).
40
+
41
+ ## Migrating from the pre-0.7.1 packages
42
+
43
+ If your project pinned one of the pre-consolidation packages, replace it with `rcf-lite`:
44
+
45
+ | Old pin | New pin |
46
+ |--------------------------------------|----------------------------------------|
47
+ | `@stravica-ai/rcf-build-lite` | `rcf-lite` |
48
+ | `@stravica-ai/rcf-verify-lite` | `rcf-lite` (verify is a subcommand now) |
49
+ | `@stravica-ai/rcf-lite-core` | `rcf-lite` (core is an internal module) |
50
+
51
+ Invocation:
52
+
53
+ - `rcf init` / `rcf validate` / `rcf build` / `rcf finalise` are unchanged.
54
+ - Prefer `rcf verify <run|report|provision|cleanup|mcp>` over the legacy `rcf-verify` bin. The alias still works (identical dispatch, one-line stderr deprecation notice on direct invocation; suppress with `RCF_QUIET=1`).
55
+
56
+ The full migration story, the ratified ruling sheet and the registry runbook live at the repo root under [`docs/`](../../docs/).
57
+
58
+ ## This repo runs on it
59
+
60
+ The umbrella's own PRD, requirements, user stories, acceptance criteria, architecture and build queue live as JSON under [`rcf/`](./rcf), validated against the open [`@stravica-ai/rcf-schemas`](https://github.com/Stravica/rcf-schemas). The build queue in there is the one that drove the tool's own development. The artefacts are the demo.
61
+
62
+ See them the way you'd see your own project's:
63
+
64
+ ```sh
65
+ git clone https://github.com/Stravica/rcf-lite.git
66
+ cd rcf-lite && pnpm install
67
+ cd packages/rcf-lite
68
+ pnpm rcf view # the tree this tool was built from, rendered live in your browser
69
+ ```
70
+
71
+ Then scaffold your own: [docs/getting-started.md](docs/getting-started.md).
72
+
73
+ ## Docs
74
+
75
+ | Doc | One line |
76
+ |---|---|
77
+ | [docs/install.md](docs/install.md) | Prerequisites, install, verify, wire into an agent harness |
78
+ | [docs/getting-started.md](docs/getting-started.md) | Empty directory to a validated, queried, building RCF project |
79
+ | [docs/how-it-works.md](docs/how-it-works.md) | The document chain, the files, the verbs, the agent contract |
80
+ | [docs/why-it-exists.md](docs/why-it-exists.md) | The confidence gap, and why files plus a CLI is the answer |
81
+ | [docs/code-nodes.md](docs/code-nodes.md) | The spec-to-code bridge: Code Nodes, staleness detection, the mark-complete gate, honest limits |
82
+ | [docs/verify-reference.md](docs/verify-reference.md) | The verify subcommand tree (run, report, provision, cleanup, mcp) in detail |
83
+
84
+ [docs/README.md](docs/README.md) is the index; `rcf help <verb>` is the flag reference; [guidance/](guidance/README.md) is the agent-facing method pack.
85
+
86
+ ## Under the hood
87
+
88
+ The chain does not stop at the tests. **Code Nodes** make source files first-class nodes in the same graph, so a dangling spec-to-code link fails `rcf validate` exactly the way a dangling spec-to-spec one does. `rcf trace` walks backward from a source file to the requirements it serves; `rcf impact` extends a change's blast radius into the code that implements it. Spec-only trees work unchanged; the code layer is additive. Full detail, deliberate limits and the roadmap beyond them: [docs/code-nodes.md](docs/code-nodes.md).
89
+
90
+ ## Contributing
91
+
92
+ Not accepting external code contributions at this stage of the project. Bug reports and feature discussion via [Issues](https://github.com/Stravica/rcf-lite/issues) are welcome. [CONTRIBUTING.md](./CONTRIBUTING.md) covers the development setup and house rules that will apply when that changes.
93
+
94
+ ## License
95
+
96
+ Apache 2.0. See [LICENSE](./LICENSE).
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env node
2
+ // The `rcf-verify` alias bin. Post 0.7.1 packaging consolidation the
3
+ // unified `rcf` CLI grew a `verify` subcommand that dispatches to the
4
+ // same handlers this file wires up; `rcf-verify` remains as a
5
+ // transition-grace alias (see docs/2026-08-06_packaging-consolidation-
6
+ // proposal.md R3). When run directly (as `rcf-verify <verb>` rather
7
+ // than through the routing `rcf verify <verb>`), the entrypoint emits
8
+ // a one-line stderr deprecation notice; behaviour is otherwise
9
+ // unchanged.
10
+ //
11
+ // Argv layout: `rcf-verify <subcommand> [args...]`. The first positional
12
+ // selects the subcommand handler; global --version / --help short-circuit
13
+ // before dispatch. The `main` export is also imported by bin/rcf.js as
14
+ // the `verify` subcommand handler, so the dispatcher lives in one place.
15
+
16
+ import { realpathSync } from 'node:fs';
17
+ import { readFile } from 'node:fs/promises';
18
+ import { dirname, resolve } from 'node:path';
19
+ import process from 'node:process';
20
+ import { fileURLToPath, pathToFileURL } from 'node:url';
21
+
22
+ import { main as runMain } from '../src/verify/cli/run.js';
23
+ import { main as reportMain } from '../src/verify/cli/report.js';
24
+ import { main as provisionMain } from '../src/verify/cli/provision.js';
25
+ import { main as cleanupMain } from '../src/verify/cli/cleanup.js';
26
+ import { main as mcpMain } from '../src/verify/cli/mcp.js';
27
+ import { main as helpMain, TOP_LEVEL_HELP } from '../src/verify/cli/help.js';
28
+
29
+ const here = dirname(fileURLToPath(import.meta.url));
30
+
31
+ const SUBCOMMANDS = {
32
+ run: runMain,
33
+ report: reportMain,
34
+ provision: provisionMain,
35
+ cleanup: cleanupMain,
36
+ mcp: mcpMain,
37
+ help: helpMain,
38
+ };
39
+
40
+ /**
41
+ * @param {string[]} argv - argv minus node + script
42
+ * @param {object} [deps]
43
+ * @returns {Promise<number>}
44
+ */
45
+ export async function main(argv, deps = {}) {
46
+ const stdout = deps.stdout ?? process.stdout;
47
+ const stderr = deps.stderr ?? process.stderr;
48
+
49
+ if (argv.length === 0) {
50
+ stdout.write(TOP_LEVEL_HELP);
51
+ return 0;
52
+ }
53
+ const first = argv[0];
54
+ if (first === '--version' || first === '-v') {
55
+ stdout.write(`rcf-verify ${await readPackageVersion()}\n`);
56
+ return 0;
57
+ }
58
+ if (first === '--help' || first === '-h') {
59
+ stdout.write(TOP_LEVEL_HELP);
60
+ return 0;
61
+ }
62
+ const handler = SUBCOMMANDS[first];
63
+ if (!handler) {
64
+ stderr.write(`[error] usage unknown subcommand: ${first}\n`);
65
+ stderr.write(TOP_LEVEL_HELP);
66
+ return 2;
67
+ }
68
+ return await handler(argv.slice(1), deps);
69
+ }
70
+
71
+ async function readPackageVersion() {
72
+ try {
73
+ const pkgPath = resolve(here, '..', 'package.json');
74
+ const pkg = JSON.parse(await readFile(pkgPath, 'utf8'));
75
+ return pkg.version ?? '0.0.0';
76
+ } catch {
77
+ return '0.0.0';
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Symlink-safe entry-point compare (mirrors build's bin/rcf.js). macOS `/tmp`
83
+ * is a symlink to `/private/tmp` and every `pnpm link` shim is a symlink;
84
+ * without realpath the isMain gate breaks and main() never runs.
85
+ *
86
+ * @param {string} metaUrl
87
+ * @param {string} argvPath
88
+ * @returns {boolean}
89
+ */
90
+ export function isSameEntryPoint(metaUrl, argvPath) {
91
+ try {
92
+ const metaPath = fileURLToPath(metaUrl);
93
+ return realpathSync(metaPath) === realpathSync(argvPath);
94
+ } catch {
95
+ try {
96
+ return metaUrl === pathToFileURL(argvPath).href;
97
+ } catch {
98
+ return false;
99
+ }
100
+ }
101
+ }
102
+
103
+ const isMain = process.argv[1] && isSameEntryPoint(import.meta.url, process.argv[1]);
104
+ if (isMain) {
105
+ // Transition-grace deprecation notice per proposal R3. Only fires when
106
+ // the alias bin is invoked directly (not when bin/rcf.js routes the
107
+ // `verify` subcommand through the exported `main`, since the isMain
108
+ // guard is false in that case). Suppressible via RCF_QUIET=1 for
109
+ // scripted callers who cannot tolerate stderr chatter.
110
+ if (!process.env.RCF_QUIET) {
111
+ process.stderr.write(
112
+ '[rcf-verify] deprecation: prefer `rcf verify` (the umbrella CLI subcommand). ' +
113
+ 'The `rcf-verify` alias will be removed in a future major. Set RCF_QUIET=1 to silence.\n',
114
+ );
115
+ }
116
+ main(process.argv.slice(2))
117
+ .then((code) => process.exit(code))
118
+ .catch((err) => {
119
+ process.stderr.write(`[rcf-verify] unexpected failure: ${err.message}\n${err.stack}\n`);
120
+ process.exit(1);
121
+ });
122
+ }
package/bin/rcf.js ADDED
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env node
2
+ // Unified `rcf` binary. Phase 4 §D1 / §D23: replaces the standalone
3
+ // `bin/rcf-view.js` and adds init / validate / create / read / update /
4
+ // delete / link / unlink / help subcommands. Zero external deps.
5
+ //
6
+ // Argv layout: `rcf <subcommand> [args...]`. The first positional is
7
+ // the subcommand; everything after is handed to that subcommand's
8
+ // handler (`src/cli/<subcommand>.js`). Global `--version` and `--help`
9
+ // short-circuit before dispatch.
10
+
11
+ import { realpathSync } from 'node:fs';
12
+ import { readFile } from 'node:fs/promises';
13
+ import { dirname, resolve } from 'node:path';
14
+ import process from 'node:process';
15
+ import { fileURLToPath, pathToFileURL } from 'node:url';
16
+
17
+ import { main as buildMain } from '../src/cli/build.js';
18
+ import { main as coverageMain } from '../src/cli/coverage.js';
19
+ import { main as createMain } from '../src/cli/create.js';
20
+ import { main as deleteMain } from '../src/cli/delete.js';
21
+ import { main as doctorMain } from '../src/cli/doctor.js';
22
+ import { main as finaliseMain } from '../src/cli/finalise.js';
23
+ import { main as guidanceMain } from '../src/cli/guidance.js';
24
+ import { main as helpMain, TOP_LEVEL_HELP } from '../src/cli/help.js';
25
+ import { main as impactMain } from '../src/cli/impact.js';
26
+ import { main as initMain } from '../src/cli/init.js';
27
+ import { main as linkMain } from '../src/cli/link.js';
28
+ import { main as mcpMain } from '../src/cli/mcp.js';
29
+ import { main as preflightMain } from '../src/cli/preflight.js';
30
+ import { main as readMain } from '../src/cli/read.js';
31
+ import { main as reviewMain } from '../src/cli/review.js';
32
+ import { main as fbsMain } from '../src/cli/fbs.js';
33
+ import { main as testSuiteMain } from '../src/cli/test-suite.js';
34
+ import { main as traceMain } from '../src/cli/trace.js';
35
+ import { main as uiBaselineMain } from '../src/cli/ui-baseline.js';
36
+ import { main as uiClassifyMain } from '../src/cli/ui-classify.js';
37
+ import { main as designMain } from '../src/cli/design.js';
38
+ import { main as browserVerifyMain } from '../src/cli/browser-verify.js';
39
+ import { main as updateMain } from '../src/cli/update.js';
40
+ import { main as validateMain } from '../src/cli/validate.js';
41
+ import { main as viewMain } from '../src/cli/view.js';
42
+ // Track C+D (elicitation-and-playbook-hardening-0.7.0) verbs.
43
+ import { main as reqClassifyMain } from '../src/cli/req-classify.js';
44
+ import { main as reqBaselineMain } from '../src/cli/req-baseline.js';
45
+ import { main as intakeMain } from '../src/cli/intake.js';
46
+ // 0.7.1 packaging consolidation: `rcf verify <verb>` routes through the
47
+ // same dispatcher the `rcf-verify` alias bin exposes. One place to wire
48
+ // the verify subcommands; two entry points.
49
+ import { main as verifyMain } from './rcf-verify.js';
50
+
51
+ const here = dirname(fileURLToPath(import.meta.url));
52
+
53
+ export const SUBCOMMANDS = {
54
+ init: initMain,
55
+ view: viewMain,
56
+ validate: validateMain,
57
+ create: createMain,
58
+ read: readMain,
59
+ update: updateMain,
60
+ delete: deleteMain,
61
+ link: (argv, deps) => linkMain(argv, { ...deps, remove: false }),
62
+ unlink: (argv, deps) => linkMain(argv, { ...deps, remove: true }),
63
+ coverage: coverageMain,
64
+ trace: traceMain,
65
+ impact: impactMain,
66
+ build: buildMain,
67
+ finalise: finaliseMain,
68
+ doctor: doctorMain,
69
+ guidance: guidanceMain,
70
+ mcp: mcpMain,
71
+ preflight: preflightMain,
72
+ review: reviewMain,
73
+ fbs: fbsMain,
74
+ 'test-suite': testSuiteMain,
75
+ 'ui-classify': uiClassifyMain,
76
+ 'ui-baseline': uiBaselineMain,
77
+ design: designMain,
78
+ 'browser-verify': browserVerifyMain,
79
+ // Track C+D (elicitation-and-playbook-hardening-0.7.0) verbs.
80
+ 'req-classify': reqClassifyMain,
81
+ 'req-baseline': reqBaselineMain,
82
+ intake: intakeMain,
83
+ // 0.7.1 packaging consolidation (R3, ratified 2026-08-06): the verify
84
+ // suite lives under `rcf verify <run|report|provision|cleanup|mcp>`.
85
+ // Dispatches to the same handlers as the `rcf-verify` alias bin.
86
+ verify: verifyMain,
87
+ help: helpMain,
88
+ };
89
+
90
+ /**
91
+ * Entry point. Reads argv (minus node + script), dispatches on the
92
+ * first positional. Returns a Promise resolving to an exit code.
93
+ *
94
+ * @param {string[]} argv
95
+ * @param {object} [deps]
96
+ * @returns {Promise<number>}
97
+ */
98
+ export async function main(argv, deps = {}) {
99
+ const stdout = deps.stdout ?? process.stdout;
100
+ const stderr = deps.stderr ?? process.stderr;
101
+
102
+ if (argv.length === 0) {
103
+ stdout.write(TOP_LEVEL_HELP);
104
+ return 0;
105
+ }
106
+ const first = argv[0];
107
+ if (first === '--version' || first === '-v') {
108
+ const version = await readPackageVersion();
109
+ stdout.write(`rcf ${version}\n`);
110
+ return 0;
111
+ }
112
+ if (first === '--help' || first === '-h') {
113
+ stdout.write(TOP_LEVEL_HELP);
114
+ return 0;
115
+ }
116
+ const handler = SUBCOMMANDS[first];
117
+ if (!handler) {
118
+ stderr.write(`[error] usage unknown subcommand: ${first}\n`);
119
+ stderr.write(TOP_LEVEL_HELP);
120
+ return 2;
121
+ }
122
+ return await handler(argv.slice(1), deps);
123
+ }
124
+
125
+ async function readPackageVersion() {
126
+ try {
127
+ const pkgPath = resolve(here, '..', 'package.json');
128
+ const pkg = JSON.parse(await readFile(pkgPath, 'utf8'));
129
+ return pkg.version ?? '0.0.0';
130
+ } catch {
131
+ return '0.0.0';
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Compare `import.meta.url` to `process.argv[1]` in a symlink-safe way.
137
+ * On macOS `/tmp` is a symlink to `/private/tmp`, and any `npm link` /
138
+ * `pnpm link` install exposes the bin via a symlink. `import.meta.url`
139
+ * always resolves via realpath; `process.argv[1]` is the raw string the
140
+ * shell/OS passed. Normalise both via `fs.realpathSync` before compare.
141
+ * Falls back to the raw compare if realpath fails (e.g. path removed).
142
+ *
143
+ * @param {string} metaUrl - `import.meta.url`
144
+ * @param {string} argvPath - `process.argv[1]`
145
+ * @returns {boolean}
146
+ */
147
+ export function isSameEntryPoint(metaUrl, argvPath) {
148
+ try {
149
+ const metaPath = fileURLToPath(metaUrl);
150
+ return realpathSync(metaPath) === realpathSync(argvPath);
151
+ } catch {
152
+ // realpath failed on one side — fall back to the raw URL compare.
153
+ try {
154
+ return metaUrl === pathToFileURL(argvPath).href;
155
+ } catch {
156
+ return false;
157
+ }
158
+ }
159
+ }
160
+
161
+ // isMain gate — normalise both sides via realpath. Without this, macOS symlinks
162
+ // like `/tmp` -> `/private/tmp` and every `npm link` / `pnpm link` shim break
163
+ // the compare and main() silently never runs. See BUG-001.
164
+ const isMain = process.argv[1] && isSameEntryPoint(import.meta.url, process.argv[1]);
165
+ if (isMain) {
166
+ main(process.argv.slice(2))
167
+ .then((code) => process.exit(code))
168
+ .catch((err) => {
169
+ // Exit 1 is the "unexpected" escape hatch (§D15). Stack is not
170
+ // suppressed even under --quiet - operator needs the raw failure.
171
+ process.stderr.write(`[rcf] unexpected failure: ${err.message}\n${err.stack}\n`);
172
+ process.exit(1);
173
+ });
174
+ }
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ // Detached view-supervisor child entry point (spec §9.3).
3
+ //
4
+ // Spawned by `rcf view start --detach`; the parent CLI process
5
+ // invokes `child_process.spawn` on this file with `detached: true` and
6
+ // unrefs. The child reads its config from env vars set by the parent,
7
+ // then hands off to the supervisor loop.
8
+
9
+ import { runDetachedChild } from '../src/view-supervisor/index.js';
10
+
11
+ runDetachedChild().catch((err) => {
12
+ process.stderr.write(`[view-supervisor-child] unexpected failure: ${err.message}\n${err.stack}\n`);
13
+ process.exit(1);
14
+ });