codebeacon 0.2.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. {codebeacon-0.2.0 → codebeacon-0.3.1}/PKG-INFO +92 -13
  2. {codebeacon-0.2.0 → codebeacon-0.3.1}/README.de.md +81 -10
  3. {codebeacon-0.2.0 → codebeacon-0.3.1}/README.es.md +81 -10
  4. {codebeacon-0.2.0 → codebeacon-0.3.1}/README.fr.md +81 -10
  5. {codebeacon-0.2.0 → codebeacon-0.3.1}/README.ja.md +82 -11
  6. {codebeacon-0.2.0 → codebeacon-0.3.1}/README.ko.md +83 -12
  7. {codebeacon-0.2.0 → codebeacon-0.3.1}/README.md +91 -12
  8. {codebeacon-0.2.0 → codebeacon-0.3.1}/README.pt-BR.md +81 -10
  9. {codebeacon-0.2.0 → codebeacon-0.3.1}/README.zh-CN.md +82 -11
  10. codebeacon-0.3.1/codebeacon/__init__.py +1 -0
  11. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/cache.py +55 -4
  12. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/cli.py +210 -50
  13. codebeacon-0.3.1/codebeacon/common/safety.py +90 -0
  14. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/config.py +57 -0
  15. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/contextmap/generator.py +51 -20
  16. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/discover/detector.py +44 -4
  17. codebeacon-0.3.1/codebeacon/discover/ignore.py +172 -0
  18. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/discover/scanner.py +37 -26
  19. codebeacon-0.3.1/codebeacon/export/callflow_html.py +221 -0
  20. codebeacon-0.3.1/codebeacon/export/hooks.py +131 -0
  21. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/export/mcp.py +16 -10
  22. codebeacon-0.3.1/codebeacon/export/merge.py +118 -0
  23. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/export/obsidian.py +26 -14
  24. codebeacon-0.3.1/codebeacon/export/tree_html.py +295 -0
  25. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/graph/analyze.py +14 -1
  26. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/graph/enrich.py +60 -4
  27. codebeacon-0.3.1/codebeacon/graph/write.py +193 -0
  28. codebeacon-0.3.1/codebeacon/plugins/__init__.py +1 -0
  29. codebeacon-0.3.1/codebeacon/plugins/githooks.py +238 -0
  30. codebeacon-0.3.1/codebeacon/plugins/skills.py +147 -0
  31. {codebeacon-0.2.0 → codebeacon-0.3.1}/pyproject.toml +1 -1
  32. codebeacon-0.3.1/tests/test_plugins.py +276 -0
  33. codebeacon-0.3.1/tests/test_safety_and_writes.py +315 -0
  34. codebeacon-0.2.0/codebeacon/__init__.py +0 -1
  35. {codebeacon-0.2.0 → codebeacon-0.3.1}/.cursorrules +0 -0
  36. {codebeacon-0.2.0 → codebeacon-0.3.1}/.github/CODEOWNERS +0 -0
  37. {codebeacon-0.2.0 → codebeacon-0.3.1}/.github/dependabot.yml +0 -0
  38. {codebeacon-0.2.0 → codebeacon-0.3.1}/.github/workflows/ci.yml +0 -0
  39. {codebeacon-0.2.0 → codebeacon-0.3.1}/.github/workflows/release.yml +0 -0
  40. {codebeacon-0.2.0 → codebeacon-0.3.1}/.gitignore +0 -0
  41. {codebeacon-0.2.0 → codebeacon-0.3.1}/AGENTS.md +0 -0
  42. {codebeacon-0.2.0 → codebeacon-0.3.1}/CLAUDE.md +0 -0
  43. {codebeacon-0.2.0 → codebeacon-0.3.1}/LICENSE +0 -0
  44. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/__main__.py +0 -0
  45. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/common/__init__.py +0 -0
  46. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/common/filters.py +0 -0
  47. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/common/symbols.py +0 -0
  48. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/common/types.py +0 -0
  49. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/contextmap/__init__.py +0 -0
  50. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/discover/__init__.py +0 -0
  51. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/export/__init__.py +0 -0
  52. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/__init__.py +0 -0
  53. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/base.py +0 -0
  54. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/components.py +0 -0
  55. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/dependencies.py +0 -0
  56. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/entities.py +0 -0
  57. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/README.md +0 -0
  58. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/actix.scm +0 -0
  59. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/angular.scm +0 -0
  60. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/aspnet.scm +0 -0
  61. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/django.scm +0 -0
  62. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/express.scm +0 -0
  63. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/fastapi.scm +0 -0
  64. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/flask.scm +0 -0
  65. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/gin.scm +0 -0
  66. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/ktor.scm +0 -0
  67. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/laravel.scm +0 -0
  68. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/nestjs.scm +0 -0
  69. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/rails.scm +0 -0
  70. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/react.scm +0 -0
  71. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/spring_boot.scm +0 -0
  72. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/svelte.scm +0 -0
  73. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/tauri.scm +0 -0
  74. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/vapor.scm +0 -0
  75. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/queries/vue.scm +0 -0
  76. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/routes.py +0 -0
  77. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/semantic.py +0 -0
  78. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/extract/services.py +0 -0
  79. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/graph/__init__.py +0 -0
  80. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/graph/build.py +0 -0
  81. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/graph/cluster.py +0 -0
  82. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/skill/SKILL.md +0 -0
  83. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/wave.py +0 -0
  84. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/wiki/__init__.py +0 -0
  85. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/wiki/generator.py +0 -0
  86. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/wiki/index.py +0 -0
  87. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon/wiki/templates.py +0 -0
  88. {codebeacon-0.2.0 → codebeacon-0.3.1}/codebeacon.yaml.example +0 -0
  89. {codebeacon-0.2.0 → codebeacon-0.3.1}/docs/TRANSLATION_STATUS.md +0 -0
  90. {codebeacon-0.2.0 → codebeacon-0.3.1}/public-plan.md +0 -0
  91. {codebeacon-0.2.0 → codebeacon-0.3.1}/skill/SKILL.md +0 -0
  92. {codebeacon-0.2.0 → codebeacon-0.3.1}/skill/install.py +0 -0
  93. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/__init__.py +0 -0
  94. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/conftest.py +0 -0
  95. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/actix/main.rs +0 -0
  96. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/angular/app.component.ts +0 -0
  97. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/aspnet/UserController.cs +0 -0
  98. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/django/views.py +0 -0
  99. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/express/userRouter.js +0 -0
  100. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/fastapi/main.py +0 -0
  101. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/flask/app.py +0 -0
  102. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/gin/main.go +0 -0
  103. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/ktor/UserRoutes.kt +0 -0
  104. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/laravel/UserController.php +0 -0
  105. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/nestjs/user.controller.ts +0 -0
  106. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/rails/users_controller.rb +0 -0
  107. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/react/UserPage.tsx +0 -0
  108. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/spring_boot/UserController.java +0 -0
  109. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/sveltekit/+page.svelte +0 -0
  110. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/vapor/routes.swift +0 -0
  111. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/fixtures/vue/UserList.vue +0 -0
  112. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/test_discover.py +0 -0
  113. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/test_entities.py +0 -0
  114. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/test_filters.py +0 -0
  115. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/test_graph.py +0 -0
  116. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/test_resolve.py +0 -0
  117. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/test_routes.py +0 -0
  118. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/test_services.py +0 -0
  119. {codebeacon-0.2.0 → codebeacon-0.3.1}/tests/test_wiki.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codebeacon
