@ekanos/cli 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +41 -4
  2. package/dist/auth/ekanos-api.d.ts +23 -0
  3. package/dist/auth/ekanos-api.js +33 -6
  4. package/dist/auth/ekanos-api.js.map +1 -1
  5. package/dist/commands/agents.d.ts +2 -2
  6. package/dist/commands/agents.js +14 -20
  7. package/dist/commands/agents.js.map +1 -1
  8. package/dist/commands/apps.d.ts +11 -3
  9. package/dist/commands/apps.js +86 -28
  10. package/dist/commands/apps.js.map +1 -1
  11. package/dist/commands/catalog.d.ts +4 -2
  12. package/dist/commands/catalog.js +166 -35
  13. package/dist/commands/catalog.js.map +1 -1
  14. package/dist/commands/login.d.ts +2 -0
  15. package/dist/commands/login.js +17 -0
  16. package/dist/commands/login.js.map +1 -1
  17. package/dist/commands/runs.d.ts +7 -3
  18. package/dist/commands/runs.js +24 -6
  19. package/dist/commands/runs.js.map +1 -1
  20. package/dist/commands/scope-notice.d.ts +7 -0
  21. package/dist/commands/scope-notice.js +4 -11
  22. package/dist/commands/scope-notice.js.map +1 -1
  23. package/dist/commands/sources-roles.d.ts +5 -0
  24. package/dist/commands/sources-roles.js +235 -0
  25. package/dist/commands/sources-roles.js.map +1 -0
  26. package/dist/commands/sources.d.ts +5 -0
  27. package/dist/commands/sources.js +6 -1
  28. package/dist/commands/sources.js.map +1 -1
  29. package/dist/commands/team-agent-readiness.d.ts +23 -17
  30. package/dist/commands/team-agent-readiness.js +57 -90
  31. package/dist/commands/team-agent-readiness.js.map +1 -1
  32. package/dist/commands/team-agents-agents.d.ts +8 -5
  33. package/dist/commands/team-agents-agents.js +173 -58
  34. package/dist/commands/team-agents-agents.js.map +1 -1
  35. package/dist/commands/team-agents-define.d.ts +31 -0
  36. package/dist/commands/team-agents-define.js +176 -0
  37. package/dist/commands/team-agents-define.js.map +1 -0
  38. package/dist/commands/team-agents-mcp.js +112 -10
  39. package/dist/commands/team-agents-mcp.js.map +1 -1
  40. package/dist/commands/team-agents-triggers.d.ts +1 -1
  41. package/dist/commands/team-agents-triggers.js +137 -5
  42. package/dist/commands/team-agents-triggers.js.map +1 -1
  43. package/dist/commands/team-agents.d.ts +4 -1
  44. package/dist/commands/team-agents.js +17 -4
  45. package/dist/commands/team-agents.js.map +1 -1
  46. package/dist/commands/team-llm-key.d.ts +14 -0
  47. package/dist/commands/team-llm-key.js +122 -0
  48. package/dist/commands/team-llm-key.js.map +1 -0
  49. package/dist/commands/teams-connect.js +123 -31
  50. package/dist/commands/teams-connect.js.map +1 -1
  51. package/dist/commands/teams-lifecycle.d.ts +90 -0
  52. package/dist/commands/teams-lifecycle.js +457 -0
  53. package/dist/commands/teams-lifecycle.js.map +1 -0
  54. package/dist/commands/teams-onboard.d.ts +14 -0
  55. package/dist/commands/teams-onboard.js +62 -13
  56. package/dist/commands/teams-onboard.js.map +1 -1
  57. package/dist/commands/teams-overview.js +7 -3
  58. package/dist/commands/teams-overview.js.map +1 -1
  59. package/dist/commands/teams.d.ts +25 -5
  60. package/dist/commands/teams.js +101 -39
  61. package/dist/commands/teams.js.map +1 -1
  62. package/dist/commands/workflows.d.ts +37 -0
  63. package/dist/commands/workflows.js +589 -0
  64. package/dist/commands/workflows.js.map +1 -0
  65. package/dist/connect-fields.d.ts +22 -0
  66. package/dist/connect-fields.js +115 -0
  67. package/dist/connect-fields.js.map +1 -0
  68. package/dist/context.d.ts +12 -0
  69. package/dist/context.js +32 -9
  70. package/dist/context.js.map +1 -1
  71. package/dist/index.d.ts +13 -0
  72. package/dist/index.js +367 -133
  73. package/dist/index.js.map +1 -1
  74. package/dist/invocation.d.ts +31 -0
  75. package/dist/invocation.js +58 -0
  76. package/dist/invocation.js.map +1 -0
  77. package/dist/runs-api.js +8 -3
  78. package/dist/runs-api.js.map +1 -1
  79. package/dist/safe-fs.d.ts +18 -0
  80. package/dist/safe-fs.js +57 -0
  81. package/dist/safe-fs.js.map +1 -1
  82. package/dist/secret-form.d.ts +48 -0
  83. package/dist/secret-form.js +212 -0
  84. package/dist/secret-form.js.map +1 -0
  85. package/dist/secret-input.d.ts +96 -0
  86. package/dist/secret-input.js +299 -0
  87. package/dist/secret-input.js.map +1 -0
  88. package/dist/team-connect-api.d.ts +78 -3
  89. package/dist/team-connect-api.js +17 -2
  90. package/dist/team-connect-api.js.map +1 -1
  91. package/dist/team-lifecycle-api.d.ts +435 -0
  92. package/dist/team-lifecycle-api.js +301 -0
  93. package/dist/team-lifecycle-api.js.map +1 -0
  94. package/dist/teams-api.d.ts +13 -1
  95. package/dist/teams-api.js +90 -31
  96. package/dist/teams-api.js.map +1 -1
  97. package/dist/unknown-command.d.ts +18 -0
  98. package/dist/unknown-command.js +50 -0
  99. package/dist/unknown-command.js.map +1 -0
  100. package/dist/workflows-api.d.ts +69 -0
  101. package/dist/workflows-api.js +182 -0
  102. package/dist/workflows-api.js.map +1 -0
  103. package/package.json +3 -3
  104. package/templates/AGENTS.md.tmpl +6 -4
  105. package/templates/claude-skill.md.tmpl +4 -1
  106. package/templates/package.json.tmpl +4 -4
  107. package/templates/skills/build-agent/SKILL.md +56 -22
  108. package/templates/skills/build-agent/references/agent-json.md +4 -1
  109. package/templates/skills/build-agent/references/app-setup.md +14 -7
  110. package/templates/skills/build-agent/references/rollout.md +40 -20
  111. package/templates/skills/build-agent/references/set-up-an-integration.md +46 -29
  112. package/templates/skills/build-agent/references/triggers.md +4 -3
  113. package/templates/skills/build-integration/references/widget-design.md +1 -1
  114. package/templates/skills/ekanos-platform/SKILL.md +77 -23
  115. package/templates/skills/polish-widgets/references/patterns.md +3 -3
@@ -1,5 +1,5 @@
1
1
  import { invalidStateError, usageError } from '../errors.js';
2
- import { createTeam, disconnectTeamIntegration, inviteTeamMember, listTeamMembers, listTeamRoles, removeTeamMember, renameTeam, setTeamMemberRole, } from '../teams-api.js';
2
+ import { addTeamMember, createTeam, disconnectTeamIntegration, inviteTeamMember, listTeamMembers, listTeamRoles, removeTeamMember, renameTeam, setTeamMemberRole, } from '../teams-api.js';
3
3
  import { runTeamConnect } from './teams-connect.js';
