chiron 0.1.0 → 0.2.1

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +84 -24
  3. data/CLAUDE.md +30 -1
  4. data/Gemfile.lock +1 -1
  5. data/README.md +51 -8
  6. data/docs/development_journal.md +84 -1
  7. data/lib/chiron/cli.rb +144 -20
  8. data/lib/chiron/project_config.rb +95 -0
  9. data/lib/chiron/templates/python/CLAUDE.md.erb +192 -0
  10. data/lib/chiron/templates/python/commands/conventions/python.md +330 -0
  11. data/lib/chiron/templates/python/commands/quality/python-testing.md +578 -0
  12. data/lib/chiron/templates/python/commands/workflows/debug-python.md +222 -0
  13. data/lib/chiron/templates/python/commands/workflows/flask-development.md +667 -0
  14. data/lib/chiron/templates/python/commands/workflows/python-refactor.md +336 -0
  15. data/lib/chiron/templates/shared/commands/context/branch-context.md +176 -0
  16. data/lib/chiron/templates/{commands → shared/commands}/context/catchup.md +6 -1
  17. data/lib/chiron/templates/{commands → shared/commands}/context/quickstart.md +8 -3
  18. data/lib/chiron/templates/shared/commands/workflows/branch-management.md +256 -0
  19. data/lib/chiron/templates/{development_journal.md.erb → shared/development_journal.md.erb} +9 -3
  20. data/lib/chiron/version.rb +1 -1
  21. data/lib/chiron.rb +1 -0
  22. metadata +27 -18
  23. /data/lib/chiron/templates/{CLAUDE.md.erb → rails/CLAUDE.md.erb} +0 -0
  24. /data/lib/chiron/templates/{commands → rails/commands}/conventions/rails.md +0 -0
  25. /data/lib/chiron/templates/{claude → shared/claude}/settings.json +0 -0
  26. /data/lib/chiron/templates/{commands → shared/commands}/context/prime.md +0 -0
  27. /data/lib/chiron/templates/{commands → shared/commands}/journal/instructions.md +0 -0
  28. /data/lib/chiron/templates/{commands → shared/commands}/journal/template.md +0 -0
  29. /data/lib/chiron/templates/{commands → shared/commands}/quality/pre-commit.md +0 -0
  30. /data/lib/chiron/templates/{commands → shared/commands}/quality/test-driven.md +0 -0
  31. /data/lib/chiron/templates/{commands → shared/commands}/workflows/create-prd.md +0 -0
  32. /data/lib/chiron/templates/{commands → shared/commands}/workflows/feature-complete.md +0 -0
  33. /data/lib/chiron/templates/{commands → shared/commands}/workflows/generate-tasks.md +0 -0
  34. /data/lib/chiron/templates/{commands → shared/commands}/workflows/process-tasks.md +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1bedffbe29eddeb944137d4f3e986b45d20acfac3ddefa8d5f731efa1c7bc76
4
- data.tar.gz: 1c710a2bb2eb67b01ae126f38d2853edc0527c7536832a6a691a94d896d4d79c
3
+ metadata.gz: ed0812e658fcd053473ebaeb84d3c0e7b5c0ca35cc9a53a66a316e72ba96d0e5
4
+ data.tar.gz: 45a146731a3eb6797444ae1b8d469e066da1a3e7d50d8913a414d2944c9d9a40
5
5
  SHA512:
6
- metadata.gz: f1a40196a2c48302fec0be7bdba442d21386bcd8e0b2f3b88174e32f2927bec876c5673ee018e9c23cf1dd46b299ae1a628acc9b831b26c12d4da86c801913ea
7
- data.tar.gz: 93668d0ac4144e80aa5b80172bad66706db730d1068f6250a2e18e3ee621479d1ca09ae118abc6b615f4b05e6b332342a53913c09fb1c392b633fa2275316344
6
+ metadata.gz: 0a1d06237d6c61271c7a4313a7242dc9105fdd14dc90a135f8117f18b0a5da1df02a800a5c2f731a02524bdf15a8dc1b698a5efd75f5bb9e7e634c8d6989876a
7
+ data.tar.gz: 90b73ca6f3b9a550ee4b78220c3f73e83587341e962c0265acdefc1276d06aa89c6f67bedd93258436760f2e6671ef47a0e4bbe0bd76643fd56e0659751ec844
data/CHANGELOG.md CHANGED
@@ -5,30 +5,90 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [Unreleased]
8
+ ## [0.2.1] - 2025-07-01
9
9
 
