@productbrain/cli 0.1.0-beta.9 → 0.1.0-beta.91

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 (643) hide show
  1. package/README.md +77 -92
  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__/batch-transformations.test.d.ts +2 -0
  11. package/dist/__tests__/batch-transformations.test.d.ts.map +1 -0
  12. package/dist/__tests__/batch-transformations.test.js +263 -0
  13. package/dist/__tests__/batch-transformations.test.js.map +1 -0
  14. package/dist/__tests__/capture.test.js +309 -18
  15. package/dist/__tests__/capture.test.js.map +1 -1
  16. package/dist/__tests__/config.test.d.ts +8 -0
  17. package/dist/__tests__/config.test.d.ts.map +1 -0
  18. package/dist/__tests__/config.test.js +166 -0
  19. package/dist/__tests__/config.test.js.map +1 -0
  20. package/dist/__tests__/constants.test.d.ts +2 -0
  21. package/dist/__tests__/constants.test.d.ts.map +1 -0
  22. package/dist/__tests__/constants.test.js +141 -0
  23. package/dist/__tests__/constants.test.js.map +1 -0
  24. package/dist/__tests__/constellation.test.js +20 -26
  25. package/dist/__tests__/constellation.test.js.map +1 -1
  26. package/dist/__tests__/context-strategy.test.d.ts +2 -0
  27. package/dist/__tests__/context-strategy.test.d.ts.map +1 -0
  28. package/dist/__tests__/context-strategy.test.js +79 -0
  29. package/dist/__tests__/context-strategy.test.js.map +1 -0
  30. package/dist/__tests__/errors.test.d.ts +2 -0
  31. package/dist/__tests__/errors.test.d.ts.map +1 -0
  32. package/dist/__tests__/errors.test.js +117 -0
  33. package/dist/__tests__/errors.test.js.map +1 -0
  34. package/dist/__tests__/experiment.test.d.ts +6 -0
  35. package/dist/__tests__/experiment.test.d.ts.map +1 -0
  36. package/dist/__tests__/experiment.test.js +69 -0
  37. package/dist/__tests__/experiment.test.js.map +1 -0
  38. package/dist/__tests__/fields.test.js +68 -68
  39. package/dist/__tests__/fields.test.js.map +1 -1
  40. package/dist/__tests__/glossary.test.d.ts +2 -0
  41. package/dist/__tests__/glossary.test.d.ts.map +1 -0
  42. package/dist/__tests__/glossary.test.js +32 -0
  43. package/dist/__tests__/glossary.test.js.map +1 -0
  44. package/dist/__tests__/handshake-preview.test.d.ts +2 -0
  45. package/dist/__tests__/handshake-preview.test.d.ts.map +1 -0
  46. package/dist/__tests__/handshake-preview.test.js +156 -0
  47. package/dist/__tests__/handshake-preview.test.js.map +1 -0
  48. package/dist/__tests__/handshake.test.js +27 -18
  49. package/dist/__tests__/handshake.test.js.map +1 -1
  50. package/dist/__tests__/hook-intents.test.d.ts +2 -0
  51. package/dist/__tests__/hook-intents.test.d.ts.map +1 -0
  52. package/dist/__tests__/hook-intents.test.js +184 -0
  53. package/dist/__tests__/hook-intents.test.js.map +1 -0
  54. package/dist/__tests__/ingest.test.js +110 -12
  55. package/dist/__tests__/ingest.test.js.map +1 -1
  56. package/dist/__tests__/init.test.d.ts +7 -0
  57. package/dist/__tests__/init.test.d.ts.map +1 -0
  58. package/dist/__tests__/init.test.js +146 -0
  59. package/dist/__tests__/init.test.js.map +1 -0
  60. package/dist/__tests__/login.test.d.ts +2 -0
  61. package/dist/__tests__/login.test.d.ts.map +1 -0
  62. package/dist/__tests__/login.test.js +167 -0
  63. package/dist/__tests__/login.test.js.map +1 -0
  64. package/dist/__tests__/manifest.test.d.ts +6 -0
  65. package/dist/__tests__/manifest.test.d.ts.map +1 -0
  66. package/dist/__tests__/manifest.test.js +138 -0
  67. package/dist/__tests__/manifest.test.js.map +1 -0
  68. package/dist/__tests__/method-registry.integration.test.d.ts +6 -0
  69. package/dist/__tests__/method-registry.integration.test.d.ts.map +1 -0
  70. package/dist/__tests__/method-registry.integration.test.js +18 -0
  71. package/dist/__tests__/method-registry.integration.test.js.map +1 -0
  72. package/dist/__tests__/method-registry.test.d.ts +14 -0
  73. package/dist/__tests__/method-registry.test.d.ts.map +1 -0
  74. package/dist/__tests__/method-registry.test.js +134 -0
  75. package/dist/__tests__/method-registry.test.js.map +1 -0
  76. package/dist/__tests__/onboarding-path-b.test.d.ts +2 -0
  77. package/dist/__tests__/onboarding-path-b.test.d.ts.map +1 -0
  78. package/dist/__tests__/onboarding-path-b.test.js +46 -0
  79. package/dist/__tests__/onboarding-path-b.test.js.map +1 -0
  80. package/dist/__tests__/onboarding.test.d.ts +6 -0
  81. package/dist/__tests__/onboarding.test.d.ts.map +1 -0
  82. package/dist/__tests__/onboarding.test.js +347 -0
  83. package/dist/__tests__/onboarding.test.js.map +1 -0
  84. package/dist/__tests__/orient.test.d.ts +2 -0
  85. package/dist/__tests__/orient.test.d.ts.map +1 -0
  86. package/dist/__tests__/orient.test.js +143 -0
  87. package/dist/__tests__/orient.test.js.map +1 -0
  88. package/dist/__tests__/personal-layer.test.d.ts +12 -0
  89. package/dist/__tests__/personal-layer.test.d.ts.map +1 -0
  90. package/dist/__tests__/personal-layer.test.js +304 -0
  91. package/dist/__tests__/personal-layer.test.js.map +1 -0
  92. package/dist/__tests__/profiles.test.d.ts +2 -0
  93. package/dist/__tests__/profiles.test.d.ts.map +1 -0
  94. package/dist/__tests__/profiles.test.js +168 -0
  95. package/dist/__tests__/profiles.test.js.map +1 -0
  96. package/dist/__tests__/promote.test.d.ts +2 -0
  97. package/dist/__tests__/promote.test.d.ts.map +1 -0
  98. package/dist/__tests__/promote.test.js +161 -0
  99. package/dist/__tests__/promote.test.js.map +1 -0
  100. package/dist/__tests__/prompts.test.d.ts +6 -0
  101. package/dist/__tests__/prompts.test.d.ts.map +1 -0
  102. package/dist/__tests__/prompts.test.js +146 -0
  103. package/dist/__tests__/prompts.test.js.map +1 -0
  104. package/dist/__tests__/proposals.test.d.ts +2 -0
  105. package/dist/__tests__/proposals.test.d.ts.map +1 -0
  106. package/dist/__tests__/proposals.test.js +167 -0
  107. package/dist/__tests__/proposals.test.js.map +1 -0
  108. package/dist/__tests__/relate.test.js +57 -33
  109. package/dist/__tests__/relate.test.js.map +1 -1
  110. package/dist/__tests__/repo-detect.test.js +97 -1
  111. package/dist/__tests__/repo-detect.test.js.map +1 -1
  112. package/dist/__tests__/runner.test.js +19 -15
  113. package/dist/__tests__/runner.test.js.map +1 -1
  114. package/dist/__tests__/session-state-machine.test.d.ts +2 -0
  115. package/dist/__tests__/session-state-machine.test.d.ts.map +1 -0
  116. package/dist/__tests__/session-state-machine.test.js +154 -0
  117. package/dist/__tests__/session-state-machine.test.js.map +1 -0
  118. package/dist/__tests__/session-touch.test.js +11 -11
  119. package/dist/__tests__/session-touch.test.js.map +1 -1
  120. package/dist/__tests__/session.test.js +4 -10
  121. package/dist/__tests__/session.test.js.map +1 -1
  122. package/dist/__tests__/setup.test.d.ts +2 -0
  123. package/dist/__tests__/setup.test.d.ts.map +1 -0
  124. package/dist/__tests__/setup.test.js +141 -0
  125. package/dist/__tests__/setup.test.js.map +1 -0
  126. package/dist/__tests__/spinner-labels.test.d.ts +2 -0
  127. package/dist/__tests__/spinner-labels.test.d.ts.map +1 -0
  128. package/dist/__tests__/spinner-labels.test.js +23 -0
  129. package/dist/__tests__/spinner-labels.test.js.map +1 -0
  130. package/dist/__tests__/state.test.d.ts +6 -0
  131. package/dist/__tests__/state.test.d.ts.map +1 -0
  132. package/dist/__tests__/state.test.js +97 -0
  133. package/dist/__tests__/state.test.js.map +1 -0
  134. package/dist/__tests__/strip.test.js +2 -2
  135. package/dist/__tests__/strip.test.js.map +1 -1
  136. package/dist/__tests__/surface-profiles.test.d.ts +2 -0
  137. package/dist/__tests__/surface-profiles.test.d.ts.map +1 -0
  138. package/dist/__tests__/surface-profiles.test.js +233 -0
  139. package/dist/__tests__/surface-profiles.test.js.map +1 -0
  140. package/dist/__tests__/surfaces.test.d.ts +2 -0
  141. package/dist/__tests__/surfaces.test.d.ts.map +1 -0
  142. package/dist/__tests__/surfaces.test.js +46 -0
  143. package/dist/__tests__/surfaces.test.js.map +1 -0
  144. package/dist/__tests__/update.test.js +123 -43
  145. package/dist/__tests__/update.test.js.map +1 -1
  146. package/dist/__tests__/workspace.test.d.ts +2 -0
  147. package/dist/__tests__/workspace.test.d.ts.map +1 -0
  148. package/dist/__tests__/workspace.test.js +308 -0
  149. package/dist/__tests__/workspace.test.js.map +1 -0
  150. package/dist/commands/accept.d.ts +18 -0
  151. package/dist/commands/accept.d.ts.map +1 -0
  152. package/dist/commands/accept.js +76 -0
  153. package/dist/commands/accept.js.map +1 -0
  154. package/dist/commands/admin/cockpit.d.ts +90 -0
  155. package/dist/commands/admin/cockpit.d.ts.map +1 -0
  156. package/dist/commands/admin/cockpit.js +618 -0
  157. package/dist/commands/admin/cockpit.js.map +1 -0
  158. package/dist/commands/admin/index.d.ts +21 -0
  159. package/dist/commands/admin/index.d.ts.map +1 -0
  160. package/dist/commands/admin/index.js +256 -0
  161. package/dist/commands/admin/index.js.map +1 -0
  162. package/dist/commands/admin/inspect.d.ts +30 -0
  163. package/dist/commands/admin/inspect.d.ts.map +1 -0
  164. package/dist/commands/admin/inspect.js +555 -0
  165. package/dist/commands/admin/inspect.js.map +1 -0
  166. package/dist/commands/admin/inspect.test.d.ts +7 -0
  167. package/dist/commands/admin/inspect.test.d.ts.map +1 -0
  168. package/dist/commands/admin/inspect.test.js +90 -0
  169. package/dist/commands/admin/inspect.test.js.map +1 -0
  170. package/dist/commands/admin/manage.d.ts +8 -0
  171. package/dist/commands/admin/manage.d.ts.map +1 -0
  172. package/dist/commands/admin/manage.js +76 -0
  173. package/dist/commands/admin/manage.js.map +1 -0
  174. package/dist/commands/admin/seed.d.ts +32 -0
  175. package/dist/commands/admin/seed.d.ts.map +1 -0
  176. package/dist/commands/admin/seed.js +533 -0
  177. package/dist/commands/admin/seed.js.map +1 -0
  178. package/dist/commands/admin/seed.test.d.ts +6 -0
  179. package/dist/commands/admin/seed.test.d.ts.map +1 -0
  180. package/dist/commands/admin/seed.test.js +65 -0
  181. package/dist/commands/admin/seed.test.js.map +1 -0
  182. package/dist/commands/audit.d.ts +25 -0
  183. package/dist/commands/audit.d.ts.map +1 -0
  184. package/dist/commands/audit.js +188 -0
  185. package/dist/commands/audit.js.map +1 -0
  186. package/dist/commands/brand-pack.d.ts +2 -0
  187. package/dist/commands/brand-pack.d.ts.map +1 -0
  188. package/dist/commands/brand-pack.js +25 -0
  189. package/dist/commands/brand-pack.js.map +1 -0
  190. package/dist/commands/brief.d.ts +28 -0
  191. package/dist/commands/brief.d.ts.map +1 -0
  192. package/dist/commands/brief.js +75 -0
  193. package/dist/commands/brief.js.map +1 -0
  194. package/dist/commands/capture.d.ts +9 -0
  195. package/dist/commands/capture.d.ts.map +1 -1
  196. package/dist/commands/capture.js +256 -17
  197. package/dist/commands/capture.js.map +1 -1
  198. package/dist/commands/chain-walk.d.ts +14 -0
  199. package/dist/commands/chain-walk.d.ts.map +1 -0
  200. package/dist/commands/chain-walk.js +38 -0
  201. package/dist/commands/chain-walk.js.map +1 -0
  202. package/dist/commands/changes.d.ts +11 -0
  203. package/dist/commands/changes.d.ts.map +1 -0
  204. package/dist/commands/changes.js +46 -0
  205. package/dist/commands/changes.js.map +1 -0
  206. package/dist/commands/codex-prep.d.ts +12 -0
  207. package/dist/commands/codex-prep.d.ts.map +1 -0
  208. package/dist/commands/codex-prep.js +122 -0
  209. package/dist/commands/codex-prep.js.map +1 -0
  210. package/dist/commands/collections.d.ts +22 -0
  211. package/dist/commands/collections.d.ts.map +1 -0
  212. package/dist/commands/collections.js +77 -0
  213. package/dist/commands/collections.js.map +1 -0
  214. package/dist/commands/connect-integration.test.d.ts +7 -0
  215. package/dist/commands/connect-integration.test.d.ts.map +1 -0
  216. package/dist/commands/connect-integration.test.js +195 -0
  217. package/dist/commands/connect-integration.test.js.map +1 -0
  218. package/dist/commands/connect-screens.d.ts +21 -0
  219. package/dist/commands/connect-screens.d.ts.map +1 -0
  220. package/dist/commands/connect-screens.js +79 -0
  221. package/dist/commands/connect-screens.js.map +1 -0
  222. package/dist/commands/connect.d.ts +21 -0
  223. package/dist/commands/connect.d.ts.map +1 -0
  224. package/dist/commands/connect.js +237 -0
  225. package/dist/commands/connect.js.map +1 -0
  226. package/dist/commands/connect.test.d.ts +6 -0
  227. package/dist/commands/connect.test.d.ts.map +1 -0
  228. package/dist/commands/connect.test.js +234 -0
  229. package/dist/commands/connect.test.js.map +1 -0
  230. package/dist/commands/constellation.d.ts.map +1 -1
  231. package/dist/commands/constellation.js +8 -3
  232. package/dist/commands/constellation.js.map +1 -1
  233. package/dist/commands/context.d.ts.map +1 -1
  234. package/dist/commands/context.js +8 -3
  235. package/dist/commands/context.js.map +1 -1
  236. package/dist/commands/cross-cut.d.ts +11 -0
  237. package/dist/commands/cross-cut.d.ts.map +1 -0
  238. package/dist/commands/cross-cut.js +23 -0
  239. package/dist/commands/cross-cut.js.map +1 -0
  240. package/dist/commands/doctor.d.ts +18 -0
  241. package/dist/commands/doctor.d.ts.map +1 -0
  242. package/dist/commands/doctor.js +232 -0
  243. package/dist/commands/doctor.js.map +1 -0
  244. package/dist/commands/doctor.test.d.ts +8 -0
  245. package/dist/commands/doctor.test.d.ts.map +1 -0
  246. package/dist/commands/doctor.test.js +311 -0
  247. package/dist/commands/doctor.test.js.map +1 -0
  248. package/dist/commands/fields.d.ts.map +1 -1
  249. package/dist/commands/fields.js +8 -4
  250. package/dist/commands/fields.js.map +1 -1
  251. package/dist/commands/get.d.ts.map +1 -1
  252. package/dist/commands/get.js +14 -6
  253. package/dist/commands/get.js.map +1 -1
  254. package/dist/commands/handshake.d.ts +12 -0
  255. package/dist/commands/handshake.d.ts.map +1 -1
  256. package/dist/commands/handshake.js +422 -74
  257. package/dist/commands/handshake.js.map +1 -1
  258. package/dist/commands/ingest.d.ts +7 -2
  259. package/dist/commands/ingest.d.ts.map +1 -1
  260. package/dist/commands/ingest.js +137 -31
  261. package/dist/commands/ingest.js.map +1 -1
  262. package/dist/commands/init.d.ts +14 -0
  263. package/dist/commands/init.d.ts.map +1 -0
  264. package/dist/commands/init.js +109 -0
  265. package/dist/commands/init.js.map +1 -0
  266. package/dist/commands/login.d.ts +4 -0
  267. package/dist/commands/login.d.ts.map +1 -1
  268. package/dist/commands/login.js +101 -38
  269. package/dist/commands/login.js.map +1 -1
  270. package/dist/commands/method.d.ts +99 -0
  271. package/dist/commands/method.d.ts.map +1 -0
  272. package/dist/commands/method.js +781 -0
  273. package/dist/commands/method.js.map +1 -0
  274. package/dist/commands/orient.d.ts +106 -1
  275. package/dist/commands/orient.d.ts.map +1 -1
  276. package/dist/commands/orient.js +13 -2
  277. package/dist/commands/orient.js.map +1 -1
  278. package/dist/commands/profile.d.ts +24 -0
  279. package/dist/commands/profile.d.ts.map +1 -0
  280. package/dist/commands/profile.js +82 -0
  281. package/dist/commands/profile.js.map +1 -0
  282. package/dist/commands/promote.d.ts +12 -0
  283. package/dist/commands/promote.d.ts.map +1 -0
  284. package/dist/commands/promote.js +90 -0
  285. package/dist/commands/promote.js.map +1 -0
  286. package/dist/commands/proposals.d.ts +9 -0
  287. package/dist/commands/proposals.d.ts.map +1 -0
  288. package/dist/commands/proposals.js +24 -0
  289. package/dist/commands/proposals.js.map +1 -0
  290. package/dist/commands/reject.d.ts +14 -0
  291. package/dist/commands/reject.d.ts.map +1 -0
  292. package/dist/commands/reject.js +43 -0
  293. package/dist/commands/reject.js.map +1 -0
  294. package/dist/commands/relate.d.ts +1 -0
  295. package/dist/commands/relate.d.ts.map +1 -1
  296. package/dist/commands/relate.js +41 -15
  297. package/dist/commands/relate.js.map +1 -1
  298. package/dist/commands/search.js +2 -2
  299. package/dist/commands/search.js.map +1 -1
  300. package/dist/commands/session.d.ts.map +1 -1
  301. package/dist/commands/session.js +85 -16
  302. package/dist/commands/session.js.map +1 -1
  303. package/dist/commands/setup.d.ts +15 -0
  304. package/dist/commands/setup.d.ts.map +1 -0
  305. package/dist/commands/setup.js +148 -0
  306. package/dist/commands/setup.js.map +1 -0
  307. package/dist/commands/update.d.ts +1 -0
  308. package/dist/commands/update.d.ts.map +1 -1
  309. package/dist/commands/update.js +102 -13
  310. package/dist/commands/update.js.map +1 -1
  311. package/dist/commands/usage.d.ts +40 -0
  312. package/dist/commands/usage.d.ts.map +1 -0
  313. package/dist/commands/usage.js +232 -0
  314. package/dist/commands/usage.js.map +1 -0
  315. package/dist/commands/verify.d.ts +13 -0
  316. package/dist/commands/verify.d.ts.map +1 -0
  317. package/dist/commands/verify.js +49 -0
  318. package/dist/commands/verify.js.map +1 -0
  319. package/dist/commands/welcome.d.ts +21 -0
  320. package/dist/commands/welcome.d.ts.map +1 -0
  321. package/dist/commands/welcome.js +50 -0
  322. package/dist/commands/welcome.js.map +1 -0
  323. package/dist/commands/workspace.d.ts +41 -0
  324. package/dist/commands/workspace.d.ts.map +1 -0
  325. package/dist/commands/workspace.js +239 -0
  326. package/dist/commands/workspace.js.map +1 -0
  327. package/dist/formatters/audit.d.ts +46 -0
  328. package/dist/formatters/audit.d.ts.map +1 -0
  329. package/dist/formatters/audit.js +81 -0
  330. package/dist/formatters/audit.js.map +1 -0
  331. package/dist/formatters/brief.d.ts +112 -0
  332. package/dist/formatters/brief.d.ts.map +1 -0
  333. package/dist/formatters/brief.js +179 -0
  334. package/dist/formatters/brief.js.map +1 -0
  335. package/dist/formatters/capture.d.ts +21 -3
  336. package/dist/formatters/capture.d.ts.map +1 -1
  337. package/dist/formatters/capture.js +20 -1
  338. package/dist/formatters/capture.js.map +1 -1
  339. package/dist/formatters/chain-walk.d.ts +33 -0
  340. package/dist/formatters/chain-walk.d.ts.map +1 -0
  341. package/dist/formatters/chain-walk.js +54 -0
  342. package/dist/formatters/chain-walk.js.map +1 -0
  343. package/dist/formatters/changes.d.ts +25 -0
  344. package/dist/formatters/changes.d.ts.map +1 -0
  345. package/dist/formatters/changes.js +60 -0
  346. package/dist/formatters/changes.js.map +1 -0
  347. package/dist/formatters/collections.d.ts +40 -0
  348. package/dist/formatters/collections.d.ts.map +1 -0
  349. package/dist/formatters/collections.js +93 -0
  350. package/dist/formatters/collections.js.map +1 -0
  351. package/dist/formatters/cross-cut.d.ts +21 -0
  352. package/dist/formatters/cross-cut.d.ts.map +1 -0
  353. package/dist/formatters/cross-cut.js +32 -0
  354. package/dist/formatters/cross-cut.js.map +1 -0
  355. package/dist/formatters/entry.d.ts +11 -4
  356. package/dist/formatters/entry.d.ts.map +1 -1
  357. package/dist/formatters/entry.js +24 -8
  358. package/dist/formatters/entry.js.map +1 -1
  359. package/dist/formatters/handshake.d.ts +29 -0
  360. package/dist/formatters/handshake.d.ts.map +1 -1
  361. package/dist/formatters/handshake.js +115 -3
  362. package/dist/formatters/handshake.js.map +1 -1
  363. package/dist/formatters/orient.d.ts +104 -1
  364. package/dist/formatters/orient.d.ts.map +1 -1
  365. package/dist/formatters/orient.js +140 -17
  366. package/dist/formatters/orient.js.map +1 -1
  367. package/dist/formatters/promote.d.ts +30 -0
  368. package/dist/formatters/promote.d.ts.map +1 -0
  369. package/dist/formatters/promote.js +39 -0
  370. package/dist/formatters/promote.js.map +1 -0
  371. package/dist/formatters/proposals.d.ts +45 -0
  372. package/dist/formatters/proposals.d.ts.map +1 -0
  373. package/dist/formatters/proposals.js +62 -0
  374. package/dist/formatters/proposals.js.map +1 -0
  375. package/dist/formatters/relate.d.ts +3 -0
  376. package/dist/formatters/relate.d.ts.map +1 -1
  377. package/dist/formatters/relate.js +6 -0
  378. package/dist/formatters/relate.js.map +1 -1
  379. package/dist/formatters/search.d.ts +0 -4
  380. package/dist/formatters/search.d.ts.map +1 -1
  381. package/dist/formatters/search.js +4 -1
  382. package/dist/formatters/search.js.map +1 -1
  383. package/dist/formatters/session.d.ts +1 -1
  384. package/dist/formatters/session.d.ts.map +1 -1
  385. package/dist/formatters/session.js +3 -1
  386. package/dist/formatters/session.js.map +1 -1
  387. package/dist/formatters/update.d.ts.map +1 -1
  388. package/dist/formatters/update.js +2 -0
  389. package/dist/formatters/update.js.map +1 -1
  390. package/dist/formatters/verify.d.ts +11 -0
  391. package/dist/formatters/verify.d.ts.map +1 -0
  392. package/dist/formatters/verify.js +11 -0
  393. package/dist/formatters/verify.js.map +1 -0
  394. package/dist/generators/__tests__/surface-profiles.test.d.ts +2 -0
  395. package/dist/generators/__tests__/surface-profiles.test.d.ts.map +1 -0
  396. package/dist/generators/__tests__/surface-profiles.test.js +89 -0
  397. package/dist/generators/__tests__/surface-profiles.test.js.map +1 -0
  398. package/dist/generators/adapters.d.ts +37 -3
  399. package/dist/generators/adapters.d.ts.map +1 -1
  400. package/dist/generators/adapters.js +193 -5
  401. package/dist/generators/adapters.js.map +1 -1
  402. package/dist/generators/adapters.test.d.ts +2 -0
  403. package/dist/generators/adapters.test.d.ts.map +1 -0
  404. package/dist/generators/adapters.test.js +27 -0
  405. package/dist/generators/adapters.test.js.map +1 -0
  406. package/dist/generators/archetypes.d.ts +52 -0
  407. package/dist/generators/archetypes.d.ts.map +1 -0
  408. package/dist/generators/archetypes.js +153 -0
  409. package/dist/generators/archetypes.js.map +1 -0
  410. package/dist/generators/archetypes.test.d.ts +2 -0
  411. package/dist/generators/archetypes.test.d.ts.map +1 -0
  412. package/dist/generators/archetypes.test.js +237 -0
  413. package/dist/generators/archetypes.test.js.map +1 -0
  414. package/dist/generators/chain-classifier.d.ts +49 -0
  415. package/dist/generators/chain-classifier.d.ts.map +1 -0
  416. package/dist/generators/chain-classifier.js +180 -0
  417. package/dist/generators/chain-classifier.js.map +1 -0
  418. package/dist/generators/chain-classifier.test.d.ts +2 -0
  419. package/dist/generators/chain-classifier.test.d.ts.map +1 -0
  420. package/dist/generators/chain-classifier.test.js +257 -0
  421. package/dist/generators/chain-classifier.test.js.map +1 -0
  422. package/dist/generators/chain-rules.d.ts +42 -0
  423. package/dist/generators/chain-rules.d.ts.map +1 -0
  424. package/dist/generators/chain-rules.js +144 -0
  425. package/dist/generators/chain-rules.js.map +1 -0
  426. package/dist/generators/chain-rules.test.d.ts +2 -0
  427. package/dist/generators/chain-rules.test.d.ts.map +1 -0
  428. package/dist/generators/chain-rules.test.js +179 -0
  429. package/dist/generators/chain-rules.test.js.map +1 -0
  430. package/dist/generators/context-md.d.ts +1 -1
  431. package/dist/generators/context-md.d.ts.map +1 -1
  432. package/dist/generators/context-md.js +12 -1
  433. package/dist/generators/context-md.js.map +1 -1
  434. package/dist/generators/handshake-diff.d.ts +67 -0
  435. package/dist/generators/handshake-diff.d.ts.map +1 -0
  436. package/dist/generators/handshake-diff.js +183 -0
  437. package/dist/generators/handshake-diff.js.map +1 -0
  438. package/dist/generators/handshake-diff.test.d.ts +2 -0
  439. package/dist/generators/handshake-diff.test.d.ts.map +1 -0
  440. package/dist/generators/handshake-diff.test.js +264 -0
  441. package/dist/generators/handshake-diff.test.js.map +1 -0
  442. package/dist/generators/manifest.d.ts +37 -0
  443. package/dist/generators/manifest.d.ts.map +1 -0
  444. package/dist/generators/manifest.js +166 -0
  445. package/dist/generators/manifest.js.map +1 -0
  446. package/dist/generators/portable-knowledge.d.ts +102 -9
  447. package/dist/generators/portable-knowledge.d.ts.map +1 -1
  448. package/dist/generators/portable-knowledge.js +384 -17
  449. package/dist/generators/portable-knowledge.js.map +1 -1
  450. package/dist/generators/portable-knowledge.test.js +529 -1
  451. package/dist/generators/portable-knowledge.test.js.map +1 -1
  452. package/dist/generators/surface-profiles.d.ts +49 -0
  453. package/dist/generators/surface-profiles.d.ts.map +1 -0
  454. package/dist/generators/surface-profiles.js +98 -0
  455. package/dist/generators/surface-profiles.js.map +1 -0
  456. package/dist/index.js +618 -138
  457. package/dist/index.js.map +1 -1
  458. package/dist/lib/activation.d.ts +28 -0
  459. package/dist/lib/activation.d.ts.map +1 -0
  460. package/dist/lib/activation.js +57 -0
  461. package/dist/lib/activation.js.map +1 -0
  462. package/dist/lib/activation.test.d.ts +6 -0
  463. package/dist/lib/activation.test.d.ts.map +1 -0
  464. package/dist/lib/activation.test.js +121 -0
  465. package/dist/lib/activation.test.js.map +1 -0
  466. package/dist/lib/client.d.ts +45 -3
  467. package/dist/lib/client.d.ts.map +1 -1
  468. package/dist/lib/client.js +188 -36
  469. package/dist/lib/client.js.map +1 -1
  470. package/dist/lib/collectionRegistry.d.ts +38 -0
  471. package/dist/lib/collectionRegistry.d.ts.map +1 -0
  472. package/dist/lib/collectionRegistry.js +112 -0
  473. package/dist/lib/collectionRegistry.js.map +1 -0
  474. package/dist/lib/config.d.ts +84 -4
  475. package/dist/lib/config.d.ts.map +1 -1
  476. package/dist/lib/config.js +322 -42
  477. package/dist/lib/config.js.map +1 -1
  478. package/dist/lib/constants.d.ts +42 -0
  479. package/dist/lib/constants.d.ts.map +1 -0
  480. package/dist/lib/constants.js +76 -0
  481. package/dist/lib/constants.js.map +1 -0
  482. package/dist/lib/conversation-engine.d.ts +45 -0
  483. package/dist/lib/conversation-engine.d.ts.map +1 -0
  484. package/dist/lib/conversation-engine.js +112 -0
  485. package/dist/lib/conversation-engine.js.map +1 -0
  486. package/dist/lib/conversation-phases.d.ts +59 -0
  487. package/dist/lib/conversation-phases.d.ts.map +1 -0
  488. package/dist/lib/conversation-phases.js +11 -0
  489. package/dist/lib/conversation-phases.js.map +1 -0
  490. package/dist/lib/conversation-signals.d.ts +30 -0
  491. package/dist/lib/conversation-signals.d.ts.map +1 -0
  492. package/dist/lib/conversation-signals.js +64 -0
  493. package/dist/lib/conversation-signals.js.map +1 -0
  494. package/dist/lib/deployment.d.ts +23 -0
  495. package/dist/lib/deployment.d.ts.map +1 -0
  496. package/dist/lib/deployment.js +78 -0
  497. package/dist/lib/deployment.js.map +1 -0
  498. package/dist/lib/deployment.test.d.ts +5 -0
  499. package/dist/lib/deployment.test.d.ts.map +1 -0
  500. package/dist/lib/deployment.test.js +54 -0
  501. package/dist/lib/deployment.test.js.map +1 -0
  502. package/dist/lib/errors.d.ts +58 -0
  503. package/dist/lib/errors.d.ts.map +1 -0
  504. package/dist/lib/errors.js +67 -0
  505. package/dist/lib/errors.js.map +1 -0
  506. package/dist/lib/experiment.d.ts +18 -0
  507. package/dist/lib/experiment.d.ts.map +1 -0
  508. package/dist/lib/experiment.js +28 -0
  509. package/dist/lib/experiment.js.map +1 -0
  510. package/dist/lib/format.d.ts +10 -0
  511. package/dist/lib/format.d.ts.map +1 -0
  512. package/dist/lib/format.js +27 -0
  513. package/dist/lib/format.js.map +1 -0
  514. package/dist/lib/glossary.d.ts +19 -0
  515. package/dist/lib/glossary.d.ts.map +1 -0
  516. package/dist/lib/glossary.js +53 -0
  517. package/dist/lib/glossary.js.map +1 -0
  518. package/dist/lib/hook-intents.d.ts +51 -0
  519. package/dist/lib/hook-intents.d.ts.map +1 -0
  520. package/dist/lib/hook-intents.js +85 -0
  521. package/dist/lib/hook-intents.js.map +1 -0
  522. package/dist/lib/inferSourceDate.d.ts +12 -0
  523. package/dist/lib/inferSourceDate.d.ts.map +1 -0
  524. package/dist/lib/inferSourceDate.js +44 -0
  525. package/dist/lib/inferSourceDate.js.map +1 -0
  526. package/dist/lib/method-registry.d.ts +32 -0
  527. package/dist/lib/method-registry.d.ts.map +1 -0
  528. package/dist/lib/method-registry.js +53 -0
  529. package/dist/lib/method-registry.js.map +1 -0
  530. package/dist/lib/onboarding-path-b.d.ts +10 -0
  531. package/dist/lib/onboarding-path-b.d.ts.map +1 -0
  532. package/dist/lib/onboarding-path-b.js +214 -0
  533. package/dist/lib/onboarding-path-b.js.map +1 -0
  534. package/dist/lib/onboarding-phases.d.ts +9 -0
  535. package/dist/lib/onboarding-phases.d.ts.map +1 -0
  536. package/dist/lib/onboarding-phases.js +120 -0
  537. package/dist/lib/onboarding-phases.js.map +1 -0
  538. package/dist/lib/onboarding-shared.d.ts +81 -0
  539. package/dist/lib/onboarding-shared.d.ts.map +1 -0
  540. package/dist/lib/onboarding-shared.js +190 -0
  541. package/dist/lib/onboarding-shared.js.map +1 -0
  542. package/dist/lib/onboarding-topics.d.ts +27 -0
  543. package/dist/lib/onboarding-topics.d.ts.map +1 -0
  544. package/dist/lib/onboarding-topics.js +57 -0
  545. package/dist/lib/onboarding-topics.js.map +1 -0
  546. package/dist/lib/onboarding.d.ts +17 -0
  547. package/dist/lib/onboarding.d.ts.map +1 -0
  548. package/dist/lib/onboarding.js +350 -0
  549. package/dist/lib/onboarding.js.map +1 -0
  550. package/dist/lib/profiles.d.ts +39 -0
  551. package/dist/lib/profiles.d.ts.map +1 -0
  552. package/dist/lib/profiles.js +185 -0
  553. package/dist/lib/profiles.js.map +1 -0
  554. package/dist/lib/prompts.d.ts +65 -0
  555. package/dist/lib/prompts.d.ts.map +1 -0
  556. package/dist/lib/prompts.js +132 -0
  557. package/dist/lib/prompts.js.map +1 -0
  558. package/dist/lib/repo-detect.d.ts +19 -0
  559. package/dist/lib/repo-detect.d.ts.map +1 -1
  560. package/dist/lib/repo-detect.js +25 -0
  561. package/dist/lib/repo-detect.js.map +1 -1
  562. package/dist/lib/runner.d.ts +2 -0
  563. package/dist/lib/runner.d.ts.map +1 -1
  564. package/dist/lib/runner.js +21 -7
  565. package/dist/lib/runner.js.map +1 -1
  566. package/dist/lib/session.d.ts +25 -0
  567. package/dist/lib/session.d.ts.map +1 -1
  568. package/dist/lib/session.js +70 -4
  569. package/dist/lib/session.js.map +1 -1
  570. package/dist/lib/spinner.d.ts +27 -0
  571. package/dist/lib/spinner.d.ts.map +1 -0
  572. package/dist/lib/spinner.js +76 -0
  573. package/dist/lib/spinner.js.map +1 -0
  574. package/dist/lib/spinner.test.d.ts +2 -0
  575. package/dist/lib/spinner.test.d.ts.map +1 -0
  576. package/dist/lib/spinner.test.js +39 -0
  577. package/dist/lib/spinner.test.js.map +1 -0
  578. package/dist/lib/state.d.ts +51 -0
  579. package/dist/lib/state.d.ts.map +1 -0
  580. package/dist/lib/state.js +90 -0
  581. package/dist/lib/state.js.map +1 -0
  582. package/dist/lib/strip.d.ts +1 -0
  583. package/dist/lib/strip.d.ts.map +1 -1
  584. package/dist/lib/strip.js +15 -0
  585. package/dist/lib/strip.js.map +1 -1
  586. package/dist/lib/style.d.ts +96 -0
  587. package/dist/lib/style.d.ts.map +1 -0
  588. package/dist/lib/style.js +169 -0
  589. package/dist/lib/style.js.map +1 -0
  590. package/dist/lib/style.test.d.ts +7 -0
  591. package/dist/lib/style.test.d.ts.map +1 -0
  592. package/dist/lib/style.test.js +263 -0
  593. package/dist/lib/style.test.js.map +1 -0
  594. package/dist/lib/telemetry.d.ts +15 -0
  595. package/dist/lib/telemetry.d.ts.map +1 -0
  596. package/dist/lib/telemetry.js +47 -0
  597. package/dist/lib/telemetry.js.map +1 -0
  598. package/dist/lib/tokenConstants.d.ts +17 -0
  599. package/dist/lib/tokenConstants.d.ts.map +1 -0
  600. package/dist/lib/tokenConstants.js +17 -0
  601. package/dist/lib/tokenConstants.js.map +1 -0
  602. package/dist/lib/update-check.d.ts +21 -0
  603. package/dist/lib/update-check.d.ts.map +1 -0
  604. package/dist/lib/update-check.js +145 -0
  605. package/dist/lib/update-check.js.map +1 -0
  606. package/dist/lib/wizard-surfaces.d.ts +47 -0
  607. package/dist/lib/wizard-surfaces.d.ts.map +1 -0
  608. package/dist/lib/wizard-surfaces.js +176 -0
  609. package/dist/lib/wizard-surfaces.js.map +1 -0
  610. package/dist/lib/wizard-surfaces.test.d.ts +2 -0
  611. package/dist/lib/wizard-surfaces.test.d.ts.map +1 -0
  612. package/dist/lib/wizard-surfaces.test.js +127 -0
  613. package/dist/lib/wizard-surfaces.test.js.map +1 -0
  614. package/dist/lib/wizard-trust.d.ts +31 -0
  615. package/dist/lib/wizard-trust.d.ts.map +1 -0
  616. package/dist/lib/wizard-trust.js +66 -0
  617. package/dist/lib/wizard-trust.js.map +1 -0
  618. package/dist/lib/wizard-trust.test.d.ts +2 -0
  619. package/dist/lib/wizard-trust.test.d.ts.map +1 -0
  620. package/dist/lib/wizard-trust.test.js +32 -0
  621. package/dist/lib/wizard-trust.test.js.map +1 -0
  622. package/dist/lib/workspace-probe.d.ts +19 -0
  623. package/dist/lib/workspace-probe.d.ts.map +1 -0
  624. package/dist/lib/workspace-probe.js +27 -0
  625. package/dist/lib/workspace-probe.js.map +1 -0
  626. package/dist/surfaces/registry.d.ts +20 -0
  627. package/dist/surfaces/registry.d.ts.map +1 -0
  628. package/dist/surfaces/registry.js +42 -0
  629. package/dist/surfaces/registry.js.map +1 -0
  630. package/package.json +9 -3
  631. package/templates/archetypes/boundary.md +23 -0
  632. package/templates/archetypes/constraint.md +23 -0
  633. package/templates/archetypes/convention.md +23 -0
  634. package/templates/archetypes/policy.md +23 -0
  635. package/templates/archetypes/quality-gate.md +23 -0
  636. package/templates/archetypes/workflow.md +23 -0
  637. package/templates/general/code-integrity.md +11 -0
  638. package/templates/general/getting-started.md +12 -0
  639. package/templates/method-registry.json +16 -0
  640. package/templates/node-ts/code-integrity.md +13 -0
  641. package/templates/node-ts/testing.md +12 -0
  642. package/templates/python/code-integrity.md +13 -0
  643. package/templates/python/testing.md +12 -0
