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,218 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
export const TFX_START = "<!-- TFX:START -->";
|
|
7
|
+
export const TFX_END = "<!-- TFX:END -->";
|
|
8
|
+
export const OMC_END = "<!-- OMC:END -->";
|
|
9
|
+
const TFX_VERSION_RE = /<!-- TFX:VERSION:([\d.]+) -->/u;
|
|
10
|
+
|
|
11
|
+
const LEGACY_PATTERNS = [
|
|
12
|
+
/<user_cli_routing>/u,
|
|
13
|
+
/Codex Pro 무료 기간/u,
|
|
14
|
+
/codex exec --dangerously-bypass.*skip-git-repo-check/u,
|
|
15
|
+
/OMC 에이전트 → CLI 매핑/u,
|
|
16
|
+
/Spark 가드레일/u,
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const DEFAULT_TFX_TEMPLATE = [
|
|
20
|
+
"### triflux CLI routing (managed)",
|
|
21
|
+
"- 이 블록은 triflux setup에서 자동으로 관리됩니다.",
|
|
22
|
+
"- 직접 수정이 필요하면 블록 바깥에 사용자 섹션을 추가하세요.",
|
|
23
|
+
].join("\n");
|
|
24
|
+
|
|
25
|
+
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const DEFAULT_TEMPLATE_PATH = join(SCRIPT_DIR, "..", "templates", "claudemd-tfx-section.md");
|
|
27
|
+
|
|
28
|
+
function resolveVersion(version) {
|
|
29
|
+
if (version) return version;
|
|
30
|
+
try {
|
|
31
|
+
const pkgPath = join(SCRIPT_DIR, "..", "..", "package.json");
|
|
32
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
33
|
+
return pkg.version || "0.0.0";
|
|
34
|
+
} catch {
|
|
35
|
+
return "0.0.0";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function resolveTemplate(template, templatePath = DEFAULT_TEMPLATE_PATH) {
|
|
40
|
+
if (typeof template === "string" && template.trim()) {
|
|
41
|
+
return template.trim();
|
|
42
|
+
}
|
|
43
|
+
if (existsSync(templatePath)) {
|
|
44
|
+
const raw = readFileSync(templatePath, "utf8").trim();
|
|
45
|
+
if (raw) return raw;
|
|
46
|
+
}
|
|
47
|
+
return DEFAULT_TFX_TEMPLATE;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function findManagedSection(rawText) {
|
|
51
|
+
const raw = String(rawText || "");
|
|
52
|
+
const startIdx = raw.indexOf(TFX_START);
|
|
53
|
+
const endMarkerIdx = raw.indexOf(TFX_END);
|
|
54
|
+
if (startIdx === -1 || endMarkerIdx === -1 || endMarkerIdx <= startIdx) {
|
|
55
|
+
return {
|
|
56
|
+
found: false,
|
|
57
|
+
content: null,
|
|
58
|
+
version: null,
|
|
59
|
+
startIdx: -1,
|
|
60
|
+
endIdx: -1,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const endIdx = endMarkerIdx + TFX_END.length;
|
|
65
|
+
const content = raw.slice(startIdx, endIdx);
|
|
66
|
+
const versionMatch = content.match(TFX_VERSION_RE);
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
found: true,
|
|
70
|
+
content,
|
|
71
|
+
version: versionMatch ? versionMatch[1] : null,
|
|
72
|
+
startIdx,
|
|
73
|
+
endIdx,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function detectLegacyRange(rawText) {
|
|
78
|
+
const raw = String(rawText || "");
|
|
79
|
+
const matches = LEGACY_PATTERNS.some((pattern) => pattern.test(raw));
|
|
80
|
+
if (!matches) {
|
|
81
|
+
return { found: false, startIdx: -1, endIdx: -1 };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const startTag = raw.indexOf("<user_cli_routing>");
|
|
85
|
+
const endTag = raw.indexOf("</user_cli_routing>");
|
|
86
|
+
if (startTag === -1 || endTag === -1 || endTag <= startTag) {
|
|
87
|
+
return { found: true, startIdx: -1, endIdx: -1 };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
let removeStart = startTag;
|
|
91
|
+
const userOverridesComment = "<!-- USER OVERRIDES";
|
|
92
|
+
const commentIdx = raw.lastIndexOf(userOverridesComment, startTag);
|
|
93
|
+
if (commentIdx !== -1 && startTag - commentIdx < 200) {
|
|
94
|
+
removeStart = commentIdx;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
found: true,
|
|
99
|
+
startIdx: removeStart,
|
|
100
|
+
endIdx: endTag + "</user_cli_routing>".length,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function normalizeSpacing(text) {
|
|
105
|
+
return String(text || "").replace(/\n{3,}/gu, "\n\n");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function findAllClaudeMdPaths(options = {}) {
|
|
109
|
+
const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
|
|
110
|
+
const homeDir = options.homeDir ? resolve(options.homeDir) : homedir();
|
|
111
|
+
const includeGlobal = options.includeGlobal !== false;
|
|
112
|
+
const includeProject = options.includeProject !== false;
|
|
113
|
+
|
|
114
|
+
const candidates = [];
|
|
115
|
+
if (includeGlobal) candidates.push(join(homeDir, ".claude", "CLAUDE.md"));
|
|
116
|
+
if (includeProject) candidates.push(join(cwd, "CLAUDE.md"));
|
|
117
|
+
|
|
118
|
+
const seen = new Set();
|
|
119
|
+
const paths = [];
|
|
120
|
+
for (const candidate of candidates) {
|
|
121
|
+
const normalized = resolve(candidate);
|
|
122
|
+
if (seen.has(normalized)) continue;
|
|
123
|
+
seen.add(normalized);
|
|
124
|
+
if (existsSync(normalized)) {
|
|
125
|
+
paths.push(normalized);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return paths;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function writeSection(filePath, options = {}) {
|
|
132
|
+
const absolutePath = resolve(filePath);
|
|
133
|
+
const version = resolveVersion(options.version);
|
|
134
|
+
const template = resolveTemplate(options.template, options.templatePath);
|
|
135
|
+
const block = [
|
|
136
|
+
TFX_START,
|
|
137
|
+
`<!-- TFX:VERSION:${version} -->`,
|
|
138
|
+
template,
|
|
139
|
+
TFX_END,
|
|
140
|
+
].join("\n");
|
|
141
|
+
|
|
142
|
+
if (!existsSync(absolutePath)) {
|
|
143
|
+
writeFileSync(absolutePath, `${block}\n`, "utf8");
|
|
144
|
+
return { action: "created", version, path: absolutePath };
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const raw = readFileSync(absolutePath, "utf8");
|
|
148
|
+
const existing = findManagedSection(raw);
|
|
149
|
+
|
|
150
|
+
if (existing.found) {
|
|
151
|
+
const nextContent = `${raw.slice(0, existing.startIdx)}${block}${raw.slice(existing.endIdx)}`;
|
|
152
|
+
writeFileSync(absolutePath, nextContent, "utf8");
|
|
153
|
+
return {
|
|
154
|
+
action: "updated",
|
|
155
|
+
oldVersion: existing.version,
|
|
156
|
+
version,
|
|
157
|
+
path: absolutePath,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const omcEndIdx = raw.indexOf(OMC_END);
|
|
162
|
+
if (omcEndIdx !== -1) {
|
|
163
|
+
const insertAt = omcEndIdx + OMC_END.length;
|
|
164
|
+
const before = raw.slice(0, insertAt);
|
|
165
|
+
const after = raw.slice(insertAt);
|
|
166
|
+
const nextContent = `${before}\n${block}${after}`;
|
|
167
|
+
writeFileSync(absolutePath, nextContent, "utf8");
|
|
168
|
+
return { action: "inserted_after_omc", version, path: absolutePath };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const separator = raw.endsWith("\n") ? "" : "\n";
|
|
172
|
+
writeFileSync(absolutePath, `${raw}${separator}${block}\n`, "utf8");
|
|
173
|
+
return { action: "appended", version, path: absolutePath };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function migrateClaudeMd(filePath, options = {}) {
|
|
177
|
+
const absolutePath = resolve(filePath);
|
|
178
|
+
if (!existsSync(absolutePath)) {
|
|
179
|
+
return { action: "no_file", removed: [], path: absolutePath };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const raw = readFileSync(absolutePath, "utf8");
|
|
183
|
+
const existing = findManagedSection(raw);
|
|
184
|
+
const legacy = detectLegacyRange(raw);
|
|
185
|
+
|
|
186
|
+
if (existing.found && !legacy.found) {
|
|
187
|
+
return {
|
|
188
|
+
action: "already_managed",
|
|
189
|
+
removed: [],
|
|
190
|
+
version: existing.version,
|
|
191
|
+
path: absolutePath,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const removed = [];
|
|
196
|
+
let nextContent = raw;
|
|
197
|
+
|
|
198
|
+
if (legacy.found && legacy.startIdx !== -1 && legacy.endIdx !== -1) {
|
|
199
|
+
nextContent = `${nextContent.slice(0, legacy.startIdx)}${nextContent.slice(legacy.endIdx)}`;
|
|
200
|
+
removed.push("<user_cli_routing> block");
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const existingAfterLegacy = findManagedSection(nextContent);
|
|
204
|
+
if (existingAfterLegacy.found) {
|
|
205
|
+
nextContent = `${nextContent.slice(0, existingAfterLegacy.startIdx)}${nextContent.slice(existingAfterLegacy.endIdx)}`;
|
|
206
|
+
removed.push("old TFX block");
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
writeFileSync(absolutePath, normalizeSpacing(nextContent), "utf8");
|
|
210
|
+
const writeResult = writeSection(absolutePath, options);
|
|
211
|
+
|
|
212
|
+
return {
|
|
213
|
+
action: "migrated",
|
|
214
|
+
removed,
|
|
215
|
+
version: writeResult.version,
|
|
216
|
+
path: absolutePath,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 요청별 로그 컨텍스트 전파 (AsyncLocalStorage 기반).
|
|
3
|
+
*
|
|
4
|
+
* Hub HTTP 서버의 요청마다 correlationId를 자동 할당하여,
|
|
5
|
+
* 하나의 요청에서 발생한 모든 로그를 추적할 수 있다.
|
|
6
|
+
*
|
|
7
|
+
* 사용법:
|
|
8
|
+
* import { getLogger, getCorrelationId, withRequestContext } from './lib/context.mjs';
|
|
9
|
+
*
|
|
10
|
+
* // 미들웨어에서 컨텍스트 생성
|
|
11
|
+
* withRequestContext({ method: 'POST', path: '/bridge/result' }, () => {
|
|
12
|
+
* const log = getLogger();
|
|
13
|
+
* log.info({ agentId }, 'bridge.result_received');
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* // 내부 함수에서 자동 상관 ID
|
|
17
|
+
* function processResult() {
|
|
18
|
+
* const log = getLogger();
|
|
19
|
+
* log.info('result.processed'); // correlationId 자동 포함
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
23
|
+
import { randomUUID } from 'node:crypto';
|
|
24
|
+
|
|
25
|
+
import { logger } from './logger.mjs';
|
|
26
|
+
|
|
27
|
+
/** @type {AsyncLocalStorage<{logger: import('pino').Logger, correlationId: string}>} */
|
|
28
|
+
export const asyncLocalStorage = new AsyncLocalStorage();
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 현재 요청 컨텍스트의 로거를 반환한다.
|
|
32
|
+
* 요청 컨텍스트 밖에서 호출하면 기본 로거를 반환한다.
|
|
33
|
+
*
|
|
34
|
+
* @returns {import('pino').Logger}
|
|
35
|
+
*/
|
|
36
|
+
export function getLogger() {
|
|
37
|
+
return asyncLocalStorage.getStore()?.logger || logger;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 현재 요청의 상관 ID를 반환한다.
|
|
42
|
+
*
|
|
43
|
+
* @returns {string|undefined}
|
|
44
|
+
*/
|
|
45
|
+
export function getCorrelationId() {
|
|
46
|
+
return asyncLocalStorage.getStore()?.correlationId;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 요청 컨텍스트를 생성하고 콜백을 실행한다.
|
|
51
|
+
*
|
|
52
|
+
* @param {object} context — 컨텍스트 필드 (method, path 등)
|
|
53
|
+
* @param {string} [context.correlationId] — 외부에서 전달된 상관 ID (없으면 자동 생성)
|
|
54
|
+
* @param {function} callback — 컨텍스트 내에서 실행할 함수
|
|
55
|
+
* @returns {*}
|
|
56
|
+
*/
|
|
57
|
+
export function withRequestContext(context, callback) {
|
|
58
|
+
const correlationId = context.correlationId || randomUUID();
|
|
59
|
+
const { correlationId: _, ...rest } = context;
|
|
60
|
+
|
|
61
|
+
const store = {
|
|
62
|
+
correlationId,
|
|
63
|
+
logger: logger.child({ correlationId, ...rest }),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return asyncLocalStorage.run(store, callback);
|
|
67
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
|
|
3
|
+
export const SESSION_TTL_SEC = 30 * 60;
|
|
4
|
+
export const STATE_REL_PATH = join(".omc", "state", "cross-review.json");
|
|
5
|
+
|
|
6
|
+
export function readStdin() {
|
|
7
|
+
return new Promise((resolve) => {
|
|
8
|
+
let raw = "";
|
|
9
|
+
process.stdin.setEncoding("utf8");
|
|
10
|
+
process.stdin.on("data", (chunk) => {
|
|
11
|
+
raw += chunk;
|
|
12
|
+
});
|
|
13
|
+
process.stdin.on("end", () => resolve(raw));
|
|
14
|
+
process.stdin.on("error", () => resolve(""));
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function parseJson(raw) {
|
|
19
|
+
try {
|
|
20
|
+
return JSON.parse(raw);
|
|
21
|
+
} catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function nowSec() {
|
|
27
|
+
return Math.floor(Date.now() / 1000);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function resolveBaseDir(payload) {
|
|
31
|
+
if (typeof payload?.cwd === "string" && payload.cwd.trim()) return payload.cwd;
|
|
32
|
+
if (typeof payload?.directory === "string" && payload.directory.trim()) return payload.directory;
|
|
33
|
+
return process.cwd();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function shouldTrackPath(filePath) {
|
|
37
|
+
if (typeof filePath !== "string" || !filePath.trim()) return false;
|
|
38
|
+
|
|
39
|
+
const lower = filePath.toLowerCase();
|
|
40
|
+
if (lower.startsWith(".omc/") || lower.startsWith(".claude/")) return false;
|
|
41
|
+
if (lower === "package-lock.json" || lower.endsWith("/package-lock.json")) return false;
|
|
42
|
+
if (/\.(md|lock|yml|yaml)$/i.test(lower)) return false;
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function expectedReviewer(author) {
|
|
47
|
+
if (author === "claude") return "codex";
|
|
48
|
+
if (author === "codex") return "claude";
|
|
49
|
+
if (author === "gemini") return "claude";
|
|
50
|
+
return "";
|
|
51
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join, dirname } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { execSync, spawn } from "node:child_process";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import { whichCommand, whichCommandAsync } from "../../hub/platform.mjs";
|
|
8
|
+
|
|
9
|
+
const DEFAULT_STATUS_URL = "http://127.0.0.1:27888/status";
|
|
10
|
+
const _sab = new Int32Array(new SharedArrayBuffer(4));
|
|
11
|
+
const CLI_PROBE_CACHE = new Map();
|
|
12
|
+
const CLI_PROBE_PROMISES = new Map();
|
|
13
|
+
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const DEFAULT_PKG_ROOT = join(dirname(__filename), "..", "..");
|
|
16
|
+
|
|
17
|
+
function sleepSync(ms) {
|
|
18
|
+
Atomics.wait(_sab, 0, 0, ms);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function fetchHubStatus({
|
|
22
|
+
execSyncFn = execSync,
|
|
23
|
+
statusUrl = DEFAULT_STATUS_URL,
|
|
24
|
+
timeout = 3000,
|
|
25
|
+
} = {}) {
|
|
26
|
+
const response = execSyncFn(`curl -sf ${statusUrl}`, {
|
|
27
|
+
timeout,
|
|
28
|
+
encoding: "utf8",
|
|
29
|
+
windowsHide: true,
|
|
30
|
+
});
|
|
31
|
+
const data = JSON.parse(response);
|
|
32
|
+
return {
|
|
33
|
+
ok: true,
|
|
34
|
+
state: data?.hub?.state || "unknown",
|
|
35
|
+
pid: data?.pid,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function normalizeCliName(name) {
|
|
40
|
+
return String(name ?? "").trim() || null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function toCliResult(path) {
|
|
44
|
+
return path ? { ok: true, path } : { ok: false };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function cloneCliResult(result) {
|
|
48
|
+
return result?.ok ? { ...result } : { ok: false };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function readCachedCliResult(name) {
|
|
52
|
+
const cached = CLI_PROBE_CACHE.get(name);
|
|
53
|
+
return cached ? cloneCliResult(cached) : null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function storeCliResult(name, result) {
|
|
57
|
+
const snapshot = cloneCliResult(result);
|
|
58
|
+
CLI_PROBE_CACHE.set(name, snapshot);
|
|
59
|
+
return cloneCliResult(snapshot);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function buildCliProbeOptions(options = {}) {
|
|
63
|
+
return {
|
|
64
|
+
timeout: options.timeout ?? 2000,
|
|
65
|
+
env: options.env,
|
|
66
|
+
cwd: options.cwd,
|
|
67
|
+
platform: options.platform,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function normalizeCliNames(names) {
|
|
72
|
+
return [...new Set((names || []).map(normalizeCliName).filter(Boolean))];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function mapCliResults(names, results) {
|
|
76
|
+
return names.reduce((acc, name, index) => ({
|
|
77
|
+
...acc,
|
|
78
|
+
[name]: results[index],
|
|
79
|
+
}), {});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function resolveCliProbe(name, options = {}) {
|
|
83
|
+
const path = await (options.whichCommandAsyncFn || whichCommandAsync)(name, {
|
|
84
|
+
...buildCliProbeOptions(options),
|
|
85
|
+
execFileFn: options.execFileFn,
|
|
86
|
+
});
|
|
87
|
+
return toCliResult(path);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export async function checkCli(name, options = {}) {
|
|
91
|
+
const cliName = normalizeCliName(name);
|
|
92
|
+
if (!cliName) return { ok: false };
|
|
93
|
+
|
|
94
|
+
const cached = readCachedCliResult(cliName);
|
|
95
|
+
if (cached) return cached;
|
|
96
|
+
|
|
97
|
+
const pending = CLI_PROBE_PROMISES.get(cliName);
|
|
98
|
+
if (pending) return pending.then(cloneCliResult);
|
|
99
|
+
|
|
100
|
+
const nextProbe = resolveCliProbe(cliName, options)
|
|
101
|
+
.then((result) => storeCliResult(cliName, result))
|
|
102
|
+
.catch(() => storeCliResult(cliName, { ok: false }))
|
|
103
|
+
.finally(() => {
|
|
104
|
+
CLI_PROBE_PROMISES.delete(cliName);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
CLI_PROBE_PROMISES.set(cliName, nextProbe);
|
|
108
|
+
return nextProbe.then(cloneCliResult);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function checkCliSync(name, options = {}) {
|
|
112
|
+
const cliName = normalizeCliName(name);
|
|
113
|
+
if (!cliName) return { ok: false };
|
|
114
|
+
|
|
115
|
+
const cached = readCachedCliResult(cliName);
|
|
116
|
+
if (cached) return cached;
|
|
117
|
+
|
|
118
|
+
const path = (options.whichCommandFn || whichCommand)(cliName, buildCliProbeOptions(options));
|
|
119
|
+
return storeCliResult(cliName, toCliResult(path));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export async function probeClis(names, options = {}) {
|
|
123
|
+
const cliNames = normalizeCliNames(names);
|
|
124
|
+
const results = await Promise.all(cliNames.map((name) => checkCli(name, options)));
|
|
125
|
+
return mapCliResults(cliNames, results);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function resetCliProbeCache() {
|
|
129
|
+
CLI_PROBE_CACHE.clear();
|
|
130
|
+
CLI_PROBE_PROMISES.clear();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function detectCodexAuthState({
|
|
134
|
+
homeDir = homedir(),
|
|
135
|
+
existsSyncFn = existsSync,
|
|
136
|
+
readFileSyncFn = readFileSync,
|
|
137
|
+
} = {}) {
|
|
138
|
+
try {
|
|
139
|
+
const authPath = join(homeDir, ".codex", "auth.json");
|
|
140
|
+
if (!existsSyncFn(authPath)) return { plan: "unknown", source: "no_auth", fingerprint: "no_auth" };
|
|
141
|
+
|
|
142
|
+
const auth = JSON.parse(readFileSyncFn(authPath, "utf8"));
|
|
143
|
+
if (auth.auth_mode !== "chatgpt") {
|
|
144
|
+
const fingerprint = createHash("sha256")
|
|
145
|
+
.update(JSON.stringify({
|
|
146
|
+
auth_mode: auth.auth_mode || "api_key",
|
|
147
|
+
has_api_key: Boolean(auth.api_key || auth.apiKey),
|
|
148
|
+
}))
|
|
149
|
+
.digest("hex");
|
|
150
|
+
return { plan: "api", source: "api_key", fingerprint };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const token = auth.tokens?.id_token || auth.tokens?.access_token;
|
|
154
|
+
if (!token) {
|
|
155
|
+
return {
|
|
156
|
+
plan: "unknown",
|
|
157
|
+
source: "no_token",
|
|
158
|
+
fingerprint: createHash("sha256")
|
|
159
|
+
.update(JSON.stringify({ auth_mode: auth.auth_mode || "chatgpt", token: null }))
|
|
160
|
+
.digest("hex"),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const payload = JSON.parse(Buffer.from(token.split(".")[1], "base64url").toString());
|
|
165
|
+
const plan = payload?.["https://api.openai.com/auth"]?.chatgpt_plan_type || "unknown";
|
|
166
|
+
const fingerprint = createHash("sha256")
|
|
167
|
+
.update(JSON.stringify({
|
|
168
|
+
auth_mode: auth.auth_mode || "chatgpt",
|
|
169
|
+
plan,
|
|
170
|
+
sub: payload?.sub || null,
|
|
171
|
+
exp: payload?.exp || null,
|
|
172
|
+
}))
|
|
173
|
+
.digest("hex");
|
|
174
|
+
return { plan, source: "jwt", fingerprint };
|
|
175
|
+
} catch {
|
|
176
|
+
return { plan: "unknown", source: "error", fingerprint: "error" };
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function detectCodexPlan(options = {}) {
|
|
181
|
+
const { plan, source } = detectCodexAuthState(options);
|
|
182
|
+
return { plan, source };
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function checkHub({
|
|
186
|
+
pkgRoot = DEFAULT_PKG_ROOT,
|
|
187
|
+
statusUrl = DEFAULT_STATUS_URL,
|
|
188
|
+
restart = true,
|
|
189
|
+
requestTimeoutMs = 3000,
|
|
190
|
+
pollAttempts = 8,
|
|
191
|
+
pollIntervalMs = 500,
|
|
192
|
+
execSyncFn = execSync,
|
|
193
|
+
spawnFn = spawn,
|
|
194
|
+
existsSyncFn = existsSync,
|
|
195
|
+
sleepSyncFn = sleepSync,
|
|
196
|
+
} = {}) {
|
|
197
|
+
try {
|
|
198
|
+
return fetchHubStatus({
|
|
199
|
+
execSyncFn,
|
|
200
|
+
statusUrl,
|
|
201
|
+
timeout: requestTimeoutMs,
|
|
202
|
+
});
|
|
203
|
+
} catch {}
|
|
204
|
+
|
|
205
|
+
if (!restart) return { ok: false, state: "unreachable", restart: "disabled" };
|
|
206
|
+
|
|
207
|
+
const serverPath = join(pkgRoot, "hub", "server.mjs");
|
|
208
|
+
if (!existsSyncFn(serverPath)) return { ok: false, state: "unreachable", restart: "no_server" };
|
|
209
|
+
|
|
210
|
+
try {
|
|
211
|
+
const child = spawnFn(process.execPath, [serverPath], {
|
|
212
|
+
detached: true,
|
|
213
|
+
stdio: "ignore",
|
|
214
|
+
windowsHide: true,
|
|
215
|
+
});
|
|
216
|
+
child.unref();
|
|
217
|
+
} catch {
|
|
218
|
+
return { ok: false, state: "unreachable", restart: "spawn_failed" };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
for (let i = 0; i < pollAttempts; i++) {
|
|
222
|
+
sleepSyncFn(pollIntervalMs);
|
|
223
|
+
try {
|
|
224
|
+
const status = fetchHubStatus({
|
|
225
|
+
execSyncFn,
|
|
226
|
+
statusUrl,
|
|
227
|
+
timeout: Math.min(requestTimeoutMs, 1000),
|
|
228
|
+
});
|
|
229
|
+
if (status.state === "healthy") {
|
|
230
|
+
return { ...status, restarted: true };
|
|
231
|
+
}
|
|
232
|
+
} catch {}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return { ok: false, state: "unreachable", restart: "timeout" };
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export {
|
|
239
|
+
DEFAULT_PKG_ROOT,
|
|
240
|
+
DEFAULT_STATUS_URL,
|
|
241
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
const DEFAULT_GEMINI_PROFILES = {
|
|
6
|
+
model: "gemini-3.1-pro-preview",
|
|
7
|
+
profiles: {
|
|
8
|
+
pro31: { model: "gemini-3.1-pro-preview", hint: "3.1 Pro — 플래그십 (1M ctx, 멀티모달)" },
|
|
9
|
+
flash3: { model: "gemini-3-flash-preview", hint: "3.0 Flash — 빠른 응답, 비용 효율" },
|
|
10
|
+
pro25: { model: "gemini-2.5-pro", hint: "2.5 Pro — 안정 (추론 강화)" },
|
|
11
|
+
flash25: { model: "gemini-2.5-flash", hint: "2.5 Flash — 경량 범용" },
|
|
12
|
+
lite25: { model: "gemini-2.5-flash-lite", hint: "2.5 Flash Lite — 최경량" },
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const DEFAULT_PROFILE_COUNT = Object.keys(DEFAULT_GEMINI_PROFILES.profiles).length;
|
|
17
|
+
|
|
18
|
+
function ensureGeminiProfiles({
|
|
19
|
+
geminiDir = join(homedir(), ".gemini"),
|
|
20
|
+
profilesPath = join(geminiDir, "triflux-profiles.json"),
|
|
21
|
+
} = {}) {
|
|
22
|
+
try {
|
|
23
|
+
if (!existsSync(geminiDir)) mkdirSync(geminiDir, { recursive: true });
|
|
24
|
+
|
|
25
|
+
if (!existsSync(profilesPath)) {
|
|
26
|
+
writeFileSync(profilesPath, JSON.stringify(DEFAULT_GEMINI_PROFILES, null, 2) + "\n", { encoding: "utf8", mode: 0o600 });
|
|
27
|
+
return {
|
|
28
|
+
ok: true,
|
|
29
|
+
created: true,
|
|
30
|
+
added: DEFAULT_PROFILE_COUNT,
|
|
31
|
+
count: DEFAULT_PROFILE_COUNT,
|
|
32
|
+
message: null,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let cfg;
|
|
37
|
+
try {
|
|
38
|
+
cfg = JSON.parse(readFileSync(profilesPath, "utf8"));
|
|
39
|
+
} catch {
|
|
40
|
+
try { copyFileSync(profilesPath, profilesPath + `.bak.${Date.now()}`); } catch {}
|
|
41
|
+
writeFileSync(profilesPath, JSON.stringify(DEFAULT_GEMINI_PROFILES, null, 2) + "\n", { encoding: "utf8", mode: 0o600 });
|
|
42
|
+
return {
|
|
43
|
+
ok: true,
|
|
44
|
+
created: true,
|
|
45
|
+
added: DEFAULT_PROFILE_COUNT,
|
|
46
|
+
count: DEFAULT_PROFILE_COUNT,
|
|
47
|
+
message: null,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!cfg || typeof cfg !== "object" || Array.isArray(cfg)) cfg = {};
|
|
52
|
+
if (!cfg.profiles || typeof cfg.profiles !== "object" || Array.isArray(cfg.profiles)) cfg.profiles = {};
|
|
53
|
+
|
|
54
|
+
let added = 0;
|
|
55
|
+
for (const [name, value] of Object.entries(DEFAULT_GEMINI_PROFILES.profiles)) {
|
|
56
|
+
if (!cfg.profiles[name]) {
|
|
57
|
+
cfg.profiles[name] = value;
|
|
58
|
+
added++;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!cfg.model) cfg.model = DEFAULT_GEMINI_PROFILES.model;
|
|
62
|
+
|
|
63
|
+
if (added > 0) {
|
|
64
|
+
writeFileSync(profilesPath, JSON.stringify(cfg, null, 2) + "\n", { encoding: "utf8", mode: 0o600 });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
ok: true,
|
|
69
|
+
created: false,
|
|
70
|
+
added,
|
|
71
|
+
count: Object.keys(cfg.profiles).length,
|
|
72
|
+
message: null,
|
|
73
|
+
};
|
|
74
|
+
} catch (error) {
|
|
75
|
+
return {
|
|
76
|
+
ok: false,
|
|
77
|
+
created: false,
|
|
78
|
+
added: 0,
|
|
79
|
+
count: 0,
|
|
80
|
+
message: error.message,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { DEFAULT_GEMINI_PROFILES, ensureGeminiProfiles };
|