taskode 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,398 @@
1
+ # 🚀 Taskode — 任务即代码
2
+
3
+ > 把任务变成代码,让 AI 为你开发。
4
+
5
+ ---
6
+
7
+ ## ✨ 什么是 Taskode?
8
+
9
+ **Taskode** 是一个本地优先(local-first)的 AI 开发操作系统,
10
+ 同时也是一个 **对齐 Symphony 设计理念的 Node.js 编排器实现**。
11
+
12
+ 只需一条命令:
13
+
14
+ ```bash
15
+ taskode
16
+ ```
17
+
18
+ 你就可以在当前项目中获得一个完整的 AI 开发环境:
19
+
20
+ * 🧠 内置任务 / Issue 管理系统
21
+ * 🤖 AI 自动执行任务(生成代码、修改代码、补充测试)
22
+ * 📊 实时可视化 AI 工作过程
23
+ * 🧩 支持多任务源(Local / Linear / GitHub)
24
+ * ⚙️ 可配置 Agent、并发与执行策略
25
+
26
+ ---
27
+
28
+ ## 🧠 核心理念
29
+
30
+ > 任务即代码(Task = Code)
31
+
32
+ 传统开发:
33
+
34
+ ```text
35
+ 人 → 写代码 → 提交
36
+ ```
37
+
38
+ Taskode:
39
+
40
+ ```text
41
+ 任务 → AI执行 → 生成代码 → 人审核
42
+ ```
43
+
44
+ 开发者从“写代码的人”,变成“管理 AI 工程团队的人”。
45
+
46
+ ---
47
+
48
+ ## 🧩 核心能力
49
+
50
+ ### 🗂️ 内置任务系统
51
+
52
+ * 创建 / 编辑 / 管理任务(Todo / Issue)
53
+ * 看板式流程(Todo / In Progress / Review / Done)
54
+ * 支持任务依赖与拆解
55
+ * 支持优先级与状态管理
56
+
57
+ ---
58
+
59
+ ### 🤖 AI 自动执行任务
60
+
61
+ 每个任务由 AI 在隔离环境中执行,输出:
62
+
63
+ * 代码修改(diff)
64
+ * 新增文件
65
+ * 测试代码
66
+ * 执行日志
67
+ * 任务总结
68
+
69
+ ---
70
+
71
+ ### 🧠 Agent 调度系统
72
+
73
+ * 任务队列管理
74
+ * 多 Agent 并发执行
75
+ * 自动失败重试
76
+ * 状态持久化与恢复
77
+
78
+ ---
79
+
80
+ ### 🔁 Retry Queue(持久化)
81
+
82
+ * 支持失败任务自动重试
83
+ * 状态持久化(支持重启恢复)
84
+ * 最大重试次数可配置
85
+
86
+ ---
87
+
88
+ ### 🧩 Workspace 生命周期管理
89
+
90
+ 每个任务运行在独立 workspace:
91
+
92
+ ```text
93
+ .taskode/workspaces/{task-id}
94
+ ```
95
+
96
+ 支持:
97
+
98
+ * 自动创建 / 复用
99
+ * `after_create / before_run / after_run / before_remove` hooks
100
+ * workspace 路径安全校验
101
+ * SSH worker 远程 workspace
102
+ * 终态自动清理
103
+
104
+ ---
105
+
106
+ ### 📊 可视化控制台
107
+
108
+ 启动后访问:
109
+
110
+ ```text
111
+ http://localhost:4317
112
+ ```
113
+
114
+ 可查看:
115
+
116
+ * 任务状态
117
+ * Agent 执行过程
118
+ * 日志与输出
119
+ * 代码变更(diff)
120
+ * 系统运行状态
121
+
122
+ ---
123
+
124
+ ### 🔌 多任务源支持
125
+
126
+ 支持:
127
+
128
+ * Local(默认)
129
+ * Linear(双向同步)
130
+ * GitHub Issues(扩展)
131
+
132
+ ---
133
+
134
+ ### 🔗 Linear 双向闭环
135
+
136
+ * 拉取任务
137
+ * 评论同步
138
+ * 状态迁移
139
+ * 动态工具 `linear_graphql`
140
+
141
+ ---
142
+
143
+ ### 🔍 Review / Apply 流程
144
+
145
+ * 自动生成 diff / patch
146
+ * Web 端审核运行结果
147
+ * 审批后应用 workspace 变更回主项目
148
+ * 可回写任务评论 / 状态
149
+
150
+ ---
151
+
152
+ ### 🧠 App-Server 会话模式
153
+
154
+ 支持两种执行模式:
155
+
156
+ #### 1️⃣ App-server 模式(推荐)
157
+
158
+ * 多轮对话(turn-based)
159
+ * token 使用可观测
160
+ * JSON-RPC thread / turn 会话
161
+ * 支持动态工具调用
162
+ * 更接近真实 AI 编程
163
+
164
+ #### 2️⃣ Shell 模式
165
+
166
+ * 单次命令执行
167
+ * 简单、快速
168
+
169
+ ---
170
+
171
+ ### 🔐 安全与策略控制
172
+
173
+ * API Token 鉴权
174
+ * 命令 allow / deny 策略
175
+ * 审计日志(Audit Log)
176
+ * 工作区路径逃逸防护
177
+ * 默认 `workspace-write` turn sandbox policy
178
+
179
+ ---
180
+
181
+ ### ♻️ WORKFLOW 热重载
182
+
183
+ * 运行中自动检测 `WORKFLOW.md` 变化
184
+ * 重载失败保留 last-known-good 配置
185
+ * 支持更严格的前置配置校验
186
+
187
+ ---
188
+
189
+ ### 🧪 测试门禁
190
+
191
+ 支持:
192
+
193
+ * Unit Test
194
+ * Integration Test
195
+ * E2E Test
196
+
197
+ 可作为 AI 执行的质量门禁。
198
+
199
+ ---
200
+
201
+ ## 🚀 快速开始
202
+
203
+ ### 1️⃣ 安装
204
+
205
+ ```bash
206
+ npm install -g taskode
207
+ ```
208
+
209
+ ---
210
+
211
+ ### 2️⃣ 初始化项目
212
+
213
+ ```bash
214
+ taskode init
215
+ ```
216
+
217
+ ---
218
+
219
+ ### 3️⃣ 启动系统
220
+
221
+ ```bash
222
+ npm run start
223
+ ```
224
+
225
+ 或:
226
+
227
+ ```bash
228
+ taskode
229
+ ```
230
+
231
+ ---
232
+
233
+ ### 4️⃣ 打开控制台
234
+
235
+ ```text
236
+ http://localhost:4317
237
+ ```
238
+
239
+ ---
240
+
241
+ ## ⚙️ 配置
242
+
243
+ 创建:
244
+
245
+ ```bash
246
+ taskode.config.ts
247
+ ```
248
+
249
+ 示例:
250
+
251
+ ```ts
252
+ export default {
253
+ project: {
254
+ name: "my-project",
255
+ root: ".",
256
+ },
257
+
258
+ web: {
259
+ port: 4317,
260
+ },
261
+
262
+ database: {
263
+ provider: "sqlite",
264
+ url: "./.taskode/data.db",
265
+ },
266
+
267
+ tracker: {
268
+ type: "local", // local | linear | github
269
+ },
270
+
271
+ agent: {
272
+ provider: "codex",
273
+ concurrency: 2,
274
+ },
275
+
276
+ git: {
277
+ baseBranch: "main",
278
+ workspaceDir: "./.taskode/workspaces",
279
+ },
280
+ };
281
+ ```
282
+
283
+ ---
284
+
285
+ ## 🧩 WORKFLOW.md(核心运行配置)
286
+
287
+ ```yaml
288
+ tracker:
289
+ kind: local # or linear
290
+
291
+ agent:
292
+ poll_interval_ms: 3000
293
+ max_concurrent_agents: 2
294
+ max_retry_attempts: 5
295
+ max_turns: 20
296
+
297
+ codex:
298
+ mode: shell # or app-server
299
+ command: echo "simulated codex run"
300
+ timeout_ms: 120000
301
+
302
+ policy:
303
+ allow_commands: ["*"]
304
+ deny_commands: []
305
+
306
+ auth:
307
+ token: $TASKODE_API_TOKEN
308
+
309
+ hooks:
310
+ after_create: |
311
+ echo "workspace created"
312
+
313
+ before_remove: |
314
+ echo "cleanup start"
315
+
316
+ after_remove: |
317
+ echo "cleanup done"
318
+ ```
319
+
320
+ ---
321
+
322
+ ## 📁 项目目录结构
323
+
324
+ ```text
325
+ .taskode/
326
+ ├── data.db
327
+ ├── logs/
328
+ ├── workspaces/
329
+ ├── runs/
330
+ └── config.json
331
+ ```
332
+
333
+ ---
334
+
335
+ ## 🔌 API
336
+
337
+ ### Public
338
+
339
+ * `GET /api/health`
340
+
341
+ ### Protected(需要 token)
342
+
343
+ * `GET /api/tasks`
344
+ * `POST /api/tasks`
345
+ * `PATCH /api/tasks/:id`
346
+ * `GET /api/runs`
347
+ * `GET /api/logs`
348
+ * `GET /api/audit`
349
+ * `GET /api/v1/state`
350
+ * `GET /api/v1/:issueIdentifier`
351
+ * `POST /api/v1/refresh`
352
+
353
+ ---
354
+
355
+ ## 🧪 Testing
356
+
357
+ ```bash
358
+ npm run test:unit
359
+ npm run test:integration
360
+ npm run test:e2e
361
+ npm test
362
+ ```
363
+
364
+ ---
365
+
366
+ ## 📌 Notes
367
+
368
+ * Linear 模式需要 `LINEAR_API_KEY`
369
+ * App-server 模式需要可运行的 agent 服务
370
+ * 未配置 auth token 时 API 默认开放
371
+
372
+ ---
373
+
374
+ ## 🧠 设计原则
375
+
376
+ * Local-first(本地优先)
377
+ * 可观测(AI行为透明)
378
+ * 可控(人类最终决策)
379
+ * 可扩展(任务源 / agent / workflow)
380
+
381
+ ---
382
+
383
+ ## 🤝 贡献
384
+
385
+ 欢迎 PR。
386
+
387
+ ---
388
+
389
+ ## 📄 License
390
+
391
+ MIT
392
+
393
+ ---
394
+
395
+ ## 🧠 最后一句
396
+
397
+ > 不要写代码。
398
+ > 让 AI 写代码。
package/WORKFLOW.md ADDED
@@ -0,0 +1,53 @@
1
+ ---
2
+ tracker:
3
+ kind: local
4
+ workspace:
5
+ root: ./.taskode/workspaces
6
+ agent:
7
+ poll_interval_ms: 3000
8
+ max_concurrent_agents: 2
9
+ max_retry_attempts: 5
10
+ max_retry_backoff_ms: 60000
11
+ max_concurrent_agents_by_state: {}
12
+ max_turns: 20
13
+ worker:
14
+ ssh_hosts: []
15
+ max_concurrent_agents_per_host:
16
+ codex:
17
+ mode: shell
18
+ command: echo "simulated codex run"
19
+ timeout_ms: 120000
20
+ read_timeout_ms: 5000
21
+ turn_timeout_ms: 3600000
22
+ stall_timeout_ms: 300000
23
+ approval_policy:
24
+ reject:
25
+ sandbox_approval: true
26
+ rules: true
27
+ mcp_elicitations: true
28
+ thread_sandbox: workspace-write
29
+ hooks:
30
+ after_create:
31
+ before_run:
32
+ after_run:
33
+ before_remove:
34
+ timeout_ms: 60000
35
+ policy:
36
+ allow_commands: ["*"]
37
+ deny_commands: []
38
+ auth:
39
+ token: $TASKODE_API_TOKEN
40
+ server:
41
+ port: 4317
42
+ ---
43
+
44
+ You are working on issue {{ issue.identifier }}.
45
+
46
+ Title: {{ issue.title }}
47
+ Body: {{ issue.description }}
48
+
49
+ Deliverables:
50
+ 1) Plan
51
+ 2) Implementation
52
+ 3) Tests
53
+ 4) Summary
package/bin/taskode.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from '../src/cli.js';
3
+
4
+ runCli(process.argv.slice(2)).catch((error) => {
5
+ console.error(`[taskode] fatal: ${error?.stack || error}`);
6
+ process.exit(1);
7
+ });
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "taskode",
3
+ "version": "0.4.0",
4
+ "description": "Taskode - Symphony-aligned Node orchestrator for AI issue execution",
5
+ "type": "module",
6
+ "files": [
7
+ "README.md",
8
+ "WORKFLOW.md",
9
+ "bin",
10
+ "public",
11
+ "src"
12
+ ],
13
+ "bin": {
14
+ "taskode": "bin/taskode.js"
15
+ },
16
+ "scripts": {
17
+ "start": "node ./bin/taskode.js ./WORKFLOW.md",
18
+ "test": "npm run test:unit && npm run test:integration && npm run test:e2e",
19
+ "test:unit": "node --test test/*.test.js",
20
+ "test:integration": "node test/integration/orchestrator-flow.test.js && node test/integration/recovery-and-cleanup.test.js",
21
+ "test:e2e": "node test/e2e/cli-smoke.test.js"
22
+ },
23
+ "engines": {
24
+ "node": ">=20"
25
+ },
26
+ "dependencies": {
27
+ "express": "^4.21.2",
28
+ "js-yaml": "^4.1.1"
29
+ }
30
+ }