wiki-graph 0.3.0 → 0.4.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.
Files changed (69) hide show
  1. package/README.md +10 -271
  2. package/dist/cli.d.ts +1 -0
  3. package/dist/cli.js +2983 -4
  4. package/dist/cli.js.map +1 -0
  5. package/{data → dist/data}/editor/text_compressor.jinja +17 -13
  6. package/{data → dist/data}/help/commands/archive/next.jinja +7 -2
  7. package/{data → dist/data}/help/commands/gc.jinja +2 -1
  8. package/{data → dist/data}/help/commands/legacy/migrate.jinja +6 -1
  9. package/{data → dist/data}/help/commands/legacy.jinja +3 -2
  10. package/dist/data/help/commands/library-predicate.jinja +296 -0
  11. package/dist/data/help/commands/library.jinja +235 -0
  12. package/{data → dist/data}/help/commands/maintenance/chapter/add.jinja +3 -3
  13. package/{data → dist/data}/help/commands/maintenance/chapter/list.jinja +4 -4
  14. package/{data → dist/data}/help/commands/maintenance/chapter/move.jinja +4 -4
  15. package/{data → dist/data}/help/commands/maintenance/chapter/remove.jinja +1 -1
  16. package/{data → dist/data}/help/commands/maintenance/chapter/reset.jinja +1 -1
  17. package/{data → dist/data}/help/commands/maintenance/chapter/set-source.jinja +2 -2
  18. package/{data → dist/data}/help/commands/maintenance/chapter/set-summary.jinja +1 -1
  19. package/{data → dist/data}/help/commands/maintenance/chapter/set-title.jinja +3 -3
  20. package/{data → dist/data}/help/commands/maintenance/chapter/tree.jinja +6 -6
  21. package/{data → dist/data}/help/commands/maintenance/chapter.jinja +10 -10
  22. package/{data → dist/data}/help/commands/maintenance/meta.jinja +7 -7
  23. package/dist/data/help/commands/maintenance/upgrade.jinja +35 -0
  24. package/dist/data/help/commands/maintenance.jinja +23 -0
  25. package/{data → dist/data}/help/commands/predicate.jinja +204 -28
  26. package/{data → dist/data}/help/commands/root.jinja +10 -3
  27. package/{data → dist/data}/help/commands/uri.jinja +165 -6
  28. package/{data → dist/data}/help/topics/config.jinja +10 -3
  29. package/dist/data/help/topics/library.jinja +87 -0
  30. package/{data → dist/data}/help/topics/readiness.jinja +32 -2
  31. package/{data → dist/data}/help/topics/recipe.jinja +42 -17
  32. package/{data → dist/data}/help/topics/runtime.jinja +20 -3
  33. package/{data → dist/data}/help/topics/uri.jinja +51 -25
  34. package/dist/gc-worker.d.ts +1 -0
  35. package/dist/gc-worker.js +548 -0
  36. package/dist/gc-worker.js.map +1 -0
  37. package/dist/index.cjs +12463 -19690
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.cts +36 -842
  40. package/dist/index.d.ts +36 -842
  41. package/dist/index.js +13871 -9
  42. package/dist/index.js.map +1 -0
  43. package/dist/queue-worker.d.ts +1 -0
  44. package/dist/queue-worker.js +2110 -0
  45. package/dist/queue-worker.js.map +1 -0
  46. package/package.json +18 -45
  47. package/dist/cli.cjs +0 -41734
  48. package/dist/cli.cjs.map +0 -1
  49. package/docs/images/flowchart.excalidraw +0 -3293
  50. package/docs/images/flowchart.svg +0 -4
  51. package/docs/images/terminal-cn.png +0 -0
  52. package/docs/images/terminal-en.png +0 -0
  53. package/docs/wikispine-runtime.md +0 -143
  54. /package/{data → dist/data}/editor/clue_reviewer.jinja +0 -0
  55. /package/{data → dist/data}/editor/clue_reviewer_generator.jinja +0 -0
  56. /package/{data → dist/data}/editor/revision_feedback.jinja +0 -0
  57. /package/{data → dist/data}/guaranteed/response_intent_classifier.jinja +0 -0
  58. /package/{data → dist/data}/help/commands/maintenance/cover.jinja +0 -0
  59. /package/{data → dist/data}/help/commands/transform.jinja +0 -0
  60. /package/{data → dist/data}/help/topics/format.jinja +0 -0
  61. /package/{data → dist/data}/output/epub/cover.xhtml.jinja +0 -0
  62. /package/{data → dist/data}/output/epub/nav.xhtml.jinja +0 -0
  63. /package/{data → dist/data}/output/epub/package.opf.xml.jinja +0 -0
  64. /package/{data → dist/data}/output/epub/section.xhtml.jinja +0 -0
  65. /package/{data → dist/data}/topologization/book_coherence_extraction.jinja +0 -0
  66. /package/{data → dist/data}/topologization/chunk_extraction.jinja +0 -0
  67. /package/{data → dist/data}/topologization/evidence_choice.jinja +0 -0
  68. /package/{data → dist/data}/topologization/translate_chunks.jinja +0 -0
  69. /package/{data → dist/data}/topologization/user_focused_extraction.jinja +0 -0
