@productbrain/cli 0.1.0-beta.1 → 0.1.0-beta.102

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 (747) hide show
  1. package/README.md +127 -0
  2. package/dist/__tests__/adapters.test.d.ts +2 -0
  3. package/dist/__tests__/adapters.test.d.ts.map +1 -0
  4. package/dist/__tests__/adapters.test.js +417 -0
  5. package/dist/__tests__/adapters.test.js.map +1 -0
  6. package/dist/__tests__/audit.test.d.ts +2 -0
  7. package/dist/__tests__/audit.test.d.ts.map +1 -0
  8. package/dist/__tests__/audit.test.js +394 -0
  9. package/dist/__tests__/audit.test.js.map +1 -0
  10. package/dist/__tests__/authority-domains.test.d.ts +2 -0
  11. package/dist/__tests__/authority-domains.test.d.ts.map +1 -0
  12. package/dist/__tests__/authority-domains.test.js +48 -0
  13. package/dist/__tests__/authority-domains.test.js.map +1 -0
  14. package/dist/__tests__/batch-transformations.test.d.ts +2 -0
  15. package/dist/__tests__/batch-transformations.test.d.ts.map +1 -0
  16. package/dist/__tests__/batch-transformations.test.js +263 -0
  17. package/dist/__tests__/batch-transformations.test.js.map +1 -0
  18. package/dist/__tests__/capture.test.d.ts +2 -0
  19. package/dist/__tests__/capture.test.d.ts.map +1 -0
  20. package/dist/__tests__/capture.test.js +377 -0
  21. package/dist/__tests__/capture.test.js.map +1 -0
  22. package/dist/__tests__/config.test.d.ts +8 -0
  23. package/dist/__tests__/config.test.d.ts.map +1 -0
  24. package/dist/__tests__/config.test.js +296 -0
  25. package/dist/__tests__/config.test.js.map +1 -0
  26. package/dist/__tests__/constants.test.d.ts +2 -0
  27. package/dist/__tests__/constants.test.d.ts.map +1 -0
  28. package/dist/__tests__/constants.test.js +141 -0
  29. package/dist/__tests__/constants.test.js.map +1 -0
  30. package/dist/__tests__/constellation.test.d.ts +2 -0
  31. package/dist/__tests__/constellation.test.d.ts.map +1 -0
  32. package/dist/__tests__/constellation.test.js +254 -0
  33. package/dist/__tests__/constellation.test.js.map +1 -0
  34. package/dist/__tests__/context-strategy.test.d.ts +2 -0
  35. package/dist/__tests__/context-strategy.test.d.ts.map +1 -0
  36. package/dist/__tests__/context-strategy.test.js +79 -0
  37. package/dist/__tests__/context-strategy.test.js.map +1 -0
  38. package/dist/__tests__/envelope-contract.test.d.ts +15 -0
  39. package/dist/__tests__/envelope-contract.test.d.ts.map +1 -0
  40. package/dist/__tests__/envelope-contract.test.js +126 -0
  41. package/dist/__tests__/envelope-contract.test.js.map +1 -0
  42. package/dist/__tests__/errors.test.d.ts +2 -0
  43. package/dist/__tests__/errors.test.d.ts.map +1 -0
  44. package/dist/__tests__/errors.test.js +117 -0
  45. package/dist/__tests__/errors.test.js.map +1 -0
  46. package/dist/__tests__/experiment.test.d.ts +6 -0
  47. package/dist/__tests__/experiment.test.d.ts.map +1 -0
  48. package/dist/__tests__/experiment.test.js +69 -0
  49. package/dist/__tests__/experiment.test.js.map +1 -0
  50. package/dist/__tests__/fields.test.d.ts +2 -0
  51. package/dist/__tests__/fields.test.d.ts.map +1 -0
  52. package/dist/__tests__/fields.test.js +238 -0
  53. package/dist/__tests__/fields.test.js.map +1 -0
  54. package/dist/__tests__/glossary.test.d.ts +2 -0
  55. package/dist/__tests__/glossary.test.d.ts.map +1 -0
  56. package/dist/__tests__/glossary.test.js +32 -0
  57. package/dist/__tests__/glossary.test.js.map +1 -0
  58. package/dist/__tests__/handshake-preview.test.d.ts +2 -0
  59. package/dist/__tests__/handshake-preview.test.d.ts.map +1 -0
  60. package/dist/__tests__/handshake-preview.test.js +279 -0
  61. package/dist/__tests__/handshake-preview.test.js.map +1 -0
  62. package/dist/__tests__/handshake.test.d.ts +2 -0
  63. package/dist/__tests__/handshake.test.d.ts.map +1 -0
  64. package/dist/__tests__/handshake.test.js +555 -0
  65. package/dist/__tests__/handshake.test.js.map +1 -0
  66. package/dist/__tests__/hook-intents.test.d.ts +2 -0
  67. package/dist/__tests__/hook-intents.test.d.ts.map +1 -0
  68. package/dist/__tests__/hook-intents.test.js +184 -0
  69. package/dist/__tests__/hook-intents.test.js.map +1 -0
  70. package/dist/__tests__/ingest.test.d.ts +2 -0
  71. package/dist/__tests__/ingest.test.d.ts.map +1 -0
  72. package/dist/__tests__/ingest.test.js +185 -0
  73. package/dist/__tests__/ingest.test.js.map +1 -0
  74. package/dist/__tests__/init.test.d.ts +7 -0
  75. package/dist/__tests__/init.test.d.ts.map +1 -0
  76. package/dist/__tests__/init.test.js +146 -0
  77. package/dist/__tests__/init.test.js.map +1 -0
  78. package/dist/__tests__/login.test.d.ts +2 -0
  79. package/dist/__tests__/login.test.d.ts.map +1 -0
  80. package/dist/__tests__/login.test.js +167 -0
  81. package/dist/__tests__/login.test.js.map +1 -0
  82. package/dist/__tests__/manifest.test.d.ts +6 -0
  83. package/dist/__tests__/manifest.test.d.ts.map +1 -0
  84. package/dist/__tests__/manifest.test.js +138 -0
  85. package/dist/__tests__/manifest.test.js.map +1 -0
  86. package/dist/__tests__/method-registry.integration.test.d.ts +6 -0
  87. package/dist/__tests__/method-registry.integration.test.d.ts.map +1 -0
  88. package/dist/__tests__/method-registry.integration.test.js +18 -0
  89. package/dist/__tests__/method-registry.integration.test.js.map +1 -0
  90. package/dist/__tests__/method-registry.test.d.ts +14 -0
  91. package/dist/__tests__/method-registry.test.d.ts.map +1 -0
  92. package/dist/__tests__/method-registry.test.js +134 -0
  93. package/dist/__tests__/method-registry.test.js.map +1 -0
  94. package/dist/__tests__/onboarding-path-b.test.d.ts +2 -0
  95. package/dist/__tests__/onboarding-path-b.test.d.ts.map +1 -0
  96. package/dist/__tests__/onboarding-path-b.test.js +46 -0
  97. package/dist/__tests__/onboarding-path-b.test.js.map +1 -0
  98. package/dist/__tests__/onboarding.test.d.ts +6 -0
  99. package/dist/__tests__/onboarding.test.d.ts.map +1 -0
  100. package/dist/__tests__/onboarding.test.js +347 -0
  101. package/dist/__tests__/onboarding.test.js.map +1 -0
  102. package/dist/__tests__/orient.test.d.ts +2 -0
  103. package/dist/__tests__/orient.test.d.ts.map +1 -0
  104. package/dist/__tests__/orient.test.js +196 -0
  105. package/dist/__tests__/orient.test.js.map +1 -0
  106. package/dist/__tests__/personal-layer.test.d.ts +12 -0
  107. package/dist/__tests__/personal-layer.test.d.ts.map +1 -0
  108. package/dist/__tests__/personal-layer.test.js +304 -0
  109. package/dist/__tests__/personal-layer.test.js.map +1 -0
  110. package/dist/__tests__/profiles.test.d.ts +2 -0
  111. package/dist/__tests__/profiles.test.d.ts.map +1 -0
  112. package/dist/__tests__/profiles.test.js +212 -0
  113. package/dist/__tests__/profiles.test.js.map +1 -0
  114. package/dist/__tests__/promote.test.d.ts +2 -0
  115. package/dist/__tests__/promote.test.d.ts.map +1 -0
  116. package/dist/__tests__/promote.test.js +230 -0
  117. package/dist/__tests__/promote.test.js.map +1 -0
  118. package/dist/__tests__/prompts.test.d.ts +6 -0
  119. package/dist/__tests__/prompts.test.d.ts.map +1 -0
  120. package/dist/__tests__/prompts.test.js +146 -0
  121. package/dist/__tests__/prompts.test.js.map +1 -0
  122. package/dist/__tests__/proposals.test.d.ts +2 -0
  123. package/dist/__tests__/proposals.test.d.ts.map +1 -0
  124. package/dist/__tests__/proposals.test.js +167 -0
  125. package/dist/__tests__/proposals.test.js.map +1 -0
  126. package/dist/__tests__/relate.test.d.ts +2 -0
  127. package/dist/__tests__/relate.test.d.ts.map +1 -0
  128. package/dist/__tests__/relate.test.js +103 -0
  129. package/dist/__tests__/relate.test.js.map +1 -0
  130. package/dist/__tests__/repo-detect.test.d.ts +2 -0
  131. package/dist/__tests__/repo-detect.test.d.ts.map +1 -0
  132. package/dist/__tests__/repo-detect.test.js +215 -0
  133. package/dist/__tests__/repo-detect.test.js.map +1 -0
  134. package/dist/__tests__/runner.test.d.ts +2 -0
  135. package/dist/__tests__/runner.test.d.ts.map +1 -0
  136. package/dist/__tests__/runner.test.js +219 -0
  137. package/dist/__tests__/runner.test.js.map +1 -0
  138. package/dist/__tests__/session-state-machine.test.d.ts +2 -0
  139. package/dist/__tests__/session-state-machine.test.d.ts.map +1 -0
  140. package/dist/__tests__/session-state-machine.test.js +154 -0
  141. package/dist/__tests__/session-state-machine.test.js.map +1 -0
  142. package/dist/__tests__/session-touch.test.d.ts +2 -0
  143. package/dist/__tests__/session-touch.test.d.ts.map +1 -0
  144. package/dist/__tests__/session-touch.test.js +134 -0
  145. package/dist/__tests__/session-touch.test.js.map +1 -0
  146. package/dist/__tests__/session.test.d.ts +2 -0
  147. package/dist/__tests__/session.test.d.ts.map +1 -0
  148. package/dist/__tests__/session.test.js +46 -0
  149. package/dist/__tests__/session.test.js.map +1 -0
  150. package/dist/__tests__/setup-ingest.test.d.ts +2 -0
  151. package/dist/__tests__/setup-ingest.test.d.ts.map +1 -0
  152. package/dist/__tests__/setup-ingest.test.js +55 -0
  153. package/dist/__tests__/setup-ingest.test.js.map +1 -0
  154. package/dist/__tests__/setup-resolver.test.d.ts +14 -0
  155. package/dist/__tests__/setup-resolver.test.d.ts.map +1 -0
  156. package/dist/__tests__/setup-resolver.test.js +228 -0
  157. package/dist/__tests__/setup-resolver.test.js.map +1 -0
  158. package/dist/__tests__/setup.test.d.ts +2 -0
  159. package/dist/__tests__/setup.test.d.ts.map +1 -0
  160. package/dist/__tests__/setup.test.js +141 -0
  161. package/dist/__tests__/setup.test.js.map +1 -0
  162. package/dist/__tests__/spinner-labels.test.d.ts +2 -0
  163. package/dist/__tests__/spinner-labels.test.d.ts.map +1 -0
  164. package/dist/__tests__/spinner-labels.test.js +23 -0
  165. package/dist/__tests__/spinner-labels.test.js.map +1 -0
  166. package/dist/__tests__/state.test.d.ts +6 -0
  167. package/dist/__tests__/state.test.d.ts.map +1 -0
  168. package/dist/__tests__/state.test.js +97 -0
  169. package/dist/__tests__/state.test.js.map +1 -0
  170. package/dist/__tests__/strip.test.d.ts +2 -0
  171. package/dist/__tests__/strip.test.d.ts.map +1 -0
  172. package/dist/__tests__/strip.test.js +136 -0
  173. package/dist/__tests__/strip.test.js.map +1 -0
  174. package/dist/__tests__/surface-profiles.test.d.ts +2 -0
  175. package/dist/__tests__/surface-profiles.test.d.ts.map +1 -0
  176. package/dist/__tests__/surface-profiles.test.js +233 -0
  177. package/dist/__tests__/surface-profiles.test.js.map +1 -0
  178. package/dist/__tests__/surfaces.test.d.ts +2 -0
  179. package/dist/__tests__/surfaces.test.d.ts.map +1 -0
  180. package/dist/__tests__/surfaces.test.js +46 -0
  181. package/dist/__tests__/surfaces.test.js.map +1 -0
  182. package/dist/__tests__/update.test.d.ts +2 -0
  183. package/dist/__tests__/update.test.d.ts.map +1 -0
  184. package/dist/__tests__/update.test.js +228 -0
  185. package/dist/__tests__/update.test.js.map +1 -0
  186. package/dist/__tests__/workspace.test.d.ts +2 -0
  187. package/dist/__tests__/workspace.test.d.ts.map +1 -0
  188. package/dist/__tests__/workspace.test.js +328 -0
  189. package/dist/__tests__/workspace.test.js.map +1 -0
  190. package/dist/commands/accept.d.ts +18 -0
  191. package/dist/commands/accept.d.ts.map +1 -0
  192. package/dist/commands/accept.js +76 -0
  193. package/dist/commands/accept.js.map +1 -0
  194. package/dist/commands/admin/cockpit.d.ts +90 -0
  195. package/dist/commands/admin/cockpit.d.ts.map +1 -0
  196. package/dist/commands/admin/cockpit.js +618 -0
  197. package/dist/commands/admin/cockpit.js.map +1 -0
  198. package/dist/commands/admin/index.d.ts +21 -0
  199. package/dist/commands/admin/index.d.ts.map +1 -0
  200. package/dist/commands/admin/index.js +256 -0
  201. package/dist/commands/admin/index.js.map +1 -0
  202. package/dist/commands/admin/inspect.d.ts +30 -0
  203. package/dist/commands/admin/inspect.d.ts.map +1 -0
  204. package/dist/commands/admin/inspect.js +555 -0
  205. package/dist/commands/admin/inspect.js.map +1 -0
  206. package/dist/commands/admin/inspect.test.d.ts +7 -0
  207. package/dist/commands/admin/inspect.test.d.ts.map +1 -0
  208. package/dist/commands/admin/inspect.test.js +90 -0
  209. package/dist/commands/admin/inspect.test.js.map +1 -0
  210. package/dist/commands/admin/manage.d.ts +8 -0
  211. package/dist/commands/admin/manage.d.ts.map +1 -0
  212. package/dist/commands/admin/manage.js +76 -0
  213. package/dist/commands/admin/manage.js.map +1 -0
  214. package/dist/commands/admin/seed.d.ts +46 -0
  215. package/dist/commands/admin/seed.d.ts.map +1 -0
  216. package/dist/commands/admin/seed.js +729 -0
  217. package/dist/commands/admin/seed.js.map +1 -0
  218. package/dist/commands/admin/seed.test.d.ts +11 -0
  219. package/dist/commands/admin/seed.test.d.ts.map +1 -0
  220. package/dist/commands/admin/seed.test.js +123 -0
  221. package/dist/commands/admin/seed.test.js.map +1 -0
  222. package/dist/commands/audit.d.ts +25 -0
  223. package/dist/commands/audit.d.ts.map +1 -0
  224. package/dist/commands/audit.js +188 -0
  225. package/dist/commands/audit.js.map +1 -0
  226. package/dist/commands/authority-domains.d.ts +140 -0
  227. package/dist/commands/authority-domains.d.ts.map +1 -0
  228. package/dist/commands/authority-domains.js +268 -0
  229. package/dist/commands/authority-domains.js.map +1 -0
  230. package/dist/commands/brand-pack.d.ts +2 -0
  231. package/dist/commands/brand-pack.d.ts.map +1 -0
  232. package/dist/commands/brand-pack.js +25 -0
  233. package/dist/commands/brand-pack.js.map +1 -0
  234. package/dist/commands/brief.d.ts +28 -0
  235. package/dist/commands/brief.d.ts.map +1 -0
  236. package/dist/commands/brief.js +75 -0
  237. package/dist/commands/brief.js.map +1 -0
  238. package/dist/commands/capture.d.ts +30 -0
  239. package/dist/commands/capture.d.ts.map +1 -0
  240. package/dist/commands/capture.js +339 -0
  241. package/dist/commands/capture.js.map +1 -0
  242. package/dist/commands/chain-walk.d.ts +14 -0
  243. package/dist/commands/chain-walk.d.ts.map +1 -0
  244. package/dist/commands/chain-walk.js +38 -0
  245. package/dist/commands/chain-walk.js.map +1 -0
  246. package/dist/commands/changes.d.ts +11 -0
  247. package/dist/commands/changes.d.ts.map +1 -0
  248. package/dist/commands/changes.js +46 -0
  249. package/dist/commands/changes.js.map +1 -0
  250. package/dist/commands/codex-prep.d.ts +12 -0
  251. package/dist/commands/codex-prep.d.ts.map +1 -0
  252. package/dist/commands/codex-prep.js +122 -0
  253. package/dist/commands/codex-prep.js.map +1 -0
  254. package/dist/commands/collections.d.ts +22 -0
  255. package/dist/commands/collections.d.ts.map +1 -0
  256. package/dist/commands/collections.js +77 -0
  257. package/dist/commands/collections.js.map +1 -0
  258. package/dist/commands/connect-integration.test.d.ts +7 -0
  259. package/dist/commands/connect-integration.test.d.ts.map +1 -0
  260. package/dist/commands/connect-integration.test.js +211 -0
  261. package/dist/commands/connect-integration.test.js.map +1 -0
  262. package/dist/commands/connect-screens.d.ts +24 -0
  263. package/dist/commands/connect-screens.d.ts.map +1 -0
  264. package/dist/commands/connect-screens.js +97 -0
  265. package/dist/commands/connect-screens.js.map +1 -0
  266. package/dist/commands/connect.d.ts +23 -0
  267. package/dist/commands/connect.d.ts.map +1 -0
  268. package/dist/commands/connect.js +289 -0
  269. package/dist/commands/connect.js.map +1 -0
  270. package/dist/commands/connect.test.d.ts +6 -0
  271. package/dist/commands/connect.test.d.ts.map +1 -0
  272. package/dist/commands/connect.test.js +297 -0
  273. package/dist/commands/connect.test.js.map +1 -0
  274. package/dist/commands/constellation.d.ts +11 -0
  275. package/dist/commands/constellation.d.ts.map +1 -0
  276. package/dist/commands/constellation.js +33 -0
  277. package/dist/commands/constellation.js.map +1 -0
  278. package/dist/commands/context.d.ts +2 -1
  279. package/dist/commands/context.d.ts.map +1 -1
  280. package/dist/commands/context.js +25 -10
  281. package/dist/commands/context.js.map +1 -1
  282. package/dist/commands/cross-cut.d.ts +11 -0
  283. package/dist/commands/cross-cut.d.ts.map +1 -0
  284. package/dist/commands/cross-cut.js +23 -0
  285. package/dist/commands/cross-cut.js.map +1 -0
  286. package/dist/commands/doctor.d.ts +18 -0
  287. package/dist/commands/doctor.d.ts.map +1 -0
  288. package/dist/commands/doctor.js +232 -0
  289. package/dist/commands/doctor.js.map +1 -0
  290. package/dist/commands/doctor.test.d.ts +8 -0
  291. package/dist/commands/doctor.test.d.ts.map +1 -0
  292. package/dist/commands/doctor.test.js +311 -0
  293. package/dist/commands/doctor.test.js.map +1 -0
  294. package/dist/commands/fields.d.ts +9 -0
  295. package/dist/commands/fields.d.ts.map +1 -0
  296. package/dist/commands/fields.js +30 -0
  297. package/dist/commands/fields.js.map +1 -0
  298. package/dist/commands/get.d.ts +8 -1
  299. package/dist/commands/get.d.ts.map +1 -1
  300. package/dist/commands/get.js +65 -8
  301. package/dist/commands/get.js.map +1 -1
  302. package/dist/commands/handshake.d.ts +142 -0
  303. package/dist/commands/handshake.d.ts.map +1 -0
  304. package/dist/commands/handshake.js +1349 -0
  305. package/dist/commands/handshake.js.map +1 -0
  306. package/dist/commands/ingest.d.ts +14 -0
  307. package/dist/commands/ingest.d.ts.map +1 -0
  308. package/dist/commands/ingest.js +189 -0
  309. package/dist/commands/ingest.js.map +1 -0
  310. package/dist/commands/init.d.ts +14 -0
  311. package/dist/commands/init.d.ts.map +1 -0
  312. package/dist/commands/init.js +109 -0
  313. package/dist/commands/init.js.map +1 -0
  314. package/dist/commands/login.d.ts +9 -0
  315. package/dist/commands/login.d.ts.map +1 -0
  316. package/dist/commands/login.js +116 -0
  317. package/dist/commands/login.js.map +1 -0
  318. package/dist/commands/method.d.ts +99 -0
  319. package/dist/commands/method.d.ts.map +1 -0
  320. package/dist/commands/method.js +781 -0
  321. package/dist/commands/method.js.map +1 -0
  322. package/dist/commands/migrate-setup.d.ts +18 -0
  323. package/dist/commands/migrate-setup.d.ts.map +1 -0
  324. package/dist/commands/migrate-setup.js +198 -0
  325. package/dist/commands/migrate-setup.js.map +1 -0
  326. package/dist/commands/orient.d.ts +109 -1
  327. package/dist/commands/orient.d.ts.map +1 -1
  328. package/dist/commands/orient.js +94 -7
  329. package/dist/commands/orient.js.map +1 -1
  330. package/dist/commands/profile.d.ts +47 -0
  331. package/dist/commands/profile.d.ts.map +1 -0
  332. package/dist/commands/profile.js +148 -0
  333. package/dist/commands/profile.js.map +1 -0
  334. package/dist/commands/promote.d.ts +12 -0
  335. package/dist/commands/promote.d.ts.map +1 -0
  336. package/dist/commands/promote.js +113 -0
  337. package/dist/commands/promote.js.map +1 -0
  338. package/dist/commands/proposals.d.ts +9 -0
  339. package/dist/commands/proposals.d.ts.map +1 -0
  340. package/dist/commands/proposals.js +24 -0
  341. package/dist/commands/proposals.js.map +1 -0
  342. package/dist/commands/reject.d.ts +14 -0
  343. package/dist/commands/reject.d.ts.map +1 -0
  344. package/dist/commands/reject.js +43 -0
  345. package/dist/commands/reject.js.map +1 -0
  346. package/dist/commands/relate.d.ts +16 -0
  347. package/dist/commands/relate.d.ts.map +1 -0
  348. package/dist/commands/relate.js +111 -0
  349. package/dist/commands/relate.js.map +1 -0
  350. package/dist/commands/search.d.ts +1 -0
  351. package/dist/commands/search.d.ts.map +1 -1
  352. package/dist/commands/search.js +10 -4
  353. package/dist/commands/search.js.map +1 -1
  354. package/dist/commands/session.d.ts +20 -0
  355. package/dist/commands/session.d.ts.map +1 -0
  356. package/dist/commands/session.js +203 -0
  357. package/dist/commands/session.js.map +1 -0
  358. package/dist/commands/setup-ingest.d.ts +17 -0
  359. package/dist/commands/setup-ingest.d.ts.map +1 -0
  360. package/dist/commands/setup-ingest.js +224 -0
  361. package/dist/commands/setup-ingest.js.map +1 -0
  362. package/dist/commands/setup-resolver.d.ts +58 -0
  363. package/dist/commands/setup-resolver.d.ts.map +1 -0
  364. package/dist/commands/setup-resolver.js +150 -0
  365. package/dist/commands/setup-resolver.js.map +1 -0
  366. package/dist/commands/setup.d.ts +15 -0
  367. package/dist/commands/setup.d.ts.map +1 -0
  368. package/dist/commands/setup.js +148 -0
  369. package/dist/commands/setup.js.map +1 -0
  370. package/dist/commands/update.d.ts +17 -0
  371. package/dist/commands/update.d.ts.map +1 -0
  372. package/dist/commands/update.js +178 -0
  373. package/dist/commands/update.js.map +1 -0
  374. package/dist/commands/usage.d.ts +40 -0
  375. package/dist/commands/usage.d.ts.map +1 -0
  376. package/dist/commands/usage.js +232 -0
  377. package/dist/commands/usage.js.map +1 -0
  378. package/dist/commands/verify.d.ts +13 -0
  379. package/dist/commands/verify.d.ts.map +1 -0
  380. package/dist/commands/verify.js +49 -0
  381. package/dist/commands/verify.js.map +1 -0
  382. package/dist/commands/welcome.d.ts +21 -0
  383. package/dist/commands/welcome.d.ts.map +1 -0
  384. package/dist/commands/welcome.js +50 -0
  385. package/dist/commands/welcome.js.map +1 -0
  386. package/dist/commands/workspace.d.ts +113 -0
  387. package/dist/commands/workspace.d.ts.map +1 -0
  388. package/dist/commands/workspace.js +263 -0
  389. package/dist/commands/workspace.js.map +1 -0
  390. package/dist/formatters/audit.d.ts +46 -0
  391. package/dist/formatters/audit.d.ts.map +1 -0
  392. package/dist/formatters/audit.js +81 -0
  393. package/dist/formatters/audit.js.map +1 -0
  394. package/dist/formatters/brief.d.ts +112 -0
  395. package/dist/formatters/brief.d.ts.map +1 -0
  396. package/dist/formatters/brief.js +179 -0
  397. package/dist/formatters/brief.js.map +1 -0
  398. package/dist/formatters/capture.d.ts +48 -0
  399. package/dist/formatters/capture.d.ts.map +1 -0
  400. package/dist/formatters/capture.js +77 -0
  401. package/dist/formatters/capture.js.map +1 -0
  402. package/dist/formatters/chain-walk.d.ts +33 -0
  403. package/dist/formatters/chain-walk.d.ts.map +1 -0
  404. package/dist/formatters/chain-walk.js +54 -0
  405. package/dist/formatters/chain-walk.js.map +1 -0
  406. package/dist/formatters/changes.d.ts +25 -0
  407. package/dist/formatters/changes.d.ts.map +1 -0
  408. package/dist/formatters/changes.js +60 -0
  409. package/dist/formatters/changes.js.map +1 -0
  410. package/dist/formatters/collections.d.ts +40 -0
  411. package/dist/formatters/collections.d.ts.map +1 -0
  412. package/dist/formatters/collections.js +93 -0
  413. package/dist/formatters/collections.js.map +1 -0
  414. package/dist/formatters/constellation.d.ts +34 -0
  415. package/dist/formatters/constellation.d.ts.map +1 -0
  416. package/dist/formatters/constellation.js +38 -0
  417. package/dist/formatters/constellation.js.map +1 -0
  418. package/dist/formatters/cross-cut.d.ts +21 -0
  419. package/dist/formatters/cross-cut.d.ts.map +1 -0
  420. package/dist/formatters/cross-cut.js +32 -0
  421. package/dist/formatters/cross-cut.js.map +1 -0
  422. package/dist/formatters/entry.d.ts +11 -4
  423. package/dist/formatters/entry.d.ts.map +1 -1
  424. package/dist/formatters/entry.js +24 -8
  425. package/dist/formatters/entry.js.map +1 -1
  426. package/dist/formatters/fields.d.ts +32 -0
  427. package/dist/formatters/fields.d.ts.map +1 -0
  428. package/dist/formatters/fields.js +49 -0
  429. package/dist/formatters/fields.js.map +1 -0
  430. package/dist/formatters/handshake.d.ts +46 -0
  431. package/dist/formatters/handshake.d.ts.map +1 -0
  432. package/dist/formatters/handshake.js +163 -0
  433. package/dist/formatters/handshake.js.map +1 -0
  434. package/dist/formatters/orient.d.ts +129 -1
  435. package/dist/formatters/orient.d.ts.map +1 -1
  436. package/dist/formatters/orient.js +156 -17
  437. package/dist/formatters/orient.js.map +1 -1
  438. package/dist/formatters/promote.d.ts +30 -0
  439. package/dist/formatters/promote.d.ts.map +1 -0
  440. package/dist/formatters/promote.js +39 -0
  441. package/dist/formatters/promote.js.map +1 -0
  442. package/dist/formatters/proposals.d.ts +45 -0
  443. package/dist/formatters/proposals.d.ts.map +1 -0
  444. package/dist/formatters/proposals.js +62 -0
  445. package/dist/formatters/proposals.js.map +1 -0
  446. package/dist/formatters/relate.d.ts +14 -0
  447. package/dist/formatters/relate.d.ts.map +1 -0
  448. package/dist/formatters/relate.js +16 -0
  449. package/dist/formatters/relate.js.map +1 -0
  450. package/dist/formatters/search.d.ts +0 -4
  451. package/dist/formatters/search.d.ts.map +1 -1
  452. package/dist/formatters/search.js +4 -1
  453. package/dist/formatters/search.js.map +1 -1
  454. package/dist/formatters/session.d.ts +11 -0
  455. package/dist/formatters/session.d.ts.map +1 -0
  456. package/dist/formatters/session.js +53 -0
  457. package/dist/formatters/session.js.map +1 -0
  458. package/dist/formatters/update.d.ts +17 -0
  459. package/dist/formatters/update.d.ts.map +1 -0
  460. package/dist/formatters/update.js +45 -0
  461. package/dist/formatters/update.js.map +1 -0
  462. package/dist/formatters/verify.d.ts +11 -0
  463. package/dist/formatters/verify.d.ts.map +1 -0
  464. package/dist/formatters/verify.js +11 -0
  465. package/dist/formatters/verify.js.map +1 -0
  466. package/dist/generators/__tests__/surface-profiles.test.d.ts +2 -0
  467. package/dist/generators/__tests__/surface-profiles.test.d.ts.map +1 -0
  468. package/dist/generators/__tests__/surface-profiles.test.js +89 -0
  469. package/dist/generators/__tests__/surface-profiles.test.js.map +1 -0
  470. package/dist/generators/adapters.d.ts +44 -0
  471. package/dist/generators/adapters.d.ts.map +1 -0
  472. package/dist/generators/adapters.js +290 -0
  473. package/dist/generators/adapters.js.map +1 -0
  474. package/dist/generators/adapters.test.d.ts +2 -0
  475. package/dist/generators/adapters.test.d.ts.map +1 -0
  476. package/dist/generators/adapters.test.js +27 -0
  477. package/dist/generators/adapters.test.js.map +1 -0
  478. package/dist/generators/archetypes.d.ts +52 -0
  479. package/dist/generators/archetypes.d.ts.map +1 -0
  480. package/dist/generators/archetypes.js +153 -0
  481. package/dist/generators/archetypes.js.map +1 -0
  482. package/dist/generators/archetypes.test.d.ts +2 -0
  483. package/dist/generators/archetypes.test.d.ts.map +1 -0
  484. package/dist/generators/archetypes.test.js +237 -0
  485. package/dist/generators/archetypes.test.js.map +1 -0
  486. package/dist/generators/boundary-manifest.d.ts +29 -0
  487. package/dist/generators/boundary-manifest.d.ts.map +1 -0
  488. package/dist/generators/boundary-manifest.js +183 -0
  489. package/dist/generators/boundary-manifest.js.map +1 -0
  490. package/dist/generators/boundary-manifest.test.d.ts +2 -0
  491. package/dist/generators/boundary-manifest.test.d.ts.map +1 -0
  492. package/dist/generators/boundary-manifest.test.js +91 -0
  493. package/dist/generators/boundary-manifest.test.js.map +1 -0
  494. package/dist/generators/briefing-md.d.ts +8 -0
  495. package/dist/generators/briefing-md.d.ts.map +1 -0
  496. package/dist/generators/briefing-md.js +51 -0
  497. package/dist/generators/briefing-md.js.map +1 -0
  498. package/dist/generators/chain-classifier.d.ts +49 -0
  499. package/dist/generators/chain-classifier.d.ts.map +1 -0
  500. package/dist/generators/chain-classifier.js +180 -0
  501. package/dist/generators/chain-classifier.js.map +1 -0
  502. package/dist/generators/chain-classifier.test.d.ts +2 -0
  503. package/dist/generators/chain-classifier.test.d.ts.map +1 -0
  504. package/dist/generators/chain-classifier.test.js +257 -0
  505. package/dist/generators/chain-classifier.test.js.map +1 -0
  506. package/dist/generators/chain-rules.d.ts +42 -0
  507. package/dist/generators/chain-rules.d.ts.map +1 -0
  508. package/dist/generators/chain-rules.js +144 -0
  509. package/dist/generators/chain-rules.js.map +1 -0
  510. package/dist/generators/chain-rules.test.d.ts +2 -0
  511. package/dist/generators/chain-rules.test.d.ts.map +1 -0
  512. package/dist/generators/chain-rules.test.js +179 -0
  513. package/dist/generators/chain-rules.test.js.map +1 -0
  514. package/dist/generators/context-md.d.ts +8 -0
  515. package/dist/generators/context-md.d.ts.map +1 -0
  516. package/dist/generators/context-md.js +134 -0
  517. package/dist/generators/context-md.js.map +1 -0
  518. package/dist/generators/handshake-diff.d.ts +67 -0
  519. package/dist/generators/handshake-diff.d.ts.map +1 -0
  520. package/dist/generators/handshake-diff.js +183 -0
  521. package/dist/generators/handshake-diff.js.map +1 -0
  522. package/dist/generators/handshake-diff.test.d.ts +2 -0
  523. package/dist/generators/handshake-diff.test.d.ts.map +1 -0
  524. package/dist/generators/handshake-diff.test.js +264 -0
  525. package/dist/generators/handshake-diff.test.js.map +1 -0
  526. package/dist/generators/manifest.d.ts +39 -0
  527. package/dist/generators/manifest.d.ts.map +1 -0
  528. package/dist/generators/manifest.js +166 -0
  529. package/dist/generators/manifest.js.map +1 -0
  530. package/dist/generators/portable-knowledge.d.ts +165 -0
  531. package/dist/generators/portable-knowledge.d.ts.map +1 -0
  532. package/dist/generators/portable-knowledge.js +613 -0
  533. package/dist/generators/portable-knowledge.js.map +1 -0
  534. package/dist/generators/portable-knowledge.test.d.ts +2 -0
  535. package/dist/generators/portable-knowledge.test.d.ts.map +1 -0
  536. package/dist/generators/portable-knowledge.test.js +927 -0
  537. package/dist/generators/portable-knowledge.test.js.map +1 -0
  538. package/dist/generators/surface-profiles.d.ts +49 -0
  539. package/dist/generators/surface-profiles.d.ts.map +1 -0
  540. package/dist/generators/surface-profiles.js +98 -0
  541. package/dist/generators/surface-profiles.js.map +1 -0
  542. package/dist/index.d.ts +3 -2
  543. package/dist/index.d.ts.map +1 -1
  544. package/dist/index.js +858 -32
  545. package/dist/index.js.map +1 -1
  546. package/dist/lib/activation.d.ts +28 -0
  547. package/dist/lib/activation.d.ts.map +1 -0
  548. package/dist/lib/activation.js +57 -0
  549. package/dist/lib/activation.js.map +1 -0
  550. package/dist/lib/activation.test.d.ts +6 -0
  551. package/dist/lib/activation.test.d.ts.map +1 -0
  552. package/dist/lib/activation.test.js +121 -0
  553. package/dist/lib/activation.test.js.map +1 -0
  554. package/dist/lib/canonicalRefs.d.ts +69 -0
  555. package/dist/lib/canonicalRefs.d.ts.map +1 -0
  556. package/dist/lib/canonicalRefs.js +83 -0
  557. package/dist/lib/canonicalRefs.js.map +1 -0
  558. package/dist/lib/client.d.ts +62 -1
  559. package/dist/lib/client.d.ts.map +1 -1
  560. package/dist/lib/client.js +259 -13
  561. package/dist/lib/client.js.map +1 -1
  562. package/dist/lib/collectionRegistry.d.ts +38 -0
  563. package/dist/lib/collectionRegistry.d.ts.map +1 -0
  564. package/dist/lib/collectionRegistry.js +112 -0
  565. package/dist/lib/collectionRegistry.js.map +1 -0
  566. package/dist/lib/config.d.ts +122 -2
  567. package/dist/lib/config.d.ts.map +1 -1
  568. package/dist/lib/config.js +426 -18
  569. package/dist/lib/config.js.map +1 -1
  570. package/dist/lib/connectKeyLabel.d.ts +9 -0
  571. package/dist/lib/connectKeyLabel.d.ts.map +1 -0
  572. package/dist/lib/connectKeyLabel.js +12 -0
  573. package/dist/lib/connectKeyLabel.js.map +1 -0
  574. package/dist/lib/constants.d.ts +42 -0
  575. package/dist/lib/constants.d.ts.map +1 -0
  576. package/dist/lib/constants.js +76 -0
  577. package/dist/lib/constants.js.map +1 -0
  578. package/dist/lib/conversation-engine.d.ts +45 -0
  579. package/dist/lib/conversation-engine.d.ts.map +1 -0
  580. package/dist/lib/conversation-engine.js +112 -0
  581. package/dist/lib/conversation-engine.js.map +1 -0
  582. package/dist/lib/conversation-phases.d.ts +59 -0
  583. package/dist/lib/conversation-phases.d.ts.map +1 -0
  584. package/dist/lib/conversation-phases.js +11 -0
  585. package/dist/lib/conversation-phases.js.map +1 -0
  586. package/dist/lib/conversation-signals.d.ts +30 -0
  587. package/dist/lib/conversation-signals.d.ts.map +1 -0
  588. package/dist/lib/conversation-signals.js +64 -0
  589. package/dist/lib/conversation-signals.js.map +1 -0
  590. package/dist/lib/deployment.d.ts +23 -0
  591. package/dist/lib/deployment.d.ts.map +1 -0
  592. package/dist/lib/deployment.js +78 -0
  593. package/dist/lib/deployment.js.map +1 -0
  594. package/dist/lib/deployment.test.d.ts +5 -0
  595. package/dist/lib/deployment.test.d.ts.map +1 -0
  596. package/dist/lib/deployment.test.js +54 -0
  597. package/dist/lib/deployment.test.js.map +1 -0
  598. package/dist/lib/errors.d.ts +60 -0
  599. package/dist/lib/errors.d.ts.map +1 -0
  600. package/dist/lib/errors.js +69 -0
  601. package/dist/lib/errors.js.map +1 -0
  602. package/dist/lib/experiment.d.ts +18 -0
  603. package/dist/lib/experiment.d.ts.map +1 -0
  604. package/dist/lib/experiment.js +28 -0
  605. package/dist/lib/experiment.js.map +1 -0
  606. package/dist/lib/format.d.ts +10 -0
  607. package/dist/lib/format.d.ts.map +1 -0
  608. package/dist/lib/format.js +27 -0
  609. package/dist/lib/format.js.map +1 -0
  610. package/dist/lib/glossary.d.ts +19 -0
  611. package/dist/lib/glossary.d.ts.map +1 -0
  612. package/dist/lib/glossary.js +53 -0
  613. package/dist/lib/glossary.js.map +1 -0
  614. package/dist/lib/hook-intents.d.ts +51 -0
  615. package/dist/lib/hook-intents.d.ts.map +1 -0
  616. package/dist/lib/hook-intents.js +85 -0
  617. package/dist/lib/hook-intents.js.map +1 -0
  618. package/dist/lib/inferSourceDate.d.ts +12 -0
  619. package/dist/lib/inferSourceDate.d.ts.map +1 -0
  620. package/dist/lib/inferSourceDate.js +44 -0
  621. package/dist/lib/inferSourceDate.js.map +1 -0
  622. package/dist/lib/method-registry.d.ts +32 -0
  623. package/dist/lib/method-registry.d.ts.map +1 -0
  624. package/dist/lib/method-registry.js +53 -0
  625. package/dist/lib/method-registry.js.map +1 -0
  626. package/dist/lib/normalizeMaterializedFilename.d.ts +28 -0
  627. package/dist/lib/normalizeMaterializedFilename.d.ts.map +1 -0
  628. package/dist/lib/normalizeMaterializedFilename.js +56 -0
  629. package/dist/lib/normalizeMaterializedFilename.js.map +1 -0
  630. package/dist/lib/normalizeMaterializedFilename.test.d.ts +16 -0
  631. package/dist/lib/normalizeMaterializedFilename.test.d.ts.map +1 -0
  632. package/dist/lib/normalizeMaterializedFilename.test.js +90 -0
  633. package/dist/lib/normalizeMaterializedFilename.test.js.map +1 -0
  634. package/dist/lib/onboarding-path-b.d.ts +10 -0
  635. package/dist/lib/onboarding-path-b.d.ts.map +1 -0
  636. package/dist/lib/onboarding-path-b.js +214 -0
  637. package/dist/lib/onboarding-path-b.js.map +1 -0
  638. package/dist/lib/onboarding-phases.d.ts +9 -0
  639. package/dist/lib/onboarding-phases.d.ts.map +1 -0
  640. package/dist/lib/onboarding-phases.js +120 -0
  641. package/dist/lib/onboarding-phases.js.map +1 -0
  642. package/dist/lib/onboarding-shared.d.ts +81 -0
  643. package/dist/lib/onboarding-shared.d.ts.map +1 -0
  644. package/dist/lib/onboarding-shared.js +190 -0
  645. package/dist/lib/onboarding-shared.js.map +1 -0
  646. package/dist/lib/onboarding-topics.d.ts +27 -0
  647. package/dist/lib/onboarding-topics.d.ts.map +1 -0
  648. package/dist/lib/onboarding-topics.js +57 -0
  649. package/dist/lib/onboarding-topics.js.map +1 -0
  650. package/dist/lib/onboarding.d.ts +17 -0
  651. package/dist/lib/onboarding.d.ts.map +1 -0
  652. package/dist/lib/onboarding.js +350 -0
  653. package/dist/lib/onboarding.js.map +1 -0
  654. package/dist/lib/profiles.d.ts +39 -0
  655. package/dist/lib/profiles.d.ts.map +1 -0
  656. package/dist/lib/profiles.js +185 -0
  657. package/dist/lib/profiles.js.map +1 -0
  658. package/dist/lib/prompts.d.ts +65 -0
  659. package/dist/lib/prompts.d.ts.map +1 -0
  660. package/dist/lib/prompts.js +132 -0
  661. package/dist/lib/prompts.js.map +1 -0
  662. package/dist/lib/repo-detect.d.ts +33 -0
  663. package/dist/lib/repo-detect.d.ts.map +1 -0
  664. package/dist/lib/repo-detect.js +83 -0
  665. package/dist/lib/repo-detect.js.map +1 -0
  666. package/dist/lib/runner.d.ts +33 -0
  667. package/dist/lib/runner.d.ts.map +1 -0
  668. package/dist/lib/runner.js +79 -0
  669. package/dist/lib/runner.js.map +1 -0
  670. package/dist/lib/session.d.ts +42 -0
  671. package/dist/lib/session.d.ts.map +1 -0
  672. package/dist/lib/session.js +109 -0
  673. package/dist/lib/session.js.map +1 -0
  674. package/dist/lib/spinner.d.ts +27 -0
  675. package/dist/lib/spinner.d.ts.map +1 -0
  676. package/dist/lib/spinner.js +76 -0
  677. package/dist/lib/spinner.js.map +1 -0
  678. package/dist/lib/spinner.test.d.ts +2 -0
  679. package/dist/lib/spinner.test.d.ts.map +1 -0
  680. package/dist/lib/spinner.test.js +39 -0
  681. package/dist/lib/spinner.test.js.map +1 -0
  682. package/dist/lib/state.d.ts +51 -0
  683. package/dist/lib/state.d.ts.map +1 -0
  684. package/dist/lib/state.js +90 -0
  685. package/dist/lib/state.js.map +1 -0
  686. package/dist/lib/strip.d.ts +12 -0
  687. package/dist/lib/strip.d.ts.map +1 -0
  688. package/dist/lib/strip.js +41 -0
  689. package/dist/lib/strip.js.map +1 -0
  690. package/dist/lib/style.d.ts +96 -0
  691. package/dist/lib/style.d.ts.map +1 -0
  692. package/dist/lib/style.js +169 -0
  693. package/dist/lib/style.js.map +1 -0
  694. package/dist/lib/style.test.d.ts +7 -0
  695. package/dist/lib/style.test.d.ts.map +1 -0
  696. package/dist/lib/style.test.js +263 -0
  697. package/dist/lib/style.test.js.map +1 -0
  698. package/dist/lib/telemetry.d.ts +15 -0
  699. package/dist/lib/telemetry.d.ts.map +1 -0
  700. package/dist/lib/telemetry.js +47 -0
  701. package/dist/lib/telemetry.js.map +1 -0
  702. package/dist/lib/tokenConstants.d.ts +17 -0
  703. package/dist/lib/tokenConstants.d.ts.map +1 -0
  704. package/dist/lib/tokenConstants.js +17 -0
  705. package/dist/lib/tokenConstants.js.map +1 -0
  706. package/dist/lib/update-check.d.ts +21 -0
  707. package/dist/lib/update-check.d.ts.map +1 -0
  708. package/dist/lib/update-check.js +145 -0
  709. package/dist/lib/update-check.js.map +1 -0
  710. package/dist/lib/wizard-surfaces.d.ts +47 -0
  711. package/dist/lib/wizard-surfaces.d.ts.map +1 -0
  712. package/dist/lib/wizard-surfaces.js +176 -0
  713. package/dist/lib/wizard-surfaces.js.map +1 -0
  714. package/dist/lib/wizard-surfaces.test.d.ts +2 -0
  715. package/dist/lib/wizard-surfaces.test.d.ts.map +1 -0
  716. package/dist/lib/wizard-surfaces.test.js +127 -0
  717. package/dist/lib/wizard-surfaces.test.js.map +1 -0
  718. package/dist/lib/wizard-trust.d.ts +31 -0
  719. package/dist/lib/wizard-trust.d.ts.map +1 -0
  720. package/dist/lib/wizard-trust.js +66 -0
  721. package/dist/lib/wizard-trust.js.map +1 -0
  722. package/dist/lib/wizard-trust.test.d.ts +2 -0
  723. package/dist/lib/wizard-trust.test.d.ts.map +1 -0
  724. package/dist/lib/wizard-trust.test.js +32 -0
  725. package/dist/lib/wizard-trust.test.js.map +1 -0
  726. package/dist/lib/workspace-probe.d.ts +19 -0
  727. package/dist/lib/workspace-probe.d.ts.map +1 -0
  728. package/dist/lib/workspace-probe.js +27 -0
  729. package/dist/lib/workspace-probe.js.map +1 -0
  730. package/dist/surfaces/registry.d.ts +20 -0
  731. package/dist/surfaces/registry.d.ts.map +1 -0
  732. package/dist/surfaces/registry.js +42 -0
  733. package/dist/surfaces/registry.js.map +1 -0
  734. package/package.json +15 -5
  735. package/templates/archetypes/boundary.md +23 -0
  736. package/templates/archetypes/constraint.md +23 -0
  737. package/templates/archetypes/convention.md +23 -0
  738. package/templates/archetypes/policy.md +23 -0
  739. package/templates/archetypes/quality-gate.md +23 -0
  740. package/templates/archetypes/workflow.md +23 -0
  741. package/templates/general/code-integrity.md +11 -0
  742. package/templates/general/getting-started.md +12 -0
  743. package/templates/method-registry.json +16 -0
  744. package/templates/node-ts/code-integrity.md +13 -0
  745. package/templates/node-ts/testing.md +12 -0
  746. package/templates/python/code-integrity.md +13 -0
  747. package/templates/python/testing.md +12 -0
