@devness/useai-cli 0.4.2 → 0.4.4
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/index.js +37 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
|
-
import { Command as
|
|
9
|
+
import { Command as Command10 } from "commander";
|
|
10
10
|
|
|
11
11
|
// ../shared/dist/constants/paths.js
|
|
12
12
|
import { join } from "path";
|
|
@@ -29,7 +29,7 @@ var SYSTEMD_SERVICE_PATH = join(homedir(), ".config", "systemd", "user", "useai-
|
|
|
29
29
|
var WINDOWS_STARTUP_SCRIPT_PATH = join(process.env["APPDATA"] ?? join(homedir(), "AppData", "Roaming"), "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "useai-daemon.vbs");
|
|
30
30
|
|
|
31
31
|
// ../shared/dist/constants/version.js
|
|
32
|
-
var VERSION = "0.4.
|
|
32
|
+
var VERSION = "0.4.4";
|
|
33
33
|
|
|
34
34
|
// ../shared/dist/constants/defaults.js
|
|
35
35
|
var DEFAULT_CONFIG = {
|
|
@@ -5782,8 +5782,41 @@ var autostartStatusCommand = new Command8("status").description("Check auto-star
|
|
|
5782
5782
|
var autostartCommand = new Command8("autostart").description("Manage auto-start service").addCommand(autostartInstallCommand).addCommand(autostartRemoveCommand).addCommand(autostartStatusCommand);
|
|
5783
5783
|
var daemonCommand = new Command8("daemon").description("Manage the UseAI HTTP daemon").addCommand(startCommand).addCommand(stopCommand).addCommand(statusCommand2).addCommand(autostartCommand);
|
|
5784
5784
|
|
|
5785
|
+
// src/commands/serve.ts
|
|
5786
|
+
import { Command as Command9 } from "commander";
|
|
5787
|
+
import { exec } from "child_process";
|
|
5788
|
+
import chalk8 from "chalk";
|
|
5789
|
+
var serveCommand = new Command9("serve").description("Open the local UseAI dashboard").option("--open", "Open the dashboard in your default browser").action(async (opts) => {
|
|
5790
|
+
const url = `http://127.0.0.1:${DAEMON_PORT}/dashboard`;
|
|
5791
|
+
console.log(chalk8.dim(" Ensuring daemon is running..."));
|
|
5792
|
+
const started = await ensureDaemon();
|
|
5793
|
+
if (!started) {
|
|
5794
|
+
console.log(chalk8.red(" Failed to start daemon. Try: useai daemon start --foreground"));
|
|
5795
|
+
process.exit(1);
|
|
5796
|
+
}
|
|
5797
|
+
console.log(chalk8.green(` Dashboard running at ${chalk8.bold(url)}`));
|
|
5798
|
+
if (opts.open) {
|
|
5799
|
+
const cmd = process.platform === "darwin" ? "open" : "xdg-open";
|
|
5800
|
+
exec(`${cmd} ${url}`, (err) => {
|
|
5801
|
+
if (err) {
|
|
5802
|
+
console.log(chalk8.yellow(` Could not open browser: ${err.message}`));
|
|
5803
|
+
console.log(chalk8.dim(` Open manually: ${url}`));
|
|
5804
|
+
}
|
|
5805
|
+
});
|
|
5806
|
+
}
|
|
5807
|
+
console.log(chalk8.dim(" Press Ctrl+C to exit"));
|
|
5808
|
+
const keepAlive = setInterval(() => {
|
|
5809
|
+
}, 6e4);
|
|
5810
|
+
const shutdown = () => {
|
|
5811
|
+
clearInterval(keepAlive);
|
|
5812
|
+
process.exit(0);
|
|
5813
|
+
};
|
|
5814
|
+
process.on("SIGINT", shutdown);
|
|
5815
|
+
process.on("SIGTERM", shutdown);
|
|
5816
|
+
});
|
|
5817
|
+
|
|
5785
5818
|
// src/index.ts
|
|
5786
|
-
var program = new
|
|
5819
|
+
var program = new Command10();
|
|
5787
5820
|
program.name("useai").description("useai.dev \u2014 Track your AI-assisted development workflow").version(VERSION);
|
|
5788
5821
|
program.addCommand(statsCommand);
|
|
5789
5822
|
program.addCommand(statusCommand);
|
|
@@ -5793,4 +5826,5 @@ program.addCommand(exportCommand);
|
|
|
5793
5826
|
program.addCommand(purgeCommand);
|
|
5794
5827
|
program.addCommand(mcpCommand);
|
|
5795
5828
|
program.addCommand(daemonCommand);
|
|
5829
|
+
program.addCommand(serveCommand);
|
|
5796
5830
|
program.parse();
|