@doist/cli-core 0.4.0 → 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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.5.0](https://github.com/Doist/cli-core/compare/v0.4.0...v0.5.0) (2026-05-08)
2
+
3
+ ### Features
4
+
5
+ * add global args parser + factories ([#7](https://github.com/Doist/cli-core/issues/7)) ([419243e](https://github.com/Doist/cli-core/commit/419243e8543f180e15a2f6efe91d99a4c93bee40))
6
+
1
7
  ## [0.4.0](https://github.com/Doist/cli-core/compare/v0.3.0...v0.4.0) (2026-05-08)
2
8
 
3
9
  ### Features
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Centralized, type-safe parsing of well-known global CLI flags shared
3
+ * across the Doist CLIs.
4
+ *
5
+ * Replaces scattered `process.argv.includes()` checks with a single parse
6
+ * that correctly handles grouped short flags (e.g., `-vq`), repeated flags
7
+ * (e.g., `-vvv`), `--flag=value` forms, and avoids false-positives from
8
+ * option values.
9
+ *
10
+ * The parser is pure — pass an explicit argv for testing, or use
11
+ * `createGlobalArgsStore` for the lazy-cached singleton pattern. The store
12
+ * is generic so per-CLI extensions (e.g. todoist's `--user`/`--raw`,
13
+ * twist's `--non-interactive`) can layer their own fields over `GlobalArgs`.
14
+ */
15
+ import type { ViewOptions } from './options.js';
16
+ export type GlobalArgs = Required<Pick<ViewOptions, 'json' | 'ndjson'>> & {
17
+ quiet: boolean;
18
+ verbose: 0 | 1 | 2 | 3 | 4;
19
+ accessible: boolean;
20
+ noSpinner: boolean;
21
+ /** false = absent, true = present without path, string = path. */
22
+ progressJsonl: string | true | false;
23
+ };
24
+ /**
25
+ * Parse well-known global flags from `argv`. Pure — pass an explicit array
26
+ * for testing, or omit to read `process.argv.slice(2)`.
27
+ *
28
+ * The parser scans the entire argv: a CLI-specific positional that happens
29
+ * to look like a global short flag (`td comment add 123 -q`) will flip the
30
+ * matching global state. Workaround: use the standard `--` terminator
31
+ * (`td comment add 123 -- -q`) so the parser stops before the positional.
32
+ * The trade-off is intentional — callers run this before Commander has
33
+ * parsed argv, so we can't yet distinguish positionals from option values.
34
+ *
35
+ * `--progress-jsonl` accepts only the bare form (output to stderr) and the
36
+ * `--progress-jsonl=path` form. The space-separated `--progress-jsonl path`
37
+ * form is intentionally unsupported because it silently consumes the next
38
+ * positional argument (e.g., `td task add --progress-jsonl "Buy milk"`
39
+ * would treat `Buy milk` as a file path).
40
+ */
41
+ export declare function parseGlobalArgs(argv?: string[]): GlobalArgs;
42
+ export type GlobalArgsStore<T extends GlobalArgs = GlobalArgs> = {
43
+ get(): T;
44
+ /** Clear the cached parse result. Call from test teardown. */
45
+ reset(): void;
46
+ };
47
+ /**
48
+ * Lazy-cached singleton wrapper around a parser function. Each CLI builds
49
+ * one store at startup; callers read via `store.get()`. Tests reset between
50
+ * cases so a mutated `process.argv` is re-parsed on next access.
51
+ *
52
+ * ```ts
53
+ * // Vanilla — canonical fields only.
54
+ * const store = createGlobalArgsStore()
55
+ * export const isJsonMode = () => store.get().json
56
+ * export const resetGlobalArgs = store.reset
57
+ *
58
+ * // Extended — layer CLI-specific fields over GlobalArgs.
59
+ * type CliArgs = GlobalArgs & { user: string | undefined; raw: boolean }
60
+ * const store = createGlobalArgsStore<CliArgs>(() => {
61
+ * const base = parseGlobalArgs()
62
+ * const argv = process.argv.slice(2)
63
+ * return { ...base, user: parseUser(argv), raw: argv.includes('--raw') }
64
+ * })
65
+ * ```
66
+ */
67
+ export declare function createGlobalArgsStore(): GlobalArgsStore<GlobalArgs>;
68
+ export declare function createGlobalArgsStore<T extends GlobalArgs>(parse: () => T): GlobalArgsStore<T>;
69
+ export declare function isProgressJsonlEnabled(args: GlobalArgs): boolean;
70
+ export declare function getProgressJsonlPath(args: GlobalArgs): string | undefined;
71
+ export type AccessibleGateOptions = {
72
+ /** Env var that, when set to `'1'`, forces accessible mode (e.g. `TD_ACCESSIBLE`). */
73
+ envVar: string;
74
+ getArgs: () => GlobalArgs;
75
+ };
76
+ /**
77
+ * Build an `isAccessible` predicate that combines the `--accessible` flag
78
+ * with a CLI-specific opt-in env var (e.g. `TD_ACCESSIBLE=1`).
79
+ *
80
+ * ```ts
81
+ * const store = createGlobalArgsStore()
82
+ * export const isAccessible = createAccessibleGate({
83
+ * envVar: 'TD_ACCESSIBLE',
84
+ * getArgs: store.get,
85
+ * })
86
+ * ```
87
+ */
88
+ export declare function createAccessibleGate(opts: AccessibleGateOptions): () => boolean;
89
+ export type SpinnerGateOptions = {
90
+ /** Env var that, when set to `'false'`, force-disables the spinner (e.g. `TD_SPINNER`). */
91
+ envVar: string;
92
+ getArgs: () => GlobalArgs;
93
+ /**
94
+ * CLI-specific extra disable triggers — e.g. twist returns true when
95
+ * `--non-interactive` is set. Evaluated only after the canonical checks
96
+ * already returned false.
97
+ */
98
+ extraTriggers?: () => boolean;
99
+ };
100
+ /**
101
+ * Build a `shouldDisableSpinner` predicate. Disables on:
102
+ * - env var equals `'false'`
103
+ * - `isCI()`
104
+ * - any of `--json`, `--ndjson`, `--no-spinner`, `--progress-jsonl`, `--verbose`
105
+ * - `extraTriggers?.()` returning true
106
+ *
107
+ * Pair with `createSpinner({ isDisabled })` from `./spinner.js`.
108
+ *
109
+ * ```ts
110
+ * const store = createGlobalArgsStore()
111
+ *
112
+ * // todoist: env var + canonical flags only.
113
+ * const shouldDisableSpinner = createSpinnerGate({
114
+ * envVar: 'TD_SPINNER',
115
+ * getArgs: store.get,
116
+ * })
117
+ *
118
+ * // twist: also disable when --non-interactive is set.
119
+ * const shouldDisableSpinner = createSpinnerGate({
120
+ * envVar: 'TW_SPINNER',
121
+ * getArgs: store.get,
122
+ * extraTriggers: () => isNonInteractive(),
123
+ * })
124
+ *
125
+ * const { withSpinner } = createSpinner({ isDisabled: shouldDisableSpinner })
126
+ * ```
127
+ */
128
+ export declare function createSpinnerGate(opts: SpinnerGateOptions): () => boolean;
129
+ //# sourceMappingURL=global-args.d.ts.map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UAAU,CAAA;CAC5B,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,OAAO,CAE/E;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC7B,2FAA2F;IAC3F,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,UAAU,CAAA;IACzB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,OAAO,CAAA;CAChC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,OAAO,CAgBzE"}
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Centralized, type-safe parsing of well-known global CLI flags shared
3
+ * across the Doist CLIs.
4
+ *
5
+ * Replaces scattered `process.argv.includes()` checks with a single parse
6
+ * that correctly handles grouped short flags (e.g., `-vq`), repeated flags
7
+ * (e.g., `-vvv`), `--flag=value` forms, and avoids false-positives from
8
+ * option values.
9
+ *
10
+ * The parser is pure — pass an explicit argv for testing, or use
11
+ * `createGlobalArgsStore` for the lazy-cached singleton pattern. The store
12
+ * is generic so per-CLI extensions (e.g. todoist's `--user`/`--raw`,
13
+ * twist's `--non-interactive`) can layer their own fields over `GlobalArgs`.
14
+ */
15
+ import { isCI } from './terminal.js';
16
+ const SHORT_FLAGS = {
17
+ q: 'quiet',
18
+ v: 'verbose',
19
+ };
20
+ /**
21
+ * Parse well-known global flags from `argv`. Pure — pass an explicit array
22
+ * for testing, or omit to read `process.argv.slice(2)`.
23
+ *
24
+ * The parser scans the entire argv: a CLI-specific positional that happens
25
+ * to look like a global short flag (`td comment add 123 -q`) will flip the
26
+ * matching global state. Workaround: use the standard `--` terminator
27
+ * (`td comment add 123 -- -q`) so the parser stops before the positional.
28
+ * The trade-off is intentional — callers run this before Commander has
29
+ * parsed argv, so we can't yet distinguish positionals from option values.
30
+ *
31
+ * `--progress-jsonl` accepts only the bare form (output to stderr) and the
32
+ * `--progress-jsonl=path` form. The space-separated `--progress-jsonl path`
33
+ * form is intentionally unsupported because it silently consumes the next
34
+ * positional argument (e.g., `td task add --progress-jsonl "Buy milk"`
35
+ * would treat `Buy milk` as a file path).
36
+ */
37
+ export function parseGlobalArgs(argv) {
38
+ const args = argv ?? process.argv.slice(2);
39
+ const result = {
40
+ json: false,
41
+ ndjson: false,
42
+ quiet: false,
43
+ verbose: 0,
44
+ accessible: false,
45
+ noSpinner: false,
46
+ progressJsonl: false,
47
+ };
48
+ for (let i = 0; i < args.length; i++) {
49
+ const arg = args[i];
50
+ if (arg === '--')
51
+ break;
52
+ if (arg === '--json') {
53
+ result.json = true;
54
+ }
55
+ else if (arg === '--ndjson') {
56
+ result.ndjson = true;
57
+ }
58
+ else if (arg === '--quiet') {
59
+ result.quiet = true;
60
+ }
61
+ else if (arg === '--verbose') {
62
+ result.verbose = Math.min(result.verbose + 1, 4);
63
+ }
64
+ else if (arg === '--accessible') {
65
+ result.accessible = true;
66
+ }
67
+ else if (arg === '--no-spinner') {
68
+ result.noSpinner = true;
69
+ }
70
+ else if (arg === '--progress-jsonl') {
71
+ result.progressJsonl = true;
72
+ }
73
+ else if (arg.startsWith('--progress-jsonl=')) {
74
+ result.progressJsonl = arg.slice('--progress-jsonl='.length);
75
+ }
76
+ else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') {
77
+ // Short-flag group: -v, -vq, -vvv, etc. Unknown shorts are
78
+ // silently ignored — they belong to Commander or subcommands.
79
+ for (let j = 1; j < arg.length; j++) {
80
+ const mapped = SHORT_FLAGS[arg[j]];
81
+ if (mapped === 'verbose') {
82
+ result.verbose = Math.min(result.verbose + 1, 4);
83
+ }
84
+ else if (mapped === 'quiet') {
85
+ result.quiet = true;
86
+ }
87
+ }
88
+ }
89
+ }
90
+ return result;
91
+ }
92
+ export function createGlobalArgsStore(parse) {
93
+ // Overloads ensure callers passing a custom `T` must supply a matching
94
+ // parser; the implementation default only kicks in for the no-arg
95
+ // canonical case where `T` collapses to `GlobalArgs`.
96
+ const parser = parse ?? parseGlobalArgs;
97
+ let cached = null;
98
+ return {
99
+ get() {
100
+ if (cached === null)
101
+ cached = parser();
102
+ return cached;
103
+ },
104
+ reset() {
105
+ cached = null;
106
+ },
107
+ };
108
+ }
109
+ export function isProgressJsonlEnabled(args) {
110
+ return args.progressJsonl !== false;
111
+ }
112
+ export function getProgressJsonlPath(args) {
113
+ return typeof args.progressJsonl === 'string' ? args.progressJsonl : undefined;
114
+ }
115
+ /**
116
+ * Build an `isAccessible` predicate that combines the `--accessible` flag
117
+ * with a CLI-specific opt-in env var (e.g. `TD_ACCESSIBLE=1`).
118
+ *
119
+ * ```ts
120
+ * const store = createGlobalArgsStore()
121
+ * export const isAccessible = createAccessibleGate({
122
+ * envVar: 'TD_ACCESSIBLE',
123
+ * getArgs: store.get,
124
+ * })
125
+ * ```
126
+ */
127
+ export function createAccessibleGate(opts) {
128
+ return () => process.env[opts.envVar] === '1' || opts.getArgs().accessible;
129
+ }
130
+ /**
131
+ * Build a `shouldDisableSpinner` predicate. Disables on:
132
+ * - env var equals `'false'`
133
+ * - `isCI()`
134
+ * - any of `--json`, `--ndjson`, `--no-spinner`, `--progress-jsonl`, `--verbose`
135
+ * - `extraTriggers?.()` returning true
136
+ *
137
+ * Pair with `createSpinner({ isDisabled })` from `./spinner.js`.
138
+ *
139
+ * ```ts
140
+ * const store = createGlobalArgsStore()
141
+ *
142
+ * // todoist: env var + canonical flags only.
143
+ * const shouldDisableSpinner = createSpinnerGate({
144
+ * envVar: 'TD_SPINNER',
145
+ * getArgs: store.get,
146
+ * })
147
+ *
148
+ * // twist: also disable when --non-interactive is set.
149
+ * const shouldDisableSpinner = createSpinnerGate({
150
+ * envVar: 'TW_SPINNER',
151
+ * getArgs: store.get,
152
+ * extraTriggers: () => isNonInteractive(),
153
+ * })
154
+ *
155
+ * const { withSpinner } = createSpinner({ isDisabled: shouldDisableSpinner })
156
+ * ```
157
+ */
158
+ export function createSpinnerGate(opts) {
159
+ return () => {
160
+ if (process.env[opts.envVar] === 'false')
161
+ return true;
162
+ if (isCI())
163
+ return true;
164
+ const args = opts.getArgs();
165
+ if (args.json ||
166
+ args.ndjson ||
167
+ args.noSpinner ||
168
+ isProgressJsonlEnabled(args) ||
169
+ args.verbose > 0) {
170
+ return true;
171
+ }
172
+ return opts.extraTriggers?.() ?? false;
173
+ };
174
+ }
175
+ //# sourceMappingURL=global-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-args.js","sourceRoot":"","sources":["../src/global-args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAWpC,MAAM,WAAW,GAAwC;IACrD,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,SAAS;CACf,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAAC,IAAe;IAC3C,MAAM,IAAI,GAAG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAE1C,MAAM,MAAM,GAAe;QACvB,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,CAAC;QACV,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,KAAK;KACvB,CAAA;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QAEnB,IAAI,GAAG,KAAK,IAAI;YAAE,MAAK;QAEvB,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,GAAG,IAAI,CAAA;QACtB,CAAC;aAAM,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;Y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AAM,CAAC,KAAK,OAAO;YAAE,OAAO,IAAI,CAAA;QACrD,IAAI,IAAI,EAAE;YAAE,OAAO,IAAI,CAAA;QACvB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;QAC3B,IACI,IAAI,CAAC,IAAI;YACT,IAAI,CAAC,MAAM;YACX,IAAI,CAAC,SAAS;YACd,sBAAsB,CAAC,IAAI,CAAC;YAC5B,IAAI,CAAC,OAAO,GAAG,CAAC,EAClB,CAAC;YACC,OAAO,IAAI,CAAA;QACf,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,KAAK,CAAA;IAC1C,CAAC,CAAA;AACL,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,6 +3,8 @@ export type { ConfigErrorCode, ReadConfigStrictResult, WriteConfigOptions } from
3
3
  export { printEmpty } from './empty.js';
4
4
  export { CliError } from './errors.js';
5
5
  export type { CliErrorCode, CliErrorOptions, ErrorType } from './errors.js';
6
+ export { createAccessibleGate, createGlobalArgsStore, createSpinnerGate, getProgressJsonlPath, isProgressJsonlEnabled, parseGlobalArgs, } from './global-args.js';
7
+ export type { AccessibleGateOptions, GlobalArgs, GlobalArgsStore, SpinnerGateOptions, } from './global-args.js';
6
8
  export { formatJson, formatNdjson } from './json.js';
7
9
  export type { ViewOptions } from './options.js';
8
10
  export { createSpinner } from './spinner.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,2BAA2B,EAC3B,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,WAAW,GACd,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC9F,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,YAAY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AAa,EACb,UAAU,EACV,cAAc,GACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { BROKEN_CONFIG_STATE_TO_CODE, getConfigPath, readConfig, readConfigStrict, updateConfig, writeConfig, } from './config.js';
2
2
  export { printEmpty } from './empty.js';
3
3
  export { CliError } from './errors.js';
4
+ export { createAccessibleGate, createGlobalArgsStore, createSpinnerGate, getProgressJsonlPath, isProgressJsonlEnabled, parseGlobalArgs, } from './global-args.js';
4
5
  export { formatJson, formatNdjson } from './json.js';
5
6
  export { createSpinner } from './spinner.js';
6
7
  export { isCI, isStderrTTY, isStdinTTY, isStdoutTTY } from './terminal.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,2BAA2B,EAC3B,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,WAAW,GACd,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAQ5C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,2BAA2B,EAC3B,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,WAAW,GACd,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EACH,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,GAClB,MAAM,kBAAkB,CAAA;AAOzB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAQ5C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/cli-core",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Shared core utilities for Doist CLI projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",