pi-usereq 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,7 +62,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
62
62
  - **CTN-010**: MUST execute offline harness flows without requiring pi.dev services or `docs/pi.dev/agent-document-manifest.json`.
63
63
  - **CTN-011**: MUST store bundled prompt, instruction, template, and guideline resources under `src/resources/{prompts,instructions,templates,guidelines}` and install them under `<installation-path>/resources/{prompts,instructions,templates,guidelines}`.
64
64
  - **CTN-012**: MUST NOT persist derived `base-path`, `git-path`, `parent-path`, `base-dir`, `context-path`, `worktree-dir`, or `worktree-path` in `.pi-usereq.json`.
65
- - **CTN-013**: MUST default `DEBUG_ENABLED=disable`, `DEBUG_LOG_FILE=debug.json`, `DEBUG_STATUS_CHANGES=disable`, `DEBUG_WORKFLOW_EVENTS=disable`, `DEBUG_LOG_ON_STATUS=running`, `DEBUG_ENABLED_TOOLS=[]`, and `DEBUG_ENABLED_PROMPTS=[]` in persisted project configuration.
65
+ - **CTN-013**: MUST default `DEBUG_ENABLED=disable`, `DEBUG_LOG_FILE=/tmp/PI-useReq.json`, `DEBUG_STATUS_CHANGES=disable`, `DEBUG_WORKFLOW_EVENTS=disable`, `DEBUG_LOG_ON_STATUS=running`, `DEBUG_ENABLED_TOOLS=[]`, and `DEBUG_ENABLED_PROMPTS=[]` in persisted project configuration.
66
66
  - **CTN-014**: MUST serialize every configured or derived path without a trailing `/`.
67
67
  - **CTN-015**: MUST reserve `*-path` names for absolute paths and `*-dir` names for relative paths.
68
68
  - **CTN-016**: MUST NOT modify any path under `docs/` during analysis, implementation, verification, or bug fixing.
@@ -115,7 +115,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
115
115
  - **REQ-065**: MUST make `scripts/pi-usereq-debug.sh tool` accept `--args <text>` by forwarding a JSON object through `--params`, while preserving direct `--params <json>` passthrough.
116
116
  - **REQ-006**: MUST provide a `pi-usereq` menu that edits project directories, git automation, static-check settings, tools, notifications, and debug settings, exposes `Show configuration`, confirms reset actions, saves every change immediately, and never renders `Save and close`.
117
117
  - **REQ-236**: MUST persist `DEBUG_ENABLED` with allowed values `enable` and `disable`, defaulting to `disable`.
118
- - **REQ-237**: MUST persist `DEBUG_LOG_FILE` as a non-empty string defaulting to `debug.json`, and resolve relative paths against the original project base when writing logs.
118
+ - **REQ-237**: MUST persist `DEBUG_LOG_FILE` as a non-empty string defaulting to `/tmp/PI-useReq.json`, and resolve relative paths against the original project base when writing logs.
119
119
  - **REQ-238**: MUST persist `DEBUG_LOG_ON_STATUS` with allowed values `any`, `idle`, `checking`, `running`, `merging`, and `error`, defaulting to `running`.
120
120
  - **REQ-239**: MUST persist enabled debug-tool names and enabled debug-prompt names as normalized arrays defaulting to empty.
121
121
  - **REQ-254**: MUST persist `DEBUG_STATUS_CHANGES` with allowed values `enable` and `disable`, defaulting to `disable`.
@@ -152,9 +152,9 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
152
152
  - **REQ-251**: MUST default `static-check.Python`, `JavaScript`, and `TypeScript` to `enabled=enable` with their documented Command checker entries.
153
153
  - **REQ-252**: MUST default every other supported `static-check.<language>` entry to `enabled=disable` with `checkers=[]`.
154
154
  - **REQ-009**: MUST refresh shared runtime path context, apply configured startup tools, reset workflow state to `idle` for `session_start` reasons `startup|new|reload`, and publish single-line `pi-usereq` status text.
155
- - **REQ-109**: MUST make the single-line status bar render the explicit runtime `current-path` value from `context-path` and omit `base`, `docs`, `src`, and `tests` path fields.
155
+ - **REQ-109**: MUST omit `current-path`, `base`, `docs`, `src`, and `tests` path fields from the single-line status bar.
156
156
  - **REQ-111**: MUST omit prompt-delivery mode fields from the single-line status bar.
157
- - **REQ-112**: MUST render status-bar field names with the active theme `accent` token and non-error field values with the active theme `warning` token.
157
+ - **REQ-112**: MUST render status-bar field names with the active theme `accent` token and non-error field values with the active theme `warning` token unless a field-specific requirement overrides the value token.
158
158
  - **REQ-113**: MUST register shared event wrappers for `resources_discover`, `session_start`, `session_before_switch`, `session_before_fork`, `session_before_compact`, `session_compact`, and `session_shutdown`.
159
159
  - **REQ-114**: MUST register shared event wrappers for `session_before_tree`, `session_tree`, `context`, `before_provider_request`, `before_agent_start`, `agent_start`, and `agent_end`.
160
160
  - **REQ-115**: MUST register shared event wrappers for `turn_start`, `turn_end`, `message_start`, `message_update`, `message_end`, `tool_execution_start`, and `tool_execution_update`.
@@ -162,16 +162,18 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
162
162
  - **REQ-117**: MUST route every intercepted hook through `updateExtensionStatus` with the originating hook name and event payload, even when no hook-specific side effect exists.
163
163
  - **REQ-118**: MUST obtain latest context-usage facts from `ctx.getContextUsage()` or an equivalent runtime API and store them in extension session state.
164
164
  - **REQ-119**: MUST refresh stored context-usage facts during `session_start` and after intercepted events before rebuilding the status bar when newer data is available.
165
- - **REQ-120**: MUST render single-line status fields in this order: `status`, `current-path`, `context`, `elapsed`, `sound`.
166
- - **REQ-121**: MUST render `context` immediately after `current-path` with separator ` • ` and one fixed-width gauge icon.
167
- - **REQ-122**: MUST map `context` usage to `▕_▏`, `▕▂▏`, `▕▄▏`, `▕▆▏`, and `▕█▏` for `0`, `>0-25`, `>25-50`, `>50-90`, and `>90-100` percent bands.
165
+ - **REQ-120**: MUST render single-line status fields in this order: `status`, `branch`, `context`, `elapsed`, `sound`.
166
+ - **REQ-121**: MUST render `branch` immediately after `status` with separator ` • ` and the active git branch name.
167
+ - **REQ-283**: MUST resolve `branch` from the current `context-path` git HEAD during every status-bar rebuild so worktree switches and base-path restoration update immediately.
168
+ - **REQ-284**: MUST render `context` immediately after `branch` with separator ` • ` and one fixed-width gauge icon.
169
+ - **REQ-122**: MUST map `context` usage to `▕_▏`, `▕▂▏`, `▕▄▏`, `▕▆▏`, and `▕█▏` for `0`, `>0-<25`, `>=25-<50`, `>=50-<75`, and `>=75` percent bands.
168
170
  - **REQ-123**: MUST render `elapsed` immediately after `context` as `⏱︎ <active> ⚑ <last> ⌛︎<total>`.
169
171
  - **REQ-124**: MUST render `⏱︎ --:--` when no prompt is active, and `⚑ --:--` plus `⌛︎--:--` until the corresponding timers receive a normally completed prompt duration.
