dotmd-parser 0.2.0__tar.gz → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dotmd-parser
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Dependency graph parser for .md skill files — parse @include/@delegate/@ref directives, build graphs, and resolve templates for AI agent prompt engineering
5
5
  Author: dotmd-projects
6
6
  License-Expression: MIT
@@ -39,7 +39,7 @@ Dependency graph parser for `.md` skill files — built for AI agent prompt engi
39
39
 
40
40
  ## Why dotmd-parser?
41
41
 
42
- As AI agent projects grow, `SKILL.md` files start referencing each other via `@include` and `@delegate` directives. Without tooling, you're left manually tracing dependencies to answer basic questions:
42
+ As AI agent projects grow, `.md` files start referencing each other via `@include`, `@delegate`, and `@ref` directives. Without tooling, you're left manually tracing dependencies to answer basic questions:
43
43
 
44
44
  - *"Which files break if I edit `shared/role.md`?"*
45
45
  - *"Is there a circular reference hiding in my skill tree?"*
@@ -51,7 +51,7 @@ As AI agent projects grow, `SKILL.md` files start referencing each other via `@i
51
51
 
52
52
  | Capability | Manual / grep | dotmd-parser |
53
53
  |---|---|---|
54
- | Find `@include` / `@delegate` references | `grep -r "@include"` — flat list, no context | Structured graph with node types and edge metadata |
54
+ | Find `@include` / `@delegate` / `@ref` references | `grep -r "@include"` — flat list, no context | Structured graph with node types and edge metadata |
55
55
  | Detect circular references | Hope you notice before the agent loops | Automatic detection with full cycle path in warnings |
56
56
  | Reverse dependency ("what breaks?") | Manually trace every file | `dependents_of(graph, "shared/role.md")` — one call |
57
57
  | Expand `@include` to final text | Copy-paste by hand | `resolve("SKILL.md", variables={...})` — recursive expansion |
@@ -92,8 +92,32 @@ Returns:
92
92
  }
93
93
  ```
94
94
 
95
+ **Custom node type mapping:**
96
+
97
+ By default, node types are inferred from path keywords (`agent`, `shared`, `prompt`, `reference`, `asset`, `template`). You can override this with the `type_map` parameter:
98
+
99
+ ```python
100
+ graph = build_graph("./my-skill/", type_map=[
101
+ ("helper", "utility"),
102
+ ("core", "foundation"),
103
+ ])
104
+ ```
105
+
106
+ **deps.yml support:**
107
+
108
+ If a `deps.yml` file exists in the root directory, its dependencies are automatically merged into the graph:
109
+
110
+ ```yaml
111
+ - path: agents/planner.md
112
+ includes:
113
+ - shared/role.md
114
+ - shared/tools.md
115
+ ```
116
+
95
117
  ### resolve — Expand @include directives
96
118
 
119
+ Recursively expands `@include` directives into final text. `@delegate` and `@ref` lines are left as-is.
120
+
97
121
  ```python
98
122
  result = resolve("./prompts/main.md", variables={"name": "Alice"})
99
123
 
@@ -113,20 +137,36 @@ affected = dependents_of(graph, "/abs/path/to/shared/role.md")
113
137
 
114
138
  ```python
115
139
  print(summary(graph))
116
- # Nodes: 5 (agent:1, shared:2, skill:1, reference:1)
117
- # Edges: 4 (include:3, read-ref:1)
140
+ # Nodes: 5 (agent:1, prompt:1, shared:2, skill:1)
141
+ # Edges: 4 (include:2, ref:1, read-ref:1)
118
142
  # Warnings: 0
