toolbase 0.9.0__tar.gz → 0.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. {toolbase-0.9.0 → toolbase-0.10.0}/CHANGELOG.md +20 -0
  2. {toolbase-0.9.0 → toolbase-0.10.0}/PKG-INFO +8 -5
  3. {toolbase-0.9.0 → toolbase-0.10.0}/README.md +7 -4
  4. {toolbase-0.9.0 → toolbase-0.10.0}/pyproject.toml +1 -1
  5. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/cli.py +27 -48
  6. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/connect/__init__.py +7 -2
  7. toolbase-0.10.0/toolbase/connect/antigravity.py +242 -0
  8. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/connect/orchestral.py +14 -14
  9. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/skills.py +1 -0
  10. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase.egg-info/SOURCES.txt +1 -0
  11. {toolbase-0.9.0 → toolbase-0.10.0}/LICENSE +0 -0
  12. {toolbase-0.9.0 → toolbase-0.10.0}/MANIFEST.in +0 -0
  13. {toolbase-0.9.0 → toolbase-0.10.0}/setup.cfg +0 -0
  14. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/__init__.py +0 -0
  15. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/_setup_host.py +0 -0
  16. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/_toolkit_host.py +0 -0
  17. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/astro.py +0 -0
  18. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/auth.py +0 -0
  19. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/config.py +0 -0
  20. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/connect/base.py +0 -0
  21. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/connect/claude_code.py +0 -0
  22. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/connect/codex.py +0 -0
  23. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/connect/opencode.py +0 -0
  24. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/envs/__init__.py +0 -0
  25. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/envs/bundle_deps.py +0 -0
  26. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/envs/cache.py +0 -0
  27. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/envs/config.py +0 -0
  28. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/envs/discovery.py +0 -0
  29. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/envs/manifest.py +0 -0
  30. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/envs/paths.py +0 -0
  31. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/envs/schema.py +0 -0
  32. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/hep.py +0 -0
  33. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/ingest.py +0 -0
  34. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/logging/__init__.py +0 -0
  35. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/logging/logger.py +0 -0
  36. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/naming.py +0 -0
  37. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/neutrino.py +0 -0
  38. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/quantum.py +0 -0
  39. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/serve/__init__.py +0 -0
  40. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/serve/bundles.py +0 -0
  41. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/serve/config.py +0 -0
  42. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/serve/orchestrator.py +0 -0
  43. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/serve/profile_scaffold.py +0 -0
  44. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/serve/profiles.py +0 -0
  45. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/serve/proxy_tool.py +0 -0
  46. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/setup/__init__.py +0 -0
  47. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/setup/_rpc.py +0 -0
  48. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/setup/context.py +0 -0
  49. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/setup/declarative.py +0 -0
  50. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/setup/downloads.py +0 -0
  51. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/setup/prompts.py +0 -0
  52. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/setup/runner.py +0 -0
  53. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/setup/schema.py +0 -0
  54. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/setup/storage.py +0 -0
  55. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/setup/validate_cache.py +0 -0
  56. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/templates/Dockerfile.template +0 -0
  57. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/templates/README.md.template +0 -0
  58. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/templates/__init__.py.template +0 -0
  59. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/templates/mcp/__init__.py.template +0 -0
  60. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/templates/mcp/server_stdio.py.template +0 -0
  61. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/templates/requirements.txt.template +0 -0
  62. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/templates/setup.py.template +0 -0
  63. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/templates/skills/example_skill.md +0 -0
  64. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/templates/tool_example.py +0 -0
  65. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/templates/toolkit.yaml.template +0 -0
  66. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/toolkit.py +0 -0
  67. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/validation.py +0 -0
  68. {toolbase-0.9.0 → toolbase-0.10.0}/toolbase/versioning.py +0 -0