170
172
  - **REQ-125**: MUST render timed `elapsed` segments as `M:SS`, keep minutes unbounded above 59, zero-pad seconds to two digits, and preserve `⚑` plus `⌛︎` when escape-triggered cancellation ends the active run.
171
- - **REQ-126**: MUST render `context` gauge icons with theme `warning`, except the overflow state uses theme `error`.
172
- - **REQ-127**: MUST render `context` as blinking theme `warning` `▕█▏` when normalized usage is `>90-100` percent and terminal blink control is supported.
173
- - **REQ-233**: MUST render `context` as blinking theme `error` `▕█▏` when normalized usage exceeds 100 percent and terminal blink control is supported.
174
- - **REQ-128**: MUST render `context` as theme `error` `▕█▏` when normalized usage exceeds 100 percent and terminal blink control is unavailable.
173
+ - **REQ-126**: MUST render `context` gauge icons in default terminal color below 90 percent and theme `error` at 90 percent or above.
174
+ - **REQ-127**: MUST render `context` as non-blinking theme `error` `▕█▏` when normalized usage is `>=90-<100` percent.
175
+ - **REQ-233**: MUST render `context` as blinking theme `error` `▕█▏` when normalized usage is `>=100` percent and terminal blink control is supported.
176
+ - **REQ-128**: MUST render `context` as theme `error` `▕█▏` when normalized usage is `>=100` percent and terminal blink control is unavailable.
175
177
  - **REQ-131**: MUST persist a sound level with allowed values `none`, `low`, `mid`, and `high`, defaulting to `none`.
176
178
  - **REQ-132**: MUST execute the configured sound command when the corresponding prompt-end sound event toggle is enabled and the sound level is not `none`.
177
179
  - **REQ-133**: MUST persist configurable shell-command strings for sound levels `low`, `mid`, and `high`, and MUST substitute `%%INSTALLATION_PATH%%` with the runtime extension installation path before execution.
@@ -203,7 +205,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
203
205
  - **REQ-190**: MUST label top-level rows as `Document directory`, `Source-code directories`, `Unit tests directory`, `Auto git commit`, `Git worktree`, `Worktree prefix`, `Language static code checkers`, `Enable tools`, `Notifications`, `Debug`, and `Show configuration`.
204
206
  - **REQ-191**: MUST order top-level rows as `Document directory`, `Source-code directories`, `Unit tests directory`, `Auto git commit`, `Git worktree`, `Worktree prefix`, `Language static code checkers`, `Enable tools`, `Notifications`, `Debug`, `Show configuration`, and `Reset defaults`.
205
207
  - **REQ-192**: MUST preserve the selected settings-menu row after toggling or editing a setting value.
206
- - **REQ-193**: MUST append `Reset defaults` as the final row of every configuration menu and descendant selector menu, and MUST NOT render `Save and close`.
208
+ - **REQ-193**: MUST append `Reset defaults` as a final row without right-aligned value text in every configuration menu and descendant selector menu, and MUST NOT render `Save and close`.
207
209
  - **REQ-194**: MUST make top-level `Reset defaults` show changed values with previous and next values, require explicit confirmation, restore full-tree defaults, and save immediately.
208
210
  - **REQ-195**: MUST make non-top-level `Reset defaults` show changed values with previous and next values, require explicit confirmation, restore subtree defaults, and save immediately.
209
211
  - **REQ-196**: MUST persist a global command-notify enable flag defaulting to disabled.
@@ -222,10 +224,10 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
222
224
  - **REQ-206**: MUST derive `worktree-dir` as `<prefix><project>-<sanitized-branch>-<YYYYMMDDHHMMSS>` and `worktree-path` as `<parent-path>/<worktree-dir>/<base-dir>` when worktrees are enabled.
223
225
  - **REQ-271**: MUST create one dedicated worktree under `parent-path`, fork the current active session into an execution session file whose header cwd equals `worktree-path`, and switch the active pi CLI session to that file before agent start.
224
226
  - **REQ-207**: MUST keep `context-path`, `ctx.cwd`, and `process.cwd()` at `base-path` when worktree creation is disabled.
225
- - **REQ-208**: MUST restore the original session-backed `base-path`, fast-forward-only merge from `base-path`, and delete the worktree plus branch after successful orchestrated session closure.
227
+ - **REQ-208**: MUST restore the original session-backed `base-path`, fast-forward-only merge from `base-path`, delete the worktree plus branch, and preserve the successful worktree execution transcript in the client-visible session after closure.
226
228
  - **REQ-209**: MUST restore the original session-backed `base-path`, notify the pi CLI of closure failure, and retain the worktree plus branch when orchestrated session closure is interrupted, failed, aborted, or incomplete.
227
229
  - **REQ-221**: MUST maintain one prompt-orchestration state machine with states `idle`, `checking`, `running`, `merging`, and `error`.
228
- - **REQ-222**: MUST render `status` immediately before `base` as the current prompt-orchestration state and refresh it on every internal or pi CLI state transition.
230
+ - **REQ-222**: MUST render `status` as the first single-line status field and refresh it on every internal or pi CLI state transition.
229
231
  - **REQ-223**: MUST render `status:error` with theme `error` plus terminal blink when supported, and other `status` values with the existing non-error status-bar convention.
230
232
  - **REQ-224**: MUST reject a `req-<prompt>` command before any operation when workflow state is not `idle`, surfacing the error to pi CLI.
231
233
  - **REQ-225**: MUST transition workflow state to `checking` after the `idle` gate and keep it there through required-doc checks, worktree generation, worktree verification, and prompt handoff preparation.
@@ -332,7 +334,6 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
332
334
  - **REQ-144**: MUST default `PI_NOTIFY_SOUND_HIGH_CMD` to `paplay --volume=65535 %%INSTALLATION_PATH%%/resources/sounds/Soft-high-tech-notification-sound-effect.mp3`.
333
335
  - **REQ-145**: MUST derive static `git-path` during bootstrap from `base-path` and repository ancestry rules, ignoring project-configuration JSON values.
334
336
  - **REQ-146**: MUST NOT read or persist `base-path` or `git-path` in project-configuration JSON.
335
- - **REQ-148**: MUST render status-bar `current-path` as dynamic `context-path`, home-relative with `~` when applicable.
336
337
  - **REQ-149**: MUST label notification settings actions as `Notify command`, `Enable sound`, `Sound toggle hotkey bind`, `Sound command (low|mid|high vol.)`, `Pushover User Key/Delivery Group Key`, and `Pushover Token/API Token Key`.
337
338
  - **REQ-150**: MUST omit overview rows and reference-only actions from the main, notification, startup-tool, and static-check configuration menus.
338
339
  - **REQ-151**: MUST render `pi-usereq`, notification, static-check, and startup-tool menus with left-aligned labels and right-aligned current values using the active CLI settings-list theme semantics.
@@ -354,23 +355,25 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
354
355
  - **TST-078**: MUST verify default configuration persists documented per-language `enabled` flags and checker lists for `C`, `C++`, `Python`, `JavaScript`, and `TypeScript`.
355
356
  - **TST-079**: MUST verify `files-static-check` and `static-check` execute zero checkers and expose empty configured-checker lists when the target language `enabled=disable`.
356
357
  - **TST-006**: MUST verify `session_start` activates configured startup tools, resets workflow state to `idle` for `startup|new|reload`, and updates the single-line `pi-usereq` status bar.
