@meshy-ai/cli 0.4.5 → 0.5.0

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.
Files changed (118) hide show
  1. package/README.md +5 -3
  2. package/dist/client/types.d.ts +0 -18
  3. package/dist/client/types.d.ts.map +1 -1
  4. package/dist/client/types.js +0 -28
  5. package/dist/client/types.js.map +1 -1
  6. package/dist/cmd/animation-catalog.js +4 -4
  7. package/dist/cmd/animation-catalog.js.map +1 -1
  8. package/dist/cmd/api.d.ts.map +1 -1
  9. package/dist/cmd/api.js +5 -5
  10. package/dist/cmd/api.js.map +1 -1
  11. package/dist/cmd/auth.d.ts.map +1 -1
  12. package/dist/cmd/auth.js +41 -25
  13. package/dist/cmd/auth.js.map +1 -1
  14. package/dist/cmd/auto-split.d.ts.map +1 -1
  15. package/dist/cmd/auto-split.js +0 -1
  16. package/dist/cmd/auto-split.js.map +1 -1
  17. package/dist/cmd/balance.d.ts.map +1 -1
  18. package/dist/cmd/balance.js +6 -6
  19. package/dist/cmd/balance.js.map +1 -1
  20. package/dist/cmd/creative-lab.d.ts.map +1 -1
  21. package/dist/cmd/creative-lab.js +0 -3
  22. package/dist/cmd/creative-lab.js.map +1 -1
  23. package/dist/cmd/delete.d.ts.map +1 -1
  24. package/dist/cmd/delete.js +4 -4
  25. package/dist/cmd/delete.js.map +1 -1
  26. package/dist/cmd/doctor.js +4 -4
  27. package/dist/cmd/doctor.js.map +1 -1
  28. package/dist/cmd/download.js +7 -7
  29. package/dist/cmd/download.js.map +1 -1
  30. package/dist/cmd/inspect.d.ts.map +1 -1
  31. package/dist/cmd/inspect.js +4 -4
  32. package/dist/cmd/inspect.js.map +1 -1
  33. package/dist/cmd/make.d.ts.map +1 -1
  34. package/dist/cmd/make.js +31 -99
  35. package/dist/cmd/make.js.map +1 -1
  36. package/dist/cmd/mesh.js +2 -2
  37. package/dist/cmd/mesh.js.map +1 -1
  38. package/dist/cmd/operations.d.ts +16 -0
  39. package/dist/cmd/operations.d.ts.map +1 -0
  40. package/dist/cmd/operations.js +66 -0
  41. package/dist/cmd/operations.js.map +1 -0
  42. package/dist/cmd/project.js +10 -10
  43. package/dist/cmd/project.js.map +1 -1
  44. package/dist/cmd/resources.d.ts +4 -4
  45. package/dist/cmd/resources.d.ts.map +1 -1
  46. package/dist/cmd/resources.js +6 -14
  47. package/dist/cmd/resources.js.map +1 -1
  48. package/dist/cmd/showcases.d.ts.map +1 -1
  49. package/dist/cmd/showcases.js +4 -4
  50. package/dist/cmd/showcases.js.map +1 -1
  51. package/dist/cmd/slicer.js +4 -4
  52. package/dist/cmd/slicer.js.map +1 -1
  53. package/dist/cmd/usage.js +4 -4
  54. package/dist/cmd/usage.js.map +1 -1
  55. package/dist/cmd/uv-unwrap.d.ts.map +1 -1
  56. package/dist/cmd/uv-unwrap.js +0 -1
  57. package/dist/cmd/uv-unwrap.js.map +1 -1
  58. package/dist/index.d.ts +4 -2
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +47 -60
  61. package/dist/index.js.map +1 -1
  62. package/dist/internal/command-helpers.d.ts +9 -16
  63. package/dist/internal/command-helpers.d.ts.map +1 -1
  64. package/dist/internal/command-helpers.js +14 -31
  65. package/dist/internal/command-helpers.js.map +1 -1
  66. package/dist/internal/context.d.ts +9 -8
  67. package/dist/internal/context.d.ts.map +1 -1
  68. package/dist/internal/context.js +14 -7
  69. package/dist/internal/context.js.map +1 -1
  70. package/dist/internal/errors.d.ts +2 -20
  71. package/dist/internal/errors.d.ts.map +1 -1
  72. package/dist/internal/errors.js +9 -88
  73. package/dist/internal/errors.js.map +1 -1
  74. package/dist/internal/global-options.d.ts.map +1 -1
  75. package/dist/internal/global-options.js +4 -1
  76. package/dist/internal/global-options.js.map +1 -1
  77. package/dist/internal/inspect.js +1 -1
  78. package/dist/internal/inspect.js.map +1 -1
  79. package/dist/internal/operation-store.d.ts +34 -0
  80. package/dist/internal/operation-store.d.ts.map +1 -1
  81. package/dist/internal/operation-store.js +64 -1
  82. package/dist/internal/operation-store.js.map +1 -1
  83. package/dist/internal/output.d.ts +4 -13
  84. package/dist/internal/output.d.ts.map +1 -1
  85. package/dist/internal/output.js +5 -26
  86. package/dist/internal/output.js.map +1 -1
  87. package/dist/internal/result.d.ts +1 -2
  88. package/dist/internal/result.d.ts.map +1 -1
  89. package/dist/internal/result.js +1 -1
  90. package/dist/internal/result.js.map +1 -1
  91. package/dist/internal/runtime.d.ts +2 -10
  92. package/dist/internal/runtime.d.ts.map +1 -1
  93. package/dist/internal/runtime.js +9 -16
  94. package/dist/internal/runtime.js.map +1 -1
  95. package/dist/internal/slicers.js +2 -2
  96. package/dist/internal/slicers.js.map +1 -1
  97. package/dist/internal/task-command.d.ts +5 -11
  98. package/dist/internal/task-command.d.ts.map +1 -1
  99. package/dist/internal/task-command.js +46 -190
  100. package/dist/internal/task-command.js.map +1 -1
  101. package/dist/internal/update-notifier.d.ts +5 -25
  102. package/dist/internal/update-notifier.d.ts.map +1 -1
  103. package/dist/internal/update-notifier.js +5 -58
  104. package/dist/internal/update-notifier.js.map +1 -1
  105. package/dist/internal/views.d.ts +7 -8
  106. package/dist/internal/views.d.ts.map +1 -1
  107. package/dist/internal/views.js +24 -9
  108. package/dist/internal/views.js.map +1 -1
  109. package/dist/root.d.ts +0 -5
  110. package/dist/root.d.ts.map +1 -1
  111. package/dist/root.js +3 -19
  112. package/dist/root.js.map +1 -1
  113. package/package.json +1 -1
  114. package/skills/meshy-cli/SKILL.md +43 -42
  115. package/dist/internal/report.d.ts +0 -40
  116. package/dist/internal/report.d.ts.map +0 -1
  117. package/dist/internal/report.js +0 -48
  118. package/dist/internal/report.js.map +0 -1
