Skip to content

Commit 25a47b5

Browse files
authored
Merge branch 'main' into patch-1
2 parents a286100 + 0f506d4 commit 25a47b5

Some content is hidden

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

54 files changed

+3438
-281
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
# ── Chat Channel ──────────────────────────
1010
# TELEGRAM_BOT_TOKEN=123456:ABC...
1111
# DISCORD_BOT_TOKEN=xxx
12+
# LINE_CHANNEL_SECRET=xxx
13+
# LINE_CHANNEL_ACCESS_TOKEN=xxx
1214

1315
# ── Web Search (optional) ────────────────
1416
# BRAVE_SEARCH_API_KEY=BSA...

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,10 @@ jobs:
1616
with:
1717
go-version-file: go.mod
1818

19+
- name: fmt
20+
run: |
21+
make fmt
22+
git diff --exit-code || (echo "::error::Code is not formatted. Run 'make fmt' and commit the changes." && exit 1)
23+
1924
- name: Build
2025
run: make build-all

.github/workflows/pr.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
with:
3333
go-version-file: go.mod
3434

35+
- name: Run go generate
36+
run: go generate ./...
37+
3538
- name: Run go vet
3639
run: go vet ./...
3740

@@ -47,6 +50,9 @@ jobs:
4750
with:
4851
go-version-file: go.mod
4952

53+
- name: Run go generate
54+
run: go generate ./...
55+
5056
- name: Run go test
5157
run: go test ./...
5258

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ build/
1010
*.out
1111
/picoclaw
1212
/picoclaw-test
13+
cmd/picoclaw/workspace
1314

1415
# Picoclaw specific
1516

@@ -35,4 +36,8 @@ coverage.html
3536
# Ralph workspace
3637
ralph/
3738
.ralph/
38-
tasks/
39+
tasks/
40+
41+
# Editors
42+
.vscode/
43+
.idea/

Dockerfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,15 @@ RUN make build
1818
# ============================================================
1919
# Stage 2: Minimal runtime image
2020
# ============================================================
21-
FROM alpine:3.21
21+
FROM alpine:3.23
2222

23-
RUN apk add --no-cache ca-certificates tzdata
23+
RUN apk add --no-cache ca-certificates tzdata curl
2424

2525
# Copy binary
2626
COPY --from=builder /src/build/picoclaw /usr/local/bin/picoclaw
2727

28-
# Copy builtin skills
29-
COPY --from=builder /src/skills /opt/picoclaw/skills
30-
3128
# Create picoclaw home directory
32-
RUN mkdir -p /root/.picoclaw/workspace/skills && \
33-
cp -r /opt/picoclaw/skills/* /root/.picoclaw/workspace/skills/ 2>/dev/null || true
29+
RUN /usr/local/bin/picoclaw onboard
3430

3531
ENTRYPOINT ["picoclaw"]
3632
CMD ["gateway"]

Makefile

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,23 @@ BINARY_PATH=$(BUILD_DIR)/$(BINARY_NAME)-$(PLATFORM)-$(ARCH)
6363
# Default target
6464
all: build
6565

66+
## generate: Run generate
67+
generate:
68+
@echo "Run generate..."
69+
@rm -r ./$(CMD_DIR)/workspace 2>/dev/null || true
70+
@$(GO) generate ./...
71+
@echo "Run generate complete"
72+
6673
## build: Build the picoclaw binary for current platform
67-
build:
74+
build: generate
6875
@echo "Building $(BINARY_NAME) for $(PLATFORM)/$(ARCH)..."
6976
@mkdir -p $(BUILD_DIR)
70-
$(GO) build $(GOFLAGS) $(LDFLAGS) -o $(BINARY_PATH) ./$(CMD_DIR)
77+
@$(GO) build $(GOFLAGS) $(LDFLAGS) -o $(BINARY_PATH) ./$(CMD_DIR)
7178
@echo "Build complete: $(BINARY_PATH)"
7279
@ln -sf $(BINARY_NAME)-$(PLATFORM)-$(ARCH) $(BUILD_DIR)/$(BINARY_NAME)
7380

7481
## build-all: Build picoclaw for all platforms
75-
build-all:
82+
build-all: generate
7683
@echo "Building for multiple platforms..."
7784
@mkdir -p $(BUILD_DIR)
7885
GOOS=linux GOARCH=amd64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./$(CMD_DIR)
@@ -89,35 +96,8 @@ install: build
8996
@cp $(BUILD_DIR)/$(BINARY_NAME) $(INSTALL_BIN_DIR)/$(BINARY_NAME)
9097
@chmod +x $(INSTALL_BIN_DIR)/$(BINARY_NAME)
9198
@echo "Installed binary to $(INSTALL_BIN_DIR)/$(BINARY_NAME)"
92-
@echo "Installing builtin skills to $(WORKSPACE_SKILLS_DIR)..."
93-
@mkdir -p $(WORKSPACE_SKILLS_DIR)
94-
@for skill in $(BUILTIN_SKILLS_DIR)/*/; do \
95-
if [ -d "$$skill" ]; then \
96-
skill_name=$$(basename "$$skill"); \
97-
if [ -f "$$skill/SKILL.md" ]; then \
98-
cp -r "$$skill" $(WORKSPACE_SKILLS_DIR); \
99-
echo " ✓ Installed skill: $$skill_name"; \
100-
fi; \
101-
fi; \
102-
done
10399
@echo "Installation complete!"
104100

