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