Cli mock stdin
Skill a5c-ai/babysitter/library/specializations/cli-mcp-development/skills/cli-mock-stdin
Create mock stdin utilities for interactive CLI testing.From its SKILL.md
npx -y skills add a5c-ai/babysitter --skill cli-mock-stdinAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
1.3 KB, 204 tokens by cl100k_base, as published. Nobody here has run it
CLI Mock Stdin
Create mock stdin utilities for testing.
Generated Patterns
import { Readable } from 'stream';
export function mockStdin(inputs: string[]): Readable {
let index = 0;
return new Readable({
read() {
if (index < inputs.length) {
setTimeout(() => {
this.push(inputs[index++] + '\n');
}, 10);
} else {
this.push(null);
}
},
});
}
export async function runWithStdin(
cmd: () => Promise<void>,
inputs: string[]
): Promise<void> {
const originalStdin = process.stdin;
Object.defineProperty(process, 'stdin', { value: mockStdin(inputs) });
try {
await cmd();
} finally {
Object.defineProperty(process, 'stdin', { value: originalStdin });
}
}
Target Processes
- cli-unit-integration-testing
- interactive-prompt-system
What ships with it: 1 file
155 B alongside SKILL.md
- README.md155 B