kenaz 0.3.18 → 0.3.20
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/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/launch.js +1 -6
- package/core/.formation/bifrost/launch.test.js +1 -1
- 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__/arms.test.js +41 -0
- package/core/.formation/tools/__tests__/diagnose-bug.test.js +10 -0
- package/core/.formation/tools/__tests__/m1-hmap-convid.test.js +1 -124
- package/core/.formation/tools/arms.js +48 -0
- package/core/.formation/tools/dispatch.js +24 -15
- package/core/.formation/tools/kenaz-stats.js +32 -8
- package/core/.formation/tools/kenaz-stats.test.js +15 -2
- package/core/.formation/tools/loader.js +17 -140
- package/core/.formation/tools/post-complete.js +0 -31
- package/core/.formation/tools/prompt.js +16 -1
- package/core/.formation/tools/prompt.test.js +20 -0
- 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/ansuz-boot-fast.js +7 -4
- package/core/.specialist/tools/ansuz-boot-fast.test.js +10 -3
- 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/peer-identity-e2e.js +402 -0
- package/core/dev/scripts/peer-identity-e2e.md +47 -0
- package/core/dev/scripts/relay-admin.js +94 -0
- package/core/dev/scripts/relay-admin.test.js +131 -0
- package/core/dev/scripts/run-rust-tests.js +9 -45
- 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/README.md +10 -0
- 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/hooks/kenaz-hook.js +2 -1
- package/core/plugins/kenaz/hooks/sdk-gate.js +9 -0
- package/core/plugins/kenaz/scripts/kenaz.test.js +15 -3
- package/core/plugins/kenaz/scripts/sync.js +1 -1
- package/core/plugins/kenaz/scripts/ygg.js +8 -0
- package/core/plugins/kenaz/scripts/ygg.test.js +72 -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/core/plugins/kenaz-peer/hooks/register.test.ts +32 -0
- package/core/plugins/kenaz-peer/hooks/register.ts +9 -0
- 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,804 +0,0 @@
|
|
|
1
|
-
# .collaboration 遷移指南
|
|
2
|
-
|
|
3
|
-
從舊的 `dev/pipeline/` 任務系統遷移到新的 `.collaboration` 系統的完整指南。
|
|
4
|
-
|
|
5
|
-
## 目錄
|
|
6
|
-
|
|
7
|
-
- [為什麼要遷移](#為什麼要遷移)
|
|
8
|
-
- [遷移前準備](#遷移前準備)
|
|
9
|
-
- [遷移步驟](#遷移步驟)
|
|
10
|
-
- [遷移工具](#遷移工具)
|
|
11
|
-
- [驗證遷移](#驗證遷移)
|
|
12
|
-
- [回滾計劃](#回滾計劃)
|
|
13
|
-
- [常見問題](#常見問題)
|
|
14
|
-
- [最佳實踐](#最佳實踐)
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## 為什麼要遷移
|
|
19
|
-
|
|
20
|
-
### 舊系統的限制
|
|
21
|
-
|
|
22
|
-
| 問題 | 舊系統 (dev/pipeline/) | 新系統 (.collaboration/) |
|
|
23
|
-
|------|----------------------|-------------------------|
|
|
24
|
-
| **Git 衝突** | 頻繁發生(單一 JSON 文件) | 幾乎無衝突(原子文件) |
|
|
25
|
-
| **多用戶協作** | 困難(鎖定機制不完善) | 順暢(樂觀鎖定 + 版本號) |
|
|
26
|
-
| **任務 ID** | 遞增數字(易衝突) | UUID(全局唯一) |
|
|
27
|
-
| **索引效率** | 需要載入整個文件 | JSONL 索引(快速查詢) |
|
|
28
|
-
| **擴展性** | 單一文件有大小限制 | 可無限擴展(扁平化存儲) |
|
|
29
|
-
| **可移植性** | 相對路徑依賴 | 完全可移植(Git 友好) |
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
### 新系統的優勢
|
|
34
|
-
|
|
35
|
-
- ✅ **原子文件結構** - 一個任務一個檔案,最小化 Git 衝突
|
|
36
|
-
- ✅ **UUID 任務 ID** - 全局唯一,可排序,支援分散式協作
|
|
37
|
-
- ✅ **JSONL 索引** - Append-only 格式,Git 自動合併友好
|
|
38
|
-
- ✅ **樂觀鎖定** - 版本號衝突偵測,無需中央伺服器
|
|
39
|
-
- ✅ **完整用戶追蹤** - 建立者、分配者、執行者、協作者
|
|
40
|
-
- ✅ **統一 API** - 相容舊系統,支援漸進式遷移
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## 遷移前準備
|
|
45
|
-
|
|
46
|
-
### 1. 備份舊系統資料
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
# 建立備份目錄
|
|
50
|
-
mkdir -p .migration/backup/$(date +%Y%m%d)
|
|
51
|
-
|
|
52
|
-
# 備份 TASK_QUEUE.json
|
|
53
|
-
cp dev/pipeline/TASK_QUEUE.json .migration/backup/$(date +%Y%m%d)/
|
|
54
|
-
|
|
55
|
-
# 備份已完成任務
|
|
56
|
-
cp dev/pipeline/completed/*.yaml .migration/backup/$(date +%Y%m%d)/ 2>/dev/null || true
|
|
57
|
-
|
|
58
|
-
# 備份記憶檔案
|
|
59
|
-
cp .memory/COMPLETED_TASKS.json .migration/backup/$(date +%Y%m%d)/ 2>/dev/null || true
|
|
60
|
-
|
|
61
|
-
echo "✅ 備份完成:.migration/backup/$(date +%Y%m%d)/"
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
### 2. 檢查 Git 狀態
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
# 確保工作區乾淨
|
|
70
|
-
git status
|
|
71
|
-
|
|
72
|
-
# 如果有未提交的變更,先提交
|
|
73
|
-
git add .
|
|
74
|
-
git commit -m "chore: 遷移前的檢查點"
|
|
75
|
-
git push origin main
|
|
76
|
-
|
|
77
|
-
# 建立遷移分支(建議)
|
|
78
|
-
git checkout -b migration/collaboration-system
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
### 3. 安裝必要工具
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
# 檢查 Node.js 版本(需要 >= 14)
|
|
87
|
-
node --version
|
|
88
|
-
|
|
89
|
-
# 測試 CLI 工具
|
|
90
|
-
node .collaboration/cli/task-cli.js --help
|
|
91
|
-
|
|
92
|
-
# 測試 API
|
|
93
|
-
node -e "
|
|
94
|
-
const { TaskAPI } = require('./.collaboration/core/task-api.js');
|
|
95
|
-
const api = new TaskAPI();
|
|
96
|
-
console.log('✅ API 載入成功');
|
|
97
|
-
"
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## 遷移步驟
|
|
103
|
-
|
|
104
|
-
### 步驟 1:分析現有任務
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
# 統計任務數量
|
|
108
|
-
echo "舊系統任務統計:"
|
|
109
|
-
node -e "
|
|
110
|
-
const fs = require('fs');
|
|
111
|
-
const data = JSON.parse(fs.readFileSync('dev/pipeline/TASK_QUEUE.json', 'utf8'));
|
|
112
|
-
console.log(\`總任務數: \${data.tasks.length}\`);
|
|
113
|
-
console.log(\`Pending: \${data.tasks.filter(t => t.status === 'pending').length}\`);
|
|
114
|
-
console.log(\`In Progress: \${data.tasks.filter(t => t.status === 'in_progress').length}\`);
|
|
115
|
-
console.log(\`Completed: \${data.tasks.filter(t => t.status === 'completed').length}\`);
|
|
116
|
-
"
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
### 步驟 2:遷移任務資料
|
|
122
|
-
|
|
123
|
-
**選項 A:使用自動遷移腳本(推薦)**
|
|
124
|
-
|
|
125
|
-
```javascript
|
|
126
|
-
// .collaboration/tools/migrate.js
|
|
127
|
-
const fs = require('fs').promises;
|
|
128
|
-
const path = require('path');
|
|
129
|
-
const { TaskAPI } = require('../core/task-api.js');
|
|
130
|
-
const { generateTaskID } = require('../core/id-generator.js');
|
|
131
|
-
|
|
132
|
-
async function migrateFromOldSystem() {
|
|
133
|
-
const api = new TaskAPI();
|
|
134
|
-
|
|
135
|
-
// 讀取舊系統任務
|
|
136
|
-
const oldQueue = JSON.parse(
|
|
137
|
-
await fs.readFile('dev/pipeline/TASK_QUEUE.json', 'utf8')
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
console.log(`開始遷移 ${oldQueue.tasks.length} 個任務...`);
|
|
141
|
-
|
|
142
|
-
const idMapping = {}; // 舊 ID → 新 ID 映射
|
|
143
|
-
|
|
144
|
-
for (const oldTask of oldQueue.tasks) {
|
|
145
|
-
// 生成新的 UUID
|
|
146
|
-
const newId = generateTaskID();
|
|
147
|
-
idMapping[oldTask.id] = newId;
|
|
148
|
-
|
|
149
|
-
// 轉換任務格式
|
|
150
|
-
const newTask = {
|
|
151
|
-
id: newId,
|
|
152
|
-
title: oldTask.title,
|
|
153
|
-
description: oldTask.description || oldTask.requirements?.join('\n') || '',
|
|
154
|
-
status: oldTask.status,
|
|
155
|
-
priority: oldTask.priority,
|
|
156
|
-
estimated_hours: oldTask.estimated_hours,
|
|
157
|
-
acceptance_criteria: oldTask.acceptance_criteria || [],
|
|
158
|
-
scope: oldTask.scope_paths || [],
|
|
159
|
-
dependencies: oldTask.dependencies || [], // 稍後更新為新 ID
|
|
160
|
-
created_by: {
|
|
161
|
-
name: oldTask.created_by || 'System',
|
|
162
|
-
git_user: 'system',
|
|
163
|
-
timestamp: oldTask.created_at || new Date().toISOString()
|
|
164
|
-
},
|
|
165
|
-
assigned_to: oldTask.assigned_to ? {
|
|
166
|
-
name: oldTask.assigned_to,
|
|
167
|
-
git_user: oldTask.assigned_to.toLowerCase(),
|
|
168
|
-
timestamp: new Date().toISOString()
|
|
169
|
-
} : null,
|
|
170
|
-
last_modified_by: {
|
|
171
|
-
name: 'Migration Script',
|
|
172
|
-
git_user: 'system',
|
|
173
|
-
timestamp: new Date().toISOString()
|
|
174
|
-
},
|
|
175
|
-
collaborators: [],
|
|
176
|
-
executed_by: oldTask.status === 'completed' ? {
|
|
177
|
-
name: oldTask.executed_by || 'Unknown',
|
|
178
|
-
git_user: 'unknown',
|
|
179
|
-
timestamp: oldTask.completed_at || new Date().toISOString()
|
|
180
|
-
} : null,
|
|
181
|
-
_version: 1,
|
|
182
|
-
_migration: {
|
|
183
|
-
old_id: oldTask.id,
|
|
184
|
-
migrated_at: new Date().toISOString(),
|
|
185
|
-
source: 'dev/pipeline/TASK_QUEUE.json'
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
// 寫入新系統
|
|
190
|
-
const userDir = path.join('.collaboration/tasks/db/all');
|
|
191
|
-
await fs.mkdir(userDir, { recursive: true });
|
|
192
|
-
|
|
193
|
-
const taskPath = path.join(userDir, `${newId}.json`);
|
|
194
|
-
await fs.writeFile(taskPath, JSON.stringify(newTask, null, 2));
|
|
195
|
-
|
|
196
|
-
console.log(`✅ 遷移: ${oldTask.id} → ${newId}`);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// 更新依賴關係(使用新 ID)
|
|
200
|
-
console.log('\n更新依賴關係...');
|
|
201
|
-
for (const [oldId, newId] of Object.entries(idMapping)) {
|
|
202
|
-
const taskPath = path.join('.collaboration/tasks/db/all', `${newId}.json`);
|
|
203
|
-
const task = JSON.parse(await fs.readFile(taskPath, 'utf8'));
|
|
204
|
-
|
|
205
|
-
if (task.dependencies && task.dependencies.length > 0) {
|
|
206
|
-
task.dependencies = task.dependencies.map(depId => idMapping[depId] || depId);
|
|
207
|
-
await fs.writeFile(taskPath, JSON.stringify(task, null, 2));
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// 儲存 ID 映射表
|
|
212
|
-
await fs.writeFile(
|
|
213
|
-
'.migration/id_mapping.json',
|
|
214
|
-
JSON.stringify(idMapping, null, 2)
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
console.log(`\n✅ 遷移完成!`);
|
|
218
|
-
console.log(`ID 映射表已儲存: .migration/id_mapping.json`);
|
|
219
|
-
|
|
220
|
-
return idMapping;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// 執行遷移
|
|
224
|
-
migrateFromOldSystem().catch(console.error);
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
**執行遷移**:
|
|
228
|
-
```bash
|
|
229
|
-
# 執行遷移腳本
|
|
230
|
-
node .collaboration/tools/migrate.js
|
|
231
|
-
|
|
232
|
-
# 輸出範例:
|
|
233
|
-
# 開始遷移 10 個任務...
|
|
234
|
-
# ✅ 遷移: TASK_147 → TASK_5KPEES80F922
|
|
235
|
-
# ✅ 遷移: TASK_148 → TASK_5KPEES80HT6S
|
|
236
|
-
# ...
|
|
237
|
-
# ✅ 遷移完成!
|
|
238
|
-
# ID 映射表已儲存: .migration/id_mapping.json
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
**選項 B:手動遷移(小規模)**
|
|
244
|
-
|
|
245
|
-
如果只有少量任務(< 10 個),可以手動遷移:
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
# 1. 為每個舊任務建立新任務
|
|
249
|
-
node .collaboration/cli/task-cli.js create \
|
|
250
|
-
--title "實作登入功能" \
|
|
251
|
-
--description "從 TASK_147 遷移" \
|
|
252
|
-
--priority P1
|
|
253
|
-
|
|
254
|
-
# 2. 記錄 ID 映射
|
|
255
|
-
echo "TASK_147 → TASK_5KPEES80F922" >> .migration/manual_mapping.txt
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
### 步驟 3:重建索引
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
# 重建所有索引
|
|
264
|
-
node .collaboration/cli/task-cli.js rebuild
|
|
265
|
-
|
|
266
|
-
# 輸出範例:
|
|
267
|
-
# 重建索引中...
|
|
268
|
-
# ✅ 索引重建完成
|
|
269
|
-
# 總任務數: 10
|
|
270
|
-
# 狀態分類: 4
|
|
271
|
-
# 用戶分類: 3
|
|
272
|
-
# 優先級分類: 3
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
### 步驟 4:驗證遷移結果
|
|
278
|
-
|
|
279
|
-
```bash
|
|
280
|
-
# 比較任務數量
|
|
281
|
-
echo "舊系統:"
|
|
282
|
-
node -e "
|
|
283
|
-
const fs = require('fs');
|
|
284
|
-
const data = JSON.parse(fs.readFileSync('dev/pipeline/TASK_QUEUE.json', 'utf8'));
|
|
285
|
-
console.log(\`總任務數: \${data.tasks.length}\`);
|
|
286
|
-
"
|
|
287
|
-
|
|
288
|
-
echo ""
|
|
289
|
-
echo "新系統:"
|
|
290
|
-
node -e "
|
|
291
|
-
const { TaskAPI } = require('./.collaboration/core/task-api.js');
|
|
292
|
-
const api = new TaskAPI();
|
|
293
|
-
(async () => {
|
|
294
|
-
const data = await api.getAllTasks();
|
|
295
|
-
console.log(\`總任務數: \${data.statistics.total}\`);
|
|
296
|
-
console.log(\`Pending: \${data.statistics.pending}\`);
|
|
297
|
-
console.log(\`In Progress: \${data.statistics.in_progress}\`);
|
|
298
|
-
console.log(\`Completed: \${data.statistics.completed}\`);
|
|
299
|
-
})();
|
|
300
|
-
"
|
|
301
|
-
|
|
302
|
-
# 檢查每個任務
|
|
303
|
-
node .collaboration/cli/task-cli.js list
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
---
|
|
307
|
-
|
|
308
|
-
### 步驟 5:提交遷移
|
|
309
|
-
|
|
310
|
-
```bash
|
|
311
|
-
# 加入所有新任務
|
|
312
|
-
git add .collaboration/tasks/
|
|
313
|
-
|
|
314
|
-
# 加入 ID 映射表
|
|
315
|
-
git add .migration/
|
|
316
|
-
|
|
317
|
-
# 提交
|
|
318
|
-
git commit -m "feat: 遷移任務系統從 dev/pipeline 到 .collaboration
|
|
319
|
-
|
|
320
|
-
- 遷移 10 個任務
|
|
321
|
-
- 重建所有索引
|
|
322
|
-
- 保留 ID 映射表供回滾使用
|
|
323
|
-
|
|
324
|
-
BREAKING CHANGE: 任務 ID 格式從 TASK_XXX 改為 TASK_XXXXXXXXXXXX
|
|
325
|
-
"
|
|
326
|
-
|
|
327
|
-
# 推送
|
|
328
|
-
git push origin migration/collaboration-system
|
|
329
|
-
|
|
330
|
-
# 建立 PR(可選)
|
|
331
|
-
gh pr create \
|
|
332
|
-
--title "feat: 遷移到 .collaboration 任務系統" \
|
|
333
|
-
--body "完整遷移舊系統任務到新系統,詳見提交訊息"
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
---
|
|
337
|
-
|
|
338
|
-
### 步驟 6:更新團隊工具
|
|
339
|
-
|
|
340
|
-
更新 Dashboard 和其他工具以使用新系統:
|
|
341
|
-
|
|
342
|
-
```javascript
|
|
343
|
-
// 在 Dashboard 中使用統一 API
|
|
344
|
-
const { TaskAPI } = require('./.collaboration/core/task-api.js');
|
|
345
|
-
const api = new TaskAPI();
|
|
346
|
-
|
|
347
|
-
// 取得所有任務(自動合併新舊系統)
|
|
348
|
-
const allData = await api.getAllTasks();
|
|
349
|
-
|
|
350
|
-
// Dashboard 會自動顯示來源標記
|
|
351
|
-
// 🆕 - 新系統任務
|
|
352
|
-
// 📦 - 舊系統任務(如果還有)
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
---
|
|
356
|
-
|
|
357
|
-
### 步驟 7:封存舊系統(可選)
|
|
358
|
-
|
|
359
|
-
等待團隊適應新系統後(建議 2 週),封存舊系統:
|
|
360
|
-
|
|
361
|
-
```bash
|
|
362
|
-
# 移動舊系統到封存目錄
|
|
363
|
-
mkdir -p .archive/old-pipeline/$(date +%Y%m%d)
|
|
364
|
-
mv dev/pipeline/TASK_QUEUE.json .archive/old-pipeline/$(date +%Y%m%d)/
|
|
365
|
-
|
|
366
|
-
# 提交
|
|
367
|
-
git add .
|
|
368
|
-
git commit -m "chore: 封存舊任務系統"
|
|
369
|
-
git push
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
---
|
|
373
|
-
|
|
374
|
-
## 遷移工具
|
|
375
|
-
|
|
376
|
-
### ID 映射表查詢工具
|
|
377
|
-
|
|
378
|
-
```javascript
|
|
379
|
-
// .collaboration/tools/lookup-old-id.js
|
|
380
|
-
const fs = require('fs');
|
|
381
|
-
|
|
382
|
-
const mapping = JSON.parse(fs.readFileSync('.migration/id_mapping.json', 'utf8'));
|
|
383
|
-
const oldId = process.argv[2];
|
|
384
|
-
|
|
385
|
-
if (mapping[oldId]) {
|
|
386
|
-
console.log(`${oldId} → ${mapping[oldId]}`);
|
|
387
|
-
} else {
|
|
388
|
-
console.log(`❌ 未找到對應的新 ID`);
|
|
389
|
-
}
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
**使用**:
|
|
393
|
-
```bash
|
|
394
|
-
node .collaboration/tools/lookup-old-id.js TASK_147
|
|
395
|
-
# 輸出: TASK_147 → TASK_5KPEES80F922
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
---
|
|
399
|
-
|
|
400
|
-
### 依賴關係檢查工具
|
|
401
|
-
|
|
402
|
-
```javascript
|
|
403
|
-
// .collaboration/tools/check-dependencies.js
|
|
404
|
-
const { TaskAPI } = require('../core/task-api.js');
|
|
405
|
-
|
|
406
|
-
(async () => {
|
|
407
|
-
const api = new TaskAPI();
|
|
408
|
-
const allData = await api.getAllTasks();
|
|
409
|
-
|
|
410
|
-
console.log('檢查依賴關係...\n');
|
|
411
|
-
|
|
412
|
-
for (const task of allData.tasks) {
|
|
413
|
-
if (task.dependencies && task.dependencies.length > 0) {
|
|
414
|
-
for (const depId of task.dependencies) {
|
|
415
|
-
const depTask = await api.getTask(depId);
|
|
416
|
-
if (!depTask) {
|
|
417
|
-
console.log(`❌ ${task.id}: 依賴任務不存在 ${depId}`);
|
|
418
|
-
} else {
|
|
419
|
-
console.log(`✅ ${task.id} → ${depId} (${depTask.status})`);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
})();
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
---
|
|
428
|
-
|
|
429
|
-
## 驗證遷移
|
|
430
|
-
|
|
431
|
-
### 驗證清單
|
|
432
|
-
|
|
433
|
-
- [ ] 任務數量一致
|
|
434
|
-
- [ ] 所有狀態正確遷移
|
|
435
|
-
- [ ] 優先級正確
|
|
436
|
-
- [ ] 依賴關係完整
|
|
437
|
-
- [ ] 索引正常工作
|
|
438
|
-
- [ ] CLI 命令正常
|
|
439
|
-
- [ ] Dashboard 正常顯示
|
|
440
|
-
- [ ] Git 提交乾淨無衝突
|
|
441
|
-
|
|
442
|
-
### 自動驗證腳本
|
|
443
|
-
|
|
444
|
-
```bash
|
|
445
|
-
# .collaboration/tools/validate-migration.sh
|
|
446
|
-
#!/bin/bash
|
|
447
|
-
|
|
448
|
-
echo "🔍 驗證遷移結果..."
|
|
449
|
-
echo ""
|
|
450
|
-
|
|
451
|
-
# 1. 檢查任務數量
|
|
452
|
-
echo "1️⃣ 檢查任務數量..."
|
|
453
|
-
OLD_COUNT=$(node -e "console.log(JSON.parse(require('fs').readFileSync('dev/pipeline/TASK_QUEUE.json', 'utf8')).tasks.length)")
|
|
454
|
-
NEW_COUNT=$(ls .collaboration/tasks/db/all/*.json 2>/dev/null | wc -l)
|
|
455
|
-
|
|
456
|
-
if [ "$OLD_COUNT" -eq "$NEW_COUNT" ]; then
|
|
457
|
-
echo "✅ 任務數量一致: $NEW_COUNT 個"
|
|
458
|
-
else
|
|
459
|
-
echo "❌ 任務數量不一致: 舊 $OLD_COUNT vs 新 $NEW_COUNT"
|
|
460
|
-
exit 1
|
|
461
|
-
fi
|
|
462
|
-
|
|
463
|
-
# 2. 檢查索引
|
|
464
|
-
echo ""
|
|
465
|
-
echo "2️⃣ 檢查索引..."
|
|
466
|
-
if [ -d ".collaboration/tasks/index/" ]; then
|
|
467
|
-
echo "✅ 索引目錄存在"
|
|
468
|
-
else
|
|
469
|
-
echo "❌ 索引目錄不存在"
|
|
470
|
-
exit 1
|
|
471
|
-
fi
|
|
472
|
-
|
|
473
|
-
# 3. 測試 CLI
|
|
474
|
-
echo ""
|
|
475
|
-
echo "3️⃣ 測試 CLI..."
|
|
476
|
-
if node .collaboration/cli/task-cli.js list > /dev/null 2>&1; then
|
|
477
|
-
echo "✅ CLI 正常工作"
|
|
478
|
-
else
|
|
479
|
-
echo "❌ CLI 執行失敗"
|
|
480
|
-
exit 1
|
|
481
|
-
fi
|
|
482
|
-
|
|
483
|
-
# 4. 測試 API
|
|
484
|
-
echo ""
|
|
485
|
-
echo "4️⃣ 測試 API..."
|
|
486
|
-
if node -e "
|
|
487
|
-
const { TaskAPI } = require('./.collaboration/core/task-api.js');
|
|
488
|
-
const api = new TaskAPI();
|
|
489
|
-
(async () => {
|
|
490
|
-
await api.getAllTasks();
|
|
491
|
-
console.log('✅ API 正常工作');
|
|
492
|
-
})().catch(e => { console.error('❌ API 執行失敗'); process.exit(1); });
|
|
493
|
-
"; then
|
|
494
|
-
:
|
|
495
|
-
else
|
|
496
|
-
exit 1
|
|
497
|
-
fi
|
|
498
|
-
|
|
499
|
-
echo ""
|
|
500
|
-
echo "🎉 驗證通過!"
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
**執行驗證**:
|
|
504
|
-
```bash
|
|
505
|
-
bash .collaboration/tools/validate-migration.sh
|
|
506
|
-
```
|
|
507
|
-
|
|
508
|
-
---
|
|
509
|
-
|
|
510
|
-
## 回滾計劃
|
|
511
|
-
|
|
512
|
-
### 完全回滾(恢復到舊系統)
|
|
513
|
-
|
|
514
|
-
```bash
|
|
515
|
-
# 1. 切換到遷移前的提交
|
|
516
|
-
git log --oneline | grep "遷移前的檢查點"
|
|
517
|
-
git revert <commit-hash>
|
|
518
|
-
|
|
519
|
-
# 2. 恢復備份
|
|
520
|
-
cp .migration/backup/20260211/TASK_QUEUE.json dev/pipeline/
|
|
521
|
-
|
|
522
|
-
# 3. 刪除新系統(可選)
|
|
523
|
-
rm -rf .collaboration/tasks/db/all/*.json
|
|
524
|
-
|
|
525
|
-
# 4. 提交
|
|
526
|
-
git add .
|
|
527
|
-
git commit -m "revert: 回滾到舊任務系統"
|
|
528
|
-
git push
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
---
|
|
532
|
-
|
|
533
|
-
### 部分回滾(保留新任務,恢復舊 ID)
|
|
534
|
-
|
|
535
|
-
如果需要保留新系統但恢復舊 ID 格式:
|
|
536
|
-
|
|
537
|
-
```javascript
|
|
538
|
-
// .collaboration/tools/rollback-ids.js
|
|
539
|
-
const fs = require('fs').promises;
|
|
540
|
-
const path = require('path');
|
|
541
|
-
|
|
542
|
-
async function rollbackIds() {
|
|
543
|
-
const mapping = JSON.parse(
|
|
544
|
-
await fs.readFile('.migration/id_mapping.json', 'utf8')
|
|
545
|
-
);
|
|
546
|
-
|
|
547
|
-
// 反轉映射
|
|
548
|
-
const reverseMapping = {};
|
|
549
|
-
for (const [oldId, newId] of Object.entries(mapping)) {
|
|
550
|
-
reverseMapping[newId] = oldId;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
// 遍歷所有任務
|
|
554
|
-
const tasksDir = '.collaboration/tasks/db/all';
|
|
555
|
-
const files = await fs.readdir(tasksDir);
|
|
556
|
-
|
|
557
|
-
for (const file of files) {
|
|
558
|
-
if (!file.endsWith('.json')) continue;
|
|
559
|
-
|
|
560
|
-
const taskPath = path.join(tasksDir, file);
|
|
561
|
-
const task = JSON.parse(await fs.readFile(taskPath, 'utf8'));
|
|
562
|
-
|
|
563
|
-
const newId = path.basename(file, '.json');
|
|
564
|
-
const oldId = reverseMapping[newId];
|
|
565
|
-
|
|
566
|
-
if (oldId) {
|
|
567
|
-
task.id = oldId;
|
|
568
|
-
|
|
569
|
-
// 更新依賴
|
|
570
|
-
if (task.dependencies) {
|
|
571
|
-
task.dependencies = task.dependencies.map(d => reverseMapping[d] || d);
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
// 重新命名文件
|
|
575
|
-
const newPath = path.join(tasksDir, `${oldId}.json`);
|
|
576
|
-
await fs.writeFile(newPath, JSON.stringify(task, null, 2));
|
|
577
|
-
await fs.unlink(taskPath);
|
|
578
|
-
|
|
579
|
-
console.log(`✅ 回滾: ${newId} → ${oldId}`);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
console.log('回滾完成!');
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
rollbackIds().catch(console.error);
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
---
|
|
590
|
-
|
|
591
|
-
## 常見問題
|
|
592
|
-
|
|
593
|
-
### Q1: 遷移需要多久?
|
|
594
|
-
|
|
595
|
-
**A**: 取決於任務數量:
|
|
596
|
-
- < 10 個任務:5-10 分鐘(手動)
|
|
597
|
-
- 10-50 個任務:15-30 分鐘(自動腳本)
|
|
598
|
-
- > 50 個任務:30-60 分鐘(自動腳本 + 驗證)
|
|
599
|
-
|
|
600
|
-
---
|
|
601
|
-
|
|
602
|
-
### Q2: 是否可以漸進式遷移?
|
|
603
|
-
|
|
604
|
-
**A**: 可以!新系統支援與舊系統並存:
|
|
605
|
-
|
|
606
|
-
```javascript
|
|
607
|
-
// 統一 API 自動合併兩個系統
|
|
608
|
-
const { TaskAPI } = require('./.collaboration/core/task-api.js');
|
|
609
|
-
const api = new TaskAPI();
|
|
610
|
-
|
|
611
|
-
const allData = await api.getAllTasks();
|
|
612
|
-
// 包含舊系統(TASK_QUEUE.json)和新系統(.collaboration/tasks/db/)的任務
|
|
613
|
-
```
|
|
614
|
-
|
|
615
|
-
**建議策略**:
|
|
616
|
-
1. 新任務使用新系統建立
|
|
617
|
-
2. 舊任務保持不動
|
|
618
|
-
3. 當舊任務完成時,自動封存
|
|
619
|
-
4. 3 個月後全部遷移到新系統
|
|
620
|
-
|
|
621
|
-
---
|
|
622
|
-
|
|
623
|
-
### Q3: 如何處理進行中的任務?
|
|
624
|
-
|
|
625
|
-
**A**: 遷移時保留狀態:
|
|
626
|
-
|
|
627
|
-
```javascript
|
|
628
|
-
// 遷移腳本會保留所有欄位
|
|
629
|
-
const newTask = {
|
|
630
|
-
...oldTask,
|
|
631
|
-
status: oldTask.status, // 保留 in_progress
|
|
632
|
-
assigned_to: { ... }, // 保留分配資訊
|
|
633
|
-
_version: 1
|
|
634
|
-
};
|
|
635
|
-
```
|
|
636
|
-
|
|
637
|
-
建議在非工作時間(週末)遷移,減少影響。
|
|
638
|
-
|
|
639
|
-
---
|
|
640
|
-
|
|
641
|
-
### Q4: 依賴關係如何處理?
|
|
642
|
-
|
|
643
|
-
**A**: 自動更新為新 ID:
|
|
644
|
-
|
|
645
|
-
```javascript
|
|
646
|
-
// 遷移腳本會自動處理
|
|
647
|
-
task.dependencies = task.dependencies.map(oldDepId => {
|
|
648
|
-
return idMapping[oldDepId] || oldDepId;
|
|
649
|
-
});
|
|
650
|
-
```
|
|
651
|
-
|
|
652
|
-
如果發現依賴錯誤,使用檢查工具:
|
|
653
|
-
```bash
|
|
654
|
-
node .collaboration/tools/check-dependencies.js
|
|
655
|
-
```
|
|
656
|
-
|
|
657
|
-
---
|
|
658
|
-
|
|
659
|
-
### Q5: 遷移後如何查找舊 ID?
|
|
660
|
-
|
|
661
|
-
**A**: 使用 ID 映射表:
|
|
662
|
-
|
|
663
|
-
```bash
|
|
664
|
-
# 查詢工具
|
|
665
|
-
node .collaboration/tools/lookup-old-id.js TASK_147
|
|
666
|
-
|
|
667
|
-
# 或直接查看映射表
|
|
668
|
-
cat .migration/id_mapping.json | grep "TASK_147"
|
|
669
|
-
```
|
|
670
|
-
|
|
671
|
-
映射表範例:
|
|
672
|
-
```json
|
|
673
|
-
{
|
|
674
|
-
"TASK_147": "TASK_5KPEES80F922",
|
|
675
|
-
"TASK_148": "TASK_5KPEES80HT6S",
|
|
676
|
-
...
|
|
677
|
-
}
|
|
678
|
-
```
|
|
679
|
-
|
|
680
|
-
---
|
|
681
|
-
|
|
682
|
-
## 最佳實踐
|
|
683
|
-
|
|
684
|
-
### 1. 在遷移分支上進行
|
|
685
|
-
|
|
686
|
-
```bash
|
|
687
|
-
# 建立遷移分支
|
|
688
|
-
git checkout -b migration/collaboration-system
|
|
689
|
-
|
|
690
|
-
# 遷移完成後合併
|
|
691
|
-
git checkout main
|
|
692
|
-
git merge migration/collaboration-system
|
|
693
|
-
```
|
|
694
|
-
|
|
695
|
-
---
|
|
696
|
-
|
|
697
|
-
### 2. 分階段驗證
|
|
698
|
-
|
|
699
|
-
```bash
|
|
700
|
-
# 階段 1:遷移 10%
|
|
701
|
-
node .collaboration/tools/migrate.js --limit 10
|
|
702
|
-
|
|
703
|
-
# 驗證
|
|
704
|
-
bash .collaboration/tools/validate-migration.sh
|
|
705
|
-
|
|
706
|
-
# 階段 2:遷移全部
|
|
707
|
-
node .collaboration/tools/migrate.js
|
|
708
|
-
```
|
|
709
|
-
|
|
710
|
-
---
|
|
711
|
-
|
|
712
|
-
### 3. 保留備份至少 3 個月
|
|
713
|
-
|
|
714
|
-
```bash
|
|
715
|
-
# 備份目錄結構
|
|
716
|
-
.migration/
|
|
717
|
-
├── backup/
|
|
718
|
-
│ ├── 20260211/ # 第一次備份
|
|
719
|
-
│ ├── 20260312/ # 第二次備份
|
|
720
|
-
│ └── 20260411/ # 第三次備份
|
|
721
|
-
└── id_mapping.json # ID 映射表
|
|
722
|
-
```
|
|
723
|
-
|
|
724
|
-
---
|
|
725
|
-
|
|
726
|
-
### 4. 通知團隊成員
|
|
727
|
-
|
|
728
|
-
**遷移前通知**(提前 3 天):
|
|
729
|
-
```
|
|
730
|
-
📢 任務系統遷移通知
|
|
731
|
-
|
|
732
|
-
我們將在 2026-02-14(週六)進行任務系統遷移。
|
|
733
|
-
|
|
734
|
-
變更:
|
|
735
|
-
- 任務 ID 格式:TASK_147 → TASK_5KPEES80F922
|
|
736
|
-
- 新增 CLI 工具:task-cli.js
|
|
737
|
-
- Git 衝突大幅減少
|
|
738
|
-
|
|
739
|
-
準備:
|
|
740
|
-
- 請在 2/13 前完成所有進行中的任務
|
|
741
|
-
- 2/14 當天不要建立新任務
|
|
742
|
-
- 遷移後查看 ID 映射表:.migration/id_mapping.json
|
|
743
|
-
```
|
|
744
|
-
|
|
745
|
-
**遷移後通知**:
|
|
746
|
-
```
|
|
747
|
-
✅ 任務系統遷移完成
|
|
748
|
-
|
|
749
|
-
新功能:
|
|
750
|
-
- 使用 `task list` 查看任務
|
|
751
|
-
- 使用 `task claim TASK_XXX` 認領任務
|
|
752
|
-
- 詳見文檔:.collaboration/docs/CLI.md
|
|
753
|
-
|
|
754
|
-
如有問題請聯繫 IT 支援。
|
|
755
|
-
```
|
|
756
|
-
|
|
757
|
-
---
|
|
758
|
-
|
|
759
|
-
### 5. 建立遷移日誌
|
|
760
|
-
|
|
761
|
-
```markdown
|
|
762
|
-
# 遷移日誌
|
|
763
|
-
|
|
764
|
-
## 2026-02-11 14:00 - 開始遷移
|
|
765
|
-
- 建立備份
|
|
766
|
-
- 建立遷移分支
|
|
767
|
-
|
|
768
|
-
## 2026-02-11 14:30 - 執行遷移腳本
|
|
769
|
-
- 遷移 10 個任務
|
|
770
|
-
- 生成 ID 映射表
|
|
771
|
-
|
|
772
|
-
## 2026-02-11 15:00 - 驗證
|
|
773
|
-
- ✅ 任務數量一致
|
|
774
|
-
- ✅ 依賴關係正確
|
|
775
|
-
- ✅ CLI 測試通過
|
|
776
|
-
|
|
777
|
-
## 2026-02-11 15:30 - 提交
|
|
778
|
-
- 提交到遷移分支
|
|
779
|
-
- 建立 PR
|
|
780
|
-
|
|
781
|
-
## 2026-02-12 10:00 - 合併到 main
|
|
782
|
-
- PR 審查通過
|
|
783
|
-
- 合併到 main
|
|
784
|
-
- 通知團隊
|
|
785
|
-
|
|
786
|
-
## 2026-02-15 - 封存舊系統
|
|
787
|
-
- 無重大問題
|
|
788
|
-
- 封存 TASK_QUEUE.json
|
|
789
|
-
```
|
|
790
|
-
|
|
791
|
-
---
|
|
792
|
-
|
|
793
|
-
## 相關文檔
|
|
794
|
-
|
|
795
|
-
- [API 參考文檔](./API.md) - JavaScript API 完整文檔
|
|
796
|
-
- [CLI 使用指南](./CLI.md) - 命令列工具文檔
|
|
797
|
-
- [常見問題](./FAQ.md) - 疑難排解指南
|
|
798
|
-
- [架構設計](./ARCHITECTURE.md) - 系統架構詳細說明
|
|
799
|
-
|
|
800
|
-
---
|
|
801
|
-
|
|
802
|
-
**版本**: 1.0.0
|
|
803
|
-
**最後更新**: 2026-02-11
|
|
804
|
-
**維護者**: Developer Team
|