codeep 1.1.21 → 1.1.22
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/dist/renderer/App.js +25 -2
- package/package.json +1 -1
package/dist/renderer/App.js
CHANGED
|
@@ -30,11 +30,14 @@ const KEYWORDS = {
|
|
|
30
30
|
go: ['func', 'return', 'if', 'else', 'for', 'range', 'switch', 'case', 'break', 'continue', 'fallthrough', 'default', 'go', 'select', 'chan', 'defer', 'panic', 'recover', 'type', 'struct', 'interface', 'map', 'package', 'import', 'const', 'var', 'nil', 'true', 'false', 'iota', 'make', 'new', 'append', 'len', 'cap', 'copy', 'delete'],
|
|
31
31
|
rust: ['fn', 'let', 'mut', 'const', 'static', 'return', 'if', 'else', 'match', 'for', 'while', 'loop', 'break', 'continue', 'struct', 'enum', 'trait', 'impl', 'type', 'where', 'use', 'mod', 'pub', 'crate', 'self', 'super', 'async', 'await', 'move', 'ref', 'true', 'false', 'Some', 'None', 'Ok', 'Err', 'Self', 'dyn', 'unsafe', 'extern'],
|
|
32
32
|
sh: ['if', 'then', 'else', 'elif', 'fi', 'case', 'esac', 'for', 'while', 'until', 'do', 'done', 'in', 'function', 'return', 'local', 'export', 'readonly', 'declare', 'typeset', 'unset', 'shift', 'exit', 'break', 'continue', 'source', 'alias', 'echo', 'printf', 'read', 'test', 'true', 'false'],
|
|
33
|
+
html: ['html', 'head', 'body', 'div', 'span', 'p', 'a', 'img', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'table', 'tr', 'td', 'th', 'form', 'input', 'button', 'select', 'option', 'textarea', 'label', 'section', 'article', 'nav', 'header', 'footer', 'main', 'aside', 'meta', 'link', 'script', 'style', 'title', 'DOCTYPE'],
|
|
34
|
+
css: ['import', 'media', 'keyframes', 'font-face', 'supports', 'charset', 'namespace', 'page', 'inherit', 'initial', 'unset', 'none', 'auto', 'block', 'inline', 'flex', 'grid', 'absolute', 'relative', 'fixed', 'sticky', 'static', 'hidden', 'visible', 'solid', 'dashed', 'dotted', 'transparent', 'important'],
|
|
33
35
|
};
|
|
34
36
|
// Map language aliases
|
|
35
37
|
const LANG_ALIASES = {
|
|
36
38
|
javascript: 'js', typescript: 'ts', python: 'py', golang: 'go',
|
|
37
39
|
bash: 'sh', shell: 'sh', zsh: 'sh', tsx: 'ts', jsx: 'js',
|
|
40
|
+
htm: 'html', scss: 'css', sass: 'css', less: 'css',
|
|
38
41
|
};
|
|
39
42
|
/**
|
|
40
43
|
* Syntax highlighter for code with better token handling
|
|
@@ -42,6 +45,20 @@ const LANG_ALIASES = {
|
|
|
42
45
|
function highlightCode(code, lang) {
|
|
43
46
|
const normalizedLang = LANG_ALIASES[lang.toLowerCase()] || lang.toLowerCase();
|
|
44
47
|
const keywords = KEYWORDS[normalizedLang] || KEYWORDS['js'] || [];
|
|
48
|
+
// HTML: highlight tags, attributes, and values
|
|
49
|
+
if (normalizedLang === 'html' || normalizedLang === 'xml' || normalizedLang === 'svg') {
|
|
50
|
+
return code.replace(/(<\/?)(\w[\w-]*)((?:\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|\S+))?)*)(\s*\/?>)/g, (_match, open, tag, attrs, close) => {
|
|
51
|
+
const highlightedAttrs = attrs.replace(/([\w-]+)(=)("[^"]*"|'[^']*')/g, (_m, attr, eq, val) => SYNTAX.function + attr + '\x1b[0m' + SYNTAX.operator + eq + '\x1b[0m' + SYNTAX.string + val + '\x1b[0m');
|
|
52
|
+
return SYNTAX.punctuation + open + '\x1b[0m' + SYNTAX.keyword + tag + '\x1b[0m' + highlightedAttrs + SYNTAX.punctuation + close + '\x1b[0m';
|
|
53
|
+
}).replace(/<!--[\s\S]*?-->/g, (comment) => SYNTAX.comment + comment + '\x1b[0m');
|
|
54
|
+
}
|
|
55
|
+
// CSS: highlight selectors, properties, and values
|
|
56
|
+
if (normalizedLang === 'css') {
|
|
57
|
+
return code
|
|
58
|
+
.replace(/\/\*[\s\S]*?\*\//g, (comment) => SYNTAX.comment + comment + '\x1b[0m')
|
|
59
|
+
.replace(/([\w-]+)(\s*:\s*)([^;{}]+)/g, (_m, prop, colon, val) => SYNTAX.function + prop + '\x1b[0m' + colon + SYNTAX.string + val + '\x1b[0m')
|
|
60
|
+
.replace(/([.#]?[\w-]+(?:\s*[,>+~]\s*[.#]?[\w-]+)*)\s*\{/g, (match, selector) => SYNTAX.keyword + selector + '\x1b[0m' + ' {');
|
|
61
|
+
}
|
|
45
62
|
// Tokenize and highlight
|
|
46
63
|
let result = '';
|
|
47
64
|
let i = 0;
|
|
@@ -2374,7 +2391,7 @@ export class App {
|
|
|
2374
2391
|
const roleStyle = role === 'user' ? fg.green : role === 'assistant' ? PRIMARY_COLOR : fg.yellow;
|
|
2375
2392
|
const roleLabel = role === 'user' ? '> ' : role === 'assistant' ? ' ' : '# ';
|
|
2376
2393
|
// Parse content for code blocks
|
|
2377
|
-
const codeBlockRegex = /```(
|
|
2394
|
+
const codeBlockRegex = /```([^\n]*)\n([\s\S]*?)```/g;
|
|
2378
2395
|
let lastIndex = 0;
|
|
2379
2396
|
let match;
|
|
2380
2397
|
let isFirstLine = true;
|
|
@@ -2387,7 +2404,13 @@ export class App {
|
|
|
2387
2404
|
isFirstLine = false;
|
|
2388
2405
|
}
|
|
2389
2406
|
// Add code block with syntax highlighting
|
|
2390
|
-
const
|
|
2407
|
+
const rawLang = (match[1] || 'text').trim();
|
|
2408
|
+
// Handle filepath:name.ext format - extract extension as language
|
|
2409
|
+
let lang = rawLang;
|
|
2410
|
+
if (rawLang.includes(':') || rawLang.includes('.')) {
|
|
2411
|
+
const ext = rawLang.split('.').pop() || rawLang;
|
|
2412
|
+
lang = ext;
|
|
2413
|
+
}
|
|
2391
2414
|
const code = match[2];
|
|
2392
2415
|
const codeLines = this.formatCodeBlock(code, lang, maxWidth);
|
|
2393
2416
|
lines.push(...codeLines);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeep",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
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",
|