termdeck-cli 1.0.2 → 1.0.3
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 +1 -0
- package/package.json +1 -1
- package/src/dashboard.js +35 -14
- package/src/index.js +1 -0
package/README.md
CHANGED
|
@@ -69,6 +69,7 @@ Every later launch skips straight to the dashboard. Re-run it any time with
|
|
|
69
69
|
| <kbd>d</kbd> | start the dev server for the selection (or click **Dev Server**) |
|
|
70
70
|
| <kbd>e</kbd> | open the editor in a new terminal window (or click **Editor**) |
|
|
71
71
|
| <kbd>a</kbd> | open the agent in a new terminal window (or click **Agent**) |
|
|
72
|
+
| <kbd>tab</kbd>, <kbd>shift</kbd>+<kbd>tab</kbd> | move keyboard focus to the buttons — a focused button lights up and answers to <kbd>space</kbd>/<kbd>enter</kbd> |
|
|
72
73
|
| <kbd>x</kbd> | stop the selected project's dev server |
|
|
73
74
|
| <kbd>r</kbd> | reload the config file from disk |
|
|
74
75
|
| <kbd>PgUp</kbd>/<kbd>PgDn</kbd>, wheel | scroll the log pane (pauses following, shows how many lines arrived) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "termdeck-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A terminal dashboard for your local dev projects: start dev servers with in-app logs, open your editor, or launch a coding agent in a fresh terminal window.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
package/src/dashboard.js
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* | footer: hints / status messages |
|
|
16
16
|
* +--------------------------------------------------------------+
|
|
17
17
|
*
|
|
18
|
-
* Mouse support is enabled on the screen, and the three CTAs are
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Mouse support is enabled on the screen, and the three CTAs are real blessed
|
|
19
|
+
* buttons: clickable with the mouse, `press`-able with Enter/Space when focused
|
|
20
|
+
* (Tab cycles focus), and every CTA also has its own keyboard shortcut.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
const blessed = require('blessed');
|
|
@@ -47,7 +47,7 @@ const MAIN_WIDTH = '70%';
|
|
|
47
47
|
const PROJECT_COLORS = ['cyan', 'green', 'yellow', 'magenta', 'red', 'white'];
|
|
48
48
|
|
|
49
49
|
const HINTS =
|
|
50
|
-
' {bold}↑/↓{/bold} select {bold}d{/bold} dev server {bold}e{/bold} editor {bold}a{/bold} agent ' +
|
|
50
|
+
' {bold}↑/↓{/bold} select {bold}tab{/bold} focus buttons {bold}d{/bold} dev server {bold}e{/bold} editor {bold}a{/bold} agent ' +
|
|
51
51
|
'{bold}x{/bold} stop server {bold}r{/bold} reload {bold}PgUp/PgDn{/bold} logs {bold}q{/bold} quit ';
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -175,30 +175,47 @@ function launchDashboard(config, options = {}) {
|
|
|
175
175
|
label: ' dev server logs ',
|
|
176
176
|
});
|
|
177
177
|
|
|
178
|
-
/**
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
/**
|
|
179
|
+
* The three CTAs: real blessed buttons. They are clickable (`mouse: true`
|
|
180
|
+
* wires click -> press), answer to space/enter when focused, light up on
|
|
181
|
+
* hover/focus, and each shows its own keyboard shortcut. `autoFocus: false`
|
|
182
|
+
* keeps keyboard focus on the project list until the user Tabs to a button.
|
|
183
|
+
*/
|
|
184
|
+
function makeButton({ left, width, label, hint, color, onPress }) {
|
|
185
|
+
const button = blessed.button({
|
|
181
186
|
parent: screen,
|
|
182
187
|
top: BUTTON_TOP,
|
|
183
188
|
left,
|
|
184
189
|
width,
|
|
185
190
|
height: LAYOUT.buttonHeight,
|
|
186
|
-
content: `{bold}${label}{/bold}`,
|
|
191
|
+
content: `{bold}${label}{/bold} {gray-fg}(${hint}){/gray-fg}`,
|
|
187
192
|
align: 'center',
|
|
188
193
|
valign: 'middle',
|
|
189
194
|
tags: true,
|
|
195
|
+
mouse: true,
|
|
190
196
|
clickable: true,
|
|
191
197
|
autoFocus: false, // keep keyboard focus on the project list
|
|
192
198
|
border: { type: 'line' },
|
|
193
|
-
style: {
|
|
194
|
-
|
|
199
|
+
style: {
|
|
200
|
+
fg: 'white',
|
|
201
|
+
bg: color,
|
|
202
|
+
bold: true,
|
|
203
|
+
border: { fg: color },
|
|
204
|
+
hover: { bg: 'lightwhite', fg: 'black', bold: true },
|
|
205
|
+
focus: { bg: 'lightwhite', fg: 'black', bold: true },
|
|
206
|
+
},
|
|
195
207
|
});
|
|
196
208
|
|
|
197
|
-
button.on('
|
|
209
|
+
button.on('press', () => {
|
|
198
210
|
try {
|
|
199
211
|
onPress();
|
|
200
212
|
} catch (err) {
|
|
201
213
|
setStatus(`Error: ${err.message}`);
|
|
214
|
+
} finally {
|
|
215
|
+
// blessed's Button.press() focuses the button before emitting `press`;
|
|
216
|
+
// hand focus back so the arrow keys keep working after activation.
|
|
217
|
+
projectList.focus();
|
|
218
|
+
screen.render();
|
|
202
219
|
}
|
|
203
220
|
});
|
|
204
221
|
|
|
@@ -206,9 +223,9 @@ function launchDashboard(config, options = {}) {
|
|
|
206
223
|
}
|
|
207
224
|
|
|
208
225
|
const buttons = {
|
|
209
|
-
dev: makeButton({ left: MAIN_LEFT, width: '23%', label: '▶ Dev Server', color: 'green', onPress: () => startDevServer() }),
|
|
210
|
-
editor: makeButton({ left: '53%', width: '23%', label: '</> Editor', color: 'blue', onPress: () => openTool('editor') }),
|
|
211
|
-
agent: makeButton({ left: '76%', width: '24%', label: '☕ Agent', color: 'magenta', onPress: () => openTool('agent') }),
|
|
226
|
+
dev: makeButton({ left: MAIN_LEFT, width: '23%', label: '▶ Dev Server', hint: 'd', color: 'green', onPress: () => startDevServer() }),
|
|
227
|
+
editor: makeButton({ left: '53%', width: '23%', label: '</> Editor', hint: 'e', color: 'blue', onPress: () => openTool('editor') }),
|
|
228
|
+
agent: makeButton({ left: '76%', width: '24%', label: '☕ Agent', hint: 'a', color: 'magenta', onPress: () => openTool('agent') }),
|
|
212
229
|
};
|
|
213
230
|
|
|
214
231
|
/* ---------------------------------------------------------------- *
|
|
@@ -493,6 +510,10 @@ function launchDashboard(config, options = {}) {
|
|
|
493
510
|
screen.key(['r'], () => reloadConfig());
|
|
494
511
|
screen.key(['j'], () => projectList.down(1));
|
|
495
512
|
screen.key(['k'], () => projectList.up(1));
|
|
513
|
+
// Tab cycles keyboard focus across the list and the three CTAs; the focused
|
|
514
|
+
// CTA lights up and answers to space/enter.
|
|
515
|
+
screen.key(['tab'], () => screen.focusNext());
|
|
516
|
+
screen.key(['S-tab'], () => screen.focusPrevious());
|
|
496
517
|
// NOTE: blessed reports uppercase letters as `S-g`, so 'G' alone never fires.
|
|
497
518
|
screen.key(['S-g', 'end'], () => logView.followTail());
|
|
498
519
|
screen.key(['pageup'], () => logView.page(-1));
|
package/src/index.js
CHANGED
|
@@ -33,6 +33,7 @@ const HELP = `
|
|
|
33
33
|
d Start \`npm run dev\` and stream its logs into the pane
|
|
34
34
|
e Open the project in your editor in a NEW terminal window
|
|
35
35
|
a Open your coding agent in a NEW terminal window
|
|
36
|
+
tab / S-tab Cycle focus to the buttons (space/enter activates)
|
|
36
37
|
x Stop the selected project's dev server
|
|
37
38
|
r Reload the config file
|
|
38
39
|
PgUp/PgDn, wheel Scroll the dev server logs (G to follow the tail again)
|