@moldea.ai/cli 5.0.3 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,23 +4,26 @@
4
4
 
5
5
  The canonical read-only local command-line composition for deterministic inspection of `moldea` repositories.
6
6
 
7
- The package's version 5 surface provides the `moldea` executable with the version 1 command grammar and version 2 JSON envelope. It includes deterministic help and version output, resource-limit validation, safe human or JSON errors, Git-owned working-tree discovery, bounded strict tracked/untracked candidate probing, submodule and nested-repository ownership filtering, deterministic stage collapse, no-follow current entry-type normalization, bounded effective `core.symlinks` resolution, portable logical-path normalization with exact Unicode code-point ordering, bounded effective Git content-transformation classification, exact-path Repository FS construction, private immutable reader wrappers for materialized Git symlinks and guarded regular-file reads, bounded whole-operation snapshot stabilization, attempt-local Core execution, safe Repository/Core operational-error translation, operation-scoped process-signal cancellation, deterministic content-minimized `validate` human and JSON results, concise content-free `inspect` human summaries, complete Core-result `inspect` JSON output, command-wide installation-integrity verification, and compact deterministic `composition` human and JSON reporting.
7
+ The version 6 executable exposes one schema-3-only JSON contract. `inspect` returns allowlisted metadata instead of canonical bodies, `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
- Version 5 bundles Anthropic adapter `2.0.6`, whose client-tool names must match `^[A-Za-z0-9_-]{1,64}$`.
9
+ Version 6 bundles Anthropic adapter `2.0.6`, whose client-tool names must match `^[A-Za-z0-9_-]{1,64}$`.
10
10
 
11
- Tarball, installed-bin, and cross-repository skill checks remain the release boundary for every published version.
11
+ Tarball, installed-bin, runtime, and testing-peer checks remain the package release boundary.
12
12
 
13
13
  ## Commands
14
14
 
15
- The version 1 command names are:
15
+ The command names are:
16
16
 
17
17
  ```text
18
18
  moldea validate
19
19
  moldea inspect
20
+ moldea scope --path /src/example.ts
21
+ moldea scope --paths-stdin
22
+ moldea content --path /moldea/project.md
20
23
  moldea composition
21
24
  ```
22
25
 
23
- The foundation fully supports top-level and command-specific help, `moldea --version`, strict option validation, and usage failures. It discovers a selected working tree, pins its filesystem and Git identity, probes its raw tracked and non-ignored untracked candidates, excludes submodule and nested-repository-only content, collapses index stages by exact path, omits absent paths, classifies every remaining current file or symlink without following the leaf, derives its effective Git content-transformation state, converts the surviving records into deterministically sorted repository logical paths, retries a complete provisional reader operation when the source changes, and runs Core through the accepted reader. `validate` and `inspect` return completed valid and structurally invalid results. `composition` reports the installed executable and exact package composition without discovering a repository.
26
+ The executable supports top-level and command-specific help, `moldea --version`, strict option validation, and deterministic usage failures. Repository-backed commands discover and pin a Git working tree, use a no-follow exact-path reader, and retry complete provisional operations when the selected source changes. `validate` and `inspect` run the full Core and adapter composition. `scope` and `content` do not load or verify adapters and limit Git inventory to the manifest or requested canonical path. `composition` reports installed executable state without discovering a repository.
24
27
 
25
28
  ## Package boundary
26
29
 
@@ -46,17 +49,17 @@ The package declares `preferUnplugged: true` so Yarn Plug'n'Play materializes th
46
49
 
47
50
  The executable derives its composition state from its installed manifest, actually resolved first-class package versions, active adapter singletons, Core repository-format constants, minimum Git constant, and JSON output schema constant. It carries no Runtime Compatibility Matrix or target-maturity snapshot.
48
51
 
49
- The executable performs no network requests, telemetry, repository writes, or configured Git content transformations. `validate` and `inspect` use read-only Git operations and no-follow filesystem metadata inspection to discover a working tree, establish and verify its identity, normalize the selected inventory, construct an exact-path guarded filesystem reader, and run Core within at most three complete snapshot attempts. Help, version, and usage failures do not run the installation-integrity preflight. `composition` and that preflight do not invoke Git, a filesystem repository reader, a client manifest, or Core inspection; the preflight reads installed package manifests and compares them with the actual adapter and Core composition.
52
+ The executable performs no network requests, telemetry, repository writes, configured Git content transformations, temporary-index operations, or object-writing Git commands. Repository-backed commands use read-only Git and no-follow filesystem observations within at most three complete snapshot attempts. Help, version, and usage failures do not run the installation-integrity preflight. `composition` and that preflight do not invoke Git, a filesystem repository reader, a client manifest, or Core inspection; the preflight reads installed package manifests and compares them with the actual adapter and Core composition.
50
53
 
51
54
  ## Runtime support
52
55
 
53
- The version 1 consumer runtime range is:
56
+ The consumer runtime range is:
54
57
 
55
58
  ```text
