Skip to content

Commit b3b0f59

Browse files
authored
fix: add curated suggestions for open-url and close-session (#1175)
Last night's help-conformance benchmark showed agents guessing open-url and close-session with no "did you mean" hint (the Levenshtein fallback doesn't cover either token — both exceed the edit-distance threshold for their length). Add curated entries pointing them at `open <url>` and `close`.
1 parent 983625f commit b3b0f59

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/cli/parser/__tests__/command-suggestions.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,26 @@ test('get-text, gettext, and get_text suggest get text', () => {
109109
}
110110
});
111111

112+
test('open-url suggests open <url>', () => {
113+
assert.throws(
114+
() => parseArgs(['open-url', 'https://example.com']),
115+
(error: unknown) =>
116+
error instanceof AppError &&
117+
error.code === 'INVALID_ARGS' &&
118+
error.message === 'Unknown command: open-url. Did you mean open <url>?',
119+
);
120+
});
121+
122+
test('close-session suggests close', () => {
123+
assert.throws(
124+
() => parseArgs(['close-session']),
125+
(error: unknown) =>
126+
error instanceof AppError &&
127+
error.code === 'INVALID_ARGS' &&
128+
error.message === 'Unknown command: close-session. Did you mean close?',
129+
);
130+
});
131+
112132
test('screencap and capture suggest screenshot', () => {
113133
for (const guess of ['screencap', 'capture']) {
114134
assert.throws(

src/cli/parser/command-suggestions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ const COMMAND_ALIAS_SUGGESTIONS: Record<string, CommandAliasSuggestion> = {
3838
'get-text': { command: 'get', example: 'get text' },
3939
gettext: { command: 'get', example: 'get text' },
4040
get_text: { command: 'get', example: 'get text' },
41+
'open-url': { command: 'open', example: 'open <url>' },
42+
'close-session': { command: 'close', example: 'close' },
4143
};
4244

4345
export function listCommandAliasSuggestionEntries(): Array<[string, CommandAliasSuggestion]> {

0 commit comments

Comments
 (0)