sales-frontend-gemini-cli 0.4.0 → 0.4.1
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/dist/common/helper.cjs +23 -3
- package/dist/common/helper.cjs.map +1 -1
- package/dist/common/helper.d.cts +1 -1
- package/dist/common/helper.d.ts +1 -1
- package/dist/common/helper.js +23 -3
- package/dist/common/helper.js.map +1 -1
- package/dist/pr-review/claude/claude-commander.cjs +134 -27
- package/dist/pr-review/claude/claude-commander.cjs.map +1 -1
- package/dist/pr-review/claude/claude-commander.d.cts +7 -8
- package/dist/pr-review/claude/claude-commander.d.ts +7 -8
- package/dist/pr-review/claude/claude-commander.js +134 -27
- package/dist/pr-review/claude/claude-commander.js.map +1 -1
- package/dist/pr-review/claude/installation-claude.cjs.map +1 -1
- package/dist/pr-review/claude/installation-claude.js.map +1 -1
- package/dist/pr-review/codex/codex-commander.cjs +58 -20
- package/dist/pr-review/codex/codex-commander.cjs.map +1 -1
- package/dist/pr-review/codex/codex-commander.d.cts +8 -3
- package/dist/pr-review/codex/codex-commander.d.ts +8 -3
- package/dist/pr-review/codex/codex-commander.js +58 -20
- package/dist/pr-review/codex/codex-commander.js.map +1 -1
- package/dist/pr-review/codex/installation-codex.cjs.map +1 -1
- package/dist/pr-review/codex/installation-codex.js.map +1 -1
- package/dist/pr-review/gemini/gemini-commander.cjs +115 -20
- package/dist/pr-review/gemini/gemini-commander.cjs.map +1 -1
- package/dist/pr-review/gemini/gemini-commander.d.cts +10 -13
- package/dist/pr-review/gemini/gemini-commander.d.ts +10 -13
- package/dist/pr-review/gemini/gemini-commander.js +115 -20
- package/dist/pr-review/gemini/gemini-commander.js.map +1 -1
- package/dist/pr-review/gemini/installation-gemini.cjs.map +1 -1
- package/dist/pr-review/gemini/installation-gemini.js.map +1 -1
- package/dist/pr-review/review-one-by-one.cjs +329 -67
- package/dist/pr-review/review-one-by-one.cjs.map +1 -1
- package/dist/pr-review/review-one-by-one.js +329 -67
- package/dist/pr-review/review-one-by-one.js.map +1 -1
- package/dist/pr-review/review.cjs +329 -67
- package/dist/pr-review/review.cjs.map +1 -1
- package/dist/pr-review/review.js +329 -67
- package/dist/pr-review/review.js.map +1 -1
- package/package.json +1 -1
|
@@ -29,6 +29,21 @@ var ignoreList = [
|
|
|
29
29
|
".review-report/"
|
|
30
30
|
// 생성되는 리포트 폴더도 제외
|
|
31
31
|
];
|
|
32
|
+
function parseServiceFromArgs(args4 = process.argv.slice(2)) {
|
|
33
|
+
const serviceIndex = args4.indexOf("--service");
|
|
34
|
+
const rawService = serviceIndex !== -1 ? args4[serviceIndex + 1] : "";
|
|
35
|
+
if (!rawService) {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
const normalizedService = rawService.toLowerCase();
|
|
39
|
+
if (AIServices.includes(normalizedService)) {
|
|
40
|
+
return normalizedService;
|
|
41
|
+
}
|
|
42
|
+
console.error(
|
|
43
|
+
`\u274C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC11C\uBE44\uC2A4\uC785\uB2C8\uB2E4: ${rawService}. \uC0AC\uC6A9 \uAC00\uB2A5 \uAC12: ${AIServices.join(", ")} (\uC608: --service codex)`
|
|
44
|
+
);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
32
47
|
function isTestMode(args4 = process.argv.slice(2)) {
|
|
33
48
|
return args4.includes("--test");
|
|
34
49
|
}
|
|
@@ -159,6 +174,13 @@ function getDiffArgs() {
|
|
|
159
174
|
return diffArgs;
|
|
160
175
|
}
|
|
161
176
|
async function showSelectionAIService() {
|
|
177
|
+
const selectedServiceFromArgs = parseServiceFromArgs();
|
|
178
|
+
if (selectedServiceFromArgs) {
|
|
179
|
+
console.log(`
|
|
180
|
+
\u2705 \x1B[32m${selectedServiceFromArgs}\x1B[0m \uC11C\uBE44\uC2A4\uAC00 \uC120\uD0DD\uB418\uC5C8\uC2B5\uB2C8\uB2E4. (--service)
|
|
181
|
+
`);
|
|
182
|
+
return selectedServiceFromArgs;
|
|
183
|
+
}
|
|
162
184
|
let selectedIndex = 0;
|
|
163
185
|
const rl = readline.createInterface({
|
|
164
186
|
input: process.stdin,
|
|
@@ -222,40 +244,147 @@ async function showSelectionAIService() {
|
|
|
222
244
|
}
|
|
223
245
|
var args = process.argv.slice(2);
|
|
224
246
|
var trace = createTraceLogger("claude-commander", args);
|
|
225
|
-
var
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
247
|
+
var ALLOWED_REASONING_EFFORTS = ["minimal", "low", "medium", "high"];
|
|
248
|
+
function shellQuote(value) {
|
|
249
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
250
|
+
}
|
|
251
|
+
function getArgValue(flag) {
|
|
252
|
+
const index = args.indexOf(flag);
|
|
253
|
+
if (index === -1 || !args[index + 1]) {
|
|
254
|
+
return "";
|
|
255
|
+
}
|
|
256
|
+
return args[index + 1];
|
|
257
|
+
}
|
|
258
|
+
function toUnique(values) {
|
|
259
|
+
const seen = /* @__PURE__ */ new Set();
|
|
260
|
+
return values.filter((value) => {
|
|
261
|
+
if (!value || seen.has(value)) {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
seen.add(value);
|
|
265
|
+
return true;
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function normalizeEffort(level) {
|
|
269
|
+
if (level === "minimal") {
|
|
270
|
+
return "low";
|
|
271
|
+
}
|
|
272
|
+
return level;
|
|
273
|
+
}
|
|
274
|
+
function resolveReasoningEffort() {
|
|
275
|
+
const customReasoningEffort = getArgValue("--reasoning-effort") || getArgValue("--effort");
|
|
276
|
+
if (customReasoningEffort) {
|
|
277
|
+
if (ALLOWED_REASONING_EFFORTS.includes(customReasoningEffort)) {
|
|
278
|
+
const normalized = normalizeEffort(customReasoningEffort);
|
|
279
|
+
trace("reasoning:custom", `${customReasoningEffort} -> ${normalized}`);
|
|
280
|
+
if (customReasoningEffort === "minimal") {
|
|
281
|
+
console.warn("\u26A0\uFE0F Claude\uB294 minimal\uC744 \uC9C1\uC811 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC544 low\uB85C \uB9E4\uD551\uD569\uB2C8\uB2E4.");
|
|
282
|
+
}
|
|
283
|
+
return normalized;
|
|
244
284
|
}
|
|
285
|
+
console.warn(
|
|
286
|
+
`\u26A0\uFE0F \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uB294 reasoning effort(${customReasoningEffort})\uC785\uB2C8\uB2E4. allowed: ${ALLOWED_REASONING_EFFORTS.join(
|
|
287
|
+
", "
|
|
288
|
+
)}`
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
if (args.includes("--flash")) {
|
|
292
|
+
trace("reasoning:flash-default", "low");
|
|
293
|
+
return "low";
|
|
294
|
+
}
|
|
295
|
+
if (args.includes("--review")) {
|
|
296
|
+
trace("reasoning:review-default", "high");
|
|
297
|
+
return "high";
|
|
245
298
|
}
|
|
299
|
+
trace("reasoning:default", "medium");
|
|
300
|
+
return "medium";
|
|
301
|
+
}
|
|
302
|
+
function resolvePrimaryAlias() {
|
|
303
|
+
if (args.includes("--review")) {
|
|
304
|
+
trace("model:mode-alias", "opus");
|
|
305
|
+
return "opus";
|
|
306
|
+
}
|
|
307
|
+
if (args.includes("--flash")) {
|
|
308
|
+
trace("model:mode-alias", "haiku");
|
|
309
|
+
return "haiku";
|
|
310
|
+
}
|
|
311
|
+
trace("model:default-alias", "sonnet");
|
|
312
|
+
return "sonnet";
|
|
313
|
+
}
|
|
314
|
+
function getAliasFallbacks(primaryAlias) {
|
|
315
|
+
if (primaryAlias === "opus") {
|
|
316
|
+
return ["opus", "sonnet", "haiku"];
|
|
317
|
+
}
|
|
318
|
+
if (primaryAlias === "haiku") {
|
|
319
|
+
return ["haiku", "sonnet"];
|
|
320
|
+
}
|
|
321
|
+
return [primaryAlias, "sonnet", "haiku"];
|
|
322
|
+
}
|
|
323
|
+
function buildClaudeExecCommand(options) {
|
|
324
|
+
const { tempDiffPath: tempDiffPath2, prompt, systemPromptFiles, effort, model, fallbackModel } = options;
|
|
325
|
+
const modelOption = model ? `--model ${shellQuote(model)}` : "";
|
|
326
|
+
const fallbackOption = model && fallbackModel ? `--fallback-model ${shellQuote(fallbackModel)}` : "";
|
|
327
|
+
const effortOption = `--effort ${shellQuote(effort)}`;
|
|
328
|
+
const appendedPromptFiles = systemPromptFiles.map((path2) => `--append-system-prompt-file ${shellQuote(path2)}`).join(" ");
|
|
329
|
+
return `cat ${shellQuote(tempDiffPath2)} | claude ${[
|
|
330
|
+
modelOption,
|
|
331
|
+
fallbackOption,
|
|
332
|
+
effortOption,
|
|
333
|
+
appendedPromptFiles,
|
|
334
|
+
"-p",
|
|
335
|
+
shellQuote(prompt)
|
|
336
|
+
].filter(Boolean).join(" ")}`;
|
|
337
|
+
}
|
|
338
|
+
var createClaudeCommand = (tempDiffPath2, reviewFormPath2) => {
|
|
339
|
+
trace("createClaudeCommand:start", `tempDiffPath=${tempDiffPath2}, reviewFormPath=${reviewFormPath2}`);
|
|
340
|
+
const customModel = getArgValue("--model");
|
|
341
|
+
const effort = resolveReasoningEffort();
|
|
342
|
+
const primaryAlias = resolvePrimaryAlias();
|
|
343
|
+
const aliasFallbacks = toUnique(getAliasFallbacks(primaryAlias));
|
|
246
344
|
const rules = [
|
|
247
345
|
{ path: rulesPath, display: "\uB8F0\uC14B" },
|
|
248
346
|
{ path: namingRulesPath, display: "\uB124\uC774\uBC0D \uADDC\uCE59" },
|
|
249
347
|
{ path: codingConventionRulesPath, display: "\uCF54\uB529 \uCEE8\uBCA4\uC158" }
|
|
250
348
|
];
|
|
251
|
-
const
|
|
252
|
-
trace(
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
349
|
+
const existingRuleFiles = rules.filter((rule) => fs5.existsSync(rule.path)).map((rule) => rule.path);
|
|
350
|
+
trace("rules:loaded", `count=${existingRuleFiles.length}`);
|
|
351
|
+
const reviewFormExists = fs5.existsSync(reviewFormPath2);
|
|
352
|
+
trace("reviewForm:status", reviewFormExists ? "exists" : "missing");
|
|
353
|
+
const systemPromptFiles = reviewFormExists ? [...existingRuleFiles, reviewFormPath2] : existingRuleFiles;
|
|
354
|
+
const prompt = "\uC704 \uADDC\uCE59\uB4E4\uC744 \uCC38\uACE0\uD558\uC5EC \uC774 diff\uB97C \uCF54\uB4DC\uB9AC\uBDF0\uD574\uC918. \uB9AC\uBDF0\uC591\uC2DD\uC5D0 \uB9DE\uCDB0\uC11C \uC791\uC131\uD574\uC918.";
|
|
355
|
+
const modelCandidates = toUnique(customModel ? [customModel, ...aliasFallbacks] : aliasFallbacks);
|
|
356
|
+
trace("model:candidates", modelCandidates.join(", "));
|
|
357
|
+
if (customModel) {
|
|
358
|
+
console.warn(
|
|
359
|
+
`\u26A0\uFE0F \uCEE4\uC2A4\uD140 \uBAA8\uB378(${customModel})\uC744 \uC6B0\uC120 \uC2DC\uB3C4\uD558\uACE0 \uC2E4\uD328\uD558\uBA74 alias(${aliasFallbacks.join(
|
|
360
|
+
" -> "
|
|
361
|
+
)}) \uBC0F \uAE30\uBCF8 \uBAA8\uB378 \uC21C\uC73C\uB85C \uD3F4\uBC31\uD569\uB2C8\uB2E4.`
|
|
362
|
+
);
|
|
363
|
+
} else {
|
|
364
|
+
console.warn(
|
|
365
|
+
`\u26A0\uFE0F \uBAA8\uB378\uC774 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. alias(${aliasFallbacks.join(" -> ")})\uB97C \uC21C\uCC28 \uC2DC\uB3C4\uD558\uACE0 \uB9C8\uC9C0\uB9C9\uC5D0 \uAE30\uBCF8 \uBAA8\uB378\uB85C \uD3F4\uBC31\uD569\uB2C8\uB2E4.`
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
const commandCandidates = modelCandidates.map((model, index) => {
|
|
369
|
+
const fallbackModel = modelCandidates[index + 1];
|
|
370
|
+
return buildClaudeExecCommand({
|
|
371
|
+
tempDiffPath: tempDiffPath2,
|
|
372
|
+
prompt,
|
|
373
|
+
systemPromptFiles,
|
|
374
|
+
effort,
|
|
375
|
+
model,
|
|
376
|
+
fallbackModel
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
const command = [
|
|
380
|
+
...commandCandidates,
|
|
381
|
+
buildClaudeExecCommand({
|
|
382
|
+
tempDiffPath: tempDiffPath2,
|
|
383
|
+
prompt,
|
|
384
|
+
systemPromptFiles,
|
|
385
|
+
effort
|
|
386
|
+
})
|
|
387
|
+
].join(" || ");
|
|
259
388
|
trace("command:created");
|
|
260
389
|
if (args.includes("--test")) {
|
|
261
390
|
const safeCommand = command.replace(/"/g, '\\"');
|
|
@@ -298,27 +427,50 @@ function checkClaudeCliInstalled() {
|
|
|
298
427
|
}
|
|
299
428
|
var args2 = process.argv.slice(2);
|
|
300
429
|
var trace3 = createTraceLogger("codex-commander", args2);
|
|
301
|
-
var
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
modelOption = "--model gpt-5-mini";
|
|
319
|
-
trace3("model:default", modelOption);
|
|
430
|
+
var ALLOWED_REASONING_EFFORTS2 = ["minimal", "low", "medium", "high"];
|
|
431
|
+
function shellQuote2(value) {
|
|
432
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
433
|
+
}
|
|
434
|
+
function getArgValue2(flag) {
|
|
435
|
+
const index = args2.indexOf(flag);
|
|
436
|
+
if (index === -1 || !args2[index + 1]) {
|
|
437
|
+
return "";
|
|
438
|
+
}
|
|
439
|
+
return args2[index + 1];
|
|
440
|
+
}
|
|
441
|
+
function resolveReasoningEffort2() {
|
|
442
|
+
const customReasoningEffort = getArgValue2("--reasoning-effort");
|
|
443
|
+
if (customReasoningEffort) {
|
|
444
|
+
if (ALLOWED_REASONING_EFFORTS2.includes(customReasoningEffort)) {
|
|
445
|
+
trace3("reasoning:custom", customReasoningEffort);
|
|
446
|
+
return customReasoningEffort;
|
|
320
447
|
}
|
|
448
|
+
console.warn(
|
|
449
|
+
`\u26A0\uFE0F \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uB294 reasoning effort(${customReasoningEffort})\uC785\uB2C8\uB2E4. allowed: ${ALLOWED_REASONING_EFFORTS2.join(
|
|
450
|
+
", "
|
|
451
|
+
)}`
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
if (args2.includes("--flash")) {
|
|
455
|
+
trace3("reasoning:flash-default", "minimal");
|
|
456
|
+
return "minimal";
|
|
321
457
|
}
|
|
458
|
+
if (args2.includes("--review")) {
|
|
459
|
+
trace3("reasoning:review-default", "high");
|
|
460
|
+
return "high";
|
|
461
|
+
}
|
|
462
|
+
trace3("reasoning:default", "medium");
|
|
463
|
+
return "medium";
|
|
464
|
+
}
|
|
465
|
+
function buildCodexExecCommand(prompt, reasoningEffort, model) {
|
|
466
|
+
const modelOption = model ? `--model ${shellQuote2(model)}` : "";
|
|
467
|
+
const reasoningOption = `-c ${shellQuote2(`model_reasoning_effort="${reasoningEffort}"`)}`;
|
|
468
|
+
return `codex exec ${[modelOption, reasoningOption, shellQuote2(prompt)].filter(Boolean).join(" ")}`;
|
|
469
|
+
}
|
|
470
|
+
var createCodexCommand = (tempDiffPath2, reviewFormPath2) => {
|
|
471
|
+
trace3("createCodexCommand:start", `tempDiffPath=${tempDiffPath2}, reviewFormPath=${reviewFormPath2}`);
|
|
472
|
+
const customModel = getArgValue2("--model");
|
|
473
|
+
const reasoningEffort = resolveReasoningEffort2();
|
|
322
474
|
const rules = [rulesPath, namingRulesPath, codingConventionRulesPath].filter((filePath) => fs5.existsSync(filePath)).map((filePath) => `- ${filePath}`).join("\n");
|
|
323
475
|
const rulesCount = rules ? rules.split("\n").length : 0;
|
|
324
476
|
trace3("rules:loaded", `count=${rulesCount}`);
|
|
@@ -334,7 +486,22 @@ ${reviewFormLine || "- (\uC5C6\uC74C)"}
|
|
|
334
486
|
- ${tempDiffPath2}
|
|
335
487
|
|
|
336
488
|
\uBC18\uB4DC\uC2DC \uB9AC\uBDF0 \uC591\uC2DD\uC5D0 \uB9DE\uCDB0 \uC791\uC131\uD574\uC918.`;
|
|
337
|
-
|
|
489
|
+
let command = "";
|
|
490
|
+
if (customModel) {
|
|
491
|
+
console.warn("\u26A0\uFE0F \uC9C0\uC815\uD55C \uBAA8\uB378\uC774 \uC5C6\uB294 \uACBD\uC6B0, \uC5D0\uB7EC\uAC00 \uBC1C\uC0DD\uD558\uB2C8 \uC8FC\uC758\uD558\uC138\uC694.");
|
|
492
|
+
trace3("model:custom", customModel);
|
|
493
|
+
command = buildCodexExecCommand(prompt, reasoningEffort, customModel);
|
|
494
|
+
} else {
|
|
495
|
+
const preferredModelAlias = "gpt-5";
|
|
496
|
+
const aliasCommand = buildCodexExecCommand(prompt, reasoningEffort, preferredModelAlias);
|
|
497
|
+
const fallbackCommand = buildCodexExecCommand(prompt, reasoningEffort);
|
|
498
|
+
console.warn(
|
|
499
|
+
`\u26A0\uFE0F \uBAA8\uB378\uC774 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. alias(${preferredModelAlias})\uB97C \uC6B0\uC120 \uC2DC\uB3C4\uD558\uACE0 \uC2E4\uD328\uD558\uBA74 \uACC4\uC815 \uAE30\uBCF8 \uBAA8\uB378\uB85C \uC790\uB3D9 \uD3F4\uBC31\uD569\uB2C8\uB2E4.`
|
|
500
|
+
);
|
|
501
|
+
trace3("model:alias-first", preferredModelAlias);
|
|
502
|
+
trace3("model:fallback", "account-default");
|
|
503
|
+
command = `${aliasCommand} || ${fallbackCommand}`;
|
|
504
|
+
}
|
|
338
505
|
trace3("command:created");
|
|
339
506
|
if (args2.includes("--test")) {
|
|
340
507
|
const safeCommand = command.replace(/"/g, '\\"');
|
|
@@ -375,27 +542,102 @@ function checkCodexCliInstalled() {
|
|
|
375
542
|
}
|
|
376
543
|
var args3 = process.argv.slice(2);
|
|
377
544
|
var trace5 = createTraceLogger("gemini-commander", args3);
|
|
378
|
-
var
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
545
|
+
var ALLOWED_REASONING_EFFORTS3 = ["minimal", "low", "medium", "high"];
|
|
546
|
+
function shellQuote3(value) {
|
|
547
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
548
|
+
}
|
|
549
|
+
function getArgValue3(flag) {
|
|
550
|
+
const index = args3.indexOf(flag);
|
|
551
|
+
if (index === -1 || !args3[index + 1]) {
|
|
552
|
+
return "";
|
|
553
|
+
}
|
|
554
|
+
return args3[index + 1];
|
|
555
|
+
}
|
|
556
|
+
function toUnique2(values) {
|
|
557
|
+
const seen = /* @__PURE__ */ new Set();
|
|
558
|
+
return values.filter((value) => {
|
|
559
|
+
if (!value || seen.has(value)) {
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
seen.add(value);
|
|
563
|
+
return true;
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
function resolveReasoningEffort3() {
|
|
567
|
+
const customReasoningEffort = getArgValue3("--reasoning-effort");
|
|
568
|
+
if (customReasoningEffort) {
|
|
569
|
+
if (ALLOWED_REASONING_EFFORTS3.includes(customReasoningEffort)) {
|
|
570
|
+
trace5("reasoning:custom", customReasoningEffort);
|
|
571
|
+
return customReasoningEffort;
|
|
397
572
|
}
|
|
573
|
+
console.warn(
|
|
574
|
+
`\u26A0\uFE0F \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uB294 reasoning effort(${customReasoningEffort})\uC785\uB2C8\uB2E4. allowed: ${ALLOWED_REASONING_EFFORTS3.join(
|
|
575
|
+
", "
|
|
576
|
+
)}`
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
if (args3.includes("--flash")) {
|
|
580
|
+
trace5("reasoning:flash-default", "minimal");
|
|
581
|
+
return "minimal";
|
|
398
582
|
}
|
|
583
|
+
if (args3.includes("--review")) {
|
|
584
|
+
trace5("reasoning:review-default", "high");
|
|
585
|
+
return "high";
|
|
586
|
+
}
|
|
587
|
+
trace5("reasoning:default", "medium");
|
|
588
|
+
return "medium";
|
|
589
|
+
}
|
|
590
|
+
function resolvePrimaryAlias2(reasoningEffort) {
|
|
591
|
+
if (args3.includes("--review")) {
|
|
592
|
+
trace5("model:mode-alias", "pro");
|
|
593
|
+
return "pro";
|
|
594
|
+
}
|
|
595
|
+
if (args3.includes("--flash")) {
|
|
596
|
+
trace5("model:mode-alias", "flash");
|
|
597
|
+
return "flash";
|
|
598
|
+
}
|
|
599
|
+
if (reasoningEffort === "high") {
|
|
600
|
+
trace5("model:reasoning-alias", "pro");
|
|
601
|
+
return "pro";
|
|
602
|
+
}
|
|
603
|
+
if (reasoningEffort === "minimal" || reasoningEffort === "low") {
|
|
604
|
+
trace5("model:reasoning-alias", "flash");
|
|
605
|
+
return "flash";
|
|
606
|
+
}
|
|
607
|
+
trace5("model:default-alias", "auto");
|
|
608
|
+
return "auto";
|
|
609
|
+
}
|
|
610
|
+
function getAliasFallbacks2(primaryAlias) {
|
|
611
|
+
if (primaryAlias === "pro") {
|
|
612
|
+
return ["pro", "flash", "auto"];
|
|
613
|
+
}
|
|
614
|
+
if (primaryAlias === "flash") {
|
|
615
|
+
return ["flash", "auto", "pro"];
|
|
616
|
+
}
|
|
617
|
+
return [primaryAlias, "auto", "flash", "pro"];
|
|
618
|
+
}
|
|
619
|
+
function getReasoningInstruction(reasoningEffort) {
|
|
620
|
+
if (reasoningEffort === "high") {
|
|
621
|
+
return "high (\uAE4A\uC774 \uC788\uB294 \uBD84\uC11D, \uC7A0\uC7AC\uC801 \uB9AC\uC2A4\uD06C\uAE4C\uC9C0 \uC810\uAC80)";
|
|
622
|
+
}
|
|
623
|
+
if (reasoningEffort === "medium") {
|
|
624
|
+
return "medium (\uADE0\uD615 \uC7A1\uD78C \uBD84\uC11D\uACFC \uD575\uC2EC \uC774\uC288 \uC911\uC2EC)";
|
|
625
|
+
}
|
|
626
|
+
if (reasoningEffort === "low") {
|
|
627
|
+
return "low (\uD575\uC2EC \uACB0\uD568 \uC704\uC8FC\uB85C \uAC04\uACB0\uD558\uAC8C \uBD84\uC11D)";
|
|
628
|
+
}
|
|
629
|
+
return "minimal (\uCE58\uBA85\uB3C4 \uB192\uC740 \uC774\uC288\uB9CC \uB9E4\uC6B0 \uAC04\uACB0\uD558\uAC8C \uBD84\uC11D)";
|
|
630
|
+
}
|
|
631
|
+
function buildGeminiExecCommand(prompt, model) {
|
|
632
|
+
const modelOption = model ? `--model ${shellQuote3(model)}` : "";
|
|
633
|
+
return `gemini ${[modelOption, "-p", shellQuote3(prompt)].filter(Boolean).join(" ")}`;
|
|
634
|
+
}
|
|
635
|
+
var createGeminiCommand = (tempDiffPath2, reviewFormPath2) => {
|
|
636
|
+
trace5("createGeminiCommand:start", `tempDiffPath=${tempDiffPath2}, reviewFormPath=${reviewFormPath2}`);
|
|
637
|
+
const customModel = getArgValue3("--model");
|
|
638
|
+
const reasoningEffort = resolveReasoningEffort3();
|
|
639
|
+
const primaryAlias = resolvePrimaryAlias2(reasoningEffort);
|
|
640
|
+
const aliasFallbacks = toUnique2(getAliasFallbacks2(primaryAlias));
|
|
399
641
|
const rules = [
|
|
400
642
|
{ path: rulesPath, display: "\uB8F0\uC14B" },
|
|
401
643
|
{ path: namingRulesPath, display: "\uB124\uC774\uBC0D \uADDC\uCE59" },
|
|
@@ -404,7 +646,27 @@ var createGeminiCommand = (tempDiffPath2, reviewFormPath2) => {
|
|
|
404
646
|
const validRules = rules.filter((rule) => fs5.existsSync(rule.path)).map((rule) => `@${rule.path}`).join(", ");
|
|
405
647
|
const rulesCount = validRules ? validRules.split(",").length : 0;
|
|
406
648
|
trace5("rules:loaded", `count=${rulesCount}`);
|
|
407
|
-
const
|
|
649
|
+
const reviewFormRef = fs5.existsSync(reviewFormPath2) ? `@${reviewFormPath2}` : "(\uC5C6\uC74C)";
|
|
650
|
+
trace5("reviewForm:status", reviewFormRef === "(\uC5C6\uC74C)" ? "missing" : "exists");
|
|
651
|
+
const reasoningInstruction = getReasoningInstruction(reasoningEffort);
|
|
652
|
+
const prompt = `\uB2E4\uC74C \uADDC\uCE59\uB4E4\uC744 \uCC38\uACE0\uD574\uC11C(${validRules || "(\uC5C6\uC74C)"}) \uC774 diff(@${tempDiffPath2})\uB97C \uB9AC\uBDF0\uD574\uC918.
|
|
653
|
+
\uB9AC\uBDF0 \uC591\uC2DD\uC740 ${reviewFormRef} \uC5D0 \uB9DE\uCDB0\uC11C \uC791\uC131\uD574\uC918.
|
|
654
|
+
\uCD94\uB860 \uAC15\uB3C4 \uC9C0\uCE68: ${reasoningInstruction}`;
|
|
655
|
+
const modelCandidates = toUnique2(customModel ? [customModel, ...aliasFallbacks] : aliasFallbacks);
|
|
656
|
+
trace5("model:candidates", modelCandidates.join(", "));
|
|
657
|
+
if (customModel) {
|
|
658
|
+
console.warn(
|
|
659
|
+
`\u26A0\uFE0F \uCEE4\uC2A4\uD140 \uBAA8\uB378(${customModel})\uC744 \uC6B0\uC120 \uC2DC\uB3C4\uD558\uACE0 \uC2E4\uD328\uD558\uBA74 alias(${aliasFallbacks.join(
|
|
660
|
+
" -> "
|
|
661
|
+
)}) \uBC0F \uAE30\uBCF8 \uBAA8\uB378 \uC21C\uC73C\uB85C \uD3F4\uBC31\uD569\uB2C8\uB2E4.`
|
|
662
|
+
);
|
|
663
|
+
} else {
|
|
664
|
+
console.warn(
|
|
665
|
+
`\u26A0\uFE0F \uBAA8\uB378\uC774 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. alias(${aliasFallbacks.join(" -> ")})\uB97C \uC21C\uCC28 \uC2DC\uB3C4\uD558\uACE0 \uB9C8\uC9C0\uB9C9\uC5D0 \uAE30\uBCF8 \uBAA8\uB378\uB85C \uD3F4\uBC31\uD569\uB2C8\uB2E4.`
|
|
666
|
+
);
|
|
667
|
+
}
|
|
668
|
+
const commandCandidates = modelCandidates.map((model) => buildGeminiExecCommand(prompt, model));
|
|
669
|
+
const command = [...commandCandidates, buildGeminiExecCommand(prompt)].join(" || ");
|
|
408
670
|
trace5("command:created");
|
|
409
671
|
if (args3.includes("--test")) {
|
|
410
672
|
const safeCommand = command.replace(/"/g, '\\"');
|