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.
@@ -506,6 +506,62 @@ function truncateCommitSubject(subject) {
506
506
  }
507
507
  return `${subject.slice(0, 69)}...`;
508
508
  }
509
+ function formatReviewTargetFileCount(fileCount) {
510
+ return fileCount === 0 ? "\uBCC0\uACBD \uC5C6\uC74C" : `${fileCount}\uAC1C \uD30C\uC77C`;
511
+ }
512
+ function buildReviewTargetSectionTitle(target) {
513
+ return target.kind === "commit" ? `${target.hash} ${target.subject}` : `${target.hash} | ${target.subject}`;
514
+ }
515
+ function buildReviewTargetSummaryLine(target) {
516
+ if (target.kind === "commit") {
517
+ return `- ${target.hash} | ${target.subject} | ${target.author} | ${target.relativeDate}`;
518
+ }
519
+ return `- ${target.hash} | ${target.subject}`;
520
+ }
521
+ function buildReviewTargetDiffArgs(target, filePath) {
522
+ const reviewPathspecArgs = getReviewPathspecArgs();
523
+ if (target.kind === "commit") {
524
+ return filePath ? ["show", "--stat", "--patch", "--format=", target.hash, "--", filePath] : ["show", "--stat", "--patch", "--format=", target.hash, "--", ...reviewPathspecArgs];
525
+ }
526
+ const diffArgs = ["diff"];
527
+ if (target.kind === "staged") {
528
+ diffArgs.push("--cached");
529
+ }
530
+ diffArgs.push("--stat", "--patch", "--");
531
+ return filePath ? [...diffArgs, filePath] : [...diffArgs, ...reviewPathspecArgs];
532
+ }
533
+ function buildReviewTargetFileArgs(target) {
534
+ const reviewPathspecArgs = getReviewPathspecArgs();
535
+ if (target.kind === "commit") {
536
+ return ["show", "--pretty=format:", "--name-only", target.hash, "--", ...reviewPathspecArgs];
537
+ }
538
+ const diffArgs = ["diff"];
539
+ if (target.kind === "staged") {
540
+ diffArgs.push("--cached");
541
+ }
542
+ return [...diffArgs, "--name-only", "--", ...reviewPathspecArgs];
543
+ }
544
+ function getReviewTargetFiles(target) {
545
+ const output = runGitCommand(buildReviewTargetFileArgs(target), {
546
+ allowFailure: true
547
+ });
548
+ return output.split("\n").map((line) => line.trim()).filter(Boolean);
549
+ }
550
+ function createWorkingTreeReviewOption(kind) {
551
+ const files = getReviewTargetFiles({
552
+ hash: kind,
553
+ kind});
554
+ const subject = kind === "unstaged" ? "\uC544\uC9C1 git add \uD558\uC9C0 \uC54A\uC740 \uBCC0\uACBD\uC0AC\uD56D" : "git add \uB41C \uBCC0\uACBD\uC0AC\uD56D";
555
+ return {
556
+ author: "",
557
+ description: `${subject} | ${formatReviewTargetFileCount(files.length)}`,
558
+ hash: kind,
559
+ kind,
560
+ label: kind,
561
+ relativeDate: "",
562
+ subject
563
+ };
564
+ }
509
565
  function getRecentCommitOptions() {
510
566
  const output = runGitCommand(
511
567
  ["log", `-${COMMIT_FETCH_LIMIT}`, "--date=relative", "--pretty=format:%h%x09%an%x09%ar%x09%s"],
@@ -521,62 +577,61 @@ function getRecentCommitOptions() {
521
577
  author,
522
578
  description: `${author} | ${relativeDate}`,
523
579
  hash,
580
+ kind: "commit",
524
581
  label: `${hash} | ${truncateCommitSubject(subject)}`,
525
582
  relativeDate,
526
583
  subject
527
584
  };
528
585
  });
529
586
  }
587
+ function getReviewTargetOptions() {
588
+ return [createWorkingTreeReviewOption("unstaged"), createWorkingTreeReviewOption("staged"), ...getRecentCommitOptions()];
589
+ }
530
590
  function buildSelectedCommitSummary(commits) {
531
- return commits.map((commit) => `- ${commit.hash} | ${commit.subject} | ${commit.author} | ${commit.relativeDate}`).join("\n");
591
+ return commits.map((commit) => buildReviewTargetSummaryLine(commit)).join("\n");
532
592
  }
533
593
  function getReviewPathspecArgs() {
534
594
  const { includePatterns, excludePatterns } = getGitDiffPathspecs();
535
595
  return [...includePatterns, ...excludePatterns];
536
596
  }
