Repository navigation
feat(cli): add --source and result counts to kirocrew app update - #24535
Conversation
e26e006 to
a7ebd27
Compare
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level concerns. [DESIGN-REVIEWED] 9b7b41a Description read[DESCRIPTION-READ] 4f7681babd9db15ad71277ab79937d049c7bb56eb09a3c4b2f6c841d6bf90981 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: the What this change shipsInventory (7 items) — 5 justifiedIntent: let a terminal user update an installed app from a different directory without uninstalling and reinstalling, which would drop its enabled state and its consent. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 9b7b41a Description read[DESCRIPTION-READ] 7c7959e40422e0a3810d166f56da7b0a8d75fdeeeb8742e2281530cac74b279a That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
a7ebd27 to
ec8babd
Compare
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
ec8babd to
e7937cb
Compare
Security Scope Review (fork) — 🔴 BLOCK (blocking)Which legitimate operations does no leg reported, and this was not the nothing-to-adjudicate short circuit No |
e7937cb to
f5ce27b
Compare
|
HOLD (policy_sensitive) at fd025f2. The code looks correct: the verb posts the existing owner-gated update route (cli_commands_app.py), refuses an empty It is held for a human because it decides what an agent-reachable command may do. Notes: the Security Scope Review comment still shows BLOCK for — crew-pr-reviewer (r144) |
fd025f2 to
37f4545
Compare
37f4545 to
2cfa188
Compare
|
Requesting a maintainer ruling on the HOLD above (policy_sensitive), so this can move forward. What changed since the hold #29309 merged The question
What the route already enforces when All of this is existing behaviour in
What
What each ruling means for this PR: with option 1 it can merge as it is. With option 2 I'll drop Manual verification is now done against an isolated gateway (steps 1 to 4 in the description, with outputs). The re-consent path is covered by a unit test. |
Update request through the running gateway and refuses when none answers. It always updates from the source recorded at install, so an app developer iterating on a second checkout, or on a directory that moved since install, still has to uninstall and reinstall, and a fresh install resets the sessionApproval consent. Add `--source DIR`. The CLI makes the path absolute, because the gateway resolves it against its own working directory, and sends it as the request body the route already reads. Without the flag no body is sent, as before. An empty value (an unset shell variable) is refused before any request instead of being read as the current directory. The result now prints the agent and skill counts the gateway re-registered, as `enable` does. An update the gateway parks for session-approval re-consent prints its message and no counts. `install`'s already-installed refusal now names `kirocrew app update` alongside uninstalling. A gateway refusal that already ends in a period no longer prints "..". The CLI and App Kit specs, the shipped apps doc, the publishing guide and both skills describe the flag, including that a --source update also becomes the app's recorded source.
2cfa188 to
9b7b41a
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed at 9b7b41a.
kirocrew app update NAME --source DIRresolves the path against the shell's own working directory and sends it as{"source": ...}. The existingPOST /api/apps/{name}/updatehandler already readsbody.source, falling back to the recorded source, so no server change is needed.- An empty
--source(an unset variable) is refused rather than read as the current directory. updatenow prints the same registration counts asenable. The "already installed" error points atapp update, and the gateway-refusal message no longer prints "..".- It stays gateway-only, with no file-only fallback, so a running backend is never left on the old tree.
No new refusals and no pattern matching. All checks green. Approving.
Problem / Motivation
Goal:
kirocrew app update <name> --source DIRupdates an installed app from a directory other than the one it was installed from, and the command reports what it re-registered.#29309 added
kirocrew app update <name>. It always updates from the app's recorded source, so these cases still needuninstall,installandenable:A fresh install starts disabled, and for an app that declares
permissions.sessionApprovalit also resets that consent. So every such release ends in the dashboard, re-consenting to a permission that did not change.POST /api/apps/{name}/updatealready reads asourcefrom its body. Only the CLI cannot send one.The command also prints only
✅ updated <name> vA -> vB. It says nothing about the agents and skills the gateway re-registered, whichenablereports.Why it matters
Every app that is not installed from the registry pays this: apps under development, privately distributed apps, and apps whose author tests a build before publishing. The uninstall/install loop drops the enabled state an update is meant to keep, and the forced re-consent teaches users to click through a disclosure they have already read.
Not a goal
app updateor--source. Whether an agent may run it is a policy call for a maintainer. The route has accepted asourcebody from any owner-token holder since it was added, so the flag adds no new reach.POST /api/apps/{name}/updateor to what it records.What changed (motivation → approach → change)
Goal: let the terminal send the
sourcethe route already accepts, and show the result the wayenabledoes.Approach: build on #29309's
_run_app_action_through_gateway, which already carries an optionalpayloadtotoggle_app. No new helper or client change was needed.cli_parser_agent.pyapp updatetakes an optional--source DIR, with an example in the epilog.cli_commands_app.py--sourceis made absolute before it is sent, because the gateway resolves paths against its own working directory. Without the flag no body is sent, as before. An empty value (--source "$DIR"with the variable unset) is refused before any request. A gateway refusal that already ends in a period no longer prints...app_lifecycle_client.pyAgents registered/Skills registeredcounts the way an enable does. An update the gateway parks for session-approval re-consent prints its message and no counts.apps/manager_install.pykirocrew app update <name>next to uninstalling.cli.md,app-kit-platform.md,apps.md, the publishing guide and thekirocrew-commandsandkirocrew-app-devskills describe the flag. They also note that a--sourceupdate becomes the app's recorded source, which manual step 2 confirmed.Not a product-shape change: no default changes and nothing is removed, so no RFC is cited.
Backwards compatibility
Compatible.
app update <name>without the flag sends the same bodyless request as onmain. The only changed texts areinstall's already-installed refusal and the removal of a doubled period in gateway refusals. No code or test onmainmatches either.Removes nothing: no flag, path, record or key is removed or renamed, and no validator is tightened on an existing input.
Tests
In
test/test_cli_app_update.py, next to #29309's tests:test_the_parser_accepts_an_optional_source: the flag is optional and parsed.test_a_relative_source_is_sent_absolute: a relative--sourcereachestoggle_appas the resolved absolute path.test_without_source_no_body_is_sent: no flag, no payload.test_an_empty_source_is_refused_before_any_request(""and" "): exits 1 and sends nothing.test_registration_counts_are_printed: the counts appear and noenablehint follows.test_an_update_parked_for_consent_prints_no_counts_or_enable_hint.test_a_refusal_ending_in_a_period_is_not_doubled.test/test_app_manager.py::test_install_duplicate_rejectedalso checks that the refusal nameskirocrew app update <name>.With the source changes reverted to
main, 5 of these fail. The rest pin behaviourmainalready has.Run locally (macOS, Python 3.14): the CLI app tests, CLI coverage, lifecycle client, app manager, facade guards, docs catalogue, and every test file that matches
gateway refused: 1067 passed. flake8, black and isort are clean on the changed files.Manual verification
Run against an isolated gateway started with
./dev-backend.shfrom this branch (its ownKIROCREW_HOME,KIRO_HOMEand port 6777), not a live one. The test app came fromkirocrew app init(one agent, one skill) and was trusted in the test config only. A marker file was placed in the installed app'sdata/.kirocrew app update mv-demo. Got✅ updated mv-demo v0.1.0 -> v0.2.0,Agents registered: 1,Skills registered: 1, exit 0. Still enabled, marker intact.--sourcewith a relative path from another directory. From the parent folder, rankirocrew app update mv-demo --source mv-demo-v2(bumped to 0.3.0). Gotupdated mv-demo v0.2.0 -> v0.3.0with the counts, exit 0. Still enabled, marker intact, andapp infoshows the recorded source is now the absolute path ofmv-demo-v2.--source ""printed--source is empty; pass the app directory or omit the flag, exit 1. A secondkirocrew app installof the app was refused withalready installed (v0.3.0). Update it in place instead (from the app's page, or kirocrew app update mv-demo), or uninstall first, exit 1. This run showed a doubled period after that message, which this PR now fixes; the fix is covered by a unit test but was not re-run against the gateway.kirocrew app update mv-demoprintedNo running gateway answered, so nothing was updated..., exit 1, and the app stayed at 0.3.0, enabled.Not run: an update that newly adds
permissions.sessionApproval. That path is covered bytest_an_update_parked_for_consent_prints_no_counts_or_enable_hint.Related Issues
Follows #29309, which added
kirocrew app update <name>. Related: #14255, an earlier PR for the same verb, which stalled on an operator-only argv floor this PR leaves out (see "Not a goal"). No issue is linked.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license, per the Licensing section of CONTRIBUTING.md.