sales-frontend-gemini-cli 0.4.4 → 0.5.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/dist/common/helper.cjs +108 -17
- package/dist/common/helper.cjs.map +1 -1
- package/dist/common/helper.js +108 -17
- package/dist/common/helper.js.map +1 -1
- package/dist/common/types.d.cts +3 -1
- package/dist/common/types.d.ts +3 -1
- package/dist/pr-review/claude/claude-commander.cjs.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- 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 +75 -20
- package/dist/pr-review/review-one-by-one.cjs.map +1 -1
- package/dist/pr-review/review-one-by-one.js +75 -20
- package/dist/pr-review/review-one-by-one.js.map +1 -1
- package/dist/pr-review/review.cjs +109 -18
- package/dist/pr-review/review.cjs.map +1 -1
- package/dist/pr-review/review.js +109 -18
- package/dist/pr-review/review.js.map +1 -1
- package/package.json +1 -1
package/dist/pr-review/review.js
CHANGED
|
@@ -200,15 +200,51 @@ function runGitCommand(args4, options = {}) {
|
|
|
200
200
|
throw error;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
+
function resolveShellLaunchConfig() {
|
|
204
|
+
const candidates = [];
|
|
205
|
+
const seen = /* @__PURE__ */ new Set();
|
|
206
|
+
const appendCandidate = (executable, shellArgs) => {
|
|
207
|
+
const normalizedExecutable = executable?.trim();
|
|
208
|
+
if (!normalizedExecutable) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (path.isAbsolute(normalizedExecutable) && !fs.existsSync(normalizedExecutable)) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const key = `${normalizedExecutable}::${shellArgs.join("\0")}`;
|
|
215
|
+
if (seen.has(key)) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
seen.add(key);
|
|
219
|
+
candidates.push({
|
|
220
|
+
executable: normalizedExecutable,
|
|
221
|
+
shellArgs
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
const shellFromEnv = process.env.SHELL?.trim();
|
|
225
|
+
const envShellName = shellFromEnv ? path.basename(shellFromEnv) : "";
|
|
226
|
+
if (["bash", "zsh", "ksh"].includes(envShellName)) {
|
|
227
|
+
appendCandidate(shellFromEnv, ["-lc"]);
|
|
228
|
+
}
|
|
229
|
+
["/bin/bash", "/usr/bin/bash", "bash", "/bin/zsh", "/usr/bin/zsh", "zsh"].forEach((shellPath) => {
|
|
230
|
+
appendCandidate(shellPath, ["-lc"]);
|
|
231
|
+
});
|
|
232
|
+
["/bin/sh", "/usr/bin/sh", "sh"].forEach((shellPath) => {
|
|
233
|
+
appendCandidate(shellPath, ["-c"]);
|
|
234
|
+
});
|
|
235
|
+
return candidates[0] || { executable: "sh", shellArgs: ["-c"] };
|
|
236
|
+
}
|
|
203
237
|
async function executeShellCommandWithProgress(command, options = {}) {
|
|
204
238
|
const { progressIntervalMs = 1e4, progressMessage = "\u23F3 \uBA85\uB839\uC744 \uC2E4\uD589\uD558\uB294 \uC911\uC785\uB2C8\uB2E4...", streamOutput = false } = options;
|
|
205
239
|
const { spawn } = await import('child_process');
|
|
240
|
+
const shellLaunchConfig = resolveShellLaunchConfig();
|
|
206
241
|
return new Promise((resolve, reject) => {
|
|
207
242
|
let stdout = "";
|
|
208
243
|
let stderr = "";
|
|
209
244
|
const startedAt = Date.now();
|
|
210
245
|
console.log(progressMessage);
|
|
211
|
-
|
|
246
|
+
helperTrace("shell-command:launcher", `${shellLaunchConfig.executable} ${shellLaunchConfig.shellArgs.join(" ")}`);
|
|
247
|
+
const child = spawn(shellLaunchConfig.executable, [...shellLaunchConfig.shellArgs, command], {
|
|
212
248
|
stdio: ["ignore", "pipe", "pipe"]
|
|
213
249
|
});
|
|
214
250
|
const progressTimer = setInterval(() => {
|
|
@@ -587,6 +623,62 @@ function truncateCommitSubject(subject) {
|
|
|
587
623
|
}
|
|
588
624
|
return `${subject.slice(0, 69)}...`;
|
|
589
625
|
}
|
|
626
|
+
function formatReviewTargetFileCount(fileCount) {
|
|
627
|
+
return fileCount === 0 ? "\uBCC0\uACBD \uC5C6\uC74C" : `${fileCount}\uAC1C \uD30C\uC77C`;
|
|
628
|
+
}
|
|
629
|
+
function buildReviewTargetSectionTitle(target) {
|
|
630
|
+
return target.kind === "commit" ? `${target.hash} ${target.subject}` : `${target.hash} | ${target.subject}`;
|
|
631
|
+
}
|
|
632
|
+
function buildReviewTargetSummaryLine(target) {
|
|
633
|
+
if (target.kind === "commit") {
|
|
634
|
+
return `- ${target.hash} | ${target.subject} | ${target.author} | ${target.relativeDate}`;
|
|
635
|
+
}
|
|
636
|
+
return `- ${target.hash} | ${target.subject}`;
|
|
637
|
+
}
|
|
638
|
+
function buildReviewTargetDiffArgs(target, filePath) {
|
|
639
|
+
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
640
|
+
if (target.kind === "commit") {
|
|
641
|
+
return ["show", "--stat", "--patch", "--format=", target.hash, "--", ...reviewPathspecArgs];
|
|
642
|
+
}
|
|
643
|
+
const diffArgs = ["diff"];
|
|
644
|
+
if (target.kind === "staged") {
|
|
645
|
+
diffArgs.push("--cached");
|
|
646
|
+
}
|
|
647
|
+
diffArgs.push("--stat", "--patch", "--");
|
|
648
|
+
return [...diffArgs, ...reviewPathspecArgs];
|
|
649
|
+
}
|
|
650
|
+
function buildReviewTargetFileArgs(target) {
|
|
651
|
+
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
652
|
+
if (target.kind === "commit") {
|
|
653
|
+
return ["show", "--pretty=format:", "--name-only", target.hash, "--", ...reviewPathspecArgs];
|
|
654
|
+
}
|
|
655
|
+
const diffArgs = ["diff"];
|
|
656
|
+
if (target.kind === "staged") {
|
|
657
|
+
diffArgs.push("--cached");
|
|
658
|
+
}
|
|
659
|
+
return [...diffArgs, "--name-only", "--", ...reviewPathspecArgs];
|
|
660
|
+
}
|
|
661
|
+
function getReviewTargetFiles(target) {
|
|
662
|
+
const output = runGitCommand(buildReviewTargetFileArgs(target), {
|
|
663
|
+
allowFailure: true
|
|
664
|
+
});
|
|
665
|
+
return output.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
666
|
+
}
|
|
667
|
+
function createWorkingTreeReviewOption(kind) {
|
|
668
|
+
const files = getReviewTargetFiles({
|
|
669
|
+
hash: kind,
|
|
670
|
+
kind});
|
|
671
|
+
const subject = kind === "unstaged" ? "\uC544\uC9C1 git add \uD558\uC9C0 \uC54A\uC740 \uBCC0\uACBD\uC0AC\uD56D" : "git add \uB41C \uBCC0\uACBD\uC0AC\uD56D";
|
|
672
|
+
return {
|
|
673
|
+
author: "",
|
|
674
|
+
description: `${subject} | ${formatReviewTargetFileCount(files.length)}`,
|
|
675
|
+
hash: kind,
|
|
676
|
+
kind,
|
|
677
|
+
label: kind,
|
|
678
|
+
relativeDate: "",
|
|
679
|
+
subject
|
|
680
|
+
};
|
|
681
|
+
}
|
|
590
682
|
function getRecentCommitOptions() {
|
|
591
683
|
const output = runGitCommand(
|
|
592
684
|
["log", `-${COMMIT_FETCH_LIMIT}`, "--date=relative", "--pretty=format:%h%x09%an%x09%ar%x09%s"],
|
|
@@ -602,44 +694,43 @@ function getRecentCommitOptions() {
|
|
|
602
694
|
author,
|
|
603
695
|
description: `${author} | ${relativeDate}`,
|
|
604
696
|
hash,
|
|
697
|
+
kind: "commit",
|
|
605
698
|
label: `${hash} | ${truncateCommitSubject(subject)}`,
|
|
606
699
|
relativeDate,
|
|
607
700
|
subject
|
|
608
701
|
};
|
|
609
702
|
});
|
|
610
703
|
}
|
|
704
|
+
function getReviewTargetOptions() {
|
|
705
|
+
return [createWorkingTreeReviewOption("unstaged"), createWorkingTreeReviewOption("staged"), ...getRecentCommitOptions()];
|
|
706
|
+
}
|
|
611
707
|
function buildSelectedCommitSummary(commits) {
|
|
612
|
-
return commits.map((commit) =>
|
|
708
|
+
return commits.map((commit) => buildReviewTargetSummaryLine(commit)).join("\n");
|
|
613
709
|
}
|
|
614
710
|
function getReviewPathspecArgs() {
|
|
615
711
|
const { includePatterns, excludePatterns } = getGitDiffPathspecs();
|
|
616
712
|
return [...includePatterns, ...excludePatterns];
|
|
617
713
|
}
|
|
618
714
|
function buildSelectedCommitDiff(commits) {
|
|
619
|
-
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
620
715
|
const sections = commits.map((commit) => {
|
|
621
|
-
const diff = runGitCommand(
|
|
716
|
+
const diff = runGitCommand(buildReviewTargetDiffArgs(commit), {
|
|
622
717
|
allowFailure: true,
|
|
623
718
|
trimOutput: false
|
|
624
719
|
}).trim();
|
|
625
720
|
if (!diff) {
|
|
626
721
|
return "";
|
|
627
722
|
}
|
|
628
|
-
return [`## ${commit
|
|
723
|
+
return [`## ${buildReviewTargetSectionTitle(commit)}`, diff].join("\n\n");
|
|
629
724
|
}).filter(Boolean).join("\n\n");
|
|
630
725
|
if (!sections) {
|
|
631
726
|
return "";
|
|
632
727
|
}
|
|
633
|
-
return ["# \uC120\uD0DD\uD55C \
|
|
728
|
+
return ["# \uC120\uD0DD\uD55C \uB9AC\uBDF0 \uB300\uC0C1", buildSelectedCommitSummary(commits), "", "# \uB9AC\uBDF0 \uB300\uC0C1 diff", sections].join("\n");
|
|
634
729
|
}
|
|
635
730
|
function getSelectedCommitFiles(commits) {
|
|
636
|
-
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
637
731
|
const files = /* @__PURE__ */ new Set();
|
|
638
732
|
commits.forEach((commit) => {
|
|
639
|
-
|
|
640
|
-
allowFailure: true
|
|
641
|
-
});
|
|
642
|
-
output.split("\n").map((line) => line.trim()).filter(Boolean).forEach((filePath) => files.add(filePath));
|
|
733
|
+
getReviewTargetFiles(commit).forEach((filePath) => files.add(filePath));
|
|
643
734
|
});
|
|
644
735
|
return [...files];
|
|
645
736
|
}
|
|
@@ -827,13 +918,13 @@ async function showMultiSelect(question, options, windowSize = COMMIT_SELECTION_
|
|
|
827
918
|
});
|
|
828
919
|
}
|
|
829
920
|
async function selectReviewCommits() {
|
|
830
|
-
const commits =
|
|
921
|
+
const commits = getReviewTargetOptions();
|
|
831
922
|
if (commits.length === 0) {
|
|
832
|
-
console.log("\u2139\uFE0F \uB9AC\uBDF0\uD560 \
|
|
923
|
+
console.log("\u2139\uFE0F \uB9AC\uBDF0\uD560 \uB300\uC0C1\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
833
924
|
return [];
|
|
834
925
|
}
|
|
835
926
|
return showMultiSelect(
|
|
836
|
-
"\uB9AC\uBDF0\uD560 \
|
|
927
|
+
"\uB9AC\uBDF0\uD560 \uB300\uC0C1\uC744 \uC120\uD0DD\uD574\uC8FC\uC138\uC694.",
|
|
837
928
|
commits.map((commit) => ({
|
|
838
929
|
description: commit.description,
|
|
839
930
|
label: commit.label,
|
|
@@ -1500,8 +1591,8 @@ async function main() {
|
|
|
1500
1591
|
trace7("commit-selection:done", `count=${selectedCommits.length}`);
|
|
1501
1592
|
if (selectedCommits.length === 0) {
|
|
1502
1593
|
trace7("commit-selection:empty");
|
|
1503
|
-
executionTitle = "\uC120\uD0DD\uB41C \
|
|
1504
|
-
console.log("\u2139\uFE0F \uC120\uD0DD\uB41C \
|
|
1594
|
+
executionTitle = "\uC120\uD0DD\uB41C \uB9AC\uBDF0 \uB300\uC0C1\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.";
|
|
1595
|
+
console.log("\u2139\uFE0F \uC120\uD0DD\uB41C \uB9AC\uBDF0 \uB300\uC0C1\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
1505
1596
|
deleteTempDiff();
|
|
1506
1597
|
return;
|
|
1507
1598
|
}
|
|
@@ -1515,8 +1606,8 @@ async function main() {
|
|
|
1515
1606
|
trace7("git-diff:build:done", `length=${diff.length}`);
|
|
1516
1607
|
if (!diff.trim() && !isTest) {
|
|
1517
1608
|
trace7("empty-diff:exit");
|
|
1518
|
-
executionTitle = "\uC120\uD0DD\uD55C \
|
|
1519
|
-
console.log("\u2139\uFE0F \uC120\uD0DD\uD55C \
|
|
1609
|
+
executionTitle = "\uC120\uD0DD\uD55C \uB9AC\uBDF0 \uB300\uC0C1\uC5D0\uC11C \uB9AC\uBDF0\uD560 \uBCC0\uACBD\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.";
|
|
1610
|
+
console.log("\u2139\uFE0F \uC120\uD0DD\uD55C \uB9AC\uBDF0 \uB300\uC0C1\uC5D0\uC11C \uB9AC\uBDF0\uD560 \uBCC0\uACBD\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.");
|
|
1520
1611
|
deleteTempDiff();
|
|
1521
1612
|
return;
|
|
1522
1613
|
}
|