@productbrain/cli 0.1.0-beta.94 → 0.1.0-beta.945
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/dist/__tests__/audit.test.js +5 -0
- package/dist/__tests__/audit.test.js.map +1 -1
- package/dist/__tests__/authority-domains.test.d.ts +2 -0
- package/dist/__tests__/authority-domains.test.d.ts.map +1 -0
- package/dist/__tests__/authority-domains.test.js +48 -0
- package/dist/__tests__/authority-domains.test.js.map +1 -0
- package/dist/__tests__/canonicalRefs.vocab.test.d.ts +2 -0
- package/dist/__tests__/canonicalRefs.vocab.test.d.ts.map +1 -0
- package/dist/__tests__/canonicalRefs.vocab.test.js +251 -0
- package/dist/__tests__/canonicalRefs.vocab.test.js.map +1 -0
- package/dist/__tests__/config.test.d.ts +1 -1
- package/dist/__tests__/config.test.js +410 -10
- package/dist/__tests__/config.test.js.map +1 -1
- package/dist/__tests__/constants.test.js +6 -1
- package/dist/__tests__/constants.test.js.map +1 -1
- package/dist/__tests__/envelope-contract.test.js +29 -3
- package/dist/__tests__/envelope-contract.test.js.map +1 -1
- package/dist/__tests__/errors.test.js +1 -0
- package/dist/__tests__/errors.test.js.map +1 -1
- package/dist/__tests__/handshake-augment.test.d.ts +2 -0
- package/dist/__tests__/handshake-augment.test.d.ts.map +1 -0
- package/dist/__tests__/handshake-augment.test.js +423 -0
- package/dist/__tests__/handshake-augment.test.js.map +1 -0
- package/dist/__tests__/handshake-dormancy.test.d.ts +2 -0
- package/dist/__tests__/handshake-dormancy.test.d.ts.map +1 -0
- package/dist/__tests__/handshake-dormancy.test.js +207 -0
- package/dist/__tests__/handshake-dormancy.test.js.map +1 -0
- package/dist/__tests__/handshake-formatter.test.d.ts +2 -0
- package/dist/__tests__/handshake-formatter.test.d.ts.map +1 -0
- package/dist/__tests__/handshake-formatter.test.js +67 -0
- package/dist/__tests__/handshake-formatter.test.js.map +1 -0
- package/dist/__tests__/handshake-preview.test.js +688 -3
- package/dist/__tests__/handshake-preview.test.js.map +1 -1
- package/dist/__tests__/handshake.e2e.test.d.ts +2 -0
- package/dist/__tests__/handshake.e2e.test.d.ts.map +1 -0
- package/dist/__tests__/handshake.e2e.test.js +1252 -0
- package/dist/__tests__/handshake.e2e.test.js.map +1 -0
- package/dist/__tests__/handshake.test.js +611 -2
- package/dist/__tests__/handshake.test.js.map +1 -1
- package/dist/__tests__/manifest.test.js +118 -1
- package/dist/__tests__/manifest.test.js.map +1 -1
- package/dist/__tests__/onboarding-path-b.test.js +4 -4
- package/dist/__tests__/onboarding-path-b.test.js.map +1 -1
- package/dist/__tests__/orient.test.js +135 -8
- package/dist/__tests__/orient.test.js.map +1 -1
- package/dist/__tests__/perimeter.test.d.ts +2 -0
- package/dist/__tests__/perimeter.test.d.ts.map +1 -0
- package/dist/__tests__/perimeter.test.js +165 -0
- package/dist/__tests__/perimeter.test.js.map +1 -0
- package/dist/__tests__/personal-layer.test.d.ts +1 -2
- package/dist/__tests__/personal-layer.test.d.ts.map +1 -1
- package/dist/__tests__/personal-layer.test.js +12 -48
- package/dist/__tests__/personal-layer.test.js.map +1 -1
- package/dist/__tests__/profiles.test.js +153 -5
- package/dist/__tests__/profiles.test.js.map +1 -1
- package/dist/__tests__/promote.test.js +71 -2
- package/dist/__tests__/promote.test.js.map +1 -1
- package/dist/__tests__/session-state-machine.test.js +45 -1
- package/dist/__tests__/session-state-machine.test.js.map +1 -1
- package/dist/__tests__/session-switch.test.d.ts +2 -0
- package/dist/__tests__/session-switch.test.d.ts.map +1 -0
- package/dist/__tests__/session-switch.test.js +129 -0
- package/dist/__tests__/session-switch.test.js.map +1 -0
- package/dist/__tests__/setup-ingest.test.d.ts +2 -0
- package/dist/__tests__/setup-ingest.test.d.ts.map +1 -0
- package/dist/__tests__/setup-ingest.test.js +71 -0
- package/dist/__tests__/setup-ingest.test.js.map +1 -0
- package/dist/__tests__/skill-vocabulary.test.d.ts +21 -0
- package/dist/__tests__/skill-vocabulary.test.d.ts.map +1 -0
- package/dist/__tests__/skill-vocabulary.test.js +187 -0
- package/dist/__tests__/skill-vocabulary.test.js.map +1 -0
- package/dist/__tests__/update-check.test.d.ts +2 -0
- package/dist/__tests__/update-check.test.d.ts.map +1 -0
- package/dist/__tests__/update-check.test.js +56 -0
- package/dist/__tests__/update-check.test.js.map +1 -0
- package/dist/__tests__/upgrade-runner.test.d.ts +2 -0
- package/dist/__tests__/upgrade-runner.test.d.ts.map +1 -0
- package/dist/__tests__/upgrade-runner.test.js +42 -0
- package/dist/__tests__/upgrade-runner.test.js.map +1 -0
- package/dist/__tests__/vocabulary-leak.test.d.ts +39 -0
- package/dist/__tests__/vocabulary-leak.test.d.ts.map +1 -0
- package/dist/__tests__/vocabulary-leak.test.js +534 -0
- package/dist/__tests__/vocabulary-leak.test.js.map +1 -0
- package/dist/__tests__/workspace.test.js +32 -12
- package/dist/__tests__/workspace.test.js.map +1 -1
- package/dist/commands/__tests__/connect-handoff.test.d.ts +11 -0
- package/dist/commands/__tests__/connect-handoff.test.d.ts.map +1 -0
- package/dist/commands/__tests__/connect-handoff.test.js +111 -0
- package/dist/commands/__tests__/connect-handoff.test.js.map +1 -0
- package/dist/commands/__tests__/setup-detect-surfaces.test.d.ts +15 -0
- package/dist/commands/__tests__/setup-detect-surfaces.test.d.ts.map +1 -0
- package/dist/commands/__tests__/setup-detect-surfaces.test.js +149 -0
- package/dist/commands/__tests__/setup-detect-surfaces.test.js.map +1 -0
- package/dist/commands/__tests__/setup-state.test.d.ts +2 -0
- package/dist/commands/__tests__/setup-state.test.d.ts.map +1 -0
- package/dist/commands/__tests__/setup-state.test.js +194 -0
- package/dist/commands/__tests__/setup-state.test.js.map +1 -0
- package/dist/commands/admin/seed.d.ts +46 -2
- package/dist/commands/admin/seed.d.ts.map +1 -1
- package/dist/commands/admin/seed.js +475 -33
- package/dist/commands/admin/seed.js.map +1 -1
- package/dist/commands/admin/seed.test.d.ts +5 -0
- package/dist/commands/admin/seed.test.d.ts.map +1 -1
- package/dist/commands/admin/seed.test.js +67 -2
- package/dist/commands/admin/seed.test.js.map +1 -1
- package/dist/commands/admin/seedRegistryEntries.generated.d.ts +14 -0
- package/dist/commands/admin/seedRegistryEntries.generated.d.ts.map +1 -0
- package/dist/commands/admin/seedRegistryEntries.generated.js +117 -0
- package/dist/commands/admin/seedRegistryEntries.generated.js.map +1 -0
- package/dist/commands/admin/seedRegistryEntries.test.d.ts +11 -0
- package/dist/commands/admin/seedRegistryEntries.test.d.ts.map +1 -0
- package/dist/commands/admin/seedRegistryEntries.test.js +67 -0
- package/dist/commands/admin/seedRegistryEntries.test.js.map +1 -0
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +30 -3
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/authority-domains.d.ts +146 -0
- package/dist/commands/authority-domains.d.ts.map +1 -0
- package/dist/commands/authority-domains.js +282 -0
- package/dist/commands/authority-domains.js.map +1 -0
- package/dist/commands/capture.d.ts.map +1 -1
- package/dist/commands/capture.js +3 -2
- package/dist/commands/capture.js.map +1 -1
- package/dist/commands/codex-prep.d.ts +1 -0
- package/dist/commands/codex-prep.d.ts.map +1 -1
- package/dist/commands/codex-prep.js +10 -7
- package/dist/commands/codex-prep.js.map +1 -1
- package/dist/commands/connect-config.test.d.ts +2 -0
- package/dist/commands/connect-config.test.d.ts.map +1 -0
- package/dist/commands/connect-config.test.js +44 -0
- package/dist/commands/connect-config.test.js.map +1 -0
- package/dist/commands/connect-context.d.ts +45 -0
- package/dist/commands/connect-context.d.ts.map +1 -0
- package/dist/commands/connect-context.js +64 -0
- package/dist/commands/connect-context.js.map +1 -0
- package/dist/commands/connect-context.test.d.ts +2 -0
- package/dist/commands/connect-context.test.d.ts.map +1 -0
- package/dist/commands/connect-context.test.js +110 -0
- package/dist/commands/connect-context.test.js.map +1 -0
- package/dist/commands/connect-handoff.d.ts +51 -0
- package/dist/commands/connect-handoff.d.ts.map +1 -0
- package/dist/commands/connect-handoff.js +70 -0
- package/dist/commands/connect-handoff.js.map +1 -0
- package/dist/commands/connect-integration.test.js +29 -12
- package/dist/commands/connect-integration.test.js.map +1 -1
- package/dist/commands/connect-screens.d.ts +6 -4
- package/dist/commands/connect-screens.d.ts.map +1 -1
- package/dist/commands/connect-screens.js +30 -19
- package/dist/commands/connect-screens.js.map +1 -1
- package/dist/commands/connect.d.ts +21 -6
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +78 -51
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/connect.test.js +64 -1
- package/dist/commands/connect.test.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +68 -3
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/doctor.test.js +131 -0
- package/dist/commands/doctor.test.js.map +1 -1
- package/dist/commands/handshake.d.ts +194 -2
- package/dist/commands/handshake.d.ts.map +1 -1
- package/dist/commands/handshake.js +1724 -45
- package/dist/commands/handshake.js.map +1 -1
- package/dist/commands/method.d.ts.map +1 -1
- package/dist/commands/method.js +3 -0
- package/dist/commands/method.js.map +1 -1
- package/dist/commands/migrate-setup.d.ts +18 -0
- package/dist/commands/migrate-setup.d.ts.map +1 -0
- package/dist/commands/migrate-setup.js +198 -0
- package/dist/commands/migrate-setup.js.map +1 -0
- package/dist/commands/orient.d.ts +15 -2
- package/dist/commands/orient.d.ts.map +1 -1
- package/dist/commands/orient.js +86 -4
- package/dist/commands/orient.js.map +1 -1
- package/dist/commands/profile.d.ts +11 -1
- package/dist/commands/profile.d.ts.map +1 -1
- package/dist/commands/profile.js +109 -26
- package/dist/commands/profile.js.map +1 -1
- package/dist/commands/promote.d.ts.map +1 -1
- package/dist/commands/promote.js +25 -2
- package/dist/commands/promote.js.map +1 -1
- package/dist/commands/relate.d.ts.map +1 -1
- package/dist/commands/relate.js +13 -0
- package/dist/commands/relate.js.map +1 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +55 -18
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/setup-audit.d.ts +59 -0
- package/dist/commands/setup-audit.d.ts.map +1 -0
- package/dist/commands/setup-audit.js +250 -0
- package/dist/commands/setup-audit.js.map +1 -0
- package/dist/commands/setup-detect-surfaces.d.ts +38 -0
- package/dist/commands/setup-detect-surfaces.d.ts.map +1 -0
- package/dist/commands/setup-detect-surfaces.js +76 -0
- package/dist/commands/setup-detect-surfaces.js.map +1 -0
- package/dist/commands/setup-ingest.d.ts +17 -0
- package/dist/commands/setup-ingest.d.ts.map +1 -0
- package/dist/commands/setup-ingest.js +226 -0
- package/dist/commands/setup-ingest.js.map +1 -0
- package/dist/commands/setup-state.d.ts +42 -0
- package/dist/commands/setup-state.d.ts.map +1 -0
- package/dist/commands/setup-state.js +93 -0
- package/dist/commands/setup-state.js.map +1 -0
- package/dist/commands/setup.d.ts +17 -9
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +52 -131
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/upgrade.d.ts +5 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +89 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/commands/whoami.d.ts +12 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +70 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/commands/whoami.test.d.ts +2 -0
- package/dist/commands/whoami.test.d.ts.map +1 -0
- package/dist/commands/whoami.test.js +50 -0
- package/dist/commands/whoami.test.js.map +1 -0
- package/dist/commands/workspace.d.ts +74 -2
- package/dist/commands/workspace.d.ts.map +1 -1
- package/dist/commands/workspace.js +26 -2
- package/dist/commands/workspace.js.map +1 -1
- package/dist/formatters/audit.d.ts +6 -0
- package/dist/formatters/audit.d.ts.map +1 -1
- package/dist/formatters/audit.js.map +1 -1
- package/dist/formatters/handshake.d.ts +19 -3
- package/dist/formatters/handshake.d.ts.map +1 -1
- package/dist/formatters/handshake.js +48 -13
- package/dist/formatters/handshake.js.map +1 -1
- package/dist/formatters/orient.d.ts +50 -4
- package/dist/formatters/orient.d.ts.map +1 -1
- package/dist/formatters/orient.js +64 -16
- package/dist/formatters/orient.js.map +1 -1
- package/dist/formatters/session.js +1 -1
- package/dist/formatters/session.js.map +1 -1
- package/dist/generators/adapters.js +2 -2
- package/dist/generators/boundary-manifest.d.ts +29 -0
- package/dist/generators/boundary-manifest.d.ts.map +1 -0
- package/dist/generators/boundary-manifest.js +183 -0
- package/dist/generators/boundary-manifest.js.map +1 -0
- package/dist/generators/boundary-manifest.test.d.ts +2 -0
- package/dist/generators/boundary-manifest.test.d.ts.map +1 -0
- package/dist/generators/boundary-manifest.test.js +91 -0
- package/dist/generators/boundary-manifest.test.js.map +1 -0
- package/dist/generators/context-md.js +6 -6
- package/dist/generators/context-md.js.map +1 -1
- package/dist/generators/manifest.d.ts +78 -0
- package/dist/generators/manifest.d.ts.map +1 -1
- package/dist/generators/manifest.js +125 -14
- package/dist/generators/manifest.js.map +1 -1
- package/dist/generators/portable-knowledge.d.ts +6 -12
- package/dist/generators/portable-knowledge.d.ts.map +1 -1
- package/dist/generators/portable-knowledge.js +2 -19
- package/dist/generators/portable-knowledge.js.map +1 -1
- package/dist/generators/region-projections.d.ts +18 -0
- package/dist/generators/region-projections.d.ts.map +1 -0
- package/dist/generators/region-projections.js +49 -0
- package/dist/generators/region-projections.js.map +1 -0
- package/dist/generators/region-projections.test.d.ts +2 -0
- package/dist/generators/region-projections.test.d.ts.map +1 -0
- package/dist/generators/region-projections.test.js +63 -0
- package/dist/generators/region-projections.test.js.map +1 -0
- package/dist/generators/region.d.ts +24 -0
- package/dist/generators/region.d.ts.map +1 -0
- package/dist/generators/region.js +87 -0
- package/dist/generators/region.js.map +1 -0
- package/dist/generators/region.test.d.ts +2 -0
- package/dist/generators/region.test.d.ts.map +1 -0
- package/dist/generators/region.test.js +126 -0
- package/dist/generators/region.test.js.map +1 -0
- package/dist/generators/surface-profiles.d.ts +1 -2
- package/dist/generators/surface-profiles.d.ts.map +1 -1
- package/dist/generators/surface-profiles.js.map +1 -1
- package/dist/index.js +242 -26
- package/dist/index.js.map +1 -1
- package/dist/lib/activation.d.ts.map +1 -1
- package/dist/lib/activation.js +3 -3
- package/dist/lib/activation.js.map +1 -1
- package/dist/lib/activation.test.js +3 -3
- package/dist/lib/activation.test.js.map +1 -1
- package/dist/lib/canonicalRefs.d.ts +141 -0
- package/dist/lib/canonicalRefs.d.ts.map +1 -0
- package/dist/lib/canonicalRefs.js +150 -0
- package/dist/lib/canonicalRefs.js.map +1 -0
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/client.js +14 -4
- package/dist/lib/client.js.map +1 -1
- package/dist/lib/config.d.ts +98 -9
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +231 -44
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/connectKeyLabel.d.ts +9 -0
- package/dist/lib/connectKeyLabel.d.ts.map +1 -0
- package/dist/lib/connectKeyLabel.js +12 -0
- package/dist/lib/connectKeyLabel.js.map +1 -0
- package/dist/lib/constants.d.ts +2 -0
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +2 -0
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/errors.d.ts +3 -0
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +3 -0
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/normalizeMaterializedFilename.d.ts +28 -0
- package/dist/lib/normalizeMaterializedFilename.d.ts.map +1 -0
- package/dist/lib/normalizeMaterializedFilename.js +56 -0
- package/dist/lib/normalizeMaterializedFilename.js.map +1 -0
- package/dist/lib/normalizeMaterializedFilename.test.d.ts +16 -0
- package/dist/lib/normalizeMaterializedFilename.test.d.ts.map +1 -0
- package/dist/lib/normalizeMaterializedFilename.test.js +90 -0
- package/dist/lib/normalizeMaterializedFilename.test.js.map +1 -0
- package/dist/lib/onboarding-path-b.d.ts.map +1 -1
- package/dist/lib/onboarding-path-b.js +0 -1
- package/dist/lib/onboarding-path-b.js.map +1 -1
- package/dist/lib/onboarding-shared.d.ts +0 -1
- package/dist/lib/onboarding-shared.d.ts.map +1 -1
- package/dist/lib/onboarding-shared.js +1 -17
- package/dist/lib/onboarding-shared.js.map +1 -1
- package/dist/lib/profiles.d.ts +3 -1
- package/dist/lib/profiles.d.ts.map +1 -1
- package/dist/lib/profiles.js +9 -6
- package/dist/lib/profiles.js.map +1 -1
- package/dist/lib/session.d.ts +10 -0
- package/dist/lib/session.d.ts.map +1 -1
- package/dist/lib/session.js +14 -0
- package/dist/lib/session.js.map +1 -1
- package/dist/lib/update-check.d.ts +20 -0
- package/dist/lib/update-check.d.ts.map +1 -1
- package/dist/lib/update-check.js +122 -21
- package/dist/lib/update-check.js.map +1 -1
- package/dist/lib/upgrade-runner.d.ts +21 -0
- package/dist/lib/upgrade-runner.d.ts.map +1 -0
- package/dist/lib/upgrade-runner.js +109 -0
- package/dist/lib/upgrade-runner.js.map +1 -0
- package/dist/lib/workspaceVocabCache.d.ts +60 -0
- package/dist/lib/workspaceVocabCache.d.ts.map +1 -0
- package/dist/lib/workspaceVocabCache.js +98 -0
- package/dist/lib/workspaceVocabCache.js.map +1 -0
- package/dist/setup/__tests__/coach-traces.test.d.ts +2 -0
- package/dist/setup/__tests__/coach-traces.test.d.ts.map +1 -0
- package/dist/setup/__tests__/coach-traces.test.js +189 -0
- package/dist/setup/__tests__/coach-traces.test.js.map +1 -0
- package/dist/setup/__tests__/setup-commands.test.d.ts +2 -0
- package/dist/setup/__tests__/setup-commands.test.d.ts.map +1 -0
- package/dist/setup/__tests__/setup-commands.test.js +177 -0
- package/dist/setup/__tests__/setup-commands.test.js.map +1 -0
- package/dist/setup/__tests__/state-machine.test.d.ts +2 -0
- package/dist/setup/__tests__/state-machine.test.d.ts.map +1 -0
- package/dist/setup/__tests__/state-machine.test.js +341 -0
- package/dist/setup/__tests__/state-machine.test.js.map +1 -0
- package/dist/setup/detect-surfaces.d.ts +21 -0
- package/dist/setup/detect-surfaces.d.ts.map +1 -0
- package/dist/setup/detect-surfaces.js +39 -0
- package/dist/setup/detect-surfaces.js.map +1 -0
- package/dist/setup/manifest-writer.d.ts +17 -0
- package/dist/setup/manifest-writer.d.ts.map +1 -0
- package/dist/setup/manifest-writer.js +153 -0
- package/dist/setup/manifest-writer.js.map +1 -0
- package/dist/setup/perimeter.d.ts +72 -0
- package/dist/setup/perimeter.d.ts.map +1 -0
- package/dist/setup/perimeter.js +128 -0
- package/dist/setup/perimeter.js.map +1 -0
- package/dist/setup/state-machine.d.ts +67 -0
- package/dist/setup/state-machine.d.ts.map +1 -0
- package/dist/setup/state-machine.js +124 -0
- package/dist/setup/state-machine.js.map +1 -0
- package/dist/surfaces/__tests__/adapter.test.d.ts +2 -0
- package/dist/surfaces/__tests__/adapter.test.d.ts.map +1 -0
- package/dist/surfaces/__tests__/adapter.test.js +90 -0
- package/dist/surfaces/__tests__/adapter.test.js.map +1 -0
- package/dist/surfaces/__tests__/pb-setup-passthrough.test.d.ts +2 -0
- package/dist/surfaces/__tests__/pb-setup-passthrough.test.d.ts.map +1 -0
- package/dist/surfaces/__tests__/pb-setup-passthrough.test.js +132 -0
- package/dist/surfaces/__tests__/pb-setup-passthrough.test.js.map +1 -0
- package/dist/surfaces/__tests__/telemetry.test.d.ts +2 -0
- package/dist/surfaces/__tests__/telemetry.test.d.ts.map +1 -0
- package/dist/surfaces/__tests__/telemetry.test.js +55 -0
- package/dist/surfaces/__tests__/telemetry.test.js.map +1 -0
- package/dist/surfaces/adapter.d.ts +70 -0
- package/dist/surfaces/adapter.d.ts.map +1 -0
- package/dist/surfaces/adapter.js +2 -0
- package/dist/surfaces/adapter.js.map +1 -0
- package/dist/surfaces/adapters/claude.d.ts +3 -0
- package/dist/surfaces/adapters/claude.d.ts.map +1 -0
- package/dist/surfaces/adapters/claude.js +67 -0
- package/dist/surfaces/adapters/claude.js.map +1 -0
- package/dist/surfaces/adapters/codex.d.ts +3 -0
- package/dist/surfaces/adapters/codex.d.ts.map +1 -0
- package/dist/surfaces/adapters/codex.js +61 -0
- package/dist/surfaces/adapters/codex.js.map +1 -0
- package/dist/surfaces/adapters/copilot.d.ts +3 -0
- package/dist/surfaces/adapters/copilot.d.ts.map +1 -0
- package/dist/surfaces/adapters/copilot.js +59 -0
- package/dist/surfaces/adapters/copilot.js.map +1 -0
- package/dist/surfaces/adapters/cursor.d.ts +3 -0
- package/dist/surfaces/adapters/cursor.d.ts.map +1 -0
- package/dist/surfaces/adapters/cursor.js +78 -0
- package/dist/surfaces/adapters/cursor.js.map +1 -0
- package/dist/surfaces/registry.d.ts +58 -2
- package/dist/surfaces/registry.d.ts.map +1 -1
- package/dist/surfaces/registry.js +82 -7
- package/dist/surfaces/registry.js.map +1 -1
- package/dist/surfaces/telemetry.d.ts +17 -0
- package/dist/surfaces/telemetry.d.ts.map +1 -0
- package/dist/surfaces/telemetry.js +31 -0
- package/dist/surfaces/telemetry.js.map +1 -0
- package/package.json +3 -1
- package/dist/__tests__/setup.test.d.ts +0 -2
- package/dist/__tests__/setup.test.d.ts.map +0 -1
- package/dist/__tests__/setup.test.js +0 -141
- package/dist/__tests__/setup.test.js.map +0 -1
- package/dist/generators/__tests__/surface-profiles.test.d.ts +0 -2
- package/dist/generators/__tests__/surface-profiles.test.d.ts.map +0 -1
- package/dist/generators/__tests__/surface-profiles.test.js +0 -89
- package/dist/generators/__tests__/surface-profiles.test.js.map +0 -1
- package/dist/lib/onboarding-phases.d.ts +0 -9
- package/dist/lib/onboarding-phases.d.ts.map +0 -1
- package/dist/lib/onboarding-phases.js +0 -120
- package/dist/lib/onboarding-phases.js.map +0 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synced from convex/lib/canonicalRefs.ts (WP-345: canonical refs, NG4: CLI import boundary).
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Canonical Refs — pure parser for semantic ref syntax.
|
|
6
|
+
*
|
|
7
|
+
* Zero Convex imports. This file is drift-synced to:
|
|
8
|
+
* - packages/cli/src/lib/canonicalRefs.ts (CLI copy — identical logic)
|
|
9
|
+
* - packages/mcp-server/src/lib/canonicalRefs.ts (MCP copy — identical logic)
|
|
10
|
+
*
|
|
11
|
+
* NG4 (WP-345): CLI/MCP MUST NOT import the resolver (convex/canonicalRefs.ts).
|
|
12
|
+
* They import only this pure parser module.
|
|
13
|
+
*
|
|
14
|
+
* DEC-A/WP-354: semantic refs syntax is {{ref:canonicalKey}},
|
|
15
|
+
* {{ref:canonicalKey:display}}, {{ref:domain:data/analytics}}, or
|
|
16
|
+
* {{ref:entry:DEC-123}}.
|
|
17
|
+
* Chain: WP-345 E4, DEC-K (projection hash trailer)
|
|
18
|
+
*
|
|
19
|
+
* WP-436 S1 — Axis 2 vocabulary resolver (DEC-1021, STD-253):
|
|
20
|
+
* {{vocab:<canonicalKey>.<form>}} tokens + getCollectionLabel resolver.
|
|
21
|
+
* PAT-230: resolver is pure — no Convex import, workspace context passed as arg.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* WP-354 Build-Order #6: Setup-ref resolver return shape.
|
|
25
|
+
*
|
|
26
|
+
* All consumers (CLI, MCP, handshake, editor health) must read
|
|
27
|
+
* the discriminated kind+status fields instead of an optional resolved object.
|
|
28
|
+
*
|
|
29
|
+
* Spec: docs/system/design/authority-domains-design-spec.md §632
|
|
30
|
+
* Chain: WP-354 Slice H, STD-101 (single source of truth)
|
|
31
|
+
*
|
|
32
|
+
* drift-synced to:
|
|
33
|
+
* - packages/cli/src/lib/canonicalRefs.ts
|
|
34
|
+
* - packages/mcp-server/src/lib/canonicalRefs.ts
|
|
35
|
+
*/
|
|
36
|
+
export type SetupRefResolution = {
|
|
37
|
+
ref: string;
|
|
38
|
+
kind: 'entry' | 'domain' | 'seed' | 'unknown';
|
|
39
|
+
status: 'resolved' | 'unresolved' | 'unsupported-future' | 'invalid';
|
|
40
|
+
/** Human-readable entryId (e.g. 'BR-5'). Only when status='resolved' for kind='entry' or 'domain'. */
|
|
41
|
+
localEntryId?: string;
|
|
42
|
+
/** Domain slug (e.g. 'engineering/backend'). Only when kind='domain' and status='resolved'. */
|
|
43
|
+
canonicalSlug?: string;
|
|
44
|
+
/** true when kind is 'entry' or 'domain'; false for seed/unknown */
|
|
45
|
+
required: boolean;
|
|
46
|
+
message?: string;
|
|
47
|
+
action?: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Extracts canonical keys from a body string.
|
|
51
|
+
* Handles {{ref:key}} and {{ref:key:display}}.
|
|
52
|
+
*
|
|
53
|
+
* Returns deduplicated array of canonical keys in order of first appearance.
|
|
54
|
+
*/
|
|
55
|
+
export declare function parseSemanticRefs(body: string): string[];
|
|
56
|
+
/**
|
|
57
|
+
* Renders a resolved ref for display in projected output.
|
|
58
|
+
* Falls back to the raw key wrapped in brackets if no resolved name is available.
|
|
59
|
+
*
|
|
60
|
+
* Examples:
|
|
61
|
+
* renderSemanticRef('bet', 'Active Bets') → 'Active Bets'
|
|
62
|
+
* renderSemanticRef('bet') → '[bet]'
|
|
63
|
+
* renderSemanticRef('bet', undefined) → '[bet]'
|
|
64
|
+
*/
|
|
65
|
+
export declare function renderSemanticRef(key: string, resolvedName?: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Replaces all semantic refs in a body string with their resolved display names.
|
|
68
|
+
*
|
|
69
|
+
* resolvedMap: Map<canonicalKey, resolvedName> — keys not in the map are rendered
|
|
70
|
+
* as [unresolved: key] to make missing refs visible.
|
|
71
|
+
*/
|
|
72
|
+
export declare function replaceSemanticRefs(body: string, resolvedMap: Map<string, string>): string;
|
|
73
|
+
/**
|
|
74
|
+
* Label set for a single canonical type (Axis 2, DEC-1021).
|
|
75
|
+
* All fields optional — undefined means "derive from next layer".
|
|
76
|
+
*/
|
|
77
|
+
export type LabelSet = {
|
|
78
|
+
singular?: string;
|
|
79
|
+
plural?: string;
|
|
80
|
+
verb_start?: string;
|
|
81
|
+
verb_commit?: string;
|
|
82
|
+
verb_review?: string;
|
|
83
|
+
verb_complete?: string;
|
|
84
|
+
verb_archive?: string;
|
|
85
|
+
};
|
|
86
|
+
/** Valid form names for a LabelSet. */
|
|
87
|
+
export type LabelForm = keyof LabelSet;
|
|
88
|
+
/**
|
|
89
|
+
* Minimal workspace context for Axis 2 resolution.
|
|
90
|
+
* Passed by the caller — keeps the resolver pure (PAT-230).
|
|
91
|
+
*/
|
|
92
|
+
export type WorkspaceVocabCtx = {
|
|
93
|
+
/** Per-workspace overrides: canonicalKey → LabelSet (partial). */
|
|
94
|
+
collectionLabels?: Record<string, LabelSet | undefined>;
|
|
95
|
+
/**
|
|
96
|
+
* Layer 2 defaults from system_collection_definitions.labels, keyed by canonicalKey.
|
|
97
|
+
* Fetched via chain.getVocabulary collectionDefaults and threaded through by the caller.
|
|
98
|
+
* Used as fallback when no workspace override exists and collectionCtx is not passed.
|
|
99
|
+
* WP-436 completion — wires dead Layer 2 to consumers.
|
|
100
|
+
*/
|
|
101
|
+
collectionDefaults?: Record<string, LabelSet | undefined>;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Minimal collection context for Axis 2 resolution.
|
|
105
|
+
* Passed by the caller — keeps the resolver pure (PAT-230).
|
|
106
|
+
*/
|
|
107
|
+
export type CollectionVocabCtx = {
|
|
108
|
+
/** Collection-level default labels (from system_collection_definitions.labels). */
|
|
109
|
+
labels?: LabelSet;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Regex for matching vocab tokens: {{vocab:<canonicalKey>.<form>}}
|
|
113
|
+
* STD-253: canonicalKey + form are both lowercase snake_case.
|
|
114
|
+
* Captures: [1] canonicalKey, [2] form.
|
|
115
|
+
*/
|
|
116
|
+
export declare const VOCAB_TOKEN_REGEX: RegExp;
|
|
117
|
+
/**
|
|
118
|
+
* Resolve the display label for a canonical type + form.
|
|
119
|
+
*
|
|
120
|
+
* Resolution chain (DEC-1021):
|
|
121
|
+
* 1. workspaceCtx.collectionLabels[canonicalKey][form] — workspace override
|
|
122
|
+
* 2. collectionCtx.labels[form] — collection default
|
|
123
|
+
* 3. canonicalKey literal — fallback (no throw)
|
|
124
|
+
*
|
|
125
|
+
* Pure function. No Convex imports. No side effects. (PAT-230)
|
|
126
|
+
*
|
|
127
|
+
* @param canonicalKey - e.g. 'work_package', 'decision'
|
|
128
|
+
* @param form - e.g. 'singular', 'plural', 'verb_start'
|
|
129
|
+
* @param workspaceCtx - optional workspace-level override context
|
|
130
|
+
* @param collectionCtx - optional collection-level default context
|
|
131
|
+
* @returns resolved label string
|
|
132
|
+
*/
|
|
133
|
+
export declare function getCollectionLabel(canonicalKey: string, form: string, workspaceCtx?: WorkspaceVocabCtx, collectionCtx?: CollectionVocabCtx): string;
|
|
134
|
+
/**
|
|
135
|
+
* Replace all {{vocab:<canonicalKey>.<form>}} tokens in a string.
|
|
136
|
+
*
|
|
137
|
+
* For each token, calls getCollectionLabel with the provided contexts.
|
|
138
|
+
* STD-253.
|
|
139
|
+
*/
|
|
140
|
+
export declare function replaceVocabTokens(body: string, workspaceCtx?: WorkspaceVocabCtx, collectionCtxMap?: Map<string, CollectionVocabCtx>): string;
|
|
141
|
+
//# sourceMappingURL=canonicalRefs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonicalRefs.d.ts","sourceRoot":"","sources":["../../src/lib/canonicalRefs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;IAC9C,MAAM,EACH,UAAU,GACV,YAAY,GACZ,oBAAoB,GACpB,SAAS,CACV;IACF,sGAAsG;IACtG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+FAA+F;IAC/F,aAAa,CAAC,EAAE,MAAM,CAA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AAO,MAAM,iBAAiB,QAAwC,CAAC;AAEvE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CACjC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,iBAAiB,EAChC,aAAa,CAAC,EAAE,kBAAkB,GAChC,MAAM,CAyBR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,iBAAiB,EAChC,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAChD,MAAM,CASR"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synced from convex/lib/canonicalRefs.ts (WP-345: canonical refs, NG4: CLI import boundary).
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Canonical Refs — pure parser for semantic ref syntax.
|
|
6
|
+
*
|
|
7
|
+
* Zero Convex imports. This file is drift-synced to:
|
|
8
|
+
* - packages/cli/src/lib/canonicalRefs.ts (CLI copy — identical logic)
|
|
9
|
+
* - packages/mcp-server/src/lib/canonicalRefs.ts (MCP copy — identical logic)
|
|
10
|
+
*
|
|
11
|
+
* NG4 (WP-345): CLI/MCP MUST NOT import the resolver (convex/canonicalRefs.ts).
|
|
12
|
+
* They import only this pure parser module.
|
|
13
|
+
*
|
|
14
|
+
* DEC-A/WP-354: semantic refs syntax is {{ref:canonicalKey}},
|
|
15
|
+
* {{ref:canonicalKey:display}}, {{ref:domain:data/analytics}}, or
|
|
16
|
+
* {{ref:entry:DEC-123}}.
|
|
17
|
+
* Chain: WP-345 E4, DEC-K (projection hash trailer)
|
|
18
|
+
*
|
|
19
|
+
* WP-436 S1 — Axis 2 vocabulary resolver (DEC-1021, STD-253):
|
|
20
|
+
* {{vocab:<canonicalKey>.<form>}} tokens + getCollectionLabel resolver.
|
|
21
|
+
* PAT-230: resolver is pure — no Convex import, workspace context passed as arg.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Regex for matching semantic refs. Captures: [1] ref key/path, [2] optional display label.
|
|
25
|
+
*/
|
|
26
|
+
const SEMANTIC_REF_REGEX = /\{\{ref:([a-zA-Z0-9_./-]+(?::[a-zA-Z0-9_./-]+)?)(?::([^}]+))?\}\}/g;
|
|
27
|
+
/**
|
|
28
|
+
* Extracts canonical keys from a body string.
|
|
29
|
+
* Handles {{ref:key}} and {{ref:key:display}}.
|
|
30
|
+
*
|
|
31
|
+
* Returns deduplicated array of canonical keys in order of first appearance.
|
|
32
|
+
*/
|
|
33
|
+
export function parseSemanticRefs(body) {
|
|
34
|
+
if (!body || body.length === 0)
|
|
35
|
+
return [];
|
|
36
|
+
const keys = [];
|
|
37
|
+
const seen = new Set();
|
|
38
|
+
// Reset lastIndex for global regex before each use
|
|
39
|
+
const regex = new RegExp(SEMANTIC_REF_REGEX.source, 'g');
|
|
40
|
+
let match;
|
|
41
|
+
while ((match = regex.exec(body)) !== null) {
|
|
42
|
+
const key = match[1];
|
|
43
|
+
if (key && !seen.has(key)) {
|
|
44
|
+
seen.add(key);
|
|
45
|
+
keys.push(key);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return keys;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Renders a resolved ref for display in projected output.
|
|
52
|
+
* Falls back to the raw key wrapped in brackets if no resolved name is available.
|
|
53
|
+
*
|
|
54
|
+
* Examples:
|
|
55
|
+
* renderSemanticRef('bet', 'Active Bets') → 'Active Bets'
|
|
56
|
+
* renderSemanticRef('bet') → '[bet]'
|
|
57
|
+
* renderSemanticRef('bet', undefined) → '[bet]'
|
|
58
|
+
*/
|
|
59
|
+
export function renderSemanticRef(key, resolvedName) {
|
|
60
|
+
if (resolvedName && resolvedName.trim().length > 0) {
|
|
61
|
+
return resolvedName.trim();
|
|
62
|
+
}
|
|
63
|
+
return `[${key}]`;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Replaces all semantic refs in a body string with their resolved display names.
|
|
67
|
+
*
|
|
68
|
+
* resolvedMap: Map<canonicalKey, resolvedName> — keys not in the map are rendered
|
|
69
|
+
* as [unresolved: key] to make missing refs visible.
|
|
70
|
+
*/
|
|
71
|
+
export function replaceSemanticRefs(body, resolvedMap) {
|
|
72
|
+
if (!body || body.length === 0)
|
|
73
|
+
return body;
|
|
74
|
+
const regex = new RegExp(SEMANTIC_REF_REGEX.source, 'g');
|
|
75
|
+
return body.replace(regex, (_match, key, displayLabel) => {
|
|
76
|
+
// If an inline display label is provided, it takes precedence over the resolved name
|
|
77
|
+
if (displayLabel && displayLabel.trim().length > 0) {
|
|
78
|
+
return displayLabel.trim();
|
|
79
|
+
}
|
|
80
|
+
const resolved = resolvedMap.get(key);
|
|
81
|
+
if (resolved) {
|
|
82
|
+
return resolved;
|
|
83
|
+
}
|
|
84
|
+
return `[unresolved: ${key}]`;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Regex for matching vocab tokens: {{vocab:<canonicalKey>.<form>}}
|
|
89
|
+
* STD-253: canonicalKey + form are both lowercase snake_case.
|
|
90
|
+
* Captures: [1] canonicalKey, [2] form.
|
|
91
|
+
*/
|
|
92
|
+
export const VOCAB_TOKEN_REGEX = /\{\{vocab:([a-z_]+)\.([a-z_]+)\}\}/g;
|
|
93
|
+
/**
|
|
94
|
+
* Resolve the display label for a canonical type + form.
|
|
95
|
+
*
|
|
96
|
+
* Resolution chain (DEC-1021):
|
|
97
|
+
* 1. workspaceCtx.collectionLabels[canonicalKey][form] — workspace override
|
|
98
|
+
* 2. collectionCtx.labels[form] — collection default
|
|
99
|
+
* 3. canonicalKey literal — fallback (no throw)
|
|
100
|
+
*
|
|
101
|
+
* Pure function. No Convex imports. No side effects. (PAT-230)
|
|
102
|
+
*
|
|
103
|
+
* @param canonicalKey - e.g. 'work_package', 'decision'
|
|
104
|
+
* @param form - e.g. 'singular', 'plural', 'verb_start'
|
|
105
|
+
* @param workspaceCtx - optional workspace-level override context
|
|
106
|
+
* @param collectionCtx - optional collection-level default context
|
|
107
|
+
* @returns resolved label string
|
|
108
|
+
*/
|
|
109
|
+
export function getCollectionLabel(canonicalKey, form, workspaceCtx, collectionCtx) {
|
|
110
|
+
// Layer 1: workspace override
|
|
111
|
+
const wsLabels = workspaceCtx?.collectionLabels?.[canonicalKey];
|
|
112
|
+
if (wsLabels) {
|
|
113
|
+
const wsVal = wsLabels[form];
|
|
114
|
+
if (wsVal !== undefined && wsVal.length > 0)
|
|
115
|
+
return wsVal;
|
|
116
|
+
}
|
|
117
|
+
// Layer 2: explicit collection ctx (granular call sites — handshake projector)
|
|
118
|
+
const colLabels = collectionCtx?.labels;
|
|
119
|
+
if (colLabels) {
|
|
120
|
+
const colVal = colLabels[form];
|
|
121
|
+
if (colVal !== undefined && colVal.length > 0)
|
|
122
|
+
return colVal;
|
|
123
|
+
}
|
|
124
|
+
// Layer 2.5: collection defaults from WorkspaceVocabCtx (threaded via chain.getVocabulary)
|
|
125
|
+
// New: wires the dead Layer 2 path for consumers that don't pass explicit collectionCtx.
|
|
126
|
+
const defaultLabels = workspaceCtx?.collectionDefaults?.[canonicalKey];
|
|
127
|
+
if (defaultLabels) {
|
|
128
|
+
const defVal = defaultLabels[form];
|
|
129
|
+
if (defVal !== undefined && defVal.length > 0)
|
|
130
|
+
return defVal;
|
|
131
|
+
}
|
|
132
|
+
// Layer 3: canonicalKey literal fallback
|
|
133
|
+
return canonicalKey;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Replace all {{vocab:<canonicalKey>.<form>}} tokens in a string.
|
|
137
|
+
*
|
|
138
|
+
* For each token, calls getCollectionLabel with the provided contexts.
|
|
139
|
+
* STD-253.
|
|
140
|
+
*/
|
|
141
|
+
export function replaceVocabTokens(body, workspaceCtx, collectionCtxMap) {
|
|
142
|
+
if (!body || body.length === 0)
|
|
143
|
+
return body;
|
|
144
|
+
const regex = new RegExp(VOCAB_TOKEN_REGEX.source, 'g');
|
|
145
|
+
return body.replace(regex, (_match, canonicalKey, form) => {
|
|
146
|
+
const collectionCtx = collectionCtxMap?.get(canonicalKey);
|
|
147
|
+
return getCollectionLabel(canonicalKey, form, workspaceCtx, collectionCtx);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=canonicalRefs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonicalRefs.js","sourceRoot":"","sources":["../../src/lib/canonicalRefs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AAkCH;;GAEG;AACH,MAAM,kBAAkB,GAAG,oEAAoE,CAAC;AAEhG;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC7C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE1C,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,mDAAmD;IACnD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzD,IAAI,KAA6B,CAAC;IAElC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CA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,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/lib/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAC;AAKlD,uEAAuE;AACvE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,eAAe,GAAG,gBAAgB,GAAG,UAAU,CAAC;IAC3D,OAAO,EAAE,MAAM,CAAC;CACjB;AAeD,kGAAkG;AAClG,qBAAa,QAAS,SAAQ,QAAQ;IACpC,OAAO,CAAC,EAAE,qBAAqB,EAAE,CAAC;gBAEtB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,EAAE;CAQ9E;AA2DD,gFAAgF;AAChF,MAAM,MAAM,iBAAiB,GACzB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpC;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,SAAO,GACf,OAAO,CAAC,iBAAiB,CAAC,CAqC5B;AA0BD,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,OAAO,CAAC,CAsBlB;AAED,wBAAsB,UAAU,CAAC,CAAC,GAAG,OAAO,EAC1C,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACjC,OAAO,CAAC,CAAC,CAAC,CAyBZ;AA0BD;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,GAAG,OAAO,EACrD,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACjC,OAAO,CAAC,CAAC,CAAC,CAwCZ"}
|
package/dist/lib/client.js
CHANGED
|
@@ -13,6 +13,7 @@ import { getConfig, resolveAdminConfig } from './config.js';
|
|
|
13
13
|
import { readSession } from './session.js';
|
|
14
14
|
import { CLIError, ErrorCode } from './errors.js';
|
|
15
15
|
import { withSpinner } from './spinner.js';
|
|
16
|
+
import { recordServerLatest } from './update-check.js';
|
|
16
17
|
/**
|
|
17
18
|
* Map MCP server error codes to CLIError categories.
|
|
18
19
|
* Keeps backward compat: McpError.code is still a free string from the server,
|
|
@@ -23,7 +24,7 @@ function mcpCodeToCategory(code) {
|
|
|
23
24
|
return 'internal';
|
|
24
25
|
if (code.startsWith('AUTH') || code === 'UNAUTHORIZED')
|
|
25
26
|
return 'auth';
|
|
26
|
-
if (code === 'VALIDATION_FAILED')
|
|
27
|
+
if (code === 'VALIDATION_FAILED' || code === 'QUALITY_GATE_BLOCKED')
|
|
27
28
|
return 'validation';
|
|
28
29
|
if (code === 'SESSION_REQUIRED')
|
|
29
30
|
return 'session';
|
|
@@ -41,6 +42,13 @@ export class McpError extends CLIError {
|
|
|
41
42
|
this.details = details;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
45
|
+
function recordLatestFromResponse(res) {
|
|
46
|
+
recordServerLatest(res.headers?.get?.('pb-latest-cli-version') ?? null);
|
|
47
|
+
}
|
|
48
|
+
async function parseKernelEnvelope(res) {
|
|
49
|
+
recordLatestFromResponse(res);
|
|
50
|
+
return (await res.json().catch(() => ({})));
|
|
51
|
+
}
|
|
44
52
|
// Configure proxy at module load — runs once, before any fetch call.
|
|
45
53
|
// Node.js fetch (undici) ignores HTTPS_PROXY env vars. We detect the proxy
|
|
46
54
|
// and install a ProxyAgent as the global dispatcher so all fetch() calls
|
|
@@ -101,10 +109,12 @@ export async function validateKey(apiKey, siteUrl, timeoutMs = 5000) {
|
|
|
101
109
|
signal: controller.signal,
|
|
102
110
|
});
|
|
103
111
|
clearTimeout(timer);
|
|
112
|
+
// Record header BEFORE the 401/403 short-circuit — auth-fail responses still carry the version skew signal.
|
|
113
|
+
recordLatestFromResponse(res);
|
|
104
114
|
if (res.status === 401 || res.status === 403) {
|
|
105
115
|
return { valid: false, error: 'Invalid API key.' };
|
|
106
116
|
}
|
|
107
|
-
const envelope =
|
|
117
|
+
const envelope = await parseKernelEnvelope(res);
|
|
108
118
|
if (!res.ok || envelope.ok === false) {
|
|
109
119
|
return { valid: false, error: envelope.message || envelope.error || `Server error (${res.status})` };
|
|
110
120
|
}
|
|
@@ -191,7 +201,7 @@ export async function kernelCall(fn, args = {}) {
|
|
|
191
201
|
catch (err) {
|
|
192
202
|
rethrowWithGuidance(err, siteUrl);
|
|
193
203
|
}
|
|
194
|
-
const envelope =
|
|
204
|
+
const envelope = await parseKernelEnvelope(res);
|
|
195
205
|
if (!res.ok || envelope.ok === false) {
|
|
196
206
|
throw new McpError(envelope.message || envelope.error || res.statusText, envelope.code, envelope.details);
|
|
197
207
|
}
|
|
@@ -250,7 +260,7 @@ export async function kernelCallWithSession(fn, args = {}) {
|
|
|
250
260
|
catch (err) {
|
|
251
261
|
rethrowWithGuidance(err, siteUrl);
|
|
252
262
|
}
|
|
253
|
-
const envelope =
|
|
263
|
+
const envelope = await parseKernelEnvelope(res);
|
|
254
264
|
if (!res.ok || envelope.ok === false) {
|
|
255
265
|
throw new McpError(envelope.message || envelope.error || res.statusText, envelope.code, envelope.details);
|
|
256
266
|
}
|
package/dist/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAYvD;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,IAAa;IACtC,IAAI,CAAC,IAAI;QAAE,OAAO,UAAU,CAAC;IAC7B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,KAAK,cAAc;QAAE,OAAO,MAAM,CAAC;IACtE,IAAI,IAAI,KAAK,mBAAmB,IAAI,IAAI,KAAK,sBAAsB;QAAE,OAAO,YAAY,CAAC;IACzF,IAAI,IAAI,KAAK,kBAAkB;QAAE,OAAO,SAAS,CAAC;IACl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,CAAC;YACH,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,UAAU,EAAE;gBACtC,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;aACnC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACpC,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAI,GAAG,CAAC,CAAC;QACnD,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;YACrC,MAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,KAAK,IAAI,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC5G,CAAC;QACD,OAAO,QAAQ,CAAC,IAAS,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,gFAAgF;IAChF,wFAAwF;IACxF,oFAAoF;IACpF,IAAI,OAAO,EAAE,SAAS,EAAE,CAAC;QACvB,KAAK,WAAW,CAAC,oBAAoB,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -1,29 +1,117 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI config — reads PRODUCTBRAIN_API_KEY + CONVEX_SITE_URL from:
|
|
3
3
|
* 1. Environment variables (always highest priority)
|
|
4
|
-
* 2. Project config: .productbrain/config.json
|
|
5
|
-
* 3.
|
|
6
|
-
* 4.
|
|
7
|
-
* 5.
|
|
4
|
+
* 2. Project local config: .productbrain/config.local.json (walked up from CWD, machine-local)
|
|
5
|
+
* 3. Project config: .productbrain/config.json (walked up from CWD, siteUrl only — committed)
|
|
6
|
+
* 4. Profile system (~/.config/productbrain/profiles/{name}.env)
|
|
7
|
+
* 5. Legacy ~/.config/productbrain/.env (auto-migrated to profiles on first use)
|
|
8
|
+
* 6. CWD .env.mcp / packages/mcp-server/.env.mcp / .env
|
|
8
9
|
*
|
|
9
10
|
* Config loading is lazy — loadEnv() runs on first getConfig()/getConfigOrGuide() call.
|
|
10
11
|
* This enables profile switching without import-time side effects (TEN-1276).
|
|
11
12
|
*
|
|
12
13
|
* When key is missing and retry is provided (TTY), runs guided flow per docs/cli-unauthenticated-user-journey.md.
|
|
14
|
+
*
|
|
15
|
+
* Split config design:
|
|
16
|
+
* - config.json (committed): siteUrl only — workspace gateway, safe to share with teammates.
|
|
17
|
+
* - config.local.json (gitignored): profile pin — machine-local, never committed.
|
|
13
18
|
*/
|
|
14
19
|
declare const HOME_CONFIG_DIR: string;
|
|
15
20
|
declare const HOME_ENV_PATH: string;
|
|
16
|
-
/** Project config shape — .productbrain/config.json */
|
|
21
|
+
/** Project config shape — .productbrain/config.json (committed, siteUrl only) */
|
|
17
22
|
interface ProjectConfig {
|
|
18
|
-
apiKey?: string;
|
|
19
23
|
siteUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Local project config shape — .productbrain/config.local.json (gitignored, machine-local) */
|
|
26
|
+
interface LocalProjectConfig {
|
|
20
27
|
profile?: string;
|
|
28
|
+
/** Direct preview API key — set by `npm run pb:preview`, cleared by `npm run pb:real`. */
|
|
29
|
+
apiKey?: string;
|
|
30
|
+
/** Preview site URL — set alongside apiKey by `npm run pb:preview`. */
|
|
31
|
+
siteUrl?: string;
|
|
32
|
+
/** Marks this config as preview-bound; the CLI shows a loud banner on every command. */
|
|
33
|
+
preview?: boolean;
|
|
34
|
+
/** Human-readable preview workspace name for the banner (e.g. "Preview Workspace"). */
|
|
35
|
+
workspaceName?: string;
|
|
21
36
|
}
|
|
22
37
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
38
|
+
* Walk up the directory tree (git-style) to find the nearest CLI project root.
|
|
39
|
+
*
|
|
40
|
+
* A `.productbrain/` directory only counts as a CLI project root when it carries
|
|
41
|
+
* CLI configuration — `config.json` (committed siteUrl gateway) or
|
|
42
|
+
* `config.local.json` (machine-local profile pin or preview binding). A
|
|
43
|
+
* projection-only `.productbrain/` written by `pb handshake` (briefing.md,
|
|
44
|
+
* context.md, rules/, etc.) does NOT count — otherwise a subrepo like
|
|
45
|
+
* `packages/cli/.productbrain/` would shadow the real configuring root and
|
|
46
|
+
* `npm run pb:preview` writes (which always land at the repo-root
|
|
47
|
+
* `.productbrain/`) would be invisible to commands run from the subrepo.
|
|
48
|
+
*
|
|
49
|
+
* Stops at home directory or filesystem root. Returns the directory containing
|
|
50
|
+
* a config-bearing `.productbrain/`, or null if not found.
|
|
51
|
+
*/
|
|
52
|
+
export declare function findProjectRoot(startDir: string): string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Read .productbrain/config.json from the walked-up project root.
|
|
55
|
+
* Only reads siteUrl — profile and apiKey fields are ignored (legacy or misplaced).
|
|
56
|
+
* Returns null if file missing or project root not found.
|
|
57
|
+
* Warns to stderr on invalid JSON but does not throw.
|
|
25
58
|
*/
|
|
26
59
|
declare function readProjectConfig(): ProjectConfig | null;
|
|
60
|
+
/**
|
|
61
|
+
* Read .productbrain/config.local.json from the walked-up project root.
|
|
62
|
+
* Returns the machine-local pin (`profile`) and any preview-binding fields
|
|
63
|
+
* (`apiKey`, `siteUrl`, `preview`, `workspaceName`) written by
|
|
64
|
+
* `npm run pb:preview` — all gitignored, never committed.
|
|
65
|
+
* Returns null if file missing or project root not found.
|
|
66
|
+
* Warns to stderr on invalid JSON but does not throw.
|
|
67
|
+
*/
|
|
68
|
+
export declare function readLocalProjectConfig(): LocalProjectConfig | null;
|
|
69
|
+
/**
|
|
70
|
+
* Returns the preview binding metadata when pb is currently bound to a throwaway preview,
|
|
71
|
+
* or null when bound to the real Chain (the default).
|
|
72
|
+
*
|
|
73
|
+
* Effective-binding mirror: this only reports a preview binding when
|
|
74
|
+
* `resolveConfig()`/`loadEnv()` would actually honor it — `preview === true` AND
|
|
75
|
+
* an atomic apiKey+siteUrl pair (SF-3) AND no `PRODUCTBRAIN_API_KEY` env override
|
|
76
|
+
* (env always wins in resolveConfig step 1). Without these guards the PREVIEW
|
|
77
|
+
* banner could fire while writes still hit the real Chain, defeating the safety
|
|
78
|
+
* warning. Used by the PREVIEW banner (index.ts preAction hook) and the
|
|
79
|
+
* capture/update advisory.
|
|
80
|
+
*
|
|
81
|
+
* Security classification: reads only the gitignored machine-local config.local.json.
|
|
82
|
+
* The preview key in that file is a throwaway preview-scoped key, set by explicit
|
|
83
|
+
* `npm run pb:preview` opt-in and reversed by `npm run pb:real`. Never throws — returns
|
|
84
|
+
* null on any error so the banner/advisory path is never the source of a CLI crash.
|
|
85
|
+
*/
|
|
86
|
+
export declare function getPreviewBinding(): {
|
|
87
|
+
workspaceName: string | null;
|
|
88
|
+
} | null;
|
|
89
|
+
/**
|
|
90
|
+
* Write/merge the profile pin into <projectRoot>/.productbrain/config.local.json,
|
|
91
|
+
* preserving any sibling keys. Single source of truth for the local pin write —
|
|
92
|
+
* used by `pb profile use --local`, the default reconcile path, and `pb connect`.
|
|
93
|
+
*
|
|
94
|
+
* Co-writer note (SF-2): scripts/pb-binding.mjs is the OTHER writer of config.local.json — it
|
|
95
|
+
* merges/strips the preview-binding keys (apiKey, siteUrl, preview, workspaceName) for
|
|
96
|
+
* `npm run pb:preview` / `npm run pb:real`. Both writers preserve the `profile` pin. If you add
|
|
97
|
+
* a preview-scoped key here or in readLocalProjectConfig(), update pb-binding.mjs's PREVIEW_KEYS.
|
|
98
|
+
*/
|
|
99
|
+
export declare function setLocalProfilePin(projectRoot: string, profile: string): void;
|
|
100
|
+
/** Source of the effective profile, in resolution-precedence order. */
|
|
101
|
+
export type EffectiveProfileSource = 'env' | 'local' | 'global' | 'default' | 'none';
|
|
102
|
+
/**
|
|
103
|
+
* Resolve the effective profile NAME + where it came from. The SOURCE-PRECEDENCE
|
|
104
|
+
* ORDER matches resolveConfig() (env > local pin > global > default), but unlike
|
|
105
|
+
* resolveConfig() this reports the *configured* pin name even when that profile is
|
|
106
|
+
* unresolvable (deleted / missing key). That divergence is intentional: a dangling
|
|
107
|
+
* repo pin must be surfaced by `pb whoami`, not silently masked by the global
|
|
108
|
+
* profile — masking it is the TEN-2163 silent-drift bug. Used by `pb whoami` and
|
|
109
|
+
* the inline "now using" prints.
|
|
110
|
+
*/
|
|
111
|
+
export declare function resolveEffectiveProfile(): {
|
|
112
|
+
profile: string | null;
|
|
113
|
+
source: EffectiveProfileSource;
|
|
114
|
+
};
|
|
27
115
|
/** Config source in resolution priority order. */
|
|
28
116
|
export type ConfigSource = 'env' | 'project' | 'profile' | 'cwd' | 'default';
|
|
29
117
|
/** Result of the full config resolution cascade. */
|
|
@@ -36,7 +124,8 @@ export interface ResolvedConfig {
|
|
|
36
124
|
* Run the full config resolution cascade and return a typed result.
|
|
37
125
|
* Resolution order:
|
|
38
126
|
* 1. Environment variables (highest priority)
|
|
39
|
-
* 2.
|
|
127
|
+
* 2. config.local.json profile → resolveNamedProfileConfig(profile) for apiKey + siteUrl
|
|
128
|
+
* 2b. config.json siteUrl (gateway override only — no apiKey, no profile)
|
|
40
129
|
* 3. Profile system (~/.config/productbrain/profiles/{name}.env)
|
|
41
130
|
* 4. Legacy home config (~/.config/productbrain/.env)
|
|
42
131
|
* 5. CWD .env files (.env.mcp, packages/mcp-server/.env.mcp, .env)
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiB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