codeep 1.1.19 → 1.1.20

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.
@@ -393,7 +393,11 @@ export declare class App {
393
393
  */
394
394
  private formatMessage;
395
395
  /**
396
- * Format plain text lines
396
+ * Apply inline markdown formatting (bold, italic, inline code) to a line
397
+ */
398
+ private applyInlineMarkdown;
399
+ /**
400
+ * Format plain text lines with markdown support
397
401
  */
398
402
  private formatTextLines;
399
403
  /**
@@ -2385,7 +2385,64 @@ export class App {
2385
2385
  return lines;
2386
2386
  }
2387
2387
  /**
2388
- * Format plain text lines
2388
+ * Apply inline markdown formatting (bold, italic, inline code) to a line
2389
+ */
2390
+ applyInlineMarkdown(text) {
2391
+ let result = '';
2392
+ let hasFormatting = false;
2393
+ let i = 0;
2394
+ while (i < text.length) {
2395
+ // Inline code: `code`
2396
+ if (text[i] === '`' && text[i + 1] !== '`') {
2397
+ const end = text.indexOf('`', i + 1);
2398
+ if (end !== -1) {
2399
+ const code = text.slice(i + 1, end);
2400
+ result += fg.rgb(209, 154, 102) + code + '\x1b[0m';
2401
+ hasFormatting = true;
2402
+ i = end + 1;
2403
+ continue;
2404
+ }
2405
+ }
2406
+ // Bold + italic: ***text***
2407
+ if (text.slice(i, i + 3) === '***') {
2408
+ const end = text.indexOf('***', i + 3);
2409
+ if (end !== -1) {
2410
+ const inner = text.slice(i + 3, end);
2411
+ result += style.bold + style.italic + fg.white + inner + '\x1b[0m';
2412
+ hasFormatting = true;
2413
+ i = end + 3;
2414
+ continue;
2415
+ }
2416
+ }
2417
+ // Bold: **text**
2418
+ if (text.slice(i, i + 2) === '**') {
2419
+ const end = text.indexOf('**', i + 2);
2420
+ if (end !== -1) {
2421
+ const inner = text.slice(i + 2, end);
2422
+ result += style.bold + fg.white + inner + '\x1b[0m';
2423
+ hasFormatting = true;
2424
+ i = end + 2;
2425
+ continue;
2426
+ }
2427
+ }
2428
+ // Italic: *text*
2429
+ if (text[i] === '*' && text[i + 1] !== '*') {
2430
+ const end = text.indexOf('*', i + 1);
2431
+ if (end !== -1 && end > i + 1) {
2432
+ const inner = text.slice(i + 1, end);
2433
+ result += style.italic + inner + '\x1b[0m';
2434
+ hasFormatting = true;
2435
+ i = end + 1;
2436
+ continue;
2437
+ }
2438
+ }
2439
+ result += text[i];
2440
+ i++;
2441
+ }
2442
+ return { formatted: result, hasFormatting };
2443
+ }
2444
+ /**
2445
+ * Format plain text lines with markdown support
2389
2446
  */
2390
2447
  formatTextLines(text, maxWidth, firstPrefix, firstStyle) {
2391
2448
  const lines = [];
@@ -2394,21 +2451,79 @@ export class App {
2394
2451
  const line = contentLines[i];
2395
2452
  const prefix = i === 0 ? firstPrefix : ' ';
2396
2453
  const prefixStyle = i === 0 ? firstStyle : '';
2397
- if (line.length > maxWidth - prefix.length) {
2398
- const wrapped = this.wordWrap(line, maxWidth - prefix.length);
2399
- for (let j = 0; j < wrapped.length; j++) {
2454
+ // Heading: ## or ### etc.
2455
+ const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
2456
+ if (headingMatch) {
2457
+ const level = headingMatch[1].length;
2458
+ const headingText = headingMatch[2];
2459
+ const headingColor = level <= 2 ? fg.rgb(97, 175, 239) : fg.rgb(198, 120, 221);
2460
+ lines.push({
2461
+ text: prefix + headingColor + style.bold + headingText + '\x1b[0m',
2462
+ style: prefixStyle,
2463
+ raw: true,
2464
+ });
2465
+ continue;
2466
+ }
2467
+ // Horizontal rule: --- or *** or ___
2468
+ if (/^[-*_]{3,}\s*$/.test(line)) {
2469
+ const ruleWidth = Math.min(maxWidth - 4, 40);
2470
+ lines.push({
2471
+ text: prefix + fg.gray + '─'.repeat(ruleWidth) + '\x1b[0m',
2472
+ style: prefixStyle,
2473
+ raw: true,
2474
+ });
2475
+ continue;
2476
+ }
2477
+ // List items: - item or * item or numbered 1. item
2478
+ const listMatch = line.match(/^(\s*)([-*]|\d+\.)\s+(.+)$/);
2479
+ if (listMatch) {
2480
+ const indent = listMatch[1];
2481
+ const bullet = listMatch[2];
2482
+ const content = listMatch[3];
2483
+ const { formatted, hasFormatting } = this.applyInlineMarkdown(content);
2484
+ const bulletChar = bullet === '-' || bullet === '*' ? '•' : bullet;
2485
+ if (hasFormatting) {
2486
+ lines.push({
2487
+ text: prefix + indent + fg.gray + bulletChar + '\x1b[0m' + ' ' + formatted,
2488
+ style: prefixStyle,
2489
+ raw: true,
2490
+ });
2491
+ }
2492
+ else {
2400
2493
  lines.push({
2401
- text: (j === 0 ? prefix : ' ') + wrapped[j],
2402
- style: j === 0 ? prefixStyle : '',
2494
+ text: prefix + indent + bulletChar + ' ' + content,
2495
+ style: prefixStyle,
2403
2496
  });
2404
2497
  }
2498
+ continue;
2405
2499
  }
2406
- else {
2500
+ // Regular text with possible inline markdown
2501
+ const { formatted, hasFormatting } = this.applyInlineMarkdown(line);
2502
+ if (hasFormatting) {
2407
2503
  lines.push({
2408
- text: prefix + line,
2504
+ text: prefix + formatted,
2409
2505
  style: prefixStyle,
2506
+ raw: true,
2410
2507
  });
2411
2508
  }
2509
+ else {
2510
+ // Plain text - word wrap as before
2511
+ if (line.length > maxWidth - prefix.length) {
2512
+ const wrapped = this.wordWrap(line, maxWidth - prefix.length);
2513
+ for (let j = 0; j < wrapped.length; j++) {
2514
+ lines.push({
2515
+ text: (j === 0 ? prefix : ' ') + wrapped[j],
2516
+ style: j === 0 ? prefixStyle : '',
2517
+ });
2518
+ }
2519
+ }
2520
+ else {
2521
+ lines.push({
2522
+ text: prefix + line,
2523
+ style: prefixStyle,
2524
+ });
2525
+ }
2526
+ }
2412
2527
  }
2413
2528
  return lines;
2414
2529
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.1.19",
3
+ "version": "1.1.20",
4
4
  "description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",