@productbrain/cli 0.1.0-beta.7 → 0.1.0-beta.70

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 (600) hide show
  1. package/README.md +98 -30
  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.d.ts +2 -0
  15. package/dist/__tests__/capture.test.d.ts.map +1 -0
  16. package/dist/__tests__/capture.test.js +377 -0
  17. package/dist/__tests__/capture.test.js.map +1 -0
  18. package/dist/__tests__/config.test.d.ts +8 -0
  19. package/dist/__tests__/config.test.d.ts.map +1 -0
  20. package/dist/__tests__/config.test.js +166 -0
  21. package/dist/__tests__/config.test.js.map +1 -0
  22. package/dist/__tests__/constants.test.d.ts +2 -0
  23. package/dist/__tests__/constants.test.d.ts.map +1 -0
  24. package/dist/__tests__/constants.test.js +141 -0
  25. package/dist/__tests__/constants.test.js.map +1 -0
  26. package/dist/__tests__/constellation.test.d.ts +2 -0
  27. package/dist/__tests__/constellation.test.d.ts.map +1 -0
  28. package/dist/__tests__/constellation.test.js +254 -0
  29. package/dist/__tests__/constellation.test.js.map +1 -0
  30. package/dist/__tests__/context-strategy.test.d.ts +2 -0
  31. package/dist/__tests__/context-strategy.test.d.ts.map +1 -0
  32. package/dist/__tests__/context-strategy.test.js +79 -0
  33. package/dist/__tests__/context-strategy.test.js.map +1 -0
  34. package/dist/__tests__/errors.test.d.ts +2 -0
  35. package/dist/__tests__/errors.test.d.ts.map +1 -0
  36. package/dist/__tests__/errors.test.js +117 -0
  37. package/dist/__tests__/errors.test.js.map +1 -0
  38. package/dist/__tests__/experiment.test.d.ts +6 -0
  39. package/dist/__tests__/experiment.test.d.ts.map +1 -0
  40. package/dist/__tests__/experiment.test.js +69 -0
  41. package/dist/__tests__/experiment.test.js.map +1 -0
  42. package/dist/__tests__/fields.test.d.ts +2 -0
  43. package/dist/__tests__/fields.test.d.ts.map +1 -0
  44. package/dist/__tests__/fields.test.js +238 -0
  45. package/dist/__tests__/fields.test.js.map +1 -0
  46. package/dist/__tests__/glossary.test.d.ts +2 -0
  47. package/dist/__tests__/glossary.test.d.ts.map +1 -0
  48. package/dist/__tests__/glossary.test.js +32 -0
  49. package/dist/__tests__/glossary.test.js.map +1 -0
  50. package/dist/__tests__/handshake.test.d.ts +2 -0
  51. package/dist/__tests__/handshake.test.d.ts.map +1 -0
  52. package/dist/__tests__/handshake.test.js +196 -0
  53. package/dist/__tests__/handshake.test.js.map +1 -0
  54. package/dist/__tests__/ingest.test.js +98 -0
  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__/onboarding-path-b.test.d.ts +2 -0
  65. package/dist/__tests__/onboarding-path-b.test.d.ts.map +1 -0
  66. package/dist/__tests__/onboarding-path-b.test.js +46 -0
  67. package/dist/__tests__/onboarding-path-b.test.js.map +1 -0
  68. package/dist/__tests__/onboarding.test.d.ts +6 -0
  69. package/dist/__tests__/onboarding.test.d.ts.map +1 -0
  70. package/dist/__tests__/onboarding.test.js +347 -0
  71. package/dist/__tests__/onboarding.test.js.map +1 -0
  72. package/dist/__tests__/orient.test.d.ts +2 -0
  73. package/dist/__tests__/orient.test.d.ts.map +1 -0
  74. package/dist/__tests__/orient.test.js +143 -0
  75. package/dist/__tests__/orient.test.js.map +1 -0
  76. package/dist/__tests__/profiles.test.d.ts +2 -0
  77. package/dist/__tests__/profiles.test.d.ts.map +1 -0
  78. package/dist/__tests__/profiles.test.js +168 -0
  79. package/dist/__tests__/profiles.test.js.map +1 -0
  80. package/dist/__tests__/promote.test.d.ts +2 -0
  81. package/dist/__tests__/promote.test.d.ts.map +1 -0
  82. package/dist/__tests__/promote.test.js +161 -0
  83. package/dist/__tests__/promote.test.js.map +1 -0
  84. package/dist/__tests__/prompts.test.d.ts +6 -0
  85. package/dist/__tests__/prompts.test.d.ts.map +1 -0
  86. package/dist/__tests__/prompts.test.js +146 -0
  87. package/dist/__tests__/prompts.test.js.map +1 -0
  88. package/dist/__tests__/proposals.test.d.ts +2 -0
  89. package/dist/__tests__/proposals.test.d.ts.map +1 -0
  90. package/dist/__tests__/proposals.test.js +167 -0
  91. package/dist/__tests__/proposals.test.js.map +1 -0
  92. package/dist/__tests__/relate.test.d.ts +2 -0
  93. package/dist/__tests__/relate.test.d.ts.map +1 -0
  94. package/dist/__tests__/relate.test.js +103 -0
  95. package/dist/__tests__/relate.test.js.map +1 -0
  96. package/dist/__tests__/repo-detect.test.d.ts +2 -0
  97. package/dist/__tests__/repo-detect.test.d.ts.map +1 -0
  98. package/dist/__tests__/repo-detect.test.js +215 -0
  99. package/dist/__tests__/repo-detect.test.js.map +1 -0
  100. package/dist/__tests__/runner.test.d.ts +2 -0
  101. package/dist/__tests__/runner.test.d.ts.map +1 -0
  102. package/dist/__tests__/runner.test.js +219 -0
  103. package/dist/__tests__/runner.test.js.map +1 -0
  104. package/dist/__tests__/session-touch.test.d.ts +2 -0
  105. package/dist/__tests__/session-touch.test.d.ts.map +1 -0
  106. package/dist/__tests__/session-touch.test.js +134 -0
  107. package/dist/__tests__/session-touch.test.js.map +1 -0
  108. package/dist/__tests__/session.test.d.ts +2 -0
  109. package/dist/__tests__/session.test.d.ts.map +1 -0
  110. package/dist/__tests__/session.test.js +46 -0
  111. package/dist/__tests__/session.test.js.map +1 -0
  112. package/dist/__tests__/setup.test.d.ts +2 -0
  113. package/dist/__tests__/setup.test.d.ts.map +1 -0
  114. package/dist/__tests__/setup.test.js +141 -0
  115. package/dist/__tests__/setup.test.js.map +1 -0
  116. package/dist/__tests__/spinner-labels.test.d.ts +2 -0
  117. package/dist/__tests__/spinner-labels.test.d.ts.map +1 -0
  118. package/dist/__tests__/spinner-labels.test.js +23 -0
  119. package/dist/__tests__/spinner-labels.test.js.map +1 -0
  120. package/dist/__tests__/strip.test.d.ts +2 -0
  121. package/dist/__tests__/strip.test.d.ts.map +1 -0
  122. package/dist/__tests__/strip.test.js +136 -0
  123. package/dist/__tests__/strip.test.js.map +1 -0
  124. package/dist/__tests__/surface-profiles.test.d.ts +2 -0
  125. package/dist/__tests__/surface-profiles.test.d.ts.map +1 -0
  126. package/dist/__tests__/surface-profiles.test.js +233 -0
  127. package/dist/__tests__/surface-profiles.test.js.map +1 -0
  128. package/dist/__tests__/update.test.d.ts +2 -0
  129. package/dist/__tests__/update.test.d.ts.map +1 -0
  130. package/dist/__tests__/update.test.js +228 -0
  131. package/dist/__tests__/update.test.js.map +1 -0
  132. package/dist/__tests__/workspace.test.d.ts +2 -0
  133. package/dist/__tests__/workspace.test.d.ts.map +1 -0
  134. package/dist/__tests__/workspace.test.js +308 -0
  135. package/dist/__tests__/workspace.test.js.map +1 -0
  136. package/dist/commands/accept.d.ts +18 -0
  137. package/dist/commands/accept.d.ts.map +1 -0
  138. package/dist/commands/accept.js +76 -0
  139. package/dist/commands/accept.js.map +1 -0
  140. package/dist/commands/admin/cockpit.d.ts +88 -0
  141. package/dist/commands/admin/cockpit.d.ts.map +1 -0
  142. package/dist/commands/admin/cockpit.js +409 -0
  143. package/dist/commands/admin/cockpit.js.map +1 -0
  144. package/dist/commands/admin/index.d.ts +21 -0
  145. package/dist/commands/admin/index.d.ts.map +1 -0
  146. package/dist/commands/admin/index.js +254 -0
  147. package/dist/commands/admin/index.js.map +1 -0
  148. package/dist/commands/admin/inspect.d.ts +21 -0
  149. package/dist/commands/admin/inspect.d.ts.map +1 -0
  150. package/dist/commands/admin/inspect.js +536 -0
  151. package/dist/commands/admin/inspect.js.map +1 -0
  152. package/dist/commands/admin/inspect.test.d.ts +7 -0
  153. package/dist/commands/admin/inspect.test.d.ts.map +1 -0
  154. package/dist/commands/admin/inspect.test.js +71 -0
  155. package/dist/commands/admin/inspect.test.js.map +1 -0
  156. package/dist/commands/admin/seed.d.ts +32 -0
  157. package/dist/commands/admin/seed.d.ts.map +1 -0
  158. package/dist/commands/admin/seed.js +527 -0
  159. package/dist/commands/admin/seed.js.map +1 -0
  160. package/dist/commands/admin/seed.test.d.ts +6 -0
  161. package/dist/commands/admin/seed.test.d.ts.map +1 -0
  162. package/dist/commands/admin/seed.test.js +65 -0
  163. package/dist/commands/admin/seed.test.js.map +1 -0
  164. package/dist/commands/audit.d.ts +25 -0
  165. package/dist/commands/audit.d.ts.map +1 -0
  166. package/dist/commands/audit.js +188 -0
  167. package/dist/commands/audit.js.map +1 -0
  168. package/dist/commands/brand-pack.d.ts +2 -0
  169. package/dist/commands/brand-pack.d.ts.map +1 -0
  170. package/dist/commands/brand-pack.js +25 -0
  171. package/dist/commands/brand-pack.js.map +1 -0
  172. package/dist/commands/brief.d.ts +28 -0
  173. package/dist/commands/brief.d.ts.map +1 -0
  174. package/dist/commands/brief.js +75 -0
  175. package/dist/commands/brief.js.map +1 -0
  176. package/dist/commands/capture.d.ts +30 -0
  177. package/dist/commands/capture.d.ts.map +1 -0
  178. package/dist/commands/capture.js +385 -0
  179. package/dist/commands/capture.js.map +1 -0
  180. package/dist/commands/chain-walk.d.ts +14 -0
  181. package/dist/commands/chain-walk.d.ts.map +1 -0
  182. package/dist/commands/chain-walk.js +38 -0
  183. package/dist/commands/chain-walk.js.map +1 -0
  184. package/dist/commands/changes.d.ts +11 -0
  185. package/dist/commands/changes.d.ts.map +1 -0
  186. package/dist/commands/changes.js +46 -0
  187. package/dist/commands/changes.js.map +1 -0
  188. package/dist/commands/codex-prep.d.ts +12 -0
  189. package/dist/commands/codex-prep.d.ts.map +1 -0
  190. package/dist/commands/codex-prep.js +122 -0
  191. package/dist/commands/codex-prep.js.map +1 -0
  192. package/dist/commands/collections.d.ts +22 -0
  193. package/dist/commands/collections.d.ts.map +1 -0
  194. package/dist/commands/collections.js +77 -0
  195. package/dist/commands/collections.js.map +1 -0
  196. package/dist/commands/connect-integration.test.d.ts +7 -0
  197. package/dist/commands/connect-integration.test.d.ts.map +1 -0
  198. package/dist/commands/connect-integration.test.js +200 -0
  199. package/dist/commands/connect-integration.test.js.map +1 -0
  200. package/dist/commands/connect.d.ts +21 -0
  201. package/dist/commands/connect.d.ts.map +1 -0
  202. package/dist/commands/connect.js +279 -0
  203. package/dist/commands/connect.js.map +1 -0
  204. package/dist/commands/connect.test.d.ts +6 -0
  205. package/dist/commands/connect.test.d.ts.map +1 -0
  206. package/dist/commands/connect.test.js +230 -0
  207. package/dist/commands/connect.test.js.map +1 -0
  208. package/dist/commands/constellation.d.ts +11 -0
  209. package/dist/commands/constellation.d.ts.map +1 -0
  210. package/dist/commands/constellation.js +33 -0
  211. package/dist/commands/constellation.js.map +1 -0
  212. package/dist/commands/context.d.ts +2 -1
  213. package/dist/commands/context.d.ts.map +1 -1
  214. package/dist/commands/context.js +20 -9
  215. package/dist/commands/context.js.map +1 -1
  216. package/dist/commands/cross-cut.d.ts +11 -0
  217. package/dist/commands/cross-cut.d.ts.map +1 -0
  218. package/dist/commands/cross-cut.js +23 -0
  219. package/dist/commands/cross-cut.js.map +1 -0
  220. package/dist/commands/doctor.d.ts +18 -0
  221. package/dist/commands/doctor.d.ts.map +1 -0
  222. package/dist/commands/doctor.js +232 -0
  223. package/dist/commands/doctor.js.map +1 -0
  224. package/dist/commands/doctor.test.d.ts +8 -0
  225. package/dist/commands/doctor.test.d.ts.map +1 -0
  226. package/dist/commands/doctor.test.js +311 -0
  227. package/dist/commands/doctor.test.js.map +1 -0
  228. package/dist/commands/fields.d.ts +9 -0
  229. package/dist/commands/fields.d.ts.map +1 -0
  230. package/dist/commands/fields.js +30 -0
  231. package/dist/commands/fields.js.map +1 -0
  232. package/dist/commands/get.d.ts +8 -1
  233. package/dist/commands/get.d.ts.map +1 -1
  234. package/dist/commands/get.js +60 -7
  235. package/dist/commands/get.js.map +1 -1
  236. package/dist/commands/handshake.d.ts +28 -0
  237. package/dist/commands/handshake.d.ts.map +1 -0
  238. package/dist/commands/handshake.js +617 -0
  239. package/dist/commands/handshake.js.map +1 -0
  240. package/dist/commands/ingest.d.ts +8 -2
  241. package/dist/commands/ingest.d.ts.map +1 -1
  242. package/dist/commands/ingest.js +148 -25
  243. package/dist/commands/ingest.js.map +1 -1
  244. package/dist/commands/init.d.ts +14 -0
  245. package/dist/commands/init.d.ts.map +1 -0
  246. package/dist/commands/init.js +117 -0
  247. package/dist/commands/init.js.map +1 -0
  248. package/dist/commands/login.d.ts +4 -0
  249. package/dist/commands/login.d.ts.map +1 -1
  250. package/dist/commands/login.js +101 -38
  251. package/dist/commands/login.js.map +1 -1
  252. package/dist/commands/orient.d.ts +107 -1
  253. package/dist/commands/orient.d.ts.map +1 -1
  254. package/dist/commands/orient.js +24 -8
  255. package/dist/commands/orient.js.map +1 -1
  256. package/dist/commands/profile.d.ts +24 -0
  257. package/dist/commands/profile.d.ts.map +1 -0
  258. package/dist/commands/profile.js +82 -0
  259. package/dist/commands/profile.js.map +1 -0
  260. package/dist/commands/promote.d.ts +12 -0
  261. package/dist/commands/promote.d.ts.map +1 -0
  262. package/dist/commands/promote.js +90 -0
  263. package/dist/commands/promote.js.map +1 -0
  264. package/dist/commands/proposals.d.ts +9 -0
  265. package/dist/commands/proposals.d.ts.map +1 -0
  266. package/dist/commands/proposals.js +24 -0
  267. package/dist/commands/proposals.js.map +1 -0
  268. package/dist/commands/reject.d.ts +14 -0
  269. package/dist/commands/reject.d.ts.map +1 -0
  270. package/dist/commands/reject.js +43 -0
  271. package/dist/commands/reject.js.map +1 -0
  272. package/dist/commands/relate.d.ts +16 -0
  273. package/dist/commands/relate.d.ts.map +1 -0
  274. package/dist/commands/relate.js +98 -0
  275. package/dist/commands/relate.js.map +1 -0
  276. package/dist/commands/search.d.ts +1 -0
  277. package/dist/commands/search.d.ts.map +1 -1
  278. package/dist/commands/search.js +5 -3
  279. package/dist/commands/search.js.map +1 -1
  280. package/dist/commands/session.d.ts +20 -0
  281. package/dist/commands/session.d.ts.map +1 -0
  282. package/dist/commands/session.js +148 -0
  283. package/dist/commands/session.js.map +1 -0
  284. package/dist/commands/setup.d.ts +15 -0
  285. package/dist/commands/setup.d.ts.map +1 -0
  286. package/dist/commands/setup.js +168 -0
  287. package/dist/commands/setup.js.map +1 -0
  288. package/dist/commands/update.d.ts +17 -0
  289. package/dist/commands/update.d.ts.map +1 -0
  290. package/dist/commands/update.js +178 -0
  291. package/dist/commands/update.js.map +1 -0
  292. package/dist/commands/verify.d.ts +13 -0
  293. package/dist/commands/verify.d.ts.map +1 -0
  294. package/dist/commands/verify.js +49 -0
  295. package/dist/commands/verify.js.map +1 -0
  296. package/dist/commands/workspace.d.ts +41 -0
  297. package/dist/commands/workspace.d.ts.map +1 -0
  298. package/dist/commands/workspace.js +239 -0
  299. package/dist/commands/workspace.js.map +1 -0
  300. package/dist/formatters/audit.d.ts +46 -0
  301. package/dist/formatters/audit.d.ts.map +1 -0
  302. package/dist/formatters/audit.js +81 -0
  303. package/dist/formatters/audit.js.map +1 -0
  304. package/dist/formatters/brief.d.ts +112 -0
  305. package/dist/formatters/brief.d.ts.map +1 -0
  306. package/dist/formatters/brief.js +179 -0
  307. package/dist/formatters/brief.js.map +1 -0
  308. package/dist/formatters/capture.d.ts +48 -0
  309. package/dist/formatters/capture.d.ts.map +1 -0
  310. package/dist/formatters/capture.js +77 -0
  311. package/dist/formatters/capture.js.map +1 -0
  312. package/dist/formatters/chain-walk.d.ts +33 -0
  313. package/dist/formatters/chain-walk.d.ts.map +1 -0
  314. package/dist/formatters/chain-walk.js +54 -0
  315. package/dist/formatters/chain-walk.js.map +1 -0
  316. package/dist/formatters/changes.d.ts +25 -0
  317. package/dist/formatters/changes.d.ts.map +1 -0
  318. package/dist/formatters/changes.js +60 -0
  319. package/dist/formatters/changes.js.map +1 -0
  320. package/dist/formatters/collections.d.ts +40 -0
  321. package/dist/formatters/collections.d.ts.map +1 -0
  322. package/dist/formatters/collections.js +93 -0
  323. package/dist/formatters/collections.js.map +1 -0
  324. package/dist/formatters/constellation.d.ts +34 -0
  325. package/dist/formatters/constellation.d.ts.map +1 -0
  326. package/dist/formatters/constellation.js +38 -0
  327. package/dist/formatters/constellation.js.map +1 -0
  328. package/dist/formatters/cross-cut.d.ts +21 -0
  329. package/dist/formatters/cross-cut.d.ts.map +1 -0
  330. package/dist/formatters/cross-cut.js +32 -0
  331. package/dist/formatters/cross-cut.js.map +1 -0
  332. package/dist/formatters/entry.d.ts +11 -4
  333. package/dist/formatters/entry.d.ts.map +1 -1
  334. package/dist/formatters/entry.js +24 -8
  335. package/dist/formatters/entry.js.map +1 -1
  336. package/dist/formatters/fields.d.ts +32 -0
  337. package/dist/formatters/fields.d.ts.map +1 -0
  338. package/dist/formatters/fields.js +49 -0
  339. package/dist/formatters/fields.js.map +1 -0
  340. package/dist/formatters/handshake.d.ts +24 -0
  341. package/dist/formatters/handshake.d.ts.map +1 -0
  342. package/dist/formatters/handshake.js +69 -0
  343. package/dist/formatters/handshake.js.map +1 -0
  344. package/dist/formatters/orient.d.ts +104 -1
  345. package/dist/formatters/orient.d.ts.map +1 -1
  346. package/dist/formatters/orient.js +140 -17
  347. package/dist/formatters/orient.js.map +1 -1
  348. package/dist/formatters/promote.d.ts +30 -0
  349. package/dist/formatters/promote.d.ts.map +1 -0
  350. package/dist/formatters/promote.js +39 -0
  351. package/dist/formatters/promote.js.map +1 -0
  352. package/dist/formatters/proposals.d.ts +45 -0
  353. package/dist/formatters/proposals.d.ts.map +1 -0
  354. package/dist/formatters/proposals.js +62 -0
  355. package/dist/formatters/proposals.js.map +1 -0
  356. package/dist/formatters/relate.d.ts +14 -0
  357. package/dist/formatters/relate.d.ts.map +1 -0
  358. package/dist/formatters/relate.js +16 -0
  359. package/dist/formatters/relate.js.map +1 -0
  360. package/dist/formatters/search.d.ts +0 -4
  361. package/dist/formatters/search.d.ts.map +1 -1
  362. package/dist/formatters/search.js +4 -1
  363. package/dist/formatters/search.js.map +1 -1
  364. package/dist/formatters/session.d.ts +11 -0
  365. package/dist/formatters/session.d.ts.map +1 -0
  366. package/dist/formatters/session.js +53 -0
  367. package/dist/formatters/session.js.map +1 -0
  368. package/dist/formatters/update.d.ts +17 -0
  369. package/dist/formatters/update.d.ts.map +1 -0
  370. package/dist/formatters/update.js +45 -0
  371. package/dist/formatters/update.js.map +1 -0
  372. package/dist/formatters/verify.d.ts +11 -0
  373. package/dist/formatters/verify.d.ts.map +1 -0
  374. package/dist/formatters/verify.js +11 -0
  375. package/dist/formatters/verify.js.map +1 -0
  376. package/dist/generators/__tests__/surface-profiles.test.d.ts +2 -0
  377. package/dist/generators/__tests__/surface-profiles.test.d.ts.map +1 -0
  378. package/dist/generators/__tests__/surface-profiles.test.js +89 -0
  379. package/dist/generators/__tests__/surface-profiles.test.js.map +1 -0
  380. package/dist/generators/adapters.d.ts +44 -0
  381. package/dist/generators/adapters.d.ts.map +1 -0
  382. package/dist/generators/adapters.js +290 -0
  383. package/dist/generators/adapters.js.map +1 -0
  384. package/dist/generators/adapters.test.d.ts +2 -0
  385. package/dist/generators/adapters.test.d.ts.map +1 -0
  386. package/dist/generators/adapters.test.js +27 -0
  387. package/dist/generators/adapters.test.js.map +1 -0
  388. package/dist/generators/archetypes.d.ts +52 -0
  389. package/dist/generators/archetypes.d.ts.map +1 -0
  390. package/dist/generators/archetypes.js +153 -0
  391. package/dist/generators/archetypes.js.map +1 -0
  392. package/dist/generators/archetypes.test.d.ts +2 -0
  393. package/dist/generators/archetypes.test.d.ts.map +1 -0
  394. package/dist/generators/archetypes.test.js +237 -0
  395. package/dist/generators/archetypes.test.js.map +1 -0
  396. package/dist/generators/briefing-md.d.ts +8 -0
  397. package/dist/generators/briefing-md.d.ts.map +1 -0
  398. package/dist/generators/briefing-md.js +51 -0
  399. package/dist/generators/briefing-md.js.map +1 -0
  400. package/dist/generators/chain-classifier.d.ts +49 -0
  401. package/dist/generators/chain-classifier.d.ts.map +1 -0
  402. package/dist/generators/chain-classifier.js +180 -0
  403. package/dist/generators/chain-classifier.js.map +1 -0
  404. package/dist/generators/chain-classifier.test.d.ts +2 -0
  405. package/dist/generators/chain-classifier.test.d.ts.map +1 -0
  406. package/dist/generators/chain-classifier.test.js +257 -0
  407. package/dist/generators/chain-classifier.test.js.map +1 -0
  408. package/dist/generators/chain-rules.d.ts +42 -0
  409. package/dist/generators/chain-rules.d.ts.map +1 -0
  410. package/dist/generators/chain-rules.js +144 -0
  411. package/dist/generators/chain-rules.js.map +1 -0
  412. package/dist/generators/chain-rules.test.d.ts +2 -0
  413. package/dist/generators/chain-rules.test.d.ts.map +1 -0
  414. package/dist/generators/chain-rules.test.js +179 -0
  415. package/dist/generators/chain-rules.test.js.map +1 -0
  416. package/dist/generators/context-md.d.ts +8 -0
  417. package/dist/generators/context-md.d.ts.map +1 -0
  418. package/dist/generators/context-md.js +134 -0
  419. package/dist/generators/context-md.js.map +1 -0
  420. package/dist/generators/handshake-diff.d.ts +67 -0
  421. package/dist/generators/handshake-diff.d.ts.map +1 -0
  422. package/dist/generators/handshake-diff.js +183 -0
  423. package/dist/generators/handshake-diff.js.map +1 -0
  424. package/dist/generators/handshake-diff.test.d.ts +2 -0
  425. package/dist/generators/handshake-diff.test.d.ts.map +1 -0
  426. package/dist/generators/handshake-diff.test.js +264 -0
  427. package/dist/generators/handshake-diff.test.js.map +1 -0
  428. package/dist/generators/portable-knowledge.d.ts +143 -0
  429. package/dist/generators/portable-knowledge.d.ts.map +1 -0
  430. package/dist/generators/portable-knowledge.js +504 -0
  431. package/dist/generators/portable-knowledge.js.map +1 -0
  432. package/dist/generators/portable-knowledge.test.d.ts +2 -0
  433. package/dist/generators/portable-knowledge.test.d.ts.map +1 -0
  434. package/dist/generators/portable-knowledge.test.js +927 -0
  435. package/dist/generators/portable-knowledge.test.js.map +1 -0
  436. package/dist/generators/surface-profiles.d.ts +49 -0
  437. package/dist/generators/surface-profiles.d.ts.map +1 -0
  438. package/dist/generators/surface-profiles.js +98 -0
  439. package/dist/generators/surface-profiles.js.map +1 -0
  440. package/dist/index.d.ts +3 -2
  441. package/dist/index.d.ts.map +1 -1
  442. package/dist/index.js +642 -37
  443. package/dist/index.js.map +1 -1
  444. package/dist/lib/activation.d.ts +28 -0
  445. package/dist/lib/activation.d.ts.map +1 -0
  446. package/dist/lib/activation.js +57 -0
  447. package/dist/lib/activation.js.map +1 -0
  448. package/dist/lib/activation.test.d.ts +6 -0
  449. package/dist/lib/activation.test.d.ts.map +1 -0
  450. package/dist/lib/activation.test.js +121 -0
  451. package/dist/lib/activation.test.js.map +1 -0
  452. package/dist/lib/client.d.ts +61 -0
  453. package/dist/lib/client.d.ts.map +1 -1
  454. package/dist/lib/client.js +258 -12
  455. package/dist/lib/client.js.map +1 -1
  456. package/dist/lib/config.d.ts +84 -4
  457. package/dist/lib/config.d.ts.map +1 -1
  458. package/dist/lib/config.js +322 -42
  459. package/dist/lib/config.js.map +1 -1
  460. package/dist/lib/constants.d.ts +42 -0
  461. package/dist/lib/constants.d.ts.map +1 -0
  462. package/dist/lib/constants.js +76 -0
  463. package/dist/lib/constants.js.map +1 -0
  464. package/dist/lib/conversation-engine.d.ts +45 -0
  465. package/dist/lib/conversation-engine.d.ts.map +1 -0
  466. package/dist/lib/conversation-engine.js +112 -0
  467. package/dist/lib/conversation-engine.js.map +1 -0
  468. package/dist/lib/conversation-phases.d.ts +59 -0
  469. package/dist/lib/conversation-phases.d.ts.map +1 -0
  470. package/dist/lib/conversation-phases.js +11 -0
  471. package/dist/lib/conversation-phases.js.map +1 -0
  472. package/dist/lib/conversation-signals.d.ts +30 -0
  473. package/dist/lib/conversation-signals.d.ts.map +1 -0
  474. package/dist/lib/conversation-signals.js +64 -0
  475. package/dist/lib/conversation-signals.js.map +1 -0
  476. package/dist/lib/deployment.d.ts +23 -0
  477. package/dist/lib/deployment.d.ts.map +1 -0
  478. package/dist/lib/deployment.js +78 -0
  479. package/dist/lib/deployment.js.map +1 -0
  480. package/dist/lib/deployment.test.d.ts +5 -0
  481. package/dist/lib/deployment.test.d.ts.map +1 -0
  482. package/dist/lib/deployment.test.js +54 -0
  483. package/dist/lib/deployment.test.js.map +1 -0
  484. package/dist/lib/errors.d.ts +58 -0
  485. package/dist/lib/errors.d.ts.map +1 -0
  486. package/dist/lib/errors.js +67 -0
  487. package/dist/lib/errors.js.map +1 -0
  488. package/dist/lib/experiment.d.ts +18 -0
  489. package/dist/lib/experiment.d.ts.map +1 -0
  490. package/dist/lib/experiment.js +28 -0
  491. package/dist/lib/experiment.js.map +1 -0
  492. package/dist/lib/format.d.ts +10 -0
  493. package/dist/lib/format.d.ts.map +1 -0
  494. package/dist/lib/format.js +27 -0
  495. package/dist/lib/format.js.map +1 -0
  496. package/dist/lib/glossary.d.ts +19 -0
  497. package/dist/lib/glossary.d.ts.map +1 -0
  498. package/dist/lib/glossary.js +53 -0
  499. package/dist/lib/glossary.js.map +1 -0
  500. package/dist/lib/onboarding-path-b.d.ts +10 -0
  501. package/dist/lib/onboarding-path-b.d.ts.map +1 -0
  502. package/dist/lib/onboarding-path-b.js +214 -0
  503. package/dist/lib/onboarding-path-b.js.map +1 -0
  504. package/dist/lib/onboarding-phases.d.ts +9 -0
  505. package/dist/lib/onboarding-phases.d.ts.map +1 -0
  506. package/dist/lib/onboarding-phases.js +120 -0
  507. package/dist/lib/onboarding-phases.js.map +1 -0
  508. package/dist/lib/onboarding-shared.d.ts +81 -0
  509. package/dist/lib/onboarding-shared.d.ts.map +1 -0
  510. package/dist/lib/onboarding-shared.js +190 -0
  511. package/dist/lib/onboarding-shared.js.map +1 -0
  512. package/dist/lib/onboarding-topics.d.ts +27 -0
  513. package/dist/lib/onboarding-topics.d.ts.map +1 -0
  514. package/dist/lib/onboarding-topics.js +57 -0
  515. package/dist/lib/onboarding-topics.js.map +1 -0
  516. package/dist/lib/onboarding.d.ts +17 -0
  517. package/dist/lib/onboarding.d.ts.map +1 -0
  518. package/dist/lib/onboarding.js +350 -0
  519. package/dist/lib/onboarding.js.map +1 -0
  520. package/dist/lib/profiles.d.ts +39 -0
  521. package/dist/lib/profiles.d.ts.map +1 -0
  522. package/dist/lib/profiles.js +185 -0
  523. package/dist/lib/profiles.js.map +1 -0
  524. package/dist/lib/prompts.d.ts +65 -0
  525. package/dist/lib/prompts.d.ts.map +1 -0
  526. package/dist/lib/prompts.js +132 -0
  527. package/dist/lib/prompts.js.map +1 -0
  528. package/dist/lib/repo-detect.d.ts +33 -0
  529. package/dist/lib/repo-detect.d.ts.map +1 -0
  530. package/dist/lib/repo-detect.js +83 -0
  531. package/dist/lib/repo-detect.js.map +1 -0
  532. package/dist/lib/runner.d.ts +33 -0
  533. package/dist/lib/runner.d.ts.map +1 -0
  534. package/dist/lib/runner.js +79 -0
  535. package/dist/lib/runner.js.map +1 -0
  536. package/dist/lib/session.d.ts +17 -0
  537. package/dist/lib/session.d.ts.map +1 -0
  538. package/dist/lib/session.js +43 -0
  539. package/dist/lib/session.js.map +1 -0
  540. package/dist/lib/spinner.d.ts +27 -0
  541. package/dist/lib/spinner.d.ts.map +1 -0
  542. package/dist/lib/spinner.js +76 -0
  543. package/dist/lib/spinner.js.map +1 -0
  544. package/dist/lib/spinner.test.d.ts +2 -0
  545. package/dist/lib/spinner.test.d.ts.map +1 -0
  546. package/dist/lib/spinner.test.js +39 -0
  547. package/dist/lib/spinner.test.js.map +1 -0
  548. package/dist/lib/strip.d.ts +12 -0
  549. package/dist/lib/strip.d.ts.map +1 -0
  550. package/dist/lib/strip.js +41 -0
  551. package/dist/lib/strip.js.map +1 -0
  552. package/dist/lib/style.d.ts +94 -0
  553. package/dist/lib/style.d.ts.map +1 -0
  554. package/dist/lib/style.js +167 -0
  555. package/dist/lib/style.js.map +1 -0
  556. package/dist/lib/style.test.d.ts +7 -0
  557. package/dist/lib/style.test.d.ts.map +1 -0
  558. package/dist/lib/style.test.js +263 -0
  559. package/dist/lib/style.test.js.map +1 -0
  560. package/dist/lib/telemetry.d.ts +15 -0
  561. package/dist/lib/telemetry.d.ts.map +1 -0
  562. package/dist/lib/telemetry.js +47 -0
  563. package/dist/lib/telemetry.js.map +1 -0
  564. package/dist/lib/tokenConstants.d.ts +17 -0
  565. package/dist/lib/tokenConstants.d.ts.map +1 -0
  566. package/dist/lib/tokenConstants.js +17 -0
  567. package/dist/lib/tokenConstants.js.map +1 -0
  568. package/dist/lib/wizard-surfaces.d.ts +47 -0
  569. package/dist/lib/wizard-surfaces.d.ts.map +1 -0
  570. package/dist/lib/wizard-surfaces.js +176 -0
  571. package/dist/lib/wizard-surfaces.js.map +1 -0
  572. package/dist/lib/wizard-surfaces.test.d.ts +2 -0
  573. package/dist/lib/wizard-surfaces.test.d.ts.map +1 -0
  574. package/dist/lib/wizard-surfaces.test.js +127 -0
  575. package/dist/lib/wizard-surfaces.test.js.map +1 -0
  576. package/dist/lib/wizard-trust.d.ts +31 -0
  577. package/dist/lib/wizard-trust.d.ts.map +1 -0
  578. package/dist/lib/wizard-trust.js +66 -0
  579. package/dist/lib/wizard-trust.js.map +1 -0
  580. package/dist/lib/wizard-trust.test.d.ts +2 -0
  581. package/dist/lib/wizard-trust.test.d.ts.map +1 -0
  582. package/dist/lib/wizard-trust.test.js +32 -0
  583. package/dist/lib/wizard-trust.test.js.map +1 -0
  584. package/dist/lib/workspace-probe.d.ts +16 -0
  585. package/dist/lib/workspace-probe.d.ts.map +1 -0
  586. package/dist/lib/workspace-probe.js +33 -0
  587. package/dist/lib/workspace-probe.js.map +1 -0
  588. package/package.json +13 -4
  589. package/templates/archetypes/boundary.md +23 -0
  590. package/templates/archetypes/constraint.md +23 -0
  591. package/templates/archetypes/convention.md +23 -0
  592. package/templates/archetypes/policy.md +23 -0
  593. package/templates/archetypes/quality-gate.md +23 -0
  594. package/templates/archetypes/workflow.md +23 -0
  595. package/templates/general/code-integrity.md +11 -0
  596. package/templates/general/getting-started.md +12 -0
  597. package/templates/node-ts/code-integrity.md +13 -0
  598. package/templates/node-ts/testing.md +12 -0
  599. package/templates/python/code-integrity.md +13 -0
  600. package/templates/python/testing.md +12 -0
