@ekanos/cli 0.28.1 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +14 -5
  2. package/dist/auth/ekanos-api.d.ts +8 -1
  3. package/dist/auth/ekanos-api.js +14 -2
  4. package/dist/auth/ekanos-api.js.map +1 -1
  5. package/dist/bin.js +9 -1
  6. package/dist/bin.js.map +1 -1
  7. package/dist/commands/dev.js +5 -5
  8. package/dist/commands/dev.js.map +1 -1
  9. package/dist/commands/feedback.d.ts +38 -0
  10. package/dist/commands/feedback.js +234 -0
  11. package/dist/commands/feedback.js.map +1 -0
  12. package/dist/commands/publish.js +1 -1
  13. package/dist/commands/publish.js.map +1 -1
  14. package/dist/commands/sources.js +4 -1
  15. package/dist/commands/sources.js.map +1 -1
  16. package/dist/commands/status.js +1 -1
  17. package/dist/commands/status.js.map +1 -1
  18. package/dist/commands/validate.js +2 -2
  19. package/dist/commands/validate.js.map +1 -1
  20. package/dist/context.d.ts +11 -1
  21. package/dist/context.js +12 -1
  22. package/dist/context.js.map +1 -1
  23. package/dist/feedback-api.d.ts +70 -0
  24. package/dist/feedback-api.js +111 -0
  25. package/dist/feedback-api.js.map +1 -0
  26. package/dist/feedback-context.d.ts +31 -0
  27. package/dist/feedback-context.js +209 -0
  28. package/dist/feedback-context.js.map +1 -0
  29. package/dist/feedback-updates.d.ts +16 -0
  30. package/dist/feedback-updates.js +174 -0
  31. package/dist/feedback-updates.js.map +1 -0
  32. package/dist/http-trace.d.ts +19 -0
  33. package/dist/http-trace.js +47 -0
  34. package/dist/http-trace.js.map +1 -0
  35. package/dist/index.d.ts +18 -0
  36. package/dist/index.js +172 -13
  37. package/dist/index.js.map +1 -1
  38. package/dist/last-error.d.ts +17 -0
  39. package/dist/last-error.js +56 -0
  40. package/dist/last-error.js.map +1 -0
  41. package/dist/toolchain-api.d.ts +2 -1
  42. package/dist/toolchain-api.js +2 -2
  43. package/dist/toolchain-api.js.map +1 -1
  44. package/dist/toolchain-resolve.d.ts +4 -0
  45. package/dist/toolchain-resolve.js +11 -7
  46. package/dist/toolchain-resolve.js.map +1 -1
  47. package/dist/update-notice.d.ts +31 -8
  48. package/dist/update-notice.js +161 -31
  49. package/dist/update-notice.js.map +1 -1
  50. package/package.json +2 -2
  51. package/templates/AGENTS.md.tmpl +19 -0
  52. package/templates/claude-skill.md.tmpl +18 -0
  53. package/templates/experience/package.json.tmpl +4 -4
  54. package/templates/package.json.tmpl +4 -4
  55. package/templates/skills/build-agent/SKILL.md +18 -0
  56. package/templates/skills/build-integration/SKILL.md +18 -0
