Skip to content

feat(cli): add --source and result counts to kirocrew app update - #24535

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
devsdmf:feat/app-update-cli
Nov 5, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
devsdmf:feat/app-update-cli

Conversation

@devsdmf

@devsdmf devsdmf commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: kirocrew app update <name> --source DIR updates 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 need uninstall, install and enable:

  • a developer building a new version in a second checkout;
  • an app directory that has moved since install;
  • a release script that builds into a fresh directory.

A fresh install starts disabled, and for an app that declares permissions.sessionApproval it 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}/update already reads a source from 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, which enable reports.

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

  • No operator-only argv floor, denylist entry or "refused from an agent shell" rule for app update or --source. Whether an agent may run it is a policy call for a maintainer. The route has accepted a source body from any owner-token holder since it was added, so the flag adds no new reach.
  • No change to POST /api/apps/{name}/update or to what it records.
  • No change to the verb feat(cli): add kirocrew app update #29309 shipped: its gateway-only path, its refusal and its tests stay as they are.
  • No file-only fallback when no gateway answers.

What changed (motivation → approach → change)

Goal: let the terminal send the source the route already accepts, and show the result the way enable does.

Approach: build on #29309's _run_app_action_through_gateway, which already carries an optional payload to toggle_app. No new helper or client change was needed.

Area Change
cli_parser_agent.py app update takes an optional --source DIR, with an example in the epilog.
cli_commands_app.py --source is 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.py An update prints the Agents registered / Skills registered counts the way an enable does. An update the gateway parks for session-approval re-consent prints its message and no counts.
apps/manager_install.py The already-installed refusal names kirocrew app update <name> next to uninstalling.
Docs cli.md, app-kit-platform.md, apps.md, the publishing guide and the kirocrew-commands and kirocrew-app-dev skills describe the flag. They also note that a --source update 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 on main. The only changed texts are install's already-installed refusal and the removal of a doubled period in gateway refusals. No code or test on main matches 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 --source reaches toggle_app as 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 no enable hint 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_rejected also checks that the refusal names kirocrew app update <name>.

With the source changes reverted to main, 5 of these fail. The rest pin behaviour main already 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.sh from this branch (its own KIROCREW_HOME, KIRO_HOME and port 6777), not a live one. The test app came from kirocrew app init (one agent, one skill) and was trusted in the test config only. A marker file was placed in the installed app's data/.

  1. Update from the recorded source. Bumped to 0.2.0, ran 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.
  2. --source with a relative path from another directory. From the parent folder, ran kirocrew app update mv-demo --source mv-demo-v2 (bumped to 0.3.0). Got updated mv-demo v0.2.0 -> v0.3.0 with the counts, exit 0. Still enabled, marker intact, and app info shows the recorded source is now the absolute path of mv-demo-v2.
  3. Refusals. --source "" printed --source is empty; pass the app directory or omit the flag, exit 1. A second kirocrew app install of the app was refused with already 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.
  4. No gateway. With the gateway stopped, kirocrew app update mv-demo printed No 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 by test_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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 license, per the Licensing section of CONTRIBUTING.md.

@devsdmf
devsdmf requested review from a team and KiroCrewCaptain as code owners October 26, 2026 19:00
@devsdmf
devsdmf requested a review from CrysisDeu October 26, 2026 19:00
@github-actions github-actions Bot added readiness: checking Automated validation is still running fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 26, 2026
@devsdmf
devsdmf force-pushed the feat/app-update-cli branch from e26e006 to a7ebd27 Compare October 30, 2026 11:35
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 9b7b41a7e59ad9a99cb065d8866f7f5cd2a47660 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns. --source sends a body field that routes_install.py:88 already reads, through #29309's existing payload seam. The patch adds no new surface on the gateway side and removes nothing.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 9b7b41a7e59ad9a99cb065d8866f7f5cd2a47660 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: the source field was already accepted by POST /api/apps/{name}/update (apps/routes_install.py:88), and the CLI now sends it. The two message tweaks are harmless riders.

What this change ships

Inventory (7 items) — 5 justified

Intent: 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.

  1. kirocrew app update NAME --source DIR updates from another directory, and that directory becomes the recorded source — justified
  2. A relative --source is sent as an absolute path — justified
  3. An empty or blank --source exits 1 before any request is sent — justified
  4. A successful update prints Agents registered / Skills registered counts; an update held for re-consent prints only its message — justified
  5. install's already-installed refusal now points at kirocrew app update <name> — rides along
  6. Gateway refusals no longer print a doubled period (..) — rides along
  7. CLI, App Kit spec, apps doc, publishing guide and two skills describe the flag — justified

[FIRST-PRINCIPLES-REVIEWED] 9b7b41a

Description read