package/dist/index.js CHANGED
@@ -1,19 +1,212 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Product Brain CLI — read-only Chain knowledge in the terminal.
4
- * BET-108 Slice 0: pb orient
3
+ * Product Brain CLI — Chain knowledge + write-back in the terminal.
4
+ * Read: BET-108. Write: pb session + pb capture (TEN-27, INS-80).
5
+ * BET-181 Slice 0: global --json / --pretty flags for agent-native output (DEC-299).
5
6
  */
6
- import { Command } from 'commander';
7
+ import { readFileSync } from 'node:fs';
8
+ import { dirname, join } from 'node:path';
9
+ import { fileURLToPath } from 'node:url';
10
+ import { Command, CommanderError } from 'commander';
11
+ const __dirname = dirname(fileURLToPath(import.meta.url));
12
+ const cliPackageVersion = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
13
+ import { setOutputMode, setQuietMode, isJsonMode } from './lib/runner.js';
14
+ import { CLIError, ErrorCode } from './lib/errors.js';
7
15
  import { runContext } from './commands/context.js';
8
- import { runGet } from './commands/get.js';
16
+ import { runGet, runGetMany } from './commands/get.js';
17
+ import { runConnect } from './commands/connect.js';
9
18
  import { runLogin } from './commands/login.js';
