Skip to content

Commit d53af54

Browse files
authored
Merge pull request #32 from flashcatcloud/feat/knowledge-pack-tasks
feat(knowledge): stage/delete knowledge pack task handlers
2 parents c23cd4d + ba0e447 commit d53af54

15 files changed

Lines changed: 721 additions & 155 deletions

.golangci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ linters:
4747
# Exclude G301 (directory permissions) - workspace needs readable directories
4848
# Exclude G304 (file inclusion) - paths are validated via safePath()
4949
# Exclude G306 (file permissions) - workspace files need to be readable
50-
# Exclude G706 (log injection) - we use slog structured logging which is inherently safe
5150
excludes:
5251
- G301
5352
- G304
5453
- G306
55-
- G706
5654

5755
formatters:
5856
enable:

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ sudo mv flashduty-runner /usr/local/bin/
127127
```bash
128128
docker run -d \
129129
--name flashduty-runner \
130-
-e FLASHDUTY_RUNNER_TOKEN=wnt_xxx \
130+
-e FLASHDUTY_RUNNER_TOKEN=ent_xxx \
131131
-v /var/flashduty/workspace:/workspace \
132132
registry.flashcat.cloud/public/flashduty-runner:latest
133133

134134
# With custom endpoint
135135
docker run -d \
136136
--name flashduty-runner \
137-
-e FLASHDUTY_RUNNER_TOKEN=wnt_xxx \
138-
-e FLASHDUTY_RUNNER_URL=wss://custom.example.com/safari/worknode/ws \
137+
-e FLASHDUTY_RUNNER_TOKEN=ent_xxx \
138+
-e FLASHDUTY_RUNNER_URL=wss://custom.example.com/safari/environment/ws \
139139
-v /var/flashduty/workspace:/workspace \
140140
registry.flashcat.cloud/public/flashduty-runner:latest
141141
```
@@ -144,13 +144,13 @@ docker run -d \
144144

145145
```bash
146146
# Basic usage (token required)
147-
flashduty-runner run --token wnt_xxx
147+
flashduty-runner run --token ent_xxx
148148

149149
# Specify workspace directory
150-
flashduty-runner run --token wnt_xxx --workspace ~/projects
150+
flashduty-runner run --token ent_xxx --workspace ~/projects
151151

152152
# Specify custom WebSocket endpoint
153-
flashduty-runner run --token wnt_xxx --url wss://custom.example.com/safari/worknode/ws
153+
flashduty-runner run --token ent_xxx --url wss://custom.example.com/safari/environment/ws
154154

155155
# Check version
156156
flashduty-runner version
@@ -180,8 +180,8 @@ WantedBy=multi-user.target
180180
Create `/etc/flashduty-runner/env`:
181181

182182
```bash
183-
FLASHDUTY_RUNNER_TOKEN=wnt_xxx
184-
# FLASHDUTY_RUNNER_URL=wss://custom.example.com/safari/worknode/ws
183+
FLASHDUTY_RUNNER_TOKEN=ent_xxx
184+
# FLASHDUTY_RUNNER_URL=wss://custom.example.com/safari/environment/ws
185185
# FLASHDUTY_RUNNER_WORKSPACE=/var/flashduty/workspace
186186
```
187187

@@ -199,7 +199,7 @@ Configuration is via command-line flags or environment variables (flags take pre
199199
| Flag | Env Variable | Required | Default | Description |
200200
|------|-------------|----------|---------|-------------|
201201
| `--token` | `FLASHDUTY_RUNNER_TOKEN` | Yes | - | Authentication token |
202-
| `--url` | `FLASHDUTY_RUNNER_URL` | No | `wss://api.flashcat.cloud/safari/worknode/ws` | WebSocket endpoint |
202+
| `--url` | `FLASHDUTY_RUNNER_URL` | No | `wss://api.flashcat.cloud/safari/environment/ws` | WebSocket endpoint |
203203
| `--workspace` | `FLASHDUTY_RUNNER_WORKSPACE` | No | `~/.flashduty-runner/workspace` | Workspace root directory |
204204
| `--log-level` | `FLASHDUTY_RUNNER_LOG_LEVEL` | No | `info` | Log level: debug, info, warn, error |
205205

@@ -238,7 +238,7 @@ journalctl -u flashduty-runner -f
238238
Enable debug logging to see detailed permission decisions:
239239

240240
```bash
241-
flashduty-runner run --token wnt_xxx --log-level debug
241+
flashduty-runner run --token ent_xxx --log-level debug
242242

243243
# Or via environment variable
244244
export FLASHDUTY_RUNNER_LOG_LEVEL=debug

README_zh.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ sudo mv flashduty-runner /usr/local/bin/
127127
```bash
128128
docker run -d \
129129
--name flashduty-runner \
130-
-e FLASHDUTY_RUNNER_TOKEN=wnt_xxx \
130+
-e FLASHDUTY_RUNNER_TOKEN=ent_xxx \
131131
-v /var/flashduty/workspace:/workspace \
132132
registry.flashcat.cloud/public/flashduty-runner:latest
133133

