Skip to content

Commit cbc8047

Browse files
committed
chore: remove batch stdin source and related docs
1 parent 6106db5 commit cbc8047

9 files changed

Lines changed: 7 additions & 92 deletions

File tree

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,6 @@ agent-device batch \
6060
--json
6161
```
6262

63-
```bash
64-
cat /tmp/batch-steps.json | agent-device batch \
65-
--session sim \
66-
--platform ios \
67-
--udid 00008150-001849640CF8401C \
68-
--steps-stdin \
69-
--json
70-
```
71-
7263
Small inline payloads are also supported:
7364

7465
```bash
@@ -97,7 +88,7 @@ Agent usage guidelines:
9788
- Keep each batch to one screen-local workflow.
9889
- Add sync guards (`wait`, `is exists`) after mutating steps (`open`, `click`, `fill`, `swipe`).
9990
- Treat refs/snapshot assumptions as stale after UI mutations.
100-
- Prefer `--steps-file` or `--steps-stdin` over inline JSON for reliability.
91+
- Prefer `--steps-file` over inline JSON for reliability.
10192
- Keep batches moderate (about 5-20 steps) and stop on first error.
10293

10394
## CLI Usage
@@ -172,7 +163,6 @@ Flags:
172163
- `--json` for structured output
173164
- `--steps <json>` batch: JSON array of steps
174165
- `--steps-file <path>` batch: read step JSON from file
175-
- `--steps-stdin` batch: read step JSON from stdin
176166
- `--on-error stop` batch: stop when a step fails
177167
- `--max-steps <n>` batch: max allowed steps per request
178168

skills/agent-device/SKILL.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,6 @@ agent-device batch \
168168
--json
169169
```
170170

171-
```bash
172-
cat /tmp/batch-steps.json | agent-device batch \
173-
--session sim \
174-
--platform ios \
175-
--udid 00008150-001849640CF8401C \
176-
--steps-stdin \
177-
--json
178-
```
179-
180171
Inline JSON works for small payloads:
181172

182173
```bash
@@ -199,7 +190,7 @@ Batch best practices for agents:
199190
- Batch one screen-local flow at a time.
200191
- Add sync guards (`wait`, `is exists`) after mutating steps (`open`, `click`, `fill`, `swipe`).
201192
- Treat prior refs/snapshot assumptions as stale after UI mutations.
202-
- Prefer `--steps-file` or `--steps-stdin` over inline JSON.
193+
- Prefer `--steps-file` over inline JSON.
203194
- Keep batches moderate (about 5-20 steps).
204195
- Use failure context (`step`, `partialResults`) to replan from the failed step.
205196

skills/agent-device/references/batching-for-agents.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ From file:
2020
agent-device batch --session sim --platform ios --steps-file /tmp/batch-steps.json --json
2121
```
2222

23-
From stdin:
24-
25-
```bash
26-
cat /tmp/batch-steps.json | agent-device batch --session sim --platform ios --steps-stdin --json
27-
```
28-
2923
Inline (small payloads only):
3024

3125
```bash

