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.cjs
CHANGED
|
@@ -209,15 +209,51 @@ function runGitCommand(args, options = {}) {
|
|
|
209
209
|
throw error;
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
+
function resolveShellLaunchConfig() {
|
|
213
|
+
const candidates = [];
|
|
214
|
+
const seen = /* @__PURE__ */ new Set();
|
|
215
|
+
const appendCandidate = (executable, shellArgs) => {
|
|
216
|
+
const normalizedExecutable = executable?.trim();
|
|
217
|
+
if (!normalizedExecutable) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (path__default.default.isAbsolute(normalizedExecutable) && !fs__default.default.existsSync(normalizedExecutable)) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const key = `${normalizedExecutable}::${shellArgs.join("\0")}`;
|
|
224
|
+
if (seen.has(key)) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
seen.add(key);
|
|
228
|
+
candidates.push({
|
|
229
|
+
executable: normalizedExecutable,
|
|
230
|
+
shellArgs
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
const shellFromEnv = process.env.SHELL?.trim();
|
|
234
|
+
const envShellName = shellFromEnv ? path__default.default.basename(shellFromEnv) : "";
|
|
235
|
+
if (["bash", "zsh", "ksh"].includes(envShellName)) {
|
|
236
|
+
appendCandidate(shellFromEnv, ["-lc"]);
|
|
237
|
+
}
|
|
238
|
+
["/bin/bash", "/usr/bin/bash", "bash", "/bin/zsh", "/usr/bin/zsh", "zsh"].forEach((shellPath) => {
|
|
239
|
+
appendCandidate(shellPath, ["-lc"]);
|
|
240
|
+
});
|
|
241
|
+
["/bin/sh", "/usr/bin/sh", "sh"].forEach((shellPath) => {
|
|
242
|
+
appendCandidate(shellPath, ["-c"]);
|
|
243
|
+
});
|
|
244
|
+
return candidates[0] || { executable: "sh", shellArgs: ["-c"] };
|
|
245
|
+
}
|
|
212
246
|
async function executeShellCommandWithProgress(command, options = {}) {
|
|
213
247
|
const { progressIntervalMs = 1e4, progressMessage = "\u23F3 \uBA85\uB839\uC744 \uC2E4\uD589\uD558\uB294 \uC911\uC785\uB2C8\uB2E4...", streamOutput = false } = options;
|
|
214
248
|
const { spawn } = await import('child_process');
|
|
249
|
+
const shellLaunchConfig = resolveShellLaunchConfig();
|
|
215
250
|
return new Promise((resolve, reject) => {
|
|
216
251
|
let stdout = "";
|
|
217
252
|
let stderr = "";
|
|
218
253
|
const startedAt = Date.now();
|
|
219
254
|
console.log(progressMessage);
|
|
220
|
-
|
|
255
|
+
helperTrace("shell-command:launcher", `${shellLaunchConfig.executable} ${shellLaunchConfig.shellArgs.join(" ")}`);
|
|
256
|
+
const child = spawn(shellLaunchConfig.executable, [...shellLaunchConfig.shellArgs, command], {
|
|
221
257
|
stdio: ["ignore", "pipe", "pipe"]
|
|
222
258
|
});
|
|
223
259
|
const progressTimer = setInterval(() => {
|
|
@@ -603,6 +639,62 @@ function truncateCommitSubject(subject) {
|
|
|
603
639
|
}
|
|
604
640
|
return `${subject.slice(0, 69)}...`;
|
|
605
641
|
}
|
|
642
|
+
function formatReviewTargetFileCount(fileCount) {
|
|
643
|
+
return fileCount === 0 ? "\uBCC0\uACBD \uC5C6\uC74C" : `${fileCount}\uAC1C \uD30C\uC77C`;
|
|
644
|
+
}
|
|
645
|
+
function buildReviewTargetSectionTitle(target) {
|
|
646
|
+
return target.kind === "commit" ? `${target.hash} ${target.subject}` : `${target.hash} | ${target.subject}`;
|
|
647
|
+
}
|
|
648
|
+
function buildReviewTargetSummaryLine(target) {
|
|
649
|
+
if (target.kind === "commit") {
|
|
650
|
+
return `- ${target.hash} | ${target.subject} | ${target.author} | ${target.relativeDate}`;
|
|
651
|
+
}
|
|
652
|
+
return `- ${target.hash} | ${target.subject}`;
|
|
653
|
+
}
|
|
654
|
+
function buildReviewTargetDiffArgs(target, filePath) {
|
|
655
|
+
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
656
|
+
if (target.kind === "commit") {
|
|
657
|
+
return filePath ? ["show", "--stat", "--patch", "--format=", target.hash, "--", filePath] : ["show", "--stat", "--patch", "--format=", target.hash, "--", ...reviewPathspecArgs];
|
|
658
|
+
}
|
|
659
|
+
const diffArgs = ["diff"];
|
|
660
|
+
if (target.kind === "staged") {
|
|
661
|
+
diffArgs.push("--cached");
|
|
662
|
+
}
|
|
663
|
+
diffArgs.push("--stat", "--patch", "--");
|
|
664
|
+
return filePath ? [...diffArgs, filePath] : [...diffArgs, ...reviewPathspecArgs];
|
|
665
|
+
}
|
|
666
|
+
function buildReviewTargetFileArgs(target) {
|
|
667
|
+
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
668
|
+
if (target.kind === "commit") {
|
|
669
|
+
return ["show", "--pretty=format:", "--name-only", target.hash, "--", ...reviewPathspecArgs];
|
|
670
|
+
}
|
|
671
|
+
const diffArgs = ["diff"];
|
|
672
|
+
if (target.kind === "staged") {
|
|
673
|
+
diffArgs.push("--cached");
|
|
674
|
+
}
|
|
675
|
+
return [...diffArgs, "--name-only", "--", ...reviewPathspecArgs];
|
|
676
|
+
}
|
|
677
|
+
function getReviewTargetFiles(target) {
|
|
678
|
+
const output = runGitCommand(buildReviewTargetFileArgs(target), {
|
|
679
|
+
allowFailure: true
|
|
680
|
+
});
|
|
681
|
+
return output.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
682
|
+
}
|
|
683
|
+
function createWorkingTreeReviewOption(kind) {
|
|
684
|
+
const files = getReviewTargetFiles({
|
|
685
|
+
hash: kind,
|
|
686
|
+
kind});
|
|
687
|
+
const subject = kind === "unstaged" ? "\uC544\uC9C1 git add \uD558\uC9C0 \uC54A\uC740 \uBCC0\uACBD\uC0AC\uD56D" : "git add \uB41C \uBCC0\uACBD\uC0AC\uD56D";
|
|
688
|
+
return {
|
|
689
|
+
author: "",
|
|
690
|
+
description: `${subject} | ${formatReviewTargetFileCount(files.length)}`,
|
|
691
|
+
hash: kind,
|
|
692
|
+
kind,
|
|
693
|
+
label: kind,
|
|
694
|
+
relativeDate: "",
|
|
695
|
+
subject
|
|
696
|
+
};
|
|
697
|
+
}
|
|
606
698
|
function getRecentCommitOptions() {
|
|
607
699
|
const output = runGitCommand(
|
|
608
700
|
["log", `-${COMMIT_FETCH_LIMIT}`, "--date=relative", "--pretty=format:%h%x09%an%x09%ar%x09%s"],
|
|
@@ -618,62 +710,61 @@ function getRecentCommitOptions() {
|
|
|
618
710
|
author,
|
|
619
711
|
description: `${author} | ${relativeDate}`,
|
|
620
712
|
hash,
|
|
713
|
+
kind: "commit",
|
|
621
714
|
label: `${hash} | ${truncateCommitSubject(subject)}`,
|
|
622
715
|
relativeDate,
|
|
623
716
|
subject
|
|
624
717
|
};
|
|
625
718
|
});
|
|
626
719
|
}
|
|
720
|
+
function getReviewTargetOptions() {
|
|
721
|
+
return [createWorkingTreeReviewOption("unstaged"), createWorkingTreeReviewOption("staged"), ...getRecentCommitOptions()];
|
|
722
|
+
}
|
|
627
723
|
function buildSelectedCommitSummary(commits) {
|
|
628
|
-
return commits.map((commit) =>
|
|
724
|
+
return commits.map((commit) => buildReviewTargetSummaryLine(commit)).join("\n");
|
|
629
725
|
}
|
|
630
726
|
function getReviewPathspecArgs() {
|
|
631
727
|
const { includePatterns, excludePatterns } = getGitDiffPathspecs();
|
|
632
728
|
return [...includePatterns, ...excludePatterns];
|
|
633
729
|
}
|
|
634
730
|
function buildSelectedCommitDiff(commits) {
|
|
635
|
-
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
636
731
|
const sections = commits.map((commit) => {
|
|
637
|
-
const diff = runGitCommand(
|
|
732
|
+
const diff = runGitCommand(buildReviewTargetDiffArgs(commit), {
|
|
638
733
|
allowFailure: true,
|
|
639
734
|
trimOutput: false
|
|
640
735
|
}).trim();
|
|
641
736
|
if (!diff) {
|
|
642
737
|
return "";
|
|
643
738
|
}
|
|
644
|
-
return [`## ${commit
|
|
739
|
+
return [`## ${buildReviewTargetSectionTitle(commit)}`, diff].join("\n\n");
|
|
645
740
|
}).filter(Boolean).join("\n\n");
|
|
646
741
|
if (!sections) {
|
|
647
742
|
return "";
|
|
648
743
|
}
|
|
649
|
-
return ["# \uC120\uD0DD\uD55C \
|
|
744
|
+
return ["# \uC120\uD0DD\uD55C \uB9AC\uBDF0 \uB300\uC0C1", buildSelectedCommitSummary(commits), "", "# \uB9AC\uBDF0 \uB300\uC0C1 diff", sections].join("\n");
|
|
650
745
|
}
|
|
651
746
|
function getSelectedCommitFiles(commits) {
|
|
652
|
-
const reviewPathspecArgs = getReviewPathspecArgs();
|
|
653
747
|
const files = /* @__PURE__ */ new Set();
|
|
654
748
|
commits.forEach((commit) => {
|
|
655
|
-
|
|
656
|
-
allowFailure: true
|
|
657
|
-
});
|
|
658
|
-
output.split("\n").map((line) => line.trim()).filter(Boolean).forEach((filePath) => files.add(filePath));
|
|
749
|
+
getReviewTargetFiles(commit).forEach((filePath) => files.add(filePath));
|
|
659
750
|
});
|
|
660
751
|
return [...files];
|
|
661
752
|
}
|
|
662
753
|
function buildSelectedFileDiff(commits, filePath) {
|
|
663
754
|
const sections = commits.map((commit) => {
|
|
664
|
-
const diff = runGitCommand(
|
|
755
|
+
const diff = runGitCommand(buildReviewTargetDiffArgs(commit, filePath), {
|
|
665
756
|
allowFailure: true,
|
|
666
757
|
trimOutput: false
|
|
667
758
|
}).trim();
|
|
668
759
|
if (!diff) {
|
|
669
760
|
return "";
|
|
670
761
|
}
|
|
671
|
-
return [`## ${commit
|
|
762
|
+
return [`## ${buildReviewTargetSectionTitle(commit)}`, diff].join("\n\n");
|
|
672
763
|
}).filter(Boolean).join("\n\n");
|
|
673
764
|
if (!sections) {
|
|
674
765
|
return "";
|
|
675
766
|
}
|
|
676
|
-
return ["# \uC120\uD0DD\uD55C \
|
|
767
|
+
return ["# \uC120\uD0DD\uD55C \uB9AC\uBDF0 \uB300\uC0C1", buildSelectedCommitSummary(commits), "", `# \uD30C\uC77C: ${filePath}`, sections].join("\n\n");
|
|
677
768
|
}
|
|
678
769
|
function openReport(reportPath) {
|
|
679
770
|
const resolvedPath = path__default.default.resolve(reportPath);
|
|
@@ -859,13 +950,13 @@ async function showMultiSelect(question, options, windowSize = COMMIT_SELECTION_
|
|
|
859
950
|
});
|
|
860
951
|
}
|
|
861
952
|
async function selectReviewCommits() {
|
|
862
|
-
const commits =
|
|
953
|
+
const commits = getReviewTargetOptions();
|
|
863
954
|
if (commits.length === 0) {
|
|
864
|
-
console.log("\u2139\uFE0F \uB9AC\uBDF0\uD560 \
|
|
955
|
+
console.log("\u2139\uFE0F \uB9AC\uBDF0\uD560 \uB300\uC0C1\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
865
956
|
return [];
|
|
866
957
|
}
|
|
867
958
|
return showMultiSelect(
|
|
868
|
-
"\uB9AC\uBDF0\uD560 \
|
|
959
|
+
"\uB9AC\uBDF0\uD560 \uB300\uC0C1\uC744 \uC120\uD0DD\uD574\uC8FC\uC138\uC694.",
|
|
869
960
|
commits.map((commit) => ({
|
|
870
961
|
description: commit.description,
|
|
871
962
|
label: commit.label,
|