10
- ## [0.1.0] - 2025-01-21
10
+ ### Added
11
+
12
+ #### Branch Tracking for Claude Sessions
13
+ - **`/branch-context` Command**: Comprehensive branch information for Claude session continuity
14
+ - **Branch Management Workflow**: Complete procedures for creating, switching, and managing Git branches
15
+ - **Enhanced Context Commands**: Updated `/quickstart` and `/catchup` with branch awareness
16
+ - **Development Journal Integration**: Branch tracking sections and guidelines for documentation
17
+ - **Session Continuity**: Workflows for maintaining context across Claude sessions and branch switches
18
+
19
+ #### New Workflow Templates
20
+ - **Branch Context** (`shared/commands/context/branch-context.md`): Detailed branch information and progress tracking
21
+ - **Branch Management** (`shared/commands/workflows/branch-management.md`): Complete branch lifecycle management
22
+
23
+ #### Enhanced Documentation
24
+ - **CLAUDE.md**: Added branch management section with naming conventions and session continuity guidelines
25
+ - **Development Journal Template**: Enhanced with branch tracking fields and ownership documentation
26
+ - **Context Commands**: Integrated branch awareness into existing workflow commands
27
+
28
+ ### Enhanced
29
+
30
+ #### Session Management
31
+ - **Context Continuity**: Improved Claude session startup with branch context
32
+ - **Progress Tracking**: Better documentation of branch work and ownership
33
+ - **Collaboration**: Enhanced handoff procedures and shared understanding patterns
34
+
35
+ ## [0.2.0] - 2025-07-01
36
+
37
+ ### Added
38
+
39
+ #### Python Project Support
40
+ - **Auto-detection**: Automatically detects Python projects via `requirements.txt`, `pyproject.toml`, `setup.py`, or `Pipfile`
41
+ - **Framework Detection**: Identifies Django, FastAPI, Flask, or generic Python projects
42
+ - **Python-specific CLAUDE.md template**: Customized for Python development with framework-specific sections
43
+ - **CLI Options**: Added `--type=python`, `--with-django`, and `--with-fastapi` flags
44
+
45
+ #### Python Workflow Templates
46
+ - **Python Conventions** (`python/commands/conventions/python.md`): Comprehensive Python best practices including PEP 8, type hints, async patterns, and framework-specific guidelines
47
+ - **Python Testing** (`python/commands/quality/python-testing.md`): Complete pytest patterns, fixtures, mocking, async testing, and CI/CD
48
+ - **Python Debugging** (`python/commands/workflows/debug-python.md`): Systematic debugging with pdb, logging, and performance profiling
49
+ - **Python Refactoring** (`python/commands/workflows/python-refactor.md`): SOLID principles, design patterns, and code organization
50
+ - **Flask Development** (`python/commands/workflows/flask-development.md`): Complete Flask application patterns, blueprints, forms, and testing
51
+
52
+ #### Enhanced Architecture
53
+ - **ProjectConfig Class**: Language-agnostic configuration management for tools, commands, and package managers
54
+ - **Template Organization**: Restructured templates with `rails/`, `python/`, and `shared/` directories
55
+ - **Framework-specific Content**: Dynamic template content based on detected frameworks
56
+
57
+ #### Testing & Quality
58
+ - **Comprehensive Test Suite**: 41 tests covering both Rails and Python functionality
59
+ - **Framework Detection Tests**: Tests for Django, FastAPI, and Flask project detection
60
+ - **ProjectConfig Tests**: Full coverage of configuration management
61
+ - **Backward Compatibility**: All existing Rails functionality preserved
62
+
63
+ ### Enhanced
64
+
65
+ #### CLI Improvements
66
+ - **Smart Project Detection**: Improved auto-detection with user prompts for unknown projects
67
+ - **Project-specific Tips**: Displays relevant setup tips after initialization
68
+ - **Doctor Command**: Enhanced health checks for both Rails and Python projects
69
+
70
+ #### Documentation
71
+ - **README**: Updated with Python examples and framework-specific usage
72
+ - **Template Structure**: Clear documentation of language-specific workflow organization
73
+
74
+ ### Technical Details
75
+
76
+ #### Supported Python Frameworks
77
+ - **Django**: Detects `manage.py`, includes Django ORM patterns, management commands
78
+ - **FastAPI**: Detects FastAPI in requirements, includes async patterns, API documentation
79
+ - **Flask**: Detects Flask dependencies, includes blueprint patterns, forms, testing
80
+ - **Generic Python**: Supports any Python project with standard tooling
81
+
82
+ #### Code Quality Tools
83
+ - **Rails**: RuboCop, RSpec, Rails conventions
84
+ - **Python**: Black, flake8, mypy, pytest, type hints
85
+
86
+ ## [0.1.0] - 2025-06-30
11
87
 
