@@ -50,20 +50,44 @@ Purpose:
5050 Create or replace the archive at this URI.
5151
5252Usage:
53- wikigraph {{ uri }} create [source] [--input-format <format >] [--llm <json >] [--prompt <text >]
53+ wikigraph {{ uri }} create [source] [--input-format <format >] [--llm <json >] [--prompt <text >] [--json]
5454
5555Notes:
56- - `source` may be EPUB, Markdown, txt, or another supported input.
56+ - `source` may be EPUB, Markdown, txt, URL, or another supported input path.
57+ - Without `source`, an empty `.wikg` archive is created unless stdin is selected with `--input-format`.
5758 - Stdin is supported when `--input-format markdown` or `--input-format txt` is provided.
59+ - Input format is inferred from the source extension when possible; use `--input-format` when stdin or the extension is ambiguous.
60+ - Creating from EPUB, Markdown, txt, URL, or stdin runs only the import/source stage.
61+ - This command creates or replaces the target archive file; parent directories must already exist.
62+ - `--llm <json >` passes local LLM settings to the import pipeline when the selected input path needs them.
63+ - On success, text output is the archive object (`<archive >`). With `--json`, output is `{"uri":"..."}`.
64+
65+ Examples:
66+ wikigraph {{ uri }} create ./book.epub
67+ wikigraph {{ uri }} create ./notes.md --input-format markdown
68+ cat chapter.md | wikigraph {{ uri }} create --input-format markdown
69+ wikigraph {{ uri }} create --json
70+
71+ Next:
72+ wikigraph {{ uri }} inspect
5873{% elif predicate == "export" %}
5974Purpose:
6075 Export a projection from this archive.
6176
6277Usage:
63- wikigraph {{ uri }} export --output-format < format > [--output <path >]
78+ wikigraph {{ uri }} export [ --output-format markdown|txt|epub] [--output <path >]
6479
6580Notes:
81+ - Default output format is markdown when omitted by the parser, but explicit `--output-format` is recommended.
82+ - Without `--output`, exported content is written to stdout.
83+ - `--json` and `--jsonl` are not supported; the output stream is the exported projection.
84+ - Text exports depend on available source/summary content. Missing summaries produce an error that points to the generation command.
85+ - Export does not build Reading Graph or Knowledge Graph coverage.
6686 - Projections are portable views; they do not replace the `.wikg` archive.
87+
88+ Examples:
89+ wikigraph {{ uri }} export --output-format markdown --output book.md
90+ wikigraph {{ uri }} export --output-format txt > book.txt
6791{% elif predicate == "inspect" %}
6892Purpose:
6993 Inspect archive readiness before `--query`, retrieval, or starting generated work.
@@ -84,10 +108,11 @@ Purpose:
84108 Add a local generation job.
85109
86110Usage:
87- wikigraph {{ uri }} add --input <chapter-uri > --task reading-graph|reading-summary|knowledge-graph --accept-cost [--boost] [--llm <json >] [--prompt <text >]
111+ wikigraph {{ uri }} add --input <archive-uri | chapter-uri > --task reading-graph|reading-summary|knowledge-graph --accept-cost [--boost] [--llm <json >] [--prompt <text >]
88112
89113Notes:
90114 - Generation jobs may call an LLM provider and incur cost.
115+ - Archive input adds jobs for all eligible chapters; chapter input adds one job.
91116{% elif predicate == "move" %}
92117Purpose:
93118 Move this chapter in the chapter tree.
@@ -107,49 +132,179 @@ Purpose:
107132Usage:
108133 wikigraph {{ uri }} reset --to source|reading-graph|reading-summary|knowledge-graph [--confirm]
109134{% elif predicate == "set" %}
135+ {% if target .name == "chapter-tree-object" %}
110136Purpose:
111- Modify this writable URI target .
137+ Replace the chapter tree with a JSON tree document .
112138
113- {% if target .name == "chapter-tree-object" %}
114139Usage:
115140 wikigraph {{ uri }} set --input <tree .json >
141+
142+ Notes:
143+ - The input is a chapter tree JSON document produced by the chapter tree view.
144+ - This rewires chapter hierarchy and order; it does not rewrite chapter source text or generated graph content.
116145{% elif target .name == "chapter-source-object" %}
146+ Purpose:
147+ Replace this chapter source text.
148+
117149Usage:
118150 wikigraph {{ uri }} set [text] [--input <path >] --input-format markdown|txt
151+
152+ Notes:
153+ - `--input-format` is required and must be markdown or txt.
154+ - Source replacement invalidates later generated work for that chapter.
155+ - Use `wikigraph {{ uri }} --help` to inspect the source object before replacing it.
119156{% elif target .name == "chapter-summary-object" %}
157+ Purpose:
158+ Replace this chapter summary text.
159+
120160Usage:
121161 wikigraph {{ uri }} set [text] [--input <path >]
162+
163+ Notes:
164+ - The input is plain summary text.
165+ - This sets the summary resource directly; it does not call an LLM provider.
122166{% elif target .name == "chapter-title-object" %}
167+ Purpose:
168+ Replace this chapter title.
169+
123170Usage:
124171 wikigraph {{ uri }} set <title >
172+
173+ Notes:
174+ - Use `clear` on the same title URI to remove an explicit title.
125175{% elif target .name == "job-target-object" %}
176+ Purpose:
177+ Change the generation target for this local job.
178+
126179Usage:
127180 wikigraph {{ uri }} set reading-graph|reading-summary|knowledge-graph
181+
182+ Notes:
183+ - This changes what the job will generate when resumed or picked up by a worker.
184+ - Use `wikigraph {{ uri }} --help` to inspect the current job target first.
128185{% elif target .name == "local-config-section" %}
186+ Purpose:
187+ Replace this entire local config section with a JSON object.
188+
189+ Usage:
190+ wikigraph {{ uri }} set <json > [--json]
191+ wikigraph {{ uri }} set --json-input <json > [--json]
192+
193+ {% if "/llm" in uri %}
194+ Schema:
195+ {
196+ "provider": "openai|openai-compatible|anthropic|google",
197+ "model": "<model-name >",
198+ "baseURL": "<url >",
199+ "name": "<display-name >"
200+ }
201+
202+ Notes:
203+ - Allowed keys: provider, model, baseURL, name, apiKey.
204+ - `apiKey` is sensitive and cannot be set from JSON.
205+ - If current output shows `"apiKey":"****"`, passing the same masked value preserves the existing secret.
206+ - To add or replace the secret, use `wikigraph {{ uri }} put apiKey --secret`.
207+ - To remove the secret, use `wikigraph {{ uri }} delete apiKey`.
208+ {% elif "/wikispine" in uri %}
209+ Schema:
210+ {
211+ "provider": "fetch|cli"
212+ }
213+
214+ Notes:
215+ - `fetch` uses the built-in WikiSpine service endpoint.
216+ - `cli` runs the local `wikispine` command from PATH.
217+ {% elif "/concurrent" in uri %}
218+ Schema:
219+ {
220+ "job": 3,
221+ "request": 6
222+ }
223+
224+ Notes:
225+ - Allowed keys: job, request.
226+ - Values must be positive integers.
227+ {% endif %}
228+
229+ Examples:
230+ {% if "/llm" in uri %}
231+ wikigraph {{ uri }} set '{"provider":"openai","model":"gpt-4.1"}'
232+ wikigraph {{ uri }} set --json-input '{"provider":"openai-compatible","model":"model-name"}'
233+ wikigraph {{ uri }} set '{"provider":"google","model":"gemini-2.5-pro"}' --json
234+ {% elif "/wikispine" in uri %}
235+ wikigraph {{ uri }} set '{"provider":"fetch"}'
236+ wikigraph {{ uri }} set '{"provider":"cli"}'
237+ {% elif "/concurrent" in uri %}
238+ wikigraph {{ uri }} set '{"job":3,"request":6}'
239+ wikigraph {{ uri }} set --json-input '{"job":2,"request":4}'
240+ {% endif %}
241+ {% elif "/meta" in uri %}
242+ Purpose:
243+ Replace this metadata object from a JSON object or input value.
244+
129245Usage:
130- wikigraph {{ uri }} set [<json >] [--json <json >|--json-input <json >]
246+ wikigraph {{ uri }} set <json > [--json]
247+ wikigraph {{ uri }} set --json-input <json > [--json]
248+
249+ Notes:
250+ - Metadata shape depends on whether this is archive metadata or object metadata.
251+ - `put`, `delete`, and `clear` are usually safer for single-key metadata edits.
131252{% else %}
253+ Purpose:
254+ This URI target has no generic `set` behavior.
255+
132256Usage:
133- wikigraph {{ uri }} set [options]
257+ wikigraph {{ uri }} --help
258+
259+ Notes:
260+ - `set` is target-specific. Use the URI help page to find the writable child resource or supported predicate.
134261{% endif %}
135262{% elif predicate == "clear" %}
136263Purpose:
137264 Clear this writable resource or local config section.
138265
139266Usage:
140267 wikigraph {{ uri }} clear
268+
269+ {% if target .name == "local-config-section" %}
270+ Notes:
271+ - Clears every key in this local config section, including secrets.
272+ - No confirmation prompt is shown.
273+ - Success output is the now-empty JSON object: `{}`.
274+ {% elif "/meta" in uri %}
275+ Notes:
276+ - Clears all metadata keys for this metadata object.
277+ - No confirmation prompt is shown.
278+ {% else %}
279+ Notes:
280+ - This predicate is only available on URI targets that explicitly support clearing.
281+ {% endif %}
141282{% elif predicate == "build" %}
142283Purpose:
143284 Build the FTS index for this archive.
144285
145286Usage:
146287 wikigraph {{ uri }} build [--jsonl]
288+
289+ Notes:
290+ - Safe to run repeatedly; it refreshes a missing or outdated FTS index.
291+ - By default the index is stored as local cache outside the `.wikg` archive.
292+ - Build uses local CPU and disk only; it does not call an LLM provider.
293+ - Text success output is a short status summary.
294+ - With `--jsonl`, progress is emitted as line-delimited event records such as step/status/error records.
295+ - After build, `--query`, `related --query`, and `evidence --query` become available.
147296{% elif predicate == "embed" %}
148297Purpose:
149298 Store the FTS index inside the archive.
150299
151300Usage:
152301 wikigraph {{ uri }} embed
302+
303+ Notes:
304+ - Embedding writes the current FTS index into the `.wikg` archive.
305+ - This makes the archive more portable, but increases archive size.
306+ - Run `build` first if the index is missing or outdated.
307+ - If embed fails because the index is unavailable, run `wikigraph {{ uri }} build`.
153308{% elif predicate == "external" %}
154309Purpose:
155310 Keep the FTS index outside the archive as local cache.
@@ -198,19 +353,65 @@ Purpose:
198353
199354Usage:
200355 wikigraph {{ uri }} put <key > <value >
356+ wikigraph {{ uri }} put <key > --json-input <json >
357+ {% if "/llm" in uri %}
201358 wikigraph {{ uri }} put <key > --secret
359+ {% endif %}
360+
361+ {% if target .name == "local-config-section" %}
362+ {% if "/llm" in uri %}
363+ Keys:
364+ - provider: openai, openai-compatible, anthropic, or google
365+ - model: non-empty model name
366+ - baseURL: non-empty provider base URL string
367+ - name: non-empty display name
368+ - apiKey: secret; use `--secret`
369+ {% elif "/wikispine" in uri %}
370+ Keys:
371+ - provider: fetch or cli
372+ {% elif "/concurrent" in uri %}
373+ Keys:
374+ - job: positive integer
375+ - request: positive integer
376+ {% endif %}
377+
378+ Notes:
379+ - Positional `<value >` is stored as a string.
380+ - `--json-input` stores a JSON value and is useful for numeric config sections.
381+ {% if "/llm" in uri %}
382+ - `--secret` reads the value from an interactive terminal without echoing it; use it for `apiKey`.
383+ {% endif %}
384+ - Success output is the full section JSON with sensitive values masked.
385+ {% endif %}
202386{% elif predicate == "delete" %}
203387Purpose:
204388 Delete one key from this local config section.
205389
206390Usage:
207391 wikigraph {{ uri }} delete <key >
392+
393+ {% if target .name == "local-config-section" %}
394+ Notes:
395+ - Deletes the key if present; deleting an absent key leaves the section unchanged.
396+ - Success output is the full section JSON after deletion.
397+ - Key aliases are normalized where supported, for example `api-key` to `apiKey`.
398+ {% endif %}
208399{% elif predicate == "test" %}
209400Purpose:
210401 Test connectivity for this local config section.
211402
212403Usage:
213- wikigraph {{ uri }} test
404+ wikigraph {{ uri }} test [--json]
405+
406+ Notes:
407+ - For `llm`, this sends a small request to the configured model.
408+ - For `wikispine`, this checks the built-in fetch service or local `wikispine` command.
409+ - Text success output is intentionally short.
410+ - With `--json`, success and failure both return `{ "ok": true|false, ... }`; failures set a non-zero exit code.
411+ - Without `--json`, failures print the command error. Use `wikigraph help readiness` and `wikigraph help config` to recover.
412+ {% if "/wikispine" in uri %}
413+ - Runtime setup and recovery guide: https://raw.githubusercontent.com/oomol-lab/wiki-graph/refs/heads/main/docs/wikispine-runtime.md
414+ {% endif %}
214415{% endif %}
215416
216417Related help:
0 commit comments