Commit Graph

22 Commits

Author SHA1 Message Date
0afe00ab2c Update gitea/coder.py 2026-01-18 20:33:28 +00:00
86bfae2743 working on updates for gitea_coder 2026-01-17 18:41:31 -05:00
9ec4bb3491 feat(gitea): critical refactor - automatic branch management (v1.0.0)
CRITICAL ARCHITECTURAL CHANGE:
- LLM no longer manages branch names - system derives from chat_id
- All operations automatically use current working branch from chat_id session
- Branch parameter REMOVED from all operation functions
- Added _get_working_branch() helper for automatic branch detection
- Added _generate_branch_name() for system-managed branch naming
- All functions now use __chat_id__ parameter for branch detection

Complete file operations (NO branch parameter needed!):
- apply_diff() - diff-based updates
- commit_changes() - commit with size delta gating  
- create_file() - create new files
- replace_file() - replace entire file
- delete_file() - delete files  NEW
- rename_file() - rename files  NEW
- get_file() - read files
- list_files() - list directory contents

Updated workflow:
- create_feature_branch() generates branch name from issue_number + scope
- System caches: chat_id → working_branch
- All file operations use cached working branch from chat_id
- LLM focuses on code/content, not infrastructure

All functions now:
- Use __chat_id__ parameter for branch detection (REQUIRED)
- Get working branch from session cache (system-managed)
- Never accept branch names from LLM input

Documentation updated:
- workflow_summary() shows critical change notice
- All function docs updated to reflect automatic branch management
- Examples updated to show __chat_id__ usage

Version remains 1.0.0 (no release yet)

Refs: #11
2026-01-17 16:39:02 +00:00
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
dc9f128eb9 Update gitea/dev.py (#8)
Reviewed-on: #8
2026-01-15 20:43:12 +00:00
7f35b8fac4 fix(dev.py): fix CRUD operation bugs
- Fixed redundant __user__ checks in _get_token, _get_repo, _get_branch, _get_org
- Fixed merge_pull_request: proper conflict detection (409), merged status check, and empty response handling
- Fixed update_file: proper 404 handling before raise_for_status
- Fixed delete_file: proper 404 handling before raise_for_status
- Updated version to 1.4.1 with changelog

Refs: bug hunt fix
2026-01-15 17:43:06 +00:00
dbfeca8271 feat(gitea): Add CRUD operations for Issues and Pull Requests (#3) (#4)
**Review Summary**

 PASS - All CRUD operations implemented correctly

**Issues Fixed:**
- `merge_pull_request` output variable bug (early return)
- Duplicate docstring in `_get_branch`
- Namespace refactor for VeniceInfo (from PR comment feedback)

**Changes in this PR:**
- 9 Issue CRUD functions (get, update, close, reopen, delete, comments)
- 7 PR CRUD functions (get, update, merge, comments)
- Version bumped to 1.4.0

Ready to merge. The code follows existing patterns with proper error handling and confirmation dialogs for destructive operations.

Reviewed-on: #4
2026-01-15 13:45:16 +00:00
7b64a69e21 Delete gitea/dev_broken.py 2026-01-14 15:47:20 +00:00
be7d3852b4 Update gitea/dev.py 2026-01-14 15:45:27 +00:00
1b101b2256 Update gitea/dev.py 2026-01-14 15:32:17 +00:00
b3a4887b47 Update gitea/dev.py 2026-01-14 13:55:37 +00:00
7587c9fefe Add gitea/dev.py 2026-01-14 13:55:05 +00:00
67bf06d7d4 Update gitea/dev_broken.py 2026-01-14 13:54:04 +00:00
2a3b615a3b Update gitea/dev.py 2026-01-13 19:15:27 +00:00
d96c439c06 Update gitea/admin.py 2026-01-13 19:08:17 +00:00
673e5d434d Add gitea/dev.py 2026-01-13 18:23:29 +00:00
259fe538d4 Add gitea/admin.py 2026-01-13 18:22:43 +00:00