[DESCRIPTION-READ] 7c7959e40422e0a3810d166f56da7b0a8d75fdeeeb8742e2281530cac74b279a

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 9b7b41a7e59ad9a99cb065d8866f7f5cd2a47660 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 9b7b41a

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 9b7b41a7e59ad9a99cb065d8866f7f5cd2a47660 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 9b7b41a

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 1, 2026
@devsdmf
devsdmf force-pushed the feat/app-update-cli branch from a7ebd27 to ec8babd Compare November 2, 2026 17:17
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision 9b7b41a7e59ad9a99cb065d8866f7f5cd2a47660 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 2, 2026
@devsdmf
devsdmf force-pushed the feat/app-update-cli branch from ec8babd to e7937cb Compare November 2, 2026 20:58
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Security Scope Review (fork) — 🔴 BLOCK (blocking)

Which legitimate operations does e7937cb4b659a7f083352c44eec359dd25677ff8 newly refuse? Model proposes, scripts/deny_diff.py decides — updated in place on each push. A script-confirmed regression blocks PR readiness.

no leg reported, and this was not the nothing-to-adjudicate short circuit

No [SCOPE-REVIEWED] marker for this head was produced, so the model's text is withheld: it cannot be shown to describe this revision. See the job logs.

@devsdmf
devsdmf force-pushed the feat/app-update-cli branch from e7937cb to f5ce27b Compare November 2, 2026 23:26
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 3, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 3, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

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 --source, and has no file-only fallback. CI on this head is green.

It is held for a human because it decides what an agent-reachable command may do. app update --source DIR swaps an installed app's code for any directory and restarts it under its existing consent (routes_install.py). The description leaves whether an agent shell may run it to a repository writer, and #14255 stalled on that question. A maintainer ruling on that (no floor, or an operator-only floor) clears this hold.

Notes: the Security Scope Review comment still shows BLOCK for e7937cb4, not this head; the head's Security Scope Review check is SUCCESS. The manual verification steps are listed as not run.

— crew-pr-reviewer (r144)

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 3, 2026
@devsdmf
devsdmf force-pushed the feat/app-update-cli branch from fd025f2 to 37f4545 Compare November 4, 2026 17:40
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 4, 2026
@devsdmf devsdmf changed the title feat(cli): add kirocrew app update <name> through the gateway feat(cli): add --source and result counts to kirocrew app update Nov 4, 2026
@devsdmf
devsdmf force-pushed the feat/app-update-cli branch from 37f4545 to 2cfa188 Compare November 4, 2026 18:09
@devsdmf

devsdmf commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Requesting a maintainer ruling on the HOLD above (policy_sensitive), so this can move forward.

What changed since the hold

#29309 merged kirocrew app update <name> on main, with no argv floor. This PR is now rebased onto it as a single commit (2cfa188) and only adds --source DIR, the re-registration counts, and the install hint. So the open question is narrower than when the hold was posted: it is only whether an agent-reachable shell may pass --source.

The question

app update <name> --source DIR replaces an installed app's code with the contents of DIR and restarts it under the consent it already has. Should it be:

  1. No floor. Agent shells may run it, like the bare app update on main.
  2. Operator-only. Agent shells are refused (an argv floor or denylist entry for --source, or for app update as a whole). This would land as a separate PR, as the description says.

What the route already enforces when --source points somewhere new

All of this is existing behaviour in POST /api/apps/{name}/update; this PR changes none of it:

  • The name must match. A directory whose app.json names a different app is refused (manager_install.py#L525).
  • Admission policy and the trust grant are re-checked for the new code (#L539, #L564).
  • Wider permissions go back to the owner. A version that newly asks for sessionApproval comes back disabled until the owner re-consents in the dashboard (#L582). Grants the old version was not approved for are held back rather than approved (#L590).
  • The body is not new. The route has read source from the request body since it was added (routes_install.py#L88), for any owner-token holder.

What --source adds beyond main, plainly

  • Without it, an agent that can write to the app's recorded source directory can already change the code that bare app update installs, under the same checks.
  • With it, the agent can point at any directory it can write to, and that directory becomes the recorded source for later updates (confirmed in manual verification step 2).
  • Neither path can rename the app or widen its permissions without the owner.

What each ruling means for this PR: with option 1 it can merge as it is. With option 2 I'll drop --source from this PR, so it keeps only the counts and the install hint, and the floor can follow as its own PR.

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.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Nov 4, 2026
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.
@devsdmf
devsdmf force-pushed the feat/app-update-cli branch from 2cfa188 to 9b7b41a Compare November 4, 2026 22:33
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 4, 2026

@bolichen97 bolichen97 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.

Reviewed at 9b7b41a.

  • kirocrew app update NAME --source DIR resolves the path against the shell's own working directory and sends it as {"source": ...}. The existing POST /api/apps/{name}/update handler already reads body.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.
  • update now prints the same registration counts as enable. The "already installed" error points at app 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.

@bolichen97
bolichen97 merged commit 405c687 into kirodotdev:main Nov 5, 2026
94 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 5, 2026
@devsdmf
devsdmf deleted the feat/app-update-cli branch November 7, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants