@lifeaitools/clauth 0.3.0 → 0.3.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.
@@ -209,13 +209,15 @@ async function actionStart(opts) {
209
209
  }
210
210
  console.log(chalk.green(" ✓ Vault auth verified"));
211
211
 
212
- // Spawn detached daemon child
212
+ // Spawn detached daemon child via the clauth CLI entry point
213
213
  const { spawn } = await import("child_process");
214
214
  const { fileURLToPath } = await import("url");
215
+ const { dirname, join } = await import("path");
215
216
  const __filename = fileURLToPath(import.meta.url);
217
+ const cliEntry = join(dirname(__filename), "..", "index.js");
216
218
 
217
- // Build args: node serve.js --action start --port N --pw PW [--services S]
218
- const childArgs = [__filename, "--action", "start", "--port", String(port), "--pw", password];
219
+ // Build args: node index.js serve start --port N --pw PW [--services S]
220
+ const childArgs = [cliEntry, "serve", "start", "--port", String(port), "--pw", password];
219
221
  if (opts.services) childArgs.push("--services", opts.services);
220
222
 
221
223
  const out = fs.openSync(LOG_FILE, "a");
@@ -226,11 +228,19 @@ async function actionStart(opts) {
226
228
  });
227
229
  child.unref();
228
230
 
229
- // Give it a moment then verify
230
- await new Promise(r => setTimeout(r, 800));
231
+ // Give it time to bind and write PID file (Windows spawn is slower)
232
+ // Verify via HTTP ping (process.kill(pid,0) fails on Windows for detached processes)
233
+ let started = false;
234
+ for (let attempt = 0; attempt < 5; attempt++) {
235
+ await new Promise(r => setTimeout(r, 1000));
236
+ try {
237
+ const resp = await fetch(`http://127.0.0.1:${port}/ping`);
238
+ if (resp.ok) { started = true; break; }
239
+ } catch {}
240
+ }
231
241
 
232
242
  const info = readPid();
233
- if (info && isProcessAlive(info.pid)) {
243
+ if (started && info) {
234
244
  console.log(chalk.green(`\n 🔐 clauth serve started`));
235
245
  console.log(chalk.gray(` PID: ${info.pid}`));
236
246
  console.log(chalk.gray(` Port: 127.0.0.1:${info.port}`));
package/cli/index.js CHANGED
@@ -11,7 +11,7 @@ import * as api from "./api.js";
11
11
  import os from "os";
12
12
 
13
13
  const config = new Conf({ projectName: "clauth" });
14
- const VERSION = "0.3.0";
14
+ const VERSION = "0.3.1";
15
15
 
16
16
  // ============================================================
17
17
  // Password prompt helper
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/clauth",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Hardware-bound credential vault for the LIFEAI infrastructure stack",
5
5
  "type": "module",
6
6
  "bin": {