@ekanos/cli 0.15.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.
- package/README.md +41 -4
- package/dist/auth/ekanos-api.d.ts +23 -0
- package/dist/auth/ekanos-api.js +33 -6
- package/dist/auth/ekanos-api.js.map +1 -1
- package/dist/commands/agents.js +3 -2
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/apps.d.ts +11 -3
- package/dist/commands/apps.js +86 -28
- package/dist/commands/apps.js.map +1 -1
- package/dist/commands/catalog.d.ts +4 -2
- package/dist/commands/catalog.js +166 -35
- package/dist/commands/catalog.js.map +1 -1
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.js +17 -0
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/runs.d.ts +7 -3
- package/dist/commands/runs.js +21 -5
- package/dist/commands/runs.js.map +1 -1
- package/dist/commands/scope-notice.d.ts +7 -0
- package/dist/commands/scope-notice.js +4 -11
- package/dist/commands/scope-notice.js.map +1 -1
- package/dist/commands/sources-roles.d.ts +5 -0
- package/dist/commands/sources-roles.js +235 -0
- package/dist/commands/sources-roles.js.map +1 -0
- package/dist/commands/sources.d.ts +5 -0
- package/dist/commands/sources.js +6 -1
- package/dist/commands/sources.js.map +1 -1
- package/dist/commands/team-agent-readiness.d.ts +18 -2
- package/dist/commands/team-agent-readiness.js +39 -39
- package/dist/commands/team-agent-readiness.js.map +1 -1
- package/dist/commands/team-agents-agents.d.ts +5 -2
- package/dist/commands/team-agents-agents.js +152 -15
- package/dist/commands/team-agents-agents.js.map +1 -1
- package/dist/commands/team-agents-define.d.ts +31 -0
- package/dist/commands/team-agents-define.js +176 -0
- package/dist/commands/team-agents-define.js.map +1 -0
- package/dist/commands/team-agents-mcp.js +112 -10
- package/dist/commands/team-agents-mcp.js.map +1 -1
- package/dist/commands/team-agents-triggers.d.ts +1 -1
- package/dist/commands/team-agents-triggers.js +137 -5
- package/dist/commands/team-agents-triggers.js.map +1 -1
- package/dist/commands/team-agents.d.ts +4 -1
- package/dist/commands/team-agents.js +17 -4
- package/dist/commands/team-agents.js.map +1 -1
- package/dist/commands/team-llm-key.d.ts +14 -0
- package/dist/commands/team-llm-key.js +122 -0
- package/dist/commands/team-llm-key.js.map +1 -0
- package/dist/commands/teams-connect.js +123 -31
- package/dist/commands/teams-connect.js.map +1 -1
- package/dist/commands/teams-lifecycle.d.ts +90 -0
- package/dist/commands/teams-lifecycle.js +457 -0
- package/dist/commands/teams-lifecycle.js.map +1 -0
- package/dist/commands/teams-onboard.d.ts +14 -0
- package/dist/commands/teams-onboard.js +62 -13
- package/dist/commands/teams-onboard.js.map +1 -1
- package/dist/commands/teams-overview.js +6 -2
- package/dist/commands/teams-overview.js.map +1 -1
- package/dist/commands/teams.d.ts +25 -5
- package/dist/commands/teams.js +101 -39
- package/dist/commands/teams.js.map +1 -1
- package/dist/commands/workflows.d.ts +37 -0
- package/dist/commands/workflows.js +589 -0
- package/dist/commands/workflows.js.map +1 -0
- package/dist/connect-fields.d.ts +22 -0
- package/dist/connect-fields.js +115 -0
- package/dist/connect-fields.js.map +1 -0
- package/dist/context.d.ts +12 -0
- package/dist/context.js +32 -9
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.js +357 -122
- package/dist/index.js.map +1 -1
- package/dist/invocation.d.ts +31 -0
- package/dist/invocation.js +58 -0
- package/dist/invocation.js.map +1 -0
- package/dist/runs-api.js +8 -3
- package/dist/runs-api.js.map +1 -1
- package/dist/safe-fs.d.ts +18 -0
- package/dist/safe-fs.js +57 -0
- package/dist/safe-fs.js.map +1 -1
- package/dist/secret-form.d.ts +48 -0
- package/dist/secret-form.js +212 -0
- package/dist/secret-form.js.map +1 -0
- package/dist/secret-input.d.ts +96 -0
- package/dist/secret-input.js +299 -0
- package/dist/secret-input.js.map +1 -0
- package/dist/team-connect-api.d.ts +78 -3
- package/dist/team-connect-api.js +17 -2
- package/dist/team-connect-api.js.map +1 -1
- package/dist/team-lifecycle-api.d.ts +435 -0
- package/dist/team-lifecycle-api.js +301 -0
- package/dist/team-lifecycle-api.js.map +1 -0
- package/dist/teams-api.d.ts +13 -1
- package/dist/teams-api.js +88 -27
- package/dist/teams-api.js.map +1 -1
- package/dist/unknown-command.d.ts +18 -0
- package/dist/unknown-command.js +50 -0
- package/dist/unknown-command.js.map +1 -0
- package/dist/workflows-api.d.ts +69 -0
- package/dist/workflows-api.js +182 -0
- package/dist/workflows-api.js.map +1 -0
- package/package.json +3 -3
- package/templates/AGENTS.md.tmpl +6 -4
- package/templates/claude-skill.md.tmpl +4 -1
- package/templates/package.json.tmpl +4 -4
- package/templates/skills/build-agent/SKILL.md +43 -10
- package/templates/skills/build-agent/references/agent-json.md +4 -1
- package/templates/skills/build-agent/references/app-setup.md +14 -7
- package/templates/skills/build-agent/references/rollout.md +26 -2
- package/templates/skills/build-agent/references/set-up-an-integration.md +46 -29
- package/templates/skills/build-integration/references/widget-design.md +1 -1
- package/templates/skills/ekanos-platform/SKILL.md +66 -14
- package/templates/skills/polish-widgets/references/patterns.md +3 -3
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { TeamAgentListSchema, } from '@ekanos/integration-schema';
|
|
2
|
+
import { fieldPrompt, parseFieldValue } from '../connect-fields.js';
|
|
2
3
|
import { invalidStateError, usageError, validationError } from '../errors.js';
|
|
4
|
+
import { cli } from '../invocation.js';
|
|
3
5
|
import { assertBrowserSafeUrl, openInBrowser } from '../open-url.js';
|
|
6
|
+
import { FIELD_SECRET_FORMS, collectSecrets, parsePlainValues, readSecretFlags, secretInputGiven, } from '../secret-input.js';
|
|
4
7
|
import { showTeamConnect, startTeamConnect, } from '../team-connect-api.js';
|
|
5
8
|
import { call, showTeamIntegration } from '../teams-api.js';
|
|
6
9
|
import { promptHidden, promptLine } from './apps.js';
|
|
7
10
|
import { scopeHiddenLines } from './scope-notice.js';
|
|
8
|
-
import { canPrompt, checklist, promptAndSaveTeamApp, } from './teams.js';
|
|
11
|
+
import { canPrompt, checklist, promptAndSaveTeamApp, teamsSecretIO, } from './teams.js';
|
|
9
12
|
import { isTeamChannel, runTeamChannelInstall } from './teams-channel-install.js';
|
|
10
13
|
/**
|
|
11
14
|
* `teams connect <team> <product>` — connect a product for one team, doing
|
|
@@ -161,7 +164,7 @@ async function warnOtherRunsAs(ctx, client, host, source, plan) {
|
|
|
161
164
|
item.viaDetail.toLowerCase() !== email)) === null || _d === void 0 ? void 0 : _d.viaDetail;
|
|
162
165
|
if (!runsAs)
|
|
163
166
|
continue;
|
|
164
|
-
ctx.warn(`Note: ${entry.key} runs as ${runsAs} and uses ${runsAs}'s ${plan.product.name} connection, not ${email}'s. For the agent, run:
|
|
167
|
+
ctx.warn(`Note: ${entry.key} runs as ${runsAs} and uses ${runsAs}'s ${plan.product.name} connection, not ${email}'s. For the agent, run: ${cli()} teams connect ${plan.team.slug} ${plan.product.slug} --as ${runsAs} --source ${source}`);
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
/**
|
|
@@ -192,7 +195,7 @@ async function offerChannels(ctx, args, client, host, source, input, done) {
|
|
|
192
195
|
done.summary,
|
|
193
196
|
...waiting.flatMap((entry) => [
|
|
194
197
|
`Next: ${why(entry)}`,
|
|
195
|
-
` Install it in your terminal:
|
|
198
|
+
` Install it in your terminal: ${cli()} ${command(entry.connectionId)}`,
|
|
196
199
|
]),
|
|
197
200
|
].join('\n'));
|
|
198
201
|
}
|
|
@@ -229,31 +232,14 @@ async function connectionLabel(client, host, target, plan) {
|
|
|
229
232
|
}
|
|
230
233
|
async function activate(ctx, args, client, host, target, plan) {
|
|
231
234
|
var _a;
|
|
232
|
-
var _b, _c
|
|
235
|
+
var _b, _c;
|
|
233
236
|
if (plan.scope === 'user' && !plan.member) {
|
|
234
|
-
throw invalidStateError((_b = plan.memberProblem) !== null && _b !== void 0 ? _b : `${plan.product.name} is a personal connection: each member connects their own.`,
|
|
237
|
+
throw invalidStateError((_b = plan.memberProblem) !== null && _b !== void 0 ? _b : `${plan.product.name} is a personal connection: each member connects their own.`, joinHint(plan, target));
|
|
235
238
|
}
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
ctx.log(`${plan.product.name} for ${plan.scope === 'user' ? 'you, in' : 'team'} ${plan.team.slug}: enter what the app's form asks. Secrets are hidden and never shown again.`);
|
|
242
|
-
for (const field of plan.fields) {
|
|
243
|
-
if (field.description)
|
|
244
|
-
ctx.log(` ${field.description}`);
|
|
245
|
-
const suffix = `${field.required ? '' : ' (optional — Enter skips)'}${field.sensitive ? ' (hidden)' : ''}: `;
|
|
246
|
-
const value = (await (field.sensitive
|
|
247
|
-
? ((_c = args.askSecret) !== null && _c !== void 0 ? _c : promptHidden)
|
|
248
|
-
: ((_d = args.ask) !== null && _d !== void 0 ? _d : promptLine))(`${field.label}${suffix}`)).trim();
|
|
249
|
-
if (value)
|
|
250
|
-
fields[field.name] = value;
|
|
251
|
-
else if (field.required) {
|
|
252
|
-
throw validationError(`${field.label} is needed.`, `Run "ekanos teams connect ${target.team} ${target.product}" again.`);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
const started = await client.call((token) => startTeamConnect(host, token, target, { fields }));
|
|
239
|
+
const entered = plan.mode === 'fields'
|
|
240
|
+
? await enterFields(ctx, args, plan, connectAgain(target, plan))
|
|
241
|
+
: { fields: {}, set: [] };
|
|
242
|
+
const started = await client.call((token) => startTeamConnect(host, token, target, Object.assign({ fields: entered.fields }, (entered.set.length > 0 ? { set: entered.set } : {}))));
|
|
257
243
|
return ctx.succeed(Object.assign(Object.assign({ host }, started), { connected: started.plan.connected }), ctx.ui.result({
|
|
258
244
|
title: `Connected ${started.plan.product.name} for ${started.plan.team.slug}`,
|
|
259
245
|
rows: [
|
|
@@ -261,7 +247,7 @@ async function activate(ctx, args, client, host, target, plan) {
|
|
|
261
247
|
[
|
|
262
248
|
'For',
|
|
263
249
|
started.plan.scope === 'user'
|
|
264
|
-
? `you (${(
|
|
250
|
+
? `you (${(_c = (_a = started.plan.member) === null || _a === void 0 ? void 0 : _a.email) !== null && _c !== void 0 ? _c : 'your account'}) — a personal connection`
|
|
265
251
|
: 'the whole team',
|
|
266
252
|
],
|
|
267
253
|
['Team page', started.plan.connectUrl],
|
|
@@ -274,21 +260,32 @@ async function connectOAuth(ctx, args, client, host, target, plan, asEmail, opti
|
|
|
274
260
|
const name = options.name;
|
|
275
261
|
const again = `ekanos teams connect ${target.team} ${target.product}${named ? ` --connection ${plan.connectionId}` : ''}`;
|
|
276
262
|
if (!plan.member) {
|
|
277
|
-
throw invalidStateError((_a = plan.memberProblem) !== null && _a !== void 0 ? _a : 'No member of the team can sign in yet.',
|
|
263
|
+
throw invalidStateError((_a = plan.memberProblem) !== null && _a !== void 0 ? _a : 'No member of the team can sign in yet.', plan.scope === 'user'
|
|
264
|
+
? joinHint(plan, target)
|
|
265
|
+
: `Name a member of ${plan.team.slug} who signs in: ${again} --as <email>. Or join it and sign in yourself: ekanos teams members add ${plan.team.slug} --self --role admin`);
|
|
278
266
|
}
|
|
279
267
|
if (plan.teamApp) {
|
|
280
268
|
const status = await client.call((token) => showTeamIntegration(host, token, target));
|
|
281
269
|
const connectionId = (_b = plan.connectionId) !== null && _b !== void 0 ? _b : 'default';
|
|
282
270
|
const app = (_c = status.teamApps.find((entry) => entry.connectionId === connectionId)) !== null && _c !== void 0 ? _c : (named ? undefined : status.teamApps[0]);
|
|
283
271
|
if (app && app.fields.some((field) => !field.set)) {
|
|
284
|
-
if (!canPrompt(ctx, args)
|
|
285
|
-
|
|
272
|
+
if (!canPrompt(ctx, args) &&
|
|
273
|
+
!secretInputGiven(readSecretFlags(args.flags))) {
|
|
274
|
+
throw usageError(`${name} needs ${plan.team.slug}'s own app first (${app.fields
|
|
275
|
+
.filter((field) => !field.set)
|
|
276
|
+
.map((field) => field.secretName)
|
|
277
|
+
.join(', ')}), and there is no terminal to ask at.`, `Without a terminal, pass --set <field>=<value> for the plain fields and ${FIELD_SECRET_FORMS}. Or run it yourself in your terminal: ${cli()} ${again} --source ${plan.source.slug}`);
|
|
286
278
|
}
|
|
287
279
|
ctx.log(`${name} signs ${plan.team.slug} in through the team's own app. Set it up first:`);
|
|
288
280
|
await promptAndSaveTeamApp(ctx, args, client, host, target, status, app);
|
|
289
281
|
}
|
|
290
282
|
}
|
|
291
|
-
|
|
283
|
+
// An app sign-in (GitHub, ROAM) activates on return with what the app's
|
|
284
|
+
// form would add after the sign-in: asked now, applied then.
|
|
285
|
+
const entered = plan.signIn === 'app' && plan.fields.length > 0
|
|
286
|
+
? await enterFields(ctx, args, plan, `${again} --source ${plan.source.slug}`)
|
|
287
|
+
: undefined;
|
|
288
|
+
const started = await client.call((token) => startTeamConnect(host, token, target, Object.assign(Object.assign(Object.assign({}, (asEmail ? { as: asEmail } : {})), (entered ? { fields: entered.fields } : {})), (entered && entered.set.length > 0 ? { set: entered.set } : {}))));
|
|
292
289
|
if (started.result !== 'consent') {
|
|
293
290
|
throw invalidStateError(`The host answered "${started.result}" where a sign-in link was expected.`, 'Run "ekanos upgrade" — the CLI and the host disagree on the connect contract.');
|
|
294
291
|
}
|
|
@@ -303,11 +300,21 @@ async function connectOAuth(ctx, args, client, host, target, plan, asEmail, opti
|
|
|
303
300
|
: `Sign in to ${plan.product.name} as the account ${plan.team.slug} should use${plan.scope === 'user' ? ' (a personal connection: yours)' : ''}:`,
|
|
304
301
|
` ${started.authorizeUrl}`,
|
|
305
302
|
` (one-time link, valid until ${expires} UTC)`,
|
|
303
|
+
...(plan.signIn === 'app'
|
|
304
|
+
? [
|
|
305
|
+
` It opens ${plan.product.name}'s sign-in through ${plan.source.slug}'s app: if the browser asks you to sign in to the app first, do, then open the link again.`,
|
|
306
|
+
]
|
|
307
|
+
: []),
|
|
306
308
|
].join('\n')
|
|
307
309
|
: [
|
|
308
310
|
`Send this link to ${(_e = member.email) !== null && _e !== void 0 ? _e : 'the member'} — they ${named ? `install ${name}` : `sign in to ${plan.product.name}`} for ${plan.team.slug}${plan.scope === 'user' ? ' (a personal connection: theirs)' : ''}:`,
|
|
309
311
|
` ${started.authorizeUrl}`,
|
|
310
312
|
` (one-time, for them only, valid until ${expires} UTC)`,
|
|
313
|
+
...(plan.signIn === 'app'
|
|
314
|
+
? [
|
|
315
|
+
` They open it signed in to ${plan.source.slug}'s app as themselves.`,
|
|
316
|
+
]
|
|
317
|
+
: []),
|
|
311
318
|
].join('\n'));
|
|
312
319
|
// Only ever the caller's own browser: opening a link meant for another
|
|
313
320
|
// member would sign the caller's provider account in for them.
|
|
@@ -360,6 +367,91 @@ async function connectOAuth(ctx, args, client, host, target, plan, asEmail, opti
|
|
|
360
367
|
}
|
|
361
368
|
throw validationError('The sign-in did not finish before the link expired.', `Run "${again}${asEmail ? ` --as ${asEmail}` : ''}" again for a fresh link.`);
|
|
362
369
|
}
|
|
370
|
+
/** The command that connects it again, for a hint. */
|
|
371
|
+
function connectAgain(target, plan) {
|
|
372
|
+
return `ekanos teams connect ${target.team} ${target.product} --source ${plan.source.slug}`;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* A personal connection is the member's own: whoever runs connect makes
|
|
376
|
+
* theirs, so a caller who is not on the team joins it first.
|
|
377
|
+
*/
|
|
378
|
+
function joinHint(plan, target) {
|
|
379
|
+
return `It is yours to connect once you are a member: ekanos teams members add ${plan.team.slug} --self, then ${connectAgain(target, plan)}. For someone else's, send them a link: ${connectAgain(target, plan)} --as <their-email>.`;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* The activation fields, through the shared secret input (`secret-input.ts`)
|
|
383
|
+
* that every command taking a secret uses: `--set <field>=<value>` for a
|
|
384
|
+
* plain field; for a secret (which includes a JSON value, which can carry
|
|
385
|
+
* one) `--set-secret <field>=env:…|file:…|stdin`, `--secret-env|file|stdin`
|
|
386
|
+
* for a single one, or `--browser`; otherwise a prompt at a terminal, hidden
|
|
387
|
+
* for a secret. Each value is then typed by its field (`connect-fields.ts`).
|
|
388
|
+
*
|
|
389
|
+
* In a script or an agent run with no secret flags, an optional field
|
|
390
|
+
* nobody gave is skipped rather than refused, so a product whose fields are
|
|
391
|
+
* all optional (GitHub) goes straight to its sign-in.
|
|
392
|
+
*
|
|
393
|
+
* `set` names the fields given by `--set`: the host refuses a secret among
|
|
394
|
+
* them (`SECRET_AS_ARGUMENT`), as `--set` here already does.
|
|
395
|
+
*/
|
|
396
|
+
async function enterFields(ctx, args, plan, again) {
|
|
397
|
+
var _a;
|
|
398
|
+
const plain = parsePlainValues((_a = args.flags) === null || _a === void 0 ? void 0 : _a.set, 'default_labels=bug,triage');
|
|
399
|
+
const secret = readSecretFlags(args.flags);
|
|
400
|
+
const interactive = canPrompt(ctx, args);
|
|
401
|
+
const asking = interactive || secretInputGiven(secret);
|
|
402
|
+
// Without a terminal, a secret flag or any --set, only the required fields
|
|
403
|
+
// are asked for (and refused); an optional one is skipped.
|
|
404
|
+
const fields = asking || Object.keys(plain).length > 0
|
|
405
|
+
? plan.fields
|
|
406
|
+
: plan.fields.filter((field) => field.required);
|
|
407
|
+
if (interactive &&
|
|
408
|
+
!secretInputGiven(secret) &&
|
|
409
|
+
fields.some((field) => !(field.name in plain))) {
|
|
410
|
+
ctx.log(`${plan.product.name} for ${plan.scope === 'user' ? 'you, in' : 'team'} ${plan.team.slug}: enter what the app's form asks${plan.signIn === 'app' ? ' after the sign-in' : ''}. Secrets are hidden and never shown again.`);
|
|
411
|
+
}
|
|
412
|
+
const byName = new Map(plan.fields.map((field) => [field.name, field]));
|
|
413
|
+
const raw = fields.length === 0 && Object.keys(plain).length === 0
|
|
414
|
+
? {}
|
|
415
|
+
: await collectSecrets(ctx, {
|
|
416
|
+
fields: fields.map((field) => (Object.assign({ name: field.name, label: field.label, sensitive: field.sensitive, required: field.required }, (field.description ? { description: field.description } : {})))),
|
|
417
|
+
plain,
|
|
418
|
+
flags: secret,
|
|
419
|
+
io: teamsSecretIO(args),
|
|
420
|
+
interactive,
|
|
421
|
+
title: `${plan.product.name} for ${plan.team.slug}`,
|
|
422
|
+
refusal: `${plan.product.name} needs its form's fields (${fields
|
|
423
|
+
.filter((field) => field.required)
|
|
424
|
+
.map((field) => `${field.label} [${field.name}]`)
|
|
425
|
+
.join(', ')}), and there is no terminal to ask at.`,
|
|
426
|
+
again: again.replace(/^ekanos /, ''),
|
|
427
|
+
prompt: (spec) => {
|
|
428
|
+
var _a, _b;
|
|
429
|
+
const field = byName.get(spec.name);
|
|
430
|
+
if (field.description)
|
|
431
|
+
ctx.log(` ${field.description}`);
|
|
432
|
+
return (field.sensitive
|
|
433
|
+
? ((_a = args.askSecret) !== null && _a !== void 0 ? _a : promptHidden)
|
|
434
|
+
: ((_b = args.ask) !== null && _b !== void 0 ? _b : promptLine))(fieldPrompt(field));
|
|
435
|
+
},
|
|
436
|
+
});
|
|
437
|
+
const values = {};
|
|
438
|
+
for (const [name, text] of Object.entries(raw)) {
|
|
439
|
+
const field = byName.get(name);
|
|
440
|
+
if (!field)
|
|
441
|
+
continue;
|
|
442
|
+
const value = parseFieldValue(field, text);
|
|
443
|
+
if (value !== undefined)
|
|
444
|
+
values[name] = value;
|
|
445
|
+
}
|
|
446
|
+
const missing = plan.fields.filter((field) => field.required && values[field.name] === undefined);
|
|
447
|
+
if (missing.length > 0) {
|
|
448
|
+
throw validationError(`${missing.map((field) => `${field.label} (${field.name})`).join(', ')} ${missing.length === 1 ? 'is' : 'are'} needed.`, `Run "${again}" again.`);
|
|
449
|
+
}
|
|
450
|
+
return {
|
|
451
|
+
fields: values,
|
|
452
|
+
set: Object.keys(plain).filter((name) => plain[name] !== ''),
|
|
453
|
+
};
|
|
454
|
+
}
|
|
363
455
|
/** `--link-only`: the team's page and whether it is connected. */
|
|
364
456
|
async function printLink(ctx, client, host, target) {
|
|
365
457
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teams-connect.js","sourceRoot":"","sources":["../../src/commands/teams-connect.ts"],"names":[],"m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,kDAAkD;YAClD,yBAAyB,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,gDAAgD;SACjH;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,IAAqB,EAAE,KAAK,GAAG,KAAK;IACpD,IAAI,CAAC,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;IACtE,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAC9G,CAAC","sourcesContent":["import {\n TeamAgentListSchema,\n type TeamIntegrationStatus,\n} from '@ekanos/integration-schema';\n\nimport type { CliContext } from '../context';\nimport { invalidStateError, usageError, validationError } from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport { assertBrowserSafeUrl, openInBrowser } from '../open-url';\nimport {\n type TeamConnectPlan,\n showTeamConnect,\n startTeamConnect,\n} from '../team-connect-api';\nimport { call, showTeamIntegration } from '../teams-api';\nimport type { ResultRow } from '../ui';\nimport { promptHidden, promptLine } from './apps';\nimport { scopeHiddenLines } from './scope-notice';\nimport {\n type TeamsArgs,\n type TeamsClient,\n canPrompt,\n checklist,\n promptAndSaveTeamApp,\n} from './teams';\nimport { isTeamChannel, runTeamChannelInstall } from './teams-channel-install';\n\n/**\n * `teams connect <team> <product>` — connect a product for one team, doing\n * whichever the integration needs (the host's plan decides, never the CLI):\n *\n * - works as shipped → says so; not self-serve or not enabled → refuses\n * with the reason (and points at `sources products` for the latter);\n * - form fields → asks them here (secrets hidden, never as arguments) and\n * activates exactly as the app's form does;\n * - OAuth → runs `teams app set` inline when the team's own app is needed\n * first (Zendesk), then a one-time sign-in link for the member who\n * consents: the caller when a member, else `--as <email>`. Opens it for\n * the caller (unless `--no-open`), always prints it, and waits until the\n * team is connected (unless `--no-wait`);\n * - a form only the browser can fill → prints the team's page.\n *\n * `--connection <id>` connects one of the integration's named connections\n * instead of the main one — Linear's `agent`, the team's own Linear app\n * installed as a workspace member, which is what makes Linear send the\n * @mention and assignment webhooks an agent's triggers listen for. It runs\n * the same way: the team app's fields when missing, then the sign-in, then\n * the wait until it is installed.\n *\n * Without `--connection`, once the main connection is made (or already\n * was), a named connection the team's agents' triggers wait on is offered\n * next — at a terminal it asks and installs it, otherwise it names the\n * command. \"Connected\" is not the goal; an agent that can be reached is.\n *\n * `--reconnect` connects it again even though it reads as connected — for\n * a revoked or expired sign-in, or new form values. An OAuth reconnect\n * prints the link and returns: the team already reads as connected, so\n * there is nothing to wait for.\n *\n * `--link-only` keeps the old behaviour: the team's page and its status.\n *\n * `slack` and `linear-app` install the channels agent triggers answer\n * through — Slack, and Ekanos's own Linear Agents app — by the same\n * link-and-wait (`teams-channel-install.ts`).\n */\nexport async function runTeamConnect(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n source: string,\n input: { team: string; product: string; as?: string; connection?: string },\n): Promise<ExitCode> {\n const target = {\n source,\n team: input.team,\n product: input.product,\n ...(input.connection ? { connection: input.connection } : {}),\n };\n\n // Slack and Ekanos's Linear Agents app: the channels a `slack` or `linear`\n // agent trigger answers through, installed by their own flows.\n if (!input.connection && !args.linkOnly && isTeamChannel(input.product)) {\n return runTeamChannelInstall(ctx, args, client, host, source, {\n team: input.team,\n channel: input.product,\n ...(input.as ? { as: input.as } : {}),\n open: args.openUrl ?? openInBrowser,\n });\n }\n\n if (args.linkOnly) return printLink(ctx, client, host, target);\n\n const { plan } = await client.call((token) =>\n showTeamConnect(host, token, target, input.as),\n );\n const named = isNamed(plan);\n const name = named\n ? await connectionLabel(client, host, target, plan)\n : plan.product.name;\n await warnOtherRunsAs(ctx, client, host, source, plan);\n for (const line of scopeHiddenLines(plan.productScope, {\n team: plan.team.slug,\n product: plan.product.slug,\n source: plan.source.slug,\n })) {\n ctx.warn(line);\n }\n\n switch (plan.mode) {\n case 'not-entitled':\n throw invalidStateError(\n plan.reason ??\n `\"${input.product}\" is not enabled on ${plan.source.slug}.`,\n `Enable it for the Source first: \"ekanos sources products enable ${input.product}\" as a Source admin if ${plan.source.slug} built it, otherwise a super-admin (/admin in the browser). \"ekanos sources products\" shows what ${plan.source.slug} has.`,\n );\n case 'not-self-serve':\n throw invalidStateError(\n plan.reason ?? `${name} is not connected by a team.`,\n plan.product.kind === 'experience'\n ? `\"ekanos sources products --source ${plan.source.slug}\" shows whether it is on for the Source.`\n : 'It is turned on for the Source by Ekanos; there is nothing for the team to do.',\n );\n case 'unsupported':\n throw invalidStateError(\n plan.reason ?? `${name} cannot be connected from here.`,\n `Open the team's page instead: ${plan.connectUrl}`,\n );\n case 'works-as-shipped':\n return ctx.succeed(\n { host, plan, connected: true },\n ctx.ui.result({\n title: `${name} works as shipped for ${plan.team.slug}`,\n rows: [['Status', 'nothing to connect']],\n }),\n );\n case 'browser':\n return ctx.succeed(\n { host, plan, connected: plan.connected },\n ctx.ui.result({\n title: plan.connected\n ? `${plan.team.slug} has connected ${name}`\n : `${name} connects in the app for ${plan.team.slug}`,\n tone: plan.connected ? 'ok' : 'warn',\n rows: [\n ['Open', plan.connectUrl],\n ['Status', statusOf(plan)],\n ],\n notes: plan.connected\n ? []\n : [\n plan.reason ??\n `${name} connects through its own form in the app.`,\n 'A team admin signs in there and clicks Connect.',\n ],\n }),\n );\n default:\n break;\n }\n\n if (plan.connected && !args.reconnect) {\n const summary = ctx.ui.result({\n title: `${plan.team.slug} has already ${named ? 'installed' : 'connected'} ${name}`,\n rows: [\n ['Status', statusOf(plan, named)],\n ['Team page', plan.connectUrl],\n ],\n notes: [\n `\"ekanos teams show ${plan.team.slug} ${plan.product.slug}\" shows the full setup.`,\n `Broken (revoked or expired)? Connect it again: ekanos teams connect ${plan.team.slug} ${plan.product.slug}${named ? ` --connection ${plan.connectionId}` : ''} --reconnect`,\n ],\n });\n return named\n ? ctx.succeed({ host, plan, connected: true }, summary)\n : offerChannels(ctx, args, client, host, source, input, {\n data: { host, plan, connected: true },\n summary,\n });\n }\n\n if (plan.mode === 'fields' || plan.mode === 'no-fields') {\n return activate(ctx, args, client, host, target, plan);\n }\n return connectOAuth(ctx, args, client, host, target, plan, input.as, {\n name,\n then: named\n ? undefined\n : (done) => offerChannels(ctx, args, client, host, source, input, done),\n });\n}\n\n/**\n * A personal connection belongs to whoever makes it, but a provided agent\n * uses the personal connection of the person it runs as — so connecting\n * your own leaves the agent missing it (CLI audit P0-5). Name each agent\n * that runs as someone else and the command that connects it for them.\n */\nasync function warnOtherRunsAs(\n ctx: CliContext,\n client: TeamsClient,\n host: string,\n source: string,\n plan: TeamConnectPlan,\n): Promise<void> {\n const email = plan.member?.email?.toLowerCase();\n if (plan.scope !== 'user' || !email) return;\n let list;\n try {\n list = await client.call((token) =>\n call(host, token, TeamAgentListSchema, {\n method: 'GET',\n path: `/api/partner/teams/${encodeURIComponent(plan.team.slug)}/agents`,\n source,\n }),\n );\n } catch (error) {\n ctx.log(\n `Could not check who ${plan.team.slug}'s agents run as: ${error instanceof Error ? error.message : String(error)}`,\n );\n return;\n }\n for (const entry of list.agents) {\n const runsAs = entry.agent?.requirements.find(\n (item) =>\n item.key === plan.product.slug &&\n item.via === 'person' &&\n item.viaDetail &&\n item.viaDetail.toLowerCase() !== email,\n )?.viaDetail;\n if (!runsAs) continue;\n ctx.warn(\n `Note: ${entry.key} runs as ${runsAs} and uses ${runsAs}'s ${plan.product.name} connection, not ${email}'s. For the agent, run: npx @ekanos/cli teams connect ${plan.team.slug} ${plan.product.slug} --as ${runsAs} --source ${source}`,\n );\n }\n}\n\n/**\n * After the main connection: the named connections the team's agents'\n * triggers wait on and the team has not installed (Linear's agent). At a\n * terminal, ask and install each; otherwise name the command, in the\n * result and its JSON (`channelsToInstall`).\n */\nasync function offerChannels(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n source: string,\n input: { team: string; product: string; as?: string },\n done: { data: Record<string, unknown>; summary: string },\n): Promise<ExitCode> {\n const status = await client.call((token) =>\n showTeamIntegration(host, token, {\n source,\n team: input.team,\n product: input.product,\n }),\n );\n const waiting = channelsToInstall(status);\n if (waiting.length === 0) return ctx.succeed(done.data, done.summary);\n\n const command = (connectionId: string) =>\n `ekanos teams connect ${input.team} ${input.product} --connection ${connectionId} --source ${status.source.slug}`;\n const why = (entry: (typeof waiting)[number]) =>\n `${entry.label} is not installed for ${input.team}, and ${entry.neededBy.map((need) => `${need.agent} (${need.triggers.join(', ')})`).join(', ')} only start${entry.neededBy.length === 1 ? 's' : ''} through it.`;\n\n if (!canPrompt(ctx, args)) {\n return ctx.succeed(\n {\n ...done.data,\n channelsToInstall: waiting.map((entry) => ({\n connectionId: entry.connectionId,\n label: entry.label,\n neededBy: entry.neededBy,\n command: command(entry.connectionId),\n })),\n },\n [\n done.summary,\n ...waiting.flatMap((entry) => [\n `Next: ${why(entry)}`,\n ` Install it in your terminal: npx @ekanos/cli ${command(entry.connectionId)}`,\n ]),\n ].join('\\n'),\n );\n }\n\n ctx.log(done.summary);\n let code: ExitCode = 0;\n for (const entry of waiting) {\n ctx.log(why(entry));\n const answer = (\n await (args.ask ?? promptLine)(`Install ${entry.label} now? [Y/n] `)\n )\n .trim()\n .toLowerCase();\n if (answer !== '' && answer !== 'y' && answer !== 'yes') {\n ctx.log(`Skipped. Later: ${command(entry.connectionId)}`);\n continue;\n }\n code = await runTeamConnect(ctx, args, client, host, source, {\n ...input,\n connection: entry.connectionId,\n });\n }\n return code;\n}\n\n/** Named connections the team's agents wait on and the team has not installed. */\nexport function channelsToInstall(status: TeamIntegrationStatus) {\n return (status.connections ?? []).filter(\n (entry) =>\n entry.connectionId !== 'default' &&\n !entry.connected &&\n entry.neededBy.length > 0,\n );\n}\n\nfunction isNamed(plan: TeamConnectPlan): boolean {\n return Boolean(plan.connectionId && plan.connectionId !== 'default');\n}\n\nasync function connectionLabel(\n client: TeamsClient,\n host: string,\n target: { source: string; team: string; product: string },\n plan: TeamConnectPlan,\n): Promise<string> {\n const status = await client.call((token) =>\n showTeamIntegration(host, token, target),\n );\n return (\n status.connections?.find(\n (entry) => entry.connectionId === plan.connectionId,\n )?.label ??\n status.teamApps.find((entry) => entry.connectionId === plan.connectionId)\n ?.label ??\n `${plan.product.name} (${plan.connectionId})`\n );\n}\n\nasync function activate(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n target: { source: string; team: string; product: string },\n plan: TeamConnectPlan,\n): Promise<ExitCode> {\n if (plan.scope === 'user' && !plan.member) {\n throw invalidStateError(\n plan.memberProblem ??\n `${plan.product.name} is a personal connection: each member connects their own.`,\n `A member connects it for themselves on the team's page: ${plan.connectUrl}`,\n );\n }\n\n const fields: Record<string, string> = {};\n if (plan.mode === 'fields') {\n if (!canPrompt(ctx, args)) {\n throw usageError(\n `${plan.product.name} needs its fields typed at a terminal (${plan.fields.map((field) => field.label).join(', ')}), never in a script or an agent run.`,\n `Run it yourself in your terminal: npx @ekanos/cli teams connect ${target.team} ${target.product} --source ${plan.source.slug}`,\n );\n }\n ctx.log(\n `${plan.product.name} for ${plan.scope === 'user' ? 'you, in' : 'team'} ${plan.team.slug}: enter what the app's form asks. Secrets are hidden and never shown again.`,\n );\n for (const field of plan.fields) {\n if (field.description) ctx.log(` ${field.description}`);\n const suffix = `${field.required ? '' : ' (optional — Enter skips)'}${field.sensitive ? ' (hidden)' : ''}: `;\n const value = (\n await (\n field.sensitive\n ? (args.askSecret ?? promptHidden)\n : (args.ask ?? promptLine)\n )(`${field.label}${suffix}`)\n ).trim();\n if (value) fields[field.name] = value;\n else if (field.required) {\n throw validationError(\n `${field.label} is needed.`,\n `Run \"ekanos teams connect ${target.team} ${target.product}\" again.`,\n );\n }\n }\n }\n\n const started = await client.call((token) =>\n startTeamConnect(host, token, target, { fields }),\n );\n return ctx.succeed(\n { host, ...started, connected: started.plan.connected },\n ctx.ui.result({\n title: `Connected ${started.plan.product.name} for ${started.plan.team.slug}`,\n rows: [\n ['Status', statusOf(started.plan)],\n [\n 'For',\n started.plan.scope === 'user'\n ? `you (${started.plan.member?.email ?? 'your account'}) — a personal connection`\n : 'the whole team',\n ],\n ['Team page', started.plan.connectUrl],\n ],\n }),\n );\n}\n\nasync function connectOAuth(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n target: {\n source: string;\n team: string;\n product: string;\n connection?: string;\n },\n plan: TeamConnectPlan,\n asEmail: string | undefined,\n options: {\n /** What is being connected: the product, or a named connection's label. */\n name: string;\n /** On success, instead of finishing: the main connection's follow-ups. */\n then?: (done: {\n data: Record<string, unknown>;\n summary: string;\n }) => Promise<ExitCode>;\n },\n): Promise<ExitCode> {\n const named = isNamed(plan);\n const name = options.name;\n const again = `ekanos teams connect ${target.team} ${target.product}${named ? ` --connection ${plan.connectionId}` : ''}`;\n if (!plan.member) {\n throw invalidStateError(\n plan.memberProblem ?? 'No member of the team can sign in yet.',\n `Name a member of ${plan.team.slug} who signs in: ${again} --as <email>`,\n );\n }\n\n if (plan.teamApp) {\n const status = await client.call((token) =>\n showTeamIntegration(host, token, target),\n );\n const connectionId = plan.connectionId ?? 'default';\n const app =\n status.teamApps.find((entry) => entry.connectionId === connectionId) ??\n (named ? undefined : status.teamApps[0]);\n if (app && app.fields.some((field) => !field.set)) {\n if (!canPrompt(ctx, args)) {\n throw usageError(\n `${name} needs ${plan.team.slug}'s own app first, entered at a terminal.`,\n `Run it yourself in your terminal: npx @ekanos/cli ${again} --source ${plan.source.slug}`,\n );\n }\n ctx.log(\n `${name} signs ${plan.team.slug} in through the team's own app. Set it up first:`,\n );\n await promptAndSaveTeamApp(ctx, args, client, host, target, status, app);\n }\n }\n\n const started = await client.call((token) =>\n startTeamConnect(host, token, target, asEmail ? { as: asEmail } : {}),\n );\n if (started.result !== 'consent') {\n throw invalidStateError(\n `The host answered \"${started.result}\" where a sign-in link was expected.`,\n 'Run \"ekanos upgrade\" — the CLI and the host disagree on the connect contract.',\n );\n }\n assertBrowserSafeUrl(started.authorizeUrl, 'sign-in link');\n\n const member = started.plan.member ?? plan.member;\n const forCaller = member.isCaller;\n const expires = started.expiresAt.replace('T', ' ').slice(0, 16);\n ctx.log(\n forCaller\n ? [\n named\n ? `Install ${name} for ${plan.team.slug} — sign in as an admin of the workspace it goes into, and approve it:`\n : `Sign in to ${plan.product.name} as the account ${plan.team.slug} should use${plan.scope === 'user' ? ' (a personal connection: yours)' : ''}:`,\n ` ${started.authorizeUrl}`,\n ` (one-time link, valid until ${expires} UTC)`,\n ].join('\\n')\n : [\n `Send this link to ${member.email ?? 'the member'} — they ${named ? `install ${name}` : `sign in to ${plan.product.name}`} for ${plan.team.slug}${plan.scope === 'user' ? ' (a personal connection: theirs)' : ''}:`,\n ` ${started.authorizeUrl}`,\n ` (one-time, for them only, valid until ${expires} UTC)`,\n ].join('\\n'),\n );\n\n // Only ever the caller's own browser: opening a link meant for another\n // member would sign the caller's provider account in for them.\n if (forCaller && !args.noOpen && !ctx.jsonMode) {\n (args.openUrl ?? openInBrowser)(started.authorizeUrl);\n }\n\n // A reconnect can't be waited on: the team already reads as connected, so\n // nothing the host reports changes when the new sign-in lands.\n const reconnecting = args.reconnect === true && plan.connected;\n if (args.noWait || ctx.jsonMode || reconnecting) {\n return ctx.succeed(\n {\n host,\n plan: started.plan,\n authorizeUrl: started.authorizeUrl,\n expiresAt: started.expiresAt,\n connected: false,\n },\n ctx.ui.hint(\n reconnecting\n ? `The current connection keeps working until the sign-in finishes; then its tokens are replaced. Check with \"ekanos teams show ${target.team} ${target.product}\".`\n : `Then check with \"ekanos teams show ${target.team} ${target.product}\".`,\n ),\n );\n }\n\n ctx.log(\n 'Waiting for the sign-in to finish (Ctrl-C stops waiting; the link stays valid)…',\n );\n const deadline = Date.parse(started.expiresAt) || Date.now() + 10 * 60 * 1000;\n while (Date.now() < deadline) {\n await new Promise((resolve) =>\n setTimeout(resolve, args.pollDelayMs ?? 3000),\n );\n const polled = await client.call((token) =>\n showTeamConnect(host, token, target, asEmail),\n );\n if (polled.plan.connected) {\n const status = await client.call((token) =>\n showTeamIntegration(host, token, target),\n );\n const done = {\n data: { host, plan: polled.plan, status, connected: true },\n summary: [\n ctx.ui.result({\n title: `${named ? 'Installed' : 'Connected'} ${name} for ${plan.team.slug}`,\n rows: [\n ['Signed in by', member.email ?? member.userId],\n ['Status', statusOf(polled.plan, named)],\n ],\n notes: named\n ? [\n `Prove it end to end: @mention the agent in ${plan.product.name}, then \"ekanos runs list --team ${plan.team.slug}\" shows the run it started.`,\n ]\n : [],\n }),\n checklist(status).join('\\n'),\n ].join('\\n'),\n };\n return options.then\n ? options.then(done)\n : ctx.succeed(done.data, done.summary);\n }\n }\n throw validationError(\n 'The sign-in did not finish before the link expired.',\n `Run \"${again}${asEmail ? ` --as ${asEmail}` : ''}\" again for a fresh link.`,\n );\n}\n\n/** `--link-only`: the team's page and whether it is connected. */\nasync function printLink(\n ctx: CliContext,\n client: TeamsClient,\n host: string,\n target: { source: string; team: string; product: string },\n): Promise<ExitCode> {\n const status = await client.call((token) =>\n showTeamIntegration(host, token, target),\n );\n if (!status.enabled) {\n throw invalidStateError(\n `\"${target.product}\" is not enabled on ${status.source.slug}.`,\n `\"ekanos sources products --source ${status.source.slug}\" shows what this Source has; a super-admin enables a product for a Source.`,\n );\n }\n const connected = status.activation !== null;\n const rows: ResultRow[] = [\n ['Open', status.connectUrl],\n [\n 'Status',\n connected\n ? `connected${status.activation?.activatedAt ? ` ${status.activation.activatedAt.slice(0, 10)}` : ''}`\n : 'not connected',\n ],\n ];\n return ctx.succeed(\n { host, ...status },\n ctx.ui.result({\n title: connected\n ? `${status.team.slug} has connected ${status.product.name}`\n : `Connect link for ${status.team.slug} · ${status.product.name}`,\n tone: connected ? 'ok' : 'warn',\n rows,\n notes: [\n 'A team member signs in there and clicks Connect.',\n `\"ekanos teams connect ${status.team.slug} ${status.product.slug}\" (without --link-only) connects it from here.`,\n ],\n }),\n );\n}\n\nfunction statusOf(plan: TeamConnectPlan, named = false): string {\n if (!plan.connected) return named ? 'not installed' : 'not connected';\n return `${named ? 'installed' : 'connected'}${plan.connectedAt ? ` ${plan.connectedAt.slice(0, 10)}` : ''}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"teams-connect.js","sourceRoot":"","sources":["../../src/commands/teams-connect.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAEpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE3E,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAGL,eAAe,EACf,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAGL,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAe,EACf,IAAe,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AM,CAAC,IAAI,CAAC,IAAI,kBAAkB,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE;YAC5D,CAAC,CAAC,oBAAoB,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE;QACnE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;QAC/B,IAAI;QACJ,KAAK,EAAE;YACL,kDAAkD;YAClD,yBAAyB,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,gDAAgD;SACjH;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,IAAqB,EAAE,KAAK,GAAG,KAAK;IACpD,IAAI,CAAC,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;IACtE,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAC9G,CAAC","sourcesContent":["import {\n TeamAgentListSchema,\n type TeamIntegrationStatus,\n} from '@ekanos/integration-schema';\n\nimport { fieldPrompt, parseFieldValue } from '../connect-fields';\nimport type { CliContext } from '../context';\nimport { invalidStateError, usageError, validationError } from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport { cli } from '../invocation';\nimport { assertBrowserSafeUrl, openInBrowser } from '../open-url';\nimport {\n FIELD_SECRET_FORMS,\n collectSecrets,\n parsePlainValues,\n readSecretFlags,\n secretInputGiven,\n} from '../secret-input';\nimport {\n type FieldValue,\n type TeamConnectPlan,\n showTeamConnect,\n startTeamConnect,\n} from '../team-connect-api';\nimport { call, showTeamIntegration } from '../teams-api';\nimport type { ResultRow } from '../ui';\nimport { promptHidden, promptLine } from './apps';\nimport { scopeHiddenLines } from './scope-notice';\nimport {\n type TeamsArgs,\n type TeamsClient,\n canPrompt,\n checklist,\n promptAndSaveTeamApp,\n teamsSecretIO,\n} from './teams';\nimport { isTeamChannel, runTeamChannelInstall } from './teams-channel-install';\n\n/**\n * `teams connect <team> <product>` — connect a product for one team, doing\n * whichever the integration needs (the host's plan decides, never the CLI):\n *\n * - works as shipped → says so; not self-serve or not enabled → refuses\n * with the reason (and points at `sources products` for the latter);\n * - form fields → asks them here (secrets hidden, never as arguments) and\n * activates exactly as the app's form does;\n * - OAuth → runs `teams app set` inline when the team's own app is needed\n * first (Zendesk), then a one-time sign-in link for the member who\n * consents: the caller when a member, else `--as <email>`. Opens it for\n * the caller (unless `--no-open`), always prints it, and waits until the\n * team is connected (unless `--no-wait`);\n * - a form only the browser can fill → prints the team's page.\n *\n * `--connection <id>` connects one of the integration's named connections\n * instead of the main one — Linear's `agent`, the team's own Linear app\n * installed as a workspace member, which is what makes Linear send the\n * @mention and assignment webhooks an agent's triggers listen for. It runs\n * the same way: the team app's fields when missing, then the sign-in, then\n * the wait until it is installed.\n *\n * Without `--connection`, once the main connection is made (or already\n * was), a named connection the team's agents' triggers wait on is offered\n * next — at a terminal it asks and installs it, otherwise it names the\n * command. \"Connected\" is not the goal; an agent that can be reached is.\n *\n * `--reconnect` connects it again even though it reads as connected — for\n * a revoked or expired sign-in, or new form values. An OAuth reconnect\n * prints the link and returns: the team already reads as connected, so\n * there is nothing to wait for.\n *\n * `--link-only` keeps the old behaviour: the team's page and its status.\n *\n * `slack` and `linear-app` install the channels agent triggers answer\n * through — Slack, and Ekanos's own Linear Agents app — by the same\n * link-and-wait (`teams-channel-install.ts`).\n */\nexport async function runTeamConnect(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n source: string,\n input: { team: string; product: string; as?: string; connection?: string },\n): Promise<ExitCode> {\n const target = {\n source,\n team: input.team,\n product: input.product,\n ...(input.connection ? { connection: input.connection } : {}),\n };\n\n // Slack and Ekanos's Linear Agents app: the channels a `slack` or `linear`\n // agent trigger answers through, installed by their own flows.\n if (!input.connection && !args.linkOnly && isTeamChannel(input.product)) {\n return runTeamChannelInstall(ctx, args, client, host, source, {\n team: input.team,\n channel: input.product,\n ...(input.as ? { as: input.as } : {}),\n open: args.openUrl ?? openInBrowser,\n });\n }\n\n if (args.linkOnly) return printLink(ctx, client, host, target);\n\n const { plan } = await client.call((token) =>\n showTeamConnect(host, token, target, input.as),\n );\n const named = isNamed(plan);\n const name = named\n ? await connectionLabel(client, host, target, plan)\n : plan.product.name;\n await warnOtherRunsAs(ctx, client, host, source, plan);\n for (const line of scopeHiddenLines(plan.productScope, {\n team: plan.team.slug,\n product: plan.product.slug,\n source: plan.source.slug,\n })) {\n ctx.warn(line);\n }\n\n switch (plan.mode) {\n case 'not-entitled':\n throw invalidStateError(\n plan.reason ??\n `\"${input.product}\" is not enabled on ${plan.source.slug}.`,\n `Enable it for the Source first: \"ekanos sources products enable ${input.product}\" as a Source admin if ${plan.source.slug} built it, otherwise a super-admin (/admin in the browser). \"ekanos sources products\" shows what ${plan.source.slug} has.`,\n );\n case 'not-self-serve':\n throw invalidStateError(\n plan.reason ?? `${name} is not connected by a team.`,\n plan.product.kind === 'experience'\n ? `\"ekanos sources products --source ${plan.source.slug}\" shows whether it is on for the Source.`\n : 'It is turned on for the Source by Ekanos; there is nothing for the team to do.',\n );\n case 'unsupported':\n throw invalidStateError(\n plan.reason ?? `${name} cannot be connected from here.`,\n `Open the team's page instead: ${plan.connectUrl}`,\n );\n case 'works-as-shipped':\n return ctx.succeed(\n { host, plan, connected: true },\n ctx.ui.result({\n title: `${name} works as shipped for ${plan.team.slug}`,\n rows: [['Status', 'nothing to connect']],\n }),\n );\n case 'browser':\n return ctx.succeed(\n { host, plan, connected: plan.connected },\n ctx.ui.result({\n title: plan.connected\n ? `${plan.team.slug} has connected ${name}`\n : `${name} connects in the app for ${plan.team.slug}`,\n tone: plan.connected ? 'ok' : 'warn',\n rows: [\n ['Open', plan.connectUrl],\n ['Status', statusOf(plan)],\n ],\n notes: plan.connected\n ? []\n : [\n plan.reason ??\n `${name} connects through its own form in the app.`,\n 'A team admin signs in there and clicks Connect.',\n ],\n }),\n );\n default:\n break;\n }\n\n if (plan.connected && !args.reconnect) {\n const summary = ctx.ui.result({\n title: `${plan.team.slug} has already ${named ? 'installed' : 'connected'} ${name}`,\n rows: [\n ['Status', statusOf(plan, named)],\n ['Team page', plan.connectUrl],\n ],\n notes: [\n `\"ekanos teams show ${plan.team.slug} ${plan.product.slug}\" shows the full setup.`,\n `Broken (revoked or expired)? Connect it again: ekanos teams connect ${plan.team.slug} ${plan.product.slug}${named ? ` --connection ${plan.connectionId}` : ''} --reconnect`,\n ],\n });\n return named\n ? ctx.succeed({ host, plan, connected: true }, summary)\n : offerChannels(ctx, args, client, host, source, input, {\n data: { host, plan, connected: true },\n summary,\n });\n }\n\n if (plan.mode === 'fields' || plan.mode === 'no-fields') {\n return activate(ctx, args, client, host, target, plan);\n }\n return connectOAuth(ctx, args, client, host, target, plan, input.as, {\n name,\n then: named\n ? undefined\n : (done) => offerChannels(ctx, args, client, host, source, input, done),\n });\n}\n\n/**\n * A personal connection belongs to whoever makes it, but a provided agent\n * uses the personal connection of the person it runs as — so connecting\n * your own leaves the agent missing it (CLI audit P0-5). Name each agent\n * that runs as someone else and the command that connects it for them.\n */\nasync function warnOtherRunsAs(\n ctx: CliContext,\n client: TeamsClient,\n host: string,\n source: string,\n plan: TeamConnectPlan,\n): Promise<void> {\n const email = plan.member?.email?.toLowerCase();\n if (plan.scope !== 'user' || !email) return;\n let list;\n try {\n list = await client.call((token) =>\n call(host, token, TeamAgentListSchema, {\n method: 'GET',\n path: `/api/partner/teams/${encodeURIComponent(plan.team.slug)}/agents`,\n source,\n }),\n );\n } catch (error) {\n ctx.log(\n `Could not check who ${plan.team.slug}'s agents run as: ${error instanceof Error ? error.message : String(error)}`,\n );\n return;\n }\n for (const entry of list.agents) {\n const runsAs = entry.agent?.requirements.find(\n (item) =>\n item.key === plan.product.slug &&\n item.via === 'person' &&\n item.viaDetail &&\n item.viaDetail.toLowerCase() !== email,\n )?.viaDetail;\n if (!runsAs) continue;\n ctx.warn(\n `Note: ${entry.key} runs as ${runsAs} and uses ${runsAs}'s ${plan.product.name} connection, not ${email}'s. For the agent, run: ${cli()} teams connect ${plan.team.slug} ${plan.product.slug} --as ${runsAs} --source ${source}`,\n );\n }\n}\n\n/**\n * After the main connection: the named connections the team's agents'\n * triggers wait on and the team has not installed (Linear's agent). At a\n * terminal, ask and install each; otherwise name the command, in the\n * result and its JSON (`channelsToInstall`).\n */\nasync function offerChannels(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n source: string,\n input: { team: string; product: string; as?: string },\n done: { data: Record<string, unknown>; summary: string },\n): Promise<ExitCode> {\n const status = await client.call((token) =>\n showTeamIntegration(host, token, {\n source,\n team: input.team,\n product: input.product,\n }),\n );\n const waiting = channelsToInstall(status);\n if (waiting.length === 0) return ctx.succeed(done.data, done.summary);\n\n const command = (connectionId: string) =>\n `ekanos teams connect ${input.team} ${input.product} --connection ${connectionId} --source ${status.source.slug}`;\n const why = (entry: (typeof waiting)[number]) =>\n `${entry.label} is not installed for ${input.team}, and ${entry.neededBy.map((need) => `${need.agent} (${need.triggers.join(', ')})`).join(', ')} only start${entry.neededBy.length === 1 ? 's' : ''} through it.`;\n\n if (!canPrompt(ctx, args)) {\n return ctx.succeed(\n {\n ...done.data,\n channelsToInstall: waiting.map((entry) => ({\n connectionId: entry.connectionId,\n label: entry.label,\n neededBy: entry.neededBy,\n command: command(entry.connectionId),\n })),\n },\n [\n done.summary,\n ...waiting.flatMap((entry) => [\n `Next: ${why(entry)}`,\n ` Install it in your terminal: ${cli()} ${command(entry.connectionId)}`,\n ]),\n ].join('\\n'),\n );\n }\n\n ctx.log(done.summary);\n let code: ExitCode = 0;\n for (const entry of waiting) {\n ctx.log(why(entry));\n const answer = (\n await (args.ask ?? promptLine)(`Install ${entry.label} now? [Y/n] `)\n )\n .trim()\n .toLowerCase();\n if (answer !== '' && answer !== 'y' && answer !== 'yes') {\n ctx.log(`Skipped. Later: ${command(entry.connectionId)}`);\n continue;\n }\n code = await runTeamConnect(ctx, args, client, host, source, {\n ...input,\n connection: entry.connectionId,\n });\n }\n return code;\n}\n\n/** Named connections the team's agents wait on and the team has not installed. */\nexport function channelsToInstall(status: TeamIntegrationStatus) {\n return (status.connections ?? []).filter(\n (entry) =>\n entry.connectionId !== 'default' &&\n !entry.connected &&\n entry.neededBy.length > 0,\n );\n}\n\nfunction isNamed(plan: TeamConnectPlan): boolean {\n return Boolean(plan.connectionId && plan.connectionId !== 'default');\n}\n\nasync function connectionLabel(\n client: TeamsClient,\n host: string,\n target: { source: string; team: string; product: string },\n plan: TeamConnectPlan,\n): Promise<string> {\n const status = await client.call((token) =>\n showTeamIntegration(host, token, target),\n );\n return (\n status.connections?.find(\n (entry) => entry.connectionId === plan.connectionId,\n )?.label ??\n status.teamApps.find((entry) => entry.connectionId === plan.connectionId)\n ?.label ??\n `${plan.product.name} (${plan.connectionId})`\n );\n}\n\nasync function activate(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n target: { source: string; team: string; product: string },\n plan: TeamConnectPlan,\n): Promise<ExitCode> {\n if (plan.scope === 'user' && !plan.member) {\n throw invalidStateError(\n plan.memberProblem ??\n `${plan.product.name} is a personal connection: each member connects their own.`,\n joinHint(plan, target),\n );\n }\n\n const entered =\n plan.mode === 'fields'\n ? await enterFields(ctx, args, plan, connectAgain(target, plan))\n : { fields: {}, set: [] };\n const started = await client.call((token) =>\n startTeamConnect(host, token, target, {\n fields: entered.fields,\n ...(entered.set.length > 0 ? { set: entered.set } : {}),\n }),\n );\n return ctx.succeed(\n { host, ...started, connected: started.plan.connected },\n ctx.ui.result({\n title: `Connected ${started.plan.product.name} for ${started.plan.team.slug}`,\n rows: [\n ['Status', statusOf(started.plan)],\n [\n 'For',\n started.plan.scope === 'user'\n ? `you (${started.plan.member?.email ?? 'your account'}) — a personal connection`\n : 'the whole team',\n ],\n ['Team page', started.plan.connectUrl],\n ],\n }),\n );\n}\n\nasync function connectOAuth(\n ctx: CliContext,\n args: TeamsArgs,\n client: TeamsClient,\n host: string,\n target: {\n source: string;\n team: string;\n product: string;\n connection?: string;\n },\n plan: TeamConnectPlan,\n asEmail: string | undefined,\n options: {\n /** What is being connected: the product, or a named connection's label. */\n name: string;\n /** On success, instead of finishing: the main connection's follow-ups. */\n then?: (done: {\n data: Record<string, unknown>;\n summary: string;\n }) => Promise<ExitCode>;\n },\n): Promise<ExitCode> {\n const named = isNamed(plan);\n const name = options.name;\n const again = `ekanos teams connect ${target.team} ${target.product}${named ? ` --connection ${plan.connectionId}` : ''}`;\n if (!plan.member) {\n throw invalidStateError(\n plan.memberProblem ?? 'No member of the team can sign in yet.',\n plan.scope === 'user'\n ? joinHint(plan, target)\n : `Name a member of ${plan.team.slug} who signs in: ${again} --as <email>. Or join it and sign in yourself: ekanos teams members add ${plan.team.slug} --self --role admin`,\n );\n }\n\n if (plan.teamApp) {\n const status = await client.call((token) =>\n showTeamIntegration(host, token, target),\n );\n const connectionId = plan.connectionId ?? 'default';\n const app =\n status.teamApps.find((entry) => entry.connectionId === connectionId) ??\n (named ? undefined : status.teamApps[0]);\n if (app && app.fields.some((field) => !field.set)) {\n if (\n !canPrompt(ctx, args) &&\n !secretInputGiven(readSecretFlags(args.flags))\n ) {\n throw usageError(\n `${name} needs ${plan.team.slug}'s own app first (${app.fields\n .filter((field) => !field.set)\n .map((field) => field.secretName)\n .join(', ')}), and there is no terminal to ask at.`,\n `Without a terminal, pass --set <field>=<value> for the plain fields and ${FIELD_SECRET_FORMS}. Or run it yourself in your terminal: ${cli()} ${again} --source ${plan.source.slug}`,\n );\n }\n ctx.log(\n `${name} signs ${plan.team.slug} in through the team's own app. Set it up first:`,\n );\n await promptAndSaveTeamApp(ctx, args, client, host, target, status, app);\n }\n }\n\n // An app sign-in (GitHub, ROAM) activates on return with what the app's\n // form would add after the sign-in: asked now, applied then.\n const entered =\n plan.signIn === 'app' && plan.fields.length > 0\n ? await enterFields(\n ctx,\n args,\n plan,\n `${again} --source ${plan.source.slug}`,\n )\n : undefined;\n const started = await client.call((token) =>\n startTeamConnect(host, token, target, {\n ...(asEmail ? { as: asEmail } : {}),\n ...(entered ? { fields: entered.fields } : {}),\n ...(entered && entered.set.length > 0 ? { set: entered.set } : {}),\n }),\n );\n if (started.result !== 'consent') {\n throw invalidStateError(\n `The host answered \"${started.result}\" where a sign-in link was expected.`,\n 'Run \"ekanos upgrade\" — the CLI and the host disagree on the connect contract.',\n );\n }\n assertBrowserSafeUrl(started.authorizeUrl, 'sign-in link');\n\n const member = started.plan.member ?? plan.member;\n const forCaller = member.isCaller;\n const expires = started.expiresAt.replace('T', ' ').slice(0, 16);\n ctx.log(\n forCaller\n ? [\n named\n ? `Install ${name} for ${plan.team.slug} — sign in as an admin of the workspace it goes into, and approve it:`\n : `Sign in to ${plan.product.name} as the account ${plan.team.slug} should use${plan.scope === 'user' ? ' (a personal connection: yours)' : ''}:`,\n ` ${started.authorizeUrl}`,\n ` (one-time link, valid until ${expires} UTC)`,\n ...(plan.signIn === 'app'\n ? [\n ` It opens ${plan.product.name}'s sign-in through ${plan.source.slug}'s app: if the browser asks you to sign in to the app first, do, then open the link again.`,\n ]\n : []),\n ].join('\\n')\n : [\n `Send this link to ${member.email ?? 'the member'} — they ${named ? `install ${name}` : `sign in to ${plan.product.name}`} for ${plan.team.slug}${plan.scope === 'user' ? ' (a personal connection: theirs)' : ''}:`,\n ` ${started.authorizeUrl}`,\n ` (one-time, for them only, valid until ${expires} UTC)`,\n ...(plan.signIn === 'app'\n ? [\n ` They open it signed in to ${plan.source.slug}'s app as themselves.`,\n ]\n : []),\n ].join('\\n'),\n );\n\n // Only ever the caller's own browser: opening a link meant for another\n // member would sign the caller's provider account in for them.\n if (forCaller && !args.noOpen && !ctx.jsonMode) {\n (args.openUrl ?? openInBrowser)(started.authorizeUrl);\n }\n\n // A reconnect can't be waited on: the team already reads as connected, so\n // nothing the host reports changes when the new sign-in lands.\n const reconnecting = args.reconnect === true && plan.connected;\n if (args.noWait || ctx.jsonMode || reconnecting) {\n return ctx.succeed(\n {\n host,\n plan: started.plan,\n authorizeUrl: started.authorizeUrl,\n expiresAt: started.expiresAt,\n connected: false,\n },\n ctx.ui.hint(\n reconnecting\n ? `The current connection keeps working until the sign-in finishes; then its tokens are replaced. Check with \"ekanos teams show ${target.team} ${target.product}\".`\n : `Then check with \"ekanos teams show ${target.team} ${target.product}\".`,\n ),\n );\n }\n\n ctx.log(\n 'Waiting for the sign-in to finish (Ctrl-C stops waiting; the link stays valid)…',\n );\n const deadline = Date.parse(started.expiresAt) || Date.now() + 10 * 60 * 1000;\n while (Date.now() < deadline) {\n await new Promise((resolve) =>\n setTimeout(resolve, args.pollDelayMs ?? 3000),\n );\n const polled = await client.call((token) =>\n showTeamConnect(host, token, target, asEmail),\n );\n if (polled.plan.connected) {\n const status = await client.call((token) =>\n showTeamIntegration(host, token, target),\n );\n const done = {\n data: { host, plan: polled.plan, status, connected: true },\n summary: [\n ctx.ui.result({\n title: `${named ? 'Installed' : 'Connected'} ${name} for ${plan.team.slug}`,\n rows: [\n ['Signed in by', member.email ?? member.userId],\n ['Status', statusOf(polled.plan, named)],\n ],\n notes: named\n ? [\n `Prove it end to end: @mention the agent in ${plan.product.name}, then \"ekanos runs list --team ${plan.team.slug}\" shows the run it started.`,\n ]\n : [],\n }),\n checklist(status).join('\\n'),\n ].join('\\n'),\n };\n return options.then\n ? options.then(done)\n : ctx.succeed(done.data, done.summary);\n }\n }\n throw validationError(\n 'The sign-in did not finish before the link expired.',\n `Run \"${again}${asEmail ? ` --as ${asEmail}` : ''}\" again for a fresh link.`,\n );\n}\n\n/** The command that connects it again, for a hint. */\nfunction connectAgain(\n target: { team: string; product: string },\n plan: TeamConnectPlan,\n): string {\n return `ekanos teams connect ${target.team} ${target.product} --source ${plan.source.slug}`;\n}\n\n/**\n * A personal connection is the member's own: whoever runs connect makes\n * theirs, so a caller who is not on the team joins it first.\n */\nfunction joinHint(\n plan: TeamConnectPlan,\n target: { team: string; product: string },\n): string {\n return `It is yours to connect once you are a member: ekanos teams members add ${plan.team.slug} --self, then ${connectAgain(target, plan)}. For someone else's, send them a link: ${connectAgain(target, plan)} --as <their-email>.`;\n}\n\n/**\n * The activation fields, through the shared secret input (`secret-input.ts`)\n * that every command taking a secret uses: `--set <field>=<value>` for a\n * plain field; for a secret (which includes a JSON value, which can carry\n * one) `--set-secret <field>=env:…|file:…|stdin`, `--secret-env|file|stdin`\n * for a single one, or `--browser`; otherwise a prompt at a terminal, hidden\n * for a secret. Each value is then typed by its field (`connect-fields.ts`).\n *\n * In a script or an agent run with no secret flags, an optional field\n * nobody gave is skipped rather than refused, so a product whose fields are\n * all optional (GitHub) goes straight to its sign-in.\n *\n * `set` names the fields given by `--set`: the host refuses a secret among\n * them (`SECRET_AS_ARGUMENT`), as `--set` here already does.\n */\nasync function enterFields(\n ctx: CliContext,\n args: TeamsArgs,\n plan: TeamConnectPlan,\n again: string,\n): Promise<{ fields: Record<string, FieldValue>; set: string[] }> {\n const plain = parsePlainValues(args.flags?.set, 'default_labels=bug,triage');\n const secret = readSecretFlags(args.flags);\n const interactive = canPrompt(ctx, args);\n const asking = interactive || secretInputGiven(secret);\n // Without a terminal, a secret flag or any --set, only the required fields\n // are asked for (and refused); an optional one is skipped.\n const fields =\n asking || Object.keys(plain).length > 0\n ? plan.fields\n : plan.fields.filter((field) => field.required);\n if (\n interactive &&\n !secretInputGiven(secret) &&\n fields.some((field) => !(field.name in plain))\n ) {\n ctx.log(\n `${plan.product.name} for ${plan.scope === 'user' ? 'you, in' : 'team'} ${plan.team.slug}: enter what the app's form asks${plan.signIn === 'app' ? ' after the sign-in' : ''}. Secrets are hidden and never shown again.`,\n );\n }\n\n const byName = new Map(plan.fields.map((field) => [field.name, field]));\n const raw =\n fields.length === 0 && Object.keys(plain).length === 0\n ? {}\n : await collectSecrets(ctx, {\n fields: fields.map((field) => ({\n name: field.name,\n label: field.label,\n sensitive: field.sensitive,\n required: field.required,\n ...(field.description ? { description: field.description } : {}),\n })),\n plain,\n flags: secret,\n io: teamsSecretIO(args),\n interactive,\n title: `${plan.product.name} for ${plan.team.slug}`,\n refusal: `${plan.product.name} needs its form's fields (${fields\n .filter((field) => field.required)\n .map((field) => `${field.label} [${field.name}]`)\n .join(', ')}), and there is no terminal to ask at.`,\n again: again.replace(/^ekanos /, ''),\n prompt: (spec) => {\n const field = byName.get(spec.name)!;\n if (field.description) ctx.log(` ${field.description}`);\n return (\n field.sensitive\n ? (args.askSecret ?? promptHidden)\n : (args.ask ?? promptLine)\n )(fieldPrompt(field));\n },\n });\n\n const values: Record<string, FieldValue> = {};\n for (const [name, text] of Object.entries(raw)) {\n const field = byName.get(name);\n if (!field) continue;\n const value = parseFieldValue(field, text);\n if (value !== undefined) values[name] = value;\n }\n const missing = plan.fields.filter(\n (field) => field.required && values[field.name] === undefined,\n );\n if (missing.length > 0) {\n throw validationError(\n `${missing.map((field) => `${field.label} (${field.name})`).join(', ')} ${missing.length === 1 ? 'is' : 'are'} needed.`,\n `Run \"${again}\" again.`,\n );\n }\n return {\n fields: values,\n set: Object.keys(plain).filter((name) => plain[name] !== ''),\n };\n}\n\n/** `--link-only`: the team's page and whether it is connected. */\nasync function printLink(\n ctx: CliContext,\n client: TeamsClient,\n host: string,\n target: { source: string; team: string; product: string },\n): Promise<ExitCode> {\n const status = await client.call((token) =>\n showTeamIntegration(host, token, target),\n );\n if (!status.enabled) {\n throw invalidStateError(\n `\"${target.product}\" is not enabled on ${status.source.slug}.`,\n `\"ekanos sources products --source ${status.source.slug}\" shows what this Source has; a super-admin enables a product for a Source.`,\n );\n }\n const connected = status.activation !== null;\n const rows: ResultRow[] = [\n ['Open', status.connectUrl],\n [\n 'Status',\n connected\n ? `connected${status.activation?.activatedAt ? ` ${status.activation.activatedAt.slice(0, 10)}` : ''}`\n : 'not connected',\n ],\n ];\n return ctx.succeed(\n { host, ...status },\n ctx.ui.result({\n title: connected\n ? `${status.team.slug} has connected ${status.product.name}`\n : `Connect link for ${status.team.slug} · ${status.product.name}`,\n tone: connected ? 'ok' : 'warn',\n rows,\n notes: [\n 'A team member signs in there and clicks Connect.',\n `\"ekanos teams connect ${status.team.slug} ${status.product.slug}\" (without --link-only) connects it from here.`,\n ],\n }),\n );\n}\n\nfunction statusOf(plan: TeamConnectPlan, named = false): string {\n if (!plan.connected) return named ? 'not installed' : 'not connected';\n return `${named ? 'installed' : 'connected'}${plan.connectedAt ? ` ${plan.connectedAt.slice(0, 10)}` : ''}`;\n}\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { CliContext } from '../context.js';
|
|
2
|
+
import type { ExitCode } from '../exit-codes.js';
|
|
3
|
+
import { type TeamsArgs } from './teams.js';
|
|
4
|
+
/**
|
|
5
|
+
* A team's lifecycle from the terminal, for the Source admin:
|
|
6
|
+
* `teams members resend`, `teams leave`, `teams groups …`, `teams health`
|
|
7
|
+
* and `teams workspace …`. Each is parsed before a session is touched
|
|
8
|
+
* (`parseLifecycle`), and a change that takes something away is confirmed
|
|
9
|
+
* first — asked at a terminal, `--yes` in a script or agent run — so a usage
|
|
10
|
+
* error or an unconfirmed change never costs a request. The host does the
|
|
11
|
+
* rest through the services the app's own screens use, with an Admin Audit
|
|
12
|
+
* row per write.
|
|
13
|
+
*
|
|
14
|
+
* Ownership transfer and team deletion are not here: in the app they are
|
|
15
|
+
* the primary owner's alone, confirmed by a code emailed to them.
|
|
16
|
+
*/
|
|
17
|
+
export declare const LIFECYCLE_SUBCOMMANDS: readonly ['leave', 'groups', 'health', 'workspace'];
|
|
18
|
+
type LifecycleSubcommand = (typeof LIFECYCLE_SUBCOMMANDS)[number];
|
|
19
|
+
/** `teams members <verb>` verbs handled here rather than in onboarding. */
|
|
20
|
+
export declare const LIFECYCLE_MEMBER_VERBS: readonly ['resend'];
|
|
21
|
+
/** What an unconfirmed change says, and the question a terminal is asked. */
|
|
22
|
+
export interface Confirmation {
|
|
23
|
+
what: string;
|
|
24
|
+
command: string;
|
|
25
|
+
question: string;
|
|
26
|
+
}
|
|
27
|
+
export type LifecyclePlan = ({
|
|
28
|
+
kind: 'resend';
|
|
29
|
+
team: string;
|
|
30
|
+
email: string;
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'leave';
|
|
33
|
+
team: string;
|
|
34
|
+
} | {
|
|
35
|
+
kind: 'groups-list';
|
|
36
|
+
team: string;
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'groups-create';
|
|
39
|
+
team: string;
|
|
40
|
+
name: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
products?: string[];
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'groups-update';
|
|
45
|
+
team: string;
|
|
46
|
+
group: string;
|
|
47
|
+
name?: string;
|
|
48
|
+
description?: string | null;
|
|
49
|
+
products?: string[];
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'groups-delete';
|
|
52
|
+
team: string;
|
|
53
|
+
group: string;
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'groups-member';
|
|
56
|
+
team: string;
|
|
57
|
+
group: string;
|
|
58
|
+
email: string;
|
|
59
|
+
member: boolean;
|
|
60
|
+
} | {
|
|
61
|
+
kind: 'health';
|
|
62
|
+
team: string;
|
|
63
|
+
product?: string;
|
|
64
|
+
run: boolean;
|
|
65
|
+
/** `--mine`: the caller's own personal connection to <product>. */
|
|
66
|
+
mine?: boolean;
|
|
67
|
+
} | {
|
|
68
|
+
kind: 'workspace-list';
|
|
69
|
+
team: string;
|
|
70
|
+
} | {
|
|
71
|
+
kind: 'workspace-default';
|
|
72
|
+
team: string;
|
|
73
|
+
workspace: string;
|
|
74
|
+
}) & {
|
|
75
|
+
confirm?: Confirmation;
|
|
76
|
+
};
|
|
77
|
+
export declare function isLifecycleSubcommand(value: string | undefined): value is LifecycleSubcommand;
|
|
78
|
+
export declare function isLifecycleMemberVerb(value: string | undefined): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* `subcommand` is `members` (with `resend` first in `rest`) or one
|
|
81
|
+
* of {@link LIFECYCLE_SUBCOMMANDS}.
|
|
82
|
+
*/
|
|
83
|
+
export declare function parseLifecycle(subcommand: string, rest: readonly string[], args: Pick<TeamsArgs, 'yes' | 'flags'>): LifecyclePlan;
|
|
84
|
+
export declare function runLifecycle(ctx: CliContext, args: TeamsArgs, plan: LifecyclePlan): Promise<ExitCode>;
|
|
85
|
+
/**
|
|
86
|
+
* A change that takes something away: asked at a terminal; a script, an
|
|
87
|
+
* agent run or `--json` passes `--yes` instead. Asked before any request.
|
|
88
|
+
*/
|
|
89
|
+
export declare function confirmChange(ctx: CliContext, args: TeamsArgs, confirm: Confirmation): Promise<void>;
|
|
90
|
+
export {};
|