sieve-notes 0.2.0__tar.gz → 0.3.1__tar.gz
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.
- sieve_notes-0.3.1/CHANGELOG.md +39 -0
- {sieve_notes-0.2.0/sieve_notes.egg-info → sieve_notes-0.3.1}/PKG-INFO +116 -7
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/README.ja.md +110 -5
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/README.md +114 -5
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/docs/formats.md +1 -1
- sieve_notes-0.3.1/docs/graph.md +99 -0
- sieve_notes-0.3.1/docs/plan.md +139 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/docs/resolution.md +1 -1
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/docs/vocabulary.md +41 -1
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/pyproject.toml +2 -2
- {sieve_notes-0.2.0 → sieve_notes-0.3.1/sieve_notes.egg-info}/PKG-INFO +116 -7
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/sieve_notes.egg-info/SOURCES.txt +2 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/sieve_notes.py +1380 -8
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/tests/test_notes_nt.py +1412 -23
- sieve_notes-0.2.0/CHANGELOG.md +0 -22
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/LICENSE +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/MANIFEST.in +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/conftest.py +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/docs/convert.md +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/examples/README.md +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/examples/vault_mixed/meeting.md +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/examples/vault_mixed/overview.md +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/examples/vault_outline/meeting.md +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/examples/vault_outline/reading.md +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/examples/vault_wikilink/daily/2026-11-28.md +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/examples/vault_wikilink/ideas/plan.md +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/examples/vault_wikilink/index.md +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/setup.cfg +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/sieve_notes.egg-info/dependency_links.txt +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/sieve_notes.egg-info/entry_points.txt +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/sieve_notes.egg-info/top_level.txt +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/tests/public_text_baseline.json +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/tests/test_public_text.py +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/tools/check_public_text.py +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/tools/check_release_assets.py +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/tools/check_release_version.py +0 -0
- {sieve_notes-0.2.0 → sieve_notes-0.3.1}/tools/extract_changelog.py +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
## [0.3.1] - 2026-12-02
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- In the `graph` SVG (the `links` and `folders` views), every edge now starts on the boundary of its source node and ends on the boundary of its target node (within a pixel), so the arrowhead touches the target node instead of stopping short of it.
|
|
6
|
+
- An unknown `--format` for `index`, `blocks` and `convert` (for example `--format yaml`) now exits with the closed error word `invalid_option` and exit code 2, like every other invalid option. The valid outputs are unchanged.
|
|
7
|
+
- The version statements in `docs/formats.md` and `docs/resolution.md` show the current version.
|
|
8
|
+
|
|
9
|
+
## [0.3.0] - 2026-12-02
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `graph` draws the link graph of a vault: the `links` view (resolved note-to-note links, merged per direction with a link count), the `folders` view (aggregated per folder, `--depth`) and the `tree` view (folders and notes), each emitted as `svg`, `dot`, `mermaid` or `json`. The same input always produces the same bytes.
|
|
14
|
+
- The `graph` SVG is a static picture: no scripts, no external references, no absolute paths, black on white, with `<title>` and `<desc>`. `--no-names` replaces every display name by the shared node identifiers (`n1`, `n2`, ...).
|
|
15
|
+
- `plan` prints a placement plan from a small rules file (`--rules FILE`) (one rule per line, seven predicates, first match wins) and reports how every link of the vault would resolve after the planned moves (counts before and after, the changed links, and the state transitions). It only plans: nothing is moved, renamed or written.
|
|
16
|
+
- `plan` also ranks the notes of each folder: `--order KEY` (five keys) or a reference order (`--order-file FILE`); `--reverse` flips the direction.
|
|
17
|
+
|
|
18
|
+
## [0.2.0] - 2026-12-01
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- Math is observed: display math (`$$…$$`) is a `math` block in `blocks`, and `index` reports the `math_blocks` and `math_inline` counts for the whole vault and for each note. Math bodies are never emitted.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- Links, comments and block references inside math are no longer counted; 0.1.0 counted them. The same symbols outside math are counted as before.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- The supported-formats list no longer claims tags (0.1.0 does not observe tags), and math is added to the list.
|
|
31
|
+
|
|
32
|
+
## [0.1.0] - 2026-11-29
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- `index` observes the relations of a Markdown vault deterministically: notes, links, backlinks, broken links and orphan notes.
|
|
37
|
+
- `blocks` prints the structure of a note as a tree over a closed vocabulary (headings, paragraphs, lists, code, tables and more). Note bodies are not emitted.
|
|
38
|
+
- `convert` converts between the document form and the outliner form. It writes a new file and never modifies the original.
|
|
39
|
+
- `--self-check` verifies observation and conversion against a small bundled sample.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sieve-notes
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Deterministic observation and conversion for Markdown note vaults: note relations, block trees,
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Deterministic observation and conversion for Markdown note vaults: note relations, block trees, document-outline round trips, link graphs and placement plans
|
|
5
5
|
Author: Kai IWASAKI
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/neguseatama/sieve-notes
|
|
@@ -20,7 +20,7 @@ Description-Content-Type: text/markdown
|
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Dynamic: license-file
|
|
22
22
|
|
|
23
|
-
# Sieve Notes v0.
|
|
23
|
+
# Sieve Notes v0.3.1
|
|
24
24
|
|
|
25
25
|
English | [日本語](https://github.com/neguseatama/sieve-notes/blob/main/README.ja.md)
|
|
26
26
|
|
|
@@ -33,6 +33,10 @@ note-taking app, called a vault below) and deterministically produces:
|
|
|
33
33
|
lowered into one closed vocabulary (no note bodies are emitted).
|
|
34
34
|
3. **Document ⇄ outline conversion** — a pure conversion through the tree.
|
|
35
35
|
The original file is never modified; the result goes to a new file.
|
|
36
|
+
4. **The link graph** — the note relations as a picture (`svg`) or as text
|
|
37
|
+
for existing drawing tools (`dot`, `mermaid`) or for machines (`json`).
|
|
38
|
+
5. **Placement and order plans** — where each note could be placed, and in
|
|
39
|
+
which order the notes of a folder would stand, before anything is moved.
|
|
36
40
|
|
|
37
41
|
It runs on the standard library alone (no runtime dependencies).
|
|
38
42
|
Python 3.10 or later. It works offline and sends no telemetry.
|
|
@@ -56,6 +60,102 @@ broken a.md:7 wikilink broken ghost
|
|
|
56
60
|
`index` observes the relations of the whole vault. For machines use
|
|
57
61
|
`--format json` (the `notes_version: 1` contract).
|
|
58
62
|
|
|
63
|
+
The graph of the bundled example vault (`examples/vault_wikilink`), drawn by
|
|
64
|
+
`graph` itself:
|
|
65
|
+
|
|
66
|
+