@@ -1 +1 @@
1
- {"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/commands/sources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAEL,oBAAoB,EACpB,cAAc,EACd,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE7E,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAGL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAmB,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cA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;IAClB,YACmB,GAAoB,EAC7B,OAAsB;mBADb,GAAG;uBACZ,OAAO;IACd,CAAC;IAEJ,KAAK,CAAC,IAAI,CACR,IAAkE;QAElE,IAAI,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAClD,IAAI,MAAM,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;YACrC,IAAI,CAAC,OAAO,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAClE,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC,IAAI,CAAC;QAC/C,MAAM,iBAAiB,CACrB,mBAAmB,IAAI,CAAC,GAAG,CAAC,IAAI,wCAAwC,EACxE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CACpB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { StoredSession } from '../auth/credential-store';\nimport { loginHint } from '../auth/host-trust';\nimport {\n type AuthEnvironment,\n refreshStoredSession,\n requireSession,\n resolveAuthEnvironment,\n} from '../auth/session';\nimport type { CliContext } from '../context';\nimport { authRequiredError, invalidStateError, usageError } from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport { hostPredatesFeatures, productGroup } from '../product-kinds';\nimport { PRODUCT_SLUG_SHAPE, isProductSlug } from '../product-slug';\nimport { EKANOS_CONFIG_FILENAME } from '../project';\nimport { fetchSeatsWithOneRefresh } from '../seats';\nimport {\n type SourceProduct,\n type SourceProductsApiResult,\n listSourceProducts,\n setSourceProduct,\n} from '../source-products-api';\nimport { resolveSourceTarget } from '../source-target';\nimport { type SourceSeat, stillUnauthorizedSourceSeats } from '../sources-api';\nimport { listProductScopes, setScopeProduct } from '../teams-api';\nimport { type Ui, pluralize, shortHost } from '../ui';\nimport { scopeDeprecationNotice } from './scope-notice';\nimport { runSourcePeople, runSourceRoles } from './sources-roles';\n\nexport interface SourcesArgs {\n host?: string;\n /** `products [enable|disable <product>]`, `scopes [add|remove <scope> <product>]`; none lists the sources. */\n positionals?: readonly string[];\n source?: string;\n yes?: boolean;\n /** `roles` and `people`: their flags (`--level`, `--permission`, `--search` …). */\n flags?: Record<string, string | boolean | string[]>;\n /** `roles delete` asks at a terminal; the test seams for it. */\n stdinIsTTY?: boolean;\n ask?: (question: string) => Promise<string>;\n /** Where a project's ekanos.json may sit — its `source` field, if any, is the marker. */\n dir: string;\n env: Record<string, string | undefined>;\n}\n\n/**\n * `sources` — list every source the caller holds a developer or admin seat\n * on, the read half of the publish-target-verification story.\n *\n * The list itself is the mechanism that makes `publish` safe: a partner (or\n * an agent acting for one) can always answer \"which sources can I possibly\n * publish to?\" before running `ekanos use` or passing `--source`.\n */\nexport async function runSources(\n ctx: CliContext,\n args: SourcesArgs,\n): Promise<ExitCode> {\n const [subcommand, ...rest] = args.positionals ?? [];\n if (subcommand !== undefined) {\n if (subcommand === 'scopes') return runScopes(ctx, args, rest);\n if (subcommand === 'roles') return runSourceRoles(ctx, args, rest);\n if (subcommand === 'people') return runSourcePeople(ctx, args, rest);\n if (subcommand !== 'products') {\n throw usageError(\n `Unknown sources subcommand \"${subcommand}\".`,\n 'Run \"ekanos sources\" to list your sources, \"ekanos sources products [enable|disable <product>]\", \"ekanos sources scopes [add|remove <scope> <product>]\", \"ekanos sources roles [list|create|update|delete <role>]\" or \"ekanos sources people\".',\n );\n }\n return runProducts(ctx, args, rest);\n }\n\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n const session = requireSession(env);\n\n const result = await fetchSeatsWithOneRefresh(env, session);\n\n if (result.status === 'unauthorized') {\n stillUnauthorizedSourceSeats(env);\n }\n\n const activeSource = readActiveSource(args.dir);\n\n return ctx.succeed(\n { host: env.host, sources: result.sources, activeSource },\n humanSummary(ctx.ui, env.host, result.sources, activeSource),\n );\n}\n\n/**\n * Best-effort, lenient read of ekanos.json's `source` field — mirrors\n * `readProjectHost` in `auth/session.ts`. A missing, unparseable, or\n * sourceless ekanos.json (or no project at all) simply means \"no active\n * source to mark\", never an error: `sources` must answer outside a project\n * too.\n */\nexport function readActiveSource(dir: string): string | null {\n const configPath = path.join(dir, EKANOS_CONFIG_FILENAME);\n\n let raw: string;\n try {\n raw = fs.readFileSync(configPath, 'utf8');\n } catch {\n return null;\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n return null;\n }\n\n const source =\n typeof parsed === 'object' && parsed !== null\n ? (parsed as { source?: unknown }).source\n : undefined;\n\n return typeof source === 'string' && source.trim().length > 0\n ? source.trim()\n : null;\n}\n\n/** Why a product is not enabled, by the lever that would enable it — the words `catalog` uses. */\nconst NOT_ENABLED_BECAUSE: Record<SourceProduct['lever'], string> = {\n flag: 'its Flag is off',\n plan: 'no active plan',\n entitlement: 'not granted',\n};\n\nfunction humanSummary(\n ui: Ui,\n host: string,\n sources: SourceSeat[],\n activeSource: string | null,\n): string {\n if (sources.length === 0) {\n return ui.result({\n // Read by any signed-in account, a team member's too: no word here\n // may imply the host serves more than one customer.\n title: 'No partner seats',\n tone: 'warn',\n rows: [['Host', shortHost(host)]],\n notes: ['This account has no partner seats on this host.'],\n });\n }\n\n const orphaned =\n activeSource && !sources.some((s) => s.slug === activeSource);\n\n return ui.result({\n title: `${pluralize(sources.length, 'source')} on ${shortHost(host)}`,\n rows: sources.map((source): [string, string] => [\n source.slug,\n [\n source.name ?? '(unnamed)',\n source.roles.join(', '),\n ...(source.slug === activeSource ? [ui.accent('this project')] : []),\n ].join(' · '),\n ]),\n notes: orphaned\n ? [\n `This project's ekanos.json points at \"${activeSource}\", which is not in the list above.`,\n ]\n : [],\n });\n}\n\n/**\n * `sources products` — the catalog as one Source has it: every product, its\n * kind (Feature or Integration), and whether it is enabled for the Source.\n * `enable|disable <product>` switch one through the levers `/admin` uses\n * (`attachProductToSource` / `detachProductFromSource` for an Integration,\n * the Feature lever for a Feature). A Source admin switches the\n * integrations their Source built (`owned`); anything else is a super-admin\n * grant, which an `ekanos login` session never carries, so from the terminal\n * that write answers with where to do it.\n */\nasync function runProducts(\n ctx: CliContext,\n args: SourcesArgs,\n rest: readonly string[],\n): Promise<ExitCode> {\n const [verb, rawProduct, ...extra] = rest;\n if (extra.length > 0) {\n throw usageError(\n `Unexpected argument \"${extra[0]}\".`,\n 'Run \"ekanos sources products [enable|disable <product>] [--source <slug>]\".',\n );\n }\n if (verb !== undefined && verb !== 'enable' && verb !== 'disable') {\n throw usageError(\n `Unknown sources products subcommand \"${verb}\".`,\n 'Run \"ekanos sources products\", \"ekanos sources products enable <product>\" or \"ekanos sources products disable <product> --yes\".',\n );\n }\n const product = verb ? productSlug(rawProduct, verb) : null;\n if (verb === 'disable' && !args.yes) {\n throw invalidStateError(\n `Disabling ${product} removes it from the Source: its plans, widget settings, Source credentials and workspaces go with it.`,\n `Re-run with --yes: ekanos sources products disable ${product} --yes`,\n );\n }\n\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n const resolved = await resolveSourceTarget(env, requireSession(env), {\n source: args.source,\n dir: args.dir,\n });\n const client = new ProductsClient(env, resolved.session);\n\n if (!verb || !product) {\n const list = await client.call((token) =>\n listSourceProducts(env.host, token, resolved.source),\n );\n const legacyHost = hostPredatesFeatures(list.products);\n const byKind = (kind: 'feature' | 'experience' | 'integration') =>\n list.products\n .filter((entry) => productGroup(entry, legacyHost) === kind)\n .map((entry): [string, string] => [\n entry.slug,\n `${entry.enabled ? '✓ enabled' : `✗ not enabled (${NOT_ENABLED_BECAUSE[entry.lever]})`} · ${entry.name}${entry.owned ? ' · built by this Source' : ''}${entry.registered ? '' : ' · no package on this host'}`,\n ]);\n return ctx.succeed(\n { host: env.host, ...list },\n [\n ctx.ui.result({\n title: `Features on ${list.source.slug}`,\n rows: byKind('feature'),\n }),\n ...(byKind('experience').length > 0\n ? [\n ctx.ui.result({\n title: `Experiences on ${list.source.slug}`,\n rows: byKind('experience'),\n }),\n ]\n : []),\n ctx.ui.result({\n title: `Integrations on ${list.source.slug}`,\n rows: byKind('integration'),\n notes: [\n list.canEnable\n ? '\"ekanos sources products enable|disable <product>\" switches one.'\n : list.canEnableOwned\n ? '\"ekanos sources products enable|disable <product>\" switches one built by this Source; Ekanos enables any other.'\n : 'Ekanos enables them.',\n '\"ekanos teams connect <team> <product>\" connects an enabled integration for a team.',\n ],\n }),\n ].join('\\n'),\n );\n }\n\n const enabled = verb === 'enable';\n const result = await client.call((token) =>\n setSourceProduct(env.host, token, {\n source: resolved.source,\n product,\n enabled,\n }),\n );\n return ctx.succeed(\n { host: env.host, ...result },\n ctx.ui.result({\n title: result.changed\n ? `${enabled ? 'Enabled' : 'Disabled'} ${result.product.name} for ${result.source.slug}`\n : `${result.product.name} was already ${enabled ? 'enabled' : 'off'} for ${result.source.slug}`,\n rows: [\n ['Kind', result.product.kind],\n [\n 'Switched by',\n result.product.lever === 'flag'\n ? 'its Flag'\n : result.product.lever === 'plan'\n ? 'its plan'\n : 'the entitlement',\n ],\n ],\n notes:\n enabled && result.product.kind === 'integration'\n ? [\n `Next: \"ekanos teams connect <team> ${result.product.slug}\" connects it for a team.`,\n ]\n : [],\n }),\n );\n}\n\n/**\n * `sources scopes` — the Source's product scopes, for its Source admin: each\n * scope's products and how many teams hold it. Once a Source has a scope,\n * each team sees in the app only its scopes' products. `add|remove <scope>\n * <product>` changes one scope (by name or id) through what\n * `/admin/sources/[id]/scopes` uses; a product can only be added if\n * the Source has it. Taking one out hides it from every team on the scope\n * that no other of its scopes shows it to, so that needs `--yes`.\n */\nasync function runScopes(\n ctx: CliContext,\n args: SourcesArgs,\n rest: readonly string[],\n): Promise<ExitCode> {\n const [verb, rawScope, rawProduct, ...extra] = rest;\n const usage =\n 'Run \"ekanos sources scopes\", \"ekanos sources scopes add <scope> <product>\" or \"ekanos sources scopes remove <scope> <product> --yes\".';\n if (verb !== undefined && verb !== 'add' && verb !== 'remove') {\n throw usageError(`Unknown sources scopes subcommand \"${verb}\".`, usage);\n }\n if (extra.length > 0) {\n throw usageError(`Unexpected argument \"${extra[0]}\".`, usage);\n }\n const scope = rawScope?.trim();\n if (verb && !scope) {\n throw usageError(\n `sources scopes ${verb} needs a scope and a product.`,\n usage,\n );\n }\n const product = verb ? scopeProductSlug(rawProduct, verb) : null;\n if (verb === 'remove' && !args.yes) {\n throw invalidStateError(\n `Taking ${product} out of ${scope} hides it, in the app, from every team on ${scope} that no other of its scopes shows it to.`,\n `Re-run with --yes: ekanos sources scopes remove ${quoteArg(scope!)} ${product} --yes`,\n );\n }\n\n ctx.warn(\n scopeDeprecationNotice(\n verb ? `audiences set ${scope} --products …` : 'audiences list',\n ),\n );\n\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n const resolved = await resolveSourceTarget(env, requireSession(env), {\n source: args.source,\n dir: args.dir,\n });\n const client = new ProductsClient(env, resolved.session);\n\n if (!verb || !product || !scope) {\n const list = await client.call((token) =>\n listProductScopes(env.host, token, resolved.source),\n );\n if (list.scopes.length === 0) {\n return ctx.succeed(\n { host: env.host, ...list },\n ctx.ui.result({\n title: `No product scopes on ${list.source.slug}`,\n rows: [['Teams see', 'every product the Source has']],\n notes: [\n 'Scopes are created at /admin/sources → the Source → Product scopes.',\n ],\n }),\n );\n }\n return ctx.succeed(\n { host: env.host, ...list },\n ctx.ui.result({\n title: `Product scopes on ${list.source.slug}`,\n rows: list.scopes.map((entry): [string, string[]] => [\n entry.name,\n [\n `${pluralize(entry.teamCount, 'team')}${entry.isDefault ? ' · given to every new team' : ''}`,\n entry.products.length > 0\n ? entry.products.map((item) => item.slug).join(', ')\n : 'no products',\n ],\n ]),\n notes: [\n 'A team sees in the app only the products of the scopes it holds.',\n '\"ekanos sources scopes add <scope> <product>\" shows a product to every team on a scope; \"ekanos teams scope show|set <team>\" reads or changes which scopes a team holds.',\n ],\n }),\n );\n }\n\n const included = verb === 'add';\n const result = await client.call((token) =>\n setScopeProduct(\n env.host,\n token,\n { source: resolved.source, scope, product },\n included,\n ),\n );\n return ctx.succeed(\n { host: env.host, ...result },\n ctx.ui.result({\n title: result.changed\n ? `${included ? 'Added' : 'Took'} ${result.product.name} ${included ? 'to' : 'out of'} ${result.scope.name}`\n : `${result.product.name} was already ${included ? 'in' : 'not in'} ${result.scope.name}`,\n tone: !included && result.changed ? 'warn' : 'ok',\n rows: [\n ['Teams on it', String(result.scope.teamCount)],\n [\n 'Products',\n result.scope.products.length > 0\n ? result.scope.products.map((item) => item.slug).join(', ')\n : 'none',\n ],\n ],\n notes: [\n included\n ? `Every team on ${result.scope.name} sees ${result.product.slug} in the app now.`\n : `Teams on ${result.scope.name} see ${result.product.slug} only if another of their scopes has it.`,\n ],\n }),\n );\n}\n\nfunction scopeProductSlug(value: string | undefined, verb: string): string {\n const slug = value?.trim().toLowerCase();\n if (slug && isProductSlug(slug)) return slug;\n if (value) {\n throw usageError(\n `\"${value}\" is not a product slug.`,\n `${PRODUCT_SLUG_SHAPE} \"ekanos sources products\" lists them.`,\n );\n }\n throw usageError(\n `sources scopes ${verb} needs a product.`,\n '\"ekanos sources products\" lists them, e.g. \"ekanos sources scopes add Bronze linear\".',\n );\n}\n\nfunction quoteArg(value: string): string {\n return /^[A-Za-z0-9._-]+$/.test(value) ? value : `\"${value}\"`;\n}\n\nfunction productSlug(value: string | undefined, verb: string): string {\n const slug = value?.trim().toLowerCase();\n if (slug && isProductSlug(slug)) return slug;\n if (value) {\n throw usageError(\n `\"${value}\" is not a product slug.`,\n `${PRODUCT_SLUG_SHAPE} \"ekanos sources products\" lists them.`,\n );\n }\n throw usageError(\n `sources products ${verb} needs a product.`,\n '\"ekanos sources products\" lists them, e.g. \"ekanos sources products enable agents\".',\n );\n}\n\nclass ProductsClient {\n constructor(\n private readonly env: AuthEnvironment,\n private session: StoredSession,\n ) {}\n\n async call<T>(\n send: (accessToken: string) => Promise<SourceProductsApiResult<T>>,\n ): Promise<T> {\n let result = await send(this.session.accessToken);\n if (result.status === 'unauthorized') {\n this.session = await refreshStoredSession(this.env, this.session);\n result = await send(this.session.accessToken);\n }\n if (result.status === 'ok') return result.data;\n throw authRequiredError(\n `The session for ${this.env.host} could not authorize the sources call.`,\n loginHint(this.env),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/commands/sources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAEL,oBAAoB,EACpB,cAAc,EACd,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE7E,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAGL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAmB,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAW,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,s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AAM,cAAc;IAClB,YACmB,GAAoB,EAC7B,OAAsB;mBADb,GAAG;uBACZ,OAAO;IACd,CAAC;IAEJ,KAAK,CAAC,IAAI,CACR,IAAkE;QAElE,IAAI,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAClD,IAAI,MAAM,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;YACrC,IAAI,CAAC,OAAO,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAClE,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC,IAAI,CAAC;QAC/C,MAAM,iBAAiB,CACrB,mBAAmB,IAAI,CAAC,GAAG,CAAC,IAAI,wCAAwC,EACxE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CACpB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { StoredSession } from '../auth/credential-store';\nimport { loginHint } from '../auth/host-trust';\nimport {\n type AuthEnvironment,\n refreshStoredSession,\n requireSession,\n resolveAuthEnvironment,\n} from '../auth/session';\nimport type { CliContext } from '../context';\nimport { authRequiredError, invalidStateError, usageError } from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport { hostPredatesFeatures, productGroup } from '../product-kinds';\nimport { PRODUCT_SLUG_SHAPE, isProductSlug } from '../product-slug';\nimport { EKANOS_CONFIG_FILENAME } from '../project';\nimport { fetchSeatsWithOneRefresh } from '../seats';\nimport {\n type SourceProduct,\n type SourceProductsApiResult,\n listSourceProducts,\n setSourceProduct,\n} from '../source-products-api';\nimport { resolveSourceTarget } from '../source-target';\nimport { type SourceSeat, stillUnauthorizedSourceSeats } from '../sources-api';\nimport { listProductScopes, setScopeProduct } from '../teams-api';\nimport { type Ui, pluralize, shortHost } from '../ui';\nimport { runSourceFeedback } from './feedback';\nimport { scopeDeprecationNotice } from './scope-notice';\nimport { runSourcePeople, runSourceRoles } from './sources-roles';\n\nexport interface SourcesArgs {\n host?: string;\n /** `products [enable|disable <product>]`, `scopes [add|remove <scope> <product>]`; none lists the sources. */\n positionals?: readonly string[];\n source?: string;\n yes?: boolean;\n /** `roles` and `people`: their flags (`--level`, `--permission`, `--search` …). */\n flags?: Record<string, string | boolean | string[]>;\n /** `roles delete` asks at a terminal; the test seams for it. */\n stdinIsTTY?: boolean;\n ask?: (question: string) => Promise<string>;\n /** Where a project's ekanos.json may sit — its `source` field, if any, is the marker. */\n dir: string;\n env: Record<string, string | undefined>;\n}\n\n/**\n * `sources` — list every source the caller holds a developer or admin seat\n * on, the read half of the publish-target-verification story.\n *\n * The list itself is the mechanism that makes `publish` safe: a partner (or\n * an agent acting for one) can always answer \"which sources can I possibly\n * publish to?\" before running `ekanos use` or passing `--source`.\n */\nexport async function runSources(\n ctx: CliContext,\n args: SourcesArgs,\n): Promise<ExitCode> {\n const [subcommand, ...rest] = args.positionals ?? [];\n if (subcommand !== undefined) {\n if (subcommand === 'scopes') return runScopes(ctx, args, rest);\n if (subcommand === 'roles') return runSourceRoles(ctx, args, rest);\n if (subcommand === 'people') return runSourcePeople(ctx, args, rest);\n if (subcommand === 'feedback') return runSourceFeedback(ctx, args, rest);\n if (subcommand !== 'products') {\n throw usageError(\n `Unknown sources subcommand \"${subcommand}\".`,\n 'Run \"ekanos sources\" to list your sources, \"ekanos sources products [enable|disable <product>]\", \"ekanos sources scopes [add|remove <scope> <product>]\", \"ekanos sources roles [list|create|update|delete <role>]\", \"ekanos sources people\" or \"ekanos sources feedback [status|enable|disable]\".',\n );\n }\n return runProducts(ctx, args, rest);\n }\n\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n const session = requireSession(env);\n\n const result = await fetchSeatsWithOneRefresh(env, session);\n\n if (result.status === 'unauthorized') {\n stillUnauthorizedSourceSeats(env);\n }\n\n const activeSource = readActiveSource(args.dir);\n\n return ctx.succeed(\n { host: env.host, sources: result.sources, activeSource },\n humanSummary(ctx.ui, env.host, result.sources, activeSource),\n );\n}\n\n/**\n * Best-effort, lenient read of ekanos.json's `source` field — mirrors\n * `readProjectHost` in `auth/session.ts`. A missing, unparseable, or\n * sourceless ekanos.json (or no project at all) simply means \"no active\n * source to mark\", never an error: `sources` must answer outside a project\n * too.\n */\nexport function readActiveSource(dir: string): string | null {\n const configPath = path.join(dir, EKANOS_CONFIG_FILENAME);\n\n let raw: string;\n try {\n raw = fs.readFileSync(configPath, 'utf8');\n } catch {\n return null;\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n return null;\n }\n\n const source =\n typeof parsed === 'object' && parsed !== null\n ? (parsed as { source?: unknown }).source\n : undefined;\n\n return typeof source === 'string' && source.trim().length > 0\n ? source.trim()\n : null;\n}\n\n/** Why a product is not enabled, by the lever that would enable it — the words `catalog` uses. */\nconst NOT_ENABLED_BECAUSE: Record<SourceProduct['lever'], string> = {\n flag: 'its Flag is off',\n plan: 'no active plan',\n entitlement: 'not granted',\n};\n\nfunction humanSummary(\n ui: Ui,\n host: string,\n sources: SourceSeat[],\n activeSource: string | null,\n): string {\n if (sources.length === 0) {\n return ui.result({\n // Read by any signed-in account, a team member's too: no word here\n // may imply the host serves more than one customer.\n title: 'No partner seats',\n tone: 'warn',\n rows: [['Host', shortHost(host)]],\n notes: ['This account has no partner seats on this host.'],\n });\n }\n\n const orphaned =\n activeSource && !sources.some((s) => s.slug === activeSource);\n\n return ui.result({\n title: `${pluralize(sources.length, 'source')} on ${shortHost(host)}`,\n rows: sources.map((source): [string, string] => [\n source.slug,\n [\n source.name ?? '(unnamed)',\n source.roles.join(', '),\n ...(source.slug === activeSource ? [ui.accent('this project')] : []),\n ].join(' · '),\n ]),\n notes: orphaned\n ? [\n `This project's ekanos.json points at \"${activeSource}\", which is not in the list above.`,\n ]\n : [],\n });\n}\n\n/**\n * `sources products` — the catalog as one Source has it: every product, its\n * kind (Feature or Integration), and whether it is enabled for the Source.\n * `enable|disable <product>` switch one through the levers `/admin` uses\n * (`attachProductToSource` / `detachProductFromSource` for an Integration,\n * the Feature lever for a Feature). A Source admin switches the\n * integrations their Source built (`owned`); anything else is a super-admin\n * grant, which an `ekanos login` session never carries, so from the terminal\n * that write answers with where to do it.\n */\nasync function runProducts(\n ctx: CliContext,\n args: SourcesArgs,\n rest: readonly string[],\n): Promise<ExitCode> {\n const [verb, rawProduct, ...extra] = rest;\n if (extra.length > 0) {\n throw usageError(\n `Unexpected argument \"${extra[0]}\".`,\n 'Run \"ekanos sources products [enable|disable <product>] [--source <slug>]\".',\n );\n }\n if (verb !== undefined && verb !== 'enable' && verb !== 'disable') {\n throw usageError(\n `Unknown sources products subcommand \"${verb}\".`,\n 'Run \"ekanos sources products\", \"ekanos sources products enable <product>\" or \"ekanos sources products disable <product> --yes\".',\n );\n }\n const product = verb ? productSlug(rawProduct, verb) : null;\n if (verb === 'disable' && !args.yes) {\n throw invalidStateError(\n `Disabling ${product} removes it from the Source: its plans, widget settings, Source credentials and workspaces go with it.`,\n `Re-run with --yes: ekanos sources products disable ${product} --yes`,\n );\n }\n\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n const resolved = await resolveSourceTarget(env, requireSession(env), {\n source: args.source,\n dir: args.dir,\n });\n const client = new ProductsClient(env, resolved.session);\n\n if (!verb || !product) {\n const list = await client.call((token) =>\n listSourceProducts(env.host, token, resolved.source),\n );\n const legacyHost = hostPredatesFeatures(list.products);\n const byKind = (kind: 'feature' | 'experience' | 'integration') =>\n list.products\n .filter((entry) => productGroup(entry, legacyHost) === kind)\n .map((entry): [string, string] => [\n entry.slug,\n `${entry.enabled ? '✓ enabled' : `✗ not enabled (${NOT_ENABLED_BECAUSE[entry.lever]})`} · ${entry.name}${entry.owned ? ' · built by this Source' : ''}${entry.registered ? '' : ' · no package on this host'}`,\n ]);\n return ctx.succeed(\n { host: env.host, ...list },\n [\n ctx.ui.result({\n title: `Features on ${list.source.slug}`,\n rows: byKind('feature'),\n }),\n ...(byKind('experience').length > 0\n ? [\n ctx.ui.result({\n title: `Experiences on ${list.source.slug}`,\n rows: byKind('experience'),\n }),\n ]\n : []),\n ctx.ui.result({\n title: `Integrations on ${list.source.slug}`,\n rows: byKind('integration'),\n notes: [\n list.canEnable\n ? '\"ekanos sources products enable|disable <product>\" switches one.'\n : list.canEnableOwned\n ? '\"ekanos sources products enable|disable <product>\" switches one built by this Source; Ekanos enables any other.'\n : 'Ekanos enables them.',\n '\"ekanos teams connect <team> <product>\" connects an enabled integration for a team.',\n ],\n }),\n ].join('\\n'),\n );\n }\n\n const enabled = verb === 'enable';\n const result = await client.call((token) =>\n setSourceProduct(env.host, token, {\n source: resolved.source,\n product,\n enabled,\n }),\n );\n return ctx.succeed(\n { host: env.host, ...result },\n ctx.ui.result({\n title: result.changed\n ? `${enabled ? 'Enabled' : 'Disabled'} ${result.product.name} for ${result.source.slug}`\n : `${result.product.name} was already ${enabled ? 'enabled' : 'off'} for ${result.source.slug}`,\n rows: [\n ['Kind', result.product.kind],\n [\n 'Switched by',\n result.product.lever === 'flag'\n ? 'its Flag'\n : result.product.lever === 'plan'\n ? 'its plan'\n : 'the entitlement',\n ],\n ],\n notes:\n enabled && result.product.kind === 'integration'\n ? [\n `Next: \"ekanos teams connect <team> ${result.product.slug}\" connects it for a team.`,\n ]\n : [],\n }),\n );\n}\n\n/**\n * `sources scopes` — the Source's product scopes, for its Source admin: each\n * scope's products and how many teams hold it. Once a Source has a scope,\n * each team sees in the app only its scopes' products. `add|remove <scope>\n * <product>` changes one scope (by name or id) through what\n * `/admin/sources/[id]/scopes` uses; a product can only be added if\n * the Source has it. Taking one out hides it from every team on the scope\n * that no other of its scopes shows it to, so that needs `--yes`.\n */\nasync function runScopes(\n ctx: CliContext,\n args: SourcesArgs,\n rest: readonly string[],\n): Promise<ExitCode> {\n const [verb, rawScope, rawProduct, ...extra] = rest;\n const usage =\n 'Run \"ekanos sources scopes\", \"ekanos sources scopes add <scope> <product>\" or \"ekanos sources scopes remove <scope> <product> --yes\".';\n if (verb !== undefined && verb !== 'add' && verb !== 'remove') {\n throw usageError(`Unknown sources scopes subcommand \"${verb}\".`, usage);\n }\n if (extra.length > 0) {\n throw usageError(`Unexpected argument \"${extra[0]}\".`, usage);\n }\n const scope = rawScope?.trim();\n if (verb && !scope) {\n throw usageError(\n `sources scopes ${verb} needs a scope and a product.`,\n usage,\n );\n }\n const product = verb ? scopeProductSlug(rawProduct, verb) : null;\n if (verb === 'remove' && !args.yes) {\n throw invalidStateError(\n `Taking ${product} out of ${scope} hides it, in the app, from every team on ${scope} that no other of its scopes shows it to.`,\n `Re-run with --yes: ekanos sources scopes remove ${quoteArg(scope!)} ${product} --yes`,\n );\n }\n\n ctx.warn(\n scopeDeprecationNotice(\n verb ? `audiences set ${scope} --products …` : 'audiences list',\n ),\n );\n\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n const resolved = await resolveSourceTarget(env, requireSession(env), {\n source: args.source,\n dir: args.dir,\n });\n const client = new ProductsClient(env, resolved.session);\n\n if (!verb || !product || !scope) {\n const list = await client.call((token) =>\n listProductScopes(env.host, token, resolved.source),\n );\n if (list.scopes.length === 0) {\n return ctx.succeed(\n { host: env.host, ...list },\n ctx.ui.result({\n title: `No product scopes on ${list.source.slug}`,\n rows: [['Teams see', 'every product the Source has']],\n notes: [\n 'Scopes are created at /admin/sources → the Source → Product scopes.',\n ],\n }),\n );\n }\n return ctx.succeed(\n { host: env.host, ...list },\n ctx.ui.result({\n title: `Product scopes on ${list.source.slug}`,\n rows: list.scopes.map((entry): [string, string[]] => [\n entry.name,\n [\n `${pluralize(entry.teamCount, 'team')}${entry.isDefault ? ' · given to every new team' : ''}`,\n entry.products.length > 0\n ? entry.products.map((item) => item.slug).join(', ')\n : 'no products',\n ],\n ]),\n notes: [\n 'A team sees in the app only the products of the scopes it holds.',\n '\"ekanos sources scopes add <scope> <product>\" shows a product to every team on a scope; \"ekanos teams scope show|set <team>\" reads or changes which scopes a team holds.',\n ],\n }),\n );\n }\n\n const included = verb === 'add';\n const result = await client.call((token) =>\n setScopeProduct(\n env.host,\n token,\n { source: resolved.source, scope, product },\n included,\n ),\n );\n return ctx.succeed(\n { host: env.host, ...result },\n ctx.ui.result({\n title: result.changed\n ? `${included ? 'Added' : 'Took'} ${result.product.name} ${included ? 'to' : 'out of'} ${result.scope.name}`\n : `${result.product.name} was already ${included ? 'in' : 'not in'} ${result.scope.name}`,\n tone: !included && result.changed ? 'warn' : 'ok',\n rows: [\n ['Teams on it', String(result.scope.teamCount)],\n [\n 'Products',\n result.scope.products.length > 0\n ? result.scope.products.map((item) => item.slug).join(', ')\n : 'none',\n ],\n ],\n notes: [\n included\n ? `Every team on ${result.scope.name} sees ${result.product.slug} in the app now.`\n : `Teams on ${result.scope.name} see ${result.product.slug} only if another of their scopes has it.`,\n ],\n }),\n );\n}\n\nfunction scopeProductSlug(value: string | undefined, verb: string): string {\n const slug = value?.trim().toLowerCase();\n if (slug && isProductSlug(slug)) return slug;\n if (value) {\n throw usageError(\n `\"${value}\" is not a product slug.`,\n `${PRODUCT_SLUG_SHAPE} \"ekanos sources products\" lists them.`,\n );\n }\n throw usageError(\n `sources scopes ${verb} needs a product.`,\n '\"ekanos sources products\" lists them, e.g. \"ekanos sources scopes add Bronze linear\".',\n );\n}\n\nfunction quoteArg(value: string): string {\n return /^[A-Za-z0-9._-]+$/.test(value) ? value : `\"${value}\"`;\n}\n\nfunction productSlug(value: string | undefined, verb: string): string {\n const slug = value?.trim().toLowerCase();\n if (slug && isProductSlug(slug)) return slug;\n if (value) {\n throw usageError(\n `\"${value}\" is not a product slug.`,\n `${PRODUCT_SLUG_SHAPE} \"ekanos sources products\" lists them.`,\n );\n }\n throw usageError(\n `sources products ${verb} needs a product.`,\n '\"ekanos sources products\" lists them, e.g. \"ekanos sources products enable agents\".',\n );\n}\n\nclass ProductsClient {\n constructor(\n private readonly env: AuthEnvironment,\n private session: StoredSession,\n ) {}\n\n async call<T>(\n send: (accessToken: string) => Promise<SourceProductsApiResult<T>>,\n ): Promise<T> {\n let result = await send(this.session.accessToken);\n if (result.status === 'unauthorized') {\n this.session = await refreshStoredSession(this.env, this.session);\n result = await send(this.session.accessToken);\n }\n if (result.status === 'ok') return result.data;\n throw authRequiredError(\n `The session for ${this.env.host} could not authorize the sources call.`,\n loginHint(this.env),\n );\n }\n}\n"]}
@@ -99,7 +99,7 @@ export async function runStatus(ctx, args) {
99
99
  host: env.host,
100
100
  session: stored !== null && stored !== void 0 ? stored : undefined,
101
101
  });
