clixad 0.0.1-beta.2 → 0.0.1-beta.3
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/clixad.mjs +38 -5
- package/package.json +1 -1
package/dist/clixad.mjs
CHANGED
|
@@ -1497,6 +1497,26 @@ var init_browser = __esm({
|
|
|
1497
1497
|
}
|
|
1498
1498
|
});
|
|
1499
1499
|
|
|
1500
|
+
// src/version.ts
|
|
1501
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
1502
|
+
function readVersion() {
|
|
1503
|
+
try {
|
|
1504
|
+
const url = new URL("../package.json", import.meta.url);
|
|
1505
|
+
const pkg = JSON.parse(readFileSync5(url, "utf8"));
|
|
1506
|
+
return typeof pkg.version === "string" && pkg.version ? pkg.version : "unknown";
|
|
1507
|
+
} catch {
|
|
1508
|
+
return "unknown";
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
var VERSION, VERSION_LABEL;
|
|
1512
|
+
var init_version = __esm({
|
|
1513
|
+
"src/version.ts"() {
|
|
1514
|
+
"use strict";
|
|
1515
|
+
VERSION = readVersion();
|
|
1516
|
+
VERSION_LABEL = `v${VERSION}`;
|
|
1517
|
+
}
|
|
1518
|
+
});
|
|
1519
|
+
|
|
1500
1520
|
// src/compact.ts
|
|
1501
1521
|
function estimateTokens(text) {
|
|
1502
1522
|
return Math.ceil(text.length / 4);
|
|
@@ -2102,7 +2122,7 @@ function App({ client, config, wallet, session, initialTask }) {
|
|
|
2102
2122
|
earnedUsdToday: wallet?.earned_usd_today ?? 0,
|
|
2103
2123
|
maxRewardUsd: wallet?.max_reward_usd_per_day ?? 0,
|
|
2104
2124
|
cwd: process.cwd(),
|
|
2105
|
-
version:
|
|
2125
|
+
version: VERSION_LABEL
|
|
2106
2126
|
})
|
|
2107
2127
|
}
|
|
2108
2128
|
]);
|
|
@@ -2817,6 +2837,7 @@ var init_app = __esm({
|
|
|
2817
2837
|
init_compact();
|
|
2818
2838
|
init_kimi();
|
|
2819
2839
|
init_browser();
|
|
2840
|
+
init_version();
|
|
2820
2841
|
init_tools();
|
|
2821
2842
|
init_permissions();
|
|
2822
2843
|
init_session();
|
|
@@ -2880,17 +2901,21 @@ function titleEnabled({ isTTY, env }) {
|
|
|
2880
2901
|
function titleSequence(title) {
|
|
2881
2902
|
return `\x1B]0;${title.replace(/[\x00-\x1f\x7f]/g, " ").trim()}\x07`;
|
|
2882
2903
|
}
|
|
2883
|
-
function
|
|
2904
|
+
function titleStream(streams = [process.stdout, process.stderr]) {
|
|
2905
|
+
return streams.find((s) => s?.isTTY);
|
|
2906
|
+
}
|
|
2907
|
+
function setTerminalTitle(title = APP_TITLE, out = titleStream()) {
|
|
2884
2908
|
process.title = title.toLowerCase();
|
|
2885
|
-
if (!titleEnabled({ isTTY: out.isTTY, env: process.env })) return;
|
|
2909
|
+
if (!out || !titleEnabled({ isTTY: out.isTTY, env: process.env })) return;
|
|
2886
2910
|
out.write(titleSequence(title));
|
|
2887
2911
|
}
|
|
2888
|
-
function clearTerminalTitle(out =
|
|
2889
|
-
if (!titleEnabled({ isTTY: out.isTTY, env: process.env })) return;
|
|
2912
|
+
function clearTerminalTitle(out = titleStream()) {
|
|
2913
|
+
if (!out || !titleEnabled({ isTTY: out.isTTY, env: process.env })) return;
|
|
2890
2914
|
out.write(titleSequence(""));
|
|
2891
2915
|
}
|
|
2892
2916
|
|
|
2893
2917
|
// src/main.ts
|
|
2918
|
+
init_version();
|
|
2894
2919
|
var c = {
|
|
2895
2920
|
cyan: (s) => `\x1B[36m${s}\x1B[0m`,
|
|
2896
2921
|
green: (s) => `\x1B[32m${s}\x1B[0m`,
|
|
@@ -2940,6 +2965,13 @@ async function main() {
|
|
|
2940
2965
|
case "--help":
|
|
2941
2966
|
case "-h":
|
|
2942
2967
|
return printHelp();
|
|
2968
|
+
// The first thing anyone types after an install, and it used to land in
|
|
2969
|
+
// `unknown command` and print the help with exit code 1. Bare, no "clixad"
|
|
2970
|
+
// prefix and no colour: it gets piped into scripts and issue reports.
|
|
2971
|
+
case "version":
|
|
2972
|
+
case "--version":
|
|
2973
|
+
case "-v":
|
|
2974
|
+
return void console.log(VERSION);
|
|
2943
2975
|
case void 0:
|
|
2944
2976
|
return repl(client, config);
|
|
2945
2977
|
default:
|
|
@@ -3340,6 +3372,7 @@ function printHelp() {
|
|
|
3340
3372
|
${c.cyan("code")} ["<task>"] launch the full Kimi CLI coding agent on the current dir
|
|
3341
3373
|
${c.cyan("--continue")} resume the last session in this directory
|
|
3342
3374
|
${c.cyan("--resume")} [id] list saved sessions, or resume one
|
|
3375
|
+
${c.cyan("--version")} print the version and exit
|
|
3343
3376
|
(no command) interactive coding REPL`);
|
|
3344
3377
|
}
|
|
3345
3378
|
main().catch((err) => {
|