sysprom 1.0.0 → 1.0.5
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 +207 -0
- package/dist/schema.json +510 -0
- package/dist/src/canonical-json.d.ts +23 -0
- package/dist/src/canonical-json.js +120 -0
- package/dist/src/cli/commands/add.d.ts +22 -0
- package/dist/src/cli/commands/add.js +95 -0
- package/dist/src/cli/commands/check.d.ts +10 -0
- package/dist/src/cli/commands/check.js +33 -0
- package/dist/src/cli/commands/graph.d.ts +15 -0
- package/dist/src/cli/commands/graph.js +32 -0
- package/dist/src/cli/commands/init.d.ts +2 -0
- package/dist/src/cli/commands/init.js +44 -0
- package/dist/src/cli/commands/json2md.d.ts +2 -0
- package/dist/src/cli/commands/json2md.js +60 -0
- package/dist/src/cli/commands/md2json.d.ts +2 -0
- package/dist/src/cli/commands/md2json.js +29 -0
- package/dist/src/cli/commands/plan.d.ts +2 -0
- package/dist/src/cli/commands/plan.js +227 -0
- package/dist/src/cli/commands/query.d.ts +2 -0
- package/dist/src/cli/commands/query.js +275 -0
- package/dist/src/cli/commands/remove.d.ts +13 -0
- package/dist/src/cli/commands/remove.js +50 -0
- package/dist/src/cli/commands/rename.d.ts +14 -0
- package/dist/src/cli/commands/rename.js +34 -0
- package/dist/src/cli/commands/search.d.ts +11 -0
- package/dist/src/cli/commands/search.js +37 -0
- package/dist/src/cli/commands/speckit.d.ts +2 -0
- package/dist/src/cli/commands/speckit.js +318 -0
- package/dist/src/cli/commands/stats.d.ts +10 -0
- package/dist/src/cli/commands/stats.js +51 -0
- package/dist/src/cli/commands/task.d.ts +2 -0
- package/dist/src/cli/commands/task.js +162 -0
- package/dist/src/cli/commands/update.d.ts +2 -0
- package/dist/src/cli/commands/update.js +219 -0
- package/dist/src/cli/commands/validate.d.ts +10 -0
- package/dist/src/cli/commands/validate.js +30 -0
- package/dist/src/cli/define-command.d.ts +34 -0
- package/dist/src/cli/define-command.js +237 -0
- package/dist/src/cli/index.d.ts +2 -0
- package/dist/src/cli/index.js +3 -0
- package/dist/src/cli/program.d.ts +4 -0
- package/dist/src/cli/program.js +46 -0
- package/dist/src/cli/shared.d.ts +26 -0
- package/dist/src/cli/shared.js +41 -0
- package/dist/src/generate-schema.d.ts +1 -0
- package/dist/src/generate-schema.js +9 -0
- package/dist/src/index.d.ts +48 -0
- package/dist/src/index.js +99 -0
- package/dist/src/io.d.ts +22 -0
- package/dist/src/io.js +66 -0
- package/dist/src/json-to-md.d.ts +26 -0
- package/dist/src/json-to-md.js +498 -0
- package/dist/src/md-to-json.d.ts +22 -0
- package/dist/src/md-to-json.js +548 -0
- package/dist/src/operations/add-node.d.ts +887 -0
- package/dist/src/operations/add-node.js +21 -0
- package/dist/src/operations/add-plan-task.d.ts +594 -0
- package/dist/src/operations/add-plan-task.js +25 -0
- package/dist/src/operations/add-relationship.d.ts +635 -0
- package/dist/src/operations/add-relationship.js +25 -0
- package/dist/src/operations/check.d.ts +301 -0
- package/dist/src/operations/check.js +66 -0
- package/dist/src/operations/define-operation.d.ts +14 -0
- package/dist/src/operations/define-operation.js +21 -0
- package/dist/src/operations/graph.d.ts +303 -0
- package/dist/src/operations/graph.js +71 -0
- package/dist/src/operations/index.d.ts +38 -0
- package/dist/src/operations/index.js +45 -0
- package/dist/src/operations/init-document.d.ts +299 -0
- package/dist/src/operations/init-document.js +26 -0
- package/dist/src/operations/json-to-markdown.d.ts +298 -0
- package/dist/src/operations/json-to-markdown.js +13 -0
- package/dist/src/operations/mark-task-done.d.ts +594 -0
- package/dist/src/operations/mark-task-done.js +26 -0
- package/dist/src/operations/mark-task-undone.d.ts +594 -0
- package/dist/src/operations/mark-task-undone.js +26 -0
- package/dist/src/operations/markdown-to-json.d.ts +298 -0
- package/dist/src/operations/markdown-to-json.js +13 -0
- package/dist/src/operations/next-id.d.ts +322 -0
- package/dist/src/operations/next-id.js +29 -0
- package/dist/src/operations/node-history.d.ts +313 -0
- package/dist/src/operations/node-history.js +55 -0
- package/dist/src/operations/plan-add-task.d.ts +595 -0
- package/dist/src/operations/plan-add-task.js +18 -0
- package/dist/src/operations/plan-gate.d.ts +351 -0
- package/dist/src/operations/plan-gate.js +41 -0
- package/dist/src/operations/plan-init.d.ts +299 -0
- package/dist/src/operations/plan-init.js +17 -0
- package/dist/src/operations/plan-progress.d.ts +313 -0
- package/dist/src/operations/plan-progress.js +23 -0
- package/dist/src/operations/plan-status.d.ts +349 -0
- package/dist/src/operations/plan-status.js +41 -0
- package/dist/src/operations/query-node.d.ts +1065 -0
- package/dist/src/operations/query-node.js +27 -0
- package/dist/src/operations/query-nodes.d.ts +594 -0
- package/dist/src/operations/query-nodes.js +23 -0
- package/dist/src/operations/query-relationships.d.ts +343 -0
- package/dist/src/operations/query-relationships.js +27 -0
- package/dist/src/operations/remove-node.d.ts +895 -0
- package/dist/src/operations/remove-node.js +58 -0
- package/dist/src/operations/remove-relationship.d.ts +622 -0
- package/dist/src/operations/remove-relationship.js +26 -0
- package/dist/src/operations/rename.d.ts +594 -0
- package/dist/src/operations/rename.js +113 -0
- package/dist/src/operations/search.d.ts +593 -0
- package/dist/src/operations/search.js +39 -0
- package/dist/src/operations/speckit-diff.d.ts +330 -0
- package/dist/src/operations/speckit-diff.js +89 -0
- package/dist/src/operations/speckit-export.d.ts +300 -0
- package/dist/src/operations/speckit-export.js +17 -0
- package/dist/src/operations/speckit-import.d.ts +299 -0
- package/dist/src/operations/speckit-import.js +39 -0
- package/dist/src/operations/speckit-sync.d.ts +900 -0
- package/dist/src/operations/speckit-sync.js +116 -0
- package/dist/src/operations/state-at.d.ts +309 -0
- package/dist/src/operations/state-at.js +53 -0
- package/dist/src/operations/stats.d.ts +324 -0
- package/dist/src/operations/stats.js +85 -0
- package/dist/src/operations/task-list.d.ts +305 -0
- package/dist/src/operations/task-list.js +44 -0
- package/dist/src/operations/timeline.d.ts +312 -0
- package/dist/src/operations/timeline.js +46 -0
- package/dist/src/operations/trace-from-node.d.ts +1197 -0
- package/dist/src/operations/trace-from-node.js +36 -0
- package/dist/src/operations/update-metadata.d.ts +593 -0
- package/dist/src/operations/update-metadata.js +18 -0
- package/dist/src/operations/update-node.d.ts +957 -0
- package/dist/src/operations/update-node.js +24 -0
- package/dist/src/operations/update-plan-task.d.ts +595 -0
- package/dist/src/operations/update-plan-task.js +31 -0
- package/dist/src/operations/validate.d.ts +310 -0
- package/dist/src/operations/validate.js +82 -0
- package/dist/src/schema.d.ts +891 -0
- package/dist/src/schema.js +356 -0
- package/dist/src/speckit/generate.d.ts +7 -0
- package/dist/src/speckit/generate.js +546 -0
- package/dist/src/speckit/index.d.ts +4 -0
- package/dist/src/speckit/index.js +4 -0
- package/dist/src/speckit/parse.d.ts +11 -0
- package/dist/src/speckit/parse.js +712 -0
- package/dist/src/speckit/plan.d.ts +125 -0
- package/dist/src/speckit/plan.js +636 -0
- package/dist/src/speckit/project.d.ts +39 -0
- package/dist/src/speckit/project.js +141 -0
- package/dist/src/text.d.ts +23 -0
- package/dist/src/text.js +32 -0
- package/package.json +86 -8
- package/schema.json +510 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Detect Spec-Kit project structure from a directory.
|
|
5
|
+
* Looks for .specify/ and specs/ subdirectories.
|
|
6
|
+
*/
|
|
7
|
+
export function detectSpecKitProject(dir) {
|
|
8
|
+
const specifyDir = checkDir(join(dir, ".specify"));
|
|
9
|
+
const specsDir = checkDir(join(dir, "specs"));
|
|
10
|
+
// Resolve constitution.md - check .specify/memory/ first, then root
|
|
11
|
+
let constitutionPath = null;
|
|
12
|
+
if (specifyDir) {
|
|
13
|
+
const memoryConstitution = join(specifyDir, "memory", "constitution.md");
|
|
14
|
+
if (existsSync(memoryConstitution)) {
|
|
15
|
+
constitutionPath = memoryConstitution;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (!constitutionPath) {
|
|
19
|
+
const rootConstitution = join(dir, "constitution.md");
|
|
20
|
+
if (existsSync(rootConstitution)) {
|
|
21
|
+
constitutionPath = rootConstitution;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
root: dir,
|
|
26
|
+
specifyDir,
|
|
27
|
+
specsDir,
|
|
28
|
+
constitutionPath,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* List all features in the specs/ directory, sorted by number.
|
|
33
|
+
*/
|
|
34
|
+
export function listFeatures(project) {
|
|
35
|
+
if (!project.specsDir) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const features = [];
|
|
39
|
+
const featurePattern = /^\d{3}-/;
|
|
40
|
+
try {
|
|
41
|
+
const entries = readdirSync(project.specsDir);
|
|
42
|
+
for (const entry of entries) {
|
|
43
|
+
const featurePath = join(project.specsDir, entry);
|
|
44
|
+
const stat = statSync(featurePath);
|
|
45
|
+
// Only process directories matching the feature pattern
|
|
46
|
+
if (!stat.isDirectory() || !featurePattern.test(entry)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const feature = parseFeatureDirectory(featurePath, entry);
|
|
50
|
+
if (feature) {
|
|
51
|
+
features.push(feature);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// If specs directory cannot be read, return empty list
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
// Sort by number
|
|
60
|
+
features.sort((a, b) => a.number - b.number);
|
|
61
|
+
return features;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get a specific feature by number or name.
|
|
65
|
+
* Matches "001", "001-feature-name", or "feature-name".
|
|
66
|
+
*/
|
|
67
|
+
export function getFeature(project, idOrName) {
|
|
68
|
+
const features = listFeatures(project);
|
|
69
|
+
// Try exact match on id first
|
|
70
|
+
let feature = features.find((f) => f.id === idOrName);
|
|
71
|
+
if (feature)
|
|
72
|
+
return feature;
|
|
73
|
+
// Try match on name
|
|
74
|
+
feature = features.find((f) => f.name === idOrName);
|
|
75
|
+
if (feature)
|
|
76
|
+
return feature;
|
|
77
|
+
// Try match on number (e.g., "1" or "001")
|
|
78
|
+
const numberStr = idOrName.padStart(3, "0");
|
|
79
|
+
feature = features.find((f) => f.id.startsWith(numberStr + "-"));
|
|
80
|
+
if (feature)
|
|
81
|
+
return feature;
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Resolve the constitution.md file, checking .specify/memory/ first, then root.
|
|
86
|
+
*/
|
|
87
|
+
export function resolveConstitution(project) {
|
|
88
|
+
return project.constitutionPath;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Check if a directory exists, return path or null.
|
|
92
|
+
*/
|
|
93
|
+
function checkDir(path) {
|
|
94
|
+
try {
|
|
95
|
+
const stat = statSync(path);
|
|
96
|
+
return stat.isDirectory() ? path : null;
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Parse a feature directory and extract metadata and file paths.
|
|
104
|
+
*/
|
|
105
|
+
function parseFeatureDirectory(dir, dirName) {
|
|
106
|
+
// Parse the directory name format: "NNN-feature-name"
|
|
107
|
+
const match = /^(\d{3})-(.+)$/.exec(dirName);
|
|
108
|
+
if (!match) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const [, numberStr, name] = match;
|
|
112
|
+
const number = parseInt(numberStr, 10);
|
|
113
|
+
return {
|
|
114
|
+
id: dirName,
|
|
115
|
+
number,
|
|
116
|
+
name,
|
|
117
|
+
dir,
|
|
118
|
+
files: {
|
|
119
|
+
spec: checkFile(dir, "spec.md"),
|
|
120
|
+
plan: checkFile(dir, "plan.md"),
|
|
121
|
+
tasks: checkFile(dir, "tasks.md"),
|
|
122
|
+
checklist: checkFile(dir, "checklist.md"),
|
|
123
|
+
research: checkFile(dir, "research.md"),
|
|
124
|
+
dataModel: checkFile(dir, "data-model.md"),
|
|
125
|
+
quickstart: checkFile(dir, "quickstart.md"),
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Check if a file exists in a directory, return path or null.
|
|
131
|
+
*/
|
|
132
|
+
function checkFile(dir, filename) {
|
|
133
|
+
const path = join(dir, filename);
|
|
134
|
+
try {
|
|
135
|
+
const stat = statSync(path);
|
|
136
|
+
return stat.isFile() ? path : null;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Normalise a text field (string | string[]) to a single string, joining with newlines.
|
|
2
|
+
* @param value - The text field to normalise.
|
|
3
|
+
* @returns A single string.
|
|
4
|
+
*/
|
|
5
|
+
export declare function textToString(value: string | string[]): string;
|
|
6
|
+
/** Normalise a text field to an array of lines.
|
|
7
|
+
* @param value - The text field to normalise.
|
|
8
|
+
* @returns An array of lines.
|
|
9
|
+
*/
|
|
10
|
+
export declare function textToLines(value: string | string[]): string[];
|
|
11
|
+
/** Format a text field for Markdown output — each line becomes a paragraph.
|
|
12
|
+
* @param value - The text field to format.
|
|
13
|
+
* @returns Markdown-formatted string.
|
|
14
|
+
*/
|
|
15
|
+
export declare function textToMarkdown(value: string | string[]): string;
|
|
16
|
+
/**
|
|
17
|
+
* Parse a Markdown text block back into the canonical text representation.
|
|
18
|
+
* Single-line content stays as a string; multiline becomes an array.
|
|
19
|
+
*
|
|
20
|
+
* @param block - The Markdown text block to parse.
|
|
21
|
+
* @returns A string for single-line content, or an array of lines for multiline.
|
|
22
|
+
*/
|
|
23
|
+
export declare function markdownToText(block: string): string | string[];
|
package/dist/src/text.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Normalise a text field (string | string[]) to a single string, joining with newlines.
|
|
2
|
+
* @param value - The text field to normalise.
|
|
3
|
+
* @returns A single string.
|
|
4
|
+
*/
|
|
5
|
+
export function textToString(value) {
|
|
6
|
+
return Array.isArray(value) ? value.join("\n") : value;
|
|
7
|
+
}
|
|
8
|
+
/** Normalise a text field to an array of lines.
|
|
9
|
+
* @param value - The text field to normalise.
|
|
10
|
+
* @returns An array of lines.
|
|
11
|
+
*/
|
|
12
|
+
export function textToLines(value) {
|
|
13
|
+
return Array.isArray(value) ? value : [value];
|
|
14
|
+
}
|
|
15
|
+
/** Format a text field for Markdown output — each line becomes a paragraph.
|
|
16
|
+
* @param value - The text field to format.
|
|
17
|
+
* @returns Markdown-formatted string.
|
|
18
|
+
*/
|
|
19
|
+
export function textToMarkdown(value) {
|
|
20
|
+
return textToLines(value).join("\n");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parse a Markdown text block back into the canonical text representation.
|
|
24
|
+
* Single-line content stays as a string; multiline becomes an array.
|
|
25
|
+
*
|
|
26
|
+
* @param block - The Markdown text block to parse.
|
|
27
|
+
* @returns A string for single-line content, or an array of lines for multiline.
|
|
28
|
+
*/
|
|
29
|
+
export function markdownToText(block) {
|
|
30
|
+
const lines = block.split("\n");
|
|
31
|
+
return lines.length === 1 ? lines[0] : lines;
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,91 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sysprom",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "SysProM — System Provenance Model CLI and library",
|
|
5
|
+
"author": "ExaDev",
|
|
6
|
+
"homepage": "https://github.com/ExaDev/SysProM#readme",
|
|
7
|
+
"bugs": "https://github.com/ExaDev/SysProM/issues",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/ExaDev/SysProM.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"sysprom",
|
|
14
|
+
"provenance",
|
|
15
|
+
"decision",
|
|
16
|
+
"architecture",
|
|
17
|
+
"traceability",
|
|
18
|
+
"system-model",
|
|
19
|
+
"cli"
|
|
20
|
+
],
|
|
21
|
+
"packageManager": "pnpm@10.32.1",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/src/index.js",
|
|
24
|
+
"types": "./dist/src/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/src/index.d.ts",
|
|
28
|
+
"import": "./dist/src/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist/src/**/*.js",
|
|
33
|
+
"dist/src/**/*.d.ts",
|
|
34
|
+
"schema.json"
|
|
35
|
+
],
|
|
36
|
+
"bin": {
|
|
37
|
+
"sysprom": "./dist/src/cli/index.js",
|
|
38
|
+
"spm": "./dist/src/cli/index.js"
|
|
39
|
+
},
|
|
6
40
|
"scripts": {
|
|
7
|
-
"
|
|
41
|
+
"build": "turbo run _build",
|
|
42
|
+
"typecheck": "turbo run _typecheck",
|
|
43
|
+
"compile": "turbo run _compile",
|
|
44
|
+
"schema": "turbo run _schema",
|
|
45
|
+
"test": "turbo run _test",
|
|
46
|
+
"test:coverage": "turbo run _test:coverage",
|
|
47
|
+
"docs": "turbo run _docs:cli _docs:api",
|
|
48
|
+
"docs:html": "turbo run _docs:cli _docs:api:html",
|
|
49
|
+
"docs:serve": "typedoc --options typedoc.html.json --watch --serve",
|
|
50
|
+
"lint": "turbo run _lint",
|
|
51
|
+
"spm": "tsx src/cli/index.ts",
|
|
52
|
+
"_lint": "eslint --cache .",
|
|
53
|
+
"_typecheck": "tsc --noEmit",
|
|
54
|
+
"_compile": "tsc",
|
|
55
|
+
"_schema": "tsx src/generate-schema.ts",
|
|
56
|
+
"_test": "tsx --test tests/*.test.ts",
|
|
57
|
+
"_test:coverage": "c8 --src src --exclude 'src/cli/**' --exclude 'src/generate-schema.ts' tsx --test tests/*.test.ts",
|
|
58
|
+
"_docs:cli": "tsx scripts/generate-cli-docs.ts",
|
|
59
|
+
"_docs:api": "typedoc",
|
|
60
|
+
"_docs:api:html": "typedoc --options typedoc.html.json",
|
|
61
|
+
"prepare": "husky"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"commander": "14.0.3",
|
|
65
|
+
"picocolors": "1.1.1",
|
|
66
|
+
"zod": "4.3.6"
|
|
8
67
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@commitlint/cli": "20.5.0",
|
|
70
|
+
"@commitlint/config-conventional": "20.5.0",
|
|
71
|
+
"@eslint/js": "10.0.1",
|
|
72
|
+
"@semantic-release/changelog": "6.0.3",
|
|
73
|
+
"@semantic-release/git": "10.0.1",
|
|
74
|
+
"@types/node": "25.5.0",
|
|
75
|
+
"c8": "11.0.0",
|
|
76
|
+
"conventional-changelog-conventionalcommits": "9.3.0",
|
|
77
|
+
"eslint": "10.1.0",
|
|
78
|
+
"eslint-config-prettier": "10.1.8",
|
|
79
|
+
"eslint-plugin-prettier": "5.5.5",
|
|
80
|
+
"husky": "9.1.7",
|
|
81
|
+
"prettier": "3.8.1",
|
|
82
|
+
"semantic-release": "25.0.3",
|
|
83
|
+
"tsx": "4.21.0",
|
|
84
|
+
"turbo": "2.8.20",
|
|
85
|
+
"typedoc": "0.28.17",
|
|
86
|
+
"typedoc-plugin-markdown": "4.11.0",
|
|
87
|
+
"typedoc-plugin-zod": "1.4.3",
|
|
88
|
+
"typescript": "5.9.3",
|
|
89
|
+
"typescript-eslint": "8.57.1"
|
|
90
|
+
}
|
|
13
91
|
}
|