wikifier 0.3.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.
Files changed (31) hide show
  1. wikifier-0.3.1/PKG-INFO +253 -0
  2. wikifier-0.3.1/README.md +221 -0
  3. {wikifier-0.3.0 → wikifier-0.3.1}/pyproject.toml +6 -2
  4. wikifier-0.3.1/wikifier/__init__.py +16 -0
  5. wikifier-0.3.1/wikifier/health.py +620 -0
  6. wikifier-0.3.1/wikifier/import_cache.py +135 -0
  7. wikifier-0.3.1/wikifier/mcp/server.py +1279 -0
  8. wikifier-0.3.1/wikifier.egg-info/PKG-INFO +253 -0
  9. {wikifier-0.3.0 → wikifier-0.3.1}/wikifier.egg-info/SOURCES.txt +7 -0
  10. {wikifier-0.3.0 → wikifier-0.3.1}/wikifier.egg-info/entry_points.txt +1 -0
  11. wikifier-0.3.1/wikifier.egg-info/requires.txt +3 -0
  12. wikifier-0.3.0/PKG-INFO +0 -137
  13. wikifier-0.3.0/README.md +0 -107
  14. wikifier-0.3.0/wikifier/__init__.py +0 -9
  15. wikifier-0.3.0/wikifier.egg-info/PKG-INFO +0 -137
  16. {wikifier-0.3.0 → wikifier-0.3.1}/Basis-v0.3.md +0 -0
  17. {wikifier-0.3.0 → wikifier-0.3.1}/CONTRIBUTING.md +0 -0
  18. {wikifier-0.3.0 → wikifier-0.3.1}/LICENSE +0 -0
  19. {wikifier-0.3.0 → wikifier-0.3.1}/MANIFEST.in +0 -0
  20. {wikifier-0.3.0 → wikifier-0.3.1}/TRADEOFFS.md +0 -0
  21. {wikifier-0.3.0 → wikifier-0.3.1}/index.html +0 -0
  22. {wikifier-0.3.0 → wikifier-0.3.1}/setup.cfg +0 -0
  23. {wikifier-0.3.0 → wikifier-0.3.1}/skills/run.md +0 -0
  24. {wikifier-0.3.0 → wikifier-0.3.1}/spec.md +0 -0
  25. {wikifier-0.3.0 → wikifier-0.3.1}/wikifier/__main__.py +0 -0
  26. {wikifier-0.3.0 → wikifier-0.3.1}/wikifier/cli.py +0 -0
  27. {wikifier-0.3.0 → wikifier-0.3.1}/wikifier/scripts/wikifier.bat +0 -0
  28. {wikifier-0.3.0 → wikifier-0.3.1}/wikifier/scripts/wikifier.ps1 +0 -0
  29. {wikifier-0.3.0 → wikifier-0.3.1}/wikifier/scripts/wikifier.sh +0 -0
  30. {wikifier-0.3.0 → wikifier-0.3.1}/wikifier.egg-info/dependency_links.txt +0 -0
  31. {wikifier-0.3.0 → wikifier-0.3.1}/wikifier.egg-info/top_level.txt +0 -0
