@vibe-validate/git 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 +53 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Git utilities for vibe-validate - deterministic tree hash calculation, branch sy
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Deterministic Git Tree Hash**: Content-based hashing using `git write-tree` (no timestamps)
|
|
7
|
+
- **Deterministic Git Tree Hash with Automatic Work Protection**: Content-based hashing using `git write-tree` (no timestamps) - automatically creates recoverable snapshots of all files
|
|
8
8
|
- **Branch Sync Checking**: Safe branch synchronization verification without auto-merging
|
|
9
9
|
- **Post-Merge Cleanup**: Automated cleanup of merged branches after PR completion
|
|
10
10
|
|
|
@@ -114,6 +114,8 @@ git reset // Restore index to clean state
|
|
|
114
114
|
- Enables reliable validation state caching
|
|
115
115
|
- Includes all files (staged, unstaged, untracked)
|
|
116
116
|
- No side effects (index restored after hash)
|
|
117
|
+
- Automatic work protection (all files stored as git objects)
|
|
118
|
+
- Recoverable snapshots of uncommitted work
|
|
117
119
|
|
|
118
120
|
### Safe Branch Sync
|
|
119
121
|
|
|
@@ -131,6 +133,56 @@ git reset // Restore index to clean state
|
|
|
131
133
|
- Never deletes main branch
|
|
132
134
|
- Provides clear feedback on all operations
|
|
133
135
|
|
|
136
|
+
## Automatic Work Protection
|
|
137
|
+
|
|
138
|
+
A valuable side benefit of the deterministic tree hash calculation is automatic work protection.
|
|
139
|
+
|
|
140
|
+
### Technical Implementation
|
|
141
|
+
|
|
142
|
+
When `getGitTreeHash()` runs, it:
|
|
143
|
+
1. Creates temporary index: `.git/vibe-validate-temp-index`
|
|
144
|
+
2. Copies current index to temp index
|
|
145
|
+
3. Runs `git add --all` in temp index (stages everything)
|
|
146
|
+
4. Runs `git write-tree` (creates git objects for all files)
|
|
147
|
+
5. Deletes temp index (your real index remains untouched)
|
|
148
|
+
|
|
149
|
+
**Critical insight**: Step 4 creates permanent git objects in `.git/objects/` for every file, even though the temp index is deleted. These objects remain accessible via the tree hash.
|
|
150
|
+
|
|
151
|
+
### What Gets Protected
|
|
152
|
+
|
|
153
|
+
Every file in your working directory (respecting .gitignore):
|
|
154
|
+
- ✅ Staged changes (in git index)
|
|
155
|
+
- ✅ Unstaged modifications (tracked files)
|
|
156
|
+
- ✅ Untracked files (new files not yet added)
|
|
157
|
+
|
|
158
|
+
**Not protected** (by design):
|
|
159
|
+
- ❌ Files in .gitignore (secrets, credentials, build artifacts)
|
|
160
|
+
|
|
161
|
+
### Storage Overhead
|
|
162
|
+
|
|
163
|
+
**Zero additional overhead**: Git's content-addressable storage automatically deduplicates identical file content. If a file hasn't changed between validations, no additional storage is used.
|
|
164
|
+
|
|
165
|
+
### Recovery Examples
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Scenario: Accidentally deleted file that was never committed
|
|
169
|
+
$ echo "Important work" > new-feature.ts
|
|
170
|
+
$ vv validate # Tree hash: abc123...
|
|
171
|
+
$ rm new-feature.ts # Oops!
|
|
172
|
+
|
|
173
|
+
# Recovery:
|
|
174
|
+
$ git cat-file -p abc123def:new-feature.ts > new-feature.ts
|
|
175
|
+
|
|
176
|
+
# Scenario: Want to see file content from 2 hours ago
|
|
177
|
+
$ vv history list
|
|
178
|
+
2025-12-02 14:30:15 abc123... # 2 hours ago
|
|
179
|
+
2025-12-02 16:45:22 def456... # Current
|
|
180
|
+
|
|
181
|
+
$ git cat-file -p abc123def:src/feature.ts # View old version
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
See [Work Protection Guide](../../docs/work-protection.md) for more examples.
|
|
185
|
+
|
|
134
186
|
## License
|
|
135
187
|
|
|
136
188
|
MIT
|
package/package.json
CHANGED