@orderful/droid 0.16.0 → 0.16.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/.claude/CLAUDE.md +3 -43
- package/AGENTS.md +75 -0
- package/CHANGELOG.md +12 -0
- package/dist/bin/droid.js +3064 -54
- package/dist/index.js +952 -6
- package/package.json +2 -2
- package/scripts/build.ts +78 -0
- package/dist/bin/droid.js.map +0 -1
- package/dist/commands/config.js +0 -67
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/install.js +0 -45
- package/dist/commands/install.js.map +0 -1
- package/dist/commands/setup.js +0 -269
- package/dist/commands/setup.js.map +0 -1
- package/dist/commands/skills.js +0 -144
- package/dist/commands/skills.js.map +0 -1
- package/dist/commands/tui/components/Badge.js +0 -29
- package/dist/commands/tui/components/Badge.js.map +0 -1
- package/dist/commands/tui/components/Markdown.js +0 -42
- package/dist/commands/tui/components/Markdown.js.map +0 -1
- package/dist/commands/tui/components/SettingsDetails.js +0 -11
- package/dist/commands/tui/components/SettingsDetails.js.map +0 -1
- package/dist/commands/tui/components/TabBar.js +0 -7
- package/dist/commands/tui/components/TabBar.js.map +0 -1
- package/dist/commands/tui/components/ToolDetails.js +0 -35
- package/dist/commands/tui/components/ToolDetails.js.map +0 -1
- package/dist/commands/tui/components/ToolItem.js +0 -11
- package/dist/commands/tui/components/ToolItem.js.map +0 -1
- package/dist/commands/tui/constants.js +0 -17
- package/dist/commands/tui/constants.js.map +0 -1
- package/dist/commands/tui/hooks/useAppUpdate.js +0 -52
- package/dist/commands/tui/hooks/useAppUpdate.js.map +0 -1
- package/dist/commands/tui/hooks/useToolUpdates.js +0 -77
- package/dist/commands/tui/hooks/useToolUpdates.js.map +0 -1
- package/dist/commands/tui/types.js +0 -2
- package/dist/commands/tui/types.js.map +0 -1
- package/dist/commands/tui/views/ReadmeViewer.js +0 -56
- package/dist/commands/tui/views/ReadmeViewer.js.map +0 -1
- package/dist/commands/tui/views/SetupScreen.js +0 -114
- package/dist/commands/tui/views/SetupScreen.js.map +0 -1
- package/dist/commands/tui/views/SkillConfigScreen.js +0 -148
- package/dist/commands/tui/views/SkillConfigScreen.js.map +0 -1
- package/dist/commands/tui/views/ToolExplorer.js +0 -86
- package/dist/commands/tui/views/ToolExplorer.js.map +0 -1
- package/dist/commands/tui/views/ToolUpdatePrompt.js +0 -38
- package/dist/commands/tui/views/ToolUpdatePrompt.js.map +0 -1
- package/dist/commands/tui/views/WelcomeScreen.js +0 -46
- package/dist/commands/tui/views/WelcomeScreen.js.map +0 -1
- package/dist/commands/tui.js +0 -307
- package/dist/commands/tui.js.map +0 -1
- package/dist/commands/uninstall.js +0 -26
- package/dist/commands/uninstall.js.map +0 -1
- package/dist/commands/update.js +0 -45
- package/dist/commands/update.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/agents.js +0 -248
- package/dist/lib/agents.js.map +0 -1
- package/dist/lib/config.js +0 -196
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/platforms.js +0 -52
- package/dist/lib/platforms.js.map +0 -1
- package/dist/lib/quotes.js +0 -24
- package/dist/lib/quotes.js.map +0 -1
- package/dist/lib/skill-config.js +0 -80
- package/dist/lib/skill-config.js.map +0 -1
- package/dist/lib/skills.js +0 -582
- package/dist/lib/skills.js.map +0 -1
- package/dist/lib/tools.js +0 -145
- package/dist/lib/tools.js.map +0 -1
- package/dist/lib/types.js +0 -50
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/version.js +0 -100
- package/dist/lib/version.js.map +0 -1
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text, useInput } from 'ink';
|
|
3
|
-
import TextInput from 'ink-text-input';
|
|
4
|
-
import { useState, useMemo } from 'react';
|
|
5
|
-
import { loadSkillOverrides, saveSkillOverrides } from '../../../lib/config';
|
|
6
|
-
import { ConfigOptionType } from '../../../lib/types';
|
|
7
|
-
import { colors, MAX_VISIBLE_CONFIG_ITEMS } from '../constants';
|
|
8
|
-
export function SkillConfigScreen({ skill, onComplete, onCancel }) {
|
|
9
|
-
const configSchema = skill.config_schema || {};
|
|
10
|
-
const configKeys = Object.keys(configSchema);
|
|
11
|
-
const initialOverrides = useMemo(() => loadSkillOverrides(skill.name), [skill.name]);
|
|
12
|
-
// Initialize values from saved overrides or defaults
|
|
13
|
-
const [values, setValues] = useState(() => {
|
|
14
|
-
const initial = {};
|
|
15
|
-
for (const key of configKeys) {
|
|
16
|
-
const option = configSchema[key];
|
|
17
|
-
initial[key] = initialOverrides[key] ?? option.default ?? (option.type === ConfigOptionType.Boolean ? false : '');
|
|
18
|
-
}
|
|
19
|
-
return initial;
|
|
20
|
-
});
|
|
21
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
22
|
-
const [scrollOffset, setScrollOffset] = useState(0);
|
|
23
|
-
const [editingField, setEditingField] = useState(null);
|
|
24
|
-
const [editValue, setEditValue] = useState('');
|
|
25
|
-
const [editingSelect, setEditingSelect] = useState(null);
|
|
26
|
-
const [selectOptionIndex, setSelectOptionIndex] = useState(0);
|
|
27
|
-
// Total items = config keys + Save button
|
|
28
|
-
const totalItems = configKeys.length + 1;
|
|
29
|
-
const handleSave = () => {
|
|
30
|
-
saveSkillOverrides(skill.name, values);
|
|
31
|
-
onComplete();
|
|
32
|
-
};
|
|
33
|
-
const handleSubmitEdit = () => {
|
|
34
|
-
if (editingField) {
|
|
35
|
-
setValues((prev) => ({ ...prev, [editingField]: editValue }));
|
|
36
|
-
setEditingField(null);
|
|
37
|
-
setEditValue('');
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
// Handle text input for string fields
|
|
41
|
-
useInput((input, key) => {
|
|
42
|
-
if (key.escape) {
|
|
43
|
-
setEditingField(null);
|
|
44
|
-
setEditValue('');
|
|
45
|
-
}
|
|
46
|
-
}, { isActive: editingField !== null });
|
|
47
|
-
// Handle select field editing
|
|
48
|
-
useInput((input, key) => {
|
|
49
|
-
if (!editingSelect)
|
|
50
|
-
return;
|
|
51
|
-
const option = configSchema[editingSelect];
|
|
52
|
-
if (!option?.options)
|
|
53
|
-
return;
|
|
54
|
-
if (key.escape) {
|
|
55
|
-
setEditingSelect(null);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (key.leftArrow || key.upArrow) {
|
|
59
|
-
setSelectOptionIndex((prev) => Math.max(0, prev - 1));
|
|
60
|
-
}
|
|
61
|
-
if (key.rightArrow || key.downArrow) {
|
|
62
|
-
setSelectOptionIndex((prev) => Math.min(option.options.length - 1, prev + 1));
|
|
63
|
-
}
|
|
64
|
-
if (key.return) {
|
|
65
|
-
setValues((prev) => ({ ...prev, [editingSelect]: option.options[selectOptionIndex] }));
|
|
66
|
-
setEditingSelect(null);
|
|
67
|
-
}
|
|
68
|
-
}, { isActive: editingSelect !== null });
|
|
69
|
-
// Handle navigation and actions when not editing
|
|
70
|
-
useInput((input, key) => {
|
|
71
|
-
if (key.escape) {
|
|
72
|
-
onCancel();
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (key.upArrow) {
|
|
76
|
-
setSelectedIndex((prev) => {
|
|
77
|
-
const newIndex = Math.max(0, prev - 1);
|
|
78
|
-
// Scroll up if needed
|
|
79
|
-
if (newIndex < scrollOffset) {
|
|
80
|
-
setScrollOffset(newIndex);
|
|
81
|
-
}
|
|
82
|
-
return newIndex;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
if (key.downArrow) {
|
|
86
|
-
// +1 for the Save button at the end
|
|
87
|
-
setSelectedIndex((prev) => {
|
|
88
|
-
const newIndex = Math.min(totalItems - 1, prev + 1);
|
|
89
|
-
// Scroll down if needed
|
|
90
|
-
if (newIndex >= scrollOffset + MAX_VISIBLE_CONFIG_ITEMS) {
|
|
91
|
-
setScrollOffset(newIndex - MAX_VISIBLE_CONFIG_ITEMS + 1);
|
|
92
|
-
}
|
|
93
|
-
return newIndex;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
if (key.return) {
|
|
97
|
-
// Save button is at index === configKeys.length
|
|
98
|
-
if (selectedIndex === configKeys.length) {
|
|
99
|
-
handleSave();
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const key = configKeys[selectedIndex];
|
|
103
|
-
const option = configSchema[key];
|
|
104
|
-
if (option.type === ConfigOptionType.Boolean) {
|
|
105
|
-
// Toggle boolean
|
|
106
|
-
setValues((prev) => ({ ...prev, [key]: !prev[key] }));
|
|
107
|
-
}
|
|
108
|
-
else if (option.type === ConfigOptionType.Select && option.options) {
|
|
109
|
-
// Enter select edit mode
|
|
110
|
-
const currentValue = String(values[key] || option.options[0]);
|
|
111
|
-
const currentIndex = option.options.indexOf(currentValue);
|
|
112
|
-
setSelectOptionIndex(currentIndex >= 0 ? currentIndex : 0);
|
|
113
|
-
setEditingSelect(key);
|
|
114
|
-
}
|
|
115
|
-
else if (option.type === ConfigOptionType.String) {
|
|
116
|
-
// Enter edit mode for string
|
|
117
|
-
setEditingField(key);
|
|
118
|
-
setEditValue(String(values[key] || ''));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}, { isActive: editingField === null && editingSelect === null });
|
|
122
|
-
if (configKeys.length === 0) {
|
|
123
|
-
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: [_jsx(Text, { color: colors.textDim, children: "[" }), _jsx(Text, { color: colors.primary, children: "\u25CF" }), _jsx(Text, { color: colors.textDim, children: " " }), _jsx(Text, { color: colors.primary, children: "\u25CF" }), _jsx(Text, { color: colors.textDim, children: "] " }), _jsxs(Text, { color: colors.text, bold: true, children: ["configure ", skill.name] })] }) }), _jsx(Text, { color: colors.textMuted, children: "This skill has no configuration options." }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: colors.textDim, children: "esc to go back" }) })] }));
|
|
124
|
-
}
|
|
125
|
-
// Calculate visible range
|
|
126
|
-
const visibleEndIndex = Math.min(scrollOffset + MAX_VISIBLE_CONFIG_ITEMS, totalItems);
|
|
127
|
-
const visibleConfigKeys = configKeys.slice(scrollOffset, Math.min(scrollOffset + MAX_VISIBLE_CONFIG_ITEMS, configKeys.length));
|
|
128
|
-
const showSaveButton = visibleEndIndex > configKeys.length || scrollOffset + MAX_VISIBLE_CONFIG_ITEMS > configKeys.length;
|
|
129
|
-
const showTopIndicator = scrollOffset > 0;
|
|
130
|
-
const showBottomIndicator = scrollOffset + MAX_VISIBLE_CONFIG_ITEMS < totalItems;
|
|
131
|
-
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: [_jsx(Text, { color: colors.textDim, children: "[" }), _jsx(Text, { color: colors.primary, children: "\u25CF" }), _jsx(Text, { color: colors.textDim, children: " " }), _jsx(Text, { color: colors.primary, children: "\u25CF" }), _jsx(Text, { color: colors.textDim, children: "] " }), _jsxs(Text, { color: colors.text, bold: true, children: ["configure ", skill.name] })] }) }), _jsxs(Box, { flexDirection: "column", children: [showTopIndicator && (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: colors.textDim, children: [" \u2191 ", scrollOffset, " more"] }) })), visibleConfigKeys.map((configKey) => {
|
|
132
|
-
const actualIndex = configKeys.indexOf(configKey);
|
|
133
|
-
const option = configSchema[configKey];
|
|
134
|
-
const isSelected = selectedIndex === actualIndex;
|
|
135
|
-
const isEditing = editingField === configKey;
|
|
136
|
-
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { children: [_jsxs(Text, { color: colors.textDim, children: [isSelected ? '>' : ' ', " "] }), _jsx(Text, { color: isSelected ? colors.text : colors.textMuted, children: configKey })] }), _jsxs(Text, { color: colors.textDim, children: [" ", option.description] }), _jsxs(Box, { children: [_jsx(Text, { color: colors.textDim, children: " " }), option.type === ConfigOptionType.Boolean ? (_jsxs(Text, { color: colors.text, children: ["[", values[configKey] ? 'x' : ' ', "] ", values[configKey] ? 'enabled' : 'disabled'] })) : option.type === ConfigOptionType.Select && option.options ? (_jsx(Text, { color: colors.text, children: option.options.map((opt, i) => {
|
|
137
|
-
const isCurrentValue = String(values[configKey]) === opt;
|
|
138
|
-
const isEditingThis = editingSelect === configKey;
|
|
139
|
-
const isHighlighted = isEditingThis && selectOptionIndex === i;
|
|
140
|
-
return (_jsxs(Text, { children: [i > 0 && _jsx(Text, { color: colors.textDim, children: " \u00B7 " }), _jsx(Text, { color: isHighlighted ? '#ffffff' : isCurrentValue ? colors.primary : colors.textMuted, backgroundColor: isHighlighted ? colors.primary : undefined, children: isCurrentValue && !isEditingThis ? `[${opt}]` : isHighlighted ? ` ${opt} ` : opt })] }, opt));
|
|
141
|
-
}) })) : isEditing ? (_jsxs(Box, { children: [_jsx(Text, { color: colors.textDim, children: '> ' }), _jsx(TextInput, { value: editValue, onChange: setEditValue, onSubmit: handleSubmitEdit })] })) : (_jsx(Text, { color: colors.text, children: String(values[configKey]) || '(not set)' }))] })] }, configKey));
|
|
142
|
-
}), showSaveButton && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { children: [_jsxs(Text, { color: colors.textDim, children: [selectedIndex === configKeys.length ? '>' : ' ', " "] }), _jsxs(Text, { backgroundColor: selectedIndex === configKeys.length ? colors.primary : undefined, color: selectedIndex === configKeys.length ? '#ffffff' : colors.textMuted, bold: selectedIndex === configKeys.length, children: [' ', "Save", ' '] })] }) })), showBottomIndicator && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: colors.textDim, children: [" \u2193 ", totalItems - scrollOffset - MAX_VISIBLE_CONFIG_ITEMS, " more"] }) }))] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: colors.textDim, children: editingField
|
|
143
|
-
? 'enter save · esc cancel'
|
|
144
|
-
: editingSelect
|
|
145
|
-
? '←→ choose · enter select · esc cancel'
|
|
146
|
-
: '↑↓ select · enter toggle/edit · esc back' }) })] }));
|
|
147
|
-
}
|
|
148
|
-
//# sourceMappingURL=Skill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,mBAAmB,IAAI,CACtB,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,MAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,0BAAO,UAAU,GAAG,YAAY,GAAG,wBAAwB,aAAa,GAC/F,CACP,IACG,EAEN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,YACxB,YAAY;wBACX,CAAC,CAAC,yBAAyB;wBAC3B,CAAC,CAAC,aAAa;4BACb,CAAC,CAAC,uCAAuC;4BACzC,CAAC,CAAC,0CAA0C,GAC3C,GACH,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text, useInput } from 'ink';
|
|
3
|
-
import { useState, useMemo } from 'react';
|
|
4
|
-
import { existsSync, readFileSync } from 'fs';
|
|
5
|
-
import { join } from 'path';
|
|
6
|
-
import { getBundledToolsDir } from '../../../lib/tools';
|
|
7
|
-
import { colors } from '../constants';
|
|
8
|
-
export function ToolExplorer({ tool, onViewSource, onClose }) {
|
|
9
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
10
|
-
// Build list of all explorable items
|
|
11
|
-
const items = useMemo(() => {
|
|
12
|
-
const result = [];
|
|
13
|
-
const toolDir = getBundledToolsDir();
|
|
14
|
-
// Add skills
|
|
15
|
-
for (const skill of tool.includes.skills) {
|
|
16
|
-
result.push({
|
|
17
|
-
type: 'skill',
|
|
18
|
-
name: skill.name,
|
|
19
|
-
path: join(toolDir, tool.name, 'skills', skill.name, 'SKILL.md'),
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
// Add commands
|
|
23
|
-
for (const cmd of tool.includes.commands) {
|
|
24
|
-
result.push({
|
|
25
|
-
type: 'command',
|
|
26
|
-
name: `/${cmd}`,
|
|
27
|
-
path: join(toolDir, tool.name, 'commands', `${cmd}.md`),
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
// Add agents
|
|
31
|
-
for (const agent of tool.includes.agents) {
|
|
32
|
-
result.push({
|
|
33
|
-
type: 'agent',
|
|
34
|
-
name: agent,
|
|
35
|
-
path: join(toolDir, tool.name, 'agents', agent, 'AGENT.md'),
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return result;
|
|
39
|
-
}, [tool]);
|
|
40
|
-
useInput((input, key) => {
|
|
41
|
-
if (key.escape) {
|
|
42
|
-
onClose();
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (key.leftArrow || key.upArrow) {
|
|
46
|
-
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
47
|
-
}
|
|
48
|
-
if (key.rightArrow || key.downArrow) {
|
|
49
|
-
setSelectedIndex((prev) => Math.min(items.length - 1, prev + 1));
|
|
50
|
-
}
|
|
51
|
-
if (key.return && items.length > 0) {
|
|
52
|
-
const item = items[selectedIndex];
|
|
53
|
-
if (existsSync(item.path)) {
|
|
54
|
-
const content = readFileSync(item.path, 'utf-8');
|
|
55
|
-
onViewSource(`${tool.name} / ${item.name}`, content);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
// Try YAML fallback for skills/agents
|
|
59
|
-
const yamlPath = item.path.replace('.md', '.yaml');
|
|
60
|
-
if (existsSync(yamlPath)) {
|
|
61
|
-
const content = readFileSync(yamlPath, 'utf-8');
|
|
62
|
-
onViewSource(`${tool.name} / ${item.name}`, content);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
// Group items by type for display
|
|
68
|
-
const skillItems = items.filter(i => i.type === 'skill');
|
|
69
|
-
const commandItems = items.filter(i => i.type === 'command');
|
|
70
|
-
const agentItems = items.filter(i => i.type === 'agent');
|
|
71
|
-
const getItemIndex = (item) => items.indexOf(item);
|
|
72
|
-
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: [_jsx(Text, { color: colors.textDim, children: "[" }), _jsx(Text, { color: colors.primary, children: "\u25CF" }), _jsx(Text, { color: colors.textDim, children: " " }), _jsx(Text, { color: colors.primary, children: "\u25CF" }), _jsx(Text, { color: colors.textDim, children: "] " }), _jsx(Text, { color: colors.text, bold: true, children: tool.name })] }) }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: colors.textMuted, children: tool.description }) }), skillItems.length > 0 && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { color: colors.skill, bold: true, children: "Skills" }), _jsx(Box, { flexDirection: "row", flexWrap: "wrap", marginTop: 1, children: skillItems.map((item) => {
|
|
73
|
-
const idx = getItemIndex(item);
|
|
74
|
-
const isSelected = selectedIndex === idx;
|
|
75
|
-
return (_jsx(Box, { marginRight: 1, marginBottom: 1, children: _jsx(Text, { backgroundColor: isSelected ? colors.skill : colors.bgSelected, color: isSelected ? '#000000' : colors.skill, bold: isSelected, children: ` ${item.name} ` }) }, item.name));
|
|
76
|
-
}) })] })), commandItems.length > 0 && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { color: colors.command, bold: true, children: "Commands" }), _jsx(Box, { flexDirection: "row", flexWrap: "wrap", marginTop: 1, children: commandItems.map((item) => {
|
|
77
|
-
const idx = getItemIndex(item);
|
|
78
|
-
const isSelected = selectedIndex === idx;
|
|
79
|
-
return (_jsx(Box, { marginRight: 1, marginBottom: 1, children: _jsx(Text, { backgroundColor: isSelected ? colors.command : colors.bgSelected, color: isSelected ? '#000000' : colors.command, bold: isSelected, children: ` ${item.name} ` }) }, item.name));
|
|
80
|
-
}) })] })), agentItems.length > 0 && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { color: colors.agent, bold: true, children: "Agents" }), _jsx(Box, { flexDirection: "row", flexWrap: "wrap", marginTop: 1, children: agentItems.map((item) => {
|
|
81
|
-
const idx = getItemIndex(item);
|
|
82
|
-
const isSelected = selectedIndex === idx;
|
|
83
|
-
return (_jsx(Box, { marginRight: 1, marginBottom: 1, children: _jsx(Text, { backgroundColor: isSelected ? colors.agent : colors.bgSelected, color: isSelected ? '#000000' : colors.agent, bold: isSelected, children: ` ${item.name} ` }) }, item.name));
|
|
84
|
-
}) })] })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: colors.textDim, children: "\u2190\u2192 navigate \u00B7 enter view source \u00B7 esc back" }) })] }));
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=ToolExplorer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolExplorer.js","sourceRoot":"","sources":["../../../../src/commands/tui/views/ToolExplorer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAetC,MAAM,UAAU,YAAY,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAqB;IAC7E,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEtD,qCAAqC;IACrC,MAAM,KAAK,GAAmB,OAAO,CAAC,GAAG,EAAE;QACzC,MAAM,MAAM,GAAmB,EAAE,CAAC;QAClC,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;QAErC,aAAa;QACb,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACzC,MAAM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jsx-runtime";
|
|
2
|
-
import { Box, Text, useInput } from 'ink';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { colors } from '../constants';
|
|
5
|
-
export function ToolUpdatePrompt({ toolUpdates, onUpdateAll, onAlways, onSkip, isUpdating }) {
|
|
6
|
-
const [selectedButton, setSelectedButton] = useState(0);
|
|
7
|
-
useInput((input, key) => {
|
|
8
|
-
if (isUpdating)
|
|
9
|
-
return;
|
|
10
|
-
if (key.leftArrow) {
|
|
11
|
-
setSelectedButton((prev) => Math.max(0, prev - 1));
|
|
12
|
-
}
|
|
13
|
-
if (key.rightArrow) {
|
|
14
|
-
setSelectedButton((prev) => Math.min(2, prev + 1));
|
|
15
|
-
}
|
|
16
|
-
if (key.return) {
|
|
17
|
-
if (selectedButton === 0) {
|
|
18
|
-
onUpdateAll();
|
|
19
|
-
}
|
|
20
|
-
else if (selectedButton === 1) {
|
|
21
|
-
onAlways();
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
onSkip();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (input === 'q') {
|
|
28
|
-
onSkip();
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const buttons = [
|
|
32
|
-
{ label: 'Update All', action: onUpdateAll },
|
|
33
|
-
{ label: 'Always', action: onAlways },
|
|
34
|
-
{ label: 'Skip', action: onSkip },
|
|
35
|
-
];
|
|
36
|
-
return (_jsx(Box, { flexDirection: "column", alignItems: "center", justifyContent: "center", height: 18, children: _jsxs(Box, { flexDirection: "column", alignItems: "center", borderStyle: "single", borderColor: colors.primary, paddingX: 4, paddingY: 1, children: [_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { color: colors.textDim, children: "\u2554\u2550\u2550\u2550\u2550\u2550\u2557 " }), _jsx(Text, { color: colors.text, children: "Tool Updates" })] }), _jsxs(Text, { children: [_jsx(Text, { color: colors.textDim, children: "\u2551 " }), _jsx(Text, { color: colors.primary, children: "\u25CF" }), _jsx(Text, { color: colors.textDim, children: " " }), _jsx(Text, { color: colors.primary, children: "\u25CF" }), _jsx(Text, { color: colors.textDim, children: " \u2551 " }), _jsxs(Text, { color: colors.textMuted, children: [toolUpdates.length, " tool", toolUpdates.length > 1 ? 's have' : ' has', " updates available"] })] }), _jsx(Text, { children: _jsx(Text, { color: colors.textDim, children: "\u255A\u2550\u2566\u2550\u2566\u2550\u255D" }) })] }), _jsxs(Box, { marginTop: 1, marginBottom: 1, flexDirection: "column", children: [toolUpdates.slice(0, 5).map((tool) => (_jsxs(Text, { color: colors.textMuted, children: [_jsx(Text, { color: colors.primary, children: "\u2191" }), " ", tool.name, _jsxs(Text, { color: colors.textDim, children: [" ", tool.installedVersion, " \u2192 ", tool.bundledVersion] })] }, tool.name))), toolUpdates.length > 5 && (_jsxs(Text, { color: colors.textDim, children: ["...and ", toolUpdates.length - 5, " more"] }))] }), isUpdating ? (_jsx(Text, { color: colors.primary, children: "Updating tools..." })) : (_jsx(Box, { flexDirection: "row", children: buttons.map((button, index) => (_jsxs(Text, { backgroundColor: selectedButton === index ? colors.primary : colors.bgSelected, color: selectedButton === index ? '#000000' : colors.textMuted, bold: selectedButton === index, children: [' ', button.label, ' '] }, button.label))) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: colors.textDim, children: "\u2190\u2192 select \u00B7 enter \u00B7 \"Always\" enables auto-update" }) })] }) }));
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=ToolUpdatePrompt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolUpdatePrompt.js","sourceRoot":"","sources":["../../../../src/commands/tui/views/ToolUpdatePrompt.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAWt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|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text, useInput } from 'ink';
|
|
3
|
-
import { useState, useMemo } from 'react';
|
|
4
|
-
import { colors } from '../constants';
|
|
5
|
-
import { getRandomQuote } from '../../../lib/quotes';
|
|
6
|
-
export function WelcomeScreen({ onContinue, onUpdate, onAlways, onExit, updateInfo, isUpdating }) {
|
|
7
|
-
const [selectedButton, setSelectedButton] = useState(0);
|
|
8
|
-
const welcomeQuote = useMemo(() => getRandomQuote(), []);
|
|
9
|
-
useInput((input, key) => {
|
|
10
|
-
if (isUpdating)
|
|
11
|
-
return;
|
|
12
|
-
if (updateInfo.hasUpdate) {
|
|
13
|
-
if (key.leftArrow) {
|
|
14
|
-
setSelectedButton((prev) => Math.max(0, prev - 1));
|
|
15
|
-
}
|
|
16
|
-
if (key.rightArrow) {
|
|
17
|
-
setSelectedButton((prev) => Math.min(2, prev + 1));
|
|
18
|
-
}
|
|
19
|
-
if (key.return) {
|
|
20
|
-
if (selectedButton === 0) {
|
|
21
|
-
onUpdate();
|
|
22
|
-
}
|
|
23
|
-
else if (selectedButton === 1) {
|
|
24
|
-
onAlways();
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
onContinue();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (input === 'q') {
|
|
31
|
-
onExit();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
if (key.return) {
|
|
36
|
-
onContinue();
|
|
37
|
-
}
|
|
38
|
-
if (input === 'q') {
|
|
39
|
-
onExit();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
const hasUpdate = updateInfo.hasUpdate && updateInfo.latestVersion;
|
|
44
|
-
return (_jsx(Box, { flexDirection: "column", alignItems: "center", justifyContent: "center", height: 18, children: _jsxs(Box, { flexDirection: "column", alignItems: "center", borderStyle: "single", borderColor: hasUpdate ? '#eab308' : colors.border, paddingX: 4, paddingY: 1, children: [_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { color: colors.textDim, children: "\u2554\u2550\u2550\u2550\u2550\u2550\u2557 " }), _jsx(Text, { color: colors.text, children: "droid" }), _jsxs(Text, { color: colors.textDim, children: [" v", updateInfo.currentVersion] })] }), _jsxs(Text, { children: [_jsx(Text, { color: colors.textDim, children: "\u2551 " }), _jsx(Text, { color: hasUpdate ? '#eab308' : colors.primary, children: "\u25CF" }), _jsx(Text, { color: colors.textDim, children: " " }), _jsx(Text, { color: hasUpdate ? '#eab308' : colors.primary, children: "\u25CF" }), _jsx(Text, { color: colors.textDim, children: " \u2551 " }), _jsx(Text, { color: colors.textMuted, children: "Droid, teaching your AI new tricks" })] }), _jsxs(Text, { children: [_jsx(Text, { color: colors.textDim, children: "\u255A\u2550\u2566\u2550\u2566\u2550\u255D " }), _jsx(Text, { color: colors.textDim, children: "github.com/Orderful/droid" })] })] }), hasUpdate ? (_jsxs(_Fragment, { children: [_jsxs(Box, { marginTop: 2, marginBottom: 1, flexDirection: "column", alignItems: "center", children: [_jsx(Text, { color: "#eab308", italic: true, children: "\"The odds of functioning optimally without this" }), _jsx(Text, { color: "#eab308", italic: true, children: "update are approximately 3,720 to 1.\"" })] }), _jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: colors.textMuted, children: ["v", updateInfo.currentVersion, " \u2192 v", updateInfo.latestVersion] }) }), isUpdating ? (_jsx(Text, { color: "#eab308", children: "Updating..." })) : (_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { backgroundColor: selectedButton === 0 ? '#eab308' : colors.bgSelected, color: selectedButton === 0 ? '#000000' : colors.textMuted, bold: selectedButton === 0, children: [' ', "Update", ' '] }), _jsx(Text, { children: " " }), _jsxs(Text, { backgroundColor: selectedButton === 1 ? '#eab308' : colors.bgSelected, color: selectedButton === 1 ? '#000000' : colors.textMuted, bold: selectedButton === 1, children: [' ', "Always", ' '] }), _jsx(Text, { children: " " }), _jsxs(Text, { backgroundColor: selectedButton === 2 ? colors.bgSelected : undefined, color: selectedButton === 2 ? colors.text : colors.textMuted, bold: selectedButton === 2, children: [' ', "Skip", ' '] })] })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: colors.textDim, children: "\u2190\u2192 select \u00B7 enter \u00B7 \"Always\" enables auto-update" }) })] })) : (_jsxs(_Fragment, { children: [_jsx(Box, { marginTop: 2, marginBottom: 1, children: _jsx(Text, { backgroundColor: colors.primary, color: "#ffffff", bold: true, children: ` ${welcomeQuote} ` }) }), _jsx(Text, { color: colors.textDim, children: "press enter" })] }))] }) }));
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=WelcomeScreen.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WelcomeScreen.js","sourceRoot":"","sources":["../../../../src/commands/tui/views/WelcomeScreen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAYrD,MAAM,UAAU,aAAa,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAsB;IAClH,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxD,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC;IAEzD,QAAQ,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACtB,IAAI,UAAU;YAAE,OAAO;QAEvB,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC;YACzB,I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