toolbase 0.9.1__tar.gz → 0.11.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.
- {toolbase-0.9.1 → toolbase-0.11.0}/CHANGELOG.md +24 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/PKG-INFO +13 -8
- {toolbase-0.9.1 → toolbase-0.11.0}/README.md +12 -7
- {toolbase-0.9.1 → toolbase-0.11.0}/pyproject.toml +1 -1
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/cli.py +30 -29
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/connect/__init__.py +7 -2
- toolbase-0.11.0/toolbase/connect/antigravity.py +244 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/skills.py +113 -12
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/validation.py +26 -11
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase.egg-info/SOURCES.txt +1 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/LICENSE +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/MANIFEST.in +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/setup.cfg +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/__init__.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/_setup_host.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/_toolkit_host.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/astro.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/auth.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/config.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/connect/base.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/connect/claude_code.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/connect/codex.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/connect/opencode.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/connect/orchestral.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/envs/__init__.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/envs/bundle_deps.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/envs/cache.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/envs/config.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/envs/discovery.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/envs/manifest.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/envs/paths.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/envs/schema.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/hep.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/ingest.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/logging/__init__.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/logging/logger.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/naming.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/neutrino.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/quantum.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/serve/__init__.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/serve/bundles.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/serve/config.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/serve/orchestrator.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/serve/profile_scaffold.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/serve/profiles.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/serve/proxy_tool.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/setup/__init__.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/setup/_rpc.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/setup/context.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/setup/declarative.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/setup/downloads.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/setup/prompts.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/setup/runner.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/setup/schema.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/setup/storage.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/setup/validate_cache.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/templates/Dockerfile.template +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/templates/README.md.template +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/templates/__init__.py.template +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/templates/mcp/__init__.py.template +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/templates/mcp/server_stdio.py.template +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/templates/requirements.txt.template +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/templates/setup.py.template +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/templates/skills/example_skill.md +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/templates/tool_example.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/templates/toolkit.yaml.template +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/toolkit.py +0 -0
- {toolbase-0.9.1 → toolbase-0.11.0}/toolbase/versioning.py +0 -0
|
@@ -8,6 +8,30 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.11.0] — 2026-07-30
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Skills can now be directories, not just files.** A toolkit ships a skill either as `skills/<name>.md` or as `skills/<name>/SKILL.md` — the second form carrying `references/`, `scripts/` and assets beside the guide, which is how skills are written for Claude Code and Antigravity natively. Previously only the flat file was discovered: a directory-form skill was invisible everywhere (not surfaced, not counted, not validated, not reachable by `tb activate <toolkit>__<skill>`) while still shipping inside the package, so a skill written for Claude Code silently did nothing when dropped into a toolkit.
|
|
16
|
+
|
|
17
|
+
Attachments travel to harnesses that take a skill as a directory (Claude Code, Antigravity), symlinked per file so edits to an editable install show up live and toolbase never writes into the author's toolkit. Harnesses that take a single prompt file (Codex, OpenCode) get the guide alone. A directory with no `SKILL.md` isn't a skill; `tb validate` now says so rather than ignoring it.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **The Antigravity project-scope warning now says what the CLI actually does.** 0.10.0 shipped a note claiming the IDE and SDK honor a workspace `.agents/mcp_config.json` while the CLI "discovers and then ignores" it, citing [antigravity-cli#60](https://github.com/google-antigravity/antigravity-cli/issues/60) — a report against `.antigravitycli/mcp_config.json`, a different path. Tested directly: with `.agents/mcp_config.json` wired and the `agy` CLI launched in that workspace, no server starts and its log never mentions MCP; the identical entry in the global root starts one at boot. The printed note, the adapter docs, and this changelog now state that, and attribute the IDE/SDK half to Google's documentation rather than to verification. Guidance is unchanged: on the CLI, connect with `-g`.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- **`tb validate` prints its hints on success.** Warnings — missing README, incomplete skill frontmatter, a skill directory with no `SKILL.md` — were only shown when validation *failed*, so a valid toolkit's hints were computed and discarded. That is exactly when the author can still act on them.
|
|
26
|
+
|
|
27
|
+
## [0.10.0] — 2026-07-30
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- **`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.
|
|
32
|
+
|
|
33
|
+
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 about workspace configs — see the 0.11.0 entry above, which corrects what that warning claims.
|
|
34
|
+
|
|
11
35
|
## [0.9.1] — 2026-07-29
|
|
12
36
|
|
|
13
37
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: toolbase
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.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
|
|
91
|
-
lists them);
|
|
92
|
-
|
|
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).
|
|
@@ -133,9 +133,11 @@ warning, and the rest are served bare.
|
|
|
133
133
|
## Skills: guides that travel with the toolkit
|
|
134
134
|
|
|
135
135
|
A toolkit can ship **skills** — markdown how-to guides in `skills/` —
|
|
136
|
-
alongside its tools or on their own.
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
alongside its tools or on their own. Each is either a file
|
|
137
|
+
(`skills/exact_math.md`) or a directory (`skills/exact_math/SKILL.md`) that
|
|
138
|
+
carries reference files and scripts beside the guide. `tb connect` surfaces
|
|
139
|
+
the activated toolkits' skills into the harness you connect, in that
|
|
140
|
+
harness's native format:
|
|
139
141
|
|
|
140
142
|
- **Claude Code** → `~/.claude/skills/<toolkit>__<skill>/` — auto-surfaced
|
|
141
143
|
to the model *and* available as a `/<toolkit>__<skill>` slash command.
|
|
@@ -144,6 +146,9 @@ format:
|
|
|
144
146
|
- **OpenCode** → `~/.config/opencode/command/<toolkit>__<skill>.md` — a
|
|
145
147
|
`/<toolkit>__<skill>` slash-command prompt (its `description` shows in
|
|
146
148
|
the TUI).
|
|
149
|
+
- **Antigravity** → `~/.gemini/config/skills/<toolkit>__<skill>/` — a
|
|
150
|
+
native skill in the global customization root, loaded on demand by the
|
|
151
|
+
`agy` CLI and the IDE alike.
|
|
147
152
|
|
|
148
153
|
Skills follow the same curation as tools: a guide is surfaced only when
|
|
149
154
|
its toolkit is active, and you toggle a single one with the activation
|
|
@@ -228,7 +233,7 @@ Full reference with all flags: <https://toolbase-ai.com/docs/reference/commands>
|
|
|
228
233
|
| `tb list` | Installed toolkits (`-v` for a per-tool view) |
|
|
229
234
|
| `tb activate ITEM` | Expose a toolkit / `toolkit/bundle` / `toolkit__tool` / `toolkit__skill` (project-local; `-g` for user-wide) |
|
|
230
235
|
| `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) |
|
|
236
|
+
| `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
237
|
| `tb disconnect HARNESS` | Remove toolbase from a harness (and its surfaced skills) |
|
|
233
238
|
| `tb logs` | Tail the serve log, live |
|
|
234
239
|
| `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
|
|
50
|
-
lists them);
|
|
51
|
-
|
|
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).
|
|
@@ -92,9 +92,11 @@ warning, and the rest are served bare.
|
|
|
92
92
|
## Skills: guides that travel with the toolkit
|
|
93
93
|
|
|
94
94
|
A toolkit can ship **skills** — markdown how-to guides in `skills/` —
|
|
95
|
-
alongside its tools or on their own.
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
alongside its tools or on their own. Each is either a file
|
|
96
|
+
(`skills/exact_math.md`) or a directory (`skills/exact_math/SKILL.md`) that
|
|
97
|
+
carries reference files and scripts beside the guide. `tb connect` surfaces
|
|
98
|
+
the activated toolkits' skills into the harness you connect, in that
|
|
99
|
+
harness's native format:
|
|
98
100
|
|
|
99
101
|
- **Claude Code** → `~/.claude/skills/<toolkit>__<skill>/` — auto-surfaced
|
|
100
102
|
to the model *and* available as a `/<toolkit>__<skill>` slash command.
|
|
@@ -103,6 +105,9 @@ format:
|
|
|
103
105
|
- **OpenCode** → `~/.config/opencode/command/<toolkit>__<skill>.md` — a
|
|
104
106
|
`/<toolkit>__<skill>` slash-command prompt (its `description` shows in
|
|
105
107
|
the TUI).
|
|
108
|
+
- **Antigravity** → `~/.gemini/config/skills/<toolkit>__<skill>/` — a
|
|
109
|
+
native skill in the global customization root, loaded on demand by the
|
|
110
|
+
`agy` CLI and the IDE alike.
|
|
106
111
|
|
|
107
112
|
Skills follow the same curation as tools: a guide is surfaced only when
|
|
108
113
|
its toolkit is active, and you toggle a single one with the activation
|
|
@@ -187,7 +192,7 @@ Full reference with all flags: <https://toolbase-ai.com/docs/reference/commands>
|
|
|
187
192
|
| `tb list` | Installed toolkits (`-v` for a per-tool view) |
|
|
188
193
|
| `tb activate ITEM` | Expose a toolkit / `toolkit/bundle` / `toolkit__tool` / `toolkit__skill` (project-local; `-g` for user-wide) |
|
|
189
194
|
| `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) |
|
|
195
|
+
| `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
196
|
| `tb disconnect HARNESS` | Remove toolbase from a harness (and its surfaced skills) |
|
|
192
197
|
| `tb logs` | Tail the serve log, live |
|
|
193
198
|
| `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.
|
|
7
|
+
version = "0.11.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"
|
|
@@ -1250,6 +1250,14 @@ def validate(path):
|
|
|
1250
1250
|
table.add_row("Tools", str(len(result.metadata.tools)))
|
|
1251
1251
|
|
|
1252
1252
|
console.print(table)
|
|
1253
|
+
|
|
1254
|
+
# Warnings are hints, not failures -- but a valid toolkit is
|
|
1255
|
+
# exactly when the author can still act on them, so print them
|
|
1256
|
+
# here too rather than only on the failure path.
|
|
1257
|
+
if result.warnings:
|
|
1258
|
+
console.print()
|
|
1259
|
+
for warning in result.warnings:
|
|
1260
|
+
console.print(f" [yellow]hint:[/yellow] {warning}")
|
|
1253
1261
|
else:
|
|
1254
1262
|
console.print("\n[bold red]✗ Validation failed[/bold red]")
|
|
1255
1263
|
for error in result.errors:
|
|
@@ -4037,13 +4045,9 @@ def _write_path_install_meta(
|
|
|
4037
4045
|
compute_and_write_disk_size as _compute_and_write_disk_size,
|
|
4038
4046
|
)
|
|
4039
4047
|
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
p for p in skills_dir.glob("*.md") if not p.name.startswith("._")
|
|
4044
|
-
)
|
|
4045
|
-
else:
|
|
4046
|
-
skill_files = []
|
|
4048
|
+
from .skills import discover_skills as _discover_skills
|
|
4049
|
+
|
|
4050
|
+
skill_files = _discover_skills(slot)
|
|
4047
4051
|
tools_count = len(config.get("tools", []) or [])
|
|
4048
4052
|
has_setup_script = (slot / "setup.py").exists()
|
|
4049
4053
|
|
|
@@ -4134,18 +4138,18 @@ def _note_skills_available(name: str, slot: Path, no_skills: bool = False) -> No
|
|
|
4134
4138
|
that skills exist. ``tb connect <harness>`` does the surfacing. Each
|
|
4135
4139
|
guide is printed by its toggle name (``<toolkit>__<slug>``) so the user
|
|
4136
4140
|
can `tb deactivate` an individual one."""
|
|
4137
|
-
from .skills import discover_skills
|
|
4141
|
+
from .skills import discover_skills
|
|
4138
4142
|
skill_files = discover_skills(slot)
|
|
4139
4143
|
if not skill_files:
|
|
4140
4144
|
return
|
|
4141
4145
|
n = len(skill_files)
|
|
4142
4146
|
console.print(f"Skills: {n} guide{'s' if n != 1 else ''} available")
|
|
4143
|
-
for
|
|
4144
|
-
console.print(f" [dim]•[/dim] {name}__{
|
|
4147
|
+
for s in skill_files:
|
|
4148
|
+
console.print(f" [dim]•[/dim] {name}__{s.slug}")
|
|
4145
4149
|
if not no_skills:
|
|
4146
4150
|
console.print(
|
|
4147
4151
|
"[dim]Surface them with [/dim][cyan]tb connect <harness>[/cyan]"
|
|
4148
|
-
"[dim] (claude-code, codex, opencode); toggle one with [/dim]"
|
|
4152
|
+
"[dim] (claude-code, codex, opencode, antigravity); toggle one with [/dim]"
|
|
4149
4153
|
"[cyan]tb deactivate <toolkit>__<skill>[/cyan][dim].[/dim]"
|
|
4150
4154
|
)
|
|
4151
4155
|
|
|
@@ -4897,14 +4901,9 @@ def install(ctx, name, version, global_scope, local_scope, editable, no_skills,
|
|
|
4897
4901
|
raise click.ClickException("Installation failed")
|
|
4898
4902
|
|
|
4899
4903
|
# Step 8: Save metadata with everything serve will need
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
skill_files = sorted(
|
|
4904
|
-
p for p in skills_dir.glob('*.md') if not p.name.startswith('._')
|
|
4905
|
-
)
|
|
4906
|
-
else:
|
|
4907
|
-
skill_files = []
|
|
4904
|
+
from .skills import discover_skills as _discover_skills
|
|
4905
|
+
|
|
4906
|
+
skill_files = _discover_skills(toolkit_dir)
|
|
4908
4907
|
tools_count = len(toolkit_config.get('tools', []) or [])
|
|
4909
4908
|
|
|
4910
4909
|
meta = {
|
|
@@ -6926,8 +6925,8 @@ def _toolkit_skill_slugs(name: str) -> set:
|
|
|
6926
6925
|
slot = _toolkit_slot_dir(name)
|
|
6927
6926
|
if slot is None:
|
|
6928
6927
|
return set()
|
|
6929
|
-
from .skills import discover_skills
|
|
6930
|
-
return {
|
|
6928
|
+
from .skills import discover_skills
|
|
6929
|
+
return {s.slug for s in discover_skills(slot)}
|
|
6931
6930
|
|
|
6932
6931
|
|
|
6933
6932
|
def _resolve_disabled_skills(name: str) -> set:
|
|
@@ -7025,14 +7024,15 @@ def connect(harness, global_scope, local_scope, profile_name, remove, dry_run,
|
|
|
7025
7024
|
"""Wire toolbase into an agent harness.
|
|
7026
7025
|
|
|
7027
7026
|
\b
|
|
7028
|
-
Claude Code, Codex, and
|
|
7029
|
-
into the harness's config. Orchestral is a Python library, not a
|
|
7030
|
-
harness, so it writes a runnable agent script you launch yourself.
|
|
7027
|
+
Claude Code, Codex, OpenCode, and Antigravity are MCP clients: this writes a
|
|
7028
|
+
server entry into the harness's config. Orchestral is a Python library, not a
|
|
7029
|
+
config-file harness, so it writes a runnable agent script you launch yourself.
|
|
7031
7030
|
|
|
7032
7031
|
\b
|
|
7033
7032
|
Examples:
|
|
7034
7033
|
tb connect claude-code # project: .mcp.json here (default)
|
|
7035
7034
|
tb connect claude-code -g # user: ~/.claude.json (every session)
|
|
7035
|
+
tb connect antigravity -g # agy CLI + IDE: ~/.gemini/config/
|
|
7036
7036
|
tb connect claude-code --profile paper
|
|
7037
7037
|
tb connect claude-code --remove
|
|
7038
7038
|
tb connect orchestral # write .toolbase/agent.py
|
|
@@ -7618,10 +7618,10 @@ def create_tarball(source_dir: Path, output_path: Path, toolkit_name: str):
|
|
|
7618
7618
|
|
|
7619
7619
|
Excludes build/VCS/editor cruft AND consumer-side state that a dir
|
|
7620
7620
|
accumulates when it doubles as a place you install/serve the toolkit
|
|
7621
|
-
from: .toolbase/ (manifest, profiles, project config), .mcp.json
|
|
7622
|
-
.codex/ (harness wiring with machine-specific paths), and
|
|
7623
|
-
(local agent settings). Publishing those would leak local
|
|
7624
|
-
absolute paths into the public package.
|
|
7621
|
+
from: .toolbase/ (manifest, profiles, project config), .mcp.json,
|
|
7622
|
+
.codex/ and .agents/ (harness wiring with machine-specific paths), and
|
|
7623
|
+
.claude/ (local agent settings). Publishing those would leak local
|
|
7624
|
+
state and absolute paths into the public package.
|
|
7625
7625
|
|
|
7626
7626
|
Args:
|
|
7627
7627
|
source_dir: Source directory to package
|
|
@@ -7634,7 +7634,8 @@ def create_tarball(source_dir: Path, output_path: Path, toolkit_name: str):
|
|
|
7634
7634
|
'.egg-info', 'dist', 'build', '.tox', 'htmlcov',
|
|
7635
7635
|
'.coverage', '.env', '.vscode', '.idea',
|
|
7636
7636
|
# Consumer/harness state — never part of the published toolkit.
|
|
7637
|
-
'.toolbase', '.mcp.json', '.claude', '.codex', '
|
|
7637
|
+
'.toolbase', '.mcp.json', '.claude', '.codex', '.agents',
|
|
7638
|
+
'node_modules',
|
|
7638
7639
|
}
|
|
7639
7640
|
|
|
7640
7641
|
def should_exclude(path: Path) -> bool:
|
|
@@ -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
|
|
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,244 @@
|
|
|
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 does nothing on the ``agy`` CLI: it starts no server from
|
|
30
|
+
``.agents/mcp_config.json`` (measured — the same entry in the global root
|
|
31
|
+
starts one at boot). Google documents workspace config for the IDE and the
|
|
32
|
+
SDK, which we haven't verified; antigravity-cli#60 is a related report
|
|
33
|
+
against a different path. Hence ``project_scope_note``.
|
|
34
|
+
|
|
35
|
+
Writes are a non-destructive merge (only the toolbase entry under
|
|
36
|
+
``mcpServers`` is touched) and atomic (tmp file + rename). Malformed existing
|
|
37
|
+
JSON is refused rather than clobbered.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
from __future__ import annotations
|
|
41
|
+
|
|
42
|
+
import json
|
|
43
|
+
import os
|
|
44
|
+
import shutil
|
|
45
|
+
from pathlib import Path
|
|
46
|
+
from typing import Dict, List, Optional
|
|
47
|
+
|
|
48
|
+
from .base import (
|
|
49
|
+
AvailabilityStatus, HarnessAdapter, HarnessConfigError, RegistrationEntry,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Workspace customization root, relative to the project root.
|
|
53
|
+
WORKSPACE_ROOT_DIR = ".agents"
|
|
54
|
+
_CONFIG_NAME = "mcp_config.json"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class AntigravityConfigError(HarnessConfigError):
|
|
58
|
+
"""Existing Antigravity config is unreadable / malformed."""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _global_root() -> Path:
|
|
62
|
+
"""The global customization root, ``~/.gemini/config``."""
|
|
63
|
+
return Path.home() / ".gemini" / "config"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class AntigravityAdapter(HarnessAdapter):
|
|
67
|
+
name = "antigravity"
|
|
68
|
+
|
|
69
|
+
def project_scope_note(self) -> str:
|
|
70
|
+
return (
|
|
71
|
+
"the agy CLI does not load a workspace .agents/mcp_config.json — "
|
|
72
|
+
"only the IDE and SDK are documented to. Use "
|
|
73
|
+
"`tb connect antigravity -g` if you're on the CLI."
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# ── detection ────────────────────────────────────────────────────
|
|
77
|
+
|
|
78
|
+
def is_available(self) -> AvailabilityStatus:
|
|
79
|
+
if shutil.which("agy"):
|
|
80
|
+
return AvailabilityStatus(True, "agy CLI found on PATH")
|
|
81
|
+
# ~/.gemini alone means the Gemini CLI, not Antigravity -- key on the
|
|
82
|
+
# customization root and Antigravity's own state dirs instead.
|
|
83
|
+
if (_global_root() / _CONFIG_NAME).exists():
|
|
84
|
+
return AvailabilityStatus(True, "found ~/.gemini/config/mcp_config.json")
|
|
85
|
+
gemini = Path.home() / ".gemini"
|
|
86
|
+
for d in ("antigravity", "antigravity-cli", "antigravity-ide"):
|
|
87
|
+
if (gemini / d).exists():
|
|
88
|
+
return AvailabilityStatus(True, f"found ~/.gemini/{d}")
|
|
89
|
+
return AvailabilityStatus(
|
|
90
|
+
False, "no `agy` CLI on PATH and no ~/.gemini/config"
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
def supported_scopes(self) -> Dict[str, str]:
|
|
94
|
+
return {"user": "global", "project": "workspace"}
|
|
95
|
+
|
|
96
|
+
def skill_target(self):
|
|
97
|
+
# ~/.gemini/config/skills/<toolkit>__<skill>/SKILL.md -- Antigravity's
|
|
98
|
+
# native skill layout is Claude Code's: a directory per skill holding a
|
|
99
|
+
# SKILL.md with name+description frontmatter, loaded on demand. Skills
|
|
100
|
+
# sit in the customization root next to mcp_config.json; we use the
|
|
101
|
+
# global root, matching the other harnesses' user-global surfacing.
|
|
102
|
+
from ..skills import SkillTarget
|
|
103
|
+
return SkillTarget(
|
|
104
|
+
harness=self.name, root=_global_root() / "skills",
|
|
105
|
+
layout="dir", keep_frontmatter=True,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
# ── paths ────────────────────────────────────────────────────────
|
|
109
|
+
|
|
110
|
+
def config_path(self, scope: str, project_root: Optional[Path]) -> Path:
|
|
111
|
+
if scope == "user":
|
|
112
|
+
return _global_root() / _CONFIG_NAME
|
|
113
|
+
if scope == "project":
|
|
114
|
+
if project_root is None:
|
|
115
|
+
raise ValueError("project scope requires a project_root")
|
|
116
|
+
return project_root / WORKSPACE_ROOT_DIR / _CONFIG_NAME
|
|
117
|
+
raise ValueError(f"unknown scope {scope!r}")
|
|
118
|
+
|
|
119
|
+
# ── read / write ─────────────────────────────────────────────────
|
|
120
|
+
|
|
121
|
+
@staticmethod
|
|
122
|
+
def _read(path: Path) -> dict:
|
|
123
|
+
if not path.exists():
|
|
124
|
+
return {}
|
|
125
|
+
text = path.read_text(encoding="utf-8")
|
|
126
|
+
# The IDE ships a zero-byte mcp_config.json; that's an empty config,
|
|
127
|
+
# not a malformed one.
|
|
128
|
+
if not text.strip():
|
|
129
|
+
return {}
|
|
130
|
+
try:
|
|
131
|
+
data = json.loads(text)
|
|
132
|
+
except json.JSONDecodeError as e:
|
|
133
|
+
hint = ""
|
|
134
|
+
if "//" in text or "/*" in text:
|
|
135
|
+
hint = (
|
|
136
|
+
" Antigravity's mcp_config.json doesn't support comments — "
|
|
137
|
+
"remove them and re-run."
|
|
138
|
+
)
|
|
139
|
+
raise AntigravityConfigError(
|
|
140
|
+
f"{path} is not valid JSON ({e}); refusing to overwrite.{hint}"
|
|
141
|
+
) from e
|
|
142
|
+
if not isinstance(data, dict):
|
|
143
|
+
raise AntigravityConfigError(
|
|
144
|
+
f"{path} must be a JSON object at the top level."
|
|
145
|
+
)
|
|
146
|
+
return data
|
|
147
|
+
|
|
148
|
+
@staticmethod
|
|
149
|
+
def _write_atomic(path: Path, data: dict) -> None:
|
|
150
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
151
|
+
tmp = path.with_suffix(path.suffix + ".tmp")
|
|
152
|
+
with open(tmp, "w", encoding="utf-8") as f:
|
|
153
|
+
json.dump(data, f, indent=2, sort_keys=False)
|
|
154
|
+
f.write("\n")
|
|
155
|
+
f.flush()
|
|
156
|
+
os.fsync(f.fileno())
|
|
157
|
+
os.replace(tmp, path)
|
|
158
|
+
|
|
159
|
+
@staticmethod
|
|
160
|
+
def _entry(command: str, args: List[str], env: Optional[Dict[str, str]]) -> dict:
|
|
161
|
+
entry: dict = {"command": command, "args": list(args)}
|
|
162
|
+
if env:
|
|
163
|
+
entry["env"] = dict(env)
|
|
164
|
+
return entry
|
|
165
|
+
|
|
166
|
+
# ── install / uninstall ──────────────────────────────────────────
|
|
167
|
+
|
|
168
|
+
def install(
|
|
169
|
+
self,
|
|
170
|
+
*,
|
|
171
|
+
scope: str,
|
|
172
|
+
project_root: Optional[Path],
|
|
173
|
+
server_name: str,
|
|
174
|
+
command: str,
|
|
175
|
+
args: List[str],
|
|
176
|
+
env: Optional[Dict[str, str]] = None,
|
|
177
|
+
dry_run: bool = False,
|
|
178
|
+
) -> Path:
|
|
179
|
+
path = self.config_path(scope, project_root)
|
|
180
|
+
data = self._read(path)
|
|
181
|
+
servers = data.get("mcpServers")
|
|
182
|
+
if servers is None:
|
|
183
|
+
servers = {}
|
|
184
|
+
elif not isinstance(servers, dict):
|
|
185
|
+
raise AntigravityConfigError(
|
|
186
|
+
f"{path}: 'mcpServers' must be a JSON object."
|
|
187
|
+
)
|
|
188
|
+
servers[server_name] = self._entry(command, args, env)
|
|
189
|
+
data["mcpServers"] = servers
|
|
190
|
+
if not dry_run:
|
|
191
|
+
self._write_atomic(path, data)
|
|
192
|
+
return path
|
|
193
|
+
|
|
194
|
+
def uninstall(
|
|
195
|
+
self,
|
|
196
|
+
*,
|
|
197
|
+
scope: str,
|
|
198
|
+
project_root: Optional[Path],
|
|
199
|
+
server_name: str,
|
|
200
|
+
) -> bool:
|
|
201
|
+
path = self.config_path(scope, project_root)
|
|
202
|
+
if not path.exists():
|
|
203
|
+
return False
|
|
204
|
+
data = self._read(path)
|
|
205
|
+
servers = data.get("mcpServers")
|
|
206
|
+
if not isinstance(servers, dict) or server_name not in servers:
|
|
207
|
+
return False
|
|
208
|
+
del servers[server_name]
|
|
209
|
+
# Leave an empty mcpServers object rather than reshaping the file.
|
|
210
|
+
data["mcpServers"] = servers
|
|
211
|
+
self._write_atomic(path, data)
|
|
212
|
+
return True
|
|
213
|
+
|
|
214
|
+
# ── status ───────────────────────────────────────────────────────
|
|
215
|
+
|
|
216
|
+
def status(self, project_root: Optional[Path]) -> List[RegistrationEntry]:
|
|
217
|
+
out: List[RegistrationEntry] = []
|
|
218
|
+
scopes = [("user", None)]
|
|
219
|
+
if project_root is not None:
|
|
220
|
+
scopes.append(("project", project_root))
|
|
221
|
+
for scope, root in scopes:
|
|
222
|
+
path = self.config_path(scope, root)
|
|
223
|
+
present = False
|
|
224
|
+
command = ""
|
|
225
|
+
args: Optional[List[str]] = None
|
|
226
|
+
if path.exists():
|
|
227
|
+
try:
|
|
228
|
+
data = self._read(path)
|
|
229
|
+
except AntigravityConfigError:
|
|
230
|
+
data = {}
|
|
231
|
+
servers = data.get("mcpServers")
|
|
232
|
+
if isinstance(servers, dict) and "toolbase" in servers:
|
|
233
|
+
entry = servers["toolbase"]
|
|
234
|
+
if isinstance(entry, dict):
|
|
235
|
+
present = True
|
|
236
|
+
command = str(entry.get("command", ""))
|
|
237
|
+
raw = entry.get("args")
|
|
238
|
+
if isinstance(raw, list):
|
|
239
|
+
args = [str(a) for a in raw]
|
|
240
|
+
out.append(RegistrationEntry(
|
|
241
|
+
harness=self.name, scope=scope, path=path,
|
|
242
|
+
present=present, command=command, args=args,
|
|
243
|
+
))
|
|
244
|
+
return out
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"""Skills surfacing.
|
|
2
2
|
|
|
3
|
-
A toolkit's ``skills
|
|
3
|
+
A toolkit's ``skills/`` entries are agent-facing how-to guides, shipped either
|
|
4
|
+
as a flat ``skills/<name>.md`` or as ``skills/<name>/SKILL.md`` — a directory
|
|
5
|
+
that can carry ``references/``, ``scripts/`` and assets beside the guide (see
|
|
6
|
+
:class:`SkillSource`). Surfacing
|
|
4
7
|
is a per-harness ``tb connect`` concern (each harness has its own skill
|
|
5
8
|
location and format), driven through a :class:`SkillTarget` an adapter
|
|
6
9
|
returns. ``tb connect <harness>`` surfaces the activated toolkits' skills
|
|
@@ -11,6 +14,7 @@ expects.
|
|
|
11
14
|
Two layouts, one per supported harness:
|
|
12
15
|
|
|
13
16
|
Claude Code (dir) ~/.claude/skills/<toolkit>__<skill>/SKILL.md
|
|
17
|
+
Antigravity (dir) ~/.gemini/config/skills/<toolkit>__<skill>/SKILL.md
|
|
14
18
|
Codex (flat) ~/.codex/prompts/<toolkit>__<skill>.md
|
|
15
19
|
|
|
16
20
|
Claude Code watches its dir and both auto-surfaces each skill to the model
|
|
@@ -182,17 +186,69 @@ def parse_frontmatter(text: str) -> Tuple[Optional[SkillFrontmatter], str]:
|
|
|
182
186
|
), body
|
|
183
187
|
|
|
184
188
|
|
|
185
|
-
|
|
186
|
-
"""Return the list of skill markdown files in a toolkit directory.
|
|
189
|
+
SKILL_DOC = "SKILL.md"
|
|
187
190
|
|
|
188
|
-
|
|
191
|
+
|
|
192
|
+
@dataclass
|
|
193
|
+
class SkillSource:
|
|
194
|
+
"""One skill as an author ships it, in either of two shapes.
|
|
195
|
+
|
|
196
|
+
- **file** — ``skills/<name>.md``. The guide is the whole skill.
|
|
197
|
+
- **directory** — ``skills/<name>/SKILL.md``, which can carry
|
|
198
|
+
``references/``, ``scripts/`` and assets beside the guide. This is the
|
|
199
|
+
layout Claude Code and Antigravity use natively, so a skill written for
|
|
200
|
+
either drops into a toolkit unchanged.
|
|
201
|
+
|
|
202
|
+
``doc`` is the markdown to read in both shapes; ``root`` is what the
|
|
203
|
+
author named the skill (the file, or the directory), and is what the
|
|
204
|
+
slug comes from.
|
|
205
|
+
"""
|
|
206
|
+
|
|
207
|
+
doc: Path
|
|
208
|
+
root: Path
|
|
209
|
+
slug: str # bare slug, no ``<toolkit>__`` prefix
|
|
210
|
+
|
|
211
|
+
@property
|
|
212
|
+
def is_dir(self) -> bool:
|
|
213
|
+
return self.root != self.doc
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def discover_skills(toolkit_dir: Path) -> List[SkillSource]:
|
|
217
|
+
"""Return a toolkit's skills, both file- and directory-form.
|
|
218
|
+
|
|
219
|
+
A directory only counts as a skill if it holds a ``SKILL.md``; one that
|
|
220
|
+
doesn't is ignored here and warned about at publish time. Dotfiles and
|
|
221
|
+
macOS AppleDouble companions ("._foo.md") are filtered out.
|
|
222
|
+
"""
|
|
223
|
+
skills_dir = toolkit_dir / "skills"
|
|
224
|
+
if not skills_dir.exists():
|
|
225
|
+
return []
|
|
226
|
+
found: List[SkillSource] = []
|
|
227
|
+
for p in sorted(skills_dir.iterdir()):
|
|
228
|
+
if p.name.startswith("."):
|
|
229
|
+
continue
|
|
230
|
+
if p.is_dir():
|
|
231
|
+
doc = p / SKILL_DOC
|
|
232
|
+
if doc.is_file():
|
|
233
|
+
found.append(SkillSource(doc=doc, root=p, slug=_slug(p.name)))
|
|
234
|
+
elif p.suffix == ".md":
|
|
235
|
+
found.append(SkillSource(doc=p, root=p, slug=_slug(p.stem)))
|
|
236
|
+
return found
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def skill_dirs_without_doc(toolkit_dir: Path) -> List[Path]:
|
|
240
|
+
"""Directories under ``skills/`` that hold no ``SKILL.md``.
|
|
241
|
+
|
|
242
|
+
These are silently invisible to discovery, which is the kind of thing an
|
|
243
|
+
author should hear about before publishing rather than after.
|
|
189
244
|
"""
|
|
190
245
|
skills_dir = toolkit_dir / "skills"
|
|
191
246
|
if not skills_dir.exists():
|
|
192
247
|
return []
|
|
193
248
|
return sorted(
|
|
194
|
-
p for p in skills_dir.
|
|
195
|
-
if not p.name.startswith(".
|
|
249
|
+
p for p in skills_dir.iterdir()
|
|
250
|
+
if p.is_dir() and not p.name.startswith(".")
|
|
251
|
+
and not (p / SKILL_DOC).is_file()
|
|
196
252
|
)
|
|
197
253
|
|
|
198
254
|
|
|
@@ -242,12 +298,12 @@ def surface_skills(
|
|
|
242
298
|
manifest = _read_manifest(target.root) if target.layout == "flat" else None
|
|
243
299
|
surfaced: List[str] = []
|
|
244
300
|
for src in sources:
|
|
245
|
-
bare_slug =
|
|
301
|
+
bare_slug = src.slug
|
|
246
302
|
if disabled_slugs is not None and bare_slug in disabled_slugs:
|
|
247
303
|
# Individually deactivated in the active profile.
|
|
248
304
|
continue
|
|
249
305
|
|
|
250
|
-
text = src.read_text(encoding="utf-8")
|
|
306
|
+
text = src.doc.read_text(encoding="utf-8")
|
|
251
307
|
fm, body = parse_frontmatter(text)
|
|
252
308
|
bundle = fm.bundle if fm else None
|
|
253
309
|
if (
|
|
@@ -278,10 +334,15 @@ def surface_skills(
|
|
|
278
334
|
|
|
279
335
|
|
|
280
336
|
def _surface_dir(
|
|
281
|
-
root: Path, toolkit_name: str, slug: str, src:
|
|
337
|
+
root: Path, toolkit_name: str, slug: str, src: "SkillSource", text: str,
|
|
282
338
|
fm: Optional[SkillFrontmatter],
|
|
283
339
|
) -> None:
|
|
284
|
-
"""Write one skill as ``<root>/<slug>/SKILL.md`` (Claude Code layout).
|
|
340
|
+
"""Write one skill as ``<root>/<slug>/SKILL.md`` (Claude Code layout).
|
|
341
|
+
|
|
342
|
+
A directory-form source also gets its supporting files mirrored beside
|
|
343
|
+
the guide, so ``references/`` and friends resolve as the author wrote
|
|
344
|
+
them.
|
|
345
|
+
"""
|
|
285
346
|
dest_dir = root / slug
|
|
286
347
|
dest_dir.mkdir(parents=True, exist_ok=True)
|
|
287
348
|
# Drop the marker so we know we own this directory.
|
|
@@ -299,7 +360,9 @@ def _surface_dir(
|
|
|
299
360
|
# source file. Using the file stem as `name` and the first
|
|
300
361
|
# descriptive line as `description` is a backward-compat fallback
|
|
301
362
|
# for toolkits that predate the requirement.
|
|
302
|
-
synthesized_name =
|
|
363
|
+
synthesized_name = (
|
|
364
|
+
src.root.stem.replace("_", " ").replace("-", " ").strip().title()
|
|
365
|
+
)
|
|
303
366
|
description = _first_line_summary(text) or f"Guidance for {toolkit_name}."
|
|
304
367
|
text = (
|
|
305
368
|
"---\n"
|
|
@@ -314,7 +377,7 @@ def _surface_dir(
|
|
|
314
377
|
# time Claude Code re-reads, which matters for editable / dev
|
|
315
378
|
# installs where the toolkit dir is the author's working copy.
|
|
316
379
|
try:
|
|
317
|
-
skill_path.symlink_to(src.resolve())
|
|
380
|
+
skill_path.symlink_to(src.doc.resolve())
|
|
318
381
|
except OSError:
|
|
319
382
|
# Fall back to a copy (filesystem doesn't support symlinks,
|
|
320
383
|
# e.g. some FUSE mounts).
|
|
@@ -323,6 +386,44 @@ def _surface_dir(
|
|
|
323
386
|
# Windows or non-symlinkable filesystem: write a copy.
|
|
324
387
|
skill_path.write_text(text, encoding="utf-8")
|
|
325
388
|
|
|
389
|
+
if src.is_dir:
|
|
390
|
+
_mirror_supporting_files(dest_dir, src.root)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def _mirror_supporting_files(dest_dir: Path, src_dir: Path) -> None:
|
|
394
|
+
"""Mirror a dir-form skill's non-SKILL.md contents into ``dest_dir``.
|
|
395
|
+
|
|
396
|
+
Per-child symlinks rather than a symlink to the whole directory: the
|
|
397
|
+
surfaced dir has to stay ours to write ``OWNED_MARKER`` into, and
|
|
398
|
+
linking the top level would mean writing that marker into the author's
|
|
399
|
+
toolkit. Copies where symlinks aren't available. Stale children from an
|
|
400
|
+
earlier surface are cleared first, so a removed reference file doesn't
|
|
401
|
+
linger.
|
|
402
|
+
"""
|
|
403
|
+
keep = {OWNED_MARKER, SKILL_DOC}
|
|
404
|
+
for child in dest_dir.iterdir():
|
|
405
|
+
if child.name in keep:
|
|
406
|
+
continue
|
|
407
|
+
if child.is_symlink() or child.is_file():
|
|
408
|
+
child.unlink()
|
|
409
|
+
else:
|
|
410
|
+
shutil.rmtree(child, ignore_errors=True)
|
|
411
|
+
|
|
412
|
+
for child in sorted(src_dir.iterdir()):
|
|
413
|
+
if child.name == SKILL_DOC or child.name.startswith("."):
|
|
414
|
+
continue
|
|
415
|
+
dest = dest_dir / child.name
|
|
416
|
+
if _can_symlink():
|
|
417
|
+
try:
|
|
418
|
+
dest.symlink_to(child.resolve())
|
|
419
|
+
continue
|
|
420
|
+
except OSError:
|
|
421
|
+
pass
|
|
422
|
+
if child.is_dir():
|
|
423
|
+
shutil.copytree(child, dest)
|
|
424
|
+
else:
|
|
425
|
+
shutil.copy2(child, dest)
|
|
426
|
+
|
|
326
427
|
|
|
327
428
|
def _surface_flat(
|
|
328
429
|
root: Path, slug: str, text: str, body: str,
|
|
@@ -85,7 +85,9 @@ def get_allowed_categories() -> List[str]:
|
|
|
85
85
|
return _categories_cache
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
def _check_skill_frontmatter(
|
|
88
|
+
def _check_skill_frontmatter(
|
|
89
|
+
skill_path: Path, *, label: Optional[str] = None,
|
|
90
|
+
) -> Optional[str]:
|
|
89
91
|
"""Return a human-readable warning if a skill's frontmatter is missing
|
|
90
92
|
or incomplete; ``None`` if it's fine.
|
|
91
93
|
|
|
@@ -107,10 +109,13 @@ def _check_skill_frontmatter(skill_path: Path) -> Optional[str]:
|
|
|
107
109
|
except OSError:
|
|
108
110
|
return None
|
|
109
111
|
fm, _body = parse_frontmatter(text)
|
|
112
|
+
# ``label`` names the skill the way it sits on disk; for a dir-form skill
|
|
113
|
+
# that's "guide/SKILL.md", not the bare "SKILL.md" every one of them shares.
|
|
114
|
+
label = label or skill_path.name
|
|
110
115
|
docs_url = "https://toolbase-ai.com/docs/authoring#skills"
|
|
111
116
|
if fm is None:
|
|
112
117
|
return (
|
|
113
|
-
f"skills/{
|
|
118
|
+
f"skills/{label}: missing YAML frontmatter. "
|
|
114
119
|
f"Add a `---`-delimited block at the top with `name:` and "
|
|
115
120
|
f"`description:` fields. See {docs_url} for the format."
|
|
116
121
|
)
|
|
@@ -120,7 +125,7 @@ def _check_skill_frontmatter(skill_path: Path) -> Optional[str]:
|
|
|
120
125
|
if not getattr(fm, k)
|
|
121
126
|
]
|
|
122
127
|
return (
|
|
123
|
-
f"skills/{
|
|
128
|
+
f"skills/{label}: frontmatter missing required "
|
|
124
129
|
f"field{'s' if len(missing) != 1 else ''}: "
|
|
125
130
|
f"{', '.join(missing)}. See {docs_url} for the format."
|
|
126
131
|
)
|
|
@@ -820,13 +825,18 @@ def validate_toolkit(toolkit_path: Path) -> ValidationResult:
|
|
|
820
825
|
result.errors.append("skills/ exists but is not a directory")
|
|
821
826
|
result.is_valid = False
|
|
822
827
|
else:
|
|
823
|
-
#
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if not p.name.startswith('._')
|
|
827
|
-
]
|
|
828
|
+
# Both shapes: skills/<name>.md and skills/<name>/SKILL.md.
|
|
829
|
+
from .skills import discover_skills, skill_dirs_without_doc
|
|
830
|
+
skill_files = discover_skills(toolkit_path)
|
|
828
831
|
if not skill_files:
|
|
829
832
|
result.warnings.append("skills/ directory exists but is empty (consider adding skill guides)")
|
|
833
|
+
# A directory with no SKILL.md is invisible to discovery, which
|
|
834
|
+
# is easier to fix before publishing than after.
|
|
835
|
+
for d in skill_dirs_without_doc(toolkit_path):
|
|
836
|
+
result.warnings.append(
|
|
837
|
+
f"skills/{d.name}/ has no SKILL.md, so it ships without "
|
|
838
|
+
"being surfaced as a skill."
|
|
839
|
+
)
|
|
830
840
|
|
|
831
841
|
# Frontmatter check: each skill should carry name + description
|
|
832
842
|
# at the top so Claude Code (when surfaced into ~/.claude/skills/)
|
|
@@ -835,7 +845,12 @@ def validate_toolkit(toolkit_path: Path) -> ValidationResult:
|
|
|
835
845
|
# synthesizes frontmatter when missing.
|
|
836
846
|
declared_bundles = set((metadata.bundles or {}).keys()) if metadata else set()
|
|
837
847
|
for sf in skill_files:
|
|
838
|
-
|
|
848
|
+
# Name the skill as the author sees it on disk: "guide.md"
|
|
849
|
+
# for the flat form, "guide/SKILL.md" for the dir form.
|
|
850
|
+
label = (
|
|
851
|
+
f"{sf.root.name}/{sf.doc.name}" if sf.is_dir else sf.doc.name
|
|
852
|
+
)
|
|
853
|
+
fm_problem = _check_skill_frontmatter(sf.doc, label=label)
|
|
839
854
|
if fm_problem:
|
|
840
855
|
result.warnings.append(fm_problem)
|
|
841
856
|
|
|
@@ -843,13 +858,13 @@ def validate_toolkit(toolkit_path: Path) -> ValidationResult:
|
|
|
843
858
|
# frontmatter must name a bundle declared in `bundles:`.
|
|
844
859
|
try:
|
|
845
860
|
from .skills import parse_frontmatter
|
|
846
|
-
fm, _body = parse_frontmatter(sf.read_text(encoding="utf-8"))
|
|
861
|
+
fm, _body = parse_frontmatter(sf.doc.read_text(encoding="utf-8"))
|
|
847
862
|
except Exception:
|
|
848
863
|
fm = None
|
|
849
864
|
skill_bundle = fm.bundle if fm else None
|
|
850
865
|
if skill_bundle is not None and skill_bundle not in declared_bundles:
|
|
851
866
|
result.errors.append(
|
|
852
|
-
f"skills/{
|
|
867
|
+
f"skills/{label}: bundle: '{skill_bundle}' is not "
|
|
853
868
|
f"declared in bundles. Declared bundles: "
|
|
854
869
|
f"{sorted(declared_bundles) or '(none)'}."
|
|
855
870
|
)
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|