19
+ import { runSetup } from './commands/setup.js';
10
20
  import { runOrient } from './commands/orient.js';
11
21
  import { runSearch } from './commands/search.js';
22
+ import { runHandshake, runHandshakeInit } from './commands/handshake.js';
23
+ import { runSessionStart, runSessionClose, runSessionId } from './commands/session.js';
24
+ import { runCapture } from './commands/capture.js';
25
+ import { runUpdate } from './commands/update.js';
26
+ import { runRelate, runUnrelate } from './commands/relate.js';
27
+ import { runIngest } from './commands/ingest.js';
28
+ import { runFields } from './commands/fields.js';
29
+ import { runConstellation } from './commands/constellation.js';
30
+ import { runPromote } from './commands/promote.js';
31
+ import { runBrandPack } from './commands/brand-pack.js';
32
+ import { runAudit } from './commands/audit.js';
33
+ import { runProposals } from './commands/proposals.js';
34
+ import { runAccept } from './commands/accept.js';
35
+ import { runReject } from './commands/reject.js';
36
+ import { runChanges } from './commands/changes.js';
37
+ import { runChainWalk } from './commands/chain-walk.js';
38
+ import { runCrossCut } from './commands/cross-cut.js';
39
+ import { runBrief, runCompoundBrief, isCompoundType } from './commands/brief.js';
40
+ import { runVerify } from './commands/verify.js';
41
+ import { runCodexPrep } from './commands/codex-prep.js';
42
+ import { runCollectionsList, runCollectionsGet, runCollectionsAudit, runCollectionsExport } from './commands/collections.js';
43
+ import { runWorkspaceVerify, runWorkspaceRepair, runDefinitionsDiff } from './commands/workspace.js';
44
+ import { runDoctor } from './commands/doctor.js';
45
+ import { runProfileList, runProfileCreate, runProfileUse, runProfileDelete } from './commands/profile.js';
46
+ import { runInit } from './commands/init.js';
47
+ import { createAdminCommand } from './commands/admin/index.js';
48
+ import { GLOSSARY, formatGlossary } from './lib/glossary.js';
49
+ import { API_KEY_PREFIX } from './lib/tokenConstants.js';
50
+ import { hint, heading, bold, dim, green, icons } from './lib/style.js';
51
+ import { readSession } from './lib/session.js';
52
+ import { formatElapsed } from './lib/format.js';
53
+ import { probeWorkspace } from './lib/workspace-probe.js';
12
54
  const program = new Command();
