kenaz 0.3.17 → 0.3.19
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/core/.claude/commands/agent-worker.md +1 -1
- package/core/.claude/commands/architect.md +1 -2
- package/core/.claude/commands/spec.md +1 -1
- package/core/.claude/commands//347/224/242/345/223/201.md +1 -1
- package/core/.claude/hooks/__tests__/task-1977-dedupe-guard.test.js +8 -8
- package/core/.claude/hooks/synapse-first-investigation.js +15 -0
- package/core/.claude/skills/architect_agent/SKILL.md +11 -92
- package/core/.claude/skills/assessment_agent/SKILL.md +0 -1
- package/core/.claude/skills/backend_engineer/SKILL.md +3 -6
- package/core/.claude/skills/code_reviewer/SKILL.md +1 -1
- package/core/.claude/skills/code_reviewer/patterns.yaml +1 -1
- package/core/.claude/skills/designer/SKILL.md +3 -6
- package/core/.claude/skills/dev_agent/SKILL.md +30 -491
- package/core/.claude/skills/developer/SKILL.md +3 -6
- package/core/.claude/skills/feature_agent/SKILL.md +3 -17
- package/core/.claude/skills/product_manager/SKILL.md +29 -1064
- package/core/.claude/skills/qa_engineer/SKILL.md +12 -17
- package/core/.claude/skills/spec_optimizer/SKILL.md +25 -275
- package/core/.claude/skills/sre_agent/SKILL.md +3 -6
- package/core/.collaboration/README.md +2 -3
- package/core/.collaboration/core/task-api.js +5 -138
- package/core/.collaboration/docs/CLI.md +0 -2
- package/core/.failure/INDEX.yaml +6 -40
- package/core/.failure/agent-execution/FAIL-013-search-cwd-drift-and-case-mismatch.yaml +1 -1
- package/core/.failure/tools/README.md +9 -227
- package/core/.formation/bifrost/exec.js +29 -4
- package/core/.formation/bifrost/launch.js +1 -6
- package/core/.formation/bifrost/launch.test.js +1 -1
- package/core/.formation/bifrost/provider-launch.js +18 -11
- package/core/.formation/bifrost/provider-launch.test.js +26 -2
- package/core/.formation/bifrost/shared/ansuz-boot-policy.js +3 -3
- package/core/.formation/bifrost/shared/ansuz-boot-policy.test.js +1 -2
- package/core/.formation/tools/__tests__/dispatch-cwd-project.test.js +42 -0
- package/core/.formation/tools/__tests__/m1-hmap-convid.test.js +1 -124
- package/core/.formation/tools/__tests__/subagent-executor.test.js +3 -2
- package/core/.formation/tools/dispatch.js +15 -2
- package/core/.formation/tools/loader.js +17 -140
- package/core/.formation/tools/post-complete.js +0 -31
- package/core/.rule/INDEX.yaml +0 -18
- package/core/.rule/general/agent-workflow.yaml +14 -164
- package/core/.rule/general/project-self-containment.yaml +8 -19
- package/core/.rule/general/rust-verify-target.yaml +6 -5
- package/core/.rule/general/synapse-code-intelligence.yaml +3 -3
- package/core/.specialist/Amelia/capability.yaml +12 -12
- package/core/.specialist/Amelia/workflow.yaml +2 -2
- package/core/.specialist/Ansuz/SYSTEM_DOC.md +20 -578
- package/core/.specialist/Ansuz/cognitive_principles.yaml +2 -3
- package/core/.specialist/Ansuz/concepts/boot_rules_summary.yaml +0 -1
- package/core/.specialist/Ansuz/concepts/deep_knowledge_pointers.yaml +1 -2
- package/core/.specialist/Ansuz/core.yaml +6 -108
- package/core/.specialist/Ansuz/guards/lesson_guards.yaml +0 -3
- package/core/.specialist/Ansuz/identity_contract.yaml +0 -1
- package/core/.specialist/Ansuz/knowledge.yaml +0 -4
- package/core/.specialist/Ansuz/rule.yaml +0 -1
- package/core/.specialist/Ansuz/tools/handoff-session-identity.test.js +6 -150
- package/core/.specialist/tests/runtime-discovery/README.md +1 -1
- package/core/.specialist/tools/__tests__/task-2374-usage-counter.test.js +1 -12
- package/core/.specialist/tools/prompt-files.test.js +1 -0
- package/core/.specialist/tools/task-bridge.js +1 -66
- package/core/.system/README.md +11 -552
- package/core/.system/collaboration/README.md +10 -174
- package/core/CLAUDE.md +1 -6
- package/core/KENAZ_CORE_VERSION +1 -1
- package/core/dev/scripts/js-yaml-resolution.test.js +1 -1
- package/core/dev/scripts/run-rust-tests.js +30 -46
- package/core/dev/scripts/run-rust-tests.test.js +17 -0
- package/core/dev/scripts/rust-verify-worktree.js +4 -4
- package/core/dev/scripts/verify-target-dir.js +6 -6
- package/core/plugins/kenaz/INVENTORY.md +8 -8
- package/core/plugins/kenaz/commands/architect.md +1 -2
- package/core/plugins/kenaz/commands/spec.md +1 -1
- package/core/plugins/kenaz/commands//347/224/242/345/223/201.md +1 -1
- package/core/plugins/kenaz/guidance.md +1 -1
- package/core/plugins/kenaz/scripts/sync.js +1 -1
- package/core/plugins/kenaz/scripts/ygg.js +6 -0
- package/core/plugins/kenaz/skills/architect_agent/SKILL.md +11 -92
- package/core/plugins/kenaz/skills/assessment_agent/SKILL.md +0 -1
- package/core/plugins/kenaz/skills/backend_engineer/SKILL.md +3 -6
- package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +1 -1
- package/core/plugins/kenaz/skills/code_reviewer/patterns.yaml +1 -1
- package/core/plugins/kenaz/skills/designer/SKILL.md +3 -6
- package/core/plugins/kenaz/skills/dev_agent/SKILL.md +30 -491
- package/core/plugins/kenaz/skills/developer/SKILL.md +3 -6
- package/core/plugins/kenaz/skills/feature_agent/SKILL.md +3 -17
- package/core/plugins/kenaz/skills/product_manager/SKILL.md +29 -1064
- package/core/plugins/kenaz/skills/qa_engineer/SKILL.md +12 -17
- package/core/plugins/kenaz/skills/spec_optimizer/SKILL.md +25 -275
- package/core/plugins/kenaz/skills/sre_agent/SKILL.md +3 -6
- package/package.json +6 -6
- package/core/.claude/commands/archive.md +0 -24
- package/core/.claude/commands/init.md +0 -112
- package/core/.claude/commands/legacy_dev.md +0 -18
- package/core/.claude/commands/product-review.md +0 -131
- package/core/.claude/commands/strategy.md +0 -141
- package/core/.claude/commands/sunny.md +0 -1
- package/core/.claude/commands//347/224/242/345/223/201/346/252/242/350/246/226.md +0 -129
- package/core/.claude/commands//351/200/262/345/272/246.md +0 -15
- package/core/.claude/hooks/__tests__/substrate.test.js +0 -122
- package/core/.claude/hooks/_substrate-paths.js +0 -95
- package/core/.claude/hooks/context-check.js +0 -51
- package/core/.claude/hooks/fatigue-check.js +0 -52
- package/core/.claude/hooks/handoff-snapshot-on-commit.js +0 -154
- package/core/.claude/hooks/handoff-snapshot-on-question.js +0 -158
- package/core/.claude/hooks/handoff-staleness.js +0 -197
- package/core/.claude/hooks/jev-thalamus-context.js +0 -17
- package/core/.claude/hooks/jev-thalamus-context.test.js +0 -41
- package/core/.claude/hooks/lease-release.js +0 -119
- package/core/.claude/hooks/lease-touch.js +0 -96
- package/core/.claude/hooks/reflex-feedback.js +0 -5
- package/core/.claude/hooks/session-init.ps1 +0 -49
- package/core/.claude/hooks/sound-event.js +0 -70
- package/core/.claude/hooks/sound-event.sh +0 -37
- package/core/.claude/hooks/stream-delta.js +0 -169
- package/core/.claude/no-hooks.settings.json +0 -3
- package/core/.claude/skills/legacy_dev/SKILL.md +0 -202
- package/core/.claude/skills/sunny/SKILL.md +0 -74
- package/core/.collaboration/cli/commands/assign.js +0 -39
- package/core/.collaboration/cli/commands/claim.js +0 -33
- package/core/.collaboration/cli/commands/complete.js +0 -44
- package/core/.collaboration/cli/commands/create.js +0 -110
- package/core/.collaboration/cli/commands/get.js +0 -83
- package/core/.collaboration/cli/commands/index.js +0 -52
- package/core/.collaboration/cli/commands/list.js +0 -51
- package/core/.collaboration/cli/commands/lock.js +0 -45
- package/core/.collaboration/cli/commands/rebuild.js +0 -39
- package/core/.collaboration/cli/commands/search.js +0 -61
- package/core/.collaboration/cli/commands/stats.js +0 -61
- package/core/.collaboration/cli/commands/transfer.js +0 -41
- package/core/.collaboration/cli/commands/unlock.js +0 -48
- package/core/.collaboration/cli/formatters/help-formatter.js +0 -70
- package/core/.collaboration/cli/formatters/index.js +0 -7
- package/core/.collaboration/cli/task-cli.js +0 -46
- package/core/.collaboration/cli/utils/arg-parser.js +0 -74
- package/core/.collaboration/cli/utils/git-user.js +0 -25
- package/core/.collaboration/cli/utils/index.js +0 -9
- package/core/.collaboration/cli/utils/output.js +0 -10
- package/core/.collaboration/config/default.yaml +0 -189
- package/core/.collaboration/core/conflict-resolver.js +0 -461
- package/core/.collaboration/core/conflict-resolver.test.js +0 -389
- package/core/.collaboration/core/migrate-legacy.js +0 -260
- package/core/.collaboration/docs/API.md +0 -787
- package/core/.collaboration/docs/ARCHITECTURE.md +0 -596
- package/core/.collaboration/docs/FAQ.md +0 -695
- package/core/.collaboration/docs/MIGRATION.md +0 -804
- package/core/.collaboration/docs/examples/README.md +0 -320
- package/core/.collaboration/docs/examples/advanced-queries.js +0 -261
- package/core/.collaboration/docs/examples/basic-usage.js +0 -184
- package/core/.collaboration/docs/examples/team-workflow.js +0 -352
- package/core/.failure/agent-execution/FAIL-001-agent-no-output.yaml +0 -391
- package/core/.failure/agent-execution/FAIL-007-pm-lead-wrong-team-invocation.yaml +0 -0
- package/core/.failure/agent-execution/FAIL-010-phase0-poem-format-skipped.yaml +0 -28
- package/core/.failure/agent-execution/FAIL-010-skipping-cognitive-checkpoint-after-verification.yaml +0 -59
- package/core/.failure/agent-execution/FAIL-012-grep-shortcut-during-investigation.yaml +0 -85
- package/core/.failure/architecture/FAIL-006-python-version-compatibility.yaml +0 -445
- package/core/.failure/pipeline/FAIL-003-queue-pollution.yaml +0 -335
- package/core/.failure/pipeline/README.md +0 -95
- package/core/.failure/retired/FAIL-009-skipping-synapse-pulse-before-code-change.yaml +0 -49
- package/core/.failure/tools/USAGE_GUIDE.md +0 -323
- package/core/.failure/tools/check_failures.ps1 +0 -387
- package/core/.failure/tools/log_failure.ps1 +0 -474
- package/core/.formation/.episode-input.json +0 -10
- package/core/.formation/.merge-lock +0 -1
- package/core/.formation/lead.yaml +0 -118
- package/core/.formation/legacy.bak/designer.yaml +0 -57
- package/core/.formation/legacy.bak/pm.yaml +0 -57
- package/core/.formation/legacy.bak/qa.yaml +0 -57
- package/core/.formation/legacy.bak/review.yaml +0 -62
- package/core/.formation/legacy.bak/scheduler.yaml +0 -129
- package/core/.formation/legacy.bak/sre.yaml +0 -57
- package/core/.formation/role-map.yaml +0 -274
- package/core/.formation/roles/_shared/modules/code_review.yaml +0 -98
- package/core/.formation/roles/_shared/modules/security.yaml +0 -103
- package/core/.formation/roles/_shared/modules/testing.yaml +0 -14
- package/core/.formation/roles/backend/role.yaml +0 -93
- package/core/.formation/roles/code_reviewer/role.yaml +0 -102
- package/core/.formation/roles/database_optimizer/role.yaml +0 -107
- package/core/.formation/roles/designer/role.yaml +0 -66
- package/core/.formation/roles/developer/role.yaml +0 -75
- package/core/.formation/roles/frontend/role.yaml +0 -134
- package/core/.formation/roles/incident_response/role.yaml +0 -89
- package/core/.formation/roles/qa/role.yaml +0 -89
- package/core/.formation/roles/security/role.yaml +0 -87
- package/core/.formation/roles/sre/role.yaml +0 -66
- package/core/.formation/skills/coordinator.yaml +0 -52
- package/core/.formation/solo/diagnosis.yaml +0 -78
- package/core/.formation/solo/strategy.yaml +0 -121
- package/core/.formation/tests/hello.txt +0 -2
- package/core/.formation/tools/coordinator.js +0 -350
- package/core/.formation/tools/jev-correction.js +0 -214
- package/core/.formation/tools/jev-correction.test.js +0 -178
- package/core/.formation/tools/log-reader.js +0 -232
- package/core/.formation/tools/revert-daemon-state.js +0 -162
- package/core/.formation/tools/test-drift.js +0 -148
- package/core/.formation/unit/heimdall.yaml +0 -96
- package/core/.formation/unit/plan.yaml +0 -67
- package/core/.formation/unit/think.yaml +0 -58
- package/core/.kenaz/MUNINN_SNAPSHOT9_EPISODE.json +0 -32
- package/core/.kenaz/MUNINN_SNAPSHOT9_RUNE.json +0 -23
- package/core/.kenaz/MUNINN_SNAPSHOT9_SUMMARY.md +0 -89
- package/core/.kenaz/ash_TASK_1428-20260507.json +0 -14
- package/core/.kenaz/muninn_episode_write.ps1 +0 -17
- package/core/.kenaz/muninn_snapshot11_rune_candidates.md +0 -63
- package/core/.kenaz/muninn_snapshot1_rune_candidates.md +0 -49
- package/core/.kenaz/runes_TASK_1428.json +0 -57
- package/core/.kenaz/tmp_heimdall_proposal_8d3e392.json +0 -13
- package/core/.kenaz/tmp_props.json +0 -1
- package/core/.kenaz/tmp_sounddrop_t1_prompt.txt +0 -371
- package/core/.rule/MECHANIZED.md +0 -61
- package/core/.rule/general/cortex-memory-recall.yaml +0 -446
- package/core/.rule/general/pipeline.yaml +0 -246
- package/core/.rule/general/sunny-access-control.yaml +0 -60
- package/core/.rule/general/system-invariants.yaml +0 -231
- package/core/.rule/pipeline/PPL-002-completed-task-archival.yaml +0 -528
- package/core/.rule/pipeline/auto-update.yaml +0 -282
- package/core/.rule/pipeline/task-execution.yaml +0 -365
- package/core/.specialist/Ansuz/concepts/phase_protocol.yaml +0 -65
- package/core/.specialist/Ansuz/experiments/boot_ablation_replay.js +0 -197
- package/core/.specialist/Ansuz/tools/bootstrap-anchors.js +0 -289
- package/core/.specialist/Ansuz/workflow.yaml +0 -1225
- package/core/.specialist/experiments/rg_benchmark.js +0 -523
- package/core/.specialist/experiments/rg_benchmark_results.json +0 -27
- package/core/.specialist/tools/jev-optional-context.js +0 -107
- package/core/.specialist/tools/jev-optional-context.test.js +0 -152
- package/core/.specialist/tools/memory-action-log.js +0 -839
- package/core/.specialist/tools/phase-gate.js +0 -3534
- package/core/.specialist/tools/phase-gate.test.js +0 -85
- package/core/.specialist/tools/precompute-runner.js +0 -444
- package/core/.specialist/tools/rule-engine.js +0 -621
- package/core/.specialist/tools/task-bridge-jev.test.js +0 -170
- package/core/.synapse/memory-shared.json.sync +0 -1
- package/core/.system/agent-skills/README.md +0 -724
- package/core/.system/cli-tools/README.md +0 -724
- package/core/.system/cortex/MODULES.md +0 -1046
- package/core/.system/dashboard/FRONTEND.md +0 -812
- package/core/.system/dashboard/README.md +0 -737
- package/core/.system/failure/README.md +0 -723
- package/core/.system/formation/LEGACY_SKILLS.md +0 -974
- package/core/.system/formation/POST_COMPLETE.md +0 -602
- package/core/.system/formation/README.md +0 -1094
- package/core/.system/formation/TOOLS_REFERENCE.md +0 -1145
- package/core/.system/kenaz/README.md +0 -787
- package/core/.system/memory/README.md +0 -719
- package/core/.system/pipeline/README.md +0 -712
- package/core/.system/rule/README.md +0 -794
- package/core/.system/sunny/README.md +0 -476
- package/core/.system/sunny/RULES.json +0 -89
- package/core/.system/sunny/knowledge/INDEX.md +0 -37
- package/core/.system/sunny/knowledge/agent-teams-api.md +0 -0
- package/core/.system/sunny/knowledge/ansuz-specialist.md +0 -500
- package/core/.system/sunny/knowledge/claude-cli-spawn.md +0 -177
- package/core/.system/sunny/knowledge/collaboration-api.md +0 -925
- package/core/.system/sunny/teammates/README.md +0 -107
- package/core/.system/sunny/teammates/how_to_use.yaml +0 -101
- package/core/.system/sunny/teammates/tools/headless/launcher.js +0 -318
- package/core/.system/sunny/teammates/tools/powershell/launcher.js +0 -241
- package/core/.system/sunny/teammates/tools/powershell/start.bat +0 -50
- package/core/.system/sunny/teammates/tools/utils/env.js +0 -96
- package/core/.system/sunny/teammates/tools/utils/format-output.js +0 -329
- package/core/.system/sunny/tools.json +0 -101
- package/core/dev/scripts/cleanup-queue.js +0 -184
- package/core/dev/scripts/cleanup_queue.js +0 -86
- package/core/dev/scripts/legacy/README.md +0 -39
- package/core/dev/scripts/legacy/dev_agent_scheduler.ps1.bak +0 -536
- package/core/dev/scripts/legacy/multi_agent_scheduler.ps1.bak +0 -1978
- package/core/dev/scripts/matrix/CLI_README.md +0 -214
- package/core/dev/scripts/matrix/README.md +0 -310
- package/core/dev/scripts/matrix/package-lock.json +0 -4266
- package/core/dev/scripts/matrix/package.json +0 -55
- package/core/dev/scripts/matrix/src/abbreviations.ts +0 -295
- package/core/dev/scripts/matrix/src/cli/commands/convert.ts +0 -211
- package/core/dev/scripts/matrix/src/cli/commands/create.ts +0 -95
- package/core/dev/scripts/matrix/src/cli/commands/delete.ts +0 -102
- package/core/dev/scripts/matrix/src/cli/commands/list-tags.ts.wip +0 -140
- package/core/dev/scripts/matrix/src/cli/commands/manage-tags.ts.wip +0 -173
- package/core/dev/scripts/matrix/src/cli/commands/query.ts +0 -261
- package/core/dev/scripts/matrix/src/cli/commands/read.ts +0 -77
- package/core/dev/scripts/matrix/src/cli/commands/stats.ts.wip +0 -168
- package/core/dev/scripts/matrix/src/cli/commands/tokens.ts.wip +0 -126
- package/core/dev/scripts/matrix/src/cli/commands/update.ts +0 -147
- package/core/dev/scripts/matrix/src/cli/commands/validate.ts +0 -275
- package/core/dev/scripts/matrix/src/cli/index.ts +0 -350
- package/core/dev/scripts/matrix/src/cli/utils/file-handler.ts +0 -72
- package/core/dev/scripts/matrix/src/cli/utils/logger.ts +0 -65
- package/core/dev/scripts/matrix/src/index.ts +0 -62
- package/core/dev/scripts/matrix/src/indexer/tag-indexer.ts +0 -165
- package/core/dev/scripts/matrix/src/parser.ts +0 -281
- package/core/dev/scripts/matrix/src/serializer.ts +0 -151
- package/core/dev/scripts/matrix/src/validator.ts +0 -301
- package/core/dev/scripts/matrix/tests/abbreviations.test.ts +0 -122
- package/core/dev/scripts/matrix/tests/cli.test.ts +0 -177
- package/core/dev/scripts/matrix/tests/convert.test.ts +0 -143
- package/core/dev/scripts/matrix/tests/parser.test.ts +0 -203
- package/core/dev/scripts/matrix/tests/query.test.ts +0 -85
- package/core/dev/scripts/matrix/tests/serializer.test.ts +0 -197
- package/core/dev/scripts/matrix/tests/validate.test.ts +0 -141
- package/core/dev/scripts/matrix/tests/validator.test.ts +0 -167
- package/core/dev/scripts/matrix/tsconfig.json +0 -20
- package/core/dev/scripts/matrix/types/index.d.ts +0 -111
- package/core/dev/scripts/matrix/types/index.d.ts.map +0 -1
- package/core/dev/scripts/matrix/types/index.js +0 -8
- package/core/dev/scripts/matrix/types/index.js.map +0 -1
- package/core/dev/scripts/matrix/types/index.ts +0 -124
- package/core/dev/scripts/memory-usage-report.js +0 -152
- package/core/dev/scripts/probe/ansuz-scaffold-ablation.js +0 -579
- package/core/dev/scripts/probe/ansuz-scaffold-ablation.test.js +0 -244
- package/core/dev/scripts/probe/hook-latency-probe.js +0 -315
- package/core/dev/scripts/probe/hook-latency-probe.test.js +0 -105
- package/core/dev/scripts/probe/prediction-signal-auc.js +0 -483
- package/core/dev/scripts/probe/prediction-signal-auc.test.js +0 -200
- package/core/dev/scripts/test-pty-ws-tunnel.js +0 -229
- package/core/dev/scripts/validate_pipeline.js +0 -197
- package/core/dev/spikes/task2145-evidence-20261004/backend-log-excerpt.txt +0 -56
- package/core/dev/spikes/task2145-evidence-20261004/graph.shadow +0 -0
- package/core/dev/spikes/task2145-evidence-20261004/graph.wal +0 -0
- package/core/dev/spikes/task2145-evidence-20261004/graph_corrupt_suspect.marker +0 -1
- package/core/plugins/kenaz/commands/strategy.md +0 -141
|
@@ -1,925 +0,0 @@
|
|
|
1
|
-
# Collaboration 任務系統 API 完整指南
|
|
2
|
-
|
|
3
|
-
> **版本**: 3.3.0
|
|
4
|
-
> **最後更新**: 2026-02-20
|
|
5
|
-
> **維護**: Kenaz Team
|
|
6
|
-
|
|
7
|
-
## 概述
|
|
8
|
-
|
|
9
|
-
`.collaboration/core/` 提供了一套完整的任務管理 API,包含 3 個核心模組:
|
|
10
|
-
|
|
11
|
-
| 模組 | 檔案 | 用途 |
|
|
12
|
-
|------|------|------|
|
|
13
|
-
| 主 API | `task-api.js` | 核心任務 CRUD 操作、狀態管理、CLI 介面 |
|
|
14
|
-
| JSON 輸出 | `task-api-json.js` | 向後相容的 JSON 格式輸出(供 Dashboard 使用) |
|
|
15
|
-
| 遷移工具 | `migrate-legacy.js` | 從舊系統(dev/pipeline/)遷移任務到新系統 |
|
|
16
|
-
|
|
17
|
-
## 1. task-api.js — 核心任務 API
|
|
18
|
-
|
|
19
|
-
### 1.1 基本資訊
|
|
20
|
-
|
|
21
|
-
- **API 版本**: 3.3.0
|
|
22
|
-
- **Node 模組**: ✅ 可用 `require()` 導入
|
|
23
|
-
- **CLI 介面**: ✅ 可直接執行
|
|
24
|
-
|
|
25
|
-
### 1.2 CLI 命令列表
|
|
26
|
-
|
|
27
|
-
#### 列出任務 (list)
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
# 基本列表
|
|
31
|
-
node .collaboration/core/task-api.js list
|
|
32
|
-
|
|
33
|
-
# 按狀態篩選
|
|
34
|
-
node .collaboration/core/task-api.js list --status pending
|
|
35
|
-
node .collaboration/core/task-api.js list --status in_progress
|
|
36
|
-
node .collaboration/core/task-api.js list --status completed
|
|
37
|
-
|
|
38
|
-
# 按優先級篩選
|
|
39
|
-
node .collaboration/core/task-api.js list --priority P0
|
|
40
|
-
node .collaboration/core/task-api.js list --priority P1
|
|
41
|
-
|
|
42
|
-
# 按角色篩選
|
|
43
|
-
node .collaboration/core/task-api.js list --role developer
|
|
44
|
-
node .collaboration/core/task-api.js list --role designer
|
|
45
|
-
|
|
46
|
-
# 按嚴謹度篩選(v3.3 新增)
|
|
47
|
-
node .collaboration/core/task-api.js list --rigor high # 需要 team 執行
|
|
48
|
-
node .collaboration/core/task-api.js list --rigor medium # 可選 team 或單一 Agent
|
|
49
|
-
node .collaboration/core/task-api.js list --rigor low # 單一 Agent 即可
|
|
50
|
-
|
|
51
|
-
# 按標籤篩選(v3.2 新增)
|
|
52
|
-
node .collaboration/core/task-api.js list --tags doc
|
|
53
|
-
node .collaboration/core/task-api.js list --tags code,fix # 多標籤逗號分隔
|
|
54
|
-
|
|
55
|
-
# 組合篩選
|
|
56
|
-
node .collaboration/core/task-api.js list --status pending --priority P1 --role developer
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**輸出格式**:
|
|
60
|
-
```
|
|
61
|
-
總任務數: 10
|
|
62
|
-
Pending: 3 | In Progress: 2 | Completed: 5
|
|
63
|
-
|
|
64
|
-
任務列表 (3 個):
|
|
65
|
-
[TASK_224] 系統文檔:.collaboration 任務系統基礎概念 (pending, P1, developer, rigor:medium, docs)
|
|
66
|
-
[TASK_225] 前端組件:Agent 任務卡片組件 (pending, P1, developer, rigor:medium, code)
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
#### 取得任務 (get)
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
# 取得單個任務的完整資訊(JSON 格式)
|
|
73
|
-
node .collaboration/core/task-api.js get TASK_224
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**輸出**:完整的 JSON 物件,包含所有欄位。
|
|
77
|
-
|
|
78
|
-
#### 建立任務 (create)
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
# 最小參數(只有標題)
|
|
82
|
-
node .collaboration/core/task-api.js create --title "實作登入功能"
|
|
83
|
-
|
|
84
|
-
# 完整參數
|
|
85
|
-
node .collaboration/core/task-api.js create \
|
|
86
|
-
--title "實作登入功能" \
|
|
87
|
-
--description "建立用戶登入頁面和 API" \
|
|
88
|
-
--priority P1 \
|
|
89
|
-
--role frontend \
|
|
90
|
-
--rigor high \
|
|
91
|
-
--complexity medium \
|
|
92
|
-
--tags code,doc \
|
|
93
|
-
--dependencies TASK_170,TASK_171 \
|
|
94
|
-
--scope-paths "dashboard/src/pages/Login.tsx,backend/api/auth.py" \
|
|
95
|
-
--estimated-hours 8 \
|
|
96
|
-
--branch feature/login \
|
|
97
|
-
--notes "使用 JWT 驗證" \
|
|
98
|
-
--feature-ids F-001,F-002 \
|
|
99
|
-
--keywords login,auth
|
|
100
|
-
|
|
101
|
-
# 多值欄位(支援多次使用同一 flag)
|
|
102
|
-
node .collaboration/core/task-api.js create \
|
|
103
|
-
--title "系統文檔" \
|
|
104
|
-
--requirements "建立 API 文檔" \
|
|
105
|
-
--requirements "更新 README" \
|
|
106
|
-
--acceptance-criteria "文檔包含所有 API" \
|
|
107
|
-
--acceptance-criteria "範例程式碼可執行" \
|
|
108
|
-
--technical-notes "使用 Markdown 格式" \
|
|
109
|
-
--technical-notes "包含範例程式碼"
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
**參數清單**:
|
|
113
|
-
|
|
114
|
-
| 參數 | 必填 | 預設值 | 說明 |
|
|
115
|
-
|------|------|--------|------|
|
|
116
|
-
| `--title` | ✅ | - | 任務標題 |
|
|
117
|
-
| `--description` | ❌ | "" | 任務描述 |
|
|
118
|
-
| `--priority` | ❌ | P2 | 優先級 (P0/P1/P2/P3) |
|
|
119
|
-
| `--role` | ❌ | developer | 角色 (designer/developer/frontend/pm/sre/team_developer/team_strategy) |
|
|
120
|
-
| `--rigor` | ❌ | medium | 嚴謹度 (high/medium/low) |
|
|
121
|
-
| `--complexity` | ❌ | medium | 複雜度 (simple/medium/complex) |
|
|
122
|
-
| `--tags` | ❌ | [] | 標籤(逗號分隔)|
|
|
123
|
-
| `--dependencies` | ❌ | [] | 依賴任務 ID(逗號分隔)|
|
|
124
|
-
| `--scope-paths` | ❌ | [] | 修改範圍路徑(逗號分隔)|
|
|
125
|
-
| `--estimated-hours` | ❌ | null | 預估工時(小時)|
|
|
126
|
-
| `--branch` | ❌ | null | Git 分支名稱 |
|
|
127
|
-
| `--notes` | ❌ | "" | 備註 |
|
|
128
|
-
| `--feature-ids` | ❌ | [] | Feature ID(逗號分隔)|
|
|
129
|
-
| `--keywords` | ❌ | [] | 關鍵字(逗號分隔)|
|
|
130
|
-
| `--requirements` | ❌ | [] | 需求(可多次使用)|
|
|
131
|
-
| `--acceptance-criteria` | ❌ | [] | 驗收標準(可多次使用)|
|
|
132
|
-
| `--technical-notes` | ❌ | [] | 技術筆記(可多次使用)|
|
|
133
|
-
|
|
134
|
-
**輸出**:
|
|
135
|
-
```
|
|
136
|
-
✅ 任務已建立: TASK_248
|
|
137
|
-
Hash: 9a8b7c6d-1234-5678-90ab-cdef12345678
|
|
138
|
-
標題: 實作登入功能
|
|
139
|
-
優先級: P1
|
|
140
|
-
角色: frontend
|
|
141
|
-
嚴謹度: high
|
|
142
|
-
複雜度: medium
|
|
143
|
-
標籤: code, doc
|
|
144
|
-
依賴: TASK_170, TASK_171
|
|
145
|
-
範圍: dashboard/src/pages/Login.tsx, backend/api/auth.py
|
|
146
|
-
預估工時: 8h
|
|
147
|
-
分支: feature/login
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
#### 認領任務 (claim)
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
# 將任務從 backlog/ 移至 active/
|
|
154
|
-
node .collaboration/core/task-api.js claim TASK_224
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
**效果**:
|
|
158
|
-
- 更新 `assigned_to` 欄位(當前 Git 用戶)
|
|
159
|
-
- 更新 `metadata.claimed_at` 和 `metadata.claimed_by`
|
|
160
|
-
- 檔案從 `.collaboration/tasks/backlog/` 移至 `.collaboration/tasks/active/`
|
|
161
|
-
|
|
162
|
-
#### 完成任務 (complete)
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
# 基本完成(不記錄工時)
|
|
166
|
-
node .collaboration/core/task-api.js complete TASK_224
|
|
167
|
-
|
|
168
|
-
# 記錄實際工時
|
|
169
|
-
node .collaboration/core/task-api.js complete TASK_224 --actual-hours 6.5
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
**效果**:
|
|
173
|
-
- 更新 `executed_by` 欄位(當前 Git 用戶)
|
|
174
|
-
- 設置 `actual_hours`(如果提供)
|
|
175
|
-
- 檔案從 `.collaboration/tasks/active/` 移至 `.collaboration/tasks/done/`
|
|
176
|
-
|
|
177
|
-
#### 移動任務 (move)
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
# 基本移動(遵守狀態機規則)
|
|
181
|
-
node .collaboration/core/task-api.js move TASK_224 blocked
|
|
182
|
-
node .collaboration/core/task-api.js move TASK_224 cancel
|
|
183
|
-
|
|
184
|
-
# 強制移動(跳過狀態機驗證)
|
|
185
|
-
node .collaboration/core/task-api.js move TASK_224 done --force
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
**狀態機規則**:
|
|
189
|
-
|
|
190
|
-
| 來源狀態 | 允許的目標狀態 |
|
|
191
|
-
|---------|---------------|
|
|
192
|
-
| `backlog` | active, cancel, blocked |
|
|
193
|
-
| `active` | done, blocked, cancel, backlog |
|
|
194
|
-
| `blocked` | active, backlog, cancel |
|
|
195
|
-
| `done` | backlog(重新開啟), archived |
|
|
196
|
-
| `cancel` | backlog(重新開啟)|
|
|
197
|
-
|
|
198
|
-
#### 搜尋任務 (search)
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# 全文搜尋(搜尋 title, description, id, tags)
|
|
202
|
-
node .collaboration/core/task-api.js search "登入"
|
|
203
|
-
node .collaboration/core/task-api.js search "API"
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
**輸出**:
|
|
207
|
-
```
|
|
208
|
-
找到 2 個符合 "登入" 的任務:
|
|
209
|
-
|
|
210
|
-
[TASK_248] 實作登入功能 (pending, P1)
|
|
211
|
-
[TASK_249] 登入頁面 UI 設計 (pending, P2)
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
#### 統計資訊 (stats)
|
|
215
|
-
|
|
216
|
-
```bash
|
|
217
|
-
node .collaboration/core/task-api.js stats
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
**輸出**:
|
|
221
|
-
```
|
|
222
|
-
任務統計:
|
|
223
|
-
|
|
224
|
-
按狀態:
|
|
225
|
-
pending: 3
|
|
226
|
-
in_progress: 2
|
|
227
|
-
completed: 5
|
|
228
|
-
|
|
229
|
-
按優先級:
|
|
230
|
-
P0: 1
|
|
231
|
-
P1: 4
|
|
232
|
-
P2: 3
|
|
233
|
-
P3: 2
|
|
234
|
-
|
|
235
|
-
按角色:
|
|
236
|
-
developer: 6
|
|
237
|
-
designer: 2
|
|
238
|
-
frontend: 2
|
|
239
|
-
|
|
240
|
-
按標籤:
|
|
241
|
-
doc: 4
|
|
242
|
-
code: 5
|
|
243
|
-
fix: 1
|
|
244
|
-
|
|
245
|
-
總計: 10 個任務
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
#### 封存任務 (archive)
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
# 預覽(不實際執行)
|
|
252
|
-
node .collaboration/core/task-api.js archive --keep 10 --dry-run
|
|
253
|
-
|
|
254
|
-
# 執行封存(保留最新 10 個 done 任務)
|
|
255
|
-
node .collaboration/core/task-api.js archive --keep 10
|
|
256
|
-
|
|
257
|
-
# 保留最新 20 個
|
|
258
|
-
node .collaboration/core/task-api.js archive --keep 20
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
**效果**:
|
|
262
|
-
- 將 `done/` 中最舊的任務移至 `archived/`
|
|
263
|
-
- 保留最新 N 個任務在 `done/`
|
|
264
|
-
|
|
265
|
-
### 1.3 JavaScript API
|
|
266
|
-
|
|
267
|
-
#### 導入模組
|
|
268
|
-
|
|
269
|
-
```javascript
|
|
270
|
-
const { TaskAPI, CONFIG, parseYAML, toYAML } = require('./.collaboration/core/task-api.js');
|
|
271
|
-
|
|
272
|
-
const api = new TaskAPI();
|
|
273
|
-
// 或自訂任務目錄
|
|
274
|
-
const customApi = new TaskAPI({ tasksDir: '/path/to/tasks' });
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
#### 核心方法
|
|
278
|
-
|
|
279
|
-
##### getAllTasks()
|
|
280
|
-
|
|
281
|
-
```javascript
|
|
282
|
-
const result = await api.getAllTasks();
|
|
283
|
-
|
|
284
|
-
// 返回格式
|
|
285
|
-
{
|
|
286
|
-
version: "3.3.0",
|
|
287
|
-
tasks: [
|
|
288
|
-
{
|
|
289
|
-
id: "TASK_224",
|
|
290
|
-
hash: "ee9ddf4b-9746-4899-970a-da7c4d510681",
|
|
291
|
-
title: "系統文檔:.collaboration 任務系統基礎概念",
|
|
292
|
-
description: "...",
|
|
293
|
-
priority: "P1",
|
|
294
|
-
status: "pending",
|
|
295
|
-
role: "developer",
|
|
296
|
-
tags: ["docs", "collaboration"],
|
|
297
|
-
complexity: "medium",
|
|
298
|
-
rigor: "medium",
|
|
299
|
-
estimated_hours: null,
|
|
300
|
-
actual_hours: null,
|
|
301
|
-
branch: null,
|
|
302
|
-
dependencies: [],
|
|
303
|
-
scope_paths: [],
|
|
304
|
-
requirements: [],
|
|
305
|
-
acceptance_criteria: [],
|
|
306
|
-
technical_notes: [],
|
|
307
|
-
created_by: { name: "...", git_user: "...", timestamp: "..." },
|
|
308
|
-
executed_by: null,
|
|
309
|
-
feature_ids: [],
|
|
310
|
-
keywords: [],
|
|
311
|
-
_status_dir: "backlog", // 內部欄位:實際目錄
|
|
312
|
-
_file_path: "D:\\repo\\...\\backlog\\TASK_224_{git_user}.yaml" // 內部欄位:檔案路徑
|
|
313
|
-
}
|
|
314
|
-
],
|
|
315
|
-
statistics: {
|
|
316
|
-
total: 10,
|
|
317
|
-
pending: 3,
|
|
318
|
-
in_progress: 2,
|
|
319
|
-
completed: 5,
|
|
320
|
-
blocked: 0,
|
|
321
|
-
cancelled: 0
|
|
322
|
-
},
|
|
323
|
-
metadata: {
|
|
324
|
-
last_updated: "2026-02-20T12:00:00.000Z",
|
|
325
|
-
directories: ["backlog", "active", "done"]
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
##### getTask(taskId)
|
|
331
|
-
|
|
332
|
-
```javascript
|
|
333
|
-
const task = await api.getTask('TASK_224');
|
|
334
|
-
|
|
335
|
-
if (task) {
|
|
336
|
-
console.log(task.title);
|
|
337
|
-
console.log(task.status);
|
|
338
|
-
console.log(task._file_path); // 內部欄位
|
|
339
|
-
} else {
|
|
340
|
-
console.log('任務不存在');
|
|
341
|
-
}
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
##### createTask(taskData)
|
|
345
|
-
|
|
346
|
-
```javascript
|
|
347
|
-
const task = await api.createTask({
|
|
348
|
-
title: "實作登入功能",
|
|
349
|
-
description: "建立用戶登入頁面和 API",
|
|
350
|
-
priority: "P1",
|
|
351
|
-
role: "frontend",
|
|
352
|
-
rigor: "high",
|
|
353
|
-
complexity: "medium",
|
|
354
|
-
tags: ["code", "doc"],
|
|
355
|
-
dependencies: ["TASK_170", "TASK_171"],
|
|
356
|
-
scope_paths: ["dashboard/src/pages/Login.tsx", "backend/api/auth.py"],
|
|
357
|
-
requirements: ["建立登入表單", "實作 JWT 驗證"],
|
|
358
|
-
acceptance_criteria: ["登入表單正常顯示", "JWT 驗證正常運作"],
|
|
359
|
-
estimated_hours: 8,
|
|
360
|
-
branch: "feature/login",
|
|
361
|
-
notes: "使用 JWT 驗證",
|
|
362
|
-
feature_ids: ["F-001", "F-002"],
|
|
363
|
-
keywords: ["login", "auth"]
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
console.log(`任務已建立: ${task.id}`);
|
|
367
|
-
console.log(`Hash: ${task.hash}`);
|
|
368
|
-
console.log(`檔案位置: ${task._file_path}`);
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
**自動處理**:
|
|
372
|
-
- 自動生成遞增的 `id`(如 TASK_248)
|
|
373
|
-
- 自動生成唯一的 `hash`(UUID v4)
|
|
374
|
-
- 自動記錄 `created_by`(當前 Git 用戶)
|
|
375
|
-
- 自動設置 `status: "pending"`
|
|
376
|
-
- 檔案自動儲存到 `.collaboration/tasks/backlog/TASK_XXX_<git_user>.yaml`
|
|
377
|
-
|
|
378
|
-
##### updateTask(taskId, updates)
|
|
379
|
-
|
|
380
|
-
```javascript
|
|
381
|
-
const task = await api.updateTask('TASK_224', {
|
|
382
|
-
title: "新標題",
|
|
383
|
-
priority: "P0",
|
|
384
|
-
tags: ["urgent", "code"],
|
|
385
|
-
estimated_hours: 10
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
console.log(`任務已更新: ${task.id}`);
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
**注意**:
|
|
392
|
-
- 如果 `updates.status` 與原狀態不同,會自動呼叫 `moveTask()`
|
|
393
|
-
- 自動更新 `metadata.updated_at` 和 `metadata.updated_by`
|
|
394
|
-
|
|
395
|
-
##### moveTask(taskId, newStatus, taskData?, options?)
|
|
396
|
-
|
|
397
|
-
```javascript
|
|
398
|
-
// 基本移動
|
|
399
|
-
const task = await api.moveTask('TASK_224', 'active');
|
|
400
|
-
|
|
401
|
-
// 移動並更新資料
|
|
402
|
-
const task = await api.moveTask('TASK_224', 'active', {
|
|
403
|
-
...existingTask,
|
|
404
|
-
estimated_hours: 10
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
// 強制移動(跳過狀態機驗證)
|
|
408
|
-
const task = await api.moveTask('TASK_224', 'done', null, { skipValidation: true });
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
**效果**:
|
|
412
|
-
- 檔案從來源目錄移至目標目錄
|
|
413
|
-
- 更新 `status` 欄位
|
|
414
|
-
- 原子性操作(先寫入新位置,確認成功後刪除舊檔案)
|
|
415
|
-
|
|
416
|
-
##### deleteTask(taskId)
|
|
417
|
-
|
|
418
|
-
```javascript
|
|
419
|
-
const success = await api.deleteTask('TASK_224');
|
|
420
|
-
|
|
421
|
-
if (success) {
|
|
422
|
-
console.log('任務已刪除');
|
|
423
|
-
} else {
|
|
424
|
-
console.log('任務不存在');
|
|
425
|
-
}
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
##### claimTask(taskId, assignee?)
|
|
429
|
-
|
|
430
|
-
```javascript
|
|
431
|
-
// 認領給當前用戶
|
|
432
|
-
const task = await api.claimTask('TASK_224');
|
|
433
|
-
|
|
434
|
-
// 認領給指定用戶
|
|
435
|
-
const task = await api.claimTask('TASK_224', 'johndoe');
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
**效果**:
|
|
439
|
-
- 移至 `active/` 目錄
|
|
440
|
-
- 更新 `assigned_to` 欄位
|
|
441
|
-
- 更新 `metadata.claimed_at` 和 `metadata.claimed_by`
|
|
442
|
-
|
|
443
|
-
##### completeTask(taskId, options?)
|
|
444
|
-
|
|
445
|
-
```javascript
|
|
446
|
-
// 基本完成
|
|
447
|
-
const task = await api.completeTask('TASK_224');
|
|
448
|
-
|
|
449
|
-
// 記錄工時
|
|
450
|
-
const task = await api.completeTask('TASK_224', { actual_hours: 6.5 });
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
**效果**:
|
|
454
|
-
- 移至 `done/` 目錄
|
|
455
|
-
- 更新 `executed_by` 欄位
|
|
456
|
-
- 設置 `actual_hours`(如果提供)
|
|
457
|
-
|
|
458
|
-
##### queryTasks(query)
|
|
459
|
-
|
|
460
|
-
```javascript
|
|
461
|
-
// 按狀態篩選
|
|
462
|
-
const tasks = await api.queryTasks({ status: 'pending' });
|
|
463
|
-
|
|
464
|
-
// 按優先級篩選
|
|
465
|
-
const tasks = await api.queryTasks({ priority: 'P1' });
|
|
466
|
-
|
|
467
|
-
// 按角色篩選
|
|
468
|
-
const tasks = await api.queryTasks({ role: 'developer' });
|
|
469
|
-
|
|
470
|
-
// 按嚴謹度篩選
|
|
471
|
-
const tasks = await api.queryTasks({ rigor: 'high' });
|
|
472
|
-
|
|
473
|
-
// 按標籤篩選(任一匹配)
|
|
474
|
-
const tasks = await api.queryTasks({ tags: ['doc', 'code'] });
|
|
475
|
-
|
|
476
|
-
// 全文搜尋
|
|
477
|
-
const tasks = await api.queryTasks({ search: '登入' });
|
|
478
|
-
|
|
479
|
-
// 組合查詢
|
|
480
|
-
const tasks = await api.queryTasks({
|
|
481
|
-
status: 'pending',
|
|
482
|
-
priority: 'P1',
|
|
483
|
-
role: 'developer',
|
|
484
|
-
rigor: 'high',
|
|
485
|
-
tags: ['code'],
|
|
486
|
-
search: 'API'
|
|
487
|
-
});
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
##### getStatistics()
|
|
491
|
-
|
|
492
|
-
```javascript
|
|
493
|
-
const stats = await api.getStatistics();
|
|
494
|
-
|
|
495
|
-
console.log(`總任務數: ${stats.total}`);
|
|
496
|
-
console.log(`按狀態:`, stats.byStatus);
|
|
497
|
-
console.log(`按優先級:`, stats.byPriority);
|
|
498
|
-
console.log(`按角色:`, stats.byRole);
|
|
499
|
-
console.log(`按標籤:`, stats.byTags);
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
#### 輔助方法
|
|
503
|
-
|
|
504
|
-
##### generateTaskID()
|
|
505
|
-
|
|
506
|
-
```javascript
|
|
507
|
-
const newId = await api.generateTaskID();
|
|
508
|
-
console.log(newId); // TASK_248
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
##### validateTaskID(id)
|
|
512
|
-
|
|
513
|
-
```javascript
|
|
514
|
-
const isValid = api.validateTaskID('TASK_248'); // true
|
|
515
|
-
const isValid2 = api.validateTaskID('INVALID'); // false
|
|
516
|
-
```
|
|
517
|
-
|
|
518
|
-
##### validateTransition(fromStatus, toStatus)
|
|
519
|
-
|
|
520
|
-
```javascript
|
|
521
|
-
const result = api.validateTransition('backlog', 'active');
|
|
522
|
-
if (result.valid) {
|
|
523
|
-
console.log('允許的狀態轉換');
|
|
524
|
-
} else {
|
|
525
|
-
console.log(`不允許的轉換: ${result.reason}`);
|
|
526
|
-
}
|
|
527
|
-
```
|
|
528
|
-
|
|
529
|
-
### 1.4 配置常數 (CONFIG)
|
|
530
|
-
|
|
531
|
-
```javascript
|
|
532
|
-
const { CONFIG } = require('./.collaboration/core/task-api.js');
|
|
533
|
-
|
|
534
|
-
console.log(CONFIG.API_VERSION); // "3.3.0"
|
|
535
|
-
console.log(CONFIG.TASKS_DIR); // 預設任務目錄
|
|
536
|
-
console.log(CONFIG.VALID_ROLES); // ['designer', 'developer', ...]
|
|
537
|
-
console.log(CONFIG.COMMON_TAGS); // ['doc', 'code', 'plan', ...]
|
|
538
|
-
console.log(CONFIG.VALID_RIGOR); // ['high', 'medium', 'low']
|
|
539
|
-
console.log(CONFIG.STATUS_DIRS); // ['backlog', 'active', 'done']
|
|
540
|
-
console.log(CONFIG.STATUS_MAP); // 舊狀態 → 新狀態映射
|
|
541
|
-
console.log(CONFIG.REVERSE_STATUS_MAP); // 新狀態 → 舊狀態映射
|
|
542
|
-
console.log(CONFIG.ALLOWED_TRANSITIONS); // 狀態機規則
|
|
543
|
-
```
|
|
544
|
-
|
|
545
|
-
### 1.5 YAML 工具函數
|
|
546
|
-
|
|
547
|
-
```javascript
|
|
548
|
-
const { parseYAML, toYAML } = require('./.collaboration/core/task-api.js');
|
|
549
|
-
|
|
550
|
-
// 解析 YAML 字串
|
|
551
|
-
const obj = parseYAML('id: TASK_224\ntitle: Test');
|
|
552
|
-
|
|
553
|
-
// 物件轉 YAML
|
|
554
|
-
const yamlStr = toYAML({ id: 'TASK_224', title: 'Test' });
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
---
|
|
558
|
-
|
|
559
|
-
## 2. task-api-json.js — JSON 輸出 Wrapper
|
|
560
|
-
|
|
561
|
-
### 2.1 基本資訊
|
|
562
|
-
|
|
563
|
-
- **用途**: 向後相容的 JSON 格式輸出(供 Tauri Dashboard 使用)
|
|
564
|
-
- **輸出**: 純 JSON(stdout),錯誤輸出到 stderr
|
|
565
|
-
|
|
566
|
-
### 2.2 CLI 用法
|
|
567
|
-
|
|
568
|
-
```bash
|
|
569
|
-
# 取得所有任務(JSON 格式)
|
|
570
|
-
node .collaboration/core/task-api-json.js
|
|
571
|
-
|
|
572
|
-
# 取得單個任務
|
|
573
|
-
node .collaboration/core/task-api-json.js --task TASK_224
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
### 2.3 輸出格式
|
|
577
|
-
|
|
578
|
-
與舊版 `TASK_QUEUE.json` 相容,並匹配 Rust Task struct:
|
|
579
|
-
|
|
580
|
-
```json
|
|
581
|
-
{
|
|
582
|
-
"version": "3.3.0",
|
|
583
|
-
"tasks": [
|
|
584
|
-
{
|
|
585
|
-
"id": "TASK_224",
|
|
586
|
-
"hash": "ee9ddf4b-9746-4899-970a-da7c4d510681",
|
|
587
|
-
"title": "系統文檔:.collaboration 任務系統基礎概念",
|
|
588
|
-
"description": "...",
|
|
589
|
-
"status": "pending",
|
|
590
|
-
"priority": "P1",
|
|
591
|
-
"agent_type": "developer",
|
|
592
|
-
"role": "developer",
|
|
593
|
-
"complexity": "medium",
|
|
594
|
-
"assigned_agent": null,
|
|
595
|
-
"estimated_hours": null,
|
|
596
|
-
"actual_hours": null,
|
|
597
|
-
"branch": null,
|
|
598
|
-
"tags": ["docs", "collaboration"],
|
|
599
|
-
"dependencies": [],
|
|
600
|
-
"scope_paths": [],
|
|
601
|
-
"requirements": ["建立完整的 API 文檔"],
|
|
602
|
-
"acceptance_criteria": ["文檔包含所有 API"],
|
|
603
|
-
"technical_notes": [],
|
|
604
|
-
"created_by": {
|
|
605
|
-
"name": "{os_user}",
|
|
606
|
-
"git_user": "{git_user}",
|
|
607
|
-
"timestamp": "2026-02-20T12:33:44.145Z"
|
|
608
|
-
},
|
|
609
|
-
"last_modified_by": null,
|
|
610
|
-
"executed_by": null,
|
|
611
|
-
"assigned_to": null,
|
|
612
|
-
"rigor": "medium",
|
|
613
|
-
"metadata": {
|
|
614
|
-
"claimed_at": null,
|
|
615
|
-
"claimed_by": null,
|
|
616
|
-
"created_at": null,
|
|
617
|
-
"created_by": null
|
|
618
|
-
},
|
|
619
|
-
"feature_ids": [],
|
|
620
|
-
"related_tasks": [],
|
|
621
|
-
"keywords": [],
|
|
622
|
-
"notes": "",
|
|
623
|
-
"_file_path": "D:\\repo\\...\\backlog\\TASK_224_{git_user}.yaml",
|
|
624
|
-
"_source": "collaboration"
|
|
625
|
-
}
|
|
626
|
-
],
|
|
627
|
-
"statistics": { ... },
|
|
628
|
-
"metadata": { ... }
|
|
629
|
-
}
|
|
630
|
-
```
|
|
631
|
-
|
|
632
|
-
### 2.4 關鍵轉換
|
|
633
|
-
|
|
634
|
-
| 新系統欄位 | 舊系統欄位 | 轉換邏輯 |
|
|
635
|
-
|-----------|-----------|---------|
|
|
636
|
-
| `role` | `agent_type` | 優先 `role`,否則 `agent_type` |
|
|
637
|
-
| `status` | `status` | 保持舊格式 (pending/in_progress/completed) |
|
|
638
|
-
| `assigned_to` | `assigned_agent` | 從物件提取 `git_user` 或 `name` |
|
|
639
|
-
| `requirements` / `acceptance_criteria` / `technical_notes` | 同名 | 確保是字串陣列 |
|
|
640
|
-
|
|
641
|
-
### 2.5 JavaScript 使用
|
|
642
|
-
|
|
643
|
-
```javascript
|
|
644
|
-
const { execSync } = require('child_process');
|
|
645
|
-
|
|
646
|
-
// 取得所有任務
|
|
647
|
-
const json = execSync('node .collaboration/core/task-api-json.js', { encoding: 'utf8' });
|
|
648
|
-
const data = JSON.parse(json);
|
|
649
|
-
|
|
650
|
-
// 取得單個任務
|
|
651
|
-
const json2 = execSync('node .collaboration/core/task-api-json.js --task TASK_224', { encoding: 'utf8' });
|
|
652
|
-
const task = JSON.parse(json2);
|
|
653
|
-
```
|
|
654
|
-
|
|
655
|
-
---
|
|
656
|
-
|
|
657
|
-
## 3. migrate-legacy.js — 舊系統遷移工具
|
|
658
|
-
|
|
659
|
-
### 3.1 基本資訊
|
|
660
|
-
|
|
661
|
-
- **用途**: 將舊系統(dev/pipeline/)的任務遷移到新系統(.collaboration/tasks/archived/)
|
|
662
|
-
- **來源**:
|
|
663
|
-
1. `dev/pipeline/completed/*.yaml` — 舊 YAML 檔
|
|
664
|
-
2. `dev/pipeline/tasks/*.yaml` — 待處理任務
|
|
665
|
-
3. `dev/pipeline/TASK_QUEUE.json` — JSON 索引
|
|
666
|
-
- **目標**: `.collaboration/tasks/archived/TASK_XXX.yaml`
|
|
667
|
-
|
|
668
|
-
### 3.2 CLI 用法
|
|
669
|
-
|
|
670
|
-
```bash
|
|
671
|
-
# 預覽模式(不實際寫入)
|
|
672
|
-
node .collaboration/core/migrate-legacy.js
|
|
673
|
-
|
|
674
|
-
# 執行遷移
|
|
675
|
-
node .collaboration/core/migrate-legacy.js --execute
|
|
676
|
-
```
|
|
677
|
-
|
|
678
|
-
### 3.3 輸出範例
|
|
679
|
-
|
|
680
|
-
```
|
|
681
|
-
📋 Existing tasks in new system: 30
|
|
682
|
-
🔍 Legacy tasks found: 50
|
|
683
|
-
❌ Missing from new system: 20
|
|
684
|
-
|
|
685
|
-
📝 TASK_134 ← dev/pipeline/completed/TASK_134_legacy.yaml (dry-run)
|
|
686
|
-
📝 TASK_135 ← dev/pipeline/TASK_QUEUE.json (dry-run)
|
|
687
|
-
...
|
|
688
|
-
|
|
689
|
-
📋 20 tasks would be migrated. Run with --execute to apply.
|
|
690
|
-
```
|
|
691
|
-
|
|
692
|
-
執行後:
|
|
693
|
-
|
|
694
|
-
```
|
|
695
|
-
✅ TASK_134 ← dev/pipeline/completed/TASK_134_legacy.yaml
|
|
696
|
-
✅ TASK_135 ← dev/pipeline/TASK_QUEUE.json
|
|
697
|
-
...
|
|
698
|
-
|
|
699
|
-
✅ Migrated 20 tasks to .collaboration/tasks/archived/
|
|
700
|
-
```
|
|
701
|
-
|
|
702
|
-
### 3.4 轉換邏輯
|
|
703
|
-
|
|
704
|
-
#### 狀態映射
|
|
705
|
-
|
|
706
|
-
| 舊系統 | 新系統 |
|
|
707
|
-
|-------|-------|
|
|
708
|
-
| `pending` | `backlog` |
|
|
709
|
-
| `in_progress` | `active` |
|
|
710
|
-
| `completed` | `completed` |
|
|
711
|
-
| `cancelled` | `cancel` |
|
|
712
|
-
| `blocked` | `blocked` |
|
|
713
|
-
| `done` | `completed` |
|
|
714
|
-
| `split` | `backlog` |
|
|
715
|
-
|
|
716
|
-
#### 角色處理
|
|
717
|
-
|
|
718
|
-
- 優先使用 `role`
|
|
719
|
-
- 否則使用 `agent_type`
|
|
720
|
-
- 否則使用 `assigned_team`
|
|
721
|
-
- 預設 `developer`
|
|
722
|
-
|
|
723
|
-
#### 欄位補充
|
|
724
|
-
|
|
725
|
-
- 自動生成 `hash`(UUID v4)
|
|
726
|
-
- `rigor` 預設為 `low`
|
|
727
|
-
- `created_by` 設為 `"Legacy Migration"`
|
|
728
|
-
- `metadata.migrated_from` 記錄來源路徑
|
|
729
|
-
- `metadata.migrated_at` 記錄遷移時間
|
|
730
|
-
|
|
731
|
-
### 3.5 JavaScript 使用
|
|
732
|
-
|
|
733
|
-
遷移工具目前為純 CLI 工具,沒有提供 JS API。建議透過 child_process 執行:
|
|
734
|
-
|
|
735
|
-
```javascript
|
|
736
|
-
const { execSync } = require('child_process');
|
|
737
|
-
|
|
738
|
-
// 預覽
|
|
739
|
-
const preview = execSync('node .collaboration/core/migrate-legacy.js', { encoding: 'utf8' });
|
|
740
|
-
console.log(preview);
|
|
741
|
-
|
|
742
|
-
// 執行
|
|
743
|
-
const result = execSync('node .collaboration/core/migrate-legacy.js --execute', { encoding: 'utf8' });
|
|
744
|
-
console.log(result);
|
|
745
|
-
```
|
|
746
|
-
|
|
747
|
-
---
|
|
748
|
-
|
|
749
|
-
## 4. 完整範例
|
|
750
|
-
|
|
751
|
-
### 4.1 創建並執行任務的完整流程
|
|
752
|
-
|
|
753
|
-
```javascript
|
|
754
|
-
const { TaskAPI } = require('./.collaboration/core/task-api.js');
|
|
755
|
-
const api = new TaskAPI();
|
|
756
|
-
|
|
757
|
-
async function workflow() {
|
|
758
|
-
// 1. 建立任務
|
|
759
|
-
const task = await api.createTask({
|
|
760
|
-
title: "實作登入功能",
|
|
761
|
-
description: "建立用戶登入頁面和 API",
|
|
762
|
-
priority: "P1",
|
|
763
|
-
role: "frontend",
|
|
764
|
-
rigor: "high",
|
|
765
|
-
tags: ["code", "feature"],
|
|
766
|
-
dependencies: ["TASK_170"],
|
|
767
|
-
scope_paths: ["dashboard/src/pages/Login.tsx"],
|
|
768
|
-
requirements: ["建立登入表單", "實作 JWT 驗證"],
|
|
769
|
-
acceptance_criteria: ["登入表單正常顯示", "JWT 驗證正常運作"],
|
|
770
|
-
estimated_hours: 8
|
|
771
|
-
});
|
|
772
|
-
console.log(`✅ 任務已建立: ${task.id}`);
|
|
773
|
-
|
|
774
|
-
// 2. 認領任務
|
|
775
|
-
await api.claimTask(task.id);
|
|
776
|
-
console.log(`✅ 任務已認領: ${task.id}`);
|
|
777
|
-
|
|
778
|
-
// 3. 執行工作...
|
|
779
|
-
console.log('🔨 執行中...');
|
|
780
|
-
|
|
781
|
-
// 4. 完成任務
|
|
782
|
-
await api.completeTask(task.id, { actual_hours: 6.5 });
|
|
783
|
-
console.log(`✅ 任務已完成: ${task.id}`);
|
|
784
|
-
|
|
785
|
-
// 5. 查詢統計
|
|
786
|
-
const stats = await api.getStatistics();
|
|
787
|
-
console.log(`📊 總任務數: ${stats.total}`);
|
|
788
|
-
console.log(`📊 已完成: ${stats.byStatus.completed}`);
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
workflow();
|
|
792
|
-
```
|
|
793
|
-
|
|
794
|
-
### 4.2 批次處理任務
|
|
795
|
-
|
|
796
|
-
```javascript
|
|
797
|
-
const { TaskAPI } = require('./.collaboration/core/task-api.js');
|
|
798
|
-
const api = new TaskAPI();
|
|
799
|
-
|
|
800
|
-
async function batchProcess() {
|
|
801
|
-
// 找出所有 P1 pending 任務
|
|
802
|
-
const tasks = await api.queryTasks({
|
|
803
|
-
status: 'pending',
|
|
804
|
-
priority: 'P1',
|
|
805
|
-
role: 'developer'
|
|
806
|
-
});
|
|
807
|
-
|
|
808
|
-
console.log(`找到 ${tasks.length} 個高優先級待處理任務`);
|
|
809
|
-
|
|
810
|
-
// 批次認領
|
|
811
|
-
for (const task of tasks) {
|
|
812
|
-
await api.claimTask(task.id);
|
|
813
|
-
console.log(`✅ 認領: ${task.id} - ${task.title}`);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
batchProcess();
|
|
818
|
-
```
|
|
819
|
-
|
|
820
|
-
### 4.3 監控任務狀態
|
|
821
|
-
|
|
822
|
-
```javascript
|
|
823
|
-
const { TaskAPI } = require('./.collaboration/core/task-api.js');
|
|
824
|
-
const api = new TaskAPI();
|
|
825
|
-
|
|
826
|
-
async function monitor() {
|
|
827
|
-
const stats = await api.getStatistics();
|
|
828
|
-
|
|
829
|
-
console.log('===== 任務儀表板 =====');
|
|
830
|
-
console.log(`總任務數: ${stats.total}`);
|
|
831
|
-
console.log('');
|
|
832
|
-
console.log('按狀態:');
|
|
833
|
-
for (const [status, count] of Object.entries(stats.byStatus)) {
|
|
834
|
-
console.log(` ${status}: ${count}`);
|
|
835
|
-
}
|
|
836
|
-
console.log('');
|
|
837
|
-
console.log('按優先級:');
|
|
838
|
-
for (const [priority, count] of Object.entries(stats.byPriority)) {
|
|
839
|
-
console.log(` ${priority}: ${count}`);
|
|
840
|
-
}
|
|
841
|
-
console.log('');
|
|
842
|
-
console.log('按角色:');
|
|
843
|
-
for (const [role, count] of Object.entries(stats.byRole)) {
|
|
844
|
-
console.log(` ${role}: ${count}`);
|
|
845
|
-
}
|
|
846
|
-
console.log('');
|
|
847
|
-
console.log('按標籤:');
|
|
848
|
-
for (const [tag, count] of Object.entries(stats.byTags)) {
|
|
849
|
-
console.log(` ${tag}: ${count}`);
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
monitor();
|
|
854
|
-
```
|
|
855
|
-
|
|
856
|
-
---
|
|
857
|
-
|
|
858
|
-
## 5. 常見問題
|
|
859
|
-
|
|
860
|
-
### 5.1 如何處理任務 ID 衝突?
|
|
861
|
-
|
|
862
|
-
任務 ID 衝突時,使用 `hash` 欄位(UUID v4)進行唯一識別。
|
|
863
|
-
|
|
864
|
-
### 5.2 如何恢復已取消的任務?
|
|
865
|
-
|
|
866
|
-
```bash
|
|
867
|
-
node .collaboration/core/task-api.js move TASK_XXX backlog
|
|
868
|
-
```
|
|
869
|
-
|
|
870
|
-
### 5.3 如何強制移動到不允許的狀態?
|
|
871
|
-
|
|
872
|
-
```bash
|
|
873
|
-
node .collaboration/core/task-api.js move TASK_XXX TARGET_STATUS --force
|
|
874
|
-
```
|
|
875
|
-
|
|
876
|
-
### 5.4 如何批次封存舊任務?
|
|
877
|
-
|
|
878
|
-
```bash
|
|
879
|
-
# 保留最新 10 個 done 任務,其餘封存
|
|
880
|
-
node .collaboration/core/task-api.js archive --keep 10
|
|
881
|
-
```
|
|
882
|
-
|
|
883
|
-
### 5.5 為什麼 requirements 變成了字串陣列?
|
|
884
|
-
|
|
885
|
-
v3.2 改進:確保 `requirements`、`acceptance_criteria`、`technical_notes` 一律是字串陣列,避免物件混入導致的 Rust 解析錯誤。
|
|
886
|
-
|
|
887
|
-
### 5.6 rigor 欄位的作用?
|
|
888
|
-
|
|
889
|
-
`rigor`(嚴謹度)決定任務是否需要 team 執行:
|
|
890
|
-
- `high` — 需要 team 執行(多 Agent 協作)
|
|
891
|
-
- `medium` — 可選 team 或單一 Agent
|
|
892
|
-
- `low` — 單一 Agent 即可
|
|
893
|
-
|
|
894
|
-
---
|
|
895
|
-
|
|
896
|
-
## 6. 版本歷史
|
|
897
|
-
|
|
898
|
-
### v3.3.0 (2026-02-14)
|
|
899
|
-
- ✅ 新增 `rigor` 欄位(嚴謹度)
|
|
900
|
-
- ✅ CLI 支援 `--rigor` 篩選和建立
|
|
901
|
-
|
|
902
|
-
### v3.2.0 (2026-02-14)
|
|
903
|
-
- ✅ 新增 `hash` 欄位(UUID v4)
|
|
904
|
-
- ✅ `agent_type` 改名為 `role`(保持向後相容)
|
|
905
|
-
- ✅ 新增 `tags` 欄位(陣列)
|
|
906
|
-
- ✅ 新增 `actual_hours` 和 `branch` 欄位
|
|
907
|
-
- ✅ 簡化人員追蹤(移除 assigned_to, collaborators, metadata)
|
|
908
|
-
|
|
909
|
-
### v3.1.0 (2026-02-14)
|
|
910
|
-
- ✅ 使用 js-yaml 替代自訂 YAML 解析器
|
|
911
|
-
- ✅ `moveTask` 原子性操作
|
|
912
|
-
- ✅ 狀態機驗證
|
|
913
|
-
|
|
914
|
-
### v3.0.0 (2026-02-14)
|
|
915
|
-
- ✅ 目錄即狀態設計
|
|
916
|
-
- ✅ YAML 格式任務檔案
|
|
917
|
-
- ✅ 移除 JSONL 索引依賴
|
|
918
|
-
|
|
919
|
-
---
|
|
920
|
-
|
|
921
|
-
## 7. 相關文檔
|
|
922
|
-
|
|
923
|
-
- [.collaboration/README.md](../../.collaboration/README.md) — 系統概述
|
|
924
|
-
- [CLAUDE.md](../../CLAUDE.md) — 專案指導
|
|
925
|
-
- [.system/collaboration/README.md](../collaboration/README.md) — 新舊系統對比
|