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