sdtk-wiki-kit 0.2.0 → 0.2.2

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/bin/sdtk-wiki.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,45 +1,45 @@
1
- {
2
- "name": "sdtk-wiki-kit",
3
- "version": "0.2.0",
4
- "description": "Project-local wiki and knowledge graph toolkit for SDTK workspaces.",
5
- "bin": {
6
- "sdtk-wiki": "bin/sdtk-wiki.js"
7
- },
8
- "main": "src/index.js",
9
- "type": "commonjs",
10
- "files": [
11
- "bin/",
12
- "src/",
13
- "assets/keys/sdtk-entitlement-public.pem",
14
- "assets/atlas/build_atlas.py",
15
- "assets/atlas/doc_atlas_viewer_template.html",
16
- "assets/atlas/vendor/mermaid.min.js"
17
- ],
18
- "scripts": {
19
- "test": "powershell -ExecutionPolicy Bypass -Command \"$ErrorActionPreference = 'Stop'; Set-Location '..\\..\\..\\..'; python -m unittest tests.test_sdtk_wiki_cli tests.test_sdtk_wiki_context\"",
20
- "pack:smoke": "npm pack --dry-run"
21
- },
22
- "engines": {
23
- "node": ">=18.13.0"
24
- },
25
- "keywords": [
26
- "sdtk-wiki",
27
- "wiki",
28
- "knowledge-graph",
29
- "cli",
30
- "toolkit"
31
- ],
32
- "license": "MIT",
33
- "repository": {
34
- "type": "git",
35
- "url": "git+https://github.com/codexsdtk/sdtk-toolkit.git",
36
- "directory": "products/sdtk-wiki/distribution/sdtk-wiki-kit"
37
- },
38
- "homepage": "https://github.com/codexsdtk/sdtk-toolkit/tree/main/products/sdtk-wiki/distribution/sdtk-wiki-kit",
39
- "bugs": {
40
- "url": "https://github.com/codexsdtk/sdtk-toolkit/issues"
41
- },
42
- "publishConfig": {
43
- "access": "public"
44
- }
45
- }
1
+ {
2
+ "name": "sdtk-wiki-kit",
3
+ "version": "0.2.2",
4
+ "description": "Project-local wiki and knowledge graph toolkit for SDTK workspaces.",
5
+ "bin": {
6
+ "sdtk-wiki": "bin/sdtk-wiki.js"
7
+ },
8
+ "main": "src/index.js",
9
+ "type": "commonjs",
10
+ "files": [
11
+ "bin/",
12
+ "src/",
13
+ "assets/keys/sdtk-entitlement-public.pem",
14
+ "assets/atlas/build_atlas.py",
15
+ "assets/atlas/doc_atlas_viewer_template.html",
16
+ "assets/atlas/vendor/mermaid.min.js"
17
+ ],
18
+ "scripts": {
19
+ "test": "powershell -ExecutionPolicy Bypass -Command \"$ErrorActionPreference = 'Stop'; Set-Location '..\\..\\..\\..'; python -m unittest tests.test_sdtk_wiki_cli tests.test_sdtk_wiki_context\"",
20
+ "pack:smoke": "npm pack --dry-run"
21
+ },
22
+ "engines": {
23
+ "node": ">=18.13.0"
24
+ },
25
+ "keywords": [
26
+ "sdtk-wiki",
27
+ "wiki",
28
+ "knowledge-graph",
29
+ "cli",
30
+ "toolkit"
31
+ ],
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/codexsdtk/sdtk-toolkit.git",
36
+ "directory": "products/sdtk-wiki/distribution/sdtk-wiki-kit"
37
+ },
38
+ "homepage": "https://github.com/codexsdtk/sdtk-toolkit/tree/main/products/sdtk-wiki/distribution/sdtk-wiki-kit",
39
+ "bugs": {
40
+ "url": "https://github.com/codexsdtk/sdtk-toolkit/issues"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ }
45
+ }
@@ -57,6 +57,8 @@ Inputs:
57
57
  Behavior:
58
58
  Executes a local premium wiki.ask runtime pack when entitlement and graph preconditions pass.
59
59
  Fails closed when the graph, entitlement, or runtime pack is missing.
60
+ --source grounds on the chosen doc plus its directly-related siblings (docs sharing
61
+ the same BK issue, knowledge id, skill, or family), bounded and labelled as related.
60
62
  Query history is off by default.
61
63
  --save-query writes one redacted JSON record under .sdtk/wiki/queries after a successful answer.
