Git diffs (#25)

* git diffs

* cmdline arg for git diff

* git diff validation

* change structure

* add git diff to model

* nits

* revert webhook

---------

Co-authored-by: Kartik Sarangmath <kartiksarangmath@Kartiks-MacBook-Air.local>
This commit is contained in:
ksarangmath
2025-07-21 23:38:38 -07:00
committed by GitHub
parent e5cc84202e
commit fbb4339a78
12 changed files with 336 additions and 1 deletions

View File

@@ -26,6 +26,8 @@ def run_stdio_server(args):
and args.claude_code_permission_tool
):
cmd.append("--claude-code-permission-tool")
if hasattr(args, "git_diff") and args.git_diff:
cmd.append("--git-diff")
subprocess.run(cmd)
@@ -77,6 +79,9 @@ Examples:
# Run with custom API base URL
omnara --stdio --api-key YOUR_API_KEY --base-url http://localhost:8000
# Run with git diff capture enabled
omnara --api-key YOUR_API_KEY --git-diff
""",
)
@@ -124,6 +129,11 @@ Examples:
action="store_true",
help="Enable Claude Code permission prompt tool for handling tool execution approvals (stdio mode only)",
)
parser.add_argument(
"--git-diff",
action="store_true",
help="Enable git diff capture for log_step and ask_question (stdio mode only)",
)
args = parser.parse_args()

View File

@@ -136,6 +136,7 @@ class AsyncOmnaraClient:
send_push: Optional[bool] = None,
send_email: Optional[bool] = None,
send_sms: Optional[bool] = None,
git_diff: Optional[str] = None,
) -> LogStepResponse:
"""Log a high-level step the agent is performing.
@@ -162,6 +163,8 @@ class AsyncOmnaraClient:
data["send_email"] = send_email
if send_sms is not None:
data["send_sms"] = send_sms
if git_diff is not None:
data["git_diff"] = git_diff
response = await self._make_request("POST", "/api/v1/steps", json=data)
@@ -181,6 +184,7 @@ class AsyncOmnaraClient:
send_push: Optional[bool] = None,
send_email: Optional[bool] = None,
send_sms: Optional[bool] = None,
git_diff: Optional[str] = None,
) -> QuestionResponse:
"""Ask the user a question and wait for their response.
@@ -212,6 +216,8 @@ class AsyncOmnaraClient:
data["send_email"] = send_email
if send_sms is not None:
data["send_sms"] = send_sms
if git_diff is not None:
data["git_diff"] = git_diff
# First, try the non-blocking endpoint to create the question
response = await self._make_request(