@aifabrix/builder 2.53.0 → 2.54.1
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/bin/aifabrix.js +2 -2
- 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/types/evidence.types.js +2 -0
- package/lib/api/work-search.api.js +136 -0
- package/lib/channels/add-channel.js +163 -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 +60 -0
- package/lib/channels/channel-add-remaining.js +486 -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-description.js +59 -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 +356 -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 +16 -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 +180 -72
- package/lib/channels/channel-status-display.js +86 -16
- package/lib/channels/channel-targets.js +106 -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 +89 -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 +258 -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 +323 -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 +48 -0
- package/lib/channels/teams-bot-channel-add.js +94 -0
- package/lib/channels/vendor-dataplane-url.js +249 -0
- package/lib/cli/setup-certification.help.js +2 -0
- package/lib/cli/setup-external-system-help.js +2 -0
- package/lib/cli/setup-external-system.js +1 -1
- 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/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-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 +10 -34
- package/lib/commands/repair-system-permissions.js +24 -22
- package/lib/commands/role-assistant-test-output.js +14 -0
- package/lib/commands/role-assistant.js +59 -21
- package/lib/commands/test-e2e-external.js +148 -21
- 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 +6 -3
- package/lib/commands/upload.js +18 -3
- 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/external-system/deploy-helpers.js +26 -1
- package/lib/external-system/deploy.js +10 -6
- package/lib/external-system/download-helpers.js +29 -2
- package/lib/external-system/download-role-assistant.js +83 -4
- package/lib/external-system/download.js +40 -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/lifecycle/role-assistant-governance.js +146 -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 +54 -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/openapi-channel-install-bindings.js +179 -0
- package/lib/programmatic/openapi-channel-install-schemas.js +286 -0
- package/lib/programmatic/openapi-component-schemas.js +18 -1
- package/lib/programmatic/openapi-description-enricher.js +3 -1
- package/lib/programmatic/openapi-descriptions.js +74 -3
- package/lib/programmatic/openapi-envelope-examples.js +117 -0
- package/lib/programmatic/openapi-operation-bindings.js +4 -1
- package/lib/programmatic/openapi-schema-descriptions-channel.js +316 -0
- package/lib/programmatic/openapi-spec.js +12 -8
- package/lib/programmatic/platform-rbac-catalog.js +36 -18
- package/lib/programmatic/route-handler-map.js +51 -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 +196 -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 +232 -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/workspace-context.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/settings.js +49 -2
- package/lib/role-assistant/test-cases-evaluate.js +30 -2
- package/lib/role-assistant/test-cases-evidence.js +175 -0
- package/lib/role-assistant/test-cases-search.js +229 -0
- package/lib/role-assistant/test-cases.js +37 -4
- package/lib/role-assistant/test-runner-search.js +149 -0
- 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 +29 -11
- package/lib/role-assistant/test-runner.js +16 -1
- package/lib/schema/external-datasource.schema.json +119 -16
- package/lib/schema/external-system.schema.json +159 -2
- package/lib/schema/mcp-client-profile.schema.json +103 -0
- package/lib/utils/app-path-resolve.js +4 -0
- package/lib/utils/authentication-env-template.js +44 -6
- 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/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-resolver.js +11 -1
- package/lib/utils/secrets-helpers.js +12 -21
- package/lib/utils/token-manager.js +10 -5
- package/lib/validation/validate.js +40 -0
- package/package.json +1 -1
- package/templates/README.md +1 -1
- package/templates/applications/builder-api/Dockerfile +1 -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 +7 -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 +2 -0
- 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 +41 -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 +21 -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 +223 -0
- package/templates/channels/slack/icon.svg +1 -0
- package/templates/channels/slack/install.template.md.hbs +36 -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 +155 -77
- package/templates/channels/slack/manifest.template.json.hbs +5 -2
- package/templates/channels/teams-bot/channel.json +161 -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
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendor remaining-step payloads for canonical channel add TTY.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Slack/Copilot/Teams/web-embed remaining steps only
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { CHANNEL_TARGETS } = require('./channel-targets');
|
|
11
|
+
const { buildCredentialPortalUrl } = require('./approval-guides/credential-portal');
|
|
12
|
+
const { ENTRA_SSO_REGISTRATION_URL } = require('./microsoft-copilot-entra-sso-form');
|
|
13
|
+
const {
|
|
14
|
+
DEVELOPER_PORTAL_APPS_URL,
|
|
15
|
+
TEAMS_ADMIN_APPS_URL,
|
|
16
|
+
copilotPackageAppId,
|
|
17
|
+
developerPortalPublishOrgUrl
|
|
18
|
+
} = require('./approval-guides/microsoft-copilot');
|
|
19
|
+
const {
|
|
20
|
+
TEAMS_CLI_MISSING_REMAINING,
|
|
21
|
+
TEAMS_OPEN_URL,
|
|
22
|
+
TEAMS_POLICY_REMAINING
|
|
23
|
+
} = require('./microsoft-provisioning/constants');
|
|
24
|
+
const {
|
|
25
|
+
buildChatGptFormValues,
|
|
26
|
+
formatChatGptFormValueLines,
|
|
27
|
+
CHATGPT_APPS_CREATE_URL
|
|
28
|
+
} = require('./chatgpt-setup-values');
|
|
29
|
+
const { printMcpClientDryRunTty } = require('./mcp-client-channel-add');
|
|
30
|
+
const { printClaudeDryRunTty } = require('./claude-channel-add');
|
|
31
|
+
const { CLAUDE_REMAINING_STEPS } = require('./claude-runtime-contract');
|
|
32
|
+
const { vendorFacingUrlsFromCtx } = require('./vendor-dataplane-url');
|
|
33
|
+
const {
|
|
34
|
+
channelDisplayLabel,
|
|
35
|
+
printValidating,
|
|
36
|
+
printRuntimeDeployed,
|
|
37
|
+
printSlackOnboarded,
|
|
38
|
+
printOAuthConnected,
|
|
39
|
+
printSlackConnected,
|
|
40
|
+
printLabeledUrl,
|
|
41
|
+
printUseLines,
|
|
42
|
+
printRemainingSteps
|
|
43
|
+
} = require('./channel-add-tty');
|
|
44
|
+
|
|
45
|
+
const SLACK_APPS_URL = 'https://api.slack.com/apps';
|
|
46
|
+
|
|
47
|
+
const SLACK_AUTH_HANDSHAKE_STEPS = [
|
|
48
|
+
'Paste the slash command in any Slack channel or DM',
|
|
49
|
+
'Approve the permissions Slack shows',
|
|
50
|
+
'Paste the challenge code and continue'
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const CHATGPT_REMAINING_STEPS = [
|
|
54
|
+
'Create with logo (cannot change later)',
|
|
55
|
+
'Publish',
|
|
56
|
+
'Connect'
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @param {Object|null} ctx
|
|
61
|
+
* @param {string} channelTarget
|
|
62
|
+
* @returns {string}
|
|
63
|
+
*/
|
|
64
|
+
function credentialUrl(ctx, channelTarget) {
|
|
65
|
+
const { dataplaneBaseUrl } = vendorFacingUrlsFromCtx(ctx || {});
|
|
66
|
+
if (!dataplaneBaseUrl) {
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
const instanceKey =
|
|
70
|
+
ctx && typeof ctx.instanceSystemKey === 'string' ? ctx.instanceSystemKey.trim() : '';
|
|
71
|
+
return buildCredentialPortalUrl(dataplaneBaseUrl, instanceKey || channelTarget);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @param {Object|null} ctx
|
|
76
|
+
* @param {Object|null} runtimeValues
|
|
77
|
+
* @returns {string}
|
|
78
|
+
*/
|
|
79
|
+
function copilotZipPath(ctx, runtimeValues) {
|
|
80
|
+
const env =
|
|
81
|
+
String((runtimeValues && runtimeValues.environment) || (ctx && ctx.environment) || 'dev').trim() ||
|
|
82
|
+
'dev';
|
|
83
|
+
const root = (ctx && ctx.projectRoot) || (runtimeValues && runtimeValues.projectRoot) || process.cwd();
|
|
84
|
+
return path.resolve(root, 'dist', 'channels', 'microsoft-copilot', 'build', `appPackage.${env}.zip`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Portal download uses the instance key so GET artifacts hits this install.
|
|
89
|
+
* @param {Object|null} ctx
|
|
90
|
+
* @returns {string}
|
|
91
|
+
*/
|
|
92
|
+
function copilotArtifactHref(ctx) {
|
|
93
|
+
const key =
|
|
94
|
+
ctx && typeof ctx.instanceSystemKey === 'string' && ctx.instanceSystemKey.trim()
|
|
95
|
+
? ctx.instanceSystemKey.trim()
|
|
96
|
+
: 'microsoft-copilot';
|
|
97
|
+
return `/api/v1/builder/systems/${encodeURIComponent(key)}/channels/artifacts/appPackage`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @param {Object|null} runtimeValues
|
|
102
|
+
* @returns {boolean}
|
|
103
|
+
*/
|
|
104
|
+
function hasCopilotOauthVault(runtimeValues) {
|
|
105
|
+
return Boolean(
|
|
106
|
+
runtimeValues &&
|
|
107
|
+
typeof runtimeValues.oauthPluginVaultReferenceId === 'string' &&
|
|
108
|
+
runtimeValues.oauthPluginVaultReferenceId.trim()
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Toolkit session exists but auth-config capture failed.
|
|
114
|
+
* @returns {Object}
|
|
115
|
+
*/
|
|
116
|
+
function copilotFallbackRemainingSpec() {
|
|
117
|
+
return {
|
|
118
|
+
oauth: true,
|
|
119
|
+
authHeading: 'Teams Developer Portal (fallback)',
|
|
120
|
+
authUrl: ENTRA_SSO_REGISTRATION_URL,
|
|
121
|
+
remainingLabel: 'Microsoft Copilot',
|
|
122
|
+
steps: ['Paste the auth-config ID if Microsoft 365 Agents Toolkit could not create it']
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Copilot remaining steps while Microsoft login / Toolkit auth-config is missing.
|
|
128
|
+
* @param {Object|null} runtimeValues
|
|
129
|
+
* @returns {Object}
|
|
130
|
+
*/
|
|
131
|
+
function copilotWaitingRemainingSpec(runtimeValues) {
|
|
132
|
+
if (runtimeValues && runtimeValues.microsoftAuthConfigFallback === true) {
|
|
133
|
+
return copilotFallbackRemainingSpec();
|
|
134
|
+
}
|
|
135
|
+
const loginUrl =
|
|
136
|
+
runtimeValues && typeof runtimeValues.microsoftLoginUrl === 'string'
|
|
137
|
+
? runtimeValues.microsoftLoginUrl.trim()
|
|
138
|
+
: '';
|
|
139
|
+
const userCode =
|
|
140
|
+
runtimeValues && typeof runtimeValues.microsoftLoginUserCode === 'string'
|
|
141
|
+
? runtimeValues.microsoftLoginUserCode.trim()
|
|
142
|
+
: '';
|
|
143
|
+
const steps = loginUrl
|
|
144
|
+
? ['Sign in with Microsoft in the browser, then continue after sign-in']
|
|
145
|
+
: ['Continue to finish Microsoft Copilot setup'];
|
|
146
|
+
if (loginUrl && userCode) {
|
|
147
|
+
steps.unshift(`Enter code ${userCode} if the browser asks for it`);
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
oauth: true,
|
|
151
|
+
authHeading: loginUrl ? 'Sign in with Microsoft' : undefined,
|
|
152
|
+
authUrl: loginUrl,
|
|
153
|
+
remainingLabel: 'Microsoft Copilot',
|
|
154
|
+
steps
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @param {Object|null} ctx
|
|
160
|
+
* @param {Object|null} runtimeValues
|
|
161
|
+
* @returns {Object}
|
|
162
|
+
*/
|
|
163
|
+
function copilotRemainingSpec(ctx, runtimeValues) {
|
|
164
|
+
if (!hasCopilotOauthVault(runtimeValues)) {
|
|
165
|
+
return copilotWaitingRemainingSpec(runtimeValues);
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
oauth: true,
|
|
169
|
+
handoffRequired: false,
|
|
170
|
+
openHeading: 'Import an application',
|
|
171
|
+
openUrl: DEVELOPER_PORTAL_APPS_URL,
|
|
172
|
+
activateHeading: 'Publish to your org',
|
|
173
|
+
activateUrl: developerPortalPublishOrgUrl(copilotPackageAppId(ctx, runtimeValues)),
|
|
174
|
+
adminHeading: 'Approve in Manage apps',
|
|
175
|
+
adminUrl: TEAMS_ADMIN_APPS_URL,
|
|
176
|
+
downloadHeading: 'Download app package',
|
|
177
|
+
downloadHref: copilotArtifactHref(ctx),
|
|
178
|
+
remainingLabel: 'Microsoft Copilot',
|
|
179
|
+
useLines: [`Package: ${copilotZipPath(ctx, runtimeValues)}`],
|
|
180
|
+
steps: [
|
|
181
|
+
'Import an application (keep the generated app id)',
|
|
182
|
+
'Publish to your org',
|
|
183
|
+
'Approve in Manage apps, then Add from Built for your org'
|
|
184
|
+
]
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Slack vendor URLs. Connected (secrets stored) omits Authentication.
|
|
190
|
+
* @param {Object|null} ctx
|
|
191
|
+
* @param {{ connected?: boolean }} [options]
|
|
192
|
+
* @returns {Object}
|
|
193
|
+
*/
|
|
194
|
+
function slackVendorUrls(ctx, options) {
|
|
195
|
+
const connected = Boolean(options && options.connected);
|
|
196
|
+
const settingsUrl = ctx && ctx.slackAppSettingsUrl;
|
|
197
|
+
const installUrl = ctx && ctx.slackInstallAppUrl;
|
|
198
|
+
const approveUrl = ctx && ctx.slackWorkspaceApproveUrl;
|
|
199
|
+
return {
|
|
200
|
+
openHeading: 'Open Slack Apps',
|
|
201
|
+
openUrl: settingsUrl || (connected ? '' : SLACK_APPS_URL),
|
|
202
|
+
activateHeading: installUrl ? 'Activate the application' : undefined,
|
|
203
|
+
activateUrl: installUrl || '',
|
|
204
|
+
adminHeading: approveUrl ? 'Approve for this workspace' : undefined,
|
|
205
|
+
adminUrl: approveUrl || '',
|
|
206
|
+
authUrl: connected ? '' : credentialUrl(ctx, 'slack')
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function slackRecoverySpec(ctx, steps) {
|
|
211
|
+
return {
|
|
212
|
+
oauth: false,
|
|
213
|
+
remainingLabel: 'Slack',
|
|
214
|
+
steps,
|
|
215
|
+
...slackVendorUrls(ctx, { connected: false })
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @param {string[]} steps
|
|
221
|
+
* @returns {boolean}
|
|
222
|
+
*/
|
|
223
|
+
function isHandshakeRemaining(steps) {
|
|
224
|
+
const text = (steps || []).join('\n');
|
|
225
|
+
return /challenge code|token_revoked|token_expired|invalid_auth|not_authed/i.test(text);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @param {string[]} steps
|
|
230
|
+
* @param {Object} [extra]
|
|
231
|
+
* @returns {Object}
|
|
232
|
+
*/
|
|
233
|
+
function slackStepsSpec(steps, extra) {
|
|
234
|
+
return {
|
|
235
|
+
oauth: false,
|
|
236
|
+
remainingLabel: 'Slack',
|
|
237
|
+
steps,
|
|
238
|
+
...extra
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function slackCustomSteps(ctx) {
|
|
243
|
+
if (ctx && Array.isArray(ctx.slackRemaining)) {
|
|
244
|
+
return ctx.slackRemaining;
|
|
245
|
+
}
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function slackConnectedRemaining(ctx, custom) {
|
|
250
|
+
return {
|
|
251
|
+
...slackStepsSpec(custom || [], { slackConnected: true }),
|
|
252
|
+
...slackVendorUrls(ctx, { connected: true })
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function slackSlashRemaining(ctx, custom) {
|
|
257
|
+
const steps = custom && custom.length > 0 ? custom : [...SLACK_AUTH_HANDSHAKE_STEPS];
|
|
258
|
+
return slackStepsSpec(steps, { slackSlashCommand: ctx.slackSlashCommand });
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function slackFailedRemaining(custom) {
|
|
262
|
+
const failed = ['Slack authentication could not start on this host.'];
|
|
263
|
+
return slackStepsSpec(custom && custom.length > 0 ? custom : failed);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function slackRecoveryOrHandshake(ctx, custom) {
|
|
267
|
+
if (custom && custom.length > 0 && isHandshakeRemaining(custom)) {
|
|
268
|
+
return slackStepsSpec(custom);
|
|
269
|
+
}
|
|
270
|
+
if (custom && custom.length > 0) {
|
|
271
|
+
return slackRecoverySpec(ctx, custom);
|
|
272
|
+
}
|
|
273
|
+
return slackRecoverySpec(ctx, [
|
|
274
|
+
'Create the Slack app from the generated manifest',
|
|
275
|
+
'Store the bot token and signing secret'
|
|
276
|
+
]);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @param {Object|null} ctx
|
|
281
|
+
* @returns {Object}
|
|
282
|
+
*/
|
|
283
|
+
function slackRemainingSpec(ctx) {
|
|
284
|
+
const custom = slackCustomSteps(ctx);
|
|
285
|
+
if (ctx && ctx.slackConnected === true) {
|
|
286
|
+
return slackConnectedRemaining(ctx, custom);
|
|
287
|
+
}
|
|
288
|
+
if (ctx && ctx.slackSlashCommand) {
|
|
289
|
+
return slackSlashRemaining(ctx, custom);
|
|
290
|
+
}
|
|
291
|
+
if (ctx && ctx.slackHandshakeFailed === true) {
|
|
292
|
+
return slackFailedRemaining(custom);
|
|
293
|
+
}
|
|
294
|
+
return slackRecoveryOrHandshake(ctx, custom);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @param {Object|null} ctx
|
|
299
|
+
* @returns {Object}
|
|
300
|
+
*/
|
|
301
|
+
function teamsBotLoginUrl(ctx, runtimeValues) {
|
|
302
|
+
const fromRuntime =
|
|
303
|
+
runtimeValues && typeof runtimeValues.microsoftLoginUrl === 'string'
|
|
304
|
+
? runtimeValues.microsoftLoginUrl.trim()
|
|
305
|
+
: '';
|
|
306
|
+
if (fromRuntime) {
|
|
307
|
+
return fromRuntime;
|
|
308
|
+
}
|
|
309
|
+
return ctx && typeof ctx.microsoftLoginUrl === 'string' ? ctx.microsoftLoginUrl.trim() : '';
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* @param {Object|null} ctx
|
|
314
|
+
* @param {Object|null} [runtimeValues]
|
|
315
|
+
* @returns {Object}
|
|
316
|
+
*/
|
|
317
|
+
function teamsBotRemainingSpec(ctx, runtimeValues) {
|
|
318
|
+
const custom = ctx && Array.isArray(ctx.teamsBotRemaining) ? ctx.teamsBotRemaining : null;
|
|
319
|
+
if (ctx && ctx.teamsBotSkipped === true) {
|
|
320
|
+
const loginUrl = teamsBotLoginUrl(ctx, runtimeValues);
|
|
321
|
+
if (loginUrl) {
|
|
322
|
+
return {
|
|
323
|
+
oauth: false,
|
|
324
|
+
openHeading: 'Sign in with Microsoft',
|
|
325
|
+
openUrl: loginUrl,
|
|
326
|
+
remainingLabel: 'Microsoft',
|
|
327
|
+
steps: ['Sign in with Microsoft in the browser, then continue after sign-in']
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
return {
|
|
331
|
+
oauth: false,
|
|
332
|
+
remainingLabel: 'Microsoft',
|
|
333
|
+
steps: custom && custom.length > 0 ? custom : TEAMS_CLI_MISSING_REMAINING
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
return {
|
|
337
|
+
oauth: true,
|
|
338
|
+
openHeading: 'Open Teams',
|
|
339
|
+
openUrl: (ctx && ctx.teamsBotOpenUrl) || TEAMS_OPEN_URL,
|
|
340
|
+
remainingLabel: 'Microsoft',
|
|
341
|
+
steps: custom && custom.length > 0 ? custom : [TEAMS_POLICY_REMAINING]
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* @param {string} channelTarget
|
|
347
|
+
* @param {Object|null} ctx
|
|
348
|
+
* @param {Object|null} [runtimeValues]
|
|
349
|
+
* @returns {Object}
|
|
350
|
+
*/
|
|
351
|
+
function remainingSpec(channelTarget, ctx, runtimeValues) {
|
|
352
|
+
if (channelTarget === 'slack') {
|
|
353
|
+
return slackRemainingSpec(ctx);
|
|
354
|
+
}
|
|
355
|
+
if (channelTarget === 'microsoft-copilot') {
|
|
356
|
+
return copilotRemainingSpec(ctx, runtimeValues);
|
|
357
|
+
}
|
|
358
|
+
if (channelTarget === 'teams-bot') {
|
|
359
|
+
return teamsBotRemainingSpec(ctx, runtimeValues);
|
|
360
|
+
}
|
|
361
|
+
if (channelTarget === 'web-embed') {
|
|
362
|
+
return {
|
|
363
|
+
oauth: false,
|
|
364
|
+
remainingLabel: '',
|
|
365
|
+
steps: ['Embed the generated snippet in your application']
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
if (channelTarget === 'mcp-client') {
|
|
369
|
+
return {
|
|
370
|
+
oauth: true,
|
|
371
|
+
remainingLabel: '',
|
|
372
|
+
steps: ['Reload the editor.']
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
if (channelTarget === 'claude') {
|
|
376
|
+
return {
|
|
377
|
+
oauth: true,
|
|
378
|
+
remainingLabel: 'Claude',
|
|
379
|
+
steps: [...CLAUDE_REMAINING_STEPS]
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
const step = CHANNEL_TARGETS[channelTarget] && CHANNEL_TARGETS[channelTarget].remainingManualStep;
|
|
383
|
+
return {
|
|
384
|
+
oauth: false,
|
|
385
|
+
remainingLabel: channelDisplayLabel(channelTarget),
|
|
386
|
+
steps: step ? [step] : []
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* @param {Object} spec
|
|
392
|
+
* @returns {void}
|
|
393
|
+
*/
|
|
394
|
+
function printVendorUrls(spec) {
|
|
395
|
+
printLabeledUrl(spec.openHeading, spec.openUrl);
|
|
396
|
+
printUseLines(spec.useLines);
|
|
397
|
+
printLabeledUrl(spec.activateHeading, spec.activateUrl);
|
|
398
|
+
printLabeledUrl(spec.adminHeading, spec.adminUrl);
|
|
399
|
+
printLabeledUrl(spec.authHeading || 'Authentication', spec.authUrl);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Default TTY after AI Fabrix-owned work for non-ChatGPT targets.
|
|
404
|
+
* @param {string} channelTarget
|
|
405
|
+
* @param {Object|null} ctx
|
|
406
|
+
* @param {Object|null} [runtimeValues]
|
|
407
|
+
* @returns {void}
|
|
408
|
+
*/
|
|
409
|
+
function printVendorChannelValidated(channelTarget, ctx, runtimeValues) {
|
|
410
|
+
const spec = remainingSpec(channelTarget, ctx, runtimeValues);
|
|
411
|
+
printValidating(channelDisplayLabel(channelTarget));
|
|
412
|
+
printRuntimeDeployed();
|
|
413
|
+
if (typeof ctx?.slackOnboarded === 'number') {
|
|
414
|
+
printSlackOnboarded(ctx.slackOnboarded);
|
|
415
|
+
}
|
|
416
|
+
if (spec.slackConnected) {
|
|
417
|
+
printSlackConnected();
|
|
418
|
+
printVendorUrls(spec);
|
|
419
|
+
printRemainingSteps(spec.remainingLabel, spec.steps);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
if (spec.slackSlashCommand) {
|
|
423
|
+
printLabeledUrl('Run in Slack', spec.slackSlashCommand);
|
|
424
|
+
printRemainingSteps(spec.remainingLabel, spec.steps);
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if (spec.oauth === true) {
|
|
428
|
+
printOAuthConnected();
|
|
429
|
+
}
|
|
430
|
+
printVendorUrls(spec);
|
|
431
|
+
printRemainingSteps(spec.remainingLabel, spec.steps);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Dry-run ChatGPT TTY (no live OAuth).
|
|
436
|
+
* @param {Object} params
|
|
437
|
+
* @returns {void}
|
|
438
|
+
*/
|
|
439
|
+
function printChatGptDryRunTty(params) {
|
|
440
|
+
printValidating('ChatGPT');
|
|
441
|
+
printRuntimeDeployed();
|
|
442
|
+
const values = buildChatGptFormValues({ runtimeValues: params.runtimeValues || {} });
|
|
443
|
+
printLabeledUrl('Open ChatGPT Apps', CHATGPT_APPS_CREATE_URL);
|
|
444
|
+
printUseLines(formatChatGptFormValueLines(values));
|
|
445
|
+
printRemainingSteps('ChatGPT', CHATGPT_REMAINING_STEPS);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Live/dry-run install TTY. ChatGPT remaining steps are printed by continuation.
|
|
450
|
+
* @param {Object} params
|
|
451
|
+
* @returns {void}
|
|
452
|
+
*/
|
|
453
|
+
function printLiveChannelCanonicalTty(params) {
|
|
454
|
+
if (params.channelTarget === 'chatgpt') {
|
|
455
|
+
if (params.options && params.options.dryRun === true) {
|
|
456
|
+
printChatGptDryRunTty(params);
|
|
457
|
+
}
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if (params.channelTarget === 'claude') {
|
|
461
|
+
if (params.options && params.options.dryRun === true) {
|
|
462
|
+
printClaudeDryRunTty(params);
|
|
463
|
+
}
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
if (params.channelTarget === 'mcp-client') {
|
|
467
|
+
if (params.options && params.options.dryRun === true) {
|
|
468
|
+
printMcpClientDryRunTty(params);
|
|
469
|
+
}
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
printVendorChannelValidated(params.channelTarget, {
|
|
473
|
+
...(params.ctx || {}),
|
|
474
|
+
projectRoot: (params.ctx && params.ctx.projectRoot) || (params.options && params.options.projectRoot)
|
|
475
|
+
}, params.runtimeValues);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
module.exports = {
|
|
479
|
+
SLACK_APPS_URL,
|
|
480
|
+
SLACK_AUTH_HANDSHAKE_STEPS,
|
|
481
|
+
CHATGPT_REMAINING_STEPS,
|
|
482
|
+
CLAUDE_REMAINING_STEPS,
|
|
483
|
+
remainingSpec,
|
|
484
|
+
printVendorChannelValidated,
|
|
485
|
+
printLiveChannelCanonicalTty
|
|
486
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical default TTY for `aifabrix channel add`.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Shared scaffold/upload/validate/remaining-step lines
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const chalk = require('chalk');
|
|
10
|
+
const logger = require('../utils/logger');
|
|
11
|
+
const {
|
|
12
|
+
formatSuccessLine,
|
|
13
|
+
formatBlockingError
|
|
14
|
+
} = require('../utils/cli-layout-chalk');
|
|
15
|
+
const { CHANNEL_TARGETS } = require('./channel-targets');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {Object} [options]
|
|
19
|
+
* @returns {boolean}
|
|
20
|
+
*/
|
|
21
|
+
function isChannelAddVerbose(options) {
|
|
22
|
+
return Boolean(options && options.verbose === true);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {string} channelTarget
|
|
27
|
+
* @returns {string}
|
|
28
|
+
*/
|
|
29
|
+
function channelDisplayLabel(channelTarget) {
|
|
30
|
+
const target = CHANNEL_TARGETS[channelTarget];
|
|
31
|
+
return (target && target.displayLabel) || channelTarget;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {string} integrationDir
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
function printScaffolded(integrationDir) {
|
|
39
|
+
logger.log(formatSuccessLine(`Scaffolded integration at ${integrationDir}`));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @param {string} systemKey
|
|
44
|
+
* @returns {void}
|
|
45
|
+
*/
|
|
46
|
+
function printUploaded(systemKey) {
|
|
47
|
+
logger.log(formatSuccessLine(`Uploaded ${systemKey} in dataplane`));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {string} label
|
|
52
|
+
* @returns {void}
|
|
53
|
+
*/
|
|
54
|
+
function printValidating(label) {
|
|
55
|
+
logger.log(chalk.white(`Validating ${label}...`));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @returns {void}
|
|
60
|
+
*/
|
|
61
|
+
function printRuntimeDeployed() {
|
|
62
|
+
logger.log(formatSuccessLine('Runtime: Deployed'));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @param {number} count
|
|
67
|
+
* @returns {void}
|
|
68
|
+
*/
|
|
69
|
+
function printSlackOnboarded(count) {
|
|
70
|
+
logger.log(formatSuccessLine(`Onboarded ${Number(count) || 0} Slack users.`));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @returns {void}
|
|
75
|
+
*/
|
|
76
|
+
function printRuntimeUnavailable() {
|
|
77
|
+
logger.error(formatBlockingError('Runtime: Unavailable'));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
83
|
+
function printOAuthConnected() {
|
|
84
|
+
logger.log(formatSuccessLine('OAuth: Connected.'));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @returns {void}
|
|
89
|
+
*/
|
|
90
|
+
function printSlackConnected() {
|
|
91
|
+
logger.log(formatSuccessLine('Slack: Connected.'));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @returns {void}
|
|
96
|
+
*/
|
|
97
|
+
function printOAuthNotConnected() {
|
|
98
|
+
logger.error(formatBlockingError('OAuth: Not connected'));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @param {string} heading
|
|
103
|
+
* @param {string} url
|
|
104
|
+
* @returns {void}
|
|
105
|
+
*/
|
|
106
|
+
function printLabeledUrl(heading, url) {
|
|
107
|
+
if (!url) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
logger.log('');
|
|
111
|
+
logger.log(chalk.white(`${heading}:`));
|
|
112
|
+
logger.log(chalk.cyan(url));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @param {string[]} lines
|
|
117
|
+
* @returns {void}
|
|
118
|
+
*/
|
|
119
|
+
function printUseLines(lines) {
|
|
120
|
+
const usable = (lines || []).filter((line) => {
|
|
121
|
+
if (typeof line !== 'string' || !line.trim()) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return !/^Server URL:\s*$/.test(line);
|
|
125
|
+
});
|
|
126
|
+
if (usable.length === 0) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
logger.log('');
|
|
130
|
+
logger.log(chalk.white('Use:'));
|
|
131
|
+
for (const line of usable) {
|
|
132
|
+
logger.log(chalk.white(line));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @param {string} vendorLabel
|
|
138
|
+
* @param {string[]} steps
|
|
139
|
+
* @returns {void}
|
|
140
|
+
*/
|
|
141
|
+
function printRemainingSteps(vendorLabel, steps) {
|
|
142
|
+
const list = (steps || []).filter((step) => typeof step === 'string' && step.trim());
|
|
143
|
+
if (list.length === 0) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const heading = vendorLabel ? `Remaining ${vendorLabel} steps:` : 'Remaining steps:';
|
|
147
|
+
logger.log('');
|
|
148
|
+
logger.log(chalk.white(heading));
|
|
149
|
+
for (const step of list) {
|
|
150
|
+
logger.log(chalk.white(`- ${step}`));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @param {string} reason
|
|
156
|
+
* @param {string} resumeCommand
|
|
157
|
+
* @returns {void}
|
|
158
|
+
*/
|
|
159
|
+
function printFixThenRerun(reason, resumeCommand) {
|
|
160
|
+
logger.log('');
|
|
161
|
+
logger.log(chalk.white(`${reason}, then run:`));
|
|
162
|
+
logger.log('');
|
|
163
|
+
logger.log(chalk.white(resumeCommand));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @returns {void}
|
|
168
|
+
*/
|
|
169
|
+
function printCallbackRegistered() {
|
|
170
|
+
logger.log(formatSuccessLine('Callback registered'));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
module.exports = {
|
|
174
|
+
isChannelAddVerbose,
|
|
175
|
+
channelDisplayLabel,
|
|
176
|
+
printScaffolded,
|
|
177
|
+
printUploaded,
|
|
178
|
+
printValidating,
|
|
179
|
+
printRuntimeDeployed,
|
|
180
|
+
printSlackOnboarded,
|
|
181
|
+
printRuntimeUnavailable,
|
|
182
|
+
printOAuthConnected,
|
|
183
|
+
printSlackConnected,
|
|
184
|
+
printOAuthNotConnected,
|
|
185
|
+
printLabeledUrl,
|
|
186
|
+
printUseLines,
|
|
187
|
+
printRemainingSteps,
|
|
188
|
+
printFixThenRerun,
|
|
189
|
+
printCallbackRegistered
|
|
190
|
+
};
|