tasktui 1.0.5 → 1.0.7

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/dist/app.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  declare const ui: import("./ui.js").UIComponents;
2
- export declare function loadAndProcessConfig(configPath?: string): void;
3
2
  export default ui;
3
+ export declare function initialize(configPath?: string): void;
package/dist/app.js CHANGED
@@ -1,4 +1,4 @@
1
- import { render, showError } from './renderer.js';
1
+ import { render, showError, toggleKeybindsMenu } from './renderer.js';
2
2
  import { createState, getAllTasksInOrder } from './state.js';
3
3
  import { cleanup, ensureDependencies, spawnTask } from './tasks.js';
4
4
  import { createUI } from './ui.js';
@@ -14,10 +14,10 @@ function handleMove(steps) {
14
14
  const newTask = allTasks[newIndex];
15
15
  if (newTask) {
16
16
  state.selectedTask = newTask;
17
- render(ui, state);
17
+ render(state);
18
18
  }
19
19
  }
20
- export function loadAndProcessConfig(configPath) {
20
+ function loadAndProcessConfig(configPath) {
21
21
  try {
22
22
  const config = loadConfig(configPath);
23
23
  state.config = config;
@@ -44,13 +44,13 @@ export function loadAndProcessConfig(configPath) {
44
44
  });
45
45
  continue;
46
46
  }
47
- spawnTask(name, task, state, () => render(ui, state));
47
+ spawnTask(name, task, state, () => render(state));
48
48
  }
49
- render(ui, state);
49
+ render(state);
50
50
  }
51
51
  catch (e) {
52
52
  const error = ensureError(e);
53
- showError(error.message, ui, state);
53
+ showError(error.message);
54
54
  }
55
55
  }
56
56
  // Key bindings
@@ -64,8 +64,19 @@ ui.screen.key(['C-c', 'q'], () => {
64
64
  cleanup(state);
65
65
  process.exit(0);
66
66
  });
67
+ ui.screen.key('m', () => {
68
+ toggleKeybindsMenu();
69
+ });
70
+ ui.screen.key('escape', () => {
71
+ if (!ui.keybindsBox.hidden)
72
+ toggleKeybindsMenu();
73
+ });
67
74
  // Handle resize
68
75
  ui.screen.on('resize', () => {
69
- render(ui, state);
76
+ render(state);
70
77
  });
71
78
  export default ui;
79
+ export function initialize(configPath) {
80
+ loadAndProcessConfig(configPath);
81
+ ui.screen.render();
82
+ }
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import meow from 'meow';
3
- import ui, { loadAndProcessConfig } from './app.js';
3
+ import { initialize } from './app.js';
4
4
  const cli = meow(`
5
5
  Usage
6
6
  $ tasktui [--config <PATH> | --help]
@@ -16,5 +16,4 @@ const cli = meow(`
16
16
  help: {},
17
17
  },
18
18
  });
19
- loadAndProcessConfig(cli.flags.config);
20
- ui.screen.render();
19
+ initialize(cli.flags.config);
@@ -1,2 +1,3 @@
1
1
  declare const CONFIG_PATH = "./tasktui.config.json";
2
- export { CONFIG_PATH };
2
+ declare const KEYBINDS: string[];
3
+ export { CONFIG_PATH, KEYBINDS };
package/dist/constants.js CHANGED
@@ -1,2 +1,8 @@
1
1
  const CONFIG_PATH = './tasktui.config.json';
2
- export { CONFIG_PATH };
2
+ const KEYBINDS = [
3
+ 'm - Toggle this help menu',
4
+ '↑ or k - Select previous task',
5
+ '↓ or j - Select next task',
6
+ 'Ctrl-c or q - Quit',
7
+ ];
8
+ export { CONFIG_PATH, KEYBINDS };
@@ -1,4 +1,5 @@
1
1
  import { AppState } from './state.js';
2
- import { UIComponents } from './ui.js';
3
- export declare function showError(message: string, ui: UIComponents, state: AppState): void;
4
- export declare function render(ui: UIComponents, state: AppState): void;
2
+ export declare function showError(message: string): void;
3
+ export declare function toggleKeybindsMenu(): void;
4
+ export declare function hideKeybinds(): void;
5
+ export declare function render(state: AppState): void;
package/dist/renderer.js CHANGED
@@ -1,16 +1,29 @@
1
+ import ui from './app.js';
1
2
  import { getOrderedTasks } from './state.js';