12
88
  ### Added
13
- - Initial release of Chiron gem (renamed from claude_rails_setup)
14
- - CLI command `chiron init` to initialize Claude AI workflows in Rails projects
15
- - PRD workflow templates for structured feature development
16
- - Task generation and management system
17
- - Development journal functionality
18
- - Quality assurance workflows and pre-commit checklists
19
- - Migration tool from `.cursor` to `.claude` directory structure
20
- - Comprehensive test suite with RSpec
21
- - GitHub Actions CI/CD pipeline
22
- - Support for Ruby 3.0+ and Rails projects
23
-
24
- ### Features
25
- - **Quick Setup**: Initialize Claude workflow with one command
26
- - **PRD Workflow**: Structured Product Requirements Document creation
27
- - **Task Management**: Generate and track implementation tasks
28
- - **Development Journal**: Track progress and maintain project history
29
- - **Migration Tool**: Easy migration from `.cursor` to `.claude` structure
30
- - **Quality Checks**: Pre-commit checklists and TDD workflows
31
- - **Customizable**: Adapt workflows to your team's needs
32
-
33
- [Unreleased]: https://github.com/ebrett/chiron/compare/v0.1.0...HEAD
34
- [0.1.0]: https://github.com/ebrett/chiron/releases/tag/v0.1.0
89
+ - Initial release with Rails project support
90
+ - Claude workflow initialization
91
+ - PRD and task management workflows
92
+ - Development journal system
93
+ - Migration from .cursor to .claude structure
94
+ - Rails-specific conventions and patterns
data/CLAUDE.md CHANGED
@@ -98,11 +98,40 @@ lib/
98
98
  - Test CLI commands with temporary directories
99
99
  - Follow RSpec best practices
100
100
 
101
+ ## Branch Management and Claude Sessions
102
+
103
+ ### Branch Naming Conventions
104
+ - `feature/[description]` - New functionality (e.g., `feature/python-support`)
105
+ - `bugfix/[description]` - Bug fixes (e.g., `bugfix/template-loading`)
106
+ - `hotfix/[description]` - Urgent production fixes
107
+ - `experiment/[description]` - Exploratory work
108
+
109
+ ### Claude Session Continuity
110
+ - **Starting Sessions**: Always run `/quickstart` to get current context
111
+ - **Branch Work**: Use `/branch-context` when working on feature branches
112
+ - **Progress Tracking**: Update development journal for significant changes
113
+ - **Branch Switching**: Document current state before switching branches
114
+
115
+ ### Development Journal Usage
116
+ - Include branch name in all journal entries
117
+ - Update "Active Branches & Ownership" section when creating/merging branches
118
+ - Link journal entries to related PRD files
119
+ - Document architectural decisions and reasoning
120
+
121
+ ### Branch Workflow
122
+ 1. Create branch from updated main: `git checkout -b feature/description`
123
+ 2. Document branch purpose in development journal
124
+ 3. Make initial empty commit with context
125
+ 4. Develop with frequent commits and journal updates
126
+ 5. Use `/catchup` and `/branch-context` for status updates
127
+ 6. Complete pre-commit checklist before merging
128
+
101
129
  ## Important Reminders
102
130
 
103
131
  - Always run tests before committing
104
- - Use semantic commit messages
132
+ - Use semantic commit messages with branch context
105
133
  - Update the development journal for significant changes
106
134
  - Follow the pre-commit checklist in `.claude/commands/quality/pre-commit.md`
135
+ - Use branch management workflows for feature development
107
136
  - Update CHANGELOG.md for notable changes
108
137
  - Test gem building and installation locally before releasing
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- chiron (0.1.0)
4
+ chiron (0.2.0)
5
5
  colorize (~> 1.1)
6
6
  thor (~> 1.3)
7
7
  tty-prompt (~> 0.23)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Chiron
2
2
 
3
- A Ruby gem that initializes Claude AI development workflows, PRD templates, and journaling system for Rails projects. Named after the wise centaur who mentored heroes, Chiron helps you quickly set up a structured development process that integrates seamlessly with Claude Code.
3
+ A Ruby gem that initializes Claude AI development workflows, PRD templates, and journaling system for Rails and Python projects. Named after the wise centaur who mentored heroes, Chiron helps you quickly set up a structured development process that integrates seamlessly with Claude Code.
4
4
 
