wiki-graph 0.3.1 → 0.4.1

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 (44) hide show
  1. package/README.md +17 -0
  2. package/dist/cli.js +2221 -37548
  3. package/dist/cli.js.map +1 -1
  4. package/dist/data/editor/text_compressor.jinja +17 -13
  5. package/dist/data/help/commands/archive/next.jinja +7 -2
  6. package/dist/data/help/commands/gc.jinja +2 -1
  7. package/dist/data/help/commands/legacy/migrate.jinja +6 -1
  8. package/dist/data/help/commands/legacy.jinja +3 -2
  9. package/dist/data/help/commands/library-predicate.jinja +296 -0
  10. package/dist/data/help/commands/library.jinja +237 -0
  11. package/dist/data/help/commands/maintenance/chapter/add.jinja +3 -3
  12. package/dist/data/help/commands/maintenance/chapter/list.jinja +4 -4
  13. package/dist/data/help/commands/maintenance/chapter/move.jinja +4 -4
  14. package/dist/data/help/commands/maintenance/chapter/remove.jinja +1 -1
  15. package/dist/data/help/commands/maintenance/chapter/reset.jinja +1 -1
  16. package/dist/data/help/commands/maintenance/chapter/set-source.jinja +2 -2
  17. package/dist/data/help/commands/maintenance/chapter/set-summary.jinja +1 -1
  18. package/dist/data/help/commands/maintenance/chapter/set-title.jinja +3 -3
  19. package/dist/data/help/commands/maintenance/chapter/tree.jinja +6 -6
  20. package/dist/data/help/commands/maintenance/chapter.jinja +10 -10
  21. package/dist/data/help/commands/maintenance/meta.jinja +7 -7
  22. package/dist/data/help/commands/maintenance/upgrade.jinja +35 -0
  23. package/dist/data/help/commands/maintenance.jinja +23 -0
  24. package/dist/data/help/commands/predicate.jinja +204 -28
  25. package/dist/data/help/commands/root.jinja +10 -3
  26. package/dist/data/help/commands/uri.jinja +165 -6
  27. package/dist/data/help/topics/config.jinja +10 -3
  28. package/dist/data/help/topics/library.jinja +90 -0
  29. package/dist/data/help/topics/readiness.jinja +32 -2
  30. package/dist/data/help/topics/recipe.jinja +42 -17
  31. package/dist/data/help/topics/runtime.jinja +20 -3
  32. package/dist/data/help/topics/uri.jinja +53 -25
  33. package/dist/gc-worker.d.ts +1 -0
  34. package/dist/gc-worker.js +548 -0
  35. package/dist/gc-worker.js.map +1 -0
  36. package/dist/index.cjs +12678 -33444
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +36 -2649
  39. package/dist/index.d.ts +36 -2649
  40. package/dist/index.js +12901 -33331
  41. package/dist/index.js.map +1 -1
  42. package/dist/queue-worker.js +1367 -24052
  43. package/dist/queue-worker.js.map +1 -1
  44. package/package.json +15 -3
