aether-code 0.42.0 → 0.43.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.
- package/LICENSE +21 -21
- package/README.md +2 -0
- package/bin/aether-code.js +515 -513
- package/package.json +77 -75
- package/scripts/postinstall.js +182 -0
- package/skills/adult-creative-writing.md +60 -60
- package/skills/debugging.md +51 -51
- package/skills/game-modding.md +73 -73
- package/skills/reverse-engineering.md +41 -41
- package/skills/scraping-automation.md +77 -77
- package/skills/security-research.md +67 -67
- package/src/agent.js +170 -219
- package/src/api.js +22 -32
- package/src/box-input.js +141 -36
- package/src/config.js +38 -38
- package/src/diff.js +49 -49
- package/src/ink-input.js +91 -91
- package/src/mcp-cli.js +94 -94
- package/src/mcp-registry.js +266 -266
- package/src/mcp.js +259 -260
- package/src/menu.js +83 -83
- package/src/render.js +141 -107
- package/src/repl.js +221 -257
- package/src/setup.js +139 -141
- package/src/tools.js +911 -1288
- package/src/update-check.js +64 -7
- package/src/project-context.js +0 -707
- package/src/sessions.js +0 -167
- package/src/version.js +0 -15
package/src/update-check.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
// Startup update check
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// Startup update check + auto-update. On every REPL launch, checks the npm
|
|
2
|
+
// registry and silently installs the latest version in the background if one
|
|
3
|
+
// exists. Never throws, bounded by a short timeout so it can't slow startup.
|
|
4
4
|
|
|
5
|
-
import { readFileSync } from "node:fs";
|
|
5
|
+
import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { dirname, join } from "node:path";
|
|
8
|
+
import { tmpdir } from "node:os";
|
|
9
|
+
import { spawn } from "node:child_process";
|
|
8
10
|
import { c } from "./render.js";
|
|
9
11
|
|
|
10
12
|
export function currentVersion() {
|
|
@@ -27,10 +29,65 @@ export function cmpVersion(a, b) {
|
|
|
27
29
|
return 0;
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
const COOLDOWN_FILE = join(tmpdir(), "aether-update-ts");
|
|
33
|
+
const COOLDOWN_MS = 3600_000; // 1 hour
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Check for updates. If a newer version exists on npm, spawn a background
|
|
37
|
+
* `npm install -g` to auto-install it. Returns a one-line status message
|
|
38
|
+
* or null. Cooldown: only checks once per hour.
|
|
39
|
+
*/
|
|
40
|
+
export async function autoUpdate({ fetchImpl = fetch, timeoutMs = 2000 } = {}) {
|
|
41
|
+
const current = currentVersion();
|
|
42
|
+
if (!current) return null;
|
|
43
|
+
|
|
44
|
+
// Skip if we checked less than 1 hour ago
|
|
45
|
+
try {
|
|
46
|
+
const ts = parseInt(readFileSync(COOLDOWN_FILE, "utf8"), 10);
|
|
47
|
+
if (Date.now() - ts < COOLDOWN_MS) return null;
|
|
48
|
+
} catch { /* no file or parse error — check now */ }
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
const ac = new AbortController();
|
|
52
|
+
const t = setTimeout(() => ac.abort(), timeoutMs);
|
|
53
|
+
let res;
|
|
54
|
+
try {
|
|
55
|
+
res = await fetchImpl("https://registry.npmjs.org/aether-code/latest", { signal: ac.signal });
|
|
56
|
+
} finally {
|
|
57
|
+
clearTimeout(t);
|
|
58
|
+
}
|
|
59
|
+
if (!res || !res.ok) return null;
|
|
60
|
+
const latest = (await res.json())?.version;
|
|
61
|
+
|
|
62
|
+
// Write cooldown regardless of whether an update is available
|
|
63
|
+
try { writeFileSync(COOLDOWN_FILE, String(Date.now())); } catch { /* ignore */ }
|
|
64
|
+
|
|
65
|
+
if (!latest || cmpVersion(latest, current) <= 0) return null;
|
|
66
|
+
|
|
67
|
+
// Spawn background npm install — detached so it doesn't block the CLI.
|
|
68
|
+
// On Windows, `npm` is a cmd script, so shell:true is required.
|
|
69
|
+
const child = spawn("npm", ["install", "-g", `aether-code@${latest}`], {
|
|
70
|
+
detached: true,
|
|
71
|
+
stdio: "ignore",
|
|
72
|
+
shell: true,
|
|
73
|
+
windowsHide: true,
|
|
74
|
+
});
|
|
75
|
+
child.unref();
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
c.cyan("↑ auto-updating ") +
|
|
79
|
+
c.gray(current) + c.gray(" → ") + c.bold(c.green(latest)) +
|
|
80
|
+
c.gray(" (background — applies next launch)")
|
|
81
|
+
);
|
|
82
|
+
} catch {
|
|
83
|
+
/* offline / aborted / parse error — stay silent */
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
|
|
30
88
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* (offline, timeout, registry hiccup) resolves to null silently.
|
|
89
|
+
* Legacy nudge-only check (kept for the test suite). Same as before: returns
|
|
90
|
+
* a one-line "update available" string or null.
|
|
34
91
|
*/
|
|
35
92
|
export async function checkForUpdate({ fetchImpl = fetch, timeoutMs = 2000 } = {}) {
|
|
36
93
|
const current = currentVersion();
|