|
|
67
|
+
|
|
68
|
+
```console
|
|
69
|
+
$ sieve-notes graph ./vault --view links --format json
|
|
70
|
+
{
|
|
71
|
+
"command": "graph",
|
|
72
|
+
"edges": [
|
|
73
|
+
{
|
|
74
|
+
"from": "n1",
|
|
75
|
+
"links": 1,
|
|
76
|
+
"to": "n3"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"from": "n2",
|
|
80
|
+
"links": 1,
|
|
81
|
+
"to": "n3"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"from": "n3",
|
|
85
|
+
"links": 1,
|
|
86
|
+
"to": "n1"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"from": "n3",
|
|
90
|
+
"links": 3,
|
|
91
|
+
"to": "n2"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"exit_code": 0,
|
|
95
|
+
"nodes": [
|
|
96
|
+
{
|
|
97
|
+
"id": "n1",
|
|
98
|
+
"kind": "note",
|
|
99
|
+
"path": "daily/2026-11-28.md"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "n2",
|
|
103
|
+
"kind": "note",
|
|
104
|
+
"path": "ideas/plan.md"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"id": "n3",
|
|
108
|
+
"kind": "note",
|
|
109
|
+
"path": "index.md"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"notes_version": 1,
|
|
113
|
+
"totals": {
|
|
114
|
+
"edges": 4,
|
|
115
|
+
"links_outside_scope": 0,
|
|
116
|
+
"nodes": 3
|
|
117
|
+
},
|
|
118
|
+
"view": "links"
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`graph` shows the same relations as a picture or text. The nodes are `n1`,
|
|
123
|
+
`n2`, ... in a fixed order, the same in every format, so the picture and the
|
|
124
|
+
JSON can be joined. `--no-names` shares the structure without the note
|
|
125
|
+
names, and `--max-nodes` (default 200) stops with an error instead of
|
|
126
|
+
drawing a huge graph.
|
|
127
|
+
|
|
128
|
+
```console
|
|
129
|
+
$ sieve-notes plan ./vault --rules rules.txt
|
|
130
|
+
notes 3
|
|
131
|
+
move 2
|
|
132
|
+
stay 0
|
|
133
|
+
unmatched 1
|
|
134
|
+
blocked_collision 0
|
|
135
|
+
links_before resolved=8 broken=1 ambiguous=0 fragment_missing=0
|
|
136
|
+
links_after resolved=4 broken=5 ambiguous=0 fragment_missing=0
|
|
137
|
+
transitions resolved→broken=4
|
|
138
|
+
move daily/2026-11-28.md -> journal rule=1
|
|
139
|
+
move ideas/plan.md -> projects rule=2
|
|
140
|
+
changed index.md:3 wikilink from=daily/2026-11-28.md to=-
|
|
141
|
+
changed index.md:4 wikilink from=ideas/plan.md to=-
|
|
142
|
+
changed index.md:5 wikilink from=ideas/plan.md to=-
|
|
143
|
+
changed index.md:8 markdown_link from=ideas/plan.md to=-
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
with `rules.txt`:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
path:daily/* => journal
|
|
150
|
+
name:plan => projects
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`plan` only plans: nothing is moved, renamed or written. The report tells
|
|
154
|
+
you what would happen to the links if the moves were carried out — here the
|
|
155
|
+
four path-form links of `index.md` would break, while the name-only
|
|
156
|
+
`[[index]]` links of the moved notes keep working. `unmatched` counts the
|
|
157
|
+
notes that no rule matched.
|
|
158
|
+
|
|
59
159
|
```console
|
|
60
160
|
$ sieve-notes blocks ./vault/notes/plan.md
|
|
61
161
|
dialect document
|
|
@@ -95,11 +195,18 @@ It never overwrites an existing output file (exit code 2).
|
|
|
95
195
|
`--dialect auto|document|outline` selects the dialect.
|
|
96
196
|
- `sieve-notes convert FILE --to outline|document -o OUT` — conversion.
|
|
97
197
|
`--indent tab|2|4` selects the item indentation (the default is two spaces).
|
|
198
|
+
- `sieve-notes graph PATH` — the link graph
|
|
199
|
+
(`--view links|folders|tree`, `--format svg|dot|mermaid|json`,
|
|
200
|
+
`--scope DIR`, `--depth N`, `--max-nodes N`, `--no-names`, `-o FILE`).
|
|
201
|
+
- `sieve-notes plan PATH` — a placement or order plan
|
|
202
|
+
(`--rules FILE`, `--order name|links|backlinks|heading|size`,
|
|
203
|
+
`--order-file FILE`, `--reverse`, `--strict`).
|
|
98
204
|
- `sieve-notes --self-check` — verifies the bundled small sample
|
|
99
205
|
(exit codes 0 / 1 / 2).
|
|
100
206
|
|
|
101
|
-
From Python, the
|
|
102
|
-
`convert_text` return the same shape
|
|
207
|
+
From Python, the five functions `index_vault` / `block_tree` /
|
|
208
|
+
`convert_text` / `graph_vault` / `plan_vault` return the same shape
|
|
209
|
+
(`notes_version: 1`).
|
|
103
210
|
|
|
104
211
|
## Supported formats
|
|
105
212
|
|
|
@@ -117,8 +224,10 @@ From Python, the three functions `index_vault` / `block_tree` /
|
|
|
117
224
|
The sources per format and the rules of this version live in docs:
|
|
118
225
|
`docs/formats.md` (supported formats and their official sources),
|
|
119
226
|
`docs/vocabulary.md` (the closed vocabulary and the output contract),
|
|
120
|
-
`docs/resolution.md` (the link resolution rules)
|
|
121
|
-
`docs/convert.md` (the conversion rules and properties)
|
|
227
|
+
`docs/resolution.md` (the link resolution rules),
|
|
228
|
+
`docs/convert.md` (the conversion rules and properties),
|
|
229
|
+
`docs/graph.md` (the link graph) and
|
|
230
|
+
`docs/plan.md` (the placement and order plans).
|
|
122
231
|
|
|
123
232
|
## License
|
|
124
233
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
# Sieve Notes v0.
|
|
1
|
+
# Sieve Notes v0.3.1
|
|
2
2
|
|
|
3
3
|
[English](https://github.com/neguseatama/sieve-notes/blob/main/README.md) | 日本語
|
|
4
4
|
|
|
5
5
|
Markdown のノートを集めたフォルダ(ノート用アプリの保管庫。以下 vault)を
|
|
6
|
-
読み、次の
|
|
6
|
+
読み、次の 5 つを、決定論的に出すコマンドラインの道具です。
|
|
7
7
|
|
|
8
8
|
1. **ノートの関係の観測** — 一覧・リンク・被リンク・切れたリンク・孤立したノート。
|
|
9
9
|
2. **ブロックの木** — 見出し・段落・リスト・コード・表などを、閉じた語彙の木に落とします(本文は出しません)。
|
|
10
10
|
3. **ドキュメント ⇄ アウトラインの変換** — 構造木を介した純粋な変換。元のファイルは変えず、新しいファイルに書き出します。
|
|
11
|
+
4. **リンク関係の図** — ノートのつながりを、図(`svg`)や、既存の描画ツール向けの文章(`dot`・`mermaid`)、機械向けの形(`json`)で出します。
|
|
12
|
+
5. **置き場所と並び順の計画** — どのノートをどこに置けるか、各フォルダのノートがどんな順に並ぶかを、動かす前に出します。
|
|
11
13
|
|
|
12
14
|
標準ライブラリだけで動きます(実行時の依存は 1 つもありません)。
|
|
13
15
|
Python 3.10 以上。オフラインで動き、利用の記録を送りません。
|
|
@@ -31,6 +33,100 @@ broken a.md:7 wikilink broken ghost
|
|
|
31
33
|
`index` は vault 全体の関係を観測します。機械で読む形は
|
|
32
34
|
`--format json`(`notes_version: 1` の契約)です。
|
|
33
35
|
|
|
36
|
+
同梱の例の vault(`examples/vault_wikilink`)の graph が描いた図です:
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
```console
|
|
41
|
+
$ sieve-notes graph ./vault --view links --format json
|
|
42
|
+
{
|
|
43
|
+
"command": "graph",
|
|
44
|
+
"edges": [
|
|
45
|
+
{
|
|
46
|
+
"from": "n1",
|
|
47
|
+
"links": 1,
|
|
48
|
+
"to": "n3"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"from": "n2",
|
|
52
|
+
"links": 1,
|
|
53
|
+
"to": "n3"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"from": "n3",
|
|
57
|
+
"links": 1,
|
|
58
|
+
"to": "n1"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"from": "n3",
|
|
62
|
+
"links": 3,
|
|
63
|
+
"to": "n2"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"exit_code": 0,
|
|
67
|
+
"nodes": [
|
|
68
|
+
{
|
|
69
|
+
"id": "n1",
|
|
70
|
+
"kind": "note",
|
|
71
|
+
"path": "daily/2026-11-28.md"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"id": "n2",
|
|
75
|
+
"kind": "note",
|
|
76
|
+
"path": "ideas/plan.md"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"id": "n3",
|
|
80
|
+
"kind": "note",
|
|
81
|
+
"path": "index.md"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"notes_version": 1,
|
|
85
|
+
"totals": {
|
|
86
|
+
"edges": 4,
|
|
87
|
+
"links_outside_scope": 0,
|
|
88
|
+
"nodes": 3
|
|
89
|
+
},
|
|
90
|
+
"view": "links"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`graph` は同じ関係を図や文章で出します。節点は決まった並び順の
|
|
95
|
+
`n1`・`n2`…で、形式をまたいで同じなので、図と JSON を突き合わせられます。
|
|
96
|
+
`--no-names` はノート名を見せずに構造だけを共有し、`--max-nodes`
|
|
97
|
+
(既定 200)は大きな図を描かずに誤りで止まります。
|
|
98
|
+
|
|
99
|
+
```console
|
|
100
|
+
$ sieve-notes plan ./vault --rules rules.txt
|
|
101
|
+
notes 3
|
|
102
|
+
move 2
|
|
103
|
+
stay 0
|
|
104
|
+
unmatched 1
|
|
105
|
+
blocked_collision 0
|
|
106
|
+
links_before resolved=8 broken=1 ambiguous=0 fragment_missing=0
|
|
107
|
+
links_after resolved=4 broken=5 ambiguous=0 fragment_missing=0
|
|
108
|
+
transitions resolved→broken=4
|
|
109
|
+
move daily/2026-11-28.md -> journal rule=1
|
|
110
|
+
move ideas/plan.md -> projects rule=2
|
|
111
|
+
changed index.md:3 wikilink from=daily/2026-11-28.md to=-
|
|
112
|
+
changed index.md:4 wikilink from=ideas/plan.md to=-
|
|
113
|
+
changed index.md:5 wikilink from=ideas/plan.md to=-
|
|
114
|
+
changed index.md:8 markdown_link from=ideas/plan.md to=-
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`rules.txt` の中身:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
path:daily/* => journal
|
|
121
|
+
name:plan => projects
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`plan` は計画を出すだけで、ファイルを動かしませんし名前も変えませんし書き込みもしません。
|
|
125
|
+
報告は、計画どおりに動かしたならリンクがどう変わるかを示します —
|
|
126
|
+
この例では `index.md` のパス付きのリンク 4 件が切れ、動く側のノートの
|
|
127
|
+
名前だけの `[[index]]` は切れません。`unmatched` は、どの規則にも
|
|
128
|
+
合わなかったノートの件数です。
|
|
129
|
+
|
|
34
130
|
```console
|
|
35
131
|
$ sieve-notes blocks ./vault/notes/plan.md
|
|
36
132
|
dialect document
|
|
@@ -70,11 +166,18 @@ output plan-outline.md
|
|
|
70
166
|
`--dialect auto|document|outline` で方言を指定できます。
|
|
71
167
|
- `sieve-notes convert FILE --to outline|document -o OUT` — 変換。
|
|
72
168
|
`--indent tab|2|4` で項目の字下げの文字を選びます(既定は空白 2 個)。
|
|
169
|
+
- `sieve-notes graph PATH` — リンク関係の図
|
|
170
|
+
(`--view links|folders|tree`、`--format svg|dot|mermaid|json`、
|
|
171
|
+
`--scope DIR`、`--depth N`、`--max-nodes N`、`--no-names`、`-o FILE`)。
|
|
172
|
+
- `sieve-notes plan PATH` — 置き場所と並び順の計画
|
|
173
|
+
(`--rules FILE`、`--order name|links|backlinks|heading|size`、
|
|
174
|
+
`--order-file FILE`、`--reverse`、`--strict`)。
|
|
73
175
|
- `sieve-notes --self-check` — 同梱の小さな試料で、観測と変換が
|
|
74
176
|
期待どおりか確かめます(終了符号 0 / 1 / 2)。
|
|
75
177
|
|
|
76
|
-
Python からは `index_vault` / `block_tree` / `convert_text`
|
|
77
|
-
|
|
178
|
+
Python からは `index_vault` / `block_tree` / `convert_text` /
|
|
179
|
+
`graph_vault` / `plan_vault` の 5 つの関数が同じ形
|
|
180
|
+
(`notes_version: 1`)を返します。
|
|
78
181
|
|
|
79
182
|
## 対応する書式
|
|
80
183
|
|
|
@@ -93,7 +196,9 @@ Python からは `index_vault` / `block_tree` / `convert_text` の
|
|
|
93
196
|
`docs/formats.md`(対応する書式と公式の文書の出所)・
|
|
94
197
|
`docs/vocabulary.md`(閉じた語彙と出力の契約)・
|
|
95
198
|
`docs/resolution.md`(リンクの解決の規則)・
|
|
96
|
-
`docs/convert.md
|
|
199
|
+
`docs/convert.md`(変換の規則と性質)・
|
|
200
|
+
`docs/graph.md`(リンク関係の図)・
|
|
201
|
+
`docs/plan.md`(置き場所と並び順の計画)。
|
|
97
202
|
|
|
98
203
|
## ライセンス
|
|
99
204
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Sieve Notes v0.
|
|
1
|
+
# Sieve Notes v0.3.1
|
|
2
2
|
|
|
3
3
|
English | [日本語](https://github.com/neguseatama/sieve-notes/blob/main/README.ja.md)
|
|
4
4
|
|
|
@@ -11,6 +11,10 @@ note-taking app, called a vault below) and deterministically produces:
|
|
|
11
11
|
lowered into one closed vocabulary (no note bodies are emitted).
|
|
12
12
|
3. **Document ⇄ outline conversion** — a pure conversion through the tree.
|
|
13
13
|
The original file is never modified; the result goes to a new file.
|
|
14
|
+
4. **The link graph** — the note relations as a picture (`svg`) or as text
|
|
15
|
+
for existing drawing tools (`dot`, `mermaid`) or for machines (`json`).
|
|
16
|
+
5. **Placement and order plans** — where each note could be placed, and in
|
|
17
|
+
which order the notes of a folder would stand, before anything is moved.
|
|
14
18
|
|
|
15
19
|
It runs on the standard library alone (no runtime dependencies).
|
|
16
20
|
Python 3.10 or later. It works offline and sends no telemetry.
|
|
@@ -34,6 +38,102 @@ broken a.md:7 wikilink broken ghost
|
|
|
34
38
|
`index` observes the relations of the whole vault. For machines use
|
|
35
39
|
`--format json` (the `notes_version: 1` contract).
|
|
36
40
|
|
|
41
|
+
The graph of the bundled example vault (`examples/vault_wikilink`), drawn by
|
|
42
|
+
`graph` itself:
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
```console
|
|
47
|
+
$ sieve-notes graph ./vault --view links --format json
|
|
48
|
+
{
|
|
49
|
+
"command": "graph",
|
|
50
|
+
"edges": [
|
|
51
|
+
{
|
|
52
|
+
"from": "n1",
|
|
53
|
+
"links": 1,
|
|
54
|
+
"to": "n3"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"from": "n2",
|
|
58
|
+
"links": 1,
|
|
59
|
+
"to": "n3"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"from": "n3",
|
|
63
|
+
"links": 1,
|
|
64
|
+
"to": "n1"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"from": "n3",
|
|
68
|
+
"links": 3,
|
|
69
|
+
"to": "n2"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"exit_code": 0,
|
|
73
|
+
"nodes": [
|
|
74
|
+
{
|
|
75
|
+
"id": "n1",
|
|
76
|
+
"kind": "note",
|
|
77
|
+
"path": "daily/2026-11-28.md"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "n2",
|
|
81
|
+
"kind": "note",
|
|
82
|
+
"path": "ideas/plan.md"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"id": "n3",
|
|
86
|
+
"kind": "note",
|
|
87
|
+
"path": "index.md"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"notes_version": 1,
|
|
91
|
+
"totals": {
|
|
92
|
+
"edges": 4,
|
|
93
|
+
"links_outside_scope": 0,
|
|
94
|
+
"nodes": 3
|
|
95
|
+
},
|
|
96
|
+
"view": "links"
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`graph` shows the same relations as a picture or text. The nodes are `n1`,
|
|
101
|
+
`n2`, ... in a fixed order, the same in every format, so the picture and the
|
|
102
|
+
JSON can be joined. `--no-names` shares the structure without the note
|
|
103
|
+
names, and `--max-nodes` (default 200) stops with an error instead of
|
|
104
|
+
drawing a huge graph.
|
|
105
|
+
|
|
106
|
+
```console
|
|
107
|
+
$ sieve-notes plan ./vault --rules rules.txt
|
|
108
|
+
notes 3
|
|
109
|
+
move 2
|
|
110
|
+
stay 0
|
|
111
|
+
unmatched 1
|
|
112
|
+
blocked_collision 0
|
|
113
|
+
links_before resolved=8 broken=1 ambiguous=0 fragment_missing=0
|
|
114
|
+
links_after resolved=4 broken=5 ambiguous=0 fragment_missing=0
|
|
115
|
+
transitions resolved→broken=4
|
|
116
|
+
move daily/2026-11-28.md -> journal rule=1
|
|
117
|
+
move ideas/plan.md -> projects rule=2
|
|
118
|
+
changed index.md:3 wikilink from=daily/2026-11-28.md to=-
|
|
119
|
+
changed index.md:4 wikilink from=ideas/plan.md to=-
|
|
120
|
+
changed index.md:5 wikilink from=ideas/plan.md to=-
|
|
121
|
+
changed index.md:8 markdown_link from=ideas/plan.md to=-
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
with `rules.txt`:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
path:daily/* => journal
|
|
128
|
+
name:plan => projects
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`plan` only plans: nothing is moved, renamed or written. The report tells
|
|
132
|
+
you what would happen to the links if the moves were carried out — here the
|
|
133
|
+
four path-form links of `index.md` would break, while the name-only
|
|
134
|
+
`[[index]]` links of the moved notes keep working. `unmatched` counts the
|
|
135
|
+
notes that no rule matched.
|
|
136
|
+
|
|
37
137
|
```console
|
|
38
138
|
$ sieve-notes blocks ./vault/notes/plan.md
|
|
39
139
|
dialect document
|
|
@@ -73,11 +173,18 @@ It never overwrites an existing output file (exit code 2).
|
|
|
73
173
|
`--dialect auto|document|outline` selects the dialect.
|
|
74
174
|
- `sieve-notes convert FILE --to outline|document -o OUT` — conversion.
|
|
75
175
|
`--indent tab|2|4` selects the item indentation (the default is two spaces).
|
|
176
|
+
- `sieve-notes graph PATH` — the link graph
|
|
177
|
+
(`--view links|folders|tree`, `--format svg|dot|mermaid|json`,
|
|
178
|
+
`--scope DIR`, `--depth N`, `--max-nodes N`, `--no-names`, `-o FILE`).
|
|
179
|
+
- `sieve-notes plan PATH` — a placement or order plan
|
|
180
|
+
(`--rules FILE`, `--order name|links|backlinks|heading|size`,
|
|
181
|
+
`--order-file FILE`, `--reverse`, `--strict`).
|
|
76
182
|
- `sieve-notes --self-check` — verifies the bundled small sample
|
|
77
183
|
(exit codes 0 / 1 / 2).
|
|
78
184
|
|
|
79
|
-
From Python, the
|
|
80
|
-
`convert_text` return the same shape
|
|
185
|
+
From Python, the five functions `index_vault` / `block_tree` /
|
|
186
|
+
`convert_text` / `graph_vault` / `plan_vault` return the same shape
|
|
187
|
+
(`notes_version: 1`).
|
|
81
188
|
|
|
82
189
|
## Supported formats
|
|
83
190
|
|
|
@@ -95,8 +202,10 @@ From Python, the three functions `index_vault` / `block_tree` /
|
|
|
95
202
|
The sources per format and the rules of this version live in docs:
|
|
96
203
|
`docs/formats.md` (supported formats and their official sources),
|
|
97
204
|
`docs/vocabulary.md` (the closed vocabulary and the output contract),
|
|
98
|
-
`docs/resolution.md` (the link resolution rules)
|
|
99
|
-
`docs/convert.md` (the conversion rules and properties)
|
|
205
|
+
`docs/resolution.md` (the link resolution rules),
|
|
206
|
+
`docs/convert.md` (the conversion rules and properties),
|
|
207
|
+
`docs/graph.md` (the link graph) and
|
|
208
|
+
`docs/plan.md` (the placement and order plans).
|
|
100
209
|
|
|
101
210
|
## License
|
|
102
211
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Supported formats and sources
|
|
2
2
|
|
|
3
|
-
The formats that Sieve Notes 0.
|
|
3
|
+
The formats that Sieve Notes 0.3.1 covers, with their sources (official
|
|
4
4
|
documentation). Formats are described by the name of the format itself. A
|
|
5
5
|
format that could not be confirmed in official documentation is listed under
|
|
6
6
|
"Not covered" and is not implemented in this version.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# The link graph (`graph`)
|
|
2
|
+
|
|
3
|
+
`graph PATH` builds the link graph of a vault and renders it as a figure or
|
|
4
|
+
as text. It observes; it never modifies, moves or deletes a file. With `-o
|
|
5
|
+
FILE` it writes one new file (an existing file is never overwritten, exit
|
|
6
|
+
code 2, `output_exists`) and prints nothing; without `-o` the figure goes to
|
|
7
|
+
standard output.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
sieve_notes.py graph PATH [--view links|folders|tree] [--format svg|dot|mermaid|json]
|
|
11
|
+
[-o FILE] [--scope DIR] [--depth N] [--max-nodes N] [--no-names]
|
|
12
|
+
[--include-hidden-dirs]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Defaults: `--view links`, `--format svg`, `--max-nodes 200`, `--depth 1`.
|
|
16
|
+
`--include-hidden-dirs` and the excluded folders follow `index`.
|
|
17
|
+
|
|
18
|
+
## Views
|
|
19
|
+
|
|
20
|
+
| View | Nodes | Edges |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| `links` (default) | notes | the resolved note-to-note links. Same-direction pairs are merged into one edge carrying the link count. Self links, broken, ambiguous, fragment-missing links and links to attachments are not edges |
|
|
23
|
+
| `folders` | folders, truncated to `--depth N` levels (notes at the root are `.`) | the resolved note-to-note links counted between the folders. Links inside one folder are not edges; they are counted in the node's `internal_links` |
|
|
24
|
+
| `tree` | folders and notes | containment (folder → its folders and notes). The root is `.` |
|
|
25
|
+
|
|
26
|
+
## Order and identifiers
|
|
27
|
+
|
|
28
|
+
Nodes are sorted by the normalized path (NFC, case-insensitive), ties by the
|
|
29
|
+
original characters. In the `tree` view the order is the walk over the tree;
|
|
30
|
+
inside a folder, folders come before notes. Nodes get the identifiers
|
|
31
|
+
`n1`, `n2`, ... in that order — the same identifiers in every format, so a
|
|
32
|
+
figure and its JSON can be joined. `--no-names` replaces every display name
|
|
33
|
+
by the identifier (the structure can be shared without the note names).
|
|
34
|
+
|
|
35
|
+
## `--scope DIR`
|
|
36
|
+
|
|
37
|
+
`DIR` is a relative path from the vault root (`.` is the root); only notes
|
|
38
|
+
under it are subjects. Links with exactly one endpoint inside the scope are
|
|
39
|
+
not edges and are counted in `totals.links_outside_scope`. A missing `DIR`
|
|
40
|
+
is `input_not_found`, a file is `not_a_directory`, a malformed `DIR`
|
|
41
|
+
(absolute, `..`, `\`) is `invalid_option`.
|
|
42
|
+
|
|
43
|
+
## Limits
|
|
44
|
+
|
|
45
|
+
When the number of nodes exceeds `--max-nodes`, nothing is emitted and the
|
|
46
|
+
exit code is 2 (`too_many_nodes`); it never truncates silently. `--depth`
|
|
47
|
+
belongs to the `folders` view; an explicit `--depth` with another view is
|
|
48
|
+
`invalid_option`.
|
|
49
|
+
|
|
50
|
+
## Formats
|
|
51
|
+
|
|
52
|
+
- `json` — the contract below (`notes_version: 1`); the key names are fixed.
|
|
53
|
+
- `dot` — Graphviz. The `links` view groups the notes of each top-level
|
|
54
|
+
folder into one non-nested `subgraph cluster_…`. Labels escape `"` and `\`.
|
|
55
|
+
An edge carries `label="N"` when N ≥ 2.
|
|
56
|
+
- `mermaid` — a `flowchart LR` body (no code fence). The `links` view groups
|
|
57
|
+
the notes per top-level folder with `subgraph`. Labels are wrapped in
|
|
58
|
+
`["…"]`; `"` becomes `#quot;`, `\` becomes `#92;`, `]` becomes `#93;` and
|
|
59
|
+
`|` becomes `#124;`. An edge carries `|"N"|` when N ≥ 2.
|
|
60
|
+
- `svg` — a static picture, black on white, with `<title>` and `<desc>`:
|
|
61
|
+
no `<script>`, no external references, no `foreignObject`, no absolute
|
|
62
|
+
path, no time and no randomness. Folders are rounded rectangles, notes are
|
|
63
|
+
ellipses. The `links` and `folders` views place the nodes on a circle in
|
|
64
|
+
node order; edges are curves bent toward the center (the bend side follows
|
|
65
|
+
the direction), with arrows, and the stroke width is 1 to 4 following the
|
|
66
|
+
link count. The `tree` view is drawn left to right: leaves in rows,
|
|
67
|
+
parents centered on their children, right-angle edges, column widths from
|
|
68
|
+
the widest label (ASCII counts 1, a wide letter counts 2). All coordinates
|
|
69
|
+
are integers inside the viewBox.
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"notes_version": 1,
|
|
74
|
+
"command": "graph",
|
|
75
|
+
"view": "links",
|
|
76
|
+
"nodes": [{"id": "n1", "path": "…", "kind": "note|folder",
|
|
77
|
+
"internal_links": 0}],
|
|
78
|
+
"edges": [{"from": "n1", "to": "n2", "links": 1}],
|
|
79
|
+
"totals": {"nodes": 3, "edges": 4, "links_outside_scope": 0},
|
|
80
|
+
"exit_code": 0
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`internal_links` appears only in the `folders` view; `tree` edges carry
|
|
85
|
+
`links: 1` (the containment). With `--no-names` the value of `path` is the
|
|
86
|
+
identifier. Rendering details (colors, zooming, clicking) are the job of the
|
|
87
|
+
viewer; this figure stays minimal and readable on its own.
|
|
88
|
+
|
|
89
|
+
## Exit codes
|
|
90
|
+
|
|
91
|
+
0 = emitted / 2 = cannot run (`input_not_found`, `not_a_directory`,
|
|
92
|
+
`invalid_option`, `too_many_nodes`, `output_exists`). There is no
|
|
93
|
+
`--strict`.
|
|
94
|
+
|
|
95
|
+
## Not in this version
|
|
96
|
+
|
|
97
|
+
No colors, themes, zooming or interaction (the viewer's job), no force-based
|
|
98
|
+
layout, and no tag observation. Nothing is planned or moved here — see
|
|
99
|
+
`docs/plan.md` for the placement plans.
|