3
- Version: 0.2.0
3
+ Version: 0.3.1
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,11 +85,18 @@ 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 based; only re-extracts files that changed since the last scan
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
99
+ - **Workspace auto-rediscovery** — on every `scan` / `sync`, codebeacon re-scans the workspace and appends any new project folders to `codebeacon.yaml` before extraction, so freshly added sub-projects are never silently skipped; pass `--no-rediscover` to opt out for hand-curated configs
93
100
 
94
101
  ---
95
102
 
@@ -159,8 +166,10 @@ project-root/
159
166
  .cursorrules ← Cursor IDE context (same merge strategy)
160
167
  AGENTS.md ← OpenAI Agents / Codex context (same merge strategy)
161
168
  .codebeacon/
162
- beacon.json ← full knowledge graph (node-link JSON, queryable)
163
- REPORT.md god nodes, surprising connections, hub files
169
+ beacon.json ← full knowledge graph; embeds `meta.built_at_commit`
170
+ beacon.html D3 collapsible-tree viewer (open in browser)
171
+ callflow.html ← Mermaid call-flow diagrams grouped by community
172
+ REPORT.md ← god nodes, surprising connections, hub files, freshness
164
173
  wiki/
165
174
  index.md ← global index (~200 tokens)
166
175
  overview.md ← platform stats + cross-project connections