357
- - **TST-031**: MUST verify the status bar renders `status` before the home-relative `current-path`, omits `base`, `docs`, `src`, `tests`, `git`, and `tools`, and preserves documented field-value theme separation.
358
+ - **TST-031**: MUST verify the status bar renders `status` before `branch`, omits `current-path`, `base`, `docs`, `src`, `tests`, `git`, and `tools`, and preserves documented field-value theme separation.
358
359
  - **TST-032**: MUST verify extension registration installs wrappers for all documented lifecycle hooks and routes replayed hook payloads through `updateExtensionStatus`.
359
- - **TST-033**: MUST verify the status bar renders ordered `status`, `current-path`, `context`, `elapsed`, and `sound` fields plus the documented icon-based `context` gauge thresholds.
360
+ - **TST-033**: MUST verify the status bar renders ordered `status`, `branch`, `context`, `elapsed`, and `sound` fields plus the documented icon-based `context` gauge thresholds.
360
361
  - **TST-037**: MUST verify the `Notifications` menu persists notification and sound settings through `Notification events` and `Sound events` submenus using the documented labels, order, reset-confirmation flows, immediate-save behavior, and no `Save and close` rows.
361
362
  - **TST-038**: MUST verify the sound-toggle shortcut cycles persisted sound levels and refreshes the status bar with the updated `sound` field.
362
363
  - **TST-047**: MUST verify the `Notifications` menu exposes `Pushover events` before direct Pushover settings, keeps `Enable pushover` dimmed and locked until both credential fields are non-empty, and persists Pushover event and credential values.
363
364
  - **TST-072**: MUST verify `Pushover text` displays escaped control sequences in menus and decodes the documented escape sequences from input before persistence.
364
365
  - **TST-048**: MUST verify native Pushover requests honor global enable, completed/interrupted/failed Pushover toggles, credentials, priority, title, and text placeholder substitution including `%%RESULT%%` for enabled prompt-end outcomes.
365
- - **TST-049**: MUST verify the status bar renders ordered `status`, `current-path`, `context`, `elapsed`, and `sound` fields and appends `sound:<level>`.
366
+ - **TST-049**: MUST verify the status bar renders ordered `status`, `branch`, `context`, `elapsed`, and `sound` fields and appends `sound:<level>`.
366
367
  - **TST-050**: MUST verify `PI_NOTIFY_CMD` placeholder substitution including `%%RESULT%%` and routing honor global notify enable plus completed/interrupted/failed notify toggles.
367
368
  - **TST-034**: MUST verify `ctx.getContextUsage()` snapshots refresh status updates and `elapsed` preserves `⚑` plus `⌛︎` across escape-triggered cancellation.
368
369
  - **TST-062**: MUST verify `Show configuration` saves pending config, closes the active configuration menu tree, and writes the persisted `.pi-usereq.json` file text into the editor.
369
370
  - **TST-063**: MUST verify `⚑` plus `⌛︎` survive `session_start` reason `new` and reset on `session_start` reason `reload`.
370
- - **TST-045**: MUST verify default configuration enables auto git commit, disables debug, notify, and Pushover globally, initializes sound to `none`, applies the documented debug and notification defaults, and persists the documented notify and Pushover templates.
371
+ - **TST-045**: MUST verify default configuration enables auto git commit, disables debug, notify, and Pushover globally, initializes sound to `none`, sets `DEBUG_LOG_FILE=/tmp/PI-useReq.json`, and persists the documented notify and Pushover templates.
371
372
  - **TST-051**: MUST verify sound routing honors the selected sound state and completed/interrupted/failed sound toggles.
372
- - **TST-035**: MUST verify unavailable or 0-percent context usage renders `▕_▏` with the theme `warning` token.
373
- - **TST-036**: MUST verify context usage `>90-100` renders blinking warning `▕█▏`, and `>100` renders blinking error `▕█▏` or non-blinking error `▕█▏` when blink control is unavailable.
373
+ - **TST-035**: MUST verify unavailable or 0-percent context usage renders `▕_▏` with default terminal color.
374
+ - **TST-096**: MUST verify context usage `>0-<25`, `>=25-<50`, `>=50-<75`, and `>=75-<90` render `▕▂▏`, `▕▄▏`, `▕▆▏`, and `▕█▏` in default terminal color.
375
+ - **TST-036**: MUST verify context usage `>=90-<100` renders non-blinking error `▕█▏`, and `>=100` renders blinking error `▕█▏` or non-blinking error `▕█▏` when blink control is unavailable.
376
+ - **TST-095**: MUST verify status-bar `branch` resolves from current `context-path` git HEAD and refreshes across worktree switches plus base-path restoration.
374
377
  - **TST-043**: MUST verify configuration menus reuse the active CLI settings-list theme semantics for labels, values, descriptions, cursor, and hints.
375
378
  - **TST-009**: MUST verify `package.json` declares ESM packaging, the single pi extension entry, and the standard `test`, `test:watch`, and `cli` scripts.
376
379
  - **TST-010**: MUST verify `tsconfig.json` declares `NodeNext`, `strict`, `noEmit`, and includes both `src/**/*.ts` and `tests/**/*.ts`.
@@ -400,7 +403,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
400
403
  - **TST-042**: MUST verify `package.json` keeps `name` equal to `pi-usereq` so npm publication resolves to `https://www.npmjs.com/package/pi-usereq`.
401
404
  - **TST-044**: MUST verify `package.json` keeps npm provenance metadata aligned to the canonical GitHub repository, issues URL, and README homepage.
402
405
  - **TST-040**: MUST verify `.pi-usereq.json` omits derived static and dynamic path fields while runtime path context and status rendering still derive them correctly.
403
- - **TST-041**: MUST verify the `pi-usereq` menu uses the documented labels and order, every configuration menu ends with `Reset defaults` only, dims locked git or debug rows, and preserves the documented summary rows.
406
+ - **TST-041**: MUST verify the `pi-usereq` menu uses the documented labels and order, every configuration menu ends with `Reset defaults` without right-aligned value text, dims locked git or debug rows, and preserves the documented summary rows.
404
407
  - **TST-073**: MUST verify the `Debug` submenu persists `DEBUG_ENABLED`, `DEBUG_STATUS_CHANGES`, `DEBUG_WORKFLOW_EVENTS`, `DEBUG_LOG_FILE`, `DEBUG_LOG_ON_STATUS`, and per-item debug toggles through immediate-save, reset-confirmation, and focus-preserving re-render flows.
405
408
  - **TST-074**: MUST verify selected custom and embedded tool debug toggles append JSON entries with tool name, workflow state, input, result, and error flag, honoring `DEBUG_ENABLED` plus `DEBUG_LOG_ON_STATUS`.
406
409
  - **TST-075**: MUST verify selected `req-*` debug toggles append JSON entries for required-doc checks, worktree creation, fast-forward merge, worktree deletion, `workflow_state`, and `DEBUG_WORKFLOW_EVENTS`-gated workflow events across successful and failing prompt runs.
@@ -473,9 +473,14 @@
473
473
  - `shouldResetWorkflowStateOnSessionStart(...)`: detect `startup|new|reload` workflow-reset boundaries [`src/core/extension-status.ts`]
474
474
  - `persistElapsedState(...)`: mirror completed timers into process-scoped persistence [`src/core/extension-status.ts`]
475
475
  - `syncPiUsereqStatusTicker(...)`: start or stop the live elapsed ticker [`src/core/extension-status.ts`]
