toolbase 0.4.0__tar.gz → 0.6.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 (66) hide show
  1. {toolbase-0.4.0 → toolbase-0.6.0}/PKG-INFO +31 -2
  2. {toolbase-0.4.0 → toolbase-0.6.0}/README.md +30 -1
  3. {toolbase-0.4.0 → toolbase-0.6.0}/pyproject.toml +1 -1
  4. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/__init__.py +4 -0
  5. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/_toolkit_host.py +5 -1
  6. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/cli.py +246 -30
  7. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/connect/orchestral.py +25 -4
  8. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/envs/__init__.py +2 -0
  9. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/envs/config.py +16 -1
  10. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/envs/manifest.py +25 -0
  11. toolbase-0.6.0/toolbase/naming.py +88 -0
  12. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/serve/config.py +13 -0
  13. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/serve/orchestrator.py +289 -22
  14. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/setup/declarative.py +14 -7
  15. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/setup/storage.py +16 -6
  16. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase.egg-info/SOURCES.txt +1 -0
  17. {toolbase-0.4.0 → toolbase-0.6.0}/CHANGELOG.md +0 -0
  18. {toolbase-0.4.0 → toolbase-0.6.0}/LICENSE +0 -0
  19. {toolbase-0.4.0 → toolbase-0.6.0}/MANIFEST.in +0 -0
  20. {toolbase-0.4.0 → toolbase-0.6.0}/setup.cfg +0 -0
  21. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/_setup_host.py +0 -0
  22. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/astro.py +0 -0
  23. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/auth.py +0 -0
  24. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/config.py +0 -0
  25. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/connect/__init__.py +0 -0
  26. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/connect/base.py +0 -0
  27. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/connect/claude_code.py +0 -0
  28. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/connect/codex.py +0 -0
  29. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/envs/bundle_deps.py +0 -0
  30. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/envs/cache.py +0 -0
  31. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/envs/discovery.py +0 -0
  32. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/envs/paths.py +0 -0
  33. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/envs/schema.py +0 -0
  34. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/hep.py +0 -0
  35. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/ingest.py +0 -0
  36. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/logging/__init__.py +0 -0
  37. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/logging/logger.py +0 -0
  38. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/neutrino.py +0 -0
  39. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/quantum.py +0 -0
  40. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/serve/__init__.py +0 -0
  41. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/serve/bundles.py +0 -0
  42. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/serve/profile_scaffold.py +0 -0
  43. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/serve/profiles.py +0 -0
  44. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/serve/proxy_tool.py +0 -0
  45. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/setup/__init__.py +0 -0
  46. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/setup/_rpc.py +0 -0
  47. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/setup/context.py +0 -0
  48. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/setup/downloads.py +0 -0
  49. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/setup/prompts.py +0 -0
  50. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/setup/runner.py +0 -0
  51. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/setup/schema.py +0 -0
  52. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/setup/validate_cache.py +0 -0
  53. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/skills.py +0 -0
  54. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/templates/Dockerfile.template +0 -0
  55. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/templates/README.md.template +0 -0
  56. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/templates/__init__.py.template +0 -0
  57. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/templates/mcp/__init__.py.template +0 -0
  58. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/templates/mcp/server_stdio.py.template +0 -0
  59. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/templates/requirements.txt.template +0 -0
  60. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/templates/setup.py.template +0 -0
  61. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/templates/skills/example_skill.md +0 -0
  62. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/templates/tool_example.py +0 -0
  63. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/templates/toolkit.yaml.template +0 -0
  64. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/toolkit.py +0 -0
  65. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/validation.py +0 -0
  66. {toolbase-0.4.0 → toolbase-0.6.0}/toolbase/versioning.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolbase
3
- Version: 0.4.0
3
+ Version: 0.6.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
@@ -117,6 +117,35 @@ lists what's available. Power users can keep several named profiles
117
117
  `tb connect claude-code --profile paper`) and switch between them; most
118
118
  users only ever touch the default profile.
119
119
 
