code-ollama 0.19.0 → 0.19.1
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.
|
@@ -227,8 +227,6 @@ var Markdown = memo(function Markdown({ content, color, dimColor, theme = getThe
|
|
|
227
227
|
//#endregion
|
|
228
228
|
//#region src/components/Messages/layout.ts
|
|
229
229
|
var ANSI_REGEX = new RegExp(String.raw`\u001B\[[0-9;]*m`, "g");
|
|
230
|
-
var CODE_BLOCK_MARGIN_Y = 2;
|
|
231
|
-
var CODE_BLOCK_BORDER_Y = 2;
|
|
232
230
|
var CODE_BLOCK_CHROME_X = 4;
|
|
233
231
|
function stripAnsi(value) {
|
|
234
232
|
return value.replaceAll(ANSI_REGEX, "");
|
|
@@ -264,8 +262,7 @@ function countWrappedLines(content, width) {
|
|
|
264
262
|
* @returns The total height in lines.
|
|
265
263
|
*/
|
|
266
264
|
function getCodeBlockHeight(content, width) {
|
|
267
|
-
|
|
268
|
-
return CODE_BLOCK_MARGIN_Y + CODE_BLOCK_BORDER_Y + countWrappedLines(content, contentWidth);
|
|
265
|
+
return 4 + countWrappedLines(content, Math.max(1, width - CODE_BLOCK_CHROME_X));
|
|
269
266
|
}
|
|
270
267
|
/**
|
|
271
268
|
* Calculates the total height of streaming text content based on wrapped lines.
|
package/dist/cli.js
CHANGED
|
@@ -38,7 +38,7 @@ var LIST$1 = [
|
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region package.json
|
|
40
40
|
var name = "code-ollama";
|
|
41
|
-
var version = "0.19.
|
|
41
|
+
var version = "0.19.1";
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/constants/package.ts
|
|
44
44
|
var NAME = name;
|
|
@@ -1154,6 +1154,29 @@ function formatSearchResults(source, results, note) {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
//#endregion
|
|
1156
1156
|
//#region src/utils/tools/dispatcher.ts
|
|
1157
|
+
var REQUIRED_STRING_ARGS = {
|
|
1158
|
+
[READ_FILE]: ["path"],
|
|
1159
|
+
[WRITE_FILE]: ["path", "content"],
|
|
1160
|
+
[EDIT_FILE]: [
|
|
1161
|
+
"path",
|
|
1162
|
+
"oldText",
|
|
1163
|
+
"newText"
|
|
1164
|
+
],
|
|
1165
|
+
[RUN_SHELL]: ["command"],
|
|
1166
|
+
[LIST_DIR]: ["path"],
|
|
1167
|
+
[GREP_SEARCH]: ["pattern", "path"],
|
|
1168
|
+
[VIEW_RANGE]: ["path"],
|
|
1169
|
+
[WEB_SEARCH]: ["query"],
|
|
1170
|
+
[WEB_FETCH]: ["url"]
|
|
1171
|
+
};
|
|
1172
|
+
function validateArgs(name, args) {
|
|
1173
|
+
const required = REQUIRED_STRING_ARGS[name] ?? [];
|
|
1174
|
+
const received = Object.keys(args).join(", ") || "none";
|
|
1175
|
+
for (const key of required) if (typeof args[key] !== "string") return {
|
|
1176
|
+
content: "",
|
|
1177
|
+
error: `Missing required argument: ${key} (received keys: ${received})`
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1157
1180
|
/**
|
|
1158
1181
|
* Execute a tool by name with arguments
|
|
1159
1182
|
*/
|
|
@@ -1162,16 +1185,19 @@ async function executeTool(name, args, options) {
|
|
|
1162
1185
|
content: "",
|
|
1163
1186
|
error: `Tool not allowed: ${name}`
|
|
1164
1187
|
};
|
|
1188
|
+
const invalid = validateArgs(name, args);
|
|
1189
|
+
if (invalid) return invalid;
|
|
1190
|
+
const stringArgs = args;
|
|
1165
1191
|
switch (name) {
|
|
1166
|
-
case READ_FILE: return readFile(
|
|
1167
|
-
case WRITE_FILE: return writeFile(
|
|
1168
|
-
case EDIT_FILE: return editFile(
|
|
1169
|
-
case RUN_SHELL: return runShell(
|
|
1170
|
-
case LIST_DIR: return listDir(
|
|
1171
|
-
case GREP_SEARCH: return await grepSearch(
|
|
1172
|
-
case VIEW_RANGE: return viewRange(
|
|
1173
|
-
case WEB_SEARCH: return await webSearch(
|
|
1174
|
-
case WEB_FETCH: return await webFetch(
|
|
1192
|
+
case READ_FILE: return readFile(stringArgs.path);
|
|
1193
|
+
case WRITE_FILE: return writeFile(stringArgs.path, stringArgs.content);
|
|
1194
|
+
case EDIT_FILE: return editFile(stringArgs.path, stringArgs.oldText, stringArgs.newText);
|
|
1195
|
+
case RUN_SHELL: return runShell(stringArgs.command);
|
|
1196
|
+
case LIST_DIR: return listDir(stringArgs.path);
|
|
1197
|
+
case GREP_SEARCH: return await grepSearch(stringArgs.pattern, stringArgs.path);
|
|
1198
|
+
case VIEW_RANGE: return viewRange(stringArgs.path, args.start, args.end);
|
|
1199
|
+
case WEB_SEARCH: return await webSearch(stringArgs.query);
|
|
1200
|
+
case WEB_FETCH: return await webFetch(stringArgs.url);
|
|
1175
1201
|
default: return {
|
|
1176
1202
|
content: "",
|
|
1177
1203
|
error: `Unknown tool: ${name}`
|
|
@@ -1242,7 +1268,7 @@ async function main(args = process.argv.slice(2)) {
|
|
|
1242
1268
|
else await launchTui();
|
|
1243
1269
|
}
|
|
1244
1270
|
async function launchTui(sessionId) {
|
|
1245
|
-
const { renderApp } = await import("./assets/tui-
|
|
1271
|
+
const { renderApp } = await import("./assets/tui-DDbMjcMS.js");
|
|
1246
1272
|
reset();
|
|
1247
1273
|
renderApp(sessionId);
|
|
1248
1274
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-ollama",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "Ollama coding agent that runs in your terminal",
|
|
5
5
|
"author": "Mark <mark@remarkablemark.org> (https://remarkablemark.org)",
|
|
6
6
|
"type": "module",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "vite build",
|
|
13
|
-
"start": "tsx
|
|
13
|
+
"start": "tsx src/cli.ts",
|
|
14
14
|
"clean": "rm -rf coverage dist docs",
|
|
15
15
|
"lint": "eslint .",
|
|
16
16
|
"lint:fix": "npm run lint -- --fix",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@commitlint/cli": "21.0.1",
|
|
54
54
|
"@commitlint/config-conventional": "21.0.1",
|
|
55
55
|
"@eslint/js": "10.0.1",
|
|
56
|
-
"@types/node": "25.9.
|
|
57
|
-
"@types/react": "19.2.
|
|
58
|
-
"@vitest/coverage-v8": "4.1.
|
|
56
|
+
"@types/node": "25.9.1",
|
|
57
|
+
"@types/react": "19.2.15",
|
|
58
|
+
"@vitest/coverage-v8": "4.1.7",
|
|
59
59
|
"eslint": "10.4.0",
|
|
60
60
|
"eslint-plugin-prettier": "5.5.5",
|
|
61
61
|
"eslint-plugin-simple-import-sort": "13.0.0",
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"lint-staged": "17.0.5",
|
|
66
66
|
"prettier": "3.8.3",
|
|
67
67
|
"publint": "0.3.21",
|
|
68
|
-
"tsx": "4.22.
|
|
68
|
+
"tsx": "4.22.3",
|
|
69
69
|
"typescript": "6.0.3",
|
|
70
70
|
"typescript-eslint": "8.59.4",
|
|
71
|
-
"vite": "8.0.
|
|
72
|
-
"vitest": "4.1.
|
|
71
|
+
"vite": "8.0.14",
|
|
72
|
+
"vitest": "4.1.7"
|
|
73
73
|
},
|
|
74
74
|
"files": [
|
|
75
75
|
"dist/"
|