mdbind 0.1.2__tar.gz → 0.1.3__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.
- mdbind-0.1.3/MANIFEST.in +1 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/PKG-INFO +1 -1
- mdbind-0.1.3/llms.txt +219 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/pyproject.toml +1 -1
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind.egg-info/PKG-INFO +1 -1
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind.egg-info/SOURCES.txt +2 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/README.md +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/setup.cfg +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind/__init__.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind/cache.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind/cli.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind/composer.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind/cycle.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind/directives.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind/index.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind/models.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind/parser.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind.egg-info/dependency_links.txt +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind.egg-info/entry_points.txt +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind.egg-info/requires.txt +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/src/mdbind.egg-info/top_level.txt +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_cache.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_cli_compose.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_cli_get.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_cli_ia_v1.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_cli_ia_v2.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_cli_tree.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_cli_validate.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_cycle_detection.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_directives.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_examples.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_index.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_models.py +0 -0
- {mdbind-0.1.2 → mdbind-0.1.3}/tests/test_parser.py +0 -0
mdbind-0.1.3/MANIFEST.in
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include llms.txt
|
mdbind-0.1.3/llms.txt
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# mdbind
|
|
2
|
+
|
|
3
|
+
> A Python CLI tool (`mdb`) that turns Markdown repositories into a navigable directed knowledge graph. Sections become addressable nodes with stable URIs, structured YAML metadata, and explicit graph edges (`@include`, `@ref`).
|
|
4
|
+
|
|
5
|
+
## Core mental model
|
|
6
|
+
|
|
7
|
+
- **Repository**: a directory tree of `.md` files indexed as a graph.
|
|
8
|
+
- **Section**: an atomic node — a Markdown heading followed immediately by a YAML block containing `section: <id>`. The `section` field is mandatory and must be globally unique within the repository.
|
|
9
|
+
- **URI**: `path/to/file.md#section-id` — stable across reorganizations.
|
|
10
|
+
- **Directive**: a standard Markdown link used as a graph edge:
|
|
11
|
+
- `[@include: label](file.md#id)` — the target section is expanded inline during `mdb compose`.
|
|
12
|
+
- `[@ref: label](file.md#id)` — records a dependency edge without embedding content.
|
|
13
|
+
- **Root**: the `--root <dir>` flag tells commands which directory to index. Required for all graph-aware commands.
|
|
14
|
+
|
|
15
|
+
## Section syntax
|
|
16
|
+
|
|
17
|
+
```markdown
|
|
18
|
+
## Heading text
|
|
19
|
+
|
|
20
|
+
```yaml
|
|
21
|
+
section: unique-id
|
|
22
|
+
title: Human-readable title
|
|
23
|
+
owner: team-name
|
|
24
|
+
tags: [tag1, tag2]
|
|
25
|
+
status: active
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Body content here.
|
|
29
|
+
|
|
30
|
+
[@include: label](other.md#other-id)
|
|
31
|
+
[@ref: label](another.md#another-id)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Rules:
|
|
35
|
+
- The YAML block must be the first block after the heading. Any content before it is ignored.
|
|
36
|
+
- `section:` is the only required field. All other fields are free-form metadata.
|
|
37
|
+
- Duplicate `section:` IDs across the repository are a validation error.
|
|
38
|
+
|
|
39
|
+
## CLI reference
|
|
40
|
+
|
|
41
|
+
All commands are invoked as `mdb <command> [args] [options]`.
|
|
42
|
+
All commands accept `--json` to emit machine-readable JSON to stdout.
|
|
43
|
+
Exit code `0` = success; `1` = error or validation failure.
|
|
44
|
+
|
|
45
|
+
### mdb get <URI>
|
|
46
|
+
|
|
47
|
+
Returns the raw source lines of a section with full documentary fidelity.
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
mdb get docs/auth.md#auth
|
|
51
|
+
mdb get docs/auth.md#auth --json
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
JSON output fields: `id`, `title`, `file`, `source_start_line`, `source_end_line`, `raw_content`, `metadata`.
|
|
55
|
+
|
|
56
|
+
### mdb tree <URI>
|
|
57
|
+
|
|
58
|
+
Displays the dependency tree rooted at URI, following `@include` and `@ref` edges.
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
mdb tree docs/auth.md#auth --root docs/
|
|
62
|
+
mdb tree docs/auth.md#auth --root docs/ --depth 2
|
|
63
|
+
mdb tree docs/auth.md#auth --root docs/ --refs # include incoming edges
|
|
64
|
+
mdb tree docs/auth.md#auth --root docs/ --json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### mdb compose <URI>
|
|
68
|
+
|
|
69
|
+
Materializes a unified document by recursively expanding `@include` directives.
|
|
70
|
+
`@ref` edges are preserved as links, not expanded.
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
mdb compose docs/auth.md#auth --root docs/
|
|
74
|
+
mdb compose docs/auth.md#auth --root docs/ --depth 2
|
|
75
|
+
mdb compose docs/auth.md#auth --root docs/ --deduplicate
|
|
76
|
+
mdb compose docs/auth.md#auth --root docs/ --strict # abort on any broken include
|
|
77
|
+
mdb compose docs/auth.md#auth --root docs/ --json
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### mdb validate
|
|
81
|
+
|
|
82
|
+
Checks repository integrity. Reports: broken `@ref` targets, broken `@include` targets, duplicate `section:` IDs, and include cycles.
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
mdb validate --root docs/
|
|
86
|
+
mdb validate --root docs/ --json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Exit code `0` = repository is clean. Exit code `1` = one or more errors found.
|
|
90
|
+
|
|
91
|
+
### mdb context <URI>
|
|
92
|
+
|
|
93
|
+
Returns structured context of a section: metadata, outgoing edges (`@include`/`@ref`), and incoming edges (backlinks).
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
mdb context docs/auth.md#auth --root docs/ --json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
JSON output fields: `id`, `file`, `metadata`, `outgoing`, `incoming`.
|
|
100
|
+
|
|
101
|
+
### mdb backlinks <URI>
|
|
102
|
+
|
|
103
|
+
Lists all sections that reference the given URI (incoming edges only).
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
mdb backlinks docs/auth.md#auth --root docs/ --json
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### mdb search <predicate>
|
|
110
|
+
|
|
111
|
+
Searches sections by metadata. Supported predicate forms:
|
|
112
|
+
- `key=value` — exact match
|
|
113
|
+
- `key~=value` — substring match
|
|
114
|
+
- `tag:value` — tag membership
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
mdb search owner=security-team --root docs/
|
|
118
|
+
mdb search title~=Auth --root docs/
|
|
119
|
+
mdb search tag:api --root docs/ --json
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### mdb impact <URI>
|
|
123
|
+
|
|
124
|
+
Returns all sections that depend (directly or indirectly) on the given URI via reverse BFS on the graph.
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
mdb impact docs/auth.md#auth --root docs/ --json
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### mdb neighbors <URI>
|
|
131
|
+
|
|
132
|
+
Returns all nodes reachable within `--depth` hops in either direction (bidirectional BFS).
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
mdb neighbors docs/auth.md#auth --root docs/ --depth 2 --json
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### mdb explain <URI_A> <URI_B>
|
|
139
|
+
|
|
140
|
+
Finds all simple directed paths from URI_A to URI_B.
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
mdb explain docs/auth.md#auth docs/auth.md#jwt --root docs/ --json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### mdb diff
|
|
147
|
+
|
|
148
|
+
Computes the structural diff of the graph against a historical git reference. Reports added/removed/changed sections and edges.
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
mdb diff --root docs/ --since HEAD~1 --json
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### mdb query <expression>
|
|
155
|
+
|
|
156
|
+
Advanced boolean metadata query. Supports `AND`, `OR`, `NOT`, grouping with parentheses, and all predicate forms from `mdb search`.
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
mdb query "owner=security-team AND tag:api" --root docs/ --json
|
|
160
|
+
mdb query "NOT status=obsolete" --root docs/ --json
|
|
161
|
+
mdb query "(tag:auth OR tag:jwt) AND owner=alice" --root docs/ --json
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### mdb context-compose <URI>
|
|
165
|
+
|
|
166
|
+
Bounded semantic materialization for LLM consumption. Expands the graph starting at URI, respecting `--depth` and `--token-limit` budgets. Ideal for fitting relevant context into a fixed token window.
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
mdb context-compose docs/auth.md#auth --root docs/ --depth 2 --token-limit 2000 --json
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Recommended patterns for AI agents
|
|
173
|
+
|
|
174
|
+
**Retrieve a known node:**
|
|
175
|
+
```
|
|
176
|
+
mdb get <file>#<id> --json
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Discover what a node depends on:**
|
|
180
|
+
```
|
|
181
|
+
mdb tree <file>#<id> --root <root> --json
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Discover what depends on a node (impact analysis):**
|
|
185
|
+
```
|
|
186
|
+
mdb impact <file>#<id> --root <root> --json
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Fit a subgraph into a token budget:**
|
|
190
|
+
```
|
|
191
|
+
mdb context-compose <file>#<id> --root <root> --depth 2 --token-limit 4000 --json
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Validate before composing:**
|
|
195
|
+
```
|
|
196
|
+
mdb validate --root <root> --json && mdb compose <file>#<id> --root <root> --json
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Find all nodes matching a metadata condition:**
|
|
200
|
+
```
|
|
201
|
+
mdb query "tag:api AND NOT status=obsolete" --root <root> --json
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Constraints and invariants
|
|
205
|
+
|
|
206
|
+
- A section URI is valid only if the file exists and the `section:` ID is declared in that file.
|
|
207
|
+
- `@include` cycles are a hard error — `mdb validate` and `mdb compose --strict` will reject them.
|
|
208
|
+
- `--root` must be an ancestor directory of the target file.
|
|
209
|
+
- All JSON outputs are deterministic for the same input.
|
|
210
|
+
- `mdb get` does not require `--root`; all graph-traversal commands do.
|
|
211
|
+
|
|
212
|
+
## Installation
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
pip install mdbind
|
|
216
|
+
mdb --help
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Requires Python 3.11+.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|