Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions assistant/src/__tests__/target-app-hints.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ describe('resolveComputerUseTargetAppHint', () => {
expect(result).toEqual({ appName: 'Discord', bundleId: 'com.hnc.Discord' });
});

test('matches "zoom"', () => {
const result = resolveComputerUseTargetAppHint('join the zoom meeting');
test('matches "open zoom"', () => {
const result = resolveComputerUseTargetAppHint('open zoom and join the call');
expect(result).toEqual({ appName: 'zoom.us', bundleId: 'us.zoom.xos' });
});

test('matches "zoom app"', () => {
const result = resolveComputerUseTargetAppHint('check the zoom app');
expect(result).toEqual({ appName: 'zoom.us', bundleId: 'us.zoom.xos' });
});

Expand Down Expand Up @@ -102,6 +107,11 @@ describe('resolveComputerUseTargetAppHint', () => {
const result = resolveComputerUseTargetAppHint('use iterm2 for this');
expect(result).toEqual({ appName: 'iTerm', bundleId: 'com.googlecode.iterm2' });
});

test('"open terminal in iterm2" resolves to iTerm', () => {
const result = resolveComputerUseTargetAppHint('open terminal in iterm2');
expect(result).toEqual({ appName: 'iTerm', bundleId: 'com.googlecode.iterm2' });
});
});

// ── IDEs ───────────────────────────────────────────────────────────
Expand All @@ -121,11 +131,16 @@ describe('resolveComputerUseTargetAppHint', () => {
expect(result).toEqual({ appName: 'Visual Studio Code', bundleId: 'com.microsoft.VSCode' });
});

test('matches "cursor"', () => {
test('matches "open cursor"', () => {
const result = resolveComputerUseTargetAppHint('open cursor and edit the file');
expect(result).toEqual({ appName: 'Cursor', bundleId: 'com.todesktop.230313mzl4w4u92' });
});

test('matches "cursor app"', () => {
const result = resolveComputerUseTargetAppHint('check the cursor app');
expect(result).toEqual({ appName: 'Cursor', bundleId: 'com.todesktop.230313mzl4w4u92' });
});

test('matches "xcode"', () => {
const result = resolveComputerUseTargetAppHint('build the project in xcode');
expect(result).toEqual({ appName: 'Xcode', bundleId: 'com.apple.dt.Xcode' });
Expand Down Expand Up @@ -245,6 +260,26 @@ describe('resolveComputerUseTargetAppHint', () => {
expect(result).toBeUndefined();
});

test('"move cursor to the submit button" does NOT return Cursor', () => {
const result = resolveComputerUseTargetAppHint('move cursor to the submit button');
expect(result).toBeUndefined();
});

test('"zoom in on the chart" does NOT return Zoom', () => {
const result = resolveComputerUseTargetAppHint('zoom in on the chart');
expect(result).toBeUndefined();
});

test('"login terminal" does NOT return Terminal (word boundary)', () => {
const result = resolveComputerUseTargetAppHint('login terminal');
expect(result).toBeUndefined();
});

test('"domain mail server" does NOT return Mail (word boundary)', () => {
const result = resolveComputerUseTargetAppHint('domain mail server');
expect(result).toBeUndefined();
});

test('empty string returns undefined', () => {
const result = resolveComputerUseTargetAppHint('');
expect(result).toBeUndefined();
Expand Down
16 changes: 8 additions & 8 deletions assistant/src/daemon/target-app-hints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function contextPattern(word: string): RegExp {
// Deliberately excludes "the" — too many false positives
// ("the settings in the config", "the messages carefully").
return new RegExp(
`(?:(?:(?:open|launch|switch\\s+to|in|test|qa|check|use)\\s+)${word}|${word}\\s+app)\\b`,
`(?:(?:(?:^|\\b)(?:open|launch|switch\\s+to|in|test|qa|check|use)\\s+)${word}|\\b${word}\\s+app)\\b`,
'i',
);
}
Expand Down Expand Up @@ -79,7 +79,7 @@ export const APP_HINTS: AppHintEntry[] = [
bundleId: 'com.hnc.Discord',
},
{
patterns: [/\bzoom\b/],
patterns: [contextPattern('zoom')],
appName: 'zoom.us',
bundleId: 'us.zoom.xos',
},
Expand All @@ -94,24 +94,24 @@ export const APP_HINTS: AppHintEntry[] = [
appName: 'Warp',
bundleId: 'dev.warp.Warp-Stable',
},
{
patterns: [contextPattern('terminal')],
appName: 'Terminal',
bundleId: 'com.apple.Terminal',
},
{
patterns: [/\biterm2?\b/],
appName: 'iTerm',
bundleId: 'com.googlecode.iterm2',
},
{
patterns: [contextPattern('terminal')],
appName: 'Terminal',
bundleId: 'com.apple.Terminal',
},
// IDEs
{
patterns: [/\b(vs\s*code|visual\s+studio\s+code)\b/],
appName: 'Visual Studio Code',
bundleId: 'com.microsoft.VSCode',
},
{
patterns: [/\bcursor\b/],
patterns: [contextPattern('cursor')],
appName: 'Cursor',
bundleId: 'com.todesktop.230313mzl4w4u92',
},
Expand Down
Loading