Skip to content

feat(tui): grey out project commands when no project is detected - #2437

Merged
nborges-aws merged 2 commits into
start-here-promptfrom
feat/tui-grey-project-commands
Sep 28, 2026
Merged

nborges-aws merged 2 commits into
start-here-promptfrom
feat/tui-grey-project-commands

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

What

The TUI command menu greys out commands that need a project when the cwd has no AgentCore project: add, remove, deploy, invoke, status, build, and the command line only export, dev, log, traces. Children inherit the state, so the add submenu is greyed too. Greyed commands stay selectable and open the existing "No AgentCore project found" guidance.

  • Router.projectHandlers(...) registers handlers and marks them as needing a project. compile passes the mark down to descendants. isProjectRequired(command) reads it.
  • The root registers createProjectHandlers(...).projectBoundHandlers through it, so the list of project commands has one source.
  • RouterScreen resolves the project with useProject and mutes marked options when there is none.

Stacked on #2433.

Why

Outside a project, the menu listed project commands the same way as commands that work anywhere, with no hint that they would fail.

How tested

  • bun test: 3573 pass, 0 fail. New tests cover the router mark and its inheritance, and the exact set of root commands marked.
  • Built with make and drove the linux-arm64 binary in a pty. Outside a project the six project commands render grey and create/eval do not. Inside a project nothing is grey. Selecting deploy outside a project shows the not-found guidance.

Comment thread src/components/RouterScreen.tsx Outdated
command,
}: RouterScreenProps & { command: Command }) {
const navigate = useNavigate();
const noProject = useProject(core, ctx.value(ProjectKey)).isError;

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.

React query has a built-in retry mechanism for errors IIRC. So the items wouldn't be greyed out until the backoff finishes which could be multiple seconds. We should do something like:

const projectDetected = useQuery({
  queryFn: async () => (await projectManager.resolve(...)) !== undefined,
});

const noProject = projectDetected.data === false

in a shared helper and use in both of our PRs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call on the shared helper. Done in bb2fa42: useNoProjectDetected(core) in ProjectGate.tsx uses your resolve(...) !== undefined shape, and both RootScreen and the menu call it, so the root menu now does one lookup under the project-detected key.

On the retry: in our runtime it does not retry. query-core 5.102.8 uses config.retry ?? (isServer() ? 0 : 3), and isServer is typeof window === "undefined", which holds under Node and Bun. I measured the grey 60 ms after the first menu paint. Your shape still removes the dependency on that default, since a missing project is now data instead of an error.

@nborges-aws
nborges-aws merged commit 8d9faf0 into start-here-prompt Sep 28, 2026
3 checks passed
@nborges-aws
nborges-aws deleted the feat/tui-grey-project-commands branch September 28, 2026 21:03
nborges-aws pushed a commit that referenced this pull request Sep 28, 2026
* feat(tui): grey out project commands when no project is detected

* refactor(tui): share one project-detected lookup between the root banner and the menu
nborges-aws pushed a commit that referenced this pull request Sep 29, 2026
* feat(tui): grey out project commands when no project is detected

* refactor(tui): share one project-detected lookup between the root banner and the menu
tejaskash added a commit that referenced this pull request Sep 30, 2026
* feat(tui): grey out project commands when no project is detected

* refactor(tui): share one project-detected lookup between the root banner and the menu
nborges-aws pushed a commit that referenced this pull request Sep 30, 2026
* feat(tui): grey out project commands when no project is detected

* refactor(tui): share one project-detected lookup between the root banner and the menu
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.

2 participants