sugarai 1.5.2__tar.gz

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 (35) hide show
  1. sugarai-1.5.2/PKG-INFO +678 -0
  2. sugarai-1.5.2/README.md +629 -0
  3. sugarai-1.5.2/pyproject.toml +148 -0
  4. sugarai-1.5.2/setup.cfg +4 -0
  5. sugarai-1.5.2/sugar/__init__.py +0 -0
  6. sugarai-1.5.2/sugar/__version__.py +35 -0
  7. sugarai-1.5.2/sugar/core/__init__.py +0 -0
  8. sugarai-1.5.2/sugar/core/loop.py +1014 -0
  9. sugarai-1.5.2/sugar/discovery/__init__.py +0 -0
  10. sugarai-1.5.2/sugar/discovery/code_quality.py +408 -0
  11. sugarai-1.5.2/sugar/discovery/error_monitor.py +393 -0
  12. sugarai-1.5.2/sugar/discovery/github_watcher.py +658 -0
  13. sugarai-1.5.2/sugar/discovery/test_coverage.py +494 -0
  14. sugarai-1.5.2/sugar/executor/__init__.py +0 -0
  15. sugarai-1.5.2/sugar/executor/claude_wrapper.py +846 -0
  16. sugarai-1.5.2/sugar/executor/structured_request.py +577 -0
  17. sugarai-1.5.2/sugar/learning/__init__.py +0 -0
  18. sugarai-1.5.2/sugar/learning/adaptive_scheduler.py +154 -0
  19. sugarai-1.5.2/sugar/learning/feedback_processor.py +467 -0
  20. sugarai-1.5.2/sugar/main.py +1592 -0
  21. sugarai-1.5.2/sugar/storage/__init__.py +0 -0
  22. sugarai-1.5.2/sugar/storage/work_queue.py +487 -0
  23. sugarai-1.5.2/sugar/utils/__init__.py +0 -0
  24. sugarai-1.5.2/sugar/utils/git_operations.py +213 -0
  25. sugarai-1.5.2/sugar/workflow/__init__.py +3 -0
  26. sugarai-1.5.2/sugar/workflow/orchestrator.py +248 -0
  27. sugarai-1.5.2/sugarai.egg-info/PKG-INFO +678 -0
  28. sugarai-1.5.2/sugarai.egg-info/SOURCES.txt +33 -0
  29. sugarai-1.5.2/sugarai.egg-info/dependency_links.txt +1 -0
  30. sugarai-1.5.2/sugarai.egg-info/entry_points.txt +2 -0
  31. sugarai-1.5.2/sugarai.egg-info/requires.txt +30 -0
  32. sugarai-1.5.2/sugarai.egg-info/top_level.txt +1 -0
  33. sugarai-1.5.2/tests/test_cli.py +258 -0
  34. sugarai-1.5.2/tests/test_core_loop.py +253 -0
  35. sugarai-1.5.2/tests/test_storage.py +468 -0