55
+ /**
56
+ * Global error handler — single exit point for all CLI errors.
57
+ * CLIError: format with code + category + guidance.
58
+ * CommanderError: re-throw for --help / --version (exitCode 0), format others.
59
+ * Regular Error: wrap as INTERNAL.
60
+ */
61
+ function handleError(err) {
62
+ // Commander help/version exits with code 0 — let them through
63
+ if (err instanceof CommanderError && err.exitCode === 0) {
64
+ process.exit(0);
65
+ }
66
+ const json = isJsonMode();
67
+ if (err instanceof CLIError) {
68
+ if (json) {
69
+ process.stderr.write(JSON.stringify(err.toJSON()) + '\n');
70
+ }
71
+ else {
72
+ process.stderr.write(err.message + '\n');
73
+ if (err.guidance) {
74
+ process.stderr.write(err.guidance + '\n');
75
+ }
76
+ }
77
+ process.exit(1);
78
+ }
79
+ // CommanderError (bad usage, missing args, etc.)
80
+ if (err instanceof CommanderError) {
81
+ const cliErr = new CLIError(err.message, {
82
+ code: ErrorCode.VALIDATION_FAILED,
83
+ category: 'validation',
84
+ });
85
+ if (json) {
86
+ process.stderr.write(JSON.stringify(cliErr.toJSON()) + '\n');
87
+ }
88
+ else {
89
+ process.stderr.write(err.message + '\n');
90
+ }
91
+ process.exit(err.exitCode);
92
+ }
93
+ // Unknown / unstructured errors
94
+ const message = err instanceof Error ? err.message : String(err);
95
+ if (json) {
96
+ process.stderr.write(JSON.stringify({ error: message, code: 'INTERNAL', category: 'internal' }) + '\n');
97
+ }
98
+ else {
99
+ process.stderr.write(message + '\n');
100
+ }
101
+ process.exit(1);
102
+ }
13
103
  program
