JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 120
  • Score
    100M100P100Q104154F
  • License MIT

CLI tool to standardize AI-generated projects with templates, rules enforcement, and automation

Package Exports

  • @hivellm/rulebook
  • @hivellm/rulebook/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hivellm/rulebook) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@hivellm/rulebook

CLI tool to standardize AI-generated projects with templates, rules enforcement, workflow generation, CI/CD monitoring, and complete publication support for 10 programming languages.

Features

  • ๐Ÿ” Auto-Detection: Automatically detects project language (10 languages) and MCP modules
  • ๐Ÿ“ Template System: 62 pre-built templates for languages, modules, IDEs, workflows, and Git
  • ๐Ÿ”„ Smart Merging: Intelligently merges with existing AGENTS.md files without losing content
  • ๐ŸŽฏ Customizable: Configure coverage thresholds, documentation strictness, Git workflow, and more
  • ๐Ÿšซ Rules Ignore: Selectively disable rules using .rulesignore file
  • ๐Ÿค– AI-Optimized: Works with 15+ AI coding assistants and 8 IDEs
  • ๐Ÿ“ฆ Publication Ready: Complete CI/CD pipelines for all package registries
  • ๐Ÿ”„ CI/CD Monitoring: GitHub MCP integration for automated workflow validation
  • ๐ŸŽจ Git Workflow: Quality gates, conventional commits, and version management

Installation

# NPX (recommended - no installation needed)
npx @hivellm/rulebook init

# Or install globally
npm install -g @hivellm/rulebook
rulebook init

# Or install locally
npm install --save-dev @hivellm/rulebook
npx rulebook init

Quick Start

Navigate to your project directory and run:

npx @hivellm/rulebook init

The CLI will:

  1. Detect your project's language(s) and structure
  2. Detect available MCP modules (Vectorizer, Synap, etc.)
  3. Ask configuration questions
  4. Generate or merge AGENTS.md with best practices
  5. Optionally generate GitHub Actions workflows

Usage

Interactive Mode

npx @hivellm/rulebook init

Answer the prompts to customize your configuration:

  • Language selection
  • Project type (application, library, CLI, monorepo)
  • MCP modules to include
  • IDE preferences
  • Coverage threshold (default: 95%)
  • Documentation strictness

Auto Mode

Use detected defaults without prompts:

npx @hivellm/rulebook init --yes

Validation

Validate your project structure against rulebook standards:

npx @hivellm/rulebook validate

Checks:

  • AGENTS.md presence and quality
  • Documentation structure (/docs directory)
  • Tests directory existence
  • .rulesignore patterns
  • Project quality score (0-100)

Dependency Checking

Check for outdated and vulnerable dependencies:

npx @hivellm/rulebook check-deps

Supports:

  • npm (package.json)
  • Cargo (Cargo.toml)
  • Python (requirements.txt, pyproject.toml)
  • Go (go.mod)
  • Maven/Gradle (pom.xml, build.gradle)

Coverage Verification

Verify test coverage meets threshold:

npx @hivellm/rulebook check-coverage

# Custom threshold
npx @hivellm/rulebook check-coverage --threshold 90

Supports: All languages (Rust, TypeScript, Python, Go, Java, etc.)

Version Management

Bump project version automatically:

# Bump patch version (1.0.0 โ†’ 1.0.1)
npx @hivellm/rulebook version patch

# Bump minor version (1.0.0 โ†’ 1.1.0)
npx @hivellm/rulebook version minor

# Bump major version (1.0.0 โ†’ 2.0.0)
npx @hivellm/rulebook version major

Updates: package.json, Cargo.toml, pyproject.toml, mix.exs, build.gradle.kts, .csproj

Changelog Generation

Generate CHANGELOG.md from git commits:

# Auto-detect version
npx @hivellm/rulebook changelog

# Specify version
npx @hivellm/rulebook changelog --version 1.2.0

Features:

  • Parses conventional commits
  • Categorizes changes (Added, Changed, Fixed, Breaking)
  • Updates CHANGELOG.md with proper formatting
  • Detects breaking changes automatically

Project Health Check

Analyze project health across multiple dimensions:

npx @hivellm/rulebook health

Analyzes:

  • ๐Ÿ“ Documentation (README, CHANGELOG, LICENSE, docs/)
  • ๐Ÿงช Testing (tests/, coverage, test frameworks)
  • ๐ŸŽจ Code Quality (linters, formatters, type checking)
  • ๐Ÿ”’ Security (SECURITY.md, .gitignore, secrets detection)
  • ๐Ÿ”„ CI/CD (GitHub Actions workflows)
  • ๐Ÿ“ฆ Dependencies (lock files, vulnerabilities)

Output: Overall score (0-100) with grade (A+ to F) and category breakdowns

Custom Templates