@@ -0,0 +1,781 @@
1
+ /**
2
+ * pb method ls / pb method show <name> / pb method diff <name> / pb method publish <name>
3
+ * WP-329 S1-S3: Method visibility CLI + publish.
4
+ *
5
+ * Lists all .productbrain/ skills and rules with per-surface adapter status,
6
+ * shows detailed fork-detection output for a single method, diffs against
7
+ * the Chain, and publishes to the Chain methods collection.
8
+ *
9
+ * Chain: WP-329 (Method Publish + Visibility), DEC-299 (JSON-default output),
10
+ * DEC-598 (local-only monotonic versioning, Option B).
11
+ */
12
+ import { createHash } from 'node:crypto';
13
+ import { existsSync, readdirSync, readFileSync } from 'node:fs';
14
+ import { join, resolve } from 'node:path';
15
+ import { cwd } from 'node:process';
16
+ import { kernelCall, kernelCallWithSession } from '../lib/client.js';
17
+ import { readSession } from '../lib/session.js';
18
+ import { runCliCommand } from '../lib/runner.js';
19
+ import { CLIError, ErrorCode } from '../lib/errors.js';
20
+ // ---------------------------------------------------------------------------
21
+ // Constants
22
+ // ---------------------------------------------------------------------------
23
+ const CODEX_MARKER_PREFIX = '<!-- auto-generated by pb handshake — source: .productbrain/';
24
+ /**
25
+ * Normalize path references in Claude adapter bodies before comparison.
26
+ * pb handshake rewrites .productbrain/rules/ → .claude/rules/ in .claude/ adapters.
27
+ * Reverting here lets us compare body content without false-positive "forked" reports.
28
+ */
29
+ function normalizeClaudeAdapterBody(body) {
30
+ return body.replace(/\.claude\/rules\//g, '.productbrain/rules/');
31
+ }
32
+ /**
33
+ * Normalize path references in Cursor adapter bodies before comparison.
34
+ * pb handshake rewrites .productbrain/rules/ → .cursor/rules/ in .cursor/ adapters.
35
+ */
36
+ function normalizeCursorAdapterBody(body) {
37
+ return body.replace(/\.cursor\/rules\//g, '.productbrain/rules/');
38
+ }
39
+ // ---------------------------------------------------------------------------
40
+ // Filesystem helpers
41
+ // ---------------------------------------------------------------------------
42
+ /** Returns project root (the directory containing .productbrain/). */
43
+ function projectRoot() {
44
+ // Walk up from cwd until we find .productbrain/, or fall back to cwd
45
+ let dir = cwd();
46
+ for (let i = 0; i < 8; i++) {
47
+ if (existsSync(join(dir, '.productbrain')))
48
+ return dir;
49
+ const parent = resolve(dir, '..');
50
+ if (parent === dir)
51
+ break;
52
+ dir = parent;
53
+ }
54
+ return cwd();
55
+ }
56
+ /** Parse YAML-ish frontmatter block from a .md file (simple key: value, supports multi-line values). */
57
+ function parseFrontmatter(content) {
58
+ if (!content.startsWith('---')) {
59
+ return { frontmatter: {}, body: content };
60
+ }
61
+ const end = content.indexOf('\n---', 3);
62
+ if (end === -1) {
63
+ return { frontmatter: {}, body: content };
64
+ }
65
+ const fmBlock = content.slice(4, end); // skip the opening ---\n
66
+ const body = content.slice(end + 4); // skip the closing ---
67
+ const frontmatter = {};
68
+ let i = 0;
69
+ const lines = fmBlock.split('\n');
70
+ while (i < lines.length) {
71
+ const line = lines[i];
72
+ const colonIdx = line.indexOf(':');
73
+ if (colonIdx < 1) {
74
+ i++;
75
+ continue;
76
+ }
77
+ const key = line.slice(0, colonIdx).trim();
78
+ let value = line.slice(colonIdx + 1).trim();
79
+ // Multi-line value: starts with >- or |
80
+ if (value === '>-' || value === '>' || value === '|') {
81
+ const parts = [];
82
+ i++;
83
+ while (i < lines.length && (lines[i].startsWith(' ') || lines[i] === '')) {
84
+ parts.push(lines[i].trim());
85
+ i++;
86
+ }
87
+ frontmatter[key] = parts.join(' ').trim();
88
+ continue;
89
+ }
90
+ // Boolean values
91
+ if (value === 'true') {
92
+ frontmatter[key] = true;
93
+ i++;
94
+ continue;
95
+ }
96
+ if (value === 'false') {
97
+ frontmatter[key] = false;
98
+ i++;
99
+ continue;
100
+ }
101
+ // Strip surrounding quotes
102
+ if ((value.startsWith('"') && value.endsWith('"')) ||
103
+ (value.startsWith("'") && value.endsWith("'"))) {
104
+ value = value.slice(1, -1);
105
+ }
106
+ frontmatter[key] = value;
107
+ i++;
108
+ }
109
+ return { frontmatter, body: body.trimStart() };
110
+ }
111
+ /**
112
+ * Strip frontmatter from adapter files so we can compare body content.
113
+ * Also strip CODEX MARKER comment line if present.
114
+ */
115
+ function extractAdapterBody(content) {
116
+ // Strip frontmatter block if present
117
+ let text = content;
118
+ if (text.startsWith('---')) {
119
+ const end = text.indexOf('\n---', 3);
120
+ if (end !== -1) {
121
+ text = text.slice(end + 4).trimStart();
122
+ }
123
+ }
124
+ // Strip MARKER comment line (first line if it matches)
125
+ const firstNewline = text.indexOf('\n');
126
+ if (firstNewline !== -1) {
127
+ const firstLine = text.slice(0, firstNewline).trim();
128
+ if (firstLine.startsWith('<!--') && firstLine.includes('auto-generated by pb handshake')) {
129
+ text = text.slice(firstNewline + 1).trimStart();
130
+ }
131
+ }
132
+ return text.trim();
133
+ }
134
+ /** Load all methods from .productbrain/skills/ and .productbrain/rules/. */
135
+ function loadAllSources(root) {
136
+ const sources = [];
137
+ const skillsDir = join(root, '.productbrain', 'skills');
138
+ const rulesDir = join(root, '.productbrain', 'rules');
139
+ for (const [dir, type] of [[skillsDir, 'skill'], [rulesDir, 'rule']]) {
140
+ if (!existsSync(dir))
141
+ continue;
142
+ const files = readdirSync(dir).filter((f) => f.endsWith('.md'));
143
+ for (const file of files) {
144
+ const filePath = join(dir, file);
145
+ let content;
146
+ try {
147
+ content = readFileSync(filePath, 'utf8');
148
+ }
149
+ catch {
150
+ continue;
151
+ }
152
+ const { frontmatter, body } = parseFrontmatter(content);
153
+ const stem = file.replace(/\.md$/, '');
154
+ sources.push({
155
+ name: stem,
156
+ type,
157
+ sourcePath: filePath,
158
+ frontmatter,
159
+ body,
160
+ });
161
+ }
162
+ }
163
+ return sources;
164
+ }
165
+ // ---------------------------------------------------------------------------
166
+ // Adapter status detection
167
+ // ---------------------------------------------------------------------------
168
+ function checkClaude(root, source) {
169
+ // Rules have adapters in .claude/rules/; skills do NOT have a direct claude adapter
170
+ if (source.type === 'skill')
171
+ return 'missing';
172
+ const adapterPath = join(root, '.claude', 'rules', `${source.name}.md`);
173
+ if (!existsSync(adapterPath))
174
+ return 'missing';
175
+ let adapterContent;
176
+ try {
177
+ adapterContent = readFileSync(adapterPath, 'utf8');
178
+ }
179
+ catch {
180
+ return 'missing';
181
+ }
182
+ const adapterBody = normalizeClaudeAdapterBody(extractAdapterBody(adapterContent));
183
+ const sourceBody = source.body.trim();
184
+ return adapterBody === sourceBody ? 'ok' : 'forked';
185
+ }
186
+ function checkCursor(root, source) {
187
+ // Rules have adapters in .cursor/rules/<name>.mdc; skills do NOT have cursor adapters
188
+ if (source.type === 'skill')
189
+ return 'missing';
190
+ const adapterPath = join(root, '.cursor', 'rules', `${source.name}.mdc`);
191
+ if (!existsSync(adapterPath))
192
+ return 'missing';
193
+ let adapterContent;
194
+ try {
195
+ adapterContent = readFileSync(adapterPath, 'utf8');
196
+ }
197
+ catch {
198
+ return 'missing';
199
+ }
200
+ const adapterBody = normalizeCursorAdapterBody(extractAdapterBody(adapterContent));
201
+ const sourceBody = source.body.trim();
202
+ return adapterBody === sourceBody ? 'ok' : 'forked';
203
+ }
204
+ function checkCodex(root, source) {
205
+ // Only skills have codex adapters in .codex/skills/
206
+ if (source.type === 'rule')
207
+ return 'missing';
208
+ const adapterPath = join(root, '.codex', 'skills', `${source.name}.md`);
209
+ if (!existsSync(adapterPath))
210
+ return 'missing';
211
+ let adapterContent;
212
+ try {
213
+ adapterContent = readFileSync(adapterPath, 'utf8');
214
+ }
215
+ catch {
216
+ return 'missing';
217
+ }
218
+ // Check MARKER presence
219
+ if (!adapterContent.includes(CODEX_MARKER_PREFIX))
220
+ return 'forked';
221
+ const adapterBody = extractAdapterBody(adapterContent);
222
+ const sourceBody = source.body.trim();
223
+ return adapterBody === sourceBody ? 'ok' : 'forked';
224
+ }
225
+ function checkCopilot(root, source) {
226
+ // Only rules contribute to copilot-instructions.md (skills are not included)
227
+ if (source.type === 'skill')
228
+ return 'missing';
229
+ const copilotPath = join(root, '.github', 'copilot-instructions.md');
230
+ if (!existsSync(copilotPath))
231
+ return 'missing';
232
+ let copilotContent;
233
+ try {
234
+ copilotContent = readFileSync(copilotPath, 'utf8');
235
+ }
236
+ catch {
237
+ return 'missing';
238
+ }
239
+ // copilot-instructions.md stores summaries (### name\ndescription), not full bodies
240
+ return copilotContent.includes(`### ${source.name}`) ? 'ok' : 'forked';
241
+ }
242
+ function checkAdapters(root, source) {
243
+ return {
244
+ claude: checkClaude(root, source),
245
+ cursor: checkCursor(root, source),
246
+ codex: checkCodex(root, source),
247
+ copilot: checkCopilot(root, source),
248
+ };
249
+ }
250
+ // ---------------------------------------------------------------------------
251
+ // Chain query helper
252
+ // ---------------------------------------------------------------------------
253
+ /** Attempt to fetch published Chain entry for a method by name. Returns null on failure. */
254
+ async function fetchChainMethod(name) {
255
+ try {
256
+ const results = await kernelCall('chain.searchEntries', { query: name, collectionSlug: 'methods' });
257
+ if (!Array.isArray(results))
258
+ return null;
259
+ // Find exact name match in results
260
+ const match = results.find((r) => {
261
+ const entryName = (r.data?.name ?? r.name);
262
+ return entryName === name;
263
+ });
264
+ if (!match)
265
+ return null;
266
+ const data = match.data ?? {};
267
+ const fmRaw = data.frontmatter;
268
+ let frontmatter;
269
+ if (fmRaw) {
270
+ try {
271
+ frontmatter = JSON.parse(fmRaw);
272
+ }
273
+ catch { /* ignore */ }
274
+ }
275
+ return {
276
+ _id: match._id,
277
+ version: data.version != null ? String(data.version) : undefined,
278
+ publishedAt: data.publishedAt,
279
+ publishedBy: data.publishedBy,
280
+ manifestHash: data.manifestHash,
281
+ body: data.body,
282
+ frontmatter,
283
+ };
284
+ }
285
+ catch {
286
+ // Chain unreachable or collection doesn't exist yet — not fatal
287
+ return null;
288
+ }
289
+ }
290
+ // ---------------------------------------------------------------------------
291
+ // Diff helpers
292
+ // ---------------------------------------------------------------------------
293
+ /**
294
+ * Produce a minimal unified diff between two texts.
295
+ * Returns an array of diff lines (context lines prefixed with space,
296
+ * removals prefixed with -, additions prefixed with +).
297
+ * Context window: 3 lines around each change.
298
+ */
299
+ function computeUnifiedDiff(oldText, newText, context = 3) {
300
+ const oldLines = oldText.split('\n');
301
+ const newLines = newText.split('\n');
302
+ // Myers-style LCS — compute edit script via DP table
303
+ const m = oldLines.length;
304
+ const n = newLines.length;
305
+ // dp[i][j] = length of LCS for oldLines[0..i-1] and newLines[0..j-1]
306
+ const dp = Array.from({ length: m + 1 }, () => new Array(n + 1).fill(0));
307
+ for (let i = 1; i <= m; i++) {
308
+ for (let j = 1; j <= n; j++) {
309
+ if (oldLines[i - 1] === newLines[j - 1]) {
310
+ dp[i][j] = dp[i - 1][j - 1] + 1;
311
+ }
312
+ else {
313
+ dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
314
+ }
315
+ }
316
+ }
317
+ const edits = [];
318
+ let i = m;
319
+ let j = n;
320
+ while (i > 0 || j > 0) {
321
+ if (i > 0 && j > 0 && oldLines[i - 1] === newLines[j - 1]) {
322
+ edits.unshift({ op: ' ', line: oldLines[i - 1], oldIdx: i - 1, newIdx: j - 1 });
323
+ i--;
324
+ j--;
325
+ }
326
+ else if (j > 0 && (i === 0 || dp[i][j - 1] >= dp[i - 1][j])) {
327
+ edits.unshift({ op: '+', line: newLines[j - 1], newIdx: j - 1 });
328
+ j--;
329
+ }
330
+ else {
331
+ edits.unshift({ op: '-', line: oldLines[i - 1], oldIdx: i - 1 });
332
+ i--;
333
+ }
334
+ }
335
+ if (edits.length === 0)
336
+ return [];
337
+ // Find indices of changed lines
338
+ const changedAt = new Set();
339
+ for (let k = 0; k < edits.length; k++) {
340
+ if (edits[k].op !== ' ')
341
+ changedAt.add(k);
342
+ }
343
+ if (changedAt.size === 0)
344
+ return []; // identical
345
+ // Build context windows — include context lines around changes
346
+ const included = new Set();
347
+ for (const idx of changedAt) {
348
+ for (let d = -context; d <= context; d++) {
349
+ const pos = idx + d;
350
+ if (pos >= 0 && pos < edits.length)
351
+ included.add(pos);
352
+ }
353
+ }
354
+ const output = [];
355
+ let prevIncluded = false;
356
+ for (let k = 0; k < edits.length; k++) {
357
+ if (included.has(k)) {
358
+ if (!prevIncluded && k > 0) {
359
+ output.push('...');
360
+ }
361
+ output.push(`${edits[k].op}${edits[k].line}`);
362
+ prevIncluded = true;
363
+ }
364
+ else {
365
+ prevIncluded = false;
366
+ }
367
+ }
368
+ return output;
369
+ }
370
+ /** Count hook-related diff lines in the edit script (lines with changes touching hooks). */
371
+ function countHookChanges(diffLines, localAlwaysApply, chainAlwaysApply) {
372
+ const HOOK_KEYWORDS = /hook|settings\.json|alwaysApply/i;
373
+ let count = 0;
374
+ for (const line of diffLines) {
375
+ if ((line.startsWith('+') || line.startsWith('-')) && HOOK_KEYWORDS.test(line)) {
376
+ count++;
377
+ }
378
+ }
379
+ // If alwaysApply changed between local and chain, count that as at least 1
380
+ if (count === 0 && localAlwaysApply !== chainAlwaysApply) {
381
+ count = 1;
382
+ }
383
+ return count;
384
+ }
385
+ // ---------------------------------------------------------------------------
386
+ // pb method ls
387
+ // ---------------------------------------------------------------------------
388
+ export async function runMethodList() {
389
+ await runCliCommand({
390
+ fn: async () => {
391
+ const root = projectRoot();
392
+ const sources = loadAllSources(root);
393
+ if (sources.length === 0) {
394
+ return { methods: [], total: 0 };
395
+ }
396
+ // Sort: rules first (alpha), then skills (alpha)
397
+ sources.sort((a, b) => {
398
+ if (a.type !== b.type)
399
+ return a.type === 'rule' ? -1 : 1;
400
+ return a.name.localeCompare(b.name);
401
+ });
402
+ // Batch Chain lookups in parallel (best-effort)
403
+ const chainResults = await Promise.allSettled(sources.map((s) => fetchChainMethod(s.name)));
404
+ const methods = sources.map((source, i) => {
405
+ const chainEntry = chainResults[i].status === 'fulfilled' ? chainResults[i].value : null;
406
+ const adapters = checkAdapters(root, source);
407
+ return {
408
+ name: source.name,
409
+ type: source.type,
410
+ version: chainEntry?.version != null ? String(chainEntry.version) : '-',
411
+ published: chainEntry !== null,
412
+ claude: adapters.claude === 'ok',
413
+ cursor: adapters.cursor === 'ok',
414
+ codex: adapters.codex === 'ok',
415
+ };
416
+ });
417
+ return { methods, total: methods.length };
418
+ },
419
+ formatPretty: (result) => formatMethodList(result),
420
+ });
421
+ }
422
+ // ---------------------------------------------------------------------------
423
+ // pb method show <name>
424
+ // ---------------------------------------------------------------------------
425
+ export async function runMethodShow(options) {
426
+ await runCliCommand({
427
+ fn: async () => {
428
+ const root = projectRoot();
429
+ const sources = loadAllSources(root);
430
+ const source = sources.find((s) => s.name === options.name);
431
+ if (!source) {
432
+ throw new CLIError(`Method '${options.name}' not found in .productbrain/skills/ or .productbrain/rules/.`, {
433
+ code: ErrorCode.VALIDATION_FAILED,
434
+ category: 'validation',
435
+ guidance: `Run 'pb method ls' to see available methods.`,
436
+ });
437
+ }
438
+ const [chainEntry, adapters] = await Promise.all([
439
+ fetchChainMethod(source.name),
440
+ Promise.resolve(checkAdapters(root, source)),
441
+ ]);
442
+ return {
443
+ name: source.name,
444
+ type: source.type,
445
+ frontmatter: source.frontmatter,
446
+ chain: chainEntry,
447
+ adapters,
448
+ };
449
+ },
450
+ formatPretty: (result) => formatMethodDetail(result),
451
+ });
452
+ }
453
+ // ---------------------------------------------------------------------------
454
+ // pb method diff <name>
455
+ // ---------------------------------------------------------------------------
456
+ export async function runMethodDiff(options) {
457
+ await runCliCommand({
458
+ fn: async () => {
459
+ const root = projectRoot();
460
+ const sources = loadAllSources(root);
461
+ const source = sources.find((s) => s.name === options.name);
462
+ if (!source) {
463
+ throw new CLIError(`Method '${options.name}' not found in .productbrain/skills/ or .productbrain/rules/.`, {
464
+ code: ErrorCode.VALIDATION_FAILED,
465
+ category: 'validation',
466
+ guidance: `Run 'pb method ls' to see available methods.`,
467
+ });
468
+ }
469
+ const chainEntry = await fetchChainMethod(source.name);
470
+ if (!chainEntry || chainEntry.body === undefined) {
471
+ return {
472
+ name: source.name,
473
+ published: false,
474
+ };
475
+ }
476
+ const localBody = source.body.trim();
477
+ const chainBody = (chainEntry.body ?? '').trim();
478
+ const diffLines = computeUnifiedDiff(chainBody, localBody);
479
+ // Detect hook-related changes — read alwaysApply from stored frontmatter JSON
480
+ const chainAlwaysApply = chainEntry.frontmatter?.alwaysApply;
481
+ const hookChanges = countHookChanges(diffLines, source.frontmatter.alwaysApply, chainAlwaysApply);
482
+ const hasFanOut = hookChanges > 0;
483
+ return {
484
+ name: source.name,
485
+ published: true,
486
+ diffLines,
487
+ hookChanges,
488
+ hasFanOut,
489
+ };
490
+ },
491
+ formatPretty: (result) => formatMethodDiff(result),
492
+ });
493
+ }
494
+ // ---------------------------------------------------------------------------
495
+ // pb method publish <name>
496
+ // ---------------------------------------------------------------------------
497
+ export async function runMethodPublish(options) {
498
+ await runCliCommand({
499
+ fn: async () => {
500
+ // 1. Require active session — publish is a write operation (DEC-9, BR-8)
501
+ const session = readSession();
502
+ if (!session) {
503
+ throw new CLIError('No active session.', {
504
+ code: ErrorCode.SESSION_REQUIRED,
505
+ category: 'session',
506
+ guidance: 'Run `pb session start` first. Write access requires a tracked session (DEC-9).',
507
+ });
508
+ }
509
+ // 2. Find local source file
510
+ const root = projectRoot();
511
+ const sources = loadAllSources(root);
512
+ const source = sources.find((s) => s.name === options.name);
513
+ if (!source) {
514
+ throw new CLIError(`Method '${options.name}' not found in .productbrain/skills/ or .productbrain/rules/.`, {
515
+ code: ErrorCode.VALIDATION_FAILED,
516
+ category: 'validation',
517
+ guidance: `Run 'pb method ls' to see available methods.`,
518
+ });
519
+ }
520
+ // 3. Compute SHA-256 hash of the local body (everything after frontmatter)
521
+ const localBody = source.body.trim();
522
+ const manifestHash = createHash('sha256').update(localBody, 'utf8').digest('hex');
523
+ // 4. Query Chain for existing published entry
524
+ const existing = await fetchChainMethod(source.name);
525
+ // 5. D4 check — refuse on no-op (unless --force)
526
+ if (!options.force && existing && existing.manifestHash === manifestHash) {
527
+ const existingVersion = typeof existing.version === 'string'
528
+ ? parseInt(existing.version, 10)
529
+ : existing.version ?? 1;
530
+ throw new CLIError(`No changes to publish. Local body matches last-published version (v${existingVersion}). Use --force to override.`, {
531
+ code: ErrorCode.VALIDATION_FAILED,
532
+ category: 'validation',
533
+ guidance: `Run 'pb method diff ${options.name}' to inspect differences.`,
534
+ });
535
+ }
536
+ // 6. Compute new version
537
+ const existingVersion = existing
538
+ ? (typeof existing.version === 'string'
539
+ ? parseInt(existing.version, 10)
540
+ : existing.version ?? 0)
541
+ : 0;
542
+ const newVersion = existingVersion + 1;
543
+ // 7. Serialize frontmatter for storage
544
+ const fm = source.frontmatter;
545
+ const frontmatterJson = JSON.stringify({
546
+ alwaysApply: fm.alwaysApply,
547
+ globs: fm.globs,
548
+ description: fm.description,
549
+ });
550
+ const publishedAt = new Date().toISOString();
551
+ const publishedBy = session.sessionId;
552
+ const entryData = {
553
+ name: source.name,
554
+ version: String(newVersion),
555
+ sourceType: source.type,
556
+ body: localBody,
557
+ frontmatter: frontmatterJson,
558
+ publishedAt,
559
+ publishedBy,
560
+ manifestHash,
561
+ };
562
+ // 8. Write to Chain — create or update
563
+ let created;
564
+ if (!existing || !existing._id) {
565
+ // No existing entry — createEntry
566
+ await kernelCallWithSession('chain.createEntry', {
567
+ collectionSlug: 'methods',
568
+ name: source.name,
569
+ status: 'active',
570
+ data: entryData,
571
+ sessionId: session.sessionId,
572
+ createdBy: `agent:${session.sessionId}`,
573
+ });
574
+ created = true;
575
+ }
576
+ else {
577
+ // Existing entry — updateEntry (LWW: last-write-wins)
578
+ await kernelCallWithSession('chain.updateEntry', {
579
+ entryId: existing._id,
580
+ data: entryData,
581
+ changedBy: `agent:${session.sessionId}`,
582
+ changeNote: `Publish v${newVersion} via pb method publish`,
583
+ });
584
+ created = false;
585
+ }
586
+ return {
587
+ name: source.name,
588
+ version: newVersion,
589
+ manifestHash,
590
+ created,
591
+ previousVersion: newVersion > 1 ? existingVersion : undefined,
592
+ };
593
+ },
594
+ formatPretty: (result) => formatMethodPublish(result),
595
+ });
596
+ }
597
+ // ---------------------------------------------------------------------------
598
+ // Formatters
599
+ // ---------------------------------------------------------------------------
600
+ function statusIcon(published) {
601
+ return published ? 'yes' : 'no ';
602
+ }
603
+ function adapterIcon(ok) {
604
+ return ok ? '\u2713' : '-';
605
+ }
606
+ function adapterStatusLabel(status) {
607
+ if (status === 'ok')
608
+ return 'ok';
609
+ if (status === 'forked')
610
+ return 'forked';
611
+ return 'missing';
612
+ }
613
+ function formatMethodList(result) {
614
+ if (result.total === 0) {
615
+ return 'No methods found. Expected .productbrain/skills/ and .productbrain/rules/ directories.';
616
+ }
617
+ const lines = [];
618
+ lines.push(`Methods (${result.total}):`);
619
+ lines.push('');
620
+ const maxName = Math.max(...result.methods.map((m) => m.name.length), 4);
621
+ const maxVersion = Math.max(...result.methods.map((m) => m.version.length), 7);
622
+ const header = [
623
+ 'Name'.padEnd(maxName),
624
+ 'Type '.padEnd(6),
625
+ 'Version'.padEnd(maxVersion),
626
+ 'Published',
627
+ 'Claude',
628
+ 'Cursor',
629
+ 'Codex',
630
+ ].join(' ');
631
+ lines.push(` ${header}`);
632
+ lines.push(` ${'-'.repeat(header.length)}`);
633
+ // Group by type
634
+ const rules = result.methods.filter((m) => m.type === 'rule');
635
+ const skills = result.methods.filter((m) => m.type === 'skill');
636
+ const renderRow = (m) => {
637
+ return ' ' + [
638
+ m.name.padEnd(maxName),
639
+ m.type.padEnd(6),
640
+ m.version.padEnd(maxVersion),
641
+ statusIcon(m.published).padEnd(10),
642
+ adapterIcon(m.claude).padEnd(7),
643
+ adapterIcon(m.cursor).padEnd(7),
644
+ adapterIcon(m.codex),
645
+ ].join(' ');
646
+ };
647
+ if (rules.length > 0) {
648
+ lines.push('');
649
+ lines.push(' Rules:');
650
+ for (const m of rules) {
651
+ lines.push(renderRow(m));
652
+ }
653
+ }
654
+ if (skills.length > 0) {
655
+ lines.push('');
656
+ lines.push(' Skills:');
657
+ for (const m of skills) {
658
+ lines.push(renderRow(m));
659
+ }
660
+ }
661
+ lines.push('');
662
+ lines.push(` ${rules.length} rules, ${skills.length} skills`);
663
+ lines.push(' Run `pb method show <name>` for fork status and Chain details.');
664
+ return lines.join('\n');
665
+ }
666
+ function formatMethodDetail(result) {
667
+ const lines = [];
668
+ const { name, type, frontmatter, chain, adapters } = result;
669
+ lines.push('');
670
+ lines.push(`Method: ${name}`);
671
+ lines.push(`Type: ${type}`);
672
+ if (frontmatter.description) {
673
+ lines.push(`Desc: ${frontmatter.description}`);
674
+ }
675
+ if (frontmatter.alwaysApply !== undefined) {
676
+ lines.push(`Always: ${frontmatter.alwaysApply}`);
677
+ }
678
+ if (frontmatter.globs) {
679
+ lines.push(`Globs: ${frontmatter.globs}`);
680
+ }
681
+ if (frontmatter.level) {
682
+ lines.push(`Level: ${frontmatter.level}`);
683
+ }
684
+ lines.push('');
685
+ if (chain) {
686
+ lines.push('Published:');
687
+ if (chain.version)
688
+ lines.push(` Version: ${chain.version}`);
689
+ if (chain.publishedAt)
690
+ lines.push(` Published: ${chain.publishedAt}`);
691
+ if (chain.publishedBy)
692
+ lines.push(` By: ${chain.publishedBy}`);
693
+ if (chain.manifestHash)
694
+ lines.push(` Hash: ${chain.manifestHash}`);
695
+ }
696
+ else {
697
+ lines.push('Published: no (not in Chain methods collection)');
698
+ }
699
+ lines.push('');
700
+ lines.push('Adapter status:');
701
+ lines.push(` claude: ${adapterStatusLabel(adapters.claude)}`);
702
+ lines.push(` cursor: ${adapterStatusLabel(adapters.cursor)}`);
703
+ lines.push(` codex: ${adapterStatusLabel(adapters.codex)}`);
704
+ lines.push(` copilot: ${adapterStatusLabel(adapters.copilot)}`);
705
+ const forked = Object.entries(adapters).filter(([, v]) => v === 'forked').map(([k]) => k);
706
+ const missing = Object.entries(adapters).filter(([, v]) => v === 'missing').map(([k]) => k);
707
+ if (forked.length > 0 || missing.length > 0) {
708
+ lines.push('');
709
+ if (forked.length > 0) {
710
+ lines.push(` ! Forked adapters (out of sync): ${forked.join(', ')}`);
711
+ lines.push(' Run `pb handshake` to regenerate adapter files.');
712
+ }
713
+ if (missing.length > 0) {
714
+ lines.push(` - Missing adapters: ${missing.join(', ')}`);
715
+ lines.push(' Run `pb handshake` to generate adapter files.');
716
+ }
717
+ }
718
+ else {
719
+ lines.push('');
720
+ lines.push(' All adapters in sync.');
721
+ }
722
+ return lines.join('\n');
723
+ }
724
+ function formatMethodPublish(result) {
725
+ const lines = [];
726
+ lines.push('');
727
+ lines.push(`Published: ${result.name} v${result.version}`);
728
+ lines.push(`Action: ${result.created ? 'created' : 'updated'}`);
729
+ lines.push(`Hash: ${result.manifestHash.slice(0, 16)}...`);
730
+ if (result.previousVersion !== undefined) {
731
+ lines.push('');
732
+ lines.push(`rollback with: pb method publish ${result.name} --version ${result.previousVersion}`);
733
+ }
734
+ lines.push('');
735
+ return lines.join('\n');
736
+ }
737
+ function formatMethodDiff(result) {
738
+ const lines = [];
739
+ if (!result.published) {
740
+ lines.push('');
741
+ lines.push(`Not published yet. Run \`pb method publish ${result.name}\` to publish.`);
742
+ lines.push('');
743
+ return lines.join('\n');
744
+ }
745
+ const diffLines = result.diffLines ?? [];
746
+ if (diffLines.length === 0) {
747
+ lines.push('');
748
+ lines.push(`Method: ${result.name}`);
749
+ lines.push('');
750
+ lines.push(' No changes. Local matches published version.');
751
+ lines.push('');
752
+ return lines.join('\n');
753
+ }
754
+ lines.push('');
755
+ lines.push(`Method: ${result.name}`);
756
+ lines.push('--- chain (published)');
757
+ lines.push('+++ local');
758
+ lines.push('');
759
+ for (const dl of diffLines) {
760
+ if (dl === '...') {
761
+ lines.push(' ...');
762
+ }
763
+ else if (dl.startsWith('+')) {
764
+ lines.push(`+ ${dl.slice(1)}`);
765
+ }
766
+ else if (dl.startsWith('-')) {
767
+ lines.push(`- ${dl.slice(1)}`);
768
+ }
769
+ else {
770
+ lines.push(` ${dl.slice(1)}`);
771
+ }
772
+ }
773
+ if (result.hasFanOut) {
774
+ const n = result.hookChanges ?? 0;
775
+ lines.push('');
776
+ lines.push(`hooks: +${n} (claude-native, +fan-out to cursor,copilot via .claude/settings.json per INS-740)`);
777
+ }
778
+ lines.push('');
779
+ return lines.join('\n');
780
+ }
781
+ //# sourceMappingURL=method.js.map