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.
Files changed (329) 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/skills/architect_agent/SKILL.md +11 -92
  7. package/core/.claude/skills/assessment_agent/SKILL.md +0 -1
  8. package/core/.claude/skills/backend_engineer/SKILL.md +3 -6
  9. package/core/.claude/skills/code_reviewer/SKILL.md +1 -1
  10. package/core/.claude/skills/code_reviewer/patterns.yaml +1 -1
  11. package/core/.claude/skills/designer/SKILL.md +3 -6
  12. package/core/.claude/skills/dev_agent/SKILL.md +30 -491
  13. package/core/.claude/skills/developer/SKILL.md +3 -6
  14. package/core/.claude/skills/feature_agent/SKILL.md +3 -17
  15. package/core/.claude/skills/product_manager/SKILL.md +29 -1064
  16. package/core/.claude/skills/qa_engineer/SKILL.md +12 -17
  17. package/core/.claude/skills/spec_optimizer/SKILL.md +25 -275
  18. package/core/.claude/skills/sre_agent/SKILL.md +3 -6
  19. package/core/.collaboration/README.md +2 -3
  20. package/core/.collaboration/core/task-api.js +5 -138
  21. package/core/.collaboration/docs/CLI.md +0 -2
  22. package/core/.failure/INDEX.yaml +6 -40
  23. package/core/.failure/agent-execution/FAIL-013-search-cwd-drift-and-case-mismatch.yaml +1 -1
  24. package/core/.failure/tools/README.md +9 -227
  25. package/core/.formation/bifrost/launch.js +1 -6
  26. package/core/.formation/bifrost/launch.test.js +1 -1
  27. package/core/.formation/bifrost/shared/ansuz-boot-policy.js +3 -3
  28. package/core/.formation/bifrost/shared/ansuz-boot-policy.test.js +1 -2
  29. package/core/.formation/tools/__tests__/arms.test.js +41 -0
  30. package/core/.formation/tools/__tests__/diagnose-bug.test.js +10 -0
  31. package/core/.formation/tools/__tests__/m1-hmap-convid.test.js +1 -124
  32. package/core/.formation/tools/arms.js +48 -0
  33. package/core/.formation/tools/dispatch.js +24 -15
  34. package/core/.formation/tools/kenaz-stats.js +32 -8
  35. package/core/.formation/tools/kenaz-stats.test.js +15 -2
  36. package/core/.formation/tools/loader.js +17 -140
  37. package/core/.formation/tools/post-complete.js +0 -31
  38. package/core/.formation/tools/prompt.js +16 -1
  39. package/core/.formation/tools/prompt.test.js +20 -0
  40. package/core/.rule/INDEX.yaml +0 -18
  41. package/core/.rule/general/agent-workflow.yaml +14 -164
  42. package/core/.rule/general/project-self-containment.yaml +8 -19
  43. package/core/.rule/general/rust-verify-target.yaml +6 -5
  44. package/core/.rule/general/synapse-code-intelligence.yaml +3 -3
  45. package/core/.specialist/Amelia/capability.yaml +12 -12
  46. package/core/.specialist/Amelia/workflow.yaml +2 -2
  47. package/core/.specialist/Ansuz/SYSTEM_DOC.md +20 -578
  48. package/core/.specialist/Ansuz/cognitive_principles.yaml +2 -3
  49. package/core/.specialist/Ansuz/concepts/boot_rules_summary.yaml +0 -1
  50. package/core/.specialist/Ansuz/concepts/deep_knowledge_pointers.yaml +1 -2
  51. package/core/.specialist/Ansuz/core.yaml +6 -108
  52. package/core/.specialist/Ansuz/guards/lesson_guards.yaml +0 -3
  53. package/core/.specialist/Ansuz/identity_contract.yaml +0 -1
  54. package/core/.specialist/Ansuz/knowledge.yaml +0 -4
  55. package/core/.specialist/Ansuz/rule.yaml +0 -1
  56. package/core/.specialist/Ansuz/tools/handoff-session-identity.test.js +6 -150
  57. package/core/.specialist/tests/runtime-discovery/README.md +1 -1
  58. package/core/.specialist/tools/__tests__/task-2374-usage-counter.test.js +1 -12
  59. package/core/.specialist/tools/ansuz-boot-fast.js +7 -4
  60. package/core/.specialist/tools/ansuz-boot-fast.test.js +10 -3
  61. package/core/.specialist/tools/prompt-files.test.js +1 -0
  62. package/core/.specialist/tools/task-bridge.js +1 -66
  63. package/core/.system/README.md +11 -552
  64. package/core/.system/collaboration/README.md +10 -174
  65. package/core/CLAUDE.md +1 -6
  66. package/core/KENAZ_CORE_VERSION +1 -1
  67. package/core/dev/scripts/js-yaml-resolution.test.js +1 -1
  68. package/core/dev/scripts/peer-identity-e2e.js +402 -0
  69. package/core/dev/scripts/peer-identity-e2e.md +47 -0
  70. package/core/dev/scripts/relay-admin.js +94 -0
  71. package/core/dev/scripts/relay-admin.test.js +131 -0
  72. package/core/dev/scripts/run-rust-tests.js +9 -45
  73. package/core/dev/scripts/rust-verify-worktree.js +4 -4
  74. package/core/dev/scripts/verify-target-dir.js +6 -6
  75. package/core/plugins/kenaz/INVENTORY.md +8 -8
  76. package/core/plugins/kenaz/README.md +10 -0
  77. package/core/plugins/kenaz/commands/architect.md +1 -2
  78. package/core/plugins/kenaz/commands/spec.md +1 -1
  79. package/core/plugins/kenaz/commands//347/224/242/345/223/201.md +1 -1
  80. package/core/plugins/kenaz/guidance.md +1 -1
  81. package/core/plugins/kenaz/hooks/kenaz-hook.js +2 -1
  82. package/core/plugins/kenaz/hooks/sdk-gate.js +9 -0
  83. package/core/plugins/kenaz/scripts/kenaz.test.js +15 -3
  84. package/core/plugins/kenaz/scripts/sync.js +1 -1
  85. package/core/plugins/kenaz/scripts/ygg.js +8 -0
  86. package/core/plugins/kenaz/scripts/ygg.test.js +72 -0
  87. package/core/plugins/kenaz/skills/architect_agent/SKILL.md +11 -92
  88. package/core/plugins/kenaz/skills/assessment_agent/SKILL.md +0 -1
  89. package/core/plugins/kenaz/skills/backend_engineer/SKILL.md +3 -6
  90. package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +1 -1
  91. package/core/plugins/kenaz/skills/code_reviewer/patterns.yaml +1 -1
  92. package/core/plugins/kenaz/skills/designer/SKILL.md +3 -6
  93. package/core/plugins/kenaz/skills/dev_agent/SKILL.md +30 -491
  94. package/core/plugins/kenaz/skills/developer/SKILL.md +3 -6
  95. package/core/plugins/kenaz/skills/feature_agent/SKILL.md +3 -17
  96. package/core/plugins/kenaz/skills/product_manager/SKILL.md +29 -1064
  97. package/core/plugins/kenaz/skills/qa_engineer/SKILL.md +12 -17
  98. package/core/plugins/kenaz/skills/spec_optimizer/SKILL.md +25 -275
  99. package/core/plugins/kenaz/skills/sre_agent/SKILL.md +3 -6
  100. package/core/plugins/kenaz-peer/hooks/register.test.ts +32 -0
  101. package/core/plugins/kenaz-peer/hooks/register.ts +9 -0
  102. package/package.json +6 -6
  103. package/core/.claude/commands/archive.md +0 -24
  104. package/core/.claude/commands/init.md +0 -112
  105. package/core/.claude/commands/legacy_dev.md +0 -18
  106. package/core/.claude/commands/product-review.md +0 -131
  107. package/core/.claude/commands/strategy.md +0 -141
  108. package/core/.claude/commands/sunny.md +0 -1
  109. package/core/.claude/commands//347/224/242/345/223/201/346/252/242/350/246/226.md +0 -129
  110. package/core/.claude/commands//351/200/262/345/272/246.md +0 -15
  111. package/core/.claude/hooks/__tests__/substrate.test.js +0 -122
  112. package/core/.claude/hooks/_substrate-paths.js +0 -95
  113. package/core/.claude/hooks/context-check.js +0 -51
  114. package/core/.claude/hooks/fatigue-check.js +0 -52
  115. package/core/.claude/hooks/handoff-snapshot-on-commit.js +0 -154
  116. package/core/.claude/hooks/handoff-snapshot-on-question.js +0 -158
  117. package/core/.claude/hooks/handoff-staleness.js +0 -197
  118. package/core/.claude/hooks/jev-thalamus-context.js +0 -17
  119. package/core/.claude/hooks/jev-thalamus-context.test.js +0 -41
  120. package/core/.claude/hooks/lease-release.js +0 -119
  121. package/core/.claude/hooks/lease-touch.js +0 -96
  122. package/core/.claude/hooks/reflex-feedback.js +0 -5
  123. package/core/.claude/hooks/session-init.ps1 +0 -49
  124. package/core/.claude/hooks/sound-event.js +0 -70
  125. package/core/.claude/hooks/sound-event.sh +0 -37
  126. package/core/.claude/hooks/stream-delta.js +0 -169
  127. package/core/.claude/no-hooks.settings.json +0 -3
  128. package/core/.claude/skills/legacy_dev/SKILL.md +0 -202
  129. package/core/.claude/skills/sunny/SKILL.md +0 -74
  130. package/core/.collaboration/cli/commands/assign.js +0 -39
  131. package/core/.collaboration/cli/commands/claim.js +0 -33
  132. package/core/.collaboration/cli/commands/complete.js +0 -44
  133. package/core/.collaboration/cli/commands/create.js +0 -110
  134. package/core/.collaboration/cli/commands/get.js +0 -83
  135. package/core/.collaboration/cli/commands/index.js +0 -52
  136. package/core/.collaboration/cli/commands/list.js +0 -51
  137. package/core/.collaboration/cli/commands/lock.js +0 -45
  138. package/core/.collaboration/cli/commands/rebuild.js +0 -39
  139. package/core/.collaboration/cli/commands/search.js +0 -61
  140. package/core/.collaboration/cli/commands/stats.js +0 -61
  141. package/core/.collaboration/cli/commands/transfer.js +0 -41
  142. package/core/.collaboration/cli/commands/unlock.js +0 -48
  143. package/core/.collaboration/cli/formatters/help-formatter.js +0 -70
  144. package/core/.collaboration/cli/formatters/index.js +0 -7
  145. package/core/.collaboration/cli/task-cli.js +0 -46
  146. package/core/.collaboration/cli/utils/arg-parser.js +0 -74
  147. package/core/.collaboration/cli/utils/git-user.js +0 -25
  148. package/core/.collaboration/cli/utils/index.js +0 -9
  149. package/core/.collaboration/cli/utils/output.js +0 -10
  150. package/core/.collaboration/config/default.yaml +0 -189
  151. package/core/.collaboration/core/conflict-resolver.js +0 -461
  152. package/core/.collaboration/core/conflict-resolver.test.js +0 -389
  153. package/core/.collaboration/core/migrate-legacy.js +0 -260
  154. package/core/.collaboration/docs/API.md +0 -787
  155. package/core/.collaboration/docs/ARCHITECTURE.md +0 -596
  156. package/core/.collaboration/docs/FAQ.md +0 -695
  157. package/core/.collaboration/docs/MIGRATION.md +0 -804
  158. package/core/.collaboration/docs/examples/README.md +0 -320
  159. package/core/.collaboration/docs/examples/advanced-queries.js +0 -261
  160. package/core/.collaboration/docs/examples/basic-usage.js +0 -184
  161. package/core/.collaboration/docs/examples/team-workflow.js +0 -352
  162. package/core/.failure/agent-execution/FAIL-001-agent-no-output.yaml +0 -391
  163. package/core/.failure/agent-execution/FAIL-007-pm-lead-wrong-team-invocation.yaml +0 -0
  164. package/core/.failure/agent-execution/FAIL-010-phase0-poem-format-skipped.yaml +0 -28
  165. package/core/.failure/agent-execution/FAIL-010-skipping-cognitive-checkpoint-after-verification.yaml +0 -59
  166. package/core/.failure/agent-execution/FAIL-012-grep-shortcut-during-investigation.yaml +0 -85
  167. package/core/.failure/architecture/FAIL-006-python-version-compatibility.yaml +0 -445
  168. package/core/.failure/pipeline/FAIL-003-queue-pollution.yaml +0 -335
  169. package/core/.failure/pipeline/README.md +0 -95
  170. package/core/.failure/retired/FAIL-009-skipping-synapse-pulse-before-code-change.yaml +0 -49
  171. package/core/.failure/tools/USAGE_GUIDE.md +0 -323
  172. package/core/.failure/tools/check_failures.ps1 +0 -387
  173. package/core/.failure/tools/log_failure.ps1 +0 -474
  174. package/core/.formation/.episode-input.json +0 -10
  175. package/core/.formation/.merge-lock +0 -1
  176. package/core/.formation/lead.yaml +0 -118
  177. package/core/.formation/legacy.bak/designer.yaml +0 -57
  178. package/core/.formation/legacy.bak/pm.yaml +0 -57
  179. package/core/.formation/legacy.bak/qa.yaml +0 -57
  180. package/core/.formation/legacy.bak/review.yaml +0 -62
  181. package/core/.formation/legacy.bak/scheduler.yaml +0 -129
  182. package/core/.formation/legacy.bak/sre.yaml +0 -57
  183. package/core/.formation/role-map.yaml +0 -274
  184. package/core/.formation/roles/_shared/modules/code_review.yaml +0 -98
  185. package/core/.formation/roles/_shared/modules/security.yaml +0 -103
  186. package/core/.formation/roles/_shared/modules/testing.yaml +0 -14
  187. package/core/.formation/roles/backend/role.yaml +0 -93
  188. package/core/.formation/roles/code_reviewer/role.yaml +0 -102
  189. package/core/.formation/roles/database_optimizer/role.yaml +0 -107
  190. package/core/.formation/roles/designer/role.yaml +0 -66
  191. package/core/.formation/roles/developer/role.yaml +0 -75
  192. package/core/.formation/roles/frontend/role.yaml +0 -134
  193. package/core/.formation/roles/incident_response/role.yaml +0 -89
  194. package/core/.formation/roles/qa/role.yaml +0 -89
  195. package/core/.formation/roles/security/role.yaml +0 -87
  196. package/core/.formation/roles/sre/role.yaml +0 -66
  197. package/core/.formation/skills/coordinator.yaml +0 -52
  198. package/core/.formation/solo/diagnosis.yaml +0 -78
  199. package/core/.formation/solo/strategy.yaml +0 -121
  200. package/core/.formation/tests/hello.txt +0 -2
  201. package/core/.formation/tools/coordinator.js +0 -350
  202. package/core/.formation/tools/jev-correction.js +0 -214
  203. package/core/.formation/tools/jev-correction.test.js +0 -178
  204. package/core/.formation/tools/log-reader.js +0 -232
  205. package/core/.formation/tools/revert-daemon-state.js +0 -162
  206. package/core/.formation/tools/test-drift.js +0 -148
  207. package/core/.formation/unit/heimdall.yaml +0 -96
  208. package/core/.formation/unit/plan.yaml +0 -67
  209. package/core/.formation/unit/think.yaml +0 -58
  210. package/core/.kenaz/MUNINN_SNAPSHOT9_EPISODE.json +0 -32
  211. package/core/.kenaz/MUNINN_SNAPSHOT9_RUNE.json +0 -23
  212. package/core/.kenaz/MUNINN_SNAPSHOT9_SUMMARY.md +0 -89
  213. package/core/.kenaz/ash_TASK_1428-20260507.json +0 -14
  214. package/core/.kenaz/muninn_episode_write.ps1 +0 -17
  215. package/core/.kenaz/muninn_snapshot11_rune_candidates.md +0 -63
  216. package/core/.kenaz/muninn_snapshot1_rune_candidates.md +0 -49
  217. package/core/.kenaz/runes_TASK_1428.json +0 -57
  218. package/core/.kenaz/tmp_heimdall_proposal_8d3e392.json +0 -13
  219. package/core/.kenaz/tmp_props.json +0 -1
  220. package/core/.kenaz/tmp_sounddrop_t1_prompt.txt +0 -371
  221. package/core/.rule/MECHANIZED.md +0 -61
  222. package/core/.rule/general/cortex-memory-recall.yaml +0 -446
  223. package/core/.rule/general/pipeline.yaml +0 -246
  224. package/core/.rule/general/sunny-access-control.yaml +0 -60
  225. package/core/.rule/general/system-invariants.yaml +0 -231
  226. package/core/.rule/pipeline/PPL-002-completed-task-archival.yaml +0 -528
  227. package/core/.rule/pipeline/auto-update.yaml +0 -282
  228. package/core/.rule/pipeline/task-execution.yaml +0 -365
  229. package/core/.specialist/Ansuz/concepts/phase_protocol.yaml +0 -65
  230. package/core/.specialist/Ansuz/experiments/boot_ablation_replay.js +0 -197
  231. package/core/.specialist/Ansuz/tools/bootstrap-anchors.js +0 -289
  232. package/core/.specialist/Ansuz/workflow.yaml +0 -1225
  233. package/core/.specialist/experiments/rg_benchmark.js +0 -523
  234. package/core/.specialist/experiments/rg_benchmark_results.json +0 -27
  235. package/core/.specialist/tools/jev-optional-context.js +0 -107
  236. package/core/.specialist/tools/jev-optional-context.test.js +0 -152
  237. package/core/.specialist/tools/memory-action-log.js +0 -839
  238. package/core/.specialist/tools/phase-gate.js +0 -3534
  239. package/core/.specialist/tools/phase-gate.test.js +0 -85
  240. package/core/.specialist/tools/precompute-runner.js +0 -444
  241. package/core/.specialist/tools/rule-engine.js +0 -621
  242. package/core/.specialist/tools/task-bridge-jev.test.js +0 -170
  243. package/core/.synapse/memory-shared.json.sync +0 -1
  244. package/core/.system/agent-skills/README.md +0 -724
  245. package/core/.system/cli-tools/README.md +0 -724
  246. package/core/.system/cortex/MODULES.md +0 -1046
  247. package/core/.system/dashboard/FRONTEND.md +0 -812
  248. package/core/.system/dashboard/README.md +0 -737
  249. package/core/.system/failure/README.md +0 -723
  250. package/core/.system/formation/LEGACY_SKILLS.md +0 -974
  251. package/core/.system/formation/POST_COMPLETE.md +0 -602
  252. package/core/.system/formation/README.md +0 -1094
  253. package/core/.system/formation/TOOLS_REFERENCE.md +0 -1145
  254. package/core/.system/kenaz/README.md +0 -787
  255. package/core/.system/memory/README.md +0 -719
  256. package/core/.system/pipeline/README.md +0 -712
  257. package/core/.system/rule/README.md +0 -794
  258. package/core/.system/sunny/README.md +0 -476
  259. package/core/.system/sunny/RULES.json +0 -89
  260. package/core/.system/sunny/knowledge/INDEX.md +0 -37
  261. package/core/.system/sunny/knowledge/agent-teams-api.md +0 -0
  262. package/core/.system/sunny/knowledge/ansuz-specialist.md +0 -500
  263. package/core/.system/sunny/knowledge/claude-cli-spawn.md +0 -177
  264. package/core/.system/sunny/knowledge/collaboration-api.md +0 -925
  265. package/core/.system/sunny/teammates/README.md +0 -107
  266. package/core/.system/sunny/teammates/how_to_use.yaml +0 -101
  267. package/core/.system/sunny/teammates/tools/headless/launcher.js +0 -318
  268. package/core/.system/sunny/teammates/tools/powershell/launcher.js +0 -241
  269. package/core/.system/sunny/teammates/tools/powershell/start.bat +0 -50
  270. package/core/.system/sunny/teammates/tools/utils/env.js +0 -96
  271. package/core/.system/sunny/teammates/tools/utils/format-output.js +0 -329
  272. package/core/.system/sunny/tools.json +0 -101
  273. package/core/dev/scripts/cleanup-queue.js +0 -184
  274. package/core/dev/scripts/cleanup_queue.js +0 -86
  275. package/core/dev/scripts/legacy/README.md +0 -39
  276. package/core/dev/scripts/legacy/dev_agent_scheduler.ps1.bak +0 -536
  277. package/core/dev/scripts/legacy/multi_agent_scheduler.ps1.bak +0 -1978
  278. package/core/dev/scripts/matrix/CLI_README.md +0 -214
  279. package/core/dev/scripts/matrix/README.md +0 -310
  280. package/core/dev/scripts/matrix/package-lock.json +0 -4266
  281. package/core/dev/scripts/matrix/package.json +0 -55
  282. package/core/dev/scripts/matrix/src/abbreviations.ts +0 -295
  283. package/core/dev/scripts/matrix/src/cli/commands/convert.ts +0 -211
  284. package/core/dev/scripts/matrix/src/cli/commands/create.ts +0 -95
  285. package/core/dev/scripts/matrix/src/cli/commands/delete.ts +0 -102
  286. package/core/dev/scripts/matrix/src/cli/commands/list-tags.ts.wip +0 -140
  287. package/core/dev/scripts/matrix/src/cli/commands/manage-tags.ts.wip +0 -173
  288. package/core/dev/scripts/matrix/src/cli/commands/query.ts +0 -261
  289. package/core/dev/scripts/matrix/src/cli/commands/read.ts +0 -77
  290. package/core/dev/scripts/matrix/src/cli/commands/stats.ts.wip +0 -168
  291. package/core/dev/scripts/matrix/src/cli/commands/tokens.ts.wip +0 -126
  292. package/core/dev/scripts/matrix/src/cli/commands/update.ts +0 -147
  293. package/core/dev/scripts/matrix/src/cli/commands/validate.ts +0 -275
  294. package/core/dev/scripts/matrix/src/cli/index.ts +0 -350
  295. package/core/dev/scripts/matrix/src/cli/utils/file-handler.ts +0 -72
  296. package/core/dev/scripts/matrix/src/cli/utils/logger.ts +0 -65
  297. package/core/dev/scripts/matrix/src/index.ts +0 -62
  298. package/core/dev/scripts/matrix/src/indexer/tag-indexer.ts +0 -165
  299. package/core/dev/scripts/matrix/src/parser.ts +0 -281
  300. package/core/dev/scripts/matrix/src/serializer.ts +0 -151
  301. package/core/dev/scripts/matrix/src/validator.ts +0 -301
  302. package/core/dev/scripts/matrix/tests/abbreviations.test.ts +0 -122
  303. package/core/dev/scripts/matrix/tests/cli.test.ts +0 -177
  304. package/core/dev/scripts/matrix/tests/convert.test.ts +0 -143
  305. package/core/dev/scripts/matrix/tests/parser.test.ts +0 -203
  306. package/core/dev/scripts/matrix/tests/query.test.ts +0 -85
  307. package/core/dev/scripts/matrix/tests/serializer.test.ts +0 -197
  308. package/core/dev/scripts/matrix/tests/validate.test.ts +0 -141
  309. package/core/dev/scripts/matrix/tests/validator.test.ts +0 -167
  310. package/core/dev/scripts/matrix/tsconfig.json +0 -20
  311. package/core/dev/scripts/matrix/types/index.d.ts +0 -111
  312. package/core/dev/scripts/matrix/types/index.d.ts.map +0 -1
  313. package/core/dev/scripts/matrix/types/index.js +0 -8
  314. package/core/dev/scripts/matrix/types/index.js.map +0 -1
  315. package/core/dev/scripts/matrix/types/index.ts +0 -124
  316. package/core/dev/scripts/memory-usage-report.js +0 -152
  317. package/core/dev/scripts/probe/ansuz-scaffold-ablation.js +0 -579
  318. package/core/dev/scripts/probe/ansuz-scaffold-ablation.test.js +0 -244
  319. package/core/dev/scripts/probe/hook-latency-probe.js +0 -315
  320. package/core/dev/scripts/probe/hook-latency-probe.test.js +0 -105
  321. package/core/dev/scripts/probe/prediction-signal-auc.js +0 -483
  322. package/core/dev/scripts/probe/prediction-signal-auc.test.js +0 -200
  323. package/core/dev/scripts/test-pty-ws-tunnel.js +0 -229
  324. package/core/dev/scripts/validate_pipeline.js +0 -197
  325. package/core/dev/spikes/task2145-evidence-20261004/backend-log-excerpt.txt +0 -56
  326. package/core/dev/spikes/task2145-evidence-20261004/graph.shadow +0 -0
  327. package/core/dev/spikes/task2145-evidence-20261004/graph.wal +0 -0
  328. package/core/dev/spikes/task2145-evidence-20261004/graph_corrupt_suspect.marker +0 -1
  329. package/core/plugins/kenaz/commands/strategy.md +0 -141
