Skip to content

Conversation

@him0
Copy link
Owner

@him0 him0 commented Jun 25, 2025

Overview

This PR migrates the project from TypeScript/pnpm to Bun and introduces a modular generator architecture, significantly improving build performance and code maintainability.

Major Changes

🎯 Build System Migration

  • Migrated from tsc to Bun for JavaScript compilation
  • Maintained TypeScript declaration files generation for type support
  • Build time reduced significantly with Bun's native TypeScript support

📦 Package Management

  • Replaced pnpm with Bun as the package manager
  • Simplified dependencies to only development requirements
  • Added bun.lock for reproducible installs

♻️ Modular Generator Architecture

  • Refactored monolithic rule-generator.ts into separate generator modules
  • Each AI tool (Copilot, Cline, Cursor) has its own generator implementing a common interface
  • Removed prefix-based filtering - generators now decide how to process rules independently
  • Improved extensibility for adding new AI tools

🔧 CLI Improvements

  • Renamed commands for better clarity: compilesync, previewplan
  • Default behavior now runs sync when no command specified
  • Consolidated all CLI logic into single src/cli.ts file

🚀 Performance & DX

  • bun run dev provides instant TypeScript execution
  • Faster installation and build times
  • Maintained Node.js compatibility for npx distribution

📝 Project Rename

  • Final name: ai-doc-sync (from ai-rule-forge)
  • Better reflects the tool's purpose of syncing AI documentation

Breaking Changes

  • Commands renamed: Use sync instead of compile, plan instead of preview
  • Requires Bun for development (Node.js still works for npx users)
  • Rules directory structure changed from ai-docs/_rules/ to ai-docs/rules/

Testing

  • ✅ All existing tests passing
  • ✅ Multi-version Node.js compatibility verified (18, 20, 22)
  • ✅ CLI commands tested
  • ✅ Build and distribution verified

Migration Guide

For developers:

# Install Bun
curl -fsSL https://bun.sh/install | bash

# Install dependencies
bun install

# Run in development
bun run dev

For users (unchanged):

npx ai-doc-sync init
npx ai-doc-sync

him0 and others added 5 commits June 26, 2025 00:45
- Migrated build system from TypeScript compiler to Bun
- Added native Bun development workflow with high-speed execution
- Maintained full Node.js compatibility for npm distribution
- Updated package.json with Bun-optimized scripts and metadata
- Added npm publish configuration following ccusage patterns
- Configured files field to include only dist directory
- Updated tsconfig.json for Bun compatibility (ESNext, bundler)
- Added Bun types support and removed pnpm-lock.yaml
- Updated .gitignore following ccusage patterns
- Verified Node.js compatibility for npx execution

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Breaking Changes:
- Renamed project from ai-rule-forge to ai-docs-cli
- Changed CLI command from `npx ai-rule-forge` to `npx ai-docs`

Major Changes:
- Migrated development environment to Bun for improved performance
- Removed tsx dependency in favor of Bun's native TypeScript support
- Updated build system to use Bun with Node.js compatibility
- Added TypeScript declaration files generation
- Created comprehensive CI/CD pipeline with GitHub Actions

New Features:
- Bun-first development workflow (direct TS execution)
- Cross-runtime testing (Node.js 18, 20, 22)
- Automated npm publishing workflow
- Optimized package distribution with .npmignore

Technical Details:
- Package size: 8.6 KB (compressed)
- Supports both `npx ai-docs-cli` and `npx ai-docs` commands
- Templates included in npm distribution
- Full backward compatibility with Node.js runtime

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove prefix-based filtering system in favor of clean generator architecture
- Create individual generator modules for each AI tool (Copilot, Cline, Cursor)
- Implement pure function generators that return file paths and content
- Separate compilation logic from file I/O operations
- Update directory structure from ai-docs/_rules to ai-docs/rules
- Simplify template files with concise, practical content
- Add ignore template with node_modules pattern
- Update documentation to reflect new modular architecture

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Major changes:
- Renamed project from ai-docs-cli to ai-doc-sync
- Default behavior now runs sync (no subcommand needed)
- Changed --plan option to plan subcommand
- Removed redundant sync subcommand

Breaking changes:
- npx ai-docs-cli → npx ai-doc-sync
- ai-docs sync → ai-doc-sync (default)
- ai-docs sync --plan → ai-doc-sync plan

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@him0 him0 changed the title Migrate to Bun for faster development and npx distribution 🚀 Migrate to Bun and refactor to modular generator architecture Jun 29, 2025
@him0 him0 merged commit 006e0c0 into main Jun 29, 2025
4 checks passed
@him0 him0 deleted the feature/migrate-to-bun branch June 29, 2025 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants