A CLI tool to generate RooCode workflow configuration files for any tech stack. This tool aims to streamline the setup process for projects adopting the RooCode methodology by providing an interactive command-line experience, potentially enhanced with Large Language Model (LLM) capabilities for intelligent configuration suggestions.
roocode-generator is a Node.js command-line interface (CLI) tool built with TypeScript, designed to streamline and standardize the creation of configuration files and documentation for projects adopting the RooCode methodology. It leverages an interactive CLI, a modular generator architecture, and integrates with Large Language Models (LLMs) via Langchain to provide intelligent, context-aware generation capabilities.
Key goals include:
- Accelerating setup by automating file generation.
- Ensuring consistency in configurations and documentation.
- Improving developer experience with an intuitive CLI.
- Supporting flexibility across different technology stacks.
- Leveraging LLMs for context-aware generation (rules, documentation).
Core features include:
- Interactive CLI (
generate,configcommands). - Modular generator architecture (
AiMagicGenerator,MemoryBankService, etc.). - LLM integration via Langchain (OpenAI, Google GenAI, Anthropic).
- Project context analysis.
- Template system for generation.
- Configuration management (
roocode-config.json,llm.config.json).
For more detailed information, refer to the Project Overview.
The application follows a Modular CLI Architecture with LLM Integration. Here's the core flow when a command like roocode generate --generators memory-bank is run:
- Initialization: The CLI entry point (
bin/roocode-generator.js) starts the application, sets up module aliasing, environment variables, and the Dependency Injection (DI) container. - DI Registration: Services are registered in modules (
@core/di/modules/*). - Application Bootstrap: The main
ApplicationContainer(@core/application/application-container.ts) is resolved. - Command Parsing (
CliInterface): Usescommanderto parse arguments (e.g.,generate,--generators memory-bank). - Configuration Loading:
ProjectConfigServiceandLLMConfigServiceload settings. - Command Routing (
ApplicationContainer): Routes thegeneratecommand toexecuteGenerateCommand. - Generator Orchestration (
GeneratorOrchestrator): Resolves the primaryAiMagicGenerator(@generators/ai-magic-generator.ts) and passes thegeneratorType(memory-bankin this example). AiMagicGeneratorExecution:- Analyzes project context using
ProjectAnalyzer. - Routes internally based on
generatorType:- If
memory-bank: CallsMemoryBankService(@memory-bank/memory-bank-service.ts) to generate documentation. - If
roo: Executes logic to generate RooCode rules. - If
cursor: Executes placeholder logic.
- If
- Uses
LLMAgentfor LLM interactions andFileOperationsto write files.
- Analyzes project context using
- User Feedback:
ProgressIndicator(ora) andLoggerService(chalk) provide updates. - Completion/Error Handling: Uses a
Resulttype for explicit success/failure.
For a more detailed diagram and component breakdown, see the Technical Architecture.
To set up the roocode-generator project for local development, follow these steps:
- Node.js: Version 18.x or higher recommended (check
enginesinpackage.json, currently>=16). - npm: Comes bundled with Node.js.
- Git: For version control.
- API Keys: Required for LLM providers (Anthropic, Google Gemini, OpenAI) if using LLM features.
-
Clone the repository:
git clone https://github.com/Hive-Academy/roocode-generator.git cd roocode-generator -
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.envfile in the project root. - Add your LLM API keys:
# .env file ANTHROPIC_API_KEY=your_anthropic_api_key GOOGLE_API_KEY=your_google_api_key OPENAI_API_KEY=your_openai_api_key
- Note:
.envis gitignored. Do not commit it.
- Create a
-
Prepare Git Hooks: Husky hooks (for linting, commit messages) are installed automatically via the
preparescript afternpm install. You can run it manually if needed:npm run prepare
Now you can run the CLI locally using npm run dev -- <args> or build it using npm run build.
For more detailed developer setup and workflow information, see the Developer Guide.
The project uses Jest for unit and integration testing.
-
Run all tests:
npm test -
Run tests in watch mode:
npm run test:watch
-
Generate coverage report:
npm run test:coverage
Coverage reports are generated in the
coverage/directory. The project aims for >=80% coverage.
For comprehensive testing guidelines, refer to the Developer Guide - Quality and Testing.
The roocode-generator provides the following main commands:
Manages LLM provider settings (llm.config.json).
Usage:
roocode config [options]Options:
--provider <name>: Set provider (openai,google-genai,anthropic).--apiKey <key>: Set API key.--model <name>: Set model name.
Interactive Mode:
Running roocode config without options starts an interactive setup guide.
Examples:
# Interactive setup
roocode config
# Set via options
roocode config --provider openai --apiKey sk-YOUR_KEY --model gpt-4oExecutes the primary AiMagicGenerator to generate content based on project analysis and LLM interaction. The type of content generated is controlled by the --generators flag.
Usage:
roocode generate --generators <type> [options]Required Flag:
--generators <type>: Specifies the type of content to generate. Must be one of:memory-bank: Generates core documentation (ProjectOverview.md,TechnicalArchitecture.md,DeveloperGuide.md) using theMemoryBankService.roo: Generates RooCode rules (.roo/rules-code/rules.md) based on project context.cursor: (Placeholder for future functionality).
Note: Running roocode generate without the --generators flag is currently not the primary intended use case and might have undefined behavior. Always specify the type of generation needed.
Examples:
# Generate Memory Bank documentation
roocode generate --generators memory-bank
# Generate RooCode rules
roocode generate --generators rooWhile ai-magic (triggered via roocode generate --generators <type>) is the main entry point, other specific generators exist and might be invoked directly if needed, though this is less common:
roocode generate system-prompts: Creates system prompt files.roocode generate roomodes: Generates the.roomodesfile.roocode generate vscode-copilot-rules: Configures VS Code Copilot settings.
Example:
# Generate only the .roomodes file (less common)
roocode generate roomodesNote: The standalone roocode generate memory-bank command is deprecated. Use roocode generate --generators memory-bank instead. The old options (--context, --output) are no longer applicable in the new workflow.
For more technical details, refer to the Technical Architecture.
This project uses semantic-release for automated version management and package publishing.
- Commit Changes: Follow the Conventional Commits specification for all commit messages on the
mainbranch (enforced bycommitlint).fix:commits trigger patch releases.feat:commits trigger minor releases.- Commits with
BREAKING CHANGE:in the body trigger major releases.
- CI Automation: When changes are pushed or merged to
main, the CI pipeline (e.g., GitHub Actions) automatically runssemantic-release. semantic-releaseSteps:- Analyzes commits since the last release.
- Determines the next semantic version number.
- Generates changelog entries.
- Tags the release in Git.
- Publishes the package to npm (requires
NPM_TOKENsecret in CI). - Creates a GitHub release with the generated notes.
Manual version bumping (npm version) and publishing (npm publish) are not part of the standard workflow.