diff --git a/.cursor-init.example.yaml b/.cursor-init.example.yaml index d226311..664a3d2 100644 --- a/.cursor-init.example.yaml +++ b/.cursor-init.example.yaml @@ -2,11 +2,11 @@ # Copy this file to .cursor-init.yaml in your project root to customize documentation generation # ============================================================================= -# DOCUMENTATION TYPES - Opt-out configuration (all auto-detected by default) +# DOCUMENTATION TYPES - Opt-out configuration (AI determines relevance by default) # ============================================================================= -# Zero-config behavior: All documentation types are auto-detected and generated -# if they would be useful for your project. Set to 'false' to disable specific types. +# Zero-config behavior: AI analyzes your project and generates relevant documentation +# automatically. Only set to 'false' to explicitly disable specific types. documentation: # Core documentation (always useful for any project) @@ -15,9 +15,23 @@ documentation: onboarding: true # Developer onboarding guide adr: true # Architecture Decision Records - # Data documentation (auto-detected based on database models) + # Data documentation (generated if database models detected) data: - data_model: true # Database schema & ER diagrams (if models found) + data_model: true # Database schema & ER diagrams (auto-generated if models found) + database_ops: false # Database operations & performance guide (disabled by default) + data_security: false # Data security policies & procedures (disabled by default) + + # Infrastructure documentation (generated if deployment configs detected) + infrastructure: + deployment: false # CI/CD & deployment procedures (disabled by default) + dependencies: false # External service dependencies (disabled by default) + security: false # Security architecture & authentication flows (disabled by default) + + # Development documentation (generated if collaborative development detected) + development: + rfc: false # Request For Comments documents (disabled by default) + contributing: false # Contributor guidelines (disabled by default) + api_docs: false # API documentation (disabled by default) # ============================================================================= # TEMPLATE VARIANTS - Choose specific template styles @@ -36,6 +50,14 @@ templates: # Data model documentation data_model: "comprehensive" # Options: simple, comprehensive + # Request For Comments + rfc: "standard" # Options: minimal, standard, detailed + + # Custom template paths (optional) + custom_template_paths: + # adr: "path/to/custom/adr-template.md" + # rfc: "path/to/custom/rfc-template.md" + # ============================================================================= # PROJECT SETTINGS - Project-specific customization # ============================================================================= @@ -65,20 +87,40 @@ generation: # ============================================================================= # Zero-config (default behavior): -# - Analyzes your project automatically using AI -# - Generates useful documentation based on what's detected +# - AI analyzes your project to determine relevant documentation +# - Generates documentation automatically based on detected technologies # - Perfect for most projects - no configuration needed! +# - Core docs (architecture, onboarding, ADRs) always generated unless disabled +# - Other docs generated only if relevant technologies detected # Minimal documentation only: # documentation: # core: { architecture: true, onboarding: true, adr: true } # data: { data_model: false } +# infrastructure: { deployment: false, dependencies: false, security: false } +# development: { rfc: false, contributing: false, api_docs: false } # Open source project: +# documentation: +# core: { architecture: true, onboarding: true, adr: true } +# development: { contributing: true } # templates: # onboarding: "contributor" # Contributor-focused onboarding # Enterprise project: +# documentation: +# core: { architecture: true, onboarding: true, adr: true } +# data: { data_model: true, database_ops: true, data_security: true } +# infrastructure: { deployment: true, dependencies: true, security: true } +# development: { rfc: true, api_docs: true } # templates: # architecture: "enterprise" # adr: "full" +# rfc: "detailed" + +# Full documentation setup: +# documentation: +# core: { architecture: true, onboarding: true, adr: true } +# data: { data_model: true, database_ops: true, data_security: true } +# infrastructure: { deployment: true, dependencies: true, security: true } +# development: { rfc: true, contributing: true, api_docs: true } diff --git a/.cursor/README.md b/.cursor/README.md index 44a6a2f..c69eb38 100644 --- a/.cursor/README.md +++ b/.cursor/README.md @@ -8,7 +8,7 @@ This folder contains an intelligent documentation generation system that works s ```bash # Copy the .cursor/ folder to your project -cp -r path/to/ai-cursor-init/.cursor/ your-project/ +cp -r path/to/ai-cursor-init/.cursor/ your-project/.cursor/ # Open your project in Cursor and type: /init-docs diff --git a/.cursor/rules/cursor-init/context/adr-context.mdc b/.cursor/rules/cursor-init/context/adr-context.mdc index d778485..95263d4 100644 --- a/.cursor/rules/cursor-init/context/adr-context.mdc +++ b/.cursor/rules/cursor-init/context/adr-context.mdc @@ -1,8 +1,10 @@ --- -description: +description: When the user asks about ADRs, architecture decisions, or decision documentation globs: -alwaysApply: true +alwaysApply: false --- +# ADR Context and Best Practices + When the user asks about ADRs, architecture decisions, or decision documentation, I should provide context about: **ADR Concept:** diff --git a/.cursor/rules/cursor-init/context/architecture-context.mdc b/.cursor/rules/cursor-init/context/architecture-context.mdc index 22b3871..89f775e 100644 --- a/.cursor/rules/cursor-init/context/architecture-context.mdc +++ b/.cursor/rules/cursor-init/context/architecture-context.mdc @@ -1,8 +1,10 @@ --- -description: +description: When the user asks about architecture, system design, components, or how the system works globs: -alwaysApply: true +alwaysApply: false --- +# Architecture Context Provider + When the user asks about architecture, system design, components, or how the system works, I should: 1. Check if `docs/architecture.md` exists using the `read_file` tool diff --git a/.cursor/rules/cursor-init/context/docs-context.mdc b/.cursor/rules/cursor-init/context/docs-context.mdc index 21537e2..87da485 100644 --- a/.cursor/rules/cursor-init/context/docs-context.mdc +++ b/.cursor/rules/cursor-init/context/docs-context.mdc @@ -3,6 +3,8 @@ description: globs: alwaysApply: true --- +# Documentation Framework Context + When the user asks about documentation, available commands, or the cursor-init framework, I should provide context about: **Available Slash Commands:** @@ -26,11 +28,18 @@ When the user asks about documentation, available commands, or the cursor-init f **Framework Features:** - Template-based generation with multiple variants per document type +- Custom template support via `.cursor-init.yaml` configuration +- Default templates available in `.cursor/templates/` directory - Mermaid diagram integration for version-controlled visuals -- Language/framework detection (Python/FastAPI, TypeScript/React) -- CI integration for documentation freshness checks +- Language/framework agnostic - Zero-installation setup via Cursor rules and templates +**Template System:** +- **Default Templates**: Located in `.cursor/templates/[type]/` with template variants +- **Custom Templates**: Configure custom paths in `.cursor-init.yaml` under `templates.custom_template_paths` +- **Template Selection**: Choose variants via `templates.[type]` configuration (e.g., `templates.rfc: "detailed"`) +- **Placeholder System**: Templates use `{{PLACEHOLDER}}` syntax for dynamic content replacement + **Philosophy:** - Documentation as code - stored in version control alongside source - Living documentation that stays in sync with codebase changes diff --git a/.cursor/rules/cursor-init/diagrams/gen-arch-diagram.mdc b/.cursor/rules/cursor-init/diagrams/gen-arch-diagram.mdc index 912855d..3ea74a4 100644 --- a/.cursor/rules/cursor-init/diagrams/gen-arch-diagram.mdc +++ b/.cursor/rules/cursor-init/diagrams/gen-arch-diagram.mdc @@ -1,27 +1,27 @@ --- -description: +description: When the user types `/gen-arch-diagram` to generate system architecture diagrams from project structure globs: -alwaysApply: true +alwaysApply: false --- -@if(user_message.starts_with("/gen-arch-diagram")) { - "I will generate a system architecture diagram from your project's structure. +# Generate Architecture Diagram - 1. **Analyzing Project Structure:** I will examine your project's top-level directories to identify the main components and their roles. +I will generate a system architecture diagram from your project's structure. - 2. **Component Classification:** I will classify each directory based on its name and contents: - - Documentation directories (docs, documentation) - - CLI/Command directories (cli, cmd, commands) - - Template directories (templates, template) - - Source code directories (src, source) - - Frontend/UI directories (frontend, ui, web) - - Backend directories (backend, server, app) - - Database/Model directories (database, db, models) +1. **Analyzing Project Structure:** I will examine your project's top-level directories to identify the main components and their roles. - 3. **Generating Mermaid Architecture Diagram:** Based on the identified components, I will create a Mermaid `graph TD` (Top-Down) flowchart showing the main architectural components and their relationships. +2. **Component Classification:** I will classify each directory based on its name and contents: + - Documentation directories (docs, documentation) + - CLI/Command directories (cli, cmd, commands) + - Template directories (templates, template) + - Source code directories (src, source) + - Frontend/UI directories (frontend, ui, web) + - Backend directories (backend, server, app) + - Database/Model directories (database, db, models) - 4. **Suggesting Integration:** If `docs/architecture.md` exists, I will suggest adding the diagram to that file for better documentation. +3. **Generating Mermaid Architecture Diagram:** Based on the identified components, I will create a Mermaid `graph TD` (Top-Down) flowchart showing the main architectural components and their relationships. - Let me start by analyzing your project structure..." +4. **Suggesting Integration:** If `docs/architecture.md` exists, I will suggest adding the diagram to that file for better documentation. - I will use the `list_dir` tool to examine the project structure, then use `edit_file` to create or suggest updates to architecture documentation. -} +Let me start by analyzing your project structure... + +I will use the `list_dir` tool to examine the project structure, then use `edit_file` to create or suggest updates to architecture documentation. diff --git a/.cursor/rules/cursor-init/diagrams/gen-dependency-diagram.mdc b/.cursor/rules/cursor-init/diagrams/gen-dependency-diagram.mdc index 83a2dc9..abe18ae 100644 --- a/.cursor/rules/cursor-init/diagrams/gen-dependency-diagram.mdc +++ b/.cursor/rules/cursor-init/diagrams/gen-dependency-diagram.mdc @@ -1,5 +1,5 @@ --- -description: When the user types `/gen-dependency-diagram` +description: When the user types `/gen-dependency-diagram` to generate diagrams showing external dependencies and service integrations globs: alwaysApply: false --- diff --git a/.cursor/rules/cursor-init/diagrams/gen-deployment-diagram.mdc b/.cursor/rules/cursor-init/diagrams/gen-deployment-diagram.mdc index 277c9d3..64a94f6 100644 --- a/.cursor/rules/cursor-init/diagrams/gen-deployment-diagram.mdc +++ b/.cursor/rules/cursor-init/diagrams/gen-deployment-diagram.mdc @@ -1,5 +1,5 @@ --- -description: When the user types `/gen-deployment-diagram` +description: When the user types `/gen-deployment-diagram` to generate deployment diagrams using infrastructure components globs: alwaysApply: false --- diff --git a/.cursor/rules/cursor-init/diagrams/gen-er-diagram.mdc b/.cursor/rules/cursor-init/diagrams/gen-er-diagram.mdc index f3bdeed..24a8f95 100644 --- a/.cursor/rules/cursor-init/diagrams/gen-er-diagram.mdc +++ b/.cursor/rules/cursor-init/diagrams/gen-er-diagram.mdc @@ -1,28 +1,30 @@ --- -description: +description: When the user types `/gen-er-diagram` to generate entity relationship diagrams from database models globs: -alwaysApply: true +alwaysApply: false --- -@if(user_message.starts_with("/gen-er-diagram")) { - "I will generate an ER diagram from database models found in your project. +# Generate ER Diagram - 1. **Scanning for SQLAlchemy Models:** I will search your codebase for database model definitions using semantic search and grep patterns to find files containing model imports and model classes. +I will generate an ER diagram from database models found in your project, respecting your configuration. - 2. **Extracting Schema Information:** I will analyze the found models to extract: - - Table names and their corresponding classes - - Column names, data types, and constraints - - Primary key relationships - - Foreign key relationships between tables +1. **Check Configuration:** I will first read `.cursor-init.yaml` to verify if `documentation.data.data_model` is explicitly disabled. If disabled (`false`), I will inform you that ER diagram generation is disabled for this project. - 3. **Check Template Configuration:** I will read `.cursor-init.yaml` to determine which data model template variant to use: - - `simple` - Basic ER diagram with entity overview - - `comprehensive` (default) - Detailed data model with full database documentation +2. **Scanning for SQLAlchemy Models:** If not disabled, I will search your codebase for database model definitions using semantic search and grep patterns to find files containing model imports and model classes. - 4. **Generating Mermaid ER Diagram:** Based on the extracted schema information, I will create a valid Mermaid `erDiagram` with proper syntax for entities, attributes, and relationships. +3. **Extracting Schema Information:** I will analyze the found models to extract: + - Table names and their corresponding classes + - Column names, data types, and constraints + - Primary key relationships + - Foreign key relationships between tables - 5. **Storing the Diagram:** The generated diagram will be saved to `docs/data-model.md` using the configured data model template variant, creating the file if it doesn't exist or overwriting it if it does. +4. **Check Template Configuration:** I will use the configuration from `.cursor-init.yaml` to determine which data model template variant to use: + - `simple` - Basic ER diagram with entity overview + - `comprehensive` (default) - Detailed data model with full database documentation - Let me start by searching for database models in your project..." +5. **Generating Mermaid ER Diagram:** Based on the extracted schema information, I will create a valid Mermaid `erDiagram` with proper syntax for entities, attributes, and relationships. - I will use the `codebase_search` and `grep_search` tools to find SQLAlchemy models, then use `read_file` to check template configuration, and `edit_file` to create the ER diagram documentation using the appropriate template variant. -} \ No newline at end of file +6. **Storing the Diagram:** The generated diagram will be saved to `docs/data-model.md` using the configured data model template variant, creating the file if it doesn't exist or overwriting it if it does (unless `documentation.data.data_model` is disabled). + +Let me start by checking your configuration and searching for database models in your project... + +I will first use the `read_file` tool to check `.cursor-init.yaml` configuration, then if data model documentation is not disabled, I'll use `codebase_search` and `grep_search` tools to find SQLAlchemy models, and `edit_file` to create the ER diagram documentation using the appropriate template variant. \ No newline at end of file diff --git a/.cursor/rules/cursor-init/diagrams/gen-onboarding-diagram.mdc b/.cursor/rules/cursor-init/diagrams/gen-onboarding-diagram.mdc index f795bc7..c15b0c9 100644 --- a/.cursor/rules/cursor-init/diagrams/gen-onboarding-diagram.mdc +++ b/.cursor/rules/cursor-init/diagrams/gen-onboarding-diagram.mdc @@ -1,5 +1,5 @@ --- -description: When the user types `/gen-onboarding-diagram` +description: When the user types `/gen-onboarding-diagram` to create developer onboarding and setup workflow diagrams globs: alwaysApply: false --- diff --git a/.cursor/rules/cursor-init/diagrams/gen-security-diagram.mdc b/.cursor/rules/cursor-init/diagrams/gen-security-diagram.mdc index 859041b..dd15df6 100644 --- a/.cursor/rules/cursor-init/diagrams/gen-security-diagram.mdc +++ b/.cursor/rules/cursor-init/diagrams/gen-security-diagram.mdc @@ -1,5 +1,5 @@ --- -description: When the user types `/gen-security-diagram` +description: When the user types `/gen-security-diagram` to generate diagrams using the codebase security-related features globs: alwaysApply: false --- diff --git a/.cursor/rules/cursor-init/documentation/adr.mdc b/.cursor/rules/cursor-init/documentation/adr.mdc index d3f8283..0acbbeb 100644 --- a/.cursor/rules/cursor-init/documentation/adr.mdc +++ b/.cursor/rules/cursor-init/documentation/adr.mdc @@ -1,18 +1,21 @@ --- -description: +description: When the user types `/adr` to generate a new Architecture Decision Record globs: -alwaysApply: true +alwaysApply: false --- # ADR Creation Command When user types `/adr` followed by a title, create a new Architecture Decision Record: ## Process -1. **Extract Title**: Get text after `/adr` or use `untitled-adr` as default -2. **Determine Number**: Check `docs/adr/` directory for highest existing ADR number and increment -3. **Select Template**: Check `.cursor-init.yaml` for template variant (nygard_style, full, lightweight, madr) -4. **Gather Context**: Use codebase search to find relevant information for the ADR topic -5. **Create File**: Generate ADR in `docs/adr/` with format `000X-sanitized-title.md` +1. **Check Configuration**: First verify if `documentation.core.adr` is explicitly disabled in `.cursor-init.yaml`. If disabled (`false`), inform that ADR creation is disabled for this project. +2. **Extract Title**: Get text after `/adr` or use `untitled-adr` as default +3. **Determine Number**: Check `docs/adr/` directory for highest existing ADR number and increment +4. **Select Template**: Check `.cursor-init.yaml` for template variant (nygard_style, full, lightweight, madr) +5. **Load Template**: Read the appropriate template file from `.cursor/templates/adr/` or use a custom template path if configured +6. **Gather Context**: Use codebase search to find relevant information for the ADR topic +7. **Replace Placeholders**: Populate the template with the title, number, and context information +8. **Create File**: Generate ADR in `docs/adr/` with format `000X-sanitized-title.md` (unless ADR documentation is disabled) ## Template Configuration ```yaml diff --git a/.cursor/rules/cursor-init/documentation/check-docs.mdc b/.cursor/rules/cursor-init/documentation/check-docs.mdc index cb78d0d..d4aea92 100644 --- a/.cursor/rules/cursor-init/documentation/check-docs.mdc +++ b/.cursor/rules/cursor-init/documentation/check-docs.mdc @@ -1,12 +1,13 @@ --- -description: +description: When the user types `/check-docs` to validate documentation freshness and completeness globs: -alwaysApply: true +alwaysApply: false --- -@if(user_message.starts_with("/check-docs")) { - "I will check your documentation for freshness and completeness issues. +# Check Documentation - **Running documentation validation...** +I will check your documentation for freshness and completeness issues. + +**Running documentation validation...** I will: 1. **Scan Documentation**: Search all `.md` files in the `docs/` directory for placeholder text @@ -29,4 +30,3 @@ alwaysApply: true - `docs/adr/0001-record-architecture-decisions.md` Then I will provide a comprehensive report of any issues found or confirm that documentation is up-to-date. -} diff --git a/.cursor/rules/cursor-init/documentation/init-docs.mdc b/.cursor/rules/cursor-init/documentation/init-docs.mdc index 9b34dc6..ef8af49 100644 --- a/.cursor/rules/cursor-init/documentation/init-docs.mdc +++ b/.cursor/rules/cursor-init/documentation/init-docs.mdc @@ -1,26 +1,44 @@ --- -description: +description: When the user types `/init-docs` to scaffold initial project documentation structure globs: -alwaysApply: true +alwaysApply: false --- -@if(user_message.starts_with("/init-docs")) { - "I will initialize project documentation by creating essential documentation files. +# Initialize Documentation - 1. **Check Existing Files:** I will first check for the existence of `docs/architecture.md`, `docs/adr/0001-record-architecture-decisions.md`, `docs/onboarding.md`, and `docs/data-model.md`. +I will initialize project documentation by creating essential documentation files based on your configuration. - 2. **Create Documentation Structure:** I will create the `docs/` directory and `docs/adr/` subdirectory if they don't exist. +1. **Read Configuration:** I will first check for `.cursor-init.yaml` to understand which documentation types are explicitly disabled. - 3. **Generate Documentation Files:** For each missing file, I will create it with appropriate template content: - - `docs/architecture.md` - System architecture overview - - `docs/adr/0001-record-architecture-decisions.md` - Initial ADR about adopting ADRs - - `docs/onboarding.md` - Project setup and onboarding guide - - `docs/data-model.md` - Entity relationship diagram (placeholder or generated from models) +2. **Framework Detection:** I will use codebase search to detect the project's technology stack and determine which documentation types are relevant: + - **Core Documentation** (always relevant): architecture, onboarding, adr + - **Onboarding Documentation** (always relevant): project explanation, first steps, setup + - **Data Documentation** (if database models found): data_model, database_ops, data_security + - **Infrastructure Documentation** (if deployment configs found): deployment, dependencies, security + - **Development Documentation** (if collaborative project detected): rfc, contributing, api_docs - 4. **Framework Detection:** I will use codebase search to detect the project's technology stack and customize the templates accordingly. +3. **Filter by Configuration:** I will check which relevant documentation types are explicitly disabled and skip those. - If any of these files already exist, I will ask for your confirmation before overwriting them. - - Let me start by checking what documentation files already exist..." +4. **Check Existing Files:** I will check for the existence of relevant documentation files (unless disabled): + - `docs/architecture.md` (unless `documentation.core.architecture: false`) + - `docs/adr/0001-record-architecture-decisions.md` (unless `documentation.core.adr: false`) + - `docs/onboarding.md` (unless `documentation.core.onboarding: false`) + - `docs/data-model.md` (if models detected, unless `documentation.data.data_model: false`) + - Additional files based on project analysis - I will use the `list_dir` tool to check existing files and `edit_file` to create the documentation structure. -} +5. **Create Documentation Structure:** I will create the `docs/` directory and required subdirectories if they don't exist. + +6. **Load Templates:** For each relevant documentation type (not disabled), I will read the appropriate template file from `.cursor/templates/` or use custom template paths if configured. + +7. **Generate Documentation Files:** For each missing file that is relevant to the project and not disabled, I will create it using the loaded template with appropriate placeholder replacements. + +**Configuration Handling (Opt-Out Behavior):** +- If `.cursor-init.yaml` doesn't exist, I will generate all relevant documentation based on project analysis +- Documentation is generated by default if relevant to the project +- Only explicitly disabled types (`false` in config) will be skipped +- AI determines relevance, configuration only disables + +If any of these files already exist, I will ask for your confirmation before overwriting them. + +Let me start by reading your configuration and checking what documentation files already exist... + +I will use the `read_file` tool to check `.cursor-init.yaml` configuration first, then `list_dir` to check existing files and `edit_file` to create the documentation structure according to your enabled settings. diff --git a/.cursor/rules/cursor-init/documentation/proactive-doc-suggest.mdc b/.cursor/rules/cursor-init/documentation/proactive-doc-suggest.mdc index c95411b..36df907 100644 --- a/.cursor/rules/cursor-init/documentation/proactive-doc-suggest.mdc +++ b/.cursor/rules/cursor-init/documentation/proactive-doc-suggest.mdc @@ -1,10 +1,11 @@ --- -description: +description: When the user mentions completion of work (done, finished, completed) or when recent changes need documentation review globs: -alwaysApply: true +alwaysApply: false --- -@if(context.includes("@RecentChanges") || user_message.includes("done") || user_message.includes("finished") || user_message.includes("completed")) { - "I notice there have been recent changes to your codebase. Let me check if any documentation might need updating based on these changes. +# Proactive Documentation Suggestions + +I notice there have been recent changes to your codebase. Let me check if any documentation might need updating based on these changes. **Analyzing Recent Changes for Documentation Impact:** @@ -21,7 +22,6 @@ alwaysApply: true - 'I noticed changes in your API routes or core modules. Perhaps the architecture documentation needs an update? You can use `/update-docs`.' - 'I see you've added new dependencies or changed the project structure. Consider updating the onboarding documentation.' - I will only make suggestions when relevant changes are detected and will phrase them as helpful reminders rather than intrusive notifications. If no documentation-relevant changes are detected, I will not make any suggestions." + I will only make suggestions when relevant changes are detected and will phrase them as helpful reminders rather than intrusive notifications. If no documentation-relevant changes are detected, I will not make any suggestions. I will use the `grep_search` and `codebase_search` tools to analyze recent changes and determine if documentation updates are needed, then provide specific, actionable suggestions. -} diff --git a/.cursor/rules/cursor-init/documentation/rfc.mdc b/.cursor/rules/cursor-init/documentation/rfc.mdc index 30fa239..bb324b0 100644 --- a/.cursor/rules/cursor-init/documentation/rfc.mdc +++ b/.cursor/rules/cursor-init/documentation/rfc.mdc @@ -1,31 +1,31 @@ --- -description: +description: When the user types `/rfc` followed by a title to create Request For Comments documents globs: -alwaysApply: true +alwaysApply: false --- -@if(user_message.starts_with("/rfc")) { - "I will create a new RFC (Request For Comments) document based on your input. +# Create RFC Document - 1. **Extracting and Sanitizing the Title:** I will extract the text after `/rfc`. If no text is provided, I will use `new-rfc` as the default title. I will then sanitize this title to be lowercase and kebab-case for the filename, and also refine it for clarity and conciseness for the document's main title. +I will create a new RFC (Request For Comments) document based on your input, respecting your configuration. - 2. **Creating the RFC Directory:** I will ensure the `docs/rfc/` directory exists, creating it if necessary. + 1. **Check Configuration:** I will first read `.cursor-init.yaml` to verify if `documentation.development.rfc` is explicitly disabled. If disabled (`false`), I will inform you that RFC creation is disabled for this project. - 3. **Generating the RFC Content:** I will populate the new file with the following RFC template. I will replace `[Title]` with the refined title from the user input. + 2. **Extracting and Sanitizing the Title:** If not disabled, I will extract the text after `/rfc`. If no text is provided, I will use `new-rfc` as the default title. I will then sanitize this title to be lowercase and kebab-case for the filename, and also refine it for clarity and conciseness for the document's main title. - ``` - ### RFC: [Title] + 3. **Creating the RFC Directory:** I will ensure the `docs/rfc/` directory exists, creating it if necessary. - **Problem Statement:** - [Describe the problem or opportunity that this RFC addresses.] + 4. **Select Template:** I will check `.cursor-init.yaml` for the RFC template variant: + - `minimal` - Basic RFC with core sections + - `standard` (default) - Standard RFC with all common sections + - `detailed` - Comprehensive RFC with extensive planning sections - **Proposed Solution:** - [Describe the proposed solution or approach to address the problem.] + 5. **Load Template:** I will read the appropriate template file from `.cursor/templates/rfc/` or use a custom template path if configured. - **Discussion:** - [Include any additional considerations, alternatives considered, implementation notes, or open questions.] - ``` + 6. **Replace Placeholders:** I will populate the template with the user's title and default placeholder values for sections like: + - `{{RFC_TITLE}}` - The sanitized title + - `{{DATE}}` - Current date + - `{{STATUS}}` - Default status (Draft) + - Other placeholders as defined in the template - 4. **Creating the File:** Finally, I will create the new RFC file in the `docs/rfc/` directory using the `edit_file` tool. The filename will be constructed using the sanitized title (e.g., `docs/rfc/my-new-feature.md`). + 7. **Creating the File:** Finally, I will create the new RFC file in the `docs/rfc/` directory using the `edit_file` tool (unless RFC documentation is disabled). The filename will be constructed using the sanitized title (e.g., `docs/rfc/my-new-feature.md`). - Please provide a brief title for the RFC after `/rfc`. If you provide no title, I will use `new-rfc` as a default." -} + Please provide a brief title for the RFC after `/rfc`. If you provide no title, I will use `new-rfc` as a default. diff --git a/.cursor/rules/cursor-init/documentation/sync-category.mdc b/.cursor/rules/cursor-init/documentation/sync-category.mdc index b65bf52..f1b4467 100644 --- a/.cursor/rules/cursor-init/documentation/sync-category.mdc +++ b/.cursor/rules/cursor-init/documentation/sync-category.mdc @@ -1,35 +1,39 @@ --- -description: +description: When the user types `/sync-category [category]` to sync all files in a documentation category globs: -alwaysApply: true +alwaysApply: false --- -@if(user_message.starts_with("/sync-category")) { - "I will sync all documentation files within the specified category. +# Sync Documentation Category + +I will sync documentation files within the specified category, respecting your configuration settings. 1. **Parse Category Name:** I will extract the category from your message (format: `/sync-category [category]`). - 2. **Identify Category Files:** I will locate all files within the specified category directory. + 2. **Check Configuration:** I will read `.cursor-init.yaml` to verify if the requested category is enabled before proceeding. + + 3. **Identify Category Files:** I will locate files within the specified category directory only if the category is enabled. - 3. **Analyze Category State:** I will check if files within the category need updating based on current project state. + 4. **Analyze Category State:** I will check if enabled files within the category need updating based on current project state. - 4. **Apply Updates:** I will update all files in the category using appropriate templates and current project information. + 5. **Apply Updates:** I will update files only if the category is enabled in configuration. - 5. **Provide Summary:** I will report the outcome of the synchronization for the entire category. + 6. **Provide Summary:** I will report the outcome, including any skipped categories due to configuration. Please provide the category name in the format: `/sync-category [category]` - **Available Categories:** - - `adr` - Architecture Decision Records - - `onboarding` - Onboarding documentation - - `architecture` - Architecture documentation - - `data-model` - Data model documentation + **Available Categories (based on .cursor-init.yaml):** + - `core` - Core documentation (architecture, onboarding, adr) + - `data` - Data documentation (data_model, database_ops, data_security) + - `infrastructure` - Infrastructure documentation (deployment, dependencies, security) + - `development` - Development documentation (rfc, contributing, api_docs) **Examples:** - - `/sync-category adr` - Updates all ADR files - - `/sync-category onboarding` - Updates onboarding documentation - - `/sync-category architecture` - Updates architecture documentation + - `/sync-category core` - Updates enabled core documentation files + - `/sync-category data` - Updates enabled data documentation files + - `/sync-category infrastructure` - Updates enabled infrastructure documentation files + + **Note:** Only enabled documentation types within each category will be processed. - Let me process your request..." + Let me process your request... - I will parse the user's message to extract the category name, then use the `list_dir`, `codebase_search`, `read_file`, and `edit_file` tools to locate all files within the specified category, analyze their current state against the codebase, and apply necessary updates using appropriate templates to keep the entire category synchronized. -} + I will parse the user's message to extract the category name, check `.cursor-init.yaml` configuration first, then use the `read_file`, `list_dir`, `codebase_search`, and `edit_file` tools to locate enabled files within the specified category, analyze their current state against the codebase, and apply necessary updates using appropriate templates to keep only the enabled documentation types synchronized. diff --git a/.cursor/rules/cursor-init/documentation/sync-doc.mdc b/.cursor/rules/cursor-init/documentation/sync-doc.mdc index aa28a78..c73b338 100644 --- a/.cursor/rules/cursor-init/documentation/sync-doc.mdc +++ b/.cursor/rules/cursor-init/documentation/sync-doc.mdc @@ -1,28 +1,33 @@ --- -description: +description: When the user types `/sync-doc [document_name]` to sync a specific documentation file globs: -alwaysApply: true +alwaysApply: false --- -@if(user_message.starts_with("/sync-doc")) { - "I will sync a specific documentation file with the current codebase state. +# Sync Specific Document + +I will sync a specific documentation file with the current codebase state, respecting your configuration. 1. **Parse Document Name:** I will extract the document name from your message (format: `/sync-doc [document_name]`). - 2. **Locate File:** I will search for the specified file in the documentation directory structure. + 2. **Check Configuration:** I will read `.cursor-init.yaml` to verify if the document type is enabled before proceeding. + + 3. **Locate File:** I will search for the specified file in the documentation directory structure only if it's enabled. - 3. **Analyze File State:** I will check if the file needs updating based on current project state. + 4. **Analyze File State:** I will check if the enabled file needs updating based on current project state. - 4. **Apply Updates:** I will update the specific file using the appropriate template and current project information. + 5. **Apply Updates:** I will update the specific file only if the corresponding documentation type is enabled in configuration. - 5. **Provide Feedback:** I will report the outcome of the synchronization for the specific file. + 6. **Provide Feedback:** I will report the outcome, including any skipped documents due to configuration settings. Please provide the document name in the format: `/sync-doc [document_name]` Examples: - - `/sync-doc architecture.md` - - `/sync-doc onboarding.md` - - `/sync-doc 0001-record-architecture-decisions.md` + - `/sync-doc architecture.md` (if `documentation.core.architecture: true`) + - `/sync-doc onboarding.md` (if `documentation.core.onboarding: true`) + - `/sync-doc data-model.md` (if `documentation.data.data_model: true`) + - `/sync-doc 0001-record-architecture-decisions.md` (if `documentation.core.adr: true`) + + **Note:** Only documents with enabled configuration will be processed. - Let me process your request..." + Let me process your request... - I will parse the users message to extract the document name, then use the `codebase_search`, `read_file`, and `edit_file` tools to locate the specific file, analyze its current state, and apply necessary updates using the appropriate templates to keep it synchronized with the codebase. -} + I will parse the users message to extract the document name, check `.cursor-init.yaml` to verify it's enabled, then use the `read_file`, `codebase_search`, and `edit_file` tools to locate the specific file, analyze its current state, and apply necessary updates using the appropriate templates to keep it synchronized with the codebase (only if enabled). diff --git a/.cursor/rules/cursor-init/documentation/sync-docs.mdc b/.cursor/rules/cursor-init/documentation/sync-docs.mdc index 37ba334..11286ab 100644 --- a/.cursor/rules/cursor-init/documentation/sync-docs.mdc +++ b/.cursor/rules/cursor-init/documentation/sync-docs.mdc @@ -1,21 +1,33 @@ --- -description: +description: When the user types `/sync-docs` to synchronize all documentation with current codebase globs: -alwaysApply: true +alwaysApply: false --- -@if(user_message.starts_with("/sync-docs")) { - "I will sync all documentation files with the current codebase state. +# Sync Documentation - **Initiating full documentation synchronization. This may take a moment...** +I will sync all relevant documentation files with the current codebase state, generating documentation based on project analysis unless explicitly disabled in your configuration. - I will: - 1. **Analyze Current Codebase:** Detect languages, frameworks, and project structure using codebase search - 2. **Check Documentation Status:** Compare existing docs with current code state - 3. **Update Missing Files:** Create any missing core documentation files using templates - 4. **Refresh Diagrams:** Update ER diagrams from SQLAlchemy models if present - 5. **Sync Content:** Ensure documentation reflects current project configuration +**Initiating full documentation synchronization. This may take a moment...** - Let me run the synchronization process..." + I will: + 1. **Read Configuration:** Check `.cursor-init.yaml` to understand which documentation types are explicitly disabled + 2. **Analyze Current Codebase:** Detect languages, frameworks, and project structure using codebase search + 3. **Determine Relevant Documentation:** Based on project analysis, identify which documentation types are relevant: + - Core: architecture, onboarding, adr (always relevant) + - Data: data_model, database_ops, data_security (if database/models detected) + - Infrastructure: deployment, dependencies, security (if deployment configs detected) + - Development: rfc, contributing, api_docs (if collaborative development detected) + 4. **Filter by Configuration:** Skip any relevant documentation types that are explicitly disabled (`false` in config) + 5. **Check Documentation Status:** Compare existing relevant docs with current code state + 6. **Load Templates:** For each relevant documentation type (not disabled), load the appropriate template: + - Read from custom template paths if configured in `templates.custom_template_paths` + - Fall back to default templates in `.cursor/templates/[type]/` + - Use template variant specified in `templates.[type]` configuration + 7. **Update Relevant Files:** Create/update documentation files that are relevant to the project and not disabled + 8. **Replace Placeholders:** For each document, replace template placeholders with current project information + 9. **Refresh Diagrams:** Update ER diagrams from database models unless data_model is disabled + 10. **Sync Content:** Ensure documentation reflects current project configuration and relevant features - I will use the `codebase_search`, `list_dir`, `read_file`, and `edit_file` tools to analyze the current project state, detect what documentation needs updating, and apply necessary changes to keep documentation in sync with the codebase. -} + Let me run the synchronization process... + + I will use the `read_file` tool to check configuration first, then `codebase_search`, `list_dir`, and `edit_file` tools to analyze the current project state, detect what documentation is relevant to the project, and apply necessary changes to keep all relevant documentation (unless disabled) in sync with the codebase. diff --git a/.cursor/rules/cursor-init/documentation/update-docs.mdc b/.cursor/rules/cursor-init/documentation/update-docs.mdc index 7942e3c..cfbc53d 100644 --- a/.cursor/rules/cursor-init/documentation/update-docs.mdc +++ b/.cursor/rules/cursor-init/documentation/update-docs.mdc @@ -1,26 +1,35 @@ --- -description: +description: When the user types `/update-docs` to analyze and suggest documentation updates globs: -alwaysApply: true +alwaysApply: false --- -@if(user_message.starts_with("/update-docs")) { - "I will analyze the current codebase and documentation to suggest updates. +# Update Documentation - 1. **Check Documentation Freshness:** I will examine the existing documentation files and compare them with the current codebase state. +I will analyze the current codebase and determine which documentation is relevant, then suggest updates unless explicitly disabled in your configuration. - 2. **Data Model Analysis:** I will check if `docs/data-model.md` exists and whether SQLAlchemy models have been modified since the last ER diagram generation. If models have changed or if the file doesn't exist, I will suggest running `/gen-er-diagram` to update the data model documentation. + 1. **Read Configuration:** I will first check `.cursor-init.yaml` to understand which documentation types are explicitly disabled. - 3. **Architecture Documentation:** I will verify that `docs/architecture.md` reflects the current project structure and technology stack. + 2. **Analyze Project Relevance:** I will examine the codebase to determine which documentation types are relevant to your project based on detected technologies, frameworks, and project structure. - 4. **ADR Review:** I will check if any new architectural decisions should be documented based on recent code changes. + 3. **Check Documentation Freshness:** I will examine the relevant documentation files (unless disabled) and compare them with the current codebase state. - 5. **Onboarding Guide:** I will ensure the onboarding documentation is current with the latest setup requirements. + 4. **Load Current Templates:** For each relevant documentation type (not disabled), read the current template configuration: + - Check for custom template paths in `templates.custom_template_paths` + - Load default templates from `.cursor/templates/[type]/` if no custom paths + - Identify template variants from `templates.[type]` configuration - 6. **Missing Documentation Detection:** I will identify any missing core documentation files that should exist based on the project structure. + 5. **Conditional Analysis Based on Project Relevance:** + - **Data Model Analysis** (if models detected, unless `documentation.data.data_model: false`): Check if `docs/data-model.md` exists and whether database/ORM models have been modified. Suggest `/gen-er-diagram` if needed. + - **Architecture Documentation** (unless `documentation.core.architecture: false`): Verify that `docs/architecture.md` reflects current project structure. + - **ADR Review** (unless `documentation.core.adr: false`): Check if new architectural decisions should be documented. + - **Onboarding Guide** (unless `documentation.core.onboarding: false`): Ensure onboarding documentation is current. + - **Infrastructure Docs** (if deployment configs detected, unless disabled): Check deployment, dependencies, security documentation. + - **Development Docs** (if collaborative project detected, unless disabled): Review RFC, contributing, API documentation. - 7. **Content Staleness Analysis:** I will analyze whether existing documentation content aligns with the current codebase structure and dependencies. + 6. **Missing Documentation Detection:** Identify missing documentation files for relevant types (unless disabled). - Let me analyze your project and provide specific recommendations for documentation updates..." + 7. **Content Staleness Analysis:** Analyze relevant documentation (unless disabled) for alignment with current codebase. - I will use the `codebase_search`, `list_dir`, `grep_search`, and `read_file` tools to examine the current state and provide a detailed report with specific recommendations for updates. -} \ No newline at end of file + Let me analyze your project and provide specific recommendations for relevant documentation updates... + + I will use the `read_file` tool to check configuration first, then `codebase_search`, `list_dir`, `grep_search`, and `read_file` tools to examine the current state and provide a detailed report with specific recommendations for updates to all relevant documentation types (unless explicitly disabled). \ No newline at end of file diff --git a/.cursor/rules/cursor-init/templates/add-template.mdc b/.cursor/rules/cursor-init/templates/add-template.mdc index 79fe844..02421fa 100644 --- a/.cursor/rules/cursor-init/templates/add-template.mdc +++ b/.cursor/rules/cursor-init/templates/add-template.mdc @@ -1,10 +1,11 @@ --- -description: +description: When the user types `/add-template` to add custom documentation templates globs: -alwaysApply: true +alwaysApply: false --- -@if(user_message.starts_with("/add-template")) { - "I will add a custom documentation template to your local cursor-init configuration. +# Add Custom Template + +I will add a custom documentation template to your local cursor-init configuration. 1. **Parse Template Information:** I will extract the template name and path from your message (format: `/add-template TemplateName path/to/template.md`). @@ -20,7 +21,6 @@ alwaysApply: true Please provide the template name and path in the format: `/add-template TemplateName path/to/template.md` - Let me process your request..." + Let me process your request... I will parse the user's message to extract the template name and path, validate the template file exists, read the current configuration, check for duplicates, and update the `.cursor-init.yaml` file with the new custom template entry using proper YAML formatting. -} diff --git a/.cursor/rules/cursor-init/templates/list-templates.mdc b/.cursor/rules/cursor-init/templates/list-templates.mdc index f91418c..03ebf33 100644 --- a/.cursor/rules/cursor-init/templates/list-templates.mdc +++ b/.cursor/rules/cursor-init/templates/list-templates.mdc @@ -1,10 +1,11 @@ --- -description: +description: When the user types `/list-templates` to see all available documentation templates globs: -alwaysApply: true +alwaysApply: false --- -@if(user_message.starts_with("/list-templates")) { - "I will list all available documentation templates, including both default templates and any custom templates configured in your project. +# List Available Templates + +I will list all available documentation templates, including both default templates and any custom templates configured in your project. 1. **Scan Default Templates:** I will examine the `templates/` directory to identify all available default template categories and their variants. @@ -12,7 +13,6 @@ alwaysApply: true 3. **Present Organized List:** I will display the templates organized by category, showing both default and custom options with their descriptions and paths. - Let me scan your project's template library..." + Let me scan your project's template library... I will use the `list_dir` tool to examine the templates directory structure and the `read_file` tool to check for custom template configurations in `.cursor-init.yaml`. -} diff --git a/CHANGELOG.md b/CHANGELOG.md index f85a212..eb331bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,46 @@ All notable changes to this project will be documented in this file. +## [0.7.0] - 2025-06-16 + +### Added + +- **AI-Driven Documentation Generation**: Intelligent analysis of project structure to determine relevant documentation types +- **True Opt-Out Configuration**: Zero-config operation with ability to disable specific documentation types +- **Template System Integration**: Proper template loading from `.cursor/templates/` with variant support +- **Custom Template Paths**: Support for user-defined template locations and custom templates +- **Placeholder Replacement System**: Dynamic content replacement using `{{PLACEHOLDER}}` syntax +- **Comprehensive Configuration Examples**: Updated `.cursor-init.example.yaml` with all documentation types and usage examples + +### Changed + +- **Token Optimization**: Reduced token usage by ~90% by converting 20+ rules from always-applied to agent-requestable +- **Rule Loading**: Only 2 essential rules remain always-applied, others loaded on-demand based on context +- **Documentation Behavior**: Changed from "opt-in" to "opt-out" - AI determines relevance, users can disable +- **Template Loading**: RFC and ADR commands now use proper template system instead of hardcoded content +- **Configuration Structure**: Enhanced YAML structure with clear categorization (core, data, infrastructure, development) +- **Command Behavior**: All slash commands now respect `.cursor-init.yaml` configuration settings + +### Fixed + +- **Template System**: RFC and ADR commands now properly load templates with variants +- **Configuration Respect**: All commands now check configuration before generating documentation +- **Copy Command**: Fixed incorrect copy command in README (`cp -r path/to/ai-cursor-init/.cursor/ your-project/.cursor/`) +- **Consistent Language**: Unified "opt-out" terminology across all rules and documentation + +### Performance + +- **Memory Usage**: Reduced memory footprint through on-demand rule loading +- **Load Time**: Faster rule processing and template loading +- **Token Efficiency**: Massive reduction in token consumption while maintaining full functionality + +### Documentation + +- **Rule Descriptions**: Added YAML frontmatter with clear descriptions for when each rule should be used +- **Template Variants**: Documented all available template options and customization paths +- **AI Behavior**: Clear explanation of AI-driven relevance detection and opt-out semantics +- **Migration Guide**: Comprehensive guidance for existing users (no breaking changes) + ## [0.6.0] - 2025-06-15 ### Removed