56
59
  >=22.11.0
57
60
  ```
58
61
 
59
- The package is Node.js-specific. `validate` and `inspect` require Git `2.30.0` or later; commands compare the numeric Git version and accept standard platform or vendor suffixes.
62
+ The package is Node.js-specific. `validate`, `inspect`, `scope`, and `content` require Git `2.30.0` or later; commands compare the numeric Git version and accept standard platform or vendor suffixes.
60
63
 
61
64
  ## Git working-tree discovery and normalized inventory
62
65
 
@@ -64,7 +67,7 @@ The starting directory is the invocation directory unless `--repository <path>`
64
67
 
65
68
  Git runs directly without a platform shell, with fixed non-interactive arguments and a sanitized deterministic environment. Version output is limited to 4096 bytes per stream, and each discovery output stream is limited to 262144 bytes. Discovery requires Git `2.30.0` or later and rejects missing or inaccessible paths, nonrepositories, bare repositories, Git-directory paths without a usable work tree, malformed Git output, and sparse checkouts before inventory probing begins.
66
69
 
67
- After discovery, `validate` and `inspect` stream NUL-delimited tracked-index and non-ignored untracked records from fixed `git ls-files` commands. Tracked records accept only full SHA-1 or SHA-256 object IDs, index stages `0` through `3`, and Git modes `100644`, `100755`, `120000`, or `160000`. Paths are decoded as fatal UTF-8 and preserve exact Unicode scalars, case, tabs, newlines, and an initial BOM without normalization.
70
+ After discovery, `validate` and `inspect` stream NUL-delimited tracked-index and non-ignored untracked records from fixed `git ls-files` commands. `scope` applies a top-level literal pathspec for `/moldea/moldea.yaml`; `content` applies one for its validated canonical path. These selected commands do not probe the rest of a large repository. Tracked records accept only full SHA-1 or SHA-256 object IDs, index stages `0` through `3`, and Git modes `100644`, `100755`, `120000`, or `160000`. Paths are decoded as fatal UTF-8 and preserve exact Unicode scalars, case, tabs, newlines, and an initial BOM without normalization.
68
71
 
69
72
  Raw tracked and untracked records share `maxEntries` before ownership filtering, stage collapse, or deduplication. Their combined stdout, nested-root validation stdout, any required effective `core.symlinks` stdout, and effective Git attribute stdout share `maxTotalBytes`, while stderr has a separate fixed 4096-byte diagnostic ceiling per Git command and is never emitted. Exceeding an inventory ceiling discards all candidates and returns the non-retryable `cli:RESOURCE_LIMIT_EXCEEDED` contract with message `A resource limit was exceeded.` Malformed output returns `git:GIT_OUTPUT_INVALID` without a partial inventory or partial attribute classification.
70
73
 
@@ -84,7 +87,7 @@ Git attribute inspection never invokes configured filters, Git LFS, clean or smu
84
87
 
85
88
  The CLI passes the complete normalized logical path set to `@moldea.ai/repository-fs` exact-path selection, so the filesystem reader synthesizes required parent directories without admitting unrelated files. `maxEntries` and `maxFileBytes` retain their filesystem meanings, while the CLI's `maxTotalBytes` becomes the reader's `maxCachedBytes` limit. The private immutable overlay then maps materialized Git symlink host files to `type: 'symlink'` in exact lookup and listing, rejects their reads with the common non-retryable `ENTRY_NOT_FILE` contract, and never calls the underlying `readFile` for those paths. The content-transformation guard wraps that logical view so symlink semantics take precedence. Missing or contradictory wrapper entries fail with `INVALID_SOURCE_DATA`.
86
89
 
87
- Before attempting a snapshot, the CLI pins the selected root directory, its worktree-specific Git directory, and its shared Git common directory by absolute host path plus nonzero device and inode identity. Linked worktrees therefore retain distinct worktree identity while sharing the expected common repository identity. Each attempt verifies the complete pin, derives normalized inventories before and after exact-path reader creation, and runs its provisional operation only when both inventories match exactly, including entry type, retained index stages, symlink-overlay state, and content-transformation classification.
90
+ Before attempting a snapshot, the CLI pins the selected root directory, its worktree-specific Git directory, and its shared Git common directory by absolute host path plus nonzero device and inode identity. Linked worktrees therefore retain distinct worktree identity while sharing the expected common repository identity. Each attempt verifies the complete pin, derives normalized full or path-selected inventories before and after exact-path reader creation, and runs its provisional operation only when both inventories match exactly, including entry type, retained index stages, symlink-overlay state, and content-transformation classification.
88
91
 
89
92
  The CLI retries the complete provisional attempt for differing inventories, Repository FS `SNAPSHOT_CHANGED` failures, and reader-creation missing-entry or parent-type failures when a fresh inventory proves the source changed. It recreates the inventory, reader, wrappers, operation state, and filesystem resource budget for every retry and never reuses provisional bytes or results. Three total attempts are allowed. Exhaustion or a changed pinned identity returns `cli:WORKING_TREE_UNSTABLE` with message `The working tree did not remain stable.` and `retryable: true`.
90
93
 
@@ -94,13 +97,17 @@ Known `RepositorySourceException`, `CoreConfigurationException`, and `CoreOperat
94
97
 