120
+ Tools are served namespaced as `<toolkit>__<tool>` by default, so two active
121
+ toolkits that both define, say, an `add` tool stay distinct (`calculator__add`
122
+ vs `matrix__add`). When names do overlap, `tb serve`, `tb list -v`, and
123
+ `tb install` flag it so it's never a surprise. Prefer bare names? `tb serve
124
+ --bare` (or `default.bare: true` in `serve.yaml`) advertises the plain `<tool>`;
125
+ a name shared by two toolkits stays qualified (both remain callable) with a
126
+ warning, and the rest are served bare.
127
+
128
+ ## Share a project without sharing your machine
129
+
130
+ Toolkits that need configuration (an API key, a path to an external
131
+ binary) read it from three layers, later winning key-by-key:
132
+
133
+ | Layer | File | For |
134
+ |---|---|---|
135
+ | user | `~/.toolbase/config/<kit>.yaml` | your defaults and secrets, every project |
136
+ | project | `<repo>/.toolbase/config/<kit>.yaml` | committed, shared with the team |
137
+ | local | `<repo>/.toolbase/config/<kit>.local.yaml` | this project on *this* machine; gitignored |
138
+
139
+ ```bash
140
+ tb config set calculator precision 10 # committed
141
+ tb config set calculator solver_path /opt/bin --local # yours alone
142
+ ```
143
+
144
+ Toolkit versions split the same way: `manifest.yaml` is committed so a
145
+ collaborator who clones the project and runs `tb install` gets the same
146
+ toolkits at the same versions, while `manifest.local.yaml` holds machine-local
147
+ pins like editable installs.
148
+
120
149
  ---
121
150
 
122
151
  ## Authoring a toolkit
@@ -163,7 +192,7 @@ Full reference with all flags: <https://toolbase-ai.com/docs/reference/commands>
163
192
  | `tb disconnect HARNESS` | Remove toolbase from a harness |
164
193
  | `tb logs` | Tail the serve log, live |
165
194
  | `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` |
195
+ | `tb config …` | Manage per-toolkit config: `show \| init \| set \| unset \| edit \| path \| validate` (`--user` / `--project` / `--local` pick the layer) |
167
196
  | `tb setup TOOLKIT` | Run a toolkit's `setup.py` (`--reset`, `--check`) |
168
197
  | `tb project init` | Create `.toolbase/` here |
169
198
  | `tb init NAME` | Scaffold a toolkit from template |
@@ -76,6 +76,35 @@ lists what's available. Power users can keep several named profiles
76
76
  `tb connect claude-code --profile paper`) and switch between them; most
77
77
  users only ever touch the default profile.
78
78
 
79
+ Tools are served namespaced as `<toolkit>__<tool>` by default, so two active
80
+ toolkits that both define, say, an `add` tool stay distinct (`calculator__add`
81
+ vs `matrix__add`). When names do overlap, `tb serve`, `tb list -v`, and
82
+ `tb install` flag it so it's never a surprise. Prefer bare names? `tb serve
83
+ --bare` (or `default.bare: true` in `serve.yaml`) advertises the plain `<tool>`;
84
+ a name shared by two toolkits stays qualified (both remain callable) with a
85
+ warning, and the rest are served bare.
86
+
87
+ ## Share a project without sharing your machine
88
+
89
+ Toolkits that need configuration (an API key, a path to an external
90
+ binary) read it from three layers, later winning key-by-key:
91
+
92
+ | Layer | File | For |
93
+ |---|---|---|
94
+ | user | `~/.toolbase/config/<kit>.yaml` | your defaults and secrets, every project |
95
+ | project | `<repo>/.toolbase/config/<kit>.yaml` | committed, shared with the team |
96
+ | local | `<repo>/.toolbase/config/<kit>.local.yaml` | this project on *this* machine; gitignored |
97
+
98
+ ```bash
99
+ tb config set calculator precision 10 # committed
100
+ tb config set calculator solver_path /opt/bin --local # yours alone
101
+ ```
102
+
103
+ Toolkit versions split the same way: `manifest.yaml` is committed so a
104
+ collaborator who clones the project and runs `tb install` gets the same
105
+ toolkits at the same versions, while `manifest.local.yaml` holds machine-local
106
+ pins like editable installs.
107
+
79
108
  ---
80
109
 
81
110
  ## Authoring a toolkit
@@ -122,7 +151,7 @@ Full reference with all flags: <https://toolbase-ai.com/docs/reference/commands>
122
151
  | `tb disconnect HARNESS` | Remove toolbase from a harness |
123
152
  | `tb logs` | Tail the serve log, live |
124
153
  | `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` |
154
+ | `tb config …` | Manage per-toolkit config: `show \| init \| set \| unset \| edit \| path \| validate` (`--user` / `--project` / `--local` pick the layer) |
126
155
  | `tb setup TOOLKIT` | Run a toolkit's `setup.py` (`--reset`, `--check`) |
127
156
  | `tb project init` | Create `.toolbase/` here |
128
157
  | `tb init NAME` | Scaffold a toolkit from template |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "toolbase"
7
- version = "0.4.0"
7
+ version = "0.6.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"
@@ -22,6 +22,10 @@ except PackageNotFoundError:
22
22
 
23
23
  __author__ = "Alex Roman"
24
24
 
25
+ # The canonical tool-naming rule, public so external integrators (e.g.
26
+ # toolbench's `python:` bridge) reproduce served names without re-deriving them.
27
+ from .naming import mcp_tool_name, namespaced_tool_name, strip_tool_suffix
28
+
25
29
  # Placeholder imports for future toolkit categories
26
30
  # from .astro import aster
27
31
  # from .hep import heptapod
@@ -363,11 +363,15 @@ def _import_explicit_tools(
363
363
  # ``inspiresearch``) was a single-blob lowercase that lost
364
364
  # word boundaries — hard for the agent to parse and not
365
365
  # something the author could override per-tool.
366
+ # Resolve the wire name via the one canonical rule (toolbase.naming),
367
+ # keeping the host's precedence: toolkit.yaml display_name >
368
+ # @define_tool display_name (already on the instance) > stripped class.
369
+ from .naming import mcp_tool_name
366
370
  yaml_display = entry.get("display_name") if isinstance(entry, dict) else None
367
371
  if isinstance(yaml_display, str) and yaml_display:
368
372
  instance._mcp_display_name = yaml_display
369
373
  elif not getattr(instance, "_mcp_display_name", None):
370
- instance._mcp_display_name = attr_name.removesuffix("Tool")
374
+ instance._mcp_display_name = mcp_tool_name(attr_name)
371
375
  tools.append(instance)
372
376
  except Exception as exc:
373
377
  _emit_tool_skip(
@@ -1825,10 +1825,18 @@ def _layer_option(f):
1825
1825
  "--user", "layer_user", is_flag=True, default=False,
1826
1826
  help="Target the user layer explicitly.",
1827
1827
  )(f)
1828
+ f = click.option(
1829
+ "--local", "layer_local", is_flag=True, default=False,
1830
+ help=(
1831
+ "Target the project-LOCAL layer: config/<toolkit>.local.yaml, "
1832
+ "project-scoped but gitignored — machine truth like absolute "
1833
+ "tool paths. Wins over the committed project layer."
1834
+ ),
1835
+ )(f)
1828
1836
  f = click.option(
1829
1837
  "--layer", "layer_explicit",
1830
- type=click.Choice(["user", "project"]), default=None,
1831
- help="Target a specific config layer (alternative to --user/--project).",
1838
+ type=click.Choice(["user", "project", "local"]), default=None,
1839
+ help="Target a specific config layer (alternative to --user/--project/--local).",
1832
1840
  )(f)
1833
1841
  return f
1834
1842
 
@@ -1838,6 +1846,7 @@ def _resolve_config_layer(
1838
1846
  layer_explicit: Optional[str],
1839
1847
  layer_user: bool,
1840
1848
  layer_project: bool,
1849
+ layer_local: bool = False,
1841
1850
  default_context: str = "auto",
1842
1851
  ) -> Tuple[str, Optional[Path]]:
1843
1852
  """Resolve the per-command effective layer.
@@ -1860,9 +1869,11 @@ def _resolve_config_layer(
1860
1869
  explicit.append("user")
1861
1870
  if layer_project:
1862
1871
  explicit.append("project")
1872
+ if layer_local:
1873
+ explicit.append("local")
1863
1874
  if len(explicit) > 1:
1864
1875
  raise click.UsageError(
1865
- "--layer / --user / --project are mutually exclusive."
1876
+ "--layer / --user / --project / --local are mutually exclusive."
1866
1877
  )
1867
1878
 
1868
1879
  if explicit:
@@ -1873,16 +1884,17 @@ def _resolve_config_layer(
1873
1884
  # the user layer.
1874
1885
  return "project", _cwd_project_root()
1875
1886
 
1876
- # Explicit layer specified.
1877
- if layer == "project":
1878
- return "project", _cwd_project_root()
1887
+ # Explicit layer specified. "local" is project-scoped too — same
1888
+ # root discovery, different (gitignored) file.
1889
+ if layer in ("project", "local"):
1890
+ return layer, _cwd_project_root()
1879
1891
  return "user", None
1880
1892
 
1881
1893
 
1882
1894
  @config.command(name="path")
1883
1895
  @click.argument("toolkit_name")
1884
1896
  @_layer_option
1885
- def config_path_cmd(toolkit_name, layer_explicit, layer_user, layer_project):
1897
+ def config_path_cmd(toolkit_name, layer_explicit, layer_user, layer_project, layer_local):
1886
1898
  """Print the absolute path to a toolkit's config file.
1887
1899
 
1888
1900
  Defaults to the active layer for the current context (project layer
@@ -1894,6 +1906,7 @@ def config_path_cmd(toolkit_name, layer_explicit, layer_user, layer_project):
1894
1906
  layer, project_root = _resolve_config_layer(
1895
1907
  layer_explicit=layer_explicit,
1896
1908
  layer_user=layer_user, layer_project=layer_project,
1909
+ layer_local=layer_local,
1897
1910
  )
1898
1911
  print(_cfg_path(toolkit_name, layer=layer, project_root=project_root))
1899
1912
 
@@ -1901,7 +1914,7 @@ def config_path_cmd(toolkit_name, layer_explicit, layer_user, layer_project):
1901
1914
  @config.command(name="show")
1902
1915
  @click.argument("toolkit_name")
1903
1916
  @_layer_option
1904
- def config_show(toolkit_name, layer_explicit, layer_user, layer_project):
1917
+ def config_show(toolkit_name, layer_explicit, layer_user, layer_project, layer_local):
1905
1918
  """Show a toolkit's effective configuration.
1906
1919
 
1907
1920
  Default (no flags): merged view of user + project layers, with each
@@ -2073,7 +2086,7 @@ def config_show(toolkit_name, layer_explicit, layer_user, layer_project):
2073
2086
  @config.command(name="edit")
2074
2087
  @click.argument("toolkit_name")
2075
2088
  @_layer_option
2076
- def config_edit(toolkit_name, layer_explicit, layer_user, layer_project):
2089
+ def config_edit(toolkit_name, layer_explicit, layer_user, layer_project, layer_local):
2077
2090
  """Open the toolkit's config file in $EDITOR.
2078
2091
 
2079
2092
  Defaults to the project layer in a project context, the user layer
@@ -2096,6 +2109,7 @@ def config_edit(toolkit_name, layer_explicit, layer_user, layer_project):
2096
2109
  layer, project_root = _resolve_config_layer(
2097
2110
  layer_explicit=layer_explicit,
2098
2111
  layer_user=layer_user, layer_project=layer_project,
2112
+ layer_local=layer_local,
2099
2113
  )
2100
2114
  cfg_file = _cfg_path(
2101
2115
  toolkit_name, layer=layer, project_root=project_root,
@@ -2165,7 +2179,7 @@ def config_edit(toolkit_name, layer_explicit, layer_user, layer_project):
2165
2179
  @_layer_option
2166
2180
  def config_set(
2167
2181
  toolkit_name, key, value,
2168
- layer_explicit, layer_user, layer_project,
2182
+ layer_explicit, layer_user, layer_project, layer_local,
2169
2183
  ):
2170
2184
  """Set one config field on a toolkit (preserves other fields/comments).
2171
2185
 
@@ -2207,11 +2221,16 @@ def config_set(
2207
2221
  layer, project_root = _resolve_config_layer(
2208
2222
  layer_explicit=layer_explicit,
2209
2223
  layer_user=layer_user, layer_project=layer_project,
2224
+ layer_local=layer_local,
2210
2225
  )
2211
- set_config_value(
2226
+ cfg_written = set_config_value(
2212
2227
  toolkit_name, key, parsed,
2213
2228
  layer=layer, project_root=project_root,
2214
2229
  )
2230
+ if layer == "local":
2231
+ # config/ sits one level below .toolbase/ — keep the local
2232
+ # layer out of git the same way editable pins are.
2233
+ _ensure_toolbase_gitignore(cfg_written.parent.parent)
2215
2234
  cfg_file = _cfg_path(
2216
2235
  toolkit_name, layer=layer, project_root=project_root,
2217
2236
  )
@@ -2227,7 +2246,7 @@ def config_set(
2227
2246
  @_layer_option
2228
2247
  def config_unset(
2229
2248
  toolkit_name, key,
2230
- layer_explicit, layer_user, layer_project,
2249
+ layer_explicit, layer_user, layer_project, layer_local,
2231
2250
  ):
2232
2251
  """Remove one config field from a toolkit's config file.
2233
2252
 
@@ -2239,6 +2258,7 @@ def config_unset(
2239
2258
  layer, project_root = _resolve_config_layer(
2240
2259
  layer_explicit=layer_explicit,
2241
2260
  layer_user=layer_user, layer_project=layer_project,
2261
+ layer_local=layer_local,
2242
2262
  )
2243
2263
  removed = unset_config_value(
2244
2264
  toolkit_name, key, layer=layer, project_root=project_root,
@@ -2329,7 +2349,7 @@ def _render_config_scaffold(toolkit_name: str, schema, source_path: Path) -> str
2329
2349
  help="Overwrite an existing config file.",
2330
2350
  )
2331
2351
  def config_init(
2332
- toolkit_name, layer_explicit, layer_user, layer_project, force,
2352
+ toolkit_name, layer_explicit, layer_user, layer_project, layer_local, force,
2333
2353
  ):
2334
2354
  """Scaffold a commented YAML config file from the toolkit's ``config:`` schema.
2335
2355
 
@@ -2359,6 +2379,7 @@ def config_init(
2359
2379
  layer, project_root = _resolve_config_layer(
2360
2380
  layer_explicit=layer_explicit,
2361
2381
  layer_user=layer_user, layer_project=layer_project,
2382
+ layer_local=layer_local,
2362
2383
  )
2363
2384
  out_path = _cfg_path(
2364
2385
  toolkit_name, layer=layer, project_root=project_root,
@@ -3480,6 +3501,58 @@ def _pin_after_install(
3480
3501
  )
3481
3502
 
3482
3503
 
3504
+ def _ensure_toolbase_gitignore(tb_dir: Path) -> None:
3505
+ """Drop the canonical .toolbase/.gitignore if none exists.
3506
+
3507
+ Covers both machine-local layers (pins and config). Created only
3508
+ when absent — an existing file is the user's to manage.
3509
+ """
3510
+ gitignore = tb_dir / ".gitignore"
3511
+ if not gitignore.exists():
3512
+ gitignore.write_text("manifest.local.yaml\nconfig/*.local.yaml\n")
3513
+
3514
+
3515
+ def _pin_editable_local(name: str, *, local_scope: bool) -> None:
3516
+ """Pin (name, "editable") into the machine-local manifest layer.
3517
+
3518
+ Writes ``manifest.local.yaml`` next to the scoped project's
3519
+ committed manifest and drops a ``.gitignore`` into ``.toolbase/``
3520
+ (created only if absent) so the local layer never reaches git.
3521
+ Best-effort like _pin_after_install: a failure warns, the install
3522
+ stands.
3523
+ """
3524
+ try:
3525
+ from .envs import (
3526
+ project_manifest_path as _project_manifest_path,
3527
+ local_manifest_path as _local_manifest_path,
3528
+ add_pin as _add_pin,
3529
+ default_project_root as _default_project_root,
3530
+ )
3531
+ if local_scope:
3532
+ from .envs import find_project_root as _find_project_root
3533
+ found = _find_project_root(cwd=Path.cwd())
3534
+ if found is None:
3535
+ project_root = Path.cwd().resolve()
3536
+ _materialize_project_dir(project_root)
3537
+ else:
3538
+ project_root = found
3539
+ else:
3540
+ project_root = _default_project_root()
3541
+ local_path = _local_manifest_path(_project_manifest_path(project_root))
3542
+ _add_pin(local_path, name, "editable")
3543
+ _ensure_toolbase_gitignore(local_path.parent)
3544
+ console.print(
3545
+ f"[dim]Pinned editable in {local_path.name} "
3546
+ f"(machine-local, gitignored).[/dim]"
3547
+ )
3548
+ except Exception as e:
3549
+ console.print(
3550
+ f"[dim]Note: could not write the local editable pin: {e} — "
3551
+ f"without it, numbered slots outrank this checkout.[/dim]"
3552
+ )
3553
+
3554
+
3555
+
3483
3556
  def _install_from_path(
3484
3557
  source_path: Path,
3485
3558
  *,
@@ -3829,6 +3902,7 @@ def _install_from_path(
3829
3902
  f"\n[bold green]✓ Successfully installed {name} "
3830
3903
  f"{'(editable)' if editable else 'v' + version}[/bold green]\n"
3831
3904
  )
3905
+ _warn_install_name_collisions(name)
3832
3906
  if editable:
3833
3907
  console.print(f"Source: [cyan]{source_path}[/cyan] (live link)")
3834
3908
  console.print(
@@ -3861,10 +3935,12 @@ def _install_from_path(
3861
3935
  ),
3862
3936
  )
3863
3937
  else:
3864
- console.print(
3865
- "[dim]Editable installs are not pinned into the project "
3866
- "manifest (the path is machine-specific).[/dim]"
3867
- )
3938
+ # Editable pins are machine state (they point at THIS machine's
3939
+ # source checkout), so they go to the gitignored local layer —
3940
+ # never the committed manifest. Without a pin the editable slot
3941
+ # would lose version resolution to any numbered slot and the
3942
+ # checkout would silently not serve.
3943
+ _pin_editable_local(name, local_scope=local_scope)
3868
3944
 
3869
3945
  console.print(f"\n[bold]Ready to use! Try:[/bold]")
3870
3946
  console.print(f" [cyan]tb activate {name}[/cyan] # expose it to the agent")
@@ -4891,6 +4967,7 @@ def install(ctx, name, version, global_scope, local_scope, editable, no_skills,
4891
4967
 
4892
4968
  # Step 9: Success message
4893
4969
  console.print(f"\n[bold green]✓ Successfully installed {name} v{version}[/bold green]\n")
4970
+ _warn_install_name_collisions(name)
4894
4971
 
4895
4972
  if activate_after:
4896
4973
  _post_install_activate(
@@ -5147,6 +5224,10 @@ def list_cmd(as_json, verbose):
5147
5224
  # Resolve the active profile to mark which toolkits are active (served).
5148
5225
  # Best-effort: no active profile => everything inactive, no error.
5149
5226
  resolved_profile, active_set = _list_resolve_active()
5227
+ # Tool names shared by >1 active toolkit — annotated per row under -v so
5228
+ # overlap (harmless while namespaced, a clash if ever served bare) is
5229
+ # visible. Only meaningful with an active multi-toolkit profile.
5230
+ _name_collisions = _active_name_collisions(active_set) if verbose else {}
5150
5231
  active_profile = resolved_profile.name if resolved_profile is not None else None
5151
5232
 
5152
5233
  if as_json:
@@ -5244,8 +5325,23 @@ def list_cmd(as_json, verbose):
5244
5325
  f"[dim](used {last_used}, {size})[/dim]"
5245
5326
  f"{subset_tag}"
5246
5327
  )
5328
+ # Editable-shadow warning: a live-linked checkout exists but
5329
+ # resolution picks a numbered slot — the developer's code is
5330
+ # not what serves. Same condition as discovery's shadow_note.
5331
+ selected = pin_map.get(name) or (
5332
+ max((e.version for e in grouped[name]),
5333
+ key=lambda v: parse_version(v) or (0, 0, 0))
5334
+ if len(grouped[name]) > 1 else grouped[name][0].version
5335
+ )
5336
+ has_editable = any(e.version == "editable" for e in grouped[name])
5337
+ if has_editable and selected != "editable":
5338
+ console.print(
5339
+ " [yellow]⚠ editable slot shadowed by "
5340
+ f"{selected} — pin 'editable' in "
5341
+ ".toolbase/manifest.local.yaml to serve your checkout[/yellow]"
5342
+ )
5247
5343
  if verbose:
5248
- _list_print_tools_verbose(name, resolved_profile)
5344
+ _list_print_tools_verbose(name, resolved_profile, _name_collisions)
5249
5345
 
5250
5346
  if any_pin_applied and manifest_path is not None:
5251
5347
  # Render the manifest path relative to cwd when possible — keeps
@@ -5283,7 +5379,68 @@ def _list_resolve_active():
5283
5379
  return resolved, active
5284
5380
 
5285
5381
 
5286
- def _list_print_tools_verbose(name, resolved_profile) -> None:
5382
+ def _toolkit_declared_tool_names(name: str) -> set:
5383
+ """Bare tool names a toolkit declares in its ``toolkit.yaml`` (empty for
5384
+ implicit-form toolkits that don't enumerate tools there)."""
5385
+ from .serve.orchestrator import (
5386
+ discover_toolkits, _resolve_bundle_availability,
5387
+ )
5388
+ disc = next(
5389
+ (d for d in discover_toolkits()
5390
+ if d.name == name and d.skip_reason is None),
5391
+ None,
5392
+ )
5393
+ if disc is None:
5394
+ return set()
5395
+ _availability, name_to_bundles = _resolve_bundle_availability(disc)
5396
+ return set(name_to_bundles or {})
5397
+
5398
+
5399
+ def _active_name_collisions(active_toolkit_names) -> dict:
5400
+ """``{bare_name: [toolkits]}`` for tool names declared by more than one of
5401
+ the given (active) toolkits — the ``tb list -v`` / ``tb install`` view of
5402
+ :func:`toolbase.naming.find_name_collisions`."""
5403
+ from .naming import find_name_collisions
5404
+ return find_name_collisions(
5405
+ {tk: _toolkit_declared_tool_names(tk) for tk in active_toolkit_names}
5406
+ )
5407
+
5408
+
5409
+ def _warn_install_name_collisions(new_toolkit: str) -> None:
5410
+ """After an install, warn if the toolkit shares any bare tool name with an
5411
+ already-active toolkit (a clash only if ever served un-namespaced; harmless
5412
+ under the default ``<toolkit>__<tool>`` form). Best-effort — never raises,
5413
+ never blocks the install."""
5414
+ try:
5415
+ _resolved, active = _list_resolve_active()
5416
+ others = {tk for tk in active if tk != new_toolkit}
5417
+ new_tools = _toolkit_declared_tool_names(new_toolkit)
5418
+ if not others or not new_tools:
5419
+ return
5420
+ overlaps = {}
5421
+ for tk in others:
5422
+ shared = sorted(new_tools & _toolkit_declared_tool_names(tk))
5423
+ if shared:
5424
+ overlaps[tk] = shared
5425
+ if not overlaps:
5426
+ return
5427
+ console.print(
5428
+ f"\n[yellow]⚠ {new_toolkit} shares tool name(s) with active "
5429
+ "toolkit(s):[/yellow]"
5430
+ )
5431
+ for tk, shared in sorted(overlaps.items()):
5432
+ console.print(f" [dim]{', '.join(shared)} — also in {tk}[/dim]")
5433
+ console.print(
5434
+ " [dim]Served distinctly as <toolkit>__<tool>, so this is only a "
5435
+ "clash if tools are served un-namespaced. To pre-empt it: set a "
5436
+ "toolkit.yaml display_name:, tb deactivate one, or keep the "
5437
+ "namespaced default.[/dim]"
5438
+ )
5439
+ except Exception:
5440
+ pass # a heads-up must never break install
5441
+
5442
+
5443
+ def _list_print_tools_verbose(name, resolved_profile, collisions=None) -> None:
5287
5444
  """Print a toolkit's declared tools with served/hidden status.
5288
5445
 
5289
5446
  Tool list comes from the toolkit.yaml declaration (explicit form);
@@ -5373,7 +5530,11 @@ def _list_print_tools_verbose(name, resolved_profile) -> None:
5373
5530
  f" [yellow](needs config: "
5374
5531
  f"{'; '.join(missing_per_bundle)})[/yellow]"
5375
5532
  )
5376
- console.print(f" {mk} {tool}{btag}{gate}")
5533
+ clash = ""
5534
+ others = [tk for tk in (collisions or {}).get(tool, []) if tk != name]
5535
+ if others:
5536
+ clash = f" [yellow](also in: {', '.join(others)})[/yellow]"
5537
+ console.print(f" {mk} {tool}{btag}{gate}{clash}")
5377
5538
 
5378
5539
  if install_gated:
5379
5540
  if len(install_gated) >= _VERBOSE_INSTALL_GATED_COLLAPSE_THRESHOLD:
@@ -5428,14 +5589,19 @@ def _list_resolve_pin_map(entries):
5428
5589
  load_manifest as _load_manifest,
5429
5590
  )
5430
5591
  project_root, _source = _resolve_active_project_root()
5592
+ from .envs import (
5593
+ load_merged_pins as _load_merged_pins,
5594
+ local_manifest_path as _local_manifest_path,
5595
+ )
5431
5596
  manifest_path = _project_manifest_path(project_root)
5432
- if not manifest_path.exists():
5597
+ if (not manifest_path.exists()
5598
+ and not _local_manifest_path(manifest_path).exists()):
5433
5599
  return {}, None
5434
- manifest = _load_manifest(manifest_path)
5435
- return (
5436
- {e.name: e.version for e in manifest.toolkits},
5437
- manifest_path,
5438
- )
5600
+ # Merged view: committed manifest + machine-local layer
5601
+ # (manifest.local.yaml), local wins — the same resolution
5602
+ # discover_toolkits uses, so the * markers never disagree
5603
+ # with what actually serves.
5604
+ return _load_merged_pins(manifest_path), manifest_path
5439
5605
  except Exception:
5440
5606
  # Manifest read errors (schema-too-new, malformed) shouldn't
5441
5607
  # break list. Skip the pin indicator and proceed.
@@ -5633,11 +5799,36 @@ def uninstall(name, yes, no_, no_input):
5633
5799
  # we silently fall back to default-project (which is where ``install``
5634
5800
  # would have pinned in the no-project case anyway).
5635
5801
  try:
5802
+ from .envs import (
5803
+ local_manifest_path as _local_manifest_path,
5804
+ load_manifest as _load_manifest_for_pins,
5805
+ )
5636
5806
  project_root, _source = _resolve_active_project_root()
5637
5807
  manifest_path = _project_manifest_path(project_root)
5808
+ local_path = _local_manifest_path(manifest_path)
5638
5809
  remaining = _list_versions(name)
5639
5810
  if not remaining:
5640
5811
  _remove_pin(manifest_path, name)
5812
+ _remove_pin(local_path, name)
5813
+ else:
5814
+ # Some versions remain. If a pin (committed or local layer)
5815
+ # still names a version we just removed, it now dangles —
5816
+ # serving would SKIP the toolkit entirely ("pinned version
5817
+ # not in cache") even though usable slots exist. Remove the
5818
+ # stale pin loudly; unpinned resolution falls back to the
5819
+ # highest remaining slot.
5820
+ for layer in (manifest_path, local_path):
5821
+ pins = {e.name: e.version
5822
+ for e in _load_manifest_for_pins(layer).toolkits}
5823
+ pinned = pins.get(name)
5824
+ if pinned is not None and pinned not in remaining:
5825
+ _remove_pin(layer, name)
5826
+ console.print(
5827
+ f"[yellow]⚠ Removed stale pin {name}@{pinned} from "
5828
+ f"{layer.name} (slot uninstalled; remaining: "
5829
+ f"{', '.join(remaining)}). Re-pin with "
5830
+ f"`tb install {name}@<version> -l` if needed.[/yellow]"
5831
+ )
5641
5832
  except Exception as e:
5642
5833
  console.print(
5643
5834
  f"[dim]Note: could not update project manifest: {e}[/dim]"
@@ -5915,8 +6106,17 @@ def toolbase_config_dir() -> Path:
5915
6106
  '--no-tui', is_flag=True, default=True,
5916
6107
  help='Run without TUI. Currently the only supported mode.',
5917
6108
  )
6109
+ @click.option(
6110
+ '--bare/--qualified', 'bare_flag', default=None,
6111
+ help=(
6112
+ 'Advertise tools un-namespaced (<tool>) instead of the default '
6113
+ 'qualified <toolkit>__<tool>. Overrides serve.yaml default.bare for '
6114
+ 'this invocation. A name shared by two toolkits stays qualified (both '
6115
+ 'callable) with a warning; the rest are served bare.'
6116
+ ),
6117
+ )
5918
6118
  @click.pass_context
5919
- def serve(ctx, profile_name, dry_run, call_timeout, no_tui):
6119
+ def serve(ctx, profile_name, dry_run, call_timeout, no_tui, bare_flag):
5920
6120
  """
5921
6121
  Start the MCP server for the active profile's tools.
5922
6122
 
@@ -5973,8 +6173,18 @@ def serve(ctx, profile_name, dry_run, call_timeout, no_tui):
5973
6173
  console.print(f"[red]Error in serve config:[/red] {e}")
5974
6174
  sys.exit(1)
5975
6175
 
6176
+ # Bare naming: explicit --bare/--qualified wins; else serve.yaml default.bare.
6177
+ if bare_flag is not None:
6178
+ bare = bare_flag
6179
+ else:
6180
+ from .serve.profiles import load_merged_serve_config
6181
+ try:
6182
+ bare = load_merged_serve_config(project_root).default.bare
6183
+ except ServeConfigError:
6184
+ bare = False
6185
+
5976
6186
  if dry_run:
5977
- _print_resolution(profile)
6187
+ _print_resolution(profile, bare=bare)
5978
6188
  return
5979
6189
 
5980
6190
  # The MCP stdio protocol owns this process's stdin/stdout, so we do NOT
@@ -5982,11 +6192,12 @@ def serve(ctx, profile_name, dry_run, call_timeout, no_tui):
5982
6192
  # orchestrator builds its own stderr-bound Console.
5983
6193
  from .serve.orchestrator import DEFAULT_CALL_TIMEOUT_S, serve as _serve_entry
5984
6194
  timeout_s = call_timeout if call_timeout is not None else DEFAULT_CALL_TIMEOUT_S
5985
- rc = _serve_entry(no_tui=True, profile=profile, call_timeout_s=timeout_s)
6195
+ rc = _serve_entry(no_tui=True, profile=profile, call_timeout_s=timeout_s,
6196
+ bare=bare)
5986
6197
  sys.exit(rc)
5987
6198
 
5988
6199
 
5989
- def _print_resolution(profile) -> None:
6200
+ def _print_resolution(profile, bare: bool = False) -> None:
5990
6201
  """Render --dry-run output: the active profile and what it selects.
5991
6202
 
5992
6203
  Shows the profile name + provenance, each selected toolkit and its
@@ -5999,6 +6210,11 @@ def _print_resolution(profile) -> None:
5999
6210
  f"\n[bold]Active profile:[/bold] [cyan]{profile.name}[/cyan] "
6000
6211
  f"[dim]({profile.source})[/dim]"
6001
6212
  )
6213
+ console.print(
6214
+ f"[bold]Naming:[/bold] "
6215
+ + ("[yellow]bare <tool>[/yellow] (un-namespaced)" if bare
6216
+ else "qualified [cyan]<toolkit>__<tool>[/cyan]")
6217
+ )
6002
6218
  if not profile.toolkits:
6003
6219
  console.print(" [dim](profile selects no toolkits)[/dim]")
6004
6220
  for tk, sel in profile.toolkits.items():