sysprom 1.0.0 → 1.0.6

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 (148) hide show
  1. package/README.md +207 -0
  2. package/dist/schema.json +510 -0
  3. package/dist/src/canonical-json.d.ts +23 -0
  4. package/dist/src/canonical-json.js +120 -0
  5. package/dist/src/cli/commands/add.d.ts +22 -0
  6. package/dist/src/cli/commands/add.js +95 -0
  7. package/dist/src/cli/commands/check.d.ts +10 -0
  8. package/dist/src/cli/commands/check.js +33 -0
  9. package/dist/src/cli/commands/graph.d.ts +15 -0
  10. package/dist/src/cli/commands/graph.js +32 -0
  11. package/dist/src/cli/commands/init.d.ts +2 -0
  12. package/dist/src/cli/commands/init.js +44 -0
  13. package/dist/src/cli/commands/json2md.d.ts +2 -0
  14. package/dist/src/cli/commands/json2md.js +60 -0
  15. package/dist/src/cli/commands/md2json.d.ts +2 -0
  16. package/dist/src/cli/commands/md2json.js +29 -0
  17. package/dist/src/cli/commands/plan.d.ts +2 -0
  18. package/dist/src/cli/commands/plan.js +227 -0
  19. package/dist/src/cli/commands/query.d.ts +2 -0
  20. package/dist/src/cli/commands/query.js +275 -0
  21. package/dist/src/cli/commands/remove.d.ts +13 -0
  22. package/dist/src/cli/commands/remove.js +50 -0
  23. package/dist/src/cli/commands/rename.d.ts +14 -0
  24. package/dist/src/cli/commands/rename.js +34 -0
  25. package/dist/src/cli/commands/search.d.ts +11 -0
  26. package/dist/src/cli/commands/search.js +37 -0
  27. package/dist/src/cli/commands/speckit.d.ts +2 -0
  28. package/dist/src/cli/commands/speckit.js +318 -0
  29. package/dist/src/cli/commands/stats.d.ts +10 -0
  30. package/dist/src/cli/commands/stats.js +51 -0
  31. package/dist/src/cli/commands/task.d.ts +2 -0
  32. package/dist/src/cli/commands/task.js +162 -0
  33. package/dist/src/cli/commands/update.d.ts +2 -0
  34. package/dist/src/cli/commands/update.js +219 -0
  35. package/dist/src/cli/commands/validate.d.ts +10 -0
  36. package/dist/src/cli/commands/validate.js +30 -0
  37. package/dist/src/cli/define-command.d.ts +34 -0
  38. package/dist/src/cli/define-command.js +237 -0
  39. package/dist/src/cli/index.d.ts +2 -0
  40. package/dist/src/cli/index.js +3 -0
  41. package/dist/src/cli/program.d.ts +4 -0
  42. package/dist/src/cli/program.js +46 -0
  43. package/dist/src/cli/shared.d.ts +26 -0
  44. package/dist/src/cli/shared.js +41 -0
  45. package/dist/src/generate-schema.d.ts +1 -0
  46. package/dist/src/generate-schema.js +9 -0
  47. package/dist/src/index.d.ts +48 -0
  48. package/dist/src/index.js +99 -0
  49. package/dist/src/io.d.ts +22 -0
  50. package/dist/src/io.js +66 -0
  51. package/dist/src/json-to-md.d.ts +26 -0
  52. package/dist/src/json-to-md.js +498 -0
  53. package/dist/src/md-to-json.d.ts +22 -0
  54. package/dist/src/md-to-json.js +548 -0
  55. package/dist/src/operations/add-node.d.ts +887 -0
  56. package/dist/src/operations/add-node.js +21 -0
  57. package/dist/src/operations/add-plan-task.d.ts +594 -0
  58. package/dist/src/operations/add-plan-task.js +25 -0
  59. package/dist/src/operations/add-relationship.d.ts +635 -0
  60. package/dist/src/operations/add-relationship.js +25 -0
  61. package/dist/src/operations/check.d.ts +301 -0
  62. package/dist/src/operations/check.js +66 -0
  63. package/dist/src/operations/define-operation.d.ts +14 -0
  64. package/dist/src/operations/define-operation.js +21 -0
  65. package/dist/src/operations/graph.d.ts +303 -0
  66. package/dist/src/operations/graph.js +71 -0
  67. package/dist/src/operations/index.d.ts +38 -0
  68. package/dist/src/operations/index.js +45 -0
  69. package/dist/src/operations/init-document.d.ts +299 -0
  70. package/dist/src/operations/init-document.js +26 -0
  71. package/dist/src/operations/json-to-markdown.d.ts +298 -0
  72. package/dist/src/operations/json-to-markdown.js +13 -0
  73. package/dist/src/operations/mark-task-done.d.ts +594 -0
  74. package/dist/src/operations/mark-task-done.js +26 -0
  75. package/dist/src/operations/mark-task-undone.d.ts +594 -0
  76. package/dist/src/operations/mark-task-undone.js +26 -0
  77. package/dist/src/operations/markdown-to-json.d.ts +298 -0
  78. package/dist/src/operations/markdown-to-json.js +13 -0
  79. package/dist/src/operations/next-id.d.ts +322 -0
  80. package/dist/src/operations/next-id.js +29 -0
  81. package/dist/src/operations/node-history.d.ts +313 -0
  82. package/dist/src/operations/node-history.js +55 -0
  83. package/dist/src/operations/plan-add-task.d.ts +595 -0
  84. package/dist/src/operations/plan-add-task.js +18 -0
  85. package/dist/src/operations/plan-gate.d.ts +351 -0
  86. package/dist/src/operations/plan-gate.js +41 -0
  87. package/dist/src/operations/plan-init.d.ts +299 -0
  88. package/dist/src/operations/plan-init.js +17 -0
  89. package/dist/src/operations/plan-progress.d.ts +313 -0
  90. package/dist/src/operations/plan-progress.js +23 -0
  91. package/dist/src/operations/plan-status.d.ts +349 -0
  92. package/dist/src/operations/plan-status.js +41 -0
  93. package/dist/src/operations/query-node.d.ts +1065 -0
  94. package/dist/src/operations/query-node.js +27 -0
  95. package/dist/src/operations/query-nodes.d.ts +594 -0
  96. package/dist/src/operations/query-nodes.js +23 -0
  97. package/dist/src/operations/query-relationships.d.ts +343 -0
  98. package/dist/src/operations/query-relationships.js +27 -0
  99. package/dist/src/operations/remove-node.d.ts +895 -0
  100. package/dist/src/operations/remove-node.js +58 -0
  101. package/dist/src/operations/remove-relationship.d.ts +622 -0
  102. package/dist/src/operations/remove-relationship.js +26 -0
  103. package/dist/src/operations/rename.d.ts +594 -0
  104. package/dist/src/operations/rename.js +113 -0
  105. package/dist/src/operations/search.d.ts +593 -0
  106. package/dist/src/operations/search.js +39 -0
  107. package/dist/src/operations/speckit-diff.d.ts +330 -0
  108. package/dist/src/operations/speckit-diff.js +89 -0
  109. package/dist/src/operations/speckit-export.d.ts +300 -0
  110. package/dist/src/operations/speckit-export.js +17 -0
  111. package/dist/src/operations/speckit-import.d.ts +299 -0
  112. package/dist/src/operations/speckit-import.js +39 -0
  113. package/dist/src/operations/speckit-sync.d.ts +900 -0
  114. package/dist/src/operations/speckit-sync.js +116 -0
  115. package/dist/src/operations/state-at.d.ts +309 -0
  116. package/dist/src/operations/state-at.js +53 -0
  117. package/dist/src/operations/stats.d.ts +324 -0
  118. package/dist/src/operations/stats.js +85 -0
  119. package/dist/src/operations/task-list.d.ts +305 -0
  120. package/dist/src/operations/task-list.js +44 -0
  121. package/dist/src/operations/timeline.d.ts +312 -0
  122. package/dist/src/operations/timeline.js +46 -0
  123. package/dist/src/operations/trace-from-node.d.ts +1197 -0
  124. package/dist/src/operations/trace-from-node.js +36 -0
  125. package/dist/src/operations/update-metadata.d.ts +593 -0
  126. package/dist/src/operations/update-metadata.js +18 -0
  127. package/dist/src/operations/update-node.d.ts +957 -0
  128. package/dist/src/operations/update-node.js +24 -0
  129. package/dist/src/operations/update-plan-task.d.ts +595 -0
  130. package/dist/src/operations/update-plan-task.js +31 -0
  131. package/dist/src/operations/validate.d.ts +310 -0
  132. package/dist/src/operations/validate.js +82 -0
  133. package/dist/src/schema.d.ts +891 -0
  134. package/dist/src/schema.js +356 -0
  135. package/dist/src/speckit/generate.d.ts +7 -0
  136. package/dist/src/speckit/generate.js +546 -0
  137. package/dist/src/speckit/index.d.ts +4 -0
  138. package/dist/src/speckit/index.js +4 -0
  139. package/dist/src/speckit/parse.d.ts +11 -0
  140. package/dist/src/speckit/parse.js +712 -0
  141. package/dist/src/speckit/plan.d.ts +125 -0
  142. package/dist/src/speckit/plan.js +636 -0
  143. package/dist/src/speckit/project.d.ts +39 -0
  144. package/dist/src/speckit/project.js +141 -0
  145. package/dist/src/text.d.ts +23 -0
  146. package/dist/src/text.js +32 -0
  147. package/package.json +86 -8
  148. package/schema.json +510 -0
