daftari 1.13.0 → 1.13.1

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 (3) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +124 -13
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.13.1] - 2026-05-30
11
+
12
+ ### Changed
13
+
14
+ - Expanded README `Coherence audit` section: multi-repo case promoted to the
15
+ headline, sample output added, transitive staleness defined in plain
16
+ language, GitHub Actions CI snippet added, exit-code table added, CLI flags
17
+ documented separately from `audit.yaml`. No code changes — docs only.
18
+
10
19
  ## [1.13.0] - 2026-05-30
11
20
 
12
21
  ### Added
package/README.md CHANGED
@@ -166,26 +166,137 @@ Each is a clean increment on a surface that already works.
166
166
 
167
167
  ## Coherence audit
168
168
 
169
- `daftari audit` runs a read-only, deterministic check across one or more
170
- markdown repos for broken cross-repo references and link-graph transitive
171
- staleness. It does **not** create a `.daftari/` vault on disk and does not
172
- write to the audited repos.
169
+ `daftari audit` is a read-only, deterministic check across one or more
170
+ markdown repos for **broken cross-repo references** and **link-graph
171
+ transitive staleness**. It works against any markdown tree daftari-managed
172
+ or not. The audit creates no `.daftari/` directory and writes nothing to the
173
+ audited repos.
174
+
175
+ ### Multi-repo (the headline use case)
176
+
177
+ When two or more repos link to each other, the audit detects broken
178
+ references that neither repo's own lint could see — because each repo only
179
+ knows about itself.
173
180
 
174
181
  ```bash
175
- # Anonymous repos (no URL patterns):
176
- daftari audit --repo ~/repos/service-a --repo ~/repos/service-b
182
+ daftari audit \
183
+ --repo ~/repos/service-a \
184
+ --repo ~/repos/service-b
185
+ ```
186
+
187
+ That works for relative-path links (`../service-b/docs/api.md`). For
188
+ GitHub-style URL links between repos (`https://github.com/org/service-b/...`),
189
+ declare each repo's URL patterns in an `audit.yaml` so the resolver can map
190
+ them back to the local repo:
177
191
 
178
- # Or with a config file (recommended; see daftari audit --help for the schema):
192
+ ```yaml
193
+ # audit.yaml
194
+ repos:
195
+ - name: service-a
196
+ path: ~/repos/service-a
197
+ urls: ["github.com/org/service-a"]
198
+ - name: service-b
199
+ path: ~/repos/service-b
200
+ urls: ["github.com/org/service-b"]
201
+ ```
202
+
203
+ ```bash
179
204
  daftari audit --config audit.yaml
180
205
  ```
181
206
 
182
- Anonymous repos passed via `--repo` do not get URL patterns, so cross-repo
183
- references that take the form of GitHub URLs (e.g.
184
- `https://github.com/org/service-a/blob/main/docs/api.md`) into them will be
185
- silently treated as external. Declare repos in `audit.yaml` with their `urls`
186
- field to detect these.
207
+ ### Single repo
208
+
209
+ The same command, one `--repo`:
210
+
211
+ ```bash
212
+ daftari audit --repo ./docs
213
+ ```
214
+
215
+ In single-repo mode the cross-repo check trivially has no work, but the
216
+ staleness check still runs over the in-repo link graph.
217
+
218
+ ### What gets detected
219
+
220
+ - **Missing files.** A link from `service-a/intro.md` to `../service-b/api.md`
221
+ or `https://github.com/org/service-b/blob/main/api.md` — flagged if `api.md`
222
+ doesn't exist in `service-b`.
223
+ - **Missing anchors.** Same link with `#run` — flagged if `api.md` has no
224
+ `## Run` heading.
225
+ - **Direct staleness.** Any doc whose git mtime is older than
226
+ `staleness.threshold_days` (default 540, ~18 months).
227
+ - **Transitive staleness.** A fresh doc that links — directly or through a
228
+ chain — to a stale doc is itself flagged, with the shortest chain reported.
229
+ Catches the case where you keep touching an index page while the docs it
230
+ links to are rotting.
231
+
232
+ ### Sample output
233
+
234
+ ```markdown
235
+ # Coherence Audit Report
236
+
237
+ ## Totals
238
+ - repos scanned: **2**
239
+ - docs scanned: **47**
240
+ - broken cross-repo refs: **2**
241
+ - directly stale docs: **3**
242
+ - transitively stale docs: **5**
243
+
244
+ ## Broken cross-repo references
245
+ | kind | source | target | href |
246
+ |----------------|---------------------------|-------------------------|------|
247
+ | missing_anchor | service-a/intro.md | service-b/api.md#run | `https://github.com/org/service-b/blob/main/api.md#run` |
248
+ | missing_file | service-a/architecture.md | service-b/deleted.md | `../service-b/deleted.md` |
249
+
250
+ ## Staleness
251
+ | kind | doc | mtime | chain |
252
+ |------------|--------------------------|------------|-------|
253
+ | transitive | service-a/onboarding.md | 2026-04-01 | service-a/onboarding.md → service-b/legacy-flow.md |
254
+ ```
255
+
256
+ JSON output (`--output-json` or `output.json` in config) carries the same
257
+ structure with full detail in `brokenRefs[]` and `staleness[]` arrays plus a
258
+ `totals` summary block for compact downstream rendering.
259
+
260
+ ### CI integration
261
+
262
+ The audit's exit code is designed to gate CI:
263
+
264
+ ```yaml
265
+ # .github/workflows/docs-audit.yml
266
+ name: Docs audit
267
+ on: [pull_request]
268
+ jobs:
269
+ audit:
270
+ runs-on: ubuntu-latest
271
+ steps:
272
+ - uses: actions/checkout@v4
273
+ with: { fetch-depth: 0 } # full history so git mtime works
274
+ - run: npx daftari@latest audit --config audit.yaml
275
+ ```
276
+
277
+ Exit codes:
278
+
279
+ | code | meaning |
280
+ |------|---------|
281
+ | `0` | clean run, all findings within `fail_on` thresholds |
282
+ | `1` | clean run but a threshold was exceeded — CI fails |
283
+ | `2` | config error (missing required fields, bad paths, malformed YAML) |
284
+ | `3` | runtime error (IO failure during collection) |
285
+
286
+ ### CLI flags
287
+
288
+ `audit.yaml` and CLI flags overlap; CLI wins. A warning is printed to stderr
289
+ when `--output` or `--output-json` displaces a value from the config.
290
+
291
+ - `--repo <path>` — add a repo. May be repeated. Anonymous CLI repos get no
292
+ URL patterns; URL-based cross-refs into them won't be detected. Use
293
+ `--config` for URL-aware repos.
294
+ - `--config <path>` — load an `audit.yaml`.
295
+ - `--output <md>` — markdown report destination (default: stdout).
296
+ - `--output-json <json>` — JSON report destination (default: not written).
297
+ - `--help` — full help text.
187
298
 
188
- `audit.yaml` schema:
299
+ ### Full `audit.yaml` schema
189
300
 
190
301
  ```yaml
191
302
  repos:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daftari",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "An open-source, multi-user knowledge vault exposed to AI agents via an MCP server.",
5
5
  "license": "MIT",
6
6
  "author": "Mihir Wagle / mavaali",