5
5
  ## Features
6
6
 
@@ -34,15 +34,16 @@ gem install chiron
34
34
 
35
35
  ### Initialize Claude Workflow
36
36
 
37
- In your Rails project root:
37
+ In your project root (Rails or Python):
38
38
 
39
39
  ```bash
40
40
  chiron init
41
41
  ```
42
42
 
43
43
  This will:
44
+ - Auto-detect your project type (Rails/Python)
44
45
  - Create `.claude/commands/` directory with workflow templates
45
- - Generate `CLAUDE.md` with project-specific configuration
46
+ - Generate `CLAUDE.md` with language-specific configuration
46
47
  - Set up `tasks/` directory for PRDs and task lists
47
48
  - Initialize development journal in `docs/`
48
49
  - Update `.gitignore` appropriately
@@ -50,9 +51,13 @@ This will:
50
51
  ### Command Options
51
52
 
52
53
  ```bash
53
- # Initialize with options
54
+ # Initialize Rails project with options
54
55
  chiron init --project-name="MyApp" --with-viewcomponents
55
56
 
57
+ # Initialize Python project with framework-specific patterns
58
+ chiron init --type=python --with-django
59
+ chiron init --type=python --with-fastapi
60
+
56
61
  # Migrate from .cursor to .claude
57
62
  chiron migrate-cursor
58
63
 
@@ -71,15 +76,19 @@ chiron doctor
71
76
  After initialization, you'll have:
72
77
 
73
78
  ```
74
- your-rails-app/
79
+ your-project/
75
80
  ├── .claude/
76
81
  │ ├── commands/
77
82
  │ │ ├── workflows/ # Development workflows
78
83
  │ │ │ ├── create-prd.md
79
84
  │ │ │ ├── generate-tasks.md
80
- │ │ │ └── process-tasks.md
85
+ │ │ │ ├── process-tasks.md
86
+ │ │ │ ├── debug-python.md # Python debugging (Python projects)
87
+ │ │ │ ├── python-refactor.md # Python refactoring (Python projects)
88
+ │ │ │ └── flask-development.md # Flask patterns (Flask projects)
81
89
  │ │ ├── conventions/ # Language/framework rules
82
- │ │ │ └── rails.md
90
+ │ │ │ ├── rails.md # Rails-specific
91
+ │ │ │ └── python.md # Python-specific
83
92
  │ │ ├── context/ # Context commands
84
93
  │ │ │ ├── quickstart.md
85
94
  │ │ │ └── catchup.md
@@ -88,7 +97,8 @@ your-rails-app/
88
97
  │ │ │ └── template.md
89
98
  │ │ └── quality/ # Quality assurance
90
99
  │ │ ├── pre-commit.md
91
- │ │ └── test-driven.md
100
+ │ │ ├── test-driven.md
101
+ │ │ └── python-testing.md # Python testing (Python projects)
92
102
  │ └── settings.json # Claude permissions
93
103
  ├── CLAUDE.md # Project-specific Claude instructions
94
104
  ├── tasks/ # PRDs and task lists
@@ -133,6 +143,39 @@ After setup, you can tell Claude:
133
143
  - "Update the journal"
134
144
  - "Run pre-commit checks"
135
145
 
146
+ ### Language-Specific Commands
147
+
148
+ **Rails:**
149
+ - "Run RuboCop on this file"
150
+ - "Generate an RSpec test"
151
+ - "Create a Rails migration"
152
+
153
+ **Python:**
154
+ - "Format this with Black"
155
+ - "Create a pytest fixture"
156
+ - "Generate a Django model"
157
+ - "Debug this async function"
158
+ - "Refactor this class using SOLID principles"
159
+ - "Add type hints to this function"
160
+
161
+ ## Supported Project Types
162
+
163
+ ### Rails Projects
164
+ - Full Rails conventions and best practices
165
+ - RSpec testing patterns
166
+ - Hotwire/Stimulus integration
167
+ - ViewComponent support (optional)
168
+ - RuboCop for code quality
169
+
170
+ ### Python Projects
171
+ - Auto-detects Django, FastAPI, Flask, or generic Python
172
+ - pytest testing patterns with fixtures and parametrization
173
+ - Black/flake8/mypy for code quality and type checking
174
+ - Framework-specific templates (Django ORM, FastAPI async, Flask blueprints)
175
+ - Debugging workflows with pdb and logging
176
+ - Refactoring patterns and SOLID principles
177
+ - Virtual environment and dependency management best practices
178
+
136
179
  ## Customization