Add your own templates to extend rulebook:

# Initialize custom templates directory
mkdir -p .rulebook/templates/{language,module,workflow,ide,cli}

# Add your custom template
echo "<!-- CUSTOM:START -->" > .rulebook/templates/language/CUSTOM.md
# ... add your template content ...
echo "<!-- CUSTOM:END -->" >> .rulebook/templates/language/CUSTOM.md

# Custom templates are automatically detected
npx @hivellm/rulebook init

Supports: Custom templates for all categories

Auto-Fix Common Issues

Automatically fix common project issues:

npx @hivellm/rulebook fix

Fixes:

  • Creates missing .gitignore with comprehensive patterns
  • Creates missing LICENSE (MIT template)
  • Creates missing README.md with template
  • Creates /docs directory for documentation
  • Runs code formatting (npm run format)
  • Fixes lint errors automatically (npm run lint --fix)

Integrates with health command: Improves project health score automatically

Documentation Structure Generation

Generate complete documentation structure and standard open source files:

npx @hivellm/rulebook generate-docs

# Auto mode
npx @hivellm/rulebook generate-docs --yes

Generates:

  • /docs directory structure (specs, guides, diagrams, benchmarks, etc.)
  • CONTRIBUTING.md - Contribution guidelines
  • CODE_OF_CONDUCT.md - Code of conduct
  • SECURITY.md - Security policy
  • docs/ROADMAP.md - Project roadmap
  • docs/ARCHITECTURE.md - System architecture
  • docs/DAG.md - Component dependencies

Supported Languages (11)

  • โœ… Rust: Edition 2024, Clippy, Cargo fmt, nextest, llvm-cov โ†’ crates.io
  • โœ… TypeScript: ESLint, Prettier, Vitest, strict mode โ†’ npm
  • โœ… Python: Ruff, Black, mypy, pytest โ†’ PyPI
  • โœ… Go: gofmt, golangci-lint, go vet, table-driven tests โ†’ pkg.go.dev
  • โœ… Java: Maven/Gradle, JUnit 5, Checkstyle, PMD, SpotBugs โ†’ Maven Central
  • โœ… Elixir: Mix, Credo, Dialyzer, ExUnit โ†’ Hex.pm
  • โœ… C#: .NET 8+, nullable types, Roslyn analyzers โ†’ NuGet
  • โœ… PHP: PHP 8.2+, PHPStan, PHP-CS-Fixer, PHPUnit โ†’ Packagist
  • โœ… Swift: Swift 5.10+, SwiftLint, strict concurrency โ†’ SPM
  • โœ… Kotlin: Kotlin 2.0+, K2 compiler, Detekt, ktlint โ†’ Maven Central
  • โœ… C/C++: C++20/23, CMake, clang-format, clang-tidy, Google Test โ†’ Conan/vcpkg

Supported MCP Modules (5)

  • โœ… Vectorizer: Semantic search and codebase exploration
  • โœ… Synap: Key-value store for task and data persistence
  • โœ… OpenSpec: Change proposal and specification workflow
  • โœ… Context7: Library documentation for dependency management
  • โœ… GitHub MCP: Automated workflow validation and CI/CD monitoring

Supported IDEs & AI Tools (23 total)

IDEs (8)

  • โœ… Cursor: Cursor-specific rules format (Agent mode, Composer)
  • โœ… Windsurf: Windsurf configuration (Cascade AI, Flow State)
  • โœ… VS Code: VS Code AI extensions (Copilot, Cody, Continue)
  • โœ… GitHub Copilot: Copilot instructions and best practices
  • โœ… Tabnine: Multi-IDE AI completion (VS Code, JetBrains, Vim, Sublime)
  • โœ… Replit: Cloud IDE with Ghostwriter AI
  • โœ… JetBrains AI: AI Assistant (IntelliJ, PyCharm, WebStorm, GoLand, RustRover, Rider, CLion, PhpStorm)
  • โœ… Zed: High-performance collaborative editor (Rust-powered)

CLI & API Agents (15)

  • โœ… Aider: AI pair programming in terminal
  • โœ… Continue: Open-source Copilot alternative
  • โœ… Claude: Anthropic Claude API/CLI (200K context)
  • โœ… Claude Code: Advanced Anthropic coding assistant
  • โœ… Gemini: Google Gemini API/CLI (2M context)
  • โœ… Cursor CLI: Cursor automation and scripting
  • โœ… Codeium: Free AI coding assistant
  • โœ… Cline: VS Code extension and CLI with quality gates
  • โœ… Amazon Q Developer: AWS-focused with security scanning
  • โœ… Auggie (Augment CLI): TDD mode and intelligent refactoring
  • โœ… CodeBuddy Code: Intelligent pair programming
  • โœ… Factory Droid: Code generation and automation
  • โœ… OpenCode: Open-source AI assistant
  • โœ… Kilo Code: Lightweight coding companion
  • โœ… Codex: OpenAI code generation integration