143
+ # Placeholders: name, role
119
144
  ```
120
145
 
121
146
  ## Supported Directives
122
147
 
123
- | Directive | Description |
148
+ | Directive | Edge type | Expanded by `resolve()`? | Description |
149
+ |---|---|---|---|
150
+ | `@include path/to/file.md` | `include` | Yes | Inline expansion — file content is inserted at this position |
151
+ | `@delegate path/to/agent.md` | `delegate` | No | Agent delegation — recorded in graph, left as-is in output |
152
+ | `@delegate path/to/agent.md --parallel` | `delegate` | No | Parallel delegation with `--parallel` flag |
153
+ | `@ref path/to/file.md` | `ref` | No | Runtime reference — recorded in graph, left as-is in output |
154
+ | `` Read `path/to/file.md` `` | `read-ref` | No | Legacy runtime reference (same as `@ref`, kept for backward compatibility) |
155
+
156
+ ## Utility Functions
157
+
158
+ Lower-level parsing functions are also exported for custom use:
159
+
160
+ ```python
161
+ from dotmd_parser import parse_directives, parse_read_refs, parse_placeholders, parse_deps_yml
162
+ ```
163
+
164
+ | Function | Description |
124
165
  |---|---|
125
- | `@include path/to/file.md` | Inline expansion file content is inserted at this position |
126
- | `@delegate path/to/agent.md` | Agent delegation recorded in graph but not expanded |
127
- | `@delegate path/to/agent.md --parallel` | Parallel delegation with `--parallel` flag |
128
- | `@ref path/to/file.md` | Runtime reference recorded in graph but not expanded |
129
- | `` Read `path/to/file.md` `` | Legacy runtime reference — same behavior as `@ref` (kept for backward compatibility) |
166
+ | `parse_directives(content)` | Extract `@include` / `@delegate` / `@ref` directives from text |
167
+ | `parse_read_refs(content)` | Extract legacy `Read`/`See`/list-style `.md` references (deduplicated) |
168
+ | `parse_placeholders(content)` | Extract `{{variable}}` placeholder names (deduplicated) |
169
+ | `parse_deps_yml(content)` | Parse `deps.yml` text into `{path: [includes]}` dict (no PyYAML required) |
130
170
 
131
171
  ## CLI
132
172
 
@@ -138,6 +178,8 @@ dotmd-parser ./my-skill/
138
178
  python -m dotmd_parser.parser ./my-skill/
139
179
  ```
140
180
 
181
+ Outputs a human-readable summary followed by the full JSON graph.
182
+
141
183
  ## Development
142
184
 
143
185
  ```bash
@@ -12,7 +12,7 @@ Dependency graph parser for `.md` skill files — built for AI agent prompt engi
12
12
 
13
13
  ## Why dotmd-parser?
14
14
 
15
- As AI agent projects grow, `SKILL.md` files start referencing each other via `@include` and `@delegate` directives. Without tooling, you're left manually tracing dependencies to answer basic questions:
15
+ As AI agent projects grow, `.md` files start referencing each other via `@include`, `@delegate`, and `@ref` directives. Without tooling, you're left manually tracing dependencies to answer basic questions:
16
16
 
17
17
  - *"Which files break if I edit `shared/role.md`?"*
18
18
  - *"Is there a circular reference hiding in my skill tree?"*
@@ -24,7 +24,7 @@ As AI agent projects grow, `SKILL.md` files start referencing each other via `@i
24
24
 
25
25
  | Capability | Manual / grep | dotmd-parser |
26
26
  |---|---|---|
27
- | Find `@include` / `@delegate` references | `grep -r "@include"` — flat list, no context | Structured graph with node types and edge metadata |
27
+ | Find `@include` / `@delegate` / `@ref` references | `grep -r "@include"` — flat list, no context | Structured graph with node types and edge metadata |
28
28
  | Detect circular references | Hope you notice before the agent loops | Automatic detection with full cycle path in warnings |
29
29
  | Reverse dependency ("what breaks?") | Manually trace every file | `dependents_of(graph, "shared/role.md")` — one call |
30
30
  | Expand `@include` to final text | Copy-paste by hand | `resolve("SKILL.md", variables={...})` — recursive expansion |
@@ -65,8 +65,32 @@ Returns:
65
65
  }
66
66
  ```
67
67
 
68
+ **Custom node type mapping:**
69
+
70
+ By default, node types are inferred from path keywords (`agent`, `shared`, `prompt`, `reference`, `asset`, `template`). You can override this with the `type_map` parameter:
71
+
72
+ ```python
73
+ graph = build_graph("./my-skill/", type_map=[
74
+ ("helper", "utility"),
75
+ ("core", "foundation"),
76
+ ])
77
+ ```
78
+
79
+ **deps.yml support:**
80
+
81
+ If a `deps.yml` file exists in the root directory, its dependencies are automatically merged into the graph:
82
+
83
+ ```yaml
84
+ - path: agents/planner.md
85
+ includes:
86
+ - shared/role.md
87
+ - shared/tools.md
88
+ ```
89
+
68
90
  ### resolve — Expand @include directives
69
91
 
92
+ Recursively expands `@include` directives into final text. `@delegate` and `@ref` lines are left as-is.
93
+
70
94
  ```python
71
95
  result = resolve("./prompts/main.md", variables={"name": "Alice"})
72
96
 
@@ -86,20 +110,36 @@ affected = dependents_of(graph, "/abs/path/to/shared/role.md")
86
110
 
87
111
  ```python
88
112
  print(summary(graph))
89
- # Nodes: 5 (agent:1, shared:2, skill:1, reference:1)
90
- # Edges: 4 (include:3, read-ref:1)
113
+ # Nodes: 5 (agent:1, prompt:1, shared:2, skill:1)
114
+ # Edges: 4 (include:2, ref:1, read-ref:1)
91
115
  # Warnings: 0
116
+ # Placeholders: name, role
92
117
  ```
