dir-analysis-tool 3.4.1 → 3.5.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
@@ -1,7 +1,7 @@
1
1
  <div align="center">
2
2
 
3
3
  <a href="https://www.npmjs.com/package/dir-analysis-tool">
4
- <img src=".github/assets/dir-analysis-tool-banner.png" alt="dir-analysis-tool: fast, memory-bounded directory analysis for your terminal and CI" width="100%" />
4
+ <img src="https://raw.githubusercontent.com/KhaledSaeed18/dir-analysis-tool/main/.github/assets/dir-analysis-tool-banner.png" alt="dir-analysis-tool: fast, memory-bounded directory analysis for your terminal and CI" width="100%" />
5
5
  </a>
6
6
 
7
7
  <h1>dir-analysis-tool</h1>
@@ -13,7 +13,7 @@
13
13
  <a href="https://www.npmjs.com/package/dir-analysis-tool"><img src="https://shieldcn.dev/npm/dw/dir-analysis-tool.svg" alt="npm downloads" /></a>
14
14
  <a href="https://github.com/KhaledSaeed18/dir-analysis-tool/actions/workflows/ci.yml"><img src="https://shieldcn.dev/github/ci/KhaledSaeed18/dir-analysis-tool.svg" alt="CI status" /></a>
15
15
  <a href="https://www.npmjs.com/package/dir-analysis-tool"><img src="https://shieldcn.dev/npm/types/dir-analysis-tool.svg" alt="TypeScript types" /></a>
16
- <a href="LICENSE"><img src="https://shieldcn.dev/npm/license/dir-analysis-tool.svg?variant=secondary" alt="License: MIT" /></a>
16
+ <a href="https://github.com/KhaledSaeed18/dir-analysis-tool/blob/main/LICENSE"><img src="https://shieldcn.dev/npm/license/dir-analysis-tool.svg?variant=secondary" alt="License: MIT" /></a>
17
17
  </p>
18
18
 
19
19
  <p>
