Commit Graph

6 Commits

Author SHA1 Message Date
95b90e3ac7 Update gitea/coder.py 2026-01-17 15:03:14 +00:00
20c86cd595 fix(gitea): restore full gitea_coder role implementation with all methods
The file was corrupted to only 4KB during previous edits. This restores the complete implementation with all methods including:
- workflow_summary()
- read_ticket()
- suggest_branch_name()
- create_feature_branch()
- get_branch_status()
- list_my_branches()
- apply_diff()
- _apply_unified_diff()
- _generate_diff_commit_message()
- commit_changes()
- create_pull_request()
- replace_file()
- create_file()
- get_file()
- list_files()

All with proper difflib import at module level.

Refs: #11
2026-01-17 15:02:13 +00:00
91fb3f77a3 fix(gitea): remove invalid import statement from function body
Removed the incorrectly placed `import difflib` line from inside
the _apply_unified_diff() method. The module is now imported at
the top of the file where it belongs.

Refs: #11
2026-01-17 14:44:16 +00:00
586c5effa7 fix(gitea): move difflib import to module level
The import statement was incorrectly placed inside a function body,
which is invalid Python syntax. Moved to module-level imports.

Also updated requirements to include difflib (part of stdlib, no pip install needed).

Refs: #11
2026-01-17 14:43:51 +00:00
6c03be54f3 feat(gitea): add diff-based updates and size delta gating to coder role
Enhancements:
- Added apply_diff() method for unified diff-based file updates
- Added commit_changes() with size delta quality gate (default 50%)
- Size delta gate blocks commits that exceed threshold to prevent data loss
- Auto-detects create vs replace operations
- Generates contextual commit messages from diffs
- Added _apply_unified_diff() helper for parsing and applying patches
- Added _generate_diff_commit_message() for auto-generating commit messages

Quality Gates:
- Files exceeding max_delta_percent (default 50%) are rejected
- Returns helpful guidance to use apply_diff() instead
- Prevents LLM accidental full file replacements

Refs: #11
2026-01-17 14:28:56 +00:00
11a19eb578 feat(gitea): implement gitea_coder role with scope enforcement
Implements the gitea_coder role with full file/branch operations and commit message generation.

Features:
- Branch creation with scope gating (prevents main pushes)
- Enforces branch naming conventions (feature/, fix/, refactor/, etc.)
- Generates detailed commit messages with ticket references
- Creates PRs from branches
- Reads ticket requirements from issues
- Unified file operations workflow

Technical:
- Uses existing gitea/dev.py operations
- Validates branch names against scope patterns
- Auto-generates commit messages with issue references
- Caches default branch per chat_id for session persistence

Refs: #11
2026-01-17 14:11:06 +00:00