sugarai-1.5.2/PKG-INFO ADDED
@@ -0,0 +1,678 @@
1
+ Metadata-Version: 2.4
2
+ Name: sugarai
3
+ Version: 1.5.2
4
+ Summary: Sugar - AI-powered autonomous development system for Claude Code CLI
5
+ Author-email: Steven Leggett <contact@roboticforce.io>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/cdnsteve/sugar
8
+ Project-URL: Documentation, https://docs.roboticforce.io/sugar
9
+ Project-URL: Repository, https://github.com/cdnsteve/sugar
10
+ Project-URL: Bug Tracker, https://github.com/cdnsteve/sugar/issues
11
+ Keywords: claude,autonomous,development,ai,automation
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Topic :: Software Development :: Quality Assurance
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: click>=8.1.0
23
+ Requires-Dist: pyyaml>=6.0
24
+ Requires-Dist: aiosqlite>=0.19.0
25
+ Requires-Dist: sqlalchemy>=2.0.0
26
+ Requires-Dist: python-dotenv>=1.0.0
27
+ Requires-Dist: asyncio-throttle>=1.0.0
28
+ Requires-Dist: setuptools>=45
29
+ Provides-Extra: github
30
+ Requires-Dist: PyGithub>=1.59.0; extra == "github"
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
33
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
34
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
35
+ Requires-Dist: black>=23.0.0; extra == "dev"
36
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
37
+ Requires-Dist: flake8-docstrings>=1.7.0; extra == "dev"
38
+ Requires-Dist: isort>=5.12.0; extra == "dev"
39
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
40
+ Requires-Dist: bandit>=1.7.5; extra == "dev"
41
+ Requires-Dist: safety>=2.3.0; extra == "dev"
42
+ Requires-Dist: pre-commit>=3.0.0; extra == "dev"
43
+ Requires-Dist: types-PyYAML>=6.0.0; extra == "dev"
44
+ Requires-Dist: types-requests>=2.28.0; extra == "dev"
45
+ Provides-Extra: test
46
+ Requires-Dist: pytest>=7.0.0; extra == "test"
47
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
48
+ Requires-Dist: pytest-cov>=4.0.0; extra == "test"
49
+
50
+ # Sugar - AI-Powered Autonomous Development System
51
+
52
+ **An intelligent autonomous development assistant that works 24/7 to improve your codebase using Claude AI.**
53
+
54
+ Sugar is a lightweight autonomous development system specifically designed for Claude Code CLI integration that can be installed as a library in any project. It continuously discovers work from GitHub issues, error logs, and code quality analysis, then automatically implements fixes and improvements using Claude's advanced reasoning capabilities.
55
+
56
+ ## ✨ What Makes Sugar Special
57
+
58
+ - 🤖 **Truly Autonomous**: Runs 24/7 discovering and fixing issues without human intervention
59
+ - 🧠 **Advanced Agent Integration**: Intelligently selects optimal Claude agents for each task type
60
+ - 🚀 **Dynamic Agent Discovery**: Works with **any** Claude agents you have configured locally
61
+ - 🔍 **Smart Discovery**: Automatically finds work from GitHub issues, error logs, and code analysis
62
+ - 🎯 **Project-Focused**: Each project gets isolated Sugar instance with custom configuration
63
+ - 🔧 **Battle-Tested**: Handles real development workflows with git, GitHub, testing, and deployment
64
+ - 📊 **Quality Tracking**: Monitors agent performance with detailed analytics and confidence scoring
65
+ - 📈 **Learning System**: Adapts and improves based on success/failure patterns
66
+
67
+ ## 🚀 Quick Start
68
+
69
+ ### Prerequisites
70
+
71
+ **Required:** Sugar requires Claude Code CLI to be installed and accessible.
72
+
73
+ 1. **Install Claude Code CLI** (if not already installed):
74
+ - Visit [Claude Code CLI documentation](https://docs.anthropic.com/en/docs/claude-code) for installation instructions
75
+ - Or install via npm: `npm install -g @anthropic-ai/claude-code-cli`
76
+ - Verify installation: `claude --version`
77
+
78
+ 2. **Ensure Claude CLI is in your PATH** or note its location for configuration
79
+
80
+ ⚠️ **Important:** Sugar is designed to run **outside** of Claude Code sessions. Run Sugar directly in your terminal/shell, not within a Claude Code session. Sugar will call Claude Code CLI as needed to execute tasks.
81
+
82
+ ### Installation
83
+
84
+ **Currently in development - install from source:**
85
+
86
+ ```bash
87
+ # Method 1: Clone and install (recommended)
88
+ git clone https://github.com/cdnsteve/sugar.git
89
+ cd sugar
90
+ pip install -e .
91
+
92
+ # Method 2: Direct from Git (SSH) - Always use main branch
93
+ pip install -e git+ssh://git@github.com/cdnsteve/sugar.git@main#egg=sugar
94
+
95
+ # Note: Always install from main branch to get the latest features
96
+ # including version reporting (--version flag) and recent bug fixes
97
+ ```
98
+
99
+ 📖 **Detailed setup instructions:** [Local Development Setup](docs/dev/local-development.md)
100
+
101
+ ### Initialize in Your Project
102
+
103
+ ```bash
104
+ cd /path/to/your/project
105
+ sugar init
106
+ ```
107
+
108
+ **Note:** Sugar will auto-detect your Claude CLI installation. If it's not in your PATH, you can specify the location in `.sugar/config.yaml` after initialization.
109
+
110
+ ### Add Some Work
111
+
112
+ ```bash
113
+ sugar add "Implement user authentication" --type feature --priority 4
114
+ sugar add "Fix memory leak in auth module" --type bug_fix --urgent
115
+ sugar add "Add unit tests for payments" --type test --priority 3
116
+ ```
117
+
118
+ ### Get Help Anytime
119
+
120
+ ```bash
121
+ # Comprehensive help and quick reference
122
+ sugar help
123
+
124
+ # Command-specific help
125
+ sugar add --help
126
+ sugar run --help
127
+ ```
128
+
129
+ ### Start Autonomous Development
130
+
131
+ ```bash
132
+ # Test with dry run first
133
+ sugar run --dry-run --once
134
+
135
+ # Start 24/7 autonomous operation
136
+ sugar run
137
+ ```
138
+
139
+ ## 🎯 What Sugar Does
140
+
141
+ Sugar operates in **two modes**:
142
+
143
+ ### 🤖 Autonomous Discovery
144
+ Sugar continuously:
145
+ - 🔍 **Discovers work** from error logs, feedback, and GitHub issues
146
+ - 📊 **Analyzes code quality** and identifies improvements
147
+ - 🧪 **Detects missing tests** and coverage gaps
148
+ - ⚡ **Executes tasks** using Claude Code CLI with full context
149
+ - 🌿 **Creates branches & PRs** or commits directly to main (configurable)
150
+ - 💬 **Updates GitHub issues** with detailed progress and completion status
151
+ - 🧠 **Learns and adapts** from results to improve future performance
152
+ - 🔄 **Repeats autonomously** 24/7 without human intervention
153
+
154
+ ### 👤 Manual Task Management
155
+ You can also directly add tasks:
156
+ - 📝 **Add specific tasks** via `sugar add "task description"`
157
+ - 🎯 **Set priorities** and task types (bug_fix, feature, test, etc.)
158
+ - 📋 **Manage work queue** with full CLI control
159
+ - 🔄 **Combined workflow** - manual tasks + autonomous discovery
160
+
161
+ ## 📁 Clean Project Structure
162
+
163
+ Sugar keeps everything contained in `.sugar/` directory - no clutter in your project root!
164
+
165
+ ```
166
+ your-project/
167
+ ├── src/ # Your project source
168
+ ├── .sugar/ # Sugar-specific files (isolated)
169
+ │ ├── config.yaml # Project-specific config
170
+ │ ├── sugar.db # Project-specific database
171
+ │ ├── sugar.log # Project-specific logs
172
+ │ └── context.json # Claude context
173
+ ├── .gitignore # Just add: .sugar/
174
+ └── logs/errors/ # Your error logs (monitored)
175
+ ```
176
+
177
+ **Simple .gitignore:** Just add `.sugar/` to your `.gitignore` - that's it!
178
+ 📖 [Complete .gitignore template](docs/user/gitignore-template.md)
179
+
180
+ ## 🔧 Configuration
181
+
182
+ Auto-generated `.sugar/config.yaml` with sensible defaults:
183
+
184
+ ```yaml
185
+ sugar:
186
+ # Core Loop Settings
187
+ loop_interval: 300 # 5 minutes between cycles
188
+ max_concurrent_work: 3 # Execute multiple tasks per cycle
189
+ dry_run: true # Start in safe mode - change to false when ready
190
+
191
+ # Claude Code Integration
192
+ claude:
193
+ command: "/path/to/claude" # Auto-detected Claude CLI path
194
+ timeout: 1800 # 30 minutes max per task
195
+ context_file: ".sugar/context.json"
196
+
197
+ # Agent Integration (v1.2.0+)
198
+ use_structured_requests: true # Enable structured JSON communication
199
+ enable_agents: true # Enable Claude agent mode selection
200
+ agent_fallback: true # Fall back to basic Claude if agent fails
201
+ agent_selection: # Map work types to specific agents
202
+ bug_fix: "tech-lead" # Strategic analysis for bug fixes
203
+ feature: "general-purpose" # General development for features
204
+ refactor: "code-reviewer" # Code review expertise for refactoring
205
+ test: "general-purpose" # General development for tests
206
+ documentation: "general-purpose" # General development for docs
207
+ # available_agents: [] # Optional: specify which agents are available
208
+ # If empty, Sugar accepts any agent name
209
+
210
+ # Work Discovery
211
+ discovery:
212
+ error_logs:
213
+ enabled: true
214
+ paths: ["logs/errors/", "logs/feedback/", ".sugar/logs/"]
215
+ patterns: ["*.json", "*.log"]
216
+ max_age_hours: 24
217
+
218
+ github:
219
+ enabled: false # Set to true and configure to enable
220
+ repo: "" # e.g., "user/repository"
221
+ issue_labels: [] # No filtering - work on ALL open issues
222
+ workflow:
223
+ auto_close_issues: true
224
+ git_workflow: "direct_commit" # direct_commit|pull_request
225
+
226
+ code_quality:
227
+ enabled: true
228
+ root_path: "."
229
+ file_extensions: [".py", ".js", ".ts", ".jsx", ".tsx"]
230
+ excluded_dirs: ["node_modules", ".git", "__pycache__", "venv", ".venv", ".sugar"]
231
+ max_files_per_scan: 50
232
+
233
+ test_coverage:
234
+ enabled: true
235
+ root_path: "."
236
+ source_dirs: ["src", "lib", "app", "api", "server"]
237
+ test_dirs: ["tests", "test", "__tests__", "spec"]
238
+
239
+ # Storage
240
+ storage:
241
+ database: ".sugar/sugar.db" # Project-specific database
242
+ backup_interval: 3600 # 1 hour
243
+
244
+ # Safety
245
+ safety:
246
+ max_retries: 3
247
+ excluded_paths:
248
+ - "/System"
249
+ - "/usr/bin"
250
+ - "/etc"
251
+ - ".sugar"
252
+
253
+ # Logging
254
+ logging:
255
+ level: "INFO"
256
+ file: ".sugar/sugar.log" # Project-specific logs
257
+ ```
258
+
259
+ ## 🤖 Claude Agent Integration
260
+
261
+ **Sugar v1.2.0+ includes advanced Claude agent integration with dynamic agent discovery!**
262
+
263
+ Sugar intelligently selects the best Claude agent for each task based on work characteristics, and supports **any agents you have configured locally** - not just built-in ones.
264
+
265
+ ### 🎯 Intelligent Agent Selection
266
+
267
+ Sugar automatically analyzes your work items and selects the optimal agent:
268
+
269
+ ```bash
270
+ # High-priority security bug → tech-lead agent
271
+ sugar add --type bug_fix --priority 5 --title "Critical auth vulnerability"
272
+
273
+ # Code refactoring → code-reviewer agent
274
+ sugar add --type refactor --title "Clean up legacy payment code"
275
+
276
+ # Social media content → social-media-growth-strategist agent
277
+ sugar add --type documentation --title "Create LinkedIn content for developer audience"
278
+
279
+ # Standard feature → general-purpose agent
280
+ sugar add --type feature --title "Add user profile settings"
281
+ ```
282
+
283
+ ### 🔧 Agent Configuration
284
+
285
+ Configure agents in `.sugar/config.yaml`:
286
+
287
+ ```yaml
288
+ claude:
289
+ # Structured Request System
290
+ use_structured_requests: true
291
+
292
+ # Agent Selection System
293
+ enable_agents: true # Enable agent mode selection
294
+ agent_fallback: true # Fall back to basic Claude if agent fails
295
+
296
+ # Map work types to specific agents (built-in or custom)
297
+ agent_selection:
298
+ bug_fix: "tech-lead" # Built-in agent
299
+ feature: "my-frontend-specialist" # Your custom agent
300
+ refactor: "code-reviewer" # Built-in agent
301
+ test: "general-purpose" # Built-in agent
302
+ documentation: "technical-writer" # Your custom agent
303
+
304
+ # Dynamic Agent Discovery - specify your available agents
305
+ available_agents: [
306
+ "tech-lead", # Built-in agents
307
+ "code-reviewer",
308
+ "general-purpose",
309
+ "my-frontend-specialist", # Your custom agents
310
+ "technical-writer",
311
+ "database-expert",
312
+ "security-specialist"
313
+ ]
314
+
315
+ # If available_agents is empty/unspecified, Sugar accepts any agent name
316
+ ```
317
+
318
+ ### 🌟 Built-in Agent Types
319
+
320
+ Sugar includes intelligent selection for these built-in agents:
321
+
322
+ | Agent | Best For | Keywords |
323
+ |-------|----------|----------|
324
+ | **tech-lead** | Strategic analysis, architecture, complex bugs, high-priority work | architecture, design, strategy, security, critical |
325
+ | **code-reviewer** | Code quality, refactoring, optimization, best practices | review, refactor, cleanup, optimize, code quality |
326
+ | **social-media-growth-strategist** | Content strategy, engagement, audience growth | social media, content, engagement, followers |
327
+ | **general-purpose** | Standard development work (features, tests, docs) | Default for most tasks |
328
+ | **statusline-setup** | Claude Code status line configuration | statusline, status line |
329
+ | **output-style-setup** | Claude Code output styling and themes | output style, styling, theme |
330
+
331
+ ### 🚀 Custom Agent Support
332
+
333
+ **Sugar supports ANY agents you have configured locally!** Examples:
334
+
335
+ ```yaml
336
+ claude:
337
+ agent_selection:
338
+ bug_fix: "my-security-expert" # Your custom security agent
339
+ feature: "frontend-guru" # Your custom frontend agent
340
+ refactor: "performance-wizard" # Your custom performance agent
341
+ database: "sql-specialist" # Your custom database agent
342
+ ```
343
+
344
+ ### 🧠 How Agent Selection Works
345
+
346
+ 1. **User Configuration First**: Checks your `agent_selection` mapping
347
+ 2. **Keyword Analysis**: Uses intelligent keyword matching as fallback
348
+ 3. **Availability Validation**: Ensures selected agent is in your `available_agents` list
349
+ 4. **Graceful Fallback**: Falls back to available alternatives if needed
350
+ 5. **Quality Assessment**: Tracks agent performance with 0.0-1.0 quality scores
351
+
352
+ ### 📊 Agent Performance Tracking
353
+
354
+ Sugar provides detailed analytics for agent performance:
355
+
356
+ ```bash
357
+ # View work with timing and agent information
358
+ sugar list
359
+ # 📋 20 Tasks (16 pending ⏳, 2 completed ✅, 1 active ⚡, 1 failed ❌):
360
+ # ⏱️ 45.2s | 🕐 2m 15s | 🤖 tech-lead | Critical auth fix
361
+
362
+ sugar view TASK_ID
363
+ # Shows: agent used, quality score, confidence level, execution time
364
+ ```
365
+
366
+ ### 🔄 Fallback Strategy
367
+
368
+ Sugar uses a robust multi-layer fallback system:
369
+
370
+ 1. **Selected Agent** (from configuration or keyword analysis)
371
+ 2. **Basic Claude** (if agent fails)
372
+ 3. **Legacy Mode** (if structured requests fail)
373
+
374
+ This ensures your work **never fails** due to agent issues.
375
+
376
+ ### ⚙️ Migration from v1.1.x
377
+
378
+ Existing Sugar installations automatically get agent support with **zero breaking changes**:
379
+
380
+ - All existing configurations continue working unchanged
381
+ - Agents are **opt-in** - set `enable_agents: false` to disable
382
+ - Without agent configuration, Sugar uses intelligent defaults
383
+
384
+ ## 📋 Command Reference
385
+
386
+ ### Task Management
387
+ ```bash
388
+ # Add tasks with different types and priorities
389
+ sugar add "Task title" [--type TYPE] [--priority 1-5] [--urgent] [--description DESC]
390
+
391
+ # Types: bug_fix, feature, test, refactor, documentation
392
+ # Priority: 1 (low) to 5 (urgent)
393
+
394
+ # List tasks
395
+ sugar list [--status STATUS] [--type TYPE] [--limit N]
396
+
397
+ # View specific task details
398
+ sugar view TASK_ID
399
+
400
+ # Update existing task
401
+ sugar update TASK_ID [--title TITLE] [--description DESC] [--priority 1-5] [--type TYPE] [--status STATUS]
402
+
403
+ # Remove task
404
+ sugar remove TASK_ID
405
+
406
+ # Check system status
407
+ sugar status
408
+ ```
409
+
410
+ ### System Operation
411
+ ```bash
412
+ # Initialize Sugar in current directory
413
+ sugar init [--project-dir PATH]
414
+
415
+ # Run autonomous loop
416
+ sugar run [--dry-run] [--once] [--validate]
417
+
418
+ # Validate configuration
419
+ sugar run --validate
420
+ ```
421
+
422
+ ## 🔄 Multi-Project Usage
423
+
424
+ Run Sugar across multiple projects simultaneously:
425
+
426
+ ```bash
427
+ # Project A
428
+ cd /path/to/project-a
429
+ sugar init && sugar run &
430
+
431
+ # Project B
432
+ cd /path/to/project-b
433
+ sugar init && sugar run &
434
+
435
+ # Project C
436
+ cd /path/to/project-c
437
+ sugar init && sugar run &
438
+ ```
439
+
440
+ Each project operates independently with isolated:
441
+ - Configuration and database
442
+ - Work queues and execution
443
+ - Discovery and learning
444
+
445
+ ## 🛡️ Safety Features
446
+
447
+ - **Dry run mode** - Simulates execution without making changes (default)
448
+ - **Path exclusions** - Prevents system file modifications
449
+ - **Project isolation** - Uses `.sugar/` directory to avoid conflicts
450
+ - **Timeout handling** - Prevents runaway processes
451
+ - **Auto-detection** - Finds Claude CLI automatically
452
+ - **Graceful shutdown** - Handles interrupts cleanly
453
+
454
+ ## 💾 Storage & Context
455
+
456
+ Sugar maintains project-specific data isolation:
457
+
458
+ - **Project Database**: `.sugar/sugar.db` stores all task data, execution history, and learning
459
+ - **Context Management**: `.sugar/context.json` preserves Claude Code session context
460
+ - **Automated Backups**: Regular database backups with configurable intervals
461
+ - **Isolated Logs**: Project-specific logging in `.sugar/sugar.log`
462
+
463
+ Each Sugar instance is completely isolated - you can run multiple projects simultaneously without interference.
464
+
465
+ ## 🔍 Work Input Methods
466
+
467
+ Sugar accepts work from **multiple sources**:
468
+
469
+ ### 📝 Manual CLI Input
470
+ Direct task management via command line:
471
+ ```bash
472
+ sugar add "Implement user registration" --type feature --priority 4
473
+ sugar add "Fix authentication bug" --type bug_fix --urgent
474
+ sugar add "Add API tests" --type test --priority 3
475
+ ```
476
+
477
+ ### 🤖 Autonomous Discovery
478
+ Sugar automatically finds work from:
479
+
480
+ ### Error Logs
481
+ Monitors specified directories for error files:
482
+ ```yaml
483
+ discovery:
484
+ error_logs:
485
+ paths: ["logs/errors/", "app/logs/"]
486
+ patterns: ["*.json", "*.log"]
487
+ ```
488
+
489
+ ### Code Quality Analysis
490
+ Scans source code for improvements:
491
+ ```yaml
492
+ discovery:
493
+ code_quality:
494
+ file_extensions: [".py", ".js", ".ts"]
495
+ excluded_dirs: ["node_modules", "venv"]
496
+ ```
497
+
498
+ ### Test Coverage Analysis
499
+ Identifies missing tests:
500
+ ```yaml
501
+ discovery:
502
+ test_coverage:
503
+ source_dirs: ["src", "lib"]
504
+ test_dirs: ["tests", "spec"]
505
+ ```
506
+
507
+ ### GitHub Integration (Optional)
508
+ Monitors repository issues and PRs:
509
+ ```yaml
510
+ discovery:
511
+ github:
512
+ enabled: true
513
+ repo: "owner/repository"
514
+ token: "ghp_your_token"
515
+ ```
516
+
517
+ ## 📊 Monitoring
518
+
519
+ ### Per-Project Monitoring
520
+
521
+ Each project has its own isolated Sugar instance. Commands are project-specific:
522
+
523
+ ```bash
524
+ # Check status for current project
525
+ sugar status
526
+
527
+ # Monitor logs for current project
528
+ tail -f .sugar/sugar.log
529
+
530
+ # List recent work for current project (shows status summary)
531
+ sugar list --status completed --limit 10
532
+
533
+ # Background operation for current project
534
+ nohup sugar run > sugar-autonomous.log 2>&1 &
535
+ ```
536
+
537
+ ### Multi-Project Monitoring
538
+
539
+ To monitor Sugar across multiple projects, you need to check each project directory:
540
+
541
+ ```bash
542
+ # Example script to check all projects
543
+ for project in ~/projects/*; do
544
+ if [ -d "$project/.sugar" ]; then
545
+ echo "📂 Project: $(basename $project)"
546
+ cd "$project"
547
+ sugar status | grep -E "(Total Tasks|Pending|Active|Completed)"
548
+ echo
549
+ fi
550
+ done
551
+ ```
552
+
553
+ ## 🎛️ Advanced Usage
554
+
555
+ ### Custom Error Integration
556
+
557
+ Configure Sugar to monitor your application's error logs:
558
+
559
+ ```yaml
560
+ discovery:
561
+ error_logs:
562
+ paths:
563
+ - "logs/errors/"
564
+ - "monitoring/alerts/"
565
+ - "var/log/myapp/"
566
+ ```
567
+
568
+ ### Team Workflow
569
+
570
+ 1. Each developer runs Sugar locally
571
+ 2. Share configuration templates (without tokens)
572
+ 3. Different priorities for different team members
573
+ 4. GitHub integration prevents duplicate work
574
+
575
+ ### Production Deployment
576
+
577
+ - Test thoroughly in staging environments
578
+ - Monitor resource usage and performance
579
+ - Set appropriate concurrency and timeout limits
580
+ - Ensure rollback procedures are in place
581
+
582
+ ## 🚨 Troubleshooting
583
+
584
+ ### Common Issues
585
+
586
+ **Claude CLI not found:**
587
+ ```bash
588
+ # First, check if Claude CLI is installed
589
+ claude --version
590
+
591
+ # If not installed, install it:
592
+ npm install -g @anthropic-ai/claude-code-cli
593
+
594
+ # If installed but not found by Sugar, edit .sugar/config.yaml:
595
+ claude:
596
+ command: "/full/path/to/claude" # Specify exact path
597
+ ```
598
+
599
+ **No work discovered:**
600
+ ```bash
601
+ # Check paths exist
602
+ ls -la logs/errors/
603
+
604
+ # Validate configuration
605
+ sugar run --validate
606
+
607
+ # Test with sample error
608
+ echo '{"error": "test"}' > logs/errors/test.json
609
+ ```
610
+
611
+ **Tasks not executing:**
612
+ ```bash
613
+ # Check dry_run setting
614
+ cat .sugar/config.yaml | grep dry_run
615
+
616
+ # Monitor logs
617
+ tail -f .sugar/sugar.log
618
+
619
+ # Test single cycle
620
+ sugar run --once
621
+ ```
622
+
623
+ ## 📚 Documentation
624
+
625
+ - **[Complete Documentation Hub](docs/README.md)** - All Sugar documentation
626
+ - **[Quick Start Guide](docs/user/quick-start.md)** - Get up and running in 5 minutes
627
+ - **[Local Development Setup](docs/dev/local-development.md)** - Install and test Sugar locally (before PyPI)
628
+ - **[GitHub Integration](docs/user/github-integration.md)** - Connect Sugar to GitHub issues and PRs
629
+ - **[Installation Guide](docs/user/installation-guide.md)** - Comprehensive installation and usage
630
+ - **[CLI Reference](docs/user/cli-reference.md)** - Complete command reference
631
+ - **[Contributing Guide](docs/dev/contributing.md)** - How to contribute to Sugar
632
+
633
+ ## 🎯 Use Cases
634
+
635
+ ### Individual Developer
636
+ - Continuous bug fixing from error logs
637
+ - Automated test creation for uncovered code
638
+ - Documentation updates when code changes
639
+ - Code quality improvements during idle time
640
+
641
+ ### Development Team
642
+ - Shared work discovery across team projects
643
+ - Automated issue processing from GitHub
644
+ - Continuous integration of feedback loops
645
+ - 24/7 development progress across multiple repos
646
+
647
+ ### Product Teams
648
+ - Autonomous handling of user feedback
649
+ - Automated response to monitoring alerts
650
+ - Continuous improvement of code quality metrics
651
+ - Proactive maintenance and technical debt reduction
652
+
653
+ ## 🔮 Roadmap
654
+
655
+ - ✅ **Phase 1**: Core loop, error discovery, basic execution
656
+ - ✅ **Phase 2**: Smart discovery (GitHub, code quality, test coverage)
657
+ - ✅ **Phase 3**: Learning and adaptation system
658
+ - 🚧 **Phase 4**: PyPI package distribution
659
+ - 📋 **Phase 5**: Enhanced integrations (Slack, Jira, monitoring systems)
660
+ - 📋 **Phase 6**: Team coordination and conflict resolution
661
+
662
+ ## 🤝 Contributing
663
+
664
+ 1. Test changes with `--dry-run` and `--once`
665
+ 2. Validate configuration with `--validate`
666
+ 3. Check logs in `.sugar/sugar.log`
667
+ 4. Follow existing code patterns
668
+ 5. Update documentation for new features
669
+
670
+ ## 📄 License
671
+
672
+ MIT License - see LICENSE file for details.
673
+
674
+ ---
675
+
676
+ **Claude Sugar v0.1.0** - Built for Claude Code CLI autonomous development across any project or codebase.
677
+
678
+ *Transform any project into an autonomous development environment with just `sugar init`.*