sdtk-spec-kit 0.8.0 → 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.
@@ -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 Atlas config and run first build (opens viewer)",
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 atlas build in a local browser",
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 (init):",
128
- " --project-path <path> Target project directory (default: cwd)",
129
- " --output-dir <path> Atlas output directory (default: <project>/.sdtk/atlas)",
130
- " --scan-root <path> Scan root (repeatable; default: project root)",
131
- " --force Overwrite existing Atlas config",
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 path; SDTK-WIKI is the canonical home for new wiki work.",
160
- " - Artifacts are written under <project>/.sdtk/atlas/ (project-local compatibility output).",
161
- " - Native SDTK-WIKI uses <project>/.sdtk/wiki/ and <project>/.sdtk/wiki/graph/.",
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)",
@@ -129,6 +129,19 @@ async function cmdInit(args) {
129
129
  if (s.unknown.length) {
130
130
  console.log(` Could not detect (please set manually): ${s.unknown.join(", ")}.`);
131
131
  }
132
+ // BK-346: close the loop from detection into a gate-ready config.
133
+ const profileHint = d.framework === "laravel" || d.language === "php"
134
+ ? "php-laravel"
135
+ : d.framework === "django"
136
+ ? "django-react"
137
+ : d.framework === "nextjs" || d.framework === "next"
138
+ ? "node-nextjs"
139
+ : null;
140
+ if (profileHint) {
141
+ console.log(` Tip: run "sdtk-spec config apply-profile ${profileHint}" to fill stack + gate commands, then verify with "sdtk-spec config check".`);
142
+ } else {
143
+ console.log(' Tip: fill the remaining values with "sdtk-spec config apply-profile <name>" (see sdtk-spec.config.profiles.example.json), then verify with "sdtk-spec config check".');
144
+ }
132
145
  console.log("");
133
146
  }
134
147
 
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ const path = require("path");
4
+ const { ValidationError } = require("./errors");
5
+
6
+ // BK-347: sdtk-wiki owns the graph builder. sdtk-spec keeps the R1 "atlas"
7
+ // namespace as a compatibility entry point and forwards every invocation to
8
+ // sdtk-wiki, which does the same job in pure Node — no interpreter prerequisite.
9
+ //
10
+ // The two flag surfaces are identical (project-path / output-dir / scan-root /
11
+ // force / no-build / no-open / host / port / verbose), so args forward verbatim
12
+ // and no translation layer exists to drift.
13
+ const WIKI_PKG = "sdtk-wiki-kit";
14
+ const WIKI_BIN = "sdtk-wiki";
15
+
16
+ const SUBCOMMAND_ARGV = {
17
+ init: ["init"],
18
+ build: ["atlas", "build"],
19
+ open: ["atlas", "open"],
20
+ watch: ["atlas", "watch"],
21
+ status: ["atlas", "status"],
22
+ };
23
+
24
+ const ATLAS_SUBCOMMANDS = new Set(Object.keys(SUBCOMMAND_ARGV));
25
+
26
+ const USAGE_LINES = [
27
+ "[atlas] Usage: sdtk-spec atlas <subcommand> [options]",
28
+ " Subcommands: init, build, open, watch, status",
29
+ " All subcommands delegate to sdtk-wiki, which owns the graph builder.",
30
+ " Run 'sdtk-wiki atlas --help' for the full option list.",
31
+ ];
32
+
33
+ const WIKI_MISSING_LINES = [
34
+ "[atlas] sdtk-spec atlas delegates to sdtk-wiki, which is not installed.",
35
+ "[atlas] Install the wiki kit, then rerun:",
36
+ `[atlas] npm install -g ${WIKI_PKG}`,
37
+ `[atlas] ${WIKI_BIN} atlas build`,
38
+ "[atlas] Or install the whole suite at once: npm install -g sdtk-kit",
39
+ ];
40
+
41
+ /**
42
+ * Map an `sdtk-spec atlas ...` invocation onto the sdtk-wiki argv that performs
43
+ * the same work. Pure: no filesystem or process access.
44
+ *
45
+ * @param {string[]} args - Args after the `atlas` verb.
46
+ * @returns {{ usage: true } | { usage: false, subcommand: string, argv: string[] }}
47
+ * @throws {ValidationError} When the subcommand is not part of the atlas family.
48
+ */
49
+ function planDelegation(args) {
50
+ if (!args || args.length === 0) {
51
+ return { usage: true };
52
+ }
53
+
54
+ const [subcommand, ...rest] = args;
55
+
56
+ if (!ATLAS_SUBCOMMANDS.has(subcommand)) {
57
+ throw new ValidationError(
58
+ `Unknown atlas subcommand: "${subcommand}". Valid subcommands: init, build, open, watch, status.`
59
+ );
60
+ }
61
+
62
+ return {
63
+ usage: false,
64
+ subcommand,
65
+ argv: [...SUBCOMMAND_ARGV[subcommand], ...rest],
66
+ };
67
+ }
68
+
69
+ /**
70
+ * Resolve the sdtk-wiki entry script through its package.json `bin` map, the
71
+ * same drift-safe path the umbrella uses to reach sub-kits.
72
+ *
73
+ * @returns {string | null} Absolute path to the sdtk-wiki entry script, or null
74
+ * when sdtk-wiki-kit is not installed alongside sdtk-spec-kit.
75
+ */
76
+ function resolveWikiBin() {
77
+ let pkgJsonPath;
78
+ try {
79
+ pkgJsonPath = require.resolve(`${WIKI_PKG}/package.json`);
80
+ } catch (_) {
81
+ return null;
82
+ }
83
+
84
+ // eslint-disable-next-line global-require
85
+ const pkg = require(pkgJsonPath);
86
+ const binField = pkg.bin;
87
+ let rel;
88
+ if (typeof binField === "string") {
89
+ rel = binField;
90
+ } else if (binField && typeof binField === "object") {
91
+ rel = binField[WIKI_BIN] || Object.values(binField)[0];
92
+ }
93
+ if (!rel) {
94
+ return null;
95
+ }
96
+
97
+ return path.resolve(path.dirname(pkgJsonPath), rel);
98
+ }
99
+
100
+ module.exports = {
101
+ ATLAS_SUBCOMMANDS,
102
+ SUBCOMMAND_ARGV,
103
+ USAGE_LINES,
104
+ WIKI_BIN,
105
+ WIKI_MISSING_LINES,
106
+ WIKI_PKG,
107
+ planDelegation,
108
+ resolveWikiBin,
109
+ };
package/src/lib/update.js CHANGED
@@ -306,6 +306,8 @@ async function applyPlan(plan, options) {
306
306
 
307
307
  console.log("");
308
308
  console.log("SDTK-SPEC update completed successfully.");
309
+ // BK-346: fragmentation is born exactly at update time (BK-322 lesson).
310
+ console.log('Tip: run "sdtk doctor" to confirm every suite CLI now serves the updated copy (detects shadowed installs).');
309
311
  }
310
312
 
311
313
  async function executeUpdate(args) {