@moldea.ai/cli 14.0.2 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/chunks/{composition-aJXeA6un.js → composition-B4GH4Nqy.js} +1 -1
- package/dist/chunks/{composition-BzwNJ346.js → composition-DymbbpSr.js} +72 -108
- package/dist/chunks/composition-DymbbpSr.js.map +1 -0
- package/dist/chunks/{core-composition-CzdeqYS9.js → core-composition-DhjRyNO7.js} +79 -8
- package/dist/chunks/core-composition-DhjRyNO7.js.map +1 -0
- package/dist/moldea.js +51 -43
- package/dist/moldea.js.map +1 -1
- package/dist/portable/SHA256SUMS +4 -4
- package/dist/portable/{chunk-1b3c5f05.mjs → chunk-ad32cb41.mjs} +388 -419
- package/dist/portable/{chunk-a6007228.mjs → chunk-afb0cf51.mjs} +132 -93
- package/dist/portable/{chunk-8a1dadf9.mjs → chunk-cb0442cc.mjs} +1 -1
- package/dist/portable/moldea.mjs +208 -207
- package/package.json +1 -1
- package/dist/chunks/composition-BzwNJ346.js.map +0 -1
- package/dist/chunks/core-composition-CzdeqYS9.js.map +0 -1
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { o as MoldeaCliCompositionException, t as resolveInstalledMoldeaCliComposition } from "./composition-
|
|
2
|
+
import { A as createMoldeaCliRecordKey, P as MoldeaCliOutputPageException, o as MoldeaCliCompositionException, t as resolveInstalledMoldeaCliComposition } from "./composition-DymbbpSr.js";
|
|
3
|
+
import { CoreOperationException } from "@moldea.ai/core";
|
|
3
4
|
import { createNodeProjectInspection } from "@moldea.ai/core/node";
|
|
5
|
+
//#region src/core-composition/inspect-page.ts
|
|
6
|
+
var DIAGNOSTICS_START = "diagnostics-start";
|
|
7
|
+
/**
|
|
8
|
+
* Reads one bounded page of inventory and diagnostics, omitting Core agent assignments.
|
|
9
|
+
* @throws
|
|
10
|
+
* - CURSOR_INVALID: The continuation cursor is invalid for this request.
|
|
11
|
+
* - CURSOR_SNAPSHOT_CHANGED: The continuation cursor belongs to a different repository snapshot.
|
|
12
|
+
* - INVALID_ARGUMENT: The Core operation received an invalid argument.
|
|
13
|
+
*/
|
|
14
|
+
var readMoldeaCliInspectPage = async (inspection, maxItems, cursor) => {
|
|
15
|
+
const { counts, coverageCounts, formatVersion, inspectionDigest, valid } = inspection;
|
|
16
|
+
const totalItems = counts.metadata + counts.diagnostics;
|
|
17
|
+
const priorIndex = cursor === void 0 ? -1 : Number.parseInt(cursor.lastKey, 36);
|
|
18
|
+
const startIndex = priorIndex + 1;
|
|
19
|
+
let sourceCursor = cursor?.sourceCursor ?? null;
|
|
20
|
+
if (cursor !== void 0) {
|
|
21
|
+
if (cursor.snapshotDigest !== inspectionDigest) throw new MoldeaCliOutputPageException("CURSOR_SNAPSHOT_CHANGED");
|
|
22
|
+
if (!Number.isSafeInteger(priorIndex) || priorIndex < 0 || createMoldeaCliRecordKey(priorIndex) !== cursor.lastKey || startIndex >= totalItems || sourceCursor === null || sourceCursor === DIAGNOSTICS_START !== (startIndex === counts.metadata)) throw new MoldeaCliOutputPageException("CURSOR_INVALID");
|
|
23
|
+
}
|
|
24
|
+
if (sourceCursor === DIAGNOSTICS_START) sourceCursor = null;
|
|
25
|
+
const records = [];
|
|
26
|
+
for (const [view, endIndex] of [["metadata", counts.metadata], ["diagnostics", totalItems]]) {
|
|
27
|
+
const nextIndex = startIndex + records.length;
|
|
28
|
+
const requestItems = Math.min(maxItems - records.length, endIndex - nextIndex);
|
|
29
|
+
if (requestItems <= 0) continue;
|
|
30
|
+
const result = await inspection.readPage({
|
|
31
|
+
view,
|
|
32
|
+
maxItems: requestItems,
|
|
33
|
+
...sourceCursor === null ? {} : { cursor: sourceCursor }
|
|
34
|
+
}).catch((error) => {
|
|
35
|
+
if (sourceCursor !== null && error instanceof CoreOperationException && error.code === "INVALID_ARGUMENT") throw new MoldeaCliOutputPageException("CURSOR_INVALID", { cause: error });
|
|
36
|
+
throw error;
|
|
37
|
+
});
|
|
38
|
+
if (result.page.records.length !== requestItems) {
|
|
39
|
+
if (sourceCursor !== null) throw new MoldeaCliOutputPageException("CURSOR_INVALID");
|
|
40
|
+
throw new TypeError("The Core inspection view ended before its reported count.");
|
|
41
|
+
}
|
|
42
|
+
for (const { item, nextCursor } of result.page.records) {
|
|
43
|
+
if (item.kind !== "metadata" && item.kind !== "diagnostic" || (view === "metadata" ? item.kind !== "metadata" : item.kind !== "diagnostic")) {
|
|
44
|
+
if (sourceCursor !== null) throw new MoldeaCliOutputPageException("CURSOR_INVALID");
|
|
45
|
+
throw new TypeError("The Core inspection view returned an unexpected record.");
|
|
46
|
+
}
|
|
47
|
+
const followingIndex = startIndex + records.length + 1;
|
|
48
|
+
const continuation = followingIndex === totalItems ? null : followingIndex === counts.metadata ? DIAGNOSTICS_START : nextCursor;
|
|
49
|
+
if (followingIndex < totalItems && continuation === null) {
|
|
50
|
+
if (sourceCursor !== null) throw new MoldeaCliOutputPageException("CURSOR_INVALID");
|
|
51
|
+
throw new TypeError("The Core inspection view is missing a continuation.");
|
|
52
|
+
}
|
|
53
|
+
records.push({
|
|
54
|
+
item,
|
|
55
|
+
nextCursor: continuation
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
sourceCursor = null;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
counts,
|
|
62
|
+
coverageCounts,
|
|
63
|
+
formatVersion,
|
|
64
|
+
inspectionDigest,
|
|
65
|
+
records,
|
|
66
|
+
startIndex,
|
|
67
|
+
valid
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
4
71
|
//#region src/core-composition/executor.ts
|
|
5
72
|
var calculateRetainedByteLimit = (maxTotalBytes) => maxTotalBytes > Math.floor(Number.MAX_SAFE_INTEGER / 4) ? Number.MAX_SAFE_INTEGER : maxTotalBytes * 4;
|
|
6
73
|
/**
|
|
@@ -23,13 +90,10 @@ var createMoldeaCliCoreInspectionExecutor = (nodeInspectionFactory = createNodeP
|
|
|
23
90
|
},
|
|
24
91
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
25
92
|
});
|
|
93
|
+
let translatedCursorCause;
|
|
26
94
|
try {
|
|
27
95
|
if (resolveInstalledMoldeaCliComposition({ packageMetadata: input.packageMetadata }).kind === "invalid") throw new MoldeaCliCompositionException();
|
|
28
|
-
if (input.command === "inspect") return await inspection.
|
|
29
|
-
...input.cursor === void 0 ? {} : { cursor: input.cursor },
|
|
30
|
-
maxItems: Math.min(256, input.resourceLimits.maxEntries),
|
|
31
|
-
view: "all"
|
|
32
|
-
});
|
|
96
|
+
if (input.command === "inspect") return await readMoldeaCliInspectPage(inspection, Math.min(256, input.resourceLimits.maxEntries), input.cursor);
|
|
33
97
|
const diagnostics = [];
|
|
34
98
|
const coverage = [];
|
|
35
99
|
for (const view of ["diagnostics", "coverage"]) {
|
|
@@ -58,8 +122,13 @@ var createMoldeaCliCoreInspectionExecutor = (nodeInspectionFactory = createNodeP
|
|
|
58
122
|
source: inspection.source,
|
|
59
123
|
summary: inspection.summary
|
|
60
124
|
});
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (error instanceof MoldeaCliOutputPageException) translatedCursorCause = error.cause;
|
|
127
|
+
throw error;
|
|
61
128
|
} finally {
|
|
62
|
-
await inspection.dispose()
|
|
129
|
+
await inspection.dispose().catch((error) => {
|
|
130
|
+
if (translatedCursorCause === void 0 || error !== translatedCursorCause) throw error;
|
|
131
|
+
});
|
|
63
132
|
}
|
|
64
133
|
};
|
|
65
134
|
/**
|
|
@@ -68,6 +137,8 @@ var createMoldeaCliCoreInspectionExecutor = (nodeInspectionFactory = createNodeP
|
|
|
68
137
|
* @throws
|
|
69
138
|
* - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.
|
|
70
139
|
* - INVALID_ARGUMENT: The Core operation received an invalid argument.
|
|
140
|
+
* - CURSOR_INVALID: The continuation cursor is invalid for this request.
|
|
141
|
+
* - CURSOR_SNAPSHOT_CHANGED: The continuation cursor belongs to a different repository snapshot.
|
|
71
142
|
* - INVALID_REPOSITORY_PATH: The repository path is invalid.
|
|
72
143
|
* - ENTRY_NOT_FOUND: The requested repository entry was not found.
|
|
73
144
|
* - ENTRY_NOT_FILE: The requested repository entry is not a file.
|
|
@@ -91,4 +162,4 @@ var executeMoldeaCliCoreInspection = createMoldeaCliCoreInspectionExecutor();
|
|
|
91
162
|
//#endregion
|
|
92
163
|
export { executeMoldeaCliCoreInspection };
|
|
93
164
|
|
|
94
|
-
//# sourceMappingURL=core-composition-
|
|
165
|
+
//# sourceMappingURL=core-composition-DhjRyNO7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-composition-DhjRyNO7.js","names":[],"sources":["../../src/core-composition/inspect-page.ts","../../src/core-composition/executor.ts"],"sourcesContent":["import { CoreOperationException } from '@moldea.ai/core';\nimport type { INodeProjectInspection } from '@moldea.ai/core/node';\n\nimport {\n createMoldeaCliRecordKey,\n MoldeaCliOutputPageException,\n type IMoldeaCliCursorState,\n} from '../output-page/index.js';\n\nimport type { IMoldeaCliCoreInspectPage } from './types.js';\n\n// marks the switch between Core views without exposing or fabricating a Core cursor\nconst DIAGNOSTICS_START = 'diagnostics-start';\n\n/**\n * Reads one bounded page of inventory and diagnostics, omitting Core agent assignments.\n * @throws\n * - CURSOR_INVALID: The continuation cursor is invalid for this request.\n * - CURSOR_SNAPSHOT_CHANGED: The continuation cursor belongs to a different repository snapshot.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n */\nexport const readMoldeaCliInspectPage = async (\n inspection: INodeProjectInspection,\n maxItems: number,\n cursor: IMoldeaCliCursorState | undefined,\n): Promise<IMoldeaCliCoreInspectPage> => {\n const { counts, coverageCounts, formatVersion, inspectionDigest, valid } = inspection;\n const totalItems = counts.metadata + counts.diagnostics;\n const priorIndex = cursor === undefined ? -1 : Number.parseInt(cursor.lastKey, 36);\n const startIndex = priorIndex + 1;\n let sourceCursor = cursor?.sourceCursor ?? null;\n\n if (cursor !== undefined) {\n if (cursor.snapshotDigest !== inspectionDigest) {\n throw new MoldeaCliOutputPageException('CURSOR_SNAPSHOT_CHANGED');\n }\n if (\n !Number.isSafeInteger(priorIndex) ||\n priorIndex < 0 ||\n createMoldeaCliRecordKey(priorIndex) !== cursor.lastKey ||\n startIndex >= totalItems ||\n sourceCursor === null ||\n (sourceCursor === DIAGNOSTICS_START) !== (startIndex === counts.metadata)\n ) {\n throw new MoldeaCliOutputPageException('CURSOR_INVALID');\n }\n }\n\n if (sourceCursor === DIAGNOSTICS_START) sourceCursor = null;\n const records: IMoldeaCliCoreInspectPage['records'][number][] = [];\n for (const [view, endIndex] of [\n ['metadata', counts.metadata],\n ['diagnostics', totalItems],\n ] as const) {\n const nextIndex = startIndex + records.length;\n const requestItems = Math.min(maxItems - records.length, endIndex - nextIndex);\n if (requestItems <= 0) continue;\n\n const result = await inspection\n .readPage({\n view,\n maxItems: requestItems,\n ...(sourceCursor === null ? {} : { cursor: sourceCursor }),\n })\n .catch((error: unknown) => {\n if (\n sourceCursor !== null &&\n error instanceof CoreOperationException &&\n error.code === 'INVALID_ARGUMENT'\n ) {\n throw new MoldeaCliOutputPageException('CURSOR_INVALID', { cause: error });\n }\n throw error;\n });\n\n if (result.page.records.length !== requestItems) {\n if (sourceCursor !== null) throw new MoldeaCliOutputPageException('CURSOR_INVALID');\n throw new TypeError('The Core inspection view ended before its reported count.');\n }\n for (const { item, nextCursor } of result.page.records) {\n if (\n (item.kind !== 'metadata' && item.kind !== 'diagnostic') ||\n (view === 'metadata' ? item.kind !== 'metadata' : item.kind !== 'diagnostic')\n ) {\n if (sourceCursor !== null) throw new MoldeaCliOutputPageException('CURSOR_INVALID');\n throw new TypeError('The Core inspection view returned an unexpected record.');\n }\n const followingIndex = startIndex + records.length + 1;\n const continuation =\n followingIndex === totalItems\n ? null\n : followingIndex === counts.metadata\n ? DIAGNOSTICS_START\n : nextCursor;\n if (followingIndex < totalItems && continuation === null) {\n if (sourceCursor !== null) throw new MoldeaCliOutputPageException('CURSOR_INVALID');\n throw new TypeError('The Core inspection view is missing a continuation.');\n }\n records.push({ item, nextCursor: continuation });\n }\n sourceCursor = null;\n }\n return { counts, coverageCounts, formatVersion, inspectionDigest, records, startIndex, valid };\n};\n","import type { IDiagnostic, IProjectValidationResult, IBindingCoverage } from '@moldea.ai/core';\nimport { createNodeProjectInspection } from '@moldea.ai/core/node';\n\nimport {\n MoldeaCliCompositionException,\n resolveInstalledMoldeaCliComposition,\n} from '../composition/index.js';\nimport { MoldeaCliOutputPageException } from '../output-page/index.js';\n\nimport { readMoldeaCliInspectPage } from './inspect-page.js';\nimport type { IMoldeaCliCoreInspectionExecutor, IMoldeaCliNodeInspectionFactory } from './types.js';\n\nconst calculateRetainedByteLimit = (maxTotalBytes: number): number =>\n maxTotalBytes > Math.floor(Number.MAX_SAFE_INTEGER / 4)\n ? Number.MAX_SAFE_INTEGER\n : maxTotalBytes * 4;\n\n/**\n * Creates one isolated inspection per snapshot attempt, with no in-process fallback.\n * @param nodeInspectionFactory The supervised Node inspection boundary.\n * @returns An executor that disposes its worker before returning any successful result.\n */\nexport const createMoldeaCliCoreInspectionExecutor =\n (\n nodeInspectionFactory: IMoldeaCliNodeInspectionFactory = createNodeProjectInspection,\n ): IMoldeaCliCoreInspectionExecutor =>\n async (input) => {\n const inspection = await nodeInspectionFactory({\n repository: input.repository,\n ...(input.instructions === undefined ? {} : { instructions: input.instructions }),\n limits: {\n maxDiagnostics: input.resourceLimits.maxDiagnostics,\n maxEntries: input.resourceLimits.maxEntries,\n maxCoverage: input.resourceLimits.maxCoverage,\n maxFileBytes: input.resourceLimits.maxFileBytes,\n maxManifestBytes: input.resourceLimits.maxManifestBytes,\n maxRetainedBytes: calculateRetainedByteLimit(input.resourceLimits.maxTotalBytes),\n maxTotalBytesRead: input.resourceLimits.maxTotalBytes,\n },\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n let translatedCursorCause: unknown;\n try {\n if (\n resolveInstalledMoldeaCliComposition({\n packageMetadata: input.packageMetadata,\n }).kind === 'invalid'\n )\n throw new MoldeaCliCompositionException();\n if (input.command === 'inspect')\n return await readMoldeaCliInspectPage(\n inspection,\n Math.min(256, input.resourceLimits.maxEntries),\n input.cursor,\n );\n const diagnostics: IDiagnostic[] = [];\n const coverage: IBindingCoverage[] = [];\n for (const view of ['diagnostics', 'coverage'] as const) {\n let cursor: string | undefined;\n do {\n const result = await inspection.readPage({\n view,\n maxItems: Math.min(256, input.resourceLimits.maxEntries),\n ...(cursor === undefined ? {} : { cursor }),\n });\n for (const { item } of result.page.records) {\n if (item.kind === 'diagnostic') diagnostics.push(item.diagnostic);\n else if (item.kind === 'coverage') coverage.push(item.coverage);\n }\n cursor = result.page.nextCursor ?? undefined;\n } while (cursor !== undefined);\n }\n return Object.freeze({\n diagnostics: Object.freeze(diagnostics),\n coverage: Object.freeze(coverage),\n coverageCounts: inspection.coverageCounts,\n diagnosticCount: inspection.counts.diagnostics,\n acceptedWarningCount: inspection.counts.acceptedWarnings,\n errorCount: inspection.counts.errors,\n warningCount: inspection.counts.warnings,\n valid: inspection.valid,\n formatVersion: inspection.formatVersion,\n source: inspection.source,\n summary: inspection.summary,\n } satisfies IProjectValidationResult);\n } catch (error) {\n if (error instanceof MoldeaCliOutputPageException) translatedCursorCause = error.cause;\n throw error;\n } finally {\n await inspection.dispose().catch((error: unknown) => {\n // Core repeats a terminal page failure during disposal. Keep the CLI cursor error.\n if (translatedCursorCause === undefined || error !== translatedCursorCause) throw error;\n });\n }\n };\n\n/**\n * Executes one project inspection through the isolated CLI-configured Node boundary.\n * @returns A promise resolving to Core's complete immutable inspection result.\n * @throws\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - CURSOR_INVALID: The continuation cursor is invalid for this request.\n * - CURSOR_SNAPSHOT_CHANGED: The continuation cursor belongs to a different repository snapshot.\n * - INVALID_REPOSITORY_PATH: The repository path is invalid.\n * - ENTRY_NOT_FOUND: The requested repository entry was not found.\n * - ENTRY_NOT_FILE: The requested repository entry is not a file.\n * - ENTRY_NOT_DIRECTORY: The requested repository entry is not a directory.\n * - INVALID_PAGE_REQUEST: The repository page request is invalid.\n * - ACCESS_DENIED: Access to the repository source was denied.\n * - SOURCE_UNAVAILABLE: The repository source is unavailable.\n * - SNAPSHOT_CHANGED: The repository snapshot changed during the operation.\n * - PROVIDER_INCOMPLETE: The repository provider cannot expose a complete result.\n * - INVALID_SOURCE_DATA: The repository source returned invalid data.\n * - RESOURCE_LIMIT_EXCEEDED: A named repository resource limit was exceeded.\n * - RESOURCE_LIMIT_EXCEEDED: A Core resource limit was exceeded.\n * - ABORTED: The repository operation was aborted.\n * - ABORTED: The Core operation was aborted.\n * - INSPECTION_BUSY: Project inspection capacity is busy. Try again shortly.\n * - INSPECTION_TIMEOUT: The isolated project inspection timed out.\n * - INSPECTION_PROCESS_FAILED: The isolated project inspection failed.\n * - COMPOSITION_STATE_INVALID: The installed composition state is invalid.\n */\nexport const executeMoldeaCliCoreInspection = createMoldeaCliCoreInspectionExecutor();\n"],"mappings":";;;;;AAYA,IAAM,oBAAoB;;;;;;;;AAS1B,IAAa,2BAA2B,OACtC,YACA,UACA,WACuC;CACvC,MAAM,EAAE,QAAQ,gBAAgB,eAAe,kBAAkB,UAAU;CAC3E,MAAM,aAAa,OAAO,WAAW,OAAO;CAC5C,MAAM,aAAa,WAAW,KAAA,IAAY,KAAK,OAAO,SAAS,OAAO,SAAS,EAAE;CACjF,MAAM,aAAa,aAAa;CAChC,IAAI,eAAe,QAAQ,gBAAgB;CAE3C,IAAI,WAAW,KAAA,GAAW;EACxB,IAAI,OAAO,mBAAmB,kBAC5B,MAAM,IAAI,6BAA6B,yBAAyB;EAElE,IACE,CAAC,OAAO,cAAc,UAAU,KAChC,aAAa,KACb,yBAAyB,UAAU,MAAM,OAAO,WAChD,cAAc,cACd,iBAAiB,QAChB,iBAAiB,uB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;IAC3C,CAAC;IACD,KAAK,MAAM,EAAE,UAAU,OAAO,KAAK,SACjC,IAAI,KAAK,SAAS,cAAc,YAAY,KAAK,KAAK,UAAU;SAC3D,IAAI,KAAK,SAAS,YAAY,SAAS,KAAK,KAAK,QAAQ;IAEhE,SAAS,OAAO,KAAK,cAAc,KAAA;GACrC,SAAS,WAAW,KAAA;EACtB;EACA,OAAO,OAAO,OAAO;GACnB,aAAa,OAAO,OAAO,WAAW;GACtC,UAAU,OAAO,OAAO,QAAQ;GAChC,gBAAgB,WAAW;GAC3B,iBAAiB,WAAW,OAAO;GACnC,sBAAsB,WAAW,OAAO;GACxC,YAAY,WAAW,OAAO;GAC9B,cAAc,WAAW,OAAO;GAChC,OAAO,WAAW;GAClB,eAAe,WAAW;GAC1B,QAAQ,WAAW;GACnB,SAAS,WAAW;EACtB,CAAoC;CACtC,SAAS,OAAO;EACd,IAAI,iBAAiB,8BAA8B,wBAAwB,MAAM;EACjF,MAAM;CACR,UAAU;EACR,MAAM,WAAW,QAAQ,CAAC,CAAC,OAAO,UAAmB;GAEnD,IAAI,0BAA0B,KAAA,KAAa,UAAU,uBAAuB,MAAM;EACpF,CAAC;CACH;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BF,IAAa,iCAAiC,sCAAsC"}
|
package/dist/moldea.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as createMoldeaCliRecordKey, C as formatMoldeaCliJsonInspectResult, D as parseMoldeaCliArguments, E as createMoldeaCliOwnedError, F as MOLDEA_CLI_COMMANDS, M as decodeMoldeaCliCursor, N as encodeMoldeaCliCursor, O as isRepositoryDirectoryInputValid, P as MoldeaCliOutputPageException, S as formatMoldeaCliJsonError, T as formatMoldeaCliJsonValidateResult, _ as formatMoldeaCliHumanInspectResult, a as require_semver, b as formatMoldeaCliJsonCompositionResult, c as runGitCommand, d as createMoldeaCliInspectProjection, f as createMoldeaCliValidateProjection, g as formatMoldeaCliHumanError, h as formatMoldeaCliHumanContentResult, j as calculateMoldeaCliJsonDigest, k as createMoldeaCliOutputPage, l as readGit, m as formatMoldeaCliHumanCompositionResult, o as MoldeaCliCompositionException, p as formatMoldeaCliHelp, s as createGitVersionPreflight, u as createMoldeaCliDiagnosticRecord, v as formatMoldeaCliHumanScopeResult, w as formatMoldeaCliJsonScopeResult, x as formatMoldeaCliJsonContentResult, y as formatMoldeaCliHumanValidateResult } from "./chunks/composition-DymbbpSr.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -595,43 +595,61 @@ var createMoldeaCliProjectScopeExecutor = (coreFactory = createCore) => {
|
|
|
595
595
|
var executeMoldeaCliProjectScope = createMoldeaCliProjectScopeExecutor();
|
|
596
596
|
//#endregion
|
|
597
597
|
//#region src/project-scope/transformers.ts
|
|
598
|
-
var
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
"match",
|
|
602
|
-
match.owner.kind,
|
|
603
|
-
match.owner.agentId,
|
|
604
|
-
match.owner.id,
|
|
605
|
-
match.field,
|
|
606
|
-
match.declaration.kind === "exact" ? match.declaration.path : match.declaration.pattern,
|
|
607
|
-
match.inputPath,
|
|
608
|
-
match.pointer
|
|
609
|
-
]);
|
|
610
|
-
/** Projects complete Core scope output into ordered content-free CLI records. */
|
|
598
|
+
var compareText = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
599
|
+
var getOwnerPath = ({ kind, id, agentId }) => kind === "context" || kind === "decision" ? id : `/moldea/agents/${agentId ?? id}/instruction.md`;
|
|
600
|
+
/** Projects all Core matches into one row per owner and one entry per matched declaration. */
|
|
611
601
|
var createMoldeaCliScopeProjection = (execution) => {
|
|
612
|
-
const
|
|
613
|
-
|
|
602
|
+
const { scope } = execution;
|
|
603
|
+
const owners = /* @__PURE__ */ new Map();
|
|
604
|
+
for (const { owner, field, declaration } of scope.matches) {
|
|
605
|
+
const ownerKey = JSON.stringify([
|
|
606
|
+
owner.kind,
|
|
607
|
+
owner.agentId,
|
|
608
|
+
owner.id
|
|
609
|
+
]);
|
|
610
|
+
let group = owners.get(ownerKey);
|
|
611
|
+
if (group === void 0) {
|
|
612
|
+
group = {
|
|
613
|
+
owner,
|
|
614
|
+
path: getOwnerPath(owner),
|
|
615
|
+
relationships: /* @__PURE__ */ new Map()
|
|
616
|
+
};
|
|
617
|
+
owners.set(ownerKey, group);
|
|
618
|
+
}
|
|
619
|
+
const path = declaration.kind === "exact" ? declaration.path : declaration.pattern;
|
|
620
|
+
const relationshipKey = JSON.stringify([field, path]);
|
|
621
|
+
if (!group.relationships.has(relationshipKey)) group.relationships.set(relationshipKey, {
|
|
622
|
+
field,
|
|
623
|
+
path
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
const diagnostics = scope.diagnostics.map(createMoldeaCliDiagnosticRecord);
|
|
627
|
+
const matches = [...owners.values()].sort((left, right) => compareText(left.path, right.path) || compareText(left.owner.kind, right.owner.kind) || compareText(left.owner.id, right.owner.id)).map(({ owner, path, relationships }, index) => ({
|
|
628
|
+
key: createMoldeaCliRecordKey(diagnostics.length + index),
|
|
614
629
|
kind: "match",
|
|
615
|
-
|
|
616
|
-
|
|
630
|
+
path,
|
|
631
|
+
ownerKind: owner.kind,
|
|
632
|
+
...owner.kind === "tool" || owner.kind === "skill" ? { capabilityId: owner.id } : {},
|
|
633
|
+
relationships: [...relationships.values()].sort((left, right) => compareText(left.field, right.field) || compareText(left.path, right.path))
|
|
634
|
+
}));
|
|
635
|
+
const records = Object.freeze([...diagnostics, ...matches]);
|
|
617
636
|
const snapshotDigest = calculateMoldeaCliJsonDigest({
|
|
618
|
-
inputDigest:
|
|
619
|
-
manifestDigest:
|
|
637
|
+
inputDigest: scope.inputDigest,
|
|
638
|
+
manifestDigest: scope.manifestDigest,
|
|
620
639
|
records,
|
|
621
|
-
valid:
|
|
640
|
+
valid: scope.valid
|
|
622
641
|
});
|
|
623
642
|
return Object.freeze({
|
|
624
643
|
canonicalBodies: Object.freeze([execution.manifestContent]),
|
|
625
644
|
counts: Object.freeze({
|
|
626
|
-
...
|
|
627
|
-
diagnostics:
|
|
645
|
+
...scope.counts,
|
|
646
|
+
diagnostics: scope.diagnostics.length
|
|
628
647
|
}),
|
|
629
|
-
inputDigest:
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
relevant: execution.scope.relevant,
|
|
648
|
+
inputDigest: scope.inputDigest,
|
|
649
|
+
records,
|
|
650
|
+
relevant: scope.relevant,
|
|
633
651
|
snapshotDigest,
|
|
634
|
-
valid:
|
|
652
|
+
valid: scope.valid
|
|
635
653
|
});
|
|
636
654
|
};
|
|
637
655
|
//#endregion
|
|
@@ -2472,8 +2490,6 @@ var createMoldeaCliValidateExecutionResult = (inspection, cliVersion, isJson, cu
|
|
|
2472
2490
|
errorCount: projection.errorCount,
|
|
2473
2491
|
formatVersion: projection.formatVersion,
|
|
2474
2492
|
page,
|
|
2475
|
-
snapshotDigest: projection.snapshotDigest,
|
|
2476
|
-
source: projection.source,
|
|
2477
2493
|
coverageCounts: projection.coverageCounts,
|
|
2478
2494
|
valid: projection.valid,
|
|
2479
2495
|
warningCount: projection.warningCount
|
|
@@ -2508,12 +2524,8 @@ var createMoldeaCliInspectExecutionResult = (inspection, cliVersion, isJson, cur
|
|
|
2508
2524
|
counts: projection.counts,
|
|
2509
2525
|
formatVersion: projection.formatVersion,
|
|
2510
2526
|
page,
|
|
2511
|
-
project: projection.project,
|
|
2512
|
-
snapshotDigest: projection.snapshotDigest,
|
|
2513
|
-
source: projection.source,
|
|
2514
2527
|
coverageCounts: projection.coverageCounts,
|
|
2515
|
-
valid: projection.valid
|
|
2516
|
-
view: projection.view
|
|
2528
|
+
valid: projection.valid
|
|
2517
2529
|
});
|
|
2518
2530
|
const page = createMoldeaCliOutputPage({
|
|
2519
2531
|
command: "inspect",
|
|
@@ -2544,12 +2556,8 @@ var createMoldeaCliScopeExecutionResult = (execution, cliVersion, isJson, cursor
|
|
|
2544
2556
|
const projection = createMoldeaCliScopeProjection(execution);
|
|
2545
2557
|
const createResult = (page) => ({
|
|
2546
2558
|
counts: projection.counts,
|
|
2547
|
-
inputDigest: projection.inputDigest,
|
|
2548
|
-
manifestDigest: projection.manifestDigest,
|
|
2549
2559
|
page,
|
|
2550
2560
|
relevant: projection.relevant,
|
|
2551
|
-
snapshotDigest: projection.snapshotDigest,
|
|
2552
|
-
source: MOLDEA_CLI_GIT_WORKING_TREE_SOURCE,
|
|
2553
2561
|
valid: projection.valid
|
|
2554
2562
|
});
|
|
2555
2563
|
const page = createMoldeaCliOutputPage({
|
|
@@ -2593,11 +2601,11 @@ var createMoldeaCliContentExecutionResult = (pageResult, cliVersion, isJson, cur
|
|
|
2593
2601
|
//#region src/cli-execution/command-executor.ts
|
|
2594
2602
|
/** Loads isolated Core inspection only for commands that need it. */
|
|
2595
2603
|
var executeLazyCoreInspection = async (input) => {
|
|
2596
|
-
const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-
|
|
2604
|
+
const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-DhjRyNO7.js");
|
|
2597
2605
|
return executeMoldeaCliCoreInspection(input);
|
|
2598
2606
|
};
|
|
2599
2607
|
var loadInstalledComposition = async (input) => {
|
|
2600
|
-
const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-
|
|
2608
|
+
const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-B4GH4Nqy.js");
|
|
2601
2609
|
return resolveInstalledMoldeaCliComposition(input);
|
|
2602
2610
|
};
|
|
2603
2611
|
/** Creates one operational error result without exposing caught failure details. */
|
|
@@ -2610,7 +2618,7 @@ var createOperationalErrorResult = (code, input, details) => createMoldeaCliErro
|
|
|
2610
2618
|
* @param compositionLoader The installed executable-integrity composition boundary.
|
|
2611
2619
|
* @param projectScopeExecutor The manifest-only manifest scope operation.
|
|
2612
2620
|
* @param projectContentExecutor The manifest-only canonical content operation.
|
|
2613
|
-
* @returns A command executor for the schema
|
|
2621
|
+
* @returns A command executor for the schema 9 CLI.
|
|
2614
2622
|
*/
|
|
2615
2623
|
var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingTree, workingTreeSnapshotExecutor = executeWorkingTreeSnapshot, coreInspectionExecutor = executeLazyCoreInspection, compositionLoader = loadInstalledComposition, projectScopeExecutor = executeMoldeaCliProjectScope, projectContentExecutor = executeMoldeaCliProjectContent) => {
|
|
2616
2624
|
return async (input) => {
|
|
@@ -2632,7 +2640,7 @@ var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingT
|
|
|
2632
2640
|
command: "inspect",
|
|
2633
2641
|
cursor: options.cursor,
|
|
2634
2642
|
filters: {}
|
|
2635
|
-
})
|
|
2643
|
+
}) : null;
|
|
2636
2644
|
if (command === MOLDEA_CLI_COMMANDS.Scope) {
|
|
2637
2645
|
if (options.pathsInput === "path" && options.path !== null) scopePaths = Object.freeze([options.path]);
|
|
2638
2646
|
else if (options.pathsInput === "stdin" && input.stdin !== void 0) {
|