Skip to content
Merged

Main #329

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sorlros/detoks",
"version": "0.2.0",
"version": "0.2.1",
"private": false,
"type": "module",
"bin": {
Expand Down
18 changes: 17 additions & 1 deletion src/cli/commands/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,21 @@ const resolveReplMode = (args: CliArgs): ReplModeResolution => {
return { useTui: false, reason: "non-TTY/CI 환경" };
};

const resolvePresentationMode = (
args: CliArgs,
replMode: ReplModeResolution,
): CliArgs["presentationMode"] => {
if (args.presentationMode) {
return args.presentationMode;
}

if (replMode.useTui && args.executionMode === "real") {
return "embedded-pane";
}

return undefined;
};

export const runReplCommand = async (baseArgs: CliArgs): Promise<void> => {
const executionCwd = baseArgs.cwd ?? process.cwd();

Expand All @@ -448,6 +463,7 @@ export const runReplCommand = async (baseArgs: CliArgs): Promise<void> => {

// TUI 모드 판정
const replMode = resolveReplMode(baseArgs);
const presentationMode = resolvePresentationMode(baseArgs, replMode);

// TUI 모드인 경우: TUI REPL 실행
if (replMode.useTui) {
Expand All @@ -468,7 +484,7 @@ export const runReplCommand = async (baseArgs: CliArgs): Promise<void> => {
cwd: executionCwd,
...(baseArgs.sessionId ? { sessionId: baseArgs.sessionId } : {}),
translationModel: getTranslationModel(),
...(baseArgs.presentationMode ? { presentationMode: baseArgs.presentationMode } : {}),
...(presentationMode ? { presentationMode } : {}),
};

if (currentModel) {
Expand Down
3 changes: 2 additions & 1 deletion src/cli/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ const CLI_USAGE_REPL = [
" - 각 프롬프트는 별도의 작업 단위로 실행됩니다",
" - execution-mode는 프롬프트를 모의 실행으로 할지 실제 실행으로 할지 결정합니다",
" - interactive TTY에서는 기본적으로 TUI를 사용합니다. --no-tui로 legacy text REPL로 전환할 수 있습니다",
" - real-mode TUI에서는 기본적으로 detoks TUI 안의 embedded CLI pane에 원본 CLI 출력을 표시합니다",
" - --passthrough-ui를 사용하면 원본 CLI UI를 먼저 보여주고 종료 후 detoks 요약을 표시합니다",
" - --embedded-cli-ui를 사용하면 detoks TUI 안의 전용 패널에 원본 CLI 출력을 표시합니다",
" - --embedded-cli-ui는 기본 embedded 동작을 명시적으로 고정합니다",
"",
"옵션:",
` --adapter ${ADAPTER_HELP} 대상 어댑터(기본값: codex)`,
Expand Down
18 changes: 18 additions & 0 deletions tests/ts/unit/cli/repl-tui-startup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,24 @@ describe("runReplCommand TUI startup flow", () => {
);
});

it("defaults real-mode TUI startup to embedded native presentation", async () => {
await runReplCommand({
mode: "repl",
adapter: "codex",
executionMode: "real",
verbose: false,
trace: false,
tui: "force",
showHelp: false,
});

expect(mocks.runTuiRepl).toHaveBeenCalledWith(
expect.objectContaining({
presentationMode: "embedded-pane",
}),
);
});

it("passes embedded presentation mode into the TUI startup flow", async () => {
await runReplCommand({
mode: "repl",
Expand Down
Loading