@klitchevo/code-council 0.1.4 → 0.2.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.
@@ -800,6 +800,30 @@ var gitReviewSchemaObj = z.object({
800
800
  output_format: z.enum(["markdown", "json", "html", "pr-comments"]).optional().describe("Output format for the review (default: markdown)")
801
801
  });
802
802
  var gitReviewSchema = gitReviewSchemaObj.shape;
803
+ function getBaseRef() {
804
+ const githubBaseRef = process.env.GITHUB_BASE_REF;
805
+ if (githubBaseRef) {
806
+ logger.debug("Using GITHUB_BASE_REF", { ref: githubBaseRef });
807
+ return `origin/${githubBaseRef}`;
808
+ }
809
+ try {
810
+ execSync("git rev-parse --verify main", {
811
+ encoding: "utf-8",
812
+ stdio: "pipe"
813
+ });
814
+ return "main";
815
+ } catch {
816
+ try {
817
+ execSync("git rev-parse --verify origin/main", {
818
+ encoding: "utf-8",
819
+ stdio: "pipe"
820
+ });
821
+ return "origin/main";
822
+ } catch {
823
+ return "main";
824
+ }
825
+ }
826
+ }
803
827
  function getGitDiff(reviewType = "staged", commitHash) {
804
828
  try {
805
829
  let command;
@@ -810,9 +834,11 @@ function getGitDiff(reviewType = "staged", commitHash) {
810
834
  case "unstaged":
811
835
  command = "git diff";
812
836
  break;
813
- case "diff":
814
- command = "git diff main..HEAD";
837
+ case "diff": {
838
+ const baseRef = getBaseRef();
839
+ command = `git diff ${baseRef}..HEAD`;
815
840
  break;
841
+ }
816
842
  case "commit":
817
843
  if (!commitHash) {
818
844
  throw new Error(
@@ -903,6 +929,7 @@ You MUST respond with valid JSON matching this schema:
903
929
  "endLine": 45
904
930
  },
905
931
  "suggestion": "How to fix or improve",
932
+ "suggestedCode": "The actual corrected code that should replace the problematic code (if applicable)",
906
933
  "rawExcerpt": "The original text from the review that describes this finding",
907
934
  "confidence": 0.95
908
935
  }
@@ -930,6 +957,7 @@ ${Object.entries(SEVERITY_DESCRIPTIONS).map(([sev, desc]) => `- **${sev}**: ${de
930
957
  5. **Set confidence**: Higher (0.8-1.0) for clear, explicit issues; lower (0.5-0.7) for inferred or ambiguous ones
931
958
  6. **Don't duplicate**: Each distinct issue should appear once
932
959
  7. **Handle empty reviews**: If no issues found, return {"findings": []}
960
+ 8. **Include code fixes**: When a fix involves specific code changes, provide the actual corrected code in the suggestedCode field (not explanation, just the code)
933
961
 
934
962
  ## Important
935
963
 
@@ -1038,6 +1066,7 @@ var ExtractionResponseSchema = z2.object({
1038
1066
  endLine: z2.number().optional()
1039
1067
  }).optional(),
1040
1068
  suggestion: z2.string().optional(),
1069
+ suggestedCode: z2.string().optional(),
1041
1070
  rawExcerpt: z2.string(),
1042
1071
  confidence: z2.number().min(0).max(1).optional()
1043
1072
  })
@@ -1150,6 +1179,7 @@ function parseExtractionResponse(responseText, sourceModel) {
1150
1179
  endLine: f.location.endLine
1151
1180
  } : void 0,
1152
1181
  suggestion: f.suggestion,
1182
+ suggestedCode: f.suggestedCode,
1153
1183
  rawExcerpt: f.rawExcerpt,
1154
1184
  extractedAt: now,
1155
1185
  confidence: f.confidence
@@ -2191,4 +2221,4 @@ export {
2191
2221
  gitReviewSchema,
2192
2222
  handleGitReview
2193
2223
  };
2194
- //# sourceMappingURL=chunk-GKJH5C6Z.js.map
2224
+ //# sourceMappingURL=chunk-YWK4IFSW.js.map
@@ -5,7 +5,7 @@ import {
5
5
  formatForHostExtraction,
6
6
  handleGitReview,
7
7
  initializeConfig
8
- } from "./chunk-GKJH5C6Z.js";
8
+ } from "./chunk-YWK4IFSW.js";
9
9
  import "./chunk-IVKLQD6M.js";
10
10
  import "./chunk-SYMFCPGM.js";
11
11
  import {
@@ -214,7 +214,11 @@ function formatCommentBody(cluster, showModelAgreement) {
214
214
  lines.push(firstFinding.description);
215
215
  lines.push("");
216
216
  }
217
- if (firstFinding?.suggestion) {
217
+ if (firstFinding?.suggestedCode) {
218
+ lines.push("```suggestion");
219
+ lines.push(firstFinding.suggestedCode);
220
+ lines.push("```");
221
+ } else if (firstFinding?.suggestion) {
218
222
  lines.push(`**Suggestion:** ${firstFinding.suggestion}`);
219
223
  }
220
224
  return lines.join("\n").trim();
@@ -1044,4 +1048,4 @@ export {
1044
1048
  processResult,
1045
1049
  runCli
1046
1050
  };
1047
- //# sourceMappingURL=cli-GQR62DBS.js.map
1051
+ //# sourceMappingURL=cli-223AZHWH.js.map
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  handleGitReview,
19
19
  initializeConfig,
20
20
  logger
21
- } from "./chunk-GKJH5C6Z.js";
21
+ } from "./chunk-YWK4IFSW.js";
22
22
  import "./chunk-IVKLQD6M.js";
23
23
  import "./chunk-SYMFCPGM.js";
24
24
  import {
@@ -1906,7 +1906,7 @@ ${r.review}
1906
1906
  var args = process.argv.slice(2);
1907
1907
  var command = args[0];
1908
1908
  if (command === "review" || command === "setup") {
1909
- import("./cli-GQR62DBS.js").then(async ({ processResult, runCli }) => {
1909
+ import("./cli-223AZHWH.js").then(async ({ processResult, runCli }) => {
1910
1910
  try {
1911
1911
  const result = await runCli(process.argv);
1912
1912
  if (result) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klitchevo/code-council",
3
- "version": "0.1.4",
3
+ "version": "0.2.1",
4
4
  "description": "Multi-model AI code review server using OpenRouter - get diverse perspectives from multiple LLMs in parallel",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",