@resit/engineering-rules
v1.0.0
Published
Corporate CLI tool to bootstrap projects and install engineering rules for AI-assisted development
Readme
Resit Engineering Rules CLI
A corporate CLI tool to bootstrap projects and install engineering rules for AI-assisted development tools like Windsurf, Cursor, Continue, and Claude Code.
Features
- 🚀 Easy Initialization: Quickly set up engineering rules in any project
- 🔍 Auto-Detection: Automatically detects project type (Odoo, React, WordPress, Python, Ruby on Rails)
- 📦 Modular Rules: Combines base engineering rules with stack-specific guidelines
- 🔄 Update Support: Keep your rules up-to-date with the latest version
- 🏥 Health Checks: Verify your rules are properly configured
- 🎯 Extensible: Plugin-style architecture for adding new stacks and rules
Installation
Global Installation (Recommended)
npm install -g @resit/engineering-rulesLocal Installation
npm install --save-dev @resit/engineering-rulesUsage
Initialize Rules
Initialize engineering rules in your current project:
resit initThis command will:
- Detect your project type (if possible)
- Prompt you to select a stack if detection fails
- If the stack has optional modules, prompt to select them (checkbox list)
- Generate a
.windsurfdirectory with:architecture.md- Project architecture documentationprompts.md- Helpful prompts for AI assistantsrules/- Folder containing:rules.md- Combined engineering and stack-specific rules- Selected optional module folders/files (preserves folder structure)
Check Rules Health
Verify that your engineering rules are properly configured:
resit doctorThis command checks for:
- Existence of
.windsurfdirectory - Presence of required files
- Unprocessed template variables
- Outdated rules
Update Rules
Update your rules to the latest version:
resit updateThis command will:
- Detect your current stack from existing rules
- Update all rule files to the latest version
- Preserve your stack selection
Show Version
Display the CLI version:
resit versionSupported Stacks
- Odoo - Odoo ERP development
- React - React web applications
- WordPress - WordPress plugins and themes
- Python - Python applications
- Ruby on Rails - Ruby on Rails applications
Project Structure
resit-engineering-rules/
├── src/
│ ├── cli.ts # Main CLI entry point
│ ├── commands/ # CLI commands
│ │ ├── init.ts
│ │ ├── doctor.ts
│ │ ├── update.ts
│ │ └── version.ts
│ ├── core/ # Core modules
│ │ ├── ruleLoader.ts # Loads and combines rules
│ │ ├── stackResolver.ts # Detects and manages stacks
│ │ ├── templateEngine.ts # Renders templates
│ │ └── types.ts # TypeScript types
│ └── utils/ # Utility modules
│ ├── logger.ts
│ └── fs.ts
├── rules/ # Rule definitions
│ ├── base/ # Base rules for all projects
│ │ ├── engineering.md
│ │ └── git.md
│ ├── stacks/ # Stack-specific rules
│ │ ├── odoo.md
│ │ ├── react.md
│ │ ├── wordpress.md
│ │ ├── python.md
│ │ └── ruby.md
│ └── modules/ # Optional modules (add your custom modules here)
│ ├── odoo-localization-chile/ # Directory module (multiple .md files)
│ │ ├── odoo-l10n-cl-overview.md
│ │ ├── odoo-l10n-cl-dte.md
│ │ └── odoo-l10n-cl-xml-templates.md
│ ├── odoo-pos.md # Single file module
│ └── .gitkeep
├── templates/ # Template files
│ └── windsurf/
│ ├── rules.md
│ ├── architecture.md
│ └── prompts.md
└── package.jsonArchitecture
Plugin-Style Design
The CLI uses a modular, plugin-style architecture that makes it easy to add new stacks and rules without modifying core code.
Adding a New Stack
- Create a new rule file in
rules/stacks/:
# Example: rules/stacks/nextjs.md- Add the stack to
StackResolver:
// src/core/stackResolver.ts
{
id: 'nextjs',
name: 'Next.js',
description: 'Next.js applications',
ruleFiles: ['nextjs.md'],
}- Add detection logic (optional):
// src/core/stackResolver.ts
if (fs.existsSync(path.join(projectPath, 'next.config.js'))) {
return 'nextjs';
}Adding New Base Rules
Create a new markdown file in rules/base/ and update RuleLoader.loadBaseRules() to include it.
Adding Optional Modules to a Stack
Optional modules allow you to add technology-specific rules that users can select during initialization. For example, Odoo projects can select modules for Chilean localization, POS, accounting, or government projects.
Module formats supported:
Modules can be either:
- Single file:
rules/modules/odoo-pos.md - Directory with multiple files:
rules/modules/odoo-localization-chile/(containing multiple.mdfiles)
1. Create the module rules:
Option A - Single file module:
# Simple module with all rules in one file
rules/modules/odoo-pos.mdOption B - Directory module (recommended for complex modules):
# Complex module with multiple organized files
rules/modules/odoo-localization-chile/
├── odoo-l10n-cl-overview.md
├── odoo-l10n-cl-dte.md
├── odoo-l10n-cl-xml-templates.md
└── odoo-l10n-cl-sii-integration.mdWhen using a directory, all .md files inside will be loaded and combined (sorted alphabetically).
2. Add the module to the stack definition:
// src/core/stackResolver.ts
{
id: 'odoo',
name: 'Odoo',
description: 'Odoo ERP development',
ruleFiles: ['odoo.md'],
optionalModules: [
{
id: 'odoo-localization-chile',
name: 'Localización Chile',
description: 'Reglas para localización chilena (facturación electrónica, DTE, etc.)',
ruleFile: 'odoo-localization-chile.md',
},
{
id: 'odoo-pos',
name: 'Point of Sale (POS)',
description: 'Reglas para desarrollo de módulos POS',
ruleFile: 'odoo-pos.md',
},
// Add more modules as needed
],
}3. How it works:
- During
resit init, if a stack has optional modules, the CLI will prompt the user with a checkbox list - Users can select one, multiple, or no optional modules
- Selected modules are loaded and appended to the generated rules
- The selection is tracked in the architecture.md file
Example stacks with optional modules:
- Odoo: Chilean localization, POS, Accounting, Government
- Node.js/React: Socket.IO, PostgreSQL, MongoDB
- Python: Django, FastAPI, Flask, SQLAlchemy
Benefits:
- Keep base stack rules clean and focused
- Allow project-specific customization
- Easy to extend without modifying core files
- Users only get the rules they need
Core Modules
- StackResolver: Manages available stacks and auto-detects project types
- RuleLoader: Loads and combines base and stack-specific rules
- TemplateEngine: Renders templates with variables and generates output files
Development
Setup
# Clone the repository
git clone <repository-url>
cd resit-engineering-rules
# Install dependencies
npm install
# Build the project
npm run build
# Link for local testing
npm linkBuild
npm run buildWatch Mode
npm run devTesting Locally
After building and linking:
cd /path/to/test/project
resit initPublishing to npm
Prerequisites
- Create an npm account at https://www.npmjs.com
- Login to npm:
npm loginPublishing Steps
1. Update Version
Update the version in package.json:
npm version patch # 1.0.0 -> 1.0.1
npm version minor # 1.0.0 -> 1.1.0
npm version major # 1.0.0 -> 2.0.02. Build the Project
npm run build3. Test the Package
# Test locally
npm link
cd /path/to/test/project
resit init
# Or test with npm pack
npm pack
npm install -g resit-engineering-rules-1.0.0.tgz4. Publish
# For scoped packages (recommended)
npm publish --access public
# For unscoped packages
npm publish5. Verify Publication
npm info @resit/engineering-rulesPublishing Checklist
- [ ] All tests pass
- [ ] Version number updated
- [ ] CHANGELOG updated (if applicable)
- [ ] README is up-to-date
- [ ] Build succeeds without errors
- [ ] Package tested locally
- [ ] Git changes committed and pushed
- [ ] Published to npm
- [ ] Verified installation:
npm install -g @resit/engineering-rules
Continuous Deployment (Optional)
Using GitHub Actions
Create .github/workflows/publish.yml:
name: Publish to npm
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}Add your npm token to GitHub Secrets as NPM_TOKEN.
Maintenance
Updating Rules
- Edit rule files in
rules/base/orrules/stacks/ - Update version in
package.json - Build and publish
- Users can update with
resit update
Adding New Features
- Create new command in
src/commands/ - Register command in
src/cli.ts - Update README
- Build and publish
Contributing
Adding New Stacks
We welcome contributions for new stack support! To add a new stack:
- Create a rule file in
rules/stacks/[stack-name].md - Follow the existing format and structure
- Add detection logic to
StackResolver - Update this README
- Submit a pull request
Improving Rules
To improve existing rules:
- Edit the relevant markdown file
- Ensure rules are clear and actionable
- Test with AI assistants
- Submit a pull request
License
MIT
Support
For issues, questions, or contributions, please visit the project repository.
Roadmap
- [ ] Support for more stacks (Vue.js, Angular, Django, etc.)
- [ ] Custom rule templates
- [ ] Rule versioning and migration
- [ ] Integration with more AI tools
- [ ] Rule validation and linting
- [ ] Interactive rule customization
- [ ] Team-specific rule overrides
