prompt-language-shell 0.4.2 → 0.4.4

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/ui/Plan.js CHANGED
@@ -1,23 +1,24 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
3
  import { Box, useInput } from 'ink';
4
- import { TaskColors } from '../types/colors.js';
5
4
  import { TaskType } from '../types/types.js';
5
+ import { getTaskColors } from '../services/colors.js';
6
6
  import { Label } from './Label.js';
7
7
  import { List } from './List.js';
8
- function taskToListItem(task, highlightedChildIndex = null, isDefineTaskWithoutSelection = false) {
8
+ function taskToListItem(task, highlightedChildIndex = null, isDefineTaskWithoutSelection = false, isCurrent = false) {
9
+ const taskColors = getTaskColors(task.type, isCurrent);
9
10
  const item = {
10
11
  description: {
11
12
  text: task.action,
12
- color: TaskColors[task.type].description,
13
+ color: taskColors.description,
13
14
  },
14
- type: { text: task.type, color: TaskColors[task.type].type },
15
+ type: { text: task.type, color: taskColors.type },
15
16
  children: [],
16
17
  };
17
18
  // Mark define tasks with right arrow when no selection has been made
18
19
  if (isDefineTaskWithoutSelection) {
19
20
  item.marker = ' → ';
20
- item.markerColor = TaskColors[TaskType.Plan].type;
21
+ item.markerColor = getTaskColors(TaskType.Plan, isCurrent).type;
21
22
  }
22
23
  // Add children for Define tasks with options
23
24
  if (task.type === TaskType.Define && Array.isArray(task.params?.options)) {
@@ -29,17 +30,18 @@ function taskToListItem(task, highlightedChildIndex = null, isDefineTaskWithoutS
29
30
  childType =
30
31
  index === highlightedChildIndex ? TaskType.Execute : TaskType.Discard;
31
32
  }
32
- const colors = TaskColors[childType];
33
+ const colors = getTaskColors(childType, isCurrent);
34
+ const planColors = getTaskColors(TaskType.Plan, isCurrent);
33
35
  return {
34
36
  description: {
35
37
  text: String(option),
36
38
  color: colors.description,
37
- highlightedColor: TaskColors[TaskType.Plan].description,
39
+ highlightedColor: planColors.description,
38
40
  },
39
41
  type: {
40
42
  text: childType,
41
43
  color: colors.type,
42
- highlightedColor: TaskColors[TaskType.Plan].type,
44
+ highlightedColor: planColors.type,
43
45
  },
44
46
  };
45
47
  });
@@ -143,6 +145,7 @@ export function Plan({ message, tasks, state, debug = false, onSelectionConfirme
143
145
  isDone,
144
146
  state,
145
147
  ]);
148
+ const isCurrent = isDone === false;
146
149
  const listItems = tasks.map((task, idx) => {
147
150
  // Find which define group this task belongs to (if any)
148
151
  const defineGroupIndex = defineTaskIndices.indexOf(idx);
@@ -170,7 +173,7 @@ export function Plan({ message, tasks, state, debug = false, onSelectionConfirme
170
173
  defineGroupIndex === currentDefineGroupIndex &&
171
174
  highlightedIndex === null &&
172
175
  !isDone;
173
- return taskToListItem(task, childIndex, isDefineWithoutSelection);
176
+ return taskToListItem(task, childIndex, isDefineWithoutSelection, isCurrent);
174
177
  });
175
- return (_jsxs(Box, { flexDirection: "column", children: [message && (_jsx(Box, { marginBottom: 1, children: _jsx(Label, { description: message, descriptionColor: TaskColors[TaskType.Plan].description, type: TaskType.Plan, typeColor: TaskColors[TaskType.Plan].type, showType: debug }) })), _jsx(List, { items: listItems, highlightedIndex: currentDefineTaskIndex >= 0 ? highlightedIndex : null, highlightedParentIndex: currentDefineTaskIndex, showType: debug })] }));
178
+ return (_jsxs(Box, { flexDirection: "column", children: [message && (_jsx(Box, { marginBottom: 1, children: _jsx(Label, { description: message, taskType: TaskType.Plan, showType: debug, isCurrent: isCurrent }) })), _jsx(List, { items: listItems, highlightedIndex: currentDefineTaskIndex >= 0 ? highlightedIndex : null, highlightedParentIndex: currentDefineTaskIndex, showType: debug })] }));
176
179
  }
@@ -1,6 +1,6 @@
1
1
  import { jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Text } from 'ink';
3
- import { Colors } from '../types/colors.js';
3
+ import { Colors } from '../services/colors.js';
4
4
  export const Separator = ({ color = Colors.Label.Discarded, spaces = 1, }) => {
5
5
  const spacing = ' '.repeat(spaces);
6
6
  return (_jsxs(Text, { color: color, children: [spacing, "\u203A", spacing] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prompt-language-shell",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Your personal command-line concierge. Ask politely, and it gets things done.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
File without changes