pi-usereq 0.11.0 → 0.12.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +6 -6
  3. package/package.json +1 -1
  4. package/pi-usereq/docs/REFERENCES.md +818 -691
  5. package/pi-usereq/docs/REQUIREMENTS.md +131 -77
  6. package/pi-usereq/docs/WORKFLOW.md +185 -51
  7. package/scripts/lib/extension-debug-harness.ts +2 -2
  8. package/scripts/tool-args-to-params.ts +2 -2
  9. package/src/cli.ts +12 -12
  10. package/src/core/extension-status.ts +69 -12
  11. package/src/core/pi-notify.ts +5 -5
  12. package/src/core/pi-usereq-tools.ts +4 -2
  13. package/src/core/prompt-command-catalog.ts +4 -5
  14. package/src/core/prompt-command-runtime.ts +183 -44
  15. package/src/core/prompts.ts +0 -2
  16. package/src/core/req-references-command.ts +175 -0
  17. package/src/core/req-reset-command.ts +323 -0
  18. package/src/core/resources.ts +6 -23
  19. package/src/core/settings-menu.ts +85 -28
  20. package/src/core/tool-runner.ts +26 -6
  21. package/src/index.ts +523 -85
  22. package/tests/attended-results-scenarios.ts +5 -5
  23. package/tests/cli-command-option-parity.test.ts +25 -25
  24. package/tests/debug-extension-harness.test.ts +1 -1
  25. package/tests/extension-registration.test.ts +1029 -82
  26. package/tests/oracle-project.test.ts +4 -4
  27. package/tests/oracle-standalone.test.ts +5 -5
  28. package/src/core/reference-payload.ts +0 -752
  29. package/src/resources/prompts/references.md +0 -64
  30. /package/tests/fixtures_attended_results/project/{references.json → summarize.json} +0 -0
  31. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_c.c.json +0 -0
  32. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_cpp.cpp.json +0 -0
  33. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_csharp.cs.json +0 -0
  34. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_elixir.ex.json +0 -0
  35. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_go.go.json +0 -0
  36. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_haskell.hs.json +0 -0
  37. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_java.java.json +0 -0
  38. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_javascript.js.json +0 -0
  39. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_kotlin.kt.json +0 -0
  40. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_lua.lua.json +0 -0
  41. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_perl.pl.json +0 -0
  42. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_php.php.json +0 -0
  43. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_python.py.json +0 -0
  44. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_ruby.rb.json +0 -0
  45. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_rust.rs.json +0 -0
  46. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_scala.scala.json +0 -0
  47. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_shell.sh.json +0 -0
  48. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_swift.swift.json +0 -0
  49. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_typescript.ts.json +0 -0
  50. /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_zig.zig.json +0 -0
@@ -23,7 +23,8 @@
23
23
  │ ├── prompt-command-runtime.ts
24
24
  │ ├── prompt-command-state.ts
25
25
  │ ├── prompts.ts
26
- │ ├── reference-payload.ts
26
+ │ ├── req-references-command.ts
27
+ │ ├── req-reset-command.ts
27
28
  │ ├── resources.ts
28
29
  │ ├── runtime-project-paths.ts
29
30
  │ ├── settings-menu.ts
