Skip to content

refactor(no-ticket): extract shared templates.render() from webserver - #329

Merged
cloudsmith-iduffy merged 2 commits into
masterfrom
iduffy/templates-render
Jul 31, 2026
Merged

refactor(no-ticket): extract shared templates.render() from webserver#329
cloudsmith-iduffy merged 2 commits into
masterfrom
iduffy/templates-render

Conversation

@cloudsmith-iduffy

@cloudsmith-iduffy cloudsmith-iduffy commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description

Prep refactor split out of #314 (stacked: this PR merges first).

Moves the placeholder-based template renderer out of cloudsmith_cli/cli/webserver.py into the templates package as a shared templates.render() (+ template_path()), so non-HTML callers — the Maven credential helper in #314 renders its settings.xml with it — can reuse it. webserver.py keeps thin wrappers delegating to the new functions; rendering behavior is unchanged (<!-- KEY_PLACEHOLDER --> substitution, empty string for falsy values).

No functional changes intended; existing webserver/login tests cover the moved code paths.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe)

🤖 Generated with Claude Code

Move the placeholder-based template renderer from cloudsmith_cli/cli/webserver.py
into the templates package so other callers (upcoming Maven credential helper)
can reuse it. webserver keeps thin wrappers; behavior is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudsmith-iduffy cloudsmith-iduffy changed the title iduffy/templates render refactor(no-ticket): extract shared templates.render() from webserver Jul 30, 2026
@cloudsmith-iduffy
cloudsmith-iduffy marked this pull request as ready for review July 30, 2026 21:22
@cloudsmith-iduffy
cloudsmith-iduffy requested a review from a team as a code owner July 30, 2026 21:22
Copilot AI review requested due to automatic review settings July 30, 2026 21:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the CLI’s placeholder-based template rendering logic out of cloudsmith_cli/cli/webserver.py into the cloudsmith_cli.templates package so it can be reused by non-webserver callers while preserving existing rendering semantics.

Changes:

  • Added shared templates.template_path() and templates.render() helpers to centralize placeholder substitution.
  • Updated cli/webserver.py template helpers to delegate to the shared templates package (removing duplicated renderer logic).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cloudsmith_cli/templates/init.py Introduces shared template path resolution and placeholder-based rendering utilities.
cloudsmith_cli/cli/webserver.py Replaces in-module template rendering/path logic with thin wrappers around cloudsmith_cli.templates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cloudsmith_cli/cli/webserver.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@cloudsmith-iduffy
cloudsmith-iduffy merged commit ff39a18 into master Jul 31, 2026
26 checks passed
@cloudsmith-iduffy
cloudsmith-iduffy deleted the iduffy/templates-render branch July 31, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants