living-documentation 7.11.0 → 7.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,18 @@ No cloud, no database, no build step — just point it at a folder where you add
10
10
 
11
11
  ## Features
12
12
 
13
+ ### Reliability gauge — keep your docs honest
14
+
15
+ Living Documentation's flagship feature: each document can be **bound to the source files it describes**, so you can see at a glance whether it has drifted from the code.
16
+
17
+ - **Bind source files** to any doc via the `🗂 Metadata` button in the doc header — pick any file under `sourceRoot` (your project root, configurable in Admin). Each binding stores the file's SHA-256 hash.
18
+ - **Reliability gauge** in the sticky doc header — a red → orange → yellow → green gradient bar that fills up as `reliability = unchanged / total`. If every bound file still matches its hash, the bar is full and green; as soon as one file is modified or deleted, the gauge drops and the colour shifts. Hidden when the doc has no bindings. Click it to open the metadata modal.
19
+ - **Metadata Files popup** (top bar `📁 Metadata Files`) — central place to list, **replace** or **delete** every file uploaded under `DOCS_FOLDER/files/` (PDFs, specs, mockups attached to docs). After a replace/delete, the popup closes and the search bar is auto-filled with `metadata://<filename>` so you immediately see which documents still reference it.
20
+ - **`metadata://<filename>` search prefix** — reverse-lookup documents by the source files they're bound to. Useful to answer "which docs am I supposed to update now that I've changed this PDF/class/module?".
21
+ - **MCP tools** (`list_metadata`, `get_accuracy`, `add_metadata`, `refresh_metadata`) — AI agents can detect drift, read the source & the doc, rewrite the doc and re-baseline the hashes autonomously.
22
+
23
+ ### Other features
24
+
13
25
  - **Sidebar** grouped by folder → category, sorted alphabetically; **General** always first
14
26
  [![README Diagrams](./images/readme-sidebar.png)](/diagram?id=d1775399110713)
15
27
 
@@ -224,16 +236,21 @@ living-documentation/
224
236
  │ │ ├── wordcloud.ts Word cloud raw text reader
225
237
  │ │ ├── diagrams.ts Diagrams CRUD API (vis-network JSON)
226
238
  │ │ ├── annotations.ts Per-document highlight markers API
239
+ │ │ ├── metadata.ts Source-file bindings + reliability report
240
+ │ │ ├── browse-source.ts Source tree navigator (rooted at sourceRoot)
227
241
  │ │ └── export.ts HTML export (PDF, Notion, Confluence zip)
228
242
  │ ├── mcp/
229
243
  │ │ ├── server.ts Model Context Protocol server (Streamable HTTP)
230
244
  │ │ └── tools/
231
245
  │ │ ├── documents.ts MCP tools: list/read/create document
232
246
  │ │ ├── diagrams.ts MCP tools: list/read/create diagram
233
- │ │ └── source.ts MCP tools: list/read/search source files
247
+ │ │ ├── source.ts MCP tools: list/read/search source files
248
+ │ │ └── metadata.ts MCP tools: list_metadata, get_accuracy, add_metadata, refresh_metadata
234
249
  │ ├── lib/
235
250
  │ │ ├── parser.ts Filename parser
236
- │ │ └── config.ts Config management (.living-doc.json)
251
+ │ │ ├── config.ts Config management (.living-doc.json)
252
+ │ │ ├── metadata.ts .metadata.json store + reliability formula
253
+ │ │ └── hash.ts sha256File helper
237
254
  │ └── frontend/
238
255
  │ ├── index.html Main viewer shell
239
256
  │ ├── admin.html Admin panel
@@ -271,6 +288,14 @@ living-documentation/
271
288
  | `POST` | `/api/browse/mkdir` | Create a new folder under the docs root |
272
289
  | `POST` | `/api/images/upload` | Upload a base64 image; saved to `DOCS_FOLDER/images/` |
273
290
  | `POST` | `/api/files/upload` | Upload a base64 file attachment; saved to `DOCS_FOLDER/files/` |
291
+ | `GET` | `/api/files` | List every file under `DOCS_FOLDER/files/` (chronological) |
292
+ | `PUT` | `/api/files/:filename` | Replace an existing attachment with a new base64 payload |
293
+ | `DELETE` | `/api/files/:filename` | Delete an attachment |
294
+ | `GET` | `/api/metadata/:docId` | Reliability report for one doc (per-entry status + score) |
295
+ | `POST` | `/api/metadata/:docId` | Add or replace a source-file binding for a doc |
296
+ | `DELETE` | `/api/metadata/:docId` | Remove a binding |
297
+ | `POST` | `/api/metadata/:docId/refresh` | Re-hash all bindings (re-baseline after the doc has been updated) |
298
+ | `GET` | `/api/browse-source?path=` | Navigate the source tree rooted at `sourceRoot` |
274
299
  | `GET` | `/api/diagrams` | List saved diagrams |
