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.
Files changed (316) hide show
  1. package/core/.claude/commands/agent-worker.md +1 -1
  2. package/core/.claude/commands/architect.md +1 -2
  3. package/core/.claude/commands/spec.md +1 -1
  4. package/core/.claude/commands//347/224/242/345/223/201.md +1 -1
  5. package/core/.claude/hooks/__tests__/task-1977-dedupe-guard.test.js +8 -8
  6. package/core/.claude/hooks/synapse-first-investigation.js +15 -0
  7. package/core/.claude/skills/architect_agent/SKILL.md +11 -92
  8. package/core/.claude/skills/assessment_agent/SKILL.md +0 -1
  9. package/core/.claude/skills/backend_engineer/SKILL.md +3 -6
  10. package/core/.claude/skills/code_reviewer/SKILL.md +1 -1
  11. package/core/.claude/skills/code_reviewer/patterns.yaml +1 -1
  12. package/core/.claude/skills/designer/SKILL.md +3 -6
  13. package/core/.claude/skills/dev_agent/SKILL.md +30 -491
  14. package/core/.claude/skills/developer/SKILL.md +3 -6
  15. package/core/.claude/skills/feature_agent/SKILL.md +3 -17
  16. package/core/.claude/skills/product_manager/SKILL.md +29 -1064
  17. package/core/.claude/skills/qa_engineer/SKILL.md +12 -17
  18. package/core/.claude/skills/spec_optimizer/SKILL.md +25 -275
  19. package/core/.claude/skills/sre_agent/SKILL.md +3 -6
  20. package/core/.collaboration/README.md +2 -3
  21. package/core/.collaboration/core/task-api.js +5 -138
  22. package/core/.collaboration/docs/CLI.md +0 -2
  23. package/core/.failure/INDEX.yaml +6 -40
  24. package/core/.failure/agent-execution/FAIL-013-search-cwd-drift-and-case-mismatch.yaml +1 -1
  25. package/core/.failure/tools/README.md +9 -227
  26. package/core/.formation/bifrost/exec.js +29 -4
  27. package/core/.formation/bifrost/launch.js +1 -6
  28. package/core/.formation/bifrost/launch.test.js +1 -1
  29. package/core/.formation/bifrost/provider-launch.js +18 -11
  30. package/core/.formation/bifrost/provider-launch.test.js +26 -2
  31. package/core/.formation/bifrost/shared/ansuz-boot-policy.js +3 -3
  32. package/core/.formation/bifrost/shared/ansuz-boot-policy.test.js +1 -2
  33. package/core/.formation/tools/__tests__/dispatch-cwd-project.test.js +42 -0
  34. package/core/.formation/tools/__tests__/m1-hmap-convid.test.js +1 -124
  35. package/core/.formation/tools/__tests__/subagent-executor.test.js +3 -2
  36. package/core/.formation/tools/dispatch.js +15 -2
  37. package/core/.formation/tools/loader.js +17 -140
  38. package/core/.formation/tools/post-complete.js +0 -31
  39. package/core/.rule/INDEX.yaml +0 -18
  40. package/core/.rule/general/agent-workflow.yaml +14 -164
  41. package/core/.rule/general/project-self-containment.yaml +8 -19
  42. package/core/.rule/general/rust-verify-target.yaml +6 -5
  43. package/core/.rule/general/synapse-code-intelligence.yaml +3 -3
  44. package/core/.specialist/Amelia/capability.yaml +12 -12
  45. package/core/.specialist/Amelia/workflow.yaml +2 -2
  46. package/core/.specialist/Ansuz/SYSTEM_DOC.md +20 -578
  47. package/core/.specialist/Ansuz/cognitive_principles.yaml +2 -3
  48. package/core/.specialist/Ansuz/concepts/boot_rules_summary.yaml +0 -1
  49. package/core/.specialist/Ansuz/concepts/deep_knowledge_pointers.yaml +1 -2
  50. package/core/.specialist/Ansuz/core.yaml +6 -108
  51. package/core/.specialist/Ansuz/guards/lesson_guards.yaml +0 -3
  52. package/core/.specialist/Ansuz/identity_contract.yaml +0 -1
  53. package/core/.specialist/Ansuz/knowledge.yaml +0 -4
  54. package/core/.specialist/Ansuz/rule.yaml +0 -1
  55. package/core/.specialist/Ansuz/tools/handoff-session-identity.test.js +6 -150
  56. package/core/.specialist/tests/runtime-discovery/README.md +1 -1
  57. package/core/.specialist/tools/__tests__/task-2374-usage-counter.test.js +1 -12
  58. package/core/.specialist/tools/prompt-files.test.js +1 -0
  59. package/core/.specialist/tools/task-bridge.js +1 -66
  60. package/core/.system/README.md +11 -552
  61. package/core/.system/collaboration/README.md +10 -174
  62. package/core/CLAUDE.md +1 -6
  63. package/core/KENAZ_CORE_VERSION +1 -1
  64. package/core/dev/scripts/js-yaml-resolution.test.js +1 -1
  65. package/core/dev/scripts/run-rust-tests.js +30 -46
  66. package/core/dev/scripts/run-rust-tests.test.js +17 -0
  67. package/core/dev/scripts/rust-verify-worktree.js +4 -4
  68. package/core/dev/scripts/verify-target-dir.js +6 -6
  69. package/core/plugins/kenaz/INVENTORY.md +8 -8
  70. package/core/plugins/kenaz/commands/architect.md +1 -2
  71. package/core/plugins/kenaz/commands/spec.md +1 -1
  72. package/core/plugins/kenaz/commands//347/224/242/345/223/201.md +1 -1
  73. package/core/plugins/kenaz/guidance.md +1 -1
  74. package/core/plugins/kenaz/scripts/sync.js +1 -1
  75. package/core/plugins/kenaz/scripts/ygg.js +6 -0
  76. package/core/plugins/kenaz/skills/architect_agent/SKILL.md +11 -92
  77. package/core/plugins/kenaz/skills/assessment_agent/SKILL.md +0 -1
  78. package/core/plugins/kenaz/skills/backend_engineer/SKILL.md +3 -6
  79. package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +1 -1
  80. package/core/plugins/kenaz/skills/code_reviewer/patterns.yaml +1 -1
  81. package/core/plugins/kenaz/skills/designer/SKILL.md +3 -6
  82. package/core/plugins/kenaz/skills/dev_agent/SKILL.md +30 -491
  83. package/core/plugins/kenaz/skills/developer/SKILL.md +3 -6
  84. package/core/plugins/kenaz/skills/feature_agent/SKILL.md +3 -17
  85. package/core/plugins/kenaz/skills/product_manager/SKILL.md +29 -1064
  86. package/core/plugins/kenaz/skills/qa_engineer/SKILL.md +12 -17
  87. package/core/plugins/kenaz/skills/spec_optimizer/SKILL.md +25 -275
  88. package/core/plugins/kenaz/skills/sre_agent/SKILL.md +3 -6
  89. package/package.json +6 -6
  90. package/core/.claude/commands/archive.md +0 -24
  91. package/core/.claude/commands/init.md +0 -112
  92. package/core/.claude/commands/legacy_dev.md +0 -18
  93. package/core/.claude/commands/product-review.md +0 -131
  94. package/core/.claude/commands/strategy.md +0 -141
  95. package/core/.claude/commands/sunny.md +0 -1
  96. package/core/.claude/commands//347/224/242/345/223/201/346/252/242/350/246/226.md +0 -129
  97. package/core/.claude/commands//351/200/262/345/272/246.md +0 -15
  98. package/core/.claude/hooks/__tests__/substrate.test.js +0 -122
  99. package/core/.claude/hooks/_substrate-paths.js +0 -95
  100. package/core/.claude/hooks/context-check.js +0 -51
  101. package/core/.claude/hooks/fatigue-check.js +0 -52
  102. package/core/.claude/hooks/handoff-snapshot-on-commit.js +0 -154
  103. package/core/.claude/hooks/handoff-snapshot-on-question.js +0 -158
  104. package/core/.claude/hooks/handoff-staleness.js +0 -197
  105. package/core/.claude/hooks/jev-thalamus-context.js +0 -17
  106. package/core/.claude/hooks/jev-thalamus-context.test.js +0 -41
  107. package/core/.claude/hooks/lease-release.js +0 -119
  108. package/core/.claude/hooks/lease-touch.js +0 -96
  109. package/core/.claude/hooks/reflex-feedback.js +0 -5
  110. package/core/.claude/hooks/session-init.ps1 +0 -49
  111. package/core/.claude/hooks/sound-event.js +0 -70
  112. package/core/.claude/hooks/sound-event.sh +0 -37
  113. package/core/.claude/hooks/stream-delta.js +0 -169
  114. package/core/.claude/no-hooks.settings.json +0 -3
  115. package/core/.claude/skills/legacy_dev/SKILL.md +0 -202
  116. package/core/.claude/skills/sunny/SKILL.md +0 -74
  117. package/core/.collaboration/cli/commands/assign.js +0 -39
  118. package/core/.collaboration/cli/commands/claim.js +0 -33
  119. package/core/.collaboration/cli/commands/complete.js +0 -44
  120. package/core/.collaboration/cli/commands/create.js +0 -110
  121. package/core/.collaboration/cli/commands/get.js +0 -83
  122. package/core/.collaboration/cli/commands/index.js +0 -52
  123. package/core/.collaboration/cli/commands/list.js +0 -51
  124. package/core/.collaboration/cli/commands/lock.js +0 -45
  125. package/core/.collaboration/cli/commands/rebuild.js +0 -39
  126. package/core/.collaboration/cli/commands/search.js +0 -61
  127. package/core/.collaboration/cli/commands/stats.js +0 -61
  128. package/core/.collaboration/cli/commands/transfer.js +0 -41
  129. package/core/.collaboration/cli/commands/unlock.js +0 -48
  130. package/core/.collaboration/cli/formatters/help-formatter.js +0 -70
  131. package/core/.collaboration/cli/formatters/index.js +0 -7
  132. package/core/.collaboration/cli/task-cli.js +0 -46
  133. package/core/.collaboration/cli/utils/arg-parser.js +0 -74
  134. package/core/.collaboration/cli/utils/git-user.js +0 -25
  135. package/core/.collaboration/cli/utils/index.js +0 -9
  136. package/core/.collaboration/cli/utils/output.js +0 -10
  137. package/core/.collaboration/config/default.yaml +0 -189
  138. package/core/.collaboration/core/conflict-resolver.js +0 -461
  139. package/core/.collaboration/core/conflict-resolver.test.js +0 -389
  140. package/core/.collaboration/core/migrate-legacy.js +0 -260
  141. package/core/.collaboration/docs/API.md +0 -787
  142. package/core/.collaboration/docs/ARCHITECTURE.md +0 -596
  143. package/core/.collaboration/docs/FAQ.md +0 -695
  144. package/core/.collaboration/docs/MIGRATION.md +0 -804
  145. package/core/.collaboration/docs/examples/README.md +0 -320
  146. package/core/.collaboration/docs/examples/advanced-queries.js +0 -261
  147. package/core/.collaboration/docs/examples/basic-usage.js +0 -184
  148. package/core/.collaboration/docs/examples/team-workflow.js +0 -352
  149. package/core/.failure/agent-execution/FAIL-001-agent-no-output.yaml +0 -391
  150. package/core/.failure/agent-execution/FAIL-007-pm-lead-wrong-team-invocation.yaml +0 -0
  151. package/core/.failure/agent-execution/FAIL-010-phase0-poem-format-skipped.yaml +0 -28
  152. package/core/.failure/agent-execution/FAIL-010-skipping-cognitive-checkpoint-after-verification.yaml +0 -59
  153. package/core/.failure/agent-execution/FAIL-012-grep-shortcut-during-investigation.yaml +0 -85
  154. package/core/.failure/architecture/FAIL-006-python-version-compatibility.yaml +0 -445
  155. package/core/.failure/pipeline/FAIL-003-queue-pollution.yaml +0 -335
  156. package/core/.failure/pipeline/README.md +0 -95
  157. package/core/.failure/retired/FAIL-009-skipping-synapse-pulse-before-code-change.yaml +0 -49
  158. package/core/.failure/tools/USAGE_GUIDE.md +0 -323
  159. package/core/.failure/tools/check_failures.ps1 +0 -387
  160. package/core/.failure/tools/log_failure.ps1 +0 -474
  161. package/core/.formation/.episode-input.json +0 -10
  162. package/core/.formation/.merge-lock +0 -1
  163. package/core/.formation/lead.yaml +0 -118
  164. package/core/.formation/legacy.bak/designer.yaml +0 -57
  165. package/core/.formation/legacy.bak/pm.yaml +0 -57
  166. package/core/.formation/legacy.bak/qa.yaml +0 -57
  167. package/core/.formation/legacy.bak/review.yaml +0 -62
  168. package/core/.formation/legacy.bak/scheduler.yaml +0 -129
  169. package/core/.formation/legacy.bak/sre.yaml +0 -57
  170. package/core/.formation/role-map.yaml +0 -274
  171. package/core/.formation/roles/_shared/modules/code_review.yaml +0 -98
  172. package/core/.formation/roles/_shared/modules/security.yaml +0 -103
  173. package/core/.formation/roles/_shared/modules/testing.yaml +0 -14
  174. package/core/.formation/roles/backend/role.yaml +0 -93
  175. package/core/.formation/roles/code_reviewer/role.yaml +0 -102
  176. package/core/.formation/roles/database_optimizer/role.yaml +0 -107
  177. package/core/.formation/roles/designer/role.yaml +0 -66
  178. package/core/.formation/roles/developer/role.yaml +0 -75
  179. package/core/.formation/roles/frontend/role.yaml +0 -134
  180. package/core/.formation/roles/incident_response/role.yaml +0 -89
  181. package/core/.formation/roles/qa/role.yaml +0 -89
  182. package/core/.formation/roles/security/role.yaml +0 -87
  183. package/core/.formation/roles/sre/role.yaml +0 -66
  184. package/core/.formation/skills/coordinator.yaml +0 -52
  185. package/core/.formation/solo/diagnosis.yaml +0 -78
  186. package/core/.formation/solo/strategy.yaml +0 -121
  187. package/core/.formation/tests/hello.txt +0 -2
  188. package/core/.formation/tools/coordinator.js +0 -350
  189. package/core/.formation/tools/jev-correction.js +0 -214
  190. package/core/.formation/tools/jev-correction.test.js +0 -178
  191. package/core/.formation/tools/log-reader.js +0 -232
  192. package/core/.formation/tools/revert-daemon-state.js +0 -162
  193. package/core/.formation/tools/test-drift.js +0 -148
  194. package/core/.formation/unit/heimdall.yaml +0 -96
  195. package/core/.formation/unit/plan.yaml +0 -67
  196. package/core/.formation/unit/think.yaml +0 -58
  197. package/core/.kenaz/MUNINN_SNAPSHOT9_EPISODE.json +0 -32
  198. package/core/.kenaz/MUNINN_SNAPSHOT9_RUNE.json +0 -23
  199. package/core/.kenaz/MUNINN_SNAPSHOT9_SUMMARY.md +0 -89
  200. package/core/.kenaz/ash_TASK_1428-20260507.json +0 -14
  201. package/core/.kenaz/muninn_episode_write.ps1 +0 -17
  202. package/core/.kenaz/muninn_snapshot11_rune_candidates.md +0 -63
  203. package/core/.kenaz/muninn_snapshot1_rune_candidates.md +0 -49
  204. package/core/.kenaz/runes_TASK_1428.json +0 -57
  205. package/core/.kenaz/tmp_heimdall_proposal_8d3e392.json +0 -13
  206. package/core/.kenaz/tmp_props.json +0 -1
  207. package/core/.kenaz/tmp_sounddrop_t1_prompt.txt +0 -371
  208. package/core/.rule/MECHANIZED.md +0 -61
  209. package/core/.rule/general/cortex-memory-recall.yaml +0 -446
  210. package/core/.rule/general/pipeline.yaml +0 -246
  211. package/core/.rule/general/sunny-access-control.yaml +0 -60
  212. package/core/.rule/general/system-invariants.yaml +0 -231
  213. package/core/.rule/pipeline/PPL-002-completed-task-archival.yaml +0 -528
  214. package/core/.rule/pipeline/auto-update.yaml +0 -282
  215. package/core/.rule/pipeline/task-execution.yaml +0 -365
  216. package/core/.specialist/Ansuz/concepts/phase_protocol.yaml +0 -65
  217. package/core/.specialist/Ansuz/experiments/boot_ablation_replay.js +0 -197
  218. package/core/.specialist/Ansuz/tools/bootstrap-anchors.js +0 -289
  219. package/core/.specialist/Ansuz/workflow.yaml +0 -1225
  220. package/core/.specialist/experiments/rg_benchmark.js +0 -523
  221. package/core/.specialist/experiments/rg_benchmark_results.json +0 -27
  222. package/core/.specialist/tools/jev-optional-context.js +0 -107
  223. package/core/.specialist/tools/jev-optional-context.test.js +0 -152
  224. package/core/.specialist/tools/memory-action-log.js +0 -839
  225. package/core/.specialist/tools/phase-gate.js +0 -3534
  226. package/core/.specialist/tools/phase-gate.test.js +0 -85
  227. package/core/.specialist/tools/precompute-runner.js +0 -444
  228. package/core/.specialist/tools/rule-engine.js +0 -621
  229. package/core/.specialist/tools/task-bridge-jev.test.js +0 -170
  230. package/core/.synapse/memory-shared.json.sync +0 -1
  231. package/core/.system/agent-skills/README.md +0 -724
  232. package/core/.system/cli-tools/README.md +0 -724
  233. package/core/.system/cortex/MODULES.md +0 -1046
  234. package/core/.system/dashboard/FRONTEND.md +0 -812
  235. package/core/.system/dashboard/README.md +0 -737
  236. package/core/.system/failure/README.md +0 -723
  237. package/core/.system/formation/LEGACY_SKILLS.md +0 -974
  238. package/core/.system/formation/POST_COMPLETE.md +0 -602
  239. package/core/.system/formation/README.md +0 -1094
  240. package/core/.system/formation/TOOLS_REFERENCE.md +0 -1145
  241. package/core/.system/kenaz/README.md +0 -787
  242. package/core/.system/memory/README.md +0 -719
  243. package/core/.system/pipeline/README.md +0 -712
  244. package/core/.system/rule/README.md +0 -794
  245. package/core/.system/sunny/README.md +0 -476
  246. package/core/.system/sunny/RULES.json +0 -89
  247. package/core/.system/sunny/knowledge/INDEX.md +0 -37
  248. package/core/.system/sunny/knowledge/agent-teams-api.md +0 -0
  249. package/core/.system/sunny/knowledge/ansuz-specialist.md +0 -500
  250. package/core/.system/sunny/knowledge/claude-cli-spawn.md +0 -177
  251. package/core/.system/sunny/knowledge/collaboration-api.md +0 -925
  252. package/core/.system/sunny/teammates/README.md +0 -107
  253. package/core/.system/sunny/teammates/how_to_use.yaml +0 -101
  254. package/core/.system/sunny/teammates/tools/headless/launcher.js +0 -318
  255. package/core/.system/sunny/teammates/tools/powershell/launcher.js +0 -241
  256. package/core/.system/sunny/teammates/tools/powershell/start.bat +0 -50
  257. package/core/.system/sunny/teammates/tools/utils/env.js +0 -96
  258. package/core/.system/sunny/teammates/tools/utils/format-output.js +0 -329
  259. package/core/.system/sunny/tools.json +0 -101
  260. package/core/dev/scripts/cleanup-queue.js +0 -184
  261. package/core/dev/scripts/cleanup_queue.js +0 -86
  262. package/core/dev/scripts/legacy/README.md +0 -39
  263. package/core/dev/scripts/legacy/dev_agent_scheduler.ps1.bak +0 -536
  264. package/core/dev/scripts/legacy/multi_agent_scheduler.ps1.bak +0 -1978
  265. package/core/dev/scripts/matrix/CLI_README.md +0 -214
  266. package/core/dev/scripts/matrix/README.md +0 -310
  267. package/core/dev/scripts/matrix/package-lock.json +0 -4266
  268. package/core/dev/scripts/matrix/package.json +0 -55
  269. package/core/dev/scripts/matrix/src/abbreviations.ts +0 -295
  270. package/core/dev/scripts/matrix/src/cli/commands/convert.ts +0 -211
  271. package/core/dev/scripts/matrix/src/cli/commands/create.ts +0 -95
  272. package/core/dev/scripts/matrix/src/cli/commands/delete.ts +0 -102
  273. package/core/dev/scripts/matrix/src/cli/commands/list-tags.ts.wip +0 -140
  274. package/core/dev/scripts/matrix/src/cli/commands/manage-tags.ts.wip +0 -173
  275. package/core/dev/scripts/matrix/src/cli/commands/query.ts +0 -261
  276. package/core/dev/scripts/matrix/src/cli/commands/read.ts +0 -77
  277. package/core/dev/scripts/matrix/src/cli/commands/stats.ts.wip +0 -168
  278. package/core/dev/scripts/matrix/src/cli/commands/tokens.ts.wip +0 -126
  279. package/core/dev/scripts/matrix/src/cli/commands/update.ts +0 -147
  280. package/core/dev/scripts/matrix/src/cli/commands/validate.ts +0 -275
  281. package/core/dev/scripts/matrix/src/cli/index.ts +0 -350
  282. package/core/dev/scripts/matrix/src/cli/utils/file-handler.ts +0 -72
  283. package/core/dev/scripts/matrix/src/cli/utils/logger.ts +0 -65
  284. package/core/dev/scripts/matrix/src/index.ts +0 -62
  285. package/core/dev/scripts/matrix/src/indexer/tag-indexer.ts +0 -165
  286. package/core/dev/scripts/matrix/src/parser.ts +0 -281
  287. package/core/dev/scripts/matrix/src/serializer.ts +0 -151
  288. package/core/dev/scripts/matrix/src/validator.ts +0 -301
  289. package/core/dev/scripts/matrix/tests/abbreviations.test.ts +0 -122
  290. package/core/dev/scripts/matrix/tests/cli.test.ts +0 -177
  291. package/core/dev/scripts/matrix/tests/convert.test.ts +0 -143
  292. package/core/dev/scripts/matrix/tests/parser.test.ts +0 -203
  293. package/core/dev/scripts/matrix/tests/query.test.ts +0 -85
  294. package/core/dev/scripts/matrix/tests/serializer.test.ts +0 -197
  295. package/core/dev/scripts/matrix/tests/validate.test.ts +0 -141
  296. package/core/dev/scripts/matrix/tests/validator.test.ts +0 -167
  297. package/core/dev/scripts/matrix/tsconfig.json +0 -20
  298. package/core/dev/scripts/matrix/types/index.d.ts +0 -111
  299. package/core/dev/scripts/matrix/types/index.d.ts.map +0 -1
  300. package/core/dev/scripts/matrix/types/index.js +0 -8
  301. package/core/dev/scripts/matrix/types/index.js.map +0 -1
  302. package/core/dev/scripts/matrix/types/index.ts +0 -124
  303. package/core/dev/scripts/memory-usage-report.js +0 -152
  304. package/core/dev/scripts/probe/ansuz-scaffold-ablation.js +0 -579
  305. package/core/dev/scripts/probe/ansuz-scaffold-ablation.test.js +0 -244
  306. package/core/dev/scripts/probe/hook-latency-probe.js +0 -315
  307. package/core/dev/scripts/probe/hook-latency-probe.test.js +0 -105
  308. package/core/dev/scripts/probe/prediction-signal-auc.js +0 -483
  309. package/core/dev/scripts/probe/prediction-signal-auc.test.js +0 -200
  310. package/core/dev/scripts/test-pty-ws-tunnel.js +0 -229
  311. package/core/dev/scripts/validate_pipeline.js +0 -197
  312. package/core/dev/spikes/task2145-evidence-20261004/backend-log-excerpt.txt +0 -56
  313. package/core/dev/spikes/task2145-evidence-20261004/graph.shadow +0 -0
  314. package/core/dev/spikes/task2145-evidence-20261004/graph.wal +0 -0
  315. package/core/dev/spikes/task2145-evidence-20261004/graph_corrupt_suspect.marker +0 -1
  316. package/core/plugins/kenaz/commands/strategy.md +0 -141
