pi-pr-review 1.10.6 → 1.10.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.10.7](https://github.com/10ego/pi-pr-review/compare/v1.10.6...v1.10.7) (2026-07-17)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **publish:** auto-heal a Markdown-fenced review JSON object ([#37](https://github.com/10ego/pi-pr-review/issues/37)) ([9ecdd05](https://github.com/10ego/pi-pr-review/commit/9ecdd05e8f00b56176c52f5ca50fcf55698bd2b8))
9
+
3
10
  ## [1.10.6](https://github.com/10ego/pi-pr-review/compare/v1.10.5...v1.10.6) (2026-07-17)
4
11
 
5
12
 
@@ -619,11 +619,26 @@ function isConfidence(value: unknown): value is number {
619
619
  return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
620
620
  }
621
621
 
622
- /** Publication accepts only one complete JSON object, never fenced/prose-wrapped drafts. */
622
+ /**
623
+ * Strip a single surrounding Markdown fenced code block (```lang … ```) so a model
624
+ * response that wraps the review object in a code fence — despite the instruction
625
+ * to emit exactly one JSON object — can still be parsed without a repair round-trip.
626
+ * Prose-wrapped or mixed drafts are intentionally left untouched (still rejected).
627
+ * Returns the original text when there is no recognizable outer fence.
628
+ */
629
+ function stripMarkdownCodeFence(text: string): string {
630
+ const match = text.trim().match(/^```[^\n]*\n([\s\S]*)\n```[ \t]*$/);
631
+ return match ? match[1] : text;
632
+ }
633
+
634
+ /**
635
+ * Publication accepts one complete JSON object. A single surrounding Markdown code
636
+ * fence is tolerated and stripped; prose-wrapped or partial drafts are rejected.
637
+ */
623
638
  export function parsePublishableReview(text: string): PublishableReviewParseResult {
624
639
  let value: unknown;
625
640
  try {
626
- value = JSON.parse(text.trim());
641
+ value = JSON.parse(stripMarkdownCodeFence(text).trim());
627
642
  } catch {
628
643
  return { error: "final response is not exactly one JSON object" };
629
644
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-pr-review",
3
- "version": "1.10.6",
3
+ "version": "1.10.7",
4
4
  "description": "Parallel AI code review for GitHub pull requests in the Pi coding agent, with model-agnostic tiered subagents, structured findings, optional verification, and safe COMMENT-only publishing.",
5
5
  "keywords": [
6
6
  "pi-package",