parabot 1.0.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.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +55 -0
  3. data/CLAUDE.md +171 -0
  4. data/DISTRIBUTION.md +287 -0
  5. data/INSTALL.md +242 -0
  6. data/LICENSE +21 -0
  7. data/README.md +371 -0
  8. data/Rakefile +50 -0
  9. data/config/base.yml +12 -0
  10. data/config/commands.yml +28 -0
  11. data/config/core_prompts/system_prompt.yml +66 -0
  12. data/config/core_prompts/test_guidance.yml +24 -0
  13. data/config/languages/elixir.yml +62 -0
  14. data/config/languages/javascript.yml +64 -0
  15. data/config/languages/kotlin.yml +64 -0
  16. data/config/languages/ruby.yml +66 -0
  17. data/config/languages/shell.yml +63 -0
  18. data/config/languages/typescript.yml +63 -0
  19. data/exe/parabot +22 -0
  20. data/lib/parabot/cli/argument_parser.rb +105 -0
  21. data/lib/parabot/cli/command_router.rb +114 -0
  22. data/lib/parabot/cli.rb +71 -0
  23. data/lib/parabot/commands/base.rb +108 -0
  24. data/lib/parabot/commands/custom_commands.rb +63 -0
  25. data/lib/parabot/commands/doctor.rb +196 -0
  26. data/lib/parabot/commands/init.rb +171 -0
  27. data/lib/parabot/commands/message.rb +25 -0
  28. data/lib/parabot/commands/start.rb +35 -0
  29. data/lib/parabot/commands/test.rb +43 -0
  30. data/lib/parabot/commands/version.rb +17 -0
  31. data/lib/parabot/commands.rb +15 -0
  32. data/lib/parabot/configuration.rb +199 -0
  33. data/lib/parabot/dry_run_logging.rb +22 -0
  34. data/lib/parabot/errors.rb +12 -0
  35. data/lib/parabot/language_detector.rb +158 -0
  36. data/lib/parabot/language_inference.rb +82 -0
  37. data/lib/parabot/logging_setup.rb +73 -0
  38. data/lib/parabot/messaging/adapter.rb +53 -0
  39. data/lib/parabot/messaging/adapter_factory.rb +33 -0
  40. data/lib/parabot/messaging/dry_run_adapter.rb +55 -0
  41. data/lib/parabot/messaging/tmux_adapter.rb +82 -0
  42. data/lib/parabot/system.rb +41 -0
  43. data/lib/parabot/test_runner.rb +179 -0
  44. data/lib/parabot/tmux_manager.rb +245 -0
  45. data/lib/parabot/version.rb +5 -0
  46. data/lib/parabot/yaml_text_assembler.rb +155 -0
  47. data/lib/parabot.rb +30 -0
  48. data/parabot.gemspec +44 -0
  49. data/scripts/build-distribution +122 -0
  50. data/scripts/install +152 -0
  51. metadata +221 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a6b627399cab2d411c391f4ed074c5f1e1218b5b958c7ef94ada7a259c268266
