feat: add poly update command and startup version check - #303
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Five skills teaching AI coding agents (Claude Code, Cursor, Codex) the poly CLI workflow, structured against google/agents-cli conventions: - poly-adk-workflow: entrypoint - setup, core loop, invariants, routing - poly-adk-testing: validate, scripted chat, test_suite, functions execute - poly-adk-branching: merge model, conflict resolution, review gists - poly-adk-conversations: real-call inspection, logging/metrics - poly-adk-rtc: RTC cycle, drift protection, live-push safety Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
poly setup is the single onboarding entry point: auth (browser sign-in), shell completion, AI agent skills via npx, and project setup — each step skipped automatically when already done. - new cli_commands/skills.py: pinned npx skills wrapper, Node 18+ gate, non-fatal install/update helpers - poly login/setup now wait for a new API key to become active - region selection extracted and threaded everywhere (no hardcoded studio) - poly start removed: superseded by poly setup, not referenced in published material - docs: new setup reference page, getting-started restructured around poly setup, start page removed, tooling page leads with skills install Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Ruari-Phipps
force-pushed
the
ruari/feat/poly_update
branch
from
September 2, 2026 15:39
eaf8ce3 to
77b7d02
Compare
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Ruari-Phipps
force-pushed
the
ruari/feat/poly_update
branch
from
September 2, 2026 15:40
77b7d02 to
7c6b03d
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Path.expanduser resolves ~ from USERPROFILE on Windows, not HOME, so the throwaway home directory must be set via both variables. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
polyai-adk now imports packaging directly for PyPI version comparison, so declare it rather than relying on it being present transitively. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
An editable or ephemeral install was only rejected inside perform_update, after the target version had been validated against PyPI and after "Updating Poly CLI to version X..." had already been printed. The command announced an update it then refused to perform, and spent a network round trip to do it. Hoist the guard to the top of update() so a refused install produces the warning and nothing else. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CI runners have nobody watching for an upgrade prompt. Non-TTY output already covered most of them, but that is incidental rather than deliberate and stops holding for any runner that allocates a terminal, so check the usual markers explicitly. Jenkins, Azure Pipelines and TeamCity are named individually because they do not set CI. Suppression reasons move into one helper so they are read together, and 'poly update --help' now mentions POLY_NO_UPDATE_CHECK. That closes the discoverability gap that made a --no-update-check flag look necessary: the env var already works inline, so a flag would only duplicate it across every subcommand's help output. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
poly update now refreshes the installed skills after the CLI (also when the CLI is already current). --cli-only and --skills-only narrow it to one half; --skills-only works on editable installs, where the CLI half is refused. Skill failures in a combined update warn without failing the command; in --json mode npx output is captured so stdout stays a single object. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Ruari-Phipps
force-pushed
the
ruari/feat/poly_update
branch
from
September 2, 2026 15:50
7c6b03d to
4ee74d9
Compare
This was referenced Sep 2, 2026
This comment has been minimized.
This comment has been minimized.
jamesosullivan-polyai
approved these changes
Sep 9, 2026
jamesosullivan-polyai
left a comment
Contributor
There was a problem hiding this comment.
Approved — solid implementation with strong test coverage (101 tests), scope is clear (updates the CLI tool + bundled skills, not project resources), and correctly wired into cli.py.
Note: this PR isn't mergeable standalone as-is — it imports node_gate_reason/update_skills from skills.py and GETTING_STARTED_GROUP from base.py, which only land in #305. Merge #305 first; expect a straightforward conflict in cli.py's COMMANDS list when landing sequentially. Also worth a quick pass on the stray copy-pasted docstring in update.py:230 ("Auth command family: start and login.").
Ruari-Phipps
added a commit
that referenced
this pull request
Sep 10, 2026
## Summary Adds a `skills/` directory with five agent skills that teach AI coding agents (Claude Code, Cursor, Codex, etc.) the `poly` CLI workflow, plus a README describing the suite. Installable via `npx skills add`. First PR of a three-part stack: #305 adds `poly setup`, which installs these skills, and #303 makes `poly update` keep them current. ## Motivation AI coding agents working on ADK projects currently have no contextual knowledge of the `poly` workflow — resource schemas, the no-`main` rule, pushed-state testing semantics, or conflict resolution. These skills provide that context on demand, structured after Google's `agents-cli` skills suite: a workflow entrypoint plus task-specific skills that load only when relevant. ## Changes - `skills/poly-adk-workflow/SKILL.md` — entrypoint: install/update, auth, `poly docs` habit, resource-choice guidance, project structure, the core edit → validate → push → test → merge loop, and a routing table to the task skills - `skills/poly-adk-testing/SKILL.md` — `poly validate`, scripted `poly chat`, `test_suite/` authoring with `api_mocks`, `poly functions execute/validate` - `skills/poly-adk-branching/SKILL.md` — branch semantics, three-way merge model, conflict markers, non-interactive `merge --resolutions`, review gists - `skills/poly-adk-conversations/SKILL.md` — `poly conversations`, instrumenting with `conv.log` and metrics, real-call → test-case loop - `skills/poly-adk-rtc/SKILL.md` — RTC pull/push cycle, drift protection, live-environment safety - `skills/README.md` — suite overview and install instructions Resource schemas are deliberately not duplicated — skills instruct agents to run `poly docs`, which ships schemas with the installed CLI. Skill `metadata.version` is pinned to the current release (0.53.1). ## Test strategy - [ ] Added/updated unit tests - [x] Manual CLI testing (`poly <command>`) - [x] Tested against a live Agent Studio project - [x] N/A (docs, config, or trivial change) Markdown-only change. Skills were installed locally via `npx skills add` (frontmatter validated by the tool) and exercised in Claude Code sessions against a real project. All CLI commands and flags referenced were cross-checked against `docs/` and, where relevant, the source. ## Checklist - [x] `ruff check .` and `ruff format --check .` pass - [x] `pytest` passes - [x] No breaking changes to the `poly` CLI interface (or migration path documented) - [x] Commit messages follow [conventional commits](https://www.conventionalcommits.org/) ## Screenshots / Logs N/A 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Ruari-Phipps
added a commit
that referenced
this pull request
Sep 10, 2026
## Summary Adds `poly setup` — a single onboarding command covering authentication, shell completion, AI agent skill installation, and project setup — and removes `poly start`, which it supersedes. Second PR of the stack: stacked on #304 (the skills it installs), and the base for #303, which makes `poly update` keep them current. ## Motivation Onboarding currently spans several commands users must discover one by one (`poly login`, `poly completion`, `poly project create`), and the new agent skills had no installation path. `poly setup` runs all of it in one command, skipping any step that is already done, so it doubles as a repair command. `poly start` covered a subset of this (auth + project, hardcoded to the `studio` region) and is not referenced in published material, so it is removed rather than left as a second entry point. ## Changes - New `poly setup` command with `--region`, `--base-path`, `--skip-auth`, `--skip-skills`, `--agent` (repeatable), `--dev`, and `--global/-g` flags - New `cli_commands/skills.py`: wrapper around the pinned `npx skills` package with a Node.js 18+ gate; skill installation is non-fatal — a missing Node warns and setup continues - `poly login` (and setup) now wait up to 20s for a newly created API key to become active before returning - Region selection extracted to a shared picker; `poly start`'s four hardcoded `studio` call sites removed along the way - `poly start` removed from the CLI, docs, and nav - Docs: new `setup` reference page; getting-started restructured to "install, then `poly setup`"; tooling page now leads with skill installation via setup - `poly-adk-workflow` skill updated to mention `poly setup` for fresh machines - Root README quickstart updated from `poly start` to `poly setup` ## Test strategy - [x] Added/updated unit tests - [x] Manual CLI testing (`poly <command>`) - [ ] Tested against a live Agent Studio project - [ ] N/A (docs, config, or trivial change) 60 new tests (node gate, npx argument construction and non-raising failures, per-step skip logic, real rc-file completion installs in throwaway home directories — set via both HOME and USERPROFILE so they are hermetic on Windows — region threading, and activation-poll behavior). Manually verified end-to-end with an isolated `$HOME`: completion install + idempotent re-run, `--dev -g --agent claude-code` installing all five skills via npx, graceful skip without a TTY, and `poly start` now reporting an invalid choice. ## Checklist - [x] `ruff check .` and `ruff format --check .` pass - [x] `pytest` passes - [x] No breaking changes to the `poly` CLI interface (or migration path documented) — `poly start` is intentionally removed; `poly setup` / `poly login` are the migration path - [x] Commit messages follow [conventional commits](https://www.conventionalcommits.org/) ## Screenshots / Logs N/A
Ruari-Phipps
enabled auto-merge (squash)
September 10, 2026 10:17
Contributor
Coverage Report
Changed file coverage
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
poly updatecommand that detects how the CLI was installed, runs the matching upgrade command, and refreshes the installed AI agent skills, supporting--check,--to VERSION,--cli-only, and--skills-only. Also adds a passive startup notice that tells users when a newer release exists, limited to standalone tool installs.Final PR of the stack: stacked on #305 (
poly setup), whose skills wrapper it reuses.Motivation
There is no built-in way to update the CLI. Users have no way of learning that a new version exists, and upgrading means knowing which of several install methods they used and running the right command by hand.
Changes
Add
poly update, which upgrades the CLI to the latest release on PyPI.Add
poly update --checkto report whether an update is available without installing it.Add
poly update --to VERSIONto install a specific release, including downgrades and reinstalls. Named--torather than--versionbecause the root parser already uses that to print the installed version. The requested version is validated against PyPI first, so a typo fails immediately with a list of recent releases rather than a resolver error.Detect the install method from
sys.prefixand package metadata, and pick the matching command foruv tool,pipx,uv pipandpip. Pinned installs useinstall --forcerather thanupgrade, since the upgrade subcommands will not move backwards and would silently no-op a downgrade.Refuse to upgrade an editable/dev install, which would otherwise replace a working checkout with a released package and leave local edits mysteriously inert.
Refuse to upgrade an ephemeral
uvx/uv runenvironment, where the install is discarded when the command exits.Add a passive update notice on CLI startup, rate limited to once every 12 hours via a stamp file in
~/.poly. It is restricted to standaloneuv tool/pipxinstalls: a project install's version is pinned by that project's manifest, so prompting the user to upgrade it would be advice the next dependency sync silently undoes.Suppress the startup notice for
--jsonand non-TTY output so machine-readable output cannot be corrupted, viaPOLY_NO_UPDATE_CHECK, and in CI. Non-TTY already covered most CI runners, but only incidentally, and that stops holding for any runner that allocates a terminal, so the usual markers are checked explicitly. Jenkins, Azure Pipelines and TeamCity are named individually because they do not setCI. Errors are swallowed and logged at debug level so a version check can never break the command the user actually ran.Mention
POLY_NO_UPDATE_CHECKinpoly update --help, so someone who sees the notice can find out how to silence it. No--no-update-checkflag: the env var already works inline (POLY_NO_UPDATE_CHECK=1 poly status), so a flag would only duplicate it across every subcommand's help output.Gate the startup check cheapest-first — string comparison, then a small file read, then a 2 second network call — so the common case adds no measurable startup cost. Skip recording the stamp when PyPI does not answer, so a transient failure retries on the next run instead of causing 12 hours of silence.
Add PyPI helpers to
cli_commands/shared.py:get_latest_version,get_available_versionsandis_newer_version. Version comparison usespackagingrather than string inequality, which previously reported an update available on every run for any build not exactly matching PyPI.Add a shared
POLY_HOME_DIRconstant and use it for both the credentials file and the update stamp, replacing an inlined~/.polypath.Declare
packaging>=24.0, which was previously only available transitively.Update the installed AI agent skills as part of
poly update— also when the CLI is already current — via the pinnednpx skillswrapper this PR inherits from feat: add poly setup command and remove poly start #305.Add
--cli-onlyand--skills-only(mutually exclusive) to narrow the update to one half.--skills-onlydeliberately skips the not-upgradable guard, so editable/dev installs can still update their skills.Treat skill failures in a combined update as best-effort: warn without failing the command. With
--skills-onlythey are the whole command failing (exit 1).Capture npx output in
--jsonmode so stdout stays a single object, and report the outcome under askills_updatedkey.Test strategy
poly <command>)101 unit tests covering the skills half of the update (scope flags, best-effort vs required failure handling, quiet npx in
--jsonmode), install-method detection, version comparison and ordering, command construction for each install method, target-version validation, theupdatecontrol flow, and every startup-check and suppression gate. Tests make no network calls and never touch the real~/.poly.Manual testing covered
--check,--towith valid, invalid and older versions, and the editable-install guard.Checklist
ruff check .andruff format --check .passpytestpassespolyCLI interface (or migration path documented)Screenshots / Logs
Startup notice gates, verified across every path:
uv toolinstall, update availablepipxinstall, update availableuvx--jsonoutputPOLY_NO_UPDATE_CHECK=1CI,JENKINS_URL,TF_BUILD,TEAMCITY_VERSION)Invalid target version: