Skip to content

Commit af2d63b

Browse files
committed
chore: remove trigger command aliases
1 parent a85f9a8 commit af2d63b

9 files changed

Lines changed: 12 additions & 110 deletions

File tree

README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ agent-device scrollintoview @e42
149149
- `press` (alias: `click`), `focus`, `type`, `fill`, `long-press`, `swipe`, `scroll`, `scrollintoview`, `pinch`, `is`
150150
- `alert`, `wait`, `screenshot`
151151
- `trigger-app-event <event> [payloadJson]`
152-
- `trigger-screenshot-notification` (alias: `trigger-screenshot`)
153-
- `trigger-memory-warning`, `trigger-device-shake`
154152
- `trace start`, `trace stop`
155153
- `logs path`, `logs start`, `logs stop`, `logs clear`, `logs clear --restart`, `logs doctor`, `logs mark` (session app log file for grep; iOS simulator + iOS device + Android)
156154
- `clipboard read`, `clipboard write <text>` (iOS simulator + Android)
@@ -187,18 +185,11 @@ Payload notes:
187185
App event triggers (app hook):
188186

189187
```bash
190-
# Generic app event trigger
191188
agent-device trigger-app-event screenshot_taken '{"source":"qa"}'
192-
193-
# Convenience aliases
194-
agent-device trigger-screenshot-notification
195-
agent-device trigger-screenshot
196-
agent-device trigger-memory-warning
197-
agent-device trigger-device-shake
198189
```
199190

200-
- `trigger-*` commands dispatch an app event via deep link and require an app-side test/debug hook.
201-
- `trigger-*` commands require either an active session or explicit device selectors (`--platform`, `--device`, `--udid`, `--serial`).
191+
- `trigger-app-event` dispatches an app event via deep link and requires an app-side test/debug hook.
192+
- `trigger-app-event` requires either an active session or explicit device selectors (`--platform`, `--device`, `--udid`, `--serial`).
202193
- On iOS physical devices, custom-scheme deep links require active app context (open the app in-session first).
203194
- Configure one of:
204195
- `AGENT_DEVICE_APP_EVENT_URL_TEMPLATE`

skills/agent-device/SKILL.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ agent-device perf --json
142142
agent-device network dump [limit] [summary|headers|body|all]
143143
agent-device push <bundle|package> <payload.json|inline-json>
144144
agent-device trigger-app-event screenshot_taken '{"source":"qa"}'
145-
agent-device trigger-screenshot-notification
146145
agent-device get text @e1
147146
agent-device screenshot out.png
148147
agent-device settings permission grant notifications
@@ -176,8 +175,8 @@ agent-device batch --steps-file /tmp/batch-steps.json --json
176175
- `push` simulates notification delivery:
177176
- iOS simulator uses APNs-style payload JSON.
178177
- Android uses broadcast action + typed extras (string/boolean/number).
179-
- `trigger-app-event` and `trigger-*` aliases require app-defined deep-link hooks and URL template configuration (`AGENT_DEVICE_APP_EVENT_URL_TEMPLATE` or platform-specific variants).
180-
- `trigger-*` commands require an active session or explicit selectors (`--platform`, `--device`, `--udid`, `--serial`); on iOS physical devices, custom-scheme triggers require active app context.
178+
- `trigger-app-event` requires app-defined deep-link hooks and URL template configuration (`AGENT_DEVICE_APP_EVENT_URL_TEMPLATE` or platform-specific variants).
179+
- `trigger-app-event` requires an active session or explicit selectors (`--platform`, `--device`, `--udid`, `--serial`); on iOS physical devices, custom-scheme triggers require active app context.
181180
- Canonical trigger behavior and caveats are documented in [`website/docs/docs/commands.md`](../../website/docs/docs/commands.md) under **App event triggers**.
182181
- Permission settings are app-scoped and require an active session app:
183182
`settings permission <grant|deny|reset> <camera|microphone|photos|contacts|notifications> [full|limited]`

src/core/__tests__/app-events.test.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
11
import test from 'node:test';
22
import assert from 'node:assert/strict';
3-
import { parseTriggerAppEventArgs, normalizeTriggerAliasCommand } from '../app-events.ts';
3+
import { parseTriggerAppEventArgs } from '../app-events.ts';
44
import { AppError } from '../../utils/errors.ts';
55