275
300
  | `GET` | `/api/diagrams/:id` | Read a single diagram (nodes + edges) |
276
301
  | `PUT` | `/api/diagrams/:id` | Create or update a diagram |
@@ -317,6 +342,10 @@ A `GET http://localhost:4321/mcp` returns a JSON summary of available tools for
317
342
  | `list_source_files` | List project source files under `sourceRoot` (fallback only) |
318
343
  | `read_source_file` | Read a source file under `sourceRoot` (fallback only) |
319
344
  | `search_source` | Grep-like text search across files under `sourceRoot` |
345
+ | `list_metadata` | List the source-file bindings of every doc |
346
+ | `get_accuracy` | Get the reliability report of a doc (per-entry status + ratio) — detect drift |
347
+ | `add_metadata` | Bind a source file to a doc (stores the SHA-256 hash) |
348
+ | `refresh_metadata` | Re-hash all bindings for a doc — re-baseline after the doc has been rewritten |
320
349
 
321
350
  Prompts (`generate-context-diagram`, `generate-container-diagram`, `generate-uml-diagram`, `update-diagram-from-docs`, `generate-screen-guide`, `flow`, `erd`) are exposed alongside the tools for clients that surface MCP prompts to the user.
322
351
 
@@ -29,7 +29,10 @@ function renderAccuracyGauge(report) {
29
29
  if (label) label.textContent = window.t("accuracy.label");
30
30
  if (bar) {
31
31
  bar.style.width = pct + "%";
32
- bar.style.backgroundColor = color;
32
+ // The gradient spans the full track width, so we stretch the background
33
+ // to (100/pct)× the bar width — this way the bar only shows the left
34
+ // portion of the red→green gradient corresponding to its percentage.
35
+ bar.style.backgroundSize = pct > 0 ? `${10000 / pct}% 100%` : "100% 100%";
33
36
  }
34
37
  if (value) {
35
38
  value.textContent = pct + "%";
@@ -100,11 +100,11 @@
100
100
  "metadata.add": "Add source file",
101
101
  "metadata.refresh": "Refresh hashes",
102
102
  "metadata.remove": "Remove",
103
- "metadata.empty": "No metadata yet — add a source file to start tracking accuracy.",
103
+ "metadata.empty": "No metadata yet — add a source file to start tracking reliability.",
104
104
  "metadata.status.unchanged": "Unchanged",
105
105
  "metadata.status.modified": "Modified",
106
106
  "metadata.status.missing": "Missing",
107
- "accuracy.label": "Accuracy",
107
+ "accuracy.label": "Reliability",
108
108
  "accuracy.tooltip": "Unchanged: {unchanged} · Modified: {modified} · Missing: {missing} · Total: {total}",
109
109
 
110
110
  "modal.new_folder.title": "New folder",
@@ -104,7 +104,7 @@
104
104
  "metadata.status.unchanged": "Inchangé",
105
105
  "metadata.status.modified": "Modifié",
106
106
  "metadata.status.missing": "Manquant",
107
- "accuracy.label": "Justesse",
107
+ "accuracy.label": "Fiabilité",
108
108
  "accuracy.tooltip": "Inchangés : {unchanged} · Modifiés : {modified} · Manquants : {missing} · Total : {total}",
109
109
 
110
110
  "modal.new_folder.title": "Nouveau dossier",
@@ -647,20 +647,20 @@
647
647
  <div
648
648
  id="accuracy-gauge"
649
649
  onclick="openMetadataModal()"
650
- class="hidden no-print mt-3 flex items-center gap-3 ml-auto w-full sm:w-80 cursor-pointer select-none"
650
+ class="hidden no-print mt-5 flex items-center gap-3 mr-auto w-full sm:w-80 cursor-pointer select-none"
651
651
  >
652
652
  <span
653
653
  id="accuracy-gauge-label"
654
654
  data-i18n="accuracy.label"
655
655
  class="text-xs text-gray-500 dark:text-gray-400 shrink-0"
656
- >Accuracy</span>
656
+ >Reliability</span>
657
657
  <div
658
- class="flex-1 h-2 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden"
658
+ class="flex-1 h-4 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden"
659
659
  >
660
660
  <div
661
661
  id="accuracy-gauge-bar"
662
662
  class="h-full transition-all"
663
- style="width: 0%; background-color: #9ca3af"
663
+ style="width: 0%; background: linear-gradient(to right, #dc2626, #f97316, #eab308, #16a34a); background-size: 100% 100%; background-repeat: no-repeat;"
664
664
  ></div>
665
665
  </div>
666
666
  <span
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "living-documentation",
3
- "version": "7.11.0",
3
+ "version": "7.12.0",
4
4
  "description": "A CLI tool that serves a local Markdown documentation viewer",
5
5
  "main": "dist/src/server.js",
6
6
  "bin": {