sdtk-spec-kit 0.8.1 → 0.9.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.
- package/README.md +13 -12
- package/assets/manifest/toolkit-bundle.manifest.json +2 -2
- package/package.json +1 -1
- package/src/commands/atlas.js +55 -344
- package/src/commands/help.js +12 -35
- package/src/lib/atlas-delegate.js +109 -0
- package/assets/atlas/build_atlas.py +0 -880
- package/assets/atlas/doc_atlas_viewer_template.html +0 -3796
- package/assets/atlas/vendor/mermaid.min.js +0 -2029
- package/src/lib/atlas-config.js +0 -200
- package/src/lib/atlas-runner.js +0 -435
- package/src/lib/browser-open.js +0 -39
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
It exposes the `sdtk-spec` CLI as the primary upstream command surface.
|
|
6
6
|
|
|
7
|
-
Package version in this source snapshot: `0.
|
|
7
|
+
Package version in this source snapshot: `0.9.0`
|
|
8
8
|
Full usage guide: `products/sdtk-spec/governance/SDTK_SPEC_USAGE_GUIDE.md`
|
|
9
9
|
|
|
10
10
|
Wraps the `SDTK-SPEC` PowerShell toolkit for portable, reproducible feature documentation scaffolding.
|
|
@@ -201,9 +201,9 @@ sdtk-spec analyze --source <requirements.md> --feature-key <UPPER_SNAKE_CASE> --
|
|
|
201
201
|
Build and browse a local document graph for your project.
|
|
202
202
|
|
|
203
203
|
Atlas is a free local compatibility feature in `sdtk-spec-kit`. No
|
|
204
|
-
authentication or entitlement is required.
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
authentication or entitlement is required. `sdtk-wiki` owns the graph builder
|
|
205
|
+
and the canonical `.sdtk/wiki` storage; `sdtk-spec atlas` remains the R1
|
|
206
|
+
compatibility namespace and forwards every subcommand to it.
|
|
207
207
|
|
|
208
208
|
#### Subcommands
|
|
209
209
|
|
|
@@ -222,7 +222,7 @@ cd <project>
|
|
|
222
222
|
sdtk-spec atlas init
|
|
223
223
|
```
|
|
224
224
|
|
|
225
|
-
This creates `.sdtk/
|
|
225
|
+
This delegates to `sdtk-wiki init`: it creates the graph workspace under `.sdtk/wiki`, scans local markdown, builds the document graph and static viewer, and opens the viewer in your browser by default.
|
|
226
226
|
|
|
227
227
|
#### Common flows
|
|
228
228
|
|
|
@@ -252,10 +252,11 @@ sdtk-spec atlas init [--project-path <path>] [--output-dir <path>] [--scan-root
|
|
|
252
252
|
|
|
253
253
|
#### Key facts
|
|
254
254
|
|
|
255
|
-
-
|
|
256
|
-
-
|
|
255
|
+
- `sdtk-spec atlas` is the R1 compatibility namespace. Every subcommand delegates to `sdtk-wiki`, which owns the graph builder; flags are forwarded verbatim.
|
|
256
|
+
- Requires `sdtk-wiki-kit`, which the SDTK suite installer brings in alongside this package. Without it, `atlas` exits 2 and prints the install steps.
|
|
257
|
+
- The builder is pure Node. No interpreter or extra runtime is required.
|
|
258
|
+
- Generated artifacts are written to `<project>/.sdtk/wiki/graph/` (project-local, not global). A legacy `<project>/.sdtk/atlas/` from an older release is left alone, never auto-deleted.
|
|
257
259
|
- The viewer server binds to `127.0.0.1` by default (loopback only).
|
|
258
|
-
- Python 3.8+ must be available in `PATH` for `atlas init`, `build`, and `watch`.
|
|
259
260
|
- Free Atlas scans local markdown files only and does not upload document content to external services.
|
|
260
261
|
- `sdtk-spec auth` and `sdtk-spec entitlement` are separate capability-management surfaces; they are not required for free Atlas commands.
|
|
261
262
|
- The old SPEC ask command path is not supported. Native Ask is owned by `sdtk-wiki ask` and capability `wiki.ask`.
|
|
@@ -362,7 +363,7 @@ sdtk-spec --version
|
|
|
362
363
|
|
|
363
364
|
- Node.js >= 18.13.0
|
|
364
365
|
- PowerShell (Windows PowerShell 5.1+ or PowerShell Core)
|
|
365
|
-
-
|
|
366
|
+
- `sdtk-wiki-kit` for the `atlas` commands
|
|
366
367
|
|
|
367
368
|
## Troubleshooting
|
|
368
369
|
|
|
@@ -386,9 +387,9 @@ sdtk-spec --version
|
|
|
386
387
|
**Payload hash mismatch**
|
|
387
388
|
- The bundled toolkit payload may be corrupted. Reinstall the package.
|
|
388
389
|
|
|
389
|
-
**Atlas
|
|
390
|
-
-
|
|
391
|
-
-
|
|
390
|
+
**Atlas exits 2 with "sdtk-wiki is not installed"**
|
|
391
|
+
- `sdtk-spec atlas` delegates to `sdtk-wiki`. Install it with `npm install -g sdtk-wiki-kit`.
|
|
392
|
+
- Then rerun `sdtk-spec atlas build`, or call `sdtk-wiki atlas build` directly.
|
|
392
393
|
|
|
393
394
|
## Development
|
|
394
395
|
|
package/package.json
CHANGED
package/src/commands/atlas.js
CHANGED
|
@@ -1,368 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const { parseFlags } = require("../lib/args");
|
|
3
|
+
const { spawn } = require("child_process");
|
|
6
4
|
const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = require("../lib/
|
|
14
|
-
const { runBuild, openViewer } = require("../lib/atlas-runner");
|
|
15
|
-
const { ValidationError } = require("../lib/errors");
|
|
16
|
-
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
// Shared flag definitions
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
const BASE_FLAG_DEFS = {
|
|
21
|
-
"project-path": { type: "string" },
|
|
22
|
-
"output-dir": { type: "string" },
|
|
23
|
-
"scan-root": { type: "string" },
|
|
24
|
-
verbose: { type: "boolean" },
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const OPEN_FLAG_DEFS = {
|
|
28
|
-
...BASE_FLAG_DEFS,
|
|
29
|
-
host: { type: "string" },
|
|
30
|
-
port: { type: "string" },
|
|
31
|
-
"no-open": { type: "boolean" },
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const INIT_FLAG_DEFS = {
|
|
35
|
-
...OPEN_FLAG_DEFS,
|
|
36
|
-
force: { type: "boolean" },
|
|
37
|
-
"no-build": { type: "boolean" },
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const WATCH_FLAG_DEFS = {
|
|
41
|
-
...BASE_FLAG_DEFS,
|
|
42
|
-
port: { type: "string" },
|
|
43
|
-
"no-open": { type: "boolean" },
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
// Flag parsing with repeatable --scan-root support
|
|
48
|
-
// ---------------------------------------------------------------------------
|
|
5
|
+
USAGE_LINES,
|
|
6
|
+
WIKI_BIN,
|
|
7
|
+
WIKI_MISSING_LINES,
|
|
8
|
+
planDelegation,
|
|
9
|
+
resolveWikiBin,
|
|
10
|
+
} = require("../lib/atlas-delegate");
|
|
11
|
+
const { CliError } = require("../lib/errors");
|
|
49
12
|
|
|
50
13
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
14
|
+
* Spawn the resolved sdtk-wiki entry script with the current Node binary rather
|
|
15
|
+
* than the installed shim, so Windows never has to resolve a .cmd through
|
|
16
|
+
* PATHEXT (BK-F).
|
|
17
|
+
*
|
|
18
|
+
* @param {string} binPath - Absolute path to the sdtk-wiki entry script.
|
|
19
|
+
* @param {string[]} argv - Args to forward.
|
|
20
|
+
* @returns {Promise<number>} Child exit code.
|
|
54
21
|
*/
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
22
|
+
function runWiki(binPath, argv) {
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
const child = spawn(process.execPath, [binPath, ...argv], {
|
|
25
|
+
stdio: "inherit",
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
child.on("error", (err) => {
|
|
29
|
+
reject(new CliError(`Failed to start ${WIKI_BIN}: ${err.message}`));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
child.on("close", (code, signal) => {
|
|
33
|
+
if (signal) {
|
|
34
|
+
// Ctrl+C on a long-lived `open` / `watch` run is a normal exit here.
|
|
35
|
+
resolve(0);
|
|
36
|
+
return;
|
|
67
37
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
} else {
|
|
72
|
-
filteredArgs.push(arg);
|
|
73
|
-
i++;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const { flags, positional } = parseFlags(filteredArgs, defs);
|
|
78
|
-
// Inject the collected scan roots as an array
|
|
79
|
-
flags["scan-root"] = scanRoots.length > 0 ? scanRoots : undefined;
|
|
80
|
-
return { flags, positional };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// ---------------------------------------------------------------------------
|
|
84
|
-
// atlas init
|
|
85
|
-
// ---------------------------------------------------------------------------
|
|
86
|
-
async function cmdAtlasInit(args) {
|
|
87
|
-
const { flags } = parseAtlasFlags(args, INIT_FLAG_DEFS);
|
|
88
|
-
const config = resolveAtlasConfig(flags);
|
|
89
|
-
|
|
90
|
-
if (isAtlasInitialized(config.outputDir) && !flags.force) {
|
|
91
|
-
console.log(`[atlas] Atlas already initialized at: ${config.outputDir}`);
|
|
92
|
-
console.log("[atlas] Use --force to overwrite existing config.");
|
|
93
|
-
} else {
|
|
94
|
-
writeAtlasConfig(config);
|
|
95
|
-
console.log(`[atlas] Initialized Atlas config: ${config.configPath}`);
|
|
96
|
-
console.log(`[atlas] Project root: ${config.projectPath}`);
|
|
97
|
-
console.log(`[atlas] Output dir: ${config.outputDir}`);
|
|
98
|
-
console.log(`[atlas] Scan roots: ${config.scanRoots.join(", ")}`);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (flags["no-build"]) {
|
|
102
|
-
console.log("[atlas] --no-build specified; skipping initial build.");
|
|
103
|
-
return 0;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
console.log("");
|
|
107
|
-
const buildResult = await runBuild(config);
|
|
108
|
-
console.log(`[atlas] Build complete: ${buildResult.docCount} docs, ${buildResult.nodeCount} nodes, ${buildResult.edgeCount} edges.`);
|
|
109
|
-
|
|
110
|
-
if (flags["no-open"]) {
|
|
111
|
-
console.log("[atlas] --no-open specified; skipping viewer launch.");
|
|
112
|
-
return 0;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const { url } = await openViewer(config, false);
|
|
116
|
-
console.log(`[atlas] Viewer: ${url}`);
|
|
117
|
-
return 0;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// ---------------------------------------------------------------------------
|
|
121
|
-
// atlas build
|
|
122
|
-
// ---------------------------------------------------------------------------
|
|
123
|
-
async function cmdAtlasBuild(args) {
|
|
124
|
-
const { flags } = parseAtlasFlags(args, BASE_FLAG_DEFS);
|
|
125
|
-
const config = resolveAtlasConfig(flags);
|
|
126
|
-
|
|
127
|
-
if (!isAtlasInitialized(config.outputDir)) {
|
|
128
|
-
console.log("[atlas] Atlas not initialized. Run: sdtk-spec atlas init");
|
|
129
|
-
console.log(`[atlas] Output dir: ${config.outputDir}`);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const startMs = Date.now();
|
|
133
|
-
const buildResult = await runBuild(config);
|
|
134
|
-
const durationMs = Date.now() - startMs;
|
|
135
|
-
|
|
136
|
-
console.log("");
|
|
137
|
-
console.log("[atlas] Build summary:");
|
|
138
|
-
console.log(` Documents: ${buildResult.docCount}`);
|
|
139
|
-
console.log(` Graph nodes: ${buildResult.nodeCount}`);
|
|
140
|
-
console.log(` Graph edges: ${buildResult.edgeCount}`);
|
|
141
|
-
console.log(` Output dir: ${config.outputDir}`);
|
|
142
|
-
console.log(` Duration: ${(durationMs / 1000).toFixed(1)}s`);
|
|
143
|
-
if (buildResult.generated) {
|
|
144
|
-
console.log(` Generated: ${buildResult.generated}`);
|
|
145
|
-
}
|
|
146
|
-
return 0;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// ---------------------------------------------------------------------------
|
|
150
|
-
// atlas open
|
|
151
|
-
// ---------------------------------------------------------------------------
|
|
152
|
-
async function cmdAtlasOpen(args) {
|
|
153
|
-
const { flags } = parseAtlasFlags(args, OPEN_FLAG_DEFS);
|
|
154
|
-
const config = resolveAtlasConfig(flags);
|
|
155
|
-
|
|
156
|
-
if (!isAtlasBuilt(config.outputDir)) {
|
|
157
|
-
console.error("[atlas] No atlas build found.");
|
|
158
|
-
console.error(` Expected: ${config.outputDir}/viewer.html`);
|
|
159
|
-
console.error(" Run: sdtk-spec atlas init");
|
|
160
|
-
console.error(" Or: sdtk-spec atlas build");
|
|
161
|
-
return 1;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const noOpen = !!flags["no-open"];
|
|
165
|
-
const { url } = await openViewer(config, noOpen);
|
|
166
|
-
|
|
167
|
-
if (!noOpen) {
|
|
168
|
-
// If the server was started inline, keep it alive until user exits
|
|
169
|
-
console.log("[atlas] Press Ctrl+C to stop the viewer server.");
|
|
170
|
-
await new Promise(() => {}); // keep alive
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return 0;
|
|
38
|
+
resolve(code === null ? 1 : code);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
174
41
|
}
|
|
175
42
|
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
const config = resolveAtlasConfig(flags);
|
|
182
|
-
|
|
183
|
-
if (!isAtlasInitialized(config.outputDir)) {
|
|
184
|
-
console.log("[atlas] Atlas not initialized. Running init first...");
|
|
185
|
-
writeAtlasConfig(config);
|
|
186
|
-
console.log(`[atlas] Initialized Atlas config: ${config.configPath}`);
|
|
187
|
-
}
|
|
43
|
+
// `deps` = { resolveWikiBin, runWiki } — injected by tests so both the resolved
|
|
44
|
+
// and the not-installed branch are exercisable without a real install.
|
|
45
|
+
async function cmdAtlas(args, deps = {}) {
|
|
46
|
+
const resolve = deps.resolveWikiBin || resolveWikiBin;
|
|
47
|
+
const run = deps.runWiki || runWiki;
|
|
188
48
|
|
|
189
|
-
const
|
|
190
|
-
let debounceTimer = null;
|
|
191
|
-
let rebuilding = false;
|
|
49
|
+
const plan = planDelegation(args);
|
|
192
50
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
console.log(`\n[atlas] Change detected (${reason}). Rebuilding...`);
|
|
197
|
-
try {
|
|
198
|
-
const buildResult = await runBuild(config);
|
|
199
|
-
console.log(`[atlas] Rebuild complete: ${buildResult.docCount} docs, ${buildResult.nodeCount} nodes.`);
|
|
200
|
-
} catch (err) {
|
|
201
|
-
console.error(`[atlas] Rebuild failed: ${err.message}`);
|
|
202
|
-
} finally {
|
|
203
|
-
rebuilding = false;
|
|
51
|
+
if (plan.usage) {
|
|
52
|
+
for (const line of USAGE_LINES) {
|
|
53
|
+
console.error(line);
|
|
204
54
|
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Initial build
|
|
208
|
-
console.log("[atlas] Running initial build...");
|
|
209
|
-
try {
|
|
210
|
-
const buildResult = await runBuild(config);
|
|
211
|
-
console.log(`[atlas] Initial build complete: ${buildResult.docCount} docs.`);
|
|
212
|
-
} catch (err) {
|
|
213
|
-
console.error(`[atlas] Initial build failed: ${err.message}`);
|
|
214
|
-
// Continue watching even if initial build fails
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Open viewer unless --no-open
|
|
218
|
-
let viewerServer = null;
|
|
219
|
-
if (!flags["no-open"] && isAtlasBuilt(config.outputDir)) {
|
|
220
|
-
const result = await openViewer(config, false);
|
|
221
|
-
viewerServer = result.server;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Watch each scan root for markdown changes
|
|
225
|
-
const watchers = [];
|
|
226
|
-
for (const scanRoot of config.scanRoots) {
|
|
227
|
-
if (!fs.existsSync(scanRoot)) {
|
|
228
|
-
console.log(`[atlas] Warning: scan root does not exist, skipping watch: ${scanRoot}`);
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
try {
|
|
233
|
-
const watcher = fs.watch(scanRoot, { recursive: true }, (eventType, filename) => {
|
|
234
|
-
if (!filename || !filename.endsWith(".md")) return;
|
|
235
|
-
if (debounceTimer) clearTimeout(debounceTimer);
|
|
236
|
-
debounceTimer = setTimeout(() => {
|
|
237
|
-
rebuild(`${eventType}: ${filename}`);
|
|
238
|
-
}, DEBOUNCE_MS);
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
watcher.on("error", (err) => {
|
|
242
|
-
console.error(`[atlas] Watch error on ${scanRoot}: ${err.message}`);
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
watchers.push(watcher);
|
|
246
|
-
console.log(`[atlas] Watching: ${scanRoot}`);
|
|
247
|
-
} catch (err) {
|
|
248
|
-
console.error(`[atlas] Could not watch ${scanRoot}: ${err.message}`);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (watchers.length === 0) {
|
|
253
|
-
console.error("[atlas] No scan roots could be watched. Exiting.");
|
|
254
55
|
return 1;
|
|
255
56
|
}
|
|
256
57
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
console.log("\n[atlas] Stopping watch...");
|
|
262
|
-
if (debounceTimer) clearTimeout(debounceTimer);
|
|
263
|
-
for (const w of watchers) {
|
|
264
|
-
try { w.close(); } catch (_) {}
|
|
265
|
-
}
|
|
266
|
-
if (viewerServer) {
|
|
267
|
-
try { viewerServer.close(); } catch (_) {}
|
|
58
|
+
const binPath = resolve();
|
|
59
|
+
if (!binPath) {
|
|
60
|
+
for (const line of WIKI_MISSING_LINES) {
|
|
61
|
+
console.error(line);
|
|
268
62
|
}
|
|
269
|
-
|
|
63
|
+
return 2;
|
|
270
64
|
}
|
|
271
65
|
|
|
272
|
-
|
|
273
|
-
|
|
66
|
+
console.log(
|
|
67
|
+
`[atlas] Delegating to "${WIKI_BIN} ${plan.argv.join(" ")}" — sdtk-wiki owns the graph builder.`
|
|
68
|
+
);
|
|
69
|
+
console.log(
|
|
70
|
+
"[atlas] Graph output defaults to .sdtk/wiki/graph; pass --output-dir to choose another location."
|
|
71
|
+
);
|
|
274
72
|
|
|
275
|
-
|
|
276
|
-
await new Promise(() => {});
|
|
277
|
-
return 0;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
// ---------------------------------------------------------------------------
|
|
281
|
-
// atlas status
|
|
282
|
-
// ---------------------------------------------------------------------------
|
|
283
|
-
async function cmdAtlasStatus(args) {
|
|
284
|
-
const { flags } = parseAtlasFlags(args, BASE_FLAG_DEFS);
|
|
285
|
-
|
|
286
|
-
// Use defaults-only resolution (no validation errors for status)
|
|
287
|
-
let config;
|
|
288
|
-
try {
|
|
289
|
-
config = resolveAtlasConfig(flags);
|
|
290
|
-
} catch (err) {
|
|
291
|
-
console.error(`[atlas] Config error: ${err.message}`);
|
|
292
|
-
return 1;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
const initialized = isAtlasInitialized(config.outputDir);
|
|
296
|
-
const built = isAtlasBuilt(config.outputDir);
|
|
297
|
-
|
|
298
|
-
console.log("[atlas] Status");
|
|
299
|
-
console.log("=".repeat(40));
|
|
300
|
-
console.log(` Initialized: ${initialized ? "yes" : "no"}`);
|
|
301
|
-
console.log(` Built: ${built ? "yes" : "no"}`);
|
|
302
|
-
console.log(` Project root: ${config.projectPath}`);
|
|
303
|
-
console.log(` Output dir: ${config.outputDir}`);
|
|
304
|
-
console.log(` Scan roots: ${config.scanRoots.join(", ")}`);
|
|
305
|
-
console.log(` Viewer host: ${config.host}:${config.port}`);
|
|
306
|
-
|
|
307
|
-
if (built) {
|
|
308
|
-
const meta = readBuildMeta(config.outputDir);
|
|
309
|
-
const graphMeta = readGraphMeta(config.outputDir);
|
|
310
|
-
if (meta) {
|
|
311
|
-
console.log(` Last build: ${meta.generated || "unknown"}`);
|
|
312
|
-
console.log(` Documents: ${meta.count}`);
|
|
313
|
-
}
|
|
314
|
-
if (graphMeta) {
|
|
315
|
-
console.log(` Graph nodes: ${graphMeta.nodeCount}`);
|
|
316
|
-
console.log(` Graph edges: ${graphMeta.edgeCount}`);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
if (!initialized) {
|
|
321
|
-
console.log("");
|
|
322
|
-
console.log("[atlas] Hint: run 'sdtk-spec atlas init' to initialize Atlas for this project.");
|
|
323
|
-
} else if (!built) {
|
|
324
|
-
console.log("");
|
|
325
|
-
console.log("[atlas] Hint: run 'sdtk-spec atlas build' to build the local document graph.");
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return 0;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// ---------------------------------------------------------------------------
|
|
332
|
-
// Top-level atlas dispatcher
|
|
333
|
-
// ---------------------------------------------------------------------------
|
|
334
|
-
const ATLAS_SUBCOMMANDS = new Set(["init", "build", "open", "watch", "status"]);
|
|
335
|
-
|
|
336
|
-
async function cmdAtlas(args) {
|
|
337
|
-
if (!args || args.length === 0) {
|
|
338
|
-
console.error("[atlas] Usage: sdtk-spec atlas <subcommand> [options]");
|
|
339
|
-
console.error(" Subcommands: init, build, open, watch, status");
|
|
340
|
-
console.error(" Run 'sdtk-spec --help' for full usage.");
|
|
341
|
-
return 1;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
const [subcommand, ...rest] = args;
|
|
345
|
-
|
|
346
|
-
if (!ATLAS_SUBCOMMANDS.has(subcommand)) {
|
|
347
|
-
throw new ValidationError(
|
|
348
|
-
`Unknown atlas subcommand: "${subcommand}". Valid subcommands: init, build, open, watch, status.`
|
|
349
|
-
);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
switch (subcommand) {
|
|
353
|
-
case "init":
|
|
354
|
-
return cmdAtlasInit(rest);
|
|
355
|
-
case "build":
|
|
356
|
-
return cmdAtlasBuild(rest);
|
|
357
|
-
case "open":
|
|
358
|
-
return cmdAtlasOpen(rest);
|
|
359
|
-
case "watch":
|
|
360
|
-
return cmdAtlasWatch(rest);
|
|
361
|
-
case "status":
|
|
362
|
-
return cmdAtlasStatus(rest);
|
|
363
|
-
}
|
|
73
|
+
return run(binPath, plan.argv);
|
|
364
74
|
}
|
|
365
75
|
|
|
366
76
|
module.exports = {
|
|
367
77
|
cmdAtlas,
|
|
78
|
+
runWiki,
|
|
368
79
|
};
|
package/src/commands/help.js
CHANGED
|
@@ -111,10 +111,10 @@ function cmdHelp() {
|
|
|
111
111
|
" --force Overwrite managed analysis artifacts",
|
|
112
112
|
" --json Print result summary as JSON",
|
|
113
113
|
"",
|
|
114
|
-
"Atlas subcommands (free compatibility path):",
|
|
115
|
-
" sdtk-spec atlas init Initialize
|
|
114
|
+
"Atlas subcommands (free compatibility path; delegated to sdtk-wiki):",
|
|
115
|
+
" sdtk-spec atlas init Initialize the graph workspace and run the first build (opens viewer)",
|
|
116
116
|
" sdtk-spec atlas build Rebuild the local document graph from project markdown",
|
|
117
|
-
" sdtk-spec atlas open Open the last successful
|
|
117
|
+
" sdtk-spec atlas open Open the last successful build in a local browser",
|
|
118
118
|
" sdtk-spec atlas watch Watch for markdown changes and rebuild automatically",
|
|
119
119
|
" sdtk-spec atlas status Show initialization state and last build summary",
|
|
120
120
|
"",
|
|
@@ -124,44 +124,21 @@ function cmdHelp() {
|
|
|
124
124
|
" sdtk-spec project refresh Incremental managed refresh of .sdtk/project/ artifacts (Pro)",
|
|
125
125
|
" sdtk-spec project promote Publish reviewed staged docs into /docs/ for sdtk-wiki (free; dry-run by default)",
|
|
126
126
|
"",
|
|
127
|
-
"Atlas options
|
|
128
|
-
"
|
|
129
|
-
" --
|
|
130
|
-
" --
|
|
131
|
-
" --
|
|
132
|
-
" --no-build Skip initial build",
|
|
133
|
-
" --no-open Skip opening the viewer",
|
|
134
|
-
" --verbose Show detailed build output",
|
|
135
|
-
"",
|
|
136
|
-
"Atlas options (build):",
|
|
137
|
-
" --project-path <path> Target project directory (default: cwd)",
|
|
138
|
-
" --output-dir <path> Atlas output directory (default: <project>/.sdtk/atlas)",
|
|
139
|
-
" --scan-root <path> Scan root (repeatable; default: project root)",
|
|
140
|
-
" --verbose Show incremental build detail",
|
|
141
|
-
"",
|
|
142
|
-
"Atlas options (open):",
|
|
143
|
-
" --project-path <path> Target project directory (default: cwd)",
|
|
144
|
-
" --output-dir <path> Atlas output directory (default: <project>/.sdtk/atlas)",
|
|
145
|
-
" --host <host> Viewer server host (default: 127.0.0.1)",
|
|
146
|
-
" --port <port> Viewer server port (default: 8765)",
|
|
147
|
-
" --no-open Print viewer URL without opening browser",
|
|
148
|
-
"",
|
|
149
|
-
"Atlas options (watch):",
|
|
150
|
-
" --project-path <path> Target project directory (default: cwd)",
|
|
151
|
-
" --output-dir <path> Atlas output directory (default: <project>/.sdtk/atlas)",
|
|
152
|
-
" --scan-root <path> Scan root (repeatable; default: project root)",
|
|
153
|
-
" --port <port> Viewer server port (default: 8765)",
|
|
154
|
-
" --no-open Skip opening the viewer after initial build",
|
|
127
|
+
"Atlas options:",
|
|
128
|
+
" Every flag is forwarded verbatim to sdtk-wiki, which owns the option surface:",
|
|
129
|
+
" --project-path, --output-dir, --scan-root (repeatable), --verbose, --host, --port,",
|
|
130
|
+
" --no-open; init also accepts --force and --no-build.",
|
|
131
|
+
" Run 'sdtk-wiki atlas <subcommand> --help' for the authoritative list.",
|
|
155
132
|
"",
|
|
156
133
|
"Atlas notes:",
|
|
157
134
|
" - Free Atlas commands (init, build, open, watch, status) require no authentication or entitlement.",
|
|
158
135
|
" - Atlas scans markdown files and builds a local document graph and static viewer.",
|
|
159
|
-
" - sdtk-spec atlas is the R1 compatibility
|
|
160
|
-
" -
|
|
161
|
-
" -
|
|
136
|
+
" - sdtk-spec atlas is the R1 compatibility namespace; it delegates to sdtk-wiki, the canonical builder.",
|
|
137
|
+
" - The builder is pure Node: no interpreter or extra runtime is required.",
|
|
138
|
+
" - Requires sdtk-wiki-kit (bundled with the sdtk-kit suite). Without it, atlas exits 2 with install steps.",
|
|
139
|
+
" - Graph output defaults to <project>/.sdtk/wiki/graph/; a legacy <project>/.sdtk/atlas/ is never auto-deleted.",
|
|
162
140
|
" - The old SPEC ask command path is not supported; native Ask is sdtk-wiki ask with capability wiki.ask.",
|
|
163
141
|
" - Viewer server binds to 127.0.0.1 by default (loopback only).",
|
|
164
|
-
" - Requires Python 3.8+ in PATH for the build step.",
|
|
165
142
|
"",
|
|
166
143
|
"Project ingest options (Pro):",
|
|
167
144
|
" --project-path <path> Target project directory to ingest (default: cwd)",
|