@@ -26,11 +26,11 @@ Your compressed text must fall within the acceptable range. Going over the maxim
26
26
  - Natural expression (sound native in {{ user_language }}, not machine-translated)
27
27
  - Terminology consistency (technical terms and proper nouns should be accurately rendered)
28
28
 
29
- **Process:**
30
- 1. Read and understand the marked content in whatever language(s) it uses
31
- 2. Compress according to retention levels (`verbatim`, `detailed`, etc.)
32
- 3. Translate the compressed result to {{ user_language }}
33
- 4. Ensure the output reads naturally in {{ user_language }}
29
+ Apply these constraints silently:
30
+ - Understand the marked content in whatever language(s) it uses.
31
+ - Compress according to retention levels (`verbatim`, `detailed`, etc.).
32
+ - Translate the compressed result to {{ user_language }}.
33
+ - Ensure the output reads naturally in {{ user_language }}.
34
34
 
35
35
  **Important Notes:**
36
36
  - The input text may be in any language or mix of languages (e.g., an English book with French quotes)
@@ -46,6 +46,14 @@ Your compressed text must fall within the acceptable range. Going over the maxim
46
46
 
47
47
  ---
48
48
 
49
+ ## Response Protocol (MUST FOLLOW)
50
+
51
+ Return exactly one XML block matching this shape and nothing else: `<final>...</final>`
52
+
53
+ The content inside `<final>` is the only user-visible compressed content. Do not put any extra text before or after this block. Do not use Markdown fences, headings, separators, explanations, processing notes, or prefaces.
54
+
55
+ ---
56
+
49
57
  ## Format Requirements (MUST FOLLOW)
50
58
 
51
59
  ### 1. Remove ALL `<chunk>` tags from your output
@@ -61,9 +69,9 @@ The input text contains `<chunk>` markup tags like this:
61
69
  - ❌ WRONG: `<chunk retention="detailed">比如刮风啊...</chunk>`
62
70
  - ✅ CORRECT: `比如刮风啊...`
63
71
 
64
- ### 2. Output plain text only
72
+ ### 2. The content inside `<final>` must be plain text only
65
73
 
66
- Do NOT add:
74
+ Inside `<final>`, do NOT add:
67
75
  - Section headers (like "## Compressed Text")
68
76
  - XML/HTML markup of any kind
69
77
  - Explanatory comments mixed with the content
@@ -89,7 +97,7 @@ Your output should read like a natural excerpt from a longer article.
89
97
  - Delete entire paragraphs if they don't have markup
90
98
  - Only keep ultra-short transitions if absolutely necessary (e.g., "三年后", "1344年", "此时")
91
99
 
92
- ### Your compression strategy:
100
+ ### Compression priority:
93
101
 
94
102
  1. **First, preserve all marked content** (`<chunk>` tags) - this is your priority
95
103
  2. **Then, delete most unmarked text** - this is where you achieve compression
@@ -120,8 +128,4 @@ You are compressing a **segment** of a larger work (like part of a book chapter)
120
128
 
121
129
  ## Output Format
122
130
 
123
- [Optional: If you face difficult trade-offs, write 1-2 sentences about your approach. Keep this brief.]
124
-
125
- ---
126
-
127
- [Your compressed text - plain text only, no headers, no tags, written as continuous prose]
131
+ Return exactly this XML shape with no Markdown code fence: `<final>Your compressed text - plain text only, no headers, no tags, written as continuous prose</final>`
@@ -10,20 +10,25 @@ Use when:
10
10
 
