@thegitai/cli 1.0.0-beta.9 → 1.0.0-preview.10
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/README.md +49 -3
- package/dist/bin/ai.js +83 -197
- package/dist/parsers/NOTICE +18 -0
- package/dist/src/agent-mode.js +5 -0
- package/dist/src/api/auth.js +4 -4
- package/dist/src/api/browser-login.js +72 -19
- package/dist/src/api/chat.js +182 -35
- package/dist/src/api/http.js +65 -4
- package/dist/src/api/models.js +33 -22
- package/dist/src/artifact-policy.js +3 -0
- package/dist/src/background-jobs.js +410 -0
- package/dist/src/cli-args.js +0 -5
- package/dist/src/client-environment.js +2 -0
- package/dist/src/colors.js +50 -0
- package/dist/src/core/clipboard.js +19 -0
- package/dist/src/core/image-path-extractor.js +144 -0
- package/dist/src/executor.js +48 -12
- package/dist/src/help-text.js +30 -13
- package/dist/src/patcher.js +97 -12
- package/dist/src/project-index.js +13 -1
- package/dist/src/project-orientation.js +99 -0
- package/dist/src/scanner.js +50 -12
- package/dist/src/scratch-dir.js +75 -0
- package/dist/src/secret-preview.js +0 -10
- package/dist/src/session-safety.js +0 -19
- package/dist/src/session-store.js +52 -21
- package/dist/src/session.js +8 -0
- package/dist/src/todo-list.js +106 -0
- package/dist/src/tool-executor.js +194 -21
- package/dist/src/tools/delete-file.js +23 -5
- package/dist/src/tools/index.js +6 -0
- package/dist/src/tools/patch-file.js +33 -7
- package/dist/src/tools/path-suggest.js +81 -8
- package/dist/src/tools/read-document.js +2 -2
- package/dist/src/tools/read-file.js +17 -8
- package/dist/src/tools/replace-document-text.js +10 -12
- package/dist/src/tools/restore-checkpoint.js +1 -1
- package/dist/src/tools/run-command.js +109 -24
- package/dist/src/tools/run-node-script.js +27 -5
- package/dist/src/tools/shell-job-kill.js +48 -0
- package/dist/src/tools/shell-job-output.js +51 -0
- package/dist/src/tools/str-replace.js +33 -7
- package/dist/src/tools/undo-edit.js +1 -1
- package/dist/src/tools/update-todos.js +27 -0
- package/dist/src/tools/write-file.js +26 -6
- package/dist/src/tree-sitter-runtime.js +8 -1
- package/dist/src/turn-failure-marker.js +11 -0
- package/dist/src/ui/prompt-history-store.js +1 -1
- package/dist/src/ui/repl.js +500 -71
- package/dist/src/ui/tui/bridge.js +3 -4
- package/dist/src/ui/tui/build-frame.js +393 -100
- package/dist/src/ui/tui/markdown-render.js +72 -73
- package/dist/src/ui/tui/shell-input.js +75 -17
- package/dist/src/ui/tui/terminal-title.js +84 -0
- package/dist/src/ui/tui/terminal-writes.js +48 -0
- package/dist/src/ui/tui/text.js +158 -4
- package/dist/src/utils.js +9 -0
- package/dist/src/version.js +0 -6
- package/dist/vendor/web-tree-sitter/LICENSE +21 -0
- package/dist/vendor/web-tree-sitter/NOTICE +13 -0
- package/dist/vendor/web-tree-sitter/web-tree-sitter.cjs +4063 -0
- package/dist/vendor/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/package.json +27 -16
- package/dist/src/markdown-renderer.js +0 -112
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thegitai/cli",
|
|
3
|
-
"version": "1.0.0-
|
|
4
|
-
"description": "TheGitAI
|
|
3
|
+
"version": "1.0.0-preview.10",
|
|
4
|
+
"description": "TheGitAI is an AI coding agent for your terminal. It indexes your repository, writes and edits files, runs commands, and builds features with you.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"ai-coding-agent",
|
|
8
|
+
"coding-agent",
|
|
9
|
+
"coding-assistant",
|
|
10
|
+
"terminal",
|
|
11
|
+
"cli",
|
|
12
|
+
"developer-tools"
|
|
13
|
+
],
|
|
5
14
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
15
|
"homepage": "https://thegit.ai",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"email": "support@thegit.ai"
|
|
18
|
+
},
|
|
7
19
|
"type": "module",
|
|
8
20
|
"engines": {
|
|
9
21
|
"node": ">=24"
|
|
@@ -16,21 +28,20 @@
|
|
|
16
28
|
"LICENSE",
|
|
17
29
|
"README.md"
|
|
18
30
|
],
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@homebridge/node-pty-prebuilt-multiarch": "^0.13.1",
|
|
21
|
-
"@mozilla/readability": "0.6.0",
|
|
22
|
-
"@vscode/ripgrep": "1.17.1",
|
|
23
|
-
"@vscode/tree-sitter-wasm": "^0.3.0",
|
|
24
|
-
"chalk": "^5.4.1",
|
|
25
|
-
"glob": "^11.0.1",
|
|
26
|
-
"jsdom": "29.1.1",
|
|
27
|
-
"web-tree-sitter": "^0.26.6"
|
|
28
|
-
},
|
|
31
|
+
"dependencies": {},
|
|
29
32
|
"optionalDependencies": {
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
33
|
+
"@lydell/node-pty": "1.1.0",
|
|
34
|
+
"@lydell/node-pty-darwin-arm64": "1.1.0",
|
|
35
|
+
"@lydell/node-pty-darwin-x64": "1.1.0",
|
|
36
|
+
"@lydell/node-pty-linux-arm64": "1.1.0",
|
|
37
|
+
"@lydell/node-pty-linux-x64": "1.1.0",
|
|
38
|
+
"@lydell/node-pty-win32-arm64": "1.1.0",
|
|
39
|
+
"@lydell/node-pty-win32-x64": "1.1.0",
|
|
40
|
+
"@thegitai/tui-darwin-arm64": "1.0.0-preview.10",
|
|
41
|
+
"@thegitai/tui-darwin-x64": "1.0.0-preview.10",
|
|
42
|
+
"@thegitai/tui-linux-x64": "1.0.0-preview.10",
|
|
43
|
+
"@thegitai/tui-win32-x64": "1.0.0-preview.10",
|
|
44
|
+
"@vscode/ripgrep": "1.18.0"
|
|
34
45
|
},
|
|
35
46
|
"publishConfig": {
|
|
36
47
|
"access": "public"
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
function renderInline(text) {
|
|
3
|
-
const parts = String(text ?? '').split(/(`[^`]+`)/g);
|
|
4
|
-
return parts
|
|
5
|
-
.map((part) => part.startsWith('`') && part.endsWith('`') && part.length > 1
|
|
6
|
-
? chalk.cyan(part.slice(1, -1))
|
|
7
|
-
: part)
|
|
8
|
-
.join('');
|
|
9
|
-
}
|
|
10
|
-
function isTableSeparator(line) {
|
|
11
|
-
const cells = splitTableRow(line);
|
|
12
|
-
return (cells.length > 1 &&
|
|
13
|
-
cells.every((cell) => /^:?-{3,}:?$/.test(cell.trim())));
|
|
14
|
-
}
|
|
15
|
-
function splitTableRow(line) {
|
|
16
|
-
const trimmed = String(line ?? '').trim();
|
|
17
|
-
if (!trimmed.includes('|'))
|
|
18
|
-
return [];
|
|
19
|
-
return trimmed
|
|
20
|
-
.replace(/^\|/, '')
|
|
21
|
-
.replace(/\|$/, '')
|
|
22
|
-
.split('|')
|
|
23
|
-
.map((cell) => cell.trim());
|
|
24
|
-
}
|
|
25
|
-
function tableWidth(text) {
|
|
26
|
-
return text.replace(/\x1b\[[0-9;]*m/g, '').length;
|
|
27
|
-
}
|
|
28
|
-
function padCell(text, width) {
|
|
29
|
-
return `${text}${' '.repeat(Math.max(0, width - tableWidth(text)))}`;
|
|
30
|
-
}
|
|
31
|
-
function renderTable(rows) {
|
|
32
|
-
if (rows.length < 2 || !isTableSeparator(rows[1].join('|')))
|
|
33
|
-
return [];
|
|
34
|
-
const headers = rows[0];
|
|
35
|
-
const body = rows.slice(2).filter((row) => row.length > 0);
|
|
36
|
-
const columnCount = Math.max(headers.length, ...body.map((row) => row.length));
|
|
37
|
-
const normalizedRows = [headers, ...body].map((row) => Array.from({ length: columnCount }, (_, index) => renderInline(row[index] ?? '')));
|
|
38
|
-
const widths = Array.from({ length: columnCount }, (_, index) => Math.max(...normalizedRows.map((row) => tableWidth(row[index] ?? '')), 3));
|
|
39
|
-
const border = `+${widths.map((width) => '-'.repeat(width + 2)).join('+')}+`;
|
|
40
|
-
const renderRow = (row) => `| ${row.map((cell, index) => padCell(cell, widths[index])).join(' | ')} |`;
|
|
41
|
-
return [
|
|
42
|
-
border,
|
|
43
|
-
renderRow(normalizedRows[0].map((cell) => chalk.bold(cell))),
|
|
44
|
-
border,
|
|
45
|
-
...normalizedRows.slice(1).map(renderRow),
|
|
46
|
-
border,
|
|
47
|
-
];
|
|
48
|
-
}
|
|
49
|
-
function readTableBlock(lines, startIndex) {
|
|
50
|
-
if (startIndex + 1 >= lines.length)
|
|
51
|
-
return null;
|
|
52
|
-
const header = splitTableRow(lines[startIndex]);
|
|
53
|
-
const separator = splitTableRow(lines[startIndex + 1]);
|
|
54
|
-
if (header.length < 2 || separator.length < 2 || !isTableSeparator(lines[startIndex + 1])) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
const rows = [header, separator];
|
|
58
|
-
let index = startIndex + 2;
|
|
59
|
-
while (index < lines.length) {
|
|
60
|
-
const row = splitTableRow(lines[index]);
|
|
61
|
-
if (row.length < 2)
|
|
62
|
-
break;
|
|
63
|
-
rows.push(row);
|
|
64
|
-
index += 1;
|
|
65
|
-
}
|
|
66
|
-
const rendered = renderTable(rows);
|
|
67
|
-
return rendered.length ? { rendered, nextIndex: index } : null;
|
|
68
|
-
}
|
|
69
|
-
export function renderMarkdownForTerminal(markdown) {
|
|
70
|
-
const lines = String(markdown ?? '').replace(/\r\n?/g, '\n').split('\n');
|
|
71
|
-
const output = [];
|
|
72
|
-
let inCodeBlock = false;
|
|
73
|
-
for (let index = 0; index < lines.length; index++) {
|
|
74
|
-
const line = lines[index];
|
|
75
|
-
if (/^\s*```/.test(line)) {
|
|
76
|
-
inCodeBlock = !inCodeBlock;
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if (inCodeBlock) {
|
|
80
|
-
output.push(chalk.dim(` ${line}`));
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
const table = readTableBlock(lines, index);
|
|
84
|
-
if (table) {
|
|
85
|
-
output.push(...table.rendered);
|
|
86
|
-
index = table.nextIndex - 1;
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
const heading = line.match(/^\s{0,3}#{1,6}\s+(.+)$/);
|
|
90
|
-
if (heading) {
|
|
91
|
-
output.push(chalk.bold(renderInline(heading[1].trim())));
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
const bullet = line.match(/^(\s*)[-*]\s+(.+)$/);
|
|
95
|
-
if (bullet) {
|
|
96
|
-
output.push(`${bullet[1]}- ${renderInline(bullet[2].trim())}`);
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
const numbered = line.match(/^(\s*)\d+[.)]\s+(.+)$/);
|
|
100
|
-
if (numbered) {
|
|
101
|
-
output.push(`${numbered[1]}- ${renderInline(numbered[2].trim())}`);
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
const quote = line.match(/^\s*>\s?(.+)$/);
|
|
105
|
-
if (quote) {
|
|
106
|
-
output.push(chalk.dim(`> ${renderInline(quote[1].trim())}`));
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
output.push(renderInline(line));
|
|
110
|
-
}
|
|
111
|
-
return output.join('\n').trimEnd();
|
|
112
|
-
}
|