netheriteai-code 1.1.2 → 1.1.5

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/image.png ADDED
Binary file
package/package.json CHANGED
@@ -1,16 +1,10 @@
1
1
  {
2
2
  "name": "netheriteai-code",
3
- "version": "1.1.2",
3
+ "version": "1.1.5",
4
4
  "description": "NetheriteAI:Code by hurdacu. High-performance coding assistant.",
5
5
  "author": "hurdacu",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
- "files": [
9
- "bin",
10
- "src",
11
- "README.md",
12
- "package.json"
13
- ],
14
8
  "bin": {
15
9
  "netheriteai-code": "bin/netheriteai-code.js",
16
10
  "netheritecode": "bin/netheriteai-code.js",
package/src/cli.js CHANGED
@@ -11,10 +11,19 @@ import { printTable, resolveWorkspaceRoot } from "./utils.js";
11
11
 
12
12
  const execFileAsync = promisify(execFile);
13
13
 
14
- const VERSION = "1.1.2";
14
+ const VERSION = "1.1.5";
15
+
16
+ function isNewer(latest, current) {
17
+ const l = String(latest || "0.0.0").split(".").map(Number);
18
+ const c = String(current || "0.0.0").split(".").map(Number);
19
+ for (let i = 0; i < 3; i++) {
20
+ if (l[i] > (c[i] || 0)) return true;
21
+ if (l[i] < (c[i] || 0)) return false;
22
+ }
23
+ return false;
24
+ }
15
25
 
16
26
  async function handleAutoUpdate() {
17
- // If we were just restarted by an update, don't check again
18
27
  if (process.argv.includes("--no-update")) return;
19
28
 
20
29
  try {
@@ -24,7 +33,7 @@ async function handleAutoUpdate() {
24
33
  timeout: 3000,
25
34
  }).trim();
26
35
 
27
- if (latest && latest !== VERSION) {
36
+ if (latest && isNewer(latest, VERSION)) {
28
37
  const cols = process.stdout.columns || 80;
29
38
  const rows = process.stdout.rows || 24;
30
39
  const msg = "Updating NetheriteAI:Code...";
@@ -55,7 +64,6 @@ async function handleAutoUpdate() {
55
64
  process.stdout.write(`\u001b[${y};${dx}H\u001b[1m${doneMsg}\u001b[0m`);
56
65
  process.stdout.write("\u001b[?1049l");
57
66
 
58
- // Pass the skip flag to the restarted process to prevent looping
59
67
  spawn(process.argv[0], [...process.argv.slice(1), "--no-update"], { stdio: "inherit", detached: false });
60
68
  process.exit(0);
61
69
  }
package/src/ollama.js CHANGED
@@ -59,12 +59,15 @@ export async function listModels() {
59
59
 
60
60
  export async function pickDefaultModel() {
61
61
  try {
62
- const models = await listModels();
63
- if (!models.length) throw new Error("Server down");
64
- const match = models.find(m => PREFERRED_DEFAULT_MODELS.some(p => p.toLowerCase() === m.name.toLowerCase()));
65
- return match ? match.name : models[0].name;
62
+ const models = await listModels().catch(() => []);
63
+ if (models.length > 0) {
64
+ const match = models.find(m => PREFERRED_DEFAULT_MODELS.some(p => p.toLowerCase() === m.name.toLowerCase()));
65
+ if (match) return match.name;
66
+ }
67
+ // If list fails or no match, fallback to the first preferred model directly
68
+ return PREFERRED_DEFAULT_MODELS[0];
66
69
  } catch {
67
- throw new Error("Server down");
70
+ return PREFERRED_DEFAULT_MODELS[0];
68
71
  }
69
72
  }
70
73
 
package/src/tui.js CHANGED
@@ -495,8 +495,11 @@ export function runTui({
495
495
  onSubmit,
496
496
  }) {
497
497
  return new Promise((resolve) => {
498
- if (process.stdin.isTTY) process.stdin.setRawMode(true);
499
- // Disable wrap and enter alternate buffer
498
+ try {
499
+ if (process.stdin.isTTY) process.stdin.setRawMode(true);
500
+ } catch {
501
+ // Ignore EIO or other TTY errors
502
+ }
500
503
  process.stdout.write("\u001b[?1049h\u001b[?25l\u001b[?1000h\u001b[?1006h\u001b[?7l\u001b[2J");
501
504
  setTerminalTitle("NetheriteAI:Code by hurdacu");
502
505