11
11
  Usage:
12
12
  {{ commandName }} next <cursor> [--limit <n>] [--json|--jsonl] [--help|-h]
13
- {{ commandName }} next <archive-uri> <cursor> [--limit <n>] [--json|--jsonl] [--help|-h]
13
+ {{ commandName }} next <uri> <cursor> [--limit <n>] [--json|--jsonl] [--help|-h]
14
14
 
15
15
  Returns:
16
16
  - The next result page for the cursor.
17
17
 
18
18
  Notes:
19
19
  - Cursors are opaque short tokens stored in local Wiki Graph state.
20
- - Passing `<archive-uri>` is optional; when provided, it must match the archive stored in the cursor.
20
+ - A cursor stores the index scope that produced it, such as a standalone archive index or a library index.
21
+ - Passing `<uri>` is optional; when provided, it is used only as a safety check and must match the cursor's stored index scope.
22
+ - Library cursors re-check that the library index is still current before continuing.
21
23
  - Use `--limit` to override the next page size.
22
24
 
23
25
  Examples:
24
26
  {{ commandName }} next c_7Kp9x2aQ
25
27
  {{ commandName }} next wikg:///books/book.wikg c_7Kp9x2aQ
28
+ {{ commandName }} next wikg://lib c_7Kp9x2aQ
26
29
 
27
30
  Related help:
28
31
  - URI scopes, pagination, JSON, and JSONL result shapes:
29
32
  {{ commandName }} help uri
33
+ - Library cursor scope and aggregate index freshness:
34
+ {{ commandName }} help library
@@ -21,10 +21,11 @@ Options:
21
21
 
22
22
  Managed areas:
23
23
  - Wiki Graph coordinator workspace files and cached SQLite databases.
24
- - Search query cache.
24
+ - Search query cache and expired continuation cursor state under `~/.wikigraph/cache`.
25
25
  - Expired Wikipedia page cache.
26
26
  - Completed build job records and their durable event, cache, log, and workspace files.
27
27
  - Wiki Graph controlled temporary directories under the state directory.
28
+ - Orphaned library aggregate index staging that is no longer tied to a registered library.
28
29
 
29
30
  Output:
30
31
  Text output reports scanned resources, removed resources, and freed disk space.
@@ -2,7 +2,10 @@ Help Type: command
2
2
  Command: {{ commandName }} legacy migrate
3
3
 
4
4
  Purpose:
5
- Convert an `.sdpub` archive into the current `.wikg` format.
5
+ Deprecated alias for converting an `.sdpub` archive into the current `.wikg` format.
6
+
7
+ Deprecated:
8
+ Use `{{ commandName }} maintenance upgrade <path.sdpub>` instead.
6
9
 
7
10
  Usage:
8
11
  {{ commandName }} legacy migrate <path.sdpub> [--output <path.wikg>]
@@ -16,5 +19,7 @@ Examples:
16
19
  {{ commandName }} legacy migrate ./book.sdpub --output ./book.wikg
17
20
 
18
21
  Related help:
22
+ - Current maintenance upgrade entry point:
23
+ {{ commandName }} maintenance upgrade --help
19
24
  - Current archive format, create/import, and export boundaries:
20
25
  {{ commandName }} help format
@@ -2,18 +2,19 @@ Help Type: command
2
2
  Command: {{ commandName }} legacy
3
3
 
4
4
  Purpose:
5
- Expose the single `.sdpub` upgrade command.
5
+ Deprecated compatibility entry point for `.sdpub` upgrade.
6
6
 
7
7
  Usage:
8
8
  {{ commandName }} legacy migrate <path.sdpub> [--output <path.wikg>]
9
9
 
10
10
  Commands:
11
- migrate Convert an `.sdpub` archive into the current `.wikg` format.
11
+ migrate Deprecated alias for `{{ commandName }} maintenance upgrade <path.sdpub>`.
12
12
 
13
13
  Examples:
14
14
  {{ commandName }} legacy migrate ./book.sdpub
15
15
  {{ commandName }} legacy migrate ./book.sdpub --output ./book.wikg
16
16
 
17
17
  See Also:
18
+ {{ commandName }} maintenance upgrade --help
18
19
  {{ commandName }} legacy migrate --help
19
20
  {{ commandName }} help format
