Skip to content

feat(cli): deployment history and version-scoped diff/review#39

Merged
Ruari-Phipps merged 31 commits intomainfrom
ruari/feat/poly_versions
Apr 17, 2026
Merged

feat(cli): deployment history and version-scoped diff/review#39
Ruari-Phipps merged 31 commits intomainfrom
ruari/feat/poly_versions

Conversation

@Ruari-Phipps
Copy link
Copy Markdown
Collaborator

@Ruari-Phipps Ruari-Phipps commented Mar 24, 2026

Summary

Adds poly deployments, extends diff / review with hash and --before / --after / --files, updates.
Updates review to be review create to be similar with branch commands

Motivation

Improves visibility into deployed versions and makes comparing local vs remote or named versions consistent in the CLI.

Changes

  • poly deployments with --env, pagination, --hash, --oneline, --json; Rich output with sandbox / pre-release / live badges.
  • get_deployments (API + project): client_env, list return shape, tuple with active hashes on AgentStudioProject.
  • poly diff / poly review: optional hash, --files, --before / --after; --delete on review; shared diff computation.
  • poly review logic moved to poly review create
  • poly revert / poly format: CLI shape updates to be consistent (--all removed; format uses --files).

Test strategy

  • Added/updated unit tests
  • Manual CLI testing (poly <command>)
  • Tested against a live Agent Studio project
  • N/A (docs, config, or trivial change)

Checklist

  • ruff check . and ruff format --check . pass
  • pytest passes
  • No breaking changes to the poly CLI interface (or migration path documented)
  • Commit messages follow conventional commits

Screenshots / Logs

Screenshot 2026-03-27 at 14 23 31

--details
Screenshot 2026-03-27 at 15 35 14

--env
Screenshot 2026-03-27 at 15 35 27

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new CLI surface for deployment history and extends existing diff/review workflows to support version-scoped comparisons.

Changes:

  • Introduces poly deployments (env selection, pagination, hash anchor, rich/JSON output).
  • Refactors poly diff / poly review to share diff computation and accept hash plus --before/--after/--files.
  • Updates platform API + project layer deployment fetching to return deployment records (list) and active deployment hashes.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/poly/cli.py Adds deployments command + new diff/review args and shared diff computation.
src/poly/project.py Adds get_deployments() and extends named-version resolution (including deployment hash + local).
src/poly/output/console.py Adds rich rendering helpers for deployment listings.
src/poly/handlers/platform_api.py Changes get_deployments() to accept client_env and return a list of deployment records.
src/poly/handlers/interface.py Updates interface signature/return type for get_deployments().
src/poly/tests/github_api_test.py Updates review gist tests to patch _compute_diff and new arg names.
Comments suppressed due to low confidence (1)

src/poly/cli.py:1285

  • AgentStudioCLI.revert() now rejects empty files and the error text still references --all, but the --all flag has been removed from the parser. This makes poly revert unusable despite the command description saying it should revert all changes by default. Consider treating files=None/[] as “revert all” and update the error/json output messages to remove --all references.
        if not files:
            if output_json:
                json_print(
                    {
                        "success": False,
                        "error": "No files specified to revert. Use --all or list files.",
                    }
                )
                sys.exit(1)
            error("No files specified to revert. Use [bold]--all[/bold] to revert all changes.")
            return

Comment thread src/poly/cli.py Outdated
Comment thread src/poly/cli.py
Comment thread src/poly/cli.py
Comment thread src/poly/cli.py
Comment thread src/poly/project.py Outdated
Comment on lines +241 to +248
try:
tz_str = created_at.split()[-1] # "GMT"
dt = datetime.strptime(created_at, "%a, %d %b %Y %H:%M:%S %Z")
dt = dt.replace(tzinfo=ZoneInfo(tz_str))
dt = dt.astimezone()
return dt.strftime("%d %b %y %H:%M %Z")
except (TypeError, ValueError):
return "-"
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

_format_deployment_timestamp can raise ZoneInfoNotFoundError when ZoneInfo(tz_str) is constructed (e.g., if the timestamp ends with an unrecognized tz abbreviation). This exception is not currently caught, so poly deployments could crash on unexpected API data. Catch zoneinfo.ZoneInfoNotFoundError (or broader Exception) in this formatter.

Copilot uses AI. Check for mistakes.
Comment thread src/poly/handlers/platform_api.py
Comment thread src/poly/cli.py Outdated
Comment thread src/poly/cli.py
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (1)

src/poly/cli.py:1285

  • The revert command currently errors when no files are provided and the error message still references --all, but --all has been removed from the parser and the help text says omitting files should revert all changes. The CLI should allow poly revert to revert everything (or reintroduce an explicit flag), and the error/help strings should be updated to match the actual arguments.
        if not files:
            if output_json:
                json_print(
                    {
                        "success": False,
                        "error": "No files specified to revert. Use --all or list files.",
                    }
                )
                sys.exit(1)
            error("No files specified to revert. Use [bold]--all[/bold] to revert all changes.")
            return

Comment thread src/poly/cli.py Outdated
Comment thread src/poly/cli.py
Comment thread src/poly/cli.py Outdated
Comment thread src/poly/cli.py
Comment thread src/poly/cli.py
Comment thread src/poly/project.py
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@Ruari-Phipps Ruari-Phipps force-pushed the ruari/feat/poly_versions branch from e06c43e to a785541 Compare April 9, 2026 10:55
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@Ruari-Phipps Ruari-Phipps requested review from a team as code owners April 16, 2026 12:12
@github-actions

This comment has been minimized.

Comment thread src/poly/cli.py Outdated
Comment thread src/poly/cli.py Outdated
Comment thread src/poly/cli.py
Comment thread src/poly/cli.py
@github-actions
Copy link
Copy Markdown
Contributor

Coverage Report

Base (main) PR Change
71.8% 72.3% +0.5% ✅

Changed file coverage

File Coverage Change
poly/output/console.py 18.8% -5.0% ⚠️
poly/handlers/platform_api.py 33.6% +1.5% ✅
poly/cli.py 52.7% +3.7% ✅
poly/project.py 69.3% +2.4% ✅
poly/resources/pronunciation.py 78.8% +0.7% ✅
poly/resources/resource.py 80.8% +1.4% ✅

@Ruari-Phipps Ruari-Phipps merged commit 0730d06 into main Apr 17, 2026
3 checks passed
@Ruari-Phipps Ruari-Phipps deleted the ruari/feat/poly_versions branch April 17, 2026 16:32
AaronForinton added a commit that referenced this pull request Apr 20, 2026
## Summary

This covers the work from #39

## Motivation

<!-- Why is this change needed? Link to an issue if applicable. -->

Closes #<!-- issue number -->

## Changes

<!-- Bullet list of the key changes. Focus on *what* changed, not *how*.
-->

-

## Test strategy

<!-- How did you verify this works? Check all that apply. -->

- [ ] Added/updated unit tests
- [ ] Manual CLI testing (`poly <command>`)
- [ ] Tested against a live Agent Studio project
- [x] N/A (docs, config, or trivial change)

## Checklist

- [ ] `ruff check .` and `ruff format --check .` pass
- [ ] `pytest` passes
- [x] No breaking changes to the `poly` CLI interface (or migration path
documented)
- [ ] Commit messages follow [conventional
commits](https://www.conventionalcommits.org/)

## Screenshots / Logs

<!-- Optional: paste terminal output, screenshots, or before/after diffs
if helpful. -->

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants