@warpgogol/forge 4.1.6 → 4.2.1

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 (756) hide show
  1. package/AGENTS.md +2 -1
  2. package/CHANGELOG.md +33 -0
  3. package/CONTRIBUTING.md +36 -0
  4. package/README.md +129 -535
  5. package/README.uk.md +145 -554
  6. package/SECURITY.md +17 -0
  7. package/dist/bin/cli.d.ts +3 -0
  8. package/dist/bin/cli.d.ts.map +1 -0
  9. package/dist/bin/cli.js +296 -0
  10. package/dist/bin/cli.js.map +1 -0
  11. package/dist/os/adr/adr.module.d.ts +3 -0
  12. package/dist/os/adr/adr.module.d.ts.map +1 -0
  13. package/dist/os/adr/adr.module.js +153 -0
  14. package/dist/os/adr/adr.module.js.map +1 -0
  15. package/dist/os/adr/frontmatter-io.d.ts +12 -0
  16. package/dist/os/adr/frontmatter-io.d.ts.map +1 -0
  17. package/dist/os/adr/frontmatter-io.js +67 -0
  18. package/dist/os/adr/frontmatter-io.js.map +1 -0
  19. package/dist/os/adr/handlers/archive.d.ts +24 -0
  20. package/dist/os/adr/handlers/archive.d.ts.map +1 -0
  21. package/dist/os/adr/handlers/archive.js +194 -0
  22. package/dist/os/adr/handlers/archive.js.map +1 -0
  23. package/dist/os/adr/handlers/implement-stamp.d.ts +4 -0
  24. package/dist/os/adr/handlers/implement-stamp.d.ts.map +1 -0
  25. package/dist/os/adr/handlers/implement-stamp.js +264 -0
  26. package/dist/os/adr/handlers/implement-stamp.js.map +1 -0
  27. package/dist/os/adr/handlers/list-create.d.ts +5 -0
  28. package/dist/os/adr/handlers/list-create.d.ts.map +1 -0
  29. package/dist/os/adr/handlers/list-create.js +201 -0
  30. package/dist/os/adr/handlers/list-create.js.map +1 -0
  31. package/dist/os/adr/handlers/validate.d.ts +4 -0
  32. package/dist/os/adr/handlers/validate.d.ts.map +1 -0
  33. package/dist/os/adr/handlers/validate.js +304 -0
  34. package/dist/os/adr/handlers/validate.js.map +1 -0
  35. package/dist/os/adr/index.d.ts +8 -0
  36. package/dist/os/adr/index.d.ts.map +1 -0
  37. package/dist/os/adr/index.js +18 -0
  38. package/dist/os/adr/index.js.map +1 -0
  39. package/dist/os/adr/types.d.ts +81 -0
  40. package/dist/os/adr/types.d.ts.map +1 -0
  41. package/dist/os/adr/types.js +62 -0
  42. package/dist/os/adr/types.js.map +1 -0
  43. package/dist/os/audit/audit.module.d.ts +3 -0
  44. package/dist/os/audit/audit.module.d.ts.map +1 -0
  45. package/dist/os/audit/audit.module.js +50 -0
  46. package/dist/os/audit/audit.module.js.map +1 -0
  47. package/dist/os/audit/frontmatter-io.d.ts +12 -0
  48. package/dist/os/audit/frontmatter-io.d.ts.map +1 -0
  49. package/dist/os/audit/frontmatter-io.js +71 -0
  50. package/dist/os/audit/frontmatter-io.js.map +1 -0
  51. package/dist/os/audit/handlers/archive.d.ts +4 -0
  52. package/dist/os/audit/handlers/archive.d.ts.map +1 -0
  53. package/dist/os/audit/handlers/archive.js +207 -0
  54. package/dist/os/audit/handlers/archive.js.map +1 -0
  55. package/dist/os/audit/index.d.ts +6 -0
  56. package/dist/os/audit/index.d.ts.map +1 -0
  57. package/dist/os/audit/index.js +16 -0
  58. package/dist/os/audit/index.js.map +1 -0
  59. package/dist/os/audit/types.d.ts +12 -0
  60. package/dist/os/audit/types.d.ts.map +1 -0
  61. package/dist/os/audit/types.js +17 -0
  62. package/dist/os/audit/types.js.map +1 -0
  63. package/dist/os/compass/compass.module.d.ts +3 -0
  64. package/dist/os/compass/compass.module.d.ts.map +1 -0
  65. package/dist/os/compass/compass.module.js +191 -0
  66. package/dist/os/compass/compass.module.js.map +1 -0
  67. package/dist/os/compass/handlers/compass-audit-handler.d.ts +36 -0
  68. package/dist/os/compass/handlers/compass-audit-handler.d.ts.map +1 -0
  69. package/dist/os/compass/handlers/compass-audit-handler.js +260 -0
  70. package/dist/os/compass/handlers/compass-audit-handler.js.map +1 -0
  71. package/dist/os/compass/handlers/compass-change-summary-handler.d.ts +19 -0
  72. package/dist/os/compass/handlers/compass-change-summary-handler.d.ts.map +1 -0
  73. package/dist/os/compass/handlers/compass-change-summary-handler.js +222 -0
  74. package/dist/os/compass/handlers/compass-change-summary-handler.js.map +1 -0
  75. package/dist/os/compass/handlers/compass-inventory-handler.d.ts +28 -0
  76. package/dist/os/compass/handlers/compass-inventory-handler.d.ts.map +1 -0
  77. package/dist/os/compass/handlers/compass-inventory-handler.js +387 -0
  78. package/dist/os/compass/handlers/compass-inventory-handler.js.map +1 -0
  79. package/dist/os/compass/handlers/compass-inventory.d.ts +30 -0
  80. package/dist/os/compass/handlers/compass-inventory.d.ts.map +1 -0
  81. package/dist/os/compass/handlers/compass-inventory.js +472 -0
  82. package/dist/os/compass/handlers/compass-inventory.js.map +1 -0
  83. package/dist/os/compass/handlers/git-revision.d.ts +8 -0
  84. package/dist/os/compass/handlers/git-revision.d.ts.map +1 -0
  85. package/dist/os/compass/handlers/git-revision.js +99 -0
  86. package/dist/os/compass/handlers/git-revision.js.map +1 -0
  87. package/dist/os/compass/handlers/resolve-scan-root.d.ts +3 -0
  88. package/dist/os/compass/handlers/resolve-scan-root.d.ts.map +1 -0
  89. package/dist/os/compass/handlers/resolve-scan-root.js +57 -0
  90. package/dist/os/compass/handlers/resolve-scan-root.js.map +1 -0
  91. package/dist/os/compass/index.d.ts +8 -0
  92. package/dist/os/compass/index.d.ts.map +1 -0
  93. package/dist/os/compass/index.js +19 -0
  94. package/dist/os/compass/index.js.map +1 -0
  95. package/dist/os/core/core.module.d.ts +3 -0
  96. package/dist/os/core/core.module.d.ts.map +1 -0
  97. package/dist/os/core/core.module.js +855 -0
  98. package/dist/os/core/core.module.js.map +1 -0
  99. package/dist/os/core/handlers/assets-check.d.ts +19 -0
  100. package/dist/os/core/handlers/assets-check.d.ts.map +1 -0
  101. package/dist/os/core/handlers/assets-check.js +89 -0
  102. package/dist/os/core/handlers/assets-check.js.map +1 -0
  103. package/dist/os/core/handlers/assets-helpers.d.ts +28 -0
  104. package/dist/os/core/handlers/assets-helpers.d.ts.map +1 -0
  105. package/dist/os/core/handlers/assets-helpers.js +128 -0
  106. package/dist/os/core/handlers/assets-helpers.js.map +1 -0
  107. package/dist/os/core/handlers/assets-list.d.ts +9 -0
  108. package/dist/os/core/handlers/assets-list.d.ts.map +1 -0
  109. package/dist/os/core/handlers/assets-list.js +72 -0
  110. package/dist/os/core/handlers/assets-list.js.map +1 -0
  111. package/dist/os/core/handlers/build.d.ts +16 -0
  112. package/dist/os/core/handlers/build.d.ts.map +1 -0
  113. package/dist/os/core/handlers/build.js +123 -0
  114. package/dist/os/core/handlers/build.js.map +1 -0
  115. package/dist/os/core/handlers/determinism-check.d.ts +20 -0
  116. package/dist/os/core/handlers/determinism-check.d.ts.map +1 -0
  117. package/dist/os/core/handlers/determinism-check.js +289 -0
  118. package/dist/os/core/handlers/determinism-check.js.map +1 -0
  119. package/dist/os/core/handlers/dev.d.ts +10 -0
  120. package/dist/os/core/handlers/dev.d.ts.map +1 -0
  121. package/dist/os/core/handlers/dev.js +102 -0
  122. package/dist/os/core/handlers/dev.js.map +1 -0
  123. package/dist/os/core/handlers/forge-autonomy-validate.d.ts +18 -0
  124. package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +1 -0
  125. package/dist/os/core/handlers/forge-autonomy-validate.js +115 -0
  126. package/dist/os/core/handlers/forge-autonomy-validate.js.map +1 -0
  127. package/dist/os/core/handlers/knowledge-compact.d.ts +4 -0
  128. package/dist/os/core/handlers/knowledge-compact.d.ts.map +1 -0
  129. package/dist/os/core/handlers/knowledge-compact.js +204 -0
  130. package/dist/os/core/handlers/knowledge-compact.js.map +1 -0
  131. package/dist/os/core/handlers/package-health.d.ts +17 -0
  132. package/dist/os/core/handlers/package-health.d.ts.map +1 -0
  133. package/dist/os/core/handlers/package-health.js +217 -0
  134. package/dist/os/core/handlers/package-health.js.map +1 -0
  135. package/dist/os/core/handlers/pinned-check.d.ts +49 -0
  136. package/dist/os/core/handlers/pinned-check.d.ts.map +1 -0
  137. package/dist/os/core/handlers/pinned-check.js +159 -0
  138. package/dist/os/core/handlers/pinned-check.js.map +1 -0
  139. package/dist/os/core/handlers/pinned-init.d.ts +19 -0
  140. package/dist/os/core/handlers/pinned-init.d.ts.map +1 -0
  141. package/dist/os/core/handlers/pinned-init.js +283 -0
  142. package/dist/os/core/handlers/pinned-init.js.map +1 -0
  143. package/dist/os/core/handlers/pinned-types.d.ts +29 -0
  144. package/dist/os/core/handlers/pinned-types.d.ts.map +1 -0
  145. package/dist/os/core/handlers/pinned-types.js +16 -0
  146. package/dist/os/core/handlers/pinned-types.js.map +1 -0
  147. package/dist/os/core/handlers/pinned-validate.d.ts +4 -0
  148. package/dist/os/core/handlers/pinned-validate.d.ts.map +1 -0
  149. package/dist/os/core/handlers/pinned-validate.js +248 -0
  150. package/dist/os/core/handlers/pinned-validate.js.map +1 -0
  151. package/dist/os/core/handlers/profile-resolve.d.ts +13 -0
  152. package/dist/os/core/handlers/profile-resolve.d.ts.map +1 -0
  153. package/dist/os/core/handlers/profile-resolve.js +65 -0
  154. package/dist/os/core/handlers/profile-resolve.js.map +1 -0
  155. package/dist/os/core/handlers/public-surface.d.ts +13 -0
  156. package/dist/os/core/handlers/public-surface.d.ts.map +1 -0
  157. package/dist/os/core/handlers/public-surface.js +148 -0
  158. package/dist/os/core/handlers/public-surface.js.map +1 -0
  159. package/dist/os/core/handlers/release-prepare.d.ts +25 -0
  160. package/dist/os/core/handlers/release-prepare.d.ts.map +1 -0
  161. package/dist/os/core/handlers/release-prepare.js +228 -0
  162. package/dist/os/core/handlers/release-prepare.js.map +1 -0
  163. package/dist/os/core/handlers/release-publish.d.ts +13 -0
  164. package/dist/os/core/handlers/release-publish.d.ts.map +1 -0
  165. package/dist/os/core/handlers/release-publish.js +173 -0
  166. package/dist/os/core/handlers/release-publish.js.map +1 -0
  167. package/dist/os/core/handlers/validate.d.ts +39 -0
  168. package/dist/os/core/handlers/validate.d.ts.map +1 -0
  169. package/dist/os/core/handlers/validate.js +241 -0
  170. package/dist/os/core/handlers/validate.js.map +1 -0
  171. package/dist/os/core/index.d.ts +2 -0
  172. package/dist/os/core/index.d.ts.map +1 -0
  173. package/dist/os/core/index.js +13 -0
  174. package/dist/os/core/index.js.map +1 -0
  175. package/dist/os/exploration/exploration.module.d.ts +3 -0
  176. package/dist/os/exploration/exploration.module.d.ts.map +1 -0
  177. package/dist/os/exploration/exploration.module.js +88 -0
  178. package/dist/os/exploration/exploration.module.js.map +1 -0
  179. package/dist/os/exploration/frontmatter-io.d.ts +13 -0
  180. package/dist/os/exploration/frontmatter-io.d.ts.map +1 -0
  181. package/dist/os/exploration/frontmatter-io.js +61 -0
  182. package/dist/os/exploration/frontmatter-io.js.map +1 -0
  183. package/dist/os/exploration/handlers/archive.d.ts +4 -0
  184. package/dist/os/exploration/handlers/archive.d.ts.map +1 -0
  185. package/dist/os/exploration/handlers/archive.js +141 -0
  186. package/dist/os/exploration/handlers/archive.js.map +1 -0
  187. package/dist/os/exploration/handlers/list.d.ts +4 -0
  188. package/dist/os/exploration/handlers/list.d.ts.map +1 -0
  189. package/dist/os/exploration/handlers/list.js +64 -0
  190. package/dist/os/exploration/handlers/list.js.map +1 -0
  191. package/dist/os/exploration/handlers/show.d.ts +4 -0
  192. package/dist/os/exploration/handlers/show.d.ts.map +1 -0
  193. package/dist/os/exploration/handlers/show.js +97 -0
  194. package/dist/os/exploration/handlers/show.js.map +1 -0
  195. package/dist/os/exploration/index.d.ts +7 -0
  196. package/dist/os/exploration/index.d.ts.map +1 -0
  197. package/dist/os/exploration/index.js +17 -0
  198. package/dist/os/exploration/index.js.map +1 -0
  199. package/dist/os/exploration/types.d.ts +38 -0
  200. package/dist/os/exploration/types.d.ts.map +1 -0
  201. package/dist/os/exploration/types.js +23 -0
  202. package/dist/os/exploration/types.js.map +1 -0
  203. package/dist/os/mission/handlers/archive.d.ts +4 -0
  204. package/dist/os/mission/handlers/archive.d.ts.map +1 -0
  205. package/dist/os/mission/handlers/archive.js +454 -0
  206. package/dist/os/mission/handlers/archive.js.map +1 -0
  207. package/dist/os/mission/index.d.ts +2 -0
  208. package/dist/os/mission/index.d.ts.map +1 -0
  209. package/dist/os/mission/index.js +2 -0
  210. package/dist/os/mission/index.js.map +1 -0
  211. package/dist/os/mission/mission.module.d.ts +3 -0
  212. package/dist/os/mission/mission.module.d.ts.map +1 -0
  213. package/dist/os/mission/mission.module.js +55 -0
  214. package/dist/os/mission/mission.module.js.map +1 -0
  215. package/dist/os/mission/types.d.ts +23 -0
  216. package/dist/os/mission/types.d.ts.map +1 -0
  217. package/dist/os/mission/types.js +19 -0
  218. package/dist/os/mission/types.js.map +1 -0
  219. package/dist/os/naming/index.d.ts +3 -0
  220. package/dist/os/naming/index.d.ts.map +1 -0
  221. package/dist/os/naming/index.js +14 -0
  222. package/dist/os/naming/index.js.map +1 -0
  223. package/dist/os/naming/naming-convention.d.ts +25 -0
  224. package/dist/os/naming/naming-convention.d.ts.map +1 -0
  225. package/dist/os/naming/naming-convention.js +334 -0
  226. package/dist/os/naming/naming-convention.js.map +1 -0
  227. package/dist/os/naming/naming.module.d.ts +3 -0
  228. package/dist/os/naming/naming.module.d.ts.map +1 -0
  229. package/dist/os/naming/naming.module.js +41 -0
  230. package/dist/os/naming/naming.module.js.map +1 -0
  231. package/dist/os/notes/index.d.ts +2 -0
  232. package/dist/os/notes/index.d.ts.map +1 -0
  233. package/dist/os/notes/index.js +10 -0
  234. package/dist/os/notes/index.js.map +1 -0
  235. package/dist/os/notes/notes.module.d.ts +3 -0
  236. package/dist/os/notes/notes.module.d.ts.map +1 -0
  237. package/dist/os/notes/notes.module.js +93 -0
  238. package/dist/os/notes/notes.module.js.map +1 -0
  239. package/dist/os/plan/frontmatter-io.d.ts +12 -0
  240. package/dist/os/plan/frontmatter-io.d.ts.map +1 -0
  241. package/dist/os/plan/frontmatter-io.js +69 -0
  242. package/dist/os/plan/frontmatter-io.js.map +1 -0
  243. package/dist/os/plan/handlers/archive.d.ts +4 -0
  244. package/dist/os/plan/handlers/archive.d.ts.map +1 -0
  245. package/dist/os/plan/handlers/archive.js +206 -0
  246. package/dist/os/plan/handlers/archive.js.map +1 -0
  247. package/dist/os/plan/index.d.ts +6 -0
  248. package/dist/os/plan/index.d.ts.map +1 -0
  249. package/dist/os/plan/index.js +16 -0
  250. package/dist/os/plan/index.js.map +1 -0
  251. package/dist/os/plan/plan.module.d.ts +3 -0
  252. package/dist/os/plan/plan.module.d.ts.map +1 -0
  253. package/dist/os/plan/plan.module.js +50 -0
  254. package/dist/os/plan/plan.module.js.map +1 -0
  255. package/dist/os/plan/types.d.ts +12 -0
  256. package/dist/os/plan/types.d.ts.map +1 -0
  257. package/dist/os/plan/types.js +17 -0
  258. package/dist/os/plan/types.js.map +1 -0
  259. package/dist/os/plugin/plugin.module.d.ts +25 -0
  260. package/dist/os/plugin/plugin.module.d.ts.map +1 -0
  261. package/dist/os/plugin/plugin.module.js +212 -0
  262. package/dist/os/plugin/plugin.module.js.map +1 -0
  263. package/dist/os/program/discovery.d.ts +61 -0
  264. package/dist/os/program/discovery.d.ts.map +1 -0
  265. package/dist/os/program/discovery.js +236 -0
  266. package/dist/os/program/discovery.js.map +1 -0
  267. package/dist/os/program/handlers/complete.d.ts +12 -0
  268. package/dist/os/program/handlers/complete.d.ts.map +1 -0
  269. package/dist/os/program/handlers/complete.js +362 -0
  270. package/dist/os/program/handlers/complete.js.map +1 -0
  271. package/dist/os/program/handlers/lease.d.ts +13 -0
  272. package/dist/os/program/handlers/lease.d.ts.map +1 -0
  273. package/dist/os/program/handlers/lease.js +328 -0
  274. package/dist/os/program/handlers/lease.js.map +1 -0
  275. package/dist/os/program/handlers/seal.d.ts +12 -0
  276. package/dist/os/program/handlers/seal.d.ts.map +1 -0
  277. package/dist/os/program/handlers/seal.js +277 -0
  278. package/dist/os/program/handlers/seal.js.map +1 -0
  279. package/dist/os/program/handlers/validate.d.ts +14 -0
  280. package/dist/os/program/handlers/validate.d.ts.map +1 -0
  281. package/dist/os/program/handlers/validate.js +170 -0
  282. package/dist/os/program/handlers/validate.js.map +1 -0
  283. package/dist/os/program/lease.d.ts +39 -0
  284. package/dist/os/program/lease.d.ts.map +1 -0
  285. package/dist/os/program/lease.js +129 -0
  286. package/dist/os/program/lease.js.map +1 -0
  287. package/dist/os/program/program.module.d.ts +3 -0
  288. package/dist/os/program/program.module.d.ts.map +1 -0
  289. package/dist/os/program/program.module.js +209 -0
  290. package/dist/os/program/program.module.js.map +1 -0
  291. package/dist/os/program/schemas.d.ts +225 -0
  292. package/dist/os/program/schemas.d.ts.map +1 -0
  293. package/dist/os/program/schemas.js +174 -0
  294. package/dist/os/program/schemas.js.map +1 -0
  295. package/dist/os/program/state.d.ts +38 -0
  296. package/dist/os/program/state.d.ts.map +1 -0
  297. package/dist/os/program/state.js +189 -0
  298. package/dist/os/program/state.js.map +1 -0
  299. package/dist/os/rfc/acceptance.d.ts +15 -0
  300. package/dist/os/rfc/acceptance.d.ts.map +1 -0
  301. package/dist/os/rfc/acceptance.js +438 -0
  302. package/dist/os/rfc/acceptance.js.map +1 -0
  303. package/dist/os/rfc/decision-log.d.ts +6 -0
  304. package/dist/os/rfc/decision-log.d.ts.map +1 -0
  305. package/dist/os/rfc/decision-log.js +269 -0
  306. package/dist/os/rfc/decision-log.js.map +1 -0
  307. package/dist/os/rfc/dna-trace.d.ts +27 -0
  308. package/dist/os/rfc/dna-trace.d.ts.map +1 -0
  309. package/dist/os/rfc/dna-trace.js +214 -0
  310. package/dist/os/rfc/dna-trace.js.map +1 -0
  311. package/dist/os/rfc/frontmatter-io.d.ts +18 -0
  312. package/dist/os/rfc/frontmatter-io.d.ts.map +1 -0
  313. package/dist/os/rfc/frontmatter-io.js +110 -0
  314. package/dist/os/rfc/frontmatter-io.js.map +1 -0
  315. package/dist/os/rfc/handlers/archive.d.ts +25 -0
  316. package/dist/os/rfc/handlers/archive.d.ts.map +1 -0
  317. package/dist/os/rfc/handlers/archive.js +247 -0
  318. package/dist/os/rfc/handlers/archive.js.map +1 -0
  319. package/dist/os/rfc/handlers/check.d.ts +4 -0
  320. package/dist/os/rfc/handlers/check.d.ts.map +1 -0
  321. package/dist/os/rfc/handlers/check.js +203 -0
  322. package/dist/os/rfc/handlers/check.js.map +1 -0
  323. package/dist/os/rfc/handlers/implement-stamp.d.ts +4 -0
  324. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -0
  325. package/dist/os/rfc/handlers/implement-stamp.js +452 -0
  326. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -0
  327. package/dist/os/rfc/handlers/index-graph.d.ts +13 -0
  328. package/dist/os/rfc/handlers/index-graph.d.ts.map +1 -0
  329. package/dist/os/rfc/handlers/index-graph.js +192 -0
  330. package/dist/os/rfc/handlers/index-graph.js.map +1 -0
  331. package/dist/os/rfc/handlers/lifecycle.d.ts +13 -0
  332. package/dist/os/rfc/handlers/lifecycle.d.ts.map +1 -0
  333. package/dist/os/rfc/handlers/lifecycle.js +155 -0
  334. package/dist/os/rfc/handlers/lifecycle.js.map +1 -0
  335. package/dist/os/rfc/handlers/list-create.d.ts +6 -0
  336. package/dist/os/rfc/handlers/list-create.d.ts.map +1 -0
  337. package/dist/os/rfc/handlers/list-create.js +260 -0
  338. package/dist/os/rfc/handlers/list-create.js.map +1 -0
  339. package/dist/os/rfc/handlers/pipeline-status.d.ts +26 -0
  340. package/dist/os/rfc/handlers/pipeline-status.d.ts.map +1 -0
  341. package/dist/os/rfc/handlers/pipeline-status.js +124 -0
  342. package/dist/os/rfc/handlers/pipeline-status.js.map +1 -0
  343. package/dist/os/rfc/handlers/shared.d.ts +22 -0
  344. package/dist/os/rfc/handlers/shared.d.ts.map +1 -0
  345. package/dist/os/rfc/handlers/shared.js +105 -0
  346. package/dist/os/rfc/handlers/shared.js.map +1 -0
  347. package/dist/os/rfc/handlers/supersede-propose.d.ts +4 -0
  348. package/dist/os/rfc/handlers/supersede-propose.d.ts.map +1 -0
  349. package/dist/os/rfc/handlers/supersede-propose.js +203 -0
  350. package/dist/os/rfc/handlers/supersede-propose.js.map +1 -0
  351. package/dist/os/rfc/handlers/validate-rules.d.ts +80 -0
  352. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -0
  353. package/dist/os/rfc/handlers/validate-rules.js +907 -0
  354. package/dist/os/rfc/handlers/validate-rules.js.map +1 -0
  355. package/dist/os/rfc/handlers/validate.d.ts +4 -0
  356. package/dist/os/rfc/handlers/validate.d.ts.map +1 -0
  357. package/dist/os/rfc/handlers/validate.js +134 -0
  358. package/dist/os/rfc/handlers/validate.js.map +1 -0
  359. package/dist/os/rfc/handlers.d.ts +7 -0
  360. package/dist/os/rfc/handlers.d.ts.map +1 -0
  361. package/dist/os/rfc/handlers.js +19 -0
  362. package/dist/os/rfc/handlers.js.map +1 -0
  363. package/dist/os/rfc/index.d.ts +18 -0
  364. package/dist/os/rfc/index.d.ts.map +1 -0
  365. package/dist/os/rfc/index.js +24 -0
  366. package/dist/os/rfc/index.js.map +1 -0
  367. package/dist/os/rfc/rfc.module.d.ts +3 -0
  368. package/dist/os/rfc/rfc.module.d.ts.map +1 -0
  369. package/dist/os/rfc/rfc.module.js +390 -0
  370. package/dist/os/rfc/rfc.module.js.map +1 -0
  371. package/dist/os/rfc/types.d.ts +559 -0
  372. package/dist/os/rfc/types.d.ts.map +1 -0
  373. package/dist/os/rfc/types.js +118 -0
  374. package/dist/os/rfc/types.js.map +1 -0
  375. package/dist/os/rfc/verification-evidence.d.ts +15 -0
  376. package/dist/os/rfc/verification-evidence.d.ts.map +1 -0
  377. package/dist/os/rfc/verification-evidence.js +185 -0
  378. package/dist/os/rfc/verification-evidence.js.map +1 -0
  379. package/dist/os/rfc/verification-refresh.d.ts +4 -0
  380. package/dist/os/rfc/verification-refresh.d.ts.map +1 -0
  381. package/dist/os/rfc/verification-refresh.js +160 -0
  382. package/dist/os/rfc/verification-refresh.js.map +1 -0
  383. package/dist/os/session/atif-parser.d.ts +29 -0
  384. package/dist/os/session/atif-parser.d.ts.map +1 -0
  385. package/dist/os/session/atif-parser.js +140 -0
  386. package/dist/os/session/atif-parser.js.map +1 -0
  387. package/dist/os/session/frontmatter-io.d.ts +31 -0
  388. package/dist/os/session/frontmatter-io.d.ts.map +1 -0
  389. package/dist/os/session/frontmatter-io.js +146 -0
  390. package/dist/os/session/frontmatter-io.js.map +1 -0
  391. package/dist/os/session/handlers/archive.d.ts +4 -0
  392. package/dist/os/session/handlers/archive.d.ts.map +1 -0
  393. package/dist/os/session/handlers/archive.js +241 -0
  394. package/dist/os/session/handlers/archive.js.map +1 -0
  395. package/dist/os/session/handlers/list.d.ts +4 -0
  396. package/dist/os/session/handlers/list.d.ts.map +1 -0
  397. package/dist/os/session/handlers/list.js +147 -0
  398. package/dist/os/session/handlers/list.js.map +1 -0
  399. package/dist/os/session/handlers/metrics-aggregate.d.ts +4 -0
  400. package/dist/os/session/handlers/metrics-aggregate.d.ts.map +1 -0
  401. package/dist/os/session/handlers/metrics-aggregate.js +183 -0
  402. package/dist/os/session/handlers/metrics-aggregate.js.map +1 -0
  403. package/dist/os/session/handlers/metrics-rfc.d.ts +4 -0
  404. package/dist/os/session/handlers/metrics-rfc.d.ts.map +1 -0
  405. package/dist/os/session/handlers/metrics-rfc.js +272 -0
  406. package/dist/os/session/handlers/metrics-rfc.js.map +1 -0
  407. package/dist/os/session/handlers/metrics-session.d.ts +9 -0
  408. package/dist/os/session/handlers/metrics-session.d.ts.map +1 -0
  409. package/dist/os/session/handlers/metrics-session.js +167 -0
  410. package/dist/os/session/handlers/metrics-session.js.map +1 -0
  411. package/dist/os/session/handlers/save.d.ts +6 -0
  412. package/dist/os/session/handlers/save.d.ts.map +1 -0
  413. package/dist/os/session/handlers/save.js +319 -0
  414. package/dist/os/session/handlers/save.js.map +1 -0
  415. package/dist/os/session/handlers/validate.d.ts +4 -0
  416. package/dist/os/session/handlers/validate.d.ts.map +1 -0
  417. package/dist/os/session/handlers/validate.js +224 -0
  418. package/dist/os/session/handlers/validate.js.map +1 -0
  419. package/dist/os/session/index.d.ts +9 -0
  420. package/dist/os/session/index.d.ts.map +1 -0
  421. package/dist/os/session/index.js +21 -0
  422. package/dist/os/session/index.js.map +1 -0
  423. package/dist/os/session/session.module.d.ts +3 -0
  424. package/dist/os/session/session.module.d.ts.map +1 -0
  425. package/dist/os/session/session.module.js +147 -0
  426. package/dist/os/session/session.module.js.map +1 -0
  427. package/dist/os/session/types.d.ts +214 -0
  428. package/dist/os/session/types.d.ts.map +1 -0
  429. package/dist/os/session/types.js +61 -0
  430. package/dist/os/session/types.js.map +1 -0
  431. package/dist/os/spec/live-spec-list.d.ts +4 -0
  432. package/dist/os/spec/live-spec-list.d.ts.map +1 -0
  433. package/dist/os/spec/live-spec-list.js +72 -0
  434. package/dist/os/spec/live-spec-list.js.map +1 -0
  435. package/dist/os/spec/live-spec-merge.d.ts +4 -0
  436. package/dist/os/spec/live-spec-merge.d.ts.map +1 -0
  437. package/dist/os/spec/live-spec-merge.js +316 -0
  438. package/dist/os/spec/live-spec-merge.js.map +1 -0
  439. package/dist/os/spec/live-spec-show.d.ts +4 -0
  440. package/dist/os/spec/live-spec-show.d.ts.map +1 -0
  441. package/dist/os/spec/live-spec-show.js +105 -0
  442. package/dist/os/spec/live-spec-show.js.map +1 -0
  443. package/dist/os/spec/live-spec-types.d.ts +71 -0
  444. package/dist/os/spec/live-spec-types.d.ts.map +1 -0
  445. package/dist/os/spec/live-spec-types.js +14 -0
  446. package/dist/os/spec/live-spec-types.js.map +1 -0
  447. package/dist/os/spec/live-spec-validate.d.ts +4 -0
  448. package/dist/os/spec/live-spec-validate.d.ts.map +1 -0
  449. package/dist/os/spec/live-spec-validate.js +140 -0
  450. package/dist/os/spec/live-spec-validate.js.map +1 -0
  451. package/dist/os/spec/spec-materialize.d.ts +21 -0
  452. package/dist/os/spec/spec-materialize.d.ts.map +1 -0
  453. package/dist/os/spec/spec-materialize.js +342 -0
  454. package/dist/os/spec/spec-materialize.js.map +1 -0
  455. package/dist/os/spec/spec-schema.d.ts +126 -0
  456. package/dist/os/spec/spec-schema.d.ts.map +1 -0
  457. package/dist/os/spec/spec-schema.js +118 -0
  458. package/dist/os/spec/spec-schema.js.map +1 -0
  459. package/dist/os/spec/spec-status.d.ts +33 -0
  460. package/dist/os/spec/spec-status.d.ts.map +1 -0
  461. package/dist/os/spec/spec-status.js +228 -0
  462. package/dist/os/spec/spec-status.js.map +1 -0
  463. package/dist/os/spec/spec-validate.d.ts +4 -0
  464. package/dist/os/spec/spec-validate.d.ts.map +1 -0
  465. package/dist/os/spec/spec-validate.js +438 -0
  466. package/dist/os/spec/spec-validate.js.map +1 -0
  467. package/dist/os/spec/spec.module.d.ts +3 -0
  468. package/dist/os/spec/spec.module.d.ts.map +1 -0
  469. package/dist/os/spec/spec.module.js +129 -0
  470. package/dist/os/spec/spec.module.js.map +1 -0
  471. package/dist/os/werkstatt/handlers/lock.d.ts +10 -0
  472. package/dist/os/werkstatt/handlers/lock.d.ts.map +1 -0
  473. package/dist/os/werkstatt/handlers/lock.js +153 -0
  474. package/dist/os/werkstatt/handlers/lock.js.map +1 -0
  475. package/dist/os/werkstatt/handlers/schema.d.ts +33 -0
  476. package/dist/os/werkstatt/handlers/schema.d.ts.map +1 -0
  477. package/dist/os/werkstatt/handlers/schema.js +42 -0
  478. package/dist/os/werkstatt/handlers/schema.js.map +1 -0
  479. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts +15 -0
  480. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +1 -0
  481. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +152 -0
  482. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +1 -0
  483. package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts +18 -0
  484. package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts.map +1 -0
  485. package/dist/os/werkstatt/handlers/werkstatt-lock-status.js +51 -0
  486. package/dist/os/werkstatt/handlers/werkstatt-lock-status.js.map +1 -0
  487. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts +11 -0
  488. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +1 -0
  489. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +79 -0
  490. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +1 -0
  491. package/dist/os/werkstatt/handlers/workspace-deps.d.ts +12 -0
  492. package/dist/os/werkstatt/handlers/workspace-deps.d.ts.map +1 -0
  493. package/dist/os/werkstatt/handlers/workspace-deps.js +42 -0
  494. package/dist/os/werkstatt/handlers/workspace-deps.js.map +1 -0
  495. package/dist/os/werkstatt/index.d.ts +7 -0
  496. package/dist/os/werkstatt/index.d.ts.map +1 -0
  497. package/dist/os/werkstatt/index.js +18 -0
  498. package/dist/os/werkstatt/index.js.map +1 -0
  499. package/dist/os/werkstatt/werkstatt.module.d.ts +3 -0
  500. package/dist/os/werkstatt/werkstatt.module.d.ts.map +1 -0
  501. package/dist/os/werkstatt/werkstatt.module.js +63 -0
  502. package/dist/os/werkstatt/werkstatt.module.js.map +1 -0
  503. package/dist/os/workflow/handlers.d.ts +12 -0
  504. package/dist/os/workflow/handlers.d.ts.map +1 -0
  505. package/dist/os/workflow/handlers.js +262 -0
  506. package/dist/os/workflow/handlers.js.map +1 -0
  507. package/dist/os/workflow/index.d.ts +4 -0
  508. package/dist/os/workflow/index.d.ts.map +1 -0
  509. package/dist/os/workflow/index.js +18 -0
  510. package/dist/os/workflow/index.js.map +1 -0
  511. package/dist/os/workflow/types.d.ts +69 -0
  512. package/dist/os/workflow/types.d.ts.map +1 -0
  513. package/dist/os/workflow/types.js +23 -0
  514. package/dist/os/workflow/types.js.map +1 -0
  515. package/dist/os/workflow/workflow.module.d.ts +3 -0
  516. package/dist/os/workflow/workflow.module.d.ts.map +1 -0
  517. package/dist/os/workflow/workflow.module.js +56 -0
  518. package/dist/os/workflow/workflow.module.js.map +1 -0
  519. package/dist/src/cli-output.d.ts +5 -0
  520. package/dist/src/cli-output.d.ts.map +1 -0
  521. package/dist/src/cli-output.js +53 -0
  522. package/dist/src/cli-output.js.map +1 -0
  523. package/dist/src/compass/contract-registry.d.ts +7 -0
  524. package/dist/src/compass/contract-registry.d.ts.map +1 -0
  525. package/dist/src/compass/contract-registry.js +112 -0
  526. package/dist/src/compass/contract-registry.js.map +1 -0
  527. package/dist/src/compass/types.d.ts +28 -0
  528. package/dist/src/compass/types.d.ts.map +1 -0
  529. package/dist/src/compass/types.js +14 -0
  530. package/dist/src/compass/types.js.map +1 -0
  531. package/dist/src/config/forge-config.d.ts +242 -0
  532. package/dist/src/config/forge-config.d.ts.map +1 -0
  533. package/dist/src/config/forge-config.js +363 -0
  534. package/dist/src/config/forge-config.js.map +1 -0
  535. package/dist/src/forge-module.d.ts +29 -0
  536. package/dist/src/forge-module.d.ts.map +1 -0
  537. package/dist/src/forge-module.js +16 -0
  538. package/dist/src/forge-module.js.map +1 -0
  539. package/dist/src/index.d.ts +39 -0
  540. package/dist/src/index.d.ts.map +1 -0
  541. package/dist/src/index.js +59 -0
  542. package/dist/src/index.js.map +1 -0
  543. package/dist/src/knowledge/budgets.d.ts +38 -0
  544. package/dist/src/knowledge/budgets.d.ts.map +1 -0
  545. package/dist/src/knowledge/budgets.js +157 -0
  546. package/dist/src/knowledge/budgets.js.map +1 -0
  547. package/dist/src/knowledge/compact.d.ts +47 -0
  548. package/dist/src/knowledge/compact.d.ts.map +1 -0
  549. package/dist/src/knowledge/compact.js +320 -0
  550. package/dist/src/knowledge/compact.js.map +1 -0
  551. package/dist/src/knowledge/index.d.ts +7 -0
  552. package/dist/src/knowledge/index.d.ts.map +1 -0
  553. package/dist/src/knowledge/index.js +19 -0
  554. package/dist/src/knowledge/index.js.map +1 -0
  555. package/dist/src/knowledge/parse.d.ts +3 -0
  556. package/dist/src/knowledge/parse.d.ts.map +1 -0
  557. package/dist/src/knowledge/parse.js +205 -0
  558. package/dist/src/knowledge/parse.js.map +1 -0
  559. package/dist/src/knowledge/promote.d.ts +37 -0
  560. package/dist/src/knowledge/promote.d.ts.map +1 -0
  561. package/dist/src/knowledge/promote.js +120 -0
  562. package/dist/src/knowledge/promote.js.map +1 -0
  563. package/dist/src/knowledge/schema.d.ts +61 -0
  564. package/dist/src/knowledge/schema.d.ts.map +1 -0
  565. package/dist/src/knowledge/schema.js +64 -0
  566. package/dist/src/knowledge/schema.js.map +1 -0
  567. package/dist/src/knowledge/serialize.d.ts +3 -0
  568. package/dist/src/knowledge/serialize.d.ts.map +1 -0
  569. package/dist/src/knowledge/serialize.js +67 -0
  570. package/dist/src/knowledge/serialize.js.map +1 -0
  571. package/dist/src/migration-adapters/git-utils.d.ts +3 -0
  572. package/dist/src/migration-adapters/git-utils.d.ts.map +1 -0
  573. package/dist/src/migration-adapters/git-utils.js +65 -0
  574. package/dist/src/migration-adapters/git-utils.js.map +1 -0
  575. package/dist/src/migration-adapters/ignored-files.d.ts +12 -0
  576. package/dist/src/migration-adapters/ignored-files.d.ts.map +1 -0
  577. package/dist/src/migration-adapters/ignored-files.js +190 -0
  578. package/dist/src/migration-adapters/ignored-files.js.map +1 -0
  579. package/dist/src/migration-adapters/index.d.ts +8 -0
  580. package/dist/src/migration-adapters/index.d.ts.map +1 -0
  581. package/dist/src/migration-adapters/index.js +17 -0
  582. package/dist/src/migration-adapters/index.js.map +1 -0
  583. package/dist/src/migration-adapters/node-typescript-pnpm/index.d.ts +3 -0
  584. package/dist/src/migration-adapters/node-typescript-pnpm/index.d.ts.map +1 -0
  585. package/dist/src/migration-adapters/node-typescript-pnpm/index.js +141 -0
  586. package/dist/src/migration-adapters/node-typescript-pnpm/index.js.map +1 -0
  587. package/dist/src/migration-adapters/phaser-pnpm/index.d.ts +3 -0
  588. package/dist/src/migration-adapters/phaser-pnpm/index.d.ts.map +1 -0
  589. package/dist/src/migration-adapters/phaser-pnpm/index.js +142 -0
  590. package/dist/src/migration-adapters/phaser-pnpm/index.js.map +1 -0
  591. package/dist/src/migration-adapters/registry.d.ts +6 -0
  592. package/dist/src/migration-adapters/registry.d.ts.map +1 -0
  593. package/dist/src/migration-adapters/registry.js +55 -0
  594. package/dist/src/migration-adapters/registry.js.map +1 -0
  595. package/dist/src/migration-adapters/types.d.ts +35 -0
  596. package/dist/src/migration-adapters/types.d.ts.map +1 -0
  597. package/dist/src/migration-adapters/types.js +31 -0
  598. package/dist/src/migration-adapters/types.js.map +1 -0
  599. package/dist/src/onboarding/agents-generate.d.ts +31 -0
  600. package/dist/src/onboarding/agents-generate.d.ts.map +1 -0
  601. package/dist/src/onboarding/agents-generate.js +373 -0
  602. package/dist/src/onboarding/agents-generate.js.map +1 -0
  603. package/dist/src/onboarding/create.d.ts +12 -0
  604. package/dist/src/onboarding/create.d.ts.map +1 -0
  605. package/dist/src/onboarding/create.js +408 -0
  606. package/dist/src/onboarding/create.js.map +1 -0
  607. package/dist/src/onboarding/doctor.d.ts +45 -0
  608. package/dist/src/onboarding/doctor.d.ts.map +1 -0
  609. package/dist/src/onboarding/doctor.js +1222 -0
  610. package/dist/src/onboarding/doctor.js.map +1 -0
  611. package/dist/src/onboarding/init.d.ts +36 -0
  612. package/dist/src/onboarding/init.d.ts.map +1 -0
  613. package/dist/src/onboarding/init.js +412 -0
  614. package/dist/src/onboarding/init.js.map +1 -0
  615. package/dist/src/onboarding/invariant-engine.d.ts +17 -0
  616. package/dist/src/onboarding/invariant-engine.d.ts.map +1 -0
  617. package/dist/src/onboarding/invariant-engine.js +416 -0
  618. package/dist/src/onboarding/invariant-engine.js.map +1 -0
  619. package/dist/src/onboarding/memory-scaffold.d.ts +18 -0
  620. package/dist/src/onboarding/memory-scaffold.d.ts.map +1 -0
  621. package/dist/src/onboarding/memory-scaffold.js +151 -0
  622. package/dist/src/onboarding/memory-scaffold.js.map +1 -0
  623. package/dist/src/onboarding/nested-agents-generate.d.ts +18 -0
  624. package/dist/src/onboarding/nested-agents-generate.d.ts.map +1 -0
  625. package/dist/src/onboarding/nested-agents-generate.js +69 -0
  626. package/dist/src/onboarding/nested-agents-generate.js.map +1 -0
  627. package/dist/src/onboarding/nested-agents-templates.d.ts +26 -0
  628. package/dist/src/onboarding/nested-agents-templates.d.ts.map +1 -0
  629. package/dist/src/onboarding/nested-agents-templates.js +179 -0
  630. package/dist/src/onboarding/nested-agents-templates.js.map +1 -0
  631. package/dist/src/onboarding/profile-validate.d.ts +13 -0
  632. package/dist/src/onboarding/profile-validate.d.ts.map +1 -0
  633. package/dist/src/onboarding/profile-validate.js +109 -0
  634. package/dist/src/onboarding/profile-validate.js.map +1 -0
  635. package/dist/src/onboarding/scaffold-project.d.ts +12 -0
  636. package/dist/src/onboarding/scaffold-project.d.ts.map +1 -0
  637. package/dist/src/onboarding/scaffold-project.js +264 -0
  638. package/dist/src/onboarding/scaffold-project.js.map +1 -0
  639. package/dist/src/onboarding/scaffold.d.ts +15 -0
  640. package/dist/src/onboarding/scaffold.d.ts.map +1 -0
  641. package/dist/src/onboarding/scaffold.js +123 -0
  642. package/dist/src/onboarding/scaffold.js.map +1 -0
  643. package/dist/src/onboarding/upgrade.d.ts +27 -0
  644. package/dist/src/onboarding/upgrade.d.ts.map +1 -0
  645. package/dist/src/onboarding/upgrade.js +453 -0
  646. package/dist/src/onboarding/upgrade.js.map +1 -0
  647. package/dist/src/onboarding/workspace-discovery.d.ts +11 -0
  648. package/dist/src/onboarding/workspace-discovery.d.ts.map +1 -0
  649. package/dist/src/onboarding/workspace-discovery.js +138 -0
  650. package/dist/src/onboarding/workspace-discovery.js.map +1 -0
  651. package/dist/src/plugin/forge-plugin-manifest.d.ts +38 -0
  652. package/dist/src/plugin/forge-plugin-manifest.d.ts.map +1 -0
  653. package/dist/src/plugin/forge-plugin-manifest.js +52 -0
  654. package/dist/src/plugin/forge-plugin-manifest.js.map +1 -0
  655. package/dist/src/profiles/profile-schema.d.ts +361 -0
  656. package/dist/src/profiles/profile-schema.d.ts.map +1 -0
  657. package/dist/src/profiles/profile-schema.js +208 -0
  658. package/dist/src/profiles/profile-schema.js.map +1 -0
  659. package/dist/src/profiles/stack-profile.d.ts +173 -0
  660. package/dist/src/profiles/stack-profile.d.ts.map +1 -0
  661. package/dist/src/profiles/stack-profile.js +148 -0
  662. package/dist/src/profiles/stack-profile.js.map +1 -0
  663. package/dist/src/profiles/terminology-utils.d.ts +8 -0
  664. package/dist/src/profiles/terminology-utils.d.ts.map +1 -0
  665. package/dist/src/profiles/terminology-utils.js +31 -0
  666. package/dist/src/profiles/terminology-utils.js.map +1 -0
  667. package/dist/src/registry.d.ts +38 -0
  668. package/dist/src/registry.d.ts.map +1 -0
  669. package/dist/src/registry.js +174 -0
  670. package/dist/src/registry.js.map +1 -0
  671. package/dist/src/skill-schema.d.ts +30 -0
  672. package/dist/src/skill-schema.d.ts.map +1 -0
  673. package/dist/src/skill-schema.js +34 -0
  674. package/dist/src/skill-schema.js.map +1 -0
  675. package/dist/src/types.d.ts +158 -0
  676. package/dist/src/types.d.ts.map +1 -0
  677. package/dist/src/types.js +17 -0
  678. package/dist/src/types.js.map +1 -0
  679. package/dist/src/utils/fs-atomic.d.ts +7 -0
  680. package/dist/src/utils/fs-atomic.d.ts.map +1 -0
  681. package/dist/src/utils/fs-atomic.js +81 -0
  682. package/dist/src/utils/fs-atomic.js.map +1 -0
  683. package/dist/src/utils/fs-idempotent.d.ts +2 -0
  684. package/dist/src/utils/fs-idempotent.d.ts.map +1 -0
  685. package/dist/src/utils/fs-idempotent.js +39 -0
  686. package/dist/src/utils/fs-idempotent.js.map +1 -0
  687. package/dist/src/utils/fs-trash-sync.d.ts +2 -0
  688. package/dist/src/utils/fs-trash-sync.d.ts.map +1 -0
  689. package/dist/src/utils/fs-trash-sync.js +34 -0
  690. package/dist/src/utils/fs-trash-sync.js.map +1 -0
  691. package/dist/src/utils/fs-trash.d.ts +2 -0
  692. package/dist/src/utils/fs-trash.d.ts.map +1 -0
  693. package/dist/src/utils/fs-trash.js +24 -0
  694. package/dist/src/utils/fs-trash.js.map +1 -0
  695. package/dist/src/utils/fs.d.ts +8 -0
  696. package/dist/src/utils/fs.d.ts.map +1 -0
  697. package/dist/src/utils/fs.js +60 -0
  698. package/dist/src/utils/fs.js.map +1 -0
  699. package/dist/src/utils/generated-marker.d.ts +28 -0
  700. package/dist/src/utils/generated-marker.d.ts.map +1 -0
  701. package/dist/src/utils/generated-marker.js +138 -0
  702. package/dist/src/utils/generated-marker.js.map +1 -0
  703. package/dist/src/utils/hash.d.ts +2 -0
  704. package/dist/src/utils/hash.d.ts.map +1 -0
  705. package/dist/src/utils/hash.js +18 -0
  706. package/dist/src/utils/hash.js.map +1 -0
  707. package/dist/src/utils/index.d.ts +9 -0
  708. package/dist/src/utils/index.d.ts.map +1 -0
  709. package/dist/src/utils/index.js +21 -0
  710. package/dist/src/utils/index.js.map +1 -0
  711. package/dist/src/utils/string-utils.d.ts +2 -0
  712. package/dist/src/utils/string-utils.d.ts.map +1 -0
  713. package/dist/src/utils/string-utils.js +19 -0
  714. package/dist/src/utils/string-utils.js.map +1 -0
  715. package/dist/src/validators/note-frontmatter-validate.d.ts +20 -0
  716. package/dist/src/validators/note-frontmatter-validate.d.ts.map +1 -0
  717. package/dist/src/validators/note-frontmatter-validate.js +117 -0
  718. package/dist/src/validators/note-frontmatter-validate.js.map +1 -0
  719. package/dist/src/validators/note-link-validate.d.ts +21 -0
  720. package/dist/src/validators/note-link-validate.d.ts.map +1 -0
  721. package/dist/src/validators/note-link-validate.js +121 -0
  722. package/dist/src/validators/note-link-validate.js.map +1 -0
  723. package/dist/src/validators/note-orphan-detect.d.ts +19 -0
  724. package/dist/src/validators/note-orphan-detect.d.ts.map +1 -0
  725. package/dist/src/validators/note-orphan-detect.js +123 -0
  726. package/dist/src/validators/note-orphan-detect.js.map +1 -0
  727. package/dist/src/validators/port-validate.d.ts +12 -0
  728. package/dist/src/validators/port-validate.d.ts.map +1 -0
  729. package/dist/src/validators/port-validate.js +78 -0
  730. package/dist/src/validators/port-validate.js.map +1 -0
  731. package/dist/src/validators/skill-validate.d.ts +29 -0
  732. package/dist/src/validators/skill-validate.d.ts.map +1 -0
  733. package/dist/src/validators/skill-validate.js +689 -0
  734. package/dist/src/validators/skill-validate.js.map +1 -0
  735. package/docs/concepts/governance-model.md +33 -0
  736. package/docs/concepts/project-contract.md +61 -0
  737. package/docs/concepts/why-forge.md +46 -0
  738. package/docs/getting-started.md +44 -0
  739. package/docs/guides/existing-project.md +38 -0
  740. package/docs/guides/rfc-adr.md +61 -0
  741. package/docs/guides/skills.md +60 -0
  742. package/docs/guides/upgrading.md +35 -0
  743. package/docs/maintainers/publishing.md +34 -0
  744. package/docs/reference/cli.md +140 -0
  745. package/docs/reference/forge-yaml.md +114 -0
  746. package/docs/reference/profiles.md +37 -0
  747. package/docs/reference/programmatic-api.md +79 -0
  748. package/os/core/core.module.ts +15 -0
  749. package/os/core/handlers/public-surface.ts +189 -0
  750. package/os/rfc/handlers/validate-rules.ts +0 -1
  751. package/os/rfc/verification-refresh.test.ts +15 -14
  752. package/os/rfc/verification-refresh.ts +1 -7
  753. package/os/session/handlers/metrics-session.ts +10 -9
  754. package/package.json +15 -7
  755. package/src/tests/metrics-rfc-1053.test.ts +14 -4
  756. package/src/tests/public-surface.test.ts +247 -0
@@ -0,0 +1,1222 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>forge.doctor — diagnoses forge state in an existing project.
4
+ Checks for forge.yaml, AGENTS.md, PREFERENCES.md, .agents/skills/, docs/rfcs/,
5
+ @warpgogol/* import autonomy guard, and bindings contract (RFC-0393).</purpose>
6
+ <non-goals>
7
+ <item>Do not modify files — doctor is read-only diagnostics.</item>
8
+ </non-goals>
9
+ </MODULE_CONTRACT>
10
+ <CHANGE_SUMMARY>
11
+ <item>Initial forge.doctor handler for autonomy refactor.</item>
12
+ <item>RFC-0391: added @warpgogol/* forbidden-imports autonomy guard.</item>
13
+ <item>RFC-0393: added bindings validation — resolved/absent/invalid reporting.</item>
14
+ <item>RFC-0524: added stale knowledge file detection — compares source and .agents/ copies.</item>
15
+ <item>RFC-0539: extended knowledge file check to iterate pack skills via discoverPackSkills. Added pack-skills check for stale/missing copies and skillPacks config validation.</item>
16
+ <item>RFC-0540: added defaultable-binding-null notices for forge-CLI-backed bindings.</item>
17
+ <item>RFC-0611: added nested AGENTS.md checks — missing, stale (dryRun comparison), hand-written improvement.</item>
18
+ <item>RFC-0640: added domain reporting, invariant listing (reported-only), terminology resolution, --strict flag, and software-specific check skipping for non-software domains.</item>
19
+ <item>RFC-0675: upgraded domain-invariants check from advisory to enforcement using invariant engine.</item>
20
+ <item>RFC-0660: added legacy-section count reporting for structured knowledge files.</item>
21
+ <item>RFC-0661: added knowledge-budgets check — validates override shape, computes per-skill budget reports, reports summary with headroom %.</item>
22
+ <item>RFC-0663: added knowledge-duplicates check (cross-skill L2 duplicate detection) and shared-knowledge-file check (schema/id uniqueness for the shared layer).</item>
23
+ <item>RFC-0664: added memory-layer health check (budget usage, gitignore coverage, daily-file leak risk).</item>
24
+ <item>RFC-0704: added independent-version-packages check — validates that paths in independentVersionPackages exist and contain package.json.</item>
25
+ <item>RFC-0941: added pack-manifests advisory check — validates forge.plugin.yaml existence and schema for each declared skill pack.</item>
26
+ <item>Added git-branch check — warns when current branch is 'master' instead of 'main'.</item>
27
+ </CHANGE_SUMMARY>
28
+ */
29
+ import { readFile, readdir, stat } from "node:fs/promises";
30
+ import { readFileSync, existsSync } from "node:fs";
31
+ import { join, relative, dirname, resolve } from "node:path";
32
+ import { parse as parseYaml } from "yaml";
33
+ import { forgePluginManifestSchema } from "../plugin/forge-plugin-manifest.js";
34
+ import { resolveForgeRoot, loadForgeConfig, resolveBinding, resolveTerminology, FORGE_CLI_BINDING_DEFAULTS, resolvePmRunner } from "../config/forge-config.js";
35
+ import { FORGE_SKILLS, discoverPackSkills } from "../registry.js";
36
+ import { discoverWorkspaces } from "./workspace-discovery.js";
37
+ import { buildNestedAgentsMd, selectNestedTemplate } from "./nested-agents-templates.js";
38
+ import { readPackageInfo } from "./nested-agents-generate.js";
39
+ import { listStackProfiles } from "../profiles/stack-profile.js";
40
+ import { resolveAllTerminology } from "../profiles/terminology-utils.js";
41
+ import { TERMINOLOGY_DEFAULTS } from "../profiles/profile-schema.js";
42
+ import { runProfileValidate } from "./profile-validate.js";
43
+ import { parseKnowledgeFile } from "../knowledge/index.js";
44
+ import { computeLayerBudgets, resolveKnowledgeBudgets, DEFAULT_KNOWLEDGE_BUDGETS } from "../knowledge/budgets.js";
45
+ import { detectDuplicatePrinciples } from "../knowledge/index.js";
46
+ import { checkMemoryLayerHealth } from "./memory-scaffold.js";
47
+ import { checkInvariants } from "./invariant-engine.js";
48
+ import { execSync } from "node:child_process";
49
+ async function pathExists(target) {
50
+ try {
51
+ await stat(target);
52
+ return true;
53
+ }
54
+ catch {
55
+ return false;
56
+ }
57
+ }
58
+ const FORBIDDEN_IMPORT_PATTERN = /(?:^|\n)\s*(?:import\s+[^;]+?\s+from\s+|require\s*\(\s*)["'`](@warpgogol\/[^"'`]+)["'`]/g;
59
+ async function scanForForbiddenImports(dir, workspaceRoot) {
60
+ const violations = [];
61
+ const entries = await readdir(dir, { withFileTypes: true }).catch(() => []);
62
+ for (const entry of entries) {
63
+ const fullPath = join(dir, entry.name);
64
+ if (entry.isDirectory()) {
65
+ if (entry.name === "node_modules" || entry.name === "tests")
66
+ continue;
67
+ const sub = await scanForForbiddenImports(fullPath, workspaceRoot);
68
+ violations.push(...sub);
69
+ }
70
+ else if (entry.name.endsWith(".ts")) {
71
+ const content = await readFile(fullPath, "utf8").catch(() => "");
72
+ let match;
73
+ const pattern = new RegExp(FORBIDDEN_IMPORT_PATTERN.source, "g");
74
+ while ((match = pattern.exec(content)) !== null) {
75
+ violations.push({
76
+ file: relative(workspaceRoot, fullPath),
77
+ specifier: match[1],
78
+ });
79
+ }
80
+ }
81
+ }
82
+ return violations;
83
+ }
84
+ // ---------------------------------------------------------------------------
85
+ // Bindings validation (RFC-0393)
86
+ // ---------------------------------------------------------------------------
87
+ const BINDING_PATH_KEYS = [
88
+ "paths.invariantsFile",
89
+ "paths.reviewsDir",
90
+ "paths.handoffsDir",
91
+ "paths.sessionsDir",
92
+ ];
93
+ const BINDING_COMMAND_KEYS = [
94
+ "commands.validateRfc",
95
+ "commands.validateAdr",
96
+ "commands.implementStamp",
97
+ "commands.typecheck",
98
+ "commands.test",
99
+ "commands.scopedBuild",
100
+ "commands.specValidate",
101
+ "commands.sessionSave",
102
+ ];
103
+ async function validateBindings(workspaceRoot) {
104
+ const result = { resolved: [], absent: [], invalid: [], notices: [] };
105
+ let config;
106
+ try {
107
+ config = loadForgeConfig(workspaceRoot);
108
+ }
109
+ catch {
110
+ return result;
111
+ }
112
+ if (!config.bindings) {
113
+ return result;
114
+ }
115
+ for (const key of BINDING_PATH_KEYS) {
116
+ const value = resolveBinding(config, key);
117
+ if (value === null) {
118
+ result.absent.push(key);
119
+ }
120
+ else if (typeof value === "string") {
121
+ const exists = await pathExists(join(workspaceRoot, value));
122
+ if (exists) {
123
+ result.resolved.push(key);
124
+ }
125
+ else {
126
+ result.invalid.push(`${key} (path not found: ${value})`);
127
+ }
128
+ }
129
+ }
130
+ const compassDocs = resolveBinding(config, "paths.compassDocs");
131
+ if (Array.isArray(compassDocs) && compassDocs.length > 0) {
132
+ for (const docPath of compassDocs) {
133
+ const exists = await pathExists(join(workspaceRoot, docPath));
134
+ if (exists) {
135
+ result.resolved.push(`paths.compassDocs[${docPath}]`);
136
+ }
137
+ else {
138
+ result.invalid.push(`paths.compassDocs[${docPath}] (path not found)`);
139
+ }
140
+ }
141
+ }
142
+ else {
143
+ result.absent.push("paths.compassDocs");
144
+ }
145
+ for (const key of BINDING_COMMAND_KEYS) {
146
+ const value = resolveBinding(config, key);
147
+ if (value === null) {
148
+ result.absent.push(key);
149
+ }
150
+ else if (typeof value === "string") {
151
+ result.resolved.push(key);
152
+ }
153
+ }
154
+ // RFC-0540: Emit defaultable-binding-null notices for forge-CLI-backed bindings
155
+ const pm = config.project.packageManager;
156
+ const runner = resolvePmRunner(pm);
157
+ for (const entry of FORGE_CLI_BINDING_DEFAULTS) {
158
+ const value = resolveBinding(config, entry.key);
159
+ if (value === null) {
160
+ result.notices.push({
161
+ key: entry.key,
162
+ rule: "defaultable-binding-null",
163
+ suggestion: `${runner} ${entry.template}`,
164
+ });
165
+ }
166
+ }
167
+ return result;
168
+ }
169
+ // ---------------------------------------------------------------------------
170
+ // Stale knowledge file detection (RFC-0524)
171
+ // ---------------------------------------------------------------------------
172
+ async function checkStaleKnowledgeFiles(workspaceRoot, forgeRoot) {
173
+ const stale = [];
174
+ let config;
175
+ try {
176
+ config = loadForgeConfig(workspaceRoot);
177
+ }
178
+ catch {
179
+ return { name: "knowledge-files", status: "pass", message: "No forge.yaml — knowledge file check skipped" };
180
+ }
181
+ const agentsSkillsDir = join(workspaceRoot, config.paths.skillsDir);
182
+ for (const skill of FORGE_SKILLS) {
183
+ if (!skill.knowledge || skill.knowledge.length === 0)
184
+ continue;
185
+ const skillSrcDir = dirname(join(forgeRoot, skill.path));
186
+ for (const kf of skill.knowledge) {
187
+ const srcPath = join(skillSrcDir, kf);
188
+ const destPath = join(agentsSkillsDir, skill.name, kf);
189
+ const srcExists = await pathExists(srcPath);
190
+ const destExists = await pathExists(destPath);
191
+ if (srcExists && destExists) {
192
+ const srcContent = await readFile(srcPath, "utf8").catch(() => "");
193
+ const destContent = await readFile(destPath, "utf8").catch(() => "");
194
+ if (srcContent !== destContent) {
195
+ stale.push(`${skill.name}/${kf}`);
196
+ }
197
+ }
198
+ // If source exists but dest doesn't, skip — expected on first install
199
+ // If source doesn't exist, SKILL-13 in forge.skill.validate catches it
200
+ }
201
+ }
202
+ // RFC-0539: Check pack skill knowledge files
203
+ let packSkills = [];
204
+ try {
205
+ packSkills = discoverPackSkills(workspaceRoot, config);
206
+ }
207
+ catch {
208
+ // Manifest missing or invalid — skip pack skill checks
209
+ }
210
+ for (const skill of packSkills) {
211
+ if (!skill.knowledge || skill.knowledge.length === 0)
212
+ continue;
213
+ const skillSrcDir = dirname(join(workspaceRoot, skill.dir, skill.path));
214
+ for (const kf of skill.knowledge) {
215
+ const srcPath = join(skillSrcDir, kf);
216
+ const destPath = join(agentsSkillsDir, skill.name, kf);
217
+ const srcExists = await pathExists(srcPath);
218
+ const destExists = await pathExists(destPath);
219
+ if (srcExists && destExists) {
220
+ const srcContent = await readFile(srcPath, "utf8").catch(() => "");
221
+ const destContent = await readFile(destPath, "utf8").catch(() => "");
222
+ if (srcContent !== destContent) {
223
+ stale.push(`${skill.name}/${kf}`);
224
+ }
225
+ }
226
+ }
227
+ }
228
+ return {
229
+ name: "knowledge-files",
230
+ status: stale.length === 0 ? "pass" : "warn",
231
+ message: stale.length === 0
232
+ ? "All knowledge files in sync"
233
+ : `${stale.length} stale knowledge file(s): ${stale.join(", ")} — run 'forge create' to sync`,
234
+ };
235
+ }
236
+ // ---------------------------------------------------------------------------
237
+ // Legacy section detection (RFC-0660)
238
+ // ---------------------------------------------------------------------------
239
+ function checkLegacyKnowledgeSections(workspaceRoot, forgeRoot) {
240
+ let config;
241
+ try {
242
+ config = loadForgeConfig(workspaceRoot);
243
+ }
244
+ catch {
245
+ return { name: "knowledge-legacy", status: "pass", message: "No forge.yaml — legacy section check skipped" };
246
+ }
247
+ let totalLegacy = 0;
248
+ let filesWithLegacy = 0;
249
+ // Check forge skills
250
+ for (const skill of FORGE_SKILLS) {
251
+ if (!skill.knowledge || skill.knowledge.length === 0)
252
+ continue;
253
+ const skillDir = join(forgeRoot, dirname(skill.path));
254
+ for (const kf of skill.knowledge) {
255
+ const kfPath = join(skillDir, kf);
256
+ try {
257
+ const parsed = parseKnowledgeFile(kfPath);
258
+ if (parsed.isKnowledgeAdjacent)
259
+ continue;
260
+ if (parsed.legacySections.length > 0) {
261
+ totalLegacy += parsed.legacySections.length;
262
+ filesWithLegacy++;
263
+ }
264
+ }
265
+ catch {
266
+ // File read errors are handled by stale knowledge check
267
+ }
268
+ }
269
+ }
270
+ // Check pack skills
271
+ let packSkills = [];
272
+ try {
273
+ packSkills = discoverPackSkills(workspaceRoot, config);
274
+ }
275
+ catch {
276
+ // Manifest missing or invalid — skip pack skill checks
277
+ }
278
+ for (const skill of packSkills) {
279
+ if (!skill.knowledge || skill.knowledge.length === 0)
280
+ continue;
281
+ const skillDir = join(workspaceRoot, skill.dir, dirname(skill.path));
282
+ for (const kf of skill.knowledge) {
283
+ const kfPath = join(skillDir, kf);
284
+ try {
285
+ const parsed = parseKnowledgeFile(kfPath);
286
+ if (parsed.isKnowledgeAdjacent)
287
+ continue;
288
+ if (parsed.legacySections.length > 0) {
289
+ totalLegacy += parsed.legacySections.length;
290
+ filesWithLegacy++;
291
+ }
292
+ }
293
+ catch {
294
+ // File read errors are handled by stale knowledge check
295
+ }
296
+ }
297
+ }
298
+ return {
299
+ name: "knowledge-legacy",
300
+ status: totalLegacy === 0 ? "pass" : "warn",
301
+ message: totalLegacy === 0
302
+ ? "No legacy knowledge sections"
303
+ : `${totalLegacy} legacy section${totalLegacy === 1 ? "" : "s"} across ${filesWithLegacy} knowledge file${filesWithLegacy === 1 ? "" : "s"} — run the knowledge compaction command to migrate`,
304
+ };
305
+ }
306
+ // ---------------------------------------------------------------------------
307
+ // Knowledge budget check (RFC-0661)
308
+ // ---------------------------------------------------------------------------
309
+ function checkKnowledgeBudgets(workspaceRoot, forgeRoot) {
310
+ let config;
311
+ try {
312
+ config = loadForgeConfig(workspaceRoot);
313
+ }
314
+ catch {
315
+ return { name: "knowledge-budgets", status: "pass", message: "No forge.yaml — budget check skipped" };
316
+ }
317
+ // Validate override shape if present
318
+ const overrideWarnings = [];
319
+ const effectiveBudgets = resolveKnowledgeBudgets(workspaceRoot);
320
+ let usingDefaults = true;
321
+ try {
322
+ const forgeYamlPath = join(workspaceRoot, "forge.yaml");
323
+ const content = readFileSync(forgeYamlPath, "utf8");
324
+ const parsed = parseYaml(content);
325
+ const bindings = parsed?.bindings;
326
+ const knowledge = bindings?.knowledge;
327
+ const budgets = knowledge?.budgets;
328
+ if (budgets) {
329
+ usingDefaults = false;
330
+ if (typeof budgets.hot !== "number" || budgets.hot <= 0 || !Number.isInteger(budgets.hot)) {
331
+ overrideWarnings.push(`bindings.knowledge.budgets.hot invalid (got ${String(budgets.hot)}), using default ${DEFAULT_KNOWLEDGE_BUDGETS.hot}`);
332
+ }
333
+ if (typeof budgets.warm !== "number" || budgets.warm <= 0 || !Number.isInteger(budgets.warm)) {
334
+ overrideWarnings.push(`bindings.knowledge.budgets.warm invalid (got ${String(budgets.warm)}), using default ${DEFAULT_KNOWLEDGE_BUDGETS.warm}`);
335
+ }
336
+ }
337
+ }
338
+ catch {
339
+ // forge.yaml not readable — defaults already applied
340
+ }
341
+ // Collect all parsed knowledge files from forge skills and pack skills
342
+ const parsedFiles = [];
343
+ for (const skill of FORGE_SKILLS) {
344
+ if (!skill.knowledge || skill.knowledge.length === 0)
345
+ continue;
346
+ const skillDir = join(forgeRoot, dirname(skill.path));
347
+ for (const kf of skill.knowledge) {
348
+ const kfPath = join(skillDir, kf);
349
+ try {
350
+ const parsed = parseKnowledgeFile(kfPath);
351
+ if (parsed.layer !== null && parsed.layer !== "L0" && !parsed.isKnowledgeAdjacent && parsed.parseIssues.length === 0) {
352
+ parsedFiles.push({ file: parsed, skillName: skill.name });
353
+ }
354
+ }
355
+ catch {
356
+ // File read errors are handled by stale knowledge check
357
+ }
358
+ }
359
+ }
360
+ let packSkills = [];
361
+ try {
362
+ packSkills = discoverPackSkills(workspaceRoot, config);
363
+ }
364
+ catch {
365
+ // Manifest missing or invalid — skip pack skill checks
366
+ }
367
+ for (const skill of packSkills) {
368
+ if (!skill.knowledge || skill.knowledge.length === 0)
369
+ continue;
370
+ const skillDir = join(workspaceRoot, skill.dir, dirname(skill.path));
371
+ for (const kf of skill.knowledge) {
372
+ const kfPath = join(skillDir, kf);
373
+ try {
374
+ const parsed = parseKnowledgeFile(kfPath);
375
+ if (parsed.layer !== null && parsed.layer !== "L0" && !parsed.isKnowledgeAdjacent && parsed.parseIssues.length === 0) {
376
+ parsedFiles.push({ file: parsed, skillName: skill.name, pack: skill.pack });
377
+ }
378
+ }
379
+ catch {
380
+ // File read errors are handled by stale knowledge check
381
+ }
382
+ }
383
+ }
384
+ // Compute budget reports
385
+ const filesForBudget = parsedFiles.map((p) => p.file);
386
+ const skillNames = new Map();
387
+ for (const p of parsedFiles) {
388
+ skillNames.set(p.file.path, p.skillName);
389
+ }
390
+ const reports = computeLayerBudgets(filesForBudget, effectiveBudgets, skillNames);
391
+ // Build summary
392
+ const budgetSource = usingDefaults ? "defaults" : "override";
393
+ const parts = [`budgets: hot=${effectiveBudgets.hot} warm=${effectiveBudgets.warm} (${budgetSource})`];
394
+ if (reports.length > 0) {
395
+ const summary = reports.map((r) => {
396
+ const pct = Math.round((r.activeChars / r.budget) * 100);
397
+ return `${r.skill}/${r.file}[${r.layer}]: ${r.activeChars}/${r.budget} (${pct}%)`;
398
+ });
399
+ parts.push(`${reports.length} file${reports.length === 1 ? "" : "s"}: ${summary.join(", ")}`);
400
+ }
401
+ else {
402
+ parts.push("no hot/warm knowledge files to check");
403
+ }
404
+ if (overrideWarnings.length > 0) {
405
+ parts.push(overrideWarnings.join("; "));
406
+ }
407
+ const status = overrideWarnings.length > 0 ? "warn" : "pass";
408
+ return {
409
+ name: "knowledge-budgets",
410
+ status,
411
+ message: parts.join(" | "),
412
+ };
413
+ }
414
+ // ---------------------------------------------------------------------------
415
+ // Knowledge duplicate detection (RFC-0663)
416
+ // ---------------------------------------------------------------------------
417
+ function collectL2Files(workspaceRoot, forgeRoot) {
418
+ let config;
419
+ try {
420
+ config = loadForgeConfig(workspaceRoot);
421
+ }
422
+ catch {
423
+ return [];
424
+ }
425
+ const files = [];
426
+ for (const skill of FORGE_SKILLS) {
427
+ if (!skill.knowledge || skill.knowledge.length === 0)
428
+ continue;
429
+ const skillDir = join(forgeRoot, dirname(skill.path));
430
+ for (const kf of skill.knowledge) {
431
+ if (kf !== "learned-principles.md")
432
+ continue;
433
+ const kfPath = join(skillDir, kf);
434
+ try {
435
+ const parsed = parseKnowledgeFile(kfPath);
436
+ if (parsed.isKnowledgeAdjacent)
437
+ continue;
438
+ if (parsed.parseIssues.length > 0)
439
+ continue;
440
+ files.push({ skill: skill.name, parsed });
441
+ }
442
+ catch {
443
+ // File read errors are handled by stale knowledge check
444
+ }
445
+ }
446
+ }
447
+ let packSkills = [];
448
+ try {
449
+ packSkills = discoverPackSkills(workspaceRoot, config);
450
+ }
451
+ catch {
452
+ // Manifest missing or invalid — skip pack skill checks
453
+ }
454
+ for (const skill of packSkills) {
455
+ if (!skill.knowledge || skill.knowledge.length === 0)
456
+ continue;
457
+ const skillDir = join(workspaceRoot, skill.dir, dirname(skill.path));
458
+ for (const kf of skill.knowledge) {
459
+ if (kf !== "learned-principles.md")
460
+ continue;
461
+ const kfPath = join(skillDir, kf);
462
+ try {
463
+ const parsed = parseKnowledgeFile(kfPath);
464
+ if (parsed.isKnowledgeAdjacent)
465
+ continue;
466
+ if (parsed.parseIssues.length > 0)
467
+ continue;
468
+ files.push({ skill: skill.name, parsed });
469
+ }
470
+ catch {
471
+ // File read errors are handled by stale knowledge check
472
+ }
473
+ }
474
+ }
475
+ const sharedPath = join(forgeRoot, "skills", "shared", "knowledge", "learned-principles.md");
476
+ try {
477
+ const parsed = parseKnowledgeFile(sharedPath);
478
+ if (!parsed.isKnowledgeAdjacent && parsed.parseIssues.length === 0 && parsed.entries.length > 0) {
479
+ files.push({ skill: "shared", parsed });
480
+ }
481
+ }
482
+ catch {
483
+ // Shared layer not initialized — not an error
484
+ }
485
+ return files;
486
+ }
487
+ function checkKnowledgeDuplicates(workspaceRoot, forgeRoot) {
488
+ const l2Files = collectL2Files(workspaceRoot, forgeRoot);
489
+ if (l2Files.length === 0) {
490
+ return { name: "knowledge-duplicates", status: "pass", message: "No L2 knowledge files to check" };
491
+ }
492
+ const pairs = detectDuplicatePrinciples(l2Files);
493
+ if (pairs.length === 0) {
494
+ return { name: "knowledge-duplicates", status: "pass", message: "No cross-skill duplicate principles detected" };
495
+ }
496
+ const pairSummaries = pairs.map((p) => `${p.a.skill}/${p.a.entryId} ↔ ${p.b.skill}/${p.b.entryId} (${p.kind})`);
497
+ return {
498
+ name: "knowledge-duplicates",
499
+ status: "warn",
500
+ message: `${pairs.length} duplicate pair${pairs.length === 1 ? "" : "s"} detected — run fo-knowledge-distill to promote: ${pairSummaries.join("; ")}`,
501
+ };
502
+ }
503
+ // ---------------------------------------------------------------------------
504
+ // Shared knowledge file validation (RFC-0663)
505
+ // ---------------------------------------------------------------------------
506
+ function checkSharedKnowledgeFile(workspaceRoot, forgeRoot) {
507
+ const sharedPath = join(forgeRoot, "skills", "shared", "knowledge", "learned-principles.md");
508
+ let parsed;
509
+ try {
510
+ parsed = parseKnowledgeFile(sharedPath);
511
+ }
512
+ catch {
513
+ return { name: "shared-knowledge-file", status: "pass", message: "Shared knowledge layer not initialized — created on first promotion" };
514
+ }
515
+ if (parsed.isKnowledgeAdjacent) {
516
+ return { name: "shared-knowledge-file", status: "pass", message: "Shared knowledge layer is empty (no structured entries)" };
517
+ }
518
+ const issues = [];
519
+ for (const issue of parsed.parseIssues) {
520
+ issues.push(`line ${issue.line}: ${issue.message}`);
521
+ }
522
+ const seenIds = new Set();
523
+ for (const entry of parsed.entries) {
524
+ if (seenIds.has(entry.meta.id)) {
525
+ issues.push(`duplicate entry id: ${entry.meta.id}`);
526
+ }
527
+ seenIds.add(entry.meta.id);
528
+ }
529
+ if (issues.length > 0) {
530
+ return {
531
+ name: "shared-knowledge-file",
532
+ status: "fail",
533
+ message: `${issues.length} issue${issues.length === 1 ? "" : "s"}: ${issues.join("; ")}`,
534
+ };
535
+ }
536
+ return {
537
+ name: "shared-knowledge-file",
538
+ status: "pass",
539
+ message: `Shared knowledge layer: ${parsed.entries.length} entr${parsed.entries.length === 1 ? "y" : "ies"}`,
540
+ };
541
+ }
542
+ // ---------------------------------------------------------------------------
543
+ // Independent version packages diagnostics (RFC-0704)
544
+ // ---------------------------------------------------------------------------
545
+ async function checkIndependentVersionPackages(workspaceRoot) {
546
+ let config;
547
+ try {
548
+ config = loadForgeConfig(workspaceRoot);
549
+ }
550
+ catch {
551
+ return { name: "independent-version-packages", status: "pass", message: "No forge.yaml — independent version packages check skipped" };
552
+ }
553
+ if (!config.independentVersionPackages || config.independentVersionPackages.length === 0) {
554
+ return { name: "independent-version-packages", status: "pass", message: "No independent version packages declared" };
555
+ }
556
+ const issues = [];
557
+ let validCount = 0;
558
+ for (const pkgPath of config.independentVersionPackages) {
559
+ const dirExists = await pathExists(join(workspaceRoot, pkgPath));
560
+ const pkgJsonExists = await pathExists(join(workspaceRoot, pkgPath, "package.json"));
561
+ if (!dirExists) {
562
+ issues.push(`path '${pkgPath}' does not exist`);
563
+ }
564
+ else if (!pkgJsonExists) {
565
+ issues.push(`path '${pkgPath}' has no package.json`);
566
+ }
567
+ else {
568
+ validCount++;
569
+ }
570
+ }
571
+ if (issues.length === 0) {
572
+ return {
573
+ name: "independent-version-packages",
574
+ status: "pass",
575
+ message: `${validCount} independent version package${validCount === 1 ? "" : "s"} declared`,
576
+ };
577
+ }
578
+ return {
579
+ name: "independent-version-packages",
580
+ status: "warn",
581
+ message: `${issues.length} issue${issues.length === 1 ? "" : "s"}: ${issues.join(", ")}`,
582
+ };
583
+ }
584
+ // ---------------------------------------------------------------------------
585
+ // Pack skill diagnostics (RFC-0539)
586
+ // ---------------------------------------------------------------------------
587
+ async function checkPackSkills(workspaceRoot) {
588
+ let config;
589
+ try {
590
+ config = loadForgeConfig(workspaceRoot);
591
+ }
592
+ catch {
593
+ return { name: "pack-skills", status: "pass", message: "No forge.yaml — pack skill check skipped" };
594
+ }
595
+ if (!config.skillPacks || config.skillPacks.length === 0) {
596
+ return { name: "pack-skills", status: "pass", message: "No skill packs declared" };
597
+ }
598
+ const issues = [];
599
+ // Validate skillPacks config: unique prefixes, unique dirs, no 'fo' prefix, dir exists
600
+ const prefixes = new Set();
601
+ const dirs = new Set();
602
+ for (const pack of config.skillPacks) {
603
+ if (prefixes.has(pack.prefix)) {
604
+ issues.push(`duplicate prefix '${pack.prefix}'`);
605
+ }
606
+ prefixes.add(pack.prefix);
607
+ if (pack.prefix === "fo") {
608
+ issues.push(`prefix 'fo' is reserved for forge`);
609
+ }
610
+ if (dirs.has(pack.dir)) {
611
+ issues.push(`duplicate dir '${pack.dir}'`);
612
+ }
613
+ dirs.add(pack.dir);
614
+ const packDirExists = await pathExists(join(workspaceRoot, pack.dir));
615
+ if (!packDirExists) {
616
+ issues.push(`pack dir '${pack.dir}' does not exist`);
617
+ }
618
+ }
619
+ // Check for stale/missing pack skill copies
620
+ let packSkills = [];
621
+ try {
622
+ packSkills = discoverPackSkills(workspaceRoot, config);
623
+ }
624
+ catch {
625
+ // Manifest missing or invalid — skip pack skill checks
626
+ }
627
+ const agentsSkillsDir = join(workspaceRoot, config.paths.skillsDir);
628
+ for (const skill of packSkills) {
629
+ const srcPath = join(workspaceRoot, skill.dir, skill.path);
630
+ const destPath = join(agentsSkillsDir, skill.name, "SKILL.md");
631
+ const srcExists = await pathExists(srcPath);
632
+ const destExists = await pathExists(destPath);
633
+ if (srcExists && destExists) {
634
+ const srcContent = await readFile(srcPath, "utf8").catch(() => "");
635
+ const destContent = await readFile(destPath, "utf8").catch(() => "");
636
+ if (srcContent !== destContent) {
637
+ issues.push(`stale copy of '${skill.name}'`);
638
+ }
639
+ }
640
+ else if (srcExists && !destExists) {
641
+ issues.push(`missing copy of '${skill.name}'`);
642
+ }
643
+ }
644
+ return {
645
+ name: "pack-skills",
646
+ status: issues.length === 0 ? "pass" : "warn",
647
+ message: issues.length === 0
648
+ ? `${packSkills.length} pack skill(s) in sync`
649
+ : `${issues.length} issue(s): ${issues.join(", ")} — run 'forge create' to sync`,
650
+ };
651
+ }
652
+ // ---------------------------------------------------------------------------
653
+ // Pack manifest diagnostics (RFC-0941)
654
+ // ---------------------------------------------------------------------------
655
+ async function checkPackManifests(workspaceRoot) {
656
+ let config;
657
+ try {
658
+ config = loadForgeConfig(workspaceRoot);
659
+ }
660
+ catch {
661
+ return {
662
+ name: "pack-manifests",
663
+ status: "pass",
664
+ message: "forge.yaml not loadable — pack manifest check skipped",
665
+ };
666
+ }
667
+ if (!config.skillPacks || config.skillPacks.length === 0) {
668
+ return { name: "pack-manifests", status: "pass", message: "No skill packs declared" };
669
+ }
670
+ const issues = [];
671
+ for (const pack of config.skillPacks) {
672
+ const packDir = resolve(workspaceRoot, pack.dir);
673
+ const manifestPath = join(packDir, "forge.plugin.yaml");
674
+ if (!existsSync(manifestPath)) {
675
+ issues.push(`pack '${pack.prefix}': forge.plugin.yaml missing at ${pack.dir}`);
676
+ continue;
677
+ }
678
+ try {
679
+ const raw = readFileSync(manifestPath, "utf-8");
680
+ const parsed = parseYaml(raw);
681
+ const result = forgePluginManifestSchema.safeParse(parsed);
682
+ if (!result.success) {
683
+ const errs = result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ");
684
+ issues.push(`pack '${pack.prefix}': invalid manifest — ${errs}`);
685
+ }
686
+ }
687
+ catch (err) {
688
+ issues.push(`pack '${pack.prefix}': failed to read manifest — ${err.message}`);
689
+ }
690
+ }
691
+ return {
692
+ name: "pack-manifests",
693
+ status: issues.length === 0 ? "pass" : "warn",
694
+ message: issues.length === 0
695
+ ? `${config.skillPacks.length} pack manifest(s) valid`
696
+ : `${issues.length} issue(s): ${issues.join(", ")}`,
697
+ };
698
+ }
699
+ // ---------------------------------------------------------------------------
700
+ // Nested AGENTS.md diagnostics (RFC-0611)
701
+ // ---------------------------------------------------------------------------
702
+ async function checkNestedAgentsMd(workspaceRoot, workspaceTypes) {
703
+ let config;
704
+ try {
705
+ config = loadForgeConfig(workspaceRoot);
706
+ }
707
+ catch {
708
+ return {
709
+ name: "nested-AGENTS.md",
710
+ status: "pass",
711
+ message: "forge.yaml not loadable — nested AGENTS.md check skipped",
712
+ };
713
+ }
714
+ const workspaces = discoverWorkspaces(workspaceRoot, workspaceTypes);
715
+ if (workspaces.length === 0) {
716
+ return {
717
+ name: "nested-AGENTS.md",
718
+ status: "pass",
719
+ message: "no workspace directories found",
720
+ };
721
+ }
722
+ const issues = [];
723
+ let missing = 0;
724
+ let stale = 0;
725
+ let handwritten = 0;
726
+ for (const ws of workspaces) {
727
+ if (!ws.hasAgentsMd) {
728
+ missing++;
729
+ issues.push(`${ws.path}/AGENTS.md missing`);
730
+ continue;
731
+ }
732
+ if (!ws.isGenerated) {
733
+ handwritten++;
734
+ const suggestions = [];
735
+ try {
736
+ const content = await readFile(join(workspaceRoot, ws.path, "AGENTS.md"), "utf8");
737
+ if (!content.includes("AGENTS.md")) {
738
+ suggestions.push("reference root AGENTS.md");
739
+ }
740
+ }
741
+ catch {
742
+ // unreadable — skip
743
+ }
744
+ if (suggestions.length > 0) {
745
+ issues.push(`${ws.path}/AGENTS.md hand-written — consider: ${suggestions.join(", ")}`);
746
+ }
747
+ continue;
748
+ }
749
+ // Stale check: compare in-memory render to committed file
750
+ // Must match the generate pipeline: readPackageInfo + buildNestedAgentsMd + selectNestedTemplate
751
+ try {
752
+ const packageInfo = readPackageInfo(workspaceRoot, ws.path);
753
+ const fallback = buildNestedAgentsMd(ws, config, packageInfo);
754
+ const profile = config.profile;
755
+ const terminology = resolveAllTerminology(config, profile);
756
+ const wsType = workspaceTypes?.find((wt) => wt.id === ws.type);
757
+ const expected = selectNestedTemplate(wsType, profile, terminology, fallback);
758
+ const actual = await readFile(join(workspaceRoot, ws.path, "AGENTS.md"), "utf8");
759
+ if (expected !== actual) {
760
+ stale++;
761
+ issues.push(`${ws.path}/AGENTS.md stale — run 'forge agents generate'`);
762
+ }
763
+ }
764
+ catch {
765
+ // unreadable — skip
766
+ }
767
+ }
768
+ if (issues.length === 0) {
769
+ return {
770
+ name: "nested-AGENTS.md",
771
+ status: "pass",
772
+ message: `${workspaces.length} workspace(s) — all AGENTS.md in sync`,
773
+ };
774
+ }
775
+ const parts = [];
776
+ if (missing > 0)
777
+ parts.push(`${missing} missing`);
778
+ if (stale > 0)
779
+ parts.push(`${stale} stale`);
780
+ if (handwritten > 0)
781
+ parts.push(`${handwritten} hand-written`);
782
+ return {
783
+ name: "nested-AGENTS.md",
784
+ status: stale > 0 ? "warn" : "pass",
785
+ message: `${parts.join(", ")} — ${issues.slice(0, 3).join("; ")}${issues.length > 3 ? ` (+${issues.length - 3} more)` : ""}`,
786
+ };
787
+ }
788
+ function buildTerminologyMap(config, profileTerminology) {
789
+ const result = {};
790
+ for (const key of Object.keys(TERMINOLOGY_DEFAULTS)) {
791
+ result[key] = resolveTerminology(config, profileTerminology, key);
792
+ }
793
+ // Also include any custom keys from bindings.terminology
794
+ if (config.bindings?.terminology) {
795
+ for (const key of Object.keys(config.bindings.terminology)) {
796
+ if (!(key in result)) {
797
+ result[key] = resolveTerminology(config, profileTerminology, key);
798
+ }
799
+ }
800
+ }
801
+ return result;
802
+ }
803
+ function resolveDomainReport(workspaceRoot, forgeRoot) {
804
+ // 1. Try forge.yaml domain field
805
+ try {
806
+ const config = loadForgeConfig(workspaceRoot);
807
+ if (config.project.domain) {
808
+ const terminology = buildTerminologyMap(config);
809
+ const register = readRegisterFromPrefs(workspaceRoot);
810
+ return {
811
+ domain: config.project.domain,
812
+ register,
813
+ terminology,
814
+ invariants: [],
815
+ source: "forge.yaml",
816
+ };
817
+ }
818
+ }
819
+ catch {
820
+ // forge.yaml not loadable
821
+ }
822
+ // 2. Try to find domain from stack profile matching config.project.stack
823
+ try {
824
+ const config = loadForgeConfig(workspaceRoot);
825
+ const profiles = listStackProfiles(forgeRoot);
826
+ for (const stackId of config.project.stack) {
827
+ const profile = profiles.find((p) => p.id === stackId);
828
+ if (profile?.domain) {
829
+ const terminology = buildTerminologyMap(config, profile.terminology);
830
+ const register = profile.register ?? readRegisterFromPrefs(workspaceRoot);
831
+ return {
832
+ domain: profile.domain,
833
+ register,
834
+ terminology,
835
+ invariants: profile.invariants ?? [],
836
+ source: "profile",
837
+ profileId: profile.id,
838
+ };
839
+ }
840
+ }
841
+ }
842
+ catch {
843
+ // config or profiles not loadable
844
+ }
845
+ // 3. Default: software domain
846
+ return {
847
+ domain: "software",
848
+ register: null,
849
+ terminology: {},
850
+ invariants: [],
851
+ source: "default",
852
+ };
853
+ }
854
+ function readRegisterFromPrefs(workspaceRoot) {
855
+ try {
856
+ const prefsPath = join(workspaceRoot, "PREFERENCES.md");
857
+ const content = readFileSync(prefsPath, "utf8");
858
+ const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
859
+ if (fmMatch) {
860
+ const fm = parseYaml(fmMatch[1]);
861
+ if (fm["register"] === "creative")
862
+ return "creative";
863
+ if (fm["register"] === "business")
864
+ return "business";
865
+ }
866
+ }
867
+ catch {
868
+ // PREFERENCES.md missing or unreadable
869
+ }
870
+ return null;
871
+ }
872
+ function checkDomainInfo(domainReport) {
873
+ const parts = [`domain: ${domainReport.domain}`, `source: ${domainReport.source}`];
874
+ if (domainReport.register) {
875
+ parts.push(`register: ${domainReport.register}`);
876
+ }
877
+ if (Object.keys(domainReport.terminology).length > 0) {
878
+ const terms = Object.entries(domainReport.terminology)
879
+ .map(([k, v]) => `${k}=${v}`)
880
+ .join(", ");
881
+ parts.push(`terminology: ${terms}`);
882
+ }
883
+ if (domainReport.invariants.length > 0) {
884
+ parts.push(`invariants: ${domainReport.invariants.length} declared`);
885
+ }
886
+ return {
887
+ name: "domain-info",
888
+ status: "pass",
889
+ message: parts.join(", "),
890
+ };
891
+ }
892
+ // RFC-0664: Memory layer health check
893
+ function checkMemoryLayer(workspaceRoot) {
894
+ const health = checkMemoryLayerHealth(workspaceRoot);
895
+ if (!health.memoryMdExists) {
896
+ return {
897
+ name: "memory-layer",
898
+ status: "pass",
899
+ message: "Memory layer not initialized — run 'forge create' or 'forge upgrade' to scaffold .agents/memory/",
900
+ };
901
+ }
902
+ const overBudget = health.memoryMdChars > health.budget;
903
+ const leakRisk = !health.gitignoreCoversDaily && health.dailyFileCount > 0;
904
+ if (overBudget && leakRisk) {
905
+ return {
906
+ name: "memory-layer",
907
+ status: "warn",
908
+ message: `MEMORY.md over budget (${health.memoryMdChars}/${health.budget} chars); ${health.dailyFileCount} daily file(s) untracked by .gitignore — add forge-agent-memory block`,
909
+ };
910
+ }
911
+ if (overBudget) {
912
+ return {
913
+ name: "memory-layer",
914
+ status: "warn",
915
+ message: `MEMORY.md over budget (${health.memoryMdChars}/${health.budget} chars) — compact or promote to skill knowledge`,
916
+ };
917
+ }
918
+ if (leakRisk) {
919
+ return {
920
+ name: "memory-layer",
921
+ status: "warn",
922
+ message: `${health.dailyFileCount} daily file(s) not covered by .gitignore — add forge-agent-memory block to prevent committing ephemeral logs`,
923
+ };
924
+ }
925
+ return {
926
+ name: "memory-layer",
927
+ status: "pass",
928
+ message: `MEMORY.md ${health.memoryMdChars}/${health.budget} chars; ${health.dailyFileCount} daily file(s); gitignore ${health.gitignoreCoversDaily ? "covers" : "absent (no daily files)"}`,
929
+ };
930
+ }
931
+ // ---------------------------------------------------------------------------
932
+ // Git branch check — warn if current branch is 'master' instead of 'main'
933
+ // ---------------------------------------------------------------------------
934
+ function checkGitBranch(workspaceRoot) {
935
+ const gitDir = join(workspaceRoot, ".git");
936
+ if (!existsSync(gitDir)) {
937
+ return { name: "git-branch", status: "pass", message: "No git repository — git branch check skipped" };
938
+ }
939
+ try {
940
+ const branch = execSync("git branch --show-current", { cwd: workspaceRoot, stdio: "pipe", timeout: 5000 })
941
+ .toString()
942
+ .trim();
943
+ if (branch === "master") {
944
+ return {
945
+ name: "git-branch",
946
+ status: "warn",
947
+ message: "Current branch is 'master' — rename to 'main' with: git branch -m main",
948
+ };
949
+ }
950
+ return {
951
+ name: "git-branch",
952
+ status: "pass",
953
+ message: `Current branch: ${branch}`,
954
+ };
955
+ }
956
+ catch {
957
+ return { name: "git-branch", status: "pass", message: "Unable to determine git branch — check skipped" };
958
+ }
959
+ }
960
+ // ---------------------------------------------------------------------------
961
+ // Prerequisite checks (profile-declared system dependencies)
962
+ // ---------------------------------------------------------------------------
963
+ function checkPrerequisites(prerequisites) {
964
+ if (prerequisites.length === 0) {
965
+ return { name: "prerequisites", status: "pass", message: "No prerequisites declared" };
966
+ }
967
+ const results = [];
968
+ for (const prereq of prerequisites) {
969
+ try {
970
+ execSync(prereq.check, { stdio: "pipe", timeout: 10000 });
971
+ results.push({ id: prereq.id, name: prereq.name, status: "pass", message: `${prereq.name} found` });
972
+ }
973
+ catch {
974
+ const hint = prereq.installHint ? ` — install: ${prereq.installHint}` : "";
975
+ results.push({ id: prereq.id, name: prereq.name, status: "fail", message: `${prereq.name} not found${hint}` });
976
+ }
977
+ }
978
+ const failed = results.filter((r) => r.status === "fail");
979
+ const hasErrors = failed.some((r) => prerequisites.find((p) => p.id === r.id)?.severity === "error");
980
+ const hasWarnings = failed.some((r) => prerequisites.find((p) => p.id === r.id)?.severity === "warning");
981
+ const status = hasErrors ? "fail" : hasWarnings ? "warn" : "pass";
982
+ const parts = results.map((r) => `${r.name}: ${r.status === "pass" ? "ok" : "missing"}`);
983
+ return {
984
+ name: "prerequisites",
985
+ status,
986
+ message: `${results.length} prerequisite(s): ${parts.join(", ")}`,
987
+ };
988
+ }
989
+ export async function runDoctor(input, context) {
990
+ const { workspaceRoot, logger, outputFormat } = context;
991
+ const strict = input.flags["strict"] === true;
992
+ const checks = [];
993
+ // Check forge.yaml
994
+ const forgeYamlExists = await pathExists(join(workspaceRoot, "forge.yaml"));
995
+ checks.push({
996
+ name: "forge.yaml",
997
+ status: forgeYamlExists ? "pass" : "warn",
998
+ message: forgeYamlExists
999
+ ? "forge.yaml found"
1000
+ : "forge.yaml not found — run 'forge create' to create project configuration",
1001
+ });
1002
+ // Check AGENTS.md
1003
+ const agentsMdExists = await pathExists(join(workspaceRoot, "AGENTS.md"));
1004
+ checks.push({
1005
+ name: "AGENTS.md",
1006
+ status: agentsMdExists ? "pass" : "warn",
1007
+ message: agentsMdExists
1008
+ ? "AGENTS.md found"
1009
+ : "AGENTS.md not found — run 'forge create' to deploy agent instructions",
1010
+ });
1011
+ // Check PREFERENCES.md
1012
+ const preferencesExists = await pathExists(join(workspaceRoot, "PREFERENCES.md"));
1013
+ checks.push({
1014
+ name: "PREFERENCES.md",
1015
+ status: preferencesExists ? "pass" : "warn",
1016
+ message: preferencesExists
1017
+ ? "PREFERENCES.md found"
1018
+ : "PREFERENCES.md not found — run 'forge create' to create preferences file",
1019
+ });
1020
+ // Check .agents/skills/
1021
+ const skillsDirExists = await pathExists(join(workspaceRoot, ".agents", "skills"));
1022
+ checks.push({
1023
+ name: ".agents/skills/",
1024
+ status: skillsDirExists ? "pass" : "fail",
1025
+ message: skillsDirExists
1026
+ ? ".agents/skills/ directory found"
1027
+ : ".agents/skills/ directory not found — run 'forge create' to deploy skills",
1028
+ });
1029
+ // Check docs/rfcs/
1030
+ const rfcsDirExists = await pathExists(join(workspaceRoot, "docs", "rfcs"));
1031
+ checks.push({
1032
+ name: "docs/rfcs/",
1033
+ status: rfcsDirExists ? "pass" : "warn",
1034
+ message: rfcsDirExists
1035
+ ? "docs/rfcs/ directory found"
1036
+ : "docs/rfcs/ directory not found — run 'forge create' to create RFC directory",
1037
+ });
1038
+ // Check docs/adrs/
1039
+ const adrsDirExists = await pathExists(join(workspaceRoot, "docs", "adrs"));
1040
+ checks.push({
1041
+ name: "docs/adrs/",
1042
+ status: adrsDirExists ? "pass" : "warn",
1043
+ message: adrsDirExists
1044
+ ? "docs/adrs/ directory found"
1045
+ : "docs/adrs/ directory not found — run 'forge create' to create ADR directory",
1046
+ });
1047
+ // Check git branch is 'main' (not 'master')
1048
+ checks.push(checkGitBranch(workspaceRoot));
1049
+ // Check @warpgogol/* forbidden imports (autonomy guard)
1050
+ let forgeRoot;
1051
+ try {
1052
+ forgeRoot = resolveForgeRoot(workspaceRoot);
1053
+ }
1054
+ catch {
1055
+ forgeRoot = join(workspaceRoot, "packages", "forge");
1056
+ }
1057
+ // RFC-0640: Resolve domain report for domain-aware checks
1058
+ const domainReport = resolveDomainReport(workspaceRoot, forgeRoot);
1059
+ // RFC-0640: Domain info check
1060
+ checks.push(checkDomainInfo(domainReport));
1061
+ // RFC-0675: Enforce invariants using the invariant engine
1062
+ if (domainReport.invariants.length > 0) {
1063
+ const profiles = listStackProfiles(forgeRoot);
1064
+ const profile = domainReport.profileId
1065
+ ? profiles.find((p) => p.id === domainReport.profileId)
1066
+ : undefined;
1067
+ const invariantResults = profile
1068
+ ? checkInvariants(profile, workspaceRoot)
1069
+ : [];
1070
+ const allViolations = invariantResults.flatMap((r) => r.violations);
1071
+ const errorViolations = allViolations.filter((v) => v.severity === "error");
1072
+ const warningViolations = allViolations.filter((v) => v.severity === "warning");
1073
+ const checkedCount = invariantResults.filter((r) => r.checked).length;
1074
+ const advisoryCount = invariantResults.filter((r) => !r.checked).length;
1075
+ const status = errorViolations.length > 0 ? "fail" :
1076
+ warningViolations.length > 0 ? "warn" :
1077
+ "pass";
1078
+ const parts = [];
1079
+ if (allViolations.length > 0) {
1080
+ parts.push(`${allViolations.length} violation${allViolations.length === 1 ? "" : "s"}`);
1081
+ for (const v of allViolations.slice(0, 3)) {
1082
+ parts.push(`${v.invariantId}: ${v.file} — ${v.message}`);
1083
+ }
1084
+ if (allViolations.length > 3)
1085
+ parts.push(`(+${allViolations.length - 3} more)`);
1086
+ }
1087
+ else {
1088
+ parts.push(`${checkedCount} checked, ${advisoryCount} advisory`);
1089
+ }
1090
+ checks.push({
1091
+ name: "domain-invariants",
1092
+ status,
1093
+ message: parts.join("; "),
1094
+ invariantViolations: allViolations.length > 0 ? allViolations : undefined,
1095
+ });
1096
+ }
1097
+ // Prerequisite checks (profile-declared system dependencies)
1098
+ if (domainReport.profileId) {
1099
+ const profiles = listStackProfiles(forgeRoot);
1100
+ const profile = profiles.find((p) => p.id === domainReport.profileId);
1101
+ if (profile?.prerequisites && profile.prerequisites.length > 0) {
1102
+ checks.push(checkPrerequisites(profile.prerequisites));
1103
+ }
1104
+ }
1105
+ // RFC-0640: Run forge.profile.validate as advisory check (warn on failure, not fail)
1106
+ const profileValidateResult = await runProfileValidate({ argv: [], flags: {} }, { ...context, forgeRoot });
1107
+ const invalidProfiles = profileValidateResult.data?.profiles.filter((p) => !p.valid) ?? [];
1108
+ checks.push({
1109
+ name: "profile-validate",
1110
+ status: invalidProfiles.length === 0 ? "pass" : "warn",
1111
+ message: invalidProfiles.length === 0
1112
+ ? `${profileValidateResult.data?.profiles.length ?? 0} profile(s) valid`
1113
+ : `${invalidProfiles.length} profile(s) invalid (advisory): ${invalidProfiles.map((p) => p.id).join(", ")}`,
1114
+ });
1115
+ const forbiddenImports = await scanForForbiddenImports(forgeRoot, workspaceRoot);
1116
+ checks.push({
1117
+ name: "autonomy-guard",
1118
+ status: forbiddenImports.length === 0 ? "pass" : "fail",
1119
+ message: forbiddenImports.length === 0
1120
+ ? "No @warpgogol/* imports in forge source"
1121
+ : `${forbiddenImports.length} @warpgogol/* import(s) found in forge source — remove them`,
1122
+ });
1123
+ // Check bindings contract (RFC-0393)
1124
+ const bindingsResult = await validateBindings(workspaceRoot);
1125
+ checks.push({
1126
+ name: "bindings",
1127
+ status: bindingsResult.invalid.length === 0 ? "pass" : "fail",
1128
+ message: bindingsResult.invalid.length === 0
1129
+ ? `Bindings: ${bindingsResult.resolved.length} resolved, ${bindingsResult.absent.length} absent`
1130
+ : `Bindings: ${bindingsResult.invalid.length} invalid — ${bindingsResult.invalid.join(", ")}`,
1131
+ });
1132
+ // Check stale knowledge files (RFC-0524, RFC-0539)
1133
+ const staleCheck = await checkStaleKnowledgeFiles(workspaceRoot, forgeRoot);
1134
+ checks.push(staleCheck);
1135
+ // RFC-0660: Check legacy sections in knowledge files
1136
+ const legacyCheck = checkLegacyKnowledgeSections(workspaceRoot, forgeRoot);
1137
+ checks.push(legacyCheck);
1138
+ // RFC-0661: Check knowledge layer token budgets
1139
+ const budgetCheck = checkKnowledgeBudgets(workspaceRoot, forgeRoot);
1140
+ checks.push(budgetCheck);
1141
+ // RFC-0663: Check cross-skill duplicate principles
1142
+ const duplicatesCheck = checkKnowledgeDuplicates(workspaceRoot, forgeRoot);
1143
+ checks.push(duplicatesCheck);
1144
+ // RFC-0663: Validate shared knowledge layer file
1145
+ const sharedKnowledgeCheck = checkSharedKnowledgeFile(workspaceRoot, forgeRoot);
1146
+ checks.push(sharedKnowledgeCheck);
1147
+ // RFC-0664: Check memory layer health (budget, gitignore coverage, leak risk)
1148
+ checks.push(checkMemoryLayer(workspaceRoot));
1149
+ // RFC-0539: Check pack skills — stale/missing copies and config validation
1150
+ const packCheck = await checkPackSkills(workspaceRoot);
1151
+ checks.push(packCheck);
1152
+ // RFC-0941: Check pack manifests — forge.plugin.yaml existence and validity
1153
+ const packManifestCheck = await checkPackManifests(workspaceRoot);
1154
+ checks.push(packManifestCheck);
1155
+ // RFC-0704: Check independent version packages — paths must exist and contain package.json
1156
+ const independentCheck = await checkIndependentVersionPackages(workspaceRoot);
1157
+ checks.push(independentCheck);
1158
+ // RFC-0611: Check nested AGENTS.md — missing, stale, hand-written
1159
+ // RFC-0640: Use profile-driven workspace types when available (all domains)
1160
+ // RFC-0640 fix: previously gated by isSoftwareDomain, which skipped the check
1161
+ // entirely for non-software domains. Now runs for all domains — profile-driven
1162
+ // wsTypes replace hardcoded detection when present.
1163
+ {
1164
+ let wsTypes;
1165
+ try {
1166
+ const config = loadForgeConfig(workspaceRoot);
1167
+ // RFC-0643: prefer config.profile (loaded by loadForgeConfig)
1168
+ if (config.profile?.workspaceTypes && config.profile.workspaceTypes.length > 0) {
1169
+ wsTypes = config.profile.workspaceTypes;
1170
+ }
1171
+ else {
1172
+ const profiles = listStackProfiles(forgeRoot);
1173
+ for (const stackId of config.project.stack) {
1174
+ const profile = profiles.find((p) => p.id === stackId);
1175
+ if (profile?.workspaceTypes && profile.workspaceTypes.length > 0) {
1176
+ wsTypes = profile.workspaceTypes;
1177
+ break;
1178
+ }
1179
+ }
1180
+ }
1181
+ }
1182
+ catch {
1183
+ // profiles not loadable
1184
+ }
1185
+ const nestedCheck = await checkNestedAgentsMd(workspaceRoot, wsTypes);
1186
+ checks.push(nestedCheck);
1187
+ }
1188
+ // RFC-0640: --strict flag elevates warn to fail for domain-related checks
1189
+ const finalChecks = strict
1190
+ ? checks.map((c) => c.status === "warn" &&
1191
+ (c.name === "domain-invariants" || c.name === "profile-validate")
1192
+ ? { ...c, status: "fail" }
1193
+ : c)
1194
+ : checks;
1195
+ const allPass = finalChecks.every((c) => c.status === "pass");
1196
+ const hasFails = finalChecks.some((c) => c.status === "fail");
1197
+ if (outputFormat === "pretty") {
1198
+ logger.section(`Forge Doctor — ${workspaceRoot}`);
1199
+ for (const check of finalChecks) {
1200
+ const icon = check.status === "pass" ? "✓" : check.status === "warn" ? "⚠" : "✖";
1201
+ const fn = check.status === "pass" ? logger.success : check.status === "warn" ? logger.warn : logger.error;
1202
+ fn(`${icon} ${check.name}: ${check.message}`);
1203
+ }
1204
+ if (allPass) {
1205
+ logger.success("All checks passed — forge is properly configured.");
1206
+ }
1207
+ else if (hasFails) {
1208
+ logger.error("Some checks failed — run 'forge create' to fix.");
1209
+ }
1210
+ else {
1211
+ logger.warn("Some checks warn — review above.");
1212
+ }
1213
+ }
1214
+ return {
1215
+ data: { command: "forge.doctor", checks: finalChecks, allPass, forbiddenImports, bindings: bindingsResult, domain: domainReport },
1216
+ exitCode: hasFails ? 1 : 0,
1217
+ summary: allPass
1218
+ ? "forge.doctor: all checks passed"
1219
+ : `forge.doctor: ${finalChecks.filter((c) => c.status === "fail").length} fail(s), ${finalChecks.filter((c) => c.status === "warn").length} warn(s)`,
1220
+ };
1221
+ }
1222
+ //# sourceMappingURL=doctor.js.map