@ekanos/cli 0.31.0 → 0.32.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 +4 -3
- package/dist/commands/apps.d.ts +10 -0
- package/dist/commands/apps.js +39 -12
- package/dist/commands/apps.js.map +1 -1
- package/dist/commands/contract.js +12 -11
- package/dist/commands/contract.js.map +1 -1
- package/dist/commands/doctor.d.ts +29 -0
- package/dist/commands/doctor.js +188 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.js +3 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/status.js +48 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/contract-verification.d.ts +20 -0
- package/dist/contract-verification.js +49 -0
- package/dist/contract-verification.js.map +1 -0
- package/dist/doctor-api.d.ts +41 -0
- package/dist/doctor-api.js +79 -0
- package/dist/doctor-api.js.map +1 -0
- package/dist/feedback-context.js +1 -0
- package/dist/feedback-context.js.map +1 -1
- package/dist/index.js +35 -1
- package/dist/index.js.map +1 -1
- package/dist/project.js +12 -0
- package/dist/project.js.map +1 -1
- package/dist/validate-findings.js +10 -1
- package/dist/validate-findings.js.map +1 -1
- package/package.json +2 -2
- package/templates/AGENTS.md.tmpl +1 -1
- package/templates/experience/package.json.tmpl +4 -4
- package/templates/package.json.tmpl +4 -4
- package/templates/src/integration.ts.tmpl +5 -56
- package/templates/src/widget.ts.tmpl +65 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback-context.js","sourceRoot":"","sources":["../src/feedback-context.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,YAAY;IACZ,MAAM;IACN,UAAU;IACV,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,SAAS;IACT,MAAM;IACN,OAAO;IACP,WAAW;IACX,QA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,CAAC,IAAI,CAAC;IACtC,OAAO,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1D,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,mBAAmB,CAAC,KAGnC;IACC,OAAO;QACL,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC;QACrC,EAAE,EAAE,OAAO,EAAE;QACb,IAAI,EAAE,WAAW,EAAE;QACnB,QAAQ,EAAE,IAAI;KACf,CAAC;AACJ,CAAC","sourcesContent":["import type {\n FeedbackAgent,\n FeedbackContext,\n} from '@ekanos/integration-schema';\n\n/**\n * What `ekanos feedback` may say about a command: its path in the CLI's own\n * words and the NAMES of its flags. Never an argument, a flag's value, a\n * file's contents or an environment value — this module is the one place a\n * command line is reduced to that, for a recorded failure and for\n * `--command` alike.\n */\n\n/**\n * The words a command path is made of: the CLI's commands and the verbs and\n * areas under them. A token that is not one of these ends the path, so a\n * team, a product, an email or a key never joins it. A slug that happens to\n * be one of these words says nothing more than the word.\n */\nconst COMMAND_WORDS = new Set([\n // Commands.\n 'init',\n 'validate',\n 'dev',\n 'test',\n 'login',\n 'logout',\n 'whoami',\n 'status',\n 'sources',\n 'catalog',\n 'apps',\n 'teams',\n 'reviewers',\n 'routes',\n 'agents',\n 'skills',\n 'knowledge',\n 'runs',\n 'approvals',\n 'workflows',\n 'use',\n 'publish',\n 'upgrade',\n 'feedback',\n // Areas and verbs.\n 'add',\n 'app',\n 'apply',\n 'approve',\n 'archive',\n 'attach',\n 'cancel',\n 'confirm',\n 'connect',\n 'create',\n 'default',\n 'define',\n 'delete',\n 'detach',\n 'disable',\n 'disconnect',\n 'edit',\n 'effect',\n 'enable',\n 'events',\n 'groups',\n 'health',\n 'invite',\n 'leave',\n 'links',\n 'list',\n 'llm-key',\n 'mcp',\n 'members',\n 'options',\n 'overrides',\n 'people',\n 'pin',\n 'policy',\n 'products',\n 'pull',\n 'push',\n 'refresh',\n 'reject',\n 'remove',\n 'rename',\n 'replay',\n 'resend',\n 'role',\n 'roles',\n 'rollback',\n 'rotate',\n 'scope',\n 'scopes',\n 'search',\n 'set',\n 'show',\n 'start',\n 'tags',\n 'token',\n 'triggers',\n 'unarchive',\n 'unpin',\n 'unrouted',\n 'unset',\n 'update',\n 'webhook',\n 'workspace',\n]);\n\nconst MAX_PATH_WORDS = 4;\nconst FLAG_NAME = /^--[a-z0-9][a-z0-9-]{0,47}$/;\n\n/**\n * `teams connect` from `[\"teams\", \"connect\", \"acme\", \"linear\"]`: the command\n * and the words after it that are the CLI's own, up to the first that is not.\n */\nexport function commandPathOf(tokens: readonly string[]): string | null {\n const words: string[] = [];\n for (const token of tokens) {\n if (words.length === MAX_PATH_WORDS || !COMMAND_WORDS.has(token)) break;\n words.push(token);\n }\n return words.length > 0 ? words.join(' ') : null;\n}\n\n/**\n * The names of the flags in an argv, in order, once each: `--set a=b` gives\n * `--set`, `--source=acme` gives `--source`. A token after `--` is the\n * passthrough's, not a flag of this CLI, and is never read.\n */\nexport function flagNamesOf(argv: readonly string[]): string[] {\n const names: string[] = [];\n for (const token of argv) {\n if (token === '--') break;\n if (!token.startsWith('--')) continue;\n const name = token.split('=')[0]!.toLowerCase();\n if (FLAG_NAME.test(name) && !names.includes(name)) names.push(name);\n if (names.length === 40) break;\n }\n return names;\n}\n\n/** The leading words of an argv that are not flags, and not values of one. */\nfunction bareTokens(argv: readonly string[]): string[] {\n const tokens: string[] = [];\n for (const token of argv) {\n if (token === '--' || token.startsWith('-')) break;\n tokens.push(token);\n }\n return tokens;\n}\n\n/**\n * A command line someone typed (`--command \"ekanos teams connect acme\n * linear --set clientId=x\"`), reduced to its path and flag names. A leading\n * `ekanos`, `npx @ekanos/cli[@version]` or package-runner prefix is dropped.\n */\nexport function describeCommandLine(line: string): {\n command: string | null;\n flags: string[];\n} {\n const tokens = line\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .map((token) => token.replace(/^[\"']|[\"']$/g, ''));\n const start = tokens.findIndex((token) => COMMAND_WORDS.has(token));\n const relevant = start === -1 ? [] : tokens.slice(start);\n // Only what follows a recognized command counts: a prefix such as\n // `npx @ekanos/cli` is not part of it.\n return {\n command: commandPathOf(bareTokens(relevant)),\n flags: flagNamesOf(relevant),\n };\n}\n\n/** Which coding agent is running this CLI, by its marker; never the value. */\nexport function detectFeedbackAgent(\n env: Readonly<Record<string, string | undefined>>,\n): FeedbackAgent | null {\n if (env.CLAUDECODE === '1') return 'claude-code';\n if (env.CODEX_SANDBOX) return 'codex';\n if (env.CURSOR_AGENT === '1') return 'cursor';\n if (env.GEMINI_CLI === '1') return 'gemini-cli';\n if (env.AI_AGENT) return 'other';\n return null;\n}\n\n/** `darwin-arm64`, `linux-x64`. */\nexport function osLabel(): string | null {\n const label = `${process.platform}-${process.arch}`.toLowerCase();\n return /^[a-z0-9_-]{1,40}$/.test(label) ? label : null;\n}\n\nexport function nodeVersion(): string | null {\n const version = process.versions.node;\n return /^\\d+\\.\\d+\\.\\d+$/.test(version) ? version : null;\n}\n\n/** A context with nothing about a command: what a plain report carries. */\nexport function baseFeedbackContext(input: {\n cliVersion: string;\n env: Readonly<Record<string, string | undefined>>;\n}): FeedbackContext {\n return {\n cliVersion: input.cliVersion,\n command: null,\n flags: [],\n errorCode: null,\n exitCode: null,\n httpStatus: null,\n requestId: null,\n agent: detectFeedbackAgent(input.env),\n os: osLabel(),\n node: nodeVersion(),\n failedAt: null,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"feedback-context.js","sourceRoot":"","sources":["../src/feedback-context.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM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AE,CAAC,WAAW,EAAE,CAAC;IAClE,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IACtC,OAAO,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1D,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,mBAAmB,CAAC,KAGnC;IACC,OAAO;QACL,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC;QACrC,EAAE,EAAE,OAAO,EAAE;QACb,IAAI,EAAE,WAAW,EAAE;QACnB,QAAQ,EAAE,IAAI;KACf,CAAC;AACJ,CAAC","sourcesContent":["import type {\n FeedbackAgent,\n FeedbackContext,\n} from '@ekanos/integration-schema';\n\n/**\n * What `ekanos feedback` may say about a command: its path in the CLI's own\n * words and the NAMES of its flags. Never an argument, a flag's value, a\n * file's contents or an environment value — this module is the one place a\n * command line is reduced to that, for a recorded failure and for\n * `--command` alike.\n */\n\n/**\n * The words a command path is made of: the CLI's commands and the verbs and\n * areas under them. A token that is not one of these ends the path, so a\n * team, a product, an email or a key never joins it. A slug that happens to\n * be one of these words says nothing more than the word.\n */\nconst COMMAND_WORDS = new Set([\n // Commands.\n 'init',\n 'validate',\n 'dev',\n 'test',\n 'login',\n 'logout',\n 'whoami',\n 'status',\n 'sources',\n 'catalog',\n 'doctor',\n 'apps',\n 'teams',\n 'reviewers',\n 'routes',\n 'agents',\n 'skills',\n 'knowledge',\n 'runs',\n 'approvals',\n 'workflows',\n 'use',\n 'publish',\n 'upgrade',\n 'feedback',\n // Areas and verbs.\n 'add',\n 'app',\n 'apply',\n 'approve',\n 'archive',\n 'attach',\n 'cancel',\n 'confirm',\n 'connect',\n 'create',\n 'default',\n 'define',\n 'delete',\n 'detach',\n 'disable',\n 'disconnect',\n 'edit',\n 'effect',\n 'enable',\n 'events',\n 'groups',\n 'health',\n 'invite',\n 'leave',\n 'links',\n 'list',\n 'llm-key',\n 'mcp',\n 'members',\n 'options',\n 'overrides',\n 'people',\n 'pin',\n 'policy',\n 'products',\n 'pull',\n 'push',\n 'refresh',\n 'reject',\n 'remove',\n 'rename',\n 'replay',\n 'resend',\n 'role',\n 'roles',\n 'rollback',\n 'rotate',\n 'scope',\n 'scopes',\n 'search',\n 'set',\n 'show',\n 'start',\n 'tags',\n 'token',\n 'triggers',\n 'unarchive',\n 'unpin',\n 'unrouted',\n 'unset',\n 'update',\n 'webhook',\n 'workspace',\n]);\n\nconst MAX_PATH_WORDS = 4;\nconst FLAG_NAME = /^--[a-z0-9][a-z0-9-]{0,47}$/;\n\n/**\n * `teams connect` from `[\"teams\", \"connect\", \"acme\", \"linear\"]`: the command\n * and the words after it that are the CLI's own, up to the first that is not.\n */\nexport function commandPathOf(tokens: readonly string[]): string | null {\n const words: string[] = [];\n for (const token of tokens) {\n if (words.length === MAX_PATH_WORDS || !COMMAND_WORDS.has(token)) break;\n words.push(token);\n }\n return words.length > 0 ? words.join(' ') : null;\n}\n\n/**\n * The names of the flags in an argv, in order, once each: `--set a=b` gives\n * `--set`, `--source=acme` gives `--source`. A token after `--` is the\n * passthrough's, not a flag of this CLI, and is never read.\n */\nexport function flagNamesOf(argv: readonly string[]): string[] {\n const names: string[] = [];\n for (const token of argv) {\n if (token === '--') break;\n if (!token.startsWith('--')) continue;\n const name = token.split('=')[0]!.toLowerCase();\n if (FLAG_NAME.test(name) && !names.includes(name)) names.push(name);\n if (names.length === 40) break;\n }\n return names;\n}\n\n/** The leading words of an argv that are not flags, and not values of one. */\nfunction bareTokens(argv: readonly string[]): string[] {\n const tokens: string[] = [];\n for (const token of argv) {\n if (token === '--' || token.startsWith('-')) break;\n tokens.push(token);\n }\n return tokens;\n}\n\n/**\n * A command line someone typed (`--command \"ekanos teams connect acme\n * linear --set clientId=x\"`), reduced to its path and flag names. A leading\n * `ekanos`, `npx @ekanos/cli[@version]` or package-runner prefix is dropped.\n */\nexport function describeCommandLine(line: string): {\n command: string | null;\n flags: string[];\n} {\n const tokens = line\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .map((token) => token.replace(/^[\"']|[\"']$/g, ''));\n const start = tokens.findIndex((token) => COMMAND_WORDS.has(token));\n const relevant = start === -1 ? [] : tokens.slice(start);\n // Only what follows a recognized command counts: a prefix such as\n // `npx @ekanos/cli` is not part of it.\n return {\n command: commandPathOf(bareTokens(relevant)),\n flags: flagNamesOf(relevant),\n };\n}\n\n/** Which coding agent is running this CLI, by its marker; never the value. */\nexport function detectFeedbackAgent(\n env: Readonly<Record<string, string | undefined>>,\n): FeedbackAgent | null {\n if (env.CLAUDECODE === '1') return 'claude-code';\n if (env.CODEX_SANDBOX) return 'codex';\n if (env.CURSOR_AGENT === '1') return 'cursor';\n if (env.GEMINI_CLI === '1') return 'gemini-cli';\n if (env.AI_AGENT) return 'other';\n return null;\n}\n\n/** `darwin-arm64`, `linux-x64`. */\nexport function osLabel(): string | null {\n const label = `${process.platform}-${process.arch}`.toLowerCase();\n return /^[a-z0-9_-]{1,40}$/.test(label) ? label : null;\n}\n\nexport function nodeVersion(): string | null {\n const version = process.versions.node;\n return /^\\d+\\.\\d+\\.\\d+$/.test(version) ? version : null;\n}\n\n/** A context with nothing about a command: what a plain report carries. */\nexport function baseFeedbackContext(input: {\n cliVersion: string;\n env: Readonly<Record<string, string | undefined>>;\n}): FeedbackContext {\n return {\n cliVersion: input.cliVersion,\n command: null,\n flags: [],\n errorCode: null,\n exitCode: null,\n httpStatus: null,\n requestId: null,\n agent: detectFeedbackAgent(input.env),\n os: osLabel(),\n node: nodeVersion(),\n failedAt: null,\n };\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import { runApps } from './commands/apps.js';
|
|
|
18
18
|
import { runAudiences } from './commands/audiences.js';
|
|
19
19
|
import { runCatalog } from './commands/catalog.js';
|
|
20
20
|
import { runDev } from './commands/dev.js';
|
|
21
|
+
import { runDoctor } from './commands/doctor.js';
|
|
21
22
|
import { runFeedback } from './commands/feedback.js';
|
|
22
23
|
import { EXPERIENCE_COMMANDS } from './commands/index-experience.js';
|
|
23
24
|
import { runInit } from './commands/init.js';
|
|
@@ -305,6 +306,19 @@ const COMMAND_SPECS = {
|
|
|
305
306
|
description: "not only SDK packages: the Source's in-repo integrations and Features too",
|
|
306
307
|
},
|
|
307
308
|
},
|
|
309
|
+
doctor: {
|
|
310
|
+
host: HOST,
|
|
311
|
+
source: SOURCE,
|
|
312
|
+
dir: DIR,
|
|
313
|
+
team: {
|
|
314
|
+
type: 'string',
|
|
315
|
+
description: "The team's slug: also check the connection each integration resolves to, as you",
|
|
316
|
+
},
|
|
317
|
+
kind: {
|
|
318
|
+
type: 'string',
|
|
319
|
+
description: 'integration or experience (else the host is asked as each)',
|
|
320
|
+
},
|
|
321
|
+
},
|
|
308
322
|
apps: Object.assign({ host: HOST, source: SOURCE, dir: DIR, 'no-wait': {
|
|
309
323
|
type: 'boolean',
|
|
310
324
|
description: 'connect: print the links and return without waiting',
|
|
@@ -823,6 +837,7 @@ const POSITIONAL_COMMANDS = {
|
|
|
823
837
|
// `sources scopes add <scope> <product>` is the longest form.
|
|
824
838
|
sources: ['subcommand', 'verb', 'product-or-scope', 'product-slug'],
|
|
825
839
|
catalog: ['product-slug'],
|
|
840
|
+
doctor: ['token-or-ref'],
|
|
826
841
|
audiences: ['subcommand', 'audience'],
|
|
827
842
|
apps: ['subcommand', 'product-slug'],
|
|
828
843
|
// `teams agents policy <team> <key> set <tool> auto` is the longest form.
|
|
@@ -927,6 +942,15 @@ const USAGE = [
|
|
|
927
942
|
' Features); one product shows its tools with their inputs and',
|
|
928
943
|
' whose connection agent runs use',
|
|
929
944
|
' ("ekanos catalog [<product-slug>] --source <slug> [--all]", --json)',
|
|
945
|
+
' doctor Whether a published integration or experience resolves on the',
|
|
946
|
+
' host, check by check, without calling it: registry, contract,',
|
|
947
|
+
' product row, visibility, entitlement, release, and for an',
|
|
948
|
+
' experience each integration it uses with the refusal the',
|
|
949
|
+
' executor would give. Lists the OAuth redirect URI each',
|
|
950
|
+
' connection expects and warns where the stored one drifted.',
|
|
951
|
+
' Exit 1 when it is not ready',
|
|
952
|
+
' ("ekanos doctor <token-or-ref> [--team <slug>] [--source <slug>]',
|
|
953
|
+
' [--kind integration|experience]", --json)',
|
|
930
954
|
" apps The Source's app for an integration teams sign in through:",
|
|
931
955
|
' show <product> | set <product> (Source admin; takes the secret',
|
|
932
956
|
' at your terminal, Enter keeps a saved value; without one,',
|
|
@@ -1182,7 +1206,7 @@ const USAGE = [
|
|
|
1182
1206
|
' bare "ekanos upgrade" MUTATES the project (installs the target versions,',
|
|
1183
1207
|
' verifies with validate + the test script, rolls back on any failure).',
|
|
1184
1208
|
'',
|
|
1185
|
-
'Host resolution (logout, whoami, status, sources, catalog, apps, teams, names, reviewers, routes, agents, skills, knowledge, runs, approvals, workflows, use, publish, upgrade, feedback):',
|
|
1209
|
+
'Host resolution (logout, whoami, status, sources, catalog, doctor, apps, teams, names, reviewers, routes, agents, skills, knowledge, runs, approvals, workflows, use, publish, upgrade, feedback):',
|
|
1186
1210
|
' --host, else EKANOS_HOST, else the "host" field in ekanos.json, else the',
|
|
1187
1211
|
' sole stored login. "ekanos publish" saves host and source to ekanos.json.',
|
|
1188
1212
|
' "ekanos login" never reads ekanos.json for a host (--host, else',
|
|
@@ -1474,6 +1498,16 @@ async function dispatch(argv, options, ctx, cwd, env, trace) {
|
|
|
1474
1498
|
dir,
|
|
1475
1499
|
env,
|
|
1476
1500
|
});
|
|
1501
|
+
case 'doctor':
|
|
1502
|
+
return await runDoctor(ctx, {
|
|
1503
|
+
host: parsed.flags.host,
|
|
1504
|
+
source: parsed.flags.source,
|
|
1505
|
+
target: parsed.positionals[0],
|
|
1506
|
+
kind: parsed.flags.kind,
|
|
1507
|
+
team: parsed.flags.team,
|
|
1508
|
+
dir,
|
|
1509
|
+
env,
|
|
1510
|
+
});
|
|
1477
1511
|
case 'apps':
|
|
1478
1512
|
return await runApps(ctx, {
|
|
1479
1513
|
host: parsed.flags.host,
|