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
package/README.md ADDED
@@ -0,0 +1,207 @@
1
+ # SysProM — System Provenance Model
2
+
3
+ /sɪs.prɒm/
4
+
5
+ A recursive, decision-driven model for recording where every part of a system came from, what decisions shaped it, and how it reached its current form.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ # From npm (when published)
11
+ npm install -g sysprom
12
+
13
+ # From GitHub
14
+ npm install -g github:ExaDev/SysProM
15
+
16
+ # Or use without installing
17
+ npx sysprom --help
18
+ ```
19
+
20
+ Both `sysprom` and `spm` are available as commands.
21
+
22
+ ## CLI
23
+
24
+ ```sh
25
+ # Convert between formats
26
+ spm json2md sysprom.spm.json ./SysProM
27
+ spm md2json ./SysProM output.spm.json
28
+
29
+ # Validate and summarise
30
+ spm validate sysprom.spm.json
31
+ spm stats sysprom.spm.json
32
+
33
+ # Query nodes and relationships
34
+ spm query nodes sysprom.spm.json --type decision
35
+ spm query node sysprom.spm.json D1
36
+ spm query rels sysprom.spm.json --from D1
37
+ spm query trace sysprom.spm.json I1
38
+ spm query timeline sysprom.spm.json
39
+ spm query state-at sysprom.spm.json --time 2026-03-22
40
+
41
+ # Add nodes (ID auto-generated from type prefix if --id omitted)
42
+ spm add sysprom.spm.json invariant --name "New Rule" --description "Must hold"
43
+ spm add sysprom.spm.json decision --name "Choose X" \
44
+ --option "OPT-A:Use framework X" --option "OPT-B:Use framework Y" \
45
+ --selected OPT-A --rationale "Lower migration effort"
46
+
47
+ # Remove nodes
48
+ spm remove sysprom.spm.json INV23
49
+
50
+ # Update nodes, relationships, and metadata
51
+ spm update node sysprom.spm.json D1 --status deprecated
52
+ spm update add-rel sysprom.spm.json D1 affects EL5
53
+ spm update remove-rel sysprom.spm.json D1 affects EL5
54
+ spm update meta sysprom.spm.json --meta version=2
55
+ ```
56
+
57
+ All commands auto-detect format — they work on `.spm.json` files, `.spm.md` files, and multi-document folders.
58
+
59
+ ## Programmatic API
60
+
61
+ ```ts
62
+ import {
63
+ // Schema and types
64
+ sysproMDocument,
65
+ node,
66
+ nodeType,
67
+ relationshipType,
68
+ type SysProMDocument,
69
+ type Node,
70
+ type Relationship,
71
+
72
+ // Conversion
73
+ jsonToMarkdown,
74
+ jsonToMarkdownSingle,
75
+ jsonToMarkdownMultiDoc,
76
+ markdownToJson,
77
+
78
+ // Validation and query
79
+ validate,
80
+ stats,
81
+ queryNodes,
82
+ queryNode,
83
+ queryRelationships,
84
+ traceFromNode,
85
+
86
+ // Mutation
87
+ addNode,
88
+ removeNode,
89
+ updateNode,
90
+ addRelationship,
91
+ removeRelationship,
92
+ updateMetadata,
93
+
94
+ // File I/O
95
+ loadDocument,
96
+ saveDocument,
97
+
98
+ // Utilities
99
+ canonicalise,
100
+ toJSONSchema,
101
+ } from "sysprom";
102
+
103
+ // Validate
104
+ const doc = JSON.parse(fs.readFileSync("sysprom.spm.json", "utf8"));
105
+ const result = validate(doc);
106
+ console.log(result.valid, result.issues);
107
+
108
+ // Query
109
+ const decisions = queryNodes(doc, { type: "decision" });
110
+ const trace = traceFromNode(doc, "I1");
111
+
112
+ // Mutate
113
+ const updated = addNode(doc, { id: "INV23", type: "invariant", name: "New Rule" });
114
+ const withRel = addRelationship(updated, { from: "D1", to: "INV23", type: "must_preserve" });
115
+
116
+ // Type guards
117
+ if (sysproMDocument.is(data)) { /* data is SysProMDocument */ }
118
+ if (node.is(thing)) { /* thing is Node */ }
119
+ ```
120
+
121
+ ## What is SysProM?
122
+
123
+ SysProM models systems as directed graphs across abstraction layers — intent, concept, capability, structure, and realisation — with explicit decisions, changes, and invariants. It is domain-agnostic, format-agnostic, and recursively composable.
124
+
125
+ ## How SysProM Compares
126
+
127
+ | System | Readable | Parseable | State | Rationale | History | Constraints | Nesting | Diagrams | Inference | Impact | Temporal | Scaffolding | Planning | Tracking |
128
+ |--------|----------|-----------|-------|-----------|---------|-------------|---------|----------|-----------|--------|----------|-------------|----------|----------|
129
+ | [MBSE (SysML)](https://www.omg.org/spec/SysML/) | 🔶 | ✅ | ✅ | 🔶 | 🔶 | ✅ | ✅ | ✅ | | ✅ | | | | |
130
+ | [Knowledge Graphs](https://www.w3.org/TR/rdf12-concepts/) | | ✅ | ✅ | | | 🔶 | ✅ | 🔶 | ✅ | | | | | |
131
+ | [EA (ArchiMate)](https://pubs.opengroup.org/architecture/archimate-spec/) | ✅ | 🔶 | ✅ | | | 🔶 | 🔶 | ✅ | | ✅ | | | | |
132
+ | [Git](https://git-scm.com/) | 🔶 | ✅ | ✅ | | ✅ | | | | | | ✅ | | | 🔶 |
133
+ | [Event Sourcing](https://martinfowler.com/eaaDev/EventSourcing.html) | | ✅ | 🔶 | | ✅ | 🔶 | | | | | ✅ | | | |
134
+ | [DDD](https://www.domainlanguage.com/ddd/) | ✅ | | ✅ | | | 🔶 | 🔶 | | | | | | | |
135
+ | [C4](https://c4model.com/) | ✅ | | ✅ | | | | 🔶 | ✅ | | | | | | |
136
+ | [Traceability Matrices](https://en.wikipedia.org/wiki/Traceability_matrix) | ✅ | | ✅ | | | 🔶 | | | | 🔶 | | | | 🔶 |
137
+ | [Spec Kit](https://github.com/github/spec-kit) | ✅ | | ✅ | 🔶 | 🔶 | | 🔶 | | | | | ✅ | ✅ | ✅ |
138
+ | [ADR](https://adr.github.io/) | ✅ | | | ✅ | 🔶 | | | | | | | | | |
139
+ | [RFC Processes](https://www.rfc-editor.org/rfc/rfc2026) | ✅ | | | ✅ | 🔶 | | | | | | | | 🔶 | 🔶 |
140
+ | [Ralplan](https://github.com/yeachan-heo/oh-my-claudecode/blob/main/skills/ralplan/SKILL.md) | ✅ | | 🔶 | ✅ | | 🔶 | | | | | | | ✅ | 🔶 |
141
+ | [GSD](https://github.com/gsd-build/get-shit-done) | ✅ | | | 🔶 | | 🔶 | | | | | | | | |
142
+ | **SysProM** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🔶 | | 🔶 | ✅ | ✅ | ✅ | ✅ |
143
+
144
+ ✅ = first-class support. 🔶 = partial or implicit.
145
+
146
+ ## Key Concepts
147
+
148
+ **Nodes** — typed entities (intent, concept, capability, element, realisation, invariant, principle, policy, protocol, stage, role, gate, mode, artefact, decision, change, view)
149
+
150
+ **Relationships** — typed directed edges (refines, realises, implements, depends_on, affects, supersedes, must_preserve, and 17 others)
151
+
152
+ **Invariants** — rules that must hold across all valid system states
153
+
154
+ **Decisions** — choices between alternatives, with context, options, rationale, and must_preserve links to invariants (required when affecting domain nodes)
155
+
156
+ **Changes** — modifications to the system, linked to decisions, with scope, operations, and lifecycle tracking
157
+
158
+ **Subsystems** — any node can contain a nested SysProM graph, using the same structure recursively
159
+
160
+ ## Serialisation
161
+
162
+ SysProM is format-agnostic. This repository includes:
163
+
164
+ - **JSON** — validated against `schema.json`, supports recursive subsystems
165
+ - **Markdown** — single file (`.spm.md`), multi-document folder, or recursive nested folders with automatic grouping by type
166
+
167
+ Round-trip conversion between JSON and Markdown is supported with zero information loss.
168
+
169
+ ## Development
170
+
171
+ ```sh
172
+ pnpm build # Typecheck + compile + schema + docs (cached via Turbo)
173
+ pnpm typecheck # Type-check only
174
+ pnpm compile # Compile to dist/
175
+ pnpm test # Typecheck + run all tests
176
+ pnpm test:coverage # Tests with coverage report
177
+ pnpm docs # Generate API + CLI markdown docs
178
+ pnpm docs:html # Generate HTML site for GitHub Pages
179
+ pnpm docs:serve # Live-reload HTML docs during development
180
+ pnpm spm <command> # Run the CLI from source (e.g. pnpm spm validate ...)
181
+ ```
182
+
183
+ ## Self-Description
184
+
185
+ `sysprom.spm.json` is SysProM describing itself — the specification, its decisions, invariants, changes, and worked examples are all encoded as a SysProM document. The `./SysProM/` folder contains the same content as human-readable Markdown.
186
+
187
+ All significant activity — decisions, changes, new capabilities, and invariants — should be recorded in the self-describing document. Updates can be made either by editing the Markdown files in `./SysProM/` directly or by using the CLI:
188
+
189
+ ```sh
190
+ # Add a decision via the CLI
191
+ spm add sysprom.spm.json decision --id D23 --name "My Decision" --context "Why this was needed"
192
+
193
+ # Or edit ./SysProM/DECISIONS.md directly, then sync
194
+ spm md2json ./SysProM sysprom.spm.json
195
+ ```
196
+
197
+ Keep both representations in sync after any change:
198
+
199
+ ```sh
200
+ # JSON → Markdown
201
+ spm json2md sysprom.spm.json ./SysProM
202
+
203
+ # Markdown → JSON
204
+ spm md2json ./SysProM sysprom.spm.json
205
+ ```
206
+
207
+ > **Important:** Always keep `sysprom.spm.json` and `./SysProM/` up to date with current activity and in sync with each other. Record all decisions, changes, and new capabilities as they happen. After any change to either representation, run the appropriate conversion command above. Validate with `spm validate sysprom.spm.json` before committing.