@aifabrix/builder 2.45.5 → 2.47.0
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/.cursor/rules/cli-layout.mdc +2 -0
- package/.cursor/rules/cli-product-neutral.mdc +43 -0
- package/.cursor/rules/project-rules.mdc +1 -0
- package/.npmrc.token +1 -0
- package/.temp/jest-protection-convert/run-IFN2nv/.protection/hubspot-companies.json +1 -0
- package/.temp/jest-protection-convert/run-IvmKLO/.protection/hubspot-companies.yaml +17 -0
- package/.temp/jest-protection-convert/run-SdvblF/.protection/hubspot-companies.json +1 -0
- package/.temp/jest-protection-convert/run-b51TsW/.protection/hubspot-companies.json +1 -0
- package/.temp/jest-protection-convert/run-fiLmb1/.protection/hubspot-companies.json +1 -0
- package/.temp/jest-protection-convert/run-qYGHMU/.protection/hubspot-companies.yaml +17 -0
- package/.temp/jest-protection-fixtures/hubspot-Mq5re8/hubspot-companies.yaml +17 -0
- package/.temp/jest-protection-fixtures/hubspot-f3u4YL/hubspot-companies.yaml +17 -0
- package/.temp/jest-protection-fixtures/hubspot-iQtd1O/hubspot-companies.yaml +17 -0
- package/.temp/jest-protection-fixtures/hubspot-mdmz5M/hubspot-companies.yaml +17 -0
- package/.temp/jest-protection-fixtures/hubspot-qbKYxQ/hubspot-companies.yaml +17 -0
- package/.temp/jest-protection-fixtures/hubspot-yzlJy6/hubspot-companies.yaml +17 -0
- package/.temp/validation/summary.txt +5 -0
- package/README.md +43 -17
- package/integration/hubspot-test/test-artifacts/wizard-hubspot-credential-real.yaml +1 -1
- package/integration/hubspot-test/test-artifacts/wizard-hubspot-env-vars.yaml +1 -1
- package/jest.config.default.js +2 -1
- package/jest.config.isolated.js +2 -1
- package/jest.global-live-fabrix-hooks.js +36 -0
- package/jest.isolated-projects.js +146 -0
- package/jest.projects.js +65 -136
- package/lib/api/api-response-errors.js +124 -0
- package/lib/api/dataplane-health.api.js +19 -7
- package/lib/api/governance-scenario-pack.api.js +159 -0
- package/lib/api/index.js +43 -3
- package/lib/api/lifecycle.api.js +98 -0
- package/lib/api/pipeline.api.js +3 -1
- package/lib/api/records-bulk.api.js +14 -1
- package/lib/api/resource-types.api.js +107 -0
- package/lib/api/runtime-configuration.api.js +72 -0
- package/lib/api/types/resource-types.types.js +45 -0
- package/lib/api/user-groups.api.js +9 -9
- package/lib/api/users.api.js +8 -8
- package/lib/api/validation-runner.js +3 -1
- package/lib/api/wizard.api.js +10 -2
- package/lib/app/deploy-config.js +4 -1
- package/lib/app/down.js +78 -27
- package/lib/app/index.js +2 -2
- package/lib/app/push.js +4 -5
- package/lib/app/register.js +7 -4
- package/lib/app/run-env-compose.js +84 -30
- package/lib/app/run-resolve-image.js +2 -1
- package/lib/app/run-stop-containers.js +113 -0
- package/lib/app/run.js +1 -31
- package/lib/app/show-display.js +35 -0
- package/lib/app/show.js +32 -1
- package/lib/build/index.js +22 -5
- package/lib/build/miso-controller-npm-sdk-guard.js +25 -0
- package/lib/certification/sync-system-certification.js +13 -6
- package/lib/channels/add-channel.js +348 -0
- package/lib/channels/channel-artifact-generator.js +141 -0
- package/lib/channels/channel-audit.js +101 -0
- package/lib/channels/channel-auth-context.js +37 -0
- package/lib/channels/channel-credential.js +200 -0
- package/lib/channels/channel-display-name.js +64 -0
- package/lib/channels/channel-external-system.js +106 -0
- package/lib/channels/channel-integration-generator.js +274 -0
- package/lib/channels/channel-probe.js +89 -0
- package/lib/channels/channel-runtime-resolver.js +152 -0
- package/lib/channels/channel-status-display.js +141 -0
- package/lib/channels/channel-targets.js +115 -0
- package/lib/cli/index.js +20 -4
- package/lib/cli/infra-guided-auth.js +109 -0
- package/lib/cli/infra-guided.js +84 -81
- package/lib/cli/setup-app.help.js +0 -31
- package/lib/cli/setup-app.js +82 -5
- package/lib/cli/setup-app.test-commands.js +5 -57
- package/lib/cli/setup-auth.js +25 -0
- package/lib/cli/setup-certification-commands.js +147 -0
- package/lib/cli/setup-certification.help.js +141 -0
- package/lib/cli/setup-environment.js +19 -2
- package/lib/cli/setup-external-system-help.js +62 -0
- package/lib/cli/setup-external-system.js +25 -3
- package/lib/cli/setup-infra-up-dataplane-action.js +2 -2
- package/lib/cli/setup-infra-up-platform-action.js +2 -1
- package/lib/cli/setup-infra.js +9 -1
- package/lib/cli/setup-platform.js +6 -1
- package/lib/cli/setup-secrets.js +33 -1
- package/lib/cli/setup-utility-help-after.js +25 -2
- package/lib/cli/setup-utility-repair.js +198 -0
- package/lib/cli/setup-utility-resolve.js +44 -5
- package/lib/cli/setup-utility-validate.js +197 -0
- package/lib/cli/setup-utility.js +4 -239
- package/lib/commands/app-logs.js +54 -26
- package/lib/commands/app.js +41 -0
- package/lib/commands/auth-status-client-tokens.js +214 -0
- package/lib/commands/auth-status-dataplane-version.js +142 -68
- package/lib/commands/auth-status.js +43 -54
- package/lib/commands/channel.js +58 -0
- package/lib/commands/datasource-test-trust-cli.js +27 -23
- package/lib/commands/datasource-unified-test-cli.js +6 -3
- package/lib/commands/datasource-unified-test-cli.options.js +5 -1
- package/lib/commands/datasource.js +8 -8
- package/lib/commands/dev-show-display.js +8 -1
- package/lib/commands/governance-cli-shared.js +94 -0
- package/lib/commands/governance-command-action.js +132 -0
- package/lib/commands/governance-download-external.js +34 -0
- package/lib/commands/governance-generate-external.js +71 -0
- package/lib/commands/governance-upload-external.js +36 -0
- package/lib/commands/governance-verify-external.js +64 -0
- package/lib/commands/governance.js +144 -0
- package/lib/commands/identity-apply-sync.js +49 -8
- package/lib/commands/identity-group-cli.js +66 -26
- package/lib/commands/identity-membership-role-cache.js +58 -37
- package/lib/commands/identity-shared.js +22 -1
- package/lib/commands/identity-user-cli.js +80 -34
- package/lib/commands/lifecycle-command-action.js +123 -0
- package/lib/commands/lifecycle-external.js +268 -0
- package/lib/commands/login.js +11 -2
- package/lib/commands/repair-auth-apply.js +153 -0
- package/lib/commands/repair-auth-config.js +8 -13
- package/lib/commands/repair-changed-files.js +41 -0
- package/lib/commands/repair-datasource-com-v2.js +15 -0
- package/lib/commands/repair-datasource-keys.js +4 -1
- package/lib/commands/repair-datasource-run.js +59 -0
- package/lib/commands/repair-datasource-service-contract.js +206 -0
- package/lib/commands/repair-datasource-test-payload.js +259 -0
- package/lib/commands/repair-datasource.js +49 -64
- package/lib/commands/repair-env-template.js +76 -25
- package/lib/commands/repair-external-run.js +216 -0
- package/lib/commands/repair-openapi-sync.js +49 -4
- package/lib/commands/repair-persist.js +4 -0
- package/lib/commands/repair-rbac.js +52 -1
- package/lib/commands/repair-steps.js +160 -0
- package/lib/commands/repair-system-alignment.js +7 -4
- package/lib/commands/repair.js +29 -296
- package/lib/commands/resource-type.js +371 -0
- package/lib/commands/secrets-get.js +184 -0
- package/lib/commands/secrets-remove-all.js +3 -1
- package/lib/commands/setup-image-refresh.js +146 -0
- package/lib/commands/setup-modes.js +158 -162
- package/lib/commands/setup-platform-auth.js +76 -0
- package/lib/commands/setup-prompts-admin.js +244 -0
- package/lib/commands/setup-prompts-platform-mode.js +70 -0
- package/lib/commands/setup-prompts-validators.js +36 -0
- package/lib/commands/setup-prompts.js +24 -76
- package/lib/commands/setup-run-context.js +45 -0
- package/lib/commands/setup-spinners.js +39 -0
- package/lib/commands/setup.js +27 -5
- package/lib/commands/teardown.js +39 -0
- package/lib/commands/test-e2e-external.js +24 -8
- package/lib/commands/test-governance-external.js +3 -24
- package/lib/commands/test-trust-external.js +48 -100
- package/lib/commands/up-common.js +57 -13
- package/lib/commands/up-dataplane.js +56 -15
- package/lib/commands/upload-publish-context.js +75 -0
- package/lib/commands/upload-sidecar-followups.js +89 -0
- package/lib/commands/upload.js +113 -110
- package/lib/commands/verify-governance-combined-external.js +61 -0
- package/lib/commands/verify-governance-command-action.js +64 -0
- package/lib/commands/verify-governance-db.js +102 -0
- package/lib/commands/verify-governance-external.js +77 -0
- package/lib/commands/verify-governance-result-builders.js +71 -0
- package/lib/commands/verify-operations-command-action.js +68 -0
- package/lib/commands/verify-operations-external.js +268 -0
- package/lib/commands/verify-operations-persist.js +75 -0
- package/lib/commands/verify-operations-step-plan.js +68 -0
- package/lib/commands/verify-operations-steps.js +111 -0
- package/lib/commands/verify-trust-command-action.js +73 -0
- package/lib/commands/verify-trust-external.js +59 -0
- package/lib/commands/wizard-config-normalizer.js +43 -23
- package/lib/commands/wizard-core.js +2 -0
- package/lib/core/admin-password-generator.js +38 -0
- package/lib/core/admin-secrets-bundle.js +111 -0
- package/lib/core/admin-secrets-env-overlay.js +62 -0
- package/lib/core/admin-secrets.js +32 -4
- package/lib/core/config-attach-extensions.js +3 -0
- package/lib/core/config-platform-controller.js +44 -0
- package/lib/core/config-setup-installation-profile.js +42 -0
- package/lib/core/config-setup-platform-mode.js +46 -0
- package/lib/core/config.js +46 -36
- package/lib/core/secrets-admin-env.js +6 -2
- package/lib/core/secrets-ensure.js +4 -0
- package/lib/core/secrets-env-content.js +54 -48
- package/lib/core/secrets-env-write.js +10 -1
- package/lib/core/secrets-infra-placeholder-sync.js +2 -0
- package/lib/core/setup-installation-profile.js +43 -0
- package/lib/core/setup-platform-mode.js +90 -0
- package/lib/datasource/agent-trust-debug-log.js +1 -1
- package/lib/datasource/agent-trust-run.js +5 -3
- package/lib/datasource/audit-evidence-extract-debug.js +30 -18
- package/lib/datasource/audit-evidence-extract.js +7 -4
- package/lib/datasource/audit-evidence-verify-matrix.js +54 -26
- package/lib/datasource/bulk-loader-run-batches.js +15 -3
- package/lib/datasource/capability/capability-diff-slice.js +2 -2
- package/lib/datasource/capability/capability-manifest.js +254 -0
- package/lib/datasource/capability/capability-resolve.js +3 -4
- package/lib/datasource/capability/copy-operations.js +5 -3
- package/lib/datasource/capability/remove-operations.js +2 -1
- package/lib/datasource/capability/run-capability-copy.js +32 -4
- package/lib/datasource/capability/run-capability-diff.js +3 -3
- package/lib/datasource/capability/run-capability-dimension.js +2 -4
- package/lib/datasource/capability/run-capability-edit.js +4 -7
- package/lib/datasource/capability/run-capability-relate.js +2 -4
- package/lib/datasource/capability/run-capability-remove.js +2 -4
- package/lib/datasource/capability/validate-capability-slice.js +2 -1
- package/lib/datasource/datasource-identifier.js +2 -1
- package/lib/datasource/datasource-load-export-context.js +3 -0
- package/lib/datasource/datasource-validate-display.js +1 -1
- package/lib/datasource/field-reference-validator.js +24 -3
- package/lib/datasource/log-cleaner.js +2 -2
- package/lib/datasource/log-viewer.js +8 -8
- package/lib/datasource/orphan-profiles-validator.js +98 -0
- package/lib/datasource/test-e2e.js +4 -1
- package/lib/datasource/unified-validation-run-body.js +3 -1
- package/lib/datasource/unified-validation-run.js +5 -2
- package/lib/datasource/validate.js +41 -23
- package/lib/deployment/environment-poll-status.js +138 -0
- package/lib/deployment/environment.js +42 -34
- package/lib/external-system/download-helpers.js +87 -0
- package/lib/external-system/download.js +78 -138
- package/lib/external-system/generator.js +1 -55
- package/lib/external-system/integration-auth-context.js +45 -0
- package/lib/external-system/test-auth.js +12 -5
- package/lib/external-system/test.js +16 -21
- package/lib/generator/builders.js +11 -1
- package/lib/generator/external-controller-manifest.js +18 -0
- package/lib/generator/split.js +3 -1
- package/lib/generator/wizard.js +1 -28
- package/lib/governance/governance-cli-errors.js +96 -0
- package/lib/governance/governance-download-display.js +38 -0
- package/lib/governance/governance-run-display.js +215 -25
- package/lib/identity/fk-reference.js +65 -0
- package/lib/identity/identity-apply-core.js +13 -58
- package/lib/identity/identity-apply-phases.js +5 -1
- package/lib/identity/identity-display.js +243 -0
- package/lib/identity/identity-response-helpers.js +52 -0
- package/lib/identity/identity-sync-errors.js +62 -0
- package/lib/identity/resolve-user-id.js +129 -0
- package/lib/identity/username-default.js +31 -0
- package/lib/infrastructure/admin-secrets-apply.js +84 -0
- package/lib/infrastructure/admin-secrets-ensure.js +130 -0
- package/lib/infrastructure/admin-secrets-resolve.js +95 -0
- package/lib/infrastructure/admin-secrets-sync.js +91 -0
- package/lib/infrastructure/helpers.js +23 -129
- package/lib/infrastructure/index.js +5 -6
- package/lib/infrastructure/orphan-infra-docker-teardown.js +11 -5
- package/lib/lifecycle/certification-progress.js +231 -0
- package/lib/lifecycle/dataplane-ui-url.js +145 -0
- package/lib/lifecycle/exit-codes.js +24 -0
- package/lib/lifecycle/json-envelope.js +25 -0
- package/lib/lifecycle/lifecycle-governance-options.js +51 -0
- package/lib/lifecycle/logger-quiet.js +29 -0
- package/lib/lifecycle/open-api-published.js +59 -0
- package/lib/lifecycle/operations-readiness-metrics.js +101 -0
- package/lib/lifecycle/product-model.js +196 -0
- package/lib/lifecycle/report-display-trust.js +70 -0
- package/lib/lifecycle/report-display.js +472 -0
- package/lib/lifecycle/scenario-upload.js +191 -0
- package/lib/lifecycle/verify-step-progress.js +87 -0
- package/lib/parameters/infra-kv-discovery.js +27 -2
- package/lib/protection/auth-context.js +10 -4
- package/lib/resolvers/datasource-resolver.js +2 -3
- package/lib/resolvers/resource-type-file.js +159 -0
- package/lib/schema/application-schema.json +17 -1
- package/lib/schema/datasource-test-run.schema.json +89 -6
- package/lib/schema/deployment-rules.yaml +2 -1
- package/lib/schema/external-datasource.schema.json +2947 -2619
- package/lib/schema/external-system.schema.json +1418 -761
- package/lib/schema/infra.parameter.yaml +45 -0
- package/lib/schema/type/credential-field-registry.json +103 -97
- package/lib/schema/type/document-storage.json +9 -5
- package/lib/utils/aifabrix-test-runtime-guard.js +125 -0
- package/lib/utils/api.js +55 -31
- package/lib/utils/app-relative-path-env.js +112 -0
- package/lib/utils/app-run-containers.js +25 -2
- package/lib/utils/authentication-shape.js +224 -0
- package/lib/utils/build-copy.js +36 -5
- package/lib/utils/build-resolve-image.js +66 -12
- package/lib/utils/celery-companion-apps.js +53 -0
- package/lib/utils/cli-secrets-error-format.js +83 -21
- package/lib/utils/cli-utils.js +20 -4
- package/lib/utils/compose-celery-worker.js +23 -0
- package/lib/utils/compose-generate-docker-compose.js +13 -1
- package/lib/utils/compose-traefik-ingress-base.js +16 -1
- package/lib/utils/config-secrets-path.js +46 -0
- package/lib/utils/configuration-env-resolver.js +36 -0
- package/lib/utils/controller-url.js +88 -1
- package/lib/utils/credential-secrets-env-kv.js +216 -0
- package/lib/utils/credential-secrets-env.js +175 -257
- package/lib/utils/dataplane-resolver.js +18 -2
- package/lib/utils/declarative-url-ports.js +27 -4
- package/lib/utils/deployment-auth-mode.js +41 -0
- package/lib/utils/developer-volume-id.js +33 -0
- package/lib/utils/docker-build.js +1 -4
- package/lib/utils/env-copy.js +14 -9
- package/lib/utils/env-kv-orphan-lines.js +43 -0
- package/lib/utils/error-formatters/network-errors.js +13 -4
- package/lib/utils/external-env-template.js +11 -3
- package/lib/utils/external-system-readiness-core.js +10 -0
- package/lib/utils/external-system-readiness-display.js +80 -23
- package/lib/utils/external-system-validators.js +8 -2
- package/lib/utils/health-check.js +4 -1
- package/lib/utils/help-builder.js +13 -8
- package/lib/utils/keycloak-realm-ready.js +101 -0
- package/lib/utils/load-cip-capacity-display-config.js +61 -15
- package/lib/utils/manifest-source-emit.js +2 -0
- package/lib/utils/paths.js +25 -0
- package/lib/utils/pipeline-upload-auth-retry.js +82 -0
- package/lib/utils/platform-controller-url.js +157 -0
- package/lib/utils/platform-kv-ref.js +57 -0
- package/lib/utils/postgres-platform-bootstrap.js +199 -0
- package/lib/utils/postgres-wipe.js +9 -2
- package/lib/utils/resolve-env-mode.js +47 -0
- package/lib/utils/runtime-configuration-download.js +189 -0
- package/lib/utils/runtime-configuration-values.js +119 -0
- package/lib/utils/schema-loader.js +19 -4
- package/lib/utils/secrets-generator.js +31 -25
- package/lib/utils/secrets-missing-error.js +164 -0
- package/lib/utils/service-url-label.js +81 -0
- package/lib/utils/setup-quiet-output.js +25 -0
- package/lib/utils/template-helpers.js +15 -0
- package/lib/utils/token-manager-client-credentials.js +201 -0
- package/lib/utils/token-manager-messages.js +8 -0
- package/lib/utils/token-manager-refresh.js +12 -2
- package/lib/utils/token-manager.js +86 -105
- package/lib/utils/upload-pipeline-ui.js +12 -5
- package/lib/utils/upload-sync-options.js +42 -0
- package/lib/utils/url-declarative-public-base.js +21 -3
- package/lib/utils/url-declarative-vdir-inactive-env.js +14 -4
- package/lib/utils/validation-poll-ui.js +8 -0
- package/lib/utils/validation-run-stage.js +45 -0
- package/lib/utils/worker-sidecars.js +142 -0
- package/lib/validation/external-manifest-validator.js +2 -0
- package/lib/validation/runtime-configuration-rules.js +98 -0
- package/lib/validation/validate-display-dimensions.js +154 -0
- package/lib/validation/validate-display-sections.js +276 -0
- package/lib/validation/validate-display-steps.js +67 -0
- package/lib/validation/validate-display.js +24 -402
- package/package.json +1 -1
- package/templates/applications/dataplane/application.yaml +7 -1
- package/templates/applications/dataplane/env.template +50 -14
- package/templates/applications/dataplane/rbac.yaml +108 -1
- package/templates/applications/miso-controller/application.yaml +2 -2
- package/templates/applications/miso-controller/env.template +53 -122
- package/templates/applications/miso-controller/rbac.yaml +28 -13
- package/templates/channels/chatgpt/install.template.md.hbs +49 -0
- package/templates/channels/chatgpt/manifest.template.json.hbs +9 -0
- package/templates/channels/microsoft-copilot/install.template.md.hbs +49 -0
- package/templates/channels/microsoft-copilot/manifest.template.json.hbs +8 -0
- package/templates/channels/slack/install.template.md.hbs +49 -0
- package/templates/channels/slack/manifest.template.json.hbs +66 -0
- package/templates/channels/teams-bot/install.template.md.hbs +49 -0
- package/templates/channels/teams-bot/manifest.template.json.hbs +13 -0
- package/templates/channels/web-embed/install.template.md.hbs +49 -0
- package/templates/channels/web-embed/manifest.template.json.hbs +8 -0
- package/templates/external-system/README.md.hbs +74 -17
- package/templates/python/docker-compose.hbs +75 -18
- package/templates/typescript/docker-compose.hbs +70 -17
- package/lib/commands/test-governance-command-action.js +0 -55
- package/lib/commands/test-trust-command-action.js +0 -118
package/lib/commands/setup.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Top-level handler for `aifabrix setup`.
|
|
3
3
|
*
|
|
4
4
|
* Decides between:
|
|
5
|
-
* - fresh install (no infra running) — wizard for admin creds + AI tool, then up-infra + up-platform.
|
|
6
|
-
* - mode menu (infra already running) — dispatch one of
|
|
5
|
+
* - fresh install (no infra running) — wipe volumes, wizard for admin creds + AI tool, then up-infra + up-platform.
|
|
6
|
+
* - mode menu (infra already running) — dispatch one of three destructive/refresh paths.
|
|
7
7
|
*
|
|
8
8
|
* The mode handlers live in `setup-modes.js`; the prompts live in
|
|
9
9
|
* `setup-prompts.js`. This module is a thin orchestrator so it stays well
|
|
@@ -28,8 +28,12 @@ const {
|
|
|
28
28
|
} = require('../utils/cli-test-layout-chalk');
|
|
29
29
|
|
|
30
30
|
const setupPrompts = require('./setup-prompts');
|
|
31
|
+
const setupPlatformModePrompts = require('./setup-prompts-platform-mode');
|
|
32
|
+
const { flagsForSetupPlatformMode } = require('../core/setup-platform-mode');
|
|
31
33
|
const setupModes = require('./setup-modes');
|
|
34
|
+
const { syncPlatformControllerUrlsInConfig } = require('./setup-platform-auth');
|
|
32
35
|
const installationLog = require('../utils/installation-log');
|
|
36
|
+
const { beginSetupCommandFlow, endSetupCommandFlow } = require('./setup-run-context');
|
|
33
37
|
|
|
34
38
|
const MODE = setupPrompts.MODE;
|
|
35
39
|
|
|
@@ -54,10 +58,24 @@ async function maybePinDeveloperIdForFreshInstall(rawDeveloper) {
|
|
|
54
58
|
logger.log(infoLine(`Developer ID pinned to ${dev}.`));
|
|
55
59
|
}
|
|
56
60
|
|
|
61
|
+
async function applySetupPlatformMode(options) {
|
|
62
|
+
const mode = await setupPlatformModePrompts.promptSetupPlatformMode(options);
|
|
63
|
+
await config.setSetupPlatformMode(mode);
|
|
64
|
+
const derived = flagsForSetupPlatformMode(mode);
|
|
65
|
+
// These are the user gates that control full-mode behavior.
|
|
66
|
+
const cfg = await config.getConfig();
|
|
67
|
+
cfg.traefik = derived.traefik;
|
|
68
|
+
cfg.useEnvironmentScopedResources = derived.useEnvironmentScopedResources;
|
|
69
|
+
await config.saveConfig(cfg);
|
|
70
|
+
await syncPlatformControllerUrlsInConfig();
|
|
71
|
+
return mode;
|
|
72
|
+
}
|
|
73
|
+
|
|
57
74
|
async function runFreshInstallFlow(options) {
|
|
58
75
|
await maybePinDeveloperIdForFreshInstall(options.developer);
|
|
59
76
|
logger.log(infoLine('No infrastructure detected; starting fresh install.'));
|
|
60
|
-
|
|
77
|
+
await applySetupPlatformMode(options);
|
|
78
|
+
const adminCreds = await setupPrompts.promptAdminCredentials(options);
|
|
61
79
|
await config.setAdminEmail(adminCreds.adminEmail);
|
|
62
80
|
await setupModes.runFreshInstall(adminCreds);
|
|
63
81
|
logger.log(formatSuccessParagraph('aifabrix setup complete (fresh install).'));
|
|
@@ -74,6 +92,10 @@ async function runExistingInfraFlow(assumeYes) {
|
|
|
74
92
|
logger.log(chalk.yellow('Aborted by user.'));
|
|
75
93
|
return { aborted: true, mode };
|
|
76
94
|
}
|
|
95
|
+
// Re-install / wipe-data can change platform topology; re-prompt so the next up-platform matches intent.
|
|
96
|
+
if (mode === MODE.REINSTALL || mode === MODE.WIPE_DATA) {
|
|
97
|
+
await applySetupPlatformMode({});
|
|
98
|
+
}
|
|
77
99
|
await dispatchMode(mode);
|
|
78
100
|
logger.log(formatSuccessParagraph(`aifabrix setup complete (mode: ${mode}).`));
|
|
79
101
|
return { aborted: false, mode };
|
|
@@ -114,8 +136,6 @@ async function dispatchMode(mode) {
|
|
|
114
136
|
return setupModes.runReinstall();
|
|
115
137
|
case MODE.WIPE_DATA:
|
|
116
138
|
return setupModes.runWipeData();
|
|
117
|
-
case MODE.CLEAN_FILES:
|
|
118
|
-
return setupModes.runCleanInstallFiles();
|
|
119
139
|
case MODE.UPDATE_IMAGES:
|
|
120
140
|
return setupModes.runUpdateImages();
|
|
121
141
|
default:
|
|
@@ -224,6 +244,7 @@ async function handleSetup(options = {}) {
|
|
|
224
244
|
let setupMode = null;
|
|
225
245
|
let err = null;
|
|
226
246
|
|
|
247
|
+
beginSetupCommandFlow();
|
|
227
248
|
try {
|
|
228
249
|
const main = await runSetupMainPath(options, assumeYes);
|
|
229
250
|
outcome = main.outcome;
|
|
@@ -232,6 +253,7 @@ async function handleSetup(options = {}) {
|
|
|
232
253
|
outcome = 'failure';
|
|
233
254
|
err = e;
|
|
234
255
|
} finally {
|
|
256
|
+
endSetupCommandFlow();
|
|
235
257
|
await appendSetupInstallationRecord({
|
|
236
258
|
outcome,
|
|
237
259
|
startedAt,
|
package/lib/commands/teardown.js
CHANGED
|
@@ -118,6 +118,37 @@ function cleanAifabrixSystemDir() {
|
|
|
118
118
|
return { removed, failed };
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Remove materialized `builder/` trees (aifabrix-work, aifabrix-home / config dir, cwd).
|
|
123
|
+
* Complements {@link cleanAifabrixSystemDir} when `builder/` lives under `aifabrix-work` outside
|
|
124
|
+
* the config directory.
|
|
125
|
+
*
|
|
126
|
+
* @returns {{ removed: string[], failed: string[] }}
|
|
127
|
+
*/
|
|
128
|
+
function cleanMaterializedBuilderTrees() {
|
|
129
|
+
const candidates = [
|
|
130
|
+
pathsUtil.getBuilderRoot(),
|
|
131
|
+
path.join(pathsUtil.getAifabrixSystemDir(), 'builder'),
|
|
132
|
+
path.join(process.cwd(), 'builder')
|
|
133
|
+
];
|
|
134
|
+
const seen = new Set();
|
|
135
|
+
const removed = [];
|
|
136
|
+
const failed = [];
|
|
137
|
+
for (const candidate of candidates) {
|
|
138
|
+
const resolved = path.resolve(candidate);
|
|
139
|
+
if (seen.has(resolved)) continue;
|
|
140
|
+
seen.add(resolved);
|
|
141
|
+
if (!fs.existsSync(resolved)) continue;
|
|
142
|
+
try {
|
|
143
|
+
fs.rmSync(resolved, { recursive: true, force: true });
|
|
144
|
+
removed.push(resolved);
|
|
145
|
+
} catch {
|
|
146
|
+
failed.push(resolved);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return { removed, failed };
|
|
150
|
+
}
|
|
151
|
+
|
|
121
152
|
/**
|
|
122
153
|
* Stop infra with `down-infra -v` semantics. Tolerates already-down state.
|
|
123
154
|
* @async
|
|
@@ -259,6 +290,13 @@ async function handleTeardown(options = {}) {
|
|
|
259
290
|
try {
|
|
260
291
|
await stopInfraQuietly();
|
|
261
292
|
const { removed, failed } = cleanFilesWithSpinner();
|
|
293
|
+
const builderClean = cleanMaterializedBuilderTrees();
|
|
294
|
+
for (const p of builderClean.removed) {
|
|
295
|
+
removed.push(p);
|
|
296
|
+
}
|
|
297
|
+
for (const p of builderClean.failed) {
|
|
298
|
+
failed.push(p);
|
|
299
|
+
}
|
|
262
300
|
const devStr = await buildDeveloperLabel();
|
|
263
301
|
logTeardownFooter({ devStr, removedCount: removed.length, failedCount: failed.length });
|
|
264
302
|
|
|
@@ -271,6 +309,7 @@ async function handleTeardown(options = {}) {
|
|
|
271
309
|
module.exports = {
|
|
272
310
|
handleTeardown,
|
|
273
311
|
cleanAifabrixSystemDir,
|
|
312
|
+
cleanMaterializedBuilderTrees,
|
|
274
313
|
stopInfraQuietly,
|
|
275
314
|
PRESERVE_FILE,
|
|
276
315
|
PRESERVE_CERTS_DIR
|
|
@@ -19,6 +19,7 @@ const { loadConfigFile } = require('../utils/config-format');
|
|
|
19
19
|
const { discoverIntegrationFiles, buildEffectiveDatasourceFiles } = require('./repair-internal');
|
|
20
20
|
const { runDatasourceTestE2E } = require('../datasource/test-e2e');
|
|
21
21
|
const { cliOptsSkipSync } = require('../utils/cli-sync-options');
|
|
22
|
+
const { buildMinimalUploadSyncOptions, isQuietMinimalSync } = require('../utils/upload-sync-options');
|
|
22
23
|
const { getConfig } = require('../core/config');
|
|
23
24
|
const { setupIntegrationTestAuth } = require('../external-system/test-auth');
|
|
24
25
|
|
|
@@ -96,13 +97,12 @@ function getDatasourceKeys(appPath, configPath, variables, systemKey, systemPars
|
|
|
96
97
|
*/
|
|
97
98
|
async function syncLocalIfRequested(systemKey, options) {
|
|
98
99
|
if (cliOptsSkipSync(options)) return null;
|
|
99
|
-
logger.log(chalk.cyan('Syncing local config to dataplane…'));
|
|
100
100
|
const { uploadExternalSystem } = require('./upload');
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
const uploadOpts = buildMinimalUploadSyncOptions(options);
|
|
102
|
+
const uploadCtx = await uploadExternalSystem(systemKey, uploadOpts);
|
|
103
|
+
if (uploadCtx?.uploadSkipped !== true && !isQuietMinimalSync(uploadOpts)) {
|
|
104
|
+
logger.log(formatSuccessLine('Sync complete'));
|
|
105
|
+
}
|
|
106
106
|
return uploadCtx && uploadCtx.dataplaneUrl && uploadCtx.authConfig ? uploadCtx : null;
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -176,11 +176,18 @@ async function runTestE2EForExternalSystem(externalSystem, options = {}) {
|
|
|
176
176
|
let dataplaneUrl;
|
|
177
177
|
if (uploadCtx) {
|
|
178
178
|
({ authConfig, dataplaneUrl } = uploadCtx);
|
|
179
|
+
} else if (options.authConfig && options.dataplaneUrl) {
|
|
180
|
+
({ authConfig, dataplaneUrl } = options);
|
|
179
181
|
} else {
|
|
180
182
|
const configObj = await getConfig();
|
|
181
183
|
({ authConfig, dataplaneUrl } = await setupIntegrationTestAuth(
|
|
182
184
|
externalSystem,
|
|
183
|
-
{
|
|
185
|
+
{
|
|
186
|
+
environment: options.env,
|
|
187
|
+
authConfig: options.authConfig,
|
|
188
|
+
dataplaneUrl: options.dataplaneUrl,
|
|
189
|
+
silentResolve: options.silentResolve === true
|
|
190
|
+
},
|
|
184
191
|
configObj
|
|
185
192
|
));
|
|
186
193
|
}
|
|
@@ -193,9 +200,18 @@ async function runTestE2EForExternalSystem(externalSystem, options = {}) {
|
|
|
193
200
|
verbose: options.verbose,
|
|
194
201
|
async: options.async !== false,
|
|
195
202
|
authConfig,
|
|
196
|
-
dataplaneUrl
|
|
203
|
+
dataplaneUrl,
|
|
204
|
+
quietPollUi: options.quietPollUi === true,
|
|
205
|
+
onPollProgress: options.onPollProgress
|
|
197
206
|
};
|
|
198
207
|
for (const key of keys) {
|
|
208
|
+
if (typeof options.onDatasourceProgress === 'function') {
|
|
209
|
+
options.onDatasourceProgress({
|
|
210
|
+
key,
|
|
211
|
+
index: results.length,
|
|
212
|
+
total: keys.length
|
|
213
|
+
});
|
|
214
|
+
}
|
|
199
215
|
try {
|
|
200
216
|
const data = await runDatasourceTestE2E(key, opts);
|
|
201
217
|
const steps = data.steps || data.completedActions || [];
|
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
const chalk = require('chalk');
|
|
10
|
-
const logger = require('../utils/logger');
|
|
11
|
-
const { cliOptsSkipSync } = require('../utils/cli-sync-options');
|
|
12
9
|
const { getConfig } = require('../core/config');
|
|
13
10
|
const { setupIntegrationTestAuth } = require('../external-system/test-auth');
|
|
14
11
|
const { runGovernanceScenarios } = require('../api/governance-scenarios.api');
|
|
@@ -16,25 +13,7 @@ const {
|
|
|
16
13
|
resolveGovernancePackPath,
|
|
17
14
|
loadGovernancePackYaml
|
|
18
15
|
} = require('../governance/governance-pack-loader');
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @param {string} systemKey
|
|
22
|
-
* @param {Object} options
|
|
23
|
-
* @returns {Promise<{ authConfig: Object, dataplaneUrl: string }|null>}
|
|
24
|
-
*/
|
|
25
|
-
async function syncLocalIfRequested(systemKey, options) {
|
|
26
|
-
if (cliOptsSkipSync(options)) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const { uploadExternalSystem } = require('./upload');
|
|
30
|
-
logger.log(chalk.cyan('Syncing local config to dataplane…'));
|
|
31
|
-
const uploadCtx = await uploadExternalSystem(systemKey, {
|
|
32
|
-
minimal: true,
|
|
33
|
-
verbose: !!options.verbose
|
|
34
|
-
});
|
|
35
|
-
logger.log(chalk.green('✔ Sync complete'));
|
|
36
|
-
return uploadCtx && uploadCtx.dataplaneUrl && uploadCtx.authConfig ? uploadCtx : null;
|
|
37
|
-
}
|
|
16
|
+
const { syncLocalIfRequested } = require('./test-e2e-external');
|
|
38
17
|
|
|
39
18
|
/**
|
|
40
19
|
* @async
|
|
@@ -47,7 +26,7 @@ async function runTestGovernanceForExternalSystem(externalSystem, options = {})
|
|
|
47
26
|
const appType = await pathsUtil.detectAppType(externalSystem).catch(() => null);
|
|
48
27
|
if (!appType || appType.baseDir !== 'integration') {
|
|
49
28
|
throw new Error(
|
|
50
|
-
'
|
|
29
|
+
'verify-governance applies to external integration folders only (integration/<systemKey>/).'
|
|
51
30
|
);
|
|
52
31
|
}
|
|
53
32
|
|
|
@@ -79,7 +58,7 @@ async function runTestGovernanceForExternalSystem(externalSystem, options = {})
|
|
|
79
58
|
scenarios: options.scenarioIds
|
|
80
59
|
};
|
|
81
60
|
const result = await runGovernanceScenarios(dataplaneUrl, authConfig, body);
|
|
82
|
-
return { result, packPath, systemKey };
|
|
61
|
+
return { result, packPath, systemKey, packDocument: pack };
|
|
83
62
|
}
|
|
84
63
|
|
|
85
64
|
module.exports = {
|
|
@@ -1,125 +1,73 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview
|
|
2
|
+
* @fileoverview verify-trust <systemKey> — dual-confidence AI Trust via dataplane (433.0).
|
|
3
3
|
* @author AI Fabrix Team
|
|
4
|
-
* @version
|
|
4
|
+
* @version 2.0.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
const chalk = require('chalk');
|
|
10
10
|
const logger = require('../utils/logger');
|
|
11
|
-
const { cliOptsSkipSync } = require('../utils/cli-sync-options');
|
|
12
11
|
const { getConfig } = require('../core/config');
|
|
13
12
|
const { setupIntegrationTestAuth } = require('../external-system/test-auth');
|
|
14
|
-
const {
|
|
15
|
-
const {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* @param {Object} options
|
|
20
|
-
* @returns {Promise<{ authConfig: Object, dataplaneUrl: string }|null>}
|
|
21
|
-
*/
|
|
22
|
-
async function syncLocalIfRequested(systemKey, options) {
|
|
23
|
-
if (cliOptsSkipSync(options)) return null;
|
|
24
|
-
const { uploadExternalSystem } = require('./upload');
|
|
25
|
-
logger.log(chalk.cyan('Syncing local config to dataplane…'));
|
|
26
|
-
const uploadCtx = await uploadExternalSystem(systemKey, {
|
|
27
|
-
minimal: true,
|
|
28
|
-
verbose: !!options.verbose
|
|
29
|
-
});
|
|
30
|
-
logger.log(chalk.green('✔ Sync complete'));
|
|
31
|
-
return uploadCtx && uploadCtx.dataplaneUrl && uploadCtx.authConfig ? uploadCtx : null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function pushTrustResult(results, key, trustRun, apiError) {
|
|
35
|
-
const failed =
|
|
36
|
-
apiError ||
|
|
37
|
-
!trustRun ||
|
|
38
|
-
trustRun.trustDecision === 'notTrusted' ||
|
|
39
|
-
trustRun.validationStatus === 'failed';
|
|
40
|
-
results.push({
|
|
41
|
-
key,
|
|
42
|
-
success: !failed,
|
|
43
|
-
error: failed
|
|
44
|
-
? apiError
|
|
45
|
-
? apiError.message || String(apiError)
|
|
46
|
-
: trustRun.summary || 'Trust validation failed'
|
|
47
|
-
: undefined,
|
|
48
|
-
trustRun
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @async
|
|
54
|
-
* @param {Object|null} uploadCtx
|
|
55
|
-
* @param {string} externalSystem
|
|
56
|
-
* @param {Object} options
|
|
57
|
-
* @returns {Promise<{ authConfig: Object, dataplaneUrl: string }>}
|
|
58
|
-
*/
|
|
59
|
-
async function resolveTrustAuthContext(uploadCtx, externalSystem, options) {
|
|
60
|
-
if (uploadCtx) {
|
|
61
|
-
return { authConfig: uploadCtx.authConfig, dataplaneUrl: uploadCtx.dataplaneUrl };
|
|
62
|
-
}
|
|
63
|
-
const configObj = await getConfig();
|
|
64
|
-
return setupIntegrationTestAuth(externalSystem, { environment: options.env }, configObj);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @async
|
|
69
|
-
* @param {string[]} keys
|
|
70
|
-
* @param {Object} runOpts
|
|
71
|
-
* @param {Array<Object>} results
|
|
72
|
-
*/
|
|
73
|
-
async function runTrustForDatasourceKeys(keys, runOpts, results) {
|
|
74
|
-
for (const key of keys) {
|
|
75
|
-
try {
|
|
76
|
-
const { trustRun, apiError } = await runDatasourceAgentTrust(key, runOpts);
|
|
77
|
-
pushTrustResult(results, key, trustRun, apiError);
|
|
78
|
-
} catch (err) {
|
|
79
|
-
results.push({ key, success: false, error: err.message, trustRun: null });
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
13
|
+
const { runSystemVerifyTrust } = require('../api/lifecycle.api');
|
|
14
|
+
const {
|
|
15
|
+
resolveExternalIntegrationContext,
|
|
16
|
+
syncLocalIfRequested
|
|
17
|
+
} = require('./test-e2e-external');
|
|
83
18
|
|
|
84
19
|
/**
|
|
85
20
|
* @async
|
|
86
21
|
* @param {string} externalSystem
|
|
87
22
|
* @param {Object} options
|
|
88
|
-
* @returns {Promise<{ success: boolean, results: Array<Object>, systemKey: string }>}
|
|
23
|
+
* @returns {Promise<{ success: boolean, results: Array<Object>, systemKey: string, trustReport?: Object }>}
|
|
89
24
|
*/
|
|
90
25
|
async function runTestTrustForExternalSystem(externalSystem, options = {}) {
|
|
91
|
-
const { systemKey
|
|
92
|
-
if (keys.length === 0) {
|
|
93
|
-
logger.log(chalk.yellow(`No datasources found for ${externalSystem}.`));
|
|
94
|
-
return { success: true, results: [], systemKey };
|
|
95
|
-
}
|
|
26
|
+
const { systemKey } = resolveExternalIntegrationContext(externalSystem);
|
|
96
27
|
|
|
97
28
|
const uploadCtx = await syncLocalIfRequested(systemKey, options);
|
|
29
|
+
if (uploadCtx?.authConfig && uploadCtx?.dataplaneUrl) {
|
|
30
|
+
options.authConfig = uploadCtx.authConfig;
|
|
31
|
+
options.dataplaneUrl = uploadCtx.dataplaneUrl;
|
|
32
|
+
options.silentResolve = true;
|
|
33
|
+
}
|
|
98
34
|
if (options.revalidate === true) {
|
|
99
|
-
logger.log(chalk.cyan('Forcing revalidation (cache bypass)
|
|
35
|
+
logger.log(chalk.cyan('Forcing revalidation (cache bypass)…'));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let authConfig = options.authConfig;
|
|
39
|
+
let dataplaneUrl = options.dataplaneUrl;
|
|
40
|
+
if (!authConfig || !dataplaneUrl) {
|
|
41
|
+
const configObj = await getConfig();
|
|
42
|
+
const auth = await setupIntegrationTestAuth(
|
|
43
|
+
externalSystem,
|
|
44
|
+
{
|
|
45
|
+
environment: options.env,
|
|
46
|
+
authConfig: options.authConfig,
|
|
47
|
+
dataplaneUrl: options.dataplaneUrl,
|
|
48
|
+
silentResolve: options.silentResolve === true
|
|
49
|
+
},
|
|
50
|
+
configObj
|
|
51
|
+
);
|
|
52
|
+
authConfig = auth.authConfig;
|
|
53
|
+
dataplaneUrl = auth.dataplaneUrl;
|
|
100
54
|
}
|
|
101
55
|
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
authConfig,
|
|
118
|
-
dataplaneUrl
|
|
119
|
-
},
|
|
120
|
-
results
|
|
121
|
-
);
|
|
122
|
-
return { success: results.every(r => r.success), results, systemKey };
|
|
56
|
+
const trustReport = await runSystemVerifyTrust(dataplaneUrl, authConfig, systemKey, {
|
|
57
|
+
forceRevalidate: options.revalidate === true
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const results = (trustReport.datasourceRows || []).map(row => ({
|
|
61
|
+
key: row.datasourceKey,
|
|
62
|
+
success: trustReport.verdict === 'VERIFIED' || trustReport.verdict !== 'FAILED',
|
|
63
|
+
trustRun: {
|
|
64
|
+
trustDecision: row.trustDecision,
|
|
65
|
+
validationStatus: row.validationStatus
|
|
66
|
+
}
|
|
67
|
+
}));
|
|
68
|
+
|
|
69
|
+
const success = trustReport.verdict === 'VERIFIED';
|
|
70
|
+
return { success, results, systemKey, trustReport };
|
|
123
71
|
}
|
|
124
72
|
|
|
125
73
|
module.exports = {
|
|
@@ -14,7 +14,7 @@ const fs = require('fs');
|
|
|
14
14
|
const chalk = require('chalk');
|
|
15
15
|
const logger = require('../utils/logger');
|
|
16
16
|
const config = require('../core/config');
|
|
17
|
-
const {
|
|
17
|
+
const { resolvePlatformControllerUrl } = require('../utils/platform-controller-url');
|
|
18
18
|
const pathsUtil = require('../utils/paths');
|
|
19
19
|
const { loadConfigFile, writeConfigFile } = require('../utils/config-format');
|
|
20
20
|
const { isYamlPath } = require('../utils/config-format');
|
|
@@ -189,19 +189,29 @@ function patchEnvOutputPathForDeployOnly(appName) {
|
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
191
|
* For ``up-platform --force`` only: clear all stored auth tokens, set ``environment`` to ``dev``,
|
|
192
|
-
* set ``controller`` to the default URL
|
|
193
|
-
*
|
|
192
|
+
* set ``controller`` and ``platform-controller`` to the default URL (or ``defaultControllerUrl`` when
|
|
193
|
+
* provided), and persist config. Does not change ``developer-id``. Pass ``clearTokens: false`` to
|
|
194
|
+
* keep device/client tokens (setup when already logged in to the platform controller).
|
|
194
195
|
* Builder dirs (keycloak, miso-controller, dataplane) are cleaned separately.
|
|
195
196
|
*
|
|
196
197
|
* @returns {Promise<void>}
|
|
197
198
|
*/
|
|
198
199
|
async function applyUpPlatformForceConfig(opts = {}) {
|
|
199
200
|
const silent = Boolean(opts.silent);
|
|
200
|
-
const
|
|
201
|
-
|
|
201
|
+
const clearTokens = opts.clearTokens !== false;
|
|
202
|
+
let deviceCleared = 0;
|
|
203
|
+
let clientCleared = 0;
|
|
204
|
+
if (clearTokens) {
|
|
205
|
+
deviceCleared = await config.clearAllDeviceTokens();
|
|
206
|
+
clientCleared = await config.clearAllClientTokens();
|
|
207
|
+
}
|
|
202
208
|
await config.setCurrentEnvironment('dev');
|
|
203
|
-
const defaultControllerUrl =
|
|
209
|
+
const defaultControllerUrl =
|
|
210
|
+
opts.defaultControllerUrl && typeof opts.defaultControllerUrl === 'string'
|
|
211
|
+
? String(opts.defaultControllerUrl).replace(/\/+$/, '')
|
|
212
|
+
: await resolvePlatformControllerUrl();
|
|
204
213
|
await config.setControllerUrl(defaultControllerUrl);
|
|
214
|
+
await config.setPlatformControllerUrl(defaultControllerUrl);
|
|
205
215
|
|
|
206
216
|
const summary = { deviceCleared, clientCleared, defaultControllerUrl, environment: 'dev' };
|
|
207
217
|
if (!silent) {
|
|
@@ -287,14 +297,15 @@ async function cleanBuilderAppDirs(appNames, opts = {}) {
|
|
|
287
297
|
* @example
|
|
288
298
|
* await ensureAppFromTemplate('keycloak');
|
|
289
299
|
*/
|
|
290
|
-
async function ensureAppFromTemplate(appName) {
|
|
300
|
+
async function ensureAppFromTemplate(appName, opts = {}) {
|
|
291
301
|
if (!appName || typeof appName !== 'string') {
|
|
292
302
|
throw new Error('Application name is required and must be a string');
|
|
293
303
|
}
|
|
304
|
+
const silent = Boolean(opts.silent);
|
|
294
305
|
|
|
295
306
|
const appPath = pathsUtil.getBuilderPath(appName);
|
|
296
307
|
const primaryCopied = await ensureTemplateAtPath(appName, appPath);
|
|
297
|
-
if (primaryCopied) {
|
|
308
|
+
if (primaryCopied && !silent) {
|
|
298
309
|
logger.log(chalk.blue(`Creating builder/${appName} from template...`));
|
|
299
310
|
logger.log(formatSuccessLine(`Copied template for ${appName}`));
|
|
300
311
|
}
|
|
@@ -307,7 +318,7 @@ async function ensureAppFromTemplate(appName) {
|
|
|
307
318
|
!pathsUtil.isSystemBuilderAppName(appName)
|
|
308
319
|
) {
|
|
309
320
|
const cwdCopied = await ensureTemplateAtPath(appName, cwdBuilderPath);
|
|
310
|
-
if (cwdCopied) {
|
|
321
|
+
if (cwdCopied && !silent) {
|
|
311
322
|
logger.log(chalk.blue(`Creating builder/${appName} in project (from template)...`));
|
|
312
323
|
logger.log(formatSuccessLine(`Copied template for ${appName} into builder/`));
|
|
313
324
|
}
|
|
@@ -317,6 +328,35 @@ async function ensureAppFromTemplate(appName) {
|
|
|
317
328
|
return primaryCopied;
|
|
318
329
|
}
|
|
319
330
|
|
|
331
|
+
/** Dataplane app key materialized for dataplane install (worker/beat are compose sidecars). */
|
|
332
|
+
const DATAPLANE_BUILDER_APP_KEYS = Object.freeze(['dataplane']);
|
|
333
|
+
|
|
334
|
+
/** Builder dirs removed on up-platform / setup force (includes Celery companions). */
|
|
335
|
+
const PLATFORM_BUILDER_CLEAN_APP_KEYS = Object.freeze([
|
|
336
|
+
'keycloak',
|
|
337
|
+
'miso-controller',
|
|
338
|
+
...DATAPLANE_BUILDER_APP_KEYS
|
|
339
|
+
]);
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Ensure dataplane application manifest exists under the builder root.
|
|
343
|
+
* Worker/beat sidecars are resolved from parent application.yaml at run/compose time.
|
|
344
|
+
*
|
|
345
|
+
* @param {object} [opts]
|
|
346
|
+
* @param {boolean} [opts.silent]
|
|
347
|
+
* @returns {Promise<boolean>} True if any app template was copied
|
|
348
|
+
*/
|
|
349
|
+
async function ensureDataplaneAppsFromTemplate(opts = {}) {
|
|
350
|
+
let anyCopied = false;
|
|
351
|
+
for (const appName of DATAPLANE_BUILDER_APP_KEYS) {
|
|
352
|
+
const copied = await ensureAppFromTemplate(appName, opts);
|
|
353
|
+
if (copied) {
|
|
354
|
+
anyCopied = true;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return anyCopied;
|
|
358
|
+
}
|
|
359
|
+
|
|
320
360
|
/**
|
|
321
361
|
* Merge builder/packages `application.yaml` into `~/.aifabrix/urls.local.yaml`.
|
|
322
362
|
* Same scan as the end of {@link prepareUrlsLocalRegistryForUpPlatform}; call after platform app
|
|
@@ -339,17 +379,21 @@ function refreshUrlsLocalRegistryForCurrentProject() {
|
|
|
339
379
|
*
|
|
340
380
|
* @returns {Promise<void>}
|
|
341
381
|
*/
|
|
342
|
-
async function prepareUrlsLocalRegistryForUpPlatform() {
|
|
343
|
-
|
|
344
|
-
await ensureAppFromTemplate('
|
|
345
|
-
await ensureAppFromTemplate('
|
|
382
|
+
async function prepareUrlsLocalRegistryForUpPlatform(opts = {}) {
|
|
383
|
+
const templateOpts = { silent: Boolean(opts.silent) };
|
|
384
|
+
await ensureAppFromTemplate('keycloak', templateOpts);
|
|
385
|
+
await ensureAppFromTemplate('miso-controller', templateOpts);
|
|
386
|
+
await ensureDataplaneAppsFromTemplate(templateOpts);
|
|
346
387
|
refreshUrlsLocalRegistryForCurrentProject();
|
|
347
388
|
}
|
|
348
389
|
|
|
349
390
|
module.exports = {
|
|
350
391
|
applyUpPlatformForceConfig,
|
|
351
392
|
cleanBuilderAppDirs,
|
|
393
|
+
DATAPLANE_BUILDER_APP_KEYS,
|
|
394
|
+
PLATFORM_BUILDER_CLEAN_APP_KEYS,
|
|
352
395
|
ensureAppFromTemplate,
|
|
396
|
+
ensureDataplaneAppsFromTemplate,
|
|
353
397
|
patchEnvOutputPathForDeployOnly,
|
|
354
398
|
validateEnvOutputPathFolderOrNull,
|
|
355
399
|
getEnvOutputPathFolder,
|