package/dist/index.js CHANGED
@@ -4,16 +4,16 @@
4
4
  *
5
5
  * Responsibilities kept here on purpose:
6
6
  * - decide whether the background update check may run before anything else;
7
- * - turn SIGINT into a cooperative abort (exit 130) instead of a hard kill;
7
+ * - turn SIGINT / SIGTERM / SIGHUP into a cooperative abort (exit 130) instead of a hard kill;
8
8
  * - route every failure — including Commander parse errors — through one
9
- * exit that renders the payload in the schema the command would have used;
9
+ * exit that renders the v1 error envelope in the format the command would have used;
10
10
  * - flush stdout before exiting.
11
11
  */
12
- import { buildRootCommand, V1_ONLY_COMMANDS, LOCAL_COMMANDS } from "./root.js";
13
- import { currentCommand, markInterrupted, wasInterrupted } from "./internal/context.js";
14
- import { exitCodeFor, isCommanderInformational, reportError, CliError } from "./internal/errors.js";
12
+ import { buildRootCommand, LOCAL_COMMANDS } from "./root.js";
13
+ import { currentCommand, interruptedBy, markInterrupted, wasInterrupted } from "./internal/context.js";
14
+ import { isCommanderInformational, CliError } from "./internal/errors.js";
15
15
  import { painterFor } from "./internal/color.js";
16
- import { emitEnvelope, printWarnings, writeStdout } from "./internal/output.js";
16
+ import { emitEnvelope, printWarnings } from "./internal/output.js";
17
17
  import { humanHint } from "./internal/views.js";
18
18
  import { stopActiveProgress } from "./internal/progress.js";
19
19
  import { errorEnvelope } from "./internal/result.js";
@@ -64,23 +64,38 @@ export function shouldRunUpdateCheck(argv, env = process.env) {
64
64
  return false;
65
65
  return true;
66
66
  }
