@nexusclawhq/cli 0.3.25 → 0.3.27
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/CHANGELOG.md +16 -0
- package/dist/build-info.json +4 -4
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/agent-executable-assets/cli-contract.types.d.ts +37 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/agent-executable-assets/contract-versions.d.ts +5 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/agent-executable-assets/contract-versions.js +6 -2
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/agent-executable-assets/contract-versions.js.map +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/agent-executable-assets/index.d.ts +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/agent-executable-assets/index.js.map +1 -1
- package/dist/nexus-cli/src/cli-runner.test.d.ts +1 -0
- package/dist/nexus-cli/src/cli-runner.test.js +156 -0
- package/dist/nexus-cli/src/cli-runner.test.js.map +1 -0
- package/dist/nexus-cli/src/cli.d.ts +8 -0
- package/dist/nexus-cli/src/cli.js +133 -7
- package/dist/nexus-cli/src/cli.js.map +1 -1
- package/dist/nexus-cli/src/commands/ai/context-export.js +6 -3
- package/dist/nexus-cli/src/commands/ai/context-export.js.map +1 -1
- package/dist/nexus-cli/src/commands/ai/help.d.ts +1 -1
- package/dist/nexus-cli/src/commands/ai/help.js +14 -2
- package/dist/nexus-cli/src/commands/ai/help.js.map +1 -1
- package/dist/nexus-cli/src/commands/ai/help.test.js +32 -0
- package/dist/nexus-cli/src/commands/ai/help.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/changeset/index.js +68 -34
- package/dist/nexus-cli/src/commands/changeset/index.js.map +1 -1
- package/dist/nexus-cli/src/commands/customer-entitlement/activate.js +16 -9
- package/dist/nexus-cli/src/commands/customer-entitlement/activate.js.map +1 -1
- package/dist/nexus-cli/src/commands/customer-entitlement/create.js +22 -15
- package/dist/nexus-cli/src/commands/customer-entitlement/create.js.map +1 -1
- package/dist/nexus-cli/src/commands/customer-entitlement/deactivate.js +16 -9
- package/dist/nexus-cli/src/commands/customer-entitlement/deactivate.js.map +1 -1
- package/dist/nexus-cli/src/commands/customer-entitlement/get.js +25 -17
- package/dist/nexus-cli/src/commands/customer-entitlement/get.js.map +1 -1
- package/dist/nexus-cli/src/commands/customer-entitlement/list.js +14 -5
- package/dist/nexus-cli/src/commands/customer-entitlement/list.js.map +1 -1
- package/dist/nexus-cli/src/commands/customer-entitlement/result.d.ts +1 -0
- package/dist/nexus-cli/src/commands/customer-entitlement/result.js +11 -0
- package/dist/nexus-cli/src/commands/customer-entitlement/result.js.map +1 -0
- package/dist/nexus-cli/src/commands/customer-entitlement/validate.js +13 -4
- package/dist/nexus-cli/src/commands/customer-entitlement/validate.js.map +1 -1
- package/dist/nexus-cli/src/commands/data/delete-bulk.js +12 -6
- package/dist/nexus-cli/src/commands/data/delete-bulk.js.map +1 -1
- package/dist/nexus-cli/src/commands/data/export-tree.js +15 -8
- package/dist/nexus-cli/src/commands/data/export-tree.js.map +1 -1
- package/dist/nexus-cli/src/commands/data/import-tree.js +14 -8
- package/dist/nexus-cli/src/commands/data/import-tree.js.map +1 -1
- package/dist/nexus-cli/src/commands/data/query.js +11 -4
- package/dist/nexus-cli/src/commands/data/query.js.map +1 -1
- package/dist/nexus-cli/src/commands/data/recycle-bin.js +9 -2
- package/dist/nexus-cli/src/commands/data/recycle-bin.js.map +1 -1
- package/dist/nexus-cli/src/commands/deployment/employee-report.js +17 -12
- package/dist/nexus-cli/src/commands/deployment/employee-report.js.map +1 -1
- package/dist/nexus-cli/src/commands/deployment/index.js +26 -10
- package/dist/nexus-cli/src/commands/deployment/index.js.map +1 -1
- package/dist/nexus-cli/src/commands/deployment/quick.js +12 -13
- package/dist/nexus-cli/src/commands/deployment/quick.js.map +1 -1
- package/dist/nexus-cli/src/commands/deployment/report.js +9 -8
- package/dist/nexus-cli/src/commands/deployment/report.js.map +1 -1
- package/dist/nexus-cli/src/commands/deployment/resume.js +15 -8
- package/dist/nexus-cli/src/commands/deployment/resume.js.map +1 -1
- package/dist/nexus-cli/src/commands/dx-json-option.test.js +1 -1
- package/dist/nexus-cli/src/commands/dx-json-option.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/dx-pages.d.ts +1 -0
- package/dist/nexus-cli/src/commands/dx-pages.js +6 -3
- package/dist/nexus-cli/src/commands/dx-pages.js.map +1 -1
- package/dist/nexus-cli/src/commands/dx-workflows.e2e.test.js +4 -2
- package/dist/nexus-cli/src/commands/dx-workflows.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/dx.js +111 -54
- package/dist/nexus-cli/src/commands/dx.js.map +1 -1
- package/dist/nexus-cli/src/commands/employee/bundle.js +3 -2
- package/dist/nexus-cli/src/commands/employee/bundle.js.map +1 -1
- package/dist/nexus-cli/src/commands/employee/deploy.e2e.test.js +9 -5
- package/dist/nexus-cli/src/commands/employee/deploy.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/employee/deploy.js +45 -23
- package/dist/nexus-cli/src/commands/employee/deploy.js.map +1 -1
- package/dist/nexus-cli/src/commands/entitlement/grant.js +21 -11
- package/dist/nexus-cli/src/commands/entitlement/grant.js.map +1 -1
- package/dist/nexus-cli/src/commands/entitlement/list.js +11 -2
- package/dist/nexus-cli/src/commands/entitlement/list.js.map +1 -1
- package/dist/nexus-cli/src/commands/entitlement/revoke.js +20 -10
- package/dist/nexus-cli/src/commands/entitlement/revoke.js.map +1 -1
- package/dist/nexus-cli/src/commands/generate/class.js +5 -3
- package/dist/nexus-cli/src/commands/generate/class.js.map +1 -1
- package/dist/nexus-cli/src/commands/generate/component.js +5 -3
- package/dist/nexus-cli/src/commands/generate/component.js.map +1 -1
- package/dist/nexus-cli/src/commands/generate/project.js +5 -3
- package/dist/nexus-cli/src/commands/generate/project.js.map +1 -1
- package/dist/nexus-cli/src/commands/generate/test.js +5 -3
- package/dist/nexus-cli/src/commands/generate/test.js.map +1 -1
- package/dist/nexus-cli/src/commands/generate/trigger.js +5 -3
- package/dist/nexus-cli/src/commands/generate/trigger.js.map +1 -1
- package/dist/nexus-cli/src/commands/install-contract/index.js +34 -24
- package/dist/nexus-cli/src/commands/install-contract/index.js.map +1 -1
- package/dist/nexus-cli/src/commands/log/get.js +9 -2
- package/dist/nexus-cli/src/commands/log/get.js.map +1 -1
- package/dist/nexus-cli/src/commands/log/list.js +9 -1
- package/dist/nexus-cli/src/commands/log/list.js.map +1 -1
- package/dist/nexus-cli/src/commands/log/tail.js +101 -50
- package/dist/nexus-cli/src/commands/log/tail.js.map +1 -1
- package/dist/nexus-cli/src/commands/log/tail.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/log/tail.test.js +45 -0
- package/dist/nexus-cli/src/commands/log/tail.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/metadata/deploy.js +34 -18
- package/dist/nexus-cli/src/commands/metadata/deploy.js.map +1 -1
- package/dist/nexus-cli/src/commands/metadata/diff.js +9 -6
- package/dist/nexus-cli/src/commands/metadata/diff.js.map +1 -1
- package/dist/nexus-cli/src/commands/metadata/export.js +7 -5
- package/dist/nexus-cli/src/commands/metadata/export.js.map +1 -1
- package/dist/nexus-cli/src/commands/metadata/import.js +24 -9
- package/dist/nexus-cli/src/commands/metadata/import.js.map +1 -1
- package/dist/nexus-cli/src/commands/metadata/retrieve.js +17 -7
- package/dist/nexus-cli/src/commands/metadata/retrieve.js.map +1 -1
- package/dist/nexus-cli/src/commands/metadata/validate-source.js +28 -14
- package/dist/nexus-cli/src/commands/metadata/validate-source.js.map +1 -1
- package/dist/nexus-cli/src/commands/metadata/validate.js +25 -11
- package/dist/nexus-cli/src/commands/metadata/validate.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/default-set.js +10 -4
- package/dist/nexus-cli/src/commands/org/default-set.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/display.js +17 -15
- package/dist/nexus-cli/src/commands/org/display.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/login-jwt.js +20 -14
- package/dist/nexus-cli/src/commands/org/login-jwt.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/login-web-terminal.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/org/login-web-terminal.test.js +128 -0
- package/dist/nexus-cli/src/commands/org/login-web-terminal.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/org/login-web.js +180 -137
- package/dist/nexus-cli/src/commands/org/login-web.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/logout.js +10 -4
- package/dist/nexus-cli/src/commands/org/logout.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/open.js +16 -7
- package/dist/nexus-cli/src/commands/org/open.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/step-up.js +15 -12
- package/dist/nexus-cli/src/commands/org/step-up.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/deprecate.js +23 -14
- package/dist/nexus-cli/src/commands/package/deprecate.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/format.js +17 -6
- package/dist/nexus-cli/src/commands/package/format.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/helpers.d.ts +5 -0
- package/dist/nexus-cli/src/commands/package/helpers.js +16 -0
- package/dist/nexus-cli/src/commands/package/helpers.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/history.js +20 -21
- package/dist/nexus-cli/src/commands/package/history.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/info.js +43 -43
- package/dist/nexus-cli/src/commands/package/info.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/install.js +45 -29
- package/dist/nexus-cli/src/commands/package/install.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/list.js +46 -48
- package/dist/nexus-cli/src/commands/package/list.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/pack.js +30 -16
- package/dist/nexus-cli/src/commands/package/pack.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/package-payload.e2e.test.js +12 -0
- package/dist/nexus-cli/src/commands/package/package-payload.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/package-query-json.e2e.test.js +9 -4
- package/dist/nexus-cli/src/commands/package/package-query-json.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/plan.js +20 -13
- package/dist/nexus-cli/src/commands/package/plan.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/promote.js +16 -11
- package/dist/nexus-cli/src/commands/package/promote.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/promotion-history.js +24 -18
- package/dist/nexus-cli/src/commands/package/promotion-history.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/publish.js +23 -13
- package/dist/nexus-cli/src/commands/package/publish.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/rollback.js +64 -43
- package/dist/nexus-cli/src/commands/package/rollback.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/rollout-status.js +15 -9
- package/dist/nexus-cli/src/commands/package/rollout-status.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/rollout-update.js +16 -9
- package/dist/nexus-cli/src/commands/package/rollout-update.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/rollout-workspaces.js +18 -12
- package/dist/nexus-cli/src/commands/package/rollout-workspaces.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/search.js +27 -25
- package/dist/nexus-cli/src/commands/package/search.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/uninstall.js +23 -16
- package/dist/nexus-cli/src/commands/package/uninstall.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/upgrade.js +37 -23
- package/dist/nexus-cli/src/commands/package/upgrade.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/validate.js +75 -59
- package/dist/nexus-cli/src/commands/package/validate.js.map +1 -1
- package/dist/nexus-cli/src/commands/package/versions.js +13 -12
- package/dist/nexus-cli/src/commands/package/versions.js.map +1 -1
- package/dist/nexus-cli/src/commands/preflight/get.js +14 -11
- package/dist/nexus-cli/src/commands/preflight/get.js.map +1 -1
- package/dist/nexus-cli/src/commands/preflight/run.e2e.test.js +9 -10
- package/dist/nexus-cli/src/commands/preflight/run.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/preflight/run.js +14 -10
- package/dist/nexus-cli/src/commands/preflight/run.js.map +1 -1
- package/dist/nexus-cli/src/commands/project/convert.js +45 -35
- package/dist/nexus-cli/src/commands/project/convert.js.map +1 -1
- package/dist/nexus-cli/src/commands/project/deploy-start.js +40 -26
- package/dist/nexus-cli/src/commands/project/deploy-start.js.map +1 -1
- package/dist/nexus-cli/src/commands/project/index.js +5 -3
- package/dist/nexus-cli/src/commands/project/index.js.map +1 -1
- package/dist/nexus-cli/src/commands/revision/baseline.js +23 -10
- package/dist/nexus-cli/src/commands/revision/baseline.js.map +1 -1
- package/dist/nexus-cli/src/commands/revision/diff.js +9 -5
- package/dist/nexus-cli/src/commands/revision/diff.js.map +1 -1
- package/dist/nexus-cli/src/commands/revision/history.js +5 -3
- package/dist/nexus-cli/src/commands/revision/history.js.map +1 -1
- package/dist/nexus-cli/src/commands/revision/revision.e2e.test.js +4 -4
- package/dist/nexus-cli/src/commands/revision/revision.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/revision/rollback.js +13 -5
- package/dist/nexus-cli/src/commands/revision/rollback.js.map +1 -1
- package/dist/nexus-cli/src/commands/sandbox/create.js +7 -5
- package/dist/nexus-cli/src/commands/sandbox/create.js.map +1 -1
- package/dist/nexus-cli/src/commands/sandbox/delete.js +12 -6
- package/dist/nexus-cli/src/commands/sandbox/delete.js.map +1 -1
- package/dist/nexus-cli/src/commands/sandbox/list.js +9 -1
- package/dist/nexus-cli/src/commands/sandbox/list.js.map +1 -1
- package/dist/nexus-cli/src/commands/script/run.js +17 -10
- package/dist/nexus-cli/src/commands/script/run.js.map +1 -1
- package/dist/nexus-cli/src/commands/source/get.js +11 -4
- package/dist/nexus-cli/src/commands/source/get.js.map +1 -1
- package/dist/nexus-cli/src/commands/source/pull.js +3 -2
- package/dist/nexus-cli/src/commands/source/pull.js.map +1 -1
- package/dist/nexus-cli/src/commands/source/push.js +14 -11
- package/dist/nexus-cli/src/commands/source/push.js.map +1 -1
- package/dist/nexus-cli/src/commands/source/source-sync.e2e.test.js +3 -2
- package/dist/nexus-cli/src/commands/source/source-sync.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/source/status.js +3 -2
- package/dist/nexus-cli/src/commands/source/status.js.map +1 -1
- package/dist/nexus-cli/src/commands/test/report.js +9 -2
- package/dist/nexus-cli/src/commands/test/report.js.map +1 -1
- package/dist/nexus-cli/src/commands/test/run.js +13 -7
- package/dist/nexus-cli/src/commands/test/run.js.map +1 -1
- package/dist/nexus-cli/src/commands/user/service-account.js +9 -5
- package/dist/nexus-cli/src/commands/user/service-account.js.map +1 -1
- package/dist/nexus-cli/src/commands/validate/index.js +20 -8
- package/dist/nexus-cli/src/commands/validate/index.js.map +1 -1
- package/dist/nexus-cli/src/commands/workforce/agent.js +3 -3
- package/dist/nexus-cli/src/commands/workforce/command-attribution.test.d.ts +1 -0
- package/dist/nexus-cli/src/commands/workforce/command-attribution.test.js +26 -0
- package/dist/nexus-cli/src/commands/workforce/command-attribution.test.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/escalation.js +1 -1
- package/dist/nexus-cli/src/commands/workforce/knowledge.js +6 -6
- package/dist/nexus-cli/src/commands/workforce/learning.js +5 -5
- package/dist/nexus-cli/src/commands/workforce/notification.js +1 -1
- package/dist/nexus-cli/src/commands/workforce/observe.js +2 -2
- package/dist/nexus-cli/src/commands/workforce/orchestration.js +2 -2
- package/dist/nexus-cli/src/commands/workforce/permission.js +3 -3
- package/dist/nexus-cli/src/commands/workforce/provider.js +1 -1
- package/dist/nexus-cli/src/commands/workforce/rehearsal.js +2 -2
- package/dist/nexus-cli/src/commands/workforce/sop.js +1 -1
- package/dist/nexus-cli/src/commands/workforce/task.js +1 -1
- package/dist/nexus-cli/src/commands/workforce/test-case.js +9 -9
- package/dist/nexus-cli/src/commands/workspace/index.js +64 -26
- package/dist/nexus-cli/src/commands/workspace/index.js.map +1 -1
- package/dist/nexus-cli/src/commands/workspace/workspace.e2e.test.js +7 -0
- package/dist/nexus-cli/src/commands/workspace/workspace.e2e.test.js.map +1 -1
- package/dist/nexus-cli/src/contracts/command-contract-matrix.d.ts +39 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.generated.test.d.ts +1 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.generated.test.js +842 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.generated.test.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.js +114 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.runner.d.ts +28 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.runner.js +159 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.runner.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.runner.test.d.ts +1 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.runner.test.js +69 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.runner.test.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.scenarios.d.ts +2 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.scenarios.js +145 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.scenarios.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.test.d.ts +1 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.test.js +53 -0
- package/dist/nexus-cli/src/contracts/command-contract-matrix.test.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-inventory.d.ts +35 -0
- package/dist/nexus-cli/src/contracts/command-inventory.js +88 -0
- package/dist/nexus-cli/src/contracts/command-inventory.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-inventory.test.d.ts +1 -0
- package/dist/nexus-cli/src/contracts/command-inventory.test.js +46 -0
- package/dist/nexus-cli/src/contracts/command-inventory.test.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-policy.exporter.d.ts +24 -0
- package/dist/nexus-cli/src/contracts/command-policy.exporter.js +51 -0
- package/dist/nexus-cli/src/contracts/command-policy.exporter.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-policy.exporter.test.d.ts +1 -0
- package/dist/nexus-cli/src/contracts/command-policy.exporter.test.js +33 -0
- package/dist/nexus-cli/src/contracts/command-policy.exporter.test.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-policy.registry.d.ts +14 -0
- package/dist/nexus-cli/src/contracts/command-policy.registry.js +185 -0
- package/dist/nexus-cli/src/contracts/command-policy.registry.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-policy.registry.test.d.ts +1 -0
- package/dist/nexus-cli/src/contracts/command-policy.registry.test.js +43 -0
- package/dist/nexus-cli/src/contracts/command-policy.registry.test.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-policy.validator.d.ts +20 -0
- package/dist/nexus-cli/src/contracts/command-policy.validator.js +179 -0
- package/dist/nexus-cli/src/contracts/command-policy.validator.js.map +1 -0
- package/dist/nexus-cli/src/contracts/command-policy.validator.test.d.ts +1 -0
- package/dist/nexus-cli/src/contracts/command-policy.validator.test.js +70 -0
- package/dist/nexus-cli/src/contracts/command-policy.validator.test.js.map +1 -0
- package/dist/nexus-cli/src/contracts/index.d.ts +7 -0
- package/dist/nexus-cli/src/contracts/index.js +24 -1
- package/dist/nexus-cli/src/contracts/index.js.map +1 -1
- package/dist/nexus-cli/src/contracts/machine-result.d.ts +3 -3
- package/dist/nexus-cli/src/contracts/machine-result.js +6 -0
- package/dist/nexus-cli/src/contracts/machine-result.js.map +1 -1
- package/dist/nexus-cli/src/runtime/failure-normalizer.d.ts +7 -0
- package/dist/nexus-cli/src/runtime/failure-normalizer.js +78 -0
- package/dist/nexus-cli/src/runtime/failure-normalizer.js.map +1 -0
- package/dist/nexus-cli/src/runtime/failure-normalizer.test.d.ts +1 -0
- package/dist/nexus-cli/src/runtime/failure-normalizer.test.js +41 -0
- package/dist/nexus-cli/src/runtime/failure-normalizer.test.js.map +1 -0
- package/dist/nexus-cli/src/runtime/output-coordinator.d.ts +31 -0
- package/dist/nexus-cli/src/runtime/output-coordinator.js +75 -0
- package/dist/nexus-cli/src/runtime/output-coordinator.js.map +1 -0
- package/dist/nexus-cli/src/runtime/output-coordinator.test.d.ts +1 -0
- package/dist/nexus-cli/src/runtime/output-coordinator.test.js +80 -0
- package/dist/nexus-cli/src/runtime/output-coordinator.test.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-bundle-archive.d.ts +1 -1
- package/dist/nexus-cli/src/services/workforce-bundle-remote.d.ts +1 -1
- package/dist/nexus-cli/src/services/workforce-test-remote.d.ts +1 -1
- package/dist/nexus-cli/src/services/workforce-test-remote.js +1 -1
- package/dist/nexus-cli/src/services/workforce-test-remote.test.js +2 -2
- package/dist/nexus-cli/src/utils/error-handler.js +3 -0
- package/dist/nexus-cli/src/utils/error-handler.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
7
|
+
const node_crypto_1 = require("node:crypto");
|
|
8
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
9
|
+
const node_http_1 = __importDefault(require("node:http"));
|
|
10
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
11
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
13
|
+
const cli_1 = require("../cli");
|
|
14
|
+
const command_contract_registry_1 = require("./command-contract.registry");
|
|
15
|
+
const command_inventory_1 = require("./command-inventory");
|
|
16
|
+
const command_policy_registry_1 = require("./command-policy.registry");
|
|
17
|
+
const command_contract_matrix_1 = require("./command-contract-matrix");
|
|
18
|
+
const command_contract_matrix_runner_1 = require("./command-contract-matrix.runner");
|
|
19
|
+
const command_contract_matrix_scenarios_1 = require("./command-contract-matrix.scenarios");
|
|
20
|
+
const auth_store_1 = require("../services/auth-store");
|
|
21
|
+
const shared_1 = require("@nexusclaw/shared");
|
|
22
|
+
const ai_authoring_context_v2_1 = require("../services/ai-authoring-context-v2");
|
|
23
|
+
const preDispatchAdapter = {
|
|
24
|
+
adapterId: 'commander-pre-dispatch',
|
|
25
|
+
setup: () => undefined,
|
|
26
|
+
teardown: () => undefined,
|
|
27
|
+
remoteMutationCount: () => 0,
|
|
28
|
+
};
|
|
29
|
+
const noRemoteMutationAdapter = {
|
|
30
|
+
adapterId: 'no-remote-mutation', setup: () => undefined, teardown: () => undefined,
|
|
31
|
+
remoteMutationCount: () => 0,
|
|
32
|
+
};
|
|
33
|
+
async function projectLocalWorkspaceAdapter() {
|
|
34
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-cli-project-matrix-'));
|
|
35
|
+
const previousCwd = process.cwd();
|
|
36
|
+
return {
|
|
37
|
+
adapterId: 'project-local-workspace', root, remoteMutationCount: () => 0,
|
|
38
|
+
setup: async () => {
|
|
39
|
+
await promises_1.default.mkdir(node_path_1.default.join(root, 'src/metadata/objects/Account'), { recursive: true });
|
|
40
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'src/metadata/objects/Account/object.json'), '{"apiName":"Account"}');
|
|
41
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'nexus-project.yaml'), [
|
|
42
|
+
'schemaVersion: nexus-project/v2', 'projectName: matrix-project',
|
|
43
|
+
'compatibleCoreVersion: 0.1.x', 'sourceRoot: src/metadata',
|
|
44
|
+
'sourceRoots:', ' - path: src/metadata', ' kind: metadata-runtime',
|
|
45
|
+
' writeTarget: true', 'localPackages: []', 'environments: []',
|
|
46
|
+
].join('\n'));
|
|
47
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'package.xml'), [
|
|
48
|
+
'<Package xmlns="http://soap.sforce.com/2006/04/metadata">',
|
|
49
|
+
'<types><members>Account</members><name>CustomObject</name></types>',
|
|
50
|
+
'<version>59.0</version></Package>',
|
|
51
|
+
].join(''));
|
|
52
|
+
process.chdir(root);
|
|
53
|
+
},
|
|
54
|
+
teardown: async () => { process.chdir(previousCwd); await promises_1.default.rm(root, { recursive: true, force: true }); },
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
async function sourceStatusAdapter(changed) {
|
|
58
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-cli-source-matrix-'));
|
|
59
|
+
const previousCwd = process.cwd();
|
|
60
|
+
const previousBaseUrl = process.env.NEXUS_BASE_URL;
|
|
61
|
+
const previousToken = process.env.NEXUS_AUTH_TOKEN;
|
|
62
|
+
let server;
|
|
63
|
+
return {
|
|
64
|
+
adapterId: changed ? 'source-status-changed' : 'source-status-empty', root,
|
|
65
|
+
remoteMutationCount: () => 0,
|
|
66
|
+
setup: async () => {
|
|
67
|
+
server = node_http_1.default.createServer((request, response) => {
|
|
68
|
+
let body = '';
|
|
69
|
+
request.on('data', (chunk) => { body += String(chunk); });
|
|
70
|
+
request.on('end', () => {
|
|
71
|
+
const isSourceStatus = body.includes('query SourceStatus');
|
|
72
|
+
const files = changed ? [{ path: 'objects/Account/object.json', hash: 'remote-hash',
|
|
73
|
+
componentKey: 'ObjectMetadata:Account', baselineHash: null }] : [];
|
|
74
|
+
const payload = isSourceStatus ? { data: { sourceStatus: {
|
|
75
|
+
remoteRevision: 'remote-1', remoteHash: 'remote-hash', baselineRevision: null,
|
|
76
|
+
baselineHash: null, baselineSource: null, baselineAvailable: true,
|
|
77
|
+
changedComponentCount: files.length, files, baselineFiles: [], drift: null, tracking: null,
|
|
78
|
+
} } } : { errors: [{ message: 'Unexpected controlled query' }] };
|
|
79
|
+
response.writeHead(200, { 'content-type': 'application/json' });
|
|
80
|
+
response.end(JSON.stringify(payload));
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
84
|
+
const address = server.address();
|
|
85
|
+
if (!address || typeof address === 'string')
|
|
86
|
+
throw new Error('MATRIX_SERVER_ADDRESS_MISSING');
|
|
87
|
+
process.env.NEXUS_BASE_URL = `http://127.0.0.1:${address.port}`;
|
|
88
|
+
process.env.NEXUS_AUTH_TOKEN = 'matrix-token';
|
|
89
|
+
process.chdir(root);
|
|
90
|
+
},
|
|
91
|
+
teardown: async () => {
|
|
92
|
+
process.chdir(previousCwd);
|
|
93
|
+
if (previousBaseUrl === undefined)
|
|
94
|
+
delete process.env.NEXUS_BASE_URL;
|
|
95
|
+
else
|
|
96
|
+
process.env.NEXUS_BASE_URL = previousBaseUrl;
|
|
97
|
+
if (previousToken === undefined)
|
|
98
|
+
delete process.env.NEXUS_AUTH_TOKEN;
|
|
99
|
+
else
|
|
100
|
+
process.env.NEXUS_AUTH_TOKEN = previousToken;
|
|
101
|
+
if (server)
|
|
102
|
+
await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
|
|
103
|
+
await promises_1.default.rm(root, { recursive: true, force: true });
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
async function sourcePushAdapter(changed) {
|
|
108
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-cli-source-push-matrix-'));
|
|
109
|
+
const previousCwd = process.cwd();
|
|
110
|
+
const previousBaseUrl = process.env.NEXUS_BASE_URL;
|
|
111
|
+
const previousToken = process.env.NEXUS_AUTH_TOKEN;
|
|
112
|
+
let server;
|
|
113
|
+
let persistentMutations = 0;
|
|
114
|
+
return {
|
|
115
|
+
adapterId: changed ? 'source-push-changed' : 'source-push-empty', root,
|
|
116
|
+
remoteMutationCount: () => persistentMutations,
|
|
117
|
+
setup: async () => {
|
|
118
|
+
if (changed) {
|
|
119
|
+
await promises_1.default.mkdir(node_path_1.default.join(root, 'src/metadata/objects/Account'), { recursive: true });
|
|
120
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'src/metadata/objects/Account/object.json'), '{"apiName":"Account"}');
|
|
121
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'nexus-project.yaml'), [
|
|
122
|
+
'schemaVersion: nexus-project/v2', 'projectName: matrix-project',
|
|
123
|
+
'compatibleCoreVersion: 0.1.x', 'sourceRoot: src/metadata',
|
|
124
|
+
'sourceRoots:', ' - path: src/metadata', ' kind: metadata-runtime',
|
|
125
|
+
' writeTarget: true', 'localPackages: []', 'environments: []',
|
|
126
|
+
].join('\n'));
|
|
127
|
+
}
|
|
128
|
+
server = node_http_1.default.createServer((request, response) => {
|
|
129
|
+
let raw = '';
|
|
130
|
+
request.on('data', (chunk) => { raw += String(chunk); });
|
|
131
|
+
request.on('end', () => {
|
|
132
|
+
const requestBody = JSON.parse(raw || '{}');
|
|
133
|
+
let payload;
|
|
134
|
+
if (requestBody.query?.includes('query SourceStatus')) {
|
|
135
|
+
payload = { data: { sourceStatus: {
|
|
136
|
+
remoteRevision: 'remote-1', remoteHash: 'remote-hash', baselineRevision: null,
|
|
137
|
+
baselineHash: null, baselineSource: null, baselineAvailable: true,
|
|
138
|
+
changedComponentCount: 0, files: [], baselineFiles: [], drift: null, tracking: null,
|
|
139
|
+
} } };
|
|
140
|
+
}
|
|
141
|
+
else if (requestBody.query?.includes('mutation PushSource')) {
|
|
142
|
+
if (requestBody.variables?.dryRun !== true)
|
|
143
|
+
persistentMutations += 1;
|
|
144
|
+
payload = { data: { pushSource: { success: true, count: changed ? 1 : 0,
|
|
145
|
+
dryRun: true, beforeRevision: 'remote-1', afterRevision: 'remote-1',
|
|
146
|
+
plan: { humanSummary: changed ? ['Would add Account'] : [] } } } };
|
|
147
|
+
}
|
|
148
|
+
else
|
|
149
|
+
payload = { errors: [{ message: 'Unexpected controlled query' }] };
|
|
150
|
+
response.writeHead(200, { 'content-type': 'application/json' });
|
|
151
|
+
response.end(JSON.stringify(payload));
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
155
|
+
const address = server.address();
|
|
156
|
+
if (!address || typeof address === 'string')
|
|
157
|
+
throw new Error('MATRIX_SERVER_ADDRESS_MISSING');
|
|
158
|
+
process.env.NEXUS_BASE_URL = `http://127.0.0.1:${address.port}`;
|
|
159
|
+
process.env.NEXUS_AUTH_TOKEN = 'matrix-token';
|
|
160
|
+
process.chdir(root);
|
|
161
|
+
},
|
|
162
|
+
teardown: async () => {
|
|
163
|
+
process.chdir(previousCwd);
|
|
164
|
+
if (previousBaseUrl === undefined)
|
|
165
|
+
delete process.env.NEXUS_BASE_URL;
|
|
166
|
+
else
|
|
167
|
+
process.env.NEXUS_BASE_URL = previousBaseUrl;
|
|
168
|
+
if (previousToken === undefined)
|
|
169
|
+
delete process.env.NEXUS_AUTH_TOKEN;
|
|
170
|
+
else
|
|
171
|
+
process.env.NEXUS_AUTH_TOKEN = previousToken;
|
|
172
|
+
if (server)
|
|
173
|
+
await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
|
|
174
|
+
await promises_1.default.rm(root, { recursive: true, force: true });
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
async function escalationReadOnlyAdapter() {
|
|
179
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-cli-escalation-matrix-'));
|
|
180
|
+
const previousHome = process.env.NEXUS_CLI_HOME;
|
|
181
|
+
let server;
|
|
182
|
+
let persistentMutations = 0;
|
|
183
|
+
return {
|
|
184
|
+
adapterId: 'escalation-read-only', root, remoteMutationCount: () => persistentMutations,
|
|
185
|
+
setup: async () => {
|
|
186
|
+
server = node_http_1.default.createServer((request, response) => {
|
|
187
|
+
let raw = '';
|
|
188
|
+
request.on('data', (chunk) => { raw += String(chunk); });
|
|
189
|
+
request.on('end', () => {
|
|
190
|
+
const requestBody = JSON.parse(raw || '{}');
|
|
191
|
+
if (requestBody.query?.includes('mutation '))
|
|
192
|
+
persistentMutations += 1;
|
|
193
|
+
const payload = requestBody.query?.includes('query WorkforceEscalationRules')
|
|
194
|
+
? { data: { escalationRules: [{
|
|
195
|
+
id: '00000000-0000-4000-8000-000000000003',
|
|
196
|
+
workspaceId: '00000000-0000-4000-8000-000000000004', name: 'Matrix escalation',
|
|
197
|
+
objectName: 'Case', isActive: false, entries: [],
|
|
198
|
+
createdAt: '2026-08-02T00:00:00.000Z', updatedAt: '2026-08-02T00:00:00.000Z',
|
|
199
|
+
}] } } : { errors: [{ message: 'Unexpected controlled query' }] };
|
|
200
|
+
response.writeHead(200, { 'content-type': 'application/json' });
|
|
201
|
+
response.end(JSON.stringify(payload));
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
205
|
+
const address = server.address();
|
|
206
|
+
if (!address || typeof address === 'string')
|
|
207
|
+
throw new Error('MATRIX_SERVER_ADDRESS_MISSING');
|
|
208
|
+
process.env.NEXUS_CLI_HOME = node_path_1.default.join(root, 'cli-home');
|
|
209
|
+
(0, auth_store_1.saveCredential)({ alias: 'matrix', instanceUrl: `http://127.0.0.1:${address.port}`,
|
|
210
|
+
accessToken: 'matrix-token', username: 'matrix@example.test',
|
|
211
|
+
orgId: '00000000-0000-4000-8000-000000000004' });
|
|
212
|
+
},
|
|
213
|
+
teardown: async () => {
|
|
214
|
+
if (previousHome === undefined)
|
|
215
|
+
delete process.env.NEXUS_CLI_HOME;
|
|
216
|
+
else
|
|
217
|
+
process.env.NEXUS_CLI_HOME = previousHome;
|
|
218
|
+
if (server)
|
|
219
|
+
await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
|
|
220
|
+
await promises_1.default.rm(root, { recursive: true, force: true });
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
async function changeSetValidationAdapter() {
|
|
225
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-cli-changeset-matrix-'));
|
|
226
|
+
const previousBaseUrl = process.env.NEXUS_BASE_URL;
|
|
227
|
+
const previousToken = process.env.NEXUS_AUTH_TOKEN;
|
|
228
|
+
let server;
|
|
229
|
+
let persistentMutations = 0;
|
|
230
|
+
return {
|
|
231
|
+
adapterId: 'changeset-validation', root, remoteMutationCount: () => persistentMutations,
|
|
232
|
+
setup: async () => {
|
|
233
|
+
server = node_http_1.default.createServer((request, response) => {
|
|
234
|
+
if (request.url?.endsWith('/deploy') || request.url?.endsWith('/rollback'))
|
|
235
|
+
persistentMutations += 1;
|
|
236
|
+
const valid = request.method === 'POST' && request.url === '/api/changesets/matrix-change-set/validate';
|
|
237
|
+
const payload = valid ? {
|
|
238
|
+
changeSet: { id: 'matrix-change-set', status: 'draft' },
|
|
239
|
+
report: { success: true, errors: [], warnings: [], summary: ['Validation passed'] },
|
|
240
|
+
} : { message: 'Unexpected controlled route' };
|
|
241
|
+
response.writeHead(valid ? 200 : 404, { 'content-type': 'application/json' });
|
|
242
|
+
response.end(JSON.stringify(payload));
|
|
243
|
+
});
|
|
244
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
245
|
+
const address = server.address();
|
|
246
|
+
if (!address || typeof address === 'string')
|
|
247
|
+
throw new Error('MATRIX_SERVER_ADDRESS_MISSING');
|
|
248
|
+
process.env.NEXUS_BASE_URL = `http://127.0.0.1:${address.port}`;
|
|
249
|
+
process.env.NEXUS_AUTH_TOKEN = 'matrix-token';
|
|
250
|
+
},
|
|
251
|
+
teardown: async () => {
|
|
252
|
+
if (previousBaseUrl === undefined)
|
|
253
|
+
delete process.env.NEXUS_BASE_URL;
|
|
254
|
+
else
|
|
255
|
+
process.env.NEXUS_BASE_URL = previousBaseUrl;
|
|
256
|
+
if (previousToken === undefined)
|
|
257
|
+
delete process.env.NEXUS_AUTH_TOKEN;
|
|
258
|
+
else
|
|
259
|
+
process.env.NEXUS_AUTH_TOKEN = previousToken;
|
|
260
|
+
if (server)
|
|
261
|
+
await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
|
|
262
|
+
await promises_1.default.rm(root, { recursive: true, force: true });
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
async function metadataAdapter(kind) {
|
|
267
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-cli-metadata-matrix-'));
|
|
268
|
+
const previousCwd = process.cwd();
|
|
269
|
+
const previousBaseUrl = process.env.NEXUS_BASE_URL;
|
|
270
|
+
const previousToken = process.env.NEXUS_AUTH_TOKEN;
|
|
271
|
+
let server;
|
|
272
|
+
let persistentMutations = 0;
|
|
273
|
+
return {
|
|
274
|
+
adapterId: kind === 'deploy' ? 'metadata-deploy-validation' : `metadata-${kind}`,
|
|
275
|
+
root, remoteMutationCount: () => persistentMutations,
|
|
276
|
+
setup: async () => {
|
|
277
|
+
if (kind === 'import-changed') {
|
|
278
|
+
await promises_1.default.mkdir(node_path_1.default.join(root, 'src/metadata/objects/Account'), { recursive: true });
|
|
279
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'src/metadata/objects/Account/object.json'), '{"apiName":"Account"}');
|
|
280
|
+
}
|
|
281
|
+
server = node_http_1.default.createServer((request, response) => {
|
|
282
|
+
let raw = '';
|
|
283
|
+
request.on('data', (chunk) => { raw += String(chunk); });
|
|
284
|
+
request.on('end', () => {
|
|
285
|
+
const body = JSON.parse(raw || '{}');
|
|
286
|
+
let valid = true;
|
|
287
|
+
let payload;
|
|
288
|
+
if (request.url === '/api/metadata/validate') {
|
|
289
|
+
payload = { success: true, errors: [], warnings: [] };
|
|
290
|
+
}
|
|
291
|
+
else if (request.url === '/api/metadata/runtime/import') {
|
|
292
|
+
if (body.dryRun !== true)
|
|
293
|
+
persistentMutations += 1;
|
|
294
|
+
const changed = kind === 'import-changed';
|
|
295
|
+
payload = { applied: false, dryRun: true, destructiveSync: false,
|
|
296
|
+
beforeRevision: 'remote-1', afterRevision: 'remote-1', plan: {
|
|
297
|
+
dryRun: true, destructiveSync: false, validation: { valid: true, summary: [] },
|
|
298
|
+
diff: { humanSummary: changed ? ['Would create Account'] : [], summary: {
|
|
299
|
+
objects: { created: changed ? 1 : 0, updated: 0, deleted: 0 },
|
|
300
|
+
fields: { created: 0, updated: 0, deleted: 0 },
|
|
301
|
+
} },
|
|
302
|
+
} };
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
valid = false;
|
|
306
|
+
if (request.url === '/api/metadata/deploy')
|
|
307
|
+
persistentMutations += 1;
|
|
308
|
+
payload = { message: 'Unexpected controlled route' };
|
|
309
|
+
}
|
|
310
|
+
response.writeHead(valid ? 200 : 404, { 'content-type': 'application/json' });
|
|
311
|
+
response.end(JSON.stringify(payload));
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
315
|
+
const address = server.address();
|
|
316
|
+
if (!address || typeof address === 'string')
|
|
317
|
+
throw new Error('MATRIX_SERVER_ADDRESS_MISSING');
|
|
318
|
+
process.env.NEXUS_BASE_URL = `http://127.0.0.1:${address.port}`;
|
|
319
|
+
process.env.NEXUS_AUTH_TOKEN = 'matrix-token';
|
|
320
|
+
process.chdir(root);
|
|
321
|
+
},
|
|
322
|
+
teardown: async () => {
|
|
323
|
+
process.chdir(previousCwd);
|
|
324
|
+
if (previousBaseUrl === undefined)
|
|
325
|
+
delete process.env.NEXUS_BASE_URL;
|
|
326
|
+
else
|
|
327
|
+
process.env.NEXUS_BASE_URL = previousBaseUrl;
|
|
328
|
+
if (previousToken === undefined)
|
|
329
|
+
delete process.env.NEXUS_AUTH_TOKEN;
|
|
330
|
+
else
|
|
331
|
+
process.env.NEXUS_AUTH_TOKEN = previousToken;
|
|
332
|
+
if (server)
|
|
333
|
+
await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
|
|
334
|
+
await promises_1.default.rm(root, { recursive: true, force: true });
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
async function sandboxPromotionAdapter() {
|
|
339
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-cli-sandbox-promote-matrix-'));
|
|
340
|
+
const previousBaseUrl = process.env.NEXUS_BASE_URL;
|
|
341
|
+
const previousToken = process.env.NEXUS_AUTH_TOKEN;
|
|
342
|
+
let server;
|
|
343
|
+
let persistentMutations = 0;
|
|
344
|
+
return {
|
|
345
|
+
adapterId: 'sandbox-promotion-precheck', root, remoteMutationCount: () => persistentMutations,
|
|
346
|
+
setup: async () => {
|
|
347
|
+
server = node_http_1.default.createServer((request, response) => {
|
|
348
|
+
let raw = '';
|
|
349
|
+
request.on('data', (chunk) => { raw += String(chunk); });
|
|
350
|
+
request.on('end', () => {
|
|
351
|
+
const body = JSON.parse(raw || '{}');
|
|
352
|
+
if (body.query?.includes('mutation PromoteSandbox'))
|
|
353
|
+
persistentMutations += 1;
|
|
354
|
+
const payload = body.query?.includes('query PromotionPrecheck')
|
|
355
|
+
? { data: { promotionPrecheck: { canPromote: true, warnings: [], errors: [],
|
|
356
|
+
frontendDiff: { from: 'sandbox', to: 'production', changes: ['matrix frontend'] },
|
|
357
|
+
backendDiff: { from: 'sandbox', to: 'production', changes: ['matrix backend'] } } } }
|
|
358
|
+
: { errors: [{ message: 'Unexpected controlled query' }] };
|
|
359
|
+
response.writeHead(200, { 'content-type': 'application/json' });
|
|
360
|
+
response.end(JSON.stringify(payload));
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
364
|
+
const address = server.address();
|
|
365
|
+
if (!address || typeof address === 'string')
|
|
366
|
+
throw new Error('MATRIX_SERVER_ADDRESS_MISSING');
|
|
367
|
+
process.env.NEXUS_BASE_URL = `http://127.0.0.1:${address.port}`;
|
|
368
|
+
process.env.NEXUS_AUTH_TOKEN = 'matrix-token';
|
|
369
|
+
},
|
|
370
|
+
teardown: async () => {
|
|
371
|
+
if (previousBaseUrl === undefined)
|
|
372
|
+
delete process.env.NEXUS_BASE_URL;
|
|
373
|
+
else
|
|
374
|
+
process.env.NEXUS_BASE_URL = previousBaseUrl;
|
|
375
|
+
if (previousToken === undefined)
|
|
376
|
+
delete process.env.NEXUS_AUTH_TOKEN;
|
|
377
|
+
else
|
|
378
|
+
process.env.NEXUS_AUTH_TOKEN = previousToken;
|
|
379
|
+
if (server)
|
|
380
|
+
await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
|
|
381
|
+
await promises_1.default.rm(root, { recursive: true, force: true });
|
|
382
|
+
},
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
async function workspaceSyncAdapter(operation, changed) {
|
|
386
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-cli-workspace-sync-matrix-'));
|
|
387
|
+
const previousCwd = process.cwd();
|
|
388
|
+
const previousHome = process.env.NEXUS_CLI_HOME;
|
|
389
|
+
let server;
|
|
390
|
+
let persistentMutations = 0;
|
|
391
|
+
return {
|
|
392
|
+
adapterId: `workspace-${operation}-${changed ? 'changed' : 'empty'}`, root,
|
|
393
|
+
remoteMutationCount: () => persistentMutations,
|
|
394
|
+
setup: async () => {
|
|
395
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'nexus-project.yaml'), [
|
|
396
|
+
'schemaVersion: nexus-project/v2', 'projectName: matrix-project',
|
|
397
|
+
'compatibleCoreVersion: 0.1.x', 'sourceRoot: src/metadata', 'defaultOrg: matrix',
|
|
398
|
+
'defaultEnvironment: dev',
|
|
399
|
+
'sourceRoots:', ' - path: src/metadata', ' kind: metadata-runtime',
|
|
400
|
+
' writeTarget: true', 'localPackages: []', 'environments:',
|
|
401
|
+
' - name: dev', ' path: env/dev.yaml', ' default: true',
|
|
402
|
+
].join('\n'));
|
|
403
|
+
await promises_1.default.mkdir(node_path_1.default.join(root, 'env'), { recursive: true });
|
|
404
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'env/dev.yaml'), [
|
|
405
|
+
'schemaVersion: dx-environment/v1', 'name: dev', 'type: dev-sandbox',
|
|
406
|
+
'target:', ' workspaceId: 00000000-0000-4000-8000-000000000004', ' orgAlias: matrix',
|
|
407
|
+
' sandboxId: matrix-sandbox',
|
|
408
|
+
'packageStack:', ' baseline:', ' packageName: foundation',
|
|
409
|
+
].join('\n'));
|
|
410
|
+
if (operation === 'push' && changed) {
|
|
411
|
+
await promises_1.default.mkdir(node_path_1.default.join(root, 'src/metadata/objects/Account'), { recursive: true });
|
|
412
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'src/metadata/objects/Account/object.json'), '{"apiName":"Account"}');
|
|
413
|
+
}
|
|
414
|
+
server = node_http_1.default.createServer((request, response) => {
|
|
415
|
+
let raw = '';
|
|
416
|
+
request.on('data', (chunk) => { raw += String(chunk); });
|
|
417
|
+
request.on('end', () => {
|
|
418
|
+
const body = JSON.parse(raw || '{}');
|
|
419
|
+
let payload;
|
|
420
|
+
if (body.query?.includes('query SourceStatus')) {
|
|
421
|
+
const files = operation === 'pull' && changed
|
|
422
|
+
? [{ path: 'objects/Account/object.json', hash: 'remote-hash',
|
|
423
|
+
componentKey: 'ObjectMetadata:Account', baselineHash: null }] : [];
|
|
424
|
+
payload = { data: { sourceStatus: { remoteRevision: 'remote-1', remoteHash: 'remote-hash',
|
|
425
|
+
baselineRevision: null, baselineHash: null, baselineSource: null, baselineAvailable: true,
|
|
426
|
+
changedComponentCount: files.length, files, baselineFiles: [], drift: null, tracking: null } } };
|
|
427
|
+
}
|
|
428
|
+
else if (body.query?.includes('query SourceFiles')) {
|
|
429
|
+
if (body.variables?.recordAccess === true)
|
|
430
|
+
persistentMutations += 1;
|
|
431
|
+
payload = { data: { sourceFiles: { remoteRevision: 'remote-1', files: [{
|
|
432
|
+
path: 'objects/Account/object.json', content: '{"apiName":"Account"}', hash: 'remote-hash',
|
|
433
|
+
componentKey: 'ObjectMetadata:Account',
|
|
434
|
+
}] } } };
|
|
435
|
+
}
|
|
436
|
+
else if (body.query?.includes('mutation PushSource')) {
|
|
437
|
+
if (body.variables?.dryRun !== true)
|
|
438
|
+
persistentMutations += 1;
|
|
439
|
+
payload = { data: { pushSource: { success: true, count: changed ? 1 : 0, dryRun: true,
|
|
440
|
+
beforeRevision: 'remote-1', afterRevision: 'remote-1',
|
|
441
|
+
plan: { humanSummary: changed ? ['Would push Account'] : [] } } } };
|
|
442
|
+
}
|
|
443
|
+
else
|
|
444
|
+
payload = { errors: [{ message: 'Unexpected controlled query' }] };
|
|
445
|
+
response.writeHead(200, { 'content-type': 'application/json' });
|
|
446
|
+
response.end(JSON.stringify(payload));
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
450
|
+
const address = server.address();
|
|
451
|
+
if (!address || typeof address === 'string')
|
|
452
|
+
throw new Error('MATRIX_SERVER_ADDRESS_MISSING');
|
|
453
|
+
process.env.NEXUS_CLI_HOME = node_path_1.default.join(root, 'cli-home');
|
|
454
|
+
(0, auth_store_1.saveCredential)({ alias: 'matrix', instanceUrl: `http://127.0.0.1:${address.port}`,
|
|
455
|
+
accessToken: 'matrix-token', username: 'matrix@example.test',
|
|
456
|
+
orgId: '00000000-0000-4000-8000-000000000004' });
|
|
457
|
+
process.chdir(root);
|
|
458
|
+
},
|
|
459
|
+
teardown: async () => {
|
|
460
|
+
process.chdir(previousCwd);
|
|
461
|
+
if (previousHome === undefined)
|
|
462
|
+
delete process.env.NEXUS_CLI_HOME;
|
|
463
|
+
else
|
|
464
|
+
process.env.NEXUS_CLI_HOME = previousHome;
|
|
465
|
+
if (server)
|
|
466
|
+
await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
|
|
467
|
+
await promises_1.default.rm(root, { recursive: true, force: true });
|
|
468
|
+
},
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
async function packageLifecycleAdapter() {
|
|
472
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-cli-package-lifecycle-matrix-'));
|
|
473
|
+
const previousCwd = process.cwd();
|
|
474
|
+
const previousHome = process.env.NEXUS_CLI_HOME;
|
|
475
|
+
const previousWorkspaceId = process.env.NEXUS_WORKSPACE_ID;
|
|
476
|
+
let server;
|
|
477
|
+
let persistentMutations = 0;
|
|
478
|
+
return {
|
|
479
|
+
adapterId: 'package-lifecycle-preview', root, remoteMutationCount: () => persistentMutations,
|
|
480
|
+
setup: async () => {
|
|
481
|
+
const packageDir = node_path_1.default.join(root, 'packages/matrix-package');
|
|
482
|
+
await promises_1.default.mkdir(node_path_1.default.join(packageDir, 'metadata/objects'), { recursive: true });
|
|
483
|
+
await promises_1.default.writeFile(node_path_1.default.join(packageDir, 'package.yaml'), [
|
|
484
|
+
'schemaVersion: v1', 'name: matrix-package', 'packageType: extension-pack',
|
|
485
|
+
'packageClass: metadata', 'description: Matrix contract package fixture', 'version: 1.0.0',
|
|
486
|
+
'dependencies: []', 'compatibleCoreVersion: "^1.0.0"', 'installOrder: 300',
|
|
487
|
+
'includedMetadataKinds: [objects]', 'includedSeedKinds: []', 'visibility: internal',
|
|
488
|
+
'releaseChannel: preview', 'kindSupport:', ' - kind: objects',
|
|
489
|
+
' executionMode: installer-input-backed',
|
|
490
|
+
].join('\n'));
|
|
491
|
+
await promises_1.default.writeFile(node_path_1.default.join(packageDir, 'metadata/objects/account.yaml'), [
|
|
492
|
+
'kind: object', 'object:', ' nameSingular: Account', ' namePlural: Accounts',
|
|
493
|
+
' labelSingular: Account', ' labelPlural: Accounts', ' isCustom: true',
|
|
494
|
+
].join('\n'));
|
|
495
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'nexus-project.yaml'), [
|
|
496
|
+
'schemaVersion: nexus-project/v2', 'projectName: matrix-project',
|
|
497
|
+
'compatibleCoreVersion: 0.1.x', 'sourceRoots: []', 'localPackages:',
|
|
498
|
+
' - name: matrix-package', ' path: packages/matrix-package',
|
|
499
|
+
'defaultEnvironment: dev', 'defaultOrg: matrix', 'environments:',
|
|
500
|
+
' - name: dev', ' path: env/dev.yaml',
|
|
501
|
+
].join('\n'));
|
|
502
|
+
await promises_1.default.mkdir(node_path_1.default.join(root, 'env'), { recursive: true });
|
|
503
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'env/dev.yaml'), [
|
|
504
|
+
'schemaVersion: dx-environment/v1', 'name: dev', 'type: dev-sandbox', 'target:',
|
|
505
|
+
' workspaceId: 00000000-0000-4000-8000-000000000004', ' orgAlias: matrix',
|
|
506
|
+
'packageStack:', ' baseline:', ' packageName: foundation',
|
|
507
|
+
].join('\n'));
|
|
508
|
+
server = node_http_1.default.createServer((request, response) => {
|
|
509
|
+
let raw = '';
|
|
510
|
+
request.on('data', (chunk) => { raw += String(chunk); });
|
|
511
|
+
request.on('end', () => {
|
|
512
|
+
const body = JSON.parse(raw || '{}');
|
|
513
|
+
let payload;
|
|
514
|
+
if (body.query?.includes('MetadataPackageInstallPlan')) {
|
|
515
|
+
payload = { data: { metadataPackageInstallPlan: { packageNames: ['matrix-package'],
|
|
516
|
+
orderedSteps: [], warnings: [], dependencies: { conflictSummary: [] } } } };
|
|
517
|
+
}
|
|
518
|
+
else if (body.query?.includes('InstallMetadataPackage')) {
|
|
519
|
+
if (body.variables?.dryRun !== true)
|
|
520
|
+
persistentMutations += 1;
|
|
521
|
+
payload = { data: { installMetadataPackage: { packageName: 'matrix-package', status: 'noop',
|
|
522
|
+
appliedMetadataKinds: ['objects'], appliedSeedKinds: [], warnings: [],
|
|
523
|
+
executionTrack: 'installer-input', installedStateId: null } } };
|
|
524
|
+
}
|
|
525
|
+
else if (body.query?.includes('MetadataPackageInstallHistory')) {
|
|
526
|
+
payload = { data: { metadataPackageInstallHistory: [{ id: 'matrix-history',
|
|
527
|
+
workspaceId: '00000000-0000-4000-8000-000000000004', packageName: 'matrix-package',
|
|
528
|
+
version: '1.0.0', action: 'install', status: 'installed', installSource: 'registry',
|
|
529
|
+
sourceUri: 'matrix', manifest: { schemaVersion: 'v1', name: 'matrix-package',
|
|
530
|
+
packageType: 'extension-pack', packageClass: 'metadata', description: 'Matrix contract package fixture',
|
|
531
|
+
version: '1.0.0', dependencies: [], compatibleCoreVersion: '^1.0.0', installOrder: 300,
|
|
532
|
+
includedMetadataKinds: ['objects'], includedSeedKinds: [], visibility: 'internal',
|
|
533
|
+
releaseChannel: 'preview', kindSupport: [{ kind: 'objects', executionMode: 'installer-input-backed' }] },
|
|
534
|
+
details: null, createdAt: '2026-08-02T00:00:00.000Z' }] } };
|
|
535
|
+
}
|
|
536
|
+
else if (body.query?.includes('RollbackMetadataPackageInstall')) {
|
|
537
|
+
if (body.variables?.dryRun !== true)
|
|
538
|
+
persistentMutations += 1;
|
|
539
|
+
payload = { data: { rollbackMetadataPackageInstall: { packageName: 'matrix-package',
|
|
540
|
+
status: 'noop', restoredVersion: '1.0.0', warnings: [], componentChanges: {
|
|
541
|
+
toRemove: [], toRestore: [],
|
|
542
|
+
} } } };
|
|
543
|
+
}
|
|
544
|
+
else
|
|
545
|
+
payload = { errors: [{ message: 'Unexpected controlled query' }] };
|
|
546
|
+
response.writeHead(200, { 'content-type': 'application/json' });
|
|
547
|
+
response.end(JSON.stringify(payload));
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
551
|
+
const address = server.address();
|
|
552
|
+
if (!address || typeof address === 'string')
|
|
553
|
+
throw new Error('MATRIX_SERVER_ADDRESS_MISSING');
|
|
554
|
+
process.env.NEXUS_CLI_HOME = node_path_1.default.join(root, 'cli-home');
|
|
555
|
+
process.env.NEXUS_WORKSPACE_ID = '00000000-0000-4000-8000-000000000004';
|
|
556
|
+
(0, auth_store_1.saveCredential)({ alias: 'matrix', instanceUrl: `http://127.0.0.1:${address.port}`,
|
|
557
|
+
accessToken: 'matrix-token', username: 'matrix@example.test',
|
|
558
|
+
orgId: '00000000-0000-4000-8000-000000000004' });
|
|
559
|
+
process.chdir(root);
|
|
560
|
+
},
|
|
561
|
+
teardown: async () => {
|
|
562
|
+
process.chdir(previousCwd);
|
|
563
|
+
if (previousHome === undefined)
|
|
564
|
+
delete process.env.NEXUS_CLI_HOME;
|
|
565
|
+
else
|
|
566
|
+
process.env.NEXUS_CLI_HOME = previousHome;
|
|
567
|
+
if (previousWorkspaceId === undefined)
|
|
568
|
+
delete process.env.NEXUS_WORKSPACE_ID;
|
|
569
|
+
else
|
|
570
|
+
process.env.NEXUS_WORKSPACE_ID = previousWorkspaceId;
|
|
571
|
+
if (server)
|
|
572
|
+
await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
|
|
573
|
+
await promises_1.default.rm(root, { recursive: true, force: true });
|
|
574
|
+
},
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
async function employeeDeployAdapter() {
|
|
578
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-cli-employee-deploy-matrix-'));
|
|
579
|
+
const previousCwd = process.cwd();
|
|
580
|
+
const previousBaseUrl = process.env.NEXUS_BASE_URL;
|
|
581
|
+
const previousToken = process.env.NEXUS_AUTH_TOKEN;
|
|
582
|
+
let server;
|
|
583
|
+
let persistentMutations = 0;
|
|
584
|
+
return {
|
|
585
|
+
adapterId: 'employee-deploy-preview', root, remoteMutationCount: () => persistentMutations,
|
|
586
|
+
setup: async () => {
|
|
587
|
+
await promises_1.default.writeFile(node_path_1.default.join(root, 'employee-package.json'), JSON.stringify({
|
|
588
|
+
schemaVersion: 'v1', name: 'matrix-employee', version: '1.0.0',
|
|
589
|
+
agent: { apiName: 'matrix_employee', name: 'Matrix Employee', type: 'sales', topics: [],
|
|
590
|
+
toolBindings: [], guardrailRuleKeys: [], knowledgeBaseKeys: [],
|
|
591
|
+
modelConfig: { modelId: 'qwen-max', provider: 'dashscope', tier: 2,
|
|
592
|
+
temperature: 0.7, maxTokens: 2048, responseFormat: 'text' },
|
|
593
|
+
permissionConfig: { dataScopeType: 'own', maxQueriesPerMinute: 60,
|
|
594
|
+
maxWritesPerMinute: 20, maxBatchSize: 200, allowedTools: [], blockedTools: [], activeWindows: [] } },
|
|
595
|
+
guardrails: [], knowledge: [], evalCases: [{ key: 'eval:smoke', name: 'smoke', input: 'hi',
|
|
596
|
+
tags: ['readonly'], assertions: [{ type: 'status_done' }] }],
|
|
597
|
+
}));
|
|
598
|
+
server = node_http_1.default.createServer((request, response) => {
|
|
599
|
+
let raw = '';
|
|
600
|
+
request.on('data', (chunk) => { raw += String(chunk); });
|
|
601
|
+
request.on('end', () => {
|
|
602
|
+
const body = JSON.parse(raw || '{}');
|
|
603
|
+
if (body.query?.includes('mutation DeployEmployeePackage') && body.variables?.dryRun !== true) {
|
|
604
|
+
persistentMutations += 1;
|
|
605
|
+
}
|
|
606
|
+
const payload = body.query?.includes('mutation DeployEmployeePackage')
|
|
607
|
+
? { data: { deployEmployeePackage: { status: 'validated', agentId: null,
|
|
608
|
+
agentStatus: 'draft', activated: false, guardrails: { upserted: 0 },
|
|
609
|
+
knowledge: { upserted: 0, embedded: 0, skippedEmbeddings: 0 },
|
|
610
|
+
evalCases: { upserted: 0, ran: 0, skippedMutating: 0 },
|
|
611
|
+
gate: { passRate: 1, minPassRate: 1, baselinePassRate: null, regressed: false,
|
|
612
|
+
passed: true, casesRun: 1, failures: [] }, errors: [] } } }
|
|
613
|
+
: { errors: [{ message: 'Unexpected controlled query' }] };
|
|
614
|
+
response.writeHead(200, { 'content-type': 'application/json' });
|
|
615
|
+
response.end(JSON.stringify(payload));
|
|
616
|
+
});
|
|
617
|
+
});
|
|
618
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
619
|
+
const address = server.address();
|
|
620
|
+
if (!address || typeof address === 'string')
|
|
621
|
+
throw new Error('MATRIX_SERVER_ADDRESS_MISSING');
|
|
622
|
+
process.env.NEXUS_BASE_URL = `http://127.0.0.1:${address.port}`;
|
|
623
|
+
process.env.NEXUS_AUTH_TOKEN = 'matrix-token';
|
|
624
|
+
process.chdir(root);
|
|
625
|
+
},
|
|
626
|
+
teardown: async () => {
|
|
627
|
+
process.chdir(previousCwd);
|
|
628
|
+
if (previousBaseUrl === undefined)
|
|
629
|
+
delete process.env.NEXUS_BASE_URL;
|
|
630
|
+
else
|
|
631
|
+
process.env.NEXUS_BASE_URL = previousBaseUrl;
|
|
632
|
+
if (previousToken === undefined)
|
|
633
|
+
delete process.env.NEXUS_AUTH_TOKEN;
|
|
634
|
+
else
|
|
635
|
+
process.env.NEXUS_AUTH_TOKEN = previousToken;
|
|
636
|
+
if (server)
|
|
637
|
+
await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
|
|
638
|
+
await promises_1.default.rm(root, { recursive: true, force: true });
|
|
639
|
+
},
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
async function workforceBundleSignedAdapter() {
|
|
643
|
+
const root = await promises_1.default.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'nexus-cli-workforce-bundle-matrix-'));
|
|
644
|
+
const previousCwd = process.cwd();
|
|
645
|
+
const previousHome = process.env.NEXUS_CLI_HOME;
|
|
646
|
+
const { privateKey, publicKey } = (0, node_crypto_1.generateKeyPairSync)('ed25519');
|
|
647
|
+
const publicKeyJwk = publicKey.export({ format: 'jwk' });
|
|
648
|
+
const digest = `sha256:${'a'.repeat(64)}`;
|
|
649
|
+
const generatedAt = new Date().toISOString();
|
|
650
|
+
const expiresAt = new Date(Date.now() + 60 * 60 * 1000).toISOString();
|
|
651
|
+
let server;
|
|
652
|
+
let persistentMutations = 0;
|
|
653
|
+
return {
|
|
654
|
+
adapterId: 'workforce-bundle-signed-preview', root,
|
|
655
|
+
remoteMutationCount: () => persistentMutations,
|
|
656
|
+
setup: async () => {
|
|
657
|
+
server = node_http_1.default.createServer((request, response) => {
|
|
658
|
+
const send = (payload) => {
|
|
659
|
+
response.writeHead(200, { 'content-type': 'application/json' });
|
|
660
|
+
response.end(JSON.stringify(payload));
|
|
661
|
+
};
|
|
662
|
+
if (request.method === 'GET' && request.url === '/api/v1/ai-authoring-context/signing-keys') {
|
|
663
|
+
send({ schemaVersion: shared_1.AI_CONTEXT_SIGNING_KEY_SET_SCHEMA_VERSION,
|
|
664
|
+
issuer: `http://127.0.0.1:${server.address().port}`,
|
|
665
|
+
generatedAt, cacheUntil: expiresAt, keys: [{ keyId: 'matrix-key', alg: 'EdDSA',
|
|
666
|
+
publicKeyJwk, notBefore: generatedAt, notAfter: expiresAt, status: 'active' }] });
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
let raw = '';
|
|
670
|
+
request.on('data', (chunk) => { raw += String(chunk); });
|
|
671
|
+
request.on('end', () => {
|
|
672
|
+
const body = JSON.parse(raw || '{}');
|
|
673
|
+
const input = body.variables?.input ?? {};
|
|
674
|
+
if (body.query?.includes('mutation '))
|
|
675
|
+
persistentMutations += 1;
|
|
676
|
+
if (body.query?.includes('query DescribeAiAuthoringContext')) {
|
|
677
|
+
const catalog = { schemaVersion: 'matrix.catalog/v1', digest, canonicalJson: '{"items":[]}' };
|
|
678
|
+
send({ data: { describeAiAuthoringContext: {
|
|
679
|
+
schemaVersion: shared_1.AI_AUTHORING_CONTEXT_SCHEMA_VERSION, coreVersion: '1.0.0',
|
|
680
|
+
coreCommitSha: 'a'.repeat(40), cliVersion: '0.2.0', runtimeApiVersion: 'v2',
|
|
681
|
+
surface: 'all', targetWorkspaceId: '00000000-0000-4000-8000-000000000004',
|
|
682
|
+
principalKind: 'human', principalId: 'matrix-user', agentApiName: null,
|
|
683
|
+
releaseSetId: null, releaseStamp: null, contractDigest: digest,
|
|
684
|
+
workspaceContractHash: digest, principalScopeDigest: digest, generatedAt, expiresAt,
|
|
685
|
+
objectCatalog: catalog, invokableCatalog: catalog, connectorCatalog: catalog,
|
|
686
|
+
aiPolicyCatalog: catalog, approvalPolicyCatalog: catalog,
|
|
687
|
+
} } });
|
|
688
|
+
}
|
|
689
|
+
else if (body.query?.includes('query SignAiAuthoringContextLock')) {
|
|
690
|
+
const signing = (0, shared_1.buildAiContextDetachedSigningInput)({ lockDigest: input.lockDigest,
|
|
691
|
+
workspaceId: input.targetWorkspaceId, principalScopeDigest: input.principalScopeDigest,
|
|
692
|
+
orgAliasClaim: input.orgAliasClaim, generatedAt: input.generatedAt, expiresAt: input.expiresAt }, 'matrix-key');
|
|
693
|
+
const signature = `${signing.protectedHeader}..${(0, node_crypto_1.sign)(null, signing.signingInput, privateKey).toString('base64url')}`;
|
|
694
|
+
send({ data: { signAiAuthoringContextLock: { schemaVersion: shared_1.AI_AUTHORING_CONTEXT_LOCK_SCHEMA_VERSION,
|
|
695
|
+
contentDigest: input.contentDigest, manifestContentDigest: input.manifestContentDigest,
|
|
696
|
+
manifestEnvelopeDigest: input.manifestEnvelopeDigest, lockDigest: input.lockDigest,
|
|
697
|
+
signatureAlgorithm: 'EdDSA', keyId: 'matrix-key', signature } } });
|
|
698
|
+
}
|
|
699
|
+
else if (body.query?.includes('query VerifyAiAuthoringContextFreshness')) {
|
|
700
|
+
send({ data: { verifyAiAuthoringContextFreshness: { valid: true, stale: false, reasons: [],
|
|
701
|
+
currentHashes: { contractDigest: digest, workspaceContractHash: digest, principalScopeDigest: digest } } } });
|
|
702
|
+
}
|
|
703
|
+
else if (body.query?.includes('query PlanExecutableWorkforceBundle')) {
|
|
704
|
+
send({ data: { planExecutableWorkforceBundle: { schemaVersion: 'nexusclaw.executable-workforce-bundle-plan/v1',
|
|
705
|
+
planDigest: digest, releaseItemSetDigest: digest, sourceLockDigest: digest,
|
|
706
|
+
plannedItems: [], headAtPlan: { activeReleaseSetId: null, generation: 0 }, lock: {} } } });
|
|
707
|
+
}
|
|
708
|
+
else
|
|
709
|
+
send({ errors: [{ message: 'Unexpected controlled query' }] });
|
|
710
|
+
});
|
|
711
|
+
});
|
|
712
|
+
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
713
|
+
const address = server.address();
|
|
714
|
+
if (!address || typeof address === 'string')
|
|
715
|
+
throw new Error('MATRIX_SERVER_ADDRESS_MISSING');
|
|
716
|
+
process.env.NEXUS_CLI_HOME = node_path_1.default.join(root, 'cli-home');
|
|
717
|
+
(0, auth_store_1.saveCredential)({ alias: 'matrix', instanceUrl: `http://127.0.0.1:${address.port}`,
|
|
718
|
+
accessToken: 'matrix-token', username: 'matrix@example.test',
|
|
719
|
+
orgId: '00000000-0000-4000-8000-000000000004' });
|
|
720
|
+
const contextDir = node_path_1.default.join(root, 'context');
|
|
721
|
+
await (0, ai_authoring_context_v2_1.exportAuthoringContextV2)({ surface: 'all', targetOrg: 'matrix', callerPreview: true,
|
|
722
|
+
outDir: contextDir, workspaceDir: root });
|
|
723
|
+
const authoringContext = (0, ai_authoring_context_v2_1.loadAuthoringContextFreshnessInput)(node_path_1.default.join(contextDir, 'context-manifest.json'));
|
|
724
|
+
const bundleDir = node_path_1.default.join(root, 'bundle/.nexusclaw');
|
|
725
|
+
await promises_1.default.mkdir(bundleDir, { recursive: true });
|
|
726
|
+
await promises_1.default.writeFile(node_path_1.default.join(bundleDir, 'workforce-remote-state.json'), JSON.stringify({
|
|
727
|
+
schemaVersion: 'nexusclaw.workforce-bundle-remote-state/v1', targetOrg: 'matrix',
|
|
728
|
+
contextManifestPath: node_path_1.default.join(contextDir, 'context-manifest.json'),
|
|
729
|
+
artifactInput: { schemaVersion: 'nexusclaw.workforce-bundle-artifact-operation-input/v1',
|
|
730
|
+
targetWorkspaceId: '00000000-0000-4000-8000-000000000004', stagedArtifactId: 'matrix-artifact',
|
|
731
|
+
expectedArchiveDigest: digest, expectedPackageDigest: digest,
|
|
732
|
+
contextManifestContentDigest: authoringContext.manifestContentDigest,
|
|
733
|
+
runtimeBindingsDigest: digest, expectedPortableBundleDigest: digest }, authoringContext,
|
|
734
|
+
}));
|
|
735
|
+
process.chdir(root);
|
|
736
|
+
},
|
|
737
|
+
teardown: async () => {
|
|
738
|
+
process.chdir(previousCwd);
|
|
739
|
+
if (previousHome === undefined)
|
|
740
|
+
delete process.env.NEXUS_CLI_HOME;
|
|
741
|
+
else
|
|
742
|
+
process.env.NEXUS_CLI_HOME = previousHome;
|
|
743
|
+
if (server)
|
|
744
|
+
await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
|
|
745
|
+
await promises_1.default.rm(root, { recursive: true, force: true });
|
|
746
|
+
},
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
(0, node_test_1.default)('generated matrix completes every registry-derived framework scenario', async () => {
|
|
750
|
+
const inventory = (0, command_inventory_1.buildCommandInventory)((0, cli_1.buildCliProgram)());
|
|
751
|
+
const policies = (0, command_policy_registry_1.buildCommandPolicyRegistry)(inventory, command_contract_registry_1.commandContractRegistry.all().map((entry) => entry.contract));
|
|
752
|
+
const manifest = {
|
|
753
|
+
...(0, command_contract_matrix_1.buildControlledTerminalScenarioManifest)(policies),
|
|
754
|
+
...(0, command_contract_matrix_1.buildPreDispatchFailureScenarioManifest)(policies),
|
|
755
|
+
...command_contract_matrix_scenarios_1.controlledDryRunScenarioManifest,
|
|
756
|
+
};
|
|
757
|
+
const executed = new Set();
|
|
758
|
+
for (const [scenarioId, declaration] of Object.entries(manifest)) {
|
|
759
|
+
if (declaration.status === 'inapplicable')
|
|
760
|
+
continue;
|
|
761
|
+
strict_1.default.equal(declaration.status, 'fixture');
|
|
762
|
+
strict_1.default.ok(declaration.fixture);
|
|
763
|
+
const controlledTerminal = declaration.fixture.adapterId.startsWith('controlled-terminal-');
|
|
764
|
+
const adapter = controlledTerminal
|
|
765
|
+
? { adapterId: declaration.fixture.adapterId, setup: () => undefined, teardown: () => undefined,
|
|
766
|
+
remoteMutationCount: () => 0 }
|
|
767
|
+
: declaration.fixture.adapterId === 'project-local-workspace'
|
|
768
|
+
? await projectLocalWorkspaceAdapter()
|
|
769
|
+
: declaration.fixture.adapterId === 'source-status-changed'
|
|
770
|
+
? await sourceStatusAdapter(true)
|
|
771
|
+
: declaration.fixture.adapterId === 'source-status-empty'
|
|
772
|
+
? await sourceStatusAdapter(false)
|
|
773
|
+
: declaration.fixture.adapterId === 'source-push-changed'
|
|
774
|
+
? await sourcePushAdapter(true)
|
|
775
|
+
: declaration.fixture.adapterId === 'source-push-empty'
|
|
776
|
+
? await sourcePushAdapter(false)
|
|
777
|
+
: declaration.fixture.adapterId === 'escalation-read-only'
|
|
778
|
+
? await escalationReadOnlyAdapter()
|
|
779
|
+
: declaration.fixture.adapterId === 'changeset-validation'
|
|
780
|
+
? await changeSetValidationAdapter()
|
|
781
|
+
: declaration.fixture.adapterId === 'metadata-deploy-validation'
|
|
782
|
+
? await metadataAdapter('deploy')
|
|
783
|
+
: declaration.fixture.adapterId === 'metadata-import-changed'
|
|
784
|
+
? await metadataAdapter('import-changed')
|
|
785
|
+
: declaration.fixture.adapterId === 'metadata-import-empty'
|
|
786
|
+
? await metadataAdapter('import-empty')
|
|
787
|
+
: declaration.fixture.adapterId === 'sandbox-promotion-precheck'
|
|
788
|
+
? await sandboxPromotionAdapter()
|
|
789
|
+
: declaration.fixture.adapterId === 'workspace-pull-changed'
|
|
790
|
+
? await workspaceSyncAdapter('pull', true)
|
|
791
|
+
: declaration.fixture.adapterId === 'workspace-pull-empty'
|
|
792
|
+
? await workspaceSyncAdapter('pull', false)
|
|
793
|
+
: declaration.fixture.adapterId === 'workspace-push-changed'
|
|
794
|
+
? await workspaceSyncAdapter('push', true)
|
|
795
|
+
: declaration.fixture.adapterId === 'workspace-push-empty'
|
|
796
|
+
? await workspaceSyncAdapter('push', false)
|
|
797
|
+
: declaration.fixture.adapterId === 'package-lifecycle-preview'
|
|
798
|
+
? await packageLifecycleAdapter()
|
|
799
|
+
: declaration.fixture.adapterId === 'employee-deploy-preview'
|
|
800
|
+
? await employeeDeployAdapter()
|
|
801
|
+
: declaration.fixture.adapterId === 'workforce-bundle-signed-preview'
|
|
802
|
+
? await workforceBundleSignedAdapter()
|
|
803
|
+
: declaration.fixture.adapterId === 'no-remote-mutation'
|
|
804
|
+
? noRemoteMutationAdapter : preDispatchAdapter;
|
|
805
|
+
const evidence = await (0, command_contract_matrix_runner_1.executeCliMatrixScenario)({
|
|
806
|
+
fixture: declaration.fixture,
|
|
807
|
+
adapter,
|
|
808
|
+
programFactory: controlledTerminal
|
|
809
|
+
? () => (0, command_contract_matrix_runner_1.buildControlledTerminalProgram)(cli_1.buildCliProgram, scenarioId.split('#')[0], declaration.fixture.adapterId.endsWith('-empty') ? 'empty' : 'success')
|
|
810
|
+
: cli_1.buildCliProgram,
|
|
811
|
+
sideEffectRoot: adapter.root,
|
|
812
|
+
requireNoPersistentSideEffects: declaration.fixture.adapterId !== 'commander-pre-dispatch',
|
|
813
|
+
});
|
|
814
|
+
if (scenarioId.endsWith('#failure')) {
|
|
815
|
+
strict_1.default.equal(evidence.exitCode, 64, scenarioId);
|
|
816
|
+
strict_1.default.equal(evidence.result.ok, false, scenarioId);
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
strict_1.default.equal(evidence.exitCode, 0, `${scenarioId}: ${evidence.stdout}`);
|
|
820
|
+
strict_1.default.equal(evidence.result.ok, true, scenarioId);
|
|
821
|
+
}
|
|
822
|
+
strict_1.default.equal(evidence.result.command, scenarioId.split('#')[0], scenarioId);
|
|
823
|
+
executed.add(scenarioId);
|
|
824
|
+
}
|
|
825
|
+
const report = (0, command_contract_matrix_1.buildCommandContractMatrixReport)(policies, manifest, executed);
|
|
826
|
+
strict_1.default.equal(executed.size, 940);
|
|
827
|
+
strict_1.default.equal(report.counts.tested, 940);
|
|
828
|
+
strict_1.default.equal(report.counts.inapplicable, 17);
|
|
829
|
+
strict_1.default.equal(report.counts.exempted, 161);
|
|
830
|
+
strict_1.default.equal(report.counts.missing, 0);
|
|
831
|
+
strict_1.default.equal(report.scenarioCount, 1118);
|
|
832
|
+
strict_1.default.equal(report.ok, true);
|
|
833
|
+
strict_1.default.equal(report.counts.exempted, 161);
|
|
834
|
+
strict_1.default.equal(report.entries.filter((entry) => entry.kind === 'failure')
|
|
835
|
+
.every((entry) => entry.status === 'tested'), true);
|
|
836
|
+
const reportPath = process.env.NEXUS_CLI_MATRIX_REPORT_PATH;
|
|
837
|
+
if (reportPath) {
|
|
838
|
+
await promises_1.default.mkdir(node_path_1.default.dirname(reportPath), { recursive: true });
|
|
839
|
+
await promises_1.default.writeFile(reportPath, `${JSON.stringify(report, null, 2)}\n`);
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
//# sourceMappingURL=command-contract-matrix.generated.test.js.map
|