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