@@ -307,7 +316,7 @@ All language parsers (Java, Kotlin, Python, JavaScript, TypeScript, Go, Ruby, PH
307
316
  codebeacon scan <path> [options]
308
317
  codebeacon scan . # current directory
309
318
  codebeacon scan /workspace # workspace root (multi-project)
310
- codebeacon scan . --update # incremental: only re-extract changed files
319
+ codebeacon scan . --update # incremental: mtime/size fast path + content-hash fallback
311
320
  codebeacon scan . --wiki-only # skip re-extraction, regenerate wiki/obsidian/context map from existing beacon.json
312
321
  codebeacon scan . --obsidian-dir <path> # write Obsidian vault to custom location
313
322
  codebeacon scan . --semantic # enable LLM semantic extraction
@@ -316,12 +325,17 @@ codebeacon scan /workspace --deep-dive # per-project + combined workspace out
316
325
 
317
326
  # Config-driven mode
318
327
  codebeacon init [path] # auto-generate codebeacon.yaml
319
- codebeacon sync # run from codebeacon.yaml
328
+ codebeacon sync # run from codebeacon.yaml (auto-appends new workspace projects)
320
329
  codebeacon sync --config <file> # use a specific config file
330
+ codebeacon sync --no-rediscover # don't auto-append newly added projects (hand-curated yaml mode)
321
331
 
322
- # Query the knowledge graph (coming soon)
323
- codebeacon query <term> # search nodes and edges
324
- codebeacon path <source> <target> # shortest path between two nodes
332
+ # Query the knowledge graph
333
+ codebeacon query <term> [--dir .codebeacon] [--limit N] # search nodes by label substring
334
+ codebeacon path <source> <target> [--dir .codebeacon] # shortest dependency path
335
+
336
+ # Multi-developer support (git plumbing)
337
+ codebeacon hook install [path] # install merge driver + post-commit incremental rebuild
338
+ codebeacon merge-driver <base> <cur> <other> # invoked by git after `hook install`; union-merges beacon.json
325
339
 
326
340
  # Integrations
327
341
  codebeacon serve [--dir .codebeacon] # start MCP server (stdio)
@@ -330,6 +344,58 @@ codebeacon install # install Claude Code skill
330
344
 
331
345
  ---
332
346
 
347
+ ## Visual Exploration
348
+
349
+ Every scan writes two self-contained HTML files alongside `beacon.json`:
350
+
351
+ ```
352
+ .codebeacon/beacon.html # D3 v7 collapsible tree — open in any browser
353
+ .codebeacon/callflow.html # Mermaid architecture diagrams, one per community
354
+ ```
355
+
356
+ No build step, no static server, no copy-paste. Open the file, click to expand
357
+ projects → types → nodes; hover for source paths and degree. `callflow.html`
358
+ groups your graph by community and renders each as a Mermaid flowchart, with
359
+ the cross-community out-edges listed in a collapsed table.
360
+
361
+ ---
362
+
363
+ ## Multi-Developer Workflow
364
+
365
+ Two developers running `codebeacon scan` on the same branch produce two
366
+ slightly different `beacon.json` files — historically a merge conflict
367
+ hotspot. `codebeacon hook install` solves this:
368
+
369
+ ```bash
370
+ codebeacon hook install # in the repo root
371
+ ```
372
+
373
+ This registers:
374
+
375
+ - a **git merge driver** that union-merges two `beacon.json` files into one
376
+ (nodes deduped by ID, edges deduped by `(source, target, relation)`),
377
+ - a `.gitattributes` entry pointing `*beacon.json` at the driver,
378
+ - a **post-commit hook** that runs `codebeacon scan . --update` in the
379
+ background so the graph never falls behind your commits. Output goes to
380
+ `~/.cache/codebeacon-rebuild.log`.
381
+
382
+ The merge driver always exits 0 — a graph regen never blocks a real merge.
383
+
384
+ ---
385
+
386
+ ## Safety Guarantees
387
+
388
+ A few invariants the writer enforces on every successful scan:
389
+
390
+ | Guard | What it prevents |
391
+ |---|---|
392
+ | **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. |
393
+ | **Atomic write** | `beacon.json` is written via `os.replace`, so the file is either complete or untouched — no half-written graphs. |
394
+ | **`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. |
395
+ | **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. |
396
+
397
+ ---
398
+
333
399
  ## Configuration
334
400
 
335
401
  Run `codebeacon init` to generate `codebeacon.yaml`, or write it manually:
@@ -366,16 +432,29 @@ deep_dive: false # set to true to generate per-project outputs
366
432
 
367
433
  ### .codebeaconignore
368
434
 
369
- Place a `.codebeaconignore` file at your project root to exclude directories or files from scanning. Syntax is the same as `.gitignore` — one pattern per line, `#` for comments.
435
+ 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
436
 
371
437
  ```
372
438
  # .codebeaconignore
373
- generated/
439
+
440
+ # directories
374
441
  build/
375
- *.generated.ts
442
+ generated/
376
443
  fixtures/
444
+
445
+ # anchored to root only
446
+ /scripts/local-only.ts
447
+
448
+ # glob patterns
449
+ *.gen.ts
450
+ **/snapshots/**
451
+
452
+ # re-include a specific file even though build/ is ignored
453
+ !build/manifest.ts
377
454
  ```
378
455
 
456
+ `!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.
457
+
379
458
  ---
380
459
 
381
460
  ## How It Compares
@@ -44,11 +44,18 @@ 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-basiert; extrahiert nur seit dem letzten Scan geänderte Dateien neu
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
58
+ - **Automatische Workspace-Wiedererkennung** — bei jedem `scan`/`sync` scannt codebeacon den Workspace erneut und hängt vor der Extraktion automatisch neue Projekte an die `codebeacon.yaml` an, sodass frisch hinzugefügte Sub-Projekte nicht unbemerkt übersprungen werden; `--no-rediscover` deaktiviert dies für handgepflegte Konfigurationen
52
59
 
53
60
  ---
54
61
 
@@ -116,8 +123,10 @@ project-root/
116
123
  .cursorrules ← Cursor-IDE-Kontext (gleiche Merge-Strategie)
117
124
  AGENTS.md ← OpenAI-Agents-/Codex-Kontext (gleiche Merge-Strategie)
118
125
  .codebeacon/
119
- beacon.json ← vollständiger Knowledge Graph (Node-Link-JSON, abfragbar)
120
- REPORT.md God-Nodes, überraschende Verbindungen, Hub-Dateien
126
+ beacon.json ← vollständiger Knowledge Graph; bettet `meta.built_at_commit` ein
127
+ beacon.html D3-Baum-Viewer (im Browser öffnen)
128
+ callflow.html ← Mermaid-Call-Flow-Diagramme, nach Community gruppiert
129
+ REPORT.md ← God-Nodes, überraschende Verbindungen, Hub-Dateien, Frische
121
130
  wiki/
122
131
  index.md
123
132
  overview.md
@@ -159,6 +168,50 @@ workspace/
159
168
  .codebeacon/ ← frontend-Graph
160
169
  ```
161
170
 
171
+ ## Visuelle Exploration
172
+
173
+ Jeder Scan schreibt zwei eigenständige HTML-Dateien neben `beacon.json`:
174
+
175
+ ```
176
+ .codebeacon/beacon.html # D3 v7 einklappbarer Baum — in jedem Browser öffnen
177
+ .codebeacon/callflow.html # Mermaid-Architekturdiagramme, eines pro Community
178
+ ```
179
+
180
+ 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.
181
+
182
+ ---
183
+
184
+ ## Multi-Entwickler-Workflow
185
+
186
+ 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:
187
+
188
+ ```bash
189
+ codebeacon hook install # im Repo-Root
190
+ ```
191
+
192
+ Es registriert:
193
+
194
+ - einen **git-Merge-Driver**, der zwei `beacon.json` per Union zu einer zusammenführt (Knoten per ID, Kanten per `(source, target, relation)` dedupliziert),
195
+ - einen `.gitattributes`-Eintrag, der `*beacon.json` auf den Driver verweist,
196
+ - 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`.
197
+
198
+ Der Merge-Driver beendet sich immer mit 0 — eine Graph-Regeneration blockiert niemals einen echten Merge.
199
+
200
+ ---
201
+
202
+ ## Sicherheitsgarantien
203
+
204
+ Invarianten, die der Writer bei jedem erfolgreichen Scan durchsetzt:
205
+
206
+ | Guard | Was er verhindert |
207
+ |---|---|
208
+ | **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. |
209
+ | **Atomares Schreiben** | `beacon.json` wird via `os.replace` geschrieben, die Datei ist also entweder komplett oder unangetastet — niemals halb geschrieben. |
210
+ | **`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. |
211
+ | **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. |
212
+
213
+ ---
214
+
162
215
  ## Konfiguration
163
216
 
164
217
  Führe `codebeacon init` aus, um `codebeacon.yaml` zu generieren, oder erstelle die Datei manuell:
@@ -195,16 +248,29 @@ deep_dive: false # auf true setzen für Pro-Projekt-Ausgabe
195
248
 
196
249
  ### .codebeaconignore
197
250
 
198
- Platziere eine `.codebeaconignore`-Datei im Projektstammverzeichnis, um Verzeichnisse oder Dateien vom Scan auszuschließen. Gleiche Syntax wie `.gitignore` — ein Muster pro Zeile, `#` für Kommentare.
251
+ 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
252
 
200
253
  ```
201
254
  # .codebeaconignore
202
- generated/
255
+
256
+ # Verzeichnisse
203
257
  build/
204
- *.generated.ts
258
+ generated/
205
259
  fixtures/
260
+
261
+ # nur am Root verankert
262
+ /scripts/local-only.ts
263
+
264
+ # Glob-Muster
265
+ *.gen.ts
266
+ **/snapshots/**
267
+
268
+ # eine Datei wieder einschließen, auch wenn build/ ignoriert ist
269
+ !build/manifest.ts
206
270
  ```
207
271
 
272
+ `!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.
273
+
208
274
  ---
209
275
 
210
276
  ## KI-Integration
@@ -298,10 +364,15 @@ codebeacon scan . --list-only # nur Frameworks erkennen
298
364
  codebeacon scan /workspace --deep-dive # Pro-Projekt- + kombinierte Workspace-Ausgabe
299
365
 
300
366
  codebeacon init [pfad] # codebeacon.yaml generieren
301
- codebeacon sync # von codebeacon.yaml ausführen
367
+ codebeacon sync # von codebeacon.yaml ausführen (hängt neue Workspace-Projekte automatisch an)
368
+ codebeacon sync --no-rediscover # neue Projekte nicht automatisch anhängen (handgepflegter yaml-Modus)
369
+
370
+ codebeacon query <Begriff> [--dir .codebeacon] [--limit N] # Knoten per Label-Substring suchen
371
+ codebeacon path <Quelle> <Ziel> [--dir .codebeacon] # kürzester Abhängigkeitspfad
302
372
 
303
- codebeacon query <Begriff> # Graph durchsuchen (demnächst)
304
- codebeacon path <Quelle> <Ziel> # kürzester Pfad zwischen zwei Knoten
373
+ # Multi-Entwickler-Support (git plumbing)
374
+ codebeacon hook install [path] # Merge-Driver + Post-Commit-Inkrement-Rebuild installieren
375
+ codebeacon merge-driver <base> <cur> <other> # von git nach `hook install` aufgerufen; Union-Merge von beacon.json
305
376
 
306
377
  codebeacon serve [--dir .codebeacon] # MCP-Server starten (stdio)
307
378
  codebeacon install # Claude-Code-Skill installieren
@@ -44,11 +44,18 @@ 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** — basado en SHA-256; solo re-extrae archivos modificados desde el último escaneo
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
58
+ - **Auto-redescubrimiento del workspace** — en cada `scan`/`sync`, codebeacon re-escanea el workspace y añade automáticamente al `codebeacon.yaml` los nuevos proyectos antes de extraer, de modo que los sub-proyectos recién añadidos nunca se omitan silenciosamente; usa `--no-rediscover` para optar por el modo de configuración curada manualmente
52
59
 
53
60
  ---
54
61
 
@@ -115,8 +122,10 @@ project-root/
115
122
  .cursorrules ← contexto para Cursor IDE (misma estrategia de fusión)
116
123
  AGENTS.md ← contexto para OpenAI Agents / Codex (misma estrategia de fusión)
117
124
  .codebeacon/
118
- beacon.json ← grafo de conocimiento completo (JSON node-link, consultable)
119
- REPORT.md nodos dios, conexiones sorprendentes, archivos hub
125
+ beacon.json ← grafo de conocimiento completo; incrusta `meta.built_at_commit`
126
+ beacon.html visor de árbol colapsable D3 (abrir en cualquier navegador)
127
+ callflow.html ← diagramas Mermaid de call-flow agrupados por comunidad
128
+ REPORT.md ← nodos dios, conexiones sorprendentes, archivos hub, frescura
120
129
  wiki/
121
130
  index.md
122
131
  overview.md
@@ -158,6 +167,50 @@ workspace/
158
167
  .codebeacon/
159
168
  ```
160
169
 
170
+ ## Exploración visual
171
+
172
+ Cada escaneo escribe dos archivos HTML autocontenidos junto a `beacon.json`:
173
+
174
+ ```
175
+ .codebeacon/beacon.html # árbol colapsable D3 v7 — abrir en cualquier navegador
176
+ .codebeacon/callflow.html # diagramas Mermaid de arquitectura, uno por comunidad
177
+ ```
178
+
179
+ 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.
180
+
181
+ ---
182
+
183
+ ## Flujo multi-desarrollador
184
+
185
+ 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:
186
+
187
+ ```bash
188
+ codebeacon hook install # en la raíz del repo
189
+ ```
190
+
191
+ Registra:
192
+
193
+ - un **git merge driver** que union-mergea dos `beacon.json` en uno (nodos deduplicados por ID, edges deduplicados por `(source, target, relation)`),
194
+ - una entrada `.gitattributes` apuntando `*beacon.json` al driver,
195
+ - 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`.
196
+
197
+ El merge driver siempre sale con 0 — la regeneración del grafo nunca bloquea un merge real.
198
+
199
+ ---
200
+
201
+ ## Garantías de seguridad
202
+
203
+ Invariantes que el writer impone en cada escaneo exitoso:
204
+
205
+ | Guard | Lo que previene |
206
+ |---|---|
207
+ | **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. |
208
+ | **Escritura atómica** | `beacon.json` se escribe vía `os.replace`, así que el archivo está completo o intacto — nunca a medio escribir. |
209
+ | **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. |
210
+ | **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. |
211
+
212
+ ---
213
+
161
214
  ## Configuración
162
215
 
163
216
  Ejecuta `codebeacon init` para generar `codebeacon.yaml`, o escríbelo manualmente:
@@ -194,16 +247,29 @@ deep_dive: false # establecer true para salida por proyecto
194
247
 
195
248
  ### .codebeaconignore
196
249
 
197
- Coloca un archivo `.codebeaconignore` en la raíz del proyecto para excluir directorios o archivos del escaneo. Misma sintaxis que `.gitignore` — un patrón por línea, `#` para comentarios.
250
+ 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
251
 
199
252
  ```
200
253
  # .codebeaconignore
201
- generated/
254
+
255
+ # directorios
202
256
  build/
203
- *.generated.ts
257
+ generated/
204
258
  fixtures/
259
+
260
+ # anclado solo a la raíz
261
+ /scripts/local-only.ts
262
+
263
+ # patrones glob
264
+ *.gen.ts
265
+ **/snapshots/**
266
+
267
+ # re-incluir un archivo aunque build/ esté ignorado
268
+ !build/manifest.ts
205
269
  ```
206
270
 
271
+ `!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.
272
+
207
273
  ---
208
274
 
209
275
  ## Integración con IA
@@ -297,10 +363,15 @@ codebeacon scan . --list-only # solo detectar frameworks
297
363
  codebeacon scan /workspace --deep-dive # salida por proyecto + workspace combinado
298
364
 
299
365
  codebeacon init [ruta] # generar codebeacon.yaml
300
- codebeacon sync # ejecutar desde codebeacon.yaml
366
+ codebeacon sync # ejecutar desde codebeacon.yaml (añade nuevos proyectos del workspace automáticamente)
367
+ codebeacon sync --no-rediscover # no añadir automáticamente nuevos proyectos (modo yaml curado a mano)
368
+
369
+ codebeacon query <término> [--dir .codebeacon] [--limit N] # buscar nodos por substring de etiqueta
370
+ codebeacon path <origen> <destino> [--dir .codebeacon] # ruta más corta de dependencias
301
371
 
302
- codebeacon query <término> # buscar en el grafo (próximamente)
303
- codebeacon path <origen> <destino> # ruta más corta entre dos nodos
372
+ # Soporte multi-desarrollador (git plumbing)
373
+ codebeacon hook install [path] # instala merge driver + hook post-commit incremental
374
+ codebeacon merge-driver <base> <cur> <other> # invocado por git tras `hook install`; union-merge de beacon.json
304
375
 
305
376
  codebeacon serve [--dir .codebeacon] # servidor MCP (stdio)
306
377
  codebeacon install # instalar skill de Claude Code
@@ -44,11 +44,18 @@ 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** — basé sur SHA-256 ; ré-extrait uniquement les fichiers modifiés depuis le dernier scan
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
58
+ - **Redécouverte automatique du workspace** — à chaque `scan`/`sync`, codebeacon réanalyse le workspace et ajoute automatiquement les nouveaux projets au `codebeacon.yaml` avant l'extraction, de sorte que les sous-projets fraîchement ajoutés ne soient jamais oubliés en silence ; utilisez `--no-rediscover` pour conserver une configuration yaml gérée manuellement
52
59
 
53
60
  ---
54
61
 
@@ -115,8 +122,10 @@ project-root/
115
122
  .cursorrules ← contexte Cursor IDE (même stratégie de fusion)
116
123
  AGENTS.md ← contexte OpenAI Agents / Codex (même stratégie de fusion)
117
124
  .codebeacon/
118
- beacon.json ← knowledge graph complet (JSON node-link, interrogeable)
119
- REPORT.md nœuds dieu, connexions surprenantes, fichiers hub
125
+ beacon.json ← knowledge graph complet ; embarque `meta.built_at_commit`
126
+ beacon.html visualiseur d'arbre repliable D3 (ouvrir dans un navigateur)
127
+ callflow.html ← diagrammes Mermaid de call-flow groupés par communauté
128
+ REPORT.md ← nœuds dieu, connexions surprenantes, fichiers hub, fraîcheur
120
129
  wiki/
121
130
  index.md
122
131
  overview.md
@@ -158,6 +167,50 @@ workspace/
158
167
  .codebeacon/
159
168
  ```
160
169
 
170
+ ## Exploration visuelle
171
+
172
+ Chaque scan écrit deux fichiers HTML autonomes à côté de `beacon.json` :
173
+
174
+ ```
175
+ .codebeacon/beacon.html # arbre repliable D3 v7 — ouvrir dans n'importe quel navigateur
176
+ .codebeacon/callflow.html # diagrammes d'architecture Mermaid, un par communauté
177
+ ```
178
+
179
+ 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.
180
+
181
+ ---
182
+
183
+ ## Workflow multi-développeur
184
+
185
+ 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 :
186
+
187
+ ```bash
188
+ codebeacon hook install # à la racine du repo
189
+ ```
190
+
191
+ Cela enregistre :
192
+
193
+ - 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)`),
194
+ - une entrée `.gitattributes` pointant `*beacon.json` vers le driver,
195
+ - 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`.
196
+
197
+ Le merge driver sort toujours en 0 — la régénération du graphe ne bloque jamais un vrai merge.
198
+
199
+ ---
200
+
201
+ ## Garanties de sécurité
202
+
203
+ Quelques invariants que le writer applique à chaque scan réussi :
204
+
205
+ | Guard | Ce qu'il empêche |
206
+ |---|---|
207
+ | **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. |
208
+ | **Écriture atomique** | `beacon.json` est écrit via `os.replace`, donc le fichier est soit complet soit intact — jamais à moitié écrit. |
209
+ | **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. |
210
+ | **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. |
211
+
212
+ ---
213
+
161
214
  ## Configuration