137
180
 
138
181
  All templates are customizable. After initialization:
@@ -1,11 +1,94 @@
1
1
  # Development Journal - Chiron Gem
2
2
 
3
3
  ## Project Overview
4
- Chiron is a Ruby gem that helps Rails developers set up Claude AI workflows, PRD templates, and development journaling systems.
4
+ Chiron is a Ruby gem that helps Rails and Python developers set up Claude AI workflows, PRD templates, and development journaling systems.
5
+
6
+ ---
7
+
8
+ ## 2025-07-01 - Major Enhancement: Comprehensive Python Project Support
9
+ **Developer(s)**: Claude Code | **Branch**: main | **Context**: User request for Python support
10
+
11
+ ### What was accomplished today:
12
+ - **Major Feature Release**: Added complete Python project support to Chiron gem
13
+ - **Framework Detection**: Implemented auto-detection for Django, FastAPI, Flask, and generic Python projects
14
+ - **Architecture Overhaul**: Created `ProjectConfig` class for language-agnostic tool management
15
+ - **Template Reorganization**: Restructured templates into `rails/`, `python/`, and `shared/` directories
16
+ - **Comprehensive Testing**: Expanded test suite from 5 to 41 tests with full Python coverage
17
+ - **Documentation Update**: Enhanced README, CHANGELOG, and CLI help with Python examples
18
+ - **RubyGems Publication**: Successfully published version 0.2.0 to RubyGems
19
+
20
+ ### Technical decisions made:
21
+ - **Multi-Language Architecture**: Designed extensible system supporting both Rails and Python
22
+ - **Project Detection**: Auto-detects project type via `requirements.txt`, `pyproject.toml`, `setup.py`, `Pipfile`
23
+ - **Framework Intelligence**: Identifies Django (`manage.py`), FastAPI/Flask (via requirements analysis)
24
+ - **Template Strategy**: Shared workflows with language-specific conventions and patterns
25
+ - **Backward Compatibility**: Maintained 100% compatibility with existing Rails functionality
26
+ - **Configuration Management**: `ProjectConfig` class abstracts tool selection (pytest vs RSpec, black vs RuboCop)
27
+
28
+ ### Features added:
29
+ - **Python CLI Options**: `--type=python`, `--with-django`, `--with-fastapi` flags
30
+ - **Smart Project Detection**: Interactive prompts for unknown project types
31
+ - **Python Workflow Templates**:
32
+ - Python Conventions (PEP 8, type hints, async patterns, framework best practices)
33
+ - Python Testing (pytest patterns, fixtures, mocking, async testing, CI/CD)
34
+ - Python Debugging (pdb workflows, logging strategies, performance profiling)
35
+ - Python Refactoring (SOLID principles, design patterns, code organization)
36
+ - Flask Development (blueprints, forms, testing, deployment patterns)
37
+ - **Framework-Specific Content**: Dynamic CLAUDE.md templates based on detected frameworks
38
+ - **Project-Specific Tips**: Contextual setup guidance after initialization
39
+
40
+ ### Code quality metrics:
41
+ - **RSpec**: 41 examples, 0 failures (8x increase in test coverage)
42
+ - **New Test Categories**: Framework detection, ProjectConfig functionality, Python workflows
43
+ - **RuboCop**: 29 minor offenses (mostly method length in CLI - acceptable for feature-rich CLI)
44
+ - **Backward Compatibility**: All existing Rails tests continue to pass
45
+
46
+ ### Architecture improvements:
47
+ - **Template Structure**:
48
+ ```
49
+ lib/chiron/templates/
50
+ ├── rails/ # Rails-specific templates
51
+ ├── python/ # Python-specific templates
52
+ └── shared/ # Language-agnostic workflows
53
+ ```
54
+ - **Language Detection**: Robust project type identification with fallback mechanisms
55
+ - **Tool Configuration**: Abstracted command generation for testing, linting, formatting
56
+ - **ERB Enhancement**: Framework-aware template rendering with conditional content
57
+
58
+ ### Bugs fixed:
59
+ - **Template Fallbacks**: Graceful handling when project-specific templates don't exist
60
+ - **CLI Robustness**: Improved error handling for unknown project types
61
+ - **Cross-Platform**: Ensured Python detection works across different package managers
62
+
63
+ ### Version and release:
64
+ - **Version Bump**: 0.1.0 → 0.2.0 (major feature enhancement)
65
+ - **Gem Build**: Successfully built `chiron-0.2.0.gem`
66
+ - **RubyGems**: Published to RubyGems registry
67
+ - **Documentation**: Comprehensive CHANGELOG with technical details
68
+
69
+ ### Impact and usage:
70
+ - **Multi-Language Support**: Chiron now serves both Rails and Python ecosystems
71
+ - **Framework Coverage**: Django, FastAPI, Flask, and generic Python projects supported
72
+ - **Developer Experience**: Auto-detection eliminates manual configuration
73
+ - **Workflow Richness**: Language-specific best practices and patterns included
74
+
75
+ ### Next steps:
76
+ - Monitor RubyGems adoption and user feedback
77
+ - Consider additional language support (Node.js, Go, etc.)
78
+ - Enhance framework detection with more sophisticated analysis
79
+ - Add more Python-specific workflow templates based on community needs
80
+ - Create video documentation showing Python project initialization
81
+
82
+ ### Notes:
83
+ - This represents the largest enhancement to Chiron since its creation
84
+ - Successfully maintained backward compatibility while adding major new functionality
85
+ - Python support is comprehensive and production-ready
86
+ - Architecture now supports easy addition of future languages
5
87
 
