@aifabrix/builder 2.53.1 → 2.55.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/README.md +8 -0
- package/bin/aifabrix.js +2 -2
- package/lib/agent-kit/apply-ops.js +82 -0
- package/lib/agent-kit/checksums.js +28 -0
- package/lib/agent-kit/classify.js +113 -0
- package/lib/agent-kit/claude-shim.js +61 -0
- package/lib/agent-kit/constants.js +55 -0
- package/lib/agent-kit/file-list.js +103 -0
- package/lib/agent-kit/host-approve.js +130 -0
- package/lib/agent-kit/hosting/github.js +63 -0
- package/lib/agent-kit/hosts.js +71 -0
- package/lib/agent-kit/init.js +319 -0
- package/lib/agent-kit/kit-root.js +17 -0
- package/lib/agent-kit/managed-section.js +79 -0
- package/lib/agent-kit/package-load.js +45 -0
- package/lib/agent-kit/plan-ops.js +69 -0
- package/lib/agent-kit/remote-prompts.js +239 -0
- package/lib/agent-kit/render-host-markdown.js +40 -0
- package/lib/agent-kit/repo-guard.js +47 -0
- package/lib/agent-kit/report.js +107 -0
- package/lib/agent-kit/run.js +82 -0
- package/lib/agent-kit/scm/git.js +122 -0
- package/lib/agent-kit/state-file.js +83 -0
- package/lib/agent-kit/status.js +50 -0
- package/lib/agent-kit/v1-detect.js +81 -0
- package/lib/agent-kit/validate-kit.js +87 -0
- package/lib/agent-kit/workspace-name.js +40 -0
- package/lib/agent-kit/workspace-skeleton.js +103 -0
- package/lib/api/assistants.api.js +8 -5
- package/lib/api/channel-identity.api.js +41 -0
- package/lib/api/evidence-authoring.api.js +5 -1
- package/lib/api/evidence.api.js +2 -0
- package/lib/api/role-assistant-test-pack.api.js +86 -0
- package/lib/api/types/evidence.types.js +2 -0
- package/lib/api/work-search.api.js +163 -0
- package/lib/api/work.api.js +19 -12
- package/lib/app/list-external-systems.js +2 -1
- package/lib/app/show-display.js +33 -6
- package/lib/app/show.js +25 -2
- package/lib/channels/add-channel.js +164 -126
- package/lib/channels/approval-guides/chatgpt.js +14 -18
- package/lib/channels/approval-guides/claude.js +29 -0
- package/lib/channels/approval-guides/index.js +88 -22
- package/lib/channels/approval-guides/mcp-client.js +27 -0
- package/lib/channels/approval-guides/microsoft-copilot.js +52 -3
- package/lib/channels/approval-guides/slack.js +10 -10
- package/lib/channels/approval-guides/teams-bot.js +8 -12
- package/lib/channels/channel-add-continuations.js +91 -0
- package/lib/channels/channel-add-ensure.js +124 -27
- package/lib/channels/channel-add-existing.js +160 -28
- package/lib/channels/channel-add-failure.js +61 -0
- package/lib/channels/channel-add-remaining.js +492 -0
- package/lib/channels/channel-add-tty.js +190 -0
- package/lib/channels/channel-add-wizard-config.js +138 -0
- package/lib/channels/channel-add-wizard.js +250 -0
- package/lib/channels/channel-artifact-generator.js +27 -13
- package/lib/channels/channel-cardinality.js +83 -0
- package/lib/channels/channel-catalog-icon.js +45 -0
- package/lib/channels/channel-cli-instructions.js +75 -0
- package/lib/channels/channel-configuration-map.js +213 -0
- package/lib/channels/channel-credential.js +11 -14
- package/lib/channels/channel-definition-project.js +101 -0
- package/lib/channels/channel-definition-registry.js +154 -0
- package/lib/channels/channel-definition-status.js +115 -0
- package/lib/channels/channel-description.js +60 -2
- package/lib/channels/channel-discovery.js +16 -2
- package/lib/channels/channel-external-system.js +86 -9
- package/lib/channels/channel-install-envelope-actions.js +88 -0
- package/lib/channels/channel-install-envelope-microsoft.js +155 -0
- package/lib/channels/channel-install-envelope.js +358 -0
- package/lib/channels/channel-install-help-md.js +172 -0
- package/lib/channels/channel-install-http-payload.js +62 -0
- package/lib/channels/channel-install-inventory.js +115 -0
- package/lib/channels/channel-install-profiles.js +90 -0
- package/lib/channels/channel-instance-collision.js +118 -0
- package/lib/channels/channel-instance-key.js +100 -0
- package/lib/channels/channel-instance-materialize.js +240 -0
- package/lib/channels/channel-integration-generator.js +18 -9
- package/lib/channels/channel-integration-template.js +101 -22
- package/lib/channels/channel-inventory-fetch.js +79 -0
- package/lib/channels/channel-oauth-preflight.js +104 -0
- package/lib/channels/channel-package-version.js +76 -0
- package/lib/channels/channel-predefined-client.js +154 -0
- package/lib/channels/channel-probe.js +7 -2
- package/lib/channels/channel-runtime-resolver.js +194 -72
- package/lib/channels/channel-status-display.js +86 -16
- package/lib/channels/channel-targets.js +132 -92
- package/lib/channels/chatgpt-callback.js +318 -0
- package/lib/channels/chatgpt-channel-add.js +229 -0
- package/lib/channels/chatgpt-preflight.js +396 -0
- package/lib/channels/chatgpt-runtime-contract.js +17 -0
- package/lib/channels/chatgpt-setup-values.js +124 -0
- package/lib/channels/claude-callback.js +67 -0
- package/lib/channels/claude-channel-add.js +254 -0
- package/lib/channels/claude-runtime-contract.js +40 -0
- package/lib/channels/claude-runtime.js +58 -0
- package/lib/channels/claude-setup-values.js +92 -0
- package/lib/channels/mcp-client/config-merge.js +148 -0
- package/lib/channels/mcp-client/ensure-client.js +231 -0
- package/lib/channels/mcp-client/paths.js +53 -0
- package/lib/channels/mcp-client/profiles.js +122 -0
- package/lib/channels/mcp-client/redirect-uris.js +99 -0
- package/lib/channels/mcp-client/runtime.js +59 -0
- package/lib/channels/mcp-client-channel-add.js +186 -0
- package/lib/channels/microsoft-copilot-channel-add.js +117 -7
- package/lib/channels/microsoft-copilot-entra-identifier-uris.js +187 -0
- package/lib/channels/microsoft-copilot-entra-sso-form.js +106 -18
- package/lib/channels/microsoft-copilot-entra-sso.js +31 -2
- package/lib/channels/microsoft-copilot-package-prior.js +107 -0
- package/lib/channels/microsoft-copilot-package.js +29 -28
- package/lib/channels/microsoft-provisioning/a365.js +80 -0
- package/lib/channels/microsoft-provisioning/auth-config.js +240 -0
- package/lib/channels/microsoft-provisioning/auth.js +179 -0
- package/lib/channels/microsoft-provisioning/cli.js +71 -0
- package/lib/channels/microsoft-provisioning/constants.js +75 -0
- package/lib/channels/microsoft-provisioning/errors.js +117 -0
- package/lib/channels/microsoft-provisioning/index.js +55 -0
- package/lib/channels/microsoft-provisioning/install-atk.js +158 -0
- package/lib/channels/microsoft-provisioning/install-teams.js +115 -0
- package/lib/channels/microsoft-provisioning/login-portal-device.js +236 -0
- package/lib/channels/microsoft-provisioning/login-portal-parse.js +71 -0
- package/lib/channels/microsoft-provisioning/login-portal-teams.js +193 -0
- package/lib/channels/microsoft-provisioning/login-portal.js +230 -0
- package/lib/channels/microsoft-provisioning/persist.js +110 -0
- package/lib/channels/microsoft-provisioning/teams-bot-args.js +119 -0
- package/lib/channels/microsoft-provisioning/teams-bot-controller.js +123 -0
- package/lib/channels/microsoft-provisioning/teams-bot-parse.js +134 -0
- package/lib/channels/microsoft-provisioning/teams-bot-persist.js +113 -0
- package/lib/channels/microsoft-provisioning/teams-bot-provision.js +234 -0
- package/lib/channels/microsoft-provisioning/teams-bot-secrets.js +45 -0
- package/lib/channels/microsoft-provisioning/teams-cli.js +82 -0
- package/lib/channels/runtime-tool-catalog.js +5 -2
- package/lib/channels/slack-channel-add-portal.js +130 -0
- package/lib/channels/slack-channel-add-tty-auth.js +95 -0
- package/lib/channels/slack-channel-add.js +311 -0
- package/lib/channels/slack-mcp-callback.js +51 -0
- package/lib/channels/slack-mcp-runtime.js +156 -0
- package/lib/channels/slack-provisioning/apps.js +181 -0
- package/lib/channels/slack-provisioning/auth-store.js +110 -0
- package/lib/channels/slack-provisioning/auth-ticket.js +185 -0
- package/lib/channels/slack-provisioning/auth.js +115 -0
- package/lib/channels/slack-provisioning/callbacks.js +41 -0
- package/lib/channels/slack-provisioning/cli.js +226 -0
- package/lib/channels/slack-provisioning/constants.js +37 -0
- package/lib/channels/slack-provisioning/credentials.js +169 -0
- package/lib/channels/slack-provisioning/curl-shim.js +132 -0
- package/lib/channels/slack-provisioning/developer-install.js +118 -0
- package/lib/channels/slack-provisioning/env-file.js +120 -0
- package/lib/channels/slack-provisioning/errors.js +47 -0
- package/lib/channels/slack-provisioning/go-ca-bundle.js +137 -0
- package/lib/channels/slack-provisioning/index.js +250 -0
- package/lib/channels/slack-provisioning/install-cli.js +335 -0
- package/lib/channels/slack-provisioning/manifest.js +89 -0
- package/lib/channels/slack-provisioning/oauth-lock.js +33 -0
- package/lib/channels/slack-provisioning/offer-cli.js +113 -0
- package/lib/channels/slack-provisioning/onboard-members.js +122 -0
- package/lib/channels/slack-provisioning/onboard.js +89 -0
- package/lib/channels/slack-provisioning/persist.js +95 -0
- package/lib/channels/slack-provisioning/remaining-urls.js +158 -0
- package/lib/channels/slack-provisioning/with-curl-on-path.js +53 -0
- package/lib/channels/teams-bot-channel-add.js +94 -0
- package/lib/channels/vendor-dataplane-url.js +249 -0
- package/lib/cli/index.js +4 -0
- package/lib/cli/setup-certification-commands.js +2 -2
- package/lib/cli/setup-certification.help.js +5 -1
- package/lib/cli/setup-external-system-help.js +2 -0
- package/lib/cli/setup-external-system.js +1 -1
- package/lib/commands/agent-kit-help.js +79 -0
- package/lib/commands/agent-kit.js +346 -0
- package/lib/commands/channel-add-help.js +366 -0
- package/lib/commands/channel-add-setup.js +162 -80
- package/lib/commands/channel-configure.js +118 -0
- package/lib/commands/channel.js +10 -1
- package/lib/commands/datasource-capability-relate-cli.js +5 -4
- package/lib/commands/governance-upload-external.js +6 -3
- package/lib/commands/lifecycle-command-action.js +2 -5
- package/lib/commands/lifecycle-external.js +93 -21
- package/lib/commands/repair-auth-apply.js +1 -1
- package/lib/commands/repair-datasource-key-skip.js +39 -0
- package/lib/commands/repair-datasource-keys.js +24 -12
- package/lib/commands/repair-datasource-test-payload.js +4 -2
- package/lib/commands/repair-datasource-webhooks-sync-bridge.js +23 -2
- package/lib/commands/repair-datasource.js +3 -0
- package/lib/commands/repair-external-run.js +59 -25
- package/lib/commands/repair-openapi-rest-runtime.js +127 -0
- package/lib/commands/repair-orchestration-tag-merge.js +339 -0
- package/lib/commands/repair-rbac-catalog-defaults.js +96 -0
- package/lib/commands/repair-rbac-platform-preset.js +26 -15
- package/lib/commands/repair-rbac-reader-roles.js +8 -21
- package/lib/commands/repair-rbac.js +26 -44
- package/lib/commands/repair-system-permissions.js +24 -22
- package/lib/commands/role-assistant-copy-output.js +61 -0
- package/lib/commands/role-assistant-copy.js +155 -0
- package/lib/commands/role-assistant-test-output.js +22 -9
- package/lib/commands/role-assistant-test-result-rows.js +42 -0
- package/lib/commands/role-assistant.js +150 -43
- package/lib/commands/search.js +143 -0
- package/lib/commands/test-e2e-external.js +148 -21
- package/lib/commands/test-trust-external.js +7 -5
- package/lib/commands/upload-credential-push-log.js +2 -1
- package/lib/commands/upload-publish-context.js +1 -1
- package/lib/commands/upload-role-assistant-shell.js +124 -0
- package/lib/commands/upload-sidecar-followups.js +10 -4
- package/lib/commands/upload.js +18 -3
- package/lib/commands/verify-operations-skip-e2e.js +131 -0
- package/lib/commands/verify-operations-step-plan.js +6 -33
- package/lib/commands/verify-operations-steps.js +3 -1
- package/lib/core/secrets-docker-env.js +4 -1
- package/lib/core/secrets-env-content.js +17 -3
- package/lib/datasource/capability/capability-manifest.js +0 -3
- package/lib/datasource/capability/copy-test-payload.js +3 -0
- package/lib/datasource/capability/relate-operations.js +28 -10
- package/lib/datasource/capability/run-capability-relate.js +48 -25
- package/lib/datasource/datasource-identifier.js +13 -5
- package/lib/deployment/deployer-poll-run.js +117 -35
- package/lib/external-system/deploy-dataplane-published.js +70 -0
- package/lib/external-system/deploy-helpers.js +26 -1
- package/lib/external-system/deploy.js +22 -8
- package/lib/external-system/download-helpers.js +29 -2
- package/lib/external-system/download-role-assistant.js +109 -4
- package/lib/external-system/download.js +46 -30
- package/lib/external-system/sync-deploy-manifest.js +3 -2
- package/lib/external-system/upload-identity.js +42 -0
- package/lib/generator/index.js +19 -15
- package/lib/generator/split.js +13 -2
- package/lib/generator/wizard-datasource-key.js +54 -0
- package/lib/generator/wizard.js +55 -54
- package/lib/integration-definition/apply-datasource-keys.js +75 -0
- package/lib/integration-definition/apply-relationships.js +195 -0
- package/lib/integration-definition/apply-static-enterprise.js +229 -0
- package/lib/integration-definition/apply-system-file.js +71 -0
- package/lib/integration-definition/apply-test-endpoint.js +89 -0
- package/lib/integration-definition/apply-viewpoint-defaults.js +157 -0
- package/lib/integration-definition/apply.js +78 -59
- package/lib/integration-definition/enrich-openapi-operations.js +36 -10
- package/lib/integration-definition/enrich-openapi-pick.js +87 -0
- package/lib/lifecycle/role-assistant-governance.js +181 -0
- package/lib/lifecycle/scenario-upload.js +181 -30
- package/lib/programmatic/builder-api-cors.js +143 -0
- package/lib/programmatic/builder-api-request.js +6 -0
- package/lib/programmatic/builder-api-route-dispatch.js +56 -42
- package/lib/programmatic/builder-api-server.js +8 -1
- package/lib/programmatic/capability-registry.js +55 -0
- package/lib/programmatic/channel-install-help-resolve.js +359 -0
- package/lib/programmatic/channel-install-session.js +218 -0
- package/lib/programmatic/help-content/channel-onboarding.md +2 -0
- package/lib/programmatic/help-content/cip-overview.md +3 -1
- package/lib/programmatic/http-raw-response.js +62 -0
- package/lib/programmatic/index.js +2 -0
- package/lib/programmatic/openapi-apply-result-schemas.js +8 -0
- package/lib/programmatic/openapi-channel-install-bindings.js +179 -0
- package/lib/programmatic/openapi-channel-install-schemas.js +289 -0
- package/lib/programmatic/openapi-component-schemas.js +19 -1
- package/lib/programmatic/openapi-description-enricher.js +3 -1
- package/lib/programmatic/openapi-descriptions.js +80 -3
- package/lib/programmatic/openapi-envelope-examples.js +124 -0
- package/lib/programmatic/openapi-operation-bindings.js +9 -1
- package/lib/programmatic/openapi-request-schemas.js +5 -0
- package/lib/programmatic/openapi-schema-descriptions-channel.js +319 -0
- package/lib/programmatic/openapi-schema-descriptions-operations.js +19 -0
- package/lib/programmatic/openapi-spec.js +13 -8
- package/lib/programmatic/platform-rbac-catalog.js +36 -18
- package/lib/programmatic/request-timeout.js +3 -0
- package/lib/programmatic/route-handler-map.js +58 -1
- package/lib/programmatic/route-handlers-context.js +2 -1
- package/lib/programmatic/run-auth-permissions.js +54 -0
- package/lib/programmatic/run-channel-catalog.js +238 -0
- package/lib/programmatic/run-channel-install-artifacts.js +137 -0
- package/lib/programmatic/run-channel-install-copilot.js +353 -0
- package/lib/programmatic/run-channel-install-options.js +236 -0
- package/lib/programmatic/run-channel-install-teams-bot.js +204 -0
- package/lib/programmatic/run-channel-install.js +346 -0
- package/lib/programmatic/run-channel-package.js +87 -7
- package/lib/programmatic/run-download.js +41 -0
- package/lib/programmatic/workspace-context.js +2 -0
- package/lib/protection/auth-context.js +3 -1
- package/lib/protection/protection-display.js +3 -2
- package/lib/protection/report-exit.js +50 -0
- package/lib/protection/run-commands.js +2 -0
- package/lib/role-assistant/evidence-sync.js +4 -2
- package/lib/role-assistant/evidence-validation-issues.js +51 -0
- package/lib/role-assistant/knowledge-sync.js +10 -4
- package/lib/role-assistant/package-validate.js +175 -0
- package/lib/role-assistant/settings.js +49 -2
- package/lib/role-assistant/test-case-assertion-row.js +36 -0
- package/lib/role-assistant/test-case-copy-bind.js +77 -0
- package/lib/role-assistant/test-case-copy-expected.js +127 -0
- package/lib/role-assistant/test-case-copy-from-work.js +90 -0
- package/lib/role-assistant/test-case-copy-interactions.js +67 -0
- package/lib/role-assistant/test-case-copy.js +119 -0
- package/lib/role-assistant/test-case-expected-catalog.js +135 -0
- package/lib/role-assistant/test-case-validate.js +88 -0
- package/lib/role-assistant/test-cases-bid.js +117 -4
- package/lib/role-assistant/test-cases-evaluate.js +159 -24
- package/lib/role-assistant/test-cases-evidence.js +175 -0
- package/lib/role-assistant/test-cases-honesty.js +155 -6
- package/lib/role-assistant/test-cases-lifecycle.js +291 -0
- package/lib/role-assistant/test-cases-search-graph.js +122 -0
- package/lib/role-assistant/test-cases-search.js +247 -0
- package/lib/role-assistant/test-cases.js +71 -172
- package/lib/role-assistant/test-pack-map.js +180 -0
- package/lib/role-assistant/test-pack-sync.js +187 -0
- package/lib/role-assistant/test-runner-debug.js +54 -0
- package/lib/role-assistant/test-runner-respond-body.js +36 -0
- package/lib/role-assistant/test-runner-search.js +164 -0
- package/lib/role-assistant/test-runner-start-payload.js +63 -10
- package/lib/role-assistant/test-runner-workhub-answers.js +45 -16
- package/lib/role-assistant/test-runner-workhub-helpers.js +40 -2
- package/lib/role-assistant/test-runner-workhub-soft.js +9 -3
- package/lib/role-assistant/test-runner-workhub.js +74 -32
- package/lib/role-assistant/test-runner.js +66 -11
- package/lib/schema/external-datasource.schema.json +146 -21
- package/lib/schema/external-system.schema.json +177 -2
- package/lib/schema/mcp-client-profile.schema.json +103 -0
- package/lib/schema/role-assistant-test-case.schema.json +408 -0
- package/lib/search/dataplane-context.js +23 -0
- package/lib/search/search-args.js +211 -0
- package/lib/search/search-display.js +238 -0
- package/lib/search/search-errors.js +50 -0
- package/lib/search/search-prompts.js +119 -0
- package/lib/search/search-roles.js +85 -0
- package/lib/search/search-run.js +241 -0
- package/lib/search/search-skills.js +198 -0
- package/lib/utils/app-path-resolve.js +4 -0
- package/lib/utils/authentication-env-template.js +44 -6
- package/lib/utils/authentication-slot-show.js +153 -0
- package/lib/utils/credential-display.js +43 -1
- package/lib/utils/credential-secrets-env.js +6 -1
- package/lib/utils/env-copy.js +19 -7
- package/lib/utils/external-env-template.js +20 -2
- package/lib/utils/external-system-readiness-compact-blocks.js +5 -1
- package/lib/utils/external-system-readiness-compact-display.js +30 -1
- package/lib/utils/external-system-validators.js +2 -1
- package/lib/utils/help-builder.js +3 -1
- package/lib/utils/paths.js +18 -1
- package/lib/utils/platform-shell-package.js +69 -0
- package/lib/utils/port-resolver.js +50 -1
- package/lib/utils/rewrite-name-flag.js +20 -0
- package/lib/utils/role-assistant-paths.js +13 -10
- package/lib/utils/schema-loader.js +37 -0
- package/lib/utils/schema-resolver.js +11 -1
- package/lib/utils/secrets-helpers.js +12 -21
- package/lib/utils/token-manager.js +10 -5
- package/lib/validation/validate-external-file.js +5 -1
- package/lib/validation/validate.js +41 -0
- package/package.json +1 -1
- package/templates/README.md +1 -1
- package/templates/agent-kit/adapters/claude/nested.CLAUDE.md +1 -0
- package/templates/agent-kit/adapters/claude/root.CLAUDE.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-0-plan.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-1-validate.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-2-build.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-3-push.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-biz-1-validate.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-biz-2-build.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-biz-3-prove.md +5 -0
- package/templates/agent-kit/agent-kit.yaml +45 -0
- package/templates/agent-kit/instructions/AGENTKIT.md +83 -0
- package/templates/agent-kit/instructions/integration.AGENTS.md +25 -0
- package/templates/agent-kit/instructions/role-assistant.AGENTS.md +22 -0
- package/templates/agent-kit/instructions/root.AGENTS.md +37 -0
- package/templates/agent-kit/parity-inventory.yaml +188 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/SKILL.md +58 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/references/contract-checklist.md +40 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/references/delivery-gates.md +54 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/references/production-safety.md +35 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/scripts/reserved-system-key.js +19 -0
- package/templates/agent-kit/skills/aifabrix-plan/SKILL.md +51 -0
- package/templates/agent-kit/skills/aifabrix-plan/references/challenge-checklist.md +108 -0
- package/templates/agent-kit/skills/aifabrix-plan/references/interaction.md +34 -0
- package/templates/agent-kit/skills/aifabrix-plan/references/plan-template.md +182 -0
- package/templates/agent-kit/skills/aifabrix-prove/SKILL.md +50 -0
- package/templates/agent-kit/skills/aifabrix-prove/references/demo-template.md +65 -0
- package/templates/agent-kit/skills/aifabrix-prove/references/evidence-lifecycle.md +68 -0
- package/templates/agent-kit/skills/aifabrix-prove/references/learning-template.md +66 -0
- package/templates/agent-kit/skills/aifabrix-role-assistant/SKILL.md +42 -0
- package/templates/agent-kit/skills/aifabrix-role-assistant/references/package-boundary.md +21 -0
- package/templates/agent-kit/skills/shared/hosts.md +78 -0
- package/templates/agent-kit/workspace/.cursor/plans/README.md +22 -0
- package/templates/agent-kit/workspace/LICENSE.mit +21 -0
- package/templates/agent-kit/workspace/README.md +89 -0
- package/templates/applications/builder-api/Dockerfile +3 -1
- package/templates/applications/builder-api/env.template +7 -0
- package/templates/applications/dataplane/application.yaml +6 -5
- package/templates/applications/dataplane/env.template +2 -2
- package/templates/applications/dataplane/rbac.yaml +35 -2
- package/templates/applications/keycloak/Dockerfile +30 -4
- package/templates/applications/keycloak/application.yaml +2 -2
- package/templates/applications/keycloak/cimd-lenient-parse/AbstractClientIdMetadataDocumentExecutor.java +896 -0
- package/templates/applications/keycloak/cimd-lenient-parse/SOURCE.md +19 -0
- package/templates/applications/keycloak/env.template +3 -0
- package/templates/applications/miso-controller/application.yaml +1 -2
- package/templates/applications/miso-controller/env.template +10 -9
- package/templates/channels/README.md +5 -5
- package/templates/channels/chatgpt/TROUBLESHOOTING.md +51 -0
- package/templates/channels/chatgpt/channel.json +59 -0
- package/templates/channels/chatgpt/icon.svg +1 -0
- package/templates/channels/chatgpt/install.template.md.hbs +20 -95
- package/templates/channels/chatgpt/integration/README.md +1 -1
- package/templates/channels/chatgpt/integration/application.json +2 -2
- package/templates/channels/chatgpt/integration/chatgpt-system.json +49 -4
- package/templates/channels/chatgpt/integration/env.template +2 -4
- package/templates/channels/chatgpt/integration/rbac.json +13 -0
- package/templates/channels/claude/TROUBLESHOOTING.md +44 -0
- package/templates/channels/claude/channel.json +59 -0
- package/templates/channels/claude/icon.svg +1 -0
- package/templates/channels/claude/install.template.md.hbs +22 -0
- package/templates/channels/claude/integration/README.md +14 -0
- package/templates/channels/claude/integration/application.json +15 -0
- package/templates/channels/claude/integration/claude-system.json +59 -0
- package/templates/channels/claude/integration/env.template +2 -0
- package/templates/channels/claude/integration/rbac.json +13 -0
- package/templates/channels/claude/manifest.template.json.hbs +40 -0
- package/templates/channels/mcp-client/channel.json +72 -0
- package/templates/channels/mcp-client/icon.svg +1 -0
- package/templates/channels/mcp-client/install.template.md.hbs +24 -0
- package/templates/channels/mcp-client/integration/README.md +13 -0
- package/templates/channels/mcp-client/integration/application.json +15 -0
- package/templates/channels/mcp-client/integration/env.template +2 -0
- package/templates/channels/mcp-client/integration/mcp-client-system.json +72 -0
- package/templates/channels/mcp-client/integration/rbac.json +13 -0
- package/templates/channels/mcp-client/manifest.template.json.hbs +41 -0
- package/templates/channels/mcp-client/profiles/cursor.json +26 -0
- package/templates/channels/mcp-client/profiles/github-copilot.json +29 -0
- package/templates/channels/mcp-client/profiles/vscode.json +29 -0
- package/templates/channels/microsoft-copilot/channel.json +73 -0
- package/templates/channels/microsoft-copilot/declarative-agent.template.json.hbs +8 -4
- package/templates/channels/microsoft-copilot/entra-sso-registration.template.md.hbs +65 -5
- package/templates/channels/microsoft-copilot/icon.svg +1 -0
- package/templates/channels/microsoft-copilot/install.template.md.hbs +9 -9
- package/templates/channels/microsoft-copilot/integration/README.md +1 -1
- package/templates/channels/microsoft-copilot/integration/application.json +2 -2
- package/templates/channels/microsoft-copilot/integration/env.template +3 -6
- package/templates/channels/microsoft-copilot/integration/microsoft-copilot-system.json +63 -4
- package/templates/channels/microsoft-copilot/integration/rbac.json +13 -0
- package/templates/channels/microsoft-copilot/oauth-plugin-vault-required.template.md.hbs +5 -5
- package/templates/channels/slack/channel.json +234 -0
- package/templates/channels/slack/icon.svg +1 -0
- package/templates/channels/slack/install.template.md.hbs +45 -28
- package/templates/channels/slack/integration/README.md +245 -22
- package/templates/channels/slack/integration/application.json +44 -7
- package/templates/channels/slack/integration/env.template +15 -6
- package/templates/channels/slack/integration/openapi/openapi.json +126 -0
- package/templates/channels/slack/integration/rbac.json +84 -0
- package/templates/channels/slack/integration/slack-datasource-commands.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-conversations.json +28 -3
- package/templates/channels/slack/integration/slack-datasource-events.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-interactive.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-messages.json +40 -2
- package/templates/channels/slack/integration/slack-system.json +161 -72
- package/templates/channels/slack/manifest.template.json.hbs +10 -4
- package/templates/channels/teams-bot/channel.json +162 -0
- package/templates/channels/teams-bot/icon.svg +1 -0
- package/templates/channels/teams-bot/install.template.md.hbs +12 -13
- package/templates/channels/teams-bot/integration/README.md +5 -4
- package/templates/channels/teams-bot/integration/application.json +6 -4
- package/templates/channels/teams-bot/integration/env.template +5 -4
- package/templates/channels/teams-bot/integration/openapi/openapi.json +68 -0
- package/templates/channels/teams-bot/integration/rbac.json +21 -0
- package/templates/channels/teams-bot/integration/teams-bot-datasource-activities.json +154 -0
- package/templates/channels/teams-bot/integration/teams-bot-system.json +128 -23
- package/templates/channels/web-embed/channel.json +60 -0
- package/templates/channels/web-embed/install.template.md.hbs +1 -1
- package/templates/channels/web-embed/integration/README.md +2 -2
- package/templates/channels/web-embed/integration/application.json +2 -2
- package/templates/channels/web-embed/integration/env.template +1 -1
- package/templates/channels/web-embed/integration/rbac.json +13 -0
- package/templates/channels/web-embed/integration/web-embed-system.json +50 -4
- package/templates/python/docker-compose.hbs +14 -0
- package/templates/typescript/docker-compose.hbs +14 -0
|
@@ -18,6 +18,7 @@ const { persistChangesAndRegenerate, regenerateReadmeIfRequested, regenerateDepl
|
|
|
18
18
|
const { runRepairSteps } = require('./repair-steps');
|
|
19
19
|
const { runDatasourceRepairs } = require('./repair-datasource-run');
|
|
20
20
|
const { repairSplitOrchestrationDatasources } = require('./repair-orchestration-datasource-split');
|
|
21
|
+
const { mergeOrchestrationTagOperations } = require('./repair-orchestration-tag-merge');
|
|
21
22
|
const { maybeRepairRbac } = require('./repair-rbac');
|
|
22
23
|
const { collectCapabilityOpenApiDriftWarnings } = require('./repair-capability-openapi-warnings');
|
|
23
24
|
const { maybeRunOpenApiSyncForMcp } = require('./repair-openapi-sync');
|
|
@@ -169,7 +170,62 @@ async function runDatasourceOpenApiRepairs(ws) {
|
|
|
169
170
|
changes: ws.changes,
|
|
170
171
|
backupCtx: ws.backupCtx
|
|
171
172
|
});
|
|
172
|
-
|
|
173
|
+
const tagMerge = mergeOrchestrationTagOperations({
|
|
174
|
+
appPath: ws.appPath,
|
|
175
|
+
systemKey: ws.systemKey,
|
|
176
|
+
dryRun: ws.dryRun,
|
|
177
|
+
changes: ws.changes,
|
|
178
|
+
backupCtx: ws.backupCtx,
|
|
179
|
+
options: ws.options
|
|
180
|
+
});
|
|
181
|
+
return {
|
|
182
|
+
datasourceRepairUpdated: datasourceRepairUpdated || splitResult.updated || tagMerge.length > 0,
|
|
183
|
+
openapiActionsPerformed
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @param {Object} ws
|
|
189
|
+
* @returns {Promise<Object>}
|
|
190
|
+
*/
|
|
191
|
+
/**
|
|
192
|
+
* @param {Object} ws
|
|
193
|
+
* @returns {Object}
|
|
194
|
+
*/
|
|
195
|
+
function runRepairRbacStep(ws) {
|
|
196
|
+
return maybeRepairRbac(
|
|
197
|
+
ws.appPath,
|
|
198
|
+
ws.systemFilePath,
|
|
199
|
+
ws.systemParsed,
|
|
200
|
+
ws.datasourceFiles,
|
|
201
|
+
{
|
|
202
|
+
rbac: Boolean(ws.options.rbac),
|
|
203
|
+
rbacFmt: ws.rbacFmt,
|
|
204
|
+
rbacPreset: ws.options.rbacPreset,
|
|
205
|
+
dryRun: ws.dryRun,
|
|
206
|
+
changes: ws.changes,
|
|
207
|
+
backupCtx: ws.backupCtx
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @param {Object} ws
|
|
214
|
+
* @param {Object} steps
|
|
215
|
+
* @param {boolean} datasourceRepairUpdated
|
|
216
|
+
* @param {Object} rbac
|
|
217
|
+
* @returns {boolean}
|
|
218
|
+
*/
|
|
219
|
+
function anyRepairLocalUpdated(ws, steps, datasourceRepairUpdated, rbac) {
|
|
220
|
+
return Boolean(
|
|
221
|
+
ws.keysNormalized ||
|
|
222
|
+
steps.updated ||
|
|
223
|
+
datasourceRepairUpdated ||
|
|
224
|
+
rbac.rbacMigratedFromSystem ||
|
|
225
|
+
rbac.rbacMergeUpdated ||
|
|
226
|
+
rbac.rbacSyncedIntoSystem ||
|
|
227
|
+
rbac.rbacSecurityBound
|
|
228
|
+
);
|
|
173
229
|
}
|
|
174
230
|
|
|
175
231
|
/**
|
|
@@ -198,32 +254,10 @@ async function runRepairIntegrationFileSteps(ws) {
|
|
|
198
254
|
collectCapabilityOpenApiDriftWarnings(ws.appPath, ws.datasourceFiles, ws.warnings);
|
|
199
255
|
}
|
|
200
256
|
const { datasourceRepairUpdated, openapiActionsPerformed } = await runDatasourceOpenApiRepairs(ws);
|
|
201
|
-
const
|
|
202
|
-
maybeRepairRbac(
|
|
203
|
-
ws.appPath,
|
|
204
|
-
ws.systemFilePath,
|
|
205
|
-
ws.systemParsed,
|
|
206
|
-
ws.datasourceFiles,
|
|
207
|
-
{
|
|
208
|
-
rbac: Boolean(ws.options.rbac),
|
|
209
|
-
rbacFmt: ws.rbacFmt,
|
|
210
|
-
rbacPreset: ws.options.rbacPreset,
|
|
211
|
-
dryRun: ws.dryRun,
|
|
212
|
-
changes: ws.changes,
|
|
213
|
-
backupCtx: ws.backupCtx
|
|
214
|
-
}
|
|
215
|
-
);
|
|
216
|
-
const anyLocalUpdated =
|
|
217
|
-
ws.keysNormalized ||
|
|
218
|
-
steps.updated ||
|
|
219
|
-
datasourceRepairUpdated ||
|
|
220
|
-
rbacMigratedFromSystem ||
|
|
221
|
-
rbacMergeUpdated ||
|
|
222
|
-
rbacSyncedIntoSystem ||
|
|
223
|
-
rbacSecurityBound;
|
|
257
|
+
const rbac = runRepairRbacStep(ws);
|
|
224
258
|
return {
|
|
225
259
|
steps,
|
|
226
|
-
anyLocalUpdated,
|
|
260
|
+
anyLocalUpdated: anyRepairLocalUpdated(ws, steps, datasourceRepairUpdated, rbac),
|
|
227
261
|
changes: ws.changes,
|
|
228
262
|
warnings: ws.warnings,
|
|
229
263
|
openapiActionsPerformed,
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infer published REST restRuntime from a Builder OpenAPI path.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview CIP item routes bind one `{systemKey}` path param as recordIdentifier
|
|
5
|
+
* @author AI Fabrix Team
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
const APP_PACKAGE_ARTIFACT_ID = 'appPackage';
|
|
12
|
+
const BUILDER_API_PREFIX = /^\/api\/v1\/builder/;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Published REST cannot carry extra `{param}` segments except as restRuntime
|
|
16
|
+
* templates bound from the catch-all item subpath (only recordIdentifier is
|
|
17
|
+
* canonical). Channel ZIP downloads use the envelope artifact id `appPackage`.
|
|
18
|
+
* @param {string} segment
|
|
19
|
+
* @returns {string}
|
|
20
|
+
*/
|
|
21
|
+
function normalizeRestRuntimeSegment(segment) {
|
|
22
|
+
if (segment === '{artifactId}') {
|
|
23
|
+
return APP_PACKAGE_ARTIFACT_ID;
|
|
24
|
+
}
|
|
25
|
+
if (segment === '{systemKey}') {
|
|
26
|
+
return '{installationKey}';
|
|
27
|
+
}
|
|
28
|
+
return segment;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} tail
|
|
33
|
+
* @returns {string[]}
|
|
34
|
+
*/
|
|
35
|
+
function splitNormalizedSegments(tail) {
|
|
36
|
+
return tail.split('/').filter(Boolean).map(normalizeRestRuntimeSegment);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} stripped
|
|
41
|
+
* @returns {{ pathKind: string, subpathSegments: string[] }|undefined}
|
|
42
|
+
*/
|
|
43
|
+
function restRuntimeFromSystemsPath(stripped) {
|
|
44
|
+
const match = stripped.match(/^\/systems\/\{[^}]+\}\/(.+)$/);
|
|
45
|
+
if (!match) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const segs = splitNormalizedSegments(match[1]);
|
|
49
|
+
if (segs.length === 0) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return { pathKind: 'itemSubresource', subpathSegments: segs };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @param {string} stripped
|
|
57
|
+
* @returns {{ pathKind: string, subpathSegments?: string[] }|undefined}
|
|
58
|
+
*/
|
|
59
|
+
function restRuntimeFromChannelsPath(stripped) {
|
|
60
|
+
if (/^\/channels\/\{[^}]+\}$/.test(stripped)) {
|
|
61
|
+
return { pathKind: 'item' };
|
|
62
|
+
}
|
|
63
|
+
const match = stripped.match(/^\/channels\/\{[^}]+\}\/(.+)$/);
|
|
64
|
+
if (!match) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const segs = splitNormalizedSegments(match[1]);
|
|
68
|
+
if (segs.length === 0) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
return { pathKind: 'itemSubresource', subpathSegments: segs };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @param {string} stripped
|
|
76
|
+
* @returns {{ pathKind: string, subpathSegments: string[] }|undefined}
|
|
77
|
+
*/
|
|
78
|
+
function restRuntimeFromCollectionPath(stripped) {
|
|
79
|
+
if (stripped.includes('{')) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
const match = stripped.match(/^\/[^/]+\/(.+)$/);
|
|
83
|
+
if (!match) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
const segs = match[1].split('/').filter(Boolean);
|
|
87
|
+
if (segs.length === 0) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
return { pathKind: 'collectionSubresource', subpathSegments: segs };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @param {string} vendorPath
|
|
95
|
+
* @returns {{ pathKind: string, subpathSegments?: string[] }|undefined}
|
|
96
|
+
*/
|
|
97
|
+
function restRuntimeFromVendorPath(vendorPath) {
|
|
98
|
+
if (typeof vendorPath !== 'string' || !vendorPath.trim()) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
const stripped = vendorPath.replace(BUILDER_API_PREFIX, '');
|
|
102
|
+
return (
|
|
103
|
+
restRuntimeFromSystemsPath(stripped) ||
|
|
104
|
+
restRuntimeFromChannelsPath(stripped) ||
|
|
105
|
+
restRuntimeFromCollectionPath(stripped)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @param {Object} openapiOp
|
|
111
|
+
* @returns {Object}
|
|
112
|
+
*/
|
|
113
|
+
function withInferredRestRuntime(openapiOp) {
|
|
114
|
+
if (!openapiOp || typeof openapiOp !== 'object' || openapiOp.restRuntime) {
|
|
115
|
+
return openapiOp;
|
|
116
|
+
}
|
|
117
|
+
const restRuntime = restRuntimeFromVendorPath(openapiOp.path);
|
|
118
|
+
if (!restRuntime) {
|
|
119
|
+
return openapiOp;
|
|
120
|
+
}
|
|
121
|
+
return { ...openapiOp, restRuntime };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
module.exports = {
|
|
125
|
+
restRuntimeFromVendorPath,
|
|
126
|
+
withInferredRestRuntime
|
|
127
|
+
};
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge new tagged OpenAPI operations onto existing split orchestration datasources.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview --api follow-up for builder-api after OpenAPI export
|
|
5
|
+
* @author AI Fabrix Team
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const { CAPABILITIES } = require('../programmatic/capability-registry');
|
|
14
|
+
const { buildOpenApiSpec } = require('../programmatic/openapi-spec');
|
|
15
|
+
const { buildOperationXAfabrix } = require('../programmatic/orchestration-openapi-meta');
|
|
16
|
+
const { getOperationDescription } = require('../programmatic/openapi-descriptions');
|
|
17
|
+
const { isProgrammaticOrchestrationSystem } = require('./repair-openapi-export');
|
|
18
|
+
const { loadConfigFile, writeConfigFile } = require('../utils/config-format');
|
|
19
|
+
const { backupIntegrationFile } = require('../utils/integration-file-backup');
|
|
20
|
+
const { trackRepairWrite } = require('./repair-changed-files');
|
|
21
|
+
const { withInferredRestRuntime } = require('./repair-openapi-rest-runtime');
|
|
22
|
+
|
|
23
|
+
const DEFAULT_SECURITY = Object.freeze([
|
|
24
|
+
{ oauth2: ['business-transformation'] },
|
|
25
|
+
{ oauth2: ['aifabrix-developer'] },
|
|
26
|
+
{ oauth2: ['aifabrix-platform-admin'] }
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} handlerId
|
|
31
|
+
* @returns {string}
|
|
32
|
+
*/
|
|
33
|
+
function manifestKeyForHandler(handlerId) {
|
|
34
|
+
return String(handlerId || '').trim().toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {Object} parsed
|
|
39
|
+
* @returns {Set<string>}
|
|
40
|
+
*/
|
|
41
|
+
function existingOperationIds(parsed) {
|
|
42
|
+
const ids = new Set();
|
|
43
|
+
const ops = parsed && parsed.openapi && parsed.openapi.operations;
|
|
44
|
+
if (!ops || typeof ops !== 'object') {
|
|
45
|
+
return ids;
|
|
46
|
+
}
|
|
47
|
+
for (const entry of Object.values(ops)) {
|
|
48
|
+
if (entry && typeof entry.operationId === 'string' && entry.operationId.trim()) {
|
|
49
|
+
ids.add(entry.operationId.trim());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return ids;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Copy oauth2 security from a sibling operation on the same datasource.
|
|
57
|
+
* @param {Object} parsed
|
|
58
|
+
* @returns {Array<{ oauth2: string[] }>}
|
|
59
|
+
*/
|
|
60
|
+
function securityFromParsed(parsed) {
|
|
61
|
+
const ops = parsed && parsed.openapi && parsed.openapi.operations;
|
|
62
|
+
if (ops && typeof ops === 'object') {
|
|
63
|
+
for (const entry of Object.values(ops)) {
|
|
64
|
+
if (entry && Array.isArray(entry.security) && entry.security.length > 0) {
|
|
65
|
+
return entry.security.map((row) => ({
|
|
66
|
+
oauth2: Array.isArray(row.oauth2) ? [...row.oauth2] : []
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return DEFAULT_SECURITY.map((row) => ({ oauth2: [...row.oauth2] }));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @param {Object} spec
|
|
76
|
+
* @param {string} handlerId
|
|
77
|
+
* @returns {{ path: string, method: string, summary: string }|null}
|
|
78
|
+
*/
|
|
79
|
+
function findSpecOperation(spec, handlerId) {
|
|
80
|
+
const paths = spec && spec.paths && typeof spec.paths === 'object' ? spec.paths : {};
|
|
81
|
+
for (const [route, methods] of Object.entries(paths)) {
|
|
82
|
+
if (!methods || typeof methods !== 'object') {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
for (const [method, operation] of Object.entries(methods)) {
|
|
86
|
+
if (operation && operation.operationId === handlerId) {
|
|
87
|
+
return {
|
|
88
|
+
path: route,
|
|
89
|
+
method: String(method).toUpperCase(),
|
|
90
|
+
summary:
|
|
91
|
+
(typeof operation.summary === 'string' && operation.summary.trim()) ||
|
|
92
|
+
getOperationDescription(handlerId).summary
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @param {Object} specOp
|
|
102
|
+
* @param {string} handlerId
|
|
103
|
+
* @param {Object} parsed
|
|
104
|
+
* @returns {Object}
|
|
105
|
+
*/
|
|
106
|
+
function buildOpenapiOperation(specOp, handlerId, parsed) {
|
|
107
|
+
return withInferredRestRuntime({
|
|
108
|
+
operationId: handlerId,
|
|
109
|
+
path: specOp.path,
|
|
110
|
+
method: specOp.method,
|
|
111
|
+
security: securityFromParsed(parsed)
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @param {Object} parsed
|
|
117
|
+
* @param {string} key
|
|
118
|
+
* @param {Object} openapiOp
|
|
119
|
+
* @returns {boolean}
|
|
120
|
+
*/
|
|
121
|
+
function fillMissingRestRuntime(parsed, key, openapiOp) {
|
|
122
|
+
const existing = parsed.openapi && parsed.openapi.operations && parsed.openapi.operations[key];
|
|
123
|
+
if (!existing || existing.restRuntime || !openapiOp || !openapiOp.restRuntime) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
existing.restRuntime = openapiOp.restRuntime;
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @param {string} key
|
|
132
|
+
* @param {string} description
|
|
133
|
+
* @returns {Object}
|
|
134
|
+
*/
|
|
135
|
+
function buildCipPassthrough(key, description) {
|
|
136
|
+
return {
|
|
137
|
+
enabled: true,
|
|
138
|
+
description,
|
|
139
|
+
steps: [
|
|
140
|
+
{ fetch: { source: 'openapi', openapiRef: key, query: {} } },
|
|
141
|
+
{ map: { useFieldMappings: true, inputPath: '$' } },
|
|
142
|
+
{ output: { mode: 'records' } }
|
|
143
|
+
]
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @param {Object} parsed
|
|
149
|
+
* @param {string} key
|
|
150
|
+
* @param {string} description
|
|
151
|
+
* @returns {boolean}
|
|
152
|
+
*/
|
|
153
|
+
function ensureCapability(parsed, key, description) {
|
|
154
|
+
if (!Array.isArray(parsed.capabilities)) {
|
|
155
|
+
parsed.capabilities = [];
|
|
156
|
+
}
|
|
157
|
+
if (parsed.capabilities.some((row) => row && row.key === key)) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
parsed.capabilities.push({
|
|
161
|
+
key,
|
|
162
|
+
description,
|
|
163
|
+
riskLevel: 'medium',
|
|
164
|
+
approvalRequired: false
|
|
165
|
+
});
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @param {Object} parsed
|
|
171
|
+
* @param {string} key
|
|
172
|
+
* @param {Object} openapiOp
|
|
173
|
+
* @param {string} description
|
|
174
|
+
* @returns {string[]}
|
|
175
|
+
*/
|
|
176
|
+
function ensureCipScaffold(parsed) {
|
|
177
|
+
if (!parsed.openapi || typeof parsed.openapi !== 'object') {
|
|
178
|
+
parsed.openapi = {};
|
|
179
|
+
}
|
|
180
|
+
if (!parsed.openapi.operations || typeof parsed.openapi.operations !== 'object') {
|
|
181
|
+
parsed.openapi.operations = {};
|
|
182
|
+
}
|
|
183
|
+
if (!parsed.execution) {
|
|
184
|
+
parsed.execution = { engine: 'cip', cip: { version: '1.0', operations: {} } };
|
|
185
|
+
}
|
|
186
|
+
if (!parsed.execution.cip) {
|
|
187
|
+
parsed.execution.cip = { version: '1.0', operations: {} };
|
|
188
|
+
}
|
|
189
|
+
if (!parsed.execution.cip.operations) {
|
|
190
|
+
parsed.execution.cip.operations = {};
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @param {Object} parsed
|
|
196
|
+
* @param {string} key
|
|
197
|
+
* @param {Object} openapiOp
|
|
198
|
+
* @param {string} description
|
|
199
|
+
* @returns {string[]}
|
|
200
|
+
*/
|
|
201
|
+
function mergeOneOperation(parsed, key, openapiOp, description) {
|
|
202
|
+
const added = [];
|
|
203
|
+
ensureCipScaffold(parsed);
|
|
204
|
+
if (ensureCapability(parsed, key, description)) {
|
|
205
|
+
added.push(`capabilities.${key}`);
|
|
206
|
+
}
|
|
207
|
+
if (!parsed.openapi.operations[key]) {
|
|
208
|
+
parsed.openapi.operations[key] = withInferredRestRuntime(openapiOp);
|
|
209
|
+
added.push(`openapi.operations.${key}`);
|
|
210
|
+
} else if (fillMissingRestRuntime(parsed, key, withInferredRestRuntime(openapiOp))) {
|
|
211
|
+
added.push(`openapi.operations.${key}.restRuntime`);
|
|
212
|
+
}
|
|
213
|
+
if (!parsed.execution.cip.operations[key]) {
|
|
214
|
+
parsed.execution.cip.operations[key] = buildCipPassthrough(key, description);
|
|
215
|
+
added.push(`execution.cip.operations.${key}`);
|
|
216
|
+
}
|
|
217
|
+
return added;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @param {string} appPath
|
|
222
|
+
* @param {string} systemKey
|
|
223
|
+
* @param {string} tag
|
|
224
|
+
* @returns {string}
|
|
225
|
+
*/
|
|
226
|
+
function tagDatasourcePath(appPath, systemKey, tag) {
|
|
227
|
+
return path.join(appPath, `${systemKey}-datasource-${tag}.json`);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @param {Map<string, Object|null>} cache
|
|
232
|
+
* @param {string} appPath
|
|
233
|
+
* @param {string} systemKey
|
|
234
|
+
* @param {string} tag
|
|
235
|
+
* @returns {{ filePath: string, parsed: Object, dirty: boolean }|null}
|
|
236
|
+
*/
|
|
237
|
+
function loadTagEntry(cache, appPath, systemKey, tag) {
|
|
238
|
+
const filePath = tagDatasourcePath(appPath, systemKey, tag);
|
|
239
|
+
if (cache.has(filePath)) {
|
|
240
|
+
return cache.get(filePath);
|
|
241
|
+
}
|
|
242
|
+
if (!fs.existsSync(filePath)) {
|
|
243
|
+
cache.set(filePath, null);
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
const entry = { filePath, parsed: loadConfigFile(filePath), dirty: false };
|
|
247
|
+
cache.set(filePath, entry);
|
|
248
|
+
return entry;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @param {Map<string, Object|null>} cache
|
|
253
|
+
* @param {boolean} dryRun
|
|
254
|
+
* @param {Object} backupCtx
|
|
255
|
+
* @returns {void}
|
|
256
|
+
*/
|
|
257
|
+
function persistDirtyEntries(cache, dryRun, backupCtx) {
|
|
258
|
+
for (const entry of cache.values()) {
|
|
259
|
+
if (!entry || !entry.dirty) {
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (!dryRun) {
|
|
263
|
+
backupIntegrationFile(entry.filePath, backupCtx);
|
|
264
|
+
writeConfigFile(entry.filePath, entry.parsed);
|
|
265
|
+
}
|
|
266
|
+
trackRepairWrite(entry.filePath, { ...(backupCtx || {}), dryRun: Boolean(dryRun) });
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @param {Map<string, Object|null>} cache
|
|
272
|
+
* @param {Object} spec
|
|
273
|
+
* @param {Object} capability
|
|
274
|
+
* @param {string} appPath
|
|
275
|
+
* @param {string} systemKey
|
|
276
|
+
* @returns {string[]}
|
|
277
|
+
*/
|
|
278
|
+
function mergeCapabilityIntoCache(cache, spec, capability, appPath, systemKey) {
|
|
279
|
+
const tag = buildOperationXAfabrix(capability).datasourceTag;
|
|
280
|
+
if (tag !== 'infra') {
|
|
281
|
+
return [];
|
|
282
|
+
}
|
|
283
|
+
const entry = loadTagEntry(cache, appPath, systemKey, tag);
|
|
284
|
+
if (!entry) {
|
|
285
|
+
return [];
|
|
286
|
+
}
|
|
287
|
+
const specOp = findSpecOperation(spec, capability.handlerId);
|
|
288
|
+
if (!specOp) {
|
|
289
|
+
return [];
|
|
290
|
+
}
|
|
291
|
+
const key = manifestKeyForHandler(capability.handlerId);
|
|
292
|
+
const openapiOp = buildOpenapiOperation(specOp, capability.handlerId, entry.parsed);
|
|
293
|
+
if (existingOperationIds(entry.parsed).has(capability.handlerId)) {
|
|
294
|
+
if (!fillMissingRestRuntime(entry.parsed, key, openapiOp)) {
|
|
295
|
+
return [];
|
|
296
|
+
}
|
|
297
|
+
entry.dirty = true;
|
|
298
|
+
return [`${path.basename(entry.filePath)}: openapi.operations.${key}.restRuntime`];
|
|
299
|
+
}
|
|
300
|
+
const added = mergeOneOperation(entry.parsed, key, openapiOp, specOp.summary);
|
|
301
|
+
if (added.length > 0) {
|
|
302
|
+
entry.dirty = true;
|
|
303
|
+
}
|
|
304
|
+
return added.map((part) => `${path.basename(entry.filePath)}: ${part}`);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Merge missing infra-tagged OpenAPI operations onto the existing infra datasource.
|
|
309
|
+
* Does not create new split files (package/branding stay on the channel tag).
|
|
310
|
+
* @param {Object} params
|
|
311
|
+
* @returns {string[]}
|
|
312
|
+
*/
|
|
313
|
+
function mergeOrchestrationTagOperations(params) {
|
|
314
|
+
const { appPath, systemKey, dryRun, changes, backupCtx, options } = params;
|
|
315
|
+
if (!isProgrammaticOrchestrationSystem(systemKey)) {
|
|
316
|
+
return [];
|
|
317
|
+
}
|
|
318
|
+
if (!options || !options.api) {
|
|
319
|
+
return [];
|
|
320
|
+
}
|
|
321
|
+
const spec = buildOpenApiSpec();
|
|
322
|
+
const cache = new Map();
|
|
323
|
+
const added = [];
|
|
324
|
+
for (const capability of CAPABILITIES) {
|
|
325
|
+
added.push(...mergeCapabilityIntoCache(cache, spec, capability, appPath, systemKey));
|
|
326
|
+
}
|
|
327
|
+
persistDirtyEntries(cache, dryRun, backupCtx);
|
|
328
|
+
if (Array.isArray(changes)) {
|
|
329
|
+
added.forEach((line) => changes.push(line));
|
|
330
|
+
}
|
|
331
|
+
return added;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
module.exports = {
|
|
335
|
+
manifestKeyForHandler,
|
|
336
|
+
existingOperationIds,
|
|
337
|
+
mergeOneOperation,
|
|
338
|
+
mergeOrchestrationTagOperations
|
|
339
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catalog Admin/Observer defaults for Connected System RBAC.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Upload requires COM catalog keys — never invent {systemKey}-admin
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
listPlatformRoles,
|
|
11
|
+
ROLE_PLATFORM_ADMIN,
|
|
12
|
+
ROLE_OBSERVER
|
|
13
|
+
} = require('../programmatic/platform-rbac-catalog');
|
|
14
|
+
|
|
15
|
+
const CATALOG_ADMIN_ROLE = ROLE_PLATFORM_ADMIN;
|
|
16
|
+
const CATALOG_READER_ROLE = ROLE_OBSERVER;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @returns {Array<{ name: string, value: string, description: string, groups: string[] }>}
|
|
20
|
+
*/
|
|
21
|
+
function catalogAdminReaderRoles() {
|
|
22
|
+
const all = listPlatformRoles();
|
|
23
|
+
const admin = all.find((r) => r.value === CATALOG_ADMIN_ROLE);
|
|
24
|
+
const reader = all.find((r) => r.value === CATALOG_READER_ROLE);
|
|
25
|
+
return [admin, reader].filter(Boolean);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {string[]} roleValuesList
|
|
30
|
+
* @param {string} [systemKey]
|
|
31
|
+
* @param {string|null} [fallback]
|
|
32
|
+
* @returns {string|null}
|
|
33
|
+
*/
|
|
34
|
+
function pickCatalogAdminRoleValue(roleValuesList, systemKey, fallback) {
|
|
35
|
+
const values = Array.isArray(roleValuesList) ? roleValuesList : [];
|
|
36
|
+
return (
|
|
37
|
+
values.find((v) => v === CATALOG_ADMIN_ROLE) ||
|
|
38
|
+
(systemKey ? values.find((v) => v === `${systemKey}-admin`) : undefined) ||
|
|
39
|
+
values.find((v) => typeof v === 'string' && v.endsWith('-admin')) ||
|
|
40
|
+
fallback ||
|
|
41
|
+
values[0] ||
|
|
42
|
+
null
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {string[]} roleValuesList
|
|
48
|
+
* @param {string} [systemKey]
|
|
49
|
+
* @param {string|null} [fallback]
|
|
50
|
+
* @returns {string|null}
|
|
51
|
+
*/
|
|
52
|
+
function pickCatalogReaderRoleValue(roleValuesList, systemKey, fallback) {
|
|
53
|
+
const values = Array.isArray(roleValuesList) ? roleValuesList : [];
|
|
54
|
+
return (
|
|
55
|
+
values.find((v) => v === CATALOG_READER_ROLE) ||
|
|
56
|
+
(systemKey ? values.find((v) => v === `${systemKey}-reader`) : undefined) ||
|
|
57
|
+
values.find((v) => typeof v === 'string' && v.endsWith('-reader')) ||
|
|
58
|
+
fallback ||
|
|
59
|
+
null
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Ensures catalog Admin/Reader roles if rbac.roles is empty. Mutates rbac.
|
|
65
|
+
* @param {Object} rbac
|
|
66
|
+
* @param {string[]} changes
|
|
67
|
+
* @returns {boolean}
|
|
68
|
+
*/
|
|
69
|
+
function ensureDefaultRoles(rbac, changes) {
|
|
70
|
+
const hasRoles = Array.isArray(rbac.roles) && rbac.roles.length > 0;
|
|
71
|
+
if (hasRoles) return false;
|
|
72
|
+
const seeded = catalogAdminReaderRoles();
|
|
73
|
+
if (seeded.length < 2) return false;
|
|
74
|
+
rbac.roles = seeded;
|
|
75
|
+
const listGetPerms = (rbac.permissions || [])
|
|
76
|
+
.filter((p) => p?.name && (p.name.split(':')[1] === 'list' || p.name.split(':')[1] === 'get'))
|
|
77
|
+
.map((p) => p.name);
|
|
78
|
+
for (const p of rbac.permissions || []) {
|
|
79
|
+
if (!p.roles) p.roles = [];
|
|
80
|
+
if (p.name && listGetPerms.includes(p.name) && !p.roles.includes(CATALOG_READER_ROLE)) {
|
|
81
|
+
p.roles.push(CATALOG_READER_ROLE);
|
|
82
|
+
}
|
|
83
|
+
if (!p.roles.includes(CATALOG_ADMIN_ROLE)) p.roles.push(CATALOG_ADMIN_ROLE);
|
|
84
|
+
}
|
|
85
|
+
changes.push('Added catalog Admin and Reader roles to rbac file');
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
module.exports = {
|
|
90
|
+
CATALOG_ADMIN_ROLE,
|
|
91
|
+
CATALOG_READER_ROLE,
|
|
92
|
+
catalogAdminReaderRoles,
|
|
93
|
+
pickCatalogAdminRoleValue,
|
|
94
|
+
pickCatalogReaderRoleValue,
|
|
95
|
+
ensureDefaultRoles
|
|
96
|
+
};
|