agent-wiki-cli 0.3.28__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.
Files changed (82) hide show
  1. agent_wiki_cli-0.3.28/LICENSE +21 -0
  2. agent_wiki_cli-0.3.28/PKG-INFO +425 -0
  3. agent_wiki_cli-0.3.28/README.md +397 -0
  4. agent_wiki_cli-0.3.28/pyproject.toml +62 -0
  5. agent_wiki_cli-0.3.28/setup.cfg +4 -0
  6. agent_wiki_cli-0.3.28/src/agent_wiki_cli.egg-info/PKG-INFO +425 -0
  7. agent_wiki_cli-0.3.28/src/agent_wiki_cli.egg-info/SOURCES.txt +80 -0
  8. agent_wiki_cli-0.3.28/src/agent_wiki_cli.egg-info/dependency_links.txt +1 -0
  9. agent_wiki_cli-0.3.28/src/agent_wiki_cli.egg-info/entry_points.txt +2 -0
  10. agent_wiki_cli-0.3.28/src/agent_wiki_cli.egg-info/requires.txt +13 -0
  11. agent_wiki_cli-0.3.28/src/agent_wiki_cli.egg-info/top_level.txt +1 -0
  12. agent_wiki_cli-0.3.28/src/llm_wiki_cli/__init__.py +7 -0
  13. agent_wiki_cli-0.3.28/src/llm_wiki_cli/cli.py +231 -0
  14. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/__init__.py +1 -0
  15. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/bootstrap_cmd.py +1072 -0
  16. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/bump_cmd.py +55 -0
  17. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/context_cmd.py +427 -0
  18. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/extract_cmd.py +745 -0
  19. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/generate_prompt_cmd.py +89 -0
  20. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/hook_cmd.py +161 -0
  21. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/init_cmd.py +92 -0
  22. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/lint_cmd.py +294 -0
  23. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/migrate_cmd.py +892 -0
  24. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/release_cmd.py +163 -0
  25. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/status_cmd.py +70 -0
  26. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/sync_cmd.py +521 -0
  27. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/trigger_cmd.py +205 -0
  28. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/uninstall_cmd.py +221 -0
  29. agent_wiki_cli-0.3.28/src/llm_wiki_cli/commands/upgrade_cmd.py +196 -0
  30. agent_wiki_cli-0.3.28/src/llm_wiki_cli/config.py +318 -0
  31. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/__init__.py +46 -0
  32. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/common.py +90 -0
  33. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/go_extractor.py +143 -0
  34. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/go_scripts/go.mod +3 -0
  35. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/go_scripts/main.go +668 -0
  36. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/python_extractor.py +346 -0
  37. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/rust_extractor.py +143 -0
  38. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/rust_scripts/Cargo.lock +110 -0
  39. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/rust_scripts/Cargo.toml +11 -0
  40. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/rust_scripts/src/main.rs +803 -0
  41. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/ts_extractor.py +206 -0
  42. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/ts_scripts/extract.js +485 -0
  43. agent_wiki_cli-0.3.28/src/llm_wiki_cli/extractors/ts_scripts/package.json +10 -0
  44. agent_wiki_cli-0.3.28/src/llm_wiki_cli/services/__init__.py +0 -0
  45. agent_wiki_cli-0.3.28/src/llm_wiki_cli/services/circuit_breaker.py +79 -0
  46. agent_wiki_cli-0.3.28/src/llm_wiki_cli/services/io.py +47 -0
  47. agent_wiki_cli-0.3.28/src/llm_wiki_cli/services/lockfile.py +60 -0
  48. agent_wiki_cli-0.3.28/src/llm_wiki_cli/services/packages.py +173 -0
  49. agent_wiki_cli-0.3.28/src/llm_wiki_cli/services/paths.py +31 -0
  50. agent_wiki_cli-0.3.28/src/llm_wiki_cli/services/schema.py +214 -0
  51. agent_wiki_cli-0.3.28/src/llm_wiki_cli/services/secure_file.py +22 -0
  52. agent_wiki_cli-0.3.28/src/llm_wiki_cli/services/versioning.py +193 -0
  53. agent_wiki_cli-0.3.28/tests/test_bootstrap.py +448 -0
  54. agent_wiki_cli-0.3.28/tests/test_bump.py +65 -0
  55. agent_wiki_cli-0.3.28/tests/test_circuit_breaker.py +111 -0
  56. agent_wiki_cli-0.3.28/tests/test_config.py +141 -0
  57. agent_wiki_cli-0.3.28/tests/test_context.py +363 -0
  58. agent_wiki_cli-0.3.28/tests/test_docker_bootstrap.py +266 -0
  59. agent_wiki_cli-0.3.28/tests/test_docker_extract.py +517 -0
  60. agent_wiki_cli-0.3.28/tests/test_docker_lint.py +137 -0
  61. agent_wiki_cli-0.3.28/tests/test_e2e.py +176 -0
  62. agent_wiki_cli-0.3.28/tests/test_extract.py +561 -0
  63. agent_wiki_cli-0.3.28/tests/test_generate_prompt.py +139 -0
  64. agent_wiki_cli-0.3.28/tests/test_go_extract.py +702 -0
  65. agent_wiki_cli-0.3.28/tests/test_hook.py +190 -0
  66. agent_wiki_cli-0.3.28/tests/test_init.py +206 -0
  67. agent_wiki_cli-0.3.28/tests/test_io.py +11 -0
  68. agent_wiki_cli-0.3.28/tests/test_lint.py +195 -0
  69. agent_wiki_cli-0.3.28/tests/test_lockfile.py +42 -0
  70. agent_wiki_cli-0.3.28/tests/test_migrate.py +588 -0
  71. agent_wiki_cli-0.3.28/tests/test_multilanguage_wiki.py +149 -0
  72. agent_wiki_cli-0.3.28/tests/test_package_metadata.py +57 -0
  73. agent_wiki_cli-0.3.28/tests/test_release.py +306 -0
  74. agent_wiki_cli-0.3.28/tests/test_rust_extract.py +645 -0
  75. agent_wiki_cli-0.3.28/tests/test_schema.py +21 -0
  76. agent_wiki_cli-0.3.28/tests/test_status.py +111 -0
  77. agent_wiki_cli-0.3.28/tests/test_sync.py +666 -0
  78. agent_wiki_cli-0.3.28/tests/test_trigger.py +173 -0
  79. agent_wiki_cli-0.3.28/tests/test_ts_extract.py +650 -0
  80. agent_wiki_cli-0.3.28/tests/test_uninstall.py +183 -0
  81. agent_wiki_cli-0.3.28/tests/test_upgrade.py +346 -0
  82. agent_wiki_cli-0.3.28/tests/test_versioning.py +172 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Denis Sivagin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,425 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-wiki-cli
3
+ Version: 0.3.28
4
+ Summary: CLI tool to maintain hybrid LLM Wikis for multi-language projects.
5
+ Author-email: Denis Sivagin <denissvgn@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Denissvgn/python-wiki-llm
8
+ Project-URL: Repository, https://github.com/Denissvgn/python-wiki-llm
9
+ Project-URL: Issues, https://github.com/Denissvgn/python-wiki-llm/issues
10
+ Keywords: llm,wiki,documentation,ai,agents,code-context
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Topic :: Software Development :: Documentation
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: tomli>=2; python_version < "3.11"
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7.0; extra == "dev"
23
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
24
+ Provides-Extra: typescript
25
+ Provides-Extra: go
26
+ Provides-Extra: rust
27
+ Dynamic: license-file
28
+
29
+ # LLM Wiki CLI
30
+
31
+ ## About
32
+
33
+ LLM Wiki CLI helps coding agents keep project documentation accurate automatically. It builds and maintains a structured wiki from your source code, validates consistency with lint checks, and supports automated or prompt-driven sync workflows after each commit.
34
+
35
+ It is designed for teams using AI-assisted development who want less context drift, better architectural memory, and a repo-level documentation process that scales across Python, TypeScript, Go, Rust, and Docker/Compose infrastructure.
36
+
37
+ A companion CLI designed to help Native LLM Coding Agents (like Claude Code, OpenCode, Cursor, Copilot, or Aider) autonomously maintain a persistent architectural memory ("Wiki") of your projects.
38
+
39
+ By providing constant, up-to-date documentation via a local wiki, your LLM agents will stop rediscovering project boundaries from scratch upon every interaction. Instead, the agent learns to consult the `docs/llm_wiki` first, and updates it gracefully whenever a commit alters the software architecture.
40
+
41
+ Supports **Python, TypeScript, Go, and Rust** projects. Infrastructure documentation (Docker/Compose) included.
42
+
43
+ > Inspired by Andrej Karpathy's post on [LLM-native development workflows](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).
44
+
45
+ > **Warning:** This tool grants **full unsupervised permissions** to background agents (e.g. `--dangerously-skip-permissions` for Claude Code). The post-commit hook runs headlessly with no human-in-the-loop confirmation. Use with caution — review your agent's capabilities and ensure you trust the execution environment before enabling automation.
46
+
47
+ ## How it Works
48
+
49
+ This tool bridges the context gap using a **Hybrid Approach**:
50
+ 1. **Multi-Language Extraction**: The CLI uses language-specific AST processors (Python `ast`, TypeScript `ts-morph`, Go stdlib `ast`, Rust `syn`) to rapidly map classes, functions, types, imports, and relationships without forcing the LLM to waste context tokens loading megabytes of raw text.
51
+ 2. **Strict Schema Constraints**: The tool scaffolds specific prompt constraints (e.g., `CLAUDE.md` or `.github/copilot-instructions.md`) dictating that your agent *must* act as the overarching librarian for `docs/llm_wiki/`.
52
+ 3. **Post-Commit Wiki Sync**: A local `.git/hooks/post-commit` script is installed. The sync strategy depends on the agent type:
53
+ - **CLI agents** (`claude`, `aider`, `opencode`): every commit spawns a fully detached background process that captures the `git diff`, merges it with the structural AST, and invokes the agent headlessly to update the wiki automatically.
54
+ - **IDE agents** (`copilot`, `cursor`, `generic`): every commit generates a ready-to-paste sync prompt at `.git/llm-wiki-prompt.txt`. You paste it into your IDE chat to trigger the update.
55
+
56
+ ## Agent Support
57
+
58
+ | Agent | Schema file | Auto-sync mode |
59
+ |---|---|---|
60
+ | `claude` | `CLAUDE.md` | Headless background process |
61
+ | `aider` | `.aider.conf.yml` | Headless background process |
62
+ | `opencode` | `.opencode/instructions.md` | Headless background process |
63
+ | `copilot` | `.github/copilot-instructions.md` | IDE prompt (paste into chat) |
64
+ | `cursor` | `.cursorrules` | IDE prompt (paste into chat) |
65
+ | `generic` | `.agents.md` | IDE prompt (paste into chat) |
66
+
67
+ ## Multi-Language Support
68
+
69
+ The tool supports multiple programming languages via a pluggable extractor architecture:
70
+
71
+ | Language | Extractor | Requirements | Installation |
72
+ |----------|-----------|--------------|--------------|
73
+ | **Python** | AST (stdlib) | Python 3.9+ | Included |
74
+ | **TypeScript/TSX** | ts-morph (Node.js) | Node.js, npm | Included; installs bundled npm deps on first use |
75
+ | **Go** | stdlib `ast` | Go toolchain on PATH | Included; auto-detects from PATH |
76
+ | **Rust** | syn + cargo | Rust toolchain on PATH | Included; builds bundled extractor on first use |
77
+
78
+ All extractors share the same output format and are automatically invoked by `bootstrap`, `extract`, `lint`, and `sync` commands.
79
+
80
+ Each language provides:
81
+ - **Classes/Types** → Entity wiki pages with attributes, methods, relationships
82
+ - **Functions/Methods** → Function tables in module pages
83
+ - **Imports** → Cross-module relationship tracking
84
+ - **Docstrings/Comments** → Included in entity documentation
85
+
86
+ ## Installation (with Multi-Language Support)
87
+
88
+ Install the CLI:
89
+ ```bash
90
+ pip install agent-wiki-cli
91
+ ```
92
+
93
+ The package defines optional extras for language groups, but they do not install
94
+ additional Python dependencies. Non-Python extractors depend on runtime
95
+ toolchains instead:
96
+ - TypeScript/TSX: `node` and `npm`; bundled npm dependencies install on first use.
97
+ - Go: `go`; the bundled extractor runs via the Go toolchain.
98
+ - Rust: `cargo`; the bundled extractor builds on first use using the packaged lockfile.
99
+
100
+ Or from source:
101
+ ```bash
102
+ git clone https://github.com/Denissvgn/python-wiki-llm.git
103
+ cd python-wiki-llm
104
+ pip install -e .
105
+ ```
106
+
107
+ ## Setup & Initialization
108
+
109
+ Bootstrap the wiki and agent constraint schema inside the root of your project:
110
+
111
+ ```bash
112
+ llm-wiki init --agent claude
113
+ ```
114
+
115
+ Supported agents: `claude`, `aider`, `opencode`, `copilot`, `cursor`, `generic`.
116
+
117
+ **What this does**:
118
+ - Creates `docs/llm_wiki/index.md` (table of contents).
119
+ - Creates `docs/llm_wiki/log.md` (append-only chronological ledger).
120
+ - Scaffolds `entities/`, `modules/`, `workflows/`, and `infrastructure/` directories.
121
+ - Writes the agent-specific instruction file (e.g. `CLAUDE.md`, `.github/copilot-instructions.md`) so the agent knows the rules of the system.
122
+ - Saves the chosen agent to `.git/.llm-wiki-agent` (local-only, not committed) so subsequent commands (like `install-hook`) pick it up automatically.
123
+
124
+ > If you pass a CLI agent (`claude`, `aider`, `opencode`) that is not installed on your `PATH`, `init` will warn you but still create all files.
125
+
126
+ Use `--wiki-dir` to change the default wiki location:
127
+
128
+ ```bash
129
+ llm-wiki init --agent copilot --wiki-dir .wiki
130
+ ```
131
+
132
+ Disable quality hints (agent constraints for surgical changes and careful editing):
133
+ ```bash
134
+ llm-wiki init --agent copilot --no-quality-hints
135
+ ```
136
+
137
+ ## Bootstrap an Existing Codebase
138
+
139
+ Generate a comprehensive wiki from an existing project in one command:
140
+
141
+ ```bash
142
+ llm-wiki bootstrap --src-dir . --wiki-dir docs/llm_wiki
143
+ ```
144
+
145
+ **What this does**:
146
+ - Scans all project files via **multi-language AST extraction** (Python, TypeScript, Go, Rust).
147
+ - For each language:
148
+ - Python: deep extraction (docstrings, attributes with types/defaults, method signatures, decorators, imports).
149
+ - TypeScript/Go/Rust: classes, interfaces, types, functions, methods, imports.
150
+ - Creates **entity pages** (`entities/<ClassName>.md`) with full attribute tables, method signatures, and cross-module relationship links.
151
+ - Creates **module pages** (`modules/<filename>.md`) with import tables, class summaries, and function signatures with decorators.
152
+ - Discovers and documents **Docker/Compose files** as `infrastructure/<name>.md` with build stages, ports, environment variables, volumes, services, and cross-references to source code.
153
+ - Rebuilds `index.md` and appends a summary to `log.md`.
154
+ - Creates `<wiki-dir>/.llm-wiki-manifest.json` for incremental syncs (see `llm-wiki sync` below).
155
+ - Cross-references imports to build `used_by` / `imported_by` relationship graphs between entities.
156
+
157
+ **Flags**:
158
+ - `--overwrite` — Regenerate existing pages instead of skipping them.
159
+ - `--depth shallow|full` — `full` (default) extracts everything; `shallow` produces name-only stubs.
160
+ - `--skip-workflows` — Skip automatic workflow page generation from the call graph.
161
+
162
+ **Multi-language support:**
163
+ - **Python**: Always available (stdlib `ast`)
164
+ - **TypeScript/TSX** (`.ts`, `.tsx`): Requires Node.js and npm on PATH; bundled npm dependencies install on first use
165
+ - **Go** (`.go`): Requires Go on PATH
166
+ - **Rust** (`.rs`): Requires Cargo on PATH; compiles on first use
167
+
168
+ ## Automation Setup (Highly Recommended)
169
+
170
+ Install the post-commit hook to keep the wiki in sync automatically:
171
+
172
+ ```bash
173
+ llm-wiki install-hook
174
+ ```
175
+
176
+ The agent is read automatically from `.git/.llm-wiki-agent` (written by `init` as a local-only, non-committed file). You can override it:
177
+
178
+ ```bash
179
+ llm-wiki install-hook --agent aider
180
+ llm-wiki install-hook --wiki-dir .wiki # custom wiki dir
181
+ ```
182
+
183
+ ### CLI Agents (Claude, Aider, OpenCode)
184
+
185
+ The post-commit hook spawns `llm-wiki trigger-agent` as a detached background process via `nohup`:
186
+
187
+ 1. Calculates `git diff HEAD~1..HEAD`.
188
+ 2. Extracts current multi-language AST context.
189
+ 3. Writes a temporary command payload to `.git/llm-wiki-prompt.txt`.
190
+ 4. Spawns the CLI agent (e.g., `claude -p --dangerously-skip-permissions`) and pipes the prompt in.
191
+ 5. The agent updates the configured wiki markdown files and commits the result.
192
+
193
+ The prompt file includes the last commit diff and AST context. It is written with owner-only permissions where the platform supports it, but you should still treat it as sensitive if commits may contain secrets.
194
+
195
+ Inspect the background log at any time:
196
+ ```bash
197
+ cat .git/llm-wiki-sync.log
198
+ ```
199
+
200
+ ### IDE Agents (Copilot, Cursor, Generic)
201
+
202
+ Because IDE agents run inside the editor and have no headless CLI interface, the post-commit hook generates a sync prompt instead:
203
+
204
+ 1. Writes a ready-to-paste prompt to `.git/llm-wiki-prompt.txt`.
205
+ 2. The prompt tells the IDE agent how to inspect the last diff, extract changed-file AST context, and run lint.
206
+ 3. Prints a reminder in the terminal.
207
+
208
+ After every commit you'll see:
209
+ ```text
210
+ +--------------------------------------------------------------+
211
+ | LLM Wiki: paste the sync prompt into your IDE agent chat. |
212
+ | File: .git/llm-wiki-prompt.txt |
213
+ +--------------------------------------------------------------+
214
+ ```
215
+
216
+ Paste the file contents into your agent chat to trigger the wiki update.
217
+
218
+ You can also generate the prompt manually at any time (without committing):
219
+ ```bash
220
+ llm-wiki generate-prompt
221
+ llm-wiki generate-prompt --print # print to stdout
222
+ llm-wiki generate-prompt --wiki-dir .wiki # custom wiki dir
223
+ ```
224
+
225
+ ### Manual Version Bumping
226
+
227
+ You can bump the project version manually at any time:
228
+
229
+ ```bash
230
+ llm-wiki bump --patch # 0.1.5 -> 0.1.6
231
+ llm-wiki bump --minor # 0.1.6 -> 0.2.0
232
+ llm-wiki bump --patch --stage # bump + git add (for hook use)
233
+ ```
234
+
235
+ Supported version files: `pyproject.toml`, `setup.cfg`, `package.json`, `VERSION`.
236
+
237
+ ## Manual Commands
238
+
239
+ You or your agent can manually invoke any part of the pipeline:
240
+
241
+ ### 1. Structural Extraction
242
+
243
+ Extracts the project topology into a token-friendly JSON representation (all languages):
244
+ ```bash
245
+ llm-wiki extract --src-dir .
246
+ llm-wiki extract --src-dir . --changed # only files changed in last commit
247
+ llm-wiki extract --src-dir . --summary # compact output (names only)
248
+ llm-wiki extract --src-dir . --paths src/foo.py src/bar.py # specific files
249
+ ```
250
+
251
+ **Flags**:
252
+ - `--changed` — Extract only files modified since the last commit (for large projects)
253
+ - `--summary` — Compact format with class/function names only (no signatures, docstrings)
254
+ - `--paths FILE...` — Extract specific files for drill-down detail
255
+ - `--deep` — Deep mode (extract nested relationships)
256
+ - `--package NAME` — Only include files belonging to a discovered package
257
+ - `--include-empty` — Include Python files even if they have no extractable components
258
+
259
+ ### 2. Linting the Wiki
260
+
261
+ Validates wiki consistency — checks for broken links, orphan pages, and cross-references all entity/module/infrastructure pages against the live AST to detect undocumented classes, stale pages, and missing modules:
262
+ ```bash
263
+ llm-wiki lint --wiki-dir docs/llm_wiki --src-dir .
264
+ ```
265
+
266
+ Returns exit code `1` on any issues, making it CI-compatible.
267
+
268
+ ### 3. Incremental Sync (Fast Updates)
269
+
270
+ Update the wiki incrementally — only regenerates pages for files that changed since bootstrap/last sync:
271
+ ```bash
272
+ llm-wiki sync --src-dir . --wiki-dir docs/llm_wiki
273
+ ```
274
+
275
+ This is much faster than `bootstrap` for large projects. It:
276
+ - Uses `docs/llm_wiki/.llm-wiki-manifest.json` to track source file hashes
277
+ - Regenerates entity and module pages only for changed/new files
278
+ - Marks deleted files with a deprecation header in their wiki pages
279
+ - Rebuilds the index automatically
280
+ - Falls back gracefully for pre-manifest wikis (seeds baseline on first run)
281
+
282
+ ### 4. Context Budgeting (Large Projects)
283
+
284
+ Build a token-budgeted snapshot of the codebase for feeding to agents when the full extract is too large:
285
+ ```bash
286
+ llm-wiki context --budget 8000 --src-dir . --format markdown
287
+ llm-wiki context --budget 8000 --src-dir . --format json
288
+ llm-wiki context --budget 8000 --focus changed # prioritise changed files
289
+ llm-wiki context --budget 8000 --focus all # treat all files equally
290
+ ```
291
+
292
+ The token budget is an estimated maximum for the returned context payload.
293
+ When full detail does not fit, files are downgraded to slimmer summaries; files
294
+ that still do not fit are listed as omitted.
295
+
296
+ **Flags**:
297
+ - `--budget TOKENS` (required) — Estimated maximum token count for the context payload
298
+ - `--format markdown|json` — Output format (default: json)
299
+ - `--focus changed|all` — Priority classification (changed files get full detail; default: changed)
300
+
301
+ ### 5. Legacy Wiki Migration
302
+
303
+ Reconcile pages generated by older llm-wiki versions with the current
304
+ collision-aware naming rules without deleting prior content:
305
+ ```bash
306
+ llm-wiki migrate --src-dir . --wiki-dir docs/llm_wiki
307
+ llm-wiki migrate --dry-run # preview without writing
308
+ llm-wiki migrate --chunk-size 200 --plan-chunks # inspect chunk plan
309
+ llm-wiki migrate --chunk-size 200 # apply next pending chunk
310
+ ```
311
+
312
+ This regenerates active canonical pages, preserves previous page content under
313
+ `## Legacy Notes`, archives old pages under `docs/llm_wiki/legacy/`, rebuilds
314
+ `index.md`, refreshes the sync manifest, and rewrites known active links.
315
+ Archived `legacy/` pages are ignored by `lint`, and migrate adds the archive
316
+ directory to `.gitignore` so migration snapshots do not flood the repository.
317
+
318
+ For large wikis, use `--chunk-size` to keep each working-tree change small.
319
+ Run the same chunked command repeatedly, reviewing or committing between runs.
320
+ The final chunk refreshes `index.md`, active links, and `.llm-wiki-manifest.json`.
321
+
322
+ ### 6. Generate Sync Prompt (IDE agents)
323
+
324
+ Builds an IDE sync prompt and writes it to a file for pasting into your IDE agent chat:
325
+ ```bash
326
+ llm-wiki generate-prompt
327
+ llm-wiki generate-prompt --print # print to stdout instead
328
+ llm-wiki generate-prompt --output my.txt # custom output path
329
+ llm-wiki generate-prompt --src-dir . --wiki-dir docs/llm_wiki
330
+ ```
331
+
332
+ ### 7. Upgrade Framework
333
+
334
+ Refresh all framework-managed artifacts in one command (idempotent, non-destructive):
335
+ ```bash
336
+ llm-wiki upgrade
337
+ llm-wiki upgrade --agent copilot # switch agents
338
+ llm-wiki upgrade --wiki-dir .wiki # custom wiki dir
339
+ llm-wiki upgrade --no-quality-hints # disable quality hints
340
+ ```
341
+
342
+ This updates:
343
+ - Agent constraint blocks in schema files
344
+ - Wiki directory structure (adds missing directories)
345
+ - Git hooks (if previously installed)
346
+
347
+ ### 8. Release Changelog
348
+
349
+ Stamp the current project version into the `[Unreleased]` section of the changelog. Empty `[Unreleased]` sections are left unchanged.
350
+ ```bash
351
+ llm-wiki release
352
+ llm-wiki release --changelog CHANGELOG.md
353
+ llm-wiki release --stage
354
+ ```
355
+
356
+ ### 9. Project Status
357
+
358
+ Display the current wiki setup and integration status:
359
+ ```bash
360
+ llm-wiki status
361
+ ```
362
+
363
+ Shows: wiki directory, configured agent, installed hooks, circuit breaker state, page counts.
364
+
365
+ ### 10. Version Bump
366
+
367
+ Manually bump the project version:
368
+ ```bash
369
+ llm-wiki bump --patch # increment patch
370
+ llm-wiki bump --minor # increment minor, reset patch
371
+ ```
372
+
373
+ ## Wiki File Naming Conventions
374
+
375
+ The wiki uses collision-aware naming to ensure every page has a unique filename:
376
+
377
+ | Page Type | Pattern | Examples |
378
+ |-----------|---------|----------|
379
+ | **Entity** | `entities/<ClassName>.md` | `User.md`, `parser_Parser.md` (when collision) |
380
+ | **Module** | `modules/<file_stem>.md` | `cli.md`, `pkg_a_cli.md` (when collision) |
381
+ | **Workflow** | `workflows/<name>.md` | `user_auth_flow.md` |
382
+ | **Infrastructure** | `infrastructure/<path_transformed>.md` | `Dockerfile.md`, `test_project_Dockerfile.md`, `docker-compose_yml.md` |
383
+
384
+ **Collision-aware naming:**
385
+ - When multiple classes share the same name across different files, the module page name is prepended (e.g., `pkg_a_cli_Parser.md` vs `pkg_b_cli_Parser.md`)
386
+ - When multiple files share the same stem in different directories, parent directory components are progressively added (e.g., `pkg_a_cli.md` vs `pkg_b_cli.md`)
387
+ - These rules are automatically enforced by `bootstrap`, `sync`, and validated by `lint`
388
+
389
+ ## Forking and Security
390
+
391
+ This project does not maintain a formal contribution process. The source is
392
+ published under the MIT License, so you may freely fork it, adapt it, and run
393
+ your own version under the license terms.
394
+
395
+ Public issues are still useful for reproducible bugs and project discussion.
396
+ Participants are expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md)
397
+ in project spaces.
398
+
399
+ Do not report security vulnerabilities in public issues. Follow
400
+ [SECURITY.md](SECURITY.md), especially for issues involving headless agent
401
+ execution, generated prompt files, path handling, or extractor subprocesses.
402
+
403
+ ## Uninstalling from a Project
404
+
405
+ Remove LLM Wiki integration artifacts (hooks, agent constraint blocks, local runtime artifacts) while **preserving the wiki documentation**:
406
+
407
+ ```bash
408
+ llm-wiki uninstall
409
+ ```
410
+
411
+ To also delete the wiki documentation directory:
412
+ ```bash
413
+ llm-wiki uninstall --remove-wiki
414
+ ```
415
+
416
+ Preview what would be removed first:
417
+ ```bash
418
+ llm-wiki uninstall --dry-run
419
+ ```
420
+
421
+ **Safety guarantees:**
422
+ - **Wiki docs**: kept by default. Pass `--remove-wiki` to opt-in to deletion.
423
+ - **Agent schema files** (e.g. `CLAUDE.md`): only the `# --- LLM Wiki Maintainer Constraints ---` block is stripped. Any user-written content outside that block is preserved. The file is only deleted if it contained nothing else.
424
+ - **Git hooks**: only removed if they contain the `LLM Wiki` signature. Custom user hooks are never touched.
425
+ - The CLI itself is not uninstalled — run `pip uninstall agent-wiki-cli` separately if needed.