109109 skill_locations_for_client ,
110110)
111111from ucode .skills_download import (
112+ configure_location_skills_download_command ,
112113 configure_selected_skills_download_command ,
113- configure_skills_download_command ,
114114 configure_skills_download_picker_command ,
115115 download_managed_skills_on_launch ,
116116)
@@ -359,26 +359,6 @@ def _is_qualified_skill_name(name: str) -> bool:
359359 return len (parts ) == 3 and all (part and part == part .strip () for part in parts )
360360
361361
362- def _download_selected_skills_route (
363- requested_skills : set [str ], location : str | None , path : str | None , * , flag : str
364- ) -> None :
365- """Download the fully-qualified `requested_skills` (cross-schema) and register.
366-
367- The `--skills`/`--skill` download path: names must be fully qualified so a
368- selection can span schemas without a `--location`, so passing one is an error
369- and any bare/malformed name is rejected up front. `flag` names the option in
370- those errors. Empty selections download nothing."""
371- if location is not None :
372- raise RuntimeError (f"{ flag } takes fully-qualified names; drop --location." )
373- invalid = sorted (name for name in requested_skills if not _is_qualified_skill_name (name ))
374- if invalid :
375- raise RuntimeError (
376- f"{ flag } entries must be fully-qualified `<catalog>.<schema>.<name>` names "
377- f"(invalid: { ', ' .join (invalid )} )."
378- )
379- configure_selected_skills_download_command (sorted (requested_skills ), path )
380-
381-
382362def _parse_workspaces_option (workspaces : str ) -> list [tuple [str , str | None ]]:
383363 """Parse `--workspaces` into [(url, profile_name | None), ...].
384364
@@ -1343,11 +1323,19 @@ def skills_add(
13431323 raise RuntimeError ("--path is not supported when using --mcp" )
13441324 if mcp and requested_skills is not None :
13451325 raise RuntimeError ("--skills is not supported when using --mcp" )
1326+ if requested_skills is not None and location is not None :
1327+ raise RuntimeError ("--skills takes fully-qualified names; drop --location." )
13461328 # Downloaded skills use shared directory families, so only MCP scopes can be agent-scoped.
13471329 if not mcp and agents is not None :
13481330 raise RuntimeError ("--agents is only supported when using --mcp" )
13491331 if requested_skills is not None :
1350- _download_selected_skills_route (requested_skills , location , path , flag = "--skills" )
1332+ invalid = sorted (s for s in requested_skills if not _is_qualified_skill_name (s ))
1333+ if invalid :
1334+ raise RuntimeError (
1335+ "--skills entries must be fully-qualified `<catalog>.<schema>.<name>` names "
1336+ f"(invalid: { ', ' .join (invalid )} )."
1337+ )
1338+ configure_selected_skills_download_command (sorted (requested_skills ), path )
13511339 return
13521340 locations = _parse_skill_locations (location )
13531341 if not locations :
@@ -1361,7 +1349,7 @@ def skills_add(
13611349 )
13621350 add_skills_command (locations , agents = scope )
13631351 else :
1364- configure_skills_download_command (locations , path = path )
1352+ configure_location_skills_download_command (locations , path = path )
13651353 except (RuntimeError , ValueError ) as exc :
13661354 print_err (str (exc ))
13671355 raise typer .Exit (1 ) from None
@@ -3237,16 +3225,24 @@ def configure_skills(
32373225 raise RuntimeError ("--path is not valid with --mcp." )
32383226 if mcp and selected_skills is not None :
32393227 raise RuntimeError ("--skill is not valid with --mcp; it only applies when downloading." )
3228+ if selected_skills is not None and location is not None :
3229+ raise RuntimeError ("--skill takes fully-qualified names; drop --location." )
32403230 if selected_skills is not None :
3241- _download_selected_skills_route (selected_skills , location , path , flag = "--skill" )
3231+ invalid = sorted (s for s in selected_skills if not _is_qualified_skill_name (s ))
3232+ if invalid :
3233+ raise RuntimeError (
3234+ "--skill entries must be fully-qualified `<catalog>.<schema>.<name>` names "
3235+ f"(invalid: { ', ' .join (invalid )} )."
3236+ )
3237+ configure_selected_skills_download_command (sorted (selected_skills ), path )
32423238 return
32433239 locations = _parse_skill_locations (location )
32443240 if path is not None and not locations :
32453241 raise RuntimeError ("--path only applies when downloading with --location." )
32463242 if mcp or not locations :
32473243 configure_skills_mcp_command (locations )
32483244 else :
3249- configure_skills_download_command (locations , path = path )
3245+ configure_location_skills_download_command (locations , path = path )
32503246 except (RuntimeError , ValueError ) as exc :
32513247 print_err (str (exc ))
32523248 raise typer .Exit (1 ) from None
0 commit comments