14
104
  .name('pb')
15
- .description('Product Brain — read-only CLI for Chain knowledge')
16
- .version('0.1.0');
105
+ .description('Product Brain — Chain knowledge + write-back CLI')
106
+ .version(cliPackageVersion.version)
107
+ // Global output mode flags (DEC-299, BET-181)
108
+ .option('--json', 'Output machine-readable JSON (overrides TTY auto-detection)')
109
+ .option('--pretty', 'Force human-readable output even when piped')
110
+ .option('-q, --quiet', 'Suppress non-essential output (banners, hints, progress)')
111
+ .exitOverride(); // Throw CommanderError instead of calling process.exit directly
112
+ // Apply global output mode BEFORE subcommand actions run
113
+ program.hook('preAction', (thisCommand) => {
114
+ const globalOpts = program.opts();
115
+ if (globalOpts.json) {
116
+ setOutputMode('json');
117
+ }
118
+ else if (globalOpts.pretty) {
119
+ setOutputMode('pretty');
120
+ }
121
+ // else: 'auto' (default) — TTY detection handles it
122
+ if (globalOpts.quiet) {
123
+ setQuietMode(true);
124
+ }
125
+ void thisCommand;
126
+ });
127
+ // Default action — status dashboard when `pb` is invoked with no command.
128
+ // `pb --help` still works because Commander intercepts --help before the action runs.
129
+ program.action(async () => {
130
+ // Check if we have a valid API key (sync, no network)
131
+ let hasKey = false;
132
+ let config = null;
133
+ try {
134
+ const { getConfig: gc } = await import('./lib/config.js');
135
+ config = gc();
136
+ hasKey = true;
137
+ }
138
+ catch {
139
+ // No valid key
140
+ }
141
+ // JSON mode: structured status
142
+ if (isJsonMode()) {
143
+ if (!hasKey) {
144
+ process.stdout.write(JSON.stringify({
145
+ configured: false,
146
+ hint: 'Run pb login to configure your API key.',
147
+ }) + '\n');
148
+ return;
149
+ }
150
+ const session = readSession();
151
+ const wsInfo = await probeWorkspace();
152
+ process.stdout.write(JSON.stringify({
153
+ configured: true,
154
+ workspace: wsInfo?.name ?? null,
155
+ session: session ? { id: session.sessionId, startedAt: session.startedAt } : null,
156
+ entryCount: wsInfo?.entryCount ?? null,
157
+ hint: 'Run pb --help for available commands.',
158
+ }) + '\n');
159
+ return;
160
+ }
161
+ // Human mode — not configured
162
+ if (!hasKey) {
163
+ process.stdout.write('\n');
164
+ process.stdout.write(`${bold('Product Brain')} ${dim('— not connected')}\n\n`);
165
+ process.stdout.write(`${heading('Get started')}\n\n`);
166
+ hint('1. pb login Save your API key');
167
+ hint('2. pb setup Connect a workspace');
168
+ hint('3. pb orient -b See what\'s happening');
169
+ process.stdout.write('\n');
170
+ hint('pb --help Show all commands');
171
+ process.stdout.write('\n');
172
+ return;
173
+ }
174
+ // Human mode — configured, try workspace probe
175
+ const session = readSession();
176
+ const wsInfo = await probeWorkspace();
177
+ const workspaceName = wsInfo?.name ?? null;
178
+ const entryCount = wsInfo?.entryCount ?? null;
179
+ const offline = !wsInfo;
180
+ process.stdout.write('\n');
181
+ if (offline) {
182
+ process.stdout.write(`${bold('Product Brain')} ${dim('— connected (offline)')}\n\n`);
183
+ process.stdout.write(` ${green(icons.pass)} Key: configured\n`);
184
+ process.stdout.write(` ${dim('Server: unreachable — check your connection')}\n\n`);
185
+ hint('pb doctor Diagnose connection issues');
186
+ hint('pb --help Show all commands');
187
+ process.stdout.write('\n');
188
+ return;
189
+ }
190
+ // Online with workspace
191
+ const title = workspaceName
192
+ ? `${bold('Product Brain')} ${dim('—')} ${bold(workspaceName)}`
193
+ : `${bold('Product Brain')}`;
194
+ process.stdout.write(`${title}\n\n`);
195
+ if (session) {
196
+ const elapsed = formatElapsed(session.startedAt);
197
+ process.stdout.write(` Session: active (started ${elapsed})\n`);
198
+ }
199
+ if (entryCount !== null && entryCount > 0) {
200
+ process.stdout.write(` Entries: ${entryCount}\n`);
201
+ }
202
+ process.stdout.write('\n');
203
+ if (!session) {
204
+ hint('pb session start Start a write session');
205
+ }
206
+ hint('pb orient -b Workspace overview');
207
+ hint('pb --help Show all commands');
208
+ process.stdout.write('\n');
209
+ });
17
210
  program