102
- announceUpdate(ctx, notice);
102
+ announceUpdate(ctx, notice, { env: args.env });
103
103
  const session = stored
104
104
  ? await probeSession(env, stored)
105
105
  : {
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAGL,eAAe,GAChB,MA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CAAC","sourcesContent":["import { isRepoRoot } from '@ekanos/integration-schema/repo';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { StoredSession } from '../auth/credential-store';\nimport { loginHint } from '../auth/host-trust';\nimport {\n refreshStoredSession,\n resolveAuthEnvironment,\n resolveIdentity,\n} from '../auth/session';\nimport type { CliContext } from '../context';\nimport {\n CliError,\n authRequiredError,\n gateFailedError,\n preconditionError,\n timeoutError,\n usageError,\n} from '../errors';\nimport { ERROR_CODES, type ExitCode } from '../exit-codes';\nimport { formatFindings, relativeTime } from '../findings-renderer';\nimport { EKANOS_CONFIG_FILENAME, loadProject } from '../project';\nimport {\n type SubmissionListing,\n type SubmissionVersion,\n listSubmissions,\n} from '../publish-api';\nimport { fetchSeatsWithOneRefresh } from '../seats';\nimport { type ResultRow, type Ui, shortHost } from '../ui';\nimport { announceUpdate, checkForUpdate } from '../update-notice';\nimport { readProjectVersion } from './publish';\n\n/** The first wait between polls; each one after it doubles, up to the cap. */\nconst WATCH_POLL_START_MS = 5_000;\nconst WATCH_POLL_CAP_MS = 30_000;\n\n/** How long `--wait` waits for a verdict when `--timeout` is not given. */\nexport const DEFAULT_WAIT_MINUTES = 30;\n\n/** The wait before poll number `attempt` (0-based): 5s, 10s, 20s, then 30s. */\nexport function pollDelayMs(attempt: number): number {\n return Math.min(WATCH_POLL_START_MS * 2 ** attempt, WATCH_POLL_CAP_MS);\n}\n\n/** `--timeout <minutes>`: a positive number, or the default. */\nexport function parseTimeoutMinutes(raw: string | undefined): number {\n if (raw === undefined) return DEFAULT_WAIT_MINUTES;\n const minutes = Number(raw);\n if (!Number.isFinite(minutes) || minutes <= 0) {\n throw usageError(\n `--timeout \"${raw}\" is not a number of minutes.`,\n 'Pass a positive number of minutes, e.g. \"--wait --timeout 45\".',\n );\n }\n\n return minutes;\n}\n\n/**\n * The states `--watch` stops on. `submitted` is the only non-terminal state\n * a version can be in when watching starts (an already-`gated`/`dev`/\n * `rejected` version resolves on the very first check, no polling needed).\n */\nconst WATCH_TERMINAL_STATES = new Set(['gated', 'dev', 'rejected']);\n\nexport interface StatusArgs {\n host?: string;\n /** Project directory (may contain ekanos.json). Defaults to cwd. */\n dir: string;\n env: Record<string, string | undefined>;\n /** Render each version's full finding list, not just error/warn counts. */\n findings?: boolean;\n /**\n * Expand \"OTHER INTEGRATIONS IN SOURCE …\" from one summary line per\n * integration into the same VERSION/STATE/AGE/FINDINGS table shape THIS\n * PROJECT's section uses. Human mode only — the JSON envelope's\n * `submissions` already carries every integration's full version history\n * regardless of this flag.\n */\n all?: boolean;\n /**\n * Block until this project's current (slug, version) submission reaches a\n * terminal-for-waiting state (gated, dev, rejected), polling every 30s.\n * Changes the command's exit-code contract — see `runStatus`'s docstring.\n */\n watch?: boolean;\n /** `--timeout <minutes>` for `--watch`/`--wait`: how long to wait (default 30). */\n timeoutMinutes?: number;\n /** Injectable for tests — see `auth/device-flow.ts`'s identical pattern. */\n sleep?: (ms: number) => Promise<void>;\n /** Injectable \"now\" for deterministic AGE rendering in tests. Defaults to `new Date()`. */\n now?: Date;\n}\n\ninterface SessionReport {\n authenticated: boolean;\n user?: { id: string; email: string | null; name: string | null };\n expiresAt?: string;\n hint?: string;\n}\n\ninterface ProjectReport {\n dir: string;\n slug: string;\n source: string | null;\n}\n\n/**\n * `status` — the read verb: where am I pointed, who am I, and what has this\n * project submitted?\n *\n * Three sections, each degrading gracefully rather than failing:\n *\n * - **session** — whoami's server-side identity check, but an absent or dead\n * session reports `authenticated: false` with a hint instead of exit 4. A\n * partner asking \"what is my state?\" must get an answer, not an error whose\n * answer it is.\n * - **project** — the ekanos.json in `--dir` (default cwd), when there is\n * one. No project is an ordinary state for `status`, never an error.\n * - **submissions** — `GET /api/partner/submissions?source=…` for the\n * project's resolved source, only when both a session and a source exist.\n * Server errors here DO map through the taxonomy: an unreachable host or a\n * missing source is a fault to surface, not a state to absorb.\n *\n * Exit 0 whenever the report itself could be assembled — EXCEPT under\n * `--watch` (see below), whose exit code carries the gate's verdict instead.\n *\n * The submission listing always requests the full `?detail=findings` shape\n * server-side (needed so THIS PROJECT's latest-error auto-inline rendering\n * — see `humanSummary` — has findings to inspect without a second\n * round-trip). `--findings` no longer changes what's FETCHED; it changes\n * what's RENDERED inline in human mode: every shown version's findings,\n * not just the latest's error-severity ones.\n *\n * `--watch` turns `status` into a blocking wait: it requires a project with\n * a resolved source and a live session (both are PRECONDITIONs here, not\n * degraded-to-false states — there is nothing to watch without them), then\n * polls `GET /api/partner/submissions?detail=findings` every 30s for THIS\n * project's current (slug, package.json version) submission until it reaches\n * a terminal-for-waiting state: `gated`/`dev` exit 0, `rejected` exits 10\n * (GATE_FAILED) with the findings carried in `data` — the same shape\n * `publish`'s own gate refusal uses, so an agent's fix-then-retry loop\n * branches on it identically whether the gate ran inline (future) or via\n * this poll (today). `--json --watch` still emits exactly ONE envelope, at\n * completion — the polling itself only ever writes to stderr via `ctx.log`.\n *\n * Human-mode rendering is PROJECT-SCOPED: the server lists every\n * submission for the resolved source (an org-level bucket shared by every\n * project publishing there — `listSubmissions` has no server-side slug\n * filter, see `publish-api.ts`'s wire contract), so \"THIS PROJECT\" groups\n * the rows matching this project's own slug and \"OTHER INTEGRATIONS IN\n * SOURCE …\" collapses everything else to one summary line per integration\n * (or, with `--all`, the same table shape).\n * The `--json` envelope stays additive-compatible: `submissions` is still\n * the full, unfiltered list, with `data.project.scopedSubmissions` and\n * `data.otherIntegrations` layered on top for a consumer that wants the\n * pre-grouped view without re-deriving it.\n */\nexport async function runStatus(\n ctx: CliContext,\n args: StatusArgs,\n): Promise<ExitCode> {\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n\n const stored = env.store.read(env.host);\n\n const notice = await checkForUpdate({\n env: args.env,\n host: env.host,\n session: stored ?? undefined,\n });\n announceUpdate(ctx, notice);\n\n const session = stored\n ? await probeSession(env, stored)\n : {\n authenticated: false,\n hint: loginHint(env, 'to sign in.'),\n };\n\n // probeSession may have refreshed the session — persisting a NEW access\n // token and ROTATING the refresh token on disk. Re-read before using it:\n // the pre-probe object now holds a dead access token and an already-spent\n // refresh token, and presenting those would turn \"logged in, token was\n // merely stale\" into a hard exit-4 — the one failure this command promises\n // never to produce.\n const live = stored ? (env.store.read(env.host) ?? stored) : null;\n\n const project = readProjectReport(args.dir);\n\n if (args.watch) {\n if (!session.authenticated || !live) {\n throw authRequiredError(\n `\"ekanos status --watch\" needs a live session on ${env.host}.`,\n loginHint(env),\n );\n }\n\n if (!project) {\n throw preconditionError(\n `No ekanos.json found in ${path.resolve(args.dir)}.`,\n 'Run \"ekanos publish\" at least once before watching its gate result.',\n );\n }\n\n if (!project.source) {\n throw preconditionError(\n 'This project has no \"source\" in ekanos.json yet.',\n 'Run \"ekanos publish\" at least once (it saves the source you ' +\n 'publish to) before watching its gate result.',\n );\n }\n\n return runWatch(ctx, env, project, args);\n }\n\n let submissions: SubmissionListing[] | null = null;\n\n if (project?.source && session.authenticated && live) {\n // Always the full `?detail=findings` shape, `--findings` or not: THIS\n // PROJECT's auto-inline latest-error rendering (see `humanSummary`)\n // needs the findings array to decide whether to render, not just the\n // counts — and `data.project.scopedSubmissions` carries the same\n // richer shape in the JSON envelope regardless of the flag. `--findings`\n // now controls how much of it gets rendered inline, not what's fetched.\n submissions = await listWithOneRefresh(\n env,\n live,\n project.source,\n 'findings',\n );\n } else if (project?.source && !session.authenticated) {\n // Human mode says this in the result block's note; the stderr line is\n // for JSON callers, who never see that block.\n if (ctx.jsonMode) {\n ctx.log(\n `ekanos: not logged in to ${env.host} — skipping the submission list. ` +\n (session.hint ?? ''),\n );\n }\n } else if (project && !project.source) {\n if (ctx.jsonMode)\n ctx.log(\n 'ekanos: this project has no \"source\" in ekanos.json yet — the first ' +\n '\"ekanos publish --source <slug>\" saves one, and status will list ' +\n 'submissions from then on.',\n );\n }\n\n const projectIntegration =\n project && submissions\n ? (submissions.find((s) => s.slug === project.slug) ?? null)\n : null;\n\n const otherIntegrations = submissions\n ? submissions\n .filter((s) => s.slug !== project?.slug)\n .map((s) => summarizeIntegration(s))\n : null;\n\n // Best-effort, human-mode-only add-on for the header's \"publish target\n // (+ seat role)\" line — same degrade-to-null contract as `whoami`'s own\n // seat lookup. Skipped entirely in JSON mode: nothing in the envelope\n // needs it, and it would otherwise be an extra network round-trip every\n // existing `--json` caller pays for no reason.\n const seatRole =\n !ctx.jsonMode && project?.source && session.authenticated && live\n ? await fetchSeatRoleQuietly(env, live, project.source)\n : null;\n\n return ctx.succeed(\n {\n host: env.host,\n ...session,\n credentialsPath: env.store.filePath,\n project: project\n ? {\n ...project,\n scopedSubmissions: submissions\n ? (projectIntegration?.versions ?? [])\n : null,\n }\n : null,\n submissions,\n ...(otherIntegrations !== null ? { otherIntegrations } : {}),\n ...(notice ? { toolchain: notice } : {}),\n },\n humanSummary(\n ctx.ui,\n project?.dir ?? path.resolve(args.dir),\n env.host,\n session,\n project,\n submissions,\n { findings: args.findings ?? false, all: args.all ?? false },\n seatRole,\n args.now ?? new Date(),\n ),\n );\n}\n\n/**\n * The `--watch` poll loop. Targets THIS project's current submission —\n * `project.slug` + the version presently in `package.json` (the same value\n * `publish` would submit right now) — not \"whatever's most recent,\" so\n * watching after a publish can never resolve against a stale prior version.\n */\nasync function runWatch(\n ctx: CliContext,\n env: ReturnType<typeof resolveAuthEnvironment>,\n project: ProjectReport,\n args: StatusArgs,\n): Promise<ExitCode> {\n const source = project.source;\n if (!source) {\n // Unreachable — the caller already checked — but keeps this function's\n // own type honest without a non-null assertion.\n throw preconditionError(\n 'This project has no \"source\" in ekanos.json yet.',\n 'Run \"ekanos publish\" at least once before watching its gate result.',\n );\n }\n\n const targetVersion = readProjectVersion(project.dir);\n\n // Glyph-only restyle — the poll contract itself (exit codes, timing,\n // JSON envelope) is unchanged.\n const waitGlyph = ctx.jsonMode ? '' : `${ctx.ui.dim(ctx.ui.glyphs.info)} `;\n const prefix = ctx.jsonMode ? 'ekanos: ' : '';\n\n ctx.log(\n `${waitGlyph}${prefix}watching ${project.slug}@${targetVersion} on ${env.host} ` +\n `(polling, up to ${args.timeoutMinutes ?? DEFAULT_WAIT_MINUTES} min)…`,\n );\n\n const waited = await waitForGate(ctx, env, {\n slug: project.slug,\n source,\n version: targetVersion,\n timeoutMinutes: args.timeoutMinutes ?? DEFAULT_WAIT_MINUTES,\n sleep: args.sleep ?? defaultSleep,\n });\n\n return waited.timedOut\n ? failWatchTimeout(ctx, project.slug, targetVersion, waited)\n : reportWatchOutcome(ctx, project.slug, waited.version);\n}\n\nexport type GateWait =\n | { timedOut: false; version: SubmissionVersion }\n | {\n timedOut: true;\n lastState: string | null;\n waitedMinutes: number;\n };\n\n/**\n * Poll the submission list until `slug@version` reaches a verdict (see\n * `WATCH_TERMINAL_STATES`) or `timeoutMinutes` of waiting has passed. Waits\n * back off from 5s to a 30s cap. The elapsed time is the sum of the waits, so\n * a test with an instant `sleep` still reaches the timeout.\n */\nexport async function waitForGate(\n ctx: CliContext,\n env: ReturnType<typeof resolveAuthEnvironment>,\n target: {\n slug: string;\n source: string;\n version: string;\n timeoutMinutes: number;\n sleep: (ms: number) => Promise<void>;\n },\n): Promise<GateWait> {\n const waitGlyph = ctx.jsonMode ? '' : `${ctx.ui.dim(ctx.ui.glyphs.info)} `;\n const prefix = ctx.jsonMode ? 'ekanos: ' : '';\n const budgetMs = target.timeoutMinutes * 60_000;\n let waitedMs = 0;\n\n for (let attempt = 0; ; attempt += 1) {\n // Re-read the session from the credential store on EVERY iteration —\n // never carry one over in a closure. Auth0 rotates the refresh token on\n // every use (see `refreshStoredSession`'s docstring), so a token this\n // loop already consumed is dead by the next iteration; the store is the\n // persisted source of truth for whichever refresh most recently landed\n // — this loop's own (via `listWithOneRefresh` below, which persists\n // through `refreshStoredSession`), or a concurrent one from another\n // process (another terminal running login/publish/status --watch\n // against the same host). Threading the refreshed session back out of\n // `listWithOneRefresh` instead would only cover the first case.\n const current = env.store.read(env.host);\n\n if (!current) {\n throw authRequiredError(\n `The session for ${env.host} is gone — waiting for the gate ` +\n 'cannot continue without it.',\n loginHint(env),\n );\n }\n\n const integrations = await listWithOneRefresh(\n env,\n current,\n target.source,\n 'findings',\n );\n const version = findVersion(integrations, target.slug, target.version);\n\n if (version && WATCH_TERMINAL_STATES.has(version.state)) {\n return { timedOut: false, version };\n }\n\n const delay = pollDelayMs(attempt);\n if (waitedMs + delay > budgetMs) {\n return {\n timedOut: true,\n lastState: version?.state ?? null,\n waitedMinutes: Math.round(waitedMs / 6_000) / 10,\n };\n }\n\n ctx.log(\n `${waitGlyph}${prefix}${target.slug}@${target.version} is ` +\n `${version ? version.state : 'not visible yet'} — waiting…`,\n );\n\n await target.sleep(delay);\n waitedMs += delay;\n }\n}\n\n/** The exit-11 outcome: the gate has not answered, but it may still. */\nexport function failWatchTimeout(\n ctx: CliContext,\n slug: string,\n version: string,\n waited: Extract<GateWait, { timedOut: true }>,\n): ExitCode {\n return ctx.fail(\n timeoutError(\n `${slug}@${version} had no gate verdict after ${waited.waitedMinutes} minutes` +\n `${waited.lastState ? ` (still \"${waited.lastState}\")` : ''}.`,\n 'The gate may still be running. Run \"ekanos status --watch\" to keep waiting, or raise --timeout.',\n ),\n { slug, version, state: waited.lastState, timedOut: true },\n );\n}\n\nfunction findVersion(\n integrations: SubmissionListing[],\n slug: string,\n version: string,\n): SubmissionVersion | null {\n const integration = integrations.find((i) => i.slug === slug);\n return integration?.versions.find((v) => v.version === version) ?? null;\n}\n\nexport function watchOutcomeData(slug: string, version: SubmissionVersion) {\n return {\n slug,\n version: version.version,\n state: version.state,\n gatedAt: version.gatedAt,\n errorCount: version.errorCount,\n warnCount: version.warnCount,\n findings: version.findings ?? [],\n stages: version.stages ?? [],\n };\n}\n\nfunction reportWatchOutcome(\n ctx: CliContext,\n slug: string,\n version: SubmissionVersion,\n): ExitCode {\n const data = watchOutcomeData(slug, version);\n\n if (version.state === 'rejected') {\n return ctx.fail(\n gateFailedError(\n `${slug}@${version.version} was rejected by the gate ` +\n `(${data.errorCount ?? 0} error${data.errorCount === 1 ? '' : 's'}).`,\n 'Resolve the error-severity findings in data.findings, bump the ' +\n 'version, and re-run \"ekanos publish\".',\n ),\n data,\n );\n }\n\n return ctx.succeed(\n data,\n ctx.ui.result({\n title: `${slug}@${version.version} is ${version.state}`,\n tone: data.warnCount ? 'warn' : 'ok',\n rows: [\n ['State', version.state],\n ...(data.warnCount\n ? [['Warnings', String(data.warnCount)] as const]\n : []),\n ],\n }),\n );\n}\n\nfunction defaultSleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\n/**\n * whoami's identity resolution, with AUTH_REQUIRED absorbed into\n * `authenticated: false`. Anything else — network, precondition, MFA mapped\n * to auth by `fetchIdentity` — still propagates: \"the host was unreachable\"\n * must never be reported as \"you are logged out\".\n */\nasync function probeSession(\n env: ReturnType<typeof resolveAuthEnvironment>,\n stored: StoredSession,\n): Promise<SessionReport> {\n try {\n const { identity, session } = await resolveIdentity(env, stored);\n\n return {\n authenticated: true,\n user: { id: identity.id, email: identity.email, name: identity.name },\n expiresAt: session.expiresAt,\n };\n } catch (error) {\n if (error instanceof CliError && error.code === ERROR_CODES.AUTH_REQUIRED) {\n return { authenticated: false, hint: error.hint };\n }\n\n throw error;\n }\n}\n\n/**\n * Lenient project read: no ekanos.json means \"not in a project\", which is an\n * answer, not an error. An ekanos.json that EXISTS but does not load keeps\n * `loadProject`'s strict behaviour — a broken project file is a fault the\n * partner needs named, whatever verb they ran.\n */\nfunction readProjectReport(dir: string): ProjectReport | null {\n const projectDir = path.resolve(dir);\n\n // A repo root is not one project: status reports no project there, as it\n // does outside any.\n if (\n !fs.existsSync(path.join(projectDir, EKANOS_CONFIG_FILENAME)) ||\n isRepoRoot(projectDir)\n ) {\n return null;\n }\n\n const loaded = loadProject(projectDir);\n\n return {\n dir: loaded.projectDir,\n slug: loaded.primary.slug,\n source: loaded.project.source ?? null,\n };\n}\n\n/** Mirrors publish's one-refresh-one-retry on a stale access token. */\nasync function listWithOneRefresh(\n env: ReturnType<typeof resolveAuthEnvironment>,\n session: StoredSession,\n source: string,\n detail?: 'findings',\n): Promise<SubmissionListing[]> {\n const first = await listSubmissions(env.host, session.accessToken, source, {\n detail,\n });\n\n if (first.status === 'ok') return first.integrations;\n\n const refreshed = await refreshStoredSession(env, session);\n const second = await listSubmissions(\n env.host,\n refreshed.accessToken,\n source,\n {\n detail,\n },\n );\n\n if (second.status === 'ok') return second.integrations;\n\n // Authenticated a moment ago, unauthorized twice here: report the list as\n // unavailable rather than the session as dead — probeSession already proved\n // it. This is unreachable in practice; belt and braces for a racing revoke.\n throw authRequiredError(\n `The session for ${env.host} could not authorize the submission list.`,\n loginHint(env),\n );\n}\n\n/**\n * `whoami`'s seat-lookup degradation, narrowed to one source's role: a\n * network hiccup, MFA, or a deployment predating the seats route must never\n * turn a working `status` into a failing one — the header simply omits the\n * \"(role)\" suffix.\n */\nasync function fetchSeatRoleQuietly(\n env: ReturnType<typeof resolveAuthEnvironment>,\n session: StoredSession,\n source: string,\n): Promise<string | null> {\n try {\n const result = await fetchSeatsWithOneRefresh(env, session);\n if (result.status !== 'ok') return null;\n\n const seat = result.sources.find((s) => s.slug === source);\n return seat ? seat.roles.join(', ') : null;\n } catch {\n return null;\n }\n}\n\nfunction tryReadProjectVersion(dir: string): string | null {\n try {\n return readProjectVersion(dir);\n } catch {\n return null;\n }\n}\n\nfunction timestampMs(iso: string | null | undefined): number {\n if (!iso) return 0;\n const parsed = new Date(iso).getTime();\n return Number.isNaN(parsed) ? 0 : parsed;\n}\n\n/**\n * Newest-first by `gatedAt ?? submittedAt`. Ties (including two versions\n * with no timestamp at all) keep their original, server-given order —\n * `Array#sort` is stable, and a stable no-op is the right answer when there\n * is nothing to compare.\n */\nexport function sortVersionsNewestFirst(\n versions: readonly SubmissionVersion[],\n): SubmissionVersion[] {\n return [...versions].sort(\n (a, b) =>\n timestampMs(b.gatedAt ?? b.submittedAt) -\n timestampMs(a.gatedAt ?? a.submittedAt),\n );\n}\n\nfunction versionAge(version: SubmissionVersion, now: Date): string {\n const timestamp = version.gatedAt ?? version.submittedAt;\n return timestamp ? relativeTime(timestamp, now) : '—';\n}\n\nexport function findingsCellParts(\n ui: Ui,\n version: SubmissionVersion,\n): { text: string; paint: (text: string) => string } {\n if (version.errorCount === null && version.warnCount === null) {\n return { text: '—', paint: ui.dim };\n }\n\n const errorCount = version.errorCount ?? 0;\n const warnCount = version.warnCount ?? 0;\n\n if (errorCount === 0 && warnCount === 0) {\n return { text: '0', paint: (text) => text };\n }\n\n const parts: string[] = [];\n if (errorCount > 0) parts.push(`${errorCount}E`);\n if (warnCount > 0) parts.push(`${warnCount}W`);\n\n return { text: parts.join(' '), paint: errorCount > 0 ? ui.err : ui.warn };\n}\n\nexport function stateColorFor(ui: Ui, state: string): (text: string) => string {\n if (state === 'dev' || state === 'prod') return ui.ok;\n if (state === 'gated') return ui.accent;\n if (state === 'submitted' || state === 'superseded') return ui.dim;\n if (state === 'rejected' || state === 'revoked') return ui.err;\n return (text) => text;\n}\n\n/**\n * A VERSION/STATE/AGE/FINDINGS table, built by hand rather than via\n * `ui.table`: STATE and FINDINGS need per-cell color, and `ui.table` sizes\n * columns from the raw cell strings it's handed — a colored cell's ANSI\n * escapes would inflate that width and misalign the column. `ui.ts`'s own\n * doc comment on `padCell` names this exact tradeoff (\"ignoring color codes\n * in length math is the CALLER's job — pad before coloring, never after\"),\n * so this pads against the PLAIN text first and colors the already-padded\n * string — the same rule `ui.table` documents, just applied here instead of\n * inside it.\n */\nexport function renderVersionsTable(\n ui: Ui,\n versions: readonly SubmissionVersion[],\n now: Date,\n): string {\n const headers = ['VERSION', 'STATE', 'AGE', 'FINDINGS'] as const;\n\n const rows = versions.map((version) => {\n const findings = findingsCellParts(ui, version);\n return {\n version: version.version,\n state: version.state,\n age: versionAge(version, now),\n findingsText: findings.text,\n findingsPaint: findings.paint,\n statePaint: stateColorFor(ui, version.state),\n };\n });\n\n const widths: [number, number, number, number] = [\n Math.max(headers[0].length, ...rows.map((r) => r.version.length)),\n Math.max(headers[1].length, ...rows.map((r) => r.state.length)),\n Math.max(headers[2].length, ...rows.map((r) => r.age.length)),\n Math.max(headers[3].length, ...rows.map((r) => r.findingsText.length)),\n ];\n\n const headerLine = headers\n .map((header, i) => ui.dim(header.padEnd(widths[i]!)))\n .join(' ');\n\n const bodyLines = rows.map((row) =>\n [\n row.version.padEnd(widths[0]),\n row.statePaint(row.state.padEnd(widths[1])),\n row.age.padEnd(widths[2]),\n row.findingsPaint(row.findingsText.padEnd(widths[3])),\n ].join(' '),\n );\n\n return [headerLine, ...bodyLines].join('\\n');\n}\n\n/**\n * The findings shown directly under THIS PROJECT's table. `--findings`\n * forces every version's own findings inline; otherwise only the LATEST\n * version's ERROR-severity findings auto-render (the moment a partner most\n * needs them, no flag required), and a dim pointer at `ekanos status\n * --findings` covers everything else with a nonzero count.\n */\nfunction renderThisProjectFindings(\n ui: Ui,\n cwd: string,\n sorted: readonly SubmissionVersion[],\n forceAll: boolean,\n): string | null {\n if (forceAll) {\n const blocks = sorted\n .filter((v) => v.findings && v.findings.length > 0)\n .map((v) =>\n [\n ` ${ui.dim(`${v.version}:`)}`,\n indentLines(formatFindings(ui, v.findings!, { cwd }), 4),\n ].join('\\n'),\n );\n\n return blocks.length > 0 ? blocks.join('\\n\\n') : null;\n }\n\n const [latest, ...older] = sorted;\n const latestErrors = (latest?.findings ?? []).filter(\n (f) => f.severity === 'error',\n );\n\n if (latest && latestErrors.length > 0 && latest.findings) {\n return indentLines(formatFindings(ui, latest.findings, { cwd }), 2);\n }\n\n const latestNonzero =\n (latest?.errorCount ?? 0) > 0 || (latest?.warnCount ?? 0) > 0;\n const olderNonzero = older.some(\n (v) => (v.errorCount ?? 0) > 0 || (v.warnCount ?? 0) > 0,\n );\n\n return latestNonzero || olderNonzero\n ? ` ${ui.dim('→ details: ekanos status --findings')}`\n : null;\n}\n\nexport interface OtherIntegrationSummary {\n slug: string;\n /** The full name (`acme/google-drive`); absent on an older host. */\n displayName?: string;\n name: string | null;\n versionsCount: number;\n latestVersion: string | null;\n latestState: string | null;\n}\n\nexport function summarizeIntegration(\n integration: SubmissionListing,\n): OtherIntegrationSummary {\n const latest = sortVersionsNewestFirst(integration.versions)[0] ?? null;\n return {\n slug: integration.slug,\n ...(integration.displayName\n ? { displayName: integration.displayName }\n : {}),\n name: integration.name,\n versionsCount: integration.versions.length,\n latestVersion: latest?.version ?? null,\n latestState: latest?.state ?? null,\n };\n}\n\nfunction indentLines(block: string, spaces: number): string {\n const prefix = ' '.repeat(spaces);\n return block\n .split('\\n')\n .map((line) => `${prefix}${line}`)\n .join('\\n');\n}\n\nfunction buildHeaderRows(\n host: string,\n session: SessionReport,\n project: ProjectReport | null,\n seatRole: string | null,\n): readonly ResultRow[] {\n const rows: ResultRow[] = [];\n\n if (session.authenticated) {\n rows.push([\n 'Account',\n session.user?.email ?? session.user?.id ?? 'unknown',\n ]);\n }\n rows.push(['Host', shortHost(host)]);\n\n if (project) {\n const version = tryReadProjectVersion(project.dir);\n rows.push([\n 'Project',\n version ? `${project.slug}@${version}` : project.slug,\n ]);\n rows.push([\n 'Target',\n project.source\n ? `${project.source}${seatRole ? ` · ${seatRole}` : ''}`\n : 'none yet',\n ]);\n }\n\n return rows;\n}\n\n/**\n * The closing `ui.nextAction` line, chosen from the LATEST version of THIS\n * project — `null` (no closing line at all) whenever nothing is pending:\n * no submission yet, or the latest is already `dev`/`prod`/`revoked`.\n */\nexport function buildNextAction(\n ui: Ui,\n latest: SubmissionVersion | null,\n): string | null {\n if (!latest) return null;\n\n if (latest.state === 'rejected') {\n return ui.nextAction('ekanos status --findings', 'see what failed');\n }\n if (latest.state === 'gated') {\n return `\\n${ui.dim('→ awaiting admission (runs hourly)')}`;\n }\n if (latest.state === 'submitted') {\n return `\\n${ui.dim('→ awaiting gate result')}`;\n }\n\n return null;\n}\n\nfunction humanSummary(\n ui: Ui,\n cwd: string,\n host: string,\n session: SessionReport,\n project: ProjectReport | null,\n submissions: SubmissionListing[] | null,\n args: { findings: boolean; all: boolean },\n seatRole: string | null,\n now: Date,\n): string {\n const note = !session.authenticated\n ? session.hint\n : !project\n ? 'No ekanos.json here, so there is no project to report on.'\n : !project.source\n ? 'No \"source\" configured yet. The first \"ekanos publish --source <slug>\" saves one.'\n : undefined;\n\n const lines: string[] = [\n ui.result({\n title: session.authenticated ? 'Signed in' : 'Not signed in',\n tone: session.authenticated ? 'ok' : 'warn',\n rows: buildHeaderRows(host, session, project, seatRole),\n notes: note ? [note] : [],\n }),\n ];\n\n if (note || !project?.source || !submissions) {\n return lines.join('\\n');\n }\n\n const projectIntegration =\n submissions.find((s) => s.slug === project.slug) ?? null;\n const others = submissions.filter((s) => s.slug !== project.slug);\n\n lines.push('', ui.section('this project'));\n\n if (\n projectIntegration?.displayName &&\n projectIntegration.displayName !== projectIntegration.slug\n ) {\n lines.push(` ${ui.dim(`published as ${projectIntegration.displayName}`)}`);\n }\n\n const sorted = projectIntegration\n ? sortVersionsNewestFirst(projectIntegration.versions)\n : [];\n\n if (sorted.length === 0) {\n lines.push(` ${ui.dim('no submissions yet for this project.')}`);\n } else {\n lines.push(indentLines(renderVersionsTable(ui, sorted, now), 2));\n\n const findingsBlock = renderThisProjectFindings(\n ui,\n cwd,\n sorted,\n args.findings,\n );\n if (findingsBlock) lines.push('', findingsBlock);\n }\n\n lines.push('', ui.section(`other integrations in source ${project.source}`));\n\n if (others.length === 0) {\n lines.push(` ${ui.dim('none.')}`);\n } else if (args.all) {\n for (const integration of others) {\n const otherSorted = sortVersionsNewestFirst(integration.versions);\n lines.push(` ${ui.dim(integration.displayName ?? integration.slug)}`);\n lines.push(indentLines(renderVersionsTable(ui, otherSorted, now), 4));\n }\n } else {\n for (const integration of others) {\n const summary = summarizeIntegration(integration);\n lines.push(\n ` ${ui.dim(\n `${summary.displayName ?? summary.slug} — ${summary.versionsCount} version${\n summary.versionsCount === 1 ? '' : 's'\n }, latest ${summary.latestVersion ?? '?'} ${\n summary.latestState ?? '?'\n }`,\n )}`,\n );\n }\n }\n\n const action = buildNextAction(ui, sorted[0] ?? null);\n if (action) lines.push(action);\n\n return lines.join('\\n');\n}\n"]}
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAGL,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAA2B,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,8EAA8E;AAC9E,MAAM,mBAAmB,GAAG,IAAK,CAAC;AAClC,MAAM,iBAAiB,GAAG,KAAM,CAAC;AAEjC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC,+EAA+E;AAC/E,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,IAAI,CAAC,GAAG,CAAC,mBAAm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,EAAE,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,WAAW,IAAI,MAAM,EAAE,CAAC;YACjC,MAAM,OAAO,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;YAClD,KAAK,CAAC,IAAI,CACR,KAAK,EAAE,CAAC,GAAG,CACT,GAAG,MAAA,OAAO,CAAC,WAAW,mCAAI,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,aAAa,WAC/D,OAAO,CAAC,aAAa,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACrC,YAAY,MAAA,OAAO,CAAC,aAAa,mCAAI,GAAG,IACtC,MAAA,OAAO,CAAC,WAAW,mCAAI,GACzB,EAAE,CACH,EAAE,CACJ,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,QAAE,MAAM,CAAC,CAAC,CAAC,mCAAI,IAAI,CAAC,CAAC;IACtD,IAAI,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE/B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import { isRepoRoot } from '@ekanos/integration-schema/repo';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { StoredSession } from '../auth/credential-store';\nimport { loginHint } from '../auth/host-trust';\nimport {\n refreshStoredSession,\n resolveAuthEnvironment,\n resolveIdentity,\n} from '../auth/session';\nimport type { CliContext } from '../context';\nimport {\n CliError,\n authRequiredError,\n gateFailedError,\n preconditionError,\n timeoutError,\n usageError,\n} from '../errors';\nimport { ERROR_CODES, type ExitCode } from '../exit-codes';\nimport { formatFindings, relativeTime } from '../findings-renderer';\nimport { EKANOS_CONFIG_FILENAME, loadProject } from '../project';\nimport {\n type SubmissionListing,\n type SubmissionVersion,\n listSubmissions,\n} from '../publish-api';\nimport { fetchSeatsWithOneRefresh } from '../seats';\nimport { type ResultRow, type Ui, shortHost } from '../ui';\nimport { announceUpdate, checkForUpdate } from '../update-notice';\nimport { readProjectVersion } from './publish';\n\n/** The first wait between polls; each one after it doubles, up to the cap. */\nconst WATCH_POLL_START_MS = 5_000;\nconst WATCH_POLL_CAP_MS = 30_000;\n\n/** How long `--wait` waits for a verdict when `--timeout` is not given. */\nexport const DEFAULT_WAIT_MINUTES = 30;\n\n/** The wait before poll number `attempt` (0-based): 5s, 10s, 20s, then 30s. */\nexport function pollDelayMs(attempt: number): number {\n return Math.min(WATCH_POLL_START_MS * 2 ** attempt, WATCH_POLL_CAP_MS);\n}\n\n/** `--timeout <minutes>`: a positive number, or the default. */\nexport function parseTimeoutMinutes(raw: string | undefined): number {\n if (raw === undefined) return DEFAULT_WAIT_MINUTES;\n const minutes = Number(raw);\n if (!Number.isFinite(minutes) || minutes <= 0) {\n throw usageError(\n `--timeout \"${raw}\" is not a number of minutes.`,\n 'Pass a positive number of minutes, e.g. \"--wait --timeout 45\".',\n );\n }\n\n return minutes;\n}\n\n/**\n * The states `--watch` stops on. `submitted` is the only non-terminal state\n * a version can be in when watching starts (an already-`gated`/`dev`/\n * `rejected` version resolves on the very first check, no polling needed).\n */\nconst WATCH_TERMINAL_STATES = new Set(['gated', 'dev', 'rejected']);\n\nexport interface StatusArgs {\n host?: string;\n /** Project directory (may contain ekanos.json). Defaults to cwd. */\n dir: string;\n env: Record<string, string | undefined>;\n /** Render each version's full finding list, not just error/warn counts. */\n findings?: boolean;\n /**\n * Expand \"OTHER INTEGRATIONS IN SOURCE …\" from one summary line per\n * integration into the same VERSION/STATE/AGE/FINDINGS table shape THIS\n * PROJECT's section uses. Human mode only — the JSON envelope's\n * `submissions` already carries every integration's full version history\n * regardless of this flag.\n */\n all?: boolean;\n /**\n * Block until this project's current (slug, version) submission reaches a\n * terminal-for-waiting state (gated, dev, rejected), polling every 30s.\n * Changes the command's exit-code contract — see `runStatus`'s docstring.\n */\n watch?: boolean;\n /** `--timeout <minutes>` for `--watch`/`--wait`: how long to wait (default 30). */\n timeoutMinutes?: number;\n /** Injectable for tests — see `auth/device-flow.ts`'s identical pattern. */\n sleep?: (ms: number) => Promise<void>;\n /** Injectable \"now\" for deterministic AGE rendering in tests. Defaults to `new Date()`. */\n now?: Date;\n}\n\ninterface SessionReport {\n authenticated: boolean;\n user?: { id: string; email: string | null; name: string | null };\n expiresAt?: string;\n hint?: string;\n}\n\ninterface ProjectReport {\n dir: string;\n slug: string;\n source: string | null;\n}\n\n/**\n * `status` — the read verb: where am I pointed, who am I, and what has this\n * project submitted?\n *\n * Three sections, each degrading gracefully rather than failing:\n *\n * - **session** — whoami's server-side identity check, but an absent or dead\n * session reports `authenticated: false` with a hint instead of exit 4. A\n * partner asking \"what is my state?\" must get an answer, not an error whose\n * answer it is.\n * - **project** — the ekanos.json in `--dir` (default cwd), when there is\n * one. No project is an ordinary state for `status`, never an error.\n * - **submissions** — `GET /api/partner/submissions?source=…` for the\n * project's resolved source, only when both a session and a source exist.\n * Server errors here DO map through the taxonomy: an unreachable host or a\n * missing source is a fault to surface, not a state to absorb.\n *\n * Exit 0 whenever the report itself could be assembled — EXCEPT under\n * `--watch` (see below), whose exit code carries the gate's verdict instead.\n *\n * The submission listing always requests the full `?detail=findings` shape\n * server-side (needed so THIS PROJECT's latest-error auto-inline rendering\n * — see `humanSummary` — has findings to inspect without a second\n * round-trip). `--findings` no longer changes what's FETCHED; it changes\n * what's RENDERED inline in human mode: every shown version's findings,\n * not just the latest's error-severity ones.\n *\n * `--watch` turns `status` into a blocking wait: it requires a project with\n * a resolved source and a live session (both are PRECONDITIONs here, not\n * degraded-to-false states — there is nothing to watch without them), then\n * polls `GET /api/partner/submissions?detail=findings` every 30s for THIS\n * project's current (slug, package.json version) submission until it reaches\n * a terminal-for-waiting state: `gated`/`dev` exit 0, `rejected` exits 10\n * (GATE_FAILED) with the findings carried in `data` — the same shape\n * `publish`'s own gate refusal uses, so an agent's fix-then-retry loop\n * branches on it identically whether the gate ran inline (future) or via\n * this poll (today). `--json --watch` still emits exactly ONE envelope, at\n * completion — the polling itself only ever writes to stderr via `ctx.log`.\n *\n * Human-mode rendering is PROJECT-SCOPED: the server lists every\n * submission for the resolved source (an org-level bucket shared by every\n * project publishing there — `listSubmissions` has no server-side slug\n * filter, see `publish-api.ts`'s wire contract), so \"THIS PROJECT\" groups\n * the rows matching this project's own slug and \"OTHER INTEGRATIONS IN\n * SOURCE …\" collapses everything else to one summary line per integration\n * (or, with `--all`, the same table shape).\n * The `--json` envelope stays additive-compatible: `submissions` is still\n * the full, unfiltered list, with `data.project.scopedSubmissions` and\n * `data.otherIntegrations` layered on top for a consumer that wants the\n * pre-grouped view without re-deriving it.\n */\nexport async function runStatus(\n ctx: CliContext,\n args: StatusArgs,\n): Promise<ExitCode> {\n const env = resolveAuthEnvironment(ctx, args.host, args.env, {\n projectDir: args.dir,\n });\n\n const stored = env.store.read(env.host);\n\n const notice = await checkForUpdate({\n env: args.env,\n host: env.host,\n session: stored ?? undefined,\n });\n announceUpdate(ctx, notice, { env: args.env });\n\n const session = stored\n ? await probeSession(env, stored)\n : {\n authenticated: false,\n hint: loginHint(env, 'to sign in.'),\n };\n\n // probeSession may have refreshed the session — persisting a NEW access\n // token and ROTATING the refresh token on disk. Re-read before using it:\n // the pre-probe object now holds a dead access token and an already-spent\n // refresh token, and presenting those would turn \"logged in, token was\n // merely stale\" into a hard exit-4 — the one failure this command promises\n // never to produce.\n const live = stored ? (env.store.read(env.host) ?? stored) : null;\n\n const project = readProjectReport(args.dir);\n\n if (args.watch) {\n if (!session.authenticated || !live) {\n throw authRequiredError(\n `\"ekanos status --watch\" needs a live session on ${env.host}.`,\n loginHint(env),\n );\n }\n\n if (!project) {\n throw preconditionError(\n `No ekanos.json found in ${path.resolve(args.dir)}.`,\n 'Run \"ekanos publish\" at least once before watching its gate result.',\n );\n }\n\n if (!project.source) {\n throw preconditionError(\n 'This project has no \"source\" in ekanos.json yet.',\n 'Run \"ekanos publish\" at least once (it saves the source you ' +\n 'publish to) before watching its gate result.',\n );\n }\n\n return runWatch(ctx, env, project, args);\n }\n\n let submissions: SubmissionListing[] | null = null;\n\n if (project?.source && session.authenticated && live) {\n // Always the full `?detail=findings` shape, `--findings` or not: THIS\n // PROJECT's auto-inline latest-error rendering (see `humanSummary`)\n // needs the findings array to decide whether to render, not just the\n // counts — and `data.project.scopedSubmissions` carries the same\n // richer shape in the JSON envelope regardless of the flag. `--findings`\n // now controls how much of it gets rendered inline, not what's fetched.\n submissions = await listWithOneRefresh(\n env,\n live,\n project.source,\n 'findings',\n );\n } else if (project?.source && !session.authenticated) {\n // Human mode says this in the result block's note; the stderr line is\n // for JSON callers, who never see that block.\n if (ctx.jsonMode) {\n ctx.log(\n `ekanos: not logged in to ${env.host} — skipping the submission list. ` +\n (session.hint ?? ''),\n );\n }\n } else if (project && !project.source) {\n if (ctx.jsonMode)\n ctx.log(\n 'ekanos: this project has no \"source\" in ekanos.json yet — the first ' +\n '\"ekanos publish --source <slug>\" saves one, and status will list ' +\n 'submissions from then on.',\n );\n }\n\n const projectIntegration =\n project && submissions\n ? (submissions.find((s) => s.slug === project.slug) ?? null)\n : null;\n\n const otherIntegrations = submissions\n ? submissions\n .filter((s) => s.slug !== project?.slug)\n .map((s) => summarizeIntegration(s))\n : null;\n\n // Best-effort, human-mode-only add-on for the header's \"publish target\n // (+ seat role)\" line — same degrade-to-null contract as `whoami`'s own\n // seat lookup. Skipped entirely in JSON mode: nothing in the envelope\n // needs it, and it would otherwise be an extra network round-trip every\n // existing `--json` caller pays for no reason.\n const seatRole =\n !ctx.jsonMode && project?.source && session.authenticated && live\n ? await fetchSeatRoleQuietly(env, live, project.source)\n : null;\n\n return ctx.succeed(\n {\n host: env.host,\n ...session,\n credentialsPath: env.store.filePath,\n project: project\n ? {\n ...project,\n scopedSubmissions: submissions\n ? (projectIntegration?.versions ?? [])\n : null,\n }\n : null,\n submissions,\n ...(otherIntegrations !== null ? { otherIntegrations } : {}),\n ...(notice ? { toolchain: notice } : {}),\n },\n humanSummary(\n ctx.ui,\n project?.dir ?? path.resolve(args.dir),\n env.host,\n session,\n project,\n submissions,\n { findings: args.findings ?? false, all: args.all ?? false },\n seatRole,\n args.now ?? new Date(),\n ),\n );\n}\n\n/**\n * The `--watch` poll loop. Targets THIS project's current submission —\n * `project.slug` + the version presently in `package.json` (the same value\n * `publish` would submit right now) — not \"whatever's most recent,\" so\n * watching after a publish can never resolve against a stale prior version.\n */\nasync function runWatch(\n ctx: CliContext,\n env: ReturnType<typeof resolveAuthEnvironment>,\n project: ProjectReport,\n args: StatusArgs,\n): Promise<ExitCode> {\n const source = project.source;\n if (!source) {\n // Unreachable — the caller already checked — but keeps this function's\n // own type honest without a non-null assertion.\n throw preconditionError(\n 'This project has no \"source\" in ekanos.json yet.',\n 'Run \"ekanos publish\" at least once before watching its gate result.',\n );\n }\n\n const targetVersion = readProjectVersion(project.dir);\n\n // Glyph-only restyle — the poll contract itself (exit codes, timing,\n // JSON envelope) is unchanged.\n const waitGlyph = ctx.jsonMode ? '' : `${ctx.ui.dim(ctx.ui.glyphs.info)} `;\n const prefix = ctx.jsonMode ? 'ekanos: ' : '';\n\n ctx.log(\n `${waitGlyph}${prefix}watching ${project.slug}@${targetVersion} on ${env.host} ` +\n `(polling, up to ${args.timeoutMinutes ?? DEFAULT_WAIT_MINUTES} min)…`,\n );\n\n const waited = await waitForGate(ctx, env, {\n slug: project.slug,\n source,\n version: targetVersion,\n timeoutMinutes: args.timeoutMinutes ?? DEFAULT_WAIT_MINUTES,\n sleep: args.sleep ?? defaultSleep,\n });\n\n return waited.timedOut\n ? failWatchTimeout(ctx, project.slug, targetVersion, waited)\n : reportWatchOutcome(ctx, project.slug, waited.version);\n}\n\nexport type GateWait =\n | { timedOut: false; version: SubmissionVersion }\n | {\n timedOut: true;\n lastState: string | null;\n waitedMinutes: number;\n };\n\n/**\n * Poll the submission list until `slug@version` reaches a verdict (see\n * `WATCH_TERMINAL_STATES`) or `timeoutMinutes` of waiting has passed. Waits\n * back off from 5s to a 30s cap. The elapsed time is the sum of the waits, so\n * a test with an instant `sleep` still reaches the timeout.\n */\nexport async function waitForGate(\n ctx: CliContext,\n env: ReturnType<typeof resolveAuthEnvironment>,\n target: {\n slug: string;\n source: string;\n version: string;\n timeoutMinutes: number;\n sleep: (ms: number) => Promise<void>;\n },\n): Promise<GateWait> {\n const waitGlyph = ctx.jsonMode ? '' : `${ctx.ui.dim(ctx.ui.glyphs.info)} `;\n const prefix = ctx.jsonMode ? 'ekanos: ' : '';\n const budgetMs = target.timeoutMinutes * 60_000;\n let waitedMs = 0;\n\n for (let attempt = 0; ; attempt += 1) {\n // Re-read the session from the credential store on EVERY iteration —\n // never carry one over in a closure. Auth0 rotates the refresh token on\n // every use (see `refreshStoredSession`'s docstring), so a token this\n // loop already consumed is dead by the next iteration; the store is the\n // persisted source of truth for whichever refresh most recently landed\n // — this loop's own (via `listWithOneRefresh` below, which persists\n // through `refreshStoredSession`), or a concurrent one from another\n // process (another terminal running login/publish/status --watch\n // against the same host). Threading the refreshed session back out of\n // `listWithOneRefresh` instead would only cover the first case.\n const current = env.store.read(env.host);\n\n if (!current) {\n throw authRequiredError(\n `The session for ${env.host} is gone — waiting for the gate ` +\n 'cannot continue without it.',\n loginHint(env),\n );\n }\n\n const integrations = await listWithOneRefresh(\n env,\n current,\n target.source,\n 'findings',\n );\n const version = findVersion(integrations, target.slug, target.version);\n\n if (version && WATCH_TERMINAL_STATES.has(version.state)) {\n return { timedOut: false, version };\n }\n\n const delay = pollDelayMs(attempt);\n if (waitedMs + delay > budgetMs) {\n return {\n timedOut: true,\n lastState: version?.state ?? null,\n waitedMinutes: Math.round(waitedMs / 6_000) / 10,\n };\n }\n\n ctx.log(\n `${waitGlyph}${prefix}${target.slug}@${target.version} is ` +\n `${version ? version.state : 'not visible yet'} — waiting…`,\n );\n\n await target.sleep(delay);\n waitedMs += delay;\n }\n}\n\n/** The exit-11 outcome: the gate has not answered, but it may still. */\nexport function failWatchTimeout(\n ctx: CliContext,\n slug: string,\n version: string,\n waited: Extract<GateWait, { timedOut: true }>,\n): ExitCode {\n return ctx.fail(\n timeoutError(\n `${slug}@${version} had no gate verdict after ${waited.waitedMinutes} minutes` +\n `${waited.lastState ? ` (still \"${waited.lastState}\")` : ''}.`,\n 'The gate may still be running. Run \"ekanos status --watch\" to keep waiting, or raise --timeout.',\n ),\n { slug, version, state: waited.lastState, timedOut: true },\n );\n}\n\nfunction findVersion(\n integrations: SubmissionListing[],\n slug: string,\n version: string,\n): SubmissionVersion | null {\n const integration = integrations.find((i) => i.slug === slug);\n return integration?.versions.find((v) => v.version === version) ?? null;\n}\n\nexport function watchOutcomeData(slug: string, version: SubmissionVersion) {\n return {\n slug,\n version: version.version,\n state: version.state,\n gatedAt: version.gatedAt,\n errorCount: version.errorCount,\n warnCount: version.warnCount,\n findings: version.findings ?? [],\n stages: version.stages ?? [],\n };\n}\n\nfunction reportWatchOutcome(\n ctx: CliContext,\n slug: string,\n version: SubmissionVersion,\n): ExitCode {\n const data = watchOutcomeData(slug, version);\n\n if (version.state === 'rejected') {\n return ctx.fail(\n gateFailedError(\n `${slug}@${version.version} was rejected by the gate ` +\n `(${data.errorCount ?? 0} error${data.errorCount === 1 ? '' : 's'}).`,\n 'Resolve the error-severity findings in data.findings, bump the ' +\n 'version, and re-run \"ekanos publish\".',\n ),\n data,\n );\n }\n\n return ctx.succeed(\n data,\n ctx.ui.result({\n title: `${slug}@${version.version} is ${version.state}`,\n tone: data.warnCount ? 'warn' : 'ok',\n rows: [\n ['State', version.state],\n ...(data.warnCount\n ? [['Warnings', String(data.warnCount)] as const]\n : []),\n ],\n }),\n );\n}\n\nfunction defaultSleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\n/**\n * whoami's identity resolution, with AUTH_REQUIRED absorbed into\n * `authenticated: false`. Anything else — network, precondition, MFA mapped\n * to auth by `fetchIdentity` — still propagates: \"the host was unreachable\"\n * must never be reported as \"you are logged out\".\n */\nasync function probeSession(\n env: ReturnType<typeof resolveAuthEnvironment>,\n stored: StoredSession,\n): Promise<SessionReport> {\n try {\n const { identity, session } = await resolveIdentity(env, stored);\n\n return {\n authenticated: true,\n user: { id: identity.id, email: identity.email, name: identity.name },\n expiresAt: session.expiresAt,\n };\n } catch (error) {\n if (error instanceof CliError && error.code === ERROR_CODES.AUTH_REQUIRED) {\n return { authenticated: false, hint: error.hint };\n }\n\n throw error;\n }\n}\n\n/**\n * Lenient project read: no ekanos.json means \"not in a project\", which is an\n * answer, not an error. An ekanos.json that EXISTS but does not load keeps\n * `loadProject`'s strict behaviour — a broken project file is a fault the\n * partner needs named, whatever verb they ran.\n */\nfunction readProjectReport(dir: string): ProjectReport | null {\n const projectDir = path.resolve(dir);\n\n // A repo root is not one project: status reports no project there, as it\n // does outside any.\n if (\n !fs.existsSync(path.join(projectDir, EKANOS_CONFIG_FILENAME)) ||\n isRepoRoot(projectDir)\n ) {\n return null;\n }\n\n const loaded = loadProject(projectDir);\n\n return {\n dir: loaded.projectDir,\n slug: loaded.primary.slug,\n source: loaded.project.source ?? null,\n };\n}\n\n/** Mirrors publish's one-refresh-one-retry on a stale access token. */\nasync function listWithOneRefresh(\n env: ReturnType<typeof resolveAuthEnvironment>,\n session: StoredSession,\n source: string,\n detail?: 'findings',\n): Promise<SubmissionListing[]> {\n const first = await listSubmissions(env.host, session.accessToken, source, {\n detail,\n });\n\n if (first.status === 'ok') return first.integrations;\n\n const refreshed = await refreshStoredSession(env, session);\n const second = await listSubmissions(\n env.host,\n refreshed.accessToken,\n source,\n {\n detail,\n },\n );\n\n if (second.status === 'ok') return second.integrations;\n\n // Authenticated a moment ago, unauthorized twice here: report the list as\n // unavailable rather than the session as dead — probeSession already proved\n // it. This is unreachable in practice; belt and braces for a racing revoke.\n throw authRequiredError(\n `The session for ${env.host} could not authorize the submission list.`,\n loginHint(env),\n );\n}\n\n/**\n * `whoami`'s seat-lookup degradation, narrowed to one source's role: a\n * network hiccup, MFA, or a deployment predating the seats route must never\n * turn a working `status` into a failing one — the header simply omits the\n * \"(role)\" suffix.\n */\nasync function fetchSeatRoleQuietly(\n env: ReturnType<typeof resolveAuthEnvironment>,\n session: StoredSession,\n source: string,\n): Promise<string | null> {\n try {\n const result = await fetchSeatsWithOneRefresh(env, session);\n if (result.status !== 'ok') return null;\n\n const seat = result.sources.find((s) => s.slug === source);\n return seat ? seat.roles.join(', ') : null;\n } catch {\n return null;\n }\n}\n\nfunction tryReadProjectVersion(dir: string): string | null {\n try {\n return readProjectVersion(dir);\n } catch {\n return null;\n }\n}\n\nfunction timestampMs(iso: string | null | undefined): number {\n if (!iso) return 0;\n const parsed = new Date(iso).getTime();\n return Number.isNaN(parsed) ? 0 : parsed;\n}\n\n/**\n * Newest-first by `gatedAt ?? submittedAt`. Ties (including two versions\n * with no timestamp at all) keep their original, server-given order —\n * `Array#sort` is stable, and a stable no-op is the right answer when there\n * is nothing to compare.\n */\nexport function sortVersionsNewestFirst(\n versions: readonly SubmissionVersion[],\n): SubmissionVersion[] {\n return [...versions].sort(\n (a, b) =>\n timestampMs(b.gatedAt ?? b.submittedAt) -\n timestampMs(a.gatedAt ?? a.submittedAt),\n );\n}\n\nfunction versionAge(version: SubmissionVersion, now: Date): string {\n const timestamp = version.gatedAt ?? version.submittedAt;\n return timestamp ? relativeTime(timestamp, now) : '—';\n}\n\nexport function findingsCellParts(\n ui: Ui,\n version: SubmissionVersion,\n): { text: string; paint: (text: string) => string } {\n if (version.errorCount === null && version.warnCount === null) {\n return { text: '—', paint: ui.dim };\n }\n\n const errorCount = version.errorCount ?? 0;\n const warnCount = version.warnCount ?? 0;\n\n if (errorCount === 0 && warnCount === 0) {\n return { text: '0', paint: (text) => text };\n }\n\n const parts: string[] = [];\n if (errorCount > 0) parts.push(`${errorCount}E`);\n if (warnCount > 0) parts.push(`${warnCount}W`);\n\n return { text: parts.join(' '), paint: errorCount > 0 ? ui.err : ui.warn };\n}\n\nexport function stateColorFor(ui: Ui, state: string): (text: string) => string {\n if (state === 'dev' || state === 'prod') return ui.ok;\n if (state === 'gated') return ui.accent;\n if (state === 'submitted' || state === 'superseded') return ui.dim;\n if (state === 'rejected' || state === 'revoked') return ui.err;\n return (text) => text;\n}\n\n/**\n * A VERSION/STATE/AGE/FINDINGS table, built by hand rather than via\n * `ui.table`: STATE and FINDINGS need per-cell color, and `ui.table` sizes\n * columns from the raw cell strings it's handed — a colored cell's ANSI\n * escapes would inflate that width and misalign the column. `ui.ts`'s own\n * doc comment on `padCell` names this exact tradeoff (\"ignoring color codes\n * in length math is the CALLER's job — pad before coloring, never after\"),\n * so this pads against the PLAIN text first and colors the already-padded\n * string — the same rule `ui.table` documents, just applied here instead of\n * inside it.\n */\nexport function renderVersionsTable(\n ui: Ui,\n versions: readonly SubmissionVersion[],\n now: Date,\n): string {\n const headers = ['VERSION', 'STATE', 'AGE', 'FINDINGS'] as const;\n\n const rows = versions.map((version) => {\n const findings = findingsCellParts(ui, version);\n return {\n version: version.version,\n state: version.state,\n age: versionAge(version, now),\n findingsText: findings.text,\n findingsPaint: findings.paint,\n statePaint: stateColorFor(ui, version.state),\n };\n });\n\n const widths: [number, number, number, number] = [\n Math.max(headers[0].length, ...rows.map((r) => r.version.length)),\n Math.max(headers[1].length, ...rows.map((r) => r.state.length)),\n Math.max(headers[2].length, ...rows.map((r) => r.age.length)),\n Math.max(headers[3].length, ...rows.map((r) => r.findingsText.length)),\n ];\n\n const headerLine = headers\n .map((header, i) => ui.dim(header.padEnd(widths[i]!)))\n .join(' ');\n\n const bodyLines = rows.map((row) =>\n [\n row.version.padEnd(widths[0]),\n row.statePaint(row.state.padEnd(widths[1])),\n row.age.padEnd(widths[2]),\n row.findingsPaint(row.findingsText.padEnd(widths[3])),\n ].join(' '),\n );\n\n return [headerLine, ...bodyLines].join('\\n');\n}\n\n/**\n * The findings shown directly under THIS PROJECT's table. `--findings`\n * forces every version's own findings inline; otherwise only the LATEST\n * version's ERROR-severity findings auto-render (the moment a partner most\n * needs them, no flag required), and a dim pointer at `ekanos status\n * --findings` covers everything else with a nonzero count.\n */\nfunction renderThisProjectFindings(\n ui: Ui,\n cwd: string,\n sorted: readonly SubmissionVersion[],\n forceAll: boolean,\n): string | null {\n if (forceAll) {\n const blocks = sorted\n .filter((v) => v.findings && v.findings.length > 0)\n .map((v) =>\n [\n ` ${ui.dim(`${v.version}:`)}`,\n indentLines(formatFindings(ui, v.findings!, { cwd }), 4),\n ].join('\\n'),\n );\n\n return blocks.length > 0 ? blocks.join('\\n\\n') : null;\n }\n\n const [latest, ...older] = sorted;\n const latestErrors = (latest?.findings ?? []).filter(\n (f) => f.severity === 'error',\n );\n\n if (latest && latestErrors.length > 0 && latest.findings) {\n return indentLines(formatFindings(ui, latest.findings, { cwd }), 2);\n }\n\n const latestNonzero =\n (latest?.errorCount ?? 0) > 0 || (latest?.warnCount ?? 0) > 0;\n const olderNonzero = older.some(\n (v) => (v.errorCount ?? 0) > 0 || (v.warnCount ?? 0) > 0,\n );\n\n return latestNonzero || olderNonzero\n ? ` ${ui.dim('→ details: ekanos status --findings')}`\n : null;\n}\n\nexport interface OtherIntegrationSummary {\n slug: string;\n /** The full name (`acme/google-drive`); absent on an older host. */\n displayName?: string;\n name: string | null;\n versionsCount: number;\n latestVersion: string | null;\n latestState: string | null;\n}\n\nexport function summarizeIntegration(\n integration: SubmissionListing,\n): OtherIntegrationSummary {\n const latest = sortVersionsNewestFirst(integration.versions)[0] ?? null;\n return {\n slug: integration.slug,\n ...(integration.displayName\n ? { displayName: integration.displayName }\n : {}),\n name: integration.name,\n versionsCount: integration.versions.length,\n latestVersion: latest?.version ?? null,\n latestState: latest?.state ?? null,\n };\n}\n\nfunction indentLines(block: string, spaces: number): string {\n const prefix = ' '.repeat(spaces);\n return block\n .split('\\n')\n .map((line) => `${prefix}${line}`)\n .join('\\n');\n}\n\nfunction buildHeaderRows(\n host: string,\n session: SessionReport,\n project: ProjectReport | null,\n seatRole: string | null,\n): readonly ResultRow[] {\n const rows: ResultRow[] = [];\n\n if (session.authenticated) {\n rows.push([\n 'Account',\n session.user?.email ?? session.user?.id ?? 'unknown',\n ]);\n }\n rows.push(['Host', shortHost(host)]);\n\n if (project) {\n const version = tryReadProjectVersion(project.dir);\n rows.push([\n 'Project',\n version ? `${project.slug}@${version}` : project.slug,\n ]);\n rows.push([\n 'Target',\n project.source\n ? `${project.source}${seatRole ? ` · ${seatRole}` : ''}`\n : 'none yet',\n ]);\n }\n\n return rows;\n}\n\n/**\n * The closing `ui.nextAction` line, chosen from the LATEST version of THIS\n * project — `null` (no closing line at all) whenever nothing is pending:\n * no submission yet, or the latest is already `dev`/`prod`/`revoked`.\n */\nexport function buildNextAction(\n ui: Ui,\n latest: SubmissionVersion | null,\n): string | null {\n if (!latest) return null;\n\n if (latest.state === 'rejected') {\n return ui.nextAction('ekanos status --findings', 'see what failed');\n }\n if (latest.state === 'gated') {\n return `\\n${ui.dim('→ awaiting admission (runs hourly)')}`;\n }\n if (latest.state === 'submitted') {\n return `\\n${ui.dim('→ awaiting gate result')}`;\n }\n\n return null;\n}\n\nfunction humanSummary(\n ui: Ui,\n cwd: string,\n host: string,\n session: SessionReport,\n project: ProjectReport | null,\n submissions: SubmissionListing[] | null,\n args: { findings: boolean; all: boolean },\n seatRole: string | null,\n now: Date,\n): string {\n const note = !session.authenticated\n ? session.hint\n : !project\n ? 'No ekanos.json here, so there is no project to report on.'\n : !project.source\n ? 'No \"source\" configured yet. The first \"ekanos publish --source <slug>\" saves one.'\n : undefined;\n\n const lines: string[] = [\n ui.result({\n title: session.authenticated ? 'Signed in' : 'Not signed in',\n tone: session.authenticated ? 'ok' : 'warn',\n rows: buildHeaderRows(host, session, project, seatRole),\n notes: note ? [note] : [],\n }),\n ];\n\n if (note || !project?.source || !submissions) {\n return lines.join('\\n');\n }\n\n const projectIntegration =\n submissions.find((s) => s.slug === project.slug) ?? null;\n const others = submissions.filter((s) => s.slug !== project.slug);\n\n lines.push('', ui.section('this project'));\n\n if (\n projectIntegration?.displayName &&\n projectIntegration.displayName !== projectIntegration.slug\n ) {\n lines.push(` ${ui.dim(`published as ${projectIntegration.displayName}`)}`);\n }\n\n const sorted = projectIntegration\n ? sortVersionsNewestFirst(projectIntegration.versions)\n : [];\n\n if (sorted.length === 0) {\n lines.push(` ${ui.dim('no submissions yet for this project.')}`);\n } else {\n lines.push(indentLines(renderVersionsTable(ui, sorted, now), 2));\n\n const findingsBlock = renderThisProjectFindings(\n ui,\n cwd,\n sorted,\n args.findings,\n );\n if (findingsBlock) lines.push('', findingsBlock);\n }\n\n lines.push('', ui.section(`other integrations in source ${project.source}`));\n\n if (others.length === 0) {\n lines.push(` ${ui.dim('none.')}`);\n } else if (args.all) {\n for (const integration of others) {\n const otherSorted = sortVersionsNewestFirst(integration.versions);\n lines.push(` ${ui.dim(integration.displayName ?? integration.slug)}`);\n lines.push(indentLines(renderVersionsTable(ui, otherSorted, now), 4));\n }\n } else {\n for (const integration of others) {\n const summary = summarizeIntegration(integration);\n lines.push(\n ` ${ui.dim(\n `${summary.displayName ?? summary.slug} — ${summary.versionsCount} version${\n summary.versionsCount === 1 ? '' : 's'\n }, latest ${summary.latestVersion ?? '?'} ${\n summary.latestState ?? '?'\n }`,\n )}`,\n );\n }\n }\n\n const action = buildNextAction(ui, sorted[0] ?? null);\n if (action) lines.push(action);\n\n return lines.join('\\n');\n}\n"]}
@@ -24,11 +24,11 @@ import { collectAllFindings } from '../validate-findings.js';
24
24
  * every finding below it unreliable.
25
25
  */
26
26
  export async function runValidate(ctx, args) {
27
- var _a;
27
+ var _a, _b;
28
28
  const loaded = loadProject(args.dir);
29
29
  const skew = assertSchemaNotSkewed(ctx, loaded.projectDir);
30
30
  const notice = await checkForUpdate({ env: (_a = args.env) !== null && _a !== void 0 ? _a : process.env });
31
- announceUpdate(ctx, notice);
31
+ announceUpdate(ctx, notice, { env: (_b = args.env) !== null && _b !== void 0 ? _b : process.env });
32
32
  const slugs = loaded.integrations.map((i) => i.slug).join(', ');
33
33
  ctx.log(ctx.ui.dim(`Validating ${loaded.integrations.length} integration` +
34
34
  `${loaded.integrations.length === 1 ? '' : 's'} (${slugs})…`));
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAQ1D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAe,EACf,IAAkB;;IAElB,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAErC,MAAM,IAAI,GAAG,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAE3D,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,EAAE,GAAG,QAAE,IAAI,CAAC,GAAG,mCAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACtE,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;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,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAC/C,OAAO,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACjD,CAAC,CAAC;SACD,MAAM,CACL,CAAC,KAAK,EAAgD,EAAE,CAAC,KAAK,KAAK,IAAI,CACxE,CAAC;IAEJ,MAAM,CAAC,cAAc,CAAC,GAAG,WAAW,CAAC;IACrC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,EAAE,CAAC;QACvE,OAAO,CAAC,IAAI,GAAG,iBAAiB,cAAc,CAAC,UAAU,IAAI,CAAC;IAChE,CAAC;SAAM,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI;YACV,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;IAC9E,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC;IAC9B,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO;IAEtC,MAAM,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC;QACrC,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,GAAG,UAAU,IAAI,WAAW,EAAE,CAAC;IACnC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import type { Finding } from '@ekanos/integration-schema';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { CliContext } from '../context';\nimport {\n acceptedKeysAt,\n extractUnrecognizedKeys,\n suggestKey,\n} from '../did-you-mean';\nimport { validationError } from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport { renderFindings } from '../findings-renderer';\nimport { loadProject } from '../project';\nimport { assertSchemaNotSkewed } from '../schema-skew';\nimport {\n ENCLOSING_NOTE,\n extractPathFromMessage,\n isRootPath,\n locateDotPath,\n} from '../source-locator';\nimport { pluralize } from '../ui';\nimport { announceUpdate, checkForUpdate } from '../update-notice';\nimport { collectAllFindings } from '../validate-findings';\n\nexport interface ValidateArgs {\n /** Project directory (contains ekanos.json). Defaults to cwd. */\n dir: string;\n env?: Record<string, string | undefined>;\n}\n\n/**\n * `validate` — parse the declaration with the REAL zod schemas from\n * `@ekanos/integration-schema` (never a reimplementation), gather structured\n * findings, and add project-level integrity checks (the vitest inline-SDK\n * check). Exit 0 with `findings: []` when clean; exit 3 when any error-severity\n * finding is present, with the findings carried in the envelope's `data`.\n *\n * The findings pass itself lives in `validate-findings.ts`, shared with\n * `publish` so the publish gate cannot drift from what validate checks.\n *\n * Runs the schema-skew gate FIRST, before anything else — see\n * `schema-skew.ts` for why a newer project schema than the CLI bundles makes\n * every finding below it unreliable.\n */\nexport async function runValidate(\n ctx: CliContext,\n args: ValidateArgs,\n): Promise<ExitCode> {\n const loaded = loadProject(args.dir);\n\n const skew = assertSchemaNotSkewed(ctx, loaded.projectDir);\n\n const notice = await checkForUpdate({ env: args.env ?? process.env });\n announceUpdate(ctx, notice);\n\n const slugs = loaded.integrations.map((i) => i.slug).join(', ');\n ctx.log(\n ctx.ui.dim(\n `Validating ${loaded.integrations.length} integration` +\n `${loaded.integrations.length === 1 ? '' : 's'} (${slugs})…`,\n ),\n );\n\n const findings = await collectAllFindings(loaded);\n enrichSchemaFindings(findings, loaded.projectDir);\n\n const errorCount = findings.filter((f) => f.severity === 'error').length;\n const data = {\n slug: loaded.primary.slug,\n integrations: loaded.integrations.map((i) => ({\n slug: i.slug,\n entry: i.entry,\n })),\n findings,\n ...(skew.status === 'project-older'\n ? {\n schemaSkew: {\n status: skew.status,\n cliSchemaVersion: skew.cliSchemaVersion,\n projectSchemaVersion: skew.projectSchemaVersion,\n },\n }\n : {}),\n ...(notice ? { toolchain: notice } : {}),\n };\n\n if (errorCount > 0) {\n // Render the shared findings block to stderr BEFORE the envelope\n // settles, human mode only — JSON mode already carries the exact same\n // findings in `data.findings` and must stay byte-identical. The closing\n // order is findings block -> short summary (via `ctx.fail`'s\n // `findingsSummary` option) -> next action: `log` doesn't care that the\n // context already settled, so it's safe to call after `fail`.\n if (!ctx.jsonMode) {\n renderFindings(ctx, findings, { cwd: loaded.projectDir });\n }\n\n const exitCode = ctx.fail(\n validationError(\n `${errorCount} validation finding${errorCount === 1 ? '' : 's'}.`,\n 'Resolve the error-severity findings in data.findings, then re-run ' +\n '\"ekanos validate\".',\n ),\n data,\n !ctx.jsonMode\n ? { findingsSummary: { command: 'ekanos validate', errorCount } }\n : undefined,\n );\n\n if (!ctx.jsonMode) {\n ctx.log(ctx.ui.nextAction('ekanos validate', 'after fixing, re-check'));\n }\n\n return exitCode;\n }\n\n const successLine = ctx.jsonMode\n ? `validate: OK — no findings for ${slugs}.`\n : ctx.ui.result({\n title: findings.length === 0 ? 'No findings' : 'Valid',\n tone: findings.length === 0 ? 'ok' : 'warn',\n rows: [\n ['Checked', loaded.integrations.map((i) => i.slug)],\n ...(findings.length > 0\n ? [\n [\n 'Findings',\n pluralize(findings.length, 'warning or note'),\n ] as const,\n ]\n : []),\n ],\n notes:\n findings.length > 0\n ? ['None are errors. Run with --json to read them.']\n : [],\n });\n\n return ctx.succeed(data, successLine);\n}\n\n/**\n * Best-effort dot-path → `file:line` + \"did you mean?\" enrichment for\n * `definition.schema` findings — the ones `collectDefinitionFindings` builds\n * directly from a zod issue (see its doc comment in\n * `@ekanos/integration-schema`). Mutates `line` (already part of `Finding`'s\n * shape, just usually absent) and, for an unrecognized key with a close\n * match, `hint`; for a resolved-but-missing key it appends a plain-text (no\n * ANSI — `findings-renderer.ts` styles it at render time) note to `message`.\n * These are additive changes to `data.findings` in `--json` mode too — the\n * envelope's existing fields never change shape or disappear across a minor\n * release, so a partner's own JSON parsing keeps working; only new optional\n * fields are ever added.\n *\n * Every other finding, and every locator miss, passes through unchanged:\n * `source-locator.ts`'s whole design is to never guess, so a miss here is\n * silent, not an error.\n */\nfunction enrichSchemaFindings(findings: Finding[], projectDir: string): void {\n const sourceCache = new Map<string, string | null>();\n\n const readSource = (file: string): string | null => {\n const cached = sourceCache.get(file);\n if (cached !== undefined) return cached;\n\n let text: string | null;\n try {\n text = fs.readFileSync(path.resolve(projectDir, file), 'utf8');\n } catch {\n // Best-effort — an unreadable file (deleted, permissions, a race with\n // a concurrent edit) just means no enrichment, never a validate\n // failure.\n text = null;\n }\n sourceCache.set(file, text);\n return text;\n };\n\n for (const finding of findings) {\n if (finding.check !== 'definition.schema') continue;\n if (finding.line !== undefined || finding.file === undefined) continue;\n\n const parsed = extractPathFromMessage(finding.message);\n if (!parsed) continue;\n\n const source = readSource(finding.file);\n if (source === null) continue;\n\n const unrecognizedKeys = extractUnrecognizedKeys(parsed.rest);\n if (unrecognizedKeys) {\n applyUnrecognizedKeyEnrichment(\n finding,\n source,\n parsed.path,\n unrecognizedKeys,\n );\n continue;\n }\n\n applyLocation(finding, locateDotPath(source, parsed.path));\n }\n}\n\n/** Sets `line`/`message` from a locate result — shared by the plain schema-path case and the unrecognized-key case below. A `'none'` result changes nothing. */\nfunction applyLocation(\n finding: Finding,\n result: ReturnType<typeof locateDotPath>,\n): void {\n if (result.confidence === 'none') return;\n\n finding.line = result.line;\n if (result.confidence === 'enclosing') {\n finding.message = `${finding.message} ${ENCLOSING_NOTE}`;\n }\n}\n\nfunction applyUnrecognizedKeyEnrichment(\n finding: Finding,\n source: string,\n parentPath: string,\n badKeys: string[],\n): void {\n const candidates = acceptedKeysAt(parentPath);\n const suggestions = badKeys\n .map((bad) => {\n const suggestion = suggestKey(bad, candidates);\n return suggestion ? { bad, suggestion } : null;\n })\n .filter(\n (entry): entry is { bad: string; suggestion: string } => entry !== null,\n );\n\n const [onlySuggestion] = suggestions;\n if (suggestions.length === 1 && badKeys.length === 1 && onlySuggestion) {\n finding.hint = `did you mean \"${onlySuggestion.suggestion}\"?`;\n } else if (suggestions.length > 0) {\n finding.hint =\n suggestions.map((s) => `\"${s.bad}\" → \"${s.suggestion}\"`).join(', ') + '?';\n }\n\n const [firstBadKey] = badKeys;\n if (firstBadKey === undefined) return;\n\n const fullPath = isRootPath(parentPath)\n ? firstBadKey\n : `${parentPath}.${firstBadKey}`;\n applyLocation(finding, locateDotPath(source, fullPath));\n}\n"]}
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAQ1D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAe,EACf,IAAkB;;IAElB,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAErC,MAAM,IAAI,GAAG,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAE3D,MAAM,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CAAC,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import type { Finding } from '@ekanos/integration-schema';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { CliContext } from '../context';\nimport {\n acceptedKeysAt,\n extractUnrecognizedKeys,\n suggestKey,\n} from '../did-you-mean';\nimport { validationError } from '../errors';\nimport type { ExitCode } from '../exit-codes';\nimport { renderFindings } from '../findings-renderer';\nimport { loadProject } from '../project';\nimport { assertSchemaNotSkewed } from '../schema-skew';\nimport {\n ENCLOSING_NOTE,\n extractPathFromMessage,\n isRootPath,\n locateDotPath,\n} from '../source-locator';\nimport { pluralize } from '../ui';\nimport { announceUpdate, checkForUpdate } from '../update-notice';\nimport { collectAllFindings } from '../validate-findings';\n\nexport interface ValidateArgs {\n /** Project directory (contains ekanos.json). Defaults to cwd. */\n dir: string;\n env?: Record<string, string | undefined>;\n}\n\n/**\n * `validate` — parse the declaration with the REAL zod schemas from\n * `@ekanos/integration-schema` (never a reimplementation), gather structured\n * findings, and add project-level integrity checks (the vitest inline-SDK\n * check). Exit 0 with `findings: []` when clean; exit 3 when any error-severity\n * finding is present, with the findings carried in the envelope's `data`.\n *\n * The findings pass itself lives in `validate-findings.ts`, shared with\n * `publish` so the publish gate cannot drift from what validate checks.\n *\n * Runs the schema-skew gate FIRST, before anything else — see\n * `schema-skew.ts` for why a newer project schema than the CLI bundles makes\n * every finding below it unreliable.\n */\nexport async function runValidate(\n ctx: CliContext,\n args: ValidateArgs,\n): Promise<ExitCode> {\n const loaded = loadProject(args.dir);\n\n const skew = assertSchemaNotSkewed(ctx, loaded.projectDir);\n\n const notice = await checkForUpdate({ env: args.env ?? process.env });\n announceUpdate(ctx, notice, { env: args.env ?? process.env });\n\n const slugs = loaded.integrations.map((i) => i.slug).join(', ');\n ctx.log(\n ctx.ui.dim(\n `Validating ${loaded.integrations.length} integration` +\n `${loaded.integrations.length === 1 ? '' : 's'} (${slugs})…`,\n ),\n );\n\n const findings = await collectAllFindings(loaded);\n enrichSchemaFindings(findings, loaded.projectDir);\n\n const errorCount = findings.filter((f) => f.severity === 'error').length;\n const data = {\n slug: loaded.primary.slug,\n integrations: loaded.integrations.map((i) => ({\n slug: i.slug,\n entry: i.entry,\n })),\n findings,\n ...(skew.status === 'project-older'\n ? {\n schemaSkew: {\n status: skew.status,\n cliSchemaVersion: skew.cliSchemaVersion,\n projectSchemaVersion: skew.projectSchemaVersion,\n },\n }\n : {}),\n ...(notice ? { toolchain: notice } : {}),\n };\n\n if (errorCount > 0) {\n // Render the shared findings block to stderr BEFORE the envelope\n // settles, human mode only — JSON mode already carries the exact same\n // findings in `data.findings` and must stay byte-identical. The closing\n // order is findings block -> short summary (via `ctx.fail`'s\n // `findingsSummary` option) -> next action: `log` doesn't care that the\n // context already settled, so it's safe to call after `fail`.\n if (!ctx.jsonMode) {\n renderFindings(ctx, findings, { cwd: loaded.projectDir });\n }\n\n const exitCode = ctx.fail(\n validationError(\n `${errorCount} validation finding${errorCount === 1 ? '' : 's'}.`,\n 'Resolve the error-severity findings in data.findings, then re-run ' +\n '\"ekanos validate\".',\n ),\n data,\n !ctx.jsonMode\n ? { findingsSummary: { command: 'ekanos validate', errorCount } }\n : undefined,\n );\n\n if (!ctx.jsonMode) {\n ctx.log(ctx.ui.nextAction('ekanos validate', 'after fixing, re-check'));\n }\n\n return exitCode;\n }\n\n const successLine = ctx.jsonMode\n ? `validate: OK — no findings for ${slugs}.`\n : ctx.ui.result({\n title: findings.length === 0 ? 'No findings' : 'Valid',\n tone: findings.length === 0 ? 'ok' : 'warn',\n rows: [\n ['Checked', loaded.integrations.map((i) => i.slug)],\n ...(findings.length > 0\n ? [\n [\n 'Findings',\n pluralize(findings.length, 'warning or note'),\n ] as const,\n ]\n : []),\n ],\n notes:\n findings.length > 0\n ? ['None are errors. Run with --json to read them.']\n : [],\n });\n\n return ctx.succeed(data, successLine);\n}\n\n/**\n * Best-effort dot-path → `file:line` + \"did you mean?\" enrichment for\n * `definition.schema` findings — the ones `collectDefinitionFindings` builds\n * directly from a zod issue (see its doc comment in\n * `@ekanos/integration-schema`). Mutates `line` (already part of `Finding`'s\n * shape, just usually absent) and, for an unrecognized key with a close\n * match, `hint`; for a resolved-but-missing key it appends a plain-text (no\n * ANSI — `findings-renderer.ts` styles it at render time) note to `message`.\n * These are additive changes to `data.findings` in `--json` mode too — the\n * envelope's existing fields never change shape or disappear across a minor\n * release, so a partner's own JSON parsing keeps working; only new optional\n * fields are ever added.\n *\n * Every other finding, and every locator miss, passes through unchanged:\n * `source-locator.ts`'s whole design is to never guess, so a miss here is\n * silent, not an error.\n */\nfunction enrichSchemaFindings(findings: Finding[], projectDir: string): void {\n const sourceCache = new Map<string, string | null>();\n\n const readSource = (file: string): string | null => {\n const cached = sourceCache.get(file);\n if (cached !== undefined) return cached;\n\n let text: string | null;\n try {\n text = fs.readFileSync(path.resolve(projectDir, file), 'utf8');\n } catch {\n // Best-effort — an unreadable file (deleted, permissions, a race with\n // a concurrent edit) just means no enrichment, never a validate\n // failure.\n text = null;\n }\n sourceCache.set(file, text);\n return text;\n };\n\n for (const finding of findings) {\n if (finding.check !== 'definition.schema') continue;\n if (finding.line !== undefined || finding.file === undefined) continue;\n\n const parsed = extractPathFromMessage(finding.message);\n if (!parsed) continue;\n\n const source = readSource(finding.file);\n if (source === null) continue;\n\n const unrecognizedKeys = extractUnrecognizedKeys(parsed.rest);\n if (unrecognizedKeys) {\n applyUnrecognizedKeyEnrichment(\n finding,\n source,\n parsed.path,\n unrecognizedKeys,\n );\n continue;\n }\n\n applyLocation(finding, locateDotPath(source, parsed.path));\n }\n}\n\n/** Sets `line`/`message` from a locate result — shared by the plain schema-path case and the unrecognized-key case below. A `'none'` result changes nothing. */\nfunction applyLocation(\n finding: Finding,\n result: ReturnType<typeof locateDotPath>,\n): void {\n if (result.confidence === 'none') return;\n\n finding.line = result.line;\n if (result.confidence === 'enclosing') {\n finding.message = `${finding.message} ${ENCLOSING_NOTE}`;\n }\n}\n\nfunction applyUnrecognizedKeyEnrichment(\n finding: Finding,\n source: string,\n parentPath: string,\n badKeys: string[],\n): void {\n const candidates = acceptedKeysAt(parentPath);\n const suggestions = badKeys\n .map((bad) => {\n const suggestion = suggestKey(bad, candidates);\n return suggestion ? { bad, suggestion } : null;\n })\n .filter(\n (entry): entry is { bad: string; suggestion: string } => entry !== null,\n );\n\n const [onlySuggestion] = suggestions;\n if (suggestions.length === 1 && badKeys.length === 1 && onlySuggestion) {\n finding.hint = `did you mean \"${onlySuggestion.suggestion}\"?`;\n } else if (suggestions.length > 0) {\n finding.hint =\n suggestions.map((s) => `\"${s.bad}\" → \"${s.suggestion}\"`).join(', ') + '?';\n }\n\n const [firstBadKey] = badKeys;\n if (firstBadKey === undefined) return;\n\n const fullPath = isRootPath(parentPath)\n ? firstBadKey\n : `${parentPath}.${firstBadKey}`;\n applyLocation(finding, locateDotPath(source, fullPath));\n}\n"]}
package/dist/context.d.ts CHANGED
@@ -73,7 +73,17 @@ export declare class CliContext {
73
73
  private readonly stdout;
74
74
  private readonly stderr;
75
75
  private settled;
76
+ private failed;
76
77
  constructor(input?: ContextInput);
78
+ /**
79
+ * The code and exit code this run failed with, once it has — what a
80
+ * recorded failure (`last-error.ts`) and the report hint name. Null on
81
+ * success or before the run settles.
82
+ */
83
+ get failure(): {
84
+ code: string;
85
+ exitCode: number;
86
+ } | null;
77
87
  /** Whether stderr is a real terminal — decoration (the banner) gates on this. */
78
88
  get stderrIsTTY(): boolean;
79
89
  /**
@@ -92,7 +102,7 @@ export declare class CliContext {
92
102
  * an unknown command so an agent reading stderr is told what to do next
93
103
  * without the line ever touching stdout.
94
104
  */
95
- emitClaudeCodeHint(payload: Record<string, unknown>): void;
105
+ emitClaudeCodeHint(payload: Record<string, unknown>): boolean;
96
106
  /**
97
107
  * Terminal success. Writes the single stdout object (JSON mode) or a concise
98
108
  * human line (human mode). Returns the OK exit code so the caller can end the
package/dist/context.js CHANGED
@@ -26,6 +26,7 @@ export class CliContext {
26
26
  constructor(input = {}) {
27
27
  var _a, _b, _c, _d;
28
28
  this.settled = false;
29
+ this.failed = null;
29
30
  const stdout = (_a = input.stdout) !== null && _a !== void 0 ? _a : defaultStream(process.stdout);
30
31
  const stderr = (_b = input.stderr) !== null && _b !== void 0 ? _b : defaultStream(process.stderr);
31
32
  const env = (_c = input.env) !== null && _c !== void 0 ? _c : process.env;
@@ -43,6 +44,14 @@ export class CliContext {
43
44
  this.explicitJson = input.jsonFlag === true;
44
45
  this.agentDetected = isAgentEnvironment(env);
45
46
  }
47
+ /**
48
+ * The code and exit code this run failed with, once it has — what a
49
+ * recorded failure (`last-error.ts`) and the report hint name. Null on
50
+ * success or before the run settles.
51
+ */
52
+ get failure() {
53
+ return this.failed;
54
+ }
46
55
  /** Whether stderr is a real terminal — decoration (the banner) gates on this. */
47
56
  get stderrIsTTY() {
48
57
  return this.stderr.isTTY === true;
@@ -76,8 +85,9 @@ export class CliContext {
76
85
  // at a terminal, or piping into `less` or `grep` — gets the readable
77
86
  // error or help text, never a line of JSON above it.
78
87
  if (!this.explicitJson && !this.agentDetected)
79
- return;
88
+ return false;
80
89
  this.stderr.write(`claude-code-hint: ${JSON.stringify(payload)}\n`);
90
+ return true;
81
91
  }
82
92
  /**
83
93
  * Terminal success. Writes the single stdout object (JSON mode) or a concise
@@ -136,6 +146,7 @@ export class CliContext {
136
146
  */
137
147
  failWith(params) {
138
148
  this.settle();
149
+ this.failed = { code: params.code, exitCode: params.exitCode };
139
150
  if (!params.hint || params.hint.trim().length === 0) {
140
151
  throw new Error(`failWith for "${params.message}" was given an empty hint. Every CLI ` +
141
152
  'error must carry an imperative remediation.');