@vibe-validate/history 0.17.0 → 0.17.1-rc.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.
- package/README.md +68 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@ Validation history tracking via git notes for vibe-validate.
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
+
- **Automatic Work Protection**: Every validation creates recoverable snapshots of all files
|
|
7
8
|
- **Git Notes Storage**: Store validation results keyed by git tree hash
|
|
8
9
|
- **Distributed Cache**: Remember validation for EVERY tree hash
|
|
9
10
|
- **Worktree Stability Check**: Verify tree unchanged during validation
|
|
@@ -228,6 +229,73 @@ await recordValidationHistory(treeHashBefore, result);
|
|
|
228
229
|
|
|
229
230
|
**Sharing**: Local by default (no auto-push to remote)
|
|
230
231
|
|
|
232
|
+
## Work Protection
|
|
233
|
+
|
|
234
|
+
Every validation run that records history also provides automatic work protection.
|
|
235
|
+
|
|
236
|
+
### How Validation History Enables Recovery
|
|
237
|
+
|
|
238
|
+
Each history entry stores:
|
|
239
|
+
- `treeHash`: The git tree hash for that validation
|
|
240
|
+
- `timestamp`: When validation occurred
|
|
241
|
+
- `branch`: Which branch you were on
|
|
242
|
+
- `headCommit`: Last commit at validation time
|
|
243
|
+
- `uncommittedChanges`: Whether you had uncommitted work
|
|
244
|
+
|
|
245
|
+
The `treeHash` is the key to recovery - it references a git tree object containing all your files as they existed during that validation.
|
|
246
|
+
|
|
247
|
+
### Recovery Workflow
|
|
248
|
+
|
|
249
|
+
1. **Find the validation** you want to recover from:
|
|
250
|
+
```bash
|
|
251
|
+
vv history list
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
2. **Examine the tree hash** to see what files existed:
|
|
255
|
+
```bash
|
|
256
|
+
git ls-tree <tree-hash>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
3. **View specific file content**:
|
|
260
|
+
```bash
|
|
261
|
+
git cat-file -p <tree-hash>:path/to/file.ts
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
4. **Recover files**:
|
|
265
|
+
```bash
|
|
266
|
+
# Single file
|
|
267
|
+
git cat-file -p <tree-hash>:src/feature.ts > src/feature.ts
|
|
268
|
+
|
|
269
|
+
# Entire directory
|
|
270
|
+
git checkout <tree-hash> -- src/
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Example: Recovering from Accidental Loss
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
// You were working on new features (unstaged)
|
|
277
|
+
// Accidentally ran `git restore .`
|
|
278
|
+
// Work is gone from file system!
|
|
279
|
+
|
|
280
|
+
// But history remembers:
|
|
281
|
+
const notes = await readHistoryNote(currentTreeHash);
|
|
282
|
+
console.log(`Last validation: ${notes.runs[0].timestamp}`);
|
|
283
|
+
console.log(`Tree hash: ${notes.treeHash}`);
|
|
284
|
+
|
|
285
|
+
// Recover via git:
|
|
286
|
+
// git cat-file -p <tree-hash>:src/lost-work.ts
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Privacy Implications
|
|
290
|
+
|
|
291
|
+
Work protection does NOT increase privacy risks:
|
|
292
|
+
- Git objects are local (not pushed unless you explicitly push git notes)
|
|
293
|
+
- Only files already tracked or trackable are protected
|
|
294
|
+
- .gitignore is respected (secrets stay ignored)
|
|
295
|
+
- Tree hashes are content-based (no PII)
|
|
296
|
+
|
|
297
|
+
See [Work Protection Guide](../../docs/work-protection.md) for comprehensive examples.
|
|
298
|
+
|
|
231
299
|
## Future Extensions
|
|
232
300
|
|
|
233
301
|
- Team sharing (opt-in)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-validate/history",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1-rc.1",
|
|
4
4
|
"description": "Validation history tracking via git notes for vibe-validate",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"yaml": "^2.3.4",
|
|
41
41
|
"zod": "^3.24.1",
|
|
42
|
-
"@vibe-validate/git": "0.17.
|
|
43
|
-
"@vibe-validate/core": "0.17.
|
|
42
|
+
"@vibe-validate/git": "0.17.1-rc.1",
|
|
43
|
+
"@vibe-validate/core": "0.17.1-rc.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^22.0.0",
|