toolbase 0.3.0__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 (65) hide show
  1. {toolbase-0.3.0 → toolbase-0.4.0}/PKG-INFO +1 -1
  2. {toolbase-0.3.0 → toolbase-0.4.0}/pyproject.toml +1 -1
  3. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/cli.py +252 -1
  4. {toolbase-0.3.0 → toolbase-0.4.0}/CHANGELOG.md +0 -0
  5. {toolbase-0.3.0 → toolbase-0.4.0}/LICENSE +0 -0
  6. {toolbase-0.3.0 → toolbase-0.4.0}/MANIFEST.in +0 -0
  7. {toolbase-0.3.0 → toolbase-0.4.0}/README.md +0 -0
  8. {toolbase-0.3.0 → toolbase-0.4.0}/setup.cfg +0 -0
  9. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/__init__.py +0 -0
  10. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/_setup_host.py +0 -0
  11. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/_toolkit_host.py +0 -0
  12. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/astro.py +0 -0
  13. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/auth.py +0 -0
  14. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/config.py +0 -0
  15. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/connect/__init__.py +0 -0
  16. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/connect/base.py +0 -0
  17. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/connect/claude_code.py +0 -0
  18. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/connect/codex.py +0 -0
  19. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/connect/orchestral.py +0 -0
  20. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/envs/__init__.py +0 -0
  21. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/envs/bundle_deps.py +0 -0
  22. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/envs/cache.py +0 -0
  23. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/envs/config.py +0 -0
  24. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/envs/discovery.py +0 -0
  25. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/envs/manifest.py +0 -0
  26. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/envs/paths.py +0 -0
  27. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/envs/schema.py +0 -0
  28. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/hep.py +0 -0
  29. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/ingest.py +0 -0
  30. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/logging/__init__.py +0 -0
  31. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/logging/logger.py +0 -0
  32. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/neutrino.py +0 -0
  33. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/quantum.py +0 -0
  34. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/serve/__init__.py +0 -0
  35. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/serve/bundles.py +0 -0
  36. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/serve/config.py +0 -0
  37. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/serve/orchestrator.py +0 -0
  38. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/serve/profile_scaffold.py +0 -0
  39. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/serve/profiles.py +0 -0
  40. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/serve/proxy_tool.py +0 -0
  41. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/setup/__init__.py +0 -0
  42. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/setup/_rpc.py +0 -0
  43. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/setup/context.py +0 -0
  44. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/setup/declarative.py +0 -0
  45. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/setup/downloads.py +0 -0
  46. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/setup/prompts.py +0 -0
  47. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/setup/runner.py +0 -0
  48. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/setup/schema.py +0 -0
  49. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/setup/storage.py +0 -0
  50. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/setup/validate_cache.py +0 -0
  51. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/skills.py +0 -0
  52. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/templates/Dockerfile.template +0 -0
  53. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/templates/README.md.template +0 -0
  54. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/templates/__init__.py.template +0 -0
  55. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/templates/mcp/__init__.py.template +0 -0
  56. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/templates/mcp/server_stdio.py.template +0 -0
  57. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/templates/requirements.txt.template +0 -0
  58. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/templates/setup.py.template +0 -0
  59. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/templates/skills/example_skill.md +0 -0
  60. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/templates/tool_example.py +0 -0
  61. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/templates/toolkit.yaml.template +0 -0
  62. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/toolkit.py +0 -0
  63. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/validation.py +0 -0
  64. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase/versioning.py +0 -0
  65. {toolbase-0.3.0 → toolbase-0.4.0}/toolbase.egg-info/SOURCES.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolbase
3
- Version: 0.3.0
3
+ Version: 0.4.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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "toolbase"
7
- version = "0.3.0"
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:
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