62
64
  Full question and full answer are not stored by default.`);
@@ -1,67 +1,67 @@
1
- "use strict";
2
-
3
- const { parseFlags } = require("../lib/args");
4
- const { ValidationError } = require("../lib/errors");
5
- const { writeContextPack } = require("../lib/wiki-context-pack");
6
-
7
- const CONTEXT_FLAG_DEFS = {
8
- help: { type: "boolean", alias: "h" },
9
- topic: { type: "string" },
10
- budget: { type: "string" },
11
- "project-path": { type: "string" },
12
- out: { type: "string" },
13
- };
14
-
15
- function parseContextFlags(args) {
16
- return parseFlags(args || [], CONTEXT_FLAG_DEFS);
17
- }
18
-
19
- function printContextHelp() {
20
- console.log(`SDTK-WIKI Context Pack
21
-
22
- Usage:
23
- sdtk-wiki context --topic launch --budget 4000 --project-path .
24
-
25
- Purpose:
26
- Write a budgeted, source-linked context pack for compact/resume handoff.
27
-
28
- Behavior:
29
- Local-only. No network, no iii-sdk, no raw prompt dump.`);
30
- return 0;
31
- }
32
-
33
- function parseBudget(value) {
34
- if (value === undefined) {
35
- return 4000;
36
- }
37
- const budget = Number(value);
38
- if (!Number.isInteger(budget) || budget <= 0) {
39
- throw new ValidationError("--budget must be a positive integer.");
40
- }
41
- return budget;
42
- }
43
-
44
- function cmdContext(args) {
45
- const { flags } = parseContextFlags(args || []);
46
- if (flags.help) {
47
- return printContextHelp();
48
- }
49
- if (!flags.topic || !String(flags.topic).trim()) {
50
- throw new ValidationError("--topic is required.");
51
- }
52
- const result = writeContextPack(flags["project-path"], {
53
- topic: flags.topic,
54
- budget: parseBudget(flags.budget),
55
- out: flags.out,
56
- });
57
- console.log(
58
- `Context pack: ${result.selected} items, ${result.pinned} pinned, ${result.tokens}/${result.budget} tokens, ${result.pagedOut} paged out -> ${result.path}`
59
- );
60
- return 0;
61
- }
62
-
63
- module.exports = {
64
- cmdContext,
65
- parseContextFlags,
66
- printContextHelp,
67
- };
1
+ "use strict";
2
+
3
+ const { parseFlags } = require("../lib/args");
4
+ const { ValidationError } = require("../lib/errors");
5
+ const { writeContextPack } = require("../lib/wiki-context-pack");
6
+
7
+ const CONTEXT_FLAG_DEFS = {
8
+ help: { type: "boolean", alias: "h" },
9
+ topic: { type: "string" },
10
+ budget: { type: "string" },
11
+ "project-path": { type: "string" },
12
+ out: { type: "string" },
13
+ };
14
+
15
+ function parseContextFlags(args) {
16
+ return parseFlags(args || [], CONTEXT_FLAG_DEFS);
17
+ }
18
+
19
+ function printContextHelp() {
20
+ console.log(`SDTK-WIKI Context Pack
21
+
22
+ Usage:
23
+ sdtk-wiki context --topic launch --budget 4000 --project-path .
24
+
25
+ Purpose:
26
+ Write a budgeted, source-linked context pack for compact/resume handoff.
27
+
28
+ Behavior:
29
+ Local-only. No network, no iii-sdk, no raw prompt dump.`);
30
+ return 0;
31
+ }
32
+
33
+ function parseBudget(value) {
34
+ if (value === undefined) {
35
+ return 4000;
36
+ }
37
+ const budget = Number(value);
38
+ if (!Number.isInteger(budget) || budget <= 0) {
39
+ throw new ValidationError("--budget must be a positive integer.");
40
+ }
41
+ return budget;
42
+ }
43
+
44
+ function cmdContext(args) {
45
+ const { flags } = parseContextFlags(args || []);
46
+ if (flags.help) {
47
+ return printContextHelp();
48
+ }
49
+ if (!flags.topic || !String(flags.topic).trim()) {
50
+ throw new ValidationError("--topic is required.");
51
+ }
52
+ const result = writeContextPack(flags["project-path"], {
53
+ topic: flags.topic,
54
+ budget: parseBudget(flags.budget),
55
+ out: flags.out,
56
+ });
57
+ console.log(
58
+ `Context pack: ${result.selected} items, ${result.pinned} pinned, ${result.tokens}/${result.budget} tokens, ${result.pagedOut} paged out -> ${result.path}`
59
+ );
60
+ return 0;
61
+ }
62
+
63
+ module.exports = {
64
+ cmdContext,
65
+ parseContextFlags,
66
+ printContextHelp,
67
+ };
@@ -24,6 +24,7 @@ Usage:
24
24
  sdtk-wiki ask --help
25
25
  sdtk-wiki search --help
26
26
  sdtk-wiki lint --help
27
+ sdtk-wiki update --check-only
27
28
 
28
29
  Simple local wiki workflow:
29
30
  sdtk-wiki init --no-open
@@ -31,6 +32,7 @@ Simple local wiki workflow:
31
32
  sdtk-wiki compile --mode safe [--apply]
32
33
  sdtk-wiki query "<query>"
33
34
  sdtk-wiki lint
35
+ sdtk-wiki update --check-only
34
36
  sdtk-wiki discover --plan
35
37
  sdtk-wiki maintain --mode safe
36
38
 
@@ -53,6 +55,11 @@ R1 command model:
53
55
  ask Ask grounded questions over the built SDTK-WIKI graph.
54
56
  search Search generated local wiki pages without premium Ask.
55
57
  lint Write a report-first, non-destructive wiki lint report.
58
+ update Package-only updater; no wiki/.sdtk/wiki/.sdtk/atlas files are mutated in R1.
59
+
60
+ Update workflow:
61
+ sdtk-wiki update --check-only
62
+ npm install -g sdtk-wiki-kit@<version>
56
63
 
57
64
  Advanced/audit workflow:
58
65
  sdtk-wiki wiki extract --source-root <source-root> --dry-run
@@ -32,7 +32,7 @@ BK-102 behavior:
32
32
  Options:
33
33
  --project-path <path> Project root. Defaults to current working directory.
34
34
  --output-dir <path> Graph output dir under .sdtk/wiki. Defaults to .sdtk/wiki/graph.
35
- --scan-root <path> Repeatable markdown scan root.
35
+ --scan-root <path> Repeatable markdown scan root. Defaults to ./docs if it exists, otherwise the project root.
36
36
  --force Overwrite existing config.
37
37
  --no-build Write config only.
38
38
  --no-open Build graph but do not launch viewer.
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ const { executeUpdate } = require("../lib/update");
4
+
5
+ async function cmdUpdate(args) {
6
+ return executeUpdate(args);
7
+ }
8
+
9
+ module.exports = {
10
+ cmdUpdate,
11
+ };
package/src/index.js CHANGED
@@ -1,107 +1,111 @@
1
- "use strict";
2
-
3
- const { cmdAtlas } = require("./commands/atlas");
4
- const { cmdAsk } = require("./commands/ask");
5
- const { cmdHelp } = require("./commands/help");
6
- const { cmdInit } = require("./commands/init");
7
- const { cmdLint } = require("./commands/lint");
8
- const {
9
- cmdCompile,
10
- cmdDiscover,
11
- cmdIngest,
12
- cmdMaintain,
13
- cmdQuery,
14
- } = require("./commands/operations");
15
- const { cmdEnrich } = require("./commands/enrich");
16
- const { cmdContext } = require("./commands/context");
17
- const { cmdSearch } = require("./commands/search");
18
- const { cmdWiki } = require("./commands/wiki");
19
- const { ValidationError } = require("./lib/errors");
20
-
21
- function getVersion() {
22
- const pkg = require("../package.json");
23
- return pkg.version;
24
- }
25
-
26
- function parseCommand(argv) {
27
- if (!argv || argv.length === 0) {
28
- return { command: "help", args: [] };
29
- }
30
-
31
- const [first, ...rest] = argv;
32
- if (first === "-h" || first === "--help") {
33
- return { command: "help", args: [] };
34
- }
35
- if (first === "-v" || first === "--version") {
36
- return { command: "version", args: [] };
37
- }
38
-
39
- return { command: first, args: rest };
40
- }
41
-
42
- const COMMANDS = new Set([
43
- "help",
44
- "version",
45
- "init",
46
- "atlas",
47
- "wiki",
48
- "ask",
49
- "lint",
50
- "search",
51
- "ingest",
52
- "compile",
53
- "query",
54
- "discover",
55
- "maintain",
56
- "enrich",
57
- "context",
58
- ]);
59
-
60
- async function run(argv) {
61
- const { command, args } = parseCommand(argv);
62
-
63
- if (!COMMANDS.has(command)) {
64
- throw new ValidationError(
65
- `Unknown command: "${command}". Run "sdtk-wiki --help" for available commands.`
66
- );
67
- }
68
-
69
- switch (command) {
70
- case "help":
71
- return cmdHelp();
72
- case "version":
73
- console.log(`sdtk-wiki-kit ${getVersion()}`);
74
- return 0;
75
- case "init":
76
- return cmdInit(args);
77
- case "atlas":
78
- return cmdAtlas(args);
79
- case "wiki":
80
- return cmdWiki(args);
81
- case "ask":
82
- return cmdAsk(args);
83
- case "lint":
84
- return cmdLint(args);
85
- case "search":
86
- return cmdSearch(args);
87
- case "ingest":
88
- return cmdIngest(args);
89
- case "compile":
90
- return cmdCompile(args);
91
- case "query":
92
- return cmdQuery(args);
93
- case "discover":
94
- return cmdDiscover(args);
95
- case "maintain":
96
- return cmdMaintain(args);
97
- case "enrich":
98
- return cmdEnrich(args);
99
- case "context":
100
- return cmdContext(args);
101
- }
102
- }
103
-
104
- module.exports = {
105
- parseCommand,
106
- run,
107
- };
1
+ "use strict";
2
+
3
+ const { cmdAtlas } = require("./commands/atlas");
4
+ const { cmdAsk } = require("./commands/ask");
5
+ const { cmdHelp } = require("./commands/help");
6
+ const { cmdInit } = require("./commands/init");
7
+ const { cmdLint } = require("./commands/lint");
8
+ const {
9
+ cmdCompile,
10
+ cmdDiscover,
11
+ cmdIngest,
12
+ cmdMaintain,
13
+ cmdQuery,
14
+ } = require("./commands/operations");
15
+ const { cmdEnrich } = require("./commands/enrich");
16
+ const { cmdContext } = require("./commands/context");
17
+ const { cmdSearch } = require("./commands/search");
18
+ const { cmdUpdate } = require("./commands/update");
19
+ const { cmdWiki } = require("./commands/wiki");
20
+ const { ValidationError } = require("./lib/errors");
21
+
22
+ function getVersion() {
23
+ const pkg = require("../package.json");
24
+ return pkg.version;
25
+ }
26
+
27
+ function parseCommand(argv) {
28
+ if (!argv || argv.length === 0) {
29
+ return { command: "help", args: [] };
30
+ }
31
+
32
+ const [first, ...rest] = argv;
33
+ if (first === "-h" || first === "--help") {
34
+ return { command: "help", args: [] };
35
+ }
36
+ if (first === "-v" || first === "--version") {
37
+ return { command: "version", args: [] };
38
+ }
39
+
40
+ return { command: first, args: rest };
41
+ }
42
+
43
+ const COMMANDS = new Set([
44
+ "help",
45
+ "version",
46
+ "init",
47
+ "atlas",
48
+ "wiki",
49
+ "ask",
50
+ "lint",
51
+ "search",
52
+ "ingest",
53
+ "compile",
54
+ "query",
55
+ "discover",
56
+ "maintain",
57
+ "enrich",
58
+ "context",
59
+ "update",
60
+ ]);
61
+
62
+ async function run(argv) {
63
+ const { command, args } = parseCommand(argv);
64
+
65
+ if (!COMMANDS.has(command)) {
66
+ throw new ValidationError(
67
+ `Unknown command: "${command}". Run "sdtk-wiki --help" for available commands.`
68
+ );
69
+ }
70
+
71
+ switch (command) {
72
+ case "help":
73
+ return cmdHelp();
74
+ case "version":
75
+ console.log(`sdtk-wiki-kit ${getVersion()}`);
76
+ return 0;
77
+ case "init":
78
+ return cmdInit(args);
79
+ case "atlas":
80
+ return cmdAtlas(args);
81
+ case "wiki":
82
+ return cmdWiki(args);
83
+ case "ask":
84
+ return cmdAsk(args);
85
+ case "lint":
86
+ return cmdLint(args);
87
+ case "search":
88
+ return cmdSearch(args);
89
+ case "ingest":
90
+ return cmdIngest(args);
91
+ case "compile":
92
+ return cmdCompile(args);
93
+ case "query":
94
+ return cmdQuery(args);
95
+ case "discover":
96
+ return cmdDiscover(args);
97
+ case "maintain":
98
+ return cmdMaintain(args);
99
+ case "enrich":
100
+ return cmdEnrich(args);
101
+ case "context":
102
+ return cmdContext(args);
103
+ case "update":
104
+ return cmdUpdate(args);
105
+ }
106
+ }
107
+
108
+ module.exports = {
109
+ parseCommand,
110
+ run,
111
+ };