Problem
The cli-runner.js helper currently lives in tools/citation-manager/test/helpers/cli-runner.js and provides critical functionality for safe CLI command execution in test contexts:
- Prevents nested Vitest process explosion via cleanup hints
- Bypasses Node.js 64KB stdio buffer limits using temp file redirection
- Provides consistent error handling for CLI command failures
This helper is currently used by:
- Citation-manager test suite (7 test files)
- TypeScript validation script (Epic 4)
Trigger for Promotion
When we create second workspace tool/package that uses Vitest for testing CLI commands, promote cli-runner.js to workspace-level shared utility.
Proposed Location
workspace-root/
├── shared/
│ └── test-utils/
│ ├── cli-runner.js # Promoted helper
│ └── README.md # Usage documentation
└── tools/
├── citation-manager/
└── <new-tool>/ # Trigger: second tool needing helper
Implementation Checklist
Architecture Principles
✅ DRY: Single source of truth for CLI execution pattern
✅ YAGNI: Only promote when second use case emerges (Rule of Three)
✅ Modular Design: Shared utilities properly scoped at workspace level
Related Documentation
Problem
The
cli-runner.jshelper currently lives intools/citation-manager/test/helpers/cli-runner.jsand provides critical functionality for safe CLI command execution in test contexts:This helper is currently used by:
Trigger for Promotion
When we create second workspace tool/package that uses Vitest for testing CLI commands, promote
cli-runner.jsto workspace-level shared utility.Proposed Location
Implementation Checklist
shared/test-utils/directory structurecli-runner.jsto shared locationArchitecture Principles
✅ DRY: Single source of truth for CLI execution pattern
✅ YAGNI: Only promote when second use case emerges (Rule of Three)
✅ Modular Design: Shared utilities properly scoped at workspace level
Related Documentation