rekipedia 0.9.3

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.
package/README.md ADDED
@@ -0,0 +1,303 @@
1
+ # rekipedia
2
+
3
+ > Your AI tech lead — always available, always up to date.
4
+
5
+ rekipedia scans any repository into a portable SQLite knowledge store and gives every developer on the team an LLM-powered tech lead they can ask anything: _"How does the auth flow work?", "What's the fastest way to add a new API endpoint?", "What broke the payment service last week?"_
6
+
7
+ No hallucinations, no guessing — every answer is grounded in your actual codebase.
8
+
9
+ ### Key features
10
+ - **Agentic wiki orchestration**: `PlannerAgent` designs the wiki structure dynamically based on your repo
11
+ - **Page importance scoring**: planner assigns each page an importance score (0–100); nav sidebar sorts by priority
12
+ - **DeepWiki-style sections**: pages grouped into logical sections (`getting-started`, `architecture`, `core-components`, etc.)
13
+ - **Context slicing**: each page only receives the data it needs (~40–60% token reduction vs fixed-layout approach)
14
+ - **Hybrid RAG Q&A**: FAISS-indexed code chunks + wiki pages give the LLM full codebase context when answering questions
15
+ - **Embed provider choice**: `--embed-provider openai|ollama|azure|...` — any litellm-compatible embedding model
16
+ - **Wiki export**: bundle to a single Markdown file, ZIP archive, or structured JSON (`rekipedia export`)
17
+ - **Incremental updates**: only re-processes changed files after the first scan
18
+ - **Grounded Q&A**: answers cite real file paths and line numbers — no hallucinations
19
+
20
+ ## Quick start
21
+
22
+ ### via npm / npx (no install required)
23
+
24
+ ```bash
25
+ npx rekipedia init .
26
+ npx rekipedia scan .
27
+ ```
28
+
29
+ ### via uv / uvx (no install required)
30
+
31
+ ```bash
32
+ uvx rekipedia init .
33
+ uvx rekipedia scan .
34
+ ```
35
+
36
+ ### Permanent install
37
+
38
+ ```bash
39
+ # Core (scan + serve + ask)
40
+ pip install rekipedia
41
+ # or
42
+ uv tool install rekipedia
43
+
44
+ # With RAG support (semantic embed + search — needs faiss-cpu + numpy ~100MB)
45
+ pip install "rekipedia[rag]"
46
+
47
+ # Homebrew (Go single binary — no Python needed)
48
+ brew tap unrealandychan/tap
49
+ brew install rekipedia
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Commands
55
+
56
+ | Command | Description |
57
+ |---|---|
58
+ | `rekipedia init [REPO]` | Scaffold `.rekipedia/` with `config.yml` and update `.gitignore` |
59
+ | `rekipedia scan [REPO]` | Full analysis — extracts symbols, synthesises wiki pages, exports JSON |
60
+ | `rekipedia update [REPO]` | Incremental refresh — re-extracts only changed files, keeps the rest |
61
+ | `rekipedia ask [QUESTION]` | Interactive Q&A REPL — streaming answers, Ctrl+C to quit |
62
+ | `rekipedia serve [REPO]` | Start a local web UI to browse wiki pages and ask questions |
63
+ | `rekipedia embed [REPO]` | Build (or rebuild) the FAISS semantic search index for hybrid RAG Q&A |
64
+ | `rekipedia export [REPO]` | Bundle the wiki to a single file (`--format md\|zip\|json`) |
65
+
66
+ ---
67
+
68
+ ## LLM configuration
69
+
70
+ After running `rekipedia init`, edit `.rekipedia/config.yml`:
71
+
72
+ ```yaml
73
+ version: 1
74
+ ignore:
75
+ - .git
76
+ - node_modules
77
+ - __pycache__
78
+ - .rekipedia
79
+ languages:
80
+ - python
81
+ - typescript
82
+ llm:
83
+ model: ollama/llama4 # any litellm model string
84
+ api_key: "" # or set REKIPEDIA_API_KEY env var
85
+ base_url: "" # for local / self-hosted endpoints
86
+ temperature: 0.2
87
+ ```
88
+
89
+ ### Supported providers (via [litellm](https://docs.litellm.ai))
90
+
91
+ | Provider | Example model string |
92
+ |---|---|
93
+ | Ollama (local, free) | `ollama/llama4` |
94
+ | OpenAI | `gpt-5.5` |
95
+ | Anthropic | `claude-opus-4-6` |
96
+ | Google Gemini | `gemini/gemini-3.0-pro` |
97
+ | Any OpenAI-compatible | set `base_url` in config |
98
+
99
+ ### Runtime overrides (env vars)
100
+
101
+ ```bash
102
+ export REKIPEDIA_MODEL=gpt-5.5
103
+ export REKIPEDIA_API_KEY=sk-...
104
+ export REKIPEDIA_BASE_URL=https://my-proxy/v1
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Output
110
+
111
+ `rekipedia scan` writes everything to `.rekipedia/` inside your repo:
112
+
113
+ ```
114
+ .rekipedia/
115
+ ├── config.yml # your settings (committed)
116
+ ├── store.db # SQLite knowledge store (git-ignored)
117
+ ├── scan_meta.json # last scan metadata (model, timestamp, file count)
118
+ ├── wiki/ # generated Markdown pages (3–15 pages, dynamically planned)
119
+ │ ├── index.md
120
+ │ ├── architecture-overview.md
121
+ │ ├── repository-structure.md
122
+ │ └── ... (pages vary by repo)
123
+ ├── rag/ # RAG index (git-ignored)
124
+ │ ├── index.faiss # FAISS flat L2 index
125
+ │ └── chunks.json # source code chunks + metadata
126
+ ├── diagrams/ # Mermaid diagram files
127
+ │ ├── module-graph.md
128
+ │ └── class-hierarchy.md
129
+ └── exports/ # JSON exports
130
+ ├── symbols.json
131
+ ├── relationships.json
132
+ └── manifest.json # run summary + metadata + page importance scores
133
+ ```
134
+
135
+ Dynamically generates 3–15 wiki pages based on repo complexity (powered by PlannerAgent).
136
+
137
+ The wiki structure is designed dynamically by `PlannerAgent` based on what's actually present in your repo:
138
+
139
+ | Section | Example pages | When generated |
140
+ |---|---|---|
141
+ | Getting Started | index, installation, quick-start | Always |
142
+ | Architecture | architecture-overview, data-flow, repository-structure | ≥3 modules |
143
+ | Core Components | One page per major module | ≥2 modules |
144
+ | API Reference | cli-reference, python-api, rest-api | CLI/HTTP handlers found |
145
+ | Development | testing, contributing, ci-cd | Test files found |
146
+ | Ecosystem | integrations, deployment | ≥3 external deps |
147
+
148
+ ### Scan options
149
+
150
+ ```bash
151
+ # Use a specific LLM model
152
+ rekipedia scan . --model gpt-5.5
153
+
154
+ # Skip Docker (run extractors in-process)
155
+ rekipedia scan . --no-docker
156
+
157
+ # Write output to a custom directory
158
+ rekipedia scan . --output-dir /tmp/wiki-output
159
+
160
+ # Enable debug logging (litellm, HTTP, full tracebacks)
161
+ rekipedia scan . --verbose
162
+
163
+ # Auto-embed for RAG after scan
164
+ rekipedia scan . --embed-model text-embedding-3-small --embed-provider openai
165
+ ```
166
+
167
+ ### RAG / semantic search
168
+
169
+ `rekipedia ask` uses **hybrid retrieval** — wiki pages + FAISS-indexed code chunks — to answer questions with full codebase context.
170
+
171
+ ```bash
172
+ # Build or rebuild the FAISS index
173
+ rekipedia embed .
174
+
175
+ # Custom embedding model + provider
176
+ rekipedia embed . --model text-embedding-3-small --provider openai
177
+ rekipedia embed . --model nomic-embed-text --provider ollama
178
+
179
+ # If your embed provider uses a DIFFERENT API key from your main LLM:
180
+ rekipedia embed . --model text-embedding-3-small --provider openai
181
+ # set embed_api_key in config.yml, or:
182
+ export REKIPEDIA_EMBED_API_KEY=sk-your-openai-key
183
+
184
+ # Or configure everything in .rekipedia/config.yml:
185
+ # llm:
186
+ # model: ollama/llama4 # main LLM (local)
187
+ # embed_model: text-embedding-3-small
188
+ # embed_provider: openai
189
+ # embed_api_key: sk-xxx # separate key for embed provider
190
+ # embed_base_url: "" # optional: custom endpoint
191
+
192
+ # Env var overrides (all optional):
193
+ export REKIPEDIA_EMBED_MODEL=nomic-embed-text
194
+ export REKIPEDIA_EMBED_PROVIDER=ollama
195
+ export REKIPEDIA_EMBED_API_KEY=sk-xxx
196
+ export REKIPEDIA_EMBED_BASE_URL=https://my-proxy.example.com/v1
197
+ ```
198
+
199
+ The FAISS index is saved to `.rekipedia/rag/index.faiss` and chunked source code to `.rekipedia/rag/chunks.json`.
200
+
201
+ ### Export the wiki
202
+
203
+ ```bash
204
+ # Single combined Markdown file (default)
205
+ rekipedia export . --format md --output ./wiki-export.md
206
+
207
+ # ZIP archive (one .md per page + manifest.json)
208
+ rekipedia export . --format zip --output ./wiki.zip
209
+
210
+ # Structured JSON (all pages + metadata)
211
+ rekipedia export . --format json --output ./wiki.json
212
+ ```
213
+
214
+ ### Incremental update
215
+
216
+ After the first scan, `rekipedia update` only re-processes files whose SHA-256 has changed. Unchanged symbols and relationships are carried forward from the previous run — the wiki is refreshed in seconds.
217
+
218
+ ```bash
219
+ rekipedia update . # auto-detect changed files
220
+ rekipedia update . --no-docker # skip Docker
221
+ ```
222
+
223
+ If no previous scan is found, `update` automatically falls back to a full scan.
224
+
225
+ ### Ask the wiki
226
+
227
+ ```bash
228
+ # Start interactive Q&A session (streams answers, Ctrl+C to quit)
229
+ rekipedia ask
230
+ rekipedia ask --repo ./my-project
231
+ rekipedia ask --model gpt-4o
232
+
233
+ # Single-shot mode (backward compat)
234
+ rekipedia ask -q "How does the auth flow work?"
235
+ ```
236
+
237
+ Answers are grounded **entirely** in your wiki pages and symbol index — the LLM cannot hallucinate details that aren't in the scanned knowledge store. Answers are streamed token-by-token with a spinner while waiting.
238
+
239
+ Not happy with a generated page? See **[docs/customizing.md](docs/customizing.md)** — you can pin pages, override prompts, change the writing style, or add your own pages that scans will never touch.
240
+
241
+ ### Serve the wiki
242
+
243
+ ```bash
244
+ rekipedia serve . # opens browser at http://127.0.0.1:7070
245
+ rekipedia serve . --port 8080 # custom port
246
+ rekipedia serve . --no-browser # don't auto-open browser
247
+ ```
248
+
249
+ - Browse generated wiki pages in a dark-themed web UI
250
+ - Ask questions with the same grounded Q&A (answers streamed via the web)
251
+ - Q&A history stored in SQLite
252
+
253
+ ---
254
+
255
+ ## Prerequisites
256
+
257
+ - **Python ≥ 3.11** (or `uv` which manages its own Python)
258
+ - **Docker** — optional; used for isolated extraction. Falls back to in-process runner automatically if Docker is not available (`--no-docker` forces in-process mode)
259
+
260
+ ---
261
+
262
+ ## Using rekipedia with AI coding agents
263
+
264
+ rekipedia ships a **Hermes agent skill** (`rekipedia-agent-skill.md`) that teaches AI assistants (Copilot, Claude Code, Codex) to use rekipedia as their codebase intelligence layer:
265
+
266
+ 1. Copy `rekipedia-agent-skill.md` into your Hermes skills directory
267
+ 2. Any agent with the skill loaded will automatically scan + query rekipedia before diving into source files
268
+ 3. Dramatically reduces context window usage for large codebases
269
+
270
+ ---
271
+
272
+ ## Development
273
+
274
+ ```bash
275
+ # Install all deps
276
+ make dev
277
+
278
+ # Run tests
279
+ make test
280
+
281
+ # Lint
282
+ make lint
283
+
284
+ # Build wheel + npm tarball
285
+ make build
286
+ ```
287
+
288
+ ### Release
289
+
290
+ ```bash
291
+ PYPI_TOKEN=*** NPM_TOKEN=*** make release
292
+
293
+ # Full release: build + tag + push + PyPI + npm
294
+ make release-all PYPI_TOKEN=*** NPM_TOKEN=***
295
+ # With version bump
296
+ make release-all PYPI_TOKEN=*** NPM_TOKEN=*** VERSION=0.5.0
297
+ ```
298
+
299
+ ---
300
+
301
+ ## License
302
+
303
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ // close-wiki npm shim
3
+ // Delegates to the Python package (installed via uv or pip).
4
+ // Security: uses execFileSync with an explicit args array — never shell:true
5
+ // or string interpolation of user-supplied values.
6
+
7
+ "use strict";
8
+
9
+ const { execFileSync } = require("child_process");
10
+
11
+ const args = process.argv.slice(2);
12
+
13
+ function tryRun(cmd, cmdArgs) {
14
+ try {
15
+ execFileSync(cmd, cmdArgs, { stdio: "inherit" });
16
+ return true;
17
+ } catch (err) {
18
+ if (err.status !== undefined) {
19
+ // Command ran but exited non-zero — propagate exit code
20
+ process.exit(err.status);
21
+ }
22
+ // Command not found (ENOENT) — return false to try next strategy
23
+ return false;
24
+ }
25
+ }
26
+
27
+ // Strategy 1: uvx (preferred — no global install needed)
28
+ if (tryRun("uvx", ["close-wiki", ...args])) process.exit(0);
29
+
30
+ // Strategy 2: python -m close_wiki (already pip-installed)
31
+ if (tryRun("python3", ["-m", "close_wiki", ...args])) process.exit(0);
32
+ if (tryRun("python", ["-m", "close_wiki", ...args])) process.exit(0);
33
+
34
+ // No viable runtime found
35
+ console.error(
36
+ [
37
+ "",
38
+ "close-wiki: could not find a Python runtime to run the tool.",
39
+ "",
40
+ "Please install one of:",
41
+ " uv (recommended) — https://docs.astral.sh/uv/getting-started/installation/",
42
+ " pip install close-wiki",
43
+ "",
44
+ ].join("\n")
45
+ );
46
+ process.exit(1);
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "rekipedia",
3
+ "version": "0.9.3",
4
+ "description": "Agentic repo-to-wiki: scan any repository into a portable SQLite knowledge store with wiki pages, diagrams, and grounded Q&A.",
5
+ "bin": {
6
+ "rekipedia": "./bin/rekipedia.js"
7
+ },
8
+ "engines": {
9
+ "node": ">=18"
10
+ },
11
+ "files": [
12
+ "bin/"
13
+ ],
14
+ "keywords": [
15
+ "wiki",
16
+ "documentation",
17
+ "llm",
18
+ "knowledge-base",
19
+ "agent",
20
+ "sqlite"
21
+ ],
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/your-org/rekipedia.git"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/your-org/rekipedia/issues"
29
+ }
30
+ }