limn-review 0.1.142 → 0.1.143

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.
@@ -222,14 +222,32 @@ export function liftBlockMessage(by = 'Claude') {
222
222
  return `${by}'s blocking findings are fixed.`;
223
223
  }
224
224
  export const LIFT_BLOCK_MESSAGE = liftBlockMessage('Claude');
225
- /** The review body's lead: the summary's first plain sentence, else a count. `by` names the provider
226
- * that ran the review (default Claude — its text is unchanged). */
225
+ // The lead's ceiling. A summary's first paragraph is normally far shorter; past this it is cut at the
226
+ // last sentence end that fits, never mid-sentence (GitHub allows 65,536 characters in a review body).
227
+ const LEAD_MAX_CHARS = 3_000;
228
+ /** Cut `text` to ≤ `max` characters at the last sentence end that fits; failing that, at the last space
229
+ * (with "…"). Text that fits is returned whole. */
230
+ export function clipAtSentence(text, max = LEAD_MAX_CHARS) {
231
+ if (text.length <= max)
232
+ return text;
233
+ const head = text.slice(0, max);
234
+ let cut = -1;
235
+ for (const m of head.matchAll(/[.!?](?=\s)/g))
236
+ cut = m.index;
237
+ if (cut > 0)
238
+ return head.slice(0, cut + 1);
239
+ const space = head.slice(0, max - 1).lastIndexOf(' ');
240
+ return `${head.slice(0, space > 0 ? space : max - 1)}…`;
241
+ }
242
+ /** The review body's lead: the summary's first plain paragraph (whole, unless it passes
243
+ * LEAD_MAX_CHARS), else a count. `by` names the provider that ran the review (default Claude — its
244
+ * text is unchanged). */
227
245
  export function autoReviewBodyLead(summary, commentCount, by = 'Claude') {
228
246
  for (const raw of (summary ?? '').split('\n')) {
229
247
  const line = raw.trim();
230
248
  if (line === '' || /^([-*+]|\d+[.)])\s/.test(line) || line.startsWith('#'))
231
249
  continue;
232
- return line.length > 400 ? `${line.slice(0, 399)}…` : line;
250
+ return clipAtSentence(line);
233
251
  }
234
252
  if (commentCount === 0)
235
253
  return `Reviewed by ${by}.`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "limn-review",
3
- "version": "0.1.142",
3
+ "version": "0.1.143",
4
4
  "description": "Dashboard for tracking your team's GitHub PR activity across repos. Runs on your machine with your gh login.",
5
5
  "type": "module",
6
6
  "author": "Alex Wakeman",