codebeacon 0.2.0__tar.gz → 0.3.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.
- {codebeacon-0.2.0 → codebeacon-0.3.0}/PKG-INFO +89 -12
- {codebeacon-0.2.0 → codebeacon-0.3.0}/README.de.md +78 -9
- {codebeacon-0.2.0 → codebeacon-0.3.0}/README.es.md +78 -9
- {codebeacon-0.2.0 → codebeacon-0.3.0}/README.fr.md +78 -9
- {codebeacon-0.2.0 → codebeacon-0.3.0}/README.ja.md +79 -10
- {codebeacon-0.2.0 → codebeacon-0.3.0}/README.ko.md +80 -11
- {codebeacon-0.2.0 → codebeacon-0.3.0}/README.md +88 -11
- {codebeacon-0.2.0 → codebeacon-0.3.0}/README.pt-BR.md +78 -9
- {codebeacon-0.2.0 → codebeacon-0.3.0}/README.zh-CN.md +79 -10
- codebeacon-0.3.0/codebeacon/__init__.py +1 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/cache.py +55 -4
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/cli.py +185 -49
- codebeacon-0.3.0/codebeacon/common/safety.py +90 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/contextmap/generator.py +51 -20
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/discover/detector.py +32 -0
- codebeacon-0.3.0/codebeacon/discover/ignore.py +172 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/discover/scanner.py +37 -26
- codebeacon-0.3.0/codebeacon/export/callflow_html.py +221 -0
- codebeacon-0.3.0/codebeacon/export/hooks.py +131 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/export/mcp.py +16 -10
- codebeacon-0.3.0/codebeacon/export/merge.py +118 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/export/obsidian.py +26 -14
- codebeacon-0.3.0/codebeacon/export/tree_html.py +295 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/graph/analyze.py +14 -1
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/graph/enrich.py +60 -4
- codebeacon-0.3.0/codebeacon/graph/write.py +193 -0
- codebeacon-0.3.0/codebeacon/plugins/__init__.py +1 -0
- codebeacon-0.3.0/codebeacon/plugins/githooks.py +238 -0
- codebeacon-0.3.0/codebeacon/plugins/skills.py +147 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/pyproject.toml +1 -1
- codebeacon-0.3.0/tests/test_plugins.py +276 -0
- codebeacon-0.3.0/tests/test_safety_and_writes.py +315 -0
- codebeacon-0.2.0/codebeacon/__init__.py +0 -1
- {codebeacon-0.2.0 → codebeacon-0.3.0}/.cursorrules +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/.github/CODEOWNERS +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/.github/dependabot.yml +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/.github/workflows/ci.yml +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/.github/workflows/release.yml +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/.gitignore +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/AGENTS.md +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/CLAUDE.md +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/LICENSE +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/__main__.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/common/__init__.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/common/filters.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/common/symbols.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/common/types.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/config.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/contextmap/__init__.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/discover/__init__.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/export/__init__.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/__init__.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/base.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/components.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/dependencies.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/entities.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/README.md +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/actix.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/angular.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/aspnet.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/django.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/express.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/fastapi.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/flask.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/gin.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/ktor.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/laravel.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/nestjs.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/rails.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/react.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/spring_boot.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/svelte.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/tauri.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/vapor.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/queries/vue.scm +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/routes.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/semantic.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/extract/services.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/graph/__init__.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/graph/build.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/graph/cluster.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/skill/SKILL.md +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/wave.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/wiki/__init__.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/wiki/generator.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/wiki/index.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon/wiki/templates.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/codebeacon.yaml.example +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/docs/TRANSLATION_STATUS.md +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/public-plan.md +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/skill/SKILL.md +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/skill/install.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/__init__.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/conftest.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/actix/main.rs +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/angular/app.component.ts +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/aspnet/UserController.cs +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/django/views.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/express/userRouter.js +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/fastapi/main.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/flask/app.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/gin/main.go +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/ktor/UserRoutes.kt +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/laravel/UserController.php +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/nestjs/user.controller.ts +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/rails/users_controller.rb +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/react/UserPage.tsx +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/spring_boot/UserController.java +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/sveltekit/+page.svelte +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/vapor/routes.swift +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/fixtures/vue/UserList.vue +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/test_discover.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/test_entities.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/test_filters.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/test_graph.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/test_resolve.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/test_routes.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/test_services.py +0 -0
- {codebeacon-0.2.0 → codebeacon-0.3.0}/tests/test_wiki.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codebeacon
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Source code AST analysis tool for AI context generation — unified multi-framework knowledge graph
|
|
5
5
|
Project-URL: Homepage, https://github.com/codebeacon/codebeacon
|
|
6
6
|
Project-URL: Repository, https://github.com/codebeacon/codebeacon
|
|
@@ -85,9 +85,15 @@ Existing tools solve this partially. Route analyzers map your controllers but mi
|
|
|
85
85
|
- **Tree-sitter based** — structural AST parsing, not regex; all language grammars included out of the box
|
|
86
86
|
- **Two-pass DI resolution** — Pass 1 extracts local AST nodes; Pass 2 builds a global symbol table and resolves Interface → Implementation mappings that single-pass tools miss
|
|
87
87
|
- **Wave merge architecture** — files processed in parallel chunks, results merged globally; handles large monorepos without memory blowouts
|
|
88
|
-
- **Multiple output formats** — JSON knowledge graph, Markdown wiki, Obsidian vault, AI context maps, MCP server
|
|
88
|
+
- **Multiple output formats** — JSON knowledge graph, Markdown wiki, Obsidian vault, AI context maps, MCP server, interactive HTML
|
|
89
|
+
- **Visual exploration** — `beacon.html` (D3 collapsible tree) and `callflow.html` (Mermaid architecture diagrams grouped by community), regenerated on every scan
|
|
89
90
|
- **Community detection** — Leiden/Louvain clustering reveals your actual architectural boundaries
|
|
90
|
-
- **Incremental cache** — SHA-256
|
|
91
|
+
- **Incremental cache** — SHA-256 + mtime/size fast path; mtime-only bumps from sync tools (Obsidian/iCloud/Nextcloud) never trigger needless re-extraction
|
|
92
|
+
- **Confidence promotion** — cross-file `calls` edges are promoted from INFERRED to EXTRACTED when an explicit import proves the binding
|
|
93
|
+
- **Safe writes** — beacon.json has a shrink guard (a partial run can never overwrite a complete graph) and stamps `built_at_commit` so REPORT.md flags stale outputs against the current HEAD
|
|
94
|
+
- **Multi-developer friendly** — `codebeacon hook install` registers a git merge driver for `beacon.json` and a post-commit incremental rebuild hook, so two devs scanning the same branch never produce merge conflicts in the graph
|
|
95
|
+
- **Hardened output** — YAML frontmatter and MCP labels are sanitized: U+2028/U+2029, C0 controls, and bidi marks are stripped before they reach Obsidian, Cursor, or the agent
|
|
96
|
+
- **gitignore-style `.codebeaconignore`** — last-match-wins with `!` negation, dir patterns (`build/`), anchored patterns (`/secrets.txt`), trailing-whitespace rules
|
|
91
97
|
- **Zero configuration** — auto-detects frameworks and languages; generates `codebeacon.yaml` for repeat runs
|
|
92
98
|
- **Deep-dive mode** — `--deep-dive` generates per-project `.codebeacon/` + `CLAUDE.md` for every sub-project; running `codebeacon scan . --update` from any sub-project folder automatically syncs all projects in the workspace
|
|
93
99
|
|
|
@@ -159,8 +165,10 @@ project-root/
|
|
|
159
165
|
.cursorrules ← Cursor IDE context (same merge strategy)
|
|
160
166
|
AGENTS.md ← OpenAI Agents / Codex context (same merge strategy)
|
|
161
167
|
.codebeacon/
|
|
162
|
-
beacon.json ← full knowledge graph
|
|
163
|
-
|
|
168
|
+
beacon.json ← full knowledge graph; embeds `meta.built_at_commit`
|
|
169
|
+
beacon.html ← D3 collapsible-tree viewer (open in browser)
|
|
170
|
+
callflow.html ← Mermaid call-flow diagrams grouped by community
|
|
171
|
+
REPORT.md ← god nodes, surprising connections, hub files, freshness
|
|
164
172
|
wiki/
|
|
165
173
|
index.md ← global index (~200 tokens)
|
|
166
174
|
overview.md ← platform stats + cross-project connections
|
|
@@ -307,7 +315,7 @@ All language parsers (Java, Kotlin, Python, JavaScript, TypeScript, Go, Ruby, PH
|
|
|
307
315
|
codebeacon scan <path> [options]
|
|
308
316
|
codebeacon scan . # current directory
|
|
309
317
|
codebeacon scan /workspace # workspace root (multi-project)
|
|
310
|
-
codebeacon scan . --update # incremental:
|
|
318
|
+
codebeacon scan . --update # incremental: mtime/size fast path + content-hash fallback
|
|
311
319
|
codebeacon scan . --wiki-only # skip re-extraction, regenerate wiki/obsidian/context map from existing beacon.json
|
|
312
320
|
codebeacon scan . --obsidian-dir <path> # write Obsidian vault to custom location
|
|
313
321
|
codebeacon scan . --semantic # enable LLM semantic extraction
|
|
@@ -319,9 +327,13 @@ codebeacon init [path] # auto-generate codebeacon.yaml
|
|
|
319
327
|
codebeacon sync # run from codebeacon.yaml
|
|
320
328
|
codebeacon sync --config <file> # use a specific config file
|
|
321
329
|
|
|
322
|
-
# Query the knowledge graph
|
|
323
|
-
codebeacon query <term>
|
|
324
|
-
codebeacon path <source> <target>
|
|
330
|
+
# Query the knowledge graph
|
|
331
|
+
codebeacon query <term> [--dir .codebeacon] [--limit N] # search nodes by label substring
|
|
332
|
+
codebeacon path <source> <target> [--dir .codebeacon] # shortest dependency path
|
|
333
|
+
|
|
334
|
+
# Multi-developer support (git plumbing)
|
|
335
|
+
codebeacon hook install [path] # install merge driver + post-commit incremental rebuild
|
|
336
|
+
codebeacon merge-driver <base> <cur> <other> # invoked by git after `hook install`; union-merges beacon.json
|
|
325
337
|
|
|
326
338
|
# Integrations
|
|
327
339
|
codebeacon serve [--dir .codebeacon] # start MCP server (stdio)
|
|
@@ -330,6 +342,58 @@ codebeacon install # install Claude Code skill
|
|
|
330
342
|
|
|
331
343
|
---
|
|
332
344
|
|
|
345
|
+
## Visual Exploration
|
|
346
|
+
|
|
347
|
+
Every scan writes two self-contained HTML files alongside `beacon.json`:
|
|
348
|
+
|
|
349
|
+
```
|
|
350
|
+
.codebeacon/beacon.html # D3 v7 collapsible tree — open in any browser
|
|
351
|
+
.codebeacon/callflow.html # Mermaid architecture diagrams, one per community
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
No build step, no static server, no copy-paste. Open the file, click to expand
|
|
355
|
+
projects → types → nodes; hover for source paths and degree. `callflow.html`
|
|
356
|
+
groups your graph by community and renders each as a Mermaid flowchart, with
|
|
357
|
+
the cross-community out-edges listed in a collapsed table.
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Multi-Developer Workflow
|
|
362
|
+
|
|
363
|
+
Two developers running `codebeacon scan` on the same branch produce two
|
|
364
|
+
slightly different `beacon.json` files — historically a merge conflict
|
|
365
|
+
hotspot. `codebeacon hook install` solves this:
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
codebeacon hook install # in the repo root
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
This registers:
|
|
372
|
+
|
|
373
|
+
- a **git merge driver** that union-merges two `beacon.json` files into one
|
|
374
|
+
(nodes deduped by ID, edges deduped by `(source, target, relation)`),
|
|
375
|
+
- a `.gitattributes` entry pointing `*beacon.json` at the driver,
|
|
376
|
+
- a **post-commit hook** that runs `codebeacon scan . --update` in the
|
|
377
|
+
background so the graph never falls behind your commits. Output goes to
|
|
378
|
+
`~/.cache/codebeacon-rebuild.log`.
|
|
379
|
+
|
|
380
|
+
The merge driver always exits 0 — a graph regen never blocks a real merge.
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Safety Guarantees
|
|
385
|
+
|
|
386
|
+
A few invariants the writer enforces on every successful scan:
|
|
387
|
+
|
|
388
|
+
| Guard | What it prevents |
|
|
389
|
+
|---|---|
|
|
390
|
+
| **Shrink guard** | A partial-extraction failure or interrupted run can never overwrite a larger complete `beacon.json`. Pass `force=True` from the API to bypass. |
|
|
391
|
+
| **Atomic write** | `beacon.json` is written via `os.replace`, so the file is either complete or untouched — no half-written graphs. |
|
|
392
|
+
| **`built_at_commit` stamp** | `beacon.json` embeds `meta.built_at_commit` (full SHA) and `REPORT.md` shows the short SHA. If HEAD has advanced past it, the report flags the graph as `⚠ stale` with a one-line remediation hint. |
|
|
393
|
+
| **Frontmatter / label hardening** | YAML frontmatter values are single-quoted and escape U+2028, U+2029, tabs, and C0 controls; MCP tool output runs every label through the same sanitizer. A malicious identifier in source code cannot break Obsidian's YAML parser or inject control sequences into an LLM agent's context. |
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
333
397
|
## Configuration
|
|
334
398
|
|
|
335
399
|
Run `codebeacon init` to generate `codebeacon.yaml`, or write it manually:
|
|
@@ -366,16 +430,29 @@ deep_dive: false # set to true to generate per-project outputs
|
|
|
366
430
|
|
|
367
431
|
### .codebeaconignore
|
|
368
432
|
|
|
369
|
-
Place a `.codebeaconignore` file at your project root to exclude directories or files from scanning. Syntax
|
|
433
|
+
Place a `.codebeaconignore` file at your project root to exclude directories or files from scanning. Syntax matches `.gitignore` — last-match-wins with `!` negation, anchored patterns (`/foo`), dir-only patterns (`build/`), and comments:
|
|
370
434
|
|
|
371
435
|
```
|
|
372
436
|
# .codebeaconignore
|
|
373
|
-
|
|
437
|
+
|
|
438
|
+
# directories
|
|
374
439
|
build/
|
|
375
|
-
|
|
440
|
+
generated/
|
|
376
441
|
fixtures/
|
|
442
|
+
|
|
443
|
+
# anchored to root only
|
|
444
|
+
/scripts/local-only.ts
|
|
445
|
+
|
|
446
|
+
# glob patterns
|
|
447
|
+
*.gen.ts
|
|
448
|
+
**/snapshots/**
|
|
449
|
+
|
|
450
|
+
# re-include a specific file even though build/ is ignored
|
|
451
|
+
!build/manifest.ts
|
|
377
452
|
```
|
|
378
453
|
|
|
454
|
+
`!pattern` re-includes a previously-ignored path; later rules override earlier ones. The walker prunes directories whose name matches the rule set, but defers pruning when any negation rule could un-ignore a nested file.
|
|
455
|
+
|
|
379
456
|
---
|
|
380
457
|
|
|
381
458
|
## How It Compares
|
|
@@ -44,9 +44,15 @@ Bestehende Tools lösen dieses Problem nur teilweise. Route-Analyzer erfassen Ih
|
|
|
44
44
|
- **Auf tree-sitter basierend** — strukturelles AST-Parsing, keine Regex; Sprachgrammatiken standardmäßig enthalten
|
|
45
45
|
- **2-Pass DI-Auflösung** — Pass 1 extrahiert lokale AST-Knoten; Pass 2 baut eine globale Symboltabelle auf und löst Interface → Implementation-Mappings auf
|
|
46
46
|
- **Wave-Merge-Architektur** — Dateien werden in parallelen Chunks verarbeitet und global zusammengeführt; auch große Monorepos ohne Speicherprobleme
|
|
47
|
-
- **Mehrere Ausgabeformate** — JSON-Knowledge-Graph, Markdown-Wiki, Obsidian Vault, KI-Kontextkarten, MCP-Server
|
|
47
|
+
- **Mehrere Ausgabeformate** — JSON-Knowledge-Graph, Markdown-Wiki, Obsidian Vault, KI-Kontextkarten, MCP-Server, interaktives HTML
|
|
48
|
+
- **Visuelle Exploration** — `beacon.html` (D3 einklappbarer Baum) und `callflow.html` (Mermaid-Architekturdiagramme nach Community gruppiert) werden bei jedem Scan neu erzeugt
|
|
48
49
|
- **Community-Erkennung** — Leiden/Louvain-Clustering deckt tatsächliche Architekturgrenzen auf
|
|
49
|
-
- **Inkrementeller Cache** — SHA-256-
|
|
50
|
+
- **Inkrementeller Cache** — SHA-256 + mtime/size Fast-Path; reine mtime-Änderungen durch Sync-Tools (Obsidian/iCloud/Nextcloud) lösen niemals eine unnötige Re-Extraktion aus
|
|
51
|
+
- **Confidence-Promotion** — datei-übergreifende `calls`-Kanten werden automatisch von INFERRED auf EXTRACTED hochgestuft, wenn ein expliziter Import das Binding belegt
|
|
52
|
+
- **Sichere Schreibvorgänge** — beacon.json hat einen Shrink-Guard (ein Teil-Lauf kann niemals einen vollständigen Graph überschreiben) und stempelt `built_at_commit`, sodass REPORT.md veraltete Ausgaben gegen den aktuellen HEAD kennzeichnet
|
|
53
|
+
- **Multi-Entwickler-freundlich** — `codebeacon hook install` registriert einen git-Merge-Driver für `beacon.json` und einen Post-Commit-Hook für inkrementelle Rebuilds; zwei Devs, die denselben Branch scannen, produzieren niemals Merge-Konflikte im Graph
|
|
54
|
+
- **Gehärtete Ausgabe** — YAML-Frontmatter und MCP-Labels werden sanitisiert: U+2028/U+2029, C0-Steuerzeichen und Bidi-Marken werden entfernt, bevor sie Obsidian, Cursor oder den Agenten erreichen
|
|
55
|
+
- **`.codebeaconignore` im gitignore-Stil** — last-match-wins mit `!`-Negation, Verzeichnis-Patterns (`build/`), verankerte Patterns (`/secrets.txt`), Trailing-Whitespace-Regeln
|
|
50
56
|
- **Keine Konfiguration notwendig** — erkennt Frameworks und Sprachen automatisch; generiert `codebeacon.yaml` für Folgeläufe
|
|
51
57
|
- **Deep-Dive-Modus** — `--deep-dive` erzeugt für jedes Sub-Projekt eigene `.codebeacon/` + `CLAUDE.md`; ein Update-Aufruf aus **beliebigem** Sub-Projekt-Ordner synchronisiert automatisch alle Projekte im Workspace
|
|
52
58
|
|
|
@@ -116,8 +122,10 @@ project-root/
|
|
|
116
122
|
.cursorrules ← Cursor-IDE-Kontext (gleiche Merge-Strategie)
|
|
117
123
|
AGENTS.md ← OpenAI-Agents-/Codex-Kontext (gleiche Merge-Strategie)
|
|
118
124
|
.codebeacon/
|
|
119
|
-
beacon.json ← vollständiger Knowledge Graph
|
|
120
|
-
|
|
125
|
+
beacon.json ← vollständiger Knowledge Graph; bettet `meta.built_at_commit` ein
|
|
126
|
+
beacon.html ← D3-Baum-Viewer (im Browser öffnen)
|
|
127
|
+
callflow.html ← Mermaid-Call-Flow-Diagramme, nach Community gruppiert
|
|
128
|
+
REPORT.md ← God-Nodes, überraschende Verbindungen, Hub-Dateien, Frische
|
|
121
129
|
wiki/
|
|
122
130
|
index.md
|
|
123
131
|
overview.md
|
|
@@ -159,6 +167,50 @@ workspace/
|
|
|
159
167
|
.codebeacon/ ← frontend-Graph
|
|
160
168
|
```
|
|
161
169
|
|
|
170
|
+
## Visuelle Exploration
|
|
171
|
+
|
|
172
|
+
Jeder Scan schreibt zwei eigenständige HTML-Dateien neben `beacon.json`:
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
.codebeacon/beacon.html # D3 v7 einklappbarer Baum — in jedem Browser öffnen
|
|
176
|
+
.codebeacon/callflow.html # Mermaid-Architekturdiagramme, eines pro Community
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Kein Build, kein statischer Server, kein Copy-Paste. Datei öffnen, klicken um Projekte → Typen → Knoten auszuklappen; Hover zeigt Source-Pfade und Grad. `callflow.html` gruppiert den Graph nach Community und rendert jede als Mermaid-Flowchart, mit den ausgehenden Cross-Community-Kanten in einer einklappbaren Tabelle.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Multi-Entwickler-Workflow
|
|
184
|
+
|
|
185
|
+
Zwei Devs, die `codebeacon scan` auf demselben Branch ausführen, produzieren leicht unterschiedliche `beacon.json` — historisch ein Merge-Konflikt-Hotspot. `codebeacon hook install` löst das:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
codebeacon hook install # im Repo-Root
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Es registriert:
|
|
192
|
+
|
|
193
|
+
- einen **git-Merge-Driver**, der zwei `beacon.json` per Union zu einer zusammenführt (Knoten per ID, Kanten per `(source, target, relation)` dedupliziert),
|
|
194
|
+
- einen `.gitattributes`-Eintrag, der `*beacon.json` auf den Driver verweist,
|
|
195
|
+
- einen **Post-Commit-Hook**, der `codebeacon scan . --update` im Hintergrund ausführt, damit der Graph niemals hinter den Commits zurückbleibt. Ausgabe in `~/.cache/codebeacon-rebuild.log`.
|
|
196
|
+
|
|
197
|
+
Der Merge-Driver beendet sich immer mit 0 — eine Graph-Regeneration blockiert niemals einen echten Merge.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Sicherheitsgarantien
|
|
202
|
+
|
|
203
|
+
Invarianten, die der Writer bei jedem erfolgreichen Scan durchsetzt:
|
|
204
|
+
|
|
205
|
+
| Guard | Was er verhindert |
|
|
206
|
+
|---|---|
|
|
207
|
+
| **Shrink-Guard** | Eine partielle Extraktion oder ein unterbrochener Lauf kann niemals eine größere vollständige `beacon.json` überschreiben. Per `force=True` aus der API umgehbar. |
|
|
208
|
+
| **Atomares Schreiben** | `beacon.json` wird via `os.replace` geschrieben, die Datei ist also entweder komplett oder unangetastet — niemals halb geschrieben. |
|
|
209
|
+
| **`built_at_commit`-Stempel** | `beacon.json` bettet `meta.built_at_commit` (vollständige SHA) ein und `REPORT.md` zeigt die Kurz-SHA. Wenn HEAD weiter ist, markiert der Report den Graphen als `⚠ stale` mit einem einzeiligen Hinweis. |
|
|
210
|
+
| **Frontmatter-/Label-Härtung** | YAML-Frontmatter-Werte sind single-quoted und escapen U+2028, U+2029, Tab und C0-Steuerzeichen; MCP-Tool-Ausgabe lässt jedes Label durch denselben Sanitizer laufen. Ein böswilliger Identifier im Quellcode kann Obsidians YAML-Parser nicht zerschlagen oder Steuersequenzen in den Kontext eines LLM-Agenten injizieren. |
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
162
214
|
## Konfiguration
|
|
163
215
|
|
|
164
216
|
Führe `codebeacon init` aus, um `codebeacon.yaml` zu generieren, oder erstelle die Datei manuell:
|
|
@@ -195,16 +247,29 @@ deep_dive: false # auf true setzen für Pro-Projekt-Ausgabe
|
|
|
195
247
|
|
|
196
248
|
### .codebeaconignore
|
|
197
249
|
|
|
198
|
-
Platziere eine `.codebeaconignore`-Datei im Projektstammverzeichnis, um Verzeichnisse oder Dateien vom Scan auszuschließen.
|
|
250
|
+
Platziere eine `.codebeaconignore`-Datei im Projektstammverzeichnis, um Verzeichnisse oder Dateien vom Scan auszuschließen. Semantik konform zu `.gitignore` — last-match-wins mit `!`-Negation, verankerte Muster (`/foo`), nur-Verzeichnis-Muster (`build/`), Kommentare:
|
|
199
251
|
|
|
200
252
|
```
|
|
201
253
|
# .codebeaconignore
|
|
202
|
-
|
|
254
|
+
|
|
255
|
+
# Verzeichnisse
|
|
203
256
|
build/
|
|
204
|
-
|
|
257
|
+
generated/
|
|
205
258
|
fixtures/
|
|
259
|
+
|
|
260
|
+
# nur am Root verankert
|
|
261
|
+
/scripts/local-only.ts
|
|
262
|
+
|
|
263
|
+
# Glob-Muster
|
|
264
|
+
*.gen.ts
|
|
265
|
+
**/snapshots/**
|
|
266
|
+
|
|
267
|
+
# eine Datei wieder einschließen, auch wenn build/ ignoriert ist
|
|
268
|
+
!build/manifest.ts
|
|
206
269
|
```
|
|
207
270
|
|
|
271
|
+
`!pattern` schließt einen zuvor ignorierten Pfad wieder ein; spätere Regeln überschreiben frühere. Der Walker schneidet Verzeichnisse weg, deren Name auf das Regelset matcht, aber er verschiebt das Wegschneiden, wenn eine Negationsregel eine geschachtelte Datei wieder einschließen könnte.
|
|
272
|
+
|
|
208
273
|
---
|
|
209
274
|
|
|
210
275
|
## KI-Integration
|
|
@@ -300,8 +365,12 @@ codebeacon scan /workspace --deep-dive # Pro-Projekt- + kombinierte Workspace
|
|
|
300
365
|
codebeacon init [pfad] # codebeacon.yaml generieren
|
|
301
366
|
codebeacon sync # von codebeacon.yaml ausführen
|
|
302
367
|
|
|
303
|
-
codebeacon query <Begriff>
|
|
304
|
-
codebeacon path <Quelle> <Ziel>
|
|
368
|
+
codebeacon query <Begriff> [--dir .codebeacon] [--limit N] # Knoten per Label-Substring suchen
|
|
369
|
+
codebeacon path <Quelle> <Ziel> [--dir .codebeacon] # kürzester Abhängigkeitspfad
|
|
370
|
+
|
|
371
|
+
# Multi-Entwickler-Support (git plumbing)
|
|
372
|
+
codebeacon hook install [path] # Merge-Driver + Post-Commit-Inkrement-Rebuild installieren
|
|
373
|
+
codebeacon merge-driver <base> <cur> <other> # von git nach `hook install` aufgerufen; Union-Merge von beacon.json
|
|
305
374
|
|
|
306
375
|
codebeacon serve [--dir .codebeacon] # MCP-Server starten (stdio)
|
|
307
376
|
codebeacon install # Claude-Code-Skill installieren
|
|
@@ -44,9 +44,15 @@ Las herramientas existentes resuelven esto de forma parcial. Los analizadores de
|
|
|
44
44
|
- **Basado en tree-sitter** — análisis AST estructural, no expresiones regulares; gramáticas de lenguaje incluidas por defecto
|
|
45
45
|
- **Resolución DI en 2 pasos** — Pass 1 extrae nodos AST locales; Pass 2 construye una tabla de símbolos global y resuelve los mapeos Interface → Implementation
|
|
46
46
|
- **Arquitectura Wave merge** — archivos procesados en chunks paralelos y fusionados globalmente; maneja grandes monorepos sin problemas de memoria
|
|
47
|
-
- **Múltiples formatos de salida** — grafo JSON, wiki Markdown, Obsidian Vault, mapas de contexto para IA, servidor MCP
|
|
47
|
+
- **Múltiples formatos de salida** — grafo JSON, wiki Markdown, Obsidian Vault, mapas de contexto para IA, servidor MCP, HTML interactivo
|
|
48
|
+
- **Exploración visual** — `beacon.html` (árbol colapsable D3) y `callflow.html` (diagramas Mermaid de arquitectura por comunidad) regenerados en cada escaneo
|
|
48
49
|
- **Detección de comunidades** — clustering Leiden/Louvain revela los límites arquitectónicos reales
|
|
49
|
-
- **Caché incremental** —
|
|
50
|
+
- **Caché incremental** — SHA-256 + ruta rápida por mtime/size; los cambios de mtime sin cambio de contenido (Obsidian/iCloud/Nextcloud) nunca disparan re-extracción innecesaria
|
|
51
|
+
- **Promoción de confianza** — los edges `calls` entre archivos pasan de INFERRED a EXTRACTED automáticamente cuando un import explícito prueba el binding
|
|
52
|
+
- **Escrituras seguras** — beacon.json tiene shrink guard (una ejecución parcial nunca puede sobrescribir un grafo completo) y estampa `built_at_commit` para que REPORT.md marque la salida como stale frente al HEAD actual
|
|
53
|
+
- **Amigable para múltiples desarrolladores** — `codebeacon hook install` registra un git merge driver para `beacon.json` y un hook post-commit de rebuild incremental, así dos devs escaneando la misma rama nunca producen conflictos de merge en el grafo
|
|
54
|
+
- **Salida endurecida** — los frontmatter YAML y las etiquetas MCP se sanitizan: U+2028/U+2029, controles C0 y marcas bidi se eliminan antes de llegar a Obsidian, Cursor o al agente
|
|
55
|
+
- **`.codebeaconignore` estilo gitignore** — last-match-wins con negación `!`, patrones de directorio (`build/`), patrones anclados (`/secrets.txt`), reglas de espacio final
|
|
50
56
|
- **Cero configuración** — detecta frameworks y lenguajes automáticamente; genera `codebeacon.yaml` para ejecuciones posteriores
|
|
51
57
|
- **Modo Deep Dive** — `--deep-dive` genera `.codebeacon/` + `CLAUDE.md` propios para cada sub-proyecto; ejecutar el comando de actualización desde **cualquier** sub-proyecto sincroniza automáticamente todos los proyectos del workspace
|
|
52
58
|
|
|
@@ -115,8 +121,10 @@ project-root/
|
|
|
115
121
|
.cursorrules ← contexto para Cursor IDE (misma estrategia de fusión)
|
|
116
122
|
AGENTS.md ← contexto para OpenAI Agents / Codex (misma estrategia de fusión)
|
|
117
123
|
.codebeacon/
|
|
118
|
-
beacon.json ← grafo de conocimiento completo
|
|
119
|
-
|
|
124
|
+
beacon.json ← grafo de conocimiento completo; incrusta `meta.built_at_commit`
|
|
125
|
+
beacon.html ← visor de árbol colapsable D3 (abrir en cualquier navegador)
|
|
126
|
+
callflow.html ← diagramas Mermaid de call-flow agrupados por comunidad
|
|
127
|
+
REPORT.md ← nodos dios, conexiones sorprendentes, archivos hub, frescura
|
|
120
128
|
wiki/
|
|
121
129
|
index.md
|
|
122
130
|
overview.md
|
|
@@ -158,6 +166,50 @@ workspace/
|
|
|
158
166
|
.codebeacon/
|
|
159
167
|
```
|
|
160
168
|
|
|
169
|
+
## Exploración visual
|
|
170
|
+
|
|
171
|
+
Cada escaneo escribe dos archivos HTML autocontenidos junto a `beacon.json`:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
.codebeacon/beacon.html # árbol colapsable D3 v7 — abrir en cualquier navegador
|
|
175
|
+
.codebeacon/callflow.html # diagramas Mermaid de arquitectura, uno por comunidad
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Sin build, sin servidor estático, sin copy-paste. Abre el archivo, haz clic para expandir proyectos → tipos → nodos; hover para ver paths y degree. `callflow.html` agrupa el grafo por comunidad y renderiza cada una como flowchart Mermaid, con los edges salientes a otras comunidades en una tabla plegada.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Flujo multi-desarrollador
|
|
183
|
+
|
|
184
|
+
Dos devs ejecutando `codebeacon scan` en la misma rama producen `beacon.json` ligeramente distintos — un punto clásico de conflicto de merge. `codebeacon hook install` lo resuelve:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
codebeacon hook install # en la raíz del repo
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Registra:
|
|
191
|
+
|
|
192
|
+
- un **git merge driver** que union-mergea dos `beacon.json` en uno (nodos deduplicados por ID, edges deduplicados por `(source, target, relation)`),
|
|
193
|
+
- una entrada `.gitattributes` apuntando `*beacon.json` al driver,
|
|
194
|
+
- un **hook post-commit** que ejecuta `codebeacon scan . --update` en background para que el grafo nunca quede atrás de los commits. Salida en `~/.cache/codebeacon-rebuild.log`.
|
|
195
|
+
|
|
196
|
+
El merge driver siempre sale con 0 — la regeneración del grafo nunca bloquea un merge real.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Garantías de seguridad
|
|
201
|
+
|
|
202
|
+
Invariantes que el writer impone en cada escaneo exitoso:
|
|
203
|
+
|
|
204
|
+
| Guard | Lo que previene |
|
|
205
|
+
|---|---|
|
|
206
|
+
| **Shrink guard** | Una extracción parcial fallida o una ejecución interrumpida nunca puede sobrescribir un `beacon.json` completo y más grande. Bypass con `force=True` desde la API. |
|
|
207
|
+
| **Escritura atómica** | `beacon.json` se escribe vía `os.replace`, así que el archivo está completo o intacto — nunca a medio escribir. |
|
|
208
|
+
| **Estampa `built_at_commit`** | `beacon.json` incrusta `meta.built_at_commit` (SHA completo) y `REPORT.md` muestra el SHA corto. Si HEAD avanzó, el reporte marca el grafo como `⚠ stale` con un hint de remediación. |
|
|
209
|
+
| **Hardening de frontmatter / etiquetas** | Los valores YAML van entre comillas simples y escapan U+2028, U+2029, tab y controles C0; la salida MCP pasa todas las etiquetas por el mismo sanitizer. Un identificador malicioso en código fuente no puede romper el parser YAML de Obsidian ni inyectar secuencias de control en el contexto de un agente LLM. |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
161
213
|
## Configuración
|
|
162
214
|
|
|
163
215
|
Ejecuta `codebeacon init` para generar `codebeacon.yaml`, o escríbelo manualmente:
|
|
@@ -194,16 +246,29 @@ deep_dive: false # establecer true para salida por proyecto
|
|
|
194
246
|
|
|
195
247
|
### .codebeaconignore
|
|
196
248
|
|
|
197
|
-
Coloca un archivo `.codebeaconignore` en la raíz del proyecto para excluir directorios o archivos del escaneo.
|
|
249
|
+
Coloca un archivo `.codebeaconignore` en la raíz del proyecto para excluir directorios o archivos del escaneo. Semántica compatible con `.gitignore` — last-match-wins con negación `!`, patrones anclados (`/foo`), patrones solo-directorio (`build/`), comentarios:
|
|
198
250
|
|
|
199
251
|
```
|
|
200
252
|
# .codebeaconignore
|
|
201
|
-
|
|
253
|
+
|
|
254
|
+
# directorios
|
|
202
255
|
build/
|
|
203
|
-
|
|
256
|
+
generated/
|
|
204
257
|
fixtures/
|
|
258
|
+
|
|
259
|
+
# anclado solo a la raíz
|
|
260
|
+
/scripts/local-only.ts
|
|
261
|
+
|
|
262
|
+
# patrones glob
|
|
263
|
+
*.gen.ts
|
|
264
|
+
**/snapshots/**
|
|
265
|
+
|
|
266
|
+
# re-incluir un archivo aunque build/ esté ignorado
|
|
267
|
+
!build/manifest.ts
|
|
205
268
|
```
|
|
206
269
|
|
|
270
|
+
`!pattern` re-incluye una ruta previamente ignorada; reglas posteriores anulan las anteriores. El walker poda directorios cuyo nombre coincida con las reglas, pero pospone la poda cuando alguna regla de negación pueda re-incluir un archivo anidado.
|
|
271
|
+
|
|
207
272
|
---
|
|
208
273
|
|
|
209
274
|
## Integración con IA
|
|
@@ -299,8 +364,12 @@ codebeacon scan /workspace --deep-dive # salida por proyecto + workspace comb
|
|
|
299
364
|
codebeacon init [ruta] # generar codebeacon.yaml
|
|
300
365
|
codebeacon sync # ejecutar desde codebeacon.yaml
|
|
301
366
|
|
|
302
|
-
codebeacon query <término>
|
|
303
|
-
codebeacon path <origen> <destino>
|
|
367
|
+
codebeacon query <término> [--dir .codebeacon] [--limit N] # buscar nodos por substring de etiqueta
|
|
368
|
+
codebeacon path <origen> <destino> [--dir .codebeacon] # ruta más corta de dependencias
|
|
369
|
+
|
|
370
|
+
# Soporte multi-desarrollador (git plumbing)
|
|
371
|
+
codebeacon hook install [path] # instala merge driver + hook post-commit incremental
|
|
372
|
+
codebeacon merge-driver <base> <cur> <other> # invocado por git tras `hook install`; union-merge de beacon.json
|
|
304
373
|
|
|
305
374
|
codebeacon serve [--dir .codebeacon] # servidor MCP (stdio)
|
|
306
375
|
codebeacon install # instalar skill de Claude Code
|
|
@@ -44,9 +44,15 @@ Les outils existants ne résolvent ce problème qu'en partie. Les analyseurs de
|
|
|
44
44
|
- **Basé sur tree-sitter** — analyse AST structurelle, pas de regex ; grammaires de langage incluses par défaut
|
|
45
45
|
- **Résolution DI en 2 passes** — Pass 1 extrait les nœuds AST locaux ; Pass 2 construit une table de symboles globale et résout les mappings Interface → Implementation
|
|
46
46
|
- **Architecture Wave merge** — fichiers traités en chunks parallèles puis fusionnés globalement ; gère les grands monorepos sans problème mémoire
|
|
47
|
-
- **Formats de sortie multiples** — knowledge graph JSON, wiki Markdown, Obsidian Vault, cartes de contexte IA, serveur MCP
|
|
47
|
+
- **Formats de sortie multiples** — knowledge graph JSON, wiki Markdown, Obsidian Vault, cartes de contexte IA, serveur MCP, HTML interactif
|
|
48
|
+
- **Exploration visuelle** — `beacon.html` (arbre repliable D3) et `callflow.html` (diagrammes d'architecture Mermaid par communauté) régénérés à chaque scan
|
|
48
49
|
- **Détection de communautés** — clustering Leiden/Louvain révèle les vraies frontières architecturales
|
|
49
|
-
- **Cache incrémental** —
|
|
50
|
+
- **Cache incrémental** — SHA-256 + chemin rapide mtime/size ; les modifications de mtime sans changement de contenu (Obsidian/iCloud/Nextcloud) ne déclenchent jamais une ré-extraction inutile
|
|
51
|
+
- **Promotion de confiance** — les arêtes `calls` inter-fichiers passent de INFERRED à EXTRACTED automatiquement quand un import explicite prouve le binding
|
|
52
|
+
- **Écritures sûres** — beacon.json a un shrink guard (une exécution partielle ne peut jamais écraser un graphe complet) et estampille `built_at_commit` afin que REPORT.md signale les sorties stale par rapport au HEAD courant
|
|
53
|
+
- **Multi-développeur** — `codebeacon hook install` enregistre un git merge driver pour `beacon.json` et un hook post-commit de rebuild incrémental, de sorte que deux devs scannant la même branche ne produisent jamais de conflits de merge sur le graphe
|
|
54
|
+
- **Sortie durcie** — les frontmatter YAML et les labels MCP sont sanitisés : U+2028/U+2029, contrôles C0 et marques bidi sont supprimés avant d'atteindre Obsidian, Cursor ou l'agent
|
|
55
|
+
- **`.codebeaconignore` style gitignore** — last-match-wins avec négation `!`, patterns de répertoire (`build/`), patterns ancrés (`/secrets.txt`), règles sur espaces de fin
|
|
50
56
|
- **Zéro configuration** — détecte automatiquement les frameworks et langages ; génère `codebeacon.yaml` pour les exécutions suivantes
|
|
51
57
|
- **Mode Deep Dive** — `--deep-dive` génère un `.codebeacon/` + `CLAUDE.md` propre à chaque sous-projet ; une commande de mise à jour depuis **n'importe quel** sous-projet synchronise automatiquement tous les projets du workspace
|
|
52
58
|
|
|
@@ -115,8 +121,10 @@ project-root/
|
|
|
115
121
|
.cursorrules ← contexte Cursor IDE (même stratégie de fusion)
|
|
116
122
|
AGENTS.md ← contexte OpenAI Agents / Codex (même stratégie de fusion)
|
|
117
123
|
.codebeacon/
|
|
118
|
-
beacon.json ← knowledge graph complet
|
|
119
|
-
|
|
124
|
+
beacon.json ← knowledge graph complet ; embarque `meta.built_at_commit`
|
|
125
|
+
beacon.html ← visualiseur d'arbre repliable D3 (ouvrir dans un navigateur)
|
|
126
|
+
callflow.html ← diagrammes Mermaid de call-flow groupés par communauté
|
|
127
|
+
REPORT.md ← nœuds dieu, connexions surprenantes, fichiers hub, fraîcheur
|
|
120
128
|
wiki/
|
|
121
129
|
index.md
|
|
122
130
|
overview.md
|
|
@@ -158,6 +166,50 @@ workspace/
|
|
|
158
166
|
.codebeacon/
|
|
159
167
|
```
|
|
160
168
|
|
|
169
|
+
## Exploration visuelle
|
|
170
|
+
|
|
171
|
+
Chaque scan écrit deux fichiers HTML autonomes à côté de `beacon.json` :
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
.codebeacon/beacon.html # arbre repliable D3 v7 — ouvrir dans n'importe quel navigateur
|
|
175
|
+
.codebeacon/callflow.html # diagrammes d'architecture Mermaid, un par communauté
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Pas de build, pas de serveur statique, pas de copier-coller. Ouvre le fichier, clique pour déplier projets → types → nœuds ; survole pour voir le chemin source et le degré. `callflow.html` groupe le graphe par communauté et rend chacune en flowchart Mermaid, avec les arêtes sortantes inter-communautés dans un tableau pliable.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Workflow multi-développeur
|
|
183
|
+
|
|
184
|
+
Deux devs exécutant `codebeacon scan` sur la même branche produisent des `beacon.json` légèrement différents — point chaud historique de conflits de merge. `codebeacon hook install` règle ça :
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
codebeacon hook install # à la racine du repo
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Cela enregistre :
|
|
191
|
+
|
|
192
|
+
- un **git merge driver** qui union-merge deux `beacon.json` en un seul (nœuds dédupliqués par ID, arêtes par `(source, target, relation)`),
|
|
193
|
+
- une entrée `.gitattributes` pointant `*beacon.json` vers le driver,
|
|
194
|
+
- un **hook post-commit** qui lance `codebeacon scan . --update` en arrière-plan pour que le graphe ne soit jamais en retard sur les commits. Sortie dans `~/.cache/codebeacon-rebuild.log`.
|
|
195
|
+
|
|
196
|
+
Le merge driver sort toujours en 0 — la régénération du graphe ne bloque jamais un vrai merge.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Garanties de sécurité
|
|
201
|
+
|
|
202
|
+
Quelques invariants que le writer applique à chaque scan réussi :
|
|
203
|
+
|
|
204
|
+
| Guard | Ce qu'il empêche |
|
|
205
|
+
|---|---|
|
|
206
|
+
| **Shrink guard** | Une extraction partielle ratée ou une exécution interrompue ne peut jamais écraser un `beacon.json` complet plus grand. Bypass via `force=True` depuis l'API. |
|
|
207
|
+
| **Écriture atomique** | `beacon.json` est écrit via `os.replace`, donc le fichier est soit complet soit intact — jamais à moitié écrit. |
|
|
208
|
+
| **Estampille `built_at_commit`** | `beacon.json` embarque `meta.built_at_commit` (SHA complet) et `REPORT.md` affiche le SHA court. Si HEAD a avancé, le rapport marque le graphe comme `⚠ stale` avec un hint d'une ligne. |
|
|
209
|
+
| **Durcissement frontmatter / labels** | Les valeurs YAML sont en single-quoted et échappent U+2028, U+2029, tabulation et contrôles C0 ; la sortie MCP passe chaque label par le même sanitizer. Un identifiant malveillant dans le code source ne peut pas casser le parser YAML d'Obsidian ni injecter de séquences de contrôle dans le contexte d'un agent LLM. |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
161
213
|
## Configuration
|
|
162
214
|
|
|
163
215
|
Exécutez `codebeacon init` pour générer `codebeacon.yaml`, ou créez-le manuellement :
|
|
@@ -194,16 +246,29 @@ deep_dive: false # mettre à true pour une sortie par projet
|
|
|
194
246
|
|
|
195
247
|
### .codebeaconignore
|
|
196
248
|
|
|
197
|
-
Placez un fichier `.codebeaconignore` à la racine du projet pour exclure des répertoires ou fichiers du scan.
|
|
249
|
+
Placez un fichier `.codebeaconignore` à la racine du projet pour exclure des répertoires ou fichiers du scan. Sémantique conforme à `.gitignore` — last-match-wins avec négation `!`, motifs ancrés (`/foo`), motifs uniquement répertoire (`build/`), commentaires :
|
|
198
250
|
|
|
199
251
|
```
|
|
200
252
|
# .codebeaconignore
|
|
201
|
-
|
|
253
|
+
|
|
254
|
+
# répertoires
|
|
202
255
|
build/
|
|
203
|
-
|
|
256
|
+
generated/
|
|
204
257
|
fixtures/
|
|
258
|
+
|
|
259
|
+
# ancré à la racine uniquement
|
|
260
|
+
/scripts/local-only.ts
|
|
261
|
+
|
|
262
|
+
# motifs glob
|
|
263
|
+
*.gen.ts
|
|
264
|
+
**/snapshots/**
|
|
265
|
+
|
|
266
|
+
# ré-inclure un fichier même si build/ est ignoré
|
|
267
|
+
!build/manifest.ts
|
|
205
268
|
```
|
|
206
269
|
|
|
270
|
+
`!pattern` ré-inclut un chemin précédemment ignoré ; les règles ultérieures écrasent les précédentes. Le walker élague les répertoires dont le nom matche, mais reporte l'élagage quand une règle de négation pourrait ré-inclure un fichier imbriqué.
|
|
271
|
+
|
|
207
272
|
---
|
|
208
273
|
|
|
209
274
|
## Intégration IA
|
|
@@ -299,8 +364,12 @@ codebeacon scan /workspace --deep-dive # sortie par projet + workspace combin
|
|
|
299
364
|
codebeacon init [chemin] # générer codebeacon.yaml
|
|
300
365
|
codebeacon sync # exécuter depuis codebeacon.yaml
|
|
301
366
|
|
|
302
|
-
codebeacon query <terme>
|
|
303
|
-
codebeacon path <source> <cible>
|
|
367
|
+
codebeacon query <terme> [--dir .codebeacon] [--limit N] # rechercher des nœuds par sous-chaîne de label
|
|
368
|
+
codebeacon path <source> <cible> [--dir .codebeacon] # chemin de dépendances le plus court
|
|
369
|
+
|
|
370
|
+
# Support multi-développeur (git plumbing)
|
|
371
|
+
codebeacon hook install [path] # installer merge driver + hook post-commit incrémental
|
|
372
|
+
codebeacon merge-driver <base> <cur> <other> # invoqué par git après `hook install` ; union-merge de beacon.json
|
|
304
373
|
|
|
305
374
|
codebeacon serve [--dir .codebeacon] # serveur MCP (stdio)
|
|
306
375
|
codebeacon install # installer le skill Claude Code
|