18
211
  .command('get <entry-id>')
19
212
  .description('Display full entry by ID (data, relations, last 10 history events)')
@@ -22,29 +215,84 @@ program
22
215
  program.commands.find((c) => c.name() === 'get')?.help();
23
216
  return;
24
217
  }
25
- try {
26
- await runGet({ entryId: entryId.trim() });
27
- }
28
- catch (err) {
29
- console.error(err instanceof Error ? err.message : String(err));
30
- process.exit(1);
31
- }
218
+ await runGet({ entryId: entryId.trim() });
219
+ });
220
+ program
221
+ .command('get-many <entry-ids...>')
222
+ .description('Fetch multiple entries in parallel (space-separated IDs)')
223
+ .action(async (entryIds) => {
224
+ await runGetMany({ entryIds: entryIds.map((id) => id.trim()).filter(Boolean) });
32
225
  });
33
226
  program
34
227
  .command('context <entry-id>')
35
- .description('Gather and display constellation context (pipe-friendly markdown when stdout is not a TTY)')
228
+ .description('Gather and display constellation context (pipe-friendly: JSON when piped, human text in terminal)')
36
229
  .action(async (entryId) => {
37
230
  if (!entryId?.trim()) {
38
231
  program.commands.find((c) => c.name() === 'context')?.help();
39
232
  return;
40
233
  }
41
- try {
42
- await runContext({ entryId: entryId.trim() });
234
+ await runContext({ entryId: entryId.trim() });
235
+ });
236
+ program
237
+ .command('changes')
238
+ .description('Detect entries modified and relations created since a given time (BET-239)')
239
+ .requiredOption('--since <duration>', 'Time window: 1h, 6h, 1d, 7d, 30d')
240
+ .action(async (opts) => {
241
+ await runChanges({ since: opts.since });
242
+ });
243
+ program
244
+ .command('walk <entry-id>')
245
+ .description('Directed deep traversal along one relation type to depth 4 (BET-239)')
246
+ .option('-d, --depth <n>', 'Traversal depth 1-4 (default 2)', '2')
247
+ .option('--direction <dir>', 'Traversal direction: outgoing or incoming (default outgoing)', 'outgoing')
248
+ .option('-t, --type <relation-type>', 'Filter by relation type (e.g. depends_on, informs, governs)')
249
+ .action(async (entryId, opts) => {
250
+ const depth = parseInt(opts.depth, 10);
251
+ if (isNaN(depth) || depth < 1 || depth > 4) {
252
+ throw new CLIError('--depth must be between 1 and 4.', {
253
+ code: ErrorCode.VALIDATION_FAILED,
254
+ category: 'validation',
255
+ });
43
256
  }
44
- catch (err) {
45
- console.error(err instanceof Error ? err.message : String(err));
46
- process.exit(1);
257
+ await runChainWalk({
258
+ entryId: entryId.trim(),
259
+ depth,
260
+ direction: opts.direction,
261
+ type: opts.type,
262
+ });
263
+ });
264
+ program
265
+ .command('cross-cut')
266
+ .description('Structural aggregation — all relations of a given type grouped by source collection (BET-239)')
267
+ .requiredOption('--type <relation-type>', 'Relation type to scan (e.g. part_of, informs, governs)')
268
+ .action(async (opts) => {
269
+ await runCrossCut({ type: opts.type });
270
+ });
271
+ program
272
+ .command('brief [type]')
273
+ .description('Brief intelligence queries (BET-239).\n' +
274
+ ' pb brief --skill <name> Incremental delta for a skill (E4)\n' +
275
+ ' pb brief steering Compound: changes + structure + delta + readiness (E6)\n' +
276
+ ' pb brief confidence Compound: changes + active bets + tensions (E6)\n' +
277
+ ' pb brief delta [--since] Compound: changes + relations since timestamp (E6)')
278
+ .option('--skill <name>', 'Skill name for incremental brief (e.g. preflight, shaping, review)')
279
+ .option('--since-last', 'Compare against last brief run (incremental mode)')
280
+ .option('--since <timestamp>', 'ISO 8601 timestamp for delta type (e.g. 2026-03-24T00:00:00Z)')
281
+ .action(async (type, opts) => {
282
+ // If positional arg is a compound type, route to compound brief
283
+ if (type && isCompoundType(type)) {
284
+ await runCompoundBrief({ type, since: opts.since });
285
+ return;
286
+ }
287
+ // Otherwise, require --skill for incremental brief
288
+ if (!opts.skill) {
289
+ throw new CLIError('Usage:\n' +
290
+ ' pb brief --skill <name> Incremental delta\n' +
291
+ ' pb brief steering Compound steering brief\n' +
292
+ ' pb brief confidence Compound confidence pass\n' +
293
+ ' pb brief delta Compound delta sync', { code: ErrorCode.VALIDATION_FAILED, category: 'validation' });
47
294
  }
295
+ await runBrief({ skill: opts.skill, sinceLast: opts.sinceLast });
48
296
  });
49
297
  program
50
298
  .command('search [query...]')
@@ -55,38 +303,395 @@ program
55
303
  program.commands.find((c) => c.name() === 'search')?.help();
56
304
  return;
57
305
  }
58
- try {
59
- await runSearch({ query });
60
- }
61
- catch (err) {
62
- console.error(err instanceof Error ? err.message : String(err));
63
- process.exit(1);
64
- }
306
+ await runSearch({ query });
65
307
  });
66
308
  program
67
309
  .command('orient')
68
310
  .description('Print workspace stage and all orient sections (strategic context, bets, governance, tensions, etc.)')
69
311
  .option('-b, --brief', 'Compact view: stage, counts, top bets, tensions, planned work')
