@zzznpm/clavis 1.2.0 → 1.2.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/README.md +2 -2
- package/dist/index.js +19 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -146,10 +146,10 @@ OpenTUI uses Bun's native FFI runtime. Install Bun first if it is not already av
|
|
|
146
146
|
curl -fsSL https://bun.sh/install | bash
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
Then
|
|
149
|
+
Then start the TUI with the normal CLI command. If Bun is installed, Clavis automatically relaunches the TUI with Bun:
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
|
-
|
|
152
|
+
clavis tui
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
### TUI Components
|
package/dist/index.js
CHANGED
|
@@ -1701,6 +1701,7 @@ import { program } from "commander";
|
|
|
1701
1701
|
import { createInterface } from "readline";
|
|
1702
1702
|
import { spawn } from "child_process";
|
|
1703
1703
|
import { createRequire } from "module";
|
|
1704
|
+
import { fileURLToPath } from "url";
|
|
1704
1705
|
import { promises as fs3 } from "fs";
|
|
1705
1706
|
|
|
1706
1707
|
// src/services/gist.js
|
|
@@ -1774,6 +1775,19 @@ import { setPassword as setPassword2, getPassword as getPassword3 } from "cross-
|
|
|
1774
1775
|
var require2 = createRequire(import.meta.url);
|
|
1775
1776
|
var { version } = require2("../package.json");
|
|
1776
1777
|
var storage = new SecretStorage_default();
|
|
1778
|
+
var startTUIWithBun = () => new Promise((resolve, reject) => {
|
|
1779
|
+
const entryFile = fileURLToPath(import.meta.url);
|
|
1780
|
+
const child = spawn("bun", ["--preload", "@opentui/solid/preload", entryFile, ...process.argv.slice(2)], { stdio: "inherit" });
|
|
1781
|
+
child.on("error", (error) => {
|
|
1782
|
+
if (error.code === "ENOENT") reject(new Error("Bun is required for the TUI. Install it from https://bun.sh."));
|
|
1783
|
+
else reject(error);
|
|
1784
|
+
});
|
|
1785
|
+
child.on("exit", (code, signal) => {
|
|
1786
|
+
if (signal) reject(new Error(`Bun TUI process exited from signal ${signal}`));
|
|
1787
|
+
else if (code === 0) resolve();
|
|
1788
|
+
else reject(new Error(`Bun TUI process exited with code ${code}`));
|
|
1789
|
+
});
|
|
1790
|
+
});
|
|
1777
1791
|
var readPassword = (prompt) => new Promise((resolve) => {
|
|
1778
1792
|
process.stdout.write(prompt);
|
|
1779
1793
|
if (!process.stdin.isTTY) {
|
|
@@ -1929,20 +1943,12 @@ program.command("clear").description("Clear all tokens (use with caution!)").act
|
|
|
1929
1943
|
readline.close();
|
|
1930
1944
|
});
|
|
1931
1945
|
});
|
|
1932
|
-
program.command("tui").description("Start interactive TUI interface").action(
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
await startTUI();
|
|
1936
|
-
} catch (error) {
|
|
1946
|
+
program.command("tui").description("Start interactive TUI interface").action(() => {
|
|
1947
|
+
const runTUI = typeof Bun === "undefined" ? startTUIWithBun : () => Promise.resolve().then(() => (init_tui(), tui_exports)).then(({ default: startTUI }) => startTUI());
|
|
1948
|
+
return runTUI().catch((error) => {
|
|
1937
1949
|
console.error("Failed to start TUI:", error.message);
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
console.error("Install Bun from https://bun.sh, then run: npm run go");
|
|
1941
|
-
} else {
|
|
1942
|
-
console.error("Make sure all dependencies are installed: npm install");
|
|
1943
|
-
}
|
|
1944
|
-
process.exit(1);
|
|
1945
|
-
}
|
|
1950
|
+
process.exitCode = 1;
|
|
1951
|
+
});
|
|
1946
1952
|
});
|
|
1947
1953
|
program.command("exec").description("Execute a command with a token injected as environment variable").argument("<sid>", "Token sid").allowExcessArguments(true).action(async (sid) => {
|
|
1948
1954
|
const dashDashIndex = process.argv.indexOf("--");
|