476
- - `renderPiUsereqStatus(...)`: render the status/current-path/context/elapsed/sound footer with CLI-theme token overlays [`src/core/extension-status.ts`]
476
+ - `renderPiUsereqStatus(...)`: render the status/branch/context/elapsed/sound footer with CLI-theme token overlays [`src/core/extension-status.ts`]
477
477
  - `createStatusThemeAdapter(...)`: constrain status rendering to CLI-supported `accent`, `warning`, `dim`, and `error` theme tokens [`src/core/extension-status.ts`]
478
- - `buildPiUsereqStatusText(...)`: compose the single-line footer payload with workflow state, current-path, elapsed semantics, and sound status fields [`src/core/extension-status.ts`]
478
+ - `resolveStatusBranchValue(...)`: resolve the active git branch from the current context cwd before footer rendering [`src/core/extension-status.ts`]
479
+ - `resolveRuntimeGitBranchName(...)`: resolve the active git branch for the current execution path [`src/core/runtime-project-paths.ts`]
480
+ - `resolveRuntimeGitPath(...)`: resolve the runtime git root for the active execution path [`src/core/runtime-project-paths.ts`]
481
+ - `isInsideGitRepo(...)`: test git work-tree membership [`src/core/runtime-project-paths.ts`]
482
+ - `resolveGitRoot(...)`: resolve repository root [`src/core/runtime-project-paths.ts`]
483
+ - `buildPiUsereqStatusText(...)`: compose the single-line footer payload with workflow state, branch, context gauge, elapsed semantics, and sound status fields [`src/core/extension-status.ts`]
479
484
  - `formatStatusField(...)`: render one colored text field [`src/core/extension-status.ts`]
480
485
  - `formatRenderedStatusField(...)`: render one pre-styled field [`src/core/extension-status.ts`]
481
486
  - `formatWorkflowStateValue(...)`: render the workflow-state value with error highlighting when required [`src/core/extension-status.ts`]
@@ -528,9 +533,14 @@
528
533
  - `buildSettingItems(...)`: map menu choices into settings-list rows, apply optional dim tones, and disable non-selectable actions [`src/core/settings-menu.ts`]
529
534
  - `saveProjectConfig(...)`: persist menu updates on save-and-close [`src/index.ts`]
530
535
  - `setPiUsereqStatusConfig(...)`: cache the saved config for footer rendering [`src/core/extension-status.ts`]
531
- - `renderPiUsereqStatus(...)`: render the current-path/context/elapsed/sound footer after save-and-close with CLI-theme token overlays [`src/core/extension-status.ts`]
536
+ - `renderPiUsereqStatus(...)`: render the status/branch/context/elapsed/sound footer after save-and-close with CLI-theme token overlays [`src/core/extension-status.ts`]
532
537
  - `createStatusThemeAdapter(...)`: constrain status rendering to CLI-supported `accent`, `warning`, `dim`, and `error` theme tokens [`src/core/extension-status.ts`]
533
- - `buildPiUsereqStatusText(...)`: compose the single-line footer payload with current-path, consolidated elapsed semantics, and sound status fields [`src/core/extension-status.ts`]
538
+ - `resolveStatusBranchValue(...)`: resolve the active git branch from the current context cwd before footer rendering [`src/core/extension-status.ts`]
539
+ - `resolveRuntimeGitBranchName(...)`: resolve the active git branch for the current execution path [`src/core/runtime-project-paths.ts`]
540
+ - `resolveRuntimeGitPath(...)`: resolve the runtime git root for the active execution path [`src/core/runtime-project-paths.ts`]
541
+ - `isInsideGitRepo(...)`: test git work-tree membership [`src/core/runtime-project-paths.ts`]
542
+ - `resolveGitRoot(...)`: resolve repository root [`src/core/runtime-project-paths.ts`]
543
+ - `buildPiUsereqStatusText(...)`: compose the single-line footer payload with workflow state, branch, context gauge, consolidated elapsed semantics, and sound status fields [`src/core/extension-status.ts`]
534
544
  - `formatStatusField(...)`: render one colored text field [`src/core/extension-status.ts`]
535
545
  - `formatRenderedStatusField(...)`: render one pre-styled field [`src/core/extension-status.ts`]
536
546
  - `formatContextUsageBar(...)`: render the icon-based context gauge [`src/core/extension-status.ts`]
@@ -544,7 +554,7 @@
544
554
  - `buildPiNotifyEventLauncherChoice(...)`: serialize one event-submenu launcher row with a compact enabled-toggle summary [`src/index.ts`]
545
555
  - `buildPiNotifyPushoverRows(...)`: serialize direct Pushover rows plus the shared event-submenu launcher [`src/index.ts`]
546
556
  - `configurePiNotifyEventMenu(...)`: interactive completed/interrupted/failed event editor for one notification transport [`src/index.ts`]
547
- - `buildPiNotifyEventMenuChoices(...)`: serialize shared event rows plus submenu reset/save actions [`src/index.ts`]
557
+ - `buildPiNotifyEventMenuChoices(...)`: serialize shared event rows plus the submenu reset action [`src/index.ts`]
548
558
  - `resetPiNotifyEventMenuToDefaults(...)`: restore default event toggles for one notification transport [`src/index.ts`]
549
559
  - `resolvePiNotifyEventLabel(...)`: map one event-toggle key to the human-readable menu label [`src/index.ts`]
550
560
  - `togglePiNotifyFlag(...)`: toggle one persisted boolean notification setting [`src/index.ts`]
@@ -627,9 +637,14 @@
627
637
  - `transitionPromptWorkflowState(...)`: update workflow state and append gated `workflow_state` debug entries only after the transition completes [`src/index.ts`]
628
638
  - `setPiUsereqWorkflowState(...)`: update workflow state before prompt preflight, prompt handoff, or command-side failure [`src/core/extension-status.ts`]
629
639
  - `logPromptWorkflowStateChange(...)`: append selected prompt workflow-transition debug entries [`src/index.ts`]
630
- - `renderPiUsereqStatus(...)`: render the status/current-path/context/elapsed/sound footer with CLI-theme token overlays [`src/core/extension-status.ts`]
640
+ - `renderPiUsereqStatus(...)`: render the status/branch/context/elapsed/sound footer with CLI-theme token overlays [`src/core/extension-status.ts`]
631
641
  - `createStatusThemeAdapter(...)`: constrain status rendering to CLI-supported `accent`, `warning`, `dim`, and `error` theme tokens [`src/core/extension-status.ts`]
632
- - `buildPiUsereqStatusText(...)`: compose the single-line footer payload with workflow state, current-path, elapsed semantics, and sound status fields [`src/core/extension-status.ts`]
642
+ - `resolveStatusBranchValue(...)`: resolve the active git branch from the current context cwd before footer rendering [`src/core/extension-status.ts`]
643
+ - `resolveRuntimeGitBranchName(...)`: resolve the active git branch for the current execution path [`src/core/runtime-project-paths.ts`]
644
+ - `resolveRuntimeGitPath(...)`: resolve the runtime git root for the active execution path [`src/core/runtime-project-paths.ts`]
645
+ - `isInsideGitRepo(...)`: test git work-tree membership [`src/core/runtime-project-paths.ts`]
646
+ - `resolveGitRoot(...)`: resolve repository root [`src/core/runtime-project-paths.ts`]
647
+ - `buildPiUsereqStatusText(...)`: compose the single-line footer payload with workflow state, branch, context gauge, elapsed semantics, and sound status fields [`src/core/extension-status.ts`]
633
648
  - `formatStatusField(...)`: render one colored text field [`src/core/extension-status.ts`]