@@ -0,0 +1,125 @@
1
+ import type { SysProMDocument, Node } from "../schema.js";
2
+ export interface PlanStatus {
3
+ constitution: {
4
+ defined: boolean;
5
+ principleCount: number;
6
+ };
7
+ spec: {
8
+ defined: boolean;
9
+ userStoryCount: number;
10
+ storiesNeedingAcceptanceCriteria: string[];
11
+ };
12
+ plan: {
13
+ defined: boolean;
14
+ phaseCount: number;
15
+ };
16
+ tasks: {
17
+ total: number;
18
+ done: number;
19
+ };
20
+ checklist: {
21
+ defined: boolean;
22
+ total: number;
23
+ done: number;
24
+ };
25
+ nextStep: string;
26
+ }
27
+ export interface PhaseProgress {
28
+ phase: number;
29
+ name: string;
30
+ done: number;
31
+ total: number;
32
+ percent: number;
33
+ }
34
+ export type GateIssue = {
35
+ kind: "previous_tasks_incomplete";
36
+ phase: number;
37
+ remaining: number;
38
+ } | {
39
+ kind: "user_story_no_change";
40
+ storyId: string;
41
+ } | {
42
+ kind: "user_story_no_acceptance_criteria";
43
+ storyId: string;
44
+ } | {
45
+ kind: "fr_no_change";
46
+ frId: string;
47
+ };
48
+ export interface GateResult {
49
+ phase: number;
50
+ ready: boolean;
51
+ issues: GateIssue[];
52
+ }
53
+ export interface TaskCount {
54
+ total: number;
55
+ done: number;
56
+ }
57
+ /**
58
+ * Scaffold a new SysProMDocument with the standard spec-kit-compatible node
59
+ * structure for a given prefix and name.
60
+ *
61
+ * Creates four skeleton nodes:
62
+ * - {prefix}-CONST protocol (constitution)
63
+ * - {prefix}-SPEC artefact (specification)
64
+ * - {prefix}-PROT-IMPL protocol (implementation plan) — with empty subsystem
65
+ * - {prefix}-CHK gate (checklist)
66
+ *
67
+ * Relationships wired:
68
+ * - {prefix}-SPEC governed_by {prefix}-CONST
69
+ * - {prefix}-CHK governed_by {prefix}-PROT-IMPL
70
+ *
71
+ * Tasks are not pre-scaffolded; use addTask to add them.
72
+ */
73
+ export declare function initDocument(prefix: string, name: string): SysProMDocument;
74
+ /**
75
+ * Immutably add a new task (change node) to PROT-IMPL.subsystem or to a parent
76
+ * change node's subsystem.
77
+ *
78
+ * - If parentId is not provided: adds CHG-{N} to PROT-IMPL.subsystem
79
+ * (where N = count of existing change nodes + 1)
80
+ * - If parentId is provided: recursively finds parent change node, adds {parentId}-{M}
81
+ * to parent's subsystem (creating subsystem if needed, where M = count of existing
82
+ * change children + 1)
83
+ *
84
+ * Wires must_follow to previous sibling change node at the same level.
85
+ * Default name: "Task N".
86
+ */
87
+ export declare function addTask(doc: SysProMDocument, prefix: string, name?: string, parentId?: string): SysProMDocument;
88
+ /**
89
+ * Check if a change node's task is complete.
90
+ *
91
+ * If no subsystem or no change children in subsystem:
92
+ * - All items in node.plan must have done === true AND at least one item must exist
93
+ * If subsystem has change children:
94
+ * - All children must be recursively done AND own plan items (if any) must be done
95
+ */
96
+ export declare function isTaskDone(node: Node): boolean;
97
+ /**
98
+ * Count total and completed tasks within a change node.
99
+ *
100
+ * Sums plan[] items from this node and recursively from all change nodes in
101
+ * subsystem (and their subsystems).
102
+ */
103
+ export declare function countTasks(node: Node): TaskCount;
104
+ /**
105
+ * Inspect a document and return workflow completeness for a given prefix.
106
+ * Never throws — missing nodes are reported as "not defined".
107
+ */
108
+ export declare function planStatus(doc: SysProMDocument, prefix: string): PlanStatus;
109
+ /**
110
+ * Return per-task completion data.
111
+ * Tasks (change nodes) are discovered from PROT-IMPL.subsystem, sorted topologically.
112
+ */
113
+ export declare function planProgress(doc: SysProMDocument, prefix: string): PhaseProgress[];
114
+ /**
115
+ * Validate readiness to enter the given phase (1-indexed).
116
+ *
117
+ * Always checks:
118
+ * - Each capability ({prefix}-US-*) has a change node that implements it
119
+ * - Each capability has non-placeholder acceptance criteria
120
+ * - Each invariant ({prefix}-FR-*) has a change node that implements it
121
+ *
122
+ * Additionally for phase N > 1:
123
+ * - All tasks in phase N-1 must be done
124
+ */
125
+ export declare function checkGate(doc: SysProMDocument, prefix: string, phase: number): GateResult;