wiki-graph 0.5.0 → 0.6.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.
- package/dist/cli.js +1249 -1243
- package/dist/cli.js.map +1 -1
- package/dist/data/help/commands/library-predicate.jinja +1 -1
- package/dist/data/help/commands/maintenance/chapter/add.jinja +2 -2
- package/dist/data/help/commands/maintenance/chapter/set-source.jinja +3 -20
- package/dist/data/help/commands/maintenance/chapter.jinja +3 -2
- package/dist/data/help/commands/maintenance/upgrade.jinja +2 -2
- package/dist/data/help/commands/maintenance.jinja +1 -1
- package/dist/data/help/commands/predicate.jinja +35 -21
- package/dist/data/help/commands/root.jinja +3 -1
- package/dist/data/help/commands/shared/chapter-source-set.jinja +21 -0
- package/dist/data/help/commands/uri.jinja +43 -4
- package/dist/data/help/topics/file-import.jinja +49 -0
- package/dist/data/help/topics/format.jinja +6 -4
- package/dist/data/help/topics/readiness.jinja +3 -1
- package/dist/data/help/topics/recipe.jinja +10 -10
- package/dist/data/help/topics/runtime.jinja +1 -1
- package/dist/data/help/topics/source-locators.jinja +45 -0
- package/dist/data/help/topics/uri.jinja +9 -1
- package/dist/gc-worker.js +482 -252
- package/dist/gc-worker.js.map +1 -1
- package/dist/index.cjs +1905 -622
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1659 -391
- package/dist/index.js.map +1 -1
- package/dist/queue-worker.js +1639 -646
- package/dist/queue-worker.js.map +1 -1
- package/package.json +9 -8
- package/LICENSE +0 -201
|
@@ -22,8 +22,8 @@ Behavior:
|
|
|
22
22
|
|
|
23
23
|
Output shape:
|
|
24
24
|
Prints the new chapter status.
|
|
25
|
-
|
|
26
|
-
With `--json`,
|
|
25
|
+
`Chapter` is the archive-relative handle; `Located URI` is the complete target for later commands.
|
|
26
|
+
With `--json`, the same values are `uri` and `locatedUri`; reuse `locatedUri` for later commands.
|
|
27
27
|
|
|
28
28
|
Typical next step:
|
|
29
29
|
{{ commandName }} wikg://local/job add --input <archive-uri|chapter-uri> --task reading-graph --accept-cost
|
|
@@ -1,31 +1,14 @@
|
|
|
1
1
|
Help Type: command
|
|
2
2
|
Command: {{ commandName }} <chapter-uri>/source set
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Usage:
|
|
8
|
-
{{ commandName }} <chapter-uri>/source set [text] [--input <path|->] [--llm <json>] [--json] [--help|-h]
|
|
9
|
-
|
|
10
|
-
Input:
|
|
11
|
-
- Source text is read from a positional value, `--input <path>`, or `--input -` for stdin.
|
|
12
|
-
|
|
13
|
-
Preconditions:
|
|
14
|
-
- The chapter must be `planned`.
|
|
15
|
-
- To replace source on a later-stage chapter, first reset it to `planned`.
|
|
16
|
-
|
|
17
|
-
Behavior:
|
|
18
|
-
- Writes normalized source text.
|
|
19
|
-
- Moves the chapter to `source`.
|
|
20
|
-
- Does not generate Reading Graph data.
|
|
21
|
-
- Does not generate or modify a summary.
|
|
22
|
-
- Does not call an LLM provider.
|
|
23
|
-
- With `--json`, prints the updated chapter status as one JSON object.
|
|
4
|
+
{% set uri = "<chapter-uri>/source" %}
|
|
5
|
+
{% include "help/commands/shared/chapter-source-set.jinja" %}
|
|
24
6
|
|
|
25
7
|
Typical next step:
|
|
26
8
|
{{ commandName }} wikg://local/job add --input <archive-uri|chapter-uri> --task reading-graph --accept-cost
|
|
27
9
|
|
|
28
10
|
See also:
|
|
11
|
+
- {{ commandName }} help file-import
|
|
29
12
|
- {{ commandName }} wikg://book.wikg/chapter/part/state --help
|
|
30
13
|
- {{ commandName }} wikg://book.wikg/chapter/part reset --help
|
|
31
14
|
- {{ commandName }} wikg://local/job --help
|
|
@@ -11,7 +11,7 @@ Usage:
|
|
|
11
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
|
-
{{ commandName }} <chapter-uri>/source set
|
|
14
|
+
{{ commandName }} <chapter-uri>/source set (<text>|--input <path|->) [--input-format jsonl] [--llm <json>] [--json] [--help|-h]
|
|
15
15
|
{{ commandName }} <chapter-uri>/summary set [text] [--input <path|->] [--llm <json>] [--json] [--help|-h]
|
|
16
16
|
{{ commandName }} <chapter-uri>/title set <title> [--llm <json>] [--help|-h]
|
|
17
17
|
{{ commandName }} <chapter-uri>/title clear [--llm <json>] [--help|-h]
|
|
@@ -29,7 +29,8 @@ Input rules:
|
|
|
29
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
|
-
- `<chapter-uri>/source set`
|
|
32
|
+
- `<chapter-uri>/source set` fills a planned chapter from one positional value or `--input <path|->`; use `--input-format jsonl` for externally extracted source provenance.
|
|
33
|
+
- `<chapter-uri>/summary set` reads a positional value, `--input <path>`, or `--input -` for stdin.
|
|
33
34
|
- `<chapter-uri>/title set <title>` renames a chapter in the tree; `<chapter-uri>/title clear` removes the explicit title.
|
|
34
35
|
- `move` changes parent/order only; it does not edit source, graph, or summary data.
|
|
35
36
|
- `tree` prints the chapter tree as JSON with `title: null` for untitled chapters.
|
|
@@ -9,7 +9,7 @@ Usage:
|
|
|
9
9
|
{{ commandName }} maintenance upgrade <path.sdpub> [--output <path.wikg>] [--json]
|
|
10
10
|
|
|
11
11
|
Targets:
|
|
12
|
-
- Home state: ~/.wikigraph
|
|
12
|
+
- Home state: home (or ~/.wikigraph)
|
|
13
13
|
- Standalone archive: ./book.wikg, /path/to/book.wikg, wikg://book.wikg, wikg:///path/to/book.wikg
|
|
14
14
|
- Legacy sdpub: ./book.sdpub, optionally with --output
|
|
15
15
|
- Library: wikg://lib or wikg://lib/<lib-id>
|
|
@@ -23,7 +23,7 @@ Notes:
|
|
|
23
23
|
- Library upgrade covers the registry and managed archive members for that library.
|
|
24
24
|
|
|
25
25
|
Examples:
|
|
26
|
-
{{ commandName }} maintenance upgrade
|
|
26
|
+
{{ commandName }} maintenance upgrade home
|
|
27
27
|
{{ commandName }} maintenance upgrade ./book.wikg
|
|
28
28
|
{{ commandName }} maintenance upgrade wikg://lib
|
|
29
29
|
{{ commandName }} maintenance upgrade ./book.sdpub --output ./book.wikg
|
|
@@ -11,7 +11,7 @@ Commands:
|
|
|
11
11
|
upgrade Upgrade home state, a .wikg archive, a library, or migrate .sdpub.
|
|
12
12
|
|
|
13
13
|
Upgrade targets:
|
|
14
|
-
{{ commandName }} maintenance upgrade
|
|
14
|
+
{{ commandName }} maintenance upgrade home
|
|
15
15
|
{{ commandName }} maintenance upgrade ./book.wikg
|
|
16
16
|
{{ commandName }} maintenance upgrade wikg://book.wikg
|
|
17
17
|
{{ commandName }} maintenance upgrade ./book.sdpub [--output ./book.wikg]
|
|
@@ -4,7 +4,7 @@ Command: {{ commandName }} <uri> {{ predicate }}
|
|
|
4
4
|
URI Predicate Command
|
|
5
5
|
|
|
6
6
|
Target:
|
|
7
|
-
{{
|
|
7
|
+
{{ displayUri }}
|
|
8
8
|
|
|
9
9
|
Predicate:
|
|
10
10
|
{{ predicate }}
|
|
@@ -37,6 +37,7 @@ Notes:
|
|
|
37
37
|
- Add `--skip-unindexed` only with `--query` when you intentionally want to search indexed chapters and ignore uncovered chapters.
|
|
38
38
|
- Without `--query`, `--reverse` reads Document Flow order backward. See `{{ commandName }} help uri`.
|
|
39
39
|
- Evidence previews include nearby source context by default; use `--context 0` for exact cited ranges.
|
|
40
|
+
- To trace an evidence passage to an imported PDF or EPUB location, move its sentence fragment to `<chapter-uri>/source/locators#<range>`; read `{{ commandName }} help source-locators`.
|
|
40
41
|
- Source and scope URIs are not evidence targets.
|
|
41
42
|
{% elif predicate == "pack" %}
|
|
42
43
|
Purpose:
|
|
@@ -54,13 +55,15 @@ Purpose:
|
|
|
54
55
|
Create the archive at this URI.
|
|
55
56
|
|
|
56
57
|
Usage:
|
|
57
|
-
{{ commandName }} {{ uri }} create [--import <
|
|
58
|
+
{{ commandName }} {{ uri }} create [--import <source-file>] [--replace] [--json]
|
|
58
59
|
|
|
59
60
|
Notes:
|
|
60
61
|
- Without `--import`, create an empty `.wikg` archive.
|
|
61
|
-
- `--import <
|
|
62
|
-
-
|
|
63
|
-
-
|
|
62
|
+
- `--import <source-file>` creates the archive and imports the source file's metadata, structure, and source text.
|
|
63
|
+
- File import also records source provenance so normalized source text can be traced back to the imported file.
|
|
64
|
+
- The imported file itself is not embedded in the `.wikg` archive.
|
|
65
|
+
- `create` does not read stdin. Read `{{ commandName }} help file-import` for supported source files and import boundaries.
|
|
66
|
+
- File import runs only the import/source stage and does not call an LLM provider.
|
|
64
67
|
- Existing archives are not overwritten by default. Use `--replace` only when the target archive should be discarded and recreated.
|
|
65
68
|
- Parent directories must already exist.
|
|
66
69
|
- On success, text output is the archive object (`<archive>`). With `--json`, output is `{"uri":"..."}`.
|
|
@@ -133,9 +136,16 @@ Usage:
|
|
|
133
136
|
|
|
134
137
|
Notes:
|
|
135
138
|
- Without `--input`, creates an empty planned chapter placeholder.
|
|
136
|
-
- With `--input <path
|
|
137
|
-
|
|
138
|
-
-
|
|
139
|
+
- With `--input <path|->`, reads non-empty UTF-8 plain text, does not infer a
|
|
140
|
+
format from the file name, and creates the chapter in the `source` stage.
|
|
141
|
+
- This plain-text path does not create a source-text map or call an LLM
|
|
142
|
+
provider. Read `{{ commandName }} help file-import` for source locators.
|
|
143
|
+
- Chapter handles are opaque and are not derived from `--title`; reuse the
|
|
144
|
+
returned `locatedUri` for later commands.
|
|
145
|
+
|
|
146
|
+
Output:
|
|
147
|
+
- Text output includes `Chapter`, the archive-relative handle, and `Located URI`, the complete target for later commands.
|
|
148
|
+
- With `--json`, the same values are `uri` and `locatedUri`; reuse `locatedUri` for later commands.
|
|
139
149
|
{% elif predicate == "add" and target.name == "job-collection-scope" %}
|
|
140
150
|
Purpose:
|
|
141
151
|
Add a local build job.
|
|
@@ -150,6 +160,7 @@ Notes:
|
|
|
150
160
|
- Reading Graph and Knowledge Graph jobs require a current FTS artifact for the chapter.
|
|
151
161
|
- Summary embedding jobs require an existing non-empty summary.
|
|
152
162
|
- Archive input adds jobs for all eligible chapters; chapter input expands to the chapter subtree by default.
|
|
163
|
+
- For archive-wide indexing, use `{{ commandName }} wikg://local/job --json` to inspect the jobs and re-run archive `inspect` to verify coverage.
|
|
153
164
|
- Use `--depth <N>` with archive or chapter input to limit affected chapters. For archive input, depth is measured from the archive's root chapters; for chapter input, it is measured from the specified chapter. `--depth 0` means only the relevant root chapters or specified chapter.
|
|
154
165
|
- `--llm <json>` stores a job-local LLM object; it does not update `wikg://local/config/llm`.
|
|
155
166
|
{% elif predicate == "move" %}
|
|
@@ -193,9 +204,13 @@ Usage:
|
|
|
193
204
|
{{ commandName }} {{ uri }} reset --to planned|source|reading-graph [--json]
|
|
194
205
|
|
|
195
206
|
Notes:
|
|
196
|
-
- `planned` deletes source text, Reading Graph
|
|
197
|
-
|
|
198
|
-
- `
|
|
207
|
+
- `planned` deletes source text and provenance, Reading Graph, Knowledge Graph,
|
|
208
|
+
summary, and all chapter index artifacts.
|
|
209
|
+
- `source` keeps source text and provenance, and deletes Reading Graph,
|
|
210
|
+
Knowledge Graph, summary, and all chapter index artifacts.
|
|
211
|
+
- `reading-graph` keeps source text and provenance, Reading Graph, Knowledge
|
|
212
|
+
Graph, and the source embedding artifact. It deletes summary, FTS, and the
|
|
213
|
+
summary embedding artifact.
|
|
199
214
|
- `reading-summary` and `knowledge-graph` are not supported reset targets.
|
|
200
215
|
- Reset is destructive and may discard generated work.
|
|
201
216
|
{% elif predicate == "set" %}
|
|
@@ -211,16 +226,7 @@ Notes:
|
|
|
211
226
|
- Use `--input -` to read the tree JSON from stdin.
|
|
212
227
|
- This rewires chapter hierarchy and order; it does not rewrite chapter source text or generated graph content.
|
|
213
228
|
{% elif target.name == "chapter-source-object" %}
|
|
214
|
-
|
|
215
|
-
Replace this chapter source text.
|
|
216
|
-
|
|
217
|
-
Usage:
|
|
218
|
-
{{ commandName }} {{ uri }} set [text] [--input <path|->]
|
|
219
|
-
|
|
220
|
-
Notes:
|
|
221
|
-
- Source text is read from a positional value, `--input <path>`, or `--input -` for stdin.
|
|
222
|
-
- Source replacement invalidates later generated work for that chapter.
|
|
223
|
-
- Use `{{ commandName }} {{ uri }} --help` to inspect the source object before replacing it.
|
|
229
|
+
{% include "help/commands/shared/chapter-source-set.jinja" %}
|
|
224
230
|
{% elif target.name == "chapter-summary-object" %}
|
|
225
231
|
Purpose:
|
|
226
232
|
Replace this chapter summary text.
|
|
@@ -629,12 +635,20 @@ Library context:
|
|
|
629
635
|
Related help:
|
|
630
636
|
- {{ commandName }} {{ uri }} --help
|
|
631
637
|
- {{ commandName }} help uri
|
|
638
|
+
{% if target.name == "chapter-source-object" and predicate == "set" %}
|
|
639
|
+
- {{ commandName }} <chapter-uri>/state --help
|
|
640
|
+
- {{ commandName }} <chapter-uri> reset --help
|
|
641
|
+
- {{ commandName }} help file-import
|
|
642
|
+
{% endif %}
|
|
632
643
|
{% if predicate == "related" or predicate == "evidence" or predicate == "pack" or target.name == "index-object" or target.name == "chapter-index-artifact" or target.name == "job-collection-scope" %}
|
|
633
644
|
- {{ commandName }} help readiness
|
|
634
645
|
{% endif %}
|
|
635
646
|
{% if predicate == "create" or predicate == "export" %}
|
|
636
647
|
- {{ commandName }} help format
|
|
637
648
|
{% endif %}
|
|
649
|
+
{% if predicate == "create" %}
|
|
650
|
+
- {{ commandName }} help file-import
|
|
651
|
+
{% endif %}
|
|
638
652
|
{% if target.name == "job-collection-scope" or target.name == "job-object" or target.name == "job-target-object" %}
|
|
639
653
|
- {{ commandName }} help runtime
|
|
640
654
|
{% endif %}
|
|
@@ -82,9 +82,11 @@ Library entry point:
|
|
|
82
82
|
|
|
83
83
|
Help topics:
|
|
84
84
|
{% for topic in helpTopics %}
|
|
85
|
+
{% if topic.rootVisible is not defined or topic.rootVisible %}
|
|
85
86
|
- {{ commandName }} help {{ topic.name }}
|
|
86
87
|
{{ topic.summary }}
|
|
88
|
+
{% endif %}
|
|
87
89
|
{% endfor %}
|
|
88
90
|
|
|
89
|
-
|
|
91
|
+
Built-in formats:
|
|
90
92
|
{{ formats | join(", ") }}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Purpose:
|
|
2
|
+
Fill a planned chapter with its complete source text.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
{{ commandName }} {{ uri }} set (<text>|--input <path|->) [--input-format jsonl] [--json]
|
|
6
|
+
|
|
7
|
+
Input:
|
|
8
|
+
- Supply exactly one positional value or `--input`; files and stdin are UTF-8 plain text unless `--input-format jsonl` is set. File extensions are not inferred.
|
|
9
|
+
- Source input must not be empty.
|
|
10
|
+
- Plain text writes source without a source-text map.
|
|
11
|
+
- `--input-format jsonl` writes source and provenance supplied by an external extractor. Read `{{ commandName }} help file-import` for the record contract.
|
|
12
|
+
|
|
13
|
+
Preconditions:
|
|
14
|
+
- The chapter must be `planned`.
|
|
15
|
+
- Read the chapter state and reset help before discarding data from a later-stage chapter.
|
|
16
|
+
|
|
17
|
+
Behavior:
|
|
18
|
+
- Initializes source for a planned chapter; it does not replace source on a later-stage chapter.
|
|
19
|
+
- Writes the complete source text and moves the chapter to `source`.
|
|
20
|
+
- Does not generate Reading Graph data or a summary, and does not call an LLM provider.
|
|
21
|
+
- With `--json`, prints the updated chapter status as one JSON object. `sourceUnits` is the number of stored source processing fragments, not the number of sentences.
|
|
@@ -4,7 +4,7 @@ Command: {{ commandName }} <uri>
|
|
|
4
4
|
URI Command
|
|
5
5
|
|
|
6
6
|
Target:
|
|
7
|
-
{{
|
|
7
|
+
{{ displayUri }}
|
|
8
8
|
|
|
9
9
|
{% if target.name == "archive-scope" %}
|
|
10
10
|
URI type:
|
|
@@ -51,6 +51,12 @@ Default behavior:
|
|
|
51
51
|
|
|
52
52
|
Use when:
|
|
53
53
|
- You already selected a chapter and want local source, summary, chunk, entity, or triple objects.
|
|
54
|
+
|
|
55
|
+
Common child targets:
|
|
56
|
+
- `{{ commandName }} {{ uri }}/source --help`: normalized source text and source ranges.
|
|
57
|
+
- `{{ commandName }} {{ uri }}/summary --help`: chapter summary text and ranges.
|
|
58
|
+
- `{{ commandName }} {{ uri }}/state --help`: current stage and readiness.
|
|
59
|
+
- `{{ commandName }} {{ uri }}/title --help`: explicit chapter title.
|
|
54
60
|
{% elif target.name == "chunk-scope" %}
|
|
55
61
|
URI type:
|
|
56
62
|
Chunk scope
|
|
@@ -105,6 +111,31 @@ Use when:
|
|
|
105
111
|
{% if libraryContext.isLibraryWide %}
|
|
106
112
|
- Open returned triple object URIs for `evidence`; expand related context through the subject or object entity.
|
|
107
113
|
{% endif %}
|
|
114
|
+
{% elif target.name == "artifact-object" %}
|
|
115
|
+
URI type:
|
|
116
|
+
Source artifact object
|
|
117
|
+
|
|
118
|
+
Default behavior:
|
|
119
|
+
- `{{ commandName }} {{ uri }}` reads the imported file identity and available metadata.
|
|
120
|
+
- An artifact fragment selects one stored PDF page box or EPUB CFI; it is not a separate object.
|
|
121
|
+
|
|
122
|
+
Use when:
|
|
123
|
+
- A source passage returns an artifact locator URI and you need to inspect its source location.
|
|
124
|
+
- Read `{{ commandName }} help source-locators` for the mapping syntax.
|
|
125
|
+
{% elif target.name == "chapter-source-locator-scope" %}
|
|
126
|
+
URI type:
|
|
127
|
+
Source locator collection scope
|
|
128
|
+
|
|
129
|
+
Default behavior:
|
|
130
|
+
- `{{ commandName }} {{ uri }}` lists mappings from source-text character ranges to artifact locator URIs.
|
|
131
|
+
- Add a fragment such as `#4..8` to select source sentences 4 through 8 before listing their mappings.
|
|
132
|
+
- Returned character ranges are 1-based, inclusive, and local to the selected source text.
|
|
133
|
+
- Use `--limit <n>` for a bounded page, `{{ commandName }} next <cursor>` to continue, or `--all` for the complete collection.
|
|
134
|
+
- JSON and JSONL items have the shape `{"range":[1,23],"uri":"wikg://artifact/<short-uid>#..."}`.
|
|
135
|
+
|
|
136
|
+
Use when:
|
|
137
|
+
- You need to trace source text back to an imported PDF or EPUB location.
|
|
138
|
+
- Read `{{ commandName }} help source-locators` for artifact fragments and range semantics.
|
|
108
139
|
{% elif target.name == "chapter-source-object" %}
|
|
109
140
|
URI type:
|
|
110
141
|
Chapter source object
|
|
@@ -112,11 +143,13 @@ URI type:
|
|
|
112
143
|
Default behavior:
|
|
113
144
|
- `{{ commandName }} {{ uri }}` reads source text.
|
|
114
145
|
- Source range fragments such as `#4..8` read sentence numbers 4 through 8, inclusive.
|
|
146
|
+
- Range fragments are read-only; `set` fills the complete source object of a planned chapter.
|
|
115
147
|
- Range sentence numbers are 1-based. `#1` is the first sentence; `#1..2` is the first two sentences.
|
|
116
|
-
- Whole source reads
|
|
148
|
+
- Whole and ranged source reads print text by default. With `--json`, they return one object containing `uri` and `text`.
|
|
117
149
|
|
|
118
150
|
Use when:
|
|
119
151
|
- You need continuous original wording from a selected chapter.
|
|
152
|
+
- Open `{{ commandName }} {{ uri }}/locators --help` to trace this text to an imported source file.
|
|
120
153
|
{% elif target.name == "chapter-source-range-object" %}
|
|
121
154
|
URI type:
|
|
122
155
|
Chapter source range object
|
|
@@ -124,10 +157,12 @@ URI type:
|
|
|
124
157
|
Default behavior:
|
|
125
158
|
- `{{ commandName }} {{ uri }}` reads a structured source sentence range.
|
|
126
159
|
- Range sentence numbers are 1-based. `#1` is the first sentence; `#1..2` is the first two sentences.
|
|
127
|
-
-
|
|
160
|
+
- Range numbers address the current stored source revision and may change after source is reset and written again.
|
|
161
|
+
- Source range fragments support `--json`; the result contains `uri` and `text`.
|
|
128
162
|
|
|
129
163
|
Use when:
|
|
130
164
|
- You need bounded original wording with machine-readable range metadata.
|
|
165
|
+
- Move the fragment after `/locators`, as in `<chapter-uri>/source/locators#4..8`, to trace the selected sentences to an imported source file.
|
|
131
166
|
{% elif target.name == "chapter-summary-object" or target.name == "summary-object" %}
|
|
132
167
|
URI type:
|
|
133
168
|
Summary object
|
|
@@ -136,7 +171,7 @@ Default behavior:
|
|
|
136
171
|
- `{{ commandName }} {{ uri }}` reads summary text.
|
|
137
172
|
- Summary range fragments such as `#4..8` read sentence numbers 4 through 8, inclusive.
|
|
138
173
|
- Range sentence numbers are 1-based. `#1` is the first sentence; `#1..2` is the first two sentences.
|
|
139
|
-
- Whole summary reads
|
|
174
|
+
- Whole and ranged summary reads print text by default. With `--json`, they return one object containing `uri` and `text`.
|
|
140
175
|
- Summary readiness means a summary object exists and is current for the chapter source. It does not guarantee the prose answers every question about the chapter.
|
|
141
176
|
|
|
142
177
|
Use when:
|
|
@@ -335,6 +370,8 @@ Library context:
|
|
|
335
370
|
{% endif %}
|
|
336
371
|
- Library archive shortcuts such as `wikg://lib/arc/<archive-id>/chapter` query or maintain one managed archive through its membership id.
|
|
337
372
|
- Use a standalone archive URI or library archive shortcut for chapter maintenance writes.
|
|
373
|
+
{% elif target.name == "artifact-object" %}
|
|
374
|
+
- A source artifact belongs to one archive. Use a library archive shortcut such as `wikg://lib/arc/<archive-id>/artifact/<short-uid>` to open it through library membership.
|
|
338
375
|
{% elif target.name == "triple-scope" or target.name == "triple-object" %}
|
|
339
376
|
{% if libraryContext.isLibraryWide %}
|
|
340
377
|
- Library-wide scopes such as `wikg://lib/triple` use the aggregate library index.
|
|
@@ -441,6 +478,8 @@ Predicate commands:
|
|
|
441
478
|
- set: replace this local config section with a JSON object. Help: {{ commandName }} {{ uri }} set --help
|
|
442
479
|
{% elif target.name == "job-target-object" %}
|
|
443
480
|
- set: change this local job target. Help: {{ commandName }} {{ uri }} set --help
|
|
481
|
+
{% elif target.name == "chapter-source-object" %}
|
|
482
|
+
- set: initialize source for a planned chapter. Help: {{ commandName }} {{ uri }} set --help
|
|
444
483
|
{% else %}
|
|
445
484
|
{% if target.name == "metadata-object" %}
|
|
446
485
|
- set: replace this metadata map. Help: {{ commandName }} {{ uri }} set --help
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Help Type: topic
|
|
2
|
+
Topic: file-import
|
|
3
|
+
|
|
4
|
+
Source Files and Provenance
|
|
5
|
+
|
|
6
|
+
Purpose:
|
|
7
|
+
Put source-file content into a `.wikg` archive while keeping normalized text
|
|
8
|
+
traceable to the file and location that produced it.
|
|
9
|
+
|
|
10
|
+
Built-in EPUB import:
|
|
11
|
+
{{ commandName }} wikg://book.wikg create --import ./book.epub
|
|
12
|
+
- `create --import` currently accepts EPUB and creates its chapter structure,
|
|
13
|
+
source text, and source-text map.
|
|
14
|
+
|
|
15
|
+
External extractor input:
|
|
16
|
+
{{ commandName }} wikg://book.wikg/chapter add --title "Part" --json
|
|
17
|
+
{{ commandName }} <locatedUri>/source set --input ./source.jsonl --input-format jsonl
|
|
18
|
+
- Use this path for PDF, or when another extractor handles EPUB.
|
|
19
|
+
- Chapter paths are returned handles, not title-derived slugs. Reuse `locatedUri`
|
|
20
|
+
from the first command; the selected chapter must be `planned`.
|
|
21
|
+
|
|
22
|
+
JSONL contract:
|
|
23
|
+
- Each non-empty line is one `artifact` or `text` object. At least one of each is required.
|
|
24
|
+
- An artifact record is `{"type":"artifact","digest":"<64 hex SHA-256 of source file bytes>","mediaType":"application/pdf|application/epub+zip","name":"<optional>","identifier":"<optional>"}`.
|
|
25
|
+
- A text record is `{"type":"text","text":"...","locator":{...}}` and belongs to the most recently declared artifact.
|
|
26
|
+
- PDF locators are `{"pageIndex":1,"bbox":[left,bottom,right,top]}`; page indexes are 1-based and bbox coordinates are ordered numbers in `[0,1]`.
|
|
27
|
+
- EPUB locators are `{"cfi":"epubcfi(...)"}`.
|
|
28
|
+
- Text records are concatenated exactly in order. WG computes their Unicode character offsets; offsets are not input fields.
|
|
29
|
+
|
|
30
|
+
Minimal PDF example:
|
|
31
|
+
{"type":"artifact","digest":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef","mediaType":"application/pdf","name":"book.pdf"}
|
|
32
|
+
{"type":"text","text":"Source text\n","locator":{"pageIndex":1,"bbox":[0,0,1,1]}}
|
|
33
|
+
|
|
34
|
+
Verification:
|
|
35
|
+
{{ commandName }} <chapter-uri>/source/locators --json
|
|
36
|
+
- This independent scope lists the stored source-text mappings. Read `{{ commandName }} help source-locators` for its range syntax.
|
|
37
|
+
|
|
38
|
+
Boundaries:
|
|
39
|
+
- OCR, layout analysis, and format-specific extraction belong to the importer; WG consumes the contract above.
|
|
40
|
+
- WG stores normalized source text and its source-text map, not the original PDF or EPUB file.
|
|
41
|
+
- Source text remains usable without a source-text map, but evidence cannot point back to a PDF page or EPUB CFI.
|
|
42
|
+
- Source-file input does not generate Reading Graph, Summary, or Knowledge Graph
|
|
43
|
+
data.
|
|
44
|
+
|
|
45
|
+
See also:
|
|
46
|
+
- {{ commandName }} wikg://book.wikg create --help
|
|
47
|
+
- {{ commandName }} <chapter-uri>/source set --help
|
|
48
|
+
- {{ commandName }} help format
|
|
49
|
+
- {{ commandName }} help source-locators
|
|
@@ -10,7 +10,7 @@ Managed archive format:
|
|
|
10
10
|
wikg
|
|
11
11
|
|
|
12
12
|
Archive create/import input:
|
|
13
|
-
|
|
13
|
+
source files via `{{ commandName }} <archive-uri> create --import <source-file>`
|
|
14
14
|
|
|
15
15
|
Export formats:
|
|
16
16
|
txt, markdown, epub
|
|
@@ -23,7 +23,8 @@ Inference rules:
|
|
|
23
23
|
- File paths use their extension when the format flag is omitted.
|
|
24
24
|
- Transform stdin requires an explicit `--input-format`.
|
|
25
25
|
- Commands that accept content input use `--input <path>` for files and `--input -` for stdin.
|
|
26
|
-
- Archive chapter/source text commands read plain source text
|
|
26
|
+
- Archive chapter/source text commands read plain source text by default; `chapter/<path>/source set` also accepts `--input-format jsonl` for source provenance input.
|
|
27
|
+
- Read `{{ commandName }} help file-import` for source-file import behavior and provenance boundaries.
|
|
27
28
|
- Stdout text export requires an explicit or inferable output format.
|
|
28
29
|
- `transform --stage` is only valid when creating `.wikg` from source input.
|
|
29
30
|
|
|
@@ -31,8 +32,9 @@ Command output shapes:
|
|
|
31
32
|
- Default text output is for direct human reading and quick inspection.
|
|
32
33
|
- Use `--json` when an Agent or script needs one stable machine-readable response.
|
|
33
34
|
- Use `--jsonl` when a command returns many records, streams progress, or feeds a Unix pipeline.
|
|
34
|
-
- Whole `source` and `summary`
|
|
35
|
-
-
|
|
35
|
+
- Whole `source` and `summary` objects print plain text by default; with `--json`, both return `uri` and `text`.
|
|
36
|
+
- `<chapter-uri>/source/locators` is a paged collection whose JSON and JSONL items contain `range` and artifact locator `uri`.
|
|
37
|
+
- Ranged fragments such as `/source#20..30` and `/summary#20..30` use the same output choices and retain the requested range in `uri`.
|
|
36
38
|
- Source and summary range numbers are 1-based and inclusive.
|
|
37
39
|
- Commands that do not support `--json` or `--jsonl` say so in their command help or error message.
|
|
38
40
|
|
|
@@ -21,10 +21,12 @@ Archive index readiness:
|
|
|
21
21
|
|
|
22
22
|
Artifact behavior:
|
|
23
23
|
Chapter artifacts are stored inside the `.wikg` archive.
|
|
24
|
-
Build FTS artifacts
|
|
24
|
+
Build FTS artifacts locally for an archive or chapter, without provider calls:
|
|
25
|
+
{{ commandName }} wikg://local/job add --input <archive-uri|chapter-uri> --task index-fts
|
|
25
26
|
Build source embedding artifacts with the chapter index URI or queue target `index-embedding-source`.
|
|
26
27
|
Build summary embedding artifacts with the chapter index URI or queue target `index-embedding-summary`.
|
|
27
28
|
Building embedding artifacts requires `wikg://local/config/embeddings` and may call the configured provider.
|
|
29
|
+
Archive input creates one job per eligible chapter. Re-run inspect after the jobs finish to verify query readiness.
|
|
28
30
|
|
|
29
31
|
Cache behavior:
|
|
30
32
|
`{{ commandName }} <archive-uri>/index sync` builds or repairs local `index.db` cache from artifacts.
|
|
@@ -10,7 +10,7 @@ Purpose:
|
|
|
10
10
|
Operating rules:
|
|
11
11
|
- Never unzip a `.wikg` archive, rewrite internal files, or bypass this CLI. Use CLI commands for archive edits.
|
|
12
12
|
- Use Wiki Graph URIs as stable object handles.
|
|
13
|
-
- Use `--json` when you want stable Agent-readable fields instead of human text. Whole `source` and `summary`
|
|
13
|
+
- Use `--json` when you want stable Agent-readable fields instead of human text. Whole and ranged `source` and `summary` reads return `uri` and `text`.
|
|
14
14
|
- If you have a URI and need valid operations, run `{{ commandName }} <uri> --help`.
|
|
15
15
|
- If you need concrete predicate usage for that URI type, run `{{ commandName }} <uri> <predicate> --help`.
|
|
16
16
|
- Never pass a bare filesystem path to URI-targeted commands.
|
|
@@ -32,9 +32,11 @@ Choose your starting point:
|
|
|
32
32
|
{{ commandName }} help library
|
|
33
33
|
|
|
34
34
|
- User gave you source content and needs a reusable knowledge-base archive:
|
|
35
|
-
Create an empty
|
|
35
|
+
Create an empty archive and add UTF-8 chapter text, or create one while importing EPUB.
|
|
36
36
|
{{ commandName }} wikg://book.wikg create
|
|
37
|
+
{{ commandName }} wikg://book.wikg/chapter add --title "Part" --input ./chapter.txt
|
|
37
38
|
{{ commandName }} wikg://book.wikg create --import ./book.epub
|
|
39
|
+
Read `{{ commandName }} help file-import` for EPUB or source-locator JSONL.
|
|
38
40
|
|
|
39
41
|
- User needs one-shot conversion without keeping an archive:
|
|
40
42
|
Use transform. Source input usually requires LLM configuration.
|
|
@@ -50,14 +52,12 @@ After inspect:
|
|
|
50
52
|
{{ commandName }} wikg:///Users/me/book.wikg --query "attention memory"
|
|
51
53
|
{{ commandName }} wikg:///Users/me/book.wikg/chapter/part --query "attention"
|
|
52
54
|
|
|
53
|
-
- If inspect reports
|
|
54
|
-
{{ commandName }} <archive-uri
|
|
55
|
-
{{ commandName }} <archive-uri
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{{ commandName }}
|
|
59
|
-
Read readiness before deciding whether artifacts or cache are missing:
|
|
60
|
-
{{ commandName }} help readiness
|
|
55
|
+
- If inspect reports query blockers, build the free local FTS artifacts, then inspect again.
|
|
56
|
+
{{ commandName }} wikg://local/job add --input <archive-uri> --task index-fts
|
|
57
|
+
{{ commandName }} <archive-uri> inspect
|
|
58
|
+
If artifacts are ready but only the local cache is missing or outdated, sync it:
|
|
59
|
+
{{ commandName }} <archive-uri>/index sync
|
|
60
|
+
Read `{{ commandName }} help readiness` for artifact and cache alternatives.
|
|
61
61
|
|
|
62
62
|
- If library-wide query reports a missing, stale, or not-ready index cache, inspect the library index target and sync it when appropriate.
|
|
63
63
|
{{ commandName }} wikg://lib/index --help
|
|
@@ -8,7 +8,7 @@ Purpose:
|
|
|
8
8
|
|
|
9
9
|
Archive-first streams:
|
|
10
10
|
- `{{ commandName }} <archive-uri> create` creates an empty archive; it does not read stdin.
|
|
11
|
-
- `{{ commandName }} <archive-uri> create --import <
|
|
11
|
+
- `{{ commandName }} <archive-uri> create --import <source-file>` imports a source file into a new archive; read `{{ commandName }} help file-import` for the import contract.
|
|
12
12
|
- `{{ commandName }} <archive-uri> export --output-format markdown|txt` can write text projections to stdout.
|
|
13
13
|
- `{{ commandName }} transform --input-format markdown|txt --output-format markdown|txt` runs direct one-shot stream digest/export and usually requires LLM configuration.
|
|
14
14
|
- Retrieval commands print human-readable text by default and support `--json` where documented.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Help Type: topic
|
|
2
|
+
Topic: source-locators
|
|
3
|
+
|
|
4
|
+
Source Artifacts and Locator Scope
|
|
5
|
+
|
|
6
|
+
Purpose:
|
|
7
|
+
Trace a returned source passage back to the imported file location that
|
|
8
|
+
produced it.
|
|
9
|
+
|
|
10
|
+
Artifact URIs:
|
|
11
|
+
- A source artifact identifies an imported PDF or EPUB by the SHA-256 digest
|
|
12
|
+
of its file bytes. Output uses its stable archive-local short UID:
|
|
13
|
+
`wikg://artifact/<short-uid>`.
|
|
14
|
+
- A short UID starts with the first 12 digest characters and lengthens only
|
|
15
|
+
when needed for uniqueness. The full digest form remains valid:
|
|
16
|
+
`wikg://artifact/<sha256-digest>`.
|
|
17
|
+
- The short UID belongs to the archive, not to one chapter. Add the archive
|
|
18
|
+
locator when opening a returned short URI. Use the full `digest` from the
|
|
19
|
+
artifact details as its content identity across archives.
|
|
20
|
+
- A fragment selects a location inside that artifact. PDF uses
|
|
21
|
+
`#page=21&bbox=left,bottom,right,top`; EPUB uses `#epubcfi(...)`.
|
|
22
|
+
- PDF pages are 1-based. Bounding boxes use normalized `[0,1]` coordinates
|
|
23
|
+
in left,bottom,right,top order with a lower-left origin.
|
|
24
|
+
|
|
25
|
+
Locator scope:
|
|
26
|
+
{{ commandName }} <chapter-uri>/source/locators
|
|
27
|
+
{{ commandName }} <chapter-uri>/source/locators#4..8
|
|
28
|
+
- Source and evidence reads contain text only. Use this scope when provenance
|
|
29
|
+
details are needed.
|
|
30
|
+
- The fragment selects source sentences. Returned `range` values count Unicode
|
|
31
|
+
characters within the selected source text; both are 1-based and inclusive.
|
|
32
|
+
- Plain output is `3..13 -> <artifact-locator-uri>`. JSON and JSONL items are
|
|
33
|
+
`{"range":[3,13],"uri":"<artifact-locator-uri>"}`.
|
|
34
|
+
- Missing ranges mean those characters have no stored source locator.
|
|
35
|
+
- Use `--limit <n>` and `{{ commandName }} next <cursor>` for paging, or `--all`
|
|
36
|
+
for the complete collection.
|
|
37
|
+
|
|
38
|
+
Reading details:
|
|
39
|
+
{{ commandName }} <chapter-uri>/source/locators --json
|
|
40
|
+
{{ commandName }} wikg://book.wikg/artifact/<short-uid>
|
|
41
|
+
{{ commandName }} 'wikg://book.wikg/artifact/<short-uid>#page=21&bbox=0.1,0.2,0.9,0.35'
|
|
42
|
+
|
|
43
|
+
See also:
|
|
44
|
+
- {{ commandName }} help file-import
|
|
45
|
+
- {{ commandName }} help uri
|
|
@@ -31,6 +31,7 @@ Library locators:
|
|
|
31
31
|
wikg://lib/arc/<archive-id>/chapter
|
|
32
32
|
wikg://lib/arc/<archive-id>/entity
|
|
33
33
|
wikg://lib/arc/<archive-id>/triple
|
|
34
|
+
wikg://lib/arc/<archive-id>/artifact/<sha256-digest>
|
|
34
35
|
- Library-wide scopes such as `wikg://lib/entity` query the aggregate library index.
|
|
35
36
|
- Read `{{ commandName }} help library` before managing registry, membership, path binding, or library index lifecycle.
|
|
36
37
|
|
|
@@ -38,6 +39,8 @@ Short and located URIs:
|
|
|
38
39
|
Commands may return short object URIs without local file paths:
|
|
39
40
|
wikg://chapter/part/title
|
|
40
41
|
wikg://chapter/part/source#4..8
|
|
42
|
+
wikg://chapter/part/source/locators#4..8
|
|
43
|
+
wikg://artifact/<sha256-digest>#epubcfi(...)
|
|
41
44
|
wikg://chunk/12
|
|
42
45
|
wikg://entity/Q8018
|
|
43
46
|
wikg://triple/Q8018/discusses/Q123
|
|
@@ -61,7 +64,8 @@ Common command shapes:
|
|
|
61
64
|
{{ commandName }} <entity|triple|chunk-uri> evidence
|
|
62
65
|
{{ commandName }} <located-chunk-uri|located-entity-uri> pack
|
|
63
66
|
{{ commandName }} next <cursor>
|
|
64
|
-
{{ commandName }} <archive-uri> create [--import <
|
|
67
|
+
{{ commandName }} <archive-uri> create [--import <source-file>]
|
|
68
|
+
{{ commandName }} help file-import
|
|
65
69
|
{{ commandName }} <archive-uri> export --output-format <format>
|
|
66
70
|
{{ commandName }} <archive-uri> inspect
|
|
67
71
|
{{ commandName }} transform [options]
|
|
@@ -90,6 +94,7 @@ Scope URIs:
|
|
|
90
94
|
wikg://book.wikg/chapter/part/chunk
|
|
91
95
|
wikg://book.wikg/chapter/part/entity
|
|
92
96
|
wikg://book.wikg/chapter/part/triple
|
|
97
|
+
wikg://book.wikg/chapter/part/source/locators
|
|
93
98
|
wikg://book.wikg/chunk
|
|
94
99
|
wikg://book.wikg/entity
|
|
95
100
|
wikg://book.wikg/triple
|
|
@@ -105,6 +110,7 @@ Object URIs:
|
|
|
105
110
|
wikg://book.wikg/chapter/part/source#4..8
|
|
106
111
|
wikg://book.wikg/chapter/part/summary
|
|
107
112
|
wikg://book.wikg/chapter/part/summary#4..8
|
|
113
|
+
wikg://book.wikg/artifact/<sha256-digest>
|
|
108
114
|
wikg://book.wikg/chapter/part/chunk/12
|
|
109
115
|
wikg://book.wikg/chapter/part/entity/Q8018
|
|
110
116
|
wikg://book.wikg/chapter/part/triple/Q8018/discusses/Q123
|
|
@@ -127,10 +133,12 @@ Object boundaries:
|
|
|
127
133
|
- `chapter/<path>` is a scope, not an object.
|
|
128
134
|
- `chapter/<path>/title` is the queryable chapter title object.
|
|
129
135
|
- Whole `source` and `summary` objects are readable text streams, not collection scopes.
|
|
136
|
+
- `<chapter-uri>/source/locators` is a collection scope. Its optional fragment selects source sentences before their locator mappings are listed.
|
|
130
137
|
- Chapter-qualified scope URIs such as `<chapter-uri>/chunk`, `<chapter-uri>/entity`, and `<chapter-uri>/triple` expand to the chapter subtree and support `--depth`.
|
|
131
138
|
- Chapter-qualified resource and object URIs such as `/source`, `/summary`, `/title`, `/state`, `/chunk/<id>`, `/entity/<qid>`, and complete `/triple/<subject>/<predicate>/<object>` do not expand to subtrees and do not support `--depth`.
|
|
132
139
|
- `move`, `remove`, and `reset` are chapter node maintenance predicates; they target the chapter node itself, not the subtree. Use `remove --recursive` for explicit recursive deletion.
|
|
133
140
|
- Ranged fragments such as `/source#4..8` and `/summary#4..8` are structured range objects.
|
|
141
|
+
- In `/source/locators#4..8`, the fragment belongs to the locator scope and selects the same source sentence range.
|
|
134
142
|
- Source and summary range numbers are 1-based and inclusive. `/source#1..2` means the first two source sentences.
|
|
135
143
|
- Source text is the grounding material. `evidence` is not available for source, summary, or chapter scope URIs.
|
|
136
144
|
- `chunk`, `entity`, and `triple` can return source-backed evidence.
|