@@ -1127,7 +1128,7 @@ import {
1127
1128
 
1128
1129
  ---
1129
1130
 
1130
- # extension-status.ts | TypeScript | 823L | 43 symbols | 5 imports | 45 comments
1131
+ # extension-status.ts | TypeScript | 880L | 46 symbols | 6 imports | 48 comments
1131
1132
  > Path: `src/core/extension-status.ts`
1132
1133
  - @brief Tracks pi-usereq extension status state and renders status-bar telemetry.
1133
1134
  - @details Centralizes hook interception, context-usage snapshots, active-branch lookup, run timing, and deterministic status-bar formatting for the pi-usereq extension. Runtime
@@ -1139,6 +1140,7 @@ scheduling through exported controller helpers.
1139
1140
  ```
1140
1141
  import type {
1141
1142
  import type { UseReqConfig } from "./config.js";
1143
+ import type { PiNotifySoundLevel } from "./pi-notify.js";
1142
1144
  import type { PromptCommandExecutionPlan } from "./prompt-command-runtime.js";
1143
1145
  import {
1144
1146
  import { resolveRuntimeGitBranchName } from "./runtime-project-paths.js";
@@ -1146,120 +1148,120 @@ import { resolveRuntimeGitBranchName } from "./runtime-project-paths.js";
1146
1148
 
1147
1149
  ## Definitions
1148
1150
 
1149
- - type `type StatusForegroundColor = Extract<` (L30)
1151
+ - type `type StatusForegroundColor = Extract<` (L31)
1150
1152
  - @brief Enumerates the CLI-supported theme tokens consumed by status rendering.
1151
1153
  - @details Restricts the status formatter to documented pi theme tokens so the
1152
1154
  status bar remains compatible with the active CLI theme schema. Compile-time
1153
1155
  only and introduces no runtime cost.
1154
- ### iface `interface RawStatusTheme` (L40-42)
1156
+ ### iface `interface RawStatusTheme` (L41-43)
1155
1157
  - @brief Describes the raw theme capabilities required for status rendering.
1156
1158
  - @details Accepts the `ctx.ui.theme` foreground renderer used by the
1157
1159
  single-line footer. Compile-time only and introduces no runtime cost.
1158
1160
 
1159
- ### iface `interface StatusThemeAdapter` (L50-55)
1161
+ ### iface `interface StatusThemeAdapter` (L51-56)
1160
1162
  - @brief Describes the normalized theme adapter used by status formatters.
1161
1163
  - @details Exposes deterministic label, value, foreground, and separator
1162
1164
  renderers so status text generation stays independent from the raw theme API.
1163
1165
  Compile-time only and introduces no runtime cost.
1164
1166
 
1165
- - type `export type PiUsereqStatusHookName = (typeof PI_USEREQ_STATUS_HOOK_NAMES)[number];` (L98)
1167
+ - type `export type PiUsereqStatusHookName = (typeof PI_USEREQ_STATUS_HOOK_NAMES)[number];` (L99)
1166
1168
  - @brief Represents one hook name handled by the pi-usereq status controller.
1167
1169
  - @details Narrows hook registration and event-update calls to the canonical
1168
1170
  intercepted-hook set. Compile-time only and introduces no runtime cost.
1169
- - type `export type PiUsereqPromptRequest = PromptCommandExecutionPlan;` (L104)
1171
+ - type `export type PiUsereqPromptRequest = PromptCommandExecutionPlan;` (L105)
1170
1172
  - @brief Describes one prompt request tracked across extension command delivery and runtime execution.
1171
1173
  - @details Reuses the prepared prompt-command execution plan so status rendering and prompt-end side effects can recover the original project base, active execution base, and optional worktree metadata for the current prompt run. The alias is compile-time only and introduces no runtime cost.
1172
- - type `export type PiUsereqWorkflowState = "idle" | "checking" | "running" | "merging" | "error";` (L110)
1174
+ - type `export type PiUsereqWorkflowState = "idle" | "checking" | "running" | "merging" | "error";` (L111)
1173
1175
  - @brief Represents one prompt-orchestration workflow state displayed in the status bar.
1174
1176
  - @details Narrows workflow tracking to the documented `idle`, `checking`, `running`, `merging`, and `error` states reused by prompt-command gating, prompt-end orchestration, and status rendering. Compile-time only and introduces no runtime cost.
1175
- ### iface `export interface PiUsereqStatusState` (L116-124)
1177
+ ### iface `export interface PiUsereqStatusState` (L117-126)
1176
1178
  - @brief Stores the mutable runtime facts displayed by the status bar.
1177
- - @details Persists the prompt-orchestration workflow state, the latest context-usage snapshot, the active run start timestamp, the most recent normally completed run duration, the accumulated duration of all normally completed runs, and prompt-request metadata carried from command dispatch into the next runtime execution. Runtime state is mutated in-place by controller helpers. Compile-time only and introduces no runtime cost.
1179
+ - @details Persists the prompt-orchestration workflow state, the latest context-usage snapshot, the active run start timestamp, the most recent normally completed run duration, the accumulated duration of all normally completed runs, the in-memory runtime sound level, and prompt-request metadata carried from command dispatch into the next runtime execution. Runtime state is mutated in-place by controller helpers. Compile-time only and introduces no runtime cost.
1178
1180
 
1179
- ### iface `export interface PiUsereqStatusController` (L133-138)
1181
+ ### iface `export interface PiUsereqStatusController` (L135-140)
1180
1182
  - @brief Stores the controller state required for event-driven status updates.
1181
1183
  - @details Keeps the mutable status snapshot, the current configuration, the
1182
1184
  latest extension context used for rendering, and the interval handle used
1183
1185
  for live elapsed-time refreshes. Compile-time only and introduces no runtime
1184
1186
  cost.
1185
1187
 
1186
- ### iface `interface PiUsereqStatusPersistenceStore` (L144-147)
1188
+ ### iface `interface PiUsereqStatusPersistenceStore` (L146-149)
1187
1189
  - @brief Stores the process-scoped elapsed-timer snapshot reused across session replacement.
1188
1190
  - @details Preserves only the latest completed duration and accumulated completed runtime so `/new`, `/resume`, and `/fork` can restore elapsed counters after the extension runtime is rebound. Compile-time only and introduces no runtime cost.
1189
1191
 
1190
- ### fn `function getPiUsereqStatusPersistenceStore(): PiUsereqStatusPersistenceStore` (L161-170)
1192
+ ### fn `function getPiUsereqStatusPersistenceStore(): PiUsereqStatusPersistenceStore` (L163-172)
1191
1193
  - @brief Returns the process-scoped elapsed-timer persistence store.
1192
1194
  - @details Lazily initializes one internal `globalThis` record because pi rebinds extension modules for `/new`, `/resume`, `/fork`, and `/reload`, but the hosting process persists across those operations. Runtime is O(1). Side effect: initializes internal process-scoped state on first access.
1193
1195
  - @return {PiUsereqStatusPersistenceStore} Mutable persistence record.
1194
1196
  - @note Design rationale: required to preserve elapsed counters across session replacement without writing session-global menu state into project configuration.
1195
1197
 
1196
- ### fn `function restorePersistedElapsedState(state: PiUsereqStatusState): void` (L178-182)
1198
+ ### fn `function restorePersistedElapsedState(state: PiUsereqStatusState): void` (L180-184)
1197
1199
  - @brief Restores persisted elapsed counters into one mutable status snapshot.
1198
1200
  - @details Copies the process-scoped last-run and accumulated completed durations into the supplied controller state so rebinding events can continue showing prior counters. Runtime is O(1). Side effect: mutates `state`.
1199
1201
  - @param[in,out] state {PiUsereqStatusState} Mutable status state.
1200
1202
  - @return {void} No return value.
1201
1203
 
1202
- ### fn `function persistElapsedState(state: PiUsereqStatusState): void` (L190-194)
1204
+ ### fn `function persistElapsedState(state: PiUsereqStatusState): void` (L192-196)
1203
1205
  - @brief Persists elapsed counters from one mutable status snapshot.
1204
1206
  - @details Copies the current last-run and accumulated completed durations into the process-scoped store so later extension instances can restore them after session replacement. Runtime is O(1). Side effect: mutates internal process-scoped state.
1205
1207
  - @param[in] state {PiUsereqStatusState} Mutable status state snapshot.
1206
1208
  - @return {void} No return value.
1207
1209
 
1208
- ### fn `function persistPromptCommandState(state: PiUsereqStatusState): void` (L202-208)
1210
+ ### fn `function persistPromptCommandState(state: PiUsereqStatusState): void` (L204-210)
1209
1211
  - @brief Mirrors one controller prompt state into the process-scoped persistence store.
1210
1212
  - @details Persists the current workflow state plus the pending and active prompt execution plans so prompt orchestration can survive session replacement. Runtime is O(1). Side effect: mutates process-scoped prompt-command persistence state.
1211
1213
  - @param[in] state {PiUsereqStatusState} Current controller state snapshot.
1212
1214
  - @return {void} No return value.
1213
1215
 
1214
- ### fn `export function shouldPreservePromptCommandStateOnShutdown(state: PiUsereqStatusState): boolean` (L217-220)
1216
+ ### fn `export function shouldPreservePromptCommandStateOnShutdown(state: PiUsereqStatusState): boolean` (L219-222)
1215
1217
  - @brief Detects whether `session_shutdown` must preserve prompt-command state.
1216
1218
  - @details Keeps both the in-memory controller prompt state and the process-scoped prompt execution plan intact while pi switches from the original session into the forked execution session, because the old extension instance can keep running the initiating command handler after `session_shutdown` fires and before the replacement session fully takes over. Runtime is O(1). No external state is mutated.
1217
1219
  - @param[in] state {PiUsereqStatusState} Controller state before shutdown mutation.
1218
1220
  - @return {boolean} `true` when prompt-command state must survive the shutdown event.
1219
1221
  - @satisfies REQ-278
1220
1222
 
1221
- ### fn `function restorePersistedPromptCommandState(` (L229-240)
1223
+ ### fn `function restorePersistedPromptCommandState(` (L231-242)
1222
1224
  - @brief Restores prompt-command persistence into one fresh controller when the active session matches.
1223
1225
  - @details Rehydrates workflow state plus pending or active prompt execution plans only when the current session file targets the persisted execution session created for prompt orchestration. Runtime is O(1). Side effect: mutates `state` when persisted prompt state is available.
1224
1226
  - @param[in] sessionFile {string | undefined} Current active session file.
1225
1227
  - @param[in,out] state {PiUsereqStatusState} Mutable controller state.
1226
1228
  - @return {void} No return value.
1227
1229
 
1228
- ### fn `function getContextSessionFile(ctx: ExtensionContext): string | undefined` (L248-252)
1230
+ ### fn `function getContextSessionFile(ctx: ExtensionContext): string | undefined` (L250-254)
1229
1231
  - @brief Resolves the active session file exposed by one extension context.
1230
1232
  - @details Reads the session-manager session-file getter when available so prompt-command persistence can be resynchronized on every lifecycle hook after session replacement. Runtime is O(1). No external state is mutated.
1231
1233
  - @param[in] ctx {ExtensionContext} Active extension context.
1232
1234
  - @return {string | undefined} Current session file when available.
1233
1235
 
1234
- ### fn `export function isStaleExtensionContextError(error: unknown): boolean` (L261-264)
1236
+ ### fn `export function isStaleExtensionContextError(error: unknown): boolean` (L263-266)
1235
1237
  - @brief Detects stale extension-context access after session replacement.
1236
1238
  - @details Matches the guarded pi runtime error emitted when one invalidated extension context, command context, or replacement-session context is accessed after session replacement or reload. Runtime is O(n) in message length only when an error is supplied. No external state is mutated.
1237
1239
  - @param[in] error {unknown} Candidate thrown value.
1238
1240
  - @return {boolean} `true` when the value matches the stale-extension-context runtime error.
1239
1241
  - @satisfies REQ-280
1240
1242
 
1241
- ### fn `function resetElapsedState(state: PiUsereqStatusState): void` (L273-277)
1243
+ ### fn `function resetElapsedState(state: PiUsereqStatusState): void` (L275-279)
1242
1244
  - @brief Resets the in-memory and persisted elapsed counters.
1243
1245
  - @details Clears both completed-duration fields in the supplied state and mirrors that cleared snapshot into the process-scoped store. Runtime is O(1). Side effects include mutable state reset and process-scoped persistence update.
1244
1246
  - @param[in,out] state {PiUsereqStatusState} Mutable status state.
1245
1247
  - @return {void} No return value.
1246
1248
  - @satisfies REQ-217
1247
1249
 
1248
- ### fn `function shouldResetElapsedStateOnSessionStart(event: unknown): boolean` (L286-289)
1250
+ ### fn `function shouldResetElapsedStateOnSessionStart(event: unknown): boolean` (L288-291)
1249
1251
  - @brief Detects whether a `session_start` event must reset elapsed counters.
1250
1252
  - @details Treats `startup` and `reload` as hard-reset boundaries while preserving counters for `new`, `resume`, and `fork`. Runtime is O(1). No external state is mutated.
1251
1253
  - @param[in] event {unknown} Session-start payload.
1252
1254
  - @return {boolean} `true` when elapsed counters must reset.
1253
1255
  - @satisfies REQ-217
1254
1256
 
1255
- ### fn `function shouldResetWorkflowStateOnSessionStart(event: unknown): boolean` (L298-301)
1257
+ ### fn `function shouldResetWorkflowStateOnSessionStart(event: unknown): boolean` (L300-303)
1256
1258
  - @brief Detects whether a `session_start` event must reset the workflow state to `idle`.
1257
1259
  - @details Treats `startup`, `new`, and `reload` as workflow-reset boundaries so prompt-orchestration state never leaks across boot, explicit session replacement, or extension reload. Runtime is O(1). No external state is mutated.
1258
1260
  - @param[in] event {unknown} Session-start payload.
1259
1261
  - @return {boolean} `true` when workflow state must reset to `idle`.
1260
1262
  - @satisfies REQ-009, REQ-221
1261
1263
 
1262
- ### fn `function createStatusThemeAdapter(theme: RawStatusTheme): StatusThemeAdapter` (L311-320)
1264
+ ### fn `function createStatusThemeAdapter(theme: RawStatusTheme): StatusThemeAdapter` (L313-322)
1263
1265
  - @brief Builds the normalized theme adapter used by pi-usereq status formatters.
1264
1266
  - @details Precomputes label, value, foreground, and separator renderers so
1265
1267
  status formatting remains stable across real TUI themes and deterministic
@@ -1267,16 +1269,16 @@ test doubles. Runtime is O(1). No external state is mutated.
1267
1269
  - @param[in] theme {RawStatusTheme} Raw theme implementation from `ctx.ui.theme`.
1268
1270
  - @return {StatusThemeAdapter} Normalized status-theme adapter.
1269
1271
 
1270
- ### fn `const colorize = (color: StatusForegroundColor, text: string): string =>` (L312-319)
1272
+ ### fn `const colorize = (color: StatusForegroundColor, text: string): string =>` (L314-321)
1271
1273
 
1272
- ### fn `function resolveStatusBranchValue(ctx: ExtensionContext): string` (L329-331)
1274
+ ### fn `function resolveStatusBranchValue(ctx: ExtensionContext): string` (L331-333)
1273
1275
  - @brief Resolves the active git branch value rendered in the status bar.
1274
1276
  - @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.
1275
1277
  - @param[in] ctx {ExtensionContext} Active extension context.
1276
1278
  - @return {string} Active branch name or `unknown` when unavailable.
1277
1279
  - @satisfies REQ-121, REQ-283
1278
1280
 
1279
- ### fn `function normalizeContextUsage(` (L342-359)
1281
+ ### fn `function normalizeContextUsage(` (L344-361)
1280
1282
  - @brief Normalizes one raw context-usage snapshot.
1281
1283
  - @details Preserves the runtime token and context-window counts, derives a
1282
1284
  percentage when the runtime omits it, clamps negative percentages to `0`,
@@ -1285,7 +1287,7 @@ external state is mutated.
1285
1287
  - @param[in] contextUsage {ContextUsage | undefined} Raw runtime snapshot.
1286
1288
  - @return {ContextUsage | undefined} Normalized snapshot.
1287
1289
 
1288
- ### fn `function refreshContextUsage(` (L371-376)
1290
+ ### fn `function refreshContextUsage(` (L373-378)
1289
1291
  - @brief Refreshes the stored context-usage snapshot from the active extension context.
1290
1292
  - @details Calls `ctx.getContextUsage()` on every intercepted event so the
1291
1293
  controller retains the newest context-usage facts available from the pi
@@ -1295,22 +1297,22 @@ runtime. Runtime is O(1). Side effect: mutates `state.contextUsage`.
1295
1297
  - @return {void} No return value.
1296
1298
  - @satisfies REQ-118, REQ-119
1297
1299
 
1298
- ### fn `function resolveContextUsageIconText(` (L385-402)
1300
+ ### fn `function resolveContextUsageIconText(` (L387-404)
1299
1301
  - @brief Resolves the icon text for one normalized context-usage snapshot.
1300
1302
  - @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.
1301
1303
  - @param[in] contextUsage {ContextUsage | undefined} Normalized context snapshot.
1302
1304
  - @return {string} Fixed-width gauge icon text.
1303
1305
  - @satisfies REQ-122, REQ-284
1304
1306
 
1305
- ### fn `function formatContextUsageBar(` (L412-424)
1307
+ ### fn `function formatContextUsageBar(` (L414-426)
1306
1308
  - @brief Formats one icon-based context-usage gauge.
1307
- - @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.
1309
+ - @details Renders the documented gauge icon with the same non-error status-value theme token used by `status` below `90%`, switches to theme `error` for `>=90%`, and enables terminal blink only for `>=100%`. Runtime is O(1). No external state is mutated.
1308
1310
  - @param[in] theme {StatusThemeAdapter} Normalized status theme.
1309
1311
  - @param[in] contextUsage {ContextUsage | undefined} Normalized context snapshot.
1310
1312
  - @return {string} Rendered fixed-width gauge icon.
1311
1313
  - @satisfies REQ-122, REQ-126, REQ-127, REQ-128, REQ-233, REQ-284
1312
1314
 
1313
- ### fn `function formatStatusDuration(durationMs: number): string` (L435-440)
1315
+ ### fn `function formatStatusDuration(durationMs: number): string` (L437-442)
1314
1316
  - @brief Formats one elapsed-duration value as `M:SS`.
1315
1317
  - @details Floors the input to whole seconds, keeps minutes unbounded above 59,
1316
1318
  and zero-pads seconds to two digits. Runtime is O(1). No external state is
@@ -1319,7 +1321,7 @@ mutated.
1319
1321
  - @return {string} Duration rendered as `M:SS`.
1320
1322
  - @satisfies REQ-125
1321
1323
 
1322
- ### fn `function formatCompletedStatusDuration(` (L451-455)
1324
+ ### fn `function formatCompletedStatusDuration(` (L453-457)
1323
1325
  - @brief Formats one optional completed-duration value.
1324
1326
  - @details Returns the canonical unset placeholder `--:--` until the supplied
1325
1327
  timer receives a normally completed prompt duration, then delegates to
@@ -1328,7 +1330,7 @@ timer receives a normally completed prompt duration, then delegates to
1328
1330
  - @return {string} Rendered duration or unset placeholder.
1329
1331
  - @satisfies REQ-124
1330
1332
 
1331
- ### fn `function formatElapsedStatusValue(` (L468-478)
1333
+ ### fn `function formatElapsedStatusValue(` (L470-480)
1332
1334
  - @brief Formats the consolidated `elapsed` status-bar value.
1333
1335
  - @details Emits the active prompt segment `⏱︎ <active>`, the latest normally
1334
1336
  completed segment `⚑ <last>`, and the accumulated successful-runtime segment
@@ -1339,7 +1341,7 @@ mutated.
1339
1341
  - @return {string} Consolidated `elapsed` field value.
1340
1342
  - @satisfies REQ-123, REQ-124, REQ-125, REQ-159
1341
1343
 
1342
- ### fn `function formatStatusField(` (L489-495)
1344
+ ### fn `function formatStatusField(` (L491-497)
1343
1345
  - @brief Formats one standard status-bar field.
1344
1346
  - @details Renders the field label in accent color and the value in warning
1345
1347
  color. Runtime is O(n) in combined text length. No external state is mutated.
@@ -1348,7 +1350,7 @@ color. Runtime is O(n) in combined text length. No external state is mutated.
1348
1350
  - @param[in] value {string} Unstyled field value.
1349
1351
  - @return {string} Rendered status-field fragment.
1350
1352
 
1351
- ### fn `function formatRenderedStatusField(` (L507-513)
1353
+ ### fn `function formatRenderedStatusField(` (L509-515)
1352
1354
  - @brief Formats one pre-rendered status-bar field value.
1353
1355
  - @details Preserves the accent-colored field label while allowing callers to
1354
1356
  provide a custom styled value such as the context-usage bar. Runtime is O(n)
@@ -1358,7 +1360,7 @@ in combined text length. No external state is mutated.
1358
1360
  - @param[in] renderedValue {string} Pre-rendered field value.
1359
1361
  - @return {string} Rendered status-field fragment.
1360
1362
 
1361
- ### fn `function formatWorkflowStateValue(` (L523-531)
1363
+ ### fn `function formatWorkflowStateValue(` (L525-533)
1362
1364
  - @brief Formats the rendered workflow-state value for the `status` field.
1363
1365
  - @details Uses the standard warning-colored value renderer for non-error states and emits a blinking `error`-colored value for `status:error` so the footer highlights orchestration failures immediately. Runtime is O(n) in text length. No external state is mutated.
1364
1366
  - @param[in] theme {StatusThemeAdapter} Normalized status theme.
@@ -1366,7 +1368,7 @@ in combined text length. No external state is mutated.
1366
1368
  - @return {string} Rendered workflow-state value.
1367
1369
  - @satisfies REQ-112, REQ-223
1368
1370
 
1369
- ### fn `function didAgentEndAbort(messages: AgentEndEvent["messages"]): boolean` (L542-549)
1371
+ ### fn `function didAgentEndAbort(messages: AgentEndEvent["messages"]): boolean` (L544-551)
1370
1372
  - @brief Detects whether an agent run ended through abort semantics.
1371
1373
  - @details Treats any assistant message whose `stopReason` equals `aborted` as
1372
1374
  an escape-triggered termination that must not overwrite the `last` timer.
@@ -1375,9 +1377,17 @@ Runtime is O(n) in message count. No external state is mutated.
1375
1377
  - @return {boolean} `true` when the run ended in aborted state.
1376
1378
  - @satisfies REQ-125
1377
1379
 
1378
- ### fn `function buildPiUsereqStatusText(` (L562-586)
1380
+ ### fn `function resolvePiUsereqRuntimeSoundLevel(` (L561-566)
1381
+ - @brief Resolves the active runtime sound level used by status and notify flows.
1382
+ - @details Prefers the mutable runtime sound state, then falls back to the cached persisted boot value, and finally defaults to `none` before `session_start` loads configuration. Runtime is O(1). No external state is mutated.
1383
+ - @param[in] state {PiUsereqStatusState} Mutable status state snapshot.
1384
+ - @param[in] config {UseReqConfig | undefined} Cached project configuration.
1385
+ - @return {PiNotifySoundLevel} Active runtime sound level.
1386
+ - @satisfies REQ-180, REQ-285
1387
+
1388
+ ### fn `function buildPiUsereqStatusText(` (L579-603)
1379
1389
  - @brief Builds the full single-line pi-usereq status-bar payload.
1380
- - @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.
1390
+ - @details Renders status, branch, context, elapsed, and sound fields in the canonical order with dim bullet separators, workflow-state highlighting, the documented icon-based context gauge, and the active runtime sound level instead of the persisted boot value. Runtime is O(1). No external state is mutated.
1381
1391
  - @param[in] config {UseReqConfig} Effective project configuration.
1382
1392
  - @param[in] theme {StatusThemeAdapter} Normalized status theme.
1383
1393
  - @param[in] state {PiUsereqStatusState} Mutable status state snapshot.
@@ -1386,7 +1396,7 @@ Runtime is O(n) in message count. No external state is mutated.
1386
1396
  - @return {string} Single-line status-bar text.
1387
1397
  - @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
1388
1398
 
1389
- ### fn `function stopStatusTicker(controller: PiUsereqStatusController): void` (L596-601)
1399
+ ### fn `function stopStatusTicker(controller: PiUsereqStatusController): void` (L613-618)
1390
1400
  - @brief Stops the live elapsed-time ticker when it is active.
1391
1401
  - @details Clears the interval handle and resets the stored timer reference so
1392
1402
  subsequent runs can reinitialize live status refreshes deterministically.
@@ -1394,7 +1404,7 @@ Runtime is O(1). Side effect: mutates `controller.tickHandle`.
1394
1404
  - @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
1395
1405
  - @return {void} No return value.
1396
1406
 
1397
- ### fn `function syncPiUsereqStatusTicker(` (L613-629)
1407
+ ### fn `function syncPiUsereqStatusTicker(` (L630-646)
1398
1408
  - @brief Synchronizes the live elapsed-time ticker with the current run state.
1399
1409
  - @details Starts a 1-second render ticker while a run is active and stops the
1400
1410
  ticker when the run returns to idle. Runtime is O(1). Side effects include
@@ -1404,31 +1414,48 @@ ticks.
1404
1414
  - @return {void} No return value.
1405
1415
  - @satisfies REQ-123
1406
1416
 
1407
- ### fn `export function createPiUsereqStatusController(): PiUsereqStatusController` (L637-652)
1417
+ ### fn `export function createPiUsereqStatusController(): PiUsereqStatusController` (L654-670)
1408
1418
  - @brief Creates an empty pi-usereq status controller.
1409
- - @details Initializes the mutable status snapshot, including empty prompt-request tracking, and starts with no config, no context, and no live ticker. Runtime is O(1). No external state is mutated.
1419
+ - @details Initializes the mutable status snapshot, including empty prompt-request tracking and an unset runtime sound level that later loads from persisted config during `session_start`, and starts with no config, no context, and no live ticker. Runtime is O(1). No external state is mutated.
1410
1420
  - @return {PiUsereqStatusController} New status controller.
1411
1421
  - @satisfies DES-010
1412
1422
 
1413
- ### fn `export function setPiUsereqStatusConfig(` (L664-669)
1423
+ ### fn `export function setPiUsereqStatusConfig(` (L683-688)
1414
1424
  - @brief Stores the effective project configuration used by status rendering.
1415
1425
  - @details Replaces the controller's cached configuration so later status
1416
- renders reuse the latest docs, tests, source-path, and pi-notify values
1417
- without reading from disk on every event. Runtime is O(1). Side effect:
1426
+ renders reuse the latest docs, tests, source-path, and persisted pi-notify
1427
+ values without reading from disk on every event, while leaving the active
1428
+ runtime sound level in `controller.state`. Runtime is O(1). Side effect:
1418
1429
  mutates `controller.config`.
1419
1430
  - @param[in] config {UseReqConfig} Effective project configuration.
1420
1431
  - @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
1421
1432
  - @return {void} No return value.
1422
1433
 
1423
- ### fn `export function renderPiUsereqStatus(` (L679-709)
1434
+ ### fn `export function getPiUsereqRuntimeSoundLevel(` (L697-701)
1435
+ - @brief Returns the active runtime sound level tracked by the status controller.
1436
+ - @details Exposes the in-memory runtime sound state so shortcut handlers and prompt-end notification dispatch can stay decoupled from the persisted boot value stored in `.pi-usereq.json`. Runtime is O(1). No external state is mutated.
1437
+ - @param[in] controller {PiUsereqStatusController} Mutable status controller.
1438
+ - @return {PiNotifySoundLevel} Active runtime sound level.
1439
+ - @satisfies REQ-180, REQ-285
1440
+
1441
+ ### fn `export function setPiUsereqRuntimeSoundLevel(` (L712-722)
1442
+ - @brief Stores one new runtime sound level and refreshes the status bar.
1443
+ - @details Mutates only the in-memory runtime sound state so shortcut-driven sound changes do not update `.pi-usereq.json`, then re-renders the footer when an active extension context is available. Runtime is O(1). Side effect: mutates `controller.state.runtimeSoundLevel` and may update `ctx.ui` status.
1444
+ - @param[in] runtimeSoundLevel {PiNotifySoundLevel} Next active runtime sound level.
1445
+ - @param[in] ctx {ExtensionContext | undefined} Optional active extension context.
1446
+ - @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
1447
+ - @return {void} No return value.
1448
+ - @satisfies REQ-180, REQ-286, REQ-287
1449
+
1450
+ ### fn `export function renderPiUsereqStatus(` (L732-763)
1424
1451
  - @brief Renders the current pi-usereq status bar into the active UI context.
1425
- - @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.
1452
+ - @details Updates the controller's latest context pointer, refreshes the live `getContextUsage()` snapshot for direct render call sites that do not pass through `updateExtensionStatus(...)`, and writes the single-line status text only when configuration is available, including the active branch field, documented icon-based context gauge, and active runtime sound level. 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 `controller.state.contextUsage` and `ctx.ui` status when the context is still active.
1426
1453
  - @param[in] ctx {ExtensionContext} Active extension context.
1427
1454
  - @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
1428
1455
  - @return {void} No return value.
1429
- - @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
1456
+ - @satisfies REQ-118, REQ-119, 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
1430
1457
 
1431
- ### fn `export function setPiUsereqWorkflowState(` (L720-731)
1458
+ ### fn `export function setPiUsereqWorkflowState(` (L774-785)
1432
1459
  - @brief Transitions the prompt-orchestration workflow state and refreshes the status bar.
1433
1460
  - @details Mutates the tracked workflow state, preserves the latest extension context when available, and re-renders the single-line footer immediately so internal command transitions and pi lifecycle transitions stay visible to the user. Runtime is O(1). Side effect: mutates workflow state and may update `ctx.ui` status.
1434
1461
  - @param[in] workflowState {PiUsereqWorkflowState} Next workflow state.
@@ -1437,17 +1464,17 @@ mutates `controller.config`.
1437
1464
  - @return {void} No return value.
1438
1465
  - @satisfies REQ-221, REQ-222, REQ-223
1439
1466
 
1440
- ### fn `export function updateExtensionStatus(` (L743-807)
1467
+ ### fn `export function updateExtensionStatus(` (L797-864)
1441
1468
  - @brief Updates mutable status state for one intercepted lifecycle hook.
1442
- - @details Refreshes stored context usage on every hook, resets or restores persisted elapsed counters during `session_start`, restores persisted prompt-command metadata when the active session matches a forked execution session, resynchronizes that metadata on later lifecycle hooks so post-switch workflow transitions performed by the initiating command handler become visible to the replacement-session runtime, resets workflow state to `idle` for documented session-start reasons, starts run timing on `agent_start`, promotes pending prompt-request metadata into the active run, captures non-aborted run duration on `agent_end`, accumulates successful runtime into `Σ`, preserves in-memory prompt-command state plus process-scoped persistence across switch-triggered `session_shutdown`, tolerates stale post-replacement render contexts, synchronizes the live ticker, and re-renders the status bar when configuration is available. Runtime is O(n) in `agent_end` message count and otherwise O(1). Side effects include in-memory state mutation, interval scheduling, process-scoped persistence mutation, and footer-status updates.
1469
+ - @details Refreshes stored context usage on every hook, resets or restores persisted elapsed counters during `session_start`, loads the active runtime sound level from persisted config during `session_start`, restores persisted prompt-command metadata when the active session matches a forked execution session, resynchronizes that metadata on later lifecycle hooks so post-switch workflow transitions performed by the initiating command handler become visible to the replacement-session runtime, resets workflow state to `idle` for documented session-start reasons, starts run timing on `agent_start`, promotes pending prompt-request metadata into the active run, captures non-aborted run duration on `agent_end`, accumulates successful runtime into `Σ`, preserves in-memory prompt-command state plus process-scoped persistence across switch-triggered `session_shutdown`, tolerates stale post-replacement render contexts, synchronizes the live ticker, and re-renders the status bar when configuration is available. Runtime is O(n) in `agent_end` message count and otherwise O(1). Side effects include in-memory state mutation, interval scheduling, process-scoped persistence mutation, and footer-status updates.
1443
1470
  - @param[in] hookName {PiUsereqStatusHookName} Intercepted hook name.
1444
1471
  - @param[in] event {unknown} Hook payload forwarded from the wrapper.
1445
1472
  - @param[in] ctx {ExtensionContext} Active extension context.
1446
1473
  - @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
1447
1474
  - @return {void} No return value.
1448
- - @satisfies REQ-009, REQ-117, REQ-118, REQ-119, REQ-123, REQ-124, REQ-125, REQ-159, REQ-169, REQ-217, REQ-221, REQ-278, REQ-279, REQ-280
1475
+ - @satisfies REQ-009, REQ-117, REQ-118, REQ-119, REQ-123, REQ-124, REQ-125, REQ-159, REQ-169, REQ-217, REQ-221, REQ-278, REQ-279, REQ-280, REQ-285
1449
1476
 
1450
- ### fn `export function disposePiUsereqStatusController(` (L818-823)
1477
+ ### fn `export function disposePiUsereqStatusController(` (L875-880)
1451
1478
  - @brief Disposes the pi-usereq status controller.
1452
1479
  - @details Stops the live ticker, clears the cached context pointer, and leaves
1453
1480
  the last captured status snapshot available for inspection until the
@@ -1459,49 +1486,52 @@ limited to interval disposal and in-memory state mutation.
1459
1486
  ## Symbol Index
1460
1487
  |Symbol|Kind|Vis|Lines|Sig|
1461
1488
  |---|---|---|---|---|
1462
- |`StatusForegroundColor`|type||30||
1463
- |`RawStatusTheme`|iface||40-42|interface RawStatusTheme|
1464
- |`StatusThemeAdapter`|iface||50-55|interface StatusThemeAdapter|
1465
- |`PiUsereqStatusHookName`|type||98||
1466
- |`PiUsereqPromptRequest`|type||104||
1467
- |`PiUsereqWorkflowState`|type||110||
1468
- |`PiUsereqStatusState`|iface||116-124|export interface PiUsereqStatusState|
1469
- |`PiUsereqStatusController`|iface||133-138|export interface PiUsereqStatusController|
1470
- |`PiUsereqStatusPersistenceStore`|iface||144-147|interface PiUsereqStatusPersistenceStore|
1471
- |`getPiUsereqStatusPersistenceStore`|fn||161-170|function getPiUsereqStatusPersistenceStore(): PiUsereqSta...|
1472
- |`restorePersistedElapsedState`|fn||178-182|function restorePersistedElapsedState(state: PiUsereqStat...|
1473
- |`persistElapsedState`|fn||190-194|function persistElapsedState(state: PiUsereqStatusState):...|
1474
- |`persistPromptCommandState`|fn||202-208|function persistPromptCommandState(state: PiUsereqStatusS...|
1475
- |`shouldPreservePromptCommandStateOnShutdown`|fn||217-220|export function shouldPreservePromptCommandStateOnShutdow...|
1476
- |`restorePersistedPromptCommandState`|fn||229-240|function restorePersistedPromptCommandState(|
1477
- |`getContextSessionFile`|fn||248-252|function getContextSessionFile(ctx: ExtensionContext): st...|
1478
- |`isStaleExtensionContextError`|fn||261-264|export function isStaleExtensionContextError(error: unkno...|
1479
- |`resetElapsedState`|fn||273-277|function resetElapsedState(state: PiUsereqStatusState): void|
1480
- |`shouldResetElapsedStateOnSessionStart`|fn||286-289|function shouldResetElapsedStateOnSessionStart(event: unk...|
1481
- |`shouldResetWorkflowStateOnSessionStart`|fn||298-301|function shouldResetWorkflowStateOnSessionStart(event: un...|
1482
- |`createStatusThemeAdapter`|fn||311-320|function createStatusThemeAdapter(theme: RawStatusTheme):...|
1483
- |`colorize`|fn||312-319|const colorize = (color: StatusForegroundColor, text: str...|
1484
- |`resolveStatusBranchValue`|fn||329-331|function resolveStatusBranchValue(ctx: ExtensionContext):...|
1485
- |`normalizeContextUsage`|fn||342-359|function normalizeContextUsage(|
1486
- |`refreshContextUsage`|fn||371-376|function refreshContextUsage(|
1487
- |`resolveContextUsageIconText`|fn||385-402|function resolveContextUsageIconText(|
1488
- |`formatContextUsageBar`|fn||412-424|function formatContextUsageBar(|
1489
- |`formatStatusDuration`|fn||435-440|function formatStatusDuration(durationMs: number): string|
1490
- |`formatCompletedStatusDuration`|fn||451-455|function formatCompletedStatusDuration(|
1491
- |`formatElapsedStatusValue`|fn||468-478|function formatElapsedStatusValue(|
1492
- |`formatStatusField`|fn||489-495|function formatStatusField(|
1493
- |`formatRenderedStatusField`|fn||507-513|function formatRenderedStatusField(|
1494
- |`formatWorkflowStateValue`|fn||523-531|function formatWorkflowStateValue(|
1495
- |`didAgentEndAbort`|fn||542-549|function didAgentEndAbort(messages: AgentEndEvent["messag...|
1496
- |`buildPiUsereqStatusText`|fn||562-586|function buildPiUsereqStatusText(|
1497
- |`stopStatusTicker`|fn||596-601|function stopStatusTicker(controller: PiUsereqStatusContr...|
1498
- |`syncPiUsereqStatusTicker`|fn||613-629|function syncPiUsereqStatusTicker(|
1499
- |`createPiUsereqStatusController`|fn||637-652|export function createPiUsereqStatusController(): PiUsere...|
1500
- |`setPiUsereqStatusConfig`|fn||664-669|export function setPiUsereqStatusConfig(|
1501
- |`renderPiUsereqStatus`|fn||679-709|export function renderPiUsereqStatus(|
1502
- |`setPiUsereqWorkflowState`|fn||720-731|export function setPiUsereqWorkflowState(|
1503
- |`updateExtensionStatus`|fn||743-807|export function updateExtensionStatus(|
1504
- |`disposePiUsereqStatusController`|fn||818-823|export function disposePiUsereqStatusController(|
1489
+ |`StatusForegroundColor`|type||31||
1490
+ |`RawStatusTheme`|iface||41-43|interface RawStatusTheme|
1491
+ |`StatusThemeAdapter`|iface||51-56|interface StatusThemeAdapter|
1492
+ |`PiUsereqStatusHookName`|type||99||
1493
+ |`PiUsereqPromptRequest`|type||105||
1494
+ |`PiUsereqWorkflowState`|type||111||
1495
+ |`PiUsereqStatusState`|iface||117-126|export interface PiUsereqStatusState|
1496
+ |`PiUsereqStatusController`|iface||135-140|export interface PiUsereqStatusController|
1497
+ |`PiUsereqStatusPersistenceStore`|iface||146-149|interface PiUsereqStatusPersistenceStore|
1498
+ |`getPiUsereqStatusPersistenceStore`|fn||163-172|function getPiUsereqStatusPersistenceStore(): PiUsereqSta...|
1499
+ |`restorePersistedElapsedState`|fn||180-184|function restorePersistedElapsedState(state: PiUsereqStat...|
1500
+ |`persistElapsedState`|fn||192-196|function persistElapsedState(state: PiUsereqStatusState):...|
1501
+ |`persistPromptCommandState`|fn||204-210|function persistPromptCommandState(state: PiUsereqStatusS...|
1502
+ |`shouldPreservePromptCommandStateOnShutdown`|fn||219-222|export function shouldPreservePromptCommandStateOnShutdow...|
1503
+ |`restorePersistedPromptCommandState`|fn||231-242|function restorePersistedPromptCommandState(|
1504
+ |`getContextSessionFile`|fn||250-254|function getContextSessionFile(ctx: ExtensionContext): st...|
1505
+ |`isStaleExtensionContextError`|fn||263-266|export function isStaleExtensionContextError(error: unkno...|
1506
+ |`resetElapsedState`|fn||275-279|function resetElapsedState(state: PiUsereqStatusState): void|
1507
+ |`shouldResetElapsedStateOnSessionStart`|fn||288-291|function shouldResetElapsedStateOnSessionStart(event: unk...|
1508
+ |`shouldResetWorkflowStateOnSessionStart`|fn||300-303|function shouldResetWorkflowStateOnSessionStart(event: un...|
1509
+ |`createStatusThemeAdapter`|fn||313-322|function createStatusThemeAdapter(theme: RawStatusTheme):...|
1510
+ |`colorize`|fn||314-321|const colorize = (color: StatusForegroundColor, text: str...|
1511
+ |`resolveStatusBranchValue`|fn||331-333|function resolveStatusBranchValue(ctx: ExtensionContext):...|
1512
+ |`normalizeContextUsage`|fn||344-361|function normalizeContextUsage(|
1513
+ |`refreshContextUsage`|fn||373-378|function refreshContextUsage(|
1514
+ |`resolveContextUsageIconText`|fn||387-404|function resolveContextUsageIconText(|
1515
+ |`formatContextUsageBar`|fn||414-426|function formatContextUsageBar(|
1516
+ |`formatStatusDuration`|fn||437-442|function formatStatusDuration(durationMs: number): string|
1517
+ |`formatCompletedStatusDuration`|fn||453-457|function formatCompletedStatusDuration(|
1518
+ |`formatElapsedStatusValue`|fn||470-480|function formatElapsedStatusValue(|
1519
+ |`formatStatusField`|fn||491-497|function formatStatusField(|
1520
+ |`formatRenderedStatusField`|fn||509-515|function formatRenderedStatusField(|
1521
+ |`formatWorkflowStateValue`|fn||525-533|function formatWorkflowStateValue(|
1522
+ |`didAgentEndAbort`|fn||544-551|function didAgentEndAbort(messages: AgentEndEvent["messag...|
1523
+ |`resolvePiUsereqRuntimeSoundLevel`|fn||561-566|function resolvePiUsereqRuntimeSoundLevel(|
1524
+ |`buildPiUsereqStatusText`|fn||579-603|function buildPiUsereqStatusText(|
1525
+ |`stopStatusTicker`|fn||613-618|function stopStatusTicker(controller: PiUsereqStatusContr...|
1526
+ |`syncPiUsereqStatusTicker`|fn||630-646|function syncPiUsereqStatusTicker(|
1527
+ |`createPiUsereqStatusController`|fn||654-670|export function createPiUsereqStatusController(): PiUsere...|
1528
+ |`setPiUsereqStatusConfig`|fn||683-688|export function setPiUsereqStatusConfig(|
1529
+ |`getPiUsereqRuntimeSoundLevel`|fn||697-701|export function getPiUsereqRuntimeSoundLevel(|
1530
+ |`setPiUsereqRuntimeSoundLevel`|fn||712-722|export function setPiUsereqRuntimeSoundLevel(|
1531
+ |`renderPiUsereqStatus`|fn||732-763|export function renderPiUsereqStatus(|
1532
+ |`setPiUsereqWorkflowState`|fn||774-785|export function setPiUsereqWorkflowState(|
1533
+ |`updateExtensionStatus`|fn||797-864|export function updateExtensionStatus(|
1534
+ |`disposePiUsereqStatusController`|fn||875-880|export function disposePiUsereqStatusController(|
1505
1535
 
1506
1536
 
1507
1537
  ---
@@ -2102,7 +2132,7 @@ import type { UseReqConfig } from "./config.js";
2102
2132
 
2103
2133
  - type `export type PiNotifyConfigFields = Pick<` (L115)
2104
2134
  - @brief Describes the configuration fields consumed by pi-notify helpers.
2105
- - @details Narrows the full project config to the persisted notify, sound, and Pushover fields used by status rendering, prompt-end routing, and shortcut toggles. Compile-time only and introduces no runtime cost.
2135
+ - @details Narrows the full project config to the notify, sound, and Pushover fields used by status rendering and prompt-end routing. Callers may override `notify-sound` with the active runtime sound level before dispatch. Compile-time only and introduces no runtime cost.
2106
2136
  - type `type PiNotifySpawn = typeof spawn;` (L145)
2107
2137
  - @brief Describes the shell-spawn callback used by prompt-end command dispatch.
2108
2138
  - @details Narrows the injected spawn surface so deterministic tests can capture detached shell invocations without patching global module state externally. Compile-time only and introduces no runtime cost.
@@ -2187,10 +2217,10 @@ import type { UseReqConfig } from "./config.js";
2187
2217
 
2188
2218
  ### fn `export function cyclePiNotifySoundLevel(currentLevel: PiNotifySoundLevel): PiNotifySoundLevel` (L371-377)
2189
2219
  - @brief Cycles one sound level through the canonical shortcut order.
2190
- - @details Advances persisted sound state in the exact order `none -> low -> mid -> high -> none`, enabling deterministic shortcut toggling and menu reuse. Runtime is O(1). No external state is mutated.
2191
- - @param[in] currentLevel {PiNotifySoundLevel} Current persisted sound level.
2192
- - @return {PiNotifySoundLevel} Next sound level in the cycle.
2193
- - @satisfies REQ-134
2220
+ - @details Advances the active runtime sound state in the exact order `none -> low -> mid -> high -> none`, enabling deterministic shortcut toggling without mutating persisted boot configuration. Runtime is O(1). No external state is mutated.
2221
+ - @param[in] currentLevel {PiNotifySoundLevel} Current active runtime sound level.
2222
+ - @return {PiNotifySoundLevel} Next runtime sound level in the cycle.
2223
+ - @satisfies REQ-286
2194
2224
 
2195
2225
  ### fn `function isPiNotifyOutcomeEnabled(` (L388-402)
2196
2226
  - @brief Tests whether one outcome-specific toggle is enabled.
@@ -2445,29 +2475,29 @@ import type { UseReqConfig } from "./config.js";
2445
2475
 
2446
2476
  ---
2447
2477
 
2448
- # pi-usereq-tools.ts | TypeScript | 178L | 7 symbols | 0 imports | 17 comments
2478
+ # pi-usereq-tools.ts | TypeScript | 180L | 7 symbols | 0 imports | 17 comments
2449
2479
  > Path: `src/core/pi-usereq-tools.ts`
2450
2480
  - @brief Declares the configurable pi-usereq active-tool inventory.
2451
2481
  - @details Provides canonical custom-tool names, supported embedded-tool names, default enablement subsets, and normalization helpers shared by configuration loading, extension startup, and test doubles. The module is side-effect free. Lookup and normalization costs are linear in configured tool count.
2452
2482
 
2453
2483
  ## Definitions
2454
2484
 
2455
- - type `export type PiUsereqCustomToolName = (typeof PI_USEREQ_CUSTOM_TOOL_NAMES)[number];` (L79)
2485
+ - type `export type PiUsereqCustomToolName = (typeof PI_USEREQ_CUSTOM_TOOL_NAMES)[number];` (L81)
2456
2486
  - @brief Represents one valid extension-owned configurable tool identifier.
2457
2487
  - @details Narrows arbitrary strings to the literal union derived from `PI_USEREQ_CUSTOM_TOOL_NAMES`. The alias is compile-time only and introduces no runtime cost.
2458
- - type `export type PiUsereqEmbeddedToolName = (typeof PI_USEREQ_EMBEDDED_TOOL_NAMES)[number];` (L85)
2488
+ - type `export type PiUsereqEmbeddedToolName = (typeof PI_USEREQ_EMBEDDED_TOOL_NAMES)[number];` (L87)
2459
2489
  - @brief Represents one valid embedded configurable tool identifier.
2460
2490
  - @details Narrows arbitrary strings to the literal union derived from `PI_USEREQ_EMBEDDED_TOOL_NAMES`. The alias is compile-time only and introduces no runtime cost.
2461
- - type `export type PiUsereqStartupToolName = (typeof PI_USEREQ_STARTUP_TOOL_NAMES)[number];` (L91)
2491
+ - type `export type PiUsereqStartupToolName = (typeof PI_USEREQ_STARTUP_TOOL_NAMES)[number];` (L93)
2462
2492
  - @brief Represents one valid configurable active-tool identifier.
2463
2493
  - @details Narrows arbitrary strings to the literal union derived from `PI_USEREQ_STARTUP_TOOL_NAMES`. The alias is compile-time only and introduces no runtime cost.
2464
- ### fn `export function isPiUsereqEmbeddedToolName(name: string): name is PiUsereqEmbeddedToolName` (L117-119)
2494
+ ### fn `export function isPiUsereqEmbeddedToolName(name: string): name is PiUsereqEmbeddedToolName` (L119-121)
2465
2495
  - @brief Tests whether one tool name belongs to the supported embedded-tool subset.
2466
2496
  - @details Performs one set-membership probe against `PI_USEREQ_EMBEDDED_TOOL_SET`. Runtime is O(1). No external state is mutated.
2467
2497
  - @param[in] name {string} Candidate tool name.
2468
2498
  - @return {boolean} `true` when the name belongs to the embedded configurable-tool subset.
2469
2499
 
2470
- ### fn `export function normalizeEnabledPiUsereqTools(value: unknown): PiUsereqStartupToolName[]` (L129-136)
2500
+ ### fn `export function normalizeEnabledPiUsereqTools(value: unknown): PiUsereqStartupToolName[]` (L131-138)
2471
2501
  - @brief Normalizes a user-configured active-tool list.
2472
2502
  - @details Returns the default enabled-tool tuple when the input is not an array. Otherwise filters to string entries, removes names outside the configurable tool set, and deduplicates while preserving first-seen order. Time complexity is O(n). No external state is mutated.
2473
2503
  - @param[in] value {unknown} Raw configuration payload for `enabled-tools`.
@@ -2475,14 +2505,14 @@ import type { UseReqConfig } from "./config.js";
2475
2505
  - @satisfies REQ-064
2476
2506
  - @post Returned values are members of `PI_USEREQ_STARTUP_TOOL_NAMES` only.
2477
2507
 
2478
- ### fn `function buildPiUsereqStartupToolSortKey(` (L145-153)
2508
+ ### fn `function buildPiUsereqStartupToolSortKey(` (L147-155)
2479
2509
  - @brief Builds the menu-order partition key for one configurable tool name.
2480
2510
  - @details Encodes the documented `Enable tools` ordering by grouping custom tools before embedded tools, placing non-`files-*` custom tools before `files-*` custom tools, and moving default-disabled names to the tail of each resolved partition. Runtime is O(1). No external state is mutated.
2481
2511
  - @param[in] name {PiUsereqStartupToolName} Canonical configurable tool name.
2482
2512
  - @return {[number, number, number, string]} Stable tuple `{group, subgroup, default_state, name}` used for lexicographic ordering.
2483
2513
  - @satisfies REQ-007, REQ-231, REQ-232
2484
2514
 
2485
- ### fn `export function comparePiUsereqStartupToolNames(` (L163-178)
2515
+ ### fn `export function comparePiUsereqStartupToolNames(` (L165-180)
2486
2516
  - @brief Compares two configurable tool names using the documented menu order.
2487
2517
  - @details Applies the partition key emitted by `buildPiUsereqStartupToolSortKey(...)` and falls back to lexical comparison inside the final key slot so the `Enable tools` submenu stays deterministic across runtimes. Runtime is O(1). No external state is mutated.
2488
2518
  - @param[in] left {PiUsereqStartupToolName} Left configurable tool name.
@@ -2493,28 +2523,28 @@ import type { UseReqConfig } from "./config.js";
2493
2523
  ## Symbol Index
2494
2524
  |Symbol|Kind|Vis|Lines|Sig|
2495
2525
  |---|---|---|---|---|
2496
- |`PiUsereqCustomToolName`|type||79||
2497
- |`PiUsereqEmbeddedToolName`|type||85||
2498
- |`PiUsereqStartupToolName`|type||91||
2499
- |`isPiUsereqEmbeddedToolName`|fn||117-119|export function isPiUsereqEmbeddedToolName(name: string):...|
2500
- |`normalizeEnabledPiUsereqTools`|fn||129-136|export function normalizeEnabledPiUsereqTools(value: unkn...|
2501
- |`buildPiUsereqStartupToolSortKey`|fn||145-153|function buildPiUsereqStartupToolSortKey(|
2502
- |`comparePiUsereqStartupToolNames`|fn||163-178|export function comparePiUsereqStartupToolNames(|
2526
+ |`PiUsereqCustomToolName`|type||81||
2527
+ |`PiUsereqEmbeddedToolName`|type||87||
2528
+ |`PiUsereqStartupToolName`|type||93||
2529
+ |`isPiUsereqEmbeddedToolName`|fn||119-121|export function isPiUsereqEmbeddedToolName(name: string):...|
2530
+ |`normalizeEnabledPiUsereqTools`|fn||131-138|export function normalizeEnabledPiUsereqTools(value: unkn...|
2531
+ |`buildPiUsereqStartupToolSortKey`|fn||147-155|function buildPiUsereqStartupToolSortKey(|
2532
+ |`comparePiUsereqStartupToolNames`|fn||165-180|export function comparePiUsereqStartupToolNames(|
2503
2533
 
2504
2534
 
2505
2535
  ---
2506
2536
 
2507
- # prompt-command-catalog.ts | TypeScript | 46L | 2 symbols | 0 imports | 4 comments
2537
+ # prompt-command-catalog.ts | TypeScript | 45L | 2 symbols | 0 imports | 4 comments
2508
2538
  > Path: `src/core/prompt-command-catalog.ts`
2509
- - @brief Declares the canonical bundled `req-*` prompt-command inventory.
2510
- - @details Centralizes prompt-command names shared by extension registration, configuration normalization, debug-menu rendering, and prompt-runtime orchestration. The module is side-effect free. Lookup cost is O(1) per exported constant access.
2539
+ - @brief Declares the canonical bundled prompt-backed `req-*` command inventory.
2540
+ - @details Centralizes only prompt-template-backed command names shared by extension registration, configuration normalization, debug-menu rendering, and prompt-runtime orchestration. Specialized slash commands such as `req-references` and `req-reset` are registered outside this inventory. The module is side-effect free. Lookup cost is O(1) per exported constant access.
2511
2541
 
2512
2542
  ## Definitions
2513
2543
 
2514
- - type `export type PromptCommandName = (typeof PROMPT_COMMAND_NAMES)[number];` (L34)
2544
+ - type `export type PromptCommandName = (typeof PROMPT_COMMAND_NAMES)[number];` (L33)
2515
2545
  - @brief Narrows prompt-command identifiers to the bundled command set.
2516
2546
  - @details Compile-time alias reused by orchestration helpers, debug inventory normalization, and command registration. The alias introduces no runtime cost.
2517
- ### fn `export function formatPromptCommandName(` (L42-46)
2547
+ ### fn `export function formatPromptCommandName(` (L41-45)
2518
2548
  - @brief Formats one bundled prompt-command identifier as its slash-command name.
2519
2549
  - @details Prefixes the canonical prompt name with `req-` so debug menus and log filters can use the invokable slash-command form without duplicating the underlying inventory. Runtime is O(n) in prompt-name length. No external state is mutated.
2520
2550
  - @param[in] promptName {PromptCommandName} Canonical bundled prompt name.
@@ -2523,16 +2553,16 @@ import type { UseReqConfig } from "./config.js";
2523
2553
  ## Symbol Index
2524
2554
  |Symbol|Kind|Vis|Lines|Sig|
2525
2555
  |---|---|---|---|---|
2526
- |`PromptCommandName`|type||34||
2527
- |`formatPromptCommandName`|fn||42-46|export function formatPromptCommandName(|
2556
+ |`PromptCommandName`|type||33||
2557
+ |`formatPromptCommandName`|fn||41-45|export function formatPromptCommandName(|
2528
2558
 
2529
2559
 
2530
2560
  ---
2531
2561
 
2532
- # prompt-command-runtime.ts | TypeScript | 1816L | 54 symbols | 12 imports | 58 comments
2562
+ # prompt-command-runtime.ts | TypeScript | 1955L | 56 symbols | 12 imports | 60 comments
2533
2563
  > Path: `src/core/prompt-command-runtime.ts`
2534
- - @brief Implements prompt-command preflight and worktree orchestration.
2535
- - @details Centralizes `req-<prompt>` repository validation, prompt-specific required-document checks, slash-command-owned worktree naming and lifecycle handling, session-backed cwd switching plus verification, persisted replacement-session context reuse for non-command lifecycle handlers, matched-success fast-forward merge finalization with restored-session transcript preservation, and command-side abort cleanup. Runtime is dominated by git subprocess execution plus bounded filesystem and session-file metadata checks. Side effects include active-session replacement, worktree creation and deletion, branch merges, and filesystem reads and writes.
2564
+ - @brief Implements bundled prompt-command preflight and worktree orchestration.
2565
+ - @details Centralizes prompt-template-backed `req-<prompt>` repository validation, prompt-specific required-document checks, slash-command-owned worktree naming and lifecycle handling, reusable transcript-preservation plus session-restoration helpers, persisted replacement-session context reuse for non-command lifecycle handlers, matched-success stash-assisted fast-forward merge finalization, and command-side abort cleanup. Runtime is dominated by git subprocess execution plus bounded filesystem and session-file metadata checks. Side effects include active-session replacement, worktree creation and deletion, branch merges, stash-stack mutation, and filesystem reads and writes.
2536
2566
 
2537
2567
  ## Imports
2538
2568
  ```
@@ -2543,7 +2573,7 @@ import { ReqError } from "./errors.js";
2543
2573
  import { classifyPiNotifyOutcome, type PiNotifyOutcome } from "./pi-notify.js";
2544
2574
  import {
2545
2575
  import {
2546
- import {
2576
+ import { type PromptCommandName } from "./prompt-command-catalog.js";
2547
2577
  import {
2548
2578
  import { SessionManager } from "@mariozechner/pi-coding-agent";
2549
2579
  import { resolveRuntimeGitPath } from "./runtime-project-paths.js";
@@ -2552,57 +2582,57 @@ import {
2552
2582
 
2553
2583
  ## Definitions
2554
2584
 
2555
- ### iface `export interface PromptRequiredDocSpec` (L45-48)
2585
+ ### iface `export interface PromptRequiredDocSpec` (L42-45)
2556
2586
  - @brief Describes one canonical required-document probe.
2557
2587
  - @details Binds a canonical doc filename to the remediation prompt command surfaced on failure so prompt-specific doc validation can stay deterministic. The interface is compile-time only and introduces no runtime cost.
2558
2588
 
2559
- ### iface `export interface PromptCommandExecutionPlan` (L54-68)
2589
+ ### iface `export interface PromptCommandExecutionPlan` (L51-65)
2560
2590
  - @brief Describes one prompt-command execution plan tracked across lifecycle hooks.
2561
2591
  - @details Stores the prompt identity, runtime git root, associated branch name, original project base, execution context path, persisted origin and execution session files, and optional worktree metadata so the extension can switch all cwd surfaces before prompt dispatch and finalize worktree lifecycle after agent end. The interface is compile-time only and introduces no runtime cost.
2562
2592
 
2563
- ### iface `interface PromptCommandPostCreateHookContext` (L74-79)
2593
+ ### iface `interface PromptCommandPostCreateHookContext` (L71-76)
2564
2594
  - @brief Describes one post-create test hook payload for prompt-command worktrees.
2565
2595
  - @details Exposes the git root, generated worktree name, sibling worktree path, and effective execution base so tests can simulate post-create verification failures deterministically. The interface is compile-time only and introduces no runtime cost.
2566
2596
 
2567
- - type `type PromptCommandPostCreateHook = (context: PromptCommandPostCreateHookContext) => void;` (L85)
2597
+ - type `type PromptCommandPostCreateHook = (context: PromptCommandPostCreateHookContext) => void;` (L82)
2568
2598
  - @brief Represents one synchronous test hook invoked after prompt worktree creation.
2569
2599
  - @details Allows tests to mutate or remove newly created worktree artifacts before verification executes. The alias is compile-time only and introduces no runtime cost.
2570
- ### iface `interface PromptCommandDebugOptions` (L91-94)
2600
+ ### iface `interface PromptCommandDebugOptions` (L88-91)
2571
2601
  - @brief Describes optional debug logging context for prompt orchestration helpers.
2572
2602
  - @details Carries the effective project configuration and current workflow state so prompt-runtime helpers can append selected debug entries without depending on extension UI types. The interface is compile-time only and introduces no runtime cost.
2573
2603
 
2574
- ### iface `interface PromptCommandSessionMessageOptions` (L100-102)
2604
+ ### iface `interface PromptCommandSessionMessageOptions` (L97-99)
2575
2605
  - @brief Describes prompt-delivery options supported by replacement-session callbacks.
2576
2606
  - @details Mirrors the documented `sendUserMessage(...)` delivery modes needed when prompt orchestration targets a replacement session after a slash-command-owned session switch. The interface is compile-time only and introduces no runtime cost.
2577
2607
 
2578
- ### iface `interface PromptCommandSessionSwitchOptions` (L108-110)
2608
+ ### iface `interface PromptCommandSessionSwitchOptions` (L105-107)
2579
2609
  - @brief Describes the replacement-session callback options accepted by session switching.
2580
2610
  - @details Mirrors the documented pi runtime `withSession(...)` hook so prompt-command orchestration can continue work against the replacement session after the old command context becomes stale. The interface is compile-time only and introduces no runtime cost.
2581
2611
 
2582
- ### iface `interface PromptCommandActiveContext extends PromptCommandSessionContext` : PromptCommandSessionContext (L116-121)
2612
+ ### iface `interface PromptCommandActiveContext extends PromptCommandSessionContext` : PromptCommandSessionContext (L113-118)
2583
2613
  - @brief Describes the minimal session-bound surface available after session replacement.
2584
2614
  - @details Extends the shared prompt-command context with `sendUserMessage(...)` so prompt dispatch can target the replacement session without reusing stale pre-switch runtime objects. The interface is compile-time only and introduces no runtime cost.
2585
2615
 
2586
- ### iface `interface PromptCommandSessionEntry` (L127-133)
2616
+ ### iface `interface PromptCommandSessionEntry` (L124-130)
2587
2617
  - @brief Describes one serializable session entry copied into a materialized execution-session file.
2588
2618
  - @details Captures the stable tree-entry fields needed to write a JSONL session snapshot for cross-cwd session replacement when the origin session file has not been flushed yet. The interface is compile-time only and introduces no runtime cost.
2589
2619
 
2590
- ### iface `interface PromptCommandSessionContext` (L139-151)
2620
+ ### iface `interface PromptCommandSessionContext` (L136-148)
2591
2621
  - @brief Describes the minimal command-context session surface used by prompt orchestration.
2592
2622
  - @details Narrows extension command contexts to the `switchSession(...)` hook, the mutable `cwd` mirror, and the session metadata probes required for cwd verification and session snapshot materialization. The interface is compile-time only and introduces no runtime cost.
2593
2623
 
2594
- ### iface `interface PromptCommandContextError extends Error` : Error (L157-159)
2624
+ ### iface `interface PromptCommandContextError extends Error` : Error (L154-156)
2595
2625
  - @brief Describes one error object enriched with a replacement-session context.
2596
2626
  - @details Allows prompt orchestration helpers to preserve the last valid session-bound context across replacement boundaries so callers can continue notifications and status updates after switch-triggered failures. The interface is compile-time only and introduces no runtime cost.
2597
2627
 
2598
- ### fn `function isUsablePromptSessionFile(` (L174-192)
2628
+ ### fn `function isUsablePromptSessionFile(` (L171-189)
2599
2629
  - @brief Tests whether the current session file remains reusable for prompt-command bootstrap.
2600
2630
  - @details Accepts only persisted session files whose header cwd is readable, still exists on disk, and remains inside the active project base. This rejects stale execution-session files that still point at deleted or sibling worktrees from earlier prompt runs. Runtime is O(p) plus one session-header read. No external state is mutated.
2601
2631
  - @param[in] sessionFile {string | undefined} Candidate current session file.
2602
2632
  - @param[in] projectBase {string} Active project base path.
2603
2633
  - @return {sessionFile is string} `true` when the session file remains reusable for prompt bootstrap.
2604
2634
 
2605
- ### fn `function resolvePromptSessionFile(sessionFile: string | undefined, cwd: string): string` (L202-212)
2635
+ ### fn `function resolvePromptSessionFile(sessionFile: string | undefined, cwd: string): string` (L199-209)
2606
2636
  - @brief Resolves the session file path used as the origin for prompt-command session switching.
2607
2637
  - @details Reuses the current session file only when its persisted header cwd is still readable, exists on disk, and remains inside the active project base. Otherwise allocates a fresh session file path rooted at the supplied cwd so later worktree switching and restoration never inherit stale deleted-worktree session metadata. Runtime is dominated by one optional session-header read plus optional session-file allocation. Side effects include session-file path allocation when the active session metadata is stale or ephemeral.
2608
2638
  - @param[in] sessionFile {string | undefined} Current active session file when available.
@@ -2610,7 +2640,7 @@ import {
2610
2640
  - @return {string} Session file path reserved for prompt orchestration.
2611
2641
  - @throws {ReqError} Throws when a session file path cannot be resolved.
2612
2642
 
2613
- ### fn `function writePromptExecutionSessionSnapshot(` (L226-252)
2643
+ ### fn `function writePromptExecutionSessionSnapshot(` (L223-249)
2614
2644
  - @brief Writes one execution-session snapshot file with the target worktree cwd.
2615
2645
  - @details Persists a version-3 JSONL session header whose `cwd` equals the supplied target worktree path, then appends the supplied current-session branch entries unchanged so pi can reopen the replacement session in the correct cwd even when the origin session file has not been flushed yet. Runtime is O(n) in branch-entry count plus serialized byte size. Side effects include directory creation and file overwrite.
2616
2646
  - @param[in] sessionFile {string} Target execution-session file path.
@@ -2622,7 +2652,7 @@ import {
2622
2652
  - @throws {ReqError} Throws when the execution-session snapshot cannot be written.
2623
2653
  - @satisfies REQ-271
2624
2654
 
2625
- ### fn `function createPromptExecutionSessionFile(` (L265-288)
2655
+ ### fn `function createPromptExecutionSessionFile(` (L262-285)
2626
2656
  - @brief Creates the persisted session file used for worktree-backed prompt execution.
2627
2657
  - @details Forks the resolved origin session into the target cwd when the origin session file is already persisted. Otherwise allocates a new execution-session path, materializes a JSONL header whose `cwd` equals the target worktree path, and copies the current in-memory session branch so pi can switch into the worktree session with the correct runtime cwd. Runtime is dominated by session-file copy or snapshot-write cost. Side effects include session-file creation under the target cwd session directory.
2628
2658
  - @param[in] sourceSessionFile {string} Origin session file path.
@@ -2633,25 +2663,25 @@ import {
2633
2663
  - @throws {ReqError} Throws when the execution-session file cannot be created.
2634
2664
  - @satisfies REQ-271
2635
2665
 
2636
- ### fn `function getPromptSessionCwd(ctx?: PromptCommandSessionContext): string | undefined` (L296-304)
2666
+ ### fn `function getPromptSessionCwd(ctx?: PromptCommandSessionContext): string | undefined` (L293-301)
2637
2667
  - @brief Reads the current active session cwd from a prompt-command context.
2638
2668
  - @details Returns the session-manager cwd only when the supplied context exposes the documented `getCwd()` probe and the probe remains valid after any prior session replacement. Stale or missing probes degrade to `undefined` so verification paths never reuse invalidated pre-switch session objects. Runtime is O(1). No external state is mutated.
2639
2669
  - @param[in] ctx {PromptCommandSessionContext | undefined} Candidate prompt-command context.
2640
2670
  - @return {string | undefined} Active session cwd when available.
2641
2671
 
2642
- ### fn `function getPromptSessionFile(ctx?: PromptCommandSessionContext): string | undefined` (L312-320)
2672
+ ### fn `function getPromptSessionFile(ctx?: PromptCommandSessionContext): string | undefined` (L309-317)
2643
2673
  - @brief Reads the current active session file from a prompt-command context.
2644
2674
  - @details Returns the session-manager file path only when the supplied context exposes the documented `getSessionFile()` probe and the probe remains valid after any prior session replacement. Stale or missing probes degrade to `undefined` so verification paths never reuse invalidated pre-switch session objects. Runtime is O(1). No external state is mutated.
2645
2675
  - @param[in] ctx {PromptCommandSessionContext | undefined} Candidate prompt-command context.
2646
2676
  - @return {string | undefined} Active session file when available.
2647
2677
 
2648
- ### fn `function getPromptContextCwd(ctx?: PromptCommandSessionContext): string | undefined` (L328-334)
2678
+ ### fn `function getPromptContextCwd(ctx?: PromptCommandSessionContext): string | undefined` (L325-331)
2649
2679
  - @brief Reads the current context cwd from a prompt-command context.
2650
2680
  - @details Returns the context `cwd` only when the supplied getter remains valid after any prior session replacement. Stale getters degrade to `undefined` so verification paths never depend on invalidated pre-switch command objects. Runtime is O(1). No external state is mutated.
2651
2681
  - @param[in] ctx {PromptCommandSessionContext | undefined} Candidate prompt-command context.
2652
2682
  - @return {string | undefined} Context cwd when available.
2653
2683
 
2654
- ### fn `function resolvePromptCommandSwitchContext(` (L344-359)
2684
+ ### fn `function resolvePromptCommandSwitchContext(` (L341-356)
2655
2685
  - @brief Resolves the best available command-capable context for prompt session switching.
2656
2686
  - @details Prefers the caller-supplied context when it still exposes `switchSession(...)`, otherwise falls back to the persisted replacement-session context associated with the execution-session file so lifecycle handlers can complete closure when pi emits non-command event contexts. Runtime is O(1). No external state is mutated.
2657
2687
  - @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan whose execution-session file keys the persisted context.
@@ -2659,7 +2689,7 @@ import {
2659
2689
  - @return {{ context: PromptCommandSessionContext | undefined; source: "provided" | "persisted" | "missing" }} Preferred switch context plus its provenance.
2660
2690
  - @satisfies REQ-272, REQ-276
2661
2691
 
2662
- ### fn `function syncPromptCommandProcessCwd(expectedPath: string, stageLabel: string): void` (L370-390)
2692
+ ### fn `function syncPromptCommandProcessCwd(expectedPath: string, stageLabel: string): void` (L367-387)
2663
2693
  - @brief Aligns the host process cwd to one expected prompt-orchestration path.
2664
2694
  - @details Applies `process.chdir(...)` only when the host process is still anchored to a different directory than the active prompt session, then re-reads `process.cwd()` and throws a deterministic error when the mutation fails or does not take effect. Runtime is O(p) in path length plus one optional cwd mutation. Side effect: mutates the host process cwd.
2665
2695
  - @param[in] expectedPath {string} Path that `process.cwd()` must match.
@@ -2668,28 +2698,28 @@ import {
2668
2698
  - @throws {ReqError} Throws when `process.chdir(...)` fails or leaves `process.cwd()` misaligned.
2669
2699
  - @satisfies REQ-257, REQ-272
2670
2700
 
2671
- ### fn `function readPromptSessionFileCwd(sessionFile: string): string | undefined` (L398-422)
2701
+ ### fn `function readPromptSessionFileCwd(sessionFile: string): string | undefined` (L395-419)
2672
2702
  - @brief Reads the persisted working directory recorded in one prompt-command session file header.
2673
2703
  - @details Opens the JSONL session file, parses the first non-empty line as JSON, and returns the `cwd` field when present as a string so session-target verification can rely on live on-disk session state instead of stale handler-scoped `ctx` references. Runtime is O(n) in header size. No external state is mutated.
2674
2704
  - @param[in] sessionFile {string} Absolute session-file path.
2675
2705
  - @return {string | undefined} Persisted session cwd when readable; otherwise undefined.
2676
2706
 
2677
- ### fn `function readPromptSessionJsonLines(` (L431-478)
2707
+ ### fn `function readPromptSessionJsonLines(` (L428-475)
2678
2708
  - @brief Reads one persisted session file as ordered parsed JSONL records.
2679
2709
  - @details Loads the raw session file, preserves every non-empty serialized line verbatim, parses each line as one JSON object, and rejects unreadable or structurally invalid files so prompt-closure helpers can replay exact execution-session transcript records into the restored base session without reserialization drift. Runtime is O(n) in session-file size. No external state is mutated.
2680
2710
  - @param[in] sessionFile {string} Absolute session-file path.
2681
2711
  - @return {Array<{ rawLine: string; parsed: Record<string, unknown> }>} Parsed non-empty JSONL lines in file order.
2682
2712
  - @throws {ReqError} Throws when the file cannot be read, when it contains no JSONL records, when any record is not a JSON object, or when the header record is missing.
2683
2713
 
2684
- ### fn `function preservePromptCommandExecutionTranscript(plan: PromptCommandExecutionPlan): void` (L488-585)
2714
+ ### fn `export function preservePromptCommandExecutionTranscript(plan: PromptCommandExecutionPlan): void` (L485-582)
2685
2715
  - @brief Copies successful execution-session transcript records into the restored base session file.
2686
2716
  - @details Reads the execution session JSONL file, preserves the original base-session header when it already exists, materializes a restored base-session header when the reserved original session file is still pending persistence, appends any execution-session records missing from the original session in original execution order, and re-reads the restored file to verify both `base-path` cwd and copied entry identifiers. Runtime is O(n) in combined session-file size. Side effects include session-file creation or append operations for the restored base session.
2687
2717
  - @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan whose original and execution session files must be synchronized.
2688
2718
  - @return {void} No return value.
2689
2719
  - @throws {ReqError} Throws when either session file is unreadable or when appended execution records are not persisted to the original session file.
2690
- - @satisfies REQ-208
2720
+ - @satisfies REQ-208, REQ-307
2691
2721
 
2692
- ### fn `function verifyPromptCommandSessionTarget(` (L598-642)
2722
+ ### fn `function verifyPromptCommandSessionTarget(` (L595-639)
2693
2723
  - @brief Verifies that the active session file and cwd surfaces match one expected prompt-orchestration target.
2694
2724
  - @details Re-reads the persisted session-file header when present plus the host `process.cwd()` and throws on the first mismatch so prompt commands abort before prompt dispatch or prompt-end handling whenever session switching leaves execution attached to the wrong cwd. A missing persisted session file is treated as a non-fatal lazy-persistence state because pi's `SessionManager` writes session files on first assistant flush rather than eagerly during `ctx.switchSession(sessionPath)`; when the file is absent, pi aligns its internal session cwd to the live `process.cwd()`, so verifying `process.cwd()` alone is authoritative in that state. Reads of `ctx.cwd`, `ctx.sessionManager.getCwd()`, and `ctx.sessionManager.getSessionFile()` are advisory only because the pi `ctx.switchSession(sessionPath)` SDK contract does not mutate the handler-scoped `ctx` object, so those probes stay bound to the pre-switch session and a divergent value alone never triggers abort; they only surface a mismatch when they disagree with both the persisted header cwd and the live `process.cwd()`. Runtime is O(p) in aggregate path length plus one session-file header read. No external state is mutated.
2695
2725
  - @param[in] expectedSessionFile {string} Session file that must remain active.
@@ -2700,7 +2730,7 @@ import {
2700
2730
  - @throws {ReqError} Throws when the persisted session-file header cwd diverges from the expected target or when `process.cwd()` diverges from the expected target.
2701
2731
  - @satisfies REQ-257, REQ-272
2702
2732
 
2703
- ### fn `function verifyPromptCommandClosureArtifacts(` (L652-687)
2733
+ ### fn `function verifyPromptCommandClosureArtifacts(` (L649-684)
2704
2734
  - @brief Verifies persisted prompt execution artifacts before successful closure merge.
2705
2735
  - @details Re-reads the persisted execution-session header, verifies the worktree path still exists, confirms the sibling worktree remains registered, and confirms the linked branch is still present before prompt-end closure attempts to restore `base-path` and merge from the original repository. Unlike prompt-start activation checks, this helper intentionally does not require the live process cwd or current session-bound context to remain on `worktree-path`, because pi CLI may already have started end-of-session session replacement or other post-run housekeeping before the extension finishes closure handling. Runtime is dominated by one session-file read, two git subprocess checks, and bounded filesystem probes. No external state is mutated.
2706
2736
  - @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan.
@@ -2708,7 +2738,7 @@ import {
2708
2738
  - @throws {ReqError} Throws when persisted execution-session metadata or worktree artifacts no longer match the expected worktree target.
2709
2739
  - @satisfies REQ-208, REQ-219, REQ-258, REQ-282
2710
2740
 
2711
- ### fn `async function switchPromptCommandSession(` (L698-727)
2741
+ ### fn `async function switchPromptCommandSession(` (L695-724)
2712
2742
  - @brief Switches the active prompt session to one persisted session file when required.
2713
2743
  - @details Calls `ctx.switchSession(sessionPath, { withSession })` so current pi runtimes can expose a fresh replacement-session context for every post-switch session-bound operation. When a runtime ignores the callback, the helper falls back to the caller-supplied context and downstream verification continues to rely on the persisted session-file header plus `process.cwd()`. If pi surfaces only the documented stale-extension-context error while invalidating the old execution-session closure, the helper treats that side effect as non-fatal and lets downstream verification confirm whether the target session actually became active. Runtime is dominated by the session switch. Side effects include active-session replacement and cwd mutation by the host runtime.
2714
2744
  - @param[in] sessionFile {string} Target persisted session file.
@@ -2717,47 +2747,63 @@ import {
2717
2747
  - @throws {ReqError} Throws when the context cannot switch sessions, when the host cancels the switch, or when later verification proves the target session never became active.
2718
2748
  - @satisfies REQ-068, REQ-271, REQ-272
2719
2749
 
2720
- ### fn `function isPromptCommandStaleContextError(error: unknown): boolean` (L736-739)
2750
+ ### fn `function isPromptCommandStaleContextError(error: unknown): boolean` (L733-736)
2721
2751
  - @brief Detects the documented stale-extension-context runtime error during prompt-command session switching.
2722
2752
  - @details Matches the guarded pi runtime error emitted when the old execution-session closure is invalidated during a session replacement or reload. Prompt-command session-switch helpers use this detector to distinguish a late stale-context side effect from genuine switch failures, then rely on post-switch verification to confirm whether the target session actually became active. Runtime is O(n) in message length only when an error is supplied. No external state is mutated.
2723
2753
  - @param[in] error {unknown} Candidate thrown value.
2724
2754
  - @return {boolean} `true` when the value matches the stale-extension-context runtime error.
2725
2755
  - @satisfies REQ-280
2726
2756
 
2727
- ### fn `function attachPromptCommandErrorContext(` (L748-756)
2757
+ ### fn `function attachPromptCommandErrorContext(` (L745-753)
2728
2758
  - @brief Attaches the last valid prompt-command context to one thrown error.
2729
2759
  - @details Preserves the replacement-session context discovered after `ctx.switchSession(...)` so outer callers can continue UI notifications and cleanup without reusing stale pre-switch command objects. Runtime is O(1). Side effect: mutates the error object when it is an `Error` instance.
2730
2760
  - @param[in] error {unknown} Thrown value.
2731
2761
  - @param[in] ctx {PromptCommandSessionContext | undefined} Last valid prompt-command context.
2732
2762
  - @return {unknown} Original thrown value with optional attached prompt context.
2733
2763
 
2734
- ### fn `export function getPromptCommandErrorContext(` (L764-770)
2764
+ ### fn `export function getPromptCommandErrorContext(` (L761-767)
2735
2765
  - @brief Reads an attached prompt-command context from one thrown error.
2736
2766
  - @details Returns the replacement-session context captured by prompt orchestration helpers when a switch-triggered failure occurs after the original command context became stale. Runtime is O(1). No external state is mutated.
2737
2767
  - @param[in] error {unknown} Thrown value.
2738
2768
  - @return {PromptCommandSessionContext | undefined} Attached prompt-command context when available.
2739
2769
 
2740
- ### fn `function runCapture(command: string[], cwd: string): ReturnType<typeof spawnSync>` (L851-856)
2770
+ ### fn `function runCapture(command: string[], cwd: string): ReturnType<typeof spawnSync>` (L845-850)
2741
2771
  - @brief Executes one git subprocess synchronously and captures UTF-8 output.
2742
2772
  - @details Delegates to `spawnSync`, preserves the supplied working directory, and returns the raw subprocess result used by prompt-command orchestration. Runtime is dominated by external process execution. Side effects include process spawning.
2743
2773
  - @param[in] command {string[]} Executable plus argument vector.
2744
2774
  - @param[in] cwd {string} Working directory for the subprocess.
2745
2775
  - @return {ReturnType<typeof spawnSync>} Captured subprocess result.
2746
2776
 
2747
- ### fn `export function setPromptCommandPostCreateHookForTests(` (L864-868)
2777
+ ### fn `function listPromptTrackedBasePathChanges(basePath: string): string[]` (L860-878)
2778
+ - @brief Lists tracked `base-path` status rows that require stash-assisted merge handling.
2779
+ - @details Executes `git status --porcelain`, retains only tracked rows whose index or worktree slot reports a change, and excludes untracked or ignored rows because the required `git stash` command does not preserve them. Runtime is dominated by one git subprocess plus O(n) parsing in status-line count. Side effects include process spawning.
2780
+ - @param[in] basePath {string} Restored project base path.
2781
+ - @return {string[]} Tracked status rows requiring stash-assisted merge handling.
2782
+ - @throws {ReqError} Throws when git status cannot be read from `basePath`.
2783
+ - @satisfies REQ-291
2784
+
2785
+ ### fn `function finalizePromptCommandMerge(` (L888-1010)
2786
+ - @brief Executes the successful-closure merge sequence from restored `base-path`.
2787
+ - @details Detects tracked staged or unstaged `base-path` changes, wraps the existing fast-forward merge in `git stash` and `git stash pop` when required, preserves the direct merge path when no tracked changes exist, emits a warning-only result after successful local-change restoration, and writes one merge-finalization debug entry when enabled. Runtime is dominated by up to four git subprocesses plus O(n) status parsing. Side effects include stash-stack mutation, branch merge attempts, and optional debug-log writes.
2788
+ - @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan whose branch should be merged.
2789
+ - @param[in] debugOptions {PromptCommandDebugOptions | undefined} Optional prompt debug logging context.
2790
+ - @return {{ mergeAttempted: boolean; mergeSucceeded: boolean; errorMessage?: string; warningMessage?: string }} Merge-attempt facts plus optional warning text.
2791
+ - @satisfies REQ-208, REQ-245, REQ-291, REQ-292
2792
+
2793
+ ### fn `export function setPromptCommandPostCreateHookForTests(` (L1018-1022)
2748
2794
  - @brief Stores or clears the prompt-command post-create test hook.
2749
2795
  - @details Enables deterministic simulation of post-create worktree verification failures without altering production control flow. Runtime is O(1). Side effect: mutates module-local test state.
2750
2796
  - @param[in] hook {PromptCommandPostCreateHook | undefined} Optional replacement hook.
2751
2797
  - @return {void} No return value.
2752
2798
 
2753
- ### fn `function resolvePromptDocsRoot(projectBase: string, config: UseReqConfig): string` (L877-880)
2799
+ ### fn `function resolvePromptDocsRoot(projectBase: string, config: UseReqConfig): string` (L1031-1034)
2754
2800
  - @brief Resolves the configured docs root for one project base.
2755
2801
  - @details Joins the project base with the normalized `docs-dir` value while stripping trailing separators from the persisted config field. Runtime is O(p) in path length. No external state is mutated.
2756
2802
  - @param[in] projectBase {string} Absolute project root.
2757
2803
  - @param[in] config {UseReqConfig} Effective project configuration.
2758
2804
  - @return {string} Absolute canonical docs root path.
2759
2805
 
2760
- ### fn `function resolveWorktreePaths(` (L890-917)
2806
+ ### fn `function resolveWorktreePaths(` (L1044-1071)
2761
2807
  - @brief Resolves the effective worktree project base relative to the git root.
2762
2808
  - @details Reuses the original project-base location relative to the git root so nested repository subdirectories remain aligned inside the sibling worktree. Runtime is O(p) in path length. No external state is mutated.
2763
2809
  - @param[in] projectBase {string} Original absolute project base path.
@@ -2765,51 +2811,51 @@ import {
2765
2811
  - @param[in] worktreeName {string} Created worktree name.
2766
2812
  - @return {{ worktreePath: string; worktreeBasePath: string }} Derived worktree paths.
2767
2813
 
2768
- ### fn `function sanitizePromptWorktreeBranchName(branch: string): string` (L925-927)
2814
+ ### fn `function sanitizePromptWorktreeBranchName(branch: string): string` (L1079-1081)
2769
2815
  - @brief Rewrites a branch name into a filesystem-safe token for prompt worktrees.
2770
2816
  - @details Replaces characters invalid for worktree directory and branch-name generation with `-`. Runtime is O(n). No external state is mutated.
2771
2817
  - @param[in] branch {string} Raw branch name.
2772
2818
  - @return {string} Sanitized token.
2773
2819
 
2774
- ### fn `function validatePromptWorktreeName(wtName: string): boolean` (L935-940)
2820
+ ### fn `function validatePromptWorktreeName(wtName: string): boolean` (L1089-1094)
2775
2821
  - @brief Validates a prompt-command-generated worktree or branch name.
2776
2822
  - @details Rejects empty names, dot-path markers, whitespace, and filesystem-invalid characters. Runtime is O(n). No external state is mutated.
2777
2823
  - @param[in] wtName {string} Candidate worktree name.
2778
2824
  - @return {boolean} `true` when the name is acceptable for worktree creation.
2779
2825
 
2780
- ### fn `function throwPromptGitStatusError(): never` (L948-950)
2826
+ ### fn `function throwPromptGitStatusError(): never` (L1102-1104)
2781
2827
  - @brief Throws the canonical prompt-command git-preflight failure.
2782
2828
  - @details Normalizes all repository-validation failures to the contractually stable prompt-command error string consumed by tests and downstream prompt workflows. Runtime is O(1). No external state is mutated.
2783
2829
  - @return {never} Always throws.
2784
2830
  - @throws {ReqError} Always throws with exit code `1`.
2785
2831
 
2786
- ### fn `function validatePromptGitState(projectBase: string, config?: UseReqConfig): string` (L961-1005)
2787
- - @brief Runs prompt-command-owned git validation and returns the runtime git root.
2788
- - @details Validates work-tree membership, porcelain cleanliness, and symbolic or detached `HEAD` presence without invoking extension custom-tool executors. Runtime is dominated by git subprocess execution. Side effects include process spawning.
2832
+ ### fn `export function validatePromptGitState(projectBase: string, config?: UseReqConfig): string` (L1115-1159)
2833
+ - @brief Runs slash-command-owned git validation and returns the runtime git root.
2834
+ - @details Validates work-tree membership, porcelain cleanliness, and symbolic or detached `HEAD` presence for bundled prompt commands and `req-references` without invoking extension custom-tool executors. Runtime is dominated by git subprocess execution. Side effects include process spawning.
2789
2835
  - @param[in] projectBase {string} Absolute current project base.
2790
2836
  - @param[in] config {UseReqConfig | undefined} Optional effective project configuration used to ignore extension-owned debug-log artifacts.
2791
2837
  - @return {string} Absolute runtime git root.
2792
2838
  - @throws {ReqError} Throws the canonical prompt-command git-preflight error on any validation failure.
2793
2839
  - @satisfies REQ-200, REQ-220
2794
2840
 
2795
- ### fn `function resolveCurrentPromptBranchName(gitRoot: string): string` (L1013-1018)
2841
+ ### fn `function resolveCurrentPromptBranchName(gitRoot: string): string` (L1167-1172)
2796
2842
  - @brief Resolves the current local branch name used by prompt-command orchestration.
2797
2843
  - @details Reads `git branch --show-current`, falls back to `unknown` when git cannot provide a branch name, and preserves the raw branch token for later worktree-name generation and state tracking. Runtime is dominated by one git subprocess. Side effects include process spawning.
2798
2844
  - @param[in] gitRoot {string} Absolute runtime git root.
2799
2845
  - @return {string} Current branch name or `unknown` when unavailable.
2800
2846
 
2801
- ### fn `function formatPromptWorktreeExecutionId(timestamp: Date): string` (L1032-1034)
2847
+ ### fn `function formatPromptWorktreeExecutionId(timestamp: Date): string` (L1186-1188)
2802
2848
  - @brief Formats one prompt-worktree execution identifier.
2803
2849
  - @details Serializes the supplied timestamp as `YYYYMMDDHHMMSS` with zero-padded calendar and clock fields so generated worktree names remain stable, lexicographically sortable, and requirement-compatible. Runtime is O(1). No external state is mutated.
2804
2850
  - @param[in] timestamp {Date} Timestamp to encode.
2805
2851
  - @return {string} Formatted execution identifier.
2806
2852
 
2807
- ### fn `function getNextPromptWorktreeExecutionId(): string` (L1041-1054)
2853
+ ### fn `function getNextPromptWorktreeExecutionId(): string` (L1195-1208)
2808
2854
  - @brief Resolves the next unique prompt-worktree execution identifier.
2809
2855
  - @details Formats the current wall-clock second as `YYYYMMDDHHMMSS`, then monotonically advances by one-second steps until the identifier is strictly greater than the last value emitted in the current host process. This preserves the documented timestamp-only name shape while preventing immediate same-process worktree-name reuse after fast back-to-back prompt starts. Runtime is O(1) in the common case and O(k) in repeated same-second collisions. Side effect: mutates process-scoped execution-id persistence.
2810
2856
  - @return {string} Unique execution identifier for worktree naming.
2811
2857
 
2812
- ### fn `function buildPromptWorktreeName(gitRoot: string, config: UseReqConfig): string` (L1065-1076)
2858
+ ### fn `function buildPromptWorktreeName(gitRoot: string, config: UseReqConfig): string` (L1219-1230)
2813
2859
  - @brief Builds the prompt-command worktree name without invoking agent-tool executors.
2814
2860
  - @details Combines the normalized persisted worktree prefix, repository basename, sanitized current branch, and timestamp execution identifier into the dedicated prompt-command worktree name. Runtime is O(1) plus git execution cost. Side effects include process spawning.
2815
2861
  - @param[in] gitRoot {string} Absolute runtime git root.
@@ -2818,21 +2864,21 @@ import {
2818
2864
  - @throws {ReqError} Throws when the generated name is invalid.
2819
2865
  - @satisfies REQ-206, REQ-220
2820
2866
 
2821
- ### fn `function promptWorktreeBranchExists(gitRoot: string, branchName: string): boolean` (L1085-1094)
2867
+ ### fn `function promptWorktreeBranchExists(gitRoot: string, branchName: string): boolean` (L1239-1248)
2822
2868
  - @brief Tests whether the exact prompt-command branch is present in the local branch list.
2823
2869
  - @details Queries `git branch --list --format=%(refname:short)` and returns a boolean without mutating repository state. Runtime is dominated by one git subprocess plus O(n) parsing in listed branch count. Side effects include process spawning.
2824
2870
  - @param[in] gitRoot {string} Absolute runtime git root.
2825
2871
  - @param[in] branchName {string} Candidate local branch name.
2826
2872
  - @return {boolean} `true` when the exact local branch is listed.
2827
2873
 
2828
- ### fn `function promptWorktreeRegistered(gitRoot: string, worktreePath: string): boolean` (L1103-1114)
2874
+ ### fn `function promptWorktreeRegistered(gitRoot: string, worktreePath: string): boolean` (L1257-1268)
2829
2875
  - @brief Tests whether the exact prompt-command worktree is registered.
2830
2876
  - @details Scans `git worktree list --porcelain` for the resolved target path so cleanup and verification can distinguish registered worktrees from unrelated sibling directories. Runtime is dominated by one git subprocess plus O(n) parsing in listed worktree count. Side effects include process spawning.
2831
2877
  - @param[in] gitRoot {string} Absolute runtime git root.
2832
2878
  - @param[in] worktreePath {string} Absolute sibling worktree path.
2833
2879
  - @return {boolean} `true` when the exact path is registered as a git worktree.
2834
2880
 
2835
- ### fn `function cleanupPromptWorktreeCreation(` (L1124-1138)
2881
+ ### fn `function cleanupPromptWorktreeCreation(` (L1278-1292)
2836
2882
  - @brief Removes partially created prompt-command worktree resources.
2837
2883
  - @details Force-removes the registered sibling worktree when present, deletes the matching local branch, and falls back to filesystem removal for leftover directories so failed prompt preflight leaves no reusable worktree residue. Runtime is dominated by git subprocess execution. Side effects include branch deletion and directory removal.
2838
2884
  - @param[in] gitRoot {string} Absolute runtime git root.
@@ -2840,7 +2886,7 @@ import {
2840
2886
  - @param[in] worktreeName {string} Exact worktree and branch name.
2841
2887
  - @return {void} No return value.
2842
2888
 
2843
- ### fn `function createPromptWorktree(` (L1152-1272)
2889
+ ### fn `function createPromptWorktree(` (L1306-1426)
2844
2890
  - @brief Creates and verifies the prompt-command worktree and branch.
2845
2891
  - @details Creates the sibling worktree, mirrors project config when present, runs the optional post-create test hook, verifies git worktree registration, verifies git branch listing, verifies filesystem paths before prompt dispatch, and appends selected debug entries for worktree creation. Failed verification triggers immediate rollback. Runtime is dominated by git subprocess execution and filesystem metadata checks. Side effects include worktree creation, branch creation, directory creation, file copying, optional debug-log writes, and rollback on failure.
2846
2892
  - @param[in] projectBase {string} Absolute original project base.
@@ -2852,7 +2898,7 @@ import {
2852
2898
  - @throws {ReqError} Throws when worktree creation, verification, or rollback finalization fails.
2853
2899
  - @satisfies REQ-206, REQ-219, REQ-220, REQ-245
2854
2900
 
2855
- ### fn `function deletePromptWorktree(` (L1285-1345)
2901
+ ### fn `export function deletePromptWorktree(` (L1439-1499)
2856
2902
  - @brief Deletes prompt-command worktree resources without invoking custom-tool executors.
2857
2903
  - @details Force-removes the sibling worktree and matching branch, verifies both are absent so prompt finalization remains independent from agent-tool implementations, and appends selected debug entries for worktree deletion. Runtime is dominated by git subprocess execution plus filesystem probes. Side effects include worktree deletion, branch deletion, and optional debug-log writes.
2858
2904
  - @param[in] projectBase {string} Absolute original project base.
@@ -2861,16 +2907,16 @@ import {
2861
2907
  - @param[in] debugOptions {PromptCommandDebugOptions | undefined} Optional prompt debug logging context.
2862
2908
  - @return {void} No return value.
2863
2909
  - @throws {ReqError} Throws when cleanup cannot remove the worktree and branch fully.
2864
- - @satisfies REQ-208, REQ-220, REQ-245
2910
+ - @satisfies REQ-208, REQ-220, REQ-245, REQ-309
2865
2911
 
2866
- ### fn `export function getPromptRequiredDocs(promptName: PromptCommandName): readonly PromptRequiredDocSpec[]` (L1354-1356)
2912
+ ### fn `export function getPromptRequiredDocs(promptName: PromptCommandName): readonly PromptRequiredDocSpec[]` (L1508-1510)
2867
2913
  - @brief Returns the canonical required-document probes for one prompt command.
2868
2914
  - @details Performs a constant-time lookup in the prompt-doc matrix used by command preflight validation. No filesystem access occurs.
2869
2915
  - @param[in] promptName {PromptCommandName} Bundled prompt identifier.
2870
2916
  - @return {readonly PromptRequiredDocSpec[]} Required-doc definitions in probe order.
2871
2917
  - @satisfies REQ-201, REQ-202
2872
2918
 
2873
- ### fn `export function validatePromptRequiredDocs(` (L1369-1420)
2919
+ ### fn `export function validatePromptRequiredDocs(` (L1523-1574)
2874
2920
  - @brief Runs prompt-specific required-document validation.
2875
2921
  - @details Resolves the configured docs root, verifies the prompt-mapped canonical docs exist as files, throws a deterministic remediation error for the first missing document, and appends selected debug entries for required-doc checks. Runtime is O(d) in required-doc count plus filesystem metadata cost. Side effects are limited to filesystem reads and optional debug-log writes.
2876
2922
  - @param[in] promptName {PromptCommandName} Bundled prompt identifier.
@@ -2881,7 +2927,7 @@ import {
2881
2927
  - @throws {ReqError} Throws when a required canonical doc is missing.
2882
2928
  - @satisfies REQ-201, REQ-202, REQ-203, REQ-245
2883
2929
 
2884
- ### fn `export function preparePromptCommandExecution(` (L1437-1513)
2930
+ ### fn `export function preparePromptCommandExecution(` (L1591-1667)
2885
2931
  - @brief Prepares prompt-command execution for one bundled prompt.
2886
2932
  - @details Runs slash-command-owned git validation, enforces the prompt-specific required-doc matrix, resolves persisted origin and execution session files, applies the effective worktree policy, generates and verifies a dedicated worktree when enabled, and returns the execution plan consumed by prompt rendering plus lifecycle hooks. Worktree-backed execution reuses the active session directory for the forked session file. Runtime is dominated by git subprocesses, worktree creation, and optional session-file cloning. Side effects include worktree creation, session-file creation, filesystem reads, and optional prompt debug-log writes.
2887
2933
  - @param[in] promptName {PromptCommandName} Bundled prompt identifier.
@@ -2896,7 +2942,7 @@ import {
2896
2942
  - @throws {ReqError} Throws when repository validation, required-doc validation, worktree creation, or session preparation fails.
2897
2943
  - @satisfies REQ-200, REQ-203, REQ-206, REQ-207, REQ-215, REQ-219, REQ-220, REQ-245, REQ-256, REQ-271
2898
2944
 
2899
- ### fn `export async function activatePromptCommandExecution(` (L1524-1557)
2945
+ ### fn `export async function activatePromptCommandExecution(` (L1678-1711)
2900
2946
  - @brief Activates the prepared prompt execution path before prompt dispatch or agent start.
2901
2947
  - @details Switches the active session to the execution-session file when worktree routing changed the cwd, re-aligns `process.cwd()` to the execution path, verifies active-session cwd plus cwd mirrors after the switch completes, and stores the verified command-capable replacement-session context for later closure handling. Runtime is dominated by the optional session switch and one optional cwd mutation. Side effects include active-session replacement, host-process cwd mutation, runtime-path state mutation, and process-scoped command-context persistence.
2902
2948
  - @param[in] plan {PromptCommandExecutionPlan} Prepared prompt execution plan.
@@ -2905,7 +2951,7 @@ import {
2905
2951
  - @throws {ReqError} Throws when the session switch or cwd verification fails.
2906
2952
  - @satisfies REQ-206, REQ-207, REQ-257, REQ-272, REQ-276
2907
2953
 
2908
- ### fn `export async function restorePromptCommandExecution(` (L1569-1633)
2954
+ ### fn `export async function restorePromptCommandExecution(` (L1723-1787)
2909
2955
  - @brief Restores the original project base path before merge or session-closure return.
2910
2956
  - @details Switches the active session back to the original session file when worktree routing changed the cwd, re-aligns `process.cwd()` to `base-path`, verifies the restored session target, reuses the persisted replacement-session context when lifecycle handlers receive non-command contexts, tolerates the documented stale-extension-context error when the old replacement-session closure becomes invalid immediately after a successful restore, emits optional workflow restoration debug entries, and clears active worktree path facts before session closure continues. Runtime is dominated by the optional session switch and one optional cwd mutation. Side effects include active-session replacement, host-process cwd mutation, runtime-path state mutation, and optional workflow-debug writes.
2911
2957
  - @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan whose original base should be restored.
@@ -2915,7 +2961,7 @@ import {
2915
2961
  - @throws {ReqError} Throws when the session switch or cwd verification fails.
2916
2962
  - @satisfies REQ-208, REQ-209, REQ-245, REQ-257, REQ-272, REQ-276
2917
2963
 
2918
- ### fn `export async function abortPromptCommandExecution(` (L1644-1690)
2964
+ ### fn `export async function abortPromptCommandExecution(` (L1798-1844)
2919
2965
  - @brief Aborts one prepared prompt-command execution before pi CLI takes ownership.
2920
2966
  - @details Restores the original session-backed cwd and deletes any created worktree plus branch when command-side preflight, prompt rendering, or prompt handoff fails before agent completion. Restoration failures are returned as structured cleanup errors so the original preflight failure is not masked. Runtime is dominated by the optional session switch plus git subprocess execution. Side effects include active-session replacement, optional worktree deletion, and optional debug-log writes.
2921
2967
  - @param[in] plan {PromptCommandExecutionPlan} Prepared prompt execution plan.
@@ -2924,16 +2970,16 @@ import {
2924
2970
  - @return {Promise<{ cleanupSucceeded: boolean; errorMessage?: string; activeContext?: PromptCommandSessionContext }>} Abort-cleanup facts plus the last valid active prompt-command context.
2925
2971
  - @satisfies REQ-226, REQ-220, REQ-245
2926
2972
 
2927
- ### fn `export async function finalizePromptCommandExecution(` (L1701-1804)
2973
+ ### fn `export async function finalizePromptCommandExecution(` (L1855-1943)
2928
2974
  - @brief Finalizes one matched successful worktree-backed prompt execution.
2929
- - @details Re-verifies persisted execution-session metadata plus worktree artifacts, copies any execution-session transcript records missing from the original session file, restores the original session-backed `base-path`, fast-forward merges the successful worktree branch from `base-path`, deletes the worktree after merge success, and preserves the restored base session across closure failures. Closure intentionally treats `base-path` restoration as authoritative even when pi CLI has already started end-of-session session replacement or other housekeeping that moved the live runtime away from `worktree-path`. Runtime is dominated by session switching plus git subprocess execution. Side effects include session-file appends, active-session replacement, branch merges, worktree deletion, and optional debug-log writes.
2975
+ - @details Re-verifies persisted execution-session metadata plus worktree artifacts, copies any execution-session transcript records missing from the original session file, restores the original session-backed `base-path`, executes the stash-assisted fast-forward merge sequence from `base-path`, deletes the worktree after merge success, and preserves the restored base session across closure failures. Closure intentionally treats `base-path` restoration as authoritative even when pi CLI has already started end-of-session session replacement or other housekeeping that moved the live runtime away from `worktree-path`. Runtime is dominated by session switching plus git subprocess execution. Side effects include session-file appends, active-session replacement, branch merges, stash-stack mutation, worktree deletion, and optional debug-log writes.
2930
2976
  - @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan.
2931
2977
  - @param[in] ctx {PromptCommandSessionContext | undefined} Optional prompt-command context.
2932
2978
  - @param[in] debugOptions {PromptCommandDebugOptions | undefined} Optional prompt debug logging context.
2933
- - @return {Promise<{ mergeAttempted: boolean; mergeSucceeded: boolean; cleanupSucceeded: boolean; errorMessage?: string; activeContext?: PromptCommandSessionContext }>} Finalization facts plus the last valid active prompt-command context.
2934
- - @satisfies REQ-208, REQ-209, REQ-220, REQ-245, REQ-282
2979
+ - @return {Promise<{ mergeAttempted: boolean; mergeSucceeded: boolean; cleanupSucceeded: boolean; errorMessage?: string; warningMessage?: string; activeContext?: PromptCommandSessionContext }>} Finalization facts plus the last valid active prompt-command context.
2980
+ - @satisfies REQ-208, REQ-209, REQ-220, REQ-245, REQ-282, REQ-291, REQ-292
2935
2981
 
2936
- ### fn `export function classifyPromptCommandOutcome(` (L1812-1816)
2982
+ ### fn `export function classifyPromptCommandOutcome(` (L1951-1955)
2937
2983
  - @brief Maps one `agent_end` payload into the canonical prompt-worktree finalization outcome.
2938
2984
  - @details Delegates to the shared notification outcome classifier so worktree merge and fork-session retention decisions stay aligned with prompt-end notification routing. Runtime is O(m) in assistant message count. No external state is mutated.
2939
2985
  - @param[in] event {Pick<import("@mariozechner/pi-coding-agent").AgentEndEvent, "messages">} Agent-end payload subset.
@@ -2942,60 +2988,62 @@ import {
2942
2988
  ## Symbol Index
2943
2989
  |Symbol|Kind|Vis|Lines|Sig|
2944
2990
  |---|---|---|---|---|
2945
- |`PromptRequiredDocSpec`|iface||45-48|export interface PromptRequiredDocSpec|
2946
- |`PromptCommandExecutionPlan`|iface||54-68|export interface PromptCommandExecutionPlan|
2947
- |`PromptCommandPostCreateHookContext`|iface||74-79|interface PromptCommandPostCreateHookContext|
2948
- |`PromptCommandPostCreateHook`|type||85||
2949
- |`PromptCommandDebugOptions`|iface||91-94|interface PromptCommandDebugOptions|
2950
- |`PromptCommandSessionMessageOptions`|iface||100-102|interface PromptCommandSessionMessageOptions|
2951
- |`PromptCommandSessionSwitchOptions`|iface||108-110|interface PromptCommandSessionSwitchOptions|
2952
- |`PromptCommandActiveContext`|iface||116-121|interface PromptCommandActiveContext extends PromptComman...|
2953
- |`PromptCommandSessionEntry`|iface||127-133|interface PromptCommandSessionEntry|
2954
- |`PromptCommandSessionContext`|iface||139-151|interface PromptCommandSessionContext|
2955
- |`PromptCommandContextError`|iface||157-159|interface PromptCommandContextError extends Error|
2956
- |`isUsablePromptSessionFile`|fn||174-192|function isUsablePromptSessionFile(|
2957
- |`resolvePromptSessionFile`|fn||202-212|function resolvePromptSessionFile(sessionFile: string | u...|
2958
- |`writePromptExecutionSessionSnapshot`|fn||226-252|function writePromptExecutionSessionSnapshot(|
2959
- |`createPromptExecutionSessionFile`|fn||265-288|function createPromptExecutionSessionFile(|
2960
- |`getPromptSessionCwd`|fn||296-304|function getPromptSessionCwd(ctx?: PromptCommandSessionCo...|
2961
- |`getPromptSessionFile`|fn||312-320|function getPromptSessionFile(ctx?: PromptCommandSessionC...|
2962
- |`getPromptContextCwd`|fn||328-334|function getPromptContextCwd(ctx?: PromptCommandSessionCo...|
2963
- |`resolvePromptCommandSwitchContext`|fn||344-359|function resolvePromptCommandSwitchContext(|
2964
- |`syncPromptCommandProcessCwd`|fn||370-390|function syncPromptCommandProcessCwd(expectedPath: string...|
2965
- |`readPromptSessionFileCwd`|fn||398-422|function readPromptSessionFileCwd(sessionFile: string): s...|
2966
- |`readPromptSessionJsonLines`|fn||431-478|function readPromptSessionJsonLines(|
2967
- |`preservePromptCommandExecutionTranscript`|fn||488-585|function preservePromptCommandExecutionTranscript(plan: P...|
2968
- |`verifyPromptCommandSessionTarget`|fn||598-642|function verifyPromptCommandSessionTarget(|
2969
- |`verifyPromptCommandClosureArtifacts`|fn||652-687|function verifyPromptCommandClosureArtifacts(|
2970
- |`switchPromptCommandSession`|fn||698-727|async function switchPromptCommandSession(|
2971
- |`isPromptCommandStaleContextError`|fn||736-739|function isPromptCommandStaleContextError(error: unknown)...|
2972
- |`attachPromptCommandErrorContext`|fn||748-756|function attachPromptCommandErrorContext(|
2973
- |`getPromptCommandErrorContext`|fn||764-770|export function getPromptCommandErrorContext(|
2974
- |`runCapture`|fn||851-856|function runCapture(command: string[], cwd: string): Retu...|
2975
- |`setPromptCommandPostCreateHookForTests`|fn||864-868|export function setPromptCommandPostCreateHookForTests(|
2976
- |`resolvePromptDocsRoot`|fn||877-880|function resolvePromptDocsRoot(projectBase: string, confi...|
2977
- |`resolveWorktreePaths`|fn||890-917|function resolveWorktreePaths(|
2978
- |`sanitizePromptWorktreeBranchName`|fn||925-927|function sanitizePromptWorktreeBranchName(branch: string)...|
2979
- |`validatePromptWorktreeName`|fn||935-940|function validatePromptWorktreeName(wtName: string): boolean|
2980
- |`throwPromptGitStatusError`|fn||948-950|function throwPromptGitStatusError(): never|
2981
- |`validatePromptGitState`|fn||961-1005|function validatePromptGitState(projectBase: string, conf...|
2982
- |`resolveCurrentPromptBranchName`|fn||1013-1018|function resolveCurrentPromptBranchName(gitRoot: string):...|
2983
- |`formatPromptWorktreeExecutionId`|fn||1032-1034|function formatPromptWorktreeExecutionId(timestamp: Date)...|
2984
- |`getNextPromptWorktreeExecutionId`|fn||1041-1054|function getNextPromptWorktreeExecutionId(): string|
2985
- |`buildPromptWorktreeName`|fn||1065-1076|function buildPromptWorktreeName(gitRoot: string, config:...|
2986
- |`promptWorktreeBranchExists`|fn||1085-1094|function promptWorktreeBranchExists(gitRoot: string, bran...|
2987
- |`promptWorktreeRegistered`|fn||1103-1114|function promptWorktreeRegistered(gitRoot: string, worktr...|
2988
- |`cleanupPromptWorktreeCreation`|fn||1124-1138|function cleanupPromptWorktreeCreation(|
2989
- |`createPromptWorktree`|fn||1152-1272|function createPromptWorktree(|
2990
- |`deletePromptWorktree`|fn||1285-1345|function deletePromptWorktree(|
2991
- |`getPromptRequiredDocs`|fn||1354-1356|export function getPromptRequiredDocs(promptName: PromptC...|
2992
- |`validatePromptRequiredDocs`|fn||1369-1420|export function validatePromptRequiredDocs(|
2993
- |`preparePromptCommandExecution`|fn||1437-1513|export function preparePromptCommandExecution(|
2994
- |`activatePromptCommandExecution`|fn||1524-1557|export async function activatePromptCommandExecution(|
2995
- |`restorePromptCommandExecution`|fn||1569-1633|export async function restorePromptCommandExecution(|
2996
- |`abortPromptCommandExecution`|fn||1644-1690|export async function abortPromptCommandExecution(|
2997
- |`finalizePromptCommandExecution`|fn||1701-1804|export async function finalizePromptCommandExecution(|
2998
- |`classifyPromptCommandOutcome`|fn||1812-1816|export function classifyPromptCommandOutcome(|
2991
+ |`PromptRequiredDocSpec`|iface||42-45|export interface PromptRequiredDocSpec|
2992
+ |`PromptCommandExecutionPlan`|iface||51-65|export interface PromptCommandExecutionPlan|
2993
+ |`PromptCommandPostCreateHookContext`|iface||71-76|interface PromptCommandPostCreateHookContext|
2994
+ |`PromptCommandPostCreateHook`|type||82||
2995
+ |`PromptCommandDebugOptions`|iface||88-91|interface PromptCommandDebugOptions|
2996
+ |`PromptCommandSessionMessageOptions`|iface||97-99|interface PromptCommandSessionMessageOptions|
2997
+ |`PromptCommandSessionSwitchOptions`|iface||105-107|interface PromptCommandSessionSwitchOptions|
2998
+ |`PromptCommandActiveContext`|iface||113-118|interface PromptCommandActiveContext extends PromptComman...|
2999
+ |`PromptCommandSessionEntry`|iface||124-130|interface PromptCommandSessionEntry|
3000
+ |`PromptCommandSessionContext`|iface||136-148|interface PromptCommandSessionContext|
3001
+ |`PromptCommandContextError`|iface||154-156|interface PromptCommandContextError extends Error|
3002
+ |`isUsablePromptSessionFile`|fn||171-189|function isUsablePromptSessionFile(|
3003
+ |`resolvePromptSessionFile`|fn||199-209|function resolvePromptSessionFile(sessionFile: string | u...|
3004
+ |`writePromptExecutionSessionSnapshot`|fn||223-249|function writePromptExecutionSessionSnapshot(|
3005
+ |`createPromptExecutionSessionFile`|fn||262-285|function createPromptExecutionSessionFile(|
3006
+ |`getPromptSessionCwd`|fn||293-301|function getPromptSessionCwd(ctx?: PromptCommandSessionCo...|
3007
+ |`getPromptSessionFile`|fn||309-317|function getPromptSessionFile(ctx?: PromptCommandSessionC...|
3008
+ |`getPromptContextCwd`|fn||325-331|function getPromptContextCwd(ctx?: PromptCommandSessionCo...|
3009
+ |`resolvePromptCommandSwitchContext`|fn||341-356|function resolvePromptCommandSwitchContext(|
3010
+ |`syncPromptCommandProcessCwd`|fn||367-387|function syncPromptCommandProcessCwd(expectedPath: string...|
3011
+ |`readPromptSessionFileCwd`|fn||395-419|function readPromptSessionFileCwd(sessionFile: string): s...|
3012
+ |`readPromptSessionJsonLines`|fn||428-475|function readPromptSessionJsonLines(|
3013
+ |`preservePromptCommandExecutionTranscript`|fn||485-582|export function preservePromptCommandExecutionTranscript(...|
3014
+ |`verifyPromptCommandSessionTarget`|fn||595-639|function verifyPromptCommandSessionTarget(|
3015
+ |`verifyPromptCommandClosureArtifacts`|fn||649-684|function verifyPromptCommandClosureArtifacts(|
3016
+ |`switchPromptCommandSession`|fn||695-724|async function switchPromptCommandSession(|
3017
+ |`isPromptCommandStaleContextError`|fn||733-736|function isPromptCommandStaleContextError(error: unknown)...|
3018
+ |`attachPromptCommandErrorContext`|fn||745-753|function attachPromptCommandErrorContext(|
3019
+ |`getPromptCommandErrorContext`|fn||761-767|export function getPromptCommandErrorContext(|
3020
+ |`runCapture`|fn||845-850|function runCapture(command: string[], cwd: string): Retu...|
3021
+ |`listPromptTrackedBasePathChanges`|fn||860-878|function listPromptTrackedBasePathChanges(basePath: strin...|
3022
+ |`finalizePromptCommandMerge`|fn||888-1010|function finalizePromptCommandMerge(|
3023
+ |`setPromptCommandPostCreateHookForTests`|fn||1018-1022|export function setPromptCommandPostCreateHookForTests(|
3024
+ |`resolvePromptDocsRoot`|fn||1031-1034|function resolvePromptDocsRoot(projectBase: string, confi...|
3025
+ |`resolveWorktreePaths`|fn||1044-1071|function resolveWorktreePaths(|
3026
+ |`sanitizePromptWorktreeBranchName`|fn||1079-1081|function sanitizePromptWorktreeBranchName(branch: string)...|
3027
+ |`validatePromptWorktreeName`|fn||1089-1094|function validatePromptWorktreeName(wtName: string): boolean|
3028
+ |`throwPromptGitStatusError`|fn||1102-1104|function throwPromptGitStatusError(): never|
3029
+ |`validatePromptGitState`|fn||1115-1159|export function validatePromptGitState(projectBase: strin...|
3030
+ |`resolveCurrentPromptBranchName`|fn||1167-1172|function resolveCurrentPromptBranchName(gitRoot: string):...|
3031
+ |`formatPromptWorktreeExecutionId`|fn||1186-1188|function formatPromptWorktreeExecutionId(timestamp: Date)...|
3032
+ |`getNextPromptWorktreeExecutionId`|fn||1195-1208|function getNextPromptWorktreeExecutionId(): string|
3033
+ |`buildPromptWorktreeName`|fn||1219-1230|function buildPromptWorktreeName(gitRoot: string, config:...|
3034
+ |`promptWorktreeBranchExists`|fn||1239-1248|function promptWorktreeBranchExists(gitRoot: string, bran...|
3035
+ |`promptWorktreeRegistered`|fn||1257-1268|function promptWorktreeRegistered(gitRoot: string, worktr...|
3036
+ |`cleanupPromptWorktreeCreation`|fn||1278-1292|function cleanupPromptWorktreeCreation(|
3037
+ |`createPromptWorktree`|fn||1306-1426|function createPromptWorktree(|
3038
+ |`deletePromptWorktree`|fn||1439-1499|export function deletePromptWorktree(|
3039
+ |`getPromptRequiredDocs`|fn||1508-1510|export function getPromptRequiredDocs(promptName: PromptC...|
3040
+ |`validatePromptRequiredDocs`|fn||1523-1574|export function validatePromptRequiredDocs(|
3041
+ |`preparePromptCommandExecution`|fn||1591-1667|export function preparePromptCommandExecution(|
3042
+ |`activatePromptCommandExecution`|fn||1678-1711|export async function activatePromptCommandExecution(|
3043
+ |`restorePromptCommandExecution`|fn||1723-1787|export async function restorePromptCommandExecution(|
3044
+ |`abortPromptCommandExecution`|fn||1798-1844|export async function abortPromptCommandExecution(|
3045
+ |`finalizePromptCommandExecution`|fn||1855-1943|export async function finalizePromptCommandExecution(|
3046
+ |`classifyPromptCommandOutcome`|fn||1951-1955|export function classifyPromptCommandOutcome(|
2999
3047
 
3000
3048
 
3001
3049
  ---
@@ -3093,7 +3141,7 @@ import type { PromptCommandExecutionPlan } from "./prompt-command-runtime.js";
3093
3141
 
3094
3142
  ---
3095
3143
 
3096
- # prompts.ts | TypeScript | 316L | 9 symbols | 7 imports | 17 comments
3144
+ # prompts.ts | TypeScript | 314L | 9 symbols | 7 imports | 17 comments
3097
3145
  > Path: `src/core/prompts.ts`
3098
3146
  - @brief Renders bundled pi-usereq prompts for the current project context.
3099
3147
  - @details Applies placeholder substitution, legacy tool-name rewrites, and conditional pi.dev governance guidance before prompt text is sent to the agent. Runtime is linear in prompt size plus replacement count. Side effects are limited to filesystem reads used for manifest checks and bundled prompt loading.
@@ -3111,7 +3159,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3111
3159
 
3112
3160
  ## Definitions
3113
3161
 
3114
- ### fn `function buildPiDevConformanceBlock(promptName: string, projectBase: string): string` (L111-120)
3162
+ ### fn `function buildPiDevConformanceBlock(promptName: string, projectBase: string): string` (L109-118)
3115
3163
  - @brief Builds the conditional pi.dev governance block for one rendered prompt.
3116
3164
  - @details Emits the manifest-driven governance rules only when the selected bundled prompt can analyze or mutate source code and the project root contains the pi.dev manifest. Time complexity O(1). No filesystem writes.
3117
3165
  - @param[in] promptName {string} Bundled prompt identifier.
@@ -3119,7 +3167,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3119
3167
  - @return {string} Markdown bullet block or the empty string when injection is not applicable.
3120
3168
  - @satisfies REQ-032, REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275
3121
3169
 
3122
- ### fn `function injectPiDevConformanceBlock(text: string, promptName: string, projectBase: string): string` (L131-138)
3170
+ ### fn `function injectPiDevConformanceBlock(text: string, promptName: string, projectBase: string): string` (L129-136)
3123
3171
  - @brief Injects the pi.dev governance block into the prompt behavior section.
3124
3172
  - @details Inserts the block immediately after the `## Behavior` heading so downstream agents evaluate the rule before workflow steps. Leaves prompts unchanged when no behavior section exists or the block is already present. Time complexity O(n).
3125
3173
  - @param[in] text {string} Prompt markdown after placeholder replacement.
@@ -3128,14 +3176,14 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3128
3176
  - @return {string} Prompt markdown with zero or one injected conformance block.
3129
3177
  - @satisfies REQ-032, REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275
3130
3178
 
3131
- ### fn `export function adaptPromptForInternalTools(text: string): string` (L147-153)
3179
+ ### fn `export function adaptPromptForInternalTools(text: string): string` (L145-151)
3132
3180
  - @brief Rewrites bundled prompt tool references from legacy `req --...` syntax to internal tool names.
3133
3181
  - @details Applies deterministic global regex replacements so prompt text matches the extension-registered tool surface instead of the standalone CLI spelling. Time complexity O(p*r) where p is pattern count and r is prompt length.
3134
3182
  - @param[in] text {string} Prompt markdown before tool-reference normalization.
3135
3183
  - @return {string} Prompt markdown with internal tool names.
3136
3184
  - @satisfies REQ-003
3137
3185
 
3138
- ### fn `export function applyReplacements(text: string, replacements: Record<string, string>): string` (L163-169)
3186
+ ### fn `export function applyReplacements(text: string, replacements: Record<string, string>): string` (L161-167)
3139
3187
  - @brief Applies literal placeholder replacements to bundled prompt markdown.
3140
3188
  - @details Replaces every placeholder token using split/join semantics so all occurrences are updated without regex escaping. Time complexity O(t*n) where t is replacement count and n is prompt length.
3141
3189
  - @param[in] text {string} Prompt markdown containing placeholder tokens.
@@ -3143,7 +3191,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3143
3191
  - @return {string} Prompt markdown with all placeholder tokens expanded.
3144
3192
  - @satisfies REQ-002
3145
3193
 
3146
- ### fn `function buildPromptExecutionBlock(` (L179-201)
3194
+ ### fn `function buildPromptExecutionBlock(` (L177-199)
3147
3195
  - @brief Builds the prompt-command execution block injected at prompt start.
3148
3196
  - @details Serializes the already-completed repository validation, prompt-specific required-doc validation, worktree routing decision, and extension-owned lifecycle responsibilities so downstream agents do not repeat command-side orchestration. Time complexity is O(d) in required-doc count. No external state is mutated.
3149
3197
  - @param[in] promptName {PromptCommandName} Bundled prompt identifier.
@@ -3151,7 +3199,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3151
3199
  - @return {string} Markdown block or the empty string when runtime execution metadata is unavailable.
3152
3200
  - @satisfies REQ-200, REQ-201, REQ-202, REQ-206, REQ-207, REQ-208, REQ-209
3153
3201
 
3154
- ### fn `function injectPromptExecutionBlock(` (L211-222)
3202
+ ### fn `function injectPromptExecutionBlock(` (L209-220)
3155
3203
  - @brief Injects the prompt-command execution block near the start of the rendered prompt.
3156
3204
  - @details Inserts the execution block immediately after the first level-1 heading so downstream agents evaluate extension-owned orchestration before workflow steps. Leaves prompts unchanged when no execution block is provided or when the block is already present. Time complexity O(n).
3157
3205
  - @param[in] text {string} Prompt markdown after placeholder replacement.
@@ -3159,7 +3207,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3159
3207
  - @param[in] executionPlan {PromptCommandExecutionPlan | undefined} Prepared execution plan.
3160
3208
  - @return {string} Prompt markdown with zero or one injected execution block.
3161
3209
 
3162
- ### fn `function buildPromptReplacements(` (L234-246)
3210
+ ### fn `function buildPromptReplacements(` (L232-244)
3163
3211
  - @brief Builds prompt-specific runtime placeholder replacements.
3164
3212
  - @details Merges shared path substitutions with prompt-scoped runtime values for `%%ARGS%%` and `%%PROMPT%%`. Time complexity is O(g log g + s) due to delegated path replacement building, where g is guideline count and s is source-directory count. Side effects are limited to filesystem reads delegated to shared path-context helpers.
3165
3213
  - @param[in] promptName {string} Bundled prompt identifier without the `req-` prefix.
@@ -3169,7 +3217,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3169
3217
  - @return {Record<string, string>} Prompt-specific placeholder-to-value map.
3170
3218
  - @satisfies REQ-002, REQ-211
3171
3219
 
3172
- ### fn `function renderBundledCommitInstruction(` (L258-272)
3220
+ ### fn `function renderBundledCommitInstruction(` (L256-270)
3173
3221
  - @brief Renders the bundled git instruction injected through `%%COMMIT%%`.
3174
3222
  - @details Selects `resources/instructions/git_commit.md` when automatic git commit is enabled and `resources/instructions/git_read-only.md` otherwise, then applies the same runtime placeholder substitutions used by bundled prompts before returning the rendered markdown. Time complexity is O(n + g log g + s) where n is instruction size, g is guideline count, and s is source-directory count. Side effects are limited to filesystem reads.
3175
3223
  - @param[in] promptName {string} Bundled prompt identifier without the `req-` prefix.
@@ -3179,7 +3227,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3179
3227
  - @return {string} Rendered bundled git instruction selected for the current automatic-commit mode.
3180
3228
  - @satisfies REQ-211, REQ-213, REQ-214
3181
3229
 
3182
- ### fn `export function renderPrompt(` (L285-316)
3230
+ ### fn `export function renderPrompt(` (L283-314)
3183
3231
  - @brief Renders a bundled prompt for the current project context.
3184
3232
  - @details Loads the bundled markdown template, expands configuration-derived placeholders, injects extension-owned execution guidance plus conditional pi.dev governance guidance, expands the optional bundled commit instruction, and rewrites legacy tool references to internal names. Time complexity O(n) relative to prompt size plus delegated commit-instruction rendering. No tracked files are modified.
3185
3233
  - @param[in] promptName {string} Bundled prompt identifier.
@@ -3193,211 +3241,223 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3193
3241
  ## Symbol Index
3194
3242
  |Symbol|Kind|Vis|Lines|Sig|
3195
3243
  |---|---|---|---|---|
3196
- |`buildPiDevConformanceBlock`|fn||111-120|function buildPiDevConformanceBlock(promptName: string, p...|
3197
- |`injectPiDevConformanceBlock`|fn||131-138|function injectPiDevConformanceBlock(text: string, prompt...|
3198
- |`adaptPromptForInternalTools`|fn||147-153|export function adaptPromptForInternalTools(text: string)...|
3199
- |`applyReplacements`|fn||163-169|export function applyReplacements(text: string, replaceme...|
3200
- |`buildPromptExecutionBlock`|fn||179-201|function buildPromptExecutionBlock(|
3201
- |`injectPromptExecutionBlock`|fn||211-222|function injectPromptExecutionBlock(|
3202
- |`buildPromptReplacements`|fn||234-246|function buildPromptReplacements(|
3203
- |`renderBundledCommitInstruction`|fn||258-272|function renderBundledCommitInstruction(|
3204
- |`renderPrompt`|fn||285-316|export function renderPrompt(|
3244
+ |`buildPiDevConformanceBlock`|fn||109-118|function buildPiDevConformanceBlock(promptName: string, p...|
3245
+ |`injectPiDevConformanceBlock`|fn||129-136|function injectPiDevConformanceBlock(text: string, prompt...|
3246
+ |`adaptPromptForInternalTools`|fn||145-151|export function adaptPromptForInternalTools(text: string)...|
3247
+ |`applyReplacements`|fn||161-167|export function applyReplacements(text: string, replaceme...|
3248
+ |`buildPromptExecutionBlock`|fn||177-199|function buildPromptExecutionBlock(|
3249
+ |`injectPromptExecutionBlock`|fn||209-220|function injectPromptExecutionBlock(|
3250
+ |`buildPromptReplacements`|fn||232-244|function buildPromptReplacements(|
3251
+ |`renderBundledCommitInstruction`|fn||256-270|function renderBundledCommitInstruction(|
3252
+ |`renderPrompt`|fn||283-314|export function renderPrompt(|
3205
3253
 
3206
3254
 
3207
3255
  ---
3208
3256
 
3209
- # reference-payload.ts | TypeScript | 752L | 28 symbols | 5 imports | 27 comments
3210
- > Path: `src/core/reference-payload.ts`
3211
- - @brief Builds agent-oriented JSON payloads for `files-references` and `references`.
3212
- - @details Converts analyzed source files into deterministic JSON sections ordered for LLM traversal, including repository structure, per-file metrics, imports, symbols, structured Doxygen fields, and structured comment evidence. Runtime is O(F log F + S) where F is file count and S is total source size. Side effects are limited to filesystem reads and optional stderr logging.
3257
+ # req-references-command.ts | TypeScript | 175L | 7 symbols | 6 imports | 10 comments
3258
+ > Path: `src/core/req-references-command.ts`
3259
+ - @brief Implements the specialized `req-references` slash-command workflow.
3260
+ - @details Performs slash-command-owned git validation reuse, reference-file generation, targeted staging, fixed-message commit creation, and post-commit cleanliness verification without creating a worktree or starting an LLM session. Runtime is dominated by git subprocess execution plus source-summary generation and one documentation write. Side effects include filesystem writes and git index/history mutation.
3213
3261
 
3214
3262
  ## Imports
3215
3263
  ```
3216
- import fs from "node:fs";
3264
+ import { spawnSync } from "node:child_process";
3217
3265
  import path from "node:path";
3218
- import {
3219
- import { detectLanguage } from "./compress.js";
3220
- import {
3266
+ import type { UseReqConfig } from "./config.js";
3267
+ import { ReqError } from "./errors.js";
3268
+ import { validatePromptGitState } from "./prompt-command-runtime.js";
3269
+ import { runReferences } from "./tool-runner.js";
3221
3270
  ```
3222
3271
 
3223
3272
  ## Definitions
3224
3273
 
3225
- - type `export type ReferenceToolScope = "explicit-files" | "configured-source-directories";` (L27)
3226
- - @brief Enumerates supported references-payload scopes.
3227
- - @details Distinguishes explicit-file requests from configured project scans while preserving one stable JSON contract. The alias is compile-time only and introduces no runtime cost.
3228
- - type `export type ReferenceFileStatus = "analyzed" | "error" | "skipped";` (L33)
3229
- - @brief Enumerates supported per-file references entry statuses.
3230
- - @details Separates analyzed files, analysis failures, and skipped inputs so downstream agents can branch without reparsing stderr text. The alias is compile-time only and introduces no runtime cost.
3231
- ### iface `export interface ReferenceLineRange` (L39-43)
3232
- - @brief Describes one numeric source line range.
3233
- - @details Exposes start and end line numbers plus the same inclusive range as a numeric tuple for direct agent access. The interface is compile-time only and introduces no runtime cost.
3234
-
3235
- ### iface `export interface ReferenceImportEntry extends ReferenceLineRange` : ReferenceLineRange (L49-52)
3236
- - @brief Describes one structured import record.
3237
- - @details Stores the normalized import identity, raw import statement, and declaration line range without requiring agents to parse markdown blocks. The interface is compile-time only and introduces no runtime cost.
3274
+ ### iface `export interface ReqReferencesCommandPlan` (L30-35)
3275
+ - @brief Describes the prepared execution facts for one `req-references` run.
3276
+ - @details Stores the validated project base, resolved git root, target references path, and fixed commit message needed by the specialized direct-write workflow. The interface is compile-time only and introduces no runtime cost.
3238
3277
 
3239
- ### iface `export interface ReferenceCommentEntry extends ReferenceLineRange` : ReferenceLineRange (L58-61)
3240
- - @brief Describes one structured standalone or attached comment record.
3241
- - @details Preserves normalized comment text plus per-line comment fragments so agents can consume comment evidence without reparsing source delimiters. The interface is compile-time only and introduces no runtime cost.
3242
-
3243
- ### iface `export interface ReferenceExitPointEntry` (L67-70)
3244
- - @brief Describes one structured exit-point annotation.
3245
- - @details Preserves the normalized exit expression text together with its source line number for downstream reasoning about control flow hints. The interface is compile-time only and introduces no runtime cost.
3246
-
3247
- ### iface `export interface ReferenceSymbolEntry extends ReferenceLineRange` : ReferenceLineRange (L76-96)
3248
- - @brief Describes one structured symbol record.
3249
- - @details Orders direct-access identity fields before hierarchy, locations, Doxygen metadata, and comment evidence so agents can branch without reparsing monolithic summaries. The interface is compile-time only and introduces no runtime cost.
3250
-
3251
- ### iface `export interface ReferenceToolFileEntry extends ReferenceLineRange` : ReferenceLineRange (L102-115)
3252
- - @brief Describes one per-file references payload entry.
3253
- - @details Stores canonical identity, line metrics, structured imports, structured symbols, structured comment evidence, and optional file-level Doxygen metadata. Derivable identity and filesystem-probe fields are intentionally omitted to reduce token cost. The interface is compile-time only and introduces no runtime cost.
3254
-
3255
- ### iface `export interface ReferenceToolRequestSection` (L121-130)
3256
- - @brief Describes the request section of the references payload.
3257
- - @details Captures tool identity, scope, base directory, requested path inventory, and configured source-directory scope so agents can reason about how the file set was selected. The interface is compile-time only and introduces no runtime cost.
3258
-
3259
- ### iface `export interface ReferenceToolSummarySection` (L136-147)
3260
- - @brief Describes the summary section of the references payload.
3261
- - @details Exposes aggregate file, symbol, import, comment, and Doxygen counts as numeric fields plus deterministic symbol-kind totals. The interface is compile-time only and introduces no runtime cost.
3262
-
3263
- ### iface `export interface ReferenceRepositoryTreeNode` (L153-159)
3264
- - @brief Describes one repository tree node in the references payload.
3265
- - @details Encodes directory and file hierarchy without ASCII-art decoration so agents can traverse repository structure as structured JSON. The interface is compile-time only and introduces no runtime cost.
3278
+ ### fn `function runCapture(command: string[], cwd: string): ReturnType<typeof spawnSync>` (L44-49)
3279
+ - @brief Executes one synchronous subprocess and captures UTF-8 output.
3280
+ - @details Delegates to `spawnSync(...)`, preserves the supplied working directory, and returns the raw result so callers can interpret git exit status plus diagnostics deterministically. Runtime is dominated by external process execution. Side effects include subprocess creation.
3281
+ - @param[in] command {string[]} Executable plus argument vector.
3282
+ - @param[in] cwd {string} Working directory for the subprocess.
3283
+ - @return {ReturnType<typeof spawnSync>} Captured subprocess result.
3266
3284
 
3267
- ### iface `export interface ReferenceToolRepositorySection` (L165-169)
3268
- - @brief Describes the repository section of the references payload.
3269
- - @details Stores configured source-directory scope, the canonical analyzed file list, and the structured directory tree used during analysis. Static root-path echoes are intentionally omitted to reduce token cost. The interface is compile-time only and introduces no runtime cost.
3285
+ ### fn `function buildIgnoredGitStatusPaths(` (L59-73)
3286
+ - @brief Builds the set of git-status paths ignored for cleanliness checks.
3287
+ - @details Reuses the configured debug-log path exception already honored by prompt-command git validation so extension-owned debug artifacts do not block `req-references` execution or post-commit cleanliness verification. Runtime is O(p) in path length. No external state is mutated.
3288
+ - @param[in] projectBase {string} Absolute project base path.
3289
+ - @param[in] gitRoot {string} Absolute git root path.
3290
+ - @param[in] config {UseReqConfig} Effective project configuration.
3291
+ - @return {Set<string>} Slash-normalized relative paths ignored during git-status evaluation.
3270
3292
 
3271
- ### iface `export interface ReferenceToolPayload` (L175-179)
3272
- - @brief Describes the full agent-oriented references payload.
3273
- - @details Exposes only aggregate analysis totals, repository structure, and per-file reference records, omitting request echoes that are already known to the caller or encoded in the tool registration. The interface is compile-time only and introduces no runtime cost.
3293
+ ### fn `function listResidualGitStatusLines(` (L84-102)
3294
+ - @brief Lists residual git-status rows after ignored extension-owned paths are filtered out.
3295
+ - @details Executes `git status --porcelain`, drops the configured debug-log path when present inside the active repository, and returns all remaining staged or unstaged rows used for post-commit cleanliness verification. Runtime is dominated by one git subprocess plus O(n) parsing in status-line count. Side effects include subprocess creation.
3296
+ - @param[in] projectBase {string} Absolute project base path.
3297
+ - @param[in] gitRoot {string} Absolute git root path.
3298
+ - @param[in] config {UseReqConfig} Effective project configuration.
3299
+ - @return {string[]} Residual status rows after ignored paths are removed.
3300
+ - @throws {ReqError} Throws when git status cannot be inspected.
3301
+
3302
+ ### fn `function getGitAddTargetPath(gitRoot: string, absolutePath: string): string` (L111-117)
3303
+ - @brief Converts one absolute repository path into the preferred git-add target syntax.
3304
+ - @details Emits a slash-normalized relative path when the target is inside the git root and falls back to the absolute path otherwise, preserving deterministic add semantics across nested project-base layouts. Runtime is O(p) in path length. No external state is mutated.
3305
+ - @param[in] gitRoot {string} Absolute git root path.
3306
+ - @param[in] absolutePath {string} Absolute path to stage.
3307
+ - @return {string} Relative or absolute git-add target path.
3308
+
3309
+ ### fn `export function prepareReqReferencesCommandExecution(` (L128-141)
3310
+ - @brief Prepares the specialized `req-references` execution plan.
3311
+ - @details Reuses slash-command-owned git validation, resolves the configured references document path, and returns the fixed commit metadata consumed by the direct-write workflow. Runtime is dominated by git validation subprocesses. Side effects include subprocess creation delegated through `validatePromptGitState(...)`.
3312
+ - @param[in] projectBase {string} Absolute project base path.
3313
+ - @param[in] config {UseReqConfig} Effective project configuration.
3314
+ - @return {ReqReferencesCommandPlan} Prepared execution plan for direct references regeneration.
3315
+ - @throws {ReqError} Throws when git validation fails.
3316
+ - @satisfies REQ-200, REQ-299
3317
+
3318
+ ### fn `export function executeReqReferencesCommandExecution(` (L152-175)
3319
+ - @brief Executes the specialized `req-references` direct-write workflow.
3320
+ - @details Regenerates `REFERENCES.md` through the same source-summary path used by the `references` tool, stages only the target file, creates the fixed-message commit, and verifies that no residual git-status rows remain after ignored extension-owned debug artifacts are filtered out. Runtime is dominated by summary generation plus three git subprocesses. Side effects include documentation writes, index mutation, commit creation, and subprocess creation.
3321
+ - @param[in] plan {ReqReferencesCommandPlan} Prepared direct-write execution plan.
3322
+ - @param[in] config {UseReqConfig} Effective project configuration.
3323
+ - @return {void} No return value.
3324
+ - @throws {ReqError} Throws when reference generation, staging, commit creation, or cleanliness verification fails.
3325
+ - @satisfies REQ-300, REQ-301, REQ-302, REQ-303
3274
3326
 
3275
- ### iface `export interface BuildReferenceToolPayloadOptions` (L185-192)
3276
- - @brief Describes the options required to build one references payload.
3277
- - @details Supplies tool identity, scope, base directory, requested paths, and optional configured source directories while keeping payload construction deterministic. The interface is compile-time only and introduces no runtime cost.
3327
+ ## Symbol Index
3328
+ |Symbol|Kind|Vis|Lines|Sig|
3329
+ |---|---|---|---|---|
3330
+ |`ReqReferencesCommandPlan`|iface||30-35|export interface ReqReferencesCommandPlan|
3331
+ |`runCapture`|fn||44-49|function runCapture(command: string[], cwd: string): Retu...|
3332
+ |`buildIgnoredGitStatusPaths`|fn||59-73|function buildIgnoredGitStatusPaths(|
3333
+ |`listResidualGitStatusLines`|fn||84-102|function listResidualGitStatusLines(|
3334
+ |`getGitAddTargetPath`|fn||111-117|function getGitAddTargetPath(gitRoot: string, absolutePat...|
3335
+ |`prepareReqReferencesCommandExecution`|fn||128-141|export function prepareReqReferencesCommandExecution(|
3336
+ |`executeReqReferencesCommandExecution`|fn||152-175|export function executeReqReferencesCommandExecution(|
3278
3337
 
3279
- ### fn `function canonicalizeReferencePath(targetPath: string, baseDir: string): string` (L201-209)
3280
- - @brief Canonicalizes one filesystem path relative to the payload base directory.
3281
- - @details Emits a slash-normalized relative path when the target is under the base directory; otherwise emits the normalized absolute path. Runtime is O(p) in path length. No side effects occur.
3282
- - @param[in] targetPath {string} Absolute or relative filesystem path.
3283
- - @param[in] baseDir {string} Base directory used for relative canonicalization.
3284
- - @return {string} Canonicalized path string.
3285
3338
 
3286
- ### fn `function buildLineRange(startLineNumber: number, endLineNumber: number): ReferenceLineRange` (L218-224)
3287
- - @brief Builds one structured line-range record.
3288
- - @details Duplicates the inclusive range as start, end, and tuple fields so callers can address whichever shape is most convenient. Runtime is O(1). No side effects occur.
3289
- - @param[in] startLineNumber {number} Inclusive start line number.
3290
- - @param[in] endLineNumber {number} Inclusive end line number.
3291
- - @return {ReferenceLineRange} Structured line-range record.
3339
+ ---
3292
3340
 
3293
- ### fn `function extractCommentText(commentElement: SourceElement, maxLength = 0): string` (L233-253)
3294
- - @brief Extracts normalized plain text from one comment element.
3295
- - @details Removes language comment markers, drops delimiter-only lines, joins content with spaces, and optionally truncates the result. Runtime is O(n) in comment length. No side effects occur.
3296
- - @param[in] commentElement {SourceElement} Comment element.
3297
- - @param[in] maxLength {number} Optional maximum output length; `0` disables truncation.
3298
- - @return {string} Cleaned comment text.
3341
+ # req-reset-command.ts | TypeScript | 323L | 12 symbols | 7 imports | 14 comments
3342
+ > Path: `src/core/req-reset-command.ts`
3343
+ - @brief Implements the specialized `req-reset` slash-command workflow.
3344
+ - @details Performs non-agentic prompt-orchestration recovery by preserving the current execution-session transcript when available, restoring the original session-backed `base-path`, force-removing every generated sibling worktree and matching branch, and returning deterministic cleanup facts to the extension command handler. Runtime is dominated by session switching plus git subprocess execution. Side effects include session-file reads and writes, active-session replacement, host-process cwd mutation, worktree deletion, branch deletion, and filesystem removal.
3299
3345
 
3300
- ### fn `function extractCommentLines(commentElement: SourceElement): string[]` (L261-275)
3301
- - @brief Extracts cleaned individual lines from one comment element.
3302
- - @details Removes language comment markers while preserving line granularity for structured comment payloads. Runtime is O(n) in comment length. No side effects occur.
3303
- - @param[in] commentElement {SourceElement} Comment element.
3304
- - @return {string[]} Cleaned comment lines.
3346
+ ## Imports
3347
+ ```
3348
+ import fs from "node:fs";
3349
+ import path from "node:path";
3350
+ import { spawnSync } from "node:child_process";
3351
+ import {
3352
+ import { ReqError } from "./errors.js";
3353
+ import {
3354
+ import { resolveRuntimeGitPath } from "./runtime-project-paths.js";
3355
+ ```
3305
3356
 
3306
- ### fn `function buildCommentMaps(elements: SourceElement[]): [Record<number, SourceElement[]>, SourceElement[], string]` (L283-333)
3307
- - @brief Associates nearby comment blocks with definitions and standalone comment groups.
3308
- - @details Reuses the repository comment-attachment heuristic that binds comments within three lines of a definition while preserving early file-description text. Runtime is O(n log n). No side effects occur.
3309
- - @param[in] elements {SourceElement[]} Analyzed source elements.
3310
- - @return {[Record<number, SourceElement[]>, SourceElement[], string]} Attached-comment map, standalone comments, and compact file description.
3357
+ ## Definitions
3311
3358
 
3312
- ### fn `function resolveSymbolName(element: SourceElement): string` (L341-343)
3313
- - @brief Resolves one stable symbol name from an analyzed element.
3314
- - @details Prefers explicit analyzer name metadata, then falls back to the derived signature or the first source line so every symbol retains a direct-access identifier. Runtime is O(1). No side effects occur.
3315
- - @param[in] element {SourceElement} Source element.
3316
- - @return {string} Stable symbol name.
3359
+ ### iface `export interface ReqResetCommandPlan` (L34-40)
3360
+ - @brief Describes the prepared execution facts for one `req-reset` run.
3361
+ - @details Stores the validated project base, resolved git root, sibling-worktree parent directory, generated-name matcher, and optional persisted prompt execution plan used for transcript preservation plus base-path restoration. The interface is compile-time only and introduces no runtime cost.
3317
3362
 
3318
- ### fn `function resolveParentElement(definitions: SourceElement[], child: SourceElement): SourceElement | undefined` (L352-361)
3319
- - @brief Resolves the direct parent element for one child symbol.
3320
- - @details Matches by parent name plus inclusive line containment and chooses the deepest enclosing definition. Runtime is O(n) in definition count. No side effects occur.
3321
- - @param[in] definitions {SourceElement[]} Sorted definition elements.
3322
- - @param[in] child {SourceElement} Candidate child symbol.
3323
- - @return {SourceElement | undefined} Matched parent definition when available.
3363
+ ### iface `export interface ReqResetCommandExecutionResult` (L46-53)
3364
+ - @brief Describes the outcome of one `req-reset` execution attempt.
3365
+ - @details Captures the last valid session-bound context, transcript-preservation and base-path-restoration facts, removed generated worktree and branch names, and one aggregated failure string when any recovery step fails. The interface is compile-time only and introduces no runtime cost.
3324
3366
 
3325
- ### fn `function buildCommentEntry(commentElement: SourceElement): ReferenceCommentEntry` (L369-376)
3326
- - @brief Builds one structured comment record from a comment element.
3327
- - @details Preserves numeric line-range metadata plus normalized text and per-line fragments. Runtime is O(n) in comment length. No side effects occur.
3328
- - @param[in] commentElement {SourceElement} Source comment element.
3329
- - @return {ReferenceCommentEntry} Structured comment record.
3367
+ - type `type ReqResetCommandContext = Parameters<typeof restorePromptCommandExecution>[1];` (L59)
3368
+ - @brief Describes the session-bound context surface reused during `req-reset` recovery.
3369
+ - @details Reuses the session-switching contract already accepted by `restorePromptCommandExecution(...)` so the dedicated reset command can restore the original session without depending on concrete pi runtime classes. The alias is compile-time only and introduces no runtime cost.
3370
+ ### fn `function runCapture(command: string[], cwd: string): ReturnType<typeof spawnSync>` (L68-73)
3371
+ - @brief Executes one synchronous subprocess and captures UTF-8 output.
3372
+ - @details Delegates to `spawnSync(...)`, preserves the supplied working directory, and returns the raw result so callers can interpret git exit status plus diagnostics deterministically. Runtime is dominated by external process execution. Side effects include subprocess creation.
3373
+ - @param[in] command {string[]} Executable plus argument vector.
3374
+ - @param[in] cwd {string} Working directory for the subprocess.
3375
+ - @return {ReturnType<typeof spawnSync>} Captured subprocess result.
3330
3376
 
3331
- ### fn `function buildRepositoryTree(canonicalPaths: string[]): ReferenceRepositoryTreeNode` (L384-443)
3332
- - @brief Builds one structured repository tree from canonical file paths.
3333
- - @details Materializes a nested directory map and converts it into recursively ordered JSON nodes without decorative ASCII formatting. Runtime is O(n log n) in path count. No side effects occur.
3334
- - @param[in] canonicalPaths {string[]} Canonical file paths.
3335
- - @return {ReferenceRepositoryTreeNode} Structured repository tree rooted at `.`.
3377
+ ### fn `function escapeReqResetRegExpLiteral(text: string): string` (L81-83)
3378
+ - @brief Escapes one literal string for safe JavaScript regular-expression reuse.
3379
+ - @details Prefixes every regular-expression metacharacter with `\\` so generated worktree-name patterns can embed persisted prefixes and repository basenames without introducing unintended matcher semantics. Runtime is O(n) in string length. No external state is mutated.
3380
+ - @param[in] text {string} Literal text fragment.
3381
+ - @return {string} Regular-expression-safe literal fragment.
3336
3382
 
3337
- ### fn `const ensureDirectory = (parent: ReferenceRepositoryTreeNode, nodeName: string, relativePath: string): ReferenceRepositoryTreeNode =>` (L393-407)
3383
+ ### fn `function buildReqResetWorktreeNamePattern(gitRoot: string, config: UseReqConfig): RegExp` (L93-100)
3384
+ - @brief Builds the generated-worktree name matcher used by `req-reset` cleanup.
3385
+ - @details Reuses the configured worktree prefix plus repository basename, accepts any sanitized branch token between those fixed segments and the final execution identifier, and constrains the timestamp suffix to the documented `YYYYMMDDHHMMSS` shape. Runtime is O(p) in combined prefix and project-name length. No external state is mutated.
3386
+ - @param[in] gitRoot {string} Absolute runtime git root.
3387
+ - @param[in] config {UseReqConfig} Effective project configuration.
3388
+ - @return {RegExp} Matcher for generated prompt-command worktree and branch names.
3389
+ - @satisfies REQ-309, REQ-310, REQ-311
3338
3390
 
3339
- ### fn `const finalizeNode = (node: ReferenceRepositoryTreeNode): ReferenceRepositoryTreeNode =>` (L429-440)
3391
+ ### fn `function listReqResetRegisteredWorktreeRoots(gitRoot: string): string[]` (L109-118)
3392
+ - @brief Lists every registered git worktree root for one repository.
3393
+ - @details Executes `git worktree list --porcelain`, extracts each `worktree <path>` record, resolves every listed path to an absolute form, and returns the ordered list used by generated-worktree cleanup. Runtime is dominated by one git subprocess plus O(n) parsing in listed worktree count. Side effects include subprocess creation.
3394
+ - @param[in] gitRoot {string} Absolute runtime git root.
3395
+ - @return {string[]} Absolute registered worktree-root paths.
3396
+ - @throws {ReqError} Throws when git worktree enumeration fails.
3397
+
3398
+ ### fn `function listReqResetSiblingWorktreeRoots(` (L128-146)
3399
+ - @brief Lists sibling directories whose names match the generated-worktree contract.
3400
+ - @details Reads the repository parent directory, keeps only direct child directories whose basenames match the supplied generated-name pattern, and resolves each candidate to an absolute path so `req-reset` can remove unregistered leftover directories as well as registered git worktrees. Runtime is dominated by directory enumeration plus O(n) matcher cost. Side effects are limited to filesystem reads.
3401
+ - @param[in] parentPath {string} Absolute directory containing sibling worktree roots.
3402
+ - @param[in] worktreeNamePattern {RegExp} Generated-worktree name matcher.
3403
+ - @return {string[]} Absolute sibling directory paths whose basenames match the generated-name contract.
3404
+ - @throws {ReqError} Throws when directory enumeration fails.
3405
+
3406
+ ### fn `function listReqResetMatchingWorktreeRoots(` (L157-172)
3407
+ - @brief Lists every generated sibling worktree candidate targeted by `req-reset`.
3408
+ - @details Unions registered git-worktree roots with matching sibling directories so cleanup covers both registered worktrees and unregistered leftover directories, then sorts the canonical absolute paths for deterministic deletion order. Runtime is dominated by git worktree enumeration plus sibling-directory scanning. Side effects are limited to subprocess creation and filesystem reads.
3409
+ - @param[in] parentPath {string} Absolute directory containing sibling worktree roots.
3410
+ - @param[in] gitRoot {string} Absolute runtime git root.
3411
+ - @param[in] worktreeNamePattern {RegExp} Generated-worktree name matcher.
3412
+ - @return {string[]} Sorted absolute worktree-root paths targeted for deletion.
3413
+ - @throws {ReqError} Throws when git worktree or sibling-directory enumeration fails.
3340
3414
 
3341
- ### fn `function analyzeReferenceFile(` (L456-621)
3342
- - @brief Builds one analyzed file entry for the references payload.
3343
- - @details Parses the file with `SourceAnalyzer`, extracts structured imports and symbols, attaches structured Doxygen fields, and preserves standalone comment evidence. Runtime is O(S log S) in file size and symbol count. Side effects are limited to filesystem reads and optional stderr logging.
3344
- - @param[in] analyzer {SourceAnalyzer} Shared source analyzer instance.
3345
- - @param[in] inputPath {string} Caller-provided input path.
3346
- - @param[in] absolutePath {string} Absolute file path.
3347
- - @param[in] requestIndex {number} Zero-based request index.
3348
- - @param[in] baseDir {string} Base directory used for canonical paths.
3349
- - @param[in] verbose {boolean} When `true`, emit per-file progress diagnostics to stderr.
3350
- - @return {ReferenceToolFileEntry} Structured file entry.
3351
-
3352
- ### fn `export function buildReferenceToolPayload(options: BuildReferenceToolPayloadOptions): ReferenceToolPayload` (L630-730)
3353
- - @brief Builds the full agent-oriented references payload.
3354
- - @details Validates requested paths against the filesystem, analyzes processable files in caller order, preserves skipped and failed inputs in structured file entries, computes aggregate numeric totals, and emits structured repository data without echoing request metadata already known to the caller. Runtime is O(F log F + S). Side effects are limited to filesystem reads and optional stderr logging.
3355
- - @param[in] options {BuildReferenceToolPayloadOptions} Payload-construction options.
3356
- - @return {ReferenceToolPayload} Structured references payload ordered as summary, repository, and files.
3357
- - @satisfies REQ-011, REQ-014, REQ-076, REQ-077, REQ-078, REQ-079
3358
-
3359
- ### fn `export function buildReferenceToolExecutionStderr(payload: ReferenceToolPayload): string` (L738-752)
3360
- - @brief Builds deterministic stderr diagnostics from a references payload.
3361
- - @details Serializes skipped-input and analysis-error entries into stable newline-delimited diagnostics while leaving fully analyzed payloads silent. Runtime is O(n) in file-entry count. No side effects occur.
3362
- - @param[in] payload {ReferenceToolPayload} Structured references payload.
3363
- - @return {string} Newline-delimited diagnostics.
3415
+ ### fn `function listReqResetMatchingBranchNames(` (L182-195)
3416
+ - @brief Lists every matching generated branch targeted by `req-reset`.
3417
+ - @details Executes `git branch --list --format=%(refname:short)`, filters the local branch inventory through the generated-name matcher, and returns a sorted list so later forced branch deletion remains deterministic. Runtime is dominated by one git subprocess plus O(n) parsing in listed branch count. Side effects include subprocess creation.
3418
+ - @param[in] gitRoot {string} Absolute runtime git root.
3419
+ - @param[in] worktreeNamePattern {RegExp} Generated-worktree name matcher.
3420
+ - @return {string[]} Sorted local branch names targeted for deletion.
3421
+ - @throws {ReqError} Throws when local branch enumeration fails.
3422
+
3423
+ ### fn `export function prepareReqResetCommandExecution(` (L207-230)
3424
+ - @brief Prepares the specialized `req-reset` execution plan.
3425
+ - @details Resolves the active project base into a runtime git root, derives the sibling-worktree parent directory and generated-name matcher from the same prefix plus repository-basename contract used by prompt-command worktree generation, and keeps only worktree-backed persisted prompt execution plans for transcript-preserving base-path restoration. Runtime is O(p) in path length. No external state is mutated.
3426
+ - @param[in] projectBase {string} Absolute project base path.
3427
+ - @param[in] config {UseReqConfig} Effective project configuration.
3428
+ - @param[in] promptRequest {PromptCommandExecutionPlan | undefined} Pending or active prompt execution plan when available.
3429
+ - @return {ReqResetCommandPlan} Prepared recovery and cleanup plan.
3430
+ - @throws {ReqError} Throws when the repository root cannot be resolved.
3431
+ - @satisfies REQ-306, REQ-309, REQ-310, REQ-311
3432
+
3433
+ ### fn `export async function executeReqResetCommandExecution(` (L240-323)
3434
+ - @brief Executes the specialized `req-reset` recovery and cleanup workflow.
3435
+ - @details Preserves the execution-session transcript into the original session file when a worktree-backed prompt execution plan is still available, restores the original session-backed `base-path` through the shared prompt-command restoration helper, force-removes every matching sibling worktree directory, force-removes every remaining matching local branch, and aggregates any failure diagnostics without rolling back successful cleanup steps. Runtime is dominated by session switching plus git subprocess execution. Side effects include session-file reads and writes, active-session replacement, host-process cwd mutation, worktree deletion, branch deletion, and filesystem reads.
3436
+ - @param[in] plan {ReqResetCommandPlan} Prepared recovery and cleanup plan.
3437
+ - @param[in] ctx {ReqResetCommandContext | undefined} Optional session-bound command context.
3438
+ - @return {Promise<ReqResetCommandExecutionResult>} Recovery and cleanup outcome facts.
3439
+ - @satisfies REQ-305, REQ-307, REQ-308, REQ-309, REQ-310, REQ-313
3364
3440
 
3365
3441
  ## Symbol Index
3366
3442
  |Symbol|Kind|Vis|Lines|Sig|
3367
3443
  |---|---|---|---|---|
3368
- |`ReferenceToolScope`|type||27||
3369
- |`ReferenceFileStatus`|type||33||
3370
- |`ReferenceLineRange`|iface||39-43|export interface ReferenceLineRange|
3371
- |`ReferenceImportEntry`|iface||49-52|export interface ReferenceImportEntry extends ReferenceLi...|
3372
- |`ReferenceCommentEntry`|iface||58-61|export interface ReferenceCommentEntry extends ReferenceL...|
3373
- |`ReferenceExitPointEntry`|iface||67-70|export interface ReferenceExitPointEntry|
3374
- |`ReferenceSymbolEntry`|iface||76-96|export interface ReferenceSymbolEntry extends ReferenceLi...|
3375
- |`ReferenceToolFileEntry`|iface||102-115|export interface ReferenceToolFileEntry extends Reference...|
3376
- |`ReferenceToolRequestSection`|iface||121-130|export interface ReferenceToolRequestSection|
3377
- |`ReferenceToolSummarySection`|iface||136-147|export interface ReferenceToolSummarySection|
3378
- |`ReferenceRepositoryTreeNode`|iface||153-159|export interface ReferenceRepositoryTreeNode|
3379
- |`ReferenceToolRepositorySection`|iface||165-169|export interface ReferenceToolRepositorySection|
3380
- |`ReferenceToolPayload`|iface||175-179|export interface ReferenceToolPayload|
3381
- |`BuildReferenceToolPayloadOptions`|iface||185-192|export interface BuildReferenceToolPayloadOptions|
3382
- |`canonicalizeReferencePath`|fn||201-209|function canonicalizeReferencePath(targetPath: string, ba...|
3383
- |`buildLineRange`|fn||218-224|function buildLineRange(startLineNumber: number, endLineN...|
3384
- |`extractCommentText`|fn||233-253|function extractCommentText(commentElement: SourceElement...|
3385
- |`extractCommentLines`|fn||261-275|function extractCommentLines(commentElement: SourceElemen...|
3386
- |`buildCommentMaps`|fn||283-333|function buildCommentMaps(elements: SourceElement[]): [Re...|
3387
- |`resolveSymbolName`|fn||341-343|function resolveSymbolName(element: SourceElement): string|
3388
- |`resolveParentElement`|fn||352-361|function resolveParentElement(definitions: SourceElement[...|
3389
- |`buildCommentEntry`|fn||369-376|function buildCommentEntry(commentElement: SourceElement)...|
3390
- |`buildRepositoryTree`|fn||384-443|function buildRepositoryTree(canonicalPaths: string[]): R...|
3391
- |`ensureDirectory`|fn||393-407|const ensureDirectory = (parent: ReferenceRepositoryTreeN...|
3392
- |`finalizeNode`|fn||429-440|const finalizeNode = (node: ReferenceRepositoryTreeNode):...|
3393
- |`analyzeReferenceFile`|fn||456-621|function analyzeReferenceFile(|
3394
- |`buildReferenceToolPayload`|fn||630-730|export function buildReferenceToolPayload(options: BuildR...|
3395
- |`buildReferenceToolExecutionStderr`|fn||738-752|export function buildReferenceToolExecutionStderr(payload...|
3444
+ |`ReqResetCommandPlan`|iface||34-40|export interface ReqResetCommandPlan|
3445
+ |`ReqResetCommandExecutionResult`|iface||46-53|export interface ReqResetCommandExecutionResult|
3446
+ |`ReqResetCommandContext`|type||59||
3447
+ |`runCapture`|fn||68-73|function runCapture(command: string[], cwd: string): Retu...|
3448
+ |`escapeReqResetRegExpLiteral`|fn||81-83|function escapeReqResetRegExpLiteral(text: string): string|
3449
+ |`buildReqResetWorktreeNamePattern`|fn||93-100|function buildReqResetWorktreeNamePattern(gitRoot: string...|
3450
+ |`listReqResetRegisteredWorktreeRoots`|fn||109-118|function listReqResetRegisteredWorktreeRoots(gitRoot: str...|
3451
+ |`listReqResetSiblingWorktreeRoots`|fn||128-146|function listReqResetSiblingWorktreeRoots(|
3452
+ |`listReqResetMatchingWorktreeRoots`|fn||157-172|function listReqResetMatchingWorktreeRoots(|
3453
+ |`listReqResetMatchingBranchNames`|fn||182-195|function listReqResetMatchingBranchNames(|
3454
+ |`prepareReqResetCommandExecution`|fn||207-230|export function prepareReqResetCommandExecution(|
3455
+ |`executeReqResetCommandExecution`|fn||240-323|export async function executeReqResetCommandExecution(|
3396
3456
 
3397
3457
 
3398
3458
  ---
3399
3459
 
3400
- # resources.ts | TypeScript | 119L | 7 symbols | 3 imports | 8 comments
3460
+ # resources.ts | TypeScript | 102L | 7 symbols | 3 imports | 8 comments
3401
3461
  > Path: `src/core/resources.ts`
3402
3462
  - @brief Resolves installation-owned bundled resource locations.
3403
3463
  - @details Encapsulates installation-path discovery, bundled-resource validation, prompt enumeration, prompt loading, and bundled instruction loading directly from the installed extension payload. Runtime is proportional to directory-entry enumeration and resource file size. Side effects are limited to filesystem reads.
@@ -3437,20 +3497,20 @@ import { getInstallationPath, RESOURCE_ROOT_DIRNAME } from "./path-context.js";
3437
3497
  - @return {string} Raw prompt markdown content.
3438
3498
  - @throws {Error} Propagates `fs.readFileSync` errors when the prompt file is missing or unreadable.
3439
3499
 
3440
- ### fn `export function readBundledPromptDescription(promptName: string): string` (L73-95)
3441
- - @brief Extracts the YAML-front-matter `description` field from one bundled prompt.
3442
- - @details Parses only the leading front-matter block, resolves the first scalar `description` entry, strips one matching pair of wrapping quotes, and unescapes quoted apostrophe or quote characters used in prompt metadata. Runtime is O(n) in prompt length. Side effects are limited to filesystem reads delegated through `readBundledPrompt(...)`.
3500
+ ### fn `export function readBundledPromptDescription(promptName: string): string` (L73-78)
3501
+ - @brief Extracts the first Markdown level-one heading from one bundled prompt.
3502
+ - @details Removes one optional leading YAML front-matter block, scans the remaining markdown body for the first line that begins with `# `, and returns the heading payload without the marker or surrounding whitespace. Runtime is O(n) in prompt length. Side effects are limited to filesystem reads delegated through `readBundledPrompt(...)`.
3443
3503
  - @param[in] promptName {string} Prompt identifier without the `.md` suffix.
3444
- - @return {string} Normalized prompt description or the empty string when the front matter does not declare one.
3504
+ - @return {string} First `# ` heading payload, or the empty string when no level-one heading exists.
3445
3505
 
3446
- ### fn `export function readBundledInstruction(instructionName: string): string` (L104-106)
3506
+ ### fn `export function readBundledInstruction(instructionName: string): string` (L87-89)
3447
3507
  - @brief Reads one bundled markdown instruction by logical instruction name.
3448
3508
  - @details Resolves the instruction file under the installation-owned `resources/instructions` directory, validates resource accessibility, and loads it as UTF-8 text. Time complexity is O(n) in file size. Side effects are limited to filesystem reads.
3449
3509
  - @param[in] instructionName {string} Instruction identifier without the `.md` suffix.
3450
3510
  - @return {string} Raw instruction markdown content.
3451
3511
  - @throws {Error} Propagates `fs.readFileSync` errors when the instruction file is missing or unreadable.
3452
3512
 
3453
- ### fn `export function listBundledPromptNames(): string[]` (L113-119)
3513
+ ### fn `export function listBundledPromptNames(): string[]` (L96-102)
3454
3514
  - @brief Lists bundled prompt identifiers available in the installed extension payload.
3455
3515
  - @details Scans the installation-owned prompt directory, keeps visible markdown files only, strips the `.md` suffix, and returns a lexicographically sorted list. Time complexity is O(n log n). Side effects are limited to filesystem reads.
3456
3516
  - @return {string[]} Sorted prompt names without file extensions.
@@ -3462,9 +3522,9 @@ import { getInstallationPath, RESOURCE_ROOT_DIRNAME } from "./path-context.js";
3462
3522
  |`ensureBundledResourcesAccessible`|fn||26-38|export function ensureBundledResourcesAccessible(): string|
3463
3523
  |`readBundledMarkdownResource`|fn||48-54|function readBundledMarkdownResource(|
3464
3524
  |`readBundledPrompt`|fn||63-65|export function readBundledPrompt(promptName: string): st...|
3465
- |`readBundledPromptDescription`|fn||73-95|export function readBundledPromptDescription(promptName: ...|
3466
- |`readBundledInstruction`|fn||104-106|export function readBundledInstruction(instructionName: s...|
3467
- |`listBundledPromptNames`|fn||113-119|export function listBundledPromptNames(): string[]|
3525
+ |`readBundledPromptDescription`|fn||73-78|export function readBundledPromptDescription(promptName: ...|
3526
+ |`readBundledInstruction`|fn||87-89|export function readBundledInstruction(instructionName: s...|
3527
+ |`listBundledPromptNames`|fn||96-102|export function listBundledPromptNames(): string[]|
3468
3528
 
3469
3529
 
3470
3530
  ---
@@ -3532,7 +3592,7 @@ import { isSameOrAncestorPath } from "./path-context.js";
3532
3592
 
3533
3593
  ---
3534
3594
 
3535
- # settings-menu.ts | TypeScript | 264L | 12 symbols | 2 imports | 13 comments
3595
+ # settings-menu.ts | TypeScript | 321L | 15 symbols | 2 imports | 15 comments
3536
3596
  > Path: `src/core/settings-menu.ts`
3537
3597
  - @brief Renders pi-usereq configuration menus with the shared pi.dev settings style.
3538
3598
  - @details Wraps `SettingsList` in one extension-command helper that exposes right-aligned current values, built-in circular scrolling, bottom-line descriptions, and a deterministic bridge for offline test harnesses. Runtime is O(n) in visible choice count plus user interaction cost. Side effects are limited to transient custom-UI rendering.
@@ -3545,37 +3605,35 @@ import { Container, SettingsList, Text, type Component, type SettingItem, type S
3545
3605
 
3546
3606
  ## Definitions
3547
3607
 
3548
- ### iface `export interface PiUsereqSettingsMenuChoice` (L14-22)
3608
+ ### iface `export interface PiUsereqSettingsMenuChoice` (L14-23)
3549
3609
  - @brief Describes one selectable pi-usereq settings-menu choice.
3550
- - @details Stores the stable action identifier, left-column label, optional label and value tone overrides, optional disabled state, right-column current value, and bottom-line description consumed by the shared settings-menu renderer. The interface is compile-time only and introduces no runtime cost.
3610
+ - @details Stores the stable action identifier, left-column label, optional label and value tone overrides, optional disabled state, right-column current value, optional inline-cycle values, and bottom-line description consumed by the shared settings-menu renderer. The interface is compile-time only and introduces no runtime cost.
3551
3611
 
3552
- ### iface `export interface PiUsereqSettingsMenuBridge` (L28-34)
3612
+ ### iface `export interface PiUsereqSettingsMenuBridge` (L29-35)
3553
3613
  - @brief Describes the offline bridge exposed by shared settings-menu components.
3554
3614
  - @details Lets deterministic harnesses and unit tests drive the same settings-menu choices by label without simulating raw terminal key streams. The interface is runtime-facing but carries no side effects by itself.
3555
3615
 
3556
- ### iface `export interface PiUsereqSettingsMenuOptions` (L42-44)
3616
+ ### iface `export interface PiUsereqSettingsMenuOptions` (L41-45)
3557
3617
  - @brief Describes optional behavior overrides for one settings-menu render.
3558
- - @details Carries the caller-selected initial focus row so menu re-renders can
3559
- preserve selection after an in-place toggle or value edit. The interface is
3560
- compile-time only and introduces no runtime cost.
3618
+ - @details Carries the caller-selected initial focus row, the optional dynamic choice supplier used to rebuild dependent rows after inline toggles, and the optional inline-change callback used to persist `SettingsList` value cycles without closing the menu. The interface is compile-time only and introduces no runtime cost.
3561
3619
 
3562
- ### iface `export interface PiUsereqSettingsMenuComponent extends Component` : Component (L50-52)
3620
+ ### iface `export interface PiUsereqSettingsMenuComponent extends Component` : Component (L51-53)
3563
3621
  - @brief Represents a custom menu component augmented with the offline bridge.
3564
3622
  - @details Extends the generic TUI `Component` contract with one optional bridge field consumed only by deterministic test and debug harness adapters. The interface is compile-time only and introduces no runtime cost.
3565
3623
 
3566
- - type `type PiUsereqSettingsThemeColor = Extract<ThemeColor, "accent" | "muted" | "dim">;` (L60)
3624
+ - type `type PiUsereqSettingsThemeColor = Extract<ThemeColor, "accent" | "muted" | "dim">;` (L61)
3567
3625
  - @brief Enumerates the CLI-supported theme tokens consumed by settings menus.
3568
3626
  - @details Narrows callback-local theme calls to the documented settings-list
3569
3627
  semantics used by the pi CLI. Compile-time only and introduces no runtime
3570
3628
  cost.
3571
- ### iface `interface PiUsereqSettingsTheme` (L69-72)
3629
+ ### iface `interface PiUsereqSettingsTheme` (L70-73)
3572
3630
  - @brief Describes the callback-local theme surface required by settings menus.
3573
3631
  - @details Captures the subset of the custom-UI theme API needed to rebuild
3574
3632
  title and fallback settings-list styling when the shared global theme is not
3575
3633
  available in tests or offline replay. Compile-time only and introduces no
3576
3634
  runtime cost.
3577
3635
 
3578
- ### fn `function buildFallbackPiUsereqSettingsListTheme(` (L84-96)
3636
+ ### fn `function buildFallbackPiUsereqSettingsListTheme(` (L85-97)
3579
3637
  - @brief Builds the fallback settings-list theme matching CLI settings semantics.
3580
3638
  - @details Mirrors the shared CLI settings theme token mapping for labels,
3581
3639
  values, descriptions, cursor, and hints while avoiding the global theme
@@ -3585,7 +3643,7 @@ mutated.
3585
3643
  - @return {SettingsListTheme} Fallback settings-list theme.
3586
3644
  - @satisfies REQ-151, REQ-156
3587
3645
 
3588
- ### fn `function buildPiUsereqSettingsListTheme(` (L109-123)
3646
+ ### fn `function buildPiUsereqSettingsListTheme(` (L110-124)
3589
3647
  - @brief Resolves the settings-list theme used by pi-usereq configuration menus.
3590
3648
  - @details Prefers the shared CLI `getSettingsListTheme()` API so extension
3591
3649
  menus inherit active-theme behavior from pi itself, then falls back to an
@@ -3596,7 +3654,7 @@ external state is mutated.
3596
3654
  - @return {SettingsListTheme} Settings-list theme used by pi-usereq menus.
3597
3655
  - @satisfies REQ-151, REQ-156
3598
3656
 
3599
- ### fn `function formatPiUsereqSettingsMenuTitle(` (L135-140)
3657
+ ### fn `function formatPiUsereqSettingsMenuTitle(` (L136-141)
3600
3658
  - @brief Formats the settings-menu title with active-theme semantics.
3601
3659
  - @details Applies the callback-local `accent` token and bold styling on every
3602
3660
  rebuild so custom-menu titles stay synchronized with live theme changes.
@@ -3606,46 +3664,64 @@ Runtime is O(n) in title length. No external state is mutated.
3606
3664
  - @return {string} Styled title text.
3607
3665
  - @satisfies REQ-151, REQ-156
3608
3666
 
3609
- ### fn `function createImmediateSelectionComponent(choiceId: string, done: (value?: string) => void): Component` (L149-161)
3667
+ ### fn `function createImmediateSelectionComponent(choiceId: string, done: (value?: string) => void): Component` (L150-162)
3610
3668
  - @brief Closes a settings menu immediately with one selected action identifier.
3611
3669
  - @details Provides the submenu callback used by `SettingsList` so pressing Enter on any menu row resolves the outer custom UI promise with the row identifier. Runtime is O(1). Side effects are limited to one custom-UI completion callback.
3612
3670
  - @param[in] choiceId {string} Stable choice identifier to emit.
3613
3671
  - @param[in] done {(value?: string) => void} Outer custom-UI completion callback.
3614
3672
  - @return {Component} Immediate-completion submenu component.
3615
3673
 
3616
- ### fn `function buildSettingItems(` (L171-189)
3674
+ ### fn `function buildSettingItems(` (L172-193)
3617
3675
  - @brief Builds `SettingsList` items from one menu-choice vector.
3618
- - @details Copies labels, current values, label-tone overrides, value-tone overrides, disabled-state semantics, and descriptions into `SettingItem` records and attaches a submenu that resolves the outer custom UI with the selected choice identifier only for enabled rows. Runtime is O(n) in choice count. No external state is mutated.
3676
+ - @details Copies labels, current values, label-tone overrides, value-tone overrides, disabled-state semantics, inline-cycle values, and descriptions into `SettingItem` records. Non-disabled rows with `values` cycle inline on `Enter` or `Space`, while other non-disabled rows resolve the outer custom UI through the immediate submenu bridge. Runtime is O(n) in choice count. No external state is mutated.
3619
3677
  - @param[in] theme {PiUsereqSettingsTheme} Callback-local pi theme adapter.
3620
3678
  - @param[in] choices {PiUsereqSettingsMenuChoice[]} Ordered menu-choice vector.
3621
3679
  - @param[in] done {(value?: string) => void} Outer custom-UI completion callback.
3622
3680
  - @return {SettingItem[]} `SettingsList` item vector.
3623
3681
 
3624
- ### fn `export async function showPiUsereqSettingsMenu(` (L201-205)
3682
+ ### fn `function setSettingsListSelectedIndex(` (L202-207)
3683
+ - @brief Writes one best-effort selected row index into a `SettingsList` instance.
3684
+ - @details Uses reflective access so pi-usereq can preserve focus across menu re-renders without depending on the private field at compile time. Runtime is O(1). Side effect: mutates the underlying `SettingsList` selection state when the field exists.
3685
+ - @param[in] selectedIndex {number} Zero-based row index to restore.
3686
+ - @param[in,out] settingsList {SettingsList} Mutable settings-list instance.
3687
+ - @return {void} No return value.
3688
+
3689
+ ### fn `function getSettingsListSelectedIndex(` (L215-220)
3690
+ - @brief Reads the current selected row index from a `SettingsList` instance.
3691
+ - @details Uses reflective access so pi-usereq can report the current focused row through the offline bridge without referencing the private field in the static type system. Runtime is O(1). No external state is mutated.
3692
+ - @param[in] settingsList {SettingsList} Settings-list instance.
3693
+ - @return {number | undefined} Zero-based selected row index when available.
3694
+
3695
+ ### fn `export async function showPiUsereqSettingsMenu(` (L232-236)
3625
3696
  - @brief Renders one shared pi-usereq settings menu and resolves the selected action.
3626
- - @details Uses `ctx.ui.custom(...)` plus `SettingsList` so every configuration menu shares pi.dev styling, right-aligned current values, circular scrolling, bottom-line descriptions, and optional disabled rows. The returned custom component also exposes an offline bridge for deterministic tests and debug harnesses. Runtime is O(n) in visible choice count plus user interaction cost. Side effects are limited to transient custom-UI rendering.
3697
+ - @details Uses `ctx.ui.custom(...)` plus `SettingsList` so every configuration menu shares pi.dev styling, right-aligned current values, circular scrolling, bottom-line descriptions, optional disabled rows, and inline toggle cycles that do not close the menu. When callers provide `getChoices(...)`, dependent rows are rebuilt after inline changes while preserving focus on the changed row. The returned custom component also exposes an offline bridge for deterministic tests and debug harnesses. Runtime is O(n) in visible choice count plus user interaction cost. Side effects are limited to transient custom-UI rendering and caller-owned inline-change callbacks.
3627
3698
  - @param[in] ctx {ExtensionCommandContext} Active command context.
3628
3699
  - @param[in] title {string} Menu title displayed in the heading and offline bridge.
3629
3700
  - @param[in] choices {PiUsereqSettingsMenuChoice[]} Ordered menu-choice vector.
3630
- - @param[in] options {PiUsereqSettingsMenuOptions | undefined} Optional initial-focus override.
3701
+ - @param[in] options {PiUsereqSettingsMenuOptions | undefined} Optional initial-focus override plus inline-change behavior.
3631
3702
  - @return {Promise<string | undefined>} Selected choice identifier or `undefined` when cancelled.
3632
3703
  - @satisfies REQ-151, REQ-152, REQ-153, REQ-154, REQ-156, REQ-192
3633
3704
 
3705
+ ### fn `const rebuildMenu = (selectedChoiceId?: string): void =>` (L272-279)
3706
+
3634
3707
  ## Symbol Index
3635
3708
  |Symbol|Kind|Vis|Lines|Sig|
3636
3709
  |---|---|---|---|---|
3637
- |`PiUsereqSettingsMenuChoice`|iface||14-22|export interface PiUsereqSettingsMenuChoice|
3638
- |`PiUsereqSettingsMenuBridge`|iface||28-34|export interface PiUsereqSettingsMenuBridge|
3639
- |`PiUsereqSettingsMenuOptions`|iface||42-44|export interface PiUsereqSettingsMenuOptions|
3640
- |`PiUsereqSettingsMenuComponent`|iface||50-52|export interface PiUsereqSettingsMenuComponent extends Co...|
3641
- |`PiUsereqSettingsThemeColor`|type||60||
3642
- |`PiUsereqSettingsTheme`|iface||69-72|interface PiUsereqSettingsTheme|
3643
- |`buildFallbackPiUsereqSettingsListTheme`|fn||84-96|function buildFallbackPiUsereqSettingsListTheme(|
3644
- |`buildPiUsereqSettingsListTheme`|fn||109-123|function buildPiUsereqSettingsListTheme(|
3645
- |`formatPiUsereqSettingsMenuTitle`|fn||135-140|function formatPiUsereqSettingsMenuTitle(|
3646
- |`createImmediateSelectionComponent`|fn||149-161|function createImmediateSelectionComponent(choiceId: stri...|
3647
- |`buildSettingItems`|fn||171-189|function buildSettingItems(|
3648
- |`showPiUsereqSettingsMenu`|fn||201-205|export async function showPiUsereqSettingsMenu(|
3710
+ |`PiUsereqSettingsMenuChoice`|iface||14-23|export interface PiUsereqSettingsMenuChoice|
3711
+ |`PiUsereqSettingsMenuBridge`|iface||29-35|export interface PiUsereqSettingsMenuBridge|
3712
+ |`PiUsereqSettingsMenuOptions`|iface||41-45|export interface PiUsereqSettingsMenuOptions|
3713
+ |`PiUsereqSettingsMenuComponent`|iface||51-53|export interface PiUsereqSettingsMenuComponent extends Co...|
3714
+ |`PiUsereqSettingsThemeColor`|type||61||
3715
+ |`PiUsereqSettingsTheme`|iface||70-73|interface PiUsereqSettingsTheme|
3716
+ |`buildFallbackPiUsereqSettingsListTheme`|fn||85-97|function buildFallbackPiUsereqSettingsListTheme(|
3717
+ |`buildPiUsereqSettingsListTheme`|fn||110-124|function buildPiUsereqSettingsListTheme(|
3718
+ |`formatPiUsereqSettingsMenuTitle`|fn||136-141|function formatPiUsereqSettingsMenuTitle(|
3719
+ |`createImmediateSelectionComponent`|fn||150-162|function createImmediateSelectionComponent(choiceId: stri...|
3720
+ |`buildSettingItems`|fn||172-193|function buildSettingItems(|
3721
+ |`setSettingsListSelectedIndex`|fn||202-207|function setSettingsListSelectedIndex(|
3722
+ |`getSettingsListSelectedIndex`|fn||215-220|function getSettingsListSelectedIndex(|
3723
+ |`showPiUsereqSettingsMenu`|fn||232-236|export async function showPiUsereqSettingsMenu(|
3724
+ |`rebuildMenu`|fn||272-279|const rebuildMenu = (selectedChoiceId?: string): void =>|
3649
3725
 
3650
3726
 
3651
3727
  ---
@@ -4155,7 +4231,7 @@ import { ReqError } from "./errors.js";
4155
4231
 
4156
4232
  ---
4157
4233
 
4158
- # tool-runner.ts | TypeScript | 438L | 21 symbols | 11 imports | 23 comments
4234
+ # tool-runner.ts | TypeScript | 458L | 22 symbols | 11 imports | 24 comments
4159
4235
  > Path: `src/core/tool-runner.ts`
4160
4236
  - @brief Implements the executable back-end for pi-usereq CLI analysis and static-check commands.
4161
4237
  - @details Centralizes project discovery, git-backed source-file collection, documentation token generation, compression, construct lookup, and static-check dispatch. Runtime depends on the selected command and may include filesystem reads, config writes, and process spawning.
@@ -4257,9 +4333,9 @@ import { makeRelativeIfContainsProject } from "./utils.js";
4257
4333
  - @return {ToolResult} Tool result containing the formatted summary and warnings.
4258
4334
  - @throws {ReqError} Throws when no valid files are provided.
4259
4335
 
4260
- ### fn `export function runFilesReferences(files: string[], cwd = process.cwd(), verbose = false): ToolResult` (L250-256)
4261
- - @brief Generates the monolithic references markdown for explicit files.
4262
- - @details Delegates to `generateMarkdown(...)`, keeps output paths relative to the caller cwd, and returns the Python-compatible markdown document through stdout. Runtime is O(F + S). Side effects are limited to filesystem reads and optional stderr logging.
4336
+ ### fn `export function runFilesSummarize(files: string[], cwd = process.cwd(), verbose = false): ToolResult` (L250-256)
4337
+ - @brief Generates the monolithic summary markdown for explicit files.
4338
+ - @details Delegates to `generateMarkdown(...)`, keeps output paths relative to the caller cwd, and returns the Python-compatible summary markdown document through stdout. Runtime is O(F + S). Side effects are limited to filesystem reads and optional stderr logging.
4263
4339
  - @param[in] files {string[]} Explicit file paths.
4264
4340
  - @param[in] cwd {string} Base directory used for relative output paths. Defaults to `process.cwd()`.
4265
4341
  - @param[in] verbose {boolean} When `true`, emit per-file progress diagnostics to stderr.
@@ -4284,9 +4360,9 @@ import { makeRelativeIfContainsProject } from "./utils.js";
4284
4360
  - @return {ToolResult} Successful tool result containing construct markdown.
4285
4361
  - @throws {ReqError} Throws when required arguments are missing.
4286
4362
 
4287
- ### fn `export function runReferences(projectBase: string, config?: UseReqConfig, verbose = false): ToolResult` (L298-309)
4288
- - @brief Generates the monolithic references markdown for configured source directories.
4289
- - @details Resolves the project base, collects configured source files, prepends the repository file-structure markdown block, and returns the Python-compatible references document through stdout. Runtime is O(F log F + S). Side effects are limited to filesystem reads and optional stderr logging.
4363
+ ### fn `export function runSummarize(projectBase: string, config?: UseReqConfig, verbose = false): ToolResult` (L298-309)
4364
+ - @brief Generates the monolithic summary markdown for configured source directories.
4365
+ - @details Resolves the project base, collects configured source files, prepends the repository file-structure markdown block, and returns the Python-compatible summary document through stdout. Runtime is O(F log F + S). Side effects are limited to filesystem reads and optional stderr logging.
4290
4366
  - @param[in] projectBase {string} Candidate project root.
4291
4367
  - @param[in] config {UseReqConfig | undefined} Optional preloaded configuration.
4292
4368
  - @param[in] verbose {boolean} When `true`, emit per-file diagnostics to stderr.
@@ -4294,7 +4370,17 @@ import { makeRelativeIfContainsProject } from "./utils.js";
4294
4370
  - @throws {ReqError} Throws when no source files are found or no file can be analyzed.
4295
4371
  - @satisfies REQ-014, REQ-076, REQ-077, REQ-078, REQ-079
4296
4372
 
4297
- ### fn `export function runCompress(projectBase: string, config?: UseReqConfig, enableLineNumbers = false, verbose = false): ToolResult` (L321-326)
4373
+ ### fn `export function runReferences(projectBase: string, config?: UseReqConfig, verbose = false): ToolResult` (L321-329)
4374
+ - @brief Writes configured project references markdown to the canonical docs file.
4375
+ - @details Reuses `runSummarize(...)` to generate the same file-structure-plus-summary markdown, resolves `<docs-dir>/REFERENCES.md` from the effective project configuration, overwrites the target file, and returns the status-only stdout `success`. Runtime is O(F log F + S) plus one file write. Side effects include filesystem writes.
4376
+ - @param[in] projectBase {string} Candidate project root.
4377
+ - @param[in] config {UseReqConfig | undefined} Optional preloaded configuration.
4378
+ - @param[in] verbose {boolean} When `true`, emit per-file diagnostics to stderr during summary generation.
4379
+ - @return {ToolResult} Successful tool result containing the status-only stdout payload.
4380
+ - @throws {ReqError} Throws when source discovery, summary generation, or file writing fails.
4381
+ - @satisfies REQ-293
4382
+
4383
+ ### fn `export function runCompress(projectBase: string, config?: UseReqConfig, enableLineNumbers = false, verbose = false): ToolResult` (L341-346)
4298
4384
  - @brief Compresses all source files from configured source directories.
4299
4385
  - @details Resolves the project base, collects source files, and delegates to `compressFiles`. Runtime is O(F + S). Side effects are limited to filesystem reads and optional stderr logging.
4300
4386
  - @param[in] projectBase {string} Candidate project root.
@@ -4304,7 +4390,7 @@ import { makeRelativeIfContainsProject } from "./utils.js";
4304
4390
  - @return {ToolResult} Successful tool result containing compressed output.
4305
4391
  - @throws {ReqError} Throws when no source files are found.
4306
4392
 
4307
- ### fn `export function runSearch(projectBase: string, tagFilter: string, pattern: string, config?: UseReqConfig, enableLineNumbers = false, verbose = false): ToolResult` (L340-349)
4393
+ ### fn `export function runSearch(projectBase: string, tagFilter: string, pattern: string, config?: UseReqConfig, enableLineNumbers = false, verbose = false): ToolResult` (L360-369)
4308
4394
  - @brief Searches named constructs across configured project source files.
4309
4395
  - @details Resolves the project base, collects source files, delegates to `searchConstructsInFiles`, and converts thrown search errors into structured `ReqError` failures. Runtime is O(F + S + M). Side effects are limited to filesystem reads and optional stderr logging.
4310
4396
  - @param[in] projectBase {string} Candidate project root.
@@ -4316,7 +4402,7 @@ import { makeRelativeIfContainsProject } from "./utils.js";
4316
4402
  - @return {ToolResult} Successful tool result containing construct markdown.
4317
4403
  - @throws {ReqError} Throws when no source files are found or the search fails.
4318
4404
 
4319
- ### fn `export function runTokens(projectBase: string, config?: UseReqConfig): ToolResult` (L359-368)
4405
+ ### fn `export function runTokens(projectBase: string, config?: UseReqConfig): ToolResult` (L379-388)
4320
4406
  - @brief Counts tokens for canonical documentation files.
4321
4407
  - @details Loads the configured docs directory, selects `REQUIREMENTS.md`, `WORKFLOW.md`, and `REFERENCES.md` when present, and delegates to `runFilesTokens`. Runtime is O(F + S). Side effects are limited to filesystem reads.
4322
4408
  - @param[in] projectBase {string} Candidate project root.
@@ -4324,7 +4410,7 @@ import { makeRelativeIfContainsProject } from "./utils.js";
4324
4410
  - @return {ToolResult} Tool result containing documentation token metrics.
4325
4411
  - @throws {ReqError} Throws when no canonical docs files exist.
4326
4412
 
4327
- ### fn `export function runFilesStaticCheck(files: string[], projectBase: string, config?: UseReqConfig): ToolResult` (L378-414)
4413
+ ### fn `export function runFilesStaticCheck(files: string[], projectBase: string, config?: UseReqConfig): ToolResult` (L398-434)
4328
4414
  - @brief Runs configured static checks for explicit files.
4329
4415
  - @details Loads the effective static-check config, resolves the active checker list per file-extension language through the per-language enable flag, captures checker stdout for each dispatched entry, and aggregates stderr warnings for invalid paths. Runtime is O(F * C) plus external checker cost. Side effects include filesystem reads, stdout interception, and process spawning.
4330
4416
  - @param[in] files {string[]} Explicit file paths.
@@ -4332,7 +4418,7 @@ import { makeRelativeIfContainsProject } from "./utils.js";
4332
4418
  - @param[in] config {UseReqConfig | undefined} Optional preloaded configuration.
4333
4419
  - @return {ToolResult} Aggregated static-check result.
4334
4420
 
4335
- ### fn `export function runProjectStaticCheck(projectBase: string, config?: UseReqConfig): ToolResult` (L424-437)
4421
+ ### fn `export function runProjectStaticCheck(projectBase: string, config?: UseReqConfig): ToolResult` (L444-457)
4336
4422
  - @brief Runs configured static checks for project source and test directories.
4337
4423
  - @details Collects source and test files, excludes fixture roots, and delegates to `runFilesStaticCheck`. Runtime is O(F * C) plus external checker cost. Side effects include filesystem reads, stdout interception, and process spawning.
4338
4424
  - @param[in] projectBase {string} Candidate project root.
@@ -4355,15 +4441,16 @@ import { makeRelativeIfContainsProject } from "./utils.js";
4355
4441
  |`resolveProjectSrcDirs`|fn||196-204|export function resolveProjectSrcDirs(projectBase: string...|
4356
4442
  |`loadAndRepairConfig`|fn||213-218|export function loadAndRepairConfig(projectBase: string):...|
4357
4443
  |`runFilesTokens`|fn||227-239|export function runFilesTokens(files: string[]): ToolResult|
4358
- |`runFilesReferences`|fn||250-256|export function runFilesReferences(files: string[], cwd =...|
4444
+ |`runFilesSummarize`|fn||250-256|export function runFilesSummarize(files: string[], cwd = ...|
4359
4445
  |`runFilesCompress`|fn||267-269|export function runFilesCompress(files: string[], cwd = p...|
4360
4446
  |`runFilesSearch`|fn||280-286|export function runFilesSearch(argsList: string[], enable...|
4361
- |`runReferences`|fn||298-309|export function runReferences(projectBase: string, config...|
4362
- |`runCompress`|fn||321-326|export function runCompress(projectBase: string, config?:...|
4363
- |`runSearch`|fn||340-349|export function runSearch(projectBase: string, tagFilter:...|
4364
- |`runTokens`|fn||359-368|export function runTokens(projectBase: string, config?: U...|
4365
- |`runFilesStaticCheck`|fn||378-414|export function runFilesStaticCheck(files: string[], proj...|
4366
- |`runProjectStaticCheck`|fn||424-437|export function runProjectStaticCheck(projectBase: string...|
4447
+ |`runSummarize`|fn||298-309|export function runSummarize(projectBase: string, config?...|
4448
+ |`runReferences`|fn||321-329|export function runReferences(projectBase: string, config...|
4449
+ |`runCompress`|fn||341-346|export function runCompress(projectBase: string, config?:...|
4450
+ |`runSearch`|fn||360-369|export function runSearch(projectBase: string, tagFilter:...|
4451
+ |`runTokens`|fn||379-388|export function runTokens(projectBase: string, config?: U...|
4452
+ |`runFilesStaticCheck`|fn||398-434|export function runFilesStaticCheck(files: string[], proj...|
4453
+ |`runProjectStaticCheck`|fn||444-457|export function runProjectStaticCheck(projectBase: string...|
4367
4454
 
4368
4455
 
4369
4456
  ---
@@ -4450,7 +4537,7 @@ import path from "node:path";
4450
4537
 
4451
4538
  ---
4452
4539
 
4453
- # index.ts | TypeScript | 3765L | 87 symbols | 25 imports | 93 comments
4540
+ # index.ts | TypeScript | 4203L | 93 symbols | 27 imports | 99 comments
4454
4541
  > Path: `src/index.ts`
4455
4542
  - @brief Registers the pi-usereq extension commands, tools, and configuration UI.
4456
4543
  - @details Bridges the standalone tool-runner layer into the pi extension API by registering prompt commands, agent tools, and interactive configuration menus. Runtime at module load is O(1); later behavior depends on the selected command or tool. Side effects include extension registration, UI updates, filesystem reads/writes, and delegated tool execution.
@@ -4472,6 +4559,8 @@ import {
4472
4559
  import { renderPrompt } from "./core/prompts.js";
4473
4560
  import {
4474
4561
  import {
4562
+ import {
4563
+ import {
4475
4564
  import { PROMPT_COMMAND_NAMES } from "./core/prompt-command-catalog.js";
4476
4565
  import { resolveRuntimeGitPath } from "./core/runtime-project-paths.js";
4477
4566
  import {
@@ -4486,45 +4575,45 @@ import { makeRelativeIfContainsProject, shellSplit } from "./core/utils.js";
4486
4575
 
4487
4576
  ## Definitions
4488
4577
 
4489
- ### iface `interface PiShortcutRegistrar` (L161-169)
4578
+ ### iface `interface PiShortcutRegistrar` (L177-185)
4490
4579
  - @brief Describes the optional shortcut-registration surface used by pi-usereq.
4491
4580
  - @details Narrows the runtime API to the documented `registerShortcut(...)`
4492
4581
  method so the extension can remain compatible with offline harnesses that do
4493
4582
  not implement shortcut capture. Compile-time only and introduces no runtime
4494
4583
  cost.
4495
4584
 
4496
- ### fn `function getProjectBase(cwd: string): string` (L177-186)
4585
+ ### fn `function getProjectBase(cwd: string): string` (L193-202)
4497
4586
  - @brief Resolves the effective project base from a working directory.
4498
4587
  - @details Normalizes the provided cwd into an absolute path without consulting configuration. Time complexity is O(1). No I/O side effects occur.
4499
4588
  - @param[in] cwd {string} Current working directory.
4500
4589
  - @return {string} Absolute project base path.
4501
4590
 
4502
- ### fn `function getProcessCwdSafe(): string` (L193-202)
4591
+ ### fn `function getProcessCwdSafe(): string` (L209-218)
4503
4592
  - @brief Resolves a safe process working directory for extension-load paths.
4504
4593
  - @details Returns `process.cwd()` when available and falls back to absolute `PWD`, `HOME`, or `/` when the current shell directory has been deleted. Runtime is O(1). No external state is mutated.
4505
4594
  - @return {string} Absolute fallback-safe process working directory.
4506
4595
 
4507
- ### fn `function resolveLiveBootstrapCwd(cwd: string): string` (L210-222)
4596
+ ### fn `function resolveLiveBootstrapCwd(cwd: string): string` (L226-238)
4508
4597
  - @brief Resolves the live working directory used for bootstrap-sensitive flows.
4509
4598
  - @details Prefers the supplied cwd when it still exists. Otherwise reuses the tracked runtime context path when it remains live, then the tracked runtime base path, and finally a process-safe cwd so deleted worktree paths retained by stale contexts cannot poison later prompt preflight or lifecycle bootstrap. Runtime is O(1) plus bounded filesystem probes. No external state is mutated.
4510
4599
  - @param[in] cwd {string} Candidate context cwd.
4511
4600
  - @return {string} Existing absolute cwd used for bootstrap work.
4512
4601
 
4513
- ### fn `function syncContextCwdMirror(ctx: { cwd?: string }, cwd: string): void` (L231-240)
4602
+ ### fn `function syncContextCwdMirror(ctx: { cwd?: string }, cwd: string): void` (L247-256)
4514
4603
  - @brief Best-effort synchronizes one context `cwd` mirror with bootstrap reality.
4515
4604
  - @details Applies the resolved live cwd to the supplied context when writable and ignores stale or read-only mirrors so command bootstrap can continue using authoritative filesystem probes. Runtime is O(1). Side effects are limited to optional `ctx.cwd` mutation.
4516
4605
  - @param[in] cwd {string} Resolved live cwd.
4517
4606
  - @param[in,out] ctx {{ cwd?: string }} Mutable context-like object.
4518
4607
  - @return {void} No return value.
4519
4608
 
4520
- ### fn `function loadProjectConfig(cwd: string): UseReqConfig` (L249-252)
4609
+ ### fn `function loadProjectConfig(cwd: string): UseReqConfig` (L265-268)
4521
4610
  - @brief Loads project configuration for the extension runtime.
4522
4611
  - @details Resolves the project base, loads persisted config, and normalizes configured directory paths without reading or persisting runtime-derived `base-path` or `git-path` metadata. Runtime is dominated by config I/O. Side effects are limited to filesystem reads.
4523
4612
  - @param[in] cwd {string} Current working directory.
4524
4613
  - @return {UseReqConfig} Effective project configuration.
4525
4614
  - @satisfies REQ-030, REQ-145, REQ-146
4526
4615
 
4527
- ### fn `function saveProjectConfig(cwd: string, config: UseReqConfig): void` (L262-265)
4616
+ ### fn `function saveProjectConfig(cwd: string, config: UseReqConfig): void` (L278-281)
4528
4617
  - @brief Persists project configuration from the extension runtime.
4529
4618
  - @details Resolves the project base, normalizes configured directory paths into project-relative form, and delegates persistence to `saveConfig` without serializing runtime-derived path metadata. Runtime is O(n) in config size. Side effects include config-file writes.
4530
4619
  - @param[in] cwd {string} Current working directory.
@@ -4532,32 +4621,32 @@ cost.
4532
4621
  - @return {void} No return value.
4533
4622
  - @satisfies REQ-146
4534
4623
 
4535
- ### fn `function formatProjectConfigPathForMenu(cwd: string): string` (L274-278)
4624
+ ### fn `function formatProjectConfigPathForMenu(cwd: string): string` (L290-294)
4536
4625
  - @brief Formats the current project config path for top-level menu display.
4537
4626
  - @details Resolves `<base-path>/.pi-usereq.json` from the cwd-derived project base, reuses the shared runtime-path formatter, and rewrites a leading POSIX `$HOME` token to `~` for the `Show configuration` row only. Runtime is O(p) in path length. No external state is mutated.
4538
4627
  - @param[in] cwd {string} Current working directory.
4539
4628
  - @return {string} `~`-relative or absolute config path display value.
4540
4629
  - @satisfies REQ-162
4541
4630
 
4542
- ### fn `function buildTerminalSettingsMenuChoices(options:` (L287-298)
4631
+ ### fn `function buildTerminalSettingsMenuChoices(options:` (L303-314)
4543
4632
  - @brief Builds the standardized terminal rows appended to every configuration menu.
4544
4633
  - @details Returns the canonical value-less `Reset defaults` row so all configuration menus and descendant selector menus share the same terminal ordering contract without rendering `Save and close`. Runtime is O(1). No external state is mutated.
4545
4634
  - @param[in] options {{ resetDefaultsDescription: string }} Menu-specific terminal-row metadata.
4546
4635
  - @return {PiUsereqSettingsMenuChoice[]} Ordered terminal menu rows.
4547
4636
  - @satisfies REQ-193
4548
4637
 
4549
- ### iface `interface ResetConfirmationChange` (L304-308)
4638
+ ### iface `interface ResetConfirmationChange` (L320-324)
4550
4639
  - @brief Describes one pending reset value change shown in confirmation menus.
4551
4640
  - @details Stores the row label plus its previous and next values so reset-confirmation submenus can expose machine-readable and human-verifiable change previews. The interface is compile-time only and introduces no runtime cost.
4552
4641
 
4553
- ### fn `function formatResetConfirmationValue(previousValue: string, nextValue: string): string` (L317-319)
4642
+ ### fn `function formatResetConfirmationValue(previousValue: string, nextValue: string): string` (L333-335)
4554
4643
  - @brief Formats one reset-confirmation value pair for menu display.
4555
4644
  - @details Serializes the previous and next values into a deterministic `previous -> next` preview string used by confirmation submenus. Runtime is O(n) in combined value length. No external state is mutated.
4556
4645
  - @param[in] previousValue {string} Current persisted value.
4557
4646
  - @param[in] nextValue {string} Candidate default value.
4558
4647
  - @return {string} Rendered preview string.
4559
4648
 
4560
- ### fn `function buildResetConfirmationChoices(` (L329-368)
4649
+ ### fn `function buildResetConfirmationChoices(` (L345-384)
4561
4650
  - @brief Builds the shared settings-menu choices for one reset-confirmation submenu.
4562
4651
  - @details Renders each pending changed value as a disabled preview row, appends explicit approve and abort actions, and falls back to one disabled no-op row when no values would change. Runtime is O(n) in changed-value count. No external state is mutated.
4563
4652
  - @param[in] changes {ResetConfirmationChange[]} Changed-value preview rows.
@@ -4565,7 +4654,7 @@ cost.
4565
4654
  - @param[in] abortDescription {string} Description for the abort action.
4566
4655
  - @return {PiUsereqSettingsMenuChoice[]} Reset-confirmation submenu choices.
4567
4656
 
4568
- ### fn `async function confirmResetChanges(` (L380-393)
4657
+ ### fn `async function confirmResetChanges(` (L396-409)
4569
4658
  - @brief Opens one explicit reset-confirmation submenu.
4570
4659
  - @details Uses the shared settings-menu renderer to show every changed value before reset application and returns `true` only when the user selects the explicit approval action. Runtime depends on user interaction count. Side effects are limited to transient custom-UI rendering.
4571
4660
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -4575,7 +4664,7 @@ cost.
4575
4664
  - @param[in] abortDescription {string} Description for the abort action.
4576
4665
  - @return {Promise<boolean>} `true` when the reset is explicitly approved.
4577
4666
 
4578
- ### fn `function writePersistedProjectConfigToEditor(` (L404-411)
4667
+ ### fn `function writePersistedProjectConfigToEditor(` (L420-427)
4579
4668
  - @brief Writes the already-persisted project configuration file text into the editor.
4580
4669
  - @details Reads the current `.pi-usereq.json` file content from disk after the caller has saved any pending configuration changes and forwards that exact persisted text into the editor. Runtime is O(n) in serialized config size. Side effects include filesystem reads and editor-text mutation.
4581
4670
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -4584,51 +4673,51 @@ cost.
4584
4673
  - @return {void} No return value.
4585
4674
  - @satisfies REQ-031
4586
4675
 
4587
- ### fn `function buildSearchToolSupportedTagGuidelines(): string[]` (L472-476)
4676
+ ### fn `function buildSearchToolSupportedTagGuidelines(): string[]` (L488-492)
4588
4677
  - @brief Builds the supported-tag guidance lines embedded in search-tool registrations.
4589
4678
  - @details Emits one deterministic line per supported language containing its canonical registration label and sorted tag list so downstream agents can specialize requests without invoking the tool first. Runtime is O(l * t log t). No side effects occur.
4590
4679
  - @return {string[]} Supported-tag guidance lines.
4591
4680
 
4592
- ### fn `function buildSearchToolSchemaDescription(scope: FindToolScope): string` (L484-489)
4681
+ ### fn `function buildSearchToolSchemaDescription(scope: FindToolScope): string` (L500-505)
4593
4682
  - @brief Builds the schema description for one search-tool registration.
4594
4683
  - @details Specializes the explicit-file and configured-directory input contracts while documenting the monolithic markdown output channel and minimal execution details shape. Runtime is O(1). No side effects occur.
4595
4684
  - @param[in] scope {FindToolScope} Search-tool scope.
4596
4685
  - @return {string} Parameter-schema description.
4597
4686
 
4598
- ### fn `function buildSearchToolPromptGuidelines(scope: FindToolScope): string[]` (L497-510)
4687
+ ### fn `function buildSearchToolPromptGuidelines(scope: FindToolScope): string[]` (L513-526)
4599
4688
  - @brief Builds the prompt-guideline set for one search-tool registration.
4600
4689
  - @details Encodes scope selection, monolithic markdown output semantics, regex semantics, line-number behavior, tag-filter rules, and the full language-to-tag matrix as stable agent-oriented strings. Runtime is O(l * t log t). No side effects occur.
4601
4690
  - @param[in] scope {FindToolScope} Search-tool scope.
4602
4691
  - @return {string[]} Prompt-guideline strings.
4603
4692
 
4604
- - type `type MonolithicToolRenderResult = {` (L516)
4693
+ - type `type MonolithicToolRenderResult = {` (L532)
4605
4694
  - @brief Describes the monolithic tool-result surface consumed by tool-row renderers.
4606
4695
  - @details Narrows execute-result data to the primary text content block plus the minimal `details.execution` metadata returned by monolithic tool wrappers. The alias is compile-time only and introduces no runtime cost.
4607
- ### fn `function getMonolithicToolText(result: MonolithicToolRenderResult): string` (L533-536)
4696
+ ### fn `function getMonolithicToolText(result: MonolithicToolRenderResult): string` (L549-552)
4608
4697
  - @brief Extracts the primary monolithic text block from one tool result.
4609
4698
  - @details Returns the first text content block when present and falls back to an empty string when the tool emitted no LLM-facing content. Runtime is O(1). No external state is mutated.
4610
4699
  - @param[in] result {MonolithicToolRenderResult} Tool result wrapper.
4611
4700
  - @return {string} Primary monolithic content text.
4612
4701
 
4613
- ### fn `function getMonolithicToolErrorText(result: MonolithicToolRenderResult): string | undefined` (L544-554)
4702
+ ### fn `function getMonolithicToolErrorText(result: MonolithicToolRenderResult): string | undefined` (L560-570)
4614
4703
  - @brief Reads the first residual execution error string from one monolithic tool result.
4615
4704
  - @details Prefers the first `stderr_lines` entry when present and otherwise falls back to the first line of `stderr`. Runtime is O(1) plus first-line split cost. No external state is mutated.
4616
4705
  - @param[in] result {MonolithicToolRenderResult} Tool result wrapper.
4617
4706
  - @return {string | undefined} First residual execution error string.
4618
4707
 
4619
- ### fn `function formatCompactToolArgumentValue(value: unknown): string | undefined` (L562-601)
4708
+ ### fn `function formatCompactToolArgumentValue(value: unknown): string | undefined` (L578-617)
4620
4709
  - @brief Formats one scalar or structural tool argument for compact render summaries.
4621
4710
  - @details Truncates long strings, compresses arrays into short previews, and renders plain object arguments as key indexes so collapsed tool rows stay compact while still exposing the essential invocation shape. Runtime is O(n) in preview size. No external state is mutated.
4622
4711
  - @param[in] value {unknown} Candidate tool argument value.
4623
4712
  - @return {string | undefined} Compact preview string or `undefined` when the value carries no useful summary.
4624
4713
 
4625
- ### fn `function buildCompactToolInvocationText(args: Record<string, unknown> | undefined): string` (L609-620)
4714
+ ### fn `function buildCompactToolInvocationText(args: Record<string, unknown> | undefined): string` (L625-636)
4626
4715
  - @brief Builds the compact invocation summary appended to collapsed tool rows.
4627
4716
  - @details Renders only caller-supplied parameters that have stable, non-empty compact previews and joins them in insertion order so agents can infer how the tool was used without expanding the full result. Runtime is O(n) in argument count and preview size. No external state is mutated.
4628
4717
  - @param[in] args {Record<string, unknown> | undefined} Current tool call arguments.
4629
4718
  - @return {string} Compact invocation summary prefixed with one separating space, or the empty string when no useful preview exists.
4630
4719
 
4631
- ### fn `function summarizeStructuredToolResult(` (L630-645)
4720
+ ### fn `function summarizeStructuredToolResult(` (L646-661)
4632
4721
  - @brief Builds the compact default text for one monolithic tool result row.
4633
4722
  - @details Prefers the tool name, compact invocation preview, and success marker for collapsed rows, and falls back to residual execution diagnostics when the tool failed before completing successfully. Runtime is O(n) in compact argument-preview size. No external state is mutated.
4634
4723
  - @param[in] toolName {string} Registered tool name.
@@ -4636,20 +4725,27 @@ cost.
4636
4725
  - @param[in] args {Record<string, unknown> | undefined} Current tool call arguments.
4637
4726
  - @return {string} Compact single-line summary.
4638
4727
 
4639
- ### fn `function buildStructuredToolRenderResult(toolName: string)` (L654-673)
4728
+ ### fn `function buildStructuredToolRenderResult(toolName: string)` (L670-689)
4640
4729
  - @brief Builds a custom `renderResult` implementation for one monolithic tool.
4641
4730
  - @details Reuses a mutable `Text` component when possible, keeps the default collapsed row compact with essential invocation parameters plus result status, and reveals the full monolithic content only when the tool row is expanded. Runtime is O(n) in expanded content length and compact argument-preview size. No external state is mutated.
4642
4731
  - @param[in] toolName {string} Registered tool name.
4643
4732
  - @return {(result: MonolithicToolRenderResult, options: { expanded?: boolean; isPartial?: boolean }, _theme: unknown, context: { args?: Record<string, unknown>; lastComponent?: unknown }) => Text} Custom result renderer.
4644
4733
  - @satisfies REQ-210
4645
4734
 
4646
- ### fn `function executeMonolithicTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (L681-687)
4735
+ ### fn `function executeMonolithicTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (L697-703)
4647
4736
  - @brief Executes one CLI-style runner for a monolithic agent tool.
4648
4737
  - @details Reuses the standalone tool-runner contract, normalizes thrown failures into `ToolResult`, and wraps the selected stdout or stderr text into the monolithic content channel. Runtime is dominated by the delegated runner. Side effects depend on the selected tool.
4649
4738
  - @param[in] operation {() => ToolResult} Runner callback.
4650
4739
  - @return {ReturnType<typeof buildMonolithicToolExecuteResult>} Monolithic tool execute result.
4651
4740
 
4652
- ### fn `function deliverPromptCommand(` (L698-716)
4741
+ ### fn `function executeStatusTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (L712-741)
4742
+ - @brief Executes one CLI-style runner for a status-only agent tool.
4743
+ - @details Reuses the standalone tool-runner contract, preserves `content[0].text` as the status-only `success` or `error: <diagnostic>` payload, and strips success-path `stdout_lines` so `details.execution` stays limited to the numeric code plus optional residual stderr diagnostics. Runtime is dominated by the delegated runner. Side effects depend on the selected tool.
4744
+ - @param[in] operation {() => ToolResult} Runner callback.
4745
+ - @return {ReturnType<typeof buildMonolithicToolExecuteResult>} Status-only tool execute result.
4746
+ - @satisfies REQ-294, REQ-295, REQ-296
4747
+
4748
+ ### fn `function deliverPromptCommand(` (L752-770)
4653
4749
  - @brief Starts delivery of one rendered prompt into the current active session.
4654
4750
  - @details Prefers the replacement-session `sendUserMessage(...)` helper exposed by `withSession(...)` callbacks after session replacement so post-switch prompt delivery never reuses stale pre-switch session-bound extension objects. Returns the underlying delivery promise without awaiting it so callers can record the `running` workflow transition as soon as prompt handoff is accepted instead of waiting for the full agent turn to complete on runtimes whose async replacement-session helpers resolve only after `agent_end`. When pi later invalidates that replacement-session context during successful prompt-end restoration, the helper suppresses the documented stale-extension-context rejection because the prompt was already accepted and late rethrow would surface a false orchestration failure. Falls back to `pi.sendUserMessage(...)` only for non-replacement flows or runtimes that do not expose replacement-session helpers. Runtime is O(n) in prompt length. Side effects are limited to user-message delivery.
4655
4751
  - @param[in] pi {ExtensionAPI} Handler-scoped extension API instance retained as the fallback dispatcher.
@@ -4658,7 +4754,7 @@ cost.
4658
4754
  - @return {Promise<void>} Promise representing eventual prompt-delivery completion.
4659
4755
  - @satisfies REQ-004, REQ-067, REQ-068, REQ-227, REQ-281
4660
4756
 
4661
- ### fn `function shouldIgnoreLatePromptDeliveryFailure(` (L727-743)
4757
+ ### fn `function shouldIgnoreLatePromptDeliveryFailure(` (L781-797)
4662
4758
  - @brief Detects prompt-delivery failures that can be ignored after prompt ownership has moved past the command handler.
4663
4759
  - @details Matches the documented stale-extension-context runtime error once prompt ownership has already moved beyond command-side preflight. The helper treats the failure as ignorable when the persisted prompt runtime state shows the same execution session as the active prompt run or when the persisted workflow state has already advanced beyond `checking|running`, because rethrowing at that point would incorrectly re-enter command-side abort logic after the prompt was already accepted. Runtime is O(n) in error-message length plus path length. No external state is mutated.
4664
4760
  - @param[in] error {unknown} Candidate prompt-delivery failure.
@@ -4667,7 +4763,7 @@ cost.
4667
4763
  - @return {boolean} `true` when the failure is a late stale-context delivery rejection that MUST be ignored.
4668
4764
  - @satisfies REQ-208, REQ-280, REQ-281, REQ-282
4669
4765
 
4670
- ### fn `function logPromptWorkflowStateChange(` (L756-775)
4766
+ ### fn `function logPromptWorkflowStateChange(` (L810-829)
4671
4767
  - @brief Appends one workflow-state debug entry for a bundled prompt when selected.
4672
4768
  - @details Reuses the shared debug logger so `req-*` command handlers and prompt-end orchestration can record deterministic workflow transitions without duplicating JSON payload shaping. Runtime is O(n) in serialized payload size only when logging is enabled and O(1) otherwise. Side effects include debug-log file writes for matching enabled prompts.
4673
4769
  - @param[in] projectBase {string} Absolute original project base path.
@@ -4678,7 +4774,7 @@ cost.
4678
4774
  - @return {void} No return value.
4679
4775
  - @satisfies REQ-245, REQ-246, REQ-247
4680
4776
 
4681
- ### fn `function logPromptWorkflowEvent(` (L791-811)
4777
+ ### fn `function logPromptWorkflowEvent(` (L845-865)
4682
4778
  - @brief Appends one dedicated prompt workflow debug entry when selected.
4683
4779
  - @details Reuses the shared workflow-event logger so prompt activation, restoration, closure, and session-shutdown paths can emit higher-granularity orchestration diagnostics without duplicating JSON payload shaping. Runtime is O(n) in serialized payload size only when logging is enabled and O(1) otherwise. Side effects include debug-log file writes for matching enabled prompts.
4684
4780
  - @param[in] projectBase {string} Absolute original project base path.
@@ -4692,7 +4788,7 @@ cost.
4692
4788
  - @return {void} No return value.
4693
4789
  - @satisfies REQ-245, REQ-246, REQ-247, REQ-277
4694
4790
 
4695
- ### fn `function transitionPromptWorkflowState(` (L824-837)
4791
+ ### fn `function transitionPromptWorkflowState(` (L878-891)
4696
4792
  - @brief Transitions one prompt workflow state and logs the transition immediately after the state update.
4697
4793
  - @details Captures the previous workflow state, applies the new state through the shared status helper, and appends the gated `workflow_state` debug entry only after the transition has completed. Runtime is O(1). Side effects include status mutation, status-bar rendering, and optional debug-log writes.
4698
4794
  - @param[in] ctx {ExtensionContext | ExtensionCommandContext} Active extension context.
@@ -4703,20 +4799,20 @@ cost.
4703
4799
  - @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
4704
4800
  - @return {void} No return value.
4705
4801
 
4706
- ### fn `function resolvePromptCommandDescription(` (L845-849)
4802
+ ### fn `function resolvePromptCommandDescription(` (L899-903)
4707
4803
  - @brief Resolves the runtime slash-command description for one bundled prompt.
4708
- - @details Reads the bundled prompt front matter, extracts its normalized `description` field, and falls back to the historical generated label when the prompt metadata omits a description. Runtime is O(n) in prompt length. Side effects are limited to filesystem reads.
4804
+ - @details Reads the bundled prompt markdown, extracts the first `# ` heading payload, and falls back to the historical generated label when the prompt omits a level-one heading. Runtime is O(n) in prompt length. Side effects are limited to filesystem reads.
4709
4805
  - @param[in] promptName {import("./core/prompt-command-catalog.js").PromptCommandName} Bundled prompt name.
4710
4806
  - @return {string} Runtime command description.
4711
4807
 
4712
- ### fn `function resolveDebugProjectBase(cwd: string, statusController: PiUsereqStatusController): string` (L858-862)
4808
+ ### fn `function resolveDebugProjectBase(cwd: string, statusController: PiUsereqStatusController): string` (L912-916)
4713
4809
  - @brief Resolves the original project base used for debug-log file writes.
4714
4810
  - @details Prefers the active or pending prompt execution plan so tool-result logging during worktree-backed prompt runs persists into the original repository path instead of transient worktree directories. Runtime is O(1). No external state is mutated.
4715
4811
  - @param[in] cwd {string} Current extension working directory.
4716
4812
  - @param[in] statusController {PiUsereqStatusController} Mutable status controller.
4717
4813
  - @return {string} Absolute original project base path for debug logging.
4718
4814
 
4719
- ### fn `function notifyContextSafely(` (L873-890)
4815
+ ### fn `function notifyContextSafely(` (L927-944)
4720
4816
  - @brief Delivers one best-effort UI notification without failing on stale replacement contexts.
4721
4817
  - @details Attempts to use the supplied extension context for UI notification delivery and suppresses the documented stale-extension-context runtime error raised after session replacement, because prompt-orchestration closure can outlive the context that initiated the switch. Runtime is O(n) in message length. Side effects are limited to user notification delivery when the context is still active.
4722
4818
  - @param[in] ctx {ExtensionContext | ExtensionCommandContext | undefined} Candidate UI context.
@@ -4725,20 +4821,30 @@ cost.
4725
4821
  - @return {boolean} `true` when the notification was delivered and `false` when the context was already stale.
4726
4822
  - @satisfies REQ-280
4727
4823
 
4728
- ### fn `function getPiUsereqStartupTools(pi: ExtensionAPI): ToolInfo[]` (L899-907)
4824
+ ### fn `function rejectNonIdleReqCommand(` (L956-976)
4825
+ - @brief Rejects one non-`idle` req-command invocation and records the workflow error state.
4826
+ - @details Builds a deterministic busy-state diagnostic from the current workflow state, transitions the shared workflow state to `error`, preserves any pending or active prompt execution metadata for later closure handling, emits an error notification, and throws `ReqError`. Bundled prompt commands reuse `transitionPromptWorkflowState(...)` when cached configuration is available so prompt debug logging captures the actual state transition; specialized non-prompt commands fall back to direct status mutation. Runtime is O(1). Side effects include workflow-state mutation, status-bar rendering, optional debug-log writes, and user notification delivery.
4827
+ - @param[in] ctx {ExtensionContext | ExtensionCommandContext} Active extension context.
4828
+ - @param[in] promptName {import("./core/prompt-command-catalog.js").PromptCommandName | undefined} Optional bundled prompt name used for prompt debug logging.
4829
+ - @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
4830
+ - @return {never} This helper always throws a deterministic `ReqError`.
4831
+ - @throws {ReqError} Always throws because non-`idle` req commands are rejected.
4832
+ - @satisfies REQ-224
4833
+
4834
+ ### fn `function getPiUsereqStartupTools(pi: ExtensionAPI): ToolInfo[]` (L985-993)
4729
4835
  - @brief Returns the configurable active-tool inventory visible to the extension.
4730
4836
  - @details Filters runtime tools against the canonical configurable-tool set, keeps only builtin-backed embedded tools, and orders the result by the documented custom/files/embedded/default-disabled grouping. Runtime is O(t log t). No external state is mutated.
4731
4837
  - @param[in] pi {ExtensionAPI} Active extension API instance.
4732
4838
  - @return {ToolInfo[]} Sorted configurable tool descriptors.
4733
4839
  - @satisfies REQ-007, REQ-063, REQ-231, REQ-232
4734
4840
 
4735
- ### fn `function getConfiguredEnabledPiUsereqTools(config: UseReqConfig): string[]` (L915-919)
4841
+ ### fn `function getConfiguredEnabledPiUsereqTools(config: UseReqConfig): string[]` (L1001-1005)
4736
4842
  - @brief Normalizes and returns the configured enabled active tools.
4737
4843
  - @details Reuses repository normalization rules, updates the config object in place, and returns the normalized array. Runtime is O(n) in configured tool count. Side effect: mutates `config["enabled-tools"]`.
4738
4844
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
4739
4845
  - @return {string[]} Normalized enabled tool names.
4740
4846
 
4741
- ### fn `function applyConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig): void` (L929-946)
4847
+ ### fn `function applyConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig): void` (L1015-1032)
4742
4848
  - @brief Applies the configured active-tool enablement to the current session.
4743
4849
  - @details Preserves non-configurable active tools, removes every configurable tool from the active set, then re-adds only configured tools that exist in the current runtime inventory. Runtime is O(t). Side effects include `pi.setActiveTools(...)`.
4744
4850
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -4746,18 +4852,18 @@ cost.
4746
4852
  - @return {void} No return value.
4747
4853
  - @satisfies REQ-009, REQ-064
4748
4854
 
4749
- ### fn `async function handleExtensionStatusEvent(` (L959-1219)
4855
+ ### fn `async function handleExtensionStatusEvent(` (L1045-1316)
4750
4856
  - @brief Handles one intercepted pi lifecycle hook for pi-usereq status updates.
4751
- - @details Applies session-start-specific resource validation, project-config refresh, startup-tool enablement, and selected debug-tool logging before forwarding the originating hook name and payload into the shared `updateExtensionStatus(...)` pipeline. Before `agent_start`, re-verifies any prepared prompt execution session switch. On `agent_end`, dispatches configured command-notify, sound, and prompt-specific Pushover effects, logs dedicated workflow-closure diagnostics, restores the original session-backed `base-path` for every matched worktree-backed completion by reusing persisted replacement-session command contexts when event contexts omit `switchSession()`, merges and deletes the worktree only for matched successful completions, tolerates stale replacement-session notification contexts after session replacement, retains the worktree plus notifies closure failure for interrupted or failed outcomes, logs selected prompt workflow transitions, and transitions workflow state through `merging`, `error`, and `idle` as required. On `session_shutdown`, captures pre-update prompt snapshots so workflow-shutdown diagnostics and same-runtime command continuation preserve the active prompt workflow state across switch-triggered rebinding, then disposes the shared controller. Runtime is dominated by configuration loading during `session_start` and git finalization during matched successful `agent_end` handling; all other hooks are O(1). Side effects include resource checks, active-tool mutation, active-session replacement, status updates, live-ticker disposal on shutdown, optional child-process spawning, outbound HTTPS requests, branch merges, worktree deletion, and optional debug-log writes.
4857
+ - @details Applies session-start-specific resource validation, project-config refresh, startup-tool enablement, and selected debug-tool logging before forwarding the originating hook name and payload into the shared `updateExtensionStatus(...)` pipeline. Before `agent_start`, re-verifies any prepared prompt execution session switch. On `agent_end`, dispatches configured command-notify, sound, and prompt-specific Pushover effects, logs dedicated workflow-closure diagnostics, restores the original session-backed `base-path` for every matched worktree-backed completion by reusing persisted replacement-session command contexts when event contexts omit `switchSession()`, executes the stash-assisted merge-and-delete finalization path for every matched successful worktree-backed completion even when a later busy-command rejection already moved workflow state to `error`, emits a warning-only notification when restored `base-path` changes are reapplied after merge, tolerates stale replacement-session notification contexts after session replacement, retains the worktree plus notifies closure failure for interrupted or failed outcomes, logs selected prompt workflow transitions, and transitions workflow state through `merging`, `error`, and `idle` as required. On `session_shutdown`, captures pre-update prompt snapshots so workflow-shutdown diagnostics and same-runtime command continuation preserve the active prompt workflow state across switch-triggered rebinding, then disposes the shared controller. Runtime is dominated by configuration loading during `session_start` and git finalization during matched successful `agent_end` handling; all other hooks are O(1). Side effects include resource checks, active-tool mutation, active-session replacement, status updates, live-ticker disposal on shutdown, optional child-process spawning, outbound HTTPS requests, branch merges, worktree deletion, and optional debug-log writes.
4752
4858
  - @param[in] pi {ExtensionAPI} Active extension API instance.
4753
4859
  - @param[in] hookName {PiUsereqStatusHookName} Intercepted hook name.
4754
4860
  - @param[in] event {unknown} Hook payload forwarded by pi.
4755
4861
  - @param[in] ctx {ExtensionContext} Active extension context.
4756
4862
  - @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
4757
4863
  - @return {Promise<void>} Promise resolved when hook processing completes.
4758
- - @satisfies REQ-117, REQ-118, REQ-119, REQ-131, REQ-132, REQ-133, REQ-166, REQ-167, REQ-168, REQ-169, REQ-172, REQ-176, REQ-178, REQ-184, REQ-185, REQ-186, REQ-187, REQ-208, REQ-209, REQ-221, REQ-228, REQ-229, REQ-230, REQ-244, REQ-245, REQ-246, REQ-247, REQ-276, REQ-277, REQ-278, REQ-279, REQ-280
4864
+ - @satisfies REQ-117, REQ-118, REQ-119, REQ-131, REQ-132, REQ-133, REQ-166, REQ-167, REQ-168, REQ-169, REQ-172, REQ-176, REQ-178, REQ-184, REQ-185, REQ-186, REQ-187, REQ-208, REQ-209, REQ-221, REQ-228, REQ-229, REQ-230, REQ-244, REQ-245, REQ-246, REQ-247, REQ-276, REQ-277, REQ-278, REQ-279, REQ-280, REQ-291, REQ-292
4759
4865
 
4760
- ### fn `function registerExtensionStatusHooks(` (L1235-1254)
4866
+ ### fn `function registerExtensionStatusHooks(` (L1332-1351)
4761
4867
  - @brief Registers shared wrappers for every supported pi lifecycle hook.
4762
4868
  - @details Installs one generic wrapper per intercepted hook so every resource,
4763
4869
  session, agent, model, tool, bash, and input event is routed through the
@@ -4771,7 +4877,7 @@ registered hook count. Side effects include hook registration.
4771
4877
  - @return {void} No return value.
4772
4878
  - @satisfies DES-002, REQ-113, REQ-114, REQ-115, REQ-116, REQ-117
4773
4879
 
4774
- ### fn `function setConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig, enabledTools: string[]): void` (L1264-1267)
4880
+ ### fn `function setConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig, enabledTools: string[]): void` (L1361-1364)
4775
4881
  - @brief Replaces the configured active-tool selection and applies it immediately.
4776
4882
  - @details Normalizes the requested tool names, stores them in config, and synchronizes the active tool set with runtime registration state. Runtime is O(n + t). Side effect: mutates config and active tools.
4777
4883
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -4779,26 +4885,26 @@ registered hook count. Side effects include hook registration.
4779
4885
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
4780
4886
  - @return {void} No return value.
4781
4887
 
4782
- ### fn `function getDebugToolToggleNames(): PiUsereqStartupToolName[]` (L1275-1277)
4888
+ ### fn `function getDebugToolToggleNames(): PiUsereqStartupToolName[]` (L1372-1374)
4783
4889
  - @brief Returns the canonical debug-tool toggle order.
4784
4890
  - @details Reuses the documented configurable-tool ordering so debug toggles list extension-owned tools before embedded tools and remain deterministic across sessions. Runtime is O(t log t). No external state is mutated.
4785
4891
  - @return {PiUsereqStartupToolName[]} Ordered debug-tool toggle names.
4786
4892
  - @satisfies REQ-242
4787
4893
 
4788
- ### fn `function resetDebugConfigToDefaults(config: UseReqConfig): void` (L1286-1294)
4894
+ ### fn `function resetDebugConfigToDefaults(config: UseReqConfig): void` (L1383-1391)
4789
4895
  - @brief Restores the debug configuration subtree to its documented defaults.
4790
4896
  - @details Resets global debug enablement, log path, workflow-state filter, dedicated workflow-event logging, and selected tool plus prompt debug toggles without mutating unrelated settings. Runtime is O(1). Side effect: mutates `config`.
4791
4897
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
4792
4898
  - @return {void} No return value.
4793
4899
  - @satisfies REQ-236, REQ-237, REQ-238, REQ-239, REQ-195, REQ-277
4794
4900
 
4795
- ### fn `function formatDebugMenuSummary(config: UseReqConfig): string` (L1302-1308)
4901
+ ### fn `function formatDebugMenuSummary(config: UseReqConfig): string` (L1399-1405)
4796
4902
  - @brief Formats the top-level Debug summary value.
4797
4903
  - @details Emits the current global debug mode plus compact selected-tool and selected-prompt counts for right-aligned menu display. Runtime is O(n) in configured selector count. No external state is mutated.
4798
4904
  - @param[in] config {UseReqConfig} Effective project configuration.
4799
4905
  - @return {string} Compact debug summary string.
4800
4906
 
4801
- ### fn `function buildDebugMenuChoice(` (L1318-1331)
4907
+ ### fn `function buildDebugMenuChoice(` (L1415-1428)
4802
4908
  - @brief Builds one debug-menu row with optional disabled styling.
4803
4909
  - @details Applies dim styling and disables selection whenever global debug is off for all rows except the global `Debug` toggle row. Runtime is O(1). No external state is mutated.
4804
4910
  - @param[in] choice {PiUsereqSettingsMenuChoice} Base debug-menu row.
@@ -4806,21 +4912,21 @@ registered hook count. Side effects include hook registration.
4806
4912
  - @return {PiUsereqSettingsMenuChoice} Styled debug-menu row.
4807
4913
  - @satisfies REQ-241
4808
4914
 
4809
- ### fn `async function selectDebugLogOnStatus(` (L1340-1368)
4915
+ ### fn `async function selectDebugLogOnStatus(` (L1437-1465)
4810
4916
  - @brief Opens the workflow-state filter selector used by the Debug submenu.
4811
4917
  - @details Exposes `any` plus each canonical workflow state through the shared settings-menu renderer and returns the selected normalized filter or `undefined` when the user cancels the submenu. Runtime depends on user interaction count. Side effects are limited to transient custom-UI rendering.
4812
4918
  - @param[in] ctx {ExtensionCommandContext} Active command context.
4813
4919
  - @param[in] currentValue {DebugLogOnStatus} Current persisted workflow-state filter.
4814
4920
  - @return {Promise<DebugLogOnStatus | undefined>} Selected workflow-state filter or `undefined` when cancelled.
4815
4921
 
4816
- ### fn `function buildDebugMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L1377-1448)
4922
+ ### fn `function buildDebugMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L1474-1550)
4817
4923
  - @brief Builds the shared settings-menu choices for debug logging configuration.
4818
4924
  - @details Serializes global debug controls plus workflow-state, dedicated workflow-event, per-tool, and per-prompt toggles into one submenu, deriving inventories from the canonical tool and prompt lists and dimming locked rows while debug is disabled. Runtime is O(t + p). No external state is mutated.
4819
4925
  - @param[in] config {UseReqConfig} Effective project configuration.
4820
4926
  - @return {PiUsereqSettingsMenuChoice[]} Ordered debug-menu choices.
4821
4927
  - @satisfies REQ-240, REQ-241, REQ-242, REQ-243, REQ-193, REQ-277
4822
4928
 
4823
- ### fn `async function configureDebugMenu(` (L1458-1575)
4929
+ ### fn `async function configureDebugMenu(` (L1560-1729)
4824
4930
  - @brief Runs the interactive Debug submenu.
4825
4931
  - @details Lets the user toggle global debug enablement, edit debug file and workflow filters, toggle dedicated workflow-event logging, mutate per-tool and per-prompt debug selectors, and restore subtree defaults while preserving row focus across re-renders. Runtime depends on user interaction count. Side effects include UI updates and config mutation.
4826
4932
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -4828,45 +4934,45 @@ registered hook count. Side effects include hook registration.
4828
4934
  - @return {Promise<void>} Promise resolved when the submenu closes.
4829
4935
  - @satisfies REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243, REQ-192, REQ-193, REQ-195, REQ-277
4830
4936
 
4831
- - type `type PiNotifyBooleanConfigKey =` (L1581)
4937
+ - type `type PiNotifyBooleanConfigKey =` (L1735)
4832
4938
  - @brief Represents one persisted boolean notification-setting key.
4833
4939
  - @details Restricts menu toggles to the global enable flags and completed/interrupted/failed event toggles used by command-notify, sound, and Pushover configuration. Compile-time only and introduces no runtime cost.
4834
- - type `type PiNotifyEventBooleanConfigKey = Exclude<` (L1598)
4940
+ - type `type PiNotifyEventBooleanConfigKey = Exclude<` (L1752)
4835
4941
  - @brief Represents one persisted boolean notification event-toggle key.
4836
4942
  - @details Restricts shared event-submenu mutation helpers to completed/interrupted/failed toggles and excludes global enable flags. Compile-time only and introduces no runtime cost.
4837
- - type `type PiNotifyEventId = "completed" | "interrupted" | "failed";` (L1607)
4943
+ - type `type PiNotifyEventId = "completed" | "interrupted" | "failed";` (L1761)
4838
4944
  - @brief Represents one shared prompt-end event identifier used by notification menus.
4839
4945
  - @details Restricts event-submenu rendering to the canonical completed/interrupted/failed domain shared by command-notify, sound, and Pushover routing. Compile-time only and introduces no runtime cost.
4840
- ### iface `interface PiNotifyEventRowDefinition` (L1613-1617)
4946
+ ### iface `interface PiNotifyEventRowDefinition` (L1767-1771)
4841
4947
  - @brief Describes one shared prompt-end event row rendered inside notification event submenus.
4842
4948
  - @details Binds one canonical event identifier to the human-readable label and terminal-outcome description reused across command-notify, sound, and Pushover event menus. The interface is compile-time only and introduces no runtime cost.
4843
4949
 
4844
- ### iface `interface PiNotifyEventMenuDefinition` (L1623-1629)
4950
+ ### iface `interface PiNotifyEventMenuDefinition` (L1777-1783)
4845
4951
  - @brief Describes one notification-system event submenu contract.
4846
4952
  - @details Binds the top-level launcher row, submenu title, toast prefix, and completed/interrupted/failed config keys for one notification transport. The interface is compile-time only and introduces no runtime cost.
4847
4953
 
4848
- ### fn `function togglePiNotifyFlag(config: UseReqConfig, key: PiNotifyBooleanConfigKey): boolean` (L1638-1641)
4954
+ ### fn `function togglePiNotifyFlag(config: UseReqConfig, key: PiNotifyBooleanConfigKey): boolean` (L1792-1795)
4849
4955
  - @brief Flips one persisted boolean notification setting.
4850
4956
  - @details Negates the selected configuration flag in place and returns the resulting boolean value so callers can emit deterministic UI feedback. Runtime is O(1). Side effect: mutates `config`.
4851
4957
  - @param[in] key {PiNotifyBooleanConfigKey} Boolean configuration key to toggle.
4852
4958
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
4853
4959
  - @return {boolean} Next enabled state.
4854
4960
 
4855
- ### fn `function resetPiNotifyConfigToDefaults(config: UseReqConfig): void` (L1650-1674)
4961
+ ### fn `function resetPiNotifyConfigToDefaults(config: UseReqConfig): void` (L1804-1828)
4856
4962
  - @brief Restores notification-related settings to their documented defaults.
4857
4963
  - @details Copies the command-notify, sound, and Pushover configuration subtree from a fresh default config into the supplied mutable project config. Runtime is O(1). Side effect: mutates `config`.
4858
4964
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
4859
4965
  - @return {void} No return value.
4860
4966
  - @satisfies REQ-174, REQ-178, REQ-184, REQ-195, REQ-196
4861
4967
 
4862
- ### fn `function formatPiNotifyPushoverPriority(priority: PiNotifyPushoverPriority): string` (L1683-1685)
4968
+ ### fn `function formatPiNotifyPushoverPriority(priority: PiNotifyPushoverPriority): string` (L1837-1839)
4863
4969
  - @brief Formats one persisted Pushover priority for menu display.
4864
4970
  - @details Maps the canonical `0|1` priority domain to deterministic `Normal|High` labels reused by the Pushover configuration UI. Runtime is O(1). No external state is mutated.
4865
4971
  - @param[in] priority {PiNotifyPushoverPriority} Persisted Pushover priority.
4866
4972
  - @return {string} Menu-display label.
4867
4973
  - @satisfies REQ-172
4868
4974
 
4869
- ### fn `function formatPiNotifyEventMenuSummary(` (L1762-1770)
4975
+ ### fn `function formatPiNotifyEventMenuSummary(` (L1923-1931)
4870
4976
  - @brief Formats the top-level summary value for one notification event submenu.
4871
4977
  - @details Counts enabled completed/interrupted/failed toggles for the selected transport and renders the result as `n/3 on` for right-aligned menu display. Runtime is O(1). No external state is mutated.
4872
4978
  - @param[in] config {UseReqConfig} Effective project configuration.
@@ -4874,7 +4980,7 @@ registered hook count. Side effects include hook registration.
4874
4980
  - @return {string} Compact enabled-toggle summary.
4875
4981
  - @satisfies REQ-198
4876
4982
 
4877
- ### fn `function buildPiNotifyEventLauncherChoice(` (L1780-1790)
4983
+ ### fn `function buildPiNotifyEventLauncherChoice(` (L1941-1951)
4878
4984
  - @brief Builds the top-level launcher row for one notification event submenu.
4879
4985
  - @details Reuses the shared completed/interrupted/failed summary renderer so the `Notifications` menu can expose dedicated event editors for command-notify, sound, and Pushover in a uniform shape. Runtime is O(1). No external state is mutated.
4880
4986
  - @param[in] config {UseReqConfig} Effective project configuration.
@@ -4882,7 +4988,7 @@ registered hook count. Side effects include hook registration.
4882
4988
  - @return {PiUsereqSettingsMenuChoice} Launcher row for the selected event submenu.
4883
4989
  - @satisfies REQ-181, REQ-183, REQ-165, REQ-198
4884
4990
 
4885
- ### fn `function buildPiNotifyEventMenuChoices(` (L1800-1815)
4991
+ ### fn `function buildPiNotifyEventMenuChoices(` (L1961-1977)
4886
4992
  - @brief Builds the shared settings-menu choices for one notification event submenu.
4887
4993
  - @details Serializes completed/interrupted/failed rows with right-aligned `on|off` values, then appends a value-less `Reset defaults` row for submenu-scoped mutation control. Runtime is O(1). No external state is mutated.
4888
4994
  - @param[in] config {UseReqConfig} Effective project configuration.
@@ -4890,7 +4996,7 @@ registered hook count. Side effects include hook registration.
4890
4996
  - @return {PiUsereqSettingsMenuChoice[]} Ordered event-submenu choice vector.
4891
4997
  - @satisfies REQ-188, REQ-193, REQ-198
4892
4998
 
4893
- ### fn `function resetPiNotifyEventMenuToDefaults(` (L1825-1833)
4999
+ ### fn `function resetPiNotifyEventMenuToDefaults(` (L1987-1995)
4894
5000
  - @brief Restores one notification event submenu to its documented defaults.
4895
5001
  - @details Copies only the completed/interrupted/failed toggles referenced by the supplied submenu contract from a fresh default config into the mutable project config. Runtime is O(1). Side effect: mutates `config`.
4896
5002
  - @param[in] eventMenu {PiNotifyEventMenuDefinition} Notification-system event submenu contract.
@@ -4898,7 +5004,7 @@ registered hook count. Side effects include hook registration.
4898
5004
  - @return {void} No return value.
4899
5005
  - @satisfies REQ-174, REQ-178, REQ-184, REQ-195
4900
5006
 
4901
- ### fn `function resolvePiNotifyEventLabel(` (L1843-1850)
5007
+ ### fn `function resolvePiNotifyEventLabel(` (L2005-2012)
4902
5008
  - @brief Resolves the human-readable event label for one event-toggle config key.
4903
5009
  - @details Matches the supplied config key against the submenu contract and returns the corresponding completed/interrupted/failed menu label for deterministic notification toasts. Runtime is O(1). No external state is mutated.
4904
5010
  - @param[in] key {PiNotifyEventBooleanConfigKey} Event-toggle configuration key.
@@ -4906,7 +5012,7 @@ registered hook count. Side effects include hook registration.
4906
5012
  - @return {string} Human-readable event label.
4907
5013
  - @satisfies REQ-188, REQ-198
4908
5014
 
4909
- ### fn `async function configurePiNotifyEventMenu(` (L1861-1921)
5015
+ ### fn `async function configurePiNotifyEventMenu(` (L2023-2099)
4910
5016
  - @brief Runs one dedicated notification event submenu.
4911
5017
  - @details Reuses the shared settings-menu renderer to toggle completed/interrupted/failed delivery flags, preserve row focus, and apply submenu-scoped reset semantics for command-notify, sound, or Pushover events. Runtime depends on user interaction count. Side effects include UI updates and config mutation.
4912
5018
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -4915,14 +5021,14 @@ registered hook count. Side effects include hook registration.
4915
5021
  - @return {Promise<void>} Promise resolved when the submenu closes.
4916
5022
  - @satisfies REQ-188, REQ-192, REQ-193, REQ-195, REQ-198
4917
5023
 
4918
- ### fn `function buildPiNotifyPushoverRows(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L1930-1979)
5024
+ ### fn `function buildPiNotifyPushoverRows(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2108-2158)
4919
5025
  - @brief Builds the direct Pushover rows rendered inside `Notifications`.
4920
- - @details Serializes the global enable flag, shared-event submenu launcher, priority, title, text, and credential rows into right-valued menu items appended after the sound-command rows, dims and disables the enable row until both credentials are populated, and escapes control characters for the single-line `Pushover text` value. Runtime is O(n) in the rendered text-template length. No external state is mutated.
5026
+ - @details Serializes the global enable flag, shared-event submenu launcher, priority, title, text, and credential rows into right-valued menu items appended after the sound-command rows, dims and disables the enable row until both credentials are populated, renders the locked value as `configure user/token keys first`, and escapes control characters for the single-line `Pushover text` value. Runtime is O(n) in the rendered text-template length. No external state is mutated.
4921
5027
  - @param[in] config {UseReqConfig} Effective project configuration.
4922
5028
  - @return {PiUsereqSettingsMenuChoice[]} Ordered direct Pushover rows.
4923
5029
  - @satisfies REQ-163, REQ-165, REQ-172, REQ-184, REQ-185, REQ-198, REQ-234, REQ-235
4924
5030
 
4925
- ### fn `async function selectPiNotifyPushoverPriority(` (L1989-2017)
5031
+ ### fn `async function selectPiNotifyPushoverPriority(` (L2168-2196)
4926
5032
  - @brief Opens the shared settings-menu selector for Pushover priority.
4927
5033
  - @details Reuses the pi-usereq settings-menu renderer so Pushover priority selection remains stylistically aligned with the notification menus and appends a value-less subtree-local `Reset defaults` row. Runtime depends on user interaction count. Side effects are limited to transient custom-UI rendering.
4928
5034
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -4930,58 +5036,82 @@ registered hook count. Side effects include hook registration.
4930
5036
  - @return {Promise<PiNotifyPushoverPriority | "reset-defaults" | undefined>} Selected priority, reset action, or `undefined` when cancelled.
4931
5037
  - @satisfies REQ-172, REQ-192
4932
5038
 
4933
- ### fn `function buildPiNotifyMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2026-2083)
5039
+ ### fn `function buildPiNotifyMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2205-2263)
4934
5040
  - @brief Builds the shared settings-menu choices for notification configuration.
4935
- - @details Serializes command-notify, sound, and Pushover blocks with dedicated shared-event submenu launchers so the settings-menu renderer can expose one unified but modular configuration surface, including locked Pushover enablement and escaped single-line rendering for `Pushover text`. Runtime is O(n) in the longest rendered command or text field. No external state is mutated.
5041
+ - @details Serializes command-notify, sound, and Pushover blocks with dedicated shared-event submenu launchers so the settings-menu renderer can expose one unified but modular configuration surface, including locked Pushover enablement, persisted boot-sound rows that stay decoupled from the active runtime sound level, and escaped single-line rendering for `Pushover text`. Runtime is O(n) in the longest rendered command or text field. No external state is mutated.
4936
5042
  - @param[in] config {UseReqConfig} Effective project configuration.
4937
5043
  - @return {PiUsereqSettingsMenuChoice[]} Ordered notification-menu choice vector.
4938
- - @satisfies REQ-137, REQ-149, REQ-150, REQ-151, REQ-152, REQ-163, REQ-164, REQ-165, REQ-172, REQ-179, REQ-181, REQ-183, REQ-188, REQ-193, REQ-198, REQ-234, REQ-235
5044
+ - @satisfies REQ-137, REQ-149, REQ-150, REQ-151, REQ-152, REQ-163, REQ-164, REQ-165, REQ-172, REQ-179, REQ-181, REQ-183, REQ-188, REQ-193, REQ-198, REQ-234, REQ-235, REQ-289
4939
5045
 
4940
- ### fn `async function selectPiNotifySoundLevel(` (L2093-2133)
4941
- - @brief Opens the shared settings-menu selector for the active sound level.
4942
- - @details Reuses the pi-usereq settings-menu renderer so sound-level selection remains stylistically aligned with the notification menu and appends a value-less subtree-local `Reset defaults` row. Runtime depends on user interaction count. Side effects are limited to transient custom-UI rendering.
5046
+ ### fn `async function selectPiNotifySoundLevel(` (L2273-2313)
5047
+ - @brief Opens the shared settings-menu selector for the persisted boot sound level.
5048
+ - @details Reuses the pi-usereq settings-menu renderer so boot-sound selection remains stylistically aligned with the notification menu, keeps the active runtime sound level unchanged, and appends a value-less subtree-local `Reset defaults` row. Runtime depends on user interaction count. Side effects are limited to transient custom-UI rendering.
4943
5049
  - @param[in] ctx {ExtensionCommandContext} Active command context.
4944
- - @param[in] currentLevel {PiNotifySoundLevel} Currently selected sound level.
4945
- - @return {Promise<PiNotifySoundLevel | "reset-defaults" | undefined>} Selected sound level, reset action, or `undefined` when cancelled.
4946
- - @satisfies REQ-131, REQ-179, REQ-192
5050
+ - @param[in] currentLevel {PiNotifySoundLevel} Persisted boot sound level.
5051
+ - @return {Promise<PiNotifySoundLevel | "reset-defaults" | undefined>} Selected boot sound level, reset action, or `undefined` when cancelled.
5052
+ - @satisfies REQ-131, REQ-179, REQ-192, REQ-289
4947
5053
 
4948
- ### fn `async function configurePiNotifyMenu(` (L2143-2409)
5054
+ ### fn `async function configurePiNotifyMenu(` (L2323-2609)
4949
5055
  - @brief Runs the interactive notification-configuration menu.
4950
- - @details Exposes command-notify, sound, and Pushover controls through the shared settings-menu renderer, delegates completed/interrupted/failed toggles to dedicated event submenus, keeps `Enable pushover` locked until both credentials are populated, decodes escaped control-sequence input for `Pushover text`, and preserves row focus across menu re-renders. Runtime depends on user interaction count. Side effects include UI updates and config mutation.
5056
+ - @details Exposes command-notify, sound, and Pushover controls through the shared settings-menu renderer, delegates completed/interrupted/failed toggles to dedicated event submenus, persists boot-sound changes without altering the active runtime sound level, keeps `Enable pushover` locked until both credentials are populated, decodes escaped control-sequence input for `Pushover text`, and preserves row focus across menu re-renders. Runtime depends on user interaction count. Side effects include UI updates and config mutation.
4951
5057
  - @param[in] ctx {ExtensionCommandContext} Active command context.
4952
5058
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
4953
5059
  - @return {Promise<boolean>} `true` when the sound-toggle shortcut changed.
4954
- - @satisfies REQ-131, REQ-133, REQ-134, REQ-137, REQ-163, REQ-164, REQ-165, REQ-172, REQ-179, REQ-181, REQ-183, REQ-184, REQ-188, REQ-192, REQ-193, REQ-195, REQ-196, REQ-198, REQ-234, REQ-235
5060
+ - @satisfies REQ-131, REQ-133, REQ-134, REQ-137, REQ-163, REQ-164, REQ-165, REQ-172, REQ-179, REQ-181, REQ-183, REQ-184, REQ-188, REQ-192, REQ-193, REQ-195, REQ-196, REQ-198, REQ-234, REQ-235, REQ-288, REQ-289
4955
5061
 
4956
- ### fn `function registerPiNotifyShortcut(` (L2424-2444)
5062
+ ### fn `function registerPiNotifyShortcut(` (L2624-2647)
4957
5063
  - @brief Registers the configurable notification-sound shortcut when supported.
4958
5064
  - @details Loads the current project config, registers one raw pi shortcut when
4959
- the runtime exposes `registerShortcut(...)`, cycles persisted sound state on
4960
- invocation, saves the config, refreshes the status bar, and emits one info
4961
- notification. Runtime is O(1) for registration plus config I/O per shortcut
4962
- use. Side effects include shortcut registration, config writes, and status
4963
- updates.
5065
+ the runtime exposes `registerShortcut(...)`, cycles only the active runtime
5066
+ sound level on invocation, leaves `.pi-usereq.json` unchanged, refreshes the
5067
+ status bar, and emits one info notification. Runtime is O(1) for registration
5068
+ plus one status update per shortcut use. Side effects include shortcut
5069
+ registration and status updates.
5070
+ - @param[in] pi {ExtensionAPI} Active extension API instance.
5071
+ - @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
5072
+ - @return {void} No return value.
5073
+ - @satisfies REQ-134, REQ-180, REQ-286, REQ-287
5074
+
5075
+ ### fn `function resolveReqResetPromptRequest(` (L2655-2681)
5076
+ - @brief Resolves the prompt execution plan targeted by `req-reset` recovery.
5077
+ - @details Prefers the current in-memory active request, then the current in-memory pending request, then the process-scoped persisted prompt runtime state so the dedicated reset command can recover from same-host unclean prompt termination after session replacement. Runtime is O(1). No external state is mutated.
5078
+ - @param[in] statusController {PiUsereqStatusController} Mutable status controller.
5079
+ - @return {PromptCommandExecutionPlan | undefined} Recoverable prompt execution plan when one remains available.
5080
+
5081
+ ### fn `const isWorktreeBacked = (request: PromptCommandExecutionPlan | undefined): request is PromptCommandExecutionPlan =>` (L2658-2665)
5082
+
5083
+ ### fn `function registerReqResetCommand(` (L2691-2745)
5084
+ - @brief Registers the specialized `req-reset` slash command.
5085
+ - @details Registers the non-agentic prompt-recovery command that accepts any current workflow state, reuses persisted prompt runtime state when available, restores the original session-backed `base-path`, force-removes matching generated worktrees plus branches, clears recoverable prompt state when restoration succeeds, and notifies pi without starting an LLM session or creating a worktree. Runtime is dominated by session restoration plus git cleanup. Side effects include command registration, status-controller mutation, active-session replacement, worktree deletion, branch deletion, and user notifications.
5086
+ - @param[in] pi {ExtensionAPI} Active extension API instance.
5087
+ - @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
5088
+ - @return {void} No return value.
5089
+ - @satisfies REQ-304, REQ-305, REQ-306, REQ-307, REQ-308, REQ-309, REQ-310, REQ-311, REQ-312, REQ-313
5090
+
5091
+ ### fn `function registerReqReferencesCommand(` (L2755-2795)
5092
+ - @brief Registers the specialized `req-references` slash command.
5093
+ - @details Registers the non-agentic references-maintenance command that rejects non-`idle` invocations by transitioning workflow state to `error` before direct execution, otherwise reuses slash-command-owned git validation, transitions workflow state through `checking|running|idle`, regenerates `REFERENCES.md` directly from configured source directories, stages only the generated file, creates the fixed-message git commit, verifies repository cleanliness, and notifies pi without starting an LLM session or creating a worktree. Runtime is dominated by git subprocess execution plus source-summary generation. Side effects include command registration, status-controller mutation, filesystem writes, git index/history mutation, and user notifications.
4964
5094
  - @param[in] pi {ExtensionAPI} Active extension API instance.
4965
5095
  - @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
4966
5096
  - @return {void} No return value.
4967
- - @satisfies REQ-131, REQ-134, REQ-180
5097
+ - @satisfies REQ-200, REQ-221, REQ-224, REQ-298, REQ-299, REQ-300, REQ-301, REQ-302, REQ-303
4968
5098
 
4969
- ### fn `function registerPromptCommands(` (L2454-2572)
4970
- - @brief Registers bundled prompt commands with the extension.
4971
- - @details Creates one `req-<prompt>` command per bundled prompt name. Each handler rejects non-`idle` workflow state, transitions the shared workflow state through `checking`, `error`, and `running`, runs dedicated prompt-command git and required-doc preflight checks, optionally prepares a dedicated worktree execution plan using the active session directory, persists the prompt metadata needed for switch-triggered rebinding, switches the active session to the verified execution cwd before prompt handoff, logs dedicated workflow-activation diagnostics, renders the prompt, starts prompt delivery into the forked active session, records `running` immediately after delivery handoff begins, and then awaits the wrapped prompt-delivery promise whose stale post-restore rejections are suppressed. Runtime is O(p) for registration; handler cost depends on prompt preflight, worktree preparation, session switching, prompt rendering, prompt dispatch, and optional debug logging. Side effects include command registration, status-controller mutation, worktree creation, active-session replacement, optional worktree rollback, user-message delivery during execution, and optional debug-log writes.
5099
+ ### fn `function registerPromptCommands(` (L2805-2921)
5100
+ - @brief Registers bundled prompt-backed commands with the extension.
5101
+ - @details Creates one prompt-template-backed `req-<prompt>` command per bundled prompt name. Each handler rejects non-`idle` workflow state by transitioning the shared workflow state to `error` before command-side preflight, otherwise transitions the shared workflow state through `checking`, `error`, and `running`, runs dedicated prompt-command git and required-doc preflight checks, optionally prepares a dedicated worktree execution plan using the active session directory, persists the prompt metadata needed for switch-triggered rebinding, switches the active session to the verified execution cwd before prompt handoff, logs dedicated workflow-activation diagnostics, renders the prompt, starts prompt delivery into the forked active session, records `running` immediately after delivery handoff begins, and then awaits the wrapped prompt-delivery promise whose stale post-restore rejections are suppressed. Runtime is O(p) for registration; handler cost depends on prompt preflight, worktree preparation, session switching, prompt rendering, prompt dispatch, and optional debug logging. Side effects include command registration, status-controller mutation, worktree creation, active-session replacement, optional worktree rollback, user-message delivery during execution, and optional debug-log writes.
4972
5102
  - @param[in] pi {ExtensionAPI} Active extension API instance.
4973
5103
  - @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
4974
5104
  - @return {void} No return value.
4975
5105
  - @satisfies REQ-004, REQ-067, REQ-068, REQ-169, REQ-200, REQ-201, REQ-202, REQ-203, REQ-206, REQ-207, REQ-219, REQ-220, REQ-221, REQ-224, REQ-225, REQ-226, REQ-227, REQ-245, REQ-246, REQ-247, REQ-277, REQ-281
4976
5106
 
4977
- ### fn `function registerAgentTools(pi: ExtensionAPI): void` (L2582-2881)
5107
+ ### fn `function registerAgentTools(pi: ExtensionAPI): void` (L2931-3230)
4978
5108
  - @brief Registers pi-usereq agent tools exposed to the model.
4979
5109
  - @details Defines the tool schemas, prompt metadata, and execution handlers that bridge extension tool calls into tool-runner operations without registering duplicate custom slash commands for the same capabilities. Runtime is O(t) for registration; execution cost depends on the selected tool. Side effects include tool registration.
4980
5110
  - @param[in] pi {ExtensionAPI} Active extension API instance.
4981
5111
  - @return {void} No return value.
4982
- - @satisfies REQ-005, REQ-010, REQ-011, REQ-014, REQ-017, REQ-044, REQ-069, REQ-070, REQ-071, REQ-072, REQ-073, REQ-074, REQ-075, REQ-076, REQ-077, REQ-078, REQ-079, REQ-080, REQ-089, REQ-090, REQ-091, REQ-092, REQ-093, REQ-094, REQ-095, REQ-096, REQ-097, REQ-098, REQ-099, REQ-100, REQ-101, REQ-102
5112
+ - @satisfies REQ-005, REQ-010, REQ-011, REQ-014, REQ-017, REQ-044, REQ-069, REQ-070, REQ-071, REQ-072, REQ-073, REQ-074, REQ-075, REQ-076, REQ-077, REQ-078, REQ-079, REQ-080, REQ-089, REQ-090, REQ-091, REQ-092, REQ-093, REQ-094, REQ-095, REQ-096, REQ-097, REQ-098, REQ-099, REQ-100, REQ-101, REQ-102, REQ-293, REQ-294, REQ-295, REQ-296, REQ-297
4983
5113
 
4984
- ### fn `function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2899-2924)
5114
+ ### fn `function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3275-3300)
4985
5115
  - @brief Builds the shared settings-menu choices for startup-tool management.
4986
5116
  - @details Serializes startup-tool actions into right-valued menu rows consumed by the shared settings-menu renderer while omitting the removed status-reference action. Runtime is O(t) in configurable-tool count. No external state is mutated.
4987
5117
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -4989,7 +5119,7 @@ updates.
4989
5119
  - @return {PiUsereqSettingsMenuChoice[]} Ordered startup-tool menu choices.
4990
5120
  - @satisfies REQ-007, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193
4991
5121
 
4992
- ### fn `function buildPiUsereqToolToggleChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2934-2947)
5122
+ ### fn `function buildPiUsereqToolToggleChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3310-3324)
4993
5123
  - @brief Builds the shared settings-menu choices for per-tool startup toggles.
4994
5124
  - @details Exposes every configurable startup tool as one row whose right-side value reports the current enabled state, preserves the documented custom/files/embedded/default-disabled ordering, and appends a value-less subtree-local `Reset defaults` row. Runtime is O(t) in configurable-tool count. No external state is mutated.
4995
5125
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -4997,7 +5127,7 @@ updates.
4997
5127
  - @return {PiUsereqSettingsMenuChoice[]} Ordered per-tool toggle choices.
4998
5128
  - @satisfies REQ-007, REQ-151, REQ-152, REQ-153, REQ-154, REQ-231, REQ-232
4999
5129
 
5000
- ### fn `async function configurePiUsereqToolsMenu(` (L2958-3053)
5130
+ ### fn `async function configurePiUsereqToolsMenu(` (L3335-3452)
5001
5131
  - @brief Runs the interactive active-tool configuration menu.
5002
5132
  - @details Synchronizes runtime active tools with persisted config, renders startup-tool actions through the shared settings-menu UI, preserves the documented per-tool ordering, and updates configuration state in response to selections until the user exits. Runtime depends on user interaction count. Side effects include UI updates, active-tool changes, and config mutation.
5003
5133
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5006,58 +5136,58 @@ updates.
5006
5136
  - @return {Promise<void>} Promise resolved when the menu closes.
5007
5137
  - @satisfies REQ-007, REQ-063, REQ-064, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193, REQ-231, REQ-232
5008
5138
 
5009
- ### fn `function getStaticCheckLanguageConfigForMenu(` (L3062-3067)
5139
+ ### fn `function getStaticCheckLanguageConfigForMenu(` (L3461-3466)
5010
5140
  - @brief Resolves one static-check language config for menu rendering.
5011
5141
  - @details Returns the configured per-language static-check object when present and otherwise synthesizes a disabled empty-language object so menu code can render all supported languages deterministically. Runtime is O(1). No external state is mutated.
5012
5142
  - @param[in] config {UseReqConfig} Effective project configuration.
5013
5143
  - @param[in] language {string} Canonical language name.
5014
5144
  - @return {StaticCheckLanguageConfig} Resolved per-language config object.
5015
5145
 
5016
- ### fn `function countConfiguredStaticCheckLanguages(config: UseReqConfig): number` (L3075-3077)
5146
+ ### fn `function countConfiguredStaticCheckLanguages(config: UseReqConfig): number` (L3474-3476)
5017
5147
  - @brief Counts languages that currently expose at least one configured checker.
5018
5148
  - @details Treats configured-but-disabled languages as configured when their checker list is non-empty so removal actions remain deterministic. Runtime is O(l). No external state is mutated.
5019
5149
  - @param[in] config {UseReqConfig} Effective project configuration.
5020
5150
  - @return {number} Number of languages with at least one configured checker.
5021
5151
 
5022
- ### fn `function countEnabledStaticCheckLanguages(config: UseReqConfig): number` (L3085-3087)
5152
+ ### fn `function countEnabledStaticCheckLanguages(config: UseReqConfig): number` (L3484-3486)
5023
5153
  - @brief Counts languages whose static-check enable flag is on.
5024
5154
  - @details Counts only languages whose persisted per-language config explicitly sets `enabled=enable`, regardless of checker count. Runtime is O(l). No external state is mutated.
5025
5155
  - @param[in] config {UseReqConfig} Effective project configuration.
5026
5156
  - @return {number} Number of enabled languages.
5027
5157
 
5028
- ### fn `function resetStaticCheckConfig(config: UseReqConfig): void` (L3096-3098)
5158
+ ### fn `function resetStaticCheckConfig(config: UseReqConfig): void` (L3495-3497)
5029
5159
  - @brief Restores the documented static-check default configuration.
5030
5160
  - @details Replaces the mutable config subtree with a fresh clone of the documented per-language defaults so menu reset actions restore both enable flags and checker lists in one step. Runtime is O(l + c). Side effect: mutates `config`.
5031
5161
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
5032
5162
  - @return {void} No return value.
5033
5163
  - @satisfies REQ-250, REQ-251, REQ-252
5034
5164
 
5035
- ### fn `function formatStaticCheckLanguagesSummary(config: UseReqConfig): string` (L3106-3108)
5165
+ ### fn `function formatStaticCheckLanguagesSummary(config: UseReqConfig): string` (L3505-3507)
5036
5166
  - @brief Summarizes enabled and configured static-check languages.
5037
5167
  - @details Counts enabled languages and languages with at least one checker, then emits one compact summary string suitable for the top-level configuration menu. Runtime is O(l). No external state is mutated.
5038
5168
  - @param[in] config {UseReqConfig} Effective project configuration.
5039
5169
  - @return {string} Compact summary string.
5040
5170
 
5041
- ### fn `function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3117-3148)
5171
+ ### fn `function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3516-3548)
5042
5172
  - @brief Builds the shared settings-menu choices for static-check management.
5043
5173
  - @details Serializes guided Command-oriented add and remove actions, renders one direct on/off toggle row for every supported language, and appends canonical terminal rows while omitting raw-spec and reference-only actions. Runtime is O(l). No external state is mutated.
5044
5174
  - @param[in] config {UseReqConfig} Effective project configuration.
5045
5175
  - @return {PiUsereqSettingsMenuChoice[]} Ordered static-check menu choices.
5046
5176
  - @satisfies REQ-008, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-248
5047
5177
 
5048
- ### fn `function buildSupportedStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3156-3173)
5178
+ ### fn `function buildSupportedStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3556-3573)
5049
5179
  - @brief Builds the shared settings-menu choices for supported static-check languages.
5050
5180
  - @details Exposes every supported language as one row whose right-side value reports extensions, enablement, and configured checker count for guided Command configuration flows, then appends subtree-local terminal rows. Runtime is O(l). No external state is mutated.
5051
5181
  - @param[in] config {UseReqConfig} Effective project configuration.
5052
5182
  - @return {PiUsereqSettingsMenuChoice[]} Ordered language-choice vector.
5053
5183
 
5054
- ### fn `function buildConfiguredStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3181-3198)
5184
+ ### fn `function buildConfiguredStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3581-3598)
5055
5185
  - @brief Builds the shared settings-menu choices for configured static-check languages.
5056
5186
  - @details Exposes only languages whose checker lists are non-empty so removal remains deterministic, then appends subtree-local terminal rows. Runtime is O(l). No external state is mutated.
5057
5187
  - @param[in] config {UseReqConfig} Effective project configuration.
5058
5188
  - @return {PiUsereqSettingsMenuChoice[]} Ordered configured-language vector.
5059
5189
 
5060
- ### fn `async function configureStaticCheckMenu(` (L3208-3341)
5190
+ ### fn `async function configureStaticCheckMenu(` (L3608-3754)
5061
5191
  - @brief Runs the interactive static-check configuration menu.
5062
5192
  - @details Lets the user add Command entries by guided prompts, remove configured language entries, toggle direct per-language enable flags, and reset the subtree to documented defaults through the shared settings-menu renderer until the user exits. Runtime depends on user interaction count. Side effects include UI updates and config mutation.
5063
5193
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -5065,7 +5195,7 @@ updates.
5065
5195
  - @return {Promise<void>} Promise resolved when the menu closes.
5066
5196
  - @satisfies REQ-008, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-195, REQ-248, REQ-253
5067
5197
 
5068
- ### fn `function buildPiUsereqMenuChoices(` (L3351-3440)
5198
+ ### fn `function buildPiUsereqMenuChoices(` (L3764-3856)
5069
5199
  - @brief Builds the shared settings-menu choices for the top-level pi-usereq configuration UI.
5070
5200
  - @details Serializes primary configuration actions into right-valued menu rows consumed by the shared settings-menu renderer, including automatic git-commit mode, effective prompt-command worktree state, notification summary, debug summary, locked worktree rows when automatic git commit is disabled, and the display-only config path beside `show-config`. Runtime is O(s) in source-directory count. No external state is mutated.
5071
5201
  - @param[in] cwd {string} Current working directory.
@@ -5073,21 +5203,21 @@ updates.
5073
5203
  - @return {PiUsereqSettingsMenuChoice[]} Ordered top-level menu choices.
5074
5204
  - @satisfies REQ-006, REQ-031, REQ-137, REQ-150, REQ-151, REQ-152, REQ-162, REQ-190, REQ-191, REQ-197, REQ-204, REQ-205, REQ-212, REQ-215, REQ-216, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240
5075
5205
 
5076
- ### fn `function buildSrcDirMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3449-3467)
5206
+ ### fn `function buildSrcDirMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3865-3883)
5077
5207
  - @brief Builds the shared settings-menu choices for source-directory management.
5078
5208
  - @details Exposes add and remove actions for `src-dir` entries through right-valued menu rows consumed by the shared settings-menu renderer. Runtime is O(s) in source-directory count. No external state is mutated.
5079
5209
  - @param[in] config {UseReqConfig} Effective project configuration.
5080
5210
  - @return {PiUsereqSettingsMenuChoice[]} Ordered source-directory management choices.
5081
5211
  - @satisfies REQ-006, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193
5082
5212
 
5083
- ### fn `function buildSrcDirRemovalChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3476-3488)
5213
+ ### fn `function buildSrcDirRemovalChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3892-3904)
5084
5214
  - @brief Builds the shared settings-menu choices for removing one source-directory entry.
5085
5215
  - @details Exposes every configured `src-dir` entry as one removable row and appends a value-less subtree-local `Reset defaults` row. Runtime is O(s) in source-directory count. No external state is mutated.
5086
5216
  - @param[in] config {UseReqConfig} Effective project configuration.
5087
5217
  - @return {PiUsereqSettingsMenuChoice[]} Ordered removable source-directory choices.
5088
5218
  - @satisfies REQ-006, REQ-151, REQ-152, REQ-153, REQ-154
5089
5219
 
5090
- ### fn `async function configurePiUsereq(` (L3499-3719)
5220
+ ### fn `async function configurePiUsereq(` (L3915-4164)
5091
5221
  - @brief Runs the top-level pi-usereq configuration menu.
5092
5222
  - @details Loads project config, exposes docs/test/source/automatic-commit/worktree/static-check/startup-tool/notification/debug actions through the shared settings-menu renderer, forces worktree disablement when automatic git commit is disabled, prevents locked row edits, persists changes on exit, closes immediately after `Show configuration`, and refreshes the single-line status bar. Runtime depends on user interaction count. Side effects include UI updates, config writes, active-tool changes, and editor text updates.
5093
5223
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5096,9 +5226,9 @@ updates.
5096
5226
  - @return {Promise<void>} Promise resolved when configuration is saved and the menu closes.
5097
5227
  - @satisfies REQ-006, REQ-031, REQ-137, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-162, REQ-190, REQ-191, REQ-192, REQ-194, REQ-195, REQ-204, REQ-205, REQ-212, REQ-215, REQ-216, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243
5098
5228
 
5099
- ### fn `const persistConfigChange = () =>` (L3510-3515)
5229
+ ### fn `const persistConfigChange = () =>` (L3926-3931)
5100
5230
 
5101
- ### fn `function registerConfigCommands(` (L3729-3739)
5231
+ ### fn `function registerConfigCommands(` (L4174-4184)
5102
5232
  - @brief Registers configuration-management commands.
5103
5233
  - @details Adds the interactive `pi-usereq` configuration command only; the config-viewer action is now exposed exclusively inside that menu. Runtime is O(1) for registration. Side effects include command registration.
5104
5234
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5106,110 +5236,107 @@ updates.
5106
5236
  - @return {void} No return value.
5107
5237
  - @satisfies REQ-006, REQ-031
5108
5238
 
5109
- ### fn `export default function piUsereqExtension(pi: ExtensionAPI): void` (L3757-3765)
5239
+ ### fn `export default function piUsereqExtension(pi: ExtensionAPI): void` (L4193-4203)
5110
5240
  - @brief Registers the complete pi-usereq extension.
5111
- - @details Validates installation-owned bundled resources, registers prompt and
5112
- configuration commands plus agent tools, registers the configurable
5113
- notification-sound shortcut when the runtime supports shortcuts, and
5114
- installs shared wrappers for all supported pi lifecycle hooks so status
5115
- telemetry, context usage, prompt timing, cumulative runtime, prompt-specific
5116
- Pushover metadata, tool-result debug logging, and prompt-orchestration debug
5117
- effects remain synchronized with runtime events. Runtime is O(h) in hook
5118
- count during registration. Side effects include filesystem reads,
5119
- command/tool/shortcut registration, UI updates, active-tool changes,
5120
- optional debug-log writes, and timer scheduling.
5241
+ - @details Validates installation-owned bundled resources, registers the specialized `req-reset` and `req-references` commands plus bundled prompt-backed commands and agent tools, registers configuration commands, registers the configurable notification-sound shortcut when the runtime supports shortcuts, and installs shared wrappers for all supported pi lifecycle hooks so status telemetry, context usage, prompt timing, cumulative runtime, prompt-specific Pushover metadata, tool-result debug logging, and prompt-orchestration effects remain synchronized with runtime events. Runtime is O(h) in hook count during registration. Side effects include filesystem reads, command/tool/shortcut registration, UI updates, active-tool changes, optional debug-log writes, and timer scheduling.
5121
5242
  - @param[in] pi {ExtensionAPI} Active extension API instance.
5122
5243
  - @return {void} No return value.
5123
- - @satisfies DES-002, REQ-004, REQ-005, REQ-009, REQ-044, REQ-067, REQ-068, REQ-109, REQ-111, REQ-112, REQ-113, REQ-114, REQ-115, REQ-116, REQ-117, REQ-118, REQ-119, REQ-120, REQ-121, REQ-122, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-131, REQ-132, REQ-133, REQ-134, REQ-137, REQ-159, REQ-163, REQ-164, REQ-165, REQ-166, REQ-167, REQ-168, REQ-169, REQ-172, REQ-174, REQ-179, REQ-180, REQ-184, REQ-188, REQ-190, REQ-191, REQ-192, REQ-193, REQ-194, REQ-195, REQ-196, REQ-197, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243, REQ-244, REQ-245, REQ-246, REQ-247
5244
+ - @satisfies DES-002, REQ-004, REQ-005, REQ-009, REQ-044, REQ-067, REQ-068, REQ-109, REQ-111, REQ-112, REQ-113, REQ-114, REQ-115, REQ-116, REQ-117, REQ-118, REQ-119, REQ-120, REQ-121, REQ-122, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-131, REQ-132, REQ-133, REQ-134, REQ-137, REQ-159, REQ-163, REQ-164, REQ-165, REQ-166, REQ-167, REQ-168, REQ-169, REQ-172, REQ-174, REQ-179, REQ-180, REQ-184, REQ-188, REQ-190, REQ-191, REQ-192, REQ-193, REQ-194, REQ-195, REQ-196, REQ-197, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243, REQ-244, REQ-245, REQ-246, REQ-247, REQ-298, REQ-299, REQ-300, REQ-301, REQ-302, REQ-303, REQ-304, REQ-305, REQ-306, REQ-312, REQ-313
5124
5245
 
5125
5246
  ## Symbol Index
5126
5247
  |Symbol|Kind|Vis|Lines|Sig|
5127
5248
  |---|---|---|---|---|
5128
- |`PiShortcutRegistrar`|iface||161-169|interface PiShortcutRegistrar|
5129
- |`getProjectBase`|fn||177-186|function getProjectBase(cwd: string): string|
5130
- |`getProcessCwdSafe`|fn||193-202|function getProcessCwdSafe(): string|
5131
- |`resolveLiveBootstrapCwd`|fn||210-222|function resolveLiveBootstrapCwd(cwd: string): string|
5132
- |`syncContextCwdMirror`|fn||231-240|function syncContextCwdMirror(ctx: { cwd?: string }, cwd:...|
5133
- |`loadProjectConfig`|fn||249-252|function loadProjectConfig(cwd: string): UseReqConfig|
5134
- |`saveProjectConfig`|fn||262-265|function saveProjectConfig(cwd: string, config: UseReqCon...|
5135
- |`formatProjectConfigPathForMenu`|fn||274-278|function formatProjectConfigPathForMenu(cwd: string): string|
5136
- |`buildTerminalSettingsMenuChoices`|fn||287-298|function buildTerminalSettingsMenuChoices(options:|
5137
- |`ResetConfirmationChange`|iface||304-308|interface ResetConfirmationChange|
5138
- |`formatResetConfirmationValue`|fn||317-319|function formatResetConfirmationValue(previousValue: stri...|
5139
- |`buildResetConfirmationChoices`|fn||329-368|function buildResetConfirmationChoices(|
5140
- |`confirmResetChanges`|fn||380-393|async function confirmResetChanges(|
5141
- |`writePersistedProjectConfigToEditor`|fn||404-411|function writePersistedProjectConfigToEditor(|
5142
- |`buildSearchToolSupportedTagGuidelines`|fn||472-476|function buildSearchToolSupportedTagGuidelines(): string[]|
5143
- |`buildSearchToolSchemaDescription`|fn||484-489|function buildSearchToolSchemaDescription(scope: FindTool...|
5144
- |`buildSearchToolPromptGuidelines`|fn||497-510|function buildSearchToolPromptGuidelines(scope: FindToolS...|
5145
- |`MonolithicToolRenderResult`|type||516||
5146
- |`getMonolithicToolText`|fn||533-536|function getMonolithicToolText(result: MonolithicToolRend...|
5147
- |`getMonolithicToolErrorText`|fn||544-554|function getMonolithicToolErrorText(result: MonolithicToo...|
5148
- |`formatCompactToolArgumentValue`|fn||562-601|function formatCompactToolArgumentValue(value: unknown): ...|
5149
- |`buildCompactToolInvocationText`|fn||609-620|function buildCompactToolInvocationText(args: Record<stri...|
5150
- |`summarizeStructuredToolResult`|fn||630-645|function summarizeStructuredToolResult(|
5151
- |`buildStructuredToolRenderResult`|fn||654-673|function buildStructuredToolRenderResult(toolName: string)|
5152
- |`executeMonolithicTool`|fn||681-687|function executeMonolithicTool(operation: () => ToolResul...|
5153
- |`deliverPromptCommand`|fn||698-716|function deliverPromptCommand(|
5154
- |`shouldIgnoreLatePromptDeliveryFailure`|fn||727-743|function shouldIgnoreLatePromptDeliveryFailure(|
5155
- |`logPromptWorkflowStateChange`|fn||756-775|function logPromptWorkflowStateChange(|
5156
- |`logPromptWorkflowEvent`|fn||791-811|function logPromptWorkflowEvent(|
5157
- |`transitionPromptWorkflowState`|fn||824-837|function transitionPromptWorkflowState(|
5158
- |`resolvePromptCommandDescription`|fn||845-849|function resolvePromptCommandDescription(|
5159
- |`resolveDebugProjectBase`|fn||858-862|function resolveDebugProjectBase(cwd: string, statusContr...|
5160
- |`notifyContextSafely`|fn||873-890|function notifyContextSafely(|
5161
- |`getPiUsereqStartupTools`|fn||899-907|function getPiUsereqStartupTools(pi: ExtensionAPI): ToolI...|
5162
- |`getConfiguredEnabledPiUsereqTools`|fn||915-919|function getConfiguredEnabledPiUsereqTools(config: UseReq...|
5163
- |`applyConfiguredPiUsereqTools`|fn||929-946|function applyConfiguredPiUsereqTools(pi: ExtensionAPI, c...|
5164
- |`handleExtensionStatusEvent`|fn||959-1219|async function handleExtensionStatusEvent(|
5165
- |`registerExtensionStatusHooks`|fn||1235-1254|function registerExtensionStatusHooks(|
5166
- |`setConfiguredPiUsereqTools`|fn||1264-1267|function setConfiguredPiUsereqTools(pi: ExtensionAPI, con...|
5167
- |`getDebugToolToggleNames`|fn||1275-1277|function getDebugToolToggleNames(): PiUsereqStartupToolNa...|
5168
- |`resetDebugConfigToDefaults`|fn||1286-1294|function resetDebugConfigToDefaults(config: UseReqConfig)...|
5169
- |`formatDebugMenuSummary`|fn||1302-1308|function formatDebugMenuSummary(config: UseReqConfig): st...|
5170
- |`buildDebugMenuChoice`|fn||1318-1331|function buildDebugMenuChoice(|
5171
- |`selectDebugLogOnStatus`|fn||1340-1368|async function selectDebugLogOnStatus(|
5172
- |`buildDebugMenuChoices`|fn||1377-1448|function buildDebugMenuChoices(config: UseReqConfig): PiU...|
5173
- |`configureDebugMenu`|fn||1458-1575|async function configureDebugMenu(|
5174
- |`PiNotifyBooleanConfigKey`|type||1581||
5175
- |`PiNotifyEventBooleanConfigKey`|type||1598||
5176
- |`PiNotifyEventId`|type||1607||
5177
- |`PiNotifyEventRowDefinition`|iface||1613-1617|interface PiNotifyEventRowDefinition|
5178
- |`PiNotifyEventMenuDefinition`|iface||1623-1629|interface PiNotifyEventMenuDefinition|
5179
- |`togglePiNotifyFlag`|fn||1638-1641|function togglePiNotifyFlag(config: UseReqConfig, key: Pi...|
5180
- |`resetPiNotifyConfigToDefaults`|fn||1650-1674|function resetPiNotifyConfigToDefaults(config: UseReqConf...|
5181
- |`formatPiNotifyPushoverPriority`|fn||1683-1685|function formatPiNotifyPushoverPriority(priority: PiNotif...|
5182
- |`formatPiNotifyEventMenuSummary`|fn||1762-1770|function formatPiNotifyEventMenuSummary(|
5183
- |`buildPiNotifyEventLauncherChoice`|fn||1780-1790|function buildPiNotifyEventLauncherChoice(|
5184
- |`buildPiNotifyEventMenuChoices`|fn||1800-1815|function buildPiNotifyEventMenuChoices(|
5185
- |`resetPiNotifyEventMenuToDefaults`|fn||1825-1833|function resetPiNotifyEventMenuToDefaults(|
5186
- |`resolvePiNotifyEventLabel`|fn||1843-1850|function resolvePiNotifyEventLabel(|
5187
- |`configurePiNotifyEventMenu`|fn||1861-1921|async function configurePiNotifyEventMenu(|
5188
- |`buildPiNotifyPushoverRows`|fn||1930-1979|function buildPiNotifyPushoverRows(config: UseReqConfig):...|
5189
- |`selectPiNotifyPushoverPriority`|fn||1989-2017|async function selectPiNotifyPushoverPriority(|
5190
- |`buildPiNotifyMenuChoices`|fn||2026-2083|function buildPiNotifyMenuChoices(config: UseReqConfig): ...|
5191
- |`selectPiNotifySoundLevel`|fn||2093-2133|async function selectPiNotifySoundLevel(|
5192
- |`configurePiNotifyMenu`|fn||2143-2409|async function configurePiNotifyMenu(|
5193
- |`registerPiNotifyShortcut`|fn||2424-2444|function registerPiNotifyShortcut(|
5194
- |`registerPromptCommands`|fn||2454-2572|function registerPromptCommands(|
5195
- |`registerAgentTools`|fn||2582-2881|function registerAgentTools(pi: ExtensionAPI): void|
5196
- |`buildPiUsereqToolsMenuChoices`|fn||2899-2924|function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, ...|
5197
- |`buildPiUsereqToolToggleChoices`|fn||2934-2947|function buildPiUsereqToolToggleChoices(pi: ExtensionAPI,...|
5198
- |`configurePiUsereqToolsMenu`|fn||2958-3053|async function configurePiUsereqToolsMenu(|
5199
- |`getStaticCheckLanguageConfigForMenu`|fn||3062-3067|function getStaticCheckLanguageConfigForMenu(|
5200
- |`countConfiguredStaticCheckLanguages`|fn||3075-3077|function countConfiguredStaticCheckLanguages(config: UseR...|
5201
- |`countEnabledStaticCheckLanguages`|fn||3085-3087|function countEnabledStaticCheckLanguages(config: UseReqC...|
5202
- |`resetStaticCheckConfig`|fn||3096-3098|function resetStaticCheckConfig(config: UseReqConfig): void|
5203
- |`formatStaticCheckLanguagesSummary`|fn||3106-3108|function formatStaticCheckLanguagesSummary(config: UseReq...|
5204
- |`buildStaticCheckMenuChoices`|fn||3117-3148|function buildStaticCheckMenuChoices(config: UseReqConfig...|
5205
- |`buildSupportedStaticCheckLanguageChoices`|fn||3156-3173|function buildSupportedStaticCheckLanguageChoices(config:...|
5206
- |`buildConfiguredStaticCheckLanguageChoices`|fn||3181-3198|function buildConfiguredStaticCheckLanguageChoices(config...|
5207
- |`configureStaticCheckMenu`|fn||3208-3341|async function configureStaticCheckMenu(|
5208
- |`buildPiUsereqMenuChoices`|fn||3351-3440|function buildPiUsereqMenuChoices(|
5209
- |`buildSrcDirMenuChoices`|fn||3449-3467|function buildSrcDirMenuChoices(config: UseReqConfig): Pi...|
5210
- |`buildSrcDirRemovalChoices`|fn||3476-3488|function buildSrcDirRemovalChoices(config: UseReqConfig):...|
5211
- |`configurePiUsereq`|fn||3499-3719|async function configurePiUsereq(|
5212
- |`persistConfigChange`|fn||3510-3515|const persistConfigChange = () =>|
5213
- |`registerConfigCommands`|fn||3729-3739|function registerConfigCommands(|
5214
- |`piUsereqExtension`|fn||3757-3765|export default function piUsereqExtension(pi: ExtensionAP...|
5249
+ |`PiShortcutRegistrar`|iface||177-185|interface PiShortcutRegistrar|
5250
+ |`getProjectBase`|fn||193-202|function getProjectBase(cwd: string): string|
5251
+ |`getProcessCwdSafe`|fn||209-218|function getProcessCwdSafe(): string|
5252
+ |`resolveLiveBootstrapCwd`|fn||226-238|function resolveLiveBootstrapCwd(cwd: string): string|
5253
+ |`syncContextCwdMirror`|fn||247-256|function syncContextCwdMirror(ctx: { cwd?: string }, cwd:...|
5254
+ |`loadProjectConfig`|fn||265-268|function loadProjectConfig(cwd: string): UseReqConfig|
5255
+ |`saveProjectConfig`|fn||278-281|function saveProjectConfig(cwd: string, config: UseReqCon...|
5256
+ |`formatProjectConfigPathForMenu`|fn||290-294|function formatProjectConfigPathForMenu(cwd: string): string|
5257
+ |`buildTerminalSettingsMenuChoices`|fn||303-314|function buildTerminalSettingsMenuChoices(options:|
5258
+ |`ResetConfirmationChange`|iface||320-324|interface ResetConfirmationChange|
5259
+ |`formatResetConfirmationValue`|fn||333-335|function formatResetConfirmationValue(previousValue: stri...|
5260
+ |`buildResetConfirmationChoices`|fn||345-384|function buildResetConfirmationChoices(|
5261
+ |`confirmResetChanges`|fn||396-409|async function confirmResetChanges(|
5262
+ |`writePersistedProjectConfigToEditor`|fn||420-427|function writePersistedProjectConfigToEditor(|
5263
+ |`buildSearchToolSupportedTagGuidelines`|fn||488-492|function buildSearchToolSupportedTagGuidelines(): string[]|
5264
+ |`buildSearchToolSchemaDescription`|fn||500-505|function buildSearchToolSchemaDescription(scope: FindTool...|
5265
+ |`buildSearchToolPromptGuidelines`|fn||513-526|function buildSearchToolPromptGuidelines(scope: FindToolS...|
5266
+ |`MonolithicToolRenderResult`|type||532||
5267
+ |`getMonolithicToolText`|fn||549-552|function getMonolithicToolText(result: MonolithicToolRend...|
5268
+ |`getMonolithicToolErrorText`|fn||560-570|function getMonolithicToolErrorText(result: MonolithicToo...|
5269
+ |`formatCompactToolArgumentValue`|fn||578-617|function formatCompactToolArgumentValue(value: unknown): ...|
5270
+ |`buildCompactToolInvocationText`|fn||625-636|function buildCompactToolInvocationText(args: Record<stri...|
5271
+ |`summarizeStructuredToolResult`|fn||646-661|function summarizeStructuredToolResult(|
5272
+ |`buildStructuredToolRenderResult`|fn||670-689|function buildStructuredToolRenderResult(toolName: string)|
5273
+ |`executeMonolithicTool`|fn||697-703|function executeMonolithicTool(operation: () => ToolResul...|
5274
+ |`executeStatusTool`|fn||712-741|function executeStatusTool(operation: () => ToolResult): ...|
5275
+ |`deliverPromptCommand`|fn||752-770|function deliverPromptCommand(|
5276
+ |`shouldIgnoreLatePromptDeliveryFailure`|fn||781-797|function shouldIgnoreLatePromptDeliveryFailure(|
5277
+ |`logPromptWorkflowStateChange`|fn||810-829|function logPromptWorkflowStateChange(|
5278
+ |`logPromptWorkflowEvent`|fn||845-865|function logPromptWorkflowEvent(|
5279
+ |`transitionPromptWorkflowState`|fn||878-891|function transitionPromptWorkflowState(|
5280
+ |`resolvePromptCommandDescription`|fn||899-903|function resolvePromptCommandDescription(|
5281
+ |`resolveDebugProjectBase`|fn||912-916|function resolveDebugProjectBase(cwd: string, statusContr...|
5282
+ |`notifyContextSafely`|fn||927-944|function notifyContextSafely(|
5283
+ |`rejectNonIdleReqCommand`|fn||956-976|function rejectNonIdleReqCommand(|
5284
+ |`getPiUsereqStartupTools`|fn||985-993|function getPiUsereqStartupTools(pi: ExtensionAPI): ToolI...|
5285
+ |`getConfiguredEnabledPiUsereqTools`|fn||1001-1005|function getConfiguredEnabledPiUsereqTools(config: UseReq...|
5286
+ |`applyConfiguredPiUsereqTools`|fn||1015-1032|function applyConfiguredPiUsereqTools(pi: ExtensionAPI, c...|
5287
+ |`handleExtensionStatusEvent`|fn||1045-1316|async function handleExtensionStatusEvent(|
5288
+ |`registerExtensionStatusHooks`|fn||1332-1351|function registerExtensionStatusHooks(|
5289
+ |`setConfiguredPiUsereqTools`|fn||1361-1364|function setConfiguredPiUsereqTools(pi: ExtensionAPI, con...|
5290
+ |`getDebugToolToggleNames`|fn||1372-1374|function getDebugToolToggleNames(): PiUsereqStartupToolNa...|
5291
+ |`resetDebugConfigToDefaults`|fn||1383-1391|function resetDebugConfigToDefaults(config: UseReqConfig)...|
5292
+ |`formatDebugMenuSummary`|fn||1399-1405|function formatDebugMenuSummary(config: UseReqConfig): st...|
5293
+ |`buildDebugMenuChoice`|fn||1415-1428|function buildDebugMenuChoice(|
5294
+ |`selectDebugLogOnStatus`|fn||1437-1465|async function selectDebugLogOnStatus(|
5295
+ |`buildDebugMenuChoices`|fn||1474-1550|function buildDebugMenuChoices(config: UseReqConfig): PiU...|
5296
+ |`configureDebugMenu`|fn||1560-1729|async function configureDebugMenu(|
5297
+ |`PiNotifyBooleanConfigKey`|type||1735||
5298
+ |`PiNotifyEventBooleanConfigKey`|type||1752||
5299
+ |`PiNotifyEventId`|type||1761||
5300
+ |`PiNotifyEventRowDefinition`|iface||1767-1771|interface PiNotifyEventRowDefinition|
5301
+ |`PiNotifyEventMenuDefinition`|iface||1777-1783|interface PiNotifyEventMenuDefinition|
5302
+ |`togglePiNotifyFlag`|fn||1792-1795|function togglePiNotifyFlag(config: UseReqConfig, key: Pi...|
5303
+ |`resetPiNotifyConfigToDefaults`|fn||1804-1828|function resetPiNotifyConfigToDefaults(config: UseReqConf...|
5304
+ |`formatPiNotifyPushoverPriority`|fn||1837-1839|function formatPiNotifyPushoverPriority(priority: PiNotif...|
5305
+ |`formatPiNotifyEventMenuSummary`|fn||1923-1931|function formatPiNotifyEventMenuSummary(|
5306
+ |`buildPiNotifyEventLauncherChoice`|fn||1941-1951|function buildPiNotifyEventLauncherChoice(|
5307
+ |`buildPiNotifyEventMenuChoices`|fn||1961-1977|function buildPiNotifyEventMenuChoices(|
5308
+ |`resetPiNotifyEventMenuToDefaults`|fn||1987-1995|function resetPiNotifyEventMenuToDefaults(|
5309
+ |`resolvePiNotifyEventLabel`|fn||2005-2012|function resolvePiNotifyEventLabel(|
5310
+ |`configurePiNotifyEventMenu`|fn||2023-2099|async function configurePiNotifyEventMenu(|
5311
+ |`buildPiNotifyPushoverRows`|fn||2108-2158|function buildPiNotifyPushoverRows(config: UseReqConfig):...|
5312
+ |`selectPiNotifyPushoverPriority`|fn||2168-2196|async function selectPiNotifyPushoverPriority(|
5313
+ |`buildPiNotifyMenuChoices`|fn||2205-2263|function buildPiNotifyMenuChoices(config: UseReqConfig): ...|
5314
+ |`selectPiNotifySoundLevel`|fn||2273-2313|async function selectPiNotifySoundLevel(|
5315
+ |`configurePiNotifyMenu`|fn||2323-2609|async function configurePiNotifyMenu(|
5316
+ |`registerPiNotifyShortcut`|fn||2624-2647|function registerPiNotifyShortcut(|
5317
+ |`resolveReqResetPromptRequest`|fn||2655-2681|function resolveReqResetPromptRequest(|
5318
+ |`isWorktreeBacked`|fn||2658-2665|const isWorktreeBacked = (request: PromptCommandExecution...|
5319
+ |`registerReqResetCommand`|fn||2691-2745|function registerReqResetCommand(|
5320
+ |`registerReqReferencesCommand`|fn||2755-2795|function registerReqReferencesCommand(|
5321
+ |`registerPromptCommands`|fn||2805-2921|function registerPromptCommands(|
5322
+ |`registerAgentTools`|fn||2931-3230|function registerAgentTools(pi: ExtensionAPI): void|
5323
+ |`buildPiUsereqToolsMenuChoices`|fn||3275-3300|function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, ...|
5324
+ |`buildPiUsereqToolToggleChoices`|fn||3310-3324|function buildPiUsereqToolToggleChoices(pi: ExtensionAPI,...|
5325
+ |`configurePiUsereqToolsMenu`|fn||3335-3452|async function configurePiUsereqToolsMenu(|
5326
+ |`getStaticCheckLanguageConfigForMenu`|fn||3461-3466|function getStaticCheckLanguageConfigForMenu(|
5327
+ |`countConfiguredStaticCheckLanguages`|fn||3474-3476|function countConfiguredStaticCheckLanguages(config: UseR...|
5328
+ |`countEnabledStaticCheckLanguages`|fn||3484-3486|function countEnabledStaticCheckLanguages(config: UseReqC...|
5329
+ |`resetStaticCheckConfig`|fn||3495-3497|function resetStaticCheckConfig(config: UseReqConfig): void|
5330
+ |`formatStaticCheckLanguagesSummary`|fn||3505-3507|function formatStaticCheckLanguagesSummary(config: UseReq...|
5331
+ |`buildStaticCheckMenuChoices`|fn||3516-3548|function buildStaticCheckMenuChoices(config: UseReqConfig...|
5332
+ |`buildSupportedStaticCheckLanguageChoices`|fn||3556-3573|function buildSupportedStaticCheckLanguageChoices(config:...|
5333
+ |`buildConfiguredStaticCheckLanguageChoices`|fn||3581-3598|function buildConfiguredStaticCheckLanguageChoices(config...|
5334
+ |`configureStaticCheckMenu`|fn||3608-3754|async function configureStaticCheckMenu(|
5335
+ |`buildPiUsereqMenuChoices`|fn||3764-3856|function buildPiUsereqMenuChoices(|
5336
+ |`buildSrcDirMenuChoices`|fn||3865-3883|function buildSrcDirMenuChoices(config: UseReqConfig): Pi...|
5337
+ |`buildSrcDirRemovalChoices`|fn||3892-3904|function buildSrcDirRemovalChoices(config: UseReqConfig):...|
5338
+ |`configurePiUsereq`|fn||3915-4164|async function configurePiUsereq(|
5339
+ |`persistConfigChange`|fn||3926-3931|const persistConfigChange = () =>|
5340
+ |`registerConfigCommands`|fn||4174-4184|function registerConfigCommands(|
5341
+ |`piUsereqExtension`|fn||4193-4203|export default function piUsereqExtension(pi: ExtensionAP...|
5215
5342