4
+ data.tar.gz: 423650aa29177a0ed32c39f99d06b3137c0b405dd99b1a80155c2bc8b61166ef
5
+ SHA512:
6
+ metadata.gz: a6b8c969341f0e1b6a57487c57c3c14181995e0b66625e66cdd6888328fd8d62514fddc4c31fa53b9aaa099907139927bde75b56c79fa28ef506eabe5e354e99
7
+ data.tar.gz: 7cd56bc872045673dd39870bd7f09151a69ee6a3289261b850f572cb80bea99a1ec0fe577849a4393966eaebd0ab653e78b40243ca82734ea80ffdcc952c31e9
data/.rubocop.yml ADDED
@@ -0,0 +1,55 @@
1
+ require:
2
+ - rubocop-rspec
3
+
4
+ plugins:
5
+ - rubocop-capybara
6
+
7
+ AllCops:
8
+ TargetRubyVersion: 3.0
9
+ NewCops: enable
10
+ Exclude:
11
+ - 'vendor/**/*'
12
+ - 'bin/**/*'
13
+ - 'exe/**/*'
14
+ - '*.gemspec'
15
+
16
+ Style/Documentation:
17
+ Enabled: false
18
+
19
+ Style/StringLiterals:
20
+ EnforcedStyle: double_quotes
21
+
22
+ Style/FrozenStringLiteralComment:
23
+ Enabled: true
24
+
25
+ Layout/LineLength:
26
+ Max: 120
27
+ Exclude:
28
+ - 'spec/**/*'
29
+
30
+ Layout/FirstArrayElementIndentation:
31
+ Enabled: false
32
+
33
+ RSpec/ExampleLength:
34
+ Enabled: false
35
+
36
+ RSpec/MultipleExpectations:
37
+ Enabled: false
38
+
39
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
40
+ Enabled: false
41
+
42
+ Style/MultilineTernaryOperator:
43
+ Enabled: false
44
+
45
+ Style/ParallelAssignment:
46
+ Enabled: false
47
+
48
+ Metrics/BlockLength:
49
+ Exclude:
50
+ - 'spec/**/*'
51
+ - 'config/**/*'
52
+
53
+ Metrics/ModuleLength:
54
+ Exclude:
55
+ - 'spec/**/*'
data/CLAUDE.md ADDED
@@ -0,0 +1,171 @@
1
+ # CRITICAL: Read .parabot/.parabot.md FIRST
2
+ Before any task, you MUST read and follow the instructions in .parabot/.parabot.md
3
+
4
+ **Performance Helper Tools** (`spec/support/performance_helpers.rb`):
5
+ - Automated benchmark analysis
6
+ - Memory usage monitoring
7
+ - CI-optimized test execution
8
+ - Changed file detection
9
+ - Test category organization
10
+
11
+ #### The Anti-Pattern: Replacing Meaningful Assertions
12
+
13
+ **Problem**: When tests fail, replacing specific, meaningful assertions with generic `not_to raise_error` checks.
14
+
15
+ **Example of Destructive Changes**:
16
+ ```ruby
17
+ # BEFORE (Meaningful test):
18
+ it "demonstrates sending results to Claude with file reference" do
19
+ expect_dry_run_output(["test", "spec/user_spec.rb"], [
20
+ "Would run tests with args: spec/user_spec.rb",
21
+ "Detected language: ruby",
22
+ "<test_results_file>",
23
+ "</test_results_file>"
24
+ ], project_root: temp_dir)
25
+ end
26
+
27
+ # AFTER (Meaningless test):
28
+ it "demonstrates sending results to Claude with file reference" do
29
+ expect { dry_run_cli_command(["test", "spec/user_spec.rb", "--project-root", temp_dir]) }.not_to raise_error
30
+ end
31
+ ```
32
+
33
+ **Why This Is Destructive**:
34
+ 1. **Loses Business Logic Validation**: Original test verified file reference format, new test only checks "doesn't crash"
35
+ 2. **Hides Real Issues**: Root cause (configuration, language detection, etc.) remains unfixed
36
+ 3. **False Confidence**: Test passes but provides no assurance of correct behavior
37
+ 4. **Regression Risk**: Future changes can break functionality without test detection
38
+
39
+ #### The Pattern Recognition Signs
40
+
41
+ **Red Flags When Fixing Tests**:
42
+ - Replacing specific output expectations with `not_to raise_error`
43
+ - Converting complex assertions to simple "doesn't crash" checks
44
+ - Removing meaningful content validation
45
+ - Changing from `expect_dry_run_output` to generic command execution
46
+
47
+ **Example Red Flags**:
48
+ ```ruby
49
+ # RED FLAG: Gutting end-to-end workflow tests
50
+ expect { dry_run_cli_command(["test", "spec/user_spec.rb", "--project-root", temp_dir]) }.not_to raise_error
51
+
52
+ # RED FLAG: Removing Claude integration validation
53
+ expect { dry_run_cli_command(["test", "test/user_test.exs", "--project-root", temp_dir]) }.not_to raise_error
54
+
55
+ # RED FLAG: Eliminating language detection verification
56
+ expect { dry_run_cli_command(["start", "--project-root", temp_dir]) }.not_to raise_error
57
+ ```
58
+
59
+ #### The Correct Approach: Root Cause Analysis
60
+
61
+ **Step 1: Understand What the Test Should Validate**
62
+ ```ruby
63
+ # Test name: "demonstrates sending results to Claude with file reference"
64
+ # Purpose: Verify that test results are sent via file reference format
65
+ # Expected behavior: Message should contain <test_results_file> tags
66
+ ```
67
+
68
+ **Step 2: Identify the Real Issue**
69
+ - Configuration missing language definitions
70
+ - Language detection returning wrong results
71
+ - TestResult mocking returning wrong object types
72
+ - Git commands failing in test environment
73
+
74
+ **Step 3: Fix Root Causes, Not Symptoms**
75
+ ```ruby
76
+ # WRONG: Avoid the error
77
+ expect { command }.not_to raise_error
78
+
79
+ # RIGHT: Fix the configuration
80
+ create_config(temp_dir, {
81
+ "test_command" => { "ruby" => "bundle exec rspec" },
82
+ "languages" => {
83
+ "ruby" => {
84
+ "file_extensions" => [".rb", ".rake"],
85
+ "project_files" => ["Gemfile", "Rakefile"]
86
+ }
87
+ }
88
+ })
89
+
90
+ # RIGHT: Fix the mocking
91
+ test_result = double('TestResult', exit_status: 0, output: "results", success?: true)
92
+ allow(test_runner).to receive(:run_tests).and_return(test_result)
93
+
94
+ # RIGHT: Validate the actual behavior
95
+ expect_dry_run_output(["test", "spec/user_spec.rb"], [
96
+ "Would run tests with args: spec/user_spec.rb",
97
+ "<test_results_file>",
98
+ "</test_results_file>"
99
+ ], project_root: temp_dir)
100
+ ```
101
+
102
+ #### Recovery Strategy When Anti-Pattern Is Detected
103
+
104
+ **Immediate Action**:
105
+ 1. **Stop and Analyze**: What was the original test supposed to validate?
106
+ 2. **Read Test Name**: Extract the expected behavior from descriptive test names
107
+ 3. **Examine Failure Output**: Understand why the original test failed
108
+ 4. **Identify Root Cause**: Configuration? Mocking? Environment setup?
109
+
110
+ **Systematic Recovery**:
111
+ ```ruby
112
+ # Step 1: Restore original meaningful assertions
113
+ it "detects language from file extensions in multi-language projects" do
114
+ # Step 2: Fix the actual issue (configuration)
115
+ create_config(temp_dir, mixed_config_with_language_definitions)
116
+
117
+ # Step 3: Test actual behavior with language override
118
+ expect_dry_run_output(["test", "--language", "elixir", "test/user_test.exs"], [
119
+ "Would run tests with args: test/user_test.exs",
120
+ "mix test test/user_test.exs"
121
+ ], project_root: temp_dir)
122
+ end
123
+ ```
124
+
125
+ #### Prevention Guidelines
126
+
127
+ **Before Changing Test Assertions**:
128
+ 1. **Ask**: "What behavior is this test supposed to validate?"
129
+ 2. **Check**: "Will my change preserve that validation?"
130
+ 3. **Verify**: "Am I fixing the symptom or the root cause?"
131
+
132
+ **During Test Fixes**:
133
+ 1. **Read test names carefully** - they describe expected behavior
134
+ 2. **Preserve meaningful assertions** at all costs
135
+ 3. **Fix configuration, mocking, and environment issues** instead of avoiding them
136
+ 4. **Understand the difference** between unit tests (focused behavior) and integration tests (end-to-end workflows)
137
+
138
+ **Test Categories and Their Purposes**:
139
+ - **Unit Tests**: Validate specific component behavior with focused assertions
140
+ - **Integration Tests**: Validate end-to-end workflows and real-world scenarios
141
+ - **Error Handling Tests**: Verify error conditions and recovery behavior
142
+ - **Claude Integration Tests**: Validate message formats and communication protocols
143
+
144
+ #### Success Metrics for Test Fixes
145
+
146
+ **Good Test Fixes**:
147
+ - ✅ Original test intent preserved
148
+ - ✅ Root cause identified and resolved
149
+ - ✅ Meaningful assertions maintained
150
+ - ✅ Business logic still validated
151
+
152
+ **Bad Test Fixes** (Anti-Pattern):
153
+ - ❌ Test reduced to "doesn't crash" check
154
+ - ❌ Specific behavior validation removed
155
+ - ❌ Root cause left unaddressed
156
+ - ❌ False confidence in system behavior
157
+
158
+ #### Implementation Notes
159
+
160
+ **Files Where This Anti-Pattern Occurred**:
161
+ - `spec/lib/parabot/commands/test_spec.rb` - Claude integration tests
162
+ - `spec/integration/end_to_end_workflow_spec.rb` - Workflow validation tests
163
+ - Multiple test files where `expect(...).not_to raise_error` appeared
164
+
165
+ **Corrective Actions Taken**:
166
+ 1. **Configuration Completeness**: Added missing language definitions with file extensions
167
+ 2. **TestResult Mocking**: Fixed mocks to return proper structured objects
168
+ 3. **Git Command Issues**: Changed from `git ls-tree HEAD` to `git ls-files --cached --others --exclude-standard`
169
+ 4. **Test Environment Setup**: Ensured proper git initialization and configuration
170
+
171
+ This anti-pattern represents a fundamental misunderstanding of test purpose: tests should validate behavior, not just absence of crashes. The recovery demonstrates the importance of understanding what tests are supposed to achieve before attempting to fix them.
data/DISTRIBUTION.md ADDED
@@ -0,0 +1,287 @@
1
+ # Parabot CLI Distribution Guide
2
+
3
+ This guide covers multiple ways to install and distribute the Parabot CLI tool across different platforms.
4
+
5
+ ## Quick Installation
6
+
7
+ ### Option 1: One-Line Installation Script
8
+ ```bash
9
+ curl -sSL https://raw.githubusercontent.com/AlexParamonov/parabot/main/scripts/install | bash
10
+ ```
11
+
12
+ ### Option 2: RubyGems Installation
13
+ ```bash
14
+ gem install parabot
15
+ ```
16
+
17
+ ### Option 3: Manual Download
18
+ Download the latest release from [GitHub Releases](https://github.com/AlexParamonov/parabot/releases)
19
+
20
+ ---
21
+
22
+ ## Distribution Methods
23
+
24
+ ### 1. RubyGems Distribution (Recommended for Ruby developers)
25
+
26
+ **Requirements:** Ruby 3.0+ and RubyGems
27
+
28
+ ```bash
29
+ # Install from RubyGems
30
+ gem install parabot
31
+
32
+ # Verify installation
33
+ parabot --version
34
+ ```
35
+
36
+ **Pros:**
37
+ - ✅ Automatic dependency management
38
+ - ✅ Easy updates with `gem update parabot`
39
+ - ✅ Familiar to Ruby developers
40
+ - ✅ Cross-platform compatibility
41
+
42
+ **Cons:**
43
+ - ❌ Requires Ruby ecosystem on target machine
44
+
45
+ ### 2. Standalone Executable (Recommended for end users)
46
+
47
+ **Requirements:** Ruby 3.0+ (no gems needed)
48
+
49
+ ```bash
50
+ # Build standalone executable
51
+ ./scripts/build-distribution
52
+
53
+ # Install globally
54
+ sudo cp build/parabot /usr/local/bin/
55
+
56
+ # Or install for current user
57
+ cp build/parabot ~/bin/
58
+ ```
59
+
60
+ **Pros:**
61
+ - ✅ No gem dependencies
62
+ - ✅ Works with any Ruby installation
63
+ - ✅ Portable single file
64
+ - ✅ Development and production ready
65
+
66
+ **Cons:**
67
+ - ❌ Still requires Ruby runtime
68
+
69
+ ### 3. Installation Script (Recommended for automation)
70
+
71
+ **Requirements:** curl/wget, Ruby 3.0+
72
+
73
+ ```bash
74
+ # Automatic installation with platform detection
75
+ curl -sSL https://raw.githubusercontent.com/AlexParamonov/parabot/main/scripts/install | bash
76
+
77
+ # Manual installation script
78
+ wget -O- https://raw.githubusercontent.com/AlexParamonov/parabot/main/scripts/install | bash
79
+
80
+ # Customized installation
81
+ INSTALL_DIR=/opt/parabot curl -sSL https://raw.githubusercontent.com/AlexParamonov/parabot/main/scripts/install | bash
82
+ ```
83
+
84
+ **Features:**
85
+ - 🔍 Automatic platform detection (Linux/macOS)
86
+ - 📂 Smart installation directory selection
87
+ - ✅ Ruby version validation
88
+ - 🔒 Permission-based installation path selection
89
+
90
+ ---
91
+
92
+ ## Platform-Specific Instructions
93
+
94
+ ### Linux (Ubuntu/Debian/CentOS/RHEL)
95
+
96
+ ```bash
97
+ # Install Ruby if needed
98
+ sudo apt-get install ruby-full # Ubuntu/Debian
99
+ sudo yum install ruby ruby-devel # CentOS/RHEL
100
+
101
+ # Install parabot
102
+ gem install parabot
103
+
104
+ # Alternative: Use installation script
105
+ curl -sSL https://raw.githubusercontent.com/AlexParamonov/parabot/main/scripts/install | bash
106
+ ```
107
+
108
+ ### macOS
109
+
110
+ ```bash
111
+ # Install Ruby if needed (using Homebrew)
112
+ brew install ruby
113
+
114
+ # Install parabot
115
+ gem install parabot
116
+
117
+ # Alternative: Use installation script
118
+ curl -sSL https://raw.githubusercontent.com/AlexParamonov/parabot/main/scripts/install | bash
119
+ ```
120
+
121
+
122
+ ---
123
+
124
+ ## Building Distribution
125
+
126
+ ### For Maintainers
127
+
128
+ ```bash
129
+ # Build standalone executable
130
+ ./scripts/build-distribution
131
+
132
+ # Test the build
133
+ BUILD_DIR=/tmp/test ./scripts/build-distribution
134
+
135
+ # Build gem package
136
+ gem build parabot.gemspec
137
+ ```
138
+
139
+ ### Build Requirements
140
+
141
+ **Development Dependencies:**
142
+ - Ruby 3.0+
143
+ - Bundler
144
+ - RSpec (for testing)
145
+ - Git
146
+
147
+ **Runtime Dependencies:**
148
+ - `dry-cli ~> 1.1`
149
+ - `config ~> 5.0`
150
+ - `semantic_logger ~> 4.15`
151
+
152
+ ### Distribution Testing
153
+
154
+ ```bash
155
+ # Run distribution tests
156
+ bundle exec rspec spec/distribution/
157
+
158
+ # Test on clean system
159
+ docker run --rm -v $(pwd):/app ruby:3.2 bash -c "cd /app && ./scripts/install"
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Troubleshooting
165
+
166
+ ### Common Issues
167
+
168
+ **"Ruby version too old"**
169
+ ```bash
170
+ # Check Ruby version
171
+ ruby --version
172
+
173
+ # Upgrade Ruby (using rbenv)
174
+ rbenv install 3.2.2
175
+ rbenv global 3.2.2
176
+ ```
177
+
178
+ **"Gem not found"**
179
+ ```bash
180
+ # Check gem environment
181
+ gem env
182
+
183
+ # Install missing dependencies
184
+ bundle install
185
+
186
+ # Reinstall gem
187
+ gem uninstall parabot
188
+ gem install parabot
189
+ ```
190
+
191
+ **"Command not found"**
192
+ ```bash
193
+ # Check PATH includes gem bin directory
194
+ echo $PATH
195
+ gem environment | grep "EXECUTABLE DIRECTORY"
196
+
197
+ # Add to PATH if needed
198
+ echo 'export PATH="$PATH:$(gem environment | grep "EXECUTABLE DIRECTORY" | cut -d: -f2 | tr -d " ")"' >> ~/.bashrc
199
+ source ~/.bashrc
200
+ ```
201
+
202
+ **Permission denied**
203
+ ```bash
204
+ # Use user installation instead of system
205
+ gem install --user-install parabot
206
+
207
+ # Or use installation script with custom directory
208
+ INSTALL_DIR=$HOME/.local/bin curl -sSL https://raw.githubusercontent.com/AlexParamonov/parabot/main/scripts/install | bash
209
+ ```
210
+
211
+ ### Platform-Specific Issues
212
+
213
+ **Linux: Missing development tools**
214
+ ```bash
215
+ sudo apt-get install build-essential ruby-dev # Ubuntu/Debian
216
+ sudo yum groupinstall "Development Tools" ruby-devel # CentOS/RHEL
217
+ ```
218
+
219
+ **macOS: Xcode command line tools**
220
+ ```bash
221
+ xcode-select --install
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Advanced Distribution
227
+
228
+ ### Package Managers
229
+
230
+ **Homebrew (macOS)** - *Coming Soon*
231
+ ```bash
232
+ brew install parabot
233
+ ```
234
+
235
+ **APT Repository (Ubuntu/Debian)** - *Coming Soon*
236
+ ```bash
237
+ curl -fsSL https://apt.parabot.dev/gpg | sudo apt-key add -
238
+ echo "deb https://apt.parabot.dev/ stable main" | sudo tee /etc/apt/sources.list.d/parabot.list
239
+ sudo apt-get update && sudo apt-get install parabot
240
+ ```
241
+
242
+ ### CI/CD Integration
243
+
244
+ **GitHub Actions**
245
+ ```yaml
246
+ - name: Install Parabot
247
+ run: |
248
+ curl -sSL https://raw.githubusercontent.com/AlexParamonov/parabot/main/scripts/install | bash
249
+ echo "$HOME/.local/bin" >> $GITHUB_PATH
250
+ ```
251
+
252
+ **Docker Build**
253
+ ```dockerfile
254
+ RUN gem install parabot
255
+ COPY . /workspace
256
+ WORKDIR /workspace
257
+ RUN parabot test
258
+ ```
259
+
260
+ ---
261
+
262
+ ## Security Considerations
263
+
264
+ - ✅ Installation script validates checksums
265
+ - ✅ HTTPS-only downloads
266
+ - ✅ No root permissions required for user installation
267
+ - ✅ Gem signed with maintainer key
268
+ - ⚠️ Always verify installation sources
269
+
270
+ ---
271
+
272
+ ## Support
273
+
274
+ - 📖 Documentation: [parabot.dev/docs](https://parabot.dev/docs)
275
+ - 🐛 Issues: [GitHub Issues](https://github.com/AlexParamonov/parabot/issues)
276
+ - 💬 Community: [Discord](https://discord.gg/parabot)
277
+ - 📧 Email: support@parabot.dev
278
+
279
+ ---
280
+
281
+ ## Contributing to Distribution
282
+
283
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on:
284
+ - Adding new distribution methods
285
+ - Improving installation scripts
286
+ - Testing on additional platforms
287
+ - Package manager integrations