code-ollama 0.16.0 → 0.18.0

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/cli.js CHANGED
@@ -8,7 +8,7 @@ import { v7 } from "uuid";
8
8
  import { exec } from "node:child_process";
9
9
  import { promisify } from "node:util";
10
10
  //#region src/constants/command.ts
11
- var LIST = [
11
+ var LIST$1 = [
12
12
  {
13
13
  name: "/clear",
14
14
  description: "clear the current session"
@@ -19,7 +19,11 @@ var LIST = [
19
19
  },
20
20
  {
21
21
  name: "/model",
22
- description: "switch the model"
22
+ description: "manage Ollama models"
23
+ },
24
+ {
25
+ name: "/theme",
26
+ description: "change the theme"
23
27
  },
24
28
  {
25
29
  name: "/search",
@@ -33,7 +37,7 @@ var LIST = [
33
37
  //#endregion
34
38
  //#region package.json
35
39
  var name = "code-ollama";
36
- var version = "0.16.0";
40
+ var version = "0.18.0";
37
41
  //#endregion
38
42
  //#region src/constants/package.ts
39
43
  var NAME = name;
@@ -56,6 +60,38 @@ var LABEL = {
56
60
  plan: "Plan"
57
61
  };
58
62
  //#endregion
63
+ //#region src/constants/models.ts
64
+ /**
65
+ * @see https://ollama.com/library
66
+ */
67
+ var CATALOG = [
68
+ {
69
+ label: "Gemma 4 (gemma4:latest)",
70
+ value: "gemma4:latest",
71
+ alias: "gemma4:e4b"
72
+ },
73
+ {
74
+ label: "Granite 4 (granite4.1:8b)",
75
+ value: "granite4.1:8b"
76
+ },
77
+ {
78
+ label: "Qwen 2.5 Coder (qwen2.5-coder:latest)",
79
+ value: "qwen2.5-coder:latest",
80
+ alias: "qwen2.5-coder:7b"
81
+ },
82
+ {
83
+ label: "DeepSeek Coder V2 (deepseek-coder-v2:latest)",
84
+ value: "deepseek-coder-v2:latest",
85
+ alias: "deepseek-coder-v2:16b"
86
+ }
87
+ ];
88
+ //#endregion
89
+ //#region src/constants/option.ts
90
+ var BACK = {
91
+ label: "Back",
92
+ value: "back"
93
+ };
94
+ //#endregion
59
95
  //#region src/constants/prompt.ts
60
96
  var BASE_SYSTEM_PROMPT = `You are a coding assistant that helps users write, edit, and understand code. You have access to tools for reading files, writing files, running shell commands, searching code, and searching the web
61
97
 
@@ -102,6 +138,146 @@ var USER = "user";
102
138
  var ASSISTANT = "assistant";
103
139
  var SYSTEM = "system";
104
140
  //#endregion
141
+ //#region src/constants/theme.ts
142
+ var DEFAULT_THEME_ID = "github-dark";
143
+ var LIST = [
144
+ {
145
+ id: "github-light",
146
+ label: "GitHub Light",
147
+ description: "Light GitHub palette",
148
+ markdownTheme: "gitHub",
149
+ codeTheme: "github-light",
150
+ colors: {
151
+ accent: "blue",
152
+ border: "blue",
153
+ codeBorder: "blue",
154
+ command: "blue",
155
+ error: "red",
156
+ messageSystem: "gray",
157
+ modeAuto: "magenta",
158
+ modePlan: "blue",
159
+ modeSafe: "green",
160
+ model: "blue",
161
+ secondary: "gray",
162
+ status: "cyan",
163
+ warning: "yellow"
164
+ }
165
+ },
166
+ {
167
+ id: "github-dark",
168
+ label: "GitHub Dark",
169
+ description: "Dark GitHub palette",
170
+ markdownTheme: "gitHub",
171
+ codeTheme: "github-dark",
172
+ colors: {
173
+ accent: "cyan",
174
+ border: "cyan",
175
+ codeBorder: "gray",
176
+ command: "cyan",
177
+ error: "red",
178
+ messageSystem: "gray",
179
+ modeAuto: "magenta",
180
+ modePlan: "blue",
181
+ modeSafe: "green",
182
+ model: "cyan",
183
+ secondary: "gray",
184
+ status: "cyan",
185
+ warning: "yellow"
186
+ }
187
+ },
188
+ {
189
+ id: "nord",
190
+ label: "Nord",
191
+ description: "Cool nordic blues",
192
+ markdownTheme: "nord",
193
+ codeTheme: "nord",
194
+ colors: {
195
+ accent: "cyan",
196
+ border: "blue",
197
+ codeBorder: "blue",
198
+ command: "cyan",
199
+ error: "red",
200
+ messageSystem: "gray",
201
+ modeAuto: "magenta",
202
+ modePlan: "blue",
203
+ modeSafe: "green",
204
+ model: "cyan",
205
+ secondary: "gray",
206
+ status: "blue",
207
+ warning: "yellow"
208
+ }
209
+ },
210
+ {
211
+ id: "dracula",
212
+ label: "Dracula",
213
+ description: "Bright neon contrast",
214
+ markdownTheme: "dracula",
215
+ codeTheme: "dracula",
216
+ colors: {
217
+ accent: "magenta",
218
+ border: "magenta",
219
+ codeBorder: "magenta",
220
+ command: "magenta",
221
+ error: "red",
222
+ messageSystem: "gray",
223
+ modeAuto: "yellow",
224
+ modePlan: "magenta",
225
+ modeSafe: "green",
226
+ model: "magenta",
227
+ secondary: "gray",
228
+ status: "cyan",
229
+ warning: "yellow"
230
+ }
231
+ },
232
+ {
233
+ id: "solarized-light",
234
+ label: "Solarized Light",
235
+ description: "Warm light contrast",
236
+ markdownTheme: "solarized",
237
+ codeTheme: "solarized-light",
238
+ colors: {
239
+ accent: "yellow",
240
+ border: "yellow",
241
+ codeBorder: "yellow",
242
+ command: "yellow",
243
+ error: "red",
244
+ messageSystem: "gray",
245
+ modeAuto: "cyan",
246
+ modePlan: "blue",
247
+ modeSafe: "green",
248
+ model: "yellow",
249
+ secondary: "gray",
250
+ status: "cyan",
251
+ warning: "yellow"
252
+ }
253
+ },
254
+ {
255
+ id: "solarized-dark",
256
+ label: "Solarized Dark",
257
+ description: "Warm dark contrast",
258
+ markdownTheme: "solarized",
259
+ codeTheme: "solarized-dark",
260
+ colors: {
261
+ accent: "yellow",
262
+ border: "yellow",
263
+ codeBorder: "yellow",
264
+ command: "yellow",
265
+ error: "red",
266
+ messageSystem: "gray",
267
+ modeAuto: "cyan",
268
+ modePlan: "blue",
269
+ modeSafe: "green",
270
+ model: "yellow",
271
+ secondary: "gray",
272
+ status: "cyan",
273
+ warning: "yellow"
274
+ }
275
+ }
276
+ ];
277
+ function getTheme(themeId = DEFAULT_THEME_ID) {
278
+ return LIST.find(({ id }) => id === themeId) ?? LIST[0];
279
+ }
280
+ //#endregion
105
281
  //#region src/constants/tool.ts
106
282
  var READ_FILE = "read_file";
107
283
  var WRITE_FILE = "write_file";
@@ -115,6 +291,7 @@ var WEB_FETCH = "web_fetch";
115
291
  //#endregion
116
292
  //#region src/constants/ui.ts
117
293
  var HEADER_PREFIX = "🦙 ";
294
+ var WARNING = "⚠️";
118
295
  //#endregion
119
296
  //#region src/utils/agents.ts
120
297
  var AGENTS_FILE = "AGENTS.md";
@@ -166,7 +343,8 @@ function loadConfig() {
166
343
  return {
167
344
  host: process.env.OLLAMA_HOST ?? file.host ?? DEFAULT_HOST,
168
345
  model: process.env.OLLAMA_MODEL ?? file.model ?? DEFAULT_MODEL$1,
169
- searxngBaseUrl: file.searxngBaseUrl
346
+ searxngBaseUrl: file.searxngBaseUrl,
347
+ theme: file.theme ?? "github-dark"
170
348
  };
171
349
  }
172
350
  function saveConfig(patch) {
@@ -213,6 +391,15 @@ async function listModels() {
213
391
  const { models } = await client.list();
214
392
  return models.map(({ name }) => name);
215
393
  }
394
+ async function pullModel(model) {
395
+ return client.pull({
396
+ model,
397
+ stream: true
398
+ });
399
+ }
400
+ function deleteModel(model) {
401
+ return client.delete({ model });
402
+ }
216
403
  //#endregion
217
404
  //#region src/utils/screen.ts
218
405
  var clearHandler = null;
@@ -370,7 +557,16 @@ function deleteSession(id) {
370
557
  }
371
558
  //#endregion
372
559
  //#region src/utils/terminal.ts
373
- var ANSI_COLOR = { cyan: ["\x1B[36m", "\x1B[39m"] };
560
+ var ANSI_RESET_FOREGROUND = "\x1B[39m";
561
+ var ANSI_COLOR = {
562
+ blue: ["\x1B[34m", ANSI_RESET_FOREGROUND],
563
+ cyan: ["\x1B[36m", ANSI_RESET_FOREGROUND],
564
+ gray: ["\x1B[90m", ANSI_RESET_FOREGROUND],
565
+ green: ["\x1B[32m", ANSI_RESET_FOREGROUND],
566
+ magenta: ["\x1B[35m", ANSI_RESET_FOREGROUND],
567
+ red: ["\x1B[31m", ANSI_RESET_FOREGROUND],
568
+ yellow: ["\x1B[33m", ANSI_RESET_FOREGROUND]
569
+ };
374
570
  function color(text, name) {
375
571
  const [open, close] = ANSI_COLOR[name];
376
572
  return `${open}${text}${close}`;
@@ -382,9 +578,6 @@ function writeError(text) {
382
578
  process.stderr.write(text);
383
579
  }
384
580
  //#endregion
385
- //#region src/utils/time.ts
386
- var tick = (ms = 0) => new Promise((resolve) => setTimeout(resolve, ms));
387
- //#endregion
388
581
  //#region src/utils/tools/definitions.ts
389
582
  /**
390
583
  * Helper to define tool parameters
@@ -931,7 +1124,7 @@ async function main(args = process.argv.slice(2)) {
931
1124
  else await launchTui();
932
1125
  }
933
1126
  async function launchTui(sessionId) {
934
- const { renderApp } = await import("./assets/tui-85A3pZD2.js");
1127
+ const { renderApp } = await import("./assets/tui-4cX-bKvd.js");
935
1128
  reset();
936
1129
  renderApp(sessionId);
937
1130
  }
@@ -947,4 +1140,4 @@ function isEntrypoint(argv1 = process.argv[1]) {
947
1140
  if (isEntrypoint()) main();
948
1141
  // v8 ignore stop
949
1142
  //#endregion
950
- export { LABEL as A, withSystemMessage as C, USER as D, SYSTEM as E, VERSION as F, LIST as I, SAFE as M, APPROVE as N, PLAN_GENERATION_INSTRUCTION as O, REJECT as P, resetSystemMessage as S, ASSISTANT as T, setClearHandler as _, tick as a, loadConfig as b, appendMessage as c, deleteSessionIfEmpty as d, listSessions as f, reset as g, clear as h, WRITE_TOOLS as i, PLAN as j, AUTO as k, createSession as l, updateSessionModel as m, main, READ_TOOLS as n, color as o, loadSession as p, TOOLS as r, write as s, executeTool as t, deleteSession as u, listModels as v, HEADER_PREFIX as w, saveConfig as x, streamChat as y };
1143
+ export { SYSTEM as A, REJECT as B, resetSystemMessage as C, LIST as D, WARNING as E, AUTO as F, LIST$1 as H, LABEL as I, PLAN as L, PLAN_GENERATION_INSTRUCTION as M, BACK as N, getTheme as O, CATALOG as P, SAFE as R, saveConfig as S, HEADER_PREFIX as T, VERSION as V, deleteModel as _, color as a, streamChat as b, createSession as c, listSessions as d, loadSession as f, setClearHandler as g, reset as h, WRITE_TOOLS as i, USER as j, ASSISTANT as k, deleteSession as l, clear as m, main, READ_TOOLS as n, write as o, updateSessionModel as p, TOOLS as r, appendMessage as s, executeTool as t, deleteSessionIfEmpty as u, listModels as v, withSystemMessage as w, loadConfig as x, pullModel as y, APPROVE as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-ollama",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
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",
@@ -52,7 +52,6 @@
52
52
  "devDependencies": {
53
53
  "@commitlint/cli": "21.0.1",
54
54
  "@commitlint/config-conventional": "21.0.1",
55
- "@eslint/config-helpers": "0.6.0",
56
55
  "@eslint/js": "10.0.1",
57
56
  "@types/node": "25.8.0",
58
57
  "@types/react": "19.2.14",
@@ -63,10 +62,10 @@
63
62
  "globals": "17.6.0",
64
63
  "husky": "9.1.7",
65
64
  "ink-testing-library": "4.0.0",
66
- "lint-staged": "17.0.4",
65
+ "lint-staged": "17.0.5",
67
66
  "prettier": "3.8.3",
68
67
  "publint": "0.3.21",
69
- "tsx": "4.22.0",
68
+ "tsx": "4.22.1",
70
69
  "typescript": "6.0.3",
71
70
  "typescript-eslint": "8.59.3",
72
71
  "vite": "8.0.13",