@alx-protocol/cli
v1.0.0
Published
ALX Protocol CLI — create, validate, and trace blocks from the command line
Readme
ALX CLI
Command-line interface and HTTP API server for the ALX Protocol.
Commands
alx init [dir] Create a starter project with example blocks
alx validate <file> Validate a block or graph (JSON)
alx inspect <file> Explain a block field-by-field
alx block create <options> Create a new block
alx trace <hash> --file <f> Trace attribution through a graph
alx test-vectors run Run official conformance tests
alx serve [--port 8080] Start local reference API server
alx version Show version infoQuick start
# From the repo root
pnpm install && pnpm build
# Run conformance tests
node cli/bin/alx.js test-vectors run
# Create a demo project
node cli/bin/alx.js init demo
cd demo
# Validate blocks
node ../cli/bin/alx.js validate research.block.json
node ../cli/bin/alx.js validate graph.json
# Inspect a block
node ../cli/bin/alx.js inspect decision.block.jsonHTTP API
Start the server:
node cli/bin/alx.js serve --port 8080Endpoints:
| Method | Path | Description |
|---|---|---|
| GET | /health | Health check |
| GET | /version | CLI + protocol version |
| POST | /block/create | Create a block from content + parents |
| POST | /block/validate | Validate a block's integrity |
| POST | /validate | Alias for /block/validate |
| POST | /trace | Trace attribution through a graph |
| POST | /test-vectors/run | Run conformance suite |
Example:
curl http://localhost:8080/health
curl -X POST http://localhost:8080/block/create \
-H "Content-Type: application/json" \
-d '{"content":{"type":"test"},"parentHashes":[]}'
curl -X POST http://localhost:8080/test-vectors/runOutput modes
Commands produce human-readable output by default. Add --json for machine-readable JSON:
node cli/bin/alx.js block create --content '{"x":1}' --json