@moldea.ai/cli 11.0.6 → 12.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 +6 -4
- package/dist/chunks/{composition-BkoXoPOQ.js → composition-8VLm2c-X.js} +1 -1
- package/dist/chunks/{composition-Bb9UaGLi.js → composition-DX66KnuP.js} +4 -4
- package/dist/chunks/{composition-Bb9UaGLi.js.map → composition-DX66KnuP.js.map} +1 -1
- package/dist/chunks/{core-composition-SPqzv6Kz.js → core-composition-Bbpu62TT.js} +3 -2
- package/dist/chunks/core-composition-Bbpu62TT.js.map +1 -0
- package/dist/moldea.js +175 -20
- package/dist/moldea.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunks/core-composition-SPqzv6Kz.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { o as MoldeaCliCompositionException, t as resolveInstalledMoldeaCliComposition } from "./composition-
|
|
2
|
+
import { o as MoldeaCliCompositionException, t as resolveInstalledMoldeaCliComposition } from "./composition-DX66KnuP.js";
|
|
3
3
|
import { createNodeProjectInspection } from "@moldea.ai/core/node";
|
|
4
4
|
//#region src/core-composition/executor.ts
|
|
5
5
|
var calculateRetainedByteLimit = (maxTotalBytes) => maxTotalBytes > Math.floor(Number.MAX_SAFE_INTEGER / 4) ? Number.MAX_SAFE_INTEGER : maxTotalBytes * 4;
|
|
@@ -11,6 +11,7 @@ var calculateRetainedByteLimit = (maxTotalBytes) => maxTotalBytes > Math.floor(N
|
|
|
11
11
|
var createMoldeaCliCoreInspectionExecutor = (nodeInspectionFactory = createNodeProjectInspection) => async (input) => {
|
|
12
12
|
const inspection = await nodeInspectionFactory({
|
|
13
13
|
repository: input.repository,
|
|
14
|
+
...input.instructions === void 0 ? {} : { instructions: input.instructions },
|
|
14
15
|
limits: {
|
|
15
16
|
maxDiagnostics: input.resourceLimits.maxDiagnostics,
|
|
16
17
|
maxEntries: input.resourceLimits.maxEntries,
|
|
@@ -90,4 +91,4 @@ var executeMoldeaCliCoreInspection = createMoldeaCliCoreInspectionExecutor();
|
|
|
90
91
|
//#endregion
|
|
91
92
|
export { executeMoldeaCliCoreInspection };
|
|
92
93
|
|
|
93
|
-
//# sourceMappingURL=core-composition-
|
|
94
|
+
//# sourceMappingURL=core-composition-Bbpu62TT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-composition-Bbpu62TT.js","names":[],"sources":["../../src/core-composition/executor.ts"],"sourcesContent":["import type { IDiagnostic, IProjectValidationResult, IBindingCoverage } from '@moldea.ai/core';\nimport { createNodeProjectInspection } from '@moldea.ai/core/node';\n\nimport {\n MoldeaCliCompositionException,\n resolveInstalledMoldeaCliComposition,\n} from '../composition/index.js';\n\nimport type { IMoldeaCliCoreInspectionExecutor, IMoldeaCliNodeInspectionFactory } from './types.js';\n\nconst calculateRetainedByteLimit = (maxTotalBytes: number): number =>\n maxTotalBytes > Math.floor(Number.MAX_SAFE_INTEGER / 4)\n ? Number.MAX_SAFE_INTEGER\n : maxTotalBytes * 4;\n\n/**\n * Creates one isolated inspection per snapshot attempt, with no in-process fallback.\n * @param nodeInspectionFactory The supervised Node inspection boundary.\n * @returns An executor that disposes its worker before returning any successful result.\n */\nexport const createMoldeaCliCoreInspectionExecutor =\n (\n nodeInspectionFactory: IMoldeaCliNodeInspectionFactory = createNodeProjectInspection,\n ): IMoldeaCliCoreInspectionExecutor =>\n async (input) => {\n const inspection = await nodeInspectionFactory({\n repository: input.repository,\n ...(input.instructions === undefined ? {} : { instructions: input.instructions }),\n limits: {\n maxDiagnostics: input.resourceLimits.maxDiagnostics,\n maxEntries: input.resourceLimits.maxEntries,\n maxCoverage: input.resourceLimits.maxCoverage,\n maxFileBytes: input.resourceLimits.maxFileBytes,\n maxManifestBytes: input.resourceLimits.maxManifestBytes,\n maxRetainedBytes: calculateRetainedByteLimit(input.resourceLimits.maxTotalBytes),\n maxTotalBytesRead: input.resourceLimits.maxTotalBytes,\n },\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n try {\n if (\n resolveInstalledMoldeaCliComposition({\n packageMetadata: input.packageMetadata,\n }).kind === 'invalid'\n )\n throw new MoldeaCliCompositionException();\n if (input.command === 'inspect')\n return await inspection.readPage({\n ...(input.cursor === undefined ? {} : { cursor: input.cursor }),\n maxItems: Math.min(256, input.resourceLimits.maxEntries),\n view: 'all',\n });\n const diagnostics: IDiagnostic[] = [];\n const coverage: IBindingCoverage[] = [];\n for (const view of ['diagnostics', 'coverage'] as const) {\n let cursor: string | undefined;\n do {\n const result = await inspection.readPage({\n view,\n maxItems: Math.min(256, input.resourceLimits.maxEntries),\n ...(cursor === undefined ? {} : { cursor }),\n });\n for (const { item } of result.page.records) {\n if (item.kind === 'diagnostic') diagnostics.push(item.diagnostic);\n else if (item.kind === 'coverage') coverage.push(item.coverage);\n }\n cursor = result.page.nextCursor ?? undefined;\n } while (cursor !== undefined);\n }\n return Object.freeze({\n diagnostics: Object.freeze(diagnostics),\n coverage: Object.freeze(coverage),\n coverageCounts: inspection.coverageCounts,\n diagnosticCount: inspection.counts.diagnostics,\n acceptedWarningCount: inspection.counts.acceptedWarnings,\n errorCount: inspection.counts.errors,\n warningCount: inspection.counts.warnings,\n valid: inspection.valid,\n formatVersion: inspection.formatVersion,\n source: inspection.source,\n summary: inspection.summary,\n } satisfies IProjectValidationResult);\n } finally {\n await inspection.dispose();\n }\n };\n\n/**\n * Executes one project inspection through the isolated CLI-configured Node boundary.\n * @returns A promise resolving to Core's complete immutable inspection result.\n * @throws\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - ENTRY_NOT_FOUND: The requested repository entry was not found.\n * - ENTRY_NOT_FILE: The requested repository entry is not a file.\n * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.\n * - INVALID_PAGE_REQUEST: The repository page request is invalid.\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 the operation.\n * - PROVIDER_INCOMPLETE: The repository provider cannot expose a complete result.\n * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n * - ABORTED: The Core operation was aborted.\n * - INSPECTION_BUSY: Project inspection capacity is busy. Try again shortly.\n * - INSPECTION_TIMEOUT: The isolated project inspection timed out.\n * - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.\n * - COMPOSITION_STATE_INVALID: The installed composition state is invalid.\n */\nexport const executeMoldeaCliCoreInspection = createMoldeaCliCoreInspectionExecutor();\n"],"mappings":";;;;AAUA,IAAM,8BAA8B,kBAClC,gBAAgB,KAAK,MAAM,OAAO,mBAAmB,CAAC,IAClD,OAAO,mBACP,gBAAgB;;;;;;AAOtB,IAAa,yCAET,wBAAyD,gCAE3D,OAAO,UAAU;CACf,MAAM,aAAa,MAAM,sBAAsB;EAC7C,YAAY,MAAM;EAClB,GAAI,MAAM,iBAAiB,KAAA,IAAY,CAAC,IAAI,EAAE,cAAc,MAAM,aAAa;EAC/E,QAAQ;GACN,gBAAgB,MAAM,eAAe;GACrC,YAAY,MAAM,eAAe;GACjC,aAAa,MAAM,eAAe;GAClC,cAAc,MAAM,eAAe;GACnC,kBAAkB,MAAM,eAAe;GACvC,kBAAkB,2BAA2B,MAAM,eAAe,aAAa;GAC/E,mBAAmB,MAAM,eAAe;EAC1C;EACA,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;CAC/D,CAAC;CACD,IAAI;EACF,IACE,qCAAqC,EACnC,iBAAiB,MAAM,gBACzB,CAAC,CAAC,CAAC,SAAS,WAEZ,MAAM,IAAI,8BAA8B;EAC1C,IAAI,MAAM,YAAY,WACpB,OAAO,MAAM,WAAW,SAAS;GAC/B,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;GAC7D,UAAU,KAAK,IAAI,KAAK,MAAM,eAAe,UAAU;GACvD,MAAM;EACR,CAAC;EACH,MAAM,cAA6B,CAAC;EACpC,MAAM,WAA+B,CAAC;EACtC,KAAK,MAAM,QAAQ,CAAC,eAAe,UAAU,GAAY;GACvD,IAAI;GACJ,GAAG;IACD,MAAM,SAAS,MAAM,WAAW,SAAS;KACvC;KACA,UAAU,KAAK,IAAI,KAAK,MAAM,eAAe,UAAU;KACvD,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;IAC3C,CAAC;IACD,KAAK,MAAM,EAAE,UAAU,OAAO,KAAK,SACjC,IAAI,KAAK,SAAS,cAAc,YAAY,KAAK,KAAK,UAAU;SAC3D,IAAI,KAAK,SAAS,YAAY,SAAS,KAAK,KAAK,QAAQ;IAEhE,SAAS,OAAO,KAAK,cAAc,KAAA;GACrC,SAAS,WAAW,KAAA;EACtB;EACA,OAAO,OAAO,OAAO;GACnB,aAAa,OAAO,OAAO,WAAW;GACtC,UAAU,OAAO,OAAO,QAAQ;GAChC,gBAAgB,WAAW;GAC3B,iBAAiB,WAAW,OAAO;GACnC,sBAAsB,WAAW,OAAO;GACxC,YAAY,WAAW,OAAO;GAC9B,cAAc,WAAW,OAAO;GAChC,OAAO,WAAW;GAClB,eAAe,WAAW;GAC1B,QAAQ,WAAW;GACnB,SAAS,WAAW;EACtB,CAAoC;CACtC,UAAU;EACR,MAAM,WAAW,QAAQ;CAC3B;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BF,IAAa,iCAAiC,sCAAsC"}
|
package/dist/moldea.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as hasOnlyUnicodeScalarValues$1, C as formatMoldeaCliJsonError, D as createMoldeaCliOwnedError, E as formatMoldeaCliJsonValidateResult, F as encodeMoldeaCliCursor, I as MoldeaCliOutputPageException, L as MOLDEA_CLI_COMMANDS, M as createMoldeaCliOutputPage, N as calculateMoldeaCliJsonDigest, O as MOLDEA_CLI_GIT_WORKING_TREE_SOURCE, P as decodeMoldeaCliCursor, S as formatMoldeaCliJsonContentResult, T as formatMoldeaCliJsonScopeResult, _ as formatMoldeaCliHumanError, a as require_semver, b as formatMoldeaCliHumanValidateResult, c as executeGitStreamingProcess, d as createMoldeaCliDiagnosticRecord, f as createMoldeaCliInspectProjection, g as formatMoldeaCliHumanContentResult, h as formatMoldeaCliHumanCompositionResult, j as isRepositoryDirectoryInputValid, k as parseMoldeaCliArguments, l as executeGitProcess, m as formatMoldeaCliHelp, o as MoldeaCliCompositionException, p as createMoldeaCliValidateProjection, s as createGitVersionPreflight, u as MAX_GIT_PROCESS_DIAGNOSTIC_BYTES, v as formatMoldeaCliHumanInspectResult, w as formatMoldeaCliJsonInspectResult, x as formatMoldeaCliJsonCompositionResult, y as formatMoldeaCliHumanScopeResult } from "./chunks/composition-
|
|
2
|
+
import { A as hasOnlyUnicodeScalarValues$1, C as formatMoldeaCliJsonError, D as createMoldeaCliOwnedError, E as formatMoldeaCliJsonValidateResult, F as encodeMoldeaCliCursor, I as MoldeaCliOutputPageException, L as MOLDEA_CLI_COMMANDS, M as createMoldeaCliOutputPage, N as calculateMoldeaCliJsonDigest, O as MOLDEA_CLI_GIT_WORKING_TREE_SOURCE, P as decodeMoldeaCliCursor, S as formatMoldeaCliJsonContentResult, T as formatMoldeaCliJsonScopeResult, _ as formatMoldeaCliHumanError, a as require_semver, b as formatMoldeaCliHumanValidateResult, c as executeGitStreamingProcess, d as createMoldeaCliDiagnosticRecord, f as createMoldeaCliInspectProjection, g as formatMoldeaCliHumanContentResult, h as formatMoldeaCliHumanCompositionResult, j as isRepositoryDirectoryInputValid, k as parseMoldeaCliArguments, l as executeGitProcess, m as formatMoldeaCliHelp, o as MoldeaCliCompositionException, p as createMoldeaCliValidateProjection, s as createGitVersionPreflight, u as MAX_GIT_PROCESS_DIAGNOSTIC_BYTES, v as formatMoldeaCliHumanInspectResult, w as formatMoldeaCliJsonInspectResult, x as formatMoldeaCliJsonCompositionResult, y as formatMoldeaCliHumanScopeResult } from "./chunks/composition-DX66KnuP.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { REPOSITORY_ROOT, RepositorySourceException, createRepositoryComparison, isRepositoryPath, parseRepositoryPath } from "@moldea.ai/repository";
|
|
6
|
+
import { REPOSITORY_LINK_TEXT_MAX_BYTES, REPOSITORY_ROOT, RepositorySourceException, createRepositoryComparison, isRepositoryPath, parseRepositoryPath } from "@moldea.ai/repository";
|
|
7
7
|
import { lstat, readFile, readdir, stat } from "node:fs/promises";
|
|
8
8
|
import { CoreConfigurationException, CoreOperationException, createCore } from "@moldea.ai/core";
|
|
9
9
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
@@ -767,6 +767,25 @@ var GitContentTransformationGuardRepositoryReader = class {
|
|
|
767
767
|
throw new GitContentTransformUnsupportedException(parsedPath);
|
|
768
768
|
}
|
|
769
769
|
/**
|
|
770
|
+
* Reads a link's stored text unchanged, because Git applies no content transformation to links.
|
|
771
|
+
* @param path The validated repository path of the symlink entry.
|
|
772
|
+
* @param options Optional cancellation controls.
|
|
773
|
+
* @returns A promise resolving to the text, or `null` past 4096 UTF-8 bytes or for invalid UTF-8.
|
|
774
|
+
* @throws
|
|
775
|
+
* - INVALID_REPOSITORY_PATH: The repository path is invalid.
|
|
776
|
+
* - ENTRY_NOT_FOUND: The requested repository entry was not found.
|
|
777
|
+
* - ENTRY_NOT_LINK: The requested repository entry is not a symlink.
|
|
778
|
+
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
779
|
+
* - SOURCE_UNAVAILABLE: The repository source is unavailable.
|
|
780
|
+
* - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
|
|
781
|
+
* - INVALID_SOURCE_DATA: The repository source returned invalid data.
|
|
782
|
+
* - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.
|
|
783
|
+
* - ABORTED: The repository operation was aborted.
|
|
784
|
+
*/
|
|
785
|
+
readLinkText(path, options) {
|
|
786
|
+
return this.#reader.readLinkText(path, options);
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
770
789
|
* Recursively lists entries without changing the underlying logical inventory.
|
|
771
790
|
* @param options Optional prefix and cancellation controls.
|
|
772
791
|
* @returns The underlying async iterable of detached repository entries.
|
|
@@ -816,6 +835,7 @@ var REPOSITORY_SOURCE_ERROR_MESSAGES = Object.freeze({
|
|
|
816
835
|
ENTRY_NOT_DIRECTORY: "The requested repository entry is not a directory.",
|
|
817
836
|
ENTRY_NOT_FILE: "The requested repository entry is not a file.",
|
|
818
837
|
ENTRY_NOT_FOUND: "The requested repository entry was not found.",
|
|
838
|
+
ENTRY_NOT_LINK: "The requested repository entry is not a symlink.",
|
|
819
839
|
INVALID_PAGE_REQUEST: "The repository page request is invalid.",
|
|
820
840
|
INVALID_SOURCE_DATA: "The repository source returned invalid data.",
|
|
821
841
|
PROVIDER_INCOMPLETE: "The repository provider could not expose a complete result.",
|
|
@@ -905,6 +925,22 @@ var GIT_UNTRACKED_INVENTORY_ARGUMENTS = [
|
|
|
905
925
|
"-z",
|
|
906
926
|
"--"
|
|
907
927
|
];
|
|
928
|
+
var GIT_IGNORED_INVENTORY_ARGUMENTS = [
|
|
929
|
+
"ls-files",
|
|
930
|
+
"--others",
|
|
931
|
+
"--ignored",
|
|
932
|
+
"--exclude-standard",
|
|
933
|
+
"--full-name",
|
|
934
|
+
"--no-recurse-submodules",
|
|
935
|
+
"-z",
|
|
936
|
+
"--"
|
|
937
|
+
];
|
|
938
|
+
var INSTRUCTION_PATHS = Object.freeze([
|
|
939
|
+
"/AGENTS.md",
|
|
940
|
+
"/CLAUDE.md",
|
|
941
|
+
"/.claude/CLAUDE.md",
|
|
942
|
+
"/CLAUDE.local.md"
|
|
943
|
+
].map((path) => parseRepositoryPath(path)));
|
|
908
944
|
//#endregion
|
|
909
945
|
//#region src/git-inventory/content-transformation/constants.ts
|
|
910
946
|
var GIT_CONTENT_TRANSFORMATION_ATTRIBUTES = [
|
|
@@ -2017,25 +2053,55 @@ var createGitInventoryProbe = (processExecutor = executeGitStreamingProcess, own
|
|
|
2017
2053
|
if (untrackedProcessResult.stderr.byteLength > 0) return createProbeFailure("GIT_OUTPUT_INVALID");
|
|
2018
2054
|
const untrackedCandidates = resolveParserResult(untrackedParser.finish());
|
|
2019
2055
|
if (isProbeFailure(untrackedCandidates)) return untrackedCandidates;
|
|
2020
|
-
|
|
2056
|
+
let ignoredCandidates = [];
|
|
2057
|
+
let ignoredStdoutBytes = 0;
|
|
2058
|
+
if (input.includeIgnored === true && selectionPathspecs.length > 0) {
|
|
2059
|
+
const ignoredParser = createUntrackedGitInventoryParser(input.maxEntries - trackedCandidates.length - untrackedCandidates.length);
|
|
2060
|
+
const ignoredProcessResult = await processExecutor({
|
|
2061
|
+
arguments: [
|
|
2062
|
+
"-C",
|
|
2063
|
+
input.repositoryRoot,
|
|
2064
|
+
...GIT_IGNORED_INVENTORY_ARGUMENTS,
|
|
2065
|
+
...selectionPathspecs
|
|
2066
|
+
],
|
|
2067
|
+
consumeStdout: (chunk) => ignoredParser.consume(chunk),
|
|
2068
|
+
maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,
|
|
2069
|
+
maxStdoutBytes: input.maxMetadataBytes - trackedProcessResult.stdoutBytes - untrackedProcessResult.stdoutBytes,
|
|
2070
|
+
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2071
|
+
});
|
|
2072
|
+
if (ignoredProcessResult.kind === "failed") return createProbeFailure(mapGitProcessFailure(ignoredProcessResult.reason));
|
|
2073
|
+
if (ignoredProcessResult.stderr.byteLength > 0) return createProbeFailure("GIT_OUTPUT_INVALID");
|
|
2074
|
+
const parsedIgnoredCandidates = resolveParserResult(ignoredParser.finish());
|
|
2075
|
+
if (isProbeFailure(parsedIgnoredCandidates)) return parsedIgnoredCandidates;
|
|
2076
|
+
const untrackedPaths = new Set(untrackedCandidates.map((candidate) => candidate.path));
|
|
2077
|
+
ignoredCandidates = parsedIgnoredCandidates.filter((candidate) => !untrackedPaths.has(candidate.path));
|
|
2078
|
+
ignoredStdoutBytes = ignoredProcessResult.stdoutBytes;
|
|
2079
|
+
}
|
|
2080
|
+
const candidates = Object.freeze([
|
|
2081
|
+
...trackedCandidates,
|
|
2082
|
+
...untrackedCandidates,
|
|
2083
|
+
...ignoredCandidates
|
|
2084
|
+
]);
|
|
2085
|
+
const metadataBytesAfterListing = input.maxMetadataBytes - trackedProcessResult.stdoutBytes - untrackedProcessResult.stdoutBytes - ignoredStdoutBytes;
|
|
2086
|
+
const logicalPathFilterResult = filterGitInventoryCandidateLogicalPaths({ candidates });
|
|
2021
2087
|
if (logicalPathFilterResult.kind === "failed") return logicalPathFilterResult;
|
|
2022
2088
|
const ownershipResult = await ownershipFilter({
|
|
2023
2089
|
candidates: logicalPathFilterResult.candidates,
|
|
2024
|
-
maxMetadataBytes:
|
|
2090
|
+
maxMetadataBytes: metadataBytesAfterListing,
|
|
2025
2091
|
repositoryRoot: input.repositoryRoot,
|
|
2026
2092
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2027
2093
|
});
|
|
2028
2094
|
if (ownershipResult.kind === "failed") return ownershipResult;
|
|
2029
2095
|
const entryTypeResult = await entryTypeNormalizer({
|
|
2030
2096
|
candidates: ownershipResult.candidates,
|
|
2031
|
-
maxMetadataBytes:
|
|
2097
|
+
maxMetadataBytes: metadataBytesAfterListing - ownershipResult.gitMetadataBytes,
|
|
2032
2098
|
repositoryRoot: input.repositoryRoot,
|
|
2033
2099
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2034
2100
|
});
|
|
2035
2101
|
if (entryTypeResult.kind === "failed") return entryTypeResult;
|
|
2036
2102
|
const contentTransformationResult = await contentTransformationClassifier({
|
|
2037
2103
|
entries: entryTypeResult.entries,
|
|
2038
|
-
maxMetadataBytes:
|
|
2104
|
+
maxMetadataBytes: metadataBytesAfterListing - ownershipResult.gitMetadataBytes - entryTypeResult.gitMetadataBytes,
|
|
2039
2105
|
repositoryRoot: input.repositoryRoot,
|
|
2040
2106
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2041
2107
|
});
|
|
@@ -2072,6 +2138,10 @@ var areGitInventoriesEqual = (left, right) => left.length === right.length && le
|
|
|
2072
2138
|
});
|
|
2073
2139
|
//#endregion
|
|
2074
2140
|
//#region src/repository-symlink-overlay/reader.ts
|
|
2141
|
+
var decoder = new TextDecoder("utf-8", {
|
|
2142
|
+
fatal: true,
|
|
2143
|
+
ignoreBOM: true
|
|
2144
|
+
});
|
|
2075
2145
|
/** Throws the common cancellation contract for wrapper-owned operations. */
|
|
2076
2146
|
var throwIfAborted = (signal, operation, path) => {
|
|
2077
2147
|
if (!signal?.aborted) return;
|
|
@@ -2166,6 +2236,47 @@ var GitSymlinkOverlayRepositoryReader = class {
|
|
|
2166
2236
|
});
|
|
2167
2237
|
}
|
|
2168
2238
|
/**
|
|
2239
|
+
* Reads a link's stored text. A Git link checked out as a plain file holds exactly the text Git
|
|
2240
|
+
* stored, so its bounded bytes are that text; other paths read the underlying reader.
|
|
2241
|
+
* @param path The validated repository path of the symlink entry.
|
|
2242
|
+
* @param options Optional cancellation controls.
|
|
2243
|
+
* @returns A promise resolving to the text, or `null` past 4096 UTF-8 bytes or for invalid UTF-8.
|
|
2244
|
+
* @throws
|
|
2245
|
+
* - INVALID_REPOSITORY_PATH: The repository path is invalid.
|
|
2246
|
+
* - ENTRY_NOT_FOUND: The requested repository entry was not found.
|
|
2247
|
+
* - ENTRY_NOT_LINK: The requested repository entry is not a symlink.
|
|
2248
|
+
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
2249
|
+
* - SOURCE_UNAVAILABLE: The repository source is unavailable.
|
|
2250
|
+
* - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.
|
|
2251
|
+
* - INVALID_SOURCE_DATA: The repository source returned invalid data.
|
|
2252
|
+
* - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.
|
|
2253
|
+
* - ABORTED: The repository operation was aborted.
|
|
2254
|
+
*/
|
|
2255
|
+
async readLinkText(path, options) {
|
|
2256
|
+
const parsedPath = parseRepositoryPath(path);
|
|
2257
|
+
if (!this.#overlayPaths.has(parsedPath)) return this.#reader.readLinkText(parsedPath, options);
|
|
2258
|
+
throwIfAborted(options?.signal, "read-link-text", parsedPath);
|
|
2259
|
+
const entry = await this.#reader.getEntry(parsedPath, options);
|
|
2260
|
+
validateOverlayEntry(entry, "read-link-text", parsedPath);
|
|
2261
|
+
throwIfAborted(options?.signal, "read-link-text", parsedPath);
|
|
2262
|
+
const byteLength = entry?.byteLength ?? null;
|
|
2263
|
+
if (byteLength === null) throw createInvalidOverlayException("read-link-text", parsedPath);
|
|
2264
|
+
if (byteLength > REPOSITORY_LINK_TEXT_MAX_BYTES) return null;
|
|
2265
|
+
if (byteLength === 0) return "";
|
|
2266
|
+
const page = await this.#reader.readFilePage(parsedPath, {
|
|
2267
|
+
maxBytes: byteLength,
|
|
2268
|
+
offset: 0,
|
|
2269
|
+
...options?.signal === void 0 ? {} : { signal: options.signal }
|
|
2270
|
+
});
|
|
2271
|
+
throwIfAborted(options?.signal, "read-link-text", parsedPath);
|
|
2272
|
+
if (!page.isComplete || page.totalBytes !== byteLength || page.bytes.byteLength !== byteLength) throw createInvalidOverlayException("read-link-text", parsedPath);
|
|
2273
|
+
try {
|
|
2274
|
+
return decoder.decode(page.bytes);
|
|
2275
|
+
} catch {
|
|
2276
|
+
return null;
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
/**
|
|
2169
2280
|
* Recursively lists descendants while replacing configured host files with logical symlinks.
|
|
2170
2281
|
* @param options Optional prefix and cancellation controls.
|
|
2171
2282
|
* @returns An async iterable of detached logical entries.
|
|
@@ -2229,14 +2340,8 @@ var createGitSymlinkOverlayRepositoryReader = (reader, symlinkPaths) => {
|
|
|
2229
2340
|
};
|
|
2230
2341
|
//#endregion
|
|
2231
2342
|
//#region src/repository-reader/factory.ts
|
|
2232
|
-
/**
|
|
2233
|
-
|
|
2234
|
-
* @param filesystemReaderFactory The exact-path filesystem snapshot factory.
|
|
2235
|
-
* @param symlinkOverlayFactory The logical Git symlink overlay factory.
|
|
2236
|
-
* @param contentTransformationGuardFactory The guarded logical regular-file reader factory.
|
|
2237
|
-
* @returns A factory that composes one coherent selected working-tree reader.
|
|
2238
|
-
*/
|
|
2239
|
-
var createWorkingTreeRepositoryReaderFactory = (filesystemReaderFactory = createFilesystemRepositoryReader, symlinkOverlayFactory = createGitSymlinkOverlayRepositoryReader, contentTransformationGuardFactory = createGitContentTransformationGuardRepositoryReader) => async (input) => {
|
|
2343
|
+
/** Composes the filesystem, Git symlink overlay, and content-transformation guard layers. */
|
|
2344
|
+
var composeWorkingTreeReader = async (input, filesystemReaderFactory, symlinkOverlayFactory, contentTransformationGuardFactory) => {
|
|
2240
2345
|
const selectedPaths = Object.freeze(input.entries.map((entry) => entry.path));
|
|
2241
2346
|
const symlinkOverlayPaths = Object.freeze(input.entries.reduce((paths, entry) => {
|
|
2242
2347
|
if (entry.requiresSymlinkOverlay) paths.push(entry.path);
|
|
@@ -2262,7 +2367,25 @@ var createWorkingTreeRepositoryReaderFactory = (filesystemReaderFactory = create
|
|
|
2262
2367
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2263
2368
|
}), symlinkOverlayPaths), guardedPaths);
|
|
2264
2369
|
};
|
|
2370
|
+
/**
|
|
2371
|
+
* Creates the private working-tree reader factory around injectable composition boundaries.
|
|
2372
|
+
* @param filesystemReaderFactory The exact-path filesystem snapshot factory.
|
|
2373
|
+
* @param symlinkOverlayFactory The logical Git symlink overlay factory.
|
|
2374
|
+
* @param contentTransformationGuardFactory The guarded logical regular-file reader factory.
|
|
2375
|
+
* @returns A factory that composes one coherent selected working-tree reader.
|
|
2376
|
+
*/
|
|
2377
|
+
var createWorkingTreeRepositoryReaderFactory = (filesystemReaderFactory = createFilesystemRepositoryReader, symlinkOverlayFactory = createGitSymlinkOverlayRepositoryReader, contentTransformationGuardFactory = createGitContentTransformationGuardRepositoryReader) => (input) => composeWorkingTreeReader(input, filesystemReaderFactory, symlinkOverlayFactory, contentTransformationGuardFactory);
|
|
2265
2378
|
var createWorkingTreeRepositoryReader = createWorkingTreeRepositoryReaderFactory();
|
|
2379
|
+
/**
|
|
2380
|
+
* Creates the instruction-source factory: an exact-path reader for the probed instruction
|
|
2381
|
+
* entries, with the same layers as the repository reader.
|
|
2382
|
+
* @param filesystemReaderFactory The exact-path filesystem snapshot factory.
|
|
2383
|
+
* @param symlinkOverlayFactory The logical Git symlink overlay factory.
|
|
2384
|
+
* @param contentTransformationGuardFactory The guarded logical regular-file reader factory.
|
|
2385
|
+
* @returns A factory that composes one coherent instruction reader.
|
|
2386
|
+
*/
|
|
2387
|
+
var createWorkingTreeInstructionSourceFactory = (filesystemReaderFactory = createFilesystemRepositoryReader, symlinkOverlayFactory = createGitSymlinkOverlayRepositoryReader, contentTransformationGuardFactory = createGitContentTransformationGuardRepositoryReader) => (input) => composeWorkingTreeReader(input, filesystemReaderFactory, symlinkOverlayFactory, contentTransformationGuardFactory);
|
|
2388
|
+
var createWorkingTreeInstructionSource = createWorkingTreeInstructionSourceFactory();
|
|
2266
2389
|
//#endregion
|
|
2267
2390
|
//#region src/working-tree-snapshot/executor.ts
|
|
2268
2391
|
/** Creates one immutable terminal snapshot failure. */
|
|
@@ -2282,9 +2405,10 @@ var isPinnedIdentityUnavailable = (errorCode) => errorCode === "GIT_REPOSITORY_N
|
|
|
2282
2405
|
* @param inventoryProbe The complete normalized Git inventory probe.
|
|
2283
2406
|
* @param repositoryReaderFactory The exact-path guarded reader factory.
|
|
2284
2407
|
* @param compareInventories The exact normalized inventory comparator.
|
|
2408
|
+
* @param instructionSourceFactory The instruction-source composition over instruction entries.
|
|
2285
2409
|
* @returns An executor that discards and retries complete provisional attempts.
|
|
2286
2410
|
*/
|
|
2287
|
-
var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTreeIdentity, inventoryProbe = probeGitInventory, repositoryReaderFactory = createWorkingTreeRepositoryReader, compareInventories = areGitInventoriesEqual) => {
|
|
2411
|
+
var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTreeIdentity, inventoryProbe = probeGitInventory, repositoryReaderFactory = createWorkingTreeRepositoryReader, compareInventories = areGitInventoriesEqual, instructionSourceFactory = createWorkingTreeInstructionSource) => {
|
|
2288
2412
|
const executeSnapshot = async (input) => {
|
|
2289
2413
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2290
2414
|
const repositoryRoot = input.repositoryRoot;
|
|
@@ -2307,6 +2431,18 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2307
2431
|
});
|
|
2308
2432
|
return result.kind === "failed" ? createSnapshotFailure(result.errorCode) : result;
|
|
2309
2433
|
};
|
|
2434
|
+
const probeInstructions = async () => {
|
|
2435
|
+
if (input.includeInstructions !== true) return null;
|
|
2436
|
+
const result = await inventoryProbe({
|
|
2437
|
+
includeIgnored: true,
|
|
2438
|
+
maxEntries: resourceLimits.maxEntries,
|
|
2439
|
+
maxMetadataBytes: resourceLimits.maxTotalBytes,
|
|
2440
|
+
repositoryRoot,
|
|
2441
|
+
selectionPaths: INSTRUCTION_PATHS,
|
|
2442
|
+
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2443
|
+
});
|
|
2444
|
+
return result.kind === "failed" ? createSnapshotFailure(result.errorCode) : result;
|
|
2445
|
+
};
|
|
2310
2446
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
2311
2447
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2312
2448
|
const currentIdentityResult = await identityInspector({
|
|
@@ -2319,7 +2455,11 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2319
2455
|
const firstInventoryResult = await probeInventory();
|
|
2320
2456
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2321
2457
|
if (firstInventoryResult.kind === "failed") return firstInventoryResult;
|
|
2458
|
+
const firstInstructionResult = await probeInstructions();
|
|
2459
|
+
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2460
|
+
if (firstInstructionResult?.kind === "failed") return firstInstructionResult;
|
|
2322
2461
|
let reader;
|
|
2462
|
+
let instructions;
|
|
2323
2463
|
try {
|
|
2324
2464
|
reader = await repositoryReaderFactory({
|
|
2325
2465
|
entries: firstInventoryResult.entries,
|
|
@@ -2327,6 +2467,12 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2327
2467
|
resourceLimits,
|
|
2328
2468
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2329
2469
|
});
|
|
2470
|
+
instructions = firstInstructionResult === null ? void 0 : await instructionSourceFactory({
|
|
2471
|
+
entries: firstInstructionResult.entries,
|
|
2472
|
+
repositoryRoot,
|
|
2473
|
+
resourceLimits,
|
|
2474
|
+
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2475
|
+
});
|
|
2330
2476
|
} catch (error) {
|
|
2331
2477
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2332
2478
|
if (isSnapshotChanged(error)) continue;
|
|
@@ -2334,16 +2480,23 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2334
2480
|
const freshInventoryResult = await probeInventory();
|
|
2335
2481
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2336
2482
|
if (freshInventoryResult.kind === "failed") return freshInventoryResult;
|
|
2337
|
-
|
|
2483
|
+
const freshInstructionResult = await probeInstructions();
|
|
2484
|
+
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2485
|
+
if (freshInstructionResult?.kind === "failed") return freshInstructionResult;
|
|
2486
|
+
if (!compareInventories(firstInventoryResult.entries, freshInventoryResult.entries) || firstInstructionResult !== null && freshInstructionResult !== null && !compareInventories(firstInstructionResult.entries, freshInstructionResult.entries)) continue;
|
|
2338
2487
|
throw error;
|
|
2339
2488
|
}
|
|
2340
2489
|
const secondInventoryResult = await probeInventory();
|
|
2341
2490
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2342
2491
|
if (secondInventoryResult.kind === "failed") return secondInventoryResult;
|
|
2343
2492
|
if (!compareInventories(firstInventoryResult.entries, secondInventoryResult.entries)) continue;
|
|
2493
|
+
const secondInstructionResult = await probeInstructions();
|
|
2494
|
+
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2495
|
+
if (secondInstructionResult?.kind === "failed") return secondInstructionResult;
|
|
2496
|
+
if (firstInstructionResult !== null && secondInstructionResult !== null && !compareInventories(firstInstructionResult.entries, secondInstructionResult.entries)) continue;
|
|
2344
2497
|
try {
|
|
2345
2498
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2346
|
-
const result = input.signal === void 0 ? await input.operation(reader) : await input.operation(reader, input.signal);
|
|
2499
|
+
const result = instructions !== void 0 ? await input.operation(reader, input.signal, instructions) : input.signal === void 0 ? await input.operation(reader) : await input.operation(reader, input.signal);
|
|
2347
2500
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2348
2501
|
return Object.freeze({
|
|
2349
2502
|
kind: "completed",
|
|
@@ -2522,11 +2675,11 @@ var createMoldeaCliContentExecutionResult = (pageResult, cliVersion, isJson, cur
|
|
|
2522
2675
|
//#region src/cli-execution/command-executor.ts
|
|
2523
2676
|
/** Loads isolated Core inspection only for commands that need it. */
|
|
2524
2677
|
var executeLazyCoreInspection = async (input) => {
|
|
2525
|
-
const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-
|
|
2678
|
+
const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-Bbpu62TT.js");
|
|
2526
2679
|
return executeMoldeaCliCoreInspection(input);
|
|
2527
2680
|
};
|
|
2528
2681
|
var loadInstalledComposition = async (input) => {
|
|
2529
|
-
const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-
|
|
2682
|
+
const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-8VLm2c-X.js");
|
|
2530
2683
|
return resolveInstalledMoldeaCliComposition(input);
|
|
2531
2684
|
};
|
|
2532
2685
|
/** Creates one operational error result without exposing caught failure details. */
|
|
@@ -2593,7 +2746,7 @@ var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingT
|
|
|
2593
2746
|
if (discoveryResult.kind === "failed") return createOperationalErrorResult(discoveryResult.errorCode, input);
|
|
2594
2747
|
const resourceLimits = options.resourceLimits;
|
|
2595
2748
|
const snapshotResult = await workingTreeSnapshotExecutor({
|
|
2596
|
-
operation: async (repository, signal) => {
|
|
2749
|
+
operation: async (repository, signal, instructions) => {
|
|
2597
2750
|
if (command === MOLDEA_CLI_COMMANDS.Scope && scopePaths !== null) return projectScopeExecutor({
|
|
2598
2751
|
paths: scopePaths,
|
|
2599
2752
|
repository,
|
|
@@ -2612,6 +2765,7 @@ var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingT
|
|
|
2612
2765
|
packageMetadata: input.packageMetadata,
|
|
2613
2766
|
command: command === MOLDEA_CLI_COMMANDS.Inspect ? "inspect" : "validate",
|
|
2614
2767
|
...inspectionCursor === null ? {} : { cursor: inspectionCursor },
|
|
2768
|
+
...instructions === void 0 ? {} : { instructions },
|
|
2615
2769
|
repository,
|
|
2616
2770
|
resourceLimits,
|
|
2617
2771
|
...signal === void 0 ? {} : { signal }
|
|
@@ -2619,6 +2773,7 @@ var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingT
|
|
|
2619
2773
|
},
|
|
2620
2774
|
repositoryRoot: discoveryResult.repositoryRoot,
|
|
2621
2775
|
resourceLimits,
|
|
2776
|
+
...command === MOLDEA_CLI_COMMANDS.Validate || command === MOLDEA_CLI_COMMANDS.Inspect ? { includeInstructions: true } : {},
|
|
2622
2777
|
...command === MOLDEA_CLI_COMMANDS.Scope ? { selectionPaths: [MOLDEA_MANIFEST_PATH] } : contentPath === null ? {} : { selectionPaths: [contentPath] },
|
|
2623
2778
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2624
2779
|
});
|