@cosmah/flowspec-cli
v1.0.2
Published
FlowSpec CLI - Autonomous React test generation
Downloads
150
Maintainers
Readme
FlowSpec CLI
Autonomous React test generation powered by AI.
Installation
# Install globally
npm install -g @cosmah/flowspec-cliQuick Start
# 1. Create account
flowspec register
# or
flowspec signup
# 2. Login (if you already have an account)
flowspec login
# 3. Initialize in your React project
cd my-react-app
flowspec init
# 4. Embed your codebase for AI context
flowspec embed
# 5. Generate tests automatically
flowspec watch
# Or generate for specific files
flowspec generate src/components/Button.tsxCommands
Authentication
flowspec register- Create a new FlowSpec accountflowspec signup- Create a new FlowSpec account (alias)flowspec login- Login to existing accountflowspec logout- Logout from FlowSpec
Project Management
flowspec init- Initialize FlowSpec in current projectflowspec embed- Embed codebase for AI contextflowspec status- Show project status and info
Test Generation
flowspec generate <files...>- Generate tests for specific filesflowspec watch- Watch for changes and auto-generate testsflowspec dashboard- Open web dashboard
Utility
flowspec uninstall- Show uninstall instructionsflowspec --help- Show all commandsflowspec --version- Show version
Configuration
FlowSpec creates a .flowspec/config.json file in your project:
{
"projectId": "proj_123",
"userId": "user_456",
"name": "My App",
"framework": "react",
"apiUrl": "https://api.cosmah.me"
}Environment Variables
FLOWSPEC_API_URL- API Server URL (default: https://api.cosmah.me)
Requirements
- Node.js 16+
- React/Vue/Svelte project with package.json
- Vitest for test execution
How It Works
- Authentication: Secure JWT-based auth with FlowSpec cloud
- Project Initialization: Links your local project to FlowSpec cloud
- Code Embedding: Analyzes and uploads code context for AI
- Test Generation: AI generates comprehensive Vitest tests
- Self-Healing: Automatically fixes failing tests
- Dashboard: View results and analytics in web UI
Supported Frameworks
- ✅ React (TypeScript/JavaScript)
- 🚧 Vue (coming soon)
- 🚧 Svelte (coming soon)
File Patterns
FlowSpec automatically detects and generates tests for:
src/**/*.{tsx,jsx}- React componentscomponents/**/*.{tsx,jsx}- Component directorieslib/**/*.{tsx,jsx}- Library components
Files must:
- Start with capital letter (PascalCase)
- Export a React component
- Not be test files (.test., .spec.)
Examples
Generate tests for a component
flowspec generate src/components/Button.tsx
# Creates: src/components/Button.test.tsxWatch mode for automatic generation
flowspec watch
# Monitors file changes and generates tests automaticallyCheck project status
flowspec status
# Shows authentication, project info, and server connectionTroubleshooting
"Project not initialized"
Run flowspec init in your project root.
"Not logged in"
Run flowspec login or flowspec signup.
"Cannot connect to FlowSpec server"
Make sure the Brain Server is running on the configured URL.
"Vitest not found"
Install Vitest in your project:
npm install -D vitest @testing-library/react jsdomSupport
- Documentation: https://docs.cosmah.me
- Issues: https://github.com/cosmah/flowspec-cli/issues