package/README.md CHANGED
@@ -1,142 +1,127 @@
1
1
  # Product Brain CLI (`pb`)
2
2
 
3
- CLI for Chain knowledge: read, search, gather context, and **write back**. Uses your Product Brain API key (same as MCP). Write commands require a readwrite key.
3
+ Chain knowledge + write-back in the terminal. Read, search, capture, and update your product knowledge graph.
4
4
 
5
- **Requirements:** Node 18+, API key from Product Brain Settings → API Keys (`pb_sk_*`).
6
-
7
- ---
5
+ **Requirements:** Node 18+, API key from Product Brain Settings (`pb_sk_*`).
8
6
 
9
7
  ## Install
10
8
 
11
- ### From npm (beta)
12
-
13
9
  ```bash
14
10
  npm install -g @productbrain/cli@beta
15
11
  ```
16
12
 
17
- Updates require a new publish to npm (and, if you use 2FA, a one-time password). Use this when you want a stable beta from the registry.
18
-
19
- ### From main (no publish needed)
20
-
21
- If you have the repo and want **latest from `main`** without publishing to npm:
13
+ From source (latest main):
22
14
 
23
15
  ```bash
24
16
  git clone https://github.com/synergyai-os/Product-OS.git
25
- cd Product-OS
26
- npm ci
17
+ cd Product-OS && npm ci
27
18
  cd packages/cli && npm run build && npm install -g .
28
19
  ```
