@yoooclaw/cli 0.1.0 → 0.1.2

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.cjs CHANGED
@@ -3692,7 +3692,7 @@ var COMMAND_TREE = [
3692
3692
  { name: "set-default-api-key <label>", summary: "切换 default api-key \uD83D\uDFE2" },
3693
3693
  {
3694
3694
  name: "token-rotate",
3695
- summary: "生成新 gateway token 并热重载 \uD83D\uDFE1",
3695
+ summary: "生成新 gateway token;daemon 在跑时随后 restart 生效 \uD83D\uDFE2",
3696
3696
  options: [{ flags: "--length <n>", summary: "token 字节长度", default: "32" }]
3697
3697
  },
3698
3698
  { name: "status", summary: "显示鉴权状态(本地检查,不调 daemon)\uD83D\uDFE2" },
@@ -3795,7 +3795,7 @@ var COMMAND_TREE = [
3795
3795
  },
3796
3796
  {
3797
3797
  name: "recording",
3798
- summary: "录音管理 \uD83D\uDFE2/\uD83D\uDFE1",
3798
+ summary: "录音查询与 ASR 配置 \uD83D\uDFE2",
3799
3799
  subcommands: [
3800
3800
  {
3801
3801
  name: "list",
@@ -3886,7 +3886,7 @@ var COMMAND_TREE = [
3886
3886
  name: "create",
3887
3887
  summary: "创建规则(--from-file / --intent ...)",
3888
3888
  options: [
3889
- { flags: "--from-file <path>", summary: "从 JSON/YAML 读规则(- 为 stdin)" },
3889
+ { flags: "--from-file <path>", summary: "从 JSON 读规则(- 为 stdin)" },
3890
3890
  { flags: "--name <text>", summary: "规则名" },
3891
3891
  { flags: "--intent <text>", summary: "自然语言意图描述" },
3892
3892
  { flags: "--light-action <json>", summary: "命中后的 light 动作 JSON" },
@@ -3897,7 +3897,7 @@ var COMMAND_TREE = [
3897
3897
  name: "update <id>",
3898
3898
  summary: "更新现有规则",
3899
3899
  options: [
3900
- { flags: "--from-file <path>", summary: "从 JSON/YAML 读规则(- 为 stdin)" },
3900
+ { flags: "--from-file <path>", summary: "从 JSON 读规则(- 为 stdin)" },
3901
3901
  { flags: "--name <text>", summary: "规则名" },
3902
3902
  { flags: "--intent <text>", summary: "自然语言意图描述" },
3903
3903
  { flags: "--light-action <json>", summary: "命中后的 light 动作 JSON" },
@@ -3959,7 +3959,7 @@ var COMMAND_TREE = [
3959
3959
  shortcuts: [
3960
3960
  {
3961
3961
  name: "+test",
3962
- summary: "端到端联通性自检(echo 回环)",
3962
+ summary: "daemon 本地 ingest + 鉴权自检(echo 回环)",
3963
3963
  options: [{ flags: "--client <label>", summary: "用指定 clientLabel 的 api-key 做回环写入" }]
3964
3964
  }
3965
3965
  ]
@@ -3982,10 +3982,10 @@ var COMMAND_TREE = [
3982
3982
  subcommands: [
3983
3983
  {
3984
3984
  name: "test",
3985
- summary: "模拟手机端调 daemon /notifications,验证连通/鉴权/relay \uD83D\uDFE1",
3985
+ summary: "模拟手机端调 daemon /notifications,验证本地连通与鉴权 \uD83D\uDFE1",
3986
3986
  options: [
3987
3987
  { flags: "--from-phone-ip <ip>", summary: "模拟来源 IP" },
3988
- { flags: "--via-relay", summary: "强制走 Relay 隧道" }
3988
+ { flags: "--via-relay", summary: "复用 tunnel +test 本地回环路径" }
3989
3989
  ]
3990
3990
  }
3991
3991
  ]
@@ -4047,7 +4047,7 @@ var COMMAND_TREE = [
4047
4047
  },
4048
4048
  {
4049
4049
  name: "doctor",
4050
- summary: "环境自检:Node/目录/keychain/daemon/relay \uD83D\uDFE2/\uD83D\uDFE1",
4050
+ summary: "本地环境自检:Node/目录/keychain/config/daemon \uD83D\uDFE2",
4051
4051
  options: [
4052
4052
  { flags: "--json", summary: "JSON 输出(给脚本用)" },
4053
4053
  { flags: "--fix", summary: "自动修复可修复的问题" }
@@ -4271,7 +4271,7 @@ function buildContext(flags) {
4271
4271
  var import_node_fs3 = require("node:fs");
4272
4272
  function readBuildInjectedVersion() {
4273
4273
  if (false) {}
4274
- const version = "0.1.0".trim();
4274
+ const version = "0.1.2".trim();
4275
4275
  return version || undefined;
4276
4276
  }
4277
4277
  function readVersionFromPackageJson() {
@@ -14224,14 +14224,21 @@ async function daemonStop(ctx) {
14224
14224
  removeLock(ctx.paths);
14225
14225
  throw new YoooclawError("YOOOCLAW_DAEMON_NOT_RUNNING", "daemon 未运行");
14226
14226
  }
14227
- try {
14228
- process.kill(lock.pid, "SIGTERM");
14229
- } catch {}
14227
+ const graceful = process.platform === "win32" ? "stop-endpoint" : "SIGTERM";
14228
+ if (graceful === "stop-endpoint") {
14229
+ try {
14230
+ await new DaemonClient(ctx.paths).post("/daemon/stop");
14231
+ } catch {}
14232
+ } else {
14233
+ try {
14234
+ process.kill(lock.pid, "SIGTERM");
14235
+ } catch {}
14236
+ }
14230
14237
  for (let i = 0;i < 100; i += 1) {
14231
14238
  await import_promises5.setTimeout(100);
14232
14239
  if (!isProcessAlive(lock.pid)) {
14233
14240
  removeLock(ctx.paths);
14234
- return { ok: true, stopped: lock.pid, signal: "SIGTERM" };
14241
+ return { ok: true, stopped: lock.pid, signal: graceful };
14235
14242
  }
14236
14243
  }
14237
14244
  try {
@@ -14613,9 +14620,9 @@ function wrapAction(handler) {
14613
14620
  try {
14614
14621
  ctx = buildContext(globals);
14615
14622
  const result = await handler(ctx, positionals, opts);
14616
- renderResult(result, { format: ctx.format });
14623
+ renderResult(result, { format: opts.json === true ? "json" : ctx.format });
14617
14624
  } catch (err) {
14618
- const format = ctx?.format ?? "json";
14625
+ const format = opts.json === true ? "json" : ctx?.format ?? "json";
14619
14626
  renderError(err, { format });
14620
14627
  process.exitCode = err instanceof YoooclawError ? err.exitCode : 1;
14621
14628
  }
@@ -14678,5 +14685,5 @@ async function run(argv = process.argv) {
14678
14685
  await program.parseAsync(argv);
14679
14686
  }
14680
14687
 
14681
- //# debugId=AAE31E672291A0D664756E2164756E21
14688
+ //# debugId=8A566BC43CA9738664756E2164756E21
14682
14689
  //# sourceMappingURL=index.cjs.map