@@ -0,0 +1,237 @@
1
+ Help Type: command
2
+ Command: {{ commandName }} {{ uri }}
3
+
4
+ {% if target.kind == "registry" %}
5
+ Library registry collection
6
+
7
+ Default behavior:
8
+ - `{{ commandName }} {{ uri }}` lists all library registries.
9
+ - `{{ commandName }} {{ uri }} add --path <folder>` creates a non-default library registry.
10
+
11
+ Usage:
12
+ {{ commandName }} wikg://lib/registry [--json]
13
+ {{ commandName }} wikg://lib/registry add --path <folder> [--json]
14
+
15
+ Predicate commands:
16
+ - add: create a non-default library registry and an empty folder. Help: {{ commandName }} wikg://lib/registry add --help
17
+
18
+ Related help:
19
+ - {{ commandName }} wikg://lib --help
20
+ - {{ commandName }} help library
21
+ {% elif target.kind == "path" %}
22
+ Library path object
23
+
24
+ Default behavior:
25
+ - `{{ commandName }} {{ uri }}` reads the library folder path.
26
+ - `{{ commandName }} {{ uri }} set <folder>` binds the library folder path and scans archive membership.
27
+
28
+ Usage:
29
+ {{ commandName }} {{ uri }} [--json]
30
+ {{ commandName }} {{ uri }} set <folder> [--json|--jsonl]
31
+
32
+ Predicate commands:
33
+ - set: bind this library to an existing folder and reconcile `.wikg` files. Help: {{ commandName }} {{ uri }} set --help
34
+
35
+ Related help:
36
+ - {{ commandName }} wikg://lib --help
37
+ - {{ commandName }} help library
38
+ {% elif target.kind == "archive-collection" %}
39
+ Archive member collection
40
+
41
+ Default behavior:
42
+ - `{{ commandName }} {{ uri }}` reads the archive collection scope; use `/tree` for member file visualization.
43
+ - `scan` reconciles `.wikg` files; `add` copies and registers one archive.
44
+
45
+ Usage:
46
+ {{ commandName }} {{ uri }} [--json]
47
+ {{ commandName }} {{ uri }} add --input <path> [--to <relative-wikg-path>] [--json]
48
+ {{ commandName }} {{ uri }} scan [--json|--jsonl]
49
+ {{ commandName }} {{ uri }}/tree [--parent <relative-path>] [--depth <n>] [--json]
50
+
51
+ Predicate commands:
52
+ - add: copy one `.wikg` file into the library folder. Help: {{ commandName }} {{ uri }} add --help
53
+ - scan: reconcile registered archive memberships with files under the folder. Help: {{ commandName }} {{ uri }} scan --help
54
+ - tree: inspect the managed archive file tree. Help: {{ commandName }} {{ uri }}/tree --help
55
+
56
+ Related help:
57
+ - {{ commandName }} wikg://lib --help
58
+ - {{ commandName }} help library
59
+ {% elif target.kind == "archive-tree" %}
60
+ Archive member tree object
61
+
62
+ Default behavior:
63
+ - `{{ commandName }} {{ uri }}` shows the archive member file tree.
64
+ - `--parent` filters to a directory or `.wikg` file while preserving ancestors.
65
+ - `--depth` is calculated from the library scope root.
66
+ - This object is read-only and does not support `set` or `apply`.
67
+
68
+ Usage:
69
+ {{ commandName }} {{ uri }} [--parent <relative-path>] [--depth <n>] [--json]
70
+
71
+ Related help:
72
+ - {{ commandName }} help library
73
+ {% elif target.kind == "archive-path" %}
74
+ Archive member path object
75
+
76
+ Default behavior:
77
+ - `{{ commandName }} {{ uri }}` reads this archive member's relative `.wikg` path.
78
+ - `{{ commandName }} {{ uri }} set <relative-wikg-path>` moves or renames the member.
79
+
80
+ Usage:
81
+ {{ commandName }} {{ uri }} [--json]
82
+ {{ commandName }} {{ uri }} set <relative-wikg-path> [--json]
83
+
84
+ Predicate commands:
85
+ - set: move or rename this archive inside the same library folder. Help: {{ commandName }} {{ uri }} set --help
86
+
87
+ Related help:
88
+ - {{ commandName }} help library
89
+ {% elif target.kind == "metadata" %}
90
+ Library metadata object
91
+
92
+ Default behavior:
93
+ - `{{ commandName }} {{ uri }}` reads this library metadata map.
94
+ - Metadata keys are free-form user fields.
95
+ - System registry fields such as id, public id, folder path, default marker, and staging path are not metadata.
96
+
97
+ Use when:
98
+ - You need to read or edit user metadata attached to a library scope.
99
+
100
+ Usage:
101
+ {{ commandName }} {{ uri }} [--json]
102
+ {{ commandName }} {{ uri }} set <json> [--json]
103
+ {{ commandName }} {{ uri }} set --json-input <json> [--json]
104
+ {{ commandName }} {{ uri }} set --input <path|-> [--json]
105
+ {{ commandName }} {{ uri }} put <key> <value> [--json]
106
+ {{ commandName }} {{ uri }} put <key> --json-input <value> [--json]
107
+ {{ commandName }} {{ uri }} put <key> --input <path|-> [--json]
108
+ {{ commandName }} {{ uri }} delete <key> [--json]
109
+ {{ commandName }} {{ uri }} clear [--json]
110
+
111
+ Input notes:
112
+ - `--json` controls output shape; it is not JSON input.
113
+ - Use `--json-input` when a metadata value itself is JSON.
114
+
115
+ Predicate commands:
116
+ - set: replace the whole metadata map. Help: {{ commandName }} {{ uri }} set --help
117
+ - put: write one metadata key. Help: {{ commandName }} {{ uri }} put --help
118
+ - delete: delete one metadata key. Help: {{ commandName }} {{ uri }} delete --help
119
+ - clear: clear the metadata map. Help: {{ commandName }} {{ uri }} clear --help
120
+ {% elif target.kind == "archive" %}
121
+ Library archive membership
122
+
123
+ Default behavior:
124
+ - `{{ commandName }} {{ uri }}` reads the archive member page for this managed archive.
125
+ - The member page shows the member URI, readable label or relative path, status, and business entry URIs for `/chapter`, `/entity`, `/triple`, and `inspect`.
126
+ - Registry fields such as physical path, size, mtime, and mutation token are diagnostic metadata.
127
+ - `{{ commandName }} {{ uri }} inspect` checks readiness for this managed archive's contents, not the library registry.
128
+ - Add archive object suffixes such as `/chapter`, `/entity`, or `/triple` when you want to query the archive contents.
129
+
130
+ Use when:
131
+ - You need to inspect readiness, change the relative path of, or remove one archive that is already managed by a library.
132
+
133
+ Usage:
134
+ {{ commandName }} {{ uri }} [--json]
135
+ {{ commandName }} {{ uri }} inspect [--json]
136
+ {{ commandName }} {{ uri }}/path set <relative-wikg-path> [--json]
137
+ {{ commandName }} {{ uri }} remove --confirm [--json]
138
+
139
+ Predicate commands:
140
+ - inspect: inspect this managed archive's archive readiness. Help: {{ commandName }} {{ uri }} inspect --help
141
+ - path set: move or rename this archive inside the same library folder without changing its archive id. Help: {{ commandName }} {{ uri }}/path set --help
142
+ - remove: delete this archive file from the library folder and unregister it. Help: {{ commandName }} {{ uri }} remove --help
143
+ {% elif target.kind == "scope" and target.objectUri == "wikg://index" %}
144
+ Library index object
145
+
146
+ Default behavior:
147
+ - `{{ commandName }} {{ uri }}` reads this library index status.
148
+ - Library index data is stored in local Wiki Graph staging state, not in the library folder.
149
+ - Library-wide `--query`, scope enumeration, evidence, related, and pack commands require a current library index.
150
+
151
+ Use when:
152
+ - You need to build, inspect, or drop the aggregate search index for a library.
153
+
154
+ Usage:
155
+ {{ commandName }} {{ uri }} [--json]
156
+ {{ commandName }} {{ uri }} enable [--jsonl]
157
+ {{ commandName }} {{ uri }} disable [--json]
158
+
159
+ Predicate commands:
160
+ - enable: rebuild this library index from registered present archives. Help: {{ commandName }} {{ uri }} enable --help
161
+ - disable: remove this library index materialization. Help: {{ commandName }} {{ uri }} disable --help
162
+
163
+ Related help:
164
+ - Library registry, membership, path binding, and aggregate index concepts: {{ commandName }} help library
165
+ {% else %}
166
+ Library scope
167
+
168
+ Default behavior:
169
+ - `{{ commandName }} {{ uri }}` reads the library-wide scope collection.
170
+ - Use `{{ commandName }} wikg://lib/registry` to list all library registries.
171
+ - `{{ commandName }} {{ uri }} --query <query>` searches library-wide objects through the library index.
172
+ - `{{ commandName }} {{ uri }}/arc scan` reconciles membership with `.wikg` files currently under the library folder.
173
+ - Library-wide object scopes such as `/entity` and `/triple` query one object type through the library index after it is enabled.
174
+ - Archive object search must use an explicit lens such as `/entity`, `/triple`, `/chapter`, or `/chunk`.
175
+
176
+ Use when:
177
+ - You need to manage a folder of `.wikg` archives as one library.
178
+ - You already moved or prepared a library folder and need Wiki Graph to bind this library to that existing directory.
179
+ {% if target.isDefault %}
180
+ - You need to create another library registry.
181
+ {% else %}
182
+ - You need to address a specific non-default library.
183
+ {% endif %}
184
+
185
+ URI forms:
186
+ - `{{ commandName }} wikg://lib` addresses the default library root scope.
187
+ - `{{ commandName }} wikg://lib/<lib-id>` addresses a non-default library root scope.
188
+ - `{{ commandName }} wikg://lib/arc/<archive-id>/` addresses one archive membership in the default library.
189
+ - `{{ commandName }} wikg://lib/<lib-id>/arc/<archive-id>/` addresses one archive membership in a non-default library.
190
+
191
+ Usage:
192
+ {% if target.isDefault %}
193
+ {{ commandName }} wikg://lib [--json]
194
+ {{ commandName }} wikg://lib --query <query> [--limit <n>] [--cursor <cursor>] [--json]
195
+ {{ commandName }} wikg://lib/chapter --query <query>
196
+ {{ commandName }} wikg://lib/chunk --query <query>
197
+ {{ commandName }} wikg://lib/registry add --path <folder> [--json]
198
+ {{ commandName }} wikg://lib/arc scan [--json|--jsonl]
199
+ {{ commandName }} wikg://lib/arc add --input <path> [--to <relative-wikg-path>] [--json]
200
+ {{ commandName }} wikg://lib/path set <existing-directory> [--json|--jsonl]
201
+ {{ commandName }} wikg://lib/arc/tree [--parent <relative-path>] [--depth <n>] [--json]
202
+ {{ commandName }} wikg://lib/index [--json]
203
+ {{ commandName }} wikg://lib/entity --query <query>
204
+ {{ commandName }} wikg://lib/triple --query <query>
205
+ {{ commandName }} wikg://lib/meta [--json]
206
+ {% else %}
207
+ {{ commandName }} {{ uri }} [--json]
208
+ {{ commandName }} {{ uri }} --query <query> [--limit <n>] [--cursor <cursor>] [--json]
209
+ {{ commandName }} {{ uri }}/chapter --query <query>
210
+ {{ commandName }} {{ uri }}/chunk --query <query>
211
+ {{ commandName }} {{ uri }}/arc scan [--json|--jsonl]
212
+ {{ commandName }} {{ uri }}/arc add --input <path> [--to <relative-wikg-path>] [--json]
213
+ {{ commandName }} {{ uri }}/path set <existing-directory> [--json|--jsonl]
214
+ {{ commandName }} {{ uri }}/arc/tree [--parent <relative-path>] [--depth <n>] [--json]
215
+ {{ commandName }} {{ uri }} remove --confirm [--json]
216
+ {{ commandName }} {{ uri }}/index [--json]
217
+ {{ commandName }} {{ uri }}/entity --query <query>
218
+ {{ commandName }} {{ uri }}/triple --query <query>
219
+ {{ commandName }} {{ uri }}/meta [--json]
220
+ {% endif %}
221
+
222
+ Predicate commands:
223
+ {% if target.isDefault %}
224
+ - registry add: create a non-default library registry and an empty folder. Help: {{ commandName }} wikg://lib/registry add --help
225
+ - arc scan: reconcile registered archive memberships with `.wikg` files under the library folder. Help: {{ commandName }} wikg://lib/arc scan --help
226
+ - arc add: copy a `.wikg` file into the library folder and register it. Help: {{ commandName }} wikg://lib/arc add --help
227
+ - path set: bind the default library to an existing directory, then scan/reconcile its `.wikg` files. Help: {{ commandName }} wikg://lib/path set --help
228
+ {% else %}
229
+ - arc scan: reconcile registered archive memberships with `.wikg` files under the library folder. Help: {{ commandName }} {{ uri }}/arc scan --help
230
+ - arc add: copy a `.wikg` file into the library folder and register it. Help: {{ commandName }} {{ uri }}/arc add --help
231
+ - path set: bind this library to an existing directory, then scan/reconcile its `.wikg` files. Help: {{ commandName }} {{ uri }}/path set --help
232
+ - remove: remove this library registry without deleting its folder. Help: {{ commandName }} {{ uri }} remove --help
233
+ {% endif %}
234
+
235
+ Related help:
236
+ - Library registry, membership, path binding, and aggregate index concepts: {{ commandName }} help library
237
+ {% endif %}
@@ -22,7 +22,7 @@ Behavior:
22
22
 
