Skip to content

Commit 51c7063

Browse files
committed
Promote _rewrite_project_relative_paths to public API
Rename CommandRegistrar._rewrite_project_relative_paths() to rewrite_project_relative_paths() (drop leading underscore) so integrations can call it without reaching into a private method across subsystem boundaries. Addresses PR review feedback: #2038 (comment)
1 parent 9a2cb8f commit 51c7063

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/specify_cli/agents.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,11 @@ def _adjust_script_paths(self, frontmatter: dict) -> dict:
241241

242242
for key, script_path in scripts.items():
243243
if isinstance(script_path, str):
244-
scripts[key] = self._rewrite_project_relative_paths(script_path)
244+
scripts[key] = self.rewrite_project_relative_paths(script_path)
245245
return frontmatter
246246

247247
@staticmethod
248-
def _rewrite_project_relative_paths(text: str) -> str:
248+
def rewrite_project_relative_paths(text: str) -> str:
249249
"""Rewrite repo-relative paths to their generated project locations."""
250250
if not isinstance(text, str) or not text:
251251
return text
@@ -428,7 +428,7 @@ def resolve_skill_placeholders(agent_name: str, frontmatter: dict, body: str, pr
428428
body = body.replace("{AGENT_SCRIPT}", agent_script_command)
429429

430430
body = body.replace("{ARGS}", "$ARGUMENTS").replace("__AGENT__", agent_name)
431-
return CommandRegistrar._rewrite_project_relative_paths(body)
431+
return CommandRegistrar.rewrite_project_relative_paths(body)
432432

433433
def _convert_argument_placeholder(self, content: str, from_placeholder: str, to_placeholder: str) -> str:
434434
"""Convert argument placeholder format.

src/specify_cli/integrations/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def process_template(
350350
# CommandRegistrar so extension-local paths are preserved and
351351
# boundary rules stay consistent across the codebase.
352352
from specify_cli.agents import CommandRegistrar
353-
content = CommandRegistrar._rewrite_project_relative_paths(content)
353+
content = CommandRegistrar.rewrite_project_relative_paths(content)
354354

355355
return content
356356

tests/test_extensions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ def test_rewrite_project_relative_paths_preserves_extension_local_body_paths(sel
981981
"Run scripts/bash/setup-plan.sh\n"
982982
)
983983

984-
rewritten = AgentCommandRegistrar._rewrite_project_relative_paths(body)
984+
rewritten = AgentCommandRegistrar.rewrite_project_relative_paths(body)
985985

986986
assert ".specify/extensions/test-ext/templates/spec.md" in rewritten
987987
assert ".specify/scripts/bash/setup-plan.sh" in rewritten

0 commit comments

Comments
 (0)