@@ -1,320 +0,0 @@
1
- # .collaboration 範例程式碼
2
-
3
- 這個目錄包含 .collaboration 系統的可執行範例程式碼,幫助您快速理解如何使用 API。
4
-
5
- ## 範例列表
6
-
7
- | 檔案 | 說明 | 難度 |
8
- |------|------|------|
9
- | [basic-usage.js](./basic-usage.js) | 基本使用範例 - CRUD 操作 | 初級 ⭐ |
10
- | [advanced-queries.js](./advanced-queries.js) | 進階查詢範例 - 複雜過濾與統計 | 中級 ⭐⭐ |
11
- | [team-workflow.js](./team-workflow.js) | 團隊協作範例 - 多用戶工作流程 | 進階 ⭐⭐⭐ |
12
-
13
- ---
14
-
15
- ## basic-usage.js
16
-
17
- **適合**:初次接觸 .collaboration 的開發者
18
-
19
- **涵蓋主題**:
20
- - ✅ 建立任務
21
- - ✅ 查詢任務
22
- - ✅ 認領任務
23
- - ✅ 更新任務
24
- - ✅ 鎖定/解鎖任務
25
- - ✅ 完成任務
26
- - ✅ ID 生成與驗證
27
-
28
- **執行方式**:
29
- ```bash
30
- node .collaboration/docs/examples/basic-usage.js
31
- ```
32
-
33
- **預期輸出**:
34
- ```
35
- =============================================================
36
- 📚 .collaboration 基本使用範例
37
- =============================================================
38
-
39
- 1️⃣ 建立任務
40
- -------------------------------------------------------------
41
- ✅ 任務已建立: TASK_5KPEES80MMXH
42
- 標題: 實作登入功能
43
- 優先級: P1
44
- ...
45
-
46
- 2️⃣ 查詢任務
47
- -------------------------------------------------------------
48
- ✅ 總任務數: 1
49
- Pending: 1
50
- ...
51
- ```
52
-
53
- ---
54
-
55
- ## advanced-queries.js
56
-
57
- **適合**:需要進行複雜查詢和資料分析的開發者
58
-
59
- **涵蓋主題**:
60
- - ✅ 組合查詢(多條件過濾)
61
- - ✅ 使用 JSONL 索引加速查詢
62
- - ✅ 自訂過濾條件
63
- - ✅ 統計分析(按優先級、建立者、完成率)
64
- - ✅ 排序(按時間、優先級)
65
- - ✅ 依賴關係分析
66
- - ✅ 時間範圍查詢
67
-
68
- **執行方式**:
69
- ```bash
70
- node .collaboration/docs/examples/advanced-queries.js
71
- ```
72
-
73
- **預期輸出**:
74
- ```
75
- =============================================================
76
- 🔍 進階查詢範例
77
- =============================================================
78
-
79
- 1️⃣ 組合查詢
80
- -------------------------------------------------------------
81
- ✅ 我的 P0 緊急任務: 2 個
82
- - [TASK_XXX] 修復線上問題
83
- - [TASK_YYY] 緊急部署
84
- ...
85
-
86
- 4️⃣ 統計分析
87
- -------------------------------------------------------------
88
- ✅ 按優先級統計:
89
- P0: 3 個
90
- P1: 5 個
91
- P2: 2 個
92
- ...
93
- ```
94
-
95
- ---
96
-
97
- ## team-workflow.js
98
-
99
- **適合**:需要理解多用戶協作場景的團隊 Lead
100
-
101
- **涵蓋主題**:
102
- - ✅ PM 建立 Sprint 任務並分配
103
- - ✅ 開發者查看自己的任務
104
- - ✅ 並行工作(多個開發者同時工作)
105
- - ✅ 依賴關係管理
106
- - ✅ 緊急任務插隊
107
- - ✅ 團隊進度報告
108
- - ✅ Sprint 回顧與統計
109
-
110
- **執行方式**:
111
- ```bash
112
- node .collaboration/docs/examples/team-workflow.js
113
- ```
114
-
115
- **預期輸出**:
116
- ```
117
- =============================================================
118
- 👥 團隊協作工作流程範例
119
- =============================================================
120
-
121
- 📋 場景 1: PM 建立 Sprint 任務
122
- -------------------------------------------------------------
123
- ✅ PM 建立任務...
124
- - [TASK_AAA] 實作登入頁面 → @zhangsan
125
- - [TASK_BBB] 實作註冊頁面 → @lisi
126
- ...
127
-
128
- 📊 場景 8: 團隊進度報告
129
- -------------------------------------------------------------
130
- ✅ 團隊進度統計:
131
-
132
- @zhangsan:
133
- 總任務: 3
134
- 待辦: 1
135
- 進行中: 1
136
- 已完成: 1
137
- ...
138
-
139
- 📈 整體完成率: 45.5% (5/11)
140
- ```
141
-
142
- ---
143
-
144
- ## 如何使用這些範例
145
-
146
- ### 1. 直接執行
147
-
148
- ```bash
149
- # 執行基本範例
150
- node .collaboration/docs/examples/basic-usage.js
151
-
152
- # 執行進階範例
153
- node .collaboration/docs/examples/advanced-queries.js
154
-
155
- # 執行團隊協作範例
156
- node .collaboration/docs/examples/team-workflow.js
157
- ```
158
-
159
- ---
160
-
161
- ### 2. 作為參考代碼
162
-
163
- 複製範例代碼到您的專案中並修改:
164
-
165
- ```javascript
166
- // 從範例複製
167
- const { TaskAPI } = require('./.collaboration/core/task-api.js');
168
-
169
- // 在您的程式碼中使用
170
- async function myFunction() {
171
- const api = new TaskAPI();
172
-
173
- // 建立任務
174
- const task = await api.createTask({
175
- title: '我的任務',
176
- priority: 'P1'
177
- });
178
-
179
- console.log(`任務已建立: ${task.id}`);
180
- }
181
- ```
182
-
183
- ---
184
-
185
- ### 3. 整合到測試
186
-
187
- ```javascript
188
- // test/task-api.test.js
189
- const { TaskAPI } = require('../.collaboration/core/task-api.js');
190
-
191
- describe('TaskAPI', () => {
192
- it('should create task', async () => {
193
- const api = new TaskAPI();
194
- const task = await api.createTask({
195
- title: '測試任務',
196
- priority: 'P1'
197
- });
198
-
199
- expect(task.id).toMatch(/^TASK_[A-Z0-9]{10}$/);
200
- expect(task.title).toBe('測試任務');
201
- });
202
- });
203
- ```
204
-
205
- ---
206
-
207
- ## 範例資料
208
-
209
- 範例執行時會自動建立和清理任務,不會影響您的實際任務資料。
210
-
211
- **自動清理**:
212
- - 所有範例在執行結束時會刪除建立的任務
213
- - 不會影響現有任務
214
- - 可以安全地重複執行
215
-
216
- ---
217
-
218
- ## 學習路徑
219
-
220
- 建議按以下順序學習:
221
-
222
- 1. **第 1 天**:執行 `basic-usage.js`,理解基本 CRUD 操作
223
- 2. **第 2 天**:執行 `advanced-queries.js`,學習複雜查詢
224
- 3. **第 3 天**:執行 `team-workflow.js`,理解團隊協作場景
225
-
226
- ---
227
-
228
- ## 疑難排解
229
-
230
- ### 範例執行失敗
231
-
232
- **錯誤訊息**:`Cannot find module`
233
-
234
- **解決方案**:
235
- ```bash
236
- # 確認在專案根目錄
237
- pwd
238
-
239
- # 確認文件存在
240
- ls .collaboration/core/task-api.js
241
-
242
- # 使用絕對路徑執行
243
- node "$(pwd)/.collaboration/docs/examples/basic-usage.js"
244
- ```
245
-
246
- ---
247
-
248
- ### 權限錯誤
249
-
250
- **錯誤訊息**:`EACCES: permission denied`
251
-
252
- **解決方案**:
253
- ```bash
254
- # 賦予執行權限
255
- chmod +x .collaboration/docs/examples/*.js
256
-
257
- # 再次執行
258
- node .collaboration/docs/examples/basic-usage.js
259
- ```
260
-
261
- ---
262
-
263
- ## 進階自訂
264
-
265
- ### 修改範例以使用真實資料
266
-
267
- 如果您想讓範例不刪除任務(用於測試):
268
-
269
- ```javascript
270
- // 在範例末尾註解掉清理代碼
271
- // await api.deleteTask(task1.id); // 註解這一行
272
-
273
- // 或設置環境變數
274
- if (process.env.KEEP_EXAMPLE_DATA !== 'true') {
275
- await api.deleteTask(task1.id);
276
- }
277
- ```
278
-
279
- ---
280
-
281
- ### 整合到 CI/CD
282
-
283
- ```yaml
284
- # .github/workflows/examples.yml
285
- name: Examples
286
-
287
- on: [push]
288
-
289
- jobs:
290
- run-examples:
291
- runs-on: ubuntu-latest
292
- steps:
293
- - uses: actions/checkout@v2
294
- - uses: actions/setup-node@v2
295
- with:
296
- node-version: '14'
297
-
298
- - name: Run Basic Example
299
- run: node .collaboration/docs/examples/basic-usage.js
300
-
301
- - name: Run Advanced Example
302
- run: node .collaboration/docs/examples/advanced-queries.js
303
-
304
- - name: Run Team Workflow
305
- run: node .collaboration/docs/examples/team-workflow.js
306
- ```
307
-
308
- ---
309
-
310
- ## 相關文檔
311
-
312
- - [API 參考文檔](../API.md) - 完整 API 文檔
313
- - [CLI 使用指南](../CLI.md) - 命令列工具
314
- - [常見問題](../FAQ.md) - 疑難排解
315
-
316
- ---
317
-
318
- **版本**: 1.0.0
319
- **最後更新**: 2026-02-11
320
- **維護者**: Developer Team
@@ -1,261 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * advanced-queries.js
4
- * 進階查詢範例 - 展示複雜的任務查詢和過濾
5
- *
6
- * 執行方式:
7
- * node .collaboration/docs/examples/advanced-queries.js
8
- */
9
-
10
- const { TaskAPI } = require('../../core/task-api.js');
11
- const { IndexManager } = require('../../core/index-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 indexMgr = new IndexManager();
20
-
21
- // ============================================================================
22
- // 1. 組合查詢
23
- // ============================================================================
24
-
25
- console.log('\n1️⃣ 組合查詢');
26
- console.log('-'.repeat(60));
27
-
28
- // 查詢我的 P0 緊急任務
29
- const myUrgent = await api.queryTasks({
30
- priority: 'P0',
31
- assigned_to: 'zhangsan',
32
- status: 'in_progress'
33
- });
34
-
35
- console.log(`✅ 我的 P0 緊急任務: ${myUrgent.length} 個`);
36
- myUrgent.forEach(task => {
37
- console.log(` - [${task.id}] ${task.title}`);
38
- });
39
-
40
- // ============================================================================
41
- // 2. 使用索引快速查詢
42
- // ============================================================================
43
-
44
- console.log('\n2️⃣ 使用索引快速查詢');
45
- console.log('-'.repeat(60));
46
-
47
- // 按狀態查詢
48
- const pendingIds = await indexMgr.getByStatus('pending');
49
- console.log(`✅ Pending 任務 ID: ${pendingIds.length} 個`);
50
-
51
- // 按用戶查詢
52
- const userIds = await indexMgr.getByUser('zhangsan');
53
- console.log(`✅ zhangsan 的任務: ${userIds.length} 個`);
54
-
55
- // 按優先級查詢
56
- const p0Ids = await indexMgr.getByPriority('P0');
57
- console.log(`✅ P0 任務: ${p0Ids.length} 個`);
58
-
59
- // ============================================================================
60
- // 3. 自訂過濾條件
61
- // ============================================================================
62
-
63
- console.log('\n3️⃣ 自訂過濾條件');
64
- console.log('-'.repeat(60));
65
-
66
- const allData = await api.getAllTasks();
67
-
68
- // 過濾本週建立的任務
69
- const weekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
70
- const thisWeekTasks = allData.tasks.filter(task => {
71
- const createdAt = new Date(task.created_by.timestamp);
72
- return createdAt > weekAgo;
73
- });
74
-
75
- console.log(`✅ 本週建立的任務: ${thisWeekTasks.length} 個`);
76
-
77
- // 過濾預估工時 > 4 小時的任務
78
- const longTasks = allData.tasks.filter(task => {
79
- return task.estimated_hours && task.estimated_hours > 4;
80
- });
81
-
82
- console.log(`✅ 預估 > 4 小時的任務: ${longTasks.length} 個`);
83
-
84
- // 過濾有依賴的任務
85
- const tasksWithDeps = allData.tasks.filter(task => {
86
- return task.dependencies && task.dependencies.length > 0;
87
- });
88
-
89
- console.log(`✅ 有依賴的任務: ${tasksWithDeps.length} 個`);
90
-
91
- // ============================================================================
92
- // 4. 統計分析
93
- // ============================================================================
94
-
95
- console.log('\n4️⃣ 統計分析');
96
- console.log('-'.repeat(60));
97
-
98
- // 按優先級統計
99
- const priorityStats = {};
100
- allData.tasks.forEach(task => {
101
- priorityStats[task.priority] = (priorityStats[task.priority] || 0) + 1;
102
- });
103
-
104
- console.log('✅ 按優先級統計:');
105
- Object.entries(priorityStats).forEach(([priority, count]) => {
106
- console.log(` ${priority}: ${count} 個`);
107
- });
108
-
109
- // 按建立者統計
110
- const creatorStats = {};
111
- allData.tasks.forEach(task => {
112
- const creator = task.created_by.git_user;
113
- creatorStats[creator] = (creatorStats[creator] || 0) + 1;
114
- });
115
-
116
- console.log('\n✅ 按建立者統計:');
117
- Object.entries(creatorStats)
118
- .sort((a, b) => b[1] - a[1]) // 按數量排序
119
- .forEach(([user, count]) => {
120
- console.log(` @${user}: ${count} 個`);
121
- });
122
-
123
- // 完成率統計
124
- const completedCount = allData.statistics.completed;
125
- const totalCount = allData.statistics.total;
126
- const completionRate = ((completedCount / totalCount) * 100).toFixed(1);
127
-
128
- console.log(`\n✅ 完成率: ${completionRate}% (${completedCount}/${totalCount})`);
129
-
130
- // ============================================================================
131
- // 5. 排序
132
- // ============================================================================
133
-
134
- console.log('\n5️⃣ 排序');
135
- console.log('-'.repeat(60));
136
-
137
- // 按建立時間排序(最新優先)
138
- const sortedByTime = [...allData.tasks].sort((a, b) => {
139
- return new Date(b.created_by.timestamp) - new Date(a.created_by.timestamp);
140
- });
141
-
142
- console.log('✅ 最近建立的 3 個任務:');
143
- sortedByTime.slice(0, 3).forEach(task => {
144
- console.log(` - [${task.id}] ${task.title} (${task.created_by.timestamp})`);
145
- });
146
-
147
- // 按優先級排序(P0 > P1 > P2 > P3)
148
- const priorityOrder = { 'P0': 0, 'P1': 1, 'P2': 2, 'P3': 3 };
149
- const sortedByPriority = [...allData.tasks].sort((a, b) => {
150
- return priorityOrder[a.priority] - priorityOrder[b.priority];
151
- });
152
-
153
- console.log('\n✅ 最高優先級的 3 個任務:');
154
- sortedByPriority.slice(0, 3).forEach(task => {
155
- console.log(` - [${task.id}] ${task.title} (${task.priority})`);
156
- });
157
-
158
- // ============================================================================
159
- // 6. 複雜過濾:組合多個條件
160
- // ============================================================================
161
-
162
- console.log('\n6️⃣ 複雜過濾');
163
- console.log('-'.repeat(60));
164
-
165
- // 找出:P0/P1、未完成、有人認領、無阻塞的任務
166
- const urgentActive = allData.tasks.filter(task => {
167
- return (task.priority === 'P0' || task.priority === 'P1') &&
168
- task.status !== 'completed' &&
169
- task.status !== 'blocked' &&
170
- task.assigned_to !== null;
171
- });
172
-
173
- console.log(`✅ 高優先級進行中任務: ${urgentActive.length} 個`);
174
- urgentActive.forEach(task => {
175
- console.log(` - [${task.id}] ${task.title}`);
176
- console.log(` 優先級: ${task.priority} | 狀態: ${task.status} | 負責人: ${task.assigned_to.name}`);
177
- });
178
-
179
- // ============================================================================
180
- // 7. 依賴關係分析
181
- // ============================================================================
182
-
183
- console.log('\n7️⃣ 依賴關係分析');
184
- console.log('-'.repeat(60));
185
-
186
- // 找出所有被依賴的任務
187
- const dependedTasks = new Set();
188
- allData.tasks.forEach(task => {
189
- if (task.dependencies) {
190
- task.dependencies.forEach(depId => dependedTasks.add(depId));
191
- }
192
- });
193
-
194
- console.log(`✅ 被依賴的任務數: ${dependedTasks.size} 個`);
195
-
196
- // 找出可以立即開始的任務(無依賴或依賴已完成)
197
- const readyTasks = [];
198
- for (const task of allData.tasks) {
199
- if (task.status === 'pending') {
200
- if (!task.dependencies || task.dependencies.length === 0) {
201
- readyTasks.push(task);
202
- } else {
203
- // 檢查依賴是否全部完成
204
- const allDepsCompleted = await Promise.all(
205
- task.dependencies.map(async depId => {
206
- const depTask = await api.getTask(depId);
207
- return depTask && depTask.status === 'completed';
208
- })
209
- );
210
-
211
- if (allDepsCompleted.every(completed => completed)) {
212
- readyTasks.push(task);
213
- }
214
- }
215
- }
216
- }
217
-
218
- console.log(`\n✅ 可以立即開始的任務: ${readyTasks.length} 個`);
219
- readyTasks.forEach(task => {
220
- console.log(` - [${task.id}] ${task.title} (${task.priority})`);
221
- });
222
-
223
- // ============================================================================
224
- // 8. 時間範圍查詢
225
- // ============================================================================
226
-
227
- console.log('\n8️⃣ 時間範圍查詢');
228
- console.log('-'.repeat(60));
229
-
230
- // 今天建立的任務
231
- const today = new Date().toISOString().split('T')[0];
232
- const todayTasks = allData.tasks.filter(task => {
233
- return task.created_by.timestamp.startsWith(today);
234
- });
235
-
236
- console.log(`✅ 今天建立的任務: ${todayTasks.length} 個`);
237
-
238
- // 本月完成的任務
239
- const thisMonth = new Date().toISOString().slice(0, 7); // YYYY-MM
240
- const thisMonthCompleted = allData.tasks.filter(task => {
241
- return task.status === 'completed' &&
242
- task.executed_by?.timestamp.startsWith(thisMonth);
243
- });
244
-
245
- console.log(`✅ 本月完成的任務: ${thisMonthCompleted.length} 個`);
246
-
247
- console.log('\n' + '='.repeat(60));
248
- console.log('✅ 範例執行完成!');
249
- console.log('='.repeat(60));
250
- }
251
-
252
- // 執行範例
253
- if (require.main === module) {
254
- main().catch(error => {
255
- console.error('❌ 執行失敗:', error.message);
256
- console.error(error.stack);
257
- process.exit(1);
258
- });
259
- }
260
-
261
- module.exports = { main };