triflux 10.0.0 → 10.0.2

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 (426) hide show
  1. package/CLAUDE.md +171 -0
  2. package/README.md +32 -15
  3. package/bin/triflux.mjs +62 -5
  4. package/hooks/agent-route-guard.mjs +109 -0
  5. package/hooks/cross-review-tracker.mjs +122 -0
  6. package/hooks/error-context.mjs +148 -0
  7. package/hooks/hook-adaptive-collector.mjs +86 -0
  8. package/hooks/hook-manager.mjs +365 -0
  9. package/hooks/hook-orchestrator.mjs +312 -0
  10. package/hooks/hook-registry.json +246 -0
  11. package/hooks/hooks.json +89 -0
  12. package/hooks/keyword-rules.json +574 -0
  13. package/hooks/lib/resolve-root.mjs +59 -0
  14. package/hooks/mcp-config-watcher.mjs +80 -0
  15. package/hooks/pipeline-stop.mjs +76 -0
  16. package/hooks/safety-guard.mjs +169 -0
  17. package/hooks/subagent-verifier.mjs +80 -0
  18. package/hub/account-broker.mjs +251 -0
  19. package/hub/adaptive-diagnostic.mjs +323 -0
  20. package/hub/adaptive-inject.mjs +186 -0
  21. package/hub/adaptive-memory.mjs +163 -0
  22. package/hub/adaptive.mjs +143 -0
  23. package/hub/assign-callbacks.mjs +133 -0
  24. package/hub/bridge.mjs +799 -0
  25. package/hub/cli-adapter-base.mjs +280 -0
  26. package/hub/codex-adapter.mjs +199 -0
  27. package/hub/codex-compat.mjs +11 -0
  28. package/hub/codex-preflight.mjs +166 -0
  29. package/hub/delegator/contracts.mjs +37 -0
  30. package/hub/delegator/index.mjs +14 -0
  31. package/hub/delegator/schema/delegator-tools.schema.json +250 -0
  32. package/hub/delegator/service.mjs +307 -0
  33. package/hub/delegator/tool-definitions.mjs +35 -0
  34. package/hub/fullcycle.mjs +96 -0
  35. package/hub/gemini-adapter.mjs +180 -0
  36. package/hub/hitl.mjs +143 -0
  37. package/hub/intent.mjs +193 -0
  38. package/hub/lib/cache-guard.mjs +114 -0
  39. package/hub/lib/known-errors.json +72 -0
  40. package/hub/lib/memory-store.mjs +748 -0
  41. package/hub/lib/process-utils.mjs +361 -0
  42. package/hub/lib/ssh-command.mjs +211 -0
  43. package/hub/lib/ssh-retry.mjs +59 -0
  44. package/hub/lib/uuidv7.mjs +44 -0
  45. package/hub/memory-doctor.mjs +480 -0
  46. package/hub/middleware/request-logger.mjs +161 -0
  47. package/hub/paths.mjs +30 -0
  48. package/hub/pipe.mjs +664 -0
  49. package/hub/pipeline/gates/confidence.mjs +56 -0
  50. package/hub/pipeline/gates/consensus.mjs +94 -0
  51. package/hub/pipeline/gates/index.mjs +5 -0
  52. package/hub/pipeline/gates/selfcheck.mjs +82 -0
  53. package/hub/pipeline/index.mjs +318 -0
  54. package/hub/pipeline/state.mjs +191 -0
  55. package/hub/pipeline/transitions.mjs +124 -0
  56. package/hub/platform.mjs +225 -0
  57. package/hub/public/dashboard.html +355 -0
  58. package/hub/public/tray-icon.ico +0 -0
  59. package/hub/public/tray-icon.png +0 -0
  60. package/hub/quality/deslop.mjs +253 -0
  61. package/hub/reflexion.mjs +372 -0
  62. package/hub/research.mjs +146 -0
  63. package/hub/router.mjs +791 -0
  64. package/hub/routing/complexity.mjs +166 -0
  65. package/hub/routing/index.mjs +117 -0
  66. package/hub/routing/q-learning.mjs +336 -0
  67. package/hub/schema.sql +148 -0
  68. package/hub/server.mjs +1264 -0
  69. package/hub/session-fingerprint.mjs +352 -0
  70. package/hub/state.mjs +258 -0
  71. package/hub/store-adapter.mjs +118 -0
  72. package/hub/store.mjs +857 -0
  73. package/hub/team/agent-map.json +11 -0
  74. package/hub/team/ansi.mjs +379 -0
  75. package/hub/team/backend.mjs +90 -0
  76. package/hub/team/cli/commands/attach.mjs +37 -0
  77. package/hub/team/cli/commands/control.mjs +43 -0
  78. package/hub/team/cli/commands/debug.mjs +74 -0
  79. package/hub/team/cli/commands/focus.mjs +53 -0
  80. package/hub/team/cli/commands/interrupt.mjs +36 -0
  81. package/hub/team/cli/commands/kill.mjs +37 -0
  82. package/hub/team/cli/commands/list.mjs +24 -0
  83. package/hub/team/cli/commands/send.mjs +37 -0
  84. package/hub/team/cli/commands/start/index.mjs +106 -0
  85. package/hub/team/cli/commands/start/parse-args.mjs +130 -0
  86. package/hub/team/cli/commands/start/start-headless.mjs +109 -0
  87. package/hub/team/cli/commands/start/start-in-process.mjs +40 -0
  88. package/hub/team/cli/commands/start/start-mux.mjs +73 -0
  89. package/hub/team/cli/commands/start/start-wt.mjs +69 -0
  90. package/hub/team/cli/commands/status.mjs +87 -0
  91. package/hub/team/cli/commands/stop.mjs +31 -0
  92. package/hub/team/cli/commands/task.mjs +30 -0
  93. package/hub/team/cli/commands/tasks.mjs +13 -0
  94. package/hub/team/cli/help.mjs +42 -0
  95. package/hub/team/cli/index.mjs +41 -0
  96. package/hub/team/cli/manifest.mjs +29 -0
  97. package/hub/team/cli/render.mjs +30 -0
  98. package/hub/team/cli/services/attach-fallback.mjs +54 -0
  99. package/hub/team/cli/services/hub-client.mjs +227 -0
  100. package/hub/team/cli/services/member-selector.mjs +30 -0
  101. package/hub/team/cli/services/native-control.mjs +117 -0
  102. package/hub/team/cli/services/runtime-mode.mjs +62 -0
  103. package/hub/team/cli/services/state-store.mjs +48 -0
  104. package/hub/team/cli/services/task-model.mjs +30 -0
  105. package/hub/team/conductor-mesh-bridge.mjs +121 -0
  106. package/hub/team/conductor.mjs +671 -0
  107. package/hub/team/dashboard-anchor.mjs +14 -0
  108. package/hub/team/dashboard-layout.mjs +33 -0
  109. package/hub/team/dashboard-open.mjs +153 -0
  110. package/hub/team/dashboard.mjs +274 -0
  111. package/hub/team/event-log.mjs +76 -0
  112. package/hub/team/handoff.mjs +303 -0
  113. package/hub/team/headless.mjs +1156 -0
  114. package/hub/team/health-probe.mjs +272 -0
  115. package/hub/team/launcher-template.mjs +95 -0
  116. package/hub/team/lead-control.mjs +104 -0
  117. package/hub/team/native-supervisor.mjs +392 -0
  118. package/hub/team/native.mjs +649 -0
  119. package/hub/team/nativeProxy.mjs +688 -0
  120. package/hub/team/notify.mjs +293 -0
  121. package/hub/team/orchestrator.mjs +161 -0
  122. package/hub/team/pane.mjs +153 -0
  123. package/hub/team/process-cleanup.mjs +342 -0
  124. package/hub/team/psmux.mjs +1354 -0
  125. package/hub/team/remote-probe.mjs +276 -0
  126. package/hub/team/remote-session.mjs +299 -0
  127. package/hub/team/remote-watcher.mjs +478 -0
  128. package/hub/team/routing.mjs +223 -0
  129. package/hub/team/session-sync.mjs +169 -0
  130. package/hub/team/session.mjs +611 -0
  131. package/hub/team/shared.mjs +13 -0
  132. package/hub/team/staleState.mjs +361 -0
  133. package/hub/team/swarm-hypervisor.mjs +589 -0
  134. package/hub/team/swarm-locks.mjs +204 -0
  135. package/hub/team/swarm-planner.mjs +260 -0
  136. package/hub/team/swarm-reconciler.mjs +137 -0
  137. package/hub/team/tui-lite.mjs +380 -0
  138. package/hub/team/tui-remote-adapter.mjs +393 -0
  139. package/hub/team/tui-viewer.mjs +463 -0
  140. package/hub/team/tui.mjs +1449 -0
  141. package/hub/team/worktree-lifecycle.mjs +193 -0
  142. package/hub/team/wt-manager.mjs +407 -0
  143. package/hub/team/wt-templates.json +43 -0
  144. package/hub/team-bridge.mjs +27 -0
  145. package/hub/token-mode.mjs +224 -0
  146. package/hub/tools.mjs +636 -0
  147. package/hub/tray.mjs +376 -0
  148. package/hub/workers/claude-worker.mjs +475 -0
  149. package/hub/workers/codex-mcp.mjs +507 -0
  150. package/hub/workers/delegator-mcp.mjs +1076 -0
  151. package/hub/workers/factory.mjs +21 -0
  152. package/hub/workers/gemini-worker.mjs +374 -0
  153. package/hub/workers/interface.mjs +52 -0
  154. package/hub/workers/worker-utils.mjs +104 -0
  155. package/hud/colors.mjs +88 -0
  156. package/hud/constants.mjs +88 -0
  157. package/hud/context-monitor.mjs +403 -0
  158. package/hud/hud-qos-status.mjs +210 -0
  159. package/hud/providers/claude.mjs +314 -0
  160. package/hud/providers/codex.mjs +151 -0
  161. package/hud/providers/gemini.mjs +320 -0
  162. package/hud/renderers.mjs +442 -0
  163. package/hud/terminal.mjs +140 -0
  164. package/hud/utils.mjs +313 -0
  165. package/mesh/index.mjs +63 -0
  166. package/mesh/mesh-budget.mjs +128 -0
  167. package/mesh/mesh-heartbeat.mjs +100 -0
  168. package/mesh/mesh-protocol.mjs +96 -0
  169. package/mesh/mesh-queue.mjs +165 -0
  170. package/mesh/mesh-registry.mjs +78 -0
  171. package/mesh/mesh-router.mjs +76 -0
  172. package/package.json +8 -1
  173. package/references/hosts.json +33 -0
  174. package/scripts/__tests__/gen-skill-docs.test.mjs +87 -0
  175. package/scripts/__tests__/keyword-detector.test.mjs +234 -0
  176. package/scripts/__tests__/mcp-guard-engine.test.mjs +118 -0
  177. package/scripts/__tests__/remote-spawn-transfer.test.mjs +117 -0
  178. package/scripts/__tests__/remote-spawn.test.mjs +92 -0
  179. package/scripts/__tests__/skill-template.test.mjs +193 -0
  180. package/scripts/__tests__/smoke.test.mjs +34 -0
  181. package/scripts/cache-buildup.mjs +30 -0
  182. package/scripts/cache-doctor.mjs +149 -0
  183. package/scripts/cache-warmup.mjs +557 -0
  184. package/scripts/claudemd-sync.mjs +148 -0
  185. package/scripts/cli-route.sh +3 -0
  186. package/scripts/completions/tfx.bash +47 -0
  187. package/scripts/completions/tfx.fish +44 -0
  188. package/scripts/completions/tfx.zsh +83 -0
  189. package/scripts/cross-review-gate.mjs +126 -0
  190. package/scripts/cross-review-tracker.mjs +238 -0
  191. package/scripts/gen-skill-docs.mjs +111 -0
  192. package/scripts/headless-guard-fast.sh +21 -0
  193. package/scripts/headless-guard.mjs +360 -0
  194. package/scripts/hub-ensure.mjs +120 -0
  195. package/scripts/keyword-detector.mjs +272 -0
  196. package/scripts/keyword-rules-expander.mjs +521 -0
  197. package/scripts/lib/claudemd-scanner.mjs +218 -0
  198. package/scripts/lib/context.mjs +67 -0
  199. package/scripts/lib/cross-review-utils.mjs +51 -0
  200. package/scripts/lib/env-probe.mjs +241 -0
  201. package/scripts/lib/gemini-profiles.mjs +85 -0
  202. package/scripts/lib/handoff.mjs +171 -0
  203. package/scripts/lib/hook-utils.mjs +14 -0
  204. package/scripts/lib/keyword-rules.mjs +166 -0
  205. package/scripts/lib/logger.mjs +105 -0
  206. package/scripts/lib/mcp-filter.mjs +739 -0
  207. package/scripts/lib/mcp-guard-engine.mjs +954 -0
  208. package/scripts/lib/mcp-manifest.mjs +79 -0
  209. package/scripts/lib/mcp-server-catalog.mjs +118 -0
  210. package/scripts/lib/psmux-info.mjs +119 -0
  211. package/scripts/lib/remote-spawn-transfer.mjs +196 -0
  212. package/scripts/lib/skill-template.mjs +326 -0
  213. package/scripts/mcp-check.mjs +237 -0
  214. package/scripts/mcp-cleanup.ps1 +17 -0
  215. package/scripts/mcp-gateway-config.mjs +207 -0
  216. package/scripts/mcp-gateway-ensure.mjs +85 -0
  217. package/scripts/mcp-gateway-integration-test.mjs +228 -0
  218. package/scripts/mcp-gateway-start.mjs +226 -0
  219. package/scripts/mcp-gateway-start.ps1 +141 -0
  220. package/scripts/mcp-gateway-verify.mjs +77 -0
  221. package/scripts/mcp-safety-guard.mjs +44 -0
  222. package/scripts/notion-read.mjs +556 -0
  223. package/scripts/pack.mjs +295 -0
  224. package/scripts/preflight-cache.mjs +69 -0
  225. package/scripts/preinstall.mjs +96 -0
  226. package/scripts/remote-spawn.mjs +1376 -0
  227. package/scripts/run.cjs +79 -0
  228. package/scripts/session-spawn-helper.mjs +185 -0
  229. package/scripts/setup.mjs +1178 -0
  230. package/scripts/test-lock.mjs +71 -0
  231. package/scripts/test-tfx-route-no-claude-native.mjs +57 -0
  232. package/scripts/tfx-batch-stats.mjs +96 -0
  233. package/scripts/tfx-gate-activate.mjs +89 -0
  234. package/scripts/tfx-route-post.mjs +505 -0
  235. package/scripts/tfx-route-worker.mjs +223 -0
  236. package/scripts/tfx-route.sh +2014 -0
  237. package/scripts/tmp-cleanup.mjs +103 -0
  238. package/scripts/token-snapshot.mjs +575 -0
  239. package/skills/tfx-auto/SKILL.md.tmpl +2 -3
  240. package/skills/tfx-autoresearch/SKILL.md +6 -5
  241. package/skills/tfx-codex/SKILL.md.tmpl +2 -3
  242. package/skills/tfx-codex-swarm-workspace/iteration-1/benchmark.json +33 -0
  243. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/eval_metadata.json +42 -0
  244. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/grading.json +11 -0
  245. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/analysis.md +87 -0
  246. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/classification.md +35 -0
  247. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/commands.sh +275 -0
  248. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/routing.md +56 -0
  249. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/timing.json +5 -0
  250. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/grading.json +11 -0
  251. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/analysis.md +92 -0
  252. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/classification.md +71 -0
  253. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/commands.sh +264 -0
  254. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/routing.md +113 -0
  255. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/timing.json +5 -0
  256. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/eval_metadata.json +32 -0
  257. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/grading.json +9 -0
  258. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/analysis.md +96 -0
  259. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/classification.md +38 -0
  260. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/commands.sh +151 -0
  261. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/routing.md +51 -0
  262. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/timing.json +5 -0
  263. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/grading.json +9 -0
  264. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/analysis.md +127 -0
  265. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/classification.md +57 -0
  266. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/commands.sh +129 -0
  267. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/routing.md +84 -0
  268. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/timing.json +5 -0
  269. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/eval_metadata.json +27 -0
  270. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/grading.json +8 -0
  271. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/analysis.md +98 -0
  272. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/classification.md +65 -0
  273. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/commands.sh +123 -0
  274. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/routing.md +66 -0
  275. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/timing.json +5 -0
  276. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/grading.json +8 -0
  277. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/analysis.md +88 -0
  278. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/classification.md +40 -0
  279. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/commands.sh +130 -0
  280. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/routing.md +61 -0
  281. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/timing.json +5 -0
  282. package/skills/tfx-deep-interview/SKILL.md +1 -2
  283. package/skills/tfx-plan/SKILL.md.tmpl +2 -3
  284. package/skills/tfx-psmux-rules/SKILL.md +11 -2
  285. package/skills/tfx-qa/SKILL.md.tmpl +2 -3
  286. package/skills/tfx-remote-spawn/SKILL.md +8 -11
  287. package/skills/tfx-research/SKILL.md.tmpl +2 -3
  288. package/skills/tfx-review/SKILL.md.tmpl +2 -3
  289. package/skills/tfx-workspace/async-tests/run-tests.sh +203 -0
  290. package/skills/tfx-workspace/evals/evals.json +79 -0
  291. package/skills/tfx-workspace/iteration-1/benchmark.json +162 -0
  292. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/eval_metadata.json +11 -0
  293. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/grading.json +9 -0
  294. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/outputs/analysis.md +154 -0
  295. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/timing.json +5 -0
  296. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/grading.json +9 -0
  297. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/outputs/analysis.md +126 -0
  298. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/timing.json +5 -0
  299. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/eval_metadata.json +11 -0
  300. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/grading.json +9 -0
  301. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/outputs/analysis.md +119 -0
  302. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/timing.json +5 -0
  303. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/grading.json +9 -0
  304. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/outputs/analysis.md +115 -0
  305. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/timing.json +5 -0
  306. package/skills/tfx-workspace/iteration-1/hub-start-sequence/eval_metadata.json +10 -0
  307. package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/grading.json +8 -0
  308. package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/outputs/analysis.md +86 -0
  309. package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/timing.json +5 -0
  310. package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/grading.json +8 -0
  311. package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/outputs/analysis.md +81 -0
  312. package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/timing.json +5 -0
  313. package/skills/tfx-workspace/iteration-1/multi-team-creation/eval_metadata.json +12 -0
  314. package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/grading.json +10 -0
  315. package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/outputs/analysis.md +316 -0
  316. package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/timing.json +5 -0
  317. package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/grading.json +10 -0
  318. package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/outputs/analysis.md +352 -0
  319. package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/timing.json +5 -0
  320. package/skills/tfx-workspace/iteration-1/review.html +1325 -0
  321. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/eval_metadata.json +12 -0
  322. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/grading.json +10 -0
  323. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/outputs/analysis.md +97 -0
  324. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/timing.json +5 -0
  325. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/grading.json +10 -0
  326. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/outputs/analysis.md +94 -0
  327. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/timing.json +5 -0
  328. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/eval_metadata.json +12 -0
  329. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/grading.json +10 -0
  330. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/outputs/analysis.md +209 -0
  331. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/timing.json +5 -0
  332. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/grading.json +10 -0
  333. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/outputs/analysis.md +193 -0
  334. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/timing.json +5 -0
  335. package/skills/tfx-workspace/iteration-2/benchmark.json +62 -0
  336. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/eval_metadata.json +13 -0
  337. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/grading.json +11 -0
  338. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/outputs/analysis.md +382 -0
  339. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/timing.json +5 -0
  340. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/grading.json +11 -0
  341. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/outputs/analysis.md +333 -0
  342. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/timing.json +5 -0
  343. package/skills/tfx-workspace/iteration-2/review.html +1325 -0
  344. package/skills/tfx-workspace/skill-snapshot/tfx-auto/SKILL.md +217 -0
  345. package/skills/{tfx-auto-codex/SKILL.md.tmpl → tfx-workspace/skill-snapshot/tfx-auto-codex/SKILL.md} +3 -31
  346. package/skills/tfx-workspace/skill-snapshot/tfx-codex/SKILL.md +65 -0
  347. package/skills/tfx-workspace/skill-snapshot/tfx-doctor/SKILL.md +94 -0
  348. package/skills/{tfx-gemini/SKILL.md.tmpl → tfx-workspace/skill-snapshot/tfx-gemini/SKILL.md} +6 -14
  349. package/skills/tfx-workspace/skill-snapshot/tfx-hub/SKILL.md +133 -0
  350. package/skills/tfx-workspace/skill-snapshot/tfx-multi/SKILL.md +426 -0
  351. package/skills/tfx-workspace/skill-snapshot/tfx-setup/SKILL.md +101 -0
  352. package/skills/merge-worktree/SKILL.md.tmpl +0 -144
  353. package/skills/shared/arguments-processing.md +0 -2
  354. package/skills/shared/mandatory-rules.md +0 -6
  355. package/skills/shared/telemetry-segment.md +0 -6
  356. package/skills/star-prompt/SKILL.md.tmpl +0 -122
  357. package/skills/tfx-analysis/SKILL.md.tmpl +0 -106
  358. package/skills/tfx-analysis/skill.json +0 -11
  359. package/skills/tfx-auto/skill.json +0 -26
  360. package/skills/tfx-auto-codex/skill.json +0 -8
  361. package/skills/tfx-autopilot/SKILL.md.tmpl +0 -115
  362. package/skills/tfx-autopilot/skill.json +0 -10
  363. package/skills/tfx-autoresearch/SKILL.md.tmpl +0 -135
  364. package/skills/tfx-autoresearch/skill.json +0 -14
  365. package/skills/tfx-autoroute/SKILL.md.tmpl +0 -188
  366. package/skills/tfx-autoroute/skill.json +0 -12
  367. package/skills/tfx-codex/skill.json +0 -8
  368. package/skills/tfx-codex-swarm/SKILL.md.tmpl +0 -16
  369. package/skills/tfx-codex-swarm/skill.json +0 -5
  370. package/skills/tfx-consensus/SKILL.md.tmpl +0 -145
  371. package/skills/tfx-consensus/skill.json +0 -8
  372. package/skills/tfx-debate/SKILL.md.tmpl +0 -191
  373. package/skills/tfx-debate/skill.json +0 -12
  374. package/skills/tfx-deep-analysis/SKILL.md.tmpl +0 -227
  375. package/skills/tfx-deep-analysis/skill.json +0 -10
  376. package/skills/tfx-deep-interview/SKILL.md.tmpl +0 -203
  377. package/skills/tfx-deep-interview/skill.json +0 -12
  378. package/skills/tfx-deep-plan/SKILL.md.tmpl +0 -281
  379. package/skills/tfx-deep-plan/skill.json +0 -13
  380. package/skills/tfx-deep-qa/SKILL.md.tmpl +0 -164
  381. package/skills/tfx-deep-qa/skill.json +0 -11
  382. package/skills/tfx-deep-research/SKILL.md.tmpl +0 -216
  383. package/skills/tfx-deep-research/skill.json +0 -14
  384. package/skills/tfx-deep-review/SKILL.md.tmpl +0 -178
  385. package/skills/tfx-deep-review/skill.json +0 -12
  386. package/skills/tfx-doctor/SKILL.md.tmpl +0 -172
  387. package/skills/tfx-doctor/skill.json +0 -8
  388. package/skills/tfx-find/skill.json +0 -12
  389. package/skills/tfx-forge/SKILL.md.tmpl +0 -187
  390. package/skills/tfx-forge/skill.json +0 -12
  391. package/skills/tfx-fullcycle/SKILL.md.tmpl +0 -285
  392. package/skills/tfx-fullcycle/skill.json +0 -11
  393. package/skills/tfx-gemini/skill.json +0 -8
  394. package/skills/tfx-hooks/SKILL.md.tmpl +0 -216
  395. package/skills/tfx-hooks/skill.json +0 -8
  396. package/skills/tfx-hub/SKILL.md.tmpl +0 -212
  397. package/skills/tfx-hub/skill.json +0 -8
  398. package/skills/tfx-index/skill.json +0 -11
  399. package/skills/tfx-interview/SKILL.md.tmpl +0 -284
  400. package/skills/tfx-interview/skill.json +0 -12
  401. package/skills/tfx-multi/SKILL.md.tmpl +0 -183
  402. package/skills/tfx-multi/skill.json +0 -8
  403. package/skills/tfx-panel/SKILL.md.tmpl +0 -188
  404. package/skills/tfx-panel/skill.json +0 -12
  405. package/skills/tfx-persist/SKILL.md.tmpl +0 -269
  406. package/skills/tfx-persist/skill.json +0 -12
  407. package/skills/tfx-plan/skill.json +0 -11
  408. package/skills/tfx-profile/SKILL.md.tmpl +0 -239
  409. package/skills/tfx-profile/skill.json +0 -8
  410. package/skills/tfx-prune/SKILL.md.tmpl +0 -199
  411. package/skills/tfx-prune/skill.json +0 -12
  412. package/skills/tfx-psmux-rules/SKILL.md.tmpl +0 -317
  413. package/skills/tfx-psmux-rules/skill.json +0 -8
  414. package/skills/tfx-qa/skill.json +0 -11
  415. package/skills/tfx-ralph/SKILL.md.tmpl +0 -27
  416. package/skills/tfx-ralph/skill.json +0 -8
  417. package/skills/tfx-remote-setup/SKILL.md.tmpl +0 -576
  418. package/skills/tfx-remote-setup/skill.json +0 -8
  419. package/skills/tfx-remote-spawn/SKILL.md.tmpl +0 -263
  420. package/skills/tfx-remote-spawn/skill.json +0 -9
  421. package/skills/tfx-research/skill.json +0 -13
  422. package/skills/tfx-review/skill.json +0 -11
  423. package/skills/tfx-setup/SKILL.md.tmpl +0 -380
  424. package/skills/tfx-setup/skill.json +0 -8
  425. package/skills/tfx-swarm/SKILL.md.tmpl +0 -154
  426. package/skills/tfx-swarm/skill.json +0 -5
