smart-ai-terminal
v0.4.0
Published
Unified CLI tool for automated test generation and execution
Downloads
26
Maintainers
Readme
Smart AI Test Suite (SAT)
Unified CLI tool for automated test generation and execution. Generate tests in minutes, not hours using AI-powered agents.
Team
Team Name: Aakhri
Team Members:
- Vinil Joseph
- Sharath S
- Ashik k
- Muhammed Haneen
- Pavan Marathe
Npm Link - https://www.npmjs.com/package/smart-ai-terminal
( We would recommend global installation of the package )
Features
- 🤖 AI-Powered Test Generation - Uses Groq SDK with Llama 3.3 70B for intelligent test creation
- ⚡ 95-98% Time Reduction - Generate comprehensive tests in 2-5 minutes instead of hours
- 🔧 Auto-Fix Failing Tests - Automatically fixes test failures with AI assistance
- 📊 Coverage Analysis - Identifies missing test cases and suggests improvements
- ⚛️ React Support - Automatic detection and appropriate testing library usage
- 🎯 Framework Detection - Automatically detects Jest, Vitest, or Mocha
- 📦 Dependency Management - Auto-installs missing testing dependencies
- 🔍 Static Analysis - AST-based code analysis for accurate test generation
Installation
npm install -g smart-ai-terminalQuick Start
Initialize SAT in your project:
sat initThis will:
- Detect your test framework (Jest, Vitest, Mocha)
- Create
.satrcconfiguration file - Enter interactive mode automatically
Configure API Key (first time only):
sat shell setupEnter your Groq API key (get one at https://console.groq.com/keys)
Generate tests for a file:
sat gen unit src/utils/validator.tsOr use interactive mode:
sat shell generate src/utils/validator.tsRun tests:
sat testCheck coverage:
sat coverage
Commands
CLI Commands
sat init
Initialize SAT in your project. Detects your test framework (Jest, Vitest, Mocha) and creates configuration.
What it does:
- Detects test framework from
package.json - Creates
.satrcconfiguration file - Automatically enters interactive shell mode
sat gen unit <file>
Generate unit tests for a TypeScript/JavaScript file.
Options:
-o, --output <dir>- Output directory for test files (default:__tests__)--skip-deps- Skip dependency check and installation
Examples:
sat gen unit src/utils/validator.ts
sat gen unit src/components/Button.tsx -o tests
sat gen unit src/api/client.ts --skip-depsFeatures:
- Automatically detects React components (
.tsx/.jsxfiles) - Installs missing testing dependencies (Jest, React Testing Library, etc.)
- Creates appropriate Jest configuration if needed
- Generates tests with comprehensive edge case coverage
sat test
Run tests using your configured test framework.
Options:
-w, --watch- Watch mode for continuous testing
Examples:
sat test
sat test --watchsat coverage
Generate and display test coverage report.
Examples:
sat coveragesat shell
Start interactive SAT session with AI-powered commands.
Interactive Commands:
learn- Analyze project structure and build AI contextgenerate <file>- Generate AI-powered tests for a filegenerate --all- Generate tests for all source filessuggest <file>- Suggest missing test cases for a filetest [file]- Run tests (optionally for a specific file)test --verbose [file]ortest -v [file]- Run tests with detailed outputtest --fix <file>- Run tests and auto-fix failures with AIstatus- Show current project context and configurationsetup- Configure your GROQ API keyclear- Clear the screenhelp- Show available commandsexitorquit- Exit SAT session
Example Workflow:
sat shell
> learn # Analyze project
> generate src/utils.ts # Generate tests
> test # Run tests
> test --fix src/utils.ts # Fix any failures
> exitConfiguration
SAT stores configuration in .satrc file:
{
"framework": "jest",
"testDir": "__tests__",
"testFilePattern": "{name}.test.ts"
}API Key Configuration
Set your Groq API key using one of these methods:
Interactive setup:
sat shell setupEnvironment variable:
export GROQ_API_KEY=your_key_hereManual configuration: The API key is stored in
~/.satrcafter setup.
Documentation
For comprehensive documentation on AI tools, agents, use cases, and productivity improvements, see AI_TOOLS.md.
Key Topics:
- AI agent system (Generator, Fixer, Suggester, Reviewer, Analyzer)
- Prompt engineering and context building
- Measurable productivity improvements
- Technical architecture
- Integration points
Requirements
- Node.js 18+
- TypeScript/JavaScript project
- Groq API Key (for AI features) - Get one at https://console.groq.com/keys
- Test Framework (one of):
- Jest (recommended)
- Vitest
- Mocha
Optional Dependencies
SAT will automatically install these when needed:
- For React projects:
@testing-library/react,@testing-library/jest-dom,@testing-library/user-event,jest-environment-jsdom - For all projects:
jest,ts-jest,@types/jest
Supported File Types
- TypeScript:
.ts,.tsx - JavaScript:
.js,.jsx
Project Structure
After initialization, SAT creates:
your-project/
├── .satrc # SAT configuration
├── .sat/ # SAT project context (created after 'learn')
│ └── context.json # Project analysis results
└── __tests__/ # Generated test files (default)Examples
Basic Test Generation
# Initialize project
sat init
# Generate tests
sat gen unit src/utils/validator.ts
# Run tests
sat testReact Component Testing
# SAT automatically detects React components
sat gen unit src/components/Button.tsx
# Installs React Testing Library automatically
# Generates appropriate component testsInteractive Workflow
sat shell
> learn # Build project context
> generate src/api.ts # Generate tests
> test # Run all tests
> suggest src/api.ts # Find missing test cases
> test --fix src/api.ts # Auto-fix any failuresBatch Generation
sat shell
> generate --all # Generate tests for all source filesTroubleshooting
API Key Issues
# Check if API key is configured
sat shell
> status
# Reconfigure if needed
> setupMissing Dependencies
SAT will prompt to install missing dependencies automatically. If you want to skip:
sat gen unit src/file.ts --skip-depsTest Framework Not Found
Make sure your test framework is installed:
npm install -D jest # or vitest, mochaDevelopment
# Install dependencies
npm install
# Build
npm run build
# Development mode
npm run devContributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