312
+ .option('-t, --task <task>', 'Task description for task-shaped governance and context')
313
+ // SYNC: domain list must match TaskDomain in convex/agentKnowledge/startupResolver.ts
314
+ .option('-s, --scope <domain>', 'Domain scope for governance filtering. Valid values: auth, governance, architecture, product, data-foundation, chainwork, capture-pipeline, ingestion, intelligence-and-operations, review-and-learning, general')
70
315
  .action(async (opts) => {
71
- try {
72
- await runOrient({ brief: opts.brief });
316
+ await runOrient({ brief: opts.brief, task: opts.task?.trim() || undefined, scope: opts.scope?.trim() || undefined });
317
+ });
318
+ program
319
+ .command('handshake')
320
+ .description('Generate context files for AI developer tools (AGENTS.md, .codex/skills/, CLAUDE.md, .cursor/rules/, .github/copilot-instructions.md)')
321
+ .option('--force', 'Overwrite adapter files even if they exist without auto-generated marker')
322
+ .option('--dry-run', 'Show what would be generated without writing files')
323
+ .option('--init', 'Set up Claude Code integration: team hooks + personal trust level')
324
+ .option('--level <level>', 'With --init: trust level (guide|work|silent|full-trust). Without --init: content tier (beginner|intermediate|expert)')
325
+ .option('--generate', 'Fetch governance entries from the Chain and merge generated rules (BET-286)')
326
+ .option('--surfaces <list>', 'Comma-separated surfaces to write (cursor,claude,copilot,codex)')
327
+ .action(async (opts) => {
328
+ if (opts.init) {
329
+ await runHandshakeInit({ level: opts.level, dryRun: opts.dryRun });
330
+ return;
73
331
  }
74
- catch (err) {
75
- console.error(err instanceof Error ? err.message : String(err));
76
- process.exit(1);
332
+ await runHandshake({ force: opts.force, dryRun: opts.dryRun, level: opts.level, generate: opts.generate, surfaces: opts.surfaces?.split(',') });
333
+ });
334
+ program
335
+ .command('codex-prep <task...>')
336
+ .description('Generate task-specific governance context for Codex (.codex/task-context.md)')
337
+ .option('--dry-run', 'Print to stdout instead of writing file')
338
+ .action(async (taskParts, opts) => {
339
+ const task = taskParts.join(' ').trim();
340
+ if (!task) {
341
+ program.commands.find((c) => c.name() === 'codex-prep')?.help();
342
+ return;
77
343
  }
344
+ await runCodexPrep({ task, dryRun: opts.dryRun });
345
+ });
346
+ program
347
+ .command('init')
348
+ .description('Detect setup state and guide you through configuration (WP-303)')
349
+ .action(async () => {
350
+ await runInit();
351
+ });
352
+ program
353
+ .command('connect <token>')
354
+ .description('Redeem an onboarding token and save your API key locally (FEAT-958). Uses CONVEX_SITE_URL if set, otherwise the production gateway. Override with --gateway or PB_CONNECT_GATEWAY_URL.')
355
+ .option('--gateway <url>', 'Override redeem gateway (default: CONVEX_SITE_URL or production). Use when token came from a different Convex deployment.')
356
+ .action(async (token, opts) => {
357
+ if (!token?.trim()) {
358
+ program.commands.find((c) => c.name() === 'connect')?.help();
359
+ return;
360
+ }
361
+ await runConnect(token.trim(), { gateway: opts.gateway });
78
362
  });
79
363
  program
80
364
  .command('login')
81
365
  .description('Save your API key to ~/.config/productbrain/.env (works from any directory)')
82
366
  .action(async () => {
83
- try {
84
- await runLogin();
367
+ await runLogin();
368
+ });
369
+ program
370
+ .command('doctor')
371
+ .description('Check CLI configuration and connectivity')
372
+ .option('--fix', 'Auto-repair common configuration issues')
373
+ .option('--dry-run', 'Preview what --fix would do without changing anything')
374
+ .action(async (opts) => {
375
+ await runDoctor({ fix: opts.fix, dryRun: opts.dryRun });
376
+ });
377
+ program
378
+ .command('setup')
379
+ .description('Guided first-time setup: account, login, workspace, first capture')
380
+ .action(async () => {
381
+ await runSetup();
382
+ });
383
+ // --- Write commands (require active session) ---
384
+ const sessionCmd = program
385
+ .command('session')
386
+ .description('Manage write sessions (DEC-9: sessions required before write access)');
387
+ sessionCmd
388
+ .command('start')
389
+ .description('Start a tracked write session (opens session, refreshes context)')
390
+ .option('--json', 'Output machine-readable JSON (deprecated: use global --json flag)')
391
+ .action(async (opts) => {
392
+ await runSessionStart({ json: opts.json });
393
+ });
394
+ sessionCmd
395
+ .command('id')
396
+ .description('Print current session ID to stdout (machine-readable, TEN-707)')
397
+ .action(() => {
398
+ runSessionId();
399
+ });
400
+ sessionCmd
401
+ .command('close')
402
+ .description('Close the active session (wrapup, refresh context)')
403
+ .option('--force', 'Clear local session state even if server close fails')
404
+ .action(async (opts) => {
405
+ await runSessionClose({ force: opts.force });
406
+ });
407
+ program
408
+ .command('capture [text...]')
409
+ .description('Capture knowledge to the Chain (requires active session)')
410
+ .option('-n, --name <name>', 'Entry name (defaults to capture text)')
411
+ .option('-d, --description <desc>', 'Entry description (defaults to capture text)')
412
+ .option('-c, --collection <slug>', 'Explicit collection (skip auto-classification)')
413
+ .option('-l, --link <entry-id>', 'Link new entry to an existing entry (TEN-705)')
414
+ .option('-t, --type <relation-type>', 'Relation type for --link (default: surfaces_tension_in)')
415
+ .option('--source-ref <ref>', 'Source reference URI (BET-240 E2: e.g. "meeting-2026-03-28.md")')
416
+ .option('--source-excerpt <text>', 'Verbatim source excerpt (BET-240 E2)')
417
+ .option('--json', 'Output machine-readable JSON (deprecated: use global --json flag)')
418
+ .option('--suggest-only', 'Show grounding preview (possible duplicates, related entries) without creating entry (WP-319)')
419
+ .option('--strict', 'Prompt y/N before capturing when a possible duplicate is detected (WP-319)')
420
+ .action(async (textParts = [], opts) => {
421
+ const text = textParts.join(' ').trim();
422
+ if (!text && !opts.name) {
423
+ program.commands.find((c) => c.name() === 'capture')?.help();
424
+ return;
85
425
  }
86
- catch (err) {
87
- console.error(err instanceof Error ? err.message : String(err));
88
- process.exit(1);
426
+ await runCapture({
427
+ text: text || opts.name || '',
428
+ name: opts.name,
429
+ description: opts.description,
430
+ collection: opts.collection,
431
+ link: opts.link,
432
+ type: opts.type,
433
+ sourceRef: opts.sourceRef,
434
+ sourceExcerpt: opts.sourceExcerpt,
435
+ json: opts.json,
436
+ suggestOnly: opts.suggestOnly,
437
+ strict: opts.strict,
438
+ });
439
+ });
440
+ // --- Update command (TEN-703) ---
441
+ program
442
+ .command('update <entry-id>')
443
+ .description('Update fields on an existing Chain entry (requires active session)')
444
+ .option('-f, --field <key=value>', 'Set a data field (repeatable)', (val, prev) => [...prev, val], [])
445
+ .option('--name <name>', 'Update entry name')
446
+ .option('--status <status>', 'Update entry status (draft | active | deprecated | archived)')
447
+ .option('--workflow-status <status>', 'Set workflow status (server-validated)')
448
+ .option('--note <text>', 'Change note for history')
449
+ .action(async (entryId, opts) => {
450
+ await runUpdate({
451
+ entryId,
452
+ field: opts.field,
453
+ name: opts.name,
454
+ status: opts.status,
455
+ workflowStatus: opts.workflowStatus,
456
+ note: opts.note,
457
+ });
458
+ });
459
+ // --- Promote command (Wave 2 CLI Polish) ---
460
+ program
461
+ .command('verify <entry-id>')
462
+ .description('Mark an entry as verified (BET-240: source fidelity trust signal)')
463
+ .action(async (entryId) => {
464
+ if (!entryId?.trim()) {
465
+ program.commands.find((c) => c.name() === 'verify')?.help();
466
+ return;
467
+ }
468
+ await runVerify({ entryId: entryId.trim() });
469
+ });
470
+ program
471
+ .command('promote <entry-id>')
472
+ .description('Promote entry from draft to active (commit to SSOT)')
473
+ .option('-m, --message <text>', 'Commit message')
474
+ .action(async (entryId, opts) => {
475
+ await runPromote({ entryId, message: opts.message });
476
+ });
477
+ // --- Relate / Unrelate commands (TEN-704) ---
478
+ program
479
+ .command('relate <from-id> <type> <to-id>')
480
+ .description('Add a typed relation between two entries (requires active session)')
481
+ .option('--if-missing', 'Only create relation if it does not already exist')
482
+ .action(async (fromId, type, toId, opts) => {
483
+ await runRelate({ fromId, type, toId, ifMissing: opts.ifMissing });
484
+ });
485
+ program
486
+ .command('unrelate <from-id> <type> <to-id>')
487
+ .description('Remove a typed relation between two entries (requires active session)')
488
+ .action(async (fromId, type, toId) => {
489
+ await runUnrelate({ fromId, type, toId });
490
+ });
491
+ // --- Ingest command (BET-81) ---
492
+ program
493
+ .command('ingest <pattern>')
494
+ .description('Bulk ingest documents to Chain as drafts')
495
+ .option('--dry-run', 'Stage entries without auto-committing. Shows summary only.')
496
+ .option('--resume', 'Skip files whose sourceRef is already committed in staging.')
497
+ .option('--concurrency <n>', 'Process up to N files in parallel (default 1, max 5).', '1')
498
+ .action(async (pattern, opts) => {
499
+ const concurrency = parseInt(opts.concurrency ?? '1', 10);
500
+ if (Number.isNaN(concurrency) || concurrency < 1) {
501
+ throw new CLIError('--concurrency must be a positive integer.', {
502
+ code: ErrorCode.VALIDATION_FAILED,
503
+ category: 'validation',
504
+ });
505
+ }
506
+ await runIngest({
507
+ pattern,
508
+ dryRun: opts.dryRun,
509
+ resume: opts.resume,
510
+ concurrency,
511
+ });
512
+ });
513
+ // --- Fields command (BET-181 Slice 2) ---
514
+ program
515
+ .command('fields <collection>')
516
+ .description('List all field definitions for a collection (schema discovery for agents)')
517
+ .action(async (collection) => {
518
+ if (!collection?.trim()) {
519
+ program.commands.find((c) => c.name() === 'fields')?.help();
520
+ return;
521
+ }
522
+ await runFields({ collectionSlug: collection.trim() });
523
+ });
524
+ // --- Constellation command (BET-181 Slice 3) ---
525
+ program
526
+ .command('constellation <entry-id>')
527
+ .description('Compound view: entry + all related entries grouped by relation type (agent-native)')
528
+ .action(async (entryId) => {
529
+ if (!entryId?.trim()) {
530
+ program.commands.find((c) => c.name() === 'constellation')?.help();
531
+ return;
532
+ }
533
+ await runConstellation({ entryId: entryId.trim() });
534
+ });
535
+ // --- Audit command (BET-182 Slice 2) ---
536
+ program
537
+ .command('audit <entry-ids...>')
538
+ .description('Run STD-113 hygiene audit on bet(s) — 13 gates, exit code reflects verdict')
539
+ .option('--phase <phase>', 'Override phase detection (shaping | handoff)')
540
+ .option('--gate <name>', 'Run only specified gate(s) (repeatable)', (val, prev) => [...prev, val], [])
541
+ .option('--fix', 'Auto-execute exact fixes via pb update, rerun once')
542
+ .option('--verbose', 'Show all gates including PASS detail')
543
+ .action(async (entryIds, opts) => {
544
+ await runAudit({
545
+ entryIds: entryIds.map((id) => id.trim()).filter(Boolean),
546
+ phase: opts.phase,
547
+ gate: opts.gate,
548
+ fix: opts.fix,
549
+ verbose: opts.verbose,
550
+ });
551
+ });
552
+ program
553
+ .command('brand-pack')
554
+ .description('Internal marketing: structured community copy via OpenRouter (requires OPENROUTER_API_KEY). Forwards args to scripts/brand-pack.mjs')
555
+ .allowUnknownOption(true)
556
+ .allowExcessArguments(true)
557
+ .action(() => {
558
+ runBrandPack(process.argv);
559
+ });
560
+ // --- Governance proposal commands (BET-221 Slice 3) ---
561
+ program
562
+ .command('proposals')
563
+ .description('List open consent proposals with expiry countdown (BET-221)')
564
+ .action(async () => {
565
+ await runProposals();
566
+ });
567
+ program
568
+ .command('accept [proposal-id]')
569
+ .description('Approve a consent proposal by ID, or --auto to batch-approve all')
570
+ .option('-a, --auto', 'Auto-approve all open proposals (skip contradictions)')
571
+ .action(async (proposalId, opts) => {
572
+ if (!proposalId && !opts.auto) {
573
+ throw new CLIError('Usage: pb accept <proposal-id> or pb accept --auto', {
574
+ code: ErrorCode.VALIDATION_FAILED,
575
+ category: 'validation',
576
+ });
577
+ }
578
+ await runAccept({ proposalId, auto: opts.auto });
579
+ });
580
+ program
581
+ .command('reject <proposal-id>')
582
+ .description('Reject a consent proposal with a required reason (BR-7)')
583
+ .requiredOption('-r, --reason <text>', 'Reason for rejection (required)')
584
+ .action(async (proposalId, opts) => {
585
+ await runReject({ proposalId, reason: opts.reason });
586
+ });
587
+ // --- Collections command (BET-280 Slice 1) ---
588
+ const collectionsCmd = program
589
+ .command('collections')
590
+ .description('Inspect and audit workspace collection registry (BET-280)');
591
+ collectionsCmd
592
+ .command('list')
593
+ .description('List all collections — slug, name, field count, icon')
594
+ .action(async () => {
595
+ await runCollectionsList();
596
+ });
597
+ collectionsCmd
598
+ .command('get <slug>')
599
+ .description('Show full detail for a collection by slug')
600
+ .action(async (slug) => {
601
+ if (!slug?.trim()) {
602
+ program.commands.find((c) => c.name() === 'collections')?.help();
603
+ return;
604
+ }
605
+ await runCollectionsGet({ slug: slug.trim() });
606
+ });
607
+ collectionsCmd
608
+ .command('audit')
609
+ .description('Collection health report — classification, icon, displayHint coverage, schema gaps')
610
+ .action(async () => {
611
+ await runCollectionsAudit();
612
+ });
613
+ collectionsCmd
614
+ .command('export')
615
+ .description('Export all system_collection_definitions with full classification metadata (admin only)')
616
+ .action(async () => {
617
+ await runCollectionsExport();
618
+ });
619
+ // --- Workspace operator commands (WP-305 Slice 4) ---
620
+ const workspaceCmd = program
621
+ .command('workspace')
622
+ .description('Operator commands for workspace health and repair (WP-305)');
623
+ workspaceCmd
624
+ .command('verify')
625
+ .description('Check workspace health — seeds, collections, glossary (admin only)')
626
+ .action(async () => {
627
+ await runWorkspaceVerify();
628
+ });
629
+ workspaceCmd
630
+ .command('repair')
631
+ .description('Backfill missing seeds for the active workspace (admin only)')
632
+ .action(async () => {
633
+ await runWorkspaceRepair();
634
+ });
635
+ // --- Definitions diff command (WP-305 Slice 4) ---
636
+ const definitionsCmd = program
637
+ .command('definitions')
638
+ .description('Inspect and compare workspace definitions (WP-305)');
639
+ definitionsCmd
640
+ .command('diff [file]')
641
+ .description('Compare local dev-system-collections.json against server definitions (admin only)')
642
+ .action(async (file) => {
643
+ await runDefinitionsDiff({ file });
644
+ });
645
+ // --- Profile commands (WP-302 Slice 2) ---
646
+ const profileCmd = program
647
+ .command('profile')
648
+ .description('Manage workspace profiles (WP-302: multi-workspace support)');
649
+ profileCmd
650
+ .command('list')
651
+ .description('List all profiles, mark active one')
652
+ .action(async () => {
653
+ await runProfileList();
654
+ });
655
+ profileCmd
656
+ .command('create <name>')
657
+ .description('Create a new profile with an API key')
658
+ .requiredOption('--api-key <key>', `API key (${API_KEY_PREFIX}...)`)
659
+ .option('--url <url>', 'Convex site URL (defaults to production)')
660
+ .action(async (name, opts) => {
661
+ await runProfileCreate({ name, apiKey: opts.apiKey, url: opts.url });
662
+ });
663
+ profileCmd
664
+ .command('use <name>')
665
+ .description('Switch active profile (closes any active session)')
666
+ .action(async (name) => {
667
+ await runProfileUse({ name });
668
+ });
669
+ profileCmd
670
+ .command('delete <name>')
671
+ .description('Delete a profile (cannot delete active or last profile)')
672
+ .action(async (name) => {
673
+ await runProfileDelete({ name });
674
+ });
675
+ // --- Glossary command (WP-302 Slice 4) ---
676
+ program
677
+ .command('glossary')
678
+ .description('Show key Product Brain CLI terms and definitions')
679
+ .action(() => {
680
+ if (isJsonMode()) {
681
+ process.stdout.write(JSON.stringify(GLOSSARY) + '\n');
682
+ return;
89
683
  }
684
+ const lines = [
685
+ '',
686
+ heading('Glossary'),
687
+ '',
688
+ formatGlossary(),
689
+ '',
690
+ ];
691
+ process.stdout.write(lines.join('\n') + '\n');
90
692
  });
91
- program.parse();
693
+ // --- Admin command group (WP-312 S2, FEAT-969) ---
694
+ program.addCommand(createAdminCommand());
695
+ // Parse with global error handler — all uncaught errors route through handleError
696
+ program.parseAsync().catch(handleError);
92
697
  //# sourceMappingURL=index.js.map