ai-docs-toolkit 0.1.0b1__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.
- ai_docs_toolkit-0.1.0b1/PKG-INFO +186 -0
- ai_docs_toolkit-0.1.0b1/README.md +172 -0
- ai_docs_toolkit-0.1.0b1/pyproject.toml +38 -0
- ai_docs_toolkit-0.1.0b1/setup.cfg +4 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/__init__.py +3 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/__main__.py +4 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/cli/__init__.py +232 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/context/__init__.py +13 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/context/markdown_output.py +325 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/core/__init__.py +154 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/core/changed_files.py +138 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/core/config.py +201 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/core/context.py +347 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/core/frontmatter.py +139 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/core/graph.py +150 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/core/impact.py +273 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/core/registry.py +108 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/core/scanner.py +38 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/core/schema_validation.py +214 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/core/structure_validation.py +751 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/graph/__init__.py +13 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/graph/json_output.py +234 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/impact/__init__.py +15 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/impact/json_output.py +341 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/mcp/__init__.py +8 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/mcp/__main__.py +5 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/mcp/server.py +224 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/validation/__init__.py +16 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit/validation/human.py +246 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit.egg-info/PKG-INFO +186 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit.egg-info/SOURCES.txt +50 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit.egg-info/dependency_links.txt +1 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit.egg-info/entry_points.txt +3 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit.egg-info/requires.txt +9 -0
- ai_docs_toolkit-0.1.0b1/src/ai_docs_toolkit.egg-info/top_level.txt +1 -0
- ai_docs_toolkit-0.1.0b1/tests/test_cli_baseline.py +26 -0
- ai_docs_toolkit-0.1.0b1/tests/test_config_loader_and_scanner.py +132 -0
- ai_docs_toolkit-0.1.0b1/tests/test_context_cli_json.py +329 -0
- ai_docs_toolkit-0.1.0b1/tests/test_context_cli_markdown.py +312 -0
- ai_docs_toolkit-0.1.0b1/tests/test_context_selector.py +310 -0
- ai_docs_toolkit-0.1.0b1/tests/test_document_graph.py +155 -0
- ai_docs_toolkit-0.1.0b1/tests/test_document_registry.py +86 -0
- ai_docs_toolkit-0.1.0b1/tests/test_frontmatter_parser.py +97 -0
- ai_docs_toolkit-0.1.0b1/tests/test_graph_cli_json.py +255 -0
- ai_docs_toolkit-0.1.0b1/tests/test_impact_analysis.py +193 -0
- ai_docs_toolkit-0.1.0b1/tests/test_impact_cli_human.py +190 -0
- ai_docs_toolkit-0.1.0b1/tests/test_impact_cli_json.py +297 -0
- ai_docs_toolkit-0.1.0b1/tests/test_mcp_server.py +381 -0
- ai_docs_toolkit-0.1.0b1/tests/test_schema_validation.py +143 -0
- ai_docs_toolkit-0.1.0b1/tests/test_structure_validation.py +771 -0
- ai_docs_toolkit-0.1.0b1/tests/test_validate_cli_human.py +187 -0
- ai_docs_toolkit-0.1.0b1/tests/test_validate_cli_json.py +190 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ai-docs-toolkit
|
|
3
|
+
Version: 0.1.0b1
|
|
4
|
+
Summary: AI-oriented documentation toolkit.
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: jsonschema>=4.26
|
|
8
|
+
Requires-Dist: PyYAML>=6.0
|
|
9
|
+
Provides-Extra: dev
|
|
10
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
11
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
12
|
+
Provides-Extra: mcp
|
|
13
|
+
Requires-Dist: mcp<2,>=1.27; extra == "mcp"
|
|
14
|
+
|
|
15
|
+
# AI Docs Toolkit
|
|
16
|
+
|
|
17
|
+
AI Docs Toolkit is a documentation toolkit for AI-assisted software development.
|
|
18
|
+
|
|
19
|
+
It treats documentation as an engineering interface between humans, AI agents, code, tests and change management. The project is post-MVP and is hardening planning, validation, distribution and integration workflows.
|
|
20
|
+
|
|
21
|
+
## Purpose
|
|
22
|
+
|
|
23
|
+
The toolkit is intended for projects where:
|
|
24
|
+
- AI agents participate in implementation;
|
|
25
|
+
- system knowledge must stay readable for humans and usable by automation;
|
|
26
|
+
- documentation should define constraints, expected behavior and validation rules;
|
|
27
|
+
- changes should be traceable across business rules, architecture, contracts, modules, acceptance criteria and code.
|
|
28
|
+
|
|
29
|
+
The core idea is that documentation should not be a secondary artifact created after implementation. It should guide implementation, validation and review.
|
|
30
|
+
|
|
31
|
+
## Use Cases
|
|
32
|
+
|
|
33
|
+
AI Docs Toolkit is being designed to support:
|
|
34
|
+
- typed Markdown documents with YAML front matter;
|
|
35
|
+
- document taxonomy and explicit relationships;
|
|
36
|
+
- validation of metadata, required sections and links;
|
|
37
|
+
- document graph construction;
|
|
38
|
+
- impact analysis for planned and actual changes;
|
|
39
|
+
- context bundles for AI agents;
|
|
40
|
+
- CI, pre-commit and agent workflow integrations.
|
|
41
|
+
|
|
42
|
+
## Current Status
|
|
43
|
+
|
|
44
|
+
The repository has completed the local MVP loop:
|
|
45
|
+
- typed Markdown documents with YAML front matter;
|
|
46
|
+
- schema and structure validation;
|
|
47
|
+
- document graph output;
|
|
48
|
+
- impact analysis;
|
|
49
|
+
- context bundle output;
|
|
50
|
+
- CI, pre-commit and agent workflow examples.
|
|
51
|
+
|
|
52
|
+
At this stage the repository contains:
|
|
53
|
+
- concept documents that explain the methodology;
|
|
54
|
+
- architecture and reference documents for repository structure, schemas, CLI, graph, impact, context, CI and distribution;
|
|
55
|
+
- planning documents that define active post-MVP hardening work;
|
|
56
|
+
- a workflow for implementing plan stages as documented change units;
|
|
57
|
+
- YAML schemas for MVP front matter and document types;
|
|
58
|
+
- Markdown document templates and a minimal project example;
|
|
59
|
+
- Python package baseline and an executable `ai-docs` CLI.
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
Current supported local development install from a source checkout:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
python -m pip install -e ".[dev]"
|
|
67
|
+
ai-docs --version
|
|
68
|
+
ai-docs validate
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Current CI/source checkout install contract:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
python -m pip install -e .
|
|
75
|
+
ai-docs validate --json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Published package commands are documented as contracts for after a package release exists:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
python -m pip install ai-docs-toolkit
|
|
82
|
+
pipx install ai-docs-toolkit
|
|
83
|
+
uvx ai-docs-toolkit ai-docs validate
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Docker, npm/npx and standalone binary distribution are deferred.
|
|
87
|
+
See [Distribution Strategy](docs/reference/distribution-strategy.md) for supported and deferred channels.
|
|
88
|
+
|
|
89
|
+
## Quick Start
|
|
90
|
+
|
|
91
|
+
Validate this repository:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
ai-docs validate
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Generate machine-readable validation output:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
ai-docs validate --json
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Build a document graph:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
ai-docs graph --format json
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Analyze impact for changed files:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
ai-docs impact --changed
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Prepare an agent context bundle for changed files:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
ai-docs context --changed
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Documentation Map
|
|
122
|
+
|
|
123
|
+
Start here:
|
|
124
|
+
- [Vision](docs/concepts/vision.md)
|
|
125
|
+
- [Documentation as Interface](docs/concepts/documentation-as-interface.md)
|
|
126
|
+
- [Document Taxonomy](docs/concepts/document-taxonomy.md)
|
|
127
|
+
- [Change Cascade](docs/concepts/change-cascade.md)
|
|
128
|
+
- [Planning as Execution Interface](docs/concepts/planning-as-execution-interface.md)
|
|
129
|
+
|
|
130
|
+
Architecture:
|
|
131
|
+
- [Repository Structure](docs/architecture/repository-structure.md)
|
|
132
|
+
- [Schemas and Templates](docs/architecture/schemas-and-templates.md)
|
|
133
|
+
- [CLI Architecture](docs/architecture/cli-architecture.md)
|
|
134
|
+
|
|
135
|
+
Planning:
|
|
136
|
+
- [MVP Plan](docs/planning/2026-05-13-mvp/plan.md)
|
|
137
|
+
- [Backlog](docs/planning/backlog.md)
|
|
138
|
+
|
|
139
|
+
Workflows:
|
|
140
|
+
- [Plan Stage Workflow](docs/workflows/plan-stage-workflow.md)
|
|
141
|
+
|
|
142
|
+
Reference:
|
|
143
|
+
- [Document Types](docs/reference/document-types.md)
|
|
144
|
+
- [Front Matter Fields](docs/reference/frontmatter-fields.md)
|
|
145
|
+
- [Planning Document Model](docs/reference/planning-document-model.md)
|
|
146
|
+
- [Source Of Truth Model](docs/reference/source-of-truth-model.md)
|
|
147
|
+
- [Test Case Documentation](docs/reference/test-case-documentation.md)
|
|
148
|
+
- [Distribution Strategy](docs/reference/distribution-strategy.md)
|
|
149
|
+
- [CI And Agent Integration](docs/reference/ci-agent-integration.md)
|
|
150
|
+
|
|
151
|
+
## Development Model
|
|
152
|
+
|
|
153
|
+
The toolkit is developed using its own documentation methodology.
|
|
154
|
+
|
|
155
|
+
Changes should be handled as documented change units:
|
|
156
|
+
- identify the active plan stage;
|
|
157
|
+
- read [Plan Stage Workflow](docs/workflows/plan-stage-workflow.md) before executing planning tasks;
|
|
158
|
+
- read the source documents for the task;
|
|
159
|
+
- update affected documentation before or together with implementation;
|
|
160
|
+
- keep planning documents aligned with the actual repository state;
|
|
161
|
+
- run `ai-docs validate` before closure.
|
|
162
|
+
|
|
163
|
+
For the current execution workflow, see [Plan Stage Workflow](docs/workflows/plan-stage-workflow.md).
|
|
164
|
+
|
|
165
|
+
## Planning Direction
|
|
166
|
+
|
|
167
|
+
The MVP plan is closed and retained as work history.
|
|
168
|
+
Current work is tracked in the post-MVP hardening plan.
|
|
169
|
+
|
|
170
|
+
Details:
|
|
171
|
+
- [Post-MVP Hardening Plan](docs/planning/2026-05-15-post-mvp-hardening/plan.md)
|
|
172
|
+
- [MVP Plan](docs/planning/2026-05-13-mvp/plan.md)
|
|
173
|
+
|
|
174
|
+
## Non-Goals For MVP
|
|
175
|
+
|
|
176
|
+
The MVP does not aim to provide:
|
|
177
|
+
- semantic contradiction detection;
|
|
178
|
+
- automatic documentation rewriting;
|
|
179
|
+
- full IDE plugins;
|
|
180
|
+
- hosted services;
|
|
181
|
+
- database-backed graph storage;
|
|
182
|
+
- cross-repository dependency graphs.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
License is not selected yet. This is tracked as a product documentation gap in [BLG-017 Product Core Documentation Gaps](docs/planning/backlog/task-000009-product-core-documentation-gaps.md).
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# AI Docs Toolkit
|
|
2
|
+
|
|
3
|
+
AI Docs Toolkit is a documentation toolkit for AI-assisted software development.
|
|
4
|
+
|
|
5
|
+
It treats documentation as an engineering interface between humans, AI agents, code, tests and change management. The project is post-MVP and is hardening planning, validation, distribution and integration workflows.
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
The toolkit is intended for projects where:
|
|
10
|
+
- AI agents participate in implementation;
|
|
11
|
+
- system knowledge must stay readable for humans and usable by automation;
|
|
12
|
+
- documentation should define constraints, expected behavior and validation rules;
|
|
13
|
+
- changes should be traceable across business rules, architecture, contracts, modules, acceptance criteria and code.
|
|
14
|
+
|
|
15
|
+
The core idea is that documentation should not be a secondary artifact created after implementation. It should guide implementation, validation and review.
|
|
16
|
+
|
|
17
|
+
## Use Cases
|
|
18
|
+
|
|
19
|
+
AI Docs Toolkit is being designed to support:
|
|
20
|
+
- typed Markdown documents with YAML front matter;
|
|
21
|
+
- document taxonomy and explicit relationships;
|
|
22
|
+
- validation of metadata, required sections and links;
|
|
23
|
+
- document graph construction;
|
|
24
|
+
- impact analysis for planned and actual changes;
|
|
25
|
+
- context bundles for AI agents;
|
|
26
|
+
- CI, pre-commit and agent workflow integrations.
|
|
27
|
+
|
|
28
|
+
## Current Status
|
|
29
|
+
|
|
30
|
+
The repository has completed the local MVP loop:
|
|
31
|
+
- typed Markdown documents with YAML front matter;
|
|
32
|
+
- schema and structure validation;
|
|
33
|
+
- document graph output;
|
|
34
|
+
- impact analysis;
|
|
35
|
+
- context bundle output;
|
|
36
|
+
- CI, pre-commit and agent workflow examples.
|
|
37
|
+
|
|
38
|
+
At this stage the repository contains:
|
|
39
|
+
- concept documents that explain the methodology;
|
|
40
|
+
- architecture and reference documents for repository structure, schemas, CLI, graph, impact, context, CI and distribution;
|
|
41
|
+
- planning documents that define active post-MVP hardening work;
|
|
42
|
+
- a workflow for implementing plan stages as documented change units;
|
|
43
|
+
- YAML schemas for MVP front matter and document types;
|
|
44
|
+
- Markdown document templates and a minimal project example;
|
|
45
|
+
- Python package baseline and an executable `ai-docs` CLI.
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
Current supported local development install from a source checkout:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python -m pip install -e ".[dev]"
|
|
53
|
+
ai-docs --version
|
|
54
|
+
ai-docs validate
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Current CI/source checkout install contract:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
python -m pip install -e .
|
|
61
|
+
ai-docs validate --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Published package commands are documented as contracts for after a package release exists:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
python -m pip install ai-docs-toolkit
|
|
68
|
+
pipx install ai-docs-toolkit
|
|
69
|
+
uvx ai-docs-toolkit ai-docs validate
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Docker, npm/npx and standalone binary distribution are deferred.
|
|
73
|
+
See [Distribution Strategy](docs/reference/distribution-strategy.md) for supported and deferred channels.
|
|
74
|
+
|
|
75
|
+
## Quick Start
|
|
76
|
+
|
|
77
|
+
Validate this repository:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
ai-docs validate
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Generate machine-readable validation output:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
ai-docs validate --json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Build a document graph:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
ai-docs graph --format json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Analyze impact for changed files:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
ai-docs impact --changed
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Prepare an agent context bundle for changed files:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
ai-docs context --changed
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Documentation Map
|
|
108
|
+
|
|
109
|
+
Start here:
|
|
110
|
+
- [Vision](docs/concepts/vision.md)
|
|
111
|
+
- [Documentation as Interface](docs/concepts/documentation-as-interface.md)
|
|
112
|
+
- [Document Taxonomy](docs/concepts/document-taxonomy.md)
|
|
113
|
+
- [Change Cascade](docs/concepts/change-cascade.md)
|
|
114
|
+
- [Planning as Execution Interface](docs/concepts/planning-as-execution-interface.md)
|
|
115
|
+
|
|
116
|
+
Architecture:
|
|
117
|
+
- [Repository Structure](docs/architecture/repository-structure.md)
|
|
118
|
+
- [Schemas and Templates](docs/architecture/schemas-and-templates.md)
|
|
119
|
+
- [CLI Architecture](docs/architecture/cli-architecture.md)
|
|
120
|
+
|
|
121
|
+
Planning:
|
|
122
|
+
- [MVP Plan](docs/planning/2026-05-13-mvp/plan.md)
|
|
123
|
+
- [Backlog](docs/planning/backlog.md)
|
|
124
|
+
|
|
125
|
+
Workflows:
|
|
126
|
+
- [Plan Stage Workflow](docs/workflows/plan-stage-workflow.md)
|
|
127
|
+
|
|
128
|
+
Reference:
|
|
129
|
+
- [Document Types](docs/reference/document-types.md)
|
|
130
|
+
- [Front Matter Fields](docs/reference/frontmatter-fields.md)
|
|
131
|
+
- [Planning Document Model](docs/reference/planning-document-model.md)
|
|
132
|
+
- [Source Of Truth Model](docs/reference/source-of-truth-model.md)
|
|
133
|
+
- [Test Case Documentation](docs/reference/test-case-documentation.md)
|
|
134
|
+
- [Distribution Strategy](docs/reference/distribution-strategy.md)
|
|
135
|
+
- [CI And Agent Integration](docs/reference/ci-agent-integration.md)
|
|
136
|
+
|
|
137
|
+
## Development Model
|
|
138
|
+
|
|
139
|
+
The toolkit is developed using its own documentation methodology.
|
|
140
|
+
|
|
141
|
+
Changes should be handled as documented change units:
|
|
142
|
+
- identify the active plan stage;
|
|
143
|
+
- read [Plan Stage Workflow](docs/workflows/plan-stage-workflow.md) before executing planning tasks;
|
|
144
|
+
- read the source documents for the task;
|
|
145
|
+
- update affected documentation before or together with implementation;
|
|
146
|
+
- keep planning documents aligned with the actual repository state;
|
|
147
|
+
- run `ai-docs validate` before closure.
|
|
148
|
+
|
|
149
|
+
For the current execution workflow, see [Plan Stage Workflow](docs/workflows/plan-stage-workflow.md).
|
|
150
|
+
|
|
151
|
+
## Planning Direction
|
|
152
|
+
|
|
153
|
+
The MVP plan is closed and retained as work history.
|
|
154
|
+
Current work is tracked in the post-MVP hardening plan.
|
|
155
|
+
|
|
156
|
+
Details:
|
|
157
|
+
- [Post-MVP Hardening Plan](docs/planning/2026-05-15-post-mvp-hardening/plan.md)
|
|
158
|
+
- [MVP Plan](docs/planning/2026-05-13-mvp/plan.md)
|
|
159
|
+
|
|
160
|
+
## Non-Goals For MVP
|
|
161
|
+
|
|
162
|
+
The MVP does not aim to provide:
|
|
163
|
+
- semantic contradiction detection;
|
|
164
|
+
- automatic documentation rewriting;
|
|
165
|
+
- full IDE plugins;
|
|
166
|
+
- hosted services;
|
|
167
|
+
- database-backed graph storage;
|
|
168
|
+
- cross-repository dependency graphs.
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
License is not selected yet. This is tracked as a product documentation gap in [BLG-017 Product Core Documentation Gaps](docs/planning/backlog/task-000009-product-core-documentation-gaps.md).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ai-docs-toolkit"
|
|
7
|
+
version = "0.1.0b1"
|
|
8
|
+
description = "AI-oriented documentation toolkit."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"jsonschema>=4.26",
|
|
13
|
+
"PyYAML>=6.0",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[project.optional-dependencies]
|
|
17
|
+
dev = [
|
|
18
|
+
"build>=1.2",
|
|
19
|
+
"pytest>=8.0",
|
|
20
|
+
]
|
|
21
|
+
mcp = [
|
|
22
|
+
"mcp>=1.27,<2",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
ai-docs = "ai_docs_toolkit.cli:main"
|
|
27
|
+
ai-docs-mcp = "ai_docs_toolkit.mcp:main"
|
|
28
|
+
|
|
29
|
+
[tool.setuptools.packages.find]
|
|
30
|
+
where = ["src"]
|
|
31
|
+
|
|
32
|
+
[tool.pytest.ini_options]
|
|
33
|
+
testpaths = [
|
|
34
|
+
"tests",
|
|
35
|
+
]
|
|
36
|
+
pythonpath = [
|
|
37
|
+
"src",
|
|
38
|
+
]
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
from ai_docs_toolkit import __version__
|
|
2
|
+
from ai_docs_toolkit.context import (
|
|
3
|
+
context_project,
|
|
4
|
+
format_context_json,
|
|
5
|
+
format_context_markdown,
|
|
6
|
+
)
|
|
7
|
+
from ai_docs_toolkit.graph import GraphFilters, format_graph_json, graph_project
|
|
8
|
+
from ai_docs_toolkit.impact import (
|
|
9
|
+
format_impact_human,
|
|
10
|
+
format_impact_json,
|
|
11
|
+
impact_changed_project,
|
|
12
|
+
impact_project,
|
|
13
|
+
)
|
|
14
|
+
from ai_docs_toolkit.validation import (
|
|
15
|
+
format_human_validation_result,
|
|
16
|
+
format_json_validation_result,
|
|
17
|
+
validate_project_human,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _help_text() -> str:
|
|
22
|
+
return "\n".join(
|
|
23
|
+
[
|
|
24
|
+
f"ai-docs {__version__}",
|
|
25
|
+
"",
|
|
26
|
+
"Usage:",
|
|
27
|
+
" ai-docs --help",
|
|
28
|
+
" ai-docs --version",
|
|
29
|
+
" ai-docs validate",
|
|
30
|
+
" ai-docs validate --json",
|
|
31
|
+
" ai-docs graph --format json [--type TYPE] [--module MODULE] [--id ID]",
|
|
32
|
+
" ai-docs impact (--id ID | --changed) [--format json]",
|
|
33
|
+
" ai-docs context (--id ID | --module MODULE | --feature FEATURE | --changed) [--format json]",
|
|
34
|
+
]
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def main(argv: list[str] | None = None) -> int:
|
|
39
|
+
args = list(argv) if argv is not None else None
|
|
40
|
+
|
|
41
|
+
if args is None:
|
|
42
|
+
import sys
|
|
43
|
+
|
|
44
|
+
args = sys.argv[1:]
|
|
45
|
+
|
|
46
|
+
if not args or "--help" in args or "-h" in args:
|
|
47
|
+
print(_help_text())
|
|
48
|
+
return 0
|
|
49
|
+
|
|
50
|
+
if "--version" in args or "-V" in args:
|
|
51
|
+
print(__version__)
|
|
52
|
+
return 0
|
|
53
|
+
|
|
54
|
+
if args == ["validate"]:
|
|
55
|
+
result = validate_project_human(".")
|
|
56
|
+
print(format_human_validation_result(result))
|
|
57
|
+
return result.exit_code
|
|
58
|
+
|
|
59
|
+
if args == ["validate", "--json"] or args == ["--json", "validate"]:
|
|
60
|
+
result = validate_project_human(".")
|
|
61
|
+
print(format_json_validation_result(result))
|
|
62
|
+
return result.exit_code
|
|
63
|
+
|
|
64
|
+
graph_filters = _parse_graph_args(args)
|
|
65
|
+
if graph_filters is not None:
|
|
66
|
+
result = graph_project(".", filters=graph_filters)
|
|
67
|
+
print(format_graph_json(result))
|
|
68
|
+
return result.exit_code
|
|
69
|
+
|
|
70
|
+
impact_args = _parse_impact_args(args)
|
|
71
|
+
if impact_args is not None:
|
|
72
|
+
impact_mode, impact_source_ids, impact_format = impact_args
|
|
73
|
+
result = (
|
|
74
|
+
impact_changed_project(".")
|
|
75
|
+
if impact_mode == "changed"
|
|
76
|
+
else impact_project(impact_source_ids, ".")
|
|
77
|
+
)
|
|
78
|
+
print(
|
|
79
|
+
format_impact_json(result)
|
|
80
|
+
if impact_format == "json"
|
|
81
|
+
else format_impact_human(result)
|
|
82
|
+
)
|
|
83
|
+
return result.exit_code
|
|
84
|
+
|
|
85
|
+
context_args = _parse_context_args(args)
|
|
86
|
+
if context_args is not None:
|
|
87
|
+
context_mode, context_value, context_format = context_args
|
|
88
|
+
result = context_project(mode=context_mode, value=context_value, project_root=".")
|
|
89
|
+
print(
|
|
90
|
+
format_context_json(result)
|
|
91
|
+
if context_format == "json"
|
|
92
|
+
else format_context_markdown(result)
|
|
93
|
+
)
|
|
94
|
+
return result.exit_code
|
|
95
|
+
|
|
96
|
+
if args and args[0] == "graph":
|
|
97
|
+
import sys
|
|
98
|
+
|
|
99
|
+
print("Usage: ai-docs graph --format json", file=sys.stderr)
|
|
100
|
+
return 3
|
|
101
|
+
|
|
102
|
+
if args and args[0] == "impact":
|
|
103
|
+
import sys
|
|
104
|
+
|
|
105
|
+
print("Usage: ai-docs impact (--id ID | --changed) [--format json]", file=sys.stderr)
|
|
106
|
+
return 3
|
|
107
|
+
|
|
108
|
+
if args and args[0] == "context":
|
|
109
|
+
import sys
|
|
110
|
+
|
|
111
|
+
print(
|
|
112
|
+
"Usage: ai-docs context (--id ID | --module MODULE | --feature FEATURE | --changed) [--format json]",
|
|
113
|
+
file=sys.stderr,
|
|
114
|
+
)
|
|
115
|
+
return 3
|
|
116
|
+
|
|
117
|
+
import sys
|
|
118
|
+
|
|
119
|
+
print(f"Unknown command or option: {' '.join(args)}", file=sys.stderr)
|
|
120
|
+
print("Run `ai-docs --help` for usage.", file=sys.stderr)
|
|
121
|
+
return 3
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def _parse_graph_args(args: list[str]) -> GraphFilters | None:
|
|
125
|
+
if not args or args[0] != "graph":
|
|
126
|
+
return None
|
|
127
|
+
|
|
128
|
+
values = args[1:]
|
|
129
|
+
if len(values) < 2 or values[:2] != ["--format", "json"]:
|
|
130
|
+
return None
|
|
131
|
+
|
|
132
|
+
document_type: str | None = None
|
|
133
|
+
module: str | None = None
|
|
134
|
+
document_id: str | None = None
|
|
135
|
+
index = 2
|
|
136
|
+
while index < len(values):
|
|
137
|
+
option = values[index]
|
|
138
|
+
if index + 1 >= len(values):
|
|
139
|
+
return None
|
|
140
|
+
|
|
141
|
+
value = values[index + 1]
|
|
142
|
+
if option == "--type":
|
|
143
|
+
document_type = value
|
|
144
|
+
elif option == "--module":
|
|
145
|
+
module = value
|
|
146
|
+
elif option == "--id":
|
|
147
|
+
document_id = value
|
|
148
|
+
else:
|
|
149
|
+
return None
|
|
150
|
+
index += 2
|
|
151
|
+
|
|
152
|
+
return GraphFilters(
|
|
153
|
+
document_type=document_type,
|
|
154
|
+
module=module,
|
|
155
|
+
document_id=document_id,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def _parse_impact_args(args: list[str]) -> tuple[str, tuple[str, ...], str] | None:
|
|
160
|
+
if not args or args[0] != "impact":
|
|
161
|
+
return None
|
|
162
|
+
|
|
163
|
+
values = args[1:]
|
|
164
|
+
if len(values) not in (1, 2, 3, 4):
|
|
165
|
+
return None
|
|
166
|
+
|
|
167
|
+
if len(values) == 2 and values[0] == "--id":
|
|
168
|
+
return ("id", (values[1],), "human")
|
|
169
|
+
|
|
170
|
+
if len(values) == 4 and values[0] == "--id" and values[2:] == ["--format", "json"]:
|
|
171
|
+
return ("id", (values[1],), "json")
|
|
172
|
+
|
|
173
|
+
if len(values) == 4 and values[:2] == ["--format", "json"] and values[2] == "--id":
|
|
174
|
+
return ("id", (values[3],), "json")
|
|
175
|
+
|
|
176
|
+
if values == ["--changed", "--format", "json"]:
|
|
177
|
+
return ("changed", (), "json")
|
|
178
|
+
|
|
179
|
+
if values == ["--format", "json", "--changed"]:
|
|
180
|
+
return ("changed", (), "json")
|
|
181
|
+
|
|
182
|
+
if values == ["--changed"]:
|
|
183
|
+
return ("changed", (), "human")
|
|
184
|
+
|
|
185
|
+
return None
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def _parse_context_args(args: list[str]) -> tuple[str, str, str] | None:
|
|
189
|
+
if not args or args[0] != "context":
|
|
190
|
+
return None
|
|
191
|
+
|
|
192
|
+
values = args[1:]
|
|
193
|
+
if len(values) not in (1, 2, 3, 4):
|
|
194
|
+
return None
|
|
195
|
+
|
|
196
|
+
if values == ["--changed"]:
|
|
197
|
+
return ("changed", "", "markdown")
|
|
198
|
+
|
|
199
|
+
if values == ["--changed", "--format", "json"]:
|
|
200
|
+
return ("changed", "", "json")
|
|
201
|
+
|
|
202
|
+
if values == ["--format", "json", "--changed"]:
|
|
203
|
+
return ("changed", "", "json")
|
|
204
|
+
|
|
205
|
+
if len(values) == 2:
|
|
206
|
+
option, value = values
|
|
207
|
+
mode = _context_mode(option)
|
|
208
|
+
if mode is not None and value:
|
|
209
|
+
return (mode, value, "markdown")
|
|
210
|
+
return None
|
|
211
|
+
|
|
212
|
+
if values[2:] == ["--format", "json"]:
|
|
213
|
+
mode = _context_mode(values[0])
|
|
214
|
+
if mode is not None and values[1]:
|
|
215
|
+
return (mode, values[1], "json")
|
|
216
|
+
|
|
217
|
+
if values[:2] == ["--format", "json"]:
|
|
218
|
+
mode = _context_mode(values[2])
|
|
219
|
+
if mode is not None and values[3]:
|
|
220
|
+
return (mode, values[3], "json")
|
|
221
|
+
|
|
222
|
+
return None
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def _context_mode(option: str) -> str | None:
|
|
226
|
+
if option == "--id":
|
|
227
|
+
return "id"
|
|
228
|
+
if option == "--module":
|
|
229
|
+
return "module"
|
|
230
|
+
if option == "--feature":
|
|
231
|
+
return "feature"
|
|
232
|
+
return None
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from ai_docs_toolkit.context.markdown_output import (
|
|
2
|
+
ContextBuildResult,
|
|
3
|
+
context_project,
|
|
4
|
+
format_context_json,
|
|
5
|
+
format_context_markdown,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"ContextBuildResult",
|
|
10
|
+
"context_project",
|
|
11
|
+
"format_context_json",
|
|
12
|
+
"format_context_markdown",
|
|
13
|
+
]
|