@openplanr/protocol 0.6.1 → 0.6.2
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/lib/dashboard/closed-json-contract.mjs +99 -109
- package/lib/dashboard/operate-experience-audit-display-contract.d.mts +128 -153
- package/lib/dashboard/operate-experience-audit-display-contract.mjs +530 -585
- package/lib/dashboard/operate-experience-display-contract.d.mts +415 -437
- package/lib/dashboard/operate-experience-display-contract.mjs +768 -831
- package/lib/dashboard/operate-experience-surface-contract.d.mts +143 -148
- package/lib/dashboard/operate-experience-surface-contract.mjs +72 -73
- package/lib/dashboard/operate-review-contract.d.mts +7 -14
- package/lib/dashboard/operate-review-contract.mjs +46 -42
- package/lib/dashboard/operate-review-display-workspace-contract.d.mts +2 -5
- package/lib/dashboard/operate-review-display-workspace-contract.mjs +158 -104
- package/lib/dashboard/operate-review-payload-safety.mjs +4 -2
- package/lib/dashboard/operate-review-workspace-projection-v2.d.mts +47 -33
- package/lib/protocol/index.d.ts +2647 -543
- package/package.json +1 -1
- package/registries/commands.json +3 -3
- package/registries/skills.json +5 -5
- package/src/browser-contracts.d.mts +4 -1
- package/src/browser-contracts.mjs +16 -5
- package/src/canonical-json.d.mts +3 -1
- package/src/canonical-json.mjs +57 -20
- package/src/compat/live-evidence-v2.mjs +1604 -485
- package/src/compat/operate-experience-live-patch.mjs +67 -15
- package/src/compat/operating-planning-contracts.mjs +183 -51
- package/src/contracts.d.mts +54 -13
- package/src/contracts.mjs +625 -335
- package/src/design-contracts.mjs +58 -21
- package/src/design-handoff-contracts.d.mts +67 -11
- package/src/design-handoff-contracts.mjs +243 -98
- package/src/design-publication-contracts.mjs +98 -33
- package/src/diagram-authoring-contracts.d.mts +422 -78
- package/src/diagram-authoring-contracts.mjs +1697 -326
- package/src/diagram-contracts.d.mts +4 -1
- package/src/diagram-contracts.mjs +16 -4
- package/src/enterprise-contracts.d.mts +211 -46
- package/src/enterprise-contracts.mjs +727 -175
- package/src/errors.mjs +4 -0
- package/src/generated/canonical-registries.mjs +8 -8
- package/src/index.d.mts +8 -8
- package/src/index.mjs +36 -20
- package/src/json-schema.d.mts +21 -6
- package/src/json-schema.mjs +66 -18
- package/src/planning-contracts.d.mts +8 -2
- package/src/planning-contracts.mjs +33 -7
- package/src/registries.d.mts +11 -3
- package/src/registries.mjs +369 -87
- package/src/review-experience-contracts.d.mts +7 -2
- package/src/review-experience-contracts.mjs +198 -49
- package/src/semver.mjs +5 -1
- package/src/skill-source-contracts.d.mts +36 -16
- package/src/skill-source-contracts.mjs +25 -6
- package/src/task-contracts.d.mts +13 -3
- package/src/task-contracts.mjs +181 -40
- package/src/workspace-contracts.d.mts +38 -10
- package/src/workspace-contracts.mjs +147 -33
package/src/errors.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
/** @type {typeof import('./errors.d.mts').ARTIFACT_ERROR_CODES} */
|
|
1
3
|
export const ARTIFACT_ERROR_CODES = Object.freeze({
|
|
2
4
|
INPUT_INVALID: 'E_ARTIFACT_INPUT_INVALID',
|
|
3
5
|
FILE_MISSING: 'E_ARTIFACT_FILE_MISSING',
|
|
@@ -59,6 +61,7 @@ export const ARTIFACT_ERROR_CODES = Object.freeze({
|
|
|
59
61
|
ROOM_EVENT_REPLAY: 'E_ARTIFACT_ROOM_EVENT_REPLAY',
|
|
60
62
|
});
|
|
61
63
|
|
|
64
|
+
/** @type {typeof import('./errors.d.mts').PROTOCOL_ERROR_CODES} */
|
|
62
65
|
export const PROTOCOL_ERROR_CODES = Object.freeze({
|
|
63
66
|
ASSET_NOT_FOUND: 'E_PROTOCOL_ASSET_NOT_FOUND',
|
|
64
67
|
DIGEST_MISMATCH: 'E_PROTOCOL_DIGEST_MISMATCH',
|
|
@@ -75,6 +78,7 @@ export const PROTOCOL_ERROR_CODES = Object.freeze({
|
|
|
75
78
|
|
|
76
79
|
// Compatibility name retained for consumers that imported the pipeline error
|
|
77
80
|
// vocabulary object rather than the PipelineError class.
|
|
81
|
+
/** @type {typeof import('./errors.d.mts').PIPELINE_ERROR_CODES} */
|
|
78
82
|
export const PIPELINE_ERROR_CODES = PROTOCOL_ERROR_CODES;
|
|
79
83
|
|
|
80
84
|
export class PipelineError extends Error {
|
|
@@ -1927,7 +1927,7 @@ export const CANONICAL_REGISTRIES = deepFreeze({
|
|
|
1927
1927
|
"ownerPackage": "openplanr",
|
|
1928
1928
|
"source": {
|
|
1929
1929
|
"path": "packages/cli/src/cli/commands/setup.ts",
|
|
1930
|
-
"digest": "sha256:
|
|
1930
|
+
"digest": "sha256:8cc9b0df403edf08a900baf0e2755db0b9238c9e7465b04fca92b322fd5a5b7d"
|
|
1931
1931
|
},
|
|
1932
1932
|
"authorityClass": "workflow",
|
|
1933
1933
|
"machineJson": false,
|
|
@@ -2116,7 +2116,7 @@ export const CANONICAL_REGISTRIES = deepFreeze({
|
|
|
2116
2116
|
"ownerPackage": "openplanr",
|
|
2117
2117
|
"source": {
|
|
2118
2118
|
"path": "packages/cli/src/cli/commands/upgrade.ts",
|
|
2119
|
-
"digest": "sha256:
|
|
2119
|
+
"digest": "sha256:f88457767ccf7034ee601a9e107f9976c0432632e5aa68463150d590e704bc7e"
|
|
2120
2120
|
},
|
|
2121
2121
|
"authorityClass": "workflow",
|
|
2122
2122
|
"machineJson": false,
|
|
@@ -3099,7 +3099,7 @@ export const CANONICAL_REGISTRIES = deepFreeze({
|
|
|
3099
3099
|
]
|
|
3100
3100
|
}
|
|
3101
3101
|
],
|
|
3102
|
-
"documentDigest": "sha256:
|
|
3102
|
+
"documentDigest": "sha256:9f33355d22aaa2ee1d20f91aed15abbeefd85c7a405449acd610a7cfa12e2f46"
|
|
3103
3103
|
},
|
|
3104
3104
|
"skills.json": {
|
|
3105
3105
|
"kind": "skill-catalog",
|
|
@@ -3727,7 +3727,7 @@ export const CANONICAL_REGISTRIES = deepFreeze({
|
|
|
3727
3727
|
"lifecycle": "active",
|
|
3728
3728
|
"authorityClass": "planning-write",
|
|
3729
3729
|
"source": "skills/planr-design/openplanr.skill.json",
|
|
3730
|
-
"sourceDigest": "sha256:
|
|
3730
|
+
"sourceDigest": "sha256:f766320e0acf0d321f996ad6b3115a2e7d4d386b10d760de1ba056b2b3b1e735",
|
|
3731
3731
|
"triggerPolicy": {
|
|
3732
3732
|
"include": [
|
|
3733
3733
|
"Create an initial product design direction",
|
|
@@ -3788,7 +3788,7 @@ export const CANONICAL_REGISTRIES = deepFreeze({
|
|
|
3788
3788
|
"lifecycle": "active",
|
|
3789
3789
|
"authorityClass": "planning-write",
|
|
3790
3790
|
"source": "skills/planr-design-loop/openplanr.skill.json",
|
|
3791
|
-
"sourceDigest": "sha256:
|
|
3791
|
+
"sourceDigest": "sha256:3e1c445f7e16605852ca252e13f4be26152ca536c4c3a0411ad30e3f2568579b",
|
|
3792
3792
|
"triggerPolicy": {
|
|
3793
3793
|
"include": [
|
|
3794
3794
|
"Explore multiple design directions or variants",
|
|
@@ -3849,7 +3849,7 @@ export const CANONICAL_REGISTRIES = deepFreeze({
|
|
|
3849
3849
|
"lifecycle": "active",
|
|
3850
3850
|
"authorityClass": "review-evidence",
|
|
3851
3851
|
"source": "skills/planr-design-review/openplanr.skill.json",
|
|
3852
|
-
"sourceDigest": "sha256:
|
|
3852
|
+
"sourceDigest": "sha256:0344f576cc93658bcd7265fbac08908d08f4ef4d9aa05b6fdfed63a249e51632",
|
|
3853
3853
|
"triggerPolicy": {
|
|
3854
3854
|
"include": [
|
|
3855
3855
|
"Review or critique an existing OpenPlanr design",
|
|
@@ -4282,7 +4282,7 @@ export const CANONICAL_REGISTRIES = deepFreeze({
|
|
|
4282
4282
|
"lifecycle": "active",
|
|
4283
4283
|
"authorityClass": "planning-write",
|
|
4284
4284
|
"source": "skills/planr-plan/openplanr.skill.json",
|
|
4285
|
-
"sourceDigest": "sha256:
|
|
4285
|
+
"sourceDigest": "sha256:5d747d2be313ac2e06534936043744f663939e8d72644c31936daa42f2bc500c",
|
|
4286
4286
|
"triggerPolicy": {
|
|
4287
4287
|
"include": [
|
|
4288
4288
|
"Decompose a specification into user stories and implementation tasks",
|
|
@@ -4767,7 +4767,7 @@ export const CANONICAL_REGISTRIES = deepFreeze({
|
|
|
4767
4767
|
}
|
|
4768
4768
|
],
|
|
4769
4769
|
"compatibilityAliases": [],
|
|
4770
|
-
"documentDigest": "sha256:
|
|
4770
|
+
"documentDigest": "sha256:63f0c16bcbca6cdf811e606835e91c2474f37122903e4e84d43a357159d58786"
|
|
4771
4771
|
},
|
|
4772
4772
|
"outputs.json": {
|
|
4773
4773
|
"kind": "output-catalog",
|
package/src/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './browser-contracts.mjs';
|
|
2
2
|
export * from './canonical-json.mjs';
|
|
3
|
+
export * from './design-handoff-contracts.mjs';
|
|
4
|
+
export * from './design-publication-contracts.mjs';
|
|
5
|
+
export * from './diagram-authoring-contracts.mjs';
|
|
6
|
+
export * from './diagram-contracts.mjs';
|
|
7
|
+
export * from './enterprise-contracts.mjs';
|
|
8
|
+
export * from './errors.mjs';
|
|
3
9
|
export * from './json-schema.mjs';
|
|
10
|
+
export * from './planning-contracts.mjs';
|
|
4
11
|
export * from './registries.mjs';
|
|
5
|
-
export * from './browser-contracts.mjs';
|
|
6
12
|
export * from './task-contracts.mjs';
|
|
7
|
-
export * from './planning-contracts.mjs';
|
|
8
|
-
export * from './diagram-contracts.mjs';
|
|
9
|
-
export * from './enterprise-contracts.mjs';
|
|
10
|
-
export * from './design-publication-contracts.mjs';
|
|
11
|
-
export * from './design-handoff-contracts.mjs';
|
|
12
|
-
export * from './diagram-authoring-contracts.mjs';
|
package/src/index.mjs
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export { canonicalizeJson, sha256Hex, sha256Jcs, verifyDocumentDigest, withDocumentDigest } from './canonical-json.mjs';
|
|
3
|
-
export { validate, validateJson } from './json-schema.mjs';
|
|
4
|
-
export {
|
|
5
|
-
CANONICAL_REGISTRIES,
|
|
6
|
-
getCanonicalRegistry,
|
|
7
|
-
getOutput,
|
|
8
|
-
getOutputPathTemplate,
|
|
9
|
-
getRole,
|
|
10
|
-
resolveOutputPath,
|
|
11
|
-
resolveLegacyRoleAlias,
|
|
12
|
-
resolveTaskKind,
|
|
13
|
-
routeLegacyTask,
|
|
14
|
-
validateCanonicalRegistries,
|
|
15
|
-
} from './registries.mjs';
|
|
1
|
+
// @ts-check
|
|
16
2
|
export {
|
|
17
3
|
PROTOCOL_V15_CONTRACTS,
|
|
18
4
|
PROTOCOL_V16_CONTRACTS,
|
|
@@ -22,7 +8,16 @@ export {
|
|
|
22
8
|
PROTOCOL_V113_CONTRACTS,
|
|
23
9
|
protocolAssetUrl,
|
|
24
10
|
} from './browser-contracts.mjs';
|
|
25
|
-
export {
|
|
11
|
+
export {
|
|
12
|
+
canonicalizeJson,
|
|
13
|
+
sha256Hex,
|
|
14
|
+
sha256Jcs,
|
|
15
|
+
verifyDocumentDigest,
|
|
16
|
+
withDocumentDigest,
|
|
17
|
+
} from './canonical-json.mjs';
|
|
18
|
+
export * from './design-handoff-contracts.mjs';
|
|
19
|
+
export * from './design-publication-contracts.mjs';
|
|
20
|
+
export * from './diagram-authoring-contracts.mjs';
|
|
26
21
|
export {
|
|
27
22
|
DIAGRAM_CONTRACT_FILES,
|
|
28
23
|
DIAGRAM_GRAMMAR_REGISTRY,
|
|
@@ -30,6 +25,31 @@ export {
|
|
|
30
25
|
diagramContractUrl,
|
|
31
26
|
getDiagramGrammar,
|
|
32
27
|
} from './diagram-contracts.mjs';
|
|
28
|
+
export * from './enterprise-contracts.mjs';
|
|
29
|
+
export {
|
|
30
|
+
ARTIFACT_ERROR_CODES,
|
|
31
|
+
PIPELINE_ERROR_CODES,
|
|
32
|
+
PipelineError,
|
|
33
|
+
PROTOCOL_ERROR_CODES,
|
|
34
|
+
ProtocolError,
|
|
35
|
+
} from './errors.mjs';
|
|
36
|
+
export { validate, validateJson } from './json-schema.mjs';
|
|
37
|
+
export {
|
|
38
|
+
normalizePlanningTask,
|
|
39
|
+
validatePlanningAcceptanceCoverage,
|
|
40
|
+
} from './planning-contracts.mjs';
|
|
41
|
+
export {
|
|
42
|
+
CANONICAL_REGISTRIES,
|
|
43
|
+
getCanonicalRegistry,
|
|
44
|
+
getOutput,
|
|
45
|
+
getOutputPathTemplate,
|
|
46
|
+
getRole,
|
|
47
|
+
resolveLegacyRoleAlias,
|
|
48
|
+
resolveOutputPath,
|
|
49
|
+
resolveTaskKind,
|
|
50
|
+
routeLegacyTask,
|
|
51
|
+
validateCanonicalRegistries,
|
|
52
|
+
} from './registries.mjs';
|
|
33
53
|
export {
|
|
34
54
|
assertTaskManifestSemantics,
|
|
35
55
|
assertTaskOutputSemantics,
|
|
@@ -38,7 +58,3 @@ export {
|
|
|
38
58
|
validateTaskManifestSemantics,
|
|
39
59
|
validateTaskOutputSemantics,
|
|
40
60
|
} from './task-contracts.mjs';
|
|
41
|
-
export * from './enterprise-contracts.mjs';
|
|
42
|
-
export * from './design-publication-contracts.mjs';
|
|
43
|
-
export * from './design-handoff-contracts.mjs';
|
|
44
|
-
export * from './diagram-authoring-contracts.mjs';
|
package/src/json-schema.d.mts
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
export interface JsonSchemaDiagnostic {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export interface JsonSchemaDiagnostic {
|
|
2
|
+
path: string;
|
|
3
|
+
rule: string;
|
|
4
|
+
detail: string;
|
|
5
|
+
}
|
|
6
|
+
export interface JsonSchemaResolverResult {
|
|
7
|
+
schema: unknown;
|
|
8
|
+
rootSchema?: unknown;
|
|
9
|
+
base?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function validateJson(
|
|
12
|
+
value: unknown,
|
|
13
|
+
schema: unknown,
|
|
14
|
+
options?: {
|
|
15
|
+
base?: string | null;
|
|
16
|
+
resolveRef?: (
|
|
17
|
+
reference: string,
|
|
18
|
+
context: { base?: string | null },
|
|
19
|
+
) => JsonSchemaResolverResult | unknown;
|
|
20
|
+
},
|
|
21
|
+
): JsonSchemaDiagnostic[];
|
|
7
22
|
export { validateJson as validate };
|
package/src/json-schema.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
/**
|
|
2
3
|
* Minimal JSON Schema (draft 2020-12) subset extracted from conformance/runner.mjs.
|
|
3
4
|
* Supports the constructs used by packaged Protocol schemas, including local
|
|
@@ -80,14 +81,22 @@ const validateNode = (value, schema, path, errs, context) => {
|
|
|
80
81
|
if (schema.type !== undefined) {
|
|
81
82
|
const types = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
82
83
|
if (!types.some((t) => matchesType(value, t))) {
|
|
83
|
-
errs.push({
|
|
84
|
+
errs.push({
|
|
85
|
+
path,
|
|
86
|
+
rule: 'type',
|
|
87
|
+
detail: `expected ${types.join('|')}, got ${typeOf(value)}`,
|
|
88
|
+
});
|
|
84
89
|
return;
|
|
85
90
|
}
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
if (schema.const !== undefined) {
|
|
89
94
|
if (value !== schema.const) {
|
|
90
|
-
errs.push({
|
|
95
|
+
errs.push({
|
|
96
|
+
path,
|
|
97
|
+
rule: 'const',
|
|
98
|
+
detail: `expected ${JSON.stringify(schema.const)}, got ${JSON.stringify(value)}`,
|
|
99
|
+
});
|
|
91
100
|
}
|
|
92
101
|
}
|
|
93
102
|
|
|
@@ -103,25 +112,49 @@ const validateNode = (value, schema, path, errs, context) => {
|
|
|
103
112
|
|
|
104
113
|
if (typeof value === 'string') {
|
|
105
114
|
if (typeof schema.minLength === 'number' && value.length < schema.minLength) {
|
|
106
|
-
errs.push({
|
|
115
|
+
errs.push({
|
|
116
|
+
path,
|
|
117
|
+
rule: 'minLength',
|
|
118
|
+
detail: `length ${value.length} < ${schema.minLength}`,
|
|
119
|
+
});
|
|
107
120
|
}
|
|
108
121
|
if (typeof schema.maxLength === 'number' && value.length > schema.maxLength) {
|
|
109
|
-
errs.push({
|
|
122
|
+
errs.push({
|
|
123
|
+
path,
|
|
124
|
+
rule: 'maxLength',
|
|
125
|
+
detail: `length ${value.length} > ${schema.maxLength}`,
|
|
126
|
+
});
|
|
110
127
|
}
|
|
111
128
|
if (typeof schema.pattern === 'string') {
|
|
112
129
|
try {
|
|
113
130
|
if (!new RegExp(schema.pattern).test(value)) {
|
|
114
|
-
errs.push({
|
|
131
|
+
errs.push({
|
|
132
|
+
path,
|
|
133
|
+
rule: 'pattern',
|
|
134
|
+
detail: `value ${JSON.stringify(value)} does not match /${schema.pattern}/`,
|
|
135
|
+
});
|
|
115
136
|
}
|
|
116
137
|
} catch (e) {
|
|
117
|
-
errs.push({
|
|
138
|
+
errs.push({
|
|
139
|
+
path,
|
|
140
|
+
rule: 'pattern',
|
|
141
|
+
detail: `invalid regex /${schema.pattern}/: ${e instanceof Error ? e.message : String(e)}`,
|
|
142
|
+
});
|
|
118
143
|
}
|
|
119
144
|
}
|
|
120
145
|
if (typeof schema.format === 'string') {
|
|
121
146
|
if (schema.format === 'date' && !FORMAT_DATE.test(value)) {
|
|
122
|
-
errs.push({
|
|
147
|
+
errs.push({
|
|
148
|
+
path,
|
|
149
|
+
rule: 'format:date',
|
|
150
|
+
detail: `value ${JSON.stringify(value)} is not YYYY-MM-DD`,
|
|
151
|
+
});
|
|
123
152
|
} else if (schema.format === 'date-time' && !FORMAT_DATETIME.test(value)) {
|
|
124
|
-
errs.push({
|
|
153
|
+
errs.push({
|
|
154
|
+
path,
|
|
155
|
+
rule: 'format:date-time',
|
|
156
|
+
detail: `value ${JSON.stringify(value)} is not ISO 8601 date-time`,
|
|
157
|
+
});
|
|
125
158
|
}
|
|
126
159
|
}
|
|
127
160
|
}
|
|
@@ -174,10 +207,18 @@ const validateNode = (value, schema, path, errs, context) => {
|
|
|
174
207
|
const minimum = Number.isSafeInteger(schema.minContains) ? schema.minContains : 1;
|
|
175
208
|
const maximum = Number.isSafeInteger(schema.maxContains) ? schema.maxContains : null;
|
|
176
209
|
if (matches < minimum) {
|
|
177
|
-
errs.push({
|
|
210
|
+
errs.push({
|
|
211
|
+
path,
|
|
212
|
+
rule: 'contains',
|
|
213
|
+
detail: `matched ${matches} contained items; expected at least ${minimum}`,
|
|
214
|
+
});
|
|
178
215
|
}
|
|
179
216
|
if (maximum !== null && matches > maximum) {
|
|
180
|
-
errs.push({
|
|
217
|
+
errs.push({
|
|
218
|
+
path,
|
|
219
|
+
rule: 'contains',
|
|
220
|
+
detail: `matched ${matches} contained items; expected at most ${maximum}`,
|
|
221
|
+
});
|
|
181
222
|
}
|
|
182
223
|
}
|
|
183
224
|
}
|
|
@@ -196,8 +237,8 @@ const validateNode = (value, schema, path, errs, context) => {
|
|
|
196
237
|
if (schema.additionalProperties === false) {
|
|
197
238
|
errs.push({ path, rule: 'additionalProperties', detail: `unknown property '${k}'` });
|
|
198
239
|
} else if (
|
|
199
|
-
schema.additionalProperties === true
|
|
200
|
-
|
|
240
|
+
schema.additionalProperties === true ||
|
|
241
|
+
(schema.additionalProperties !== null && typeof schema.additionalProperties === 'object')
|
|
201
242
|
) {
|
|
202
243
|
validateNode(v, schema.additionalProperties, `${path}.${k}`, errs, context);
|
|
203
244
|
}
|
|
@@ -264,11 +305,15 @@ const validateNode = (value, schema, path, errs, context) => {
|
|
|
264
305
|
}
|
|
265
306
|
};
|
|
266
307
|
|
|
267
|
-
/** @
|
|
268
|
-
export const validateJson = (
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
308
|
+
/** @type {typeof import('./json-schema.d.mts').validateJson} */
|
|
309
|
+
export const validateJson = (
|
|
310
|
+
value,
|
|
311
|
+
schema,
|
|
312
|
+
{
|
|
313
|
+
resolveRef,
|
|
314
|
+
base = /** @type {{ $id?: string } | null | undefined} */ (schema)?.$id ?? null,
|
|
315
|
+
} = {},
|
|
316
|
+
) => {
|
|
272
317
|
const errs = [];
|
|
273
318
|
validateNode(value, schema, '$', errs, {
|
|
274
319
|
rootSchema: schema,
|
|
@@ -279,5 +324,8 @@ export const validateJson = (value, schema, {
|
|
|
279
324
|
return errs;
|
|
280
325
|
};
|
|
281
326
|
|
|
282
|
-
/**
|
|
327
|
+
/**
|
|
328
|
+
* Alias matching legacy runner export name.
|
|
329
|
+
* @type {typeof import('./json-schema.d.mts').validate}
|
|
330
|
+
*/
|
|
283
331
|
export const validate = validateJson;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
export interface PlanningIssue {
|
|
2
|
-
|
|
1
|
+
export interface PlanningIssue {
|
|
2
|
+
path: string;
|
|
3
|
+
rule: string;
|
|
4
|
+
detail: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function normalizePlanningTask<T extends Record<string, unknown>>(
|
|
7
|
+
value: T,
|
|
8
|
+
): T & {
|
|
3
9
|
reviewRisks: string[];
|
|
4
10
|
browserSurfaces: string[];
|
|
5
11
|
acceptanceRefs: string[];
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
const LEGACY_TASK_FIELDS = Object.freeze({
|
|
2
3
|
review_risks: 'reviewRisks',
|
|
3
4
|
browser_surfaces: 'browserSurfaces',
|
|
4
5
|
acceptance_refs: 'acceptanceRefs',
|
|
5
6
|
});
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Translate released snake-case task metadata into the canonical 1.7 names.
|
|
10
|
+
* @returns {ReturnType<typeof import('./planning-contracts.d.mts').normalizePlanningTask>}
|
|
11
|
+
*/
|
|
8
12
|
export function normalizePlanningTask(value) {
|
|
9
13
|
const task = structuredClone(value ?? {});
|
|
10
14
|
for (const [legacy, canonical] of Object.entries(LEGACY_TASK_FIELDS)) {
|
|
@@ -17,7 +21,10 @@ export function normalizePlanningTask(value) {
|
|
|
17
21
|
return task;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Validate that every story criterion is assigned and named in task verification.
|
|
26
|
+
* @returns {ReturnType<typeof import('./planning-contracts.d.mts').validatePlanningAcceptanceCoverage>}
|
|
27
|
+
*/
|
|
21
28
|
export function validatePlanningAcceptanceCoverage(stories, tasks) {
|
|
22
29
|
const issues = [];
|
|
23
30
|
const tasksByStory = new Map();
|
|
@@ -31,21 +38,40 @@ export function validatePlanningAcceptanceCoverage(stories, tasks) {
|
|
|
31
38
|
const criteria = story.acceptanceCriteria ?? [];
|
|
32
39
|
const ids = new Set(criteria.map((criterion) => criterion.id));
|
|
33
40
|
if (ids.size !== criteria.length) {
|
|
34
|
-
issues.push({
|
|
41
|
+
issues.push({
|
|
42
|
+
path: `${story.id}.acceptanceCriteria`,
|
|
43
|
+
rule: 'unique',
|
|
44
|
+
detail: 'Acceptance IDs must be unique within the story.',
|
|
45
|
+
});
|
|
35
46
|
}
|
|
36
47
|
for (const criterion of criteria) {
|
|
37
|
-
const mapped = (tasksByStory.get(story.id) ?? []).filter((task) =>
|
|
48
|
+
const mapped = (tasksByStory.get(story.id) ?? []).filter((task) =>
|
|
49
|
+
task.acceptanceRefs.includes(criterion.id),
|
|
50
|
+
);
|
|
38
51
|
if (mapped.length === 0) {
|
|
39
|
-
issues.push({
|
|
52
|
+
issues.push({
|
|
53
|
+
path: `${story.id}.${criterion.id}`,
|
|
54
|
+
rule: 'coverage',
|
|
55
|
+
detail: 'Acceptance criterion is not mapped to a task.',
|
|
56
|
+
});
|
|
40
57
|
continue;
|
|
41
58
|
}
|
|
42
59
|
if (mapped.every((task) => !String(task.testRequirements ?? '').includes(criterion.id))) {
|
|
43
|
-
issues.push({
|
|
60
|
+
issues.push({
|
|
61
|
+
path: `${story.id}.${criterion.id}`,
|
|
62
|
+
rule: 'verification',
|
|
63
|
+
detail: 'A mapped task must name the acceptance ID in Test Requirements.',
|
|
64
|
+
});
|
|
44
65
|
}
|
|
45
66
|
}
|
|
46
67
|
for (const task of tasksByStory.get(story.id) ?? []) {
|
|
47
68
|
for (const reference of task.acceptanceRefs) {
|
|
48
|
-
if (!ids.has(reference))
|
|
69
|
+
if (!ids.has(reference))
|
|
70
|
+
issues.push({
|
|
71
|
+
path: `${task.id}.acceptanceRefs`,
|
|
72
|
+
rule: 'reference',
|
|
73
|
+
detail: `${reference} is not declared by ${story.id}.`,
|
|
74
|
+
});
|
|
49
75
|
}
|
|
50
76
|
}
|
|
51
77
|
}
|
package/src/registries.d.mts
CHANGED
|
@@ -21,12 +21,17 @@ export interface ResolveOutputPathOptions {
|
|
|
21
21
|
readonly pathArguments?: Readonly<Record<string, string>>;
|
|
22
22
|
}
|
|
23
23
|
export declare const CANONICAL_REGISTRIES: CanonicalRegistries;
|
|
24
|
-
export declare function getCanonicalRegistry(
|
|
24
|
+
export declare function getCanonicalRegistry(
|
|
25
|
+
name: keyof CanonicalRegistries,
|
|
26
|
+
): Record<string, unknown>;
|
|
25
27
|
export declare function validateCanonicalRegistries(registries?: CanonicalRegistries): true;
|
|
26
28
|
export declare function getRole(roleId: string): Record<string, unknown>;
|
|
27
29
|
export declare function resolveLegacyRoleAlias(alias: string): Record<string, unknown> | null;
|
|
28
30
|
export declare function resolveTaskKind(taskKind: string): Record<string, unknown>;
|
|
29
|
-
export declare function getOutput(
|
|
31
|
+
export declare function getOutput(
|
|
32
|
+
outputId: string,
|
|
33
|
+
registries?: CanonicalRegistries,
|
|
34
|
+
): OutputCatalogEntry;
|
|
30
35
|
export declare function getOutputPathTemplate(
|
|
31
36
|
outputId: string,
|
|
32
37
|
projectMode?: OutputProjectMode,
|
|
@@ -37,4 +42,7 @@ export declare function resolveOutputPath(
|
|
|
37
42
|
options?: ResolveOutputPathOptions,
|
|
38
43
|
registries?: CanonicalRegistries,
|
|
39
44
|
): string;
|
|
40
|
-
export declare function routeLegacyTask(value: {
|
|
45
|
+
export declare function routeLegacyTask(value: {
|
|
46
|
+
legacyType: 'UI' | 'Tech';
|
|
47
|
+
legacyAgent?: string | null;
|
|
48
|
+
}): Record<string, unknown>;
|