2
- export function showError(message, ui, state) {
3
- state.error = message;
3
+ export function showError(message) {
4
4
  ui.errorBox.setContent(`{red-fg}Error: ${message}{/}`);
5
5
  ui.errorBox.show();
6
6
  ui.screen.render();
7
7
  }
8
- export function render(ui, state) {
8
+ export function toggleKeybindsMenu() {
9
+ if (ui.keybindsBox.hidden) {
10
+ ui.keybindsBox.show();
11
+ }
12
+ else {
13
+ ui.keybindsBox.hide();
14
+ }
15
+ ui.screen.render();
16
+ }
17
+ export function hideKeybinds() {
18
+ ui.errorBox.hide();
19
+ ui.screen.render();
20
+ }
21
+ export function render(state) {
9
22
  const { running, queued, completed } = getOrderedTasks(state);
10
23
  const lines = [];
11
24
  // Running section
12
25
  if (running.length > 0) {
13
- lines.push(`{gray-fg} Running (${running.length}){/}`);
26
+ lines.push(`{gray-fg} Running (${running.length}){/}`);
14
27
  for (const name of running) {
15
28
  const isSelected = name === state.selectedTask;
16
29
  const color = isSelected ? 'yellow-fg' : 'white-fg';
@@ -20,7 +33,7 @@ export function render(ui, state) {
20
33
  }
21
34
  // Queued section
22
35
  if (queued.length > 0) {
23
- lines.push(`{gray-fg} Queued (${queued.length}){/}`);
36
+ lines.push(`{gray-fg} Queued (${queued.length}){/}`);
24
37
  for (const queueItem of queued) {
25
38
  const isSelected = queueItem.name === state.selectedTask;
26
39
  const color = isSelected ? 'yellow-fg' : 'gray-fg';
@@ -30,7 +43,7 @@ export function render(ui, state) {
30
43
  }
31
44
  // Completed section
32
45
  if (completed.length > 0) {
33
- lines.push(`{gray-fg} Completed (${completed.length}){/}`);
46
+ lines.push(`{gray-fg} Completed (${completed.length}){/}`);
34
47
  for (const name of completed) {
35
48
  const buffer = state.buffers[name];
36
49
  const isSelected = name === state.selectedTask;
package/dist/state.d.ts CHANGED
@@ -17,7 +17,6 @@ export interface AppState {
17
17
  taskOrder: string[];
18
18
  config?: TasksConfig;
19
19
  tasks: Record<string, Task>;
20
- error: string | null;
21
20
  selectedTask: string;
22
21
  buffers: Record<string, TaskBuffer>;
23
22
  queue: QueueItem[];
package/dist/state.js CHANGED
@@ -6,7 +6,6 @@ export function createState() {
6
6
  taskOrder: [],
7
7
  config: undefined,
8
8
  tasks: {},
9
- error: null,
10
9
  selectedTask: '',
11
10
  buffers: {},
12
11
  queue: [],
package/dist/tasks.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import childProcess from 'node:child_process';
2
- import ui from './app.js';
3
2
  import { showError } from './renderer.js';
4
3
  import { ensureError } from './utils.js';
5
4
  export function ensureDependencies(task, deps, state) {
@@ -64,7 +63,7 @@ export function spawnTask(name, task, state, onUpdate) {
64
63
  });
65
64
  subProcess.on('error', (e) => {
66
65
  const error = ensureError(e);
67
- showError(error.message, ui, state);
66
+ showError(error.message);
68
67
  });
69
68
  }
70
69
  function checkQueue(state, onUpdate) {
package/dist/ui.d.ts CHANGED
@@ -7,5 +7,6 @@ export interface UIComponents {
7
7
  taskNameBox: blessed.Widgets.BoxElement;
8
8
  taskOutputBox: blessed.Widgets.Log;
9
9
  errorBox: blessed.Widgets.BoxElement;
10
+ keybindsBox: blessed.Widgets.BoxElement;
10
11
  }
11
12
  export declare function createUI(): UIComponents;
package/dist/ui.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import blessed from 'blessed';
2
+ import { KEYBINDS } from './constants.js';
2
3
  export function createUI() {
3
4
  // Create screen
4
5
  const screen = blessed.screen({
@@ -45,8 +46,8 @@ export function createUI() {
45
46
  parent: sidebar,
46
47
  bottom: 0,
47
48
  width: '100%',
48
- height: 1,
49
- content: '{gray-fg}↑↓ - Navigate{/}',
49
+ height: 2,
50
+ content: '{gray-fg}↑↓ - Navigate\nm - More binds{/}',
50
51
  tags: true,
51
52
  });
52
53
  // Output pane container
@@ -107,6 +108,34 @@ export function createUI() {
107
108
  tags: true,
108
109
  hidden: true,
109
110
  });
111
+ // Keybinds display
112
+ const keybindsBox = blessed.box({
113
+ parent: screen,
114
+ top: 'center',
115
+ left: 'center',
116
+ width: '80%',
117
+ height: 'shrink',
118
+ border: {
119
+ type: 'line',
120
+ },
121
+ tags: true,
122
+ hidden: true,
123
+ });
124
+ // Keybinds title
125
+ blessed.box({
126
+ parent: keybindsBox,
127
+ top: -1,
128
+ left: 1,
129
+ width: 'shrink',
130
+ content: ' Keybinds ',
131
+ });
132
+ // Keybinds list
133
+ blessed.box({
134
+ parent: keybindsBox,
135
+ top: 1,
136
+ left: 2,
137
+ content: KEYBINDS.join('\n'),
138
+ });
110
139
  // Focus on output box for scrolling
111
140
  taskOutputBox.focus();
112
141
  return {
@@ -117,5 +146,6 @@ export function createUI() {
117
146
  taskNameBox,
118
147
  taskOutputBox,
119
148
  errorBox,
149
+ keybindsBox,
120
150
  };
121
151
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tasktui",
3
3
  "description": "Run tasks in a multiplexed terminal with dependency management.",
4
- "version": "1.0.5",
4
+ "version": "1.0.7",
5
5
  "license": "MIT",
6
6
  "bin": "dist/cli.js",
7
7
  "type": "module",