Skip to content

feat(project): command-line-only screens for project commands without a TUI - #2177

Merged
notgitika merged 2 commits into
aws:refactorfrom
notgitika:feat/project-cli-only-screens
Sep 3, 2026
Merged

feat(project): command-line-only screens for project commands without a TUI#2177
notgitika merged 2 commits into
aws:refactorfrom
notgitika:feat/project-cli-only-screens

Conversation

@notgitika

@notgitika notgitika commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What

Every project command without a TUI screen now opens a command-line-only screen instead of tearing the TUI down with an error. It says so, and shows the command's help — usage, options, arguments, and the "Parameter details" that --help appends — read from the same Commander help the CLI prints. Groups (add, export) open their menu, so every resource beneath them is reachable the same way. Esc returns to the parent menu.

The project menu lists screen-backed commands first, then a command line only divider, then the rest:

 ❯ create   create a new AgentCore project
   deploy   deploy the project to AWS
   invoke   invoke a Runtime or Harness from the current project
   build    build the project's deployable artifacts
── command line only ───────────────────────────────────────────
   add      add project resources
   export   convert project resources into editable code you own
   remove   remove a resource from the project
   dev      run the project locally for development
   status   show the status of the project's deployed resources

How

  • project Router declares its screen-backed children via the existing supportedTuiCommands(...) (what eval/identity use); compile() propagates it to nested commands.
  • RouterScreen partitions on isTuiCommandSupported instead of filtering, behind a showCliOnly prop. Other menus are unchanged.
  • New CliOnlyScreen (Layout + KeyValueTable + ScrollView, over command.createHelp()), and one wildcard route agentcore/project/* replacing Root's hand-written list and ProjectCommandNotImplementedScreen.
  • KeyValueTable wraps values under themselves and caps the key column at 50%.

dev is CLI-only here; a TUI screen for it is a follow-up.

Formerly stacked on #2172; rebased onto refactor now that it has merged, so this PR is the single feature commit plus one small fix:

  • fix(project): satisfy ProjectBackend in the build/deploy screen test fakebuildDeploy.screen.test.tsx on refactor predates resolveProjectResources landing on the ProjectBackend interface, so tsc --noEmit fails on the base branch today. The fake gets the stub the interface requires.

Also resolved the CodeQL js/bad-tag-filter finding on the test regex (it is a terminal-layout assertion, not an HTML filter; made it case-insensitive so the rule is satisfied).

Testing

bun test 2848 pass; tsc, oxlint, prettier clean. Tests read the CLI-only commands off the Commander tree and assert each shows its usage and every option; plus divider order, add → gateway drill-down, scrolling to the parameter details, a small-terminal sweep, and resize-after-scroll.

@github-actions github-actions Bot added the size/xl PR size: XL label Sep 3, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added agentcore-harness-reviewing AgentCore Harness review in progress claude-security-reviewing Claude Code /security-review in progress labels Sep 3, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Sep 3, 2026
Comment thread src/handlers/project/project.screen.test.tsx Fixed
@codecov-commenter

codecov-commenter commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.77301% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.15%. Comparing base (2e30e1f) to head (24a3bf6).

Files with missing lines Patch % Lines
src/components/CliOnlyScreen.tsx 97.97% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           refactor    #2177      +/-   ##
============================================
+ Coverage     97.13%   97.15%   +0.01%     
============================================
  Files           541      542       +1     
  Lines         37618    37726     +108     
============================================
+ Hits          36542    36651     +109     
+ Misses         1076     1075       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@agentcore-devx-automation agentcore-devx-automation Bot 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.

AgentCore Harness Review

Verdict: Looks good

This is a substantial, well-structured change and I did not find any blocking issues.

Notes I looked into but don't think need changes:

  • ConfirmAction immediate-trigger auto-run: the useEffect that fires run() when phase.kind === "idle" && !isPending && !error relies on setPhase({ kind: "running" }) inside run to prevent re-entry. Under React Strict Mode (double-invoked effects) this could theoretically fire run twice before the state update flushes, but Ink doesn't enable Strict Mode, so this is fine in practice.
  • useProject re-keys on process.cwd(): because the query key includes from = process.cwd() read on every render, a mid-session process.chdir would produce a new query missing initialData. Screens don't chdir mid-session; the tests explicitly chdir before mount. Reasonable as-is.
  • applyProgressEvent returns a fresh array for stray output events: driveProgress will still call onChange with a new (identical) task list, causing an extra setState in React consumers. Minor, not worth changing.
  • Telemetry: the referenced src/cli/telemetry/README.md doesn't exist in the tree, and telemetry is wired at the CLI wrapper (withCommandRun) rather than inside handlers/screens. So these new TUI screens are on the same footing as the existing ones — no gap introduced.
  • Test approach: tests use real temp directories, createRootHandler to scaffold a project, and stub only ProjectBackend (a legitimate boundary). Monkey-patching core.projectManager.listTargets to inject a failure is a targeted seam, not excessive mocking.

The refactor of runWithProgress into applyProgressEvent / settleProgress / driveProgress is a nice cleanup and the shared TaskList between CLI and TUI progress is a real win.

@agentcore-devx-automation agentcore-devx-automation Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Sep 3, 2026
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Sep 3, 2026
gitikavj added 2 commits September 3, 2026 17:51
…thout a TUI

Selecting a project command that has no screen used to tear the TUI down
with NotImplementedError. It now opens a screen that says the command runs
from the command line and shows its help — usage, arguments, options and
the "Parameter details" `--help` appends — from the same Commander help the
CLI prints. Groups (`add`, `export`) open their menu, so every resource
beneath them is reachable the same way. The body scrolls, clamped to the
last full page and re-clamped on resize.

The project menu lists the four screen-backed commands first, then a
"command line only" divider, then the rest, dimmed.

Built on what exists: the project Router declares its screen-backed
children with the same supportedTuiCommands eval and identity use, so
isTuiCommandSupported answers for any node and compile() propagates the
answer to nested commands; RouterScreen partitions on it instead of
filtering (opt-in via showCliOnly); one wildcard route under
agentcore/project replaces Root's hand-written list and
ProjectCommandNotImplementedScreen. Options render through KeyValueTable,
which now lays keys and values out as two boxes so a wrapped value
continues under itself, caps the key column at half the width in layout,
and keeps a gap inside the cap.
…fake

The fake backend in buildDeploy.screen.test.tsx predates
resolveProjectResources landing on refactor, so tsc fails on the base
branch. Add the stub the interface now requires.
@notgitika
notgitika force-pushed the feat/project-cli-only-screens branch from ac2b2ca to 24a3bf6 Compare September 3, 2026 17:54
@notgitika
notgitika marked this pull request as ready for review September 3, 2026 17:55
@github-actions github-actions Bot added size/l PR size: L and removed size/xl PR size: XL size/l PR size: L labels Sep 3, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Sep 3, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Sep 3, 2026
@notgitika

Copy link
Copy Markdown
Contributor Author

flaky unit test i just reran it and it passed

@notgitika
notgitika merged commit 9b78699 into aws:refactor Sep 3, 2026
28 of 33 checks passed
@notgitika
notgitika deleted the feat/project-cli-only-screens branch September 3, 2026 18:20
This was referenced Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants