@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
package/dist/src/utils.js
CHANGED
|
@@ -17,6 +17,15 @@ export function truncate(text, maxChars = 4000) {
|
|
|
17
17
|
return text;
|
|
18
18
|
return `${text.slice(0, maxChars)}\n... (truncated)`;
|
|
19
19
|
}
|
|
20
|
+
export function singleLinePreview(text, maxChars) {
|
|
21
|
+
const collapsed = String(text ?? '')
|
|
22
|
+
.replace(/\n\.\.\. \(truncated\)\s*$/, '…')
|
|
23
|
+
.replace(/\s+/g, ' ')
|
|
24
|
+
.trim();
|
|
25
|
+
if (collapsed.length <= maxChars)
|
|
26
|
+
return collapsed;
|
|
27
|
+
return `${collapsed.slice(0, Math.max(0, maxChars - 1)).trimEnd()}…`;
|
|
28
|
+
}
|
|
20
29
|
export function clampInteger(value, fallback, max) {
|
|
21
30
|
const numeric = Number(value);
|
|
22
31
|
if (!Number.isFinite(numeric) || numeric <= 0) {
|
package/dist/src/version.js
CHANGED
|
@@ -3,11 +3,6 @@ import path from 'node:path';
|
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
const PACKAGE_NAME = '@thegitai/cli';
|
|
5
5
|
const UNKNOWN_VERSION = '0.0.0';
|
|
6
|
-
// Resolve the package version at runtime by walking up from this module to the
|
|
7
|
-
// nearest package.json named @thegitai/cli. This works in both layouts: the
|
|
8
|
-
// compiled binary (dist/bin/ai.js → ../../package.json) and the source tree run
|
|
9
|
-
// under tsx in tests (src/version.ts → ../package.json). The name guard avoids
|
|
10
|
-
// picking up an unrelated manifest if the file is ever nested elsewhere.
|
|
11
6
|
export function getCliVersion() {
|
|
12
7
|
let dir = path.dirname(fileURLToPath(import.meta.url));
|
|
13
8
|
for (let depth = 0; depth < 6; depth++) {
|
|
@@ -18,7 +13,6 @@ export function getCliVersion() {
|
|
|
18
13
|
}
|
|
19
14
|
}
|
|
20
15
|
catch {
|
|
21
|
-
// No package.json at this level (or unreadable); keep walking up.
|
|
22
16
|
}
|
|
23
17
|
const parent = path.dirname(dir);
|
|
24
18
|
if (parent === dir)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Max Brunsfeld
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
web-tree-sitter
|
|
2
|
+
===============
|
|
3
|
+
|
|
4
|
+
The files `web-tree-sitter.cjs` and `web-tree-sitter.wasm` in this directory are
|
|
5
|
+
vendored, unmodified, from the `web-tree-sitter` npm package, version 0.26.6.
|
|
6
|
+
|
|
7
|
+
They are bundled here (rather than installed as a runtime dependency) so the
|
|
8
|
+
published `@thegitai/cli` package declares zero runtime dependencies while still
|
|
9
|
+
shipping local tree-sitter code intelligence. They are used only as a local
|
|
10
|
+
parsing runtime; no part of web-tree-sitter is modified.
|
|
11
|
+
|
|
12
|
+
Upstream: https://github.com/tree-sitter/tree-sitter
|
|
13
|
+
License: MIT (see the adjacent LICENSE file)
|