Repository navigation
feat: add Gemini CLI as a host via a published extension branch [DITTO-1798] #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
663befa
feat: add Gemini CLI as a host via a published extension branch [DITT…
Peyton-Spencer 5e89b32
docs: describe the Gemini git-clone fallback prompt [DITTO-1798]
Peyton-Spencer 5c0d2df
chore: vendor the generator from ditto-skills b406544 [DITTO-1798]
Peyton-Spencer 4c52018
fix(validate): accept httpUrl only from the Gemini manifest [DITTO-1798]
Peyton-Spencer 7843a3e
test(publish): isolate throwaway repos from global Git config [DITTO-…
Peyton-Spencer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: Gemini extension branch | ||
| # Gemini CLI installs a GitHub repository only from its root, so plugins/ditto is | ||
| # published unchanged as the root of the gemini-extension branch: | ||
| # gemini extensions install https://github.com/ditto-assistant/ditto-plugins --ref gemini-extension | ||
| # Fast-forward only; nothing is force-pushed, released or submitted. | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'plugins/ditto/**' | ||
| - 'scripts/publish_extension_ref.py' | ||
| - '.github/workflows/gemini-extension.yml' | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
| concurrency: | ||
| group: gemini-extension-branch | ||
| cancel-in-progress: false | ||
| jobs: | ||
| publish: | ||
| if: github.ref == 'refs/heads/main' | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 15 | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 | ||
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 | ||
| with: | ||
| python-version: '3.12' | ||
| - name: Verify the package before publishing it | ||
| run: | | ||
| python3 scripts/shared_skills.py verify --host plugins --repo . | ||
| python3 -m unittest discover -s tests | ||
| python3 scripts/validate_package.py | ||
| - name: Publish plugins/ditto to the gemini-extension branch | ||
| env: | ||
| GIT_AUTHOR_NAME: github-actions[bot] | ||
| GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | ||
| GIT_COMMITTER_NAME: github-actions[bot] | ||
| GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | ||
| run: python3 scripts/publish_extension_ref.py --source "$GITHUB_SHA" --branch gemini-extension | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "name": "ditto", | ||
| "version": "0.3.8", | ||
| "description": "Search and save Ditto memories through hosted MCP, curate music, and hand off chats with verified continuation notes. Archival and owned workspace cleanup depend on host capabilities and authorization. Sign in through Gemini CLI.", | ||
| "mcpServers": { | ||
| "ditto": { | ||
| "httpUrl": "https://api.heyditto.ai/mcp" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| #!/usr/bin/env python3 | ||
| """Publish one plugin folder as the root of a dedicated branch for Gemini CLI. | ||
|
|
||
| Gemini CLI installs a GitHub repository only from its root: the manifest must | ||
| be `gemini-extension.json` at the top of the checkout, and skills load only from | ||
| `<root>/skills/`. It accepts `--ref` but no subdirectory. A root manifest here | ||
| would also make `agy plugin install <repo>` treat the whole repository as a | ||
| Gemini extension instead of installing plugins/ditto. | ||
|
|
||
| This script commits the tree of `<source>:plugins/<plugin>` unchanged as the | ||
| next commit of the `gemini-extension` branch, so | ||
|
|
||
| gemini extensions install https://github.com/ditto-assistant/ditto-plugins --ref gemini-extension | ||
|
|
||
| installs plugins/ditto with its manifest, skills and MCP server. Each publish | ||
| fast-forwards the branch from its previous head. It never force-pushes and does | ||
| nothing when the tree is unchanged. | ||
| """ | ||
| import argparse | ||
| import subprocess | ||
| import sys | ||
|
|
||
| MANIFEST = "gemini-extension.json" | ||
|
|
||
|
|
||
| def git(*args, check=True): | ||
| result = subprocess.run(["git", *args], capture_output=True, text=True) | ||
| if check and result.returncode: | ||
| raise RuntimeError(f"git {' '.join(args)} failed: {result.stderr.strip()}") | ||
| return result | ||
|
|
||
|
|
||
| def publish(source, prefix, branch, remote, dry_run=False): | ||
| commit = git("rev-parse", "--verify", f"{source}^{{commit}}").stdout.strip() | ||
| tree = git("rev-parse", "--verify", f"{commit}:{prefix}").stdout.strip() | ||
| if git("cat-file", "-e", f"{commit}:{prefix}/{MANIFEST}", check=False).returncode: | ||
| raise ValueError(f"{prefix}/{MANIFEST} is missing at {commit}") | ||
| tracking = f"refs/remotes/{remote}/{branch}" | ||
| fetched = git("fetch", "--no-tags", remote, f"+refs/heads/{branch}:{tracking}", check=False) | ||
| if fetched.returncode and git("ls-remote", "--exit-code", "--heads", remote, branch, check=False).returncode != 2: | ||
| raise RuntimeError(f"could not fetch {branch}: {fetched.stderr.strip()}") | ||
| parent = git("rev-parse", "--verify", "--quiet", tracking, check=False).stdout.strip() if not fetched.returncode else "" | ||
| if parent and git("rev-parse", f"{parent}^{{tree}}").stdout.strip() == tree: | ||
| print(f"{branch}: already {prefix} from {commit[:12]} (tree {tree[:12]}); nothing to publish") | ||
| return None | ||
| message = f"{prefix} from {commit}\n\nGenerated by scripts/publish_extension_ref.py; do not edit this branch.\n" | ||
| new = git("commit-tree", tree, *(["-p", parent] if parent else []), "-m", message).stdout.strip() | ||
| if dry_run: | ||
| print(f"{branch}: dry run; would push {new[:12]} ({prefix} at {commit[:12]}) on top of {parent[:12] or 'nothing'}") | ||
| return new | ||
| git("push", remote, f"{new}:refs/heads/{branch}") | ||
| print(f"{branch}: published {new} ({prefix} at {commit})") | ||
| return new | ||
|
|
||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) | ||
| parser.add_argument("--source", default="HEAD", help="commit to publish from (default HEAD)") | ||
| parser.add_argument("--plugin", default="ditto") | ||
| parser.add_argument("--branch", default="gemini-extension") | ||
| parser.add_argument("--remote", default="origin") | ||
| parser.add_argument("--dry-run", action="store_true") | ||
| args = parser.parse_args() | ||
| try: | ||
| publish(args.source, f"plugins/{args.plugin}", args.branch, args.remote, args.dry_run) | ||
| except (RuntimeError, ValueError) as error: | ||
| sys.exit(str(error)) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.