···1.PHONY: all build install test clean fmt lint help version bump-patch bump-minor bump-major release
023# Binary name
4BINARY_NAME=plcbundle
5INSTALL_PATH=$(GOPATH)/bin
000000067# Version information
8VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
···93 @echo "Creating release for version $(VERSION)..."
94 @./scripts/release.sh
9596-# Show help
0000000000000000000000000000000000000000000000000097help:
98 @echo "Available targets:"
0099 @echo " make build - Build the CLI tool"
100 @echo " make install - Install CLI tool globally"
000101 @echo " make test - Run tests"
102 @echo " make test-coverage - Run tests with coverage"
103- @echo " make clean - Clean build artifacts"
104 @echo " make fmt - Format code"
105 @echo " make deps - Download dependencies"
106 @echo " make verify - Verify dependencies"
00107 @echo " make version - Show current version"
108 @echo " make bump-patch - Bump patch version (0.1.0 -> 0.1.1)"
109 @echo " make bump-minor - Bump minor version (0.1.0 -> 0.2.0)"
110 @echo " make bump-major - Bump major version (0.1.0 -> 1.0.0)"
111 @echo " make release - Create and push release tag"
112- @echo " make help - Show this help"
000000000
···1.PHONY: all build install test clean fmt lint help version bump-patch bump-minor bump-major release
2+.PHONY: docker-build docker-push docker-run docker-clean docker-shell compose-up compose-down compose-logs
34# Binary name
5BINARY_NAME=plcbundle
6INSTALL_PATH=$(GOPATH)/bin
7+8+# Docker configuration
9+DOCKER_IMAGE=plcbundle
10+DOCKER_TAG=$(VERSION)
11+DOCKER_REGISTRY?=
12+DOCKER_FULL_IMAGE=$(if $(DOCKER_REGISTRY),$(DOCKER_REGISTRY)/,)$(DOCKER_IMAGE):$(DOCKER_TAG)
13+DOCKER_LATEST=$(if $(DOCKER_REGISTRY),$(DOCKER_REGISTRY)/,)$(DOCKER_IMAGE):latest
1415# Version information
16VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
···101 @echo "Creating release for version $(VERSION)..."
102 @./scripts/release.sh
103104+# ============================================================================
105+# Docker Commands
106+# ============================================================================
107+108+# Build Docker image
109+docker-build:
110+ @echo "Building Docker image $(DOCKER_FULL_IMAGE)..."
111+ docker build \
112+ --build-arg VERSION=$(VERSION) \
113+ --build-arg GIT_COMMIT=$(GIT_COMMIT) \
114+ -t $(DOCKER_FULL_IMAGE) \
115+ -t $(DOCKER_LATEST) \
116+ .
117+ @echo "✓ Built: $(DOCKER_FULL_IMAGE)"
118+119+# Push Docker image to registry
120+docker-push:
121+ @echo "Pushing Docker image..."
122+ docker push $(DOCKER_FULL_IMAGE)
123+ docker push $(DOCKER_LATEST)
124+ @echo "✓ Pushed: $(DOCKER_FULL_IMAGE)"
125+126+# Build and push
127+docker-release: docker-build docker-push
128+129+# Run Docker container as CLI
130+docker-run:
131+ docker run --rm -v $(PWD)/data:/data $(DOCKER_FULL_IMAGE) $(CMD)
132+133+# Run Docker container as server
134+docker-serve:
135+ docker run --rm -it \
136+ -p 8080:8080 \
137+ -v $(PWD)/data:/data \
138+ $(DOCKER_FULL_IMAGE) \
139+ plcbundle serve --host 0.0.0.0
140+141+# Open shell in Docker container
142+docker-shell:
143+ docker run --rm -it -v $(PWD)/data:/data $(DOCKER_FULL_IMAGE) sh
144+145+# Clean Docker artifacts
146+docker-clean:
147+ @echo "Cleaning Docker images..."
148+ docker rmi $(DOCKER_FULL_IMAGE) $(DOCKER_LATEST) 2>/dev/null || true
149+ docker image prune -f
150+151+# ============================================================================
152+# Help
153+# ============================================================================
154+155help:
156 @echo "Available targets:"
157+ @echo ""
158+ @echo "Build & Install:"
159 @echo " make build - Build the CLI tool"
160 @echo " make install - Install CLI tool globally"
161+ @echo " make clean - Clean build artifacts"
162+ @echo ""
163+ @echo "Development:"
164 @echo " make test - Run tests"
165 @echo " make test-coverage - Run tests with coverage"
0166 @echo " make fmt - Format code"
167 @echo " make deps - Download dependencies"
168 @echo " make verify - Verify dependencies"
169+ @echo ""
170+ @echo "Versioning:"
171 @echo " make version - Show current version"
172 @echo " make bump-patch - Bump patch version (0.1.0 -> 0.1.1)"
173 @echo " make bump-minor - Bump minor version (0.1.0 -> 0.2.0)"
174 @echo " make bump-major - Bump major version (0.1.0 -> 1.0.0)"
175 @echo " make release - Create and push release tag"
176+ @echo ""
177+ @echo "Docker:"
178+ @echo " make docker-build - Build Docker image"
179+ @echo " make docker-push - Push image to registry"
180+ @echo " make docker-release - Build and push"
181+ @echo " make docker-run - Run as CLI (CMD='info')"
182+ @echo " make docker-serve - Run as server"
183+ @echo " make docker-shell - Open shell in container"
184+ @echo " make docker-clean - Remove Docker images"
185+ @echo ""
+62-26
README.md
···35* 💻 [CLI Guide](./docs/cli.md)
36* 📰 [Announcement Article](https://leaflet.pub/feb982b4-64cb-4549-9d25-d7e68cecb11a)
3738-## What is `plcbundle`?
3940-plcbundle solves the problem of synchronizing and archiving PLC directory operations by:
4142- **Bundling**: Groups 10,000 operations into compressed, immutable files
43- **Chaining**: Each bundle is cryptographically linked to the previous one
44- **Verifiable**: SHA-256 hashes ensure data integrity throughout the chain
45- **Efficient**: Zstandard compression with ~5x compression ratios
460000000000000000000000000000000000000000000000000000047## Quick Start
4849### As a Library
···63### As a CLI Tool
6465```bash
66-# Install
67-go install tangled.org/atscan.net/plcbundle/cmd/plcbundle@latest
68-69-# Fetch bundles
70plcbundle fetch
7172# Clone from remote
···7879[See full CLI reference →](./docs/cli.md)
8081-## Key Features
82-83-- 📦 Automatic bundle management (10,000 operations each)
84-- 🔄 Transparent synchronization with PLC directory
85-- 🗜️ Efficient zstd compression
86-- ✅ Cryptographic verification (SHA-256 + chain validation)
87-- 🔍 Fast indexing and gap detection
88-- 🌐 HTTP server for hosting bundles
89-- 🔌 WebSocket streaming support
90-91-## Installation
9293```bash
94-# Library
95-go get tangled.org/atscan.net/plcbundle
9697-# CLI tool
98-go install tangled.org/atscan.net/plcbundle/cmd/plcbundle@latest
099```
100101## Use Cases
···113- ✅ Check published root and head hashes
114- ✅ Anyone can reproduce bundles from PLC directory
115116-## Reference Implementations
117-118-- [TypeScript, Python, Ruby](https://tangled.org/@atscan.net/plcbundle-ref/)
119-120## Documentation
121122- [Library Guide](./docs/library.md) - Comprehensive API documentation
123- [CLI Guide](./docs/cli.md) - Command-line tool usage
124- [Specification](./docs/specification.md) - Technical format specification
125-<!--- [Examples](./docs/examples/) - Common patterns and recipes-->
126127## License
128
···35* 💻 [CLI Guide](./docs/cli.md)
36* 📰 [Announcement Article](https://leaflet.pub/feb982b4-64cb-4549-9d25-d7e68cecb11a)
3738+## What is plcbundle?
3940+plcbundle is a **format specification** for archiving PLC directory operations:
4142- **Bundling**: Groups 10,000 operations into compressed, immutable files
43- **Chaining**: Each bundle is cryptographically linked to the previous one
44- **Verifiable**: SHA-256 hashes ensure data integrity throughout the chain
45- **Efficient**: Zstandard compression with ~5x compression ratios
4647+### Implementations
48+49+- **Go** (this repository) - Full-featured CLI tool, library, and HTTP server
50+- [TypeScript, Python, Ruby](https://tangled.org/@atscan.net/plcbundle-ref/) - Reference implementations
51+52+## This Implementation (Go)
53+54+This Go implementation provides:
55+56+- 📚 **Library** - Embed bundle operations in your Go applications
57+- 💻 **CLI Tool** - Command-line interface for all operations
58+- 🌐 **HTTP Server** - Host and serve bundles over HTTP
59+- 🔄 **Auto-sync** - Automatically fetch and bundle new operations
60+- 🔌 **WebSocket** - Stream operations in real-time
61+- 🔍 **Spam Detection** - Built-in and custom JavaScript detectors
62+- ⚡ **Performance** - Parallel processing, efficient compression
63+- 🐳 **Docker** - Ready-to-deploy containers
64+65+## Installation
66+67+### Go Install
68+69+```bash
70+# CLI tool
71+go install tangled.org/atscan.net/plcbundle/cmd/plcbundle@latest
72+73+# Library
74+go get tangled.org/atscan.net/plcbundle
75+```
76+77+### Docker
78+79+```bash
80+# Build
81+docker build -t plcbundle .
82+83+# Run CLI
84+docker run --rm -v $(pwd)/data:/data plcbundle info
85+docker run --rm -v $(pwd)/data:/data plcbundle fetch
86+87+# Run as server
88+docker-compose up -d
89+```
90+91+### From Source
92+93+```bash
94+git clone https://tangled.org/@atscan.net/plcbundle
95+cd plcbundle
96+make build
97+sudo make install
98+```
99+100## Quick Start
101102### As a Library
···116### As a CLI Tool
117118```bash
119+# Fetch bundles from plc.directory
000120plcbundle fetch
121122# Clone from remote
···128129[See full CLI reference →](./docs/cli.md)
130131+### With Docker
0000000000132133```bash
134+# CLI usage
135+docker run --rm -v $(pwd)/data:/data plcbundle info
136137+# Server mode
138+docker-compose up -d
139+curl http://localhost:8080/
140```
141142## Use Cases
···154- ✅ Check published root and head hashes
155- ✅ Anyone can reproduce bundles from PLC directory
1560000157## Documentation
158159- [Library Guide](./docs/library.md) - Comprehensive API documentation
160- [CLI Guide](./docs/cli.md) - Command-line tool usage
161- [Specification](./docs/specification.md) - Technical format specification
0162163## License
164