67
+ /** How long a SIGTERM / SIGHUP waits for the cooperative stop before the process exits anyway. */
68
+ export const TERMINATE_GRACE_MS = 3_000;
69
+ /**
70
+ * SIGTERM and SIGHUP (a harness timing the command out, a closed terminal)
71
+ * take the same cooperative path as SIGINT, so the operation journal records
72
+ * what is known instead of being left at `started` by a hard kill. A command
73
+ * that does not observe the abort (an `auth login` waiting for a person) still
74
+ * exits after TERMINATE_GRACE_MS, as a terminate signal should.
75
+ */
67
76
  function installSignalHandlers() {
68
77
  let count = 0;
69
- process.on("SIGINT", () => {
70
- count += 1;
71
- if (count === 1) {
72
- markInterrupted();
73
- stopActiveProgress();
74
- process.stderr.write("\ninterrupted — finishing local bookkeeping; press Ctrl-C again to force exit\n");
75
- return;
76
- }
77
- process.exit(130);
78
- });
78
+ for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
79
+ process.on(signal, () => {
80
+ count += 1;
81
+ if (count === 1) {
82
+ markInterrupted(signal);
83
+ stopActiveProgress();
84
+ if (signal === "SIGINT") {
85
+ process.stderr.write("\ninterrupted — finishing local bookkeeping; press Ctrl-C again to force exit\n");
86
+ return;
87
+ }
88
+ process.stderr.write(`\ninterrupted by ${signal} — finishing local bookkeeping\n`);
89
+ setTimeout(() => process.exit(130), TERMINATE_GRACE_MS).unref();
90
+ return;
91
+ }
92
+ process.exit(130);
93
+ });
94
+ }
79
95
  }
