drexler 0.2.1 → 0.2.2
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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/commands.ts +65 -1
- package/src/ui/CommandPalette.tsx +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
- Added argument suggestions in the slash command palette for `/theme`, `/startup`, `/retry`, `/export`, and `/model`.
|
|
6
|
+
- Kept argument suggestion rows concise by avoiding duplicated hint copy.
|
|
7
|
+
|
|
3
8
|
## 0.2.1
|
|
4
9
|
|
|
5
10
|
- Fixed slash command help and palette coverage so every implemented command is discoverable.
|
package/package.json
CHANGED
package/src/commands.ts
CHANGED
|
@@ -76,10 +76,74 @@ export const COMMAND_PALETTE: ReadonlyArray<SlashCommand> = [
|
|
|
76
76
|
{ name: "/copy-last", description: "Copy last response" },
|
|
77
77
|
];
|
|
78
78
|
|
|
79
|
+
const ARGUMENT_PALETTE: ReadonlyArray<{
|
|
80
|
+
readonly command: string;
|
|
81
|
+
readonly values: ReadonlyArray<SlashCommand>;
|
|
82
|
+
}> = [
|
|
83
|
+
{
|
|
84
|
+
command: "/theme",
|
|
85
|
+
values: [
|
|
86
|
+
...THEME_NAMES.map((name) => ({
|
|
87
|
+
name: `/theme ${name}`,
|
|
88
|
+
description: `Switch to ${name} theme`,
|
|
89
|
+
})),
|
|
90
|
+
{ name: "/theme save", description: "Save current theme as default" },
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
command: "/startup",
|
|
95
|
+
values: [
|
|
96
|
+
{ name: "/startup fast", description: "Persist fast startup" },
|
|
97
|
+
{ name: "/startup no-intro", description: "Skip intro on launch" },
|
|
98
|
+
{ name: "/startup normal", description: "Restore full intro" },
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
command: "/retry",
|
|
103
|
+
values: [
|
|
104
|
+
{ name: "/retry terse", description: "Retry in two sentences" },
|
|
105
|
+
{ name: "/retry brutal", description: "Retry more forcefully" },
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
command: "/export",
|
|
110
|
+
values: [
|
|
111
|
+
{ name: "/export md", description: "Export markdown transcript" },
|
|
112
|
+
{ name: "/export txt", description: "Export plain text transcript" },
|
|
113
|
+
{ name: "/export json", description: "Export structured JSON" },
|
|
114
|
+
{ name: "/export html", description: "Export printable HTML" },
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
command: "/model",
|
|
119
|
+
values: [
|
|
120
|
+
{ name: "/model 31b", description: "Use primary 31b model" },
|
|
121
|
+
{ name: "/model 26b", description: "Use fallback 26b model" },
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
function filterArgumentPalette(input: string): ReadonlyArray<SlashCommand> {
|
|
127
|
+
const lower = input.toLowerCase();
|
|
128
|
+
for (const group of ARGUMENT_PALETTE) {
|
|
129
|
+
const prefix = `${group.command} `;
|
|
130
|
+
if (!lower.startsWith(prefix)) continue;
|
|
131
|
+
const argPrefix = lower.slice(prefix.length);
|
|
132
|
+
return group.values.filter((item) =>
|
|
133
|
+
item.name.toLowerCase().startsWith(lower),
|
|
134
|
+
).filter((item) => {
|
|
135
|
+
if (argPrefix.trim() === "") return true;
|
|
136
|
+
return item.name.toLowerCase().slice(prefix.length).startsWith(argPrefix);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
|
|
79
142
|
export function filterPaletteByPrefix(
|
|
80
143
|
input: string,
|
|
81
144
|
): ReadonlyArray<SlashCommand> {
|
|
82
|
-
if (!input.startsWith("/")
|
|
145
|
+
if (!input.startsWith("/")) return [];
|
|
146
|
+
if (input.includes(" ")) return filterArgumentPalette(input);
|
|
83
147
|
const prefix = input.toLowerCase();
|
|
84
148
|
return COMMAND_PALETTE.filter((c) =>
|
|
85
149
|
c.name.toLowerCase().startsWith(prefix),
|
|
@@ -90,7 +90,10 @@ function CommandPaletteInner({ items, selectedIdx, width = 80 }: Props) {
|
|
|
90
90
|
</Box>
|
|
91
91
|
{items.map((item, idx) => {
|
|
92
92
|
const sel = idx === selectedIdx;
|
|
93
|
-
const
|
|
93
|
+
const isArgumentSuggestion = item.name.includes(" ");
|
|
94
|
+
const hint = isArgumentSuggestion
|
|
95
|
+
? ""
|
|
96
|
+
: COMMAND_HINTS[item.name] ?? item.description;
|
|
94
97
|
const name = item.name.padEnd(maxNameW + 1);
|
|
95
98
|
const desc = fitDisplayText(item.description, descBudget);
|
|
96
99
|
const clippedHint =
|