Skip to content

Commit e29dab7

Browse files
committed
feat: initial csgclaw implementation
1 parent c56c958 commit e29dab7

Some content is hidden

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

51 files changed

+8948
-0
lines changed

.github/workflows/release.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: "Release version, for example v0.1.0"
11+
required: true
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
build-and-release:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- runner: ubuntu-latest
23+
goos: linux
24+
goarch: amd64
25+
- runner: macos-14
26+
goos: darwin
27+
goarch: arm64
28+
runs-on: ${{ matrix.runner }}
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Set up Go
35+
uses: actions/setup-go@v5
36+
with:
37+
go-version-file: go.mod
38+
39+
- name: Resolve version
40+
id: version
41+
shell: bash
42+
run: |
43+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
44+
version="${{ github.event.inputs.version }}"
45+
else
46+
version="${GITHUB_REF_NAME}"
47+
fi
48+
echo "value=${version}" >> "$GITHUB_OUTPUT"
49+
50+
- name: Fetch BoxLite native library
51+
shell: bash
52+
working-directory: third_party/boxlite-go
53+
env:
54+
BOXLITE_SDK_VERSION: v0.7.6
55+
run: go run ./cmd/setup
56+
57+
- name: Package release archive
58+
shell: bash
59+
run: |
60+
chmod +x scripts/package-release.sh
61+
VERSION="${{ steps.version.outputs.value }}" \
62+
DIST_DIR=dist \
63+
APP=csgclaw \
64+
GOCACHE="${{ github.workspace }}/.gocache" \
65+
CGO_ENABLED=1 \
66+
./scripts/package-release.sh "${{ matrix.goos }}" "${{ matrix.goarch }}"
67+
68+
- name: Upload release asset
69+
uses: softprops/action-gh-release@v2
70+
with:
71+
tag_name: ${{ steps.version.outputs.value }}
72+
files: dist/*

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DS_Store
2+
3+
# Go build/test artifacts
4+
.gocache/
5+
bin/
6+
dist/
7+
*.test
8+
*.out
9+
10+
# Local binaries
11+
/csgclaw
12+
13+
# Local runtime data
14+
manager-data/
15+
16+
# Editor directories
17+
.idea/
18+
.vscode/
19+
20+
# Vendored native libraries fetched on demand
21+
third_party/boxlite-go/libboxlite.a

Makefile

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
APP ?= csgclaw
2+
BIN_DIR ?= bin
3+
BIN ?= $(BIN_DIR)/$(APP)
4+
DIST_DIR ?= dist
5+
GOCACHE ?= $(CURDIR)/.gocache
6+
VERSION ?= dev
7+
8+
GO ?= go
9+
GOFMT ?= gofmt
10+
11+
ONBOARD_BASE_URL ?= http://127.0.0.1:4000
12+
ONBOARD_API_KEY ?= sk-1234567890
13+
ONBOARD_MODEL_ID ?= minimax-m2.7
14+
ONBOARD_MANAGER_IMAGE ?= ghcr.io/russellluo/picoclaw:2026.3.27
15+
16+
IMAGE ?= ghcr.io/russellluo/picoclaw
17+
TAG ?= 2025.3.25
18+
LOCAL_IMAGE ?= picoclaw:local
19+
20+
.PHONY: help fmt test build run onboard clean package release tag push publish boxlite-setup
21+
22+
help:
23+
@printf '%s\n' \
24+
'make fmt - format Go files' \
25+
'make boxlite-setup - fetch BoxLite native library if missing' \
26+
'make test - run Go tests with local build cache' \
27+
'make build - build $(BIN)' \
28+
'make run - run the server in foreground' \
29+
'make onboard - initialize ~/.csgclaw/config.toml with defaults' \
30+
'make package - package current platform binary into dist/' \
31+
'make release - build release archives for macOS/Linux/Windows' \
32+
'make clean - remove local build outputs' \
33+
'make tag - tag local manager image' \
34+
'make push - push manager image' \
35+
'make publish - tag and push manager image'
36+
37+
fmt:
38+
$(GOFMT) -w $(shell find cmd internal -name '*.go')
39+
40+
boxlite-setup:
41+
@if [ ! -f third_party/boxlite-go/libboxlite.a ]; then \
42+
echo "fetching BoxLite native library..."; \
43+
cd third_party/boxlite-go && BOXLITE_SDK_VERSION=v0.7.6 $(GO) run ./cmd/setup; \
44+
fi
45+
46+
test: boxlite-setup
47+
env GOCACHE=$(GOCACHE) $(GO) test ./...
48+
49+
build: boxlite-setup
50+
mkdir -p $(BIN_DIR)
51+
env GOCACHE=$(GOCACHE) $(GO) build -o $(BIN) ./cmd/csgclaw
52+
53+
run: boxlite-setup
54+
env GOCACHE=$(GOCACHE) $(GO) run ./cmd/csgclaw serve
55+
56+
onboard: boxlite-setup
57+
env GOCACHE=$(GOCACHE) $(GO) run ./cmd/csgclaw onboard \
58+
--base-url $(ONBOARD_BASE_URL) \
59+
--api-key $(ONBOARD_API_KEY) \
60+
--model-id $(ONBOARD_MODEL_ID) \
61+
--manager-image $(ONBOARD_MANAGER_IMAGE)
62+
63+
package: boxlite-setup
64+
mkdir -p $(DIST_DIR)
65+
VERSION=$(VERSION) DIST_DIR=$(DIST_DIR) APP=$(APP) GOCACHE=$(GOCACHE) $(CURDIR)/scripts/package-release.sh $$(go env GOOS) $$(go env GOARCH)
66+
67+
release: boxlite-setup
68+
mkdir -p $(DIST_DIR)
69+
VERSION=$(VERSION) DIST_DIR=$(DIST_DIR) APP=$(APP) GOCACHE=$(GOCACHE) $(CURDIR)/scripts/package-release.sh darwin arm64
70+
VERSION=$(VERSION) DIST_DIR=$(DIST_DIR) APP=$(APP) GOCACHE=$(GOCACHE) $(CURDIR)/scripts/package-release.sh linux amd64
71+
72+
clean:
73+
rm -rf $(BIN_DIR) $(DIST_DIR) $(GOCACHE)
74+
75+
tag:
76+
docker tag $(LOCAL_IMAGE) $(IMAGE):$(TAG)
77+
78+
push:
79+
docker push $(IMAGE):$(TAG)
80+
81+
publish: tag push

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,34 @@ It is not trying to make a single agent do everything. The real problem it tackl
1818

1919
---
2020

21+
## Quick Start
22+
23+
macOS/Linux:
24+
25+
```bash
26+
curl -fsSL https://raw.githubusercontent.com/OpenCSGs/csgclaw/main/scripts/install.sh | bash
27+
```
28+
29+
After install:
30+
31+
```bash
32+
csgclaw onboard --base-url <url> --api-key <key> --model-id <model>
33+
csgclaw start
34+
```
35+
36+
The installer downloads a prebuilt release binary from GitHub Releases and places it on your `PATH`. Prebuilt binaries are currently available for macOS arm64 and Linux amd64.
37+
38+
Build from source:
39+
40+
```bash
41+
export CGO_ENABLED=1
42+
go mod download
43+
(cd third_party/boxlite-go && BOXLITE_SDK_VERSION=v0.7.6 go run ./cmd/setup)
44+
go build ./cmd/csgclaw
45+
```
46+
47+
---
48+
2149
## Why CSGClaw Exists
2250

2351
A single agent can already be useful. But in real projects, the limits show up quickly.

README.zh.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,34 @@ CSGClaw 是 OpenCSG 推出的多智能体协作平台。
1818

1919
---
2020

21+
## 快速开始
22+
23+
macOS / Linux:
24+
25+
```bash
26+
curl -fsSL https://raw.githubusercontent.com/OpenCSGs/csgclaw/main/scripts/install.sh | bash
27+
```
28+
29+
安装完成后:
30+
31+
```bash
32+
csgclaw onboard --base-url <url> --api-key <key> --model-id <model>
33+
csgclaw start
34+
```
35+
36+
安装脚本会从 GitHub Releases 下载预编译二进制,并把它放到你的 `PATH` 目录中。目前只提供 macOS arm64 和 Linux amd64 的预编译版本。
37+
38+
源码编译:
39+
40+
```bash
41+
export CGO_ENABLED=1
42+
go mod download
43+
(cd third_party/boxlite-go && BOXLITE_SDK_VERSION=v0.7.6 go run ./cmd/setup)
44+
go build ./cmd/csgclaw
45+
```
46+
47+
---
48+
2149
## 为什么要做 CSGClaw
2250

2351
单个 Agent 在很多场景里已经很好用,但只要进入真实项目,问题很快就会出现。

0 commit comments

Comments
 (0)