sysprom 1.2.0 → 1.2.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/README.md +8 -0
- package/dist/src/canonical-json.d.ts +5 -1
- package/dist/src/canonical-json.js +5 -1
- package/dist/src/cli/define-command.d.ts +26 -0
- package/dist/src/cli/define-command.js +22 -0
- package/dist/src/cli/shared.d.ts +32 -2
- package/dist/src/cli/shared.js +29 -2
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +0 -1
- package/dist/src/io.d.ts +9 -2
- package/dist/src/io.js +9 -2
- package/dist/src/json-to-md.d.ts +13 -3
- package/dist/src/json-to-md.js +13 -3
- package/dist/src/md-to-json.d.ts +12 -3
- package/dist/src/md-to-json.js +12 -3
- package/dist/src/operations/add-node.d.ts +1 -2
- package/dist/src/operations/add-node.js +1 -2
- package/dist/src/operations/add-plan-task.d.ts +1 -2
- package/dist/src/operations/add-plan-task.js +1 -2
- package/dist/src/operations/add-relationship.d.ts +1 -2
- package/dist/src/operations/add-relationship.js +1 -2
- package/dist/src/operations/define-operation.d.ts +16 -8
- package/dist/src/operations/define-operation.js +12 -2
- package/dist/src/operations/mark-task-done.d.ts +1 -2
- package/dist/src/operations/mark-task-done.js +1 -2
- package/dist/src/operations/mark-task-undone.d.ts +1 -2
- package/dist/src/operations/mark-task-undone.js +1 -2
- package/dist/src/operations/next-id.d.ts +1 -2
- package/dist/src/operations/next-id.js +1 -2
- package/dist/src/operations/remove-node.d.ts +1 -2
- package/dist/src/operations/remove-node.js +1 -2
- package/dist/src/operations/remove-relationship.d.ts +1 -2
- package/dist/src/operations/remove-relationship.js +1 -2
- package/dist/src/operations/rename.d.ts +1 -2
- package/dist/src/operations/rename.js +1 -2
- package/dist/src/operations/task-list.d.ts +1 -2
- package/dist/src/operations/task-list.js +1 -2
- package/dist/src/operations/update-node.d.ts +1 -2
- package/dist/src/operations/update-node.js +1 -2
- package/dist/src/operations/update-plan-task.d.ts +1 -2
- package/dist/src/operations/update-plan-task.js +1 -2
- package/dist/src/schema.d.ts +9 -1
- package/dist/src/schema.js +9 -1
- package/dist/src/speckit/generate.d.ts +60 -6
- package/dist/src/speckit/generate.js +114 -6
- package/dist/src/speckit/parse.d.ts +61 -6
- package/dist/src/speckit/parse.js +105 -6
- package/dist/src/speckit/plan.d.ts +50 -0
- package/dist/src/speckit/plan.js +117 -0
- package/dist/src/speckit/project.d.ts +29 -0
- package/dist/src/speckit/project.js +49 -0
- package/dist/src/text.d.ts +25 -4
- package/dist/src/text.js +25 -4
- package/package.json +2 -1
|
@@ -2,8 +2,7 @@ import * as z from "zod";
|
|
|
2
2
|
/**
|
|
3
3
|
* Generate the next available ID for a given node type. Scans existing node IDs
|
|
4
4
|
* matching the type's conventional prefix and returns `prefix + (max + 1)`.
|
|
5
|
-
*
|
|
6
|
-
* @throws If no ID prefix is defined for the given node type.
|
|
5
|
+
* @throws {Error} If no ID prefix is defined for the given node type.
|
|
7
6
|
*/
|
|
8
7
|
export declare const nextIdOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
|
|
9
8
|
doc: z.ZodObject<{
|
|
@@ -4,8 +4,7 @@ import { SysProMDocument, NodeType, NODE_ID_PREFIX } from "../schema.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Generate the next available ID for a given node type. Scans existing node IDs
|
|
6
6
|
* matching the type's conventional prefix and returns `prefix + (max + 1)`.
|
|
7
|
-
*
|
|
8
|
-
* @throws If no ID prefix is defined for the given node type.
|
|
7
|
+
* @throws {Error} If no ID prefix is defined for the given node type.
|
|
9
8
|
*/
|
|
10
9
|
export const nextIdOp = defineOperation({
|
|
11
10
|
name: "nextId",
|
|
@@ -303,8 +303,7 @@ export type RemoveResult = z.infer<typeof RemoveResult>;
|
|
|
303
303
|
/**
|
|
304
304
|
* Remove a node and all relationships involving it. Also removes the node from
|
|
305
305
|
* view includes and external references. Warns if scope or operation references remain.
|
|
306
|
-
*
|
|
307
|
-
* @throws If the node ID is not found.
|
|
306
|
+
* @throws {Error} If the node ID is not found.
|
|
308
307
|
*/
|
|
309
308
|
export declare const removeNodeOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
|
|
310
309
|
doc: z.ZodObject<{
|
|
@@ -9,8 +9,7 @@ export const RemoveResult = z.object({
|
|
|
9
9
|
/**
|
|
10
10
|
* Remove a node and all relationships involving it. Also removes the node from
|
|
11
11
|
* view includes and external references. Warns if scope or operation references remain.
|
|
12
|
-
*
|
|
13
|
-
* @throws If the node ID is not found.
|
|
12
|
+
* @throws {Error} If the node ID is not found.
|
|
14
13
|
*/
|
|
15
14
|
export const removeNodeOp = defineOperation({
|
|
16
15
|
name: "removeNode",
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
/**
|
|
3
3
|
* Remove a relationship matching from, type, and to. Returns a new document without it.
|
|
4
|
-
*
|
|
5
|
-
* @throws If no matching relationship is found.
|
|
4
|
+
* @throws {Error} If no matching relationship is found.
|
|
6
5
|
*/
|
|
7
6
|
export declare const removeRelationshipOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
|
|
8
7
|
doc: z.ZodObject<{
|
|
@@ -3,8 +3,7 @@ import { defineOperation } from "./define-operation.js";
|
|
|
3
3
|
import { SysProMDocument, RelationshipType } from "../schema.js";
|
|
4
4
|
/**
|
|
5
5
|
* Remove a relationship matching from, type, and to. Returns a new document without it.
|
|
6
|
-
*
|
|
7
|
-
* @throws If no matching relationship is found.
|
|
6
|
+
* @throws {Error} If no matching relationship is found.
|
|
8
7
|
*/
|
|
9
8
|
export const removeRelationshipOp = defineOperation({
|
|
10
9
|
name: "removeRelationship",
|
|
@@ -3,8 +3,7 @@ import * as z from "zod";
|
|
|
3
3
|
* Rename a node ID across all references in the document — the node itself,
|
|
4
4
|
* relationships, scope, includes, operation targets, external references, and
|
|
5
5
|
* recursively into subsystems.
|
|
6
|
-
*
|
|
7
|
-
* @throws If the old ID is not found or the new ID already exists.
|
|
6
|
+
* @throws {Error} If the old ID is not found or the new ID already exists.
|
|
8
7
|
*/
|
|
9
8
|
export declare const renameOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
|
|
10
9
|
doc: z.ZodObject<{
|
|
@@ -93,8 +93,7 @@ function renameNodeId(doc, oldId, newId) {
|
|
|
93
93
|
* Rename a node ID across all references in the document — the node itself,
|
|
94
94
|
* relationships, scope, includes, operation targets, external references, and
|
|
95
95
|
* recursively into subsystems.
|
|
96
|
-
*
|
|
97
|
-
* @throws If the old ID is not found or the new ID already exists.
|
|
96
|
+
* @throws {Error} If the old ID is not found or the new ID already exists.
|
|
98
97
|
*/
|
|
99
98
|
export const renameOp = defineOperation({
|
|
100
99
|
name: "rename",
|
|
@@ -2,8 +2,7 @@ import * as z from "zod";
|
|
|
2
2
|
/**
|
|
3
3
|
* List tasks across change nodes, optionally filtered by change ID and/or
|
|
4
4
|
* pending status. Returns a flat array of task rows tagged with their parent change node.
|
|
5
|
-
*
|
|
6
|
-
* @throws If a specific changeId is provided but not found.
|
|
5
|
+
* @throws {Error} If a specific changeId is provided but not found.
|
|
7
6
|
*/
|
|
8
7
|
export declare const taskListOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
|
|
9
8
|
doc: z.ZodObject<{
|
|
@@ -11,8 +11,7 @@ const TaskRow = z.object({
|
|
|
11
11
|
/**
|
|
12
12
|
* List tasks across change nodes, optionally filtered by change ID and/or
|
|
13
13
|
* pending status. Returns a flat array of task rows tagged with their parent change node.
|
|
14
|
-
*
|
|
15
|
-
* @throws If a specific changeId is provided but not found.
|
|
14
|
+
* @throws {Error} If a specific changeId is provided but not found.
|
|
16
15
|
*/
|
|
17
16
|
export const taskListOp = defineOperation({
|
|
18
17
|
name: "taskList",
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
/**
|
|
3
3
|
* Update specified fields on a node, merging the provided fields into the existing node.
|
|
4
|
-
*
|
|
5
|
-
* @throws If the node ID is not found.
|
|
4
|
+
* @throws {Error} If the node ID is not found.
|
|
6
5
|
*/
|
|
7
6
|
export declare const updateNodeOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
|
|
8
7
|
doc: z.ZodObject<{
|
|
@@ -3,8 +3,7 @@ import { defineOperation } from "./define-operation.js";
|
|
|
3
3
|
import { SysProMDocument, Node } from "../schema.js";
|
|
4
4
|
/**
|
|
5
5
|
* Update specified fields on a node, merging the provided fields into the existing node.
|
|
6
|
-
*
|
|
7
|
-
* @throws If the node ID is not found.
|
|
6
|
+
* @throws {Error} If the node ID is not found.
|
|
8
7
|
*/
|
|
9
8
|
export const updateNodeOp = defineOperation({
|
|
10
9
|
name: "updateNode",
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
/**
|
|
3
3
|
* Set the done status of a task in a change node's plan array. Returns a new document.
|
|
4
|
-
*
|
|
5
|
-
* @throws If the change node is not found or the task index is out of range.
|
|
4
|
+
* @throws {Error} If the change node is not found or the task index is out of range.
|
|
6
5
|
*/
|
|
7
6
|
export declare const updatePlanTaskOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
|
|
8
7
|
doc: z.ZodObject<{
|
|
@@ -3,8 +3,7 @@ import { defineOperation } from "./define-operation.js";
|
|
|
3
3
|
import { SysProMDocument } from "../schema.js";
|
|
4
4
|
/**
|
|
5
5
|
* Set the done status of a task in a change node's plan array. Returns a new document.
|
|
6
|
-
*
|
|
7
|
-
* @throws If the change node is not found or the task index is out of range.
|
|
6
|
+
* @throws {Error} If the change node is not found or the task index is out of range.
|
|
8
7
|
*/
|
|
9
8
|
export const updatePlanTaskOp = defineOperation({
|
|
10
9
|
name: "updatePlanTask",
|
package/dist/src/schema.d.ts
CHANGED
|
@@ -930,6 +930,14 @@ export type Node = z.infer<typeof Node>;
|
|
|
930
930
|
export declare const NODE_FILE_MAP: Record<string, string[]>;
|
|
931
931
|
/** Conventional ID prefix for each node type. */
|
|
932
932
|
export declare const NODE_ID_PREFIX: Record<string, string>;
|
|
933
|
-
/**
|
|
933
|
+
/**
|
|
934
|
+
* Generate the JSON Schema representation of the SysProM document schema.
|
|
935
|
+
* @returns The JSON Schema object with Draft 2020-12 metadata.
|
|
936
|
+
* @example
|
|
937
|
+
* ```ts
|
|
938
|
+
* const schema = toJSONSchema();
|
|
939
|
+
* writeFileSync("schema.json", JSON.stringify(schema, null, 2));
|
|
940
|
+
* ```
|
|
941
|
+
*/
|
|
934
942
|
export declare function toJSONSchema(): Record<string, unknown>;
|
|
935
943
|
export {};
|
package/dist/src/schema.js
CHANGED
|
@@ -371,7 +371,15 @@ export const NODE_ID_PREFIX = {
|
|
|
371
371
|
function isRecord(value) {
|
|
372
372
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
373
373
|
}
|
|
374
|
-
/**
|
|
374
|
+
/**
|
|
375
|
+
* Generate the JSON Schema representation of the SysProM document schema.
|
|
376
|
+
* @returns The JSON Schema object with Draft 2020-12 metadata.
|
|
377
|
+
* @example
|
|
378
|
+
* ```ts
|
|
379
|
+
* const schema = toJSONSchema();
|
|
380
|
+
* writeFileSync("schema.json", JSON.stringify(schema, null, 2));
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
375
383
|
export function toJSONSchema() {
|
|
376
384
|
const generated = z.toJSONSchema(SysProMDocument, {
|
|
377
385
|
target: "draft-2020-12",
|
|
@@ -1,13 +1,67 @@
|
|
|
1
1
|
import type { SysProMDocument } from "../schema.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Generate a Spec-Kit constitution file from a SysProM document's principles and invariants.
|
|
4
|
+
* @param doc - The SysProM document.
|
|
5
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
6
|
+
* @returns The generated markdown.
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const md = generateConstitution(doc, "FEAT");
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
3
12
|
export declare function generateConstitution(doc: SysProMDocument, prefix: string): string;
|
|
4
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Generate a Spec-Kit specification file from a SysProM document's user stories, FRs, and acceptance criteria.
|
|
15
|
+
* @param doc - The SysProM document.
|
|
16
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
17
|
+
* @returns The generated markdown.
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const md = generateSpec(doc, "FEAT");
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
5
23
|
export declare function generateSpec(doc: SysProMDocument, prefix: string): string;
|
|
6
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Generate a Spec-Kit plan file from a SysProM document's phases and milestones.
|
|
26
|
+
* @param doc - The SysProM document.
|
|
27
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
28
|
+
* @returns The generated markdown.
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const md = generatePlan(doc, "FEAT");
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
7
34
|
export declare function generatePlan(doc: SysProMDocument, prefix: string): string;
|
|
8
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Generate a Spec-Kit tasks file from a SysProM document's change nodes.
|
|
37
|
+
* @param doc - The SysProM document.
|
|
38
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
39
|
+
* @returns The generated markdown.
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const md = generateTasks(doc, "FEAT");
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
9
45
|
export declare function generateTasks(doc: SysProMDocument, prefix: string): string;
|
|
10
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Generate a Spec-Kit checklist file from a SysProM document's gate nodes.
|
|
48
|
+
* @param doc - The SysProM document.
|
|
49
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
50
|
+
* @returns The generated markdown.
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const md = generateChecklist(doc, "FEAT");
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
11
56
|
export declare function generateChecklist(doc: SysProMDocument, prefix: string): string;
|
|
12
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Generate a complete Spec-Kit project directory from a SysProM document — constitution, spec, plan, tasks, and checklist files.
|
|
59
|
+
* @param doc - The SysProM document.
|
|
60
|
+
* @param outputDir - Output directory path.
|
|
61
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* generateSpecKitProject(doc, "./output", "FEAT");
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
13
67
|
export declare function generateSpecKitProject(doc: SysProMDocument, outputDir: string, prefix: string): void;
|
|
@@ -6,18 +6,40 @@ import { textToString } from "../text.js";
|
|
|
6
6
|
// ============================================================================
|
|
7
7
|
/**
|
|
8
8
|
* Find a single node by ID, or null if not found.
|
|
9
|
+
* @param doc - The document to search.
|
|
10
|
+
* @param id - The node ID to find.
|
|
11
|
+
* @returns The matching node, or null.
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* findNode(doc, "D1")
|
|
15
|
+
* ```
|
|
9
16
|
*/
|
|
10
17
|
function findNode(doc, id) {
|
|
11
18
|
return doc.nodes.find((n) => n.id === id) ?? null;
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
14
21
|
* Find all nodes of a specific type.
|
|
22
|
+
* @param doc - The document to search.
|
|
23
|
+
* @param type - The node type to filter by.
|
|
24
|
+
* @returns Matching nodes.
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const decisions = findNodesByType(doc, "decision");
|
|
28
|
+
* ```
|
|
15
29
|
*/
|
|
16
30
|
function findNodesByType(doc, type) {
|
|
17
31
|
return doc.nodes.filter((n) => n.type === type);
|
|
18
32
|
}
|
|
19
33
|
/**
|
|
20
34
|
* Find relationships from a source node to nodes of a target type.
|
|
35
|
+
* @param doc - The document to search.
|
|
36
|
+
* @param fromId - Source node ID.
|
|
37
|
+
* @param relationType - Optional relationship type filter.
|
|
38
|
+
* @returns Matching relationships.
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const rels = findRelationshipsFrom(doc, "D1", "affects");
|
|
42
|
+
* ```
|
|
21
43
|
*/
|
|
22
44
|
function findRelationshipsFrom(doc, fromId, relationType) {
|
|
23
45
|
return (doc.relationships ?? []).filter((r) => {
|
|
@@ -30,6 +52,14 @@ function findRelationshipsFrom(doc, fromId, relationType) {
|
|
|
30
52
|
}
|
|
31
53
|
/**
|
|
32
54
|
* Find relationships to a target node.
|
|
55
|
+
* @param doc - The document to search.
|
|
56
|
+
* @param toId - Target node ID.
|
|
57
|
+
* @param relationType - Optional relationship type filter.
|
|
58
|
+
* @returns Matching relationships.
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const rels = findRelationshipsTo(doc, "INV1", "must_preserve");
|
|
62
|
+
* ```
|
|
33
63
|
*/
|
|
34
64
|
function findRelationshipsTo(doc, toId, relationType) {
|
|
35
65
|
return (doc.relationships ?? []).filter((r) => {
|
|
@@ -43,6 +73,12 @@ function findRelationshipsTo(doc, toId, relationType) {
|
|
|
43
73
|
/**
|
|
44
74
|
* Extract priority from a node's name, description, or lifecycle fields.
|
|
45
75
|
* Looks for patterns like "P1", "P2", "Priority: P1", etc.
|
|
76
|
+
* @param node - The node to extract priority from.
|
|
77
|
+
* @returns Priority string (e.g. "P1").
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const priority = extractPriority(node);
|
|
81
|
+
* ```
|
|
46
82
|
*/
|
|
47
83
|
function extractPriority(node) {
|
|
48
84
|
const text = [
|
|
@@ -57,6 +93,12 @@ function extractPriority(node) {
|
|
|
57
93
|
}
|
|
58
94
|
/**
|
|
59
95
|
* Extract numeric suffix from an ID (e.g., "PREFIX-SPEC-001" -> "001").
|
|
96
|
+
* @param id - The node ID.
|
|
97
|
+
* @returns The numeric suffix.
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* getIdSuffix("FEAT-SPEC-001"); // => "001"
|
|
101
|
+
* ```
|
|
60
102
|
*/
|
|
61
103
|
function getIdSuffix(id) {
|
|
62
104
|
const parts = id.split("-");
|
|
@@ -64,6 +106,12 @@ function getIdSuffix(id) {
|
|
|
64
106
|
}
|
|
65
107
|
/**
|
|
66
108
|
* Parse tasks from a change node's plan array.
|
|
109
|
+
* @param node - The change node.
|
|
110
|
+
* @returns Array of task descriptions and done flags.
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* const tasks = parseTasks(changeNode);
|
|
114
|
+
* ```
|
|
67
115
|
*/
|
|
68
116
|
function parseTasks(node) {
|
|
69
117
|
return (node.plan ?? []).map((task) => ({
|
|
@@ -73,6 +121,12 @@ function parseTasks(node) {
|
|
|
73
121
|
}
|
|
74
122
|
/**
|
|
75
123
|
* Format the status for spec output: "proposed" -> "Draft", etc.
|
|
124
|
+
* @param status - The node status string.
|
|
125
|
+
* @returns Formatted status label.
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* formatStatus("proposed"); // => "Draft"
|
|
129
|
+
* ```
|
|
76
130
|
*/
|
|
77
131
|
function formatStatus(status) {
|
|
78
132
|
if (!status)
|
|
@@ -87,7 +141,16 @@ function formatStatus(status) {
|
|
|
87
141
|
// ============================================================================
|
|
88
142
|
// generate Constitution
|
|
89
143
|
// ============================================================================
|
|
90
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* Generate a Spec-Kit constitution file from a SysProM document's principles and invariants.
|
|
146
|
+
* @param doc - The SysProM document.
|
|
147
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
148
|
+
* @returns The generated markdown.
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* const md = generateConstitution(doc, "FEAT");
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
91
154
|
export function generateConstitution(doc, prefix) {
|
|
92
155
|
const protocolId = `${prefix}-CONST`;
|
|
93
156
|
const protocol = findNode(doc, protocolId);
|
|
@@ -160,7 +223,16 @@ export function generateConstitution(doc, prefix) {
|
|
|
160
223
|
// ============================================================================
|
|
161
224
|
// generateSpec
|
|
162
225
|
// ============================================================================
|
|
163
|
-
/**
|
|
226
|
+
/**
|
|
227
|
+
* Generate a Spec-Kit specification file from a SysProM document's user stories, FRs, and acceptance criteria.
|
|
228
|
+
* @param doc - The SysProM document.
|
|
229
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
230
|
+
* @returns The generated markdown.
|
|
231
|
+
* @example
|
|
232
|
+
* ```ts
|
|
233
|
+
* const md = generateSpec(doc, "FEAT");
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
164
236
|
export function generateSpec(doc, prefix) {
|
|
165
237
|
const specId = `${prefix}-SPEC`;
|
|
166
238
|
const spec = findNode(doc, specId);
|
|
@@ -274,7 +346,16 @@ export function generateSpec(doc, prefix) {
|
|
|
274
346
|
// ============================================================================
|
|
275
347
|
// generatePlan
|
|
276
348
|
// ============================================================================
|
|
277
|
-
/**
|
|
349
|
+
/**
|
|
350
|
+
* Generate a Spec-Kit plan file from a SysProM document's phases and milestones.
|
|
351
|
+
* @param doc - The SysProM document.
|
|
352
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
353
|
+
* @returns The generated markdown.
|
|
354
|
+
* @example
|
|
355
|
+
* ```ts
|
|
356
|
+
* const md = generatePlan(doc, "FEAT");
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
278
359
|
export function generatePlan(doc, prefix) {
|
|
279
360
|
const implProtocolId = `${prefix}-PROT-IMPL`;
|
|
280
361
|
const protocol = findNode(doc, implProtocolId);
|
|
@@ -325,7 +406,16 @@ export function generatePlan(doc, prefix) {
|
|
|
325
406
|
// ============================================================================
|
|
326
407
|
// generateTasks
|
|
327
408
|
// ============================================================================
|
|
328
|
-
/**
|
|
409
|
+
/**
|
|
410
|
+
* Generate a Spec-Kit tasks file from a SysProM document's change nodes.
|
|
411
|
+
* @param doc - The SysProM document.
|
|
412
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
413
|
+
* @returns The generated markdown.
|
|
414
|
+
* @example
|
|
415
|
+
* ```ts
|
|
416
|
+
* const md = generateTasks(doc, "FEAT");
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
329
419
|
export function generateTasks(doc, prefix) {
|
|
330
420
|
const implProtocolId = `${prefix}-PROT-IMPL`;
|
|
331
421
|
const protocol = findNode(doc, implProtocolId);
|
|
@@ -465,7 +555,16 @@ export function generateTasks(doc, prefix) {
|
|
|
465
555
|
// ============================================================================
|
|
466
556
|
// generateChecklist
|
|
467
557
|
// ============================================================================
|
|
468
|
-
/**
|
|
558
|
+
/**
|
|
559
|
+
* Generate a Spec-Kit checklist file from a SysProM document's gate nodes.
|
|
560
|
+
* @param doc - The SysProM document.
|
|
561
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
562
|
+
* @returns The generated markdown.
|
|
563
|
+
* @example
|
|
564
|
+
* ```ts
|
|
565
|
+
* const md = generateChecklist(doc, "FEAT");
|
|
566
|
+
* ```
|
|
567
|
+
*/
|
|
469
568
|
export function generateChecklist(doc, prefix) {
|
|
470
569
|
const gateId = `${prefix}-CHK`;
|
|
471
570
|
const gate = findNode(doc, gateId);
|
|
@@ -520,7 +619,16 @@ export function generateChecklist(doc, prefix) {
|
|
|
520
619
|
// ============================================================================
|
|
521
620
|
// generateSpecKitProject
|
|
522
621
|
// ============================================================================
|
|
523
|
-
/**
|
|
622
|
+
/**
|
|
623
|
+
* Generate a complete Spec-Kit project directory from a SysProM document — constitution, spec, plan, tasks, and checklist files.
|
|
624
|
+
* @param doc - The SysProM document.
|
|
625
|
+
* @param outputDir - Output directory path.
|
|
626
|
+
* @param prefix - ID prefix identifying nodes to include.
|
|
627
|
+
* @example
|
|
628
|
+
* ```ts
|
|
629
|
+
* generateSpecKitProject(doc, "./output", "FEAT");
|
|
630
|
+
* ```
|
|
631
|
+
*/
|
|
524
632
|
export function generateSpecKitProject(doc, outputDir, prefix) {
|
|
525
633
|
// Create output directory if it doesn't exist
|
|
526
634
|
mkdirSync(outputDir, { recursive: true });
|
|
@@ -6,15 +6,70 @@ export interface ParseResult {
|
|
|
6
6
|
/** Relationships extracted from the parsed content. */
|
|
7
7
|
relationships: Relationship[];
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Parse a Spec-Kit constitution file into SysProM nodes (principles and invariants) and relationships.
|
|
11
|
+
* @param content - Markdown file content.
|
|
12
|
+
* @param idPrefix - ID prefix for generated nodes.
|
|
13
|
+
* @returns The result.
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const result = parseConstitution(content, "FEAT");
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
10
19
|
export declare function parseConstitution(content: string, idPrefix: string): ParseResult;
|
|
11
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Parse a Spec-Kit specification file into SysProM nodes (user stories, functional requirements, acceptance criteria).
|
|
22
|
+
* @param content - Markdown file content.
|
|
23
|
+
* @param idPrefix - ID prefix for generated nodes.
|
|
24
|
+
* @returns The result.
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const result = parseSpec(content, "FEAT");
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
12
30
|
export declare function parseSpec(content: string, idPrefix: string): ParseResult;
|
|
13
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Parse a Spec-Kit plan file into SysProM nodes (phases, milestones) and relationships.
|
|
33
|
+
* @param content - Markdown file content.
|
|
34
|
+
* @param idPrefix - ID prefix for generated nodes.
|
|
35
|
+
* @returns The result.
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const result = parsePlan(content, "FEAT");
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
14
41
|
export declare function parsePlan(content: string, idPrefix: string): ParseResult;
|
|
15
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Parse a Spec-Kit tasks file into SysProM change nodes with task plans.
|
|
44
|
+
* @param content - Markdown file content.
|
|
45
|
+
* @param idPrefix - ID prefix for generated nodes.
|
|
46
|
+
* @returns The result.
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const result = parseTasks(content, "FEAT");
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
16
52
|
export declare function parseTasks(content: string, idPrefix: string): ParseResult;
|
|
17
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Parse a Spec-Kit checklist file into SysProM gate nodes with task plans.
|
|
55
|
+
* @param content - Markdown file content.
|
|
56
|
+
* @param idPrefix - ID prefix for generated nodes.
|
|
57
|
+
* @returns The result.
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const result = parseChecklist(content, "FEAT");
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
18
63
|
export declare function parseChecklist(content: string, idPrefix: string): ParseResult;
|
|
19
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Parse an entire Spec-Kit feature directory into a SysProM document, combining constitution, spec, plan, tasks, and checklist.
|
|
66
|
+
* @param featureDir - Path to Spec-Kit feature directory.
|
|
67
|
+
* @param idPrefix - ID prefix for generated nodes.
|
|
68
|
+
* @param constitutionPath - Path to constitution.md, or undefined.
|
|
69
|
+
* @returns The parsed SysProM document.
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const doc = parseSpecKitFeature("./features/auth", "AUTH");
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
20
75
|
export declare function parseSpecKitFeature(featureDir: string, idPrefix: string, constitutionPath?: string): SysProMDocument;
|