@moldea.ai/cli 11.0.6 → 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 +4 -2
- package/dist/chunks/{composition-Bb9UaGLi.js → composition-P7DOCYEA.js} +4 -4
- package/dist/chunks/{composition-Bb9UaGLi.js.map → composition-P7DOCYEA.js.map} +1 -1
- package/dist/chunks/{composition-BkoXoPOQ.js → composition-bB23wZlW.js} +1 -1
- package/dist/chunks/{core-composition-SPqzv6Kz.js → core-composition-BH3Wj5Lq.js} +3 -2
- package/dist/chunks/core-composition-BH3Wj5Lq.js.map +1 -0
- package/dist/moldea.js +151 -21
- 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-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 = [
|
|
@@ -2017,25 +2033,55 @@ var createGitInventoryProbe = (processExecutor = executeGitStreamingProcess, own
|
|
|
2017
2033
|
if (untrackedProcessResult.stderr.byteLength > 0) return createProbeFailure("GIT_OUTPUT_INVALID");
|
|
2018
2034
|
const untrackedCandidates = resolveParserResult(untrackedParser.finish());
|
|
2019
2035
|
if (isProbeFailure(untrackedCandidates)) return untrackedCandidates;
|
|
2020
|
-
|
|
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 });
|
|
2021
2067
|
if (logicalPathFilterResult.kind === "failed") return logicalPathFilterResult;
|
|
2022
2068
|
const ownershipResult = await ownershipFilter({
|
|
2023
2069
|
candidates: logicalPathFilterResult.candidates,
|
|
2024
|
-
maxMetadataBytes:
|
|
2070
|
+
maxMetadataBytes: metadataBytesAfterListing,
|
|
2025
2071
|
repositoryRoot: input.repositoryRoot,
|
|
2026
2072
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2027
2073
|
});
|
|
2028
2074
|
if (ownershipResult.kind === "failed") return ownershipResult;
|
|
2029
2075
|
const entryTypeResult = await entryTypeNormalizer({
|
|
2030
2076
|
candidates: ownershipResult.candidates,
|
|
2031
|
-
maxMetadataBytes:
|
|
2077
|
+
maxMetadataBytes: metadataBytesAfterListing - ownershipResult.gitMetadataBytes,
|
|
2032
2078
|
repositoryRoot: input.repositoryRoot,
|
|
2033
2079
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2034
2080
|
});
|
|
2035
2081
|
if (entryTypeResult.kind === "failed") return entryTypeResult;
|
|
2036
2082
|
const contentTransformationResult = await contentTransformationClassifier({
|
|
2037
2083
|
entries: entryTypeResult.entries,
|
|
2038
|
-
maxMetadataBytes:
|
|
2084
|
+
maxMetadataBytes: metadataBytesAfterListing - ownershipResult.gitMetadataBytes - entryTypeResult.gitMetadataBytes,
|
|
2039
2085
|
repositoryRoot: input.repositoryRoot,
|
|
2040
2086
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2041
2087
|
});
|
|
@@ -2228,15 +2274,37 @@ var createGitSymlinkOverlayRepositoryReader = (reader, symlinkPaths) => {
|
|
|
2228
2274
|
return Object.freeze(new GitSymlinkOverlayRepositoryReader(reader, overlayPaths));
|
|
2229
2275
|
};
|
|
2230
2276
|
//#endregion
|
|
2231
|
-
//#region src/repository-
|
|
2277
|
+
//#region src/repository-symlink-overlay/link-resolver.ts
|
|
2232
2278
|
/**
|
|
2233
|
-
*
|
|
2234
|
-
*
|
|
2235
|
-
* @param
|
|
2236
|
-
* @param
|
|
2237
|
-
* @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.
|
|
2238
2286
|
*/
|
|
2239
|
-
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) => {
|
|
2240
2308
|
const selectedPaths = Object.freeze(input.entries.map((entry) => entry.path));
|
|
2241
2309
|
const symlinkOverlayPaths = Object.freeze(input.entries.reduce((paths, entry) => {
|
|
2242
2310
|
if (entry.requiresSymlinkOverlay) paths.push(entry.path);
|
|
@@ -2246,7 +2314,7 @@ var createWorkingTreeRepositoryReaderFactory = (filesystemReaderFactory = create
|
|
|
2246
2314
|
if (entry.contentTransformation.isGuarded) paths.push(entry.path);
|
|
2247
2315
|
return paths;
|
|
2248
2316
|
}, []));
|
|
2249
|
-
|
|
2317
|
+
const filesystemReader = await filesystemReaderFactory({
|
|
2250
2318
|
limits: Object.freeze({
|
|
2251
2319
|
maxCachedBytes: input.resourceLimits.maxTotalBytes,
|
|
2252
2320
|
maxDirectoryEntries: input.resourceLimits.maxEntries,
|
|
@@ -2260,9 +2328,39 @@ var createWorkingTreeRepositoryReaderFactory = (filesystemReaderFactory = create
|
|
|
2260
2328
|
paths: selectedPaths
|
|
2261
2329
|
}),
|
|
2262
2330
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2263
|
-
})
|
|
2331
|
+
});
|
|
2332
|
+
return {
|
|
2333
|
+
filesystemReader,
|
|
2334
|
+
reader: contentTransformationGuardFactory(symlinkOverlayFactory(filesystemReader, symlinkOverlayPaths), guardedPaths),
|
|
2335
|
+
symlinkOverlayPaths
|
|
2336
|
+
};
|
|
2264
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;
|
|
2265
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();
|
|
2266
2364
|
//#endregion
|
|
2267
2365
|
//#region src/working-tree-snapshot/executor.ts
|
|
2268
2366
|
/** Creates one immutable terminal snapshot failure. */
|
|
@@ -2282,9 +2380,10 @@ var isPinnedIdentityUnavailable = (errorCode) => errorCode === "GIT_REPOSITORY_N
|
|
|
2282
2380
|
* @param inventoryProbe The complete normalized Git inventory probe.
|
|
2283
2381
|
* @param repositoryReaderFactory The exact-path guarded reader factory.
|
|
2284
2382
|
* @param compareInventories The exact normalized inventory comparator.
|
|
2383
|
+
* @param instructionSourceFactory The instruction-source composition over instruction entries.
|
|
2285
2384
|
* @returns An executor that discards and retries complete provisional attempts.
|
|
2286
2385
|
*/
|
|
2287
|
-
var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTreeIdentity, inventoryProbe = probeGitInventory, repositoryReaderFactory = createWorkingTreeRepositoryReader, compareInventories = areGitInventoriesEqual) => {
|
|
2386
|
+
var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTreeIdentity, inventoryProbe = probeGitInventory, repositoryReaderFactory = createWorkingTreeRepositoryReader, compareInventories = areGitInventoriesEqual, instructionSourceFactory = createWorkingTreeInstructionSource) => {
|
|
2288
2387
|
const executeSnapshot = async (input) => {
|
|
2289
2388
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2290
2389
|
const repositoryRoot = input.repositoryRoot;
|
|
@@ -2307,6 +2406,18 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2307
2406
|
});
|
|
2308
2407
|
return result.kind === "failed" ? createSnapshotFailure(result.errorCode) : result;
|
|
2309
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
|
+
};
|
|
2310
2421
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
2311
2422
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2312
2423
|
const currentIdentityResult = await identityInspector({
|
|
@@ -2319,7 +2430,11 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2319
2430
|
const firstInventoryResult = await probeInventory();
|
|
2320
2431
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2321
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;
|
|
2322
2436
|
let reader;
|
|
2437
|
+
let instructions;
|
|
2323
2438
|
try {
|
|
2324
2439
|
reader = await repositoryReaderFactory({
|
|
2325
2440
|
entries: firstInventoryResult.entries,
|
|
@@ -2327,6 +2442,12 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2327
2442
|
resourceLimits,
|
|
2328
2443
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2329
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
|
+
});
|
|
2330
2451
|
} catch (error) {
|
|
2331
2452
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2332
2453
|
if (isSnapshotChanged(error)) continue;
|
|
@@ -2334,16 +2455,23 @@ var createWorkingTreeSnapshotExecutor = (identityInspector = inspectGitWorkingTr
|
|
|
2334
2455
|
const freshInventoryResult = await probeInventory();
|
|
2335
2456
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2336
2457
|
if (freshInventoryResult.kind === "failed") return freshInventoryResult;
|
|
2337
|
-
|
|
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;
|
|
2338
2462
|
throw error;
|
|
2339
2463
|
}
|
|
2340
2464
|
const secondInventoryResult = await probeInventory();
|
|
2341
2465
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2342
2466
|
if (secondInventoryResult.kind === "failed") return secondInventoryResult;
|
|
2343
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;
|
|
2344
2472
|
try {
|
|
2345
2473
|
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);
|
|
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);
|
|
2347
2475
|
if (input.signal?.aborted) return createSnapshotFailure("GIT_OPERATION_ABORTED");
|
|
2348
2476
|
return Object.freeze({
|
|
2349
2477
|
kind: "completed",
|
|
@@ -2522,11 +2650,11 @@ var createMoldeaCliContentExecutionResult = (pageResult, cliVersion, isJson, cur
|
|
|
2522
2650
|
//#region src/cli-execution/command-executor.ts
|
|
2523
2651
|
/** Loads isolated Core inspection only for commands that need it. */
|
|
2524
2652
|
var executeLazyCoreInspection = async (input) => {
|
|
2525
|
-
const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-
|
|
2653
|
+
const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-BH3Wj5Lq.js");
|
|
2526
2654
|
return executeMoldeaCliCoreInspection(input);
|
|
2527
2655
|
};
|
|
2528
2656
|
var loadInstalledComposition = async (input) => {
|
|
2529
|
-
const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-
|
|
2657
|
+
const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-bB23wZlW.js");
|
|
2530
2658
|
return resolveInstalledMoldeaCliComposition(input);
|
|
2531
2659
|
};
|
|
2532
2660
|
/** Creates one operational error result without exposing caught failure details. */
|
|
@@ -2593,7 +2721,7 @@ var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingT
|
|
|
2593
2721
|
if (discoveryResult.kind === "failed") return createOperationalErrorResult(discoveryResult.errorCode, input);
|
|
2594
2722
|
const resourceLimits = options.resourceLimits;
|
|
2595
2723
|
const snapshotResult = await workingTreeSnapshotExecutor({
|
|
2596
|
-
operation: async (repository, signal) => {
|
|
2724
|
+
operation: async (repository, signal, instructions) => {
|
|
2597
2725
|
if (command === MOLDEA_CLI_COMMANDS.Scope && scopePaths !== null) return projectScopeExecutor({
|
|
2598
2726
|
paths: scopePaths,
|
|
2599
2727
|
repository,
|
|
@@ -2612,6 +2740,7 @@ var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingT
|
|
|
2612
2740
|
packageMetadata: input.packageMetadata,
|
|
2613
2741
|
command: command === MOLDEA_CLI_COMMANDS.Inspect ? "inspect" : "validate",
|
|
2614
2742
|
...inspectionCursor === null ? {} : { cursor: inspectionCursor },
|
|
2743
|
+
...instructions === void 0 ? {} : { instructions },
|
|
2615
2744
|
repository,
|
|
2616
2745
|
resourceLimits,
|
|
2617
2746
|
...signal === void 0 ? {} : { signal }
|
|
@@ -2619,6 +2748,7 @@ var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingT
|
|
|
2619
2748
|
},
|
|
2620
2749
|
repositoryRoot: discoveryResult.repositoryRoot,
|
|
2621
2750
|
resourceLimits,
|
|
2751
|
+
...command === MOLDEA_CLI_COMMANDS.Validate || command === MOLDEA_CLI_COMMANDS.Inspect ? { includeInstructions: true } : {},
|
|
2622
2752
|
...command === MOLDEA_CLI_COMMANDS.Scope ? { selectionPaths: [MOLDEA_MANIFEST_PATH] } : contentPath === null ? {} : { selectionPaths: [contentPath] },
|
|
2623
2753
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
2624
2754
|
});
|