23
23
  Output shape:
24
24
  Prints the new chapter status.
25
- The `Chapter: <id>` line is the new chapter id for later commands.
25
+ The `Chapter: <uri>` line is the new chapter URI for later commands.
26
26
  With `--json`, prints the new chapter status as one JSON object.
27
27
 
28
28
  Typical next step:
@@ -30,12 +30,12 @@ Typical next step:
30
30
 
31
31
  Examples:
32
32
  {{ commandName }} wikg://book.wikg/chapter add --title "Part I"
33
- {{ commandName }} wikg://book.wikg/chapter add --title "Chapter 1" --input ./chapter.txt --parent wikg://book.wikg/chapter/3
33
+ {{ commandName }} wikg://book.wikg/chapter add --title "Chapter 1" --input ./chapter.txt --parent wikg://book.wikg/chapter/part
34
34
  cat chapter.txt | {{ commandName }} wikg://book.wikg/chapter add --title "Chapter 1" --input -
35
35
 
36
36
  See also:
37
37
  - {{ commandName }} wikg://book.wikg/chapter --help
38
- - {{ commandName }} wikg://book.wikg/chapter/3/source set --help
38
+ - {{ commandName }} wikg://book.wikg/chapter/part/source set --help
39
39
  - {{ commandName }} help format
