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,55 +0,0 @@
1
- {
2
- "name": "@kenaz/matrix-parser",
3
- "version": "1.0.0",
4
- "description": ".matrix format parser and serializer",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "bin": {
8
- "matrix": "./dist/cli/index.js"
9
- },
10
- "scripts": {
11
- "build": "tsc",
12
- "test": "jest",
13
- "test:coverage": "jest --coverage",
14
- "test:watch": "jest --watch"
15
- },
16
- "keywords": [
17
- "matrix",
18
- "parser",
19
- "serializer",
20
- "kenaz",
21
- "cli"
22
- ],
23
- "author": "Developer Team",
24
- "license": "MIT",
25
- "dependencies": {
26
- "commander": "^11.1.0",
27
- "inquirer": "^9.2.0",
28
- "chalk": "^4.1.2"
29
- },
30
- "devDependencies": {
31
- "@types/inquirer": "^9.0.0",
32
- "@types/jest": "^29.5.0",
33
- "@types/node": "^20.0.0",
34
- "jest": "^29.5.0",
35
- "ts-jest": "^29.1.0",
36
- "typescript": "^5.0.0"
37
- },
38
- "jest": {
39
- "preset": "ts-jest",
40
- "testEnvironment": "node",
41
- "coverageThreshold": {
42
- "global": {
43
- "branches": 90,
44
- "functions": 90,
45
- "lines": 90,
46
- "statements": 90
47
- }
48
- },
49
- "collectCoverageFrom": [
50
- "src/**/*.ts",
51
- "!src/**/*.d.ts",
52
- "!src/**/index.ts"
53
- ]
54
- }
55
- }
@@ -1,295 +0,0 @@
1
- /**
2
- * .matrix 格式縮寫映射表
3
- * 從 dev/design/matrix_format_ABBREVIATIONS.md 自動生成
4
- * @version 1.0.0
5
- */
6
-
7
- /**
8
- * 欄位名縮寫映射(完整名 → 縮寫)
9
- */
10
- export const FIELD_ABBREVIATIONS: Record<string, string> = {
11
- // A. 狀態與優先級
12
- status: 'st',
13
- priority: 'p',
14
- active: 'act',
15
- blocked: 'b',
16
- blocked_by: 'blk',
17
- completed: 'c',
18
- in_progress: 'p',
19
- pending: 'pd',
20
- cancelled: 'x',
21
-
22
- // B. 時間相關
23
- time: 't',
24
- timestamp: 'ts',
25
- created_at: 'ct',
26
- updated_at: 'ut',
27
- completed_at: 'cmplt',
28
- started_at: 'start',
29
- duration: 'dur',
30
- duration_minutes: 'dur',
31
- estimated_hours: 'est',
32
- actual_hours: 'act_h',
33
- date: 'd',
34
- range: 'r',
35
-
36
- // C. 識別與類型
37
- id: 'i',
38
- task_id: 'tid',
39
- feature_id: 'fid',
40
- type: 'ty',
41
- category: 'cat',
42
- tag: 'tg',
43
- label: 'lbl',
44
- version: 'v',
45
- name: 'n',
46
- title: 'tt',
47
-
48
- // D. 團隊與角色
49
- agent: 'ag',
50
- agent_type: 'ag',
51
- assignee: 'asn',
52
- assigned_to: 'asn',
53
- created_by: 'cb',
54
- team: 'tm',
55
- owner: 'own',
56
- reviewer: 'rev',
57
-
58
- // E. 數值與統計
59
- count: 'c',
60
- total: 'tot',
61
- entries: 'e',
62
- success_rate: 'succ',
63
- percentage: 'pct',
64
- score: 'sc',
65
- weight: 'w',
66
- rank: 'rk',
67
- index: 'idx',
68
-
69
- // F. 關係與依賴
70
- dependencies: 'dep',
71
- depends_on: 'dep',
72
- parent: 'par',
73
- children: 'ch',
74
- related: 'rel',
75
- linked_to: 'lnk',
76
- references: 'ref',
77
-
78
- // G. 內容與描述
79
- description: 'd',
80
- note: 'note',
81
- comment: 'cmt',
82
- message: 'msg',
83
- summary: 'sum',
84
- reason: 'rsn',
85
- details: 'dtl',
86
-
87
- // H. 專案與配置
88
- project: 'proj',
89
- repository: 'repo',
90
- branch: 'br',
91
- commit: 'cmt',
92
- environment: 'env',
93
- path: 'pth',
94
- file: 'f',
95
- scope: 'scp',
96
-
97
- // I. 標誌與狀態
98
- enabled: 'en',
99
- visible: 'vis',
100
- locked: 'lck',
101
- archived: 'arc',
102
- deleted: 'del',
103
- draft: 'drf',
104
- published: 'pub',
105
- verified: 'vrf',
106
-
107
- // J. 其他常用
108
- source: 'src',
109
- target: 'tgt',
110
- format: 'fmt',
111
- size: 'sz',
112
- level: 'lvl',
113
- complexity: 'cplx',
114
- error: 'err',
115
- result: 'res',
116
- };
117
-
118
- /**
119
- * 欄位名反向映射(縮寫 → 完整名)
120
- */
121
- export const FIELD_EXPANSIONS: Record<string, string> = Object.fromEntries(
122
- Object.entries(FIELD_ABBREVIATIONS).map(([key, value]) => [value, key])
123
- );
124
-
125
- /**
126
- * 值代碼映射
127
- */
128
- export const VALUE_CODES = {
129
- status: {
130
- completed: 'C',
131
- in_progress: 'P',
132
- pending: 'D',
133
- blocked: 'B',
134
- cancelled: 'X',
135
- review: 'R',
136
- testing: 'T',
137
- deployed: 'Y',
138
- failed: 'F',
139
- },
140
- priority: {
141
- P0: '0',
142
- P1: '1',
143
- P2: '2',
144
- P3: '3',
145
- },
146
- complexity: {
147
- simple: 'S',
148
- moderate: 'M',
149
- complex: 'C',
150
- very_complex: 'V',
151
- },
152
- environment: {
153
- development: 'dev',
154
- staging: 'stg',
155
- production: 'prod',
156
- local: 'loc',
157
- },
158
- agent_type: {
159
- product_manager: 'pm',
160
- developer: 'dev',
161
- backend_engineer: 'be',
162
- frontend_engineer: 'fe',
163
- designer: 'des',
164
- qa_engineer: 'qa',
165
- sre_agent: 'sre',
166
- dev_agent: 'deva',
167
- },
168
- category: {
169
- feature: 'feat',
170
- bug: 'bug',
171
- documentation: 'doc',
172
- refactor: 'ref',
173
- test: 'test',
174
- chore: 'cho',
175
- performance: 'perf',
176
- security: 'sec',
177
- design: 'des',
178
- architecture: 'arch',
179
- },
180
- boolean: {
181
- true: '1',
182
- false: '0',
183
- yes: '1',
184
- no: '0',
185
- },
186
- result: {
187
- success: 'OK',
188
- failure: 'FAIL',
189
- error: 'ERR',
190
- timeout: 'TO',
191
- skipped: 'SKIP',
192
- },
193
- blocked_by: {
194
- API_DOWN: 'API_DOWN',
195
- REVIEW_PENDING: 'REVIEW',
196
- DEPENDENCY: 'DEP',
197
- WAITING_INPUT: 'INPUT',
198
- RESOURCE_UNAVAILABLE: 'RES',
199
- EXTERNAL: 'EXT',
200
- },
201
- };
202
-
203
- /**
204
- * 值代碼反向映射
205
- */
206
- export const VALUE_EXPANSIONS: Record<string, Record<string, string>> = {};
207
- for (const [field, codes] of Object.entries(VALUE_CODES)) {
208
- VALUE_EXPANSIONS[field] = Object.fromEntries(
209
- Object.entries(codes).map(([key, value]) => [value, key])
210
- );
211
- }
212
-
213
- /**
214
- * 縮寫欄位名
215
- * @param fieldName 完整欄位名
216
- * @returns 縮寫名稱(如果存在映射)
217
- */
218
- export function abbreviateField(fieldName: string): string {
219
- return FIELD_ABBREVIATIONS[fieldName] || fieldName;
220
- }
221
-
222
- /**
223
- * 展開欄位名
224
- * @param abbr 縮寫名稱
225
- * @returns 完整欄位名(如果存在映射)
226
- */
227
- export function expandField(abbr: string): string {
228
- return FIELD_EXPANSIONS[abbr] || abbr;
229
- }
230
-
231
- /**
232
- * 編碼值
233
- * @param field 欄位名
234
- * @param value 原始值
235
- * @returns 編碼後的值
236
- */
237
- export function encodeValue(field: string, value: any): string {
238
- if (field in VALUE_CODES) {
239
- const codes = VALUE_CODES[field as keyof typeof VALUE_CODES];
240
- return codes[String(value) as keyof typeof codes] || String(value);
241
- }
242
- return String(value);
243
- }
244
-
245
- /**
246
- * 解碼值
247
- * @param field 欄位名
248
- * @param code 代碼
249
- * @returns 解碼後的值
250
- */
251
- export function decodeValue(field: string, code: string): any {
252
- if (field in VALUE_EXPANSIONS) {
253
- const expansions = VALUE_EXPANSIONS[field];
254
- return expansions[code] || code;
255
- }
256
- return code;
257
- }
258
-
259
- /**
260
- * 縮短時間戳
261
- * @param isoTimestamp ISO 8601 時間戳
262
- * @returns YYMMDD-HHMM 格式
263
- */
264
- export function shortenTimestamp(isoTimestamp: string): string {
265
- const dt = new Date(isoTimestamp);
266
- const year = String(dt.getFullYear()).slice(-2);
267
- const month = String(dt.getMonth() + 1).padStart(2, '0');
268
- const day = String(dt.getDate()).padStart(2, '0');
269
- const hour = String(dt.getHours()).padStart(2, '0');
270
- const minute = String(dt.getMinutes()).padStart(2, '0');
271
- return `${year}${month}${day}-${hour}${minute}`;
272
- }
273
-
274
- /**
275
- * 展開時間戳
276
- * @param shortTs YYMMDD-HHMM 格式
277
- * @returns ISO 8601 時間戳
278
- */
279
- export function expandTimestamp(shortTs: string): string {
280
- if (shortTs.includes('-')) {
281
- const [datePart, timePart] = shortTs.split('-');
282
- const yy = datePart.slice(0, 2);
283
- const mm = datePart.slice(2, 4);
284
- const dd = datePart.slice(4, 6);
285
- const hh = timePart.slice(0, 2);
286
- const mn = timePart.slice(2, 4);
287
- return `20${yy}-${mm}-${dd}T${hh}:${mn}:00Z`;
288
- } else {
289
- // 僅日期
290
- const yy = shortTs.slice(0, 2);
291
- const mm = shortTs.slice(2, 4);
292
- const dd = shortTs.slice(4, 6);
293
- return `20${yy}-${mm}-${dd}`;
294
- }
295
- }
@@ -1,211 +0,0 @@
1
- /**
2
- * Convert command - 轉換 .matrix 和 JSON 格式
3
- * 支援 JSON ↔ .matrix 雙向轉換
4
- */
5
-
6
- import * as fs from 'fs';
7
- import * as path from 'path';
8
- import { MatrixParser } from '../../parser';
9
- import { MatrixSerializer } from '../../serializer';
10
- import { log, error as logError } from '../utils/logger';
11
- import type { MatrixFile } from '../../../types';
12
-
13
- interface ConvertOptions {
14
- from?: 'json' | 'matrix';
15
- to?: 'json' | 'matrix';
16
- }
17
-
18
- /**
19
- * Convert command handler
20
- */
21
- export async function convertCommand(input: string, output: string, options: ConvertOptions): Promise<void> {
22
- try {
23
- // 自動偵測格式(如果未指定)
24
- const fromFormat = options.from || detectFormat(input);
25
- const toFormat = options.to || detectFormat(output);
26
-
27
- // 驗證格式
28
- if (fromFormat === toFormat) {
29
- throw new Error(`Input and output formats are the same (${fromFormat}). Nothing to convert.`);
30
- }
31
-
32
- if (fromFormat !== 'json' && fromFormat !== 'matrix') {
33
- throw new Error(`Unsupported input format: ${fromFormat}. Use --from json or --from matrix.`);
34
- }
35
-
36
- if (toFormat !== 'json' && toFormat !== 'matrix') {
37
- throw new Error(`Unsupported output format: ${toFormat}. Use --to json or --to matrix.`);
38
- }
39
-
40
- // 檢查輸入文件是否存在
41
- if (!fs.existsSync(input)) {
42
- throw new Error(`Input file not found: ${input}`);
43
- }
44
-
45
- // 執行轉換
46
- if (fromFormat === 'matrix' && toFormat === 'json') {
47
- matrixToJSON(input, output);
48
- } else if (fromFormat === 'json' && toFormat === 'matrix') {
49
- jsonToMatrix(input, output);
50
- }
51
-
52
- log(`✅ Conversion complete: ${input} → ${output}`);
53
- log(` Format: ${fromFormat} → ${toFormat}`);
54
-
55
- } catch (err) {
56
- logError((err as Error).message);
57
- throw err;
58
- }
59
- }
60
-
61
- /**
62
- * 自動偵測文件格式
63
- */
64
- function detectFormat(filePath: string): 'json' | 'matrix' | 'unknown' {
65
- const ext = path.extname(filePath).toLowerCase();
66
-
67
- if (ext === '.json') return 'json';
68
- if (ext === '.matrix') return 'matrix';
69
-
70
- // 無擴展名時,嘗試讀取文件內容判斷
71
- if (fs.existsSync(filePath)) {
72
- const content = fs.readFileSync(filePath, 'utf-8').trim();
73
- if (content.startsWith('{') || content.startsWith('[')) {
74
- return 'json';
75
- }
76
- if (content.includes('@meta') || content.includes('@index')) {
77
- return 'matrix';
78
- }
79
- }
80
-
81
- return 'unknown';
82
- }
83
-
84
- /**
85
- * .matrix → JSON
86
- */
87
- function matrixToJSON(inputPath: string, outputPath: string): void {
88
- // 讀取並解析 .matrix 文件
89
- const content = fs.readFileSync(inputPath, 'utf-8');
90
- const parser = new MatrixParser();
91
- const parseResult = parser.parse(content);
92
-
93
- if (!parseResult.success || !parseResult.data) {
94
- throw new Error(`Failed to parse .matrix file: ${parseResult.error?.message || 'Unknown error'}`);
95
- }
96
-
97
- const matrixFile = parseResult.data;
98
-
99
- // 轉換為 JSON 格式(保留所有元數據)
100
- const jsonData = convertMatrixToJSONObject(matrixFile);
101
-
102
- // 寫入 JSON 文件
103
- const jsonStr = JSON.stringify(jsonData, null, 2);
104
- fs.writeFileSync(outputPath, jsonStr, 'utf-8');
105
-
106
- log(`📄 Converted .matrix to JSON`);
107
- log(` Records: ${matrixFile.data?.records.length || 0}`);
108
- }
109
-
110
- /**
111
- * JSON → .matrix
112
- */
113
- function jsonToMatrix(inputPath: string, outputPath: string): void {
114
- // 讀取 JSON 文件
115
- const content = fs.readFileSync(inputPath, 'utf-8');
116
- let jsonData: any;
117
-
118
- try {
119
- jsonData = JSON.parse(content);
120
- } catch (err) {
121
- throw new Error(`Invalid JSON file: ${(err as Error).message}`);
122
- }
123
-
124
- // 轉換為 MatrixFile 格式
125
- const matrixFile = convertJSONObjectToMatrix(jsonData);
126
-
127
- // 序列化為 .matrix 格式
128
- const serializer = new MatrixSerializer({ pretty: true, includeComment: true });
129
- const matrixContent = serializer.serialize(matrixFile);
130
-
131
- // 寫入 .matrix 文件
132
- fs.writeFileSync(outputPath, matrixContent, 'utf-8');
133
-
134
- log(`📄 Converted JSON to .matrix`);
135
- log(` Records: ${matrixFile.data?.records.length || 0}`);
136
- }
137
-
138
- /**
139
- * 將 MatrixFile 轉換為 JSON 物件
140
- */
141
- function convertMatrixToJSONObject(matrixFile: MatrixFile): any {
142
- const result: any = {
143
- version: matrixFile.meta.v || matrixFile.meta.version,
144
- category: matrixFile.meta.c || matrixFile.meta.category,
145
- metadata: {},
146
- statistics: {},
147
- records: [],
148
- };
149
-
150
- // 保留 meta 中的額外欄位
151
- for (const [key, value] of Object.entries(matrixFile.meta)) {
152
- if (key !== 'v' && key !== 'version' && key !== 'c' && key !== 'category') {
153
- result.metadata[key] = value;
154
- }
155
- }
156
-
157
- // 保留 index 中的統計數據
158
- result.statistics = { ...matrixFile.index };
159
-
160
- // 轉換 data records
161
- if (matrixFile.data && matrixFile.data.records) {
162
- result.records = matrixFile.data.records.map(record => ({
163
- id: record.id,
164
- ...record.fields,
165
- }));
166
- }
167
-
168
- return result;
169
- }
170
-
171
- /**
172
- * 將 JSON 物件轉換為 MatrixFile
173
- */
174
- function convertJSONObjectToMatrix(jsonData: any): MatrixFile {
175
- // 驗證必要欄位
176
- if (!jsonData.version && !jsonData.meta?.v) {
177
- throw new Error('JSON must contain "version" field');
178
- }
179
-
180
- if (!jsonData.category && !jsonData.meta?.c) {
181
- throw new Error('JSON must contain "category" field');
182
- }
183
-
184
- // 建立 MatrixFile
185
- const matrixFile: MatrixFile = {
186
- meta: {
187
- v: jsonData.version || jsonData.meta?.v,
188
- c: jsonData.category || jsonData.meta?.c,
189
- ...jsonData.metadata,
190
- },
191
- index: {
192
- ...jsonData.statistics,
193
- tot: jsonData.records?.length || 0,
194
- },
195
- };
196
-
197
- // 轉換 records
198
- if (jsonData.records && Array.isArray(jsonData.records)) {
199
- matrixFile.data = {
200
- records: jsonData.records.map((record: any) => {
201
- const { id, ...fields } = record;
202
- if (!id) {
203
- throw new Error('Each record must have an "id" field');
204
- }
205
- return { id, fields };
206
- }),
207
- };
208
- }
209
-
210
- return matrixFile;
211
- }
@@ -1,95 +0,0 @@
1
- /**
2
- * matrix create command
3
- * Creates a new .matrix file with interactive prompts or CLI parameters
4
- */
5
-
6
- import inquirer from 'inquirer';
7
- import { MatrixSerializer } from '../../serializer';
8
- import type { MatrixFile } from '../../../types';
9
- import { Logger } from '../utils/logger';
10
- import { FileHandler } from '../utils/file-handler';
11
-
12
- interface CreateOptions {
13
- version?: string;
14
- category?: string;
15
- interactive?: boolean;
16
- }
17
-
18
- export async function createCommand(filePath: string, options: CreateOptions): Promise<void> {
19
- Logger.header('Create .matrix File');
20
-
21
- // Ensure .matrix extension
22
- const targetPath = FileHandler.ensureExtension(filePath);
23
-
24
- // Check if file exists
25
- if (FileHandler.exists(targetPath)) {
26
- Logger.error(`File already exists: ${targetPath}`);
27
- Logger.info('Use "matrix update" to modify existing files');
28
- process.exit(1);
29
- }
30
-
31
- let version = options.version;
32
- let category = options.category;
33
-
34
- // Interactive mode
35
- if (options.interactive || (!version || !category)) {
36
- const answers = await inquirer.prompt([
37
- {
38
- type: 'input',
39
- name: 'version',
40
- message: 'Version:',
41
- default: version || '1.0.0',
42
- validate: (input: string) => input.trim().length > 0 || 'Version is required',
43
- },
44
- {
45
- type: 'list',
46
- name: 'category',
47
- message: 'Category:',
48
- choices: [
49
- { name: 'Tasks (T)', value: 'T' },
50
- { name: 'Memory (M)', value: 'M' },
51
- { name: 'Rules (R)', value: 'R' },
52
- { name: 'Project Status (P)', value: 'P' },
53
- { name: 'Custom', value: 'custom' },
54
- ],
55
- default: category,
56
- },
57
- {
58
- type: 'input',
59
- name: 'customCategory',
60
- message: 'Enter custom category:',
61
- when: (answers: any) => answers.category === 'custom',
62
- validate: (input: string) => input.trim().length > 0 || 'Category is required',
63
- },
64
- ]);
65
-
66
- version = answers.version;
67
- category = answers.category === 'custom' ? answers.customCategory : answers.category;
68
- }
69
-
70
- // Create matrix file structure
71
- const matrixFile: MatrixFile = {
72
- meta: {
73
- v: version!,
74
- c: category!,
75
- },
76
- index: {
77
- n: 0, // rule count
78
- },
79
- data: {
80
- records: [],
81
- },
82
- };
83
-
84
- // Serialize and write
85
- const serializer = new MatrixSerializer();
86
- const content = serializer.serialize(matrixFile);
87
-
88
- if (FileHandler.write(targetPath, content)) {
89
- Logger.success(`Created: ${targetPath}`);
90
- Logger.field('Version', version);
91
- Logger.field('Category', category);
92
- } else {
93
- process.exit(1);
94
- }
95
- }