537
597
  function buildSelectedCommitDiff(commits) {
538
- const reviewPathspecArgs = getReviewPathspecArgs();
539
598
  const sections = commits.map((commit) => {
540
- const diff = runGitCommand(["show", "--stat", "--patch", "--format=", commit.hash, "--", ...reviewPathspecArgs], {
599
+ const diff = runGitCommand(buildReviewTargetDiffArgs(commit), {
541
600
  allowFailure: true,
542
601
  trimOutput: false
543
602
  }).trim();
544
603
  if (!diff) {
545
604
  return "";
546
605
  }
547
- return [`## ${commit.hash} ${commit.subject}`, diff].join("\n\n");
606
+ return [`## ${buildReviewTargetSectionTitle(commit)}`, diff].join("\n\n");
548
607
  }).filter(Boolean).join("\n\n");
549
608
  if (!sections) {
550
609
  return "";
551
610
  }
552
- return ["# \uC120\uD0DD\uD55C \uCEE4\uBC0B", buildSelectedCommitSummary(commits), "", "# \uB9AC\uBDF0 \uB300\uC0C1 diff", sections].join("\n");
611
+ return ["# \uC120\uD0DD\uD55C \uB9AC\uBDF0 \uB300\uC0C1", buildSelectedCommitSummary(commits), "", "# \uB9AC\uBDF0 \uB300\uC0C1 diff", sections].join("\n");
553
612
  }
554
613
  function getSelectedCommitFiles(commits) {
555
- const reviewPathspecArgs = getReviewPathspecArgs();
556
614
  const files = /* @__PURE__ */ new Set();
557
615
  commits.forEach((commit) => {
558
- const output = runGitCommand(["show", "--pretty=format:", "--name-only", commit.hash, "--", ...reviewPathspecArgs], {
559
- allowFailure: true
560
- });
561
- output.split("\n").map((line) => line.trim()).filter(Boolean).forEach((filePath) => files.add(filePath));
616
+ getReviewTargetFiles(commit).forEach((filePath) => files.add(filePath));
562
617
  });
563
618
  return [...files];
564
619
  }
565
620
  function buildSelectedFileDiff(commits, filePath) {
566
621
  const sections = commits.map((commit) => {
567
- const diff = runGitCommand(["show", "--stat", "--patch", "--format=", commit.hash, "--", filePath], {
622
+ const diff = runGitCommand(buildReviewTargetDiffArgs(commit, filePath), {
568
623
  allowFailure: true,
569
624
  trimOutput: false
570
625
  }).trim();
571
626
  if (!diff) {
572
627
  return "";
573
628
  }
574
- return [`## ${commit.hash} ${commit.subject}`, diff].join("\n\n");
629
+ return [`## ${buildReviewTargetSectionTitle(commit)}`, diff].join("\n\n");
575
630
  }).filter(Boolean).join("\n\n");
576
631
  if (!sections) {
577
632
  return "";
578
633
  }
579
- return ["# \uC120\uD0DD\uD55C \uCEE4\uBC0B", buildSelectedCommitSummary(commits), "", `# \uD30C\uC77C: ${filePath}`, sections].join("\n\n");
634
+ return ["# \uC120\uD0DD\uD55C \uB9AC\uBDF0 \uB300\uC0C1", buildSelectedCommitSummary(commits), "", `# \uD30C\uC77C: ${filePath}`, sections].join("\n\n");
580
635
  }
581
636
  function openReport(reportPath) {
582
637
  const resolvedPath = path.resolve(reportPath);
@@ -762,13 +817,13 @@ async function showMultiSelect(question, options, windowSize = COMMIT_SELECTION_
762
817
  });
763
818
  }
764
819
  async function selectReviewCommits() {
765
- const commits = getRecentCommitOptions();
820
+ const commits = getReviewTargetOptions();
766
821
  if (commits.length === 0) {
767
- console.log("\u2139\uFE0F \uB9AC\uBDF0\uD560 \uCD5C\uADFC \uCEE4\uBC0B\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
822
+ console.log("\u2139\uFE0F \uB9AC\uBDF0\uD560 \uB300\uC0C1\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
768
823
  return [];
769
824
  }
770
825
  return showMultiSelect(
771
- "\uB9AC\uBDF0\uD560 \uCEE4\uBC0B\uC744 \uC120\uD0DD\uD574\uC8FC\uC138\uC694.",
826
+ "\uB9AC\uBDF0\uD560 \uB300\uC0C1\uC744 \uC120\uD0DD\uD574\uC8FC\uC138\uC694.",
772
827
  commits.map((commit) => ({
773
828
  description: commit.description,
774
829
  label: commit.label,
@@ -1431,8 +1486,8 @@ async function main() {
1431
1486
  trace7("commit-selection:done", `count=${selectedCommits.length}`);
1432
1487
  if (selectedCommits.length === 0) {
1433
1488
  trace7("commit-selection:empty");
1434
- executionTitle = "\uC120\uD0DD\uB41C \uCEE4\uBC0B\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.";
1435
- console.log("\u2139\uFE0F \uC120\uD0DD\uB41C \uCEE4\uBC0B\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
1489
+ executionTitle = "\uC120\uD0DD\uB41C \uB9AC\uBDF0 \uB300\uC0C1\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.";
1490
+ console.log("\u2139\uFE0F \uC120\uD0DD\uB41C \uB9AC\uBDF0 \uB300\uC0C1\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
1436
1491
  deleteTempDiff();
1437
1492
  return;
1438
1493
  }
@@ -1445,8 +1500,8 @@ async function main() {
1445
1500
  console.log(`\u{1F4C2} \uB9AC\uBDF0 \uB300\uC0C1 \uD30C\uC77C(${fileList.length}\uAC1C): ${formatReviewTargetFiles(fileList)}`);
1446
1501
  if (fileList.length === 0) {
1447
1502
  trace7("empty-file-list:exit");
1448
- executionTitle = "\uC120\uD0DD\uD55C \uCEE4\uBC0B\uC5D0\uC11C \uB9AC\uBDF0 \uB300\uC0C1 \uD30C\uC77C \uBCC0\uACBD\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.";
1449
- console.log("\u2139\uFE0F \uC120\uD0DD\uD55C \uCEE4\uBC0B\uC5D0\uC11C \uB9AC\uBDF0 \uB300\uC0C1 \uD30C\uC77C \uBCC0\uACBD\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.");
1503
+ executionTitle = "\uC120\uD0DD\uD55C \uB9AC\uBDF0 \uB300\uC0C1\uC5D0\uC11C \uB9AC\uBDF0\uD560 \uBCC0\uACBD\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.";
1504
+ 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.");
1450
1505
  deleteTempDiff();
1451
1506
  return;
1452
1507
  }