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.
- package/CLAUDE.md +171 -0
- package/README.md +32 -15
- package/bin/triflux.mjs +62 -5
- package/hooks/agent-route-guard.mjs +109 -0
- package/hooks/cross-review-tracker.mjs +122 -0
- package/hooks/error-context.mjs +148 -0
- package/hooks/hook-adaptive-collector.mjs +86 -0
- package/hooks/hook-manager.mjs +365 -0
- package/hooks/hook-orchestrator.mjs +312 -0
- package/hooks/hook-registry.json +246 -0
- package/hooks/hooks.json +89 -0
- package/hooks/keyword-rules.json +574 -0
- package/hooks/lib/resolve-root.mjs +59 -0
- package/hooks/mcp-config-watcher.mjs +80 -0
- package/hooks/pipeline-stop.mjs +76 -0
- package/hooks/safety-guard.mjs +169 -0
- package/hooks/subagent-verifier.mjs +80 -0
- package/hub/account-broker.mjs +251 -0
- package/hub/adaptive-diagnostic.mjs +323 -0
- package/hub/adaptive-inject.mjs +186 -0
- package/hub/adaptive-memory.mjs +163 -0
- package/hub/adaptive.mjs +143 -0
- package/hub/assign-callbacks.mjs +133 -0
- package/hub/bridge.mjs +799 -0
- package/hub/cli-adapter-base.mjs +280 -0
- package/hub/codex-adapter.mjs +199 -0
- package/hub/codex-compat.mjs +11 -0
- package/hub/codex-preflight.mjs +166 -0
- package/hub/delegator/contracts.mjs +37 -0
- package/hub/delegator/index.mjs +14 -0
- package/hub/delegator/schema/delegator-tools.schema.json +250 -0
- package/hub/delegator/service.mjs +307 -0
- package/hub/delegator/tool-definitions.mjs +35 -0
- package/hub/fullcycle.mjs +96 -0
- package/hub/gemini-adapter.mjs +180 -0
- package/hub/hitl.mjs +143 -0
- package/hub/intent.mjs +193 -0
- package/hub/lib/cache-guard.mjs +114 -0
- package/hub/lib/known-errors.json +72 -0
- package/hub/lib/memory-store.mjs +748 -0
- package/hub/lib/process-utils.mjs +361 -0
- package/hub/lib/ssh-command.mjs +211 -0
- package/hub/lib/ssh-retry.mjs +59 -0
- package/hub/lib/uuidv7.mjs +44 -0
- package/hub/memory-doctor.mjs +480 -0
- package/hub/middleware/request-logger.mjs +161 -0
- package/hub/paths.mjs +30 -0
- package/hub/pipe.mjs +664 -0
- package/hub/pipeline/gates/confidence.mjs +56 -0
- package/hub/pipeline/gates/consensus.mjs +94 -0
- package/hub/pipeline/gates/index.mjs +5 -0
- package/hub/pipeline/gates/selfcheck.mjs +82 -0
- package/hub/pipeline/index.mjs +318 -0
- package/hub/pipeline/state.mjs +191 -0
- package/hub/pipeline/transitions.mjs +124 -0
- package/hub/platform.mjs +225 -0
- package/hub/public/dashboard.html +355 -0
- package/hub/public/tray-icon.ico +0 -0
- package/hub/public/tray-icon.png +0 -0
- package/hub/quality/deslop.mjs +253 -0
- package/hub/reflexion.mjs +372 -0
- package/hub/research.mjs +146 -0
- package/hub/router.mjs +791 -0
- package/hub/routing/complexity.mjs +166 -0
- package/hub/routing/index.mjs +117 -0
- package/hub/routing/q-learning.mjs +336 -0
- package/hub/schema.sql +148 -0
- package/hub/server.mjs +1264 -0
- package/hub/session-fingerprint.mjs +352 -0
- package/hub/state.mjs +258 -0
- package/hub/store-adapter.mjs +118 -0
- package/hub/store.mjs +857 -0
- package/hub/team/agent-map.json +11 -0
- package/hub/team/ansi.mjs +379 -0
- package/hub/team/backend.mjs +90 -0
- package/hub/team/cli/commands/attach.mjs +37 -0
- package/hub/team/cli/commands/control.mjs +43 -0
- package/hub/team/cli/commands/debug.mjs +74 -0
- package/hub/team/cli/commands/focus.mjs +53 -0
- package/hub/team/cli/commands/interrupt.mjs +36 -0
- package/hub/team/cli/commands/kill.mjs +37 -0
- package/hub/team/cli/commands/list.mjs +24 -0
- package/hub/team/cli/commands/send.mjs +37 -0
- package/hub/team/cli/commands/start/index.mjs +106 -0
- package/hub/team/cli/commands/start/parse-args.mjs +130 -0
- package/hub/team/cli/commands/start/start-headless.mjs +109 -0
- package/hub/team/cli/commands/start/start-in-process.mjs +40 -0
- package/hub/team/cli/commands/start/start-mux.mjs +73 -0
- package/hub/team/cli/commands/start/start-wt.mjs +69 -0
- package/hub/team/cli/commands/status.mjs +87 -0
- package/hub/team/cli/commands/stop.mjs +31 -0
- package/hub/team/cli/commands/task.mjs +30 -0
- package/hub/team/cli/commands/tasks.mjs +13 -0
- package/hub/team/cli/help.mjs +42 -0
- package/hub/team/cli/index.mjs +41 -0
- package/hub/team/cli/manifest.mjs +29 -0
- package/hub/team/cli/render.mjs +30 -0
- package/hub/team/cli/services/attach-fallback.mjs +54 -0
- package/hub/team/cli/services/hub-client.mjs +227 -0
- package/hub/team/cli/services/member-selector.mjs +30 -0
- package/hub/team/cli/services/native-control.mjs +117 -0
- package/hub/team/cli/services/runtime-mode.mjs +62 -0
- package/hub/team/cli/services/state-store.mjs +48 -0
- package/hub/team/cli/services/task-model.mjs +30 -0
- package/hub/team/conductor-mesh-bridge.mjs +121 -0
- package/hub/team/conductor.mjs +671 -0
- package/hub/team/dashboard-anchor.mjs +14 -0
- package/hub/team/dashboard-layout.mjs +33 -0
- package/hub/team/dashboard-open.mjs +153 -0
- package/hub/team/dashboard.mjs +274 -0
- package/hub/team/event-log.mjs +76 -0
- package/hub/team/handoff.mjs +303 -0
- package/hub/team/headless.mjs +1156 -0
- package/hub/team/health-probe.mjs +272 -0
- package/hub/team/launcher-template.mjs +95 -0
- package/hub/team/lead-control.mjs +104 -0
- package/hub/team/native-supervisor.mjs +392 -0
- package/hub/team/native.mjs +649 -0
- package/hub/team/nativeProxy.mjs +688 -0
- package/hub/team/notify.mjs +293 -0
- package/hub/team/orchestrator.mjs +161 -0
- package/hub/team/pane.mjs +153 -0
- package/hub/team/process-cleanup.mjs +342 -0
- package/hub/team/psmux.mjs +1354 -0
- package/hub/team/remote-probe.mjs +276 -0
- package/hub/team/remote-session.mjs +299 -0
- package/hub/team/remote-watcher.mjs +478 -0
- package/hub/team/routing.mjs +223 -0
- package/hub/team/session-sync.mjs +169 -0
- package/hub/team/session.mjs +611 -0
- package/hub/team/shared.mjs +13 -0
- package/hub/team/staleState.mjs +361 -0
- package/hub/team/swarm-hypervisor.mjs +589 -0
- package/hub/team/swarm-locks.mjs +204 -0
- package/hub/team/swarm-planner.mjs +260 -0
- package/hub/team/swarm-reconciler.mjs +137 -0
- package/hub/team/tui-lite.mjs +380 -0
- package/hub/team/tui-remote-adapter.mjs +393 -0
- package/hub/team/tui-viewer.mjs +463 -0
- package/hub/team/tui.mjs +1449 -0
- package/hub/team/worktree-lifecycle.mjs +193 -0
- package/hub/team/wt-manager.mjs +407 -0
- package/hub/team/wt-templates.json +43 -0
- package/hub/team-bridge.mjs +27 -0
- package/hub/token-mode.mjs +224 -0
- package/hub/tools.mjs +636 -0
- package/hub/tray.mjs +376 -0
- package/hub/workers/claude-worker.mjs +475 -0
- package/hub/workers/codex-mcp.mjs +507 -0
- package/hub/workers/delegator-mcp.mjs +1076 -0
- package/hub/workers/factory.mjs +21 -0
- package/hub/workers/gemini-worker.mjs +374 -0
- package/hub/workers/interface.mjs +52 -0
- package/hub/workers/worker-utils.mjs +104 -0
- package/hud/colors.mjs +88 -0
- package/hud/constants.mjs +88 -0
- package/hud/context-monitor.mjs +403 -0
- package/hud/hud-qos-status.mjs +210 -0
- package/hud/providers/claude.mjs +314 -0
- package/hud/providers/codex.mjs +151 -0
- package/hud/providers/gemini.mjs +320 -0
- package/hud/renderers.mjs +442 -0
- package/hud/terminal.mjs +140 -0
- package/hud/utils.mjs +313 -0
- package/mesh/index.mjs +63 -0
- package/mesh/mesh-budget.mjs +128 -0
- package/mesh/mesh-heartbeat.mjs +100 -0
- package/mesh/mesh-protocol.mjs +96 -0
- package/mesh/mesh-queue.mjs +165 -0
- package/mesh/mesh-registry.mjs +78 -0
- package/mesh/mesh-router.mjs +76 -0
- package/package.json +8 -1
- package/references/hosts.json +33 -0
- package/scripts/__tests__/gen-skill-docs.test.mjs +87 -0
- package/scripts/__tests__/keyword-detector.test.mjs +234 -0
- package/scripts/__tests__/mcp-guard-engine.test.mjs +118 -0
- package/scripts/__tests__/remote-spawn-transfer.test.mjs +117 -0
- package/scripts/__tests__/remote-spawn.test.mjs +92 -0
- package/scripts/__tests__/skill-template.test.mjs +193 -0
- package/scripts/__tests__/smoke.test.mjs +34 -0
- package/scripts/cache-buildup.mjs +30 -0
- package/scripts/cache-doctor.mjs +149 -0
- package/scripts/cache-warmup.mjs +557 -0
- package/scripts/claudemd-sync.mjs +148 -0
- package/scripts/cli-route.sh +3 -0
- package/scripts/completions/tfx.bash +47 -0
- package/scripts/completions/tfx.fish +44 -0
- package/scripts/completions/tfx.zsh +83 -0
- package/scripts/cross-review-gate.mjs +126 -0
- package/scripts/cross-review-tracker.mjs +238 -0
- package/scripts/gen-skill-docs.mjs +111 -0
- package/scripts/headless-guard-fast.sh +21 -0
- package/scripts/headless-guard.mjs +360 -0
- package/scripts/hub-ensure.mjs +120 -0
- package/scripts/keyword-detector.mjs +272 -0
- package/scripts/keyword-rules-expander.mjs +521 -0
- package/scripts/lib/claudemd-scanner.mjs +218 -0
- package/scripts/lib/context.mjs +67 -0
- package/scripts/lib/cross-review-utils.mjs +51 -0
- package/scripts/lib/env-probe.mjs +241 -0
- package/scripts/lib/gemini-profiles.mjs +85 -0
- package/scripts/lib/handoff.mjs +171 -0
- package/scripts/lib/hook-utils.mjs +14 -0
- package/scripts/lib/keyword-rules.mjs +166 -0
- package/scripts/lib/logger.mjs +105 -0
- package/scripts/lib/mcp-filter.mjs +739 -0
- package/scripts/lib/mcp-guard-engine.mjs +954 -0
- package/scripts/lib/mcp-manifest.mjs +79 -0
- package/scripts/lib/mcp-server-catalog.mjs +118 -0
- package/scripts/lib/psmux-info.mjs +119 -0
- package/scripts/lib/remote-spawn-transfer.mjs +196 -0
- package/scripts/lib/skill-template.mjs +326 -0
- package/scripts/mcp-check.mjs +237 -0
- package/scripts/mcp-cleanup.ps1 +17 -0
- package/scripts/mcp-gateway-config.mjs +207 -0
- package/scripts/mcp-gateway-ensure.mjs +85 -0
- package/scripts/mcp-gateway-integration-test.mjs +228 -0
- package/scripts/mcp-gateway-start.mjs +226 -0
- package/scripts/mcp-gateway-start.ps1 +141 -0
- package/scripts/mcp-gateway-verify.mjs +77 -0
- package/scripts/mcp-safety-guard.mjs +44 -0
- package/scripts/notion-read.mjs +556 -0
- package/scripts/pack.mjs +295 -0
- package/scripts/preflight-cache.mjs +69 -0
- package/scripts/preinstall.mjs +96 -0
- package/scripts/remote-spawn.mjs +1376 -0
- package/scripts/run.cjs +79 -0
- package/scripts/session-spawn-helper.mjs +185 -0
- package/scripts/setup.mjs +1178 -0
- package/scripts/test-lock.mjs +71 -0
- package/scripts/test-tfx-route-no-claude-native.mjs +57 -0
- package/scripts/tfx-batch-stats.mjs +96 -0
- package/scripts/tfx-gate-activate.mjs +89 -0
- package/scripts/tfx-route-post.mjs +505 -0
- package/scripts/tfx-route-worker.mjs +223 -0
- package/scripts/tfx-route.sh +2014 -0
- package/scripts/tmp-cleanup.mjs +103 -0
- package/scripts/token-snapshot.mjs +575 -0
- package/skills/tfx-auto/SKILL.md.tmpl +2 -3
- package/skills/tfx-autoresearch/SKILL.md +6 -5
- package/skills/tfx-codex/SKILL.md.tmpl +2 -3
- package/skills/tfx-codex-swarm-workspace/iteration-1/benchmark.json +33 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/eval_metadata.json +42 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/grading.json +11 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/analysis.md +87 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/classification.md +35 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/commands.sh +275 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/routing.md +56 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/timing.json +5 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/grading.json +11 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/analysis.md +92 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/classification.md +71 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/commands.sh +264 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/routing.md +113 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/timing.json +5 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/eval_metadata.json +32 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/grading.json +9 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/analysis.md +96 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/classification.md +38 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/commands.sh +151 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/routing.md +51 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/timing.json +5 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/grading.json +9 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/analysis.md +127 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/classification.md +57 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/commands.sh +129 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/routing.md +84 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/timing.json +5 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/eval_metadata.json +27 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/grading.json +8 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/analysis.md +98 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/classification.md +65 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/commands.sh +123 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/routing.md +66 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/timing.json +5 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/grading.json +8 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/analysis.md +88 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/classification.md +40 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/commands.sh +130 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/routing.md +61 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/timing.json +5 -0
- package/skills/tfx-deep-interview/SKILL.md +1 -2
- package/skills/tfx-plan/SKILL.md.tmpl +2 -3
- package/skills/tfx-psmux-rules/SKILL.md +11 -2
- package/skills/tfx-qa/SKILL.md.tmpl +2 -3
- package/skills/tfx-remote-spawn/SKILL.md +8 -11
- package/skills/tfx-research/SKILL.md.tmpl +2 -3
- package/skills/tfx-review/SKILL.md.tmpl +2 -3
- package/skills/tfx-workspace/async-tests/run-tests.sh +203 -0
- package/skills/tfx-workspace/evals/evals.json +79 -0
- package/skills/tfx-workspace/iteration-1/benchmark.json +162 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/eval_metadata.json +11 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/grading.json +9 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/outputs/analysis.md +154 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/grading.json +9 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/outputs/analysis.md +126 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/eval_metadata.json +11 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/grading.json +9 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/outputs/analysis.md +119 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/grading.json +9 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/outputs/analysis.md +115 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/eval_metadata.json +10 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/grading.json +8 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/outputs/analysis.md +86 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/grading.json +8 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/outputs/analysis.md +81 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/eval_metadata.json +12 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/outputs/analysis.md +316 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/outputs/analysis.md +352 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/review.html +1325 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/eval_metadata.json +12 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/outputs/analysis.md +97 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/outputs/analysis.md +94 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/eval_metadata.json +12 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/outputs/analysis.md +209 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/outputs/analysis.md +193 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-2/benchmark.json +62 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/eval_metadata.json +13 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/grading.json +11 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/outputs/analysis.md +382 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/grading.json +11 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/outputs/analysis.md +333 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-2/review.html +1325 -0
- package/skills/tfx-workspace/skill-snapshot/tfx-auto/SKILL.md +217 -0
- package/skills/{tfx-auto-codex/SKILL.md.tmpl → tfx-workspace/skill-snapshot/tfx-auto-codex/SKILL.md} +3 -31
- package/skills/tfx-workspace/skill-snapshot/tfx-codex/SKILL.md +65 -0
- package/skills/tfx-workspace/skill-snapshot/tfx-doctor/SKILL.md +94 -0
- package/skills/{tfx-gemini/SKILL.md.tmpl → tfx-workspace/skill-snapshot/tfx-gemini/SKILL.md} +6 -14
- package/skills/tfx-workspace/skill-snapshot/tfx-hub/SKILL.md +133 -0
- package/skills/tfx-workspace/skill-snapshot/tfx-multi/SKILL.md +426 -0
- package/skills/tfx-workspace/skill-snapshot/tfx-setup/SKILL.md +101 -0
- package/skills/merge-worktree/SKILL.md.tmpl +0 -144
- package/skills/shared/arguments-processing.md +0 -2
- package/skills/shared/mandatory-rules.md +0 -6
- package/skills/shared/telemetry-segment.md +0 -6
- package/skills/star-prompt/SKILL.md.tmpl +0 -122
- package/skills/tfx-analysis/SKILL.md.tmpl +0 -106
- package/skills/tfx-analysis/skill.json +0 -11
- package/skills/tfx-auto/skill.json +0 -26
- package/skills/tfx-auto-codex/skill.json +0 -8
- package/skills/tfx-autopilot/SKILL.md.tmpl +0 -115
- package/skills/tfx-autopilot/skill.json +0 -10
- package/skills/tfx-autoresearch/SKILL.md.tmpl +0 -135
- package/skills/tfx-autoresearch/skill.json +0 -14
- package/skills/tfx-autoroute/SKILL.md.tmpl +0 -188
- package/skills/tfx-autoroute/skill.json +0 -12
- package/skills/tfx-codex/skill.json +0 -8
- package/skills/tfx-codex-swarm/SKILL.md.tmpl +0 -16
- package/skills/tfx-codex-swarm/skill.json +0 -5
- package/skills/tfx-consensus/SKILL.md.tmpl +0 -145
- package/skills/tfx-consensus/skill.json +0 -8
- package/skills/tfx-debate/SKILL.md.tmpl +0 -191
- package/skills/tfx-debate/skill.json +0 -12
- package/skills/tfx-deep-analysis/SKILL.md.tmpl +0 -227
- package/skills/tfx-deep-analysis/skill.json +0 -10
- package/skills/tfx-deep-interview/SKILL.md.tmpl +0 -203
- package/skills/tfx-deep-interview/skill.json +0 -12
- package/skills/tfx-deep-plan/SKILL.md.tmpl +0 -281
- package/skills/tfx-deep-plan/skill.json +0 -13
- package/skills/tfx-deep-qa/SKILL.md.tmpl +0 -164
- package/skills/tfx-deep-qa/skill.json +0 -11
- package/skills/tfx-deep-research/SKILL.md.tmpl +0 -216
- package/skills/tfx-deep-research/skill.json +0 -14
- package/skills/tfx-deep-review/SKILL.md.tmpl +0 -178
- package/skills/tfx-deep-review/skill.json +0 -12
- package/skills/tfx-doctor/SKILL.md.tmpl +0 -172
- package/skills/tfx-doctor/skill.json +0 -8
- package/skills/tfx-find/skill.json +0 -12
- package/skills/tfx-forge/SKILL.md.tmpl +0 -187
- package/skills/tfx-forge/skill.json +0 -12
- package/skills/tfx-fullcycle/SKILL.md.tmpl +0 -285
- package/skills/tfx-fullcycle/skill.json +0 -11
- package/skills/tfx-gemini/skill.json +0 -8
- package/skills/tfx-hooks/SKILL.md.tmpl +0 -216
- package/skills/tfx-hooks/skill.json +0 -8
- package/skills/tfx-hub/SKILL.md.tmpl +0 -212
- package/skills/tfx-hub/skill.json +0 -8
- package/skills/tfx-index/skill.json +0 -11
- package/skills/tfx-interview/SKILL.md.tmpl +0 -284
- package/skills/tfx-interview/skill.json +0 -12
- package/skills/tfx-multi/SKILL.md.tmpl +0 -183
- package/skills/tfx-multi/skill.json +0 -8
- package/skills/tfx-panel/SKILL.md.tmpl +0 -188
- package/skills/tfx-panel/skill.json +0 -12
- package/skills/tfx-persist/SKILL.md.tmpl +0 -269
- package/skills/tfx-persist/skill.json +0 -12
- package/skills/tfx-plan/skill.json +0 -11
- package/skills/tfx-profile/SKILL.md.tmpl +0 -239
- package/skills/tfx-profile/skill.json +0 -8
- package/skills/tfx-prune/SKILL.md.tmpl +0 -199
- package/skills/tfx-prune/skill.json +0 -12
- package/skills/tfx-psmux-rules/SKILL.md.tmpl +0 -317
- package/skills/tfx-psmux-rules/skill.json +0 -8
- package/skills/tfx-qa/skill.json +0 -11
- package/skills/tfx-ralph/SKILL.md.tmpl +0 -27
- package/skills/tfx-ralph/skill.json +0 -8
- package/skills/tfx-remote-setup/SKILL.md.tmpl +0 -576
- package/skills/tfx-remote-setup/skill.json +0 -8
- package/skills/tfx-remote-spawn/SKILL.md.tmpl +0 -263
- package/skills/tfx-remote-spawn/skill.json +0 -9
- package/skills/tfx-research/skill.json +0 -13
- package/skills/tfx-review/skill.json +0 -11
- package/skills/tfx-setup/SKILL.md.tmpl +0 -380
- package/skills/tfx-setup/skill.json +0 -8
- package/skills/tfx-swarm/SKILL.md.tmpl +0 -154
- package/skills/tfx-swarm/skill.json +0 -5
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// session-vault 태그 빈도 기반으로 keyword-rules.json 확장 후보를 제안하는 스크립트
|
|
3
|
+
|
|
4
|
+
import Database from "better-sqlite3";
|
|
5
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { homedir } from "node:os";
|
|
7
|
+
import { dirname, join, resolve } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
|
|
10
|
+
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const PROJECT_ROOT = dirname(SCRIPT_DIR);
|
|
12
|
+
const RULES_PATH = join(PROJECT_ROOT, "hooks", "keyword-rules.json");
|
|
13
|
+
const DEFAULT_DB_PATH = "~/Desktop/Projects/tools/session-vault/sessions_v2.db";
|
|
14
|
+
const DEFAULT_THRESHOLD = 3;
|
|
15
|
+
const SOURCE_FILTER = "ollama-%";
|
|
16
|
+
|
|
17
|
+
// 서비스명 → 기본 mcp_route 매핑
|
|
18
|
+
const MCP_SERVICE_ROUTE_MAP = {
|
|
19
|
+
notion: "gemini",
|
|
20
|
+
jira: "codex",
|
|
21
|
+
chrome: "gemini",
|
|
22
|
+
playwright: "gemini",
|
|
23
|
+
canva: "gemini",
|
|
24
|
+
calendar: "gemini",
|
|
25
|
+
gmail: "gemini",
|
|
26
|
+
email: "gemini",
|
|
27
|
+
github: "codex",
|
|
28
|
+
figma: "gemini"
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const MCP_SERVICE_NAMES = new Set([
|
|
32
|
+
...Object.keys(MCP_SERVICE_ROUTE_MAP),
|
|
33
|
+
"slack",
|
|
34
|
+
"linear",
|
|
35
|
+
"confluence",
|
|
36
|
+
"trello",
|
|
37
|
+
"asana",
|
|
38
|
+
"drive",
|
|
39
|
+
"sheets",
|
|
40
|
+
"docs"
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
function printUsage() {
|
|
44
|
+
console.log("사용법:");
|
|
45
|
+
console.log(" node scripts/keyword-rules-expander.mjs --dry-run");
|
|
46
|
+
console.log(" node scripts/keyword-rules-expander.mjs --threshold 5");
|
|
47
|
+
console.log(" node scripts/keyword-rules-expander.mjs --apply");
|
|
48
|
+
console.log(" node scripts/keyword-rules-expander.mjs --db-path ./other.db");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function parseArgs(argv) {
|
|
52
|
+
const args = {
|
|
53
|
+
dryRun: false,
|
|
54
|
+
apply: false,
|
|
55
|
+
threshold: DEFAULT_THRESHOLD,
|
|
56
|
+
dbPath: DEFAULT_DB_PATH,
|
|
57
|
+
help: false
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
61
|
+
const token = argv[i];
|
|
62
|
+
|
|
63
|
+
if (token === "--dry-run") {
|
|
64
|
+
args.dryRun = true;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (token === "--apply") {
|
|
69
|
+
args.apply = true;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (token === "--help" || token === "-h") {
|
|
74
|
+
args.help = true;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (token === "--threshold") {
|
|
79
|
+
const next = argv[i + 1];
|
|
80
|
+
if (!next) throw new Error("--threshold 값이 필요합니다.");
|
|
81
|
+
const parsed = Number.parseInt(next, 10);
|
|
82
|
+
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
83
|
+
throw new Error("--threshold는 1 이상의 정수여야 합니다.");
|
|
84
|
+
}
|
|
85
|
+
args.threshold = parsed;
|
|
86
|
+
i += 1;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (token.startsWith("--threshold=")) {
|
|
91
|
+
const raw = token.slice("--threshold=".length);
|
|
92
|
+
const parsed = Number.parseInt(raw, 10);
|
|
93
|
+
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
94
|
+
throw new Error("--threshold는 1 이상의 정수여야 합니다.");
|
|
95
|
+
}
|
|
96
|
+
args.threshold = parsed;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (token === "--db-path") {
|
|
101
|
+
const next = argv[i + 1];
|
|
102
|
+
if (!next) throw new Error("--db-path 값이 필요합니다.");
|
|
103
|
+
args.dbPath = next;
|
|
104
|
+
i += 1;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (token.startsWith("--db-path=")) {
|
|
109
|
+
args.dbPath = token.slice("--db-path=".length);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
throw new Error(`알 수 없는 옵션: ${token}`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!args.dryRun && !args.apply) args.dryRun = true;
|
|
117
|
+
if (args.apply) args.dryRun = false;
|
|
118
|
+
return args;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function expandHomePath(inputPath) {
|
|
122
|
+
if (!inputPath) return inputPath;
|
|
123
|
+
if (inputPath === "~") return homedir();
|
|
124
|
+
if (inputPath.startsWith("~/") || inputPath.startsWith("~\\")) {
|
|
125
|
+
return join(homedir(), inputPath.slice(2));
|
|
126
|
+
}
|
|
127
|
+
return inputPath;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function toDisplayPath(pathValue) {
|
|
131
|
+
const homePath = homedir();
|
|
132
|
+
if (pathValue.toLowerCase().startsWith(homePath.toLowerCase())) {
|
|
133
|
+
let rest = pathValue.slice(homePath.length).replace(/\\/g, "/");
|
|
134
|
+
if (rest && !rest.startsWith("/")) rest = `/${rest}`;
|
|
135
|
+
return `~${rest}`;
|
|
136
|
+
}
|
|
137
|
+
return pathValue;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function normalizeKeyword(value) {
|
|
141
|
+
if (typeof value !== "string") return "";
|
|
142
|
+
return value.trim().toLowerCase();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function slugifyKeyword(value) {
|
|
146
|
+
const base = normalizeKeyword(value)
|
|
147
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
148
|
+
.replace(/^-+|-+$/g, "")
|
|
149
|
+
.replace(/-{2,}/g, "-");
|
|
150
|
+
return base || "keyword";
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function escapeRegExp(value) {
|
|
154
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function splitSources(raw) {
|
|
158
|
+
if (typeof raw !== "string" || !raw.trim()) return [];
|
|
159
|
+
return raw
|
|
160
|
+
.split(",")
|
|
161
|
+
.map((item) => item.trim())
|
|
162
|
+
.filter(Boolean);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function fetchTagFrequencyRows(dbPath) {
|
|
166
|
+
const db = new Database(dbPath, { readonly: true, fileMustExist: true });
|
|
167
|
+
|
|
168
|
+
try {
|
|
169
|
+
const stmt = db.prepare(`
|
|
170
|
+
SELECT
|
|
171
|
+
t.tag AS tag,
|
|
172
|
+
COUNT(*) AS frequency,
|
|
173
|
+
GROUP_CONCAT(DISTINCT tt.source) AS sources
|
|
174
|
+
FROM turn_tags tt
|
|
175
|
+
INNER JOIN tags t ON t.id = tt.tag_id
|
|
176
|
+
WHERE tt.source LIKE ?
|
|
177
|
+
AND t.tag IS NOT NULL
|
|
178
|
+
AND TRIM(t.tag) <> ''
|
|
179
|
+
GROUP BY t.tag
|
|
180
|
+
ORDER BY frequency DESC, t.tag ASC
|
|
181
|
+
`);
|
|
182
|
+
|
|
183
|
+
return stmt.all(SOURCE_FILTER);
|
|
184
|
+
} finally {
|
|
185
|
+
db.close();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function aggregateByNormalizedTag(rows) {
|
|
190
|
+
const map = new Map();
|
|
191
|
+
|
|
192
|
+
for (const row of rows) {
|
|
193
|
+
const tag = typeof row.tag === "string" ? row.tag.trim() : "";
|
|
194
|
+
if (!tag) continue;
|
|
195
|
+
|
|
196
|
+
const normalized = normalizeKeyword(tag);
|
|
197
|
+
if (!normalized) continue;
|
|
198
|
+
|
|
199
|
+
if (!map.has(normalized)) {
|
|
200
|
+
map.set(normalized, {
|
|
201
|
+
keyword: tag,
|
|
202
|
+
normalized,
|
|
203
|
+
frequency: 0,
|
|
204
|
+
variants: new Set(),
|
|
205
|
+
sources: new Set()
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const current = map.get(normalized);
|
|
210
|
+
current.frequency += Number(row.frequency) || 0;
|
|
211
|
+
current.variants.add(tag);
|
|
212
|
+
for (const source of splitSources(row.sources)) {
|
|
213
|
+
current.sources.add(source);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return [...map.values()].sort((a, b) => {
|
|
218
|
+
if (a.frequency !== b.frequency) return b.frequency - a.frequency;
|
|
219
|
+
return a.keyword.localeCompare(b.keyword);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function readRulesDocument(rulesPath) {
|
|
224
|
+
const raw = readFileSync(rulesPath, "utf8");
|
|
225
|
+
const parsed = JSON.parse(raw);
|
|
226
|
+
if (!parsed || !Array.isArray(parsed.rules)) {
|
|
227
|
+
throw new Error("keyword-rules.json 형식이 올바르지 않습니다.");
|
|
228
|
+
}
|
|
229
|
+
return parsed;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function extractLiteralWords(patternSource) {
|
|
233
|
+
const words = patternSource.toLowerCase().match(/[a-z0-9][a-z0-9-]{1,}/g) || [];
|
|
234
|
+
return words.filter((word) => !["true", "false", "null", "route", "skill"].includes(word));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function buildRuleIndex(rules) {
|
|
238
|
+
const indexed = [];
|
|
239
|
+
|
|
240
|
+
for (const rule of rules) {
|
|
241
|
+
const aliases = new Set();
|
|
242
|
+
const regexes = [];
|
|
243
|
+
|
|
244
|
+
const ruleId = typeof rule.id === "string" ? rule.id.trim() : "";
|
|
245
|
+
const skill = typeof rule.skill === "string" ? rule.skill.trim() : "";
|
|
246
|
+
const route = typeof rule.mcp_route === "string" ? rule.mcp_route.trim() : "";
|
|
247
|
+
|
|
248
|
+
if (ruleId) aliases.add(normalizeKeyword(ruleId));
|
|
249
|
+
if (ruleId.endsWith("-route")) aliases.add(normalizeKeyword(ruleId.slice(0, -"-route".length)));
|
|
250
|
+
if (ruleId.endsWith("-skill")) aliases.add(normalizeKeyword(ruleId.slice(0, -"-skill".length)));
|
|
251
|
+
if (skill) aliases.add(normalizeKeyword(skill));
|
|
252
|
+
if (route) aliases.add(normalizeKeyword(route));
|
|
253
|
+
|
|
254
|
+
for (const pattern of Array.isArray(rule.patterns) ? rule.patterns : []) {
|
|
255
|
+
if (!pattern || typeof pattern.source !== "string" || typeof pattern.flags !== "string") continue;
|
|
256
|
+
try {
|
|
257
|
+
regexes.push(new RegExp(pattern.source, pattern.flags));
|
|
258
|
+
} catch {
|
|
259
|
+
// 잘못된 정규식은 건너뛴다.
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
for (const token of extractLiteralWords(pattern.source)) {
|
|
263
|
+
aliases.add(normalizeKeyword(token));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
indexed.push({
|
|
268
|
+
id: ruleId || "(unknown-rule)",
|
|
269
|
+
aliases,
|
|
270
|
+
regexes
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return indexed;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function findCoveringRule(keyword, ruleIndex) {
|
|
278
|
+
const normalized = normalizeKeyword(keyword);
|
|
279
|
+
const keywordWithSpace = normalized.replace(/[-_]+/g, " ");
|
|
280
|
+
|
|
281
|
+
for (const rule of ruleIndex) {
|
|
282
|
+
if (rule.aliases.has(normalized)) return rule.id;
|
|
283
|
+
|
|
284
|
+
for (const regex of rule.regexes) {
|
|
285
|
+
regex.lastIndex = 0;
|
|
286
|
+
if (regex.test(normalized)) return rule.id;
|
|
287
|
+
regex.lastIndex = 0;
|
|
288
|
+
if (regex.test(keywordWithSpace)) return rule.id;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function classifyCandidate(keyword) {
|
|
296
|
+
const normalized = normalizeKeyword(keyword).replace(/_/g, "-");
|
|
297
|
+
|
|
298
|
+
if (/^tfx-[a-z0-9][a-z0-9-]*$/i.test(normalized)) {
|
|
299
|
+
return {
|
|
300
|
+
type: "skill",
|
|
301
|
+
label: "skill 규칙 후보",
|
|
302
|
+
skill: normalized,
|
|
303
|
+
mcpRoute: null
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (MCP_SERVICE_NAMES.has(normalized)) {
|
|
308
|
+
return {
|
|
309
|
+
type: "mcp_route",
|
|
310
|
+
label: "mcp_route 규칙 후보",
|
|
311
|
+
skill: null,
|
|
312
|
+
mcpRoute: MCP_SERVICE_ROUTE_MAP[normalized] || "gemini"
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return {
|
|
317
|
+
type: "general",
|
|
318
|
+
label: "분류 미정",
|
|
319
|
+
skill: null,
|
|
320
|
+
mcpRoute: null
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function createPatternSource(keyword) {
|
|
325
|
+
const tokens = normalizeKeyword(keyword)
|
|
326
|
+
.split(/[\s_-]+/g)
|
|
327
|
+
.map((item) => item.trim())
|
|
328
|
+
.filter(Boolean)
|
|
329
|
+
.map((item) => escapeRegExp(item));
|
|
330
|
+
|
|
331
|
+
if (tokens.length === 0) return "\\bkeyword\\b";
|
|
332
|
+
if (tokens.length === 1) return `\\b${tokens[0]}\\b`;
|
|
333
|
+
return `\\b${tokens.join("[\\s_-]?")}\\b`;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function uniqueRuleId(baseId, existingIds) {
|
|
337
|
+
if (!existingIds.has(baseId)) return baseId;
|
|
338
|
+
let index = 2;
|
|
339
|
+
while (existingIds.has(`${baseId}-${index}`)) {
|
|
340
|
+
index += 1;
|
|
341
|
+
}
|
|
342
|
+
return `${baseId}-${index}`;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function buildRuleFromCandidate(candidate, existingIds) {
|
|
346
|
+
const slug = slugifyKeyword(candidate.keyword);
|
|
347
|
+
|
|
348
|
+
if (candidate.classification.type === "skill") {
|
|
349
|
+
const ruleId = uniqueRuleId(`${slug}-skill`, existingIds);
|
|
350
|
+
existingIds.add(ruleId);
|
|
351
|
+
return {
|
|
352
|
+
id: ruleId,
|
|
353
|
+
patterns: [
|
|
354
|
+
{
|
|
355
|
+
source: createPatternSource(candidate.keyword),
|
|
356
|
+
flags: "i"
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
skill: candidate.classification.skill,
|
|
360
|
+
priority: 20,
|
|
361
|
+
supersedes: [],
|
|
362
|
+
exclusive: false,
|
|
363
|
+
state: null,
|
|
364
|
+
mcp_route: null
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (candidate.classification.type === "mcp_route") {
|
|
369
|
+
const ruleId = uniqueRuleId(`${slug}-route`, existingIds);
|
|
370
|
+
existingIds.add(ruleId);
|
|
371
|
+
return {
|
|
372
|
+
id: ruleId,
|
|
373
|
+
patterns: [
|
|
374
|
+
{
|
|
375
|
+
source: createPatternSource(candidate.keyword),
|
|
376
|
+
flags: "i"
|
|
377
|
+
}
|
|
378
|
+
],
|
|
379
|
+
skill: null,
|
|
380
|
+
priority: 20,
|
|
381
|
+
supersedes: [],
|
|
382
|
+
exclusive: false,
|
|
383
|
+
state: null,
|
|
384
|
+
mcp_route: candidate.classification.mcpRoute
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function formatSources(allTags) {
|
|
392
|
+
const sourceSet = new Set();
|
|
393
|
+
for (const tag of allTags) {
|
|
394
|
+
for (const source of tag.sources) sourceSet.add(source);
|
|
395
|
+
}
|
|
396
|
+
const sorted = [...sourceSet].sort((a, b) => a.localeCompare(b));
|
|
397
|
+
if (sorted.length === 0) return "(없음)";
|
|
398
|
+
return sorted.join(", ");
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function printAnalysis({
|
|
402
|
+
dbPathDisplay,
|
|
403
|
+
sourceDisplay,
|
|
404
|
+
totalTags,
|
|
405
|
+
coveredCount,
|
|
406
|
+
threshold,
|
|
407
|
+
candidates,
|
|
408
|
+
covered
|
|
409
|
+
}) {
|
|
410
|
+
console.log("=== keyword-rules-expander 분석 결과 ===");
|
|
411
|
+
console.log("");
|
|
412
|
+
console.log(`DB: ${dbPathDisplay}`);
|
|
413
|
+
console.log(`추출 소스: ${sourceDisplay}`);
|
|
414
|
+
console.log(`총 태그: ${totalTags}개, 기존 규칙 매칭: ${coveredCount}개`);
|
|
415
|
+
console.log("");
|
|
416
|
+
|
|
417
|
+
console.log(`--- 새 규칙 후보 (threshold: ${threshold}) ---`);
|
|
418
|
+
if (candidates.length === 0) {
|
|
419
|
+
console.log(" (없음)");
|
|
420
|
+
} else {
|
|
421
|
+
for (const item of candidates) {
|
|
422
|
+
console.log(` ${item.keyword} (${item.frequency}회) → ${item.classification.label}`);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
console.log("");
|
|
427
|
+
console.log("--- 이미 커버됨 (스킵) ---");
|
|
428
|
+
if (covered.length === 0) {
|
|
429
|
+
console.log(" (없음)");
|
|
430
|
+
} else {
|
|
431
|
+
for (const item of covered) {
|
|
432
|
+
console.log(` ${item.keyword} (${item.frequency}회) → ${item.ruleId} 규칙 있음`);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function main() {
|
|
438
|
+
const args = parseArgs(process.argv.slice(2));
|
|
439
|
+
if (args.help) {
|
|
440
|
+
printUsage();
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const resolvedDbPath = resolve(expandHomePath(args.dbPath));
|
|
445
|
+
const rulesDoc = readRulesDocument(RULES_PATH);
|
|
446
|
+
const ruleIndex = buildRuleIndex(rulesDoc.rules);
|
|
447
|
+
|
|
448
|
+
const rawRows = fetchTagFrequencyRows(resolvedDbPath);
|
|
449
|
+
const tags = aggregateByNormalizedTag(rawRows);
|
|
450
|
+
|
|
451
|
+
const covered = [];
|
|
452
|
+
const candidates = [];
|
|
453
|
+
|
|
454
|
+
for (const tag of tags) {
|
|
455
|
+
const matchedRuleId = findCoveringRule(tag.keyword, ruleIndex);
|
|
456
|
+
|
|
457
|
+
if (matchedRuleId) {
|
|
458
|
+
covered.push({
|
|
459
|
+
keyword: tag.keyword,
|
|
460
|
+
frequency: tag.frequency,
|
|
461
|
+
ruleId: matchedRuleId
|
|
462
|
+
});
|
|
463
|
+
continue;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (tag.frequency < args.threshold) continue;
|
|
467
|
+
|
|
468
|
+
candidates.push({
|
|
469
|
+
keyword: tag.keyword,
|
|
470
|
+
normalized: tag.normalized,
|
|
471
|
+
frequency: tag.frequency,
|
|
472
|
+
classification: classifyCandidate(tag.keyword)
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
printAnalysis({
|
|
477
|
+
dbPathDisplay: toDisplayPath(resolvedDbPath),
|
|
478
|
+
sourceDisplay: formatSources(tags),
|
|
479
|
+
totalTags: tags.length,
|
|
480
|
+
coveredCount: covered.length,
|
|
481
|
+
threshold: args.threshold,
|
|
482
|
+
candidates,
|
|
483
|
+
covered
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
if (!args.apply) return;
|
|
487
|
+
|
|
488
|
+
const existingIds = new Set(
|
|
489
|
+
rulesDoc.rules
|
|
490
|
+
.map((rule) => (typeof rule.id === "string" ? rule.id.trim() : ""))
|
|
491
|
+
.filter(Boolean)
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
const autoApplicable = candidates.filter((item) => item.classification.type !== "general");
|
|
495
|
+
const manualReviewCount = candidates.length - autoApplicable.length;
|
|
496
|
+
|
|
497
|
+
const newRules = autoApplicable
|
|
498
|
+
.map((candidate) => buildRuleFromCandidate(candidate, existingIds))
|
|
499
|
+
.filter(Boolean);
|
|
500
|
+
|
|
501
|
+
if (newRules.length > 0) {
|
|
502
|
+
rulesDoc.rules.push(...newRules);
|
|
503
|
+
writeFileSync(RULES_PATH, `${JSON.stringify(rulesDoc, null, 2)}\n`, "utf8");
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
console.log("");
|
|
507
|
+
console.log("--- 적용 결과 ---");
|
|
508
|
+
console.log(` 추가된 규칙: ${newRules.length}개`);
|
|
509
|
+
if (manualReviewCount > 0) {
|
|
510
|
+
console.log(` 분류 미정(수동 검토): ${manualReviewCount}개`);
|
|
511
|
+
}
|
|
512
|
+
console.log(` 저장 파일: ${RULES_PATH}`);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
try {
|
|
516
|
+
main();
|
|
517
|
+
} catch (error) {
|
|
518
|
+
console.error(`[keyword-rules-expander] 오류: ${error.message}`);
|
|
519
|
+
process.exit(1);
|
|
520
|
+
}
|
|
521
|
+
|