Feature: Add CLI list-templates Command Closes #31 - #62
Feature: Add CLI list-templates Command Closes #31#62IvantheGreatMaker wants to merge 2 commits into
Closes #31#62Conversation
Adds new Feature: Add CLI list-templates Command cloudengine-labs#31
chefgs
left a comment
There was a problem hiding this comment.
@IvantheGreatMaker
One suggestion is to add the new list command under the Quick Start Commands section in root README.md file.
# ── List templates ──────────────────────────────────────────────────────────
python -m cli.devopsos list # → Displays list of available templates
|
Hello @IvantheGreatMaker - Thank you for picking up the issue and raising a PR. Glad you have followed the PR template, which helped us to review the code quickly. Please address the review comment, I've added in the code. |
There was a problem hiding this comment.
Pull request overview
This PR adds a new top-level CLI command (python -m cli.devopsos list) that prints the available scaffold templates grouped by category, based on per-scaffold TEMPLATE_INFO metadata.
Changes:
- Added
TEMPLATE_INFOmetadata to scaffold modules so templates can be discovered and categorized. - Added
_collect_templates()and a newlistcommand incli/devopsos.pyto render grouped template output. - Added CLI tests to validate the new command and its presence in help output.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/devopsos.py | Adds template collection + new list command rendering grouped templates. |
| cli/test_cli.py | Adds tests for list command output and help presence. |
| cli/scaffold_gha.py | Adds TEMPLATE_INFO for the GitHub Actions scaffold. |
| cli/scaffold_gitlab.py | Adds TEMPLATE_INFO for the GitLab CI scaffold. |
| cli/scaffold_jenkins.py | Adds TEMPLATE_INFO for the Jenkins scaffold. |
| cli/scaffold_cicd.py | Adds TEMPLATE_INFO for the combined CI/CD scaffold. |
| cli/scaffold_argocd.py | Adds TEMPLATE_INFO for the GitOps scaffold. |
| cli/scaffold_sre.py | Adds TEMPLATE_INFO for the SRE scaffold. |
| cli/scaffold_unittest.py | Adds TEMPLATE_INFO for the unit test scaffold. |
| cli/scaffold_devcontainer.py | Adds TEMPLATE_INFO for the devcontainer scaffold. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for t in items: | ||
| name = t["name"].ljust(14) | ||
| desc = t["description"] | ||
| typer.echo(f" {name} {desc}") |
| result = _run_module("cli.devopsos", ["--help"]) | ||
| assert result.returncode == 0 | ||
| assert "list" in result.stdout |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
cli/test_cli.py:46
test_list_in_helpasserts against raw help output without stripping ANSI codes (unlike other help-related tests in this file) and the substring check is fairly weak. Stripping ANSI and using a multiline regex makes the test more consistent and less flaky.
result = _run_module("cli.devopsos", ["--help"])
assert result.returncode == 0
assert "list" in result.stdout
cli/devopsos.py:915
list_templates()assumes every discoveredTEMPLATE_INFOdict has "name" and "description" keys and will raise aKeyErrorif a module provides an incomplete dict. Since discovery is dynamic, it’s safer to tolerate missing keys and keep output order stable (e.g., sort categories/items) to avoid surprising CLI output changes.
for category, items in templates.items():
typer.echo(typer.style(category, bold=True))
for t in items:
name = t["name"].ljust(14)
desc = t["description"]
typer.echo(f" {name} {desc}")
Adds new Feature: Add CLI list-templates Command #31
Description
Add a new
listcommand to the CLI that displays all available scaffold templates organized by category. This enables users to discover available templates without consulting documentation.Related Issue
Closes #31
Type of Change
Changes Made
TEMPLATE_INFOdictionary to 8 scaffold modules for dynamic discovery_collect_templates()helper function indevopsos.py@app.command("list")command to display templates by categorylistcommandTesting Done
python -m pytest cli/test_cli.py mcp_server/test_server.py tests/test_comprehensive.py -v)python -m cli.devopsos listChecklist