634
649
  - `formatRenderedStatusField(...)`: render one pre-styled field [`src/core/extension-status.ts`]
635
650
  - `formatWorkflowStateValue(...)`: render the workflow-state value with error highlighting when required [`src/core/extension-status.ts`]
@@ -815,9 +830,14 @@
815
830
  - `persistPromptCommandState(...)`: mirror workflow state plus pending or active prompt execution plans into process-scoped persistence [`src/core/extension-status.ts`]
816
831
  - `writePersistedPromptCommandRuntimeState(...)`: store workflow state plus pending or active prompt execution plans on `globalThis` [`src/core/prompt-command-state.ts`]
817
832
  - `syncPiUsereqStatusTicker(...)`: start or stop the live elapsed ticker [`src/core/extension-status.ts`]
818
- - `renderPiUsereqStatus(...)`: render the status/current-path/context/elapsed/sound footer with CLI-theme token overlays [`src/core/extension-status.ts`]
833
+ - `renderPiUsereqStatus(...)`: render the status/branch/context/elapsed/sound footer with CLI-theme token overlays [`src/core/extension-status.ts`]
819
834
  - `createStatusThemeAdapter(...)`: constrain status rendering to CLI-supported `accent`, `warning`, `dim`, and `error` theme tokens [`src/core/extension-status.ts`]
820
- - `buildPiUsereqStatusText(...)`: compose the single-line footer payload with workflow state, current-path, elapsed semantics, and sound status fields [`src/core/extension-status.ts`]
835
+ - `resolveStatusBranchValue(...)`: resolve the active git branch from the current context cwd before footer rendering [`src/core/extension-status.ts`]
836
+ - `resolveRuntimeGitBranchName(...)`: resolve the active git branch for the current execution path [`src/core/runtime-project-paths.ts`]
837
+ - `resolveRuntimeGitPath(...)`: resolve the runtime git root for the active execution path [`src/core/runtime-project-paths.ts`]
838
+ - `isInsideGitRepo(...)`: test git work-tree membership [`src/core/runtime-project-paths.ts`]
839
+ - `resolveGitRoot(...)`: resolve repository root [`src/core/runtime-project-paths.ts`]
840
+ - `buildPiUsereqStatusText(...)`: compose the single-line footer payload with workflow state, branch, context gauge, elapsed semantics, and sound status fields [`src/core/extension-status.ts`]
821
841
  - `formatStatusField(...)`: render one colored text field [`src/core/extension-status.ts`]
822
842
  - `formatRenderedStatusField(...)`: render one pre-styled field [`src/core/extension-status.ts`]
823
843
  - `formatWorkflowStateValue(...)`: render the workflow-state value with error highlighting when required [`src/core/extension-status.ts`]
@@ -870,10 +890,14 @@
870
890
  - `logPromptWorkflowEvent(...)`: append selected workflow-closure and workflow-session-shutdown debug entries [`src/index.ts`]
871
891
  - `transitionPromptWorkflowState(...)`: transition workflow state for matched-success merge handling and final idle restoration, and append gated workflow-state debug entries immediately after each transition [`src/index.ts`]
872
892
  - `setPiUsereqWorkflowState(...)`: transition workflow state for matched-success merge handling and final idle restoration [`src/core/extension-status.ts`]
873
- - `renderPiUsereqStatus(...)`: render the status/current-path/context/elapsed/sound footer with CLI-theme token overlays [`src/core/extension-status.ts`]
893
+ - `renderPiUsereqStatus(...)`: render the status/branch/context/elapsed/sound footer with CLI-theme token overlays [`src/core/extension-status.ts`]
874
894
  - `logPromptWorkflowStateChange(...)`: append selected prompt workflow-transition debug entries [`src/index.ts`]
875
- - `finalizePromptCommandExecution(...)`: verify persisted execution-session header metadata plus live worktree artifacts, restore the original session-backed base path through the persisted replacement-session context when lifecycle hooks omit `switchSession()`, merge the matched successful worktree branch with `--ff-only` from `base-path`, delete the worktree and branch after merge success, and append selected merge plus workflow-restore debug entries [`src/core/prompt-command-runtime.ts`]
895
+ - `finalizePromptCommandExecution(...)`: verify persisted execution-session header metadata plus live worktree artifacts, synchronize the successful execution transcript into the restored base session, restore the original session-backed base path through the persisted replacement-session context when lifecycle hooks omit `switchSession()`, merge the matched successful worktree branch with `--ff-only` from `base-path`, delete the worktree and branch after merge success, and append selected merge plus workflow-restore debug entries [`src/core/prompt-command-runtime.ts`]
876
896
  - `verifyPromptCommandClosureArtifacts(...)`: verify execution-session header cwd, worktree registration, branch presence, and worktree-path existence without requiring worktree-session reactivation after prompt end [`src/core/prompt-command-runtime.ts`]
897
+ - `preservePromptCommandExecutionTranscript(...)`: append or materialize the restored base-session transcript from the execution-session JSONL before the base-path switch [`src/core/prompt-command-runtime.ts`]
898
+ - `readPromptSessionJsonLines(...)`: parse execution-session JSONL records and parse original-session JSONL records when a persisted base session already exists [`src/core/prompt-command-runtime.ts`]
899
+ - `readPromptSessionFileCwd(...)`: verify the restored session header cwd equals `base-path` after transcript synchronization [`src/core/prompt-command-runtime.ts`]
900
+ - `readPromptSessionJsonLines(...)`: re-read the restored base session and verify copied execution entry identifiers [`src/core/prompt-command-runtime.ts`]
877
901
  - `restorePromptCommandExecution(...)`: switch back to the original session-backed base path, reuse the persisted replacement-session context keyed by the execution-session file, append optional workflow-restore debug entries, clear active worktree path facts, and realign the live `ctx.cwd` mirror before merge or merge-abort return [`src/core/prompt-command-runtime.ts`]
878
902
  - `deletePromptWorktree(...)`: delete the merged worktree and branch after successful fast-forward merge [`src/core/prompt-command-runtime.ts`]
879
903
  - `restorePromptCommandExecution(...)`: switch back to the original session-backed base path when interrupted, failed, or unmatched prompt-end events skip merge and retain the worktree for manual recovery, reusing the persisted replacement-session context when lifecycle hooks omit `switchSession()` [`src/core/prompt-command-runtime.ts`]
@@ -943,9 +967,14 @@
943
967
  - `getProjectBase(...)`: resolve project base from command context cwd [`src/index.ts`]
944
968
  - `getProjectConfigPath(...)`: resolve the persisted config path [`src/core/config.ts`]
945
969
  - `setPiUsereqStatusConfig(...)`: cache the just-saved docs/tests/src and pi-notify values for status rendering [`src/core/extension-status.ts`]
946
- - `renderPiUsereqStatus(...)`: render the status/current-path/context/elapsed/sound footer after save-and-close with CLI-theme token overlays [`src/core/extension-status.ts`]
970
+ - `renderPiUsereqStatus(...)`: render the status/branch/context/elapsed/sound footer after save-and-close with CLI-theme token overlays [`src/core/extension-status.ts`]
947
971
  - `createStatusThemeAdapter(...)`: constrain status rendering to CLI-supported `accent`, `warning`, `dim`, and `error` theme tokens [`src/core/extension-status.ts`]
948
- - `buildPiUsereqStatusText(...)`: compose the single-line footer payload with workflow state, current-path, elapsed semantics, and sound status fields [`src/core/extension-status.ts`]
972
+ - `resolveStatusBranchValue(...)`: resolve the active git branch from the current context cwd before footer rendering [`src/core/extension-status.ts`]
973
+ - `resolveRuntimeGitBranchName(...)`: resolve the active git branch for the current execution path [`src/core/runtime-project-paths.ts`]
974
+ - `resolveRuntimeGitPath(...)`: resolve the runtime git root for the active execution path [`src/core/runtime-project-paths.ts`]
975
+ - `isInsideGitRepo(...)`: test git work-tree membership [`src/core/runtime-project-paths.ts`]
976
+ - `resolveGitRoot(...)`: resolve repository root [`src/core/runtime-project-paths.ts`]
977
+ - `buildPiUsereqStatusText(...)`: compose the single-line footer payload with workflow state, branch, context gauge, elapsed semantics, and sound status fields [`src/core/extension-status.ts`]
949
978
  - `formatStatusField(...)`: render one colored text field [`src/core/extension-status.ts`]
950
979
  - `formatRenderedStatusField(...)`: render one pre-styled field [`src/core/extension-status.ts`]
951
980
  - `formatWorkflowStateValue(...)`: render the workflow-state value with error highlighting when required [`src/core/extension-status.ts`]
@@ -962,15 +991,15 @@
962
991
  - `buildStaticCheckMenuChoices(...)`: serialize guided add/remove actions plus direct per-language toggle rows [`src/index.ts`]
963
992
  - `getSupportedStaticCheckLanguageSupport(...)`: enumerate supported languages and extensions [`src/core/static-check.ts`]
964
993
  - `getSupportedStaticCheckLanguages(...)`: enumerate canonical supported languages [`src/core/static-check.ts`]
965
- - `buildTerminalSettingsMenuChoices(...)`: append canonical terminal rows to the selector menu [`src/index.ts`]
966
- - `buildSupportedStaticCheckLanguageChoices(...)`: serialize supported languages with enablement, configured counts, and terminal rows [`src/index.ts`]
994
+ - `buildTerminalSettingsMenuChoices(...)`: append the canonical value-less `Reset defaults` row to the selector menu [`src/index.ts`]
995
+ - `buildSupportedStaticCheckLanguageChoices(...)`: serialize supported languages with enablement, configured counts, and the value-less terminal reset row [`src/index.ts`]
967
996
  - `getSupportedStaticCheckLanguageSupport(...)`: enumerate supported languages and extensions [`src/core/static-check.ts`]
968
997
  - `getSupportedStaticCheckLanguages(...)`: enumerate canonical supported languages [`src/core/static-check.ts`]
969
- - `buildTerminalSettingsMenuChoices(...)`: append canonical terminal rows to the selector menu [`src/index.ts`]
970
- - `buildConfiguredStaticCheckLanguageChoices(...)`: serialize configured languages plus terminal rows for removal flows [`src/index.ts`]
998
+ - `buildTerminalSettingsMenuChoices(...)`: append the canonical value-less `Reset defaults` row to the selector menu [`src/index.ts`]
999
+ - `buildConfiguredStaticCheckLanguageChoices(...)`: serialize configured languages plus the value-less terminal reset row for removal flows [`src/index.ts`]
971
1000
  - `getSupportedStaticCheckLanguageSupport(...)`: enumerate supported languages and extensions [`src/core/static-check.ts`]
972
1001
  - `getSupportedStaticCheckLanguages(...)`: enumerate canonical supported languages [`src/core/static-check.ts`]
973
- - `buildTerminalSettingsMenuChoices(...)`: append canonical terminal rows to the selector menu [`src/index.ts`]
1002
+ - `buildTerminalSettingsMenuChoices(...)`: append the canonical value-less `Reset defaults` row to the selector menu [`src/index.ts`]
974
1003
  - `resetStaticCheckConfig(...)`: restore documented per-language static-check defaults [`src/index.ts`]
975
1004
  - `getDefaultStaticCheckConfig(...)`: build documented per-language static-check defaults [`src/core/config.ts`]
976
1005
  - `createStaticCheckLanguageConfig(...)`: clone checker entries and derive the enable flag [`src/core/config.ts`]
@@ -987,30 +1016,30 @@
987
1016
  - `getConfiguredEnabledPiUsereqTools(...)`: canonicalize configured enabled tools [`src/index.ts`]
988
1017
  - `normalizeEnabledPiUsereqTools(...)`: canonicalize configurable active tools [`src/core/pi-usereq-tools.ts`]
989
1018
  - `getPiUsereqStartupTools(...)`: enumerate configurable tools from runtime inventory in documented menu order [`src/index.ts`]
990
- - `buildPiUsereqToolToggleChoices(...)`: serialize per-tool startup-toggle rows plus terminal reset/save actions [`src/index.ts`]
991
- - `buildTerminalSettingsMenuChoices(...)`: append canonical terminal rows to the selector menu [`src/index.ts`]
1019
+ - `buildPiUsereqToolToggleChoices(...)`: serialize per-tool startup-toggle rows plus the value-less terminal reset action [`src/index.ts`]
1020
+ - `buildTerminalSettingsMenuChoices(...)`: append the canonical value-less `Reset defaults` row to the selector menu [`src/index.ts`]
992
1021
  - `configureDebugMenu(...)`: interactive debug editor for global enablement, log path, status-change logging, dedicated workflow-event logging, workflow filters, reset confirmation, and per-tool plus per-prompt toggles [`src/index.ts`]
993
- - `buildDebugMenuChoices(...)`: serialize global debug controls, workflow-event toggles, canonical tool and prompt toggles, and terminal rows [`src/index.ts`]
1022
+ - `buildDebugMenuChoices(...)`: serialize global debug controls, workflow-event toggles, canonical tool and prompt toggles, and the value-less terminal reset row [`src/index.ts`]
994
1023
  - `buildDebugMenuChoice(...)`: dim and disable locked debug rows while global debug is off [`src/index.ts`]
995
1024
  - `getDebugToolToggleNames(...)`: enumerate debuggable tool names in canonical grouped order [`src/index.ts`]
996
1025
  - `selectDebugLogOnStatus(...)`: select one explicit workflow-state filter or `any` [`src/index.ts`]
997
1026
  - `confirmResetChanges(...)`: require explicit approval before applying reset mutations [`src/index.ts`]
998
1027
  - `resetDebugConfigToDefaults(...)`: restore the debug configuration subtree to documented defaults [`src/index.ts`]
999
1028
  - `configurePiNotifyMenu(...)`: interactive notify, sound, and Pushover editor with credential-locked enablement, immediate-save mutations, reset confirmation, and dedicated event submenus [`src/index.ts`]
1000
- - `buildPiNotifyMenuChoices(...)`: serialize command-notify, sound, and Pushover blocks plus shared-event submenu launchers and terminal rows [`src/index.ts`]
1029
+ - `buildPiNotifyMenuChoices(...)`: serialize command-notify, sound, and Pushover blocks plus shared-event submenu launchers and the value-less terminal reset row [`src/index.ts`]
1001
1030
  - `buildPiNotifyEventLauncherChoice(...)`: serialize one event-submenu launcher row with a compact enabled-toggle summary [`src/index.ts`]