105-
## install-skills: Install builtin skills to workspace
106-
install-skills:
107-
@echo "Installing builtin skills to $(WORKSPACE_SKILLS_DIR)..."
108-
@mkdir -p $(WORKSPACE_SKILLS_DIR)
109-
@for skill in $(BUILTIN_SKILLS_DIR)/*/; do \
110-
if [ -d "$$skill" ]; then \
111-
skill_name=$$(basename "$$skill"); \
112-
if [ -f "$$skill/SKILL.md" ]; then \
113-
mkdir -p $(WORKSPACE_SKILLS_DIR)/$$skill_name; \
114-
cp -r "$$skill" $(WORKSPACE_SKILLS_DIR); \
115-
echo " ✓ Installed skill: $$skill_name"; \
116-
fi; \
117-
fi; \
118-
done
119-
@echo "Skills installation complete!"
120-
121101
## uninstall: Remove picoclaw from system
122102
uninstall:
123103
@echo "Uninstalling $(BINARY_NAME)..."
@@ -139,6 +119,14 @@ clean:
139119
@rm -rf $(BUILD_DIR)
140120
@echo "Clean complete"
141121

122+
## fmt: Format Go code
123+
vet:
124+
@$(GO) vet ./...
125+
126+
## fmt: Format Go code
127+
test:
128+
@$(GO) test ./...
129+
142130
## fmt: Format Go code
143131
fmt:
144132
@$(GO) fmt ./...

README.ja.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,15 @@ picoclaw agent -m "What is 2+2?"
223223

224224
## 💬 チャットアプリ
225225

226-
Telegram、Discord、QQ、DingTalk で PicoClaw と会話できます
226+
Telegram、Discord、QQ、DingTalk、LINE で PicoClaw と会話できます
227227

228228
| チャネル | セットアップ |
229229
|---------|------------|
230230
| **Telegram** | 簡単(トークンのみ) |
231231
| **Discord** | 簡単(Bot トークン + Intents) |
232232
| **QQ** | 簡単(AppID + AppSecret) |
233233
| **DingTalk** | 普通(アプリ認証情報) |
234+
| **LINE** | 普通(認証情報 + Webhook URL) |
234235

235236
<details>
236237
<summary><b>Telegram</b>(推奨)</summary>
@@ -314,7 +315,7 @@ picoclaw gateway
314315

315316
**1. Bot を作成**
316317

317-
- [QQ オープンプラットフォーム](https://connect.qq.com/) にアクセス
318+
- [QQ オープンプラットフォーム](https://q.qq.com/#) にアクセス
318319
- アプリケーションを作成 → **AppID****AppSecret** を取得
319320

320321
**2. 設定**
@@ -376,6 +377,56 @@ picoclaw gateway
376377

377378
</details>
378379

380+
<details>
381+
<summary><b>LINE</b></summary>
382+
383+
**1. LINE 公式アカウントを作成**
384+
385+
- [LINE Developers Console](https://developers.line.biz/) にアクセス
386+
- プロバイダーを作成 → Messaging API チャネルを作成
387+
- **チャネルシークレット****チャネルアクセストークン** をコピー
388+
389+
**2. 設定**
390+
391+
```json
392+
{
393+
"channels": {
394+
"line": {
395+
"enabled": true,
396+
"channel_secret": "YOUR_CHANNEL_SECRET",
397+
"channel_access_token": "YOUR_CHANNEL_ACCESS_TOKEN",
398+
"webhook_host": "0.0.0.0",
399+
"webhook_port": 18791,
400+
"webhook_path": "/webhook/line",
401+
"allow_from": []
402+
}
403+
}
404+
}
405+
```
406+
407+
**3. Webhook URL を設定**
408+
409+
LINE の Webhook には HTTPS が必要です。リバースプロキシまたはトンネルを使用してください:
410+
411+
```bash
412+
# ngrok の例
413+
ngrok http 18791
414+
```
415+
416+
LINE Developers Console で Webhook URL を `https://あなたのドメイン/webhook/line` に設定し、**Webhook の利用** を有効にしてください。
417+
418+
**4. 起動**
419+
420+
```bash
421+
picoclaw gateway
422+
```
423+
424+
> グループチャットでは @メンション時のみ応答します。返信は元メッセージを引用する形式です。
425+
426+
> **Docker Compose**: `picoclaw-gateway` サービスに `ports: ["18791:18791"]` を追加して Webhook ポートを公開してください。
427+
428+
</details>
429+
379430
## ⚙️ 設定
380431

381432
設定ファイル: `~/.picoclaw/config.json`

README.md

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,15 @@ That's it! You have a working AI assistant in 2 minutes.
239239

240240
## 💬 Chat Apps
241241

242-
Talk to your picoclaw through Telegram, Discord, or DingTalk
242+
Talk to your picoclaw through Telegram, Discord, DingTalk, or LINE
243243

244-
| Channel | Setup |
245-
| ------------ | -------------------------- |
246-
| **Telegram** | Easy (just a token) |
247-
| **Discord** | Easy (bot token + intents) |
248-
| **QQ** | Easy (AppID + AppSecret) |
249-
| **DingTalk** | Medium (app credentials) |
244+
| Channel | Setup |
245+
| ------------ | ---------------------------------- |
246+
| **Telegram** | Easy (just a token) |
247+
| **Discord** | Easy (bot token + intents) |
248+
| **QQ** | Easy (AppID + AppSecret) |
249+
| **DingTalk** | Medium (app credentials) |
250+
| **LINE** | Medium (credentials + webhook URL) |
250251

251252
<details>
252253
<summary><b>Telegram</b> (Recommended)</summary>
@@ -334,8 +335,8 @@ picoclaw gateway
334335

335336
**1. Create a bot**
336337

337-
* Go to [QQ Open Platform](https://connect.qq.com/)
338-
* Create an application → Get **AppID** and **AppSecret**
338+
- Go to [QQ Open Platform](https://q.qq.com/#)
339+
- Create an application → Get **AppID** and **AppSecret**
339340

340341
**2. Configure**
341342

@@ -396,6 +397,56 @@ picoclaw gateway
396397

397398
</details>
398399

400+
<details>
401+
<summary><b>LINE</b></summary>
402+
403+
**1. Create a LINE Official Account**
404+
405+
- Go to [LINE Developers Console](https://developers.line.biz/)
406+
- Create a provider → Create a Messaging API channel
407+
- Copy **Channel Secret** and **Channel Access Token**
408+
409+
**2. Configure**
410+
411+
```json
412+
{
413+
"channels": {
414+
"line": {
415+
"enabled": true,
416+
"channel_secret": "YOUR_CHANNEL_SECRET",
417+
"channel_access_token": "YOUR_CHANNEL_ACCESS_TOKEN",
418+
"webhook_host": "0.0.0.0",
419+
"webhook_port": 18791,
420+
"webhook_path": "/webhook/line",
421+
"allow_from": []
422+
}
423+
}
424+
}
425+
```
426+
427+
**3. Set up Webhook URL**
428+
429+
LINE requires HTTPS for webhooks. Use a reverse proxy or tunnel:
430+
431+
```bash
432+
# Example with ngrok
433+
ngrok http 18791
434+
```
435+
436+
Then set the Webhook URL in LINE Developers Console to `https://your-domain/webhook/line` and enable **Use webhook**.
437+
438+
**4. Run**
439+
440+
```bash
441+
picoclaw gateway
442+
```
443+
444+
> In group chats, the bot responds only when @mentioned. Replies quote the original message.
445+
446+
> **Docker Compose**: Add `ports: ["18791:18791"]` to the `picoclaw-gateway` service to expose the webhook port.
447+
448+
</details>
449+
399450
## <img src="assets/clawdchat-icon.png" width="24" height="24" alt="ClawdChat"> Join the Agent Social Network
400451

401452
Connect Picoclaw to the Agent Social Network simply by sending a single message via the CLI or any integrated Chat App.

README.zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ picoclaw gateway
342342

343343
**1. 创建机器人**
344344

345-
* 前往 [QQ 开放平台](https://connect.qq.com/)
345+
* 前往 [QQ 开放平台](https://q.qq.com/#)
346346
* 创建应用 → 获取 **AppID****AppSecret**
347347

348348
**2. 配置**

assets/wechat.png

2.21 KB
Loading

0 commit comments

Comments
 (0)