@effected/cli 0.16.2 → 0.18.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.
package/CliPrompt.js CHANGED
@@ -32,10 +32,9 @@ var CliPrompt = class {
32
32
  * `CliRuntime.reportFailures`) renders it as one line with exit `130`; under a bare `runMain` it prints a
33
33
  * stack.
34
34
  *
35
- * Pair it with `CliPrompt.gateTerminal`, which `CliEnv.layer` installs: core still runs `Prompt.run` on the
36
- * answered prompt it is handed, and `Prompt.run` subscribes the terminal's input, which on a real terminal
37
- * attaches a reader to stdin and drops piped input. The gate makes that subscription harmless when the run is
38
- * not interactive.
35
+ * Core runs `Prompt.run` on the answered prompt it is handed, and an answered prompt never reads the terminal's
36
+ * input (core acquires it only when a prompt needs a key), so piped stdin is left untouched without any gate.
37
+ * `CliPrompt.gateTerminal`, which `CliEnv.layer` installs, covers the prompts this function does not wrap.
39
38
  *
40
39
  * @param prompt - the prompt to show
41
40
  * @param options - the parameter it stands in for, and the non-interactive default
@@ -51,12 +50,12 @@ var CliPrompt = class {
51
50
  * Gates core's `Terminal` on `CliInteractive`, so a run that is not interactive never touches the real one.
52
51
  *
53
52
  * @remarks
54
- * Core's prompt runner subscribes the terminal's input even for a prompt that is already answered, and the
55
- * real Node terminal then attaches a readline to stdin, which drops piped input and puts a TTY stdin into raw
56
- * mode. Not interactive, this terminal's input is an already-ended queue, its `readLine` fails as quit and its
57
- * `display` writes nothing, so any prompt, the wizard included, is quit at once and the real terminal is never
58
- * read. Its `columns` and `rows` always come from the real one, so layout keeps working. Interactive, every
59
- * call passes through to the real terminal.
53
+ * A prompt that needs a key reads the terminal's input, and the real Node terminal then attaches a readline to
54
+ * stdin, which drops piped input and puts a TTY stdin into raw mode. Core's `withFallbackPrompt`, a `Prompt.run`
55
+ * in a handler and the command wizard all do so whether or not anyone is there to answer. Not interactive, this
56
+ * terminal's input is an already-ended queue, its `readLine` fails as quit and its `display` writes nothing, so
57
+ * any such prompt is quit at once and the real terminal is never read. Its `columns` and `rows` always come
58
+ * from the real one, so layout keeps working. Interactive, every call passes through to the real terminal.
60
59
  *
61
60
  * The decision is made on every call, not when the layer is built, so a scope that narrows `CliInteractive`
62
61
  * later, such as an audience flag under `CliAudience.runWith`, gates it too.
package/CliTheme.js CHANGED
@@ -118,9 +118,10 @@ var CliTheme = class CliTheme extends Context.Service()("@effected/cli/CliTheme"
118
118
  * Sets core's `Prompt.Theme` from the tokens, so built-in prompts match the rest of the output.
119
119
  *
120
120
  * @remarks
121
- * The colour fields are raw SGR openers and are empty strings when colour is `none`. Under ASCII glyphs the
122
- * prompt symbols fall back to ASCII too. A colourless theme is not byte-clean: core's `Ansi.annotate`
123
- * appends a `\x1b[0m` reset, and prompts write cursor and underline codes, whatever the theme says.
121
+ * The colour fields are raw SGR openers and are empty strings when colour is `none`, and `colors` is the theme's
122
+ * own decision (`false` at `none`), so core's prompts and its command wizard write no colour or style escape, not
123
+ * even a reset, and core never re-reads the host for `NO_COLOR` or a TTY. Cursor and redraw controls are still
124
+ * written, whatever the theme says. Under ASCII glyphs the prompt symbols fall back to ASCII too.
124
125
  */
125
126
  static promptTheme = Layer.effect(Prompt.Theme, Effect.gen(function* () {
126
127
  const theme = yield* CliTheme;
@@ -128,6 +129,7 @@ var CliTheme = class CliTheme extends Context.Service()("@effected/cli/CliTheme"
128
129
  return Prompt.makeTheme({
129
130
  ...theme.glyphs.kind === "ascii" ? ASCII_PROMPT_GLYPHS : {},
130
131
  ellipsis: theme.glyphs.ellipsis,
132
+ colors: theme.color !== "none",
131
133
  primaryColor: open("accent"),
132
134
  mutedColor: open("muted"),
133
135
  successColor: open("success"),
package/index.d.ts CHANGED
@@ -656,9 +656,10 @@ export declare class CliTheme extends CliTheme_base {
656
656
  * Sets core's `Prompt.Theme` from the tokens, so built-in prompts match the rest of the output.
657
657
  *
658
658
  * @remarks
659
- * The colour fields are raw SGR openers and are empty strings when colour is `none`. Under ASCII glyphs the
660
- * prompt symbols fall back to ASCII too. A colourless theme is not byte-clean: core's `Ansi.annotate`
661
- * appends a `\x1b[0m` reset, and prompts write cursor and underline codes, whatever the theme says.
659
+ * The colour fields are raw SGR openers and are empty strings when colour is `none`, and `colors` is the theme's
660
+ * own decision (`false` at `none`), so core's prompts and its command wizard write no colour or style escape, not
661
+ * even a reset, and core never re-reads the host for `NO_COLOR` or a TTY. Cursor and redraw controls are still
662
+ * written, whatever the theme says. Under ASCII glyphs the prompt symbols fall back to ASCII too.
662
663
  */
663
664
  static readonly promptTheme: Layer.Layer<never, never, CliTheme>;
664
665
  }
@@ -2007,13 +2008,13 @@ interface CliEnvOptions {
2007
2008
  /** The environment variable that overrides the audience, read through `Config`; see `Audience.layer`. */
2008
2009
  readonly audienceEnvVar?: string | undefined;
2009
2010
  /**
2010
- * Overrides the stderr terminal check; `Stdio` reports only stdout, so stderr mirrors it otherwise.
2011
+ * Overrides the stderr terminal check; omitted, core's `Stdio.stderrIsTerminal` answers.
2011
2012
  *
2012
2013
  * @remarks
2013
- * Mirroring means a program whose stdout is a terminal but whose stderr is redirected to a file still paints
2014
- * stderr (a failure report, a warning) with colour escapes. A Node host that redirects stderr passes the real
2015
- * answer: `env: { stderrIsTerminal: Effect.sync(() => process.stderr.isTTY === true) }`. Core's `Stdio` has no
2016
- * stderr terminal check to read instead; that gap is tracked upstream as Effect-TS/effect#8639.
2014
+ * The platform `Stdio` reads the host (`process.stderr.isTTY` on Node), so a program whose stdout is a terminal
2015
+ * but whose stderr is redirected to a file writes its failure report and warnings there unpainted, with nothing
2016
+ * passed here. A `Stdio` built with `Stdio.make` without the field answers `false`; pass this only for a host
2017
+ * whose `Stdio` cannot say.
2017
2018
  */
2018
2019
  readonly stderrIsTerminal?: Effect.Effect<boolean> | undefined;
2019
2020
  /** Options for the theme; see {@link CliThemeOptions}. */
@@ -2521,10 +2522,9 @@ export declare class CliPrompt {
2521
2522
  * `CliRuntime.reportFailures`) renders it as one line with exit `130`; under a bare `runMain` it prints a
2522
2523
  * stack.
2523
2524
  *
2524
- * Pair it with `CliPrompt.gateTerminal`, which `CliEnv.layer` installs: core still runs `Prompt.run` on the
2525
- * answered prompt it is handed, and `Prompt.run` subscribes the terminal's input, which on a real terminal
2526
- * attaches a reader to stdin and drops piped input. The gate makes that subscription harmless when the run is
2527
- * not interactive.
2525
+ * Core runs `Prompt.run` on the answered prompt it is handed, and an answered prompt never reads the terminal's
2526
+ * input (core acquires it only when a prompt needs a key), so piped stdin is left untouched without any gate.
2527
+ * `CliPrompt.gateTerminal`, which `CliEnv.layer` installs, covers the prompts this function does not wrap.
2528
2528
  *
2529
2529
  * @param prompt - the prompt to show
2530
2530
  * @param options - the parameter it stands in for, and the non-interactive default
@@ -2534,12 +2534,12 @@ export declare class CliPrompt {
2534
2534
  * Gates core's `Terminal` on `CliInteractive`, so a run that is not interactive never touches the real one.
2535
2535
  *
2536
2536
  * @remarks
2537
- * Core's prompt runner subscribes the terminal's input even for a prompt that is already answered, and the
2538
- * real Node terminal then attaches a readline to stdin, which drops piped input and puts a TTY stdin into raw
2539
- * mode. Not interactive, this terminal's input is an already-ended queue, its `readLine` fails as quit and its
2540
- * `display` writes nothing, so any prompt, the wizard included, is quit at once and the real terminal is never
2541
- * read. Its `columns` and `rows` always come from the real one, so layout keeps working. Interactive, every
2542
- * call passes through to the real terminal.
2537
+ * A prompt that needs a key reads the terminal's input, and the real Node terminal then attaches a readline to
2538
+ * stdin, which drops piped input and puts a TTY stdin into raw mode. Core's `withFallbackPrompt`, a `Prompt.run`
2539
+ * in a handler and the command wizard all do so whether or not anyone is there to answer. Not interactive, this
2540
+ * terminal's input is an already-ended queue, its `readLine` fails as quit and its `display` writes nothing, so
2541
+ * any such prompt is quit at once and the real terminal is never read. Its `columns` and `rows` always come
2542
+ * from the real one, so layout keeps working. Interactive, every call passes through to the real terminal.
2543
2543
  *
2544
2544
  * The decision is made on every call, not when the layer is built, so a scope that narrows `CliInteractive`
2545
2545
  * later, such as an audience flag under `CliAudience.runWith`, gates it too.
@@ -2715,12 +2715,9 @@ interface MainOptions<RP, EP> extends ReportFailuresOptions {
2715
2715
  * already ended and its `display` writes nothing. A program that reads piped data must read `Stdio.stdin`, and
2716
2716
  * one that writes output must use `Console` or `Stdio`, never `Terminal`.
2717
2717
  *
2718
- * Stderr's colour mirrors stdout's terminal check unless `env.stderrIsTerminal` says otherwise, so with stderr
2719
- * redirected and stdout a terminal the failure report is painted into the file. On Node, pass the real check from
2720
- * the bin's entry, the one place it reads the host:
2721
- * `env: { stderrIsTerminal: Effect.sync(() => process.stderr.isTTY === true) }`. Core's `Stdio` reports only
2722
- * stdout (upstream Effect-TS/effect#8639); once core has a stderr check, this option reads it and the bin passes
2723
- * nothing.
2718
+ * Stderr's colour follows its own terminal check, read from core's `Stdio`, so with stderr redirected and stdout
2719
+ * a terminal the failure report goes into the file unpainted. `env.stderrIsTerminal` replaces that check for a
2720
+ * host whose `Stdio` cannot say; a bin on the platform `Stdio` passes nothing.
2724
2721
  */
2725
2722
  readonly env?: CliEnvOptions | undefined;
2726
2723
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effected/cli",
3
- "version": "0.16.2",
3
+ "version": "0.18.0",
4
4
  "private": false,
5
5
  "description": "The presentation boundary of an effect/cli program: audience-aware output, a document IR and renderers, editor links, failure reports and logging, plus opt-in Ink screens, widgets and a live view",
6
6
  "keywords": [
@@ -57,15 +57,15 @@
57
57
  "./package.json": "./package.json"
58
58
  },
59
59
  "dependencies": {
60
- "@effected/github-commands": "^0.2.2"
60
+ "@effected/github-commands": "^0.4.0"
61
61
  },
62
62
  "peerDependencies": {
63
- "@effected/config-file": "^0.14.3",
64
- "@effected/env": "^0.1.2",
65
- "@effected/glob": "^0.10.1",
66
- "@effected/walker": "^0.15.1",
63
+ "@effected/config-file": "^0.16.0",
64
+ "@effected/env": "^0.3.0",
65
+ "@effected/glob": "^0.12.0",
66
+ "@effected/walker": "^0.17.0",
67
67
  "@types/react": "^19.3.0",
68
- "effect": "4.0.2",
68
+ "effect": "^4.0.0",
69
69
  "ink": "^8.0.0",
70
70
  "react": "^19.3.0"
71
71
  },