80
96
  async function reportFailure(program, argv, err) {
81
97
  stopActiveProgress();
82
98
  const ctx = currentCommand();
83
- const schema = ctx?.schema ?? resolveSchemaHeuristically(program, argv);
84
99
  const format = ctx?.format ?? resolveErrorFormat(program, argv);
85
100
  // A SIGINT that surfaced as some other failure is still reported as
86
101
  // interrupted — but whatever the command already knew (task id, submission,
@@ -88,7 +103,7 @@ async function reportFailure(program, argv, err) {
88
103
  const interruptedErr = wasInterrupted() && !(err instanceof CliError && err.code === "interrupted")
89
104
  ? new CliError({
90
105
  code: "interrupted",
91
- message: `interrupted by SIGINT${err instanceof Error && err.message ? ` (${err.message})` : ""}`,
106
+ message: `interrupted by ${interruptedBy()}${err instanceof Error && err.message ? ` (${err.message})` : ""}`,
92
107
  result: err instanceof CliError ? err.result : null,
93
108
  warnings: err instanceof CliError ? err.warnings : [],
94
109
  recovery: err instanceof CliError ? err.recovery : null,
@@ -96,36 +111,26 @@ async function reportFailure(program, argv, err) {
96
111
  cause: err,
97
112
  })
98
113
  : err;
99
- if (schema === "v1") {
100
- const command = ctx?.command ?? commandNameFromArgv(program, argv);
101
- const { envelope, exitCode } = errorEnvelope(command, interruptedErr);
102
- const paint = painterFor(process.stderr);
103
- process.stderr.write(`${paint("error:", "red")} ${envelope.error?.message ?? "unknown error"}\n`);
104
- const hint = format === "pretty" ? humanHint(envelope.error?.hint, envelope.error?.recovery?.command, envelope.result) : envelope.error?.hint;
105
- if (hint)
106
- process.stderr.write(`${paint("hint:", "yellow")} ${hint}\n`);
107
- // A person at a terminal has the message and the hint; the envelope is for
108
- // machines, which never get `pretty` unless they ask for it.
109
- if (format === "pretty") {
110
- printWarnings(envelope.warnings);
111
- return exitCode;
112
- }
113
- try {
114
- await emitEnvelope(envelope, format);
115
- }
116
- catch {
117
- /* stderr already carries the human message */
118
- }
114
+ const command = ctx?.command ?? commandNameFromArgv(program, argv);
115
+ const { envelope, exitCode } = errorEnvelope(command, interruptedErr);
116
+ const paint = painterFor(process.stderr);
117
+ process.stderr.write(`${paint("error:", "red")} ${envelope.error?.message ?? "unknown error"}\n`);
118
+ const hint = format === "pretty" ? humanHint(envelope.error?.hint, envelope.error?.recovery?.command, envelope.result) : envelope.error?.hint;
119
+ if (hint)
120
+ process.stderr.write(`${paint("hint:", "yellow")} ${hint}\n`);
121
+ // A person at a terminal has the message and the hint; the envelope is for
122
+ // machines, which never get `pretty` unless they ask for it.
123
+ if (format === "pretty") {
124
+ printWarnings(envelope.warnings);
119
125
  return exitCode;
120
126
  }
121
- reportError(interruptedErr, format);
122
127
  try {
123
- await writeStdout("");
128
+ await emitEnvelope(envelope, format);
124
129
  }
125
130
  catch {
126
- /* nothing to flush */
131
+ /* stderr already carries the human message */
127
132
  }
128
- return exitCodeFor(interruptedErr);
133
+ return exitCode;
129
134
  }
130
135
  /**
131
136
  * Resolve the output format for the error path.
@@ -157,24 +162,6 @@ function resolveErrorFormat(program, argv) {
157
162
  const typedV1 = argv.includes("--output-schema=v1") || (i >= 0 && argv[i + 1]?.toLowerCase() === "v1");
158
163
  return resolveFormat({ outputSchema: typedV1 ? "v1" : undefined });
159
164
  }
160
- /**
161
- * Before an action ran we only know argv. `--output-schema` is a root option,
162
- * so a parsed value is authoritative; otherwise the first command token decides
163
- * (new commands are v1-only, everything else is legacy).
164
- */
165
- function resolveSchemaHeuristically(program, argv) {
166
- const parsed = program.opts()["outputSchema"];
167
- if (parsed === "v1" || parsed === "legacy")
168
- return parsed;
169
- const idx = argv.indexOf("--output-schema");
170
- if (idx !== -1) {
171
- const v = argv[idx + 1];
172
- if (v === "v1" || v === "legacy")
173
- return v;
174
- }
175
- const first = firstCommandToken(program, argv);
176
- return first && V1_ONLY_COMMANDS.has(first) ? "v1" : "legacy";
177
- }
178
165
  function firstCommandToken(program, argv) {
179
166
  const names = new Set(program.commands.map((c) => c.name()));
180
167
  return argv.slice(2).find((a) => names.has(a));
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AAIH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAqB,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAqB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEzE,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,IAAI,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACvC,mEAAmE;QACnE,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,GAAG,GAAG,CAAC;IACpD,CAAC;IACD,IAAI,oBA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AAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,IAAI,IAAI,GAAG,GAAG,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI;YAAE,MAAM;QACjB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjB,IAAI,GAAG,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC"}
@@ -1,35 +1,28 @@
1
1
  /**
2
2
  * Small shared pieces every command action uses:
3
- * - open the command context (name, schema, format) so the error exit can
4
- * render in the right shape;
5
- * - render a result in either schema;
3
+ * - open the command context (name, format) so the error exit can render
4
+ * the failure the way the success path would have;
5
+ * - print a result as the meshy.cli/v1 envelope;
6
6
  * - save the raw API JSON (--save-json) with exclusive publication.
7
7
  */
8
8
  import { Command } from "commander";
9
9
  import { type CommandContext } from "./context.js";
10
10
  import { type Warning } from "./errors.js";
11
11
  import { type OutputFormat } from "./output.js";
12
- import { type OutputSchema } from "./result.js";
13
12
  import { type GlobalFlags } from "./runtime.js";
14
13
  import { type AuthorisedRoot } from "./paths.js";
15
14
  export interface OpenedCommand extends CommandContext {
16
15
  flags: GlobalFlags;
17
16
  }
18
- /** Read global flags, decide the schema and register the command context. */
19
- export declare function openCommand(thisCmd: Command, command: string, defaultSchema: OutputSchema): OpenedCommand;
20
- /**
21
- * Print a command result. Legacy keeps the bare payload (and the historical
22
- * `-o <file>` meaning "write the JSON there" for non-task commands); v1 prints
23
- * the envelope and treats `-o` on a non-task command as a usage error that
24
- * points at --save-json.
25
- */
26
- export declare function emitResult(opened: OpenedCommand, legacyValue: unknown, v1Result: unknown, opts?: {
17
+ /** Read global flags and register the command context. */
18
+ export declare function openCommand(thisCmd: Command, command: string): OpenedCommand;
19
+ /** Print a command result as one v1 envelope in the resolved rendering. */
20
+ export declare function emitResult(opened: OpenedCommand, result: unknown, opts?: {
27
21
  warnings?: Warning[];
28
- legacyFile?: string | undefined;
29
22
  format?: OutputFormat;
30
23
  }): Promise<void>;
31
- /** v1: `-o` is reserved for assets; JSON goes through --save-json. */
32
- export declare function rejectOutputFlagForV1(opened: OpenedCommand, saveJson: string | undefined): void;
24
+ /** `-o` is reserved for task assets; a command that produces JSON points at --save-json. */
25
+ export declare function rejectOutputFlag(opened: OpenedCommand, saveJson: string | undefined): void;
33
26
  export interface SavedJson {
34
27
  path: string;
35
28
  bytes: number;
@@ -1 +1 @@
1
- {"version":3,"file":"command-helpers.d.ts","sourceRoot":"","sources":["../../src/internal/command-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAkC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEpE,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,KAAK,EAAE,WAA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1,53 +1,36 @@
1
1
  /**
2
2
  * Small shared pieces every command action uses:
3
- * - open the command context (name, schema, format) so the error exit can
4
- * render in the right shape;
5
- * - render a result in either schema;
3
+ * - open the command context (name, format) so the error exit can render
4
+ * the failure the way the success path would have;
5
+ * - print a result as the meshy.cli/v1 envelope;
6
6
  * - save the raw API JSON (--save-json) with exclusive publication.
7
7
  */
8
8
  import { MeshyApiError } from "../client/errors.js";
9
9
  import { dirname, resolve as resolvePath } from "node:path";
10
10
  import { beginCommand } from "./context.js";
11
11
  import { UsageError } from "./errors.js";
12
- import { emit, emitEnvelope } from "./output.js";
12
+ import { emitEnvelope } from "./output.js";
13
13
  import { okEnvelope } from "./result.js";
14
- import { readGlobalFlags, resolveSchema } from "./runtime.js";
14
+ import { readGlobalFlags } from "./runtime.js";
15
15
  import { writeJsonFile } from "./atomic-file.js";
16
16
  import { resolveWithinRoot } from "./paths.js";
17
- /** Read global flags, decide the schema and register the command context. */
18
- export function openCommand(thisCmd, command, defaultSchema) {
17
+ /** Read global flags and register the command context. */
18
+ export function openCommand(thisCmd, command) {
19
19
  const flags = readGlobalFlags(thisCmd);
20
- const schema = resolveSchema(flags, defaultSchema);
21
- const ctx = beginCommand({ command, schema, format: flags.format });
20
+ const ctx = beginCommand({ command, format: flags.format });
22
21
  return { ...ctx, flags };
23
22
  }
24
- /**
25
- * Print a command result. Legacy keeps the bare payload (and the historical
26
- * `-o <file>` meaning "write the JSON there" for non-task commands); v1 prints
27
- * the envelope and treats `-o` on a non-task command as a usage error that
28
- * points at --save-json.
29
- */
30
- export async function emitResult(opened, legacyValue, v1Result, opts = {}) {
31
- const format = opts.format ?? opened.format;
32
- if (opened.schema === "v1") {
33
- await emitEnvelope(okEnvelope(opened.command, v1Result, opts.warnings ?? []), format);
34
- return;
35
- }
36
- // Legacy `-o <file>` writes the payload to disk instead of stdout. The TTY
37
- // default describes a terminal, not a file, so an untyped --format must not
38
- // leak `pretty` into what callers have always read back as JSON.
39
- const fileFormat = opts.legacyFile && !opened.flags.formatExplicit && opts.format === undefined ? "json" : format;
40
- emit(legacyValue, { format: fileFormat, file: opts.legacyFile });
23
+ /** Print a command result as one v1 envelope in the resolved rendering. */
24
+ export async function emitResult(opened, result, opts = {}) {
25
+ await emitEnvelope(okEnvelope(opened.command, result, opts.warnings ?? []), opts.format ?? opened.format);
41
26
  }
42
- /** v1: `-o` is reserved for assets; JSON goes through --save-json. */
43
- export function rejectOutputFlagForV1(opened, saveJson) {
44
- if (opened.schema !== "v1")
45
- return;
27
+ /** `-o` is reserved for task assets; a command that produces JSON points at --save-json. */
28
+ export function rejectOutputFlag(opened, saveJson) {
46
29
  if (opened.flags.output && saveJson) {
47
30
  throw new UsageError("--output/-o and --save-json cannot be combined on this command; -o is for assets, --save-json for the raw JSON");
48
31
  }
49
32
  if (opened.flags.output) {
50
- throw new UsageError("this command produces JSON, not assets: use --save-json <file> instead of --output/-o under --output-schema v1");
33
+ throw new UsageError("this command produces JSON, not assets: use --save-json <file> instead of --output/-o");
51
34
  }
52
35
  }
53
36
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"command-helpers.js","sourceRoot":"","sources":["../../src/internal/command-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAuB,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,UAAU,EAAgB,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAoB,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAu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AK,EAAE,CAAC,CAAC;IAC1E,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;AACzE,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,SAAS,CAAC,GAAY,EAAE,IAAY;IAClD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,aAAa,CAAC,EAAE,OAAO,EAAE,sCAAsC,IAAI,yBAAyB,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1J,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAgC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACnH,CAAC"}
@@ -1,19 +1,18 @@
1
1
  /**
2
2
  * Per-invocation command context. The CLI runs one command per process; the
3
- * action that owns the command registers its name, output schema and format
4
- * here so the top-level error exit can render the failure in the same shape
5
- * the success path would have used. Parse errors happen before any action
3
+ * action that owns the command registers its name and output format here so
4
+ * the top-level error exit can render the failure the way the success path
5
+ * would have. Parse errors happen before any action
6
6
  * runs, so the entry point falls back to argv heuristics when this is unset.
7
7
  *
8
- * The shared AbortController is what SIGINT trips; long operations (wait,
9
- * stream, download) observe `signal` and convert an abort into exit 130.
8
+ * The shared AbortController is what SIGINT, SIGTERM or SIGHUP trips; long
9
+ * operations (wait, stream, download) observe `signal` and convert an abort
10
+ * into exit 130.
10
11
  */
11
12
  import type { ViewFacts } from "./views.js";
12
13
  import type { OutputFormat } from "./output.js";
13
- import type { OutputSchema } from "./result.js";
14
14
  export interface CommandContext {
15
15
  command: string;
16
- schema: OutputSchema;
17
16
  format: OutputFormat;
18
17
  /** Facts only the `pretty` view shows; never part of json/ndjson. */
19
18
  view?: ViewFacts;
@@ -23,8 +22,10 @@ export declare function currentCommand(): CommandContext | null;
23
22
  /** Hand the human view something the payload does not carry (make: the prompt, the whole chain's time). */
24
23
  export declare function noteForView(facts: ViewFacts): void;
25
24
  export declare function abortSignal(): AbortSignal;
26
- export declare function markInterrupted(): void;
25
+ export declare function markInterrupted(signal?: string): void;
27
26
  export declare function wasInterrupted(): boolean;
27
+ /** The signal that tripped the abort (SIGINT, SIGTERM or SIGHUP). */
28
+ export declare function interruptedBy(): string;
28
29
  /** Test hook: reset module state between in-process runs. */
29
30
  export declare function resetCommandContextForTests(): void;
30
31
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/internal/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,qEAAqE;IACrE,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAMD,wBAAgB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,cAAc,CAGhE;AAED,wBAAgB,cAAc,IAAI,cAAc,GAAG,IAAI,CAEtD;AAED,2GAA2G;AAC3G,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAElD;AAED,wBAAgB,WAAW,IAAI,WAAW,CAEzC;AAED,wBAAgB,eAAe,IAAI,IAAI,CAItC;AAED,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED,6DAA6D;AAC7D,wBAAgB,2BAA2B,IAAI,IAAI,CAElD"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/internal/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,CAAC;IACrB,qEAAqE;IACrE,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAOD,wBAAgB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,cAAc,CAGhE;AAED,wBAAgB,cAAc,IAAI,cAAc,GAAG,IAAI,CAEtD;AAED,2GAA2G;AAC3G,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAElD;AAED,wBAAgB,WAAW,IAAI,WAAW,CAEzC;AAED,wBAAgB,eAAe,CAAC,MAAM,SAAW,GAAG,IAAI,CAKvD;AAED,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED,qEAAqE;AACrE,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,6DAA6D;AAC7D,wBAAgB,2BAA2B,IAAI,IAAI,CAElD"}
@@ -1,16 +1,18 @@
1
1
  /**
2
2
  * Per-invocation command context. The CLI runs one command per process; the
3
- * action that owns the command registers its name, output schema and format
4
- * here so the top-level error exit can render the failure in the same shape
5
- * the success path would have used. Parse errors happen before any action
3
+ * action that owns the command registers its name and output format here so
4
+ * the top-level error exit can render the failure the way the success path
5
+ * would have. Parse errors happen before any action
6
6
  * runs, so the entry point falls back to argv heuristics when this is unset.
7
7
  *
8
- * The shared AbortController is what SIGINT trips; long operations (wait,
9
- * stream, download) observe `signal` and convert an abort into exit 130.
8
+ * The shared AbortController is what SIGINT, SIGTERM or SIGHUP trips; long
9
+ * operations (wait, stream, download) observe `signal` and convert an abort
10
+ * into exit 130.
10
11
  */
11
12
  let current = null;
12
13
  const controller = new AbortController();
13
14
  let interrupted = false;
15
+ let interruptSignal = "SIGINT";
14
16
  export function beginCommand(ctx) {
15
17
  current = ctx;
16
18
  return ctx;
@@ -26,15 +28,20 @@ export function noteForView(facts) {
26
28
  export function abortSignal() {
27
29
  return controller.signal;
28
30
  }
29
- export function markInterrupted() {
31
+ export function markInterrupted(signal = "SIGINT") {
30
32
  if (interrupted)
31
33
  return;
32
34
  interrupted = true;
33
- controller.abort(new Error("interrupted by SIGINT"));
35
+ interruptSignal = signal;
36
+ controller.abort(new Error(`interrupted by ${signal}`));
34
37
  }
35
38
  export function wasInterrupted() {
36
39
  return interrupted;
37
40
  }
41
+ /** The signal that tripped the abort (SIGINT, SIGTERM or SIGHUP). */
42
+ export function interruptedBy() {
43
+ return interruptSignal;
44
+ }
38
45
  /** Test hook: reset module state between in-process runs. */
39
46
  export function resetCommandContextForTests() {
40
47
  current = null;
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/internal/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAcH,IAAI,OAAO,GAA0B,IAAI,CAAC;AAC1C,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;AACzC,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,MAAM,UAAU,YAAY,CAAC,GAAmB;IAC9C,OAAO,GAAG,GAAG,CAAC;IACd,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,2GAA2G;AAC3G,MAAM,UAAU,WAAW,CAAC,KAAgB;IAC1C,IAAI,OAAO;QAAE,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,GAAG,KAAK,EAAE,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,UAAU,CAAC,MAAM,CAAC;AAC3B,CAA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U,cAAc;IAC5B,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,aAAa;IAC3B,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,2BAA2B;IACzC,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC"}
@@ -3,14 +3,10 @@
3
3
  * human-friendly line, emits the structured payload when --format=json, and
4
4
  * maps error classes to conventional exit codes for scripting.
5
5
  *
6
- * Two output schemas share this module:
7
- * - legacy: the additive `{name,message,status,code,path,hint,docs}` payload
8
- * that 0.2.0 consumers parse (toErrorPayload / reportError).
9
- * - v1: `classifyError` yields the stable code/exit/http/recovery tuple that
10
- * result.ts wraps into the `meshy.cli/v1` envelope.
6
+ * `classifyError` yields the stable code/exit/http/recovery tuple that
7
+ * result.ts wraps into the `meshy.cli/v1` error envelope; index.ts prints it.
11
8
  */
12
9
  import { CommanderError } from "commander";
13
- import { type OutputFormat } from "./output.js";
14
10
  export declare const EXIT_CODES: {
15
11
  readonly OK: 0;
16
12
  readonly GENERIC: 1;
@@ -123,18 +119,4 @@ export interface ClassifiedError {
123
119
  }
124
120
  /** Map any thrown value onto the stable v1 error tuple. Never throws. */
125
121
  export declare function classifyError(err: unknown): ClassifiedError;
126
- /** Legacy stderr + payload reporter (unchanged shape for 0.2.0 consumers). */
127
- export declare function reportError(err: unknown, format: OutputFormat): void;
128
- /**
129
- * The payload shape stays additive: `hint` and `docs` join the existing
130
- * name/message/status/code/path fields rather than moving everything under an
131
- * `{ok:false, error:{…}}` envelope. Successful commands emit bare API payloads
132
- * with no `ok` field, so an envelope on failures only would force consumers to
133
- * probe for two different shapes.
134
- */
135
- export declare function toErrorPayload(err: unknown): {
136
- name: string;
137
- message: string;
138
- [k: string]: unknown;
139
- };
140
122
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"A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11 @@
3
3
  * human-friendly line, emits the structured payload when --format=json, and
4
4
  * maps error classes to conventional exit codes for scripting.
5
5
  *
6
- * Two output schemas share this module:
7
- * - legacy: the additive `{name,message,status,code,path,hint,docs}` payload
8
- * that 0.2.0 consumers parse (toErrorPayload / reportError).
9
- * - v1: `classifyError` yields the stable code/exit/http/recovery tuple that
10
- * result.ts wraps into the `meshy.cli/v1` envelope.
6
+ * `classifyError` yields the stable code/exit/http/recovery tuple that
7
+ * result.ts wraps into the `meshy.cli/v1` error envelope; index.ts prints it.
11
8
  */
12
9
  import { CommanderError } from "commander";
13
10
  import { MeshyApiError } from "../client/errors.js";
14
- import { emit } from "./output.js";
15
- import { painterFor } from "./color.js";
16
- import { humanHint } from "./views.js";
17
11
  export const EXIT_CODES = {
18
12
  OK: 0,
19
13
  GENERIC: 1,
@@ -244,8 +238,14 @@ export function classifyError(err) {
244
238
  else if (err.code === "step_failed")
245
239
  code = "task_failed";
246
240
  const exitCode = err.exitCode ?? EXIT_FOR_CODE[code];
241
+ // DeviceFlowError (a HintedError subclass) carries the OAuth error code
242
+ // (access_denied / expired_token / invalid_grant …); machines read it as
243
+ // `details.oauth_error`. Read loosely to avoid importing device.ts.
244
+ const oauthError = err["oauthErrorCode"];
247
245
  return {
248
- ...base(code, err.message, { details: { code: err.code, docs: err.docs } }),
246
+ ...base(code, err.message, {
247
+ details: { code: err.code, docs: err.docs, ...(typeof oauthError === "string" ? { oauth_error: oauthError } : {}) },
248
+ }),
249
249
  exitCode,
250
250
  hint: err.hint,
251
251
  recovery: err.hint ? { action: "run_hint", automatic: false, command: err.hint } : null,
@@ -273,83 +273,4 @@ function base(code, message, extra = {}) {
273
273
  warnings: [],
274
274
  };
275
275
  }
276
- /** Legacy stderr + payload reporter (unchanged shape for 0.2.0 consumers). */
277
- export function reportError(err, format) {
278
- const payload = toErrorPayload(err);
279
- // Painted against stderr, not stdout: `meshy ... | jq` still shows a red
280
- // error line in the terminal, and `2> log` gets clean text.
281
- const paint = painterFor(process.stderr);
282
- process.stderr.write(`${paint("error:", "red")} ${payload.message}\n`);
283
- // A person also gets a way forward when there is no hint (make's interrupt,
284
- // a poll that lost the network). Machines read it from the payload.
285
- const hint = format === "pretty"
286
- ? humanHint(payload["hint"], err instanceof CliError ? err.recovery?.command : undefined, payload["result"])
287
- : typeof payload["hint"] === "string" ? payload["hint"] : undefined;
288
- if (hint)
289
- process.stderr.write(`${paint("hint:", "yellow")} ${hint}\n`);
290
- if (format !== "pretty") {
291
- try {
292
- emit(payload, { format });
293
- }
294
- catch {
295
- /* ignore: stderr already carries the human message */
296
- }
297
- }
298
- }
299
- /**
300
- * The payload shape stays additive: `hint` and `docs` join the existing
301
- * name/message/status/code/path fields rather than moving everything under an
302
- * `{ok:false, error:{…}}` envelope. Successful commands emit bare API payloads
303
- * with no `ok` field, so an envelope on failures only would force consumers to
304
- * probe for two different shapes.
305
- */
306
- export function toErrorPayload(err) {
307
- if (err instanceof MeshyApiError) {
308
- return { ...err.toJSON(), ...hintForApiError(err), name: err.name, message: err.message };
309
- }
310
- if (err instanceof CliError) {
311
- // Additive convenience fields: a legacy consumer reading an error after a
312
- // create must find the accepted task without digging into `result`.
313
- const result = err.result ?? undefined;
314
- const taskId = typeof result?.["task_id"] === "string" ? result["task_id"] : undefined;
315
- const submission = result?.["submission"];
316
- const operationId = typeof submission?.operation_id === "string" ? submission.operation_id : undefined;
317
- return {
318
- name: err.name,
319
- message: err.message,
320
- code: err.code,
321
- ...(err.httpStatus !== null ? { status: err.httpStatus } : {}),
322
- ...(err.hint ? { hint: err.hint } : {}),
323
- ...(taskId ? { task_id: taskId } : {}),
324
- ...(operationId ? { operation_id: operationId } : {}),
325
- ...(result ? { result } : {}),
326
- };
327
- }
328
- if (err instanceof CommanderError) {
329
- return { name: "UsageError", message: err.message.replace(/^error:\s*/i, "").trim(), code: err.code };
330
- }
331
- if (err instanceof HintedError) {
332
- // DeviceFlowError (a HintedError subclass) carries an oauthErrorCode field
333
- // that machine consumers need to distinguish access_denied / invalid_grant /
334
- // expired_token etc. Serialise it as `oauth_error` (snake_case, consistent
335
- // with the rest of the JSON error payload) without importing the subclass
336
- // (which would create a circular dependency through device.ts → errors.ts).
337
- const errAsUnknown = err;
338
- const oauthError = typeof errAsUnknown["oauthErrorCode"] === "string"
339
- ? errAsUnknown["oauthErrorCode"]
340
- : undefined;
341
- return {
342
- name: err.name,
343
- message: err.message,
344
- code: err.code,
345
- ...(oauthError !== undefined ? { oauth_error: oauthError } : {}),
346
- ...(err.hint ? { hint: err.hint } : {}),
347
- ...(err.docs ? { docs: err.docs } : {}),
348
- };
349
- }
350
- if (err instanceof Error) {
351
- return { name: err.name, message: err.message };
352
- }
353
- return { name: "Error", message: String(err) };
354
- }
355
276
  //# sourceMappingURL=errors.js.map