Remove Node.js hooks, require ots CLI only

- Delete hooks/post-commit-node (local proofs only, no attestation)
- Delete hooks/pre-commit-node (no upgrade support)
- Update hooks/install.sh to require ots CLI (no fallback)
- Update documentation with clear ots CLI requirement
- Add prominent warnings about Node.js limitations

Rationale: The @opentimestamps/ots Node.js package only creates
local proofs without calendar submission or Bitcoin attestation.
For tamper-evident timestamps, ots CLI is the only complete
implementation. No partial/fallback implementations.
This commit is contained in:
Otto 2026-03-08 00:50:32 +01:00
parent b1e305d831
commit b4e2eb3c12
6 changed files with 203 additions and 357 deletions

116
SKILL.md
View file

@ -1,16 +1,40 @@
---
name: git-ots-hook
description: Install and manage OpenTimestamp git hooks that generate cryptographic proof for every commit. Use when you need to add tamper-evident timestamps to git commits using the OpenTimestamp protocol. Auto-detects ots CLI (recommended) or Node.js package.
description: Install and manage OpenTimestamp git hooks that generate cryptographic proof for every commit. Requires opentimestamps-client (ots CLI) for full Bitcoin attestation.
---
# Git OpenTimestamp Hook
Automatically generates OpenTimestamp proofs for git commits via git hooks.
## ⚠️ Prerequisites (Required)
**You must have `ots` CLI installed:**
```bash
# Recommended (isolated install)
pipx install opentimestamps-client
# Or with pip
pip install opentimestamps-client
# Or from source
git clone https://github.com/opentimestamps/opentimestamps-client
cd opentimestamps-client && pip install .
```
**Verify installation:**
```bash
ots --version
# v0.7.2 or later
```
> **Why ots CLI is required:** The Node.js `@opentimestamps/ots` package only creates local proofs without calendar submission or Bitcoin attestation. For tamper-evident timestamps anchored to Bitcoin, the Python `opentimestamps-client` is the only complete implementation.
## Quick Start
```bash
# Install both hooks (auto-detects ots CLI or Node.js)
# Install both hooks (requires ots CLI)
./hooks/install.sh /path/to/repo
# Or from repo root
@ -18,32 +42,18 @@ Automatically generates OpenTimestamp proofs for git commits via git hooks.
```
The installer will:
1. Detect available tools (ots CLI preferred, Node.js fallback)
2. Install matching hooks
3. Setup `.gitignore` (excludes cache + node_modules)
4. Install `@opentimestamps/ots` locally if using Node.js mode
1. Verify `ots` CLI is installed
2. Install post-commit and pre-commit hooks
3. Setup `.gitignore` (excludes cache file)
## What It Does
- **Auto-detects tools**: ots CLI (full Bitcoin attestation) or Node.js package (local proofs only)
- **Post-commit hook**: Generates `.ots/<commit-hash>.ots` for each new commit
- **Pre-commit backfill**: Upgrades historical proofs to attested status (ots CLI only)
- **Pre-commit backfill**: Upgrades historical proofs to Bitcoin-attested status
- Creates `.ots/proof.ots` (latest proof reference)
- Stores commit chain in `.ots/commit-chain.txt`
- Smart caching: Skips calendar calls for recently checked proofs
## Prerequisites
**Option 1: ots CLI (Recommended - Full Bitcoin attestation)**
```bash
pipx install opentimestamps-client
```
**Option 2: Node.js (Local proofs only)**
```bash
# Package will be installed locally by the installer
# Or globally: npm install -g @opentimestamps/ots
```
- Submits to 4+ remote calendar servers for Bitcoin anchoring
## Generated Files
@ -58,32 +68,39 @@ repo/
└── ...
```
## Manual Usage
## Manual Installation
**Install hooks (auto-detect):**
```bash
./hooks/install.sh /path/to/repo
```
If you prefer manual setup:
**Manual installation:**
```bash
# For ots CLI:
cp hooks/post-commit-ots .git/hooks/post-commit
cp hooks/pre-commit-ots .git/hooks/pre-commit
# For Node.js:
cp hooks/post-commit-node .git/hooks/post-commit
cp hooks/pre-commit-node .git/hooks/pre-commit
chmod +x .git/hooks/post-commit .git/hooks/pre-commit
```
Add to `.gitignore`:
```
.ots/.attestation-cache
```
## Manual Usage
**Check attestation status:**
```bash
ots info .ots/<commit-hash>.ots | grep -c "PendingAttestation"
# 0 = attested, >0 = pending
```
**Verify a proof:**
```bash
ots verify .ots/<commit-hash>.ots
```
**Upgrade pending proofs:**
```bash
ots upgrade .ots/<commit-hash>.ots
```
## Notes
### Versioning Proofs
@ -101,28 +118,39 @@ git commit -m "Add OpenTimestamp proofs"
**Ignore these:**
- `.attestation-cache` - Local performance cache
- `node_modules/` - If using Node.js mode (auto-added by installer)
### Performance
- **First backfill:** ~30-60s (scans history, contacts calendars)
- **Subsequent commits:** ~10-15s (cached status skips redundant calls)
- **Cache:** 1-hour validity, 10-min recheck for pending proofs
- **Cache:** 1-hour validity, re-checks pending proofs after 10 min
- **Attestation time:** ~10 min (Bitcoin block confirmation)
### Modes
### How It Works
| Feature | ots CLI | Node.js |
|---------|---------|---------|
| Calendar submission | ✓ | ✗ |
| Bitcoin attestation | ✓ | ✗ |
| Local proofs | ✓ | ✓ |
| Upgrade support | ✓ | ✗ |
| Speed | Fast | Fast |
1. **Commit created** → Post-commit hook runs
2. **Hash generated** → SHA256 of commit hash
3. **Submitted to calendars** → 4+ remote servers receive hash
4. **Bitcoin anchoring** → Calendars batch and anchor to Bitcoin
5. **Attestation**`ots upgrade` downloads Bitcoin proof
6. **Verification** → Anyone can verify against Bitcoin blockchain
**Recommendation:** Use ots CLI for production. Node.js for development/testing only.
### Calendar Servers
Default calendars used:
- `https://a.pool.opentimestamps.org`
- `https://b.pool.opentimestamps.org`
- `https://a.pool.eternitywall.com`
- `https://btc.calendar.catallaxy.com`
## Uninstall
```bash
rm .git/hooks/post-commit .git/hooks/pre-commit
```
## Links
- [OpenTimestamp](https://opentimestamps.org/)
- [opentimestamps-client](https://github.com/opentimestamps/opentimestamps-client)
- [How OpenTimestamp works](https://petertodd.org/2016/opentimestamps-announcement)