feat(prompt): show project (folder) name in the interactive prompt#625
Open
adi07das wants to merge 1 commit into
Open
feat(prompt): show project (folder) name in the interactive prompt#625adi07das wants to merge 1 commit into
adi07das wants to merge 1 commit into
Conversation
mpfaffenberger
approved these changes
Jul 15, 2026
Owner
|
This is not redundant with showing the folder? |
## The problem
When you're running multiple Code Puppy sessions across different
terminal tabs/windows (one puppy on repo A, another on repo B, maybe a
third on some quick scratch dir), it's hard to tell at a glance which
puppy is working on which project. Today you have to scroll up through
the session history looking for the last 'cd' or an early message that
names the project.
Just showing the raw cwd path helps a little, but it doesn't survive
navigating into subdirectories: once you're at
'~/workspace/big-monorepo/packages/api/src/handlers', the path is long,
the meaningful bit (the repo name) is buried in the middle, and every
other tab looks the same.
## The fix
Two coordinated additions:
1. **Startup banner** (right after the CODE PUPPY logo, on both
'code-puppy' and 'code-puppy -i'):
Working in project: my-repo (~/workspace/my-repo)
So the very first thing you see when opening a new terminal is
which project this puppy is pointing to.
2. **Interactive prompt** now carries the same project label between
the model badge and the cwd:
Before:
Booster [Code Puppy] [claude-sonnet-4-5] (~/workspace/my-repo) >>>
After:
Booster [Code Puppy] [claude-sonnet-4-5] my-repo (~/workspace/my-repo) >>>
## How the project name is resolved
Preference order (in '_get_project_name'):
1. Basename of the nearest git worktree root. This is the key win:
'cd packages/api/src' inside 'my-repo' still displays 'my-repo',
not 'src'. Multi-tab users can eyeball each label and immediately
know which project it belongs to.
2. Basename of the cwd itself when not inside a git repo.
3. '~' when sitting directly in $HOME.
Git detection reuses the existing 'code_puppy.config._detect_git_toplevel'
helper, which already has a 0.5s subprocess timeout and swallows every
error path, so it's safe to call on every prompt render.
## Implementation notes
- New 'project' entry in 'PROMPT_STYLES' so themes and the persistent
bottom-bar prompt can style it consistently.
- The prompt fragment carries 'class:tui.warning' to pop against the
model's 'class:tui.title'; a local Style rule ('bold ansired')
guarantees visible color even without a theme plugin loaded.
- Startup banner uses Rich markup already available in cli_runner.
- Zero new runtime dependencies. No new subprocess calls beyond the
existing git-toplevel helper.
## Tests
- '_get_project_name': git-rn-git fallback, $HOME, and a
git-detection error case (must never crash the prompt).
- 'get_prompt_with_active_model': renders project name + carries the
new 'class:project class:tui.warning' style token.
- All existing prompt/statusline tests still green (237 pass locally).
Co-authored-by: Aditya Das <Aditya.Das@walmart.com>
adi07das
force-pushed
the
feature/prompt-project-name
branch
from
July 15, 2026 01:03
3062e48 to
9b14f6d
Compare
Author
|
Thanks for the review @mpfaffenberger . Looks like it was done as part of the latest update. However, have repurposed to display the base root folder to provide the user a good reference point. Two coordinated additions:
Working in project: my-repo (~/workspace/my-repo) So the very first thing you see when opening a new terminal is which
Before: After: How the project name is resolved Preference order (in _get_project_name):
|
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.
The problem
When you're running multiple Code Puppy sessions across different terminal tabs/windows (one puppy working on repo A, another on repo B, maybe a third on some quick scratch dir), it's really hard to tell at a glance which puppy is working on which project.
Today, the only way to figure it out is to scroll up through the session history looking for the last 'cd' command or an early message that mentions the project. On busy sessions that can be a lot of scrolling.
The fix
The interactive prompt now displays the name of the folder the puppy is currently pointing to, right between the model badge and the full cwd path.
Before:
Booster [Code Puppy] [claude-sonnet-4-5] (~/workspace/repo-a) >>>
After:
Booster [Code Puppy] [claude-sonnet-4-5] repo-a (~/workspace/repo-a) >>>
Flip to another tab and you immediately see 'repo-b' instead of 'repo-a' without touching the scrollback. The label follows 'cd' — inside
/workspace/repo-a/tests it shows 'tests', in /tmp it shows 'tmp', at $HOME it shows ''.Implementation
Tests
Co-Author: Aditya Das aditya.das@walmart.com