@moldea.ai/cli 4.0.1 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/moldea.js +46 -46
- package/dist/moldea.js.map +1 -1
- package/package.json +14 -14
package/dist/moldea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moldea.js","names":["#guardedPaths","#reader","#overlayPaths","#reader"],"sources":["../src/cli-execution/constants.ts","../src/command-line/constants.ts","../src/command-line/validations.ts","../src/command-line/parser.ts","../src/presentation/constants.ts","../src/presentation/errors.ts","../src/json-serialization/serializer.ts","../src/presentation/formatters.ts","../src/presentation/transformers.ts","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/clean.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/inc.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/diff.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/major.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/minor.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/patch.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rcompare.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-loose.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-build.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/sort.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rsort.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/coerce.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/truncate.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/to-comparators.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/max-satisfying.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-satisfying.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-version.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/outside.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/gtr.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/ltr.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/intersects.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/simplify.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/subset.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/index.js","../src/compatibility/constants.ts","../src/compatibility/validations.ts","../src/compatibility/transformers.ts","../src/core-composition/constants.ts","../src/core-composition/executor.ts","../src/git-version/constants.ts","../src/git-version/parser.ts","../src/git-process/constants.ts","../src/git-process/environment.ts","../src/git-process/utilities.ts","../src/git-process/executor.ts","../src/git-process/streaming-executor.ts","../src/git-version/preflight.ts","../src/compatibility/compatibility.ts","../src/git-working-tree/constants.ts","../src/git-working-tree/parser.ts","../src/git-working-tree/starting-directory.ts","../src/git-working-tree/discovery.ts","../src/host-path-identity/utilities.ts","../src/git-working-tree/identity/comparator.ts","../src/git-working-tree/identity/constants.ts","../src/git-working-tree/identity/inspector.ts","../src/repository-content-transformation-guard/exception.ts","../src/repository-content-transformation-guard/reader.ts","../src/operational-error/constants.ts","../src/operational-error/mapper.ts","../src/git-inventory/constants.ts","../src/git-inventory/content-transformation/constants.ts","../src/git-inventory/content-transformation/parser.ts","../src/git-inventory/content-transformation/classifier.ts","../src/git-inventory/entry-type/candidate-collapser.ts","../src/git-inventory/entry-type/entry-inspector.ts","../src/git-inventory/entry-type/constants.ts","../src/git-inventory/entry-type/symlink-configuration.ts","../src/git-inventory/entry-type/normalizer.ts","../src/git-inventory/logical-path/normalizer.ts","../src/git-inventory/parser.ts","../src/git-inventory/repository-ownership/boundary-inspector.ts","../src/git-inventory/repository-ownership/path-planner.ts","../src/git-inventory/repository-ownership/ownership-filter.ts","../src/git-inventory/probe.ts","../src/git-inventory/comparison/comparator.ts","../src/repository-symlink-overlay/reader.ts","../src/repository-reader/factory.ts","../src/working-tree-snapshot/executor.ts","../src/cli-execution/results.ts","../src/cli-execution/command-executor.ts","../src/cli-execution/runner.ts","../src/package-metadata/loader.ts","../src/process-signal/session.ts","../src/bin/index.ts"],"sourcesContent":["// handled process exit codes implemented by the current CLI foundation\nexport const MOLDEA_CLI_EXIT_CODES = {\n Interrupted: 130,\n OperationalError: 3,\n StructuralInvalid: 1,\n Success: 0,\n Terminated: 143,\n UsageError: 2,\n} as const;\n","// version 1 command names accepted by the executable\nexport const MOLDEA_CLI_COMMANDS = {\n Compatibility: 'compatibility',\n Inspect: 'inspect',\n Validate: 'validate',\n} as const;\n\n// option names supported by the version 1 command grammar\nexport const MOLDEA_CLI_OPTIONS = {\n Help: '--help',\n Json: '--json',\n MaxDiagnostics: '--max-diagnostics',\n MaxEntries: '--max-entries',\n MaxEvidence: '--max-evidence',\n MaxFileBytes: '--max-file-bytes',\n MaxManifestBytes: '--max-manifest-bytes',\n MaxTotalBytes: '--max-total-bytes',\n NoColor: '--no-color',\n Repository: '--repository',\n Version: '--version',\n} as const;\n\n// default resource bounds forwarded by later command-composition slices\nexport const DEFAULT_MOLDEA_CLI_RESOURCE_LIMITS = Object.freeze({\n maxDiagnostics: 10_000,\n maxEntries: 100_000,\n maxEvidence: 10_000,\n maxFileBytes: 8_388_608,\n maxManifestBytes: 2_097_152,\n maxTotalBytes: 134_217_728,\n});\n","import type { IMoldeaCliResourceLimits } from './types.js';\n\nconst POSITIVE_INTEGER_PATTERN = /^\\d+$/u;\n\n/**\n * Determines whether text contains only Unicode scalar values.\n * @param text The text to validate.\n * @returns Whether the text contains no unpaired UTF-16 surrogate.\n */\nexport const hasOnlyUnicodeScalarValues = (text: string): boolean => {\n for (let index = 0; index < text.length; index += 1) {\n const codeUnit = text.charCodeAt(index);\n\n if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {\n if (index + 1 >= text.length) {\n return false;\n }\n\n const trailingCodeUnit = text.charCodeAt(index + 1);\n\n if (trailingCodeUnit < 0xdc00 || trailingCodeUnit > 0xdfff) {\n return false;\n }\n\n index += 1;\n continue;\n }\n\n if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * Parses one strict base-10 positive safe integer option value.\n * @param input The untrusted command-line token.\n * @returns The parsed integer, or null when the token is invalid.\n */\nexport const parsePositiveSafeInteger = (input: string): number | null => {\n if (!POSITIVE_INTEGER_PATTERN.test(input)) {\n return null;\n }\n\n const parsedInteger = Number(input);\n\n return Number.isSafeInteger(parsedInteger) && parsedInteger > 0 ? parsedInteger : null;\n};\n\n/**\n * Validates the cross-limit ordering required by the CLI composition.\n * @param limits The effective resource limits.\n * @returns Whether manifest, file, and total byte limits are consistently ordered.\n */\nexport const areMoldeaCliResourceLimitsConsistent = (limits: IMoldeaCliResourceLimits): boolean => {\n return (\n limits.maxManifestBytes <= limits.maxFileBytes && limits.maxFileBytes <= limits.maxTotalBytes\n );\n};\n\n/**\n * Determines whether one repository option is safe scalar host-path text.\n * @param input The untrusted command-line token.\n * @returns Whether the token is non-empty scalar text without NUL.\n */\nexport const isRepositoryDirectoryInputValid = (input: string): boolean => {\n return input.length > 0 && !input.includes('\\0') && hasOnlyUnicodeScalarValues(input);\n};\n","import {\n DEFAULT_MOLDEA_CLI_RESOURCE_LIMITS,\n MOLDEA_CLI_COMMANDS,\n MOLDEA_CLI_OPTIONS,\n} from './constants.js';\nimport type {\n IMoldeaCliArgumentError,\n IMoldeaCliArgumentErrorCode,\n IMoldeaCliCommand,\n IMoldeaCliCommandOptions,\n IMoldeaCliParseResult,\n IMoldeaCliResourceLimits,\n} from './types.js';\nimport {\n areMoldeaCliResourceLimitsConsistent,\n isRepositoryDirectoryInputValid,\n parsePositiveSafeInteger,\n} from './validations.js';\n\nconst COMMAND_NAMES = new Set<IMoldeaCliCommand>(Object.values(MOLDEA_CLI_COMMANDS));\nconst RESOURCE_OPTION_FIELDS = {\n [MOLDEA_CLI_OPTIONS.MaxDiagnostics]: 'maxDiagnostics',\n [MOLDEA_CLI_OPTIONS.MaxEntries]: 'maxEntries',\n [MOLDEA_CLI_OPTIONS.MaxEvidence]: 'maxEvidence',\n [MOLDEA_CLI_OPTIONS.MaxFileBytes]: 'maxFileBytes',\n [MOLDEA_CLI_OPTIONS.MaxManifestBytes]: 'maxManifestBytes',\n [MOLDEA_CLI_OPTIONS.MaxTotalBytes]: 'maxTotalBytes',\n} as const satisfies Readonly<Record<string, keyof IMoldeaCliResourceLimits>>;\n\n// mutable construction shape frozen before the normalized invocation is returned\ntype IMutableMoldeaCliResourceLimits = {\n -readonly [Key in keyof IMoldeaCliResourceLimits]: IMoldeaCliResourceLimits[Key];\n};\n\nconst createArgumentError = (\n code: IMoldeaCliArgumentErrorCode,\n command: IMoldeaCliCommand | null,\n isJson: boolean,\n): IMoldeaCliArgumentError => ({ code, command, isJson, kind: 'error' });\n\nconst isMoldeaCliCommand = (input: string | undefined): input is IMoldeaCliCommand => {\n return input !== undefined && COMMAND_NAMES.has(input as IMoldeaCliCommand);\n};\n\n/**\n * Parses the complete version 1 command grammar without mutating caller arguments.\n * @param commandLineArguments The process arguments after the executable path.\n * @returns A normalized command, informational request, or safe invocation error.\n */\nexport const parseMoldeaCliArguments = (\n commandLineArguments: readonly string[],\n): IMoldeaCliParseResult => {\n const isJson = commandLineArguments.includes(MOLDEA_CLI_OPTIONS.Json);\n\n if (commandLineArguments.length === 0) {\n return { command: null, kind: 'help' };\n }\n\n const firstArgument = commandLineArguments[0];\n\n if (firstArgument === MOLDEA_CLI_OPTIONS.Help) {\n return commandLineArguments.length === 1\n ? { command: null, kind: 'help' }\n : createArgumentError('INVALID_ARGUMENT', null, isJson);\n }\n\n if (firstArgument === MOLDEA_CLI_OPTIONS.Version) {\n return commandLineArguments.length === 1\n ? { kind: 'version' }\n : createArgumentError('INVALID_ARGUMENT', null, isJson);\n }\n\n const command = isMoldeaCliCommand(firstArgument) ? firstArgument : null;\n\n if (command === null) {\n return createArgumentError('INVALID_ARGUMENT', null, isJson);\n }\n\n if (commandLineArguments.length === 2 && commandLineArguments[1] === MOLDEA_CLI_OPTIONS.Help) {\n return { command, kind: 'help' };\n }\n\n const seenOptions = new Set<string>();\n const resourceLimits: IMutableMoldeaCliResourceLimits = {\n ...DEFAULT_MOLDEA_CLI_RESOURCE_LIMITS,\n };\n let isColorDisabled = false;\n let repositoryDirectory: string | null = null;\n\n for (let index = 1; index < commandLineArguments.length; index += 1) {\n const option = commandLineArguments[index];\n\n if (option === undefined || seenOptions.has(option)) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n seenOptions.add(option);\n\n if (option === MOLDEA_CLI_OPTIONS.Json) {\n continue;\n }\n\n if (option === MOLDEA_CLI_OPTIONS.NoColor) {\n isColorDisabled = true;\n continue;\n }\n\n if (option === MOLDEA_CLI_OPTIONS.Help || option === MOLDEA_CLI_OPTIONS.Version) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n const resourceField = RESOURCE_OPTION_FIELDS[option as keyof typeof RESOURCE_OPTION_FIELDS];\n const isRepositoryOption = option === MOLDEA_CLI_OPTIONS.Repository;\n\n if (resourceField === undefined && !isRepositoryOption) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n if (command === MOLDEA_CLI_COMMANDS.Compatibility) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n const optionValue = commandLineArguments[index + 1];\n\n if (optionValue === undefined || optionValue.startsWith('--')) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n index += 1;\n\n if (isRepositoryOption) {\n if (!isRepositoryDirectoryInputValid(optionValue)) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n repositoryDirectory = optionValue;\n continue;\n }\n\n const parsedLimit = parsePositiveSafeInteger(optionValue);\n\n if (parsedLimit === null || resourceField === undefined) {\n return createArgumentError('RESOURCE_LIMIT_CONFIGURATION_INVALID', command, isJson);\n }\n\n resourceLimits[resourceField] = parsedLimit;\n }\n\n if (!areMoldeaCliResourceLimitsConsistent(resourceLimits)) {\n return createArgumentError('RESOURCE_LIMIT_CONFIGURATION_INVALID', command, isJson);\n }\n\n const options: IMoldeaCliCommandOptions = {\n isColorDisabled,\n isJson,\n repositoryDirectory,\n resourceLimits: Object.freeze({ ...resourceLimits }),\n };\n\n return {\n invocation: Object.freeze({ command, options: Object.freeze(options) }),\n kind: 'command',\n };\n};\n","import { MOLDEA_CLI_COMMANDS } from '../command-line/index.js';\n\n// stable safe presentation contracts for errors implemented by the CLI\nexport const MOLDEA_CLI_ERROR_DEFINITIONS = Object.freeze({\n COMPATIBILITY_STATE_INVALID: Object.freeze({\n message: 'The installed compatibility state is invalid.',\n retryable: false,\n source: 'cli',\n }),\n GIT_ACCESS_DENIED: Object.freeze({\n message: 'Git access was denied.',\n retryable: true,\n source: 'git',\n }),\n GIT_COMMAND_FAILED: Object.freeze({\n message: 'The Git command failed.',\n retryable: true,\n source: 'git',\n }),\n GIT_CONTENT_TRANSFORM_UNSUPPORTED: Object.freeze({\n message: 'The requested file uses an unsupported Git content transformation.',\n retryable: false,\n source: 'git',\n }),\n GIT_NOT_FOUND: Object.freeze({\n message: 'The Git executable is unavailable.',\n retryable: false,\n source: 'git',\n }),\n GIT_OPERATION_ABORTED: Object.freeze({\n message: 'The Git operation was aborted.',\n retryable: true,\n source: 'git',\n }),\n GIT_OUTPUT_INVALID: Object.freeze({\n message: 'Git returned invalid output.',\n retryable: false,\n source: 'git',\n }),\n GIT_REPOSITORY_NOT_FOUND: Object.freeze({\n message: 'The selected path is not inside a Git repository.',\n retryable: false,\n source: 'git',\n }),\n GIT_SPARSE_CHECKOUT_UNSUPPORTED: Object.freeze({\n message: 'Sparse Git checkouts are unsupported.',\n retryable: false,\n source: 'git',\n }),\n GIT_VERSION_INVALID: Object.freeze({\n message: 'The Git version output is invalid.',\n retryable: false,\n source: 'git',\n }),\n GIT_VERSION_UNSUPPORTED: Object.freeze({\n message: 'The installed Git version is unsupported.',\n retryable: false,\n source: 'git',\n }),\n GIT_WORK_TREE_REQUIRED: Object.freeze({\n message: 'A usable Git working tree is required.',\n retryable: false,\n source: 'git',\n }),\n INTERNAL_ERROR: Object.freeze({\n message: 'The command could not be completed.',\n retryable: false,\n source: 'cli',\n }),\n INVALID_ARGUMENT: Object.freeze({\n message: 'The command invocation is invalid.',\n retryable: false,\n source: 'cli',\n }),\n RESOURCE_LIMIT_CONFIGURATION_INVALID: Object.freeze({\n message: 'The resource-limit configuration is invalid.',\n retryable: false,\n source: 'cli',\n }),\n RESOURCE_LIMIT_EXCEEDED: Object.freeze({\n message: 'A resource limit was exceeded.',\n retryable: false,\n source: 'cli',\n }),\n WORKING_TREE_UNSTABLE: Object.freeze({\n message: 'The working tree did not remain stable.',\n retryable: true,\n source: 'cli',\n }),\n} as const);\n\n// source descriptor for results derived from the selected Git working tree\nexport const MOLDEA_CLI_GIT_WORKING_TREE_SOURCE = Object.freeze({\n kind: 'git-working-tree' as const,\n});\n\n// top-level help presented without repository access\nexport const MOLDEA_CLI_TOP_LEVEL_HELP = `Usage: moldea <command> [options]\n\nCommands:\n validate Validate the current moldea project.\n inspect Inspect the current moldea project.\n compatibility Report the installed CLI compatibility state.\n\nGlobal options:\n --help Show top-level help.\n --version Show the CLI version.\n\nRun \"moldea <command> --help\" for command-specific options.\n`;\n\nconst INSPECTION_OPTIONS_HELP = `Options:\n --repository <path> Select a Git working-tree directory.\n --json Emit one machine-readable JSON result.\n --no-color Disable ANSI styling in human output.\n --max-entries <integer> Override the repository entry limit.\n --max-file-bytes <integer> Override the per-file byte limit.\n --max-total-bytes <integer> Override the total cached-byte limit.\n --max-manifest-bytes <integer> Override the manifest byte limit.\n --max-diagnostics <integer> Override the diagnostic count limit.\n --max-evidence <integer> Override the adapter evidence count limit.\n --help Show this help.\n`;\n\n// complete command-specific help keyed by the closed command set\nexport const MOLDEA_CLI_COMMAND_HELP = {\n [MOLDEA_CLI_COMMANDS.Compatibility]: `Usage: moldea compatibility [options]\n\nReport the installed CLI compatibility state.\n\nOptions:\n --json Emit one machine-readable JSON result.\n --no-color Disable ANSI styling in human output.\n --help Show this help.\n`,\n [MOLDEA_CLI_COMMANDS.Inspect]: `Usage: moldea inspect [options]\n\nInspect the current moldea project.\n\n${INSPECTION_OPTIONS_HELP}`,\n [MOLDEA_CLI_COMMANDS.Validate]: `Usage: moldea validate [options]\n\nValidate the current moldea project.\n\n${INSPECTION_OPTIONS_HELP}`,\n} as const;\n","import { MOLDEA_CLI_ERROR_DEFINITIONS } from './constants.js';\nimport type { IMoldeaCliError, IMoldeaCliOwnedErrorCode } from './types.js';\n\nconst EMPTY_ERROR_DETAILS = Object.freeze({});\n\n/**\n * Creates one immutable safe error from a CLI- or Git-owned definition.\n * @param code The stable executable-owned error code.\n * @returns The complete safe error object.\n */\nexport const createMoldeaCliOwnedError = (code: IMoldeaCliOwnedErrorCode): IMoldeaCliError => {\n const definition = MOLDEA_CLI_ERROR_DEFINITIONS[code];\n\n return Object.freeze({\n code,\n details: EMPTY_ERROR_DETAILS,\n message: definition.message,\n path: null,\n retryable: definition.retryable,\n source: definition.source,\n });\n};\n","/** Compares strings by Unicode code point rather than UTF-16 code unit. */\nconst compareUnicodeCodePoints = (left: string, right: string): number => {\n const leftCodePoints = [...left];\n const rightCodePoints = [...right];\n const sharedLength = Math.min(leftCodePoints.length, rightCodePoints.length);\n\n for (let index = 0; index < sharedLength; index += 1) {\n const leftCodePoint = leftCodePoints[index]?.codePointAt(0);\n const rightCodePoint = rightCodePoints[index]?.codePointAt(0);\n\n if (leftCodePoint === undefined || rightCodePoint === undefined) {\n throw new TypeError('The JSON object key could not be compared.');\n }\n\n if (leftCodePoint !== rightCodePoint) {\n return leftCodePoint - rightCodePoint;\n }\n }\n\n return leftCodePoints.length - rightCodePoints.length;\n};\n\n/** Serializes one validated JSON value with recursively sorted object keys. */\nconst serializeJsonValue = (value: unknown, ancestors: Set<object>): string => {\n if (value === null || typeof value === 'boolean' || typeof value === 'string') {\n return JSON.stringify(value);\n }\n\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) {\n throw new TypeError('The JSON number must be finite.');\n }\n\n return JSON.stringify(Object.is(value, -0) ? 0 : value);\n }\n\n if (typeof value !== 'object') {\n throw new TypeError('The value is not supported by the CLI JSON contract.');\n }\n\n if (ancestors.has(value)) {\n throw new TypeError('The CLI JSON value must not contain a cycle.');\n }\n\n ancestors.add(value);\n\n try {\n if (Array.isArray(value)) {\n const serializedEntries: string[] = [];\n\n for (let index = 0; index < value.length; index += 1) {\n if (!Object.hasOwn(value, index)) {\n throw new TypeError('The CLI JSON array must not contain empty slots.');\n }\n\n serializedEntries.push(serializeJsonValue(value[index], ancestors));\n }\n\n return `[${serializedEntries.join(',')}]`;\n }\n\n const prototype = Object.getPrototypeOf(value) as object | null;\n\n if (prototype !== Object.prototype && prototype !== null) {\n throw new TypeError('The CLI JSON object must be a plain record.');\n }\n\n if (Object.getOwnPropertySymbols(value).length > 0) {\n throw new TypeError('The CLI JSON object must not contain symbol keys.');\n }\n\n const record = value as Readonly<Record<string, unknown>>;\n const properties = Object.keys(record)\n .sort(compareUnicodeCodePoints)\n .map((key) => `${JSON.stringify(key)}:${serializeJsonValue(record[key], ancestors)}`);\n\n return `{${properties.join(',')}}`;\n } finally {\n ancestors.delete(value);\n }\n};\n\n/**\n * Serializes one CLI JSON value with exact recursive Unicode code-point key ordering.\n * @param value The closed JSON value to serialize.\n * @returns Compact deterministic JSON without a trailing line feed.\n * @throws\n * - If the value contains unsupported, non-finite, symbolic, class-backed, or cyclic data\n */\nexport const serializeJsonDeterministically = (value: unknown): string => {\n return serializeJsonValue(value, new Set());\n};\n","import type { IDiagnostic, IDiagnosticEntity } from '@moldea.ai/core';\n\nimport { MOLDEA_CLI_COMMANDS, type IMoldeaCliCommand } from '../command-line/index.js';\nimport type { IMoldeaCliCompatibilityResult } from '../compatibility/index.js';\nimport { MOLDEA_CLI_JSON_SCHEMA_VERSION } from '../json-output-contract/index.js';\nimport { serializeJsonDeterministically } from '../json-serialization/index.js';\n\nimport { MOLDEA_CLI_COMMAND_HELP, MOLDEA_CLI_TOP_LEVEL_HELP } from './constants.js';\nimport type {\n IMoldeaCliError,\n IMoldeaCliInspectResult,\n IMoldeaCliJsonCompatibilityEnvelope,\n IMoldeaCliJsonErrorEnvelope,\n IMoldeaCliJsonInspectEnvelope,\n IMoldeaCliJsonValidateEnvelope,\n IMoldeaCliValidateResult,\n} from './types.js';\n\nconst DIAGNOSTIC_ENTITY_KEYS = [\n 'agentId',\n 'capabilityKind',\n 'capabilityId',\n 'decisionId',\n 'variableId',\n 'adapterId',\n] as const satisfies readonly (keyof IDiagnosticEntity)[];\n\n/** Formats one diagnostic entity in the canonical Core field order. */\nconst formatMoldeaCliHumanDiagnosticEntity = (entity: IDiagnosticEntity): string =>\n DIAGNOSTIC_ENTITY_KEYS.flatMap((key) => {\n const identifier = entity[key];\n\n return identifier === undefined ? [] : [`${key}=${identifier}`];\n }).join(', ');\n\n/** Formats one Core or adapter diagnostic without changing its order or meaning. */\nconst formatMoldeaCliHumanDiagnostic = (diagnostic: IDiagnostic): string => {\n const location =\n diagnostic.path === null\n ? ''\n : diagnostic.range === null\n ? ` ${diagnostic.path}`\n : ` ${diagnostic.path}:${diagnostic.range.start.line}:${diagnostic.range.start.column}`;\n const lines = [`${diagnostic.source}:${diagnostic.code}${location} ${diagnostic.message}`];\n\n if (diagnostic.pointer !== null) {\n lines.push(` pointer: ${diagnostic.pointer}`);\n }\n\n if (diagnostic.entity !== null) {\n lines.push(` entity: ${formatMoldeaCliHumanDiagnosticEntity(diagnostic.entity)}`);\n }\n\n return lines.join('\\n');\n};\n\n/** Creates the shared human summary lines for one completed inspection state. */\nconst createMoldeaCliHumanStatusLines = (\n isValid: boolean,\n formatVersion: IMoldeaCliValidateResult['formatVersion'],\n): string[] => {\n const lines = [`The moldea project is ${isValid ? 'valid' : 'invalid'}.`];\n\n if (formatVersion !== null) {\n lines.push(`Repository format: ${formatVersion}`);\n }\n\n return lines;\n};\n\n/** Appends Core diagnostics and their final count without changing supplied order. */\nconst appendMoldeaCliHumanDiagnostics = (\n lines: string[],\n diagnostics: readonly IDiagnostic[],\n): void => {\n for (const diagnostic of diagnostics) {\n lines.push(formatMoldeaCliHumanDiagnostic(diagnostic));\n }\n\n const diagnosticLabel = diagnostics.length === 1 ? 'diagnostic' : 'diagnostics';\n\n lines.push(`${diagnostics.length} ${diagnosticLabel}.`);\n};\n\n/** Formats one count label with correct singular or plural grammar. */\nconst formatMoldeaCliHumanCount = (\n count: number,\n singularLabel: string,\n pluralLabel: string,\n): string => `${count === 1 ? singularLabel : pluralLabel}: ${count}`;\n\n/**\n * Formats top-level or command-specific help with its required trailing line feed.\n * @param command The resolved command, or null for top-level help.\n * @returns Human-readable help text.\n */\nexport const formatMoldeaCliHelp = (command: IMoldeaCliCommand | null): string => {\n if (command === null) {\n return MOLDEA_CLI_TOP_LEVEL_HELP;\n }\n\n return MOLDEA_CLI_COMMAND_HELP[command];\n};\n\n/**\n * Formats one safe CLI error for human stderr output.\n * @param error The complete safe operational error.\n * @returns One concise line ending with LF.\n */\nexport const formatMoldeaCliHumanError = (error: IMoldeaCliError): string =>\n `${error.source}:${error.code} ${error.message}\\n`;\n\n/**\n * Formats one safe version 2 JSON error envelope.\n * @param error The complete safe operational error.\n * @param command The resolved command, or null when resolution failed.\n * @param cliVersion The installed CLI package version.\n * @returns One compact deterministic JSON document ending with LF.\n */\nexport const formatMoldeaCliJsonError = (\n error: IMoldeaCliError,\n command: IMoldeaCliCommand | null,\n cliVersion: string,\n): string => {\n const envelope: IMoldeaCliJsonErrorEnvelope = {\n cliVersion,\n command,\n error,\n result: null,\n schemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n status: 'error',\n };\n\n return `${serializeJsonDeterministically(envelope)}\\n`;\n};\n\n/**\n * Formats one valid compatibility result for human stdout.\n * @param result The exact installed compatibility composition.\n * @param cliVersion The installed CLI package version.\n * @returns A deterministic complete human report ending with LF.\n */\nexport const formatMoldeaCliHumanCompatibilityResult = (\n result: IMoldeaCliCompatibilityResult,\n cliVersion: string,\n): string => {\n const lines = [\n 'The installed CLI compatibility state is valid.',\n `CLI version: ${cliVersion}`,\n `Supported Node.js: ${result.supportedNodeRange}`,\n `JSON output schema: ${MOLDEA_CLI_JSON_SCHEMA_VERSION}`,\n `Minimum Git: ${result.minimumGitVersion}`,\n `Repository formats: ${result.repositoryFormatVersions.join(', ')}`,\n 'Packages:',\n ...result.packages.map(({ name, version }) => ` ${name}: ${version}`),\n 'Adapters:',\n ];\n\n for (const adapter of result.adapters) {\n lines.push(\n ` ${adapter.id}: repository formats ${adapter.repositoryFormatVersions.join(', ')}`,\n );\n }\n\n return `${lines.join('\\n')}\\n`;\n};\n\n/**\n * Formats one valid compatibility result as a version 2 JSON envelope.\n * @param result The exact installed compatibility composition.\n * @param cliVersion The installed CLI package version.\n * @returns One compact deterministic JSON document ending with LF.\n */\nexport const formatMoldeaCliJsonCompatibilityResult = (\n result: IMoldeaCliCompatibilityResult,\n cliVersion: string,\n): string => {\n const envelope: IMoldeaCliJsonCompatibilityEnvelope = {\n cliVersion,\n command: MOLDEA_CLI_COMMANDS.Compatibility,\n error: null,\n result,\n schemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n status: 'valid',\n };\n\n return `${serializeJsonDeterministically(envelope)}\\n`;\n};\n\n/**\n * Formats one completed validation result for human stdout.\n * @param result The content-minimized validation result.\n * @returns A deterministic summary and diagnostics ending with LF.\n */\nexport const formatMoldeaCliHumanValidateResult = (result: IMoldeaCliValidateResult): string => {\n const isValid = result.diagnostics.length === 0;\n const lines = createMoldeaCliHumanStatusLines(isValid, result.formatVersion);\n\n if (!isValid) {\n appendMoldeaCliHumanDiagnostics(lines, result.diagnostics);\n }\n\n return `${lines.join('\\n')}\\n`;\n};\n\n/**\n * Formats one completed validation result as a version 1 JSON envelope.\n * @param result The content-minimized validation result.\n * @param cliVersion The installed CLI package version.\n * @returns One compact deterministic JSON document ending with LF.\n */\nexport const formatMoldeaCliJsonValidateResult = (\n result: IMoldeaCliValidateResult,\n cliVersion: string,\n): string => {\n const envelope: IMoldeaCliJsonValidateEnvelope = {\n cliVersion,\n command: MOLDEA_CLI_COMMANDS.Validate,\n error: null,\n result,\n schemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n status: result.diagnostics.length === 0 ? 'valid' : 'invalid',\n };\n\n return `${serializeJsonDeterministically(envelope)}\\n`;\n};\n\n/**\n * Formats one completed inspection result for human stdout.\n * @param result The complete inspection result and its source descriptor.\n * @returns A deterministic content-free summary or diagnostic report ending with LF.\n * @throws If a Core-valid result does not include its complete project index.\n */\nexport const formatMoldeaCliHumanInspectResult = (result: IMoldeaCliInspectResult): string => {\n const { inspection } = result;\n const lines = createMoldeaCliHumanStatusLines(inspection.valid, inspection.formatVersion);\n\n if (!inspection.valid) {\n if (inspection.evidence.length > 0) {\n lines.push(\n formatMoldeaCliHumanCount(\n inspection.evidence.length,\n 'Adapter evidence item',\n 'Adapter evidence items',\n ),\n );\n }\n\n appendMoldeaCliHumanDiagnostics(lines, inspection.diagnostics);\n\n return `${lines.join('\\n')}\\n`;\n }\n\n if (inspection.project === null) {\n throw new TypeError('A valid Core inspection must include its project index.');\n }\n\n const mirrorCount = inspection.project.agents.reduce(\n (count, agent) => count + agent.mirrors.length,\n 0,\n );\n\n lines.push(\n formatMoldeaCliHumanCount(inspection.project.context.length, 'Context asset', 'Context assets'),\n formatMoldeaCliHumanCount(inspection.project.decisions.length, 'Decision', 'Decisions'),\n formatMoldeaCliHumanCount(\n inspection.project.runtimes.length,\n 'Runtime-guidance asset',\n 'Runtime-guidance assets',\n ),\n formatMoldeaCliHumanCount(inspection.project.agents.length, 'Agent', 'Agents'),\n formatMoldeaCliHumanCount(mirrorCount, 'Mirror', 'Mirrors'),\n formatMoldeaCliHumanCount(\n inspection.evidence.length,\n 'Adapter evidence item',\n 'Adapter evidence items',\n ),\n );\n\n return `${lines.join('\\n')}\\n`;\n};\n\n/**\n * Formats one completed inspection result as a version 1 JSON envelope.\n * @param result The complete inspection result and its source descriptor.\n * @param cliVersion The installed CLI package version.\n * @returns One compact deterministic JSON document ending with LF.\n */\nexport const formatMoldeaCliJsonInspectResult = (\n result: IMoldeaCliInspectResult,\n cliVersion: string,\n): string => {\n const envelope: IMoldeaCliJsonInspectEnvelope = {\n cliVersion,\n command: MOLDEA_CLI_COMMANDS.Inspect,\n error: null,\n result,\n schemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n status: result.inspection.valid ? 'valid' : 'invalid',\n };\n\n return `${serializeJsonDeterministically(envelope)}\\n`;\n};\n","import type { IProjectInspectionResult } from '@moldea.ai/core';\n\nimport { MOLDEA_CLI_GIT_WORKING_TREE_SOURCE } from './constants.js';\nimport type { IMoldeaCliInspectResult, IMoldeaCliValidateResult } from './types.js';\n\n/** Rejects a Core result whose completion fields contradict its validity. */\nconst assertProjectInspectionInvariant = (inspection: IProjectInspectionResult): void => {\n const hasDiagnostics = inspection.diagnostics.length > 0;\n const hasProject = inspection.project !== null;\n const isConsistent = inspection.valid\n ? hasProject && !hasDiagnostics\n : !hasProject && hasDiagnostics;\n\n if (!isConsistent) {\n throw new TypeError('The Core inspection result is internally inconsistent.');\n }\n};\n\n/**\n * Reduces one complete Core inspection to the content-minimized validate result.\n * @param inspection The immutable Core inspection result.\n * @returns A frozen validation result without project content or adapter evidence.\n */\nexport const createMoldeaCliValidateResult = (\n inspection: IProjectInspectionResult,\n): IMoldeaCliValidateResult =>\n Object.freeze({\n diagnostics: inspection.diagnostics,\n formatVersion: inspection.formatVersion,\n source: MOLDEA_CLI_GIT_WORKING_TREE_SOURCE,\n });\n\n/**\n * Pairs one complete Core inspection with its non-confidential source descriptor.\n * @param inspection The immutable Core inspection result.\n * @returns A frozen result preserving the exact complete Core inspection.\n * @throws If the Core result contradicts its valid, project, and diagnostic invariants.\n */\nexport const createMoldeaCliInspectResult = (\n inspection: IProjectInspectionResult,\n): IMoldeaCliInspectResult => {\n assertProjectInspectionInvariant(inspection);\n\n return Object.freeze({\n inspection,\n source: MOLDEA_CLI_GIT_WORKING_TREE_SOURCE,\n });\n};\n","'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numeric identifiers include numeric identifiers but can be longer.\n// Therefore non-numeric identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifier, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\n\nconst isPrereleaseIdentifier = (prerelease, identifier) => {\n const identifiers = identifier.split('.')\n if (identifiers.length > prerelease.length) {\n return false\n }\n\n for (let i = 0; i < identifiers.length; i++) {\n if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {\n return false\n }\n }\n\n return true\n}\n\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (isPrereleaseIdentifier(this.prerelease, identifier)) {\n const prereleaseBase = this.prerelease[identifier.split('.').length]\n if (isNaN(prereleaseBase)) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n","'use strict'\n\nconst parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n","'use strict'\n\nconst parse = require('./parse')\nconst clean = (version, options) => {\n const s = parse(version.trim().replace(/^[=v]+/, ''), options)\n return s ? s.version : null\n}\nmodule.exports = clean\n","'use strict'\n\nconst SemVer = require('../classes/semver')\n\nconst inc = (version, release, options, identifier, identifierBase) => {\n if (typeof (options) === 'string') {\n identifierBase = identifier\n identifier = options\n options = undefined\n }\n\n try {\n return new SemVer(\n version instanceof SemVer ? version.version : version,\n options\n ).inc(release, identifier, identifierBase).version\n } catch (er) {\n return null\n }\n}\nmodule.exports = inc\n","'use strict'\n\nconst parse = require('./parse.js')\n\nconst diff = (version1, version2) => {\n const v1 = parse(version1, null, true)\n const v2 = parse(version2, null, true)\n const comparison = v1.compare(v2)\n\n if (comparison === 0) {\n return null\n }\n\n const v1Higher = comparison > 0\n const highVersion = v1Higher ? v1 : v2\n const lowVersion = v1Higher ? v2 : v1\n const highHasPre = !!highVersion.prerelease.length\n const lowHasPre = !!lowVersion.prerelease.length\n\n if (lowHasPre && !highHasPre) {\n // Going from prerelease -> no prerelease requires some special casing\n\n // If the low version has only a major, then it will always be a major\n // Some examples:\n // 1.0.0-1 -> 1.0.0\n // 1.0.0-1 -> 1.1.1\n // 1.0.0-1 -> 2.0.0\n if (!lowVersion.patch && !lowVersion.minor) {\n return 'major'\n }\n\n // If the main part has no difference\n if (lowVersion.compareMain(highVersion) === 0) {\n if (lowVersion.minor && !lowVersion.patch) {\n return 'minor'\n }\n return 'patch'\n }\n }\n\n // add the `pre` prefix if we are going to a prerelease version\n const prefix = highHasPre ? 'pre' : ''\n\n if (v1.major !== v2.major) {\n return prefix + 'major'\n }\n\n if (v1.minor !== v2.minor) {\n return prefix + 'minor'\n }\n\n if (v1.patch !== v2.patch) {\n return prefix + 'patch'\n }\n\n // high and low are prereleases\n return 'prerelease'\n}\n\nmodule.exports = diff\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst major = (a, loose) => new SemVer(a, loose).major\nmodule.exports = major\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst minor = (a, loose) => new SemVer(a, loose).minor\nmodule.exports = minor\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst patch = (a, loose) => new SemVer(a, loose).patch\nmodule.exports = patch\n","'use strict'\n\nconst parse = require('./parse')\nconst prerelease = (version, options) => {\n const parsed = parse(version, options)\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\nmodule.exports = prerelease\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","'use strict'\n\nconst compare = require('./compare')\nconst rcompare = (a, b, loose) => compare(b, a, loose)\nmodule.exports = rcompare\n","'use strict'\n\nconst compare = require('./compare')\nconst compareLoose = (a, b) => compare(a, b, true)\nmodule.exports = compareLoose\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compareBuild = (a, b, loose) => {\n const versionA = new SemVer(a, loose)\n const versionB = new SemVer(b, loose)\n return versionA.compare(versionB) || versionA.compareBuild(versionB)\n}\nmodule.exports = compareBuild\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))\nmodule.exports = sort\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))\nmodule.exports = rsort\n","'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = require('./parse')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst coerce = (version, options) => {\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version === 'number') {\n version = String(version)\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n options = options || {}\n\n let match = null\n if (!options.rtl) {\n match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])\n } else {\n // Find the right-most coercible string that does not share\n // a terminus with a more left-ward coercible string.\n // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'\n //\n // Walk through the string checking with a /g regexp\n // Manually set the index so as to pick up overlapping matches.\n // Stop when we get a match that ends at the string end, since no\n // coercible string can be more right-ward without the same terminus.\n const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]\n let next\n while ((next = coerceRtlRegex.exec(version)) &&\n (!match || match.index + match[0].length !== version.length)\n ) {\n if (!match ||\n next.index + next[0].length !== match.index + match[0].length) {\n match = next\n }\n coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length\n }\n // leave it in a clean state\n coerceRtlRegex.lastIndex = -1\n }\n\n if (match === null) {\n return null\n }\n\n const major = match[2]\n const minor = match[3] || '0'\n const patch = match[4] || '0'\n const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''\n const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''\n\n return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)\n}\nmodule.exports = coerce\n","'use strict'\n\nconst parse = require('./parse')\nconst constants = require('../internal/constants')\nconst SemVer = require('../classes/semver')\n\nconst truncate = (version, truncation, options) => {\n if (!constants.RELEASE_TYPES.includes(truncation)) {\n return null\n }\n\n const clonedVersion = cloneInputVersion(version, options)\n return clonedVersion && doTruncation(clonedVersion, truncation)\n}\n\nconst cloneInputVersion = (version, options) => {\n const versionStringToParse = (\n version instanceof SemVer ? version.version : version\n )\n\n return parse(versionStringToParse, options)\n}\n\nconst doTruncation = (version, truncation) => {\n if (isPrerelease(truncation)) {\n return version.version\n }\n\n version.prerelease = []\n\n switch (truncation) {\n case 'major':\n version.minor = 0\n version.patch = 0\n break\n case 'minor':\n version.patch = 0\n break\n }\n\n return version.format()\n}\n\nconst isPrerelease = (type) => {\n return type.startsWith('pre')\n}\n\nmodule.exports = truncate\n","'use strict'\n\nclass LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n","'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // strip build metadata so it can't bleed into the version\n range = range.replace(BUILDSTRIPRE, '')\n\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n src,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\n// unbounded global build-metadata stripper used by parseRange\nconst BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n comp = comp.replace(re[t.BUILD], '')\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\nconst invalidXRangeOrder = (M, m, p) => (\n (isX(M) && !isX(m)) ||\n (isX(m) && p && !isX(p))\n)\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n // if we're including prereleases in the match, then the lower bound is\n // -0, the lowest possible prerelease value, just like x-ranges and carets.\n // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n if (invalidXRangeOrder(M, m, p)) {\n return comp\n }\n\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n","'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","'use strict'\n\nconst Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\nmodule.exports = satisfies\n","'use strict'\n\nconst Range = require('../classes/range')\n\n// Mostly just for testing and legacy API reasons\nconst toComparators = (range, options) =>\n new Range(range, options).set\n .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))\n\nmodule.exports = toComparators\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\n\nconst maxSatisfying = (versions, range, options) => {\n let max = null\n let maxSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v\n maxSV = new SemVer(max, options)\n }\n }\n })\n return max\n}\nmodule.exports = maxSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst minSatisfying = (versions, range, options) => {\n let min = null\n let minSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v\n minSV = new SemVer(min, options)\n }\n }\n })\n return min\n}\nmodule.exports = minSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst gt = require('../functions/gt')\n\nconst minVersion = (range, loose) => {\n range = new Range(range, loose)\n\n let minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let setMin = null\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt(compver, setMin)) {\n setMin = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n })\n if (setMin && (!minver || gt(minver, setMin))) {\n minver = setMin\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\nmodule.exports = minVersion\n","'use strict'\n\nconst Range = require('../classes/range')\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\nmodule.exports = validRange\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Comparator = require('../classes/comparator')\nconst { ANY } = Comparator\nconst Range = require('../classes/range')\nconst satisfies = require('../functions/satisfies')\nconst gt = require('../functions/gt')\nconst lt = require('../functions/lt')\nconst lte = require('../functions/lte')\nconst gte = require('../functions/gte')\n\nconst outside = (version, range, hilo, options) => {\n version = new SemVer(version, options)\n range = new Range(range, options)\n\n let gtfn, ltefn, ltfn, comp, ecomp\n switch (hilo) {\n case '>':\n gtfn = gt\n ltefn = lte\n ltfn = lt\n comp = '>'\n ecomp = '>='\n break\n case '<':\n gtfn = lt\n ltefn = gte\n ltfn = gt\n comp = '<'\n ecomp = '<='\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisfies the range it is not outside\n if (satisfies(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let high = null\n let low = null\n\n comparators.forEach((comparator) => {\n if (comparator.semver === ANY) {\n comparator = new Comparator('>=0.0.0')\n }\n high = high || comparator\n low = low || comparator\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator\n }\n })\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n}\n\nmodule.exports = outside\n","'use strict'\n\n// Determine if version is greater than all the versions possible in the range.\nconst outside = require('./outside')\nconst gtr = (version, range, options) => outside(version, range, '>', options)\nmodule.exports = gtr\n","'use strict'\n\nconst outside = require('./outside')\n// Determine if version is less than all the versions possible in the range\nconst ltr = (version, range, options) => outside(version, range, '<', options)\nmodule.exports = ltr\n","'use strict'\n\nconst Range = require('../classes/range')\nconst intersects = (r1, r2, options) => {\n r1 = new Range(r1, options)\n r2 = new Range(r2, options)\n return r1.intersects(r2, options)\n}\nmodule.exports = intersects\n","'use strict'\n\n// given a set of versions and a range, create a \"simplified\" range\n// that includes the same versions that the original range does\n// If the original range is shorter than the simplified one, return that.\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\nmodule.exports = (versions, range, options) => {\n const set = []\n let first = null\n let prev = null\n const v = versions.sort((a, b) => compare(a, b, options))\n for (const version of v) {\n const included = satisfies(version, range, options)\n if (included) {\n prev = version\n if (!first) {\n first = version\n }\n } else {\n if (prev) {\n set.push([first, prev])\n }\n prev = null\n first = null\n }\n }\n if (first) {\n set.push([first, null])\n }\n\n const ranges = []\n for (const [min, max] of set) {\n if (min === max) {\n ranges.push(min)\n } else if (!max && min === v[0]) {\n ranges.push('*')\n } else if (!max) {\n ranges.push(`>=${min}`)\n } else if (min === v[0]) {\n ranges.push(`<=${max}`)\n } else {\n ranges.push(`${min} - ${max}`)\n }\n }\n const simplified = ranges.join(' || ')\n const original = typeof range.raw === 'string' ? range.raw : String(range)\n return simplified.length < original.length ? simplified : range\n}\n","'use strict'\n\nconst Range = require('../classes/range.js')\nconst Comparator = require('../classes/comparator.js')\nconst { ANY } = Comparator\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\n\n// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:\n// - Every simple range `r1, r2, ...` is a null set, OR\n// - Every simple range `r1, r2, ...` which is not a null set is a subset of\n// some `R1, R2, ...`\n//\n// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:\n// - If c is only the ANY comparator\n// - If C is only the ANY comparator, return true\n// - Else if in prerelease mode, return false\n// - else replace c with `[>=0.0.0]`\n// - If C is only the ANY comparator\n// - if in prerelease mode, return true\n// - else replace C with `[>=0.0.0]`\n// - Let EQ be the set of = comparators in c\n// - If EQ is more than one, return true (null set)\n// - Let GT be the highest > or >= comparator in c\n// - Let LT be the lowest < or <= comparator in c\n// - If GT and LT, and GT.semver > LT.semver, return true (null set)\n// - If any C is a = range, and GT or LT are set, return false\n// - If EQ\n// - If GT, and EQ does not satisfy GT, return true (null set)\n// - If LT, and EQ does not satisfy LT, return true (null set)\n// - If EQ satisfies every C, return true\n// - Else return false\n// - If GT\n// - If GT.semver is lower than any > or >= comp in C, return false\n// - If GT is >=, and GT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the GT.semver tuple, return false\n// - If LT\n// - If LT.semver is greater than any < or <= comp in C, return false\n// - If LT is <=, and LT.semver does not satisfy every C, return false\n// - If LT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the LT.semver tuple, return false\n// - Else return true\n\nconst subset = (sub, dom, options = {}) => {\n if (sub === dom) {\n return true\n }\n\n sub = new Range(sub, options)\n dom = new Range(dom, options)\n let sawNonNull = false\n\n OUTER: for (const simpleSub of sub.set) {\n for (const simpleDom of dom.set) {\n const isSub = simpleSubset(simpleSub, simpleDom, options)\n sawNonNull = sawNonNull || isSub !== null\n if (isSub) {\n continue OUTER\n }\n }\n // the null set is a subset of everything, but null simple ranges in\n // a complex range should be ignored. so if we saw a non-null range,\n // then we know this isn't a subset, but if EVERY simple range was null,\n // then it is a subset.\n if (sawNonNull) {\n return false\n }\n }\n return true\n}\n\nconst minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]\nconst minimumVersion = [new Comparator('>=0.0.0')]\n\nconst simpleSubset = (sub, dom, options) => {\n if (sub === dom) {\n return true\n }\n\n if (sub.length === 1 && sub[0].semver === ANY) {\n if (dom.length === 1 && dom[0].semver === ANY) {\n return true\n } else if (options.includePrerelease) {\n sub = minimumVersionWithPreRelease\n } else {\n sub = minimumVersion\n }\n }\n\n if (dom.length === 1 && dom[0].semver === ANY) {\n if (options.includePrerelease) {\n return true\n } else {\n dom = minimumVersion\n }\n }\n\n const eqSet = new Set()\n let gt, lt\n for (const c of sub) {\n if (c.operator === '>' || c.operator === '>=') {\n gt = higherGT(gt, c, options)\n } else if (c.operator === '<' || c.operator === '<=') {\n lt = lowerLT(lt, c, options)\n } else {\n eqSet.add(c.semver)\n }\n }\n\n if (eqSet.size > 1) {\n return null\n }\n\n let gtltComp\n if (gt && lt) {\n gtltComp = compare(gt.semver, lt.semver, options)\n if (gtltComp > 0) {\n return null\n } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {\n return null\n }\n }\n\n // will iterate one or zero times\n for (const eq of eqSet) {\n if (gt && !satisfies(eq, String(gt), options)) {\n return null\n }\n\n if (lt && !satisfies(eq, String(lt), options)) {\n return null\n }\n\n for (const c of dom) {\n if (!satisfies(eq, String(c), options)) {\n return false\n }\n }\n\n return true\n }\n\n let higher, lower\n let hasDomLT, hasDomGT\n // if the subset has a prerelease, we need a comparator in the superset\n // with the same tuple and a prerelease, or it's not a subset\n let needDomLTPre = lt &&\n !options.includePrerelease &&\n lt.semver.prerelease.length ? lt.semver : false\n let needDomGTPre = gt &&\n !options.includePrerelease &&\n gt.semver.prerelease.length ? gt.semver : false\n // exception: <1.2.3-0 is the same as <1.2.3\n if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&\n lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {\n needDomLTPre = false\n }\n\n for (const c of dom) {\n hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='\n hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='\n if (gt) {\n if (needDomGTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomGTPre.major &&\n c.semver.minor === needDomGTPre.minor &&\n c.semver.patch === needDomGTPre.patch) {\n needDomGTPre = false\n }\n }\n if (c.operator === '>' || c.operator === '>=') {\n higher = higherGT(gt, c, options)\n if (higher === c && higher !== gt) {\n return false\n }\n } else if (gt.operator === '>=' && !c.test(gt.semver)) {\n return false\n }\n }\n if (lt) {\n if (needDomLTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomLTPre.major &&\n c.semver.minor === needDomLTPre.minor &&\n c.semver.patch === needDomLTPre.patch) {\n needDomLTPre = false\n }\n }\n if (c.operator === '<' || c.operator === '<=') {\n lower = lowerLT(lt, c, options)\n if (lower === c && lower !== lt) {\n return false\n }\n } else if (lt.operator === '<=' && !c.test(lt.semver)) {\n return false\n }\n }\n if (!c.operator && (lt || gt) && gtltComp !== 0) {\n return false\n }\n }\n\n // if there was a < or >, and nothing in the dom, then must be false\n // UNLESS it was limited by another range in the other direction.\n // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0\n if (gt && hasDomLT && !lt && gtltComp !== 0) {\n return false\n }\n\n if (lt && hasDomGT && !gt && gtltComp !== 0) {\n return false\n }\n\n // we needed a prerelease range in a specific tuple, but didn't get one\n // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,\n // because it includes prereleases in the 1.2.3 tuple\n if (needDomGTPre || needDomLTPre) {\n return false\n }\n\n return true\n}\n\n// >=1.2.3 is lower than >1.2.3\nconst higherGT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp > 0 ? a\n : comp < 0 ? b\n : b.operator === '>' && a.operator === '>=' ? b\n : a\n}\n\n// <=1.2.3 is higher than <1.2.3\nconst lowerLT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp < 0 ? a\n : comp > 0 ? b\n : b.operator === '<' && a.operator === '<=' ? b\n : a\n}\n\nmodule.exports = subset\n","'use strict'\n\n// just pre-load all the stuff that index.js lazily exports\nconst internalRe = require('./internal/re')\nconst constants = require('./internal/constants')\nconst SemVer = require('./classes/semver')\nconst identifiers = require('./internal/identifiers')\nconst parse = require('./functions/parse')\nconst valid = require('./functions/valid')\nconst clean = require('./functions/clean')\nconst inc = require('./functions/inc')\nconst diff = require('./functions/diff')\nconst major = require('./functions/major')\nconst minor = require('./functions/minor')\nconst patch = require('./functions/patch')\nconst prerelease = require('./functions/prerelease')\nconst compare = require('./functions/compare')\nconst rcompare = require('./functions/rcompare')\nconst compareLoose = require('./functions/compare-loose')\nconst compareBuild = require('./functions/compare-build')\nconst sort = require('./functions/sort')\nconst rsort = require('./functions/rsort')\nconst gt = require('./functions/gt')\nconst lt = require('./functions/lt')\nconst eq = require('./functions/eq')\nconst neq = require('./functions/neq')\nconst gte = require('./functions/gte')\nconst lte = require('./functions/lte')\nconst cmp = require('./functions/cmp')\nconst coerce = require('./functions/coerce')\nconst truncate = require('./functions/truncate')\nconst Comparator = require('./classes/comparator')\nconst Range = require('./classes/range')\nconst satisfies = require('./functions/satisfies')\nconst toComparators = require('./ranges/to-comparators')\nconst maxSatisfying = require('./ranges/max-satisfying')\nconst minSatisfying = require('./ranges/min-satisfying')\nconst minVersion = require('./ranges/min-version')\nconst validRange = require('./ranges/valid')\nconst outside = require('./ranges/outside')\nconst gtr = require('./ranges/gtr')\nconst ltr = require('./ranges/ltr')\nconst intersects = require('./ranges/intersects')\nconst simplifyRange = require('./ranges/simplify')\nconst subset = require('./ranges/subset')\nmodule.exports = {\n parse,\n valid,\n clean,\n inc,\n diff,\n major,\n minor,\n patch,\n prerelease,\n compare,\n rcompare,\n compareLoose,\n compareBuild,\n sort,\n rsort,\n gt,\n lt,\n eq,\n neq,\n gte,\n lte,\n cmp,\n coerce,\n truncate,\n Comparator,\n Range,\n satisfies,\n toComparators,\n maxSatisfying,\n minSatisfying,\n minVersion,\n validRange,\n outside,\n gtr,\n ltr,\n intersects,\n simplifyRange,\n subset,\n SemVer,\n re: internalRe.re,\n src: internalRe.src,\n tokens: internalRe.t,\n SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,\n RELEASE_TYPES: constants.RELEASE_TYPES,\n compareIdentifiers: identifiers.compareIdentifiers,\n rcompareIdentifiers: identifiers.rcompareIdentifiers,\n}\n","// exact first-class package identities required by every CLI release\nexport const MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES = Object.freeze([\n '@moldea.ai/core',\n '@moldea.ai/repository',\n '@moldea.ai/repository-fs',\n] as const);\n\n// stable package and adapter identities used by runtime compatibility validation\nexport const MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX = '@moldea.ai/adapter-';\nexport const MOLDEA_CLI_CUSTOM_ADAPTER_ID = 'custom';\n","import { valid as isValidVersion, validRange } from 'semver';\n\nimport type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\n\nimport {\n MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX,\n MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n} from './constants.js';\nimport type { IMoldeaCliCompatibilityStateInput } from './types.js';\n\nconst ADAPTER_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;\n\nconst hasExactStringSet = (left: readonly string[], right: readonly string[]): boolean => {\n if (\n left.length !== right.length ||\n new Set(left).size !== left.length ||\n new Set(right).size !== right.length\n ) {\n return false;\n }\n\n const rightValues = new Set(right);\n return left.every((entry) => rightValues.has(entry));\n};\n\nconst hasUniquePositiveIntegers = (entries: readonly number[]): boolean =>\n entries.length > 0 &&\n entries.every((entry) => Number.isSafeInteger(entry) && entry > 0) &&\n new Set(entries).size === entries.length;\n\nconst createActiveAdapterMap = (\n adapters: readonly IRuntimeAdapter[],\n coreRepositoryFormatVersions: readonly number[],\n): ReadonlyMap<string, IRuntimeAdapter> | null => {\n const adapterMap = new Map<string, IRuntimeAdapter>();\n\n for (const adapter of adapters) {\n if (\n adapterMap.has(adapter.id) ||\n adapter.id === MOLDEA_CLI_CUSTOM_ADAPTER_ID ||\n !ADAPTER_ID_PATTERN.test(adapter.id) ||\n !hasUniquePositiveIntegers(adapter.supportedRepositoryFormatVersions) ||\n adapter.supportedRepositoryFormatVersions.some(\n (version) => !coreRepositoryFormatVersions.includes(version),\n )\n ) {\n return null;\n }\n\n adapterMap.set(adapter.id, adapter);\n }\n\n return adapterMap;\n};\n\n/**\n * Verifies the installed package manifest and actual executable adapter composition.\n * @param input The installed package, Core, adapter, Git, and JSON-schema state.\n * @returns Whether every runtime compatibility invariant is satisfied.\n */\nexport const isMoldeaCliCompatibilityStateValid = (\n input: IMoldeaCliCompatibilityStateInput,\n): boolean => {\n const { dependencies, installedPackageVersions, supportedNodeRange, version } =\n input.packageMetadata;\n\n if (\n isValidVersion(version) === null ||\n supportedNodeRange === null ||\n validRange(supportedNodeRange) === null ||\n isValidVersion(input.minimumGitVersion) === null ||\n input.outputSchemaVersion !== 2 ||\n dependencies === null ||\n installedPackageVersions === null ||\n !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)\n ) {\n return false;\n }\n\n const activeAdapterMap = createActiveAdapterMap(\n input.activeAdapters,\n input.coreSupportedRepositoryFormatVersions,\n );\n\n if (activeAdapterMap === null) {\n return false;\n }\n\n const expectedPackageNames = [\n ...MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n ...[...activeAdapterMap.keys()].map(\n (adapterId) => `${MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX}${adapterId}`,\n ),\n ];\n const declaredPackageNames = Object.keys(dependencies).filter((packageName) =>\n packageName.startsWith('@moldea.ai/'),\n );\n const resolvedPackageNames = Object.keys(installedPackageVersions);\n\n if (\n !hasExactStringSet(declaredPackageNames, expectedPackageNames) ||\n !hasExactStringSet(resolvedPackageNames, expectedPackageNames)\n ) {\n return false;\n }\n\n return expectedPackageNames.every((packageName) => {\n const resolvedVersion = installedPackageVersions[packageName];\n const declaredVersion = dependencies[packageName];\n\n return (\n resolvedVersion !== undefined &&\n isValidVersion(resolvedVersion) !== null &&\n (declaredVersion === resolvedVersion || declaredVersion === `workspace:${resolvedVersion}`)\n );\n });\n};\n","import { MOLDEA_CLI_CUSTOM_ADAPTER_ID } from './constants.js';\nimport type {\n IMoldeaCliAdapterCompatibility,\n IMoldeaCliCompatibilityResult,\n IMoldeaCliCompatibilityStateInput,\n} from './types.js';\n\nconst compareIdentifiers = (left: string, right: string): number =>\n left < right ? -1 : left > right ? 1 : 0;\n\n/** Recursively freezes a compatibility result without retaining mutable input ownership. */\nconst freezeCompatibilityValue = <TValue extends object>(value: TValue): TValue => {\n const pendingValues: object[] = [value];\n const visitedValues = new Set<object>();\n\n while (pendingValues.length > 0) {\n const currentValue = pendingValues.pop();\n\n if (currentValue === undefined || visitedValues.has(currentValue)) {\n continue;\n }\n\n visitedValues.add(currentValue);\n for (const nestedValue of Object.values(currentValue as Readonly<Record<string, unknown>>)) {\n if (typeof nestedValue === 'object' && nestedValue !== null) {\n pendingValues.push(nestedValue);\n }\n }\n\n Object.freeze(currentValue);\n }\n\n return value;\n};\n\n/**\n * Creates the compact immutable compatibility result from validated installed state.\n * @param input The already validated installed and executable composition.\n * @returns A deeply immutable compatibility result in deterministic report order.\n */\nexport const createMoldeaCliCompatibilityResult = (\n input: IMoldeaCliCompatibilityStateInput,\n): IMoldeaCliCompatibilityResult => {\n const adapters: IMoldeaCliAdapterCompatibility[] = [\n {\n id: MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n },\n ...input.activeAdapters.map((adapter) => ({\n id: adapter.id,\n repositoryFormatVersions: [...adapter.supportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n })),\n ].sort((left, right) => compareIdentifiers(left.id, right.id));\n const packages = Object.entries(input.packageMetadata.installedPackageVersions ?? {})\n .map(([name, version]) => ({ name, version }))\n .sort((left, right) => compareIdentifiers(left.name, right.name));\n\n return freezeCompatibilityValue({\n adapters,\n minimumGitVersion: input.minimumGitVersion,\n packages,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n supportedNodeRange: input.packageMetadata.supportedNodeRange ?? '',\n });\n};\n","import type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\nimport { anthropicAdapter } from '@moldea.ai/adapter-anthropic';\nimport { claudeAgentSdkAdapter } from '@moldea.ai/adapter-claude-agent-sdk';\nimport { cloudflareAgentsAdapter } from '@moldea.ai/adapter-cloudflare-agents';\nimport { eveAdapter } from '@moldea.ai/adapter-eve';\nimport { googleGenAiAdapter } from '@moldea.ai/adapter-google-genai';\nimport { langChainAdapter } from '@moldea.ai/adapter-langchain';\nimport { langGraphAdapter } from '@moldea.ai/adapter-langgraph';\nimport { openAiAdapter } from '@moldea.ai/adapter-openai';\nimport { openAiAgentsSdkAdapter } from '@moldea.ai/adapter-openai-agents-sdk';\nimport { vercelAiSdkAdapter } from '@moldea.ai/adapter-vercel-ai-sdk';\n\n// package-backed runtime adapters active in this CLI release\nexport const ACTIVE_RUNTIME_ADAPTERS: readonly IRuntimeAdapter[] = Object.freeze([\n anthropicAdapter,\n claudeAgentSdkAdapter,\n cloudflareAgentsAdapter,\n eveAdapter,\n googleGenAiAdapter,\n langChainAdapter,\n langGraphAdapter,\n openAiAdapter,\n openAiAgentsSdkAdapter,\n vercelAiSdkAdapter,\n]);\n","import { createCore } from '@moldea.ai/core';\nimport type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\n\nimport { ACTIVE_RUNTIME_ADAPTERS } from './constants.js';\nimport type { IMoldeaCliCoreFactory, IMoldeaCliCoreInspectionExecutor } from './types.js';\n\nconst compareAdapterIds = (left: IRuntimeAdapter, right: IRuntimeAdapter): number => {\n if (left.id < right.id) {\n return -1;\n }\n\n if (left.id > right.id) {\n return 1;\n }\n\n return 0;\n};\n\n/**\n * Creates the private attempt-local Core composition boundary.\n * @param coreFactory The immutable Core construction boundary.\n * @param activeAdapters The package-backed adapters active in this CLI release.\n * @returns An executor that creates and runs a fresh Core instance per snapshot attempt.\n */\nexport const createMoldeaCliCoreInspectionExecutor = (\n coreFactory: IMoldeaCliCoreFactory = createCore,\n activeAdapters: readonly IRuntimeAdapter[] = ACTIVE_RUNTIME_ADAPTERS,\n): IMoldeaCliCoreInspectionExecutor => {\n const normalizedAdapters = Object.freeze([...activeAdapters].sort(compareAdapterIds));\n\n return async (input) => {\n const core = coreFactory({\n adapters: normalizedAdapters,\n limits: Object.freeze({\n maxDiagnostics: input.resourceLimits.maxDiagnostics,\n maxEntries: input.resourceLimits.maxEntries,\n maxEvidence: input.resourceLimits.maxEvidence,\n maxFileBytes: input.resourceLimits.maxFileBytes,\n maxManifestBytes: input.resourceLimits.maxManifestBytes,\n maxTotalBytesRead: input.resourceLimits.maxTotalBytes,\n }),\n });\n\n return core.inspectProject({\n repository: input.repository,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n };\n};\n\n/**\n * Executes one project inspection through a fresh CLI-configured Core instance.\n * @returns A promise resolving to Core's complete immutable inspection result.\n * @throws\n * - DUPLICATE_ADAPTER_ID: A runtime adapter ID is registered more than once.\n * - RESERVED_ADAPTER_ID: A reserved runtime adapter ID was supplied.\n * - INVALID_ADAPTER_DEFINITION: A runtime adapter definition is invalid.\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - INVALID_REPOSITORY_PATH: A repository path is invalid.\n * - ENTRY_NOT_FOUND: A discovered file disappeared from the reader snapshot.\n * - ENTRY_NOT_FILE: A discovered file changed type during inspection.\n * - ENTRY_NOT_DIRECTORY: A discovered directory changed type during inspection.\n * - ACCESS_DENIED: Access to the repository source was denied.\n * - SOURCE_UNAVAILABLE: The repository source is unavailable.\n * - SNAPSHOT_CHANGED: The repository snapshot changed during inspection.\n * - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.\n * - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.\n * - ABORTED: Project inspection or a repository operation was aborted.\n * - ADAPTER_EXECUTION_FAILED: A runtime adapter failed or returned an invalid result.\n */\nexport const executeMoldeaCliCoreInspection = createMoldeaCliCoreInspectionExecutor();\n","// numeric components of the oldest Git version supported by the CLI\nexport const MINIMUM_GIT_VERSION_COMPONENTS = Object.freeze({\n major: 2,\n minor: 30,\n patch: 0,\n});\n\n// oldest Git version supported by the CLI\nexport const MINIMUM_GIT_VERSION = `${MINIMUM_GIT_VERSION_COMPONENTS.major}.${MINIMUM_GIT_VERSION_COMPONENTS.minor}.${MINIMUM_GIT_VERSION_COMPONENTS.patch}`;\n\n// maximum bytes accepted from each Git version output stream\nexport const MAX_GIT_VERSION_OUTPUT_BYTES = 4096;\n","import { TextDecoder } from 'node:util';\n\nimport type { IGitVersion } from './types.js';\n\nconst GIT_VERSION_PATTERN =\n /^git version (0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:[.-][0-9A-Za-z]+)*(?: \\([0-9A-Za-z](?:[0-9A-Za-z ._+/-]*[0-9A-Za-z])?\\))?$/;\n\nconst UTF8_DECODER = new TextDecoder('utf-8', {\n fatal: true,\n ignoreBOM: true,\n});\n\n/**\n * Decodes one terminated Git version line as strict UTF-8.\n * @param output The bounded stdout bytes from `git --version`.\n * @returns The line without its terminator, or null when invalid.\n */\nconst decodeGitVersionLine = (output: Uint8Array): string | null => {\n let decodedOutput: string;\n\n try {\n decodedOutput = UTF8_DECODER.decode(output);\n } catch {\n return null;\n }\n\n if (decodedOutput.startsWith('\\uFEFF')) {\n return null;\n }\n\n if (decodedOutput.endsWith('\\r\\n')) {\n return decodedOutput.slice(0, -2);\n }\n\n if (decodedOutput.endsWith('\\n')) {\n return decodedOutput.slice(0, -1);\n }\n\n return null;\n};\n\n/**\n * Parses a strict `git --version` response without accepting arbitrary prose.\n * @param output The bounded stdout bytes from Git.\n * @returns The frozen numeric version, or null when the output is invalid.\n */\nexport const parseGitVersionOutput = (output: Uint8Array): IGitVersion | null => {\n const versionLine = decodeGitVersionLine(output);\n\n if (versionLine === null || versionLine.includes('\\r') || versionLine.includes('\\n')) {\n return null;\n }\n\n const match = GIT_VERSION_PATTERN.exec(versionLine);\n\n if (match === null) {\n return null;\n }\n\n const majorText = match[1];\n const minorText = match[2];\n const patchText = match[3];\n\n if (majorText === undefined || minorText === undefined || patchText === undefined) {\n return null;\n }\n\n const major = Number(majorText);\n const minor = Number(minorText);\n const patch = Number(patchText);\n\n if (![major, minor, patch].every(Number.isSafeInteger)) {\n return null;\n }\n\n return Object.freeze({ major, minor, patch });\n};\n","// arguments applied to every Git subprocess\nexport const GIT_PROCESS_GLOBAL_ARGUMENTS = [\n '--no-pager',\n '-c',\n 'color.ui=false',\n '-c',\n 'core.fsmonitor=false',\n '-c',\n 'submodule.recurse=false',\n] as const;\n\n// maximum bytes retained from Git stderr for safe failure classification\nexport const MAX_GIT_PROCESS_DIAGNOSTIC_BYTES = 4096;\n\n// exact environment variables removed before executing Git\nexport const GIT_PROCESS_REMOVED_ENVIRONMENT_NAMES = [\n 'GIT_DIR',\n 'GIT_WORK_TREE',\n 'GIT_INDEX_FILE',\n 'GIT_OBJECT_DIRECTORY',\n 'GIT_ALTERNATE_OBJECT_DIRECTORIES',\n 'GIT_COMMON_DIR',\n 'GIT_CEILING_DIRECTORIES',\n 'GIT_DISCOVERY_ACROSS_FILESYSTEM',\n 'GIT_NAMESPACE',\n 'GIT_SHALLOW_FILE',\n 'GIT_ATTR_SOURCE',\n 'GIT_CONFIG',\n 'GIT_CONFIG_SYSTEM',\n 'GIT_CONFIG_GLOBAL',\n 'GIT_CONFIG_NOSYSTEM',\n 'GIT_CONFIG_PARAMETERS',\n 'GIT_CONFIG_COUNT',\n 'GIT_EXEC_PATH',\n 'GIT_LITERAL_PATHSPECS',\n 'GIT_GLOB_PATHSPECS',\n 'GIT_NOGLOB_PATHSPECS',\n 'GIT_ICASE_PATHSPECS',\n] as const;\n\n// environment-variable prefixes removed before executing Git\nexport const GIT_PROCESS_REMOVED_ENVIRONMENT_PREFIXES = [\n 'GIT_CONFIG_KEY_',\n 'GIT_CONFIG_VALUE_',\n 'GIT_TRACE',\n] as const;\n\n// deterministic non-interactive environment applied to every Git subprocess\nexport const GIT_PROCESS_ENVIRONMENT_OVERRIDES = Object.freeze({\n LC_ALL: 'C',\n LANG: 'C',\n LANGUAGE: 'C',\n GIT_OPTIONAL_LOCKS: '0',\n GIT_PAGER: '',\n PAGER: '',\n GIT_TERMINAL_PROMPT: '0',\n NO_COLOR: '1',\n});\n","import {\n GIT_PROCESS_ENVIRONMENT_OVERRIDES,\n GIT_PROCESS_REMOVED_ENVIRONMENT_NAMES,\n GIT_PROCESS_REMOVED_ENVIRONMENT_PREFIXES,\n} from './constants.js';\nimport type { IGitProcessEnvironment } from './types.js';\n\nconst REMOVED_ENVIRONMENT_NAMES = new Set(\n GIT_PROCESS_REMOVED_ENVIRONMENT_NAMES.map((name) => name.toUpperCase()),\n);\n\n/**\n * Determines whether an inherited environment variable can alter Git behavior.\n * @param name The environment variable name.\n * @returns Whether the variable must be removed.\n */\nconst isRemovedEnvironmentVariable = (name: string): boolean => {\n const normalizedName = name.toUpperCase();\n\n return (\n REMOVED_ENVIRONMENT_NAMES.has(normalizedName) ||\n GIT_PROCESS_REMOVED_ENVIRONMENT_PREFIXES.some((prefix) => normalizedName.startsWith(prefix))\n );\n};\n\n/**\n * Creates the immutable, deterministic environment used by Git subprocesses.\n * @param environment The host environment to sanitize.\n * @returns A frozen environment that preserves unrelated variables.\n */\nexport const createGitProcessEnvironment = (\n environment: NodeJS.ProcessEnv,\n): IGitProcessEnvironment => {\n const sanitizedEnvironment: Record<string, string> = {};\n\n for (const [name, environmentValue] of Object.entries(environment)) {\n if (\n environmentValue !== undefined &&\n !isRemovedEnvironmentVariable(name) &&\n !(name.toUpperCase() in GIT_PROCESS_ENVIRONMENT_OVERRIDES)\n ) {\n sanitizedEnvironment[name] = environmentValue;\n }\n }\n\n return Object.freeze({\n ...sanitizedEnvironment,\n ...GIT_PROCESS_ENVIRONMENT_OVERRIDES,\n });\n};\n","import type { IGitProcessFailureReason } from './types.js';\n\n/**\n * Classifies a subprocess error without retaining provider diagnostics.\n * @param error The Node.js subprocess error, or null for a nonzero exit.\n * @param stderr The bounded process diagnostic used only for classification.\n * @returns The normalized failure reason.\n */\nexport const classifyGitProcessError = (\n error: unknown,\n stderr: Uint8Array,\n): IGitProcessFailureReason => {\n const errorCode =\n error instanceof Error && 'code' in error && typeof error.code === 'string'\n ? error.code.toUpperCase()\n : '';\n\n if (errorCode === 'ENOENT') {\n return 'not-found';\n }\n\n if (errorCode === 'EACCES' || errorCode === 'EPERM') {\n return 'access-denied';\n }\n\n if (errorCode === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER') {\n return 'output-limit-exceeded';\n }\n\n const diagnostic = new TextDecoder().decode(stderr);\n\n if (diagnostic.startsWith('fatal: not a git repository')) {\n return 'repository-not-found';\n }\n\n if (\n diagnostic.startsWith('fatal: detected dubious ownership in repository at ') ||\n (diagnostic.startsWith('fatal: ') && /: Permission denied(?:\\r?\\n)?$/u.test(diagnostic))\n ) {\n return 'access-denied';\n }\n\n return 'command-failed';\n};\n","import { execFile } from 'node:child_process';\nimport process from 'node:process';\n\nimport { GIT_PROCESS_GLOBAL_ARGUMENTS } from './constants.js';\nimport { createGitProcessEnvironment } from './environment.js';\nimport type { IGitProcessExecutor, IGitProcessResult } from './types.js';\nimport { classifyGitProcessError } from './utilities.js';\n\n/**\n * Executes Git directly with trusted arguments, a sanitized environment, and bounded output.\n * @param options The trusted arguments, environment, output limit, and optional signal.\n * @returns A promise that resolves to normalized process output or failure.\n */\nexport const executeGitProcess: IGitProcessExecutor = async (options): Promise<IGitProcessResult> =>\n new Promise((resolve) => {\n if (options.signal?.aborted) {\n resolve(Object.freeze({ kind: 'failed', reason: 'aborted' }));\n return;\n }\n\n execFile(\n 'git',\n [...GIT_PROCESS_GLOBAL_ARGUMENTS, ...options.arguments],\n {\n encoding: 'buffer',\n env: createGitProcessEnvironment(options.environment ?? process.env),\n maxBuffer: options.maxBufferBytes,\n shell: false,\n ...(options.signal === undefined ? {} : { signal: options.signal }),\n windowsHide: true,\n },\n (error, stdout, stderr) => {\n if (options.signal?.aborted) {\n resolve(Object.freeze({ kind: 'failed', reason: 'aborted' }));\n return;\n }\n\n if (error) {\n resolve(\n Object.freeze({\n kind: 'failed',\n reason: classifyGitProcessError(error, stderr),\n }),\n );\n return;\n }\n\n resolve(\n Object.freeze({\n kind: 'completed',\n stdout: Uint8Array.from(stdout),\n stderr: Uint8Array.from(stderr),\n }),\n );\n },\n );\n });\n","import { spawn } from 'node:child_process';\nimport process from 'node:process';\n\nimport { GIT_PROCESS_GLOBAL_ARGUMENTS } from './constants.js';\nimport { createGitProcessEnvironment } from './environment.js';\nimport type {\n IGitStreamingProcessExecutor,\n IGitStreamingProcessFailureReason,\n IGitStreamingProcessResult,\n} from './types.js';\nimport { classifyGitProcessError } from './utilities.js';\n\n/** Concatenates the bounded stderr chunks retained for classification. */\nconst concatenateChunks = (chunks: readonly Buffer[], byteLength: number): Uint8Array =>\n Uint8Array.from(Buffer.concat(chunks, byteLength));\n\n/**\n * Executes Git directly while consuming bounded stdout incrementally.\n * @param options The trusted arguments, optional stdin and signal, consumer, environment, and limits.\n * @returns A promise that resolves to a normalized streamed process result.\n */\nexport const executeGitStreamingProcess: IGitStreamingProcessExecutor = async (\n options,\n): Promise<IGitStreamingProcessResult> =>\n new Promise((resolve, reject) => {\n if (options.signal?.aborted) {\n resolve(Object.freeze({ kind: 'failed', reason: 'aborted' }));\n return;\n }\n\n const stdin = options.stdin === undefined ? null : Uint8Array.from(options.stdin);\n const stderrChunks: Buffer[] = [];\n let failureReason: IGitStreamingProcessFailureReason | null = null;\n let isSettled = false;\n let stderrBytes = 0;\n let stdoutBytes = 0;\n\n const childProcess = spawn('git', [...GIT_PROCESS_GLOBAL_ARGUMENTS, ...options.arguments], {\n env: createGitProcessEnvironment(options.environment ?? process.env),\n shell: false,\n ...(options.signal === undefined ? {} : { signal: options.signal }),\n stdio: [stdin === null ? 'ignore' : 'pipe', 'pipe', 'pipe'],\n windowsHide: true,\n });\n const { stderr, stdout } = childProcess;\n\n if (stderr === null || stdout === null) {\n childProcess.on('error', () => undefined);\n childProcess.kill();\n resolve(Object.freeze({ kind: 'failed', reason: 'command-failed' }));\n return;\n }\n\n stdout.on('data', (chunk: Buffer) => {\n if (failureReason !== null || isSettled) {\n return;\n }\n\n if (stdoutBytes + chunk.byteLength > options.maxStdoutBytes) {\n failureReason = 'stdout-limit-exceeded';\n childProcess.kill();\n return;\n }\n\n stdoutBytes += chunk.byteLength;\n\n try {\n options.consumeStdout(Uint8Array.from(chunk));\n } catch (error) {\n isSettled = true;\n childProcess.kill();\n reject(\n error instanceof Error\n ? error\n : new Error('The Git stdout consumer failed.', { cause: error }),\n );\n }\n });\n\n stderr.on('data', (chunk: Buffer) => {\n if (failureReason !== null || isSettled) {\n return;\n }\n\n if (stderrBytes + chunk.byteLength > options.maxStderrBytes) {\n failureReason = 'stderr-limit-exceeded';\n childProcess.kill();\n return;\n }\n\n stderrBytes += chunk.byteLength;\n stderrChunks.push(chunk);\n });\n\n childProcess.on('error', (error) => {\n if (failureReason !== null || isSettled) {\n return;\n }\n\n isSettled = true;\n resolve(\n Object.freeze({\n kind: 'failed',\n reason: options.signal?.aborted\n ? 'aborted'\n : classifyGitProcessError(error, concatenateChunks(stderrChunks, stderrBytes)),\n }),\n );\n });\n\n childProcess.on('close', (exitCode) => {\n if (isSettled) {\n return;\n }\n\n isSettled = true;\n\n if (failureReason !== null) {\n resolve(Object.freeze({ kind: 'failed', reason: failureReason }));\n return;\n }\n\n if (options.signal?.aborted) {\n resolve(Object.freeze({ kind: 'failed', reason: 'aborted' }));\n return;\n }\n\n const stderr = concatenateChunks(stderrChunks, stderrBytes);\n\n if (exitCode !== 0) {\n resolve(\n Object.freeze({\n kind: 'failed',\n reason: classifyGitProcessError(null, stderr),\n }),\n );\n return;\n }\n\n resolve(Object.freeze({ kind: 'completed', stderr, stdoutBytes }));\n });\n\n if (stdin !== null) {\n if (childProcess.stdin === null) {\n failureReason = 'command-failed';\n childProcess.kill();\n return;\n }\n\n childProcess.stdin.on('error', () => {\n if (failureReason !== null || isSettled) {\n return;\n }\n\n failureReason = 'command-failed';\n childProcess.kill();\n });\n\n try {\n childProcess.stdin.end(stdin);\n } catch {\n failureReason = 'command-failed';\n childProcess.kill();\n }\n }\n });\n","import {\n executeGitProcess,\n type IGitProcessExecutor,\n type IGitProcessFailureReason,\n} from '../git-process/index.js';\nimport type { IMoldeaCliGitErrorCode } from '../presentation/index.js';\n\nimport { MAX_GIT_VERSION_OUTPUT_BYTES, MINIMUM_GIT_VERSION_COMPONENTS } from './constants.js';\nimport { parseGitVersionOutput } from './parser.js';\nimport type { IGitVersion, IGitVersionPreflight, IGitVersionPreflightResult } from './types.js';\n\n/**\n * Maps process failures to stable safe CLI errors.\n * @param reason The normalized subprocess failure reason.\n * @returns The public Git error code.\n */\nconst mapGitProcessFailure = (reason: IGitProcessFailureReason): IMoldeaCliGitErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'repository-not-found':\n return 'GIT_COMMAND_FAILED';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'output-limit-exceeded':\n return 'GIT_VERSION_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/**\n * Determines whether a parsed Git version meets the supported minimum.\n * @param version The parsed Git version.\n * @returns Whether the numeric version is supported.\n */\nconst isGitVersionSupported = (version: IGitVersion): boolean => {\n if (version.major !== MINIMUM_GIT_VERSION_COMPONENTS.major) {\n return version.major > MINIMUM_GIT_VERSION_COMPONENTS.major;\n }\n\n if (version.minor !== MINIMUM_GIT_VERSION_COMPONENTS.minor) {\n return version.minor > MINIMUM_GIT_VERSION_COMPONENTS.minor;\n }\n\n return version.patch >= MINIMUM_GIT_VERSION_COMPONENTS.patch;\n};\n\n/**\n * Creates a Git prerequisite check around an injectable process boundary.\n * @param processExecutor The normalized Git subprocess executor.\n * @returns A preflight that validates the installed Git version.\n */\nexport const createGitVersionPreflight =\n (processExecutor: IGitProcessExecutor = executeGitProcess): IGitVersionPreflight =>\n async (signal): Promise<IGitVersionPreflightResult> => {\n const processResult = await processExecutor({\n arguments: ['--version'],\n maxBufferBytes: MAX_GIT_VERSION_OUTPUT_BYTES,\n ...(signal === undefined ? {} : { signal }),\n });\n\n if (processResult.kind === 'failed') {\n return Object.freeze({\n errorCode: mapGitProcessFailure(processResult.reason),\n kind: 'failed',\n });\n }\n\n if (processResult.stderr.byteLength > 0) {\n return Object.freeze({\n errorCode: 'GIT_VERSION_INVALID',\n kind: 'failed',\n });\n }\n\n const version = parseGitVersionOutput(processResult.stdout);\n\n if (version === null) {\n return Object.freeze({\n errorCode: 'GIT_VERSION_INVALID',\n kind: 'failed',\n });\n }\n\n if (!isGitVersionSupported(version)) {\n return Object.freeze({\n errorCode: 'GIT_VERSION_UNSUPPORTED',\n kind: 'failed',\n });\n }\n\n return Object.freeze({ kind: 'supported', version });\n };\n\n// default Git prerequisite preflight used by command execution\nexport const checkGitVersion = createGitVersionPreflight();\n","import { SUPPORTED_REPOSITORY_FORMAT_VERSIONS } from '@moldea.ai/core';\n\nimport { ACTIVE_RUNTIME_ADAPTERS } from '../core-composition/index.js';\nimport { MINIMUM_GIT_VERSION } from '../git-version/index.js';\nimport { MOLDEA_CLI_JSON_SCHEMA_VERSION } from '../json-output-contract/index.js';\n\nimport { createMoldeaCliCompatibilityResult } from './transformers.js';\nimport type {\n IMoldeaCliCompatibilityResolution,\n IMoldeaCliCompatibilityStateInput,\n IMoldeaCliInstalledCompatibilityInput,\n} from './types.js';\nimport { isMoldeaCliCompatibilityStateValid } from './validations.js';\n\nconst INVALID_COMPATIBILITY_RESOLUTION = Object.freeze({ kind: 'invalid' as const });\n\n/**\n * Resolves one explicit runtime composition without emitting a partial compatibility result.\n * @param input The installed and actual runtime state to compare.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveMoldeaCliCompatibility = (\n input: IMoldeaCliCompatibilityStateInput,\n): IMoldeaCliCompatibilityResolution => {\n try {\n if (!isMoldeaCliCompatibilityStateValid(input)) {\n return INVALID_COMPATIBILITY_RESOLUTION;\n }\n\n return Object.freeze({\n kind: 'valid',\n result: createMoldeaCliCompatibilityResult(input),\n });\n } catch {\n return INVALID_COMPATIBILITY_RESOLUTION;\n }\n};\n\n/**\n * Resolves compatibility through the fixed package, Core, adapter, Git, and JSON composition.\n * @param input The installed package metadata.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveInstalledMoldeaCliCompatibility = (\n input: IMoldeaCliInstalledCompatibilityInput,\n): IMoldeaCliCompatibilityResolution =>\n resolveMoldeaCliCompatibility({\n activeAdapters: ACTIVE_RUNTIME_ADAPTERS,\n coreSupportedRepositoryFormatVersions: SUPPORTED_REPOSITORY_FORMAT_VERSIONS,\n minimumGitVersion: MINIMUM_GIT_VERSION,\n outputSchemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n packageMetadata: input.packageMetadata,\n });\n","// maximum bytes accepted from each Git discovery output stream\nexport const MAX_GIT_DISCOVERY_OUTPUT_BYTES = 262_144;\n","import path from 'node:path';\nimport process from 'node:process';\n\nimport { hasOnlyUnicodeScalarValues } from '../command-line/index.js';\n\nimport { MAX_GIT_DISCOVERY_OUTPUT_BYTES } from './constants.js';\n\nconst UTF8_BYTE_ORDER_MARK = [0xef, 0xbb, 0xbf] as const;\n\n/**\n * Decodes one bounded Git output value as strict UTF-8.\n * @param output The raw Git output bytes.\n * @returns The exact decoded value, or null when invalid.\n */\nconst decodeGitOutput = (output: Uint8Array): string | null => {\n if (\n output.byteLength === 0 ||\n output.byteLength > MAX_GIT_DISCOVERY_OUTPUT_BYTES ||\n UTF8_BYTE_ORDER_MARK.every((byte, index) => output[index] === byte)\n ) {\n return null;\n }\n\n let decodedOutput: string;\n\n try {\n decodedOutput = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(output);\n } catch {\n return null;\n }\n\n if (decodedOutput.includes('\\0') || !hasOnlyUnicodeScalarValues(decodedOutput)) {\n return null;\n }\n\n return decodedOutput;\n};\n\n/**\n * Parses Git's canonical boolean output.\n * @param output The raw bounded Git stdout bytes.\n * @returns The parsed boolean, or null when the output is not canonical.\n */\nexport const parseGitBooleanOutput = (output: Uint8Array): boolean | null => {\n const decodedOutput = decodeGitOutput(output);\n\n if (decodedOutput === 'true\\n' || decodedOutput === 'true\\r\\n') {\n return true;\n }\n\n if (decodedOutput === 'false\\n' || decodedOutput === 'false\\r\\n') {\n return false;\n }\n\n return null;\n};\n\n/**\n * Parses one nonempty path returned by Git.\n * @param output The raw bounded Git stdout bytes.\n * @returns The exact relative or absolute path, or null when the output is invalid.\n */\nexport const parseGitPathOutput = (output: Uint8Array): string | null => {\n const decodedOutput = decodeGitOutput(output);\n\n if (decodedOutput === null || !decodedOutput.endsWith('\\n')) {\n return null;\n }\n\n const gitPath =\n process.platform === 'win32' && decodedOutput.endsWith('\\r\\n')\n ? decodedOutput.slice(0, -2)\n : decodedOutput.slice(0, -1);\n\n return gitPath.length === 0 ? null : gitPath;\n};\n\n/**\n * Parses one absolute path returned by Git.\n * @param output The raw bounded Git stdout bytes.\n * @returns The exact absolute path, or null when the output is invalid.\n */\nexport const parseGitAbsolutePathOutput = (output: Uint8Array): string | null => {\n const gitPath = parseGitPathOutput(output);\n\n if (gitPath === null || !path.isAbsolute(gitPath)) {\n return null;\n }\n\n return gitPath;\n};\n","import { stat } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport {\n hasOnlyUnicodeScalarValues,\n isRepositoryDirectoryInputValid,\n} from '../command-line/index.js';\n\nimport type {\n IGitStartingDirectoryInspectionResult,\n IGitStartingDirectoryInspector,\n IGitStartingDirectoryStat,\n} from './types.js';\n\n/**\n * Maps a filesystem failure without retaining host diagnostics or paths.\n * @param error The unknown filesystem failure.\n * @returns An immutable safe discovery failure.\n */\nconst mapFilesystemFailure = (error: unknown): IGitStartingDirectoryInspectionResult => {\n const errorCode = (error as NodeJS.ErrnoException | null)?.code?.toUpperCase();\n\n if (errorCode === 'ENOENT' || errorCode === 'ENOTDIR') {\n return Object.freeze({ errorCode: 'GIT_REPOSITORY_NOT_FOUND', kind: 'failed' });\n }\n\n if (errorCode === 'EACCES' || errorCode === 'EPERM') {\n return Object.freeze({ errorCode: 'GIT_ACCESS_DENIED', kind: 'failed' });\n }\n\n return Object.freeze({ errorCode: 'GIT_COMMAND_FAILED', kind: 'failed' });\n};\n\n/**\n * Creates a starting-directory inspector around an injectable filesystem boundary.\n * @param inspectPath The filesystem stat operation.\n * @returns A safe inspector that resolves and verifies the selected directory.\n */\nexport const createGitStartingDirectoryInspector =\n (inspectPath: IGitStartingDirectoryStat = stat): IGitStartingDirectoryInspector =>\n async (input): Promise<IGitStartingDirectoryInspectionResult> => {\n if (\n !path.isAbsolute(input.invocationDirectory) ||\n input.invocationDirectory.includes('\\0') ||\n !hasOnlyUnicodeScalarValues(input.invocationDirectory) ||\n (input.repositoryDirectory !== null &&\n !isRepositoryDirectoryInputValid(input.repositoryDirectory))\n ) {\n return Object.freeze({ errorCode: 'GIT_REPOSITORY_NOT_FOUND', kind: 'failed' });\n }\n\n const selectedDirectory =\n input.repositoryDirectory === null\n ? input.invocationDirectory\n : path.isAbsolute(input.repositoryDirectory)\n ? input.repositoryDirectory\n : path.resolve(input.invocationDirectory, input.repositoryDirectory);\n\n try {\n const directoryStats = await inspectPath(selectedDirectory);\n\n if (!directoryStats.isDirectory()) {\n return Object.freeze({ errorCode: 'GIT_REPOSITORY_NOT_FOUND', kind: 'failed' });\n }\n } catch (error) {\n return mapFilesystemFailure(error);\n }\n\n return Object.freeze({ directory: selectedDirectory, kind: 'found' });\n };\n\n// default starting-directory inspection boundary\nexport const inspectGitStartingDirectory = createGitStartingDirectoryInspector();\n","import {\n executeGitProcess,\n type IGitProcessExecutor,\n type IGitProcessFailureReason,\n} from '../git-process/index.js';\nimport { createGitVersionPreflight, type IGitVersionPreflight } from '../git-version/index.js';\nimport type { IMoldeaCliGitErrorCode } from '../presentation/index.js';\n\nimport { MAX_GIT_DISCOVERY_OUTPUT_BYTES } from './constants.js';\nimport { parseGitAbsolutePathOutput, parseGitBooleanOutput } from './parser.js';\nimport { inspectGitStartingDirectory } from './starting-directory.js';\nimport type {\n IGitStartingDirectoryInspector,\n IGitWorkingTreeDiscovery,\n IGitWorkingTreeDiscoveryFailedResult,\n IGitWorkingTreeDiscoveryResult,\n} from './types.js';\n\n/** Maps a normalized Git process failure to a safe discovery error. */\nconst mapGitProcessFailure = (reason: IGitProcessFailureReason): IMoldeaCliGitErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'repository-not-found':\n return 'GIT_REPOSITORY_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'output-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Creates one immutable discovery failure. */\nconst createDiscoveryFailure = (\n errorCode: IMoldeaCliGitErrorCode,\n): IGitWorkingTreeDiscoveryFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/**\n * Creates Git working-tree discovery around injectable process and filesystem boundaries.\n * @param processExecutor The normalized Git subprocess executor.\n * @param startingDirectoryInspector The safe directory inspection boundary.\n * @param gitVersionPreflight The Git version prerequisite check.\n * @returns A working-tree discovery operation.\n */\nexport const createGitWorkingTreeDiscovery =\n (\n processExecutor: IGitProcessExecutor = executeGitProcess,\n startingDirectoryInspector: IGitStartingDirectoryInspector = inspectGitStartingDirectory,\n gitVersionPreflight: IGitVersionPreflight = createGitVersionPreflight(processExecutor),\n ): IGitWorkingTreeDiscovery =>\n async (input): Promise<IGitWorkingTreeDiscoveryResult> => {\n const startingDirectoryResult = await startingDirectoryInspector(input);\n\n if (startingDirectoryResult.kind === 'failed') {\n return createDiscoveryFailure(startingDirectoryResult.errorCode);\n }\n\n const workTreeResult = await processExecutor({\n arguments: ['-C', startingDirectoryResult.directory, 'rev-parse', '--is-inside-work-tree'],\n maxBufferBytes: MAX_GIT_DISCOVERY_OUTPUT_BYTES,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (workTreeResult.kind === 'failed') {\n return createDiscoveryFailure(mapGitProcessFailure(workTreeResult.reason));\n }\n\n if (workTreeResult.stderr.byteLength > 0) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n const isInsideWorkTree = parseGitBooleanOutput(workTreeResult.stdout);\n\n if (isInsideWorkTree === null) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n if (!isInsideWorkTree) {\n return createDiscoveryFailure('GIT_WORK_TREE_REQUIRED');\n }\n\n const rootResult = await processExecutor({\n arguments: ['-C', startingDirectoryResult.directory, 'rev-parse', '--show-toplevel'],\n maxBufferBytes: MAX_GIT_DISCOVERY_OUTPUT_BYTES,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (rootResult.kind === 'failed') {\n return createDiscoveryFailure(mapGitProcessFailure(rootResult.reason));\n }\n\n if (rootResult.stderr.byteLength > 0) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n const repositoryRoot = parseGitAbsolutePathOutput(rootResult.stdout);\n\n if (repositoryRoot === null) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n const rootDirectoryResult = await startingDirectoryInspector({\n invocationDirectory: startingDirectoryResult.directory,\n repositoryDirectory: repositoryRoot,\n });\n\n if (rootDirectoryResult.kind === 'failed') {\n return createDiscoveryFailure(rootDirectoryResult.errorCode);\n }\n\n const versionResult = await gitVersionPreflight(input.signal);\n\n if (versionResult.kind === 'failed') {\n return createDiscoveryFailure(versionResult.errorCode);\n }\n\n const sparseCheckoutResult = await processExecutor({\n arguments: [\n '-C',\n rootDirectoryResult.directory,\n 'config',\n '--type=bool',\n '--default=false',\n '--get',\n 'core.sparseCheckout',\n ],\n maxBufferBytes: MAX_GIT_DISCOVERY_OUTPUT_BYTES,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (sparseCheckoutResult.kind === 'failed') {\n return createDiscoveryFailure(mapGitProcessFailure(sparseCheckoutResult.reason));\n }\n\n if (sparseCheckoutResult.stderr.byteLength > 0) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n const isSparseCheckout = parseGitBooleanOutput(sparseCheckoutResult.stdout);\n\n if (isSparseCheckout === null) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n if (isSparseCheckout) {\n return createDiscoveryFailure('GIT_SPARSE_CHECKOUT_UNSUPPORTED');\n }\n\n return Object.freeze({ kind: 'discovered', repositoryRoot });\n };\n\n// default Git working-tree discovery used by command execution\nexport const discoverGitWorkingTree = createGitWorkingTreeDiscovery();\n","import path from 'node:path';\n\nimport type { IHostPathIdentity, IHostPathOperations } from './types.js';\n\n/**\n * Determines whether two absolute path spellings identify the same host path.\n * @param left The first host path.\n * @param right The second host path.\n * @param hostPathOperations The platform path operations used for comparison.\n * @returns Whether the paths are equivalent under the selected host semantics.\n */\nexport const areHostPathsEquivalent = (\n left: string,\n right: string,\n hostPathOperations: IHostPathOperations = path,\n): boolean =>\n hostPathOperations.relative(\n hostPathOperations.resolve(left),\n hostPathOperations.resolve(right),\n ) === '';\n\n/**\n * Determines whether two observations identify the same filesystem entry.\n * @param left The first filesystem observation.\n * @param right The second filesystem observation.\n * @returns Whether both observations have the same nonzero device and inode identity.\n */\nexport const haveSameHostPathIdentity = (\n left: IHostPathIdentity,\n right: IHostPathIdentity,\n): boolean => left.ino !== 0n && left.dev === right.dev && left.ino === right.ino;\n","import { haveSameHostPathIdentity } from '../../host-path-identity/index.js';\n\nimport type { IGitWorkingTreeIdentity, IGitWorkingTreeIdentityLocation } from './types.js';\n\n/** Determines whether two locations denote the same directory despite host-path aliases. */\nconst areLocationsEqual = (\n left: IGitWorkingTreeIdentityLocation,\n right: IGitWorkingTreeIdentityLocation,\n): boolean => haveSameHostPathIdentity(left, right);\n\n/**\n * Determines whether two observations identify the same working tree and Git repository.\n * @param left The pinned working-tree identity.\n * @param right The identity observed before a snapshot attempt.\n * @returns Whether the root, worktree Git directory, and common directory all match.\n */\nexport const areGitWorkingTreeIdentitiesEqual = (\n left: IGitWorkingTreeIdentity,\n right: IGitWorkingTreeIdentity,\n): boolean =>\n areLocationsEqual(left.repositoryRoot, right.repositoryRoot) &&\n areLocationsEqual(left.gitDirectory, right.gitDirectory) &&\n areLocationsEqual(left.commonDirectory, right.commonDirectory);\n","// fixed Git queries used to establish one working-tree identity\nexport const GIT_WORKING_TREE_IDENTITY_ARGUMENTS = Object.freeze({\n CommonDirectory: Object.freeze(['rev-parse', '--git-common-dir']),\n GitDirectory: Object.freeze(['rev-parse', '--absolute-git-dir']),\n RepositoryRoot: Object.freeze(['rev-parse', '--show-toplevel']),\n});\n","import { stat } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport { hasOnlyUnicodeScalarValues } from '../../command-line/index.js';\nimport {\n executeGitProcess,\n type IGitProcessExecutor,\n type IGitProcessFailureReason,\n} from '../../git-process/index.js';\nimport {\n areHostPathsEquivalent,\n haveSameHostPathIdentity,\n} from '../../host-path-identity/index.js';\nimport type { IMoldeaCliGitErrorCode } from '../../presentation/index.js';\nimport { MAX_GIT_DISCOVERY_OUTPUT_BYTES } from '../constants.js';\nimport { parseGitAbsolutePathOutput, parseGitPathOutput } from '../parser.js';\n\nimport { GIT_WORKING_TREE_IDENTITY_ARGUMENTS } from './constants.js';\nimport type {\n IGitWorkingTreeIdentityInspectionFailedResult,\n IGitWorkingTreeIdentityInspectionResult,\n IGitWorkingTreeIdentityInspector,\n IGitWorkingTreeIdentityLocation,\n IGitWorkingTreeIdentityStat,\n} from './types.js';\n\n/** Reads one followed directory identity with bigint filesystem fields. */\nconst inspectDirectoryIdentity: IGitWorkingTreeIdentityStat = async (hostPath) =>\n stat(hostPath, { bigint: true });\n\n/** Creates one immutable identity-inspection failure. */\nconst createInspectionFailure = (\n errorCode: IMoldeaCliGitErrorCode,\n): IGitWorkingTreeIdentityInspectionFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps one normalized Git process failure to the discovery error contract. */\nconst mapGitProcessFailure = (reason: IGitProcessFailureReason): IMoldeaCliGitErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'repository-not-found':\n return 'GIT_REPOSITORY_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'output-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Maps one private filesystem failure without exposing its host diagnostics. */\nconst mapFilesystemFailure = (error: unknown): IMoldeaCliGitErrorCode => {\n let errorCode: string | undefined;\n\n try {\n if (typeof error === 'object' && error !== null && 'code' in error) {\n const unknownCode: unknown = error.code;\n\n errorCode = typeof unknownCode === 'string' ? unknownCode.toUpperCase() : undefined;\n }\n } catch {\n return 'GIT_COMMAND_FAILED';\n }\n\n if (errorCode === 'ENOENT' || errorCode === 'ENOTDIR') {\n return 'GIT_REPOSITORY_NOT_FOUND';\n }\n\n if (errorCode === 'EACCES' || errorCode === 'EPERM') {\n return 'GIT_ACCESS_DENIED';\n }\n\n return 'GIT_COMMAND_FAILED';\n};\n\n/** Executes one bounded Git identity-path query. */\nconst queryGitPath = async (\n processExecutor: IGitProcessExecutor,\n repositoryRoot: string,\n arguments_: readonly string[],\n isAbsoluteRequired: boolean,\n signal?: AbortSignal,\n): Promise<string | IGitWorkingTreeIdentityInspectionFailedResult> => {\n const result = await processExecutor({\n arguments: ['-C', repositoryRoot, ...arguments_],\n maxBufferBytes: MAX_GIT_DISCOVERY_OUTPUT_BYTES,\n ...(signal === undefined ? {} : { signal }),\n });\n\n if (result.kind === 'failed') {\n return createInspectionFailure(mapGitProcessFailure(result.reason));\n }\n\n if (result.stderr.byteLength > 0) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const gitPath = isAbsoluteRequired\n ? parseGitAbsolutePathOutput(result.stdout)\n : parseGitPathOutput(result.stdout);\n\n return gitPath ?? createInspectionFailure('GIT_OUTPUT_INVALID');\n};\n\n/** Captures one directory path and stable filesystem identity. */\nconst captureLocation = async (\n inspectPath: IGitWorkingTreeIdentityStat,\n hostPath: string,\n invalidTypeCode: IMoldeaCliGitErrorCode,\n): Promise<IGitWorkingTreeIdentityLocation | IGitWorkingTreeIdentityInspectionFailedResult> => {\n try {\n const statistics = await inspectPath(hostPath);\n\n if (!statistics.isDirectory() || statistics.ino === 0n) {\n return createInspectionFailure(invalidTypeCode);\n }\n\n return Object.freeze({ dev: statistics.dev, ino: statistics.ino, path: hostPath });\n } catch (error) {\n return createInspectionFailure(mapFilesystemFailure(error));\n }\n};\n\n/** Determines whether an identity helper returned a safe failure. */\nconst isInspectionFailure = (\n result: string | IGitWorkingTreeIdentityLocation | IGitWorkingTreeIdentityInspectionFailedResult,\n): result is IGitWorkingTreeIdentityInspectionFailedResult =>\n typeof result === 'object' && 'kind' in result && result.kind === 'failed';\n\n/**\n * Creates a bounded working-tree identity inspector around Git and filesystem boundaries.\n * @param processExecutor The sanitized bounded Git process executor.\n * @param inspectPath The followed directory identity operation.\n * @returns An inspector that captures one private immutable identity.\n */\nexport const createGitWorkingTreeIdentityInspector = (\n processExecutor: IGitProcessExecutor = executeGitProcess,\n inspectPath: IGitWorkingTreeIdentityStat = inspectDirectoryIdentity,\n): IGitWorkingTreeIdentityInspector => {\n return async (input): Promise<IGitWorkingTreeIdentityInspectionResult> => {\n if (\n !path.isAbsolute(input.repositoryRoot) ||\n input.repositoryRoot.includes('\\0') ||\n !hasOnlyUnicodeScalarValues(input.repositoryRoot)\n ) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const discoveredRoot = await queryGitPath(\n processExecutor,\n input.repositoryRoot,\n GIT_WORKING_TREE_IDENTITY_ARGUMENTS.RepositoryRoot,\n true,\n input.signal,\n );\n\n if (isInspectionFailure(discoveredRoot)) {\n return discoveredRoot;\n }\n\n const repositoryRoot = await captureLocation(\n inspectPath,\n discoveredRoot,\n 'GIT_WORK_TREE_REQUIRED',\n );\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (isInspectionFailure(repositoryRoot)) {\n return repositoryRoot;\n }\n\n if (!areHostPathsEquivalent(discoveredRoot, input.repositoryRoot)) {\n const selectedRepositoryRoot = await captureLocation(\n inspectPath,\n input.repositoryRoot,\n 'GIT_WORK_TREE_REQUIRED',\n );\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (isInspectionFailure(selectedRepositoryRoot)) {\n return selectedRepositoryRoot;\n }\n\n if (!haveSameHostPathIdentity(repositoryRoot, selectedRepositoryRoot)) {\n return Object.freeze({ kind: 'mismatched' });\n }\n }\n\n const gitDirectoryPath = await queryGitPath(\n processExecutor,\n input.repositoryRoot,\n GIT_WORKING_TREE_IDENTITY_ARGUMENTS.GitDirectory,\n true,\n input.signal,\n );\n\n if (isInspectionFailure(gitDirectoryPath)) {\n return gitDirectoryPath;\n }\n\n const commonDirectoryOutput = await queryGitPath(\n processExecutor,\n input.repositoryRoot,\n GIT_WORKING_TREE_IDENTITY_ARGUMENTS.CommonDirectory,\n false,\n input.signal,\n );\n\n if (isInspectionFailure(commonDirectoryOutput)) {\n return commonDirectoryOutput;\n }\n\n const commonDirectoryPath = path.isAbsolute(commonDirectoryOutput)\n ? commonDirectoryOutput\n : path.resolve(input.repositoryRoot, commonDirectoryOutput);\n const gitDirectory = await captureLocation(inspectPath, gitDirectoryPath, 'GIT_OUTPUT_INVALID');\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (isInspectionFailure(gitDirectory)) {\n return gitDirectory;\n }\n\n const commonDirectory = await captureLocation(\n inspectPath,\n commonDirectoryPath,\n 'GIT_OUTPUT_INVALID',\n );\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (isInspectionFailure(commonDirectory)) {\n return commonDirectory;\n }\n\n return Object.freeze({\n identity: Object.freeze({ commonDirectory, gitDirectory, repositoryRoot }),\n kind: 'inspected',\n });\n };\n};\n\n// default identity inspector used by snapshot execution\nexport const inspectGitWorkingTreeIdentity = createGitWorkingTreeIdentityInspector();\n","import { RepositorySourceException, type IRepositoryPath } from '@moldea.ai/repository';\n\n/** Identifies a guarded logical file whose working-tree bytes are unsafe to inspect. */\nexport class GitContentTransformUnsupportedException extends RepositorySourceException {\n /** Creates the CLI-owned marker on the common repository-source failure boundary. */\n public constructor(path: IRepositoryPath) {\n super({\n code: 'SOURCE_UNAVAILABLE',\n operation: 'read-file',\n path,\n retryable: false,\n });\n this.name = 'GitContentTransformUnsupportedException';\n }\n}\n","import {\n REPOSITORY_ROOT,\n RepositorySourceException,\n parseRepositoryPath,\n type IRepositoryEntry,\n type IRepositoryListOptions,\n type IRepositoryOperationOptions,\n type IRepositoryPath,\n type IRepositoryReader,\n} from '@moldea.ai/repository';\n\nimport { GitContentTransformUnsupportedException } from './exception.js';\n\n/** Throws the common cancellation contract for one guard-owned read step. */\nconst throwIfAborted = (signal: AbortSignal | undefined, path: IRepositoryPath): void => {\n if (!signal?.aborted) {\n return;\n }\n\n throw new RepositorySourceException({\n cause: signal.reason,\n code: 'ABORTED',\n operation: 'read-file',\n path,\n retryable: false,\n });\n};\n\n/** Creates the common failure for contradictory underlying lookup data. */\nconst createInvalidSourceException = (path: IRepositoryPath): RepositorySourceException =>\n new RepositorySourceException({\n code: 'INVALID_SOURCE_DATA',\n operation: 'read-file',\n path,\n retryable: false,\n });\n\n// immutable guarded-read view over one coherent logical repository reader\nclass GitContentTransformationGuardRepositoryReader implements IRepositoryReader {\n readonly #guardedPaths: ReadonlySet<IRepositoryPath>;\n\n readonly #reader: IRepositoryReader;\n\n public constructor(reader: IRepositoryReader, guardedPaths: ReadonlySet<IRepositoryPath>) {\n this.#reader = reader;\n this.#guardedPaths = guardedPaths;\n }\n\n /**\n * Looks up an entry without changing the underlying logical inventory.\n * @param path The validated repository path to inspect.\n * @param options Optional cancellation controls.\n * @returns A promise resolving to the underlying detached entry or confirmed absence.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path 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 * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public getEntry(\n path: IRepositoryPath,\n options?: IRepositoryOperationOptions,\n ): Promise<IRepositoryEntry | null> {\n return this.#reader.getEntry(path, options);\n }\n\n /**\n * Reads ordinary files while refusing guarded logical regular-file bytes.\n * @param path The validated repository file path to read.\n * @param options Optional cancellation controls.\n * @returns A promise resolving to fresh bytes for an unguarded regular file.\n * @throws\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 * - ACCESS_DENIED: Access to the repository source was denied.\n * - SOURCE_UNAVAILABLE: The repository source is unavailable or its regular file uses an unsupported Git content transformation.\n * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.\n * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public async readFile(\n path: IRepositoryPath,\n options?: IRepositoryOperationOptions,\n ): Promise<Uint8Array> {\n const parsedPath = parseRepositoryPath(path);\n\n if (!this.#guardedPaths.has(parsedPath)) {\n return this.#reader.readFile(parsedPath, options);\n }\n\n throwIfAborted(options?.signal, parsedPath);\n\n const entry = await this.#reader.getEntry(parsedPath, options);\n\n throwIfAborted(options?.signal, parsedPath);\n\n if (\n entry !== null &&\n (entry.path !== parsedPath ||\n (entry.type !== 'file' && entry.type !== 'directory' && entry.type !== 'symlink'))\n ) {\n throw createInvalidSourceException(parsedPath);\n }\n\n if (entry?.type !== 'file') {\n return this.#reader.readFile(parsedPath, options);\n }\n\n throw new GitContentTransformUnsupportedException(parsedPath);\n }\n\n /**\n * Recursively lists entries without changing the underlying logical inventory.\n * @param options Optional prefix and cancellation controls.\n * @returns The underlying async iterable of detached repository entries.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - ENTRY_NOT_FOUND: The requested repository entry was not found.\n * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.\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 * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public listEntries(options?: IRepositoryListOptions): AsyncIterable<IRepositoryEntry> {\n return this.#reader.listEntries(options);\n }\n}\n\n/**\n * Creates an immutable reader that blocks bytes for Git transform-guarded logical files.\n * @param reader The coherent reader after logical Git entry-type overlays are applied.\n * @param guardedPaths The paths whose working-tree bytes may differ from Git content.\n * @returns A reader preserving inventory semantics while refusing guarded regular-file reads.\n * @throws\n * - INVALID_REPOSITORY_PATH: A guarded repository path is invalid.\n * - INVALID_SOURCE_DATA: The repository root was supplied as a guarded file path.\n */\nexport const createGitContentTransformationGuardRepositoryReader = (\n reader: IRepositoryReader,\n guardedPaths: readonly IRepositoryPath[],\n): IRepositoryReader => {\n const parsedGuardedPaths = new Set<IRepositoryPath>();\n\n for (const guardedPath of guardedPaths) {\n const parsedPath = parseRepositoryPath(guardedPath);\n\n if (parsedPath === REPOSITORY_ROOT) {\n throw new RepositorySourceException({\n code: 'INVALID_SOURCE_DATA',\n operation: 'create-reader',\n path: parsedPath,\n retryable: false,\n });\n }\n\n parsedGuardedPaths.add(parsedPath);\n }\n\n return Object.freeze(\n new GitContentTransformationGuardRepositoryReader(reader, parsedGuardedPaths),\n );\n};\n","import type { ICoreConfigurationErrorCode, ICoreOperationErrorCode } from '@moldea.ai/core';\nimport type { IRepositorySourceErrorCode } from '@moldea.ai/repository';\n\n// safe messages for common repository-source failures\nexport const REPOSITORY_SOURCE_ERROR_MESSAGES = Object.freeze({\n ABORTED: 'The repository operation was aborted.',\n ACCESS_DENIED: 'Access to the repository source was denied.',\n ENTRY_NOT_DIRECTORY: 'The requested repository entry is not a directory.',\n ENTRY_NOT_FILE: 'The requested repository entry is not a file.',\n ENTRY_NOT_FOUND: 'The requested repository entry was not found.',\n INVALID_SOURCE_DATA: 'The repository source returned invalid data.',\n RESOURCE_LIMIT_EXCEEDED: 'A repository reading resource limit was exceeded.',\n SNAPSHOT_CHANGED: 'The repository snapshot changed during the operation.',\n SOURCE_UNAVAILABLE: 'The repository source is unavailable.',\n} as const satisfies Readonly<Record<IRepositorySourceErrorCode, string>>);\n\n// safe messages for Core configuration failures\nexport const CORE_CONFIGURATION_ERROR_MESSAGES = Object.freeze({\n DUPLICATE_ADAPTER_ID: 'A runtime adapter ID is registered more than once.',\n INVALID_ADAPTER_DEFINITION: 'A runtime adapter definition is invalid.',\n INVALID_RESOURCE_LIMIT: 'A Core resource limit is invalid.',\n RESERVED_ADAPTER_ID: 'A reserved runtime adapter ID was supplied.',\n} as const satisfies Readonly<Record<ICoreConfigurationErrorCode, string>>);\n\n// safe messages for Core operation failures\nexport const CORE_OPERATION_ERROR_MESSAGES = Object.freeze({\n ABORTED: 'The Core operation was aborted.',\n ADAPTER_EXECUTION_FAILED: 'A runtime adapter failed during inspection.',\n INVALID_ARGUMENT: 'The Core operation received an invalid argument.',\n RESOURCE_LIMIT_EXCEEDED: 'A Core resource limit was exceeded.',\n} as const satisfies Readonly<Record<ICoreOperationErrorCode, string>>);\n","import { CoreConfigurationException, CoreOperationException } from '@moldea.ai/core';\nimport { isRepositoryPath, RepositorySourceException } from '@moldea.ai/repository';\n\nimport { GitContentTransformUnsupportedException } from '../repository-content-transformation-guard/index.js';\nimport { createMoldeaCliOwnedError, type IMoldeaCliError } from '../presentation/index.js';\n\nimport {\n CORE_CONFIGURATION_ERROR_MESSAGES,\n CORE_OPERATION_ERROR_MESSAGES,\n REPOSITORY_SOURCE_ERROR_MESSAGES,\n} from './constants.js';\n\nconst EMPTY_ERROR_DETAILS = Object.freeze({});\n\n/** Creates frozen safe Core metadata without retaining null fields. */\nconst createCoreErrorDetails = (\n error: CoreConfigurationException | CoreOperationException,\n): Readonly<Record<string, string>> => {\n const details: Record<string, string> = { operation: error.operation };\n\n if (error.adapterId !== null) {\n details['adapterId'] = error.adapterId;\n }\n\n if (error instanceof CoreOperationException) {\n if (error.agentId !== null) {\n details['agentId'] = error.agentId;\n }\n\n if (error.limit !== null) {\n details['limit'] = error.limit;\n }\n }\n\n return Object.freeze(details);\n};\n\n/**\n * Maps a known package exception or unknown failure to one safe CLI error object.\n * @param error The failure that escaped command composition.\n * @returns A complete immutable operational error without causes or private host data.\n */\nexport const mapMoldeaCliOperationalError = (error: unknown): IMoldeaCliError => {\n if (error instanceof GitContentTransformUnsupportedException) {\n return Object.freeze({\n ...createMoldeaCliOwnedError('GIT_CONTENT_TRANSFORM_UNSUPPORTED'),\n path: isRepositoryPath(error.path) ? error.path : null,\n });\n }\n\n if (error instanceof RepositorySourceException) {\n return Object.freeze({\n code: error.code,\n details: EMPTY_ERROR_DETAILS,\n message: REPOSITORY_SOURCE_ERROR_MESSAGES[error.code],\n path: error.path !== null && isRepositoryPath(error.path) ? error.path : null,\n retryable: error.retryable,\n source: 'repository',\n });\n }\n\n if (error instanceof CoreConfigurationException) {\n return Object.freeze({\n code: error.code,\n details: createCoreErrorDetails(error),\n message: CORE_CONFIGURATION_ERROR_MESSAGES[error.code],\n path: null,\n retryable: false,\n source: 'core',\n });\n }\n\n if (error instanceof CoreOperationException) {\n return Object.freeze({\n code: error.code,\n details: createCoreErrorDetails(error),\n message: CORE_OPERATION_ERROR_MESSAGES[error.code],\n path: null,\n retryable: error.retryable,\n source: 'core',\n });\n }\n\n return createMoldeaCliOwnedError('INTERNAL_ERROR');\n};\n","// fixed read-only Git commands used to enumerate raw working-tree candidates\nexport const GIT_TRACKED_INVENTORY_ARGUMENTS = [\n 'ls-files',\n '--cached',\n '--stage',\n '--full-name',\n '--no-abbrev',\n '--no-recurse-submodules',\n '-z',\n '--',\n] as const;\n\nexport const GIT_UNTRACKED_INVENTORY_ARGUMENTS = [\n 'ls-files',\n '--others',\n '--exclude-standard',\n '--full-name',\n '--no-recurse-submodules',\n '-z',\n '--',\n] as const;\n\n// Git index modes accepted by the version 1 inventory grammar\nexport const GIT_TRACKED_ENTRY_MODES = ['100644', '100755', '120000', '160000'] as const;\n","// Git attributes required to classify working-tree content transformations\nexport const GIT_CONTENT_TRANSFORMATION_ATTRIBUTES = [\n 'filter',\n 'working-tree-encoding',\n 'ident',\n] as const;\n\n// fixed read-only Git command used for NUL-delimited attribute inspection\nexport const GIT_CONTENT_TRANSFORMATION_ARGUMENTS = [\n 'check-attr',\n '--stdin',\n '-z',\n ...GIT_CONTENT_TRANSFORMATION_ATTRIBUTES,\n] as const;\n","import { GIT_CONTENT_TRANSFORMATION_ATTRIBUTES } from './constants.js';\nimport type {\n IGitContentTransformationAttribute,\n IGitContentTransformationAttributeValues,\n IGitContentTransformationParsedAttributes,\n IGitContentTransformationParser,\n IGitContentTransformationParserInput,\n IGitContentTransformationParserResult,\n} from './types.js';\n\ninterface IMutableAttributeValues {\n filter?: string;\n ident?: string;\n workingTreeEncoding?: string;\n}\n\n/** Concatenates one complete NUL-delimited field assembled across process chunks. */\nconst concatenateField = (fragments: readonly Uint8Array[], byteLength: number): Uint8Array => {\n const field = new Uint8Array(byteLength);\n let offset = 0;\n\n for (const fragment of fragments) {\n field.set(fragment, offset);\n offset += fragment.byteLength;\n }\n\n return field;\n};\n\n/** Decodes one Git attribute field as strict UTF-8 while preserving an initial BOM scalar. */\nconst decodeField = (field: Uint8Array): string | null => {\n try {\n return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(field);\n } catch {\n return null;\n }\n};\n\n/** Resolves one exact supported attribute name without accepting aliases. */\nconst resolveAttribute = (candidate: string): IGitContentTransformationAttribute | null => {\n return GIT_CONTENT_TRANSFORMATION_ATTRIBUTES.find((attribute) => attribute === candidate) ?? null;\n};\n\n/** Stores one exact Git value while rejecting duplicate attribute records. */\nconst storeAttribute = (\n values: IMutableAttributeValues,\n attribute: IGitContentTransformationAttribute,\n value: string,\n): boolean => {\n const property = attribute === 'working-tree-encoding' ? 'workingTreeEncoding' : attribute;\n\n if (Object.hasOwn(values, property)) {\n return false;\n }\n\n values[property] = value;\n return true;\n};\n\n/** Confirms that all three required effective attribute values were received. */\nconst hasCompleteValues = (\n values: IMutableAttributeValues,\n): values is IGitContentTransformationAttributeValues =>\n Object.hasOwn(values, 'filter') &&\n Object.hasOwn(values, 'ident') &&\n Object.hasOwn(values, 'workingTreeEncoding');\n\n/**\n * Creates a strict parser for NUL-delimited `git check-attr` triples.\n * @param input The exact paths whose three effective attributes must be present.\n * @returns An incremental all-or-nothing parser.\n */\nexport const createGitContentTransformationParser = (\n input: IGitContentTransformationParserInput,\n): IGitContentTransformationParser => {\n const paths = [...input.paths];\n const valuesByPath = new Map<string, IMutableAttributeValues>();\n let fields: Uint8Array[] = [];\n let isFailed = false;\n let pendingByteLength = 0;\n let pendingFragments: Uint8Array[] = [];\n\n for (const path of paths) {\n if (path.length === 0 || path.includes('\\u0000') || valuesByPath.has(path)) {\n isFailed = true;\n continue;\n }\n\n valuesByPath.set(path, {});\n }\n\n const consumeRecord = (): void => {\n if (isFailed || fields.length !== 3) {\n return;\n }\n\n const path = decodeField(fields[0] ?? new Uint8Array());\n const attributeCandidate = decodeField(fields[1] ?? new Uint8Array());\n const value = decodeField(fields[2] ?? new Uint8Array());\n\n fields = [];\n\n if (path === null || attributeCandidate === null || value === null) {\n isFailed = true;\n return;\n }\n\n const attribute = resolveAttribute(attributeCandidate);\n const values = valuesByPath.get(path);\n\n if (attribute === null || values === undefined || !storeAttribute(values, attribute, value)) {\n isFailed = true;\n }\n };\n\n const consumeField = (): void => {\n if (isFailed) {\n return;\n }\n\n fields.push(concatenateField(pendingFragments, pendingByteLength));\n pendingByteLength = 0;\n pendingFragments = [];\n\n if (fields.length === 3) {\n consumeRecord();\n }\n };\n\n return {\n consume: (chunk): void => {\n if (isFailed) {\n return;\n }\n\n let fragmentStart = 0;\n\n for (let index = 0; index < chunk.byteLength; index += 1) {\n if (chunk[index] !== 0x00) {\n continue;\n }\n\n const fragment = chunk.subarray(fragmentStart, index);\n\n pendingFragments.push(Uint8Array.from(fragment));\n pendingByteLength += fragment.byteLength;\n consumeField();\n\n if (isFailed) {\n return;\n }\n\n fragmentStart = index + 1;\n }\n\n const trailingFragment = chunk.subarray(fragmentStart);\n\n if (trailingFragment.byteLength > 0) {\n pendingFragments.push(Uint8Array.from(trailingFragment));\n pendingByteLength += trailingFragment.byteLength;\n }\n },\n finish: (): IGitContentTransformationParserResult => {\n if (isFailed || pendingByteLength > 0 || fields.length > 0) {\n return Object.freeze({ kind: 'failed' });\n }\n\n const attributes: IGitContentTransformationParsedAttributes[] = [];\n\n for (const path of paths) {\n const values = valuesByPath.get(path);\n\n if (values === undefined || !hasCompleteValues(values)) {\n return Object.freeze({ kind: 'failed' });\n }\n\n attributes.push(\n Object.freeze({\n filter: values.filter,\n ident: values.ident,\n path,\n workingTreeEncoding: values.workingTreeEncoding,\n }),\n );\n }\n\n return Object.freeze({ attributes: Object.freeze(attributes), kind: 'completed' });\n },\n };\n};\n","import {\n executeGitStreamingProcess,\n MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n type IGitStreamingProcessExecutor,\n type IGitStreamingProcessFailureReason,\n} from '../../git-process/index.js';\nimport type { IGitInventoryProbeErrorCode } from '../types.js';\n\nimport { GIT_CONTENT_TRANSFORMATION_ARGUMENTS } from './constants.js';\nimport { createGitContentTransformationParser } from './parser.js';\nimport type {\n IGitContentTransformationClassification,\n IGitContentTransformationClassificationFailedResult,\n IGitContentTransformationClassificationResult,\n IGitContentTransformationClassifier,\n} from './types.js';\n\n/** Creates one immutable content-transformation classification failure. */\nconst createClassificationFailure = (\n errorCode: IGitInventoryProbeErrorCode,\n): IGitContentTransformationClassificationFailedResult =>\n Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps one bounded Git attribute failure to the existing safe inventory contract. */\nconst mapGitProcessFailure = (\n reason: IGitStreamingProcessFailureReason,\n): IGitInventoryProbeErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'repository-not-found':\n return 'GIT_REPOSITORY_NOT_FOUND';\n case 'output-limit-exceeded':\n case 'stdout-limit-exceeded':\n return 'RESOURCE_LIMIT_EXCEEDED';\n case 'stderr-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Determines whether one effective attribute value requires guarded reads. */\nconst isGuardedAttributeValue = (attributeValue: string): boolean =>\n attributeValue !== 'unset' && attributeValue !== 'unspecified';\n\n/** Encodes exact Git-relative paths as NUL-delimited stdin without shell interpretation. */\nconst encodePaths = (paths: readonly string[]): Uint8Array | null => {\n const encoder = new TextEncoder();\n const encodedPaths: Uint8Array[] = [];\n let byteLength = 0;\n\n for (const path of paths) {\n if (path.length === 0 || path.includes('\\u0000')) {\n return null;\n }\n\n const encodedPath = encoder.encode(path);\n\n if (!Number.isSafeInteger(byteLength + encodedPath.byteLength + 1)) {\n return null;\n }\n\n encodedPaths.push(encodedPath);\n byteLength += encodedPath.byteLength + 1;\n }\n\n const stdin = new Uint8Array(byteLength);\n let offset = 0;\n\n for (const encodedPath of encodedPaths) {\n stdin.set(encodedPath, offset);\n offset += encodedPath.byteLength + 1;\n }\n\n return stdin;\n};\n\n/** Builds the exact retained classification and its conservative read guard. */\nconst createClassification = (\n filter: string,\n ident: string,\n workingTreeEncoding: string,\n): IGitContentTransformationClassification =>\n Object.freeze({\n filter,\n ident,\n isGuarded:\n isGuardedAttributeValue(filter) ||\n isGuardedAttributeValue(ident) ||\n isGuardedAttributeValue(workingTreeEncoding),\n workingTreeEncoding,\n });\n\n/**\n * Creates the effective Git content-transformation classifier around a process boundary.\n * @param processExecutor The sanitized streamed Git process executor.\n * @returns An all-or-nothing bounded classifier for effective inventory entries.\n */\nexport const createGitContentTransformationClassifier = (\n processExecutor: IGitStreamingProcessExecutor = executeGitStreamingProcess,\n): IGitContentTransformationClassifier => {\n return async (input): Promise<IGitContentTransformationClassificationResult> => {\n if (input.signal?.aborted) {\n return createClassificationFailure('GIT_OPERATION_ABORTED');\n }\n\n if (!Number.isSafeInteger(input.maxMetadataBytes) || input.maxMetadataBytes < 0) {\n return createClassificationFailure('RESOURCE_LIMIT_EXCEEDED');\n }\n\n if (input.entries.length === 0) {\n return Object.freeze({ entries: Object.freeze([]), gitMetadataBytes: 0, kind: 'classified' });\n }\n\n const paths = input.entries.map((entry) => entry.path);\n const stdin = encodePaths(paths);\n\n if (stdin === null) {\n return createClassificationFailure('GIT_OUTPUT_INVALID');\n }\n\n const parser = createGitContentTransformationParser({ paths });\n let consumedStdoutBytes = 0;\n const processResult = await processExecutor({\n arguments: ['-C', input.repositoryRoot, ...GIT_CONTENT_TRANSFORMATION_ARGUMENTS],\n consumeStdout: (chunk): void => {\n consumedStdoutBytes += chunk.byteLength;\n parser.consume(chunk);\n },\n maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n maxStdoutBytes: input.maxMetadataBytes,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n stdin,\n });\n\n if (processResult.kind === 'failed') {\n return createClassificationFailure(mapGitProcessFailure(processResult.reason));\n }\n\n if (\n processResult.stderr.byteLength > 0 ||\n processResult.stdoutBytes !== consumedStdoutBytes ||\n processResult.stdoutBytes > input.maxMetadataBytes\n ) {\n return createClassificationFailure('GIT_OUTPUT_INVALID');\n }\n\n const parserResult = parser.finish();\n\n if (parserResult.kind === 'failed' || parserResult.attributes.length !== input.entries.length) {\n return createClassificationFailure('GIT_OUTPUT_INVALID');\n }\n\n const entries = input.entries.map((entry, index) => {\n const attributes = parserResult.attributes[index];\n\n if (attributes === undefined || attributes.path !== entry.path) {\n return null;\n }\n\n return Object.freeze({\n ...entry,\n contentTransformation: createClassification(\n attributes.filter,\n attributes.ident,\n attributes.workingTreeEncoding,\n ),\n });\n });\n\n if (entries.some((entry) => entry === null)) {\n return createClassificationFailure('GIT_OUTPUT_INVALID');\n }\n\n return Object.freeze({\n entries: Object.freeze(entries.filter((entry) => entry !== null)),\n gitMetadataBytes: processResult.stdoutBytes,\n kind: 'classified',\n });\n };\n};\n\n// default effective Git content-transformation classifier used by inventory probing\nexport const classifyGitContentTransformations = createGitContentTransformationClassifier();\n","import type { IGitInventoryCandidate } from '../types.js';\n\nimport type {\n ICollapsedGitInventoryCandidate,\n IGitInventoryCandidateCollapseResult,\n IGitInventoryIndexEntry,\n} from './types.js';\n\ninterface IMutableTrackedCandidate {\n readonly indexEntriesByStage: Map<number, IGitInventoryIndexEntry>;\n readonly kind: 'tracked';\n readonly path: string;\n}\n\ninterface IMutableUntrackedCandidate {\n readonly kind: 'untracked';\n readonly path: string;\n}\n\ntype IMutableCollapsedCandidate = IMutableTrackedCandidate | IMutableUntrackedCandidate;\n\n/** Creates one immutable invalid candidate-collapse result. */\nconst createCollapseFailure = (): IGitInventoryCandidateCollapseResult =>\n Object.freeze({ kind: 'failed' });\n\n/**\n * Collapses raw stage records into one deterministic candidate per exact Git path.\n * @param candidates The ownership-filtered raw candidates to collapse.\n * @returns An immutable candidate set, or failure for duplicate or contradictory state.\n */\nexport const collapseGitInventoryCandidates = (\n candidates: readonly IGitInventoryCandidate[],\n): IGitInventoryCandidateCollapseResult => {\n const candidatesByPath = new Map<string, IMutableCollapsedCandidate>();\n\n for (const candidate of candidates) {\n const existingCandidate = candidatesByPath.get(candidate.path);\n\n if (candidate.kind === 'untracked') {\n if (existingCandidate !== undefined) {\n return createCollapseFailure();\n }\n\n candidatesByPath.set(candidate.path, { kind: 'untracked', path: candidate.path });\n continue;\n }\n\n if (candidate.mode === '160000' || existingCandidate?.kind === 'untracked') {\n return createCollapseFailure();\n }\n\n const trackedCandidate = existingCandidate ?? {\n indexEntriesByStage: new Map<number, IGitInventoryIndexEntry>(),\n kind: 'tracked' as const,\n path: candidate.path,\n };\n\n if (trackedCandidate.indexEntriesByStage.has(candidate.stage)) {\n return createCollapseFailure();\n }\n\n trackedCandidate.indexEntriesByStage.set(\n candidate.stage,\n Object.freeze({ mode: candidate.mode, stage: candidate.stage }),\n );\n candidatesByPath.set(candidate.path, trackedCandidate);\n }\n\n const collapsedCandidates: ICollapsedGitInventoryCandidate[] = [];\n\n for (const candidate of candidatesByPath.values()) {\n if (candidate.kind === 'untracked') {\n collapsedCandidates.push(Object.freeze(candidate));\n continue;\n }\n\n const hasStageZero = candidate.indexEntriesByStage.has(0);\n\n if (hasStageZero && candidate.indexEntriesByStage.size !== 1) {\n return createCollapseFailure();\n }\n\n const indexEntries = [...candidate.indexEntriesByStage.values()].sort(\n (left, right) => left.stage - right.stage,\n );\n\n if (indexEntries.length === 0) {\n return createCollapseFailure();\n }\n\n collapsedCandidates.push(\n Object.freeze({\n indexEntries: Object.freeze(indexEntries),\n kind: 'tracked',\n path: candidate.path,\n }),\n );\n }\n\n return Object.freeze({ candidates: Object.freeze(collapsedCandidates), kind: 'collapsed' });\n};\n","import { lstat } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport type { IGitInventoryProbeErrorCode } from '../types.js';\n\nimport type {\n IGitInventoryEntryInspector,\n IGitInventoryEntryLstat,\n IGitInventoryHostEntryInspectionFailedResult,\n IGitInventoryHostEntryInspectionResult,\n} from './types.js';\n\n/** Creates one immutable host entry inspection failure. */\nconst createInspectionFailure = (\n errorCode: IGitInventoryProbeErrorCode,\n): IGitInventoryHostEntryInspectionFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps an unknown no-follow filesystem failure without retaining host diagnostics. */\nconst mapFilesystemFailure = (\n error: unknown,\n): IGitInventoryHostEntryInspectionFailedResult | null => {\n const errorCode = (error as NodeJS.ErrnoException | null)?.code?.toUpperCase();\n\n if (errorCode === 'ENOENT' || errorCode === 'ENOTDIR') {\n return null;\n }\n\n if (errorCode === 'EACCES' || errorCode === 'EPERM') {\n return createInspectionFailure('GIT_ACCESS_DENIED');\n }\n\n if (errorCode === 'ELOOP') {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n return createInspectionFailure('GIT_COMMAND_FAILED');\n};\n\n/** Default no-follow stat boundary for current inventory entries. */\nconst inspectHostEntry: IGitInventoryEntryLstat = async (hostPath) => lstat(hostPath);\n\n/**\n * Creates current host entry inspection around an injectable no-follow stat boundary.\n * @param inspectEntry The no-follow filesystem stat operation.\n * @returns An inspector for one ownership-filtered candidate path.\n */\nexport const createGitInventoryEntryInspector = (\n inspectEntry: IGitInventoryEntryLstat = inspectHostEntry,\n): IGitInventoryEntryInspector => {\n return async (repositoryRoot, candidatePath): Promise<IGitInventoryHostEntryInspectionResult> => {\n let statistics: Awaited<ReturnType<IGitInventoryEntryLstat>>;\n\n try {\n statistics = await inspectEntry(path.join(repositoryRoot, candidatePath));\n } catch (error) {\n const failure = mapFilesystemFailure(error);\n\n return failure ?? Object.freeze({ kind: 'missing' });\n }\n\n if (statistics.isSymbolicLink()) {\n return Object.freeze({ entryType: 'symlink', kind: 'inspected' });\n }\n\n if (statistics.isFile()) {\n return Object.freeze({ entryType: 'file', kind: 'inspected' });\n }\n\n return Object.freeze({ entryType: 'unsupported', kind: 'inspected' });\n };\n};\n\n// default no-follow current host entry inspector\nexport const inspectGitInventoryEntry = createGitInventoryEntryInspector();\n","// fixed read-only query for the effective selected-repository symlink behavior\nexport const GIT_SYMLINK_CONFIGURATION_ARGUMENTS = [\n 'config',\n '--type=bool',\n '--default=true',\n '--get',\n 'core.symlinks',\n] as const;\n","import {\n executeGitStreamingProcess,\n MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n type IGitStreamingProcessExecutor,\n type IGitStreamingProcessFailureReason,\n} from '../../git-process/index.js';\nimport { parseGitBooleanOutput } from '../../git-working-tree/index.js';\nimport type { IGitInventoryProbeErrorCode } from '../types.js';\n\nimport { GIT_SYMLINK_CONFIGURATION_ARGUMENTS } from './constants.js';\nimport type {\n IGitSymlinkConfigurationFailedResult,\n IGitSymlinkConfigurationResolver,\n IGitSymlinkConfigurationResult,\n} from './types.js';\n\n/** Creates one immutable effective symlink configuration failure. */\nconst createConfigurationFailure = (\n errorCode: IGitInventoryProbeErrorCode,\n): IGitSymlinkConfigurationFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps one bounded Git configuration failure to the existing safe CLI contract. */\nconst mapGitProcessFailure = (\n reason: IGitStreamingProcessFailureReason,\n): IGitInventoryProbeErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'output-limit-exceeded':\n case 'stdout-limit-exceeded':\n return 'RESOURCE_LIMIT_EXCEEDED';\n case 'repository-not-found':\n case 'stderr-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Concatenates already bounded Git stdout chunks for strict boolean parsing. */\nconst concatenateChunks = (chunks: readonly Uint8Array[], byteLength: number): Uint8Array => {\n const output = new Uint8Array(byteLength);\n let offset = 0;\n\n for (const chunk of chunks) {\n output.set(chunk, offset);\n offset += chunk.byteLength;\n }\n\n return output;\n};\n\n/**\n * Creates the bounded effective core.symlinks resolver around a Git process boundary.\n * @param processExecutor The sanitized streamed Git process executor.\n * @returns A resolver for the selected repository's effective symlink behavior.\n */\nexport const createGitSymlinkConfigurationResolver = (\n processExecutor: IGitStreamingProcessExecutor = executeGitStreamingProcess,\n): IGitSymlinkConfigurationResolver => {\n return async (input): Promise<IGitSymlinkConfigurationResult> => {\n if (input.signal?.aborted) {\n return createConfigurationFailure('GIT_OPERATION_ABORTED');\n }\n\n if (!Number.isSafeInteger(input.maxMetadataBytes) || input.maxMetadataBytes < 0) {\n return createConfigurationFailure('RESOURCE_LIMIT_EXCEEDED');\n }\n\n const stdoutChunks: Uint8Array[] = [];\n let consumedStdoutBytes = 0;\n const processResult = await processExecutor({\n arguments: ['-C', input.repositoryRoot, ...GIT_SYMLINK_CONFIGURATION_ARGUMENTS],\n consumeStdout: (chunk): void => {\n stdoutChunks.push(Uint8Array.from(chunk));\n consumedStdoutBytes += chunk.byteLength;\n },\n maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n maxStdoutBytes: input.maxMetadataBytes,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (processResult.kind === 'failed') {\n return createConfigurationFailure(mapGitProcessFailure(processResult.reason));\n }\n\n if (\n processResult.stderr.byteLength > 0 ||\n processResult.stdoutBytes !== consumedStdoutBytes ||\n processResult.stdoutBytes > input.maxMetadataBytes\n ) {\n return createConfigurationFailure('GIT_OUTPUT_INVALID');\n }\n\n const isEnabled = parseGitBooleanOutput(concatenateChunks(stdoutChunks, consumedStdoutBytes));\n\n if (isEnabled === null) {\n return createConfigurationFailure('GIT_OUTPUT_INVALID');\n }\n\n return Object.freeze({\n gitMetadataBytes: processResult.stdoutBytes,\n isEnabled,\n kind: 'resolved',\n });\n };\n};\n\n// default bounded effective core.symlinks resolver\nexport const resolveGitSymlinkConfiguration = createGitSymlinkConfigurationResolver();\n","import { collapseGitInventoryCandidates } from './candidate-collapser.js';\nimport { inspectGitInventoryEntry } from './entry-inspector.js';\nimport { resolveGitSymlinkConfiguration } from './symlink-configuration.js';\nimport type {\n ICollapsedGitTrackedInventoryCandidate,\n IGitEntryTypeNormalizedEntry,\n IGitInventoryEntryInspector,\n IGitInventoryEntryTypeNormalizationFailedResult,\n IGitInventoryEntryTypeNormalizationResult,\n IGitInventoryEntryTypeNormalizer,\n IGitSymlinkConfigurationResolver,\n} from './types.js';\n\n/** Creates one immutable entry-type normalization failure. */\nconst createNormalizationFailure = (\n errorCode: IGitInventoryEntryTypeNormalizationFailedResult['errorCode'],\n): IGitInventoryEntryTypeNormalizationFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Determines whether retained index metadata contains a Git symlink mode. */\nconst hasSymlinkMode = (candidate: ICollapsedGitTrackedInventoryCandidate): boolean =>\n candidate.indexEntries.some(({ mode }) => mode === '120000');\n\n/** Determines whether retained index metadata contains a Git regular-file mode. */\nconst hasRegularFileMode = (candidate: ICollapsedGitTrackedInventoryCandidate): boolean =>\n candidate.indexEntries.some(({ mode }) => mode === '100644' || mode === '100755');\n\n/**\n * Creates entry-type normalization around injectable filesystem and Git configuration boundaries.\n * @param entryInspector The no-follow current host entry inspector.\n * @param symlinkConfigurationResolver The bounded effective core.symlinks resolver.\n * @returns An all-or-nothing effective working-tree entry normalizer.\n */\nexport const createGitInventoryEntryTypeNormalizer = (\n entryInspector: IGitInventoryEntryInspector = inspectGitInventoryEntry,\n symlinkConfigurationResolver: IGitSymlinkConfigurationResolver = resolveGitSymlinkConfiguration,\n): IGitInventoryEntryTypeNormalizer => {\n return async (input): Promise<IGitInventoryEntryTypeNormalizationResult> => {\n if (input.signal?.aborted) {\n return createNormalizationFailure('GIT_OPERATION_ABORTED');\n }\n\n if (!Number.isSafeInteger(input.maxMetadataBytes) || input.maxMetadataBytes < 0) {\n return createNormalizationFailure('RESOURCE_LIMIT_EXCEEDED');\n }\n\n const collapseResult = collapseGitInventoryCandidates(input.candidates);\n\n if (collapseResult.kind === 'failed') {\n return createNormalizationFailure('GIT_OUTPUT_INVALID');\n }\n\n const entries: IGitEntryTypeNormalizedEntry[] = [];\n let symlinkConfiguration: Awaited<ReturnType<IGitSymlinkConfigurationResolver>> | null = null;\n\n for (const candidate of collapseResult.candidates) {\n if (input.signal?.aborted) {\n return createNormalizationFailure('GIT_OPERATION_ABORTED');\n }\n\n const inspectionResult = await entryInspector(input.repositoryRoot, candidate.path);\n\n if (input.signal?.aborted) {\n return createNormalizationFailure('GIT_OPERATION_ABORTED');\n }\n\n if (inspectionResult.kind === 'failed') {\n return inspectionResult;\n }\n\n if (inspectionResult.kind === 'missing') {\n continue;\n }\n\n if (inspectionResult.entryType === 'unsupported') {\n return createNormalizationFailure('GIT_OUTPUT_INVALID');\n }\n\n if (candidate.kind === 'untracked') {\n entries.push(\n Object.freeze({\n entryType: inspectionResult.entryType,\n kind: 'untracked',\n path: candidate.path,\n requiresSymlinkOverlay: false,\n }),\n );\n continue;\n }\n\n if (inspectionResult.entryType === 'symlink' || !hasSymlinkMode(candidate)) {\n entries.push(\n Object.freeze({\n entryType: inspectionResult.entryType,\n indexEntries: candidate.indexEntries,\n kind: 'tracked',\n path: candidate.path,\n requiresSymlinkOverlay: false,\n }),\n );\n continue;\n }\n\n symlinkConfiguration ??= await symlinkConfigurationResolver({\n maxMetadataBytes: input.maxMetadataBytes,\n repositoryRoot: input.repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (symlinkConfiguration.kind === 'failed') {\n return symlinkConfiguration;\n }\n\n if (\n !Number.isSafeInteger(symlinkConfiguration.gitMetadataBytes) ||\n symlinkConfiguration.gitMetadataBytes < 0 ||\n symlinkConfiguration.gitMetadataBytes > input.maxMetadataBytes\n ) {\n return createNormalizationFailure('GIT_OUTPUT_INVALID');\n }\n\n if (!symlinkConfiguration.isEnabled && hasRegularFileMode(candidate)) {\n return createNormalizationFailure('GIT_OUTPUT_INVALID');\n }\n\n const requiresSymlinkOverlay = !symlinkConfiguration.isEnabled;\n\n entries.push(\n Object.freeze({\n entryType: requiresSymlinkOverlay ? 'symlink' : 'file',\n indexEntries: candidate.indexEntries,\n kind: 'tracked',\n path: candidate.path,\n requiresSymlinkOverlay,\n }),\n );\n }\n\n return Object.freeze({\n entries: Object.freeze(entries),\n gitMetadataBytes:\n symlinkConfiguration?.kind === 'resolved' ? symlinkConfiguration.gitMetadataBytes : 0,\n kind: 'normalized',\n });\n };\n};\n\n// default effective working-tree entry-type normalizer\nexport const normalizeGitInventoryEntryTypes = createGitInventoryEntryTypeNormalizer();\n","import { isRepositoryPath, type IRepositoryPath } from '@moldea.ai/repository';\n\nimport type {\n IGitInventoryCandidateLogicalPathValidationResult,\n IGitInventoryCandidateLogicalPathValidatorInput,\n IGitInventoryEntry,\n IGitInventoryLogicalPathFailedResult,\n IGitInventoryLogicalPathCandidate,\n IGitInventoryLogicalPathNormalizationResult,\n IGitInventoryLogicalPathNormalizer,\n} from './types.js';\n\n/** Creates one immutable invalid logical-path result. */\nconst createLogicalPathFailure = (): IGitInventoryLogicalPathFailedResult =>\n Object.freeze({ errorCode: 'GIT_OUTPUT_INVALID', kind: 'failed' });\n\n/** Converts one Git-relative path into a validated repository logical path. */\nconst resolveRepositoryPath = (gitPath: string): IRepositoryPath | null => {\n const logicalPath = `/${gitPath}`;\n\n return logicalPath !== '/' && isRepositoryPath(logicalPath) ? logicalPath : null;\n};\n\n/** Resolves the logical path represented by one Git candidate record. */\nconst resolveCandidateRepositoryPath = (\n candidate: IGitInventoryLogicalPathCandidate,\n): IRepositoryPath | null => {\n const gitPath =\n candidate.kind === 'untracked' && candidate.path.endsWith('/')\n ? candidate.path.slice(0, -1)\n : candidate.path;\n\n return resolveRepositoryPath(gitPath);\n};\n\n/** Compares repository paths by exact Unicode code-point order. */\nconst compareRepositoryPaths = (left: IRepositoryPath, right: IRepositoryPath): number => {\n const leftScalars = left[Symbol.iterator]();\n const rightScalars = right[Symbol.iterator]();\n\n while (true) {\n const leftScalar = leftScalars.next();\n const rightScalar = rightScalars.next();\n\n if (leftScalar.done === true) {\n return rightScalar.done === true ? 0 : -1;\n }\n\n if (rightScalar.done === true) {\n return 1;\n }\n\n const leftCodePoint = leftScalar.value.codePointAt(0) ?? 0;\n const rightCodePoint = rightScalar.value.codePointAt(0) ?? 0;\n\n if (leftCodePoint !== rightCodePoint) {\n return leftCodePoint < rightCodePoint ? -1 : 1;\n }\n }\n};\n\n/**\n * Validates every decoded Git candidate before ownership or filesystem exclusions.\n * @param input The complete decoded tracked and untracked candidate set.\n * @returns A validated result, or failure when any candidate is not portable.\n */\nexport const validateGitInventoryCandidateLogicalPaths = (\n input: IGitInventoryCandidateLogicalPathValidatorInput,\n): IGitInventoryCandidateLogicalPathValidationResult => {\n for (const candidate of input.candidates) {\n if (resolveCandidateRepositoryPath(candidate) === null) {\n return createLogicalPathFailure();\n }\n }\n\n return Object.freeze({ kind: 'validated' });\n};\n\n/**\n * Converts Git-relative inventory entries into exact repository logical paths.\n * @param input The entry-type-normalized Git-relative inventory.\n * @returns An immutable code-point-sorted inventory, or failure for invalid path state.\n */\nexport const normalizeGitInventoryLogicalPaths: IGitInventoryLogicalPathNormalizer = (\n input,\n): IGitInventoryLogicalPathNormalizationResult => {\n const entries: IGitInventoryEntry[] = [];\n const logicalPaths = new Set<IRepositoryPath>();\n\n for (const entry of input.entries) {\n const logicalPath = resolveRepositoryPath(entry.path);\n\n if (logicalPath === null || logicalPaths.has(logicalPath)) {\n return createLogicalPathFailure();\n }\n\n logicalPaths.add(logicalPath);\n entries.push(Object.freeze({ ...entry, path: logicalPath }));\n }\n\n entries.sort((left, right) => compareRepositoryPaths(left.path, right.path));\n\n return Object.freeze({ entries: Object.freeze(entries), kind: 'normalized' });\n};\n","import type {\n IGitInventoryCandidate,\n IGitInventoryParser,\n IGitInventoryParserFailureReason,\n IGitInventoryParserResult,\n IGitTrackedEntryMode,\n IGitTrackedEntryStage,\n IGitTrackedInventoryCandidate,\n IGitUntrackedInventoryCandidate,\n} from './types.js';\n\nconst TRACKED_ENTRY_HEADER_PATTERN =\n /^(100644|100755|120000|160000) (?:[0-9a-f]{40}|[0-9a-f]{64}) ([0-3])$/u;\n\n/** Decodes one complete Git path as strict UTF-8 while preserving an initial BOM scalar. */\nconst decodeGitPath = (pathBytes: Uint8Array): string | null => {\n if (pathBytes.byteLength === 0) {\n return null;\n }\n\n try {\n return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(pathBytes);\n } catch {\n return null;\n }\n};\n\n/** Confirms that one decoded path contains only complete Unicode scalar values. */\nconst hasOnlyUnicodeScalarValues = (path: string): boolean => {\n for (let index = 0; index < path.length; index += 1) {\n const codeUnit = path.charCodeAt(index);\n\n if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {\n const trailingCodeUnit = path.charCodeAt(index + 1);\n\n if (trailingCodeUnit < 0xdc00 || trailingCodeUnit > 0xdfff) {\n return false;\n }\n\n index += 1;\n continue;\n }\n\n if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {\n return false;\n }\n }\n\n return true;\n};\n\n/** Concatenates one complete record assembled across arbitrary process chunks. */\nconst concatenateRecord = (fragments: readonly Uint8Array[], byteLength: number): Uint8Array => {\n const record = new Uint8Array(byteLength);\n let offset = 0;\n\n for (const fragment of fragments) {\n record.set(fragment, offset);\n offset += fragment.byteLength;\n }\n\n return record;\n};\n\n/** Parses one tracked `ls-files --stage` record without normalizing its path. */\nconst parseTrackedCandidate = (record: Uint8Array): IGitTrackedInventoryCandidate | null => {\n const separatorIndex = record.indexOf(0x09);\n\n if (separatorIndex <= 0 || separatorIndex === record.byteLength - 1) {\n return null;\n }\n\n let header: string;\n\n try {\n header = new TextDecoder('utf-8', { fatal: true }).decode(record.subarray(0, separatorIndex));\n } catch {\n return null;\n }\n\n const headerMatch = TRACKED_ENTRY_HEADER_PATTERN.exec(header);\n const path = decodeGitPath(record.subarray(separatorIndex + 1));\n\n if (headerMatch === null || path === null || !hasOnlyUnicodeScalarValues(path)) {\n return null;\n }\n\n return Object.freeze({\n kind: 'tracked',\n mode: headerMatch[1] as IGitTrackedEntryMode,\n path,\n stage: Number(headerMatch[2]) as IGitTrackedEntryStage,\n });\n};\n\n/** Parses one untracked `ls-files --others` record without normalizing its path. */\nconst parseUntrackedCandidate = (record: Uint8Array): IGitUntrackedInventoryCandidate | null => {\n const path = decodeGitPath(record);\n\n if (path === null || !hasOnlyUnicodeScalarValues(path)) {\n return null;\n }\n\n return Object.freeze({ kind: 'untracked', path });\n};\n\n/** Creates a strict incremental parser for one NUL-delimited Git record grammar. */\nconst createGitInventoryParser = <TCandidate extends IGitInventoryCandidate>(\n maxEntries: number,\n parseCandidate: (record: Uint8Array) => TCandidate | null,\n): IGitInventoryParser<TCandidate> => {\n const candidates: TCandidate[] = [];\n let failureReason: IGitInventoryParserFailureReason | null = null;\n let pendingByteLength = 0;\n let pendingFragments: Uint8Array[] = [];\n\n const consumeRecord = (): void => {\n if (failureReason !== null) {\n return;\n }\n\n if (candidates.length >= maxEntries) {\n failureReason = 'entry-limit-exceeded';\n pendingByteLength = 0;\n pendingFragments = [];\n return;\n }\n\n const candidate = parseCandidate(concatenateRecord(pendingFragments, pendingByteLength));\n\n pendingByteLength = 0;\n pendingFragments = [];\n\n if (candidate === null) {\n failureReason = 'invalid';\n return;\n }\n\n candidates.push(candidate);\n };\n\n return {\n consume: (chunk): void => {\n if (failureReason !== null) {\n return;\n }\n\n let fragmentStart = 0;\n\n for (let index = 0; index < chunk.byteLength; index += 1) {\n if (chunk[index] !== 0x00) {\n continue;\n }\n\n const fragment = chunk.subarray(fragmentStart, index);\n\n pendingFragments.push(fragment);\n pendingByteLength += fragment.byteLength;\n consumeRecord();\n\n if (failureReason !== null) {\n return;\n }\n\n fragmentStart = index + 1;\n }\n\n const trailingFragment = chunk.subarray(fragmentStart);\n\n if (trailingFragment.byteLength > 0) {\n pendingFragments.push(trailingFragment);\n pendingByteLength += trailingFragment.byteLength;\n }\n },\n finish: (): IGitInventoryParserResult<TCandidate> => {\n if (failureReason === null && pendingByteLength > 0) {\n failureReason = 'invalid';\n }\n\n if (failureReason !== null) {\n return Object.freeze({ kind: 'failed', reason: failureReason });\n }\n\n return Object.freeze({ candidates: Object.freeze([...candidates]), kind: 'completed' });\n },\n };\n};\n\n/** Creates a strict incremental parser for tracked Git inventory output. */\nexport const createTrackedGitInventoryParser = (\n maxEntries: number,\n): IGitInventoryParser<IGitTrackedInventoryCandidate> =>\n createGitInventoryParser(maxEntries, parseTrackedCandidate);\n\n/** Creates a strict incremental parser for untracked Git inventory output. */\nexport const createUntrackedGitInventoryParser = (\n maxEntries: number,\n): IGitInventoryParser<IGitUntrackedInventoryCandidate> =>\n createGitInventoryParser(maxEntries, parseUntrackedCandidate);\n","import { Buffer } from 'node:buffer';\nimport { lstat, readdir } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport {\n executeGitStreamingProcess,\n MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n type IGitStreamingProcessExecutor,\n type IGitStreamingProcessFailureReason,\n} from '../../git-process/index.js';\nimport { parseGitAbsolutePathOutput } from '../../git-working-tree/index.js';\nimport {\n areHostPathsEquivalent,\n haveSameHostPathIdentity,\n} from '../../host-path-identity/index.js';\nimport type { IGitInventoryProbeErrorCode } from '../types.js';\n\nimport type {\n IGitInventoryBoundaryInspectedResult,\n IGitInventoryBoundaryInspectionFailedResult,\n IGitInventoryBoundaryInspectionResult,\n IGitInventoryBoundaryInspector,\n IGitInventoryBoundaryOwnership,\n IGitInventoryOwnershipLstat,\n IGitInventoryOwnershipReadDirectory,\n IGitInventoryOwnershipStatistics,\n} from './types.js';\n\nconst GIT_CONTROL_SEGMENT = '.git';\nconst GIT_REPOSITORY_ROOT_ARGUMENTS = ['rev-parse', '--show-toplevel'] as const;\n\ninterface IGitInventoryDirectoryObservation {\n readonly encodedNameKeys: ReadonlySet<string>;\n readonly hostPath: string;\n readonly ownership: IGitInventoryBoundaryOwnership;\n}\n\ninterface IGitInventoryDirectoryReadResult {\n readonly encodedNameKeys: ReadonlySet<string>;\n readonly kind: 'read';\n}\n\ninterface IGitInventoryPathInspectedResult {\n readonly kind: 'inspected';\n readonly statistics: IGitInventoryOwnershipStatistics;\n}\n\ntype IGitInventoryDirectoryReadAttempt =\n IGitInventoryBoundaryInspectionFailedResult | IGitInventoryDirectoryReadResult;\n\ntype IGitInventoryPathInspectionAttempt =\n IGitInventoryBoundaryInspectionFailedResult | IGitInventoryPathInspectedResult;\n\ninterface IGitInventoryBoundaryValidationResult {\n readonly gitMetadataBytes: number;\n readonly kind: 'validated';\n readonly ownership: IGitInventoryBoundaryOwnership;\n}\n\ntype IGitInventoryBoundaryValidationAttempt =\n IGitInventoryBoundaryInspectionFailedResult | IGitInventoryBoundaryValidationResult;\n\n/** Identifies one safe inspection failure in a filesystem result union. */\nconst isInspectionFailure = (\n result: IGitInventoryBoundaryInspectionFailedResult | IGitInventoryDirectoryObservation,\n): result is IGitInventoryBoundaryInspectionFailedResult => 'kind' in result;\n\n/** Creates one immutable ownership-inspection failure. */\nconst createInspectionFailure = (\n errorCode: IGitInventoryProbeErrorCode,\n): IGitInventoryBoundaryInspectionFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps an unknown filesystem failure without retaining host diagnostics. */\nconst mapFilesystemFailure = (error: unknown): IGitInventoryProbeErrorCode => {\n const errorCode = (error as NodeJS.ErrnoException | null)?.code?.toUpperCase();\n\n if (errorCode === 'EACCES' || errorCode === 'EPERM') {\n return 'GIT_ACCESS_DENIED';\n }\n\n if (errorCode === 'ENOENT' || errorCode === 'ENOTDIR' || errorCode === 'ELOOP') {\n return 'GIT_OUTPUT_INVALID';\n }\n\n return 'GIT_COMMAND_FAILED';\n};\n\n/** Maps a streamed nested-root check failure into the existing safe CLI contract. */\nconst mapGitProcessFailure = (\n reason: IGitStreamingProcessFailureReason,\n): IGitInventoryProbeErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'output-limit-exceeded':\n case 'stdout-limit-exceeded':\n return 'RESOURCE_LIMIT_EXCEEDED';\n case 'repository-not-found':\n case 'stderr-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Reads one directory as native names without decoding unrelated entries. */\nconst readDirectoryNames = async (\n hostPath: string,\n readDirectory: IGitInventoryOwnershipReadDirectory,\n): Promise<IGitInventoryDirectoryReadAttempt> => {\n try {\n const encodedNames = await readDirectory(hostPath);\n\n return Object.freeze({\n encodedNameKeys: new Set(encodedNames.map((encodedName) => encodedName.toString('hex'))),\n kind: 'read',\n });\n } catch (error) {\n return createInspectionFailure(mapFilesystemFailure(error));\n }\n};\n\n/** Captures one path without following its final filesystem entry. */\nconst inspectPath = async (\n hostPath: string,\n inspectHostPath: IGitInventoryOwnershipLstat,\n): Promise<IGitInventoryPathInspectionAttempt> => {\n try {\n return Object.freeze({\n kind: 'inspected',\n statistics: await inspectHostPath(hostPath),\n });\n } catch (error) {\n return createInspectionFailure(mapFilesystemFailure(error));\n }\n};\n\n/** Determines whether native names contain one exact UTF-8 segment spelling. */\nconst hasExactDirectoryName = (encodedNameKeys: ReadonlySet<string>, segment: string): boolean =>\n encodedNameKeys.has(Buffer.from(segment, 'utf8').toString('hex'));\n\n/** Confirms that one directory observation retained its no-follow identity. */\nconst hasStableDirectoryIdentity = (\n initialStatistics: IGitInventoryOwnershipStatistics,\n revalidatedStatistics: IGitInventoryOwnershipStatistics,\n): boolean =>\n initialStatistics.isDirectory() &&\n !initialStatistics.isSymbolicLink() &&\n revalidatedStatistics.isDirectory() &&\n !revalidatedStatistics.isSymbolicLink() &&\n initialStatistics.dev === revalidatedStatistics.dev &&\n initialStatistics.ino === revalidatedStatistics.ino;\n\n/** Concatenates already bounded Git stdout chunks for strict root parsing. */\nconst concatenateChunks = (chunks: readonly Uint8Array[], byteLength: number): Uint8Array => {\n const output = new Uint8Array(byteLength);\n let offset = 0;\n\n for (const chunk of chunks) {\n output.set(chunk, offset);\n offset += chunk.byteLength;\n }\n\n return output;\n};\n\n/**\n * Confirms whether a directory with an exact `.git` marker owns another working tree.\n * @param directory The exact no-follow directory being classified.\n * @param repositoryRoot The selected repository root.\n * @param directoryStatistics The stable no-follow boundary observation.\n * @param maxMetadataBytes The remaining bounded Git stdout budget.\n * @param processExecutor The sanitized streamed Git boundary.\n * @param inspectHostPath The no-follow filesystem stat operation.\n * @returns A safe ownership classification and the consumed Git metadata bytes.\n */\nconst validateGitBoundary = async (\n directory: string,\n repositoryRoot: string,\n directoryStatistics: IGitInventoryOwnershipStatistics,\n maxMetadataBytes: number,\n processExecutor: IGitStreamingProcessExecutor,\n inspectHostPath: IGitInventoryOwnershipLstat,\n signal?: AbortSignal,\n): Promise<IGitInventoryBoundaryValidationAttempt> => {\n if (signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (!Number.isSafeInteger(maxMetadataBytes) || maxMetadataBytes < 0) {\n return createInspectionFailure('RESOURCE_LIMIT_EXCEEDED');\n }\n\n const stdoutChunks: Uint8Array[] = [];\n let consumedStdoutBytes = 0;\n const processResult = await processExecutor({\n arguments: ['-C', directory, ...GIT_REPOSITORY_ROOT_ARGUMENTS],\n consumeStdout: (chunk): void => {\n stdoutChunks.push(Uint8Array.from(chunk));\n consumedStdoutBytes += chunk.byteLength;\n },\n maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n maxStdoutBytes: maxMetadataBytes,\n ...(signal === undefined ? {} : { signal }),\n });\n\n if (processResult.kind === 'failed') {\n return createInspectionFailure(mapGitProcessFailure(processResult.reason));\n }\n\n if (processResult.stderr.byteLength > 0 || processResult.stdoutBytes !== consumedStdoutBytes) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const discoveredRoot = parseGitAbsolutePathOutput(\n concatenateChunks(stdoutChunks, consumedStdoutBytes),\n );\n\n if (discoveredRoot === null) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n if (areHostPathsEquivalent(discoveredRoot, directory)) {\n return Object.freeze({\n gitMetadataBytes: processResult.stdoutBytes,\n kind: 'validated',\n ownership: 'nested-repository',\n });\n }\n\n if (areHostPathsEquivalent(discoveredRoot, repositoryRoot)) {\n return Object.freeze({\n gitMetadataBytes: processResult.stdoutBytes,\n kind: 'validated',\n ownership: 'selected-repository',\n });\n }\n\n const discoveredRootInspection = await inspectPath(discoveredRoot, inspectHostPath);\n\n if (signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (discoveredRootInspection.kind === 'failed') {\n return discoveredRootInspection;\n }\n\n if (\n !discoveredRootInspection.statistics.isDirectory() ||\n discoveredRootInspection.statistics.isSymbolicLink()\n ) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n if (haveSameHostPathIdentity(discoveredRootInspection.statistics, directoryStatistics)) {\n return Object.freeze({\n gitMetadataBytes: processResult.stdoutBytes,\n kind: 'validated',\n ownership: 'nested-repository',\n });\n }\n\n const repositoryRootInspection = await inspectPath(repositoryRoot, inspectHostPath);\n\n if (signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (repositoryRootInspection.kind === 'failed') {\n return repositoryRootInspection;\n }\n\n if (\n repositoryRootInspection.statistics.isDirectory() &&\n !repositoryRootInspection.statistics.isSymbolicLink() &&\n haveSameHostPathIdentity(\n discoveredRootInspection.statistics,\n repositoryRootInspection.statistics,\n )\n ) {\n return Object.freeze({\n gitMetadataBytes: processResult.stdoutBytes,\n kind: 'validated',\n ownership: 'selected-repository',\n });\n }\n\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n};\n\n/** Default no-follow stat boundary for ownership inspection. */\nconst inspectOwnershipPath: IGitInventoryOwnershipLstat = async (hostPath) =>\n lstat(hostPath, { bigint: true });\n\n/** Default raw directory-name boundary for ownership inspection. */\nconst readOwnershipDirectory: IGitInventoryOwnershipReadDirectory = async (hostPath) =>\n readdir(hostPath, { encoding: 'buffer' });\n\n/**\n * Creates nested-repository inspection around injectable filesystem and Git boundaries.\n * @param processExecutor The sanitized bounded Git process executor.\n * @param inspectHostPath The no-follow filesystem stat operation.\n * @param readDirectory The raw native-name directory operation.\n * @returns An all-or-nothing ownership inspector for untracked candidate paths.\n */\nexport const createGitInventoryBoundaryInspector = (\n processExecutor: IGitStreamingProcessExecutor = executeGitStreamingProcess,\n inspectHostPath: IGitInventoryOwnershipLstat = inspectOwnershipPath,\n readDirectory: IGitInventoryOwnershipReadDirectory = readOwnershipDirectory,\n): IGitInventoryBoundaryInspector => {\n return async (input): Promise<IGitInventoryBoundaryInspectionResult> => {\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n const directoryObservations = new Map<string, IGitInventoryDirectoryObservation>();\n const ownership: IGitInventoryBoundaryOwnership[] = [];\n let gitMetadataBytes = 0;\n let rootEncodedNameKeys: ReadonlySet<string> | null = null;\n\n const getRootEncodedNames = async (): Promise<IGitInventoryDirectoryReadAttempt> => {\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (rootEncodedNameKeys !== null) {\n return Object.freeze({ encodedNameKeys: rootEncodedNameKeys, kind: 'read' });\n }\n\n const readResult = await readDirectoryNames(input.repositoryRoot, readDirectory);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (readResult.kind === 'read') {\n rootEncodedNameKeys = readResult.encodedNameKeys;\n }\n\n return readResult;\n };\n\n const inspectDirectory = async (\n parentObservation: IGitInventoryDirectoryObservation | null,\n parentPrefix: string,\n segment: string,\n ): Promise<IGitInventoryBoundaryInspectionFailedResult | IGitInventoryDirectoryObservation> => {\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n const prefix = parentPrefix.length === 0 ? segment : `${parentPrefix}/${segment}`;\n const cachedObservation = directoryObservations.get(prefix);\n\n if (cachedObservation !== undefined) {\n return cachedObservation;\n }\n\n const parentNamesResult =\n parentObservation === null\n ? await getRootEncodedNames()\n : Object.freeze({\n encodedNameKeys: parentObservation.encodedNameKeys,\n kind: 'read' as const,\n });\n\n if (parentNamesResult.kind === 'failed') {\n return parentNamesResult;\n }\n\n if (!hasExactDirectoryName(parentNamesResult.encodedNameKeys, segment)) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const parentHostPath = parentObservation?.hostPath ?? input.repositoryRoot;\n const hostPath = path.join(parentHostPath, segment);\n const initialInspection = await inspectPath(hostPath, inspectHostPath);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (initialInspection.kind === 'failed') {\n return initialInspection;\n }\n\n if (\n !initialInspection.statistics.isDirectory() ||\n initialInspection.statistics.isSymbolicLink()\n ) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const directoryNamesResult = await readDirectoryNames(hostPath, readDirectory);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (directoryNamesResult.kind === 'failed') {\n return directoryNamesResult;\n }\n\n const revalidatedInspection = await inspectPath(hostPath, inspectHostPath);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (revalidatedInspection.kind === 'failed') {\n return revalidatedInspection;\n }\n\n if (\n !hasStableDirectoryIdentity(initialInspection.statistics, revalidatedInspection.statistics)\n ) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const gitControlPath = path.join(hostPath, GIT_CONTROL_SEGMENT);\n const hasExactGitControlSegment = hasExactDirectoryName(\n directoryNamesResult.encodedNameKeys,\n GIT_CONTROL_SEGMENT,\n );\n let directoryOwnership: IGitInventoryBoundaryOwnership = 'selected-repository';\n\n if (!hasExactGitControlSegment) {\n try {\n await inspectHostPath(gitControlPath);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n } catch (error) {\n const errorCode = (error as NodeJS.ErrnoException | null)?.code?.toUpperCase();\n\n if (errorCode !== 'ENOENT' && errorCode !== 'ENOTDIR') {\n return createInspectionFailure(mapFilesystemFailure(error));\n }\n }\n } else {\n const gitControlInspection = await inspectPath(gitControlPath, inspectHostPath);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (gitControlInspection.kind === 'failed') {\n return gitControlInspection;\n }\n\n if (\n gitControlInspection.statistics.isSymbolicLink() ||\n (!gitControlInspection.statistics.isDirectory() &&\n !gitControlInspection.statistics.isFile())\n ) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const boundaryValidation = await validateGitBoundary(\n hostPath,\n input.repositoryRoot,\n revalidatedInspection.statistics,\n input.maxMetadataBytes - gitMetadataBytes,\n processExecutor,\n inspectHostPath,\n input.signal,\n );\n\n if (boundaryValidation.kind === 'failed') {\n return boundaryValidation;\n }\n\n gitMetadataBytes += boundaryValidation.gitMetadataBytes;\n directoryOwnership = boundaryValidation.ownership;\n }\n\n const observation = Object.freeze({\n encodedNameKeys: directoryNamesResult.encodedNameKeys,\n hostPath,\n ownership: directoryOwnership,\n });\n\n directoryObservations.set(prefix, observation);\n\n return observation;\n };\n\n for (const plan of input.plans) {\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n let candidateOwnership: IGitInventoryBoundaryOwnership = 'selected-repository';\n let parentObservation: IGitInventoryDirectoryObservation | null = null;\n let parentPrefix = '';\n\n for (const segment of plan.directorySegments) {\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n const observation = await inspectDirectory(parentObservation, parentPrefix, segment);\n\n if (isInspectionFailure(observation)) {\n return observation;\n }\n\n parentObservation = observation;\n parentPrefix = parentPrefix.length === 0 ? segment : `${parentPrefix}/${segment}`;\n\n if (observation.ownership === 'nested-repository') {\n candidateOwnership = 'nested-repository';\n break;\n }\n }\n\n if (plan.isDirectoryRecord && candidateOwnership !== 'nested-repository') {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n ownership.push(candidateOwnership);\n }\n\n const result: IGitInventoryBoundaryInspectedResult = Object.freeze({\n gitMetadataBytes,\n kind: 'inspected',\n ownership: Object.freeze([...ownership]),\n });\n\n return result;\n };\n};\n\n// default nested-repository ownership boundary used by inventory filtering\nexport const inspectGitInventoryBoundaries = createGitInventoryBoundaryInspector();\n","import type { IGitInventoryCandidate } from '../types.js';\n\nimport type { IGitInventoryOwnershipPathPlanResult } from './types.js';\n\n/**\n * Prepares one raw Git path for ownership inspection without logical-path normalization.\n * @param candidate The strictly decoded tracked or untracked candidate.\n * @returns An immutable segment plan, or a failure for an unsafe raw path shape.\n */\nexport const planGitInventoryOwnershipPath = (\n candidate: IGitInventoryCandidate,\n): IGitInventoryOwnershipPathPlanResult => {\n const isDirectoryRecord = candidate.path.endsWith('/');\n\n if (\n candidate.path.length === 0 ||\n candidate.path.startsWith('/') ||\n candidate.path.includes('\\\\') ||\n (candidate.kind === 'tracked' && isDirectoryRecord)\n ) {\n return Object.freeze({ kind: 'failed' });\n }\n\n const pathWithoutDirectoryTerminator = isDirectoryRecord\n ? candidate.path.slice(0, -1)\n : candidate.path;\n const segments = pathWithoutDirectoryTerminator.split('/');\n\n if (\n segments.length === 0 ||\n segments.some((segment) => segment.length === 0 || segment === '.' || segment === '..')\n ) {\n return Object.freeze({ kind: 'failed' });\n }\n\n const frozenSegments = Object.freeze([...segments]);\n const directorySegments = Object.freeze(\n isDirectoryRecord ? [...segments] : segments.slice(0, -1),\n );\n\n return Object.freeze({\n kind: 'planned',\n plan: Object.freeze({\n candidate,\n directorySegments,\n hasGitControlSegment: segments.includes('.git'),\n isDirectoryRecord,\n segments: frozenSegments,\n }),\n });\n};\n","import type { IGitInventoryCandidate, IGitInventoryProbeErrorCode } from '../types.js';\n\nimport { inspectGitInventoryBoundaries } from './boundary-inspector.js';\nimport { planGitInventoryOwnershipPath } from './path-planner.js';\nimport type {\n IGitInventoryBoundaryInspector,\n IGitInventoryOwnershipFilter,\n IGitInventoryOwnershipFilterFailedResult,\n IGitInventoryOwnershipFilterResult,\n IGitInventoryOwnershipPathPlan,\n IGitInventoryUntrackedOwnershipPlan,\n} from './types.js';\n\ninterface IGitInventoryIndexedOwnershipPlan {\n readonly candidateIndex: number;\n readonly plan: IGitInventoryOwnershipPathPlan;\n}\n\ninterface IGitInventoryGitlinkTrieNode {\n readonly children: Map<string, IGitInventoryGitlinkTrieNode>;\n isRoot: boolean;\n}\n\n/** Creates one immutable ownership-filtering failure. */\nconst createOwnershipFailure = (\n errorCode: IGitInventoryProbeErrorCode = 'GIT_OUTPUT_INVALID',\n): IGitInventoryOwnershipFilterFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Builds one segment trie for deterministic submodule-root lookup. */\nconst createGitlinkTrie = (\n rootSegments: readonly (readonly string[])[],\n): IGitInventoryGitlinkTrieNode => {\n const trie: IGitInventoryGitlinkTrieNode = { children: new Map(), isRoot: false };\n\n for (const segments of rootSegments) {\n let node = trie;\n\n for (const segment of segments) {\n let childNode = node.children.get(segment);\n\n if (childNode === undefined) {\n childNode = { children: new Map(), isRoot: false };\n node.children.set(segment, childNode);\n }\n\n node = childNode;\n }\n\n node.isRoot = true;\n }\n\n return trie;\n};\n\n/** Determines whether one candidate is a submodule root or segment descendant. */\nconst isAtOrBelowGitlink = (\n candidateSegments: readonly string[],\n gitlinkTrie: IGitInventoryGitlinkTrieNode,\n): boolean => {\n let node = gitlinkTrie;\n\n for (const segment of candidateSegments) {\n const childNode = node.children.get(segment);\n\n if (childNode === undefined) {\n return false;\n }\n\n if (childNode.isRoot) {\n return true;\n }\n\n node = childNode;\n }\n\n return false;\n};\n\n/**\n * Creates selected-repository ownership filtering around an injectable boundary inspector.\n * @param boundaryInspector The no-follow nested-repository ownership operation.\n * @returns An all-or-nothing raw candidate ownership filter.\n */\nexport const createGitInventoryOwnershipFilter = (\n boundaryInspector: IGitInventoryBoundaryInspector = inspectGitInventoryBoundaries,\n): IGitInventoryOwnershipFilter => {\n return async (input): Promise<IGitInventoryOwnershipFilterResult> => {\n const plannedCandidates: IGitInventoryIndexedOwnershipPlan[] = [];\n\n for (const [candidateIndex, candidate] of input.candidates.entries()) {\n if (input.signal?.aborted) {\n return createOwnershipFailure('GIT_OPERATION_ABORTED');\n }\n\n const planResult = planGitInventoryOwnershipPath(candidate);\n\n if (planResult.kind === 'failed') {\n return createOwnershipFailure();\n }\n\n plannedCandidates.push({ candidateIndex, plan: planResult.plan });\n }\n\n const gitlinkTrie = createGitlinkTrie(\n plannedCandidates\n .filter(\n ({ plan }) =>\n !plan.hasGitControlSegment &&\n plan.candidate.kind === 'tracked' &&\n plan.candidate.mode === '160000',\n )\n .map(({ plan }) => plan.segments),\n );\n const includedCandidates = Array.from({ length: input.candidates.length }, () => false);\n const untrackedPlans: IGitInventoryUntrackedOwnershipPlan[] = [];\n\n for (const { candidateIndex, plan } of plannedCandidates) {\n const isExcludedByGitPolicy =\n plan.hasGitControlSegment || isAtOrBelowGitlink(plan.segments, gitlinkTrie);\n\n if (isExcludedByGitPolicy) {\n continue;\n }\n\n if (plan.candidate.kind === 'tracked') {\n includedCandidates[candidateIndex] = true;\n continue;\n }\n\n untrackedPlans.push({ candidate: plan.candidate, candidateIndex, plan });\n }\n\n const boundaryResult = await boundaryInspector({\n maxMetadataBytes: input.maxMetadataBytes,\n plans: untrackedPlans.map(({ plan }) => plan),\n repositoryRoot: input.repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (boundaryResult.kind === 'failed') {\n return boundaryResult;\n }\n\n if (boundaryResult.ownership.length !== untrackedPlans.length) {\n return createOwnershipFailure();\n }\n\n for (const [ownershipIndex, ownership] of boundaryResult.ownership.entries()) {\n if (input.signal?.aborted) {\n return createOwnershipFailure('GIT_OPERATION_ABORTED');\n }\n\n const untrackedPlan = untrackedPlans[ownershipIndex];\n\n if (untrackedPlan === undefined) {\n return createOwnershipFailure();\n }\n\n if (ownership === 'selected-repository') {\n includedCandidates[untrackedPlan.candidateIndex] = true;\n }\n }\n\n const candidates = input.candidates.filter(\n (_candidate: IGitInventoryCandidate, candidateIndex) =>\n includedCandidates[candidateIndex] === true,\n );\n\n return Object.freeze({\n candidates: Object.freeze(candidates),\n gitMetadataBytes: boundaryResult.gitMetadataBytes,\n kind: 'filtered',\n });\n };\n};\n","import {\n executeGitStreamingProcess,\n MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n type IGitStreamingProcessExecutor,\n type IGitStreamingProcessFailureReason,\n} from '../git-process/index.js';\nimport { GIT_TRACKED_INVENTORY_ARGUMENTS, GIT_UNTRACKED_INVENTORY_ARGUMENTS } from './constants.js';\nimport {\n createGitContentTransformationClassifier,\n type IGitContentTransformationClassifier,\n} from './content-transformation/index.js';\nimport {\n createGitInventoryEntryTypeNormalizer,\n createGitSymlinkConfigurationResolver,\n inspectGitInventoryEntry,\n type IGitInventoryEntryTypeNormalizer,\n} from './entry-type/index.js';\nimport {\n normalizeGitInventoryLogicalPaths,\n type IGitInventoryLogicalPathNormalizer,\n validateGitInventoryCandidateLogicalPaths,\n} from './logical-path/index.js';\nimport { createTrackedGitInventoryParser, createUntrackedGitInventoryParser } from './parser.js';\nimport {\n createGitInventoryBoundaryInspector,\n createGitInventoryOwnershipFilter,\n type IGitInventoryOwnershipFilter,\n} from './repository-ownership/index.js';\nimport type {\n IGitInventoryCandidate,\n IGitInventoryParserResult,\n IGitInventoryProbe,\n IGitInventoryProbeErrorCode,\n IGitInventoryProbeFailedResult,\n IGitInventoryProbeResult,\n} from './types.js';\n\n/** Maps one normalized streamed Git failure to a safe inventory error. */\nconst mapGitProcessFailure = (\n reason: IGitStreamingProcessFailureReason,\n): IGitInventoryProbeErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'repository-not-found':\n return 'GIT_REPOSITORY_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'stderr-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'output-limit-exceeded':\n case 'stdout-limit-exceeded':\n return 'RESOURCE_LIMIT_EXCEEDED';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Creates one immutable inventory-probe failure. */\nconst createProbeFailure = (\n errorCode: IGitInventoryProbeErrorCode,\n): IGitInventoryProbeFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps one completed parser result into immutable candidates or a safe failure. */\nconst resolveParserResult = <TCandidate extends IGitInventoryCandidate>(\n parserResult: IGitInventoryParserResult<TCandidate>,\n): readonly TCandidate[] | IGitInventoryProbeFailedResult => {\n if (parserResult.kind === 'completed') {\n return parserResult.candidates;\n }\n\n return createProbeFailure(\n parserResult.reason === 'entry-limit-exceeded'\n ? 'RESOURCE_LIMIT_EXCEEDED'\n : 'GIT_OUTPUT_INVALID',\n );\n};\n\n/** Identifies a parser resolution failure without relying on array contents. */\nconst isProbeFailure = (\n result: readonly IGitInventoryCandidate[] | IGitInventoryProbeFailedResult,\n): result is IGitInventoryProbeFailedResult => !Array.isArray(result);\n\n/**\n * Creates the strict normalized Git inventory probe around injectable boundaries.\n * @param processExecutor The bounded incremental Git process executor.\n * @param ownershipFilter The submodule and nested-repository ownership filter.\n * @param entryTypeNormalizer The current filesystem and Git mode entry-type normalizer.\n * @param contentTransformationClassifier The bounded effective Git attribute classifier.\n * @param logicalPathNormalizer The portable repository logical-path normalizer.\n * @returns An all-or-nothing selected-repository entry probe.\n */\nexport const createGitInventoryProbe =\n (\n processExecutor: IGitStreamingProcessExecutor = executeGitStreamingProcess,\n ownershipFilter: IGitInventoryOwnershipFilter = createGitInventoryOwnershipFilter(\n createGitInventoryBoundaryInspector(processExecutor),\n ),\n entryTypeNormalizer: IGitInventoryEntryTypeNormalizer = createGitInventoryEntryTypeNormalizer(\n inspectGitInventoryEntry,\n createGitSymlinkConfigurationResolver(processExecutor),\n ),\n contentTransformationClassifier: IGitContentTransformationClassifier = createGitContentTransformationClassifier(\n processExecutor,\n ),\n logicalPathNormalizer: IGitInventoryLogicalPathNormalizer = normalizeGitInventoryLogicalPaths,\n ): IGitInventoryProbe =>\n async (input): Promise<IGitInventoryProbeResult> => {\n if (input.signal?.aborted) {\n return createProbeFailure('GIT_OPERATION_ABORTED');\n }\n\n const trackedParser = createTrackedGitInventoryParser(input.maxEntries);\n const trackedProcessResult = await processExecutor({\n arguments: ['-C', input.repositoryRoot, ...GIT_TRACKED_INVENTORY_ARGUMENTS],\n consumeStdout: (chunk) => trackedParser.consume(chunk),\n maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n maxStdoutBytes: input.maxMetadataBytes,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (trackedProcessResult.kind === 'failed') {\n return createProbeFailure(mapGitProcessFailure(trackedProcessResult.reason));\n }\n\n if (trackedProcessResult.stderr.byteLength > 0) {\n return createProbeFailure('GIT_OUTPUT_INVALID');\n }\n\n const trackedCandidates = resolveParserResult(trackedParser.finish());\n\n if (isProbeFailure(trackedCandidates)) {\n return trackedCandidates;\n }\n\n const untrackedParser = createUntrackedGitInventoryParser(\n input.maxEntries - trackedCandidates.length,\n );\n const untrackedProcessResult = await processExecutor({\n arguments: ['-C', input.repositoryRoot, ...GIT_UNTRACKED_INVENTORY_ARGUMENTS],\n consumeStdout: (chunk) => untrackedParser.consume(chunk),\n maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n maxStdoutBytes: input.maxMetadataBytes - trackedProcessResult.stdoutBytes,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (untrackedProcessResult.kind === 'failed') {\n return createProbeFailure(mapGitProcessFailure(untrackedProcessResult.reason));\n }\n\n if (untrackedProcessResult.stderr.byteLength > 0) {\n return createProbeFailure('GIT_OUTPUT_INVALID');\n }\n\n const untrackedCandidates = resolveParserResult(untrackedParser.finish());\n\n if (isProbeFailure(untrackedCandidates)) {\n return untrackedCandidates;\n }\n\n const candidates = Object.freeze([...trackedCandidates, ...untrackedCandidates]);\n const logicalPathValidationResult = validateGitInventoryCandidateLogicalPaths({ candidates });\n\n if (logicalPathValidationResult.kind === 'failed') {\n return logicalPathValidationResult;\n }\n\n const ownershipResult = await ownershipFilter({\n candidates,\n maxMetadataBytes:\n input.maxMetadataBytes -\n trackedProcessResult.stdoutBytes -\n untrackedProcessResult.stdoutBytes,\n repositoryRoot: input.repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (ownershipResult.kind === 'failed') {\n return ownershipResult;\n }\n\n const entryTypeResult = await entryTypeNormalizer({\n candidates: ownershipResult.candidates,\n maxMetadataBytes:\n input.maxMetadataBytes -\n trackedProcessResult.stdoutBytes -\n untrackedProcessResult.stdoutBytes -\n ownershipResult.gitMetadataBytes,\n repositoryRoot: input.repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (entryTypeResult.kind === 'failed') {\n return entryTypeResult;\n }\n\n const contentTransformationResult = await contentTransformationClassifier({\n entries: entryTypeResult.entries,\n maxMetadataBytes:\n input.maxMetadataBytes -\n trackedProcessResult.stdoutBytes -\n untrackedProcessResult.stdoutBytes -\n ownershipResult.gitMetadataBytes -\n entryTypeResult.gitMetadataBytes,\n repositoryRoot: input.repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (contentTransformationResult.kind === 'failed') {\n return contentTransformationResult;\n }\n\n const logicalPathResult = logicalPathNormalizer({\n entries: contentTransformationResult.entries,\n });\n\n if (logicalPathResult.kind === 'failed') {\n return logicalPathResult;\n }\n\n return Object.freeze({ entries: logicalPathResult.entries, kind: 'probed' });\n };\n\n// default normalized Git inventory probe used by command execution\nexport const probeGitInventory = createGitInventoryProbe();\n","import type { IGitContentTransformationClassification } from '../content-transformation/index.js';\nimport type { IGitInventoryIndexEntry } from '../entry-type/index.js';\nimport type { IGitInventoryEntry } from '../logical-path/index.js';\n\n/** Determines whether two exact transform classifications are equal. */\nconst areContentTransformationsEqual = (\n left: IGitContentTransformationClassification,\n right: IGitContentTransformationClassification,\n): boolean =>\n left.filter === right.filter &&\n left.ident === right.ident &&\n left.isGuarded === right.isGuarded &&\n left.workingTreeEncoding === right.workingTreeEncoding;\n\n/** Determines whether two retained Git mode-and-stage sequences are equal. */\nconst areIndexEntriesEqual = (\n left: readonly IGitInventoryIndexEntry[],\n right: readonly IGitInventoryIndexEntry[],\n): boolean =>\n left.length === right.length &&\n left.every(\n (leftEntry, index) =>\n leftEntry.mode === right[index]?.mode && leftEntry.stage === right[index]?.stage,\n );\n\n/** Determines whether two normalized inventory entries are exactly equal. */\nconst areInventoryEntriesEqual = (left: IGitInventoryEntry, right: IGitInventoryEntry): boolean => {\n if (\n left.kind !== right.kind ||\n left.path !== right.path ||\n left.entryType !== right.entryType ||\n left.requiresSymlinkOverlay !== right.requiresSymlinkOverlay ||\n !areContentTransformationsEqual(left.contentTransformation, right.contentTransformation)\n ) {\n return false;\n }\n\n if (left.kind === 'untracked' || right.kind === 'untracked') {\n return left.kind === right.kind;\n }\n\n return areIndexEntriesEqual(left.indexEntries, right.indexEntries);\n};\n\n/**\n * Determines whether two complete normalized Git inventories describe the same snapshot inputs.\n * @param left The first deterministic inventory.\n * @param right The second deterministic inventory.\n * @returns Whether ordering and every retained record field are equal.\n */\nexport const areGitInventoriesEqual = (\n left: readonly IGitInventoryEntry[],\n right: readonly IGitInventoryEntry[],\n): boolean =>\n left.length === right.length &&\n left.every((leftEntry, index) => {\n const rightEntry = right[index];\n\n return rightEntry !== undefined && areInventoryEntriesEqual(leftEntry, rightEntry);\n });\n","import {\n REPOSITORY_ROOT,\n RepositorySourceException,\n parseRepositoryPath,\n type IRepositoryEntry,\n type IRepositoryListOptions,\n type IRepositoryOperation,\n type IRepositoryOperationOptions,\n type IRepositoryPath,\n type IRepositoryReader,\n} from '@moldea.ai/repository';\n\n/** Throws the common cancellation contract for wrapper-owned operations. */\nconst throwIfAborted = (\n signal: AbortSignal | undefined,\n operation: IRepositoryOperation,\n path: IRepositoryPath,\n): void => {\n if (!signal?.aborted) {\n return;\n }\n\n throw new RepositorySourceException({\n cause: signal.reason,\n code: 'ABORTED',\n operation,\n path,\n retryable: false,\n });\n};\n\n/** Creates the common failure for an overlay that contradicts its underlying snapshot. */\nconst createInvalidOverlayException = (\n operation: IRepositoryOperation,\n path: IRepositoryPath,\n): RepositorySourceException =>\n new RepositorySourceException({\n code: 'INVALID_SOURCE_DATA',\n operation,\n path,\n retryable: false,\n });\n\n/** Confirms that one overlay path remains a regular file in the underlying snapshot. */\nconst validateOverlayEntry = (\n entry: IRepositoryEntry | null,\n operation: Exclude<IRepositoryOperation, 'create-reader'>,\n path: IRepositoryPath,\n): void => {\n if (entry?.type !== 'file' || entry.path !== path) {\n throw createInvalidOverlayException(operation, path);\n }\n};\n\n/** Maps one expected underlying regular file to an immutable logical symlink entry. */\nconst overlayEntry = (\n entry: IRepositoryEntry | null,\n operation: 'get-entry' | 'list-entries',\n path: IRepositoryPath,\n): IRepositoryEntry => {\n validateOverlayEntry(entry, operation, path);\n\n return Object.freeze({ path, type: 'symlink' });\n};\n\n// immutable logical symlink view over one coherent repository reader\nclass GitSymlinkOverlayRepositoryReader implements IRepositoryReader {\n readonly #overlayPaths: ReadonlySet<IRepositoryPath>;\n\n readonly #reader: IRepositoryReader;\n\n public constructor(reader: IRepositoryReader, overlayPaths: ReadonlySet<IRepositoryPath>) {\n this.#reader = reader;\n this.#overlayPaths = overlayPaths;\n }\n\n /**\n * Looks up an entry while replacing configured host files with logical symlinks.\n * @param path The validated repository path to inspect.\n * @param options Optional cancellation controls.\n * @returns A promise resolving to the detached logical entry or confirmed absence.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path 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 * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public async getEntry(\n path: IRepositoryPath,\n options?: IRepositoryOperationOptions,\n ): Promise<IRepositoryEntry | null> {\n const entry = await this.#reader.getEntry(path, options);\n\n if (!this.#overlayPaths.has(path)) {\n return entry;\n }\n\n return overlayEntry(entry, 'get-entry', path);\n }\n\n /**\n * Reads ordinary files while refusing access to configured logical symlink bytes.\n * @param path The validated repository file path to read.\n * @param options Optional cancellation controls.\n * @returns A promise resolving to fresh bytes for a non-overlaid regular file.\n * @throws\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 * - 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 * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public async readFile(\n path: IRepositoryPath,\n options?: IRepositoryOperationOptions,\n ): Promise<Uint8Array> {\n const parsedPath = parseRepositoryPath(path);\n\n if (!this.#overlayPaths.has(parsedPath)) {\n return this.#reader.readFile(parsedPath, options);\n }\n\n throwIfAborted(options?.signal, 'read-file', parsedPath);\n\n const entry = await this.#reader.getEntry(parsedPath, options);\n\n validateOverlayEntry(entry, 'read-file', parsedPath);\n throwIfAborted(options?.signal, 'read-file', parsedPath);\n\n throw new RepositorySourceException({\n code: 'ENTRY_NOT_FILE',\n operation: 'read-file',\n path: parsedPath,\n retryable: false,\n });\n }\n\n /**\n * Recursively lists descendants while replacing configured host files with logical symlinks.\n * @param options Optional prefix and cancellation controls.\n * @returns An async iterable of detached logical entries.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - ENTRY_NOT_FOUND: The requested repository entry was not found.\n * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.\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 * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public async *listEntries(options?: IRepositoryListOptions): AsyncIterable<IRepositoryEntry> {\n const prefix =\n options?.prefix === undefined ? REPOSITORY_ROOT : parseRepositoryPath(options.prefix);\n\n if (this.#overlayPaths.has(prefix)) {\n throwIfAborted(options?.signal, 'list-entries', prefix);\n\n const operationOptions =\n options?.signal === undefined ? undefined : { signal: options.signal };\n const entry = await this.#reader.getEntry(prefix, operationOptions);\n\n validateOverlayEntry(entry, 'list-entries', prefix);\n throwIfAborted(options?.signal, 'list-entries', prefix);\n throw new RepositorySourceException({\n code: 'ENTRY_NOT_DIRECTORY',\n operation: 'list-entries',\n path: prefix,\n retryable: false,\n });\n }\n\n const descendantPrefix = prefix === REPOSITORY_ROOT ? REPOSITORY_ROOT : `${prefix}/`;\n const unmatchedOverlayPaths = new Set(\n [...this.#overlayPaths].filter((path) => path.startsWith(descendantPrefix)),\n );\n\n for await (const entry of this.#reader.listEntries(options)) {\n if (!unmatchedOverlayPaths.has(entry.path)) {\n yield entry;\n continue;\n }\n\n unmatchedOverlayPaths.delete(entry.path);\n yield overlayEntry(entry, 'list-entries', entry.path);\n }\n\n const missingOverlayPath = unmatchedOverlayPaths.values().next().value;\n\n if (missingOverlayPath !== undefined) {\n throw createInvalidOverlayException('list-entries', missingOverlayPath);\n }\n }\n}\n\n/**\n * Creates an immutable reader overlay for Git symlinks materialized as host files.\n * @param reader The coherent underlying repository reader.\n * @param symlinkPaths The logical paths whose host files represent Git symlinks.\n * @returns A reader that exposes the configured paths only as logical symlinks.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n */\nexport const createGitSymlinkOverlayRepositoryReader = (\n reader: IRepositoryReader,\n symlinkPaths: readonly IRepositoryPath[],\n): IRepositoryReader => {\n const overlayPaths = new Set<IRepositoryPath>();\n\n for (const symlinkPath of symlinkPaths) {\n const parsedPath = parseRepositoryPath(symlinkPath);\n\n if (parsedPath === REPOSITORY_ROOT) {\n throw new RepositorySourceException({\n code: 'INVALID_SOURCE_DATA',\n operation: 'create-reader',\n path: parsedPath,\n retryable: false,\n });\n }\n\n overlayPaths.add(parsedPath);\n }\n\n return Object.freeze(new GitSymlinkOverlayRepositoryReader(reader, overlayPaths));\n};\n","import type { IRepositoryPath, IRepositoryReader } from '@moldea.ai/repository';\nimport { createFilesystemRepositoryReader } from '@moldea.ai/repository-fs';\n\nimport { createGitContentTransformationGuardRepositoryReader } from '../repository-content-transformation-guard/index.js';\nimport { createGitSymlinkOverlayRepositoryReader } from '../repository-symlink-overlay/index.js';\n\nimport type { IWorkingTreeRepositoryReaderFactory } from './types.js';\n\n// injectable package and overlay factories used by the composition boundary\ntype IFilesystemRepositoryReaderFactory = typeof createFilesystemRepositoryReader;\ntype IGitContentTransformationGuardRepositoryReaderFactory =\n typeof createGitContentTransformationGuardRepositoryReader;\ntype IGitSymlinkOverlayRepositoryReaderFactory = typeof createGitSymlinkOverlayRepositoryReader;\n\n/**\n * Creates the private working-tree reader factory around injectable composition boundaries.\n * @param filesystemReaderFactory The exact-path filesystem snapshot factory.\n * @param symlinkOverlayFactory The logical Git symlink overlay factory.\n * @param contentTransformationGuardFactory The guarded logical regular-file reader factory.\n * @returns A factory that composes one coherent selected working-tree reader.\n */\nexport const createWorkingTreeRepositoryReaderFactory =\n (\n filesystemReaderFactory: IFilesystemRepositoryReaderFactory = createFilesystemRepositoryReader,\n symlinkOverlayFactory: IGitSymlinkOverlayRepositoryReaderFactory = createGitSymlinkOverlayRepositoryReader,\n contentTransformationGuardFactory: IGitContentTransformationGuardRepositoryReaderFactory = createGitContentTransformationGuardRepositoryReader,\n ): IWorkingTreeRepositoryReaderFactory =>\n async (input): Promise<IRepositoryReader> => {\n const selectedPaths = Object.freeze(input.entries.map((entry) => entry.path));\n const symlinkOverlayPaths = Object.freeze(\n input.entries.reduce<IRepositoryPath[]>((paths, entry) => {\n if (entry.requiresSymlinkOverlay) {\n paths.push(entry.path);\n }\n\n return paths;\n }, []),\n );\n const guardedPaths = Object.freeze(\n input.entries.reduce<IRepositoryPath[]>((paths, entry) => {\n if (entry.contentTransformation.isGuarded) {\n paths.push(entry.path);\n }\n\n return paths;\n }, []),\n );\n const filesystemReader = await filesystemReaderFactory({\n limits: Object.freeze({\n maxCachedBytes: input.resourceLimits.maxTotalBytes,\n maxEntries: input.resourceLimits.maxEntries,\n maxFileBytes: input.resourceLimits.maxFileBytes,\n }),\n rootDirectory: input.repositoryRoot,\n selection: Object.freeze({ kind: 'paths', paths: selectedPaths }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n const overlaidReader = symlinkOverlayFactory(filesystemReader, symlinkOverlayPaths);\n\n return contentTransformationGuardFactory(overlaidReader, guardedPaths);\n };\n\n// default exact-path working-tree reader composition used by command execution\nexport const createWorkingTreeRepositoryReader = createWorkingTreeRepositoryReaderFactory();\n","import { RepositorySourceException, type IRepositoryReader } from '@moldea.ai/repository';\n\nimport {\n areGitInventoriesEqual,\n probeGitInventory,\n type IGitInventoryProbe,\n type IGitInventoryProbedResult,\n} from '../git-inventory/index.js';\nimport {\n areGitWorkingTreeIdentitiesEqual,\n inspectGitWorkingTreeIdentity,\n type IGitWorkingTreeIdentity,\n type IGitWorkingTreeIdentityInspector,\n} from '../git-working-tree/index.js';\nimport type { IMoldeaCliOwnedErrorCode } from '../presentation/index.js';\nimport {\n createWorkingTreeRepositoryReader,\n type IWorkingTreeRepositoryReaderFactory,\n} from '../repository-reader/index.js';\n\nimport { MAX_WORKING_TREE_SNAPSHOT_ATTEMPTS } from './constants.js';\nimport type {\n IWorkingTreeSnapshotExecutionInput,\n IWorkingTreeSnapshotExecutionResult,\n IWorkingTreeSnapshotExecutor,\n IWorkingTreeSnapshotFailedResult,\n IWorkingTreeSnapshotInventoryComparator,\n} from './types.js';\n\n/** Creates one immutable terminal snapshot failure. */\nconst createSnapshotFailure = (\n errorCode: IMoldeaCliOwnedErrorCode,\n): IWorkingTreeSnapshotFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Determines whether a source exception proves that the current reader is unusable. */\nconst isSnapshotChanged = (error: unknown): boolean =>\n error instanceof RepositorySourceException && error.code === 'SNAPSHOT_CHANGED';\n\n/** Determines whether reader creation may have raced with an inventory change. */\nconst isCreationInventoryRace = (error: unknown): boolean =>\n error instanceof RepositorySourceException &&\n error.operation === 'create-reader' &&\n (error.code === 'ENTRY_NOT_FOUND' || error.code === 'ENTRY_NOT_DIRECTORY');\n\n/** Determines whether identity inspection failed because the pinned source disappeared. */\nconst isPinnedIdentityUnavailable = (errorCode: IMoldeaCliOwnedErrorCode): boolean =>\n errorCode === 'GIT_REPOSITORY_NOT_FOUND' || errorCode === 'GIT_WORK_TREE_REQUIRED';\n\n/**\n * Creates the bounded whole-operation working-tree snapshot executor.\n * @param identityInspector The selected working-tree identity observation boundary.\n * @param inventoryProbe The complete normalized Git inventory probe.\n * @param repositoryReaderFactory The exact-path guarded reader factory.\n * @param compareInventories The exact normalized inventory comparator.\n * @returns An executor that discards and retries complete provisional attempts.\n */\nexport const createWorkingTreeSnapshotExecutor = (\n identityInspector: IGitWorkingTreeIdentityInspector = inspectGitWorkingTreeIdentity,\n inventoryProbe: IGitInventoryProbe = probeGitInventory,\n repositoryReaderFactory: IWorkingTreeRepositoryReaderFactory = createWorkingTreeRepositoryReader,\n compareInventories: IWorkingTreeSnapshotInventoryComparator = areGitInventoriesEqual,\n): IWorkingTreeSnapshotExecutor => {\n const executeSnapshot = async <TResult>(\n input: IWorkingTreeSnapshotExecutionInput<TResult>,\n ): Promise<IWorkingTreeSnapshotExecutionResult<TResult>> => {\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n const repositoryRoot = input.repositoryRoot;\n const resourceLimits = Object.freeze({ ...input.resourceLimits });\n const pinnedIdentityResult = await identityInspector({\n repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (pinnedIdentityResult.kind === 'failed') {\n return createSnapshotFailure(pinnedIdentityResult.errorCode);\n }\n\n if (pinnedIdentityResult.kind === 'mismatched') {\n return createSnapshotFailure('GIT_OUTPUT_INVALID');\n }\n\n const pinnedIdentity: IGitWorkingTreeIdentity = pinnedIdentityResult.identity;\n\n const probeInventory = async (): Promise<\n IGitInventoryProbedResult | IWorkingTreeSnapshotFailedResult\n > => {\n const result = await inventoryProbe({\n maxEntries: resourceLimits.maxEntries,\n maxMetadataBytes: resourceLimits.maxTotalBytes,\n repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n return result.kind === 'failed' ? createSnapshotFailure(result.errorCode) : result;\n };\n\n for (let attempt = 0; attempt < MAX_WORKING_TREE_SNAPSHOT_ATTEMPTS; attempt += 1) {\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n const currentIdentityResult = await identityInspector({\n repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (currentIdentityResult.kind === 'failed') {\n return createSnapshotFailure(\n isPinnedIdentityUnavailable(currentIdentityResult.errorCode)\n ? 'WORKING_TREE_UNSTABLE'\n : currentIdentityResult.errorCode,\n );\n }\n\n if (\n currentIdentityResult.kind === 'mismatched' ||\n !areGitWorkingTreeIdentitiesEqual(pinnedIdentity, currentIdentityResult.identity)\n ) {\n return createSnapshotFailure('WORKING_TREE_UNSTABLE');\n }\n\n const firstInventoryResult = await probeInventory();\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (firstInventoryResult.kind === 'failed') {\n return firstInventoryResult;\n }\n\n let reader: IRepositoryReader;\n\n try {\n reader = await repositoryReaderFactory({\n entries: firstInventoryResult.entries,\n repositoryRoot,\n resourceLimits,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n } catch (error) {\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (isSnapshotChanged(error)) {\n continue;\n }\n\n if (!isCreationInventoryRace(error)) {\n throw error;\n }\n\n const freshInventoryResult = await probeInventory();\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (freshInventoryResult.kind === 'failed') {\n return freshInventoryResult;\n }\n\n if (!compareInventories(firstInventoryResult.entries, freshInventoryResult.entries)) {\n continue;\n }\n\n throw error;\n }\n\n const secondInventoryResult = await probeInventory();\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (secondInventoryResult.kind === 'failed') {\n return secondInventoryResult;\n }\n\n if (!compareInventories(firstInventoryResult.entries, secondInventoryResult.entries)) {\n continue;\n }\n\n try {\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n const result =\n input.signal === undefined\n ? await input.operation(reader)\n : await input.operation(reader, input.signal);\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n return Object.freeze({ kind: 'completed', result });\n } catch (error) {\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (!isSnapshotChanged(error)) {\n throw error;\n }\n }\n }\n\n return createSnapshotFailure('WORKING_TREE_UNSTABLE');\n };\n\n return executeSnapshot;\n};\n\n// default bounded snapshot executor used by command execution\nexport const executeWorkingTreeSnapshot = createWorkingTreeSnapshotExecutor();\n","import type { IProjectInspectionResult } from '@moldea.ai/core';\n\nimport type { IMoldeaCliCommand } from '../command-line/index.js';\nimport type { IMoldeaCliCompatibilityResult } from '../compatibility/index.js';\nimport {\n createMoldeaCliInspectResult,\n createMoldeaCliValidateResult,\n formatMoldeaCliHumanCompatibilityResult,\n formatMoldeaCliHumanError,\n formatMoldeaCliHumanInspectResult,\n formatMoldeaCliHumanValidateResult,\n formatMoldeaCliJsonCompatibilityResult,\n formatMoldeaCliJsonError,\n formatMoldeaCliJsonInspectResult,\n formatMoldeaCliJsonValidateResult,\n type IMoldeaCliError,\n} from '../presentation/index.js';\n\nimport { MOLDEA_CLI_EXIT_CODES } from './constants.js';\nimport type { IMoldeaCliExecutionResult } from './types.js';\n\n/**\n * Creates one process-neutral result for a valid compatibility composition.\n * @param result The exact installed compatibility result.\n * @param cliVersion The installed CLI package version.\n * @param isJson Whether machine-readable output was requested.\n * @returns The complete immutable successful process output.\n */\nexport const createMoldeaCliCompatibilityExecutionResult = (\n result: IMoldeaCliCompatibilityResult,\n cliVersion: string,\n isJson: boolean,\n): IMoldeaCliExecutionResult =>\n Object.freeze({\n exitCode: MOLDEA_CLI_EXIT_CODES.Success,\n stderr: '',\n stdout: isJson\n ? formatMoldeaCliJsonCompatibilityResult(result, cliVersion)\n : formatMoldeaCliHumanCompatibilityResult(result, cliVersion),\n });\n\n/**\n * Creates one safe process-neutral error result in the requested output mode.\n * @param error The complete safe operational error.\n * @param command The resolved command, or null when resolution failed.\n * @param cliVersion The installed CLI package version.\n * @param isJson Whether machine-readable output was requested.\n * @param exitCode The handled process exit code.\n * @returns The complete immutable process output.\n */\nexport const createMoldeaCliErrorResult = (\n error: IMoldeaCliError,\n command: IMoldeaCliCommand | null,\n cliVersion: string,\n isJson: boolean,\n exitCode: number,\n): IMoldeaCliExecutionResult =>\n Object.freeze(\n isJson\n ? {\n exitCode,\n stderr: '',\n stdout: formatMoldeaCliJsonError(error, command, cliVersion),\n }\n : {\n exitCode,\n stderr: formatMoldeaCliHumanError(error),\n stdout: '',\n },\n );\n\n/**\n * Creates one process-neutral result for a completed validate command.\n * @param inspection The complete immutable Core inspection.\n * @param cliVersion The installed CLI package version.\n * @param isJson Whether machine-readable output was requested.\n * @returns The complete immutable process output.\n */\nexport const createMoldeaCliValidateExecutionResult = (\n inspection: IProjectInspectionResult,\n cliVersion: string,\n isJson: boolean,\n): IMoldeaCliExecutionResult => {\n const result = createMoldeaCliValidateResult(inspection);\n const exitCode =\n result.diagnostics.length === 0\n ? MOLDEA_CLI_EXIT_CODES.Success\n : MOLDEA_CLI_EXIT_CODES.StructuralInvalid;\n\n return Object.freeze({\n exitCode,\n stderr: '',\n stdout: isJson\n ? formatMoldeaCliJsonValidateResult(result, cliVersion)\n : formatMoldeaCliHumanValidateResult(result),\n });\n};\n\n/**\n * Creates one process-neutral result for a completed inspect command.\n * @param inspection The complete immutable Core inspection.\n * @param cliVersion The installed CLI package version.\n * @param isJson Whether machine-readable output was requested.\n * @returns The complete immutable process output.\n * @throws If the Core result contradicts its valid, project, and diagnostic invariants.\n */\nexport const createMoldeaCliInspectExecutionResult = (\n inspection: IProjectInspectionResult,\n cliVersion: string,\n isJson: boolean,\n): IMoldeaCliExecutionResult => {\n const result = createMoldeaCliInspectResult(inspection);\n\n return Object.freeze({\n exitCode: inspection.valid\n ? MOLDEA_CLI_EXIT_CODES.Success\n : MOLDEA_CLI_EXIT_CODES.StructuralInvalid,\n stderr: '',\n stdout: isJson\n ? formatMoldeaCliJsonInspectResult(result, cliVersion)\n : formatMoldeaCliHumanInspectResult(result),\n });\n};\n","import { MOLDEA_CLI_COMMANDS } from '../command-line/index.js';\nimport {\n resolveInstalledMoldeaCliCompatibility,\n type IMoldeaCliCompatibilityResolver,\n} from '../compatibility/index.js';\nimport {\n executeMoldeaCliCoreInspection,\n type IMoldeaCliCoreInspectionExecutor,\n} from '../core-composition/index.js';\nimport {\n discoverGitWorkingTree,\n type IGitWorkingTreeDiscovery,\n} from '../git-working-tree/index.js';\nimport { mapMoldeaCliOperationalError } from '../operational-error/index.js';\nimport { createMoldeaCliOwnedError } from '../presentation/index.js';\nimport {\n executeWorkingTreeSnapshot,\n type IWorkingTreeSnapshotExecutor,\n} from '../working-tree-snapshot/index.js';\n\nimport { MOLDEA_CLI_EXIT_CODES } from './constants.js';\nimport {\n createMoldeaCliCompatibilityExecutionResult,\n createMoldeaCliErrorResult,\n createMoldeaCliInspectExecutionResult,\n createMoldeaCliValidateExecutionResult,\n} from './results.js';\nimport type { IMoldeaCliCommandExecutor, IMoldeaCliExecutionResult } from './types.js';\n\n/**\n * Creates the private command dispatcher around discovery and bounded snapshot execution.\n * @param workingTreeDiscovery The Git working-tree discovery operation.\n * @param workingTreeSnapshotExecutor The complete working-tree snapshot operation.\n * @param coreInspectionExecutor The attempt-local Core inspection composition.\n * @param compatibilityResolver The installed executable-integrity and compatibility boundary.\n * @returns A command executor for the current behavioral slice.\n */\nexport const createMoldeaCliCommandExecutor =\n (\n workingTreeDiscovery: IGitWorkingTreeDiscovery = discoverGitWorkingTree,\n workingTreeSnapshotExecutor: IWorkingTreeSnapshotExecutor = executeWorkingTreeSnapshot,\n coreInspectionExecutor: IMoldeaCliCoreInspectionExecutor = executeMoldeaCliCoreInspection,\n compatibilityResolver: IMoldeaCliCompatibilityResolver = resolveInstalledMoldeaCliCompatibility,\n ): IMoldeaCliCommandExecutor =>\n async (input): Promise<IMoldeaCliExecutionResult> => {\n const compatibilityResolution = compatibilityResolver({\n packageMetadata: input.packageMetadata,\n });\n\n if (compatibilityResolution.kind === 'invalid') {\n return createMoldeaCliErrorResult(\n createMoldeaCliOwnedError('COMPATIBILITY_STATE_INVALID'),\n input.invocation.command,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n MOLDEA_CLI_EXIT_CODES.OperationalError,\n );\n }\n\n if (input.invocation.command === MOLDEA_CLI_COMMANDS.Compatibility) {\n return createMoldeaCliCompatibilityExecutionResult(\n compatibilityResolution.result,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n );\n }\n\n const discoveryResult = await workingTreeDiscovery({\n invocationDirectory: input.invocationDirectory,\n repositoryDirectory: input.invocation.options.repositoryDirectory,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (discoveryResult.kind === 'failed') {\n return createMoldeaCliErrorResult(\n createMoldeaCliOwnedError(discoveryResult.errorCode),\n input.invocation.command,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n MOLDEA_CLI_EXIT_CODES.OperationalError,\n );\n }\n\n try {\n const resourceLimits = input.invocation.options.resourceLimits;\n const snapshotResult = await workingTreeSnapshotExecutor({\n operation: (repository, signal) =>\n coreInspectionExecutor({\n repository,\n resourceLimits,\n ...(signal === undefined ? {} : { signal }),\n }),\n repositoryRoot: discoveryResult.repositoryRoot,\n resourceLimits,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (snapshotResult.kind === 'failed') {\n return createMoldeaCliErrorResult(\n createMoldeaCliOwnedError(snapshotResult.errorCode),\n input.invocation.command,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n MOLDEA_CLI_EXIT_CODES.OperationalError,\n );\n }\n\n if (input.invocation.command === MOLDEA_CLI_COMMANDS.Validate) {\n return createMoldeaCliValidateExecutionResult(\n snapshotResult.result,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n );\n }\n\n return createMoldeaCliInspectExecutionResult(\n snapshotResult.result,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n );\n } catch (error) {\n return createMoldeaCliErrorResult(\n mapMoldeaCliOperationalError(error),\n input.invocation.command,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n MOLDEA_CLI_EXIT_CODES.OperationalError,\n );\n }\n };\n\n// default private command dispatcher used by the executable runner\nexport const executeMoldeaCliCommand = createMoldeaCliCommandExecutor();\n","import { parseMoldeaCliArguments } from '../command-line/index.js';\nimport { createMoldeaCliOwnedError, formatMoldeaCliHelp } from '../presentation/index.js';\n\nimport { executeMoldeaCliCommand } from './command-executor.js';\nimport { MOLDEA_CLI_EXIT_CODES } from './constants.js';\nimport { createMoldeaCliErrorResult } from './results.js';\nimport type { IMoldeaCliExecutionResult, IRunMoldeaCliOptions } from './types.js';\n\n/**\n * Runs one process-neutral CLI invocation through parsing and private command dispatch.\n * @param options The arguments, installed metadata, optional cancellation, and executor seam.\n * @returns A promise resolving to exact process output and the handled exit code.\n */\nexport const runMoldeaCli = async (\n options: IRunMoldeaCliOptions,\n): Promise<IMoldeaCliExecutionResult> => {\n const parseResult = parseMoldeaCliArguments(options.commandLineArguments);\n\n if (parseResult.kind === 'help') {\n return {\n exitCode: MOLDEA_CLI_EXIT_CODES.Success,\n stderr: '',\n stdout: formatMoldeaCliHelp(parseResult.command),\n };\n }\n\n if (parseResult.kind === 'version') {\n return {\n exitCode: MOLDEA_CLI_EXIT_CODES.Success,\n stderr: '',\n stdout: `${options.packageMetadata.version}\\n`,\n };\n }\n\n if (parseResult.kind === 'error') {\n return createMoldeaCliErrorResult(\n createMoldeaCliOwnedError(parseResult.code),\n parseResult.command,\n options.packageMetadata.version,\n parseResult.isJson,\n MOLDEA_CLI_EXIT_CODES.UsageError,\n );\n }\n\n const executeCommand = options.executeCommand ?? executeMoldeaCliCommand;\n\n try {\n return await executeCommand({\n invocationDirectory: options.invocationDirectory,\n invocation: parseResult.invocation,\n packageMetadata: options.packageMetadata,\n ...(options.signal === undefined ? {} : { signal: options.signal }),\n });\n } catch {\n return createMoldeaCliErrorResult(\n createMoldeaCliOwnedError('INTERNAL_ERROR'),\n parseResult.invocation.command,\n options.packageMetadata.version,\n parseResult.invocation.options.isJson,\n MOLDEA_CLI_EXIT_CODES.OperationalError,\n );\n }\n};\n","import { readFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { valid as isValidVersion } from 'semver';\n\nimport type { IMoldeaCliPackageEntryResolver, IMoldeaCliPackageMetadata } from './types.js';\n\nconst MOLDEA_CLI_PACKAGE_NAME = '@moldea.ai/cli';\n\n/** Checks exact SemVer syntax without accepting normalized prefixes or surrounding whitespace. */\nconst isExactSemanticVersion = (version: string): boolean =>\n version === version.trim() && /^[0-9]/u.test(version) && isValidVersion(version) !== null;\n\nconst isPlainRecord = (value: unknown): value is Readonly<Record<string, unknown>> => {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n return false;\n }\n\n const prototype = Object.getPrototypeOf(value) as object | null;\n\n return prototype === Object.prototype || prototype === null;\n};\n\n/** Returns a frozen string record, or null when a package composition field is malformed. */\nconst readStringRecord = (value: unknown): Readonly<Record<string, string>> | null => {\n if (!isPlainRecord(value)) {\n return null;\n }\n\n const entries = Object.entries(value);\n\n if (entries.some(([, entryValue]) => typeof entryValue !== 'string')) {\n return null;\n }\n\n return Object.freeze(Object.fromEntries(entries) as Record<string, string>);\n};\n\n/** Resolves one package entry through the executable's own module-resolution context. */\nconst resolvePackageEntry: IMoldeaCliPackageEntryResolver = (packageName) =>\n import.meta.resolve(packageName);\n\n/** Narrows a resolved package entry after the complete resolution pass succeeds. */\nconst isInstalledPackageEntry = (\n entry: readonly [string, string] | null,\n): entry is readonly [string, string] => entry !== null;\n\n/** Reads one resolved package's exact identity without executing package code. */\nconst readInstalledPackageVersion = async (\n packageName: string,\n packageEntry: string,\n): Promise<string | null> => {\n let packageDirectory: string;\n\n try {\n const packageEntryUrl = new URL(packageEntry);\n\n if (packageEntryUrl.protocol !== 'file:') {\n return null;\n }\n\n packageDirectory = path.dirname(fileURLToPath(packageEntryUrl));\n } catch {\n return null;\n }\n\n while (true) {\n try {\n const parsedManifest = JSON.parse(\n await readFile(path.join(packageDirectory, 'package.json'), 'utf8'),\n ) as unknown;\n\n if (isPlainRecord(parsedManifest) && parsedManifest['name'] === packageName) {\n const version = parsedManifest['version'];\n\n return typeof version === 'string' && isExactSemanticVersion(version) ? version : null;\n }\n } catch {\n // continue toward the package root when this directory has no readable manifest\n }\n\n const parentDirectory = path.dirname(packageDirectory);\n\n if (parentDirectory === packageDirectory) {\n return null;\n }\n\n packageDirectory = parentDirectory;\n }\n};\n\n/** Resolves the actual versions of every declared first-class package dependency. */\nconst readInstalledPackageVersions = async (\n dependencies: Readonly<Record<string, string>> | null,\n packageEntryResolver: IMoldeaCliPackageEntryResolver,\n): Promise<Readonly<Record<string, string>> | null> => {\n if (dependencies === null) {\n return null;\n }\n\n const packageNames = Object.keys(dependencies).filter((packageName) =>\n packageName.startsWith('@moldea.ai/'),\n );\n const installedPackageEntries = await Promise.all(\n packageNames.map(async (packageName) => {\n try {\n const version = await readInstalledPackageVersion(\n packageName,\n packageEntryResolver(packageName),\n );\n\n return version === null ? null : ([packageName, version] as const);\n } catch {\n return null;\n }\n }),\n );\n\n if (!installedPackageEntries.every(isInstalledPackageEntry)) {\n return null;\n }\n\n return Object.freeze(Object.fromEntries(installedPackageEntries));\n};\n\n/**\n * Loads the installed CLI identity and composition used by executable output and integrity checks.\n * @param packageManifestPath The package manifest adjacent to the distribution directory.\n * @param packageEntryResolver The module-resolution boundary for declared first-class packages.\n * @returns A promise resolving to validated package metadata.\n * @throws\n * - If the manifest cannot be read, parsed, or identified as the installed CLI package\n */\nexport const loadMoldeaCliPackageMetadata = async (\n packageManifestPath: string,\n packageEntryResolver: IMoldeaCliPackageEntryResolver = resolvePackageEntry,\n): Promise<IMoldeaCliPackageMetadata> => {\n const parsedManifest = JSON.parse(await readFile(packageManifestPath, 'utf8')) as unknown;\n\n if (\n !isPlainRecord(parsedManifest) ||\n parsedManifest['name'] !== MOLDEA_CLI_PACKAGE_NAME ||\n typeof parsedManifest['version'] !== 'string' ||\n !isExactSemanticVersion(parsedManifest['version'])\n ) {\n throw new TypeError('The installed CLI package metadata is invalid.');\n }\n\n const engines = readStringRecord(parsedManifest['engines']);\n const dependencies = readStringRecord(parsedManifest['dependencies']);\n\n return Object.freeze({\n dependencies,\n installedPackageVersions: await readInstalledPackageVersions(\n dependencies,\n packageEntryResolver,\n ),\n supportedNodeRange: engines?.['node'] ?? null,\n version: parsedManifest['version'],\n });\n};\n","import process from 'node:process';\n\nimport { MOLDEA_CLI_EXIT_CODES } from '../cli-execution/constants.js';\n\nimport type {\n IMoldeaCliProcessSignalSession,\n IMoldeaCliProcessSignalSource,\n IMoldeaCliSignalExitCode,\n IMoldeaCliTerminationSignal,\n} from './types.js';\n\nconst SIGNAL_EXIT_CODES = Object.freeze({\n SIGINT: MOLDEA_CLI_EXIT_CODES.Interrupted,\n SIGTERM: MOLDEA_CLI_EXIT_CODES.Terminated,\n} as const satisfies Readonly<Record<IMoldeaCliTerminationSignal, IMoldeaCliSignalExitCode>>);\n\nconst PROCESS_SIGNAL_SOURCE: IMoldeaCliProcessSignalSource = Object.freeze({\n addListener: (signal: IMoldeaCliTerminationSignal, listener: () => void): void => {\n process.on(signal, listener);\n },\n removeListener: (signal: IMoldeaCliTerminationSignal, listener: () => void): void => {\n process.off(signal, listener);\n },\n});\n\n/**\n * Creates one process-signal session around an operation-scoped abort controller.\n * @param signalSource The process-listener boundary.\n * @returns A session that records the first signal until output completes.\n */\nexport const createMoldeaCliProcessSignalSession = (\n signalSource: IMoldeaCliProcessSignalSource = PROCESS_SIGNAL_SOURCE,\n): IMoldeaCliProcessSignalSession => {\n const controller = new AbortController();\n let exitCode: IMoldeaCliSignalExitCode | null = null;\n let isDisposed = false;\n let isOutputComplete = false;\n\n const handleSignal = (signal: IMoldeaCliTerminationSignal): void => {\n if (exitCode !== null || isDisposed || isOutputComplete) {\n return;\n }\n\n exitCode = SIGNAL_EXIT_CODES[signal];\n controller.abort();\n };\n const handleSigint = (): void => handleSignal('SIGINT');\n const handleSigterm = (): void => handleSignal('SIGTERM');\n\n signalSource.addListener('SIGINT', handleSigint);\n signalSource.addListener('SIGTERM', handleSigterm);\n\n return Object.freeze({\n completeOutput: (): void => {\n isOutputComplete = true;\n },\n dispose: (): void => {\n if (isDisposed) {\n return;\n }\n\n isDisposed = true;\n signalSource.removeListener('SIGINT', handleSigint);\n signalSource.removeListener('SIGTERM', handleSigterm);\n },\n get exitCode(): IMoldeaCliSignalExitCode | null {\n return exitCode;\n },\n get hasReceivedSignal(): boolean {\n return exitCode !== null;\n },\n signal: controller.signal,\n });\n};\n","import path from 'node:path';\nimport process from 'node:process';\nimport { fileURLToPath } from 'node:url';\n\nimport { runMoldeaCli } from '../cli-execution/index.js';\nimport { loadMoldeaCliPackageMetadata } from '../package-metadata/index.js';\nimport { createMoldeaCliOwnedError, formatMoldeaCliHumanError } from '../presentation/index.js';\nimport { createMoldeaCliProcessSignalSession } from '../process-signal/index.js';\n\nconst executableDirectory = path.dirname(fileURLToPath(import.meta.url));\nconst packageManifestPath = path.resolve(executableDirectory, '..', 'package.json');\nconst signalSession = createMoldeaCliProcessSignalSession();\n\n/**\n * Writes one complete process output string.\n * @param outputStream The destination process stream.\n * @param output The complete output to write.\n * @returns A promise resolving after the stream accepts the output.\n */\nconst writeProcessOutput = async (\n outputStream: NodeJS.WriteStream,\n output: string,\n): Promise<void> => {\n if (output.length === 0) {\n return;\n }\n\n await new Promise<void>((resolve, reject) => {\n outputStream.write(output, (error) => {\n if (error) {\n reject(error);\n return;\n }\n\n resolve();\n });\n });\n};\n\ntry {\n const invocationDirectory = process.cwd();\n const packageMetadata = await loadMoldeaCliPackageMetadata(packageManifestPath);\n const executionResult = await runMoldeaCli({\n commandLineArguments: process.argv.slice(2),\n invocationDirectory,\n packageMetadata,\n signal: signalSession.signal,\n });\n\n if (signalSession.hasReceivedSignal) {\n process.exitCode = signalSession.exitCode;\n } else {\n await writeProcessOutput(process.stdout, executionResult.stdout);\n\n if (!signalSession.hasReceivedSignal) {\n await writeProcessOutput(process.stderr, executionResult.stderr);\n }\n\n if (!signalSession.hasReceivedSignal) {\n signalSession.completeOutput();\n }\n\n process.exitCode = signalSession.exitCode ?? executionResult.exitCode;\n }\n} catch {\n if (signalSession.hasReceivedSignal) {\n process.exitCode = signalSession.exitCode;\n } else {\n await writeProcessOutput(\n process.stderr,\n formatMoldeaCliHumanError(createMoldeaCliOwnedError('INTERNAL_ERROR')),\n ).catch(() => undefined);\n signalSession.completeOutput();\n process.exitCode = 3;\n }\n} finally {\n signalSession.dispose();\n}\n"],"x_google_ignoreList":[9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAa,wBAAwB;CACnC,aAAa;CACb,kBAAkB;C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":3,"file":"moldea.js","names":["#guardedPaths","#reader","#overlayPaths","#reader"],"sources":["../src/cli-execution/constants.ts","../src/command-line/constants.ts","../src/command-line/validations.ts","../src/command-line/parser.ts","../src/presentation/constants.ts","../src/presentation/errors.ts","../src/json-serialization/serializer.ts","../src/presentation/formatters.ts","../src/presentation/transformers.ts","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/clean.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/inc.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/diff.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/major.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/minor.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/patch.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rcompare.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-loose.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-build.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/sort.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rsort.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/coerce.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/truncate.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/to-comparators.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/max-satisfying.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-satisfying.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-version.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/outside.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/gtr.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/ltr.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/intersects.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/simplify.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/subset.js","../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/index.js","../src/composition/constants.ts","../src/composition/validations.ts","../src/composition/transformers.ts","../src/core-composition/constants.ts","../src/core-composition/executor.ts","../src/git-version/constants.ts","../src/git-version/parser.ts","../src/git-process/constants.ts","../src/git-process/environment.ts","../src/git-process/utilities.ts","../src/git-process/executor.ts","../src/git-process/streaming-executor.ts","../src/git-version/preflight.ts","../src/composition/composition.ts","../src/git-working-tree/constants.ts","../src/git-working-tree/parser.ts","../src/git-working-tree/starting-directory.ts","../src/git-working-tree/discovery.ts","../src/host-path-identity/utilities.ts","../src/git-working-tree/identity/comparator.ts","../src/git-working-tree/identity/constants.ts","../src/git-working-tree/identity/inspector.ts","../src/repository-content-transformation-guard/exception.ts","../src/repository-content-transformation-guard/reader.ts","../src/operational-error/constants.ts","../src/operational-error/mapper.ts","../src/git-inventory/constants.ts","../src/git-inventory/content-transformation/constants.ts","../src/git-inventory/content-transformation/parser.ts","../src/git-inventory/content-transformation/classifier.ts","../src/git-inventory/entry-type/candidate-collapser.ts","../src/git-inventory/entry-type/entry-inspector.ts","../src/git-inventory/entry-type/constants.ts","../src/git-inventory/entry-type/symlink-configuration.ts","../src/git-inventory/entry-type/normalizer.ts","../src/git-inventory/logical-path/normalizer.ts","../src/git-inventory/parser.ts","../src/git-inventory/repository-ownership/boundary-inspector.ts","../src/git-inventory/repository-ownership/path-planner.ts","../src/git-inventory/repository-ownership/ownership-filter.ts","../src/git-inventory/probe.ts","../src/git-inventory/comparison/comparator.ts","../src/repository-symlink-overlay/reader.ts","../src/repository-reader/factory.ts","../src/working-tree-snapshot/executor.ts","../src/cli-execution/results.ts","../src/cli-execution/command-executor.ts","../src/cli-execution/runner.ts","../src/package-metadata/loader.ts","../src/process-signal/session.ts","../src/bin/index.ts"],"sourcesContent":["// handled process exit codes implemented by the current CLI foundation\nexport const MOLDEA_CLI_EXIT_CODES = {\n Interrupted: 130,\n OperationalError: 3,\n StructuralInvalid: 1,\n Success: 0,\n Terminated: 143,\n UsageError: 2,\n} as const;\n","// version 1 command names accepted by the executable\nexport const MOLDEA_CLI_COMMANDS = {\n Composition: 'composition',\n Inspect: 'inspect',\n Validate: 'validate',\n} as const;\n\n// option names supported by the version 1 command grammar\nexport const MOLDEA_CLI_OPTIONS = {\n Help: '--help',\n Json: '--json',\n MaxDiagnostics: '--max-diagnostics',\n MaxEntries: '--max-entries',\n MaxEvidence: '--max-evidence',\n MaxFileBytes: '--max-file-bytes',\n MaxManifestBytes: '--max-manifest-bytes',\n MaxTotalBytes: '--max-total-bytes',\n NoColor: '--no-color',\n Repository: '--repository',\n Version: '--version',\n} as const;\n\n// default resource bounds forwarded by later command-composition slices\nexport const DEFAULT_MOLDEA_CLI_RESOURCE_LIMITS = Object.freeze({\n maxDiagnostics: 10_000,\n maxEntries: 100_000,\n maxEvidence: 10_000,\n maxFileBytes: 8_388_608,\n maxManifestBytes: 2_097_152,\n maxTotalBytes: 134_217_728,\n});\n","import type { IMoldeaCliResourceLimits } from './types.js';\n\nconst POSITIVE_INTEGER_PATTERN = /^\\d+$/u;\n\n/**\n * Determines whether text contains only Unicode scalar values.\n * @param text The text to validate.\n * @returns Whether the text contains no unpaired UTF-16 surrogate.\n */\nexport const hasOnlyUnicodeScalarValues = (text: string): boolean => {\n for (let index = 0; index < text.length; index += 1) {\n const codeUnit = text.charCodeAt(index);\n\n if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {\n if (index + 1 >= text.length) {\n return false;\n }\n\n const trailingCodeUnit = text.charCodeAt(index + 1);\n\n if (trailingCodeUnit < 0xdc00 || trailingCodeUnit > 0xdfff) {\n return false;\n }\n\n index += 1;\n continue;\n }\n\n if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * Parses one strict base-10 positive safe integer option value.\n * @param input The untrusted command-line token.\n * @returns The parsed integer, or null when the token is invalid.\n */\nexport const parsePositiveSafeInteger = (input: string): number | null => {\n if (!POSITIVE_INTEGER_PATTERN.test(input)) {\n return null;\n }\n\n const parsedInteger = Number(input);\n\n return Number.isSafeInteger(parsedInteger) && parsedInteger > 0 ? parsedInteger : null;\n};\n\n/**\n * Validates the cross-limit ordering required by the CLI composition.\n * @param limits The effective resource limits.\n * @returns Whether manifest, file, and total byte limits are consistently ordered.\n */\nexport const areMoldeaCliResourceLimitsConsistent = (limits: IMoldeaCliResourceLimits): boolean => {\n return (\n limits.maxManifestBytes <= limits.maxFileBytes && limits.maxFileBytes <= limits.maxTotalBytes\n );\n};\n\n/**\n * Determines whether one repository option is safe scalar host-path text.\n * @param input The untrusted command-line token.\n * @returns Whether the token is non-empty scalar text without NUL.\n */\nexport const isRepositoryDirectoryInputValid = (input: string): boolean => {\n return input.length > 0 && !input.includes('\\0') && hasOnlyUnicodeScalarValues(input);\n};\n","import {\n DEFAULT_MOLDEA_CLI_RESOURCE_LIMITS,\n MOLDEA_CLI_COMMANDS,\n MOLDEA_CLI_OPTIONS,\n} from './constants.js';\nimport type {\n IMoldeaCliArgumentError,\n IMoldeaCliArgumentErrorCode,\n IMoldeaCliCommand,\n IMoldeaCliCommandOptions,\n IMoldeaCliParseResult,\n IMoldeaCliResourceLimits,\n} from './types.js';\nimport {\n areMoldeaCliResourceLimitsConsistent,\n isRepositoryDirectoryInputValid,\n parsePositiveSafeInteger,\n} from './validations.js';\n\nconst COMMAND_NAMES = new Set<IMoldeaCliCommand>(Object.values(MOLDEA_CLI_COMMANDS));\nconst RESOURCE_OPTION_FIELDS = {\n [MOLDEA_CLI_OPTIONS.MaxDiagnostics]: 'maxDiagnostics',\n [MOLDEA_CLI_OPTIONS.MaxEntries]: 'maxEntries',\n [MOLDEA_CLI_OPTIONS.MaxEvidence]: 'maxEvidence',\n [MOLDEA_CLI_OPTIONS.MaxFileBytes]: 'maxFileBytes',\n [MOLDEA_CLI_OPTIONS.MaxManifestBytes]: 'maxManifestBytes',\n [MOLDEA_CLI_OPTIONS.MaxTotalBytes]: 'maxTotalBytes',\n} as const satisfies Readonly<Record<string, keyof IMoldeaCliResourceLimits>>;\n\n// mutable construction shape frozen before the normalized invocation is returned\ntype IMutableMoldeaCliResourceLimits = {\n -readonly [Key in keyof IMoldeaCliResourceLimits]: IMoldeaCliResourceLimits[Key];\n};\n\nconst createArgumentError = (\n code: IMoldeaCliArgumentErrorCode,\n command: IMoldeaCliCommand | null,\n isJson: boolean,\n): IMoldeaCliArgumentError => ({ code, command, isJson, kind: 'error' });\n\nconst isMoldeaCliCommand = (input: string | undefined): input is IMoldeaCliCommand => {\n return input !== undefined && COMMAND_NAMES.has(input as IMoldeaCliCommand);\n};\n\n/**\n * Parses the complete version 1 command grammar without mutating caller arguments.\n * @param commandLineArguments The process arguments after the executable path.\n * @returns A normalized command, informational request, or safe invocation error.\n */\nexport const parseMoldeaCliArguments = (\n commandLineArguments: readonly string[],\n): IMoldeaCliParseResult => {\n const isJson = commandLineArguments.includes(MOLDEA_CLI_OPTIONS.Json);\n\n if (commandLineArguments.length === 0) {\n return { command: null, kind: 'help' };\n }\n\n const firstArgument = commandLineArguments[0];\n\n if (firstArgument === MOLDEA_CLI_OPTIONS.Help) {\n return commandLineArguments.length === 1\n ? { command: null, kind: 'help' }\n : createArgumentError('INVALID_ARGUMENT', null, isJson);\n }\n\n if (firstArgument === MOLDEA_CLI_OPTIONS.Version) {\n return commandLineArguments.length === 1\n ? { kind: 'version' }\n : createArgumentError('INVALID_ARGUMENT', null, isJson);\n }\n\n const command = isMoldeaCliCommand(firstArgument) ? firstArgument : null;\n\n if (command === null) {\n return createArgumentError('INVALID_ARGUMENT', null, isJson);\n }\n\n if (commandLineArguments.length === 2 && commandLineArguments[1] === MOLDEA_CLI_OPTIONS.Help) {\n return { command, kind: 'help' };\n }\n\n const seenOptions = new Set<string>();\n const resourceLimits: IMutableMoldeaCliResourceLimits = {\n ...DEFAULT_MOLDEA_CLI_RESOURCE_LIMITS,\n };\n let isColorDisabled = false;\n let repositoryDirectory: string | null = null;\n\n for (let index = 1; index < commandLineArguments.length; index += 1) {\n const option = commandLineArguments[index];\n\n if (option === undefined || seenOptions.has(option)) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n seenOptions.add(option);\n\n if (option === MOLDEA_CLI_OPTIONS.Json) {\n continue;\n }\n\n if (option === MOLDEA_CLI_OPTIONS.NoColor) {\n isColorDisabled = true;\n continue;\n }\n\n if (option === MOLDEA_CLI_OPTIONS.Help || option === MOLDEA_CLI_OPTIONS.Version) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n const resourceField = RESOURCE_OPTION_FIELDS[option as keyof typeof RESOURCE_OPTION_FIELDS];\n const isRepositoryOption = option === MOLDEA_CLI_OPTIONS.Repository;\n\n if (resourceField === undefined && !isRepositoryOption) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n if (command === MOLDEA_CLI_COMMANDS.Composition) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n const optionValue = commandLineArguments[index + 1];\n\n if (optionValue === undefined || optionValue.startsWith('--')) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n index += 1;\n\n if (isRepositoryOption) {\n if (!isRepositoryDirectoryInputValid(optionValue)) {\n return createArgumentError('INVALID_ARGUMENT', command, isJson);\n }\n\n repositoryDirectory = optionValue;\n continue;\n }\n\n const parsedLimit = parsePositiveSafeInteger(optionValue);\n\n if (parsedLimit === null || resourceField === undefined) {\n return createArgumentError('RESOURCE_LIMIT_CONFIGURATION_INVALID', command, isJson);\n }\n\n resourceLimits[resourceField] = parsedLimit;\n }\n\n if (!areMoldeaCliResourceLimitsConsistent(resourceLimits)) {\n return createArgumentError('RESOURCE_LIMIT_CONFIGURATION_INVALID', command, isJson);\n }\n\n const options: IMoldeaCliCommandOptions = {\n isColorDisabled,\n isJson,\n repositoryDirectory,\n resourceLimits: Object.freeze({ ...resourceLimits }),\n };\n\n return {\n invocation: Object.freeze({ command, options: Object.freeze(options) }),\n kind: 'command',\n };\n};\n","import { MOLDEA_CLI_COMMANDS } from '../command-line/index.js';\n\n// stable safe presentation contracts for errors implemented by the CLI\nexport const MOLDEA_CLI_ERROR_DEFINITIONS = Object.freeze({\n COMPOSITION_STATE_INVALID: Object.freeze({\n message: 'The installed composition state is invalid.',\n retryable: false,\n source: 'cli',\n }),\n GIT_ACCESS_DENIED: Object.freeze({\n message: 'Git access was denied.',\n retryable: true,\n source: 'git',\n }),\n GIT_COMMAND_FAILED: Object.freeze({\n message: 'The Git command failed.',\n retryable: true,\n source: 'git',\n }),\n GIT_CONTENT_TRANSFORM_UNSUPPORTED: Object.freeze({\n message: 'The requested file uses an unsupported Git content transformation.',\n retryable: false,\n source: 'git',\n }),\n GIT_NOT_FOUND: Object.freeze({\n message: 'The Git executable is unavailable.',\n retryable: false,\n source: 'git',\n }),\n GIT_OPERATION_ABORTED: Object.freeze({\n message: 'The Git operation was aborted.',\n retryable: true,\n source: 'git',\n }),\n GIT_OUTPUT_INVALID: Object.freeze({\n message: 'Git returned invalid output.',\n retryable: false,\n source: 'git',\n }),\n GIT_REPOSITORY_NOT_FOUND: Object.freeze({\n message: 'The selected path is not inside a Git repository.',\n retryable: false,\n source: 'git',\n }),\n GIT_SPARSE_CHECKOUT_UNSUPPORTED: Object.freeze({\n message: 'Sparse Git checkouts are unsupported.',\n retryable: false,\n source: 'git',\n }),\n GIT_VERSION_INVALID: Object.freeze({\n message: 'The Git version output is invalid.',\n retryable: false,\n source: 'git',\n }),\n GIT_VERSION_UNSUPPORTED: Object.freeze({\n message: 'The installed Git version is unsupported.',\n retryable: false,\n source: 'git',\n }),\n GIT_WORK_TREE_REQUIRED: Object.freeze({\n message: 'A usable Git working tree is required.',\n retryable: false,\n source: 'git',\n }),\n INTERNAL_ERROR: Object.freeze({\n message: 'The command could not be completed.',\n retryable: false,\n source: 'cli',\n }),\n INVALID_ARGUMENT: Object.freeze({\n message: 'The command invocation is invalid.',\n retryable: false,\n source: 'cli',\n }),\n RESOURCE_LIMIT_CONFIGURATION_INVALID: Object.freeze({\n message: 'The resource-limit configuration is invalid.',\n retryable: false,\n source: 'cli',\n }),\n RESOURCE_LIMIT_EXCEEDED: Object.freeze({\n message: 'A resource limit was exceeded.',\n retryable: false,\n source: 'cli',\n }),\n WORKING_TREE_UNSTABLE: Object.freeze({\n message: 'The working tree did not remain stable.',\n retryable: true,\n source: 'cli',\n }),\n} as const);\n\n// source descriptor for results derived from the selected Git working tree\nexport const MOLDEA_CLI_GIT_WORKING_TREE_SOURCE = Object.freeze({\n kind: 'git-working-tree' as const,\n});\n\n// top-level help presented without repository access\nexport const MOLDEA_CLI_TOP_LEVEL_HELP = `Usage: moldea <command> [options]\n\nCommands:\n validate Validate the current moldea project.\n inspect Inspect the current moldea project.\n composition Report the installed CLI composition state.\n\nGlobal options:\n --help Show top-level help.\n --version Show the CLI version.\n\nRun \"moldea <command> --help\" for command-specific options.\n`;\n\nconst INSPECTION_OPTIONS_HELP = `Options:\n --repository <path> Select a Git working-tree directory.\n --json Emit one machine-readable JSON result.\n --no-color Disable ANSI styling in human output.\n --max-entries <integer> Override the repository entry limit.\n --max-file-bytes <integer> Override the per-file byte limit.\n --max-total-bytes <integer> Override the total cached-byte limit.\n --max-manifest-bytes <integer> Override the manifest byte limit.\n --max-diagnostics <integer> Override the diagnostic count limit.\n --max-evidence <integer> Override the adapter evidence count limit.\n --help Show this help.\n`;\n\n// complete command-specific help keyed by the closed command set\nexport const MOLDEA_CLI_COMMAND_HELP = {\n [MOLDEA_CLI_COMMANDS.Composition]: `Usage: moldea composition [options]\n\nReport the installed CLI composition state.\n\nOptions:\n --json Emit one machine-readable JSON result.\n --no-color Disable ANSI styling in human output.\n --help Show this help.\n`,\n [MOLDEA_CLI_COMMANDS.Inspect]: `Usage: moldea inspect [options]\n\nInspect the current moldea project.\n\n${INSPECTION_OPTIONS_HELP}`,\n [MOLDEA_CLI_COMMANDS.Validate]: `Usage: moldea validate [options]\n\nValidate the current moldea project.\n\n${INSPECTION_OPTIONS_HELP}`,\n} as const;\n","import { MOLDEA_CLI_ERROR_DEFINITIONS } from './constants.js';\nimport type { IMoldeaCliError, IMoldeaCliOwnedErrorCode } from './types.js';\n\nconst EMPTY_ERROR_DETAILS = Object.freeze({});\n\n/**\n * Creates one immutable safe error from a CLI- or Git-owned definition.\n * @param code The stable executable-owned error code.\n * @returns The complete safe error object.\n */\nexport const createMoldeaCliOwnedError = (code: IMoldeaCliOwnedErrorCode): IMoldeaCliError => {\n const definition = MOLDEA_CLI_ERROR_DEFINITIONS[code];\n\n return Object.freeze({\n code,\n details: EMPTY_ERROR_DETAILS,\n message: definition.message,\n path: null,\n retryable: definition.retryable,\n source: definition.source,\n });\n};\n","/** Compares strings by Unicode code point rather than UTF-16 code unit. */\nconst compareUnicodeCodePoints = (left: string, right: string): number => {\n const leftCodePoints = [...left];\n const rightCodePoints = [...right];\n const sharedLength = Math.min(leftCodePoints.length, rightCodePoints.length);\n\n for (let index = 0; index < sharedLength; index += 1) {\n const leftCodePoint = leftCodePoints[index]?.codePointAt(0);\n const rightCodePoint = rightCodePoints[index]?.codePointAt(0);\n\n if (leftCodePoint === undefined || rightCodePoint === undefined) {\n throw new TypeError('The JSON object key could not be compared.');\n }\n\n if (leftCodePoint !== rightCodePoint) {\n return leftCodePoint - rightCodePoint;\n }\n }\n\n return leftCodePoints.length - rightCodePoints.length;\n};\n\n/** Serializes one validated JSON value with recursively sorted object keys. */\nconst serializeJsonValue = (value: unknown, ancestors: Set<object>): string => {\n if (value === null || typeof value === 'boolean' || typeof value === 'string') {\n return JSON.stringify(value);\n }\n\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) {\n throw new TypeError('The JSON number must be finite.');\n }\n\n return JSON.stringify(Object.is(value, -0) ? 0 : value);\n }\n\n if (typeof value !== 'object') {\n throw new TypeError('The value is not supported by the CLI JSON contract.');\n }\n\n if (ancestors.has(value)) {\n throw new TypeError('The CLI JSON value must not contain a cycle.');\n }\n\n ancestors.add(value);\n\n try {\n if (Array.isArray(value)) {\n const serializedEntries: string[] = [];\n\n for (let index = 0; index < value.length; index += 1) {\n if (!Object.hasOwn(value, index)) {\n throw new TypeError('The CLI JSON array must not contain empty slots.');\n }\n\n serializedEntries.push(serializeJsonValue(value[index], ancestors));\n }\n\n return `[${serializedEntries.join(',')}]`;\n }\n\n const prototype = Object.getPrototypeOf(value) as object | null;\n\n if (prototype !== Object.prototype && prototype !== null) {\n throw new TypeError('The CLI JSON object must be a plain record.');\n }\n\n if (Object.getOwnPropertySymbols(value).length > 0) {\n throw new TypeError('The CLI JSON object must not contain symbol keys.');\n }\n\n const record = value as Readonly<Record<string, unknown>>;\n const properties = Object.keys(record)\n .sort(compareUnicodeCodePoints)\n .map((key) => `${JSON.stringify(key)}:${serializeJsonValue(record[key], ancestors)}`);\n\n return `{${properties.join(',')}}`;\n } finally {\n ancestors.delete(value);\n }\n};\n\n/**\n * Serializes one CLI JSON value with exact recursive Unicode code-point key ordering.\n * @param value The closed JSON value to serialize.\n * @returns Compact deterministic JSON without a trailing line feed.\n * @throws\n * - If the value contains unsupported, non-finite, symbolic, class-backed, or cyclic data\n */\nexport const serializeJsonDeterministically = (value: unknown): string => {\n return serializeJsonValue(value, new Set());\n};\n","import type { IDiagnostic, IDiagnosticEntity } from '@moldea.ai/core';\n\nimport { MOLDEA_CLI_COMMANDS, type IMoldeaCliCommand } from '../command-line/index.js';\nimport type { IMoldeaCliCompositionResult } from '../composition/index.js';\nimport { MOLDEA_CLI_JSON_SCHEMA_VERSION } from '../json-output-contract/index.js';\nimport { serializeJsonDeterministically } from '../json-serialization/index.js';\n\nimport { MOLDEA_CLI_COMMAND_HELP, MOLDEA_CLI_TOP_LEVEL_HELP } from './constants.js';\nimport type {\n IMoldeaCliError,\n IMoldeaCliInspectResult,\n IMoldeaCliJsonCompositionEnvelope,\n IMoldeaCliJsonErrorEnvelope,\n IMoldeaCliJsonInspectEnvelope,\n IMoldeaCliJsonValidateEnvelope,\n IMoldeaCliValidateResult,\n} from './types.js';\n\nconst DIAGNOSTIC_ENTITY_KEYS = [\n 'agentId',\n 'capabilityKind',\n 'capabilityId',\n 'decisionId',\n 'variableId',\n 'adapterId',\n] as const satisfies readonly (keyof IDiagnosticEntity)[];\n\n/** Formats one diagnostic entity in the canonical Core field order. */\nconst formatMoldeaCliHumanDiagnosticEntity = (entity: IDiagnosticEntity): string =>\n DIAGNOSTIC_ENTITY_KEYS.flatMap((key) => {\n const identifier = entity[key];\n\n return identifier === undefined ? [] : [`${key}=${identifier}`];\n }).join(', ');\n\n/** Formats one Core or adapter diagnostic without changing its order or meaning. */\nconst formatMoldeaCliHumanDiagnostic = (diagnostic: IDiagnostic): string => {\n const location =\n diagnostic.path === null\n ? ''\n : diagnostic.range === null\n ? ` ${diagnostic.path}`\n : ` ${diagnostic.path}:${diagnostic.range.start.line}:${diagnostic.range.start.column}`;\n const lines = [`${diagnostic.source}:${diagnostic.code}${location} ${diagnostic.message}`];\n\n if (diagnostic.pointer !== null) {\n lines.push(` pointer: ${diagnostic.pointer}`);\n }\n\n if (diagnostic.entity !== null) {\n lines.push(` entity: ${formatMoldeaCliHumanDiagnosticEntity(diagnostic.entity)}`);\n }\n\n return lines.join('\\n');\n};\n\n/** Creates the shared human summary lines for one completed inspection state. */\nconst createMoldeaCliHumanStatusLines = (\n isValid: boolean,\n formatVersion: IMoldeaCliValidateResult['formatVersion'],\n): string[] => {\n const lines = [`The moldea project is ${isValid ? 'valid' : 'invalid'}.`];\n\n if (formatVersion !== null) {\n lines.push(`Repository format: ${formatVersion}`);\n }\n\n return lines;\n};\n\n/** Appends Core diagnostics and their final count without changing supplied order. */\nconst appendMoldeaCliHumanDiagnostics = (\n lines: string[],\n diagnostics: readonly IDiagnostic[],\n): void => {\n for (const diagnostic of diagnostics) {\n lines.push(formatMoldeaCliHumanDiagnostic(diagnostic));\n }\n\n const diagnosticLabel = diagnostics.length === 1 ? 'diagnostic' : 'diagnostics';\n\n lines.push(`${diagnostics.length} ${diagnosticLabel}.`);\n};\n\n/** Formats one count label with correct singular or plural grammar. */\nconst formatMoldeaCliHumanCount = (\n count: number,\n singularLabel: string,\n pluralLabel: string,\n): string => `${count === 1 ? singularLabel : pluralLabel}: ${count}`;\n\n/**\n * Formats top-level or command-specific help with its required trailing line feed.\n * @param command The resolved command, or null for top-level help.\n * @returns Human-readable help text.\n */\nexport const formatMoldeaCliHelp = (command: IMoldeaCliCommand | null): string => {\n if (command === null) {\n return MOLDEA_CLI_TOP_LEVEL_HELP;\n }\n\n return MOLDEA_CLI_COMMAND_HELP[command];\n};\n\n/**\n * Formats one safe CLI error for human stderr output.\n * @param error The complete safe operational error.\n * @returns One concise line ending with LF.\n */\nexport const formatMoldeaCliHumanError = (error: IMoldeaCliError): string =>\n `${error.source}:${error.code} ${error.message}\\n`;\n\n/**\n * Formats one safe version 2 JSON error envelope.\n * @param error The complete safe operational error.\n * @param command The resolved command, or null when resolution failed.\n * @param cliVersion The installed CLI package version.\n * @returns One compact deterministic JSON document ending with LF.\n */\nexport const formatMoldeaCliJsonError = (\n error: IMoldeaCliError,\n command: IMoldeaCliCommand | null,\n cliVersion: string,\n): string => {\n const envelope: IMoldeaCliJsonErrorEnvelope = {\n cliVersion,\n command,\n error,\n result: null,\n schemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n status: 'error',\n };\n\n return `${serializeJsonDeterministically(envelope)}\\n`;\n};\n\n/**\n * Formats one valid composition result for human stdout.\n * @param result The exact installed composition.\n * @param cliVersion The installed CLI package version.\n * @returns A deterministic complete human report ending with LF.\n */\nexport const formatMoldeaCliHumanCompositionResult = (\n result: IMoldeaCliCompositionResult,\n cliVersion: string,\n): string => {\n const lines = [\n 'The installed CLI composition state is valid.',\n `CLI version: ${cliVersion}`,\n `Supported Node.js: ${result.supportedNodeRange}`,\n `JSON output schema: ${MOLDEA_CLI_JSON_SCHEMA_VERSION}`,\n `Minimum Git: ${result.minimumGitVersion}`,\n `Repository formats: ${result.repositoryFormatVersions.join(', ')}`,\n 'Packages:',\n ...result.packages.map(({ name, version }) => ` ${name}: ${version}`),\n 'Adapters:',\n ];\n\n for (const adapter of result.adapters) {\n lines.push(\n ` ${adapter.id}: repository formats ${adapter.repositoryFormatVersions.join(', ')}`,\n );\n }\n\n return `${lines.join('\\n')}\\n`;\n};\n\n/**\n * Formats one valid composition result as a version 2 JSON envelope.\n * @param result The exact installed composition.\n * @param cliVersion The installed CLI package version.\n * @returns One compact deterministic JSON document ending with LF.\n */\nexport const formatMoldeaCliJsonCompositionResult = (\n result: IMoldeaCliCompositionResult,\n cliVersion: string,\n): string => {\n const envelope: IMoldeaCliJsonCompositionEnvelope = {\n cliVersion,\n command: MOLDEA_CLI_COMMANDS.Composition,\n error: null,\n result,\n schemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n status: 'valid',\n };\n\n return `${serializeJsonDeterministically(envelope)}\\n`;\n};\n\n/**\n * Formats one completed validation result for human stdout.\n * @param result The content-minimized validation result.\n * @returns A deterministic summary and diagnostics ending with LF.\n */\nexport const formatMoldeaCliHumanValidateResult = (result: IMoldeaCliValidateResult): string => {\n const isValid = result.diagnostics.length === 0;\n const lines = createMoldeaCliHumanStatusLines(isValid, result.formatVersion);\n\n if (!isValid) {\n appendMoldeaCliHumanDiagnostics(lines, result.diagnostics);\n }\n\n return `${lines.join('\\n')}\\n`;\n};\n\n/**\n * Formats one completed validation result as a version 2 JSON envelope.\n * @param result The content-minimized validation result.\n * @param cliVersion The installed CLI package version.\n * @returns One compact deterministic JSON document ending with LF.\n */\nexport const formatMoldeaCliJsonValidateResult = (\n result: IMoldeaCliValidateResult,\n cliVersion: string,\n): string => {\n const envelope: IMoldeaCliJsonValidateEnvelope = {\n cliVersion,\n command: MOLDEA_CLI_COMMANDS.Validate,\n error: null,\n result,\n schemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n status: result.diagnostics.length === 0 ? 'valid' : 'invalid',\n };\n\n return `${serializeJsonDeterministically(envelope)}\\n`;\n};\n\n/**\n * Formats one completed inspection result for human stdout.\n * @param result The complete inspection result and its source descriptor.\n * @returns A deterministic content-free summary or diagnostic report ending with LF.\n * @throws If a Core-valid result does not include its complete project index.\n */\nexport const formatMoldeaCliHumanInspectResult = (result: IMoldeaCliInspectResult): string => {\n const { inspection } = result;\n const lines = createMoldeaCliHumanStatusLines(inspection.valid, inspection.formatVersion);\n\n if (!inspection.valid) {\n if (inspection.evidence.length > 0) {\n lines.push(\n formatMoldeaCliHumanCount(\n inspection.evidence.length,\n 'Adapter evidence item',\n 'Adapter evidence items',\n ),\n );\n }\n\n appendMoldeaCliHumanDiagnostics(lines, inspection.diagnostics);\n\n return `${lines.join('\\n')}\\n`;\n }\n\n if (inspection.project === null) {\n throw new TypeError('A valid Core inspection must include its project index.');\n }\n\n const mirrorCount = inspection.project.agents.reduce(\n (count, agent) => count + agent.mirrors.length,\n 0,\n );\n\n lines.push(\n formatMoldeaCliHumanCount(inspection.project.context.length, 'Context asset', 'Context assets'),\n formatMoldeaCliHumanCount(inspection.project.decisions.length, 'Decision', 'Decisions'),\n formatMoldeaCliHumanCount(\n inspection.project.runtimes.length,\n 'Runtime-guidance asset',\n 'Runtime-guidance assets',\n ),\n formatMoldeaCliHumanCount(inspection.project.agents.length, 'Agent', 'Agents'),\n formatMoldeaCliHumanCount(mirrorCount, 'Mirror', 'Mirrors'),\n formatMoldeaCliHumanCount(\n inspection.evidence.length,\n 'Adapter evidence item',\n 'Adapter evidence items',\n ),\n );\n\n return `${lines.join('\\n')}\\n`;\n};\n\n/**\n * Formats one completed inspection result as a version 2 JSON envelope.\n * @param result The complete inspection result and its source descriptor.\n * @param cliVersion The installed CLI package version.\n * @returns One compact deterministic JSON document ending with LF.\n */\nexport const formatMoldeaCliJsonInspectResult = (\n result: IMoldeaCliInspectResult,\n cliVersion: string,\n): string => {\n const envelope: IMoldeaCliJsonInspectEnvelope = {\n cliVersion,\n command: MOLDEA_CLI_COMMANDS.Inspect,\n error: null,\n result,\n schemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n status: result.inspection.valid ? 'valid' : 'invalid',\n };\n\n return `${serializeJsonDeterministically(envelope)}\\n`;\n};\n","import type { IProjectInspectionResult } from '@moldea.ai/core';\n\nimport { MOLDEA_CLI_GIT_WORKING_TREE_SOURCE } from './constants.js';\nimport type { IMoldeaCliInspectResult, IMoldeaCliValidateResult } from './types.js';\n\n/** Rejects a Core result whose completion fields contradict its validity. */\nconst assertProjectInspectionInvariant = (inspection: IProjectInspectionResult): void => {\n const hasDiagnostics = inspection.diagnostics.length > 0;\n const hasProject = inspection.project !== null;\n const isConsistent = inspection.valid\n ? hasProject && !hasDiagnostics\n : !hasProject && hasDiagnostics;\n\n if (!isConsistent) {\n throw new TypeError('The Core inspection result is internally inconsistent.');\n }\n};\n\n/**\n * Reduces one complete Core inspection to the content-minimized validate result.\n * @param inspection The immutable Core inspection result.\n * @returns A frozen validation result without project content or adapter evidence.\n */\nexport const createMoldeaCliValidateResult = (\n inspection: IProjectInspectionResult,\n): IMoldeaCliValidateResult =>\n Object.freeze({\n diagnostics: inspection.diagnostics,\n formatVersion: inspection.formatVersion,\n source: MOLDEA_CLI_GIT_WORKING_TREE_SOURCE,\n });\n\n/**\n * Pairs one complete Core inspection with its non-confidential source descriptor.\n * @param inspection The immutable Core inspection result.\n * @returns A frozen result preserving the exact complete Core inspection.\n * @throws If the Core result contradicts its valid, project, and diagnostic invariants.\n */\nexport const createMoldeaCliInspectResult = (\n inspection: IProjectInspectionResult,\n): IMoldeaCliInspectResult => {\n assertProjectInspectionInvariant(inspection);\n\n return Object.freeze({\n inspection,\n source: MOLDEA_CLI_GIT_WORKING_TREE_SOURCE,\n });\n};\n","'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numeric identifiers include numeric identifiers but can be longer.\n// Therefore non-numeric identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifier, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\n\nconst isPrereleaseIdentifier = (prerelease, identifier) => {\n const identifiers = identifier.split('.')\n if (identifiers.length > prerelease.length) {\n return false\n }\n\n for (let i = 0; i < identifiers.length; i++) {\n if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {\n return false\n }\n }\n\n return true\n}\n\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (isPrereleaseIdentifier(this.prerelease, identifier)) {\n const prereleaseBase = this.prerelease[identifier.split('.').length]\n if (isNaN(prereleaseBase)) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n","'use strict'\n\nconst parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n","'use strict'\n\nconst parse = require('./parse')\nconst clean = (version, options) => {\n const s = parse(version.trim().replace(/^[=v]+/, ''), options)\n return s ? s.version : null\n}\nmodule.exports = clean\n","'use strict'\n\nconst SemVer = require('../classes/semver')\n\nconst inc = (version, release, options, identifier, identifierBase) => {\n if (typeof (options) === 'string') {\n identifierBase = identifier\n identifier = options\n options = undefined\n }\n\n try {\n return new SemVer(\n version instanceof SemVer ? version.version : version,\n options\n ).inc(release, identifier, identifierBase).version\n } catch (er) {\n return null\n }\n}\nmodule.exports = inc\n","'use strict'\n\nconst parse = require('./parse.js')\n\nconst diff = (version1, version2) => {\n const v1 = parse(version1, null, true)\n const v2 = parse(version2, null, true)\n const comparison = v1.compare(v2)\n\n if (comparison === 0) {\n return null\n }\n\n const v1Higher = comparison > 0\n const highVersion = v1Higher ? v1 : v2\n const lowVersion = v1Higher ? v2 : v1\n const highHasPre = !!highVersion.prerelease.length\n const lowHasPre = !!lowVersion.prerelease.length\n\n if (lowHasPre && !highHasPre) {\n // Going from prerelease -> no prerelease requires some special casing\n\n // If the low version has only a major, then it will always be a major\n // Some examples:\n // 1.0.0-1 -> 1.0.0\n // 1.0.0-1 -> 1.1.1\n // 1.0.0-1 -> 2.0.0\n if (!lowVersion.patch && !lowVersion.minor) {\n return 'major'\n }\n\n // If the main part has no difference\n if (lowVersion.compareMain(highVersion) === 0) {\n if (lowVersion.minor && !lowVersion.patch) {\n return 'minor'\n }\n return 'patch'\n }\n }\n\n // add the `pre` prefix if we are going to a prerelease version\n const prefix = highHasPre ? 'pre' : ''\n\n if (v1.major !== v2.major) {\n return prefix + 'major'\n }\n\n if (v1.minor !== v2.minor) {\n return prefix + 'minor'\n }\n\n if (v1.patch !== v2.patch) {\n return prefix + 'patch'\n }\n\n // high and low are prereleases\n return 'prerelease'\n}\n\nmodule.exports = diff\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst major = (a, loose) => new SemVer(a, loose).major\nmodule.exports = major\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst minor = (a, loose) => new SemVer(a, loose).minor\nmodule.exports = minor\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst patch = (a, loose) => new SemVer(a, loose).patch\nmodule.exports = patch\n","'use strict'\n\nconst parse = require('./parse')\nconst prerelease = (version, options) => {\n const parsed = parse(version, options)\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\nmodule.exports = prerelease\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","'use strict'\n\nconst compare = require('./compare')\nconst rcompare = (a, b, loose) => compare(b, a, loose)\nmodule.exports = rcompare\n","'use strict'\n\nconst compare = require('./compare')\nconst compareLoose = (a, b) => compare(a, b, true)\nmodule.exports = compareLoose\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compareBuild = (a, b, loose) => {\n const versionA = new SemVer(a, loose)\n const versionB = new SemVer(b, loose)\n return versionA.compare(versionB) || versionA.compareBuild(versionB)\n}\nmodule.exports = compareBuild\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))\nmodule.exports = sort\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))\nmodule.exports = rsort\n","'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = require('./parse')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst coerce = (version, options) => {\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version === 'number') {\n version = String(version)\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n options = options || {}\n\n let match = null\n if (!options.rtl) {\n match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])\n } else {\n // Find the right-most coercible string that does not share\n // a terminus with a more left-ward coercible string.\n // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'\n //\n // Walk through the string checking with a /g regexp\n // Manually set the index so as to pick up overlapping matches.\n // Stop when we get a match that ends at the string end, since no\n // coercible string can be more right-ward without the same terminus.\n const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]\n let next\n while ((next = coerceRtlRegex.exec(version)) &&\n (!match || match.index + match[0].length !== version.length)\n ) {\n if (!match ||\n next.index + next[0].length !== match.index + match[0].length) {\n match = next\n }\n coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length\n }\n // leave it in a clean state\n coerceRtlRegex.lastIndex = -1\n }\n\n if (match === null) {\n return null\n }\n\n const major = match[2]\n const minor = match[3] || '0'\n const patch = match[4] || '0'\n const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''\n const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''\n\n return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)\n}\nmodule.exports = coerce\n","'use strict'\n\nconst parse = require('./parse')\nconst constants = require('../internal/constants')\nconst SemVer = require('../classes/semver')\n\nconst truncate = (version, truncation, options) => {\n if (!constants.RELEASE_TYPES.includes(truncation)) {\n return null\n }\n\n const clonedVersion = cloneInputVersion(version, options)\n return clonedVersion && doTruncation(clonedVersion, truncation)\n}\n\nconst cloneInputVersion = (version, options) => {\n const versionStringToParse = (\n version instanceof SemVer ? version.version : version\n )\n\n return parse(versionStringToParse, options)\n}\n\nconst doTruncation = (version, truncation) => {\n if (isPrerelease(truncation)) {\n return version.version\n }\n\n version.prerelease = []\n\n switch (truncation) {\n case 'major':\n version.minor = 0\n version.patch = 0\n break\n case 'minor':\n version.patch = 0\n break\n }\n\n return version.format()\n}\n\nconst isPrerelease = (type) => {\n return type.startsWith('pre')\n}\n\nmodule.exports = truncate\n","'use strict'\n\nclass LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n","'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // strip build metadata so it can't bleed into the version\n range = range.replace(BUILDSTRIPRE, '')\n\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n src,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\n// unbounded global build-metadata stripper used by parseRange\nconst BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n comp = comp.replace(re[t.BUILD], '')\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\nconst invalidXRangeOrder = (M, m, p) => (\n (isX(M) && !isX(m)) ||\n (isX(m) && p && !isX(p))\n)\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n // if we're including prereleases in the match, then the lower bound is\n // -0, the lowest possible prerelease value, just like x-ranges and carets.\n // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n if (invalidXRangeOrder(M, m, p)) {\n return comp\n }\n\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n","'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","'use strict'\n\nconst Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\nmodule.exports = satisfies\n","'use strict'\n\nconst Range = require('../classes/range')\n\n// Mostly just for testing and legacy API reasons\nconst toComparators = (range, options) =>\n new Range(range, options).set\n .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))\n\nmodule.exports = toComparators\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\n\nconst maxSatisfying = (versions, range, options) => {\n let max = null\n let maxSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v\n maxSV = new SemVer(max, options)\n }\n }\n })\n return max\n}\nmodule.exports = maxSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst minSatisfying = (versions, range, options) => {\n let min = null\n let minSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v\n minSV = new SemVer(min, options)\n }\n }\n })\n return min\n}\nmodule.exports = minSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst gt = require('../functions/gt')\n\nconst minVersion = (range, loose) => {\n range = new Range(range, loose)\n\n let minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let setMin = null\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt(compver, setMin)) {\n setMin = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n })\n if (setMin && (!minver || gt(minver, setMin))) {\n minver = setMin\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\nmodule.exports = minVersion\n","'use strict'\n\nconst Range = require('../classes/range')\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\nmodule.exports = validRange\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Comparator = require('../classes/comparator')\nconst { ANY } = Comparator\nconst Range = require('../classes/range')\nconst satisfies = require('../functions/satisfies')\nconst gt = require('../functions/gt')\nconst lt = require('../functions/lt')\nconst lte = require('../functions/lte')\nconst gte = require('../functions/gte')\n\nconst outside = (version, range, hilo, options) => {\n version = new SemVer(version, options)\n range = new Range(range, options)\n\n let gtfn, ltefn, ltfn, comp, ecomp\n switch (hilo) {\n case '>':\n gtfn = gt\n ltefn = lte\n ltfn = lt\n comp = '>'\n ecomp = '>='\n break\n case '<':\n gtfn = lt\n ltefn = gte\n ltfn = gt\n comp = '<'\n ecomp = '<='\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisfies the range it is not outside\n if (satisfies(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let high = null\n let low = null\n\n comparators.forEach((comparator) => {\n if (comparator.semver === ANY) {\n comparator = new Comparator('>=0.0.0')\n }\n high = high || comparator\n low = low || comparator\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator\n }\n })\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n}\n\nmodule.exports = outside\n","'use strict'\n\n// Determine if version is greater than all the versions possible in the range.\nconst outside = require('./outside')\nconst gtr = (version, range, options) => outside(version, range, '>', options)\nmodule.exports = gtr\n","'use strict'\n\nconst outside = require('./outside')\n// Determine if version is less than all the versions possible in the range\nconst ltr = (version, range, options) => outside(version, range, '<', options)\nmodule.exports = ltr\n","'use strict'\n\nconst Range = require('../classes/range')\nconst intersects = (r1, r2, options) => {\n r1 = new Range(r1, options)\n r2 = new Range(r2, options)\n return r1.intersects(r2, options)\n}\nmodule.exports = intersects\n","'use strict'\n\n// given a set of versions and a range, create a \"simplified\" range\n// that includes the same versions that the original range does\n// If the original range is shorter than the simplified one, return that.\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\nmodule.exports = (versions, range, options) => {\n const set = []\n let first = null\n let prev = null\n const v = versions.sort((a, b) => compare(a, b, options))\n for (const version of v) {\n const included = satisfies(version, range, options)\n if (included) {\n prev = version\n if (!first) {\n first = version\n }\n } else {\n if (prev) {\n set.push([first, prev])\n }\n prev = null\n first = null\n }\n }\n if (first) {\n set.push([first, null])\n }\n\n const ranges = []\n for (const [min, max] of set) {\n if (min === max) {\n ranges.push(min)\n } else if (!max && min === v[0]) {\n ranges.push('*')\n } else if (!max) {\n ranges.push(`>=${min}`)\n } else if (min === v[0]) {\n ranges.push(`<=${max}`)\n } else {\n ranges.push(`${min} - ${max}`)\n }\n }\n const simplified = ranges.join(' || ')\n const original = typeof range.raw === 'string' ? range.raw : String(range)\n return simplified.length < original.length ? simplified : range\n}\n","'use strict'\n\nconst Range = require('../classes/range.js')\nconst Comparator = require('../classes/comparator.js')\nconst { ANY } = Comparator\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\n\n// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:\n// - Every simple range `r1, r2, ...` is a null set, OR\n// - Every simple range `r1, r2, ...` which is not a null set is a subset of\n// some `R1, R2, ...`\n//\n// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:\n// - If c is only the ANY comparator\n// - If C is only the ANY comparator, return true\n// - Else if in prerelease mode, return false\n// - else replace c with `[>=0.0.0]`\n// - If C is only the ANY comparator\n// - if in prerelease mode, return true\n// - else replace C with `[>=0.0.0]`\n// - Let EQ be the set of = comparators in c\n// - If EQ is more than one, return true (null set)\n// - Let GT be the highest > or >= comparator in c\n// - Let LT be the lowest < or <= comparator in c\n// - If GT and LT, and GT.semver > LT.semver, return true (null set)\n// - If any C is a = range, and GT or LT are set, return false\n// - If EQ\n// - If GT, and EQ does not satisfy GT, return true (null set)\n// - If LT, and EQ does not satisfy LT, return true (null set)\n// - If EQ satisfies every C, return true\n// - Else return false\n// - If GT\n// - If GT.semver is lower than any > or >= comp in C, return false\n// - If GT is >=, and GT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the GT.semver tuple, return false\n// - If LT\n// - If LT.semver is greater than any < or <= comp in C, return false\n// - If LT is <=, and LT.semver does not satisfy every C, return false\n// - If LT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the LT.semver tuple, return false\n// - Else return true\n\nconst subset = (sub, dom, options = {}) => {\n if (sub === dom) {\n return true\n }\n\n sub = new Range(sub, options)\n dom = new Range(dom, options)\n let sawNonNull = false\n\n OUTER: for (const simpleSub of sub.set) {\n for (const simpleDom of dom.set) {\n const isSub = simpleSubset(simpleSub, simpleDom, options)\n sawNonNull = sawNonNull || isSub !== null\n if (isSub) {\n continue OUTER\n }\n }\n // the null set is a subset of everything, but null simple ranges in\n // a complex range should be ignored. so if we saw a non-null range,\n // then we know this isn't a subset, but if EVERY simple range was null,\n // then it is a subset.\n if (sawNonNull) {\n return false\n }\n }\n return true\n}\n\nconst minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]\nconst minimumVersion = [new Comparator('>=0.0.0')]\n\nconst simpleSubset = (sub, dom, options) => {\n if (sub === dom) {\n return true\n }\n\n if (sub.length === 1 && sub[0].semver === ANY) {\n if (dom.length === 1 && dom[0].semver === ANY) {\n return true\n } else if (options.includePrerelease) {\n sub = minimumVersionWithPreRelease\n } else {\n sub = minimumVersion\n }\n }\n\n if (dom.length === 1 && dom[0].semver === ANY) {\n if (options.includePrerelease) {\n return true\n } else {\n dom = minimumVersion\n }\n }\n\n const eqSet = new Set()\n let gt, lt\n for (const c of sub) {\n if (c.operator === '>' || c.operator === '>=') {\n gt = higherGT(gt, c, options)\n } else if (c.operator === '<' || c.operator === '<=') {\n lt = lowerLT(lt, c, options)\n } else {\n eqSet.add(c.semver)\n }\n }\n\n if (eqSet.size > 1) {\n return null\n }\n\n let gtltComp\n if (gt && lt) {\n gtltComp = compare(gt.semver, lt.semver, options)\n if (gtltComp > 0) {\n return null\n } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {\n return null\n }\n }\n\n // will iterate one or zero times\n for (const eq of eqSet) {\n if (gt && !satisfies(eq, String(gt), options)) {\n return null\n }\n\n if (lt && !satisfies(eq, String(lt), options)) {\n return null\n }\n\n for (const c of dom) {\n if (!satisfies(eq, String(c), options)) {\n return false\n }\n }\n\n return true\n }\n\n let higher, lower\n let hasDomLT, hasDomGT\n // if the subset has a prerelease, we need a comparator in the superset\n // with the same tuple and a prerelease, or it's not a subset\n let needDomLTPre = lt &&\n !options.includePrerelease &&\n lt.semver.prerelease.length ? lt.semver : false\n let needDomGTPre = gt &&\n !options.includePrerelease &&\n gt.semver.prerelease.length ? gt.semver : false\n // exception: <1.2.3-0 is the same as <1.2.3\n if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&\n lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {\n needDomLTPre = false\n }\n\n for (const c of dom) {\n hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='\n hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='\n if (gt) {\n if (needDomGTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomGTPre.major &&\n c.semver.minor === needDomGTPre.minor &&\n c.semver.patch === needDomGTPre.patch) {\n needDomGTPre = false\n }\n }\n if (c.operator === '>' || c.operator === '>=') {\n higher = higherGT(gt, c, options)\n if (higher === c && higher !== gt) {\n return false\n }\n } else if (gt.operator === '>=' && !c.test(gt.semver)) {\n return false\n }\n }\n if (lt) {\n if (needDomLTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomLTPre.major &&\n c.semver.minor === needDomLTPre.minor &&\n c.semver.patch === needDomLTPre.patch) {\n needDomLTPre = false\n }\n }\n if (c.operator === '<' || c.operator === '<=') {\n lower = lowerLT(lt, c, options)\n if (lower === c && lower !== lt) {\n return false\n }\n } else if (lt.operator === '<=' && !c.test(lt.semver)) {\n return false\n }\n }\n if (!c.operator && (lt || gt) && gtltComp !== 0) {\n return false\n }\n }\n\n // if there was a < or >, and nothing in the dom, then must be false\n // UNLESS it was limited by another range in the other direction.\n // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0\n if (gt && hasDomLT && !lt && gtltComp !== 0) {\n return false\n }\n\n if (lt && hasDomGT && !gt && gtltComp !== 0) {\n return false\n }\n\n // we needed a prerelease range in a specific tuple, but didn't get one\n // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,\n // because it includes prereleases in the 1.2.3 tuple\n if (needDomGTPre || needDomLTPre) {\n return false\n }\n\n return true\n}\n\n// >=1.2.3 is lower than >1.2.3\nconst higherGT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp > 0 ? a\n : comp < 0 ? b\n : b.operator === '>' && a.operator === '>=' ? b\n : a\n}\n\n// <=1.2.3 is higher than <1.2.3\nconst lowerLT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp < 0 ? a\n : comp > 0 ? b\n : b.operator === '<' && a.operator === '<=' ? b\n : a\n}\n\nmodule.exports = subset\n","'use strict'\n\n// just pre-load all the stuff that index.js lazily exports\nconst internalRe = require('./internal/re')\nconst constants = require('./internal/constants')\nconst SemVer = require('./classes/semver')\nconst identifiers = require('./internal/identifiers')\nconst parse = require('./functions/parse')\nconst valid = require('./functions/valid')\nconst clean = require('./functions/clean')\nconst inc = require('./functions/inc')\nconst diff = require('./functions/diff')\nconst major = require('./functions/major')\nconst minor = require('./functions/minor')\nconst patch = require('./functions/patch')\nconst prerelease = require('./functions/prerelease')\nconst compare = require('./functions/compare')\nconst rcompare = require('./functions/rcompare')\nconst compareLoose = require('./functions/compare-loose')\nconst compareBuild = require('./functions/compare-build')\nconst sort = require('./functions/sort')\nconst rsort = require('./functions/rsort')\nconst gt = require('./functions/gt')\nconst lt = require('./functions/lt')\nconst eq = require('./functions/eq')\nconst neq = require('./functions/neq')\nconst gte = require('./functions/gte')\nconst lte = require('./functions/lte')\nconst cmp = require('./functions/cmp')\nconst coerce = require('./functions/coerce')\nconst truncate = require('./functions/truncate')\nconst Comparator = require('./classes/comparator')\nconst Range = require('./classes/range')\nconst satisfies = require('./functions/satisfies')\nconst toComparators = require('./ranges/to-comparators')\nconst maxSatisfying = require('./ranges/max-satisfying')\nconst minSatisfying = require('./ranges/min-satisfying')\nconst minVersion = require('./ranges/min-version')\nconst validRange = require('./ranges/valid')\nconst outside = require('./ranges/outside')\nconst gtr = require('./ranges/gtr')\nconst ltr = require('./ranges/ltr')\nconst intersects = require('./ranges/intersects')\nconst simplifyRange = require('./ranges/simplify')\nconst subset = require('./ranges/subset')\nmodule.exports = {\n parse,\n valid,\n clean,\n inc,\n diff,\n major,\n minor,\n patch,\n prerelease,\n compare,\n rcompare,\n compareLoose,\n compareBuild,\n sort,\n rsort,\n gt,\n lt,\n eq,\n neq,\n gte,\n lte,\n cmp,\n coerce,\n truncate,\n Comparator,\n Range,\n satisfies,\n toComparators,\n maxSatisfying,\n minSatisfying,\n minVersion,\n validRange,\n outside,\n gtr,\n ltr,\n intersects,\n simplifyRange,\n subset,\n SemVer,\n re: internalRe.re,\n src: internalRe.src,\n tokens: internalRe.t,\n SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,\n RELEASE_TYPES: constants.RELEASE_TYPES,\n compareIdentifiers: identifiers.compareIdentifiers,\n rcompareIdentifiers: identifiers.rcompareIdentifiers,\n}\n","// exact first-class package identities required by every CLI release\nexport const MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES = Object.freeze([\n '@moldea.ai/core',\n '@moldea.ai/repository',\n '@moldea.ai/repository-fs',\n] as const);\n\n// stable package and adapter identities used by runtime composition validation\nexport const MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX = '@moldea.ai/adapter-';\nexport const MOLDEA_CLI_CUSTOM_ADAPTER_ID = 'custom';\n","import { valid as isValidVersion, validRange } from 'semver';\n\nimport type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\n\nimport {\n MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX,\n MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n} from './constants.js';\nimport type { IMoldeaCliCompositionStateInput } from './types.js';\n\nconst ADAPTER_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;\n\nconst hasExactStringSet = (left: readonly string[], right: readonly string[]): boolean => {\n if (\n left.length !== right.length ||\n new Set(left).size !== left.length ||\n new Set(right).size !== right.length\n ) {\n return false;\n }\n\n const rightValues = new Set(right);\n return left.every((entry) => rightValues.has(entry));\n};\n\nconst hasUniquePositiveIntegers = (entries: readonly number[]): boolean =>\n entries.length > 0 &&\n entries.every((entry) => Number.isSafeInteger(entry) && entry > 0) &&\n new Set(entries).size === entries.length;\n\nconst createActiveAdapterMap = (\n adapters: readonly IRuntimeAdapter[],\n coreRepositoryFormatVersions: readonly number[],\n): ReadonlyMap<string, IRuntimeAdapter> | null => {\n const adapterMap = new Map<string, IRuntimeAdapter>();\n\n for (const adapter of adapters) {\n if (\n adapterMap.has(adapter.id) ||\n adapter.id === MOLDEA_CLI_CUSTOM_ADAPTER_ID ||\n !ADAPTER_ID_PATTERN.test(adapter.id) ||\n !hasUniquePositiveIntegers(adapter.supportedRepositoryFormatVersions) ||\n adapter.supportedRepositoryFormatVersions.some(\n (version) => !coreRepositoryFormatVersions.includes(version),\n )\n ) {\n return null;\n }\n\n adapterMap.set(adapter.id, adapter);\n }\n\n return adapterMap;\n};\n\n/**\n * Verifies the installed package manifest and actual executable adapter composition.\n * @param input The installed package, Core, adapter, Git, and JSON-schema state.\n * @returns Whether every runtime composition invariant is satisfied.\n */\nexport const isMoldeaCliCompositionStateValid = (\n input: IMoldeaCliCompositionStateInput,\n): boolean => {\n const { dependencies, installedPackageVersions, supportedNodeRange, version } =\n input.packageMetadata;\n\n if (\n isValidVersion(version) === null ||\n supportedNodeRange === null ||\n validRange(supportedNodeRange) === null ||\n isValidVersion(input.minimumGitVersion) === null ||\n input.outputSchemaVersion !== 2 ||\n dependencies === null ||\n installedPackageVersions === null ||\n !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)\n ) {\n return false;\n }\n\n const activeAdapterMap = createActiveAdapterMap(\n input.activeAdapters,\n input.coreSupportedRepositoryFormatVersions,\n );\n\n if (activeAdapterMap === null) {\n return false;\n }\n\n const expectedPackageNames = [\n ...MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n ...[...activeAdapterMap.keys()].map(\n (adapterId) => `${MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX}${adapterId}`,\n ),\n ];\n const declaredPackageNames = Object.keys(dependencies).filter((packageName) =>\n packageName.startsWith('@moldea.ai/'),\n );\n const resolvedPackageNames = Object.keys(installedPackageVersions);\n\n if (\n !hasExactStringSet(declaredPackageNames, expectedPackageNames) ||\n !hasExactStringSet(resolvedPackageNames, expectedPackageNames)\n ) {\n return false;\n }\n\n return expectedPackageNames.every((packageName) => {\n const resolvedVersion = installedPackageVersions[packageName];\n const declaredVersion = dependencies[packageName];\n\n return (\n resolvedVersion !== undefined &&\n isValidVersion(resolvedVersion) !== null &&\n (declaredVersion === resolvedVersion || declaredVersion === `workspace:${resolvedVersion}`)\n );\n });\n};\n","import { MOLDEA_CLI_CUSTOM_ADAPTER_ID } from './constants.js';\nimport type {\n IMoldeaCliAdapterComposition,\n IMoldeaCliCompositionResult,\n IMoldeaCliCompositionStateInput,\n} from './types.js';\n\nconst compareIdentifiers = (left: string, right: string): number =>\n left < right ? -1 : left > right ? 1 : 0;\n\n/** Recursively freezes a composition result without retaining mutable input ownership. */\nconst freezeCompositionValue = <TValue extends object>(value: TValue): TValue => {\n const pendingValues: object[] = [value];\n const visitedValues = new Set<object>();\n\n while (pendingValues.length > 0) {\n const currentValue = pendingValues.pop();\n\n if (currentValue === undefined || visitedValues.has(currentValue)) {\n continue;\n }\n\n visitedValues.add(currentValue);\n for (const nestedValue of Object.values(currentValue as Readonly<Record<string, unknown>>)) {\n if (typeof nestedValue === 'object' && nestedValue !== null) {\n pendingValues.push(nestedValue);\n }\n }\n\n Object.freeze(currentValue);\n }\n\n return value;\n};\n\n/**\n * Creates the compact immutable composition result from validated installed state.\n * @param input The already validated installed and executable composition.\n * @returns A deeply immutable composition result in deterministic report order.\n */\nexport const createMoldeaCliCompositionResult = (\n input: IMoldeaCliCompositionStateInput,\n): IMoldeaCliCompositionResult => {\n const adapters: IMoldeaCliAdapterComposition[] = [\n {\n id: MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n },\n ...input.activeAdapters.map((adapter) => ({\n id: adapter.id,\n repositoryFormatVersions: [...adapter.supportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n })),\n ].sort((left, right) => compareIdentifiers(left.id, right.id));\n const packages = Object.entries(input.packageMetadata.installedPackageVersions ?? {})\n .map(([name, version]) => ({ name, version }))\n .sort((left, right) => compareIdentifiers(left.name, right.name));\n\n return freezeCompositionValue({\n adapters,\n minimumGitVersion: input.minimumGitVersion,\n packages,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n supportedNodeRange: input.packageMetadata.supportedNodeRange ?? '',\n });\n};\n","import type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\nimport { anthropicAdapter } from '@moldea.ai/adapter-anthropic';\nimport { claudeAgentSdkAdapter } from '@moldea.ai/adapter-claude-agent-sdk';\nimport { cloudflareAgentsAdapter } from '@moldea.ai/adapter-cloudflare-agents';\nimport { eveAdapter } from '@moldea.ai/adapter-eve';\nimport { googleGenAiAdapter } from '@moldea.ai/adapter-google-genai';\nimport { langChainAdapter } from '@moldea.ai/adapter-langchain';\nimport { langGraphAdapter } from '@moldea.ai/adapter-langgraph';\nimport { openAiAdapter } from '@moldea.ai/adapter-openai';\nimport { openAiAgentsSdkAdapter } from '@moldea.ai/adapter-openai-agents-sdk';\nimport { vercelAiSdkAdapter } from '@moldea.ai/adapter-vercel-ai-sdk';\n\n// package-backed runtime adapters active in this CLI release\nexport const ACTIVE_RUNTIME_ADAPTERS: readonly IRuntimeAdapter[] = Object.freeze([\n anthropicAdapter,\n claudeAgentSdkAdapter,\n cloudflareAgentsAdapter,\n eveAdapter,\n googleGenAiAdapter,\n langChainAdapter,\n langGraphAdapter,\n openAiAdapter,\n openAiAgentsSdkAdapter,\n vercelAiSdkAdapter,\n]);\n","import { createCore } from '@moldea.ai/core';\nimport type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\n\nimport { ACTIVE_RUNTIME_ADAPTERS } from './constants.js';\nimport type { IMoldeaCliCoreFactory, IMoldeaCliCoreInspectionExecutor } from './types.js';\n\nconst compareAdapterIds = (left: IRuntimeAdapter, right: IRuntimeAdapter): number => {\n if (left.id < right.id) {\n return -1;\n }\n\n if (left.id > right.id) {\n return 1;\n }\n\n return 0;\n};\n\n/**\n * Creates the private attempt-local Core composition boundary.\n * @param coreFactory The immutable Core construction boundary.\n * @param activeAdapters The package-backed adapters active in this CLI release.\n * @returns An executor that creates and runs a fresh Core instance per snapshot attempt.\n */\nexport const createMoldeaCliCoreInspectionExecutor = (\n coreFactory: IMoldeaCliCoreFactory = createCore,\n activeAdapters: readonly IRuntimeAdapter[] = ACTIVE_RUNTIME_ADAPTERS,\n): IMoldeaCliCoreInspectionExecutor => {\n const normalizedAdapters = Object.freeze([...activeAdapters].sort(compareAdapterIds));\n\n return async (input) => {\n const core = coreFactory({\n adapters: normalizedAdapters,\n limits: Object.freeze({\n maxDiagnostics: input.resourceLimits.maxDiagnostics,\n maxEntries: input.resourceLimits.maxEntries,\n maxEvidence: input.resourceLimits.maxEvidence,\n maxFileBytes: input.resourceLimits.maxFileBytes,\n maxManifestBytes: input.resourceLimits.maxManifestBytes,\n maxTotalBytesRead: input.resourceLimits.maxTotalBytes,\n }),\n });\n\n return core.inspectProject({\n repository: input.repository,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n };\n};\n\n/**\n * Executes one project inspection through a fresh CLI-configured Core instance.\n * @returns A promise resolving to Core's complete immutable inspection result.\n * @throws\n * - DUPLICATE_ADAPTER_ID: A runtime adapter ID is registered more than once.\n * - RESERVED_ADAPTER_ID: A reserved runtime adapter ID was supplied.\n * - INVALID_ADAPTER_DEFINITION: A runtime adapter definition is invalid.\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - INVALID_REPOSITORY_PATH: A repository path is invalid.\n * - ENTRY_NOT_FOUND: A discovered file disappeared from the reader snapshot.\n * - ENTRY_NOT_FILE: A discovered file changed type during inspection.\n * - ENTRY_NOT_DIRECTORY: A discovered directory changed type during inspection.\n * - ACCESS_DENIED: Access to the repository source was denied.\n * - SOURCE_UNAVAILABLE: The repository source is unavailable.\n * - SNAPSHOT_CHANGED: The repository snapshot changed during inspection.\n * - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.\n * - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.\n * - ABORTED: Project inspection or a repository operation was aborted.\n * - ADAPTER_EXECUTION_FAILED: A runtime adapter failed or returned an invalid result.\n */\nexport const executeMoldeaCliCoreInspection = createMoldeaCliCoreInspectionExecutor();\n","// numeric components of the oldest Git version supported by the CLI\nexport const MINIMUM_GIT_VERSION_COMPONENTS = Object.freeze({\n major: 2,\n minor: 30,\n patch: 0,\n});\n\n// oldest Git version supported by the CLI\nexport const MINIMUM_GIT_VERSION = `${MINIMUM_GIT_VERSION_COMPONENTS.major}.${MINIMUM_GIT_VERSION_COMPONENTS.minor}.${MINIMUM_GIT_VERSION_COMPONENTS.patch}`;\n\n// maximum bytes accepted from each Git version output stream\nexport const MAX_GIT_VERSION_OUTPUT_BYTES = 4096;\n","import { TextDecoder } from 'node:util';\n\nimport type { IGitVersion } from './types.js';\n\nconst GIT_VERSION_PATTERN =\n /^git version (0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:[.-][0-9A-Za-z]+)*(?: \\([0-9A-Za-z](?:[0-9A-Za-z ._+/-]*[0-9A-Za-z])?\\))?$/;\n\nconst UTF8_DECODER = new TextDecoder('utf-8', {\n fatal: true,\n ignoreBOM: true,\n});\n\n/**\n * Decodes one terminated Git version line as strict UTF-8.\n * @param output The bounded stdout bytes from `git --version`.\n * @returns The line without its terminator, or null when invalid.\n */\nconst decodeGitVersionLine = (output: Uint8Array): string | null => {\n let decodedOutput: string;\n\n try {\n decodedOutput = UTF8_DECODER.decode(output);\n } catch {\n return null;\n }\n\n if (decodedOutput.startsWith('\\uFEFF')) {\n return null;\n }\n\n if (decodedOutput.endsWith('\\r\\n')) {\n return decodedOutput.slice(0, -2);\n }\n\n if (decodedOutput.endsWith('\\n')) {\n return decodedOutput.slice(0, -1);\n }\n\n return null;\n};\n\n/**\n * Parses a strict `git --version` response without accepting arbitrary prose.\n * @param output The bounded stdout bytes from Git.\n * @returns The frozen numeric version, or null when the output is invalid.\n */\nexport const parseGitVersionOutput = (output: Uint8Array): IGitVersion | null => {\n const versionLine = decodeGitVersionLine(output);\n\n if (versionLine === null || versionLine.includes('\\r') || versionLine.includes('\\n')) {\n return null;\n }\n\n const match = GIT_VERSION_PATTERN.exec(versionLine);\n\n if (match === null) {\n return null;\n }\n\n const majorText = match[1];\n const minorText = match[2];\n const patchText = match[3];\n\n if (majorText === undefined || minorText === undefined || patchText === undefined) {\n return null;\n }\n\n const major = Number(majorText);\n const minor = Number(minorText);\n const patch = Number(patchText);\n\n if (![major, minor, patch].every(Number.isSafeInteger)) {\n return null;\n }\n\n return Object.freeze({ major, minor, patch });\n};\n","// arguments applied to every Git subprocess\nexport const GIT_PROCESS_GLOBAL_ARGUMENTS = [\n '--no-pager',\n '-c',\n 'color.ui=false',\n '-c',\n 'core.fsmonitor=false',\n '-c',\n 'submodule.recurse=false',\n] as const;\n\n// maximum bytes retained from Git stderr for safe failure classification\nexport const MAX_GIT_PROCESS_DIAGNOSTIC_BYTES = 4096;\n\n// exact environment variables removed before executing Git\nexport const GIT_PROCESS_REMOVED_ENVIRONMENT_NAMES = [\n 'GIT_DIR',\n 'GIT_WORK_TREE',\n 'GIT_INDEX_FILE',\n 'GIT_OBJECT_DIRECTORY',\n 'GIT_ALTERNATE_OBJECT_DIRECTORIES',\n 'GIT_COMMON_DIR',\n 'GIT_CEILING_DIRECTORIES',\n 'GIT_DISCOVERY_ACROSS_FILESYSTEM',\n 'GIT_NAMESPACE',\n 'GIT_SHALLOW_FILE',\n 'GIT_ATTR_SOURCE',\n 'GIT_CONFIG',\n 'GIT_CONFIG_SYSTEM',\n 'GIT_CONFIG_GLOBAL',\n 'GIT_CONFIG_NOSYSTEM',\n 'GIT_CONFIG_PARAMETERS',\n 'GIT_CONFIG_COUNT',\n 'GIT_EXEC_PATH',\n 'GIT_LITERAL_PATHSPECS',\n 'GIT_GLOB_PATHSPECS',\n 'GIT_NOGLOB_PATHSPECS',\n 'GIT_ICASE_PATHSPECS',\n] as const;\n\n// environment-variable prefixes removed before executing Git\nexport const GIT_PROCESS_REMOVED_ENVIRONMENT_PREFIXES = [\n 'GIT_CONFIG_KEY_',\n 'GIT_CONFIG_VALUE_',\n 'GIT_TRACE',\n] as const;\n\n// deterministic non-interactive environment applied to every Git subprocess\nexport const GIT_PROCESS_ENVIRONMENT_OVERRIDES = Object.freeze({\n LC_ALL: 'C',\n LANG: 'C',\n LANGUAGE: 'C',\n GIT_OPTIONAL_LOCKS: '0',\n GIT_PAGER: '',\n PAGER: '',\n GIT_TERMINAL_PROMPT: '0',\n NO_COLOR: '1',\n});\n","import {\n GIT_PROCESS_ENVIRONMENT_OVERRIDES,\n GIT_PROCESS_REMOVED_ENVIRONMENT_NAMES,\n GIT_PROCESS_REMOVED_ENVIRONMENT_PREFIXES,\n} from './constants.js';\nimport type { IGitProcessEnvironment } from './types.js';\n\nconst REMOVED_ENVIRONMENT_NAMES = new Set(\n GIT_PROCESS_REMOVED_ENVIRONMENT_NAMES.map((name) => name.toUpperCase()),\n);\n\n/**\n * Determines whether an inherited environment variable can alter Git behavior.\n * @param name The environment variable name.\n * @returns Whether the variable must be removed.\n */\nconst isRemovedEnvironmentVariable = (name: string): boolean => {\n const normalizedName = name.toUpperCase();\n\n return (\n REMOVED_ENVIRONMENT_NAMES.has(normalizedName) ||\n GIT_PROCESS_REMOVED_ENVIRONMENT_PREFIXES.some((prefix) => normalizedName.startsWith(prefix))\n );\n};\n\n/**\n * Creates the immutable, deterministic environment used by Git subprocesses.\n * @param environment The host environment to sanitize.\n * @returns A frozen environment that preserves unrelated variables.\n */\nexport const createGitProcessEnvironment = (\n environment: NodeJS.ProcessEnv,\n): IGitProcessEnvironment => {\n const sanitizedEnvironment: Record<string, string> = {};\n\n for (const [name, environmentValue] of Object.entries(environment)) {\n if (\n environmentValue !== undefined &&\n !isRemovedEnvironmentVariable(name) &&\n !(name.toUpperCase() in GIT_PROCESS_ENVIRONMENT_OVERRIDES)\n ) {\n sanitizedEnvironment[name] = environmentValue;\n }\n }\n\n return Object.freeze({\n ...sanitizedEnvironment,\n ...GIT_PROCESS_ENVIRONMENT_OVERRIDES,\n });\n};\n","import type { IGitProcessFailureReason } from './types.js';\n\n/**\n * Classifies a subprocess error without retaining provider diagnostics.\n * @param error The Node.js subprocess error, or null for a nonzero exit.\n * @param stderr The bounded process diagnostic used only for classification.\n * @returns The normalized failure reason.\n */\nexport const classifyGitProcessError = (\n error: unknown,\n stderr: Uint8Array,\n): IGitProcessFailureReason => {\n const errorCode =\n error instanceof Error && 'code' in error && typeof error.code === 'string'\n ? error.code.toUpperCase()\n : '';\n\n if (errorCode === 'ENOENT') {\n return 'not-found';\n }\n\n if (errorCode === 'EACCES' || errorCode === 'EPERM') {\n return 'access-denied';\n }\n\n if (errorCode === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER') {\n return 'output-limit-exceeded';\n }\n\n const diagnostic = new TextDecoder().decode(stderr);\n\n if (diagnostic.startsWith('fatal: not a git repository')) {\n return 'repository-not-found';\n }\n\n if (\n diagnostic.startsWith('fatal: detected dubious ownership in repository at ') ||\n (diagnostic.startsWith('fatal: ') && /: Permission denied(?:\\r?\\n)?$/u.test(diagnostic))\n ) {\n return 'access-denied';\n }\n\n return 'command-failed';\n};\n","import { execFile } from 'node:child_process';\nimport process from 'node:process';\n\nimport { GIT_PROCESS_GLOBAL_ARGUMENTS } from './constants.js';\nimport { createGitProcessEnvironment } from './environment.js';\nimport type { IGitProcessExecutor, IGitProcessResult } from './types.js';\nimport { classifyGitProcessError } from './utilities.js';\n\n/**\n * Executes Git directly with trusted arguments, a sanitized environment, and bounded output.\n * @param options The trusted arguments, environment, output limit, and optional signal.\n * @returns A promise that resolves to normalized process output or failure.\n */\nexport const executeGitProcess: IGitProcessExecutor = async (options): Promise<IGitProcessResult> =>\n new Promise((resolve) => {\n if (options.signal?.aborted) {\n resolve(Object.freeze({ kind: 'failed', reason: 'aborted' }));\n return;\n }\n\n execFile(\n 'git',\n [...GIT_PROCESS_GLOBAL_ARGUMENTS, ...options.arguments],\n {\n encoding: 'buffer',\n env: createGitProcessEnvironment(options.environment ?? process.env),\n maxBuffer: options.maxBufferBytes,\n shell: false,\n ...(options.signal === undefined ? {} : { signal: options.signal }),\n windowsHide: true,\n },\n (error, stdout, stderr) => {\n if (options.signal?.aborted) {\n resolve(Object.freeze({ kind: 'failed', reason: 'aborted' }));\n return;\n }\n\n if (error) {\n resolve(\n Object.freeze({\n kind: 'failed',\n reason: classifyGitProcessError(error, stderr),\n }),\n );\n return;\n }\n\n resolve(\n Object.freeze({\n kind: 'completed',\n stdout: Uint8Array.from(stdout),\n stderr: Uint8Array.from(stderr),\n }),\n );\n },\n );\n });\n","import { spawn } from 'node:child_process';\nimport process from 'node:process';\n\nimport { GIT_PROCESS_GLOBAL_ARGUMENTS } from './constants.js';\nimport { createGitProcessEnvironment } from './environment.js';\nimport type {\n IGitStreamingProcessExecutor,\n IGitStreamingProcessFailureReason,\n IGitStreamingProcessResult,\n} from './types.js';\nimport { classifyGitProcessError } from './utilities.js';\n\n/** Concatenates the bounded stderr chunks retained for classification. */\nconst concatenateChunks = (chunks: readonly Buffer[], byteLength: number): Uint8Array =>\n Uint8Array.from(Buffer.concat(chunks, byteLength));\n\n/**\n * Executes Git directly while consuming bounded stdout incrementally.\n * @param options The trusted arguments, optional stdin and signal, consumer, environment, and limits.\n * @returns A promise that resolves to a normalized streamed process result.\n */\nexport const executeGitStreamingProcess: IGitStreamingProcessExecutor = async (\n options,\n): Promise<IGitStreamingProcessResult> =>\n new Promise((resolve, reject) => {\n if (options.signal?.aborted) {\n resolve(Object.freeze({ kind: 'failed', reason: 'aborted' }));\n return;\n }\n\n const stdin = options.stdin === undefined ? null : Uint8Array.from(options.stdin);\n const stderrChunks: Buffer[] = [];\n let failureReason: IGitStreamingProcessFailureReason | null = null;\n let isSettled = false;\n let stderrBytes = 0;\n let stdoutBytes = 0;\n\n const childProcess = spawn('git', [...GIT_PROCESS_GLOBAL_ARGUMENTS, ...options.arguments], {\n env: createGitProcessEnvironment(options.environment ?? process.env),\n shell: false,\n ...(options.signal === undefined ? {} : { signal: options.signal }),\n stdio: [stdin === null ? 'ignore' : 'pipe', 'pipe', 'pipe'],\n windowsHide: true,\n });\n const { stderr, stdout } = childProcess;\n\n if (stderr === null || stdout === null) {\n childProcess.on('error', () => undefined);\n childProcess.kill();\n resolve(Object.freeze({ kind: 'failed', reason: 'command-failed' }));\n return;\n }\n\n stdout.on('data', (chunk: Buffer) => {\n if (failureReason !== null || isSettled) {\n return;\n }\n\n if (stdoutBytes + chunk.byteLength > options.maxStdoutBytes) {\n failureReason = 'stdout-limit-exceeded';\n childProcess.kill();\n return;\n }\n\n stdoutBytes += chunk.byteLength;\n\n try {\n options.consumeStdout(Uint8Array.from(chunk));\n } catch (error) {\n isSettled = true;\n childProcess.kill();\n reject(\n error instanceof Error\n ? error\n : new Error('The Git stdout consumer failed.', { cause: error }),\n );\n }\n });\n\n stderr.on('data', (chunk: Buffer) => {\n if (failureReason !== null || isSettled) {\n return;\n }\n\n if (stderrBytes + chunk.byteLength > options.maxStderrBytes) {\n failureReason = 'stderr-limit-exceeded';\n childProcess.kill();\n return;\n }\n\n stderrBytes += chunk.byteLength;\n stderrChunks.push(chunk);\n });\n\n childProcess.on('error', (error) => {\n if (failureReason !== null || isSettled) {\n return;\n }\n\n isSettled = true;\n resolve(\n Object.freeze({\n kind: 'failed',\n reason: options.signal?.aborted\n ? 'aborted'\n : classifyGitProcessError(error, concatenateChunks(stderrChunks, stderrBytes)),\n }),\n );\n });\n\n childProcess.on('close', (exitCode) => {\n if (isSettled) {\n return;\n }\n\n isSettled = true;\n\n if (failureReason !== null) {\n resolve(Object.freeze({ kind: 'failed', reason: failureReason }));\n return;\n }\n\n if (options.signal?.aborted) {\n resolve(Object.freeze({ kind: 'failed', reason: 'aborted' }));\n return;\n }\n\n const stderr = concatenateChunks(stderrChunks, stderrBytes);\n\n if (exitCode !== 0) {\n resolve(\n Object.freeze({\n kind: 'failed',\n reason: classifyGitProcessError(null, stderr),\n }),\n );\n return;\n }\n\n resolve(Object.freeze({ kind: 'completed', stderr, stdoutBytes }));\n });\n\n if (stdin !== null) {\n if (childProcess.stdin === null) {\n failureReason = 'command-failed';\n childProcess.kill();\n return;\n }\n\n childProcess.stdin.on('error', () => {\n if (failureReason !== null || isSettled) {\n return;\n }\n\n failureReason = 'command-failed';\n childProcess.kill();\n });\n\n try {\n childProcess.stdin.end(stdin);\n } catch {\n failureReason = 'command-failed';\n childProcess.kill();\n }\n }\n });\n","import {\n executeGitProcess,\n type IGitProcessExecutor,\n type IGitProcessFailureReason,\n} from '../git-process/index.js';\nimport type { IMoldeaCliGitErrorCode } from '../presentation/index.js';\n\nimport { MAX_GIT_VERSION_OUTPUT_BYTES, MINIMUM_GIT_VERSION_COMPONENTS } from './constants.js';\nimport { parseGitVersionOutput } from './parser.js';\nimport type { IGitVersion, IGitVersionPreflight, IGitVersionPreflightResult } from './types.js';\n\n/**\n * Maps process failures to stable safe CLI errors.\n * @param reason The normalized subprocess failure reason.\n * @returns The public Git error code.\n */\nconst mapGitProcessFailure = (reason: IGitProcessFailureReason): IMoldeaCliGitErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'repository-not-found':\n return 'GIT_COMMAND_FAILED';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'output-limit-exceeded':\n return 'GIT_VERSION_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/**\n * Determines whether a parsed Git version meets the supported minimum.\n * @param version The parsed Git version.\n * @returns Whether the numeric version is supported.\n */\nconst isGitVersionSupported = (version: IGitVersion): boolean => {\n if (version.major !== MINIMUM_GIT_VERSION_COMPONENTS.major) {\n return version.major > MINIMUM_GIT_VERSION_COMPONENTS.major;\n }\n\n if (version.minor !== MINIMUM_GIT_VERSION_COMPONENTS.minor) {\n return version.minor > MINIMUM_GIT_VERSION_COMPONENTS.minor;\n }\n\n return version.patch >= MINIMUM_GIT_VERSION_COMPONENTS.patch;\n};\n\n/**\n * Creates a Git prerequisite check around an injectable process boundary.\n * @param processExecutor The normalized Git subprocess executor.\n * @returns A preflight that validates the installed Git version.\n */\nexport const createGitVersionPreflight =\n (processExecutor: IGitProcessExecutor = executeGitProcess): IGitVersionPreflight =>\n async (signal): Promise<IGitVersionPreflightResult> => {\n const processResult = await processExecutor({\n arguments: ['--version'],\n maxBufferBytes: MAX_GIT_VERSION_OUTPUT_BYTES,\n ...(signal === undefined ? {} : { signal }),\n });\n\n if (processResult.kind === 'failed') {\n return Object.freeze({\n errorCode: mapGitProcessFailure(processResult.reason),\n kind: 'failed',\n });\n }\n\n if (processResult.stderr.byteLength > 0) {\n return Object.freeze({\n errorCode: 'GIT_VERSION_INVALID',\n kind: 'failed',\n });\n }\n\n const version = parseGitVersionOutput(processResult.stdout);\n\n if (version === null) {\n return Object.freeze({\n errorCode: 'GIT_VERSION_INVALID',\n kind: 'failed',\n });\n }\n\n if (!isGitVersionSupported(version)) {\n return Object.freeze({\n errorCode: 'GIT_VERSION_UNSUPPORTED',\n kind: 'failed',\n });\n }\n\n return Object.freeze({ kind: 'supported', version });\n };\n\n// default Git prerequisite preflight used by command execution\nexport const checkGitVersion = createGitVersionPreflight();\n","import { SUPPORTED_REPOSITORY_FORMAT_VERSIONS } from '@moldea.ai/core';\n\nimport { ACTIVE_RUNTIME_ADAPTERS } from '../core-composition/index.js';\nimport { MINIMUM_GIT_VERSION } from '../git-version/index.js';\nimport { MOLDEA_CLI_JSON_SCHEMA_VERSION } from '../json-output-contract/index.js';\n\nimport { createMoldeaCliCompositionResult } from './transformers.js';\nimport type {\n IMoldeaCliCompositionResolution,\n IMoldeaCliCompositionStateInput,\n IMoldeaCliInstalledCompositionInput,\n} from './types.js';\nimport { isMoldeaCliCompositionStateValid } from './validations.js';\n\nconst INVALID_COMPOSITION_RESOLUTION = Object.freeze({ kind: 'invalid' as const });\n\n/**\n * Resolves one explicit runtime composition without emitting a partial composition result.\n * @param input The installed and actual runtime state to compare.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveMoldeaCliComposition = (\n input: IMoldeaCliCompositionStateInput,\n): IMoldeaCliCompositionResolution => {\n try {\n if (!isMoldeaCliCompositionStateValid(input)) {\n return INVALID_COMPOSITION_RESOLUTION;\n }\n\n return Object.freeze({\n kind: 'valid',\n result: createMoldeaCliCompositionResult(input),\n });\n } catch {\n return INVALID_COMPOSITION_RESOLUTION;\n }\n};\n\n/**\n * Resolves composition through the fixed package, Core, adapter, Git, and JSON composition.\n * @param input The installed package metadata.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveInstalledMoldeaCliComposition = (\n input: IMoldeaCliInstalledCompositionInput,\n): IMoldeaCliCompositionResolution =>\n resolveMoldeaCliComposition({\n activeAdapters: ACTIVE_RUNTIME_ADAPTERS,\n coreSupportedRepositoryFormatVersions: SUPPORTED_REPOSITORY_FORMAT_VERSIONS,\n minimumGitVersion: MINIMUM_GIT_VERSION,\n outputSchemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n packageMetadata: input.packageMetadata,\n });\n","// maximum bytes accepted from each Git discovery output stream\nexport const MAX_GIT_DISCOVERY_OUTPUT_BYTES = 262_144;\n","import path from 'node:path';\nimport process from 'node:process';\n\nimport { hasOnlyUnicodeScalarValues } from '../command-line/index.js';\n\nimport { MAX_GIT_DISCOVERY_OUTPUT_BYTES } from './constants.js';\n\nconst UTF8_BYTE_ORDER_MARK = [0xef, 0xbb, 0xbf] as const;\n\n/**\n * Decodes one bounded Git output value as strict UTF-8.\n * @param output The raw Git output bytes.\n * @returns The exact decoded value, or null when invalid.\n */\nconst decodeGitOutput = (output: Uint8Array): string | null => {\n if (\n output.byteLength === 0 ||\n output.byteLength > MAX_GIT_DISCOVERY_OUTPUT_BYTES ||\n UTF8_BYTE_ORDER_MARK.every((byte, index) => output[index] === byte)\n ) {\n return null;\n }\n\n let decodedOutput: string;\n\n try {\n decodedOutput = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(output);\n } catch {\n return null;\n }\n\n if (decodedOutput.includes('\\0') || !hasOnlyUnicodeScalarValues(decodedOutput)) {\n return null;\n }\n\n return decodedOutput;\n};\n\n/**\n * Parses Git's canonical boolean output.\n * @param output The raw bounded Git stdout bytes.\n * @returns The parsed boolean, or null when the output is not canonical.\n */\nexport const parseGitBooleanOutput = (output: Uint8Array): boolean | null => {\n const decodedOutput = decodeGitOutput(output);\n\n if (decodedOutput === 'true\\n' || decodedOutput === 'true\\r\\n') {\n return true;\n }\n\n if (decodedOutput === 'false\\n' || decodedOutput === 'false\\r\\n') {\n return false;\n }\n\n return null;\n};\n\n/**\n * Parses one nonempty path returned by Git.\n * @param output The raw bounded Git stdout bytes.\n * @returns The exact relative or absolute path, or null when the output is invalid.\n */\nexport const parseGitPathOutput = (output: Uint8Array): string | null => {\n const decodedOutput = decodeGitOutput(output);\n\n if (decodedOutput === null || !decodedOutput.endsWith('\\n')) {\n return null;\n }\n\n const gitPath =\n process.platform === 'win32' && decodedOutput.endsWith('\\r\\n')\n ? decodedOutput.slice(0, -2)\n : decodedOutput.slice(0, -1);\n\n return gitPath.length === 0 ? null : gitPath;\n};\n\n/**\n * Parses one absolute path returned by Git.\n * @param output The raw bounded Git stdout bytes.\n * @returns The exact absolute path, or null when the output is invalid.\n */\nexport const parseGitAbsolutePathOutput = (output: Uint8Array): string | null => {\n const gitPath = parseGitPathOutput(output);\n\n if (gitPath === null || !path.isAbsolute(gitPath)) {\n return null;\n }\n\n return gitPath;\n};\n","import { stat } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport {\n hasOnlyUnicodeScalarValues,\n isRepositoryDirectoryInputValid,\n} from '../command-line/index.js';\n\nimport type {\n IGitStartingDirectoryInspectionResult,\n IGitStartingDirectoryInspector,\n IGitStartingDirectoryStat,\n} from './types.js';\n\n/**\n * Maps a filesystem failure without retaining host diagnostics or paths.\n * @param error The unknown filesystem failure.\n * @returns An immutable safe discovery failure.\n */\nconst mapFilesystemFailure = (error: unknown): IGitStartingDirectoryInspectionResult => {\n const errorCode = (error as NodeJS.ErrnoException | null)?.code?.toUpperCase();\n\n if (errorCode === 'ENOENT' || errorCode === 'ENOTDIR') {\n return Object.freeze({ errorCode: 'GIT_REPOSITORY_NOT_FOUND', kind: 'failed' });\n }\n\n if (errorCode === 'EACCES' || errorCode === 'EPERM') {\n return Object.freeze({ errorCode: 'GIT_ACCESS_DENIED', kind: 'failed' });\n }\n\n return Object.freeze({ errorCode: 'GIT_COMMAND_FAILED', kind: 'failed' });\n};\n\n/**\n * Creates a starting-directory inspector around an injectable filesystem boundary.\n * @param inspectPath The filesystem stat operation.\n * @returns A safe inspector that resolves and verifies the selected directory.\n */\nexport const createGitStartingDirectoryInspector =\n (inspectPath: IGitStartingDirectoryStat = stat): IGitStartingDirectoryInspector =>\n async (input): Promise<IGitStartingDirectoryInspectionResult> => {\n if (\n !path.isAbsolute(input.invocationDirectory) ||\n input.invocationDirectory.includes('\\0') ||\n !hasOnlyUnicodeScalarValues(input.invocationDirectory) ||\n (input.repositoryDirectory !== null &&\n !isRepositoryDirectoryInputValid(input.repositoryDirectory))\n ) {\n return Object.freeze({ errorCode: 'GIT_REPOSITORY_NOT_FOUND', kind: 'failed' });\n }\n\n const selectedDirectory =\n input.repositoryDirectory === null\n ? input.invocationDirectory\n : path.isAbsolute(input.repositoryDirectory)\n ? input.repositoryDirectory\n : path.resolve(input.invocationDirectory, input.repositoryDirectory);\n\n try {\n const directoryStats = await inspectPath(selectedDirectory);\n\n if (!directoryStats.isDirectory()) {\n return Object.freeze({ errorCode: 'GIT_REPOSITORY_NOT_FOUND', kind: 'failed' });\n }\n } catch (error) {\n return mapFilesystemFailure(error);\n }\n\n return Object.freeze({ directory: selectedDirectory, kind: 'found' });\n };\n\n// default starting-directory inspection boundary\nexport const inspectGitStartingDirectory = createGitStartingDirectoryInspector();\n","import {\n executeGitProcess,\n type IGitProcessExecutor,\n type IGitProcessFailureReason,\n} from '../git-process/index.js';\nimport { createGitVersionPreflight, type IGitVersionPreflight } from '../git-version/index.js';\nimport type { IMoldeaCliGitErrorCode } from '../presentation/index.js';\n\nimport { MAX_GIT_DISCOVERY_OUTPUT_BYTES } from './constants.js';\nimport { parseGitAbsolutePathOutput, parseGitBooleanOutput } from './parser.js';\nimport { inspectGitStartingDirectory } from './starting-directory.js';\nimport type {\n IGitStartingDirectoryInspector,\n IGitWorkingTreeDiscovery,\n IGitWorkingTreeDiscoveryFailedResult,\n IGitWorkingTreeDiscoveryResult,\n} from './types.js';\n\n/** Maps a normalized Git process failure to a safe discovery error. */\nconst mapGitProcessFailure = (reason: IGitProcessFailureReason): IMoldeaCliGitErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'repository-not-found':\n return 'GIT_REPOSITORY_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'output-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Creates one immutable discovery failure. */\nconst createDiscoveryFailure = (\n errorCode: IMoldeaCliGitErrorCode,\n): IGitWorkingTreeDiscoveryFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/**\n * Creates Git working-tree discovery around injectable process and filesystem boundaries.\n * @param processExecutor The normalized Git subprocess executor.\n * @param startingDirectoryInspector The safe directory inspection boundary.\n * @param gitVersionPreflight The Git version prerequisite check.\n * @returns A working-tree discovery operation.\n */\nexport const createGitWorkingTreeDiscovery =\n (\n processExecutor: IGitProcessExecutor = executeGitProcess,\n startingDirectoryInspector: IGitStartingDirectoryInspector = inspectGitStartingDirectory,\n gitVersionPreflight: IGitVersionPreflight = createGitVersionPreflight(processExecutor),\n ): IGitWorkingTreeDiscovery =>\n async (input): Promise<IGitWorkingTreeDiscoveryResult> => {\n const startingDirectoryResult = await startingDirectoryInspector(input);\n\n if (startingDirectoryResult.kind === 'failed') {\n return createDiscoveryFailure(startingDirectoryResult.errorCode);\n }\n\n const workTreeResult = await processExecutor({\n arguments: ['-C', startingDirectoryResult.directory, 'rev-parse', '--is-inside-work-tree'],\n maxBufferBytes: MAX_GIT_DISCOVERY_OUTPUT_BYTES,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (workTreeResult.kind === 'failed') {\n return createDiscoveryFailure(mapGitProcessFailure(workTreeResult.reason));\n }\n\n if (workTreeResult.stderr.byteLength > 0) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n const isInsideWorkTree = parseGitBooleanOutput(workTreeResult.stdout);\n\n if (isInsideWorkTree === null) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n if (!isInsideWorkTree) {\n return createDiscoveryFailure('GIT_WORK_TREE_REQUIRED');\n }\n\n const rootResult = await processExecutor({\n arguments: ['-C', startingDirectoryResult.directory, 'rev-parse', '--show-toplevel'],\n maxBufferBytes: MAX_GIT_DISCOVERY_OUTPUT_BYTES,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (rootResult.kind === 'failed') {\n return createDiscoveryFailure(mapGitProcessFailure(rootResult.reason));\n }\n\n if (rootResult.stderr.byteLength > 0) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n const repositoryRoot = parseGitAbsolutePathOutput(rootResult.stdout);\n\n if (repositoryRoot === null) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n const rootDirectoryResult = await startingDirectoryInspector({\n invocationDirectory: startingDirectoryResult.directory,\n repositoryDirectory: repositoryRoot,\n });\n\n if (rootDirectoryResult.kind === 'failed') {\n return createDiscoveryFailure(rootDirectoryResult.errorCode);\n }\n\n const versionResult = await gitVersionPreflight(input.signal);\n\n if (versionResult.kind === 'failed') {\n return createDiscoveryFailure(versionResult.errorCode);\n }\n\n const sparseCheckoutResult = await processExecutor({\n arguments: [\n '-C',\n rootDirectoryResult.directory,\n 'config',\n '--type=bool',\n '--default=false',\n '--get',\n 'core.sparseCheckout',\n ],\n maxBufferBytes: MAX_GIT_DISCOVERY_OUTPUT_BYTES,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (sparseCheckoutResult.kind === 'failed') {\n return createDiscoveryFailure(mapGitProcessFailure(sparseCheckoutResult.reason));\n }\n\n if (sparseCheckoutResult.stderr.byteLength > 0) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n const isSparseCheckout = parseGitBooleanOutput(sparseCheckoutResult.stdout);\n\n if (isSparseCheckout === null) {\n return createDiscoveryFailure('GIT_OUTPUT_INVALID');\n }\n\n if (isSparseCheckout) {\n return createDiscoveryFailure('GIT_SPARSE_CHECKOUT_UNSUPPORTED');\n }\n\n return Object.freeze({ kind: 'discovered', repositoryRoot });\n };\n\n// default Git working-tree discovery used by command execution\nexport const discoverGitWorkingTree = createGitWorkingTreeDiscovery();\n","import path from 'node:path';\n\nimport type { IHostPathIdentity, IHostPathOperations } from './types.js';\n\n/**\n * Determines whether two absolute path spellings identify the same host path.\n * @param left The first host path.\n * @param right The second host path.\n * @param hostPathOperations The platform path operations used for comparison.\n * @returns Whether the paths are equivalent under the selected host semantics.\n */\nexport const areHostPathsEquivalent = (\n left: string,\n right: string,\n hostPathOperations: IHostPathOperations = path,\n): boolean =>\n hostPathOperations.relative(\n hostPathOperations.resolve(left),\n hostPathOperations.resolve(right),\n ) === '';\n\n/**\n * Determines whether two observations identify the same filesystem entry.\n * @param left The first filesystem observation.\n * @param right The second filesystem observation.\n * @returns Whether both observations have the same nonzero device and inode identity.\n */\nexport const haveSameHostPathIdentity = (\n left: IHostPathIdentity,\n right: IHostPathIdentity,\n): boolean => left.ino !== 0n && left.dev === right.dev && left.ino === right.ino;\n","import { haveSameHostPathIdentity } from '../../host-path-identity/index.js';\n\nimport type { IGitWorkingTreeIdentity, IGitWorkingTreeIdentityLocation } from './types.js';\n\n/** Determines whether two locations denote the same directory despite host-path aliases. */\nconst areLocationsEqual = (\n left: IGitWorkingTreeIdentityLocation,\n right: IGitWorkingTreeIdentityLocation,\n): boolean => haveSameHostPathIdentity(left, right);\n\n/**\n * Determines whether two observations identify the same working tree and Git repository.\n * @param left The pinned working-tree identity.\n * @param right The identity observed before a snapshot attempt.\n * @returns Whether the root, worktree Git directory, and common directory all match.\n */\nexport const areGitWorkingTreeIdentitiesEqual = (\n left: IGitWorkingTreeIdentity,\n right: IGitWorkingTreeIdentity,\n): boolean =>\n areLocationsEqual(left.repositoryRoot, right.repositoryRoot) &&\n areLocationsEqual(left.gitDirectory, right.gitDirectory) &&\n areLocationsEqual(left.commonDirectory, right.commonDirectory);\n","// fixed Git queries used to establish one working-tree identity\nexport const GIT_WORKING_TREE_IDENTITY_ARGUMENTS = Object.freeze({\n CommonDirectory: Object.freeze(['rev-parse', '--git-common-dir']),\n GitDirectory: Object.freeze(['rev-parse', '--absolute-git-dir']),\n RepositoryRoot: Object.freeze(['rev-parse', '--show-toplevel']),\n});\n","import { stat } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport { hasOnlyUnicodeScalarValues } from '../../command-line/index.js';\nimport {\n executeGitProcess,\n type IGitProcessExecutor,\n type IGitProcessFailureReason,\n} from '../../git-process/index.js';\nimport {\n areHostPathsEquivalent,\n haveSameHostPathIdentity,\n} from '../../host-path-identity/index.js';\nimport type { IMoldeaCliGitErrorCode } from '../../presentation/index.js';\nimport { MAX_GIT_DISCOVERY_OUTPUT_BYTES } from '../constants.js';\nimport { parseGitAbsolutePathOutput, parseGitPathOutput } from '../parser.js';\n\nimport { GIT_WORKING_TREE_IDENTITY_ARGUMENTS } from './constants.js';\nimport type {\n IGitWorkingTreeIdentityInspectionFailedResult,\n IGitWorkingTreeIdentityInspectionResult,\n IGitWorkingTreeIdentityInspector,\n IGitWorkingTreeIdentityLocation,\n IGitWorkingTreeIdentityStat,\n} from './types.js';\n\n/** Reads one followed directory identity with bigint filesystem fields. */\nconst inspectDirectoryIdentity: IGitWorkingTreeIdentityStat = async (hostPath) =>\n stat(hostPath, { bigint: true });\n\n/** Creates one immutable identity-inspection failure. */\nconst createInspectionFailure = (\n errorCode: IMoldeaCliGitErrorCode,\n): IGitWorkingTreeIdentityInspectionFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps one normalized Git process failure to the discovery error contract. */\nconst mapGitProcessFailure = (reason: IGitProcessFailureReason): IMoldeaCliGitErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'repository-not-found':\n return 'GIT_REPOSITORY_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'output-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Maps one private filesystem failure without exposing its host diagnostics. */\nconst mapFilesystemFailure = (error: unknown): IMoldeaCliGitErrorCode => {\n let errorCode: string | undefined;\n\n try {\n if (typeof error === 'object' && error !== null && 'code' in error) {\n const unknownCode: unknown = error.code;\n\n errorCode = typeof unknownCode === 'string' ? unknownCode.toUpperCase() : undefined;\n }\n } catch {\n return 'GIT_COMMAND_FAILED';\n }\n\n if (errorCode === 'ENOENT' || errorCode === 'ENOTDIR') {\n return 'GIT_REPOSITORY_NOT_FOUND';\n }\n\n if (errorCode === 'EACCES' || errorCode === 'EPERM') {\n return 'GIT_ACCESS_DENIED';\n }\n\n return 'GIT_COMMAND_FAILED';\n};\n\n/** Executes one bounded Git identity-path query. */\nconst queryGitPath = async (\n processExecutor: IGitProcessExecutor,\n repositoryRoot: string,\n arguments_: readonly string[],\n isAbsoluteRequired: boolean,\n signal?: AbortSignal,\n): Promise<string | IGitWorkingTreeIdentityInspectionFailedResult> => {\n const result = await processExecutor({\n arguments: ['-C', repositoryRoot, ...arguments_],\n maxBufferBytes: MAX_GIT_DISCOVERY_OUTPUT_BYTES,\n ...(signal === undefined ? {} : { signal }),\n });\n\n if (result.kind === 'failed') {\n return createInspectionFailure(mapGitProcessFailure(result.reason));\n }\n\n if (result.stderr.byteLength > 0) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const gitPath = isAbsoluteRequired\n ? parseGitAbsolutePathOutput(result.stdout)\n : parseGitPathOutput(result.stdout);\n\n return gitPath ?? createInspectionFailure('GIT_OUTPUT_INVALID');\n};\n\n/** Captures one directory path and stable filesystem identity. */\nconst captureLocation = async (\n inspectPath: IGitWorkingTreeIdentityStat,\n hostPath: string,\n invalidTypeCode: IMoldeaCliGitErrorCode,\n): Promise<IGitWorkingTreeIdentityLocation | IGitWorkingTreeIdentityInspectionFailedResult> => {\n try {\n const statistics = await inspectPath(hostPath);\n\n if (!statistics.isDirectory() || statistics.ino === 0n) {\n return createInspectionFailure(invalidTypeCode);\n }\n\n return Object.freeze({ dev: statistics.dev, ino: statistics.ino, path: hostPath });\n } catch (error) {\n return createInspectionFailure(mapFilesystemFailure(error));\n }\n};\n\n/** Determines whether an identity helper returned a safe failure. */\nconst isInspectionFailure = (\n result: string | IGitWorkingTreeIdentityLocation | IGitWorkingTreeIdentityInspectionFailedResult,\n): result is IGitWorkingTreeIdentityInspectionFailedResult =>\n typeof result === 'object' && 'kind' in result && result.kind === 'failed';\n\n/**\n * Creates a bounded working-tree identity inspector around Git and filesystem boundaries.\n * @param processExecutor The sanitized bounded Git process executor.\n * @param inspectPath The followed directory identity operation.\n * @returns An inspector that captures one private immutable identity.\n */\nexport const createGitWorkingTreeIdentityInspector = (\n processExecutor: IGitProcessExecutor = executeGitProcess,\n inspectPath: IGitWorkingTreeIdentityStat = inspectDirectoryIdentity,\n): IGitWorkingTreeIdentityInspector => {\n return async (input): Promise<IGitWorkingTreeIdentityInspectionResult> => {\n if (\n !path.isAbsolute(input.repositoryRoot) ||\n input.repositoryRoot.includes('\\0') ||\n !hasOnlyUnicodeScalarValues(input.repositoryRoot)\n ) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const discoveredRoot = await queryGitPath(\n processExecutor,\n input.repositoryRoot,\n GIT_WORKING_TREE_IDENTITY_ARGUMENTS.RepositoryRoot,\n true,\n input.signal,\n );\n\n if (isInspectionFailure(discoveredRoot)) {\n return discoveredRoot;\n }\n\n const repositoryRoot = await captureLocation(\n inspectPath,\n discoveredRoot,\n 'GIT_WORK_TREE_REQUIRED',\n );\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (isInspectionFailure(repositoryRoot)) {\n return repositoryRoot;\n }\n\n if (!areHostPathsEquivalent(discoveredRoot, input.repositoryRoot)) {\n const selectedRepositoryRoot = await captureLocation(\n inspectPath,\n input.repositoryRoot,\n 'GIT_WORK_TREE_REQUIRED',\n );\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (isInspectionFailure(selectedRepositoryRoot)) {\n return selectedRepositoryRoot;\n }\n\n if (!haveSameHostPathIdentity(repositoryRoot, selectedRepositoryRoot)) {\n return Object.freeze({ kind: 'mismatched' });\n }\n }\n\n const gitDirectoryPath = await queryGitPath(\n processExecutor,\n input.repositoryRoot,\n GIT_WORKING_TREE_IDENTITY_ARGUMENTS.GitDirectory,\n true,\n input.signal,\n );\n\n if (isInspectionFailure(gitDirectoryPath)) {\n return gitDirectoryPath;\n }\n\n const commonDirectoryOutput = await queryGitPath(\n processExecutor,\n input.repositoryRoot,\n GIT_WORKING_TREE_IDENTITY_ARGUMENTS.CommonDirectory,\n false,\n input.signal,\n );\n\n if (isInspectionFailure(commonDirectoryOutput)) {\n return commonDirectoryOutput;\n }\n\n const commonDirectoryPath = path.isAbsolute(commonDirectoryOutput)\n ? commonDirectoryOutput\n : path.resolve(input.repositoryRoot, commonDirectoryOutput);\n const gitDirectory = await captureLocation(inspectPath, gitDirectoryPath, 'GIT_OUTPUT_INVALID');\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (isInspectionFailure(gitDirectory)) {\n return gitDirectory;\n }\n\n const commonDirectory = await captureLocation(\n inspectPath,\n commonDirectoryPath,\n 'GIT_OUTPUT_INVALID',\n );\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (isInspectionFailure(commonDirectory)) {\n return commonDirectory;\n }\n\n return Object.freeze({\n identity: Object.freeze({ commonDirectory, gitDirectory, repositoryRoot }),\n kind: 'inspected',\n });\n };\n};\n\n// default identity inspector used by snapshot execution\nexport const inspectGitWorkingTreeIdentity = createGitWorkingTreeIdentityInspector();\n","import { RepositorySourceException, type IRepositoryPath } from '@moldea.ai/repository';\n\n/** Identifies a guarded logical file whose working-tree bytes are unsafe to inspect. */\nexport class GitContentTransformUnsupportedException extends RepositorySourceException {\n /** Creates the CLI-owned marker on the common repository-source failure boundary. */\n public constructor(path: IRepositoryPath) {\n super({\n code: 'SOURCE_UNAVAILABLE',\n operation: 'read-file',\n path,\n retryable: false,\n });\n this.name = 'GitContentTransformUnsupportedException';\n }\n}\n","import {\n REPOSITORY_ROOT,\n RepositorySourceException,\n parseRepositoryPath,\n type IRepositoryEntry,\n type IRepositoryListOptions,\n type IRepositoryOperationOptions,\n type IRepositoryPath,\n type IRepositoryReader,\n} from '@moldea.ai/repository';\n\nimport { GitContentTransformUnsupportedException } from './exception.js';\n\n/** Throws the common cancellation contract for one guard-owned read step. */\nconst throwIfAborted = (signal: AbortSignal | undefined, path: IRepositoryPath): void => {\n if (!signal?.aborted) {\n return;\n }\n\n throw new RepositorySourceException({\n cause: signal.reason,\n code: 'ABORTED',\n operation: 'read-file',\n path,\n retryable: false,\n });\n};\n\n/** Creates the common failure for contradictory underlying lookup data. */\nconst createInvalidSourceException = (path: IRepositoryPath): RepositorySourceException =>\n new RepositorySourceException({\n code: 'INVALID_SOURCE_DATA',\n operation: 'read-file',\n path,\n retryable: false,\n });\n\n// immutable guarded-read view over one coherent logical repository reader\nclass GitContentTransformationGuardRepositoryReader implements IRepositoryReader {\n readonly #guardedPaths: ReadonlySet<IRepositoryPath>;\n\n readonly #reader: IRepositoryReader;\n\n public constructor(reader: IRepositoryReader, guardedPaths: ReadonlySet<IRepositoryPath>) {\n this.#reader = reader;\n this.#guardedPaths = guardedPaths;\n }\n\n /**\n * Looks up an entry without changing the underlying logical inventory.\n * @param path The validated repository path to inspect.\n * @param options Optional cancellation controls.\n * @returns A promise resolving to the underlying detached entry or confirmed absence.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path 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 * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public getEntry(\n path: IRepositoryPath,\n options?: IRepositoryOperationOptions,\n ): Promise<IRepositoryEntry | null> {\n return this.#reader.getEntry(path, options);\n }\n\n /**\n * Reads ordinary files while refusing guarded logical regular-file bytes.\n * @param path The validated repository file path to read.\n * @param options Optional cancellation controls.\n * @returns A promise resolving to fresh bytes for an unguarded regular file.\n * @throws\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 * - ACCESS_DENIED: Access to the repository source was denied.\n * - SOURCE_UNAVAILABLE: The repository source is unavailable or its regular file uses an unsupported Git content transformation.\n * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.\n * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public async readFile(\n path: IRepositoryPath,\n options?: IRepositoryOperationOptions,\n ): Promise<Uint8Array> {\n const parsedPath = parseRepositoryPath(path);\n\n if (!this.#guardedPaths.has(parsedPath)) {\n return this.#reader.readFile(parsedPath, options);\n }\n\n throwIfAborted(options?.signal, parsedPath);\n\n const entry = await this.#reader.getEntry(parsedPath, options);\n\n throwIfAborted(options?.signal, parsedPath);\n\n if (\n entry !== null &&\n (entry.path !== parsedPath ||\n (entry.type !== 'file' && entry.type !== 'directory' && entry.type !== 'symlink'))\n ) {\n throw createInvalidSourceException(parsedPath);\n }\n\n if (entry?.type !== 'file') {\n return this.#reader.readFile(parsedPath, options);\n }\n\n throw new GitContentTransformUnsupportedException(parsedPath);\n }\n\n /**\n * Recursively lists entries without changing the underlying logical inventory.\n * @param options Optional prefix and cancellation controls.\n * @returns The underlying async iterable of detached repository entries.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - ENTRY_NOT_FOUND: The requested repository entry was not found.\n * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.\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 * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public listEntries(options?: IRepositoryListOptions): AsyncIterable<IRepositoryEntry> {\n return this.#reader.listEntries(options);\n }\n}\n\n/**\n * Creates an immutable reader that blocks bytes for Git transform-guarded logical files.\n * @param reader The coherent reader after logical Git entry-type overlays are applied.\n * @param guardedPaths The paths whose working-tree bytes may differ from Git content.\n * @returns A reader preserving inventory semantics while refusing guarded regular-file reads.\n * @throws\n * - INVALID_REPOSITORY_PATH: A guarded repository path is invalid.\n * - INVALID_SOURCE_DATA: The repository root was supplied as a guarded file path.\n */\nexport const createGitContentTransformationGuardRepositoryReader = (\n reader: IRepositoryReader,\n guardedPaths: readonly IRepositoryPath[],\n): IRepositoryReader => {\n const parsedGuardedPaths = new Set<IRepositoryPath>();\n\n for (const guardedPath of guardedPaths) {\n const parsedPath = parseRepositoryPath(guardedPath);\n\n if (parsedPath === REPOSITORY_ROOT) {\n throw new RepositorySourceException({\n code: 'INVALID_SOURCE_DATA',\n operation: 'create-reader',\n path: parsedPath,\n retryable: false,\n });\n }\n\n parsedGuardedPaths.add(parsedPath);\n }\n\n return Object.freeze(\n new GitContentTransformationGuardRepositoryReader(reader, parsedGuardedPaths),\n );\n};\n","import type { ICoreConfigurationErrorCode, ICoreOperationErrorCode } from '@moldea.ai/core';\nimport type { IRepositorySourceErrorCode } from '@moldea.ai/repository';\n\n// safe messages for common repository-source failures\nexport const REPOSITORY_SOURCE_ERROR_MESSAGES = Object.freeze({\n ABORTED: 'The repository operation was aborted.',\n ACCESS_DENIED: 'Access to the repository source was denied.',\n ENTRY_NOT_DIRECTORY: 'The requested repository entry is not a directory.',\n ENTRY_NOT_FILE: 'The requested repository entry is not a file.',\n ENTRY_NOT_FOUND: 'The requested repository entry was not found.',\n INVALID_SOURCE_DATA: 'The repository source returned invalid data.',\n RESOURCE_LIMIT_EXCEEDED: 'A repository reading resource limit was exceeded.',\n SNAPSHOT_CHANGED: 'The repository snapshot changed during the operation.',\n SOURCE_UNAVAILABLE: 'The repository source is unavailable.',\n} as const satisfies Readonly<Record<IRepositorySourceErrorCode, string>>);\n\n// safe messages for Core configuration failures\nexport const CORE_CONFIGURATION_ERROR_MESSAGES = Object.freeze({\n DUPLICATE_ADAPTER_ID: 'A runtime adapter ID is registered more than once.',\n INVALID_ADAPTER_DEFINITION: 'A runtime adapter definition is invalid.',\n INVALID_RESOURCE_LIMIT: 'A Core resource limit is invalid.',\n RESERVED_ADAPTER_ID: 'A reserved runtime adapter ID was supplied.',\n} as const satisfies Readonly<Record<ICoreConfigurationErrorCode, string>>);\n\n// safe messages for Core operation failures\nexport const CORE_OPERATION_ERROR_MESSAGES = Object.freeze({\n ABORTED: 'The Core operation was aborted.',\n ADAPTER_EXECUTION_FAILED: 'A runtime adapter failed during inspection.',\n INVALID_ARGUMENT: 'The Core operation received an invalid argument.',\n RESOURCE_LIMIT_EXCEEDED: 'A Core resource limit was exceeded.',\n} as const satisfies Readonly<Record<ICoreOperationErrorCode, string>>);\n","import { CoreConfigurationException, CoreOperationException } from '@moldea.ai/core';\nimport { isRepositoryPath, RepositorySourceException } from '@moldea.ai/repository';\n\nimport { GitContentTransformUnsupportedException } from '../repository-content-transformation-guard/index.js';\nimport { createMoldeaCliOwnedError, type IMoldeaCliError } from '../presentation/index.js';\n\nimport {\n CORE_CONFIGURATION_ERROR_MESSAGES,\n CORE_OPERATION_ERROR_MESSAGES,\n REPOSITORY_SOURCE_ERROR_MESSAGES,\n} from './constants.js';\n\nconst EMPTY_ERROR_DETAILS = Object.freeze({});\n\n/** Creates frozen safe Core metadata without retaining null fields. */\nconst createCoreErrorDetails = (\n error: CoreConfigurationException | CoreOperationException,\n): Readonly<Record<string, string>> => {\n const details: Record<string, string> = { operation: error.operation };\n\n if (error.adapterId !== null) {\n details['adapterId'] = error.adapterId;\n }\n\n if (error instanceof CoreOperationException) {\n if (error.agentId !== null) {\n details['agentId'] = error.agentId;\n }\n\n if (error.limit !== null) {\n details['limit'] = error.limit;\n }\n }\n\n return Object.freeze(details);\n};\n\n/**\n * Maps a known package exception or unknown failure to one safe CLI error object.\n * @param error The failure that escaped command composition.\n * @returns A complete immutable operational error without causes or private host data.\n */\nexport const mapMoldeaCliOperationalError = (error: unknown): IMoldeaCliError => {\n if (error instanceof GitContentTransformUnsupportedException) {\n return Object.freeze({\n ...createMoldeaCliOwnedError('GIT_CONTENT_TRANSFORM_UNSUPPORTED'),\n path: isRepositoryPath(error.path) ? error.path : null,\n });\n }\n\n if (error instanceof RepositorySourceException) {\n return Object.freeze({\n code: error.code,\n details: EMPTY_ERROR_DETAILS,\n message: REPOSITORY_SOURCE_ERROR_MESSAGES[error.code],\n path: error.path !== null && isRepositoryPath(error.path) ? error.path : null,\n retryable: error.retryable,\n source: 'repository',\n });\n }\n\n if (error instanceof CoreConfigurationException) {\n return Object.freeze({\n code: error.code,\n details: createCoreErrorDetails(error),\n message: CORE_CONFIGURATION_ERROR_MESSAGES[error.code],\n path: null,\n retryable: false,\n source: 'core',\n });\n }\n\n if (error instanceof CoreOperationException) {\n return Object.freeze({\n code: error.code,\n details: createCoreErrorDetails(error),\n message: CORE_OPERATION_ERROR_MESSAGES[error.code],\n path: null,\n retryable: error.retryable,\n source: 'core',\n });\n }\n\n return createMoldeaCliOwnedError('INTERNAL_ERROR');\n};\n","// fixed read-only Git commands used to enumerate raw working-tree candidates\nexport const GIT_TRACKED_INVENTORY_ARGUMENTS = [\n 'ls-files',\n '--cached',\n '--stage',\n '--full-name',\n '--no-abbrev',\n '--no-recurse-submodules',\n '-z',\n '--',\n] as const;\n\nexport const GIT_UNTRACKED_INVENTORY_ARGUMENTS = [\n 'ls-files',\n '--others',\n '--exclude-standard',\n '--full-name',\n '--no-recurse-submodules',\n '-z',\n '--',\n] as const;\n\n// Git index modes accepted by the version 1 inventory grammar\nexport const GIT_TRACKED_ENTRY_MODES = ['100644', '100755', '120000', '160000'] as const;\n","// Git attributes required to classify working-tree content transformations\nexport const GIT_CONTENT_TRANSFORMATION_ATTRIBUTES = [\n 'filter',\n 'working-tree-encoding',\n 'ident',\n] as const;\n\n// fixed read-only Git command used for NUL-delimited attribute inspection\nexport const GIT_CONTENT_TRANSFORMATION_ARGUMENTS = [\n 'check-attr',\n '--stdin',\n '-z',\n ...GIT_CONTENT_TRANSFORMATION_ATTRIBUTES,\n] as const;\n","import { GIT_CONTENT_TRANSFORMATION_ATTRIBUTES } from './constants.js';\nimport type {\n IGitContentTransformationAttribute,\n IGitContentTransformationAttributeValues,\n IGitContentTransformationParsedAttributes,\n IGitContentTransformationParser,\n IGitContentTransformationParserInput,\n IGitContentTransformationParserResult,\n} from './types.js';\n\ninterface IMutableAttributeValues {\n filter?: string;\n ident?: string;\n workingTreeEncoding?: string;\n}\n\n/** Concatenates one complete NUL-delimited field assembled across process chunks. */\nconst concatenateField = (fragments: readonly Uint8Array[], byteLength: number): Uint8Array => {\n const field = new Uint8Array(byteLength);\n let offset = 0;\n\n for (const fragment of fragments) {\n field.set(fragment, offset);\n offset += fragment.byteLength;\n }\n\n return field;\n};\n\n/** Decodes one Git attribute field as strict UTF-8 while preserving an initial BOM scalar. */\nconst decodeField = (field: Uint8Array): string | null => {\n try {\n return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(field);\n } catch {\n return null;\n }\n};\n\n/** Resolves one exact supported attribute name without accepting aliases. */\nconst resolveAttribute = (candidate: string): IGitContentTransformationAttribute | null => {\n return GIT_CONTENT_TRANSFORMATION_ATTRIBUTES.find((attribute) => attribute === candidate) ?? null;\n};\n\n/** Stores one exact Git value while rejecting duplicate attribute records. */\nconst storeAttribute = (\n values: IMutableAttributeValues,\n attribute: IGitContentTransformationAttribute,\n value: string,\n): boolean => {\n const property = attribute === 'working-tree-encoding' ? 'workingTreeEncoding' : attribute;\n\n if (Object.hasOwn(values, property)) {\n return false;\n }\n\n values[property] = value;\n return true;\n};\n\n/** Confirms that all three required effective attribute values were received. */\nconst hasCompleteValues = (\n values: IMutableAttributeValues,\n): values is IGitContentTransformationAttributeValues =>\n Object.hasOwn(values, 'filter') &&\n Object.hasOwn(values, 'ident') &&\n Object.hasOwn(values, 'workingTreeEncoding');\n\n/**\n * Creates a strict parser for NUL-delimited `git check-attr` triples.\n * @param input The exact paths whose three effective attributes must be present.\n * @returns An incremental all-or-nothing parser.\n */\nexport const createGitContentTransformationParser = (\n input: IGitContentTransformationParserInput,\n): IGitContentTransformationParser => {\n const paths = [...input.paths];\n const valuesByPath = new Map<string, IMutableAttributeValues>();\n let fields: Uint8Array[] = [];\n let isFailed = false;\n let pendingByteLength = 0;\n let pendingFragments: Uint8Array[] = [];\n\n for (const path of paths) {\n if (path.length === 0 || path.includes('\\u0000') || valuesByPath.has(path)) {\n isFailed = true;\n continue;\n }\n\n valuesByPath.set(path, {});\n }\n\n const consumeRecord = (): void => {\n if (isFailed || fields.length !== 3) {\n return;\n }\n\n const path = decodeField(fields[0] ?? new Uint8Array());\n const attributeCandidate = decodeField(fields[1] ?? new Uint8Array());\n const value = decodeField(fields[2] ?? new Uint8Array());\n\n fields = [];\n\n if (path === null || attributeCandidate === null || value === null) {\n isFailed = true;\n return;\n }\n\n const attribute = resolveAttribute(attributeCandidate);\n const values = valuesByPath.get(path);\n\n if (attribute === null || values === undefined || !storeAttribute(values, attribute, value)) {\n isFailed = true;\n }\n };\n\n const consumeField = (): void => {\n if (isFailed) {\n return;\n }\n\n fields.push(concatenateField(pendingFragments, pendingByteLength));\n pendingByteLength = 0;\n pendingFragments = [];\n\n if (fields.length === 3) {\n consumeRecord();\n }\n };\n\n return {\n consume: (chunk): void => {\n if (isFailed) {\n return;\n }\n\n let fragmentStart = 0;\n\n for (let index = 0; index < chunk.byteLength; index += 1) {\n if (chunk[index] !== 0x00) {\n continue;\n }\n\n const fragment = chunk.subarray(fragmentStart, index);\n\n pendingFragments.push(Uint8Array.from(fragment));\n pendingByteLength += fragment.byteLength;\n consumeField();\n\n if (isFailed) {\n return;\n }\n\n fragmentStart = index + 1;\n }\n\n const trailingFragment = chunk.subarray(fragmentStart);\n\n if (trailingFragment.byteLength > 0) {\n pendingFragments.push(Uint8Array.from(trailingFragment));\n pendingByteLength += trailingFragment.byteLength;\n }\n },\n finish: (): IGitContentTransformationParserResult => {\n if (isFailed || pendingByteLength > 0 || fields.length > 0) {\n return Object.freeze({ kind: 'failed' });\n }\n\n const attributes: IGitContentTransformationParsedAttributes[] = [];\n\n for (const path of paths) {\n const values = valuesByPath.get(path);\n\n if (values === undefined || !hasCompleteValues(values)) {\n return Object.freeze({ kind: 'failed' });\n }\n\n attributes.push(\n Object.freeze({\n filter: values.filter,\n ident: values.ident,\n path,\n workingTreeEncoding: values.workingTreeEncoding,\n }),\n );\n }\n\n return Object.freeze({ attributes: Object.freeze(attributes), kind: 'completed' });\n },\n };\n};\n","import {\n executeGitStreamingProcess,\n MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n type IGitStreamingProcessExecutor,\n type IGitStreamingProcessFailureReason,\n} from '../../git-process/index.js';\nimport type { IGitInventoryProbeErrorCode } from '../types.js';\n\nimport { GIT_CONTENT_TRANSFORMATION_ARGUMENTS } from './constants.js';\nimport { createGitContentTransformationParser } from './parser.js';\nimport type {\n IGitContentTransformationClassification,\n IGitContentTransformationClassificationFailedResult,\n IGitContentTransformationClassificationResult,\n IGitContentTransformationClassifier,\n} from './types.js';\n\n/** Creates one immutable content-transformation classification failure. */\nconst createClassificationFailure = (\n errorCode: IGitInventoryProbeErrorCode,\n): IGitContentTransformationClassificationFailedResult =>\n Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps one bounded Git attribute failure to the existing safe inventory contract. */\nconst mapGitProcessFailure = (\n reason: IGitStreamingProcessFailureReason,\n): IGitInventoryProbeErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'repository-not-found':\n return 'GIT_REPOSITORY_NOT_FOUND';\n case 'output-limit-exceeded':\n case 'stdout-limit-exceeded':\n return 'RESOURCE_LIMIT_EXCEEDED';\n case 'stderr-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Determines whether one effective attribute value requires guarded reads. */\nconst isGuardedAttributeValue = (attributeValue: string): boolean =>\n attributeValue !== 'unset' && attributeValue !== 'unspecified';\n\n/** Encodes exact Git-relative paths as NUL-delimited stdin without shell interpretation. */\nconst encodePaths = (paths: readonly string[]): Uint8Array | null => {\n const encoder = new TextEncoder();\n const encodedPaths: Uint8Array[] = [];\n let byteLength = 0;\n\n for (const path of paths) {\n if (path.length === 0 || path.includes('\\u0000')) {\n return null;\n }\n\n const encodedPath = encoder.encode(path);\n\n if (!Number.isSafeInteger(byteLength + encodedPath.byteLength + 1)) {\n return null;\n }\n\n encodedPaths.push(encodedPath);\n byteLength += encodedPath.byteLength + 1;\n }\n\n const stdin = new Uint8Array(byteLength);\n let offset = 0;\n\n for (const encodedPath of encodedPaths) {\n stdin.set(encodedPath, offset);\n offset += encodedPath.byteLength + 1;\n }\n\n return stdin;\n};\n\n/** Builds the exact retained classification and its conservative read guard. */\nconst createClassification = (\n filter: string,\n ident: string,\n workingTreeEncoding: string,\n): IGitContentTransformationClassification =>\n Object.freeze({\n filter,\n ident,\n isGuarded:\n isGuardedAttributeValue(filter) ||\n isGuardedAttributeValue(ident) ||\n isGuardedAttributeValue(workingTreeEncoding),\n workingTreeEncoding,\n });\n\n/**\n * Creates the effective Git content-transformation classifier around a process boundary.\n * @param processExecutor The sanitized streamed Git process executor.\n * @returns An all-or-nothing bounded classifier for effective inventory entries.\n */\nexport const createGitContentTransformationClassifier = (\n processExecutor: IGitStreamingProcessExecutor = executeGitStreamingProcess,\n): IGitContentTransformationClassifier => {\n return async (input): Promise<IGitContentTransformationClassificationResult> => {\n if (input.signal?.aborted) {\n return createClassificationFailure('GIT_OPERATION_ABORTED');\n }\n\n if (!Number.isSafeInteger(input.maxMetadataBytes) || input.maxMetadataBytes < 0) {\n return createClassificationFailure('RESOURCE_LIMIT_EXCEEDED');\n }\n\n if (input.entries.length === 0) {\n return Object.freeze({ entries: Object.freeze([]), gitMetadataBytes: 0, kind: 'classified' });\n }\n\n const paths = input.entries.map((entry) => entry.path);\n const stdin = encodePaths(paths);\n\n if (stdin === null) {\n return createClassificationFailure('GIT_OUTPUT_INVALID');\n }\n\n const parser = createGitContentTransformationParser({ paths });\n let consumedStdoutBytes = 0;\n const processResult = await processExecutor({\n arguments: ['-C', input.repositoryRoot, ...GIT_CONTENT_TRANSFORMATION_ARGUMENTS],\n consumeStdout: (chunk): void => {\n consumedStdoutBytes += chunk.byteLength;\n parser.consume(chunk);\n },\n maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n maxStdoutBytes: input.maxMetadataBytes,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n stdin,\n });\n\n if (processResult.kind === 'failed') {\n return createClassificationFailure(mapGitProcessFailure(processResult.reason));\n }\n\n if (\n processResult.stderr.byteLength > 0 ||\n processResult.stdoutBytes !== consumedStdoutBytes ||\n processResult.stdoutBytes > input.maxMetadataBytes\n ) {\n return createClassificationFailure('GIT_OUTPUT_INVALID');\n }\n\n const parserResult = parser.finish();\n\n if (parserResult.kind === 'failed' || parserResult.attributes.length !== input.entries.length) {\n return createClassificationFailure('GIT_OUTPUT_INVALID');\n }\n\n const entries = input.entries.map((entry, index) => {\n const attributes = parserResult.attributes[index];\n\n if (attributes === undefined || attributes.path !== entry.path) {\n return null;\n }\n\n return Object.freeze({\n ...entry,\n contentTransformation: createClassification(\n attributes.filter,\n attributes.ident,\n attributes.workingTreeEncoding,\n ),\n });\n });\n\n if (entries.some((entry) => entry === null)) {\n return createClassificationFailure('GIT_OUTPUT_INVALID');\n }\n\n return Object.freeze({\n entries: Object.freeze(entries.filter((entry) => entry !== null)),\n gitMetadataBytes: processResult.stdoutBytes,\n kind: 'classified',\n });\n };\n};\n\n// default effective Git content-transformation classifier used by inventory probing\nexport const classifyGitContentTransformations = createGitContentTransformationClassifier();\n","import type { IGitInventoryCandidate } from '../types.js';\n\nimport type {\n ICollapsedGitInventoryCandidate,\n IGitInventoryCandidateCollapseResult,\n IGitInventoryIndexEntry,\n} from './types.js';\n\ninterface IMutableTrackedCandidate {\n readonly indexEntriesByStage: Map<number, IGitInventoryIndexEntry>;\n readonly kind: 'tracked';\n readonly path: string;\n}\n\ninterface IMutableUntrackedCandidate {\n readonly kind: 'untracked';\n readonly path: string;\n}\n\ntype IMutableCollapsedCandidate = IMutableTrackedCandidate | IMutableUntrackedCandidate;\n\n/** Creates one immutable invalid candidate-collapse result. */\nconst createCollapseFailure = (): IGitInventoryCandidateCollapseResult =>\n Object.freeze({ kind: 'failed' });\n\n/**\n * Collapses raw stage records into one deterministic candidate per exact Git path.\n * @param candidates The ownership-filtered raw candidates to collapse.\n * @returns An immutable candidate set, or failure for duplicate or contradictory state.\n */\nexport const collapseGitInventoryCandidates = (\n candidates: readonly IGitInventoryCandidate[],\n): IGitInventoryCandidateCollapseResult => {\n const candidatesByPath = new Map<string, IMutableCollapsedCandidate>();\n\n for (const candidate of candidates) {\n const existingCandidate = candidatesByPath.get(candidate.path);\n\n if (candidate.kind === 'untracked') {\n if (existingCandidate !== undefined) {\n return createCollapseFailure();\n }\n\n candidatesByPath.set(candidate.path, { kind: 'untracked', path: candidate.path });\n continue;\n }\n\n if (candidate.mode === '160000' || existingCandidate?.kind === 'untracked') {\n return createCollapseFailure();\n }\n\n const trackedCandidate = existingCandidate ?? {\n indexEntriesByStage: new Map<number, IGitInventoryIndexEntry>(),\n kind: 'tracked' as const,\n path: candidate.path,\n };\n\n if (trackedCandidate.indexEntriesByStage.has(candidate.stage)) {\n return createCollapseFailure();\n }\n\n trackedCandidate.indexEntriesByStage.set(\n candidate.stage,\n Object.freeze({ mode: candidate.mode, stage: candidate.stage }),\n );\n candidatesByPath.set(candidate.path, trackedCandidate);\n }\n\n const collapsedCandidates: ICollapsedGitInventoryCandidate[] = [];\n\n for (const candidate of candidatesByPath.values()) {\n if (candidate.kind === 'untracked') {\n collapsedCandidates.push(Object.freeze(candidate));\n continue;\n }\n\n const hasStageZero = candidate.indexEntriesByStage.has(0);\n\n if (hasStageZero && candidate.indexEntriesByStage.size !== 1) {\n return createCollapseFailure();\n }\n\n const indexEntries = [...candidate.indexEntriesByStage.values()].sort(\n (left, right) => left.stage - right.stage,\n );\n\n if (indexEntries.length === 0) {\n return createCollapseFailure();\n }\n\n collapsedCandidates.push(\n Object.freeze({\n indexEntries: Object.freeze(indexEntries),\n kind: 'tracked',\n path: candidate.path,\n }),\n );\n }\n\n return Object.freeze({ candidates: Object.freeze(collapsedCandidates), kind: 'collapsed' });\n};\n","import { lstat } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport type { IGitInventoryProbeErrorCode } from '../types.js';\n\nimport type {\n IGitInventoryEntryInspector,\n IGitInventoryEntryLstat,\n IGitInventoryHostEntryInspectionFailedResult,\n IGitInventoryHostEntryInspectionResult,\n} from './types.js';\n\n/** Creates one immutable host entry inspection failure. */\nconst createInspectionFailure = (\n errorCode: IGitInventoryProbeErrorCode,\n): IGitInventoryHostEntryInspectionFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps an unknown no-follow filesystem failure without retaining host diagnostics. */\nconst mapFilesystemFailure = (\n error: unknown,\n): IGitInventoryHostEntryInspectionFailedResult | null => {\n const errorCode = (error as NodeJS.ErrnoException | null)?.code?.toUpperCase();\n\n if (errorCode === 'ENOENT' || errorCode === 'ENOTDIR') {\n return null;\n }\n\n if (errorCode === 'EACCES' || errorCode === 'EPERM') {\n return createInspectionFailure('GIT_ACCESS_DENIED');\n }\n\n if (errorCode === 'ELOOP') {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n return createInspectionFailure('GIT_COMMAND_FAILED');\n};\n\n/** Default no-follow stat boundary for current inventory entries. */\nconst inspectHostEntry: IGitInventoryEntryLstat = async (hostPath) => lstat(hostPath);\n\n/**\n * Creates current host entry inspection around an injectable no-follow stat boundary.\n * @param inspectEntry The no-follow filesystem stat operation.\n * @returns An inspector for one ownership-filtered candidate path.\n */\nexport const createGitInventoryEntryInspector = (\n inspectEntry: IGitInventoryEntryLstat = inspectHostEntry,\n): IGitInventoryEntryInspector => {\n return async (repositoryRoot, candidatePath): Promise<IGitInventoryHostEntryInspectionResult> => {\n let statistics: Awaited<ReturnType<IGitInventoryEntryLstat>>;\n\n try {\n statistics = await inspectEntry(path.join(repositoryRoot, candidatePath));\n } catch (error) {\n const failure = mapFilesystemFailure(error);\n\n return failure ?? Object.freeze({ kind: 'missing' });\n }\n\n if (statistics.isSymbolicLink()) {\n return Object.freeze({ entryType: 'symlink', kind: 'inspected' });\n }\n\n if (statistics.isFile()) {\n return Object.freeze({ entryType: 'file', kind: 'inspected' });\n }\n\n return Object.freeze({ entryType: 'unsupported', kind: 'inspected' });\n };\n};\n\n// default no-follow current host entry inspector\nexport const inspectGitInventoryEntry = createGitInventoryEntryInspector();\n","// fixed read-only query for the effective selected-repository symlink behavior\nexport const GIT_SYMLINK_CONFIGURATION_ARGUMENTS = [\n 'config',\n '--type=bool',\n '--default=true',\n '--get',\n 'core.symlinks',\n] as const;\n","import {\n executeGitStreamingProcess,\n MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n type IGitStreamingProcessExecutor,\n type IGitStreamingProcessFailureReason,\n} from '../../git-process/index.js';\nimport { parseGitBooleanOutput } from '../../git-working-tree/index.js';\nimport type { IGitInventoryProbeErrorCode } from '../types.js';\n\nimport { GIT_SYMLINK_CONFIGURATION_ARGUMENTS } from './constants.js';\nimport type {\n IGitSymlinkConfigurationFailedResult,\n IGitSymlinkConfigurationResolver,\n IGitSymlinkConfigurationResult,\n} from './types.js';\n\n/** Creates one immutable effective symlink configuration failure. */\nconst createConfigurationFailure = (\n errorCode: IGitInventoryProbeErrorCode,\n): IGitSymlinkConfigurationFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps one bounded Git configuration failure to the existing safe CLI contract. */\nconst mapGitProcessFailure = (\n reason: IGitStreamingProcessFailureReason,\n): IGitInventoryProbeErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'output-limit-exceeded':\n case 'stdout-limit-exceeded':\n return 'RESOURCE_LIMIT_EXCEEDED';\n case 'repository-not-found':\n case 'stderr-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Concatenates already bounded Git stdout chunks for strict boolean parsing. */\nconst concatenateChunks = (chunks: readonly Uint8Array[], byteLength: number): Uint8Array => {\n const output = new Uint8Array(byteLength);\n let offset = 0;\n\n for (const chunk of chunks) {\n output.set(chunk, offset);\n offset += chunk.byteLength;\n }\n\n return output;\n};\n\n/**\n * Creates the bounded effective core.symlinks resolver around a Git process boundary.\n * @param processExecutor The sanitized streamed Git process executor.\n * @returns A resolver for the selected repository's effective symlink behavior.\n */\nexport const createGitSymlinkConfigurationResolver = (\n processExecutor: IGitStreamingProcessExecutor = executeGitStreamingProcess,\n): IGitSymlinkConfigurationResolver => {\n return async (input): Promise<IGitSymlinkConfigurationResult> => {\n if (input.signal?.aborted) {\n return createConfigurationFailure('GIT_OPERATION_ABORTED');\n }\n\n if (!Number.isSafeInteger(input.maxMetadataBytes) || input.maxMetadataBytes < 0) {\n return createConfigurationFailure('RESOURCE_LIMIT_EXCEEDED');\n }\n\n const stdoutChunks: Uint8Array[] = [];\n let consumedStdoutBytes = 0;\n const processResult = await processExecutor({\n arguments: ['-C', input.repositoryRoot, ...GIT_SYMLINK_CONFIGURATION_ARGUMENTS],\n consumeStdout: (chunk): void => {\n stdoutChunks.push(Uint8Array.from(chunk));\n consumedStdoutBytes += chunk.byteLength;\n },\n maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n maxStdoutBytes: input.maxMetadataBytes,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (processResult.kind === 'failed') {\n return createConfigurationFailure(mapGitProcessFailure(processResult.reason));\n }\n\n if (\n processResult.stderr.byteLength > 0 ||\n processResult.stdoutBytes !== consumedStdoutBytes ||\n processResult.stdoutBytes > input.maxMetadataBytes\n ) {\n return createConfigurationFailure('GIT_OUTPUT_INVALID');\n }\n\n const isEnabled = parseGitBooleanOutput(concatenateChunks(stdoutChunks, consumedStdoutBytes));\n\n if (isEnabled === null) {\n return createConfigurationFailure('GIT_OUTPUT_INVALID');\n }\n\n return Object.freeze({\n gitMetadataBytes: processResult.stdoutBytes,\n isEnabled,\n kind: 'resolved',\n });\n };\n};\n\n// default bounded effective core.symlinks resolver\nexport const resolveGitSymlinkConfiguration = createGitSymlinkConfigurationResolver();\n","import { collapseGitInventoryCandidates } from './candidate-collapser.js';\nimport { inspectGitInventoryEntry } from './entry-inspector.js';\nimport { resolveGitSymlinkConfiguration } from './symlink-configuration.js';\nimport type {\n ICollapsedGitTrackedInventoryCandidate,\n IGitEntryTypeNormalizedEntry,\n IGitInventoryEntryInspector,\n IGitInventoryEntryTypeNormalizationFailedResult,\n IGitInventoryEntryTypeNormalizationResult,\n IGitInventoryEntryTypeNormalizer,\n IGitSymlinkConfigurationResolver,\n} from './types.js';\n\n/** Creates one immutable entry-type normalization failure. */\nconst createNormalizationFailure = (\n errorCode: IGitInventoryEntryTypeNormalizationFailedResult['errorCode'],\n): IGitInventoryEntryTypeNormalizationFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Determines whether retained index metadata contains a Git symlink mode. */\nconst hasSymlinkMode = (candidate: ICollapsedGitTrackedInventoryCandidate): boolean =>\n candidate.indexEntries.some(({ mode }) => mode === '120000');\n\n/** Determines whether retained index metadata contains a Git regular-file mode. */\nconst hasRegularFileMode = (candidate: ICollapsedGitTrackedInventoryCandidate): boolean =>\n candidate.indexEntries.some(({ mode }) => mode === '100644' || mode === '100755');\n\n/**\n * Creates entry-type normalization around injectable filesystem and Git configuration boundaries.\n * @param entryInspector The no-follow current host entry inspector.\n * @param symlinkConfigurationResolver The bounded effective core.symlinks resolver.\n * @returns An all-or-nothing effective working-tree entry normalizer.\n */\nexport const createGitInventoryEntryTypeNormalizer = (\n entryInspector: IGitInventoryEntryInspector = inspectGitInventoryEntry,\n symlinkConfigurationResolver: IGitSymlinkConfigurationResolver = resolveGitSymlinkConfiguration,\n): IGitInventoryEntryTypeNormalizer => {\n return async (input): Promise<IGitInventoryEntryTypeNormalizationResult> => {\n if (input.signal?.aborted) {\n return createNormalizationFailure('GIT_OPERATION_ABORTED');\n }\n\n if (!Number.isSafeInteger(input.maxMetadataBytes) || input.maxMetadataBytes < 0) {\n return createNormalizationFailure('RESOURCE_LIMIT_EXCEEDED');\n }\n\n const collapseResult = collapseGitInventoryCandidates(input.candidates);\n\n if (collapseResult.kind === 'failed') {\n return createNormalizationFailure('GIT_OUTPUT_INVALID');\n }\n\n const entries: IGitEntryTypeNormalizedEntry[] = [];\n let symlinkConfiguration: Awaited<ReturnType<IGitSymlinkConfigurationResolver>> | null = null;\n\n for (const candidate of collapseResult.candidates) {\n if (input.signal?.aborted) {\n return createNormalizationFailure('GIT_OPERATION_ABORTED');\n }\n\n const inspectionResult = await entryInspector(input.repositoryRoot, candidate.path);\n\n if (input.signal?.aborted) {\n return createNormalizationFailure('GIT_OPERATION_ABORTED');\n }\n\n if (inspectionResult.kind === 'failed') {\n return inspectionResult;\n }\n\n if (inspectionResult.kind === 'missing') {\n continue;\n }\n\n if (inspectionResult.entryType === 'unsupported') {\n return createNormalizationFailure('GIT_OUTPUT_INVALID');\n }\n\n if (candidate.kind === 'untracked') {\n entries.push(\n Object.freeze({\n entryType: inspectionResult.entryType,\n kind: 'untracked',\n path: candidate.path,\n requiresSymlinkOverlay: false,\n }),\n );\n continue;\n }\n\n if (inspectionResult.entryType === 'symlink' || !hasSymlinkMode(candidate)) {\n entries.push(\n Object.freeze({\n entryType: inspectionResult.entryType,\n indexEntries: candidate.indexEntries,\n kind: 'tracked',\n path: candidate.path,\n requiresSymlinkOverlay: false,\n }),\n );\n continue;\n }\n\n symlinkConfiguration ??= await symlinkConfigurationResolver({\n maxMetadataBytes: input.maxMetadataBytes,\n repositoryRoot: input.repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (symlinkConfiguration.kind === 'failed') {\n return symlinkConfiguration;\n }\n\n if (\n !Number.isSafeInteger(symlinkConfiguration.gitMetadataBytes) ||\n symlinkConfiguration.gitMetadataBytes < 0 ||\n symlinkConfiguration.gitMetadataBytes > input.maxMetadataBytes\n ) {\n return createNormalizationFailure('GIT_OUTPUT_INVALID');\n }\n\n if (!symlinkConfiguration.isEnabled && hasRegularFileMode(candidate)) {\n return createNormalizationFailure('GIT_OUTPUT_INVALID');\n }\n\n const requiresSymlinkOverlay = !symlinkConfiguration.isEnabled;\n\n entries.push(\n Object.freeze({\n entryType: requiresSymlinkOverlay ? 'symlink' : 'file',\n indexEntries: candidate.indexEntries,\n kind: 'tracked',\n path: candidate.path,\n requiresSymlinkOverlay,\n }),\n );\n }\n\n return Object.freeze({\n entries: Object.freeze(entries),\n gitMetadataBytes:\n symlinkConfiguration?.kind === 'resolved' ? symlinkConfiguration.gitMetadataBytes : 0,\n kind: 'normalized',\n });\n };\n};\n\n// default effective working-tree entry-type normalizer\nexport const normalizeGitInventoryEntryTypes = createGitInventoryEntryTypeNormalizer();\n","import { isRepositoryPath, type IRepositoryPath } from '@moldea.ai/repository';\n\nimport type {\n IGitInventoryCandidateLogicalPathValidationResult,\n IGitInventoryCandidateLogicalPathValidatorInput,\n IGitInventoryEntry,\n IGitInventoryLogicalPathFailedResult,\n IGitInventoryLogicalPathCandidate,\n IGitInventoryLogicalPathNormalizationResult,\n IGitInventoryLogicalPathNormalizer,\n} from './types.js';\n\n/** Creates one immutable invalid logical-path result. */\nconst createLogicalPathFailure = (): IGitInventoryLogicalPathFailedResult =>\n Object.freeze({ errorCode: 'GIT_OUTPUT_INVALID', kind: 'failed' });\n\n/** Converts one Git-relative path into a validated repository logical path. */\nconst resolveRepositoryPath = (gitPath: string): IRepositoryPath | null => {\n const logicalPath = `/${gitPath}`;\n\n return logicalPath !== '/' && isRepositoryPath(logicalPath) ? logicalPath : null;\n};\n\n/** Resolves the logical path represented by one Git candidate record. */\nconst resolveCandidateRepositoryPath = (\n candidate: IGitInventoryLogicalPathCandidate,\n): IRepositoryPath | null => {\n const gitPath =\n candidate.kind === 'untracked' && candidate.path.endsWith('/')\n ? candidate.path.slice(0, -1)\n : candidate.path;\n\n return resolveRepositoryPath(gitPath);\n};\n\n/** Compares repository paths by exact Unicode code-point order. */\nconst compareRepositoryPaths = (left: IRepositoryPath, right: IRepositoryPath): number => {\n const leftScalars = left[Symbol.iterator]();\n const rightScalars = right[Symbol.iterator]();\n\n while (true) {\n const leftScalar = leftScalars.next();\n const rightScalar = rightScalars.next();\n\n if (leftScalar.done === true) {\n return rightScalar.done === true ? 0 : -1;\n }\n\n if (rightScalar.done === true) {\n return 1;\n }\n\n const leftCodePoint = leftScalar.value.codePointAt(0) ?? 0;\n const rightCodePoint = rightScalar.value.codePointAt(0) ?? 0;\n\n if (leftCodePoint !== rightCodePoint) {\n return leftCodePoint < rightCodePoint ? -1 : 1;\n }\n }\n};\n\n/**\n * Validates every decoded Git candidate before ownership or filesystem exclusions.\n * @param input The complete decoded tracked and untracked candidate set.\n * @returns A validated result, or failure when any candidate is not portable.\n */\nexport const validateGitInventoryCandidateLogicalPaths = (\n input: IGitInventoryCandidateLogicalPathValidatorInput,\n): IGitInventoryCandidateLogicalPathValidationResult => {\n for (const candidate of input.candidates) {\n if (resolveCandidateRepositoryPath(candidate) === null) {\n return createLogicalPathFailure();\n }\n }\n\n return Object.freeze({ kind: 'validated' });\n};\n\n/**\n * Converts Git-relative inventory entries into exact repository logical paths.\n * @param input The entry-type-normalized Git-relative inventory.\n * @returns An immutable code-point-sorted inventory, or failure for invalid path state.\n */\nexport const normalizeGitInventoryLogicalPaths: IGitInventoryLogicalPathNormalizer = (\n input,\n): IGitInventoryLogicalPathNormalizationResult => {\n const entries: IGitInventoryEntry[] = [];\n const logicalPaths = new Set<IRepositoryPath>();\n\n for (const entry of input.entries) {\n const logicalPath = resolveRepositoryPath(entry.path);\n\n if (logicalPath === null || logicalPaths.has(logicalPath)) {\n return createLogicalPathFailure();\n }\n\n logicalPaths.add(logicalPath);\n entries.push(Object.freeze({ ...entry, path: logicalPath }));\n }\n\n entries.sort((left, right) => compareRepositoryPaths(left.path, right.path));\n\n return Object.freeze({ entries: Object.freeze(entries), kind: 'normalized' });\n};\n","import type {\n IGitInventoryCandidate,\n IGitInventoryParser,\n IGitInventoryParserFailureReason,\n IGitInventoryParserResult,\n IGitTrackedEntryMode,\n IGitTrackedEntryStage,\n IGitTrackedInventoryCandidate,\n IGitUntrackedInventoryCandidate,\n} from './types.js';\n\nconst TRACKED_ENTRY_HEADER_PATTERN =\n /^(100644|100755|120000|160000) (?:[0-9a-f]{40}|[0-9a-f]{64}) ([0-3])$/u;\n\n/** Decodes one complete Git path as strict UTF-8 while preserving an initial BOM scalar. */\nconst decodeGitPath = (pathBytes: Uint8Array): string | null => {\n if (pathBytes.byteLength === 0) {\n return null;\n }\n\n try {\n return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(pathBytes);\n } catch {\n return null;\n }\n};\n\n/** Confirms that one decoded path contains only complete Unicode scalar values. */\nconst hasOnlyUnicodeScalarValues = (path: string): boolean => {\n for (let index = 0; index < path.length; index += 1) {\n const codeUnit = path.charCodeAt(index);\n\n if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {\n const trailingCodeUnit = path.charCodeAt(index + 1);\n\n if (trailingCodeUnit < 0xdc00 || trailingCodeUnit > 0xdfff) {\n return false;\n }\n\n index += 1;\n continue;\n }\n\n if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {\n return false;\n }\n }\n\n return true;\n};\n\n/** Concatenates one complete record assembled across arbitrary process chunks. */\nconst concatenateRecord = (fragments: readonly Uint8Array[], byteLength: number): Uint8Array => {\n const record = new Uint8Array(byteLength);\n let offset = 0;\n\n for (const fragment of fragments) {\n record.set(fragment, offset);\n offset += fragment.byteLength;\n }\n\n return record;\n};\n\n/** Parses one tracked `ls-files --stage` record without normalizing its path. */\nconst parseTrackedCandidate = (record: Uint8Array): IGitTrackedInventoryCandidate | null => {\n const separatorIndex = record.indexOf(0x09);\n\n if (separatorIndex <= 0 || separatorIndex === record.byteLength - 1) {\n return null;\n }\n\n let header: string;\n\n try {\n header = new TextDecoder('utf-8', { fatal: true }).decode(record.subarray(0, separatorIndex));\n } catch {\n return null;\n }\n\n const headerMatch = TRACKED_ENTRY_HEADER_PATTERN.exec(header);\n const path = decodeGitPath(record.subarray(separatorIndex + 1));\n\n if (headerMatch === null || path === null || !hasOnlyUnicodeScalarValues(path)) {\n return null;\n }\n\n return Object.freeze({\n kind: 'tracked',\n mode: headerMatch[1] as IGitTrackedEntryMode,\n path,\n stage: Number(headerMatch[2]) as IGitTrackedEntryStage,\n });\n};\n\n/** Parses one untracked `ls-files --others` record without normalizing its path. */\nconst parseUntrackedCandidate = (record: Uint8Array): IGitUntrackedInventoryCandidate | null => {\n const path = decodeGitPath(record);\n\n if (path === null || !hasOnlyUnicodeScalarValues(path)) {\n return null;\n }\n\n return Object.freeze({ kind: 'untracked', path });\n};\n\n/** Creates a strict incremental parser for one NUL-delimited Git record grammar. */\nconst createGitInventoryParser = <TCandidate extends IGitInventoryCandidate>(\n maxEntries: number,\n parseCandidate: (record: Uint8Array) => TCandidate | null,\n): IGitInventoryParser<TCandidate> => {\n const candidates: TCandidate[] = [];\n let failureReason: IGitInventoryParserFailureReason | null = null;\n let pendingByteLength = 0;\n let pendingFragments: Uint8Array[] = [];\n\n const consumeRecord = (): void => {\n if (failureReason !== null) {\n return;\n }\n\n if (candidates.length >= maxEntries) {\n failureReason = 'entry-limit-exceeded';\n pendingByteLength = 0;\n pendingFragments = [];\n return;\n }\n\n const candidate = parseCandidate(concatenateRecord(pendingFragments, pendingByteLength));\n\n pendingByteLength = 0;\n pendingFragments = [];\n\n if (candidate === null) {\n failureReason = 'invalid';\n return;\n }\n\n candidates.push(candidate);\n };\n\n return {\n consume: (chunk): void => {\n if (failureReason !== null) {\n return;\n }\n\n let fragmentStart = 0;\n\n for (let index = 0; index < chunk.byteLength; index += 1) {\n if (chunk[index] !== 0x00) {\n continue;\n }\n\n const fragment = chunk.subarray(fragmentStart, index);\n\n pendingFragments.push(fragment);\n pendingByteLength += fragment.byteLength;\n consumeRecord();\n\n if (failureReason !== null) {\n return;\n }\n\n fragmentStart = index + 1;\n }\n\n const trailingFragment = chunk.subarray(fragmentStart);\n\n if (trailingFragment.byteLength > 0) {\n pendingFragments.push(trailingFragment);\n pendingByteLength += trailingFragment.byteLength;\n }\n },\n finish: (): IGitInventoryParserResult<TCandidate> => {\n if (failureReason === null && pendingByteLength > 0) {\n failureReason = 'invalid';\n }\n\n if (failureReason !== null) {\n return Object.freeze({ kind: 'failed', reason: failureReason });\n }\n\n return Object.freeze({ candidates: Object.freeze([...candidates]), kind: 'completed' });\n },\n };\n};\n\n/** Creates a strict incremental parser for tracked Git inventory output. */\nexport const createTrackedGitInventoryParser = (\n maxEntries: number,\n): IGitInventoryParser<IGitTrackedInventoryCandidate> =>\n createGitInventoryParser(maxEntries, parseTrackedCandidate);\n\n/** Creates a strict incremental parser for untracked Git inventory output. */\nexport const createUntrackedGitInventoryParser = (\n maxEntries: number,\n): IGitInventoryParser<IGitUntrackedInventoryCandidate> =>\n createGitInventoryParser(maxEntries, parseUntrackedCandidate);\n","import { Buffer } from 'node:buffer';\nimport { lstat, readdir } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport {\n executeGitStreamingProcess,\n MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n type IGitStreamingProcessExecutor,\n type IGitStreamingProcessFailureReason,\n} from '../../git-process/index.js';\nimport { parseGitAbsolutePathOutput } from '../../git-working-tree/index.js';\nimport {\n areHostPathsEquivalent,\n haveSameHostPathIdentity,\n} from '../../host-path-identity/index.js';\nimport type { IGitInventoryProbeErrorCode } from '../types.js';\n\nimport type {\n IGitInventoryBoundaryInspectedResult,\n IGitInventoryBoundaryInspectionFailedResult,\n IGitInventoryBoundaryInspectionResult,\n IGitInventoryBoundaryInspector,\n IGitInventoryBoundaryOwnership,\n IGitInventoryOwnershipLstat,\n IGitInventoryOwnershipReadDirectory,\n IGitInventoryOwnershipStatistics,\n} from './types.js';\n\nconst GIT_CONTROL_SEGMENT = '.git';\nconst GIT_REPOSITORY_ROOT_ARGUMENTS = ['rev-parse', '--show-toplevel'] as const;\n\ninterface IGitInventoryDirectoryObservation {\n readonly encodedNameKeys: ReadonlySet<string>;\n readonly hostPath: string;\n readonly ownership: IGitInventoryBoundaryOwnership;\n}\n\ninterface IGitInventoryDirectoryReadResult {\n readonly encodedNameKeys: ReadonlySet<string>;\n readonly kind: 'read';\n}\n\ninterface IGitInventoryPathInspectedResult {\n readonly kind: 'inspected';\n readonly statistics: IGitInventoryOwnershipStatistics;\n}\n\ntype IGitInventoryDirectoryReadAttempt =\n IGitInventoryBoundaryInspectionFailedResult | IGitInventoryDirectoryReadResult;\n\ntype IGitInventoryPathInspectionAttempt =\n IGitInventoryBoundaryInspectionFailedResult | IGitInventoryPathInspectedResult;\n\ninterface IGitInventoryBoundaryValidationResult {\n readonly gitMetadataBytes: number;\n readonly kind: 'validated';\n readonly ownership: IGitInventoryBoundaryOwnership;\n}\n\ntype IGitInventoryBoundaryValidationAttempt =\n IGitInventoryBoundaryInspectionFailedResult | IGitInventoryBoundaryValidationResult;\n\n/** Identifies one safe inspection failure in a filesystem result union. */\nconst isInspectionFailure = (\n result: IGitInventoryBoundaryInspectionFailedResult | IGitInventoryDirectoryObservation,\n): result is IGitInventoryBoundaryInspectionFailedResult => 'kind' in result;\n\n/** Creates one immutable ownership-inspection failure. */\nconst createInspectionFailure = (\n errorCode: IGitInventoryProbeErrorCode,\n): IGitInventoryBoundaryInspectionFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps an unknown filesystem failure without retaining host diagnostics. */\nconst mapFilesystemFailure = (error: unknown): IGitInventoryProbeErrorCode => {\n const errorCode = (error as NodeJS.ErrnoException | null)?.code?.toUpperCase();\n\n if (errorCode === 'EACCES' || errorCode === 'EPERM') {\n return 'GIT_ACCESS_DENIED';\n }\n\n if (errorCode === 'ENOENT' || errorCode === 'ENOTDIR' || errorCode === 'ELOOP') {\n return 'GIT_OUTPUT_INVALID';\n }\n\n return 'GIT_COMMAND_FAILED';\n};\n\n/** Maps a streamed nested-root check failure into the existing safe CLI contract. */\nconst mapGitProcessFailure = (\n reason: IGitStreamingProcessFailureReason,\n): IGitInventoryProbeErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'output-limit-exceeded':\n case 'stdout-limit-exceeded':\n return 'RESOURCE_LIMIT_EXCEEDED';\n case 'repository-not-found':\n case 'stderr-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Reads one directory as native names without decoding unrelated entries. */\nconst readDirectoryNames = async (\n hostPath: string,\n readDirectory: IGitInventoryOwnershipReadDirectory,\n): Promise<IGitInventoryDirectoryReadAttempt> => {\n try {\n const encodedNames = await readDirectory(hostPath);\n\n return Object.freeze({\n encodedNameKeys: new Set(encodedNames.map((encodedName) => encodedName.toString('hex'))),\n kind: 'read',\n });\n } catch (error) {\n return createInspectionFailure(mapFilesystemFailure(error));\n }\n};\n\n/** Captures one path without following its final filesystem entry. */\nconst inspectPath = async (\n hostPath: string,\n inspectHostPath: IGitInventoryOwnershipLstat,\n): Promise<IGitInventoryPathInspectionAttempt> => {\n try {\n return Object.freeze({\n kind: 'inspected',\n statistics: await inspectHostPath(hostPath),\n });\n } catch (error) {\n return createInspectionFailure(mapFilesystemFailure(error));\n }\n};\n\n/** Determines whether native names contain one exact UTF-8 segment spelling. */\nconst hasExactDirectoryName = (encodedNameKeys: ReadonlySet<string>, segment: string): boolean =>\n encodedNameKeys.has(Buffer.from(segment, 'utf8').toString('hex'));\n\n/** Confirms that one directory observation retained its no-follow identity. */\nconst hasStableDirectoryIdentity = (\n initialStatistics: IGitInventoryOwnershipStatistics,\n revalidatedStatistics: IGitInventoryOwnershipStatistics,\n): boolean =>\n initialStatistics.isDirectory() &&\n !initialStatistics.isSymbolicLink() &&\n revalidatedStatistics.isDirectory() &&\n !revalidatedStatistics.isSymbolicLink() &&\n initialStatistics.dev === revalidatedStatistics.dev &&\n initialStatistics.ino === revalidatedStatistics.ino;\n\n/** Concatenates already bounded Git stdout chunks for strict root parsing. */\nconst concatenateChunks = (chunks: readonly Uint8Array[], byteLength: number): Uint8Array => {\n const output = new Uint8Array(byteLength);\n let offset = 0;\n\n for (const chunk of chunks) {\n output.set(chunk, offset);\n offset += chunk.byteLength;\n }\n\n return output;\n};\n\n/**\n * Confirms whether a directory with an exact `.git` marker owns another working tree.\n * @param directory The exact no-follow directory being classified.\n * @param repositoryRoot The selected repository root.\n * @param directoryStatistics The stable no-follow boundary observation.\n * @param maxMetadataBytes The remaining bounded Git stdout budget.\n * @param processExecutor The sanitized streamed Git boundary.\n * @param inspectHostPath The no-follow filesystem stat operation.\n * @returns A safe ownership classification and the consumed Git metadata bytes.\n */\nconst validateGitBoundary = async (\n directory: string,\n repositoryRoot: string,\n directoryStatistics: IGitInventoryOwnershipStatistics,\n maxMetadataBytes: number,\n processExecutor: IGitStreamingProcessExecutor,\n inspectHostPath: IGitInventoryOwnershipLstat,\n signal?: AbortSignal,\n): Promise<IGitInventoryBoundaryValidationAttempt> => {\n if (signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (!Number.isSafeInteger(maxMetadataBytes) || maxMetadataBytes < 0) {\n return createInspectionFailure('RESOURCE_LIMIT_EXCEEDED');\n }\n\n const stdoutChunks: Uint8Array[] = [];\n let consumedStdoutBytes = 0;\n const processResult = await processExecutor({\n arguments: ['-C', directory, ...GIT_REPOSITORY_ROOT_ARGUMENTS],\n consumeStdout: (chunk): void => {\n stdoutChunks.push(Uint8Array.from(chunk));\n consumedStdoutBytes += chunk.byteLength;\n },\n maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n maxStdoutBytes: maxMetadataBytes,\n ...(signal === undefined ? {} : { signal }),\n });\n\n if (processResult.kind === 'failed') {\n return createInspectionFailure(mapGitProcessFailure(processResult.reason));\n }\n\n if (processResult.stderr.byteLength > 0 || processResult.stdoutBytes !== consumedStdoutBytes) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const discoveredRoot = parseGitAbsolutePathOutput(\n concatenateChunks(stdoutChunks, consumedStdoutBytes),\n );\n\n if (discoveredRoot === null) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n if (areHostPathsEquivalent(discoveredRoot, directory)) {\n return Object.freeze({\n gitMetadataBytes: processResult.stdoutBytes,\n kind: 'validated',\n ownership: 'nested-repository',\n });\n }\n\n if (areHostPathsEquivalent(discoveredRoot, repositoryRoot)) {\n return Object.freeze({\n gitMetadataBytes: processResult.stdoutBytes,\n kind: 'validated',\n ownership: 'selected-repository',\n });\n }\n\n const discoveredRootInspection = await inspectPath(discoveredRoot, inspectHostPath);\n\n if (signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (discoveredRootInspection.kind === 'failed') {\n return discoveredRootInspection;\n }\n\n if (\n !discoveredRootInspection.statistics.isDirectory() ||\n discoveredRootInspection.statistics.isSymbolicLink()\n ) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n if (haveSameHostPathIdentity(discoveredRootInspection.statistics, directoryStatistics)) {\n return Object.freeze({\n gitMetadataBytes: processResult.stdoutBytes,\n kind: 'validated',\n ownership: 'nested-repository',\n });\n }\n\n const repositoryRootInspection = await inspectPath(repositoryRoot, inspectHostPath);\n\n if (signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (repositoryRootInspection.kind === 'failed') {\n return repositoryRootInspection;\n }\n\n if (\n repositoryRootInspection.statistics.isDirectory() &&\n !repositoryRootInspection.statistics.isSymbolicLink() &&\n haveSameHostPathIdentity(\n discoveredRootInspection.statistics,\n repositoryRootInspection.statistics,\n )\n ) {\n return Object.freeze({\n gitMetadataBytes: processResult.stdoutBytes,\n kind: 'validated',\n ownership: 'selected-repository',\n });\n }\n\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n};\n\n/** Default no-follow stat boundary for ownership inspection. */\nconst inspectOwnershipPath: IGitInventoryOwnershipLstat = async (hostPath) =>\n lstat(hostPath, { bigint: true });\n\n/** Default raw directory-name boundary for ownership inspection. */\nconst readOwnershipDirectory: IGitInventoryOwnershipReadDirectory = async (hostPath) =>\n readdir(hostPath, { encoding: 'buffer' });\n\n/**\n * Creates nested-repository inspection around injectable filesystem and Git boundaries.\n * @param processExecutor The sanitized bounded Git process executor.\n * @param inspectHostPath The no-follow filesystem stat operation.\n * @param readDirectory The raw native-name directory operation.\n * @returns An all-or-nothing ownership inspector for untracked candidate paths.\n */\nexport const createGitInventoryBoundaryInspector = (\n processExecutor: IGitStreamingProcessExecutor = executeGitStreamingProcess,\n inspectHostPath: IGitInventoryOwnershipLstat = inspectOwnershipPath,\n readDirectory: IGitInventoryOwnershipReadDirectory = readOwnershipDirectory,\n): IGitInventoryBoundaryInspector => {\n return async (input): Promise<IGitInventoryBoundaryInspectionResult> => {\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n const directoryObservations = new Map<string, IGitInventoryDirectoryObservation>();\n const ownership: IGitInventoryBoundaryOwnership[] = [];\n let gitMetadataBytes = 0;\n let rootEncodedNameKeys: ReadonlySet<string> | null = null;\n\n const getRootEncodedNames = async (): Promise<IGitInventoryDirectoryReadAttempt> => {\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (rootEncodedNameKeys !== null) {\n return Object.freeze({ encodedNameKeys: rootEncodedNameKeys, kind: 'read' });\n }\n\n const readResult = await readDirectoryNames(input.repositoryRoot, readDirectory);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (readResult.kind === 'read') {\n rootEncodedNameKeys = readResult.encodedNameKeys;\n }\n\n return readResult;\n };\n\n const inspectDirectory = async (\n parentObservation: IGitInventoryDirectoryObservation | null,\n parentPrefix: string,\n segment: string,\n ): Promise<IGitInventoryBoundaryInspectionFailedResult | IGitInventoryDirectoryObservation> => {\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n const prefix = parentPrefix.length === 0 ? segment : `${parentPrefix}/${segment}`;\n const cachedObservation = directoryObservations.get(prefix);\n\n if (cachedObservation !== undefined) {\n return cachedObservation;\n }\n\n const parentNamesResult =\n parentObservation === null\n ? await getRootEncodedNames()\n : Object.freeze({\n encodedNameKeys: parentObservation.encodedNameKeys,\n kind: 'read' as const,\n });\n\n if (parentNamesResult.kind === 'failed') {\n return parentNamesResult;\n }\n\n if (!hasExactDirectoryName(parentNamesResult.encodedNameKeys, segment)) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const parentHostPath = parentObservation?.hostPath ?? input.repositoryRoot;\n const hostPath = path.join(parentHostPath, segment);\n const initialInspection = await inspectPath(hostPath, inspectHostPath);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (initialInspection.kind === 'failed') {\n return initialInspection;\n }\n\n if (\n !initialInspection.statistics.isDirectory() ||\n initialInspection.statistics.isSymbolicLink()\n ) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const directoryNamesResult = await readDirectoryNames(hostPath, readDirectory);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (directoryNamesResult.kind === 'failed') {\n return directoryNamesResult;\n }\n\n const revalidatedInspection = await inspectPath(hostPath, inspectHostPath);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (revalidatedInspection.kind === 'failed') {\n return revalidatedInspection;\n }\n\n if (\n !hasStableDirectoryIdentity(initialInspection.statistics, revalidatedInspection.statistics)\n ) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const gitControlPath = path.join(hostPath, GIT_CONTROL_SEGMENT);\n const hasExactGitControlSegment = hasExactDirectoryName(\n directoryNamesResult.encodedNameKeys,\n GIT_CONTROL_SEGMENT,\n );\n let directoryOwnership: IGitInventoryBoundaryOwnership = 'selected-repository';\n\n if (!hasExactGitControlSegment) {\n try {\n await inspectHostPath(gitControlPath);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n } catch (error) {\n const errorCode = (error as NodeJS.ErrnoException | null)?.code?.toUpperCase();\n\n if (errorCode !== 'ENOENT' && errorCode !== 'ENOTDIR') {\n return createInspectionFailure(mapFilesystemFailure(error));\n }\n }\n } else {\n const gitControlInspection = await inspectPath(gitControlPath, inspectHostPath);\n\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n if (gitControlInspection.kind === 'failed') {\n return gitControlInspection;\n }\n\n if (\n gitControlInspection.statistics.isSymbolicLink() ||\n (!gitControlInspection.statistics.isDirectory() &&\n !gitControlInspection.statistics.isFile())\n ) {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n const boundaryValidation = await validateGitBoundary(\n hostPath,\n input.repositoryRoot,\n revalidatedInspection.statistics,\n input.maxMetadataBytes - gitMetadataBytes,\n processExecutor,\n inspectHostPath,\n input.signal,\n );\n\n if (boundaryValidation.kind === 'failed') {\n return boundaryValidation;\n }\n\n gitMetadataBytes += boundaryValidation.gitMetadataBytes;\n directoryOwnership = boundaryValidation.ownership;\n }\n\n const observation = Object.freeze({\n encodedNameKeys: directoryNamesResult.encodedNameKeys,\n hostPath,\n ownership: directoryOwnership,\n });\n\n directoryObservations.set(prefix, observation);\n\n return observation;\n };\n\n for (const plan of input.plans) {\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n let candidateOwnership: IGitInventoryBoundaryOwnership = 'selected-repository';\n let parentObservation: IGitInventoryDirectoryObservation | null = null;\n let parentPrefix = '';\n\n for (const segment of plan.directorySegments) {\n if (input.signal?.aborted) {\n return createInspectionFailure('GIT_OPERATION_ABORTED');\n }\n\n const observation = await inspectDirectory(parentObservation, parentPrefix, segment);\n\n if (isInspectionFailure(observation)) {\n return observation;\n }\n\n parentObservation = observation;\n parentPrefix = parentPrefix.length === 0 ? segment : `${parentPrefix}/${segment}`;\n\n if (observation.ownership === 'nested-repository') {\n candidateOwnership = 'nested-repository';\n break;\n }\n }\n\n if (plan.isDirectoryRecord && candidateOwnership !== 'nested-repository') {\n return createInspectionFailure('GIT_OUTPUT_INVALID');\n }\n\n ownership.push(candidateOwnership);\n }\n\n const result: IGitInventoryBoundaryInspectedResult = Object.freeze({\n gitMetadataBytes,\n kind: 'inspected',\n ownership: Object.freeze([...ownership]),\n });\n\n return result;\n };\n};\n\n// default nested-repository ownership boundary used by inventory filtering\nexport const inspectGitInventoryBoundaries = createGitInventoryBoundaryInspector();\n","import type { IGitInventoryCandidate } from '../types.js';\n\nimport type { IGitInventoryOwnershipPathPlanResult } from './types.js';\n\n/**\n * Prepares one raw Git path for ownership inspection without logical-path normalization.\n * @param candidate The strictly decoded tracked or untracked candidate.\n * @returns An immutable segment plan, or a failure for an unsafe raw path shape.\n */\nexport const planGitInventoryOwnershipPath = (\n candidate: IGitInventoryCandidate,\n): IGitInventoryOwnershipPathPlanResult => {\n const isDirectoryRecord = candidate.path.endsWith('/');\n\n if (\n candidate.path.length === 0 ||\n candidate.path.startsWith('/') ||\n candidate.path.includes('\\\\') ||\n (candidate.kind === 'tracked' && isDirectoryRecord)\n ) {\n return Object.freeze({ kind: 'failed' });\n }\n\n const pathWithoutDirectoryTerminator = isDirectoryRecord\n ? candidate.path.slice(0, -1)\n : candidate.path;\n const segments = pathWithoutDirectoryTerminator.split('/');\n\n if (\n segments.length === 0 ||\n segments.some((segment) => segment.length === 0 || segment === '.' || segment === '..')\n ) {\n return Object.freeze({ kind: 'failed' });\n }\n\n const frozenSegments = Object.freeze([...segments]);\n const directorySegments = Object.freeze(\n isDirectoryRecord ? [...segments] : segments.slice(0, -1),\n );\n\n return Object.freeze({\n kind: 'planned',\n plan: Object.freeze({\n candidate,\n directorySegments,\n hasGitControlSegment: segments.includes('.git'),\n isDirectoryRecord,\n segments: frozenSegments,\n }),\n });\n};\n","import type { IGitInventoryCandidate, IGitInventoryProbeErrorCode } from '../types.js';\n\nimport { inspectGitInventoryBoundaries } from './boundary-inspector.js';\nimport { planGitInventoryOwnershipPath } from './path-planner.js';\nimport type {\n IGitInventoryBoundaryInspector,\n IGitInventoryOwnershipFilter,\n IGitInventoryOwnershipFilterFailedResult,\n IGitInventoryOwnershipFilterResult,\n IGitInventoryOwnershipPathPlan,\n IGitInventoryUntrackedOwnershipPlan,\n} from './types.js';\n\ninterface IGitInventoryIndexedOwnershipPlan {\n readonly candidateIndex: number;\n readonly plan: IGitInventoryOwnershipPathPlan;\n}\n\ninterface IGitInventoryGitlinkTrieNode {\n readonly children: Map<string, IGitInventoryGitlinkTrieNode>;\n isRoot: boolean;\n}\n\n/** Creates one immutable ownership-filtering failure. */\nconst createOwnershipFailure = (\n errorCode: IGitInventoryProbeErrorCode = 'GIT_OUTPUT_INVALID',\n): IGitInventoryOwnershipFilterFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Builds one segment trie for deterministic submodule-root lookup. */\nconst createGitlinkTrie = (\n rootSegments: readonly (readonly string[])[],\n): IGitInventoryGitlinkTrieNode => {\n const trie: IGitInventoryGitlinkTrieNode = { children: new Map(), isRoot: false };\n\n for (const segments of rootSegments) {\n let node = trie;\n\n for (const segment of segments) {\n let childNode = node.children.get(segment);\n\n if (childNode === undefined) {\n childNode = { children: new Map(), isRoot: false };\n node.children.set(segment, childNode);\n }\n\n node = childNode;\n }\n\n node.isRoot = true;\n }\n\n return trie;\n};\n\n/** Determines whether one candidate is a submodule root or segment descendant. */\nconst isAtOrBelowGitlink = (\n candidateSegments: readonly string[],\n gitlinkTrie: IGitInventoryGitlinkTrieNode,\n): boolean => {\n let node = gitlinkTrie;\n\n for (const segment of candidateSegments) {\n const childNode = node.children.get(segment);\n\n if (childNode === undefined) {\n return false;\n }\n\n if (childNode.isRoot) {\n return true;\n }\n\n node = childNode;\n }\n\n return false;\n};\n\n/**\n * Creates selected-repository ownership filtering around an injectable boundary inspector.\n * @param boundaryInspector The no-follow nested-repository ownership operation.\n * @returns An all-or-nothing raw candidate ownership filter.\n */\nexport const createGitInventoryOwnershipFilter = (\n boundaryInspector: IGitInventoryBoundaryInspector = inspectGitInventoryBoundaries,\n): IGitInventoryOwnershipFilter => {\n return async (input): Promise<IGitInventoryOwnershipFilterResult> => {\n const plannedCandidates: IGitInventoryIndexedOwnershipPlan[] = [];\n\n for (const [candidateIndex, candidate] of input.candidates.entries()) {\n if (input.signal?.aborted) {\n return createOwnershipFailure('GIT_OPERATION_ABORTED');\n }\n\n const planResult = planGitInventoryOwnershipPath(candidate);\n\n if (planResult.kind === 'failed') {\n return createOwnershipFailure();\n }\n\n plannedCandidates.push({ candidateIndex, plan: planResult.plan });\n }\n\n const gitlinkTrie = createGitlinkTrie(\n plannedCandidates\n .filter(\n ({ plan }) =>\n !plan.hasGitControlSegment &&\n plan.candidate.kind === 'tracked' &&\n plan.candidate.mode === '160000',\n )\n .map(({ plan }) => plan.segments),\n );\n const includedCandidates = Array.from({ length: input.candidates.length }, () => false);\n const untrackedPlans: IGitInventoryUntrackedOwnershipPlan[] = [];\n\n for (const { candidateIndex, plan } of plannedCandidates) {\n const isExcludedByGitPolicy =\n plan.hasGitControlSegment || isAtOrBelowGitlink(plan.segments, gitlinkTrie);\n\n if (isExcludedByGitPolicy) {\n continue;\n }\n\n if (plan.candidate.kind === 'tracked') {\n includedCandidates[candidateIndex] = true;\n continue;\n }\n\n untrackedPlans.push({ candidate: plan.candidate, candidateIndex, plan });\n }\n\n const boundaryResult = await boundaryInspector({\n maxMetadataBytes: input.maxMetadataBytes,\n plans: untrackedPlans.map(({ plan }) => plan),\n repositoryRoot: input.repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (boundaryResult.kind === 'failed') {\n return boundaryResult;\n }\n\n if (boundaryResult.ownership.length !== untrackedPlans.length) {\n return createOwnershipFailure();\n }\n\n for (const [ownershipIndex, ownership] of boundaryResult.ownership.entries()) {\n if (input.signal?.aborted) {\n return createOwnershipFailure('GIT_OPERATION_ABORTED');\n }\n\n const untrackedPlan = untrackedPlans[ownershipIndex];\n\n if (untrackedPlan === undefined) {\n return createOwnershipFailure();\n }\n\n if (ownership === 'selected-repository') {\n includedCandidates[untrackedPlan.candidateIndex] = true;\n }\n }\n\n const candidates = input.candidates.filter(\n (_candidate: IGitInventoryCandidate, candidateIndex) =>\n includedCandidates[candidateIndex] === true,\n );\n\n return Object.freeze({\n candidates: Object.freeze(candidates),\n gitMetadataBytes: boundaryResult.gitMetadataBytes,\n kind: 'filtered',\n });\n };\n};\n","import {\n executeGitStreamingProcess,\n MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n type IGitStreamingProcessExecutor,\n type IGitStreamingProcessFailureReason,\n} from '../git-process/index.js';\nimport { GIT_TRACKED_INVENTORY_ARGUMENTS, GIT_UNTRACKED_INVENTORY_ARGUMENTS } from './constants.js';\nimport {\n createGitContentTransformationClassifier,\n type IGitContentTransformationClassifier,\n} from './content-transformation/index.js';\nimport {\n createGitInventoryEntryTypeNormalizer,\n createGitSymlinkConfigurationResolver,\n inspectGitInventoryEntry,\n type IGitInventoryEntryTypeNormalizer,\n} from './entry-type/index.js';\nimport {\n normalizeGitInventoryLogicalPaths,\n type IGitInventoryLogicalPathNormalizer,\n validateGitInventoryCandidateLogicalPaths,\n} from './logical-path/index.js';\nimport { createTrackedGitInventoryParser, createUntrackedGitInventoryParser } from './parser.js';\nimport {\n createGitInventoryBoundaryInspector,\n createGitInventoryOwnershipFilter,\n type IGitInventoryOwnershipFilter,\n} from './repository-ownership/index.js';\nimport type {\n IGitInventoryCandidate,\n IGitInventoryParserResult,\n IGitInventoryProbe,\n IGitInventoryProbeErrorCode,\n IGitInventoryProbeFailedResult,\n IGitInventoryProbeResult,\n} from './types.js';\n\n/** Maps one normalized streamed Git failure to a safe inventory error. */\nconst mapGitProcessFailure = (\n reason: IGitStreamingProcessFailureReason,\n): IGitInventoryProbeErrorCode => {\n switch (reason) {\n case 'aborted':\n return 'GIT_OPERATION_ABORTED';\n case 'not-found':\n return 'GIT_NOT_FOUND';\n case 'repository-not-found':\n return 'GIT_REPOSITORY_NOT_FOUND';\n case 'access-denied':\n return 'GIT_ACCESS_DENIED';\n case 'stderr-limit-exceeded':\n return 'GIT_OUTPUT_INVALID';\n case 'output-limit-exceeded':\n case 'stdout-limit-exceeded':\n return 'RESOURCE_LIMIT_EXCEEDED';\n case 'command-failed':\n return 'GIT_COMMAND_FAILED';\n }\n};\n\n/** Creates one immutable inventory-probe failure. */\nconst createProbeFailure = (\n errorCode: IGitInventoryProbeErrorCode,\n): IGitInventoryProbeFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Maps one completed parser result into immutable candidates or a safe failure. */\nconst resolveParserResult = <TCandidate extends IGitInventoryCandidate>(\n parserResult: IGitInventoryParserResult<TCandidate>,\n): readonly TCandidate[] | IGitInventoryProbeFailedResult => {\n if (parserResult.kind === 'completed') {\n return parserResult.candidates;\n }\n\n return createProbeFailure(\n parserResult.reason === 'entry-limit-exceeded'\n ? 'RESOURCE_LIMIT_EXCEEDED'\n : 'GIT_OUTPUT_INVALID',\n );\n};\n\n/** Identifies a parser resolution failure without relying on array contents. */\nconst isProbeFailure = (\n result: readonly IGitInventoryCandidate[] | IGitInventoryProbeFailedResult,\n): result is IGitInventoryProbeFailedResult => !Array.isArray(result);\n\n/**\n * Creates the strict normalized Git inventory probe around injectable boundaries.\n * @param processExecutor The bounded incremental Git process executor.\n * @param ownershipFilter The submodule and nested-repository ownership filter.\n * @param entryTypeNormalizer The current filesystem and Git mode entry-type normalizer.\n * @param contentTransformationClassifier The bounded effective Git attribute classifier.\n * @param logicalPathNormalizer The portable repository logical-path normalizer.\n * @returns An all-or-nothing selected-repository entry probe.\n */\nexport const createGitInventoryProbe =\n (\n processExecutor: IGitStreamingProcessExecutor = executeGitStreamingProcess,\n ownershipFilter: IGitInventoryOwnershipFilter = createGitInventoryOwnershipFilter(\n createGitInventoryBoundaryInspector(processExecutor),\n ),\n entryTypeNormalizer: IGitInventoryEntryTypeNormalizer = createGitInventoryEntryTypeNormalizer(\n inspectGitInventoryEntry,\n createGitSymlinkConfigurationResolver(processExecutor),\n ),\n contentTransformationClassifier: IGitContentTransformationClassifier = createGitContentTransformationClassifier(\n processExecutor,\n ),\n logicalPathNormalizer: IGitInventoryLogicalPathNormalizer = normalizeGitInventoryLogicalPaths,\n ): IGitInventoryProbe =>\n async (input): Promise<IGitInventoryProbeResult> => {\n if (input.signal?.aborted) {\n return createProbeFailure('GIT_OPERATION_ABORTED');\n }\n\n const trackedParser = createTrackedGitInventoryParser(input.maxEntries);\n const trackedProcessResult = await processExecutor({\n arguments: ['-C', input.repositoryRoot, ...GIT_TRACKED_INVENTORY_ARGUMENTS],\n consumeStdout: (chunk) => trackedParser.consume(chunk),\n maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n maxStdoutBytes: input.maxMetadataBytes,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (trackedProcessResult.kind === 'failed') {\n return createProbeFailure(mapGitProcessFailure(trackedProcessResult.reason));\n }\n\n if (trackedProcessResult.stderr.byteLength > 0) {\n return createProbeFailure('GIT_OUTPUT_INVALID');\n }\n\n const trackedCandidates = resolveParserResult(trackedParser.finish());\n\n if (isProbeFailure(trackedCandidates)) {\n return trackedCandidates;\n }\n\n const untrackedParser = createUntrackedGitInventoryParser(\n input.maxEntries - trackedCandidates.length,\n );\n const untrackedProcessResult = await processExecutor({\n arguments: ['-C', input.repositoryRoot, ...GIT_UNTRACKED_INVENTORY_ARGUMENTS],\n consumeStdout: (chunk) => untrackedParser.consume(chunk),\n maxStderrBytes: MAX_GIT_PROCESS_DIAGNOSTIC_BYTES,\n maxStdoutBytes: input.maxMetadataBytes - trackedProcessResult.stdoutBytes,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (untrackedProcessResult.kind === 'failed') {\n return createProbeFailure(mapGitProcessFailure(untrackedProcessResult.reason));\n }\n\n if (untrackedProcessResult.stderr.byteLength > 0) {\n return createProbeFailure('GIT_OUTPUT_INVALID');\n }\n\n const untrackedCandidates = resolveParserResult(untrackedParser.finish());\n\n if (isProbeFailure(untrackedCandidates)) {\n return untrackedCandidates;\n }\n\n const candidates = Object.freeze([...trackedCandidates, ...untrackedCandidates]);\n const logicalPathValidationResult = validateGitInventoryCandidateLogicalPaths({ candidates });\n\n if (logicalPathValidationResult.kind === 'failed') {\n return logicalPathValidationResult;\n }\n\n const ownershipResult = await ownershipFilter({\n candidates,\n maxMetadataBytes:\n input.maxMetadataBytes -\n trackedProcessResult.stdoutBytes -\n untrackedProcessResult.stdoutBytes,\n repositoryRoot: input.repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (ownershipResult.kind === 'failed') {\n return ownershipResult;\n }\n\n const entryTypeResult = await entryTypeNormalizer({\n candidates: ownershipResult.candidates,\n maxMetadataBytes:\n input.maxMetadataBytes -\n trackedProcessResult.stdoutBytes -\n untrackedProcessResult.stdoutBytes -\n ownershipResult.gitMetadataBytes,\n repositoryRoot: input.repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (entryTypeResult.kind === 'failed') {\n return entryTypeResult;\n }\n\n const contentTransformationResult = await contentTransformationClassifier({\n entries: entryTypeResult.entries,\n maxMetadataBytes:\n input.maxMetadataBytes -\n trackedProcessResult.stdoutBytes -\n untrackedProcessResult.stdoutBytes -\n ownershipResult.gitMetadataBytes -\n entryTypeResult.gitMetadataBytes,\n repositoryRoot: input.repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (contentTransformationResult.kind === 'failed') {\n return contentTransformationResult;\n }\n\n const logicalPathResult = logicalPathNormalizer({\n entries: contentTransformationResult.entries,\n });\n\n if (logicalPathResult.kind === 'failed') {\n return logicalPathResult;\n }\n\n return Object.freeze({ entries: logicalPathResult.entries, kind: 'probed' });\n };\n\n// default normalized Git inventory probe used by command execution\nexport const probeGitInventory = createGitInventoryProbe();\n","import type { IGitContentTransformationClassification } from '../content-transformation/index.js';\nimport type { IGitInventoryIndexEntry } from '../entry-type/index.js';\nimport type { IGitInventoryEntry } from '../logical-path/index.js';\n\n/** Determines whether two exact transform classifications are equal. */\nconst areContentTransformationsEqual = (\n left: IGitContentTransformationClassification,\n right: IGitContentTransformationClassification,\n): boolean =>\n left.filter === right.filter &&\n left.ident === right.ident &&\n left.isGuarded === right.isGuarded &&\n left.workingTreeEncoding === right.workingTreeEncoding;\n\n/** Determines whether two retained Git mode-and-stage sequences are equal. */\nconst areIndexEntriesEqual = (\n left: readonly IGitInventoryIndexEntry[],\n right: readonly IGitInventoryIndexEntry[],\n): boolean =>\n left.length === right.length &&\n left.every(\n (leftEntry, index) =>\n leftEntry.mode === right[index]?.mode && leftEntry.stage === right[index]?.stage,\n );\n\n/** Determines whether two normalized inventory entries are exactly equal. */\nconst areInventoryEntriesEqual = (left: IGitInventoryEntry, right: IGitInventoryEntry): boolean => {\n if (\n left.kind !== right.kind ||\n left.path !== right.path ||\n left.entryType !== right.entryType ||\n left.requiresSymlinkOverlay !== right.requiresSymlinkOverlay ||\n !areContentTransformationsEqual(left.contentTransformation, right.contentTransformation)\n ) {\n return false;\n }\n\n if (left.kind === 'untracked' || right.kind === 'untracked') {\n return left.kind === right.kind;\n }\n\n return areIndexEntriesEqual(left.indexEntries, right.indexEntries);\n};\n\n/**\n * Determines whether two complete normalized Git inventories describe the same snapshot inputs.\n * @param left The first deterministic inventory.\n * @param right The second deterministic inventory.\n * @returns Whether ordering and every retained record field are equal.\n */\nexport const areGitInventoriesEqual = (\n left: readonly IGitInventoryEntry[],\n right: readonly IGitInventoryEntry[],\n): boolean =>\n left.length === right.length &&\n left.every((leftEntry, index) => {\n const rightEntry = right[index];\n\n return rightEntry !== undefined && areInventoryEntriesEqual(leftEntry, rightEntry);\n });\n","import {\n REPOSITORY_ROOT,\n RepositorySourceException,\n parseRepositoryPath,\n type IRepositoryEntry,\n type IRepositoryListOptions,\n type IRepositoryOperation,\n type IRepositoryOperationOptions,\n type IRepositoryPath,\n type IRepositoryReader,\n} from '@moldea.ai/repository';\n\n/** Throws the common cancellation contract for wrapper-owned operations. */\nconst throwIfAborted = (\n signal: AbortSignal | undefined,\n operation: IRepositoryOperation,\n path: IRepositoryPath,\n): void => {\n if (!signal?.aborted) {\n return;\n }\n\n throw new RepositorySourceException({\n cause: signal.reason,\n code: 'ABORTED',\n operation,\n path,\n retryable: false,\n });\n};\n\n/** Creates the common failure for an overlay that contradicts its underlying snapshot. */\nconst createInvalidOverlayException = (\n operation: IRepositoryOperation,\n path: IRepositoryPath,\n): RepositorySourceException =>\n new RepositorySourceException({\n code: 'INVALID_SOURCE_DATA',\n operation,\n path,\n retryable: false,\n });\n\n/** Confirms that one overlay path remains a regular file in the underlying snapshot. */\nconst validateOverlayEntry = (\n entry: IRepositoryEntry | null,\n operation: Exclude<IRepositoryOperation, 'create-reader'>,\n path: IRepositoryPath,\n): void => {\n if (entry?.type !== 'file' || entry.path !== path) {\n throw createInvalidOverlayException(operation, path);\n }\n};\n\n/** Maps one expected underlying regular file to an immutable logical symlink entry. */\nconst overlayEntry = (\n entry: IRepositoryEntry | null,\n operation: 'get-entry' | 'list-entries',\n path: IRepositoryPath,\n): IRepositoryEntry => {\n validateOverlayEntry(entry, operation, path);\n\n return Object.freeze({ path, type: 'symlink' });\n};\n\n// immutable logical symlink view over one coherent repository reader\nclass GitSymlinkOverlayRepositoryReader implements IRepositoryReader {\n readonly #overlayPaths: ReadonlySet<IRepositoryPath>;\n\n readonly #reader: IRepositoryReader;\n\n public constructor(reader: IRepositoryReader, overlayPaths: ReadonlySet<IRepositoryPath>) {\n this.#reader = reader;\n this.#overlayPaths = overlayPaths;\n }\n\n /**\n * Looks up an entry while replacing configured host files with logical symlinks.\n * @param path The validated repository path to inspect.\n * @param options Optional cancellation controls.\n * @returns A promise resolving to the detached logical entry or confirmed absence.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path 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 * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public async getEntry(\n path: IRepositoryPath,\n options?: IRepositoryOperationOptions,\n ): Promise<IRepositoryEntry | null> {\n const entry = await this.#reader.getEntry(path, options);\n\n if (!this.#overlayPaths.has(path)) {\n return entry;\n }\n\n return overlayEntry(entry, 'get-entry', path);\n }\n\n /**\n * Reads ordinary files while refusing access to configured logical symlink bytes.\n * @param path The validated repository file path to read.\n * @param options Optional cancellation controls.\n * @returns A promise resolving to fresh bytes for a non-overlaid regular file.\n * @throws\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 * - 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 * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public async readFile(\n path: IRepositoryPath,\n options?: IRepositoryOperationOptions,\n ): Promise<Uint8Array> {\n const parsedPath = parseRepositoryPath(path);\n\n if (!this.#overlayPaths.has(parsedPath)) {\n return this.#reader.readFile(parsedPath, options);\n }\n\n throwIfAborted(options?.signal, 'read-file', parsedPath);\n\n const entry = await this.#reader.getEntry(parsedPath, options);\n\n validateOverlayEntry(entry, 'read-file', parsedPath);\n throwIfAborted(options?.signal, 'read-file', parsedPath);\n\n throw new RepositorySourceException({\n code: 'ENTRY_NOT_FILE',\n operation: 'read-file',\n path: parsedPath,\n retryable: false,\n });\n }\n\n /**\n * Recursively lists descendants while replacing configured host files with logical symlinks.\n * @param options Optional prefix and cancellation controls.\n * @returns An async iterable of detached logical entries.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - ENTRY_NOT_FOUND: The requested repository entry was not found.\n * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.\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 * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n */\n public async *listEntries(options?: IRepositoryListOptions): AsyncIterable<IRepositoryEntry> {\n const prefix =\n options?.prefix === undefined ? REPOSITORY_ROOT : parseRepositoryPath(options.prefix);\n\n if (this.#overlayPaths.has(prefix)) {\n throwIfAborted(options?.signal, 'list-entries', prefix);\n\n const operationOptions =\n options?.signal === undefined ? undefined : { signal: options.signal };\n const entry = await this.#reader.getEntry(prefix, operationOptions);\n\n validateOverlayEntry(entry, 'list-entries', prefix);\n throwIfAborted(options?.signal, 'list-entries', prefix);\n throw new RepositorySourceException({\n code: 'ENTRY_NOT_DIRECTORY',\n operation: 'list-entries',\n path: prefix,\n retryable: false,\n });\n }\n\n const descendantPrefix = prefix === REPOSITORY_ROOT ? REPOSITORY_ROOT : `${prefix}/`;\n const unmatchedOverlayPaths = new Set(\n [...this.#overlayPaths].filter((path) => path.startsWith(descendantPrefix)),\n );\n\n for await (const entry of this.#reader.listEntries(options)) {\n if (!unmatchedOverlayPaths.has(entry.path)) {\n yield entry;\n continue;\n }\n\n unmatchedOverlayPaths.delete(entry.path);\n yield overlayEntry(entry, 'list-entries', entry.path);\n }\n\n const missingOverlayPath = unmatchedOverlayPaths.values().next().value;\n\n if (missingOverlayPath !== undefined) {\n throw createInvalidOverlayException('list-entries', missingOverlayPath);\n }\n }\n}\n\n/**\n * Creates an immutable reader overlay for Git symlinks materialized as host files.\n * @param reader The coherent underlying repository reader.\n * @param symlinkPaths The logical paths whose host files represent Git symlinks.\n * @returns A reader that exposes the configured paths only as logical symlinks.\n * @throws\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n */\nexport const createGitSymlinkOverlayRepositoryReader = (\n reader: IRepositoryReader,\n symlinkPaths: readonly IRepositoryPath[],\n): IRepositoryReader => {\n const overlayPaths = new Set<IRepositoryPath>();\n\n for (const symlinkPath of symlinkPaths) {\n const parsedPath = parseRepositoryPath(symlinkPath);\n\n if (parsedPath === REPOSITORY_ROOT) {\n throw new RepositorySourceException({\n code: 'INVALID_SOURCE_DATA',\n operation: 'create-reader',\n path: parsedPath,\n retryable: false,\n });\n }\n\n overlayPaths.add(parsedPath);\n }\n\n return Object.freeze(new GitSymlinkOverlayRepositoryReader(reader, overlayPaths));\n};\n","import type { IRepositoryPath, IRepositoryReader } from '@moldea.ai/repository';\nimport { createFilesystemRepositoryReader } from '@moldea.ai/repository-fs';\n\nimport { createGitContentTransformationGuardRepositoryReader } from '../repository-content-transformation-guard/index.js';\nimport { createGitSymlinkOverlayRepositoryReader } from '../repository-symlink-overlay/index.js';\n\nimport type { IWorkingTreeRepositoryReaderFactory } from './types.js';\n\n// injectable package and overlay factories used by the composition boundary\ntype IFilesystemRepositoryReaderFactory = typeof createFilesystemRepositoryReader;\ntype IGitContentTransformationGuardRepositoryReaderFactory =\n typeof createGitContentTransformationGuardRepositoryReader;\ntype IGitSymlinkOverlayRepositoryReaderFactory = typeof createGitSymlinkOverlayRepositoryReader;\n\n/**\n * Creates the private working-tree reader factory around injectable composition boundaries.\n * @param filesystemReaderFactory The exact-path filesystem snapshot factory.\n * @param symlinkOverlayFactory The logical Git symlink overlay factory.\n * @param contentTransformationGuardFactory The guarded logical regular-file reader factory.\n * @returns A factory that composes one coherent selected working-tree reader.\n */\nexport const createWorkingTreeRepositoryReaderFactory =\n (\n filesystemReaderFactory: IFilesystemRepositoryReaderFactory = createFilesystemRepositoryReader,\n symlinkOverlayFactory: IGitSymlinkOverlayRepositoryReaderFactory = createGitSymlinkOverlayRepositoryReader,\n contentTransformationGuardFactory: IGitContentTransformationGuardRepositoryReaderFactory = createGitContentTransformationGuardRepositoryReader,\n ): IWorkingTreeRepositoryReaderFactory =>\n async (input): Promise<IRepositoryReader> => {\n const selectedPaths = Object.freeze(input.entries.map((entry) => entry.path));\n const symlinkOverlayPaths = Object.freeze(\n input.entries.reduce<IRepositoryPath[]>((paths, entry) => {\n if (entry.requiresSymlinkOverlay) {\n paths.push(entry.path);\n }\n\n return paths;\n }, []),\n );\n const guardedPaths = Object.freeze(\n input.entries.reduce<IRepositoryPath[]>((paths, entry) => {\n if (entry.contentTransformation.isGuarded) {\n paths.push(entry.path);\n }\n\n return paths;\n }, []),\n );\n const filesystemReader = await filesystemReaderFactory({\n limits: Object.freeze({\n maxCachedBytes: input.resourceLimits.maxTotalBytes,\n maxEntries: input.resourceLimits.maxEntries,\n maxFileBytes: input.resourceLimits.maxFileBytes,\n }),\n rootDirectory: input.repositoryRoot,\n selection: Object.freeze({ kind: 'paths', paths: selectedPaths }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n const overlaidReader = symlinkOverlayFactory(filesystemReader, symlinkOverlayPaths);\n\n return contentTransformationGuardFactory(overlaidReader, guardedPaths);\n };\n\n// default exact-path working-tree reader composition used by command execution\nexport const createWorkingTreeRepositoryReader = createWorkingTreeRepositoryReaderFactory();\n","import { RepositorySourceException, type IRepositoryReader } from '@moldea.ai/repository';\n\nimport {\n areGitInventoriesEqual,\n probeGitInventory,\n type IGitInventoryProbe,\n type IGitInventoryProbedResult,\n} from '../git-inventory/index.js';\nimport {\n areGitWorkingTreeIdentitiesEqual,\n inspectGitWorkingTreeIdentity,\n type IGitWorkingTreeIdentity,\n type IGitWorkingTreeIdentityInspector,\n} from '../git-working-tree/index.js';\nimport type { IMoldeaCliOwnedErrorCode } from '../presentation/index.js';\nimport {\n createWorkingTreeRepositoryReader,\n type IWorkingTreeRepositoryReaderFactory,\n} from '../repository-reader/index.js';\n\nimport { MAX_WORKING_TREE_SNAPSHOT_ATTEMPTS } from './constants.js';\nimport type {\n IWorkingTreeSnapshotExecutionInput,\n IWorkingTreeSnapshotExecutionResult,\n IWorkingTreeSnapshotExecutor,\n IWorkingTreeSnapshotFailedResult,\n IWorkingTreeSnapshotInventoryComparator,\n} from './types.js';\n\n/** Creates one immutable terminal snapshot failure. */\nconst createSnapshotFailure = (\n errorCode: IMoldeaCliOwnedErrorCode,\n): IWorkingTreeSnapshotFailedResult => Object.freeze({ errorCode, kind: 'failed' });\n\n/** Determines whether a source exception proves that the current reader is unusable. */\nconst isSnapshotChanged = (error: unknown): boolean =>\n error instanceof RepositorySourceException && error.code === 'SNAPSHOT_CHANGED';\n\n/** Determines whether reader creation may have raced with an inventory change. */\nconst isCreationInventoryRace = (error: unknown): boolean =>\n error instanceof RepositorySourceException &&\n error.operation === 'create-reader' &&\n (error.code === 'ENTRY_NOT_FOUND' || error.code === 'ENTRY_NOT_DIRECTORY');\n\n/** Determines whether identity inspection failed because the pinned source disappeared. */\nconst isPinnedIdentityUnavailable = (errorCode: IMoldeaCliOwnedErrorCode): boolean =>\n errorCode === 'GIT_REPOSITORY_NOT_FOUND' || errorCode === 'GIT_WORK_TREE_REQUIRED';\n\n/**\n * Creates the bounded whole-operation working-tree snapshot executor.\n * @param identityInspector The selected working-tree identity observation boundary.\n * @param inventoryProbe The complete normalized Git inventory probe.\n * @param repositoryReaderFactory The exact-path guarded reader factory.\n * @param compareInventories The exact normalized inventory comparator.\n * @returns An executor that discards and retries complete provisional attempts.\n */\nexport const createWorkingTreeSnapshotExecutor = (\n identityInspector: IGitWorkingTreeIdentityInspector = inspectGitWorkingTreeIdentity,\n inventoryProbe: IGitInventoryProbe = probeGitInventory,\n repositoryReaderFactory: IWorkingTreeRepositoryReaderFactory = createWorkingTreeRepositoryReader,\n compareInventories: IWorkingTreeSnapshotInventoryComparator = areGitInventoriesEqual,\n): IWorkingTreeSnapshotExecutor => {\n const executeSnapshot = async <TResult>(\n input: IWorkingTreeSnapshotExecutionInput<TResult>,\n ): Promise<IWorkingTreeSnapshotExecutionResult<TResult>> => {\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n const repositoryRoot = input.repositoryRoot;\n const resourceLimits = Object.freeze({ ...input.resourceLimits });\n const pinnedIdentityResult = await identityInspector({\n repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (pinnedIdentityResult.kind === 'failed') {\n return createSnapshotFailure(pinnedIdentityResult.errorCode);\n }\n\n if (pinnedIdentityResult.kind === 'mismatched') {\n return createSnapshotFailure('GIT_OUTPUT_INVALID');\n }\n\n const pinnedIdentity: IGitWorkingTreeIdentity = pinnedIdentityResult.identity;\n\n const probeInventory = async (): Promise<\n IGitInventoryProbedResult | IWorkingTreeSnapshotFailedResult\n > => {\n const result = await inventoryProbe({\n maxEntries: resourceLimits.maxEntries,\n maxMetadataBytes: resourceLimits.maxTotalBytes,\n repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n return result.kind === 'failed' ? createSnapshotFailure(result.errorCode) : result;\n };\n\n for (let attempt = 0; attempt < MAX_WORKING_TREE_SNAPSHOT_ATTEMPTS; attempt += 1) {\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n const currentIdentityResult = await identityInspector({\n repositoryRoot,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (currentIdentityResult.kind === 'failed') {\n return createSnapshotFailure(\n isPinnedIdentityUnavailable(currentIdentityResult.errorCode)\n ? 'WORKING_TREE_UNSTABLE'\n : currentIdentityResult.errorCode,\n );\n }\n\n if (\n currentIdentityResult.kind === 'mismatched' ||\n !areGitWorkingTreeIdentitiesEqual(pinnedIdentity, currentIdentityResult.identity)\n ) {\n return createSnapshotFailure('WORKING_TREE_UNSTABLE');\n }\n\n const firstInventoryResult = await probeInventory();\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (firstInventoryResult.kind === 'failed') {\n return firstInventoryResult;\n }\n\n let reader: IRepositoryReader;\n\n try {\n reader = await repositoryReaderFactory({\n entries: firstInventoryResult.entries,\n repositoryRoot,\n resourceLimits,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n } catch (error) {\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (isSnapshotChanged(error)) {\n continue;\n }\n\n if (!isCreationInventoryRace(error)) {\n throw error;\n }\n\n const freshInventoryResult = await probeInventory();\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (freshInventoryResult.kind === 'failed') {\n return freshInventoryResult;\n }\n\n if (!compareInventories(firstInventoryResult.entries, freshInventoryResult.entries)) {\n continue;\n }\n\n throw error;\n }\n\n const secondInventoryResult = await probeInventory();\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (secondInventoryResult.kind === 'failed') {\n return secondInventoryResult;\n }\n\n if (!compareInventories(firstInventoryResult.entries, secondInventoryResult.entries)) {\n continue;\n }\n\n try {\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n const result =\n input.signal === undefined\n ? await input.operation(reader)\n : await input.operation(reader, input.signal);\n\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n return Object.freeze({ kind: 'completed', result });\n } catch (error) {\n if (input.signal?.aborted) {\n return createSnapshotFailure('GIT_OPERATION_ABORTED');\n }\n\n if (!isSnapshotChanged(error)) {\n throw error;\n }\n }\n }\n\n return createSnapshotFailure('WORKING_TREE_UNSTABLE');\n };\n\n return executeSnapshot;\n};\n\n// default bounded snapshot executor used by command execution\nexport const executeWorkingTreeSnapshot = createWorkingTreeSnapshotExecutor();\n","import type { IProjectInspectionResult } from '@moldea.ai/core';\n\nimport type { IMoldeaCliCommand } from '../command-line/index.js';\nimport type { IMoldeaCliCompositionResult } from '../composition/index.js';\nimport {\n createMoldeaCliInspectResult,\n createMoldeaCliValidateResult,\n formatMoldeaCliHumanCompositionResult,\n formatMoldeaCliHumanError,\n formatMoldeaCliHumanInspectResult,\n formatMoldeaCliHumanValidateResult,\n formatMoldeaCliJsonCompositionResult,\n formatMoldeaCliJsonError,\n formatMoldeaCliJsonInspectResult,\n formatMoldeaCliJsonValidateResult,\n type IMoldeaCliError,\n} from '../presentation/index.js';\n\nimport { MOLDEA_CLI_EXIT_CODES } from './constants.js';\nimport type { IMoldeaCliExecutionResult } from './types.js';\n\n/**\n * Creates one process-neutral result for a valid installed composition.\n * @param result The exact installed composition result.\n * @param cliVersion The installed CLI package version.\n * @param isJson Whether machine-readable output was requested.\n * @returns The complete immutable successful process output.\n */\nexport const createMoldeaCliCompositionExecutionResult = (\n result: IMoldeaCliCompositionResult,\n cliVersion: string,\n isJson: boolean,\n): IMoldeaCliExecutionResult =>\n Object.freeze({\n exitCode: MOLDEA_CLI_EXIT_CODES.Success,\n stderr: '',\n stdout: isJson\n ? formatMoldeaCliJsonCompositionResult(result, cliVersion)\n : formatMoldeaCliHumanCompositionResult(result, cliVersion),\n });\n\n/**\n * Creates one safe process-neutral error result in the requested output mode.\n * @param error The complete safe operational error.\n * @param command The resolved command, or null when resolution failed.\n * @param cliVersion The installed CLI package version.\n * @param isJson Whether machine-readable output was requested.\n * @param exitCode The handled process exit code.\n * @returns The complete immutable process output.\n */\nexport const createMoldeaCliErrorResult = (\n error: IMoldeaCliError,\n command: IMoldeaCliCommand | null,\n cliVersion: string,\n isJson: boolean,\n exitCode: number,\n): IMoldeaCliExecutionResult =>\n Object.freeze(\n isJson\n ? {\n exitCode,\n stderr: '',\n stdout: formatMoldeaCliJsonError(error, command, cliVersion),\n }\n : {\n exitCode,\n stderr: formatMoldeaCliHumanError(error),\n stdout: '',\n },\n );\n\n/**\n * Creates one process-neutral result for a completed validate command.\n * @param inspection The complete immutable Core inspection.\n * @param cliVersion The installed CLI package version.\n * @param isJson Whether machine-readable output was requested.\n * @returns The complete immutable process output.\n */\nexport const createMoldeaCliValidateExecutionResult = (\n inspection: IProjectInspectionResult,\n cliVersion: string,\n isJson: boolean,\n): IMoldeaCliExecutionResult => {\n const result = createMoldeaCliValidateResult(inspection);\n const exitCode =\n result.diagnostics.length === 0\n ? MOLDEA_CLI_EXIT_CODES.Success\n : MOLDEA_CLI_EXIT_CODES.StructuralInvalid;\n\n return Object.freeze({\n exitCode,\n stderr: '',\n stdout: isJson\n ? formatMoldeaCliJsonValidateResult(result, cliVersion)\n : formatMoldeaCliHumanValidateResult(result),\n });\n};\n\n/**\n * Creates one process-neutral result for a completed inspect command.\n * @param inspection The complete immutable Core inspection.\n * @param cliVersion The installed CLI package version.\n * @param isJson Whether machine-readable output was requested.\n * @returns The complete immutable process output.\n * @throws If the Core result contradicts its valid, project, and diagnostic invariants.\n */\nexport const createMoldeaCliInspectExecutionResult = (\n inspection: IProjectInspectionResult,\n cliVersion: string,\n isJson: boolean,\n): IMoldeaCliExecutionResult => {\n const result = createMoldeaCliInspectResult(inspection);\n\n return Object.freeze({\n exitCode: inspection.valid\n ? MOLDEA_CLI_EXIT_CODES.Success\n : MOLDEA_CLI_EXIT_CODES.StructuralInvalid,\n stderr: '',\n stdout: isJson\n ? formatMoldeaCliJsonInspectResult(result, cliVersion)\n : formatMoldeaCliHumanInspectResult(result),\n });\n};\n","import { MOLDEA_CLI_COMMANDS } from '../command-line/index.js';\nimport {\n resolveInstalledMoldeaCliComposition,\n type IMoldeaCliCompositionResolver,\n} from '../composition/index.js';\nimport {\n executeMoldeaCliCoreInspection,\n type IMoldeaCliCoreInspectionExecutor,\n} from '../core-composition/index.js';\nimport {\n discoverGitWorkingTree,\n type IGitWorkingTreeDiscovery,\n} from '../git-working-tree/index.js';\nimport { mapMoldeaCliOperationalError } from '../operational-error/index.js';\nimport { createMoldeaCliOwnedError } from '../presentation/index.js';\nimport {\n executeWorkingTreeSnapshot,\n type IWorkingTreeSnapshotExecutor,\n} from '../working-tree-snapshot/index.js';\n\nimport { MOLDEA_CLI_EXIT_CODES } from './constants.js';\nimport {\n createMoldeaCliCompositionExecutionResult,\n createMoldeaCliErrorResult,\n createMoldeaCliInspectExecutionResult,\n createMoldeaCliValidateExecutionResult,\n} from './results.js';\nimport type { IMoldeaCliCommandExecutor, IMoldeaCliExecutionResult } from './types.js';\n\n/**\n * Creates the private command dispatcher around discovery and bounded snapshot execution.\n * @param workingTreeDiscovery The Git working-tree discovery operation.\n * @param workingTreeSnapshotExecutor The complete working-tree snapshot operation.\n * @param coreInspectionExecutor The attempt-local Core inspection composition.\n * @param compositionResolver The installed executable-integrity and composition boundary.\n * @returns A command executor for the current behavioral slice.\n */\nexport const createMoldeaCliCommandExecutor =\n (\n workingTreeDiscovery: IGitWorkingTreeDiscovery = discoverGitWorkingTree,\n workingTreeSnapshotExecutor: IWorkingTreeSnapshotExecutor = executeWorkingTreeSnapshot,\n coreInspectionExecutor: IMoldeaCliCoreInspectionExecutor = executeMoldeaCliCoreInspection,\n compositionResolver: IMoldeaCliCompositionResolver = resolveInstalledMoldeaCliComposition,\n ): IMoldeaCliCommandExecutor =>\n async (input): Promise<IMoldeaCliExecutionResult> => {\n const compositionResolution = compositionResolver({\n packageMetadata: input.packageMetadata,\n });\n\n if (compositionResolution.kind === 'invalid') {\n return createMoldeaCliErrorResult(\n createMoldeaCliOwnedError('COMPOSITION_STATE_INVALID'),\n input.invocation.command,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n MOLDEA_CLI_EXIT_CODES.OperationalError,\n );\n }\n\n if (input.invocation.command === MOLDEA_CLI_COMMANDS.Composition) {\n return createMoldeaCliCompositionExecutionResult(\n compositionResolution.result,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n );\n }\n\n const discoveryResult = await workingTreeDiscovery({\n invocationDirectory: input.invocationDirectory,\n repositoryDirectory: input.invocation.options.repositoryDirectory,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (discoveryResult.kind === 'failed') {\n return createMoldeaCliErrorResult(\n createMoldeaCliOwnedError(discoveryResult.errorCode),\n input.invocation.command,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n MOLDEA_CLI_EXIT_CODES.OperationalError,\n );\n }\n\n try {\n const resourceLimits = input.invocation.options.resourceLimits;\n const snapshotResult = await workingTreeSnapshotExecutor({\n operation: (repository, signal) =>\n coreInspectionExecutor({\n repository,\n resourceLimits,\n ...(signal === undefined ? {} : { signal }),\n }),\n repositoryRoot: discoveryResult.repositoryRoot,\n resourceLimits,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n\n if (snapshotResult.kind === 'failed') {\n return createMoldeaCliErrorResult(\n createMoldeaCliOwnedError(snapshotResult.errorCode),\n input.invocation.command,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n MOLDEA_CLI_EXIT_CODES.OperationalError,\n );\n }\n\n if (input.invocation.command === MOLDEA_CLI_COMMANDS.Validate) {\n return createMoldeaCliValidateExecutionResult(\n snapshotResult.result,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n );\n }\n\n return createMoldeaCliInspectExecutionResult(\n snapshotResult.result,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n );\n } catch (error) {\n return createMoldeaCliErrorResult(\n mapMoldeaCliOperationalError(error),\n input.invocation.command,\n input.packageMetadata.version,\n input.invocation.options.isJson,\n MOLDEA_CLI_EXIT_CODES.OperationalError,\n );\n }\n };\n\n// default private command dispatcher used by the executable runner\nexport const executeMoldeaCliCommand = createMoldeaCliCommandExecutor();\n","import { parseMoldeaCliArguments } from '../command-line/index.js';\nimport { createMoldeaCliOwnedError, formatMoldeaCliHelp } from '../presentation/index.js';\n\nimport { executeMoldeaCliCommand } from './command-executor.js';\nimport { MOLDEA_CLI_EXIT_CODES } from './constants.js';\nimport { createMoldeaCliErrorResult } from './results.js';\nimport type { IMoldeaCliExecutionResult, IRunMoldeaCliOptions } from './types.js';\n\n/**\n * Runs one process-neutral CLI invocation through parsing and private command dispatch.\n * @param options The arguments, installed metadata, optional cancellation, and executor seam.\n * @returns A promise resolving to exact process output and the handled exit code.\n */\nexport const runMoldeaCli = async (\n options: IRunMoldeaCliOptions,\n): Promise<IMoldeaCliExecutionResult> => {\n const parseResult = parseMoldeaCliArguments(options.commandLineArguments);\n\n if (parseResult.kind === 'help') {\n return {\n exitCode: MOLDEA_CLI_EXIT_CODES.Success,\n stderr: '',\n stdout: formatMoldeaCliHelp(parseResult.command),\n };\n }\n\n if (parseResult.kind === 'version') {\n return {\n exitCode: MOLDEA_CLI_EXIT_CODES.Success,\n stderr: '',\n stdout: `${options.packageMetadata.version}\\n`,\n };\n }\n\n if (parseResult.kind === 'error') {\n return createMoldeaCliErrorResult(\n createMoldeaCliOwnedError(parseResult.code),\n parseResult.command,\n options.packageMetadata.version,\n parseResult.isJson,\n MOLDEA_CLI_EXIT_CODES.UsageError,\n );\n }\n\n const executeCommand = options.executeCommand ?? executeMoldeaCliCommand;\n\n try {\n return await executeCommand({\n invocationDirectory: options.invocationDirectory,\n invocation: parseResult.invocation,\n packageMetadata: options.packageMetadata,\n ...(options.signal === undefined ? {} : { signal: options.signal }),\n });\n } catch {\n return createMoldeaCliErrorResult(\n createMoldeaCliOwnedError('INTERNAL_ERROR'),\n parseResult.invocation.command,\n options.packageMetadata.version,\n parseResult.invocation.options.isJson,\n MOLDEA_CLI_EXIT_CODES.OperationalError,\n );\n }\n};\n","import { readFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { valid as isValidVersion } from 'semver';\n\nimport type { IMoldeaCliPackageEntryResolver, IMoldeaCliPackageMetadata } from './types.js';\n\nconst MOLDEA_CLI_PACKAGE_NAME = '@moldea.ai/cli';\n\n/** Checks exact SemVer syntax without accepting normalized prefixes or surrounding whitespace. */\nconst isExactSemanticVersion = (version: string): boolean =>\n version === version.trim() && /^[0-9]/u.test(version) && isValidVersion(version) !== null;\n\nconst isPlainRecord = (value: unknown): value is Readonly<Record<string, unknown>> => {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n return false;\n }\n\n const prototype = Object.getPrototypeOf(value) as object | null;\n\n return prototype === Object.prototype || prototype === null;\n};\n\n/** Returns a frozen string record, or null when a package composition field is malformed. */\nconst readStringRecord = (value: unknown): Readonly<Record<string, string>> | null => {\n if (!isPlainRecord(value)) {\n return null;\n }\n\n const entries = Object.entries(value);\n\n if (entries.some(([, entryValue]) => typeof entryValue !== 'string')) {\n return null;\n }\n\n return Object.freeze(Object.fromEntries(entries) as Record<string, string>);\n};\n\n/** Resolves one package entry through the executable's own module-resolution context. */\nconst resolvePackageEntry: IMoldeaCliPackageEntryResolver = (packageName) =>\n import.meta.resolve(packageName);\n\n/** Narrows a resolved package entry after the complete resolution pass succeeds. */\nconst isInstalledPackageEntry = (\n entry: readonly [string, string] | null,\n): entry is readonly [string, string] => entry !== null;\n\n/** Reads one resolved package's exact identity without executing package code. */\nconst readInstalledPackageVersion = async (\n packageName: string,\n packageEntry: string,\n): Promise<string | null> => {\n let packageDirectory: string;\n\n try {\n const packageEntryUrl = new URL(packageEntry);\n\n if (packageEntryUrl.protocol !== 'file:') {\n return null;\n }\n\n packageDirectory = path.dirname(fileURLToPath(packageEntryUrl));\n } catch {\n return null;\n }\n\n while (true) {\n try {\n const parsedManifest = JSON.parse(\n await readFile(path.join(packageDirectory, 'package.json'), 'utf8'),\n ) as unknown;\n\n if (isPlainRecord(parsedManifest) && parsedManifest['name'] === packageName) {\n const version = parsedManifest['version'];\n\n return typeof version === 'string' && isExactSemanticVersion(version) ? version : null;\n }\n } catch {\n // continue toward the package root when this directory has no readable manifest\n }\n\n const parentDirectory = path.dirname(packageDirectory);\n\n if (parentDirectory === packageDirectory) {\n return null;\n }\n\n packageDirectory = parentDirectory;\n }\n};\n\n/** Resolves the actual versions of every declared first-class package dependency. */\nconst readInstalledPackageVersions = async (\n dependencies: Readonly<Record<string, string>> | null,\n packageEntryResolver: IMoldeaCliPackageEntryResolver,\n): Promise<Readonly<Record<string, string>> | null> => {\n if (dependencies === null) {\n return null;\n }\n\n const packageNames = Object.keys(dependencies).filter((packageName) =>\n packageName.startsWith('@moldea.ai/'),\n );\n const installedPackageEntries = await Promise.all(\n packageNames.map(async (packageName) => {\n try {\n const version = await readInstalledPackageVersion(\n packageName,\n packageEntryResolver(packageName),\n );\n\n return version === null ? null : ([packageName, version] as const);\n } catch {\n return null;\n }\n }),\n );\n\n if (!installedPackageEntries.every(isInstalledPackageEntry)) {\n return null;\n }\n\n return Object.freeze(Object.fromEntries(installedPackageEntries));\n};\n\n/**\n * Loads the installed CLI identity and composition used by executable output and integrity checks.\n * @param packageManifestPath The package manifest adjacent to the distribution directory.\n * @param packageEntryResolver The module-resolution boundary for declared first-class packages.\n * @returns A promise resolving to validated package metadata.\n * @throws\n * - If the manifest cannot be read, parsed, or identified as the installed CLI package\n */\nexport const loadMoldeaCliPackageMetadata = async (\n packageManifestPath: string,\n packageEntryResolver: IMoldeaCliPackageEntryResolver = resolvePackageEntry,\n): Promise<IMoldeaCliPackageMetadata> => {\n const parsedManifest = JSON.parse(await readFile(packageManifestPath, 'utf8')) as unknown;\n\n if (\n !isPlainRecord(parsedManifest) ||\n parsedManifest['name'] !== MOLDEA_CLI_PACKAGE_NAME ||\n typeof parsedManifest['version'] !== 'string' ||\n !isExactSemanticVersion(parsedManifest['version'])\n ) {\n throw new TypeError('The installed CLI package metadata is invalid.');\n }\n\n const engines = readStringRecord(parsedManifest['engines']);\n const dependencies = readStringRecord(parsedManifest['dependencies']);\n\n return Object.freeze({\n dependencies,\n installedPackageVersions: await readInstalledPackageVersions(\n dependencies,\n packageEntryResolver,\n ),\n supportedNodeRange: engines?.['node'] ?? null,\n version: parsedManifest['version'],\n });\n};\n","import process from 'node:process';\n\nimport { MOLDEA_CLI_EXIT_CODES } from '../cli-execution/constants.js';\n\nimport type {\n IMoldeaCliProcessSignalSession,\n IMoldeaCliProcessSignalSource,\n IMoldeaCliSignalExitCode,\n IMoldeaCliTerminationSignal,\n} from './types.js';\n\nconst SIGNAL_EXIT_CODES = Object.freeze({\n SIGINT: MOLDEA_CLI_EXIT_CODES.Interrupted,\n SIGTERM: MOLDEA_CLI_EXIT_CODES.Terminated,\n} as const satisfies Readonly<Record<IMoldeaCliTerminationSignal, IMoldeaCliSignalExitCode>>);\n\nconst PROCESS_SIGNAL_SOURCE: IMoldeaCliProcessSignalSource = Object.freeze({\n addListener: (signal: IMoldeaCliTerminationSignal, listener: () => void): void => {\n process.on(signal, listener);\n },\n removeListener: (signal: IMoldeaCliTerminationSignal, listener: () => void): void => {\n process.off(signal, listener);\n },\n});\n\n/**\n * Creates one process-signal session around an operation-scoped abort controller.\n * @param signalSource The process-listener boundary.\n * @returns A session that records the first signal until output completes.\n */\nexport const createMoldeaCliProcessSignalSession = (\n signalSource: IMoldeaCliProcessSignalSource = PROCESS_SIGNAL_SOURCE,\n): IMoldeaCliProcessSignalSession => {\n const controller = new AbortController();\n let exitCode: IMoldeaCliSignalExitCode | null = null;\n let isDisposed = false;\n let isOutputComplete = false;\n\n const handleSignal = (signal: IMoldeaCliTerminationSignal): void => {\n if (exitCode !== null || isDisposed || isOutputComplete) {\n return;\n }\n\n exitCode = SIGNAL_EXIT_CODES[signal];\n controller.abort();\n };\n const handleSigint = (): void => handleSignal('SIGINT');\n const handleSigterm = (): void => handleSignal('SIGTERM');\n\n signalSource.addListener('SIGINT', handleSigint);\n signalSource.addListener('SIGTERM', handleSigterm);\n\n return Object.freeze({\n completeOutput: (): void => {\n isOutputComplete = true;\n },\n dispose: (): void => {\n if (isDisposed) {\n return;\n }\n\n isDisposed = true;\n signalSource.removeListener('SIGINT', handleSigint);\n signalSource.removeListener('SIGTERM', handleSigterm);\n },\n get exitCode(): IMoldeaCliSignalExitCode | null {\n return exitCode;\n },\n get hasReceivedSignal(): boolean {\n return exitCode !== null;\n },\n signal: controller.signal,\n });\n};\n","import path from 'node:path';\nimport process from 'node:process';\nimport { fileURLToPath } from 'node:url';\n\nimport { runMoldeaCli } from '../cli-execution/index.js';\nimport { loadMoldeaCliPackageMetadata } from '../package-metadata/index.js';\nimport { createMoldeaCliOwnedError, formatMoldeaCliHumanError } from '../presentation/index.js';\nimport { createMoldeaCliProcessSignalSession } from '../process-signal/index.js';\n\nconst executableDirectory = path.dirname(fileURLToPath(import.meta.url));\nconst packageManifestPath = path.resolve(executableDirectory, '..', 'package.json');\nconst signalSession = createMoldeaCliProcessSignalSession();\n\n/**\n * Writes one complete process output string.\n * @param outputStream The destination process stream.\n * @param output The complete output to write.\n * @returns A promise resolving after the stream accepts the output.\n */\nconst writeProcessOutput = async (\n outputStream: NodeJS.WriteStream,\n output: string,\n): Promise<void> => {\n if (output.length === 0) {\n return;\n }\n\n await new Promise<void>((resolve, reject) => {\n outputStream.write(output, (error) => {\n if (error) {\n reject(error);\n return;\n }\n\n resolve();\n });\n });\n};\n\ntry {\n const invocationDirectory = process.cwd();\n const packageMetadata = await loadMoldeaCliPackageMetadata(packageManifestPath);\n const executionResult = await runMoldeaCli({\n commandLineArguments: process.argv.slice(2),\n invocationDirectory,\n packageMetadata,\n signal: signalSession.signal,\n });\n\n if (signalSession.hasReceivedSignal) {\n process.exitCode = signalSession.exitCode;\n } else {\n await writeProcessOutput(process.stdout, executionResult.stdout);\n\n if (!signalSession.hasReceivedSignal) {\n await writeProcessOutput(process.stderr, executionResult.stderr);\n }\n\n if (!signalSession.hasReceivedSignal) {\n signalSession.completeOutput();\n }\n\n process.exitCode = signalSession.exitCode ?? executionResult.exitCode;\n }\n} catch {\n if (signalSession.hasReceivedSignal) {\n process.exitCode = signalSession.exitCode;\n } else {\n await writeProcessOutput(\n process.stderr,\n formatMoldeaCliHumanError(createMoldeaCliOwnedError('INTERNAL_ERROR')),\n ).catch(() => undefined);\n signalSession.completeOutput();\n process.exitCode = 3;\n }\n} finally {\n signalSession.dispose();\n}\n"],"x_google_ignoreList":[9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAa,wBAAwB;CACnC,aAAa;CACb,kBAAkB;CAClB,mBAAmB;CACnB,SAAS;CACT,YAAY;CACZ,YAAY;AACd;;;ACPA,IAAa,sBAAsB;CACjC,aAAa;CACb,SAAS;CACT,UAAU;AACZ;AAGA,IAAa,qBAAqB;CAChC,MAAM;CACN,MAAM;CACN,gBAAgB;CAChB,YAAY;CACZ,aAAa;CACb,cAAc;CACd,kBAAkB;CAClB,eAAe;CACf,SAAS;CACT,YAAY;CACZ,SAAS;AACX;AAGA,IAAa,qCAAqC,OAAO,OAAO;CAC9D,gBAAgB;CAChB,YAAY;CACZ,aAAa;CACb,cAAc;CACd,kBAAkB;CAClB,eAAe;AACjB,CAAC;;;AC5BD,IAAM,2BAA2B;;;;;;AAOjC,IAAa,gCAA8B,SAA0B;CACnE,KAAK,IAAI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