@kjanat/dreamcli 3.0.0-rc.16 → 3.0.0-rc.17

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/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.0.0-rc.17] - 2026-07-20
11
+
12
+ ### Added
13
+
14
+ - **`out.status()`** — a success/status line channel that writes to **stderr**
15
+ (stdout stays clean for piping) and is suppressed under quiet verbosity.
16
+ `info` remains stdout-bound; `warn`/`error` remain always-emitted.
17
+ - **Global `--quiet`/`-q` flag** — sets quiet verbosity on every CLI, wired
18
+ like `--json`: detected and stripped at the root before dispatch (command
19
+ schemas never see it), honoring the `--` separator so a literal `-q`
20
+ positional reaches the command unchanged. Listed under root help's
21
+ `Global options:`.
22
+
23
+ ### Fixed
24
+
25
+ - **`.run()` misread a post-separator `--json`** — runtime preflight used a
26
+ naive `includes('--json')`, so `mycli cmd -- --json` entered JSON mode via
27
+ the adapter path even though `.execute()` correctly treats it as a
28
+ positional. Preflight now uses the `--`-aware detection.
29
+
10
30
  ## [3.0.0-rc.16] - 2026-07-20
11
31
 
12
32
  ### Added
@@ -1315,7 +1335,8 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1315
1335
  - MIT License.
1316
1336
  - Markdownlint configuration.
1317
1337
 
1318
- [Unreleased]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.16...HEAD
1338
+ [Unreleased]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.17...HEAD
1339
+ [3.0.0-rc.17]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.16...v3.0.0-rc.17
1319
1340
  [3.0.0-rc.16]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.15...v3.0.0-rc.16
1320
1341
  [3.0.0-rc.15]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.14...v3.0.0-rc.15
1321
1342
  [3.0.0-rc.14]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.13...v3.0.0-rc.14
