@causyne/agent 1.20.43 → 1.20.44
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/package.json +1 -1
- package/src/tui/completion.js +18 -19
package/package.json
CHANGED
package/src/tui/completion.js
CHANGED
|
@@ -93,11 +93,26 @@ function rank(items, query, limit = 50, focusDir = null) {
|
|
|
93
93
|
for (const item of items) {
|
|
94
94
|
const val = item.match !== undefined ? item.match : item.value;
|
|
95
95
|
let value = score(val, query);
|
|
96
|
+
let matchedAlias = null;
|
|
97
|
+
|
|
98
|
+
if (Array.isArray(item.aliases) && query) {
|
|
99
|
+
for (const alias of item.aliases) {
|
|
100
|
+
const aliasScore = score(alias, query);
|
|
101
|
+
if (aliasScore > value) {
|
|
102
|
+
value = aliasScore;
|
|
103
|
+
matchedAlias = alias;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
96
108
|
if (value >= 0) {
|
|
97
109
|
if (focusPrefix && val.toLowerCase().startsWith(focusPrefix)) {
|
|
98
110
|
value += 3000;
|
|
99
111
|
}
|
|
100
|
-
|
|
112
|
+
const resultItem = matchedAlias
|
|
113
|
+
? { ...item, description: `(alias: /${matchedAlias}) ${item.description}` }
|
|
114
|
+
: item;
|
|
115
|
+
scored.push({ item: resultItem, value });
|
|
101
116
|
}
|
|
102
117
|
}
|
|
103
118
|
scored.sort((a, b) => b.value - a.value);
|
|
@@ -140,27 +155,11 @@ function commandItems() {
|
|
|
140
155
|
commands.push({
|
|
141
156
|
value: primaryLabel,
|
|
142
157
|
match: command.name,
|
|
158
|
+
aliases: Array.isArray(command.aliases) ? command.aliases.filter(isTerminalSafe) : [],
|
|
143
159
|
label: primaryLabel,
|
|
144
160
|
description: sanitize(command.description || '')
|
|
145
161
|
});
|
|
146
162
|
}
|
|
147
|
-
|
|
148
|
-
// Include aliases (e.g. /models, /session, /reset) so they match cleanly and resolve to canonical command
|
|
149
|
-
if (Array.isArray(command.aliases)) {
|
|
150
|
-
for (const alias of command.aliases) {
|
|
151
|
-
if (!isTerminalSafe(alias)) continue;
|
|
152
|
-
const aliasLabel = '/' + alias;
|
|
153
|
-
if (!seenLabels.has(aliasLabel)) {
|
|
154
|
-
seenLabels.add(aliasLabel);
|
|
155
|
-
commands.push({
|
|
156
|
-
value: primaryLabel,
|
|
157
|
-
match: alias,
|
|
158
|
-
label: aliasLabel,
|
|
159
|
-
description: sanitize(command.description || '')
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
// Skills answer to the slash menu directly, the way claude-code surfaces a
|
|
@@ -188,7 +187,7 @@ function commandItems() {
|
|
|
188
187
|
*/
|
|
189
188
|
function argumentItems(name) {
|
|
190
189
|
const command = listCommands('terminal')
|
|
191
|
-
.find((candidate) => candidate.name === name && isTerminalSafe(candidate.name));
|
|
190
|
+
.find((candidate) => (candidate.name === name || (Array.isArray(candidate.aliases) && candidate.aliases.includes(name))) && isTerminalSafe(candidate.name));
|
|
192
191
|
if (!command || typeof command.complete !== 'function') return [];
|
|
193
192
|
|
|
194
193
|
let produced;
|