mcp-ssh-manager 3.8.7 → 4.0.1
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/.eslintignore +5 -0
- package/.gitattributes +5 -0
- package/CHANGELOG.md +371 -6
- package/CLAUDE.md +6 -0
- package/CODE_OF_CONDUCT.md +18 -0
- package/CONTRIBUTING.md +30 -0
- package/Formula/ssh-manager.rb +60 -0
- package/README.md +484 -964
- package/ROADMAP-V4.md +451 -0
- package/brand/README.md +43 -0
- package/brand/icon.svg +32 -0
- package/brand/mark.svg +18 -0
- package/brand/wordmark.svg +30 -0
- package/cli/app.js +230 -0
- package/cli/control.js +116 -0
- package/cli/lib/colors.sh +15 -0
- package/cli/lib/menu.sh +145 -96
- package/cli/portability.js +186 -0
- package/cli/ssh-manager +197 -91
- package/cli/ssh-manager.js +14 -0
- package/cli/style.js +17 -0
- package/cli/vault.js +411 -0
- package/desktop/ControlPlaneApp.swift +219 -0
- package/desktop/build.sh +58 -0
- package/desktop/electron/after-pack.cjs +39 -0
- package/desktop/electron/electron-builder.yml +148 -0
- package/desktop/electron/finalize-artifacts.mjs +83 -0
- package/desktop/electron/main.js +815 -0
- package/desktop/electron/package-lock.json +3656 -0
- package/desktop/electron/package.json +30 -0
- package/desktop/electron/prepare-engine.mjs +84 -0
- package/desktop/electron/resources/entitlements.mac.plist +22 -0
- package/desktop/electron/resources/icon.png +0 -0
- package/desktop/electron/resources/trayTemplate.png +0 -0
- package/desktop/electron/resources/trayTemplate@2x.png +0 -0
- package/desktop/electron/smoke-test.mjs +184 -0
- package/dist/ui/app.css +1 -0
- package/dist/ui/app.js +501 -0
- package/dist/ui/assets/Forum-Regular.woff2 +0 -0
- package/dist/ui/assets/JetBrainsMono-Bold.woff2 +0 -0
- package/dist/ui/assets/JetBrainsMono-Regular.woff2 +0 -0
- package/dist/ui/assets/Karla-Variable.woff2 +0 -0
- package/dist/ui/index.html +16 -0
- package/docs/DISTRIBUTION.md +136 -0
- package/docs/FINAL-TEST-V4.md +209 -0
- package/docs/MIGRATION.md +334 -0
- package/docs/TESTING-V4.md +119 -0
- package/docs/superpowers/specs/2026-10-08-desktop-from-npm-and-cli-design.md +187 -0
- package/docs/videos/control-plane.mp4 +0 -0
- package/package.json +61 -30
- package/scripts/build-interface.mjs +73 -0
- package/scripts/capture-screenshots.mjs +191 -0
- package/scripts/demo-env.mjs +461 -0
- package/scripts/frame-screenshots.py +176 -0
- package/scripts/macbook-mockup.py +296 -0
- package/scripts/make-tray-icon.py +61 -0
- package/scripts/preview-candidate.mjs +291 -0
- package/scripts/publish-desktop.mjs +46 -0
- package/scripts/record-demo.mjs +229 -0
- package/scripts/release-version.mjs +32 -0
- package/scripts/render-cli-menu.py +157 -0
- package/scripts/requirements-dev.in +12 -0
- package/scripts/requirements-dev.txt +424 -0
- package/scripts/run-ui-regression.mjs +48 -0
- package/scripts/setup-hooks.sh +7 -13
- package/scripts/smoke-desktop.mjs +80 -0
- package/scripts/test-drag-and-drop.mjs +114 -0
- package/scripts/test-first-run.mjs +5 -0
- package/scripts/test-import-ui.mjs +5 -0
- package/scripts/test-preferences-persist.mjs +5 -0
- package/scripts/test-upgrade-from-published.mjs +226 -0
- package/scripts/verify-mac-build.sh +153 -0
- package/scripts/verify-windows-build.ps1 +15 -0
- package/server.json +3 -3
- package/skills/README.md +42 -0
- package/skills/ssh-incident/SKILL.md +55 -0
- package/skills/ssh-operations/SKILL.md +62 -0
- package/skills/ssh-restricted/SKILL.md +57 -0
- package/src/agent-clients.js +482 -0
- package/src/approval.js +291 -0
- package/src/audit.js +11 -1
- package/src/command-log.js +162 -0
- package/src/config-loader.js +119 -4
- package/src/config-paths.js +101 -0
- package/src/control-plane.js +2730 -0
- package/src/desktop-install.js +747 -0
- package/src/index.js +179 -213
- package/src/live-stream.js +261 -0
- package/src/saved-commands.js +150 -0
- package/src/secret-store.js +573 -0
- package/src/server-aliases.js +8 -7
- package/src/server-config-manager.js +33 -7
- package/src/server-export.js +106 -0
- package/src/server-groups.js +82 -21
- package/src/server-import.js +477 -0
- package/src/shell-quote.js +9 -2
- package/src/ssh-connection.js +155 -0
- package/src/ssh-manager.js +186 -13
- package/src/tunnel-manager.js +79 -0
- package/src/vault-recovery.js +206 -0
- package/src/xlsx.js +322 -0
- package/docs/images/social-preview.png +0 -0
- package/docs/images/social-preview@2x.png +0 -0
- package/docs/images/ssh-manager-cli-menu.png +0 -0
package/cli/ssh-manager
CHANGED
|
@@ -47,91 +47,84 @@ show_version() {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
# Show help
|
|
50
|
+
#
|
|
51
|
+
# In sections, with the commands aligned. Every command this help has ever
|
|
52
|
+
# listed is still here; `app` is new.
|
|
50
53
|
show_help() {
|
|
54
|
+
local H="${ACCENT}${BOLD}" N="$NC"
|
|
51
55
|
cat <<EOF
|
|
52
|
-
${BOLD}SSH Manager CLI${NC} - Simple and powerful SSH server management
|
|
53
56
|
|
|
54
|
-
${
|
|
55
|
-
ssh-manager # Interactive mode (menu)
|
|
56
|
-
ssh-manager -i # Interactive mode (menu)
|
|
57
|
-
ssh-manager <command> # Direct command mode
|
|
57
|
+
${H}▲ SSH Manager ${VERSION}${N} ${GRAY}servers, files and agent approvals${N}
|
|
58
58
|
|
|
59
|
-
${
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
${CYAN}session${NC} SSH session management
|
|
84
|
-
start Start interactive session
|
|
85
|
-
list List active sessions
|
|
86
|
-
close Close a session
|
|
87
|
-
|
|
88
|
-
${CYAN}exec${NC} Execute commands
|
|
89
|
-
run Run command on server
|
|
90
|
-
group Run on server group
|
|
91
|
-
|
|
92
|
-
${CYAN}config${NC} Configuration
|
|
93
|
-
edit Edit configuration
|
|
94
|
-
show Show configuration
|
|
95
|
-
init Initialize configuration
|
|
59
|
+
${H}USAGE${N}
|
|
60
|
+
ssh-manager The menu (also: -i, --interactive)
|
|
61
|
+
ssh-manager <command> ... One command, for scripts and pipes
|
|
62
|
+
|
|
63
|
+
${H}SERVERS${N}
|
|
64
|
+
server add Add a server, step by step
|
|
65
|
+
server list List configured servers
|
|
66
|
+
server test <name> Test a connection
|
|
67
|
+
server show <name> Show a server's settings
|
|
68
|
+
server edit <name> Edit a server
|
|
69
|
+
server remove <name> Remove a server
|
|
70
|
+
ssh <name> Open an SSH session (also: connect)
|
|
71
|
+
exec <name> <command> Run a command on a server
|
|
72
|
+
exec group <group> <command> Run it on a server group
|
|
73
|
+
monitor <name> <what> cpu · memory · disk · network
|
|
74
|
+
session start|list|close SSH sessions
|
|
75
|
+
|
|
76
|
+
${H}FILES${N}
|
|
77
|
+
sync push <name> <src> <dest> Send files with rsync
|
|
78
|
+
sync pull <name> <src> <dest> Fetch files with rsync
|
|
79
|
+
tunnel create <name> <type> <ports>
|
|
80
|
+
<type>: local, remote or dynamic (SOCKS)
|
|
81
|
+
tunnel list Active tunnels
|
|
82
|
+
tunnel close Close a tunnel
|
|
96
83
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
export Export Claude Code auto-approval config
|
|
84
|
+
${H}AGENTS AND THE INTERFACE${N}
|
|
85
|
+
control Watch what your agents run, and decide
|
|
86
|
+
before it runs, in your browser
|
|
87
|
+
app The desktop app: installs it if needed
|
|
88
|
+
(checked against the release), then opens it
|
|
89
|
+
app --status Whether it is installed, in one line
|
|
104
90
|
|
|
105
|
-
${
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
91
|
+
${H}SETTINGS${N}
|
|
92
|
+
config edit|show|init The CLI's own settings
|
|
93
|
+
tools list|configure Which MCP tools your agents see
|
|
94
|
+
tools enable|disable <group> Turn a tool group on or off
|
|
95
|
+
tools reset Every tool back on
|
|
96
|
+
tools export Claude Code auto-approval config
|
|
97
|
+
vault import Take the servers in .env / TOML, encrypted
|
|
98
|
+
vault list What it holds, never a secret
|
|
99
|
+
vault status Where it and its key live
|
|
100
|
+
vault add|remove <name> One server in or out
|
|
101
|
+
vault backup|restore <file> A recovery file, under a passphrase
|
|
102
|
+
import <file> A spreadsheet, CSV, ~/.ssh/config, FileZilla,
|
|
103
|
+
PuTTY, Termius or MobaXterm export (detected)
|
|
104
|
+
import --from <tool> ssh-config · filezilla · transmit
|
|
105
|
+
import --template A spreadsheet to fill in and import back
|
|
106
|
+
export <file> .xlsx, .csv, .env or .toml
|
|
107
|
+
(never with passwords)
|
|
110
108
|
|
|
111
|
-
${
|
|
112
|
-
|
|
109
|
+
${H}OPTIONS${N}
|
|
110
|
+
-h, --help Show this help
|
|
111
|
+
-v, --version Show the version
|
|
112
|
+
-q, --quiet Quiet mode
|
|
113
|
+
-d, --debug Debug mode
|
|
114
|
+
|
|
115
|
+
${H}EXAMPLES${N}
|
|
113
116
|
ssh-manager server add
|
|
114
|
-
|
|
115
|
-
# List all servers
|
|
116
|
-
ssh-manager server list
|
|
117
|
-
|
|
118
|
-
# Test connection to prod1
|
|
119
117
|
ssh-manager server test prod1
|
|
120
|
-
|
|
121
|
-
# Sync files to server
|
|
122
118
|
ssh-manager sync push prod1 ./app /var/www/app
|
|
123
|
-
|
|
124
|
-
# Create SSH tunnel
|
|
125
119
|
ssh-manager tunnel create prod1 local 3307:localhost:3306
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
ssh-manager monitor prod1 cpu
|
|
120
|
+
ssh-manager control
|
|
121
|
+
ssh-manager app
|
|
129
122
|
|
|
130
|
-
${
|
|
131
|
-
Config directory
|
|
132
|
-
Server config
|
|
123
|
+
${H}CONFIGURATION${N}
|
|
124
|
+
Config directory ${SSH_MANAGER_HOME:-~/.ssh-manager}
|
|
125
|
+
Server config ${SSH_MANAGER_ENV:-.env}
|
|
133
126
|
|
|
134
|
-
${
|
|
127
|
+
${H}DOCUMENTATION${N}
|
|
135
128
|
https://github.com/bvisible/mcp-ssh-manager
|
|
136
129
|
|
|
137
130
|
EOF
|
|
@@ -373,6 +366,28 @@ main() {
|
|
|
373
366
|
tools)
|
|
374
367
|
cmd_tools "$@"
|
|
375
368
|
;;
|
|
369
|
+
control)
|
|
370
|
+
# v4 control plane: approval socket + local page.
|
|
371
|
+
node "$SCRIPT_DIR/control.js" "$@"
|
|
372
|
+
;;
|
|
373
|
+
app)
|
|
374
|
+
# The desktop application: installed if needed, checked against
|
|
375
|
+
# the release, then opened. Node, like control, so it shares the
|
|
376
|
+
# engine's code and works the same without Bash.
|
|
377
|
+
node "$SCRIPT_DIR/app.js" "$@"
|
|
378
|
+
;;
|
|
379
|
+
import|export)
|
|
380
|
+
# Bringing servers in from other tools, and taking them out again.
|
|
381
|
+
# Node, because it writes through the same SecretStore the engine
|
|
382
|
+
# reads — one code path, so the two cannot disagree.
|
|
383
|
+
node "$SCRIPT_DIR/portability.js" "$command" "$@"
|
|
384
|
+
;;
|
|
385
|
+
vault)
|
|
386
|
+
# v4 encrypted credential store. Implemented in Node because it uses
|
|
387
|
+
# the same SecretStore the MCP server reads from — one code path for
|
|
388
|
+
# writing and reading, so the CLI and the server can never disagree.
|
|
389
|
+
node "$SCRIPT_DIR/vault.js" "$@"
|
|
390
|
+
;;
|
|
376
391
|
config)
|
|
377
392
|
case "$1" in
|
|
378
393
|
edit)
|
|
@@ -411,6 +426,8 @@ interactive_mode() {
|
|
|
411
426
|
exit 1
|
|
412
427
|
fi
|
|
413
428
|
|
|
429
|
+
refresh_desktop_status
|
|
430
|
+
|
|
414
431
|
while true; do
|
|
415
432
|
show_main_menu
|
|
416
433
|
read choice
|
|
@@ -489,15 +506,15 @@ interactive_mode() {
|
|
|
489
506
|
5)
|
|
490
507
|
# System Monitoring
|
|
491
508
|
if select_server_menu "System Monitoring"; then
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
read
|
|
509
|
+
clear
|
|
510
|
+
print_menu_header "Health of $selected_server"
|
|
511
|
+
menu_item 1 "Overview"
|
|
512
|
+
menu_item 2 "CPU"
|
|
513
|
+
menu_item 3 "Memory"
|
|
514
|
+
menu_item 4 "Disk"
|
|
515
|
+
menu_item 5 "Network"
|
|
516
|
+
menu_prompt "Choose [1-5]:"
|
|
517
|
+
read monitor_type
|
|
501
518
|
|
|
502
519
|
case "$monitor_type" in
|
|
503
520
|
1) cmd_exec "$selected_server" "uptime && free -h && df -h" ;;
|
|
@@ -525,13 +542,13 @@ interactive_mode() {
|
|
|
525
542
|
7)
|
|
526
543
|
# Configuration
|
|
527
544
|
clear
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
read
|
|
545
|
+
print_menu_header "Configuration"
|
|
546
|
+
menu_item 1 "Edit CLI config"
|
|
547
|
+
menu_item 2 "Show CLI config"
|
|
548
|
+
menu_item 3 "Edit server config (.env)"
|
|
549
|
+
menu_item 0 "Back"
|
|
550
|
+
menu_prompt "Choose [0-3]:"
|
|
551
|
+
read config_choice
|
|
535
552
|
|
|
536
553
|
case "$config_choice" in
|
|
537
554
|
1) ${EDITOR:-nano} "$SSH_MANAGER_CONFIG" ;;
|
|
@@ -539,9 +556,98 @@ interactive_mode() {
|
|
|
539
556
|
3) cmd_server_edit ;;
|
|
540
557
|
esac
|
|
541
558
|
;;
|
|
542
|
-
8)
|
|
543
|
-
# Help
|
|
544
|
-
|
|
559
|
+
8|'?')
|
|
560
|
+
# Help. 8 since 3.1; the home screen shows ?. -R keeps the
|
|
561
|
+
# palette instead of printing its escape codes.
|
|
562
|
+
show_help | less -R
|
|
563
|
+
;;
|
|
564
|
+
9)
|
|
565
|
+
# The control plane runs in the foreground and holds the approval
|
|
566
|
+
# socket, so it takes over this terminal until Ctrl-C. Say so
|
|
567
|
+
# first: a menu entry that appears to hang is a menu entry people
|
|
568
|
+
# kill and never try again.
|
|
569
|
+
echo
|
|
570
|
+
print_info "The control plane runs here until you stop it with Ctrl-C."
|
|
571
|
+
echo "It opens a local page showing what your agents are doing on"
|
|
572
|
+
echo "your servers, and lets you approve or refuse a command before"
|
|
573
|
+
echo "it runs. Closing it puts everything back the way it was."
|
|
574
|
+
echo
|
|
575
|
+
read -p "Start it? [Y/n] " start_control
|
|
576
|
+
case "$start_control" in
|
|
577
|
+
n|N) ;;
|
|
578
|
+
*) node "$SCRIPT_DIR/control.js" ;;
|
|
579
|
+
esac
|
|
580
|
+
;;
|
|
581
|
+
a|A)
|
|
582
|
+
# The desktop application. Downloads only now, on this key,
|
|
583
|
+
# and only after the release has vouched for the file.
|
|
584
|
+
node "$SCRIPT_DIR/app.js" || true
|
|
585
|
+
refresh_desktop_status
|
|
586
|
+
read -p "Press Enter to continue..."
|
|
587
|
+
;;
|
|
588
|
+
t|T)
|
|
589
|
+
# MCP tools: which of them agents see.
|
|
590
|
+
clear
|
|
591
|
+
print_menu_header "MCP tools"
|
|
592
|
+
menu_item 1 "Show what is enabled" "ssh-manager tools list"
|
|
593
|
+
menu_item 2 "Choose which tools agents see" "ssh-manager tools configure"
|
|
594
|
+
menu_item 0 "Back"
|
|
595
|
+
menu_prompt "Choose [0-2]:"
|
|
596
|
+
read tools_choice
|
|
597
|
+
case "$tools_choice" in
|
|
598
|
+
1) cmd_tools list || true; echo; read -p "Press Enter to continue..." ;;
|
|
599
|
+
2) cmd_tools configure || true ;;
|
|
600
|
+
esac
|
|
601
|
+
;;
|
|
602
|
+
v|V)
|
|
603
|
+
# The encrypted vault, through the same Node command as
|
|
604
|
+
# `ssh-manager vault`.
|
|
605
|
+
clear
|
|
606
|
+
print_menu_header "Encrypted vault"
|
|
607
|
+
menu_item 1 "What it holds" "ssh-manager vault list (never prints a secret)"
|
|
608
|
+
menu_item 2 "Where it and its key live" "ssh-manager vault status"
|
|
609
|
+
menu_item 3 "Take the servers in .env / TOML" "ssh-manager vault import"
|
|
610
|
+
menu_item 0 "Back"
|
|
611
|
+
echo
|
|
612
|
+
echo " ${GRAY}More, including recovery files: ssh-manager vault --help${NC}"
|
|
613
|
+
menu_prompt "Choose [0-3]:"
|
|
614
|
+
read vault_choice
|
|
615
|
+
case "$vault_choice" in
|
|
616
|
+
1) node "$SCRIPT_DIR/vault.js" list || true ;;
|
|
617
|
+
2) node "$SCRIPT_DIR/vault.js" status || true ;;
|
|
618
|
+
3) node "$SCRIPT_DIR/vault.js" import || true ;;
|
|
619
|
+
esac
|
|
620
|
+
case "$vault_choice" in
|
|
621
|
+
1|2|3) echo; read -p "Press Enter to continue..." ;;
|
|
622
|
+
esac
|
|
623
|
+
;;
|
|
624
|
+
i|I)
|
|
625
|
+
# Servers from somewhere else, through `ssh-manager import`.
|
|
626
|
+
clear
|
|
627
|
+
print_menu_header "Import servers"
|
|
628
|
+
menu_item 1 "From ~/.ssh/config"
|
|
629
|
+
menu_item 2 "From FileZilla"
|
|
630
|
+
menu_item 3 "From Transmit"
|
|
631
|
+
menu_item 4 "From a file" "A spreadsheet, CSV, PuTTY, Termius or MobaXterm export"
|
|
632
|
+
menu_item 5 "Write a spreadsheet to fill in"
|
|
633
|
+
menu_item 0 "Back"
|
|
634
|
+
menu_prompt "Choose [0-5]:"
|
|
635
|
+
read import_choice
|
|
636
|
+
case "$import_choice" in
|
|
637
|
+
1) node "$SCRIPT_DIR/portability.js" import --from ssh-config || true ;;
|
|
638
|
+
2) node "$SCRIPT_DIR/portability.js" import --from filezilla || true ;;
|
|
639
|
+
3) node "$SCRIPT_DIR/portability.js" import --from transmit || true ;;
|
|
640
|
+
4)
|
|
641
|
+
read -r -p " File to import: " import_file
|
|
642
|
+
if [ -n "$import_file" ]; then
|
|
643
|
+
node "$SCRIPT_DIR/portability.js" import "${import_file/#\~/$HOME}" || true
|
|
644
|
+
fi
|
|
645
|
+
;;
|
|
646
|
+
5) node "$SCRIPT_DIR/portability.js" import --template || true ;;
|
|
647
|
+
esac
|
|
648
|
+
case "$import_choice" in
|
|
649
|
+
1|2|3|4|5) echo; read -p "Press Enter to continue..." ;;
|
|
650
|
+
esac
|
|
545
651
|
;;
|
|
546
652
|
0|q|Q)
|
|
547
653
|
print_info "Goodbye!"
|
package/cli/ssh-manager.js
CHANGED
|
@@ -27,6 +27,20 @@ if (!existsSync(bashScript)) {
|
|
|
27
27
|
const isWindows = platform() === 'win32';
|
|
28
28
|
const args = process.argv.slice(2);
|
|
29
29
|
|
|
30
|
+
// These commands are native Node and also work on Windows without Git Bash.
|
|
31
|
+
const nativeCommands = { control: 'control.js', vault: 'vault.js', import: 'portability.js', export: 'portability.js', app: 'app.js' };
|
|
32
|
+
if (Object.hasOwn(nativeCommands, args[0])) {
|
|
33
|
+
const commandArgs = ['import', 'export'].includes(args[0]) ? args : args.slice(1);
|
|
34
|
+
const result = spawnSync(process.execPath, [join(__dirname, nativeCommands[args[0]]), ...commandArgs], { stdio: 'inherit' });
|
|
35
|
+
if (result.error) console.error(`[ssh-manager] ${result.error.message}`);
|
|
36
|
+
process.exit(result.status ?? 1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// No "new in v4" invitation, not even once. Someone who uses the CLI and the
|
|
40
|
+
// npm engine as they always have gets exactly that: the interface and the
|
|
41
|
+
// desktop app are one key away in the menu (a) for whoever wants them, and say
|
|
42
|
+
// nothing to whoever does not.
|
|
43
|
+
|
|
30
44
|
/**
|
|
31
45
|
* Convert a Windows-style path (C:\foo\bar) into a POSIX-style path
|
|
32
46
|
* understood by Git Bash / MSYS (/c/foo/bar). Leaves non-Windows paths alone.
|
package/cli/style.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Terminal styles for the Node commands of the CLI.
|
|
2
|
+
//
|
|
3
|
+
// NO_COLOR (https://no-color.org): when set and not empty, no colour. Bold and
|
|
4
|
+
// dim stay, being emphasis rather than colour, and the application's orange
|
|
5
|
+
// falls back to bold — the same rules as cli/lib/colors.sh.
|
|
6
|
+
|
|
7
|
+
const noColor = Boolean(process.env.NO_COLOR);
|
|
8
|
+
const colour = code => (noColor ? '' : code);
|
|
9
|
+
|
|
10
|
+
export const RED = colour('\x1b[31m');
|
|
11
|
+
export const GREEN = colour('\x1b[32m');
|
|
12
|
+
export const YELLOW = colour('\x1b[33m');
|
|
13
|
+
export const BOLD = '\x1b[1m';
|
|
14
|
+
export const DIM = '\x1b[2m';
|
|
15
|
+
export const RESET = '\x1b[0m';
|
|
16
|
+
/** The application's orange, #c04500: 256-colour 166. */
|
|
17
|
+
export const ORANGE = noColor ? BOLD : '\x1b[38;5;166m';
|