1002
1031
  - `buildPiNotifyPushoverRows(...)`: serialize direct Pushover rows with locked enablement plus the shared event-submenu launcher [`src/index.ts`]
1003
- - `buildTerminalSettingsMenuChoices(...)`: append canonical terminal rows [`src/index.ts`]
1032
+ - `buildTerminalSettingsMenuChoices(...)`: append the canonical value-less `Reset defaults` row [`src/index.ts`]
1004
1033
  - `configurePiNotifyEventMenu(...)`: interactive completed/interrupted/failed event editor for one notification transport [`src/index.ts`]
1005
- - `buildPiNotifyEventMenuChoices(...)`: serialize shared event rows plus submenu reset/save actions [`src/index.ts`]
1034
+ - `buildPiNotifyEventMenuChoices(...)`: serialize shared event rows plus the submenu reset action [`src/index.ts`]
1006
1035
  - `resetPiNotifyEventMenuToDefaults(...)`: restore default event toggles for one notification transport [`src/index.ts`]
1007
1036
  - `resolvePiNotifyEventLabel(...)`: map one event-toggle key to the human-readable menu label [`src/index.ts`]
1008
1037
  - `togglePiNotifyFlag(...)`: toggle one persisted boolean notification setting [`src/index.ts`]
1009
1038
  - `togglePiNotifyFlag(...)`: toggle one persisted boolean notification setting [`src/index.ts`]
1010
- - `selectPiNotifySoundLevel(...)`: present the `Enable sound` selector with subtree-local reset/save actions [`src/index.ts`]
1011
- - `buildTerminalSettingsMenuChoices(...)`: append canonical terminal rows to the selector menu [`src/index.ts`]
1012
- - `selectPiNotifyPushoverPriority(...)`: present the `Normal|High` priority selector with subtree-local reset/save actions [`src/index.ts`]
1013
- - `buildTerminalSettingsMenuChoices(...)`: append canonical terminal rows to the selector menu [`src/index.ts`]
1039
+ - `selectPiNotifySoundLevel(...)`: present the `Enable sound` selector with the subtree-local reset action [`src/index.ts`]
1040
+ - `buildTerminalSettingsMenuChoices(...)`: append the canonical value-less `Reset defaults` row to the selector menu [`src/index.ts`]
1041
+ - `selectPiNotifyPushoverPriority(...)`: present the `Normal|High` priority selector with the subtree-local reset action [`src/index.ts`]
1042
+ - `buildTerminalSettingsMenuChoices(...)`: append the canonical value-less `Reset defaults` row to the selector menu [`src/index.ts`]
1014
1043
  - `resetPiNotifyConfigToDefaults(...)`: restore notification settings to documented defaults [`src/index.ts`]
1015
1044
  - `getDefaultConfig(...)`: restore default config on reset and subtree-local selector resets [`src/core/config.ts`]
1016
1045
  - `normalizeEnabledPiUsereqTools(...)`: canonicalize configurable active tools [`src/core/pi-usereq-tools.ts`]
@@ -26,10 +26,10 @@ export const DEFAULT_DEBUG_ENABLED = "disable" as const;
26
26
 
27
27
  /**
28
28
  * @brief Defines the default debug log file value.
29
- * @details Relative values resolve against the original project base when entries are written. Access complexity is O(1).
29
+ * @details New configurations write debug JSON entries to `/tmp/PI-useReq.json` unless the user overrides the path. Access complexity is O(1).
30
30
  * @satisfies CTN-013, REQ-237
31
31
  */
32
- export const DEFAULT_DEBUG_LOG_FILE = "debug.json";
32
+ export const DEFAULT_DEBUG_LOG_FILE = "/tmp/PI-useReq.json";
33
33
 
34
34
  /**
35
35
  * @brief Defines the default workflow-transition logging mode.
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * @file
3
3
  * @brief Tracks pi-usereq extension status state and renders status-bar telemetry.
4
- * @details Centralizes hook interception, context-usage snapshots, run timing,
5
- * and deterministic status-bar formatting for the pi-usereq extension. Runtime
6
- * is O(1) per event plus O(s) in configured source-path count during status
7
- * rendering. Side effects are limited to in-memory state mutation and interval
4
+ * @details Centralizes hook interception, context-usage snapshots, active-branch lookup, run timing, and deterministic status-bar formatting for the pi-usereq extension. Runtime
5
+ * is O(1) per event plus interval-driven re-renders while a prompt remains
6
+ * active. Side effects are limited to in-memory state mutation and interval
8
7
  * scheduling through exported controller helpers.
9
8
  */
10
9
 
@@ -16,14 +15,11 @@ import type {
16
15
  } from "@mariozechner/pi-coding-agent";
17
16
  import type { UseReqConfig } from "./config.js";
18
17
  import type { PromptCommandExecutionPlan } from "./prompt-command-runtime.js";
19
- import {
20
- formatRuntimePathForDisplay,
21
- getRuntimeContextPath,
22
- } from "./path-context.js";
23
18
  import {
24
19
  restorePersistedPromptCommandRuntimeStateForSession,
25
20
  writePersistedPromptCommandRuntimeState,
26
21
  } from "./prompt-command-state.js";
22
+ import { resolveRuntimeGitBranchName } from "./runtime-project-paths.js";
27
23
 
28
24
  /**
29
25
  * @brief Enumerates the CLI-supported theme tokens consumed by status rendering.
@@ -323,6 +319,17 @@ function createStatusThemeAdapter(theme: RawStatusTheme): StatusThemeAdapter {
323
319
  };
324
320
  }
325
321
 
322
+ /**
323
+ * @brief Resolves the active git branch value rendered in the status bar.
324
+ * @details Reads the current branch from the active context working directory on every status render so worktree switches and restored base-session renders expose the latest branch immediately. Runtime is dominated by git execution when the working directory belongs to a repository. Side effects include subprocess creation.
325
+ * @param[in] ctx {ExtensionContext} Active extension context.
326
+ * @return {string} Active branch name or `unknown` when unavailable.
327
+ * @satisfies REQ-121, REQ-283
328
+ */
329
+ function resolveStatusBranchValue(ctx: ExtensionContext): string {
330
+ return resolveRuntimeGitBranchName(ctx.cwd);
331
+ }
332
+
326
333
  /**
327
334
  * @brief Normalizes one raw context-usage snapshot.
328
335
  * @details Preserves the runtime token and context-window counts, derives a
@@ -370,12 +377,10 @@ function refreshContextUsage(
370
377
 
371
378
  /**
372
379
  * @brief Resolves the icon text for one normalized context-usage snapshot.
373
- * @details Maps context usage to one fixed-width icon band so footer rendering
374
- * remains compact and deterministic. Unavailable usage degrades to the `0%`
375
- * icon. Runtime is O(1). No external state is mutated.
380
+ * @details Maps context usage to one fixed-width icon band so footer rendering remains compact and deterministic across the documented `0`, `>0-<25`, `>=25-<50`, `>=50-<75`, and `>=75` percent bands. Unavailable usage degrades to the `0%` icon. Runtime is O(1). No external state is mutated.
376
381
  * @param[in] contextUsage {ContextUsage | undefined} Normalized context snapshot.
377
382
  * @return {string} Fixed-width gauge icon text.
378
- * @satisfies REQ-121, REQ-122
383
+ * @satisfies REQ-122, REQ-284
379
384
  */
