@nowline/cli 0.8.6 → 0.10.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/README.md +32 -9
- package/dist/cli/args.d.ts +20 -4
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +20 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +31 -3
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/options.d.ts +74 -0
- package/dist/cli/options.d.ts.map +1 -0
- package/dist/cli/options.js +209 -0
- package/dist/cli/options.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mcp-install.d.ts +18 -0
- package/dist/commands/mcp-install.d.ts.map +1 -0
- package/dist/commands/mcp-install.js +151 -0
- package/dist/commands/mcp-install.js.map +1 -0
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +7 -12
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/render.d.ts +7 -0
- package/dist/commands/render.d.ts.map +1 -1
- package/dist/commands/render.js +161 -155
- package/dist/commands/render.js.map +1 -1
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +87 -60
- package/dist/commands/serve.js.map +1 -1
- package/dist/diagnostics/adapt.d.ts +12 -1
- package/dist/diagnostics/adapt.d.ts.map +1 -1
- package/dist/diagnostics/adapt.js +53 -1
- package/dist/diagnostics/adapt.js.map +1 -1
- package/dist/diagnostics/model.d.ts +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.d.ts.map +1 -1
- package/dist/generated/version.js +2 -2
- package/dist/generated/version.js.map +1 -1
- package/dist/i18n/locale.d.ts.map +1 -1
- package/dist/i18n/locale.js +2 -5
- package/dist/i18n/locale.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/io/config.d.ts +1 -1
- package/dist/io/config.d.ts.map +1 -1
- package/dist/io/config.js +1 -1
- package/dist/io/config.js.map +1 -1
- package/dist/io/log.d.ts +17 -0
- package/dist/io/log.d.ts.map +1 -0
- package/dist/io/log.js +16 -0
- package/dist/io/log.js.map +1 -0
- package/dist/mcp-install/clients.d.ts +58 -0
- package/dist/mcp-install/clients.d.ts.map +1 -0
- package/dist/mcp-install/clients.js +304 -0
- package/dist/mcp-install/clients.js.map +1 -0
- package/dist/mcp-install/host.d.ts +29 -0
- package/dist/mcp-install/host.d.ts.map +1 -0
- package/dist/mcp-install/host.js +72 -0
- package/dist/mcp-install/host.js.map +1 -0
- package/dist/mcp-install/json-config.d.ts +29 -0
- package/dist/mcp-install/json-config.d.ts.map +1 -0
- package/dist/mcp-install/json-config.js +139 -0
- package/dist/mcp-install/json-config.js.map +1 -0
- package/dist/mcp-install/server-command.d.ts +26 -0
- package/dist/mcp-install/server-command.d.ts.map +1 -0
- package/dist/mcp-install/server-command.js +52 -0
- package/dist/mcp-install/server-command.js.map +1 -0
- package/man/fr/nowline.1 +248 -19
- package/man/fr/nowline.5 +819 -45
- package/man/nowline.1 +193 -18
- package/man/nowline.5 +764 -36
- package/package.json +19 -19
- package/src/cli/args.ts +55 -5
- package/src/cli/help.ts +31 -3
- package/src/cli/options.ts +286 -0
- package/src/commands/init.ts +2 -3
- package/src/commands/mcp-install.ts +211 -0
- package/src/commands/mcp.ts +10 -14
- package/src/commands/render.ts +198 -195
- package/src/commands/serve.ts +102 -74
- package/src/diagnostics/adapt.ts +62 -0
- package/src/diagnostics/model.ts +1 -1
- package/src/generated/version.ts +2 -2
- package/src/i18n/locale.ts +2 -6
- package/src/index.ts +3 -0
- package/src/io/config.ts +0 -1
- package/src/io/log.ts +33 -0
- package/src/mcp-install/clients.ts +443 -0
- package/src/mcp-install/host.ts +106 -0
- package/src/mcp-install/json-config.ts +179 -0
- package/src/mcp-install/server-command.ts +75 -0
package/README.md
CHANGED
|
@@ -52,6 +52,8 @@ nowline <input> [options] # render (default)
|
|
|
52
52
|
nowline <input> --serve [-p <port>] # live HTTP preview
|
|
53
53
|
nowline --init [<name>] # scaffold a starter file
|
|
54
54
|
nowline <input> --dry-run # validate-only (no write)
|
|
55
|
+
nowline --mcp # MCP stdio server for AI agents
|
|
56
|
+
nowline --mcp-install [<client>] # register that server with your agents
|
|
55
57
|
nowline --help # print help
|
|
56
58
|
nowline --version # print version
|
|
57
59
|
nowline # no args → print help
|
|
@@ -99,18 +101,22 @@ nowline roadmap.nowline --headless # bundled DejaVu fonts (determi
|
|
|
99
101
|
| `--serve` | Live HTTP preview. Opt-in `-o <path>` writes on each rebuild. |
|
|
100
102
|
| `--init [<name>]` | Scaffold a starter `.nowline` in cwd. Auto-appends `.nowline`. |
|
|
101
103
|
| `-n, --dry-run` | Run pipeline; skip the write. Replaces the old `validate` verb. |
|
|
104
|
+
| `--mcp` | MCP stdio server (`--port <n>` for local HTTP), same as `npx @nowline/mcp`. |
|
|
105
|
+
| `--mcp-install [<client>]` | Register the MCP server with an agent; omit the client for every agent found. `-n` previews. |
|
|
106
|
+
| `--mcp-uninstall [<client>]` | Remove it again. |
|
|
102
107
|
|
|
103
108
|
### Render options
|
|
104
109
|
|
|
105
110
|
| Flag | Default | Notes |
|
|
106
111
|
|-----------------------|--------------|---------------------------------------------|
|
|
107
|
-
| `-t, --theme <name>` | `light` | `light` \| `dark`.
|
|
108
|
-
| `--now YYYY-MM-DD` | today (
|
|
112
|
+
| `-t, --theme <name>` | `light` | `light` \| `dark` \| `grayscale`. |
|
|
113
|
+
| `--now YYYY-MM-DD` | today (local) | Override the now-line anchor date. Use `--now -` to suppress it. Without `--now`, today is the local civil date, or the date in `--timezone` when set. |
|
|
109
114
|
| `--no-links` | (off) | Omit link icons from items. |
|
|
110
115
|
| `-s, --scale <n>` | `1` | Raster scale (PNG only). |
|
|
111
116
|
| `--strict` | (off) | Promote asset / sanitizer warnings to errors. |
|
|
112
|
-
| `-w, --width <px>` |
|
|
113
|
-
| `--
|
|
117
|
+
| `-w, --width <px>` | fit content | Maximum canvas width. The timeline shrinks to fit (down to 1 px/day); spilled captions can still overflow. |
|
|
118
|
+
| `--non-working <mode>` | (file key, else `hide`) | `hide` \| `show`. How a business calendar's non-working days appear: collapsed, or drawn as shaded bands. Overrides the file's `default roadmap non-working:` key; omit it to let the key apply. Also accepted by `--serve`. |
|
|
119
|
+
| `--asset-root <dir>` | `.nowlinerc` `assetRoot`, else input dir | Root for `logo:` / image refs. |
|
|
114
120
|
|
|
115
121
|
### Format-specific options
|
|
116
122
|
|
|
@@ -122,7 +128,7 @@ nowline roadmap.nowline --headless # bundled DejaVu fonts (determi
|
|
|
122
128
|
| `--font-sans <path\|alias>` | platform-resolved | png, pdf | TTF/OTF path, or alias `sf`, `helvetica`, `dejavu`, etc. |
|
|
123
129
|
| `--font-mono <path\|alias>` | platform-resolved | png, pdf | TTF/OTF path or alias for monospace. |
|
|
124
130
|
| `--headless` | (off) | png, pdf | Skip platform font probe; use bundled DejaVu pair. Byte-stable across machines. |
|
|
125
|
-
| `--start YYYY-MM-DD` | `today
|
|
131
|
+
| `--start YYYY-MM-DD` | `start:`, else today | msproj | Project start date. Defaults to the roadmap's `start:`, else the `--now` date. |
|
|
126
132
|
|
|
127
133
|
### Serve options
|
|
128
134
|
|
|
@@ -131,6 +137,19 @@ nowline roadmap.nowline --headless # bundled DejaVu fonts (determi
|
|
|
131
137
|
| `-p, --port <n>` | `4318` |
|
|
132
138
|
| `--host <host>` | `127.0.0.1` |
|
|
133
139
|
| `--open` | (off) |
|
|
140
|
+
| `-w, --width <px>` | `.nowlinerc` `width`, else fit content |
|
|
141
|
+
| `--no-links` | (off) |
|
|
142
|
+
| `--strict` | (off) |
|
|
143
|
+
|
|
144
|
+
### MCP options
|
|
145
|
+
|
|
146
|
+
`nowline --mcp-install` edits each agent's own config: `claude-code`, `claude-desktop`, `cursor`, `vscode`, `codex`, `gemini`, `antigravity`, `muse` (Meta Muse Code), `opencode`, `copilot` (GitHub Copilot CLI), `windsurf`, `zed`, `amp`, `goose`. Re-running is safe, and comments in JSON configs survive. Details: [`specs/cli.md` § `--mcp-install`](../../specs/cli.md).
|
|
147
|
+
|
|
148
|
+
| Flag | Default | Meaning |
|
|
149
|
+
|----------------------|---------|---------|
|
|
150
|
+
| `--root <dir>` | cwd | Folder the MCP file tools may use; with `--mcp-install`, written into the registered command. |
|
|
151
|
+
| `--scope <s>` | `user` | `user` (every project) or `project` (config files in cwd, for committing). |
|
|
152
|
+
| `--server <s>` | `self` | `self` registers this `nowline` binary, so a Homebrew install needs no Node; `npx` registers `npx -y @nowline/mcp`. |
|
|
134
153
|
|
|
135
154
|
### Logging (mutually exclusive)
|
|
136
155
|
|
|
@@ -195,13 +214,13 @@ Mutual exclusivity rules (all exit 2 with a message):
|
|
|
195
214
|
| Code | Meaning |
|
|
196
215
|
|------|---------|
|
|
197
216
|
| 0 | Success |
|
|
198
|
-
| 1 | Validation error |
|
|
217
|
+
| 1 | Validation error (including a wave rule across included files, e.g. `NL.E0202`) |
|
|
199
218
|
| 2 | Usage error (missing input, bad flags, unsupported format, file not found, empty stdin, invalid `--diagnostic-format`, binary→TTY refusal) |
|
|
200
|
-
| 3 | Output error (cannot write to destination, exporter failure, page too small for margin) |
|
|
219
|
+
| 3 | Output error (cannot write to destination, exporter failure, page too small for margin, unresolvable include) |
|
|
201
220
|
|
|
202
221
|
## Configuration: `.nowlinerc`
|
|
203
222
|
|
|
204
|
-
On any operation that takes an `<input>` file, `nowline` walks up from the input file's directory looking for a `.nowlinerc` (JSON or YAML). The nearest one wins.
|
|
223
|
+
On any operation that takes an `<input>` file, `nowline` walks up from the input file's directory looking for a `.nowlinerc` (JSON or YAML). The nearest one wins. Each key is the default for its flag: a flag on the command line wins, then the key, then the built-in default. An invalid value is a usage error that names the key. `--serve` reads `theme`, `width`, `locale` and `assetRoot`. Environment variables are not consulted, except the locale variables, which rank above the `locale` key.
|
|
205
224
|
|
|
206
225
|
```yaml
|
|
207
226
|
# .nowlinerc (YAML)
|
|
@@ -216,6 +235,8 @@ pdfMargin: 0.5in # --margin
|
|
|
216
235
|
fontSans: sf # --font-sans (alias or path)
|
|
217
236
|
fontMono: sf-mono # --font-mono
|
|
218
237
|
headlessFonts: false # --headless
|
|
238
|
+
useSystemFonts: false # --use-system-fonts
|
|
239
|
+
assetRoot: assets # --asset-root (relative to this file)
|
|
219
240
|
```
|
|
220
241
|
|
|
221
242
|
```json
|
|
@@ -228,7 +249,9 @@ headlessFonts: false # --headless
|
|
|
228
249
|
"pdfMargin": "0.5in",
|
|
229
250
|
"fontSans": "sf",
|
|
230
251
|
"fontMono": "sf-mono",
|
|
231
|
-
"headlessFonts": false
|
|
252
|
+
"headlessFonts": false,
|
|
253
|
+
"useSystemFonts": false,
|
|
254
|
+
"assetRoot": "assets"
|
|
232
255
|
}
|
|
233
256
|
```
|
|
234
257
|
|
package/dist/cli/args.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import type { LogLevel } from '../io/log.js';
|
|
2
|
+
export type ModeKind = 'render' | 'serve' | 'init' | 'mcp' | 'mcp-install' | 'mcp-uninstall' | 'help' | 'version';
|
|
3
|
+
export type McpScope = 'user' | 'project';
|
|
4
|
+
export type McpServerKind = 'self' | 'npx';
|
|
2
5
|
export interface ParsedArgs {
|
|
3
6
|
/** Resolved mode after dispatch (mutual-exclusivity already checked). */
|
|
4
7
|
mode: ModeKind;
|
|
5
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Positional argument, or undefined. Render = input path. Init = project name. Serve = input path.
|
|
10
|
+
* MCP install / uninstall = client id.
|
|
11
|
+
*/
|
|
6
12
|
positional?: string;
|
|
7
|
-
/** True if `--dry-run` / `-n` was passed (
|
|
13
|
+
/** True if `--dry-run` / `-n` was passed (render and MCP install / uninstall). */
|
|
8
14
|
dryRun: boolean;
|
|
9
15
|
/** Logging level. Verbose and quiet are mutually exclusive. */
|
|
10
|
-
logLevel:
|
|
16
|
+
logLevel: LogLevel;
|
|
11
17
|
output?: string;
|
|
12
18
|
format?: string;
|
|
13
19
|
inputFormat?: string;
|
|
@@ -29,6 +35,12 @@ export interface ParsedArgs {
|
|
|
29
35
|
scale?: string;
|
|
30
36
|
strict: boolean;
|
|
31
37
|
width?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Raw `--non-working` value (`hide` or `show`). Undefined means unset, so
|
|
40
|
+
* the file's `default roadmap non-working:` key still applies. Validated
|
|
41
|
+
* by the render and serve commands, like `--width`.
|
|
42
|
+
*/
|
|
43
|
+
nonWorking?: string;
|
|
32
44
|
assetRoot?: string;
|
|
33
45
|
pageSize?: string;
|
|
34
46
|
orientation?: string;
|
|
@@ -56,6 +68,10 @@ export interface ParsedArgs {
|
|
|
56
68
|
diagnosticFormat?: 'text' | 'json';
|
|
57
69
|
template?: string;
|
|
58
70
|
root?: string;
|
|
71
|
+
/** `--scope` for --mcp-install / --mcp-uninstall; validated in parseArgv. */
|
|
72
|
+
scope?: McpScope;
|
|
73
|
+
/** `--server` for --mcp-install; validated in parseArgv. */
|
|
74
|
+
server?: McpServerKind;
|
|
59
75
|
}
|
|
60
76
|
/**
|
|
61
77
|
* Pure argument parser. Walks `argv` once, identifies mode flags, applies
|
package/dist/cli/args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,MAAM,QAAQ,GACd,QAAQ,GACR,OAAO,GACP,MAAM,GACN,KAAK,GACL,aAAa,GACb,eAAe,GACf,MAAM,GACN,SAAS,CAAC;AAEhB,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAC1C,MAAM,MAAM,aAAa,GAAG,MA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AM,CAAC;IAGlB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CAsN7D"}
|
package/dist/cli/args.js
CHANGED
|
@@ -36,6 +36,8 @@ export function parseArgv(argv) {
|
|
|
36
36
|
serve: { type: 'boolean' },
|
|
37
37
|
init: { type: 'boolean' },
|
|
38
38
|
mcp: { type: 'boolean' },
|
|
39
|
+
'mcp-install': { type: 'boolean' },
|
|
40
|
+
'mcp-uninstall': { type: 'boolean' },
|
|
39
41
|
'dry-run': { type: 'boolean', short: 'n' },
|
|
40
42
|
theme: { type: 'string', short: 't' },
|
|
41
43
|
// `--now <date>` overrides the now-line position; without it, the
|
|
@@ -50,6 +52,7 @@ export function parseArgv(argv) {
|
|
|
50
52
|
scale: { type: 'string', short: 's' },
|
|
51
53
|
strict: { type: 'boolean' },
|
|
52
54
|
width: { type: 'string', short: 'w' },
|
|
55
|
+
'non-working': { type: 'string' },
|
|
53
56
|
'asset-root': { type: 'string' },
|
|
54
57
|
port: { type: 'string', short: 'p' },
|
|
55
58
|
host: { type: 'string' },
|
|
@@ -58,6 +61,8 @@ export function parseArgv(argv) {
|
|
|
58
61
|
template: { type: 'string' },
|
|
59
62
|
// MCP
|
|
60
63
|
root: { type: 'string' },
|
|
64
|
+
scope: { type: 'string' },
|
|
65
|
+
server: { type: 'string' },
|
|
61
66
|
// Format-specific (m2c)
|
|
62
67
|
'page-size': { type: 'string' },
|
|
63
68
|
orientation: { type: 'string' },
|
|
@@ -115,6 +120,10 @@ export function parseArgv(argv) {
|
|
|
115
120
|
modes.push('init');
|
|
116
121
|
if (values.mcp === true)
|
|
117
122
|
modes.push('mcp');
|
|
123
|
+
if (values['mcp-install'] === true)
|
|
124
|
+
modes.push('mcp-install');
|
|
125
|
+
if (values['mcp-uninstall'] === true)
|
|
126
|
+
modes.push('mcp-uninstall');
|
|
118
127
|
if (modes.length > 1) {
|
|
119
128
|
throw new CliError(ExitCode.InputError, `nowline: --${modes[0]} and --${modes[1]} are mutually exclusive.`);
|
|
120
129
|
}
|
|
@@ -130,6 +139,14 @@ export function parseArgv(argv) {
|
|
|
130
139
|
.join(' ');
|
|
131
140
|
throw new CliError(ExitCode.InputError, `nowline: unexpected extra arguments: ${extras}.`);
|
|
132
141
|
}
|
|
142
|
+
const scope = stringOrUndefined(values.scope);
|
|
143
|
+
if (scope !== undefined && scope !== 'user' && scope !== 'project') {
|
|
144
|
+
throw new CliError(ExitCode.InputError, `nowline: invalid --scope "${scope}". Expected user or project.`);
|
|
145
|
+
}
|
|
146
|
+
const server = stringOrUndefined(values.server);
|
|
147
|
+
if (server !== undefined && server !== 'self' && server !== 'npx') {
|
|
148
|
+
throw new CliError(ExitCode.InputError, `nowline: invalid --server "${server}". Expected self or npx.`);
|
|
149
|
+
}
|
|
133
150
|
const rawDiagnosticFormat = stringOrUndefined(values['diagnostic-format']);
|
|
134
151
|
if (rawDiagnosticFormat !== undefined && !isDiagnosticFormat(rawDiagnosticFormat)) {
|
|
135
152
|
throw new CliError(ExitCode.InputError, `nowline: invalid --diagnostic-format "${rawDiagnosticFormat}". Expected text or json. Try --help for usage.`);
|
|
@@ -150,6 +167,7 @@ export function parseArgv(argv) {
|
|
|
150
167
|
scale: stringOrUndefined(values.scale),
|
|
151
168
|
strict: values.strict === true,
|
|
152
169
|
width: stringOrUndefined(values.width),
|
|
170
|
+
nonWorking: stringOrUndefined(values['non-working']),
|
|
153
171
|
assetRoot: stringOrUndefined(values['asset-root']),
|
|
154
172
|
port: stringOrUndefined(values.port),
|
|
155
173
|
host: stringOrUndefined(values.host),
|
|
@@ -166,6 +184,8 @@ export function parseArgv(argv) {
|
|
|
166
184
|
start: stringOrUndefined(values.start),
|
|
167
185
|
locale: stringOrUndefined(values.locale),
|
|
168
186
|
root: stringOrUndefined(values.root),
|
|
187
|
+
scope,
|
|
188
|
+
server,
|
|
169
189
|
};
|
|
170
190
|
}
|
|
171
191
|
function stringOrUndefined(value) {
|
package/dist/cli/args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAyGzD;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,IAAuB;IAC7C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO;YACH,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,KAAK;YACf,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;IAED,MAAM,MAAM,GAAoB;QAC5B,IAAI,EAAE,IAAgB;QACtB,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE;YACL,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;YACrC,OAAO,EAAE,EAAE,IAAI,EAAE,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AAC,IAAI,CAAC;QACpC,KAAK;QACL,MAAM;KACT,CAAC;AACN,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAe;IACrC,IAAI,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACvC,OAAO,YAAY,OAAO,yBAAyB,CAAC;IACxD,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,OAAO,YAAY,OAAO,yBAAyB,CAAC;IACxD,CAAC;IACD,OAAO,YAAY,OAAO,EAAE,CAAC;AACjC,CAAC"}
|
package/dist/cli/help.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AA8JA,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
package/dist/cli/help.js
CHANGED
|
@@ -8,6 +8,7 @@ USAGE
|
|
|
8
8
|
nowline <input> [options]
|
|
9
9
|
nowline --serve <input> [options]
|
|
10
10
|
nowline --init [<name>]
|
|
11
|
+
nowline --mcp-install [<client>] [options]
|
|
11
12
|
nowline --version
|
|
12
13
|
nowline --help
|
|
13
14
|
|
|
@@ -34,6 +35,14 @@ MODE FLAGS (mutually exclusive)
|
|
|
34
35
|
exposing validate, render, export, and file tools.
|
|
35
36
|
Shares the same @nowline/mcp server code as
|
|
36
37
|
\`npx @nowline/mcp\`.
|
|
38
|
+
--mcp-install [<client>]
|
|
39
|
+
Register the MCP server with an agent: claude-code,
|
|
40
|
+
claude-desktop, cursor, vscode, codex, gemini,
|
|
41
|
+
antigravity, muse, opencode, copilot, windsurf, zed,
|
|
42
|
+
amp, goose, or all. Omitted: every agent found on this machine.
|
|
43
|
+
Re-running is safe; -n previews the change.
|
|
44
|
+
--mcp-uninstall [<client>]
|
|
45
|
+
Remove the server from the same configs.
|
|
37
46
|
-n, --dry-run Run the full pipeline (parse + validate + layout +
|
|
38
47
|
format) but skip the write step. Subsumes the old
|
|
39
48
|
'validate' verb. Exit 0 on success, 1 on errors.
|
|
@@ -65,8 +74,18 @@ RENDER OPTIONS
|
|
|
65
74
|
--no-links Omit link icons from rendered items.
|
|
66
75
|
-s, --scale <n> Raster scale factor (PNG only; default 1).
|
|
67
76
|
--strict Promote asset / sanitizer warnings to errors.
|
|
68
|
-
-w, --width <px>
|
|
69
|
-
|
|
77
|
+
-w, --width <px> Maximum canvas width in pixels. Default: fit the
|
|
78
|
+
content. A wider roadmap shrinks its timeline to
|
|
79
|
+
fit; long captions can still overflow it.
|
|
80
|
+
--non-working <hide|show>
|
|
81
|
+
How a business calendar's non-working days appear:
|
|
82
|
+
hide collapses them (the default), show draws them
|
|
83
|
+
as shaded bands. Overrides the file's
|
|
84
|
+
'default roadmap non-working:' key; omit it to let
|
|
85
|
+
the key apply. Mermaid, MS Project, and XLSX output
|
|
86
|
+
is the same in both views.
|
|
87
|
+
--asset-root <dir> Root for logo / image assets (default: the
|
|
88
|
+
.nowlinerc assetRoot key, then the input dir).
|
|
70
89
|
--locale <bcp47> BCP-47 locale (e.g. fr, fr-CA) for CLI message
|
|
71
90
|
output (validator diagnostics, --help, errors).
|
|
72
91
|
Used as a fallback for the rendered drawing only
|
|
@@ -98,6 +117,13 @@ SERVE OPTIONS
|
|
|
98
117
|
MCP OPTIONS
|
|
99
118
|
--root <dir> Allowed-root directory for file tools (default: cwd).
|
|
100
119
|
File paths are resolved and restricted to this root.
|
|
120
|
+
With --mcp-install, written into the registered
|
|
121
|
+
command.
|
|
122
|
+
--scope <s> --mcp-install target: user (default, every
|
|
123
|
+
project) or project (config files in cwd).
|
|
124
|
+
--server <s> What --mcp-install registers: self (default, this
|
|
125
|
+
nowline binary; needs no Node) or npx
|
|
126
|
+
(npx -y @nowline/mcp, tracks npm).
|
|
101
127
|
|
|
102
128
|
LOGGING (mutually exclusive)
|
|
103
129
|
-v, --verbose Print extra diagnostics to stderr.
|
|
@@ -117,8 +143,10 @@ EXAMPLES
|
|
|
117
143
|
nowline roadmap.nowline --dry-run # validate-only
|
|
118
144
|
nowline roadmap.nowline --serve -p 8080 # live preview
|
|
119
145
|
nowline --init my-project # scaffold ./my-project.nowline
|
|
120
|
-
nowline --mcp # start MCP stdio server
|
|
146
|
+
nowline --mcp # start MCP stdio server
|
|
121
147
|
nowline --mcp --root ./roadmaps # MCP server with custom root
|
|
148
|
+
nowline --mcp-install # register with every agent found
|
|
149
|
+
nowline --mcp-install cursor --scope project -n # preview .cursor/mcp.json
|
|
122
150
|
|
|
123
151
|
EXIT CODES
|
|
124
152
|
0 Success
|
package/dist/cli/help.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,sEAAsE;AACtE,oEAAoE;AACpE,2DAA2D;AAC3D,MAAM,SAAS,GAAG,WAAW,iBAAiB,EAAE
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,sEAAsE;AACtE,oEAAoE;AACpE,2DAA2D;AAC3D,MAAM,SAAS,GAAG,WAAW,iBAAiB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuJ/C,CAAC;AAEF,MAAM,UAAU,UAAU;IACtB,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,aAAa;IACzB,OAAO,GAAG,iBAAiB,EAAE,IAAI,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type NowlineRc, type OptionError, type OptionSpec, type SurfaceOptions } from '@nowline/config';
|
|
2
|
+
import type { ParsedArgs } from './args.js';
|
|
3
|
+
export type PdfOrientation = 'portrait' | 'landscape' | 'auto';
|
|
4
|
+
/** Every option the CLI resolves over its flag and rc layers: the shared five, then its own. */
|
|
5
|
+
export declare const CLI_OPTION_SPECS: Readonly<{
|
|
6
|
+
theme: OptionSpec<import("@nowline/layout").ThemeName>;
|
|
7
|
+
width: OptionSpec<number>;
|
|
8
|
+
now: OptionSpec<Date | null>;
|
|
9
|
+
pageSize: OptionSpec<import("@nowline/export-core").PdfPageSize>;
|
|
10
|
+
nonWorking: OptionSpec<import("@nowline/layout").NonWorkingDisplay>;
|
|
11
|
+
orientation: OptionSpec<PdfOrientation>;
|
|
12
|
+
margin: OptionSpec<number>;
|
|
13
|
+
defaultFormat: OptionSpec<string>;
|
|
14
|
+
fontSans: OptionSpec<string>;
|
|
15
|
+
fontMono: OptionSpec<string>;
|
|
16
|
+
headless: OptionSpec<boolean>;
|
|
17
|
+
useSystemFonts: OptionSpec<boolean>;
|
|
18
|
+
locale: OptionSpec<string>;
|
|
19
|
+
assetRoot: OptionSpec<string>;
|
|
20
|
+
}>;
|
|
21
|
+
type CliSpecs = typeof CLI_OPTION_SPECS;
|
|
22
|
+
export type CliOptionKey = Extract<keyof CliSpecs, string>;
|
|
23
|
+
export interface CliOptions {
|
|
24
|
+
/** Theme, width, now-line date and non-working display; page size when set. */
|
|
25
|
+
surface: SurfaceOptions;
|
|
26
|
+
orientation?: PdfOrientation;
|
|
27
|
+
/** Page margin in points. */
|
|
28
|
+
margin?: number;
|
|
29
|
+
/** The rc `defaultFormat`; the `--format` flag is resolved by `resolveFormat`. */
|
|
30
|
+
defaultFormat?: string;
|
|
31
|
+
fontSans?: string;
|
|
32
|
+
fontMono?: string;
|
|
33
|
+
headless: boolean;
|
|
34
|
+
useSystemFonts: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Where `logo:` assets are read from, as an absolute path: `--asset-root`,
|
|
37
|
+
* else the rc `assetRoot`. Unset means the input file's directory.
|
|
38
|
+
*/
|
|
39
|
+
assetRoot?: string;
|
|
40
|
+
/** The rc `locale`; the flag and `NOWLINE_LOCALE` rank above it (`resolveLocaleOverride`). */
|
|
41
|
+
rcLocale?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Throw the first invalid option as a usage error, in the order the CLI
|
|
44
|
+
* has always reported them: theme, timezone, now, width, non-working.
|
|
45
|
+
*/
|
|
46
|
+
assertValid(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Throw the first invalid PDF setting (page size, orientation, margin).
|
|
49
|
+
* Run after validation, so these errors follow any diagnostics.
|
|
50
|
+
*/
|
|
51
|
+
assertPdfSettingsValid(): void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Resolve the CLI's options over the flag layer, then the `.nowlinerc` layer.
|
|
55
|
+
* `render` and `--serve` both call this, so they read the same keys the same
|
|
56
|
+
* way. `cwd` is what a relative `--asset-root` resolves against (default: the
|
|
57
|
+
* process's). Nothing throws here: a caller reads `defaultFormat` early and reports bad
|
|
58
|
+
* values at the point it always did, through `assertValid`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolveCliOptions(args: ParsedArgs, config: NowlineRc | null, context?: {
|
|
61
|
+
rcPath?: string;
|
|
62
|
+
cwd?: string;
|
|
63
|
+
clock?: () => Date;
|
|
64
|
+
}): CliOptions;
|
|
65
|
+
/**
|
|
66
|
+
* An {@link OptionError} in the CLI's wording, naming the flag or `.nowlinerc`
|
|
67
|
+
* key the value came from: `nowline: invalid --width "abc". Must be an integer
|
|
68
|
+
* ≥ 320.` The templates are the ones the CLI used before the schema, so
|
|
69
|
+
* scripts that match them keep working.
|
|
70
|
+
*/
|
|
71
|
+
export declare function formatOptionError(error: OptionError<string>): string;
|
|
72
|
+
export declare function formatChoices(names: readonly string[]): string;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/cli/options.ts"],"names":[],"mappings":"AAQA,OAAO,EAEH,KAAK,SAAS,EACd,KAAK,WAAW,EAGhB,KAAK,UAAU,EAKf,KAAK,cAAc,EACtB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAI5C,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,CAAC;AAqC/D,gGAAgG;AAChG,eAAO,MAAM,gBAAgB;;;;;;iBAE4C,UAAU,CAAC,cAAc,CAAC;YACzC,UAAU,CAAC,MAAM,CAAC;mBACL,UAAU,CAAC,MAAM,CAAC;cAC5B,UAAU,CAAC,MAAM,CAAC;cAClB,UAAU,CAAC,MAAM,CAAC;cACb,UAAU,CAAC,OAAO,CAAC;oBACZ,UAAU,CAAC,OAAO,CAAC;YACnC,UAAU,CAAC,MAAM,CAAC;eACzC,UAAU,CAAC,MAAM,CAAC;EAClD,CAAC;AAEH,KAAK,QAAQ,GAAG,OAAO,gBAAgB,CAAC;AACxC,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,QAAQ,EAAE,MAAM,CAAC,CAAC;AAoB3D,MAAM,WAAW,UAAU;IACvB,+EAA+E;IAC/E,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,IAAI,IAAI,CAAC;IACpB;;;OAGG;IACH,sBAAsB,IAAI,IAAI,CAAC;CAClC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,SAAS,GAAG,IAAI,EACxB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAA;CAAO,GACpE,UAAU,CA2CZ;AA+DD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAcpE;AAcD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAG9D"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// How the CLI turns flags and `.nowlinerc` keys into render options. The five
|
|
2
|
+
// shared options (theme, width, now, page size, non-working display) come from
|
|
3
|
+
// `@nowline/config`'s schema; the CLI-only keys are registered here as option
|
|
4
|
+
// specs over the same two layers, so adding an rc key is one entry in
|
|
5
|
+
// `CLI_OPTION_SPECS` rather than a hand-written merge in each command
|
|
6
|
+
// (specs/surface-options.md §3.1).
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
import { ASSET_ROOT_SPEC, rcLayer, resolveOptions, resolveSurfaceOptions, SURFACE_OPTION_SPECS, } from '@nowline/config';
|
|
9
|
+
import { lengthToPoints, parseLength } from '@nowline/export-core';
|
|
10
|
+
import { normalizeZone, TimezoneError } from '@nowline/layout';
|
|
11
|
+
import { CliError, ExitCode } from '../io/exit-codes.js';
|
|
12
|
+
const ORIENTATIONS = ['portrait', 'landscape', 'auto'];
|
|
13
|
+
/** An rc key the CLI reads as a string; any other type is ignored, as it always was. */
|
|
14
|
+
function lenientString(raw) {
|
|
15
|
+
return { ok: true, value: typeof raw === 'string' ? raw : undefined };
|
|
16
|
+
}
|
|
17
|
+
/** An rc or flag switch: only a literal `true` turns it on. */
|
|
18
|
+
function lenientSwitch(raw) {
|
|
19
|
+
return { ok: true, value: raw === true ? true : undefined };
|
|
20
|
+
}
|
|
21
|
+
function parseOrientation(raw) {
|
|
22
|
+
if (raw === '')
|
|
23
|
+
return { ok: true, value: undefined };
|
|
24
|
+
const lower = typeof raw === 'string' ? raw.toLowerCase() : undefined;
|
|
25
|
+
const found = ORIENTATIONS.find((orientation) => orientation === lower);
|
|
26
|
+
if (found)
|
|
27
|
+
return { ok: true, value: found };
|
|
28
|
+
return { ok: false, detail: 'must be an orientation', expected: ORIENTATIONS };
|
|
29
|
+
}
|
|
30
|
+
function parseMargin(raw) {
|
|
31
|
+
if (raw === '')
|
|
32
|
+
return { ok: true, value: undefined };
|
|
33
|
+
// A bare number is points; YAML and JSON hand the rc one over as a number.
|
|
34
|
+
if (typeof raw === 'number' && Number.isFinite(raw) && raw >= 0) {
|
|
35
|
+
return { ok: true, value: raw };
|
|
36
|
+
}
|
|
37
|
+
const text = String(raw);
|
|
38
|
+
if (/^\d+(?:\.\d+)?$/.test(text))
|
|
39
|
+
return { ok: true, value: Number(text) };
|
|
40
|
+
try {
|
|
41
|
+
return { ok: true, value: lengthToPoints(parseLength(text)) };
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
return { ok: false, detail: err instanceof Error ? err.message : String(err) };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Every option the CLI resolves over its flag and rc layers: the shared five, then its own. */
|
|
48
|
+
export const CLI_OPTION_SPECS = Object.freeze({
|
|
49
|
+
...SURFACE_OPTION_SPECS,
|
|
50
|
+
orientation: { rcKey: 'pdfOrientation', parse: parseOrientation },
|
|
51
|
+
margin: { rcKey: 'pdfMargin', parse: parseMargin },
|
|
52
|
+
defaultFormat: { rcKey: 'defaultFormat', parse: lenientString },
|
|
53
|
+
fontSans: { rcKey: 'fontSans', parse: lenientString },
|
|
54
|
+
fontMono: { rcKey: 'fontMono', parse: lenientString },
|
|
55
|
+
headless: { rcKey: 'headlessFonts', parse: lenientSwitch },
|
|
56
|
+
useSystemFonts: { rcKey: 'useSystemFonts', parse: lenientSwitch },
|
|
57
|
+
locale: { rcKey: 'locale', parse: lenientString },
|
|
58
|
+
assetRoot: ASSET_ROOT_SPEC,
|
|
59
|
+
});
|
|
60
|
+
/** The flag each option is passed as, for an error that names its source. */
|
|
61
|
+
const FLAG_NAMES = {
|
|
62
|
+
theme: '--theme',
|
|
63
|
+
width: '--width',
|
|
64
|
+
now: '--now',
|
|
65
|
+
pageSize: '--page-size',
|
|
66
|
+
nonWorking: '--non-working',
|
|
67
|
+
orientation: '--orientation',
|
|
68
|
+
margin: '--margin',
|
|
69
|
+
fontSans: '--font-sans',
|
|
70
|
+
fontMono: '--font-mono',
|
|
71
|
+
headless: '--headless',
|
|
72
|
+
useSystemFonts: '--use-system-fonts',
|
|
73
|
+
assetRoot: '--asset-root',
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Resolve the CLI's options over the flag layer, then the `.nowlinerc` layer.
|
|
77
|
+
* `render` and `--serve` both call this, so they read the same keys the same
|
|
78
|
+
* way. `cwd` is what a relative `--asset-root` resolves against (default: the
|
|
79
|
+
* process's). Nothing throws here: a caller reads `defaultFormat` early and reports bad
|
|
80
|
+
* values at the point it always did, through `assertValid`.
|
|
81
|
+
*/
|
|
82
|
+
export function resolveCliOptions(args, config, context = {}) {
|
|
83
|
+
const { rcPath, cwd, clock } = context;
|
|
84
|
+
const layers = [flagLayer(args), rcLayer(config ?? {}, CLI_OPTION_SPECS)];
|
|
85
|
+
// `--timezone` is validated even when `--now` is explicit, as it always was.
|
|
86
|
+
const zone = readZone(args.timezone);
|
|
87
|
+
const { options, errors: surfaceErrors } = resolveSurfaceOptions(layers, { theme: 'light' }, { zone: zone.zone, clock });
|
|
88
|
+
const { values, errors: cliErrors } = resolveOptions(CLI_OPTION_SPECS, layers);
|
|
89
|
+
const failures = new Map([...surfaceErrors, ...cliErrors].map((error) => [error.key, error]));
|
|
90
|
+
const failure = (key) => {
|
|
91
|
+
const error = failures.get(key);
|
|
92
|
+
return error && new CliError(ExitCode.InputError, formatOptionError(error));
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
surface: options,
|
|
96
|
+
orientation: values.orientation,
|
|
97
|
+
margin: values.margin,
|
|
98
|
+
defaultFormat: values.defaultFormat,
|
|
99
|
+
fontSans: values.fontSans,
|
|
100
|
+
fontMono: values.fontMono,
|
|
101
|
+
headless: values.headless ?? false,
|
|
102
|
+
useSystemFonts: values.useSystemFonts ?? false,
|
|
103
|
+
assetRoot: absoluteAssetRoot(values.assetRoot, args.assetRoot !== undefined, rcPath, cwd),
|
|
104
|
+
rcLocale: values.locale,
|
|
105
|
+
assertValid: () => throwFirst([
|
|
106
|
+
failure('theme'),
|
|
107
|
+
zone.error,
|
|
108
|
+
failure('now'),
|
|
109
|
+
failure('width'),
|
|
110
|
+
failure('nonWorking'),
|
|
111
|
+
failure('assetRoot'),
|
|
112
|
+
]),
|
|
113
|
+
assertPdfSettingsValid: () => throwFirst([failure('pageSize'), failure('orientation'), failure('margin')]),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function throwFirst(candidates) {
|
|
117
|
+
for (const candidate of candidates) {
|
|
118
|
+
if (candidate)
|
|
119
|
+
throw candidate;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function flagLayer(args) {
|
|
123
|
+
return {
|
|
124
|
+
source: (key) => ({ kind: 'flag', name: FLAG_NAMES[key] ?? `--${key}` }),
|
|
125
|
+
values: {
|
|
126
|
+
// An empty `--theme ""` has always meant "not passed", so the rc theme applies.
|
|
127
|
+
theme: args.theme || undefined,
|
|
128
|
+
width: args.width,
|
|
129
|
+
now: args.now,
|
|
130
|
+
pageSize: args.pageSize,
|
|
131
|
+
nonWorking: args.nonWorking,
|
|
132
|
+
orientation: args.orientation,
|
|
133
|
+
margin: args.margin,
|
|
134
|
+
fontSans: args.fontSans,
|
|
135
|
+
fontMono: args.fontMono,
|
|
136
|
+
assetRoot: args.assetRoot,
|
|
137
|
+
// A switch flag is absent or on; absent leaves the rc to decide.
|
|
138
|
+
headless: args.headless || undefined,
|
|
139
|
+
useSystemFonts: args.useSystemFonts || undefined,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function readZone(raw) {
|
|
144
|
+
if (!raw)
|
|
145
|
+
return {};
|
|
146
|
+
try {
|
|
147
|
+
return { zone: normalizeZone(raw) };
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
if (err instanceof TimezoneError) {
|
|
151
|
+
return { error: new CliError(ExitCode.InputError, err.message) };
|
|
152
|
+
}
|
|
153
|
+
throw err;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// ---- Asset root -------------------------------------------------------------
|
|
157
|
+
/**
|
|
158
|
+
* The asset root as an absolute path. A flag resolves against `cwd` (the
|
|
159
|
+
* process's, unless a caller passes its own); an rc value against the
|
|
160
|
+
* directory of the `.nowlinerc` it came from, so a checked-in `assetRoot:
|
|
161
|
+
* assets` means the same directory wherever `nowline` is run from.
|
|
162
|
+
*/
|
|
163
|
+
function absoluteAssetRoot(value, fromFlag, rcPath, cwd) {
|
|
164
|
+
if (value === undefined)
|
|
165
|
+
return undefined;
|
|
166
|
+
if (fromFlag || rcPath === undefined)
|
|
167
|
+
return path.resolve(cwd ?? '.', value);
|
|
168
|
+
return path.resolve(path.dirname(rcPath), value);
|
|
169
|
+
}
|
|
170
|
+
// ---- Error text -------------------------------------------------------------
|
|
171
|
+
/**
|
|
172
|
+
* An {@link OptionError} in the CLI's wording, naming the flag or `.nowlinerc`
|
|
173
|
+
* key the value came from: `nowline: invalid --width "abc". Must be an integer
|
|
174
|
+
* ≥ 320.` The templates are the ones the CLI used before the schema, so
|
|
175
|
+
* scripts that match them keep working.
|
|
176
|
+
*/
|
|
177
|
+
export function formatOptionError(error) {
|
|
178
|
+
const lead = `nowline: invalid ${describeSource(error.source)} "${String(error.raw)}"`;
|
|
179
|
+
if (error.expected)
|
|
180
|
+
return `${lead}. Expected ${formatChoices(error.expected)}.`;
|
|
181
|
+
switch (error.key) {
|
|
182
|
+
// Detail reads "must be YYYY-MM-DD, ...": the CLI says "Expected".
|
|
183
|
+
case 'now':
|
|
184
|
+
return `${lead}. Expected ${error.detail.replace(/^must be /, '')}.`;
|
|
185
|
+
// These two carry the parser's own message after a colon.
|
|
186
|
+
case 'pageSize':
|
|
187
|
+
case 'margin':
|
|
188
|
+
return `${lead}: ${error.detail}`;
|
|
189
|
+
default:
|
|
190
|
+
return `${lead}. ${error.detail.charAt(0).toUpperCase()}${error.detail.slice(1)}.`;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function describeSource(source) {
|
|
194
|
+
switch (source.kind) {
|
|
195
|
+
case 'flag':
|
|
196
|
+
case 'argument':
|
|
197
|
+
case 'setting':
|
|
198
|
+
return source.name;
|
|
199
|
+
case 'rc':
|
|
200
|
+
return `.nowlinerc ${source.key}`;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// `a`, `a or b`, `a, b, or c`.
|
|
204
|
+
export function formatChoices(names) {
|
|
205
|
+
if (names.length <= 2)
|
|
206
|
+
return names.join(' or ');
|
|
207
|
+
return `${names.slice(0, -1).join(', ')}, or ${names[names.length - 1]}`;
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=options.js.map
|