@git-stunts/git-cas 6.0.0 → 6.1.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
@@ -4,7 +4,7 @@
4
4
  >
5
5
  > `git-cas` addresses this by making artifact distribution inherit Git’s existing replication model, allowing binaries to be stored, verified, and transported anywhere Git can operate, including mirrored networks, constrained environments, or fully offline contexts.
6
6
 
7
- `git-cas` 6.0.0 is an industrial-grade Content-Addressable Storage (CAS) engine backed by Git’s object database. Its Security First posture makes explicit restore boundaries, bounded metadata reads, authenticated encryption, and legacy-scheme rejection the default. Stored content is chunked, deduplicated, and optionally encrypted — keeping high-fidelity assets and security-sensitive files directly within your repository history.
7
+ `git-cas` is an industrial-grade Content-Addressable Storage (CAS) engine backed by Git’s object database. Its Security First posture makes explicit restore boundaries, bounded metadata reads, authenticated encryption, and legacy-scheme rejection the default. Stored content is chunked, deduplicated, and optionally encrypted — keeping high-fidelity assets and security-sensitive files directly within your repository history.
8
8
 
9
9
  `git-cas` is designed for the architect who demands mathematical certainty and the operator who needs a stable foundation for artifact storage. It scales from simple binary blob management to multi-recipient envelope-encrypted vaults with key rotation, privacy-mode slug hashing, and Merkle-style manifests for assets of any size.
10
10
 
@@ -20,6 +20,9 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
20
20
  - **Deduplication by Default**: Content-defined chunking (CDC) with Buzhash rolling hash identifies repeated patterns across files and versions, minimizing repository growth.
21
21
  - **Cryptographic Trust**: Every chunk is verified against a SHA-256 digest. Optional AES-256-GCM encryption with multi-recipient envelope support ensures privacy at rest, and `framed` binds per-frame AAD to prevent cross-manifest blob swaps.
22
22
  - **GC-Safe Vault**: Named assets are indexed through a stable ref (`refs/cas/vault`) with optimistic concurrency, preventing Git garbage collection from reclaiming referenced blobs.
23
+ - **Mutable Root Sets**: Cache and derived-state trees can be anchored under
24
+ `refs/cas/rootsets/*` while live, then become collectible after eviction,
25
+ without vault history retaining every prior generation.
23
26
  - **Key Lifecycle**: Envelope encryption separates DEKs from KEKs. Rotate passphrases across an entire vault without re-encrypting data blobs. Privacy mode HMAC-hashes slug names to prevent metadata discovery.
24
27
  - **Runtime-Adaptive**: A single core supports Node.js 22+, Bun, and Deno through a strict hexagonal port architecture with runtime-specific crypto adapters.
25
28
 
@@ -28,7 +31,7 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
28
31
  Existing v5 users should read [UPGRADING.md](./UPGRADING.md) and run
29
32
  `npm run upgrade` in dry-run mode before restoring old encrypted vault entries.
30
33
  For the release overview, see the
31
- [v6.0.0 Release Notes](./docs/releases/v6.0.0.md).
34
+ [v6.1.0 Release Notes](./docs/releases/v6.1.0.md).
32
35
 
33
36
  ### 1. CLI Usage
34
37
 
@@ -59,216 +62,65 @@ const cas = await ContentAddressableStore.open({ cwd: '.' });
59
62
  const manifest = await cas.storeFile({ filePath: './asset.bin', slug: 'app/asset' });
60
63
  ```
61
64
 
62
- ## Feature Overview
63
-
64
- ### Content-Addressed Storage
65
-
66
- Every piece of stored content is broken into chunks and addressed by its SHA-256 digest. Identical content always produces the same address, giving you deduplication for free. Manifests record the ordered list of chunk digests so content can be reassembled faithfully, and every chunk is integrity-verified on read. New manifests are stamped with a `formatVersion` (semver from package.json) for forward-compatible schema evolution.
67
-
68
- ### Chunking
69
-
70
- Two chunking strategies are available, both with configurable size parameters:
71
-
72
- | Strategy | Algorithm | Default Target | Behavior |
73
- |---|---|---|---|
74
- | **Fixed-size** | Static split | 256 KiB | Deterministic, predictable chunk boundaries |
75
- | **Content-Defined (CDC)** | Buzhash rolling hash | Configurable target/min/max | Shift-resistant boundaries that survive insertions and deletions |
76
-
77
- CDC is the default for deduplication workloads. **FastCDC dual-mask normalization** is enabled by default, producing a tighter chunk-size distribution around the target size. Target, minimum, and maximum chunk sizes are all configurable.
78
-
79
- ### Encryption
80
-
81
- Encryption uses **AES-256-GCM** with 16-byte authentication tags. `whole` and
82
- `framed` use fresh random 96-bit nonces; `convergent` derives per-chunk keys
83
- and nonces deterministically from the plaintext content hash to preserve
84
- deduplication.
85
-
86
- Three encryption schemes are supported:
87
-
88
- | Scheme | Framing | AAD Binding | Notes |
89
- |---|---|---|---|
90
- | `whole` | Single ciphertext blob | Slug | AAD always bound to prevent cross-manifest blob swaps |
91
- | `framed` | Bounded frames | Slug + frame index | Default for fixed-chunk encrypted stores — streaming decrypt with per-frame AAD binding |
92
- | `convergent` | Per-chunk deterministic | Derived from content hash | **Default for CDC + encryption** — preserves deduplication across encrypted stores. Implemented as a standalone `ConvergentEncryption` service. |
93
-
94
- See [Encryption Modes](./docs/ENCRYPTION_MODES.md) for scheme selection guidance.
95
-
96
- Legacy schemes (`whole-v1`, `whole-v2`, `framed-v1`, `framed-v2`, `convergent-v1`) are no longer accepted and throw a `LEGACY_SCHEME` error. Run `npm run upgrade` (or `node scripts/migrate-encryption.js`) to migrate existing vault entries. The script auto-detects whether each entry needs a rename-only (fast) or full re-encryption (v1 schemes without AAD), accepts `--passphrase-file`, `--key-file`, or warning-emitting inline `--passphrase` for full migrations, supports privacy-vault key options, and defaults to dry-run mode.
97
-
98
- **Envelope encryption** wraps a random Data Encryption Key (DEK) with one or more Key Encryption Keys (KEKs). Each recipient is labeled, enabling multi-recipient access to the same encrypted content. Key rotation replaces the KEK wrapping without re-encrypting data blobs.
99
-
100
- ### Key Management
101
-
102
- Multiple key sources are supported:
103
-
104
- - **Raw keys**: 32-byte AES-256 key files read directly from disk.
105
- - **Passphrase-derived keys (PBKDF2)**: PBKDF2-SHA512 with a default of 600,000 iterations. Policy-enforced minimum and maximum iteration bounds.
106
- - **Passphrase-derived keys (scrypt)**: scrypt with default N=131072. Combined memory budget is capped at 1 GiB to prevent resource exhaustion.
107
- - **OS keychain**: Passphrase sourced from the operating system's native keychain (macOS Keychain, Linux Secret Service, Windows Credential Manager) via `@git-stunts/vault`.
108
-
109
- All KDF operations enforce a minimum 16-byte salt. Iteration counts and scrypt parameters are policy-bounded to prevent both weak derivation and denial-of-service.
110
-
111
- ### Compression
112
-
113
- Content can be gzip-compressed before storage through the `CompressionPort` abstraction. The shipped `NodeCompressionAdapter` handles Node.js; other runtimes can plug in their own adapter. Compression composes cleanly with encryption — content is compressed, then encrypted. Plaintext + gzip restores now stream instead of buffering.
114
-
115
- ### Manifests
116
-
117
- Two manifest versions handle assets of any size:
118
-
119
- - **Version 1**: A flat manifest blob listing all chunk digests. Suitable for most assets.
120
- - **Version 2**: A Merkle-style manifest that splits the chunk list into
121
- sub-manifests, each independently addressable and schema-validated.
122
- Automatically engaged when chunk count exceeds 1,000 by default, with
123
- per-operation `merkleThreshold` overrides available on store calls.
124
- Sub-manifest arrays are capped at 10,000 entries.
125
-
126
- Every manifest carries an **integrity hash** — the SHA-256 of the codec-encoded content — verified on every read to detect corruption or tampering. Two codecs are available: **JSON** (human-readable, default) and **CBOR** (binary, compact).
127
-
128
- Manifest diffing is available via `diffManifests()` for comparing two manifests and identifying changed, added, or removed chunks.
129
-
130
- ### Vault
131
-
132
- The vault is a GC-safe named asset index stored at `refs/cas/vault`. It is the control plane for managing stored content.
133
-
134
- - **CRUD**: Add, remove, list, and resolve named entries.
135
- - **Encryption**: Vault entries can be encrypted with a passphrase.
136
- - **Privacy mode**: HMAC-hashed slug names prevent metadata discovery — an observer cannot determine what assets are stored without the passphrase.
137
- - **Encryption count tracking**: The vault tracks how many times each entry has been encrypted under the current nonce context, issuing rotation warnings as limits approach.
138
- - **Passphrase verifier**: Encrypted vault metadata authenticates the derived
139
- vault key even before the first entry is added, so wrong passphrases fail
140
- before empty-vault writes are accepted.
141
- - **Passphrase rotation**: Rotate the vault passphrase across all entries in a single operation without re-encrypting data blobs.
142
- - **Optimistic concurrency**: Vault writes use compare-and-swap semantics with automatic retry on conflict, ensuring safe concurrent access.
143
-
144
- ### Restore Modes
145
-
146
- Three restore surfaces cover different memory and latency profiles:
147
-
148
- | Method | Behavior | Bounded? |
149
- |---|---|---|
150
- | `restore()` | Buffered reassembly to memory | Yes — capped by `maxRestoreBufferSize` |
151
- | `restoreFile()` | Atomic temp-file write with auth-then-rename | Yes — streams through disk for plaintext, framed, convergent, and uncompressed whole |
152
- | `restoreStream()` | Async iterable yielding chunks | Yes — frame-by-frame for framed scheme |
153
-
154
- `restoreFile()` writes tentative plaintext to a temporary file, verifies authentication, and renames into place only after verification succeeds. For `framed`, all three surfaces provide true streaming restore with per-frame authentication. Parallel chunk restore is supported via a prefetch window (`PrefetchWindow`) when concurrency is greater than 1, enabling ordered parallel reads for faster restores.
155
-
156
- ```js
157
- await cas.restoreFile({
158
- manifest,
159
- outputPath: './restored.bin',
160
- baseDirectory: process.cwd(),
161
- });
162
- ```
163
-
164
- ### CLI
165
-
166
- The `git-cas` command-line interface exposes the full feature set:
167
-
168
- | Command | Purpose |
169
- |---|---|
170
- | `git-cas store` | Store a file into the CAS |
171
- | `git-cas tree` | Create a Git tree from a manifest JSON file |
172
- | `git-cas inspect` | Inspect a stored manifest and optional chunk heatmap |
173
- | `git-cas restore` | Restore content by vault slug or tree OID |
174
- | `git-cas verify` | Verify chunk integrity for a stored asset |
175
- | `git-cas doctor` | Diagnose vault health and integrity |
176
- | `git-cas vault init` | Initialize a new vault |
177
- | `git-cas vault list` | List vault entries |
178
- | `git-cas vault stats` | Summarize vault size, dedupe, and encryption coverage |
179
- | `git-cas vault remove` | Remove a vault entry |
180
- | `git-cas vault info` | Show metadata for one vault entry |
181
- | `git-cas vault history` | Show vault commit history |
182
- | `git-cas vault rotate` | Rotate the vault passphrase |
183
- | `git-cas vault dashboard` | Interactive TUI for vault navigation |
184
- | `git-cas rotate` | Rotate an asset encryption key wrapper |
185
- | `git-cas recipient add/remove/list` | Manage envelope encryption recipients |
186
-
187
- `git-cas doctor` reports both chunk-reference dedupe and byte-level efficiency:
188
- logical manifest size versus unique chunk bytes. For privacy-enabled vaults,
189
- pass `--key-file`, `--vault-passphrase-file -`, or `--os-keychain-target` so the
190
- doctor can decrypt the privacy index before scanning entries.
191
-
192
- **Agent CLI**: `git-cas agent` exposes the same store/tree/restore/inspect/verify/doctor/rotate/recipient/vault surface through a newline-delimited protocol for CI/CD automation and programmatic integrations. Request payloads can be passed through `--request <json>` or stdin; responses stream back as JSON events on stdout.
193
-
194
- ### Security Hardening
195
-
196
- Beyond the core encryption primitives, `git-cas` enforces a set of defensive limits:
197
-
198
- - **Hex validation**: All OID and digest fields are schema-validated as strict hexadecimal strings.
199
- - **scrypt memory cap**: Combined scrypt memory budget is hard-capped at 1 GiB.
200
- - **Sub-manifest array limit**: Merkle sub-manifests are capped at 10,000 entries.
201
- - **Restore path boundary**: `restoreFile()` requires `baseDirectory` and refuses output paths that escape it.
202
- - **Metadata blob cap**: Manifest and sub-manifest blob reads default to a
203
- 10 MiB `maxBlobSize` safety limit. The default Git adapter honors the
204
- facade/service `maxBlobSize` option through its adapter-level read limit.
205
- - **Concurrency cap**: Parallel operations are bounded at 64.
206
- - **Frame size cap**: `frameBytes` is capped at 64 MiB.
207
- - **Timing oracle elimination**: Recipient trial decryption uses constant-time comparison to prevent timing-based key identification.
208
- - **Source validation**: Async iterables passed to `store()` are validated before processing begins.
209
- - **Salt enforcement**: KDF salts must be at least 16 bytes.
210
- - **Nonce rotation**: Encryption count tracking warns before nonce reuse becomes a concern.
211
- - **Legacy scheme rejection**: Attempting to use a legacy encryption scheme (`whole-v1`, `whole-v2`, `framed-v1`, `framed-v2`, `convergent-v1`) throws a `LEGACY_SCHEME` error with migration guidance (see [UPGRADING.md](./UPGRADING.md)).
212
-
213
- ## Streaming Surface
214
-
215
- | Surface | Streaming API? | Non-streaming API? | Notes |
216
- |---|---|---|---|
217
- | Write | `store({ source, ... })`, `storeFile(...)` | No dedicated non-streaming store facade | Write ingress is stream-based. CDC + encryption defaults to `convergent` (per-chunk deterministic encryption preserving dedup). Fixed + encryption defaults to `framed`. |
218
- | Read: plaintext | `restoreStream(...)`, `restoreFile(...)` | `restore(...)` | True chunk-by-chunk streaming restore. |
219
- | Read: encrypted `whole` | `restoreStream(...)`, `restoreFile(...)` | `restore(...)` | `restoreStream()` is the buffered compatibility path. Uncompressed `restoreFile()` verifies chunks, streams tentative plaintext through whole-object AES-GCM decryption into a temp-file path, and renames into place only after auth succeeds. AAD (slug) is always bound. On Web Crypto runtimes this decrypt step is still one-shot internally, bounded by `maxDecryptionBufferSize`. |
220
- | Read: encrypted `framed` | `restoreStream(...)`, `restoreFile(...)` | `restore(...)` | True authenticated streaming restore. Plaintext is yielded frame-by-frame after each frame is verified. Per-frame AAD is always bound. |
221
- | Read: compressed-only | `restoreStream(...)`, `restoreFile(...)` | `restore(...)` | Plaintext + gzip now streams end-to-end. `restoreFile()` streams gunzip output through a bounded temp-file path. |
222
- | Read: compressed + `whole` | `restoreStream(...)`, `restoreFile(...)` | `restore(...)` | Auth must complete before gunzip. `restoreFile()` therefore preserves the auth-before-decompress boundary and may buffer the encrypted compressed payload; use `framed` or `convergent` for large compressed encrypted assets. |
223
- | Read: compressed + `framed` | `restoreStream(...)`, `restoreFile(...)` | `restore(...)` | Streaming decrypt, then streaming gunzip. |
224
- | Read: encrypted `convergent` | `restoreStream(...)`, `restoreFile(...)` | `restore(...)` | True per-chunk streaming restore. Each chunk is decrypted individually using a key derived from its content hash. Parallel chunk restore via prefetch window when concurrency > 1. |
225
- | Read: compressed + `convergent` | `restoreStream(...)`, `restoreFile(...)` | `restore(...)` | Per-chunk convergent decrypt, then streaming gunzip. |
226
- | Verify | No streaming verify surface | `verifyIntegrity(manifest, options?)` | Verifies chunk digests for all content. `whole` auth-checks the full ciphertext; `framed` parses and auth-checks every frame; `convergent` decrypts each chunk and verifies plaintext digests. |
227
-
228
- Runtime note: `framed` is the honest cross-runtime streaming answer. On Node and Bun, `whole restoreFile()` has the stronger low-memory path; on Web Crypto runtimes such as Deno, `whole` remains bounded-buffer rather than true streaming.
229
-
230
- ## Architecture
231
-
232
- `git-cas` follows a strict hexagonal (ports and adapters) architecture. The domain core has zero knowledge of runtime-specific APIs.
233
-
234
- ```
235
- ┌─────────────────────┐
236
- │ ContentAddressable │
237
- │ Store (Facade) │
238
- └──────────┬──────────┘
239
- │
240
- ┌──────────▼──────────┐
241
- │ CasService │
242
- │ (Domain Core) │
243
- └──┬──┬──┬──┬──┬──┬───┘
244
- │ │ │ │ │ │
245
- ┌──────────────┘ │ │ │ │ └──────────────┐
246
- │ ┌────────┘ │ │ └────────┐ │
247
- ▼ ▼ ▼ ▼ ▼ ▼
248
- ┌────────┐┌────────┐┌────────┐┌────────┐┌────────┐┌────────┐
249
- │Persist.││ Crypto ││ Codec ││Compress││Chunking││Observe.│
250
- │ Port ││ Port ││ Port ││ Port ││ Port ││ Port │
251
- └───┬────┘└───┬────┘└───┬────┘└───┬────┘└───┬────┘└───┬────┘
252
- │ │ │ │ │ │
253
- ▼ ▼ ▼ ▼ ▼ ▼
254
- GitODB Node/Bun JSON or Node gzip Fixed or Event
255
- /Deno CBOR adapter CDC/ Emitter
256
- Crypto Buzhash
257
- ```
258
-
259
- **Ports** define the contracts. **Adapters** implement them for specific runtimes. Swap any adapter without touching domain logic.
260
-
261
- The core byte contract is `Uint8Array`. Node `Buffer` values still work at the
262
- Node boundary because `Buffer` extends `Uint8Array`, but the domain, ports,
263
- chunkers, codecs, and shared helpers do not depend on Node-specific byte APIs.
264
-
265
- ## Multi-Runtime Support
266
-
267
- | Runtime | Version | Crypto Backend | Status |
268
- |---|---|---|---|
269
- | **Node.js** | 22+ | `node:crypto` | Primary — full streaming support |
270
- | **Bun** | Latest | `node:crypto` compat | Tested via Docker |
271
- | **Deno** | Latest | Web Crypto API | Tested via Docker; `whole` decrypt is bounded-buffer |
65
+ ## Capability Map
66
+
67
+ The README is the front door. Detailed mechanics live in the guide set:
68
+
69
+ | Need | Start Here |
70
+ | ------------------------------------------------------- | ------------------------------------------------------------ |
71
+ | Productive library and CLI workflows | [Developer Guide](./GUIDE.md) |
72
+ | Restore memory behavior | [Streaming and restore matrix](./GUIDE.md#streaming-surface) |
73
+ | Encryption scheme selection | [Encryption Modes](./docs/ENCRYPTION_MODES.md) |
74
+ | CDC internals, Merkle manifests, KDF policy, and tuning | [Advanced Guide](./ADVANCED_GUIDE.md) |
75
+ | Ports, adapters, and collaborator boundaries | [Architecture](./ARCHITECTURE.md) |
76
+ | GC retention for caches and derived state | [Root Sets](./docs/API.md#root-sets) |
77
+ | v5 to v6 migration | [Upgrading](./UPGRADING.md) |
78
+
79
+ Core capabilities:
80
+
81
+ - **Content-addressed storage**: chunks are addressed by SHA-256 digest and
82
+ integrity-verified on read.
83
+ - **Deduplication**: fixed chunking and content-defined chunking (CDC) support
84
+ predictable or shift-resistant chunk boundaries.
85
+ - **Encryption**: AES-256-GCM with authenticated metadata. `whole` and
86
+ `framed` use fresh random 96-bit nonces; `convergent` derives per-chunk keys
87
+ and nonces deterministically from the plaintext content hash to preserve
88
+ deduplication.
89
+ - **Vault indexing**: named assets live under `refs/cas/vault` so Git garbage
90
+ collection does not reclaim referenced blobs.
91
+ - **Root-set retention**: current cache entries live under caller-owned
92
+ `refs/cas/rootsets/*` refs. Entries are Git-reachable while present, and old
93
+ set generations are not retained as commit history.
94
+ - **Envelope recipients**: multi-recipient key wrapping and recipient rotation
95
+ avoid re-encrypting data blobs.
96
+ - **Operational diagnostics**: `git-cas doctor` validates vault health and
97
+ reports deduplication efficiency.
98
+
99
+ ## Safety Snapshot
100
+
101
+ The v6 line is Security First by default:
102
+
103
+ - `restoreFile()` requires `baseDirectory` and refuses output paths that escape
104
+ it.
105
+ - Manifest and sub-manifest blob reads default to a 10 MiB `maxBlobSize` safety
106
+ limit.
107
+ - Legacy encryption scheme identifiers throw `LEGACY_SCHEME` with migration
108
+ guidance.
109
+ - KDF parameters, salts, frame sizes, restore buffers, and concurrency are
110
+ policy-bounded.
111
+ - Recipient trial decryption and vault verifier checks use constant-time
112
+ comparisons.
113
+
114
+ For the full hardening table, see
115
+ [Advanced Guide: Security Hardening Summary](./ADVANCED_GUIDE.md#security-hardening-summary).
116
+
117
+ ## Runtime Support
118
+
119
+ | Runtime | Version | Crypto Backend | Status |
120
+ | ----------- | ------- | -------------------- | ---------------------------------------------------- |
121
+ | **Node.js** | 22+ | `node:crypto` | Primary — full streaming support |
122
+ | **Bun** | Latest | `node:crypto` compat | Tested via Docker |
123
+ | **Deno** | Latest | Web Crypto API | Tested via Docker; `whole` decrypt is bounded-buffer |
272
124
 
273
125
  All three runtimes are tested in CI on every push. The hexagonal architecture isolates runtime differences behind the `CryptoPort` boundary, so the domain core is runtime-agnostic.
274
126
 
@@ -285,8 +137,11 @@ All three runtimes are tested in CI on every push. The hexagonal architecture is
285
137
  - **[Workflow](https://github.com/git-stunts/git-cas/blob/main/WORKFLOW.md)**: Repo work doctrine, cycles, and invariants.
286
138
  - **[Contributing](https://github.com/git-stunts/git-cas/blob/main/CONTRIBUTING.md)**, **[Code of Conduct](./CODE_OF_CONDUCT.md)**, and **[Support](./SUPPORT.md)**: Project participation and help paths.
287
139
  - **[v6.0.0 Release Notes](./docs/releases/v6.0.0.md)**: Major-release summary, upgrade call-to-action, and publication notes.
140
+ - **[v6.1.0 Release Notes](./docs/releases/v6.1.0.md)**: Root-set retention,
141
+ doctor/repair, and GC-policy guidance.
288
142
  - **[Upgrading](./UPGRADING.md)**: Migration guide for v5 → v6.
289
143
  - **[Changelog](./CHANGELOG.md)**: Version history and migration notes.
290
144
 
291
145
  ---
146
+
292
147
  Built with terminal ambition by [FLYING ROBOTS](https://github.com/flyingrobots)
package/UPGRADING.md CHANGED
@@ -1,7 +1,34 @@
1
- # Upgrading to git-cas v6.0.0
1
+ # Upgrading git-cas
2
2
 
3
3
  v6.0.0 is a major release that simplifies the encryption model, hardens security defaults, and cleans up the architecture. This guide covers every breaking change and what you need to do.
4
4
 
5
+ ## v6.0.1 To v6.1.0
6
+
7
+ v6.1.0 is API-additive and does not require stored-data migration. It adds root
8
+ sets for mutable, GC-safe retention of cache and derived-state objects.
9
+
10
+ Applications that persisted tree OIDs only inside JSON should adopt every
11
+ still-live OID before running destructive Git cleanup:
12
+
13
+ ```javascript
14
+ const rootSet = await cas.rootSets.open({
15
+ ref: 'refs/cas/rootsets/my-application/cache',
16
+ });
17
+
18
+ await rootSet.repair({
19
+ entries: liveRecords.map((record) => ({
20
+ name: record.id,
21
+ oid: record.treeOid,
22
+ type: 'tree',
23
+ retention: 'evictable',
24
+ })),
25
+ });
26
+ ```
27
+
28
+ Repair cannot recover objects that Git already pruned. Verify
29
+ `(await rootSet.doctor()).healthy` before garbage collection. Existing vault
30
+ entries and ordinary branch/tag references need no change.
31
+
5
32
  ## Quick Start
6
33
 
7
34
  If you have an existing vault with encrypted assets: