Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fd878e8
feat: frame the menus in a header box and lay them out in columns
versnic Nov 5, 2026
6368f2f
docs: tick the framed header and menu layout
versnic Nov 5, 2026
9b9b905
feat: apply one colour theme to every prompt and support FORCE_COLOR
versnic Nov 5, 2026
ecac625
feat: shorten long workspace paths in the middle
versnic Nov 5, 2026
350254b
feat: exit with a clear message when input is not a terminal
versnic Nov 5, 2026
2029c49
feat: add buttons to the menus, go back with escape and use the alter…
versnic Nov 5, 2026
498c557
feat: reach the menu buttons with up and the wheel
versnic Nov 6, 2026
18f78d2
feat: start the header breadcrumb with the workspace folder name
versnic Nov 6, 2026
5fff2c5
feat: show the command, the result and the run time of each run
versnic Nov 6, 2026
544d154
feat: go back from the workspace prompt with escape
versnic Nov 6, 2026
5c3ddeb
feat: show each project's script count, git branch and package manager
versnic Nov 6, 2026
59fc716
feat: suggest common workspace folders on first run
versnic Nov 6, 2026
a9a7cb9
feat: choose an accent colour on the first run, and colour branches a…
versnic Nov 6, 2026
65d74a8
feat: colour the last run script and the buttons in the accent
versnic Nov 6, 2026
4790321
feat: colour the last run tag instead of the script name
versnic Nov 6, 2026
85cc2d5
feat: go back from the arguments prompt with escape
versnic Nov 6, 2026
efc9f5c
feat: replace the run and args row buttons with one run with args button
versnic Nov 6, 2026
fcf768d
feat: bring back the run row button, divided from run with args
versnic Nov 6, 2026
975786d
feat: draw the row button divider in the faint accent
versnic Nov 6, 2026
9b1d36e
feat: suggest workspace folders at drive roots and above the current …
versnic Nov 6, 2026
664c44a
fix: stop reading input before leaving raw mode, so menus never wait …
versnic Nov 6, 2026
aa7883d
feat: show at most three recent projects
versnic Nov 6, 2026
0d96502
docs: release the polished interface in 0.9.0 and move terminal check…
versnic Nov 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,21 @@ node scripts/try-install.js --again -- web dev # with arguments for dws
| `config.js` | Configuration file location, reading, writing and migration |
| `state.js` | The history of recent projects and last scripts (`state.json`) |
| `terminal.js` | Recognising the terminal and its mouse support, the mouse note |
| `workspace.js` | Listing projects, reading their scripts, resolving typed paths |
| `workspace.js` | Projects, scripts, Git branch, suggested folders, typed paths |
| `package-managers.js` | Detecting each project's package manager |
| `commands.js` | Running a script with that package manager |
| `json.js` | Parsing JSON files, ignoring a leading byte order mark |
| `aliases.js` | Creating, listing and removing custom aliases |
| `prompts.js` | The questions and menus shown by `cli.js` |
| `list.js` | The list used by every menu: keys, mouse, drawing, search |
| `list.js` | The list used by every menu: keys, mouse, buttons, drawing |
| `screen.js` | Entering and leaving the terminal's alternate screen |
| `fuzzy.js` | Fuzzy matching and ranking for the list search |
| `width.js` | Measuring, cutting and wrapping text by its terminal width |
| `ui.js` | Colours, the header and screen clearing |
| `ui.js` | The colour theme and the header box |

Menus use the list in `list.js`, which owns the terminal while it is open; free-text and yes/no questions still use `@inquirer/prompts`. Test the list through `createList()` with fake input and output streams, as `test/list.test.js` does, rather than in a real terminal. With `mouse: true`, the list asks for the cursor position after each drawing; a test answers with a reply such as `` (the last line is on row 20) before sending clicks. To see how a real terminal reports the mouse, run `node scripts/mouse-check.js` in it, and record the result in the roadmap's terminal support table and in `detectTerminal()`.
Menus use the list in `list.js`, which owns the terminal while it is open; free-text and yes/no questions still use `@inquirer/prompts`. The list also draws the header box from `ui.js`, which `cli.js` passes as `header`, so the whole screen redraws together. Actions such as Back or Exit are buttons, never list items: segments that carry a `{ target }`, whose columns the list records so clicks are mapped by row and column, and which Tab reaches from the keyboard. Menus with `fullscreen: true` are drawn on the alternate screen from `screen.js`, from its top row; pass a screen from `createScreen()` to `createList()` in tests. Test the list through `createList()` with fake input and output streams, as `test/list.test.js` does, rather than in a real terminal. With `mouse: true`, the list asks for the cursor position after each drawing; a test answers with a reply such as `` (the last line is on row 20) before sending clicks. To see how a real terminal reports the mouse, run `node scripts/mouse-check.js` in it, and record the result in the roadmap's terminal support table and in `detectTerminal()`.

Every colour comes from the theme in `ui.js`: `color()` for plain output, `styleText()` for the list, and `inquirerTheme()` for the `@inquirer/prompts` questions. Do not write ANSI codes elsewhere, so `NO_COLOR` and `FORCE_COLOR` are always respected. Ask for the `accent` style, never for cyan or another colour by name, so the user's chosen accent (`setAccent()`) reaches every screen.

Each file in `lib/` starts with a comment describing what it contains and how it is used. Keep that comment accurate when you change the file.