93
118
 
94
119
  ## Supported Directives
95
120
 
96
- | Directive | Description |
121
+ | Directive | Edge type | Expanded by `resolve()`? | Description |
122
+ |---|---|---|---|
123
+ | `@include path/to/file.md` | `include` | Yes | Inline expansion — file content is inserted at this position |
124
+ | `@delegate path/to/agent.md` | `delegate` | No | Agent delegation — recorded in graph, left as-is in output |
125
+ | `@delegate path/to/agent.md --parallel` | `delegate` | No | Parallel delegation with `--parallel` flag |
126
+ | `@ref path/to/file.md` | `ref` | No | Runtime reference — recorded in graph, left as-is in output |
127
+ | `` Read `path/to/file.md` `` | `read-ref` | No | Legacy runtime reference (same as `@ref`, kept for backward compatibility) |
128
+
129
+ ## Utility Functions
130
+
131
+ Lower-level parsing functions are also exported for custom use:
132
+
133
+ ```python
134
+ from dotmd_parser import parse_directives, parse_read_refs, parse_placeholders, parse_deps_yml
135
+ ```
136
+
137
+ | Function | Description |
97
138
  |---|---|
98
- | `@include path/to/file.md` | Inline expansion file content is inserted at this position |
99
- | `@delegate path/to/agent.md` | Agent delegation recorded in graph but not expanded |
100
- | `@delegate path/to/agent.md --parallel` | Parallel delegation with `--parallel` flag |
101
- | `@ref path/to/file.md` | Runtime reference recorded in graph but not expanded |
102
- | `` Read `path/to/file.md` `` | Legacy runtime reference — same behavior as `@ref` (kept for backward compatibility) |
139
+ | `parse_directives(content)` | Extract `@include` / `@delegate` / `@ref` directives from text |
140
+ | `parse_read_refs(content)` | Extract legacy `Read`/`See`/list-style `.md` references (deduplicated) |
141
+ | `parse_placeholders(content)` | Extract `{{variable}}` placeholder names (deduplicated) |
142
+ | `parse_deps_yml(content)` | Parse `deps.yml` text into `{path: [includes]}` dict (no PyYAML required) |
103
143
 
104
144
  ## CLI
105
145
 
@@ -111,6 +151,8 @@ dotmd-parser ./my-skill/
111
151
  python -m dotmd_parser.parser ./my-skill/
112
152
  ```
113
153
 
154
+ Outputs a human-readable summary followed by the full JSON graph.
155
+
114
156
  ## Development
115
157
 
116
158
  ```bash
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dotmd-parser"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "Dependency graph parser for .md skill files — parse @include/@delegate/@ref directives, build graphs, and resolve templates for AI agent prompt engineering"
5
5
  requires-python = ">=3.10"
6
6
  license = "MIT"
@@ -8,7 +8,7 @@ API:
8
8
  from dotmd_parser import build_graph, resolve, dependents_of, summary
