toolbase 0.2.1__tar.gz → 0.4.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 (67) hide show
  1. toolbase-0.4.0/PKG-INFO +211 -0
  2. toolbase-0.4.0/README.md +170 -0
  3. {toolbase-0.2.1 → toolbase-0.4.0}/pyproject.toml +1 -1
  4. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/cli.py +252 -1
  5. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/connect/orchestral.py +16 -2
  6. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/serve/orchestrator.py +12 -0
  7. toolbase-0.2.1/PKG-INFO +0 -273
  8. toolbase-0.2.1/README.md +0 -232
  9. {toolbase-0.2.1 → toolbase-0.4.0}/CHANGELOG.md +0 -0
  10. {toolbase-0.2.1 → toolbase-0.4.0}/LICENSE +0 -0
  11. {toolbase-0.2.1 → toolbase-0.4.0}/MANIFEST.in +0 -0
  12. {toolbase-0.2.1 → toolbase-0.4.0}/setup.cfg +0 -0
  13. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/__init__.py +0 -0
  14. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/_setup_host.py +0 -0
  15. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/_toolkit_host.py +0 -0
  16. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/astro.py +0 -0
  17. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/auth.py +0 -0
  18. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/config.py +0 -0
  19. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/connect/__init__.py +0 -0
  20. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/connect/base.py +0 -0
  21. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/connect/claude_code.py +0 -0
  22. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/connect/codex.py +0 -0
  23. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/envs/__init__.py +0 -0
  24. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/envs/bundle_deps.py +0 -0
  25. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/envs/cache.py +0 -0
  26. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/envs/config.py +0 -0
  27. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/envs/discovery.py +0 -0
  28. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/envs/manifest.py +0 -0
  29. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/envs/paths.py +0 -0
  30. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/envs/schema.py +0 -0
  31. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/hep.py +0 -0
  32. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/ingest.py +0 -0
  33. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/logging/__init__.py +0 -0
  34. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/logging/logger.py +0 -0
  35. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/neutrino.py +0 -0
  36. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/quantum.py +0 -0
  37. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/serve/__init__.py +0 -0
  38. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/serve/bundles.py +0 -0
  39. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/serve/config.py +0 -0
  40. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/serve/profile_scaffold.py +0 -0
  41. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/serve/profiles.py +0 -0
  42. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/serve/proxy_tool.py +0 -0
  43. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/setup/__init__.py +0 -0
  44. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/setup/_rpc.py +0 -0
  45. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/setup/context.py +0 -0
  46. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/setup/declarative.py +0 -0
  47. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/setup/downloads.py +0 -0
  48. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/setup/prompts.py +0 -0
  49. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/setup/runner.py +0 -0
  50. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/setup/schema.py +0 -0
  51. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/setup/storage.py +0 -0
  52. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/setup/validate_cache.py +0 -0
  53. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/skills.py +0 -0
  54. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/templates/Dockerfile.template +0 -0
  55. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/templates/README.md.template +0 -0
  56. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/templates/__init__.py.template +0 -0
  57. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/templates/mcp/__init__.py.template +0 -0
  58. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/templates/mcp/server_stdio.py.template +0 -0
  59. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/templates/requirements.txt.template +0 -0
  60. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/templates/setup.py.template +0 -0
  61. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/templates/skills/example_skill.md +0 -0
  62. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/templates/tool_example.py +0 -0
  63. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/templates/toolkit.yaml.template +0 -0
  64. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/toolkit.py +0 -0
  65. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/validation.py +0 -0
  66. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase/versioning.py +0 -0
  67. {toolbase-0.2.1 → toolbase-0.4.0}/toolbase.egg-info/SOURCES.txt +0 -0
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: toolbase
3
+ Version: 0.4.0
4
+ Summary: The community registry and CLI for AI agent toolkits - discover, share, and serve tools to AI agents over MCP
5
+ Author-email: Alex Roman <toolbase.dev@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/alexr314/toolbase
8
+ Project-URL: Documentation, https://github.com/alexr314/toolbase#readme
9
+ Project-URL: Repository, https://github.com/alexr314/toolbase
10
+ Project-URL: Issues, https://github.com/alexr314/toolbase/issues
11
+ Keywords: ai,agents,tools,toolkit,mcp,orchestral,registry,package-manager
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.12
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: click>=8.0
24
+ Requires-Dist: requests>=2.31
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: ruamel.yaml>=0.18
27
+ Requires-Dist: rich>=13.0
28
+ Requires-Dist: pydantic>=2.0
29
+ Requires-Dist: email-validator>=2.0
30
+ Requires-Dist: orchestral-ai>=1.4
31
+ Requires-Dist: mcp>=1.0
32
+ Requires-Dist: tomlkit>=0.12
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=7.0; extra == "dev"
35
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
36
+ Requires-Dist: black>=23.0; extra == "dev"
37
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
38
+ Provides-Extra: docs
39
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
40
+ Dynamic: license-file
41
+
42
+ # toolbase
43
+
44
+ The package manager for AI agent toolkits. Install toolkits into
45
+ isolated environments, curate which tools your agent sees, and serve
46
+ them to your harness over the [Model Context Protocol](https://modelcontextprotocol.io). Toolkits
47
+ span any domain, from web and data utilities to scientific categories
48
+ like astro, hep, and quantum.
49
+
50
+ A **toolkit** is the publishable unit; it bundles one or more **tools**
51
+ an agent can call. Each toolkit installs into its own isolated Python
52
+ environment, so dependency conflicts between toolkits are never a
53
+ problem.
54
+
55
+ Full CLI reference: <https://toolbase-ai.com/docs>.
56
+
57
+ ---
58
+
59
+ ## Install toolbase
60
+
61
+ ```bash
62
+ pip install toolbase # Python 3.12+
63
+ ```
64
+
65
+ ## Arm your agent
66
+
67
+ The loop is **install → activate → connect**. `tb` is a short alias for
68
+ `toolbase`; both ship with the package and behave identically.
69
+
70
+ ```bash
71
+ tb install calculator # download into an isolated environment
72
+ tb activate calculator # expose it to the agent
73
+ tb connect claude-code # write toolbase into Claude Code's MCP config
74
+ ```
75
+
76
+ Now launch your harness (e.g. `claude` for Claude Code) — or, in an
77
+ already-running session, reconnect the toolbase MCP server. The tools
78
+ appear as `calculator__add`, `calculator__multiply`, etc.
79
+ `tb install calculator -a` installs and activates in one step.
80
+
81
+ **Install ≠ activate.** Installing places a toolkit in the global cache
82
+ but serves nothing — activation is what exposes it to the agent. The
83
+ binary always lives in the shared cache (`~/.toolbase/cache/`); only
84
+ the activation is scoped: `tb activate` writes to the current
85
+ directory's `.toolbase/` by default, `-g` writes to the user-wide
86
+ profile instead.
87
+
88
+ **`tb connect` writes the MCP config for you.** Claude Code, Codex, and
89
+ Orchestral are all supported (`tb connect --harnesses` lists them);
90
+ Claude Code and Codex are MCP clients (`tb connect` edits their config
91
+ file), while Orchestral gets a runnable agent script you launch
92
+ yourself.
93
+
94
+ ## Inspect
95
+
96
+ ```bash
97
+ tb list # installed toolkits, ✓ active / ✗ inactive
98
+ tb list -v # per-tool view with bundle + config-gating annotations
99
+ tb logs # tool calls, live (best diagnostic for "did it fire?")
100
+ ```
101
+
102
+ ## Curate what the agent sees
103
+
104
+ `tb activate` / `deactivate` work at three granularities:
105
+
106
+ ```bash
107
+ tb activate calculator # the whole toolkit
108
+ tb activate calculator/scientific # one bundle (group of related tools)
109
+ tb activate calculator__add # one specific tool
110
+ tb deactivate calculator__add # hide it again
111
+ ```
112
+
113
+ A **bundle** is a self-contained capability an author carves out of a
114
+ toolkit, with its own deps and skills. `tb profile tools calculator`
115
+ lists what's available. Power users can keep several named profiles
116
+ (`tb profile create paper`,
117
+ `tb connect claude-code --profile paper`) and switch between them; most
118
+ users only ever touch the default profile.
119
+
120
+ ---
121
+
122
+ ## Authoring a toolkit
123
+
124
+ ```bash
125
+ tb init my-toolkit # scaffold from template
126
+ cd my-toolkit
127
+ # write tools in tools/ and skills in skills/
128
+ tb validate # check structure
129
+ tb login # one-time browser-flow auth
130
+ tb publish # ship it (auto-registers on first run)
131
+ ```
132
+
133
+ **Iterating locally.** Develop a toolkit's code without a
134
+ publish→install round-trip by installing it editable:
135
+
136
+ ```bash
137
+ cd my-toolkit
138
+ tb install -e . -a # live symlink to this source dir, and activate
139
+ ```
140
+
141
+ Edits to your tool source appear on the next serve; rerun
142
+ `tb install -e .` to rebuild the env when dependencies change.
143
+
144
+ For the full author guide — tool conventions, skills, bundles,
145
+ configuration, `setup.py` — see <https://toolbase-ai.com/docs/authoring>.
146
+ For the agent-assisted authoring flow (recommended for first toolkits),
147
+ see <https://toolbase-ai.com/docs/scaffold-with-an-agent>.
148
+
149
+ ---
150
+
151
+ ## Commands
152
+
153
+ Full reference with all flags: <https://toolbase-ai.com/docs/reference/commands>.
154
+
155
+ | Command | Purpose |
156
+ |---|---|
157
+ | `tb install NAME` | Install a toolkit (`-a` to also activate, `-e <path>` for editable, `NAME[a,b]` for selected bundles) |
158
+ | `tb uninstall NAME` | Remove a toolkit |
159
+ | `tb list` | Installed toolkits (`-v` for a per-tool view) |
160
+ | `tb activate ITEM` | Expose a toolkit / `toolkit/bundle` / `toolkit__tool` (project-local; `-g` for user-wide) |
161
+ | `tb deactivate ITEM` | Hide a toolkit / bundle / tool |
162
+ | `tb connect HARNESS` | Wire toolbase into Claude Code, Codex, or scaffold an Orchestral agent script |
163
+ | `tb disconnect HARNESS` | Remove toolbase from a harness |
164
+ | `tb logs` | Tail the serve log, live |
165
+ | `tb profile …` | Manage named profiles: `list \| show \| create \| edit \| delete \| set-default \| path \| tools` |
166
+ | `tb config …` | Manage per-toolkit config: `show \| init \| set \| unset \| edit \| path \| validate` |
167
+ | `tb setup TOOLKIT` | Run a toolkit's `setup.py` (`--reset`, `--check`) |
168
+ | `tb project init` | Create `.toolbase/` here |
169
+ | `tb init NAME` | Scaffold a toolkit from template |
170
+ | `tb validate` / `tb ingest` | Check toolkit structure / regenerate `toolkit.yaml` from code |
171
+ | `tb login` / `tb whoami` / `tb logout` | Registry auth |
172
+ | `tb publish` | Package and upload to the registry |
173
+
174
+ See [CHANGELOG.md](CHANGELOG.md) for the full release history.
175
+
176
+ ---
177
+
178
+ ## Architecture
179
+
180
+ Three pieces:
181
+
182
+ - **CLI** (this package) — installed locally, manages toolkit
183
+ environments and serves tools.
184
+ - **Backend** ([api.scitoolkit.org](https://api.scitoolkit.org)) —
185
+ registry, auth, tarball storage.
186
+ - **Website** ([toolbase-ai.com](https://toolbase-ai.com)) — discover
187
+ and manage published toolkits.
188
+
189
+ Each installed toolkit runs in its own subprocess in its own Python
190
+ environment. `toolbase serve` aggregates them and exposes the union as
191
+ a single MCP server upstream; failures in one toolkit don't affect
192
+ others.
193
+
194
+ ---
195
+
196
+ ## Contributing
197
+
198
+ Issues and PRs are welcome at
199
+ <https://github.com/alexr314/toolbase>.
200
+
201
+ ## License
202
+
203
+ MIT. See [LICENSE](LICENSE).
204
+
205
+ ## Links
206
+
207
+ - Website: <https://toolbase-ai.com>
208
+ - Docs: <https://toolbase-ai.com/docs>
209
+ - Backend API: <https://api.scitoolkit.org>
210
+ - GitHub: <https://github.com/alexr314/toolbase>
211
+ - Issues: <https://github.com/alexr314/toolbase/issues>
@@ -0,0 +1,170 @@
1
+ # toolbase
2
+
3
+ The package manager for AI agent toolkits. Install toolkits into
4
+ isolated environments, curate which tools your agent sees, and serve
5
+ them to your harness over the [Model Context Protocol](https://modelcontextprotocol.io). Toolkits
6
+ span any domain, from web and data utilities to scientific categories
7
+ like astro, hep, and quantum.
8
+
9
+ A **toolkit** is the publishable unit; it bundles one or more **tools**
10
+ an agent can call. Each toolkit installs into its own isolated Python
11
+ environment, so dependency conflicts between toolkits are never a
12
+ problem.
13
+
14
+ Full CLI reference: <https://toolbase-ai.com/docs>.
15
+
16
+ ---
17
+
18
+ ## Install toolbase
19
+
20
+ ```bash
21
+ pip install toolbase # Python 3.12+
22
+ ```
23
+
24
+ ## Arm your agent
25
+
26
+ The loop is **install → activate → connect**. `tb` is a short alias for
27
+ `toolbase`; both ship with the package and behave identically.
28
+
29
+ ```bash
30
+ tb install calculator # download into an isolated environment
31
+ tb activate calculator # expose it to the agent
32
+ tb connect claude-code # write toolbase into Claude Code's MCP config
33
+ ```
34
+
35
+ Now launch your harness (e.g. `claude` for Claude Code) — or, in an
36
+ already-running session, reconnect the toolbase MCP server. The tools
37
+ appear as `calculator__add`, `calculator__multiply`, etc.
38
+ `tb install calculator -a` installs and activates in one step.
39
+
40
+ **Install ≠ activate.** Installing places a toolkit in the global cache
41
+ but serves nothing — activation is what exposes it to the agent. The
42
+ binary always lives in the shared cache (`~/.toolbase/cache/`); only
43
+ the activation is scoped: `tb activate` writes to the current
44
+ directory's `.toolbase/` by default, `-g` writes to the user-wide
45
+ profile instead.
46
+
47
+ **`tb connect` writes the MCP config for you.** Claude Code, Codex, and
48
+ Orchestral are all supported (`tb connect --harnesses` lists them);
49
+ Claude Code and Codex are MCP clients (`tb connect` edits their config
50
+ file), while Orchestral gets a runnable agent script you launch
51
+ yourself.
52
+
53
+ ## Inspect
54
+
55
+ ```bash
56
+ tb list # installed toolkits, ✓ active / ✗ inactive
57
+ tb list -v # per-tool view with bundle + config-gating annotations
58
+ tb logs # tool calls, live (best diagnostic for "did it fire?")
59
+ ```
60
+
61
+ ## Curate what the agent sees
62
+
63
+ `tb activate` / `deactivate` work at three granularities:
64
+
65
+ ```bash
66
+ tb activate calculator # the whole toolkit
67
+ tb activate calculator/scientific # one bundle (group of related tools)
68
+ tb activate calculator__add # one specific tool
69
+ tb deactivate calculator__add # hide it again
70
+ ```
71
+
72
+ A **bundle** is a self-contained capability an author carves out of a
73
+ toolkit, with its own deps and skills. `tb profile tools calculator`
74
+ lists what's available. Power users can keep several named profiles
75
+ (`tb profile create paper`,
76
+ `tb connect claude-code --profile paper`) and switch between them; most
77
+ users only ever touch the default profile.
78
+
79
+ ---
80
+
81
+ ## Authoring a toolkit
82
+
83
+ ```bash
84
+ tb init my-toolkit # scaffold from template
85
+ cd my-toolkit
86
+ # write tools in tools/ and skills in skills/
87
+ tb validate # check structure
88
+ tb login # one-time browser-flow auth
89
+ tb publish # ship it (auto-registers on first run)
90
+ ```
91
+
92
+ **Iterating locally.** Develop a toolkit's code without a
93
+ publish→install round-trip by installing it editable:
94
+
95
+ ```bash
96
+ cd my-toolkit
97
+ tb install -e . -a # live symlink to this source dir, and activate
98
+ ```
99
+
100
+ Edits to your tool source appear on the next serve; rerun
101
+ `tb install -e .` to rebuild the env when dependencies change.
102
+
103
+ For the full author guide — tool conventions, skills, bundles,
104
+ configuration, `setup.py` — see <https://toolbase-ai.com/docs/authoring>.
105
+ For the agent-assisted authoring flow (recommended for first toolkits),
106
+ see <https://toolbase-ai.com/docs/scaffold-with-an-agent>.
107
+
108
+ ---
109
+
110
+ ## Commands
111
+
112
+ Full reference with all flags: <https://toolbase-ai.com/docs/reference/commands>.
113
+
114
+ | Command | Purpose |
115
+ |---|---|
116
+ | `tb install NAME` | Install a toolkit (`-a` to also activate, `-e <path>` for editable, `NAME[a,b]` for selected bundles) |
117
+ | `tb uninstall NAME` | Remove a toolkit |
118
+ | `tb list` | Installed toolkits (`-v` for a per-tool view) |
119
+ | `tb activate ITEM` | Expose a toolkit / `toolkit/bundle` / `toolkit__tool` (project-local; `-g` for user-wide) |
120
+ | `tb deactivate ITEM` | Hide a toolkit / bundle / tool |
121
+ | `tb connect HARNESS` | Wire toolbase into Claude Code, Codex, or scaffold an Orchestral agent script |
122
+ | `tb disconnect HARNESS` | Remove toolbase from a harness |
123
+ | `tb logs` | Tail the serve log, live |
124
+ | `tb profile …` | Manage named profiles: `list \| show \| create \| edit \| delete \| set-default \| path \| tools` |
125
+ | `tb config …` | Manage per-toolkit config: `show \| init \| set \| unset \| edit \| path \| validate` |
126
+ | `tb setup TOOLKIT` | Run a toolkit's `setup.py` (`--reset`, `--check`) |
127
+ | `tb project init` | Create `.toolbase/` here |
128
+ | `tb init NAME` | Scaffold a toolkit from template |
129
+ | `tb validate` / `tb ingest` | Check toolkit structure / regenerate `toolkit.yaml` from code |
130
+ | `tb login` / `tb whoami` / `tb logout` | Registry auth |
131
+ | `tb publish` | Package and upload to the registry |
132
+
133
+ See [CHANGELOG.md](CHANGELOG.md) for the full release history.
134
+
135
+ ---
136
+
137
+ ## Architecture
138
+
139
+ Three pieces:
140
+
141
+ - **CLI** (this package) — installed locally, manages toolkit
142
+ environments and serves tools.
143
+ - **Backend** ([api.scitoolkit.org](https://api.scitoolkit.org)) —
144
+ registry, auth, tarball storage.
145
+ - **Website** ([toolbase-ai.com](https://toolbase-ai.com)) — discover
146
+ and manage published toolkits.
147
+
148
+ Each installed toolkit runs in its own subprocess in its own Python
149
+ environment. `toolbase serve` aggregates them and exposes the union as
150
+ a single MCP server upstream; failures in one toolkit don't affect
151
+ others.
152
+
153
+ ---
154
+
155
+ ## Contributing
156
+
157
+ Issues and PRs are welcome at
158
+ <https://github.com/alexr314/toolbase>.
159
+
160
+ ## License
161
+
162
+ MIT. See [LICENSE](LICENSE).
163
+
164
+ ## Links
165
+
166
+ - Website: <https://toolbase-ai.com>
167
+ - Docs: <https://toolbase-ai.com/docs>
168
+ - Backend API: <https://api.scitoolkit.org>
169
+ - GitHub: <https://github.com/alexr314/toolbase>
170
+ - Issues: <https://github.com/alexr314/toolbase/issues>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "toolbase"
7
- version = "0.2.1"
7
+ version = "0.4.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"
@@ -4084,6 +4084,220 @@ def _post_install_activate(
4084
4084
  console.print(f"[dim]{result.message}[/dim]")
4085
4085
 
4086
4086
 
4087
+ @main.command()
4088
+ @click.argument('path', default='.',
4089
+ type=click.Path(exists=True, file_okay=False))
4090
+ @click.option('--output', '-o', 'output_dir', default='.',
4091
+ type=click.Path(file_okay=False),
4092
+ help='Directory to write the tarball into (default: cwd).')
4093
+ def export(path, output_dir):
4094
+ """
4095
+ Package a toolkit directory as an installable tarball.
4096
+
4097
+ \b
4098
+ The registry-free distribution path: export on one machine,
4099
+ move the file however you like (scp, artifact store), install
4100
+ elsewhere with `tb install <name>-<version>.tar.gz`. Useful for
4101
+ private toolkits that aren't published to the registry.
4102
+
4103
+ Uses the same packaging as `tb publish`: VCS/build cruft and
4104
+ consumer-side state (.toolbase/, .mcp.json, .claude/, ...) are
4105
+ excluded, so local machine paths never leak into the package.
4106
+ """
4107
+ import yaml as _yaml
4108
+
4109
+ source = Path(path).resolve()
4110
+ tk_yaml = source / "toolkit.yaml"
4111
+ if not tk_yaml.is_file():
4112
+ raise click.UsageError(f"{source}: no toolkit.yaml — not a toolkit directory.")
4113
+ try:
4114
+ meta = _yaml.safe_load(tk_yaml.read_text()) or {}
4115
+ except Exception as e:
4116
+ raise click.UsageError(f"{tk_yaml}: unreadable ({e})")
4117
+ name = meta.get("name")
4118
+ version = meta.get("version")
4119
+ if not name or not version:
4120
+ raise click.UsageError(
4121
+ f"{tk_yaml}: needs `name:` and `version:` to name the package."
4122
+ )
4123
+
4124
+ out_dir = Path(output_dir).resolve()
4125
+ out_dir.mkdir(parents=True, exist_ok=True)
4126
+ out = out_dir / f"{name}-{version}.tar.gz"
4127
+ create_tarball(source, out, name)
4128
+ size = out.stat().st_size
4129
+ click.echo(f"✓ exported {name} {version} → {out} ({_format_bytes(size)})")
4130
+ click.echo(f" install elsewhere with: tb install {out.name}")
4131
+
4132
+
4133
+ # ── import files (`tb install <file>.yaml`) ─────────────────────────────
4134
+
4135
+ # Recognized keys, kept strict: an unknown key in a committed import
4136
+ # file is a typo'd intention, and silently ignoring it would install
4137
+ # something other than what the author wrote down.
4138
+ _IMPORT_ENTRY_KEYS = {"name", "source", "version", "editable", "bundles"}
4139
+
4140
+
4141
+ def _parse_import_file(path: Path) -> list:
4142
+ """Parse a toolkit import file into normalized install entries.
4143
+
4144
+ Shape::
4145
+
4146
+ toolkits:
4147
+ - name: calculator # registry install
4148
+ version: 0.2.0 # optional
4149
+ bundles: [scientific] # optional
4150
+ - source: ../heptapod # path install
4151
+ editable: true # live symlink (-e)
4152
+
4153
+ Each entry needs ``name`` (registry) or ``source`` (path); relative
4154
+ sources resolve against the import file's directory so the file
4155
+ travels with a repo, and ``${VAR}`` in sources expands from the
4156
+ environment.
4157
+ """
4158
+ import yaml as _yaml
4159
+
4160
+ try:
4161
+ data = _yaml.safe_load(path.read_text()) or {}
4162
+ except Exception as e:
4163
+ raise click.UsageError(f"{path}: unreadable YAML ({e})")
4164
+ if not isinstance(data, dict) or not isinstance(data.get("toolkits"), list):
4165
+ raise click.UsageError(
4166
+ f"{path}: an import file is a mapping with a `toolkits:` list."
4167
+ )
4168
+
4169
+ entries = []
4170
+ for i, raw in enumerate(data["toolkits"]):
4171
+ where = f"{path} toolkits[{i}]"
4172
+ if not isinstance(raw, dict):
4173
+ raise click.UsageError(f"{where}: entry must be a mapping, got {raw!r}")
4174
+ unknown = set(raw) - _IMPORT_ENTRY_KEYS
4175
+ if unknown:
4176
+ raise click.UsageError(
4177
+ f"{where}: unknown key(s) {sorted(unknown)}; "
4178
+ f"expected {sorted(_IMPORT_ENTRY_KEYS)}"
4179
+ )
4180
+ name = raw.get("name")
4181
+ source = raw.get("source")
4182
+ editable = bool(raw.get("editable", False))
4183
+ if not name and not source:
4184
+ raise click.UsageError(f"{where}: needs `name:` (registry) or `source:` (path)")
4185
+ if editable and not source:
4186
+ raise click.UsageError(f"{where}: `editable: true` requires `source:`")
4187
+ if source:
4188
+ expanded = os.path.expandvars(os.path.expanduser(str(source)))
4189
+ src = Path(expanded)
4190
+ if not src.is_absolute():
4191
+ src = (path.parent / src).resolve()
4192
+ target = str(src)
4193
+ else:
4194
+ target = str(name)
4195
+ bundles = raw.get("bundles")
4196
+ if bundles is not None and not (
4197
+ isinstance(bundles, list) and all(isinstance(b, str) for b in bundles)
4198
+ ):
4199
+ raise click.UsageError(f"{where}: `bundles:` must be a list of strings")
4200
+ entries.append({
4201
+ "target": target,
4202
+ "label": str(name or source),
4203
+ "version": raw.get("version"),
4204
+ "editable": editable,
4205
+ "bundles": tuple(bundles) if bundles else (),
4206
+ })
4207
+ if not entries:
4208
+ raise click.UsageError(f"{path}: `toolkits:` list is empty.")
4209
+ return entries
4210
+
4211
+
4212
+ def _install_from_import_file(ctx, path: Path, *, global_scope, local_scope,
4213
+ no_skills, activate_after, rebuild,
4214
+ yes, no_, no_input, invoke=None) -> None:
4215
+ """Install every toolkit an import file lists, via the normal
4216
+ per-toolkit install path (``ctx.invoke``), with the file-level
4217
+ scope/prompt flags applied to each entry.
4218
+
4219
+ Per-entry failures do not abort the run — the remaining entries
4220
+ still install — but the command exits nonzero with a summary, so a
4221
+ broken entry cannot pass silently in provisioning scripts.
4222
+
4223
+ ``invoke`` is a test seam; production uses ``ctx.invoke(install, ...)``.
4224
+ """
4225
+ entries = _parse_import_file(path)
4226
+ if invoke is None:
4227
+ def invoke(**kw):
4228
+ return ctx.invoke(install, **kw)
4229
+
4230
+ failures = []
4231
+ for e in entries:
4232
+ click.echo("→ installing " + e["label"]
4233
+ + (" @" + e["version"] if e["version"] else "")
4234
+ + (" (editable)" if e["editable"] else ""))
4235
+ try:
4236
+ invoke(
4237
+ name=e["target"], version=e["version"],
4238
+ global_scope=global_scope, local_scope=local_scope,
4239
+ editable=e["editable"], no_skills=no_skills,
4240
+ activate_after=activate_after, bundle_flags=e["bundles"],
4241
+ rebuild=rebuild, yes=yes, no_=no_, no_input=no_input,
4242
+ )
4243
+ except click.ClickException as exc:
4244
+ failures.append((e["label"], exc.format_message()))
4245
+ except Exception as exc:
4246
+ failures.append((e["label"], type(exc).__name__ + ": " + str(exc)))
4247
+
4248
+ if failures:
4249
+ for label, msg in failures:
4250
+ click.echo("✗ " + label + ": " + msg, err=True)
4251
+ raise click.ClickException(
4252
+ f"{len(failures)}/{len(entries)} import entries failed."
4253
+ )
4254
+ click.echo(f"✓ {len(entries)} toolkit(s) installed from {path.name}")
4255
+
4256
+
4257
+ def _install_from_tarball(ctx, path: Path, *, version, global_scope,
4258
+ local_scope, no_skills, activate_after,
4259
+ bundle_flags, rebuild, yes, no_, no_input,
4260
+ invoke=None) -> None:
4261
+ """Install an exported toolkit tarball (``tb export``'s output).
4262
+
4263
+ Extracts to a temp dir, validates a root toolkit.yaml, and
4264
+ re-dispatches through the normal path-install flow — the tarball is
4265
+ just a portable wrapper around a source directory. ``invoke`` is a
4266
+ test seam; production uses ``ctx.invoke(install, ...)``.
4267
+ """
4268
+ import tarfile
4269
+ import tempfile
4270
+
4271
+ if invoke is None:
4272
+ def invoke(**kw):
4273
+ return ctx.invoke(install, **kw)
4274
+
4275
+ with tempfile.TemporaryDirectory(prefix="tb-install-") as tmp:
4276
+ try:
4277
+ with tarfile.open(path, "r:gz") as tar:
4278
+ tar.extractall(path=tmp, filter="data")
4279
+ except Exception as e:
4280
+ raise click.UsageError(f"{path}: not a readable .tar.gz ({e})")
4281
+ root = Path(tmp)
4282
+ if not (root / "toolkit.yaml").is_file():
4283
+ # Tolerate a single top-level directory wrapping the toolkit.
4284
+ subdirs = [d for d in root.iterdir() if d.is_dir()]
4285
+ if len(subdirs) == 1 and (subdirs[0] / "toolkit.yaml").is_file():
4286
+ root = subdirs[0]
4287
+ else:
4288
+ raise click.UsageError(
4289
+ f"{path}: no toolkit.yaml at the archive root — is this "
4290
+ "a `tb export` package?"
4291
+ )
4292
+ invoke(
4293
+ name=str(root), version=version,
4294
+ global_scope=global_scope, local_scope=local_scope,
4295
+ editable=False, no_skills=no_skills,
4296
+ activate_after=activate_after, bundle_flags=bundle_flags,
4297
+ rebuild=rebuild, yes=yes, no_=no_, no_input=no_input,
4298
+ )
4299
+
4300
+
4087
4301
  @main.command()
4088
4302
  @click.argument('name')
4089
4303
  @click.option('--version', '-v', help='Specific version to install (default: latest)')
@@ -4146,7 +4360,8 @@ def _post_install_activate(
4146
4360
  ),
4147
4361
  )
4148
4362
  @_interactive_options
4149
- def install(name, version, global_scope, local_scope, editable, no_skills, activate_after, bundle_flags, rebuild, yes, no_, no_input):
4363
+ @click.pass_context
4364
+ def install(ctx, name, version, global_scope, local_scope, editable, no_skills, activate_after, bundle_flags, rebuild, yes, no_, no_input):
4150
4365
  """
4151
4366
  Install a toolkit — from the registry or a local source directory.
4152
4367
 
@@ -4194,6 +4409,42 @@ def install(name, version, global_scope, local_scope, editable, no_skills, activ
4194
4409
 
4195
4410
  mode = _resolve_prompt_mode(yes, no_, no_input)
4196
4411
 
4412
+ # Import-file mode: ``tb install <file>.yaml`` installs every
4413
+ # toolkit the file lists — the shareable counterpart to
4414
+ # per-toolkit installs, so a project can commit e.g. toolkits.yaml
4415
+ # and a fresh machine is one command. Detected before name/path
4416
+ # disambiguation: directories (toolkit sources) keep their
4417
+ # meaning; only an existing YAML *file* triggers import.
4418
+ if name and name.lower().endswith((".yaml", ".yml")) and Path(name).is_file():
4419
+ if editable or version or bundle_flags:
4420
+ raise click.UsageError(
4421
+ "-e/--version/--bundle apply per toolkit — set them on "
4422
+ "the entries inside the import file instead."
4423
+ )
4424
+ return _install_from_import_file(
4425
+ ctx, Path(name),
4426
+ global_scope=global_scope, local_scope=local_scope,
4427
+ no_skills=no_skills, activate_after=activate_after,
4428
+ rebuild=rebuild, yes=yes, no_=no_, no_input=no_input,
4429
+ )
4430
+
4431
+ # Tarball mode: ``tb install <toolkit>.tar.gz`` installs an exported
4432
+ # package (see ``tb export``) — distribution without the registry,
4433
+ # e.g. moving a private toolkit to a server by scp.
4434
+ if name and name.lower().endswith((".tar.gz", ".tgz")) and Path(name).is_file():
4435
+ if editable:
4436
+ raise click.UsageError(
4437
+ "-e is meaningless for a tarball (nothing to live-link). "
4438
+ "Install the source directory editable instead."
4439
+ )
4440
+ return _install_from_tarball(
4441
+ ctx, Path(name), version=version,
4442
+ global_scope=global_scope, local_scope=local_scope,
4443
+ no_skills=no_skills, activate_after=activate_after,
4444
+ bundle_flags=bundle_flags, rebuild=rebuild,
4445
+ yes=yes, no_=no_, no_input=no_input,
4446
+ )
4447
+
4197
4448
  # Flag exclusivity. -e/-l/-g pick one scope/source; -g is the
4198
4449
  # default when none is given.
4199
4450
  if sum(int(b) for b in (editable, local_scope, global_scope)) > 1: