Skip to content

Commit 9a2cb8f

Browse files
committed
Reuse CommandRegistrar path rewriting in process_template()
Replace the duplicated regex-based path rewriting in MarkdownIntegration.process_template() with a call to the shared CommandRegistrar._rewrite_project_relative_paths() implementation. This ensures extension-local paths are preserved and boundary rules stay consistent across the codebase.
1 parent 260f76e commit 9a2cb8f

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

  • src/specify_cli/integrations

src/specify_cli/integrations/base.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,11 @@ def process_template(
346346
# 6. Replace __AGENT__
347347
content = content.replace("__AGENT__", agent_name)
348348

349-
# 7. Rewrite paths (matches release script's rewrite_paths())
350-
content = re.sub(r"(/?)memory/", r".specify/memory/", content)
351-
content = re.sub(r"(/?)scripts/", r".specify/scripts/", content)
352-
content = re.sub(r"(/?)templates/", r".specify/templates/", content)
353-
# Fix double-prefix (same as release script's .specify.specify/ fix)
354-
content = content.replace(".specify.specify/", ".specify/")
355-
content = content.replace(".specify/.specify/", ".specify/")
349+
# 7. Rewrite paths — delegate to the shared implementation in
350+
# CommandRegistrar so extension-local paths are preserved and
351+
# boundary rules stay consistent across the codebase.
352+
from specify_cli.agents import CommandRegistrar
353+
content = CommandRegistrar._rewrite_project_relative_paths(content)
356354

357355
return content
358356

0 commit comments

Comments
 (0)