95
98
  ## Cancellation and process signals
96
99
 
97
- The executable owns one operation-scoped `AbortController`. `validate` and `inspect` pass its signal through every Git child process, working-tree snapshot step, Repository FS creation, repository read, Core inspection, and adapter invocation. `SIGINT` and `SIGTERM` abort the active operation, prevent another snapshot retry, discard an unwritten result, and exit with code `130` and `143`, respectively. The first received signal determines the exit code. A signal received after output has been completely written does not alter the completed result.
100
+ The executable owns one operation-scoped `AbortController`. Repository-backed commands pass its signal through every Git child process, working-tree snapshot step, Repository FS creation, repository read, Core operation, and any applicable adapter invocation. `SIGINT` and `SIGTERM` abort the active operation, prevent another snapshot retry, discard an unwritten result, and exit with code `130` and `143`, respectively. The first received signal determines the exit code. A signal received after output has been completely written does not alter the completed result.
98
101
 
99
102
  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.
100
103
 
101
- A successfully completed Core inspection produces `validate` human or JSON output without exposing the project index, canonical content, or adapter evidence. Zero diagnostics return status `valid` and exit code `0`; one or more diagnostics preserve Core order, return status `invalid`, and exit with code `1`.
104
+ 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.
102
105
 
103
- `inspect` uses the same completion status and exit codes. Valid human output reports the repository format and counts for context assets, decisions, runtime-guidance assets, agents, mirrors, and adapter evidence items without printing canonical content. Invalid human output uses the same ordered diagnostic presentation as `validate` and reports non-empty adapter evidence counts without exposing evidence details. `inspect --json` preserves the complete Core `IProjectInspectionResult`, including the deeply immutable project index and its canonical normalized content when valid, and writes it only to stdout inside the deterministic version 2 envelope. This JSON output may contain confidential project context, decisions, runtime guidance, descriptions, and instructions; callers must protect captured output.
106
+ `inspect` uses the same completion status and exit codes. Human output reports the repository format and complete collection counts. JSON output contains only allowlisted metadata records: identifiers, logical paths, digests, scalar and UTF-8 lengths, references, relationships, requirements, diagnostics without arbitrary details, and evidence summaries without adapter detail payloads. 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.
107
+
108
+ `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.
109
+
110
+ 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.
104
111
 
105
112
  ## Installed composition and integrity
106
113
 
@@ -108,7 +115,7 @@ Before `validate`, `inspect`, or `composition` produces a result, the executable
108
115
 
109
116
  `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).
110
117
 
111
- Successful human and JSON reports use exit code `0`; JSON uses status `valid` and the version 2 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.
118
+ Successful human and JSON reports use exit code `0`; JSON uses status `valid` and the schema 3 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.
112
119
 
113
120
  ## Development
114
121
 
@@ -125,6 +132,6 @@ pnpm --filter @moldea.ai/cli test
125
132
 
126
133
  Unit, integration, and end-to-end tests are colocated with their owning modules. The end-to-end suite installs real package tarballs and executes the resulting package bin without requiring any `@moldea.ai/*` package to be published. It verifies command, output, exit, security, package-content, process-signal, and repository-immutability behavior at the consumer boundary.
127
134
 
128
- CI separately packs Repository, Repository FS, Core, every active package-backed adapter, and CLI and installs them with npm scripts disabled and strict engine validation on Node.js `22.11.0`, latest Node.js 22, Node.js `24.11.0`, and latest Node.js 24, and Node.js `26.8.1`. Dedicated runtime harnesses verify each adapter's installed inspection boundary and the CLI's installed identities plus real `version`, `composition`, `validate`, and `inspect` execution. Linux owns this consumer-runtime matrix, while the complete repository tests continue to run on Linux, macOS, and Windows.
135
+ CI separately packs Repository, Repository FS, Core, every active package-backed adapter, and CLI and installs them with npm scripts disabled and strict engine validation on Node.js `22.11.0`, latest Node.js 22, Node.js `24.11.0`, latest Node.js 24, and Node.js `26.8.1`. Dedicated runtime harnesses verify each adapter's installed inspection boundary and the CLI's installed identities plus real `version`, `composition`, `validate`, `inspect`, `scope`, and `content` execution. Linux owns this consumer-runtime matrix, while the complete repository tests continue to run on Linux, macOS, and Windows.
129
136
 
