@moldea.ai/cli 8.0.0 → 9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  The canonical read-only local command-line composition for deterministic inspection of `moldea` repositories.
6
6
 
7
- The version 8 executable exposes one schema-4-only JSON contract. `validate` and `inspect` are content-free, `scope` matches changed paths by reading only the project manifest, and `content` retrieves one explicitly selected canonical text asset in bounded Unicode-safe chunks. Collection and content responses use deterministic snapshot-bound cursors, exact final UTF-8 byte accounting, a 65,536-byte default page budget, and a 1,048,576-byte hard page ceiling.
7
+ The version 9 executable exposes one schema-5-only JSON contract. `validate` and `inspect` are content-free, `scope` matches changed paths by reading only the project manifest, and `content` retrieves one explicitly selected canonical text asset in bounded Unicode-safe chunks. Collection and content responses use deterministic snapshot-bound cursors, exact final UTF-8 byte accounting, a 65,536-byte default page budget, and a 1,048,576-byte hard page ceiling.
8
8
 
9
9
  Install and invoke the CLI from each adopted repository. Global or user-home installation is outside the supported trust boundary because it can make unrelated repositories share ambient skill and executable behavior.
10
10
 
@@ -103,23 +103,27 @@ The executable owns one operation-scoped `AbortController`. Repository-backed co
103
103
 
104
104
  Git process cancellation uses the safe retryable `git:GIT_OPERATION_ABORTED` contract with message `The Git operation was aborted.` at internal command boundaries. When cancellation originates from a process signal before output completion, the executable may emit no human or JSON document rather than expose a successful or partial result. Active Git child processes are terminated through the same operation signal; no raw abort reason or process diagnostic is printed.
105
105
 
106
- A successfully completed Core inspection produces `validate` human or JSON output without exposing the project index, canonical content, or adapter evidence details. Zero diagnostics return status `valid` and exit code `0`; one or more diagnostics return status `invalid` and exit with code `1`. Diagnostics use bounded pages in JSON mode.
106
+ A successfully completed Core inspection produces `validate` human or JSON output without exposing the project index, canonical content, or adapter evidence details. Zero errors return status `valid` and exit code `0`, including when scoped unverified-relationship warnings are present. Confirmed errors return status `invalid` and exit code `1`. Complete error and warning counts appear on every JSON page; human output names the affected relationship and safe version context when available. Diagnostics use bounded pages in JSON mode.
107
107
 
108
- `inspect` uses the same completion status and exit codes. Human output reports the repository format and complete collection counts. JSON output contains only allowlisted records: one independently keyed `agent` record per canonical agent with exactly its `agentId` and manifest-declared `runtimeId`, asset identifiers and metadata, diagnostics without arbitrary details, and evidence summaries without adapter detail payloads. An assignment establishes canonical configuration only. It does not claim that a runtime is installed, implemented, qualified, or published. Unbounded child collections are emitted as independently keyed records, so no parent record grows with the repository. A recursive guard rejects any non-`content` result containing a `content` property or an exact canonical body.
108
+ `inspect` uses the same completion status and exit codes. Human output reports the repository format and complete collection counts. JSON output contains only allowlisted records: one independently keyed `agent` record per canonical agent with exactly its `agentId` and manifest-declared `runtimeId`, asset identifiers and metadata, diagnostic severity and closed warning context without arbitrary error details, and evidence summaries without adapter detail payloads. An assignment establishes canonical configuration only. It does not claim that a runtime is installed, implemented, qualified, or published. Unbounded child collections are emitted as independently keyed records, so no parent record grows with the repository. A recursive guard rejects any non-`content` result containing a `content` property or an exact canonical body.
109
109
 
110
- `scope` accepts either one repository-logical path through `--path` or NUL-delimited UTF-8 paths through `--paths-stdin`. It reads only `/moldea/moldea.yaml`, invokes Core's deterministic relationship matcher without adapters, and returns relevance, complete counts and digests, and paged match or diagnostic records. `content` accepts exactly one canonical moldea text path and returns metadata plus the largest complete Unicode-scalar chunk that fits its output page.
110
+ `scope` accepts either one leading-slash repository-logical path through `--path` or NUL-delimited UTF-8 paths with the same grammar through `--paths-stdin`. Invalid paths return `PATH_INPUT_INVALID` before repository discovery; relative paths are not normalized. It reads only `/moldea/moldea.yaml`, invokes Core's deterministic relationship matcher without adapters, and returns relevance, complete counts and digests, and paged match or diagnostic records. `content` accepts exactly one canonical moldea text path and returns metadata plus the largest complete Unicode-scalar chunk that fits its output page.
111
111
 
112
112
  For JSON collection and content output, `--max-output-bytes` accepts 4,096 through 1,048,576 bytes and defaults to 65,536. The measurement covers the final newline-terminated UTF-8 envelope after JSON escaping. `--cursor` continues a prior JSON page. Cursors are opaque canonical base64url documents bound to their format version, command, normalized filters, source snapshot, last key, and checksum. Invalid, tampered, cross-command, filter-mismatched, unsupported, or stale cursors fail with a safe structured error. An envelope or atomic record that cannot fit returns `OUTPUT_BUDGET_TOO_SMALL`; output is never truncated into invalid JSON.
113
113
 
114
114
  The 65,536-byte default is retained by a reproducible three-sample resource corpus covering ordinary and 1,024-path repositories, large Unicode content, broad relationship output, dense diagnostics, and invalid binary content. Large traversals use additional bounded pages without raising the page peak. The 1 MiB hard maximum is a single-response safety boundary, not a total repository-size limit.
115
115
 
116
+ The `inspect` unresolved count includes project-owned and agent-owned requirements across all effects. IDs are scoped to their owners, so identical IDs under different owners count separately. These readiness gaps do not themselves invalidate structurally valid project state.
117
+
118
+ Each CLI invocation is stateless. An `inspect --cursor` call repeats Git inventory and Core preparation before returning its page; a prepared Core inspection used within one process can read further pages without repeating that work. In a 65-agent shared-source fixture on Linux, the default output budget required three separate CLI commands, emitted 155,606 cumulative JSON bytes, and took 3.37 seconds in one local run. The result describes that fixture and host, not a fixed performance limit or a token count. Use `scope` for changed-path relevance and `content` for one canonical file when a full inspection is unnecessary, and request only the pages needed for the task.
119
+
116
120
  ## Installed composition and integrity
117
121
 
118
122
  Before `validate`, `inspect`, or `composition` produces a result, the executable compares its installed package metadata, actually resolved first-class package identities and versions, compatible-major first-class dependency declarations, active package-backed adapter registration, Core repository-format support, minimum Git constant, and JSON output schema constant. Source-workspace dependencies use `workspace:^<major>.0.0`; packed dependencies retain the equivalent `^<major>.0.0` range. Every resolved package must satisfy the CLI release's declared major line. Exact pins, unbounded ranges, package-manager overrides to a different major or prerelease, missing or additional first-class dependencies, duplicate or invalid adapter IDs, package-backed registration of `custom`, unsupported adapter formats, and invalid constants fail before Git discovery or repository inspection. Compatible patch and minor resolutions remain valid and are reported exactly by `composition`.
119
123
 