@@ -55,6 +55,7 @@ npx dir-analysis-tool
55
55
  - [Agent skill](#agent-skill)
56
56
  - [How it works](#how-it-works)
57
57
  - [Exit codes](#exit-codes)
58
+ - [Stability](#stability)
58
59
  - [Migrating from v2](#migrating-from-v2)
59
60
  - [FAQ](#faq)
60
61
 
@@ -363,7 +364,7 @@ A GitHub Actions step that posts a report to the job summary and enforces a budg
363
364
 
364
365
  Only the report goes to stdout. Progress, warnings, and status messages go to stderr, so `dat . --json > out.json` and pipes always get clean data.
365
366
 
366
- JSON is versioned (`"schemaVersion": 3`). Sizes are raw bytes, dates are ISO 8601, and paths are relative to `root` with `/` separators on every platform. The [types](src/types.ts) document every field. In short:
367
+ JSON is versioned (`"schemaVersion": 3`). Sizes are raw bytes, dates are ISO 8601, and paths are relative to `root` with `/` separators on every platform. Every field is described by a JSON Schema that ships in the package as `dir-analysis-tool/report.schema.json` ([view it](https://unpkg.com/dir-analysis-tool@3/report.schema.json)), covering `analyze`, `compare`, `explain`, and compact output, and by the [types](https://github.com/KhaledSaeed18/dir-analysis-tool/blob/main/src/types.ts). In short:
367
368
 
368
369
  ```jsonc
369
370
  {
@@ -512,7 +513,7 @@ An official [Agent Skill](https://agentskills.io) lets coding agents such as Cla
512
513
  npx skills add KhaledSaeed18/dir-analysis-tool --skill dir-analysis-tool
513
514
  ```
514
515
 
515
- Then ask in your own words, for example "why is this repo so big?" or "fail CI if `dist` goes over 2 MB". See [skills/README.md](skills/README.md) for other ways to install it, tested agents, and the evals.
516
+ Then ask in your own words, for example "why is this repo so big?" or "fail CI if `dist` goes over 2 MB". See [skills/README.md](https://github.com/KhaledSaeed18/dir-analysis-tool/blob/main/skills/README.md) for other ways to install it, tested agents, and the evals.
516
517
 
517
518
  ## How it works
518
519
 
@@ -549,6 +550,16 @@ The benchmark script reports scan and duplicate timings plus process peak RSS (n
549
550
  | `2` | A budget failed |
550
551
  | `130` | Interrupted (Ctrl+C) |
551
552
 
553
+ ## Stability
554
+
555
+ dir-analysis-tool follows semantic versioning, and these hold for every 3.x release:
556
+
557
+ - **Commands, options and exit codes.** Commands, options, budget metrics, config keys and exit codes stay as they are. New ones may be added, and old spellings that still work keep working.
558
+ - **JSON.** `schemaVersion` stays `3`, and `dat explain --json` keeps `explainVersion: 1`. Fields are only added, never removed, renamed or given a new type, and [`report.schema.json`](https://unpkg.com/dir-analysis-tool@3/report.schema.json) describes every one. Validate against it, and allow fields you don't know.
559
+ - **Library.** Exports keep their names and signatures; options and result fields are only added.
560
+ - **What a number means.** A metric keeps its definition (`bytes` is the apparent size, `diskBytes` the allocated size, hard links count once). A release that fixes a wrong count is a patch, and the changelog says what changed.
561
+ - **Not covered.** The wording and layout of the pretty, Markdown and HTML reports, and of messages on stderr, are for people and may change. CSV keeps its columns and only adds new ones at the end. Scripts should read `--json`.
562
+
552
563
  ## Migrating from v2
553
564
 
554
565
  v3 is a rewrite with a new output format. Most commands keep working unchanged.
@@ -577,8 +588,20 @@ v3 is a rewrite with a new output format. Most commands keep working unchanged.
577
588
 
578
589
  ## Contributing
579
590
 
580
- Bug reports and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for the development setup, and run `pnpm check` before opening a pull request.
591
+ Bug reports and pull requests are welcome. The most useful report is a result you believe is wrong: open a [wrong result issue](https://github.com/KhaledSaeed18/dir-analysis-tool/issues/new?template=wrong_result.yml) with the command, a small directory layout and the `--json` report. For a crash, an idea for a new report or a gap in these docs, [choose an issue form](https://github.com/KhaledSaeed18/dir-analysis-tool/issues/new/choose).
592
+
593
+ Development needs Node.js 22.18 or later and pnpm (the version is pinned in `package.json`), on macOS, Linux or Windows:
594
+
595
+ ```bash
596
+ pnpm install
597
+ pnpm dev ~/Downloads -d # run the CLI from source
598
+ pnpm check # everything CI runs
599
+ ```
600
+
601
+ [CONTRIBUTING.md](https://github.com/KhaledSaeed18/dir-analysis-tool/blob/main/CONTRIBUTING.md) covers the setup, the product rules, commit messages and how releases work; [AGENTS.md](https://github.com/KhaledSaeed18/dir-analysis-tool/blob/main/AGENTS.md) maps the code. Every `feat` or `fix` merged to `main` is released to npm.
602
+
603
+ Everyone taking part follows the [Code of Conduct](https://github.com/KhaledSaeed18/dir-analysis-tool/blob/main/CODE_OF_CONDUCT.md). Report security vulnerabilities privately, as [SECURITY.md](https://github.com/KhaledSaeed18/dir-analysis-tool/blob/main/SECURITY.md) describes, and accessibility barriers as [ACCESSIBILITY.md](https://github.com/KhaledSaeed18/dir-analysis-tool/blob/main/ACCESSIBILITY.md) describes.
581
604
 
582
605
  ## License
583
606
 
584
- [MIT](LICENSE), by [Khaled Saeed](https://github.com/KhaledSaeed18).
607
+ [MIT](https://github.com/KhaledSaeed18/dir-analysis-tool/blob/main/LICENSE), by [Khaled Saeed](https://github.com/KhaledSaeed18).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dir-analysis-tool",
3
- "version": "3.4.1",
3
+ "version": "3.5.0",
4
4
  "description": "Fast, zero-dependency directory analysis for your terminal and CI: largest folders and files, type and extension breakdowns, staged duplicate detection, size budgets, directory diffs, and self-contained HTML, Markdown, JSON, and CSV reports.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -9,6 +9,7 @@
9
9
  "default": "./dist/index.js"
10
10
  },
11
11
  "./schema.json": "./schema.json",
12
+ "./report.schema.json": "./report.schema.json",
12
13
  "./package.json": "./package.json"
13
14
  },
14
15
  "main": "./dist/index.js",
@@ -19,7 +20,8 @@
19
20
  },
20
21
  "files": [
21
22
  "dist",
22
- "schema.json"
23
+ "schema.json",
24
+ "report.schema.json"
23
25
  ],
24
26
  "sideEffects": false,
25
27
  "scripts": {
@@ -90,6 +92,7 @@
90
92
  "@semantic-release/release-notes-generator": "^14.1.1",
91
93
  "@types/node": "^22.20.5",
92
94
  "@vitest/coverage-v8": "^5.0.5",
95
+ "ajv": "^8.20.0",
93
96
  "conventional-changelog-conventionalcommits": "^9.3.1",
94
97
  "husky": "^9.1.7",
95
98
  "oxlint": "^1.88.0",
@@ -0,0 +1,1117 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unpkg.com/dir-analysis-tool@3/report.schema.json",
4
+ "title": "dir-analysis-tool JSON reports",
5
+ "description": "Output of dat --json (schemaVersion 3), dat compare --json (schemaVersion 3) and dat explain --json (explainVersion 1). The library returns the same shapes. Within 3.x, fields are only added, never removed, renamed or retyped.",
6
+ "anyOf": [
7
+ {
8
+ "$ref": "#/$defs/analysis"
9
+ },
10
+ {
11
+ "$ref": "#/$defs/comparison"
12
+ },
13
+ {
14
+ "$ref": "#/$defs/pathExplanation"
15
+ },
16
+ {
17
+ "$ref": "#/$defs/skipsExplanation"
18
+ }
19
+ ],
20
+ "$defs": {
21
+ "toolInfo": {
22
+ "type": "object",
23
+ "required": ["name", "version"],
24
+ "properties": {
25
+ "name": {
26
+ "const": "dir-analysis-tool"
27
+ },
28
+ "version": {
29
+ "type": "string",
30
+ "description": "The version that wrote the report."
31
+ }
32
+ }
33
+ },
34
+ "sizeStat": {
35
+ "type": "object",
36
+ "required": ["files", "bytes"],
37
+ "properties": {
38
+ "files": {
39
+ "type": "integer",
40
+ "minimum": 0
41
+ },
42
+ "bytes": {
43
+ "type": "integer",
44
+ "minimum": 0
45
+ }
46
+ }
47
+ },
48
+ "types": {
49
+ "type": "object",
50
+ "description": "Every category is always present, including empty ones.",
51
+ "required": [
52
+ "code",
53
+ "documents",
54
+ "images",
55
+ "videos",
56
+ "audio",
57
+ "archives",
58
+ "fonts",
59
+ "data",
60
+ "other"
61
+ ],
62
+ "properties": {
63
+ "code": {
64
+ "$ref": "#/$defs/sizeStat"
65
+ },
66
+ "documents": {
67
+ "$ref": "#/$defs/sizeStat"
68
+ },
69
+ "images": {
70
+ "$ref": "#/$defs/sizeStat"
71
+ },
72
+ "videos": {
73
+ "$ref": "#/$defs/sizeStat"
74
+ },
75
+ "audio": {
76
+ "$ref": "#/$defs/sizeStat"
77
+ },
78
+ "archives": {
79
+ "$ref": "#/$defs/sizeStat"
80
+ },
81
+ "fonts": {
82
+ "$ref": "#/$defs/sizeStat"
83
+ },
84
+ "data": {
85
+ "$ref": "#/$defs/sizeStat"
86
+ },
87
+ "other": {
88
+ "$ref": "#/$defs/sizeStat"
89
+ }
90
+ }
91
+ },
92
+ "fileEntry": {
93
+ "type": "object",
94
+ "required": ["path", "bytes", "modified"],
95
+ "properties": {
96
+ "path": {
97
+ "type": "string",
98
+ "description": "Relative to the root, with / separators."
99
+ },
100
+ "bytes": {
101
+ "type": "integer",
102
+ "minimum": 0
103
+ },
104
+ "modified": {
105
+ "type": "string",
106
+ "format": "date-time",
107
+ "description": "Last modification time, ISO 8601."
108
+ }
109
+ }
110
+ },
111
+ "directoryEntry": {
112
+ "type": "object",
113
+ "required": ["path", "bytes", "files"],
114
+ "properties": {
115
+ "path": {
116
+ "type": "string"
117
+ },
118
+ "bytes": {
119
+ "type": "integer",
120
+ "minimum": 0,
121
+ "description": "Total apparent size of everything below this directory."
122
+ },
123
+ "files": {
124
+ "type": "integer",
125
+ "minimum": 0,
126
+ "description": "Total number of files below this directory."
127
+ }
128
+ }
129
+ },
130
+ "extensionStat": {
131
+ "type": "object",
132
+ "required": ["extension", "files", "bytes"],
133
+ "properties": {
134
+ "extension": {
135
+ "type": "string",
136
+ "description": "Lowercased extension including the dot, or an empty string for files without one."
137
+ },
138
+ "files": {
139
+ "type": "integer",
140
+ "minimum": 0
141
+ },
142
+ "bytes": {
143
+ "type": "integer",
144
+ "minimum": 0
145
+ }
146
+ }
147
+ },
148
+ "duplicateGroup": {
149
+ "type": "object",
150
+ "required": ["hash", "bytes", "wastedBytes", "files"],
151
+ "properties": {
152
+ "hash": {
153
+ "type": "string",
154
+ "pattern": "^[0-9a-f]{64}$",
155
+ "description": "SHA-256 of the file contents, hex encoded."
156
+ },
157
+ "bytes": {
158
+ "type": "integer",
159
+ "minimum": 0,
160
+ "description": "Size of each copy."
161
+ },
162
+ "wastedBytes": {
163
+ "type": "integer",
164
+ "minimum": 0,
165
+ "description": "Space reclaimable by keeping one copy."
166
+ },
167
+ "files": {
168
+ "type": "array",
169
+ "items": {
170
+ "type": "string"
171
+ }
172
+ },
173
+ "omittedFiles": {
174
+ "type": "integer",
175
+ "minimum": 0,
176
+ "description": "Copies not listed in files; only on a group cut by compact output."
177
+ }
178
+ }
179
+ },
180
+ "fileList": {
181
+ "type": "object",
182
+ "required": ["count", "bytes", "items"],
183
+ "properties": {
184
+ "count": {
185
+ "type": "integer",
186
+ "minimum": 0,
187
+ "description": "Number of matching files."
188
+ },
189
+ "bytes": {
190
+ "type": "integer",
191
+ "minimum": 0,
192
+ "description": "Combined size of the matching files."
193
+ },
194
+ "items": {
195
+ "type": "array",
196
+ "items": {
197
+ "$ref": "#/$defs/fileEntry"
198
+ }
199
+ }
200
+ }
201
+ },
202
+ "scanError": {
203
+ "type": "object",
204
+ "required": ["path", "code", "message"],
205
+ "properties": {
206
+ "path": {
207
+ "type": "string"
208
+ },
209
+ "code": {
210
+ "type": "string",
211
+ "description": "Node.js error code, for example EACCES or ELOOP."
212
+ },
213
+ "message": {
214
+ "type": "string"
215
+ }
216
+ }
217
+ },
218
+ "treeNode": {
219
+ "type": "object",
220
+ "required": ["name", "path", "type", "bytes", "files"],
221
+ "properties": {
222
+ "name": {
223
+ "type": "string"
224
+ },
225
+ "path": {
226
+ "type": "string"
227
+ },
228
+ "type": {
229
+ "enum": ["directory", "file"]
230
+ },
231
+ "bytes": {
232
+ "type": "integer",
233
+ "minimum": 0
234
+ },
235
+ "files": {
236
+ "type": "integer",
237
+ "minimum": 0
238
+ },
239
+ "children": {
240
+ "type": "array",
241
+ "items": {
242
+ "$ref": "#/$defs/treeNode"
243
+ }
244
+ },
245
+ "omitted": {
246
+ "type": "object",
247
+ "description": "Children not shown because of the per-level limit.",
248
+ "required": ["files", "bytes", "entries"],
249
+ "properties": {
250
+ "files": {
251
+ "type": "integer",
252
+ "minimum": 0
253
+ },
254
+ "bytes": {
255
+ "type": "integer",
256
+ "minimum": 0
257
+ },
258
+ "entries": {
259
+ "type": "integer",
260
+ "minimum": 0
261
+ }
262
+ }
263
+ }
264
+ }
265
+ },
266
+ "budgetResult": {
267
+ "type": "object",
268
+ "required": ["rule", "metric", "operator", "limit", "actual", "passed"],
269
+ "properties": {
270
+ "rule": {
271
+ "type": "string",
272
+ "description": "The rule as written, for example size<=500MB."
273
+ },
274
+ "metric": {
275
+ "enum": [
276
+ "size",
277
+ "disk",
278
+ "files",
279
+ "dirs",
280
+ "largest",
281
+ "large",
282
+ "duplicates",
283
+ "wasted",
284
+ "empty",
285
+ "stale",
286
+ "errors"
287
+ ]
288
+ },
289
+ "operator": {
290
+ "enum": ["<", "<=", ">", ">=", "=", "!="]
291
+ },
292
+ "limit": {
293
+ "type": "number"
294
+ },
295
+ "actual": {
296
+ "type": "number"
297
+ },
298
+ "passed": {
299
+ "type": "boolean"
300
+ }
301
+ }
302
+ },
303
+ "summary": {
304
+ "type": "object",
305
+ "required": [
306
+ "bytes",
307
+ "diskBytes",
308
+ "files",
309
+ "directories",
310
+ "largestFileBytes",
311
+ "symlinks",
312
+ "hardlinks",
313
+ "excluded",
314
+ "filtered",
315
+ "errors"
316
+ ],
317
+ "properties": {
318
+ "bytes": {
319
+ "type": "integer",
320
+ "minimum": 0,
321
+ "description": "Apparent size: the sum of file lengths."
322
+ },
323
+ "diskBytes": {
324
+ "type": "integer",
325
+ "minimum": 0,
326
+ "description": "Allocated size on disk. Equals bytes where the platform does not report blocks."
327
+ },
328
+ "files": {
329
+ "type": "integer",
330
+ "minimum": 0
331
+ },
332
+ "directories": {
333
+ "type": "integer",
334
+ "minimum": 0
335
+ },
336
+ "largestFileBytes": {
337
+ "type": "integer",
338
+ "minimum": 0,
339
+ "description": "Size of the largest file."
340
+ },
341
+ "symlinks": {
342
+ "type": "integer",
343
+ "minimum": 0
344
+ },
345
+ "hardlinks": {
346
+ "type": "integer",
347
+ "minimum": 0,
348
+ "description": "Extra hard links skipped so that shared data is counted once."
349
+ },
350
+ "excluded": {
351
+ "type": "integer",
352
+ "minimum": 0,
353
+ "description": "Entries skipped by exclusion rules (default excludes, --exclude, .gitignore)."
354
+ },
355
+ "filtered": {
356
+ "type": "integer",
357
+ "minimum": 0,
358
+ "description": "Files skipped by size or date filters."
359
+ },
360
+ "errors": {
361
+ "type": "integer",
362
+ "minimum": 0,
363
+ "description": "Paths that could not be read."
364
+ }
365
+ }
366
+ },
367
+ "settings": {
368
+ "type": "object",
369
+ "description": "The scan settings in effect, after config files and flags were combined.",
370
+ "required": [
371
+ "exclude",
372
+ "defaultExcludes",
373
+ "gitignore",
374
+ "maxDepth",
375
+ "followSymlinks",
376
+ "countHardlinks",
377
+ "minSize",
378
+ "maxSize",
379
+ "modifiedAfter",
380
+ "modifiedBefore"
381
+ ],
382
+ "properties": {
383
+ "exclude": {
384
+ "type": "array",
385
+ "items": {
386
+ "type": "string"
387
+ }
388
+ },
389
+ "defaultExcludes": {
390
+ "type": "boolean"
391
+ },
392
+ "gitignore": {
393
+ "type": "boolean"
394
+ },
395
+ "maxDepth": {
396
+ "type": ["integer", "null"],
397
+ "minimum": 0
398
+ },
399
+ "followSymlinks": {
400
+ "type": "boolean"
401
+ },
402
+ "countHardlinks": {
403
+ "type": "boolean"
404
+ },
405
+ "minSize": {
406
+ "type": ["integer", "null"],
407
+ "minimum": 0
408
+ },
409
+ "maxSize": {
410
+ "type": ["integer", "null"],
411
+ "minimum": 0
412
+ },
413
+ "modifiedAfter": {
414
+ "type": ["string", "null"]
415
+ },
416
+ "modifiedBefore": {
417
+ "type": ["string", "null"]
418
+ }
419
+ }
420
+ },
421
+ "compact": {
422
+ "type": "object",
423
+ "description": "Present only in compact output (--compact): what was cut.",
424
+ "required": ["limit", "truncated", "omitted"],
425
+ "properties": {
426
+ "limit": {
427
+ "type": "integer",
428
+ "minimum": 0,
429
+ "description": "Maximum number of items kept in each list."
430
+ },
431
+ "truncated": {
432
+ "type": "boolean",
433
+ "description": "Whether any list was cut."
434
+ },
435
+ "omitted": {
436
+ "type": "object",
437
+ "description": "Items not listed, per cut list. A list that is absent here was not cut.",
438
+ "required": [],
439
+ "properties": {
440
+ "extensions": {
441
+ "type": "integer",
442
+ "minimum": 0
443
+ },
444
+ "errors": {
445
+ "type": "integer",
446
+ "minimum": 0
447
+ },
448
+ "largeFiles.items": {
449
+ "type": "integer",
450
+ "minimum": 0
451
+ },
452
+ "duplicates.items": {
453
+ "type": "integer",
454
+ "minimum": 0
455
+ },
456
+ "duplicates.items[].files": {
457
+ "type": "integer",
458
+ "minimum": 0
459
+ },
460
+ "emptyFiles.items": {
461
+ "type": "integer",
462
+ "minimum": 0
463
+ },
464
+ "emptyDirectories.items": {
465
+ "type": "integer",
466
+ "minimum": 0
467
+ },
468
+ "staleFiles.items": {
469
+ "type": "integer",
470
+ "minimum": 0
471
+ }
472
+ }
473
+ }
474
+ }
475
+ },
476
+ "analysis": {
477
+ "type": "object",
478
+ "description": "dat analyze --json (and each line of dat watch --json).",
479
+ "required": [
480
+ "schemaVersion",
481
+ "tool",
482
+ "root",
483
+ "startedAt",
484
+ "durationMs",
485
+ "settings",
486
+ "summary",
487
+ "types",
488
+ "extensions",
489
+ "largestDirectories",
490
+ "largestFiles",
491
+ "errors"
492
+ ],
493
+ "properties": {
494
+ "schemaVersion": {
495
+ "const": 3
496
+ },
497
+ "tool": {
498
+ "$ref": "#/$defs/toolInfo"
499
+ },
500
+ "root": {
501
+ "type": "string",
502
+ "description": "Absolute path of the analyzed directory."
503
+ },
504
+ "startedAt": {
505
+ "type": "string",
506
+ "format": "date-time"
507
+ },
508
+ "durationMs": {
509
+ "type": "integer",
510
+ "minimum": 0
511
+ },
512
+ "settings": {
513
+ "$ref": "#/$defs/settings"
514
+ },
515
+ "summary": {
516
+ "$ref": "#/$defs/summary"
517
+ },
518
+ "types": {
519
+ "$ref": "#/$defs/types"
520
+ },
521
+ "extensions": {
522
+ "type": "array",
523
+ "items": {
524
+ "$ref": "#/$defs/extensionStat"
525
+ },
526
+ "description": "Sorted by size, largest first."
527
+ },
528
+ "largestDirectories": {
529
+ "type": "array",
530
+ "items": {
531
+ "$ref": "#/$defs/directoryEntry"
532
+ }
533
+ },
534
+ "largestFiles": {
535
+ "type": "array",
536
+ "items": {
537
+ "$ref": "#/$defs/fileEntry"
538
+ }
539
+ },
540
+ "largeFiles": {
541
+ "type": "object",
542
+ "description": "With --large-files.",
543
+ "required": ["count", "bytes", "items", "threshold"],
544
+ "properties": {
545
+ "count": {
546
+ "type": "integer",
547
+ "minimum": 0
548
+ },
549
+ "bytes": {
550
+ "type": "integer",
551
+ "minimum": 0
552
+ },
553
+ "items": {
554
+ "type": "array",
555
+ "items": {
556
+ "$ref": "#/$defs/fileEntry"
557
+ }
558
+ },
559
+ "threshold": {
560
+ "type": "integer",
561
+ "minimum": 0,
562
+ "description": "The size a file must reach, in bytes."
563
+ }
564
+ }
565
+ },
566
+ "duplicates": {
567
+ "type": "object",
568
+ "description": "With --duplicates.",
569
+ "required": ["count", "files", "bytes", "wastedBytes", "items"],
570
+ "properties": {
571
+ "count": {
572
+ "type": "integer",
573
+ "minimum": 0,
574
+ "description": "Number of duplicate groups."
575
+ },
576
+ "files": {
577
+ "type": "integer",
578
+ "minimum": 0
579
+ },
580
+ "bytes": {
581
+ "type": "integer",
582
+ "minimum": 0
583
+ },
584
+ "wastedBytes": {
585
+ "type": "integer",
586
+ "minimum": 0
587
+ },
588
+ "items": {
589
+ "type": "array",
590
+ "items": {
591
+ "$ref": "#/$defs/duplicateGroup"
592
+ }
593
+ }
594
+ }
595
+ },
596
+ "emptyFiles": {
597
+ "$ref": "#/$defs/fileList",
598
+ "description": "With --empty."
599
+ },
600
+ "emptyDirectories": {
601
+ "type": "object",
602
+ "description": "With --empty.",
603
+ "required": ["count", "items"],
604
+ "properties": {
605
+ "count": {
606
+ "type": "integer",
607
+ "minimum": 0
608
+ },
609
+ "items": {
610
+ "type": "array",
611
+ "items": {
612
+ "type": "string"
613
+ }
614
+ }
615
+ }
616
+ },
617
+ "staleFiles": {
618
+ "type": "object",
619
+ "description": "With --stale.",
620
+ "required": ["count", "bytes", "items", "modifiedBefore"],
621
+ "properties": {
622
+ "count": {
623
+ "type": "integer",
624
+ "minimum": 0
625
+ },
626
+ "bytes": {
627
+ "type": "integer",
628
+ "minimum": 0
629
+ },
630
+ "items": {
631
+ "type": "array",
632
+ "items": {
633
+ "$ref": "#/$defs/fileEntry"
634
+ }
635
+ },
636
+ "modifiedBefore": {
637
+ "type": "string",
638
+ "format": "date-time"
639
+ }
640
+ }
641
+ },
642
+ "tree": {
643
+ "$ref": "#/$defs/treeNode",
644
+ "description": "With --tree."
645
+ },
646
+ "budgets": {
647
+ "type": "array",
648
+ "items": {
649
+ "$ref": "#/$defs/budgetResult"
650
+ },
651
+ "description": "With --budget."
652
+ },
653
+ "errors": {
654
+ "type": "array",
655
+ "items": {
656
+ "$ref": "#/$defs/scanError"
657
+ },
658
+ "description": "At most 100 entries; summary.errors has the full count."
659
+ },
660
+ "compact": {
661
+ "$ref": "#/$defs/compact"
662
+ }
663
+ }
664
+ },
665
+ "side": {
666
+ "type": "object",
667
+ "required": ["root", "summary", "types"],
668
+ "properties": {
669
+ "root": {
670
+ "type": "string"
671
+ },
672
+ "summary": {
673
+ "$ref": "#/$defs/summary"
674
+ },
675
+ "types": {
676
+ "$ref": "#/$defs/types"
677
+ }
678
+ }
679
+ },
680
+ "comparison": {
681
+ "type": "object",
682
+ "description": "dat compare --json.",
683
+ "required": [
684
+ "schemaVersion",
685
+ "tool",
686
+ "startedAt",
687
+ "durationMs",
688
+ "mode",
689
+ "left",
690
+ "right",
691
+ "delta",
692
+ "added",
693
+ "removed",
694
+ "changed",
695
+ "unchanged",
696
+ "directories"
697
+ ],
698
+ "properties": {
699
+ "schemaVersion": {
700
+ "const": 3
701
+ },
702
+ "tool": {
703
+ "$ref": "#/$defs/toolInfo"
704
+ },
705
+ "startedAt": {
706
+ "type": "string",
707
+ "format": "date-time"
708
+ },
709
+ "durationMs": {
710
+ "type": "integer",
711
+ "minimum": 0
712
+ },
713
+ "mode": {
714
+ "enum": ["size", "content"],
715
+ "description": "How changed was decided: by size only, or by size then content hash."
716
+ },
717
+ "left": {
718
+ "$ref": "#/$defs/side"
719
+ },
720
+ "right": {
721
+ "$ref": "#/$defs/side"
722
+ },
723
+ "delta": {
724
+ "type": "object",
725
+ "required": ["bytes", "diskBytes", "files", "directories"],
726
+ "properties": {
727
+ "bytes": {
728
+ "type": "integer"
729
+ },
730
+ "diskBytes": {
731
+ "type": "integer"
732
+ },
733
+ "files": {
734
+ "type": "integer"
735
+ },
736
+ "directories": {
737
+ "type": "integer"
738
+ }
739
+ }
740
+ },
741
+ "added": {
742
+ "$ref": "#/$defs/fileList"
743
+ },
744
+ "removed": {
745
+ "$ref": "#/$defs/fileList"
746
+ },
747
+ "changed": {
748
+ "type": "object",
749
+ "required": ["count", "delta", "items"],
750
+ "properties": {
751
+ "count": {
752
+ "type": "integer",
753
+ "minimum": 0
754
+ },
755
+ "delta": {
756
+ "type": "integer"
757
+ },
758
+ "items": {
759
+ "type": "array",
760
+ "items": {
761
+ "type": "object",
762
+ "required": ["path", "leftBytes", "rightBytes", "delta"],
763
+ "properties": {
764
+ "path": {
765
+ "type": "string"
766
+ },
767
+ "leftBytes": {
768
+ "type": "integer",
769
+ "minimum": 0
770
+ },
771
+ "rightBytes": {
772
+ "type": "integer",
773
+ "minimum": 0
774
+ },
775
+ "delta": {
776
+ "type": "integer"
777
+ }
778
+ }
779
+ }
780
+ }
781
+ }
782
+ },
783
+ "unchanged": {
784
+ "type": "integer",
785
+ "minimum": 0
786
+ },
787
+ "directories": {
788
+ "type": "array",
789
+ "items": {
790
+ "type": "object",
791
+ "required": ["path", "leftBytes", "rightBytes", "delta"],
792
+ "properties": {
793
+ "path": {
794
+ "type": "string"
795
+ },
796
+ "leftBytes": {
797
+ "type": "integer",
798
+ "minimum": 0
799
+ },
800
+ "rightBytes": {
801
+ "type": "integer",
802
+ "minimum": 0
803
+ },
804
+ "delta": {
805
+ "type": "integer"
806
+ }
807
+ }
808
+ },
809
+ "description": "Directories with the largest size change, largest absolute change first."
810
+ }
811
+ }
812
+ },
813
+ "explainSource": {
814
+ "enum": [
815
+ "default",
816
+ "pattern",
817
+ "gitignore",
818
+ "info-exclude",
819
+ "size",
820
+ "date",
821
+ "max-depth",
822
+ "symlink",
823
+ "special-file",
824
+ "error",
825
+ "unknown"
826
+ ]
827
+ },
828
+ "explainNote": {
829
+ "type": "object",
830
+ "required": ["code", "message"],
831
+ "properties": {
832
+ "code": {
833
+ "enum": [
834
+ "negation-blocked-by-parent",
835
+ "negation-cannot-reach-default",
836
+ "negation-cannot-reach-gitignore",
837
+ "root-ignored-by-git",
838
+ "global-excludes-not-read",
839
+ "nested-repository",
840
+ "hardlink-order-dependent",
841
+ "symlink-order-dependent",
842
+ "case-rule-from-platform",
843
+ "not-found",
844
+ "explanation-unavailable"
845
+ ]
846
+ },
847
+ "message": {
848
+ "type": "string"
849
+ },
850
+ "path": {
851
+ "type": "string"
852
+ },
853
+ "file": {
854
+ "type": "string"
855
+ },
856
+ "line": {
857
+ "type": "integer",
858
+ "minimum": 0
859
+ },
860
+ "rule": {
861
+ "type": "string"
862
+ },
863
+ "index": {
864
+ "type": "integer",
865
+ "minimum": 0
866
+ }
867
+ }
868
+ },
869
+ "explainReason": {
870
+ "type": "object",
871
+ "description": "The rule or limit that decided. Fields that do not apply to the source are null.",
872
+ "required": [
873
+ "source",
874
+ "at",
875
+ "ancestor",
876
+ "file",
877
+ "line",
878
+ "rule",
879
+ "index",
880
+ "limit",
881
+ "actual",
882
+ "code"
883
+ ],
884
+ "properties": {
885
+ "source": {
886
+ "$ref": "#/$defs/explainSource"
887
+ },
888
+ "at": {
889
+ "type": "string"
890
+ },
891
+ "ancestor": {
892
+ "type": "boolean"
893
+ },
894
+ "file": {
895
+ "type": ["string", "null"]
896
+ },
897
+ "line": {
898
+ "type": ["integer", "null"],
899
+ "minimum": 1
900
+ },
901
+ "rule": {
902
+ "type": ["string", "null"]
903
+ },
904
+ "index": {
905
+ "type": ["integer", "null"],
906
+ "minimum": 0
907
+ },
908
+ "limit": {
909
+ "type": ["number", "string", "null"]
910
+ },
911
+ "actual": {
912
+ "type": ["number", "string", "null"]
913
+ },
914
+ "code": {
915
+ "type": ["string", "null"]
916
+ }
917
+ }
918
+ },
919
+ "pathExplanation": {
920
+ "type": "object",
921
+ "description": "dat explain <path> --json.",
922
+ "required": [
923
+ "explainVersion",
924
+ "root",
925
+ "path",
926
+ "type",
927
+ "decision",
928
+ "reason",
929
+ "descendants",
930
+ "notes",
931
+ "ignoreCase",
932
+ "settings"
933
+ ],
934
+ "properties": {
935
+ "explainVersion": {
936
+ "const": 1
937
+ },
938
+ "root": {
939
+ "type": "string"
940
+ },
941
+ "path": {
942
+ "type": "string"
943
+ },
944
+ "type": {
945
+ "enum": ["file", "directory", "symlink", "other", null]
946
+ },
947
+ "decision": {
948
+ "enum": ["included", "excluded", "filtered", "skipped", "not-found"]
949
+ },
950
+ "reason": {
951
+ "anyOf": [
952
+ {
953
+ "$ref": "#/$defs/explainReason"
954
+ },
955
+ {
956
+ "type": "null"
957
+ }
958
+ ]
959
+ },
960
+ "descendants": {
961
+ "type": "null"
962
+ },
963
+ "notes": {
964
+ "type": "array",
965
+ "items": {
966
+ "$ref": "#/$defs/explainNote"
967
+ }
968
+ },
969
+ "ignoreCase": {
970
+ "type": "boolean"
971
+ },
972
+ "settings": {
973
+ "$ref": "#/$defs/settings"
974
+ }
975
+ }
976
+ },
977
+ "explainGroup": {
978
+ "type": "object",
979
+ "required": [
980
+ "source",
981
+ "file",
982
+ "line",
983
+ "rule",
984
+ "index",
985
+ "limit",
986
+ "count",
987
+ "entries",
988
+ "truncated"
989
+ ],
990
+ "properties": {
991
+ "source": {
992
+ "$ref": "#/$defs/explainSource"
993
+ },
994
+ "file": {
995
+ "type": ["string", "null"]
996
+ },
997
+ "line": {
998
+ "type": ["integer", "null"],
999
+ "minimum": 1
1000
+ },
1001
+ "rule": {
1002
+ "type": ["string", "null"]
1003
+ },
1004
+ "index": {
1005
+ "type": ["integer", "null"],
1006
+ "minimum": 0
1007
+ },
1008
+ "limit": {
1009
+ "type": ["number", "string", "null"]
1010
+ },
1011
+ "count": {
1012
+ "type": "integer",
1013
+ "minimum": 0
1014
+ },
1015
+ "entries": {
1016
+ "type": "array",
1017
+ "items": {
1018
+ "type": "string"
1019
+ },
1020
+ "description": "The first entries in path order."
1021
+ },
1022
+ "truncated": {
1023
+ "type": "boolean"
1024
+ }
1025
+ }
1026
+ },
1027
+ "skipsExplanation": {
1028
+ "type": "object",
1029
+ "description": "dat explain --json.",
1030
+ "required": [
1031
+ "explainVersion",
1032
+ "root",
1033
+ "totals",
1034
+ "groups",
1035
+ "errors",
1036
+ "notes",
1037
+ "limit",
1038
+ "ignoreCase",
1039
+ "settings"
1040
+ ],
1041
+ "properties": {
1042
+ "explainVersion": {
1043
+ "const": 1
1044
+ },
1045
+ "root": {
1046
+ "type": "string"
1047
+ },
1048
+ "totals": {
1049
+ "type": "object",
1050
+ "required": [
1051
+ "excluded",
1052
+ "filtered",
1053
+ "depthSkipped",
1054
+ "symlinks",
1055
+ "hardlinks",
1056
+ "errors"
1057
+ ],
1058
+ "properties": {
1059
+ "excluded": {
1060
+ "type": "integer",
1061
+ "minimum": 0
1062
+ },
1063
+ "filtered": {
1064
+ "type": "integer",
1065
+ "minimum": 0
1066
+ },
1067
+ "depthSkipped": {
1068
+ "type": "integer",
1069
+ "minimum": 0
1070
+ },
1071
+ "symlinks": {
1072
+ "type": "integer",
1073
+ "minimum": 0
1074
+ },
1075
+ "hardlinks": {
1076
+ "type": "integer",
1077
+ "minimum": 0
1078
+ },
1079
+ "errors": {
1080
+ "type": "integer",
1081
+ "minimum": 0
1082
+ }
1083
+ }
1084
+ },
1085
+ "groups": {
1086
+ "type": "array",
1087
+ "items": {
1088
+ "$ref": "#/$defs/explainGroup"
1089
+ },
1090
+ "description": "Largest groups first."
1091
+ },
1092
+ "errors": {
1093
+ "type": "array",
1094
+ "items": {
1095
+ "$ref": "#/$defs/scanError"
1096
+ }
1097
+ },
1098
+ "notes": {
1099
+ "type": "array",
1100
+ "items": {
1101
+ "$ref": "#/$defs/explainNote"
1102
+ }
1103
+ },
1104
+ "limit": {
1105
+ "type": "integer",
1106
+ "minimum": 0
1107
+ },
1108
+ "ignoreCase": {
1109
+ "type": "boolean"
1110
+ },
1111
+ "settings": {
1112
+ "$ref": "#/$defs/settings"
1113
+ }
1114
+ }
1115
+ }
1116
+ }
1117
+ }