130
137
  Every active package-backed adapter has its own repository fixtures, package tests, packed-runtime consumer check, and verified compatibility claim. Qualification execution remains outside this repository; targets with a committed skill profile may publish its canonical evidence URL through the compatibility matrix.
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env node
2
+ import { r as MINIMUM_GIT_VERSION, t as require_semver } from "./semver-BzaJzKRS.js";
3
+ import { r as ACTIVE_RUNTIME_ADAPTERS } from "./core-composition-sKWsd1Aj.js";
4
+ import { SUPPORTED_REPOSITORY_FORMAT_VERSIONS } from "@moldea.ai/core";
5
+ //#region src/composition/constants.ts
6
+ var import_semver = require_semver();
7
+ var MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES = Object.freeze([
8
+ "@moldea.ai/core",
9
+ "@moldea.ai/repository",
10
+ "@moldea.ai/repository-fs"
11
+ ]);
12
+ var MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX = "@moldea.ai/adapter-";
13
+ var MOLDEA_CLI_CUSTOM_ADAPTER_ID = "custom";
14
+ //#endregion
15
+ //#region src/composition/validations.ts
16
+ var ADAPTER_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
17
+ var hasExactStringSet = (left, right) => {
18
+ if (left.length !== right.length || new Set(left).size !== left.length || new Set(right).size !== right.length) return false;
19
+ const rightValues = new Set(right);
20
+ return left.every((entry) => rightValues.has(entry));
21
+ };
22
+ var hasUniquePositiveIntegers = (entries) => entries.length > 0 && entries.every((entry) => Number.isSafeInteger(entry) && entry > 0) && new Set(entries).size === entries.length;
23
+ var createActiveAdapterMap = (adapters, coreRepositoryFormatVersions) => {
24
+ const adapterMap = /* @__PURE__ */ new Map();
25
+ for (const adapter of adapters) {
26
+ if (adapterMap.has(adapter.id) || adapter.id === "custom" || !ADAPTER_ID_PATTERN.test(adapter.id) || !hasUniquePositiveIntegers(adapter.supportedRepositoryFormatVersions) || adapter.supportedRepositoryFormatVersions.some((version) => !coreRepositoryFormatVersions.includes(version))) return null;
27
+ adapterMap.set(adapter.id, adapter);
28
+ }
29
+ return adapterMap;
30
+ };
31
+ /**
32
+ * Verifies the installed package manifest and actual executable adapter composition.
33
+ * @param input The installed package, Core, adapter, Git, and JSON-schema state.
34
+ * @returns Whether every runtime composition invariant is satisfied.
35
+ */
36
+ var isMoldeaCliCompositionStateValid = (input) => {
37
+ const { dependencies, installedPackageVersions, supportedNodeRange, version } = input.packageMetadata;
38
+ if ((0, import_semver.valid)(version) === null || supportedNodeRange === null || (0, import_semver.validRange)(supportedNodeRange) === null || (0, import_semver.valid)(input.minimumGitVersion) === null || input.outputSchemaVersion !== 3 || dependencies === null || installedPackageVersions === null || !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)) return false;
39
+ const activeAdapterMap = createActiveAdapterMap(input.activeAdapters, input.coreSupportedRepositoryFormatVersions);
40
+ if (activeAdapterMap === null) return false;
41
+ const expectedPackageNames = [...MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES, ...[...activeAdapterMap.keys()].map((adapterId) => `${MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX}${adapterId}`)];
42
+ const declaredPackageNames = Object.keys(dependencies).filter((packageName) => packageName.startsWith("@moldea.ai/"));
43
+ const resolvedPackageNames = Object.keys(installedPackageVersions);
44
+ if (!hasExactStringSet(declaredPackageNames, expectedPackageNames) || !hasExactStringSet(resolvedPackageNames, expectedPackageNames)) return false;
45
+ return expectedPackageNames.every((packageName) => {
46
+ const resolvedVersion = installedPackageVersions[packageName];
47
+ const declaredVersion = dependencies[packageName];
48
+ return resolvedVersion !== void 0 && (0, import_semver.valid)(resolvedVersion) !== null && (declaredVersion === resolvedVersion || declaredVersion === `workspace:${resolvedVersion}`);
49
+ });
50
+ };
51
+ //#endregion
52
+ //#region src/composition/transformers.ts
53
+ var compareIdentifiers = (left, right) => left < right ? -1 : left > right ? 1 : 0;
54
+ /** Recursively freezes a composition result without retaining mutable input ownership. */
55
+ var freezeCompositionValue = (value) => {
56
+ const pendingValues = [value];
57
+ const visitedValues = /* @__PURE__ */ new Set();
58
+ while (pendingValues.length > 0) {
59
+ const currentValue = pendingValues.pop();
60
+ if (currentValue === void 0 || visitedValues.has(currentValue)) continue;
61
+ visitedValues.add(currentValue);
62
+ for (const nestedValue of Object.values(currentValue)) if (typeof nestedValue === "object" && nestedValue !== null) pendingValues.push(nestedValue);
63
+ Object.freeze(currentValue);
64
+ }
65
+ return value;
66
+ };
67
+ /**
68
+ * Creates the compact immutable composition result from validated installed state.
69
+ * @param input The already validated installed and executable composition.
70
+ * @returns A deeply immutable composition result in deterministic report order.
71
+ */
72
+ var createMoldeaCliCompositionResult = (input) => {
73
+ const adapters = [{
74
+ id: MOLDEA_CLI_CUSTOM_ADAPTER_ID,
75
+ repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort((left, right) => left - right)
76
+ }, ...input.activeAdapters.map((adapter) => ({
77
+ id: adapter.id,
78
+ repositoryFormatVersions: [...adapter.supportedRepositoryFormatVersions].sort((left, right) => left - right)
79
+ }))].sort((left, right) => compareIdentifiers(left.id, right.id));
80
+ const packages = Object.entries(input.packageMetadata.installedPackageVersions ?? {}).map(([name, version]) => ({
81
+ name,
82
+ version
83
+ })).sort((left, right) => compareIdentifiers(left.name, right.name));
84
+ return freezeCompositionValue({
85
+ adapters,
86
+ minimumGitVersion: input.minimumGitVersion,
87
+ packages,
88
+ repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort((left, right) => left - right),
89
+ supportedNodeRange: input.packageMetadata.supportedNodeRange ?? ""
90
+ });
91
+ };
92
+ //#endregion
93
+ //#region src/composition/composition.ts
94
+ var INVALID_COMPOSITION_RESOLUTION = Object.freeze({ kind: "invalid" });
95
+ /**
96
+ * Resolves one explicit runtime composition without emitting a partial composition result.
97
+ * @param input The installed and actual runtime state to compare.
98
+ * @returns A valid immutable result or the single invalid-state outcome.
99
+ */
100
+ var resolveMoldeaCliComposition = (input) => {
101
+ try {
102
+ if (!isMoldeaCliCompositionStateValid(input)) return INVALID_COMPOSITION_RESOLUTION;
103
+ return Object.freeze({
104
+ kind: "valid",
105
+ result: createMoldeaCliCompositionResult(input)
106
+ });
107
+ } catch {
108
+ return INVALID_COMPOSITION_RESOLUTION;
109
+ }
110
+ };
111
+ /**
112
+ * Resolves composition through the fixed package, Core, adapter, Git, and JSON composition.
113
+ * @param input The installed package metadata.
114
+ * @returns A valid immutable result or the single invalid-state outcome.
115
+ */
116
+ var resolveInstalledMoldeaCliComposition = (input) => resolveMoldeaCliComposition({
117
+ activeAdapters: ACTIVE_RUNTIME_ADAPTERS,
118
+ coreSupportedRepositoryFormatVersions: SUPPORTED_REPOSITORY_FORMAT_VERSIONS,
119
+ minimumGitVersion: MINIMUM_GIT_VERSION,
120
+ outputSchemaVersion: 3,
121
+ packageMetadata: input.packageMetadata
122
+ });
123
+ //#endregion
124
+ export { resolveInstalledMoldeaCliComposition };
125
+
126
+ //# sourceMappingURL=composition-CIrgnSN8.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition-CIrgnSN8.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","import { 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_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 !== 3 ||\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 declaredVersion = dependencies[packageName];\n\n return (\n resolvedVersion !== undefined &&\n isValidVersion(resolvedVersion) !== null &&\n (declaredVersion === resolvedVersion || declaredVersion === `workspace:${resolvedVersion}`)\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":"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"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { n as executeMoldeaCliCoreInspection } from "./core-composition-sKWsd1Aj.js";
3
+ export { executeMoldeaCliCoreInspection };
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ import { createCore } from "@moldea.ai/core";
3
+ import { anthropicAdapter } from "@moldea.ai/adapter-anthropic";
4
+ import { claudeAgentSdkAdapter } from "@moldea.ai/adapter-claude-agent-sdk";
5
+ import { cloudflareAgentsAdapter } from "@moldea.ai/adapter-cloudflare-agents";
6
+ import { eveAdapter } from "@moldea.ai/adapter-eve";
7
+ import { googleGenAiAdapter } from "@moldea.ai/adapter-google-genai";
8
+ import { langChainAdapter } from "@moldea.ai/adapter-langchain";
9
+ import { langGraphAdapter } from "@moldea.ai/adapter-langgraph";
10
+ import { openAiAdapter } from "@moldea.ai/adapter-openai";
11
+ import { openAiAgentsSdkAdapter } from "@moldea.ai/adapter-openai-agents-sdk";
12
+ import { vercelAiSdkAdapter } from "@moldea.ai/adapter-vercel-ai-sdk";
13
+ //#region src/core-composition/constants.ts
14
+ var ACTIVE_RUNTIME_ADAPTERS = Object.freeze([
15
+ anthropicAdapter,
16
+ claudeAgentSdkAdapter,
17
+ cloudflareAgentsAdapter,
18
+ eveAdapter,
19
+ googleGenAiAdapter,
20
+ langChainAdapter,
21
+ langGraphAdapter,
22
+ openAiAdapter,
23
+ openAiAgentsSdkAdapter,
24
+ vercelAiSdkAdapter
25
+ ]);
26
+ //#endregion
27
+ //#region src/core-composition/executor.ts
28
+ var compareAdapterIds = (left, right) => {
29
+ if (left.id < right.id) return -1;
30
+ if (left.id > right.id) return 1;
31
+ return 0;
32
+ };
33
+ /**
34
+ * Creates the private attempt-local Core composition boundary.
35
+ * @param coreFactory The immutable Core construction boundary.
36
+ * @param activeAdapters The package-backed adapters active in this CLI release.
37
+ * @returns An executor that creates and runs a fresh Core instance per snapshot attempt.
38
+ */
39
+ var createMoldeaCliCoreInspectionExecutor = (coreFactory = createCore, activeAdapters = ACTIVE_RUNTIME_ADAPTERS) => {
40
+ const normalizedAdapters = Object.freeze([...activeAdapters].sort(compareAdapterIds));
41
+ return async (input) => {
42
+ return coreFactory({
43
+ adapters: normalizedAdapters,
44
+ limits: Object.freeze({
45
+ maxDiagnostics: input.resourceLimits.maxDiagnostics,
46
+ maxEntries: input.resourceLimits.maxEntries,
47
+ maxEvidence: input.resourceLimits.maxEvidence,
48
+ maxFileBytes: input.resourceLimits.maxFileBytes,
49
+ maxManifestBytes: input.resourceLimits.maxManifestBytes,
50
+ maxTotalBytesRead: input.resourceLimits.maxTotalBytes
51
+ })
52
+ }).inspectProject({
53
+ repository: input.repository,
54
+ ...input.signal === void 0 ? {} : { signal: input.signal }
55
+ });
56
+ };
57
+ };
58
+ /**
59
+ * Executes one project inspection through a fresh CLI-configured Core instance.
60
+ * @returns A promise resolving to Core's complete immutable inspection result.
61
+ * @throws
62
+ * - DUPLICATE_ADAPTER_ID: A runtime adapter ID is registered more than once.
63
+ * - RESERVED_ADAPTER_ID: A reserved runtime adapter ID was supplied.
64
+ * - INVALID_ADAPTER_DEFINITION: A runtime adapter definition is invalid.
65
+ * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.
66
+ * - INVALID_ARGUMENT: The Core operation received an invalid argument.
67
+ * - INVALID_REPOSITORY_PATH: A repository path is invalid.
68
+ * - ENTRY_NOT_FOUND: A discovered file disappeared from the reader snapshot.
69
+ * - ENTRY_NOT_FILE: A discovered file changed type during inspection.
70
+ * - ENTRY_NOT_DIRECTORY: A discovered directory changed type during inspection.
71
+ * - ACCESS_DENIED: Access to the repository source was denied.
72
+ * - SOURCE_UNAVAILABLE: The repository source is unavailable.
73
+ * - SNAPSHOT_CHANGED: The repository snapshot changed during inspection.
74
+ * - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.
75
+ * - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.
76
+ * - ABORTED: Project inspection or a repository operation was aborted.
77
+ * - ADAPTER_EXECUTION_FAILED: A runtime adapter failed or returned an invalid result.
78
+ */
79
+ var executeMoldeaCliCoreInspection = createMoldeaCliCoreInspectionExecutor();
80
+ //#endregion
81
+ export { executeMoldeaCliCoreInspection as n, ACTIVE_RUNTIME_ADAPTERS as r, createMoldeaCliCoreInspectionExecutor as t };
82
+
83
+ //# sourceMappingURL=core-composition-sKWsd1Aj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-composition-sKWsd1Aj.js","names":[],"sources":["../../src/core-composition/constants.ts","../../src/core-composition/executor.ts"],"sourcesContent":["import type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\nimport { anthropicAdapter } from '@moldea.ai/adapter-anthropic';\nimport { claudeAgentSdkAdapter } from '@moldea.ai/adapter-claude-agent-sdk';\nimport { cloudflareAgentsAdapter } from '@moldea.ai/adapter-cloudflare-agents';\nimport { eveAdapter } from '@moldea.ai/adapter-eve';\nimport { googleGenAiAdapter } from '@moldea.ai/adapter-google-genai';\nimport { langChainAdapter } from '@moldea.ai/adapter-langchain';\nimport { langGraphAdapter } from '@moldea.ai/adapter-langgraph';\nimport { openAiAdapter } from '@moldea.ai/adapter-openai';\nimport { openAiAgentsSdkAdapter } from '@moldea.ai/adapter-openai-agents-sdk';\nimport { vercelAiSdkAdapter } from '@moldea.ai/adapter-vercel-ai-sdk';\n\n// package-backed runtime adapters active in this CLI release\nexport const ACTIVE_RUNTIME_ADAPTERS: readonly IRuntimeAdapter[] = Object.freeze([\n anthropicAdapter,\n claudeAgentSdkAdapter,\n cloudflareAgentsAdapter,\n eveAdapter,\n googleGenAiAdapter,\n langChainAdapter,\n langGraphAdapter,\n openAiAdapter,\n openAiAgentsSdkAdapter,\n vercelAiSdkAdapter,\n]);\n","import { createCore } from '@moldea.ai/core';\nimport type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\n\nimport { ACTIVE_RUNTIME_ADAPTERS } from './constants.js';\nimport type { IMoldeaCliCoreFactory, IMoldeaCliCoreInspectionExecutor } from './types.js';\n\nconst compareAdapterIds = (left: IRuntimeAdapter, right: IRuntimeAdapter): number => {\n if (left.id < right.id) {\n return -1;\n }\n\n if (left.id > right.id) {\n return 1;\n }\n\n return 0;\n};\n\n/**\n * Creates the private attempt-local Core composition boundary.\n * @param coreFactory The immutable Core construction boundary.\n * @param activeAdapters The package-backed adapters active in this CLI release.\n * @returns An executor that creates and runs a fresh Core instance per snapshot attempt.\n */\nexport const createMoldeaCliCoreInspectionExecutor = (\n coreFactory: IMoldeaCliCoreFactory = createCore,\n activeAdapters: readonly IRuntimeAdapter[] = ACTIVE_RUNTIME_ADAPTERS,\n): IMoldeaCliCoreInspectionExecutor => {\n const normalizedAdapters = Object.freeze([...activeAdapters].sort(compareAdapterIds));\n\n return async (input) => {\n const core = coreFactory({\n adapters: normalizedAdapters,\n limits: Object.freeze({\n maxDiagnostics: input.resourceLimits.maxDiagnostics,\n maxEntries: input.resourceLimits.maxEntries,\n maxEvidence: input.resourceLimits.maxEvidence,\n maxFileBytes: input.resourceLimits.maxFileBytes,\n maxManifestBytes: input.resourceLimits.maxManifestBytes,\n maxTotalBytesRead: input.resourceLimits.maxTotalBytes,\n }),\n });\n\n return core.inspectProject({\n repository: input.repository,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n };\n};\n\n/**\n * Executes one project inspection through a fresh CLI-configured Core instance.\n * @returns A promise resolving to Core's complete immutable inspection result.\n * @throws\n * - DUPLICATE_ADAPTER_ID: A runtime adapter ID is registered more than once.\n * - RESERVED_ADAPTER_ID: A reserved runtime adapter ID was supplied.\n * - INVALID_ADAPTER_DEFINITION: A runtime adapter definition is invalid.\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - INVALID_REPOSITORY_PATH: A repository path is invalid.\n * - ENTRY_NOT_FOUND: A discovered file disappeared from the reader snapshot.\n * - ENTRY_NOT_FILE: A discovered file changed type during inspection.\n * - ENTRY_NOT_DIRECTORY: A discovered directory changed type during inspection.\n * - ACCESS_DENIED: Access to the repository source was denied.\n * - SOURCE_UNAVAILABLE: The repository source is unavailable.\n * - SNAPSHOT_CHANGED: The repository snapshot changed during inspection.\n * - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.\n * - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.\n * - ABORTED: Project inspection or a repository operation was aborted.\n * - ADAPTER_EXECUTION_FAILED: A runtime adapter failed or returned an invalid result.\n */\nexport const executeMoldeaCliCoreInspection = createMoldeaCliCoreInspectionExecutor();\n"],"mappings":";;;;;;;;;;;;;AAaA,IAAa,0BAAsD,OAAO,OAAO;CAC/E;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;AClBD,IAAM,qBAAqB,MAAuB,UAAmC;CACnF,IAAI,KAAK,KAAK,MAAM,IAClB,OAAO;CAGT,IAAI,KAAK,KAAK,MAAM,IAClB,OAAO;CAGT,OAAO;AACT;;;;;;;AAQA,IAAa,yCACX,cAAqC,YACrC,iBAA6C,4BACR;CACrC,MAAM,qBAAqB,OAAO,OAAO,CAAC,GAAG,cAAc,CAAC,CAAC,KAAK,iBAAiB,CAAC;CAEpF,OAAO,OAAO,UAAU;EAatB,OAZa,YAAY;GACvB,UAAU;GACV,QAAQ,OAAO,OAAO;IACpB,gBAAgB,MAAM,eAAe;IACrC,YAAY,MAAM,eAAe;IACjC,aAAa,MAAM,eAAe;IAClC,cAAc,MAAM,eAAe;IACnC,kBAAkB,MAAM,eAAe;IACvC,mBAAmB,MAAM,eAAe;GAC1C,CAAC;EACH,CAEO,CAAA,CAAK,eAAe;GACzB,YAAY,MAAM;GAClB,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;EAC/D,CAAC;CACH;AACF;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,iCAAiC,sCAAsC"}