40
40
  - {{ commandName }} help readiness
41
41
  - {{ commandName }} --help
@@ -10,7 +10,7 @@ Usage:
10
10
  {{ commandName }} <archive-uri>/chapter [--all] [--limit <n>] [--cursor <token>] [--json|--jsonl] [--llm <json>] [--help|-h]
11
11
 
12
12
  Output shape:
13
- wikg://chapter/<id> <title-or-[untitled]> source:<ready|missing> reading-graph:<ready|missing> reading-summary:<ready|missing> knowledge-graph:<ready|missing>
13
+ wikg://chapter/<path> <title-or-[untitled]> source:<ready|missing> reading-graph:<ready|missing> reading-summary:<ready|missing> knowledge-graph:<ready|missing>
14
14
 
15
15
  With machine-readable output, each chapter object includes `uri`, `title`, and `state`.
16
16
 
@@ -18,16 +18,16 @@ Behavior:
18
18
  - Includes sourced, generated, and unfinished chapters.
19
19
  - Some chapters are structural table-of-contents nodes that organize child chapters; missing generated artifacts alone does not make them abnormal.
20
20
  - Read `{{ commandName }} help uri` before choosing `--limit`, `--all`, `--json`, or `--jsonl`.
21
- - Chapter ids are encoded in the returned `wikg://chapter/<id>` URIs.
21
+ - Chapter paths are encoded in the returned `wikg://chapter/<path>` URIs.
22
22
  - Does not call an LLM provider.