120
124
  `composition` reports the installed CLI version and JSON schema version in the envelope, plus the supported Node.js range, minimum Git version, sorted exact package versions, Core repository-format versions, and every sorted executable adapter with its accepted repository formats. Core's built-in `custom` adapter is included using Core's format support. The CLI does not report matrix entries, maturity, implementation status, target profiles, evidence links, or compatibility claims owned by the packages website. Current published technical compatibility and target maturity are available from [`https://packages.moldea.ai/compatibility/runtimes.json`](https://packages.moldea.ai/compatibility/runtimes.json).
121
125
 
122
- Successful human and JSON reports use exit code `0`; JSON uses status `valid` and the schema 4 deterministic envelope. The command never uses status `invalid`. A contradictory installation returns the non-retryable `cli:COMPOSITION_STATE_INVALID` error with message `The installed composition state is invalid.` and exit code `3`, without a partial result. The command accesses no Git executable, repository filesystem, client manifest, network, or Cloud service.
126
+ Successful human and JSON reports use exit code `0`; JSON uses status `valid` and the schema 5 deterministic envelope. The command never uses status `invalid`. A contradictory installation returns the non-retryable `cli:COMPOSITION_STATE_INVALID` error with message `The installed composition state is invalid.` and exit code `3`, without a partial result. The command accesses no Git executable, repository filesystem, client manifest, network, or Cloud service.
123
127
 
124
128
  ## Development
125
129
 
@@ -12,17 +12,17 @@ var MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES = Object.freeze([
12
12
  var MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX = "@moldea.ai/adapter-";
13
13
  var MOLDEA_CLI_CUSTOM_ADAPTER_ID = "custom";
14
14
  var MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES = Object.freeze({
15
- "@moldea.ai/adapter-anthropic": "^4.0.0",
16
- "@moldea.ai/adapter-claude-agent-sdk": "^3.0.0",
17
- "@moldea.ai/adapter-cloudflare-agents": "^3.0.0",
18
- "@moldea.ai/adapter-eve": "^3.0.0",
19
- "@moldea.ai/adapter-google-genai": "^3.0.0",
20
- "@moldea.ai/adapter-langchain": "^3.0.0",
21
- "@moldea.ai/adapter-langgraph": "^3.0.0",
22
- "@moldea.ai/adapter-openai": "^4.0.0",
23
- "@moldea.ai/adapter-openai-agents-sdk": "^3.0.0",
24
- "@moldea.ai/adapter-vercel-ai-sdk": "^3.0.0",
25
- "@moldea.ai/core": "^4.0.0",
15
+ "@moldea.ai/adapter-anthropic": "^5.0.0",
16
+ "@moldea.ai/adapter-claude-agent-sdk": "^4.0.0",
17
+ "@moldea.ai/adapter-cloudflare-agents": "^4.0.0",
18
+ "@moldea.ai/adapter-eve": "^4.0.0",
19
+ "@moldea.ai/adapter-google-genai": "^4.0.0",
20
+ "@moldea.ai/adapter-langchain": "^4.0.0",
21
+ "@moldea.ai/adapter-langgraph": "^4.0.0",
22
+ "@moldea.ai/adapter-openai": "^5.0.0",
23
+ "@moldea.ai/adapter-openai-agents-sdk": "^4.0.0",
24
+ "@moldea.ai/adapter-vercel-ai-sdk": "^4.0.0",
25
+ "@moldea.ai/core": "^5.0.0",
26
26
  "@moldea.ai/repository": "^2.0.0",
27
27
  "@moldea.ai/repository-fs": "^2.0.0"
28
28
  });
@@ -50,7 +50,7 @@ var createActiveAdapterMap = (adapters, coreRepositoryFormatVersions) => {
50
50
  */
51
51
  var isMoldeaCliCompositionStateValid = (input) => {
52
52
  const { dependencies, installedPackageVersions, supportedNodeRange, version } = input.packageMetadata;
53
- if ((0, import_semver.valid)(version) === null || supportedNodeRange === null || (0, import_semver.validRange)(supportedNodeRange) === null || (0, import_semver.valid)(input.minimumGitVersion) === null || input.outputSchemaVersion !== 4 || dependencies === null || installedPackageVersions === null || !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)) return false;
53
+ if ((0, import_semver.valid)(version) === null || supportedNodeRange === null || (0, import_semver.validRange)(supportedNodeRange) === null || (0, import_semver.valid)(input.minimumGitVersion) === null || input.outputSchemaVersion !== 5 || dependencies === null || installedPackageVersions === null || !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)) return false;
54
54
  const activeAdapterMap = createActiveAdapterMap(input.activeAdapters, input.coreSupportedRepositoryFormatVersions);
55
55
  if (activeAdapterMap === null) return false;
56
56
  const expectedPackageNames = [...MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES, ...[...activeAdapterMap.keys()].map((adapterId) => `${MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX}${adapterId}`)];
@@ -133,10 +133,10 @@ var resolveInstalledMoldeaCliComposition = (input) => resolveMoldeaCliCompositio
133
133
  activeAdapters: ACTIVE_RUNTIME_ADAPTERS,
134
134
  coreSupportedRepositoryFormatVersions: SUPPORTED_REPOSITORY_FORMAT_VERSIONS,
135
135
  minimumGitVersion: MINIMUM_GIT_VERSION,
136
- outputSchemaVersion: 4,
136
+ outputSchemaVersion: 5,
137
137
  packageMetadata: input.packageMetadata
138
138
  });
139
139
  //#endregion
140
140
  export { resolveInstalledMoldeaCliComposition };
141
141
 
142
- //# sourceMappingURL=composition-By-2bWuu.js.map
142
+ //# sourceMappingURL=composition-Ck3cXQUk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"composition-By-2bWuu.js","names":[],"sources":["../../src/composition/constants.ts","../../src/composition/validations.ts","../../src/composition/transformers.ts","../../src/composition/composition.ts"],"sourcesContent":["// exact first-class package identities required by every CLI release\nexport const MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES = Object.freeze([\n '@moldea.ai/core',\n '@moldea.ai/repository',\n '@moldea.ai/repository-fs',\n] as const);\n\n// stable package and adapter identities used by runtime composition validation\nexport const MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX = '@moldea.ai/adapter-';\nexport const MOLDEA_CLI_CUSTOM_ADAPTER_ID = 'custom';\n\n// compatible first-class package lines accepted by CLI 8\nexport const MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES = Object.freeze({\n '@moldea.ai/adapter-anthropic': '^4.0.0',\n '@moldea.ai/adapter-claude-agent-sdk': '^3.0.0',\n '@moldea.ai/adapter-cloudflare-agents': '^3.0.0',\n '@moldea.ai/adapter-eve': '^3.0.0',\n '@moldea.ai/adapter-google-genai': '^3.0.0',\n '@moldea.ai/adapter-langchain': '^3.0.0',\n '@moldea.ai/adapter-langgraph': '^3.0.0',\n '@moldea.ai/adapter-openai': '^4.0.0',\n '@moldea.ai/adapter-openai-agents-sdk': '^3.0.0',\n '@moldea.ai/adapter-vercel-ai-sdk': '^3.0.0',\n '@moldea.ai/core': '^4.0.0',\n '@moldea.ai/repository': '^2.0.0',\n '@moldea.ai/repository-fs': '^2.0.0',\n} as const);\n","import { satisfies as doesVersionSatisfy, valid as isValidVersion, validRange } from 'semver';\n\nimport type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\n\nimport {\n MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX,\n MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES,\n MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n} from './constants.js';\nimport type { IMoldeaCliCompositionStateInput } from './types.js';\n\nconst ADAPTER_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;\n\nconst hasExactStringSet = (left: readonly string[], right: readonly string[]): boolean => {\n if (\n left.length !== right.length ||\n new Set(left).size !== left.length ||\n new Set(right).size !== right.length\n ) {\n return false;\n }\n\n const rightValues = new Set(right);\n return left.every((entry) => rightValues.has(entry));\n};\n\nconst hasUniquePositiveIntegers = (entries: readonly number[]): boolean =>\n entries.length > 0 &&\n entries.every((entry) => Number.isSafeInteger(entry) && entry > 0) &&\n new Set(entries).size === entries.length;\n\nconst createActiveAdapterMap = (\n adapters: readonly IRuntimeAdapter[],\n coreRepositoryFormatVersions: readonly number[],\n): ReadonlyMap<string, IRuntimeAdapter> | null => {\n const adapterMap = new Map<string, IRuntimeAdapter>();\n\n for (const adapter of adapters) {\n if (\n adapterMap.has(adapter.id) ||\n adapter.id === MOLDEA_CLI_CUSTOM_ADAPTER_ID ||\n !ADAPTER_ID_PATTERN.test(adapter.id) ||\n !hasUniquePositiveIntegers(adapter.supportedRepositoryFormatVersions) ||\n adapter.supportedRepositoryFormatVersions.some(\n (version) => !coreRepositoryFormatVersions.includes(version),\n )\n ) {\n return null;\n }\n\n adapterMap.set(adapter.id, adapter);\n }\n\n return adapterMap;\n};\n\n/**\n * Verifies the installed package manifest and actual executable adapter composition.\n * @param input The installed package, Core, adapter, Git, and JSON-schema state.\n * @returns Whether every runtime composition invariant is satisfied.\n */\nexport const isMoldeaCliCompositionStateValid = (\n input: IMoldeaCliCompositionStateInput,\n): boolean => {\n const { dependencies, installedPackageVersions, supportedNodeRange, version } =\n input.packageMetadata;\n\n if (\n isValidVersion(version) === null ||\n supportedNodeRange === null ||\n validRange(supportedNodeRange) === null ||\n isValidVersion(input.minimumGitVersion) === null ||\n input.outputSchemaVersion !== 4 ||\n dependencies === null ||\n installedPackageVersions === null ||\n !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)\n ) {\n return false;\n }\n\n const activeAdapterMap = createActiveAdapterMap(\n input.activeAdapters,\n input.coreSupportedRepositoryFormatVersions,\n );\n\n if (activeAdapterMap === null) {\n return false;\n }\n\n const expectedPackageNames = [\n ...MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n ...[...activeAdapterMap.keys()].map(\n (adapterId) => `${MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX}${adapterId}`,\n ),\n ];\n const declaredPackageNames = Object.keys(dependencies).filter((packageName) =>\n packageName.startsWith('@moldea.ai/'),\n );\n const resolvedPackageNames = Object.keys(installedPackageVersions);\n\n if (\n !hasExactStringSet(declaredPackageNames, expectedPackageNames) ||\n !hasExactStringSet(resolvedPackageNames, expectedPackageNames)\n ) {\n return false;\n }\n\n return expectedPackageNames.every((packageName) => {\n const resolvedVersion = installedPackageVersions[packageName];\n const declaredRange = dependencies[packageName];\n const supportedRange =\n MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES[\n packageName as keyof typeof MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES\n ];\n\n return (\n resolvedVersion !== undefined &&\n isValidVersion(resolvedVersion) !== null &&\n supportedRange !== undefined &&\n (declaredRange === supportedRange || declaredRange === `workspace:${supportedRange}`) &&\n doesVersionSatisfy(resolvedVersion, supportedRange)\n );\n });\n};\n","import { MOLDEA_CLI_CUSTOM_ADAPTER_ID } from './constants.js';\nimport type {\n IMoldeaCliAdapterComposition,\n IMoldeaCliCompositionResult,\n IMoldeaCliCompositionStateInput,\n} from './types.js';\n\nconst compareIdentifiers = (left: string, right: string): number =>\n left < right ? -1 : left > right ? 1 : 0;\n\n/** Recursively freezes a composition result without retaining mutable input ownership. */\nconst freezeCompositionValue = <TValue extends object>(value: TValue): TValue => {\n const pendingValues: object[] = [value];\n const visitedValues = new Set<object>();\n\n while (pendingValues.length > 0) {\n const currentValue = pendingValues.pop();\n\n if (currentValue === undefined || visitedValues.has(currentValue)) {\n continue;\n }\n\n visitedValues.add(currentValue);\n for (const nestedValue of Object.values(currentValue as Readonly<Record<string, unknown>>)) {\n if (typeof nestedValue === 'object' && nestedValue !== null) {\n pendingValues.push(nestedValue);\n }\n }\n\n Object.freeze(currentValue);\n }\n\n return value;\n};\n\n/**\n * Creates the compact immutable composition result from validated installed state.\n * @param input The already validated installed and executable composition.\n * @returns A deeply immutable composition result in deterministic report order.\n */\nexport const createMoldeaCliCompositionResult = (\n input: IMoldeaCliCompositionStateInput,\n): IMoldeaCliCompositionResult => {\n const adapters: IMoldeaCliAdapterComposition[] = [\n {\n id: MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n },\n ...input.activeAdapters.map((adapter) => ({\n id: adapter.id,\n repositoryFormatVersions: [...adapter.supportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n })),\n ].sort((left, right) => compareIdentifiers(left.id, right.id));\n const packages = Object.entries(input.packageMetadata.installedPackageVersions ?? {})\n .map(([name, version]) => ({ name, version }))\n .sort((left, right) => compareIdentifiers(left.name, right.name));\n\n return freezeCompositionValue({\n adapters,\n minimumGitVersion: input.minimumGitVersion,\n packages,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n supportedNodeRange: input.packageMetadata.supportedNodeRange ?? '',\n });\n};\n","import { SUPPORTED_REPOSITORY_FORMAT_VERSIONS } from '@moldea.ai/core';\n\nimport { ACTIVE_RUNTIME_ADAPTERS } from '../core-composition/index.js';\nimport { MINIMUM_GIT_VERSION } from '../git-version/index.js';\nimport { MOLDEA_CLI_JSON_SCHEMA_VERSION } from '../json-output-contract/index.js';\n\nimport { createMoldeaCliCompositionResult } from './transformers.js';\nimport type {\n IMoldeaCliCompositionResolution,\n IMoldeaCliCompositionStateInput,\n IMoldeaCliInstalledCompositionInput,\n} from './types.js';\nimport { isMoldeaCliCompositionStateValid } from './validations.js';\n\nconst INVALID_COMPOSITION_RESOLUTION = Object.freeze({ kind: 'invalid' as const });\n\n/**\n * Resolves one explicit runtime composition without emitting a partial composition result.\n * @param input The installed and actual runtime state to compare.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveMoldeaCliComposition = (\n input: IMoldeaCliCompositionStateInput,\n): IMoldeaCliCompositionResolution => {\n try {\n if (!isMoldeaCliCompositionStateValid(input)) {\n return INVALID_COMPOSITION_RESOLUTION;\n }\n\n return Object.freeze({\n kind: 'valid',\n result: createMoldeaCliCompositionResult(input),\n });\n } catch {\n return INVALID_COMPOSITION_RESOLUTION;\n }\n};\n\n/**\n * Resolves composition through the fixed package, Core, adapter, Git, and JSON composition.\n * @param input The installed package metadata.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveInstalledMoldeaCliComposition = (\n input: IMoldeaCliInstalledCompositionInput,\n): IMoldeaCliCompositionResolution =>\n resolveMoldeaCliComposition({\n activeAdapters: ACTIVE_RUNTIME_ADAPTERS,\n coreSupportedRepositoryFormatVersions: SUPPORTED_REPOSITORY_FORMAT_VERSIONS,\n minimumGitVersion: MINIMUM_GIT_VERSION,\n outputSchemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n packageMetadata: input.packageMetadata,\n });\n"],"mappings":";;;;;;AACA,IAAa,wCAA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ACN,OAAO;CACT;AACF;;;;;;AAOA,IAAa,wCACX,UAEA,4BAA4B;CAC1B,gBAAgB;CAChB,uCAAuC;CACvC,mBAAmB;CACnB,qBAAA;CACA,iBAAiB,MAAM;AACzB,CAAC"}
1
+ {"version":3,"file":"composition-Ck3cXQUk.js","names":[],"sources":["../../src/composition/constants.ts","../../src/composition/validations.ts","../../src/composition/transformers.ts","../../src/composition/composition.ts"],"sourcesContent":["// exact first-class package identities required by every CLI release\nexport const MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES = Object.freeze([\n '@moldea.ai/core',\n '@moldea.ai/repository',\n '@moldea.ai/repository-fs',\n] as const);\n\n// stable package and adapter identities used by runtime composition validation\nexport const MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX = '@moldea.ai/adapter-';\nexport const MOLDEA_CLI_CUSTOM_ADAPTER_ID = 'custom';\n\n// compatible first-class package lines accepted by CLI 9\nexport const MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES = Object.freeze({\n '@moldea.ai/adapter-anthropic': '^5.0.0',\n '@moldea.ai/adapter-claude-agent-sdk': '^4.0.0',\n '@moldea.ai/adapter-cloudflare-agents': '^4.0.0',\n '@moldea.ai/adapter-eve': '^4.0.0',\n '@moldea.ai/adapter-google-genai': '^4.0.0',\n '@moldea.ai/adapter-langchain': '^4.0.0',\n '@moldea.ai/adapter-langgraph': '^4.0.0',\n '@moldea.ai/adapter-openai': '^5.0.0',\n '@moldea.ai/adapter-openai-agents-sdk': '^4.0.0',\n '@moldea.ai/adapter-vercel-ai-sdk': '^4.0.0',\n '@moldea.ai/core': '^5.0.0',\n '@moldea.ai/repository': '^2.0.0',\n '@moldea.ai/repository-fs': '^2.0.0',\n} as const);\n","import { satisfies as doesVersionSatisfy, valid as isValidVersion, validRange } from 'semver';\n\nimport type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\n\nimport {\n MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX,\n MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES,\n MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n} from './constants.js';\nimport type { IMoldeaCliCompositionStateInput } from './types.js';\n\nconst ADAPTER_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;\n\nconst hasExactStringSet = (left: readonly string[], right: readonly string[]): boolean => {\n if (\n left.length !== right.length ||\n new Set(left).size !== left.length ||\n new Set(right).size !== right.length\n ) {\n return false;\n }\n\n const rightValues = new Set(right);\n return left.every((entry) => rightValues.has(entry));\n};\n\nconst hasUniquePositiveIntegers = (entries: readonly number[]): boolean =>\n entries.length > 0 &&\n entries.every((entry) => Number.isSafeInteger(entry) && entry > 0) &&\n new Set(entries).size === entries.length;\n\nconst createActiveAdapterMap = (\n adapters: readonly IRuntimeAdapter[],\n coreRepositoryFormatVersions: readonly number[],\n): ReadonlyMap<string, IRuntimeAdapter> | null => {\n const adapterMap = new Map<string, IRuntimeAdapter>();\n\n for (const adapter of adapters) {\n if (\n adapterMap.has(adapter.id) ||\n adapter.id === MOLDEA_CLI_CUSTOM_ADAPTER_ID ||\n !ADAPTER_ID_PATTERN.test(adapter.id) ||\n !hasUniquePositiveIntegers(adapter.supportedRepositoryFormatVersions) ||\n adapter.supportedRepositoryFormatVersions.some(\n (version) => !coreRepositoryFormatVersions.includes(version),\n )\n ) {\n return null;\n }\n\n adapterMap.set(adapter.id, adapter);\n }\n\n return adapterMap;\n};\n\n/**\n * Verifies the installed package manifest and actual executable adapter composition.\n * @param input The installed package, Core, adapter, Git, and JSON-schema state.\n * @returns Whether every runtime composition invariant is satisfied.\n */\nexport const isMoldeaCliCompositionStateValid = (\n input: IMoldeaCliCompositionStateInput,\n): boolean => {\n const { dependencies, installedPackageVersions, supportedNodeRange, version } =\n input.packageMetadata;\n\n if (\n isValidVersion(version) === null ||\n supportedNodeRange === null ||\n validRange(supportedNodeRange) === null ||\n isValidVersion(input.minimumGitVersion) === null ||\n input.outputSchemaVersion !== 5 ||\n dependencies === null ||\n installedPackageVersions === null ||\n !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)\n ) {\n return false;\n }\n\n const activeAdapterMap = createActiveAdapterMap(\n input.activeAdapters,\n input.coreSupportedRepositoryFormatVersions,\n );\n\n if (activeAdapterMap === null) {\n return false;\n }\n\n const expectedPackageNames = [\n ...MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n ...[...activeAdapterMap.keys()].map(\n (adapterId) => `${MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX}${adapterId}`,\n ),\n ];\n const declaredPackageNames = Object.keys(dependencies).filter((packageName) =>\n packageName.startsWith('@moldea.ai/'),\n );\n const resolvedPackageNames = Object.keys(installedPackageVersions);\n\n if (\n !hasExactStringSet(declaredPackageNames, expectedPackageNames) ||\n !hasExactStringSet(resolvedPackageNames, expectedPackageNames)\n ) {\n return false;\n }\n\n return expectedPackageNames.every((packageName) => {\n const resolvedVersion = installedPackageVersions[packageName];\n const declaredRange = dependencies[packageName];\n const supportedRange =\n MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES[\n packageName as keyof typeof MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES\n ];\n\n return (\n resolvedVersion !== undefined &&\n isValidVersion(resolvedVersion) !== null &&\n supportedRange !== undefined &&\n (declaredRange === supportedRange || declaredRange === `workspace:${supportedRange}`) &&\n doesVersionSatisfy(resolvedVersion, supportedRange)\n );\n });\n};\n","import { MOLDEA_CLI_CUSTOM_ADAPTER_ID } from './constants.js';\nimport type {\n IMoldeaCliAdapterComposition,\n IMoldeaCliCompositionResult,\n IMoldeaCliCompositionStateInput,\n} from './types.js';\n\nconst compareIdentifiers = (left: string, right: string): number =>\n left < right ? -1 : left > right ? 1 : 0;\n\n/** Recursively freezes a composition result without retaining mutable input ownership. */\nconst freezeCompositionValue = <TValue extends object>(value: TValue): TValue => {\n const pendingValues: object[] = [value];\n const visitedValues = new Set<object>();\n\n while (pendingValues.length > 0) {\n const currentValue = pendingValues.pop();\n\n if (currentValue === undefined || visitedValues.has(currentValue)) {\n continue;\n }\n\n visitedValues.add(currentValue);\n for (const nestedValue of Object.values(currentValue as Readonly<Record<string, unknown>>)) {\n if (typeof nestedValue === 'object' && nestedValue !== null) {\n pendingValues.push(nestedValue);\n }\n }\n\n Object.freeze(currentValue);\n }\n\n return value;\n};\n\n/**\n * Creates the compact immutable composition result from validated installed state.\n * @param input The already validated installed and executable composition.\n * @returns A deeply immutable composition result in deterministic report order.\n */\nexport const createMoldeaCliCompositionResult = (\n input: IMoldeaCliCompositionStateInput,\n): IMoldeaCliCompositionResult => {\n const adapters: IMoldeaCliAdapterComposition[] = [\n {\n id: MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n },\n ...input.activeAdapters.map((adapter) => ({\n id: adapter.id,\n repositoryFormatVersions: [...adapter.supportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n })),\n ].sort((left, right) => compareIdentifiers(left.id, right.id));\n const packages = Object.entries(input.packageMetadata.installedPackageVersions ?? {})\n .map(([name, version]) => ({ name, version }))\n .sort((left, right) => compareIdentifiers(left.name, right.name));\n\n return freezeCompositionValue({\n adapters,\n minimumGitVersion: input.minimumGitVersion,\n packages,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n supportedNodeRange: input.packageMetadata.supportedNodeRange ?? '',\n });\n};\n","import { SUPPORTED_REPOSITORY_FORMAT_VERSIONS } from '@moldea.ai/core';\n\nimport { ACTIVE_RUNTIME_ADAPTERS } from '../core-composition/index.js';\nimport { MINIMUM_GIT_VERSION } from '../git-version/index.js';\nimport { MOLDEA_CLI_JSON_SCHEMA_VERSION } from '../json-output-contract/index.js';\n\nimport { createMoldeaCliCompositionResult } from './transformers.js';\nimport type {\n IMoldeaCliCompositionResolution,\n IMoldeaCliCompositionStateInput,\n IMoldeaCliInstalledCompositionInput,\n} from './types.js';\nimport { isMoldeaCliCompositionStateValid } from './validations.js';\n\nconst INVALID_COMPOSITION_RESOLUTION = Object.freeze({ kind: 'invalid' as const });\n\n/**\n * Resolves one explicit runtime composition without emitting a partial composition result.\n * @param input The installed and actual runtime state to compare.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveMoldeaCliComposition = (\n input: IMoldeaCliCompositionStateInput,\n): IMoldeaCliCompositionResolution => {\n try {\n if (!isMoldeaCliCompositionStateValid(input)) {\n return INVALID_COMPOSITION_RESOLUTION;\n }\n\n return Object.freeze({\n kind: 'valid',\n result: createMoldeaCliCompositionResult(input),\n });\n } catch {\n return INVALID_COMPOSITION_RESOLUTION;\n }\n};\n\n/**\n * Resolves composition through the fixed package, Core, adapter, Git, and JSON composition.\n * @param input The installed package metadata.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveInstalledMoldeaCliComposition = (\n input: IMoldeaCliInstalledCompositionInput,\n): IMoldeaCliCompositionResolution =>\n resolveMoldeaCliComposition({\n activeAdapters: ACTIVE_RUNTIME_ADAPTERS,\n coreSupportedRepositoryFormatVersions: SUPPORTED_REPOSITORY_FORMAT_VERSIONS,\n minimumGitVersion: MINIMUM_GIT_VERSION,\n outputSchemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n packageMetadata: input.packageMetadata,\n });\n"],"mappings":";;;;;;AACA,IAAa,wCAAwC,OAAO,OAAO;CACjE;CACA;CACA;AACF,CAAU;AAGV,IAAa,oCAAoC;AACjD,IAAa,+BAA+B;AAG5C,IAAa,wCAAwC,OAAO,OAAO;CACjE,gCAAgC;CAChC,uCAAuC;CACvC,wCAAwC;CACxC,0BAA0B;CAC1B,mCAAmC;CACnC,gCAAgC;CAChC,gCAAgC;CAChC,6BAA6B;CAC7B,wCAAwC;CACxC,oCAAoC;CACpC,mBAAmB;CACnB,yBAAyB;CACzB,4BAA4B;AAC9B,CAA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AG,MAAM,qCAAqC,CAAC,CAAC,MACxE,MAAM,UAAU,OAAO,KAC1B;CACF,GACA,GAAG,MAAM,eAAe,KAAK,aAAa;EACxC,IAAI,QAAQ;EACZ,0BAA0B,CAAC,GAAG,QAAQ,iCAAiC,CAAC,CAAC,MACtE,MAAM,UAAU,OAAO,KAC1B;CACF,EAAE,CACJ,CAAC,CAAC,MAAM,MAAM,UAAU,mBAAmB,KAAK,IAAI,MAAM,EAAE,CAAC;CAC7D,MAAM,WAAW,OAAO,QAAQ,MAAM,gBAAgB,4BAA4B,CAAC,CAAC,CAAC,CAClF,KAAK,CAAC,MAAM,cAAc;EAAE;EAAM;CAAQ,EAAE,CAAC,CAC7C,MAAM,MAAM,UAAU,mBAAmB,KAAK,MAAM,MAAM,IAAI,CAAC;CAElE,OAAO,uBAAuB;EAC5B;EACA,mBAAmB,MAAM;EACzB;EACA,0BAA0B,CAAC,GAAG,MAAM,qCAAqC,CAAC,CAAC,MACxE,MAAM,UAAU,OAAO,KAC1B;EACA,oBAAoB,MAAM,gBAAgB,sBAAsB;CAClE,CAAC;AACH;;;ACxDA,IAAM,iCAAiC,OAAO,OAAO,EAAE,MAAM,UAAmB,CAAC;;;;;;AAOjF,IAAa,+BACX,UACoC;CACpC,IAAI;EACF,IAAI,CAAC,iCAAiC,KAAK,GACzC,OAAO;EAGT,OAAO,OAAO,OAAO;GACnB,MAAM;GACN,QAAQ,iCAAiC,KAAK;EAChD,CAAC;CACH,QAAQ;EACN,OAAO;CACT;AACF;;;;;;AAOA,IAAa,wCACX,UAEA,4BAA4B;CAC1B,gBAAgB;CAChB,uCAAuC;CACvC,mBAAmB;CACnB,qBAAA;CACA,iBAAiB,MAAM;AACzB,CAAC"}
package/dist/moldea.js CHANGED
@@ -4,9 +4,9 @@ import path from "node:path";
4
4
  import process from "node:process";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { createHash, timingSafeEqual } from "node:crypto";
7
+ import { REPOSITORY_ROOT, RepositorySourceException, createRepositoryComparison, isRepositoryPath, parseRepositoryPath } from "@moldea.ai/repository";
7
8
  import { lstat, readFile, readdir, stat } from "node:fs/promises";
8
9
  import { CoreConfigurationException, CoreOperationException, createCore } from "@moldea.ai/core";
9
- import { REPOSITORY_ROOT, RepositorySourceException, createRepositoryComparison, isRepositoryPath, parseRepositoryPath } from "@moldea.ai/repository";
10
10
  import { Buffer as Buffer$1 } from "node:buffer";
11
11
  import { createFilesystemRepositoryReader } from "@moldea.ai/repository-fs";
12
12
  //#region src/cli-execution/constants.ts
@@ -294,7 +294,7 @@ var parsePositiveSafeInteger = (input) => {
294
294
  const parsedInteger = Number(input);
295
295
  return Number.isSafeInteger(parsedInteger) && parsedInteger > 0 ? parsedInteger : null;
296
296
  };
297
- /** Parses one output byte budget inside the schema 4 transport bounds. */
297
+ /** Parses one output byte budget inside the schema 5 transport bounds. */
298
298
  var parseMoldeaCliOutputByteLimit = (input) => {
299
299
  const parsed = parsePositiveSafeInteger(input);
300
300
  return parsed !== null && parsed >= 4096 && parsed <= 1048576 ? parsed : null;
@@ -340,7 +340,7 @@ var isMoldeaCliCommand = (input) => {
340
340
  return input !== void 0 && COMMAND_NAMES.has(input);
341
341
  };
342
342
  /**
343
- * Parses the complete schema 4 command grammar without mutating caller arguments.
343
+ * Parses the complete schema 5 command grammar without mutating caller arguments.
344
344
  * @param commandLineArguments The process arguments after the executable path.
345
345
  * @returns A normalized command, informational request, or safe invocation error.
346
346
  */
@@ -552,7 +552,7 @@ var MOLDEA_CLI_ERROR_DEFINITIONS = Object.freeze({
552
552
  source: "cli"
553
553
  }),
554
554
  PATH_INPUT_INVALID: Object.freeze({
555
- message: "The NUL-delimited changed-path input is invalid.",
555
+ message: "The scope path input is invalid. Use leading-slash repository-logical paths and NUL-delimited UTF-8 on stdin.",
556
556
  retryable: false,
557
557
  source: "cli"
558
558
  }),
@@ -669,16 +669,16 @@ var createMoldeaCliOwnedError = (code) => {
669
669
  };
670
670
  //#endregion
671
671
  //#region src/json-output-contract/document.ts
672
- /** Creates one strict schema 4 JSON envelope. */
672
+ /** Creates one strict schema 5 JSON envelope. */
673
673
  var createMoldeaCliJsonEnvelope = (input) => Object.freeze({
674
674
  cliVersion: input.cliVersion,
675
675
  command: input.command,
676
676
  error: input.error,
677
677
  result: input.result,
678
- schemaVersion: 4,
678
+ schemaVersion: 5,
679
679
  status: input.status
680
680
  });
681
- /** Serializes one schema 4 envelope with its required trailing line feed. */
681
+ /** Serializes one schema 5 envelope with its required trailing line feed. */
682
682
  var serializeMoldeaCliJsonEnvelope = (input) => `${serializeJsonDeterministically(createMoldeaCliJsonEnvelope(input))}\n`;
683
683
  //#endregion
684
684
  //#region src/json-output-contract/guard.ts
@@ -725,11 +725,20 @@ var formatMoldeaCliHumanDiagnostic = (diagnostic) => {
725
725
  const lines = [`${diagnostic.source}:${diagnostic.code}${location} ${diagnostic.message}`];
726
726
  if (diagnostic.pointer !== null) lines.push(` pointer: ${diagnostic.pointer}`);
727
727
  if (diagnostic.entity !== null) lines.push(` entity: ${formatMoldeaCliHumanDiagnosticEntity(diagnostic.entity)}`);
728
+ if (diagnostic.severity === "warning") {
729
+ lines.push(` unverified relationship: ${diagnostic.details.relationship}`);
730
+ lines.push(` reason: ${diagnostic.details.reason.replaceAll("-", " ")}`);
731
+ if (diagnostic.details.reason === "version-dependent-behavior") {
732
+ lines.push(` package: ${diagnostic.details.packageName}`);
733
+ lines.push(` declared range: ${diagnostic.details.declaredRange ?? "unavailable"}`);
734
+ lines.push(` behavior boundary: ${diagnostic.details.boundaryVersion}`);
735
+ }
736
+ }
728
737
  return lines.join("\n");
729
738
  };
730
739
  /** Creates shared human status lines for one completed repository command. */
731
- var createMoldeaCliHumanStatusLines = (isValid, formatVersion) => {
732
- const lines = [`The moldea project is ${isValid ? "valid" : "invalid"}.`];
740
+ var createMoldeaCliHumanStatusLines = (isValid, formatVersion, warningCount = 0) => {
741
+ const lines = [`The moldea project is ${isValid ? warningCount > 0 ? "valid with warnings" : "valid" : "invalid"}.`];
733
742
  if (formatVersion !== null) lines.push(`Repository format: ${formatVersion}`);
734
743
  return lines;
735
744
  };
@@ -741,7 +750,7 @@ var formatMoldeaCliHelp = (command) => {
741
750
  };
742
751
  /** Formats one safe CLI error for human stderr output. */
743
752
  var formatMoldeaCliHumanError = (error) => `${error.source}:${error.code} ${error.message}\n`;
744
- /** Formats any strict schema 4 JSON envelope. */
753
+ /** Formats any strict schema 5 JSON envelope. */
745
754
  var formatMoldeaCliJsonResult = (command, result, error, status, cliVersion) => serializeMoldeaCliJsonEnvelope({
746
755
  cliVersion,
747
756
  command,
@@ -749,7 +758,7 @@ var formatMoldeaCliJsonResult = (command, result, error, status, cliVersion) =>
749
758
  result,
750
759
  status
751
760
  });
752
- /** Formats one safe schema 4 JSON error envelope. */
761
+ /** Formats one safe schema 5 JSON error envelope. */
753
762
  var formatMoldeaCliJsonError = (error, command, cliVersion) => formatMoldeaCliJsonResult(command, null, error, "error", cliVersion);
754
763
  /** Formats one valid composition result for human stdout. */
755
764
  var formatMoldeaCliHumanCompositionResult = (result, cliVersion) => {
@@ -757,7 +766,7 @@ var formatMoldeaCliHumanCompositionResult = (result, cliVersion) => {
757
766
  "The installed CLI composition state is valid.",
758
767
  `CLI version: ${cliVersion}`,
759
768
  `Supported Node.js: ${result.supportedNodeRange}`,
760
- `JSON output schema: 4`,
769
+ `JSON output schema: 5`,
761
770
  `Minimum Git: ${result.minimumGitVersion}`,
762
771
  `Repository formats: ${result.repositoryFormatVersions.join(", ")}`,
763
772
  "Packages:",
@@ -766,25 +775,27 @@ var formatMoldeaCliHumanCompositionResult = (result, cliVersion) => {
766
775
  ...result.adapters.map(({ id, repositoryFormatVersions }) => ` ${id}: repository formats ${repositoryFormatVersions.join(", ")}`)
767
776
  ].join("\n")}\n`;
768
777
  };
769
- /** Formats one composition result in the strict schema 4 envelope. */
778
+ /** Formats one composition result in the strict schema 5 envelope. */
770
779
  var formatMoldeaCliJsonCompositionResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Composition, result, null, "valid", cliVersion);
771
780
  /** Formats one completed validation result for human stdout. */
772
781
  var formatMoldeaCliHumanValidateResult = (result) => {
773
- const lines = createMoldeaCliHumanStatusLines(result.diagnosticCount === 0, result.formatVersion);
782
+ const lines = createMoldeaCliHumanStatusLines(result.valid, result.formatVersion, result.warningCount);
774
783
  for (const diagnostic of result.page.records) lines.push(formatMoldeaCliHumanDiagnostic(diagnostic));
775
784
  lines.push(formatMoldeaCliHumanCount(result.diagnosticCount, "Diagnostic", "Diagnostics"));
785
+ lines.push(formatMoldeaCliHumanCount(result.errorCount, "Error", "Errors"));
786
+ lines.push(formatMoldeaCliHumanCount(result.warningCount, "Warning", "Warnings"));
776
787
  if (result.page.cursor !== null) lines.push("Additional diagnostics are available through JSON pagination.");
777
788
  return `${lines.join("\n")}\n`;
778
789
  };
779
- /** Formats one validation result in the strict schema 4 envelope. */
790
+ /** Formats one validation result in the strict schema 5 envelope. */
780
791
  var formatMoldeaCliJsonValidateResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Validate, result, null, result.valid ? "valid" : "invalid", cliVersion);
781
792
  /** Formats one completed metadata inspection for human stdout. */
782
793
  var formatMoldeaCliHumanInspectResult = (result) => {
783
- const lines = createMoldeaCliHumanStatusLines(result.valid, result.formatVersion);
794
+ const lines = createMoldeaCliHumanStatusLines(result.valid, result.formatVersion, result.counts.warnings);
784
795
  for (const [label, count] of Object.entries(result.counts)) lines.push(`${label}: ${count}`);
785
796
  return `${lines.join("\n")}\n`;
786
797
  };
787
- /** Formats one metadata inspection in the strict schema 4 envelope. */
798
+ /** Formats one metadata inspection in the strict schema 5 envelope. */
788
799
  var formatMoldeaCliJsonInspectResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Inspect, result, null, result.valid ? "valid" : "invalid", cliVersion);
789
800
  /** Formats one changed-path scope result for human stdout. */
790
801
  var formatMoldeaCliHumanScopeResult = (result) => {
@@ -794,7 +805,7 @@ var formatMoldeaCliHumanScopeResult = (result) => {
794
805
  ...Object.entries(result.counts).map(([label, count]) => `${label}: ${count}`)
795
806
  ].join("\n")}\n`;
796
807
  };
797
- /** Formats one changed-path scope result in the strict schema 4 envelope. */
808
+ /** Formats one changed-path scope result in the strict schema 5 envelope. */
798
809
  var formatMoldeaCliJsonScopeResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Scope, result, null, result.valid ? "valid" : "invalid", cliVersion);
799
810
  /** Formats one explicit canonical content chunk for human stdout. */
800
811
  var formatMoldeaCliHumanContentResult = (result) => {
@@ -808,29 +819,53 @@ var formatMoldeaCliHumanContentResult = (result) => {
808
819
  result.chunk.content
809
820
  ].join("\n")}\n`;
810
821
  };
811
- /** Formats one explicit canonical content chunk in the strict schema 4 envelope. */
822
+ /** Formats one explicit canonical content chunk in the strict schema 5 envelope. */
812
823
  var formatMoldeaCliJsonContentResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Content, result, null, "valid", cliVersion);
813
824
  //#endregion
814
825
  //#region src/presentation/transformers.ts
815
826
  /** Rejects a Core validation result whose completion fields contradict its validity. */
816
827
  var assertProjectValidationInvariant = (validation) => {
817
- if (!(validation.valid ? validation.summary !== null && validation.diagnostics.length === 0 : validation.diagnostics.length > 0)) throw new TypeError("The Core validation result is internally inconsistent.");
828
+ const observedErrorCount = validation.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
829
+ if (!(Number.isSafeInteger(validation.errorCount) && Number.isSafeInteger(validation.warningCount) && validation.errorCount === observedErrorCount && validation.warningCount === validation.diagnostics.length - observedErrorCount && validation.valid === (validation.summary !== null && validation.errorCount === 0) && (validation.valid || validation.errorCount > 0))) throw new TypeError("The Core validation result is internally inconsistent.");
818
830
  };
819
831
  /** Creates one stable composite record key. */
820
832
  var createRecordKey = (kind, ...parts) => JSON.stringify([kind, ...parts]);
821
833
  /** Projects one diagnostic without retaining arbitrary detail payloads. */
822
- var createMoldeaCliDiagnosticRecord = (diagnostic, occurrence = 0) => Object.freeze({
823
- code: diagnostic.code,
824
- entity: diagnostic.entity,
825
- key: createRecordKey("diagnostic", diagnostic.source, diagnostic.code, diagnostic.path, diagnostic.pointer, occurrence),
826
- kind: "diagnostic",
827
- message: diagnostic.message,
828
- path: diagnostic.path,
829
- pointer: diagnostic.pointer,
830
- range: diagnostic.range,
831
- source: diagnostic.source
832
- });
833
- /** Projects one bounded Core inspection item through the schema 4 allowlist. */
834
+ var createMoldeaCliDiagnosticRecord = (diagnostic, occurrence = 0) => {
835
+ const record = {
836
+ code: diagnostic.code,
837
+ entity: diagnostic.entity,
838
+ key: createRecordKey("diagnostic", diagnostic.source, diagnostic.severity, diagnostic.code, diagnostic.path, diagnostic.pointer, diagnostic.severity === "warning" ? diagnostic.details : null, occurrence),
839
+ kind: "diagnostic",
840
+ message: diagnostic.message,
841
+ path: diagnostic.path,
842
+ pointer: diagnostic.pointer,
843
+ range: diagnostic.range,
844
+ source: diagnostic.source
845
+ };
846
+ if (diagnostic.severity === "warning") {
847
+ const details = diagnostic.details.reason === "version-dependent-behavior" ? Object.freeze({
848
+ boundaryVersion: diagnostic.details.boundaryVersion,
849
+ declaredRange: diagnostic.details.declaredRange,
850
+ packageName: diagnostic.details.packageName,
851
+ reason: diagnostic.details.reason,
852
+ relationship: diagnostic.details.relationship
853
+ }) : Object.freeze({
854
+ reason: diagnostic.details.reason,
855
+ relationship: diagnostic.details.relationship
856
+ });
857
+ return Object.freeze({
858
+ ...record,
859
+ details,
860
+ severity: "warning"
861
+ });
862
+ }
863
+ return Object.freeze({
864
+ ...record,
865
+ severity: "error"
866
+ });
867
+ };
868
+ /** Projects one bounded Core inspection item through the schema 5 allowlist. */
834
869
  var createInspectRecord = (item, index) => {
835
870
  const order = index.toString().padStart(6, "0");
836
871
  if (item.kind === "agent") {
@@ -844,7 +879,7 @@ var createInspectRecord = (item, index) => {
844
879
  }
845
880
  if (item.kind === "diagnostic") return Object.freeze({
846
881
  ...createMoldeaCliDiagnosticRecord(item.diagnostic, index),
847
- key: createRecordKey(order, "diagnostic", item.diagnostic.source, item.diagnostic.code)
882
+ key: createRecordKey(order, "diagnostic", item.diagnostic.source, item.diagnostic.severity, item.diagnostic.code, item.diagnostic.severity === "warning" ? item.diagnostic.details : null)
848
883
  });
849
884
  if (item.kind === "evidence") {
850
885
  const evidence = item.evidence;
@@ -885,19 +920,23 @@ var createMoldeaCliValidateProjection = (validation) => {
885
920
  const diagnostics = Object.freeze(validation.diagnostics.map((diagnostic, index) => createMoldeaCliDiagnosticRecord(diagnostic, index)).sort((left, right) => left.key < right.key ? -1 : left.key > right.key ? 1 : 0));
886
921
  const snapshotDigest = calculateMoldeaCliJsonDigest({
887
922
  diagnostics,
923
+ errorCount: validation.errorCount,
888
924
  formatVersion: validation.formatVersion,
889
925
  summary: validation.summary,
890
- valid: validation.valid
926
+ valid: validation.valid,
927
+ warningCount: validation.warningCount
891
928
  });
892
929
  return Object.freeze({
893
930
  diagnostics,
931
+ errorCount: validation.errorCount,
894
932
  formatVersion: validation.formatVersion,
895
933
  snapshotDigest,
896
934
  source: MOLDEA_CLI_GIT_WORKING_TREE_SOURCE,
897
- valid: validation.valid
935
+ valid: validation.valid,
936
+ warningCount: validation.warningCount
898
937
  });
899
938
  };
900
- /** Projects one bounded Core page through the content-free schema 4 allowlist. */
939
+ /** Projects one bounded Core page through the content-free schema 5 allowlist. */
901
940
  var createMoldeaCliInspectProjection = (inspection) => {
902
941
  const project = inspection.summary === null ? null : Object.freeze({
903
942
  manifest: Object.freeze({
@@ -1402,7 +1441,7 @@ var createMoldeaCliContentPage = (input) => {
1402
1441
  var MOLDEA_MANIFEST_PATH = parseRepositoryPath("/moldea/moldea.yaml");
1403
1442
  //#endregion
1404
1443
  //#region src/project-scope/exception.ts
1405
- /** Represents invalid NUL-delimited changed-path input owned by the CLI. */
1444
+ /** Represents invalid scope path input owned by the CLI. */
1406
1445
  var MoldeaCliProjectScopeException = class extends Error {
1407
1446
  code;
1408
1447
  /** Creates one scope-input failure with a stable public code. */
@@ -1420,7 +1459,7 @@ var MoldeaCliProjectScopeException = class extends Error {
1420
1459
  * @param maxEntries Maximum changed-path records accepted by the operation.
1421
1460
  * @returns Detached path strings in supplied order for Core validation and normalization.
1422
1461
  * @throws
1423
- * - PATH_INPUT_INVALID: The NUL-delimited changed-path input is invalid.
1462
+ * - PATH_INPUT_INVALID: The scope path input is invalid. Use leading-slash repository-logical paths and NUL-delimited UTF-8 on stdin.
1424
1463
  */
1425
1464
  var parseMoldeaCliScopePathBytes = (input, maxEntries) => {
1426
1465
  if (input.byteLength === 0) return Object.freeze([]);
@@ -3280,11 +3319,13 @@ var createMoldeaCliValidateExecutionResult = (inspection, cliVersion, isJson, cu
3280
3319
  const projection = createMoldeaCliValidateProjection(inspection);
3281
3320
  const createResult = (page) => ({
3282
3321
  diagnosticCount: projection.diagnostics.length,
3322
+ errorCount: projection.errorCount,
3283
3323
  formatVersion: projection.formatVersion,
3284
3324
  page,
3285
3325
  snapshotDigest: projection.snapshotDigest,
3286
3326
  source: projection.source,
3287
- valid: projection.valid
3327
+ valid: projection.valid,
3328
+ warningCount: projection.warningCount
3288
3329
  });
3289
3330
  const page = createMoldeaCliOutputPage({
3290
3331
  command: "validate",
@@ -3404,7 +3445,7 @@ var executeLazyCoreInspection = async (input) => {
3404
3445
  return executeMoldeaCliCoreInspection(input);
3405
3446
  };
3406
3447
  var loadInstalledComposition = async (input) => {
3407
- const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-By-2bWuu.js");
3448
+ const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-Ck3cXQUk.js");
3408
3449
  return resolveInstalledMoldeaCliComposition(input);
3409
3450
  };
3410
3451
  /** Creates one operational error result without exposing caught failure details. */
@@ -3417,7 +3458,7 @@ var createOperationalErrorResult = (code, input) => createMoldeaCliErrorResult(c
3417
3458
  * @param compositionLoader The installed executable-integrity composition boundary.
3418
3459
  * @param projectScopeExecutor The adapter-free manifest scope operation.
3419
3460
  * @param projectContentExecutor The adapter-free canonical content operation.
3420
- * @returns A command executor for the schema 4 CLI.
3461
+ * @returns A command executor for the schema 5 CLI.
3421
3462
  */
3422
3463
  var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingTree, workingTreeSnapshotExecutor = executeWorkingTreeSnapshot, coreInspectionExecutor = executeLazyCoreInspection, compositionLoader = loadInstalledComposition, projectScopeExecutor = executeMoldeaCliProjectScope, projectContentExecutor = executeMoldeaCliProjectContent) => {
3423
3464
  return async (input) => {
@@ -3443,6 +3484,7 @@ var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingT
3443
3484
  if (input.stdin.byteLength > options.resourceLimits.maxTotalBytes) return createOperationalErrorResult("RESOURCE_LIMIT_EXCEEDED", input);
3444
3485
  scopePaths = parseMoldeaCliScopePathBytes(input.stdin, options.resourceLimits.maxEntries);
3445
3486
  } else return createOperationalErrorResult("PATH_INPUT_INVALID", input);
3487
+ if (scopePaths.some((path) => !isRepositoryPath(path))) return createOperationalErrorResult("PATH_INPUT_INVALID", input);
3446
3488
  }
3447
3489
  if (command === MOLDEA_CLI_COMMANDS.Content) {
3448
3490
  if (options.path === null) return createOperationalErrorResult("CONTENT_PATH_INVALID", input);