380
385
  function resolveContextUsageIconText(
381
386
  contextUsage: ContextUsage | undefined,
@@ -384,13 +389,13 @@ function resolveContextUsageIconText(
384
389
  if (percent === undefined || percent === null || percent <= 0) {
385
390
  return "▕_▏";
386
391
  }
387
- if (percent <= 25) {
392
+ if (percent < 25) {
388
393
  return "▕▂▏";
389
394
  }
390
- if (percent <= 50) {
395
+ if (percent < 50) {
391
396
  return "▕▄▏";
392
397
  }
393
- if (percent <= 90) {
398
+ if (percent < 75) {
394
399
  return "▕▆▏";
395
400
  }
396
401
  return "▕█▏";
@@ -398,24 +403,24 @@ function resolveContextUsageIconText(
398
403
 
399
404
  /**
400
405
  * @brief Formats one icon-based context-usage gauge.
401
- * @details Renders the documented `warning`-colored icon bands for `0-90%`, applies terminal blink control to the `warning`-colored `>90-100%` icon, and applies terminal blink control to the `error`-colored overflow icon so unsupported terminals degrade to non-blinking colored text automatically. Runtime is O(1). No external state is mutated.
406
+ * @details Renders the documented gauge icon with theme `error` for `>=90%`, enables terminal blink only for `>=100%`, and otherwise leaves the gauge in the default terminal color. Runtime is O(1). No external state is mutated.
402
407
  * @param[in] theme {StatusThemeAdapter} Normalized status theme.
403
408
  * @param[in] contextUsage {ContextUsage | undefined} Normalized context snapshot.
404
409
  * @return {string} Rendered fixed-width gauge icon.
405
- * @satisfies REQ-121, REQ-122, REQ-126, REQ-127, REQ-128, REQ-233
410
+ * @satisfies REQ-122, REQ-126, REQ-127, REQ-128, REQ-233, REQ-284
406
411
  */
407
412
  function formatContextUsageBar(
408
413
  theme: StatusThemeAdapter,
409
414
  contextUsage: ContextUsage | undefined,
410
415
  ): string {
411
416
  const percent = contextUsage?.percent ?? 0;
412
- if (percent > 100) {
417
+ if (percent >= 100) {
413
418
  return theme.colorize("error", "\u001b[5m▕█▏\u001b[25m");
414
419
  }
415
- if (percent > 90) {
416
- return theme.colorize("warning", "\u001b[5m▕█▏\u001b[25m");
420
+ if (percent >= 90) {
421
+ return theme.colorize("error", "▕█▏");
417
422
  }
418
- return theme.value(resolveContextUsageIconText(contextUsage));
423
+ return resolveContextUsageIconText(contextUsage);
419
424
  }
420
425
 
421
426
  /**
@@ -545,23 +550,22 @@ function didAgentEndAbort(messages: AgentEndEvent["messages"]): boolean {
545
550
 
546
551
  /**
547
552
  * @brief Builds the full single-line pi-usereq status-bar payload.
548
- * @details Renders status, current-path, context, elapsed, and sound fields in the canonical order with dim bullet separators, workflow-state highlighting, and the documented icon-based context gauge. Runtime is O(1). No external state is mutated.
549
- * @param[in] cwd {string} Runtime working directory used for context-path derivation.
553
+ * @details Renders status, branch, context, elapsed, and sound fields in the canonical order with dim bullet separators, workflow-state highlighting, and the documented icon-based context gauge. Runtime is O(1). No external state is mutated.
550
554
  * @param[in] config {UseReqConfig} Effective project configuration.
551
555
  * @param[in] theme {StatusThemeAdapter} Normalized status theme.
552
556
  * @param[in] state {PiUsereqStatusState} Mutable status state snapshot.
557
+ * @param[in] branchName {string} Active git branch name shown in the footer.
553
558
  * @param[in] nowMs {number} Current wall-clock time in milliseconds.
554
559
  * @return {string} Single-line status-bar text.
555
- * @satisfies REQ-109, REQ-112, REQ-120, REQ-121, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-148, REQ-156, REQ-159, REQ-180, REQ-222, REQ-223
560
+ * @satisfies REQ-109, REQ-112, REQ-120, REQ-121, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-156, REQ-159, REQ-180, REQ-222, REQ-223, REQ-233, REQ-283, REQ-284
556
561
  */
557
562
  function buildPiUsereqStatusText(
558
- cwd: string,
559
563
  config: UseReqConfig,
560
564
  theme: StatusThemeAdapter,
561
565
  state: PiUsereqStatusState,
566
+ branchName: string,
562
567
  nowMs: number,
563
568
  ): string {
564
- const currentPathText = formatRuntimePathForDisplay(getRuntimeContextPath(cwd));
565
569
  const elapsedText = formatElapsedStatusValue(state, nowMs);
566
570
  const soundText = config["notify-sound"];
567
571
  return [
@@ -570,7 +574,7 @@ function buildPiUsereqStatusText(
570
574
  "status",
571
575
  formatWorkflowStateValue(theme, state.workflowState),
572
576
  ),
573
- formatStatusField(theme, "current-path", currentPathText),
577
+ formatStatusField(theme, "branch", branchName),
574
578
  formatRenderedStatusField(
575
579
  theme,
576
580
  "context",
@@ -666,11 +670,11 @@ export function setPiUsereqStatusConfig(
666
670
 
667
671
  /**
668
672
  * @brief Renders the current pi-usereq status bar into the active UI context.
669
- * @details Updates the controller's latest context pointer and writes the single-line status text only when configuration is available, deriving `current-path` from the active runtime context path aligned to `ctx.cwd` and including the documented icon-based context gauge. When pi has already invalidated the supplied context after session replacement or reload, the helper clears the stale cached context and returns without surfacing the stale-instance exception. Runtime is O(s) in configured source-path count. Side effect: mutates `ctx.ui` status when the context is still active.
673
+ * @details Updates the controller's latest context pointer and writes the single-line status text only when configuration is available, including the active branch field and documented icon-based context gauge. When pi has already invalidated the supplied context after session replacement or reload, the helper clears the stale cached context and returns without surfacing the stale-instance exception. Runtime is O(1) plus git execution for branch refresh. Side effect: mutates `ctx.ui` status when the context is still active.
670
674
  * @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
671
675
  * @param[in] ctx {ExtensionContext} Active extension context.
672
676
  * @return {void} No return value.
673
- * @satisfies REQ-120, REQ-121, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-148, REQ-159, REQ-180, REQ-280
677
+ * @satisfies REQ-120, REQ-121, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-159, REQ-180, REQ-233, REQ-280, REQ-283, REQ-284
674
678
  */
675
679
  export function renderPiUsereqStatus(
676
680
  controller: PiUsereqStatusController,
@@ -682,13 +686,14 @@ export function renderPiUsereqStatus(
682
686
  }
683
687
  try {
684
688
  const theme = createStatusThemeAdapter(ctx.ui.theme as RawStatusTheme);
689
+ const branchName = resolveStatusBranchValue(ctx);
685
690
  ctx.ui.setStatus(
686
691
  "pi-usereq",
687
692
  buildPiUsereqStatusText(
688
- ctx.cwd,
689
693
  controller.config,
690
694
  theme,
691
695
  controller.state,
696
+ branchName,
692
697
  Date.now(),
693
698
  ),
694
699
  );