23
23
  - Does not mutate chapter content or summaries.
24
24
 
25
25
  Use this before mutation:
26
- Discover ids and missing generated artifacts with:
26
+ Discover chapter URIs and missing generated artifacts with:
27
27
  {{ commandName }} <archive-uri>/chapter
28
28
 
29
29
  See also:
30
- - {{ commandName }} wikg://book.wikg/chapter/3/state --help
30
+ - {{ commandName }} wikg://book.wikg/chapter/part/state --help
31
31
  - {{ commandName }} help readiness
32
32
  - {{ commandName }} help uri
33
33
  - {{ commandName }} --help
@@ -15,7 +15,7 @@ Usage:
15
15
  {{ commandName }} <chapter-uri> move --last [--llm <json>] [--help|-h]
16
16
 
17
17
  Behavior:
18
- - Moves only the chapter tree node. Source text, Reading Graph data, and summary stay attached to the same chapter id.
18
+ - Moves only the chapter tree node. Source text, Reading Graph data, and summary stay attached to the same internal chapter record.
19
19
  - `--parent <chapter-uri>` moves the chapter under another chapter.
20
20
  - `--root` moves the chapter to the top level.
21
21
  - `--before <chapter-uri>` or `--after <chapter-uri>` moves the chapter next to the target chapter.
@@ -25,9 +25,9 @@ Behavior:
25
25
  - Does not call an LLM provider.
26
26
 
27
27
  Examples:
28
- {{ commandName }} wikg://book.wikg/chapter/8 move --parent wikg://book.wikg/chapter/3 --first
29
- {{ commandName }} wikg://book.wikg/chapter/8 move --root --last
30
- {{ commandName }} wikg://book.wikg/chapter/8 move --before wikg://book.wikg/chapter/9
28
+ {{ commandName }} wikg://book.wikg/chapter/intro move --parent wikg://book.wikg/chapter/part --first
29
+ {{ commandName }} wikg://book.wikg/chapter/intro move --root --last
30
+ {{ commandName }} wikg://book.wikg/chapter/intro move --before wikg://book.wikg/chapter/appendix
31
31
 
32
32
  See also:
33
33
  - {{ commandName }} wikg://book.wikg/chapter --help
@@ -21,6 +21,6 @@ Safety:
21
21
 
22
22
  See also:
23
23
  - {{ commandName }} wikg://book.wikg/chapter --help
24
- - {{ commandName }} wikg://book.wikg/chapter/3 reset --help
24
+ - {{ commandName }} wikg://book.wikg/chapter/part reset --help
25
25
  - {{ commandName }} help readiness
26
26
  - {{ commandName }} --help
@@ -23,7 +23,7 @@ Behavior:
23
23
 
24
24
  See also:
25
25
  - {{ commandName }} wikg://local/job --help
26
- - {{ commandName }} wikg://book.wikg/chapter/3/state --help
26
+ - {{ commandName }} wikg://book.wikg/chapter/part/state --help
27
27
  - {{ commandName }} help readiness
28
28
  - {{ commandName }} help runtime
29
29
  - {{ commandName }} --help
@@ -26,8 +26,8 @@ Typical next step:
26
26
  {{ commandName }} wikg://local/job add --input <archive-uri|chapter-uri> --task reading-graph --accept-cost
27
27
 
28
28
  See also:
