@ekanos/cli 0.25.0 → 0.26.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/README.md +4 -0
- package/dist/catalog-api.d.ts +8 -1
- package/dist/catalog-api.js +26 -1
- package/dist/catalog-api.js.map +1 -1
- package/dist/commands/add.js +2 -1
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/apps.js +6 -4
- package/dist/commands/apps.js.map +1 -1
- package/dist/commands/dev.d.ts +5 -0
- package/dist/commands/dev.js +25 -9
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/routes.js +7 -1
- package/dist/commands/routes.js.map +1 -1
- package/dist/commands/sources.js +11 -8
- package/dist/commands/sources.js.map +1 -1
- package/dist/commands/sync.js +3 -2
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/teams-events.js +9 -1
- package/dist/commands/teams-events.js.map +1 -1
- package/dist/commands/teams-lifecycle.js +9 -1
- package/dist/commands/teams-lifecycle.js.map +1 -1
- package/dist/commands/teams-onboard.js +9 -1
- package/dist/commands/teams-onboard.js.map +1 -1
- package/dist/commands/teams-overview.d.ts +1 -1
- package/dist/commands/teams-overview.js +41 -14
- package/dist/commands/teams-overview.js.map +1 -1
- package/dist/commands/teams.js +9 -1
- package/dist/commands/teams.js.map +1 -1
- package/dist/compatibility.d.ts +7 -1
- package/dist/compatibility.js +7 -1
- package/dist/compatibility.js.map +1 -1
- package/dist/contracts-api.d.ts +32 -0
- package/dist/contracts-api.js +66 -0
- package/dist/contracts-api.js.map +1 -0
- package/dist/experience/host-contract-source.d.ts +35 -0
- package/dist/experience/host-contract-source.js +121 -0
- package/dist/experience/host-contract-source.js.map +1 -0
- package/dist/experience/publish.js +7 -11
- package/dist/experience/publish.js.map +1 -1
- package/dist/harness-scaffold.js +5 -0
- package/dist/harness-scaffold.js.map +1 -1
- package/dist/host-snapshots.d.ts +66 -0
- package/dist/host-snapshots.js +273 -0
- package/dist/host-snapshots.js.map +1 -0
- package/dist/product-slug.d.ts +8 -0
- package/dist/product-slug.js +13 -0
- package/dist/product-slug.js.map +1 -0
- package/package.json +2 -2
- package/templates/experience/package.json.tmpl +4 -4
- package/templates/harness/app/catalog/[slug]/page.tsx.tmpl +1 -0
- package/templates/harness/app/catalog/layout.tsx.tmpl +1 -0
- package/templates/harness/app/catalog/page.tsx.tmpl +1 -0
- package/templates/harness/app/experience/publishes/page.tsx.tmpl +1 -0
- package/templates/harness/app/integrations/[slug]/publishes/page.tsx.tmpl +1 -0
- package/templates/package.json.tmpl +4 -4
- package/templates/skills/build-integration/references/widget-design.md +24 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teams.js","sourceRoot":"","sources":["../../src/commands/teams.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAEL,oBAAoB,EACpB,cAAc,EACd,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,eAAe,GAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EACL,kBAAkB,EAGlB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAEL,SAAS,EACT,eAAe,EACf,UAAU,EACV,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,eAAe,CA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vF,CAAC,CAAC,qFAAqF,CAC1F,CAAC;AACJ,CAAC;AAED,SAAS,IAAI,CAAC,IAAa;IACzB,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC1B,CAAC;AAED,SAAS,GAAG,CAAC,GAAW;IACtB,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,GAAG,CAAC,MAIZ;;IACC,mBAAO,MAAM,CAAC,KAAK,mCAAI,MAAM,CAAC,IAAI,mCAAI,MAAM,CAAC,MAAM,CAAC;AACtD,CAAC;AAED,sCAAsC;AACtC,SAAS,YAAY,CAAC,GAAiB;IACrC,OAAO,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import type {\n TeamAppState,\n TeamIntegrationStatus,\n} from '@ekanos/integration-schema';\n\nimport type { StoredSession } from '../auth/credential-store';\nimport { loginHint } from '../auth/host-trust';\nimport {\n type AuthEnvironment,\n refreshStoredSession,\n requireSession,\n resolveAuthEnvironment,\n} from '../auth/session';\nimport type { CliContext } from '../context';\nimport {\n authRequiredError,\n invalidStateError,\n usageError,\n validationError,\n} from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport { cli } from '../invocation';\nimport { ensureSecretsDir, writeSecretFile } from '../secret-file';\nimport {\n FIELD_SECRET_FORMS,\n type SecretFlags,\n type SecretIO,\n collectSecrets,\n parsePlainValues,\n readSecretFlags,\n secretInputGiven,\n} from '../secret-input';\nimport { resolveSourceTarget } from '../source-target';\nimport {\n type TeamsApiResult,\n listTeams,\n mintTeamWebhook,\n setTeamApp,\n showTeamIntegration,\n} from '../teams-api';\nimport { promptHidden, promptLine } from './apps';\nimport { scopeHiddenLines } from './scope-notice';\nimport { isTeamAgentArea, runTeamAgentCommands } from './team-agents';\nimport { runTeamAudience } from './teams-audience';\nimport { runTeamEvents } from './teams-events';\nimport {\n LIFECYCLE_SUBCOMMANDS,\n isLifecycleMemberVerb,\n isLifecycleSubcommand,\n parseLifecycle,\n runLifecycle,\n} from './teams-lifecycle';\nimport {\n ONBOARDING_SUBCOMMANDS,\n isOnboardingSubcommand,\n parseOnboarding,\n runOnboarding,\n} from './teams-onboard';\nimport { runTeamOverview } from './teams-overview';\nimport { runTeamScope } from './teams-scope';\n\nexport const TEAMS_SUBCOMMANDS = [\n 'list',\n 'show',\n 'app',\n 'webhook',\n 'events',\n 'scope',\n 'audience',\n ...ONBOARDING_SUBCOMMANDS,\n ...LIFECYCLE_SUBCOMMANDS,\n] as const;\ntype TeamsSubcommand = (typeof TEAMS_SUBCOMMANDS)[number];\n\nexport interface TeamsArgs {\n host?: string;\n source?: string;\n /** `list`, `show <team> [<product>]`, `app set <team> <product>`, `webhook <team> <product> [<id>]`. */\n positionals: readonly string[];\n connection?: string;\n /** `create --slug`, `create --owner <email>`, `members invite --role`. */\n slug?: string;\n owner?: string;\n role?: string;\n yes: boolean;\n /** `connect --no-wait`: print the sign-in link and return without polling. */\n noWait?: boolean;\n /** `connect --no-open`: never open a browser, only print the link. */\n noOpen?: boolean;\n /** `connect --link-only`: print the team's page, as before connect did the work. */\n linkOnly?: boolean;\n /** `connect --reconnect`: connect again though it reads as connected. */\n reconnect?: boolean;\n /** Test seams for `connect`: the wait between polls, and the browser opener. */\n pollDelayMs?: number;\n openUrl?: (url: string) => void;\n /** Every parsed flag, for `teams agents|triggers|links|mcp` (team-agents.ts). */\n flags?: Record<string, string | boolean | string[]>;\n dir: string;\n env: Record<string, string | undefined>;\n stdinIsTTY?: boolean;\n /** Test seams for the questions `app set` asks. */\n ask?: (question: string) => Promise<string>;\n askSecret?: (question: string) => Promise<string>;\n /** Test seams for the secret-input flags (`secret-input.ts`). */\n readStdin?: () => Promise<string>;\n secretFormTimeoutMs?: number;\n}\n\nexport interface Target {\n source: string;\n team: string;\n product: string;\n}\n\n/**\n * `teams` — a Source admin's view of its teams' integration setup, the\n * team-level counterpart of `apps`. `list` names the teams; `show` reads one\n * team's setup of one product as a checklist; `app set` enters or updates\n * any of a team's own app fields (Zendesk's subdomain, client and signing\n * secret), one at a time if need be — a field left alone keeps its saved\n * value. A secret is typed at the admin's terminal with hidden input or,\n * without one, read from the environment, a private file, stdin or a form\n * in the browser (`secret-input.ts`) — never a value in argv; a non-secret\n * field may be passed as `--set name=value`; `webhook` mints the URL the\n * team's provider sends to, shown once.\n */\nexport async function runTeams(\n ctx: CliContext,\n args: TeamsArgs,\n): Promise<ExitCode> {\n const [rawSubcommand, ...rest] = args.positionals;\n if (isTeamAgentArea(rawSubcommand)) {\n return runTeamAgentCommands(ctx, args);\n }\n const subcommand = parseSubcommand(rawSubcommand);\n\n if (subcommand === 'events') {\n return runTeamEvents(ctx, args, rest);\n }\n if (subcommand === 'scope') {\n return runTeamScope(ctx, args, rest);\n }\n if (subcommand === 'audience') {\n return runTeamAudience(ctx, args, rest);\n }\n\n if (\n isLifecycleSubcommand(subcommand) ||\n (subcommand === 'members' && isLifecycleMemberVerb(rest[0]))\n ) {\n return runLifecycle(ctx, args, parseLifecycle(subcommand, rest, args));\n }\n\n if (isOnboardingSubcommand(subcommand)) {\n const plan = parseOnboarding(subcommand, rest, {\n ...args,\n as: typeof args.flags?.as === 'string' ? args.flags.as : undefined,\n self: args.flags?.self === true,\n mine: args.flags?.mine === true,\n });\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n const resolved = await resolveSourceTarget(env, requireSession(env), args);\n return runOnboarding(\n ctx,\n args,\n new TeamsClient(env, resolved.session),\n env.host,\n resolved.source,\n plan,\n );\n }\n\n if (subcommand === 'app' && rest[0] !== 'set') {\n throw usageError(\n rest[0]\n ? `Unknown teams app subcommand \"${rest[0]}\".`\n : 'teams app needs a subcommand.',\n 'Run \"ekanos teams app set <team> <product>\".',\n );\n }\n const operands = subcommand === 'app' ? rest.slice(1) : rest;\n\n if (subcommand === 'list' && operands.length > 0) {\n throw usageError(\n 'teams list takes no arguments.',\n 'Run \"ekanos teams list --source <slug>\".',\n );\n }\n\n const team = subcommand === 'list' ? '' : requireSlug(operands[0], 'team');\n // `teams show <team>` alone is the team's overview.\n const overview = subcommand === 'show' && operands[1] === undefined;\n const product =\n subcommand === 'list' || overview\n ? ''\n : requireSlug(operands[1], 'product');\n const extra = operands.slice(subcommand === 'webhook' ? 3 : 2);\n const appEdits = subcommand === 'app' ? parseAppEdits(args.flags) : null;\n if (subcommand !== 'list' && extra.length > 0) {\n throw usageError(\n `Unexpected argument \"${extra[0]}\".`,\n 'See \"ekanos teams --help\".',\n );\n }\n\n if (\n appEdits?.prompts &&\n !canPrompt(ctx, args) &&\n !secretInputGiven(appEdits.secret)\n ) {\n throw usageError(\n \"teams app set needs the team's secrets, and there is no terminal to ask at. Non-secret fields can be passed with --set <name>=<value>.\",\n `Without a terminal, pass ${FIELD_SECRET_FORMS}. Or run it yourself in your terminal: ${cli()} teams app set ${team} ${product}${args.connection ? ` --connection ${args.connection}` : ''}${args.source ? ` --source ${args.source}` : ''}`,\n );\n }\n\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n const resolved = await resolveSourceTarget(env, requireSession(env), args);\n const client = new TeamsClient(env, resolved.session);\n const source = resolved.source;\n\n if (subcommand === 'list') {\n const list = await client.call((token) =>\n listTeams(env.host, token, source),\n );\n return ctx.succeed(\n { host: env.host, ...list },\n list.teams.length === 0\n ? ctx.ui.result({\n title: `No teams on ${list.source.slug}`,\n tone: 'warn',\n })\n : ctx.ui.result({\n title: `Teams on ${list.source.slug}`,\n rows: list.teams.map((entry) => [entry.slug, teamLine(entry)]),\n notes: [\n '\"ekanos teams show <team>\" shows a team\\'s setup; add a product for its checklist.',\n ...(list.teams.some(\n (entry) =>\n entry.callerIsMember === false && entry.memberCount > 0,\n )\n ? [\n 'You manage every team of the Source as its admin without being a member. To connect your own account to one, join it: \"ekanos teams members add <team> --self\".',\n ]\n : []),\n ],\n }),\n );\n }\n\n if (overview) {\n return runTeamOverview(ctx, client, env.host, source, team);\n }\n\n const target: Target = { source, team, product };\n const status = await client.call((token) =>\n showTeamIntegration(env.host, token, target),\n );\n\n if (subcommand === 'show') {\n return ctx.succeed(\n { host: env.host, ...status },\n checklist(status).join('\\n'),\n );\n }\n\n if (!status.enabled) {\n throw invalidStateError(\n `\"${product}\" is not enabled on ${status.source.slug}.`,\n `\"ekanos sources products --source ${status.source.slug}\" shows what it has; only Ekanos enables a product for a Source.`,\n );\n }\n\n if (subcommand === 'app' && appEdits) {\n return setApp(ctx, args, client, env.host, target, status, appEdits);\n }\n return mintWebhook(ctx, args, client, env.host, target, status, operands[2]);\n}\n\n/** What `teams app set` was asked to change, from its flags. */\ninterface AppEdits {\n /** `--field`: enter just these, at the terminal. */\n only: string[];\n /** `--set name=value`: non-secret values, no prompt. */\n values: Record<string, string>;\n /** `--clear name`: remove a saved value. */\n clear: string[];\n /** `--secret-*`, `--set-secret`, `--browser`: where secrets come from without a terminal. */\n secret: SecretFlags;\n /** Whether any field is collected (asked, or read from the secret-input flags). */\n prompts: boolean;\n}\n\nfunction parseAppEdits(flags: TeamsArgs['flags']): AppEdits {\n const list = (name: string): string[] => {\n const raw = flags?.[name];\n if (raw === undefined || raw === false) return [];\n if (Array.isArray(raw)) return raw;\n return typeof raw === 'string' ? [raw] : [];\n };\n const values = parsePlainValues(flags?.set);\n const only = list('field');\n const clear = list('clear');\n const secret = readSecretFlags(flags);\n return {\n only,\n values,\n clear,\n secret,\n // Bare `app set` walks every field; `--field` asks the named ones.\n prompts:\n only.length > 0 ||\n secretInputGiven(secret) ||\n (Object.keys(values).length === 0 && clear.length === 0),\n };\n}\n\nasync function setApp(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n target: Target,\n status: TeamIntegrationStatus,\n edits: AppEdits,\n): Promise<ExitCode> {\n const app = chooseApp(status, args.connection);\n const result = await promptAndSaveTeamApp(\n ctx,\n args,\n client,\n host,\n target,\n status,\n app,\n edits,\n );\n const missing = result.fields.filter((field) => !field.set);\n const next = [\n ...(missing.length > 0\n ? [\n `Still not set: ${missing.map((field) => field.label).join(', ')} — a team member can't connect until it is. Run \"ekanos teams app set ${target.team} ${target.product} ${missing.map((field) => `--field ${field.secretName}`).join(' ')}\".`,\n ]\n : []),\n ...nextSteps(status, app, target),\n ];\n return ctx.succeed(\n { host, ...result },\n ctx.ui.result({\n title: `Saved ${target.team}'s ${result.product.name} app`,\n rows: [\n ['Source', status.source.slug],\n ['Fields', result.fields.map(fieldLine)],\n ],\n notes: next,\n }),\n );\n}\n\n/**\n * Every field, in turn: bare `teams app set`, and `teams connect` — whose\n * `--set` and secret-input flags fill the team's app too.\n */\nfunction walkEveryField(flags: TeamsArgs['flags']): AppEdits {\n return {\n only: [],\n values: parsePlainValues(flags?.set),\n clear: [],\n secret: readSecretFlags(flags),\n prompts: true,\n };\n}\n\n/**\n * The `teams app set` walkthrough and prompts for one team app, then the\n * save — of only what was entered: a field left empty keeps its saved value.\n * Shared with `teams connect`, which runs it inline when the integration\n * needs the team's own app (Zendesk) before anyone can sign in.\n */\nexport async function promptAndSaveTeamApp(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n target: Target,\n status: TeamIntegrationStatus,\n app: TeamAppState,\n edits: AppEdits = walkEveryField(args.flags),\n) {\n const known = new Map(app.fields.map((field) => [field.secretName, field]));\n const names = app.fields.map((field) => field.secretName).join(', ');\n for (const name of [\n ...edits.only,\n ...Object.keys(edits.values),\n ...edits.clear,\n ]) {\n if (!known.has(name)) {\n throw usageError(\n `${status.product.name}'s team app has no field \"${name}\".`,\n `Its fields are: ${names}.`,\n );\n }\n }\n for (const name of Object.keys(edits.values)) {\n if (known.get(name)?.sensitive) {\n throw usageError(\n `\"${name}\" is a secret: it is never passed as an argument.`,\n `Pass it as --set-secret ${name}=env:<NAME>|file:<path>|stdin, use --browser, or enter it at the prompt: ekanos teams app set ${target.team} ${target.product} --field ${name}`,\n );\n }\n }\n\n const fields: Record<string, string> = { ...edits.values };\n if (edits.prompts) {\n const toAsk =\n edits.only.length > 0\n ? app.fields.filter((field) => edits.only.includes(field.secretName))\n : app.fields;\n if (edits.only.length === 0)\n ctx.log(appWalkthrough(status, app).join('\\n'));\n else {\n ctx.log(\n `${status.product.name} app for team ${target.team} on ${status.source.slug}`,\n );\n }\n const byName = new Map(toAsk.map((field) => [field.secretName, field]));\n const again = `teams app set ${target.team} ${target.product}${args.connection ? ` --connection ${args.connection}` : ''} --source ${status.source.slug}`;\n Object.assign(\n fields,\n await collectSecrets(ctx, {\n fields: toAsk\n .filter((field) => edits.values[field.secretName] === undefined)\n .map((field) => ({\n name: field.secretName,\n label: field.label,\n sensitive: field.sensitive,\n set: field.set,\n value: field.sensitive ? null : field.value,\n })),\n flags: edits.secret,\n io: teamsSecretIO(args),\n interactive: canPrompt(ctx, args),\n title: `${status.product.name} app for team ${target.team}`,\n refusal: `${status.product.name}'s team app takes secrets (${toAsk\n .filter((field) => field.sensitive)\n .map((field) => field.secretName)\n .join(', ')}), and there is no terminal to ask at.`,\n again,\n prompt: (spec) => {\n const field = byName.get(spec.name)!;\n return (\n field.sensitive\n ? (args.askSecret ?? promptHidden)\n : (args.ask ?? promptLine)\n )(fieldQuestion(field));\n },\n }),\n );\n }\n\n if (Object.keys(fields).length === 0 && edits.clear.length === 0) {\n throw validationError(\n 'Nothing was changed.',\n `Run \"ekanos teams show ${target.team} ${target.product}\" to see the current state.`,\n );\n }\n\n return client.call((token) =>\n setTeamApp(host, token, target, {\n connectionId: app.connectionId,\n fields,\n ...(edits.clear.length > 0 ? { clear: edits.clear } : {}),\n }),\n );\n}\n\n/** The prompt for one field: what is saved, and that Enter keeps it. */\nfunction fieldQuestion(field: TeamAppState['fields'][number]): string {\n const name = `${field.label} [${field.secretName}]`;\n if (field.sensitive) {\n return field.set\n ? `${name} (saved — Enter to keep, hidden): `\n : `${name} (hidden): `;\n }\n if (field.set) {\n return field.value\n ? `${name} (current: ${field.value} — Enter to keep): `\n : `${name} (saved — Enter to keep): `;\n }\n return `${name}: `;\n}\n\n/** One field's state: a secret only as saved / not set, never its value. */\nfunction fieldLine(field: TeamAppState['fields'][number]): string {\n const state = !field.set\n ? 'not set'\n : field.sensitive\n ? 'saved'\n : field.value\n ? field.value\n : 'saved';\n return `${mark(field.set)} ${field.label} (${field.secretName}): ${state}`;\n}\n\nasync function mintWebhook(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n target: Target,\n status: TeamIntegrationStatus,\n requested: string | undefined,\n): Promise<ExitCode> {\n const webhooks = status.teamApps.flatMap((app) => app.webhooks);\n if (webhooks.length === 0) {\n throw invalidStateError(\n `${status.product.name} has no webhook a team's app sends.`,\n `Run \"ekanos teams show ${target.team} ${target.product}\" to see its setup.`,\n );\n }\n const webhook = requested\n ? webhooks.find((entry) => entry.webhookId === requested)\n : webhooks.length === 1\n ? webhooks[0]\n : undefined;\n if (!webhook) {\n throw usageError(\n requested\n ? `${status.product.name} has no team-app webhook \"${requested}\".`\n : `${status.product.name} has several webhooks; name one.`,\n `Run one of: ${webhooks.map((entry) => `ekanos teams webhook ${target.team} ${target.product} ${entry.webhookId}`).join(', ')}.`,\n );\n }\n\n if (webhook.endpoint && !args.yes) {\n throw invalidStateError(\n `${target.team} already has a live URL for ${webhook.webhookId} (${webhook.endpoint.tokenPrefix}…). A new one revokes it, and the provider's webhook stops working until you paste the new URL there.`,\n `Re-run with --yes when you are ready to update the provider: ekanos teams webhook ${target.team} ${target.product} ${webhook.webhookId} --yes`,\n );\n }\n\n // The URL carries its token, so it goes to a 0600 file, never the output.\n const secrets = ensureSecretsDir(args.env);\n const minted = await client.call((token) =>\n mintTeamWebhook(host, token, target, webhook.webhookId),\n );\n const { url, ...rest } = minted;\n const secretFile = writeSecretFile(secrets, {\n owner: target.team,\n what: `${target.product}-${webhook.webhookId}-webhook-url`,\n purpose: `Webhook URL for team ${target.team}'s ${status.product.name} (${webhook.webhookId}). Paste it into ${status.product.name}'s webhook settings for this team; the token is part of the URL.`,\n values: [['WEBHOOK_URL', url]],\n again: `ekanos teams webhook ${target.team} ${target.product} ${webhook.webhookId} --yes`,\n });\n return ctx.succeed(\n { host, ...rest, secretFile },\n ctx.ui.result({\n title: `Webhook URL for ${target.team} · ${webhook.webhookId}`,\n tone: 'warn',\n rows: [\n ['URL', `saved to ${secretFile} (readable only by you)`],\n [\n 'Paste it into',\n `${status.product.name}'s webhook settings for this team`,\n ],\n ],\n notes: [\n 'The URL carries its token, so it is shown nowhere else and cannot be read again. Copy it from that file into the provider yourself — not into a chat or an agent session — then delete the file.',\n ...(minted.replaced\n ? ['The previous URL is revoked: the provider must use this one.']\n : []),\n ],\n }),\n );\n}\n\n/** `teams show`, read top to bottom like a setup checklist. */\nexport function checklist(status: TeamIntegrationStatus): string[] {\n const name = status.product.name;\n const lines = [\n `${name} for team ${status.team.slug} (${status.team.name}) on ${status.source.slug}`,\n ` ${mark(status.enabled)} Enabled on the Source`,\n ];\n if (!status.enabled) {\n lines.push(\n ` \"ekanos sources products --source ${status.source.slug}\" shows what it has; only Ekanos enables a product for a Source.`,\n );\n return lines;\n }\n\n const target = { team: status.team.slug, product: status.product.slug };\n lines.push(\n ...scopeHiddenLines(status.scope, {\n ...target,\n source: status.source.slug,\n }).map((line) => ` ${line}`),\n );\n lines.push(...connectionLines(status));\n for (const app of status.teamApps) {\n lines.push(` Team app: ${app.label} (${app.connectionId})`);\n if (app.setup?.consoleUrl) lines.push(` Open: ${app.setup.consoleUrl}`);\n app.setup?.steps.forEach((step, index) =>\n lines.push(` ${index + 1}. ${step}`),\n );\n lines.push(' Callback URLs to register:');\n lines.push(...callbackUrls(app).map((url) => ` ${url}`));\n if (app.guideUrl) lines.push(` Guide: ${app.guideUrl}`);\n for (const field of app.fields) {\n lines.push(` ${fieldLine(field)}`);\n }\n const unset = app.fields.filter((field) => !field.set);\n if (unset.length > 0) {\n lines.push(\n ` → in your terminal: ${cli()} teams app set ${target.team} ${target.product} --connection ${app.connectionId} ${unset.map((field) => `--field ${field.secretName}`).join(' ')} --source ${status.source.slug}`,\n );\n }\n for (const webhook of app.webhooks) {\n lines.push(\n webhook.endpoint\n ? ` ${mark(true)} Webhook ${webhook.webhookId}: live URL ${webhook.endpoint.tokenPrefix}… since ${day(webhook.endpoint.createdAt)}${webhook.endpoint.lastUsedAt ? `, last delivery ${day(webhook.endpoint.lastUsedAt)}` : ', no delivery yet'}`\n : ` ${mark(false)} Webhook ${webhook.webhookId}: no URL yet`,\n );\n if (!webhook.endpoint) {\n lines.push(\n ` → ekanos teams webhook ${target.team} ${target.product} ${webhook.webhookId} --source ${status.source.slug}`,\n );\n }\n }\n lines.push(\n app.connection\n ? ` ${mark(true)} Connected ${day(app.connection.connectedAt)}${app.connection.connectedBy ? ` by ${who(app.connection.connectedBy)}` : ''}`\n : ` ${mark(false)} Connected: not yet\\n → in your terminal: ${connectCommand(status, app.connectionId)}`,\n );\n }\n\n lines.push(\n status.activation\n ? ` ${mark(true)} Activated for the team${status.activation.activatedAt ? ` ${day(status.activation.activatedAt)}` : ''}${status.activation.activatedBy ? ` by ${who(status.activation.activatedBy)}` : ''}`\n : ` ${mark(false)} Activated: not yet\\n → in your terminal: ${connectCommand(status)}`,\n );\n lines.push(` Team page: ${status.connectUrl}`);\n if (status.agentEvents.length > 0) {\n lines.push(' Agent events it offers:');\n lines.push(\n ...status.agentEvents.map((event) => ` ${event.id} — ${event.label}`),\n );\n }\n return lines;\n}\n\n/**\n * Each OAuth connection in one line — connected, or installed for a named\n * one, with its app's credentials and webhook URL — and which of the team's\n * agents wait on it. A named connection an agent's trigger needs and the team\n * has not installed is the gap no other line names: the trigger is stored\n * and on, and nothing ever reaches it.\n */\nfunction connectionLines(status: TeamIntegrationStatus): string[] {\n const connections = status.connections ?? [];\n if (connections.length === 0) return [];\n const lines = [' Connections:'];\n for (const entry of connections) {\n const named = entry.connectionId !== 'default';\n const app = status.teamApps.find(\n (candidate) => candidate.connectionId === entry.connectionId,\n );\n const webhooks = app?.webhooks ?? [];\n const steps = [\n ...(entry.credentialsSaved === null\n ? []\n : [\n `app credentials ${entry.credentialsSaved ? 'saved' : 'not saved'}`,\n ]),\n named\n ? entry.connected\n ? `installed ${day(entry.connectedAt ?? '')}`\n : 'not installed'\n : entry.connected\n ? `connected ${day(entry.connectedAt ?? '')}`\n : 'not connected',\n ...(webhooks.length > 0\n ? [\n webhooks.every((webhook) => webhook.endpoint)\n ? 'webhook URL made'\n : 'no webhook URL',\n ]\n : []),\n ];\n const ready =\n entry.connected &&\n entry.credentialsSaved !== false &&\n webhooks.every((webhook) => webhook.endpoint);\n lines.push(\n ` ${mark(ready)} ${entry.label} (${entry.connectionId}): ${steps.join(' · ')}${entry.connectedBy ? ` by ${who(entry.connectedBy)}` : ''}`,\n );\n if (entry.neededBy.length > 0) {\n lines.push(\n ` Needed by: ${entry.neededBy.map((need) => `${need.agent} (${need.triggers.join(', ')})`).join(', ')}`,\n );\n }\n if (!entry.connected) {\n lines.push(\n ` → in your terminal: ${connectCommand(status, entry.connectionId)}`,\n );\n }\n }\n return lines;\n}\n\n/**\n * One team in `teams list`: its members, and whether the caller is one. A\n * team nobody has joined says so with the command that joins it, rather than\n * reading as a count of zero.\n */\nexport function teamLine(entry: {\n slug: string;\n name: string;\n memberCount: number;\n callerIsMember?: boolean;\n}): string {\n const count = `${entry.memberCount} member${entry.memberCount === 1 ? '' : 's'}`;\n if (entry.callerIsMember === undefined) return `${entry.name} · ${count}`;\n if (entry.callerIsMember) return `${entry.name} · ${count}, you among them`;\n return entry.memberCount === 0\n ? `${entry.name} · 0 members · you are not a member — ekanos teams members add ${entry.slug} --self`\n : `${entry.name} · ${count} · you are not a member`;\n}\n\n/** The command that connects the team, for a hint: `--connection` only for a named one. */\nfunction connectCommand(\n status: TeamIntegrationStatus,\n connectionId = 'default',\n): string {\n return `${cli()} teams connect ${status.team.slug} ${status.product.slug}${connectionId === 'default' ? '' : ` --connection ${connectionId}`} --source ${status.source.slug}`;\n}\n\nfunction appWalkthrough(\n status: TeamIntegrationStatus,\n app: TeamAppState,\n): string[] {\n const lines = [\n `${status.product.name} app for team ${status.team.slug} on ${status.source.slug}`,\n ];\n if (app.setup?.consoleUrl) lines.push(` Open: ${app.setup.consoleUrl}`);\n const steps = app.setup?.steps.length\n ? [...app.setup.steps]\n : [\n `In ${status.product.name}, create an OAuth app for the team (or open the one it uses).`,\n ];\n steps.push(\n `Check the app lists exactly: ${callbackUrls(app).join(', ')}`,\n \"Enter its values below. Secrets are stored in Ekanos's vault and never shown again.\",\n );\n lines.push(...steps.map((step, index) => ` ${index + 1}. ${step}`));\n if (app.guideUrl) lines.push(` Guide: ${app.guideUrl}`);\n return lines;\n}\n\nfunction nextSteps(\n status: TeamIntegrationStatus,\n app: TeamAppState,\n target: Target,\n): string[] {\n return [\n ...app.webhooks\n .filter((webhook) => !webhook.endpoint)\n .map(\n (webhook) =>\n `Next: \"ekanos teams webhook ${target.team} ${target.product} ${webhook.webhookId}\" for the provider's webhook URL.`,\n ),\n ...(app.connection\n ? []\n : [`Then connect it: ${connectCommand(status, app.connectionId)}`]),\n ];\n}\n\nexport function chooseApp(\n status: TeamIntegrationStatus,\n connection: string | undefined,\n): TeamAppState {\n const apps = status.teamApps;\n if (apps.length === 0) {\n throw invalidStateError(\n `${status.product.name} takes no team app: teams connect through the Source's app, or need none.`,\n `Run \"ekanos apps show ${status.product.slug}\" for the Source's app.`,\n );\n }\n const app = connection\n ? apps.find((entry) => entry.connectionId === connection)\n : apps.length === 1\n ? apps[0]\n : apps.find((entry) => entry.connectionId === 'default');\n if (app) return app;\n throw usageError(\n connection\n ? `${status.product.name} has no team app \"${connection}\".`\n : `${status.product.name} has several team apps; name one.`,\n `Pass --connection with one of: ${apps.map((entry) => entry.connectionId).join(', ')}.`,\n );\n}\n\nexport class TeamsClient {\n constructor(\n private readonly env: AuthEnvironment,\n private session: StoredSession,\n ) {}\n\n async call<T>(\n send: (accessToken: string) => Promise<TeamsApiResult<T>>,\n ): Promise<T> {\n let result = await send(this.session.accessToken);\n if (result.status === 'unauthorized') {\n this.session = await refreshStoredSession(this.env, this.session);\n result = await send(this.session.accessToken);\n }\n if (result.status === 'ok') return result.data;\n throw authRequiredError(\n `The session for ${this.env.host} could not authorize the teams call.`,\n loginHint(this.env),\n );\n }\n}\n\nexport function canPrompt(ctx: CliContext, args: TeamsArgs): boolean {\n return !ctx.jsonMode && (args.stdinIsTTY ?? process.stdin.isTTY === true);\n}\n\n/** What the secret-input flags read from, with this run's test seams. */\nexport function teamsSecretIO(args: TeamsArgs): SecretIO {\n return {\n env: args.env,\n stdinIsTTY: args.stdinIsTTY ?? process.stdin.isTTY === true,\n readStdin: args.readStdin,\n openUrl: args.openUrl,\n formTimeoutMs: args.secretFormTimeoutMs,\n };\n}\n\nfunction parseSubcommand(value: string | undefined): TeamsSubcommand {\n const match = TEAMS_SUBCOMMANDS.find((name) => name === value);\n if (match) return match;\n throw usageError(\n value\n ? `Unknown teams subcommand \"${value}\".`\n : 'teams needs a subcommand.',\n 'Run one of: ekanos teams list, ekanos teams create <name>, ekanos teams rename <team> <name>, ekanos teams members list|add|invite|role|remove|resend <team> … (add <team> --self joins you), ekanos teams roles list <team>, ekanos teams leave <team> --yes, ekanos teams groups list|create|update|delete|members <team> …, ekanos teams health <team> [<product>] [--run] (<product> --mine: your own personal connection), ekanos teams workspace list|default <team> …, ekanos teams connect <team> <product>, ekanos teams disconnect <team> <product> --yes (--mine: your own personal connection), ekanos teams show <team> [<product>], ekanos teams app set <team> <product>, ekanos teams webhook <team> <product> [<webhook-id>], ekanos teams events <team> [<product>], ekanos teams audience <team> [<audience>] [--member <email>], ekanos teams scope show|set <team> … (deprecated: audiences), ekanos teams agents|triggers|links|mcp|llm-key ….',\n );\n}\n\nfunction requireSlug(value: string | undefined, what: 'team' | 'product') {\n const slug = value?.trim().toLowerCase();\n if (slug && /^[a-z0-9][a-z0-9-]*$/.test(slug)) return slug;\n throw usageError(\n value ? `\"${value}\" is not a ${what} slug.` : `Name the ${what}.`,\n what === 'team'\n ? '\"ekanos teams list\" lists the teams, e.g. \"ekanos teams show acme-support zendesk\".'\n : '\"ekanos catalog\" lists the products, e.g. \"ekanos teams show acme-support zendesk\".',\n );\n}\n\nfunction mark(done: boolean): string {\n return done ? '✓' : '✗';\n}\n\nfunction day(iso: string): string {\n return iso.slice(0, 10);\n}\n\nfunction who(member: {\n name: string | null;\n email: string | null;\n userId: string;\n}) {\n return member.email ?? member.name ?? member.userId;\n}\n\n/** Every redirect URI to register. */\nfunction callbackUrls(app: TeamAppState): string[] {\n return app.callbackUrls.length ? app.callbackUrls : [app.callbackUrl];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"teams.js","sourceRoot":"","sources":["../../src/commands/teams.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAEL,oBAAoB,EACpB,cAAc,EACd,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,eAAe,GAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EACL,kBAAkB,EAGlB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAEL,SAAS,EACT,eAAe,EACf,UAAU,EACV,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,UAAU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CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EACtC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,EAAE,CAAC;QAChC,MAAM,UAAU,CACd,IAAI,KAAK,0BAA0B,EACnC,GAAG,kBAAkB,+BAA+B,CACrD,CAAC;IACJ,CAAC;IACD,MAAM,UAAU,CACd,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,cAAc,IAAI,QAAQ,CAAC,CAAC,CAAC,YAAY,IAAI,GAAG,EACjE,IAAI,KAAK,MAAM;QACb,CAAC,CAAC,qFAAqF;QACvF,CAAC,CAAC,qFAAqF,CAC1F,CAAC;AACJ,CAAC;AAED,SAAS,IAAI,CAAC,IAAa;IACzB,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC1B,CAAC;AAED,SAAS,GAAG,CAAC,GAAW;IACtB,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,GAAG,CAAC,MAIZ;;IACC,mBAAO,MAAM,CAAC,KAAK,mCAAI,MAAM,CAAC,IAAI,mCAAI,MAAM,CAAC,MAAM,CAAC;AACtD,CAAC;AAED,sCAAsC;AACtC,SAAS,YAAY,CAAC,GAAiB;IACrC,OAAO,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import type {\n TeamAppState,\n TeamIntegrationStatus,\n} from '@ekanos/integration-schema';\n\nimport type { StoredSession } from '../auth/credential-store';\nimport { loginHint } from '../auth/host-trust';\nimport {\n type AuthEnvironment,\n refreshStoredSession,\n requireSession,\n resolveAuthEnvironment,\n} from '../auth/session';\nimport type { CliContext } from '../context';\nimport {\n authRequiredError,\n invalidStateError,\n usageError,\n validationError,\n} from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport { cli } from '../invocation';\nimport { PRODUCT_SLUG_SHAPE, isProductSlug } from '../product-slug';\nimport { ensureSecretsDir, writeSecretFile } from '../secret-file';\nimport {\n FIELD_SECRET_FORMS,\n type SecretFlags,\n type SecretIO,\n collectSecrets,\n parsePlainValues,\n readSecretFlags,\n secretInputGiven,\n} from '../secret-input';\nimport { resolveSourceTarget } from '../source-target';\nimport {\n type TeamsApiResult,\n listTeams,\n mintTeamWebhook,\n setTeamApp,\n showTeamIntegration,\n} from '../teams-api';\nimport { promptHidden, promptLine } from './apps';\nimport { scopeHiddenLines } from './scope-notice';\nimport { isTeamAgentArea, runTeamAgentCommands } from './team-agents';\nimport { runTeamAudience } from './teams-audience';\nimport { runTeamEvents } from './teams-events';\nimport {\n LIFECYCLE_SUBCOMMANDS,\n isLifecycleMemberVerb,\n isLifecycleSubcommand,\n parseLifecycle,\n runLifecycle,\n} from './teams-lifecycle';\nimport {\n ONBOARDING_SUBCOMMANDS,\n isOnboardingSubcommand,\n parseOnboarding,\n runOnboarding,\n} from './teams-onboard';\nimport { runTeamOverview } from './teams-overview';\nimport { runTeamScope } from './teams-scope';\n\nexport const TEAMS_SUBCOMMANDS = [\n 'list',\n 'show',\n 'app',\n 'webhook',\n 'events',\n 'scope',\n 'audience',\n ...ONBOARDING_SUBCOMMANDS,\n ...LIFECYCLE_SUBCOMMANDS,\n] as const;\ntype TeamsSubcommand = (typeof TEAMS_SUBCOMMANDS)[number];\n\nexport interface TeamsArgs {\n host?: string;\n source?: string;\n /** `list`, `show <team> [<product>]`, `app set <team> <product>`, `webhook <team> <product> [<id>]`. */\n positionals: readonly string[];\n connection?: string;\n /** `create --slug`, `create --owner <email>`, `members invite --role`. */\n slug?: string;\n owner?: string;\n role?: string;\n yes: boolean;\n /** `connect --no-wait`: print the sign-in link and return without polling. */\n noWait?: boolean;\n /** `connect --no-open`: never open a browser, only print the link. */\n noOpen?: boolean;\n /** `connect --link-only`: print the team's page, as before connect did the work. */\n linkOnly?: boolean;\n /** `connect --reconnect`: connect again though it reads as connected. */\n reconnect?: boolean;\n /** Test seams for `connect`: the wait between polls, and the browser opener. */\n pollDelayMs?: number;\n openUrl?: (url: string) => void;\n /** Every parsed flag, for `teams agents|triggers|links|mcp` (team-agents.ts). */\n flags?: Record<string, string | boolean | string[]>;\n dir: string;\n env: Record<string, string | undefined>;\n stdinIsTTY?: boolean;\n /** Test seams for the questions `app set` asks. */\n ask?: (question: string) => Promise<string>;\n askSecret?: (question: string) => Promise<string>;\n /** Test seams for the secret-input flags (`secret-input.ts`). */\n readStdin?: () => Promise<string>;\n secretFormTimeoutMs?: number;\n}\n\nexport interface Target {\n source: string;\n team: string;\n product: string;\n}\n\n/**\n * `teams` — a Source admin's view of its teams' integration setup, the\n * team-level counterpart of `apps`. `list` names the teams; `show` reads one\n * team's setup of one product as a checklist; `app set` enters or updates\n * any of a team's own app fields (Zendesk's subdomain, client and signing\n * secret), one at a time if need be — a field left alone keeps its saved\n * value. A secret is typed at the admin's terminal with hidden input or,\n * without one, read from the environment, a private file, stdin or a form\n * in the browser (`secret-input.ts`) — never a value in argv; a non-secret\n * field may be passed as `--set name=value`; `webhook` mints the URL the\n * team's provider sends to, shown once.\n */\nexport async function runTeams(\n ctx: CliContext,\n args: TeamsArgs,\n): Promise<ExitCode> {\n const [rawSubcommand, ...rest] = args.positionals;\n if (isTeamAgentArea(rawSubcommand)) {\n return runTeamAgentCommands(ctx, args);\n }\n const subcommand = parseSubcommand(rawSubcommand);\n\n if (subcommand === 'events') {\n return runTeamEvents(ctx, args, rest);\n }\n if (subcommand === 'scope') {\n return runTeamScope(ctx, args, rest);\n }\n if (subcommand === 'audience') {\n return runTeamAudience(ctx, args, rest);\n }\n\n if (\n isLifecycleSubcommand(subcommand) ||\n (subcommand === 'members' && isLifecycleMemberVerb(rest[0]))\n ) {\n return runLifecycle(ctx, args, parseLifecycle(subcommand, rest, args));\n }\n\n if (isOnboardingSubcommand(subcommand)) {\n const plan = parseOnboarding(subcommand, rest, {\n ...args,\n as: typeof args.flags?.as === 'string' ? args.flags.as : undefined,\n self: args.flags?.self === true,\n mine: args.flags?.mine === true,\n });\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n const resolved = await resolveSourceTarget(env, requireSession(env), args);\n return runOnboarding(\n ctx,\n args,\n new TeamsClient(env, resolved.session),\n env.host,\n resolved.source,\n plan,\n );\n }\n\n if (subcommand === 'app' && rest[0] !== 'set') {\n throw usageError(\n rest[0]\n ? `Unknown teams app subcommand \"${rest[0]}\".`\n : 'teams app needs a subcommand.',\n 'Run \"ekanos teams app set <team> <product>\".',\n );\n }\n const operands = subcommand === 'app' ? rest.slice(1) : rest;\n\n if (subcommand === 'list' && operands.length > 0) {\n throw usageError(\n 'teams list takes no arguments.',\n 'Run \"ekanos teams list --source <slug>\".',\n );\n }\n\n const team = subcommand === 'list' ? '' : requireSlug(operands[0], 'team');\n // `teams show <team>` alone is the team's overview.\n const overview = subcommand === 'show' && operands[1] === undefined;\n const product =\n subcommand === 'list' || overview\n ? ''\n : requireSlug(operands[1], 'product');\n const extra = operands.slice(subcommand === 'webhook' ? 3 : 2);\n const appEdits = subcommand === 'app' ? parseAppEdits(args.flags) : null;\n if (subcommand !== 'list' && extra.length > 0) {\n throw usageError(\n `Unexpected argument \"${extra[0]}\".`,\n 'See \"ekanos teams --help\".',\n );\n }\n\n if (\n appEdits?.prompts &&\n !canPrompt(ctx, args) &&\n !secretInputGiven(appEdits.secret)\n ) {\n throw usageError(\n \"teams app set needs the team's secrets, and there is no terminal to ask at. Non-secret fields can be passed with --set <name>=<value>.\",\n `Without a terminal, pass ${FIELD_SECRET_FORMS}. Or run it yourself in your terminal: ${cli()} teams app set ${team} ${product}${args.connection ? ` --connection ${args.connection}` : ''}${args.source ? ` --source ${args.source}` : ''}`,\n );\n }\n\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n const resolved = await resolveSourceTarget(env, requireSession(env), args);\n const client = new TeamsClient(env, resolved.session);\n const source = resolved.source;\n\n if (subcommand === 'list') {\n const list = await client.call((token) =>\n listTeams(env.host, token, source),\n );\n return ctx.succeed(\n { host: env.host, ...list },\n list.teams.length === 0\n ? ctx.ui.result({\n title: `No teams on ${list.source.slug}`,\n tone: 'warn',\n })\n : ctx.ui.result({\n title: `Teams on ${list.source.slug}`,\n rows: list.teams.map((entry) => [entry.slug, teamLine(entry)]),\n notes: [\n '\"ekanos teams show <team>\" shows a team\\'s setup; add a product for its checklist.',\n ...(list.teams.some(\n (entry) =>\n entry.callerIsMember === false && entry.memberCount > 0,\n )\n ? [\n 'You manage every team of the Source as its admin without being a member. To connect your own account to one, join it: \"ekanos teams members add <team> --self\".',\n ]\n : []),\n ],\n }),\n );\n }\n\n if (overview) {\n return runTeamOverview(ctx, client, env.host, source, team);\n }\n\n const target: Target = { source, team, product };\n const status = await client.call((token) =>\n showTeamIntegration(env.host, token, target),\n );\n\n if (subcommand === 'show') {\n return ctx.succeed(\n { host: env.host, ...status },\n checklist(status).join('\\n'),\n );\n }\n\n if (!status.enabled) {\n throw invalidStateError(\n `\"${product}\" is not enabled on ${status.source.slug}.`,\n `\"ekanos sources products --source ${status.source.slug}\" shows what it has; only Ekanos enables a product for a Source.`,\n );\n }\n\n if (subcommand === 'app' && appEdits) {\n return setApp(ctx, args, client, env.host, target, status, appEdits);\n }\n return mintWebhook(ctx, args, client, env.host, target, status, operands[2]);\n}\n\n/** What `teams app set` was asked to change, from its flags. */\ninterface AppEdits {\n /** `--field`: enter just these, at the terminal. */\n only: string[];\n /** `--set name=value`: non-secret values, no prompt. */\n values: Record<string, string>;\n /** `--clear name`: remove a saved value. */\n clear: string[];\n /** `--secret-*`, `--set-secret`, `--browser`: where secrets come from without a terminal. */\n secret: SecretFlags;\n /** Whether any field is collected (asked, or read from the secret-input flags). */\n prompts: boolean;\n}\n\nfunction parseAppEdits(flags: TeamsArgs['flags']): AppEdits {\n const list = (name: string): string[] => {\n const raw = flags?.[name];\n if (raw === undefined || raw === false) return [];\n if (Array.isArray(raw)) return raw;\n return typeof raw === 'string' ? [raw] : [];\n };\n const values = parsePlainValues(flags?.set);\n const only = list('field');\n const clear = list('clear');\n const secret = readSecretFlags(flags);\n return {\n only,\n values,\n clear,\n secret,\n // Bare `app set` walks every field; `--field` asks the named ones.\n prompts:\n only.length > 0 ||\n secretInputGiven(secret) ||\n (Object.keys(values).length === 0 && clear.length === 0),\n };\n}\n\nasync function setApp(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n target: Target,\n status: TeamIntegrationStatus,\n edits: AppEdits,\n): Promise<ExitCode> {\n const app = chooseApp(status, args.connection);\n const result = await promptAndSaveTeamApp(\n ctx,\n args,\n client,\n host,\n target,\n status,\n app,\n edits,\n );\n const missing = result.fields.filter((field) => !field.set);\n const next = [\n ...(missing.length > 0\n ? [\n `Still not set: ${missing.map((field) => field.label).join(', ')} — a team member can't connect until it is. Run \"ekanos teams app set ${target.team} ${target.product} ${missing.map((field) => `--field ${field.secretName}`).join(' ')}\".`,\n ]\n : []),\n ...nextSteps(status, app, target),\n ];\n return ctx.succeed(\n { host, ...result },\n ctx.ui.result({\n title: `Saved ${target.team}'s ${result.product.name} app`,\n rows: [\n ['Source', status.source.slug],\n ['Fields', result.fields.map(fieldLine)],\n ],\n notes: next,\n }),\n );\n}\n\n/**\n * Every field, in turn: bare `teams app set`, and `teams connect` — whose\n * `--set` and secret-input flags fill the team's app too.\n */\nfunction walkEveryField(flags: TeamsArgs['flags']): AppEdits {\n return {\n only: [],\n values: parsePlainValues(flags?.set),\n clear: [],\n secret: readSecretFlags(flags),\n prompts: true,\n };\n}\n\n/**\n * The `teams app set` walkthrough and prompts for one team app, then the\n * save — of only what was entered: a field left empty keeps its saved value.\n * Shared with `teams connect`, which runs it inline when the integration\n * needs the team's own app (Zendesk) before anyone can sign in.\n */\nexport async function promptAndSaveTeamApp(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n target: Target,\n status: TeamIntegrationStatus,\n app: TeamAppState,\n edits: AppEdits = walkEveryField(args.flags),\n) {\n const known = new Map(app.fields.map((field) => [field.secretName, field]));\n const names = app.fields.map((field) => field.secretName).join(', ');\n for (const name of [\n ...edits.only,\n ...Object.keys(edits.values),\n ...edits.clear,\n ]) {\n if (!known.has(name)) {\n throw usageError(\n `${status.product.name}'s team app has no field \"${name}\".`,\n `Its fields are: ${names}.`,\n );\n }\n }\n for (const name of Object.keys(edits.values)) {\n if (known.get(name)?.sensitive) {\n throw usageError(\n `\"${name}\" is a secret: it is never passed as an argument.`,\n `Pass it as --set-secret ${name}=env:<NAME>|file:<path>|stdin, use --browser, or enter it at the prompt: ekanos teams app set ${target.team} ${target.product} --field ${name}`,\n );\n }\n }\n\n const fields: Record<string, string> = { ...edits.values };\n if (edits.prompts) {\n const toAsk =\n edits.only.length > 0\n ? app.fields.filter((field) => edits.only.includes(field.secretName))\n : app.fields;\n if (edits.only.length === 0)\n ctx.log(appWalkthrough(status, app).join('\\n'));\n else {\n ctx.log(\n `${status.product.name} app for team ${target.team} on ${status.source.slug}`,\n );\n }\n const byName = new Map(toAsk.map((field) => [field.secretName, field]));\n const again = `teams app set ${target.team} ${target.product}${args.connection ? ` --connection ${args.connection}` : ''} --source ${status.source.slug}`;\n Object.assign(\n fields,\n await collectSecrets(ctx, {\n fields: toAsk\n .filter((field) => edits.values[field.secretName] === undefined)\n .map((field) => ({\n name: field.secretName,\n label: field.label,\n sensitive: field.sensitive,\n set: field.set,\n value: field.sensitive ? null : field.value,\n })),\n flags: edits.secret,\n io: teamsSecretIO(args),\n interactive: canPrompt(ctx, args),\n title: `${status.product.name} app for team ${target.team}`,\n refusal: `${status.product.name}'s team app takes secrets (${toAsk\n .filter((field) => field.sensitive)\n .map((field) => field.secretName)\n .join(', ')}), and there is no terminal to ask at.`,\n again,\n prompt: (spec) => {\n const field = byName.get(spec.name)!;\n return (\n field.sensitive\n ? (args.askSecret ?? promptHidden)\n : (args.ask ?? promptLine)\n )(fieldQuestion(field));\n },\n }),\n );\n }\n\n if (Object.keys(fields).length === 0 && edits.clear.length === 0) {\n throw validationError(\n 'Nothing was changed.',\n `Run \"ekanos teams show ${target.team} ${target.product}\" to see the current state.`,\n );\n }\n\n return client.call((token) =>\n setTeamApp(host, token, target, {\n connectionId: app.connectionId,\n fields,\n ...(edits.clear.length > 0 ? { clear: edits.clear } : {}),\n }),\n );\n}\n\n/** The prompt for one field: what is saved, and that Enter keeps it. */\nfunction fieldQuestion(field: TeamAppState['fields'][number]): string {\n const name = `${field.label} [${field.secretName}]`;\n if (field.sensitive) {\n return field.set\n ? `${name} (saved — Enter to keep, hidden): `\n : `${name} (hidden): `;\n }\n if (field.set) {\n return field.value\n ? `${name} (current: ${field.value} — Enter to keep): `\n : `${name} (saved — Enter to keep): `;\n }\n return `${name}: `;\n}\n\n/** One field's state: a secret only as saved / not set, never its value. */\nfunction fieldLine(field: TeamAppState['fields'][number]): string {\n const state = !field.set\n ? 'not set'\n : field.sensitive\n ? 'saved'\n : field.value\n ? field.value\n : 'saved';\n return `${mark(field.set)} ${field.label} (${field.secretName}): ${state}`;\n}\n\nasync function mintWebhook(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n target: Target,\n status: TeamIntegrationStatus,\n requested: string | undefined,\n): Promise<ExitCode> {\n const webhooks = status.teamApps.flatMap((app) => app.webhooks);\n if (webhooks.length === 0) {\n throw invalidStateError(\n `${status.product.name} has no webhook a team's app sends.`,\n `Run \"ekanos teams show ${target.team} ${target.product}\" to see its setup.`,\n );\n }\n const webhook = requested\n ? webhooks.find((entry) => entry.webhookId === requested)\n : webhooks.length === 1\n ? webhooks[0]\n : undefined;\n if (!webhook) {\n throw usageError(\n requested\n ? `${status.product.name} has no team-app webhook \"${requested}\".`\n : `${status.product.name} has several webhooks; name one.`,\n `Run one of: ${webhooks.map((entry) => `ekanos teams webhook ${target.team} ${target.product} ${entry.webhookId}`).join(', ')}.`,\n );\n }\n\n if (webhook.endpoint && !args.yes) {\n throw invalidStateError(\n `${target.team} already has a live URL for ${webhook.webhookId} (${webhook.endpoint.tokenPrefix}…). A new one revokes it, and the provider's webhook stops working until you paste the new URL there.`,\n `Re-run with --yes when you are ready to update the provider: ekanos teams webhook ${target.team} ${target.product} ${webhook.webhookId} --yes`,\n );\n }\n\n // The URL carries its token, so it goes to a 0600 file, never the output.\n const secrets = ensureSecretsDir(args.env);\n const minted = await client.call((token) =>\n mintTeamWebhook(host, token, target, webhook.webhookId),\n );\n const { url, ...rest } = minted;\n const secretFile = writeSecretFile(secrets, {\n owner: target.team,\n what: `${target.product}-${webhook.webhookId}-webhook-url`,\n purpose: `Webhook URL for team ${target.team}'s ${status.product.name} (${webhook.webhookId}). Paste it into ${status.product.name}'s webhook settings for this team; the token is part of the URL.`,\n values: [['WEBHOOK_URL', url]],\n again: `ekanos teams webhook ${target.team} ${target.product} ${webhook.webhookId} --yes`,\n });\n return ctx.succeed(\n { host, ...rest, secretFile },\n ctx.ui.result({\n title: `Webhook URL for ${target.team} · ${webhook.webhookId}`,\n tone: 'warn',\n rows: [\n ['URL', `saved to ${secretFile} (readable only by you)`],\n [\n 'Paste it into',\n `${status.product.name}'s webhook settings for this team`,\n ],\n ],\n notes: [\n 'The URL carries its token, so it is shown nowhere else and cannot be read again. Copy it from that file into the provider yourself — not into a chat or an agent session — then delete the file.',\n ...(minted.replaced\n ? ['The previous URL is revoked: the provider must use this one.']\n : []),\n ],\n }),\n );\n}\n\n/** `teams show`, read top to bottom like a setup checklist. */\nexport function checklist(status: TeamIntegrationStatus): string[] {\n const name = status.product.name;\n const lines = [\n `${name} for team ${status.team.slug} (${status.team.name}) on ${status.source.slug}`,\n ` ${mark(status.enabled)} Enabled on the Source`,\n ];\n if (!status.enabled) {\n lines.push(\n ` \"ekanos sources products --source ${status.source.slug}\" shows what it has; only Ekanos enables a product for a Source.`,\n );\n return lines;\n }\n\n const target = { team: status.team.slug, product: status.product.slug };\n lines.push(\n ...scopeHiddenLines(status.scope, {\n ...target,\n source: status.source.slug,\n }).map((line) => ` ${line}`),\n );\n lines.push(...connectionLines(status));\n for (const app of status.teamApps) {\n lines.push(` Team app: ${app.label} (${app.connectionId})`);\n if (app.setup?.consoleUrl) lines.push(` Open: ${app.setup.consoleUrl}`);\n app.setup?.steps.forEach((step, index) =>\n lines.push(` ${index + 1}. ${step}`),\n );\n lines.push(' Callback URLs to register:');\n lines.push(...callbackUrls(app).map((url) => ` ${url}`));\n if (app.guideUrl) lines.push(` Guide: ${app.guideUrl}`);\n for (const field of app.fields) {\n lines.push(` ${fieldLine(field)}`);\n }\n const unset = app.fields.filter((field) => !field.set);\n if (unset.length > 0) {\n lines.push(\n ` → in your terminal: ${cli()} teams app set ${target.team} ${target.product} --connection ${app.connectionId} ${unset.map((field) => `--field ${field.secretName}`).join(' ')} --source ${status.source.slug}`,\n );\n }\n for (const webhook of app.webhooks) {\n lines.push(\n webhook.endpoint\n ? ` ${mark(true)} Webhook ${webhook.webhookId}: live URL ${webhook.endpoint.tokenPrefix}… since ${day(webhook.endpoint.createdAt)}${webhook.endpoint.lastUsedAt ? `, last delivery ${day(webhook.endpoint.lastUsedAt)}` : ', no delivery yet'}`\n : ` ${mark(false)} Webhook ${webhook.webhookId}: no URL yet`,\n );\n if (!webhook.endpoint) {\n lines.push(\n ` → ekanos teams webhook ${target.team} ${target.product} ${webhook.webhookId} --source ${status.source.slug}`,\n );\n }\n }\n lines.push(\n app.connection\n ? ` ${mark(true)} Connected ${day(app.connection.connectedAt)}${app.connection.connectedBy ? ` by ${who(app.connection.connectedBy)}` : ''}`\n : ` ${mark(false)} Connected: not yet\\n → in your terminal: ${connectCommand(status, app.connectionId)}`,\n );\n }\n\n lines.push(\n status.activation\n ? ` ${mark(true)} Activated for the team${status.activation.activatedAt ? ` ${day(status.activation.activatedAt)}` : ''}${status.activation.activatedBy ? ` by ${who(status.activation.activatedBy)}` : ''}`\n : ` ${mark(false)} Activated: not yet\\n → in your terminal: ${connectCommand(status)}`,\n );\n lines.push(` Team page: ${status.connectUrl}`);\n if (status.agentEvents.length > 0) {\n lines.push(' Agent events it offers:');\n lines.push(\n ...status.agentEvents.map((event) => ` ${event.id} — ${event.label}`),\n );\n }\n return lines;\n}\n\n/**\n * Each OAuth connection in one line — connected, or installed for a named\n * one, with its app's credentials and webhook URL — and which of the team's\n * agents wait on it. A named connection an agent's trigger needs and the team\n * has not installed is the gap no other line names: the trigger is stored\n * and on, and nothing ever reaches it.\n */\nfunction connectionLines(status: TeamIntegrationStatus): string[] {\n const connections = status.connections ?? [];\n if (connections.length === 0) return [];\n const lines = [' Connections:'];\n for (const entry of connections) {\n const named = entry.connectionId !== 'default';\n const app = status.teamApps.find(\n (candidate) => candidate.connectionId === entry.connectionId,\n );\n const webhooks = app?.webhooks ?? [];\n const steps = [\n ...(entry.credentialsSaved === null\n ? []\n : [\n `app credentials ${entry.credentialsSaved ? 'saved' : 'not saved'}`,\n ]),\n named\n ? entry.connected\n ? `installed ${day(entry.connectedAt ?? '')}`\n : 'not installed'\n : entry.connected\n ? `connected ${day(entry.connectedAt ?? '')}`\n : 'not connected',\n ...(webhooks.length > 0\n ? [\n webhooks.every((webhook) => webhook.endpoint)\n ? 'webhook URL made'\n : 'no webhook URL',\n ]\n : []),\n ];\n const ready =\n entry.connected &&\n entry.credentialsSaved !== false &&\n webhooks.every((webhook) => webhook.endpoint);\n lines.push(\n ` ${mark(ready)} ${entry.label} (${entry.connectionId}): ${steps.join(' · ')}${entry.connectedBy ? ` by ${who(entry.connectedBy)}` : ''}`,\n );\n if (entry.neededBy.length > 0) {\n lines.push(\n ` Needed by: ${entry.neededBy.map((need) => `${need.agent} (${need.triggers.join(', ')})`).join(', ')}`,\n );\n }\n if (!entry.connected) {\n lines.push(\n ` → in your terminal: ${connectCommand(status, entry.connectionId)}`,\n );\n }\n }\n return lines;\n}\n\n/**\n * One team in `teams list`: its members, and whether the caller is one. A\n * team nobody has joined says so with the command that joins it, rather than\n * reading as a count of zero.\n */\nexport function teamLine(entry: {\n slug: string;\n name: string;\n memberCount: number;\n callerIsMember?: boolean;\n}): string {\n const count = `${entry.memberCount} member${entry.memberCount === 1 ? '' : 's'}`;\n if (entry.callerIsMember === undefined) return `${entry.name} · ${count}`;\n if (entry.callerIsMember) return `${entry.name} · ${count}, you among them`;\n return entry.memberCount === 0\n ? `${entry.name} · 0 members · you are not a member — ekanos teams members add ${entry.slug} --self`\n : `${entry.name} · ${count} · you are not a member`;\n}\n\n/** The command that connects the team, for a hint: `--connection` only for a named one. */\nfunction connectCommand(\n status: TeamIntegrationStatus,\n connectionId = 'default',\n): string {\n return `${cli()} teams connect ${status.team.slug} ${status.product.slug}${connectionId === 'default' ? '' : ` --connection ${connectionId}`} --source ${status.source.slug}`;\n}\n\nfunction appWalkthrough(\n status: TeamIntegrationStatus,\n app: TeamAppState,\n): string[] {\n const lines = [\n `${status.product.name} app for team ${status.team.slug} on ${status.source.slug}`,\n ];\n if (app.setup?.consoleUrl) lines.push(` Open: ${app.setup.consoleUrl}`);\n const steps = app.setup?.steps.length\n ? [...app.setup.steps]\n : [\n `In ${status.product.name}, create an OAuth app for the team (or open the one it uses).`,\n ];\n steps.push(\n `Check the app lists exactly: ${callbackUrls(app).join(', ')}`,\n \"Enter its values below. Secrets are stored in Ekanos's vault and never shown again.\",\n );\n lines.push(...steps.map((step, index) => ` ${index + 1}. ${step}`));\n if (app.guideUrl) lines.push(` Guide: ${app.guideUrl}`);\n return lines;\n}\n\nfunction nextSteps(\n status: TeamIntegrationStatus,\n app: TeamAppState,\n target: Target,\n): string[] {\n return [\n ...app.webhooks\n .filter((webhook) => !webhook.endpoint)\n .map(\n (webhook) =>\n `Next: \"ekanos teams webhook ${target.team} ${target.product} ${webhook.webhookId}\" for the provider's webhook URL.`,\n ),\n ...(app.connection\n ? []\n : [`Then connect it: ${connectCommand(status, app.connectionId)}`]),\n ];\n}\n\nexport function chooseApp(\n status: TeamIntegrationStatus,\n connection: string | undefined,\n): TeamAppState {\n const apps = status.teamApps;\n if (apps.length === 0) {\n throw invalidStateError(\n `${status.product.name} takes no team app: teams connect through the Source's app, or need none.`,\n `Run \"ekanos apps show ${status.product.slug}\" for the Source's app.`,\n );\n }\n const app = connection\n ? apps.find((entry) => entry.connectionId === connection)\n : apps.length === 1\n ? apps[0]\n : apps.find((entry) => entry.connectionId === 'default');\n if (app) return app;\n throw usageError(\n connection\n ? `${status.product.name} has no team app \"${connection}\".`\n : `${status.product.name} has several team apps; name one.`,\n `Pass --connection with one of: ${apps.map((entry) => entry.connectionId).join(', ')}.`,\n );\n}\n\nexport class TeamsClient {\n constructor(\n private readonly env: AuthEnvironment,\n private session: StoredSession,\n ) {}\n\n async call<T>(\n send: (accessToken: string) => Promise<TeamsApiResult<T>>,\n ): Promise<T> {\n let result = await send(this.session.accessToken);\n if (result.status === 'unauthorized') {\n this.session = await refreshStoredSession(this.env, this.session);\n result = await send(this.session.accessToken);\n }\n if (result.status === 'ok') return result.data;\n throw authRequiredError(\n `The session for ${this.env.host} could not authorize the teams call.`,\n loginHint(this.env),\n );\n }\n}\n\nexport function canPrompt(ctx: CliContext, args: TeamsArgs): boolean {\n return !ctx.jsonMode && (args.stdinIsTTY ?? process.stdin.isTTY === true);\n}\n\n/** What the secret-input flags read from, with this run's test seams. */\nexport function teamsSecretIO(args: TeamsArgs): SecretIO {\n return {\n env: args.env,\n stdinIsTTY: args.stdinIsTTY ?? process.stdin.isTTY === true,\n readStdin: args.readStdin,\n openUrl: args.openUrl,\n formTimeoutMs: args.secretFormTimeoutMs,\n };\n}\n\nfunction parseSubcommand(value: string | undefined): TeamsSubcommand {\n const match = TEAMS_SUBCOMMANDS.find((name) => name === value);\n if (match) return match;\n throw usageError(\n value\n ? `Unknown teams subcommand \"${value}\".`\n : 'teams needs a subcommand.',\n 'Run one of: ekanos teams list, ekanos teams create <name>, ekanos teams rename <team> <name>, ekanos teams members list|add|invite|role|remove|resend <team> … (add <team> --self joins you), ekanos teams roles list <team>, ekanos teams leave <team> --yes, ekanos teams groups list|create|update|delete|members <team> …, ekanos teams health <team> [<product>] [--run] (<product> --mine: your own personal connection), ekanos teams workspace list|default <team> …, ekanos teams connect <team> <product>, ekanos teams disconnect <team> <product> --yes (--mine: your own personal connection), ekanos teams show <team> [<product>], ekanos teams app set <team> <product>, ekanos teams webhook <team> <product> [<webhook-id>], ekanos teams events <team> [<product>], ekanos teams audience <team> [<audience>] [--member <email>], ekanos teams scope show|set <team> … (deprecated: audiences), ekanos teams agents|triggers|links|mcp|llm-key ….',\n );\n}\n\nfunction requireSlug(value: string | undefined, what: 'team' | 'product') {\n const slug = value?.trim().toLowerCase();\n if (\n slug &&\n (what === 'product'\n ? isProductSlug(slug)\n : /^[a-z0-9][a-z0-9-]*$/.test(slug))\n ) {\n return slug;\n }\n if (what === 'product' && value) {\n throw usageError(\n `\"${value}\" is not a product slug.`,\n `${PRODUCT_SLUG_SHAPE} \"ekanos catalog\" lists them.`,\n );\n }\n throw usageError(\n value ? `\"${value}\" is not a ${what} slug.` : `Name the ${what}.`,\n what === 'team'\n ? '\"ekanos teams list\" lists the teams, e.g. \"ekanos teams show acme-support zendesk\".'\n : '\"ekanos catalog\" lists the products, e.g. \"ekanos teams show acme-support zendesk\".',\n );\n}\n\nfunction mark(done: boolean): string {\n return done ? '✓' : '✗';\n}\n\nfunction day(iso: string): string {\n return iso.slice(0, 10);\n}\n\nfunction who(member: {\n name: string | null;\n email: string | null;\n userId: string;\n}) {\n return member.email ?? member.name ?? member.userId;\n}\n\n/** Every redirect URI to register. */\nfunction callbackUrls(app: TeamAppState): string[] {\n return app.callbackUrls.length ? app.callbackUrls : [app.callbackUrl];\n}\n"]}
|
package/dist/compatibility.d.ts
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* shell must contain. Editing a comment in a template does not count — that is
|
|
32
32
|
* what the template fingerprint in the marker is for.
|
|
33
33
|
*/
|
|
34
|
-
export declare const SHELL_CONTRACT =
|
|
34
|
+
export declare const SHELL_CONTRACT = 8;
|
|
35
35
|
/**
|
|
36
36
|
* Contract history — what each bump changed, so a mismatch message can be
|
|
37
37
|
* read against it:
|
|
@@ -62,6 +62,12 @@ export declare const SHELL_CONTRACT = 7;
|
|
|
62
62
|
* `ExperiencePagesPage` from `/routes`: the experience's Pages tab, which
|
|
63
63
|
* replaces the Layout tab (`/experience/layout` now redirects to it). A
|
|
64
64
|
* harness without that export cannot back the shell.
|
|
65
|
+
* 8 adds the Catalog (`app/catalog/layout.tsx`, `app/catalog/page.tsx`,
|
|
66
|
+
* `app/catalog/[slug]/page.tsx` re-exporting `CatalogLayout`,
|
|
67
|
+
* `CatalogPage`, `CatalogProductPage`) and the Publishes tabs
|
|
68
|
+
* (`app/integrations/[slug]/publishes/page.tsx` → `IntegrationPublishesPage`,
|
|
69
|
+
* `app/experience/publishes/page.tsx` → `ExperiencePublishesPage`). A
|
|
70
|
+
* harness without those exports cannot back the shell.
|
|
65
71
|
*/
|
|
66
72
|
/**
|
|
67
73
|
* The contract an installed `@ekanos/harness` declares it needs, from
|
package/dist/compatibility.js
CHANGED
|
@@ -36,7 +36,7 @@ import { readTemplateSource, templatesDir } from './templates.js';
|
|
|
36
36
|
* shell must contain. Editing a comment in a template does not count — that is
|
|
37
37
|
* what the template fingerprint in the marker is for.
|
|
38
38
|
*/
|
|
39
|
-
export const SHELL_CONTRACT =
|
|
39
|
+
export const SHELL_CONTRACT = 8;
|
|
40
40
|
/**
|
|
41
41
|
* Contract history — what each bump changed, so a mismatch message can be
|
|
42
42
|
* read against it:
|
|
@@ -67,6 +67,12 @@ export const SHELL_CONTRACT = 7;
|
|
|
67
67
|
* `ExperiencePagesPage` from `/routes`: the experience's Pages tab, which
|
|
68
68
|
* replaces the Layout tab (`/experience/layout` now redirects to it). A
|
|
69
69
|
* harness without that export cannot back the shell.
|
|
70
|
+
* 8 adds the Catalog (`app/catalog/layout.tsx`, `app/catalog/page.tsx`,
|
|
71
|
+
* `app/catalog/[slug]/page.tsx` re-exporting `CatalogLayout`,
|
|
72
|
+
* `CatalogPage`, `CatalogProductPage`) and the Publishes tabs
|
|
73
|
+
* (`app/integrations/[slug]/publishes/page.tsx` → `IntegrationPublishesPage`,
|
|
74
|
+
* `app/experience/publishes/page.tsx` → `ExperiencePublishesPage`). A
|
|
75
|
+
* harness without those exports cannot back the shell.
|
|
70
76
|
*/
|
|
71
77
|
/**
|
|
72
78
|
* The contract an installed `@ekanos/harness` declares it needs, from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compatibility.js","sourceRoot":"","sources":["../src/compatibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,eAAwB;IAC5D,IAAI,OAAO,eAAe,KAAK,QAAQ,IAAI,eAAe,KAAK,IAAI;QAAE,OAAO,CAAC,CAAC;IAC9E,MAAM,MAAM,GAAI,eAAwC,CAAC,MAAM,CAAC;IAChE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAI,MAAsC,CAAC,aAAa,CAAC;IACvE,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAE,QAAmB,CAAC,CAAC,CAAC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C,IAAI,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { createHash } from 'node:crypto';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport { preconditionError } from './errors';\nimport { readTemplateSource, templatesDir } from './templates';\n\n/**\n * The shell templates ship with `@ekanos/cli`; the code they import ships with\n * `@ekanos/harness`. The two version independently, so a partner can upgrade\n * one without the other — and the interesting failure is the quiet one:\n *\n * `pnpm up @ekanos/harness` → 0.2, which moves an export.\n * `ekanos dev` regenerates from the OLD CLI's templates and stamps \"0.2\"\n * into the marker. Every later run now considers the shell current. It is\n * not: it was generated against an obsolete contract, and what the partner\n * sees is a module-resolution error rather than \"these are incompatible\".\n *\n * That directly attacks the promise the package boundary exists to keep — ship\n * a harness fix as a version bump a partner picks up with `pnpm up`. So the\n * CLI declares which `@ekanos/harness` versions ITS templates are written\n * against, checks the installed one before generating, and names the\n * incompatibility instead of letting a resolution error stand in for it.\n */\n\n/**\n * The shell contract this CLI's templates GENERATE.\n *\n * An integer, not a semver range. A range can only INFER compatibility from\n * version numbers — it cannot tell a harness bugfix from a change to the shell\n * the harness requires, so it either blocks upgrades that were fine or waves\n * through ones that were not. The integer is declared by both sides and is\n * authoritative.\n *\n * **Bump this only when the generated shell's coupling to the package\n * changes**: an export renamed or moved between `/app` and `/routes`, the\n * props of `RootLayout` or `IndexPage`, the server/client split, the alias\n * specifier, which side owns `@import 'tailwindcss'`, or the set of files the\n * shell must contain. Editing a comment in a template does not count — that is\n * what the template fingerprint in the marker is for.\n */\nexport const SHELL_CONTRACT = 7;\n\n/**\n * Contract history — what each bump changed, so a mismatch message can be\n * read against it:\n *\n * 1 the original ten-file shell: pages re-exporting `/routes`, the client\n * shell + index page injecting the registry into `/app`.\n * 2 adds `app/api/integrations/[slug]/[...path]/route.ts`, injecting the\n * registry into the new `@ekanos/harness/api` server entry. A harness\n * without that export cannot back the route; a shell without the route\n * leaves that harness's live-mode OAuth loop unreachable.\n * 3 adds `app/[slug]/page.tsx`, re-exporting the new\n * `IntegrationIndexPage` from `/routes` so `/<slug>` redirects to\n * `/<slug>/widgets` instead of answering 404 under a working toolbar.\n * 4 adds `app/%5F%5Fekanos/api/[...path]/route.ts`, serving\n * `/__ekanos/api/*` from the new `createEkanosApiHandlers` in\n * `@ekanos/harness/api` (integrations, operations, approvals, run log). A\n * harness without that export cannot back the route.\n * 5 moves the widgets, tile, activation and triggers surfaces to\n * `app/integrations/[slug]/preview/**` (a `PreviewLayout` and\n * `PreviewIndexPage` from `/routes`), and turns the old `app/[slug]/**`\n * pages into `LegacyPreviewRedirect` re-exports. A harness without those\n * exports cannot back the shell.\n * 6 adds `app/not-found.tsx`, re-exporting the new `NotFoundPage` from\n * `/routes`, so an address no route matches answers in the harness's\n * own header with a way home. A harness without that export cannot back\n * the shell.\n * 7 adds `app/experience/pages/page.tsx`, re-exporting the new\n * `ExperiencePagesPage` from `/routes`: the experience's Pages tab, which\n * replaces the Layout tab (`/experience/layout` now redirects to it). A\n * harness without that export cannot back the shell.\n */\n\n/**\n * The contract an installed `@ekanos/harness` declares it needs, from\n * `{ \"ekanos\": { \"shellContract\": N } }` in its package.json.\n *\n * A package that declares nothing is read as contract 1 — the contract that\n * shipped first — so the harness released before this existed keeps working.\n * That default is deliberately silent, which is why `@ekanos/harness` asserts\n * the field's presence in its own pack test rather than relying on it.\n */\nexport function declaredShellContract(harnessManifest: unknown): number {\n if (typeof harnessManifest !== 'object' || harnessManifest === null) return 1;\n const ekanos = (harnessManifest as { ekanos?: unknown }).ekanos;\n if (typeof ekanos !== 'object' || ekanos === null) return 1;\n const declared = (ekanos as { shellContract?: unknown }).shellContract;\n return Number.isInteger(declared) ? (declared as number) : 1;\n}\n\n/** `[major, minor, patch]`, with anything non-numeric treated as 0. */\nfunction parseVersion(version: string): [number, number, number] {\n const core = version.split('+')[0]!.split('-')[0]!;\n const parts = core.split('.').map((part) => Number.parseInt(part, 10));\n return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0];\n}\n\nexport function compareVersions(a: string, b: string): number {\n const left = parseVersion(a);\n const right = parseVersion(b);\n for (let i = 0; i < 3; i++) {\n if (left[i]! !== right[i]!) return left[i]! < right[i]! ? -1 : 1;\n }\n return 0;\n}\n\n/** This CLI's own version, read from its package.json at runtime. */\nexport function cliVersion(): string {\n const manifestPath = path.join(templatesDir(), '..', 'package.json');\n const parsed: unknown = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));\n const version =\n typeof parsed === 'object' && parsed !== null\n ? (parsed as { version?: unknown }).version\n : undefined;\n return typeof version === 'string' ? version : '0.0.0';\n}\n\n/**\n * Fail unless this CLI's templates generate the shell the installed harness\n * expects.\n *\n * The templates ship with `@ekanos/cli`; the code they import ships with\n * `@ekanos/harness`. The two version independently, so a partner can upgrade\n * one without the other — and the failure that matters is the quiet one:\n * `pnpm up @ekanos/harness` moves an export, `ekanos dev` regenerates from the\n * OLD CLI's templates, and the partner sees a module-resolution error rather\n * than anything naming the incompatibility.\n *\n * Byte-comparing generated files cannot catch it: the old templates' bytes are\n * exactly what the old CLI intends, so nothing regenerates differently and the\n * shell stays wired to something that moved. Only a declared contract can.\n *\n * Runs before anything is written, so an incompatible pair produces no shell\n * at all — a broken shell that builds is worse than no shell.\n */\nexport function assertHarnessCompatible(params: {\n harnessVersion: string;\n harnessManifest: unknown;\n installHint: (packageSpec: string) => string;\n}): void {\n const required = declaredShellContract(params.harnessManifest);\n if (required === SHELL_CONTRACT) return;\n\n if (required > SHELL_CONTRACT) {\n throw preconditionError(\n `@ekanos/cli ${cliVersion()} is too old for @ekanos/harness ` +\n `${params.harnessVersion}: that harness needs shell contract ` +\n `${required}, and this CLI generates ${SHELL_CONTRACT}.`,\n `Upgrade the CLI: ${params.installHint('@ekanos/cli@latest')}. Then ` +\n 're-run \"ekanos dev\" and the shell is regenerated for you.',\n );\n }\n\n throw preconditionError(\n `@ekanos/harness ${params.harnessVersion} is too old for @ekanos/cli ` +\n `${cliVersion()}: this CLI generates shell contract ${SHELL_CONTRACT}, ` +\n `and that harness needs ${required}.`,\n `Upgrade it: ${params.installHint('@ekanos/harness@latest')}.`,\n );\n}\n\n/**\n * A fingerprint of the template SOURCES, independent of the slug they are\n * rendered with.\n *\n * The harness version alone cannot certify a shell: the templates can change\n * while it stays put (a CLI patch release), and it can change while they stay\n * put. Hashing the sources means any edit to what we generate invalidates\n * every shell generated before it, including one produced by a CLI version\n * that never shipped.\n */\nexport function templatesFingerprint(templateNames: readonly string[]): string {\n const hash = createHash('sha256');\n for (const name of [...templateNames].sort()) {\n hash.update(name);\n hash.update('\\0');\n hash.update(readTemplateSource(name));\n hash.update('\\0');\n }\n return hash.digest('hex').slice(0, 16);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compatibility.js","sourceRoot":"","sources":["../src/compatibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,eAAwB;IAC5D,IAAI,OAAO,eAAe,KAAK,QAAQ,IAAI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C,wBAAwB,CAAC,GAAG,CAC/D,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,aAAgC;IACnE,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { createHash } from 'node:crypto';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport { preconditionError } from './errors';\nimport { readTemplateSource, templatesDir } from './templates';\n\n/**\n * The shell templates ship with `@ekanos/cli`; the code they import ships with\n * `@ekanos/harness`. The two version independently, so a partner can upgrade\n * one without the other — and the interesting failure is the quiet one:\n *\n * `pnpm up @ekanos/harness` → 0.2, which moves an export.\n * `ekanos dev` regenerates from the OLD CLI's templates and stamps \"0.2\"\n * into the marker. Every later run now considers the shell current. It is\n * not: it was generated against an obsolete contract, and what the partner\n * sees is a module-resolution error rather than \"these are incompatible\".\n *\n * That directly attacks the promise the package boundary exists to keep — ship\n * a harness fix as a version bump a partner picks up with `pnpm up`. So the\n * CLI declares which `@ekanos/harness` versions ITS templates are written\n * against, checks the installed one before generating, and names the\n * incompatibility instead of letting a resolution error stand in for it.\n */\n\n/**\n * The shell contract this CLI's templates GENERATE.\n *\n * An integer, not a semver range. A range can only INFER compatibility from\n * version numbers — it cannot tell a harness bugfix from a change to the shell\n * the harness requires, so it either blocks upgrades that were fine or waves\n * through ones that were not. The integer is declared by both sides and is\n * authoritative.\n *\n * **Bump this only when the generated shell's coupling to the package\n * changes**: an export renamed or moved between `/app` and `/routes`, the\n * props of `RootLayout` or `IndexPage`, the server/client split, the alias\n * specifier, which side owns `@import 'tailwindcss'`, or the set of files the\n * shell must contain. Editing a comment in a template does not count — that is\n * what the template fingerprint in the marker is for.\n */\nexport const SHELL_CONTRACT = 8;\n\n/**\n * Contract history — what each bump changed, so a mismatch message can be\n * read against it:\n *\n * 1 the original ten-file shell: pages re-exporting `/routes`, the client\n * shell + index page injecting the registry into `/app`.\n * 2 adds `app/api/integrations/[slug]/[...path]/route.ts`, injecting the\n * registry into the new `@ekanos/harness/api` server entry. A harness\n * without that export cannot back the route; a shell without the route\n * leaves that harness's live-mode OAuth loop unreachable.\n * 3 adds `app/[slug]/page.tsx`, re-exporting the new\n * `IntegrationIndexPage` from `/routes` so `/<slug>` redirects to\n * `/<slug>/widgets` instead of answering 404 under a working toolbar.\n * 4 adds `app/%5F%5Fekanos/api/[...path]/route.ts`, serving\n * `/__ekanos/api/*` from the new `createEkanosApiHandlers` in\n * `@ekanos/harness/api` (integrations, operations, approvals, run log). A\n * harness without that export cannot back the route.\n * 5 moves the widgets, tile, activation and triggers surfaces to\n * `app/integrations/[slug]/preview/**` (a `PreviewLayout` and\n * `PreviewIndexPage` from `/routes`), and turns the old `app/[slug]/**`\n * pages into `LegacyPreviewRedirect` re-exports. A harness without those\n * exports cannot back the shell.\n * 6 adds `app/not-found.tsx`, re-exporting the new `NotFoundPage` from\n * `/routes`, so an address no route matches answers in the harness's\n * own header with a way home. A harness without that export cannot back\n * the shell.\n * 7 adds `app/experience/pages/page.tsx`, re-exporting the new\n * `ExperiencePagesPage` from `/routes`: the experience's Pages tab, which\n * replaces the Layout tab (`/experience/layout` now redirects to it). A\n * harness without that export cannot back the shell.\n * 8 adds the Catalog (`app/catalog/layout.tsx`, `app/catalog/page.tsx`,\n * `app/catalog/[slug]/page.tsx` re-exporting `CatalogLayout`,\n * `CatalogPage`, `CatalogProductPage`) and the Publishes tabs\n * (`app/integrations/[slug]/publishes/page.tsx` → `IntegrationPublishesPage`,\n * `app/experience/publishes/page.tsx` → `ExperiencePublishesPage`). A\n * harness without those exports cannot back the shell.\n */\n\n/**\n * The contract an installed `@ekanos/harness` declares it needs, from\n * `{ \"ekanos\": { \"shellContract\": N } }` in its package.json.\n *\n * A package that declares nothing is read as contract 1 — the contract that\n * shipped first — so the harness released before this existed keeps working.\n * That default is deliberately silent, which is why `@ekanos/harness` asserts\n * the field's presence in its own pack test rather than relying on it.\n */\nexport function declaredShellContract(harnessManifest: unknown): number {\n if (typeof harnessManifest !== 'object' || harnessManifest === null) return 1;\n const ekanos = (harnessManifest as { ekanos?: unknown }).ekanos;\n if (typeof ekanos !== 'object' || ekanos === null) return 1;\n const declared = (ekanos as { shellContract?: unknown }).shellContract;\n return Number.isInteger(declared) ? (declared as number) : 1;\n}\n\n/** `[major, minor, patch]`, with anything non-numeric treated as 0. */\nfunction parseVersion(version: string): [number, number, number] {\n const core = version.split('+')[0]!.split('-')[0]!;\n const parts = core.split('.').map((part) => Number.parseInt(part, 10));\n return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0];\n}\n\nexport function compareVersions(a: string, b: string): number {\n const left = parseVersion(a);\n const right = parseVersion(b);\n for (let i = 0; i < 3; i++) {\n if (left[i]! !== right[i]!) return left[i]! < right[i]! ? -1 : 1;\n }\n return 0;\n}\n\n/** This CLI's own version, read from its package.json at runtime. */\nexport function cliVersion(): string {\n const manifestPath = path.join(templatesDir(), '..', 'package.json');\n const parsed: unknown = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));\n const version =\n typeof parsed === 'object' && parsed !== null\n ? (parsed as { version?: unknown }).version\n : undefined;\n return typeof version === 'string' ? version : '0.0.0';\n}\n\n/**\n * Fail unless this CLI's templates generate the shell the installed harness\n * expects.\n *\n * The templates ship with `@ekanos/cli`; the code they import ships with\n * `@ekanos/harness`. The two version independently, so a partner can upgrade\n * one without the other — and the failure that matters is the quiet one:\n * `pnpm up @ekanos/harness` moves an export, `ekanos dev` regenerates from the\n * OLD CLI's templates, and the partner sees a module-resolution error rather\n * than anything naming the incompatibility.\n *\n * Byte-comparing generated files cannot catch it: the old templates' bytes are\n * exactly what the old CLI intends, so nothing regenerates differently and the\n * shell stays wired to something that moved. Only a declared contract can.\n *\n * Runs before anything is written, so an incompatible pair produces no shell\n * at all — a broken shell that builds is worse than no shell.\n */\nexport function assertHarnessCompatible(params: {\n harnessVersion: string;\n harnessManifest: unknown;\n installHint: (packageSpec: string) => string;\n}): void {\n const required = declaredShellContract(params.harnessManifest);\n if (required === SHELL_CONTRACT) return;\n\n if (required > SHELL_CONTRACT) {\n throw preconditionError(\n `@ekanos/cli ${cliVersion()} is too old for @ekanos/harness ` +\n `${params.harnessVersion}: that harness needs shell contract ` +\n `${required}, and this CLI generates ${SHELL_CONTRACT}.`,\n `Upgrade the CLI: ${params.installHint('@ekanos/cli@latest')}. Then ` +\n 're-run \"ekanos dev\" and the shell is regenerated for you.',\n );\n }\n\n throw preconditionError(\n `@ekanos/harness ${params.harnessVersion} is too old for @ekanos/cli ` +\n `${cliVersion()}: this CLI generates shell contract ${SHELL_CONTRACT}, ` +\n `and that harness needs ${required}.`,\n `Upgrade it: ${params.installHint('@ekanos/harness@latest')}.`,\n );\n}\n\n/**\n * A fingerprint of the template SOURCES, independent of the slug they are\n * rendered with.\n *\n * The harness version alone cannot certify a shell: the templates can change\n * while it stays put (a CLI patch release), and it can change while they stay\n * put. Hashing the sources means any edit to what we generate invalidates\n * every shell generated before it, including one produced by a CLI version\n * that never shipped.\n */\nexport function templatesFingerprint(templateNames: readonly string[]): string {\n const hash = createHash('sha256');\n for (const name of [...templateNames].sort()) {\n hash.update(name);\n hash.update('\\0');\n hash.update(readTemplateSource(name));\n hash.update('\\0');\n }\n return hash.digest('hex').slice(0, 16);\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Contract } from '@ekanos/integration-schema';
|
|
2
|
+
/**
|
|
3
|
+
* The CLI's client for host contracts: how `ekanos add` / `ekanos sync` pin an
|
|
4
|
+
* integration the developer's Source may see but does not own.
|
|
5
|
+
*
|
|
6
|
+
* ---------------------------------------------------------------------------
|
|
7
|
+
* WIRE CONTRACT — the host's `/api/partner/contracts` route.
|
|
8
|
+
*
|
|
9
|
+
* GET /api/partner/contracts?source=<slug|id>&integration=<ref>&line=<x.y>
|
|
10
|
+
* [Authorization: Bearer <access_token>]
|
|
11
|
+
* → 200 { ok: true, data: { contract } }
|
|
12
|
+
* → 401 / 3xx refresh once and retry
|
|
13
|
+
* → 403 { code: "MFA_REQUIRED" | "FORBIDDEN" }
|
|
14
|
+
* → 404 { code: "CONTRACT_NOT_FOUND" } none, or not visible to the Source
|
|
15
|
+
* → 404 { code: "LINE_NOT_FOUND", lines }
|
|
16
|
+
* ---------------------------------------------------------------------------
|
|
17
|
+
*/
|
|
18
|
+
export type FetchHostContractResult = {
|
|
19
|
+
status: 'ok';
|
|
20
|
+
contract: Contract;
|
|
21
|
+
} | {
|
|
22
|
+
status: 'unauthorized';
|
|
23
|
+
} | {
|
|
24
|
+
status: 'not-found';
|
|
25
|
+
message: string;
|
|
26
|
+
lines: string[];
|
|
27
|
+
};
|
|
28
|
+
export declare function fetchHostContract(host: string, accessToken: string, query: {
|
|
29
|
+
source: string;
|
|
30
|
+
integration: string;
|
|
31
|
+
line: string;
|
|
32
|
+
}): Promise<FetchHostContractResult>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { verifyContract } from '@ekanos/integration-schema';
|
|
2
|
+
import { request } from './auth/ekanos-api.js';
|
|
3
|
+
import { authRequiredError, forbiddenError, networkError, validationError, } from './errors.js';
|
|
4
|
+
export async function fetchHostContract(host, accessToken, query) {
|
|
5
|
+
const params = new URLSearchParams(query);
|
|
6
|
+
const response = await request(`${host}/api/partner/contracts?${params.toString()}`, {
|
|
7
|
+
method: 'GET',
|
|
8
|
+
headers: {
|
|
9
|
+
accept: 'application/json',
|
|
10
|
+
authorization: `Bearer ${accessToken}`,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
if (response.status === 401 || isRedirect(response.status)) {
|
|
14
|
+
return { status: 'unauthorized' };
|
|
15
|
+
}
|
|
16
|
+
const body = await readOptionalJson(response);
|
|
17
|
+
const code = str(body.code);
|
|
18
|
+
const message = str(body.error);
|
|
19
|
+
if (response.status === 403 && code === 'MFA_REQUIRED') {
|
|
20
|
+
throw authRequiredError(message !== null && message !== void 0 ? message : `${host} requires multi-factor authentication.`, `Complete MFA in the browser, then run "ekanos login" again.`);
|
|
21
|
+
}
|
|
22
|
+
if (response.status === 403) {
|
|
23
|
+
throw forbiddenError(message !== null && message !== void 0 ? message : `No seat on "${query.source}".`, `Run "ekanos sources" to list the sources you hold a seat on.`);
|
|
24
|
+
}
|
|
25
|
+
if (response.status === 404) {
|
|
26
|
+
const lines = Array.isArray(body.lines)
|
|
27
|
+
? body.lines.filter((line) => typeof line === 'string')
|
|
28
|
+
: [];
|
|
29
|
+
return {
|
|
30
|
+
status: 'not-found',
|
|
31
|
+
message: message !== null && message !== void 0 ? message : `${host} has no contract for ${query.integration}@${query.line}.`,
|
|
32
|
+
lines,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
throw networkError(`${host} answered ${response.status} for the ${query.integration} contract.`, 'Try again; if it keeps failing, pass --from-dir with a contracts directory.');
|
|
37
|
+
}
|
|
38
|
+
const data = body.data;
|
|
39
|
+
const raw = typeof data === 'object' && data !== null && 'contract' in data
|
|
40
|
+
? data.contract
|
|
41
|
+
: undefined;
|
|
42
|
+
const verified = verifyContract(raw);
|
|
43
|
+
if (!verified.contract || verified.problems.length > 0) {
|
|
44
|
+
const first = verified.problems[0];
|
|
45
|
+
throw validationError(`${host} sent an invalid contract for ${query.integration}@${query.line}${first ? `: ${first.rule}: ${first.message}` : ''}.`, 'Report it to Vastly; meanwhile pin from a contracts directory with --from-dir.');
|
|
46
|
+
}
|
|
47
|
+
return { status: 'ok', contract: verified.contract };
|
|
48
|
+
}
|
|
49
|
+
async function readOptionalJson(response) {
|
|
50
|
+
try {
|
|
51
|
+
const parsed = await response.json();
|
|
52
|
+
return typeof parsed === 'object' && parsed !== null
|
|
53
|
+
? parsed
|
|
54
|
+
: {};
|
|
55
|
+
}
|
|
56
|
+
catch (_a) {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function isRedirect(status) {
|
|
61
|
+
return status >= 300 && status < 400;
|
|
62
|
+
}
|
|
63
|
+
function str(value) {
|
|
64
|
+
return typeof value === 'string' && value.length > 0 ? value : null;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=contracts-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-api.js","sourceRoot":"","sources":["../src/contracts-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE3E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,eAAe,GAChB,MAAM,UAAU,CAAC;AAwBlB,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAY,EACZ,WAAmB,EACnB,KAA4D;IAE5D,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B,GAAG,IAAI,0BAA0B,MAAM,CAAC,QAAQ,EAAE,EAAE,EACpD;QACE,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,aAAa,EAAE,UAAU,WAAW,EAAE;SACvC;KACF,CACF,CAAC;IAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,Q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AG,IAAI,MAAM,GAAG,GAAG,CAAC;AACvC,CAAC;AAED,SAAS,GAAG,CAAC,KAAc;IACzB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC","sourcesContent":["import { type Contract, verifyContract } from '@ekanos/integration-schema';\n\nimport { request } from './auth/ekanos-api';\nimport {\n authRequiredError,\n forbiddenError,\n networkError,\n validationError,\n} from './errors';\n\n/**\n * The CLI's client for host contracts: how `ekanos add` / `ekanos sync` pin an\n * integration the developer's Source may see but does not own.\n *\n * ---------------------------------------------------------------------------\n * WIRE CONTRACT — the host's `/api/partner/contracts` route.\n *\n * GET /api/partner/contracts?source=<slug|id>&integration=<ref>&line=<x.y>\n * [Authorization: Bearer <access_token>]\n * → 200 { ok: true, data: { contract } }\n * → 401 / 3xx refresh once and retry\n * → 403 { code: \"MFA_REQUIRED\" | \"FORBIDDEN\" }\n * → 404 { code: \"CONTRACT_NOT_FOUND\" } none, or not visible to the Source\n * → 404 { code: \"LINE_NOT_FOUND\", lines }\n * ---------------------------------------------------------------------------\n */\n\nexport type FetchHostContractResult =\n | { status: 'ok'; contract: Contract }\n | { status: 'unauthorized' }\n | { status: 'not-found'; message: string; lines: string[] };\n\nexport async function fetchHostContract(\n host: string,\n accessToken: string,\n query: { source: string; integration: string; line: string },\n): Promise<FetchHostContractResult> {\n const params = new URLSearchParams(query);\n const response = await request(\n `${host}/api/partner/contracts?${params.toString()}`,\n {\n method: 'GET',\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${accessToken}`,\n },\n },\n );\n\n if (response.status === 401 || isRedirect(response.status)) {\n return { status: 'unauthorized' };\n }\n\n const body = await readOptionalJson(response);\n const code = str(body.code);\n const message = str(body.error);\n\n if (response.status === 403 && code === 'MFA_REQUIRED') {\n throw authRequiredError(\n message ?? `${host} requires multi-factor authentication.`,\n `Complete MFA in the browser, then run \"ekanos login\" again.`,\n );\n }\n if (response.status === 403) {\n throw forbiddenError(\n message ?? `No seat on \"${query.source}\".`,\n `Run \"ekanos sources\" to list the sources you hold a seat on.`,\n );\n }\n if (response.status === 404) {\n const lines = Array.isArray(body.lines)\n ? body.lines.filter((line): line is string => typeof line === 'string')\n : [];\n return {\n status: 'not-found',\n message:\n message ??\n `${host} has no contract for ${query.integration}@${query.line}.`,\n lines,\n };\n }\n if (!response.ok) {\n throw networkError(\n `${host} answered ${response.status} for the ${query.integration} contract.`,\n 'Try again; if it keeps failing, pass --from-dir with a contracts directory.',\n );\n }\n\n const data = body.data;\n const raw =\n typeof data === 'object' && data !== null && 'contract' in data\n ? data.contract\n : undefined;\n const verified = verifyContract(raw);\n if (!verified.contract || verified.problems.length > 0) {\n const first = verified.problems[0];\n throw validationError(\n `${host} sent an invalid contract for ${query.integration}@${query.line}${first ? `: ${first.rule}: ${first.message}` : ''}.`,\n 'Report it to Vastly; meanwhile pin from a contracts directory with --from-dir.',\n );\n }\n return { status: 'ok', contract: verified.contract };\n}\n\nasync function readOptionalJson(\n response: Response,\n): Promise<Record<string, unknown>> {\n try {\n const parsed: unknown = await response.json();\n return typeof parsed === 'object' && parsed !== null\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n\nfunction isRedirect(status: number): boolean {\n return status >= 300 && status < 400;\n}\n\nfunction str(value: unknown): string | null {\n return typeof value === 'string' && value.length > 0 ? value : null;\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { refreshStoredSession, resolveAuthEnvironment } from '../auth/session.js';
|
|
2
|
+
import type { CliContext } from '../context.js';
|
|
3
|
+
import { fetchHostContract } from '../contracts-api.js';
|
|
4
|
+
import { resolveSourceTarget } from '../source-target.js';
|
|
5
|
+
import type { ContractSource } from './contract-sources.js';
|
|
6
|
+
/** The network calls, injectable for tests. */
|
|
7
|
+
export interface HostContractDeps {
|
|
8
|
+
resolveAuthEnvironment: typeof resolveAuthEnvironment;
|
|
9
|
+
resolveSourceTarget: typeof resolveSourceTarget;
|
|
10
|
+
refreshStoredSession: typeof refreshStoredSession;
|
|
11
|
+
fetchHostContract: typeof fetchHostContract;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The host as a contract source: the contract of any integration the
|
|
15
|
+
* developer's Source may see (global, its own, or shared with it), which is
|
|
16
|
+
* how an experience builds on a package its Source does not own. Never
|
|
17
|
+
* throws for being offline, logged out or without a Source: it answers null
|
|
18
|
+
* and says why in its name, so the next source in the chain is tried and the
|
|
19
|
+
* final "no contract" message explains this one.
|
|
20
|
+
*/
|
|
21
|
+
export declare function hostContractSource(params: {
|
|
22
|
+
ctx: CliContext;
|
|
23
|
+
env: Record<string, string | undefined>;
|
|
24
|
+
projectDir: string;
|
|
25
|
+
deps?: Partial<HostContractDeps>;
|
|
26
|
+
}): ContractSource;
|
|
27
|
+
/**
|
|
28
|
+
* The chain `add` and `sync` resolve through: the project's harness first (a
|
|
29
|
+
* package of the same repo, the Source's own published package, an explicit
|
|
30
|
+
* contracts directory), then the host, and only then the committed snapshot
|
|
31
|
+
* the harness falls back to. A stale snapshot never wins over the host's
|
|
32
|
+
* contract, and the host never overrides a package being developed in the
|
|
33
|
+
* repo.
|
|
34
|
+
*/
|
|
35
|
+
export declare function withHostBeforeSnapshots(harness: readonly ContractSource[], host: ContractSource): ContractSource[];
|