@moldea.ai/cli 11.0.5 → 11.1.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 +5 -3
- package/dist/chunks/{composition-yd6mpUnt.js → composition-P7DOCYEA.js} +4 -4
- package/dist/chunks/{composition-yd6mpUnt.js.map → composition-P7DOCYEA.js.map} +1 -1
- package/dist/chunks/{composition-B_oQMnbd.js → composition-bB23wZlW.js} +1 -1
- package/dist/chunks/{core-composition-h-p3RtWT.js → core-composition-BH3Wj5Lq.js} +3 -2
- package/dist/chunks/core-composition-BH3Wj5Lq.js.map +1 -0
- package/dist/moldea.js +168 -29
- package/dist/moldea.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunks/core-composition-h-p3RtWT.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-P7DOCYEA.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-BH3Wj5Lq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-composition-BH3Wj5Lq.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,5 +1,5 @@
|
|
|
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-P7DOCYEA.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -7,7 +7,7 @@ import { REPOSITORY_ROOT, RepositorySourceException, createRepositoryComparison,
|
|
|
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";
|
|
10
|
-
import { createFilesystemRepositoryReader } from "@moldea.ai/repository-fs";
|
|
10
|
+
import { createFilesystemRepositoryLinkResolver, createFilesystemRepositoryReader } from "@moldea.ai/repository-fs";
|
|
11
11
|
//#region src/cli-execution/constants.ts
|
|
12
12
|
var MOLDEA_CLI_EXIT_CODES = {
|
|
13
13
|
Interrupted: 130,
|
|
@@ -905,6 +905,22 @@ var GIT_UNTRACKED_INVENTORY_ARGUMENTS = [
|
|
|
905
905
|
"-z",
|
|
906
906
|
"--"
|
|
907
907
|
];
|
|
908
|
+
var GIT_IGNORED_INVENTORY_ARGUMENTS = [
|
|
909
|
+
"ls-files",
|
|
910
|
+
"--others",
|
|
911
|
+
"--ignored",
|
|
912
|
+
"--exclude-standard",
|
|
913
|
+
"--full-name",
|
|
914
|
+
"--no-recurse-submodules",
|
|
915
|
+
"-z",
|
|
916
|
+
"--"
|
|
917
|
+
];
|
|
918
|
+
var INSTRUCTION_PATHS = Object.freeze([
|
|
919
|
+
"/AGENTS.md",
|
|
920
|
+
"/CLAUDE.md",
|
|
921
|
+
"/.claude/CLAUDE.md",
|
|
922
|
+
"/CLAUDE.local.md"
|
|
923
|
+
].map((path) => parseRepositoryPath(path)));
|
|
908
924
|
//#endregion
|
|
909
925
|
//#region src/git-inventory/content-transformation/constants.ts
|
|
910
926
|
var GIT_CONTENT_TRANSFORMATION_ATTRIBUTES = [
|
|
@@ -1417,13 +1433,23 @@ var compareRepositoryPaths = (left, right) => {
|
|
|
1417
1433
|
}
|
|
1418
1434
|
};
|
|
1419
1435
|
/**
|
|
1420
|
-
*
|
|
1436
|
+
* Omits invalid external paths and rejects invalid canonical paths before inspection.
|
|
1421
1437
|
* @param input The complete decoded tracked and untracked candidate set.
|
|
1422
|
-
* @returns
|
|
1438
|
+
* @returns Retained candidates, or failure when a canonical candidate is not portable.
|
|
1423
1439
|
*/
|
|
1424
|
-
var
|
|
1425
|
-
|
|
1426
|
-
|
|
1440
|
+
var filterGitInventoryCandidateLogicalPaths = (input) => {
|
|
1441
|
+
const candidates = [];
|
|
1442
|
+
for (const candidate of input.candidates) {
|
|
1443
|
+
if (resolveCandidateRepositoryPath(candidate) === null) {
|
|
1444
|
+
if (candidate.path === "moldea" || candidate.path.startsWith("moldea/")) return createLogicalPathFailure();
|
|
1445
|
+
continue;
|
|
1446
|
+
}
|
|
1447
|
+
candidates.push(candidate);
|
|
1448
|
+
}
|
|
1449
|
+
return Object.freeze({
|
|
1450
|
+
candidates: Object.freeze(candidates),
|
|
1451
|
+
kind: "filtered"
|
|
1452
|
+
});
|
|
1427
1453
|
};
|
|
1428
1454
|
/**
|
|
1429
1455
|
* Converts Git-relative inventory entries into exact repository logical paths.
|
|
@@ -2007,26 +2033,55 @@ var createGitInventoryProbe = (processExecutor = executeGitStreamingProcess, own
|
|
|
2007
2033
|
if (untrackedProcessResult.stderr.byteLength > 0) return createProbeFailure("GIT_OUTPUT_INVALID");
|
|
2008
2034
|
const untrackedCandidates = resolveParserResult(untrackedParser.finish());
|
|
2009
2035
|
if (isProbeFailure(untrackedCandidates)) return untrackedCandidates;
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
if (
|
|
2036
|
+
let ignoredCandidates = [];
|
|
2037
|
+
let ignoredStdoutBytes = 0;
|
|
2038
|
+
if (input.includeIgnored === true && selectionPathspecs.length > 0) {
|
|
2039
|
+
const ignoredParser = createUntrackedGitInventoryParser(input.maxEntries - trackedCandidates.length - untrackedCandidates.length);
|
|
2040
|
+
const ignoredProcessResult = await processExecutor({
|
|
2041
|
+
arguments: [
|
|
2042
|
+
"-C",
|
|
2043
|
+
input.repositoryRoot,
|
|
2044
|
+
...GIT_IGNORED_INVENTORY_ARGUMENTS,
|
|
2045
|
+
...selectionPathspecs
|
|
2046
|
+
],
|
|
2047
|
+
consumeStdout: (chunk) => ignoredParser.consume(chunk),
|
|
2048
|
+
maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,
|
|
2049
|
+
maxStdoutBytes: input.maxMetadataBytes - trackedProcessResult.stdoutBytes - untrackedProcessResult.stdoutBytes,
|
|
2050
|
+
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2051
|
+
});
|
|
2052
|
+
if (ignoredProcessResult.kind === "failed") return createProbeFailure(mapGitProcessFailure(ignoredProcessResult.reason));
|
|
2053
|
+
if (ignoredProcessResult.stderr.byteLength > 0) return createProbeFailure("GIT_OUTPUT_INVALID");
|
|
2054
|
+
const parsedIgnoredCandidates = resolveParserResult(ignoredParser.finish());
|
|
2055
|
+
if (isProbeFailure(parsedIgnoredCandidates)) return parsedIgnoredCandidates;
|
|
2056
|
+
const untrackedPaths = new Set(untrackedCandidates.map((candidate) => candidate.path));
|
|
2057
|
+
ignoredCandidates = parsedIgnoredCandidates.filter((candidate) => !untrackedPaths.has(candidate.path));
|
|
2058
|
+
ignoredStdoutBytes = ignoredProcessResult.stdoutBytes;
|
|
2059
|
+
}
|
|
2060
|
+
const candidates = Object.freeze([
|
|
2061
|
+
...trackedCandidates,
|
|
2062
|
+
...untrackedCandidates,
|
|
2063
|
+
...ignoredCandidates
|
|
2064
|
+
]);
|
|
2065
|
+
const metadataBytesAfterListing = input.maxMetadataBytes - trackedProcessResult.stdoutBytes - untrackedProcessResult.stdoutBytes - ignoredStdoutBytes;
|
|
2066
|
+
const logicalPathFilterResult = filterGitInventoryCandidateLogicalPaths({ candidates });
|
|
2067
|
+
if (logicalPathFilterResult.kind === "failed") return logicalPathFilterResult;
|
|
2013
2068
|
const ownershipResult = await ownershipFilter({
|
|
2014
|
-
candidates,
|
|
2015
|
-
maxMetadataBytes:
|
|
2069
|
+
candidates: logicalPathFilterResult.candidates,
|
|
2070
|
+
maxMetadataBytes: metadataBytesAfterListing,
|
|
2016
2071
|
repositoryRoot: input.repositoryRoot,
|
|
2017
2072
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2018
2073
|
});
|
|
2019
2074
|
if (ownershipResult.kind === "failed") return ownershipResult;
|
|
2020
2075
|
const entryTypeResult = await entryTypeNormalizer({
|
|
2021
2076
|
candidates: ownershipResult.candidates,
|
|
2022
|
-
maxMetadataBytes:
|
|
2077
|
+
maxMetadataBytes: metadataBytesAfterListing - ownershipResult.gitMetadataBytes,
|
|
2023
2078
|
repositoryRoot: input.repositoryRoot,
|
|
2024
2079
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2025
2080
|
});
|
|
2026
2081
|
if (entryTypeResult.kind === "failed") return entryTypeResult;
|
|
2027
2082
|
const contentTransformationResult = await contentTransformationClassifier({
|
|
2028
2083
|
entries: entryTypeResult.entries,
|
|
2029
|
-
maxMetadataBytes:
|
|
2084
|
+
maxMetadataBytes: metadataBytesAfterListing - ownershipResult.gitMetadataBytes - entryTypeResult.gitMetadataBytes,
|
|
2030
2085
|
repositoryRoot: input.repositoryRoot,
|
|
2031
2086
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2032
2087
|
});
|
|
@@ -2219,15 +2274,37 @@ var createGitSymlinkOverlayRepositoryReader = (reader, symlinkPaths) => {
|
|
|
2219
2274
|
return Object.freeze(new GitSymlinkOverlayRepositoryReader(reader, overlayPaths));
|
|
2220
2275
|
};
|
|
2221
2276
|
//#endregion
|
|
2222
|
-
//#region src/repository-
|
|
2277
|
+
//#region src/repository-symlink-overlay/link-resolver.ts
|
|
2223
2278
|
/**
|
|
2224
|
-
*
|
|
2225
|
-
*
|
|
2226
|
-
* @param
|
|
2227
|
-
* @param
|
|
2228
|
-
* @returns A
|
|
2279
|
+
* Wraps a link resolver so Git symlinks materialized as host files resolve as unsafe. Their host
|
|
2280
|
+
* bytes are link text Git wrote, not a link the filesystem can follow, so they are never read.
|
|
2281
|
+
* @param resolver The resolver bound to the underlying filesystem reader.
|
|
2282
|
+
* @param symlinkPaths The logical paths whose host files represent Git symlinks.
|
|
2283
|
+
* @returns A frozen resolver that shares the underlying resolver's snapshot.
|
|
2284
|
+
* @throws
|
|
2285
|
+
* - INVALID_REPOSITORY_PATH: The repository path is invalid.
|
|
2229
2286
|
*/
|
|
2230
|
-
var
|
|
2287
|
+
var createGitSymlinkOverlayLinkResolver = (resolver, symlinkPaths) => {
|
|
2288
|
+
const overlayPaths = new Set(symlinkPaths.map((symlinkPath) => parseRepositoryPath(symlinkPath)));
|
|
2289
|
+
return Object.freeze({
|
|
2290
|
+
snapshot: resolver.snapshot,
|
|
2291
|
+
resolveLink: async (path, options) => overlayPaths.has(parseRepositoryPath(path)) ? { state: "unsafe" } : resolver.resolveLink(path, options),
|
|
2292
|
+
readLinkTargetPage: async (path, options) => {
|
|
2293
|
+
const parsedPath = parseRepositoryPath(path);
|
|
2294
|
+
if (overlayPaths.has(parsedPath)) throw new RepositorySourceException({
|
|
2295
|
+
code: "ENTRY_NOT_FILE",
|
|
2296
|
+
operation: "read-file-page",
|
|
2297
|
+
path: parsedPath,
|
|
2298
|
+
retryable: false
|
|
2299
|
+
});
|
|
2300
|
+
return resolver.readLinkTargetPage(parsedPath, options);
|
|
2301
|
+
}
|
|
2302
|
+
});
|
|
2303
|
+
};
|
|
2304
|
+
//#endregion
|
|
2305
|
+
//#region src/repository-reader/factory.ts
|
|
2306
|
+
/** Composes the filesystem, Git symlink overlay, and content-transformation guard layers. */
|
|
2307
|
+
var composeWorkingTreeReader = async (input, filesystemReaderFactory, symlinkOverlayFactory, contentTransformationGuardFactory) => {
|
|
2231
2308
|
const selectedPaths = Object.freeze(input.entries.map((entry) => entry.path));
|
|
2232
2309
|
const symlinkOverlayPaths = Object.freeze(input.entries.reduce((paths, entry) => {
|
|
2233
2310
|
if (entry.requiresSymlinkOverlay) paths.push(entry.path);
|
|
@@ -2237,7 +2314,7 @@ var createWorkingTreeRepositoryReaderFactory = (filesystemReaderFactory = create
|
|
|
2237
2314
|
if (entry.contentTransformation.isGuarded) paths.push(entry.path);
|
|
2238
2315
|
return paths;
|
|
2239
2316
|
}, []));
|
|
2240
|
-
|
|
2317
|
+
const filesystemReader = await filesystemReaderFactory({
|
|
2241
2318
|
limits: Object.freeze({
|
|
2242
2319
|
maxCachedBytes: input.resourceLimits.maxTotalBytes,
|
|
2243
2320
|
maxDirectoryEntries: input.resourceLimits.maxEntries,
|
|
@@ -2251,9 +2328,39 @@ var createWorkingTreeRepositoryReaderFactory = (filesystemReaderFactory = create
|
|
|
2251
2328
|
paths: selectedPaths
|
|
2252
2329
|
}),
|
|
2253
2330
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2254
|
-
})
|
|
2331
|
+
});
|
|
2332
|
+
return {
|
|
2333
|
+
filesystemReader,
|
|
2334
|
+
reader: contentTransformationGuardFactory(symlinkOverlayFactory(filesystemReader, symlinkOverlayPaths), guardedPaths),
|
|
2335
|
+
symlinkOverlayPaths
|
|
2336
|
+
};
|
|
2255
2337
|
};
|
|
2338
|
+
/**
|
|
2339
|
+
* Creates the private working-tree reader factory around injectable composition boundaries.
|
|
2340
|
+
* @param filesystemReaderFactory The exact-path filesystem snapshot factory.
|
|
2341
|
+
* @param symlinkOverlayFactory The logical Git symlink overlay factory.
|
|
2342
|
+
* @param contentTransformationGuardFactory The guarded logical regular-file reader factory.
|
|
2343
|
+
* @returns A factory that composes one coherent selected working-tree reader.
|
|
2344
|
+
*/
|
|
2345
|
+
var createWorkingTreeRepositoryReaderFactory = (filesystemReaderFactory = createFilesystemRepositoryReader, symlinkOverlayFactory = createGitSymlinkOverlayRepositoryReader, contentTransformationGuardFactory = createGitContentTransformationGuardRepositoryReader) => async (input) => (await composeWorkingTreeReader(input, filesystemReaderFactory, symlinkOverlayFactory, contentTransformationGuardFactory)).reader;
|
|
2256
2346
|
var createWorkingTreeRepositoryReader = createWorkingTreeRepositoryReaderFactory();
|
|
2347
|
+
/**
|
|
2348
|
+
* Creates the instruction-source factory: an exact-path reader for the probed instruction
|
|
2349
|
+
* entries, with the same layers as the repository reader, and Repository FS's link resolver bound
|
|
2350
|
+
* to its filesystem reader so that Git-materialized links resolve as unsafe.
|
|
2351
|
+
* @param filesystemReaderFactory The exact-path filesystem snapshot factory.
|
|
2352
|
+
* @param symlinkOverlayFactory The logical Git symlink overlay factory.
|
|
2353
|
+
* @param contentTransformationGuardFactory The guarded logical regular-file reader factory.
|
|
2354
|
+
* @returns A factory that composes one coherent instruction source.
|
|
2355
|
+
*/
|
|
2356
|
+
var createWorkingTreeInstructionSourceFactory = (filesystemReaderFactory = createFilesystemRepositoryReader, symlinkOverlayFactory = createGitSymlinkOverlayRepositoryReader, contentTransformationGuardFactory = createGitContentTransformationGuardRepositoryReader) => async (input) => {
|
|
2357
|
+
const composed = await composeWorkingTreeReader(input, filesystemReaderFactory, symlinkOverlayFactory, contentTransformationGuardFactory);
|
|
2358
|
+
return Object.freeze({
|
|
2359
|
+
linkResolver: createGitSymlinkOverlayLinkResolver(createFilesystemRepositoryLinkResolver(composed.filesystemReader), composed.symlinkOverlayPaths),
|
|
2360
|
+
reader: composed.reader
|
|
2361
|
+
});
|
|
2362
|
+
};
|
|
2363
|
+
var createWorkingTreeInstructionSource = createWorkingTreeInstructionSourceFactory();
|
|
2257
2364
|
//#endregion
|
|
2258
2365
|
//#region src/working-tree-snapshot/executor.ts
|
|
2259
2366
|
/** Creates one immutable terminal snapshot failure. */
|
|
@@ -2273,9 +2380,10 @@ var isPinnedIdentityUnavailable = (errorCode) => errorCode === "GIT_REPOSITORY_N
|
|
|
2273
2380
|
* @param inventoryProbe The complete normalized Git inventory probe.
|
|
2274
2381
|
* @param repositoryReaderFactory The exact-path guarded reader factory.
|
|
2275
2382
|
* @param compareInventories The exact normalized inventory comparator.
|
|
2383
|
+
* @param instructionSourceFactory The instruction-source composition over instruction entries.
|
|
2276
2384
|
* @returns An executor that discards and retries complete provisional attempts.
|
|
2277
2385
|
*/
|
|
2278
|
-
var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTreeIdentity, inventoryProbe = probeGitInventory, repositoryReaderFactory = createWorkingTreeRepositoryReader, compareInventories = areGitInventoriesEqual) => {
|
|
2386
|
+
var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTreeIdentity, inventoryProbe = probeGitInventory, repositoryReaderFactory = createWorkingTreeRepositoryReader, compareInventories = areGitInventoriesEqual, instructionSourceFactory = createWorkingTreeInstructionSource) => {
|
|
2279
2387
|
const executeSnapshot = async (input) => {
|
|
2280
2388
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2281
2389
|
const repositoryRoot = input.repositoryRoot;
|
|
@@ -2298,6 +2406,18 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2298
2406
|
});
|
|
2299
2407
|
return result.kind === "failed" ? createSnapshotFailure(result.errorCode) : result;
|
|
2300
2408
|
};
|
|
2409
|
+
const probeInstructions = async () => {
|
|
2410
|
+
if (input.includeInstructions !== true) return null;
|
|
2411
|
+
const result = await inventoryProbe({
|
|
2412
|
+
includeIgnored: true,
|
|
2413
|
+
maxEntries: resourceLimits.maxEntries,
|
|
2414
|
+
maxMetadataBytes: resourceLimits.maxTotalBytes,
|
|
2415
|
+
repositoryRoot,
|
|
2416
|
+
selectionPaths: INSTRUCTION_PATHS,
|
|
2417
|
+
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2418
|
+
});
|
|
2419
|
+
return result.kind === "failed" ? createSnapshotFailure(result.errorCode) : result;
|
|
2420
|
+
};
|
|
2301
2421
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
2302
2422
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2303
2423
|
const currentIdentityResult = await identityInspector({
|
|
@@ -2310,7 +2430,11 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2310
2430
|
const firstInventoryResult = await probeInventory();
|
|
2311
2431
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2312
2432
|
if (firstInventoryResult.kind === "failed") return firstInventoryResult;
|
|
2433
|
+
const firstInstructionResult = await probeInstructions();
|
|
2434
|
+
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2435
|
+
if (firstInstructionResult?.kind === "failed") return firstInstructionResult;
|
|
2313
2436
|
let reader;
|
|
2437
|
+
let instructions;
|
|
2314
2438
|
try {
|
|
2315
2439
|
reader = await repositoryReaderFactory({
|
|
2316
2440
|
entries: firstInventoryResult.entries,
|
|
@@ -2318,6 +2442,12 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2318
2442
|
resourceLimits,
|
|
2319
2443
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2320
2444
|
});
|
|
2445
|
+
instructions = firstInstructionResult === null ? void 0 : await instructionSourceFactory({
|
|
2446
|
+
entries: firstInstructionResult.entries,
|
|
2447
|
+
repositoryRoot,
|
|
2448
|
+
resourceLimits,
|
|
2449
|
+
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2450
|
+
});
|
|
2321
2451
|
} catch (error) {
|
|
2322
2452
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2323
2453
|
if (isSnapshotChanged(error)) continue;
|
|
@@ -2325,16 +2455,23 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2325
2455
|
const freshInventoryResult = await probeInventory();
|
|
2326
2456
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2327
2457
|
if (freshInventoryResult.kind === "failed") return freshInventoryResult;
|
|
2328
|
-
|
|
2458
|
+
const freshInstructionResult = await probeInstructions();
|
|
2459
|
+
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2460
|
+
if (freshInstructionResult?.kind === "failed") return freshInstructionResult;
|
|
2461
|
+
if (!compareInventories(firstInventoryResult.entries, freshInventoryResult.entries) || firstInstructionResult !== null && freshInstructionResult !== null && !compareInventories(firstInstructionResult.entries, freshInstructionResult.entries)) continue;
|
|
2329
2462
|
throw error;
|
|
2330
2463
|
}
|
|
2331
2464
|
const secondInventoryResult = await probeInventory();
|
|
2332
2465
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2333
2466
|
if (secondInventoryResult.kind === "failed") return secondInventoryResult;
|
|
2334
2467
|
if (!compareInventories(firstInventoryResult.entries, secondInventoryResult.entries)) continue;
|
|
2468
|
+
const secondInstructionResult = await probeInstructions();
|
|
2469
|
+
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2470
|
+
if (secondInstructionResult?.kind === "failed") return secondInstructionResult;
|
|
2471
|
+
if (firstInstructionResult !== null && secondInstructionResult !== null && !compareInventories(firstInstructionResult.entries, secondInstructionResult.entries)) continue;
|
|
2335
2472
|
try {
|
|
2336
2473
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2337
|
-
const result = input.signal === void 0 ? await input.operation(reader) : await input.operation(reader, input.signal);
|
|
2474
|
+
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);
|
|
2338
2475
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2339
2476
|
return Object.freeze({
|
|
2340
2477
|
kind: "completed",
|
|
@@ -2513,11 +2650,11 @@ var createMoldeaCliContentExecutionResult = (pageResult, cliVersion, isJson, cur
|
|
|
2513
2650
|
//#region src/cli-execution/command-executor.ts
|
|
2514
2651
|
/** Loads isolated Core inspection only for commands that need it. */
|
|
2515
2652
|
var executeLazyCoreInspection = async (input) => {
|
|
2516
|
-
const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-
|
|
2653
|
+
const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-BH3Wj5Lq.js");
|
|
2517
2654
|
return executeMoldeaCliCoreInspection(input);
|
|
2518
2655
|
};
|
|
2519
2656
|
var loadInstalledComposition = async (input) => {
|
|
2520
|
-
const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-
|
|
2657
|
+
const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-bB23wZlW.js");
|
|
2521
2658
|
return resolveInstalledMoldeaCliComposition(input);
|
|
2522
2659
|
};
|
|
2523
2660
|
/** Creates one operational error result without exposing caught failure details. */
|
|
@@ -2584,7 +2721,7 @@ var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingT
|
|
|
2584
2721
|
if (discoveryResult.kind === "failed") return createOperationalErrorResult(discoveryResult.errorCode, input);
|
|
2585
2722
|
const resourceLimits = options.resourceLimits;
|
|
2586
2723
|
const snapshotResult = await workingTreeSnapshotExecutor({
|
|
2587
|
-
operation: async (repository, signal) => {
|
|
2724
|
+
operation: async (repository, signal, instructions) => {
|
|
2588
2725
|
if (command === MOLDEA_CLI_COMMANDS.Scope && scopePaths !== null) return projectScopeExecutor({
|
|
2589
2726
|
paths: scopePaths,
|
|
2590
2727
|
repository,
|
|
@@ -2603,6 +2740,7 @@ var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingT
|
|
|
2603
2740
|
packageMetadata: input.packageMetadata,
|
|
2604
2741
|
command: command === MOLDEA_CLI_COMMANDS.Inspect ? "inspect" : "validate",
|
|
2605
2742
|
...inspectionCursor === null ? {} : { cursor: inspectionCursor },
|
|
2743
|
+
...instructions === void 0 ? {} : { instructions },
|
|
2606
2744
|
repository,
|
|
2607
2745
|
resourceLimits,
|
|
2608
2746
|
...signal === void 0 ? {} : { signal }
|
|
@@ -2610,6 +2748,7 @@ var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingT
|
|
|
2610
2748
|
},
|
|
2611
2749
|
repositoryRoot: discoveryResult.repositoryRoot,
|
|
2612
2750
|
resourceLimits,
|
|
2751
|
+
...command === MOLDEA_CLI_COMMANDS.Validate || command === MOLDEA_CLI_COMMANDS.Inspect ? { includeInstructions: true } : {},
|
|
2613
2752
|
...command === MOLDEA_CLI_COMMANDS.Scope ? { selectionPaths: [MOLDEA_MANIFEST_PATH] } : contentPath === null ? {} : { selectionPaths: [contentPath] },
|
|
2614
2753
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2615
2754
|
});
|