Skip to content

Fixes #237: [Fleet Execution] [GitPatch Local Download Example]#259

Merged
davideast merged 3 commits intomainfrom
fix-issue-237-7399303312790599316
Mar 10, 2026
Merged

Fixes #237: [Fleet Execution] [GitPatch Local Download Example]#259
davideast merged 3 commits intomainfrom
fix-issue-237-7399303312790599316

Conversation

@davideast
Copy link
Collaborator

Fixes #237

Added a new example packages/core/examples/gitpatch-local that demonstrates how to spin up a local git branch, run an AI coding session, retrieve the resulting GitPatch (changeSet), and safely apply the generated patch to the local codebase. The example contains the necessary scripts, documentation, and package.json to be executed out of the box.

Additionally, added a reference to this new example in the packages/core/README.md.


PR created automatically by Jules for task 7399303312790599316 started by @davideast

This commit introduces a new example demonstrating how to retrieve a `changeSet` artifact's `gitPatch` from a Jules session and apply it locally. It covers creating the branch, extracting the `unidiffPatch`, writing it to a patch file, and safely applying it to the local system using Git.
The SDK's core README has also been updated to link to this new example.

Fixes #237

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions bot added the fleet-merge-ready Ready for fleet sequential merge label Mar 10, 2026
@github-actions github-actions bot added this to the Examples milestone Mar 10, 2026
davideast and others added 2 commits March 10, 2026 02:09
This commit introduces a new example demonstrating how to retrieve a `changeSet` artifact's `gitPatch` from a Jules session snapshot and safely apply it locally.

Per user instructions, the example has been refactored into a CLI utilizing:
- `citty` for command-line argument parsing
- `zod` and the Typed Service Contract pattern for strict input validation, separation of impure side-effects into `handler.ts`, and structured error mapping (Result types)
- Agent-friendly `--json` flags to output machine-readable payloads

The SDK's core README has also been updated to link to this new example.

Fixes #237

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit enhances the `gitpatch-local` example by introducing advanced AI Agent CLI conventions:
- **Introspection:** Implements a `--describe` flag that dynamically outputs the JSON schema of the CLI's inputs and outputs using `zod-to-json-schema`, providing self-documenting capabilities to agents.
- **Safety Rails:** Adds a `--dry-run` flag that safely simulates the patching operation (skipping `git checkout`, `git apply`, and `git commit` actions) to allow agents to "think out loud" before mutating a local system.
- **Input Hardening:** Enhances the Zod spec to strictly reject path traversals, control characters, and embedded query string fragments in agent-provided arguments.
- **Agent Skill documentation:** Ships an `SKILL.md` file designed to be injected into an agent's context, explicitly detailing the safety instructions and expected behaviors of this tool.

Fixes #237

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@davideast davideast merged commit 0bfde63 into main Mar 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fleet-merge-ready Ready for fleet sequential merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fleet Execution] [GitPatch Local Download Example]

1 participant