@ekanos/cli 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/fusion-api.js +2 -2
- package/dist/auth/fusion-api.js.map +1 -1
- package/dist/banner.d.ts +5 -1
- package/dist/banner.js +7 -2
- package/dist/banner.js.map +1 -1
- package/dist/commands/init.d.ts +13 -1
- package/dist/commands/init.js +70 -13
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts +13 -0
- package/dist/commands/login.js +41 -10
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/publish.js +55 -3
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/status.d.ts +68 -2
- package/dist/commands/status.js +312 -43
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/test.d.ts +27 -5
- package/dist/commands/test.js +85 -9
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/validate.js +115 -3
- package/dist/commands/validate.js.map +1 -1
- package/dist/context.d.ts +37 -1
- package/dist/context.js +27 -1
- package/dist/context.js.map +1 -1
- package/dist/did-you-mean.d.ts +36 -0
- package/dist/did-you-mean.js +192 -0
- package/dist/did-you-mean.js.map +1 -0
- package/dist/findings-renderer.d.ts +59 -0
- package/dist/findings-renderer.js +271 -0
- package/dist/findings-renderer.js.map +1 -0
- package/dist/generated/fa-free-names.js +2 -2
- package/dist/generated/fa-free-names.js.map +1 -1
- package/dist/icon-findings.js +5 -5
- package/dist/icon-findings.js.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- package/dist/pack.js +43 -0
- package/dist/pack.js.map +1 -1
- package/dist/project-checks.d.ts +37 -0
- package/dist/project-checks.js +169 -1
- package/dist/project-checks.js.map +1 -1
- package/dist/publish-api.d.ts +24 -11
- package/dist/publish-api.js +7 -8
- package/dist/publish-api.js.map +1 -1
- package/dist/source-locator.d.ts +67 -0
- package/dist/source-locator.js +284 -0
- package/dist/source-locator.js.map +1 -0
- package/dist/sources-api.d.ts +3 -3
- package/dist/sources-api.js.map +1 -1
- package/dist/test-report.d.ts +32 -0
- package/dist/test-report.js +255 -0
- package/dist/test-report.js.map +1 -0
- package/dist/toolchain-api.d.ts +5 -5
- package/dist/toolchain-api.js.map +1 -1
- package/dist/ui.d.ts +75 -0
- package/dist/ui.js +132 -0
- package/dist/ui.js.map +1 -0
- package/dist/validate-findings.d.ts +22 -0
- package/dist/validate-findings.js +57 -1
- package/dist/validate-findings.js.map +1 -1
- package/dist/wizard.d.ts +80 -0
- package/dist/wizard.js +74 -0
- package/dist/wizard.js.map +1 -0
- package/package.json +5 -2
- package/templates/package.json.tmpl +3 -1
- package/templates/scripts/setup-hooks.mjs.tmpl +45 -0
- package/templates/tsconfig.json.tmpl +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-checks.js","sourceRoot":"","sources":["../src/project-checks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAsB,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEzD,MAAM,mBAAmB,GAAG;IAC1B,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;CAClB,CAAC;AAEF,gFAAgF;AAChF,MAAM,qBAAqB,GAAG;IAC5B,SAAS;IACT,aAAa;IACb,aAAa;IACb,gCAAgC;IAChC,QAAQ;IACR,MAAM;IACN,GAAG;CACJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAkB;IACvD,MAAM,UAAU,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAClD,IAAI,C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AAqD;gBACpE,sCAAsC;SACzC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,MAAc;;IACtC,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;IAC1D,KACE,IAAI,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,EAC3C,KAAK,KAAK,IAAI,EACd,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,EACvC,CAAC;QACD,IAAI,sBAAsB,CAAC,IAAI,CAAC,MAAA,KAAK,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;IAC/D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { Finding } from '@ekanos/integration-schema';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport { type EkanosProject, isDocUrl } from './project';\n\nconst VITEST_CONFIG_NAMES = [\n 'vitest.config.ts',\n 'vitest.config.mts',\n 'vitest.config.cts',\n 'vitest.config.js',\n 'vitest.config.mjs',\n 'vitest.config.cjs',\n 'vite.config.ts',\n 'vite.config.mts',\n 'vite.config.js',\n 'vite.config.mjs',\n];\n\n/** The exact block the hint quotes — the one config that makes the SDK load. */\nconst REQUIRED_INLINE_BLOCK = [\n 'test: {',\n ' server: {',\n ' deps: {',\n \" inline: ['@ekanos/sdk'],\",\n ' },',\n ' },',\n '}',\n].join('\\n');\n\n/**\n * Project-level integrity checks that read files in the project root (next to\n * ekanos.json), NOT the integration definition. These are deliberately kept\n * out of the schema package's definition collectors: the definition is valid or\n * not on its own; whether the partner's TEST runner is configured to load the\n * published SDK is a property of THIS project.\n *\n * The highest-value check: a partner's vitest must inline `@ekanos/sdk`. The\n * published SDK dist imports extensionless `next/link`, so without\n * `test.server.deps.inline: ['@ekanos/sdk']` vitest fails to load the SDK, the\n * test file silently imports nothing, and vitest reports green over zero tests.\n *\n * The check is conditional: if the project declares NO vitest/vite config at\n * all, there is nothing to assert (the `test` verb would surface a missing\n * runner on its own). If a config IS present, it MUST inline the SDK.\n */\nexport function collectProjectFindings(projectDir: string): Finding[] {\n const configFile = VITEST_CONFIG_NAMES.map((name) =>\n path.join(projectDir, name),\n ).find((candidate) => fs.existsSync(candidate));\n\n if (!configFile) return [];\n\n const source = fs.readFileSync(configFile, 'utf8');\n if (vitestInlinesSdk(source)) return [];\n\n return [\n {\n check: 'project.vitest-inline-sdk',\n severity: 'error',\n file: configFile,\n message:\n `${path.basename(configFile)} does not inline @ekanos/sdk. The ` +\n `published SDK dist imports extensionless \"next/link\", so without ` +\n `test.server.deps.inline including \"@ekanos/sdk\", vitest cannot load ` +\n `the SDK — the test file imports nothing and vitest reports green ` +\n `over zero tests.`,\n hint:\n `Add this to your vitest config's defineConfig so the SDK is ` +\n `transformed for the test runner:\\n\\n${REQUIRED_INLINE_BLOCK}`,\n },\n ];\n}\n\n/**\n * Advisory check on the `docs` array: a relative entry that resolves to\n * nothing on disk gets a WARNING — never an error, because a missing doc file\n * must not block a publish (the gate refuses only error-severity findings).\n * URLs are never checked: `validate` does no network, ever, and an agent\n * dereferences them at authoring time instead.\n */\nexport function collectDocsFindings(\n project: EkanosProject,\n projectDir: string,\n): Finding[] {\n const findings: Finding[] = [];\n\n for (const entry of project.docs ?? []) {\n if (isDocUrl(entry)) continue;\n\n const resolved = path.resolve(projectDir, entry);\n if (fs.existsSync(resolved)) continue;\n\n findings.push({\n check: 'docs/missing-file',\n severity: 'warn',\n file: resolved,\n message:\n `ekanos.json lists \"${entry}\" under \"docs\", but no file exists ` +\n `there (resolved to ${resolved}).`,\n hint:\n `Create ${entry}, or fix the path in ekanos.json's \"docs\" array so ` +\n 'it points at real API documentation.',\n });\n }\n\n return findings;\n}\n\n/**\n * True when the config source contains an `inline: [ … ]` array that lists\n * `@ekanos/sdk`. Textual on purpose — evaluating a partner's config module\n * would run arbitrary code; a lint-style scan does not.\n */\nfunction vitestInlinesSdk(source: string): boolean {\n const inlineArrayPattern = /inline\\s*:\\s*\\[([\\s\\S]*?)\\]/g;\n for (\n let match = inlineArrayPattern.exec(source);\n match !== null;\n match = inlineArrayPattern.exec(source)\n ) {\n if (/['\"]@ekanos\\/sdk['\"]/.test(match[1] ?? '')) return true;\n }\n return false;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"project-checks.js","sourceRoot":"","sources":["../src/project-checks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAsB,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;CAClB,CAAC;AAEF,gFAAgF;AAChF,MAAM,qBAAqB,GAAG;IAC5B,SAAS;IACT,aAAa;IACb,aAAa;IACb,gCAAgC;IAChC,QAAQ;IACR,MAAM;IACN,GAAG;CACJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA4B;IAC1D,MAAM,EAAE,IAAI;IACZ,wBAAwB,EAAE,IAAI;CAC/B,CAAC;AAEF;+EAC+E;AAC/E,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AAEvD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAkB;IACvD,MAAM,UAAU,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAClD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAC5B,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,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X,CAAC;QAED,IAAI,IAAI,KAAK,GAAG,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAC1C,CAAC,IAAI,CAAC,CAAC;YACP,OACE,CAAC,GAAG,MAAM,CAAC,MAAM;gBACjB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,EAC7C,CAAC;gBACD,CAAC,EAAE,CAAC;YACN,CAAC;YACD,CAAC,EAAE,CAAC,CAAC,0BAA0B;YAC/B,SAAS;QACX,CAAC;QAED,GAAG,IAAI,IAAI,CAAC;IACd,CAAC;IAED,kDAAkD;IAClD,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,MAAc;;IACtC,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;IAC1D,KACE,IAAI,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,EAC3C,KAAK,KAAK,IAAI,EACd,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,EACvC,CAAC;QACD,IAAI,sBAAsB,CAAC,IAAI,CAAC,MAAA,KAAK,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;IAC/D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { Finding } from '@ekanos/integration-schema';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport { type EkanosProject, isDocUrl } from './project';\n\n/**\n * Every vitest/vite config basename `ekanos init` might have scaffolded (or a\n * partner might have renamed to). Exported so `pack.ts` can pack exactly the\n * same set it checks here — one list, so packing and validating this project\n * property can never disagree on what \"the test config\" even is.\n */\nexport const VITEST_CONFIG_NAMES = [\n 'vitest.config.ts',\n 'vitest.config.mts',\n 'vitest.config.cts',\n 'vitest.config.js',\n 'vitest.config.mjs',\n 'vitest.config.cjs',\n 'vite.config.ts',\n 'vite.config.mts',\n 'vite.config.js',\n 'vite.config.mjs',\n];\n\n/** The exact block the hint quotes — the one config that makes the SDK load. */\nconst REQUIRED_INLINE_BLOCK = [\n 'test: {',\n ' server: {',\n ' deps: {',\n \" inline: ['@ekanos/sdk'],\",\n ' },',\n ' },',\n '}',\n].join('\\n');\n\n/**\n * The host's own compiler-strictness overlay a project's tsconfig should\n * already satisfy — mirrors the exact flags (`HOST_TSC_FLAGS`) the gate's\n * own SECOND `tsc --noEmit` pass checks, read from the host's real tsconfig\n * (source of truth for the values themselves). Hardcoded here for the same\n * reason it is hardcoded there: this package ships to a partner's local\n * machine, so it cannot read a file inside the host's own repo at runtime.\n * Rules-as-data via `/api/partner/toolchain` supersedes this hardcoded copy\n * later — until then, keep both copies in sync by hand.\n */\nexport const HOST_COMPILER_RULES: Record<string, boolean> = {\n strict: true,\n noUncheckedIndexedAccess: true,\n};\n\n/** Matches `tsconfig.json`, `tsconfig.build.json`, etc. — mirrors the pattern\n * `pack.ts` and the gate's `typecheck.ts` use to find a project's tsconfig. */\nconst TSCONFIG_PATTERN = /^tsconfig(\\.[^./]+)?\\.json$/;\n\n/**\n * Project-level integrity checks that read files in the project root (next to\n * ekanos.json), NOT the integration definition. These are deliberately kept\n * out of the schema package's definition collectors: the definition is valid or\n * not on its own; whether the partner's TEST runner is configured to load the\n * published SDK is a property of THIS project.\n *\n * The highest-value check: a partner's vitest must inline `@ekanos/sdk`. The\n * published SDK dist imports extensionless `next/link`, so without\n * `test.server.deps.inline: ['@ekanos/sdk']` vitest fails to load the SDK, the\n * test file silently imports nothing, and vitest reports green over zero tests.\n *\n * The check is conditional: if the project declares NO vitest/vite config at\n * all, there is nothing to assert (the `test` verb would surface a missing\n * runner on its own). If a config IS present, it MUST inline the SDK.\n */\nexport function collectProjectFindings(projectDir: string): Finding[] {\n const configFile = VITEST_CONFIG_NAMES.map((name) =>\n path.join(projectDir, name),\n ).find((candidate) => fs.existsSync(candidate));\n\n if (!configFile) return [];\n\n const source = fs.readFileSync(configFile, 'utf8');\n if (vitestInlinesSdk(source)) return [];\n\n return [\n {\n check: 'project.vitest-inline-sdk',\n severity: 'error',\n file: configFile,\n message:\n `${path.basename(configFile)} does not inline @ekanos/sdk. The ` +\n `published SDK dist imports extensionless \"next/link\", so without ` +\n `test.server.deps.inline including \"@ekanos/sdk\", vitest cannot load ` +\n `the SDK — the test file imports nothing and vitest reports green ` +\n `over zero tests.`,\n hint:\n `Add this to your vitest config's defineConfig so the SDK is ` +\n `transformed for the test runner:\\n\\n${REQUIRED_INLINE_BLOCK}`,\n },\n ];\n}\n\n/**\n * Advisory check on the `docs` array: a relative entry that resolves to\n * nothing on disk gets a WARNING — never an error, because a missing doc file\n * must not block a publish (the gate refuses only error-severity findings).\n * URLs are never checked: `validate` does no network, ever, and an agent\n * dereferences them at authoring time instead.\n */\nexport function collectDocsFindings(\n project: EkanosProject,\n projectDir: string,\n): Finding[] {\n const findings: Finding[] = [];\n\n for (const entry of project.docs ?? []) {\n if (isDocUrl(entry)) continue;\n\n const resolved = path.resolve(projectDir, entry);\n if (fs.existsSync(resolved)) continue;\n\n findings.push({\n check: 'docs/missing-file',\n severity: 'warn',\n file: resolved,\n message:\n `ekanos.json lists \"${entry}\" under \"docs\", but no file exists ` +\n `there (resolved to ${resolved}).`,\n hint:\n `Create ${entry}, or fix the path in ekanos.json's \"docs\" array so ` +\n 'it points at real API documentation.',\n });\n }\n\n return findings;\n}\n\n/**\n * WARN when the project's tsconfig does not already set the host's\n * compiler-strictness overlay (`HOST_COMPILER_RULES`). This exists because a\n * project can pass its own `checks/typecheck` cleanly, publish, and only THEN\n * discover `checks/typecheck-host-rules` (the gate's second, stricter pass)\n * fails on the exact same source — e.g. `noUncheckedIndexedAccess` catching a\n * possibly-`undefined` array/record access `strict` alone allows. WARN, not\n * ERROR: this check reads a partner's local tsconfig, not the gate's own\n * verdict, so it must never block a publish that is actually fine — a\n * project whose tsconfig extends something odd, or omits `compilerOptions`\n * intentionally, still gets to publish and find out from the real gate.\n * `publish` escalates this specific check to ERROR locally (see its\n * severity-escalation list) so a submission that WOULD fail the gate never\n * gets uploaded in the first place.\n *\n * Absent tsconfig is not this check's concern — `checks/typecheck` (and its\n * host-rules sibling) already report that loudly on their own.\n */\nexport function collectHostCompilerRulesFindings(\n projectDir: string,\n): Finding[] {\n const tsconfigPath = findTsconfigPath(projectDir);\n if (!tsconfigPath) return [];\n\n const raw = fs.readFileSync(tsconfigPath, 'utf8');\n const tsconfigName = path.basename(tsconfigPath);\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(stripJsonComments(raw));\n } catch {\n // An unparseable tsconfig is a real defect, but not one THIS check can\n // reason about — `tsc` itself will refuse it far more usefully. info\n // severity: surfaced, but never blocks anything.\n return [\n {\n check: 'project.host-compiler-rules',\n severity: 'info',\n file: tsconfigPath,\n message:\n `${tsconfigName} could not be parsed as JSON (even tolerating ` +\n `comments and trailing commas), so this check could not verify it ` +\n `sets the host's compiler rules ` +\n `(${Object.keys(HOST_COMPILER_RULES).join(', ')}).`,\n hint: `Fix ${tsconfigName}'s syntax, then re-run validate.`,\n },\n ];\n }\n\n const compilerOptions =\n typeof parsed === 'object' &&\n parsed !== null &&\n typeof (parsed as { compilerOptions?: unknown }).compilerOptions ===\n 'object' &&\n (parsed as { compilerOptions?: unknown }).compilerOptions !== null\n ? ((parsed as { compilerOptions: Record<string, unknown> })\n .compilerOptions ?? {})\n : {};\n\n const missing = Object.entries(HOST_COMPILER_RULES)\n .filter(([name, required]) => compilerOptions[name] !== required)\n .map(([name]) => name);\n\n if (missing.length === 0) return [];\n\n return [\n {\n check: 'project.host-compiler-rules',\n severity: 'warn',\n file: tsconfigPath,\n message:\n `${tsconfigName} does not set ${missing.join(' and ')} in ` +\n `compilerOptions. The gate re-checks your submission under the ` +\n `host's own stricter compiler rules — a project that typechecks ` +\n `cleanly under its own laxer tsconfig can still fail that pass.`,\n hint:\n `Add ${missing.map((name) => `\"${name}\": true`).join(', ')} to ` +\n `compilerOptions in ${tsconfigName}.`,\n },\n ];\n}\n\n/** `tsconfig.json` if present (matching what a bare `tsc --noEmit` would\n * auto-discover), else the first `tsconfig.*.json` found. */\nfunction findTsconfigPath(projectDir: string): string | undefined {\n let names: string[];\n try {\n names = fs\n .readdirSync(projectDir, { withFileTypes: true })\n .filter((entry) => entry.isFile() && TSCONFIG_PATTERN.test(entry.name))\n .map((entry) => entry.name);\n } catch {\n return undefined;\n }\n if (names.length === 0) return undefined;\n const name = names.includes('tsconfig.json')\n ? 'tsconfig.json'\n : [...names].sort()[0];\n return name ? path.join(projectDir, name) : undefined;\n}\n\n/**\n * A minimal, string-literal-aware strip of `//` and `/* *\\/` comments —\n * tsconfig.json is conventionally JSONC, but nothing in this package's\n * dependency graph parses it as such. Not a full JSONC parser: it does not\n * touch trailing commas beyond the one cleanup pass below, and it makes no\n * attempt to validate the result — `JSON.parse` does that, and a project\n * with genuinely malformed JSON falls through to this check's `info`-severity\n * catch, never a crash.\n */\nfunction stripJsonComments(source: string): string {\n let out = '';\n let inString = false;\n let quote = '';\n\n for (let i = 0; i < source.length; i++) {\n const char = source[i] ?? '';\n\n if (inString) {\n out += char;\n if (char === '\\\\') {\n out += source[++i] ?? '';\n continue;\n }\n if (char === quote) inString = false;\n continue;\n }\n\n if (char === '\"' || char === \"'\") {\n inString = true;\n quote = char;\n out += char;\n continue;\n }\n\n if (char === '/' && source[i + 1] === '/') {\n while (i < source.length && source[i] !== '\\n') i++;\n out += '\\n';\n continue;\n }\n\n if (char === '/' && source[i + 1] === '*') {\n i += 2;\n while (\n i < source.length &&\n !(source[i] === '*' && source[i + 1] === '/')\n ) {\n i++;\n }\n i++; // consume the closing '/'\n continue;\n }\n\n out += char;\n }\n\n // Trailing commas before a closing brace/bracket.\n return out.replace(/,(\\s*[}\\]])/g, '$1');\n}\n\n/**\n * True when the config source contains an `inline: [ … ]` array that lists\n * `@ekanos/sdk`. Textual on purpose — evaluating a partner's config module\n * would run arbitrary code; a lint-style scan does not.\n */\nfunction vitestInlinesSdk(source: string): boolean {\n const inlineArrayPattern = /inline\\s*:\\s*\\[([\\s\\S]*?)\\]/g;\n for (\n let match = inlineArrayPattern.exec(source);\n match !== null;\n match = inlineArrayPattern.exec(source)\n ) {\n if (/['\"]@ekanos\\/sdk['\"]/.test(match[1] ?? '')) return true;\n }\n return false;\n}\n"]}
|
package/dist/publish-api.d.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* ---------------------------------------------------------------------------
|
|
5
5
|
* WIRE CONTRACT — the seam between this package and the Fusion web app.
|
|
6
6
|
*
|
|
7
|
-
* The server side
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* The server side is the host's `/api/partner/submissions` route. As with
|
|
8
|
+
* the auth routes (see `auth/fusion-api.ts`), the two halves are coupled
|
|
9
|
+
* only by HTTP; tests stub `fetch`, never the route.
|
|
10
10
|
*
|
|
11
11
|
* POST /api/partner/submissions [Authorization: Bearer <access_token>]
|
|
12
12
|
* ← multipart/form-data:
|
|
@@ -45,15 +45,14 @@
|
|
|
45
45
|
* → 404 { error, code: "SOURCE_NOT_FOUND" }
|
|
46
46
|
* → 3xx treated as 401
|
|
47
47
|
*
|
|
48
|
-
* `state` walks submitted -> gated|rejected -> dev -> prod -> revoked
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* `state` walks submitted -> gated|rejected -> dev -> prod -> revoked,
|
|
49
|
+
* enforced by a database trigger on the host's side (the full transition
|
|
50
|
+
* matrix lives there). `gated`/`dev`/`rejected` are the
|
|
51
51
|
* terminal-for-waiting states `ekanos status --watch` polls for.
|
|
52
52
|
* ---------------------------------------------------------------------------
|
|
53
53
|
*/
|
|
54
54
|
/**
|
|
55
|
-
* The server's manifest cap — 64 KiB of UTF-8, enforced
|
|
56
|
-
* `apps/web/app/api/partner/submissions/_lib/submission-validation.ts` against
|
|
55
|
+
* The server's manifest cap — 64 KiB of UTF-8, enforced server-side against
|
|
57
56
|
* `Buffer.byteLength`. Mirrored here so `publish` can refuse an oversized
|
|
58
57
|
* manifest with a clear message instead of the server's generic 400.
|
|
59
58
|
*/
|
|
@@ -85,9 +84,18 @@ export declare function submitArchive(host: string, accessToken: string, payload
|
|
|
85
84
|
/**
|
|
86
85
|
* One gate finding, mirroring `@ekanos/integration-schema`'s `Finding` shape
|
|
87
86
|
* (the same one `validate`/`publish` carry in `data.findings`). Declared
|
|
88
|
-
* locally rather than imported: the gate's own report type lives in
|
|
89
|
-
*
|
|
90
|
-
* has no business depending on — the wire shape is the
|
|
87
|
+
* locally rather than imported: the gate's own report type lives in a
|
|
88
|
+
* server-side toolchain package private to the platform monorepo, which this
|
|
89
|
+
* partner-facing CLI has no business depending on — the wire shape is the
|
|
90
|
+
* only contract.
|
|
91
|
+
*
|
|
92
|
+
* `origin`/`id`/`createdAt`/`resolvedAt` are the additive fields the host's
|
|
93
|
+
* findings-merge endpoint puts on the wire once host-filed findings — CI
|
|
94
|
+
* failures, host observations, a revocation reason — are merged in alongside
|
|
95
|
+
* the gate's own verdict. A gate-only finding still omits them entirely
|
|
96
|
+
* (this CLI's own `validate`/`publish` findings never set `origin`, which
|
|
97
|
+
* the renderer reads as "gate"); they only appear on findings read back from
|
|
98
|
+
* `GET /api/partner/submissions?detail=findings`.
|
|
91
99
|
*/
|
|
92
100
|
export interface GateFinding {
|
|
93
101
|
check: string;
|
|
@@ -96,6 +104,11 @@ export interface GateFinding {
|
|
|
96
104
|
line?: number;
|
|
97
105
|
message: string;
|
|
98
106
|
hint: string;
|
|
107
|
+
/** `'gate' | 'ci' | 'host' | 'revocation'` on the wire; kept as `string` — see the doc comment on `HostFindingRow` in `merge-findings.ts` for why the host stays defensive rather than a narrower literal union here. */
|
|
108
|
+
origin?: string;
|
|
109
|
+
id?: string;
|
|
110
|
+
createdAt?: string;
|
|
111
|
+
resolvedAt?: string | null;
|
|
99
112
|
}
|
|
100
113
|
export interface GateStageResult {
|
|
101
114
|
id: string;
|
package/dist/publish-api.js
CHANGED
|
@@ -6,9 +6,9 @@ import { authRequiredError, forbiddenError, invalidStateError, networkError, not
|
|
|
6
6
|
* ---------------------------------------------------------------------------
|
|
7
7
|
* WIRE CONTRACT — the seam between this package and the Fusion web app.
|
|
8
8
|
*
|
|
9
|
-
* The server side
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* The server side is the host's `/api/partner/submissions` route. As with
|
|
10
|
+
* the auth routes (see `auth/fusion-api.ts`), the two halves are coupled
|
|
11
|
+
* only by HTTP; tests stub `fetch`, never the route.
|
|
12
12
|
*
|
|
13
13
|
* POST /api/partner/submissions [Authorization: Bearer <access_token>]
|
|
14
14
|
* ← multipart/form-data:
|
|
@@ -47,15 +47,14 @@ import { authRequiredError, forbiddenError, invalidStateError, networkError, not
|
|
|
47
47
|
* → 404 { error, code: "SOURCE_NOT_FOUND" }
|
|
48
48
|
* → 3xx treated as 401
|
|
49
49
|
*
|
|
50
|
-
* `state` walks submitted -> gated|rejected -> dev -> prod -> revoked
|
|
51
|
-
*
|
|
52
|
-
*
|
|
50
|
+
* `state` walks submitted -> gated|rejected -> dev -> prod -> revoked,
|
|
51
|
+
* enforced by a database trigger on the host's side (the full transition
|
|
52
|
+
* matrix lives there). `gated`/`dev`/`rejected` are the
|
|
53
53
|
* terminal-for-waiting states `ekanos status --watch` polls for.
|
|
54
54
|
* ---------------------------------------------------------------------------
|
|
55
55
|
*/
|
|
56
56
|
/**
|
|
57
|
-
* The server's manifest cap — 64 KiB of UTF-8, enforced
|
|
58
|
-
* `apps/web/app/api/partner/submissions/_lib/submission-validation.ts` against
|
|
57
|
+
* The server's manifest cap — 64 KiB of UTF-8, enforced server-side against
|
|
59
58
|
* `Buffer.byteLength`. Mirrored here so `publish` can refuse an oversized
|
|
60
59
|
* manifest with a clear message instead of the server's generic 400.
|
|
61
60
|
*/
|
package/dist/publish-api.js.map
CHANGED
|
@@ -1 +1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AAC,CAAE,MAAkC;YACrC,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,MAAc;IAChC,OAAO,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,CAAC;AACvC,CAAC;AAED,SAAS,GAAG,CAAC,KAAc;IACzB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC;AAED,SAAS,GAAG,CAAC,KAAc;IACzB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5E,CAAC","sourcesContent":["import { request } from './auth/fusion-api';\nimport {\n authRequiredError,\n forbiddenError,\n invalidStateError,\n networkError,\n notFoundError,\n validationError,\n} from './errors';\n\n/**\n * The CLI's client for the Fusion submission intake route.\n *\n * ---------------------------------------------------------------------------\n * WIRE CONTRACT — the seam between this package and the Fusion web app.\n *\n * The server side lives in `apps/web/app/api/partner/submissions/route.ts`.\n * As with the auth routes (see `auth/fusion-api.ts`), the two halves are\n * coupled only by HTTP; tests stub `fetch`, never the route.\n *\n * POST /api/partner/submissions [Authorization: Bearer <access_token>]\n * ← multipart/form-data:\n * source — Fusion source slug\n * slug — integration slug (kebab-case)\n * version — semver\n * manifest — JSON string (the parsed ekanos.json + declaration summary)\n * archive — gzipped tarball, ≤ 4 MiB\n * → 201 { ok: true, data: { submissionId, slug, version, state,\n * archiveSha256 } }\n * → 400 { error, code: \"INVALID_REQUEST\" | \"INVALID_ARCHIVE\" }\n * → 401 { error, code: \"AUTH_REQUIRED\" } token absent or expired —\n * refresh once and retry\n * → 403 { error, code: \"FORBIDDEN\" } no developer seat on the source\n * → 404 { error, code: \"SOURCE_NOT_FOUND\" }\n * → 409 { error, code: \"VERSION_EXISTS\" } this (slug, version) is\n * already submitted\n * → 413 { error, code: \"ARCHIVE_TOO_LARGE\" }\n * → 3xx treated as 401 (an\n * auth-gated Fusion page\n * answers 307)\n *\n * GET /api/partner/submissions?source=<slug|id>[&detail=findings]\n * [Authorization: Bearer]\n * → 200 { ok: true, data: { source, integrations: [{ id, slug, name,\n * createdAt, versions: [{ id, version, state, archiveSha256,\n * submittedAt, gatedAt,\n * // present once a gate has run (gate_report is non-null):\n * errorCount?, warnCount?,\n * // present ONLY with ?detail=findings, alongside the above:\n * findings?, stages?\n * }] }] } }\n * → 400 { error, code: \"INVALID_REQUEST\" }\n * → 401 { error, code: \"AUTH_REQUIRED\" } refresh once and retry\n * → 403 { error, code: \"MFA_REQUIRED\" }\n * → 404 { error, code: \"SOURCE_NOT_FOUND\" }\n * → 3xx treated as 401\n *\n * `state` walks submitted -> gated|rejected -> dev -> prod -> revoked (see\n * the trigger in apps/web/supabase/schemas/110-partner-submissions.sql for\n * the full transition matrix). `gated`/`dev`/`rejected` are the\n * terminal-for-waiting states `ekanos status --watch` polls for.\n * ---------------------------------------------------------------------------\n */\n\n/**\n * The server's manifest cap — 64 KiB of UTF-8, enforced in\n * `apps/web/app/api/partner/submissions/_lib/submission-validation.ts` against\n * `Buffer.byteLength`. Mirrored here so `publish` can refuse an oversized\n * manifest with a clear message instead of the server's generic 400.\n */\nexport const MAX_MANIFEST_BYTES = 64 * 1024;\n\nexport interface SubmissionPayload {\n source: string;\n slug: string;\n version: string;\n /** JSON string — already serialized by the caller. */\n manifest: string;\n archive: Uint8Array;\n}\n\nexport interface SubmissionReceipt {\n submissionId: string;\n slug: string;\n version: string;\n state: string;\n archiveSha256: string;\n}\n\nexport type SubmitResult =\n | { status: 'ok'; receipt: SubmissionReceipt }\n /** The bearer token did not authenticate — refresh and retry, once. */\n | { status: 'unauthorized' };\n\nexport async function submitArchive(\n host: string,\n accessToken: string,\n payload: SubmissionPayload,\n): Promise<SubmitResult> {\n const form = new FormData();\n form.append('source', payload.source);\n form.append('slug', payload.slug);\n form.append('version', payload.version);\n form.append('manifest', payload.manifest);\n form.append(\n 'archive',\n // Copy into a fresh Uint8Array: Buffer is Uint8Array<ArrayBufferLike>,\n // which BlobPart refuses (a SharedArrayBuffer view is not a BlobPart).\n new Blob([new Uint8Array(payload.archive)], { type: 'application/gzip' }),\n 'archive.tgz',\n );\n\n const response = await request(`${host}/api/partner/submissions`, {\n method: 'POST',\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${accessToken}`,\n },\n body: form,\n });\n\n // 401, or the 307 an auth-gated Fusion route answers with: the token did\n // not authenticate. The caller owns the refresh-and-retry decision.\n if (response.status === 401 || isRedirect(response.status)) {\n return { status: 'unauthorized' };\n }\n\n const body = await readOptionalJson(response);\n const serverMessage = str(body.error);\n\n if (response.status === 403) {\n throw forbiddenError(\n serverMessage ??\n `${host} refused the submission: this account does not hold the ` +\n `developer seat on source \"${payload.source}\".`,\n `Ask the source operator to grant your account the developer seat for ` +\n `\"${payload.source}\", then retry.`,\n );\n }\n\n if (response.status === 404) {\n throw notFoundError(\n serverMessage ?? `${host} has no source with slug \"${payload.source}\".`,\n `Check the --source value (or the \"source\" field in ekanos.json) ` +\n `against the slug your Fusion operator gave you.`,\n );\n }\n\n if (response.status === 409) {\n throw invalidStateError(\n serverMessage ??\n `Version ${payload.version} of \"${payload.slug}\" is already submitted.`,\n `Submitted versions are immutable. Bump the \"version\" field in ` +\n `package.json and publish again.`,\n );\n }\n\n if (response.status === 400 || response.status === 413) {\n throw validationError(\n serverMessage ?? `${host} rejected the submission as invalid.`,\n `Fix the reported problem and re-run \"ekanos publish\". If the message ` +\n `names the archive, re-check the project layout (\"ekanos validate\").`,\n );\n }\n\n if (!response.ok) {\n throw networkError(\n `${host}/api/partner/submissions responded ${response.status}.`,\n response.status >= 500\n ? `The Fusion deployment returned a server error. Retry shortly; if ` +\n `it persists, report it with the status code.`\n : `Confirm the host is a Fusion deployment running a build that ` +\n `includes the partner submissions route.`,\n );\n }\n\n const data = (body.data ?? {}) as Record<string, unknown>;\n const receipt = {\n submissionId: str(data.submissionId),\n slug: str(data.slug),\n version: str(data.version),\n state: str(data.state),\n archiveSha256: str(data.archiveSha256),\n };\n\n if (Object.values(receipt).some((value) => value === null)) {\n throw networkError(\n `${host} accepted the submission but returned an incomplete receipt.`,\n `Confirm the deployment is running a Fusion build that includes the ` +\n `partner submissions route, then check the submission's state with ` +\n `your operator before re-publishing.`,\n );\n }\n\n return { status: 'ok', receipt: receipt as SubmissionReceipt };\n}\n\n/**\n * One gate finding, mirroring `@ekanos/integration-schema`'s `Finding` shape\n * (the same one `validate`/`publish` carry in `data.findings`). Declared\n * locally rather than imported: the gate's own report type lives in\n * `@ekanos/checks`, a server-side/toolchain package this partner-facing CLI\n * has no business depending on — the wire shape is the only contract.\n */\nexport interface GateFinding {\n check: string;\n severity: 'error' | 'warn' | 'info';\n file?: string;\n line?: number;\n message: string;\n hint: string;\n}\n\nexport interface GateStageResult {\n id: string;\n status: 'pass' | 'fail' | 'skipped';\n durationMs: number;\n}\n\nexport interface SubmissionVersion {\n id: string;\n version: string;\n state: string;\n archiveSha256: string | null;\n submittedAt: string | null;\n gatedAt: string | null;\n /** Present once a gate has run. */\n errorCount: number | null;\n warnCount: number | null;\n /** Present only when the request passed `?detail=findings`. */\n findings?: GateFinding[];\n stages?: GateStageResult[];\n}\n\nexport interface SubmissionListing {\n id: string;\n slug: string;\n name: string | null;\n createdAt: string | null;\n versions: SubmissionVersion[];\n}\n\nexport type ListResult =\n | { status: 'ok'; integrations: SubmissionListing[] }\n /** The bearer token did not authenticate — refresh and retry, once. */\n | { status: 'unauthorized' };\n\n/**\n * List the caller's visible submissions for a source. Same authorization model\n * as `submitArchive`: the seat SELECT policies filter server-side, so a caller\n * with no seat sees an empty list rather than an error.\n *\n * `detail: 'findings'` requests the full per-version findings/stages arrays\n * (used by `status --findings` and `status --watch`); omitted, the server\n * answers with counts only — see the wire contract above.\n */\nexport async function listSubmissions(\n host: string,\n accessToken: string,\n source: string,\n options: { detail?: 'findings' } = {},\n): Promise<ListResult> {\n const query = new URLSearchParams({ source });\n if (options.detail) query.set('detail', options.detail);\n\n const response = await request(\n `${host}/api/partner/submissions?${query.toString()}`,\n {\n method: 'GET',\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${accessToken}`,\n },\n },\n );\n\n if (response.status === 401 || isRedirect(response.status)) {\n return { status: 'unauthorized' };\n }\n\n const body = await readOptionalJson(response);\n const serverMessage = str(body.error);\n\n if (response.status === 403) {\n throw forbiddenError(\n serverMessage ?? `${host} refused to list submissions for \"${source}\".`,\n `Complete MFA in the browser if the message names it, then run ` +\n `\"ekanos login --host ${host}\" again.`,\n );\n }\n\n if (response.status === 404) {\n throw notFoundError(\n serverMessage ?? `${host} has no source with slug \"${source}\".`,\n `Check the \"source\" field in ekanos.json (or --source) against the ` +\n `slug your Fusion operator gave you.`,\n );\n }\n\n if (response.status === 400) {\n throw validationError(\n serverMessage ?? `${host} rejected the submissions query.`,\n `Fix the reported problem and re-run \"ekanos status\".`,\n );\n }\n\n if (!response.ok) {\n throw networkError(\n `${host}/api/partner/submissions responded ${response.status}.`,\n response.status >= 500\n ? `The Fusion deployment returned a server error. Retry shortly; if ` +\n `it persists, report it with the status code.`\n : `Confirm the host is a Fusion deployment running a build that ` +\n `includes the partner submissions route.`,\n );\n }\n\n const data = (body.data ?? {}) as Record<string, unknown>;\n const rows = Array.isArray(data.integrations) ? data.integrations : [];\n\n const integrations = rows\n .filter(\n (row): row is Record<string, unknown> =>\n typeof row === 'object' && row !== null,\n )\n .map((row) => ({\n id: str(row.id) ?? '',\n slug: str(row.slug) ?? '',\n name: str(row.name),\n createdAt: str(row.createdAt),\n versions: (Array.isArray(row.versions) ? row.versions : [])\n .filter(\n (version): version is Record<string, unknown> =>\n typeof version === 'object' && version !== null,\n )\n .map((version) => ({\n id: str(version.id) ?? '',\n version: str(version.version) ?? '',\n state: str(version.state) ?? '',\n archiveSha256: str(version.archiveSha256),\n submittedAt: str(version.submittedAt),\n gatedAt: str(version.gatedAt),\n errorCount: num(version.errorCount),\n warnCount: num(version.warnCount),\n ...(Array.isArray(version.findings)\n ? { findings: version.findings as GateFinding[] }\n : {}),\n ...(Array.isArray(version.stages)\n ? { stages: version.stages as GateStageResult[] }\n : {}),\n })),\n }));\n\n return { status: 'ok', integrations };\n}\n\n/** Guard for the \"still unauthorized after one refresh\" terminal case. */\nexport function stillUnauthorized(host: string): never {\n throw authRequiredError(\n `The session for ${host} could not authorize the submission.`,\n `Run \"ekanos login --host ${host}\" and retry.`,\n );\n}\n\nasync function readOptionalJson(\n response: Response,\n): Promise<Record<string, unknown>> {\n try {\n const parsed: unknown = await response.json();\n\n return typeof parsed === 'object' && parsed !== null\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n\nfunction isRedirect(status: number): boolean {\n return status >= 300 && status < 400;\n}\n\nfunction str(value: unknown): string | null {\n return typeof value === 'string' && value.length > 0 ? value : null;\n}\n\nfunction num(value: unknown): number | null {\n return typeof value === 'number' && Number.isFinite(value) ? value : null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"publish-api.js","sourceRoot":"","sources":["../src/publish-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,eAAe,GAChB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,CAAC;AAwB5C,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,WAAmB,EACnB,OAA0B;;IAE1B,MAAM,IAAI,GAAG,IAAI,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CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5E,CAAC","sourcesContent":["import { request } from './auth/fusion-api';\nimport {\n authRequiredError,\n forbiddenError,\n invalidStateError,\n networkError,\n notFoundError,\n validationError,\n} from './errors';\n\n/**\n * The CLI's client for the Fusion submission intake route.\n *\n * ---------------------------------------------------------------------------\n * WIRE CONTRACT — the seam between this package and the Fusion web app.\n *\n * The server side is the host's `/api/partner/submissions` route. As with\n * the auth routes (see `auth/fusion-api.ts`), the two halves are coupled\n * only by HTTP; tests stub `fetch`, never the route.\n *\n * POST /api/partner/submissions [Authorization: Bearer <access_token>]\n * ← multipart/form-data:\n * source — Fusion source slug\n * slug — integration slug (kebab-case)\n * version — semver\n * manifest — JSON string (the parsed ekanos.json + declaration summary)\n * archive — gzipped tarball, ≤ 4 MiB\n * → 201 { ok: true, data: { submissionId, slug, version, state,\n * archiveSha256 } }\n * → 400 { error, code: \"INVALID_REQUEST\" | \"INVALID_ARCHIVE\" }\n * → 401 { error, code: \"AUTH_REQUIRED\" } token absent or expired —\n * refresh once and retry\n * → 403 { error, code: \"FORBIDDEN\" } no developer seat on the source\n * → 404 { error, code: \"SOURCE_NOT_FOUND\" }\n * → 409 { error, code: \"VERSION_EXISTS\" } this (slug, version) is\n * already submitted\n * → 413 { error, code: \"ARCHIVE_TOO_LARGE\" }\n * → 3xx treated as 401 (an\n * auth-gated Fusion page\n * answers 307)\n *\n * GET /api/partner/submissions?source=<slug|id>[&detail=findings]\n * [Authorization: Bearer]\n * → 200 { ok: true, data: { source, integrations: [{ id, slug, name,\n * createdAt, versions: [{ id, version, state, archiveSha256,\n * submittedAt, gatedAt,\n * // present once a gate has run (gate_report is non-null):\n * errorCount?, warnCount?,\n * // present ONLY with ?detail=findings, alongside the above:\n * findings?, stages?\n * }] }] } }\n * → 400 { error, code: \"INVALID_REQUEST\" }\n * → 401 { error, code: \"AUTH_REQUIRED\" } refresh once and retry\n * → 403 { error, code: \"MFA_REQUIRED\" }\n * → 404 { error, code: \"SOURCE_NOT_FOUND\" }\n * → 3xx treated as 401\n *\n * `state` walks submitted -> gated|rejected -> dev -> prod -> revoked,\n * enforced by a database trigger on the host's side (the full transition\n * matrix lives there). `gated`/`dev`/`rejected` are the\n * terminal-for-waiting states `ekanos status --watch` polls for.\n * ---------------------------------------------------------------------------\n */\n\n/**\n * The server's manifest cap — 64 KiB of UTF-8, enforced server-side against\n * `Buffer.byteLength`. Mirrored here so `publish` can refuse an oversized\n * manifest with a clear message instead of the server's generic 400.\n */\nexport const MAX_MANIFEST_BYTES = 64 * 1024;\n\nexport interface SubmissionPayload {\n source: string;\n slug: string;\n version: string;\n /** JSON string — already serialized by the caller. */\n manifest: string;\n archive: Uint8Array;\n}\n\nexport interface SubmissionReceipt {\n submissionId: string;\n slug: string;\n version: string;\n state: string;\n archiveSha256: string;\n}\n\nexport type SubmitResult =\n | { status: 'ok'; receipt: SubmissionReceipt }\n /** The bearer token did not authenticate — refresh and retry, once. */\n | { status: 'unauthorized' };\n\nexport async function submitArchive(\n host: string,\n accessToken: string,\n payload: SubmissionPayload,\n): Promise<SubmitResult> {\n const form = new FormData();\n form.append('source', payload.source);\n form.append('slug', payload.slug);\n form.append('version', payload.version);\n form.append('manifest', payload.manifest);\n form.append(\n 'archive',\n // Copy into a fresh Uint8Array: Buffer is Uint8Array<ArrayBufferLike>,\n // which BlobPart refuses (a SharedArrayBuffer view is not a BlobPart).\n new Blob([new Uint8Array(payload.archive)], { type: 'application/gzip' }),\n 'archive.tgz',\n );\n\n const response = await request(`${host}/api/partner/submissions`, {\n method: 'POST',\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${accessToken}`,\n },\n body: form,\n });\n\n // 401, or the 307 an auth-gated Fusion route answers with: the token did\n // not authenticate. The caller owns the refresh-and-retry decision.\n if (response.status === 401 || isRedirect(response.status)) {\n return { status: 'unauthorized' };\n }\n\n const body = await readOptionalJson(response);\n const serverMessage = str(body.error);\n\n if (response.status === 403) {\n throw forbiddenError(\n serverMessage ??\n `${host} refused the submission: this account does not hold the ` +\n `developer seat on source \"${payload.source}\".`,\n `Ask the source operator to grant your account the developer seat for ` +\n `\"${payload.source}\", then retry.`,\n );\n }\n\n if (response.status === 404) {\n throw notFoundError(\n serverMessage ?? `${host} has no source with slug \"${payload.source}\".`,\n `Check the --source value (or the \"source\" field in ekanos.json) ` +\n `against the slug your Fusion operator gave you.`,\n );\n }\n\n if (response.status === 409) {\n throw invalidStateError(\n serverMessage ??\n `Version ${payload.version} of \"${payload.slug}\" is already submitted.`,\n `Submitted versions are immutable. Bump the \"version\" field in ` +\n `package.json and publish again.`,\n );\n }\n\n if (response.status === 400 || response.status === 413) {\n throw validationError(\n serverMessage ?? `${host} rejected the submission as invalid.`,\n `Fix the reported problem and re-run \"ekanos publish\". If the message ` +\n `names the archive, re-check the project layout (\"ekanos validate\").`,\n );\n }\n\n if (!response.ok) {\n throw networkError(\n `${host}/api/partner/submissions responded ${response.status}.`,\n response.status >= 500\n ? `The Fusion deployment returned a server error. Retry shortly; if ` +\n `it persists, report it with the status code.`\n : `Confirm the host is a Fusion deployment running a build that ` +\n `includes the partner submissions route.`,\n );\n }\n\n const data = (body.data ?? {}) as Record<string, unknown>;\n const receipt = {\n submissionId: str(data.submissionId),\n slug: str(data.slug),\n version: str(data.version),\n state: str(data.state),\n archiveSha256: str(data.archiveSha256),\n };\n\n if (Object.values(receipt).some((value) => value === null)) {\n throw networkError(\n `${host} accepted the submission but returned an incomplete receipt.`,\n `Confirm the deployment is running a Fusion build that includes the ` +\n `partner submissions route, then check the submission's state with ` +\n `your operator before re-publishing.`,\n );\n }\n\n return { status: 'ok', receipt: receipt as SubmissionReceipt };\n}\n\n/**\n * One gate finding, mirroring `@ekanos/integration-schema`'s `Finding` shape\n * (the same one `validate`/`publish` carry in `data.findings`). Declared\n * locally rather than imported: the gate's own report type lives in a\n * server-side toolchain package private to the platform monorepo, which this\n * partner-facing CLI has no business depending on — the wire shape is the\n * only contract.\n *\n * `origin`/`id`/`createdAt`/`resolvedAt` are the additive fields the host's\n * findings-merge endpoint puts on the wire once host-filed findings — CI\n * failures, host observations, a revocation reason — are merged in alongside\n * the gate's own verdict. A gate-only finding still omits them entirely\n * (this CLI's own `validate`/`publish` findings never set `origin`, which\n * the renderer reads as \"gate\"); they only appear on findings read back from\n * `GET /api/partner/submissions?detail=findings`.\n */\nexport interface GateFinding {\n check: string;\n severity: 'error' | 'warn' | 'info';\n file?: string;\n line?: number;\n message: string;\n hint: string;\n /** `'gate' | 'ci' | 'host' | 'revocation'` on the wire; kept as `string` — see the doc comment on `HostFindingRow` in `merge-findings.ts` for why the host stays defensive rather than a narrower literal union here. */\n origin?: string;\n id?: string;\n createdAt?: string;\n resolvedAt?: string | null;\n}\n\nexport interface GateStageResult {\n id: string;\n status: 'pass' | 'fail' | 'skipped';\n durationMs: number;\n}\n\nexport interface SubmissionVersion {\n id: string;\n version: string;\n state: string;\n archiveSha256: string | null;\n submittedAt: string | null;\n gatedAt: string | null;\n /** Present once a gate has run. */\n errorCount: number | null;\n warnCount: number | null;\n /** Present only when the request passed `?detail=findings`. */\n findings?: GateFinding[];\n stages?: GateStageResult[];\n}\n\nexport interface SubmissionListing {\n id: string;\n slug: string;\n name: string | null;\n createdAt: string | null;\n versions: SubmissionVersion[];\n}\n\nexport type ListResult =\n | { status: 'ok'; integrations: SubmissionListing[] }\n /** The bearer token did not authenticate — refresh and retry, once. */\n | { status: 'unauthorized' };\n\n/**\n * List the caller's visible submissions for a source. Same authorization model\n * as `submitArchive`: the seat SELECT policies filter server-side, so a caller\n * with no seat sees an empty list rather than an error.\n *\n * `detail: 'findings'` requests the full per-version findings/stages arrays\n * (used by `status --findings` and `status --watch`); omitted, the server\n * answers with counts only — see the wire contract above.\n */\nexport async function listSubmissions(\n host: string,\n accessToken: string,\n source: string,\n options: { detail?: 'findings' } = {},\n): Promise<ListResult> {\n const query = new URLSearchParams({ source });\n if (options.detail) query.set('detail', options.detail);\n\n const response = await request(\n `${host}/api/partner/submissions?${query.toString()}`,\n {\n method: 'GET',\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${accessToken}`,\n },\n },\n );\n\n if (response.status === 401 || isRedirect(response.status)) {\n return { status: 'unauthorized' };\n }\n\n const body = await readOptionalJson(response);\n const serverMessage = str(body.error);\n\n if (response.status === 403) {\n throw forbiddenError(\n serverMessage ?? `${host} refused to list submissions for \"${source}\".`,\n `Complete MFA in the browser if the message names it, then run ` +\n `\"ekanos login --host ${host}\" again.`,\n );\n }\n\n if (response.status === 404) {\n throw notFoundError(\n serverMessage ?? `${host} has no source with slug \"${source}\".`,\n `Check the \"source\" field in ekanos.json (or --source) against the ` +\n `slug your Fusion operator gave you.`,\n );\n }\n\n if (response.status === 400) {\n throw validationError(\n serverMessage ?? `${host} rejected the submissions query.`,\n `Fix the reported problem and re-run \"ekanos status\".`,\n );\n }\n\n if (!response.ok) {\n throw networkError(\n `${host}/api/partner/submissions responded ${response.status}.`,\n response.status >= 500\n ? `The Fusion deployment returned a server error. Retry shortly; if ` +\n `it persists, report it with the status code.`\n : `Confirm the host is a Fusion deployment running a build that ` +\n `includes the partner submissions route.`,\n );\n }\n\n const data = (body.data ?? {}) as Record<string, unknown>;\n const rows = Array.isArray(data.integrations) ? data.integrations : [];\n\n const integrations = rows\n .filter(\n (row): row is Record<string, unknown> =>\n typeof row === 'object' && row !== null,\n )\n .map((row) => ({\n id: str(row.id) ?? '',\n slug: str(row.slug) ?? '',\n name: str(row.name),\n createdAt: str(row.createdAt),\n versions: (Array.isArray(row.versions) ? row.versions : [])\n .filter(\n (version): version is Record<string, unknown> =>\n typeof version === 'object' && version !== null,\n )\n .map((version) => ({\n id: str(version.id) ?? '',\n version: str(version.version) ?? '',\n state: str(version.state) ?? '',\n archiveSha256: str(version.archiveSha256),\n submittedAt: str(version.submittedAt),\n gatedAt: str(version.gatedAt),\n errorCount: num(version.errorCount),\n warnCount: num(version.warnCount),\n ...(Array.isArray(version.findings)\n ? { findings: version.findings as GateFinding[] }\n : {}),\n ...(Array.isArray(version.stages)\n ? { stages: version.stages as GateStageResult[] }\n : {}),\n })),\n }));\n\n return { status: 'ok', integrations };\n}\n\n/** Guard for the \"still unauthorized after one refresh\" terminal case. */\nexport function stillUnauthorized(host: string): never {\n throw authRequiredError(\n `The session for ${host} could not authorize the submission.`,\n `Run \"ekanos login --host ${host}\" and retry.`,\n );\n}\n\nasync function readOptionalJson(\n response: Response,\n): Promise<Record<string, unknown>> {\n try {\n const parsed: unknown = await response.json();\n\n return typeof parsed === 'object' && parsed !== null\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n\nfunction isRedirect(status: number): boolean {\n return status >= 300 && status < 400;\n}\n\nfunction str(value: unknown): string | null {\n return typeof value === 'string' && value.length > 0 ? value : null;\n}\n\nfunction num(value: unknown): number | null {\n return typeof value === 'number' && Number.isFinite(value) ? value : null;\n}\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Best-effort zod dot-path → source line resolution for `validate`'s
|
|
3
|
+
* schema findings.
|
|
4
|
+
*
|
|
5
|
+
* `collectDefinitionFindings` (in `@ekanos/integration-schema`) bakes a zod
|
|
6
|
+
* PATH into `Finding.message` (`"components.widgets.0.id: Required"`), never
|
|
7
|
+
* a source offset — zod reports a `path`, not a byte offset, and fabricating
|
|
8
|
+
* a line number would be a lie (see the `Finding` doc comment there). This
|
|
9
|
+
* module recovers a plausible line by scanning the partner's declaration
|
|
10
|
+
* source text: no AST, no new dependency — TypeScript's compiler API is a
|
|
11
|
+
* devDep in this workspace, not a runtime one, and the published CLI never
|
|
12
|
+
* ships it, so it is never imported here. Just a brace-tracking scan of the
|
|
13
|
+
* object/array literal passed to `defineIntegration(...)`.
|
|
14
|
+
*
|
|
15
|
+
* The rule that matters more than any mechanic below: a WRONG line number is
|
|
16
|
+
* worse than none. Anything this module can't resolve with confidence
|
|
17
|
+
* returns `{ confidence: 'none' }` — never a guess.
|
|
18
|
+
*/
|
|
19
|
+
export type LocateConfidence = 'exact' | 'enclosing' | 'none';
|
|
20
|
+
export type LocateResult = {
|
|
21
|
+
confidence: 'exact';
|
|
22
|
+
line: number;
|
|
23
|
+
} | {
|
|
24
|
+
confidence: 'enclosing';
|
|
25
|
+
line: number;
|
|
26
|
+
} | {
|
|
27
|
+
confidence: 'none';
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Appended, PLAIN TEXT (no ANSI — this module never touches color; see
|
|
31
|
+
* `ui.ts`'s doc comment on why nothing outside it may), to a finding's
|
|
32
|
+
* message when only the enclosing object/array was found, not the missing
|
|
33
|
+
* key itself. `findings-renderer.ts` recognizes this literal suffix and dims
|
|
34
|
+
* it at render time.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ENCLOSING_NOTE = "(showing the enclosing object \u2014 add the missing key here)";
|
|
37
|
+
/** The literal path `collectDefinitionFindings` emits for a zod issue whose `path` array is empty. */
|
|
38
|
+
export declare function isRootPath(dotPath: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* `"components.widgets[0].id"` and `"components.widgets.0.id"` both split to
|
|
41
|
+
* `['components', 'widgets', '0', 'id']` — `collectDefinitionFindings` only
|
|
42
|
+
* ever emits the dot form (a plain `issue.path.join('.')`), but this accepts
|
|
43
|
+
* either, matching the pattern `findings-renderer.ts`'s dot-path detector
|
|
44
|
+
* already tolerates.
|
|
45
|
+
*/
|
|
46
|
+
export declare function splitDotPath(dotPath: string): string[];
|
|
47
|
+
/**
|
|
48
|
+
* A finding message is `"<dot-path>: <zod message>"` (or `(root): …` for an
|
|
49
|
+
* empty path) — see the `Finding` doc comment in `@ekanos/integration-schema`.
|
|
50
|
+
* Splits the two apart; `null` for a message with no such prefix (every
|
|
51
|
+
* finding NOT built from a zod issue, e.g. `definition.plain-data`).
|
|
52
|
+
*/
|
|
53
|
+
export declare function extractPathFromMessage(message: string): {
|
|
54
|
+
path: string;
|
|
55
|
+
rest: string;
|
|
56
|
+
} | null;
|
|
57
|
+
/**
|
|
58
|
+
* Locates `dotPath` (a zod path string, e.g. `"components.widgets.0.id"` or
|
|
59
|
+
* `"(root)"`) within `source`, the declaration file's full text. `source`
|
|
60
|
+
* MUST contain an inline `defineIntegration({ … })` call — a definition
|
|
61
|
+
* built from a variable, spread, or factory function can't be resolved
|
|
62
|
+
* statically and always comes back `none`. A one-line (minified/no-newline)
|
|
63
|
+
* source also always comes back `none`: a codeframe there can't isolate
|
|
64
|
+
* anything the reader couldn't already see, so it isn't worth the risk of a
|
|
65
|
+
* technically-correct-but-useless "line 1" frame.
|
|
66
|
+
*/
|
|
67
|
+
export declare function locateDotPath(source: string, dotPath: string): LocateResult;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Best-effort zod dot-path → source line resolution for `validate`'s
|
|
3
|
+
* schema findings.
|
|
4
|
+
*
|
|
5
|
+
* `collectDefinitionFindings` (in `@ekanos/integration-schema`) bakes a zod
|
|
6
|
+
* PATH into `Finding.message` (`"components.widgets.0.id: Required"`), never
|
|
7
|
+
* a source offset — zod reports a `path`, not a byte offset, and fabricating
|
|
8
|
+
* a line number would be a lie (see the `Finding` doc comment there). This
|
|
9
|
+
* module recovers a plausible line by scanning the partner's declaration
|
|
10
|
+
* source text: no AST, no new dependency — TypeScript's compiler API is a
|
|
11
|
+
* devDep in this workspace, not a runtime one, and the published CLI never
|
|
12
|
+
* ships it, so it is never imported here. Just a brace-tracking scan of the
|
|
13
|
+
* object/array literal passed to `defineIntegration(...)`.
|
|
14
|
+
*
|
|
15
|
+
* The rule that matters more than any mechanic below: a WRONG line number is
|
|
16
|
+
* worse than none. Anything this module can't resolve with confidence
|
|
17
|
+
* returns `{ confidence: 'none' }` — never a guess.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Appended, PLAIN TEXT (no ANSI — this module never touches color; see
|
|
21
|
+
* `ui.ts`'s doc comment on why nothing outside it may), to a finding's
|
|
22
|
+
* message when only the enclosing object/array was found, not the missing
|
|
23
|
+
* key itself. `findings-renderer.ts` recognizes this literal suffix and dims
|
|
24
|
+
* it at render time.
|
|
25
|
+
*/
|
|
26
|
+
export const ENCLOSING_NOTE = '(showing the enclosing object — add the missing key here)';
|
|
27
|
+
/** The literal path `collectDefinitionFindings` emits for a zod issue whose `path` array is empty. */
|
|
28
|
+
export function isRootPath(dotPath) {
|
|
29
|
+
return dotPath === '(root)';
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* `"components.widgets[0].id"` and `"components.widgets.0.id"` both split to
|
|
33
|
+
* `['components', 'widgets', '0', 'id']` — `collectDefinitionFindings` only
|
|
34
|
+
* ever emits the dot form (a plain `issue.path.join('.')`), but this accepts
|
|
35
|
+
* either, matching the pattern `findings-renderer.ts`'s dot-path detector
|
|
36
|
+
* already tolerates.
|
|
37
|
+
*/
|
|
38
|
+
export function splitDotPath(dotPath) {
|
|
39
|
+
var _a;
|
|
40
|
+
if (isRootPath(dotPath))
|
|
41
|
+
return [];
|
|
42
|
+
return (_a = dotPath.match(/[^.[\]]+/g)) !== null && _a !== void 0 ? _a : [];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A finding message is `"<dot-path>: <zod message>"` (or `(root): …` for an
|
|
46
|
+
* empty path) — see the `Finding` doc comment in `@ekanos/integration-schema`.
|
|
47
|
+
* Splits the two apart; `null` for a message with no such prefix (every
|
|
48
|
+
* finding NOT built from a zod issue, e.g. `definition.plain-data`).
|
|
49
|
+
*/
|
|
50
|
+
export function extractPathFromMessage(message) {
|
|
51
|
+
const match = /^((?:\(root\))|[A-Za-z0-9_]+(?:\.[A-Za-z0-9_]+|\[\d+\])*): ([^]+)$/.exec(message);
|
|
52
|
+
if (!match)
|
|
53
|
+
return null;
|
|
54
|
+
const [, path, rest] = match;
|
|
55
|
+
if (path === undefined || rest === undefined)
|
|
56
|
+
return null;
|
|
57
|
+
return { path, rest };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Replaces the CONTENTS of every string/template literal and comment with a
|
|
61
|
+
* neutral filler, preserving length, newlines, and every character outside
|
|
62
|
+
* those regions verbatim — so a later brace-depth scan never miscounts a
|
|
63
|
+
* `{`/`}`/`,` that only appears inside a string, while every index computed
|
|
64
|
+
* against the result still points at the same character in the original
|
|
65
|
+
* `source`. Delimiter characters (quotes, `/*`, `//`) are kept as-is; only
|
|
66
|
+
* their insides are masked.
|
|
67
|
+
*/
|
|
68
|
+
function mask(source) {
|
|
69
|
+
const out = source.split('');
|
|
70
|
+
const n = source.length;
|
|
71
|
+
let i = 0;
|
|
72
|
+
while (i < n) {
|
|
73
|
+
const ch = source[i];
|
|
74
|
+
const next = source[i + 1];
|
|
75
|
+
if (ch === '/' && next === '/') {
|
|
76
|
+
// Mask the `//` marker itself too, not just what follows it — a bare
|
|
77
|
+
// `/` isn't whitespace, so `skipMaskedWhitespace` needs the WHOLE
|
|
78
|
+
// comment (marker included) to read as blank in order to skip past a
|
|
79
|
+
// comment that precedes a key.
|
|
80
|
+
out[i] = ' ';
|
|
81
|
+
out[i + 1] = ' ';
|
|
82
|
+
i += 2;
|
|
83
|
+
while (i < n && source[i] !== '\n') {
|
|
84
|
+
out[i] = ' ';
|
|
85
|
+
i += 1;
|
|
86
|
+
}
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (ch === '/' && next === '*') {
|
|
90
|
+
out[i] = ' ';
|
|
91
|
+
out[i + 1] = ' ';
|
|
92
|
+
i += 2;
|
|
93
|
+
while (i < n && !(source[i] === '*' && source[i + 1] === '/')) {
|
|
94
|
+
if (source[i] !== '\n')
|
|
95
|
+
out[i] = ' ';
|
|
96
|
+
i += 1;
|
|
97
|
+
}
|
|
98
|
+
if (i < n)
|
|
99
|
+
out[i] = ' ';
|
|
100
|
+
if (i + 1 < n)
|
|
101
|
+
out[i + 1] = ' ';
|
|
102
|
+
i += 2;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (ch === "'" || ch === '"' || ch === '`') {
|
|
106
|
+
const quote = ch;
|
|
107
|
+
i += 1;
|
|
108
|
+
while (i < n && source[i] !== quote) {
|
|
109
|
+
if (source[i] === '\\') {
|
|
110
|
+
if (source[i + 1] !== '\n' && i + 1 < n)
|
|
111
|
+
out[i + 1] = 'x';
|
|
112
|
+
i += 2;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (source[i] !== '\n')
|
|
116
|
+
out[i] = 'x';
|
|
117
|
+
i += 1;
|
|
118
|
+
}
|
|
119
|
+
i += 1;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
i += 1;
|
|
123
|
+
}
|
|
124
|
+
return out.join('');
|
|
125
|
+
}
|
|
126
|
+
/** Index of the delimiter matching `masked[openIndex]`, or `-1` for unbalanced/malformed input. Operates on masked text so a bracket inside a string never throws off the count. */
|
|
127
|
+
function findMatchingClose(masked, openIndex) {
|
|
128
|
+
const stack = [];
|
|
129
|
+
for (let i = openIndex; i < masked.length; i += 1) {
|
|
130
|
+
const ch = masked[i];
|
|
131
|
+
if (ch === '{')
|
|
132
|
+
stack.push('}');
|
|
133
|
+
else if (ch === '[')
|
|
134
|
+
stack.push(']');
|
|
135
|
+
else if (ch === '(')
|
|
136
|
+
stack.push(')');
|
|
137
|
+
else if (ch === '}' || ch === ']' || ch === ')') {
|
|
138
|
+
if (stack.pop() !== ch)
|
|
139
|
+
return -1;
|
|
140
|
+
if (stack.length === 0)
|
|
141
|
+
return i;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return -1;
|
|
145
|
+
}
|
|
146
|
+
/** Top-level (depth-0-relative-to-the-scope) member spans between a scope's delimiters, split at depth-0 commas — one span per object property or array element, in source order. */
|
|
147
|
+
function splitTopLevelMembers(masked, scope) {
|
|
148
|
+
const members = [];
|
|
149
|
+
let depth = 0;
|
|
150
|
+
let memberStart = scope.start + 1;
|
|
151
|
+
for (let i = scope.start + 1; i < scope.end; i += 1) {
|
|
152
|
+
const ch = masked[i];
|
|
153
|
+
if (ch === '{' || ch === '[' || ch === '(')
|
|
154
|
+
depth += 1;
|
|
155
|
+
else if (ch === '}' || ch === ']' || ch === ')')
|
|
156
|
+
depth -= 1;
|
|
157
|
+
else if (ch === ',' && depth === 0) {
|
|
158
|
+
members.push({ start: memberStart, end: i });
|
|
159
|
+
memberStart = i + 1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
members.push({ start: memberStart, end: scope.end });
|
|
163
|
+
return members.filter((m) => masked.slice(m.start, m.end).trim() !== '');
|
|
164
|
+
}
|
|
165
|
+
function scopeAt(masked, index) {
|
|
166
|
+
const ch = masked[index];
|
|
167
|
+
if (ch !== '{' && ch !== '[')
|
|
168
|
+
return null;
|
|
169
|
+
const close = findMatchingClose(masked, index);
|
|
170
|
+
if (close === -1)
|
|
171
|
+
return null;
|
|
172
|
+
return { start: index, end: close, kind: ch };
|
|
173
|
+
}
|
|
174
|
+
function findRootScope(masked) {
|
|
175
|
+
var _a;
|
|
176
|
+
const match = /defineIntegration\s*\(/.exec(masked);
|
|
177
|
+
if (!match)
|
|
178
|
+
return null;
|
|
179
|
+
let i = match.index + match[0].length;
|
|
180
|
+
while (i < masked.length && /\s/.test((_a = masked[i]) !== null && _a !== void 0 ? _a : ''))
|
|
181
|
+
i += 1;
|
|
182
|
+
return scopeAt(masked, i);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A quoted (`'id'`/`"id"`) or bare (`id`) object key immediately followed by
|
|
186
|
+
* `:`, anchored at the very start of the string it's matched against — the
|
|
187
|
+
* caller is responsible for having already skipped past any leading
|
|
188
|
+
* whitespace AND leading comment (both of which read as whitespace in the
|
|
189
|
+
* MASKED text, see `skipMaskedWhitespace`). Matched against the RAW source
|
|
190
|
+
* slice, never the masked one — masking a quoted key's own text would
|
|
191
|
+
* destroy the very name being compared.
|
|
192
|
+
*/
|
|
193
|
+
const KEY_PATTERN = /^(?:(['"])((?:\\.|(?!\1)[^\\])*)\1|([A-Za-z_$][\w$]*))\s*:/;
|
|
194
|
+
/** First index at or after `start` (and before `end`) whose MASKED character is not whitespace — a masked comment reads as whitespace here too, so this skips leading comments along with real whitespace/newlines. */
|
|
195
|
+
function skipMaskedWhitespace(masked, start, end) {
|
|
196
|
+
var _a;
|
|
197
|
+
let i = start;
|
|
198
|
+
while (i < end && /\s/.test((_a = masked[i]) !== null && _a !== void 0 ? _a : ''))
|
|
199
|
+
i += 1;
|
|
200
|
+
return i;
|
|
201
|
+
}
|
|
202
|
+
function descend(source, masked, scope, segment) {
|
|
203
|
+
var _a;
|
|
204
|
+
const members = splitTopLevelMembers(masked, scope);
|
|
205
|
+
if (scope.kind === '[') {
|
|
206
|
+
if (!/^\d+$/.test(segment))
|
|
207
|
+
return 'mismatch';
|
|
208
|
+
const member = members[Number(segment)];
|
|
209
|
+
if (!member)
|
|
210
|
+
return 'not-found';
|
|
211
|
+
const targetStart = skipMaskedWhitespace(masked, member.start, member.end);
|
|
212
|
+
return { targetStart, valueScope: scopeAt(masked, targetStart) };
|
|
213
|
+
}
|
|
214
|
+
for (const member of members) {
|
|
215
|
+
const contentStart = skipMaskedWhitespace(masked, member.start, member.end);
|
|
216
|
+
const raw = source.slice(contentStart, member.end);
|
|
217
|
+
const match = KEY_PATTERN.exec(raw);
|
|
218
|
+
if (!match)
|
|
219
|
+
continue;
|
|
220
|
+
const keyName = (_a = match[2]) !== null && _a !== void 0 ? _a : match[3];
|
|
221
|
+
if (keyName !== segment)
|
|
222
|
+
continue;
|
|
223
|
+
const valueStart = skipMaskedWhitespace(masked, contentStart + match[0].length, member.end);
|
|
224
|
+
return {
|
|
225
|
+
targetStart: contentStart,
|
|
226
|
+
valueScope: scopeAt(masked, valueStart),
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
return 'not-found';
|
|
230
|
+
}
|
|
231
|
+
function lineAt(source, index) {
|
|
232
|
+
let line = 1;
|
|
233
|
+
for (let i = 0; i < index && i < source.length; i += 1) {
|
|
234
|
+
if (source[i] === '\n')
|
|
235
|
+
line += 1;
|
|
236
|
+
}
|
|
237
|
+
return line;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Locates `dotPath` (a zod path string, e.g. `"components.widgets.0.id"` or
|
|
241
|
+
* `"(root)"`) within `source`, the declaration file's full text. `source`
|
|
242
|
+
* MUST contain an inline `defineIntegration({ … })` call — a definition
|
|
243
|
+
* built from a variable, spread, or factory function can't be resolved
|
|
244
|
+
* statically and always comes back `none`. A one-line (minified/no-newline)
|
|
245
|
+
* source also always comes back `none`: a codeframe there can't isolate
|
|
246
|
+
* anything the reader couldn't already see, so it isn't worth the risk of a
|
|
247
|
+
* technically-correct-but-useless "line 1" frame.
|
|
248
|
+
*/
|
|
249
|
+
export function locateDotPath(source, dotPath) {
|
|
250
|
+
// Strip trailing newline(s) before checking: a one-line declaration saved
|
|
251
|
+
// with a normal trailing EOF newline must still count as "one line," not
|
|
252
|
+
// "multi-line" by virtue of that single trailing `\n`.
|
|
253
|
+
if (!source.replace(/\n+$/, '').includes('\n'))
|
|
254
|
+
return { confidence: 'none' };
|
|
255
|
+
const masked = mask(source);
|
|
256
|
+
const root = findRootScope(masked);
|
|
257
|
+
if (!root)
|
|
258
|
+
return { confidence: 'none' };
|
|
259
|
+
const segments = splitDotPath(dotPath);
|
|
260
|
+
if (segments.length === 0) {
|
|
261
|
+
return { confidence: 'enclosing', line: lineAt(source, root.start) };
|
|
262
|
+
}
|
|
263
|
+
let scope = root;
|
|
264
|
+
for (let i = 0; i < segments.length; i += 1) {
|
|
265
|
+
const segment = segments[i];
|
|
266
|
+
if (segment === undefined)
|
|
267
|
+
break;
|
|
268
|
+
const result = descend(source, masked, scope, segment);
|
|
269
|
+
if (result === 'mismatch')
|
|
270
|
+
return { confidence: 'none' };
|
|
271
|
+
if (result === 'not-found') {
|
|
272
|
+
return { confidence: 'enclosing', line: lineAt(source, scope.start) };
|
|
273
|
+
}
|
|
274
|
+
const isLast = i === segments.length - 1;
|
|
275
|
+
if (isLast) {
|
|
276
|
+
return { confidence: 'exact', line: lineAt(source, result.targetStart) };
|
|
277
|
+
}
|
|
278
|
+
if (result.valueScope === null)
|
|
279
|
+
return { confidence: 'none' };
|
|
280
|
+
scope = result.valueScope;
|
|
281
|
+
}
|
|
282
|
+
return { confidence: 'none' };
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=source-locator.js.map
|