@@ -584,8 +584,9 @@ var CLIBuilder = class CLIBuilder {
584
584
  */
585
585
  async execute(argv, options) {
586
586
  const jsonMode = includesBeforeSeparator(argv, "--json") || options?.jsonMode === true;
587
+ const verbosity = includesBeforeSeparator(argv, "--quiet") || includesBeforeSeparator(argv, "-q") ? "quiet" : options?.verbosity;
587
588
  const captureOptions = {
588
- ...options?.verbosity !== void 0 ? { verbosity: options.verbosity } : {},
589
+ ...verbosity !== void 0 ? { verbosity } : {},
589
590
  ...jsonMode ? { jsonMode } : {},
590
591
  ...options?.isTTY !== void 0 ? { isTTY: options.isTTY } : {},
591
592
  ...hyperlinksOption(resolveHyperlinkOverride(options?.env ?? {}, argv))
@@ -615,12 +616,13 @@ var CLIBuilder = class CLIBuilder {
615
616
  ...options,
616
617
  plugins: this.schema.plugins,
617
618
  ...jsonMode ? { jsonMode } : {},
619
+ ...verbosity !== void 0 ? { verbosity } : {},
618
620
  ...flagSettings !== void 0 ? { flags: flagSettings } : {}
619
621
  };
620
622
  const output = {
621
623
  jsonMode,
622
624
  isTTY: out.isTTY,
623
- verbosity: options?.verbosity ?? "normal"
625
+ verbosity: verbosity ?? "normal"
624
626
  };
625
627
  const planned = planInvocation({
626
628
  schema: options?.flags !== void 0 ? {
@@ -190,6 +190,12 @@ function planCompletionsFlag(argv, config) {
190
190
  };
191
191
  }
192
192
  }
193
+ /** Root-level output flags stripped before dispatch (never part of a command schema). */
194
+ const ROOT_OUTPUT_FLAGS = /* @__PURE__ */ new Set([
195
+ "--json",
196
+ "--quiet",
197
+ "-q"
198
+ ]);
193
199
  /**
194
200
  * Decide what to do with an argv invocation before any command executes.
195
201
  *
@@ -202,7 +208,7 @@ function planInvocation(options) {
202
208
  const separatorIndex = options.argv.indexOf("--");
203
209
  const head = separatorIndex === -1 ? options.argv : options.argv.slice(0, separatorIndex);
204
210
  const tail = separatorIndex === -1 ? [] : options.argv.slice(separatorIndex);
205
- const filteredHead = head.includes("--json") ? head.filter((arg) => arg !== "--json") : head;
211
+ const filteredHead = head.some((arg) => ROOT_OUTPUT_FLAGS.has(arg)) ? head.filter((arg) => !ROOT_OUTPUT_FLAGS.has(arg)) : head;
206
212
  const filteredArgv = separatorIndex === -1 ? filteredHead : [...filteredHead, ...tail];
207
213
  const defaultCommand = options.schema.defaultCommand;
208
214
  const rootValueFlags = defaultCommand !== void 0 ? buildFlagLookup(defaultCommand.schema.flags, options.schema.flagSettings) : void 0;
@@ -202,6 +202,10 @@ function formatGlobalOptionsSection(schema, width, theme) {
202
202
  left: theme.flag("--json"),
203
203
  description: "Emit machine-readable JSON output"
204
204
  });
205
+ entries.push({
206
+ left: theme.flag("-q, --quiet"),
207
+ description: "Suppress informational output"
208
+ });
205
209
  if (schema.configSettings !== void 0) entries.push({
206
210
  left: `${theme.flag("--config")} ${theme.placeholder("<path>")}`,
207
211
  description: "Load configuration from the given file"
@@ -1,5 +1,5 @@
1
1
  import { CLIError, ParseError } from "../errors/index.mjs";
2
- import { parse } from "../parse/index.mjs";
2
+ import { includesBeforeSeparator, parse } from "../parse/index.mjs";
3
3
  import { createTerminalPrompter } from "../prompt/index.mjs";
4
4
  import { discoverManifest, inferCliName } from "../config/package-json.mjs";
5
5
  import { deriveHelpLinks } from "./help-links.mjs";
@@ -138,7 +138,8 @@ async function prepareRuntimePreflight(options) {
138
138
  configPath: void 0,
139
139
  filteredArgv: rawArgv
140
140
  };
141
- const jsonMode = filteredArgv.includes("--json") || options.options?.jsonMode === true;
141
+ const jsonMode = includesBeforeSeparator(filteredArgv, "--json") || options.options?.jsonMode === true;
142
+ const hasQuietFlag = includesBeforeSeparator(filteredArgv, "--quiet") || includesBeforeSeparator(filteredArgv, "-q");
142
143
  const isCompletions = isCompletionsInvocation(options.schema, filteredArgv);
143
144
  const schema = await applyPackageJsonDiscovery(options.schema, options.adapter, options.inheritedName, isCompletions);
144
145
  const loadedConfig = await loadRuntimeConfig(schema, options.adapter, configPath, isCompletions, options.options?.config);
@@ -157,7 +158,7 @@ async function prepareRuntimePreflight(options) {
157
158
  env: options.options?.env ?? options.adapter.env,
158
159
  isTTY: options.options?.isTTY ?? options.adapter.isTTY,
159
160
  jsonMode,
160
- verbosity: options.options?.verbosity ?? "normal",
161
+ verbosity: hasQuietFlag ? "quiet" : options.options?.verbosity ?? "normal",
161
162
  stat: options.options?.stat ?? options.adapter.stat,
162
163
  ...stdinData !== void 0 ? { stdinData } : {},
163
164
  ...options.options?.prompter !== void 0 ? { prompter: options.options.prompter } : autoPrompter !== void 0 ? { prompter: autoPrompter } : {},
@@ -71,7 +71,7 @@ declare const outputContract: {
71
71
  declare function resolveOutputPolicy(options: ResolveOutputPolicyOptions): OutputPolicy;
72
72
  /** Resolve the default text stream for non-JSON structured output. */
73
73
  declare function resolveTextStream(policy: OutputPolicy): OutputStream;
74
- /** Whether `info()` messages should be emitted under the current policy. */
74
+ /** Whether `info()`/`status()` messages should be emitted under the current policy. */
75
75
  declare function shouldEmitInfo(policy: OutputPolicy): boolean;
76
76
  /** Resolve the concrete table format under the current policy. */
77
77
  declare function resolveTableFormat(policy: OutputPolicy, options?: TableOptions): 'text' | 'json';
@@ -11,7 +11,7 @@ function resolveOutputPolicy(options) {
11
11
  function resolveTextStream(policy) {
12
12
  return policy.jsonMode ? "stderr" : "stdout";
13
13
  }
14
- /** Whether `info()` messages should be emitted under the current policy. */
14
+ /** Whether `info()`/`status()` messages should be emitted under the current policy. */
15
15
  function shouldEmitInfo(policy) {
16
16
  return policy.verbosity !== "quiet";
17
17
  }
@@ -151,6 +151,11 @@ declare class OutputChannel implements Out {
151
151
  * In JSON mode, redirected to stderr.
152
152
  */
153
153
  info(message: string): void;
154
+ /**
155
+ * Status line to stderr (stdout stays clean for piping).
156
+ * Suppressed when verbosity is `'quiet'`.
157
+ */
158
+ status(message: string): void;
154
159
  /** Warning to stderr. Always emitted. */
155
160
  warn(message: string): void;
156
161
  /** Error to stderr. Always emitted. */
@@ -138,6 +138,14 @@ var OutputChannel = class {
138
138
  if (!shouldEmitInfo(this.policy)) return;
139
139
  writeLine(resolveWriterForStream(this.options, resolveTextStream(this.policy)), message);
140
140
  }
141
+ /**
142
+ * Status line to stderr (stdout stays clean for piping).
143
+ * Suppressed when verbosity is `'quiet'`.
144
+ */
145
+ status(message) {
146
+ if (!shouldEmitInfo(this.policy)) return;
147
+ writeLine(this.options.stderr, message);
148
+ }
141
149
  /** Warning to stderr. Always emitted. */
142
150
  warn(message) {
143
151
  writeLine(this.options.stderr, message);
@@ -112,6 +112,13 @@ interface Out {
112
112
  log(message: string): void;
113
113
  /** Informational (may be suppressed in quiet mode). */
114
114
  info(message: string): void;
115
+ /**
116
+ * Status line to stderr, suppressed in quiet mode.
117
+ *
118
+ * Keeps stdout clean for piping; for success and progress notes like
119
+ * `Wrote <path>` that scripts silence with `--quiet`.
120
+ */
121
+ status(message: string): void;
115
122
  /** Warning to stderr. */
116
123
  warn(message: string): void;
117
124
  /** Error to stderr. */
package/dist/version.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  //#region src/version.ts
2
2
  /** Package version (e.g. `"0.9.1"`). `"dev"` when running unbundled. */
3
- const DREAMCLI_VERSION = "3.0.0-rc.16";
3
+ const DREAMCLI_VERSION = "3.0.0-rc.17";
4
4
  /** Git short SHA (e.g. `"f9b5f1a"`). `"dev"` when running unbundled. */
5
- const DREAMCLI_REVISION = "561f448";
5
+ const DREAMCLI_REVISION = "58d3353";
6
6
  //#endregion
7
7
  export { DREAMCLI_REVISION, DREAMCLI_VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kjanat/dreamcli",
3
- "version": "3.0.0-rc.16",
3
+ "version": "3.0.0-rc.17",
4
4
  "description": "Schema-first, fully typed TypeScript CLI framework",
5
5
  "keywords": [
6
6
  "dreamcli",