Skip to content

Tech Debt: Promote cli-runner.js to workspace-level shared utility #12

@WesleyMFrederick

Description

@WesleyMFrederick

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:

  1. Prevents nested Vitest process explosion via cleanup hints
  2. Bypasses Node.js 64KB stdio buffer limits using temp file redirection
  3. 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

  • Create shared/test-utils/ directory structure
  • Move cli-runner.js to shared location
  • Update all imports in citation-manager tests
  • Update imports in validation scripts
  • Add usage documentation in shared/test-utils/README.md
  • Update workspace ARCHITECTURE.md to document shared test utilities
  • Verify all tests pass after migration

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:lowLow priority issuetech-debtTechnical debt that needs addressing

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions