Spaces:
Sleeping
Sleeping
inital commit phase 1
Browse files- .gitignore +46 -0
- README.md +4 -0
- openenv.yaml +5 -0
- src/jira_to_code/models.py +16 -0
- src/jira_to_code/server/app.py +10 -0
- src/jira_to_code/server/env.py +41 -0
- src/jira_to_code/tasks/easy/calculator.py +0 -0
.gitignore
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
|
| 6 |
+
# Virtual environments
|
| 7 |
+
.venv/
|
| 8 |
+
venv/
|
| 9 |
+
env/
|
| 10 |
+
ENV/
|
| 11 |
+
|
| 12 |
+
# Distribution / packaging
|
| 13 |
+
build/
|
| 14 |
+
dist/
|
| 15 |
+
*.egg-info/
|
| 16 |
+
.eggs/
|
| 17 |
+
|
| 18 |
+
# Unit test / coverage reports
|
| 19 |
+
.pytest_cache/
|
| 20 |
+
.coverage
|
| 21 |
+
.coverage.*
|
| 22 |
+
htmlcov/
|
| 23 |
+
|
| 24 |
+
# Type checker / linter caches
|
| 25 |
+
.mypy_cache/
|
| 26 |
+
.pyre/
|
| 27 |
+
.ruff_cache/
|
| 28 |
+
|
| 29 |
+
# Jupyter
|
| 30 |
+
.ipynb_checkpoints/
|
| 31 |
+
|
| 32 |
+
# Local environment files
|
| 33 |
+
.env
|
| 34 |
+
.env.*
|
| 35 |
+
*.local
|
| 36 |
+
|
| 37 |
+
# Logs
|
| 38 |
+
*.log
|
| 39 |
+
|
| 40 |
+
# IDE / editor
|
| 41 |
+
.vscode/
|
| 42 |
+
.idea/
|
| 43 |
+
|
| 44 |
+
# OS-generated files
|
| 45 |
+
.DS_Store
|
| 46 |
+
Thumbs.db
|
README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Jira To Code
|
| 3 |
emoji: ⚡
|
|
@@ -9,3 +10,6 @@ license: mit
|
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<<<<<<< HEAD
|
| 2 |
---
|
| 3 |
title: Jira To Code
|
| 4 |
emoji: ⚡
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 13 |
+
=======
|
| 14 |
+
"# Jira-to-Code OpenEnv"
|
| 15 |
+
>>>>>>> fe8c706 (inital commit phase 1)
|
openenv.yaml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# openenv.yaml
|
| 2 |
+
name: jira-to-code
|
| 3 |
+
version: 0.1.0
|
| 4 |
+
description: An environment where agents resolve Jira tickets by reading, writing, and testing code.
|
| 5 |
+
entrypoint: src.jira_to_code.server.app:app
|
src/jira_to_code/models.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# src/jira_to_code/models.py
|
| 2 |
+
from typing import Literal, Optional, List, Dict, Any
|
| 3 |
+
from pydantic import Field
|
| 4 |
+
from openenv.core.env_server import Action, Observation
|
| 5 |
+
|
| 6 |
+
class JiraCodeAction(Action):
|
| 7 |
+
action_type: Literal["read_file", "write_file", "run_tests", "submit"]
|
| 8 |
+
file_path: Optional[str] = Field(default=None, description="Path to the file to read or write")
|
| 9 |
+
content: Optional[str] = Field(default=None, description="Code content to write to the file")
|
| 10 |
+
|
| 11 |
+
class JiraCodeObservation(Observation):
|
| 12 |
+
jira_ticket: str = Field(..., description="The objective the agent needs to complete")
|
| 13 |
+
file_tree: List[str] = Field(default_factory=list, description="List of files in the repo")
|
| 14 |
+
current_file_content: Optional[str] = Field(default=None, description="Content of the recently read/written file")
|
| 15 |
+
test_output: Optional[str] = Field(default=None, description="Output from running tests")
|
| 16 |
+
error: Optional[str] = Field(default=None, description="Any system errors (e.g., file not found)")
|
src/jira_to_code/server/app.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# src/jira_to_code/server/app.py
|
| 2 |
+
from openenv.core.env_server import create_web_interface_app
|
| 3 |
+
from src.jira_to_code.server.env import JiraToCodeEnv
|
| 4 |
+
from src.jira_to_code.models import JiraCodeAction, JiraCodeObservation
|
| 5 |
+
|
| 6 |
+
# Initialize the environment
|
| 7 |
+
env = JiraToCodeEnv
|
| 8 |
+
|
| 9 |
+
# Create the FastAPI app with the OpenEnv wrapper
|
| 10 |
+
app = create_web_interface_app(env, JiraCodeAction, JiraCodeObservation)
|
src/jira_to_code/server/env.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# src/jira_to_code/server/env.py
|
| 2 |
+
from typing import Tuple, Dict, Any
|
| 3 |
+
from openenv.core.env_server import Environment, State
|
| 4 |
+
from src.jira_to_code.models import JiraCodeAction, JiraCodeObservation
|
| 5 |
+
|
| 6 |
+
class JiraToCodeEnv(Environment):
|
| 7 |
+
def __init__(self):
|
| 8 |
+
super().__init__()
|
| 9 |
+
self.current_task = None
|
| 10 |
+
self.workspace_dir = None
|
| 11 |
+
self.step_count = 0
|
| 12 |
+
|
| 13 |
+
async def reset(self) -> JiraCodeObservation:
|
| 14 |
+
"""Initialize a new episode, return initial observation."""
|
| 15 |
+
self.step_count = 0
|
| 16 |
+
return JiraCodeObservation(
|
| 17 |
+
jira_ticket="TICKET-123: Fix off-by-one error in calculator.py",
|
| 18 |
+
file_tree=["calculator.py", "tests/test_calculator.py"],
|
| 19 |
+
current_file_content=None,
|
| 20 |
+
test_output=None,
|
| 21 |
+
error=None
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
async def step(self, action: JiraCodeAction) -> Tuple[JiraCodeObservation, float, bool, Dict[str, Any]]:
|
| 25 |
+
"""Execute action, return resulting Observation, reward, done, info."""
|
| 26 |
+
self.step_count += 1
|
| 27 |
+
|
| 28 |
+
obs = JiraCodeObservation(
|
| 29 |
+
jira_ticket="TICKET-123: Fix off-by-one error in calculator.py",
|
| 30 |
+
file_tree=["calculator.py", "tests/test_calculator.py"],
|
| 31 |
+
current_file_content="def add(a, b):\n return a + b + 1 # BUG",
|
| 32 |
+
test_output=None,
|
| 33 |
+
error=None
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
# Standard format: observation, reward, done, info dict
|
| 37 |
+
return obs, 0.0, False, {}
|
| 38 |
+
|
| 39 |
+
async def state(self) -> State:
|
| 40 |
+
"""Access episode metadata."""
|
| 41 |
+
return State(episode_id="test-123", step_count=self.step_count)
|
src/jira_to_code/tasks/easy/calculator.py
ADDED
|
File without changes
|