9
9
  """
10
10
 
11
- __version__ = "0.2.0"
11
+ __version__ = "0.2.1"
12
12
 
13
13
  from dotmd_parser.parser import (
14
14
  build_graph,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dotmd-parser
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Dependency graph parser for .md skill files — parse @include/@delegate/@ref directives, build graphs, and resolve templates for AI agent prompt engineering
5
5
  Author: dotmd-projects
6
6
  License-Expression: MIT
@@ -39,7 +39,7 @@ Dependency graph parser for `.md` skill files — built for AI agent prompt engi
39
39
 
40
40
  ## Why dotmd-parser?
41
41
 
42
- As AI agent projects grow, `SKILL.md` files start referencing each other via `@include` and `@delegate` directives. Without tooling, you're left manually tracing dependencies to answer basic questions:
42
+ As AI agent projects grow, `.md` files start referencing each other via `@include`, `@delegate`, and `@ref` directives. Without tooling, you're left manually tracing dependencies to answer basic questions:
43
43
 
44
44
  - *"Which files break if I edit `shared/role.md`?"*
45
45
  - *"Is there a circular reference hiding in my skill tree?"*
@@ -51,7 +51,7 @@ As AI agent projects grow, `SKILL.md` files start referencing each other via `@i
51
51
 
52
52
  | Capability | Manual / grep | dotmd-parser |
53
53
  |---|---|---|
54
- | Find `@include` / `@delegate` references | `grep -r "@include"` — flat list, no context | Structured graph with node types and edge metadata |
54
+ | Find `@include` / `@delegate` / `@ref` references | `grep -r "@include"` — flat list, no context | Structured graph with node types and edge metadata |
55
55
  | Detect circular references | Hope you notice before the agent loops | Automatic detection with full cycle path in warnings |
56
56
  | Reverse dependency ("what breaks?") | Manually trace every file | `dependents_of(graph, "shared/role.md")` — one call |
57
57
  | Expand `@include` to final text | Copy-paste by hand | `resolve("SKILL.md", variables={...})` — recursive expansion |
@@ -92,8 +92,32 @@ Returns:
92
92
  }
93
93
  ```
94
94
 
95
+ **Custom node type mapping:**
96
+
97
+ By default, node types are inferred from path keywords (`agent`, `shared`, `prompt`, `reference`, `asset`, `template`). You can override this with the `type_map` parameter:
98
+
99
+ ```python
100
+ graph = build_graph("./my-skill/", type_map=[
101
+ ("helper", "utility"),
102
+ ("core", "foundation"),
103
+ ])
104
+ ```
105
+
106
+ **deps.yml support:**
107
+
108
+ If a `deps.yml` file exists in the root directory, its dependencies are automatically merged into the graph:
109
+
110
+ ```yaml
111
+ - path: agents/planner.md
112
+ includes:
113
+ - shared/role.md
114
+ - shared/tools.md
115
+ ```
116
+
95
117
  ### resolve — Expand @include directives
96
118
 
119
+ Recursively expands `@include` directives into final text. `@delegate` and `@ref` lines are left as-is.
120
+
97
121
  ```python
98
122
  result = resolve("./prompts/main.md", variables={"name": "Alice"})
99
123
 
@@ -113,20 +137,36 @@ affected = dependents_of(graph, "/abs/path/to/shared/role.md")
113
137
 
114
138
  ```python
115
139
  print(summary(graph))
116
- # Nodes: 5 (agent:1, shared:2, skill:1, reference:1)
117
- # Edges: 4 (include:3, read-ref:1)
140
+ # Nodes: 5 (agent:1, prompt:1, shared:2, skill:1)
141
+ # Edges: 4 (include:2, ref:1, read-ref:1)
118
142
  # Warnings: 0
143
+ # Placeholders: name, role
119
144
  ```
120
145
 
121
146
  ## Supported Directives
122
147
 
123
- | Directive | Description |
148
+ | Directive | Edge type | Expanded by `resolve()`? | Description |
149
+ |---|---|---|---|
150
+ | `@include path/to/file.md` | `include` | Yes | Inline expansion — file content is inserted at this position |
151
+ | `@delegate path/to/agent.md` | `delegate` | No | Agent delegation — recorded in graph, left as-is in output |
152
+ | `@delegate path/to/agent.md --parallel` | `delegate` | No | Parallel delegation with `--parallel` flag |
153
+ | `@ref path/to/file.md` | `ref` | No | Runtime reference — recorded in graph, left as-is in output |
154
+ | `` Read `path/to/file.md` `` | `read-ref` | No | Legacy runtime reference (same as `@ref`, kept for backward compatibility) |
155
+
156
+ ## Utility Functions
157
+
158
+ Lower-level parsing functions are also exported for custom use:
159
+
160
+ ```python
161
+ from dotmd_parser import parse_directives, parse_read_refs, parse_placeholders, parse_deps_yml
162
+ ```
163
+
164
+ | Function | Description |
124
165
  |---|---|
125
- | `@include path/to/file.md` | Inline expansion file content is inserted at this position |
126
- | `@delegate path/to/agent.md` | Agent delegation recorded in graph but not expanded |
127
- | `@delegate path/to/agent.md --parallel` | Parallel delegation with `--parallel` flag |
128
- | `@ref path/to/file.md` | Runtime reference recorded in graph but not expanded |
129
- | `` Read `path/to/file.md` `` | Legacy runtime reference — same behavior as `@ref` (kept for backward compatibility) |
166
+ | `parse_directives(content)` | Extract `@include` / `@delegate` / `@ref` directives from text |
167
+ | `parse_read_refs(content)` | Extract legacy `Read`/`See`/list-style `.md` references (deduplicated) |
168
+ | `parse_placeholders(content)` | Extract `{{variable}}` placeholder names (deduplicated) |
169
+ | `parse_deps_yml(content)` | Parse `deps.yml` text into `{path: [includes]}` dict (no PyYAML required) |
130
170
 
131
171
  ## CLI
132
172
 
@@ -138,6 +178,8 @@ dotmd-parser ./my-skill/
138
178
  python -m dotmd_parser.parser ./my-skill/
139
179
  ```
140
180
 
181
+ Outputs a human-readable summary followed by the full JSON graph.
182
+
141
183
  ## Development
142
184
 
143
185
  ```bash
File without changes
File without changes