@novastorm-ai/cli 0.0.5 → 0.0.7
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/bin/nova.js
CHANGED
|
@@ -943,7 +943,7 @@ async function startCommand() {
|
|
|
943
943
|
projectHash = createHash2("sha256").update(cwd).digest("hex");
|
|
944
944
|
}
|
|
945
945
|
const telemetry = new Telemetry();
|
|
946
|
-
const cliPkg = await import("./package-
|
|
946
|
+
const cliPkg = await import("./package-MIQKXQDV.js").catch(
|
|
947
947
|
() => ({ default: { version: "0.0.1" } })
|
|
948
948
|
);
|
|
949
949
|
telemetry.send({
|
|
@@ -2018,6 +2018,15 @@ import { execFile as execFile2 } from "child_process";
|
|
|
2018
2018
|
import chalk10 from "chalk";
|
|
2019
2019
|
import ora3 from "ora";
|
|
2020
2020
|
var PKG_NAME = "@novastorm-ai/cli";
|
|
2021
|
+
function isNewer(remote, local) {
|
|
2022
|
+
const r = remote.split(".").map(Number);
|
|
2023
|
+
const l = local.split(".").map(Number);
|
|
2024
|
+
for (let i = 0; i < 3; i++) {
|
|
2025
|
+
if ((r[i] ?? 0) > (l[i] ?? 0)) return true;
|
|
2026
|
+
if ((r[i] ?? 0) < (l[i] ?? 0)) return false;
|
|
2027
|
+
}
|
|
2028
|
+
return false;
|
|
2029
|
+
}
|
|
2021
2030
|
async function getLatestVersion() {
|
|
2022
2031
|
try {
|
|
2023
2032
|
const controller = new AbortController();
|
|
@@ -2066,8 +2075,8 @@ async function updateCommand() {
|
|
|
2066
2075
|
currentVersion = pkg2.version;
|
|
2067
2076
|
} catch {
|
|
2068
2077
|
}
|
|
2069
|
-
if (currentVersion
|
|
2070
|
-
spinner.succeed(`Already on the latest version ${chalk10.green(
|
|
2078
|
+
if (!isNewer(latest, currentVersion)) {
|
|
2079
|
+
spinner.succeed(`Already on the latest version ${chalk10.green(currentVersion)}`);
|
|
2071
2080
|
return;
|
|
2072
2081
|
}
|
|
2073
2082
|
spinner.text = `Updating ${chalk10.gray(currentVersion)} \u2192 ${chalk10.green(latest)}...`;
|
|
@@ -2082,15 +2091,28 @@ async function updateCommand() {
|
|
|
2082
2091
|
}
|
|
2083
2092
|
}
|
|
2084
2093
|
}
|
|
2094
|
+
var updateBannerInterval = null;
|
|
2085
2095
|
async function checkForUpdates(currentVersion) {
|
|
2086
2096
|
try {
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
`)
|
|
2097
|
+
let renderBanner2 = function() {
|
|
2098
|
+
if (!process.stdout.isTTY) return;
|
|
2099
|
+
process.stdout.write(
|
|
2100
|
+
`\x1B7\x1B[${rows};${x}H${msg}\x1B8`
|
|
2092
2101
|
);
|
|
2093
|
-
}
|
|
2102
|
+
};
|
|
2103
|
+
var renderBanner = renderBanner2;
|
|
2104
|
+
const latest = await getLatestVersion();
|
|
2105
|
+
if (!latest || !isNewer(latest, currentVersion)) return;
|
|
2106
|
+
const msg = chalk10.bgYellow.black(` UPDATE `) + chalk10.yellow(` ${currentVersion} \u2192 ${latest} `) + chalk10.gray(`run ${chalk10.cyan("nova update")}`);
|
|
2107
|
+
const columns = process.stdout.columns || 80;
|
|
2108
|
+
const rows = process.stdout.rows || 24;
|
|
2109
|
+
const plain = msg.replace(/\x1b\[[0-9;]*m/g, "");
|
|
2110
|
+
const x = Math.max(columns - plain.length - 1, 0);
|
|
2111
|
+
renderBanner2();
|
|
2112
|
+
updateBannerInterval = setInterval(renderBanner2, 5e3);
|
|
2113
|
+
process.on("exit", () => {
|
|
2114
|
+
if (updateBannerInterval) clearInterval(updateBannerInterval);
|
|
2115
|
+
});
|
|
2094
2116
|
} catch {
|
|
2095
2117
|
}
|
|
2096
2118
|
}
|
|
@@ -2170,7 +2192,8 @@ var BANNER = `\x1B[96m
|
|
|
2170
2192
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
2171
2193
|
\u2551 A M B I E N T D E V E L O P M E N T T O O L \u2551
|
|
2172
2194
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
2173
|
-
\x1B[0m
|
|
2195
|
+
\x1B[0m\x1B[90m https://cli.novastorm.ai\x1B[0m
|
|
2196
|
+
`;
|
|
2174
2197
|
async function run(argv = process.argv) {
|
|
2175
2198
|
const args = argv.slice(2);
|
|
2176
2199
|
const suppressBanner = args.includes("--version") || args.includes("-V") || args.includes("--help") || args.includes("-h");
|
package/dist/index.js
CHANGED