Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6b9c527

Browse files
kevincodex1OpenClaude
andcommitted
chore: initial public release
Open-source release of the gitlawb node, CLI, and git remote helper. - gitlawb-node: Axum HTTP server with git smart-HTTP and DID auth - gl: command-line client (identity, repos, PRs, MCP server) - git-remote-gitlawb: git remote helper for gitlawb:// URLs - gitlawb-core: shared crypto primitives (DID, CID, HTTP sigs, UCAN) Dual licensed under MIT or Apache-2.0. Co-Authored-By: OpenClaude <[email protected]>
0 parents  commit 6b9c527

107 files changed

Lines changed: 32477 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# gitlawb node — environment variables
2+
# Copy to .env and fill in your values.
3+
# All variables are optional unless marked REQUIRED.
4+
5+
# ── Node identity ─────────────────────────────────────────────────────────
6+
# Path to the node's Ed25519 keypair PEM file.
7+
# Generate with: gl identity new
8+
GITLAWB_KEY=/data/keys/identity.pem
9+
10+
# Publicly reachable URL of this node (used in peer announcements)
11+
GITLAWB_PUBLIC_URL=https://your-node.example.com
12+
13+
# ── Server ────────────────────────────────────────────────────────────────
14+
GITLAWB_HOST=0.0.0.0
15+
GITLAWB_PORT=7545
16+
17+
# ── Storage ───────────────────────────────────────────────────────────────
18+
GITLAWB_REPOS_DIR=/data/repos
19+
20+
# PostgreSQL connection URL. Required.
21+
# When using the bundled docker-compose, this is wired automatically.
22+
DATABASE_URL=postgresql://gitlawb:changeme@localhost:5432/gitlawb
23+
24+
# ── IPFS pinning (Pinata) ─────────────────────────────────────────────────
25+
# Get a JWT at https://app.pinata.cloud/developers/api-keys
26+
GITLAWB_PINATA_JWT=
27+
GITLAWB_PINATA_UPLOAD_URL=https://uploads.pinata.cloud/v3/files
28+
29+
# ── Arweave permanent anchoring (Irys devnet) ─────────────────────────────
30+
# Leave empty to disable Arweave anchoring.
31+
GITLAWB_IRYS_URL=https://devnet.irys.xyz
32+
33+
# ── Base L2 smart contracts ───────────────────────────────────────────────
34+
GITLAWB_CHAIN_RPC_URL=https://sepolia.base.org
35+
GITLAWB_CONTRACT_DID_REGISTRY=0x8046284116C5ac6724adbBf860feBeA85692d574
36+
GITLAWB_CONTRACT_NAME_REGISTRY=0x73094B9DAb2421878A20Abed1497001fbD51302c
37+
38+
# $GITLAWB ERC20 token (Base mainnet).
39+
GITLAWB_TOKEN=0x5F980Dcfc4c0fa3911554cf5ab288ed0eb13DBa3
40+
41+
# ── On-chain PoS (operators — required to earn rewards) ───────────────────
42+
# Set both of the next two to enable Proof-of-Stake mode. With both set, the
43+
# node verifies its registration on startup and posts heartbeats automatically.
44+
# Leave empty to run without on-chain PoS (local dev / pre-launch).
45+
46+
# Deployed GitlawbNodeStaking contract address.
47+
GITLAWB_CONTRACT_NODE_STAKING=
48+
49+
# Operator wallet private key (0x-prefixed hex). Used to sign heartbeats.
50+
# Use a dedicated wallet with only enough ETH for gas — not your treasury.
51+
GITLAWB_OPERATOR_PRIVATE_KEY=
52+
53+
# If true, the node refuses to start unless registered and currently active.
54+
# Leave false while bootstrapping; flip to true once your stake is confirmed.
55+
GITLAWB_OPERATOR_STRICT_MODE=false
56+
57+
# Heartbeat cadence in hours. Must be < 24 with headroom. Default: 20.
58+
GITLAWB_HEARTBEAT_INTERVAL_HOURS=20
59+
60+
# ── docker-compose Postgres password ──────────────────────────────────────
61+
# Only used when running via `docker compose up` with the bundled Postgres.
62+
POSTGRES_PASSWORD=changeme
63+
64+
# ── P2P networking ────────────────────────────────────────────────────────
65+
GITLAWB_P2P_PORT=7546
66+
# Comma-separated multiaddrs of bootstrap peers
67+
GITLAWB_BOOTSTRAP_PEERS=
68+
69+
# ── Access control ────────────────────────────────────────────────────────
70+
# Set to false to require auth on all read endpoints
71+
GITLAWB_PUBLIC_READ=true
72+
73+
# ── Sync ─────────────────────────────────────────────────────────────────
74+
# Enable automatic background sync from known peers
75+
GITLAWB_AUTO_SYNC=false

.github/workflows/pr-checks.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: PR Checks
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
RUST_BACKTRACE: 1
15+
16+
jobs:
17+
fmt-clippy-test:
18+
name: fmt + clippy + test
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Check out repository
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
25+
- name: Set up Rust toolchain
26+
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # stable
27+
with:
28+
toolchain: stable
29+
components: rustfmt, clippy
30+
31+
- name: Cache cargo
32+
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
33+
34+
- name: cargo fmt --check
35+
run: cargo fmt --all -- --check
36+
37+
- name: cargo clippy
38+
run: cargo clippy --workspace --all-targets -- -D warnings
39+
40+
- name: cargo test
41+
run: cargo test --workspace