@@ -8,6 +8,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.10.0] — 2026-07-30
12
+
13
+ ### Added
14
+
15
+ - **`tb connect antigravity` wires Google Antigravity.** One adapter covers the `agy` CLI, the Antigravity IDE, and the SDK, because all three read the same MCP config. Scopes follow Antigravity's two customization roots: `-g` writes the global `~/.gemini/config/mcp_config.json`, project scope writes the workspace `.agents/mcp_config.json`. Skills surface natively — `~/.gemini/config/skills/<toolkit>__<skill>/SKILL.md`, the same directory-plus-frontmatter layout Claude Code uses, so a toolkit's guides are loaded on demand rather than reduced to slash commands.
16
+
17
+ Two Antigravity quirks are handled: a zero-byte `mcp_config.json` (which the IDE creates on first launch) is read as an empty config rather than refused as malformed, and project scope prints a warning that only the IDE and SDK honor a workspace config today — the CLI discovers and then ignores it ([antigravity-cli#60](https://github.com/google-antigravity/antigravity-cli/issues/60)), so CLI users should connect with `-g`.
18
+
19
+ ## [0.9.1] — 2026-07-29
20
+
21
+ ### Changed
22
+
23
+ - **The `tb connect orchestral` scaffold now works in `sandbox/` rather than `workspace/`.** Same directory, new name — it sits beside `.toolbase/` and is where both the served toolkits and the scaffold's own file tools resolve relative paths. `sandbox` is the more common convention among toolkits that ship demo agents, and reads as "scratch space the agent owns" rather than "the project". Re-run `tb connect orchestral --force` to pick it up; an existing `workspace/` is left alone, so move or delete it yourself.
24
+
25
+ ### Fixed
26
+
27
+ - **`tb connect` now wires the exact toolbase binary by default.** A bare `toolbase` command is resolved against the `PATH` the harness inherits, and that PATH can differ from the shell that ran `connect`: activating an environment, sourcing an rc file, opening a new tab, or launching a GUI app can change it. The result was a clean connection followed by a failed MCP server, fixable only by reconnecting with `--abspath`.
28
+
29
+ The absolute path is now the default in **every** scope and for every installation, so the harness launches the same toolbase the user connected. `--portable` explicitly writes bare `toolbase` for a committed config that each teammate's PATH should resolve; `--abspath` remains an explicit spelling of the default. This is orthogonal to scope — the command string says how to find the binary, not which sessions get the tools — so project-scoped wiring and per-project curation are unchanged.
30
+
11
31
  ## [0.9.0] — 2026-07-29
12
32
 
13
33
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolbase
3
- Version: 0.9.0
3
+ Version: 0.10.0
4
4
  Summary: The community registry and CLI for AI agent toolkits - discover, share, and serve tools to AI agents over MCP
5
5
  Author-email: Alex Roman <toolbase.dev@gmail.com>
6
6
  License: MIT
@@ -87,9 +87,9 @@ directory's `.toolbase/` by default, `-g` writes to the user-wide
87
87
  profile instead.
88
88
 
89
89
  **`tb connect` writes the MCP config for you.** Claude Code, Codex,
90
- OpenCode, and Orchestral are all supported (`tb connect --harnesses`
91
- lists them); Claude Code, Codex, and OpenCode are MCP clients (`tb
92
- connect` edits their config file), while Orchestral gets a runnable agent
90
+ OpenCode, Antigravity, and Orchestral are all supported (`tb connect
91
+ --harnesses` lists them); the first four are MCP clients (`tb connect`
92
+ edits their config file), while Orchestral gets a runnable agent
93
93
  script you launch yourself. It also surfaces the activated toolkits'
94
94
  **skills** into the harness — see
95
95
  [Skills](#skills-guides-that-travel-with-the-toolkit).
@@ -144,6 +144,9 @@ format:
144
144
  - **OpenCode** → `~/.config/opencode/command/<toolkit>__<skill>.md` — a
145
145
  `/<toolkit>__<skill>` slash-command prompt (its `description` shows in
146
146
  the TUI).
147
+ - **Antigravity** → `~/.gemini/config/skills/<toolkit>__<skill>/` — a
148
+ native skill in the global customization root, loaded on demand by the
149
+ `agy` CLI and the IDE alike.
147
150
 
148
151
  Skills follow the same curation as tools: a guide is surfaced only when
149
152
  its toolkit is active, and you toggle a single one with the activation
@@ -228,7 +231,7 @@ Full reference with all flags: <https://toolbase-ai.com/docs/reference/commands>
228
231
  | `tb list` | Installed toolkits (`-v` for a per-tool view) |
229
232
  | `tb activate ITEM` | Expose a toolkit / `toolkit/bundle` / `toolkit__tool` / `toolkit__skill` (project-local; `-g` for user-wide) |
230
233
  | `tb deactivate ITEM` | Hide a toolkit / bundle / tool / skill |
231
- | `tb connect HARNESS` | Wire toolbase into Claude Code, Codex, OpenCode, or scaffold an Orchestral agent script (also surfaces skills; `--no-skills` to skip) |
234
+ | `tb connect HARNESS` | Wire toolbase into Claude Code, Codex, OpenCode, Antigravity, or scaffold an Orchestral agent script (also surfaces skills; `--no-skills` to skip) |
232
235
  | `tb disconnect HARNESS` | Remove toolbase from a harness (and its surfaced skills) |
233
236
  | `tb logs` | Tail the serve log, live |
234
237
  | `tb profile …` | Manage named profiles: `list \| show \| create \| edit \| delete \| set-default \| path \| tools` |
@@ -46,9 +46,9 @@ directory's `.toolbase/` by default, `-g` writes to the user-wide
46
46
  profile instead.
47
47
 
48
48
  **`tb connect` writes the MCP config for you.** Claude Code, Codex,
49
- OpenCode, and Orchestral are all supported (`tb connect --harnesses`
50
- lists them); Claude Code, Codex, and OpenCode are MCP clients (`tb
51
- connect` edits their config file), while Orchestral gets a runnable agent
49
+ OpenCode, Antigravity, and Orchestral are all supported (`tb connect
50
+ --harnesses` lists them); the first four are MCP clients (`tb connect`
51
+ edits their config file), while Orchestral gets a runnable agent
52
52
  script you launch yourself. It also surfaces the activated toolkits'
53
53
  **skills** into the harness — see
54
54
  [Skills](#skills-guides-that-travel-with-the-toolkit).
@@ -103,6 +103,9 @@ format:
103
103
  - **OpenCode** → `~/.config/opencode/command/<toolkit>__<skill>.md` — a
104
104
  `/<toolkit>__<skill>` slash-command prompt (its `description` shows in
105
105
  the TUI).
106
+ - **Antigravity** → `~/.gemini/config/skills/<toolkit>__<skill>/` — a
107
+ native skill in the global customization root, loaded on demand by the
108
+ `agy` CLI and the IDE alike.
106
109
 
107
110
  Skills follow the same curation as tools: a guide is surfaced only when
108
111
  its toolkit is active, and you toggle a single one with the activation
@@ -187,7 +190,7 @@ Full reference with all flags: <https://toolbase-ai.com/docs/reference/commands>
187
190
  | `tb list` | Installed toolkits (`-v` for a per-tool view) |
188
191
  | `tb activate ITEM` | Expose a toolkit / `toolkit/bundle` / `toolkit__tool` / `toolkit__skill` (project-local; `-g` for user-wide) |
189
192
  | `tb deactivate ITEM` | Hide a toolkit / bundle / tool / skill |
190
- | `tb connect HARNESS` | Wire toolbase into Claude Code, Codex, OpenCode, or scaffold an Orchestral agent script (also surfaces skills; `--no-skills` to skip) |
193
+ | `tb connect HARNESS` | Wire toolbase into Claude Code, Codex, OpenCode, Antigravity, or scaffold an Orchestral agent script (also surfaces skills; `--no-skills` to skip) |
191
194
  | `tb disconnect HARNESS` | Remove toolbase from a harness (and its surfaced skills) |
192
195
  | `tb logs` | Tail the serve log, live |
193
196
  | `tb profile …` | Manage named profiles: `list \| show \| create \| edit \| delete \| set-default \| path \| tools` |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "toolbase"
7
- version = "0.9.0"
7
+ version = "0.10.0"
8
8
  description = "The community registry and CLI for AI agent toolkits - discover, share, and serve tools to AI agents over MCP"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -4145,7 +4145,7 @@ def _note_skills_available(name: str, slot: Path, no_skills: bool = False) -> No
4145
4145
  if not no_skills:
4146
4146
  console.print(
4147
4147
  "[dim]Surface them with [/dim][cyan]tb connect <harness>[/cyan]"
4148
- "[dim] (claude-code, codex, opencode); toggle one with [/dim]"
4148
+ "[dim] (claude-code, codex, opencode, antigravity); toggle one with [/dim]"
4149
4149
  "[cyan]tb deactivate <toolkit>__<skill>[/cyan][dim].[/dim]"
4150
4150
  )
4151
4151
 
@@ -6874,44 +6874,20 @@ def _toolbase_abspath() -> str:
6874
6874
  return shutil.which("toolbase") or "toolbase"
6875
6875
 
6876
6876
 
6877
- def _toolbase_is_env_installed() -> bool:
6878
- """True when toolbase runs from an isolated env whose ``bin`` a harness
6879
- process likely won't have on PATH — a venv/virtualenv, or a *named*
6880
- (non-base) conda env. Used to warn before writing a bare command that
6881
- may not resolve for the harness."""
6882
- if sys.prefix != getattr(sys, "base_prefix", sys.prefix):
6883
- return True # venv / virtualenv
6884
- conda_env = os.environ.get("CONDA_DEFAULT_ENV")
6885
- return bool(conda_env) and conda_env != "base" # named conda env
6886
-
6887
-
6888
6877
  def _resolve_connect_command(*, abspath: bool, portable: bool, scope: str) -> str:
6889
- """The command string to write into the harness's config, scope-aware.
6890
-
6891
- Default optimizes for the config's shareability: ``user`` scope (``-g``,
6892
- a machine-local config that is never committed) writes the absolute path
6893
- so the harness always finds it; ``project`` scope (git-committed, shared)
6894
- stays bare ``toolbase`` for portability across machines. ``--abspath``
6895
- forces the absolute path in any scope; ``--portable`` forces bare. On a
6896
- project-scope bare write from an isolated env, warn that the harness may
6897
- not resolve a bare command."""
6878
+ """The command string to write into the harness's config.
6879
+
6880
+ The absolute path is the default: a bare ``toolbase`` depends on the PATH
6881
+ inherited by the harness, which can differ from the shell that ran
6882
+ ``connect``. ``--portable`` is the explicit choice for a committed config
6883
+ that each teammate's PATH should resolve; ``--abspath`` remains an
6884
+ explicit spelling of the default. Scope does not affect this choice.
6885
+ """
6898
6886
  if abspath and portable:
6899
6887
  raise click.UsageError("--abspath and --portable are mutually exclusive.")
6900
- use_abspath = abspath or (not portable and scope == "user")
6901
- if use_abspath:
6902
- return _toolbase_abspath()
6903
- if scope != "user" and _toolbase_is_env_installed():
6904
- console.print(
6905
- "[yellow]Note:[/yellow] wrote a bare [cyan]toolbase[/cyan] (portable). "
6906
- "The harness resolves it against its own PATH, and toolbase lives in "
6907
- "an isolated env — so a harness launched outside that env (a desktop "
6908
- "app, or a terminal without the env active) won't find it and the MCP "
6909
- "server will show as failed. Fixes: reconnect with [cyan]--abspath[/cyan] "
6910
- "(machine-specific path), use [cyan]-g[/cyan] (user scope uses the "
6911
- "absolute path by default), or put toolbase on your login PATH "
6912
- "(e.g. [cyan]pipx install toolbase[/cyan]) to keep it bare and portable."
6913
- )
6914
- return "toolbase"
6888
+ if portable:
6889
+ return "toolbase"
6890
+ return _toolbase_abspath()
6915
6891
 
6916
6892
 
6917
6893
  def _activated_toolkit_dirs() -> "dict[str, Path]":
@@ -7027,10 +7003,11 @@ def _unsurface_skills_for_connect(adapter) -> None:
7027
7003
  help='Print the intended write without changing anything.')
7028
7004
  @click.option('--abspath', 'abspath', is_flag=True, default=False,
7029
7005
  help='Force the absolute toolbase binary path (PATH-independent). '
7030
- 'Default for user scope (-g); project scope stays bare.')
7006
+ 'This is the default.')
7031
7007
  @click.option('--portable', 'portable', is_flag=True, default=False,
7032
- help='Force the bare `toolbase` command (portable across machines) '
7033
- 'even for user scope.')
7008
+ help='Force the bare `toolbase` command, resolved via the '
7009
+ "harness's PATH — use for a committed config shared "
7010
+ 'across machines.')
7034
7011
  @click.option('--list', 'do_list', is_flag=True, default=False,
7035
7012
  help='Show where toolbase is wired across harnesses, then exit.')
7036
7013
  @click.option('--harnesses', 'do_harnesses', is_flag=True, default=False,
@@ -7048,14 +7025,15 @@ def connect(harness, global_scope, local_scope, profile_name, remove, dry_run,
7048
7025
  """Wire toolbase into an agent harness.
7049
7026
 
7050
7027
  \b
7051
- Claude Code, Codex, and OpenCode are MCP clients: this writes a server entry
7052
- into the harness's config. Orchestral is a Python library, not a config-file
7053
- harness, so it writes a runnable agent script you launch yourself.
7028
+ Claude Code, Codex, OpenCode, and Antigravity are MCP clients: this writes a
7029
+ server entry into the harness's config. Orchestral is a Python library, not a
7030
+ config-file harness, so it writes a runnable agent script you launch yourself.
7054
7031
 
7055
7032
  \b
7056
7033
  Examples:
7057
7034
  tb connect claude-code # project: .mcp.json here (default)
7058
7035
  tb connect claude-code -g # user: ~/.claude.json (every session)
7036
+ tb connect antigravity -g # agy CLI + IDE: ~/.gemini/config/
7059
7037
  tb connect claude-code --profile paper
7060
7038
  tb connect claude-code --remove
7061
7039
  tb connect orchestral # write .toolbase/agent.py
@@ -7641,10 +7619,10 @@ def create_tarball(source_dir: Path, output_path: Path, toolkit_name: str):
7641
7619
 
7642
7620
  Excludes build/VCS/editor cruft AND consumer-side state that a dir
7643
7621
  accumulates when it doubles as a place you install/serve the toolkit
7644
- from: .toolbase/ (manifest, profiles, project config), .mcp.json and
7645
- .codex/ (harness wiring with machine-specific paths), and .claude/
7646
- (local agent settings). Publishing those would leak local state and
7647
- absolute paths into the public package.
7622
+ from: .toolbase/ (manifest, profiles, project config), .mcp.json,
7623
+ .codex/ and .agents/ (harness wiring with machine-specific paths), and
7624
+ .claude/ (local agent settings). Publishing those would leak local
7625
+ state and absolute paths into the public package.
7648
7626
 
7649
7627
  Args:
7650
7628
  source_dir: Source directory to package
@@ -7657,7 +7635,8 @@ def create_tarball(source_dir: Path, output_path: Path, toolkit_name: str):
7657
7635
  '.egg-info', 'dist', 'build', '.tox', 'htmlcov',
7658
7636
  '.coverage', '.env', '.vscode', '.idea',
7659
7637
  # Consumer/harness state — never part of the published toolkit.
7660
- '.toolbase', '.mcp.json', '.claude', '.codex', 'node_modules',
7638
+ '.toolbase', '.mcp.json', '.claude', '.codex', '.agents',
7639
+ 'node_modules',
7661
7640
  }
7662
7641
 
7663
7642
  def should_exclude(path: Path) -> bool:
@@ -7694,4 +7673,4 @@ def create_tarball(source_dir: Path, output_path: Path, toolkit_name: str):
7694
7673
 
7695
7674
 
7696
7675
  if __name__ == '__main__':
7697
- main()
7676
+ main()
@@ -3,7 +3,8 @@ agent harness so the user never copy-pastes config by hand.
3
3
 
4
4
  Two shapes of harness:
5
5
 
6
- - **Config-file harnesses** (Claude Code writes JSON; Codex writes TOML) connect
6
+ - **Config-file harnesses** (Claude Code and Antigravity write JSON; Codex
7
+ writes TOML) connect
7
8
  as MCP clients and get a ``HarnessAdapter`` (see ``base.py``). The adapter
8
9
  knows the harness's config-file location, format, scope vocabulary, and merge
9
10
  rules; the CLI surface is shared.
@@ -18,14 +19,17 @@ from __future__ import annotations
18
19
  from typing import Dict, List
19
20
 
20
21
  from .base import HarnessAdapter, RegistrationEntry, AvailabilityStatus
22
+ from .antigravity import AntigravityAdapter
21
23
  from .claude_code import ClaudeCodeAdapter
22
24
  from .codex import CodexAdapter
23
25
  from .opencode import OpenCodeAdapter
24
26
 
25
27
 
26
28
  # Registry of config-file harness adapters, keyed by the name the user types
27
- # (``tb connect <name>``).
29
+ # (``tb connect <name>``). One Antigravity entry covers the agy CLI, the IDE,
30
+ # and the SDK -- they share a config file.
28
31
  _ADAPTERS: Dict[str, HarnessAdapter] = {
32
+ "antigravity": AntigravityAdapter(),
29
33
  "claude-code": ClaudeCodeAdapter(),
30
34
  "codex": CodexAdapter(),
31
35
  "opencode": OpenCodeAdapter(),
@@ -49,6 +53,7 @@ __all__ = [
49
53
  "HarnessAdapter",
50
54
  "RegistrationEntry",
51
55
  "AvailabilityStatus",
56
+ "AntigravityAdapter",
52
57
  "ClaudeCodeAdapter",
53
58
  "CodexAdapter",
54
59
  "OpenCodeAdapter",
@@ -0,0 +1,242 @@
1
+ """Antigravity adapter for ``tb connect``.
2
+
3
+ Google's Antigravity keeps *one* MCP config shared by the ``agy`` CLI, the
4
+ Antigravity IDE, and the SDK, so a single adapter wires all three.
5
+
6
+ Config lives at a **customization root** — the directory that holds
7
+ ``mcp_config.json``, ``skills/``, ``rules/``, ``plugins/`` and ``hooks.json``.
8
+ There are two roots, which is our scope map:
9
+
10
+ - ``user`` -> ``~/.gemini/config/mcp_config.json`` (global root)
11
+ - ``project`` -> ``<root>/.agents/mcp_config.json`` (workspace root)
12
+
13
+ The entry is a stdio MCP server under the top-level ``mcpServers`` key::
14
+
15
+ {
16
+ "mcpServers": {
17
+ "toolbase": {
18
+ "command": "toolbase",
19
+ "args": ["serve"]
20
+ }
21
+ }
22
+ }
23
+
24
+ Two Antigravity-specific wrinkles:
25
+
26
+ - The IDE creates ``~/.gemini/config/mcp_config.json`` as a **zero-byte file**.
27
+ An empty (or whitespace-only) file is read as ``{}`` rather than refused, so
28
+ a first connect on a fresh install just works.
29
+ - Workspace scope is honored by the IDE and the SDK, but the CLI currently
30
+ discovers and then *ignores* a workspace ``mcp_config.json``
31
+ (google-antigravity/antigravity-cli#60), hence ``project_scope_note``.
32
+
33
+ Writes are a non-destructive merge (only the toolbase entry under
34
+ ``mcpServers`` is touched) and atomic (tmp file + rename). Malformed existing
35
+ JSON is refused rather than clobbered.
36
+ """
37
+
38
+ from __future__ import annotations
39
+
40
+ import json
41
+ import os
42
+ import shutil
43
+ from pathlib import Path
44
+ from typing import Dict, List, Optional
45
+
46
+ from .base import (
47
+ AvailabilityStatus, HarnessAdapter, HarnessConfigError, RegistrationEntry,
48
+ )
49
+
50
+ # Workspace customization root, relative to the project root.
51
+ WORKSPACE_ROOT_DIR = ".agents"
52
+ _CONFIG_NAME = "mcp_config.json"
53
+
54
+
55
+ class AntigravityConfigError(HarnessConfigError):
56
+ """Existing Antigravity config is unreadable / malformed."""
57
+
58
+
59
+ def _global_root() -> Path:
60
+ """The global customization root, ``~/.gemini/config``."""
61
+ return Path.home() / ".gemini" / "config"
62
+
63
+
64
+ class AntigravityAdapter(HarnessAdapter):
65
+ name = "antigravity"
66
+
67
+ def project_scope_note(self) -> str:
68
+ return (
69
+ "the Antigravity IDE and SDK read a workspace .agents/mcp_config.json, "
70
+ "but the agy CLI currently ignores it (upstream bug) — use "
71
+ "`tb connect antigravity -g` if you're on the CLI."
72
+ )
73
+
74
+ # ── detection ────────────────────────────────────────────────────
75
+
76
+ def is_available(self) -> AvailabilityStatus:
77
+ if shutil.which("agy"):
78
+ return AvailabilityStatus(True, "agy CLI found on PATH")
79
+ # ~/.gemini alone means the Gemini CLI, not Antigravity -- key on the
80
+ # customization root and Antigravity's own state dirs instead.
81
+ if (_global_root() / _CONFIG_NAME).exists():
82
+ return AvailabilityStatus(True, "found ~/.gemini/config/mcp_config.json")
83
+ gemini = Path.home() / ".gemini"
84
+ for d in ("antigravity", "antigravity-cli", "antigravity-ide"):
85
+ if (gemini / d).exists():
86
+ return AvailabilityStatus(True, f"found ~/.gemini/{d}")
87
+ return AvailabilityStatus(
88
+ False, "no `agy` CLI on PATH and no ~/.gemini/config"
89
+ )
90
+
91
+ def supported_scopes(self) -> Dict[str, str]:
92
+ return {"user": "global", "project": "workspace"}
93
+
94
+ def skill_target(self):
95
+ # ~/.gemini/config/skills/<toolkit>__<skill>/SKILL.md -- Antigravity's
96
+ # native skill layout is Claude Code's: a directory per skill holding a
97
+ # SKILL.md with name+description frontmatter, loaded on demand. Skills
98
+ # sit in the customization root next to mcp_config.json; we use the
99
+ # global root, matching the other harnesses' user-global surfacing.
100
+ from ..skills import SkillTarget
101
+ return SkillTarget(
102
+ harness=self.name, root=_global_root() / "skills",
103
+ layout="dir", keep_frontmatter=True,
104
+ )
105
+
106
+ # ── paths ────────────────────────────────────────────────────────
107
+
108
+ def config_path(self, scope: str, project_root: Optional[Path]) -> Path:
109
+ if scope == "user":
110
+ return _global_root() / _CONFIG_NAME
111
+ if scope == "project":
112
+ if project_root is None:
113
+ raise ValueError("project scope requires a project_root")
114
+ return project_root / WORKSPACE_ROOT_DIR / _CONFIG_NAME
115
+ raise ValueError(f"unknown scope {scope!r}")
116
+
117
+ # ── read / write ─────────────────────────────────────────────────
118
+
119
+ @staticmethod
120
+ def _read(path: Path) -> dict:
121
+ if not path.exists():
122
+ return {}
123
+ text = path.read_text(encoding="utf-8")
124
+ # The IDE ships a zero-byte mcp_config.json; that's an empty config,
125
+ # not a malformed one.
126
+ if not text.strip():
127
+ return {}
128
+ try:
129
+ data = json.loads(text)
130
+ except json.JSONDecodeError as e:
131
+ hint = ""
132
+ if "//" in text or "/*" in text:
133
+ hint = (
134
+ " Antigravity's mcp_config.json doesn't support comments — "
135
+ "remove them and re-run."
136
+ )
137
+ raise AntigravityConfigError(
138
+ f"{path} is not valid JSON ({e}); refusing to overwrite.{hint}"
139
+ ) from e
140
+ if not isinstance(data, dict):
141
+ raise AntigravityConfigError(
142
+ f"{path} must be a JSON object at the top level."
143
+ )
144
+ return data
145
+
146
+ @staticmethod
147
+ def _write_atomic(path: Path, data: dict) -> None:
148
+ path.parent.mkdir(parents=True, exist_ok=True)
149
+ tmp = path.with_suffix(path.suffix + ".tmp")
150
+ with open(tmp, "w", encoding="utf-8") as f:
151
+ json.dump(data, f, indent=2, sort_keys=False)
152
+ f.write("\n")
153
+ f.flush()
154
+ os.fsync(f.fileno())
155
+ os.replace(tmp, path)
156
+
157
+ @staticmethod
158
+ def _entry(command: str, args: List[str], env: Optional[Dict[str, str]]) -> dict:
159
+ entry: dict = {"command": command, "args": list(args)}
160
+ if env:
161
+ entry["env"] = dict(env)
162
+ return entry
163
+
164
+ # ── install / uninstall ──────────────────────────────────────────
165
+
166
+ def install(
167
+ self,
168
+ *,
169
+ scope: str,
170
+ project_root: Optional[Path],
171
+ server_name: str,
172
+ command: str,
173
+ args: List[str],
174
+ env: Optional[Dict[str, str]] = None,
175
+ dry_run: bool = False,
176
+ ) -> Path:
177
+ path = self.config_path(scope, project_root)
178
+ data = self._read(path)
179
+ servers = data.get("mcpServers")
180
+ if servers is None:
181
+ servers = {}
182
+ elif not isinstance(servers, dict):
183
+ raise AntigravityConfigError(
184
+ f"{path}: 'mcpServers' must be a JSON object."
185
+ )
186
+ servers[server_name] = self._entry(command, args, env)
187
+ data["mcpServers"] = servers
188
+ if not dry_run:
189
+ self._write_atomic(path, data)
190
+ return path
191
+
192
+ def uninstall(
193
+ self,
194
+ *,
195
+ scope: str,
196
+ project_root: Optional[Path],
197
+ server_name: str,
198
+ ) -> bool:
199
+ path = self.config_path(scope, project_root)
200
+ if not path.exists():
201
+ return False
202
+ data = self._read(path)
203
+ servers = data.get("mcpServers")
204
+ if not isinstance(servers, dict) or server_name not in servers:
205
+ return False
206
+ del servers[server_name]
207
+ # Leave an empty mcpServers object rather than reshaping the file.
208
+ data["mcpServers"] = servers
209
+ self._write_atomic(path, data)
210
+ return True
211
+
212
+ # ── status ───────────────────────────────────────────────────────
213
+
214
+ def status(self, project_root: Optional[Path]) -> List[RegistrationEntry]:
215
+ out: List[RegistrationEntry] = []
216
+ scopes = [("user", None)]
217
+ if project_root is not None:
218
+ scopes.append(("project", project_root))
219
+ for scope, root in scopes:
220
+ path = self.config_path(scope, root)
221
+ present = False
222
+ command = ""
223
+ args: Optional[List[str]] = None
224
+ if path.exists():
225
+ try:
226
+ data = self._read(path)
227
+ except AntigravityConfigError:
228
+ data = {}
229
+ servers = data.get("mcpServers")
230
+ if isinstance(servers, dict) and "toolbase" in servers:
231
+ entry = servers["toolbase"]
232
+ if isinstance(entry, dict):
233
+ present = True
234
+ command = str(entry.get("command", ""))
235
+ raw = entry.get("args")
236
+ if isinstance(raw, list):
237
+ args = [str(a) for a in raw]
238
+ out.append(RegistrationEntry(
239
+ harness=self.name, scope=scope, path=path,
240
+ present=present, command=command, args=args,
241
+ ))
242
+ return out
@@ -194,7 +194,7 @@ def agent_script(profile: Optional[str] = None) -> str:
194
194
  Two things the scaffold does deliberately, because getting them wrong is
195
195
  the difference between a working agent and a confusing one:
196
196
 
197
- - **One workspace.** A single ``WORKSPACE`` dir is passed to
197
+ - **One sandbox.** A single ``SANDBOX`` dir is passed to
198
198
  ``toolbase_tools(config_overrides=...)`` *and* to orchestral's own file
199
199
  tools, so every tool resolves relative paths against the same root.
200
200
  Without it, toolbase-served tools write wherever
@@ -202,7 +202,7 @@ def agent_script(profile: Optional[str] = None) -> str:
202
202
  back its own output.
203
203
  - **File tools.** Served toolkits are domain tools; on their own the agent
204
204
  has no way to open the files they produce. The scaffold pairs them with
205
- orchestral's read/write/edit/search/run tools, all scoped to WORKSPACE.
205
+ orchestral's read/write/edit/search/run tools, all scoped to SANDBOX.
206
206
 
207
207
  Configuring orchestral (the LLM, API keys) is the user's job; the scaffold
208
208
  just shows where their LLM plugs in.
@@ -247,29 +247,29 @@ from toolbase.connect.orchestral import toolbase_tools
247
247
  # The one directory every tool works in -- both the toolbase-served toolkits
248
248
  # and the orchestral file tools below. Keeping them on the same root is what
249
249
  # lets the agent read back the files its own tools write. Point it anywhere.
250
- WORKSPACE = Path(__file__).resolve().parent.parent / "workspace"
250
+ SANDBOX = Path(__file__).resolve().parent.parent / "sandbox"
251
251
 
252
252
 
253
253
  def main():
254
- WORKSPACE.mkdir(parents=True, exist_ok=True)
254
+ SANDBOX.mkdir(parents=True, exist_ok=True)
255
255
 
256
256
  # `toolbase_tools` spins up one subprocess per served toolkit ({profile_note})
257
257
  # and yields the tools as orchestral BaseTool instances. They are torn
258
258
  # down when the `with` block exits. `config_overrides` scopes every served
259
- # toolkit to WORKSPACE, overriding the `base_directory` in
259
+ # toolkit to SANDBOX, overriding the `base_directory` in
260
260
  # ~/.toolbase/config/<toolkit>.yaml for this run only.
261
261
  with toolbase_tools(
262
- {profile_arg}config_overrides={{"base_directory": str(WORKSPACE)}},
262
+ {profile_arg}config_overrides={{"base_directory": str(SANDBOX)}},
263
263
  ) as served:
264
264
  tools = [
265
- # General-purpose tools, scoped to the same workspace.
266
- ReadFileTool(base_directory=str(WORKSPACE), show_line_numbers=True),
267
- WriteFileTool(base_directory=str(WORKSPACE)),
268
- EditFileTool(base_directory=str(WORKSPACE)),
269
- FindFilesTool(base_directory=str(WORKSPACE)),
270
- FileSearchTool(base_directory=str(WORKSPACE)),
271
- RunCommandTool(base_directory=str(WORKSPACE)),
272
- RunPythonTool(base_directory=str(WORKSPACE)),
265
+ # General-purpose tools, scoped to the same sandbox.
266
+ ReadFileTool(base_directory=str(SANDBOX), show_line_numbers=True),
267
+ WriteFileTool(base_directory=str(SANDBOX)),
268
+ EditFileTool(base_directory=str(SANDBOX)),
269
+ FindFilesTool(base_directory=str(SANDBOX)),
270
+ FileSearchTool(base_directory=str(SANDBOX)),
271
+ RunCommandTool(base_directory=str(SANDBOX)),
272
+ RunPythonTool(base_directory=str(SANDBOX)),
273
273
  # Your toolbase toolkits.
274
274
  *served,
275
275
  ]
@@ -11,6 +11,7 @@ expects.
11
11
  Two layouts, one per supported harness:
12
12
 
13
13
  Claude Code (dir) ~/.claude/skills/<toolkit>__<skill>/SKILL.md
14
+ Antigravity (dir) ~/.gemini/config/skills/<toolkit>__<skill>/SKILL.md
14
15
  Codex (flat) ~/.codex/prompts/<toolkit>__<skill>.md
15
16
 
16
17
  Claude Code watches its dir and both auto-surfaces each skill to the model
@@ -20,6 +20,7 @@ toolbase/toolkit.py
20
20
  toolbase/validation.py
21
21
  toolbase/versioning.py
22
22
  toolbase/connect/__init__.py
23
+ toolbase/connect/antigravity.py
23
24
  toolbase/connect/base.py
24
25
  toolbase/connect/claude_code.py
25
26
  toolbase/connect/codex.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes