Replace legacy scripts with separated ots/node hooks

- Remove deprecated scripts/ directory (6 files)
- Add hooks/post-commit-ots (ots CLI version)
- Add hooks/pre-commit-ots (ots CLI backfill)
- Add hooks/post-commit-node (Node.js version, local proofs only)
- Add hooks/pre-commit-node (Node.js backfill, no upgrade)
- Update hooks/install.sh to auto-detect and install matching hooks
- Update documentation (SKILL.md, README.md, AGENTS.md)
- Add node_modules/ to .gitignore for Node.js mode

Breaking change: Scripts removed, use new hooks/ directory.
This commit is contained in:
Otto 2026-03-08 00:38:43 +01:00
parent eec64d16c6
commit b1e305d831
14 changed files with 484 additions and 616 deletions

View file

@ -9,15 +9,13 @@ Use this skill when the user wants to:
- Create cryptographic proof of commit history
- Anchor commits to Bitcoin blockchain via OpenTimestamp
## Installation (Recommended)
**Self-contained hooks** - No external dependencies:
## Installation (Auto-Detect)
```bash
# 1. Install prerequisites
# 1. Install prerequisites (ots CLI recommended)
pipx install opentimestamps-client
# 2. Install hooks (single command)
# 2. Install hooks (auto-detects available tools)
./hooks/install.sh .
# 3. Commit proofs to repository
@ -25,31 +23,48 @@ git add .ots/ .gitignore
git commit -m "Add OpenTimestamp proofs for commit history"
```
## Installation (Manual)
## Installation Modes
Copy hook files directly:
The installer auto-detects and installs matching hooks:
| Detected | Hooks Installed | Attestation |
|----------|----------------|-------------|
| `ots` CLI | `post-commit-ots`, `pre-commit-ots` | Full Bitcoin |
| `@opentimestamps/ots` (node) | `post-commit-node`, `pre-commit-node` | Local only |
**Recommendation:** Always prefer ots CLI for production use.
## Manual Installation
### ots CLI Mode
```bash
cp hooks/post-commit .git/hooks/
cp hooks/pre-commit .git/hooks/
chmod +x .git/hooks/post-commit .git/hooks/pre-commit
cp hooks/post-commit-ots .git/hooks/
cp hooks/pre-commit-ots .git/hooks/
chmod +x .git/hooks/*
```
**.gitignore**:
```
.ots/.attestation-cache
### Node.js Mode
```bash
cp hooks/post-commit-node .git/hooks/
cp hooks/pre-commit-node .git/hooks/
chmod +x .git/hooks/*
npm install @opentimestamps/ots # If not already installed
```
## Key Files
| File | Purpose | Version? |
|------|---------|----------|
| `generate-proof.sh` | Creates proof for commit | Yes |
| `backfill-proofs.sh` | Upgrades all historical proofs | Yes |
| `install-ots-hook.sh` | Installs both hooks | Yes |
| `.ots/*.ots` | Binary proofs | Yes |
| `hooks/post-commit-ots` | Post-commit hook (ots CLI) | Yes |
| `hooks/pre-commit-ots` | Backfill hook (ots CLI) | Yes |
| `hooks/post-commit-node` | Post-commit hook (Node.js) | Yes |
| `hooks/pre-commit-node` | Backfill hook (Node.js) | Yes |
| `hooks/install.sh` | Auto-detect installer | Yes |
| `.ots/*.ots` | Individual proofs | Yes |
| `.ots/proof.ots` | Latest proof reference | Yes |
| `.ots/commit-chain.txt` | Commit chain | Yes |
| `.ots/.attestation-cache` | Local cache | No |
| `node_modules/` | Node dependencies (if used) | No |
## Verification
@ -67,4 +82,5 @@ ots verify .ots/<commit-hash>.ots
- Proofs take ~10 min to become Bitcoin-attested
- Cache avoids redundant calendar calls (1-hour validity)
- Pre-commit backfill adds ~10-15s to commit time
- Safe to commit `.ots/` directory (binary proofs are small: ~500B each)
- Node.js version creates local proofs only (no calendar submission)
- Safe to commit `.ots/` directory (binary proofs are ~500-900B each)