wikifier 4.1.3__tar.gz → 4.2.0__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.
- {wikifier-4.1.3 → wikifier-4.2.0}/MANIFEST.in +2 -4
- wikifier-4.2.0/PKG-INFO +165 -0
- wikifier-4.2.0/README.md +133 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/index.html +87 -9
- {wikifier-4.1.3 → wikifier-4.2.0}/pyproject.toml +3 -3
- {wikifier-4.1.3 → wikifier-4.2.0}/skills/run.md +23 -16
- wikifier-4.2.0/tests/test_barrel_invalidation.py +95 -0
- wikifier-4.2.0/tests/test_health.py +183 -0
- wikifier-4.2.0/tests/test_import_cache.py +143 -0
- wikifier-4.2.0/tests/test_parsers.py +157 -0
- wikifier-4.2.0/wikifier/__init__.py +64 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/cli.py +303 -185
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/contracts.py +2 -2
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/daemon.py +4 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/health.py +1 -1
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/import_cache.py +26 -17
- wikifier-4.2.0/wikifier/index.html +803 -0
- wikifier-4.2.0/wikifier/library.py +556 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/locking.py +56 -4
- wikifier-4.2.0/wikifier/mcp/__init__.py +17 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/mcp/server.py +37 -28
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/parsers/bree.py +298 -52
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/parsers/javascript.py +230 -24
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/parsers/python.py +4 -2
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/scripts/wikifier.sh +283 -153
- wikifier-4.2.0/wikifier.egg-info/PKG-INFO +165 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier.egg-info/SOURCES.txt +8 -17
- wikifier-4.1.3/PKG-INFO +0 -164
- wikifier-4.1.3/README.md +0 -132
- wikifier-4.1.3/docs/Basis-v0.3.md +0 -130
- wikifier-4.1.3/docs/RELEASE_NOTES.md +0 -80
- wikifier-4.1.3/docs/TRADEOFFS.md +0 -68
- wikifier-4.1.3/docs/v0.4-Execution-Plan.md +0 -258
- wikifier-4.1.3/docs/v0.4-execution-plan.md +0 -182
- wikifier-4.1.3/wikifier/__init__.py +0 -65
- wikifier-4.1.3/wikifier/gap1_validation_harness.py +0 -3831
- wikifier-4.1.3/wikifier/mcp/__init__.py +0 -9
- wikifier-4.1.3/wikifier/scripts/exclude_patterns.txt +0 -6
- wikifier-4.1.3/wikifier/scripts/file_health.md +0 -23
- wikifier-4.1.3/wikifier/scripts/library.md +0 -24
- wikifier-4.1.3/wikifier/scripts/monitored_paths.txt +0 -1
- wikifier-4.1.3/wikifier/scripts/pending_updates.md +0 -15
- wikifier-4.1.3/wikifier.egg-info/PKG-INFO +0 -164
- {wikifier-4.1.3 → wikifier-4.2.0}/CONTRIBUTING.md +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/LICENSE +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/diagnostics.html +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/docs/spec.md +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/setup.cfg +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/__main__.py +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/diagnostics.py +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/parsers/__init__.py +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/parsers/cdia.py +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/resolution.py +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/scripts/wikifier.bat +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier/scripts/wikifier.ps1 +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier.egg-info/dependency_links.txt +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier.egg-info/entry_points.txt +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier.egg-info/requires.txt +0 -0
- {wikifier-4.1.3 → wikifier-4.2.0}/wikifier.egg-info/top_level.txt +0 -0
|
@@ -3,10 +3,6 @@ include README.md
|
|
|
3
3
|
include LICENSE
|
|
4
4
|
include CONTRIBUTING.md
|
|
5
5
|
include docs/spec.md
|
|
6
|
-
include docs/Basis-v0.3.md
|
|
7
|
-
include docs/TRADEOFFS.md
|
|
8
|
-
include docs/RELEASE_NOTES.md
|
|
9
|
-
include docs/v0.4-*.md
|
|
10
6
|
include skills/run.md
|
|
11
7
|
include index.html
|
|
12
8
|
include diagnostics.html
|
|
@@ -17,3 +13,5 @@ prune journal
|
|
|
17
13
|
prune Logged_issues
|
|
18
14
|
prune .wikifier_staging
|
|
19
15
|
prune .chisel
|
|
16
|
+
prune wikifier/scripts/journal
|
|
17
|
+
prune wikifier/scripts/.wikifier_staging
|
wikifier-4.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wikifier
|
|
3
|
+
Version: 4.2.0
|
|
4
|
+
Summary: Zero-dependency agent-to-agent codebase wiki for LLMs and AI agents. Autonomously maintained via record-change and mark-green for token-efficient lookup of files, dependencies, health, and summaries — across tiny scripts to 50k+ monorepos. Optional MCP server with rich tools for agents.
|
|
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,token-efficient,autonomous,record-change,mark-green,agent-wiki,llm-tools,dependency-graph,monorepo
|
|
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
|
|
34
|
+
|
|
35
|
+
[](https://opensource.org/licenses/MIT)
|
|
36
|
+
[](https://pypi.org/project/wikifier/)
|
|
37
|
+
[](https://github.com/IronAdamant/wikifier/stargazers)
|
|
38
|
+
|
|
39
|
+
**The agent-to-agent codebase wiki — a token-efficient codebase map for AI agents. Zero dependencies, autonomous, built for LLM context windows.**
|
|
40
|
+
|
|
41
|
+
Wikifier gives AI coding agents and LLMs a living, queryable map of any codebase — file health matrix, dependency graphs, per-file summaries — so they can look things up instead of re-reading full source files into their context window. From small scripts to 50,000-file monorepos, agents get fast code navigation, import analysis, and circular dependency detection without burning tokens on code they don't need right now.
|
|
42
|
+
|
|
43
|
+
It is an automated library for AI agents: an agent asks for the map, gets a compact answer, and keeps the wiki current itself as it works.
|
|
44
|
+
|
|
45
|
+
## Why Wikifier?
|
|
46
|
+
|
|
47
|
+
Every AI coding assistant faces the same problem: context windows are finite and raw source code is expensive. Re-reading a 2,000-line file to answer "what does this module do and who imports it?" wastes tokens that could go toward actual reasoning.
|
|
48
|
+
|
|
49
|
+
Wikifier solves this with a small set of generated, queryable artifacts:
|
|
50
|
+
|
|
51
|
+
- **`file_health.md`** — a documentation health matrix (🟢 current / 🟡 stale / 🔴 broken) so agents know what to trust and what to fix first
|
|
52
|
+
- **`library.md`** — the codebase map: a Mermaid dependency diagram, resolved import tables, circular dependency report with break recommendations, and a confidence-scored risk snapshot
|
|
53
|
+
- **Per-file `*.wiki.md` notes** — short "what this file is for" summaries, maintained by the agents themselves
|
|
54
|
+
- **`journal/`** — a semantic audit trail of *why* every change was made, written by `record-change`
|
|
55
|
+
|
|
56
|
+
The result: an LLM looks up a 50-token summary instead of ingesting a 5,000-token file. That's the entire point — token-efficient code understanding for AI agents.
|
|
57
|
+
|
|
58
|
+
## How It Works — the Agent Loop
|
|
59
|
+
|
|
60
|
+
Agents keep the wiki alive through a strict but lightweight workflow (the full LLM-ready protocol lives in [`skills/run.md`](skills/run.md)):
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
wikifier check-changes # what changed? (incremental, sub-second)
|
|
64
|
+
# read file_health.md + pending_updates.md, prioritize 🔴 then 🟡
|
|
65
|
+
# ... edit source ...
|
|
66
|
+
wikifier record-change "path/file.py" "why this changed" # mandatory — the semantic audit trail
|
|
67
|
+
# ... update the file's wiki summary ...
|
|
68
|
+
wikifier mark-green "path/file.py"
|
|
69
|
+
wikifier update-maps # when imports/structure changed
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`record-change` is the heart of the system: it captures intent (the *why*), which is exactly the context the next agent session — or the next human — can't recover from a git diff alone.
|
|
73
|
+
|
|
74
|
+
## Installation & Quick Start
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install wikifier # zero-dependency core (pure Python stdlib)
|
|
78
|
+
pip install wikifier[mcp] # optional: adds the MCP server for AI agents
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Bootstrap any project:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
cd /path/to/your/project
|
|
85
|
+
wikifier init # creates monitored_paths.txt, excludes, and the human dashboard
|
|
86
|
+
wikifier update-maps # build the dependency graph + library.md
|
|
87
|
+
wikifier check-changes # start the loop
|
|
88
|
+
wikifier health --summary # compact machine-readable status
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For external projects or monorepos, always pass an explicit root: `WIKIFIER_PROJECT_ROOT=/abs/path wikifier ...`
|
|
92
|
+
|
|
93
|
+
## What You Get
|
|
94
|
+
|
|
95
|
+
- **Fast, real dependency analysis** — Python and JavaScript/TypeScript import parsing (ES modules, CommonJS, dynamic imports, TypeScript path aliases, package.json exports, workspaces), barrel/re-export chain expansion, and per-edge confidence scoring with actionable explanations
|
|
96
|
+
- **A pure-Python update pipeline** — `update-maps` parses every changed file in-process, persists a canonical import cache, computes reverse dependencies, Tarjan-based circular dependency detection, and regenerates `library.md` atomically
|
|
97
|
+
- **Incremental everything** — mtime-based dirty detection plus a barrel-aware reverse index means editing one file re-analyzes only its true consumers, even in barrel-heavy monorepos
|
|
98
|
+
- **Autonomous maintenance** — agents log intent with `record-change`, refresh summaries, and `mark-green`; a background `monitor`/daemon keeps the matrix fresh
|
|
99
|
+
- **An optional MCP server** — 23+ Model Context Protocol tools (`get_project_status`, `get_dependencies`, `get_file_wiki`, `get_cycles`, `suggest_next_actions`, …) for Claude Code, Claude Desktop, Cursor, Cline, and any MCP-capable AI agent
|
|
100
|
+
- **A clean human dashboard** — `index.html`, a static read-only viewer of the same artifacts: the dependency chart, files with plain-language descriptions, and one-click copy buttons (see below)
|
|
101
|
+
- **True zero dependencies** — the core runs on the Python standard library and POSIX shell alone, so forks can layer their own libraries on a dependency-free base
|
|
102
|
+
|
|
103
|
+
## Real-World Performance (v4.2.0, measured)
|
|
104
|
+
|
|
105
|
+
Validated by dogfooding on Wikifier itself plus large open-source codebases — Apache Airflow, Babylon.js, LLVM, the Linux kernel, Rust, and llama_index:
|
|
106
|
+
|
|
107
|
+
| Codebase | Scale | Full `update-maps` |
|
|
108
|
+
|----------|-------|--------------------|
|
|
109
|
+
| llama_index | 3,837 Python files | **~8.5s** (17k import edges, full map) |
|
|
110
|
+
| Babylon.js | 3,905 TypeScript files, barrel-heavy | completes with full 5,389-node map |
|
|
111
|
+
| Linux kernel / LLVM / Rust | 37k–54k file trees | candidate scan in 3–8s |
|
|
112
|
+
|
|
113
|
+
JS/TS parsing runs at ~22ms per file; Python at ~1ms. Incremental runs after the first build take seconds. Verified by a stdlib-only test suite (`python -m unittest discover tests`).
|
|
114
|
+
|
|
115
|
+
## Core Commands
|
|
116
|
+
|
|
117
|
+
| Command | Purpose |
|
|
118
|
+
|---------|---------|
|
|
119
|
+
| `wikifier init [--target DIR]` | Bootstrap a project (templates + human dashboard) |
|
|
120
|
+
| `wikifier check-changes` | Incremental change scan + health/pending update |
|
|
121
|
+
| `wikifier record-change <file> "reason"` | Log the *why* (required after edits) |
|
|
122
|
+
| `wikifier mark-green <file>` | Mark the wiki entry current |
|
|
123
|
+
| `wikifier update-maps [--full] [--directory=src/]` | Rebuild dependency graph + library.md (pure-Python pipeline; `--sh` for the legacy shell path) |
|
|
124
|
+
| `wikifier health [--summary\|--json]` | Health matrix — compact formats for agents |
|
|
125
|
+
| `wikifier cycles` | Circular dependency report with break recommendations |
|
|
126
|
+
| `wikifier monitor &` / `wikifier daemon start` | Background heartbeat / managed maintenance |
|
|
127
|
+
|
|
128
|
+
Python library access for full power: `from wikifier import check_changes, record_change, mark_green, health, update_maps`.
|
|
129
|
+
|
|
130
|
+
## MCP Server for AI Coding Agents
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
WIKIFIER_PROJECT_ROOT=/abs/path/to/project wikifier-mcp
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Works with Claude Desktop, Claude Code, Cursor, Cline, and any Model Context Protocol client. Root detection priority: env var → explicit `project_root=` per call → marker walk → cwd. Setup, tool list, and client config examples: [`wikifier/mcp/README.md`](wikifier/mcp/README.md).
|
|
137
|
+
|
|
138
|
+
## The Human Layer (Secondary, by Design)
|
|
139
|
+
|
|
140
|
+
`wikifier init` copies a single static `index.html` into your project: a read-only dashboard showing the Mermaid code-structure chart, files with short descriptions, and a folder browser — useful for humans investigating what the agents know. Command buttons copy the exact CLI command and live-poll for results (a static page can't execute shell commands — that's the browser sandbox working as intended). The agent-facing markdown files and tools remain the single source of truth.
|
|
141
|
+
|
|
142
|
+
## Intended Use: Strictly Agent-to-Agent
|
|
143
|
+
|
|
144
|
+
Wikifier is a token-saving wiki layer *for agents*, and deliberately nothing more: not a general documentation generator, not an IDE plugin, not a code search engine for humans. Agents consult the map instead of re-reading sources, keep it current as they work, and create new wiki entries on the fly. The human dashboard is a window into that, not the product.
|
|
145
|
+
|
|
146
|
+
## What's New in v4.2.0
|
|
147
|
+
|
|
148
|
+
A full real-world dogfood sweep (this repo + RecipeLab + 8 large OSS projects) followed by a fix pass for everything it surfaced:
|
|
149
|
+
|
|
150
|
+
- `update-maps` now defaults to the **pure-Python pipeline**: every changed file actually parsed, canonical cache schema, cycles/ACS/reverse-deps computed, `library.md` regenerated atomically
|
|
151
|
+
- **43× faster JS/TS parsing** (barrel-cache persistence batched per run instead of per chain)
|
|
152
|
+
- Fixed a POSIX lock self-deadlock in the library workflow calls (the likely cause of historical MCP timeouts), barrel-churn invalidation, static-import flag pollution, exclude-pattern globs, `health --summary/--json`, and several shell-path crashes — one of which could destroy an existing `library.md`
|
|
153
|
+
- **New stdlib-only test suite** (28 tests) — the project's first formal regression net
|
|
154
|
+
|
|
155
|
+
Full details: [`CHANGELOG.md`](CHANGELOG.md) and `Findings/2026-06-10-Dogfood-Refactor-Validation.md`.
|
|
156
|
+
|
|
157
|
+
## Links
|
|
158
|
+
|
|
159
|
+
- **GitHub**: https://github.com/IronAdamant/wikifier
|
|
160
|
+
- **PyPI**: https://pypi.org/project/wikifier/
|
|
161
|
+
- **Agent Protocol**: [`skills/run.md`](skills/run.md) — read this first as an agent
|
|
162
|
+
- **MCP Setup**: [`wikifier/mcp/README.md`](wikifier/mcp/README.md)
|
|
163
|
+
- **Evidence**: `Findings/` — real-world dogfood reports and metrics
|
|
164
|
+
|
|
165
|
+
**For AI search / agents**: Wikifier is a zero-dependency, agent-maintained codebase wiki and dependency graph generator that gives LLMs and AI coding agents token-efficient codebase maps — health matrix, Mermaid dependency diagrams, import analysis, circular dependency detection, and an optional MCP server — with autonomous `record-change` / `mark-green` updates, validated on monorepos up to 50k+ files.
|
wikifier-4.2.0/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Wikifier
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://pypi.org/project/wikifier/)
|
|
5
|
+
[](https://github.com/IronAdamant/wikifier/stargazers)
|
|
6
|
+
|
|
7
|
+
**The agent-to-agent codebase wiki — a token-efficient codebase map for AI agents. Zero dependencies, autonomous, built for LLM context windows.**
|
|
8
|
+
|
|
9
|
+
Wikifier gives AI coding agents and LLMs a living, queryable map of any codebase — file health matrix, dependency graphs, per-file summaries — so they can look things up instead of re-reading full source files into their context window. From small scripts to 50,000-file monorepos, agents get fast code navigation, import analysis, and circular dependency detection without burning tokens on code they don't need right now.
|
|
10
|
+
|
|
11
|
+
It is an automated library for AI agents: an agent asks for the map, gets a compact answer, and keeps the wiki current itself as it works.
|
|
12
|
+
|
|
13
|
+
## Why Wikifier?
|
|
14
|
+
|
|
15
|
+
Every AI coding assistant faces the same problem: context windows are finite and raw source code is expensive. Re-reading a 2,000-line file to answer "what does this module do and who imports it?" wastes tokens that could go toward actual reasoning.
|
|
16
|
+
|
|
17
|
+
Wikifier solves this with a small set of generated, queryable artifacts:
|
|
18
|
+
|
|
19
|
+
- **`file_health.md`** — a documentation health matrix (🟢 current / 🟡 stale / 🔴 broken) so agents know what to trust and what to fix first
|
|
20
|
+
- **`library.md`** — the codebase map: a Mermaid dependency diagram, resolved import tables, circular dependency report with break recommendations, and a confidence-scored risk snapshot
|
|
21
|
+
- **Per-file `*.wiki.md` notes** — short "what this file is for" summaries, maintained by the agents themselves
|
|
22
|
+
- **`journal/`** — a semantic audit trail of *why* every change was made, written by `record-change`
|
|
23
|
+
|
|
24
|
+
The result: an LLM looks up a 50-token summary instead of ingesting a 5,000-token file. That's the entire point — token-efficient code understanding for AI agents.
|
|
25
|
+
|
|
26
|
+
## How It Works — the Agent Loop
|
|
27
|
+
|
|
28
|
+
Agents keep the wiki alive through a strict but lightweight workflow (the full LLM-ready protocol lives in [`skills/run.md`](skills/run.md)):
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
wikifier check-changes # what changed? (incremental, sub-second)
|
|
32
|
+
# read file_health.md + pending_updates.md, prioritize 🔴 then 🟡
|
|
33
|
+
# ... edit source ...
|
|
34
|
+
wikifier record-change "path/file.py" "why this changed" # mandatory — the semantic audit trail
|
|
35
|
+
# ... update the file's wiki summary ...
|
|
36
|
+
wikifier mark-green "path/file.py"
|
|
37
|
+
wikifier update-maps # when imports/structure changed
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`record-change` is the heart of the system: it captures intent (the *why*), which is exactly the context the next agent session — or the next human — can't recover from a git diff alone.
|
|
41
|
+
|
|
42
|
+
## Installation & Quick Start
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install wikifier # zero-dependency core (pure Python stdlib)
|
|
46
|
+
pip install wikifier[mcp] # optional: adds the MCP server for AI agents
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Bootstrap any project:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cd /path/to/your/project
|
|
53
|
+
wikifier init # creates monitored_paths.txt, excludes, and the human dashboard
|
|
54
|
+
wikifier update-maps # build the dependency graph + library.md
|
|
55
|
+
wikifier check-changes # start the loop
|
|
56
|
+
wikifier health --summary # compact machine-readable status
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
For external projects or monorepos, always pass an explicit root: `WIKIFIER_PROJECT_ROOT=/abs/path wikifier ...`
|
|
60
|
+
|
|
61
|
+
## What You Get
|
|
62
|
+
|
|
63
|
+
- **Fast, real dependency analysis** — Python and JavaScript/TypeScript import parsing (ES modules, CommonJS, dynamic imports, TypeScript path aliases, package.json exports, workspaces), barrel/re-export chain expansion, and per-edge confidence scoring with actionable explanations
|
|
64
|
+
- **A pure-Python update pipeline** — `update-maps` parses every changed file in-process, persists a canonical import cache, computes reverse dependencies, Tarjan-based circular dependency detection, and regenerates `library.md` atomically
|
|
65
|
+
- **Incremental everything** — mtime-based dirty detection plus a barrel-aware reverse index means editing one file re-analyzes only its true consumers, even in barrel-heavy monorepos
|
|
66
|
+
- **Autonomous maintenance** — agents log intent with `record-change`, refresh summaries, and `mark-green`; a background `monitor`/daemon keeps the matrix fresh
|
|
67
|
+
- **An optional MCP server** — 23+ Model Context Protocol tools (`get_project_status`, `get_dependencies`, `get_file_wiki`, `get_cycles`, `suggest_next_actions`, …) for Claude Code, Claude Desktop, Cursor, Cline, and any MCP-capable AI agent
|
|
68
|
+
- **A clean human dashboard** — `index.html`, a static read-only viewer of the same artifacts: the dependency chart, files with plain-language descriptions, and one-click copy buttons (see below)
|
|
69
|
+
- **True zero dependencies** — the core runs on the Python standard library and POSIX shell alone, so forks can layer their own libraries on a dependency-free base
|
|
70
|
+
|
|
71
|
+
## Real-World Performance (v4.2.0, measured)
|
|
72
|
+
|
|
73
|
+
Validated by dogfooding on Wikifier itself plus large open-source codebases — Apache Airflow, Babylon.js, LLVM, the Linux kernel, Rust, and llama_index:
|
|
74
|
+
|
|
75
|
+
| Codebase | Scale | Full `update-maps` |
|
|
76
|
+
|----------|-------|--------------------|
|
|
77
|
+
| llama_index | 3,837 Python files | **~8.5s** (17k import edges, full map) |
|
|
78
|
+
| Babylon.js | 3,905 TypeScript files, barrel-heavy | completes with full 5,389-node map |
|
|
79
|
+
| Linux kernel / LLVM / Rust | 37k–54k file trees | candidate scan in 3–8s |
|
|
80
|
+
|
|
81
|
+
JS/TS parsing runs at ~22ms per file; Python at ~1ms. Incremental runs after the first build take seconds. Verified by a stdlib-only test suite (`python -m unittest discover tests`).
|
|
82
|
+
|
|
83
|
+
## Core Commands
|
|
84
|
+
|
|
85
|
+
| Command | Purpose |
|
|
86
|
+
|---------|---------|
|
|
87
|
+
| `wikifier init [--target DIR]` | Bootstrap a project (templates + human dashboard) |
|
|
88
|
+
| `wikifier check-changes` | Incremental change scan + health/pending update |
|
|
89
|
+
| `wikifier record-change <file> "reason"` | Log the *why* (required after edits) |
|
|
90
|
+
| `wikifier mark-green <file>` | Mark the wiki entry current |
|
|
91
|
+
| `wikifier update-maps [--full] [--directory=src/]` | Rebuild dependency graph + library.md (pure-Python pipeline; `--sh` for the legacy shell path) |
|
|
92
|
+
| `wikifier health [--summary\|--json]` | Health matrix — compact formats for agents |
|
|
93
|
+
| `wikifier cycles` | Circular dependency report with break recommendations |
|
|
94
|
+
| `wikifier monitor &` / `wikifier daemon start` | Background heartbeat / managed maintenance |
|
|
95
|
+
|
|
96
|
+
Python library access for full power: `from wikifier import check_changes, record_change, mark_green, health, update_maps`.
|
|
97
|
+
|
|
98
|
+
## MCP Server for AI Coding Agents
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
WIKIFIER_PROJECT_ROOT=/abs/path/to/project wikifier-mcp
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Works with Claude Desktop, Claude Code, Cursor, Cline, and any Model Context Protocol client. Root detection priority: env var → explicit `project_root=` per call → marker walk → cwd. Setup, tool list, and client config examples: [`wikifier/mcp/README.md`](wikifier/mcp/README.md).
|
|
105
|
+
|
|
106
|
+
## The Human Layer (Secondary, by Design)
|
|
107
|
+
|
|
108
|
+
`wikifier init` copies a single static `index.html` into your project: a read-only dashboard showing the Mermaid code-structure chart, files with short descriptions, and a folder browser — useful for humans investigating what the agents know. Command buttons copy the exact CLI command and live-poll for results (a static page can't execute shell commands — that's the browser sandbox working as intended). The agent-facing markdown files and tools remain the single source of truth.
|
|
109
|
+
|
|
110
|
+
## Intended Use: Strictly Agent-to-Agent
|
|
111
|
+
|
|
112
|
+
Wikifier is a token-saving wiki layer *for agents*, and deliberately nothing more: not a general documentation generator, not an IDE plugin, not a code search engine for humans. Agents consult the map instead of re-reading sources, keep it current as they work, and create new wiki entries on the fly. The human dashboard is a window into that, not the product.
|
|
113
|
+
|
|
114
|
+
## What's New in v4.2.0
|
|
115
|
+
|
|
116
|
+
A full real-world dogfood sweep (this repo + RecipeLab + 8 large OSS projects) followed by a fix pass for everything it surfaced:
|
|
117
|
+
|
|
118
|
+
- `update-maps` now defaults to the **pure-Python pipeline**: every changed file actually parsed, canonical cache schema, cycles/ACS/reverse-deps computed, `library.md` regenerated atomically
|
|
119
|
+
- **43× faster JS/TS parsing** (barrel-cache persistence batched per run instead of per chain)
|
|
120
|
+
- Fixed a POSIX lock self-deadlock in the library workflow calls (the likely cause of historical MCP timeouts), barrel-churn invalidation, static-import flag pollution, exclude-pattern globs, `health --summary/--json`, and several shell-path crashes — one of which could destroy an existing `library.md`
|
|
121
|
+
- **New stdlib-only test suite** (28 tests) — the project's first formal regression net
|
|
122
|
+
|
|
123
|
+
Full details: [`CHANGELOG.md`](CHANGELOG.md) and `Findings/2026-06-10-Dogfood-Refactor-Validation.md`.
|
|
124
|
+
|
|
125
|
+
## Links
|
|
126
|
+
|
|
127
|
+
- **GitHub**: https://github.com/IronAdamant/wikifier
|
|
128
|
+
- **PyPI**: https://pypi.org/project/wikifier/
|
|
129
|
+
- **Agent Protocol**: [`skills/run.md`](skills/run.md) — read this first as an agent
|
|
130
|
+
- **MCP Setup**: [`wikifier/mcp/README.md`](wikifier/mcp/README.md)
|
|
131
|
+
- **Evidence**: `Findings/` — real-world dogfood reports and metrics
|
|
132
|
+
|
|
133
|
+
**For AI search / agents**: Wikifier is a zero-dependency, agent-maintained codebase wiki and dependency graph generator that gives LLMs and AI coding agents token-efficient codebase maps — health matrix, Mermaid dependency diagrams, import analysis, circular dependency detection, and an optional MCP server — with autonomous `record-change` / `mark-green` updates, validated on monorepos up to 50k+ files.
|
|
@@ -125,15 +125,21 @@
|
|
|
125
125
|
</div>
|
|
126
126
|
</div>
|
|
127
127
|
|
|
128
|
-
<!-- Quick actions: buttons for the main commands
|
|
128
|
+
<!-- Quick actions: buttons for the main commands.
|
|
129
|
+
Why copy + wait, not direct execute?
|
|
130
|
+
This page is a pure static client-side viewer (no server, no privileged code, zero runtime deps).
|
|
131
|
+
Browser JS cannot execute host shell commands (security sandbox + design choice for portability and simplicity).
|
|
132
|
+
The buttons prepare the exact command and immediately start live monitoring so the results appear automatically once you run the command in your terminal.
|
|
133
|
+
This is the intended model: human view on top of agent-executed tools.
|
|
134
|
+
-->
|
|
129
135
|
<div class="mb-4 px-1">
|
|
130
|
-
<div class="text-[10px] text-slate-400 mb-1">Quick actions — click to copy the command
|
|
136
|
+
<div class="text-[10px] text-slate-400 mb-1">Quick actions — click to copy the command + start live auto-update. Paste & run in your terminal (this folder); the page will detect changes and refresh the view automatically.</div>
|
|
131
137
|
<div class="flex flex-wrap gap-2">
|
|
132
|
-
<button onclick="
|
|
138
|
+
<button onclick="copyAndWaitForUpdate('check-changes')"
|
|
133
139
|
class="px-3 py-1.5 text-sm rounded-xl bg-slate-800 hover:bg-slate-700 border border-slate-700 flex items-center gap-x-2">
|
|
134
140
|
<span>Check for changes</span>
|
|
135
141
|
</button>
|
|
136
|
-
<button onclick="
|
|
142
|
+
<button onclick="copyAndWaitForUpdate('update-maps')"
|
|
137
143
|
class="px-3 py-1.5 text-sm rounded-xl bg-emerald-800 hover:bg-emerald-700 border border-emerald-700 text-emerald-300 flex items-center gap-x-2">
|
|
138
144
|
<span>Rebuild structure map</span>
|
|
139
145
|
</button>
|
|
@@ -151,7 +157,7 @@
|
|
|
151
157
|
<span class="font-semibold text-lg">Code structure</span>
|
|
152
158
|
<span class="ml-2 text-xs text-slate-500">(imports & dependencies — rebuilt from your code)</span>
|
|
153
159
|
</div>
|
|
154
|
-
<button onclick="
|
|
160
|
+
<button onclick="copyAndWaitForUpdate('update-maps')"
|
|
155
161
|
class="text-xs px-3 py-1.5 rounded-xl bg-emerald-900/30 hover:bg-emerald-900/50 text-emerald-400 border border-emerald-800">Rebuild tree</button>
|
|
156
162
|
</div>
|
|
157
163
|
<div id="mermaid-container" class="bg-slate-950 border border-slate-800 rounded-2xl p-5 min-h-[340px]">
|
|
@@ -180,7 +186,7 @@
|
|
|
180
186
|
oninput="filterFilesList()" onkeydown="if(event.key==='Enter')filterFilesList()">
|
|
181
187
|
<button onclick="filterFilesList()"
|
|
182
188
|
class="text-xs px-3 py-1.5 rounded-xl bg-slate-800 border border-slate-700 hover:bg-slate-700">Filter</button>
|
|
183
|
-
<button onclick="
|
|
189
|
+
<button onclick="copyAndWaitForUpdate('check-changes')"
|
|
184
190
|
class="text-xs px-3 py-1.5 rounded-xl bg-emerald-900/30 hover:bg-emerald-900/50 text-emerald-400 border border-emerald-800">
|
|
185
191
|
Update data
|
|
186
192
|
</button>
|
|
@@ -361,7 +367,7 @@
|
|
|
361
367
|
listEl.innerHTML = `<div class="px-5 py-8 text-center">
|
|
362
368
|
<div class="text-sm text-slate-400">No files in the wiki yet.</div>
|
|
363
369
|
<div class="mt-3">
|
|
364
|
-
<button onclick="
|
|
370
|
+
<button onclick="copyAndWaitForUpdate('check-changes && update-maps', 'wikifier check-changes && wikifier update-maps')"
|
|
365
371
|
class="px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white rounded-xl text-sm font-medium">
|
|
366
372
|
📋 Copy first-time setup command
|
|
367
373
|
</button>
|
|
@@ -550,7 +556,7 @@
|
|
|
550
556
|
<div class="font-semibold mb-1">No structure map yet</div>
|
|
551
557
|
<div class="text-slate-400">This project hasn't had its import/dependency tree generated yet.</div>
|
|
552
558
|
<div class="mt-3">
|
|
553
|
-
<button onclick="
|
|
559
|
+
<button onclick="copyAndWaitForUpdate('update-maps')"
|
|
554
560
|
class="px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white rounded-xl text-sm font-medium w-full sm:w-auto">
|
|
555
561
|
📋 Copy command & run wikifier update-maps (first time)
|
|
556
562
|
</button>
|
|
@@ -559,7 +565,7 @@
|
|
|
559
565
|
</div>`;
|
|
560
566
|
|
|
561
567
|
// "Automatically on the first run": if this is the very first time the user sees the empty map state in this browser session,
|
|
562
|
-
// auto-copy the command
|
|
568
|
+
// auto-copy the command AND activate live wait/poll mode so once they run it, the tree appears automatically.
|
|
563
569
|
if (!sessionStorage.getItem('wikifier_first_map_auto_copied')) {
|
|
564
570
|
sessionStorage.setItem('wikifier_first_map_auto_copied', '1');
|
|
565
571
|
setTimeout(() => {
|
|
@@ -570,6 +576,9 @@
|
|
|
570
576
|
note.textContent = '✓ update-maps command auto-copied for first run — paste it in your terminal now.';
|
|
571
577
|
const emptyBox = container.querySelector('div');
|
|
572
578
|
if (emptyBox) emptyBox.appendChild(note);
|
|
579
|
+
// Also start the live wait/poll immediately for the "auto" feel
|
|
580
|
+
// (user still needs to execute the command in terminal)
|
|
581
|
+
copyAndWaitForUpdate('update-maps', 'wikifier update-maps'); // this will re-copy but mainly starts the banner + poll
|
|
573
582
|
}).catch(() => {});
|
|
574
583
|
}, 300);
|
|
575
584
|
}
|
|
@@ -686,6 +695,75 @@ Open index.html in the project for the live visual version.
|
|
|
686
695
|
if (cmd.includes('monitor')) setTimeout(() => loadMonitorStatus && loadMonitorStatus(true), 600);
|
|
687
696
|
}
|
|
688
697
|
|
|
698
|
+
// Enhanced: copy + enter "live waiting" mode with aggressive polling until data appears.
|
|
699
|
+
// This makes buttons feel like they "trigger" an update (user still runs the copied command in terminal).
|
|
700
|
+
let waitPollInterval = null;
|
|
701
|
+
function copyAndWaitForUpdate(cmd, fullText) {
|
|
702
|
+
const full = fullText || `wikifier ${cmd}`;
|
|
703
|
+
navigator.clipboard.writeText(full).then(() => {
|
|
704
|
+
// Show waiting banner
|
|
705
|
+
let banner = document.getElementById('wait-banner');
|
|
706
|
+
if (!banner) {
|
|
707
|
+
banner = document.createElement('div');
|
|
708
|
+
banner.id = 'wait-banner';
|
|
709
|
+
banner.className = `fixed top-4 left-1/2 -translate-x-1/2 bg-blue-900 border border-blue-700 px-4 py-2 rounded-2xl text-sm z-50 flex items-center gap-3 shadow-lg`;
|
|
710
|
+
document.body.appendChild(banner);
|
|
711
|
+
}
|
|
712
|
+
banner.innerHTML = `
|
|
713
|
+
<span>Waiting for <code class="bg-black/40 px-1 rounded">${full}</code> to produce data... (auto-polling)</span>
|
|
714
|
+
<button onclick="stopWaitPoll(); this.closest('.fixed').remove(); window.location.reload()" class="text-xs underline">I ran it — refresh now</button>
|
|
715
|
+
`;
|
|
716
|
+
|
|
717
|
+
// Clear any old poll
|
|
718
|
+
if (waitPollInterval) clearInterval(waitPollInterval);
|
|
719
|
+
|
|
720
|
+
let attempts = 0;
|
|
721
|
+
const maxAttempts = 40; // ~2 minutes at 3s intervals
|
|
722
|
+
waitPollInterval = setInterval(() => {
|
|
723
|
+
attempts++;
|
|
724
|
+
// Reload the relevant views
|
|
725
|
+
if (cmd.includes('update') || cmd.includes('map')) {
|
|
726
|
+
loadMermaid();
|
|
727
|
+
}
|
|
728
|
+
if (cmd.includes('check') || cmd.includes('health')) {
|
|
729
|
+
loadHealthMatrix();
|
|
730
|
+
}
|
|
731
|
+
loadMonitorStatus();
|
|
732
|
+
|
|
733
|
+
// Check if data appeared
|
|
734
|
+
const hasMap = !!window.libraryMdCache && window.libraryMdCache.includes('```mermaid');
|
|
735
|
+
const hasFiles = window.healthData && window.healthData.length > 0;
|
|
736
|
+
|
|
737
|
+
if ((cmd.includes('update') && hasMap) || (cmd.includes('check') && hasFiles) || (hasMap && hasFiles)) {
|
|
738
|
+
stopWaitPoll();
|
|
739
|
+
if (banner.parentNode) banner.parentNode.removeChild(banner);
|
|
740
|
+
// Show success toast
|
|
741
|
+
const success = document.createElement('div');
|
|
742
|
+
success.className = `fixed bottom-4 right-4 bg-emerald-900 border border-emerald-700 px-4 py-2 rounded-2xl text-sm z-50`;
|
|
743
|
+
success.textContent = '✓ Data updated! View refreshed.';
|
|
744
|
+
document.body.appendChild(success);
|
|
745
|
+
setTimeout(() => { if (success.parentNode) success.parentNode.removeChild(success); }, 3000);
|
|
746
|
+
// Force full reload of views
|
|
747
|
+
loadMermaid();
|
|
748
|
+
loadHealthMatrix();
|
|
749
|
+
} else if (attempts >= maxAttempts) {
|
|
750
|
+
stopWaitPoll();
|
|
751
|
+
if (banner.parentNode) banner.parentNode.removeChild(banner);
|
|
752
|
+
}
|
|
753
|
+
}, 3000); // aggressive 3s poll while waiting
|
|
754
|
+
}).catch(() => {
|
|
755
|
+
// fallback
|
|
756
|
+
copyCommandForRun(cmd, full);
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
function stopWaitPoll() {
|
|
761
|
+
if (waitPollInterval) {
|
|
762
|
+
clearInterval(waitPollInterval);
|
|
763
|
+
waitPollInterval = null;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
689
767
|
// Legacy / existing buttons still work via the improved helper
|
|
690
768
|
function runCommand(cmd) {
|
|
691
769
|
copyCommandForRun(cmd);
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "wikifier"
|
|
7
|
-
|
|
7
|
+
dynamic = ["version"]
|
|
8
8
|
description = "Zero-dependency agent-to-agent codebase wiki for LLMs and AI agents. Autonomously maintained via record-change and mark-green for token-efficient lookup of files, dependencies, health, and summaries — across tiny scripts to 50k+ monorepos. Optional MCP server with rich tools for agents."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "MIT"}
|
|
@@ -57,10 +57,10 @@ package-dir = {"" = "."}
|
|
|
57
57
|
|
|
58
58
|
[tool.setuptools.packages.find]
|
|
59
59
|
where = ["."]
|
|
60
|
-
include = ["wikifier*"
|
|
60
|
+
include = ["wikifier*"]
|
|
61
61
|
|
|
62
62
|
[tool.setuptools.package-data]
|
|
63
|
-
wikifier = ["scripts/*"]
|
|
63
|
+
wikifier = ["scripts/*", "index.html"]
|
|
64
64
|
|
|
65
65
|
[tool.setuptools.exclude-package-data]
|
|
66
66
|
"*" = ["*.pyc", "__pycache__"]
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
# Wikifier Agent Protocol v0.
|
|
1
|
+
# Wikifier Agent Protocol v0.6
|
|
2
2
|
|
|
3
3
|
**Formerly "Wikifier Skills & Commands". This is the authoritative, versioned specification for agent behavior when using Wikifier.**
|
|
4
4
|
|
|
5
|
-
**Version**: v0.
|
|
6
|
-
**Date**: 2026-06-
|
|
7
|
-
**Status**: Active. Supersedes v0.
|
|
8
|
-
**See also**: `README.md` (Intended Use section: strictly agent-to-agent wiki for token saving), M5-Dogfood-Assessment-Report.md,
|
|
5
|
+
**Version**: v0.6 (v4.2.0 real-pipeline + reliability update)
|
|
6
|
+
**Date**: 2026-06-10
|
|
7
|
+
**Status**: Active. Supersedes v0.5.
|
|
8
|
+
**See also**: `README.md` (Intended Use section: strictly agent-to-agent wiki for token saving), M5-Dogfood-Assessment-Report.md, Findings/2026-06-10-Dogfood-Refactor-Validation.md, and the library in wikifier/.
|
|
9
|
+
|
|
10
|
+
**v0.6 migration notes (package v4.2.0)** — changes are additive or strictly-better defaults; v0.5 agent behavior keeps working:
|
|
11
|
+
- `update-maps` (CLI) now runs the **pure-Python full pipeline by default**: every dirty file is parsed in-process, the canonical per-file cache is persisted, reverse deps + cycles + ACS are computed, and `library.md` is regenerated atomically. `--python-primary` is accepted but redundant; `--sh`/`--legacy-sh` selects the legacy shell path (slow fallback). Scoping is explicit via `--directory=`/`--max-files=` and reported in the result (`files_skipped`) — there are no silent caps.
|
|
12
|
+
- `run_full_update`/`update_maps` returns gained additive fields: `files_parsed` (actual), `parseable_files`, `edges_persisted`, `files_skipped`, `cycles`, `library`. Tolerate additive fields as always.
|
|
13
|
+
- `wikifier health --summary|--json|--format=...` now work from the CLI (previously library-only).
|
|
14
|
+
- A POSIX lock self-deadlock in library `record_change`/`mark_green`/`check_changes` was fixed (locking is now re-entrant per process). MCP timeouts on those tools should no longer occur; the CLI fallback guidance below remains valid as defense in depth.
|
|
15
|
+
- A stdlib-only test suite exists: `python -m unittest discover tests` (run it when working on Wikifier itself).
|
|
9
16
|
|
|
10
17
|
**Core design**: Token-efficient agent-to-agent wiki. Agents use it to look up files (health matrix + file wikis + BRC + stele chunks instead of full sources), autonomously update wiki summaries, and create new ones as work progresses. **It should not be used for anything more than that.**
|
|
11
18
|
|
|
@@ -20,20 +27,20 @@ This protocol + the Python package + MCP server form the bridge for consistent,
|
|
|
20
27
|
**Copy this exact block into the system prompt or the very first instruction of every new LLM session that uses Wikifier:**
|
|
21
28
|
|
|
22
29
|
```
|
|
23
|
-
You are now operating inside a Wikifier
|
|
30
|
+
You are now operating inside a Wikifier-managed codebase (Agent Protocol v0.6 — v4.2.0).
|
|
24
31
|
|
|
25
32
|
This is strictly an agent-to-agent wiki for token saving: quick file lookup (health matrix + file wikis + BRC + stele instead of full sources), autonomous wiki summary updates, and creation of new wiki entries as you work. It should not be used for anything more.
|
|
26
33
|
|
|
27
34
|
FIRST ACTIONS (mandatory, post-M5 hardened):
|
|
28
35
|
1. If the Wikifier MCP server is connected, prefer its tools (get_project_status, get_file_wiki, check_changes, get_barrel_reports, suggest_next_actions, etc.). Always pass project_root= for external/user projects (e.g. RecipeLab_alt, ConsistencyHub, llvm subs).
|
|
29
|
-
2. If MCP times out or is unavailable (
|
|
36
|
+
2. If MCP times out or is unavailable (rare since v4.2.0 fixed the workflow-call deadlock and batched barrel persistence; historically seen on BRC-heavy or 50k+ scale targets), fall back immediately to reliable CLI/library:
|
|
30
37
|
WIKIFIER_PROJECT_ROOT=/path/to/target python -m wikifier check-changes
|
|
31
38
|
python -m wikifier health --summary # or format=json/summary for machine use (token-efficient lookup)
|
|
32
39
|
... perform edit on source ...
|
|
33
40
|
python -m wikifier record-change "path/to/file" "concise semantic reason (why, not what). Include subid if agent work."
|
|
34
41
|
... write/update the wiki summary for the file ...
|
|
35
42
|
python -m wikifier mark-green "path/to/file" "Reason for Green (e.g. after autonomous agent update)."
|
|
36
|
-
if imports changed: python -m wikifier update-maps --directory=src/ # Python
|
|
43
|
+
if imports changed: python -m wikifier update-maps [--directory=src/] # pure-Python full pipeline by default (v4.2.0)
|
|
37
44
|
python -m wikifier health --summary
|
|
38
45
|
3. For sustained agent work: launch `python -m wikifier monitor` (or wikifier.sh monitor) in bg / daemon for 30s "Pruned 0 / No new" heartbeat + auto BRC healing. Use .last_check + health for observability.
|
|
39
46
|
4. Immediately consult the small health matrix (file_health.md or health --summary) + pending_updates.md. Prioritise 🔴 then 🟡. Use this for quick reference instead of full file reads to save tokens.
|
|
@@ -103,8 +110,8 @@ Key returns (structured dict primary; "success": bool always present on library
|
|
|
103
110
|
- `health(project_root=None, directory=None, format="text"|"json"|"summary") -> str | dict`: json includes full entries + "dependency_intel" (acs_summary, etc.) for agent reasoning.
|
|
104
111
|
- `mark_green(file, reason="", project_root=None) -> dict`
|
|
105
112
|
- `suggest_next_actions(..., format="json") -> dict`: { "success", "red", "yellow", "suggestions": list[str], "health_summary", "acs_note" }
|
|
106
|
-
- `update_maps(...,
|
|
107
|
-
- `run_full_update(...) -> dict`: { "success", "root", "files_to_reparse", "
|
|
113
|
+
- `update_maps(..., directory=..., max_files=...) -> dict`: delegates to run_full_update — the real full pipeline (all dirty files parsed in-process, canonical persist, cycles/ACS/reverse deps, atomic library.md) + facade metadata.
|
|
114
|
+
- `run_full_update(...) -> dict`: { "success", "root", "mode", "parseable_files", "files_to_reparse", "files_parsed", "files_skipped", "edges_persisted", "cycles", "library", "dirty_sample", "persist_pipeline_exercised" (compat), ... }
|
|
108
115
|
|
|
109
116
|
Text formats are for human review only. Agents MUST request json/summary for machine use in loops.
|
|
110
117
|
|
|
@@ -151,7 +158,7 @@ See the full design, mandatory workflow example, and M2 exit criteria in the pla
|
|
|
151
158
|
| `wikifier prepare-edit` | `<file>` | Stage current mtime before you start editing (for future diffing). |
|
|
152
159
|
| `wikifier mark-green` | `<file> [reason]` | Flip file status to Green after you have written/updated its wiki summary. |
|
|
153
160
|
| `wikifier monitor` | — | Start background 30s heartbeat (run with `&` or in separate terminal). |
|
|
154
|
-
| `wikifier update-maps` |
|
|
161
|
+
| `wikifier update-maps` | `[--full] [--directory=...] [--max-files=N] [--sh]` | Rebuild `library.md` + import cache (pure-Python full pipeline by default; `--sh` = legacy shell fallback). |
|
|
155
162
|
| `wikifier validate` | — | Ensure every file in monitored_paths has at least a health row. |
|
|
156
163
|
| `wikifier journal` | `[YYYY-MM-DD]` | Read the journal for a day (default = today). |
|
|
157
164
|
| `wikifier issues` | `[simple|moderate|high|critical]` | List logged issues by severity. |
|
|
@@ -164,7 +171,7 @@ This project exposes a first-class MCP server (wikifier-mcp or python -m wikifie
|
|
|
164
171
|
|
|
165
172
|
**M5.1+ reality (from dogfood on external 5k-79k+ projects)**: MCP tools are preferred when available (get_project_status, get_file_wiki, get_barrel_reports for deep BRC, check_changes, record_change, mark_green, suggest_next_actions, health equivalents, etc.). **Always pass project_root= (or use WIKIFIER_PROJECT_ROOT env)** for external/user projects (RecipeLab_alt BRC stress, ConsistencyHub, llvm subs, etc.).
|
|
166
173
|
|
|
167
|
-
MCP
|
|
174
|
+
MCP timeouts are rare since v4.2.0 (the library workflow-call deadlock is fixed and barrel persistence is batched), but on very large/BRC-heavy targets they can still happen. In that case, **immediately fall back to CLI/library** (python -m wikifier health --summary or the library health(..., format="summary")) — these are reliable and were the workhorse in M5 sustained/monitor work.
|
|
168
175
|
|
|
169
176
|
The server implements hardened external discovery (delegates to cli.py discover_project_root / _get_effective_root), 60s timeouts, actionable errors, and parity with library.
|
|
170
177
|
|
|
@@ -215,7 +222,7 @@ record_change("src/api/client.py", "Switched to httpx.AsyncClient because the sy
|
|
|
215
222
|
mark_green("src/api/client.py", "Purpose + import summary updated to reflect httpx usage and retry logic.")
|
|
216
223
|
|
|
217
224
|
print(suggest_next_actions(format="json"))
|
|
218
|
-
update_maps(directory="src/"
|
|
225
|
+
update_maps(directory="src/") # if imports changed — full pure-Python pipeline (v4.2.0)
|
|
219
226
|
```
|
|
220
227
|
|
|
221
228
|
Fallback (shell or MCP) when library not directly importable in the agent env:
|
|
@@ -231,11 +238,11 @@ wikifier record-change "src/api/client.py" "Switched to httpx.AsyncClient becaus
|
|
|
231
238
|
wikifier mark-green "src/api/client.py" "Purpose + import summary updated to reflect httpx usage and retry logic."
|
|
232
239
|
```
|
|
233
240
|
|
|
234
|
-
This protocol (v0.
|
|
241
|
+
This protocol (v0.6) + the zero-dependency Python library (core has no deps; MCP is optional via `pip install wikifier[mcp]`) make Wikifier a first-class, low-ambiguity citizen in any LLM-driven development workflow across models and environments. The design ensures the mandatory loop is executable with minimal deviation.
|
|
235
242
|
|
|
236
243
|
**Explicitly zero-dependency by design** (see pyproject.toml: dependencies = [] ; MCP via optional extra only). All core agent operations (health matrix for token-saving lookup, record-change/mark-green for autonomous wiki updates, check-changes, etc.) work with plain Python + the installed package or source — no external services or heavy deps required.
|
|
237
244
|
|
|
238
|
-
## Quick Reference — Library Surface (v0.
|
|
245
|
+
## Quick Reference — Library Surface (v0.6)
|
|
239
246
|
Core imports (all zero-dep for main paths; support project_root= for external/agent-to-agent use):
|
|
240
247
|
`from wikifier import check_changes, record_change, health, mark_green, suggest_next_actions, update_maps, discover_project_root, run_full_update`
|
|
241
248
|
|
|
@@ -243,4 +250,4 @@ All support `project_root=...` and return structured data (plus side-effecting s
|
|
|
243
250
|
|
|
244
251
|
See README.md "Intended Use" for the strict agent-to-agent wiki scope (token saving for lookup + autonomous update/create of wiki entries only). M5 dogfood validated this on real external projects with the exact patterns above. Recent 4.0.1 hygiene (health coerce + superseded prune) further improves reliability of the matrix for agents doing direct lookups/updates.
|
|
245
252
|
|
|
246
|
-
**Human investigation layer (secondary, opt-in)**: `wikifier init` copies only `index.html` (the clean human wiki viewer) into the target project (the folder where MCP/CLI run). `diagnostics.html` (Wikifier maintainer hub) is no longer copied — it would show the wrong tree (Wikifier's internals) and be stale for the host project. Humans open the local `index.html` (via `python -m http.server` recommended) to see a clean visual of *that project's* agent-maintained wiki: prominent code structure / dependency chart (Mermaid) as the hero, followed by a simple "Files & descriptions" list (paths + short "what this file is about" summaries pulled from the wiki notes), and a lightweight "Browse by folder" tree derived from the health data.
|
|
253
|
+
**Human investigation layer (secondary, opt-in)**: `wikifier init` copies only `index.html` (the clean human wiki viewer) into the target project (the folder where MCP/CLI run). `diagnostics.html` (Wikifier maintainer hub) is no longer copied — it would show the wrong tree (Wikifier's internals) and be stale for the host project. Humans open the local `index.html` (via `python -m http.server` recommended) to see a clean visual of *that project's* agent-maintained wiki: prominent code structure / dependency chart (Mermaid) as the hero, followed by a simple "Files & descriptions" list (paths + short "what this file is about" summaries pulled from the wiki notes), and a lightweight "Browse by folder" tree derived from the health data. A "Quick actions" toolbar provides one-click copy buttons for the main commands (check-changes, update-maps, monitor &); empty states ("No structure map yet", "No files in the wiki yet") have prominent primary buttons for first-time commands (update-maps prioritized, combined check-changes+update-maps for files). On first open with no map, the `wikifier update-maps` command is auto-copied (sessionStorage-guarded one-time per browser session) and live-wait mode is immediately activated. Buttons use copy + live-wait: they copy the exact command and inject a fixed top "Waiting for `wikifier ...` to produce data... (auto-polling)" banner with aggressive 3s polling that auto-detects when library.md / file_health.* update (from the terminal run) and refreshes the chart/files automatically; includes an "I ran it — refresh now" link in the banner and a success toast on detection. A short explanatory note in the UI clarifies the model: this is a pure static zero-dep viewer (browser JS cannot execute host shell commands due to security sandbox); the auto we provide is copy + immediate live-wait + fast poll so results (trees, files, descriptions) appear automatically after the user pastes/runs in their terminal. "Good enough" acceptance recorded for this copy+live-wait UX. Prominent copy buttons also export "structure as text" (Mermaid source) and a clean full snapshot (tree + file list + descriptions) — exactly the compact, token-saving view agents use. The default human page is intentionally free of dense agent internals (those live in `diagnostics.html` in the Wikifier source for technical users). If an old diagnostics.html is present, it can be safely deleted. The .md files + MCP/CLI/tools remain the primary SSOT and update mechanism for agents. This layer lets humans (or teams) visually investigate and copy-paste wiki summaries for their own work / LLM chats without touching agent behavior or adding deps.
|