Documentation Structure

Rulebook enforces a clean documentation structure:

project/
โ”œโ”€โ”€ README.md           # Project overview (allowed in root)
โ”œโ”€โ”€ CHANGELOG.md        # Version history (allowed in root)
โ”œโ”€โ”€ AGENTS.md          # AI assistant rules (allowed in root)
โ”œโ”€โ”€ LICENSE            # Project license (allowed in root)
โ”œโ”€โ”€ CONTRIBUTING.md    # Contribution guidelines (allowed in root)
โ”œโ”€โ”€ CODE_OF_CONDUCT.md # Code of conduct (allowed in root)
โ”œโ”€โ”€ SECURITY.md        # Security policy (allowed in root)
โ””โ”€โ”€ docs/              # All other documentation
    โ”œโ”€โ”€ ROADMAP.md     # Implementation timeline
    โ”œโ”€โ”€ DAG.md         # Component dependencies
    โ”œโ”€โ”€ ARCHITECTURE.md # System design
    โ”œโ”€โ”€ specs/         # Feature specifications
    โ”œโ”€โ”€ guides/        # Developer guides
    โ”œโ”€โ”€ diagrams/      # Architecture diagrams
    โ”œโ”€โ”€ benchmarks/    # Performance results
    โ””โ”€โ”€ versions/      # Release reports

Testing Requirements

All projects using rulebook must follow these testing standards:

  • Minimum Coverage: Configurable (default 95%)
  • Test Location: /tests directory in project root
  • Test Execution: 100% of tests must pass before next task
  • Test-Driven: Write tests before implementation

Rules Ignore

Create a .rulesignore file to selectively disable rules:

# Ignore coverage requirement
coverage-threshold

# Ignore specific language rules
rust/edition-2024

# Ignore all TypeScript rules
typescript/*

# Use glob patterns
*-threshold

Generated Workflows (32 total)

When workflow generation is enabled, rulebook creates GitHub Actions workflows:

Test & Lint Workflows (21)

  • Rust: rust-test.yml, rust-lint.yml
  • TypeScript: typescript-test.yml, typescript-lint.yml
  • Python: python-test.yml, python-lint.yml
  • Go: go-test.yml, go-lint.yml
  • Java: java-test.yml, java-lint.yml
  • Elixir: elixir-test.yml, elixir-lint.yml
  • C#: dotnet-test.yml, dotnet-lint.yml
  • PHP: php-test.yml, php-lint.yml
  • Swift: swift-test.yml, swift-lint.yml
  • Kotlin: kotlin-test.yml, kotlin-lint.yml
  • Universal: codespell.yml (typo detection)

Publishing Workflows (10)

  • TypeScript: typescript-publish.yml โ†’ npm (with provenance)
  • Rust: rust-publish.yml โ†’ crates.io
  • Python: python-publish.yml โ†’ PyPI (trusted publishing)
  • Go: go-publish.yml โ†’ pkg.go.dev
  • Java: java-publish.yml โ†’ Maven Central + GitHub Packages
  • Elixir: elixir-publish.yml โ†’ Hex.pm
  • C#: dotnet-publish.yml โ†’ NuGet
  • PHP: php-publish.yml โ†’ Packagist (auto-sync validation)
  • Swift: swift-publish.yml โ†’ Swift Package Manager
  • Kotlin: kotlin-publish.yml โ†’ Maven Central

Git Workflow (1)

  • Complete Git workflow guidelines with quality gates and CI/CD monitoring

Example AGENTS.md Output

<!-- RULEBOOK:START -->
# Project Rules

## Documentation Standards
**CRITICAL**: Minimize Markdown files. Keep documentation organized.

## Testing Requirements
- **Minimum Coverage**: 95%
- **Test Location**: `/tests` directory
- **Test Execution**: 100% pass rate required

## Feature Development Workflow
1. Check specifications in `/docs/specs/`
2. Implement with tests
3. Run quality checks
4. Update documentation
<!-- RULEBOOK:END -->

<!-- RUST:START -->
# Rust Project Rules
[Rust-specific rules...]
<!-- RUST:END -->

<!-- VECTORIZER:START -->
# Vectorizer Instructions
[Vectorizer usage patterns...]
<!-- VECTORIZER:END -->

Development

# Install dependencies
npm install

# Run in development
npm run dev

# Build
npm run build

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Lint
npm run lint

# Format
npm run format

Requirements

  • Node.js 18.0.0 or higher
  • npm 9.0.0 or higher

License

MIT

Contributing

Contributions are welcome! Please read our contributing guidelines and code of conduct.

Support

Credits

Created by the HiveLLM Team to standardize AI-assisted development workflows.