algocoach 0.1.7 → 0.1.8
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/cli/dist/index.js +109844 -0
- package/cli/index.ts +17 -0
- package/package.json +1 -1
package/cli/index.ts
CHANGED
|
@@ -5,6 +5,22 @@ import fs from "fs"
|
|
|
5
5
|
const CONFIG_DIR = path.join(process.env.HOME || process.env.USERPROFILE || ".", ".algocoach")
|
|
6
6
|
const ENV_PATH = path.join(CONFIG_DIR, ".env")
|
|
7
7
|
|
|
8
|
+
async function checkVersion() {
|
|
9
|
+
try {
|
|
10
|
+
const pkg = JSON.parse(await Bun.file(path.join(import.meta.dir, "../package.json")).text())
|
|
11
|
+
const current = pkg.version
|
|
12
|
+
const res = await fetch("https://registry.npmjs.org/algocoach/latest", {
|
|
13
|
+
signal: AbortSignal.timeout(3000),
|
|
14
|
+
})
|
|
15
|
+
const data: any = await res.json()
|
|
16
|
+
const latest = data.version
|
|
17
|
+
if (latest !== current) {
|
|
18
|
+
console.log(` Update available: ${current} → ${latest}`)
|
|
19
|
+
console.log(` Run: npm install -g algocoach@latest\n`)
|
|
20
|
+
}
|
|
21
|
+
} catch {}
|
|
22
|
+
}
|
|
23
|
+
|
|
8
24
|
function envTemplate() {
|
|
9
25
|
return [
|
|
10
26
|
"# AlgoCoach Configuration",
|
|
@@ -64,6 +80,7 @@ Then run: algocoach start
|
|
|
64
80
|
}
|
|
65
81
|
|
|
66
82
|
async function cmdStart() {
|
|
83
|
+
checkVersion()
|
|
67
84
|
fs.mkdirSync(CONFIG_DIR, { recursive: true })
|
|
68
85
|
|
|
69
86
|
if (!fs.existsSync(ENV_PATH)) {
|