Skip to content

Commit 521e0f0

Browse files
committed
refactor(help): colocate fold guidance and extract workflows
1 parent 8c0edab commit 521e0f0

5 files changed

Lines changed: 441 additions & 413 deletions

File tree

‎src/commands/schema/cli-help-topics.test.ts‎

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -392,52 +392,6 @@ test('usageForCommand resolves web help topic', async () => {
392392
assert.match(help, /Do not use native mobile or desktop setup commands/);
393393
});
394394

395-
test('usageForCommand resolves debugging help topic', async () => {
396-
const help = await usageForCommand('debugging');
397-
if (help === null) throw new Error('Expected debugging help text');
398-
assert.match(help, /^agent-device \S+ — debugging/);
399-
assert.match(help, /Use logs when you need the lead-up timeline/);
400-
assert.match(help, /relaunches the session app through devicectl process launch --console/);
401-
assert.match(help, /Use debug symbols when you have crash\.ips\/crash\.log/);
402-
assert.match(help, /Use Xcode\/LLDB when you need live state/);
403-
assert.match(help, /debug symbols --artifact crash\.ips --search-path \.\/build/);
404-
assert.match(help, /Android Java\/R8 mapping\.txt and native ndk-stack\/addr2line/);
405-
assert.match(help, /network\/audio evidence/);
406-
assert.match(help, /agent-device alert wait 3000/);
407-
assert.match(help, /iOS support is runner-derived/);
408-
assert.match(help, /resolved app executable/);
409-
assert.match(help, /--launch-console is only for direct iOS simulator app launches/);
410-
assert.match(help, /runnerLogPath and requestLogPath/);
411-
assert.match(
412-
help,
413-
/AGENT_DEVICE_EXEC_TRACE=1 when you need host-tool spawn timing without full debug streaming/,
414-
);
415-
assert.match(help, /open --debug --json/);
416-
assert.match(help, /open_timing event/);
417-
assert.match(help, /requests\/<request-id>\.ndjson holds daemon request diagnostics/);
418-
assert.match(help, /daemon\.log is global daemon lifecycle evidence/);
419-
assert.match(help, /agent-device perf memory sample --json/);
420-
assert.match(help, /agent-device audio probe start 10 1000 --platform web/);
421-
assert.match(help, /agent-device audio probe start 10 1000 --platform macos/);
422-
assert.match(help, /agent-device audio probe start 10 1000 --platform ios/);
423-
assert.match(help, /agent-device audio probe start 10 1000 --platform android/);
424-
assert.match(help, /compact rmsDbfs and peakDbfs arrays/);
425-
assert.match(help, /requires Screen Recording permission/);
426-
assert.match(help, /Physical iOS and Android devices are not supported/);
427-
assert.match(help, /Memory artifact \(android-hprof\): \/tmp\/app\.hprof \(42MB\)/);
428-
assert.match(help, /Prefer perf memory sample over raw dumpsys\/leaks output/);
429-
assert.match(help, /Unsupported platforms return artifact\.available=false with reason\/hint/);
430-
assert.match(help, /Do not use settings permission to answer a dialog already on screen/);
431-
assert.match(help, /Treat native perf output as the agent evidence/);
432-
assert.match(help, /sizeBytes=5392410/);
433-
assert.match(help, /5\.3 MB raw trace stays in the artifact/);
434-
assert.match(help, /iOS Allow Paste cannot be exercised under XCUITest/);
435-
assert.match(help, /prefill with clipboard write "some text"/);
436-
assert.match(help, /Android Gboard handwriting\/stylus UI can capture text/);
437-
assert.match(help, /targetInput\/actualInput details/);
438-
assert.match(help, /Do not keep retrying fill\/type against the same field/);
439-
});
440-
441395
test('usageForCommand resolves remote help topic', async () => {
442396
const help = await usageForCommand('remote');
443397
if (help === null) throw new Error('Expected remote help text');
@@ -544,43 +498,6 @@ test('usageForCommand resolves ios-system-ui help topic', async () => {
544498
assert.match(help, /Reopen the app bundle under test/);
545499
});
546500

547-
test('usageForCommand resolves manual QA help topic', async () => {
548-
const help = await usageForCommand('manual-qa');
549-
if (help === null) throw new Error('Expected manual QA help text');
550-
assert.match(help, /^agent-device \S+ — manual-qa/);
551-
assert.match(help, /Execute the script/);
552-
assert.match(help, /Run snapshot -i to get current refs/);
553-
assert.match(help, /press\/fill\/click\/longpress <ref-or-selector> --settle/);
554-
assert.match(help, /A bare screenshot\/snapshot is not verification/);
555-
assert.match(help, /use fill <target> <text> --settle to replace/);
556-
assert.match(help, /use type only to append to an already-focused field/);
557-
assert.match(help, /label="Email" editable=true/);
558-
assert.match(help, /press 'label="Follow"' --settle/);
559-
assert.match(help, /Do not use placeholders such as @ref/);
560-
assert.match(help, /wait text\/selector\/absent/);
561-
assert.match(help, /wait absent 'label="Loading\.\.\."' 3000/);
562-
assert.match(help, /wait_target_absent: a readable capture ran and found no match/);
563-
assert.match(help, /wait_target_present: wait absent timed out with matches/);
564-
assert.match(help, /wait_capture_stalled: no readable capture finished before the deadline/);
565-
});
566-
567-
test('usageForCommand resolves validate help topic', async () => {
568-
const help = await usageForCommand('validate');
569-
if (help === null) throw new Error('Expected validate help text');
570-
assert.match(help, /^agent-device \S+ — validate/);
571-
assert.match(help, /validating a code change/);
572-
assert.match(help, /Required freshness gate before device verification/);
573-
assert.match(help, /For a TypeScript runtime or CLI output change, start with pnpm build/);
574-
assert.match(help, /For non-Android device verification, run pnpm clean:daemon next/);
575-
assert.match(help, /run pnpm build:android before pnpm clean:daemon/);
576-
assert.match(help, /pnpm build:xcuitest/);
577-
assert.match(help, /Do not build the Apple runner for TypeScript-only changes/);
578-
assert.match(help, /Use the settled diff as evidence/);
579-
assert.match(help, /Close sessions and release leases/);
580-
assert.match(help, /exact key that includes the agent-device package and Xcode version/);
581-
assert.match(help, /Runner reuse is authorized only by the cache metadata's content manifest/);
582-
});
583-
584501
test('usageForCommand resolves macos help topic', async () => {
585502
const help = await usageForCommand('macos');
586503
if (help === null) throw new Error('Expected macos help text');
@@ -589,28 +506,6 @@ test('usageForCommand resolves macos help topic', async () => {
589506
assert.match(help, /menu-item refs/);
590507
});
591508

592-
test('usageForCommand resolves dogfood help topic', async () => {
593-
const help = await usageForCommand('dogfood');
594-
if (help === null) throw new Error('Expected dogfood help text');
595-
assert.match(help, /^agent-device \S+ — dogfood/);
596-
assert.match(help, /Find user-visible issues from runtime behavior/);
597-
assert.match(help, /Severity: critical blocks a core flow\/data\/crashes/);
598-
assert.match(help, /Interactive\/behavioral issues need step screenshots/);
599-
assert.match(help, /Static\/on-load issues can use one screenshot/);
600-
assert.match(help, /React Native warning\/error overlays can be real findings/);
601-
assert.match(help, /Expo Go\/dev-client shells/);
602-
assert.match(help, /direct Android localhost URL opens with a port auto-configure/);
603-
assert.match(help, /Keep stateful commands serial within the same session/);
604-
assert.match(help, /agent-device wait 'role=tab' 10000/);
605-
assert.match(help, /scroll takes a selector-less direction\+amount form/);
606-
assert.match(help, /Use --settle to wait for the UI to go quiet/);
607-
assert.match(help, /prefer agent-device open "Expo Go" <url>/);
608-
assert.match(help, /dogfood-output\/report\.md/);
609-
assert.match(help, /ID, severity, category, title, affected flow\/screen/);
610-
assert.match(help, /Never delete screenshots, videos, traces, or report artifacts/);
611-
assert.match(help, /screenshot \.\/dogfood-output\/screenshots\/issue-001\.png --overlay-refs/);
612-
});
613-
614509
test('usageForCommand resolves react-devtools help topic', async () => {
615510
const help = await usageForCommand('react-devtools');
616511
if (help === null) throw new Error('Expected react-devtools help text');
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import assert from 'node:assert/strict';
2+
import { test } from 'vitest';
3+
import { usageForCommand } from '../../cli/parser/args.ts';
4+
5+
test('usageForCommand resolves debugging help topic', async () => {
6+
const help = await usageForCommand('debugging');
7+
if (help === null) throw new Error('Expected debugging help text');
8+
assert.match(help, /^agent-device \S+ — debugging/);
9+
assert.match(help, /Use logs when you need the lead-up timeline/);
10+
assert.match(help, /relaunches the session app through devicectl process launch --console/);
11+
assert.match(help, /Use debug symbols when you have crash\.ips\/crash\.log/);
12+
assert.match(help, /Use Xcode\/LLDB when you need live state/);
13+
assert.match(help, /debug symbols --artifact crash\.ips --search-path \.\/build/);
14+
assert.match(help, /Android Java\/R8 mapping\.txt and native ndk-stack\/addr2line/);
15+
assert.match(help, /network\/audio evidence/);
16+
assert.match(help, /agent-device alert wait 3000/);
17+
assert.match(help, /iOS support is runner-derived/);
18+
assert.match(help, /resolved app executable/);
19+
assert.match(help, /--launch-console is only for direct iOS simulator app launches/);
20+
assert.match(help, /runnerLogPath and requestLogPath/);
21+
assert.match(
22+
help,
23+
/AGENT_DEVICE_EXEC_TRACE=1 when you need host-tool spawn timing without full debug streaming/,
24+
);
25+
assert.match(help, /open --debug --json/);
26+
assert.match(help, /open_timing event/);
27+
assert.match(help, /requests\/<request-id>\.ndjson holds daemon request diagnostics/);
28+
assert.match(help, /daemon\.log is global daemon lifecycle evidence/);
29+
assert.match(help, /agent-device perf memory sample --json/);
30+
assert.match(help, /agent-device audio probe start 10 1000 --platform web/);
31+
assert.match(help, /agent-device audio probe start 10 1000 --platform macos/);
32+
assert.match(help, /agent-device audio probe start 10 1000 --platform ios/);
33+
assert.match(help, /agent-device audio probe start 10 1000 --platform android/);
34+
assert.match(help, /compact rmsDbfs and peakDbfs arrays/);
35+
assert.match(help, /requires Screen Recording permission/);
36+
assert.match(help, /Physical iOS and Android devices are not supported/);
37+
assert.match(help, /Memory artifact \(android-hprof\): \/tmp\/app\.hprof \(42MB\)/);
38+
assert.match(help, /Prefer perf memory sample over raw dumpsys\/leaks output/);
39+
assert.match(help, /Unsupported platforms return artifact\.available=false with reason\/hint/);
40+
assert.match(help, /Do not use settings permission to answer a dialog already on screen/);
41+
assert.match(help, /Treat native perf output as the agent evidence/);
42+
assert.match(help, /sizeBytes=5392410/);
43+
assert.match(help, /5\.3 MB raw trace stays in the artifact/);
44+
assert.match(help, /iOS Allow Paste cannot be exercised under XCUITest/);
45+
assert.match(help, /prefill with clipboard write "some text"/);
46+
assert.match(help, /Android Gboard handwriting\/stylus UI can capture text/);
47+
assert.match(help, /targetInput\/actualInput details/);
48+
assert.match(help, /Do not keep retrying fill\/type against the same field/);
49+
});
50+
51+
test('usageForCommand resolves manual QA help topic', async () => {
52+
const help = await usageForCommand('manual-qa');
53+
if (help === null) throw new Error('Expected manual QA help text');
54+
assert.match(help, /^agent-device \S+ — manual-qa/);
55+
assert.match(help, /Execute the script/);
56+
assert.match(help, /Run snapshot -i to get current refs/);
57+
assert.match(help, /press\/fill\/click\/longpress <ref-or-selector> --settle/);
58+
assert.match(help, /A bare screenshot\/snapshot is not verification/);
59+
assert.match(help, /use fill <target> <text> --settle to replace/);
60+
assert.match(help, /use type only to append to an already-focused field/);
61+
assert.match(help, /label="Email" editable=true/);
62+
assert.match(help, /press 'label="Follow"' --settle/);
63+
assert.match(help, /Do not use placeholders such as @ref/);
64+
assert.match(help, /wait text\/selector\/absent/);
65+
assert.match(help, /wait absent 'label="Loading\.\.\."' 3000/);
66+
assert.match(help, /wait_target_absent: a readable capture ran and found no match/);
67+
assert.match(help, /wait_target_present: wait absent timed out with matches/);
68+
assert.match(help, /wait_capture_stalled: no readable capture finished before the deadline/);
69+
});
70+
71+
test('usageForCommand resolves validate help topic', async () => {
72+
const help = await usageForCommand('validate');
73+
if (help === null) throw new Error('Expected validate help text');
74+
assert.match(help, /^agent-device \S+ — validate/);
75+
assert.match(help, /validating a code change/);
76+
assert.match(help, /Required freshness gate before device verification/);
77+
assert.match(help, /For a TypeScript runtime or CLI output change, start with pnpm build/);
78+
assert.match(help, /For non-Android device verification, run pnpm clean:daemon next/);
79+
assert.match(help, /run pnpm build:android before pnpm clean:daemon/);
80+
assert.match(help, /pnpm build:xcuitest/);
81+
assert.match(help, /Do not build the Apple runner for TypeScript-only changes/);
82+
assert.match(help, /Use the settled diff as evidence/);
83+
assert.match(help, /Close sessions and release leases/);
84+
assert.match(help, /exact key that includes the agent-device package and Xcode version/);
85+
assert.match(help, /Runner reuse is authorized only by the cache metadata's content manifest/);
86+
});
87+
88+
test('usageForCommand resolves dogfood help topic', async () => {
89+
const help = await usageForCommand('dogfood');
90+
if (help === null) throw new Error('Expected dogfood help text');
91+
assert.match(help, /^agent-device \S+ — dogfood/);
92+
assert.match(help, /Find user-visible issues from runtime behavior/);
93+
assert.match(help, /Severity: critical blocks a core flow\/data\/crashes/);
94+
assert.match(help, /Interactive\/behavioral issues need step screenshots/);
95+
assert.match(help, /Static\/on-load issues can use one screenshot/);
96+
assert.match(help, /React Native warning\/error overlays can be real findings/);
97+
assert.match(help, /Expo Go\/dev-client shells/);
98+
assert.match(help, /direct Android localhost URL opens with a port auto-configure/);
99+
assert.match(help, /Keep stateful commands serial within the same session/);
100+
assert.match(help, /agent-device wait 'role=tab' 10000/);
101+
assert.match(help, /scroll takes a selector-less direction\+amount form/);
102+
assert.match(help, /Use --settle to wait for the UI to go quiet/);
103+
assert.match(help, /prefer agent-device open "Expo Go" <url>/);
104+
assert.match(help, /dogfood-output\/report\.md/);
105+
assert.match(help, /ID, severity, category, title, affected flow\/screen/);
106+
assert.match(help, /Never delete screenshots, videos, traces, or report artifacts/);
107+
assert.match(help, /screenshot \.\/dogfood-output\/screenshots\/issue-001\.png --overlay-refs/);
108+
});

0 commit comments

Comments
 (0)