162
215
 
163
216
  Exécutez `codebeacon init` pour générer `codebeacon.yaml`, ou créez-le manuellement :
@@ -194,16 +247,29 @@ deep_dive: false # mettre à true pour une sortie par projet
194
247
 
195
248
  ### .codebeaconignore
196
249
 
197
- Placez un fichier `.codebeaconignore` à la racine du projet pour exclure des répertoires ou fichiers du scan. Même syntaxe que `.gitignore` — un motif par ligne, `#` pour les commentaires.
250
+ 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
251
 
199
252
  ```
200
253
  # .codebeaconignore
201
- generated/
254
+
255
+ # répertoires
202
256
  build/
203
- *.generated.ts
257
+ generated/
204
258
  fixtures/
259
+
260
+ # ancré à la racine uniquement
261
+ /scripts/local-only.ts
262
+
263
+ # motifs glob
264
+ *.gen.ts
265
+ **/snapshots/**
266
+
267
+ # ré-inclure un fichier même si build/ est ignoré
268
+ !build/manifest.ts
205
269
  ```
206
270
 
271
+ `!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é.
272
+
207
273
  ---
208
274
 
209
275
  ## Intégration IA
@@ -297,10 +363,15 @@ codebeacon scan . --list-only # détecter les frameworks uniquement
297
363
  codebeacon scan /workspace --deep-dive # sortie par projet + workspace combiné
298
364
 
299
365
  codebeacon init [chemin] # générer codebeacon.yaml
300
- codebeacon sync # exécuter depuis codebeacon.yaml
366
+ codebeacon sync # exécuter depuis codebeacon.yaml (ajoute automatiquement les nouveaux projets du workspace)
367
+ codebeacon sync --no-rediscover # ne pas ajouter automatiquement les nouveaux projets (mode yaml géré manuellement)
368
+
369
+ codebeacon query <terme> [--dir .codebeacon] [--limit N] # rechercher des nœuds par sous-chaîne de label
370
+ codebeacon path <source> <cible> [--dir .codebeacon] # chemin de dépendances le plus court
301
371
 
302
- codebeacon query <terme> # rechercher dans le graphe (bientôt)
303
- codebeacon path <source> <cible> # chemin le plus court entre deux nœuds
372
+ # Support multi-développeur (git plumbing)
373
+ codebeacon hook install [path] # installer merge driver + hook post-commit incrémental
374
+ codebeacon merge-driver <base> <cur> <other> # invoqué par git après `hook install` ; union-merge de beacon.json
304
375
 
305
376
  codebeacon serve [--dir .codebeacon] # serveur MCP (stdio)
306
377
  codebeacon install # installer le skill Claude Code