134134
# 使用自定义端点
135135
docker run -d \
136136
--name flashduty-runner \
137-
-e FLASHDUTY_RUNNER_TOKEN=wnt_xxx \
138-
-e FLASHDUTY_RUNNER_URL=wss://custom.example.com/safari/worknode/ws \
137+
-e FLASHDUTY_RUNNER_TOKEN=ent_xxx \
138+
-e FLASHDUTY_RUNNER_URL=wss://custom.example.com/safari/environment/ws \
139139
-v /var/flashduty/workspace:/workspace \
140140
registry.flashcat.cloud/public/flashduty-runner:latest
141141
```
@@ -144,13 +144,13 @@ docker run -d \
144144

145145
```bash
146146
# 基本用法(token 必填)
147-
flashduty-runner run --token wnt_xxx
147+
flashduty-runner run --token ent_xxx
148148

149149
# 指定工作区目录
150-
flashduty-runner run --token wnt_xxx --workspace ~/projects
150+
flashduty-runner run --token ent_xxx --workspace ~/projects
151151

152152
# 指定自定义 WebSocket 端点
153-
flashduty-runner run --token wnt_xxx --url wss://custom.example.com/safari/worknode/ws
153+
flashduty-runner run --token ent_xxx --url wss://custom.example.com/safari/environment/ws
154154

155155
# 查看版本
156156
flashduty-runner version
@@ -180,8 +180,8 @@ WantedBy=multi-user.target
180180
创建 `/etc/flashduty-runner/env`
181181

182182
```bash
183-
FLASHDUTY_RUNNER_TOKEN=wnt_xxx
184-
# FLASHDUTY_RUNNER_URL=wss://custom.example.com/safari/worknode/ws
183+
FLASHDUTY_RUNNER_TOKEN=ent_xxx
184+
# FLASHDUTY_RUNNER_URL=wss://custom.example.com/safari/environment/ws
185185
# FLASHDUTY_RUNNER_WORKSPACE=/var/flashduty/workspace
186186
```
187187

@@ -199,7 +199,7 @@ sudo systemctl enable --now flashduty-runner
199199
| 参数 | 环境变量 | 必填 | 默认值 | 说明 |
200200
|------|----------|------|--------|------|
201201
| `--token` | `FLASHDUTY_RUNNER_TOKEN` || - | 认证令牌 |
202-
| `--url` | `FLASHDUTY_RUNNER_URL` || `wss://api.flashcat.cloud/safari/worknode/ws` | WebSocket 端点 |
202+
| `--url` | `FLASHDUTY_RUNNER_URL` || `wss://api.flashcat.cloud/safari/environment/ws` | WebSocket 端点 |
203203
| `--workspace` | `FLASHDUTY_RUNNER_WORKSPACE` || `~/.flashduty-runner/workspace` | 工作区根目录 |
204204
| `--log-level` | `FLASHDUTY_RUNNER_LOG_LEVEL` || `info` | 日志级别:debug, info, warn, error |
205205

@@ -238,7 +238,7 @@ journalctl -u flashduty-runner -f
238238
启用调试日志以查看详细的权限决策:
239239

240240
```bash
241-
flashduty-runner run --token wnt_xxx --log-level debug
241+
flashduty-runner run --token ent_xxx --log-level debug
242242

243243
# 或通过环境变量
244244
export FLASHDUTY_RUNNER_LOG_LEVEL=debug

cmd/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313

1414
"github.com/spf13/cobra"
1515

16+
"github.com/flashcatcloud/flashduty-runner/environment"
1617
"github.com/flashcatcloud/flashduty-runner/permission"
17-
"github.com/flashcatcloud/flashduty-runner/workspace"
1818
"github.com/flashcatcloud/flashduty-runner/ws"
1919
)
2020

@@ -35,7 +35,7 @@ var (
3535

3636
// Default values
3737
const (
38-
defaultURL = "wss://api.flashcat.cloud/safari/worknode/ws"
38+
defaultURL = "wss://api.flashcat.cloud/safari/environment/ws"
3939
defaultLogLevel = "info"
4040
)
4141

@@ -67,13 +67,13 @@ func runCmd() *cobra.Command {
6767
6868
Examples:
6969
# Basic usage (token required)
70-
flashduty-runner run --token wnt_xxx
70+
flashduty-runner run --token ent_xxx
7171
7272
# Specify workspace directory
73-
flashduty-runner run --token wnt_xxx --workspace ~/projects
73+
flashduty-runner run --token ent_xxx --workspace ~/projects
7474
7575
# Specify custom API URL
76-
flashduty-runner run --token wnt_xxx --url wss://custom.example.com/safari/worknode/ws
76+
flashduty-runner run --token ent_xxx --url wss://custom.example.com/safari/environment/ws
7777
7878
Environment variables:
7979
FLASHDUTY_RUNNER_TOKEN - Authentication token (required if --token not provided)
@@ -177,7 +177,7 @@ func runRunner() error {
177177
checker := permission.NewChecker(map[string]string{"*": "allow"})
178178

179179
// Create workspace
180-
wspace, err := workspace.New(cfg.WorkspaceRoot, checker)
180+
wspace, err := environment.New(cfg.WorkspaceRoot, checker)
181181
if err != nil {
182182
return fmt.Errorf("failed to create workspace: %w", err)
183183
}

0 commit comments

Comments
 (0)