@@ -1,712 +0,0 @@
1
- # Pipeline System - 舊任務系統 ⚠️ LEGACY
2
-
3
- > **專案位置**: `dev/pipeline/`
4
- > **系統類型**: 傳統任務管理系統(JSON + YAML)
5
- > **適用場景**: Multi-Agent 並行開發、排程自動化
6
- > **狀態**: ⚠️ **Legacy System**(相容支援,逐步淘汰)
7
-
8
- ---
9
-
10
- ## ⚠️ Legacy System 說明
11
-
12
- **此系統處於遷移階段,建議新開發使用 `.collaboration/` 新任務系統。**
13
-
14
- ### 系統狀態
15
-
16
- | 狀態 | 說明 |
17
- |------|------|
18
- | ⚠️ **Legacy** | 傳統系統,保留供排程器與 Multi-Agent 並行開發使用 |
19
- | ✅ **相容支援** | 目前仍可使用,但功能凍結,不再新增特性 |
20
- | 🔄 **逐步淘汰** | 未來將全面遷移到 `.collaboration/` 新系統 |
21
-
22
- ### 何時使用此系統
23
-
24
- | 場景 | 使用此系統 | 使用新系統 |
25
- |------|-----------|-----------|
26
- | **自動化排程** | ✅ 是 | ❌ 否(功能未完整) |
27
- | **Multi-Agent 並行開發** | ✅ 是(支援路徑鎖定) | ❌ 否(無衝突檢測) |
28
- | **手動協作流程** | ⚠️ 可以(但不推薦) | ✅ 是(更簡單) |
29
- | **簡單任務流程** | ⚠️ 可以(但過重) | ✅ 是(更輕量) |
30
-
31
- ### 遷移指引
32
-
33
- **新開發建議**:
34
- - ✅ 手動協作、簡單任務 → 使用 [`.collaboration/` 新系統](../.system/collaboration/README.md)
35
- - ⚠️ 自動化排程、並行開發 → 暫時使用此系統(待新系統功能補齊後遷移)
36
-
37
- **查詢任務時必須兩邊都查**:
38
- ```bash
39
- # 新系統查詢
40
- node .collaboration/core/task-api.js get TASK_XXX
41
-
42
- # 舊系統查詢
43
- cat dev/pipeline/TASK_QUEUE.json
44
- ls dev/pipeline/completed/TASK_XXX_*.yaml
45
- ```
46
-
47
- **遷移工具**:
48
- ```bash
49
- # 新系統 → 舊系統(JSON 匯出供排程器使用)
50
- node .collaboration/core/migrate-legacy.js export
51
-
52
- # 舊系統 → 新系統(未來全面遷移時使用)
53
- node .collaboration/core/migrate-legacy.js import
54
- ```
55
-
56
- **相關文檔**:
57
- - 新系統完整文檔:[`.system/collaboration/README.md`](../collaboration/README.md)
58
- - 新舊系統差異對照:[`.system/collaboration/README.md#詳細差異對照`](../collaboration/README.md#詳細差異對照)
59
- - 遷移路線圖:[`.system/collaboration/README.md#遷移方向`](../collaboration/README.md#遷移方向)
60
-
61
- ---
62
-
63
- ## 📋 系統概述
64
-
65
- Pipeline 系統是 Kenaz AI 的傳統任務管理系統,使用 **JSON 索引 + YAML 任務卡** 的雙軌制設計,支援多 Agent 並行開發與依賴管理。
66
-
67
- ### 與新系統的對比
68
-
69
- | 特性 | Pipeline System(舊) | Collaboration System(新) |
70
- |------|---------------------|--------------------------|
71
- | **任務格式** | JSON 索引 + YAML 檔案 | YAML + 目錄即狀態 |
72
- | **狀態管理** | TASK_QUEUE.json 集中式 | 目錄結構分散式 |
73
- | **適用場景** | 排程器、Multi-Agent | 手動協作、簡單流程 |
74
- | **Python 模組** | orchestrator/(豐富) | task-api.js(輕量) |
75
- | **路徑鎖定** | ✅ lock_manager.py | ❌ 無 |
76
- | **依賴解析** | ✅ dependency_resolver.py | ⚠️ 基礎支援 |
77
-
78
- **選擇建議**:
79
- - 需要自動化排程 → 使用 Pipeline System
80
- - 需要並行開發 → 使用 Pipeline System(支援路徑鎖定)
81
- - 手動協作流程 → 使用 Collaboration System(更簡單)
82
-
83
- ---
84
-
85
- ## 📁 目錄結構
86
-
87
- ```
88
- dev/pipeline/
89
- ├── README.md # 快速開始指南
90
- ├── WORKFLOW_GUIDE.md # 完整使用指南(20 分鐘)
91
- ├── PROGRESS.md # 進度追蹤文件
92
- ├── TASK_QUEUE.json # 任務佇列(JSON 索引)⭐
93
- ├── PIPELINE_CONFIG.json # Pipeline 配置
94
- ├── AGENT_STATE.json # Agent 狀態記錄
95
- ├── LOCK_STATE.json # 路徑鎖定狀態
96
- ├── DASHBOARD_HEARTBEAT.json # Dashboard 心跳檢測
97
- │
98
- ├── tasks/ # 待處理任務卡(YAML)
99
- │ ├── TASK_180_*.yaml
100
- │ └── ...
101
- │
102
- ├── completed/ # 已完成任務(YAML 封存)
103
- │ ├── TASK_066_*.yaml
104
- │ └── ...
105
- │
106
- ├── logs/ # 執行日誌(按日期)
107
- │ ├── 20260218_*.log
108
- │ └── ...
109
- │
110
- ├── orchestrator/ # Python 編排模組 ⭐
111
- │ ├── __init__.py
112
- │ ├── task_queue.py # 任務佇列管理
113
- │ ├── dependency_resolver.py # 依賴解析
114
- │ ├── lock_manager.py # 路徑鎖定機制
115
- │ ├── agent_assigner.py # Agent 分配邏輯
116
- │ └── ...
117
- │
118
- ├── docs/ # 系統文檔
119
- │ └── multi-agent-coordination.md
120
- │
121
- ├── plans/ # 執行計劃
122
- └── backups/ # 任務備份
123
- ```
124
-
125
- ---
126
-
127
- ## 🔑 核心文件
128
-
129
- ### 1. TASK_QUEUE.json(任務佇列索引)
130
-
131
- **用途**:集中式任務索引,記錄所有任務的狀態、依賴、路徑範圍。
132
-
133
- **結構**:
134
- ```json
135
- {
136
- "version": "1.0.0",
137
- "project": "kenaz-dashboard",
138
- "last_updated": "2026-02-15T12:30:00+08:00",
139
- "statistics": {
140
- "total": 8,
141
- "pending": 0,
142
- "in_progress": 0,
143
- "completed": 8,
144
- "blocked": 0,
145
- "cancelled": 0
146
- },
147
- "tasks": [
148
- {
149
- "id": "TASK_180",
150
- "title": "移除 Quick Actions 的 Single Agent Panel",
151
- "status": "completed",
152
- "priority": "P2",
153
- "agent_type": "frontend",
154
- "dependencies": [],
155
- "scope_paths": [
156
- "dashboard/src/components/quick-actions/..."
157
- ],
158
- "completed_at": "2026-02-15T01:42:14.000000+08:00"
159
- }
160
- ],
161
- "metadata": {
162
- "created_at": "2026-02-13T14:43:10.345+08:00",
163
- "source_spec": "dev/PRODUCT_SPEC.md"
164
- }
165
- }
166
- ```
167
-
168
- **關鍵字段**:
169
- | 字段 | 說明 | 範例 |
170
- |------|------|------|
171
- | `id` | 任務唯一 ID | `TASK_180` |
172
- | `status` | 任務狀態 | `pending`, `in_progress`, `completed`, `blocked`, `cancelled` |
173
- | `priority` | 優先級 | `P0`(最高)到 `P3`(最低) |
174
- | `agent_type` | 執行 Agent | `frontend`, `backend`, `developer_team` |
175
- | `dependencies` | 依賴任務 ID 列表 | `["TASK_147"]` |
176
- | `scope_paths` | 修改的文件/目錄路徑 | `["CLAUDE.md"]` |
177
-
178
- **更新規則**:
179
- - 任務完成時,**必須**更新 `status` 為 `completed`
180
- - **必須**填寫 `completed_at`、`completed_by`、`git_commit`
181
- - **必須**重新計算 `statistics` 統計數據
182
-
183
- ### 2. tasks/ 目錄(待處理任務卡)
184
-
185
- **用途**:存放待執行任務的 YAML 定義文件。
186
-
187
- **命名規則**:`TASK_XXX_<slug>.yaml`
188
-
189
- **YAML 格式**:
190
- ```yaml
191
- id: "TASK_180"
192
- title: "移除 Quick Actions 的 Single Agent Panel"
193
- description: "清理 Single Agent Panel 組件和相關 hooks"
194
- priority: "P2"
195
- status: "pending"
196
- agent_type: "frontend"
197
- source: "F-020"
198
- feature_ids: ["F-020"]
199
- dependencies: []
200
- scope_paths:
201
- - "dashboard/src/components/quick-actions/scripts-sections/SchedulerSection.tsx"
202
- - "dashboard/src/components/quick-actions/SingleAgentCard.tsx"
203
- requirements:
204
- - "移除 SingleAgentCard.tsx 組件"
205
- - "移除 use-single-agent.ts hook"
206
- acceptance_criteria:
207
- - "SingleAgentCard.tsx 已刪除"
208
- - "SchedulerSection.tsx 無引用錯誤"
209
- estimated_hours: 0.5
210
- complexity: "simple"
211
- ```
212
-
213
- **完成後流程**:
214
- 1. 任務完成 → 更新 TASK_QUEUE.json status
215
- 2. **必須**將 YAML 文件移動到 `completed/` 目錄
216
- 3. 更新 PROGRESS.md 統計數據
217
-
218
- ### 3. orchestrator/ 模組(Python 編排)
219
-
220
- **用途**:提供任務管理、依賴解析、路徑鎖定等進階功能。
221
-
222
- #### 3.1 task_queue.py(任務佇列管理)
223
-
224
- **核心類別**:
225
- - `TaskQueue`: 任務佇列管理器
226
- - `Task`: 任務資料模型
227
- - `TaskStatus`: 任務狀態枚舉
228
- - `TaskPriority`: 優先級枚舉
229
-
230
- **主要功能**:
231
- ```python
232
- from dev.pipeline.orchestrator.task_queue import TaskQueue, TaskStatus
233
-
234
- # 載入任務佇列
235
- queue = TaskQueue("dev/pipeline/TASK_QUEUE.json")
236
-
237
- # 取得下一個待執行任務(按優先級排序)
238
- next_task = queue.get_next_task()
239
-
240
- # 更新任務狀態
241
- queue.update_status("TASK_180", TaskStatus.COMPLETED)
242
-
243
- # 儲存變更
244
- queue.save()
245
-
246
- # 取得統計數據
247
- stats = queue.get_statistics()
248
- # {'total': 8, 'pending': 0, 'completed': 8, ...}
249
- ```
250
-
251
- **特色**:
252
- - ✅ JSON Schema 驗證
253
- - ✅ 優先級排序(P0 > P1 > P2 > P3)
254
- - ✅ 依賴關係檢查
255
- - ✅ 統計數據自動計算
256
-
257
- #### 3.2 dependency_resolver.py(依賴解析)
258
-
259
- **核心類別**:
260
- - `DependencyResolver`: 依賴關係解析器
261
- - `DependencyType`: 依賴類型(HARD/SOFT)
262
-
263
- **主要功能**:
264
- ```python
265
- from dev.pipeline.orchestrator.dependency_resolver import DependencyResolver
266
-
267
- resolver = DependencyResolver()
268
-
269
- # 加入任務與依賴
270
- resolver.add_task("TASK_147", dependencies=[], status="completed")
271
- resolver.add_task("TASK_148", dependencies=["TASK_147"], status="pending")
272
-
273
- # 取得可執行的任務(所有依賴已滿足)
274
- ready = resolver.get_ready_tasks() # ["TASK_148"]
275
-
276
- # 檢查循環依賴
277
- has_cycles = not resolver.validate_no_cycles()
278
-
279
- # 取得關鍵路徑(最長依賴鏈)
280
- critical_path = resolver.get_critical_path()
281
-
282
- # 取得拓撲排序(執行順序)
283
- order = resolver.get_execution_order()
284
-
285
- # 視覺化依賴圖
286
- print(resolver.visualize())
287
- ```
288
-
289
- **特色**:
290
- - ✅ 拓撲排序(Kahn's algorithm)
291
- - ✅ 循環依賴檢測(DFS)
292
- - ✅ 關鍵路徑計算(動態規劃)
293
- - ✅ 依賴圖視覺化(ASCII tree)
294
- - ✅ Blocked 狀態傳播(依賴阻塞時自動標記)
295
-
296
- #### 3.3 lock_manager.py(路徑鎖定機制)
297
-
298
- **核心類別**:
299
- - `PathLockManager`: 路徑鎖定管理器
300
- - `LockType`: 鎖定類型(DIRECTORY/FILE/PREFIX)
301
-
302
- **主要功能**:
303
- ```python
304
- from dev.pipeline.orchestrator.lock_manager import PathLockManager
305
-
306
- manager = PathLockManager("dev/pipeline/LOCK_STATE.json")
307
-
308
- # 嘗試取得鎖定
309
- paths = ["src/components/", "src/utils/helpers.ts"]
310
- if manager.acquire(paths, agent_id="agent_1", task_id="TASK_180"):
311
- # 執行工作
312
- ...
313
- # 完成後釋放
314
- manager.release("agent_1")
315
-
316
- # 檢查衝突(並行任務分配前)
317
- conflicts = manager.get_conflicts(["src/api/auth.py"])
318
- if conflicts:
319
- print(f"路徑衝突: {conflicts}")
320
-
321
- # 清理孤兒鎖定(處理 Agent crash)
322
- cleaned = manager.cleanup_orphan_locks(timeout_minutes=60)
323
- ```
324
-
325
- **鎖定類型**:
326
- | 類型 | 說明 | 範例 |
327
- |------|------|------|
328
- | DIRECTORY | 鎖定整個目錄樹 | `src/components/` |
329
- | FILE | 鎖定單一文件 | `src/utils/helpers.ts` |
330
- | PREFIX | 鎖定匹配前綴的所有路徑 | `src/api/*` |
331
-
332
- **衝突檢測規則**:
333
- - 路徑包含或被包含 = 衝突
334
- - `src/api/` 衝突 `src/api/auth.py`(目錄包含文件)
335
- - `src/api/*` 衝突 `src/api/auth.py`(前綴匹配)
336
-
337
- **特色**:
338
- - ✅ 多粒度鎖定(目錄/文件/前綴)
339
- - ✅ 衝突檢測(並行任務安全)
340
- - ✅ 持久化狀態(LOCK_STATE.json)
341
- - ✅ 孤兒鎖定清理(處理 Agent crash)
342
-
343
- ---
344
-
345
- ## 🔄 任務狀態機
346
-
347
- ```
348
- pending → in_progress → completed
349
- ↓ ↓
350
- blocked blocked
351
- ```
352
-
353
- **狀態轉換規則**:
354
- | 從 | 到 | 條件 |
355
- |---|---|------|
356
- | `pending` | `in_progress` | Agent 開始執行 |
357
- | `in_progress` | `completed` | 任務成功完成,驗收標準通過 |
358
- | `in_progress` | `blocked` | 遇到阻礙(依賴失敗、Bug、外部因素) |
359
- | `pending` | `blocked` | 依賴任務失敗 |
360
- | `blocked` | `pending` | 阻礙解除 |
361
- | `*` | `cancelled` | 任務取消 |
362
-
363
- ---
364
-
365
- ## 🚀 使用方式
366
-
367
- ### 1. 查看進度
368
-
369
- ```bash
370
- # 查看 PROGRESS.md(人類可讀)
371
- cat dev/pipeline/PROGRESS.md
372
-
373
- # 查看任務佇列(JSON)
374
- cat dev/pipeline/TASK_QUEUE.json
375
-
376
- # 驗證任務佇列語法
377
- python dev/pipeline/orchestrator/task_queue.py dev/pipeline/TASK_QUEUE.json
378
- ```
379
-
380
- ### 2. Python API 使用
381
-
382
- ```python
383
- from dev.pipeline.orchestrator.task_queue import TaskQueue, TaskStatus
384
- from dev.pipeline.orchestrator.dependency_resolver import DependencyResolver, create_resolver_from_task_queue
385
- from dev.pipeline.orchestrator.lock_manager import PathLockManager
386
-
387
- # === 任務佇列操作 ===
388
- queue = TaskQueue()
389
- next_task = queue.get_next_task()
390
- queue.update_status("TASK_180", TaskStatus.COMPLETED)
391
- queue.save()
392
-
393
- # === 依賴解析 ===
394
- resolver = create_resolver_from_task_queue(queue)
395
- ready_tasks = resolver.get_ready_tasks()
396
- critical_path = resolver.get_critical_path()
397
-
398
- # === 路徑鎖定 ===
399
- lock_manager = PathLockManager()
400
- if lock_manager.acquire(["src/api/"], "agent_1", "TASK_180"):
401
- # 執行任務
402
- ...
403
- lock_manager.release("agent_1")
404
- ```
405
-
406
- ### 3. 與排程器整合
407
-
408
- Pipeline 系統與以下排程器整合:
409
-
410
- | 排程器 | 路徑 | 用途 |
411
- |--------|------|------|
412
- | **Single Agent** | `dev/scripts/START_DEV_AGENT.bat` | 單 Agent 自動化開發 |
413
- | **Multi-Agent** | `dev/scripts/START_MULTI_AGENT.bat` | 多 Agent 並行開發 |
414
- | **Self-Enhancement** | Dashboard UI | 自我增強迭代模式 |
415
-
416
- **排程器流程**:
417
- ```
418
- 1. 排程器啟動 → 讀取 TASK_QUEUE.json
419
- 2. 取得 ready tasks → 依賴已滿足 + 無路徑衝突
420
- 3. 分配給 Agent → 透過路徑鎖定防止衝突
421
- 4. Agent 執行完成 → 更新 TASK_QUEUE.json + 移動 YAML
422
- 5. 自動啟動下一輪 → 循環執行
423
- ```
424
-
425
- ---
426
-
427
- ## 📊 統計與監控
428
-
429
- ### PROGRESS.md 統計區塊
430
-
431
- ```markdown
432
- ## Statistics
433
-
434
- ### Current Queue Status(舊系統 TASK_QUEUE.json)
435
- ```
436
- Active Tasks: 0
437
- Pending: 0 (0%)
438
- In Progress: 0 (0%)
439
- Completed: 8 (100%)
440
- Blocked: 0 (0%)
441
- ```
442
-
443
- ### Historical Record (from .memory/ + completed/)
444
- ```
445
- Completed Tasks: 187+
446
- Total Historical: 187+
447
- ```
448
- ```
449
-
450
- ### Python 統計查詢
451
-
452
- ```python
453
- queue = TaskQueue()
454
- stats = queue.get_statistics()
455
- # {
456
- # 'total': 8,
457
- # 'pending': 0,
458
- # 'in_progress': 0,
459
- # 'completed': 8,
460
- # 'blocked': 0,
461
- # 'cancelled': 0
462
- # }
463
-
464
- resolver = create_resolver_from_task_queue(queue)
465
- resolver_stats = resolver.get_statistics()
466
- # {
467
- # 'total_tasks': 8,
468
- # 'total_edges': 5,
469
- # 'status_counts': {'completed': 8},
470
- # 'has_cycles': False,
471
- # 'critical_path_length': 3,
472
- # 'critical_path_duration': 5.0,
473
- # 'ready_tasks_count': 0
474
- # }
475
- ```
476
-
477
- ---
478
-
479
- ## ⚙️ 配置文件
480
-
481
- ### PIPELINE_CONFIG.json
482
-
483
- ```json
484
- {
485
- "version": "1.0.0",
486
- "settings": {
487
- "max_parallel_agents": 3,
488
- "task_timeout_minutes": 60,
489
- "lock_timeout_minutes": 60,
490
- "auto_cleanup_orphan_locks": true
491
- },
492
- "agent_types": {
493
- "frontend": { "max_concurrent": 2 },
494
- "backend": { "max_concurrent": 2 },
495
- "qa": { "max_concurrent": 1 }
496
- }
497
- }
498
- ```
499
-
500
- ---
501
-
502
- ## 🔗 相關文檔
503
-
504
- | 文檔 | 路徑 | 說明 |
505
- |------|------|------|
506
- | **快速開始** | `dev/pipeline/README.md` | 5 分鐘快速上手 |
507
- | **完整指南** | `dev/pipeline/WORKFLOW_GUIDE.md` | 20 分鐘深入教學 |
508
- | **Lead Agent 流程** | `CLAUDE.md` | 12 步開發流程 |
509
- | **Pipeline 規則** | `.rule/pipeline/task-execution.yaml` | PPL-101 至 PPL-112 |
510
- | **新任務系統** | `.system/collaboration/README.md` | Collaboration 系統文檔 |
511
-
512
- ---
513
-
514
- ## 🆚 新舊系統共存
515
-
516
- 目前專案**同時運行兩套系統**,查詢時需兩邊都查:
517
-
518
- | 系統 | 路徑 | ID 範圍 | 查詢方式 |
519
- |------|------|---------|---------|
520
- | **新系統** | `.collaboration/tasks/{status}/` | TASK_151~196 | `node .collaboration/core/task-api.js list` |
521
- | **舊系統** | `dev/pipeline/` | TASK_134~187 | `cat dev/pipeline/TASK_QUEUE.json` |
522
-
523
- **Migration 工具**:
524
- ```bash
525
- # 新系統 → 舊系統(JSON 匯出)
526
- node .collaboration/core/migrate-legacy.js export
527
-
528
- # 舊系統 → 新系統(YAML 匯入)
529
- node .collaboration/core/migrate-legacy.js import
530
- ```
531
-
532
- ---
533
-
534
- ## 📝 最佳實踐
535
-
536
- ### 1. 任務完成後的標準流程
537
-
538
- ```bash
539
- # 1. 更新 TASK_QUEUE.json(Python)
540
- python << EOF
541
- from dev.pipeline.orchestrator.task_queue import TaskQueue, TaskStatus
542
- queue = TaskQueue()
543
- queue.update_status("TASK_180", TaskStatus.COMPLETED)
544
- queue.save()
545
- EOF
546
-
547
- # 2. 移動任務文件到 completed/
548
- mv dev/pipeline/tasks/TASK_180_*.yaml dev/pipeline/completed/
549
-
550
- # 3. 更新 PROGRESS.md
551
- # (手動或透過 Agent 更新統計數據)
552
-
553
- # 4. 驗證一致性
554
- python dev/pipeline/orchestrator/task_queue.py dev/pipeline/TASK_QUEUE.json
555
- ```
556
-
557
- ### 2. 並行開發時的衝突避免
558
-
559
- ```python
560
- # 使用路徑鎖定防止衝突
561
- lock_manager = PathLockManager()
562
-
563
- # 分配 TASK_A(修改 src/api/)
564
- conflicts_A = lock_manager.get_conflicts(["src/api/"])
565
- if not conflicts_A:
566
- lock_manager.acquire(["src/api/"], "agent_1", "TASK_A")
567
-
568
- # 分配 TASK_B(修改 src/components/)
569
- conflicts_B = lock_manager.get_conflicts(["src/components/"])
570
- if not conflicts_B:
571
- lock_manager.acquire(["src/components/"], "agent_2", "TASK_B")
572
-
573
- # TASK_A 和 TASK_B 可以並行執行,無路徑衝突 ✅
574
- ```
575
-
576
- ### 3. 定期清理孤兒鎖定
577
-
578
- ```bash
579
- # 每 1 小時執行一次
580
- python << EOF
581
- from dev.pipeline.orchestrator.lock_manager import PathLockManager
582
- manager = PathLockManager()
583
- cleaned = manager.cleanup_orphan_locks(timeout_minutes=60)
584
- print(f"清理了 {cleaned} 個孤兒鎖定")
585
- EOF
586
- ```
587
-
588
- ---
589
-
590
- ## 🐛 常見問題
591
-
592
- ### Q1: TASK_QUEUE.json 格式錯誤
593
-
594
- **症狀**:JSON 解析失敗
595
-
596
- **解決方案**:
597
- ```bash
598
- # 驗證 JSON 語法
599
- node -e "JSON.parse(require('fs').readFileSync('dev/pipeline/TASK_QUEUE.json', 'utf8'))"
600
-
601
- # 自動修復(移除 BOM + 格式化)
602
- node .failure/tools/fix_json.js dev/pipeline/TASK_QUEUE.json
603
- ```
604
-
605
- ### Q2: 任務卡與 TASK_QUEUE.json 不同步
606
-
607
- **症狀**:YAML 文件與 JSON 索引狀態不一致
608
-
609
- **解決方案**:
610
- ```bash
611
- # 使用驗證腳本
612
- .\dev\scripts\validate_pipeline.ps1
613
-
614
- # 自動修復
615
- .\dev\scripts\fix_pipeline.ps1
616
- ```
617
-
618
- ### Q3: 路徑鎖定衝突
619
-
620
- **症狀**:無法取得路徑鎖定
621
-
622
- **檢查衝突**:
623
- ```python
624
- lock_manager = PathLockManager()
625
- conflicts = lock_manager.get_conflicts(["src/api/"])
626
- for c in conflicts:
627
- print(f"衝突路徑: {c['conflicting_path']}")
628
- print(f"持有者: {c['held_by_agent']} (TASK: {c['held_by_task']})")
629
- ```
630
-
631
- **強制釋放**(謹慎使用):
632
- ```python
633
- lock_manager.force_release("src/api/")
634
- ```
635
-
636
- ---
637
-
638
- ## 🔐 安全性注意事項
639
-
640
- ### 1. JSON 編碼問題
641
-
642
- - ⚠️ **BOM 問題**:Windows 編輯器可能產生 UTF-8 with BOM,導致 JSON 解析失敗
643
- - ✅ **解決方案**:使用 `.failure/tools/fix_json.js` 工具
644
-
645
- ### 2. 並行寫入
646
-
647
- - ⚠️ **Race Condition**:多 Agent 同時修改 TASK_QUEUE.json 會導致數據損壞
648
- - ✅ **解決方案**:透過路徑鎖定機制保護關鍵文件
649
-
650
- ### 3. 孤兒鎖定
651
-
652
- - ⚠️ **Agent Crash**:Agent 崩潰會留下孤兒鎖定,阻塞其他任務
653
- - ✅ **解決方案**:定期執行 `cleanup_orphan_locks()`
654
-
655
- ---
656
-
657
- ## 📈 未來規劃(遷移方向)
658
-
659
- ### ⚠️ Legacy System 淘汰計劃
660
-
661
- **目標**:全面遷移到 `.collaboration/` 新系統,淘汰此 Legacy System。
662
-
663
- **階段 1:雙軌制運行**(當前階段)
664
- - ✅ 兩套系統並存,保持相容
665
- - ✅ 新任務優先建立在 Collaboration 系統
666
- - ✅ Formation 系統已支援三層 fallback(新系統 → 舊 YAML → 舊 JSON)
667
- - ⚠️ 此 Legacy System 功能凍結,不再新增特性
668
-
669
- **階段 2:功能補齊**(計劃中)
670
- - [ ] 實現路徑鎖定機制(移植 `lock_manager.py` 到 Node.js)
671
- - [ ] 增強依賴解析(拓撲排序、循環檢測、關鍵路徑)
672
- - [ ] 建立驗證工具(`validate_collaboration.js`)
673
- - [ ] 統計查詢增強(依賴圖、執行時間預估)
674
-
675
- **階段 3:排程器遷移**(計劃中)
676
- - [ ] 更新 Single-Agent 排程器使用新系統
677
- - [ ] 更新 Multi-Agent 排程器使用新系統
678
- - [ ] 保留此 Legacy System 的 Python orchestrator 模組作為參考實現
679
-
680
- **階段 4:全面遷移 & Legacy System 封存**(計劃中)
681
- - [ ] 將 `dev/pipeline/TASK_QUEUE.json` 中的任務匯入新系統
682
- - [ ] 封存此 Legacy System 文件至 `.legacy/pipeline/`
683
- - [ ] 更新 CLAUDE.md、規則文檔移除 Legacy System 引用
684
- - [ ] 移除排程器對 TASK_QUEUE.json 的依賴
685
-
686
- ### 依賴項(阻礙遷移的功能)
687
-
688
- | 功能 | 依賴此 Legacy System | 新系統狀態 | 預計完成 |
689
- |------|---------------------|-----------|---------|
690
- | **路徑鎖定** | `lock_manager.py` | ❌ 未實現 | 階段 2 |
691
- | **依賴解析(進階)** | `dependency_resolver.py` | ⚠️ 基礎支援 | 階段 2 |
692
- | **Single-Agent 排程器** | `START_DEV_AGENT.bat` | ❌ 未遷移 | 階段 3 |
693
- | **Multi-Agent 排程器** | `START_MULTI_AGENT.bat` | ❌ 未遷移 | 階段 3 |
694
- | **Dashboard Scheduler** | Tauri API | ⚠️ 部分支援 | 階段 3 |
695
-
696
- ### 何時可以停用此 Legacy System?
697
-
698
- 當以下條件全部滿足時,可安全淘汰:
699
- 1. ✅ 新系統支援路徑鎖定機制(防止並行衝突)
700
- 2. ✅ 新系統支援進階依賴解析(拓撲排序、循環檢測)
701
- 3. ✅ 所有排程器已遷移到新系統
702
- 4. ✅ 無 `dev/pipeline/TASK_QUEUE.json` 的殘留依賴
703
-
704
- **預計時間**:2026 Q2 完成階段 2,2026 Q3 完成階段 3-4。
705
-
706
- ---
707
-
708
- **版本**: 1.0.0 (Legacy)
709
- **最後更新**: 2026-02-19
710
- **維護者**: Developer Team(凍結維護,僅 Bug 修復)
711
- **相關任務**: TASK_195(建立文檔), TASK_198(標記為 Legacy)
712
- **新系統文檔**: [`.system/collaboration/README.md`](../collaboration/README.md)