6-
test('normalizeTriggerAliasCommand maps aliases to trigger-app-event', () => {
7-
const normalized = normalizeTriggerAliasCommand('trigger-screenshot-notification', []);
8-
assert.equal(normalized.command, 'trigger-app-event');
9-
assert.deepEqual(normalized.positionals, ['screenshot_taken']);
10-
});
11-
12-
test('normalizeTriggerAliasCommand rejects alias arguments', () => {
13-
assert.throws(
14-
() => normalizeTriggerAliasCommand('trigger-device-shake', ['extra']),
15-
(error) => error instanceof AppError && error.code === 'INVALID_ARGS',
16-
);
17-
});
18-
196
test('parseTriggerAppEventArgs validates event name format', () => {
207
assert.throws(
218
() => parseTriggerAppEventArgs(['bad event']),

src/core/app-events.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,12 @@
11
import type { DeviceInfo } from '../utils/device.ts';
22
import { AppError } from '../utils/errors.ts';
33

4-
const APP_EVENT_ALIAS_TO_NAME = {
5-
'trigger-screenshot': 'screenshot_taken',
6-
'trigger-screenshot-notification': 'screenshot_taken',
7-
'trigger-memory-warning': 'memory_warning',
8-
'trigger-device-shake': 'device_shake',
9-
} as const;
10-
114
const APP_EVENT_NAME_PATTERN = /^[A-Za-z0-9_.:-]{1,64}$/;
125
const MAX_APP_EVENT_PAYLOAD_BYTES = 8 * 1024;
136
const MAX_APP_EVENT_URL_LENGTH = 4 * 1024;
147

158
type AppEventPayload = Record<string, unknown> | undefined;
169

17-
export function normalizeTriggerAliasCommand(
18-
command: string,
19-
positionals: string[],
20-
): { command: string; positionals: string[] } {
21-
const eventName = APP_EVENT_ALIAS_TO_NAME[command as keyof typeof APP_EVENT_ALIAS_TO_NAME];
22-
if (!eventName) {
23-
return { command, positionals };
24-
}
25-
if (positionals.length > 0) {
26-
throw new AppError('INVALID_ARGS', `${command} does not accept positional arguments`);
27-
}
28-
return { command: 'trigger-app-event', positionals: [eventName] };
29-
}
30-
3110
export function parseTriggerAppEventArgs(positionals: string[]): {
3211
eventName: string;
3312
payload: AppEventPayload;

src/daemon.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import path from 'node:path';
55
import crypto from 'node:crypto';
66
import { dispatchCommand, type CommandFlags } from './core/dispatch.ts';
77
import { isCommandSupportedOnDevice } from './core/capabilities.ts';
8-
import { normalizeTriggerAliasCommand } from './core/app-events.ts';
98
import { asAppError, AppError, normalizeError } from './utils/errors.ts';
109
import { findProjectRoot, readVersion } from './utils/version.ts';
1110
import { abortAllIosRunnerSessions, stopAllIosRunnerSessions } from './platforms/ios/runner-client.ts';
@@ -279,30 +278,10 @@ function finalizeDaemonResponse(response: DaemonResponse): DaemonResponse {
279278
}
280279

281280
function normalizeAliasedCommands(req: DaemonRequest): DaemonRequest {
282-
let normalizedReq = req;
283-
if (normalizedReq.command === 'click') {
284-
normalizedReq = { ...normalizedReq, command: 'press' };
281+
if (req.command === 'click') {
282+
return { ...req, command: 'press' };
285283
}
286-
const normalizedTrigger = normalizeTriggerAliasCommand(
287-
normalizedReq.command,
288-
normalizedReq.positionals ?? [],
289-
);
290-
if (
291-
normalizedTrigger.command !== normalizedReq.command
292-
|| !areSamePositionals(normalizedTrigger.positionals, normalizedReq.positionals ?? [])
293-
) {
294-
normalizedReq = {
295-
...normalizedReq,
296-
command: normalizedTrigger.command,
297-
positionals: normalizedTrigger.positionals,
298-
};
299-
}
300-
return normalizedReq;
301-
}
302-
303-
function areSamePositionals(left: string[], right: string[]): boolean {
304-
if (left.length !== right.length) return false;
305-
return left.every((entry, index) => entry === right[index]);
284+
return req;
306285
}
307286

308287
function writeInfo(ports: { socketPort?: number; httpPort?: number }): void {

src/utils/__tests__/args.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,7 @@ test('settings usage documents canonical faceid states', () => {
485485
assert.doesNotMatch(help, /validate\|unvalidate/);
486486
});
487487

488-
test('trigger-screenshot-notification usage is documented', () => {
488+
test('removed trigger aliases are no longer documented as commands', () => {
489489
const help = usageForCommand('trigger-screenshot-notification');
490-
if (help === null) throw new Error('Expected command help text');
491-
assert.match(help, /Trigger app-defined screenshot notification hook/);
490+
assert.equal(help, null);
492491
});

src/utils/command-schema.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -650,30 +650,6 @@ const COMMAND_SCHEMAS: Record<string, CommandSchema> = {
650650
positionalArgs: ['event', 'payloadJson?'],
651651
allowedFlags: [],
652652
},
653-
'trigger-screenshot': {
654-
description: 'Trigger app-defined screenshot event hook',
655-
positionalArgs: [],
656-
allowedFlags: [],
657-
skipCapabilityCheck: true,
658-
},
659-
'trigger-screenshot-notification': {
660-
description: 'Trigger app-defined screenshot notification hook',
661-
positionalArgs: [],
662-
allowedFlags: [],
663-
skipCapabilityCheck: true,
664-
},
665-
'trigger-memory-warning': {
666-
description: 'Trigger app-defined memory warning event hook',
667-
positionalArgs: [],
668-
allowedFlags: [],
669-
skipCapabilityCheck: true,
670-
},
671-
'trigger-device-shake': {
672-
description: 'Trigger app-defined device shake event hook',
673-
positionalArgs: [],
674-
allowedFlags: [],
675-
skipCapabilityCheck: true,
676-
},
677653
record: {
678654
usageOverride: 'record start [path] [--fps <n>] | record stop',
679655
description: 'Start/stop screen recording',

website/docs/docs/commands.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,11 @@ agent-device push com.example.app '{"action":"com.example.app.PUSH","extras":{"t
176176

177177
```bash
178178
agent-device trigger-app-event screenshot_taken '{"source":"qa"}'
179-
agent-device trigger-screenshot-notification
180-
agent-device trigger-screenshot
181-
agent-device trigger-memory-warning
182-
agent-device trigger-device-shake
183179
```
184180

185181
- `trigger-app-event <event> [payloadJson]` dispatches app-defined events via deep link.
186-
- `trigger-*` commands require either an active session or explicit device selectors (`--platform`, `--device`, `--udid`, `--serial`).
182+
- `trigger-app-event` requires either an active session or explicit device selectors (`--platform`, `--device`, `--udid`, `--serial`).
187183
- On iOS physical devices, custom-scheme deep links require active app context (open app first in the session).
188-
- Convenience aliases:
189-
- `trigger-screenshot-notification` / `trigger-screenshot` -> `screenshot_taken`
190-
- `trigger-memory-warning` -> `memory_warning`
191-
- `trigger-device-shake` -> `device_shake`
192184
- Configure one of:
193185
- `AGENT_DEVICE_APP_EVENT_URL_TEMPLATE`
194186
- `AGENT_DEVICE_IOS_APP_EVENT_URL_TEMPLATE`

website/docs/docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ For exploratory QA and bug-hunting workflows, see `skills/dogfood/SKILL.md` in t
3131
- Physical-device recording requires an active app session context (`open <app>` first).
3232
- Physical-device recording defaults to uncapped (max available) FPS and supports `--fps` caps.
3333
- Android supports the same core interaction set, plus `push` notification simulation and `clipboard read/write` via adb shell commands.
34-
- App-event triggers are available on iOS and Android through app-defined deep-link hooks (`trigger-app-event` and trigger aliases), using active session context or explicit device selectors.
34+
- App-event triggers are available on iOS and Android through app-defined deep-link hooks (`trigger-app-event`), using active session context or explicit device selectors.
3535

3636
## Architecture (high level)
3737

0 commit comments

Comments
 (0)