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