@dailephd/my-dev-kit-lab 0.4.2 → 0.4.3
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 +23 -113
- package/benchmarks/contracts/todo-behavior.md +1 -1
- package/benchmarks/projects/task-analytics-large-mixed/README.md +2 -0
- package/benchmarks/projects/task-workflow-medium-ts/README.md +3 -1
- package/dist/src/evaluation/stageContextDeterminism/calculateStageContextDeterminism.js +52 -0
- package/dist/src/evaluation/stageContextDeterminism/canonicalizeStageContextRun.js +53 -0
- package/dist/src/evaluation/stageContextDeterminism/index.js +2 -0
- package/dist/src/evaluation/stageContextDeterminism/types.js +1 -0
- package/dist/src/evaluation/stageContextExpectations/index.js +2 -0
- package/dist/src/evaluation/stageContextExpectations/readStageContextExpectationFixtureV1.js +50 -0
- package/dist/src/evaluation/stageContextExpectations/readTypes.js +1 -0
- package/dist/src/evaluation/stageContextExpectations/types.js +1 -0
- package/dist/src/evaluation/stageContextExpectations/validation.js +568 -0
- package/dist/src/evaluation/stageContextMetrics/calculateArtifactStateMetrics.js +130 -0
- package/dist/src/evaluation/stageContextMetrics/calculateContextSizeMetrics.js +85 -0
- package/dist/src/evaluation/stageContextMetrics/calculateExpectationMetrics.js +103 -0
- package/dist/src/evaluation/stageContextMetrics/calculateResponsibilityMappingMetrics.js +36 -0
- package/dist/src/evaluation/stageContextMetrics/collectContextCapsuleEvidence.js +312 -0
- package/dist/src/evaluation/stageContextMetrics/collectRetrievalAuditEvidence.js +35 -0
- package/dist/src/evaluation/stageContextMetrics/collectWorkflowInstructionEvidence.js +137 -0
- package/dist/src/evaluation/stageContextMetrics/evaluateV043StageContextExecution.js +247 -0
- package/dist/src/evaluation/stageContextMetrics/index.js +10 -0
- package/dist/src/evaluation/stageContextMetrics/matchStageContextExpectations.js +38 -0
- package/dist/src/evaluation/stageContextMetrics/targetKeys.js +35 -0
- package/dist/src/evaluation/stageContextMetrics/types.js +1 -0
- package/dist/src/evaluation/stageContextSelectors/contextArtifactConsistency.js +79 -0
- package/dist/src/evaluation/stageContextSelectors/contextCapsuleSelectors.js +126 -0
- package/dist/src/evaluation/stageContextSelectors/index.js +4 -0
- package/dist/src/evaluation/stageContextSelectors/retrievalAuditRecordSelectors.js +54 -0
- package/dist/src/evaluation/stageContextSelectors/workflowInstructionPacketSelectors.js +51 -0
- package/dist/src/evaluation/targetImmutability/captureTargetSnapshot.js +208 -0
- package/dist/src/evaluation/targetImmutability/compareTargetSnapshots.js +56 -0
- package/dist/src/evaluation/targetImmutability/index.js +3 -0
- package/dist/src/evaluation/targetImmutability/types.js +1 -0
- package/dist/src/evaluation/targetImmutability/validateTargetImmutabilityConfig.js +130 -0
- package/dist/src/evaluation/upstreamArtifacts/artifactReadTypes.js +1 -0
- package/dist/src/evaluation/upstreamArtifacts/index.js +3 -0
- package/dist/src/evaluation/upstreamArtifacts/jsonTypes.js +1 -0
- package/dist/src/evaluation/upstreamArtifacts/myDevKitClassificationTypesV1.js +1 -0
- package/dist/src/evaluation/upstreamArtifacts/myDevKitContextArtifactsV1.js +1 -0
- package/dist/src/evaluation/upstreamArtifacts/myDevKitSemanticTypesV1.js +1 -0
- package/dist/src/evaluation/upstreamArtifacts/orchestratorWorkflowInstructionPacketV1.js +1 -0
- package/dist/src/evaluation/upstreamArtifacts/readJsonArtifact.js +53 -0
- package/dist/src/evaluation/upstreamArtifacts/readMyDevKitContextCapsuleV1.js +9 -0
- package/dist/src/evaluation/upstreamArtifacts/readMyDevKitRetrievalAuditRecordV1.js +9 -0
- package/dist/src/evaluation/upstreamArtifacts/readOrchestratorWorkflowInstructionPacketV1.js +9 -0
- package/dist/src/evaluation/upstreamArtifacts/runtimeValidation.js +131 -0
- package/dist/src/evaluation/upstreamArtifacts/schemaVersion.js +32 -0
- package/dist/src/evaluation/upstreamArtifacts/validateMyDevKitContextCapsuleV1.js +1208 -0
- package/dist/src/evaluation/upstreamArtifacts/validateMyDevKitRetrievalAuditRecordV1.js +105 -0
- package/dist/src/evaluation/upstreamArtifacts/validateOrchestratorWorkflowInstructionPacketV1.js +235 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/executeV043StageContextStrategy.js +46 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/index.js +9 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/loadV043StrategyArtifacts.js +286 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/plugin.js +39 -1
- package/dist/src/experiments/plugins/contextStrategyComparison/readV043FullWorkflowLibraryFixture.js +162 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/resolveV043StrategyInputs.js +43 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/resultMapping.js +3 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/runV043StageContextStrategyWithAssurance.js +190 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/v043FullWorkflowLibraryFixture.js +1 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/v043RunAssuranceTypes.js +1 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/v043StrategyExecutionTypes.js +1 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/v043StrategyIds.js +13 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/v043StrategyInputContracts.js +1 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/validateV043RunAssuranceConfig.js +59 -0
- package/dist/src/experiments/plugins/contextStrategyComparison/validateV043StrategyInput.js +252 -0
- package/dist/src/report/experiments/buildContextStrategyComparisonV043Report.js +398 -0
- package/dist/src/report/experiments/buildPluginExperimentReport.js +21 -6
- package/dist/src/report/experiments/contextStrategyComparisonV043ReportModel.js +1 -0
- package/dist/src/report/experiments/index.js +4 -0
- package/dist/src/report/experiments/renderContextStrategyComparisonV043Html.js +234 -0
- package/dist/src/report/experiments/renderPluginExperimentReportHtml.js +3 -0
- package/dist/src/report/experiments/renderPluginExperimentReportText.js +225 -0
- package/dist/src/report/experiments/writePluginExperimentReports.js +3 -0
- package/dist/src/securityValidation/attackScenarios/scenarios/secretLeakageScenario.js +215 -9
- package/docs/METRICS.md +56 -10
- package/package.json +1 -1
- package/tests/fixtures/full-workflow-library/complete-v1.0.0.json +24 -0
- package/tests/fixtures/full-workflow-library/future-minor-v1.1.0-additive.json +25 -0
- package/tests/fixtures/stage-context-expectations/complete-v1.0.0.json +230 -0
- package/tests/fixtures/stage-context-expectations/future-minor-v1.1.0-additive.json +232 -0
- package/tests/fixtures/stage-context-expectations/invalid/malformed-json.txt +1 -0
- package/tests/fixtures/stage-context-expectations/invalid/non-object-root.json +1 -0
- package/tests/fixtures/stage-context-expectations/minimal-v1.0.0.json +18 -0
- package/tests/fixtures/upstream-artifacts/invalid/malformed-json.txt +1 -0
- package/tests/fixtures/upstream-artifacts/invalid/non-object-root.json +1 -0
- package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/context-capsule/complete-v1.0.0.json +504 -0
- package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/context-capsule/future-minor-v1.1.0-additive.json +955 -0
- package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/retrieval-audit-record/complete-v1.0.0.json +190 -0
- package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/retrieval-audit-record/future-minor-v1.1.0-additive.json +327 -0
- package/tests/fixtures/upstream-artifacts/my-dev-kit-orchestrator/1.2.1/workflow-instruction-packet/complete-v1.0.0.json +160 -0
- package/tests/fixtures/upstream-artifacts/my-dev-kit-orchestrator/1.2.1/workflow-instruction-packet/future-minor-v1.1.0-additive.json +186 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
export async function readJsonArtifactFile(artifactKind, sourcePathInput) {
|
|
4
|
+
const sourcePath = path.resolve(sourcePathInput);
|
|
5
|
+
let raw;
|
|
6
|
+
try {
|
|
7
|
+
raw = await readFile(sourcePath, "utf8");
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
const code = error.code;
|
|
11
|
+
if (code === "ENOENT") {
|
|
12
|
+
return {
|
|
13
|
+
ok: false,
|
|
14
|
+
artifactKind,
|
|
15
|
+
sourcePath,
|
|
16
|
+
code: "FILE_NOT_FOUND",
|
|
17
|
+
message: `Artifact "${artifactKind}" file was not found at "${sourcePath}".`
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
ok: false,
|
|
22
|
+
artifactKind,
|
|
23
|
+
sourcePath,
|
|
24
|
+
code: "UNREADABLE_FILE",
|
|
25
|
+
message: `Artifact "${artifactKind}" file at "${sourcePath}" could not be read: ${error.message}`
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = JSON.parse(raw);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return {
|
|
34
|
+
ok: false,
|
|
35
|
+
artifactKind,
|
|
36
|
+
sourcePath,
|
|
37
|
+
code: "MALFORMED_JSON",
|
|
38
|
+
message: `Artifact "${artifactKind}" file at "${sourcePath}" is not valid JSON: ${error.message}`
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
42
|
+
return {
|
|
43
|
+
ok: false,
|
|
44
|
+
artifactKind,
|
|
45
|
+
sourcePath,
|
|
46
|
+
code: "NON_OBJECT_ROOT",
|
|
47
|
+
message: `Artifact "${artifactKind}" file at "${sourcePath}" must parse to a JSON object at the root.`,
|
|
48
|
+
expected: "object",
|
|
49
|
+
actual: parsed
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return { ok: true, sourcePath, value: parsed };
|
|
53
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { readJsonArtifactFile } from "./readJsonArtifact.js";
|
|
2
|
+
import { validateMyDevKitContextCapsuleV1 } from "./validateMyDevKitContextCapsuleV1.js";
|
|
3
|
+
const ARTIFACT_KIND = "my-dev-kit-context-capsule-v1";
|
|
4
|
+
export async function readMyDevKitContextCapsuleV1(sourcePath) {
|
|
5
|
+
const loaded = await readJsonArtifactFile(ARTIFACT_KIND, sourcePath);
|
|
6
|
+
if (!loaded.ok)
|
|
7
|
+
return loaded;
|
|
8
|
+
return validateMyDevKitContextCapsuleV1(loaded.value, loaded.sourcePath);
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { readJsonArtifactFile } from "./readJsonArtifact.js";
|
|
2
|
+
import { validateMyDevKitRetrievalAuditRecordV1 } from "./validateMyDevKitRetrievalAuditRecordV1.js";
|
|
3
|
+
const ARTIFACT_KIND = "my-dev-kit-retrieval-audit-record-v1";
|
|
4
|
+
export async function readMyDevKitRetrievalAuditRecordV1(sourcePath) {
|
|
5
|
+
const loaded = await readJsonArtifactFile(ARTIFACT_KIND, sourcePath);
|
|
6
|
+
if (!loaded.ok)
|
|
7
|
+
return loaded;
|
|
8
|
+
return validateMyDevKitRetrievalAuditRecordV1(loaded.value, loaded.sourcePath);
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { readJsonArtifactFile } from "./readJsonArtifact.js";
|
|
2
|
+
import { validateOrchestratorWorkflowInstructionPacketV1 } from "./validateOrchestratorWorkflowInstructionPacketV1.js";
|
|
3
|
+
const ARTIFACT_KIND = "orchestrator-workflow-instruction-packet-v1";
|
|
4
|
+
export async function readOrchestratorWorkflowInstructionPacketV1(sourcePath) {
|
|
5
|
+
const loaded = await readJsonArtifactFile(ARTIFACT_KIND, sourcePath);
|
|
6
|
+
if (!loaded.ok)
|
|
7
|
+
return loaded;
|
|
8
|
+
return validateOrchestratorWorkflowInstructionPacketV1(loaded.value, loaded.sourcePath);
|
|
9
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export function joinFieldPath(parent, child) {
|
|
2
|
+
return parent.length === 0 ? child : `${parent}.${child}`;
|
|
3
|
+
}
|
|
4
|
+
export function arrayFieldPath(parent, index) {
|
|
5
|
+
return `${parent}[${index}]`;
|
|
6
|
+
}
|
|
7
|
+
export function makeFailure(artifactKind, sourcePath, code, message, fieldPath, expected, actual) {
|
|
8
|
+
return { ok: false, artifactKind, sourcePath, code, message, fieldPath, expected, actual };
|
|
9
|
+
}
|
|
10
|
+
export class ArtifactValidationError extends Error {
|
|
11
|
+
failure;
|
|
12
|
+
constructor(failure) {
|
|
13
|
+
super(failure.message);
|
|
14
|
+
this.failure = failure;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function fail(artifactKind, sourcePath, code, message, fieldPath, expected, actual) {
|
|
18
|
+
throw new ArtifactValidationError(makeFailure(artifactKind, sourcePath, code, message, fieldPath, expected, actual));
|
|
19
|
+
}
|
|
20
|
+
export function requiredField(ctx, obj, key, fieldPath) {
|
|
21
|
+
if (!(key in obj)) {
|
|
22
|
+
fail(ctx.artifactKind, ctx.sourcePath, "MISSING_REQUIRED_FIELD", `Artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" is missing required field "${fieldPath}".`, fieldPath, "present");
|
|
23
|
+
}
|
|
24
|
+
return obj[key];
|
|
25
|
+
}
|
|
26
|
+
export function optionalField(obj, key) {
|
|
27
|
+
return key in obj ? obj[key] : undefined;
|
|
28
|
+
}
|
|
29
|
+
export function requiredObject(ctx, value, fieldPath) {
|
|
30
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
31
|
+
fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be an object.`, fieldPath, "object", value);
|
|
32
|
+
}
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
export function requiredString(ctx, value, fieldPath) {
|
|
36
|
+
if (typeof value !== "string") {
|
|
37
|
+
fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be a string.`, fieldPath, "string", value);
|
|
38
|
+
}
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
export function optionalString(ctx, value, fieldPath) {
|
|
42
|
+
if (value === undefined)
|
|
43
|
+
return undefined;
|
|
44
|
+
return requiredString(ctx, value, fieldPath);
|
|
45
|
+
}
|
|
46
|
+
export function requiredNullableString(ctx, value, fieldPath) {
|
|
47
|
+
if (value === null)
|
|
48
|
+
return null;
|
|
49
|
+
return requiredString(ctx, value, fieldPath);
|
|
50
|
+
}
|
|
51
|
+
export function optionalNullableString(ctx, value, fieldPath) {
|
|
52
|
+
if (value === undefined)
|
|
53
|
+
return undefined;
|
|
54
|
+
return requiredNullableString(ctx, value, fieldPath);
|
|
55
|
+
}
|
|
56
|
+
export function requiredBoolean(ctx, value, fieldPath) {
|
|
57
|
+
if (typeof value !== "boolean") {
|
|
58
|
+
fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be a boolean.`, fieldPath, "boolean", value);
|
|
59
|
+
}
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
export function optionalBoolean(ctx, value, fieldPath) {
|
|
63
|
+
if (value === undefined)
|
|
64
|
+
return undefined;
|
|
65
|
+
return requiredBoolean(ctx, value, fieldPath);
|
|
66
|
+
}
|
|
67
|
+
export function requiredNumber(ctx, value, fieldPath) {
|
|
68
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
69
|
+
fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be a finite number.`, fieldPath, "number", value);
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
export function optionalNumber(ctx, value, fieldPath) {
|
|
74
|
+
if (value === undefined)
|
|
75
|
+
return undefined;
|
|
76
|
+
return requiredNumber(ctx, value, fieldPath);
|
|
77
|
+
}
|
|
78
|
+
export function requiredNullableNumber(ctx, value, fieldPath) {
|
|
79
|
+
if (value === null)
|
|
80
|
+
return null;
|
|
81
|
+
return requiredNumber(ctx, value, fieldPath);
|
|
82
|
+
}
|
|
83
|
+
export function requiredNonnegativeInteger(ctx, value, fieldPath) {
|
|
84
|
+
const n = requiredNumber(ctx, value, fieldPath);
|
|
85
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
86
|
+
fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be a nonnegative integer.`, fieldPath, "nonnegative integer", value);
|
|
87
|
+
}
|
|
88
|
+
return n;
|
|
89
|
+
}
|
|
90
|
+
export function requiredLiteral(ctx, value, fieldPath, allowed) {
|
|
91
|
+
const str = requiredString(ctx, value, fieldPath);
|
|
92
|
+
if (!allowed.includes(str)) {
|
|
93
|
+
fail(ctx.artifactKind, ctx.sourcePath, "INVALID_LITERAL_VALUE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" has invalid value "${str}". Expected one of: ${allowed.join(", ")}.`, fieldPath, allowed.join(" | "), str);
|
|
94
|
+
}
|
|
95
|
+
return str;
|
|
96
|
+
}
|
|
97
|
+
export function optionalLiteral(ctx, value, fieldPath, allowed) {
|
|
98
|
+
if (value === undefined)
|
|
99
|
+
return undefined;
|
|
100
|
+
return requiredLiteral(ctx, value, fieldPath, allowed);
|
|
101
|
+
}
|
|
102
|
+
export function requiredNullableLiteral(ctx, value, fieldPath, allowed) {
|
|
103
|
+
if (value === null)
|
|
104
|
+
return null;
|
|
105
|
+
return requiredLiteral(ctx, value, fieldPath, allowed);
|
|
106
|
+
}
|
|
107
|
+
export function requiredArray(ctx, value, fieldPath) {
|
|
108
|
+
if (!Array.isArray(value)) {
|
|
109
|
+
fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be an array.`, fieldPath, "array", value);
|
|
110
|
+
}
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
113
|
+
export function requiredStringArray(ctx, value, fieldPath) {
|
|
114
|
+
const arr = requiredArray(ctx, value, fieldPath);
|
|
115
|
+
return arr.map((item, index) => requiredString(ctx, item, arrayFieldPath(fieldPath, index)));
|
|
116
|
+
}
|
|
117
|
+
export function requiredRecord(ctx, value, fieldPath) {
|
|
118
|
+
return requiredObject(ctx, value, fieldPath);
|
|
119
|
+
}
|
|
120
|
+
export function requiredScalarLike(ctx, value, fieldPath) {
|
|
121
|
+
if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
122
|
+
return value;
|
|
123
|
+
}
|
|
124
|
+
fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be a string, number, boolean, or null.`, fieldPath, "string | number | boolean | null", value);
|
|
125
|
+
}
|
|
126
|
+
export function requiredScalarOrStringArrayLike(ctx, value, fieldPath) {
|
|
127
|
+
if (Array.isArray(value)) {
|
|
128
|
+
return value.map((item, index) => requiredString(ctx, item, arrayFieldPath(fieldPath, index)));
|
|
129
|
+
}
|
|
130
|
+
return requiredScalarLike(ctx, value, fieldPath);
|
|
131
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const SCHEMA_VERSION_PATTERN = /^[0-9]+\.[0-9]+\.[0-9]+$/;
|
|
2
|
+
export function parseSupportedMajorOneSchemaVersion(value, artifactKind, sourcePath, fieldPath = "schemaVersion") {
|
|
3
|
+
if (typeof value !== "string" || !SCHEMA_VERSION_PATTERN.test(value)) {
|
|
4
|
+
return {
|
|
5
|
+
ok: false,
|
|
6
|
+
artifactKind,
|
|
7
|
+
sourcePath,
|
|
8
|
+
code: "INVALID_SCHEMA_VERSION",
|
|
9
|
+
message: `Artifact "${artifactKind}" at "${sourcePath}" has an invalid "${fieldPath}": expected strict "x.y.z" semantic version.`,
|
|
10
|
+
fieldPath,
|
|
11
|
+
expected: "^[0-9]+\\.[0-9]+\\.[0-9]+$",
|
|
12
|
+
actual: value
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const [majorText, minorText, patchText] = value.split(".");
|
|
16
|
+
const major = Number(majorText);
|
|
17
|
+
const minor = Number(minorText);
|
|
18
|
+
const patch = Number(patchText);
|
|
19
|
+
if (major !== 1) {
|
|
20
|
+
return {
|
|
21
|
+
ok: false,
|
|
22
|
+
artifactKind,
|
|
23
|
+
sourcePath,
|
|
24
|
+
code: "UNSUPPORTED_SCHEMA_MAJOR",
|
|
25
|
+
message: `Artifact "${artifactKind}" at "${sourcePath}" has unsupported schema major "${major}" in "${fieldPath}": supported major is 1.`,
|
|
26
|
+
fieldPath,
|
|
27
|
+
expected: "1",
|
|
28
|
+
actual: value
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return { version: value, major: 1, minor, patch };
|
|
32
|
+
}
|