diff --git a/package-lock.json b/package-lock.json index e877a2b..b6e6693 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "github-mobile-reader", - "version": "0.1.13", + "version": "0.1.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "github-mobile-reader", - "version": "0.1.13", + "version": "0.1.14", "license": "MIT", "devDependencies": { "@types/node": "^20.0.0", diff --git a/package.json b/package.json index 8176b35..a162a02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-mobile-reader", - "version": "0.1.13", + "version": "0.1.14", "description": "Transform git diffs into mobile-friendly Markdown — no more horizontal scrolling when reviewing code on your phone.", "keywords": [ "github", diff --git a/src/cli.ts b/src/cli.ts index 2c49ce9..c2ff05a 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -215,7 +215,11 @@ async function processPR( // AI summary (opt-in — only when geminiKey is provided) if (geminiKey) { const summary = await summarizeWithGemini(filename, diff, geminiKey); - if (summary) sections.push(`> 💡 ${summary}\n`); + if (summary) { + const lines = summary.split('\n').filter(l => l.trim()); + const quoted = lines.map((l, i) => i === 0 ? `> 💡 ${l}` : `> ${l}`).join('\n'); + sections.push(quoted + '\n'); + } } sections.push(body); diff --git a/src/parser.ts b/src/parser.ts index ecdb675..958014a 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -1047,8 +1047,10 @@ function buildBehaviorSummary(lines: string[], mode: "added" | "removed" = "adde const catchMatch = line.match(/^catch\s*\(\s*(\w+)\s*\)/); if (catchMatch) { tier2.push(`(catch) \`${catchMatch[1]}\``); continue; } - // ── Tier 3: Conditionals (non-guard) ──────────────────── - const condMatch = line.match(/^(if|else if)\s*\((.{1,60})\)/); + // ── Tier 3: Conditionals (non-guard) + // Only match `if (cond) {` or `if (cond)` at end of line — reject inline one-liners + // like `if (x) doSomething()` which produce garbled output + const condMatch = line.match(/^(if|else if)\s*\(([^)]{1,60})\)\s*\{?\s*$/); if (condMatch) { tier3.push(`(cond) \`${condMatch[2].trim()}\``); continue; } // ── Tier 4: useEffect ────────────────────────────────────