29
20
 
30
- After that, `pb` runs from your global path. Pull and re-run the last two commands to update:
21
+ ## Login
31
22
 
32
23
  ```bash
33
- cd Product-OS && git pull && cd packages/cli && npm run build && npm install -g .
24
+ pb login
34
25
  ```
35
26
 
36
- See [Deployment strategy CLI vs MCP](../../docs/deployment-strategy.md#cli-vs-mcp-distribution) for why this avoids `cli:publish` / OTP.
27
+ Paste your API key (`pb_sk_...`). Saved to `~/.config/productbrain/.env`.
37
28
 
38
- ---
29
+ Or run any command without a key and follow the guided flow.
39
30
 
40
- ## First run
31
+ ### Onboarding link (`pb connect`)
41
32
 
42
- - **No key yet:** Run any command (e.g. `pb orient -b`). You’ll get a short guided flow: “Do you have an API key? (y/n)” → paste key → saved to `~/.config/productbrain/.env`. Your command then runs.
43
- - **Or:** Run `pb login` to paste and save your key once. Get a key: Product Brain app → Settings → API Keys.
33
+ If you received a connect token (`pb_ct_...`) from Product Brain:
44
34
 
45
- Config is read from (in order): env vars → `~/.config/productbrain/.env` → `.env.mcp` in the current directory.
46
-
47
- ---
48
-
49
- ## Commands
50
-
51
- ### Read (no session required)
35
+ ```bash
36
+ pb connect pb_ct_...
37
+ ```
52
38
 
53
- | Command | Description |
54
- |--------|-------------|
55
- | `pb orient` | Workspace stage, bets, governance, tensions. Use `-b` for a brief view. |
56
- | `pb search <query>` | Full-text search across the Chain. |
57
- | `pb get <entry-id>` | Full entry (data, relations, last 10 history events). |
58
- | `pb context <entry-id>` | Constellation context (pipe-friendly markdown when not a TTY). |
59
- | `pb handshake` | Generate context files for AI developer tools. See below. |
60
- | `pb login` | Save your API key to `~/.config/productbrain/.env`. |
39
+ Redemption always targets a cloud Convex deployment (HTTP Actions are cloud-hosted, even during local dev). Resolution order: `--gateway` → `PB_CONNECT_GATEWAY_URL` → `CONVEX_SITE_URL` → production default (`gateway.productbrain.io`).
61
40
 
62
- ### Write (session required DEC-9)
41
+ - **Dev deployments:** Set `CONVEX_SITE_URL` to your `*.convex.site` URL, or use `--gateway`.
42
+ - If a token fails, the CLI hints about setting `CONVEX_SITE_URL` or using `--gateway`.
63
43
 
64
- | Command | Description |
65
- |--------|-------------|
66
- | `pb session start` | Open a tracked write session. Refreshes context files. |
67
- | `pb capture "<text>"` | Capture a decision, tension, insight, or any knowledge to the Chain. Auto-classifies. |
68
- | `pb session close` | Close the session. Shows captured entries, runs wrapup, refreshes context. |
44
+ ## Quick Start
69
45
 
70
- `pb --help` for options.
46
+ ```bash
47
+ # 1. Check your setup
48
+ pb doctor
71
49
 
72
- ---
50
+ # 2. Orient — see where things stand
51
+ pb orient -b
73
52
 
74
- ## `pb handshake` AI Developer Onboarding
53
+ # 3. Read an entry
54
+ pb get BET-123
75
55
 
76
- One command generates context files for every major AI coding tool:
56
+ # 4. Search the Chain
57
+ pb search "onboarding flow"
77
58
 
78
- ```bash
79
- pb handshake
59
+ # 5. Start a write session and capture knowledge
60
+ pb session start
61
+ pb capture "DEC: chose X because Y"
62
+ pb capture "TEN: blocked by missing API"
63
+ pb session close
80
64
  ```
81
65
 
82
- **What it generates:**
83
-
84
- | File | Purpose |
85
- |------|---------|
86
- | `.productbrain/context.md` | Workspace briefing — stage, bets, governance, architecture, tensions |
87
- | `.productbrain/briefing.md` | Chain entries matched to this specific repo |
88
- | `CLAUDE.md` | Adapter for Claude Code |
89
- | `.cursor/rules/chain.mdc` | Adapter for Cursor |
90
- | `.github/copilot-instructions.md` | Adapter for GitHub Copilot |
66
+ Running `pb` with no arguments shows contextual guidance based on your setup state.
91
67
 
92
- **Options:**
93
-
94
- - `--force` — Overwrite adapter files even if they have custom content
95
- - `--dry-run` — Preview what would be generated without writing files
96
-
97
- **Safety:** Adapter files are marked with `auto-generated by pb handshake`. If you customize one and remove the marker, future runs skip it (unless `--force`). The `.productbrain/` directory contains workspace-specific context and should be in `.gitignore`.
68
+ ## Commands
98
69
 
99
- **Governance:** Context export surface per DEC-161 and GLO-63. Architecture: ARCH-63 (surfaces are peers consuming the kernel).
70
+ ### Read (no session required)
100
71
 
101
- ---
72
+ | Command | Description |
73
+ |---------|-------------|
74
+ | `pb orient [-b]` | Workspace overview. `-b` for brief, `--task` for task-grounded context. |
75
+ | `pb get <id>` | Full entry: data, relations, history. |
76
+ | `pb search <query>` | Full-text search across all collections. |
77
+ | `pb context <id>` | Constellation context for an entry. |
78
+ | `pb fields <collection>` | Field definitions for a collection. |
79
+ | `pb constellation <id>` | Entry + all related entries grouped by relation type. |
80
+ | `pb collections list` | All collections with field counts. |
81
+ | `pb glossary` | Key Product Brain CLI terms. |
82
+ | `pb doctor` | Check configuration and connectivity. |
83
+
84
+ ### Write (session required)
102
85
 
103
- ## `pb session` + `pb capture` — Close the Loop
86
+ | Command | Description |
87
+ |---------|-------------|
88
+ | `pb session start` | Open a tracked write session. |
89
+ | `pb capture "<text>"` | Capture knowledge. Auto-classifies to the right collection. |
90
+ | `pb update <id>` | Update fields on an existing entry. |
91
+ | `pb relate <from> <type> <to>` | Add a typed relation between entries. |
92
+ | `pb promote <id>` | Promote entry from draft to active. |
93
+ | `pb session close` | Close session, show summary. |
104
94
 
105
- The Chain compounds from every AI coding session. Instead of knowledge dying in chat transcripts (TEN-27), capture it as you work.
95
+ ### Profile Management
106
96
 
107
- ### Flow
97
+ Config is read from (in order): environment variables, `~/.config/productbrain/.env`, `.env.mcp` in the current directory.
108
98
 
109
99
  ```bash
110
- # Start of session
111
- pb session start # opens session, refreshes context
100
+ pb login # Save API key
101
+ pb doctor # Verify configuration
102
+ pb setup # Guided first-time setup
103
+ ```
112
104
 
113
- # During work — capture what you learn
114
- pb capture "TEN: topology query returns stale containers when initiatives are archived"
115
- pb capture "DEC: excluded archived initiatives at the query level, not the UI filter"
116
- pb capture "INS: learned that the containerIds array references soft-deleted entries"
105
+ ### AI Developer Onboarding
117
106
 
118
- # End of session
119
- pb session close # shows summary, runs wrapup, refreshes context
107
+ ```bash
108
+ pb handshake # Generate context files for Codex, Cursor, Claude, Copilot
120
109
  ```
121
110
 
122
- ### How capture works
123
-
124
- 1. Text is sent to the Chain's classification pipeline — auto-assigns collection
125
- 2. Entry is created as a **draft** (nothing auto-commits)
126
- 3. Receipt shows: entry ID, collection, confidence, reasoning, alternatives
127
- 4. You review and commit drafts in Product Brain Studio
111
+ Generates `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/chain.mdc`, `.productbrain/context.md`, and more.
128
112
 
129
- ### Options
113
+ ## Output Modes
130
114
 
131
- - `pb capture --collection tensions "text"` — skip auto-classification, use explicit collection
132
- - `pb capture --name "Short title" --description "Full explanation"` — separate name and description
133
- - `pb session close --force` clear local session state even if server close fails
115
+ | Context | Output |
116
+ |---------|--------|
117
+ | TTY (terminal) | Human-readable formatting |
118
+ | Piped / non-TTY | JSON |
119
+ | `--json` | Force JSON |
120
+ | `--pretty` | Force human-readable |
134
121
 
135
- ### Governance
122
+ ## Reference
136
123
 
137
- - Write access requires a tracked session (DEC-9, BR-8)
138
- - Session attribution via API key; `clientKind: 'cli'` discriminator per DEC-184 (pending schema extension)
139
- - All captures are drafts — human reviews and commits (TEN-374)
140
- - Solves TEN-264 (CLI write access session attribution) with explicit session token in `.productbrain/session.json`
141
- - Addresses TEN-27 (strategic conversations generate decisions that never reach the Chain)
142
- - Implements INS-80 (proactive capture during coding)
124
+ - `pb --help` for full command list
125
+ - `pb <command> --help` for command-specific options
126
+ - `pb glossary` for key terms
127
+ - Chain: WP-302 (CLI Maturity)
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=adapters.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapters.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/adapters.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,417 @@
1
+ /**
2
+ * adapters — unit tests for generateAgentsMd and generateCopilotMd.
3
+ * BET-270 Slice 2: governance-enriched AGENTS.md adapter.
4
+ * BET-270 Slice 3: profile-driven single-file Copilot adapter.
5
+ */
6
+ import { describe, expect, it } from 'vitest';
7
+ import { MARKER, generateAgentsMd, generateCopilotMd } from '../generators/adapters.js';
8
+ import { SURFACE_PROFILES } from '../generators/surface-profiles.js';
9
+ const TIMESTAMP = '2026-04-05T12:00:00.000Z';
10
+ // ── Auto-generated marker ─────────────────────────────────────────────
11
+ describe('generateAgentsMd — marker', () => {
12
+ it('always includes the auto-generated marker', () => {
13
+ expect(generateAgentsMd(TIMESTAMP)).toContain(MARKER);
14
+ });
15
+ it('always includes the marker when options are provided', () => {
16
+ expect(generateAgentsMd(TIMESTAMP, {
17
+ workspaceContext: { stage: 'grounded' },
18
+ skills: [{ name: 'my-skill', description: 'does things' }],
19
+ })).toContain(MARKER);
20
+ });
21
+ it('embeds the timestamp in the marker line', () => {
22
+ const result = generateAgentsMd(TIMESTAMP);
23
+ expect(result).toContain(`<!-- ${MARKER} — ${TIMESTAMP} -->`);
24
+ });
25
+ });
26
+ // ── Backward compatibility (no options) ──────────────────────────────
27
+ describe('generateAgentsMd — no options (backward compat)', () => {
28
+ it('produces the command reference table', () => {
29
+ const result = generateAgentsMd(TIMESTAMP);
30
+ expect(result).toContain('pb orient -b');
31
+ expect(result).toContain('pb get <ID>');
32
+ expect(result).toContain('pb search <query>');
33
+ expect(result).toContain('pb handshake');
34
+ });
35
+ it('produces the session lifecycle section', () => {
36
+ const result = generateAgentsMd(TIMESTAMP);
37
+ expect(result).toContain('pb session start');
38
+ expect(result).toContain('pb capture');
39
+ expect(result).toContain('pb session close');
40
+ });
41
+ it('does not include workspace context section when no options given', () => {
42
+ const result = generateAgentsMd(TIMESTAMP);
43
+ expect(result).not.toContain('## Workspace Context');
44
+ });
45
+ it('does not include skill directory when no options given', () => {
46
+ const result = generateAgentsMd(TIMESTAMP);
47
+ expect(result).not.toContain('## Skill Directory');
48
+ });
49
+ it('includes governance summary', () => {
50
+ const result = generateAgentsMd(TIMESTAMP);
51
+ expect(result).toContain('## Governance Summary');
52
+ });
53
+ });
54
+ // ── Workspace Context section ─────────────────────────────────────────
55
+ describe('generateAgentsMd — workspaceContext', () => {
56
+ it('includes workspace context section when workspaceContext is provided', () => {
57
+ const result = generateAgentsMd(TIMESTAMP, {
58
+ workspaceContext: { stage: 'grounded', governanceMode: 'active', totalEntries: 42 },
59
+ });
60
+ expect(result).toContain('## Workspace Context');
61
+ });
62
+ it('renders stage in workspace context table', () => {
63
+ const result = generateAgentsMd(TIMESTAMP, {
64
+ workspaceContext: { stage: 'grounded' },
65
+ });
66
+ expect(result).toContain('grounded');
67
+ expect(result).toContain('Stage');
68
+ });
69
+ it('renders focus in workspace context table', () => {
70
+ const result = generateAgentsMd(TIMESTAMP, {
71
+ workspaceContext: { focus: 'Ship BET-270' },
72
+ });
73
+ expect(result).toContain('Ship BET-270');
74
+ expect(result).toContain('Current focus');
75
+ });
76
+ it('renders governanceMode in workspace context table', () => {
77
+ const result = generateAgentsMd(TIMESTAMP, {
78
+ workspaceContext: { governanceMode: 'structured' },
79
+ });
80
+ expect(result).toContain('structured');
81
+ expect(result).toContain('Governance mode');
82
+ });
83
+ it('renders totalEntries in workspace context table', () => {
84
+ const result = generateAgentsMd(TIMESTAMP, {
85
+ workspaceContext: { totalEntries: 99 },
86
+ });
87
+ expect(result).toContain('99');
88
+ expect(result).toContain('Chain entries');
89
+ });
90
+ it('omits workspace context section when workspaceContext is undefined', () => {
91
+ const result = generateAgentsMd(TIMESTAMP, { skills: [] });
92
+ expect(result).not.toContain('## Workspace Context');
93
+ });
94
+ it('omits workspace context section when workspaceContext is empty object', () => {
95
+ const result = generateAgentsMd(TIMESTAMP, { workspaceContext: {} });
96
+ expect(result).not.toContain('## Workspace Context');
97
+ });
98
+ it('omits skill directory when only workspaceContext provided (no skills)', () => {
99
+ const result = generateAgentsMd(TIMESTAMP, {
100
+ workspaceContext: { stage: 'grounded' },
101
+ });
102
+ expect(result).not.toContain('## Skill Directory');
103
+ });
104
+ });
105
+ // ── Skill Directory section ───────────────────────────────────────────
106
+ describe('generateAgentsMd — skills', () => {
107
+ it('includes skill directory when skills array provided', () => {
108
+ const result = generateAgentsMd(TIMESTAMP, {
109
+ skills: [{ name: 'my-skill', description: 'does things' }],
110
+ });
111
+ expect(result).toContain('## Skill Directory');
112
+ });
113
+ it('renders skill name in the table', () => {
114
+ const result = generateAgentsMd(TIMESTAMP, {
115
+ skills: [{ name: 'commit', description: 'commit changes to main' }],
116
+ });
117
+ expect(result).toContain('commit');
118
+ expect(result).toContain('commit changes to main');
119
+ });
120
+ it('renders skill triggers (up to 3) in the table', () => {
121
+ const result = generateAgentsMd(TIMESTAMP, {
122
+ skills: [
123
+ {
124
+ name: 'review',
125
+ description: 'review changes',
126
+ triggers: ['review', 'implementation review', 'review this'],
127
+ },
128
+ ],
129
+ });
130
+ expect(result).toContain('review');
131
+ expect(result).toContain('implementation review');
132
+ expect(result).toContain('review this');
133
+ });
134
+ it('caps triggers at 3 items', () => {
135
+ const result = generateAgentsMd(TIMESTAMP, {
136
+ skills: [
137
+ {
138
+ name: 'shape',
139
+ description: 'shape a bet',
140
+ triggers: ['shape', 'shape this', 'shape a bet', 'shape up', 'let\'s shape'],
141
+ },
142
+ ],
143
+ });
144
+ // Should have at most 3 triggers shown — 4th and 5th should not appear if they are unique
145
+ // The row should contain up to 3 triggers joined by ', '
146
+ const lines = result.split('\n');
147
+ const skillRow = lines.find((l) => l.includes('shape') && l.includes('shape a bet'));
148
+ expect(skillRow).toBeDefined();
149
+ const parts = skillRow.split('|');
150
+ // triggers cell is the 4th column (index 3)
151
+ const triggersCell = parts[3]?.trim() ?? '';
152
+ const triggerCount = triggersCell.split(',').length;
153
+ expect(triggerCount).toBeLessThanOrEqual(3);
154
+ });
155
+ it('renders "—" when no triggers provided for a skill', () => {
156
+ const result = generateAgentsMd(TIMESTAMP, {
157
+ skills: [{ name: 'my-skill', description: 'does things' }],
158
+ });
159
+ expect(result).toContain('—');
160
+ });
161
+ it('renders multiple skills as separate rows', () => {
162
+ const result = generateAgentsMd(TIMESTAMP, {
163
+ skills: [
164
+ { name: 'skill-a', description: 'skill A description' },
165
+ { name: 'skill-b', description: 'skill B description' },
166
+ ],
167
+ });
168
+ expect(result).toContain('skill-a');
169
+ expect(result).toContain('skill-b');
170
+ expect(result).toContain('skill A description');
171
+ expect(result).toContain('skill B description');
172
+ });
173
+ it('omits skill directory when skills array is empty', () => {
174
+ const result = generateAgentsMd(TIMESTAMP, { skills: [] });
175
+ expect(result).not.toContain('## Skill Directory');
176
+ });
177
+ it('omits skill directory when skills option is undefined', () => {
178
+ const result = generateAgentsMd(TIMESTAMP, { workspaceContext: { stage: 'grounded' } });
179
+ expect(result).not.toContain('## Skill Directory');
180
+ });
181
+ it('includes workspace context AND skill directory together', () => {
182
+ const result = generateAgentsMd(TIMESTAMP, {
183
+ workspaceContext: { stage: 'grounded', totalEntries: 10 },
184
+ skills: [{ name: 'orient', description: 'orient the workspace' }],
185
+ });
186
+ expect(result).toContain('## Workspace Context');
187
+ expect(result).toContain('## Skill Directory');
188
+ });
189
+ });
190
+ // ── Governance summary (always present) ─────────────────────────────
191
+ describe('generateAgentsMd — governance summary', () => {
192
+ it('is present with no options', () => {
193
+ expect(generateAgentsMd(TIMESTAMP)).toContain('## Governance Summary');
194
+ });
195
+ it('is present with full context', () => {
196
+ const result = generateAgentsMd(TIMESTAMP, {
197
+ workspaceContext: { stage: 'grounded' },
198
+ skills: [{ name: 'commit', description: 'commit to main' }],
199
+ });
200
+ expect(result).toContain('## Governance Summary');
201
+ });
202
+ it('mentions Product Brain governance', () => {
203
+ const result = generateAgentsMd(TIMESTAMP);
204
+ expect(result).toContain('Product Brain governance');
205
+ });
206
+ });
207
+ // ────────────────────────────────────────────────────────────────────
208
+ // generateCopilotMd
209
+ // ────────────────────────────────────────────────────────────────────
210
+ // ── Marker always present ────────────────────────────────────────────
211
+ describe('generateCopilotMd — marker', () => {
212
+ it('always includes the auto-generated marker with no options', () => {
213
+ expect(generateCopilotMd(TIMESTAMP)).toContain(MARKER);
214
+ });
215
+ it('always includes the marker when options are provided', () => {
216
+ expect(generateCopilotMd(TIMESTAMP, {
217
+ skills: [{ name: 'my-skill', description: 'does things' }],
218
+ })).toContain(MARKER);
219
+ });
220
+ it('embeds the timestamp in the marker line', () => {
221
+ const result = generateCopilotMd(TIMESTAMP);
222
+ expect(result).toContain(`<!-- ${MARKER} — ${TIMESTAMP} -->`);
223
+ });
224
+ });
225
+ // ── Backward compatibility (no options) ─────────────────────────────
226
+ describe('generateCopilotMd — no options (backward compat)', () => {
227
+ it('produces the command reference section', () => {
228
+ const result = generateCopilotMd(TIMESTAMP);
229
+ expect(result).toContain('pb orient -b');
230
+ expect(result).toContain('pb get <ID>');
231
+ expect(result).toContain('pb search <query>');
232
+ expect(result).toContain('pb handshake');
233
+ });
234
+ it('produces the session lifecycle section', () => {
235
+ const result = generateCopilotMd(TIMESTAMP);
236
+ expect(result).toContain('pb session start');
237
+ expect(result).toContain('pb capture');
238
+ expect(result).toContain('pb session close');
239
+ });
240
+ it('does not include Skills section when no options given', () => {
241
+ const result = generateCopilotMd(TIMESTAMP);
242
+ expect(result).not.toContain('## Skills');
243
+ });
244
+ it('does not include Rules section when no options given', () => {
245
+ const result = generateCopilotMd(TIMESTAMP);
246
+ expect(result).not.toContain('## Rules');
247
+ });
248
+ it('does not include workspace context section when no options given', () => {
249
+ const result = generateCopilotMd(TIMESTAMP);
250
+ expect(result).not.toContain('## Workspace Context');
251
+ });
252
+ });
253
+ // ── Full context ─────────────────────────────────────────────────────
254
+ describe('generateCopilotMd — full context', () => {
255
+ it('produces all sections when all options provided', () => {
256
+ const result = generateCopilotMd(TIMESTAMP, {
257
+ profile: SURFACE_PROFILES.copilot,
258
+ workspaceContext: { stage: 'grounded', focus: 'Ship BET-270', governanceMode: 'active', totalEntries: 55 },
259
+ skills: [{ name: 'commit', description: 'commit changes', triggers: ['commit'] }],
260
+ rules: [{ name: 'git-workflow', description: 'two-track git workflow' }],
261
+ });
262
+ expect(result).toContain('## Workspace Context');
263
+ expect(result).toContain('## Skills');
264
+ expect(result).toContain('## Rules');
265
+ expect(result).toContain('commit');
266
+ expect(result).toContain('git-workflow');
267
+ });
268
+ it('renders workspace context fields', () => {
269
+ const result = generateCopilotMd(TIMESTAMP, {
270
+ workspaceContext: { stage: 'grounded', governanceMode: 'active', totalEntries: 42, focus: 'BET-270' },
271
+ });
272
+ expect(result).toContain('grounded');
273
+ expect(result).toContain('active');
274
+ expect(result).toContain('42');
275
+ expect(result).toContain('BET-270');
276
+ });
277
+ it('renders skill name and description', () => {
278
+ const result = generateCopilotMd(TIMESTAMP, {
279
+ skills: [{ name: 'review', description: 'review implementation changes' }],
280
+ });
281
+ expect(result).toContain('### review');
282
+ expect(result).toContain('review implementation changes');
283
+ });
284
+ it('renders skill triggers (up to 3)', () => {
285
+ const result = generateCopilotMd(TIMESTAMP, {
286
+ skills: [
287
+ { name: 'shape', description: 'shape a bet', triggers: ['shape', 'shape this', 'shape a bet', 'let\'s shape'] },
288
+ ],
289
+ });
290
+ expect(result).toContain('shape');
291
+ expect(result).toContain('shape this');
292
+ expect(result).toContain('shape a bet');
293
+ // 4th trigger should not appear as it was sliced
294
+ expect(result).not.toContain('let\'s shape');
295
+ });
296
+ it('renders rule name and description', () => {
297
+ const result = generateCopilotMd(TIMESTAMP, {
298
+ rules: [{ name: 'feature-flags', description: 'three-tier feature flag resolution' }],
299
+ });
300
+ expect(result).toContain('### feature-flags');
301
+ expect(result).toContain('three-tier feature flag resolution');
302
+ });
303
+ it('renders multiple skills as separate headings', () => {
304
+ const result = generateCopilotMd(TIMESTAMP, {
305
+ skills: [
306
+ { name: 'skill-a', description: 'alpha skill' },
307
+ { name: 'skill-b', description: 'beta skill' },
308
+ ],
309
+ });
310
+ expect(result).toContain('### skill-a');
311
+ expect(result).toContain('### skill-b');
312
+ expect(result).toContain('alpha skill');
313
+ expect(result).toContain('beta skill');
314
+ });
315
+ it('renders multiple rules as separate headings', () => {
316
+ const result = generateCopilotMd(TIMESTAMP, {
317
+ rules: [
318
+ { name: 'rule-one', description: 'first rule' },
319
+ { name: 'rule-two', description: 'second rule' },
320
+ ],
321
+ });
322
+ expect(result).toContain('### rule-one');
323
+ expect(result).toContain('### rule-two');
324
+ });
325
+ it('does not include skill bodies — only summaries', () => {
326
+ // Summaries contain just name + description + optional triggers, no full markdown content
327
+ const result = generateCopilotMd(TIMESTAMP, {
328
+ skills: [{ name: 'orchestrate', description: 'run bounded implementation slices' }],
329
+ });
330
+ // Should have a heading and description but NOT multi-paragraph content from the skill body
331
+ expect(result).toContain('### orchestrate');
332
+ expect(result).toContain('run bounded implementation slices');
333
+ // Confirm no "Run Contract" section from skill body is present
334
+ expect(result).not.toContain('## Run Contract');
335
+ });
336
+ });
337
+ // ── Token budget enforcement ─────────────────────────────────────────
338
+ describe('generateCopilotMd — token budget enforcement', () => {
339
+ it('output length does not exceed profile token budget', () => {
340
+ const profile = SURFACE_PROFILES.copilot; // 30000 chars
341
+ // Generate a large payload
342
+ const manySkills = Array.from({ length: 100 }, (_, i) => ({
343
+ name: `skill-${i}`,
344
+ description: `Description for skill ${i} — a moderately long description to consume budget`,
345
+ triggers: [`trigger-${i}-a`, `trigger-${i}-b`, `trigger-${i}-c`],
346
+ }));
347
+ const manyRules = Array.from({ length: 50 }, (_, i) => ({
348
+ name: `rule-${i}`,
349
+ description: `Description for rule ${i} — another moderately long description`,
350
+ }));
351
+ const result = generateCopilotMd(TIMESTAMP, { profile, skills: manySkills, rules: manyRules });
352
+ expect(result.length).toBeLessThanOrEqual(profile.tokenBudget);
353
+ });
354
+ it('includes a truncation note when content is truncated', () => {
355
+ const profile = { ...SURFACE_PROFILES.copilot, tokenBudget: 2000 };
356
+ const manySkills = Array.from({ length: 50 }, (_, i) => ({
357
+ name: `skill-${i}`,
358
+ description: `Description for skill ${i}`,
359
+ }));
360
+ const result = generateCopilotMd(TIMESTAMP, { profile, skills: manySkills });
361
+ expect(result).toContain('Truncated');
362
+ expect(result).toContain('token budget');
363
+ });
364
+ it('does not include a truncation note when everything fits', () => {
365
+ const result = generateCopilotMd(TIMESTAMP, {
366
+ profile: SURFACE_PROFILES.copilot,
367
+ skills: [{ name: 'one-skill', description: 'a single skill that easily fits' }],
368
+ rules: [{ name: 'one-rule', description: 'a single rule that easily fits' }],
369
+ });
370
+ expect(result).not.toContain('Truncated');
371
+ });
372
+ it('respects a custom small token budget', () => {
373
+ // Budget must be larger than the base template (~1437 chars) + truncation note (~80 chars)
374
+ const smallBudget = 2500;
375
+ const profile = { ...SURFACE_PROFILES.copilot, tokenBudget: smallBudget };
376
+ const manySkills = Array.from({ length: 30 }, (_, i) => ({
377
+ name: `skill-${i}`,
378
+ description: `Description for skill ${i} with enough text to consume budget`,
379
+ triggers: [`trigger-${i}`],
380
+ }));
381
+ const result = generateCopilotMd(TIMESTAMP, { profile, skills: manySkills });
382
+ expect(result.length).toBeLessThanOrEqual(smallBudget);
383
+ expect(result).toContain('Truncated');
384
+ });
385
+ it('stays within budget even when base nearly fills it', () => {
386
+ // Budget barely above base template — should not exceed budget
387
+ const tightBudget = 1500;
388
+ const profile = { ...SURFACE_PROFILES.copilot, tokenBudget: tightBudget };
389
+ const manySkills = Array.from({ length: 20 }, (_, i) => ({
390
+ name: `skill-${i}`,
391
+ description: `Description ${i}`,
392
+ }));
393
+ const result = generateCopilotMd(TIMESTAMP, { profile, skills: manySkills });
394
+ expect(result.length).toBeLessThanOrEqual(tightBudget);
395
+ });
396
+ it('respects a large custom token budget without unnecessary truncation', () => {
397
+ const largeBudget = 200000;
398
+ const profile = { ...SURFACE_PROFILES.copilot, tokenBudget: largeBudget };
399
+ const fewSkills = Array.from({ length: 5 }, (_, i) => ({
400
+ name: `skill-${i}`,
401
+ description: `Short desc ${i}`,
402
+ }));
403
+ const result = generateCopilotMd(TIMESTAMP, { profile, skills: fewSkills });
404
+ expect(result.length).toBeLessThanOrEqual(largeBudget);
405
+ expect(result).not.toContain('Truncated');
406
+ });
407
+ it('truncated output still contains the marker', () => {
408
+ const profile = { ...SURFACE_PROFILES.copilot, tokenBudget: 2000 };
409
+ const manySkills = Array.from({ length: 50 }, (_, i) => ({
410
+ name: `skill-${i}`,
411
+ description: `Description for skill ${i}`,
412
+ }));
413
+ const result = generateCopilotMd(TIMESTAMP, { profile, skills: manySkills });
414
+ expect(result).toContain(MARKER);
415
+ });
416
+ });
417
+ //# sourceMappingURL=adapters.test.js.map