@planvokter/riotplan-catalyst 1.0.17-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ publish:
2
+ lockfilePolicy: ignore
package/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 Tim O'Brien
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,330 @@
1
+ # @planvokter/riotplan-catalyst
2
+
3
+ Catalyst system for RiotPlan - composable, layerable guidance packages that shape the entire planning process.
4
+
5
+ ## What is a Catalyst?
6
+
7
+ A catalyst is a collection of resources that affects the questions asked and the process used to come up with a plan. It provides guidance through six facets:
8
+
9
+ - **Questions** - Things to consider during exploration
10
+ - **Constraints** - Rules the plan must satisfy
11
+ - **Output Templates** - Expected deliverables
12
+ - **Domain Knowledge** - Context about the domain
13
+ - **Process Guidance** - How to approach the planning process
14
+ - **Validation Rules** - Post-creation checks
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @planvokter/riotplan-catalyst
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ### Loading a Single Catalyst
25
+
26
+ ```typescript
27
+ import { loadCatalyst } from '@planvokter/riotplan-catalyst';
28
+
29
+ // Load a catalyst from a directory
30
+ const result = await loadCatalyst('./my-catalyst');
31
+
32
+ if (result.success) {
33
+ console.log('Loaded:', result.catalyst.manifest.name);
34
+ console.log('Facets:', Object.keys(result.catalyst.facets));
35
+ } else {
36
+ console.error('Failed to load:', result.error);
37
+ }
38
+ ```
39
+
40
+ ### Loading Multiple Catalysts
41
+
42
+ ```typescript
43
+ import { resolveCatalysts } from '@planvokter/riotplan-catalyst';
44
+
45
+ // Resolve multiple catalysts by path
46
+ const catalysts = await resolveCatalysts([
47
+ './catalysts/software',
48
+ './catalysts/nodejs',
49
+ './catalysts/company'
50
+ ]);
51
+
52
+ console.log(`Loaded ${catalysts.length} catalysts`);
53
+ ```
54
+
55
+ ### Merging Catalysts
56
+
57
+ ```typescript
58
+ import { resolveCatalysts, mergeCatalysts } from '@planvokter/riotplan-catalyst';
59
+
60
+ // Load and merge catalysts
61
+ const catalysts = await resolveCatalysts(['./catalyst-1', './catalyst-2']);
62
+ const merged = mergeCatalysts(catalysts);
63
+
64
+ // Access merged content
65
+ console.log('Applied catalysts:', merged.catalystIds);
66
+ console.log('Questions:', merged.facets.questions);
67
+ console.log('Constraints:', merged.facets.constraints);
68
+ ```
69
+
70
+ ### Working with Plan Manifests
71
+
72
+ ```typescript
73
+ import {
74
+ readPlanManifest,
75
+ writePlanManifest,
76
+ addCatalystToManifest
77
+ } from '@planvokter/riotplan-catalyst';
78
+
79
+ // Read plan manifest
80
+ const manifest = await readPlanManifest('./my-plan');
81
+ console.log('Plan:', manifest.title);
82
+ console.log('Catalysts:', manifest.catalysts);
83
+
84
+ // Add a catalyst to a plan
85
+ await addCatalystToManifest('./my-plan', '@kjerneverk/catalyst-nodejs');
86
+
87
+ // Create a new plan manifest
88
+ await writePlanManifest('./new-plan', {
89
+ id: 'new-plan',
90
+ title: 'New Plan',
91
+ catalysts: ['@kjerneverk/catalyst-nodejs'],
92
+ created: new Date().toISOString()
93
+ });
94
+ ```
95
+
96
+ ## Catalyst Directory Structure
97
+
98
+ ```
99
+ my-catalyst/
100
+ catalyst.yml # Manifest (required)
101
+ questions/ # Optional
102
+ exploration.md # Questions for idea phase
103
+ constraints/ # Optional
104
+ testing.md # Testing requirements
105
+ output-templates/ # Optional
106
+ press-release.md # Press release template
107
+ domain-knowledge/ # Optional
108
+ overview.md # Domain context
109
+ process-guidance/ # Optional
110
+ lifecycle.md # Process guidance
111
+ validation-rules/ # Optional
112
+ checklist.md # Validation checklist
113
+ ```
114
+
115
+ ## Schema Reference
116
+
117
+ ### catalyst.yml
118
+
119
+ ```yaml
120
+ id: '@myorg/catalyst-name' # NPM package name format (required)
121
+ name: 'Human Readable Name' # Display name (required)
122
+ version: '1.0.0' # Semver version (required)
123
+ description: 'What this provides' # Description (required)
124
+ facets: # Optional - auto-detected if omitted
125
+ questions: true
126
+ constraints: true
127
+ outputTemplates: true
128
+ domainKnowledge: true
129
+ processGuidance: true
130
+ validationRules: true
131
+ ```
132
+
133
+ **Validation Rules:**
134
+ - `id` must be a valid NPM package name (e.g., `@scope/name` or `name`)
135
+ - `version` must be valid semver (e.g., `1.0.0` or `1.0.0-dev.0`)
136
+ - `name` and `description` cannot be empty
137
+ - Facets are optional - if omitted, detected from directory structure
138
+
139
+ ### plan.yaml
140
+
141
+ ```yaml
142
+ id: 'plan-identifier' # Plan ID (required)
143
+ title: 'Plan Title' # Display title (required)
144
+ catalysts: # Optional - list of catalyst IDs
145
+ - '@myorg/catalyst-nodejs'
146
+ - '@myorg/catalyst-company'
147
+ created: '2026-01-15T10:30:00Z' # ISO timestamp (optional)
148
+ metadata: # Optional - extensible
149
+ author: 'John Doe'
150
+ tags: ['feature', 'api']
151
+ ```
152
+
153
+ ## API Reference
154
+
155
+ ### Loader Functions
156
+
157
+ #### `loadCatalyst(path: string): Promise<CatalystLoadResult>`
158
+
159
+ Load a single catalyst from a directory.
160
+
161
+ **Returns:**
162
+ ```typescript
163
+ {
164
+ success: true,
165
+ catalyst: {
166
+ manifest: { id, name, version, description, facets },
167
+ directory: '/absolute/path',
168
+ facets: {
169
+ questions: [{ filename, content }],
170
+ constraints: [{ filename, content }],
171
+ // ... other facets
172
+ }
173
+ }
174
+ }
175
+ // or
176
+ {
177
+ success: false,
178
+ error: 'Error message'
179
+ }
180
+ ```
181
+
182
+ #### `loadCatalystSafe(path: string): Promise<Catalyst | null>`
183
+
184
+ Load a catalyst, returning null on error (no exception thrown).
185
+
186
+ #### `resolveCatalysts(identifiers: string[]): Promise<Catalyst[]>`
187
+
188
+ Load multiple catalysts by path. Skips any that fail to load.
189
+
190
+ **Example:**
191
+ ```typescript
192
+ const catalysts = await resolveCatalysts([
193
+ './catalyst-1',
194
+ './catalyst-2',
195
+ './catalyst-3'
196
+ ]);
197
+ // Returns only successfully loaded catalysts
198
+ ```
199
+
200
+ ### Merger Functions
201
+
202
+ #### `mergeCatalysts(catalysts: Catalyst[]): MergedCatalyst`
203
+
204
+ Merge multiple catalysts into a single structure with source attribution.
205
+
206
+ **Returns:**
207
+ ```typescript
208
+ {
209
+ catalystIds: ['@org/cat-1', '@org/cat-2'],
210
+ facets: {
211
+ questions: [
212
+ { content: '...', sourceId: '@org/cat-1', filename: 'setup.md' },
213
+ { content: '...', sourceId: '@org/cat-2', filename: 'config.md' }
214
+ ],
215
+ // ... other facets
216
+ }
217
+ }
218
+ ```
219
+
220
+ #### `renderFacet(facetName: string, merged: MergedCatalyst): string`
221
+
222
+ Render a single facet as markdown with source attribution.
223
+
224
+ #### `renderAllFacets(merged: MergedCatalyst): Record<string, string>`
225
+
226
+ Render all facets as markdown strings.
227
+
228
+ **Example:**
229
+ ```typescript
230
+ const rendered = renderAllFacets(merged);
231
+ console.log(rendered.questions);
232
+ console.log(rendered.constraints);
233
+ ```
234
+
235
+ ### Plan Manifest Functions
236
+
237
+ #### `readPlanManifest(planPath: string): Promise<PlanManifest>`
238
+
239
+ Read plan.yaml from a plan directory.
240
+
241
+ #### `writePlanManifest(planPath: string, manifest: PlanManifest): Promise<void>`
242
+
243
+ Write plan.yaml to a plan directory.
244
+
245
+ #### `updatePlanManifest(planPath: string, updates: Partial<PlanManifest>): Promise<void>`
246
+
247
+ Update specific fields in plan.yaml.
248
+
249
+ #### `addCatalystToManifest(planPath: string, catalystId: string): Promise<void>`
250
+
251
+ Add a catalyst ID to the plan's catalyst list (if not already present).
252
+
253
+ #### `removeCatalystFromManifest(planPath: string, catalystId: string): Promise<void>`
254
+
255
+ Remove a catalyst ID from the plan's catalyst list.
256
+
257
+ ## TypeScript Types
258
+
259
+ ```typescript
260
+ // Catalyst manifest
261
+ interface CatalystManifest {
262
+ id: string;
263
+ name: string;
264
+ version: string;
265
+ description: string;
266
+ facets?: FacetsDeclaration;
267
+ }
268
+
269
+ // Facet content
270
+ interface FacetContent {
271
+ filename: string;
272
+ content: string;
273
+ }
274
+
275
+ // Loaded catalyst
276
+ interface Catalyst {
277
+ manifest: CatalystManifest;
278
+ directory: string;
279
+ facets: CatalystFacets;
280
+ }
281
+
282
+ // Merged catalyst with attribution
283
+ interface MergedCatalyst {
284
+ catalystIds: string[];
285
+ facets: Record<string, AttributedContent[]>;
286
+ }
287
+
288
+ interface AttributedContent {
289
+ content: string;
290
+ sourceId: string;
291
+ filename?: string;
292
+ }
293
+
294
+ // Plan manifest
295
+ interface PlanManifest {
296
+ id: string;
297
+ title: string;
298
+ catalysts?: string[];
299
+ created?: string;
300
+ metadata?: Record<string, string>;
301
+ }
302
+ ```
303
+
304
+ ## Error Handling
305
+
306
+ All loader functions return structured results:
307
+
308
+ ```typescript
309
+ // Success
310
+ { success: true, catalyst: Catalyst }
311
+
312
+ // Failure
313
+ { success: false, error: string }
314
+ ```
315
+
316
+ Safe variants return `null` on error:
317
+
318
+ ```typescript
319
+ const catalyst = await loadCatalystSafe('./path');
320
+ if (catalyst === null) {
321
+ console.error('Failed to load');
322
+ }
323
+ ```
324
+
325
+ ## License
326
+
327
+ Apache-2.0
328
+ TEST
329
+ TEST
330
+ TEST