@@ -0,0 +1,355 @@
1
+ <!DOCTYPE html>
2
+ <html lang="ko">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>triflux QoS 대시보드</title>
7
+ <style>
8
+ *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
9
+ body{background:#0d1117;color:#c9d1d9;font-family:system-ui,-apple-system,sans-serif;min-height:100vh;padding:16px}
10
+ .header{display:flex;align-items:center;justify-content:space-between;padding:12px 0;margin-bottom:16px;border-bottom:1px solid #30363d;max-width:1200px;margin-left:auto;margin-right:auto}
11
+ .header h1{font-size:1.4rem;font-weight:600}
12
+ .status-bar{display:flex;align-items:center;gap:12px;font-size:.85rem;color:#8b949e}
13
+ .status-dot{width:10px;height:10px;border-radius:50%;display:inline-block;transition:background .3s}
14
+ .status-dot.ok{background:#3fb950}
15
+ .status-dot.err{background:#f85149}
16
+ .grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;max-width:1200px;margin:0 auto}
17
+ @media(max-width:768px){.grid{grid-template-columns:1fr}}
18
+ .card{background:#161b22;border:1px solid #30363d;border-radius:8px;padding:16px}
19
+ .card-title{font-size:.95rem;font-weight:600;margin-bottom:12px;color:#c9d1d9}
20
+ .sub{color:#8b949e;font-size:.8rem}
21
+
22
+ .gauge-wrap{display:flex;flex-direction:column;align-items:center;gap:8px}
23
+ .gauge-value{font-size:2.2rem;font-weight:700;margin-top:-36px}
24
+ .gauge-label{font-size:.85rem;color:#8b949e}
25
+
26
+ .quota-row{margin-bottom:14px}
27
+ .quota-row:last-child{margin-bottom:0}
28
+ .quota-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;font-size:.85rem}
29
+ .quota-header .cli-name{font-weight:600}
30
+ .quota-header .meta{color:#8b949e;font-size:.78rem}
31
+ .bar-row{display:flex;gap:6px;align-items:center;margin-bottom:4px}
32
+ .bar-row:last-child{margin-bottom:0}
33
+ .bar-row .bar-label{font-size:.72rem;color:#8b949e;width:56px;text-align:right;flex-shrink:0}
34
+ .bar-track{height:18px;background:#21262d;border-radius:4px;overflow:hidden;position:relative;flex:1}
35
+ .bar-fill{height:100%;border-radius:4px;transition:width .4s ease;display:flex;align-items:center;justify-content:flex-end;padding-right:6px;font-size:.72rem;font-weight:600;color:#0d1117;min-width:0}
36
+ .bar-pct-outer{font-size:.72rem;color:#8b949e;margin-left:6px;width:32px;flex-shrink:0}
37
+
38
+ .token-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
39
+ .token-item{background:#0d1117;border:1px solid #30363d;border-radius:6px;padding:12px;text-align:center}
40
+ .token-item .label{font-size:.78rem;color:#8b949e;margin-bottom:4px}
41
+ .token-item .value{font-size:1.5rem;font-weight:700}
42
+ .token-item .calls{font-size:.78rem;color:#8b949e;margin-top:2px}
43
+
44
+ .chart-wrap{position:relative;width:100%;height:160px}
45
+ .chart-wrap canvas{width:100%!important;height:100%!important}
46
+ .chart-legend{display:flex;gap:14px;margin-top:8px;font-size:.78rem;color:#8b949e}
47
+ .legend-dot{width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:4px;vertical-align:middle}
48
+
49
+ .placeholder{text-align:center;padding:24px;color:#8b949e;font-size:.85rem}
50
+ </style>
51
+ </head>
52
+ <body>
53
+
54
+ <div class="header">
55
+ <h1>&#9889; triflux QoS 대시보드</h1>
56
+ <div class="status-bar">
57
+ <span class="status-dot" id="statusDot"></span>
58
+ <span id="statusText">연결 중...</span>
59
+ <span id="lastUpdate" class="sub"></span>
60
+ </div>
61
+ </div>
62
+
63
+ <div class="grid">
64
+ <!-- AIMD 게이지 -->
65
+ <div class="card">
66
+ <div class="card-title">AIMD 동시 워커</div>
67
+ <div class="gauge-wrap">
68
+ <svg width="220" height="130" viewBox="0 0 220 130">
69
+ <path d="M20 120 A90 90 0 0 1 200 120" fill="none" stroke="#21262d" stroke-width="18" stroke-linecap="round"/>
70
+ <path id="gaugeArc" d="M20 120 A90 90 0 0 1 200 120" fill="none" stroke="#3fb950" stroke-width="18" stroke-linecap="round" stroke-dasharray="0 283"/>
71
+ <!-- 눈금 -->
72
+ <g id="gaugeTicks" fill="#8b949e" font-size="10" text-anchor="middle"></g>
73
+ </svg>
74
+ <div class="gauge-value" id="gaugeVal">-</div>
75
+ <div class="gauge-label" id="gaugeLabel">- / 10</div>
76
+ </div>
77
+ </div>
78
+
79
+ <!-- CLI 쿼터 바 -->
80
+ <div class="card">
81
+ <div class="card-title">CLI 쿼터 사용률</div>
82
+ <div id="quotaBars">
83
+ <div class="placeholder">데이터 대기 중...</div>
84
+ </div>
85
+ </div>
86
+
87
+ <!-- 호출 이력 차트 -->
88
+ <div class="card" style="grid-column:1/-1">
89
+ <div class="card-title">호출 이력 타임라인</div>
90
+ <div class="chart-wrap">
91
+ <canvas id="eventsCanvas"></canvas>
92
+ </div>
93
+ <div class="chart-legend">
94
+ <span><span class="legend-dot" style="background:#3fb950"></span>성공</span>
95
+ <span><span class="legend-dot" style="background:#f85149"></span>실패</span>
96
+ <span><span class="legend-dot" style="background:#d29922"></span>타임아웃</span>
97
+ </div>
98
+ </div>
99
+
100
+ <!-- 토큰 누적 -->
101
+ <div class="card" style="grid-column:1/-1">
102
+ <div class="card-title">토큰 누적 현황</div>
103
+ <div class="token-grid" id="tokenCards">
104
+ <div class="placeholder" style="grid-column:1/-1">데이터 대기 중...</div>
105
+ </div>
106
+ </div>
107
+ </div>
108
+
109
+ <script>
110
+ (function() {
111
+ function esc(s) { var d = document.createElement('div'); d.textContent = s; return d.innerHTML; }
112
+
113
+ var POLL = 5000;
114
+ var MAX_W = 10;
115
+ var ARC_TOTAL = 283;
116
+
117
+ var $dot = document.getElementById('statusDot');
118
+ var $stxt = document.getElementById('statusText');
119
+ var $time = document.getElementById('lastUpdate');
120
+ var $arc = document.getElementById('gaugeArc');
121
+ var $gval = document.getElementById('gaugeVal');
122
+ var $glab = document.getElementById('gaugeLabel');
123
+ var $quota = document.getElementById('quotaBars');
124
+ var $tokens = document.getElementById('tokenCards');
125
+ var canvas = document.getElementById('eventsCanvas');
126
+ var cx = canvas.getContext('2d');
127
+ var cachedEvents = [];
128
+
129
+ function status(ok) {
130
+ $dot.className = 'status-dot ' + (ok ? 'ok' : 'err');
131
+ $stxt.textContent = ok ? '연결됨' : '연결 실패';
132
+ }
133
+
134
+ function ts(d) {
135
+ return d.toLocaleTimeString('ko-KR', { hour: '2-digit', minute: '2-digit', second: '2-digit' });
136
+ }
137
+
138
+ function fmtTok(n) {
139
+ if (n == null) return '-';
140
+ if (n >= 1e6) return (n / 1e6).toFixed(1) + 'M';
141
+ if (n >= 1e3) return (n / 1e3).toFixed(1) + 'K';
142
+ return String(n);
143
+ }
144
+
145
+ function barCol(p) {
146
+ if (p >= 80) return '#f85149';
147
+ if (p >= 50) return '#d29922';
148
+ return '#3fb950';
149
+ }
150
+
151
+ // rt: ISO 문자열 또는 Unix 초(정수). Unix 초는 1e10 미만으로 구분
152
+ function remain(rt) {
153
+ if (!rt) return '';
154
+ var ts = typeof rt === 'number' && rt < 1e10 ? rt * 1000 : new Date(rt).getTime();
155
+ if (!isFinite(ts)) return '';
156
+ var ms = ts - Date.now();
157
+ if (ms <= 0) return '만료됨';
158
+ var h = Math.floor(ms / 3600000);
159
+ var m = Math.floor((ms % 3600000) / 60000);
160
+ return h > 0 ? h + '시간 ' + m + '분' : m + '분';
161
+ }
162
+
163
+ /* ── 게이지 ── */
164
+ function gauge(val) {
165
+ val = Math.max(0, Math.min(MAX_W, val || 0));
166
+ var r = val / MAX_W;
167
+ $arc.setAttribute('stroke-dasharray', (r * ARC_TOTAL) + ' ' + ARC_TOTAL);
168
+ $arc.setAttribute('stroke', r > 0.8 ? '#f85149' : r > 0.5 ? '#d29922' : '#3fb950');
169
+ $gval.textContent = val;
170
+ $glab.textContent = val + ' / ' + MAX_W;
171
+ }
172
+
173
+ /* ── 쿼터 ── */
174
+ function makeBar(label, pct) {
175
+ pct = Math.min(100, Math.max(0, Math.round(pct)));
176
+ var c = barCol(pct);
177
+ var inner = pct > 10 ? pct + '%' : '';
178
+ var outer = pct <= 10 ? pct + '%' : '';
179
+ return '<div class="bar-row">' +
180
+ '<span class="bar-label">' + esc(label) + '</span>' +
181
+ '<div class="bar-track"><div class="bar-fill" style="width:' + pct + '%;background:' + c + '">' + inner + '</div></div>' +
182
+ '<span class="bar-pct-outer">' + outer + '</span>' +
183
+ '</div>';
184
+ }
185
+
186
+ function quotaBlock(name, color, bars, resetTime) {
187
+ var rem = remain(resetTime);
188
+ var expired = rem === '만료됨';
189
+ var h = '<div class="quota-row"><div class="quota-header">' +
190
+ '<span class="cli-name" style="color:' + color + '">' + esc(name) + '</span>';
191
+ if (rem) h += '<span class="meta" style="' + (expired ? 'color:#f85149' : '') + '">리셋: ' + rem + '</span>';
192
+ h += '</div>';
193
+ for (var i = 0; i < bars.length; i++) h += makeBar(bars[i][0], bars[i][1]);
194
+ h += '</div>';
195
+ return h;
196
+ }
197
+
198
+ function renderQuota(d) {
199
+ var s = '';
200
+
201
+ // Claude
202
+ var cl = d.claude && d.claude.data;
203
+ if (cl) {
204
+ s += quotaBlock('Claude (c)', '#d19a66', [
205
+ ['5시간', cl.fiveHourPercent || 0],
206
+ ['주간', cl.weeklyPercent || 0]
207
+ ], cl.fiveHourResetsAt);
208
+ }
209
+
210
+ // Codex
211
+ var cx2 = d.codex && d.codex.buckets && d.codex.buckets.codex;
212
+ if (cx2) {
213
+ s += quotaBlock('Codex (x)', '#ffffff', [
214
+ ['Primary', cx2.primary ? cx2.primary.used_percent || 0 : 0],
215
+ ['Secondary', cx2.secondary ? cx2.secondary.used_percent || 0 : 0]
216
+ ], cx2.primary && cx2.primary.resets_at);
217
+ }
218
+
219
+ // Gemini
220
+ var gm = d.gemini && d.gemini.buckets;
221
+ if (gm && gm.length > 0) {
222
+ var frac = gm[0].remainingFraction;
223
+ s += quotaBlock('Gemini (g)', '#61afef', [
224
+ ['사용률', frac != null ? Math.round((1 - frac) * 100) : 0]
225
+ ], gm[0].resetTime);
226
+ }
227
+
228
+ $quota.innerHTML = s || '<div class="placeholder">쿼터 데이터 없음</div>';
229
+ }
230
+
231
+ /* ── 토큰 ── */
232
+ function renderTokens(acc) {
233
+ if (!acc || Object.keys(acc).length === 0) {
234
+ $tokens.innerHTML = '<div class="placeholder" style="grid-column:1/-1">누적 데이터 없음</div>';
235
+ return;
236
+ }
237
+ var h = '';
238
+ var keys = Object.keys(acc);
239
+ for (var i = 0; i < keys.length; i++) {
240
+ var k = keys[i], v = acc[k];
241
+ if (!v) continue;
242
+ h += '<div class="token-item">' +
243
+ '<div class="label">' + esc(k.toUpperCase()) + '</div>' +
244
+ '<div class="value">' + esc(fmtTok(v.tokens)) + '</div>' +
245
+ '<div class="calls">' + (v.calls || 0) + '회 호출</div>' +
246
+ '</div>';
247
+ }
248
+ $tokens.innerHTML = h || '<div class="placeholder" style="grid-column:1/-1">누적 데이터 없음</div>';
249
+ }
250
+
251
+ /* ── 이벤트 차트 ── */
252
+ var colorMap = { success: '#3fb950', failed: '#f85149', fail: '#f85149', error: '#f85149', timeout: '#d29922' };
253
+
254
+ function drawEvents(evts) {
255
+ var dpr = window.devicePixelRatio || 1;
256
+ var rect = canvas.parentElement.getBoundingClientRect();
257
+ var w = rect.width, h = rect.height;
258
+ canvas.width = w * dpr;
259
+ canvas.height = h * dpr;
260
+ cx.setTransform(dpr, 0, 0, dpr, 0, 0);
261
+ cx.clearRect(0, 0, w, h);
262
+
263
+ if (!evts || evts.length === 0) {
264
+ cx.fillStyle = '#8b949e';
265
+ cx.font = '13px system-ui';
266
+ cx.textAlign = 'center';
267
+ cx.fillText('이벤트 데이터 없음', w / 2, h / 2);
268
+ return;
269
+ }
270
+
271
+ var pad = { l: 50, r: 16, t: 12, b: 28 };
272
+ var cw = w - pad.l - pad.r;
273
+ var ch = h - pad.t - pad.b;
274
+
275
+ var times = [];
276
+ for (var i = 0; i < evts.length; i++) {
277
+ times.push(new Date(evts[i].timestamp || evts[i].time || evts[i].t).getTime());
278
+ }
279
+ var tMin = Math.min.apply(null, times);
280
+ var tMax = Math.max.apply(null, times);
281
+ if (tMax === tMin) tMax = tMin + 60000;
282
+
283
+ // X축 라인
284
+ cx.strokeStyle = '#30363d';
285
+ cx.lineWidth = 1;
286
+ cx.beginPath();
287
+ cx.moveTo(pad.l, pad.t + ch);
288
+ cx.lineTo(pad.l + cw, pad.t + ch);
289
+ cx.stroke();
290
+
291
+ // X축 라벨
292
+ cx.fillStyle = '#8b949e';
293
+ cx.font = '11px system-ui';
294
+ cx.textAlign = 'center';
295
+ var nL = Math.min(6, evts.length);
296
+ for (var j = 0; j < nL; j++) {
297
+ var tp = tMin + (tMax - tMin) * j / (nL - 1 || 1);
298
+ var xp = pad.l + cw * (tp - tMin) / (tMax - tMin);
299
+ var dd = new Date(tp);
300
+ cx.fillText(dd.getHours() + ':' + String(dd.getMinutes()).padStart(2, '0'), xp, h - 6);
301
+ }
302
+
303
+ // 도트
304
+ var dr = Math.max(3, Math.min(6, cw / evts.length * 0.4));
305
+ for (var k = 0; k < evts.length; k++) {
306
+ var ev = evts[k];
307
+ var t = times[k];
308
+ var ex = pad.l + cw * (t - tMin) / (tMax - tMin);
309
+ // Y: 해시 분산 (겹침 방지)
310
+ var ey = pad.t + ch * 0.15 + (ch * 0.65) * ((k * 7 + 3) % 13) / 13;
311
+ var st = (ev.status || ev.result || 'success').toLowerCase();
312
+ cx.beginPath();
313
+ cx.arc(ex, ey, dr, 0, Math.PI * 2);
314
+ cx.fillStyle = colorMap[st] || '#8b949e';
315
+ cx.fill();
316
+ }
317
+ }
318
+
319
+ /* ── 폴링 ── */
320
+ function poll() {
321
+ fetch('/api/qos-stats')
322
+ .then(function(r) {
323
+ if (!r.ok) throw new Error('HTTP ' + r.status);
324
+ return r.json();
325
+ })
326
+ .then(function(data) {
327
+ status(true);
328
+ $time.textContent = ts(new Date());
329
+
330
+ gauge(data.aimd ? data.aimd.batchSize : 0);
331
+ renderQuota(data);
332
+
333
+ cachedEvents = (data.aimd && data.aimd.events) || [];
334
+ drawEvents(cachedEvents);
335
+
336
+ renderTokens(data.accumulator);
337
+ })
338
+ .catch(function(e) {
339
+ status(false);
340
+ $time.textContent = ts(new Date()) + ' (실패)';
341
+ });
342
+ }
343
+
344
+ var rTimer;
345
+ window.addEventListener('resize', function() {
346
+ clearTimeout(rTimer);
347
+ rTimer = setTimeout(function() { drawEvents(cachedEvents); }, 150);
348
+ });
349
+
350
+ poll();
351
+ setInterval(poll, POLL);
352
+ })();
353
+ </script>
354
+ </body>
355
+ </html>
Binary file
Binary file
@@ -0,0 +1,253 @@
1
+ /**
2
+ * Anti-Slop Code Pass
3
+ * AI 생성 코드에서 불필요한 요소를 자동 탐지/제거하는 정적 분석 모듈
4
+ */
5
+
6
+ import { readdir, readFile, writeFile, stat } from 'node:fs/promises';
7
+ import { join, relative } from 'node:path';
8
+
9
+ /** @type {ReadonlyArray<{type: string, pattern: RegExp, severity: string, autoFixable: boolean, multiline: boolean}>} */
10
+ export const SLOP_PATTERNS = Object.freeze([
11
+ {
12
+ type: 'trivial_comment',
13
+ pattern: /^\s*\/\/\s*(import|define|set|get|return|export)\s/i,
14
+ severity: 'low',
15
+ autoFixable: true,
16
+ multiline: false,
17
+ },
18
+ {
19
+ type: 'empty_catch',
20
+ pattern: /catch\s*\([^)]*\)\s*\{\s*\}/,
21
+ severity: 'med',
22
+ autoFixable: false,
23
+ multiline: true,
24
+ },
25
+ {
26
+ type: 'console_debug',
27
+ pattern: /^\s*console\.(log|debug|info)\(/,
28
+ severity: 'low',
29
+ autoFixable: true,
30
+ multiline: false,
31
+ },
32
+ {
33
+ type: 'useless_jsdoc',
34
+ pattern: /\/\*\*\s*\n\s*\*\s*\n\s*\*\//,
35
+ severity: 'low',
36
+ autoFixable: true,
37
+ multiline: true,
38
+ },
39
+ {
40
+ type: 'rethrow_only',
41
+ pattern: /catch\s*\((\w+)\)\s*\{\s*throw\s+\1\s*;?\s*\}/,
42
+ severity: 'med',
43
+ autoFixable: false,
44
+ multiline: true,
45
+ },
46
+ {
47
+ type: 'redundant_type',
48
+ pattern: /:\s*(string|number|boolean)\s*=\s*('[^']*'|"[^"]*"|\d+|true|false)/,
49
+ severity: 'low',
50
+ autoFixable: false,
51
+ multiline: false,
52
+ },
53
+ {
54
+ type: 'commented_code',
55
+ pattern: /^\s*\/\/\s*(const |let |var |function |class |if\s*\(|for\s*\(|while\s*\(|return |await )/,
56
+ severity: 'low',
57
+ autoFixable: true,
58
+ multiline: false,
59
+ },
60
+ ]);
61
+
62
+ const SEVERITY_WEIGHT = { low: 2, med: 5 };
63
+
64
+ /**
65
+ * 파일 내용에서 slop 패턴 탐지
66
+ * @param {string} content - 파일 내용
67
+ * @param {string} [filePath] - 파일 경로 (보고용)
68
+ * @returns {{ issues: Array<{line: number, type: string, severity: string, suggestion: string, text: string, autoFixable: boolean}>, score: number }}
69
+ */
70
+ export function detectSlop(content, filePath = '') {
71
+ const lines = content.split('\n');
72
+ const issues = [];
73
+
74
+ for (const sp of SLOP_PATTERNS) {
75
+ if (sp.multiline) continue;
76
+ for (let i = 0; i < lines.length; i++) {
77
+ if (sp.pattern.test(lines[i])) {
78
+ issues.push({
79
+ line: i + 1,
80
+ type: sp.type,
81
+ severity: sp.severity,
82
+ suggestion: `${sp.type} 패턴 감지`,
83
+ text: lines[i].trim(),
84
+ autoFixable: sp.autoFixable,
85
+ file: filePath,
86
+ });
87
+ }
88
+ }
89
+ }
90
+
91
+ for (const sp of SLOP_PATTERNS) {
92
+ if (!sp.multiline) continue;
93
+ const regex = new RegExp(sp.pattern.source, sp.pattern.flags.replace('g', '') + 'g');
94
+ let match;
95
+ while ((match = regex.exec(content)) !== null) {
96
+ const line = content.substring(0, match.index).split('\n').length;
97
+ issues.push({
98
+ line,
99
+ type: sp.type,
100
+ severity: sp.severity,
101
+ suggestion: `${sp.type} 패턴 감지`,
102
+ text: match[0].split('\n')[0].trim(),
103
+ autoFixable: sp.autoFixable,
104
+ file: filePath,
105
+ });
106
+ }
107
+ }
108
+
109
+ issues.sort((a, b) => a.line - b.line);
110
+
111
+ const totalPenalty = issues.reduce((sum, i) => sum + (SEVERITY_WEIGHT[i.severity] || 2), 0);
112
+ const score = Math.max(0, 100 - totalPenalty);
113
+
114
+ return { issues, score };
115
+ }
116
+
117
+ /**
118
+ * 자동 수정 (safe transforms만)
119
+ * @param {string} content - 파일 내용
120
+ * @param {Array<{type: string, autoFixable: boolean}>} issues - detectSlop 결과
121
+ * @returns {{ fixed: string, applied: number, skipped: number }}
122
+ */
123
+ export function autoFixSlop(content, issues) {
124
+ if (!issues || issues.length === 0) return { fixed: content, applied: 0, skipped: 0 };
125
+
126
+ const fixable = issues.filter(i => i.autoFixable);
127
+ const skipped = issues.length - fixable.length;
128
+
129
+ if (fixable.length === 0) return { fixed: content, applied: 0, skipped };
130
+
131
+ let fixed = content;
132
+ let applied = 0;
133
+
134
+ // Multi-line: useless_jsdoc 제거
135
+ if (fixable.some(i => i.type === 'useless_jsdoc')) {
136
+ const matches = fixed.match(/\/\*\*\s*\n\s*\*\s*\n\s*\*\/\n?/g);
137
+ if (matches) {
138
+ fixed = fixed.replace(/\/\*\*\s*\n\s*\*\s*\n\s*\*\/\n?/g, '');
139
+ applied += matches.length;
140
+ }
141
+ }
142
+
143
+ // Line-level: trivial_comment, console_debug, commented_code 제거
144
+ const lineTypes = new Set(
145
+ fixable
146
+ .filter(i => ['trivial_comment', 'console_debug', 'commented_code'].includes(i.type))
147
+ .map(i => i.type),
148
+ );
149
+
150
+ if (lineTypes.size > 0) {
151
+ const linePatterns = SLOP_PATTERNS.filter(p => lineTypes.has(p.type));
152
+ const lines = fixed.split('\n');
153
+ const result = [];
154
+ for (const line of lines) {
155
+ let remove = false;
156
+ for (const p of linePatterns) {
157
+ if (p.pattern.test(line)) {
158
+ remove = true;
159
+ applied++;
160
+ break;
161
+ }
162
+ }
163
+ if (!remove) result.push(line);
164
+ }
165
+ fixed = result.join('\n');
166
+ }
167
+
168
+ return { fixed, applied, skipped };
169
+ }
170
+
171
+ function matchesGlob(filePath, pattern) {
172
+ const normalized = '/' + filePath.replace(/\\/g, '/');
173
+
174
+ // **/*.ext → 확장자 매칭
175
+ if (pattern.startsWith('**/*.')) {
176
+ const ext = pattern.slice(4);
177
+ return normalized.endsWith(ext);
178
+ }
179
+
180
+ // *.ext → 확장자 매칭 (디렉토리 무관)
181
+ if (pattern.startsWith('*.') && !pattern.includes('/')) {
182
+ const ext = pattern.slice(1);
183
+ return normalized.endsWith(ext);
184
+ }
185
+
186
+ // **/dir/** → 디렉토리 포함 여부
187
+ const dirMatch = pattern.match(/^\*\*\/([^*]+)\/\*\*$/);
188
+ if (dirMatch) {
189
+ return normalized.includes('/' + dirMatch[1] + '/');
190
+ }
191
+
192
+ return false;
193
+ }
194
+
195
+ /**
196
+ * 디렉토리 전체 스캔
197
+ * @param {string} dirPath - 스캔 대상 디렉토리
198
+ * @param {object} [opts]
199
+ * @param {string[]} [opts.include] - 포함할 glob 패턴
200
+ * @param {string[]} [opts.exclude] - 제외할 glob 패턴
201
+ * @param {boolean} [opts.autoFix] - 자동 수정 여부
202
+ * @returns {Promise<{ files: Array<{path: string, issues: Array, score: number}>, summary: object }>}
203
+ */
204
+ export async function scanDirectory(dirPath, opts = {}) {
205
+ const {
206
+ include = ['**/*.mjs', '**/*.js', '**/*.ts'],
207
+ exclude = ['**/node_modules/**', '**/dist/**', '**/.git/**'],
208
+ autoFix = false,
209
+ } = opts;
210
+
211
+ const entries = await readdir(dirPath, { recursive: true });
212
+ const files = [];
213
+
214
+ for (const entry of entries) {
215
+ const normalized = entry.replace(/\\/g, '/');
216
+ const fullPath = join(dirPath, entry);
217
+
218
+ let st;
219
+ try { st = await stat(fullPath); } catch { continue; }
220
+ if (!st.isFile()) continue;
221
+
222
+ const included = include.some(p => matchesGlob(normalized, p));
223
+ const excluded = exclude.some(p => matchesGlob(normalized, p));
224
+ if (!included || excluded) continue;
225
+
226
+ const fileContent = await readFile(fullPath, 'utf-8');
227
+ const { issues, score } = detectSlop(fileContent, normalized);
228
+
229
+ if (autoFix && issues.length > 0) {
230
+ const { fixed, applied } = autoFixSlop(fileContent, issues);
231
+ if (applied > 0) await writeFile(fullPath, fixed, 'utf-8');
232
+ }
233
+
234
+ files.push({ path: normalized, issues, score });
235
+ }
236
+
237
+ const totalIssues = files.reduce((sum, f) => sum + f.issues.length, 0);
238
+ const avgScore = files.length > 0
239
+ ? Math.round(files.reduce((sum, f) => sum + f.score, 0) / files.length)
240
+ : 100;
241
+
242
+ const byType = {};
243
+ for (const f of files) {
244
+ for (const issue of f.issues) {
245
+ byType[issue.type] = (byType[issue.type] || 0) + 1;
246
+ }
247
+ }
248
+
249
+ return {
250
+ files,
251
+ summary: { totalFiles: files.length, totalIssues, averageScore: avgScore, byType },
252
+ };
253
+ }