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,45 +0,0 @@
1
- /**
2
- * lock 命令 - 鎖定任務
3
- */
4
-
5
- const { getPositional } = require('../utils/arg-parser');
6
- const { getGitUser } = require('../utils/git-user');
7
- const { success, error, warn } = require('../utils/output');
8
-
9
- // 可選載入 LockManager
10
- let LockManager = null;
11
- try {
12
- LockManager = require('../../core/lock-manager.js').LockManager;
13
- } catch { /* 模組不存在 */ }
14
-
15
- module.exports = {
16
- name: 'lock',
17
- description: '鎖定任務',
18
- options: [],
19
-
20
- async execute(args) {
21
- if (!LockManager) {
22
- warn('鎖定功能未啟用(lock-manager 模組不存在)');
23
- return 0;
24
- }
25
-
26
- const taskId = getPositional(args, 0);
27
- if (!taskId) {
28
- error('缺少任務 ID');
29
- return 1;
30
- }
31
-
32
- try {
33
- const gitUser = getGitUser();
34
- const lockMgr = new LockManager();
35
- const lock = await lockMgr.acquireLock(taskId, gitUser);
36
- success(`任務已鎖定: ${lock.task_id}`);
37
- console.log(`鎖定者: ${lock.locked_by}`);
38
- console.log(`過期時間: ${lock.expires_at}`);
39
- return 0;
40
- } catch (err) {
41
- error(`鎖定失敗: ${err.message}`);
42
- return 1;
43
- }
44
- }
45
- };
@@ -1,39 +0,0 @@
1
- /**
2
- * rebuild 命令 - 重建索引
3
- */
4
-
5
- const { success, error, warn } = require('../utils/output');
6
-
7
- // 可選載入 IndexManager
8
- let IndexManager = null;
9
- try {
10
- IndexManager = require('../../core/index-manager.js').IndexManager;
11
- } catch { /* 模組不存在 */ }
12
-
13
- module.exports = {
14
- name: 'rebuild',
15
- description: '重建索引',
16
- options: [],
17
-
18
- async execute() {
19
- if (!IndexManager) {
20
- warn('索引功能未啟用(index-manager 模組不存在)');
21
- return 0;
22
- }
23
-
24
- try {
25
- console.log('重建索引中...');
26
- const indexMgr = new IndexManager();
27
- const stats = await indexMgr.rebuildAll();
28
- success('索引重建完成');
29
- console.log(`總任務數: ${stats.totalTasks}`);
30
- console.log(`狀態分類: ${stats.byStatus}`);
31
- console.log(`用戶分類: ${stats.byUser}`);
32
- console.log(`優先級分類: ${stats.byPriority}`);
33
- return 0;
34
- } catch (err) {
35
- error(`重建失敗: ${err.message}`);
36
- return 1;
37
- }
38
- }
39
- };
@@ -1,61 +0,0 @@
1
- /**
2
- * search 命令 - 搜尋任務
3
- */
4
-
5
- const { TaskAPI } = require('../../core/task-api.js');
6
- const { getPositional, parseArgs } = require('../utils/arg-parser');
7
- const { error } = require('../utils/output');
8
-
9
- module.exports = {
10
- name: 'search',
11
- description: '搜尋任務',
12
- options: ['--status', '--priority', '--role', '--tags'],
13
-
14
- async execute(args) {
15
- const keyword = getPositional(args, 0);
16
- const filters = parseArgs(args, ['status', 'priority', 'role', 'tags']);
17
-
18
- if (!keyword && Object.keys(filters).length === 0) {
19
- error('缺少搜尋關鍵字或過濾條件');
20
- console.log('用法: search <關鍵字> [--status STATUS] [--priority P] [--role ROLE] [--tags TAG1,TAG2]');
21
- return 1;
22
- }
23
-
24
- try {
25
- const api = new TaskAPI();
26
-
27
- const query = {};
28
- if (keyword) query.search = keyword;
29
- if (filters.status) query.status = filters.status;
30
- if (filters.priority) query.priority = filters.priority;
31
- if (filters.role) query.role = filters.role;
32
- if (filters.tags) query.tags = filters.tags.split(',').map(t => t.trim());
33
-
34
- const tasks = await api.queryTasks(query);
35
-
36
- if (tasks.length === 0) {
37
- console.log('沒有符合條件的任務');
38
- return 0;
39
- }
40
-
41
- const searchDesc = keyword ? `"${keyword}"` : '條件';
42
- console.log(`找到 ${tasks.length} 個符合 ${searchDesc} 的任務:\n`);
43
-
44
- tasks.forEach(task => {
45
- const role = task.role || task.agent_type || '-';
46
- const tags = (task.tags || []).join(',') || '-';
47
- console.log(`[${task.id}] ${task.title}`);
48
- console.log(` 狀態: ${task.status} | 優先級: ${task.priority} | 角色: ${role} | 標籤: ${tags}`);
49
- if (task.description) {
50
- console.log(` 描述: ${task.description.substring(0, 60)}${task.description.length > 60 ? '...' : ''}`);
51
- }
52
- console.log('');
53
- });
54
-
55
- return 0;
56
- } catch (err) {
57
- error(`搜尋失敗: ${err.message}`);
58
- return 1;
59
- }
60
- }
61
- };
@@ -1,61 +0,0 @@
1
- /**
2
- * stats 命令 - 顯示任務統計
3
- */
4
-
5
- const { TaskAPI } = require('../../core/task-api.js');
6
- const { error } = require('../utils/output');
7
-
8
- module.exports = {
9
- name: 'stats',
10
- description: '顯示任務統計',
11
- options: [],
12
-
13
- async execute() {
14
- try {
15
- const api = new TaskAPI();
16
- const stats = await api.getStatistics();
17
-
18
- console.log('任務統計\n');
19
- console.log('========================================');
20
-
21
- console.log('\n📊 按狀態:');
22
- for (const [status, count] of Object.entries(stats.byStatus)) {
23
- const bar = '█'.repeat(Math.min(count, 20));
24
- console.log(` ${status.padEnd(12)} ${bar} ${count}`);
25
- }
26
-
27
- console.log('\n🎯 按優先級:');
28
- const priorityOrder = ['P0', 'P1', 'P2', 'P3'];
29
- for (const priority of priorityOrder) {
30
- const count = stats.byPriority[priority] || 0;
31
- if (count > 0) {
32
- const bar = '█'.repeat(Math.min(count, 20));
33
- console.log(` ${priority.padEnd(12)} ${bar} ${count}`);
34
- }
35
- }
36
-
37
- console.log('\n👤 按角色:');
38
- for (const [role, count] of Object.entries(stats.byRole)) {
39
- const bar = '█'.repeat(Math.min(count, 20));
40
- console.log(` ${role.padEnd(16)} ${bar} ${count}`);
41
- }
42
-
43
- if (Object.keys(stats.byTags).length > 0) {
44
- console.log('\n🏷️ 按標籤:');
45
- for (const [tag, count] of Object.entries(stats.byTags)) {
46
- const bar = '█'.repeat(Math.min(count, 20));
47
- console.log(` ${tag.padEnd(12)} ${bar} ${count}`);
48
- }
49
- }
50
-
51
- console.log('\n========================================');
52
- console.log(`總計: ${stats.total} 個任務`);
53
- console.log(`更新時間: ${stats.timestamp}`);
54
-
55
- return 0;
56
- } catch (err) {
57
- error(`統計失敗: ${err.message}`);
58
- return 1;
59
- }
60
- }
61
- };
@@ -1,41 +0,0 @@
1
- /**
2
- * transfer 命令 - 轉移任務
3
- */
4
-
5
- const { TaskAPI } = require('../../core/task-api.js');
6
- const { getPositional, parseArgs } = require('../utils/arg-parser');
7
- const { success, error } = require('../utils/output');
8
-
9
- module.exports = {
10
- name: 'transfer',
11
- description: '轉移任務',
12
- options: ['--from', '--to'],
13
-
14
- async execute(args) {
15
- const taskId = getPositional(args, 0);
16
- const { from, to } = parseArgs(args, ['from', 'to']);
17
-
18
- if (!taskId) {
19
- error('缺少任務 ID');
20
- return 1;
21
- }
22
-
23
- if (!from || !to) {
24
- error('缺少 --from 或 --to 參數');
25
- return 1;
26
- }
27
-
28
- try {
29
- const api = new TaskAPI();
30
- // 使用 claimTask 來轉移(重新分配)
31
- const task = await api.claimTask(taskId, to);
32
- success(`任務已轉移: ${task.id}`);
33
- console.log(`從: ${from}`);
34
- console.log(`轉移給: ${to}`);
35
- return 0;
36
- } catch (err) {
37
- error(`轉移失敗: ${err.message}`);
38
- return 1;
39
- }
40
- }
41
- };
@@ -1,48 +0,0 @@
1
- /**
2
- * unlock 命令 - 解鎖任務
3
- */
4
-
5
- const { getPositional } = require('../utils/arg-parser');
6
- const { getGitUser } = require('../utils/git-user');
7
- const { success, warn, error } = require('../utils/output');
8
-
9
- // 可選載入 LockManager
10
- let LockManager = null;
11
- try {
12
- LockManager = require('../../core/lock-manager.js').LockManager;
13
- } catch { /* 模組不存在 */ }
14
-
15
- module.exports = {
16
- name: 'unlock',
17
- description: '解鎖任務',
18
- options: [],
19
-
20
- async execute(args) {
21
- if (!LockManager) {
22
- warn('鎖定功能未啟用(lock-manager 模組不存在)');
23
- return 0;
24
- }
25
-
26
- const taskId = getPositional(args, 0);
27
- if (!taskId) {
28
- error('缺少任務 ID');
29
- return 1;
30
- }
31
-
32
- try {
33
- const gitUser = getGitUser();
34
- const lockMgr = new LockManager();
35
- const released = await lockMgr.releaseLock(taskId, gitUser);
36
-
37
- if (released) {
38
- success(`任務已解鎖: ${taskId}`);
39
- } else {
40
- warn('任務未被鎖定');
41
- }
42
- return 0;
43
- } catch (err) {
44
- error(`解鎖失敗: ${err.message}`);
45
- return 1;
46
- }
47
- }
48
- };
@@ -1,70 +0,0 @@
1
- /**
2
- * 幫助文字格式化
3
- */
4
-
5
- const { CommandRegistry } = require('../commands');
6
-
7
- /**
8
- * 顯示幫助資訊
9
- */
10
- function showHelp() {
11
- const commands = CommandRegistry.getAll();
12
-
13
- console.log(`
14
- 任務管理 CLI
15
-
16
- 用法:
17
- task-cli.js <command> [options]
18
-
19
- 命令:`);
20
-
21
- // 動態生成命令列表
22
- Object.values(commands).forEach(cmd => {
23
- const name = cmd.name.padEnd(12);
24
- console.log(` ${name}${cmd.description}`);
25
- });
26
-
27
- console.log(`
28
- 選項:
29
- --help, -h 顯示幫助資訊
30
-
31
- 範例:
32
- # 建立任務
33
- task-cli.js create --title "實作登入功能" --priority P1 --description "建立登入頁面和 API"
34
-
35
- # 列出所有 pending 任務
36
- task-cli.js list --status pending
37
-
38
- # 列出指定用戶的任務
39
- task-cli.js list --assigned-to zhangsan
40
-
41
- # 列出 P0 任務
42
- task-cli.js list --priority P0
43
-
44
- # 取得任務詳情
45
- task-cli.js get TASK_01HQFX9K2G
46
-
47
- # 認領任務
48
- task-cli.js claim TASK_01HQFX9K2G
49
-
50
- # 分配任務
51
- task-cli.js assign TASK_01HQFX9K2G --to lisi
52
-
53
- # 轉移任務
54
- task-cli.js transfer TASK_01HQFX9K2G --from zhangsan --to lisi
55
-
56
- # 完成任務
57
- task-cli.js complete TASK_01HQFX9K2G
58
-
59
- # 鎖定任務
60
- task-cli.js lock TASK_01HQFX9K2G
61
-
62
- # 解鎖任務
63
- task-cli.js unlock TASK_01HQFX9K2G
64
-
65
- # 重建索引
66
- task-cli.js rebuild
67
- `);
68
- }
69
-
70
- module.exports = { showHelp };
@@ -1,7 +0,0 @@
1
- /**
2
- * Formatters barrel export
3
- */
4
-
5
- module.exports = {
6
- ...require('./help-formatter'),
7
- };
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * task-cli.js
4
- * 任務管理命令列工具
5
- *
6
- * 使用方式:
7
- * node .collaboration/cli/task-cli.js create --title "實作登入功能" --priority P1
8
- * node .collaboration/cli/task-cli.js list --status pending
9
- * node .collaboration/cli/task-cli.js claim TASK_01HQFX9K2G
10
- */
11
-
12
- const { CommandRegistry } = require('./commands');
13
- const { showHelp } = require('./formatters/help-formatter');
14
- const { hasFlag } = require('./utils/arg-parser');
15
-
16
- async function main() {
17
- const args = process.argv.slice(2);
18
-
19
- // 顯示幫助
20
- if (args.length === 0 || hasFlag(args, 'help') || args.includes('-h')) {
21
- showHelp();
22
- return 0;
23
- }
24
-
25
- const [command, ...commandArgs] = args;
26
-
27
- try {
28
- return await CommandRegistry.execute(command, commandArgs);
29
- } catch (error) {
30
- console.error(`❌ ${error.message}`);
31
- showHelp();
32
- return 1;
33
- }
34
- }
35
-
36
- // CLI 入口
37
- if (require.main === module) {
38
- main()
39
- .then(process.exit)
40
- .catch(err => {
41
- console.error(`❌ 執行錯誤: ${err.message}`);
42
- process.exit(1);
43
- });
44
- }
45
-
46
- module.exports = { main };
@@ -1,74 +0,0 @@
1
- /**
2
- * 參數解析工具
3
- */
4
-
5
- /**
6
- * 解析命名參數
7
- * @param {string[]} args - 參數陣列
8
- * @param {string[]} keys - 要解析的 key 列表
9
- * @returns {Object} 解析結果
10
- */
11
- function parseArgs(args, keys) {
12
- const result = {};
13
- keys.forEach(key => {
14
- const index = args.indexOf(`--${key}`);
15
- if (index >= 0 && args[index + 1] && !args[index + 1].startsWith('--')) {
16
- result[key] = args[index + 1];
17
- }
18
- });
19
- return result;
20
- }
21
-
22
- /**
23
- * 取得位置參數
24
- * @param {string[]} args - 參數陣列
25
- * @param {number} index - 位置索引
26
- * @returns {string|undefined}
27
- */
28
- function getPositional(args, index = 0) {
29
- const positionals = args.filter(a => !a.startsWith('--'));
30
- return positionals[index];
31
- }
32
-
33
- /**
34
- * 解析逗號分隔的參數值為陣列
35
- * @param {string[]} args - 參數陣列
36
- * @param {string} key - 參數名稱
37
- * @returns {string[]} 解析結果
38
- */
39
- function parseCsv(args, key) {
40
- const index = args.indexOf(`--${key}`);
41
- if (index >= 0 && args[index + 1] && !args[index + 1].startsWith('--')) {
42
- return args[index + 1].split(',').map(s => s.trim()).filter(Boolean);
43
- }
44
- return [];
45
- }
46
-
47
- /**
48
- * 收集同一 flag 多次出現的值(支援 --req "A" --req "B")
49
- * @param {string[]} args - 參數陣列
50
- * @param {string} key - 參數名稱
51
- * @returns {string[]} 所有匹配的值
52
- */
53
- function parseMulti(args, key) {
54
- const flag = `--${key}`;
55
- const results = [];
56
- for (let i = 0; i < args.length; i++) {
57
- if (args[i] === flag && args[i + 1] && !args[i + 1].startsWith('--')) {
58
- results.push(args[i + 1]);
59
- }
60
- }
61
- return results;
62
- }
63
-
64
- /**
65
- * 檢查是否有指定旗標
66
- * @param {string[]} args - 參數陣列
67
- * @param {string} flag - 旗標名稱
68
- * @returns {boolean}
69
- */
70
- function hasFlag(args, flag) {
71
- return args.includes(`--${flag}`) || args.includes(`-${flag.charAt(0)}`);
72
- }
73
-
74
- module.exports = { parseArgs, getPositional, hasFlag, parseCsv, parseMulti };
@@ -1,25 +0,0 @@
1
- /**
2
- * Git 用戶工具
3
- */
4
-
5
- const { execSync } = require('child_process');
6
- const path = require('path');
7
-
8
- const PROJECT_ROOT = path.resolve(__dirname, '../../..');
9
-
10
- /**
11
- * 取得當前 Git 用戶名
12
- * @param {string} [cwd] - 指定 git 工作目錄,預設為專案根目錄
13
- * @returns {string}
14
- */
15
- function getGitUser(cwd = PROJECT_ROOT) {
16
- try {
17
- return execSync('git config user.email', { encoding: 'utf8', cwd })
18
- .trim()
19
- .split('@')[0];
20
- } catch {
21
- return 'unknown';
22
- }
23
- }
24
-
25
- module.exports = { getGitUser };
@@ -1,9 +0,0 @@
1
- /**
2
- * Utils barrel export
3
- */
4
-
5
- module.exports = {
6
- ...require('./arg-parser'),
7
- ...require('./git-user'),
8
- ...require('./output'),
9
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * 輸出工具
3
- */
4
-
5
- module.exports = {
6
- success: (msg) => console.log(`✅ ${msg}`),
7
- error: (msg) => console.error(`❌ ${msg}`),
8
- warn: (msg) => console.log(`⚠️ ${msg}`),
9
- info: (msg) => console.log(msg),
10
- };