@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.
Files changed (55) hide show
  1. package/lib/dashboard/closed-json-contract.mjs +99 -109
  2. package/lib/dashboard/operate-experience-audit-display-contract.d.mts +128 -153
  3. package/lib/dashboard/operate-experience-audit-display-contract.mjs +530 -585
  4. package/lib/dashboard/operate-experience-display-contract.d.mts +415 -437
  5. package/lib/dashboard/operate-experience-display-contract.mjs +768 -831
  6. package/lib/dashboard/operate-experience-surface-contract.d.mts +143 -148
  7. package/lib/dashboard/operate-experience-surface-contract.mjs +72 -73
  8. package/lib/dashboard/operate-review-contract.d.mts +7 -14
  9. package/lib/dashboard/operate-review-contract.mjs +46 -42
  10. package/lib/dashboard/operate-review-display-workspace-contract.d.mts +2 -5
  11. package/lib/dashboard/operate-review-display-workspace-contract.mjs +158 -104
  12. package/lib/dashboard/operate-review-payload-safety.mjs +4 -2
  13. package/lib/dashboard/operate-review-workspace-projection-v2.d.mts +47 -33
  14. package/lib/protocol/index.d.ts +2647 -543
  15. package/package.json +1 -1
  16. package/registries/commands.json +3 -3
  17. package/registries/skills.json +5 -5
  18. package/src/browser-contracts.d.mts +4 -1
  19. package/src/browser-contracts.mjs +16 -5
  20. package/src/canonical-json.d.mts +3 -1
  21. package/src/canonical-json.mjs +57 -20
  22. package/src/compat/live-evidence-v2.mjs +1604 -485
  23. package/src/compat/operate-experience-live-patch.mjs +67 -15
  24. package/src/compat/operating-planning-contracts.mjs +183 -51
  25. package/src/contracts.d.mts +54 -13
  26. package/src/contracts.mjs +625 -335
  27. package/src/design-contracts.mjs +58 -21
  28. package/src/design-handoff-contracts.d.mts +67 -11
  29. package/src/design-handoff-contracts.mjs +243 -98
  30. package/src/design-publication-contracts.mjs +98 -33
  31. package/src/diagram-authoring-contracts.d.mts +422 -78
  32. package/src/diagram-authoring-contracts.mjs +1697 -326
  33. package/src/diagram-contracts.d.mts +4 -1
  34. package/src/diagram-contracts.mjs +16 -4
  35. package/src/enterprise-contracts.d.mts +211 -46
  36. package/src/enterprise-contracts.mjs +727 -175
  37. package/src/errors.mjs +4 -0
  38. package/src/generated/canonical-registries.mjs +8 -8
  39. package/src/index.d.mts +8 -8
  40. package/src/index.mjs +36 -20
  41. package/src/json-schema.d.mts +21 -6
  42. package/src/json-schema.mjs +66 -18
  43. package/src/planning-contracts.d.mts +8 -2
  44. package/src/planning-contracts.mjs +33 -7
  45. package/src/registries.d.mts +11 -3
  46. package/src/registries.mjs +369 -87
  47. package/src/review-experience-contracts.d.mts +7 -2
  48. package/src/review-experience-contracts.mjs +198 -49
  49. package/src/semver.mjs +5 -1
  50. package/src/skill-source-contracts.d.mts +36 -16
  51. package/src/skill-source-contracts.mjs +25 -6
  52. package/src/task-contracts.d.mts +13 -3
  53. package/src/task-contracts.mjs +181 -40
  54. package/src/workspace-contracts.d.mts +38 -10
  55. 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:866e47698db7a4f39ff487cac8e27ce1d474a0f078c12200164d414bab32d9a3"
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:9b644add6535f982df30767f511404592edda7e813fbfcf93b167fcc38ef00fe"
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:e7321cb2a962c7fe7906034eb3e0c09bbf6e85de52b779faa44a50d5584cff4d"
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:b6fb1882f9147414964469f6e3b8089c2ca8d55c0f4a7f92e66b5a107db68051",
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:e74d98bbf31c030727e6cf2bd306b760d1bba2449bbb247148fe6c1dbc684f7b",
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:388904d851b0da0e6bc9171db229f80facca68a417bb4e458bf5eebf6cd12be3",
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:e91d221a286bd91b3b7a2343cea8c73564cb3401b968854d38bcf8a9790131f1",
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:b1abd9ebb9b724c02ec359e67ec05ebefb38d5b5a64ed04b415fce41b58de5cc"
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 './errors.mjs';
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
- export { ARTIFACT_ERROR_CODES, PIPELINE_ERROR_CODES, PROTOCOL_ERROR_CODES, PipelineError, ProtocolError } from './errors.mjs';
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 { normalizePlanningTask, validatePlanningAcceptanceCoverage } from './planning-contracts.mjs';
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';
@@ -1,7 +1,22 @@
1
- export interface JsonSchemaDiagnostic { path: string; rule: string; detail: string }
2
- export interface JsonSchemaResolverResult { schema: unknown; rootSchema?: unknown; base?: string }
3
- export declare function validateJson(value: unknown, schema: unknown, options?: {
4
- base?: string | null;
5
- resolveRef?: (reference: string, context: { base?: string | null }) => JsonSchemaResolverResult | unknown;
6
- }): JsonSchemaDiagnostic[];
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 };
@@ -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({ path, rule: 'type', detail: `expected ${types.join('|')}, got ${typeOf(value)}` });
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({ path, rule: 'const', detail: `expected ${JSON.stringify(schema.const)}, got ${JSON.stringify(value)}` });
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({ path, rule: 'minLength', detail: `length ${value.length} < ${schema.minLength}` });
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({ path, rule: 'maxLength', detail: `length ${value.length} > ${schema.maxLength}` });
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({ path, rule: 'pattern', detail: `value ${JSON.stringify(value)} does not match /${schema.pattern}/` });
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({ path, rule: 'pattern', detail: `invalid regex /${schema.pattern}/: ${e.message}` });
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({ path, rule: 'format:date', detail: `value ${JSON.stringify(value)} is not YYYY-MM-DD` });
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({ path, rule: 'format:date-time', detail: `value ${JSON.stringify(value)} is not ISO 8601 date-time` });
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({ path, rule: 'contains', detail: `matched ${matches} contained items; expected at least ${minimum}` });
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({ path, rule: 'contains', detail: `matched ${matches} contained items; expected at most ${maximum}` });
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
- || (schema.additionalProperties !== null && typeof schema.additionalProperties === 'object')
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
- /** @returns {{ path: string, rule: string, detail: string }[]} */
268
- export const validateJson = (value, schema, {
269
- resolveRef = null,
270
- base = schema?.$id ?? null,
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
- /** Alias matching legacy runner export name. */
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 { path: string; rule: string; detail: string }
2
- export declare function normalizePlanningTask<T extends Record<string, unknown>>(value: T): T & {
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
- /** Translate released snake-case task metadata into the canonical 1.7 names. */
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
- /** Validate that every story criterion is assigned and named in task verification. */
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({ path: `${story.id}.acceptanceCriteria`, rule: 'unique', detail: 'Acceptance IDs must be unique within the story.' });
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) => task.acceptanceRefs.includes(criterion.id));
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({ path: `${story.id}.${criterion.id}`, rule: 'coverage', detail: 'Acceptance criterion is not mapped to a task.' });
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({ path: `${story.id}.${criterion.id}`, rule: 'verification', detail: 'A mapped task must name the acceptance ID in Test Requirements.' });
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)) issues.push({ path: `${task.id}.acceptanceRefs`, rule: 'reference', detail: `${reference} is not declared by ${story.id}.` });
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
  }
@@ -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(name: keyof CanonicalRegistries): Record<string, unknown>;
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(outputId: string, registries?: CanonicalRegistries): OutputCatalogEntry;
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: { legacyType: 'UI' | 'Tech'; legacyAgent?: string | null }): Record<string, unknown>;
45
+ export declare function routeLegacyTask(value: {
46
+ legacyType: 'UI' | 'Tech';
47
+ legacyAgent?: string | null;
48
+ }): Record<string, unknown>;