.github/workflows/release.yml

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: release-${{ github.ref }}
10+
cancel-in-progress: false
11+
12+
jobs:
13+
release-please:
14+
if: ${{ github.repository == 'Gitlawb/node' }}
15+
name: Release Please
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
outputs:
21+
release_created: ${{ steps.release.outputs.release_created }}
22+
tag_name: ${{ steps.release.outputs.tag_name }}
23+
version: ${{ steps.release.outputs.version }}
24+
steps:
25+
- name: Run release-please
26+
id: release
27+
uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.3.0
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
docker:
32+
name: Build & Push Docker Image
33+
needs: release-please
34+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read
38+
packages: write
39+
steps:
40+
- name: Checkout release tag
41+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
with:
43+
ref: ${{ needs.release-please.outputs.tag_name }}
44+
45+
- name: Set up QEMU
46+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
47+
48+
- name: Set up Docker Buildx
49+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
50+
51+
- name: Log in to GitHub Container Registry
52+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Extract metadata
59+
id: meta
60+
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
61+
with:
62+
images: ghcr.io/${{ github.repository }}
63+
tags: |
64+
type=semver,pattern={{version}},value=${{ needs.release-please.outputs.version }}
65+
type=semver,pattern={{major}}.{{minor}},value=${{ needs.release-please.outputs.version }}
66+
type=raw,value=latest
67+
68+
- name: Build and load locally (smoke)
69+
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0
70+
with:
71+
context: .
72+
load: true
73+
tags: gitlawb-node:smoke
74+
cache-from: type=gha
75+
76+
- name: Smoke test
77+
run: docker run --rm gitlawb-node:smoke --version
78+
79+
- name: Build and push (multi-arch)
80+
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0
81+
with:
82+
context: .
83+
platforms: linux/amd64,linux/arm64
84+
push: true
85+
tags: ${{ steps.meta.outputs.tags }}
86+
labels: ${{ steps.meta.outputs.labels }}
87+
cache-from: type=gha
88+
cache-to: type=gha,mode=max
89+
90+
- name: Release summary
91+
run: |
92+
{
93+
echo "## Released ${{ needs.release-please.outputs.tag_name }}"
94+
echo
95+
echo "- Image: \`ghcr.io/${{ github.repository }}:${{ needs.release-please.outputs.version }}\`"
96+
echo "- GitHub: https://github.com/${{ github.repository }}/releases/tag/${{ needs.release-please.outputs.tag_name }}"
97+
} >> "$GITHUB_STEP_SUMMARY"
98+
99+
release-binaries:
100+
name: Build & Attach Binaries
101+
needs: release-please
102+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
103+
runs-on: ${{ matrix.os }}
104+
permissions:
105+
contents: write
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
include:
110+
- target: x86_64-unknown-linux-musl
111+
os: ubuntu-latest
112+
- target: aarch64-unknown-linux-musl
113+
os: ubuntu-latest
114+
- target: x86_64-apple-darwin
115+
os: macos-13
116+
- target: aarch64-apple-darwin
117+
os: macos-14
118+
steps:
119+
- name: Checkout release tag
120+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
121+
with:
122+
ref: ${{ needs.release-please.outputs.tag_name }}
123+
124+
- name: Set up Rust toolchain
125+
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # stable
126+
with:
127+
toolchain: stable
128+
targets: ${{ matrix.target }}
129+
130+
- name: Install musl tools (linux)
131+
if: contains(matrix.target, 'linux-musl')
132+
run: |
133+
sudo apt-get update
134+
sudo apt-get install -y musl-tools
135+
if [ "${{ matrix.target }}" = "aarch64-unknown-linux-musl" ]; then
136+
sudo apt-get install -y gcc-aarch64-linux-gnu
137+
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
138+
echo "CC_aarch64_unknown_linux_musl=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
139+
fi
140+
141+
- name: Cache cargo
142+
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
143+
with:
144+
key: ${{ matrix.target }}
145+
146+
- name: Build
147+
run: cargo build --release --target ${{ matrix.target }} -p gl -p git-remote-gitlawb -p gitlawb-node
148+
149+
- name: Package
150+
id: pkg
151+
shell: bash
152+
run: |
153+
set -euo pipefail
154+
NAME="gitlawb-node-${{ needs.release-please.outputs.version }}-${{ matrix.target }}"
155+
mkdir -p "dist/$NAME"
156+
cp "target/${{ matrix.target }}/release/gl" "dist/$NAME/"
157+
cp "target/${{ matrix.target }}/release/git-remote-gitlawb" "dist/$NAME/"
158+
cp "target/${{ matrix.target }}/release/gitlawb-node" "dist/$NAME/"
159+
cp README.md LICENSE-MIT LICENSE-APACHE "dist/$NAME/"
160+
cd dist
161+
tar czf "$NAME.tar.gz" "$NAME"
162+
shasum -a 256 "$NAME.tar.gz" > "$NAME.tar.gz.sha256"
163+
echo "asset=dist/$NAME.tar.gz" >> "$GITHUB_OUTPUT"
164+
echo "checksum=dist/$NAME.tar.gz.sha256" >> "$GITHUB_OUTPUT"
165+
166+
- name: Attach to release
167+
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
168+
with:
169+
tag_name: ${{ needs.release-please.outputs.tag_name }}
170+
files: |
171+
${{ steps.pkg.outputs.asset }}
172+
${{ steps.pkg.outputs.checksum }}

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/target
2+
**/*.rs.bk
3+
Cargo.lock.bak
4+
5+
# Local node data
6+
/data
7+
/repos
8+
9+
# Env / secrets
10+
.env
11+
.env.local
12+
*.pem
13+
keys/
14+
15+
# Editor / OS
16+
.DS_Store
17+
.vscode/
18+
.idea/
19+
*.swp
20+
*.swo
21+
22+
# Logs
23+
*.log

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.3.8"
3+
}

0 commit comments

Comments
 (0)