triflux 10.3.3 → 10.4.0
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 +193 -0
- package/LICENSE +21 -21
- package/hooks/hook-registry.json +256 -256
- package/hub/adaptive-inject.mjs +1 -1
- package/hub/assign-callbacks.mjs +120 -120
- package/hub/delegator/index.mjs +14 -14
- package/hub/delegator/tool-definitions.mjs +35 -35
- package/hub/hitl.mjs +143 -143
- package/hub/lib/path-utils.mjs +167 -0
- package/hub/router.mjs +791 -791
- package/hub/session-fingerprint.mjs +1 -1
- package/hub/team/cli/commands/attach.mjs +37 -37
- package/hub/team/cli/commands/debug.mjs +74 -74
- package/hub/team/cli/commands/focus.mjs +53 -53
- package/hub/team/cli/commands/list.mjs +24 -24
- package/hub/team/cli/commands/start/start-in-process.mjs +40 -40
- package/hub/team/cli/commands/start/start-mux.mjs +73 -73
- package/hub/team/cli/commands/start/start-wt.mjs +69 -69
- package/hub/team/cli/commands/tasks.mjs +13 -13
- package/hub/team/cli/render.mjs +30 -30
- package/hub/team/cli/services/attach-fallback.mjs +54 -54
- package/hub/team/cli/services/member-selector.mjs +30 -30
- package/hub/team/cli/services/native-control.mjs +116 -116
- package/hub/team/cli/services/task-model.mjs +30 -30
- package/hub/team/notify.mjs +1 -1
- package/hub/team/orchestrator.mjs +161 -161
- package/hub/team/runtime-strategy.mjs +74 -0
- package/hub/team/session.mjs +611 -611
- package/hub/team/shared.mjs +13 -13
- package/hub/team/worktree-lifecycle.mjs +61 -2
- package/hub/tray.mjs +368 -368
- package/hub/workers/codex-mcp.mjs +507 -507
- package/hub/workers/factory.mjs +21 -21
- package/hud/hud-qos-status.mjs +17 -3
- package/hud/mission-board.mjs +53 -0
- package/hud/providers/claude.mjs +95 -22
- package/hud/renderers.mjs +39 -5
- package/package.json +21 -55
- package/references/hosts.json +33 -0
- package/scripts/completions/tfx.bash +47 -47
- package/scripts/completions/tfx.fish +44 -44
- package/scripts/completions/tfx.zsh +83 -83
- package/scripts/demo.mjs +169 -0
- package/scripts/headless-guard.mjs +16 -4
- package/scripts/hub-ensure.mjs +120 -120
- package/scripts/keyword-detector.mjs +272 -272
- package/scripts/keyword-rules-expander.mjs +521 -521
- package/scripts/lib/mcp-server-catalog.mjs +118 -118
- package/scripts/lib/skill-state.mjs +220 -0
- package/scripts/notion-read.mjs +553 -553
- package/scripts/test-tfx-route-no-claude-native.mjs +57 -57
- package/scripts/tfx-batch-stats.mjs +96 -96
- package/skills/.omc/state/agent-replay-8f0e10a9-9693-4410-96f5-a6b07e8ed995.jsonl +1 -0
- package/skills/.omc/state/idle-notif-cooldown.json +3 -0
- package/skills/.omc/state/last-tool-error.json +7 -0
- package/skills/.omc/state/subagent-tracking.json +7 -0
- package/skills/tfx-remote-spawn/references/hosts.json +16 -0
- 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-workspace/skill-snapshot/tfx-auto-codex/SKILL.md +77 -0
- 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-workspace/skill-snapshot/tfx-gemini/SKILL.md +82 -0
- 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/.claude-plugin/marketplace.json +0 -34
- package/.claude-plugin/plugin.json +0 -22
- package/config/mcp-registry.json +0 -29
- package/tui/codex-profile.mjs +0 -402
- package/tui/core.mjs +0 -236
- package/tui/doctor.mjs +0 -328
- package/tui/gemini-profile.mjs +0 -254
- package/tui/monitor-data.mjs +0 -148
- package/tui/monitor.mjs +0 -295
- package/tui/setup.mjs +0 -442
package/tui/setup.mjs
DELETED
|
@@ -1,442 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// tui/setup.mjs — Interactive triflux setup wizard TUI
|
|
3
|
-
import { execFileSync } from "node:child_process";
|
|
4
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync, copyFileSync, readdirSync } from "node:fs";
|
|
5
|
-
import { join, dirname } from "node:path";
|
|
6
|
-
import { homedir } from "node:os";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
import {
|
|
9
|
-
clear, box, table, divider, label, ok, warn, fail, info,
|
|
10
|
-
select, confirm, spinner, sleep,
|
|
11
|
-
RESET, DIM, BOLD, CYAN, AMBER, GREEN, RED, YELLOW, WHITE, GRAY,
|
|
12
|
-
onExit, showCursor,
|
|
13
|
-
} from "./core.mjs";
|
|
14
|
-
import { DEFAULT_GEMINI_PROFILES } from "../scripts/lib/gemini-profiles.mjs";
|
|
15
|
-
|
|
16
|
-
const PKG_ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
17
|
-
const CLAUDE_DIR = join(homedir(), ".claude");
|
|
18
|
-
const CODEX_DIR = join(homedir(), ".codex");
|
|
19
|
-
const GEMINI_DIR = join(homedir(), ".gemini");
|
|
20
|
-
const SETTINGS_PATH = join(CLAUDE_DIR, "settings.json");
|
|
21
|
-
|
|
22
|
-
// ── Step Definitions ──
|
|
23
|
-
|
|
24
|
-
const STEPS = [
|
|
25
|
-
{ id: "sync", name: "파일 동기화", desc: "스크립트/HUD/스킬을 ~/.claude/에 배포" },
|
|
26
|
-
{ id: "hud", name: "HUD 설정", desc: "settings.json에 statusLine 등록" },
|
|
27
|
-
{ id: "profiles", name: "Codex 프로파일", desc: "필수 프로파일 생성/확인" },
|
|
28
|
-
{ id: "gemini-profiles", name: "Gemini 프로필", desc: "triflux-profiles.json 생성/확인" },
|
|
29
|
-
{ id: "cli", name: "CLI 진단", desc: "Codex/Gemini/Claude CLI 확인" },
|
|
30
|
-
{ id: "mcp", name: "MCP 서버 확인", desc: "MCP 서버 인벤토리 점검" },
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
// ── Step Implementations ──
|
|
34
|
-
|
|
35
|
-
function stepSync() {
|
|
36
|
-
try {
|
|
37
|
-
const out = execFileSync(process.execPath,
|
|
38
|
-
[join(PKG_ROOT, "bin", "triflux.mjs"), "setup", "--json"],
|
|
39
|
-
{ timeout: 30000, encoding: "utf8", windowsHide: true }
|
|
40
|
-
);
|
|
41
|
-
return { ok: true, detail: "파일 동기화 완료" };
|
|
42
|
-
} catch (e) {
|
|
43
|
-
return { ok: false, detail: e.message };
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function stepHud() {
|
|
48
|
-
try {
|
|
49
|
-
if (!existsSync(SETTINGS_PATH)) {
|
|
50
|
-
return { ok: false, detail: "settings.json 미존재", action: "create" };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const raw = readFileSync(SETTINGS_PATH, "utf8");
|
|
54
|
-
let settings;
|
|
55
|
-
try { settings = JSON.parse(raw); } catch {
|
|
56
|
-
return { ok: false, detail: "settings.json 파싱 실패", action: "fix" };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const hudScript = join(CLAUDE_DIR, "hud", "hud-qos-status.mjs");
|
|
60
|
-
const nodePath = process.execPath;
|
|
61
|
-
|
|
62
|
-
// Check if statusLine already configured correctly
|
|
63
|
-
if (settings.statusLine?.command?.includes("hud-qos-status")) {
|
|
64
|
-
return { ok: true, detail: "statusLine 이미 설정됨", current: settings.statusLine };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
ok: false,
|
|
69
|
-
detail: settings.statusLine ? "statusLine이 다른 HUD를 가리킴" : "statusLine 미설정",
|
|
70
|
-
action: "configure",
|
|
71
|
-
current: settings.statusLine || null,
|
|
72
|
-
target: {
|
|
73
|
-
type: "command",
|
|
74
|
-
command: `"${nodePath}" "${hudScript}"`,
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
} catch (e) {
|
|
78
|
-
return { ok: false, detail: e.message };
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function stepProfiles() {
|
|
83
|
-
const configPath = join(CODEX_DIR, "config.toml");
|
|
84
|
-
if (!existsSync(configPath)) {
|
|
85
|
-
return { ok: false, detail: "config.toml 미존재", action: "skip" };
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const content = readFileSync(configPath, "utf8");
|
|
89
|
-
const required = ["codex53_high", "codex53_xhigh", "spark53_low"];
|
|
90
|
-
const missing = required.filter((name) => {
|
|
91
|
-
const re = new RegExp(`^\\[profiles\\.${name}\\]`, "m");
|
|
92
|
-
return !re.test(content);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
if (missing.length === 0) {
|
|
96
|
-
return { ok: true, detail: `필수 프로파일 ${required.length}개 확인됨` };
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return { ok: false, detail: `누락: ${missing.join(", ")}`, missing, action: "create" };
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function stepGeminiProfiles() {
|
|
103
|
-
const configPath = join(GEMINI_DIR, "triflux-profiles.json");
|
|
104
|
-
if (!existsSync(configPath)) {
|
|
105
|
-
if (!existsSync(GEMINI_DIR)) mkdirSync(GEMINI_DIR, { recursive: true });
|
|
106
|
-
writeFileSync(configPath, JSON.stringify(DEFAULT_GEMINI_PROFILES, null, 2) + "\n", "utf8");
|
|
107
|
-
return {
|
|
108
|
-
ok: true,
|
|
109
|
-
detail: `기본 프로필 ${Object.keys(DEFAULT_GEMINI_PROFILES.profiles).length}개 자동 생성됨`,
|
|
110
|
-
action: "created",
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
try {
|
|
115
|
-
const cfg = JSON.parse(readFileSync(configPath, "utf8"));
|
|
116
|
-
const required = ["pro31", "flash3"];
|
|
117
|
-
const missing = required.filter((name) => !cfg.profiles?.[name]);
|
|
118
|
-
if (missing.length === 0) {
|
|
119
|
-
const count = Object.keys(cfg.profiles || {}).length;
|
|
120
|
-
return { ok: true, detail: `프로필 ${count}개 확인됨` };
|
|
121
|
-
}
|
|
122
|
-
return { ok: false, detail: `누락: ${missing.join(", ")}`, action: "update" };
|
|
123
|
-
} catch {
|
|
124
|
-
return { ok: false, detail: "triflux-profiles.json 파싱 실패", action: "recreate" };
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function stepCli() {
|
|
129
|
-
const results = [];
|
|
130
|
-
for (const [name, installCmd] of [
|
|
131
|
-
["codex", "npm i -g @openai/codex"],
|
|
132
|
-
["gemini", "npm i -g @google/gemini-cli"],
|
|
133
|
-
["claude", "Claude Code 설치"],
|
|
134
|
-
]) {
|
|
135
|
-
try {
|
|
136
|
-
execFileSync(process.platform === "win32" ? "where" : "which", [name], {
|
|
137
|
-
timeout: 5000, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
|
|
138
|
-
});
|
|
139
|
-
results.push({ name, found: true });
|
|
140
|
-
} catch {
|
|
141
|
-
results.push({ name, found: false, install: installCmd });
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
const allFound = results.every((r) => r.found);
|
|
145
|
-
return { ok: allFound, results, detail: allFound ? "모든 CLI 확인됨" : "일부 CLI 미설치" };
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function stepMcp() {
|
|
149
|
-
const inventoryPath = join(CLAUDE_DIR, "cache", "mcp-inventory.json");
|
|
150
|
-
if (!existsSync(inventoryPath)) {
|
|
151
|
-
return { ok: false, detail: "MCP 인벤토리 미존재", action: "rebuild" };
|
|
152
|
-
}
|
|
153
|
-
try {
|
|
154
|
-
const inventory = JSON.parse(readFileSync(inventoryPath, "utf8"));
|
|
155
|
-
const count = Object.keys(inventory.servers || inventory).length;
|
|
156
|
-
return { ok: true, detail: `${count}개 MCP 서버 등록됨` };
|
|
157
|
-
} catch {
|
|
158
|
-
return { ok: false, detail: "MCP 인벤토리 파싱 실패", action: "rebuild" };
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const STEP_RUNNERS = { sync: stepSync, hud: stepHud, profiles: stepProfiles, "gemini-profiles": stepGeminiProfiles, cli: stepCli, mcp: stepMcp };
|
|
163
|
-
|
|
164
|
-
// ── UI ──
|
|
165
|
-
|
|
166
|
-
function showStepResult(step, result) {
|
|
167
|
-
if (result.ok) {
|
|
168
|
-
ok(`${step.name}: ${result.detail}`);
|
|
169
|
-
} else {
|
|
170
|
-
warn(`${step.name}: ${result.detail}`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
async function runWizard() {
|
|
175
|
-
console.log();
|
|
176
|
-
info(`${STEPS.length}개 단계를 순서대로 실행합니다.`);
|
|
177
|
-
console.log();
|
|
178
|
-
|
|
179
|
-
const results = {};
|
|
180
|
-
|
|
181
|
-
for (let i = 0; i < STEPS.length; i++) {
|
|
182
|
-
const step = STEPS[i];
|
|
183
|
-
const progress = `${DIM}[${i + 1}/${STEPS.length}]${RESET}`;
|
|
184
|
-
|
|
185
|
-
console.log(` ${progress} ${BOLD}${step.name}${RESET} ${DIM}— ${step.desc}${RESET}`);
|
|
186
|
-
|
|
187
|
-
const spin = spinner(`${step.name} 실행 중...`);
|
|
188
|
-
const result = STEP_RUNNERS[step.id]();
|
|
189
|
-
spin.stop();
|
|
190
|
-
|
|
191
|
-
showStepResult(step, result);
|
|
192
|
-
results[step.id] = result;
|
|
193
|
-
|
|
194
|
-
// Handle fixable issues
|
|
195
|
-
if (!result.ok && result.action) {
|
|
196
|
-
await handleStepFix(step, result);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
console.log();
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return results;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
async function handleStepFix(step, result) {
|
|
206
|
-
switch (step.id) {
|
|
207
|
-
case "hud": {
|
|
208
|
-
if (result.action === "configure") {
|
|
209
|
-
if (result.current) {
|
|
210
|
-
warn(`현재 statusLine: ${JSON.stringify(result.current)}`);
|
|
211
|
-
if (!(await confirm("triflux HUD로 덮어쓰시겠습니까?", false))) return;
|
|
212
|
-
} else {
|
|
213
|
-
if (!(await confirm("statusLine을 설정하시겠습니까?"))) return;
|
|
214
|
-
}
|
|
215
|
-
try {
|
|
216
|
-
const raw = readFileSync(SETTINGS_PATH, "utf8");
|
|
217
|
-
const settings = JSON.parse(raw);
|
|
218
|
-
settings.statusLine = result.target;
|
|
219
|
-
writeFileSync(SETTINGS_PATH, JSON.stringify(settings, null, 2), "utf8");
|
|
220
|
-
ok("statusLine 설정 완료");
|
|
221
|
-
} catch (e) {
|
|
222
|
-
fail(`설정 실패: ${e.message}`);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
case "profiles": {
|
|
229
|
-
if (result.action === "create" && result.missing) {
|
|
230
|
-
if (await confirm(`누락된 프로파일 ${result.missing.length}개를 생성하시겠습니까?`)) {
|
|
231
|
-
try {
|
|
232
|
-
execFileSync(process.execPath,
|
|
233
|
-
[join(PKG_ROOT, "bin", "triflux.mjs"), "setup"],
|
|
234
|
-
{ timeout: 15000, stdio: "ignore", windowsHide: true }
|
|
235
|
-
);
|
|
236
|
-
ok("프로파일 생성 완료");
|
|
237
|
-
} catch {
|
|
238
|
-
warn("프로파일 생성 실패 — triflux setup으로 재시도");
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
case "mcp": {
|
|
246
|
-
if (result.action === "rebuild") {
|
|
247
|
-
if (await confirm("MCP 인벤토리를 재생성하시겠습니까?")) {
|
|
248
|
-
const mcpCheck = join(PKG_ROOT, "scripts", "mcp-check.mjs");
|
|
249
|
-
if (existsSync(mcpCheck)) {
|
|
250
|
-
try {
|
|
251
|
-
execFileSync(process.execPath, [mcpCheck], { timeout: 15000, stdio: "ignore", windowsHide: true });
|
|
252
|
-
ok("MCP 인벤토리 재생성 완료");
|
|
253
|
-
} catch {
|
|
254
|
-
warn("MCP 인벤토리 재생성 실패 — 다음 세션에서 자동 재시도");
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
async function runSelective() {
|
|
265
|
-
const options = STEPS.map((s) => ({
|
|
266
|
-
label: s.name,
|
|
267
|
-
hint: s.desc,
|
|
268
|
-
}));
|
|
269
|
-
|
|
270
|
-
const picked = await select("실행할 단계", options);
|
|
271
|
-
if (!picked) return;
|
|
272
|
-
|
|
273
|
-
const step = STEPS[picked.index];
|
|
274
|
-
console.log();
|
|
275
|
-
const spin = spinner(`${step.name} 실행 중...`);
|
|
276
|
-
const result = STEP_RUNNERS[step.id]();
|
|
277
|
-
spin.stop();
|
|
278
|
-
|
|
279
|
-
showStepResult(step, result);
|
|
280
|
-
|
|
281
|
-
if (!result.ok && result.action) {
|
|
282
|
-
await handleStepFix(step, result);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// CLI step has extra detail
|
|
286
|
-
if (step.id === "cli" && result.results) {
|
|
287
|
-
console.log();
|
|
288
|
-
for (const r of result.results) {
|
|
289
|
-
if (r.found) ok(`${r.name}: 설치됨`);
|
|
290
|
-
else warn(`${r.name}: 미설치 → ${DIM}${r.install}${RESET}`);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
function showSummary(results) {
|
|
296
|
-
console.log();
|
|
297
|
-
divider(46);
|
|
298
|
-
box("Setup 완료", 46);
|
|
299
|
-
console.log();
|
|
300
|
-
|
|
301
|
-
const headers = ["항목", "상태"];
|
|
302
|
-
const rows = STEPS.map((s) => {
|
|
303
|
-
const r = results[s.id];
|
|
304
|
-
if (!r) return [s.name, `${GRAY}건너뜀${RESET}`];
|
|
305
|
-
return [
|
|
306
|
-
s.name,
|
|
307
|
-
r.ok ? `${GREEN}✓ 정상${RESET}` : `${YELLOW}⚠ ${r.detail}${RESET}`,
|
|
308
|
-
];
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
table(headers, rows);
|
|
312
|
-
|
|
313
|
-
const issues = Object.values(results).filter((r) => r && !r.ok).length;
|
|
314
|
-
console.log();
|
|
315
|
-
if (issues === 0) {
|
|
316
|
-
ok(`${BOLD}모든 항목 정상${RESET} — 세션을 재시작하면 적용됩니다`);
|
|
317
|
-
} else {
|
|
318
|
-
warn(`${issues}개 항목에 주의가 필요합니다`);
|
|
319
|
-
info("/tfx-doctor --fix 로 자동 수정을 시도하세요");
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// ── Star Request ──
|
|
324
|
-
|
|
325
|
-
async function starRequest() {
|
|
326
|
-
let ghOk = false;
|
|
327
|
-
try {
|
|
328
|
-
execFileSync("gh", ["auth", "status"], {
|
|
329
|
-
timeout: 5000, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
|
|
330
|
-
});
|
|
331
|
-
ghOk = true;
|
|
332
|
-
} catch {}
|
|
333
|
-
|
|
334
|
-
if (!ghOk) {
|
|
335
|
-
console.log();
|
|
336
|
-
info(`${AMBER}⭐${RESET} 하나가 큰 차이를 만듭니다. ${CYAN}https://github.com/tellang/triflux${RESET}`);
|
|
337
|
-
console.log();
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// gh 인증됨 — 스타 여부 확인
|
|
342
|
-
let alreadyStarred = false;
|
|
343
|
-
try {
|
|
344
|
-
execFileSync("gh", ["api", "user/starred/tellang/triflux"], {
|
|
345
|
-
timeout: 5000, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"],
|
|
346
|
-
});
|
|
347
|
-
alreadyStarred = true;
|
|
348
|
-
} catch {}
|
|
349
|
-
|
|
350
|
-
console.log();
|
|
351
|
-
|
|
352
|
-
if (alreadyStarred) {
|
|
353
|
-
ok(`이미 함께하고 계시군요. ${AMBER}⭐${RESET}`);
|
|
354
|
-
console.log();
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
if (await confirm(`${AMBER}⭐${RESET} 하나가 큰 차이를 만듭니다.`, false)) {
|
|
359
|
-
try {
|
|
360
|
-
execFileSync("gh", ["api", "-X", "PUT", "/user/starred/tellang/triflux"], {
|
|
361
|
-
timeout: 5000, stdio: ["pipe", "pipe", "pipe"],
|
|
362
|
-
});
|
|
363
|
-
ok(`함께해 주셔서 감사합니다. ${AMBER}⭐${RESET}`);
|
|
364
|
-
} catch {
|
|
365
|
-
info(`${CYAN}https://github.com/tellang/triflux${RESET}`);
|
|
366
|
-
}
|
|
367
|
-
} else {
|
|
368
|
-
console.log(` ${DIM}${CYAN}https://github.com/tellang/triflux${RESET}`);
|
|
369
|
-
}
|
|
370
|
-
console.log();
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// ── Main Menu ──
|
|
374
|
-
|
|
375
|
-
const MENU = [
|
|
376
|
-
{ label: "전체 설정 (Full Setup)", hint: "6단계 순서 실행" },
|
|
377
|
-
{ label: "단계별 선택 (Selective)", hint: "특정 단계만 실행" },
|
|
378
|
-
{ label: "현재 상태 확인 (Status)", hint: "설정 없이 진단만" },
|
|
379
|
-
{ label: "종료", hint: "Ctrl+C" },
|
|
380
|
-
];
|
|
381
|
-
|
|
382
|
-
async function main() {
|
|
383
|
-
onExit(() => {});
|
|
384
|
-
clear();
|
|
385
|
-
|
|
386
|
-
while (true) {
|
|
387
|
-
box("triflux Setup Wizard", 46);
|
|
388
|
-
console.log();
|
|
389
|
-
|
|
390
|
-
const choice = await select("작업 선택", MENU);
|
|
391
|
-
if (!choice || choice.index === 3) {
|
|
392
|
-
console.log();
|
|
393
|
-
info("종료합니다.");
|
|
394
|
-
showCursor();
|
|
395
|
-
break;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
console.log();
|
|
399
|
-
|
|
400
|
-
switch (choice.index) {
|
|
401
|
-
case 0: {
|
|
402
|
-
const results = await runWizard();
|
|
403
|
-
showSummary(results);
|
|
404
|
-
await starRequest();
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
case 1: {
|
|
409
|
-
await runSelective();
|
|
410
|
-
break;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
case 2: {
|
|
414
|
-
info("현재 상태를 확인합니다...");
|
|
415
|
-
console.log();
|
|
416
|
-
const results = {};
|
|
417
|
-
for (const step of STEPS) {
|
|
418
|
-
if (step.id === "sync") continue; // sync는 상태 확인 불가
|
|
419
|
-
const result = STEP_RUNNERS[step.id]();
|
|
420
|
-
showStepResult(step, result);
|
|
421
|
-
results[step.id] = result;
|
|
422
|
-
if (step.id === "cli" && result.results) {
|
|
423
|
-
for (const r of result.results) {
|
|
424
|
-
if (r.found) ok(` ${r.name}: 설치됨`);
|
|
425
|
-
else warn(` ${r.name}: 미설치`);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
break;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
console.log();
|
|
434
|
-
divider(46);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
main().catch((e) => {
|
|
439
|
-
showCursor();
|
|
440
|
-
console.error(e);
|
|
441
|
-
process.exit(1);
|
|
442
|
-
});
|