@cleocode/contracts 2026.5.126 → 2026.5.128
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/dist/__tests__/enums.test.js +1 -1
- package/dist/__tests__/enums.test.js.map +1 -1
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +48 -3
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/enums.d.ts +5 -3
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +5 -3
- package/dist/enums.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/operations/docs.d.ts +42 -1
- package/dist/operations/docs.d.ts.map +1 -1
- package/dist/operations/docs.js +4 -0
- package/dist/operations/docs.js.map +1 -1
- package/dist/operations/tasks.d.ts +11 -21
- package/dist/operations/tasks.d.ts.map +1 -1
- package/dist/operations/tasks.js.map +1 -1
- package/dist/taxonomy.d.ts +136 -0
- package/dist/taxonomy.d.ts.map +1 -0
- package/dist/taxonomy.js +562 -0
- package/dist/taxonomy.js.map +1 -0
- package/dist/workgraph.d.ts +19 -3
- package/dist/workgraph.d.ts.map +1 -1
- package/dist/workgraph.js +29 -9
- package/dist/workgraph.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/enums.test.ts +1 -1
- package/src/dispatch/operations-registry.ts +49 -3
- package/src/enums.ts +5 -3
- package/src/index.ts +18 -0
- package/src/operations/docs.ts +47 -0
- package/src/operations/tasks.ts +13 -23
- package/src/taxonomy.ts +634 -0
- package/src/workgraph.ts +32 -9
package/dist/taxonomy.js
ADDED
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Taxonomy Registry (T11186).
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for classification tags across decisions,
|
|
5
|
+
* documents, tasks, and routing surfaces. Unifies the previously
|
|
6
|
+
* fragmented vocabularies:
|
|
7
|
+
*
|
|
8
|
+
* - `BRAIN_DECISION_TYPES` (memory-schema.ts) — 5 values
|
|
9
|
+
* - `BRAIN_DECISION_CATEGORIES` (memory-schema.ts) — 3 values
|
|
10
|
+
* - `BrainCognitiveType` (brain.ts) — 3 values
|
|
11
|
+
* - `BUILTIN_DOC_KINDS` (docs-taxonomy.ts) — 10 values
|
|
12
|
+
* - `labels_json` (tasks schema) — free-form, 30+ ad-hoc labels
|
|
13
|
+
* - `BrainEdgeKind` (operations/brain.ts) — open-ended
|
|
14
|
+
* - `BRAIN_PATTERN_TYPES` (memory-schema.ts) — 5 values
|
|
15
|
+
* - `BRAIN_OBSERVATION_TYPES` (memory-schema.ts) — 8 values
|
|
16
|
+
*
|
|
17
|
+
* The taxonomy is organized into **axes** — each tag is classified
|
|
18
|
+
* by what dimension of classification it represents. A single tag
|
|
19
|
+
* may belong to multiple axes (e.g., `adr` is both a doc_kind and
|
|
20
|
+
* a decision type).
|
|
21
|
+
*
|
|
22
|
+
* ## Axes
|
|
23
|
+
*
|
|
24
|
+
* | Axis | Purpose |
|
|
25
|
+
* |-------------|----------------------------------------------|
|
|
26
|
+
* | `domain` | Architectural subsystem or component area |
|
|
27
|
+
* | `type` | Kind of artifact, decision, or entry |
|
|
28
|
+
* | `lifecycle` | Phase in the RCASD→IVTR pipeline |
|
|
29
|
+
* | `priority` | Severity, urgency, or importance |
|
|
30
|
+
* | `doc_kind` | Document classification (absorbs docs-taxonomy)|
|
|
31
|
+
*
|
|
32
|
+
* @task T11186
|
|
33
|
+
* @epic T10520
|
|
34
|
+
* @saga T10516
|
|
35
|
+
* @see ADR-073 §1 — Task Hierarchy Charter
|
|
36
|
+
* @see packages/contracts/src/docs-taxonomy.ts — absorbed doc-kind subset
|
|
37
|
+
*/
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// Built-in canonical tags
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
/**
|
|
42
|
+
* Every canonical tag known to the system.
|
|
43
|
+
*
|
|
44
|
+
* Adding a tag here automatically makes it available for decisions,
|
|
45
|
+
* task labels, doc classification, and routing surfaces. No other
|
|
46
|
+
* file needs to be updated.
|
|
47
|
+
*/
|
|
48
|
+
export const BUILTIN_TAXONOMY_TAGS = [
|
|
49
|
+
// ─── Domain tags ───────────────────────────────────────────────
|
|
50
|
+
{
|
|
51
|
+
tag: 'architecture',
|
|
52
|
+
label: 'Architecture',
|
|
53
|
+
description: 'Cross-cutting architectural decisions, patterns, and subsystem-level concerns',
|
|
54
|
+
axes: ['domain', 'type'],
|
|
55
|
+
adhocAliases: ['architecture'],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
tag: 'cli',
|
|
59
|
+
label: 'CLI',
|
|
60
|
+
description: 'Command-line interface, dispatch, and command infrastructure',
|
|
61
|
+
axes: ['domain'],
|
|
62
|
+
adhocAliases: ['cli'],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
tag: 'core',
|
|
66
|
+
label: 'Core',
|
|
67
|
+
description: 'Core engine, shared utilities, and foundational modules',
|
|
68
|
+
axes: ['domain'],
|
|
69
|
+
adhocAliases: ['core', 'pm-core-v2', 'foundation'],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
tag: 'contracts',
|
|
73
|
+
label: 'Contracts',
|
|
74
|
+
description: 'Type contracts, schemas, and public API surface definitions',
|
|
75
|
+
axes: ['domain'],
|
|
76
|
+
adhocAliases: ['contracts', 'schema'],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
tag: 'caamp',
|
|
80
|
+
label: 'CAAMP',
|
|
81
|
+
description: 'Cross-Agent Adaptive Messaging Protocol — hooks, adapters, providers',
|
|
82
|
+
axes: ['domain'],
|
|
83
|
+
adhocAliases: ['caamp', 'cant', 'pi', 'cant-dsl'],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
tag: 'skills',
|
|
87
|
+
label: 'Skills',
|
|
88
|
+
description: 'Agent skill definitions, injection, dispatch, and guard patterns',
|
|
89
|
+
axes: ['domain'],
|
|
90
|
+
adhocAliases: ['skills'],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
tag: 'brain',
|
|
94
|
+
label: 'BRAIN',
|
|
95
|
+
description: 'Cognitive memory system — decisions, patterns, observations, learnings',
|
|
96
|
+
axes: ['domain'],
|
|
97
|
+
adhocAliases: ['brain'],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
tag: 'nexus',
|
|
101
|
+
label: 'Nexus',
|
|
102
|
+
description: 'Code intelligence surface — project indexing, impact analysis, cross-repo',
|
|
103
|
+
axes: ['domain'],
|
|
104
|
+
adhocAliases: ['nexus'],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
tag: 'orchestration',
|
|
108
|
+
label: 'Orchestration',
|
|
109
|
+
description: 'Multi-agent orchestration, playbooks, LOOM lifecycle, spawn dispatch',
|
|
110
|
+
axes: ['domain'],
|
|
111
|
+
adhocAliases: ['orchestration', 'orchestrate'],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
tag: 'sessions',
|
|
115
|
+
label: 'Sessions',
|
|
116
|
+
description: 'Session lifecycle — handoff, debrief, briefing, snapshot, state',
|
|
117
|
+
axes: ['domain'],
|
|
118
|
+
adhocAliases: ['sessions'],
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
tag: 'tasks',
|
|
122
|
+
label: 'Tasks',
|
|
123
|
+
description: 'Task management — CRUD, gates, evidence, acceptance criteria, lifecycle',
|
|
124
|
+
axes: ['domain'],
|
|
125
|
+
adhocAliases: ['tasks'],
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
tag: 'docs',
|
|
129
|
+
label: 'Documents',
|
|
130
|
+
description: 'Document storage, retrieval, taxonomy, publish, and provenance',
|
|
131
|
+
axes: ['domain'],
|
|
132
|
+
adhocAliases: ['docs', 'documentation'],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
tag: 'cleoos',
|
|
136
|
+
label: 'CleoOS',
|
|
137
|
+
description: 'CleoOS runtime — gateway, daemon, injection facade, agents',
|
|
138
|
+
axes: ['domain'],
|
|
139
|
+
adhocAliases: ['cleoos', 'facade', 'sentient'],
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
tag: 'worktrunk',
|
|
143
|
+
label: 'Worktrunk',
|
|
144
|
+
description: 'Git worktree management — spawn, adopt, prune, lifecycle',
|
|
145
|
+
axes: ['domain'],
|
|
146
|
+
adhocAliases: ['worktrunk', 'worktrunk-ssot'],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
tag: 'agents',
|
|
150
|
+
label: 'Agents',
|
|
151
|
+
description: 'Agent profiles, execution learning, registry, dispatch',
|
|
152
|
+
axes: ['domain'],
|
|
153
|
+
adhocAliases: ['agents'],
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
tag: 'routing',
|
|
157
|
+
label: 'Routing',
|
|
158
|
+
description: 'Operation routing, capability matrix, dispatch path resolution',
|
|
159
|
+
axes: ['domain'],
|
|
160
|
+
adhocAliases: ['routing'],
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
tag: 'studio',
|
|
164
|
+
label: 'Studio',
|
|
165
|
+
description: 'Web UI, dashboard, and visual interfaces',
|
|
166
|
+
axes: ['domain'],
|
|
167
|
+
adhocAliases: ['studio'],
|
|
168
|
+
},
|
|
169
|
+
// ─── Type tags ─────────────────────────────────────────────────
|
|
170
|
+
{
|
|
171
|
+
tag: 'architectural',
|
|
172
|
+
label: 'Architectural Decision',
|
|
173
|
+
description: 'Cross-cutting architectural decision with durable rationale',
|
|
174
|
+
axes: ['type'],
|
|
175
|
+
adhocAliases: ['architectural'],
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
tag: 'technical',
|
|
179
|
+
label: 'Technical Decision',
|
|
180
|
+
description: 'Implementation-scoped technical decision (library, pattern, algorithm)',
|
|
181
|
+
axes: ['type'],
|
|
182
|
+
adhocAliases: ['technical'],
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
tag: 'process',
|
|
186
|
+
label: 'Process Decision',
|
|
187
|
+
description: 'Workflow, methodology, or operational process decision',
|
|
188
|
+
axes: ['type'],
|
|
189
|
+
adhocAliases: ['process'],
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
tag: 'strategic',
|
|
193
|
+
label: 'Strategic Decision',
|
|
194
|
+
description: 'Long-horizon direction-setting decision spanning multiple epics',
|
|
195
|
+
axes: ['type'],
|
|
196
|
+
adhocAliases: ['strategic'],
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
tag: 'tactical',
|
|
200
|
+
label: 'Tactical Decision',
|
|
201
|
+
description: 'Short-horizon execution-level decision (AGT-* dispatch, within-sprint)',
|
|
202
|
+
axes: ['type'],
|
|
203
|
+
adhocAliases: ['tactical'],
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
tag: 'operational',
|
|
207
|
+
label: 'Operational Decision',
|
|
208
|
+
description: 'Infrastructure, deployment, or runtime configuration decision',
|
|
209
|
+
axes: ['type'],
|
|
210
|
+
adhocAliases: ['operational'],
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
tag: 'bugfix',
|
|
214
|
+
label: 'Bug Fix',
|
|
215
|
+
description: 'Defect correction or regression fix',
|
|
216
|
+
axes: ['type'],
|
|
217
|
+
adhocAliases: ['bugfix', 'bug-fix', 'hygiene'],
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
tag: 'refactor',
|
|
221
|
+
label: 'Refactor',
|
|
222
|
+
description: 'Internal restructuring without functional change',
|
|
223
|
+
axes: ['type'],
|
|
224
|
+
adhocAliases: ['refactor'],
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
tag: 'feature',
|
|
228
|
+
label: 'Feature',
|
|
229
|
+
description: 'New capability or user-facing enhancement',
|
|
230
|
+
axes: ['type'],
|
|
231
|
+
adhocAliases: ['feature'],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
tag: 'discovery',
|
|
235
|
+
label: 'Discovery',
|
|
236
|
+
description: 'Exploratory research, investigation, or spike outcome',
|
|
237
|
+
axes: ['type'],
|
|
238
|
+
adhocAliases: ['discovery', 'exploration', 'research-type'],
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
tag: 'migration',
|
|
242
|
+
label: 'Migration',
|
|
243
|
+
description: 'Data or schema migration, backfill, or upgrade path',
|
|
244
|
+
axes: ['type'],
|
|
245
|
+
adhocAliases: ['migration', 'migrations'],
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
tag: 'unification',
|
|
249
|
+
label: 'Unification',
|
|
250
|
+
description: 'Consolidation of fragmented systems into a single SSoT',
|
|
251
|
+
axes: ['type'],
|
|
252
|
+
adhocAliases: ['unification'],
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
tag: 'bootstrap',
|
|
256
|
+
label: 'Bootstrap',
|
|
257
|
+
description: 'Initial setup, scaffolding, or seed infrastructure',
|
|
258
|
+
axes: ['type'],
|
|
259
|
+
adhocAliases: ['bootstrap'],
|
|
260
|
+
},
|
|
261
|
+
// ─── Lifecycle tags ────────────────────────────────────────────
|
|
262
|
+
{
|
|
263
|
+
tag: 'research',
|
|
264
|
+
label: 'Research',
|
|
265
|
+
description: 'LOOM stage 1: information gathering and domain understanding',
|
|
266
|
+
axes: ['lifecycle'],
|
|
267
|
+
adhocAliases: ['research', 'wave-0'],
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
tag: 'consensus',
|
|
271
|
+
label: 'Consensus',
|
|
272
|
+
description: 'LOOM stage 2: multi-agent consensus and validation of findings',
|
|
273
|
+
axes: ['lifecycle'],
|
|
274
|
+
adhocAliases: ['consensus'],
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
tag: 'design',
|
|
278
|
+
label: 'Architecture Decision',
|
|
279
|
+
description: 'LOOM stage 3: architecture decision recording and validation',
|
|
280
|
+
axes: ['lifecycle'],
|
|
281
|
+
adhocAliases: ['design', 'architecture_decision'],
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
tag: 'specification',
|
|
285
|
+
label: 'Specification',
|
|
286
|
+
description: 'LOOM stage 4: technical specification authoring',
|
|
287
|
+
axes: ['lifecycle'],
|
|
288
|
+
adhocAliases: ['specification', 'rfc'],
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
tag: 'decomposition',
|
|
292
|
+
label: 'Decomposition',
|
|
293
|
+
description: 'LOOM stage 5: task decomposition and dependency modeling',
|
|
294
|
+
axes: ['lifecycle'],
|
|
295
|
+
adhocAliases: ['decomposition'],
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
tag: 'implementation',
|
|
299
|
+
label: 'Implementation',
|
|
300
|
+
description: 'LOOM stage 6: code authoring and unit-level verification',
|
|
301
|
+
axes: ['lifecycle'],
|
|
302
|
+
adhocAliases: [
|
|
303
|
+
'implementation',
|
|
304
|
+
'wave-1',
|
|
305
|
+
'wave-2',
|
|
306
|
+
'wave-3',
|
|
307
|
+
'wave-4',
|
|
308
|
+
'wave-5',
|
|
309
|
+
'wave.1',
|
|
310
|
+
'wave.2',
|
|
311
|
+
'wave.3',
|
|
312
|
+
],
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
tag: 'validation',
|
|
316
|
+
label: 'Validation',
|
|
317
|
+
description: 'LOOM stage 7: integration testing and gate verification',
|
|
318
|
+
axes: ['lifecycle'],
|
|
319
|
+
adhocAliases: ['validation', 'testing'],
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
tag: 'release',
|
|
323
|
+
label: 'Release',
|
|
324
|
+
description: 'LOOM stage 9: versioning, changelog, npm publish, tag push',
|
|
325
|
+
axes: ['lifecycle', 'type'],
|
|
326
|
+
adhocAliases: ['release'],
|
|
327
|
+
},
|
|
328
|
+
// ─── Priority tags ─────────────────────────────────────────────
|
|
329
|
+
{
|
|
330
|
+
tag: 'p0',
|
|
331
|
+
label: 'P0 — Critical',
|
|
332
|
+
description: 'Drop-everything critical: blocks release, data loss, security incident',
|
|
333
|
+
axes: ['priority'],
|
|
334
|
+
adhocAliases: ['p0', 'critical', 'prime-tier1'],
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
tag: 'p1',
|
|
338
|
+
label: 'P1 — High',
|
|
339
|
+
description: 'High priority: blocks dependent work, user-visible degradation',
|
|
340
|
+
axes: ['priority'],
|
|
341
|
+
adhocAliases: ['p1'],
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
tag: 'p2',
|
|
345
|
+
label: 'P2 — Medium',
|
|
346
|
+
description: 'Medium priority: should fix, not blocking current wave',
|
|
347
|
+
axes: ['priority'],
|
|
348
|
+
adhocAliases: ['p2'],
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
tag: 'p3',
|
|
352
|
+
label: 'P3 — Low',
|
|
353
|
+
description: 'Low priority: nice-to-have, cleanup, future consideration',
|
|
354
|
+
axes: ['priority'],
|
|
355
|
+
adhocAliases: ['p3'],
|
|
356
|
+
},
|
|
357
|
+
// ─── Doc-kind tags (absorb docs-taxonomy) ──────────────────────
|
|
358
|
+
{
|
|
359
|
+
tag: 'adr',
|
|
360
|
+
label: 'Architecture Decision Record',
|
|
361
|
+
description: 'Formal architecture decision record with rationale and alternatives',
|
|
362
|
+
axes: ['doc_kind'],
|
|
363
|
+
adhocAliases: ['adr'],
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
tag: 'spec',
|
|
367
|
+
label: 'Specification',
|
|
368
|
+
description: 'Technical specification for a feature, protocol, or subsystem',
|
|
369
|
+
axes: ['doc_kind'],
|
|
370
|
+
adhocAliases: ['spec'],
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
tag: 'research',
|
|
374
|
+
label: 'Research Note',
|
|
375
|
+
description: 'Investigation findings, surveys, and domain analysis',
|
|
376
|
+
axes: ['doc_kind'],
|
|
377
|
+
adhocAliases: ['research'],
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
tag: 'handoff',
|
|
381
|
+
label: 'Handoff Note',
|
|
382
|
+
description: 'Cross-session handoff with state, blockers, and next actions',
|
|
383
|
+
axes: ['doc_kind'],
|
|
384
|
+
adhocAliases: ['handoff'],
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
tag: 'note',
|
|
388
|
+
label: 'Note',
|
|
389
|
+
description: 'General-purpose note, observation, or free-form documentation',
|
|
390
|
+
axes: ['doc_kind'],
|
|
391
|
+
adhocAliases: ['note'],
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
tag: 'llmreadme',
|
|
395
|
+
label: 'LLM README',
|
|
396
|
+
description: 'Agent-consumable project overview, conventions, and context',
|
|
397
|
+
axes: ['doc_kind'],
|
|
398
|
+
adhocAliases: ['llmreadme', 'llm-readme'],
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
tag: 'designmd',
|
|
402
|
+
label: 'Design Doc',
|
|
403
|
+
description: 'Google DESIGN.md token spec for agent interface contracts',
|
|
404
|
+
axes: ['doc_kind'],
|
|
405
|
+
adhocAliases: ['designmd', 'design-md'],
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
tag: 'changeset',
|
|
409
|
+
label: 'Changeset',
|
|
410
|
+
description: 'User-facing changelog entry for a single change',
|
|
411
|
+
axes: ['doc_kind'],
|
|
412
|
+
adhocAliases: ['changeset'],
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
tag: 'changelog',
|
|
416
|
+
label: 'Changelog',
|
|
417
|
+
description: 'Aggregated release changelog for a version',
|
|
418
|
+
axes: ['doc_kind'],
|
|
419
|
+
adhocAliases: ['changelog'],
|
|
420
|
+
},
|
|
421
|
+
];
|
|
422
|
+
// ---------------------------------------------------------------------------
|
|
423
|
+
// Derived constants
|
|
424
|
+
// ---------------------------------------------------------------------------
|
|
425
|
+
/** All canonical tag string values. */
|
|
426
|
+
export const CANONICAL_TAG_VALUES = BUILTIN_TAXONOMY_TAGS.map((t) => t.tag);
|
|
427
|
+
/** Every tag indexed by its canonical id. */
|
|
428
|
+
const _TAG_BY_ID = new Map(BUILTIN_TAXONOMY_TAGS.map((t) => [t.tag, t]));
|
|
429
|
+
/** Ad-hoc label → canonical tag lookup. */
|
|
430
|
+
const ADHOC_TO_CANONICAL = new Map();
|
|
431
|
+
for (const tag of BUILTIN_TAXONOMY_TAGS) {
|
|
432
|
+
for (const alias of tag.adhocAliases) {
|
|
433
|
+
ADHOC_TO_CANONICAL.set(alias, tag.tag);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
/** Tags grouped by axis. */
|
|
437
|
+
const TAGS_BY_AXIS = new Map();
|
|
438
|
+
for (const axis of ['domain', 'type', 'lifecycle', 'priority', 'doc_kind']) {
|
|
439
|
+
TAGS_BY_AXIS.set(axis, BUILTIN_TAXONOMY_TAGS.filter((t) => t.axes.includes(axis)));
|
|
440
|
+
}
|
|
441
|
+
/** All canonical tag type values (subset of ALL_TAGS with axis='type'). */
|
|
442
|
+
export const CANONICAL_TYPE_TAGS = TAGS_BY_AXIS.get('type').map((t) => t.tag);
|
|
443
|
+
/** All canonical domain tag values. */
|
|
444
|
+
export const CANONICAL_DOMAIN_TAGS = TAGS_BY_AXIS.get('domain').map((t) => t.tag);
|
|
445
|
+
/** Canonical priority tag values in order. */
|
|
446
|
+
export const CANONICAL_PRIORITY_TAGS = ['p0', 'p1', 'p2', 'p3'];
|
|
447
|
+
/** Canonical lifecycle tag values in LOOM order. */
|
|
448
|
+
export const CANONICAL_LIFECYCLE_TAGS = [
|
|
449
|
+
'research',
|
|
450
|
+
'consensus',
|
|
451
|
+
'design',
|
|
452
|
+
'specification',
|
|
453
|
+
'decomposition',
|
|
454
|
+
'implementation',
|
|
455
|
+
'validation',
|
|
456
|
+
'release',
|
|
457
|
+
];
|
|
458
|
+
/** Doc-kind tags (absorbed from docs-taxonomy). */
|
|
459
|
+
export const CANONICAL_DOC_KIND_TAGS = TAGS_BY_AXIS.get('doc_kind').map((t) => t.tag);
|
|
460
|
+
// ---------------------------------------------------------------------------
|
|
461
|
+
// Taxonomy Registry
|
|
462
|
+
// ---------------------------------------------------------------------------
|
|
463
|
+
/** Error thrown for taxonomy validation failures. */
|
|
464
|
+
export class TaxonomyError extends Error {
|
|
465
|
+
invalidTags;
|
|
466
|
+
constructor(message, invalidTags) {
|
|
467
|
+
super(message);
|
|
468
|
+
this.invalidTags = invalidTags;
|
|
469
|
+
this.name = 'TaxonomyError';
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Canonical Taxonomy Registry — runtime accessor and validator.
|
|
474
|
+
*
|
|
475
|
+
* Use {@link TaxonomyRegistry.default} for the built-in singleton,
|
|
476
|
+
* or construct with a custom tag list for testing.
|
|
477
|
+
*/
|
|
478
|
+
export class TaxonomyRegistry {
|
|
479
|
+
byId;
|
|
480
|
+
adhocMap;
|
|
481
|
+
constructor(tags) {
|
|
482
|
+
this.byId = new Map(tags.map((t) => [t.tag, t]));
|
|
483
|
+
this.adhocMap = new Map();
|
|
484
|
+
for (const tag of tags) {
|
|
485
|
+
for (const alias of tag.adhocAliases) {
|
|
486
|
+
const existingTarget = this.adhocMap.get(alias);
|
|
487
|
+
if (existingTarget !== undefined && existingTarget !== tag.tag) {
|
|
488
|
+
throw new TaxonomyError(`Ad-hoc alias '${alias}' maps to both '${existingTarget}' and '${tag.tag}' — aliases must be unique across targets`, [alias]);
|
|
489
|
+
}
|
|
490
|
+
this.adhocMap.set(alias, tag.tag);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
/** Default built-in registry singleton. */
|
|
495
|
+
static default = new TaxonomyRegistry(BUILTIN_TAXONOMY_TAGS);
|
|
496
|
+
/** True when `tag` is a canonical tag. */
|
|
497
|
+
isCanonical(tag) {
|
|
498
|
+
return this.byId.has(tag);
|
|
499
|
+
}
|
|
500
|
+
/** Look up metadata for a canonical tag. */
|
|
501
|
+
get(tag) {
|
|
502
|
+
return this.byId.get(tag);
|
|
503
|
+
}
|
|
504
|
+
/** List all canonical tags. */
|
|
505
|
+
list() {
|
|
506
|
+
return [...this.byId.values()];
|
|
507
|
+
}
|
|
508
|
+
/** List tags for a specific axis. */
|
|
509
|
+
listByAxis(axis) {
|
|
510
|
+
return this.list().filter((t) => t.axes.includes(axis));
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Normalize an ad-hoc label to its canonical form.
|
|
514
|
+
*
|
|
515
|
+
* Returns the canonical tag id, or `undefined` if the label has no
|
|
516
|
+
* known canonical mapping.
|
|
517
|
+
*/
|
|
518
|
+
normalize(adhoc) {
|
|
519
|
+
return this.adhocMap.get(adhoc);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Validate that every tag in `tags` is canonical.
|
|
523
|
+
*
|
|
524
|
+
* @param tags - Tags to validate.
|
|
525
|
+
* @returns An array of invalid tags. Empty array = all valid.
|
|
526
|
+
*/
|
|
527
|
+
validate(tags) {
|
|
528
|
+
return tags.filter((t) => !this.byId.has(t));
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Validate tags and throw on failure.
|
|
532
|
+
*
|
|
533
|
+
* @param tags - Tags to validate.
|
|
534
|
+
* @param context - Human-readable context for the error message.
|
|
535
|
+
* @throws TaxonomyError when any tag is not canonical.
|
|
536
|
+
*/
|
|
537
|
+
validateOrThrow(tags, context) {
|
|
538
|
+
const invalid = this.validate(tags);
|
|
539
|
+
if (invalid.length > 0) {
|
|
540
|
+
throw new TaxonomyError(`${context}: unknown tags [${invalid.join(', ')}]. ` +
|
|
541
|
+
`Use canonical tags. Run 'cleo taxonomy list' to see all valid tags.`, invalid);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Normalize a set of ad-hoc labels to canonical form.
|
|
546
|
+
*
|
|
547
|
+
* Unknown labels are passed through unchanged (they may be
|
|
548
|
+
* project-specific extensions or task-id references).
|
|
549
|
+
*
|
|
550
|
+
* @param labels - Ad-hoc labels to normalize.
|
|
551
|
+
* @returns Normalized label set (deduplicated).
|
|
552
|
+
*/
|
|
553
|
+
normalizeSet(labels) {
|
|
554
|
+
const result = new Set();
|
|
555
|
+
for (const label of labels) {
|
|
556
|
+
const canonical = this.normalize(label);
|
|
557
|
+
result.add(canonical ?? label);
|
|
558
|
+
}
|
|
559
|
+
return [...result];
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
//# sourceMappingURL=taxonomy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taxonomy.js","sourceRoot":"","sources":["../src/taxonomy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AA4BH,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAwC;IACxE,kEAAkE;IAClE;QACE,GAAG,EAAE,cAAc;QACnB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,+EAA+E;QAC5F,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,cAAc,CAAC;KAC/B;IACD;QACE,GAAG,EAAE,KAAK;QACV,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,8DAA8D;QAC3E,IAAI,EAAE,CAAC,QAAQ,CAAC;QAChB,YAAY,EAAE,CAAC,KAAK,CAAC;KACtB;IACD;QACE,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,yDAAyD;QACtE,IAAI,EAAE,CAAC,QAAQ,CAAC;QAChB,YAAY,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAC;KACnD;IACD;QACE,GAAG,EAAE,WAAW;QAChB,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,6DAA6D;QAC1E,IAAI,EAAE,CA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AK,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC;IACrB,CAAC"}
|
package/dist/workgraph.d.ts
CHANGED
|
@@ -1920,6 +1920,21 @@ export interface WorkGraphHierarchyValidationOptions {
|
|
|
1920
1920
|
/** Throw on the first violation instead of returning all diagnostics. */
|
|
1921
1921
|
readonly throwOnViolation?: boolean;
|
|
1922
1922
|
}
|
|
1923
|
+
/**
|
|
1924
|
+
* Return true when the task type can exist without a parent in the canonical
|
|
1925
|
+
* PM-Core V2 containment tree.
|
|
1926
|
+
*
|
|
1927
|
+
* @param type - Task type to test.
|
|
1928
|
+
*/
|
|
1929
|
+
export declare function canWorkGraphTaskTypeBeRoot(type: TaskType): boolean;
|
|
1930
|
+
/**
|
|
1931
|
+
* Return true when a parent type can contain a child type in the canonical
|
|
1932
|
+
* PM-Core V2 containment tree.
|
|
1933
|
+
*
|
|
1934
|
+
* @param childType - Child task type.
|
|
1935
|
+
* @param parentType - Candidate parent task type.
|
|
1936
|
+
*/
|
|
1937
|
+
export declare function isAllowedWorkGraphParentType(childType: TaskType, parentType: TaskType): boolean;
|
|
1923
1938
|
/** Error thrown by fail-fast WorkGraph hierarchy validation. */
|
|
1924
1939
|
export declare class WorkGraphHierarchyInvariantError extends Error {
|
|
1925
1940
|
/** Stable machine-readable code for the invariant breach. */
|
|
@@ -1936,9 +1951,10 @@ export declare class WorkGraphHierarchyInvariantError extends Error {
|
|
|
1936
1951
|
* Validate WorkGraph hierarchy rows against CLEO's canonical type/parent matrix.
|
|
1937
1952
|
*
|
|
1938
1953
|
* The validator mirrors the SQLite trigger invariant in a storage-agnostic form
|
|
1939
|
-
* for core adapters, projections, and API callers: sagas and epics
|
|
1940
|
-
*
|
|
1941
|
-
* are leaves. Saga membership
|
|
1954
|
+
* for core adapters, projections, and API callers: sagas and standalone epics
|
|
1955
|
+
* may be roots, sagas may contain epics, epics may contain tasks, tasks may
|
|
1956
|
+
* contain subtasks, and subtasks are leaves. Saga membership uses `parentId`
|
|
1957
|
+
* containment, never `task_relations.groups`.
|
|
1942
1958
|
*
|
|
1943
1959
|
* @param nodes - Task-like hierarchy rows to validate.
|
|
1944
1960
|
* @param options - Optional fail-fast behavior for enforcement call sites.
|