4
4
  /**
5
5
  * Onboarding a team from the terminal, for the Source admin: `teams create`,
@@ -16,7 +16,7 @@ export const ONBOARDING_SUBCOMMANDS = [
16
16
  'connect',
17
17
  'disconnect',
18
18
  ];
19
- const MEMBERS_VERBS = ['list', 'invite', 'role', 'remove'];
19
+ const MEMBERS_VERBS = ['list', 'add', 'invite', 'role', 'remove'];
20
20
  export function isOnboardingSubcommand(value) {
21
21
  return ONBOARDING_SUBCOMMANDS.includes(value);
22
22
  }
@@ -54,10 +54,13 @@ export function parseOnboarding(subcommand, rest, flags) {
54
54
  noExtra(extra);
55
55
  const teamSlug = slugOf(team, 'team');
56
56
  const productSlug = slugOf(product, 'product');
57
+ const mine = flags.mine === true;
57
58
  if (!flags.yes) {
58
- throw invalidStateError(`Disconnecting ${productSlug} from ${teamSlug} removes the team's connection and its tokens: every widget, workflow and agent of the team that uses it stops until someone connects it again. The team's own app (its saved fields) stays.`, `Re-run with --yes: ekanos teams disconnect ${teamSlug} ${productSlug} --yes`);
59
+ throw invalidStateError(mine
60
+ ? `Disconnecting your own ${productSlug} connection removes its tokens: anything of ${teamSlug} that acts with your connection — your personal agents, an agent that runs as you — stops until you connect it again.`
61
+ : `Disconnecting ${productSlug} from ${teamSlug} removes the team's connection and its tokens: every widget, workflow and agent of the team that uses it stops until someone connects it again. The team's own app (its saved fields) stays.`, `Re-run with --yes: ekanos teams disconnect ${teamSlug} ${productSlug}${mine ? ' --mine' : ''} --yes`);
59
62
  }
60
- return { kind: 'disconnect', team: teamSlug, product: productSlug };
63
+ return { kind: 'disconnect', team: teamSlug, product: productSlug, mine };
61
64
  }
62
65
  if (subcommand === 'roles') {
63
66
  const [verb, team, ...extra] = rest;
@@ -74,7 +77,7 @@ export function parseOnboarding(subcommand, rest, flags) {
74
77
  if (!match) {
75
78
  throw usageError(verb
76
79
  ? `Unknown teams members subcommand "${verb}".`
77
- : 'teams members needs a subcommand.', 'Run one of: ekanos teams members list <team>, ekanos teams members invite <team> <email> --role <role>, ekanos teams members role <team> <email> <role>, ekanos teams members remove <team> <email> --yes.');
80
+ : 'teams members needs a subcommand.', 'Run one of: ekanos teams members list <team>, ekanos teams members add <team> --self | <email> [--role <role>], ekanos teams members invite <team> <email> --role <role>, ekanos teams members role <team> <email> <role>, ekanos teams members remove <team> <email> --yes, ekanos teams members resend <team> <email>.');
78
81
  }
79
82
  noExtra(extra);
80
83
  if (match === 'list') {
@@ -83,6 +86,17 @@ export function parseOnboarding(subcommand, rest, flags) {
83
86
  return { kind: 'members-list', team: slugOf(team, 'team') };
84
87
  }
85
88
  const teamSlug = slugOf(team, 'team');
89
+ if (match === 'add') {
90
+ if (role !== undefined)
91
+ noExtra([role]);
92
+ if (flags.self === true && email !== undefined) {
93
+ throw usageError('Name one person: --self, or an email.', `Run "ekanos teams members add ${teamSlug} --self" to join it yourself, or "ekanos teams members add ${teamSlug} <email>" for someone who already has an Ekanos account on this Source.`);
94
+ }
95
+ if (flags.self !== true && email === undefined) {
96
+ throw usageError('Name who joins: --self, or an email.', `Run "ekanos teams members add ${teamSlug} --self" to join it yourself.`);
97
+ }
98
+ return Object.assign({ kind: 'members-add', team: teamSlug, target: flags.self === true ? { self: true } : { email: emailOf(email) } }, (flags.role === undefined ? {} : { role: roleOf(flags.role) }));
99
+ }
86
100
  const address = emailOf(email);
87
101
  if (match === 'invite') {
88
102
  if (role !== undefined)
@@ -114,7 +128,7 @@ export function parseOnboarding(subcommand, rest, flags) {
114
128
  return { kind: 'members-remove', team: teamSlug, email: address };
115
129
  }
116
130
  export async function runOnboarding(ctx, args, client, host, source, plan) {
117
- var _a, _b;
131
+ var _a, _b, _c, _d;
118
132
  switch (plan.kind) {
119
133
  case 'create': {
120
134
  const created = await client.call((token) => createTeam(host, token, source, {
@@ -178,7 +192,37 @@ export async function runOnboarding(ctx, args, client, host, source, plan) {
178
192
  tone: rows.length === 0 ? 'warn' : 'ok',
179
193
  rows,
180
194
  notes: [
181
- `"ekanos teams members invite ${list.team.slug} <email> --role <role>" adds one.`,
195
+ `"ekanos teams members add ${list.team.slug} --self" joins it yourself, now; "ekanos teams members add ${list.team.slug} <email>" adds someone already on the Source; "ekanos teams members invite ${list.team.slug} <email> --role <role>" emails anyone else an invitation.`,
196
+ ],
197
+ }));
198
+ }
199
+ case 'members-add': {
200
+ const added = await client.call((token) => addTeamMember(host, token, { source, team: plan.team }, Object.assign(Object.assign({}, plan.target), (plan.role ? { role: plan.role } : {}))));
201
+ const who = added.self
202
+ ? `you${added.member.email ? ` (${added.member.email})` : ''}`
203
+ : ((_a = added.member.email) !== null && _a !== void 0 ? _a : added.member.userId);
204
+ const already = added.outcome === 'already';
205
+ return ctx.succeed(Object.assign({ host }, added), ctx.ui.result({
206
+ title: already
207
+ ? `${added.self ? 'You are' : `${who} is`} already a member of ${added.team.slug}`
208
+ : `Added ${who} to ${added.team.slug}`,
209
+ rows: [
210
+ ['Role', added.member.role],
211
+ ['Status', added.member.status],
212
+ ],
213
+ notes: [
214
+ ...(already && plan.role && plan.role !== added.member.role
215
+ ? [
216
+ `The role was left as ${added.member.role}. Change it: ekanos teams members role ${added.team.slug} ${(_b = added.member.email) !== null && _b !== void 0 ? _b : '<email>'} ${plan.role}`,
217
+ ]
218
+ : []),
219
+ ...(added.withdrawnInvitation
220
+ ? [
221
+ `Their pending invitation${added.withdrawnInvitationRole ? ` (as ${added.withdrawnInvitationRole})` : ''} was withdrawn: the membership replaces it.`,
222
+ ]
223
+ : []),
224
+ ...(already ? [] : ['No email was sent: it takes effect now.']),
225
+ `Connect a product for ${added.self ? 'yourself' : 'the team'}: ekanos teams connect ${added.team.slug} <product>`,
182
226
  ],
183
227
  }));
184
228
  }
@@ -202,7 +246,7 @@ export async function runOnboarding(ctx, args, client, host, source, plan) {
202
246
  ? `${changed.email} is already ${changed.after} on ${changed.team.slug}`
203
247
  : `${changed.email} is now ${changed.after} on ${changed.team.slug}`,
204
248
  rows: [
205
- ['Was', (_a = changed.before) !== null && _a !== void 0 ? _a : '—'],
249
+ ['Was', (_c = changed.before) !== null && _c !== void 0 ? _c : '—'],
206
250
  [
207
251
  'Applies to',
208
252
  changed.kind === 'member'
@@ -222,7 +266,7 @@ export async function runOnboarding(ctx, args, client, host, source, plan) {
222
266
  title: removed.kind === 'member'
223
267
  ? `Removed ${removed.email} from ${removed.team.slug}`
224
268
  : `Withdrew ${removed.email}'s invitation to ${removed.team.slug}`,
225
- rows: [['Role was', (_b = removed.before) !== null && _b !== void 0 ? _b : '—']],
269
+ rows: [['Role was', (_d = removed.before) !== null && _d !== void 0 ? _d : '—']],
226
270
  }));
227
271
  }
228
272
  case 'roles-list': {
@@ -243,11 +287,16 @@ export async function runOnboarding(ctx, args, client, host, source, plan) {
243
287
  source,
244
288
  team: plan.team,
245
289
  product: plan.product,
290
+ mine: plan.mine,
246
291
  }));
247
- return ctx.succeed(Object.assign({ host }, done), ctx.ui.result({
248
- title: done.wasConnected
249
- ? `Disconnected ${done.product.name} from ${done.team.slug}`
250
- : `${done.team.slug} had no ${done.product.name} connection; cleared what was left`,
292
+ return ctx.succeed(Object.assign(Object.assign({ host }, done), (plan.mine ? { mine: true } : {})), ctx.ui.result({
293
+ title: plan.mine
294
+ ? done.wasConnected
295
+ ? `Disconnected your own ${done.product.name} connection`
296
+ : `You had no ${done.product.name} connection; cleared what was left`
297
+ : done.wasConnected
298
+ ? `Disconnected ${done.product.name} from ${done.team.slug}`
299
+ : `${done.team.slug} had no ${done.product.name} connection; cleared what was left`,
251
300
  tone: 'warn',
252
301
  notes: [
253
302
  `Connect it again with "ekanos teams connect ${done.team.slug} ${done.product.slug}".`,
@@ -1 +1 @@
1
- {"version":3,"file":"teams-onboard.js","sourceRoot":"","sources":["../../src/commands/teams-onboard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,EACL,UAA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zC,IAAI,IAAI,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3D,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,+EAA+E;QACjF,CAAC,CAAC,kFAAkF,CACvF,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,KAAyB;IACxC,MAAM,KAAK,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,GAAG,WAAW,EAAE,CAAC;IAC1C,IAAI,KAAK,IAAI,4BAA4B,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACpE,MAAM,UAAU,CACd,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,4BAA4B,CAAC,CAAC,CAAC,2BAA2B,EAC3E,yEAAyE,CAC1E,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,KAAa;IAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACxC,IAAI,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,MAAM,UAAU,CACd,IAAI,KAAK,uBAAuB,EAChC,oEAAoE,CACrE,CAAC;AACJ,CAAC","sourcesContent":["import type { CliContext } from '../context';\nimport { invalidStateError, usageError } from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport {\n createTeam,\n disconnectTeamIntegration,\n inviteTeamMember,\n listTeamMembers,\n listTeamRoles,\n removeTeamMember,\n renameTeam,\n setTeamMemberRole,\n} from '../teams-api';\nimport type { TeamsArgs, TeamsClient } from './teams';\nimport { runTeamConnect } from './teams-connect';\n\n/**\n * Onboarding a team from the terminal, for the Source admin: `teams create`,\n * `teams members list|invite|role|remove`, `teams roles list`,\n * `teams connect` and `teams disconnect`. Parsed before any session is touched (`parseOnboarding`)\n * so a usage error never costs a network round-trip, then run against the\n * session `runTeams` resolved.\n */\n\nexport const ONBOARDING_SUBCOMMANDS = [\n 'create',\n 'rename',\n 'members',\n 'roles',\n 'connect',\n 'disconnect',\n] as const;\nexport type OnboardingSubcommand = (typeof ONBOARDING_SUBCOMMANDS)[number];\n\nexport interface OnboardingFlags {\n slug?: string;\n owner?: string;\n role?: string;\n /** `connect --as <member-email>`: the member who signs in. */\n as?: string;\n yes: boolean;\n}\n\nexport type OnboardingPlan =\n | { kind: 'create'; name: string; slug?: string; ownerEmail?: string }\n | { kind: 'rename'; team: string; name: string }\n | { kind: 'members-list'; team: string }\n | { kind: 'members-invite'; team: string; email: string; role: string }\n | { kind: 'members-role'; team: string; email: string; role: string }\n | { kind: 'members-remove'; team: string; email: string }\n | { kind: 'roles-list'; team: string }\n | { kind: 'connect'; team: string; product: string; as?: string }\n | { kind: 'disconnect'; team: string; product: string };\n\nconst MEMBERS_VERBS = ['list', 'invite', 'role', 'remove'] as const;\n\nexport function isOnboardingSubcommand(\n value: string,\n): value is OnboardingSubcommand {\n return (ONBOARDING_SUBCOMMANDS as readonly string[]).includes(value);\n}\n\nexport function parseOnboarding(\n subcommand: OnboardingSubcommand,\n rest: readonly string[],\n flags: OnboardingFlags,\n): OnboardingPlan {\n if (subcommand === 'create') {\n const [name, ...extra] = rest;\n if (!name?.trim()) {\n throw usageError(\n 'Name the team.',\n 'Run \"ekanos teams create \\\\\"Bank A\\\\\" [--slug bank-a] [--owner <email>]\".',\n );\n }\n noExtra(extra);\n return {\n kind: 'create',\n name: name.trim(),\n slug: flags.slug === undefined ? undefined : slugOf(flags.slug, 'team'),\n ownerEmail: flags.owner === undefined ? undefined : emailOf(flags.owner),\n };\n }\n\n if (subcommand === 'rename') {\n const [team, name, ...extra] = rest;\n const teamSlug = slugOf(team, 'team');\n if (!name?.trim()) {\n throw usageError(\n 'Name the team’s new name.',\n `Run \"ekanos teams rename ${teamSlug} \\\\\"Bank A Support\\\\\"\".`,\n );\n }\n noExtra(extra);\n return { kind: 'rename', team: teamSlug, name: name.trim() };\n }\n\n if (subcommand === 'connect') {\n const [team, product, ...extra] = rest;\n noExtra(extra);\n return {\n kind: 'connect',\n team: slugOf(team, 'team'),\n product: slugOf(product, 'product'),\n ...(flags.as === undefined ? {} : { as: emailOf(flags.as) }),\n };\n }\n\n if (subcommand === 'disconnect') {\n const [team, product, ...extra] = rest;\n noExtra(extra);\n const teamSlug = slugOf(team, 'team');\n const productSlug = slugOf(product, 'product');\n if (!flags.yes) {\n throw invalidStateError(\n `Disconnecting ${productSlug} from ${teamSlug} removes the team's connection and its tokens: every widget, workflow and agent of the team that uses it stops until someone connects it again. The team's own app (its saved fields) stays.`,\n `Re-run with --yes: ekanos teams disconnect ${teamSlug} ${productSlug} --yes`,\n );\n }\n return { kind: 'disconnect', team: teamSlug, product: productSlug };\n }\n\n if (subcommand === 'roles') {\n const [verb, team, ...extra] = rest;\n if (verb !== 'list') {\n throw usageError(\n verb\n ? `Unknown teams roles subcommand \"${verb}\".`\n : 'teams roles needs a subcommand.',\n 'Run \"ekanos teams roles list <team>\".',\n );\n }\n noExtra(extra);\n return { kind: 'roles-list', team: slugOf(team, 'team') };\n }\n\n const [verb, team, email, role, ...extra] = rest;\n const match = MEMBERS_VERBS.find((name) => name === verb);\n if (!match) {\n throw usageError(\n verb\n ? `Unknown teams members subcommand \"${verb}\".`\n : 'teams members needs a subcommand.',\n 'Run one of: ekanos teams members list <team>, ekanos teams members invite <team> <email> --role <role>, ekanos teams members role <team> <email> <role>, ekanos teams members remove <team> <email> --yes.',\n );\n }\n noExtra(extra);\n\n if (match === 'list') {\n if (email !== undefined) noExtra([email]);\n return { kind: 'members-list', team: slugOf(team, 'team') };\n }\n\n const teamSlug = slugOf(team, 'team');\n const address = emailOf(email);\n\n if (match === 'invite') {\n if (role !== undefined) noExtra([role]);\n return {\n kind: 'members-invite',\n team: teamSlug,\n email: address,\n role: roleOf(flags.role ?? 'member'),\n };\n }\n\n if (match === 'role') {\n const named = role ?? flags.role;\n if (!named) {\n throw usageError(\n 'Name the new role.',\n `Run \"ekanos teams members role ${teamSlug} ${address} <role>\"; \"ekanos teams roles list ${teamSlug}\" lists them.`,\n );\n }\n return {\n kind: 'members-role',\n team: teamSlug,\n email: address,\n role: roleOf(named),\n };\n }\n\n if (role !== undefined) noExtra([role]);\n if (!flags.yes) {\n throw invalidStateError(\n `Removing ${address} from ${teamSlug} ends their access to the team (a pending invitation is withdrawn instead).`,\n `Re-run with --yes: ekanos teams members remove ${teamSlug} ${address} --yes`,\n );\n }\n return { kind: 'members-remove', team: teamSlug, email: address };\n}\n\nexport async function runOnboarding(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n source: string,\n plan: OnboardingPlan,\n): Promise<ExitCode> {\n switch (plan.kind) {\n case 'create': {\n const created = await client.call((token) =>\n createTeam(host, token, source, {\n name: plan.name,\n slug: plan.slug,\n ownerEmail: plan.ownerEmail,\n }),\n );\n return ctx.succeed(\n { host, ...created },\n ctx.ui.result({\n title: `Created team ${created.team.slug}`,\n rows: [\n ['Name', created.team.name],\n ['Source', created.source.slug],\n [\n 'Owner',\n created.owner.kind === 'caller'\n ? `you${created.owner.email ? ` (${created.owner.email})` : ''}`\n : `${created.owner.email} — invited; ownership moves to them on accept`,\n ],\n ['Team home', created.teamUrl],\n ],\n notes: [\n `Next: \"ekanos teams members invite ${created.team.slug} <email> --role <role>\" (\"ekanos teams roles list ${created.team.slug}\" lists the roles).`,\n `Then \"ekanos teams connect ${created.team.slug} <product>\" connects an integration for the team.`,\n ],\n }),\n );\n }\n\n case 'rename': {\n const renamed = await client.call((token) =>\n renameTeam(host, token, { source, team: plan.team }, plan.name),\n );\n const moved = renamed.team.slug !== renamed.previous.slug;\n return ctx.succeed(\n { host, ...renamed },\n ctx.ui.result({\n title:\n renamed.team.name === renamed.previous.name\n ? `${renamed.team.slug} is already named ${renamed.team.name}`\n : `Renamed ${renamed.previous.slug} to ${renamed.team.name}`,\n rows: [\n ['Name', renamed.team.name],\n ['Slug', renamed.team.slug],\n ['Team home', renamed.teamUrl],\n ],\n notes: moved\n ? [\n `The slug followed the name: use \"${renamed.team.slug}\" from now on. Links and scripts naming \"${renamed.previous.slug}\" no longer reach the team.`,\n ]\n : [],\n tone: moved ? 'warn' : 'ok',\n }),\n );\n }\n\n case 'members-list': {\n const list = await client.call((token) =>\n listTeamMembers(host, token, { source, team: plan.team }),\n );\n const rows: [string, string][] = list.members.map((member) => [\n member.email ?? member.userId,\n `${member.role}${member.primaryOwner ? ' · primary owner' : ''}${member.status === 'active' ? '' : ` · ${member.status}`}${member.name ? ` · ${member.name}` : ''}`,\n ]);\n for (const invitation of list.invitations) {\n rows.push([\n invitation.email,\n `${invitation.role} · invited, expires ${invitation.expiresAt.slice(0, 10)}`,\n ]);\n }\n return ctx.succeed(\n { host, ...list },\n ctx.ui.result({\n title: `Members of ${list.team.slug} (${list.team.name})`,\n tone: rows.length === 0 ? 'warn' : 'ok',\n rows,\n notes: [\n `\"ekanos teams members invite ${list.team.slug} <email> --role <role>\" adds one.`,\n ],\n }),\n );\n }\n\n case 'members-invite': {\n const invited = await client.call((token) =>\n inviteTeamMember(\n host,\n token,\n { source, team: plan.team },\n { email: plan.email, role: plan.role },\n ),\n );\n return ctx.succeed(\n { host, ...invited },\n ctx.ui.result({\n title: `Invited ${invited.invitation.email} to ${invited.team.slug}`,\n rows: [\n ['Role', invited.invitation.role],\n ['Expires', invited.invitation.expiresAt.slice(0, 10)],\n ],\n notes: [\n 'The invitation email is on its way; they join when they accept it.',\n ],\n }),\n );\n }\n\n case 'members-role': {\n const changed = await client.call((token) =>\n setTeamMemberRole(\n host,\n token,\n { source, team: plan.team, email: plan.email },\n plan.role,\n ),\n );\n return ctx.succeed(\n { host, ...changed },\n ctx.ui.result({\n title:\n changed.before === changed.after\n ? `${changed.email} is already ${changed.after} on ${changed.team.slug}`\n : `${changed.email} is now ${changed.after} on ${changed.team.slug}`,\n rows: [\n ['Was', changed.before ?? '—'],\n [\n 'Applies to',\n changed.kind === 'member'\n ? 'their membership'\n : 'their pending invitation',\n ],\n ],\n }),\n );\n }\n\n case 'members-remove': {\n const removed = await client.call((token) =>\n removeTeamMember(host, token, {\n source,\n team: plan.team,\n email: plan.email,\n }),\n );\n return ctx.succeed(\n { host, ...removed },\n ctx.ui.result({\n title:\n removed.kind === 'member'\n ? `Removed ${removed.email} from ${removed.team.slug}`\n : `Withdrew ${removed.email}'s invitation to ${removed.team.slug}`,\n rows: [['Role was', removed.before ?? '—']],\n }),\n );\n }\n\n case 'roles-list': {\n const roles = await client.call((token) =>\n listTeamRoles(host, token, { source, team: plan.team }),\n );\n return ctx.succeed(\n { host, ...roles },\n ctx.ui.result({\n title: `Roles on ${roles.team.slug}`,\n rows: roles.roles.map((role) => [\n `${role.name} (${role.displayName})`,\n role.permissions.length > 0 ? role.permissions : ['no permissions'],\n ]),\n notes: [\n 'Lower roles are listed last. Give one with \"ekanos teams members role <team> <email> <role>\".',\n ],\n }),\n );\n }\n\n case 'disconnect': {\n const done = await client.call((token) =>\n disconnectTeamIntegration(host, token, {\n source,\n team: plan.team,\n product: plan.product,\n }),\n );\n return ctx.succeed(\n { host, ...done },\n ctx.ui.result({\n title: done.wasConnected\n ? `Disconnected ${done.product.name} from ${done.team.slug}`\n : `${done.team.slug} had no ${done.product.name} connection; cleared what was left`,\n tone: 'warn',\n notes: [\n `Connect it again with \"ekanos teams connect ${done.team.slug} ${done.product.slug}\".`,\n ],\n }),\n );\n }\n\n case 'connect':\n return runTeamConnect(ctx, args, client, host, source, {\n team: plan.team,\n product: plan.product,\n as: plan.as,\n ...(args.connection ? { connection: args.connection } : {}),\n });\n }\n}\n\nfunction noExtra(extra: readonly string[]) {\n if (extra.length > 0) {\n throw usageError(\n `Unexpected argument \"${extra[0]}\".`,\n 'See \"ekanos teams --help\".',\n );\n }\n}\n\nfunction slugOf(value: string | undefined, what: 'team' | 'product'): string {\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 members list bank-a\".'\n : '\"ekanos catalog\" lists the products, e.g. \"ekanos teams connect bank-a zendesk\".',\n );\n}\n\nfunction emailOf(value: string | undefined): string {\n const email = value?.trim().toLowerCase();\n if (email && /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)) return email;\n throw usageError(\n value ? `\"${value}\" is not an email address.` : 'Name the person by email.',\n 'e.g. \"ekanos teams members invite bank-a ana@bank-a.com --role member\".',\n );\n}\n\nfunction roleOf(value: string): string {\n const role = value.trim().toLowerCase();\n if (/^[a-z][a-z0-9_-]{0,49}$/.test(role)) return role;\n throw usageError(\n `\"${value}\" is not a role name.`,\n '\"ekanos teams roles list <team>\" lists the roles this Source uses.',\n );\n}\n"]}
1
+ {"version":3,"file":"teams-onboard.js","sourceRoot":"","sources":["../../src/commands/teams-onboard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,EACL,aAAa,EACb,UAAU,EACV,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,YAAY;CACJ,CAAC;AAiCX,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAE3E,MAAM,UAAU,sBAAsB,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AC,CAAC,2BAA2B,EAC3E,yEAAyE,CAC1E,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,KAAa;IAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACxC,IAAI,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,MAAM,UAAU,CACd,IAAI,KAAK,uBAAuB,EAChC,oEAAoE,CACrE,CAAC;AACJ,CAAC","sourcesContent":["import type { CliContext } from '../context';\nimport { invalidStateError, usageError } from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport {\n addTeamMember,\n createTeam,\n disconnectTeamIntegration,\n inviteTeamMember,\n listTeamMembers,\n listTeamRoles,\n removeTeamMember,\n renameTeam,\n setTeamMemberRole,\n} from '../teams-api';\nimport type { TeamsArgs, TeamsClient } from './teams';\nimport { runTeamConnect } from './teams-connect';\n\n/**\n * Onboarding a team from the terminal, for the Source admin: `teams create`,\n * `teams members list|invite|role|remove`, `teams roles list`,\n * `teams connect` and `teams disconnect`. Parsed before any session is touched (`parseOnboarding`)\n * so a usage error never costs a network round-trip, then run against the\n * session `runTeams` resolved.\n */\n\nexport const ONBOARDING_SUBCOMMANDS = [\n 'create',\n 'rename',\n 'members',\n 'roles',\n 'connect',\n 'disconnect',\n] as const;\nexport type OnboardingSubcommand = (typeof ONBOARDING_SUBCOMMANDS)[number];\n\nexport interface OnboardingFlags {\n slug?: string;\n owner?: string;\n role?: string;\n /** `connect --as <member-email>`: the member who signs in. */\n as?: string;\n /** `members add --self`: the caller joins. */\n self?: boolean;\n /** `disconnect --mine`: the caller's own personal connection. */\n mine?: boolean;\n yes: boolean;\n}\n\nexport type OnboardingPlan =\n | { kind: 'create'; name: string; slug?: string; ownerEmail?: string }\n | { kind: 'rename'; team: string; name: string }\n | { kind: 'members-list'; team: string }\n | { kind: 'members-invite'; team: string; email: string; role: string }\n | {\n kind: 'members-add';\n team: string;\n target: { self: true } | { email: string };\n role?: string;\n }\n | { kind: 'members-role'; team: string; email: string; role: string }\n | { kind: 'members-remove'; team: string; email: string }\n | { kind: 'roles-list'; team: string }\n | { kind: 'connect'; team: string; product: string; as?: string }\n | { kind: 'disconnect'; team: string; product: string; mine: boolean };\n\nconst MEMBERS_VERBS = ['list', 'add', 'invite', 'role', 'remove'] as const;\n\nexport function isOnboardingSubcommand(\n value: string,\n): value is OnboardingSubcommand {\n return (ONBOARDING_SUBCOMMANDS as readonly string[]).includes(value);\n}\n\nexport function parseOnboarding(\n subcommand: OnboardingSubcommand,\n rest: readonly string[],\n flags: OnboardingFlags,\n): OnboardingPlan {\n if (subcommand === 'create') {\n const [name, ...extra] = rest;\n if (!name?.trim()) {\n throw usageError(\n 'Name the team.',\n 'Run \"ekanos teams create \\\\\"Bank A\\\\\" [--slug bank-a] [--owner <email>]\".',\n );\n }\n noExtra(extra);\n return {\n kind: 'create',\n name: name.trim(),\n slug: flags.slug === undefined ? undefined : slugOf(flags.slug, 'team'),\n ownerEmail: flags.owner === undefined ? undefined : emailOf(flags.owner),\n };\n }\n\n if (subcommand === 'rename') {\n const [team, name, ...extra] = rest;\n const teamSlug = slugOf(team, 'team');\n if (!name?.trim()) {\n throw usageError(\n 'Name the team’s new name.',\n `Run \"ekanos teams rename ${teamSlug} \\\\\"Bank A Support\\\\\"\".`,\n );\n }\n noExtra(extra);\n return { kind: 'rename', team: teamSlug, name: name.trim() };\n }\n\n if (subcommand === 'connect') {\n const [team, product, ...extra] = rest;\n noExtra(extra);\n return {\n kind: 'connect',\n team: slugOf(team, 'team'),\n product: slugOf(product, 'product'),\n ...(flags.as === undefined ? {} : { as: emailOf(flags.as) }),\n };\n }\n\n if (subcommand === 'disconnect') {\n const [team, product, ...extra] = rest;\n noExtra(extra);\n const teamSlug = slugOf(team, 'team');\n const productSlug = slugOf(product, 'product');\n const mine = flags.mine === true;\n if (!flags.yes) {\n throw invalidStateError(\n mine\n ? `Disconnecting your own ${productSlug} connection removes its tokens: anything of ${teamSlug} that acts with your connection — your personal agents, an agent that runs as you — stops until you connect it again.`\n : `Disconnecting ${productSlug} from ${teamSlug} removes the team's connection and its tokens: every widget, workflow and agent of the team that uses it stops until someone connects it again. The team's own app (its saved fields) stays.`,\n `Re-run with --yes: ekanos teams disconnect ${teamSlug} ${productSlug}${mine ? ' --mine' : ''} --yes`,\n );\n }\n return { kind: 'disconnect', team: teamSlug, product: productSlug, mine };\n }\n\n if (subcommand === 'roles') {\n const [verb, team, ...extra] = rest;\n if (verb !== 'list') {\n throw usageError(\n verb\n ? `Unknown teams roles subcommand \"${verb}\".`\n : 'teams roles needs a subcommand.',\n 'Run \"ekanos teams roles list <team>\".',\n );\n }\n noExtra(extra);\n return { kind: 'roles-list', team: slugOf(team, 'team') };\n }\n\n const [verb, team, email, role, ...extra] = rest;\n const match = MEMBERS_VERBS.find((name) => name === verb);\n if (!match) {\n throw usageError(\n verb\n ? `Unknown teams members subcommand \"${verb}\".`\n : 'teams members needs a subcommand.',\n 'Run one of: ekanos teams members list <team>, ekanos teams members add <team> --self | <email> [--role <role>], ekanos teams members invite <team> <email> --role <role>, ekanos teams members role <team> <email> <role>, ekanos teams members remove <team> <email> --yes, ekanos teams members resend <team> <email>.',\n );\n }\n noExtra(extra);\n\n if (match === 'list') {\n if (email !== undefined) noExtra([email]);\n return { kind: 'members-list', team: slugOf(team, 'team') };\n }\n\n const teamSlug = slugOf(team, 'team');\n\n if (match === 'add') {\n if (role !== undefined) noExtra([role]);\n if (flags.self === true && email !== undefined) {\n throw usageError(\n 'Name one person: --self, or an email.',\n `Run \"ekanos teams members add ${teamSlug} --self\" to join it yourself, or \"ekanos teams members add ${teamSlug} <email>\" for someone who already has an Ekanos account on this Source.`,\n );\n }\n if (flags.self !== true && email === undefined) {\n throw usageError(\n 'Name who joins: --self, or an email.',\n `Run \"ekanos teams members add ${teamSlug} --self\" to join it yourself.`,\n );\n }\n return {\n kind: 'members-add',\n team: teamSlug,\n target: flags.self === true ? { self: true } : { email: emailOf(email) },\n ...(flags.role === undefined ? {} : { role: roleOf(flags.role) }),\n };\n }\n\n const address = emailOf(email);\n\n if (match === 'invite') {\n if (role !== undefined) noExtra([role]);\n return {\n kind: 'members-invite',\n team: teamSlug,\n email: address,\n role: roleOf(flags.role ?? 'member'),\n };\n }\n\n if (match === 'role') {\n const named = role ?? flags.role;\n if (!named) {\n throw usageError(\n 'Name the new role.',\n `Run \"ekanos teams members role ${teamSlug} ${address} <role>\"; \"ekanos teams roles list ${teamSlug}\" lists them.`,\n );\n }\n return {\n kind: 'members-role',\n team: teamSlug,\n email: address,\n role: roleOf(named),\n };\n }\n\n if (role !== undefined) noExtra([role]);\n if (!flags.yes) {\n throw invalidStateError(\n `Removing ${address} from ${teamSlug} ends their access to the team (a pending invitation is withdrawn instead).`,\n `Re-run with --yes: ekanos teams members remove ${teamSlug} ${address} --yes`,\n );\n }\n return { kind: 'members-remove', team: teamSlug, email: address };\n}\n\nexport async function runOnboarding(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n source: string,\n plan: OnboardingPlan,\n): Promise<ExitCode> {\n switch (plan.kind) {\n case 'create': {\n const created = await client.call((token) =>\n createTeam(host, token, source, {\n name: plan.name,\n slug: plan.slug,\n ownerEmail: plan.ownerEmail,\n }),\n );\n return ctx.succeed(\n { host, ...created },\n ctx.ui.result({\n title: `Created team ${created.team.slug}`,\n rows: [\n ['Name', created.team.name],\n ['Source', created.source.slug],\n [\n 'Owner',\n created.owner.kind === 'caller'\n ? `you${created.owner.email ? ` (${created.owner.email})` : ''}`\n : `${created.owner.email} — invited; ownership moves to them on accept`,\n ],\n ['Team home', created.teamUrl],\n ],\n notes: [\n `Next: \"ekanos teams members invite ${created.team.slug} <email> --role <role>\" (\"ekanos teams roles list ${created.team.slug}\" lists the roles).`,\n `Then \"ekanos teams connect ${created.team.slug} <product>\" connects an integration for the team.`,\n ],\n }),\n );\n }\n\n case 'rename': {\n const renamed = await client.call((token) =>\n renameTeam(host, token, { source, team: plan.team }, plan.name),\n );\n const moved = renamed.team.slug !== renamed.previous.slug;\n return ctx.succeed(\n { host, ...renamed },\n ctx.ui.result({\n title:\n renamed.team.name === renamed.previous.name\n ? `${renamed.team.slug} is already named ${renamed.team.name}`\n : `Renamed ${renamed.previous.slug} to ${renamed.team.name}`,\n rows: [\n ['Name', renamed.team.name],\n ['Slug', renamed.team.slug],\n ['Team home', renamed.teamUrl],\n ],\n notes: moved\n ? [\n `The slug followed the name: use \"${renamed.team.slug}\" from now on. Links and scripts naming \"${renamed.previous.slug}\" no longer reach the team.`,\n ]\n : [],\n tone: moved ? 'warn' : 'ok',\n }),\n );\n }\n\n case 'members-list': {\n const list = await client.call((token) =>\n listTeamMembers(host, token, { source, team: plan.team }),\n );\n const rows: [string, string][] = list.members.map((member) => [\n member.email ?? member.userId,\n `${member.role}${member.primaryOwner ? ' · primary owner' : ''}${member.status === 'active' ? '' : ` · ${member.status}`}${member.name ? ` · ${member.name}` : ''}`,\n ]);\n for (const invitation of list.invitations) {\n rows.push([\n invitation.email,\n `${invitation.role} · invited, expires ${invitation.expiresAt.slice(0, 10)}`,\n ]);\n }\n return ctx.succeed(\n { host, ...list },\n ctx.ui.result({\n title: `Members of ${list.team.slug} (${list.team.name})`,\n tone: rows.length === 0 ? 'warn' : 'ok',\n rows,\n notes: [\n `\"ekanos teams members add ${list.team.slug} --self\" joins it yourself, now; \"ekanos teams members add ${list.team.slug} <email>\" adds someone already on the Source; \"ekanos teams members invite ${list.team.slug} <email> --role <role>\" emails anyone else an invitation.`,\n ],\n }),\n );\n }\n\n case 'members-add': {\n const added = await client.call((token) =>\n addTeamMember(\n host,\n token,\n { source, team: plan.team },\n { ...plan.target, ...(plan.role ? { role: plan.role } : {}) },\n ),\n );\n const who = added.self\n ? `you${added.member.email ? ` (${added.member.email})` : ''}`\n : (added.member.email ?? added.member.userId);\n const already = added.outcome === 'already';\n return ctx.succeed(\n { host, ...added },\n ctx.ui.result({\n title: already\n ? `${added.self ? 'You are' : `${who} is`} already a member of ${added.team.slug}`\n : `Added ${who} to ${added.team.slug}`,\n rows: [\n ['Role', added.member.role],\n ['Status', added.member.status],\n ],\n notes: [\n ...(already && plan.role && plan.role !== added.member.role\n ? [\n `The role was left as ${added.member.role}. Change it: ekanos teams members role ${added.team.slug} ${added.member.email ?? '<email>'} ${plan.role}`,\n ]\n : []),\n ...(added.withdrawnInvitation\n ? [\n `Their pending invitation${added.withdrawnInvitationRole ? ` (as ${added.withdrawnInvitationRole})` : ''} was withdrawn: the membership replaces it.`,\n ]\n : []),\n ...(already ? [] : ['No email was sent: it takes effect now.']),\n `Connect a product for ${added.self ? 'yourself' : 'the team'}: ekanos teams connect ${added.team.slug} <product>`,\n ],\n }),\n );\n }\n\n case 'members-invite': {\n const invited = await client.call((token) =>\n inviteTeamMember(\n host,\n token,\n { source, team: plan.team },\n { email: plan.email, role: plan.role },\n ),\n );\n return ctx.succeed(\n { host, ...invited },\n ctx.ui.result({\n title: `Invited ${invited.invitation.email} to ${invited.team.slug}`,\n rows: [\n ['Role', invited.invitation.role],\n ['Expires', invited.invitation.expiresAt.slice(0, 10)],\n ],\n notes: [\n 'The invitation email is on its way; they join when they accept it.',\n ],\n }),\n );\n }\n\n case 'members-role': {\n const changed = await client.call((token) =>\n setTeamMemberRole(\n host,\n token,\n { source, team: plan.team, email: plan.email },\n plan.role,\n ),\n );\n return ctx.succeed(\n { host, ...changed },\n ctx.ui.result({\n title:\n changed.before === changed.after\n ? `${changed.email} is already ${changed.after} on ${changed.team.slug}`\n : `${changed.email} is now ${changed.after} on ${changed.team.slug}`,\n rows: [\n ['Was', changed.before ?? '—'],\n [\n 'Applies to',\n changed.kind === 'member'\n ? 'their membership'\n : 'their pending invitation',\n ],\n ],\n }),\n );\n }\n\n case 'members-remove': {\n const removed = await client.call((token) =>\n removeTeamMember(host, token, {\n source,\n team: plan.team,\n email: plan.email,\n }),\n );\n return ctx.succeed(\n { host, ...removed },\n ctx.ui.result({\n title:\n removed.kind === 'member'\n ? `Removed ${removed.email} from ${removed.team.slug}`\n : `Withdrew ${removed.email}'s invitation to ${removed.team.slug}`,\n rows: [['Role was', removed.before ?? '—']],\n }),\n );\n }\n\n case 'roles-list': {\n const roles = await client.call((token) =>\n listTeamRoles(host, token, { source, team: plan.team }),\n );\n return ctx.succeed(\n { host, ...roles },\n ctx.ui.result({\n title: `Roles on ${roles.team.slug}`,\n rows: roles.roles.map((role) => [\n `${role.name} (${role.displayName})`,\n role.permissions.length > 0 ? role.permissions : ['no permissions'],\n ]),\n notes: [\n 'Lower roles are listed last. Give one with \"ekanos teams members role <team> <email> <role>\".',\n ],\n }),\n );\n }\n\n case 'disconnect': {\n const done = await client.call((token) =>\n disconnectTeamIntegration(host, token, {\n source,\n team: plan.team,\n product: plan.product,\n mine: plan.mine,\n }),\n );\n return ctx.succeed(\n { host, ...done, ...(plan.mine ? { mine: true } : {}) },\n ctx.ui.result({\n title: plan.mine\n ? done.wasConnected\n ? `Disconnected your own ${done.product.name} connection`\n : `You had no ${done.product.name} connection; cleared what was left`\n : done.wasConnected\n ? `Disconnected ${done.product.name} from ${done.team.slug}`\n : `${done.team.slug} had no ${done.product.name} connection; cleared what was left`,\n tone: 'warn',\n notes: [\n `Connect it again with \"ekanos teams connect ${done.team.slug} ${done.product.slug}\".`,\n ],\n }),\n );\n }\n\n case 'connect':\n return runTeamConnect(ctx, args, client, host, source, {\n team: plan.team,\n product: plan.product,\n as: plan.as,\n ...(args.connection ? { connection: args.connection } : {}),\n });\n }\n}\n\nfunction noExtra(extra: readonly string[]) {\n if (extra.length > 0) {\n throw usageError(\n `Unexpected argument \"${extra[0]}\".`,\n 'See \"ekanos teams --help\".',\n );\n }\n}\n\nfunction slugOf(value: string | undefined, what: 'team' | 'product'): string {\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 members list bank-a\".'\n : '\"ekanos catalog\" lists the products, e.g. \"ekanos teams connect bank-a zendesk\".',\n );\n}\n\nfunction emailOf(value: string | undefined): string {\n const email = value?.trim().toLowerCase();\n if (email && /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)) return email;\n throw usageError(\n value ? `\"${value}\" is not an email address.` : 'Name the person by email.',\n 'e.g. \"ekanos teams members invite bank-a ana@bank-a.com --role member\".',\n );\n}\n\nfunction roleOf(value: string): string {\n const role = value.trim().toLowerCase();\n if (/^[a-z][a-z0-9_-]{0,49}$/.test(role)) return role;\n throw usageError(\n `\"${value}\" is not a role name.`,\n '\"ekanos teams roles list <team>\" lists the roles this Source uses.',\n );\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { SourceCatalogSchema, TeamAgentListSchema, } from '@ekanos/integration-schema';
2
2
  import { notFoundError } from '../errors.js';
3
+ import { cli } from '../invocation.js';
3
4
  import { call, listTeams, showTeamIntegration } from '../teams-api.js';
4
5
  import { scopeFix, scopeHiddenWords } from './scope-notice.js';
5
6
  import { REASON_WORDS, agentReadiness, liveLine, requirementFix, } from './team-agent-readiness.js';
@@ -30,7 +31,10 @@ export async function runTeamOverview(ctx, client, host, source, team) {
30
31
  if (!ref) {
31
32
  throw notFoundError(`No team "${team}" on ${teams.source.slug}.`, 'Run "ekanos teams list" to see the teams on this Source.');
32
33
  }
33
- const integrations = catalog.products.filter((product) => product.kind === 'integration' && product.availability === 'enabled');
34
+ const integrations = catalog.products.filter((product) => product.kind === 'integration' &&
35
+ product.availability === 'enabled' &&
36
+ // A catalog row with no package on this host has no team status to read.
37
+ product.registered !== false);
34
38
  const statuses = await inBatches(integrations, 4, (product) => client.call((token) => showTeamIntegration(host, token, {
35
39
  source,
36
40
  team,
@@ -84,7 +88,7 @@ export async function runTeamOverview(ctx, client, host, source, team) {
84
88
  'Agents',
85
89
  ...(agentRows.length === 0
86
90
  ? [' none provided']
87
- : agentRows.map((row, index) => { var _a; return ` ${pad(row.key)} ${liveLine(row.readiness, (_a = agents.agents[index]) === null || _a === void 0 ? void 0 : _a.agent)}${row.readiness.next ? ` · Next: ${row.readiness.next}` : ''}`; })),
91
+ : agentRows.map((row) => ` ${pad(row.key)} ${liveLine(row.readiness)}${row.readiness.next ? ` · Next: ${row.readiness.next}` : ''}`)),
88
92
  '',
89
93
  `"ekanos teams agents show ${team} <key>" explains one agent; "ekanos teams show ${team} <product>" one integration.`,
90
94
  ].join('\n'));
@@ -135,7 +139,7 @@ function integrationLine(product, status, need, target) {
135
139
  }
136
140
  return {
137
141
  state: `✗ not connected${webhookNote}`,
138
- fix: `npx @ekanos/cli teams connect ${target.team} ${product.slug} --source ${target.source}`,
142
+ fix: `${cli()} teams connect ${target.team} ${product.slug} --source ${target.source}`,
139
143
  };
140
144
  }
141
145
  /** A product the team's scopes hide from it in the app says so, whatever else is true. */
@@ -1 +1 @@
1
- {"version":3,"file":"teams-overview.js","sourceRoot":"","sources":["../../src/commands/teams-overview.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EACnB,mBAAmB,GAEpB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EACL,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,cAAc,GACf,MAAM,wBAAwB,CAAC;AAGhC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAe,EACf,MAAmB,EACnB,IAAY,EACZ,MAAc,EACd,IAAY;;;IAEZ,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACjD,MAAM,CAAC,IAAI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ACjB,CAAC","sourcesContent":["import {\n type CatalogProduct,\n type Requirement,\n SourceCatalogSchema,\n TeamAgentListSchema,\n type TeamIntegrationStatus,\n} from '@ekanos/integration-schema';\n\nimport type { CliContext } from '../context';\nimport { notFoundError } from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport { call, listTeams, showTeamIntegration } from '../teams-api';\nimport { scopeFix, scopeHiddenWords } from './scope-notice';\nimport {\n REASON_WORDS,\n agentReadiness,\n liveLine,\n requirementFix,\n} from './team-agent-readiness';\nimport type { TeamsClient } from './teams';\n\n/**\n * `ekanos teams show <team>` with no product: one screen per team (CLI audit\n * P1-7) — its members, one line per Integration the Source has enabled (whose\n * connection, or the step to make it), and one line per provided agent with\n * the same verdict as `teams agents show`. Reads the team list, the Source\n * catalog, the team's agents, and each enabled Integration's status.\n */\nexport async function runTeamOverview(\n ctx: CliContext,\n client: TeamsClient,\n host: string,\n source: string,\n team: string,\n): Promise<ExitCode> {\n const [teams, catalog, agents] = await Promise.all([\n client.call((token) => listTeams(host, token, source)),\n client.call((token) =>\n call(host, token, SourceCatalogSchema, {\n method: 'GET',\n path: '/api/partner/catalog',\n source,\n }),\n ),\n client.call((token) =>\n call(host, token, TeamAgentListSchema, {\n method: 'GET',\n path: `/api/partner/teams/${encodeURIComponent(team)}/agents`,\n source,\n }),\n ),\n ]);\n const ref = teams.teams.find((entry) => entry.slug === team);\n if (!ref) {\n throw notFoundError(\n `No team \"${team}\" on ${teams.source.slug}.`,\n 'Run \"ekanos teams list\" to see the teams on this Source.',\n );\n }\n\n const integrations = catalog.products.filter(\n (product) =>\n product.kind === 'integration' && product.availability === 'enabled',\n );\n const statuses = await inBatches(integrations, 4, (product) =>\n client.call((token) =>\n showTeamIntegration(host, token, {\n source,\n team,\n product: product.slug,\n }),\n ),\n );\n\n // What the team's agents need of each product, and whose connection it is.\n const needs = new Map<string, Requirement>();\n for (const entry of agents.agents) {\n for (const item of entry.agent?.requirements ?? []) {\n if (item.kind === 'product' && !needs.has(item.key)) {\n needs.set(item.key, item);\n }\n }\n }\n\n const target = { team, source };\n const agentRows = agents.agents.map((entry) => ({\n key: entry.key,\n name: entry.name,\n on: entry.agent?.status === 'active',\n readiness: agentReadiness(entry, target),\n }));\n const integrationRows = integrations.map((product, index) => ({\n slug: product.slug,\n name: product.name,\n line: withScope(\n integrationLine(\n product,\n statuses[index]!,\n needs.get(product.slug),\n target,\n ),\n statuses[index]!,\n { ...target, product: product.slug },\n ),\n }));\n\n const width = Math.max(\n 8,\n ...integrations.map((product) => product.slug.length),\n ...agents.agents.map((entry) => entry.key.length),\n );\n const pad = (label: string) => label.padEnd(width);\n const live = agentRows.filter((row) => row.readiness.live).length;\n\n return ctx.succeed(\n {\n host,\n team: { slug: ref.slug, name: ref.name, memberCount: ref.memberCount },\n integrations: integrationRows.map((row, index) => ({\n slug: row.slug,\n name: row.name,\n status: statuses[index],\n agentsNeed: needs.get(row.slug) ?? null,\n })),\n agents: agentRows,\n },\n [\n `${ref.name} (${ref.slug}) · ${ref.memberCount} member${ref.memberCount === 1 ? '' : 's'} · ${agentRows.filter((row) => row.on).length} agent${agentRows.filter((row) => row.on).length === 1 ? '' : 's'} on, ${live} live`,\n '',\n 'Integrations',\n ...(integrationRows.length === 0\n ? [' none enabled for the Source']\n : integrationRows.flatMap((row) => [\n ` ${pad(row.slug)} ${row.line.state}`,\n ...(row.line.fix ? [` ${pad('')} → ${row.line.fix}`] : []),\n ])),\n '',\n 'Agents',\n ...(agentRows.length === 0\n ? [' none provided']\n : agentRows.map(\n (row, index) =>\n ` ${pad(row.key)} ${liveLine(row.readiness, agents.agents[index]?.agent)}${row.readiness.next ? ` · Next: ${row.readiness.next}` : ''}`,\n )),\n '',\n `\"ekanos teams agents show ${team} <key>\" explains one agent; \"ekanos teams show ${team} <product>\" one integration.`,\n ].join('\\n'),\n );\n}\n\nfunction integrationLine(\n product: CatalogProduct,\n status: TeamIntegrationStatus,\n need: Requirement | undefined,\n target: { team: string; source: string },\n): { state: string; fix: string | null } {\n if (need?.owner === 'source' || need?.via === 'source') {\n const problem =\n need.reason && need.reason !== 'not_connected'\n ? REASON_WORDS[need.reason]\n : null;\n const state = !need.connected\n ? `✗ via Source connection — ${problem ?? REASON_WORDS.not_connected}`\n : need.via === 'source'\n ? `✓ via Source connection${need.viaDetail ? ` · routes: ${need.viaDetail}` : ''}`\n : `! via team connection (${problem ?? 'the Source connection is not used'})`;\n return {\n state,\n fix:\n need.connected && need.via === 'source'\n ? null\n : requirementFix(need, target.team, target.source),\n };\n }\n if (!product.requiresActivation) {\n return { state: '✓ works as shipped', fix: null };\n }\n if (product.scope === 'user') {\n const person =\n need?.via === 'person' && need.viaDetail\n ? need.connected\n ? ` · ✓ ${need.viaDetail} connected (an agent runs as them)`\n : ` · ✗ ${need.viaDetail} not connected (an agent runs as them)`\n : '';\n return {\n state: `personal: each person connects their own${person}`,\n fix:\n need && !need.connected\n ? requirementFix(need, target.team, target.source)\n : null,\n };\n }\n const webhooks = status.teamApps.flatMap((app) => app.webhooks);\n const made = webhooks.filter((webhook) => webhook.endpoint).length;\n const webhookNote =\n webhooks.length > 0 ? ` · webhook URL ${made}/${webhooks.length} made` : '';\n if (status.activation) {\n const by = status.activation.activatedBy?.email;\n return {\n state: `✓ connected${status.activation.activatedAt ? ` ${status.activation.activatedAt.slice(0, 10)}` : ''}${by ? ` by ${by}` : ''}${webhookNote}`,\n fix: null,\n };\n }\n return {\n state: `✗ not connected${webhookNote}`,\n fix: `npx @ekanos/cli teams connect ${target.team} ${product.slug} --source ${target.source}`,\n };\n}\n\n/** A product the team's scopes hide from it in the app says so, whatever else is true. */\nfunction withScope(\n line: { state: string; fix: string | null },\n status: TeamIntegrationStatus,\n target: { team: string; source: string; product: string },\n): { state: string; fix: string | null } {\n if (!status.scope?.hidden) return line;\n return {\n state: `${line.state} · ! ${scopeHiddenWords(status.scope)}`,\n fix: line.fix ?? scopeFix(status.scope, target),\n };\n}\n\n/** Each item through `read`, at most `size` at a time, in order. */\nasync function inBatches<T, R>(\n items: T[],\n size: number,\n read: (item: T) => Promise<R>,\n): Promise<R[]> {\n const results: R[] = [];\n for (let start = 0; start < items.length; start += size) {\n results.push(\n ...(await Promise.all(items.slice(start, start + size).map(read))),\n );\n }\n return results;\n}\n"]}
1
+ {"version":3,"file":"teams-overview.js","sourceRoot":"","sources":["../../src/commands/teams-overview.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EACnB,mBAAmB,GAEpB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EACL,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,cAAc,GACf,MAAM,wBAAwB,CAAC;AAGhC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAe,EACf,MAAmB,EACnB,IAAY,EACZ,MAAc,EACd,IAAY;;;IAEZ,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QACtD,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CACpB,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,mBAAmB,EAAE;YACrC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,sBAAsB;YAC5B,MAAM;SACP,CAAC,CACH;QACD,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CACpB,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE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,CAAC;AACJ,CAAC;AAED,0FAA0F;AAC1F,SAAS,SAAS,CAChB,IAA2C,EAC3C,MAA6B,EAC7B,MAAyD;;;IAEzD,IAAI,EAAC,MAAA,MAAM,CAAC,KAAK,0CAAE,MAAM,CAAA;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO;QACL,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,QAAQ,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC5D,GAAG,QAAE,IAAI,CAAC,GAAG,mCAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;KAChD,CAAC;AACJ,CAAC;AAED,oEAAoE;AACpE,KAAK,UAAU,SAAS,CACtB,KAAU,EACV,IAAY,EACZ,IAA6B;IAE7B,MAAM,OAAO,GAAQ,EAAE,CAAC;IACxB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC;QACxD,OAAO,CAAC,IAAI,CACV,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CACnE,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import {\n type CatalogProduct,\n type Requirement,\n SourceCatalogSchema,\n TeamAgentListSchema,\n type TeamIntegrationStatus,\n} from '@ekanos/integration-schema';\n\nimport type { CliContext } from '../context';\nimport { notFoundError } from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport { cli } from '../invocation';\nimport { call, listTeams, showTeamIntegration } from '../teams-api';\nimport { scopeFix, scopeHiddenWords } from './scope-notice';\nimport {\n REASON_WORDS,\n agentReadiness,\n liveLine,\n requirementFix,\n} from './team-agent-readiness';\nimport type { TeamsClient } from './teams';\n\n/**\n * `ekanos teams show <team>` with no product: one screen per team (CLI audit\n * P1-7) — its members, one line per Integration the Source has enabled (whose\n * connection, or the step to make it), and one line per provided agent with\n * the same verdict as `teams agents show`. Reads the team list, the Source\n * catalog, the team's agents, and each enabled Integration's status.\n */\nexport async function runTeamOverview(\n ctx: CliContext,\n client: TeamsClient,\n host: string,\n source: string,\n team: string,\n): Promise<ExitCode> {\n const [teams, catalog, agents] = await Promise.all([\n client.call((token) => listTeams(host, token, source)),\n client.call((token) =>\n call(host, token, SourceCatalogSchema, {\n method: 'GET',\n path: '/api/partner/catalog',\n source,\n }),\n ),\n client.call((token) =>\n call(host, token, TeamAgentListSchema, {\n method: 'GET',\n path: `/api/partner/teams/${encodeURIComponent(team)}/agents`,\n source,\n }),\n ),\n ]);\n const ref = teams.teams.find((entry) => entry.slug === team);\n if (!ref) {\n throw notFoundError(\n `No team \"${team}\" on ${teams.source.slug}.`,\n 'Run \"ekanos teams list\" to see the teams on this Source.',\n );\n }\n\n const integrations = catalog.products.filter(\n (product) =>\n product.kind === 'integration' &&\n product.availability === 'enabled' &&\n // A catalog row with no package on this host has no team status to read.\n product.registered !== false,\n );\n const statuses = await inBatches(integrations, 4, (product) =>\n client.call((token) =>\n showTeamIntegration(host, token, {\n source,\n team,\n product: product.slug,\n }),\n ),\n );\n\n // What the team's agents need of each product, and whose connection it is.\n const needs = new Map<string, Requirement>();\n for (const entry of agents.agents) {\n for (const item of entry.agent?.requirements ?? []) {\n if (item.kind === 'product' && !needs.has(item.key)) {\n needs.set(item.key, item);\n }\n }\n }\n\n const target = { team, source };\n const agentRows = agents.agents.map((entry) => ({\n key: entry.key,\n name: entry.name,\n on: entry.agent?.status === 'active',\n readiness: agentReadiness(entry, target),\n }));\n const integrationRows = integrations.map((product, index) => ({\n slug: product.slug,\n name: product.name,\n line: withScope(\n integrationLine(\n product,\n statuses[index]!,\n needs.get(product.slug),\n target,\n ),\n statuses[index]!,\n { ...target, product: product.slug },\n ),\n }));\n\n const width = Math.max(\n 8,\n ...integrations.map((product) => product.slug.length),\n ...agents.agents.map((entry) => entry.key.length),\n );\n const pad = (label: string) => label.padEnd(width);\n const live = agentRows.filter((row) => row.readiness.live).length;\n\n return ctx.succeed(\n {\n host,\n team: { slug: ref.slug, name: ref.name, memberCount: ref.memberCount },\n integrations: integrationRows.map((row, index) => ({\n slug: row.slug,\n name: row.name,\n status: statuses[index],\n agentsNeed: needs.get(row.slug) ?? null,\n })),\n agents: agentRows,\n },\n [\n `${ref.name} (${ref.slug}) · ${ref.memberCount} member${ref.memberCount === 1 ? '' : 's'} · ${agentRows.filter((row) => row.on).length} agent${agentRows.filter((row) => row.on).length === 1 ? '' : 's'} on, ${live} live`,\n '',\n 'Integrations',\n ...(integrationRows.length === 0\n ? [' none enabled for the Source']\n : integrationRows.flatMap((row) => [\n ` ${pad(row.slug)} ${row.line.state}`,\n ...(row.line.fix ? [` ${pad('')} → ${row.line.fix}`] : []),\n ])),\n '',\n 'Agents',\n ...(agentRows.length === 0\n ? [' none provided']\n : agentRows.map(\n (row) =>\n ` ${pad(row.key)} ${liveLine(row.readiness)}${row.readiness.next ? ` · Next: ${row.readiness.next}` : ''}`,\n )),\n '',\n `\"ekanos teams agents show ${team} <key>\" explains one agent; \"ekanos teams show ${team} <product>\" one integration.`,\n ].join('\\n'),\n );\n}\n\nfunction integrationLine(\n product: CatalogProduct,\n status: TeamIntegrationStatus,\n need: Requirement | undefined,\n target: { team: string; source: string },\n): { state: string; fix: string | null } {\n if (need?.owner === 'source' || need?.via === 'source') {\n const problem =\n need.reason && need.reason !== 'not_connected'\n ? REASON_WORDS[need.reason]\n : null;\n const state = !need.connected\n ? `✗ via Source connection — ${problem ?? REASON_WORDS.not_connected}`\n : need.via === 'source'\n ? `✓ via Source connection${need.viaDetail ? ` · routes: ${need.viaDetail}` : ''}`\n : `! via team connection (${problem ?? 'the Source connection is not used'})`;\n return {\n state,\n fix:\n need.connected && need.via === 'source'\n ? null\n : requirementFix(need, target.team, target.source),\n };\n }\n if (!product.requiresActivation) {\n return { state: '✓ works as shipped', fix: null };\n }\n if (product.scope === 'user') {\n const person =\n need?.via === 'person' && need.viaDetail\n ? need.connected\n ? ` · ✓ ${need.viaDetail} connected (an agent runs as them)`\n : ` · ✗ ${need.viaDetail} not connected (an agent runs as them)`\n : '';\n return {\n state: `personal: each person connects their own${person}`,\n fix:\n need && !need.connected\n ? requirementFix(need, target.team, target.source)\n : null,\n };\n }\n const webhooks = status.teamApps.flatMap((app) => app.webhooks);\n const made = webhooks.filter((webhook) => webhook.endpoint).length;\n const webhookNote =\n webhooks.length > 0 ? ` · webhook URL ${made}/${webhooks.length} made` : '';\n if (status.activation) {\n const by = status.activation.activatedBy?.email;\n return {\n state: `✓ connected${status.activation.activatedAt ? ` ${status.activation.activatedAt.slice(0, 10)}` : ''}${by ? ` by ${by}` : ''}${webhookNote}`,\n fix: null,\n };\n }\n return {\n state: `✗ not connected${webhookNote}`,\n fix: `${cli()} teams connect ${target.team} ${product.slug} --source ${target.source}`,\n };\n}\n\n/** A product the team's scopes hide from it in the app says so, whatever else is true. */\nfunction withScope(\n line: { state: string; fix: string | null },\n status: TeamIntegrationStatus,\n target: { team: string; source: string; product: string },\n): { state: string; fix: string | null } {\n if (!status.scope?.hidden) return line;\n return {\n state: `${line.state} · ! ${scopeHiddenWords(status.scope)}`,\n fix: line.fix ?? scopeFix(status.scope, target),\n };\n}\n\n/** Each item through `read`, at most `size` at a time, in order. */\nasync function inBatches<T, R>(\n items: T[],\n size: number,\n read: (item: T) => Promise<R>,\n): Promise<R[]> {\n const results: R[] = [];\n for (let start = 0; start < items.length; start += size) {\n results.push(\n ...(await Promise.all(items.slice(start, start + size).map(read))),\n );\n }\n return results;\n}\n"]}
@@ -3,8 +3,9 @@ import type { StoredSession } from '../auth/credential-store.js';
3
3
  import { type AuthEnvironment } from '../auth/session.js';
4
4
  import type { CliContext } from '../context.js';
5
5
  import type { ExitCode } from '../exit-codes.js';
6
+ import { type SecretFlags, type SecretIO } from '../secret-input.js';
6
7
  import { type TeamsApiResult } from '../teams-api.js';
7
- export declare const TEAMS_SUBCOMMANDS: readonly ["list", "show", "app", "webhook", "events", "scope", "create", "rename", "members", "roles", "connect", "disconnect"];
8
+ export declare const TEAMS_SUBCOMMANDS: readonly ["list", "show", "app", "webhook", "events", "scope", "create", "rename", "members", "roles", "connect", "disconnect", "leave", "groups", "health", "workspace"];
8
9
  export interface TeamsArgs {
9
10
  host?: string;
10
11
  source?: string;
@@ -35,6 +36,9 @@ export interface TeamsArgs {
35
36
  /** Test seams for the questions `app set` asks. */
36
37
  ask?: (question: string) => Promise<string>;
37
38
  askSecret?: (question: string) => Promise<string>;
39
+ /** Test seams for the secret-input flags (`secret-input.ts`). */
40
+ readStdin?: () => Promise<string>;
41
+ secretFormTimeoutMs?: number;
38
42
  }
39
43
  export interface Target {
40
44
  source: string;
@@ -47,9 +51,10 @@ export interface Target {
47
51
  * team's setup of one product as a checklist; `app set` enters or updates
48
52
  * any of a team's own app fields (Zendesk's subdomain, client and signing
49
53
  * secret), one at a time if need be — a field left alone keeps its saved
50
- * value. Secrets are only ever typed at the admin's terminal, never from a
51
- * flag, a file or a non-interactive run, so an agent driving the CLI never
52
- * handles one; a non-secret field may be passed as `--set name=value`; `webhook` mints the URL the
54
+ * value. A secret is typed at the admin's terminal with hidden input or,
55
+ * without one, read from the environment, a private file, stdin or a form
56
+ * in the browser (`secret-input.ts`) — never a value in argv; a non-secret
57
+ * field may be passed as `--set name=value`; `webhook` mints the URL the
53
58
  * team's provider sends to, shown once.
54
59
  */
55
60
  export declare function runTeams(ctx: CliContext, args: TeamsArgs): Promise<ExitCode>;
@@ -61,7 +66,9 @@ interface AppEdits {
61
66
  values: Record<string, string>;
62
67
  /** `--clear name`: remove a saved value. */
63
68
  clear: string[];
64
- /** Whether anything is asked at the terminal. */
69
+ /** `--secret-*`, `--set-secret`, `--browser`: where secrets come from without a terminal. */
70
+ secret: SecretFlags;
71
+ /** Whether any field is collected (asked, or read from the secret-input flags). */
65
72
  prompts: boolean;
66
73
  }
67
74
  /**
@@ -91,6 +98,17 @@ export declare function promptAndSaveTeamApp(ctx: CliContext, args: TeamsArgs, c
91
98
  }>;
92
99
  /** `teams show`, read top to bottom like a setup checklist. */
93
100
  export declare function checklist(status: TeamIntegrationStatus): string[];
101
+ /**
102
+ * One team in `teams list`: its members, and whether the caller is one. A
103
+ * team nobody has joined says so with the command that joins it, rather than
104
+ * reading as a count of zero.
105
+ */
106
+ export declare function teamLine(entry: {
107
+ slug: string;
108
+ name: string;
109
+ memberCount: number;
110
+ callerIsMember?: boolean;
111
+ }): string;
94
112
  export declare function chooseApp(status: TeamIntegrationStatus, connection: string | undefined): TeamAppState;
95
113
  export declare class TeamsClient {
96
114
  private readonly env;
@@ -99,4 +117,6 @@ export declare class TeamsClient {
99
117
  call<T>(send: (accessToken: string) => Promise<TeamsApiResult<T>>): Promise<T>;
100
118
  }
101
119
  export declare function canPrompt(ctx: CliContext, args: TeamsArgs): boolean;
120
+ /** What the secret-input flags read from, with this run's test seams. */
121
+ export declare function teamsSecretIO(args: TeamsArgs): SecretIO;
102
122
  export {};