rulesync 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -382,6 +382,11 @@ async function parseRulesFromDirectory(aiRulesDir) {
382
382
  throw new Error(`Validation errors found:
383
383
  ${errors.join("\n")}`);
384
384
  }
385
+ const rootRules = rules.filter((rule) => rule.frontmatter.root);
386
+ if (rootRules.length > 1) {
387
+ const rootRuleFiles = rootRules.map((rule) => rule.filepath).join(", ");
388
+ throw new Error(`Multiple root rules found: ${rootRuleFiles}. Only one rule can have root: true.`);
389
+ }
385
390
  return rules;
386
391
  }
387
392
  async function parseRuleFile(filepath) {
@@ -666,15 +671,15 @@ async function initCommand() {
666
671
  async function createSampleFiles(aiRulesDir) {
667
672
  const sampleFiles = [
668
673
  {
669
- filename: "coding-rules.md",
674
+ filename: "overview.md",
670
675
  content: `---
671
676
  root: true
672
677
  targets: ["*"]
673
- description: "General coding standards and best practices"
678
+ description: "Project overview and general development guidelines"
674
679
  globs: ["**/*.ts", "**/*.js", "**/*.tsx", "**/*.jsx"]
675
680
  ---
676
681
 
677
- # Coding Rules
682
+ # Project Overview
678
683
 
679
684
  ## General Guidelines
680
685
 
@@ -690,54 +695,94 @@ globs: ["**/*.ts", "**/*.js", "**/*.tsx", "**/*.jsx"]
690
695
  - Use semicolons
691
696
  - Use double quotes for strings
692
697
  - Use trailing commas in multi-line objects and arrays
698
+
699
+ ## Architecture Principles
700
+
701
+ - Organize code by feature, not by file type
702
+ - Keep related files close together
703
+ - Use dependency injection for better testability
704
+ - Implement proper error handling
705
+ - Follow single responsibility principle
693
706
  `
694
707
  },
695
708
  {
696
- filename: "naming-conventions.md",
709
+ filename: "frontend.md",
697
710
  content: `---
698
711
  root: false
699
712
  targets: ["*"]
700
- description: "Naming conventions for variables, functions, and files"
701
- globs: ["**/*.ts", "**/*.js"]
713
+ description: "Frontend development rules and best practices"
714
+ globs: ["src/components/**/*.tsx", "src/pages/**/*.tsx", "**/*.css", "**/*.scss"]
702
715
  ---
703
716
 
704
- # Naming Conventions
717
+ # Frontend Development Rules
718
+
719
+ ## React Components
720
+
721
+ - Use functional components with hooks
722
+ - Follow PascalCase naming for components
723
+ - Use TypeScript interfaces for props
724
+ - Implement proper error boundaries
725
+
726
+ ## Styling
727
+
728
+ - Use CSS modules or styled-components
729
+ - Follow BEM methodology for CSS classes
730
+ - Prefer flexbox and grid for layouts
731
+ - Use semantic HTML elements
705
732
 
706
- ## Variables and Functions
707
- - Use camelCase for variables and functions
708
- - Use descriptive names that explain the purpose
709
- - Avoid abbreviations unless they are well-known
733
+ ## State Management
710
734
 
711
- ## Files and Directories
712
- - Use kebab-case for file names
713
- - Use PascalCase for component files
714
- - Use lowercase for directory names
735
+ - Use React hooks for local state
736
+ - Consider Redux or Zustand for global state
737
+ - Avoid prop drilling with context API
738
+ - Keep state as close to where it's used as possible
715
739
 
716
- ## Constants
717
- - Use SCREAMING_SNAKE_CASE for constants
718
- - Group related constants in enums or const objects
740
+ ## Performance
741
+
742
+ - Use React.memo for expensive components
743
+ - Implement lazy loading for routes
744
+ - Optimize images and assets
745
+ - Use proper key props in lists
719
746
  `
720
747
  },
721
748
  {
722
- filename: "architecture.md",
749
+ filename: "backend.md",
723
750
  content: `---
724
751
  root: false
725
- targets: ["copilot", "cursor"]
726
- description: "Architectural patterns and project structure guidelines"
727
- globs: ["src/**/*.ts"]
752
+ targets: ["*"]
753
+ description: "Backend development rules and API guidelines"
754
+ globs: ["src/api/**/*.ts", "src/services/**/*.ts", "src/models/**/*.ts"]
728
755
  ---
729
756
 
730
- # Architecture Guidelines
757
+ # Backend Development Rules
731
758
 
732
- ## Project Structure
733
- - Organize code by feature, not by file type
734
- - Keep related files close together
735
- - Use index files for clean imports
759
+ ## API Design
736
760
 
737
- ## Design Patterns
738
- - Use dependency injection for better testability
739
- - Implement proper error handling
740
- - Follow single responsibility principle
761
+ - Follow RESTful conventions
762
+ - Use consistent HTTP status codes
763
+ - Implement proper error handling with meaningful messages
764
+ - Use API versioning when necessary
765
+
766
+ ## Database
767
+
768
+ - Use proper indexing for performance
769
+ - Implement database migrations
770
+ - Follow naming conventions for tables and columns
771
+ - Use transactions for data consistency
772
+
773
+ ## Security
774
+
775
+ - Validate all input data
776
+ - Use proper authentication and authorization
777
+ - Implement rate limiting
778
+ - Sanitize database queries to prevent SQL injection
779
+
780
+ ## Code Organization
781
+
782
+ - Use service layer pattern
783
+ - Implement proper logging
784
+ - Use environment variables for configuration
785
+ - Write comprehensive tests for business logic
741
786
  `
742
787
  }
743
788
  ];
package/dist/index.mjs CHANGED
@@ -359,6 +359,11 @@ async function parseRulesFromDirectory(aiRulesDir) {
359
359
  throw new Error(`Validation errors found:
360
360
  ${errors.join("\n")}`);
361
361
  }
362
+ const rootRules = rules.filter((rule) => rule.frontmatter.root);
363
+ if (rootRules.length > 1) {
364
+ const rootRuleFiles = rootRules.map((rule) => rule.filepath).join(", ");
365
+ throw new Error(`Multiple root rules found: ${rootRuleFiles}. Only one rule can have root: true.`);
366
+ }
362
367
  return rules;
363
368
  }
364
369
  async function parseRuleFile(filepath) {
@@ -643,15 +648,15 @@ async function initCommand() {
643
648
  async function createSampleFiles(aiRulesDir) {
644
649
  const sampleFiles = [
645
650
  {
646
- filename: "coding-rules.md",
651
+ filename: "overview.md",
647
652
  content: `---
648
653
  root: true
649
654
  targets: ["*"]
650
- description: "General coding standards and best practices"
655
+ description: "Project overview and general development guidelines"
651
656
  globs: ["**/*.ts", "**/*.js", "**/*.tsx", "**/*.jsx"]
652
657
  ---
653
658
 
654
- # Coding Rules
659
+ # Project Overview
655
660
 
656
661
  ## General Guidelines
657
662
 
@@ -667,54 +672,94 @@ globs: ["**/*.ts", "**/*.js", "**/*.tsx", "**/*.jsx"]
667
672
  - Use semicolons
668
673
  - Use double quotes for strings
669
674
  - Use trailing commas in multi-line objects and arrays
675
+
676
+ ## Architecture Principles
677
+
678
+ - Organize code by feature, not by file type
679
+ - Keep related files close together
680
+ - Use dependency injection for better testability
681
+ - Implement proper error handling
682
+ - Follow single responsibility principle
670
683
  `
671
684
  },
672
685
  {
673
- filename: "naming-conventions.md",
686
+ filename: "frontend.md",
674
687
  content: `---
675
688
  root: false
676
689
  targets: ["*"]
677
- description: "Naming conventions for variables, functions, and files"
678
- globs: ["**/*.ts", "**/*.js"]
690
+ description: "Frontend development rules and best practices"
691
+ globs: ["src/components/**/*.tsx", "src/pages/**/*.tsx", "**/*.css", "**/*.scss"]
679
692
  ---
680
693
 
681
- # Naming Conventions
694
+ # Frontend Development Rules
695
+
696
+ ## React Components
697
+
698
+ - Use functional components with hooks
699
+ - Follow PascalCase naming for components
700
+ - Use TypeScript interfaces for props
701
+ - Implement proper error boundaries
702
+
703
+ ## Styling
704
+
705
+ - Use CSS modules or styled-components
706
+ - Follow BEM methodology for CSS classes
707
+ - Prefer flexbox and grid for layouts
708
+ - Use semantic HTML elements
682
709
 
683
- ## Variables and Functions
684
- - Use camelCase for variables and functions
685
- - Use descriptive names that explain the purpose
686
- - Avoid abbreviations unless they are well-known
710
+ ## State Management
687
711
 
688
- ## Files and Directories
689
- - Use kebab-case for file names
690
- - Use PascalCase for component files
691
- - Use lowercase for directory names
712
+ - Use React hooks for local state
713
+ - Consider Redux or Zustand for global state
714
+ - Avoid prop drilling with context API
715
+ - Keep state as close to where it's used as possible
692
716
 
693
- ## Constants
694
- - Use SCREAMING_SNAKE_CASE for constants
695
- - Group related constants in enums or const objects
717
+ ## Performance
718
+
719
+ - Use React.memo for expensive components
720
+ - Implement lazy loading for routes
721
+ - Optimize images and assets
722
+ - Use proper key props in lists
696
723
  `
697
724
  },
698
725
  {
699
- filename: "architecture.md",
726
+ filename: "backend.md",
700
727
  content: `---
701
728
  root: false
702
- targets: ["copilot", "cursor"]
703
- description: "Architectural patterns and project structure guidelines"
704
- globs: ["src/**/*.ts"]
729
+ targets: ["*"]
730
+ description: "Backend development rules and API guidelines"
731
+ globs: ["src/api/**/*.ts", "src/services/**/*.ts", "src/models/**/*.ts"]
705
732
  ---
706
733
 
707
- # Architecture Guidelines
734
+ # Backend Development Rules
708
735
 
709
- ## Project Structure
710
- - Organize code by feature, not by file type
711
- - Keep related files close together
712
- - Use index files for clean imports
736
+ ## API Design
713
737
 
714
- ## Design Patterns
715
- - Use dependency injection for better testability
716
- - Implement proper error handling
717
- - Follow single responsibility principle
738
+ - Follow RESTful conventions
739
+ - Use consistent HTTP status codes
740
+ - Implement proper error handling with meaningful messages
741
+ - Use API versioning when necessary
742
+
743
+ ## Database
744
+
745
+ - Use proper indexing for performance
746
+ - Implement database migrations
747
+ - Follow naming conventions for tables and columns
748
+ - Use transactions for data consistency
749
+
750
+ ## Security
751
+
752
+ - Validate all input data
753
+ - Use proper authentication and authorization
754
+ - Implement rate limiting
755
+ - Sanitize database queries to prevent SQL injection
756
+
757
+ ## Code Organization
758
+
759
+ - Use service layer pattern
760
+ - Implement proper logging
761
+ - Use environment variables for configuration
762
+ - Write comprehensive tests for business logic
718
763
  `
719
764
  }
720
765
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rulesync",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "Unified AI rules management CLI tool that generates configuration files for various AI development tools",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",