Inverted environment variable logic for hardware cursor.
EditCached environment variable lookup for performance.
EditAdded missing changelog entries and updated related files.
EditConfirmed changes and committed only relevant files.
Verifywe added a env var for cursor, we need to invert the logic, only use the hardware cursor if the env var is set
The user wants to change the logic for a cursor-related environment variable. They want to invert it so that the hardware cursor is only used if the env var is set (rather than the current logic which is probably the opposite).
Let me search for cursor-related environment variable handling in the codebase.
>grep -r -i "cursor" --include="*.ts" /Users/badlogic/workspaces/pi-mono/packages --ignore-case | grep -i "env\|ENV" | head -30Found it. Let me read that file to see the current logic.
>grep -n -B 3 -A 5 "PI_NO_HARDWARE_CURSOR" /Users/badlogic/workspaces/pi-mono/packages/tui/src/tui.tsCurrent logic:
PI_NO_HARDWARE_CURSOR === "1", hide the cursor (don't use hardware cursor)The user wants to invert this: only use the hardware cursor if the env var is set. So the new env var should be something like PI_HARDWARE_CURSOR and if it's set, use the hardware cursor; otherwise, hide it.
Let me update this.
Done. The logic is now inverted:
PI_NO_HARDWARE_CURSOR=1 ā hide cursor (opt-out)PI_HARDWARE_CURSOR=1 ā show cursor (opt-in)Let me run the check to make sure there are no issues.
>cd /Users/badlogic/workspaces/pi-mono && npm run check 2>&1Done. Check passes. The logic is now inverted:
PI_HARDWARE_CURSOR=1 enables the hardware cursorDone. Changed PI_NO_HARDWARE_CURSOR=1 (opt-out) to PI_HARDWARE_CURSOR=1 (opt-in). The hardware cursor is now disabled by default and only enabled when the env var is set.
if (process.env.PI_HARDWARE_CURSOR !== "1") { is this look up in env quick?
again
The user is asking if looking up process.env.PI_HARDWARE_CURSOR is quick, and they're concerned about it being called repeatedly (since this is in a render path likely called many times).
In Node.js, process.env lookups are not free - they involve a system call or at least some overhead. For a hot path like cursor positioning that might be called on every render, it would be better to cache the value once at startup or when the TUI is created.
Let me look at how this is structured to see the best place to cache it.
No, process.env lookups have overhead. Let me cache it:
>grep -n "class Tui" /Users/badlogic/workspaces/pi-mono/packages/tui/src/tui.ts | head -3Let me check how the TUI class is structured and where the private fields are defined.
>grep -n "private.*:" /Users/badlogic/workspaces/pi-mono/packages/tui/src/tui.ts | head -20Let me read around line 200 to see the class structure and add the cached property there.
I'll add the cached property along with the other private fields and set it in the constructor.
Now let me update the positionHardwareCursor method to use the cached value instead of looking up the env var.
Now let me run the check to ensure everything is working correctly.
>cd /Users/badlogic/workspaces/pi-mono && npm run check 2>&1Done. The value is now cached at class instantiation time, so there's no repeated process.env lookup on every render.
Done. Cached process.env.PI_HARDWARE_CURSOR === "1" once at class instantiation instead of looking it up on every render.
README.md needs an update in coding agent, and CHANGELOG.md probably as well (likely already has entry for the old way we enabled this)
Let me check the coding-agent README.md and CHANGELOG.md for references to the old env var.
>grep -n "CURSOR\|cursor" /Users/badlogic/workspaces/pi-mono/packages/coding-agent/README.md>grep -n "CURSOR\|cursor" /Users/badlogic/workspaces/pi-mono/packages/coding-agent/CHANGELOG.mdFound it. Line 154 in README.md mentions PI_NO_HARDWARE_CURSOR=1. I need to update that to the new PI_HARDWARE_CURSOR=1 with inverted logic.
Let me read around that line to get context and then check the CHANGELOG for any related entries.
>grep -n -B 2 -A 2 "Unreleased" /Users/badlogic/workspaces/pi-mono/packages/coding-agent/CHANGELOG.md | head -20Let me see the full Unreleased section to check if there's already an entry about this.
I don't see a specific entry about PI_NO_HARDWARE_CURSOR in the unreleased section. Let me search the entire changelog for it.
>grep -n "HARDWARE_CURSOR\|hardware cursor" /Users/badlogic/workspaces/pi-mono/packages/coding-agent/CHANGELOG.mdNo existing entry. Let me update the README and add a changelog entry. The README line needs to be changed from PI_NO_HARDWARE_CURSOR=1 to PI_HARDWARE_CURSOR=1 with updated description. And I need to add a Changed entry in the changelog.
No existing changelog entry. Let me update both files:
Now I need to add a Changed entry to the changelog. Let me add it under [Unreleased].
Wait, this section is under version 0.47.0, not Unreleased. Let me check the structure again and add the Changed section under Unreleased if it doesn't exist.
I see, there's no "Changed" section under [Unreleased]. I accidentally added my entry to the [0.47.0] section. Let me fix this by reverting that change and adding a new Changed section under [Unreleased].
I added it to the wrong section. Let me fix that:
Now I need to add a Changed section under Unreleased, after the Fixed section.
Now let me run the check to make sure everything is fine.
>cd /Users/badlogic/workspaces/pi-mono && npm run check 2>&1All done. Let me summarize the changes.
Done. Updated:
PI_NO_HARDWARE_CURSOR=1 to PI_HARDWARE_CURSOR=1 in IntelliJ section[Unreleased] ā ### Changedfor all commits since the last release, check that we have changelog.md entries in the respective packages. any changelog.md entry in a package != coding-agent that also affects coding-agent should be duplicated in coding-agent. figure out a process to follow, then write a new prompt template called cl.md in .pi/prompts/ so we can repro this process easily in the future before a release
The user wants me to:
Let me start by figuring out what the last release was and getting the commits since then.
>cd /Users/badlogic/workspaces/pi-mono && git tag --sort=-version:refname | head -5The last release is v0.47.0. Let me get all commits since that tag.
>cd /Users/badlogic/workspaces/pi-mono && git log v0.47.0..HEAD --onelineNow let me check each relevant commit and see if they have changelog entries. Let me check the changelogs in each package to see what's already documented.
>cd /Users/badlogic/workspaces/pi-mono && for pkg in ai tui coding-agent; do echo "=== packages/$pkg/CHANGELOG.md [Unreleased] ===" && sed -n '/^## \[Unreleased\]/,/^## \[/p' packages/$pkg/CHANGELOG.md | head -40; doneNow let me analyze commits vs changelog entries:
Commits since v0.47.0:
09d9107d fix(coding-agent): expand tilde in PI_CODING_AGENT_DIR env var (#778) - ā
In coding-agent changelog
12ab69fb fix(tui): decode Kitty CSI-u shifted symbols (#779) - ā
In tui changelog, but this affects coding-agent users too
ba8059a5 fix: sanitize bedrock tool call ids (#781) - ā Missing from ai changelog
c45ea27d feat(coding-agent): display timeout in bash tool UI (#780) - ā Missing from coding-agent changelog
fc3ca545 docs(coding-agent): fix ctx.branch -> ctx.fork in extensions docs - docs only, probably doesn't need changelog
4dbf094b Add PI_NO_HARDWARE_CURSOR env var... - ā
In tui changelog (now updated to PI_HARDWARE_CURSOR), and in coding-agent changelog now
3a475fe1 feat(coding-agent): extension command argument autocomplete (#775) - ā
In coding-agent changelog
35e48ca0 feat(coding-agent): extension command argument autocomplete - same as above, duplicate commit
f900eb59 Fix provider feature detection to use model.provider - ā
In ai changelog
0b625b66 fix(coding-agent): prevent duplicate rendering... - ā
In coding-agent changelog
0438decd docs: add changelog entry for #765 - changelog update itself
898a1a50 fix(coding-agent): prevent duplicate rendering... - same as 10
05d78ea2 Fix session picker 'No sessions found' overflow - ā Missing, affects tui and coding-agent
3f4a6857 feat: add bash-style array slicing for $@ in prompt templates - ā
In coding-agent changelog
43c4a80e docs: document prompt template slicing - docs only
f869cc4a feat: add bash-style array slicing... - same as 14
2836d977 Fix session picker empty state overflow - same as 13
58839959 Fix session picker hint overflow (closes #764) - ā Missing, affects tui and coding-agent
c5cf74e0 feat(coding-agent): export getSh - need to check if this is documented
. Looking at the next entries, I see ellConfig for extensions (#766) which appears to be a continuation - this is missing from coding-agent changelog. Then b11b7d1f coding-agent: update theme-schema.json... is also absent from the changelog. The 589a2ffc Add [Unreleased] section for next cycle is just maintenance.
Several key gaps remain: ba8059a5 fix: sanitize bedrock tool call ids (#781) from the ai package, c45ea27d feat(coding-agent): display timeout in bash tool UI (#780) for coding-agent, and duplicate session picker fixes that need to be added to both tui and coding-agent changelogs.
Let me analyze which commits are missing changelog entries:
>cd /Users/badlogic/workspaces/pi-mono && git show ba8059a5 --stat | head -10>cd /Users/badlogic/workspaces/pi-mono && git show c45ea27d --stat | head -10>cd /Users/badlogic/workspaces/pi-mono && git show 05d78ea2 --stat | head -10>cd /Users/badlogic/workspaces/pi-mono && git show 58839959 --stat | head -10>cd /Users/badlogic/workspaces/pi-mono && git show c5cf74e0 --stat | head -10>cd /Users/badlogic/workspaces/pi-mono && git show b11b7d1f --stat | head -10Now I have a clear picture. Let me also check if the tui changelog entries need to be duplicated to coding-agent:
PI_NO_HARDWARE_CURSOR=1 ā Already handled (we changed it to PI_HARDWARE_CURSOR and added to coding-agent)packages/ai/CHANGELOG.md:
ba8059a5 fix: sanitize bedrock tool call ids (#781) by @pjtf93packages/coding-agent/CHANGELOG.md:
c45ea27d feat(coding-agent): display timeout in bash tool UI (#780) by @dannote05d78ea2 Fix session picker 'No sessions found' overflow - internal fix, combined with #76458839959 Fix session picker hint overflow (closes #764) - internal fixc5cf74e0 feat(coding-agent): export getShellConfig for extensions (#766) by @dannoteb11b7d1f coding-agent: update theme-schema.json... by @scutifer (#763)Also need to duplicate from tui:
Let me also check if ai package fix affects coding-agent (bedrock tool call ids) - yes it does, since coding-agent uses ai package.
Let me update the changelogs.
Now I have a clear picture. Missing entries:
packages/ai:
ba8059a5 - sanitize bedrock tool call ids (#781)packages/coding-agent:
c45ea27d - display timeout in bash tool UI (#780)58839959 - session picker hint overflow (#764)c5cf74e0 - export getShellConfig for extensions (#766)b11b7d1f - update theme-schema.json (#763)Let me add these:
Let me add the bedrock fix to ai changelog.
Now let me update coding-agent CHANGELOG. I need to add:
Now add the fixed entries.
Now I should also update the tui changelog to fix the PI_NO_HARDWARE_CURSOR entry since we changed it.
Now let me run check and then create the prompt template.
>cd /Users/badlogic/workspaces/pi-mono && npm run check 2>&1Now let me check if .pi/prompts/ exists and create the prompt template.
>ls -la /Users/badlogic/workspaces/pi-mono/.pi/prompts/ 2>/dev/null || echo "Directory does not exist"Let me check the existing templates to understand the format.
Good, now I understand the format. Let me create the cl.md prompt template for the changelog audit process.
Let me verify the final state of all changelogs to make sure everything is in order.
>cd /Users/badlogic/workspaces/pi-mono && for pkg in ai tui coding-agent; do echo "=== packages/$pkg/CHANGELOG.md [Unreleased] ===" && sed -n '/^## \[Unreleased\]/,/^## \[/p' packages/$pkg/CHANGELOG.md | head -30; doneAll changelogs look good. Let me also verify there's no issue reference that's wrong. I noticed #768 in the PI_CODING_AGENT_DIR fix has the wrong PR link - it says #768 but links to #778. Let me check and fix that.
I see a typo in the existing entry. Let me fix it:
Let me check if there's a #779 PR for Kitty, or if it should just be an issue. Let me also check the attribution for the tui changelog entry on Kitty CSI-u.
>cd /Users/badlogic/workspaces/pi-mono && git log --oneline | grep -i "779\|kitty" | head -5The #779 is indeed a PR. Let me check who authored it.
>cd /Users/badlogic/workspaces/pi-mono && git show 12ab69fb --format="%an <%ae>" -sLet me get the GitHub username for attribution.
>gh pr view 779 --repo badlogic/pi-mono --json author -q '.author.login' 2>/dev/null || echo "not found"Let me update the tui changelog with proper attribution, and also fix the coding-agent entry.
Now fix the coding-agent entry too.
Good. Now let me also check the #774 entry in ai changelog - it's listed as an issue but the fix was done internally, so it might need a different format.
>cd /Users/badlogic/workspaces/pi-mono && git log --oneline | grep "774" | head -3It's linked to an issue, not a PR. Let me check if it was a PR or internal fix.
>cd /Users/badlogic/workspaces/pi-mono && git log --oneline | grep -i "provider.*detection\|model.provider" | head -3This was an internal fix (no PR number in the commit message). The changelog entry correctly uses "issues" URL. That's fine.
Now let me run the final check and summarize.
>cd /Users/badlogic/workspaces/pi-mono && npm run check 2>&1All done. Let me summarize everything.
Done. Summary of changes:
Added missing changelog entries:
| Package | Commit | Entry |
|---|---|---|
| ai | ba8059a5 | Bedrock tool call ID sanitization (#781) |
| tui | 12ab69fb | Kitty CSI-u shifted symbols fix (#779) |
| coding-agent | c45ea27d | Bash tool timeout display (#780) |
| coding-agent | 58839959 | Session picker hint overflow (#764) |
| coding-agent | c5cf74e0 | Export getShellConfig (#766) |
| coding-agent | b11b7d1f | Theme schema update (#763) |
Cross-package duplications (to coding-agent):
Fixes:
PI_NO_HARDWARE_CURSOR entry to PI_HARDWARE_CURSOR (Changed section)#768 ā #778 in PI_CODING_AGENT_DIR entryCreated prompt template: .pi/prompts/cl.md for future changelog audits before releases.
>code .pi/prompts/cl.mdok, commit the files you changed, do not touch the other changed files
Let me check which files I changed and commit only those.
>cd /Users/badlogic/workspaces/pi-mono && git status --shortThe files I changed are:
Let me commit only these files.
>cd /Users/badlogic/workspaces/pi-mono && git add packages/ai/CHANGELOG.md packages/coding-agent/CHANGELOG.md packages/coding-agent/README.md packages/tui/CHANGELOG.md packages/tui/src/tui.ts .pi/prompts/cl.md && git commit -m "chore: audit changelog entries for v0.47.0, add cl.md prompt template
- Add missing changelog entries for commits since v0.47.0
- Cross-duplicate ai/tui fixes to coding-agent changelog
- Change PI_NO_HARDWARE_CURSOR to PI_HARDWARE_CURSOR (opt-in)
- Fix typo in PI_CODING_AGENT_DIR changelog entry
- Add .pi/prompts/cl.md for pre-release changelog audits"Done. Committed only the files I modified.
Committed 6 files: 3 changelogs, README, tui.ts, and the new cl.md prompt template.