Skip to content

Commit c16a8d5

Browse files
authored
docs: clarify agent-device help entrypoint (#884)
* docs: clarify agent-device help entrypoint * docs: trim duplicated help guidance
1 parent 053bbac commit c16a8d5

2 files changed

Lines changed: 80 additions & 24 deletions

File tree

src/utils/__tests__/args.test.ts

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,10 +1177,35 @@ test('usage includes only global flags in the top-level global flags section', (
11771177

11781178
test('usage includes agent workflows, config, environment, and examples footers', () => {
11791179
const usageText = usage();
1180+
assert.match(
1181+
usageText,
1182+
/CLI to automate supported app, device, desktop, and web targets for AI agents/,
1183+
);
11801184
assert.ok(
11811185
usageText.indexOf('Agent Workflows:') < usageText.indexOf('Commands:'),
11821186
'Agent workflows should appear before the command list for agents that only read the top of help.',
11831187
);
1188+
assert.ok(
1189+
usageText.indexOf('Agent Starting Point:') < usageText.indexOf('Agent Workflows:'),
1190+
'The agent starting point should appear before topic selection.',
1191+
);
1192+
assert.match(usageText, /Agent Starting Point:/);
1193+
assert.match(
1194+
usageText,
1195+
/agent-device is the default automation surface for app\/device workflows across supported targets/,
1196+
);
1197+
assert.match(
1198+
usageText,
1199+
/Default to agent-device for installs, opens, snapshots, interactions, screenshots, logs, network\/perf evidence, and verification/,
1200+
);
1201+
assert.match(
1202+
usageText,
1203+
/Use raw adb, simctl, xcrun, or platform scripts only when this help calls out a tool gap or platform setup step/,
1204+
);
1205+
assert.match(
1206+
usageText,
1207+
/Start with agent-device help workflow to understand the core loop and how to use the tool/,
1208+
);
11841209
assert.match(usageText, /Agent Quickstart:/);
11851210
assert.match(usageText, /Default loop: devices\/apps -> open -> snapshot -i/);
11861211
assert.match(usageText, /Use selectors or refs as positional targets/);
@@ -1225,21 +1250,30 @@ test('usage includes agent workflows, config, environment, and examples footers'
12251250
assert.match(usageText, /Full operating guide: agent-device help workflow/);
12261251
assert.match(usageText, /Exploratory QA: agent-device help dogfood/);
12271252
assert.match(usageText, /Agent Workflows:/);
1228-
assert.match(usageText, /help workflow\s+Normal bootstrap, exploration, and validation loop/);
1229-
assert.match(usageText, /help debugging\s+Logs, network, perf memory, and traces/);
12301253
assert.match(
12311254
usageText,
1232-
/help react-devtools\s+React Native performance, profiling, component tree, and renders/,
1255+
/agent-device help workflow\s+Start here for the core loop, command shape, refs\/selectors, and verification/,
1256+
);
1257+
assert.match(
1258+
usageText,
1259+
/agent-device help debugging\s+Use when logs, network, perf memory, traces, alerts, or diagnostics matter/,
1260+
);
1261+
assert.match(
1262+
usageText,
1263+
/agent-device help react-devtools\s+Use when inspecting components, props\/state\/hooks, renders, or profiles/,
1264+
);
1265+
assert.match(
1266+
usageText,
1267+
/agent-device help physical-device\s+Use when using a connected phone\/tablet or iOS signing setup/,
12331268
);
12341269
assert.match(
12351270
usageText,
1236-
/help physical-device\s+Connected phone\/tablet setup and iOS signing prerequisites/,
1271+
/agent-device help react-native\s+Use when the target app is React Native, Expo, or a dev client/,
12371272
);
12381273
assert.match(
12391274
usageText,
1240-
/help react-native\s+React Native app automation hazards, overlays, Metro, and routing/,
1275+
/agent-device help web\s+Use when automating a browser through agent-device sessions/,
12411276
);
1242-
assert.match(usageText, /help web\s+Minimal browser sessions through agent-browser/);
12431277
assert.match(usageText, /Configuration:/);
12441278
assert.match(
12451279
usageText,
@@ -1663,6 +1697,7 @@ test('usageForCommand resolves react-native help topic', () => {
16631697
assert.match(help, /help debugging/);
16641698
assert.match(help, /help react-devtools/);
16651699
assert.match(help, /Help workflow owns the full Expo URL command shapes/);
1700+
assert.match(help, /For app\/package launches, run metro prepare/);
16661701
assert.match(help, /same host context that owns Metro/);
16671702
assert.match(help, /sandbox probe is not authoritative/);
16681703
assert.match(help, /adb reverse only affects Android device-to-host traffic/);

src/utils/cli-help.ts

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,50 @@ import {
1010
} from './command-schema.ts';
1111

1212
const AGENT_WORKFLOWS = [
13-
{ label: 'help workflow', description: 'Normal bootstrap, exploration, and validation loop' },
14-
{ label: 'help debugging', description: 'Logs, network, perf memory, and traces' },
1513
{
16-
label: 'help react-native',
17-
description: 'React Native app automation hazards, overlays, Metro, and routing',
14+
label: 'agent-device help workflow',
15+
description: 'Start here for the core loop, command shape, refs/selectors, and verification',
1816
},
1917
{
20-
label: 'help react-devtools',
21-
description: 'React Native performance, profiling, component tree, and renders',
18+
label: 'agent-device help debugging',
19+
description: 'Use when logs, network, perf memory, traces, alerts, or diagnostics matter',
2220
},
2321
{
24-
label: 'help cdp',
25-
description: 'React Native CDP targets, JS heap snapshots, and leak triage',
22+
label: 'agent-device help react-native',
23+
description: 'Use when the target app is React Native, Expo, or a dev client',
2624
},
2725
{
28-
label: 'help physical-device',
29-
description: 'Connected phone/tablet setup and iOS signing prerequisites',
26+
label: 'agent-device help react-devtools',
27+
description: 'Use when inspecting components, props/state/hooks, renders, or profiles',
3028
},
3129
{
32-
label: 'help remote',
33-
description: 'Remote/cloud config, tenants, leases, and local service tunnels',
30+
label: 'agent-device help cdp',
31+
description: 'Use when investigating JS heap growth, heap snapshots, or retainers',
3432
},
35-
{ label: 'help web', description: 'Minimal browser sessions through agent-browser' },
36-
{ label: 'help macos', description: 'Desktop, frontmost-app, and menu bar surfaces' },
37-
{ label: 'help dogfood', description: 'Exploratory QA report workflow' },
33+
{
34+
label: 'agent-device help physical-device',
35+
description: 'Use when using a connected phone/tablet or iOS signing setup',
36+
},
37+
{
38+
label: 'agent-device help remote',
39+
description: 'Use when working through cloud config, tenants, leases, or local tunnels',
40+
},
41+
{
42+
label: 'agent-device help web',
43+
description: 'Use when automating a browser through agent-device sessions',
44+
},
45+
{
46+
label: 'agent-device help macos',
47+
description: 'Use when targeting desktop, frontmost app, or menu bar surfaces',
48+
},
49+
{ label: 'agent-device help dogfood', description: 'Use when producing exploratory QA evidence' },
50+
] as const;
51+
52+
const AGENT_START_LINES = [
53+
'agent-device is the default automation surface for app/device workflows across supported targets.',
54+
'Default to agent-device for installs, opens, snapshots, interactions, screenshots, logs, network/perf evidence, and verification.',
55+
'Use raw adb, simctl, xcrun, or platform scripts only when this help calls out a tool gap or platform setup step.',
56+
'Start with agent-device help workflow to understand the core loop and how to use the tool.',
3857
] as const;
3958

4059
const AGENT_QUICKSTART_LINES = [
@@ -69,7 +88,6 @@ const AGENT_QUICKSTART_LINES = [
6988
'Web browser sessions: read help web; first slice is web setup if needed -> web doctor -> open <url> --platform web -> snapshot -i -> click/fill/get/is/find/wait/screenshot -> close.',
7089
'Verification commands must name the expected text/selector; bare screenshots/snapshots are not enough.',
7190
'Debug evidence: Session state contains request diagnostics and runner.log; use logs clear --restart/mark/path, trace, and network dump --include headers for app evidence.',
72-
'Use agent-device commands in final plans; raw platform tools, pseudo commands, and helper prose are wrong.',
7391
'Full operating guide: agent-device help workflow. Exploratory QA: agent-device help dogfood.',
7492
] as const;
7593

@@ -536,7 +554,7 @@ React Native dev loop:
536554
agent-device metro reload
537555
agent-device find "Home"
538556
Do not use agent-device reload. Use open --relaunch for native startup reset.
539-
Android RN/Expo Metro: direct Android localhost URL opens with a port auto-configure host reachability. For app/package launches, use help react-native if the app cannot reach local Metro.
557+
Android RN/Expo Metro: direct Android localhost URL opens with a port auto-configure host reachability. For app/package launches, run metro prepare when the app cannot reach local Metro.
540558
Verify Metro from the same host context that owns Metro. If a sandboxed shell cannot curl localhost:8081/status but an unrestricted host shell can, Metro is running and the sandbox probe is not authoritative.
541559
adb reverse only affects Android device-to-host traffic. It does not prove host-to-Metro reachability, and it does not fix a redbox caused by a stale or wrong Metro/app state.
542560
Multiple local worktrees can reuse one native iOS simulator build by running each worktree's Metro on a different port and opening the same installed app on different simulators with explicit runtime hints:
@@ -863,7 +881,7 @@ function buildCommandListUsage(commandName: string, schema: CommandSchema): stri
863881
function renderUsageText(): string {
864882
const header = `agent-device <command> [args] [--json]
865883
866-
CLI to control iOS and Android devices for AI agents.
884+
CLI to automate supported app, device, desktop, and web targets for AI agents.
867885
`;
868886

869887
const commands = listCliCommandNames().map((name) => {
@@ -878,13 +896,16 @@ CLI to control iOS and Android devices for AI agents.
878896

879897
const helpFlags = listHelpFlags(GLOBAL_FLAG_KEYS);
880898
const flagsSection = renderFlagSection('Global Flags:', helpFlags);
899+
const startSection = renderTextSection('Agent Starting Point:', AGENT_START_LINES);
881900
const quickstartSection = renderTextSection('Agent Quickstart:', AGENT_QUICKSTART_LINES);
882901
const workflowsSection = renderAlignedSection('Agent Workflows:', AGENT_WORKFLOWS);
883902
const configSection = renderTextSection('Configuration:', CONFIGURATION_LINES);
884903
const environmentSection = renderAlignedSection('Environment:', ENVIRONMENT_LINES);
885904
const examplesSection = renderTextSection('Examples:', EXAMPLE_LINES);
886905

887906
return `${header}
907+
${startSection}
908+
888909
${workflowsSection}
889910
890911
${commandLines}

0 commit comments

Comments
 (0)