29
- - {{ commandName }} wikg://book.wikg/chapter/3/state --help
30
- - {{ commandName }} wikg://book.wikg/chapter/3 reset --help
29
+ - {{ commandName }} wikg://book.wikg/chapter/part/state --help
30
+ - {{ commandName }} wikg://book.wikg/chapter/part reset --help
31
31
  - {{ commandName }} wikg://local/job --help
32
32
  - {{ commandName }} help format
33
33
  - {{ commandName }} help readiness
@@ -25,7 +25,7 @@ Behavior:
25
25
 
26
26
  See also:
27
27
  - {{ commandName }} wikg://local/job --help
28
- - {{ commandName }} wikg://book.wikg/chapter/3/state --help
28
+ - {{ commandName }} wikg://book.wikg/chapter/part/state --help
29
29
  - {{ commandName }} help readiness
30
30
  - {{ commandName }} help runtime
31
31
  - {{ commandName }} --help
@@ -19,11 +19,11 @@ Output shape:
19
19
  Prints the updated chapter object.
20
20
 
21
21
  Examples:
22
- {{ commandName }} wikg://book.wikg/chapter/12/title set "New Chapter Title"
23
- {{ commandName }} wikg://book.wikg/chapter/12/title clear
22
+ {{ commandName }} wikg://book.wikg/chapter/part/title set "New Chapter Title"
23
+ {{ commandName }} wikg://book.wikg/chapter/part/title clear
24
24
 
25
25
  See also:
26
26
  - {{ commandName }} wikg://book.wikg/chapter --help
27
- - {{ commandName }} wikg://book.wikg/chapter/12/state --help
27
+ - {{ commandName }} wikg://book.wikg/chapter/part/state --help
28
28
  - {{ commandName }} help uri
29
29
  - {{ commandName }} --help
