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,184 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* basic-usage.js
|
|
4
|
-
* .collaboration 系統基本使用範例
|
|
5
|
-
*
|
|
6
|
-
* 執行方式:
|
|
7
|
-
* node .collaboration/docs/examples/basic-usage.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const { TaskAPI } = require('../../core/task-api.js');
|
|
11
|
-
const { LockManager } = require('../../core/lock-manager.js');
|
|
12
|
-
const { generateTaskID, validateTaskID } = require('../../core/id-generator.js');
|
|
13
|
-
|
|
14
|
-
async function main() {
|
|
15
|
-
console.log('='.repeat(60));
|
|
16
|
-
console.log('📚 .collaboration 基本使用範例');
|
|
17
|
-
console.log('='.repeat(60));
|
|
18
|
-
|
|
19
|
-
const api = new TaskAPI();
|
|
20
|
-
|
|
21
|
-
// ============================================================================
|
|
22
|
-
// 1. 建立任務
|
|
23
|
-
// ============================================================================
|
|
24
|
-
|
|
25
|
-
console.log('\n1️⃣ 建立任務');
|
|
26
|
-
console.log('-'.repeat(60));
|
|
27
|
-
|
|
28
|
-
const task1 = await api.createTask({
|
|
29
|
-
title: '實作登入功能',
|
|
30
|
-
description: '建立登入頁面和認證 API',
|
|
31
|
-
priority: 'P1'
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
console.log(`✅ 任務已建立: ${task1.id}`);
|
|
35
|
-
console.log(` 標題: ${task1.title}`);
|
|
36
|
-
console.log(` 優先級: ${task1.priority}`);
|
|
37
|
-
console.log(` 狀態: ${task1.status}`);
|
|
38
|
-
console.log(` 建立者: ${task1.created_by.name}`);
|
|
39
|
-
|
|
40
|
-
// ============================================================================
|
|
41
|
-
// 2. 查詢任務
|
|
42
|
-
// ============================================================================
|
|
43
|
-
|
|
44
|
-
console.log('\n2️⃣ 查詢任務');
|
|
45
|
-
console.log('-'.repeat(60));
|
|
46
|
-
|
|
47
|
-
// 取得所有任務
|
|
48
|
-
const allData = await api.getAllTasks();
|
|
49
|
-
console.log(`✅ 總任務數: ${allData.statistics.total}`);
|
|
50
|
-
console.log(` Pending: ${allData.statistics.pending}`);
|
|
51
|
-
console.log(` In Progress: ${allData.statistics.in_progress}`);
|
|
52
|
-
console.log(` Completed: ${allData.statistics.completed}`);
|
|
53
|
-
|
|
54
|
-
// 查詢特定任務
|
|
55
|
-
const task = await api.getTask(task1.id);
|
|
56
|
-
console.log(`\n✅ 任務詳情: ${task.id}`);
|
|
57
|
-
console.log(` 狀態: ${task.status}`);
|
|
58
|
-
console.log(` 版本: ${task._version}`);
|
|
59
|
-
|
|
60
|
-
// ============================================================================
|
|
61
|
-
// 3. 認領任務
|
|
62
|
-
// ============================================================================
|
|
63
|
-
|
|
64
|
-
console.log('\n3️⃣ 認領任務');
|
|
65
|
-
console.log('-'.repeat(60));
|
|
66
|
-
|
|
67
|
-
const claimed = await api.claimTask(task1.id);
|
|
68
|
-
console.log(`✅ 任務已認領: ${claimed.id}`);
|
|
69
|
-
console.log(` 分配給: ${claimed.assigned_to.name}`);
|
|
70
|
-
console.log(` 狀態: ${claimed.status}`);
|
|
71
|
-
|
|
72
|
-
// ============================================================================
|
|
73
|
-
// 4. 更新任務
|
|
74
|
-
// ============================================================================
|
|
75
|
-
|
|
76
|
-
console.log('\n4️⃣ 更新任務');
|
|
77
|
-
console.log('-'.repeat(60));
|
|
78
|
-
|
|
79
|
-
const updated = await api.updateTask(task1.id, {
|
|
80
|
-
description: '登入頁面已完成,正在開發認證 API'
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
console.log(`✅ 任務已更新: ${updated.id}`);
|
|
84
|
-
console.log(` 新描述: ${updated.description}`);
|
|
85
|
-
console.log(` 版本: ${updated._version}`);
|
|
86
|
-
|
|
87
|
-
// ============================================================================
|
|
88
|
-
// 5. 鎖定任務
|
|
89
|
-
// ============================================================================
|
|
90
|
-
|
|
91
|
-
console.log('\n5️⃣ 鎖定任務');
|
|
92
|
-
console.log('-'.repeat(60));
|
|
93
|
-
|
|
94
|
-
const lockMgr = new LockManager();
|
|
95
|
-
const gitUser = 'example_user';
|
|
96
|
-
|
|
97
|
-
try {
|
|
98
|
-
const lock = await lockMgr.acquireLock(task1.id, gitUser, 60);
|
|
99
|
-
console.log(`✅ 任務已鎖定: ${lock.task_id}`);
|
|
100
|
-
console.log(` 鎖定者: ${lock.locked_by}`);
|
|
101
|
-
console.log(` 過期時間: ${lock.expires_at}`);
|
|
102
|
-
} catch (error) {
|
|
103
|
-
console.error(`❌ 鎖定失敗: ${error.message}`);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// ============================================================================
|
|
107
|
-
// 6. 完成任務
|
|
108
|
-
// ============================================================================
|
|
109
|
-
|
|
110
|
-
console.log('\n6️⃣ 完成任務');
|
|
111
|
-
console.log('-'.repeat(60));
|
|
112
|
-
|
|
113
|
-
const completed = await api.completeTask(task1.id);
|
|
114
|
-
console.log(`✅ 任務已完成: ${completed.id}`);
|
|
115
|
-
console.log(` 執行者: ${completed.executed_by.name}`);
|
|
116
|
-
console.log(` 完成時間: ${completed.executed_by.timestamp}`);
|
|
117
|
-
console.log(` 最終版本: ${completed._version}`);
|
|
118
|
-
|
|
119
|
-
// ============================================================================
|
|
120
|
-
// 7. 解鎖任務
|
|
121
|
-
// ============================================================================
|
|
122
|
-
|
|
123
|
-
console.log('\n7️⃣ 解鎖任務');
|
|
124
|
-
console.log('-'.repeat(60));
|
|
125
|
-
|
|
126
|
-
const unlocked = await lockMgr.releaseLock(task1.id, gitUser);
|
|
127
|
-
if (unlocked) {
|
|
128
|
-
console.log(`✅ 任務已解鎖: ${task1.id}`);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// ============================================================================
|
|
132
|
-
// 8. 查詢特定條件的任務
|
|
133
|
-
// ============================================================================
|
|
134
|
-
|
|
135
|
-
console.log('\n8️⃣ 查詢特定條件的任務');
|
|
136
|
-
console.log('-'.repeat(60));
|
|
137
|
-
|
|
138
|
-
// 查詢所有 P1 任務
|
|
139
|
-
const p1Tasks = await api.queryTasks({ priority: 'P1' });
|
|
140
|
-
console.log(`✅ P1 任務數量: ${p1Tasks.length}`);
|
|
141
|
-
|
|
142
|
-
// 查詢所有已完成任務
|
|
143
|
-
const completedTasks = await api.queryTasks({ status: 'completed' });
|
|
144
|
-
console.log(`✅ 已完成任務數量: ${completedTasks.length}`);
|
|
145
|
-
|
|
146
|
-
// ============================================================================
|
|
147
|
-
// 9. ID 生成與驗證
|
|
148
|
-
// ============================================================================
|
|
149
|
-
|
|
150
|
-
console.log('\n9️⃣ ID 生成與驗證');
|
|
151
|
-
console.log('-'.repeat(60));
|
|
152
|
-
|
|
153
|
-
const newId = generateTaskID();
|
|
154
|
-
console.log(`✅ 生成 ID: ${newId}`);
|
|
155
|
-
console.log(` 格式正確: ${validateTaskID(newId)}`);
|
|
156
|
-
console.log(` 錯誤格式: ${validateTaskID('TASK_123')}`);
|
|
157
|
-
|
|
158
|
-
// ============================================================================
|
|
159
|
-
// 10. 清理(刪除範例任務)
|
|
160
|
-
// ============================================================================
|
|
161
|
-
|
|
162
|
-
console.log('\n🗑️ 清理範例任務');
|
|
163
|
-
console.log('-'.repeat(60));
|
|
164
|
-
|
|
165
|
-
const deleted = await api.deleteTask(task1.id);
|
|
166
|
-
if (deleted) {
|
|
167
|
-
console.log(`✅ 任務已刪除: ${task1.id}`);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
console.log('\n' + '='.repeat(60));
|
|
171
|
-
console.log('✅ 範例執行完成!');
|
|
172
|
-
console.log('='.repeat(60));
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// 執行範例
|
|
176
|
-
if (require.main === module) {
|
|
177
|
-
main().catch(error => {
|
|
178
|
-
console.error('❌ 執行失敗:', error.message);
|
|
179
|
-
console.error(error.stack);
|
|
180
|
-
process.exit(1);
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
module.exports = { main };
|
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* team-workflow.js
|
|
4
|
-
* 團隊協作工作流程範例 - 模擬多用戶協作場景
|
|
5
|
-
*
|
|
6
|
-
* 執行方式:
|
|
7
|
-
* node .collaboration/docs/examples/team-workflow.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const { TaskAPI } = require('../../core/task-api.js');
|
|
11
|
-
const { LockManager } = require('../../core/lock-manager.js');
|
|
12
|
-
|
|
13
|
-
async function main() {
|
|
14
|
-
console.log('='.repeat(60));
|
|
15
|
-
console.log('👥 團隊協作工作流程範例');
|
|
16
|
-
console.log('='.repeat(60));
|
|
17
|
-
|
|
18
|
-
const api = new TaskAPI();
|
|
19
|
-
const lockMgr = new LockManager();
|
|
20
|
-
|
|
21
|
-
// ============================================================================
|
|
22
|
-
// 場景:PM 建立 Sprint 任務並分配給團隊成員
|
|
23
|
-
// ============================================================================
|
|
24
|
-
|
|
25
|
-
console.log('\n📋 場景 1: PM 建立 Sprint 任務');
|
|
26
|
-
console.log('-'.repeat(60));
|
|
27
|
-
|
|
28
|
-
// PM 建立多個任務
|
|
29
|
-
const tasks = [];
|
|
30
|
-
const taskDefinitions = [
|
|
31
|
-
{ title: '實作登入頁面', priority: 'P1', assignee: 'zhangsan' },
|
|
32
|
-
{ title: '實作註冊頁面', priority: 'P1', assignee: 'lisi' },
|
|
33
|
-
{ title: '實作密碼重設功能', priority: 'P2', assignee: 'wangwu' },
|
|
34
|
-
{ title: '實作用戶個人資料頁', priority: 'P2', assignee: 'zhangsan' },
|
|
35
|
-
{ title: '撰寫 API 文檔', priority: 'P3', assignee: 'lisi' }
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
console.log('✅ PM 建立任務...');
|
|
39
|
-
for (const def of taskDefinitions) {
|
|
40
|
-
const task = await api.createTask({
|
|
41
|
-
title: def.title,
|
|
42
|
-
priority: def.priority,
|
|
43
|
-
created_by: {
|
|
44
|
-
name: 'Product Manager',
|
|
45
|
-
git_user: 'pm',
|
|
46
|
-
timestamp: new Date().toISOString()
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// 分配任務
|
|
51
|
-
await api.updateTask(task.id, {
|
|
52
|
-
assigned_to: {
|
|
53
|
-
name: def.assignee,
|
|
54
|
-
git_user: def.assignee,
|
|
55
|
-
timestamp: new Date().toISOString()
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
tasks.push(task);
|
|
60
|
-
console.log(` - [${task.id}] ${task.title} → @${def.assignee}`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// ============================================================================
|
|
64
|
-
// 場景:開發者查看自己的任務
|
|
65
|
-
// ============================================================================
|
|
66
|
-
|
|
67
|
-
console.log('\n👨💻 場景 2: 開發者查看自己的任務');
|
|
68
|
-
console.log('-'.repeat(60));
|
|
69
|
-
|
|
70
|
-
// zhangsan 查看自己的任務
|
|
71
|
-
const zhangsanTasks = await api.queryTasks({
|
|
72
|
-
assigned_to: 'zhangsan',
|
|
73
|
-
status: 'pending'
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
console.log(`✅ zhangsan 的待辦任務: ${zhangsanTasks.length} 個`);
|
|
77
|
-
zhangsanTasks.forEach(task => {
|
|
78
|
-
console.log(` - [${task.id}] ${task.title} (${task.priority})`);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// ============================================================================
|
|
82
|
-
// 場景:開發者認領並開始工作
|
|
83
|
-
// ============================================================================
|
|
84
|
-
|
|
85
|
-
console.log('\n🔧 場景 3: 開發者認領並開始工作');
|
|
86
|
-
console.log('-'.repeat(60));
|
|
87
|
-
|
|
88
|
-
const task1 = zhangsanTasks[0];
|
|
89
|
-
|
|
90
|
-
// 認領任務
|
|
91
|
-
await api.claimTask(task1.id, 'zhangsan');
|
|
92
|
-
console.log(`✅ zhangsan 認領任務: ${task1.id}`);
|
|
93
|
-
|
|
94
|
-
// 鎖定任務
|
|
95
|
-
try {
|
|
96
|
-
await lockMgr.acquireLock(task1.id, 'zhangsan', 120);
|
|
97
|
-
console.log(`🔒 任務已鎖定 (120 分鐘)`);
|
|
98
|
-
} catch (error) {
|
|
99
|
-
console.error(`❌ 鎖定失敗: ${error.message}`);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// 模擬工作進度更新
|
|
103
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
104
|
-
|
|
105
|
-
await api.updateTask(task1.id, {
|
|
106
|
-
description: '登入頁面 UI 已完成 50%'
|
|
107
|
-
});
|
|
108
|
-
console.log(`✅ 更新進度: UI 完成 50%`);
|
|
109
|
-
|
|
110
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
111
|
-
|
|
112
|
-
await api.updateTask(task1.id, {
|
|
113
|
-
description: '登入頁面 UI 已完成,正在整合 API'
|
|
114
|
-
});
|
|
115
|
-
console.log(`✅ 更新進度: 開始整合 API`);
|
|
116
|
-
|
|
117
|
-
// ============================================================================
|
|
118
|
-
// 場景:任務完成並通知
|
|
119
|
-
// ============================================================================
|
|
120
|
-
|
|
121
|
-
console.log('\n✅ 場景 4: 任務完成並通知');
|
|
122
|
-
console.log('-'.repeat(60));
|
|
123
|
-
|
|
124
|
-
// 完成任務
|
|
125
|
-
await api.completeTask(task1.id);
|
|
126
|
-
console.log(`✅ zhangsan 完成任務: ${task1.id}`);
|
|
127
|
-
|
|
128
|
-
// 解鎖
|
|
129
|
-
await lockMgr.releaseLock(task1.id, 'zhangsan');
|
|
130
|
-
console.log(`🔓 任務已解鎖`);
|
|
131
|
-
|
|
132
|
-
// PM 查看完成狀態
|
|
133
|
-
const completed = await api.getTask(task1.id);
|
|
134
|
-
console.log(`\n📊 PM 查看完成狀態:`);
|
|
135
|
-
console.log(` 任務: ${completed.title}`);
|
|
136
|
-
console.log(` 狀態: ${completed.status}`);
|
|
137
|
-
console.log(` 執行者: ${completed.executed_by.name}`);
|
|
138
|
-
console.log(` 完成時間: ${completed.executed_by.timestamp}`);
|
|
139
|
-
|
|
140
|
-
// ============================================================================
|
|
141
|
-
// 場景:並行工作(多個開發者同時工作)
|
|
142
|
-
// ============================================================================
|
|
143
|
-
|
|
144
|
-
console.log('\n⚡ 場景 5: 並行工作(多個開發者同時工作)');
|
|
145
|
-
console.log('-'.repeat(60));
|
|
146
|
-
|
|
147
|
-
// lisi 和 wangwu 同時開始工作
|
|
148
|
-
const lisiTask = tasks.find(t => t.title === '實作註冊頁面');
|
|
149
|
-
const wangwuTask = tasks.find(t => t.title === '實作密碼重設功能');
|
|
150
|
-
|
|
151
|
-
// 並行認領任務
|
|
152
|
-
await Promise.all([
|
|
153
|
-
api.claimTask(lisiTask.id, 'lisi'),
|
|
154
|
-
api.claimTask(wangwuTask.id, 'wangwu')
|
|
155
|
-
]);
|
|
156
|
-
|
|
157
|
-
console.log(`✅ lisi 認領: ${lisiTask.title}`);
|
|
158
|
-
console.log(`✅ wangwu 認領: ${wangwuTask.title}`);
|
|
159
|
-
|
|
160
|
-
// 並行鎖定
|
|
161
|
-
await Promise.all([
|
|
162
|
-
lockMgr.acquireLock(lisiTask.id, 'lisi', 120),
|
|
163
|
-
lockMgr.acquireLock(wangwuTask.id, 'wangwu', 120)
|
|
164
|
-
]);
|
|
165
|
-
|
|
166
|
-
console.log(`🔒 兩個任務已並行鎖定`);
|
|
167
|
-
|
|
168
|
-
// ============================================================================
|
|
169
|
-
// 場景:依賴關係管理
|
|
170
|
-
// ============================================================================
|
|
171
|
-
|
|
172
|
-
console.log('\n🔗 場景 6: 依賴關係管理');
|
|
173
|
-
console.log('-'.repeat(60));
|
|
174
|
-
|
|
175
|
-
// 建立有依賴的任務
|
|
176
|
-
const loginAPITask = await api.createTask({
|
|
177
|
-
title: '實作登入 API',
|
|
178
|
-
priority: 'P1',
|
|
179
|
-
created_by: {
|
|
180
|
-
name: 'Backend Lead',
|
|
181
|
-
git_user: 'backend_lead',
|
|
182
|
-
timestamp: new Date().toISOString()
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
const loginUITask = await api.createTask({
|
|
187
|
-
title: '整合登入 UI 與 API',
|
|
188
|
-
priority: 'P1',
|
|
189
|
-
created_by: {
|
|
190
|
-
name: 'Frontend Lead',
|
|
191
|
-
git_user: 'frontend_lead',
|
|
192
|
-
timestamp: new Date().toISOString()
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
// 設置依賴:UI 整合依賴 API
|
|
197
|
-
await api.updateTask(loginUITask.id, {
|
|
198
|
-
dependencies: [loginAPITask.id]
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
console.log(`✅ 建立依賴關係:`);
|
|
202
|
-
console.log(` ${loginUITask.title}`);
|
|
203
|
-
console.log(` 依賴 → ${loginAPITask.title}`);
|
|
204
|
-
|
|
205
|
-
// 檢查依賴是否滿足
|
|
206
|
-
const depTask = await api.getTask(loginAPITask.id);
|
|
207
|
-
if (depTask.status !== 'completed') {
|
|
208
|
-
console.log(`\n⚠️ 警告: 依賴任務 ${loginAPITask.id} 尚未完成`);
|
|
209
|
-
console.log(` ${loginUITask.title} 無法開始`);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// ============================================================================
|
|
213
|
-
// 場景:緊急任務插隊
|
|
214
|
-
// ============================================================================
|
|
215
|
-
|
|
216
|
-
console.log('\n🚨 場景 7: 緊急任務插隊');
|
|
217
|
-
console.log('-'.repeat(60));
|
|
218
|
-
|
|
219
|
-
const urgentTask = await api.createTask({
|
|
220
|
-
title: '修復線上登入問題',
|
|
221
|
-
description: '用戶無法登入,緊急修復',
|
|
222
|
-
priority: 'P0',
|
|
223
|
-
created_by: {
|
|
224
|
-
name: 'On-Call Engineer',
|
|
225
|
-
git_user: 'oncall',
|
|
226
|
-
timestamp: new Date().toISOString()
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
console.log(`🚨 緊急任務建立: ${urgentTask.id}`);
|
|
231
|
-
console.log(` 標題: ${urgentTask.title}`);
|
|
232
|
-
console.log(` 優先級: ${urgentTask.priority}`);
|
|
233
|
-
|
|
234
|
-
// 立即分配給有經驗的開發者
|
|
235
|
-
await api.updateTask(urgentTask.id, {
|
|
236
|
-
assigned_to: {
|
|
237
|
-
name: 'zhangsan',
|
|
238
|
-
git_user: 'zhangsan',
|
|
239
|
-
timestamp: new Date().toISOString()
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
console.log(`✅ 緊急任務分配給: zhangsan`);
|
|
244
|
-
|
|
245
|
-
// ============================================================================
|
|
246
|
-
// 場景:團隊進度報告
|
|
247
|
-
// ============================================================================
|
|
248
|
-
|
|
249
|
-
console.log('\n📊 場景 8: 團隊進度報告');
|
|
250
|
-
console.log('-'.repeat(60));
|
|
251
|
-
|
|
252
|
-
const allData = await api.getAllTasks();
|
|
253
|
-
|
|
254
|
-
// 按用戶統計
|
|
255
|
-
const userStats = {};
|
|
256
|
-
allData.tasks.forEach(task => {
|
|
257
|
-
if (task.assigned_to) {
|
|
258
|
-
const user = task.assigned_to.git_user;
|
|
259
|
-
if (!userStats[user]) {
|
|
260
|
-
userStats[user] = { total: 0, pending: 0, in_progress: 0, completed: 0 };
|
|
261
|
-
}
|
|
262
|
-
userStats[user].total++;
|
|
263
|
-
userStats[user][task.status]++;
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
console.log('✅ 團隊進度統計:\n');
|
|
268
|
-
Object.entries(userStats).forEach(([user, stats]) => {
|
|
269
|
-
console.log(` @${user}:`);
|
|
270
|
-
console.log(` 總任務: ${stats.total}`);
|
|
271
|
-
console.log(` 待辦: ${stats.pending || 0}`);
|
|
272
|
-
console.log(` 進行中: ${stats.in_progress || 0}`);
|
|
273
|
-
console.log(` 已完成: ${stats.completed || 0}`);
|
|
274
|
-
console.log('');
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
// 計算完成率
|
|
278
|
-
const totalAssigned = allData.tasks.filter(t => t.assigned_to).length;
|
|
279
|
-
const totalCompleted = allData.tasks.filter(t => t.status === 'completed').length;
|
|
280
|
-
const completionRate = ((totalCompleted / totalAssigned) * 100).toFixed(1);
|
|
281
|
-
|
|
282
|
-
console.log(`📈 整體完成率: ${completionRate}% (${totalCompleted}/${totalAssigned})`);
|
|
283
|
-
|
|
284
|
-
// ============================================================================
|
|
285
|
-
// 場景:Sprint 回顧
|
|
286
|
-
// ============================================================================
|
|
287
|
-
|
|
288
|
-
console.log('\n🎯 場景 9: Sprint 回顧');
|
|
289
|
-
console.log('-'.repeat(60));
|
|
290
|
-
|
|
291
|
-
// 統計本次 Sprint 的任務
|
|
292
|
-
const sprintTasks = allData.tasks;
|
|
293
|
-
|
|
294
|
-
const priorityDistribution = {
|
|
295
|
-
'P0': sprintTasks.filter(t => t.priority === 'P0').length,
|
|
296
|
-
'P1': sprintTasks.filter(t => t.priority === 'P1').length,
|
|
297
|
-
'P2': sprintTasks.filter(t => t.priority === 'P2').length,
|
|
298
|
-
'P3': sprintTasks.filter(t => t.priority === 'P3').length
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
console.log('✅ 任務分布:');
|
|
302
|
-
Object.entries(priorityDistribution).forEach(([priority, count]) => {
|
|
303
|
-
if (count > 0) {
|
|
304
|
-
console.log(` ${priority}: ${count} 個`);
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
// 完成時間分析
|
|
309
|
-
const completedWithTime = sprintTasks.filter(t => t.executed_by);
|
|
310
|
-
if (completedWithTime.length > 0) {
|
|
311
|
-
console.log('\n✅ 完成時間分析:');
|
|
312
|
-
completedWithTime.forEach(task => {
|
|
313
|
-
const created = new Date(task.created_by.timestamp);
|
|
314
|
-
const completed = new Date(task.executed_by.timestamp);
|
|
315
|
-
const durationHours = Math.round((completed - created) / (1000 * 60 * 60));
|
|
316
|
-
|
|
317
|
-
console.log(` [${task.id}] ${task.title}`);
|
|
318
|
-
console.log(` 耗時: ${durationHours} 小時`);
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// ============================================================================
|
|
323
|
-
// 清理
|
|
324
|
-
// ============================================================================
|
|
325
|
-
|
|
326
|
-
console.log('\n🗑️ 清理範例任務');
|
|
327
|
-
console.log('-'.repeat(60));
|
|
328
|
-
|
|
329
|
-
for (const task of tasks) {
|
|
330
|
-
await api.deleteTask(task.id);
|
|
331
|
-
}
|
|
332
|
-
await api.deleteTask(loginAPITask.id);
|
|
333
|
-
await api.deleteTask(loginUITask.id);
|
|
334
|
-
await api.deleteTask(urgentTask.id);
|
|
335
|
-
|
|
336
|
-
console.log(`✅ 已刪除 ${tasks.length + 3} 個範例任務`);
|
|
337
|
-
|
|
338
|
-
console.log('\n' + '='.repeat(60));
|
|
339
|
-
console.log('✅ 範例執行完成!');
|
|
340
|
-
console.log('='.repeat(60));
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// 執行範例
|
|
344
|
-
if (require.main === module) {
|
|
345
|
-
main().catch(error => {
|
|
346
|
-
console.error('❌ 執行失敗:', error.message);
|
|
347
|
-
console.error(error.stack);
|
|
348
|
-
process.exit(1);
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
module.exports = { main };
|