src/__tests__/cli-batch.test.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ type RunResult = {
2424

2525
async function runCliCapture(
2626
argv: string[],
27-
options: { forceStdinTty?: boolean } = {},
2827
): Promise<RunResult> {
2928
let stdout = '';
3029
let stderr = '';
@@ -34,7 +33,6 @@ async function runCliCapture(
3433
const originalExit = process.exit;
3534
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
3635
const originalStderrWrite = process.stderr.write.bind(process.stderr);
37-
const stdinDescriptor = Object.getOwnPropertyDescriptor(process.stdin, 'isTTY');
3836

3937
(process as any).exit = ((nextCode?: number) => {
4038
throw new ExitSignal(nextCode ?? 0);
@@ -47,12 +45,6 @@ async function runCliCapture(
4745
stderr += String(chunk);
4846
return true;
4947
}) as typeof process.stderr.write;
50-
if (options.forceStdinTty !== undefined) {
51-
Object.defineProperty(process.stdin, 'isTTY', {
52-
configurable: true,
53-
value: options.forceStdinTty,
54-
});
55-
}
5648

5749
const sendToDaemon = async (req: Omit<DaemonRequest, 'token'>): Promise<DaemonResponse> => {
5850
calls.push(req);
@@ -68,13 +60,6 @@ async function runCliCapture(
6860
process.exit = originalExit;
6961
process.stdout.write = originalStdoutWrite;
7062
process.stderr.write = originalStderrWrite;
71-
if (options.forceStdinTty !== undefined) {
72-
if (stdinDescriptor) {
73-
Object.defineProperty(process.stdin, 'isTTY', stdinDescriptor);
74-
} else {
75-
delete (process.stdin as any).isTTY;
76-
}
77-
}
7863
}
7964

8065
return { code, stdout, stderr, calls };
@@ -113,10 +98,3 @@ test('batch --steps-file parses file payload', async () => {
11398
assert.equal(req.command, 'batch');
11499
assert.equal((req.flags?.batchSteps ?? [])[0]?.command, 'wait');
115100
});
116-
117-
test('batch --steps-stdin fails fast when stdin is TTY', async () => {
118-
const result = await runCliCapture(['batch', '--steps-stdin'], { forceStdinTty: true });
119-
assert.equal(result.code, 1);
120-
assert.equal(result.calls.length, 0);
121-
assert.match(result.stderr, /--steps-stdin requires piped JSON input/);
122-
});

src/cli.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ export async function runCli(argv: string[], deps: CliDeps = DEFAULT_CLI_DEPS):
6868
const batchFlags = { ...daemonFlags, batchSteps };
6969
delete (batchFlags as Record<string, unknown>).steps;
7070
delete (batchFlags as Record<string, unknown>).stepsFile;
71-
delete (batchFlags as Record<string, unknown>).stepsStdin;
7271

7372
const response = await deps.sendToDaemon({
7473
session: sessionName,
@@ -296,14 +295,6 @@ async function readBatchSteps(flags: ReturnType<typeof parseArgs>['flags']): Pro
296295
raw = flags.steps;
297296
} else if (flags.stepsFile) {
298297
raw = fs.readFileSync(flags.stepsFile, 'utf8');
299-
} else if (flags.stepsStdin) {
300-
if (process.stdin.isTTY) {
301-
throw new AppError(
302-
'INVALID_ARGS',
303-
'batch --steps-stdin requires piped JSON input on stdin.',
304-
);
305-
}
306-
raw = await readStdin();
307298
}
308299
let parsed: unknown;
309300
try {
@@ -340,14 +331,6 @@ async function readBatchSteps(flags: ReturnType<typeof parseArgs>['flags']): Pro
340331
return steps;
341332
}
342333

343-
async function readStdin(): Promise<string> {
344-
const chunks: Buffer[] = [];
345-
for await (const chunk of process.stdin) {
346-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
347-
}
348-
return Buffer.concat(chunks).toString('utf8');
349-
}
350-
351334
function isDaemonStartupFailure(error: AppError): boolean {
352335
if (error.code !== 'COMMAND_FAILED') return false;
353336
if (error.details?.kind === 'daemon_startup_failed') return true;

src/utils/args.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,11 @@ export function parseArgs(argv: string[], options?: ParseArgsOptions): ParsedArg
9999
if (command === 'batch') {
100100
const stepSourceCount =
101101
(flags.steps ? 1 : 0) +
102-
(flags.stepsFile ? 1 : 0) +
103-
(flags.stepsStdin ? 1 : 0);
102+
(flags.stepsFile ? 1 : 0);
104103
if (stepSourceCount !== 1) {
105104
throw new AppError(
106105
'INVALID_ARGS',
107-
'batch requires exactly one step source: --steps, --steps-file, or --steps-stdin.',
106+
'batch requires exactly one step source: --steps or --steps-file.',
108107
);
109108
}
110109
}

src/utils/command-schema.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export type CliFlags = {
2626
replayUpdate?: boolean;
2727
steps?: string;
2828
stepsFile?: string;
29-
stepsStdin?: boolean;
3029
batchOnError?: 'stop';
3130
batchMaxSteps?: number;
3231
batchSteps?: Array<{
@@ -246,13 +245,6 @@ export const FLAG_DEFINITIONS: readonly FlagDefinition[] = [
246245
usageLabel: '--steps-file <path>',
247246
usageDescription: 'Batch: read steps JSON from file',
248247
},
249-
{
250-
key: 'stepsStdin',
251-
names: ['--steps-stdin'],
252-
type: 'boolean',
253-
usageLabel: '--steps-stdin',
254-
usageDescription: 'Batch: read steps JSON from stdin',
255-
},
256248
{
257249
key: 'batchOnError',
258250
names: ['--on-error'],
@@ -435,10 +427,10 @@ export const COMMAND_SCHEMAS: Record<string, CommandSchema> = {
435427
skipCapabilityCheck: true,
436428
},
437429
batch: {
438-
usageOverride: 'batch [--steps <json> | --steps-file <path> | --steps-stdin]',
430+
usageOverride: 'batch [--steps <json> | --steps-file <path>]',
439431
description: 'Execute multiple commands in one daemon request',
440432
positionalArgs: [],
441-
allowedFlags: ['steps', 'stepsFile', 'stepsStdin', 'batchOnError', 'batchMaxSteps', 'out'],
433+
allowedFlags: ['steps', 'stepsFile', 'batchOnError', 'batchMaxSteps', 'out'],
442434
skipCapabilityCheck: true,
443435
},
444436
press: {

website/docs/docs/batching.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@ agent-device batch \
2121
--json
2222
```
2323

24-
From stdin:
25-
26-
```bash
27-
cat /tmp/batch-steps.json | agent-device batch \
28-
--session sim \
29-
--platform ios \
30-
--udid 00008150-001849640CF8401C \
31-
--steps-stdin \
32-
--json
33-
```
34-
3524
Inline for small payloads:
3625

3726
```bash
@@ -107,7 +96,7 @@ Failure:
10796
- Batch only one related screen flow at a time.
10897
- After mutating steps (`open`, `click`, `fill`, `swipe`), add a sync guard (`wait`, `is exists`) before critical reads.
10998
- Treat prior refs/snapshots as stale after UI changes.
110-
- Prefer `--steps-file` or `--steps-stdin` over inline JSON.
99+
- Prefer `--steps-file` over inline JSON.
111100
- Keep batches moderate (about 5-20 steps).
112101
- Replan from the failing step using `details.step` and `details.partialResults`.
113102

website/docs/docs/commands.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ See [Replay & E2E (Experimental)](/docs/replay-e2e) for recording and CI workflo
9292

9393
```bash
9494
agent-device batch --steps-file /tmp/batch-steps.json --json
95-
agent-device batch --steps-stdin --json
9695
agent-device batch --steps '[{"command":"open","positionals":["settings"]}]'
9796
```
9897

0 commit comments

Comments
 (0)