6
88
  ---
7
89
 
8
90
  ## 2025-01-21 - Initial Setup and Module Rename
91
+ **Developer(s)**: Claude Code | **Branch**: main | **Context**: Initial gem development
9
92
 
10
93
  ### What was accomplished today:
11
94
  - Set up complete gem development infrastructure
data/lib/chiron/cli.rb CHANGED
@@ -13,18 +13,30 @@ module Chiron
13
13
  true
14
14
  end
15
15
 
16
- desc 'init', 'Initialize Claude workflow in current Rails project'
16
+ desc 'init', 'Initialize Claude workflow in current project'
17
17
  option :project_name, type: :string, desc: 'Project name for CLAUDE.md'
18
+ option :type, type: :string, desc: 'Project type (rails, python). Auto-detected if not specified'
18
19
  option :with_oauth, type: :boolean, default: false, desc: 'Include OAuth workflow examples'
19
20
  option :with_viewcomponents, type: :boolean, default: false, desc: 'Include ViewComponent rules'
21
+ option :with_django, type: :boolean, default: false, desc: 'Include Django-specific patterns'
22
+ option :with_fastapi, type: :boolean, default: false, desc: 'Include FastAPI-specific patterns'
20
23
  option :skip_journal, type: :boolean, default: false, desc: 'Skip development journal setup'
21
24
  def init
22
- say '🤖 Initializing Claude Rails Setup...'.colorize(:blue)
25
+ say '🤖 Initializing Claude Setup...'.colorize(:blue)
23
26
 
24
27
  @prompt = TTY::Prompt.new
28
+ @project_type = determine_project_type
25
29
  @project_name = options[:project_name] || prompt_for_project_name
26
30
 
27
- check_rails_project
31
+ # Set up project configuration
32
+ if @project_type == :python
33
+ @python_framework = detect_python_framework
34
+ @config = ProjectConfig.new(@project_type, @python_framework)
35
+ else
36
+ @config = ProjectConfig.new(@project_type)
37
+ end
38
+
39
+ check_project_compatibility
28
40
  create_directories
29
41
  copy_templates
30
42
  update_gitignore
@@ -34,6 +46,20 @@ module Chiron
34
46
  say ' 1. Review and customize CLAUDE.md for your project'
35
47
  say ' 2. Check .claude/commands/ for available workflows'
36
48
  say " 3. Run 'claude' to start using Claude with your new setup"
49
+
50
+ # Project-specific suggestions
51
+ case @project_type
52
+ when :python
53
+ say "\nPython project tips:".colorize(:yellow)
54
+ say ' - Install dev dependencies: pip install pytest black flake8'
55
+ say ' - Set up pre-commit hooks for code quality'
56
+ say ' - Configure your IDE to use black formatting'
57
+ when :rails
58
+ say "\nRails project tips:".colorize(:yellow)
59
+ say ' - Ensure binstubs are set up: bundle binstubs bundler --force'
60
+ say " - Run 'bin/rubocop' to check code style"
61
+ say " - Use 'bin/rspec' for running tests"
62
+ end
37
63
  end
38
64
 
39
65
  desc 'migrate-cursor', 'Migrate from .cursor to .claude structure'
@@ -90,8 +116,9 @@ module Chiron
90
116
  def doctor
