codeep 1.2.80 → 1.2.82

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.
@@ -2139,40 +2139,46 @@ export class App {
2139
2139
  */
2140
2140
  formatMessage(role, content, maxWidth) {
2141
2141
  const lines = [];
2142
- const roleStyle = role === 'user' ? fg.green : role === 'assistant' ? PRIMARY_COLOR : fg.yellow;
2143
- const roleLabel = role === 'user' ? '> ' : role === 'assistant' ? ' ' : '# ';
2144
- // Parse content for code blocks
2142
+ // Role-specific prefix user gets gradient bar, assistant gets dim header, system gets diamond
2143
+ const contIndent = ' ';
2144
+ let firstPrefix;
2145
+ const firstStyle = '';
2146
+ if (role === 'user') {
2147
+ firstPrefix = gradientText('\u258c ', GRADIENT_STOPS) + style.reset;
2148
+ }
2149
+ else if (role === 'assistant') {
2150
+ lines.push({ text: fg.rgb(80, 80, 80) + '\u254c\u254c codeep' + style.reset, style: '', raw: true });
2151
+ firstPrefix = ' ';
2152
+ }
2153
+ else {
2154
+ firstPrefix = fg.rgb(100, 140, 200) + '\u25b8 ' + style.reset;
2155
+ }
2145
2156
  const codeBlockRegex = /```([^\n]*)\n([\s\S]*?)```/g;
2146
2157
  let lastIndex = 0;
2147
2158
  let match;
2148
2159
  let isFirstLine = true;
2149
2160
  while ((match = codeBlockRegex.exec(content)) !== null) {
2150
- // Add text before code block
2151
2161
  const textBefore = content.slice(lastIndex, match.index);
2152
2162
  if (textBefore) {
2153
- const textLines = this.formatTextLines(textBefore, maxWidth, isFirstLine ? roleLabel : ' ', isFirstLine ? roleStyle : '');
2163
+ const prefix = isFirstLine ? firstPrefix : (role === 'user' ? contIndent : ' ');
2164
+ const textLines = this.formatTextLines(textBefore, maxWidth, prefix, firstStyle, role === 'user' && isFirstLine);
2154
2165
  lines.push(...textLines);
2155
2166
  isFirstLine = false;
2156
2167
  }
2157
- // Add code block with syntax highlighting
2158
2168
  this.codeBlockCounter++;
2159
2169
  const rawLang = (match[1] || 'text').trim();
2160
- // Handle filepath:name.ext format - extract extension as language
2161
2170
  let lang = rawLang;
2162
2171
  if (rawLang.includes(':') || rawLang.includes('.')) {
2163
- const ext = rawLang.split('.').pop() || rawLang;
2164
- lang = ext;
2172
+ lang = rawLang.split('.').pop() || rawLang;
2165
2173
  }
2166
- const code = match[2];
2167
- const codeLines = this.formatCodeBlock(code, lang, maxWidth, this.codeBlockCounter);
2168
- lines.push(...codeLines);
2174
+ lines.push(...this.formatCodeBlock(match[2], lang, maxWidth, this.codeBlockCounter));
2169
2175
  lastIndex = match.index + match[0].length;
2170
2176
  isFirstLine = false;
2171
2177
  }
2172
- // Add remaining text after last code block
2173
2178
  const textAfter = content.slice(lastIndex);
2174
2179
  if (textAfter) {
2175
- const textLines = this.formatTextLines(textAfter, maxWidth, isFirstLine ? roleLabel : ' ', isFirstLine ? roleStyle : '');
2180
+ const prefix = isFirstLine ? firstPrefix : (role === 'user' ? contIndent : ' ');
2181
+ const textLines = this.formatTextLines(textAfter, maxWidth, prefix, firstStyle, role === 'user' && isFirstLine);
2176
2182
  lines.push(...textLines);
2177
2183
  }
2178
2184
  lines.push({ text: '', style: '' });
@@ -2238,13 +2244,14 @@ export class App {
2238
2244
  /**
2239
2245
  * Format plain text lines with markdown support
2240
2246
  */
2241
- formatTextLines(text, maxWidth, firstPrefix, firstStyle) {
2247
+ formatTextLines(text, maxWidth, firstPrefix, firstStyle, rawPrefix = false) {
2242
2248
  const lines = [];
2243
2249
  const contentLines = text.split('\n');
2244
2250
  for (let i = 0; i < contentLines.length; i++) {
2245
2251
  const line = contentLines[i];
2246
2252
  const prefix = i === 0 ? firstPrefix : ' ';
2247
2253
  const prefixStyle = i === 0 ? firstStyle : '';
2254
+ const isRaw = i === 0 ? rawPrefix : false;
2248
2255
  // Heading: ## or ### etc.
2249
2256
  const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
2250
2257
  if (headingMatch) {
@@ -2275,7 +2282,7 @@ export class App {
2275
2282
  const bullet = listMatch[2];
2276
2283
  const content = listMatch[3];
2277
2284
  const { formatted, hasFormatting } = this.applyInlineMarkdown(content);
2278
- const bulletChar = bullet === '-' || bullet === '*' ? '' : bullet;
2285
+ const bulletChar = bullet === '-' || bullet === '*' ? '\u25b8' : bullet;
2279
2286
  if (hasFormatting) {
2280
2287
  lines.push({
2281
2288
  text: prefix + indent + fg.gray + bulletChar + '\x1b[0m' + ' ' + formatted,
@@ -2319,9 +2326,11 @@ export class App {
2319
2326
  if (stringWidth(line) > maxWidth - prefix.length) {
2320
2327
  const wrapped = this.wordWrap(line, maxWidth - prefix.length);
2321
2328
  for (let j = 0; j < wrapped.length; j++) {
2329
+ const lineIsRaw = j === 0 ? isRaw : false;
2322
2330
  lines.push({
2323
2331
  text: (j === 0 ? prefix : ' ') + wrapped[j],
2324
2332
  style: j === 0 ? prefixStyle : '',
2333
+ ...(lineIsRaw ? { raw: true } : {}),
2325
2334
  });
2326
2335
  }
2327
2336
  }
@@ -2329,6 +2338,7 @@ export class App {
2329
2338
  lines.push({
2330
2339
  text: prefix + line,
2331
2340
  style: prefixStyle,
2341
+ ...(isRaw ? { raw: true } : {}),
2332
2342
  });
2333
2343
  }
2334
2344
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.2.80",
3
+ "version": "1.2.82",
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",