@@ -16,10 +16,10 @@ Tree JSON shape:
16
16
  {
17
17
  "chapters": [
18
18
  {
19
- "id": 1,
19
+ "uri": "wikg://chapter/part",
20
20
  "title": "Part I",
21
21
  "children": [
22
- { "id": 2, "title": null, "children": [] }
22
+ { "uri": "wikg://chapter/part/intro", "title": null, "children": [] }
23
23
  ]
24
24
  }
25
25
  ]
@@ -27,8 +27,8 @@ Tree JSON shape:
27
27
 
28
28
  Apply rules:
29
29
  - `set` reads tree JSON from `--input <path>` or `--input -` for stdin.
30
- - Every existing chapter id must appear exactly once.
31
- - Unknown, duplicated, or missing chapter ids are rejected.
30
+ - Every existing chapter URI must appear exactly once.
31
+ - Unknown, duplicated, or missing chapter URIs are rejected.
32
32
  - `children` is required on every node.
33
33
  - `title` is optional when setting the tree.
34
34
  - Omitted `title` means keep the current title.
@@ -51,8 +51,8 @@ Examples:
51
51
  cat tree.json | {{ commandName }} wikg://book.wikg/chapter/tree set --input -
52
52
 
53
53
  See also:
54
- - {{ commandName }} wikg://book.wikg/chapter/3 move --help
55
- - {{ commandName }} wikg://book.wikg/chapter/3/title set --help
54
+ - {{ commandName }} wikg://book.wikg/chapter/part move --help
55
+ - {{ commandName }} wikg://book.wikg/chapter/part/title set --help
56
56
  - {{ commandName }} help readiness
57
57
  - {{ commandName }} help uri
58
58
  - {{ commandName }} --help
@@ -7,8 +7,8 @@ Usage:
7
7
  {{ commandName }} <archive-uri>/chapter [--llm <json>] [--help|-h]
8
8
  {{ commandName }} <chapter-uri>/state [--json] [--help|-h]
9
9
  {{ commandName }} <chapter-uri>/state/<source|reading-graph|reading-summary|knowledge-graph> [--json] [--help|-h]
10
- {{ commandName }} <archive-uri>/chapter add [--title <title>] [--parent <id>] [--input <path|->] [--llm <json>] [--json] [--help|-h]
11
- {{ commandName }} <chapter-uri> move (--parent <id>|--root|--before <id>|--after <id>|--first|--last) [--llm <json>] [--help|-h]
10
+ {{ commandName }} <archive-uri>/chapter add [--title <title>] [--parent <chapter-path>] [--input <path|->] [--llm <json>] [--json] [--help|-h]
11
+ {{ commandName }} <chapter-uri> move (--parent <chapter-path>|--root|--before <chapter-path>|--after <chapter-path>|--first|--last) [--llm <json>] [--help|-h]
12
12
  {{ commandName }} <chapter-uri> remove [--recursive] [--llm <json>] [--help|-h]
13
13
  {{ commandName }} <chapter-uri> reset --to <planned|source|reading-graph> [--llm <json>] [--help|-h]
14
14
  {{ commandName }} <chapter-uri>/source set [text] [--input <path|->] [--llm <json>] [--json] [--help|-h]
@@ -26,7 +26,7 @@ Chapter stages:
26
26
 
27
27
  Input rules:
28
28
  - Use Wiki Graph URIs; bare `.wikg` filesystem paths are not accepted.
29
- - `<chapter-uri>` includes the numeric chapter id printed by the chapter collection or `add`.
29
+ - `<chapter-uri>` includes the chapter path printed by the chapter collection or `add`.
30
30
  - `add` creates an empty planned chapter. Use this for chapter directories, groups, and drafting placeholders.
31
31
  - `add --input <path>` creates a chapter and fills it from source text; use `--input -` for stdin.
32
32
  - `<chapter-uri>/source set` and `<chapter-uri>/summary set` read a positional value, `--input <path>`, or `--input -` for stdin.
@@ -38,18 +38,18 @@ Input rules:
38
38
  - Structure edits, `/title set`, `/source set`, `/summary set`, and `reset` do not call an LLM provider.
39
39
  - To generate reading-graph, reading-summary, or knowledge-graph, use `{{ commandName }} wikg://local/job add --input <archive-uri|chapter-uri> --task <reading-graph|reading-summary|knowledge-graph> --accept-cost`.
40
40
  - `<chapter-uri>/state` shows the aggregate chapter state. `<chapter-uri>/state/<target>` checks one target.
41
- - Append `--help` after an action for action-specific details, for example `{{ commandName }} wikg://book.wikg/chapter/3 reset --help`.
41
+ - Append `--help` after an action for action-specific details, for example `{{ commandName }} wikg://book.wikg/chapter/part reset --help`.
42
42
 
43
43
  See also:
44
44
  - {{ commandName }} wikg://book.wikg/chapter
45
- - {{ commandName }} wikg://book.wikg/chapter/3/state
46
- - {{ commandName }} wikg://book.wikg/chapter/3/state/knowledge-graph
45
+ - {{ commandName }} wikg://book.wikg/chapter/part/state
46
+ - {{ commandName }} wikg://book.wikg/chapter/part/state/knowledge-graph
47
47
  - {{ commandName }} wikg://book.wikg/chapter/tree
48
- - {{ commandName }} wikg://book.wikg/chapter/3/title set "New Title"
49
- - {{ commandName }} wikg://book.wikg/chapter/3/title clear
48
+ - {{ commandName }} wikg://book.wikg/chapter/part/title set "New Title"
49
+ - {{ commandName }} wikg://book.wikg/chapter/part/title clear
50
50
  - {{ commandName }} wikg://book.wikg/chapter add --input chapter.txt
51
- - {{ commandName }} wikg://book.wikg/chapter/3/source set --input chapter.txt
52
- - {{ commandName }} wikg://book.wikg/chapter/3/summary set --input summary.md
51
+ - {{ commandName }} wikg://book.wikg/chapter/part/source set --input chapter.txt
52
+ - {{ commandName }} wikg://book.wikg/chapter/part/summary set --input summary.md
53
53
  - cat tree.json | {{ commandName }} wikg://book.wikg/chapter/tree set --input -
54
54
  - {{ commandName }} wikg://local/job --help
55
55
  - {{ commandName }} help format
@@ -8,12 +8,11 @@ Purpose:
8
8
 
9
9
  Usage:
10
10
  {{ commandName }} <object-uri>/meta [--json] [--help|-h]
11
- {{ commandName }} <object-uri>/meta set --json <object> [--help|-h]
12
- {{ commandName }} <object-uri>/meta set --json --input <path|-> [--help|-h]
11
+ {{ commandName }} <object-uri>/meta set <json> [--json] [--help|-h]
12
+ {{ commandName }} <object-uri>/meta set --input <path|-> [--json] [--help|-h]
13
13
  {{ commandName }} <object-uri>/meta set --json-input <object> [--json] [--help|-h]
14
- {{ commandName }} <object-uri>/meta put <key> <value> [--help|-h]
15
- {{ commandName }} <object-uri>/meta put <key> --json <value> [--help|-h]
16
- {{ commandName }} <object-uri>/meta put <key> --input <path|-> [--help|-h]
14
+ {{ commandName }} <object-uri>/meta put <key> <value> [--json] [--help|-h]
15
+ {{ commandName }} <object-uri>/meta put <key> --input <path|-> [--json] [--help|-h]
17
16
  {{ commandName }} <object-uri>/meta put <key> --json-input <value> [--json] [--help|-h]
18
17
  {{ commandName }} <object-uri>/meta delete <key> [--json] [--help|-h]
19
18
  {{ commandName }} <object-uri>/meta clear [--json] [--help|-h]
@@ -22,7 +21,8 @@ Input:
22
21
  - `set` replaces the whole metadata map and requires a JSON object.
23
22
  - `put` writes one key. Without `--json`, the value is stored as a string.
24
23
  - `--json-input <json>` reads an inline JSON value.
25
- - `--json --input <path>` reads JSON from a file.
24
+ - `--input <path|->` reads a value from a file or stdin.
25
+ - `--json` controls output shape; it is not JSON input.
26
26
  - Use `--input -` to read from stdin.
27
27
  - Metadata keys are command arguments, not URI segments.
28
28
 
@@ -42,7 +42,7 @@ Examples:
42
42
  {{ commandName }} wikg://book.wikg/meta --json
43
43
  {{ commandName }} wikg://book.wikg/meta put title "New Title"
44
44
  {{ commandName }} wikg://book.wikg/entity/Q42/meta put note "reviewed"
45
- {{ commandName }} wikg://book.wikg/entity/Q42/meta put rank --json 7
45
+ {{ commandName }} wikg://book.wikg/entity/Q42/meta put rank --json-input 7
46
46
  {{ commandName }} wikg://book.wikg/entity/Q42/meta delete note
47
47
  {{ commandName }} wikg://book.wikg/entity/Q42/meta clear
48
48
 
@@ -0,0 +1,35 @@
1
+ Help Type: command
2
+ Command: {{ commandName }} maintenance upgrade
3
+
4
+ Purpose:
5
+ Explicitly upgrade persistent Wiki Graph data. Home state may be upgraded automatically before real commands; user archives and libraries are upgraded only through this maintenance command.
6
+
7
+ Usage:
8
+ {{ commandName }} maintenance upgrade <target> [--json]
9
+ {{ commandName }} maintenance upgrade <path.sdpub> [--output <path.wikg>] [--json]
10
+
11
+ Targets:
12
+ - Home state: ~/.wikigraph
13
+ - Standalone archive: ./book.wikg, /path/to/book.wikg, wikg://book.wikg, wikg:///path/to/book.wikg
14
+ - Legacy sdpub: ./book.sdpub, optionally with --output
15
+ - Library: wikg://lib or wikg://lib/<lib-id>
16
+
17
+ Notes:
18
+ - This maintenance command accepts filesystem paths. URI-targeted archive/object commands still require Wiki Graph URIs; see `{{ commandName }} help uri`.
19
+ - Home state may be schema-gated automatically before real commands, but this command is the explicit recovery and batch-upgrade entry point.
20
+ - Internal SQLite files are part of the home target and are not user-facing upgrade targets.
21
+ - Standalone .wikg, home, and library targets are upgraded in place and do not support --output.
22
+ - Library archive member URIs such as wikg://lib/arc/<archive-id>/ are not standalone upgrade targets; upgrade the whole library.
23
+ - Library upgrade covers the registry and managed archive members for that library.
24
+
25
+ Examples:
26
+ {{ commandName }} maintenance upgrade ~/.wikigraph
27
+ {{ commandName }} maintenance upgrade ./book.wikg
28
+ {{ commandName }} maintenance upgrade wikg://lib
29
+ {{ commandName }} maintenance upgrade ./book.sdpub --output ./book.wikg
30
+
31
+ Related help:
32
+ - URI target forms and path conversion:
33
+ {{ commandName }} help uri
34
+ - Library upgrade scope:
35
+ {{ commandName }} help library
@@ -0,0 +1,23 @@
1
+ Help Type: command
2
+ Command: {{ commandName }} maintenance
3
+
4
+ Purpose:
5
+ Run explicit maintenance operations for persistent Wiki Graph data.
6
+
7
+ Usage:
8
+ {{ commandName }} maintenance upgrade <target> [--json]
9
+
10
+ Commands:
11
+ upgrade Upgrade home state, a .wikg archive, a library, or migrate .sdpub.
12
+
13
+ Upgrade targets:
14
+ {{ commandName }} maintenance upgrade ~/.wikigraph
15
+ {{ commandName }} maintenance upgrade ./book.wikg
16
+ {{ commandName }} maintenance upgrade wikg://book.wikg
17
+ {{ commandName }} maintenance upgrade ./book.sdpub [--output ./book.wikg]
18
+ {{ commandName }} maintenance upgrade wikg://lib
19
+ {{ commandName }} maintenance upgrade wikg://lib/<lib-id>
20
+
21
+ See Also:
22
+ {{ commandName }} maintenance upgrade --help
23
+ {{ commandName }} help format