91
117
  say '🏥 Running Claude setup diagnostics...'.colorize(:blue)
92
118
 
119
+ project_type = detect_project_type
93
120
  checks = {
94
- 'Rails project' => Dir.exist?('app') && File.exist?('Gemfile'),
121
+ "#{project_type.to_s.capitalize} project" => project_type != :unknown,
95
122
  'CLAUDE.md exists' => File.exist?('CLAUDE.md'),
96
123
  '.claude directory' => Dir.exist?('.claude'),
97
124
  '.claude/commands' => Dir.exist?('.claude/commands'),
@@ -104,6 +131,15 @@ module Chiron
104
131
  end
105
132
  }
106
133
 
134
+ # Add project-specific checks
135
+ case project_type
136
+ when :rails
137
+ checks['Gemfile exists'] = File.exist?('Gemfile')
138
+ checks['Rails app structure'] = Dir.exist?('app')
139
+ when :python
140
+ checks['Python package file'] = python_package_exists?
141
+ end
142
+
107
143
  checks.each do |check, result|
108
144
  status = result ? '✅'.colorize(:green) : '❌'.colorize(:red)
109
145
  say "#{status} #{check}"
@@ -112,7 +148,7 @@ module Chiron
112
148
  if checks.values.all?
113
149
  say "\n✨ All checks passed!".colorize(:green)
114
150
  else
115
- say "\n⚠️ Some checks failed. Run 'claude-rails init' to fix.".colorize(:yellow)
151
+ say "\n⚠️ Some checks failed. Run 'chiron init' to fix.".colorize(:yellow)
116
152
  end
117
153
  end
118
154
 
@@ -130,11 +166,58 @@ module Chiron
130
166
  end
131
167
  end
132
168
 
133
- def check_rails_project
134
- return if File.exist?('Gemfile') && File.read('Gemfile').include?('rails')
169
+ def determine_project_type
170
+ return options[:type].to_sym if options[:type]
171
+
172
+ detected_type = detect_project_type
173
+ if detected_type == :unknown
174
+ @prompt.select('What type of project is this?') do |menu|
175
+ menu.choice 'Rails', :rails
176
+ menu.choice 'Python', :python
177
+ end
178
+ else
179
+ say "Detected #{detected_type} project".colorize(:green)
180
+ detected_type
181
+ end
182
+ end
135
183
 
136
- error "This doesn't appear to be a Rails project!"
137
- exit 1
184
+ def detect_project_type
185
+ if File.exist?('Gemfile') && File.read('Gemfile').include?('rails')
186
+ :rails
187
+ elsif python_package_exists?
188
+ :python
189
+ else
190
+ :unknown
191
+ end
192
+ end
193
+
194
+ def detect_python_framework
195
+ if File.exist?('manage.py')
196
+ :django
197
+ elsif File.exist?('app.py') || File.exist?('main.py')
198
+ if File.exist?('requirements.txt')
199
+ content = File.read('requirements.txt')
200
+ return :fastapi if content.include?('fastapi')
201
+ return :flask if content.include?('flask')
202
+ end
203
+ :generic
204
+ else
205
+ :generic
206
+ end
207
+ end
208
+
209
+ def check_project_compatibility
210
+ case @project_type
211
+ when :rails
212
+ unless File.exist?('Gemfile')
213
+ error "This doesn't appear to be a Rails project!"
214
+ exit 1
215
+ end
216
+ when :python
217
+ if !python_package_exists? && @prompt.yes?('No Python package file found. Create requirements.txt?')
218
+ File.write('requirements.txt', "# Python dependencies\n")
219
+ end
220
+ end
138
221
  end
139
222
 
140
223
  def create_directories
@@ -157,8 +240,12 @@ module Chiron
157
240
  def copy_templates(update: false)
158
241
  # Copy CLAUDE.md template
159
242
  unless update
160
- template_path = File.join(templates_path, 'CLAUDE.md.erb')
243
+ template_path = File.join(templates_path, @project_type.to_s, 'CLAUDE.md.erb')
244
+ # Fall back to shared template if project-specific doesn't exist
245
+ template_path = File.join(templates_path, 'CLAUDE.md.erb') unless File.exist?(template_path)
246
+
161
247
  if File.exist?(template_path)
248
+ @python_framework = detect_python_framework if @project_type == :python
162
249
  content = ERB.new(File.read(template_path)).result(binding)
163
250
  File.write('CLAUDE.md', content)
164
251
  say '📄 Created CLAUDE.md'.colorize(:light_blue)