@@ -0,0 +1,253 @@
1
+ Metadata-Version: 2.4
2
+ Name: wikifier
3
+ Version: 0.3.1
4
+ Summary: Agent-first, zero-dependency, self-maintaining codebase documentation & change tracking system
5
+ Author-email: Aron Amos <aron@example.com>
6
+ Maintainer: Aron Amos
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/IronAdamant/wikifier
9
+ Project-URL: Repository, https://github.com/IronAdamant/wikifier
10
+ Project-URL: Documentation, https://github.com/IronAdamant/wikifier#readme
11
+ Project-URL: Bug Tracker, https://github.com/IronAdamant/wikifier/issues
12
+ Keywords: wiki,documentation,llm,agent,mcp,codebase,health-matrix,zero-dependency,shell
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Operating System :: OS Independent
23
+ Classifier: Topic :: Software Development :: Documentation
24
+ Classifier: Topic :: Software Development :: Version Control
25
+ Classifier: Topic :: Text Processing :: Markup :: Markdown
26
+ Requires-Python: >=3.8
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Provides-Extra: mcp
30
+ Requires-Dist: mcp>=1.0.0; extra == "mcp"
31
+ Dynamic: license-file
32
+
33
+ # Wikifier v0.3
34
+
35
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
36
+ [![PyPI version](https://img.shields.io/pypi/v/wikifier.svg)](https://pypi.org/project/wikifier/)
37
+ [![GitHub Stars](https://img.shields.io/github/stars/IronAdamant/wikifier?style=social)](https://github.com/IronAdamant/wikifier/stargazers)
38
+
39
+ **Agent-first • Zero-dependency • LLM-operated codebase wiki**
40
+
41
+ Wikifier turns any codebase (tiny scripts → large monorepos) into a living, token-efficient map that LLMs/agents operate autonomously.
42
+
43
+ ### What's New in v0.3.1
44
+
45
+ - **Major improvements to Dependency Intelligence** (M2-Rem-08):
46
+ - Complete refactor of the first-pass analysis engine (`perform_first_pass_graph_and_cache_update`)
47
+ - Rich `resolved_pairs` now stored with `confidence` (`high` / `medium` / `low`)
48
+ - Full reverse dependency recording and persistence (`_reverse_dependencies`)
49
+ - `get_dependencies()` and `get_dependents()` now prefer the rich cache and are significantly more reliable
50
+ - New `heal_stubs` and `list_healable_stubs` MCP tools + CLI commands
51
+
52
+ - **Health Matrix Auto-Healing**:
53
+ - New `heal_outdated_stubs` system that detects "Initial stub" entries with real wiki summaries
54
+ - Smarter quality heuristics (headings, purpose sections, structure, word count)
55
+ - High-quality wikis can now be auto-promoted directly to 🟢 Green
56
+ - `wikifier heal-stubs`, `wikifier healable-stubs`, and `wikifier healing-stats` commands
57
+ - Full MCP tool support (`heal_stubs`, `list_healable_stubs`, `health(format="healing-stats")`)
58
+
59
+ - **Developer Experience**:
60
+ - `WIKIFIER_DEBUG=1` mode for the first-pass (shows exactly what would be re-parsed without side effects)
61
+ - Much cleaner and more maintainable first-pass code with extracted helpers
62
+
63
+ - **Cache & Data Model**:
64
+ - `import_cache.json` now stores confidence in `resolved_pairs` and a top-level `_reverse_dependencies` map
65
+ - Per-file `dependents` lists are now stored for impact analysis
66
+
67
+ This is a substantial patch release focused on making dependency intelligence and the Health Matrix trustworthy for autonomous agents.
68
+
69
+ > **GitHub**: https://github.com/IronAdamant/wikifier
70
+ > **PyPI**: https://pypi.org/project/wikifier/
71
+
72
+ ---
73
+
74
+ ## 🚀 Installation
75
+
76
+ **Recommended — via pip:**
77
+
78
+ ```bash
79
+ pip install wikifier
80
+ ```
81
+
82
+ Then run:
83
+
84
+ ```bash
85
+ wikifier init
86
+ wikifier check-changes
87
+ ```
88
+
89
+ Then open `index.html` in your browser for the live dashboard.
90
+
91
+ ---
92
+
93
+ **Alternative — from source:**
94
+
95
+ ```bash
96
+ git clone https://github.com/IronAdamant/wikifier.git
97
+ cd wikifier
98
+ chmod +x wikifier.sh
99
+ ./wikifier.sh init
100
+ ./wikifier.sh check-changes
101
+ ```
102
+
103
+ ### Mandatory Rule for Every LLM / Grok Build Session
104
+
105
+ Copy this into the **start of every new prompt** when working in a Wikifier-managed project:
106
+
107
+ ```text
108
+ You are operating inside a Wikifier v0.3 project.
109
+
110
+ MANDATORY FIRST STEPS:
111
+ 1. Run: wikifier check-changes
112
+ 2. Read file_health.md + pending_updates.md
113
+ 3. Prioritise 🔴 Red → 🟡 Yellow items
114
+ 4. For every code edit: wikifier record-change "path/to/file" "I did X because Y"
115
+ 5. After updating the wiki summary: wikifier mark-green "path/to/file"
116
+ 6. Re-validate before finishing
117
+ ```
118
+
119
+ > **Note**: This rule applies per-project. When using Wikifier on an external codebase (not the Wikifier repo itself), the agent should be told which project root to operate on (via `WIKIFIER_PROJECT_ROOT`, `--project-root`, or the `project_root` parameter on MCP tools).
120
+
121
+ ---
122
+
123
+ ### Using Wikifier on External Projects (Packaging & Setup Clarity — M2-Rem-06)
124
+
125
+ Wikifier is a **general-purpose** agent memory system. After `pip install wikifier` (or `pip install wikifier[mcp]`), the `wikifier` and `wikifier-mcp` console scripts become available globally. You can (and should) use them on **any** codebase — not just the Wikifier source tree.
126
+
127
+ #### Pip Install vs Running from Source
128
+
129
+ - **After `pip install wikifier`** (recommended for normal use):
130
+ - `wikifier` and `wikifier-mcp` commands are in your PATH.
131
+ - The underlying implementation is the installed package (Python + shell scripts bundled).
132
+ - You still need to tell Wikifier **which project** you want to document (see Root Targeting below).
133
+ - `wikifier init --target /path/to/project` is the correct way to bootstrap state in an external folder.
134
+
135
+ - **Running from source** (development / contributing):
136
+ - Clone the repo, `chmod +x wikifier.sh`, and invoke `./wikifier.sh ...` or the scripts directly.
137
+ - Useful when you are actively modifying Wikifier itself.
138
+
139
+ **First-time setup on a new external codebase after pip install** (canonical flow):
140
+ ```bash
141
+ # 1. Point at the target project
142
+ export WIKIFIER_PROJECT_ROOT=/path/to/your/actual/codebase
143
+
144
+ # 2. Bootstrap (creates monitored_paths.txt, file_health.md, etc.)
145
+ wikifier init --target "$WIKIFIER_PROJECT_ROOT"
146
+
147
+ # 3. Optional but recommended: edit monitored_paths.txt to focus on src/, app/, packages/ etc.
148
+ # 4. Run the mandatory workflow
149
+ wikifier check-changes
150
+
151
+ # 5. For agent work, start the MCP server with the same root
152
+ WIKIFIER_PROJECT_ROOT="$WIKIFIER_PROJECT_ROOT" wikifier-mcp
153
+ ```
154
+
155
+ #### How Root Targeting Works (Decision Order for Agents)
156
+
157
+ Wikifier resolves the project root using this strict priority. Agents should follow it to avoid confusion:
158
+
159
+ 1. `WIKIFIER_PROJECT_ROOT` environment variable (strongest — works for shell + all MCP tools)
160
+ 2. Explicit `--project-root` (CLI) or `project_root` parameter on MCP tool calls
161
+ 3. Upward directory walk looking for `monitored_paths.txt` or a `.wikifier/` directory
162
+ 4. `.mcp.json` present in the workspace root (common in Grok Build, Cursor, etc.)
163
+
164
+ When the MCP server is started via `wikifier-mcp` (or through `.mcp.json`), it will usually auto-detect correctly if you `cd` into the project first. For maximum reliability on external dogfooding, always pass `project_root` or set the env var.
165
+
166
+ This packaging + targeting story was a major focus of M2-Rem-06 to eliminate the friction reported during RecipeLab_alt and self-dogfood.
167
+
168
+ ---
169
+
170
+ ### Scaling Wikifier — Recommended Patterns by Project Size (M2-Rem-06)
171
+
172
+ Wikifier is explicitly designed to scale from tiny scripts to massive monorepos. The guidance below is **prescriptive** — follow the patterns for your project size to stay fast and reliable.
173
+
174
+ #### Recommended Command Patterns
175
+
176
+ | Size | Preferred Interface | Health Query | `update-maps` Strategy | Key Additional Practices |
177
+ |-----------------------|---------------------------|-------------------------------------------|-------------------------------------------------|--------------------------|
178
+ | **Tiny / Small**<br>(< 300 files) | Shell or MCP | `wikifier health` (full table is fine) | `wikifier update-maps` (default incremental) | Use `.wiki.md` files next to sources for best `get_file_wiki`. Full rebuilds are cheap. |
179
+ | **Medium**<br>(300–2,000 files) | MCP preferred | `health --summary` or `health --dir src/` | `update_maps()` (incremental). Use `--full` only after large refactors or suspected cache corruption. | Prefer MCP tools (`get_project_status`, `suggest_next_actions`). Use directory filtering heavily. |
180
+ | **Large**<br>(2,000–8,000 files) | **MCP strongly recommended** | `health(format="json", directory="src/services/")` + `--summary` | Always incremental. Inspect with `get_incremental_status()`. `--full` only on major structural changes. | Enable locking (automatic via Python backend). Run background `monitor &` safely. Use `get_files_needing_attention`. |
181
+ | **Massive**<br>(8,000–30,000+ files) | **MCP only** | `health --summary --dir <package>/` (never full table) | Incremental + `get_incremental_status()` before/after. Never run `--full` unless cache is known stale. | Use `get_dependents` / `get_dependencies` per-file. Leverage `import_cache.json` visibility. Multiple agents + monitor is safe thanks to M2-Rem-07 locking. |
182
+
183
+ **When to use `--full` (rare):**
184
+ - After moving/renaming many packages or changing import styles across the codebase.
185
+ - If you manually deleted `import_cache.json`.
186
+ - When the dogfood report or `get_incremental_status` shows very low resolution health.
187
+
188
+ **Root Detection Rules (to avoid confusion)**
189
+ Wikifier finds the project root using this priority (agents should understand this):
190
+ 1. `WIKIFIER_PROJECT_ROOT` environment variable (highest priority, works for both shell + MCP).
191
+ 2. Explicit `--project-root` flag (CLI) or `project_root` parameter (MCP tools).
192
+ 3. Walk upward from CWD looking for `monitored_paths.txt` or `.wikifier/` directory.
193
+ 4. `.mcp.json` in the current workspace (common in Grok Build / Cursor sessions).
194
+
195
+ When operating on an external project after `pip install wikifier`, the most reliable pattern is:
196
+ ```bash
197
+ WIKIFIER_PROJECT_ROOT=/absolute/path/to/your/repo wikifier check-changes
198
+ WIKIFIER_PROJECT_ROOT=/absolute/path/to/your/repo wikifier-mcp
199
+ ```
200
+ Or pass `project_root` on every MCP tool call.
201
+
202
+ This section was significantly strengthened during M2-Rem-06 based on dogfood feedback.
203
+
204
+ ---
205
+
206
+ ## What Wikifier Gives You
207
+
208
+ - **Per-file Documentation Health Matrix** — 🟢 Green / 🟡 Yellow / 🔴 Red status with reasons
209
+ - **Semantic Change Logging** — `record-change "file" "I did X because Y"` (the "why", not just the "what")
210
+ - **Background Heartbeat Monitor** — Passive `monitor &` loop keeps everything fresh while you sleep
211
+ - **Automated Journal + Categorized Issues** — Dated entries + `Logged_issues/{simple,moderate,high,critical}/...`
212
+ - **Beautiful Static Dashboard** — `index.html` with live health lights, Mermaid graphs, and one-click command reference
213
+ - **First-Class MCP Server** — Run `wikifier-mcp` to expose Wikifier as a proper MCP server with rich tools (`get_dependents`, `get_project_status`, `suggest_next_actions`, etc.), resources, and prompts. Works great with Claude Desktop, Cline, Cursor, and other MCP clients.
214
+ - **Legacy Skills Interface** — `skills/run.md` still available for simpler shell-based agent setups.
215
+ - **True Zero Dependencies** — Pure Bash + PowerShell. Works on any machine, no Docker, no Node, no Python packages.
216
+
217
+ **This is agent-first.** LLMs operate the system via shell commands. Humans just watch the dashboard.
218
+
219
+ ## Core Commands
220
+
221
+ | Command | Purpose |
222
+ |---------------------------|----------------------------------------------|
223
+ | `wikifier check-changes` | Incremental mtime scan + health update |
224
+ | `wikifier record-change <file> "reason"` | Log *why* you made an edit (required) |
225
+ | `wikifier mark-green <file>` | Mark wiki summary as accurate after editing |
226
+ | `wikifier monitor &` | Background heartbeat (30s polling) |
227
+ | `wikifier update-maps` | Rebuild `library.md` + Mermaid dependency graph |
228
+ | `wikifier health` | Show current Documentation Health Matrix |
229
+
230
+ Full reference → [`skills/run.md`](skills/run.md)
231
+
232
+ ## Quick Links
233
+
234
+ - [spec.md](spec.md) — Immutable user requirements
235
+ - [Basis-v0.3.md](Basis-v0.3.md) — Implementation reference & data formats
236
+ - [TRADEOFFS.md](TRADEOFFS.md) — Why we made the design choices we did
237
+ - [index.html](index.html) — Open this in a browser for the live dashboard
238
+
239
+ ## Differentiation
240
+
241
+ Unlike heavy "LLM Wiki" approaches (e.g. Karpathy-style personal knowledge bases), Wikifier is the **ultra-light, shell-native** implementation:
242
+
243
+ - Per-file health matrix with clear Red/Yellow/Green workflow
244
+ - Semantic `record-change` intent logging for future self-review
245
+ - True background monitor + zero external dependencies
246
+ - Native cross-platform (Linux/macOS/Windows via PowerShell)
247
+ - Designed from day one to be driven by LLMs via MCP/tools
248
+
249
+ **License**: MIT — fork freely and use in any project.
250
+
251
+ ---
252
+
253
+ *Built for agents, by agents, with just `bash` and stubbornness.*
@@ -0,0 +1,221 @@
1
+ # Wikifier v0.3
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![PyPI version](https://img.shields.io/pypi/v/wikifier.svg)](https://pypi.org/project/wikifier/)
5
+ [![GitHub Stars](https://img.shields.io/github/stars/IronAdamant/wikifier?style=social)](https://github.com/IronAdamant/wikifier/stargazers)
6
+
7
+ **Agent-first • Zero-dependency • LLM-operated codebase wiki**
8
+
9
+ Wikifier turns any codebase (tiny scripts → large monorepos) into a living, token-efficient map that LLMs/agents operate autonomously.
10
+
11
+ ### What's New in v0.3.1
12
+
13
+ - **Major improvements to Dependency Intelligence** (M2-Rem-08):
14
+ - Complete refactor of the first-pass analysis engine (`perform_first_pass_graph_and_cache_update`)
15
+ - Rich `resolved_pairs` now stored with `confidence` (`high` / `medium` / `low`)
16
+ - Full reverse dependency recording and persistence (`_reverse_dependencies`)
17
+ - `get_dependencies()` and `get_dependents()` now prefer the rich cache and are significantly more reliable
18
+ - New `heal_stubs` and `list_healable_stubs` MCP tools + CLI commands
19
+
20
+ - **Health Matrix Auto-Healing**:
21
+ - New `heal_outdated_stubs` system that detects "Initial stub" entries with real wiki summaries
22
+ - Smarter quality heuristics (headings, purpose sections, structure, word count)
23
+ - High-quality wikis can now be auto-promoted directly to 🟢 Green
24
+ - `wikifier heal-stubs`, `wikifier healable-stubs`, and `wikifier healing-stats` commands
25
+ - Full MCP tool support (`heal_stubs`, `list_healable_stubs`, `health(format="healing-stats")`)
26
+
27
+ - **Developer Experience**:
28
+ - `WIKIFIER_DEBUG=1` mode for the first-pass (shows exactly what would be re-parsed without side effects)
29
+ - Much cleaner and more maintainable first-pass code with extracted helpers
30
+
31
+ - **Cache & Data Model**:
32
+ - `import_cache.json` now stores confidence in `resolved_pairs` and a top-level `_reverse_dependencies` map
33
+ - Per-file `dependents` lists are now stored for impact analysis
34
+
35
+ This is a substantial patch release focused on making dependency intelligence and the Health Matrix trustworthy for autonomous agents.
36
+
37
+ > **GitHub**: https://github.com/IronAdamant/wikifier
38
+ > **PyPI**: https://pypi.org/project/wikifier/
39
+
40
+ ---
41
+
42
+ ## 🚀 Installation
43
+
44
+ **Recommended — via pip:**
45
+
46
+ ```bash
47
+ pip install wikifier
48
+ ```
49
+
50
+ Then run:
51
+
52
+ ```bash
53
+ wikifier init
54
+ wikifier check-changes
55
+ ```
56
+
57
+ Then open `index.html` in your browser for the live dashboard.
58
+
59
+ ---
60
+
61
+ **Alternative — from source:**
62
+
63
+ ```bash
64
+ git clone https://github.com/IronAdamant/wikifier.git
65
+ cd wikifier
66
+ chmod +x wikifier.sh
67
+ ./wikifier.sh init
68
+ ./wikifier.sh check-changes
69
+ ```
70
+
71
+ ### Mandatory Rule for Every LLM / Grok Build Session
72
+
73
+ Copy this into the **start of every new prompt** when working in a Wikifier-managed project:
74
+
75
+ ```text
76
+ You are operating inside a Wikifier v0.3 project.
77
+
78
+ MANDATORY FIRST STEPS:
79
+ 1. Run: wikifier check-changes
80
+ 2. Read file_health.md + pending_updates.md
81
+ 3. Prioritise 🔴 Red → 🟡 Yellow items
82
+ 4. For every code edit: wikifier record-change "path/to/file" "I did X because Y"
83
+ 5. After updating the wiki summary: wikifier mark-green "path/to/file"
84
+ 6. Re-validate before finishing
85
+ ```
86
+
87
+ > **Note**: This rule applies per-project. When using Wikifier on an external codebase (not the Wikifier repo itself), the agent should be told which project root to operate on (via `WIKIFIER_PROJECT_ROOT`, `--project-root`, or the `project_root` parameter on MCP tools).
88
+
89
+ ---
90
+
91
+ ### Using Wikifier on External Projects (Packaging & Setup Clarity — M2-Rem-06)
92
+
93
+ Wikifier is a **general-purpose** agent memory system. After `pip install wikifier` (or `pip install wikifier[mcp]`), the `wikifier` and `wikifier-mcp` console scripts become available globally. You can (and should) use them on **any** codebase — not just the Wikifier source tree.
94
+
95
+ #### Pip Install vs Running from Source
96
+
97
+ - **After `pip install wikifier`** (recommended for normal use):
98
+ - `wikifier` and `wikifier-mcp` commands are in your PATH.
99
+ - The underlying implementation is the installed package (Python + shell scripts bundled).
100
+ - You still need to tell Wikifier **which project** you want to document (see Root Targeting below).
101
+ - `wikifier init --target /path/to/project` is the correct way to bootstrap state in an external folder.
102
+
103
+ - **Running from source** (development / contributing):
104
+ - Clone the repo, `chmod +x wikifier.sh`, and invoke `./wikifier.sh ...` or the scripts directly.
105
+ - Useful when you are actively modifying Wikifier itself.
106
+
107
+ **First-time setup on a new external codebase after pip install** (canonical flow):
108
+ ```bash
109
+ # 1. Point at the target project
110
+ export WIKIFIER_PROJECT_ROOT=/path/to/your/actual/codebase
111
+
112
+ # 2. Bootstrap (creates monitored_paths.txt, file_health.md, etc.)
113
+ wikifier init --target "$WIKIFIER_PROJECT_ROOT"
114
+
115
+ # 3. Optional but recommended: edit monitored_paths.txt to focus on src/, app/, packages/ etc.
116
+ # 4. Run the mandatory workflow
117
+ wikifier check-changes
118
+
119
+ # 5. For agent work, start the MCP server with the same root
120
+ WIKIFIER_PROJECT_ROOT="$WIKIFIER_PROJECT_ROOT" wikifier-mcp
121
+ ```
122
+
123
+ #### How Root Targeting Works (Decision Order for Agents)
124
+
125
+ Wikifier resolves the project root using this strict priority. Agents should follow it to avoid confusion:
126
+
127
+ 1. `WIKIFIER_PROJECT_ROOT` environment variable (strongest — works for shell + all MCP tools)
128
+ 2. Explicit `--project-root` (CLI) or `project_root` parameter on MCP tool calls
129
+ 3. Upward directory walk looking for `monitored_paths.txt` or a `.wikifier/` directory
130
+ 4. `.mcp.json` present in the workspace root (common in Grok Build, Cursor, etc.)
131
+
132
+ When the MCP server is started via `wikifier-mcp` (or through `.mcp.json`), it will usually auto-detect correctly if you `cd` into the project first. For maximum reliability on external dogfooding, always pass `project_root` or set the env var.
133
+
134
+ This packaging + targeting story was a major focus of M2-Rem-06 to eliminate the friction reported during RecipeLab_alt and self-dogfood.
135
+
136
+ ---
137
+
138
+ ### Scaling Wikifier — Recommended Patterns by Project Size (M2-Rem-06)
139
+
140
+ Wikifier is explicitly designed to scale from tiny scripts to massive monorepos. The guidance below is **prescriptive** — follow the patterns for your project size to stay fast and reliable.
141
+
142
+ #### Recommended Command Patterns
143
+
144
+ | Size | Preferred Interface | Health Query | `update-maps` Strategy | Key Additional Practices |
145
+ |-----------------------|---------------------------|-------------------------------------------|-------------------------------------------------|--------------------------|
146
+ | **Tiny / Small**<br>(< 300 files) | Shell or MCP | `wikifier health` (full table is fine) | `wikifier update-maps` (default incremental) | Use `.wiki.md` files next to sources for best `get_file_wiki`. Full rebuilds are cheap. |
147
+ | **Medium**<br>(300–2,000 files) | MCP preferred | `health --summary` or `health --dir src/` | `update_maps()` (incremental). Use `--full` only after large refactors or suspected cache corruption. | Prefer MCP tools (`get_project_status`, `suggest_next_actions`). Use directory filtering heavily. |
148
+ | **Large**<br>(2,000–8,000 files) | **MCP strongly recommended** | `health(format="json", directory="src/services/")` + `--summary` | Always incremental. Inspect with `get_incremental_status()`. `--full` only on major structural changes. | Enable locking (automatic via Python backend). Run background `monitor &` safely. Use `get_files_needing_attention`. |
149
+ | **Massive**<br>(8,000–30,000+ files) | **MCP only** | `health --summary --dir <package>/` (never full table) | Incremental + `get_incremental_status()` before/after. Never run `--full` unless cache is known stale. | Use `get_dependents` / `get_dependencies` per-file. Leverage `import_cache.json` visibility. Multiple agents + monitor is safe thanks to M2-Rem-07 locking. |
150
+
151
+ **When to use `--full` (rare):**
152
+ - After moving/renaming many packages or changing import styles across the codebase.
153
+ - If you manually deleted `import_cache.json`.
154
+ - When the dogfood report or `get_incremental_status` shows very low resolution health.
155
+
156
+ **Root Detection Rules (to avoid confusion)**
157
+ Wikifier finds the project root using this priority (agents should understand this):
158
+ 1. `WIKIFIER_PROJECT_ROOT` environment variable (highest priority, works for both shell + MCP).
159
+ 2. Explicit `--project-root` flag (CLI) or `project_root` parameter (MCP tools).
160
+ 3. Walk upward from CWD looking for `monitored_paths.txt` or `.wikifier/` directory.
161
+ 4. `.mcp.json` in the current workspace (common in Grok Build / Cursor sessions).
162
+
163
+ When operating on an external project after `pip install wikifier`, the most reliable pattern is:
164
+ ```bash
165
+ WIKIFIER_PROJECT_ROOT=/absolute/path/to/your/repo wikifier check-changes
166
+ WIKIFIER_PROJECT_ROOT=/absolute/path/to/your/repo wikifier-mcp
167
+ ```
168
+ Or pass `project_root` on every MCP tool call.
169
+
170
+ This section was significantly strengthened during M2-Rem-06 based on dogfood feedback.
171
+
172
+ ---
173
+
174
+ ## What Wikifier Gives You
175
+
176
+ - **Per-file Documentation Health Matrix** — 🟢 Green / 🟡 Yellow / 🔴 Red status with reasons
177
+ - **Semantic Change Logging** — `record-change "file" "I did X because Y"` (the "why", not just the "what")
178
+ - **Background Heartbeat Monitor** — Passive `monitor &` loop keeps everything fresh while you sleep
179
+ - **Automated Journal + Categorized Issues** — Dated entries + `Logged_issues/{simple,moderate,high,critical}/...`
180
+ - **Beautiful Static Dashboard** — `index.html` with live health lights, Mermaid graphs, and one-click command reference
181
+ - **First-Class MCP Server** — Run `wikifier-mcp` to expose Wikifier as a proper MCP server with rich tools (`get_dependents`, `get_project_status`, `suggest_next_actions`, etc.), resources, and prompts. Works great with Claude Desktop, Cline, Cursor, and other MCP clients.
182
+ - **Legacy Skills Interface** — `skills/run.md` still available for simpler shell-based agent setups.
183
+ - **True Zero Dependencies** — Pure Bash + PowerShell. Works on any machine, no Docker, no Node, no Python packages.
184
+
185
+ **This is agent-first.** LLMs operate the system via shell commands. Humans just watch the dashboard.
186
+
187
+ ## Core Commands
188
+
189
+ | Command | Purpose |
190
+ |---------------------------|----------------------------------------------|
191
+ | `wikifier check-changes` | Incremental mtime scan + health update |
192
+ | `wikifier record-change <file> "reason"` | Log *why* you made an edit (required) |
193
+ | `wikifier mark-green <file>` | Mark wiki summary as accurate after editing |
194
+ | `wikifier monitor &` | Background heartbeat (30s polling) |
195
+ | `wikifier update-maps` | Rebuild `library.md` + Mermaid dependency graph |
196
+ | `wikifier health` | Show current Documentation Health Matrix |
197
+
198
+ Full reference → [`skills/run.md`](skills/run.md)
199
+
200
+ ## Quick Links
201
+
202
+ - [spec.md](spec.md) — Immutable user requirements
203
+ - [Basis-v0.3.md](Basis-v0.3.md) — Implementation reference & data formats
204
+ - [TRADEOFFS.md](TRADEOFFS.md) — Why we made the design choices we did
205
+ - [index.html](index.html) — Open this in a browser for the live dashboard
206
+
207
+ ## Differentiation
208
+
209
+ Unlike heavy "LLM Wiki" approaches (e.g. Karpathy-style personal knowledge bases), Wikifier is the **ultra-light, shell-native** implementation:
210
+
211
+ - Per-file health matrix with clear Red/Yellow/Green workflow
212
+ - Semantic `record-change` intent logging for future self-review
213
+ - True background monitor + zero external dependencies
214
+ - Native cross-platform (Linux/macOS/Windows via PowerShell)
215
+ - Designed from day one to be driven by LLMs via MCP/tools
216
+
217
+ **License**: MIT — fork freely and use in any project.
218
+
219
+ ---
220
+
221
+ *Built for agents, by agents, with just `bash` and stubbornness.*
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "wikifier"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Agent-first, zero-dependency, self-maintaining codebase documentation & change tracking system"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -35,7 +35,7 @@ classifiers = [
35
35
  "Topic :: Text Processing :: Markup :: Markdown",
36
36
  ]
37
37
 
38
- dependencies = []
38
+ dependencies = [] # Zero-dependency by default. MCP support is optional.
39
39
 
40
40
  [project.urls]
41
41
  Homepage = "https://github.com/IronAdamant/wikifier"
@@ -43,8 +43,12 @@ Repository = "https://github.com/IronAdamant/wikifier"
43
43
  Documentation = "https://github.com/IronAdamant/wikifier#readme"
44
44
  "Bug Tracker" = "https://github.com/IronAdamant/wikifier/issues"
45
45
 
46
+ [project.optional-dependencies]
47
+ mcp = ["mcp>=1.0.0"]
48
+
46
49
  [project.scripts]
47
50
  wikifier = "wikifier.cli:main"
51
+ wikifier-mcp = "wikifier.mcp.server:main"
48
52
 
49
53
  [tool.setuptools]
50
54
  package-dir = {"" = "."}
@@ -0,0 +1,16 @@
1
+ """
2
+ Wikifier Python Package
3
+
4
+ Provides the core Python components for Wikifier, including:
5
+ - Import parsers (Python + JavaScript/TypeScript)
6
+ - MCP Server
7
+ - Health Matrix (scalable implementation)
8
+ """
9
+
10
+ from . import parsers
11
+ from . import mcp
12
+ from . import health
13
+ from . import locking
14
+ from . import import_cache
15
+
16
+ __version__ = "0.3.1"