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/common/helper.js
CHANGED
|
@@ -200,15 +200,51 @@ function runGitCommand(args, 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(() => {
|
|
@@ -594,6 +630,62 @@ function truncateCommitSubject(subject) {
|
|
|
594
630
|
}
|
|
595
631
|
return `${subject.slice(0, 69)}...`;
|
|
596
632
|
}
|
|
633
|
+
function formatReviewTargetFileCount(fileCount) {
|
|
634
|
+
return fileCount === 0 ? "\uBCC0\uACBD \uC5C6\uC74C" : `${fileCount}\uAC1C \uD30C\uC77C`;
|
|
635
|
+
}
|
|
636
|
+
function buildReviewTargetSectionTitle(target) {
|
|
637
|
+
return target.kind === "commit" ? `${target.hash} ${target.subject}` : `${target.hash} | ${target.subject}`;
|
|
638
|
+
}
|
|
639
|
+
function buildReviewTargetSummaryLine(target) {
|
|
640
|
+
if (target.kind === "commit") {
|
|
641
|
+
return `- ${target.hash} | ${target.subject} | ${target.author} | ${target.relativeDate}`;
|
|
642
|
+
}
|
|
643
|
+
return `- ${target.hash} | ${target.subject}`;
|
|
644
|
+
}
|
|
645
|
+
function buildReviewTargetDiffArgs(target, filePath) {
|
|
646
|
+
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
647
|
+
if (target.kind === "commit") {
|
|
648
|
+
return filePath ? ["show", "--stat", "--patch", "--format=", target.hash, "--", filePath] : ["show", "--stat", "--patch", "--format=", target.hash, "--", ...reviewPathspecArgs];
|
|
649
|
+
}
|
|
650
|
+
const diffArgs = ["diff"];
|
|
651
|
+
if (target.kind === "staged") {
|
|
652
|
+
diffArgs.push("--cached");
|
|
653
|
+
}
|
|
654
|
+
diffArgs.push("--stat", "--patch", "--");
|
|
655
|
+
return filePath ? [...diffArgs, filePath] : [...diffArgs, ...reviewPathspecArgs];
|
|
656
|
+
}
|
|
657
|
+
function buildReviewTargetFileArgs(target) {
|
|
658
|
+
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
659
|
+
if (target.kind === "commit") {
|
|
660
|
+
return ["show", "--pretty=format:", "--name-only", target.hash, "--", ...reviewPathspecArgs];
|
|
661
|
+
}
|
|
662
|
+
const diffArgs = ["diff"];
|
|
663
|
+
if (target.kind === "staged") {
|
|
664
|
+
diffArgs.push("--cached");
|
|
665
|
+
}
|
|
666
|
+
return [...diffArgs, "--name-only", "--", ...reviewPathspecArgs];
|
|
667
|
+
}
|
|
668
|
+
function getReviewTargetFiles(target) {
|
|
669
|
+
const output = runGitCommand(buildReviewTargetFileArgs(target), {
|
|
670
|
+
allowFailure: true
|
|
671
|
+
});
|
|
672
|
+
return output.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
673
|
+
}
|
|
674
|
+
function createWorkingTreeReviewOption(kind) {
|
|
675
|
+
const files = getReviewTargetFiles({
|
|
676
|
+
hash: kind,
|
|
677
|
+
kind});
|
|
678
|
+
const subject = kind === "unstaged" ? "\uC544\uC9C1 git add \uD558\uC9C0 \uC54A\uC740 \uBCC0\uACBD\uC0AC\uD56D" : "git add \uB41C \uBCC0\uACBD\uC0AC\uD56D";
|
|
679
|
+
return {
|
|
680
|
+
author: "",
|
|
681
|
+
description: `${subject} | ${formatReviewTargetFileCount(files.length)}`,
|
|
682
|
+
hash: kind,
|
|
683
|
+
kind,
|
|
684
|
+
label: kind,
|
|
685
|
+
relativeDate: "",
|
|
686
|
+
subject
|
|
687
|
+
};
|
|
688
|
+
}
|
|
597
689
|
function getRecentCommitOptions() {
|
|
598
690
|
const output = runGitCommand(
|
|
599
691
|
["log", `-${COMMIT_FETCH_LIMIT}`, "--date=relative", "--pretty=format:%h%x09%an%x09%ar%x09%s"],
|
|
@@ -609,62 +701,61 @@ function getRecentCommitOptions() {
|
|
|
609
701
|
author,
|
|
610
702
|
description: `${author} | ${relativeDate}`,
|
|
611
703
|
hash,
|
|
704
|
+
kind: "commit",
|
|
612
705
|
label: `${hash} | ${truncateCommitSubject(subject)}`,
|
|
613
706
|
relativeDate,
|
|
614
707
|
subject
|
|
615
708
|
};
|
|
616
709
|
});
|
|
617
710
|
}
|
|
711
|
+
function getReviewTargetOptions() {
|
|
712
|
+
return [createWorkingTreeReviewOption("unstaged"), createWorkingTreeReviewOption("staged"), ...getRecentCommitOptions()];
|
|
713
|
+
}
|
|
618
714
|
function buildSelectedCommitSummary(commits) {
|
|
619
|
-
return commits.map((commit) =>
|
|
715
|
+
return commits.map((commit) => buildReviewTargetSummaryLine(commit)).join("\n");
|
|
620
716
|
}
|
|
621
717
|
function getReviewPathspecArgs() {
|
|
622
718
|
const { includePatterns, excludePatterns } = getGitDiffPathspecs();
|
|
623
719
|
return [...includePatterns, ...excludePatterns];
|
|
624
720
|
}
|
|
625
721
|
function buildSelectedCommitDiff(commits) {
|
|
626
|
-
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
627
722
|
const sections = commits.map((commit) => {
|
|
628
|
-
const diff = runGitCommand(
|
|
723
|
+
const diff = runGitCommand(buildReviewTargetDiffArgs(commit), {
|
|
629
724
|
allowFailure: true,
|
|
630
725
|
trimOutput: false
|
|
631
726
|
}).trim();
|
|
632
727
|
if (!diff) {
|
|
633
728
|
return "";
|
|
634
729
|
}
|
|
635
|
-
return [`## ${commit
|
|
730
|
+
return [`## ${buildReviewTargetSectionTitle(commit)}`, diff].join("\n\n");
|
|
636
731
|
}).filter(Boolean).join("\n\n");
|
|
637
732
|
if (!sections) {
|
|
638
733
|
return "";
|
|
639
734
|
}
|
|
640
|
-
return ["# \uC120\uD0DD\uD55C \
|
|
735
|
+
return ["# \uC120\uD0DD\uD55C \uB9AC\uBDF0 \uB300\uC0C1", buildSelectedCommitSummary(commits), "", "# \uB9AC\uBDF0 \uB300\uC0C1 diff", sections].join("\n");
|
|
641
736
|
}
|
|
642
737
|
function getSelectedCommitFiles(commits) {
|
|
643
|
-
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
644
738
|
const files = /* @__PURE__ */ new Set();
|
|
645
739
|
commits.forEach((commit) => {
|
|
646
|
-
|
|
647
|
-
allowFailure: true
|
|
648
|
-
});
|
|
649
|
-
output.split("\n").map((line) => line.trim()).filter(Boolean).forEach((filePath) => files.add(filePath));
|
|
740
|
+
getReviewTargetFiles(commit).forEach((filePath) => files.add(filePath));
|
|
650
741
|
});
|
|
651
742
|
return [...files];
|
|
652
743
|
}
|
|
653
744
|
function buildSelectedFileDiff(commits, filePath) {
|
|
654
745
|
const sections = commits.map((commit) => {
|
|
655
|
-
const diff = runGitCommand(
|
|
746
|
+
const diff = runGitCommand(buildReviewTargetDiffArgs(commit, filePath), {
|
|
656
747
|
allowFailure: true,
|
|
657
748
|
trimOutput: false
|
|
658
749
|
}).trim();
|
|
659
750
|
if (!diff) {
|
|
660
751
|
return "";
|
|
661
752
|
}
|
|
662
|
-
return [`## ${commit
|
|
753
|
+
return [`## ${buildReviewTargetSectionTitle(commit)}`, diff].join("\n\n");
|
|
663
754
|
}).filter(Boolean).join("\n\n");
|
|
664
755
|
if (!sections) {
|
|
665
756
|
return "";
|
|
666
757
|
}
|
|
667
|
-
return ["# \uC120\uD0DD\uD55C \
|
|
758
|
+
return ["# \uC120\uD0DD\uD55C \uB9AC\uBDF0 \uB300\uC0C1", buildSelectedCommitSummary(commits), "", `# \uD30C\uC77C: ${filePath}`, sections].join("\n\n");
|
|
668
759
|
}
|
|
669
760
|
function openReport(reportPath) {
|
|
670
761
|
const resolvedPath = path.resolve(reportPath);
|
|
@@ -850,13 +941,13 @@ async function showMultiSelect(question, options, windowSize = COMMIT_SELECTION_
|
|
|
850
941
|
});
|
|
851
942
|
}
|
|
852
943
|
async function selectReviewCommits() {
|
|
853
|
-
const commits =
|
|
944
|
+
const commits = getReviewTargetOptions();
|
|
854
945
|
if (commits.length === 0) {
|
|
855
|
-
console.log("\u2139\uFE0F \uB9AC\uBDF0\uD560 \
|
|
946
|
+
console.log("\u2139\uFE0F \uB9AC\uBDF0\uD560 \uB300\uC0C1\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
856
947
|
return [];
|
|
857
948
|
}
|
|
858
949
|
return showMultiSelect(
|
|
859
|
-
"\uB9AC\uBDF0\uD560 \
|
|
950
|
+
"\uB9AC\uBDF0\uD560 \uB300\uC0C1\uC744 \uC120\uD0DD\uD574\uC8FC\uC138\uC694.",
|
|
860
951
|
commits.map((commit) => ({
|
|
861
952
|
description: commit.description,
|
|
862
953
|
label: commit.label,
|