@@ -169,7 +256,10 @@ module Chiron
169
256
  copy_commands
170
257
 
171
258
  # Copy settings.json
172
- settings_path = File.join(templates_path, 'claude/settings.json')
259
+ settings_path = File.join(templates_path, 'shared', 'claude', 'settings.json')
260
+ # Fall back to root claude dir if shared doesn't exist
261
+ settings_path = File.join(templates_path, 'claude', 'settings.json') unless File.exist?(settings_path)
262
+
173
263
  if File.exist?(settings_path) && !File.exist?('.claude/settings.json')
174
264
  FileUtils.cp(settings_path, '.claude/settings.json')
175
265
  say '⚙️ Created .claude/settings.json'.colorize(:light_blue)
@@ -182,21 +272,50 @@ module Chiron
182
272
  end
183
273
 
184
274
  def copy_commands
185
- commands_dir = File.join(templates_path, 'commands')
186
- return unless Dir.exist?(commands_dir)
275
+ # Copy shared commands first
276
+ shared_commands_dir = File.join(templates_path, 'shared', 'commands')
277
+ if Dir.exist?(shared_commands_dir)
278
+ Dir.glob(File.join(shared_commands_dir, '**/*.md')).each do |file|
279
+ relative_path = file.sub("#{shared_commands_dir}/", '')
280
+ target_path = File.join('.claude/commands', relative_path)
281
+
282
+ FileUtils.mkdir_p(File.dirname(target_path))
283
+ FileUtils.cp(file, target_path)
284
+ say "📋 Copied shared: #{relative_path}".colorize(:light_blue)
285
+ end
286
+ end
287
+
288
+ # Copy project-specific commands
289
+ project_commands_dir = File.join(templates_path, @project_type.to_s, 'commands')
290
+ if Dir.exist?(project_commands_dir)
291
+ Dir.glob(File.join(project_commands_dir, '**/*.md')).each do |file|
292
+ relative_path = file.sub("#{project_commands_dir}/", '')
293
+ target_path = File.join('.claude/commands', relative_path)
294
+
295
+ FileUtils.mkdir_p(File.dirname(target_path))
296
+ FileUtils.cp(file, target_path)
297
+ say "📋 Copied #{@project_type}: #{relative_path}".colorize(:light_blue)
298
+ end
299
+ end
187
300
 
188
- Dir.glob(File.join(commands_dir, '**/*.md')).each do |file|
189
- relative_path = file.sub("#{commands_dir}/", '')
190
- target_path = File.join('.claude/commands', relative_path)
301
+ # Fall back to legacy commands if new structure doesn't exist
302
+ legacy_commands_dir = File.join(templates_path, 'commands')
303
+ if !Dir.exist?(shared_commands_dir) && !Dir.exist?(project_commands_dir) && Dir.exist?(legacy_commands_dir)
304
+ Dir.glob(File.join(legacy_commands_dir, '**/*.md')).each do |file|
305
+ relative_path = file.sub("#{legacy_commands_dir}/", '')
306
+ target_path = File.join('.claude/commands', relative_path)
191
307
 
192
- FileUtils.mkdir_p(File.dirname(target_path))
193
- FileUtils.cp(file, target_path)
194
- say "📋 Copied #{relative_path}".colorize(:light_blue)
308
+ FileUtils.mkdir_p(File.dirname(target_path))
309
+ FileUtils.cp(file, target_path)
310
+ say "📋 Copied #{relative_path}".colorize(:light_blue)
311
+ end
195
312
  end
196
313
  end
197
314
 
198
315
  def create_development_journal
199
- journal_template = File.join(templates_path, 'development_journal.md.erb')
316
+ journal_template = File.join(templates_path, 'shared', 'development_journal.md.erb')
317
+ # Fall back to root if shared doesn't exist
318
+ journal_template = File.join(templates_path, 'development_journal.md.erb') unless File.exist?(journal_template)
200
319
  return unless File.exist?(journal_template)
201
320
 
202
321
  content = ERB.new(File.read(journal_template)).result(binding)
@@ -252,6 +371,11 @@ module Chiron
252
371
  Chiron.templates_path
253
372
  end
254
373
 
374
+ def python_package_exists?
375
+ File.exist?('requirements.txt') || File.exist?('pyproject.toml') ||
376
+ File.exist?('setup.py') || File.exist?('Pipfile')
377
+ end
378
+
255
379
  def error(message)
256
380
  say "❌ #{message}".colorize(:red)
257
381
  end