Expand Down
90 changes: 57 additions & 33 deletions README.md

Large diffs are not rendered by default.

49 changes: 30 additions & 19 deletions ROADMAP.md

Large diffs are not rendered by default.

57 changes: 38 additions & 19 deletions lib/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
//
// formatHelp() builds the `--help` text, which must list every option defined
// here. It colours headings, commands and placeholders through the given
// function (ui.color), so NO_COLOR and non-TTY output stay plain; with no
// function it returns plain text.
// function (ui.color), commands in the accent, so NO_COLOR, FORCE_COLOR,
// non-TTY output and the chosen accent are respected; with no function it
// returns plain text. --set-color accepts the names in ui.ACCENTS.
//
// splitArguments() splits arguments typed at the "Run with arguments…" prompt
// into a list, honouring single and double quotes. No shell is involved, so
Expand All @@ -20,10 +21,12 @@

import { parseArgs } from 'node:util'

import { ACCENTS } from './ui.js'

export function formatHelp(color = value => String(value)) {
return `
${color('Usage:', 'bold')} ${color('dev-workspace', 'cyan')} [options] [project [script] [-- arguments]]
${color('dws', 'cyan')} [options] [project [script] [-- arguments]]
${color('Usage:', 'bold')} ${color('dev-workspace', 'accent')} [options] [project [script] [-- arguments]]
${color('dws', 'accent')} [options] [project [script] [-- arguments]]

Browse the projects in your workspace and run their scripts.

Expand All @@ -32,28 +35,34 @@ export function formatHelp(color = value => String(value)) {
matches only one project. Arguments after -- are passed to the script.

${color('Examples:', 'bold')}
${color('dws web', 'cyan')} Open the scripts of the "web" project
${color('dws web dev', 'cyan')} Run the "dev" script of "web"
${color('dws web dev -- --port 4000', 'cyan')}
${color('dws web', 'accent')} Open the scripts of the "web" project
${color('dws web dev', 'accent')} Run the "dev" script of "web"
${color('dws web dev -- --port 4000', 'accent')}

${color('Options:', 'bold')}
${color('-w, --workspace', 'cyan')} ${color('<path>', 'dim')} Use <path> as the workspace and save it
${color('--no-mouse', 'cyan')} Use only the keyboard in menus, this time
${color('--set-mouse', 'cyan')} ${color('<on|off>', 'dim')}
${color('-w, --workspace', 'accent')} ${color('<path>', 'dim')} Use <path> as the workspace and save it
${color('--no-mouse', 'accent')} Use only the keyboard in menus, this time
${color('--set-mouse', 'accent')} ${color('<on|off>', 'dim')}
Save whether menus use the mouse
${color('--config-path', 'cyan')} Print the configuration file location
${color('--clear-history', 'cyan')} Forget recently used projects and scripts
${color('--add-alias', 'cyan')} ${color('<name>', 'dim')} Create another command that starts the CLI
${color('--remove-alias', 'cyan')} ${color('<name>', 'dim')}
${color('--set-color', 'accent')} ${color('<name>', 'dim')} Save the accent colour: cyan, blue, purple,
magenta, pink, orange, teal, sky, lavender,
coral, gold, bold
${color('--config-path', 'accent')} Print the configuration file location
${color('--clear-history', 'accent')} Forget recently used projects and scripts
${color('--add-alias', 'accent')} ${color('<name>', 'dim')} Create another command that starts the CLI
${color('--remove-alias', 'accent')} ${color('<name>', 'dim')}
Delete an alias created with --add-alias
${color('--list-aliases', 'cyan')} List the available commands
${color('--reset', 'cyan')} Delete the saved configuration, history and
${color('--list-aliases', 'accent')} List the available commands
${color('--reset', 'accent')} Delete the saved configuration, history and
aliases
${color('-v, --version', 'cyan')} Print the version
${color('-h, --help', 'cyan')} Show this help
${color('-v, --version', 'accent')} Print the version
${color('-h, --help', 'accent')} Show this help

${color('Environment:', 'bold')}
${color('DEV_WORKSPACE_CONFIG', 'cyan')} Use a custom configuration file path
${color('DEV_WORKSPACE_CONFIG', 'accent')} Use a custom configuration file path
${color('NO_COLOR', 'accent')} Turn colours off
${color('FORCE_COLOR', 'accent')} Turn colours on, even when output is not
a terminal (0 turns them off)
`
}

Expand All @@ -73,6 +82,7 @@ export function parseCliArgs(args) {
workspace: { type: 'string', short: 'w' },
'no-mouse': { type: 'boolean' },
'set-mouse': { type: 'string' },
'set-color': { type: 'string' },
'config-path': { type: 'boolean' },
'clear-history': { type: 'boolean' },
'add-alias': { type: 'string' },
Expand Down Expand Up @@ -109,6 +119,15 @@ export function parseCliArgs(args) {
)
}

if (
values['set-color'] !== undefined &&
!ACCENTS.includes(values['set-color'])
) {
throw new Error(
`Use --set-color with ${ACCENTS.slice(0, -1).join(', ')} or ${ACCENTS.at(-1)}, not "${values['set-color']}".${SEE_HELP}`,
)
}

if (separator !== -1 && script === undefined) {
throw new Error(
`Arguments after -- need a project and a script, for example: dws web dev -- --port 4000${SEE_HELP}`,
Expand Down
Loading
Loading