@@ -0,0 +1,296 @@
1
+ Help Type: command
2
+ Command: {{ commandName }} {{ uri }} {{ predicate }}
3
+
4
+ Library Predicate Command
5
+
6
+ Target:
7
+ {{ uri }}
8
+
9
+ Predicate:
10
+ {{ predicate }}
11
+
12
+ {% if target.kind == "registry" and predicate == "add" %}
13
+ Purpose:
14
+ Create a non-default library registry and create its empty library folder.
15
+
16
+ Usage:
17
+ {{ commandName }} wikg://lib/registry add --path <folder> [--json]
18
+
19
+ Notes:
20
+ - The folder must not already exist; the command creates it as an empty directory.
21
+ - Text output is the new public library URI. With `--json`, output includes the public id, URI, folder path, default marker, staging path, and timestamps.
22
+ {% elif target.kind == "registry" and predicate == "list" %}
23
+ Purpose:
24
+ List all library registries.
25
+
26
+ Usage:
27
+ {{ commandName }} wikg://lib/registry [--json]
28
+ {% elif target.kind == "path" and predicate == "get" %}
29
+ Purpose:
30
+ Read this library folder path.
31
+
32
+ Usage:
33
+ {{ commandName }} {{ uri }} [--json]
34
+ {% elif target.kind == "path" and predicate == "set" %}
35
+ Purpose:
36
+ Bind this library to an existing directory, then scan/reconcile `.wikg` files in that directory.
37
+
38
+ Usage:
39
+ {{ commandName }} {{ uri }} set <folder> [--json|--jsonl]
40
+
41
+ Notes:
42
+ - The command updates only this library registry's folder path.
43
+ - With `--jsonl`, it streams started/progress/completed events.
44
+ {% elif target.kind == "archive-collection" and predicate == "add" %}
45
+ Purpose:
46
+ Copy a `.wikg` archive into this library folder and register it as a managed archive member.
47
+
48
+ Usage:
49
+ {{ commandName }} {{ uri }} add --input <path> [--to <relative-wikg-path>] [--json]
50
+ {% elif target.kind == "archive-collection" and predicate == "scan" %}
51
+ Purpose:
52
+ Reconcile this library registry with `.wikg` files currently under the library folder.
53
+
54
+ Usage:
55
+ {{ commandName }} {{ uri }} scan [--json|--jsonl]
56
+
57
+ Notes:
58
+ - With `--jsonl`, it streams started/progress/completed events.
59
+ {% elif target.kind == "archive-tree" and predicate == "archive-tree" %}
60
+ Purpose:
61
+ Show the archive member file tree.
62
+
63
+ Usage:
64
+ {{ commandName }} {{ uri }} [--parent <relative-path>] [--depth <n>] [--json]
65
+
66
+ Notes:
67
+ - `--parent` accepts a directory or concrete `.wikg` file and preserves ancestor nodes.
68
+ - `--depth` is calculated from the library scope root.
69
+ - This target is read-only and does not support `set` or `apply`.
70
+ {% elif target.kind == "archive-path" and predicate == "get" %}
71
+ Purpose:
72
+ Read this archive member's relative `.wikg` path.
73
+
74
+ Usage:
75
+ {{ commandName }} {{ uri }} [--json]
76
+ {% elif target.kind == "archive-path" and predicate == "set" %}
77
+ Purpose:
78
+ Move or rename this managed archive inside the same library folder.
79
+
80
+ Usage:
81
+ {{ commandName }} {{ uri }} set <relative-wikg-path> [--json]
82
+ {% elif target.kind == "scope" and predicate == "create" %}
83
+ Purpose:
84
+ Create a non-default library registry and create its empty library folder.
85
+
86
+ Usage:
87
+ {{ commandName }} wikg://lib/registry add --path <folder> [--json]
88
+
89
+ Notes:
90
+ - Create libraries from the registry collection, `wikg://lib/registry`.
91
+ - `<folder>` must not already exist; the command creates it as an empty directory.
92
+ - The folder is not scanned, and contained `.wikg` files are not registered in this stage.
93
+ - Registry data is stored in the global core database, not in the library folder.
94
+ - Text output is the new public library URI. With `--json`, output includes the public id, URI, folder path, default marker, staging path, and timestamps.
95
+ - Save the emitted URI or public id if you need to address this non-default library later.
96
+ - List all library registries with `{{ commandName }} wikg://lib/registry`.
97
+
98
+ Examples:
99
+ {{ commandName }} wikg://lib/registry add --path ./research-library
100
+ {{ commandName }} wikg://lib/registry add --path ./research-library --json
101
+ {% elif target.kind == "scope" and target.objectUri == "wikg://index" and predicate == "get" %}
102
+ Purpose:
103
+ Read this library index status.
104
+
105
+ Usage:
106
+ {{ commandName }} {{ uri }} [--json]
107
+
108
+ Notes:
109
+ - The status tells whether the library index is current, dirty, missing, or disabled.
110
+ - Library-wide `--query` and naked scope enumeration require a current library index.
111
+ - Run `enable` when the status says the index needs to be built or rebuilt.
112
+ {% elif target.kind == "scope" and target.objectUri == "wikg://index" and predicate == "enable" %}
113
+ Purpose:
114
+ Build or rebuild this library's aggregate search index.
115
+
116
+ Usage:
117
+ {{ commandName }} {{ uri }} enable [--jsonl]
118
+
119
+ Notes:
120
+ - This is a full rebuild from registered present archives.
121
+ - Missing or unreadable library archive members are skipped and reported.
122
+ - Progress is emitted as text by default, or line-delimited events with `--jsonl`.
123
+ - `--json` is not supported for enable because progress is streamed.
124
+ - Library indexes are local derived state under Wiki Graph staging, not files inside the library folder.
125
+ - Rebuild holds the library write lock; concurrent `arc scan`, `arc add`, `path set`, `disable`, archive `path set`, or archive `remove` commands for the same library cannot run at the same time.
126
+ - Archive writes can mark the aggregate index dirty; rebuild again before relying on library-wide query when status reports dirty or stale.
127
+ {% elif target.kind == "scope" and target.objectUri == "wikg://index" and predicate == "disable" %}
128
+ Purpose:
129
+ Disable this library index and remove its current local materialization.
130
+
131
+ Usage:
132
+ {{ commandName }} {{ uri }} disable [--json]
133
+
134
+ Notes:
135
+ - This does not delete the library registry, metadata, folder, or managed `.wikg` archives.
136
+ - Library-wide `--query` and naked scope enumeration will fail until the index is enabled again.
137
+ - Library indexes do not support archive-style `embed` or `external` modes.
138
+ - Disable holds the library write lock and cannot run concurrently with membership changes or index rebuild for the same library.
139
+ {% elif target.kind == "scope" and predicate == "add" %}
140
+ Purpose:
141
+ Copy a `.wikg` archive into this library folder and register it as a managed archive member.
142
+
143
+ Usage:
144
+ {{ commandName }} {{ uri }} add --input <path> [--to <relative-wikg-path>] [--json]
145
+
146
+ Notes:
147
+ - `--input` is a normal filesystem path, not a `wikg://` archive URI.
148
+ - Without `--to`, the archive is copied to the library folder using its basename.
149
+ - `--to` must be a relative `.wikg` path inside the library folder.
150
+ - Parent directories for `--to` are created as needed.
151
+ - Existing target files are not overwritten.
152
+ - Adding an archive marks the library index dirty.
153
+ - The command holds the library write lock and cannot run concurrently with `arc scan`, library `path set`, archive path changes/removes, or index rebuild for the same library.
154
+ {% elif target.kind == "scope" and predicate == "scan" %}
155
+ Purpose:
156
+ Reconcile this library registry with `.wikg` files currently under the library folder.
157
+
158
+ Usage:
159
+ {{ commandName }} {{ uri }} scan [--json]
160
+
161
+ Notes:
162
+ - Scan recursively discovers `.wikg` files in the bound library folder.
163
+ - Registered files that are no longer present remain visible as missing/stale instead of being deleted silently.
164
+ - When a moved archive can be matched by its stable mutation token, scan preserves its archive id and updates the relative path.
165
+ - Scan marks the library index dirty when membership changes.
166
+ - Scan holds the library write lock and cannot run concurrently with membership changes or index rebuild for the same library.
167
+ {% elif target.kind == "scope" and predicate == "get" %}
168
+ Purpose:
169
+ Read this library scope.
170
+
171
+ Usage:
172
+ {{ commandName }} {{ uri }} get [--json]
173
+
174
+ Notes:
175
+ - For a bare library URI, this reads the same membership listing as the default command.
176
+ - For concrete library-wide objects such as `{{ uri }}/entity/<qid>`, use the object URI directly or ask that URI for help.
177
+ - This is not a list of all library registries; use known `wikg://lib/<lib-id>` URIs for non-default libraries.
178
+ {% elif target.kind == "scope" and predicate == "list" %}
179
+ Purpose:
180
+ This library scope does not expose an archive membership flat list.
181
+
182
+ Usage:
183
+ {{ commandName }} {{ uri }} [--json]
184
+
185
+ Notes:
186
+ - Use `{{ commandName }} {{ uri }}/arc/tree` to inspect the managed archive file tree.
187
+ - Use `{{ commandName }} {{ uri }}/arc scan` when the folder contents changed outside Wiki Graph.
188
+ - Use `{{ commandName }} wikg://lib/registry` to list all library registries.
189
+ {% elif target.kind == "scope" and predicate == "remove" %}
190
+ Purpose:
191
+ Remove this non-default library registry.
192
+
193
+ Usage:
194
+ {{ commandName }} {{ uri }} remove --confirm [--json]
195
+
196
+ Notes:
197
+ - The default library is system-managed and cannot be removed.
198
+ - Removing a library deletes its core registry record, metadata, membership records, and local derived index state.
199
+ - Removing a library does not delete the library folder or any `.wikg` files in it.
200
+ - `--confirm` is required.
201
+ - Remove holds the library write lock and cannot run concurrently with membership changes or index rebuild for the same library.
202
+ {% elif target.kind == "archive" and predicate == "get" %}
203
+ Purpose:
204
+ Read this library archive membership record.
205
+
206
+ Usage:
207
+ {{ commandName }} {{ uri }} [--json]
208
+
209
+ Notes:
210
+ - This reads membership information, not archive content.
211
+ - Add archive object suffixes such as `/chapter`, `/entity`, or `/triple` to query the managed archive contents.
212
+ {% elif target.kind == "archive" and predicate == "remove" %}
213
+ Purpose:
214
+ Delete this managed `.wikg` file from the library folder and unregister it.
215
+
216
+ Usage:
217
+ {{ commandName }} {{ uri }} remove --confirm [--json]
218
+
219
+ Notes:
220
+ - `--confirm` is required.
221
+ - If the registered file is already missing, the command can still clean the registry entry.
222
+ - This does not delete empty parent directories.
223
+ - Removing an archive marks the library index dirty.
224
+ - Remove holds the library write lock and cannot run concurrently with library scan, add, path binding, archive path changes, or index rebuild for the same library.
225
+ {% elif target.kind == "metadata" and predicate == "set" %}
226
+ Purpose:
227
+ Replace the whole library metadata map.
228
+
229
+ Usage:
230
+ {{ commandName }} {{ uri }} set <json> [--json]
231
+ {{ commandName }} {{ uri }} set --json-input <json> [--json]
232
+ {{ commandName }} {{ uri }} set --input <path|-> [--json]
233
+
234
+ Notes:
235
+ - `set` requires a JSON object.
236
+ - Metadata keys are free-form user fields.
237
+ - `--json` controls output shape; it is not JSON input.
238
+ - System registry fields such as id, public id, folder path, default marker, and staging path cannot be modified through metadata.
239
+ - With `--json`, success output is the resulting metadata map.
240
+ {% elif target.kind == "metadata" and predicate == "get" %}
241
+ Purpose:
242
+ Read this library metadata map.
243
+
244
+ Usage:
245
+ {{ commandName }} {{ uri }} get [--json]
246
+
247
+ Notes:
248
+ - This reads the whole metadata map.
249
+ - Metadata keys are free-form user fields.
250
+ - System registry fields such as id, public id, folder path, default marker, and staging path cannot be modified through metadata.
251
+ {% elif target.kind == "metadata" and predicate == "put" %}
252
+ Purpose:
253
+ Write one library metadata key.
254
+
255
+ Usage:
256
+ {{ commandName }} {{ uri }} put <key> <value> [--json]
257
+ {{ commandName }} {{ uri }} put <key> --json-input <value> [--json]
258
+ {{ commandName }} {{ uri }} put <key> --input <path|-> [--json]
259
+
260
+ Notes:
261
+ - Without JSON input, the value is stored as a string.
262
+ - With JSON input, the value is parsed as JSON.
263
+ - `--json` controls output shape; it is not JSON input.
264
+ - Metadata keys are command arguments, not URI segments.
265
+ - System registry fields such as id, public id, folder path, default marker, and staging path cannot be modified through metadata.
266
+ {% elif target.kind == "metadata" and predicate == "delete" %}
267
+ Purpose:
268
+ Delete one library metadata key.
269
+
270
+ Usage:
271
+ {{ commandName }} {{ uri }} delete <key> [--json]
272
+
273
+ Notes:
274
+ - Missing keys are ignored.
275
+ - With `--json`, success output is the resulting metadata map.
276
+ {% elif target.kind == "metadata" and predicate == "clear" %}
277
+ Purpose:
278
+ Clear this library metadata map.
279
+
280
+ Usage:
281
+ {{ commandName }} {{ uri }} clear [--json]
282
+
283
+ Notes:
284
+ - This clears user metadata only.
285
+ - It does not remove the library registry or change the library folder.
286
+ {% else %}
287
+ This library target does not support `{{ predicate }}`.
288
+ {% endif %}
289
+
290
+ Related help:
291
+ - {{ commandName }} {{ uri }} --help
292
+ - {{ commandName }} help library
293
+ {% if target.kind == "scope" and target.objectUri == "wikg://index" %}
294
+ - {{ commandName }} help readiness
295
+ {% endif %}
296
+ - {{ commandName }} help uri
@@ -0,0 +1,235 @@
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 registry entry for this library archive member.
125
+ - The membership entry identifies the archive id, relative path, status, and containing library.
126
+ - `{{ commandName }} {{ uri }} inspect` checks readiness for this managed archive's contents, not the library registry.
127
+ - Add archive object suffixes such as `/chapter`, `/entity`, or `/triple` when you want to query the archive contents.
128
+
129
+ Use when:
130
+ - You need to inspect readiness, change the relative path of, or remove one archive that is already managed by a library.
131
+
132
+ Usage:
133
+ {{ commandName }} {{ uri }} [--json]
134
+ {{ commandName }} {{ uri }} inspect [--json]
135
+ {{ commandName }} {{ uri }}/path set <relative-wikg-path> [--json]
136
+ {{ commandName }} {{ uri }} remove --confirm [--json]
137
+
138
+ Predicate commands:
139
+ - inspect: inspect this managed archive's archive readiness. Help: {{ commandName }} {{ uri }} inspect --help
140
+ - path set: move or rename this archive inside the same library folder without changing its archive id. Help: {{ commandName }} {{ uri }}/path set --help
141
+ - remove: delete this archive file from the library folder and unregister it. Help: {{ commandName }} {{ uri }} remove --help
142
+ {% elif target.kind == "scope" and target.objectUri == "wikg://index" %}
143
+ Library index object
144
+
145
+ Default behavior:
146
+ - `{{ commandName }} {{ uri }}` reads this library index status.
147
+ - Library index data is stored in local Wiki Graph staging state, not in the library folder.
148
+ - Library-wide `--query`, scope enumeration, evidence, related, and pack commands require a current library index.
149
+
150
+ Use when:
151
+ - You need to build, inspect, or drop the aggregate search index for a library.
152
+
153
+ Usage:
154
+ {{ commandName }} {{ uri }} [--json]
155
+ {{ commandName }} {{ uri }} enable [--jsonl]
156
+ {{ commandName }} {{ uri }} disable [--json]
157
+
158
+ Predicate commands:
159
+ - enable: rebuild this library index from registered present archives. Help: {{ commandName }} {{ uri }} enable --help
160
+ - disable: remove this library index materialization. Help: {{ commandName }} {{ uri }} disable --help
161
+
162
+ Related help:
163
+ - Library registry, membership, path binding, and aggregate index concepts: {{ commandName }} help library
164
+ {% else %}
165
+ Library scope
166
+
167
+ Default behavior:
168
+ - `{{ commandName }} {{ uri }}` reads this library scope.
169
+ - Use `{{ commandName }} wikg://lib/registry` to list all library registries.
170
+ - `{{ commandName }} {{ uri }} --query <query>` runs a broad library index search across indexed object types.
171
+ - `{{ commandName }} {{ uri }}/arc scan` reconciles membership with `.wikg` files currently under the library folder.
172
+ - Library-wide object scopes such as `/entity` and `/triple` query one object type through the library index after it is enabled.
173
+
174
+ Use when:
175
+ - You need to manage a folder of `.wikg` archives as one library.
176
+ - You already moved or prepared a library folder and need Wiki Graph to bind this library to that existing directory.
177
+ {% if target.isDefault %}
178
+ - You need to create another library registry.
179
+ {% else %}
180
+ - You need to address a specific non-default library.
181
+ {% endif %}
182
+
183
+ URI forms:
184
+ - `{{ commandName }} wikg://lib` addresses the default library.
185
+ - `{{ commandName }} wikg://lib/<lib-id>` addresses a non-default library.
186
+ - `{{ commandName }} wikg://lib/arc/<archive-id>/` addresses one archive membership in the default library.
187
+ - `{{ commandName }} wikg://lib/<lib-id>/arc/<archive-id>/` addresses one archive membership in a non-default library.
188
+
189
+ Usage:
190
+ {% if target.isDefault %}
191
+ {{ commandName }} wikg://lib
192
+ {{ commandName }} wikg://lib --query <query>
193
+ {{ commandName }} wikg://lib/chapter --query <query>
194
+ {{ commandName }} wikg://lib/chunk --query <query>
195
+ {{ commandName }} wikg://lib/registry add --path <folder> [--json]
196
+ {{ commandName }} wikg://lib/arc scan [--json|--jsonl]
197
+ {{ commandName }} wikg://lib/arc add --input <path> [--to <relative-wikg-path>] [--json]
198
+ {{ commandName }} wikg://lib/path set <existing-directory> [--json|--jsonl]
199
+ {{ commandName }} wikg://lib/arc/tree [--parent <relative-path>] [--depth <n>] [--json]
200
+ {{ commandName }} wikg://lib/index [--json]
201
+ {{ commandName }} wikg://lib/entity --query <query>
202
+ {{ commandName }} wikg://lib/triple --query <query>
203
+ {{ commandName }} wikg://lib/meta [--json]
204
+ {% else %}
205
+ {{ commandName }} {{ uri }}
206
+ {{ commandName }} {{ uri }} --query <query>
207
+ {{ commandName }} {{ uri }}/chapter --query <query>
208
+ {{ commandName }} {{ uri }}/chunk --query <query>
209
+ {{ commandName }} {{ uri }}/arc scan [--json|--jsonl]
210
+ {{ commandName }} {{ uri }}/arc add --input <path> [--to <relative-wikg-path>] [--json]
211
+ {{ commandName }} {{ uri }}/path set <existing-directory> [--json|--jsonl]
212
+ {{ commandName }} {{ uri }}/arc/tree [--parent <relative-path>] [--depth <n>] [--json]
213
+ {{ commandName }} {{ uri }} remove --confirm [--json]
214
+ {{ commandName }} {{ uri }}/index [--json]
215
+ {{ commandName }} {{ uri }}/entity --query <query>
216
+ {{ commandName }} {{ uri }}/triple --query <query>
217
+ {{ commandName }} {{ uri }}/meta [--json]
218
+ {% endif %}
219
+
220
+ Predicate commands:
221
+ {% if target.isDefault %}
222
+ - registry add: create a non-default library registry and an empty folder. Help: {{ commandName }} wikg://lib/registry add --help
223
+ - arc scan: reconcile registered archive memberships with `.wikg` files under the library folder. Help: {{ commandName }} wikg://lib/arc scan --help
224
+ - arc add: copy a `.wikg` file into the library folder and register it. Help: {{ commandName }} wikg://lib/arc add --help
225
+ - path set: bind the default library to an existing directory, then scan/reconcile its `.wikg` files. Help: {{ commandName }} wikg://lib/path set --help
226
+ {% else %}
227
+ - arc scan: reconcile registered archive memberships with `.wikg` files under the library folder. Help: {{ commandName }} {{ uri }}/arc scan --help
228
+ - arc add: copy a `.wikg` file into the library folder and register it. Help: {{ commandName }} {{ uri }}/arc add --help
229
+ - path set: bind this library to an existing directory, then scan/reconcile its `.wikg` files. Help: {{ commandName }} {{ uri }}/path set --help
230
+ - remove: remove this library registry without deleting its folder. Help: {{ commandName }} {{ uri }} remove --help
231
+ {% endif %}
232
+
233
+ Related help:
234
+ - Library registry, membership, path binding, and aggregate index concepts: {{ commandName }} help library
235
+ {% endif %}