@daluo/cli 0.1.1 → 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/BUILD-STAMP CHANGED
@@ -1 +1 @@
1
- c51cb52a2f6492f5d4896517c5705aae4be2f5a9
1
+ 1b553325ef03eeafb4617ecd15d613b13e6dd54a
package/dist/run.js CHANGED
@@ -46470,10 +46470,19 @@ function collectMessages(error) {
46470
46470
  }
46471
46471
  return out;
46472
46472
  }
46473
+ var CliUsageError = class extends Error {
46474
+ constructor(message) {
46475
+ super(message);
46476
+ this.name = "CliUsageError";
46477
+ }
46478
+ };
46473
46479
  function classifyKind(error) {
46474
46480
  const text2 = collectMessages(error).join("\n");
46475
46481
  const name = error instanceof Error ? error.name : "";
46476
46482
  const msg = error instanceof Error ? error.message : String(error);
46483
+ if (error instanceof CliUsageError) {
46484
+ return { kind: "usage", exitCode: EXIT.input };
46485
+ }
46477
46486
  if (text2.includes("DALUO_LLM_")) {
46478
46487
  const userMessage = zodIssuesToUserMessage(error);
46479
46488
  return {
@@ -46800,9 +46809,7 @@ async function main() {
46800
46809
  const cwdIdx = args.indexOf("--cwd");
46801
46810
  const workspaceRoot = cwdIdx >= 0 ? args[cwdIdx + 1] : void 0;
46802
46811
  if (cwdIdx >= 0 && (workspaceRoot === void 0 || workspaceRoot.startsWith("--"))) {
46803
- console.error("daluo serve: `--cwd` \u540E\u9762\u8981\u7ED9\u4E00\u4E2A\u76EE\u5F55");
46804
- process.exitCode = EXIT.input;
46805
- return;
46812
+ throw new CliUsageError("`daluo serve --cwd` \u540E\u9762\u8981\u7ED9\u4E00\u4E2A\u76EE\u5F55");
46806
46813
  }
46807
46814
  await runServeCommand2({ cwd: process.cwd(), ...workspaceRoot === void 0 ? {} : { workspaceRoot }, env: process.env, argPort: args[1] === "--cwd" || args[1] === workspaceRoot ? void 0 : args[1] });
46808
46815
  return;
@@ -46821,29 +46828,22 @@ async function main() {
46821
46828
  "\n DALUO_DANGER=1 \u5371\u9669\u6A21\u5F0F\uFF1A\u4E0D\u6302 Guardian \u5BA1\u67E5 + \u6743\u9650\u6863\u56FA\u5B9A danger-full",
46822
46829
  "\n \uFF08policy \u786C\u5899\u4E0E\u5DE5\u5177\u6821\u9A8C\u4ECD\u5728\uFF1B\u5F00\u542F\u65F6\u542F\u52A8\u884C\u4F1A\u660E\u8BF4\uFF09"
46823
46830
  );
46824
- process.exit(EXIT.input);
46831
+ throw new CliUsageError(command !== "run" ? `\u672A\u77E5\u547D\u4EE4 ${command}\uFF08\u7528\u6CD5\u89C1\u4E0A\u65B9\uFF09` : "\u7F3A\u5C11 prompt\uFF08\u7528\u6CD5\u89C1\u4E0A\u65B9\uFF09");
46825
46832
  }
46826
46833
  const formatMissing = missingValueError(parsed, "output-format");
46827
- if (formatMissing !== void 0) {
46828
- console.error(`daluo run: ${formatMissing}`);
46829
- process.exit(EXIT.input);
46830
- }
46834
+ if (formatMissing !== void 0) throw new CliUsageError(formatMissing);
46831
46835
  let outputFormat;
46832
46836
  try {
46833
46837
  outputFormat = parseOutputFormat(parsed.options.get("output-format"));
46834
46838
  } catch (error) {
46835
- console.error(`daluo run: ${error instanceof Error ? error.message : String(error)}`);
46836
- process.exit(EXIT.input);
46839
+ throw new CliUsageError(error instanceof Error ? error.message : String(error));
46837
46840
  }
46838
46841
  const structured = isStructuredFormat(outputFormat);
46839
46842
  const debug = parsed.flags.has("debug");
46840
46843
  if (debug) enableSlowProbe();
46841
46844
  const stdoutGuard = structured ? installStdoutGuard({ stdout: process.stdout, stderr: process.stderr }) : void 0;
46842
46845
  const resumeMissing = missingValueError(parsed, "resume");
46843
- if (resumeMissing !== void 0) {
46844
- console.error(`daluo run: ${resumeMissing}`);
46845
- process.exit(EXIT.input);
46846
- }
46846
+ if (resumeMissing !== void 0) throw new CliUsageError(resumeMissing);
46847
46847
  const resumeRaw = parsed.options.get("resume");
46848
46848
  const resolved = resumeRaw ? await resolveResumeAcrossWorktrees(resumeRaw, process.cwd()) : void 0;
46849
46849
  if (resolved?.note !== void 0) process.stderr.write(`${resolved.note}
@@ -47010,15 +47010,23 @@ ${result.reply}
47010
47010
  }
47011
47011
  function structuredFromArgv(argv) {
47012
47012
  let raw;
47013
+ let \u89C1\u8FC7 = false;
47013
47014
  for (let i = 0; i < argv.length; i += 1) {
47014
47015
  const a = argv[i];
47015
- if (a === "--output-format") raw = argv[i + 1];
47016
- else if (a.startsWith("--output-format=")) raw = a.slice("--output-format=".length);
47016
+ if (a === "--output-format") {
47017
+ \u89C1\u8FC7 = true;
47018
+ raw = argv[i + 1];
47019
+ } else if (a.startsWith("--output-format=")) {
47020
+ \u89C1\u8FC7 = true;
47021
+ raw = a.slice("--output-format=".length);
47022
+ }
47017
47023
  }
47024
+ if (!\u89C1\u8FC7) return false;
47025
+ if (raw === void 0) return true;
47018
47026
  try {
47019
47027
  return isStructuredFormat(parseOutputFormat(raw));
47020
47028
  } catch {
47021
- return false;
47029
+ return true;
47022
47030
  }
47023
47031
  }
47024
47032
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daluo/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "大罗 CLI — 真实 agent 会话入口",
5
5
  "type": "module",
6
6
  "bin": {