pi-usereq 0.38.0 → 0.40.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.
@@ -581,7 +581,7 @@ import { buildLanguageSpecs } from "./source-analyzer.js";
581
581
 
582
582
  ---
583
583
 
584
- # config.ts | TypeScript | 1153L | 43 symbols | 8 imports | 52 comments
584
+ # config.ts | TypeScript | 1192L | 44 symbols | 8 imports | 54 comments
585
585
  > Path: `src/core/config.ts`
586
586
  - @brief Loads, normalizes, merges, and persists pi-usereq configuration.
587
587
  - @details Defines the effective configuration schema, split local/global persistence contracts, JSON serialization helpers, and prompt placeholder expansion paths. Runtime is dominated by filesystem reads and writes plus linear normalization over configured entries. Side effects include config-file persistence under `.pi-usereq.json` and `~/.config/pi-usereq/config.json`.
@@ -611,76 +611,83 @@ import { makeRelativeIfContainsProject } from "./utils.js";
611
611
  - @brief Describes one persisted per-language static-check configuration object.
612
612
  - @details Couples the per-language enable flag with the ordered checker-entry list so menu toggles, config serialization, and execution dispatch can distinguish configured-but-disabled languages from enabled active checker lists. The interface is compile-time only and introduces no runtime cost.
613
613
 
614
- ### iface `export interface UseReqConfig` (L83-122)
614
+ ### iface `export interface UseReqConfig` (L83-125)
615
615
  - @brief Defines the effective pi-usereq configuration schema.
616
616
  - @details Captures the merged runtime view produced from project-local and cross-project persisted scopes, including documentation paths, source/test directory selection, per-language static-check enablement plus checker configuration, prompt-command worktree settings, enabled startup tools, and notification settings while excluding runtime-derived path metadata. The interface is compile-time only and introduces no runtime side effects.
617
617
 
618
- ### iface `interface LocalStaticCheckLanguageConfig` (L128-130)
618
+ ### iface `interface LocalStaticCheckLanguageConfig` (L131-133)
619
619
  - @brief Defines one persisted local static-check language configuration.
620
620
  - @details Stores only the project-local enable flag so checker command definitions can live exclusively in global configuration. The interface is compile-time only and introduces no runtime cost.
621
621
 
622
- ### iface `interface GlobalStaticCheckLanguageConfig` (L136-138)
622
+ ### iface `interface GlobalStaticCheckLanguageConfig` (L139-141)
623
623
  - @brief Defines one persisted global static-check language configuration.
624
624
  - @details Stores only the cross-project checker-entry array so project-local files do not duplicate command definitions. The interface is compile-time only and introduces no runtime cost.
625
625
 
626
- ### iface `interface UseReqLocalConfig` (L144-157)
626
+ ### iface `interface UseReqLocalConfig` (L147-163)
627
627
  - @brief Defines the persisted local pi-usereq configuration schema.
628
628
  - @details Captures project-scoped directory, debug, and static-check enablement fields written to `<base-path>/.pi-usereq.json` while excluding global notification, tool, git, and checker-command settings. The interface is compile-time only and introduces no runtime side effects.
629
629
 
630
- ### iface `interface UseReqGlobalConfig` (L163-191)
630
+ ### iface `interface UseReqGlobalConfig` (L169-197)
631
631
  - @brief Defines the persisted global pi-usereq configuration schema.
632
632
  - @details Captures cross-project static-check checker commands, enabled tool names, git automation fields, and notification settings written to `~/.config/pi-usereq/config.json` while excluding project-local directory and debug fields. The interface is compile-time only and introduces no runtime side effects.
633
633
 
634
- ### fn `function cloneStaticCheckEntry(entry: StaticCheckEntry): StaticCheckEntry` (L308-317)
634
+ ### fn `export function normalizeContextFilesFlag(value: unknown): boolean` (L229-231)
635
+ - @brief Normalizes one persisted context-file injection flag.
636
+ - @details Returns the documented default (`true`) for missing or non-boolean values and preserves only explicit boolean input, so any malformed persisted entry keeps context-file injection enabled. Runtime is O(1). No external state is mutated.
637
+ - @param[in] value {unknown} Candidate persisted context-file flag.
638
+ - @return {boolean} Normalized context-file injection flag.
639
+ - @satisfies REQ-328
640
+
641
+ ### fn `function cloneStaticCheckEntry(entry: StaticCheckEntry): StaticCheckEntry` (L331-340)
635
642
  - @brief Clones one static-check entry into its persisted shape.
636
643
  - @details Copies only the stable module, cmd, and params fields so runtime-only or unknown metadata never leaks into persisted configuration payloads. Runtime is O(p) in parameter count. No external state is mutated.
637
644
  - @param[in] entry {StaticCheckEntry} Source static-check entry.
638
645
  - @return {StaticCheckEntry} Persistable static-check entry clone.
639
646
 
640
- ### fn `export function createStaticCheckLanguageConfig(` (L326-335)
647
+ ### fn `export function createStaticCheckLanguageConfig(` (L349-358)
641
648
  - @brief Builds one per-language static-check configuration object.
642
649
  - @details Clones the supplied checker entries, derives `enabled` from the explicit argument or checker-list emptiness, and preserves checker order for menu and dispatch determinism. Runtime is O(c + p). No external state is mutated.
643
650
  - @param[in] checkers {StaticCheckEntry[]} Ordered checker entries.
644
651
  - @param[in] enabled {StaticCheckEnabled | undefined} Optional explicit enable flag.
645
652
  - @return {StaticCheckLanguageConfig} Normalized per-language config object.
646
653
 
647
- ### fn `function createLocalStaticCheckLanguageConfig(` (L343-347)
654
+ ### fn `function createLocalStaticCheckLanguageConfig(` (L366-370)
648
655
  - @brief Builds one persisted local static-check language configuration object.
649
656
  - @details Stores only the normalized enable flag so local project files do not duplicate checker command definitions. Runtime is O(1). No external state is mutated.
650
657
  - @param[in] enabled {StaticCheckEnabled} Canonical per-language enable flag.
651
658
  - @return {LocalStaticCheckLanguageConfig} Persistable local static-check language config.
652
659
 
653
- ### fn `function createGlobalStaticCheckLanguageConfig(` (L355-361)
660
+ ### fn `function createGlobalStaticCheckLanguageConfig(` (L378-384)
654
661
  - @brief Builds one persisted global static-check language configuration object.
655
662
  - @details Clones the supplied checker entries so global configuration retains only stable module, command, and parameter fields. Runtime is O(c + p). No external state is mutated.
656
663
  - @param[in] checkers {StaticCheckEntry[]} Ordered checker entries.
657
664
  - @return {GlobalStaticCheckLanguageConfig} Persistable global static-check language config.
658
665
 
659
- ### fn `function getDefaultGlobalStaticCheckConfig(): Record<string, GlobalStaticCheckLanguageConfig>` (L368-373)
666
+ ### fn `function getDefaultGlobalStaticCheckConfig(): Record<string, GlobalStaticCheckLanguageConfig>` (L391-396)
660
667
  - @brief Returns the documented default global static-check checker map.
661
668
  - @details Emits one checker-array object for every supported language, preserving documented Command entries for default-enabled languages and `[]` for every other language. Runtime is O(l + c). No external state is mutated.
662
669
  - @return {Record<string, GlobalStaticCheckLanguageConfig>} Fresh default global checker map.
663
670
 
664
- ### fn `function getDefaultLocalStaticCheckConfig(` (L381-390)
671
+ ### fn `function getDefaultLocalStaticCheckConfig(` (L404-413)
665
672
  - @brief Returns the documented default local static-check enable map.
666
673
  - @details Derives each per-language enable flag from the supplied global checker definitions using the rule `enable` when `checkers` is non-empty and `disable` otherwise. Runtime is O(l). No external state is mutated.
667
674
  - @param[in] globalStaticCheckConfig {Record<string, GlobalStaticCheckLanguageConfig>} Global checker map used to derive default enablement.
668
675
  - @return {Record<string, LocalStaticCheckLanguageConfig>} Fresh default local enable map.
669
676
 
670
- ### fn `function mergeStaticCheckConfig(` (L399-418)
677
+ ### fn `function mergeStaticCheckConfig(` (L422-441)
671
678
  - @brief Merges local enable flags with global checker definitions into the effective static-check map.
672
679
  - @details Unifies all language keys present in either persisted scope, applies the default-enable rule when the local scope omits a language, and clones checker entries into the effective runtime config. Runtime is O(l + c + p). No external state is mutated.
673
680
  - @param[in] localStaticCheckConfig {Record<string, LocalStaticCheckLanguageConfig>} Persisted local enable map.
674
681
  - @param[in] globalStaticCheckConfig {Record<string, GlobalStaticCheckLanguageConfig>} Persisted global checker map.
675
682
  - @return {Record<string, StaticCheckLanguageConfig>} Effective per-language static-check config.
676
683
 
677
- ### fn `export function getDefaultStaticCheckConfig(): Record<string, StaticCheckLanguageConfig>` (L426-432)
684
+ ### fn `export function getDefaultStaticCheckConfig(): Record<string, StaticCheckLanguageConfig>` (L449-455)
678
685
  - @brief Returns the documented default static-check configuration.
679
686
  - @details Emits one effective per-language config object for every supported language by merging documented global checker defaults with derived local enable defaults. Runtime is O(l + c). No external state is mutated.
680
687
  - @return {Record<string, StaticCheckLanguageConfig>} Fresh default effective static-check config.
681
688
  - @satisfies REQ-249, REQ-250, REQ-251, REQ-252, REQ-316
682
689
 
683
- ### fn `export function normalizeStaticCheckEnabled(` (L442-447)
690
+ ### fn `export function normalizeStaticCheckEnabled(` (L465-470)
684
691
  - @brief Normalizes one persisted per-language static-check enable flag.
685
692
  - @details Accepts only the documented `enable|disable` values and falls back to the supplied default when the candidate is absent or invalid. Runtime is O(1). No external state is mutated.
686
693
  - @param[in] value {unknown} Candidate persisted enable flag.
@@ -688,7 +695,7 @@ import { makeRelativeIfContainsProject } from "./utils.js";
688
695
  - @return {StaticCheckEnabled} Canonical per-language enable flag.
689
696
  - @satisfies REQ-249
690
697
 
691
- ### fn `export function getActiveStaticCheckEntries(` (L457-466)
698
+ ### fn `export function getActiveStaticCheckEntries(` (L480-489)
692
699
  - @brief Resolves the active checker list for one language.
693
700
  - @details Returns the persisted checker list only when the language is enabled; disabled or missing languages yield an empty list without mutating the source config. Runtime is O(c). No external state is mutated.
694
701
  - @param[in] staticCheckConfig {Record<string, StaticCheckLanguageConfig>} Effective static-check config.
@@ -696,21 +703,21 @@ import { makeRelativeIfContainsProject } from "./utils.js";
696
703
  - @return {StaticCheckEntry[]} Active checker list for the language.
697
704
  - @satisfies REQ-019
698
705
 
699
- ### fn `export function normalizeAutoGitCommit(value: unknown): "enable" | "disable"` (L481-483)
706
+ ### fn `export function normalizeAutoGitCommit(value: unknown): "enable" | "disable"` (L504-506)
700
707
  - @brief Normalizes one persisted automatic git-commit mode value.
701
708
  - @details Accepts only the documented `enable|disable` values and falls back to `DEFAULT_AUTO_GIT_COMMIT` for all other payloads. Runtime is O(1). No side effects occur.
702
709
  - @param[in] value {unknown} Candidate persisted automatic git-commit payload.
703
710
  - @return {"enable" | "disable"} Canonical automatic git-commit mode.
704
711
  - @satisfies REQ-212
705
712
 
706
- ### fn `export function normalizeGitWorktreeEnabled(value: unknown): "enable" | "disable"` (L497-499)
713
+ ### fn `export function normalizeGitWorktreeEnabled(value: unknown): "enable" | "disable"` (L520-522)
707
714
  - @brief Normalizes one persisted worktree-enable flag value.
708
715
  - @details Accepts only the documented `enable|disable` values and falls back to `DEFAULT_GIT_WORKTREE_ENABLED` for all other payloads. Runtime is O(1). No side effects occur.
709
716
  - @param[in] value {unknown} Candidate persisted worktree-enable payload.
710
717
  - @return {"enable" | "disable"} Canonical persisted worktree-enable mode.
711
718
  - @satisfies REQ-204
712
719
 
713
- ### fn `export function resolveEffectiveGitWorktreeEnabled(` (L508-513)
720
+ ### fn `export function resolveEffectiveGitWorktreeEnabled(` (L531-536)
714
721
  - @brief Resolves the effective worktree mode after automatic-commit policy is applied.
715
722
  - @details Forces `disable` whenever `AUTO_GIT_COMMIT` is disabled; otherwise preserves the normalized persisted worktree flag. Runtime is O(1). No side effects occur.
716
723
  - @param[in] autoGitCommit {"enable" | "disable"} Effective automatic git-commit mode.
@@ -718,64 +725,65 @@ import { makeRelativeIfContainsProject } from "./utils.js";
718
725
  - @return {"enable" | "disable"} Effective worktree mode used by menus, persistence, and prompt execution.
719
726
  - @satisfies REQ-204, REQ-215
720
727
 
721
- ### fn `export function normalizeGitWorktreePrefix(value: unknown): string` (L527-533)
728
+ ### fn `export function normalizeGitWorktreePrefix(value: unknown): string` (L550-556)
722
729
  - @brief Normalizes one persisted worktree-name prefix value.
723
730
  - @details Accepts only non-empty strings, trims surrounding whitespace, and falls back to `DEFAULT_GIT_WORKTREE_PREFIX` when the candidate is absent or blank. Runtime is O(n) in prefix length. No side effects occur.
724
731
  - @param[in] value {unknown} Candidate persisted prefix payload.
725
732
  - @return {string} Canonical worktree-name prefix.
726
733
  - @satisfies REQ-205
727
734
 
728
- ### fn `export function getProjectConfigPath(projectBase: string): string` (L540-542)
735
+ ### fn `export function getProjectConfigPath(projectBase: string): string` (L563-565)
729
736
  - @brief Computes the per-project local config file path.
730
737
  - @details Joins the project base with `.pi-usereq.json`, producing the canonical local persistence location used by CLI and extension code. Time complexity is O(1). No I/O side effects occur.
731
738
  - @param[in] projectBase {string} Absolute project root path.
732
739
  - @return {string} Absolute local config file path.
733
740
 
734
- ### fn `export function getGlobalConfigPath(): string` (L549-551)
741
+ ### fn `export function getGlobalConfigPath(): string` (L572-574)
735
742
  - @brief Computes the cross-project global config file path.
736
743
  - @details Resolves `~/.config/pi-usereq/config.json` through the shared runtime path helper so CLI and extension code use one canonical global persistence location. Time complexity is O(1). No I/O side effects occur.
737
744
  - @return {string} Absolute global config file path.
738
745
 
739
- ### fn `function getDefaultLocalConfig(` (L560-577)
746
+ ### fn `function getDefaultLocalConfig(` (L583-603)
740
747
  - @brief Builds the default persisted local configuration.
741
748
  - @details Populates canonical docs/test/source directories, derives local static-check enable defaults from the supplied global checker definitions, and seeds documented debug defaults including tool-wrapper command registration without any cross-project fields. Runtime is O(l). No filesystem side effects occur.
742
749
  - @param[in] globalStaticCheckConfig {Record<string, GlobalStaticCheckLanguageConfig>} Global checker definitions used to derive local enable defaults.
743
750
  - @return {UseReqLocalConfig} Fresh default local configuration object.
744
- - @satisfies CTN-019
751
+ - @satisfies CTN-019, REQ-328
745
752
 
746
- ### fn `function getDefaultGlobalConfig(): UseReqGlobalConfig` (L584-614)
753
+ ### fn `function getDefaultGlobalConfig(): UseReqGlobalConfig` (L610-640)
747
754
  - @brief Builds the default persisted global configuration.
748
755
  - @details Populates documented cross-project static-check checker commands, enabled tools, git automation fields, and notification defaults without any project-local directory or debug fields. Runtime is O(l + c). No filesystem side effects occur.
749
756
  - @return {UseReqGlobalConfig} Fresh default global configuration object.
750
757
 
751
- ### fn `function mergeConfigScopes(` (L623-690)
758
+ ### fn `function mergeConfigScopes(` (L650-720)
752
759
  - @brief Merges persisted local and global configuration scopes into the effective runtime config.
753
760
  - @details Normalizes local directories, combines local static-check enable flags with global checker arrays, resolves effective worktree disablement when automatic git commit is off, normalizes debug and notification fields including tool-wrapper command registration, and disables Pushover until both credentials are populated. Runtime is O(l + c + p). No external state is mutated.
754
761
  - @param[in] localConfig {UseReqLocalConfig} Persisted local configuration.
755
762
  - @param[in] globalConfig {UseReqGlobalConfig} Persisted global configuration.
756
763
  - @return {UseReqConfig} Effective merged configuration.
764
+ - @satisfies REQ-328
757
765
 
758
- ### fn `export function getDefaultConfig(_projectBase: string): UseReqConfig` (L699-705)
766
+ ### fn `export function getDefaultConfig(_projectBase: string): UseReqConfig` (L729-735)
759
767
  - @brief Builds the default effective configuration.
760
768
  - @details Composes documented local and global defaults, then merges them into the effective runtime config consumed by CLI and extension code. Time complexity is O(l + c). No filesystem side effects occur.
761
769
  - @param[in] _projectBase {string} Absolute project root path retained for stable call sites.
762
770
  - @return {UseReqConfig} Fresh default effective configuration object.
763
771
  - @satisfies CTN-001, CTN-012, CTN-013, CTN-018, CTN-019, REQ-066, REQ-137, REQ-146, REQ-163, REQ-174, REQ-178, REQ-184, REQ-185, REQ-196, REQ-204, REQ-205, REQ-212, REQ-236, REQ-237, REQ-238, REQ-239, REQ-249, REQ-250, REQ-251, REQ-252, REQ-277, REQ-315, REQ-316
764
772
 
765
- ### fn `function normalizeStaticCheckEntries(value: unknown): StaticCheckEntry[]` (L713-733)
773
+ ### fn `function normalizeStaticCheckEntries(value: unknown): StaticCheckEntry[]` (L743-763)
766
774
  - @brief Normalizes one raw checker-entry array from persisted config.
767
775
  - @details Accepts only object entries with a non-empty module string, trims optional command text, filters blank params, and drops malformed records without applying any legacy schema migrations. Runtime is O(c + p). No external state is mutated.
768
776
  - @param[in] value {unknown} Candidate persisted checker array.
769
777
  - @return {StaticCheckEntry[]} Normalized checker-entry vector.
770
778
 
771
- ### fn `function readConfigPayload(configPath: string): Record<string, unknown> | undefined` (L742-758)
779
+ ### fn `function readConfigPayload(configPath: string): Record<string, unknown> | undefined` (L772-788)
772
780
  - @brief Reads and validates one persisted config payload.
773
781
  - @details Returns `undefined` when the target file does not exist. Otherwise parses UTF-8 JSON, rejects array or primitive payloads, and surfaces deterministic `ReqError` diagnostics keyed by the exact path. Runtime is O(n) in file size. Side effects are limited to filesystem reads.
774
782
  - @param[in] configPath {string} Absolute config file path.
775
783
  - @return {Record<string, unknown> | undefined} Parsed object payload or `undefined` when the file is absent.
776
784
  - @throws {ReqError} Throws with exit code `11` when the config file contains invalid JSON or a non-object payload.
777
785
 
778
- ### fn `function normalizeLocalStaticCheckConfig(` (L768-792)
786
+ ### fn `function normalizeLocalStaticCheckConfig(` (L798-822)
779
787
  - @brief Normalizes the persisted local static-check enable map.
780
788
  - @details Starts from the supplied default enable map, accepts only object-valued language entries, reads only `enabled`, and ignores misplaced checker arrays or legacy non-object payloads without migration. Runtime is O(l). No external state is mutated.
781
789
  - @param[in] value {unknown} Candidate persisted local static-check payload.
@@ -783,27 +791,27 @@ import { makeRelativeIfContainsProject } from "./utils.js";
783
791
  - @return {Record<string, LocalStaticCheckLanguageConfig>} Normalized local static-check enable map.
784
792
  - @satisfies REQ-249, REQ-316
785
793
 
786
- ### fn `function normalizeGlobalStaticCheckConfig(` (L801-818)
794
+ ### fn `function normalizeGlobalStaticCheckConfig(` (L831-848)
787
795
  - @brief Normalizes the persisted global static-check checker map.
788
796
  - @details Starts from documented global checker defaults, accepts only object-valued language entries, reads only `checkers`, and ignores misplaced local enable flags or legacy non-object payloads without migration. Runtime is O(l + c + p). No external state is mutated.
789
797
  - @param[in] value {unknown} Candidate persisted global static-check payload.
790
798
  - @return {Record<string, GlobalStaticCheckLanguageConfig>} Normalized global static-check checker map.
791
799
  - @satisfies REQ-249, REQ-250, REQ-251, REQ-252
792
800
 
793
- ### fn `function loadLocalConfig(` (L828-876)
801
+ ### fn `function loadLocalConfig(` (L858-912)
794
802
  - @brief Loads and sanitizes the persisted local configuration.
795
803
  - @details Returns defaults when `<base-path>/.pi-usereq.json` is absent. Otherwise parses the local JSON payload, normalizes project-scoped directory, debug, tool-wrapper command registration, and static-check enable fields, and ignores misplaced global keys without migration. Runtime is O(n) in file size. Side effects are limited to filesystem reads.
796
804
  - @param[in] projectBase {string} Absolute project root path.
797
805
  - @param[in] defaultStaticCheckConfig {Record<string, LocalStaticCheckLanguageConfig>} Local static-check enable defaults derived from the current global checker map.
798
806
  - @return {UseReqLocalConfig} Sanitized local configuration.
799
- - @satisfies CTN-019
807
+ - @satisfies CTN-019, REQ-328
800
808
 
801
- ### fn `function loadGlobalConfig(): UseReqGlobalConfig` (L883-924)
809
+ ### fn `function loadGlobalConfig(): UseReqGlobalConfig` (L919-960)
802
810
  - @brief Loads and sanitizes the persisted global configuration.
803
811
  - @details Returns defaults when `~/.config/pi-usereq/config.json` is absent. Otherwise parses the global JSON payload, normalizes cross-project checker, tool, git, and notification fields, and ignores misplaced local keys without migration. Runtime is O(n) in file size. Side effects are limited to filesystem reads.
804
812
  - @return {UseReqGlobalConfig} Sanitized global configuration.
805
813
 
806
- ### fn `export function loadConfig(projectBase: string): UseReqConfig` (L934-941)
814
+ ### fn `export function loadConfig(projectBase: string): UseReqConfig` (L970-977)
807
815
  - @brief Loads and sanitizes the effective merged configuration.
808
816
  - @details Loads global configuration first so local static-check enable defaults can be derived from the active global checker map, then merges both scopes into the effective runtime config without applying legacy single-file migrations. Runtime is O(n) in combined local and global config size. Side effects are limited to filesystem reads.
809
817
  - @param[in] projectBase {string} Absolute project root path.
@@ -811,28 +819,28 @@ import { makeRelativeIfContainsProject } from "./utils.js";
811
819
  - @throws {ReqError} Throws with exit code `11` when either persisted config file contains invalid JSON or a non-object payload.
812
820
  - @satisfies CTN-012, CTN-013, CTN-018, CTN-019, REQ-066, REQ-137, REQ-146, REQ-163, REQ-174, REQ-178, REQ-184, REQ-185, REQ-196, REQ-204, REQ-205, REQ-212, REQ-215, REQ-234, REQ-235, REQ-236, REQ-237, REQ-238, REQ-239, REQ-249, REQ-277, REQ-315, REQ-316
813
821
 
814
- ### fn `function buildPersistedLocalConfig(config: UseReqConfig): UseReqLocalConfig` (L950-978)
822
+ ### fn `function buildPersistedLocalConfig(config: UseReqConfig): UseReqLocalConfig` (L986-1017)
815
823
  - @brief Builds the persisted local configuration payload.
816
824
  - @details Copies only project-scoped keys into a fresh object so runtime-derived metadata plus global checker, tool, git, and notification fields never reach `.pi-usereq.json`, while preserving the debug tool-wrapper command flag beside other local debug settings. Runtime is O(n) in config size. No external state is mutated.
817
825
  - @param[in] config {UseReqConfig} Effective configuration object.
818
826
  - @return {UseReqLocalConfig} Persistable local configuration payload.
819
- - @satisfies CTN-012, CTN-013, CTN-019, REQ-104, REQ-146, REQ-249, REQ-316, REQ-277
827
+ - @satisfies CTN-012, CTN-013, CTN-019, REQ-104, REQ-146, REQ-249, REQ-316, REQ-277, REQ-328
820
828
 
821
- ### fn `function buildPersistedGlobalConfig(config: UseReqConfig): UseReqGlobalConfig` (L987-1026)
829
+ ### fn `function buildPersistedGlobalConfig(config: UseReqConfig): UseReqGlobalConfig` (L1026-1065)
822
830
  - @brief Builds the persisted global configuration payload.
823
831
  - @details Copies only cross-project keys into a fresh object so local directory and debug fields never reach `~/.config/pi-usereq/config.json`, while forcing persisted worktree disablement when automatic git commit is disabled and forcing persisted Pushover disablement until both credentials are populated. Runtime is O(n) in config size. No external state is mutated.
824
832
  - @param[in] config {UseReqConfig} Effective configuration object.
825
833
  - @return {UseReqGlobalConfig} Persistable global configuration payload.
826
834
  - @satisfies REQ-137, REQ-163, REQ-174, REQ-178, REQ-184, REQ-196, REQ-204, REQ-205, REQ-212, REQ-234, REQ-249, REQ-315
827
835
 
828
- ### fn `function writeConfigFile(configPath: string, payload: object): void` (L1035-1038)
836
+ ### fn `function writeConfigFile(configPath: string, payload: object): void` (L1074-1077)
829
837
  - @brief Writes one normalized config payload to disk.
830
838
  - @details Creates the parent directory when required, formats JSON with two-space indentation, and terminates the file with a newline. Runtime is O(n) in serialized payload size. Side effects include directory creation and file overwrite.
831
839
  - @param[in] configPath {string} Absolute destination config path.
832
840
  - @param[in] payload {object} Persistable config payload.
833
841
  - @return {void} No return value.
834
842
 
835
- ### fn `export function saveLocalConfig(projectBase: string, config: UseReqConfig): void` (L1048-1050)
843
+ ### fn `export function saveLocalConfig(projectBase: string, config: UseReqConfig): void` (L1087-1089)
836
844
  - @brief Persists the local configuration scope to disk.
837
845
  - @details Serializes only project-scoped fields into `<base-path>/.pi-usereq.json`, excluding runtime-derived metadata and every global-scope configuration key. Runtime is O(n) in serialized local config size. Side effects include directory creation and file overwrite.
838
846
  - @param[in] projectBase {string} Absolute project root path.
@@ -840,14 +848,14 @@ import { makeRelativeIfContainsProject } from "./utils.js";
840
848
  - @return {void} No return value.
841
849
  - @satisfies CTN-012, REQ-104, REQ-146
842
850
 
843
- ### fn `export function saveGlobalConfig(config: UseReqConfig): void` (L1059-1061)
851
+ ### fn `export function saveGlobalConfig(config: UseReqConfig): void` (L1098-1100)
844
852
  - @brief Persists the global configuration scope to disk.
845
853
  - @details Serializes only cross-project fields into `~/.config/pi-usereq/config.json`, excluding every project-local directory and debug setting. Runtime is O(n) in serialized global config size. Side effects include directory creation and file overwrite.
846
854
  - @param[in] config {UseReqConfig} Effective configuration object to persist.
847
855
  - @return {void} No return value.
848
856
  - @satisfies CTN-012, CTN-018, REQ-137, REQ-146, REQ-315
849
857
 
850
- ### fn `export function saveConfig(projectBase: string, config: UseReqConfig): void` (L1071-1074)
858
+ ### fn `export function saveConfig(projectBase: string, config: UseReqConfig): void` (L1110-1113)
851
859
  - @brief Persists the effective configuration to local and global config files.
852
860
  - @details Splits the effective runtime config into project-scoped and cross-project payloads, then writes both files with normalized JSON formatting. Runtime is O(n) in combined serialized config size. Side effects include directory creation and file overwrite in both persistence locations.
853
861
  - @param[in] projectBase {string} Absolute project root path.
@@ -855,14 +863,14 @@ import { makeRelativeIfContainsProject } from "./utils.js";
855
863
  - @return {void} No return value.
856
864
  - @satisfies CTN-012, CTN-018, REQ-137, REQ-146, REQ-315
857
865
 
858
- ### fn `export function normalizeConfigPaths(projectBase: string, config: UseReqConfig): UseReqConfig` (L1083-1101)
866
+ ### fn `export function normalizeConfigPaths(projectBase: string, config: UseReqConfig): UseReqConfig` (L1122-1140)
859
867
  - @brief Normalizes persisted directory fields to project-relative forms.
860
868
  - @details Rewrites docs, tests, and source directories using project containment heuristics, strips trailing separators, and restores defaults for empty results. Runtime is O(n) in configured path count plus path-length processing. No filesystem writes occur.
861
869
  - @param[in] projectBase {string} Absolute project root path.
862
870
  - @param[in] config {UseReqConfig} Configuration object to normalize.
863
871
  - @return {UseReqConfig} Normalized configuration copy.
864
872
 
865
- ### fn `export function buildPromptReplacementPaths(` (L1111-1153)
873
+ ### fn `export function buildPromptReplacementPaths(` (L1150-1192)
866
874
  - @brief Builds placeholder replacements for bundled prompt rendering.
867
875
  - @details Computes runtime path context from the execution path, derives installation-owned template and guideline paths, enumerates visible guideline files from the installed resource tree, and returns the token map consumed by prompt templates. Runtime is O(g log g + s) where g is guideline count and s is source-directory count. Side effects are limited to filesystem reads.
868
876
  - @param[in] projectBase {string} Absolute project root path.
@@ -876,46 +884,47 @@ import { makeRelativeIfContainsProject } from "./utils.js";
876
884
  |`StaticCheckEntry`|iface||58-62|export interface StaticCheckEntry|
877
885
  |`StaticCheckEnabled`|type||68||
878
886
  |`StaticCheckLanguageConfig`|iface||74-77|export interface StaticCheckLanguageConfig|
879
- |`UseReqConfig`|iface||83-122|export interface UseReqConfig|
880
- |`LocalStaticCheckLanguageConfig`|iface||128-130|interface LocalStaticCheckLanguageConfig|
881
- |`GlobalStaticCheckLanguageConfig`|iface||136-138|interface GlobalStaticCheckLanguageConfig|
882
- |`UseReqLocalConfig`|iface||144-157|interface UseReqLocalConfig|
883
- |`UseReqGlobalConfig`|iface||163-191|interface UseReqGlobalConfig|
884
- |`cloneStaticCheckEntry`|fn||308-317|function cloneStaticCheckEntry(entry: StaticCheckEntry): ...|
885
- |`createStaticCheckLanguageConfig`|fn||326-335|export function createStaticCheckLanguageConfig(|
886
- |`createLocalStaticCheckLanguageConfig`|fn||343-347|function createLocalStaticCheckLanguageConfig(|
887
- |`createGlobalStaticCheckLanguageConfig`|fn||355-361|function createGlobalStaticCheckLanguageConfig(|
888
- |`getDefaultGlobalStaticCheckConfig`|fn||368-373|function getDefaultGlobalStaticCheckConfig(): Record<stri...|
889
- |`getDefaultLocalStaticCheckConfig`|fn||381-390|function getDefaultLocalStaticCheckConfig(|
890
- |`mergeStaticCheckConfig`|fn||399-418|function mergeStaticCheckConfig(|
891
- |`getDefaultStaticCheckConfig`|fn||426-432|export function getDefaultStaticCheckConfig(): Record<str...|
892
- |`normalizeStaticCheckEnabled`|fn||442-447|export function normalizeStaticCheckEnabled(|
893
- |`getActiveStaticCheckEntries`|fn||457-466|export function getActiveStaticCheckEntries(|
894
- |`normalizeAutoGitCommit`|fn||481-483|export function normalizeAutoGitCommit(value: unknown): "...|
895
- |`normalizeGitWorktreeEnabled`|fn||497-499|export function normalizeGitWorktreeEnabled(value: unknow...|
896
- |`resolveEffectiveGitWorktreeEnabled`|fn||508-513|export function resolveEffectiveGitWorktreeEnabled(|
897
- |`normalizeGitWorktreePrefix`|fn||527-533|export function normalizeGitWorktreePrefix(value: unknown...|
898
- |`getProjectConfigPath`|fn||540-542|export function getProjectConfigPath(projectBase: string)...|
899
- |`getGlobalConfigPath`|fn||549-551|export function getGlobalConfigPath(): string|
900
- |`getDefaultLocalConfig`|fn||560-577|function getDefaultLocalConfig(|
901
- |`getDefaultGlobalConfig`|fn||584-614|function getDefaultGlobalConfig(): UseReqGlobalConfig|
902
- |`mergeConfigScopes`|fn||623-690|function mergeConfigScopes(|
903
- |`getDefaultConfig`|fn||699-705|export function getDefaultConfig(_projectBase: string): U...|
904
- |`normalizeStaticCheckEntries`|fn||713-733|function normalizeStaticCheckEntries(value: unknown): Sta...|
905
- |`readConfigPayload`|fn||742-758|function readConfigPayload(configPath: string): Record<st...|
906
- |`normalizeLocalStaticCheckConfig`|fn||768-792|function normalizeLocalStaticCheckConfig(|
907
- |`normalizeGlobalStaticCheckConfig`|fn||801-818|function normalizeGlobalStaticCheckConfig(|
908
- |`loadLocalConfig`|fn||828-876|function loadLocalConfig(|
909
- |`loadGlobalConfig`|fn||883-924|function loadGlobalConfig(): UseReqGlobalConfig|
910
- |`loadConfig`|fn||934-941|export function loadConfig(projectBase: string): UseReqCo...|
911
- |`buildPersistedLocalConfig`|fn||950-978|function buildPersistedLocalConfig(config: UseReqConfig):...|
912
- |`buildPersistedGlobalConfig`|fn||987-1026|function buildPersistedGlobalConfig(config: UseReqConfig)...|
913
- |`writeConfigFile`|fn||1035-1038|function writeConfigFile(configPath: string, payload: obj...|
914
- |`saveLocalConfig`|fn||1048-1050|export function saveLocalConfig(projectBase: string, conf...|
915
- |`saveGlobalConfig`|fn||1059-1061|export function saveGlobalConfig(config: UseReqConfig): void|
916
- |`saveConfig`|fn||1071-1074|export function saveConfig(projectBase: string, config: U...|
917
- |`normalizeConfigPaths`|fn||1083-1101|export function normalizeConfigPaths(projectBase: string,...|
918
- |`buildPromptReplacementPaths`|fn||1111-1153|export function buildPromptReplacementPaths(|
887
+ |`UseReqConfig`|iface||83-125|export interface UseReqConfig|
888
+ |`LocalStaticCheckLanguageConfig`|iface||131-133|interface LocalStaticCheckLanguageConfig|
889
+ |`GlobalStaticCheckLanguageConfig`|iface||139-141|interface GlobalStaticCheckLanguageConfig|
890
+ |`UseReqLocalConfig`|iface||147-163|interface UseReqLocalConfig|
891
+ |`UseReqGlobalConfig`|iface||169-197|interface UseReqGlobalConfig|
892
+ |`normalizeContextFilesFlag`|fn||229-231|export function normalizeContextFilesFlag(value: unknown)...|
893
+ |`cloneStaticCheckEntry`|fn||331-340|function cloneStaticCheckEntry(entry: StaticCheckEntry): ...|
894
+ |`createStaticCheckLanguageConfig`|fn||349-358|export function createStaticCheckLanguageConfig(|
895
+ |`createLocalStaticCheckLanguageConfig`|fn||366-370|function createLocalStaticCheckLanguageConfig(|
896
+ |`createGlobalStaticCheckLanguageConfig`|fn||378-384|function createGlobalStaticCheckLanguageConfig(|
897
+ |`getDefaultGlobalStaticCheckConfig`|fn||391-396|function getDefaultGlobalStaticCheckConfig(): Record<stri...|
898
+ |`getDefaultLocalStaticCheckConfig`|fn||404-413|function getDefaultLocalStaticCheckConfig(|
899
+ |`mergeStaticCheckConfig`|fn||422-441|function mergeStaticCheckConfig(|
900
+ |`getDefaultStaticCheckConfig`|fn||449-455|export function getDefaultStaticCheckConfig(): Record<str...|
901
+ |`normalizeStaticCheckEnabled`|fn||465-470|export function normalizeStaticCheckEnabled(|
902
+ |`getActiveStaticCheckEntries`|fn||480-489|export function getActiveStaticCheckEntries(|
903
+ |`normalizeAutoGitCommit`|fn||504-506|export function normalizeAutoGitCommit(value: unknown): "...|
904
+ |`normalizeGitWorktreeEnabled`|fn||520-522|export function normalizeGitWorktreeEnabled(value: unknow...|
905
+ |`resolveEffectiveGitWorktreeEnabled`|fn||531-536|export function resolveEffectiveGitWorktreeEnabled(|
906
+ |`normalizeGitWorktreePrefix`|fn||550-556|export function normalizeGitWorktreePrefix(value: unknown...|
907
+ |`getProjectConfigPath`|fn||563-565|export function getProjectConfigPath(projectBase: string)...|
908
+ |`getGlobalConfigPath`|fn||572-574|export function getGlobalConfigPath(): string|
909
+ |`getDefaultLocalConfig`|fn||583-603|function getDefaultLocalConfig(|
910
+ |`getDefaultGlobalConfig`|fn||610-640|function getDefaultGlobalConfig(): UseReqGlobalConfig|
911
+ |`mergeConfigScopes`|fn||650-720|function mergeConfigScopes(|
912
+ |`getDefaultConfig`|fn||729-735|export function getDefaultConfig(_projectBase: string): U...|
913
+ |`normalizeStaticCheckEntries`|fn||743-763|function normalizeStaticCheckEntries(value: unknown): Sta...|
914
+ |`readConfigPayload`|fn||772-788|function readConfigPayload(configPath: string): Record<st...|
915
+ |`normalizeLocalStaticCheckConfig`|fn||798-822|function normalizeLocalStaticCheckConfig(|
916
+ |`normalizeGlobalStaticCheckConfig`|fn||831-848|function normalizeGlobalStaticCheckConfig(|
917
+ |`loadLocalConfig`|fn||858-912|function loadLocalConfig(|
918
+ |`loadGlobalConfig`|fn||919-960|function loadGlobalConfig(): UseReqGlobalConfig|
919
+ |`loadConfig`|fn||970-977|export function loadConfig(projectBase: string): UseReqCo...|
920
+ |`buildPersistedLocalConfig`|fn||986-1017|function buildPersistedLocalConfig(config: UseReqConfig):...|
921
+ |`buildPersistedGlobalConfig`|fn||1026-1065|function buildPersistedGlobalConfig(config: UseReqConfig)...|
922
+ |`writeConfigFile`|fn||1074-1077|function writeConfigFile(configPath: string, payload: obj...|
923
+ |`saveLocalConfig`|fn||1087-1089|export function saveLocalConfig(projectBase: string, conf...|
924
+ |`saveGlobalConfig`|fn||1098-1100|export function saveGlobalConfig(config: UseReqConfig): void|
925
+ |`saveConfig`|fn||1110-1113|export function saveConfig(projectBase: string, config: U...|
926
+ |`normalizeConfigPaths`|fn||1122-1140|export function normalizeConfigPaths(projectBase: string,...|
927
+ |`buildPromptReplacementPaths`|fn||1150-1192|export function buildPromptReplacementPaths(|
919
928
 
920
929
 
921
930
  ---
@@ -3327,7 +3336,7 @@ import type { PromptCommandExecutionPlan } from "./prompt-command-runtime.js";
3327
3336
 
3328
3337
  ---
3329
3338
 
3330
- # prompts.ts | TypeScript | 314L | 9 symbols | 7 imports | 17 comments
3339
+ # prompts.ts | TypeScript | 425L | 11 symbols | 8 imports | 21 comments
3331
3340
  > Path: `src/core/prompts.ts`
3332
3341
  - @brief Renders bundled pi-usereq prompts for the current project context.
3333
3342
  - @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.
@@ -3336,8 +3345,9 @@ import type { PromptCommandExecutionPlan } from "./prompt-command-runtime.js";
3336
3345
  ```
3337
3346
  import fs from "node:fs";
3338
3347
  import path from "node:path";
3339
- import { buildPromptReplacementPaths, type UseReqConfig } from "./config.js";
3340
- import { formatRuntimePathForDisplay } from "./path-context.js";
3348
+ import {
3349
+ import {
3350
+ import { formatRuntimePathForDisplay, normalizeRelativeDirContract } from "./path-context.js";
3341
3351
  import type {
3342
3352
  import { getPromptRequiredDocs } from "./prompt-command-runtime.js";
3343
3353
  import { readBundledInstruction, readBundledPrompt } from "./resources.js";
@@ -3345,7 +3355,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3345
3355
 
3346
3356
  ## Definitions
3347
3357
 
3348
- ### fn `function buildPiDevConformanceBlock(promptName: string, projectBase: string): string` (L109-118)
3358
+ ### fn `function buildPiDevConformanceBlock(promptName: string, projectBase: string): string` (L119-128)
3349
3359
  - @brief Builds the conditional pi.dev governance block for one rendered prompt.
3350
3360
  - @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.
3351
3361
  - @param[in] promptName {string} Bundled prompt identifier.
@@ -3353,7 +3363,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3353
3363
  - @return {string} Markdown bullet block or the empty string when injection is not applicable.
3354
3364
  - @satisfies REQ-032, REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275
3355
3365
 
3356
- ### fn `function injectPiDevConformanceBlock(text: string, promptName: string, projectBase: string): string` (L129-136)
3366
+ ### fn `function injectPiDevConformanceBlock(text: string, promptName: string, projectBase: string): string` (L139-146)
3357
3367
  - @brief Injects the pi.dev governance block into the prompt behavior section.
3358
3368
  - @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).
3359
3369
  - @param[in] text {string} Prompt markdown after placeholder replacement.
@@ -3362,14 +3372,22 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3362
3372
  - @return {string} Prompt markdown with zero or one injected conformance block.
3363
3373
  - @satisfies REQ-032, REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275
3364
3374
 
3365
- ### fn `export function adaptPromptForInternalTools(text: string): string` (L145-151)
3375
+ ### fn `function buildContextFilesBlock(projectBase: string, config: UseReqConfig): string` (L167-184)
3376
+ - @brief Builds the markdown block that replaces the `%%CONTEXT_FILES%%` prompt token.
3377
+ - @details Iterates the documented `REQUIREMENTS.md`, `REFERENCES.md`, `WORKFLOW.md` order, skips disabled flags and missing files without error, and renders each remaining file as a file-name heading, an HTML `<file name="<docs-dir>/<filename>">` reference with `%%DOC_PATH%%` pre-substituted, and the raw file content inside four-backtick `markdown` fences. Runtime is O(n) in aggregate context-file size. Side effects are limited to filesystem reads.
3378
+ - @param[in] projectBase {string} Absolute project root used to resolve the configured docs directory.
3379
+ - @param[in] config {UseReqConfig} Effective project configuration supplying the docs directory and context-file flags.
3380
+ - @return {string} Rendered markdown block, or the empty string when no enabled context file exists.
3381
+ - @satisfies REQ-329, REQ-330, REQ-331, REQ-332
3382
+
3383
+ ### fn `export function adaptPromptForInternalTools(text: string): string` (L193-199)
3366
3384
  - @brief Rewrites bundled prompt tool references from legacy `req --...` syntax to internal tool names.
3367
3385
  - @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.
3368
3386
  - @param[in] text {string} Prompt markdown before tool-reference normalization.
3369
3387
  - @return {string} Prompt markdown with internal tool names.
3370
3388
  - @satisfies REQ-003
3371
3389
 
3372
- ### fn `export function applyReplacements(text: string, replacements: Record<string, string>): string` (L161-167)
3390
+ ### fn `export function applyReplacements(text: string, replacements: Record<string, string>): string` (L209-215)
3373
3391
  - @brief Applies literal placeholder replacements to bundled prompt markdown.
3374
3392
  - @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.
3375
3393
  - @param[in] text {string} Prompt markdown containing placeholder tokens.
@@ -3377,7 +3395,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3377
3395
  - @return {string} Prompt markdown with all placeholder tokens expanded.
3378
3396
  - @satisfies REQ-002
3379
3397
 
3380
- ### fn `function buildPromptExecutionBlock(` (L177-199)
3398
+ ### fn `function buildPromptExecutionBlock(` (L225-247)
3381
3399
  - @brief Builds the prompt-command execution block injected at prompt start.
3382
3400
  - @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.
3383
3401
  - @param[in] promptName {PromptCommandName} Bundled prompt identifier.
@@ -3385,7 +3403,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3385
3403
  - @return {string} Markdown block or the empty string when runtime execution metadata is unavailable.
3386
3404
  - @satisfies REQ-200, REQ-201, REQ-202, REQ-206, REQ-207, REQ-208, REQ-209
3387
3405
 
3388
- ### fn `function injectPromptExecutionBlock(` (L209-220)
3406
+ ### fn `function injectPromptExecutionBlock(` (L257-268)
3389
3407
  - @brief Injects the prompt-command execution block near the start of the rendered prompt.
3390
3408
  - @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).
3391
3409
  - @param[in] text {string} Prompt markdown after placeholder replacement.
@@ -3393,7 +3411,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3393
3411
  - @param[in] executionPlan {PromptCommandExecutionPlan | undefined} Prepared execution plan.
3394
3412
  - @return {string} Prompt markdown with zero or one injected execution block.
3395
3413
 
3396
- ### fn `function buildPromptReplacements(` (L232-244)
3414
+ ### fn `function buildPromptReplacements(` (L280-292)
3397
3415
  - @brief Builds prompt-specific runtime placeholder replacements.
3398
3416
  - @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.
3399
3417
  - @param[in] promptName {string} Bundled prompt identifier without the `req-` prefix.
@@ -3403,7 +3421,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3403
3421
  - @return {Record<string, string>} Prompt-specific placeholder-to-value map.
3404
3422
  - @satisfies REQ-002, REQ-211
3405
3423
 
3406
- ### fn `function renderBundledCommitInstruction(` (L256-270)
3424
+ ### fn `function renderBundledCommitInstruction(` (L304-318)
3407
3425
  - @brief Renders the bundled git instruction injected through `%%COMMIT%%`.
3408
3426
  - @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.
3409
3427
  - @param[in] promptName {string} Bundled prompt identifier without the `req-` prefix.
@@ -3413,7 +3431,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3413
3431
  - @return {string} Rendered bundled git instruction selected for the current automatic-commit mode.
3414
3432
  - @satisfies REQ-211, REQ-213, REQ-214
3415
3433
 
3416
- ### fn `export function renderPrompt(` (L283-314)
3434
+ ### fn `export function renderPrompt(` (L331-367)
3417
3435
  - @brief Renders a bundled prompt for the current project context.
3418
3436
  - @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.
3419
3437
  - @param[in] promptName {string} Bundled prompt identifier.
@@ -3422,20 +3440,31 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
3422
3440
  - @param[in] config {UseReqConfig} Effective project configuration used for path substitutions.
3423
3441
  - @param[in] executionPlan {PromptCommandExecutionPlan | undefined} Optional prompt-command execution plan used for injected runtime guidance.
3424
3442
  - @return {string} Fully rendered prompt markdown ready for `pi.sendUserMessage(...)`.
3425
- - @satisfies REQ-002, REQ-003, REQ-032, REQ-033, REQ-034, REQ-108, REQ-200, REQ-201, REQ-202, REQ-206, REQ-207, REQ-208, REQ-209, REQ-211, REQ-213, REQ-214, REQ-273, REQ-274, REQ-275
3443
+ - @satisfies REQ-002, REQ-003, REQ-032, REQ-033, REQ-034, REQ-108, REQ-200, REQ-201, REQ-202, REQ-206, REQ-207, REQ-208, REQ-209, REQ-211, REQ-213, REQ-214, REQ-273, REQ-274, REQ-275, REQ-329, REQ-330, REQ-331, REQ-332
3444
+
3445
+ ### fn `export function renderPromptCommandSummary(` (L385-425)
3446
+ - @brief Builds the on-screen command invocation summary for one bundled prompt-backed `req-<prompt>` command.
3447
+ - @details Renders the command name without the `req-` prefix in uppercase, the user request arguments, and the active configuration fields (`docs-dir`, `src-dir`, `tests-dir`, enabled context files, `AUTO_GIT_COMMIT`, effective `GIT_WORKTREE_ENABLED`, `GIT_WORKTREE_PREFIX`, enabled static-check languages, and `enabled-tools`) so the TUI shows only a compact summary while the full rendered prompt is delivered hidden to the LLM agent. Static-check languages are emitted in canonical `DEFAULT_STATIC_CHECK_LANGUAGES` order; enabled tools are emitted in documented menu order via `comparePiUsereqStartupToolNames`. Runtime is O(l + t log t) where l is language count and t is enabled-tool count. No external state is mutated.
3448
+ - @param[in] promptName {string} Bundled prompt name without the `req-` prefix.
3449
+ - @param[in] args {string} User request arguments passed to the slash command.
3450
+ - @param[in] config {UseReqConfig} Effective project configuration supplying directory, git, static-check, and tool fields.
3451
+ - @return {string} Multi-line command invocation summary text.
3452
+ - @satisfies REQ-335, REQ-336, REQ-337
3426
3453
 
3427
3454
  ## Symbol Index
3428
3455
  |Symbol|Kind|Vis|Lines|Sig|
3429
3456
  |---|---|---|---|---|
3430
- |`buildPiDevConformanceBlock`|fn||109-118|function buildPiDevConformanceBlock(promptName: string, p...|
3431
- |`injectPiDevConformanceBlock`|fn||129-136|function injectPiDevConformanceBlock(text: string, prompt...|
3432
- |`adaptPromptForInternalTools`|fn||145-151|export function adaptPromptForInternalTools(text: string)...|
3433
- |`applyReplacements`|fn||161-167|export function applyReplacements(text: string, replaceme...|
3434
- |`buildPromptExecutionBlock`|fn||177-199|function buildPromptExecutionBlock(|
3435
- |`injectPromptExecutionBlock`|fn||209-220|function injectPromptExecutionBlock(|
3436
- |`buildPromptReplacements`|fn||232-244|function buildPromptReplacements(|
3437
- |`renderBundledCommitInstruction`|fn||256-270|function renderBundledCommitInstruction(|
3438
- |`renderPrompt`|fn||283-314|export function renderPrompt(|
3457
+ |`buildPiDevConformanceBlock`|fn||119-128|function buildPiDevConformanceBlock(promptName: string, p...|
3458
+ |`injectPiDevConformanceBlock`|fn||139-146|function injectPiDevConformanceBlock(text: string, prompt...|
3459
+ |`buildContextFilesBlock`|fn||167-184|function buildContextFilesBlock(projectBase: string, conf...|
3460
+ |`adaptPromptForInternalTools`|fn||193-199|export function adaptPromptForInternalTools(text: string)...|
3461
+ |`applyReplacements`|fn||209-215|export function applyReplacements(text: string, replaceme...|
3462
+ |`buildPromptExecutionBlock`|fn||225-247|function buildPromptExecutionBlock(|
3463
+ |`injectPromptExecutionBlock`|fn||257-268|function injectPromptExecutionBlock(|
3464
+ |`buildPromptReplacements`|fn||280-292|function buildPromptReplacements(|
3465
+ |`renderBundledCommitInstruction`|fn||304-318|function renderBundledCommitInstruction(|
3466
+ |`renderPrompt`|fn||331-367|export function renderPrompt(|
3467
+ |`renderPromptCommandSummary`|fn||385-425|export function renderPromptCommandSummary(|
3439
3468
 
3440
3469
 
3441
3470
  ---
@@ -4723,7 +4752,7 @@ import path from "node:path";
4723
4752
 
4724
4753
  ---
4725
4754
 
4726
- # index.ts | TypeScript | 4413L | 102 symbols | 27 imports | 107 comments
4755
+ # index.ts | TypeScript | 4582L | 106 symbols | 27 imports | 110 comments
4727
4756
  > Path: `src/index.ts`
4728
4757
  - @brief Registers the pi-usereq extension commands, tools, and configuration UI.
4729
4758
  - @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.
@@ -4742,7 +4771,7 @@ import {
4742
4771
  import {
4743
4772
  import { showPiUsereqSettingsMenu, type PiUsereqSettingsMenuChoice } from "./core/settings-menu.js";
4744
4773
  import {
4745
- import { renderPrompt } from "./core/prompts.js";
4774
+ import {
4746
4775
  import {
4747
4776
  import {
4748
4777
  import {
@@ -4761,55 +4790,55 @@ import { makeRelativeIfContainsProject, shellSplit } from "./core/utils.js";
4761
4790
 
4762
4791
  ## Definitions
4763
4792
 
4764
- ### iface `interface PiShortcutRegistrar` (L181-189)
4793
+ ### iface `interface PiShortcutRegistrar` (L186-194)
4765
4794
  - @brief Describes the optional shortcut-registration surface used by pi-usereq.
4766
4795
  - @details Narrows the runtime API to the documented `registerShortcut(...)`
4767
4796
  method so the extension can remain compatible with offline harnesses that do
4768
4797
  not implement shortcut capture. Compile-time only and introduces no runtime
4769
4798
  cost.
4770
4799
 
4771
- ### fn `function getProjectBase(cwd: string): string` (L197-206)
4800
+ ### fn `function getProjectBase(cwd: string): string` (L202-211)
4772
4801
  - @brief Resolves the effective project base from a working directory.
4773
4802
  - @details Normalizes the provided cwd into an absolute path without consulting configuration. Time complexity is O(1). No I/O side effects occur.
4774
4803
  - @param[in] cwd {string} Current working directory.
4775
4804
  - @return {string} Absolute project base path.
4776
4805
 
4777
- ### fn `function getProcessCwdSafe(): string` (L213-222)
4806
+ ### fn `function getProcessCwdSafe(): string` (L218-227)
4778
4807
  - @brief Resolves a safe process working directory for extension-load paths.
4779
4808
  - @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.
4780
4809
  - @return {string} Absolute fallback-safe process working directory.
4781
4810
 
4782
- ### fn `function resolveLiveBootstrapCwd(cwd: string): string` (L230-242)
4811
+ ### fn `function resolveLiveBootstrapCwd(cwd: string): string` (L235-247)
4783
4812
  - @brief Resolves the live working directory used for bootstrap-sensitive flows.
4784
4813
  - @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.
4785
4814
  - @param[in] cwd {string} Candidate context cwd.
4786
4815
  - @return {string} Existing absolute cwd used for bootstrap work.
4787
4816
 
4788
- ### fn `function syncContextCwdMirror(ctx: { cwd?: string }, cwd: string): void` (L251-260)
4817
+ ### fn `function syncContextCwdMirror(ctx: { cwd?: string }, cwd: string): void` (L256-265)
4789
4818
  - @brief Best-effort synchronizes one context `cwd` mirror with bootstrap reality.
4790
4819
  - @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.
4791
4820
  - @param[in] cwd {string} Resolved live cwd.
4792
4821
  - @param[in,out] ctx {{ cwd?: string }} Mutable context-like object.
4793
4822
  - @return {void} No return value.
4794
4823
 
4795
- ### fn `function loadProjectConfig(cwd: string): UseReqConfig` (L269-272)
4824
+ ### fn `function loadProjectConfig(cwd: string): UseReqConfig` (L274-277)
4796
4825
  - @brief Loads project configuration for the extension runtime.
4797
4826
  - @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.
4798
4827
  - @param[in] cwd {string} Current working directory.
4799
4828
  - @return {UseReqConfig} Effective project configuration.
4800
4829
  - @satisfies REQ-030, REQ-145, REQ-146
4801
4830
 
4802
- - type `type DebugToolCommandExecuteResult = ReturnType<typeof buildMonolithicToolExecuteResult>;` (L278)
4831
+ - type `type DebugToolCommandExecuteResult = ReturnType<typeof buildMonolithicToolExecuteResult>;` (L283)
4803
4832
  - @brief Describes the execute-result surface reused by debug tool wrapper commands.
4804
4833
  - @details Narrows debug slash-command handlers to the same monolithic content-plus-execution wrapper returned by agent tools so editor output and notifications can reuse shared extraction helpers. The alias is compile-time only and introduces no runtime cost.
4805
- ### fn `function shouldRegisterDebugToolCommands(cwd: string): boolean` (L287-293)
4834
+ ### fn `function shouldRegisterDebugToolCommands(cwd: string): boolean` (L292-298)
4806
4835
  - @brief Tests whether debug tool wrapper commands should be registered for one runtime cwd.
4807
4836
  - @details Loads the effective project configuration for the supplied cwd and returns `true` only when `DEBUG_TOOL_COMMANDS_ENABLED` resolves to `enable`. Malformed or unreadable config payloads degrade to `false` so extension activation never aborts while deciding whether to register optional debug commands. Runtime is dominated by config I/O. Side effects are limited to filesystem reads.
4808
4837
  - @param[in] cwd {string} Candidate runtime working directory.
4809
4838
  - @return {boolean} `true` when debug tool wrapper commands should be registered.
4810
4839
  - @satisfies REQ-323
4811
4840
 
4812
- ### fn `function writeDebugToolCommandResultToEditor(` (L304-318)
4841
+ ### fn `function writeDebugToolCommandResultToEditor(` (L309-323)
4813
4842
  - @brief Writes one debug tool-wrapper result into the editor and emits a status notification.
4814
4843
  - @details Extracts the primary monolithic content text from the wrapped tool result, forwards that exact text to the editor, and emits an informational or error notification keyed by the tool exit code. Runtime is O(n) in output length. Side effects include editor-text mutation and UI notifications.
4815
4844
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -4818,7 +4847,7 @@ cost.
4818
4847
  - @return {void} No return value.
4819
4848
  - @satisfies REQ-324
4820
4849
 
4821
- ### fn `function executeDebugToolCommand(` (L330-348)
4850
+ ### fn `function executeDebugToolCommand(` (L335-353)
4822
4851
  - @brief Executes one config-gated debug tool wrapper slash command.
4823
4852
  - @details Resolves a live cwd for the invoking command context, refreshes runtime path state, loads the effective project configuration, rejects execution when debug tool wrapper commands are disabled, and otherwise writes the selected wrapped tool output into the editor. Runtime is dominated by the delegated tool runner. Side effects include runtime-path bootstrap, filesystem reads, optional tool side effects, editor-text mutation, and UI notifications.
4824
4853
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -4828,14 +4857,14 @@ cost.
4828
4857
  - @throws {ReqError} Throws when debug tool wrapper commands are disabled for the active project.
4829
4858
  - @satisfies REQ-324, REQ-325
4830
4859
 
4831
- ### fn `function registerDebugToolCommands(pi: ExtensionAPI): void` (L357-396)
4860
+ ### fn `function registerDebugToolCommands(pi: ExtensionAPI): void` (L362-401)
4832
4861
  - @brief Registers config-gated debug slash-command wrappers for selected project analysis tools.
4833
4862
  - @details Registers `debug-compress`, `debug-references`, `debug-static-check`, `debug-summarize`, and `debug-tokens` as extension commands that reuse the same runner paths as the corresponding agent tools and write the resulting monolithic text into the editor instead of the LLM content channel. Re-registering the same commands is idempotent because pi keeps the latest same-extension command definition per name. Runtime is O(1) for registration; handler cost depends on the selected runner. Side effects include command registration.
4834
4863
  - @param[in] pi {ExtensionAPI} Active extension API instance.
4835
4864
  - @return {void} No return value.
4836
4865
  - @satisfies DES-015, REQ-323, REQ-324, REQ-325
4837
4866
 
4838
- ### fn `function saveProjectConfig(cwd: string, config: UseReqConfig): void` (L406-409)
4867
+ ### fn `function saveProjectConfig(cwd: string, config: UseReqConfig): void` (L411-414)
4839
4868
  - @brief Persists effective project configuration from the extension runtime.
4840
4869
  - @details Resolves the project base, normalizes configured local directory paths into project-relative form, and delegates split local/global persistence to `saveConfig` without serializing runtime-derived path metadata. Runtime is O(n) in config size. Side effects include config-file writes.
4841
4870
  - @param[in] cwd {string} Current working directory.
@@ -4843,38 +4872,38 @@ cost.
4843
4872
  - @return {void} No return value.
4844
4873
  - @satisfies REQ-146, REQ-315
4845
4874
 
4846
- ### fn `function formatLocalConfigPathForMenu(cwd: string): string` (L418-422)
4875
+ ### fn `function formatLocalConfigPathForMenu(cwd: string): string` (L423-427)
4847
4876
  - @brief Formats the current local config path for top-level menu display.
4848
4877
  - @details Resolves `<base-path>/.pi-usereq.json` from the cwd-derived project base and reuses the shared runtime-path formatter so the `Show local configuration` row uses the documented `~`-relative display contract. Runtime is O(p) in path length. No external state is mutated.
4849
4878
  - @param[in] cwd {string} Current working directory.
4850
4879
  - @return {string} `~`-relative or absolute local config-path display value.
4851
4880
  - @satisfies REQ-162
4852
4881
 
4853
- ### fn `function formatGlobalConfigPathForMenu(): string` (L430-432)
4882
+ ### fn `function formatGlobalConfigPathForMenu(): string` (L435-437)
4854
4883
  - @brief Formats the current global config path for top-level menu display.
4855
4884
  - @details Resolves `~/.config/pi-usereq/config.json` through the shared runtime-path formatter so the `Show global configuration` row uses the documented `~`-relative display contract. Runtime is O(p) in path length. No external state is mutated.
4856
4885
  - @return {string} `~`-relative or absolute global config-path display value.
4857
4886
  - @satisfies REQ-319
4858
4887
 
4859
- ### fn `function buildTerminalSettingsMenuChoices(options:` (L441-452)
4888
+ ### fn `function buildTerminalSettingsMenuChoices(options:` (L446-457)
4860
4889
  - @brief Builds the standardized terminal rows appended to every configuration menu.
4861
4890
  - @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.
4862
4891
  - @param[in] options {{ resetDefaultsDescription: string }} Menu-specific terminal-row metadata.
4863
4892
  - @return {PiUsereqSettingsMenuChoice[]} Ordered terminal menu rows.
4864
4893
  - @satisfies REQ-193
4865
4894
 
4866
- ### iface `interface ResetConfirmationChange` (L458-462)
4895
+ ### iface `interface ResetConfirmationChange` (L463-467)
4867
4896
  - @brief Describes one pending reset value change shown in confirmation menus.
4868
4897
  - @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.
4869
4898
 
4870
- ### fn `function formatResetConfirmationValue(previousValue: string, nextValue: string): string` (L471-473)
4899
+ ### fn `function formatResetConfirmationValue(previousValue: string, nextValue: string): string` (L476-478)
4871
4900
  - @brief Formats one reset-confirmation value pair for menu display.
4872
4901
  - @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.
4873
4902
  - @param[in] previousValue {string} Current persisted value.
4874
4903
  - @param[in] nextValue {string} Candidate default value.
4875
4904
  - @return {string} Rendered preview string.
4876
4905
 
4877
- ### fn `function buildResetConfirmationChoices(` (L483-522)
4906
+ ### fn `function buildResetConfirmationChoices(` (L488-527)
4878
4907
  - @brief Builds the shared settings-menu choices for one reset-confirmation submenu.
4879
4908
  - @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.
4880
4909
  - @param[in] changes {ResetConfirmationChange[]} Changed-value preview rows.
@@ -4882,7 +4911,7 @@ cost.
4882
4911
  - @param[in] abortDescription {string} Description for the abort action.
4883
4912
  - @return {PiUsereqSettingsMenuChoice[]} Reset-confirmation submenu choices.
4884
4913
 
4885
- ### fn `async function confirmResetChanges(` (L534-547)
4914
+ ### fn `async function confirmResetChanges(` (L539-552)
4886
4915
  - @brief Opens one explicit reset-confirmation submenu.
4887
4916
  - @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.
4888
4917
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -4892,14 +4921,14 @@ cost.
4892
4921
  - @param[in] abortDescription {string} Description for the abort action.
4893
4922
  - @return {Promise<boolean>} `true` when the reset is explicitly approved.
4894
4923
 
4895
- ### fn `function writePersistedConfigToEditor(` (L556-561)
4924
+ ### fn `function writePersistedConfigToEditor(` (L561-566)
4896
4925
  - @brief Writes one already-persisted config file text into the editor.
4897
4926
  - @details Reads the target config file from disk after the caller has saved any pending changes and forwards the exact persisted text into the editor. Runtime is O(n) in serialized config size. Side effects include filesystem reads and editor-text mutation.
4898
4927
  - @param[in] ctx {ExtensionCommandContext} Active command context.
4899
4928
  - @param[in] configPath {string} Absolute persisted config path.
4900
4929
  - @return {void} No return value.
4901
4930
 
4902
- ### fn `function writePersistedLocalConfigToEditor(` (L571-577)
4931
+ ### fn `function writePersistedLocalConfigToEditor(` (L576-582)
4903
4932
  - @brief Writes the already-persisted local configuration file text into the editor.
4904
4933
  - @details Reads `<base-path>/.pi-usereq.json` from disk after the caller has saved any pending local and global configuration changes, then 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.
4905
4934
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -4907,58 +4936,58 @@ cost.
4907
4936
  - @return {void} No return value.
4908
4937
  - @satisfies REQ-031
4909
4938
 
4910
- ### fn `function writePersistedGlobalConfigToEditor(` (L586-590)
4939
+ ### fn `function writePersistedGlobalConfigToEditor(` (L591-595)
4911
4940
  - @brief Writes the already-persisted global configuration file text into the editor.
4912
4941
  - @details Reads `~/.config/pi-usereq/config.json` from disk after the caller has saved any pending local and global configuration changes, then 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.
4913
4942
  - @param[in] ctx {ExtensionCommandContext} Active command context.
4914
4943
  - @return {void} No return value.
4915
4944
  - @satisfies REQ-318
4916
4945
 
4917
- ### fn `function buildSearchToolSupportedTagGuidelines(): string[]` (L651-655)
4946
+ ### fn `function buildSearchToolSupportedTagGuidelines(): string[]` (L656-660)
4918
4947
  - @brief Builds the supported-tag guidance lines embedded in search-tool registrations.
4919
4948
  - @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.
4920
4949
  - @return {string[]} Supported-tag guidance lines.
4921
4950
 
4922
- ### fn `function buildSearchToolSchemaDescription(scope: FindToolScope): string` (L663-668)
4951
+ ### fn `function buildSearchToolSchemaDescription(scope: FindToolScope): string` (L668-673)
4923
4952
  - @brief Builds the schema description for one search-tool registration.
4924
4953
  - @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.
4925
4954
  - @param[in] scope {FindToolScope} Search-tool scope.
4926
4955
  - @return {string} Parameter-schema description.
4927
4956
 
4928
- ### fn `function buildSearchToolPromptGuidelines(scope: FindToolScope): string[]` (L676-689)
4957
+ ### fn `function buildSearchToolPromptGuidelines(scope: FindToolScope): string[]` (L681-694)
4929
4958
  - @brief Builds the prompt-guideline set for one search-tool registration.
4930
4959
  - @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.
4931
4960
  - @param[in] scope {FindToolScope} Search-tool scope.
4932
4961
  - @return {string[]} Prompt-guideline strings.
4933
4962
 
4934
- - type `type MonolithicToolRenderResult = {` (L695)
4963
+ - type `type MonolithicToolRenderResult = {` (L700)
4935
4964
  - @brief Describes the monolithic tool-result surface consumed by tool-row renderers.
4936
4965
  - @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.
4937
- ### fn `function getMonolithicToolText(result: MonolithicToolRenderResult): string` (L712-715)
4966
+ ### fn `function getMonolithicToolText(result: MonolithicToolRenderResult): string` (L717-720)
4938
4967
  - @brief Extracts the primary monolithic text block from one tool result.
4939
4968
  - @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.
4940
4969
  - @param[in] result {MonolithicToolRenderResult} Tool result wrapper.
4941
4970
  - @return {string} Primary monolithic content text.
4942
4971
 
4943
- ### fn `function getMonolithicToolErrorText(result: MonolithicToolRenderResult): string | undefined` (L723-733)
4972
+ ### fn `function getMonolithicToolErrorText(result: MonolithicToolRenderResult): string | undefined` (L728-738)
4944
4973
  - @brief Reads the first residual execution error string from one monolithic tool result.
4945
4974
  - @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.
4946
4975
  - @param[in] result {MonolithicToolRenderResult} Tool result wrapper.
4947
4976
  - @return {string | undefined} First residual execution error string.
4948
4977
 
4949
- ### fn `function formatCompactToolArgumentValue(value: unknown): string | undefined` (L741-780)
4978
+ ### fn `function formatCompactToolArgumentValue(value: unknown): string | undefined` (L746-785)
4950
4979
  - @brief Formats one scalar or structural tool argument for compact render summaries.
4951
4980
  - @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.
4952
4981
  - @param[in] value {unknown} Candidate tool argument value.
4953
4982
  - @return {string | undefined} Compact preview string or `undefined` when the value carries no useful summary.
4954
4983
 
4955
- ### fn `function buildCompactToolInvocationText(args: Record<string, unknown> | undefined): string` (L788-799)
4984
+ ### fn `function buildCompactToolInvocationText(args: Record<string, unknown> | undefined): string` (L793-804)
4956
4985
  - @brief Builds the compact invocation summary appended to collapsed tool rows.
4957
4986
  - @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.
4958
4987
  - @param[in] args {Record<string, unknown> | undefined} Current tool call arguments.
4959
4988
  - @return {string} Compact invocation summary prefixed with one separating space, or the empty string when no useful preview exists.
4960
4989
 
4961
- ### fn `function summarizeStructuredToolResult(` (L809-824)
4990
+ ### fn `function summarizeStructuredToolResult(` (L814-829)
4962
4991
  - @brief Builds the compact default text for one monolithic tool result row.
4963
4992
  - @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.
4964
4993
  - @param[in] toolName {string} Registered tool name.
@@ -4966,36 +4995,37 @@ cost.
4966
4995
  - @param[in] args {Record<string, unknown> | undefined} Current tool call arguments.
4967
4996
  - @return {string} Compact single-line summary.
4968
4997
 
4969
- ### fn `function buildStructuredToolRenderResult(toolName: string)` (L833-852)
4998
+ ### fn `function buildStructuredToolRenderResult(toolName: string)` (L838-857)
4970
4999
  - @brief Builds a custom `renderResult` implementation for one monolithic tool.
4971
5000
  - @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.
4972
5001
  - @param[in] toolName {string} Registered tool name.
4973
5002
  - @return {(result: MonolithicToolRenderResult, options: { expanded?: boolean; isPartial?: boolean }, _theme: unknown, context: { args?: Record<string, unknown>; lastComponent?: unknown }) => Text} Custom result renderer.
4974
5003
  - @satisfies REQ-210
4975
5004
 
4976
- ### fn `function executeMonolithicTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (L860-866)
5005
+ ### fn `function executeMonolithicTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (L865-871)
4977
5006
  - @brief Executes one CLI-style runner for a monolithic agent tool.
4978
5007
  - @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.
4979
5008
  - @param[in] operation {() => ToolResult} Runner callback.
4980
5009
  - @return {ReturnType<typeof buildMonolithicToolExecuteResult>} Monolithic tool execute result.
4981
5010
 
4982
- ### fn `function executeStatusTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (L875-904)
5011
+ ### fn `function executeStatusTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (L880-909)
4983
5012
  - @brief Executes one CLI-style runner for a status-only agent tool.
4984
5013
  - @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.
4985
5014
  - @param[in] operation {() => ToolResult} Runner callback.
4986
5015
  - @return {ReturnType<typeof buildMonolithicToolExecuteResult>} Status-only tool execute result.
4987
5016
  - @satisfies REQ-294, REQ-295, REQ-296
4988
5017
 
4989
- ### fn `function deliverPromptCommand(` (L915-933)
5018
+ ### fn `function deliverPromptCommand(` (L921-970)
4990
5019
  - @brief Starts delivery of one rendered prompt into the current active session.
4991
- - @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.
5020
+ - @details Prefers the replacement-session `sendMessage(...)` helper exposed by `withSession(...)` callbacks after session replacement so post-switch prompt delivery never reuses stale pre-switch session-bound extension objects. Delivers the rendered prompt as a `display:false` custom message with `triggerTurn:true` so the full content reaches the LLM agent without appearing on screen, and emits a `display:true` command invocation summary so the TUI shows only the compact summary. Returns the underlying hidden-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 `sendUserMessage(...)` only for non-replacement flows or runtimes that do not expose `sendMessage`. Runtime is O(n) in prompt length. Side effects are limited to hidden prompt delivery plus on-screen summary display.
4992
5021
  - @param[in] pi {ExtensionAPI} Handler-scoped extension API instance retained as the fallback dispatcher.
4993
5022
  - @param[in] content {string} Rendered prompt markdown.
5023
+ - @param[in] summary {string} Command invocation summary text displayed on screen.
4994
5024
  - @param[in] context {unknown} Optional replacement-session helper context.
4995
5025
  - @return {Promise<void>} Promise representing eventual prompt-delivery completion.
4996
- - @satisfies REQ-004, REQ-067, REQ-068, REQ-227, REQ-281
5026
+ - @satisfies REQ-004, REQ-067, REQ-068, REQ-227, REQ-281, REQ-334, REQ-335, DES-016
4997
5027
 
4998
- ### fn `function shouldIgnoreLatePromptDeliveryFailure(` (L944-960)
5028
+ ### fn `function shouldIgnoreLatePromptDeliveryFailure(` (L981-997)
4999
5029
  - @brief Detects prompt-delivery failures that can be ignored after prompt ownership has moved past the command handler.
5000
5030
  - @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.
5001
5031
  - @param[in] error {unknown} Candidate prompt-delivery failure.
@@ -5004,7 +5034,7 @@ cost.
5004
5034
  - @return {boolean} `true` when the failure is a late stale-context delivery rejection that MUST be ignored.
5005
5035
  - @satisfies REQ-208, REQ-280, REQ-281, REQ-282
5006
5036
 
5007
- ### fn `function logPromptWorkflowStateChange(` (L973-992)
5037
+ ### fn `function logPromptWorkflowStateChange(` (L1010-1029)
5008
5038
  - @brief Appends one workflow-state debug entry for a bundled prompt when selected.
5009
5039
  - @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.
5010
5040
  - @param[in] projectBase {string} Absolute original project base path.
@@ -5015,7 +5045,7 @@ cost.
5015
5045
  - @return {void} No return value.
5016
5046
  - @satisfies REQ-245, REQ-246, REQ-247
5017
5047
 
5018
- ### fn `function logPromptWorkflowEvent(` (L1008-1028)
5048
+ ### fn `function logPromptWorkflowEvent(` (L1045-1065)
5019
5049
  - @brief Appends one dedicated prompt workflow debug entry when selected.
5020
5050
  - @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.
5021
5051
  - @param[in] projectBase {string} Absolute original project base path.
@@ -5029,7 +5059,7 @@ cost.
5029
5059
  - @return {void} No return value.
5030
5060
  - @satisfies REQ-245, REQ-246, REQ-247, REQ-277
5031
5061
 
5032
- ### fn `function transitionPromptWorkflowState(` (L1041-1054)
5062
+ ### fn `function transitionPromptWorkflowState(` (L1078-1091)
5033
5063
  - @brief Transitions one prompt workflow state and logs the transition immediately after the state update.
5034
5064
  - @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.
5035
5065
  - @param[in] ctx {ExtensionContext | ExtensionCommandContext} Active extension context.
@@ -5040,20 +5070,20 @@ cost.
5040
5070
  - @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
5041
5071
  - @return {void} No return value.
5042
5072
 
5043
- ### fn `function resolvePromptCommandDescription(` (L1062-1066)
5073
+ ### fn `function resolvePromptCommandDescription(` (L1099-1103)
5044
5074
  - @brief Resolves the runtime slash-command description for one bundled prompt.
5045
5075
  - @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.
5046
5076
  - @param[in] promptName {import("./core/prompt-command-catalog.js").PromptCommandName} Bundled prompt name.
5047
5077
  - @return {string} Runtime command description.
5048
5078
 
5049
- ### fn `function resolveDebugProjectBase(cwd: string, statusController: PiUsereqStatusController): string` (L1075-1079)
5079
+ ### fn `function resolveDebugProjectBase(cwd: string, statusController: PiUsereqStatusController): string` (L1112-1116)
5050
5080
  - @brief Resolves the original project base used for debug-log file writes.
5051
5081
  - @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.
5052
5082
  - @param[in] cwd {string} Current extension working directory.
5053
5083
  - @param[in] statusController {PiUsereqStatusController} Mutable status controller.
5054
5084
  - @return {string} Absolute original project base path for debug logging.
5055
5085
 
5056
- ### fn `function notifyContextSafely(` (L1090-1107)
5086
+ ### fn `function notifyContextSafely(` (L1127-1144)
5057
5087
  - @brief Delivers one best-effort UI notification without failing on stale replacement contexts.
5058
5088
  - @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.
5059
5089
  - @param[in] ctx {ExtensionContext | ExtensionCommandContext | undefined} Candidate UI context.
@@ -5062,7 +5092,7 @@ cost.
5062
5092
  - @return {boolean} `true` when the notification was delivered and `false` when the context was already stale.
5063
5093
  - @satisfies REQ-280
5064
5094
 
5065
- ### fn `function rejectNonIdleReqCommand(` (L1119-1139)
5095
+ ### fn `function rejectNonIdleReqCommand(` (L1156-1176)
5066
5096
  - @brief Rejects one non-`idle` req-command invocation and records the workflow error state.
5067
5097
  - @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.
5068
5098
  - @param[in] ctx {ExtensionContext | ExtensionCommandContext} Active extension context.
@@ -5072,20 +5102,20 @@ cost.
5072
5102
  - @throws {ReqError} Always throws because non-`idle` req commands are rejected.
5073
5103
  - @satisfies REQ-224
5074
5104
 
5075
- ### fn `function getPiUsereqStartupTools(pi: ExtensionAPI): ToolInfo[]` (L1148-1156)
5105
+ ### fn `function getPiUsereqStartupTools(pi: ExtensionAPI): ToolInfo[]` (L1185-1193)
5076
5106
  - @brief Returns the configurable active-tool inventory visible to the extension.
5077
5107
  - @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.
5078
5108
  - @param[in] pi {ExtensionAPI} Active extension API instance.
5079
5109
  - @return {ToolInfo[]} Sorted configurable tool descriptors.
5080
5110
  - @satisfies REQ-007, REQ-063, REQ-231, REQ-232
5081
5111
 
5082
- ### fn `function getConfiguredEnabledPiUsereqTools(config: UseReqConfig): string[]` (L1164-1168)
5112
+ ### fn `function getConfiguredEnabledPiUsereqTools(config: UseReqConfig): string[]` (L1201-1205)
5083
5113
  - @brief Normalizes and returns the configured enabled active tools.
5084
5114
  - @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"]`.
5085
5115
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
5086
5116
  - @return {string[]} Normalized enabled tool names.
5087
5117
 
5088
- ### fn `function applyConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig): void` (L1178-1195)
5118
+ ### fn `function applyConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig): void` (L1215-1232)
5089
5119
  - @brief Applies the configured active-tool enablement to the current session.
5090
5120
  - @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(...)`.
5091
5121
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5093,7 +5123,7 @@ cost.
5093
5123
  - @return {void} No return value.
5094
5124
  - @satisfies REQ-009, REQ-064
5095
5125
 
5096
- ### fn `async function handleExtensionStatusEvent(` (L1208-1479)
5126
+ ### fn `async function handleExtensionStatusEvent(` (L1245-1516)
5097
5127
  - @brief Handles one intercepted pi lifecycle hook for pi-usereq status updates.
5098
5128
  - @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.
5099
5129
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5104,7 +5134,7 @@ cost.
5104
5134
  - @return {Promise<void>} Promise resolved when hook processing completes.
5105
5135
  - @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
5106
5136
 
5107
- ### fn `function registerExtensionStatusHooks(` (L1495-1514)
5137
+ ### fn `function registerExtensionStatusHooks(` (L1532-1551)
5108
5138
  - @brief Registers shared wrappers for every supported pi lifecycle hook.
5109
5139
  - @details Installs one generic wrapper per intercepted hook so every resource,
5110
5140
  session, agent, model, tool, bash, and input event is routed through the
@@ -5118,7 +5148,7 @@ registered hook count. Side effects include hook registration.
5118
5148
  - @return {void} No return value.
5119
5149
  - @satisfies DES-002, REQ-113, REQ-114, REQ-115, REQ-116, REQ-117
5120
5150
 
5121
- ### fn `function setConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig, enabledTools: string[]): void` (L1524-1527)
5151
+ ### fn `function setConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig, enabledTools: string[]): void` (L1561-1564)
5122
5152
  - @brief Replaces the configured active-tool selection and applies it immediately.
5123
5153
  - @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.
5124
5154
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5126,26 +5156,26 @@ registered hook count. Side effects include hook registration.
5126
5156
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
5127
5157
  - @return {void} No return value.
5128
5158
 
5129
- ### fn `function getDebugToolToggleNames(): PiUsereqStartupToolName[]` (L1535-1537)
5159
+ ### fn `function getDebugToolToggleNames(): PiUsereqStartupToolName[]` (L1572-1574)
5130
5160
  - @brief Returns the canonical debug-tool toggle order.
5131
5161
  - @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.
5132
5162
  - @return {PiUsereqStartupToolName[]} Ordered debug-tool toggle names.
5133
5163
  - @satisfies REQ-242
5134
5164
 
5135
- ### fn `function resetDebugConfigToDefaults(config: UseReqConfig): void` (L1546-1555)
5165
+ ### fn `function resetDebugConfigToDefaults(config: UseReqConfig): void` (L1583-1592)
5136
5166
  - @brief Restores the debug configuration subtree to its documented defaults.
5137
5167
  - @details Resets global debug enablement, log path, tool-wrapper command registration, 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`.
5138
5168
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
5139
5169
  - @return {void} No return value.
5140
5170
  - @satisfies REQ-236, REQ-237, REQ-238, REQ-239, REQ-195, REQ-277, REQ-322
5141
5171
 
5142
- ### fn `function formatDebugMenuSummary(config: UseReqConfig): string` (L1563-1569)
5172
+ ### fn `function formatDebugMenuSummary(config: UseReqConfig): string` (L1600-1606)
5143
5173
  - @brief Formats the top-level Debug summary value.
5144
5174
  - @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.
5145
5175
  - @param[in] config {UseReqConfig} Effective project configuration.
5146
5176
  - @return {string} Compact debug summary string.
5147
5177
 
5148
- ### fn `function buildDebugMenuChoice(` (L1579-1592)
5178
+ ### fn `function buildDebugMenuChoice(` (L1616-1629)
5149
5179
  - @brief Builds one debug-menu row with optional disabled styling.
5150
5180
  - @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.
5151
5181
  - @param[in] choice {PiUsereqSettingsMenuChoice} Base debug-menu row.
@@ -5153,21 +5183,21 @@ registered hook count. Side effects include hook registration.
5153
5183
  - @return {PiUsereqSettingsMenuChoice} Styled debug-menu row.
5154
5184
  - @satisfies REQ-241
5155
5185
 
5156
- ### fn `async function selectDebugLogOnStatus(` (L1601-1629)
5186
+ ### fn `async function selectDebugLogOnStatus(` (L1638-1666)
5157
5187
  - @brief Opens the workflow-state filter selector used by the Debug submenu.
5158
5188
  - @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.
5159
5189
  - @param[in] ctx {ExtensionCommandContext} Active command context.
5160
5190
  - @param[in] currentValue {DebugLogOnStatus} Current persisted workflow-state filter.
5161
5191
  - @return {Promise<DebugLogOnStatus | undefined>} Selected workflow-state filter or `undefined` when cancelled.
5162
5192
 
5163
- ### fn `function buildDebugMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L1638-1724)
5193
+ ### fn `function buildDebugMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L1675-1761)
5164
5194
  - @brief Builds the shared settings-menu choices for debug logging configuration.
5165
5195
  - @details Serializes global debug controls plus tool-wrapper command registration, 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.
5166
5196
  - @param[in] config {UseReqConfig} Effective project configuration.
5167
5197
  - @return {PiUsereqSettingsMenuChoice[]} Ordered debug-menu choices.
5168
5198
  - @satisfies REQ-240, REQ-241, REQ-242, REQ-243, REQ-193, REQ-277, REQ-321, REQ-322
5169
5199
 
5170
- ### fn `async function configureDebugMenu(` (L1735-1925)
5200
+ ### fn `async function configureDebugMenu(` (L1772-1962)
5171
5201
  - @brief Runs the interactive Debug submenu.
5172
5202
  - @details Lets the user toggle global debug enablement, tool-wrapper command registration, debug file and workflow filters, dedicated workflow-event logging, per-tool selectors, and per-prompt selectors while preserving row focus across re-renders. Runtime depends on user interaction count. Side effects include UI updates, config mutation, and optional debug command registration.
5173
5203
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5176,47 +5206,47 @@ registered hook count. Side effects include hook registration.
5176
5206
  - @return {Promise<void>} Promise resolved when the submenu closes.
5177
5207
  - @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, REQ-321, REQ-322, REQ-323
5178
5208
 
5179
- ### fn `const updateDebugToolCommandsEnabled = (nextValue: unknown): void =>` (L1741-1748)
5209
+ ### fn `const updateDebugToolCommandsEnabled = (nextValue: unknown): void =>` (L1778-1785)
5180
5210
 
5181
- - type `type PiNotifyBooleanConfigKey =` (L1931)
5211
+ - type `type PiNotifyBooleanConfigKey =` (L1968)
5182
5212
  - @brief Represents one persisted boolean notification-setting key.
5183
5213
  - @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.
5184
- - type `type PiNotifyEventBooleanConfigKey = Exclude<` (L1948)
5214
+ - type `type PiNotifyEventBooleanConfigKey = Exclude<` (L1985)
5185
5215
  - @brief Represents one persisted boolean notification event-toggle key.
5186
5216
  - @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.
5187
- - type `type PiNotifyEventId = "completed" | "interrupted" | "failed";` (L1957)
5217
+ - type `type PiNotifyEventId = "completed" | "interrupted" | "failed";` (L1994)
5188
5218
  - @brief Represents one shared prompt-end event identifier used by notification menus.
5189
5219
  - @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.
5190
- ### iface `interface PiNotifyEventRowDefinition` (L1963-1967)
5220
+ ### iface `interface PiNotifyEventRowDefinition` (L2000-2004)
5191
5221
  - @brief Describes one shared prompt-end event row rendered inside notification event submenus.
5192
5222
  - @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.
5193
5223
 
5194
- ### iface `interface PiNotifyEventMenuDefinition` (L1973-1979)
5224
+ ### iface `interface PiNotifyEventMenuDefinition` (L2010-2016)
5195
5225
  - @brief Describes one notification-system event submenu contract.
5196
5226
  - @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.
5197
5227
 
5198
- ### fn `function togglePiNotifyFlag(config: UseReqConfig, key: PiNotifyBooleanConfigKey): boolean` (L1988-1991)
5228
+ ### fn `function togglePiNotifyFlag(config: UseReqConfig, key: PiNotifyBooleanConfigKey): boolean` (L2025-2028)
5199
5229
  - @brief Flips one persisted boolean notification setting.
5200
5230
  - @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`.
5201
5231
  - @param[in] key {PiNotifyBooleanConfigKey} Boolean configuration key to toggle.
5202
5232
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
5203
5233
  - @return {boolean} Next enabled state.
5204
5234
 
5205
- ### fn `function resetPiNotifyConfigToDefaults(config: UseReqConfig): void` (L2000-2024)
5235
+ ### fn `function resetPiNotifyConfigToDefaults(config: UseReqConfig): void` (L2037-2061)
5206
5236
  - @brief Restores notification-related settings to their documented defaults.
5207
5237
  - @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`.
5208
5238
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
5209
5239
  - @return {void} No return value.
5210
5240
  - @satisfies REQ-174, REQ-178, REQ-184, REQ-195, REQ-196
5211
5241
 
5212
- ### fn `function formatPiNotifyPushoverPriority(priority: PiNotifyPushoverPriority): string` (L2033-2035)
5242
+ ### fn `function formatPiNotifyPushoverPriority(priority: PiNotifyPushoverPriority): string` (L2070-2072)
5213
5243
  - @brief Formats one persisted Pushover priority for menu display.
5214
5244
  - @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.
5215
5245
  - @param[in] priority {PiNotifyPushoverPriority} Persisted Pushover priority.
5216
5246
  - @return {string} Menu-display label.
5217
5247
  - @satisfies REQ-172
5218
5248
 
5219
- ### fn `function formatPiNotifyEventMenuSummary(` (L2119-2127)
5249
+ ### fn `function formatPiNotifyEventMenuSummary(` (L2156-2164)
5220
5250
  - @brief Formats the top-level summary value for one notification event submenu.
5221
5251
  - @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.
5222
5252
  - @param[in] config {UseReqConfig} Effective project configuration.
@@ -5224,7 +5254,7 @@ registered hook count. Side effects include hook registration.
5224
5254
  - @return {string} Compact enabled-toggle summary.
5225
5255
  - @satisfies REQ-198
5226
5256
 
5227
- ### fn `function buildPiNotifyEventLauncherChoice(` (L2137-2147)
5257
+ ### fn `function buildPiNotifyEventLauncherChoice(` (L2174-2184)
5228
5258
  - @brief Builds the top-level launcher row for one notification event submenu.
5229
5259
  - @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.
5230
5260
  - @param[in] config {UseReqConfig} Effective project configuration.
@@ -5232,7 +5262,7 @@ registered hook count. Side effects include hook registration.
5232
5262
  - @return {PiUsereqSettingsMenuChoice} Launcher row for the selected event submenu.
5233
5263
  - @satisfies REQ-181, REQ-183, REQ-165, REQ-198
5234
5264
 
5235
- ### fn `function buildPiNotifyEventMenuChoices(` (L2157-2173)
5265
+ ### fn `function buildPiNotifyEventMenuChoices(` (L2194-2210)
5236
5266
  - @brief Builds the shared settings-menu choices for one notification event submenu.
5237
5267
  - @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.
5238
5268
  - @param[in] config {UseReqConfig} Effective project configuration.
@@ -5240,7 +5270,7 @@ registered hook count. Side effects include hook registration.
5240
5270
  - @return {PiUsereqSettingsMenuChoice[]} Ordered event-submenu choice vector.
5241
5271
  - @satisfies REQ-188, REQ-193, REQ-198
5242
5272
 
5243
- ### fn `function resetPiNotifyEventMenuToDefaults(` (L2183-2191)
5273
+ ### fn `function resetPiNotifyEventMenuToDefaults(` (L2220-2228)
5244
5274
  - @brief Restores one notification event submenu to its documented defaults.
5245
5275
  - @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`.
5246
5276
  - @param[in] eventMenu {PiNotifyEventMenuDefinition} Notification-system event submenu contract.
@@ -5248,7 +5278,7 @@ registered hook count. Side effects include hook registration.
5248
5278
  - @return {void} No return value.
5249
5279
  - @satisfies REQ-174, REQ-178, REQ-184, REQ-195
5250
5280
 
5251
- ### fn `function resolvePiNotifyEventLabel(` (L2201-2208)
5281
+ ### fn `function resolvePiNotifyEventLabel(` (L2238-2245)
5252
5282
  - @brief Resolves the human-readable event label for one event-toggle config key.
5253
5283
  - @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.
5254
5284
  - @param[in] key {PiNotifyEventBooleanConfigKey} Event-toggle configuration key.
@@ -5256,7 +5286,7 @@ registered hook count. Side effects include hook registration.
5256
5286
  - @return {string} Human-readable event label.
5257
5287
  - @satisfies REQ-188, REQ-198
5258
5288
 
5259
- ### fn `async function configurePiNotifyEventMenu(` (L2219-2295)
5289
+ ### fn `async function configurePiNotifyEventMenu(` (L2256-2332)
5260
5290
  - @brief Runs one dedicated notification event submenu.
5261
5291
  - @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.
5262
5292
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -5265,14 +5295,14 @@ registered hook count. Side effects include hook registration.
5265
5295
  - @return {Promise<void>} Promise resolved when the submenu closes.
5266
5296
  - @satisfies REQ-188, REQ-192, REQ-193, REQ-195, REQ-198
5267
5297
 
5268
- ### fn `function buildPiNotifyPushoverRows(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2304-2354)
5298
+ ### fn `function buildPiNotifyPushoverRows(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2341-2391)
5269
5299
  - @brief Builds the direct Pushover rows rendered inside `Notifications`.
5270
5300
  - @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.
5271
5301
  - @param[in] config {UseReqConfig} Effective project configuration.
5272
5302
  - @return {PiUsereqSettingsMenuChoice[]} Ordered direct Pushover rows.
5273
5303
  - @satisfies REQ-163, REQ-165, REQ-172, REQ-184, REQ-185, REQ-198, REQ-234, REQ-235
5274
5304
 
5275
- ### fn `async function selectPiNotifyPushoverPriority(` (L2364-2392)
5305
+ ### fn `async function selectPiNotifyPushoverPriority(` (L2401-2429)
5276
5306
  - @brief Opens the shared settings-menu selector for Pushover priority.
5277
5307
  - @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.
5278
5308
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -5280,14 +5310,14 @@ registered hook count. Side effects include hook registration.
5280
5310
  - @return {Promise<PiNotifyPushoverPriority | "reset-defaults" | undefined>} Selected priority, reset action, or `undefined` when cancelled.
5281
5311
  - @satisfies REQ-172, REQ-192
5282
5312
 
5283
- ### fn `function buildPiNotifyMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2401-2459)
5313
+ ### fn `function buildPiNotifyMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2438-2496)
5284
5314
  - @brief Builds the shared settings-menu choices for notification configuration.
5285
5315
  - @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.
5286
5316
  - @param[in] config {UseReqConfig} Effective project configuration.
5287
5317
  - @return {PiUsereqSettingsMenuChoice[]} Ordered notification-menu choice vector.
5288
5318
  - @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
5289
5319
 
5290
- ### fn `async function selectPiNotifySoundLevel(` (L2469-2509)
5320
+ ### fn `async function selectPiNotifySoundLevel(` (L2506-2546)
5291
5321
  - @brief Opens the shared settings-menu selector for the persisted boot sound level.
5292
5322
  - @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.
5293
5323
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -5295,7 +5325,7 @@ registered hook count. Side effects include hook registration.
5295
5325
  - @return {Promise<PiNotifySoundLevel | "reset-defaults" | undefined>} Selected boot sound level, reset action, or `undefined` when cancelled.
5296
5326
  - @satisfies REQ-131, REQ-179, REQ-192, REQ-289
5297
5327
 
5298
- ### fn `async function configurePiNotifyMenu(` (L2519-2805)
5328
+ ### fn `async function configurePiNotifyMenu(` (L2556-2842)
5299
5329
  - @brief Runs the interactive notification-configuration menu.
5300
5330
  - @details Exposes command-notify, sound, and Pushover controls through the shared settings-menu renderer, persists every notification subtree mutation into global configuration, delegates completed/interrupted/failed toggles to dedicated event submenus, preserves boot-sound edits 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.
5301
5331
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -5303,7 +5333,7 @@ registered hook count. Side effects include hook registration.
5303
5333
  - @return {Promise<boolean>} `true` when the sound-toggle shortcut changed.
5304
5334
  - @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
5305
5335
 
5306
- ### fn `function registerPiNotifyShortcut(` (L2820-2843)
5336
+ ### fn `function registerPiNotifyShortcut(` (L2857-2880)
5307
5337
  - @brief Registers the configurable notification-sound shortcut when supported.
5308
5338
  - @details Loads the current effective config, registers one raw pi shortcut when
5309
5339
  the runtime exposes `registerShortcut(...)`, cycles only the active runtime
@@ -5316,15 +5346,15 @@ registration and status updates.
5316
5346
  - @return {void} No return value.
5317
5347
  - @satisfies REQ-134, REQ-180, REQ-286, REQ-287
5318
5348
 
5319
- ### fn `function resolveReqResetPromptRequest(` (L2851-2877)
5349
+ ### fn `function resolveReqResetPromptRequest(` (L2888-2914)
5320
5350
  - @brief Resolves the prompt execution plan targeted by `req-reset` recovery.
5321
5351
  - @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.
5322
5352
  - @param[in] statusController {PiUsereqStatusController} Mutable status controller.
5323
5353
  - @return {PromptCommandExecutionPlan | undefined} Recoverable prompt execution plan when one remains available.
5324
5354
 
5325
- ### fn `const isWorktreeBacked = (request: PromptCommandExecutionPlan | undefined): request is PromptCommandExecutionPlan =>` (L2854-2861)
5355
+ ### fn `const isWorktreeBacked = (request: PromptCommandExecutionPlan | undefined): request is PromptCommandExecutionPlan =>` (L2891-2898)
5326
5356
 
5327
- ### fn `function registerReqResetCommand(` (L2887-2941)
5357
+ ### fn `function registerReqResetCommand(` (L2924-2978)
5328
5358
  - @brief Registers the specialized `req-reset` slash command.
5329
5359
  - @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.
5330
5360
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5332,7 +5362,7 @@ registration and status updates.
5332
5362
  - @return {void} No return value.
5333
5363
  - @satisfies REQ-304, REQ-305, REQ-306, REQ-307, REQ-308, REQ-309, REQ-310, REQ-311, REQ-312, REQ-313
5334
5364
 
5335
- ### fn `function registerReqReferencesCommand(` (L2951-2991)
5365
+ ### fn `function registerReqReferencesCommand(` (L2988-3028)
5336
5366
  - @brief Registers the specialized `req-references` slash command.
5337
5367
  - @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.
5338
5368
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5340,7 +5370,7 @@ registration and status updates.
5340
5370
  - @return {void} No return value.
5341
5371
  - @satisfies REQ-200, REQ-221, REQ-224, REQ-298, REQ-299, REQ-300, REQ-301, REQ-302, REQ-303
5342
5372
 
5343
- ### fn `function registerPromptCommands(` (L3001-3117)
5373
+ ### fn `function registerPromptCommands(` (L3038-3159)
5344
5374
  - @brief Registers bundled prompt-backed commands with the extension.
5345
5375
  - @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.
5346
5376
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5348,14 +5378,14 @@ registration and status updates.
5348
5378
  - @return {void} No return value.
5349
5379
  - @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
5350
5380
 
5351
- ### fn `function registerAgentTools(pi: ExtensionAPI): void` (L3127-3426)
5381
+ ### fn `function registerAgentTools(pi: ExtensionAPI): void` (L3169-3468)
5352
5382
  - @brief Registers pi-usereq agent tools exposed to the model.
5353
5383
  - @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.
5354
5384
  - @param[in] pi {ExtensionAPI} Active extension API instance.
5355
5385
  - @return {void} No return value.
5356
5386
  - @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
5357
5387
 
5358
- ### fn `function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3471-3496)
5388
+ ### fn `function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3513-3538)
5359
5389
  - @brief Builds the shared settings-menu choices for startup-tool management.
5360
5390
  - @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.
5361
5391
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5363,7 +5393,7 @@ registration and status updates.
5363
5393
  - @return {PiUsereqSettingsMenuChoice[]} Ordered startup-tool menu choices.
5364
5394
  - @satisfies REQ-007, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193
5365
5395
 
5366
- ### fn `function buildPiUsereqToolToggleChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3506-3520)
5396
+ ### fn `function buildPiUsereqToolToggleChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3548-3562)
5367
5397
  - @brief Builds the shared settings-menu choices for per-tool startup toggles.
5368
5398
  - @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.
5369
5399
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5371,7 +5401,7 @@ registration and status updates.
5371
5401
  - @return {PiUsereqSettingsMenuChoice[]} Ordered per-tool toggle choices.
5372
5402
  - @satisfies REQ-007, REQ-151, REQ-152, REQ-153, REQ-154, REQ-231, REQ-232
5373
5403
 
5374
- ### fn `async function configurePiUsereqToolsMenu(` (L3531-3648)
5404
+ ### fn `async function configurePiUsereqToolsMenu(` (L3573-3690)
5375
5405
  - @brief Runs the interactive active-tool configuration menu.
5376
5406
  - @details Synchronizes runtime active tools with the effective config, renders startup-tool actions through the shared settings-menu UI, persists enablement changes into global configuration, 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.
5377
5407
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5380,58 +5410,58 @@ registration and status updates.
5380
5410
  - @return {Promise<void>} Promise resolved when the menu closes.
5381
5411
  - @satisfies REQ-007, REQ-063, REQ-064, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193, REQ-231, REQ-232
5382
5412
 
5383
- ### fn `function getStaticCheckLanguageConfigForMenu(` (L3657-3662)
5413
+ ### fn `function getStaticCheckLanguageConfigForMenu(` (L3699-3704)
5384
5414
  - @brief Resolves one static-check language config for menu rendering.
5385
5415
  - @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.
5386
5416
  - @param[in] config {UseReqConfig} Effective project configuration.
5387
5417
  - @param[in] language {string} Canonical language name.
5388
5418
  - @return {StaticCheckLanguageConfig} Resolved per-language config object.
5389
5419
 
5390
- ### fn `function countConfiguredStaticCheckLanguages(config: UseReqConfig): number` (L3670-3672)
5420
+ ### fn `function countConfiguredStaticCheckLanguages(config: UseReqConfig): number` (L3712-3714)
5391
5421
  - @brief Counts languages that currently expose at least one configured checker.
5392
5422
  - @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.
5393
5423
  - @param[in] config {UseReqConfig} Effective project configuration.
5394
5424
  - @return {number} Number of languages with at least one configured checker.
5395
5425
 
5396
- ### fn `function countEnabledStaticCheckLanguages(config: UseReqConfig): number` (L3680-3682)
5426
+ ### fn `function countEnabledStaticCheckLanguages(config: UseReqConfig): number` (L3722-3724)
5397
5427
  - @brief Counts languages whose static-check enable flag is on.
5398
5428
  - @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.
5399
5429
  - @param[in] config {UseReqConfig} Effective project configuration.
5400
5430
  - @return {number} Number of enabled languages.
5401
5431
 
5402
- ### fn `function resetStaticCheckConfig(config: UseReqConfig): void` (L3691-3693)
5432
+ ### fn `function resetStaticCheckConfig(config: UseReqConfig): void` (L3733-3735)
5403
5433
  - @brief Restores the documented static-check default configuration.
5404
5434
  - @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`.
5405
5435
  - @param[in,out] config {UseReqConfig} Mutable configuration object.
5406
5436
  - @return {void} No return value.
5407
5437
  - @satisfies REQ-250, REQ-251, REQ-252
5408
5438
 
5409
- ### fn `function formatStaticCheckLanguagesSummary(config: UseReqConfig): string` (L3701-3703)
5439
+ ### fn `function formatStaticCheckLanguagesSummary(config: UseReqConfig): string` (L3743-3745)
5410
5440
  - @brief Summarizes enabled and configured static-check languages.
5411
5441
  - @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.
5412
5442
  - @param[in] config {UseReqConfig} Effective project configuration.
5413
5443
  - @return {string} Compact summary string.
5414
5444
 
5415
- ### fn `function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3712-3744)
5445
+ ### fn `function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3754-3786)
5416
5446
  - @brief Builds the shared settings-menu choices for static-check management.
5417
5447
  - @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.
5418
5448
  - @param[in] config {UseReqConfig} Effective project configuration.
5419
5449
  - @return {PiUsereqSettingsMenuChoice[]} Ordered static-check menu choices.
5420
5450
  - @satisfies REQ-008, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-248
5421
5451
 
5422
- ### fn `function buildSupportedStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3752-3769)
5452
+ ### fn `function buildSupportedStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3794-3811)
5423
5453
  - @brief Builds the shared settings-menu choices for supported static-check languages.
5424
5454
  - @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.
5425
5455
  - @param[in] config {UseReqConfig} Effective project configuration.
5426
5456
  - @return {PiUsereqSettingsMenuChoice[]} Ordered language-choice vector.
5427
5457
 
5428
- ### fn `function buildConfiguredStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3777-3794)
5458
+ ### fn `function buildConfiguredStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3819-3836)
5429
5459
  - @brief Builds the shared settings-menu choices for configured static-check languages.
5430
5460
  - @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.
5431
5461
  - @param[in] config {UseReqConfig} Effective project configuration.
5432
5462
  - @return {PiUsereqSettingsMenuChoice[]} Ordered configured-language vector.
5433
5463
 
5434
- ### fn `async function configureStaticCheckMenu(` (L3804-3950)
5464
+ ### fn `async function configureStaticCheckMenu(` (L3846-3992)
5435
5465
  - @brief Runs the interactive static-check configuration menu.
5436
5466
  - @details Lets the user add and remove global Command entries, toggle direct local 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.
5437
5467
  - @param[in] ctx {ExtensionCommandContext} Active command context.
@@ -5439,40 +5469,65 @@ registration and status updates.
5439
5469
  - @return {Promise<void>} Promise resolved when the menu closes.
5440
5470
  - @satisfies REQ-008, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-195, REQ-248, REQ-253
5441
5471
 
5442
- ### fn `function buildPiUsereqMenuChoices(` (L3960-4059)
5472
+ ### fn `function formatContextFilesSummary(config: UseReqConfig): string` (L4001-4003)
5473
+ - @brief Summarizes the `Context Files` flag state for the top-level menu value column.
5474
+ - @details Renders the three context-file flags as compact `name:on|off` segments in the documented order so the top-level row reflects the current injection configuration. Runtime is O(1). No external state is mutated.
5475
+ - @param[in] config {UseReqConfig} Effective project configuration.
5476
+ - @return {string} Compact `Context Files` summary string.
5477
+ - @satisfies REQ-327
5478
+
5479
+ ### fn `function buildContextFilesMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L4012-4039)
5480
+ - @brief Builds the shared settings-menu choices for the `Context Files` submenu.
5481
+ - @details Exposes one inline on|off toggle row per context file in the documented `REQUIREMENTS.md`, `REFERENCES.md`, `WORKFLOW.md` order plus a value-less subtree-local `Reset defaults` row. Runtime is O(1). No external state is mutated.
5482
+ - @param[in] config {UseReqConfig} Effective project configuration.
5483
+ - @return {PiUsereqSettingsMenuChoice[]} Ordered `Context Files` submenu choices.
5484
+ - @satisfies REQ-327, REQ-328, REQ-333
5485
+
5486
+ ### fn `async function configureContextFilesMenu(` (L4050-4108)
5487
+ - @brief Runs the `Context Files` configuration submenu.
5488
+ - @details Loads the shared settings menu with the three context-file toggle rows, persists each inline toggle immediately through the shared change callback, restores all three flags to enabled on approved subtree reset, preserves focus on the toggled row, and returns to the top-level menu on cancel. Runtime depends on user interaction count. Side effects include config writes and UI notifications.
5489
+ - @param[in] ctx {ExtensionCommandContext} Active command context.
5490
+ - @param[in] onConfigChange {() => void} Shared persistence-plus-status callback.
5491
+ - @param[in,out] config {UseReqConfig} Mutable effective project configuration.
5492
+ - @return {Promise<void>} Promise resolved when the submenu closes.
5493
+ - @satisfies REQ-327, REQ-328, REQ-333
5494
+
5495
+ ### fn `const setFlag = (flagKey: "context-files-requirements" | "context-files-references" | "context-files-workflow", enabled: boolean): void =>` (L4055-4059)
5496
+
5497
+ ### fn `function buildPiUsereqMenuChoices(` (L4118-4223)
5443
5498
  - @brief Builds the shared settings-menu choices for the top-level pi-usereq configuration UI.
5444
- - @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 display-only local plus global config paths. Runtime is O(s) in source-directory count. No external state is mutated.
5499
+ - @details Serializes primary configuration actions into right-valued menu rows consumed by the shared settings-menu renderer, including the `Context Files` injection toggles, automatic git-commit mode, effective prompt-command worktree state, notification summary, debug summary, locked worktree rows when automatic git commit is disabled, and display-only local plus global config paths. Runtime is O(s) in source-directory count. No external state is mutated.
5445
5500
  - @param[in] cwd {string} Current working directory.
5446
5501
  - @param[in] config {UseReqConfig} Effective project configuration.
5447
5502
  - @return {PiUsereqSettingsMenuChoice[]} Ordered top-level menu choices.
5448
- - @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, REQ-314, REQ-318, REQ-319, REQ-320
5503
+ - @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, REQ-314, REQ-318, REQ-319, REQ-320, REQ-326
5449
5504
 
5450
- ### fn `function buildSrcDirMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L4068-4086)
5505
+ ### fn `function buildSrcDirMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L4232-4250)
5451
5506
  - @brief Builds the shared settings-menu choices for source-directory management.
5452
5507
  - @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.
5453
5508
  - @param[in] config {UseReqConfig} Effective project configuration.
5454
5509
  - @return {PiUsereqSettingsMenuChoice[]} Ordered source-directory management choices.
5455
5510
  - @satisfies REQ-006, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193
5456
5511
 
5457
- ### fn `function buildSrcDirRemovalChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L4095-4107)
5512
+ ### fn `function buildSrcDirRemovalChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L4259-4271)
5458
5513
  - @brief Builds the shared settings-menu choices for removing one source-directory entry.
5459
5514
  - @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.
5460
5515
  - @param[in] config {UseReqConfig} Effective project configuration.
5461
5516
  - @return {PiUsereqSettingsMenuChoice[]} Ordered removable source-directory choices.
5462
5517
  - @satisfies REQ-006, REQ-151, REQ-152, REQ-153, REQ-154
5463
5518
 
5464
- ### fn `async function configurePiUsereq(` (L4118-4371)
5519
+ ### fn `async function configurePiUsereq(` (L4282-4540)
5465
5520
  - @brief Runs the top-level pi-usereq configuration menu.
5466
5521
  - @details Loads the effective merged 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 local configuration` or `Show global 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.
5467
5522
  - @param[in] pi {ExtensionAPI} Active extension API instance.
5468
5523
  - @param[in] ctx {ExtensionCommandContext} Active command context.
5469
5524
  - @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
5470
5525
  - @return {Promise<void>} Promise resolved when configuration is saved and the menu closes.
5471
- - @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, REQ-314, REQ-318, REQ-319, REQ-320
5526
+ - @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, REQ-314, REQ-318, REQ-319, REQ-320, REQ-326, REQ-327, REQ-328, REQ-333
5472
5527
 
5473
- ### fn `const persistConfigChange = () =>` (L4129-4134)
5528
+ ### fn `const persistConfigChange = () =>` (L4293-4298)
5474
5529
 
5475
- ### fn `function registerConfigCommands(` (L4381-4391)
5530
+ ### fn `function registerConfigCommands(` (L4550-4560)
5476
5531
  - @brief Registers configuration-management commands.
5477
5532
  - @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.
5478
5533
  - @param[in] pi {ExtensionAPI} Active extension API instance.
@@ -5480,116 +5535,120 @@ registration and status updates.
5480
5535
  - @return {void} No return value.
5481
5536
  - @satisfies REQ-006, REQ-031
5482
5537
 
5483
- ### fn `export default function piUsereqExtension(pi: ExtensionAPI): void` (L4400-4413)
5538
+ ### fn `export default function piUsereqExtension(pi: ExtensionAPI): void` (L4569-4582)
5484
5539
  - @brief Registers the complete pi-usereq extension.
5485
5540
  - @details Validates installation-owned bundled resources, registers the specialized `req-reset` and `req-references` commands plus bundled prompt-backed commands and agent tools, conditionally registers config-gated debug tool wrapper commands when the current project enables them, 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.
5486
5541
  - @param[in] pi {ExtensionAPI} Active extension API instance.
5487
5542
  - @return {void} No return value.
5488
- - @satisfies DES-002, DES-015, 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, REQ-323, REQ-324, REQ-325
5543
+ - @satisfies DES-002, DES-015, 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, REQ-323, REQ-324, REQ-325, REQ-326, REQ-327
5489
5544
 
5490
5545
  ## Symbol Index
5491
5546
  |Symbol|Kind|Vis|Lines|Sig|
5492
5547
  |---|---|---|---|---|
5493
- |`PiShortcutRegistrar`|iface||181-189|interface PiShortcutRegistrar|
5494
- |`getProjectBase`|fn||197-206|function getProjectBase(cwd: string): string|
5495
- |`getProcessCwdSafe`|fn||213-222|function getProcessCwdSafe(): string|
5496
- |`resolveLiveBootstrapCwd`|fn||230-242|function resolveLiveBootstrapCwd(cwd: string): string|
5497
- |`syncContextCwdMirror`|fn||251-260|function syncContextCwdMirror(ctx: { cwd?: string }, cwd:...|
5498
- |`loadProjectConfig`|fn||269-272|function loadProjectConfig(cwd: string): UseReqConfig|
5499
- |`DebugToolCommandExecuteResult`|type||278||
5500
- |`shouldRegisterDebugToolCommands`|fn||287-293|function shouldRegisterDebugToolCommands(cwd: string): bo...|
5501
- |`writeDebugToolCommandResultToEditor`|fn||304-318|function writeDebugToolCommandResultToEditor(|
5502
- |`executeDebugToolCommand`|fn||330-348|function executeDebugToolCommand(|
5503
- |`registerDebugToolCommands`|fn||357-396|function registerDebugToolCommands(pi: ExtensionAPI): void|
5504
- |`saveProjectConfig`|fn||406-409|function saveProjectConfig(cwd: string, config: UseReqCon...|
5505
- |`formatLocalConfigPathForMenu`|fn||418-422|function formatLocalConfigPathForMenu(cwd: string): string|
5506
- |`formatGlobalConfigPathForMenu`|fn||430-432|function formatGlobalConfigPathForMenu(): string|
5507
- |`buildTerminalSettingsMenuChoices`|fn||441-452|function buildTerminalSettingsMenuChoices(options:|
5508
- |`ResetConfirmationChange`|iface||458-462|interface ResetConfirmationChange|
5509
- |`formatResetConfirmationValue`|fn||471-473|function formatResetConfirmationValue(previousValue: stri...|
5510
- |`buildResetConfirmationChoices`|fn||483-522|function buildResetConfirmationChoices(|
5511
- |`confirmResetChanges`|fn||534-547|async function confirmResetChanges(|
5512
- |`writePersistedConfigToEditor`|fn||556-561|function writePersistedConfigToEditor(|
5513
- |`writePersistedLocalConfigToEditor`|fn||571-577|function writePersistedLocalConfigToEditor(|
5514
- |`writePersistedGlobalConfigToEditor`|fn||586-590|function writePersistedGlobalConfigToEditor(|
5515
- |`buildSearchToolSupportedTagGuidelines`|fn||651-655|function buildSearchToolSupportedTagGuidelines(): string[]|
5516
- |`buildSearchToolSchemaDescription`|fn||663-668|function buildSearchToolSchemaDescription(scope: FindTool...|
5517
- |`buildSearchToolPromptGuidelines`|fn||676-689|function buildSearchToolPromptGuidelines(scope: FindToolS...|
5518
- |`MonolithicToolRenderResult`|type||695||
5519
- |`getMonolithicToolText`|fn||712-715|function getMonolithicToolText(result: MonolithicToolRend...|
5520
- |`getMonolithicToolErrorText`|fn||723-733|function getMonolithicToolErrorText(result: MonolithicToo...|
5521
- |`formatCompactToolArgumentValue`|fn||741-780|function formatCompactToolArgumentValue(value: unknown): ...|
5522
- |`buildCompactToolInvocationText`|fn||788-799|function buildCompactToolInvocationText(args: Record<stri...|
5523
- |`summarizeStructuredToolResult`|fn||809-824|function summarizeStructuredToolResult(|
5524
- |`buildStructuredToolRenderResult`|fn||833-852|function buildStructuredToolRenderResult(toolName: string)|
5525
- |`executeMonolithicTool`|fn||860-866|function executeMonolithicTool(operation: () => ToolResul...|
5526
- |`executeStatusTool`|fn||875-904|function executeStatusTool(operation: () => ToolResult): ...|
5527
- |`deliverPromptCommand`|fn||915-933|function deliverPromptCommand(|
5528
- |`shouldIgnoreLatePromptDeliveryFailure`|fn||944-960|function shouldIgnoreLatePromptDeliveryFailure(|
5529
- |`logPromptWorkflowStateChange`|fn||973-992|function logPromptWorkflowStateChange(|
5530
- |`logPromptWorkflowEvent`|fn||1008-1028|function logPromptWorkflowEvent(|
5531
- |`transitionPromptWorkflowState`|fn||1041-1054|function transitionPromptWorkflowState(|
5532
- |`resolvePromptCommandDescription`|fn||1062-1066|function resolvePromptCommandDescription(|
5533
- |`resolveDebugProjectBase`|fn||1075-1079|function resolveDebugProjectBase(cwd: string, statusContr...|
5534
- |`notifyContextSafely`|fn||1090-1107|function notifyContextSafely(|
5535
- |`rejectNonIdleReqCommand`|fn||1119-1139|function rejectNonIdleReqCommand(|
5536
- |`getPiUsereqStartupTools`|fn||1148-1156|function getPiUsereqStartupTools(pi: ExtensionAPI): ToolI...|
5537
- |`getConfiguredEnabledPiUsereqTools`|fn||1164-1168|function getConfiguredEnabledPiUsereqTools(config: UseReq...|
5538
- |`applyConfiguredPiUsereqTools`|fn||1178-1195|function applyConfiguredPiUsereqTools(pi: ExtensionAPI, c...|
5539
- |`handleExtensionStatusEvent`|fn||1208-1479|async function handleExtensionStatusEvent(|
5540
- |`registerExtensionStatusHooks`|fn||1495-1514|function registerExtensionStatusHooks(|
5541
- |`setConfiguredPiUsereqTools`|fn||1524-1527|function setConfiguredPiUsereqTools(pi: ExtensionAPI, con...|
5542
- |`getDebugToolToggleNames`|fn||1535-1537|function getDebugToolToggleNames(): PiUsereqStartupToolNa...|
5543
- |`resetDebugConfigToDefaults`|fn||1546-1555|function resetDebugConfigToDefaults(config: UseReqConfig)...|
5544
- |`formatDebugMenuSummary`|fn||1563-1569|function formatDebugMenuSummary(config: UseReqConfig): st...|
5545
- |`buildDebugMenuChoice`|fn||1579-1592|function buildDebugMenuChoice(|
5546
- |`selectDebugLogOnStatus`|fn||1601-1629|async function selectDebugLogOnStatus(|
5547
- |`buildDebugMenuChoices`|fn||1638-1724|function buildDebugMenuChoices(config: UseReqConfig): PiU...|
5548
- |`configureDebugMenu`|fn||1735-1925|async function configureDebugMenu(|
5549
- |`updateDebugToolCommandsEnabled`|fn||1741-1748|const updateDebugToolCommandsEnabled = (nextValue: unknow...|
5550
- |`PiNotifyBooleanConfigKey`|type||1931||
5551
- |`PiNotifyEventBooleanConfigKey`|type||1948||
5552
- |`PiNotifyEventId`|type||1957||
5553
- |`PiNotifyEventRowDefinition`|iface||1963-1967|interface PiNotifyEventRowDefinition|
5554
- |`PiNotifyEventMenuDefinition`|iface||1973-1979|interface PiNotifyEventMenuDefinition|
5555
- |`togglePiNotifyFlag`|fn||1988-1991|function togglePiNotifyFlag(config: UseReqConfig, key: Pi...|
5556
- |`resetPiNotifyConfigToDefaults`|fn||2000-2024|function resetPiNotifyConfigToDefaults(config: UseReqConf...|
5557
- |`formatPiNotifyPushoverPriority`|fn||2033-2035|function formatPiNotifyPushoverPriority(priority: PiNotif...|
5558
- |`formatPiNotifyEventMenuSummary`|fn||2119-2127|function formatPiNotifyEventMenuSummary(|
5559
- |`buildPiNotifyEventLauncherChoice`|fn||2137-2147|function buildPiNotifyEventLauncherChoice(|
5560
- |`buildPiNotifyEventMenuChoices`|fn||2157-2173|function buildPiNotifyEventMenuChoices(|
5561
- |`resetPiNotifyEventMenuToDefaults`|fn||2183-2191|function resetPiNotifyEventMenuToDefaults(|
5562
- |`resolvePiNotifyEventLabel`|fn||2201-2208|function resolvePiNotifyEventLabel(|
5563
- |`configurePiNotifyEventMenu`|fn||2219-2295|async function configurePiNotifyEventMenu(|
5564
- |`buildPiNotifyPushoverRows`|fn||2304-2354|function buildPiNotifyPushoverRows(config: UseReqConfig):...|
5565
- |`selectPiNotifyPushoverPriority`|fn||2364-2392|async function selectPiNotifyPushoverPriority(|
5566
- |`buildPiNotifyMenuChoices`|fn||2401-2459|function buildPiNotifyMenuChoices(config: UseReqConfig): ...|
5567
- |`selectPiNotifySoundLevel`|fn||2469-2509|async function selectPiNotifySoundLevel(|
5568
- |`configurePiNotifyMenu`|fn||2519-2805|async function configurePiNotifyMenu(|
5569
- |`registerPiNotifyShortcut`|fn||2820-2843|function registerPiNotifyShortcut(|
5570
- |`resolveReqResetPromptRequest`|fn||2851-2877|function resolveReqResetPromptRequest(|
5571
- |`isWorktreeBacked`|fn||2854-2861|const isWorktreeBacked = (request: PromptCommandExecution...|
5572
- |`registerReqResetCommand`|fn||2887-2941|function registerReqResetCommand(|
5573
- |`registerReqReferencesCommand`|fn||2951-2991|function registerReqReferencesCommand(|
5574
- |`registerPromptCommands`|fn||3001-3117|function registerPromptCommands(|
5575
- |`registerAgentTools`|fn||3127-3426|function registerAgentTools(pi: ExtensionAPI): void|
5576
- |`buildPiUsereqToolsMenuChoices`|fn||3471-3496|function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, ...|
5577
- |`buildPiUsereqToolToggleChoices`|fn||3506-3520|function buildPiUsereqToolToggleChoices(pi: ExtensionAPI,...|
5578
- |`configurePiUsereqToolsMenu`|fn||3531-3648|async function configurePiUsereqToolsMenu(|
5579
- |`getStaticCheckLanguageConfigForMenu`|fn||3657-3662|function getStaticCheckLanguageConfigForMenu(|
5580
- |`countConfiguredStaticCheckLanguages`|fn||3670-3672|function countConfiguredStaticCheckLanguages(config: UseR...|
5581
- |`countEnabledStaticCheckLanguages`|fn||3680-3682|function countEnabledStaticCheckLanguages(config: UseReqC...|
5582
- |`resetStaticCheckConfig`|fn||3691-3693|function resetStaticCheckConfig(config: UseReqConfig): void|
5583
- |`formatStaticCheckLanguagesSummary`|fn||3701-3703|function formatStaticCheckLanguagesSummary(config: UseReq...|
5584
- |`buildStaticCheckMenuChoices`|fn||3712-3744|function buildStaticCheckMenuChoices(config: UseReqConfig...|
5585
- |`buildSupportedStaticCheckLanguageChoices`|fn||3752-3769|function buildSupportedStaticCheckLanguageChoices(config:...|
5586
- |`buildConfiguredStaticCheckLanguageChoices`|fn||3777-3794|function buildConfiguredStaticCheckLanguageChoices(config...|
5587
- |`configureStaticCheckMenu`|fn||3804-3950|async function configureStaticCheckMenu(|
5588
- |`buildPiUsereqMenuChoices`|fn||3960-4059|function buildPiUsereqMenuChoices(|
5589
- |`buildSrcDirMenuChoices`|fn||4068-4086|function buildSrcDirMenuChoices(config: UseReqConfig): Pi...|
5590
- |`buildSrcDirRemovalChoices`|fn||4095-4107|function buildSrcDirRemovalChoices(config: UseReqConfig):...|
5591
- |`configurePiUsereq`|fn||4118-4371|async function configurePiUsereq(|
5592
- |`persistConfigChange`|fn||4129-4134|const persistConfigChange = () =>|
5593
- |`registerConfigCommands`|fn||4381-4391|function registerConfigCommands(|
5594
- |`piUsereqExtension`|fn||4400-4413|export default function piUsereqExtension(pi: ExtensionAP...|
5548
+ |`PiShortcutRegistrar`|iface||186-194|interface PiShortcutRegistrar|
5549
+ |`getProjectBase`|fn||202-211|function getProjectBase(cwd: string): string|
5550
+ |`getProcessCwdSafe`|fn||218-227|function getProcessCwdSafe(): string|
5551
+ |`resolveLiveBootstrapCwd`|fn||235-247|function resolveLiveBootstrapCwd(cwd: string): string|
5552
+ |`syncContextCwdMirror`|fn||256-265|function syncContextCwdMirror(ctx: { cwd?: string }, cwd:...|
5553
+ |`loadProjectConfig`|fn||274-277|function loadProjectConfig(cwd: string): UseReqConfig|
5554
+ |`DebugToolCommandExecuteResult`|type||283||
5555
+ |`shouldRegisterDebugToolCommands`|fn||292-298|function shouldRegisterDebugToolCommands(cwd: string): bo...|
5556
+ |`writeDebugToolCommandResultToEditor`|fn||309-323|function writeDebugToolCommandResultToEditor(|
5557
+ |`executeDebugToolCommand`|fn||335-353|function executeDebugToolCommand(|
5558
+ |`registerDebugToolCommands`|fn||362-401|function registerDebugToolCommands(pi: ExtensionAPI): void|
5559
+ |`saveProjectConfig`|fn||411-414|function saveProjectConfig(cwd: string, config: UseReqCon...|
5560
+ |`formatLocalConfigPathForMenu`|fn||423-427|function formatLocalConfigPathForMenu(cwd: string): string|
5561
+ |`formatGlobalConfigPathForMenu`|fn||435-437|function formatGlobalConfigPathForMenu(): string|
5562
+ |`buildTerminalSettingsMenuChoices`|fn||446-457|function buildTerminalSettingsMenuChoices(options:|
5563
+ |`ResetConfirmationChange`|iface||463-467|interface ResetConfirmationChange|
5564
+ |`formatResetConfirmationValue`|fn||476-478|function formatResetConfirmationValue(previousValue: stri...|
5565
+ |`buildResetConfirmationChoices`|fn||488-527|function buildResetConfirmationChoices(|
5566
+ |`confirmResetChanges`|fn||539-552|async function confirmResetChanges(|
5567
+ |`writePersistedConfigToEditor`|fn||561-566|function writePersistedConfigToEditor(|
5568
+ |`writePersistedLocalConfigToEditor`|fn||576-582|function writePersistedLocalConfigToEditor(|
5569
+ |`writePersistedGlobalConfigToEditor`|fn||591-595|function writePersistedGlobalConfigToEditor(|
5570
+ |`buildSearchToolSupportedTagGuidelines`|fn||656-660|function buildSearchToolSupportedTagGuidelines(): string[]|
5571
+ |`buildSearchToolSchemaDescription`|fn||668-673|function buildSearchToolSchemaDescription(scope: FindTool...|
5572
+ |`buildSearchToolPromptGuidelines`|fn||681-694|function buildSearchToolPromptGuidelines(scope: FindToolS...|
5573
+ |`MonolithicToolRenderResult`|type||700||
5574
+ |`getMonolithicToolText`|fn||717-720|function getMonolithicToolText(result: MonolithicToolRend...|
5575
+ |`getMonolithicToolErrorText`|fn||728-738|function getMonolithicToolErrorText(result: MonolithicToo...|
5576
+ |`formatCompactToolArgumentValue`|fn||746-785|function formatCompactToolArgumentValue(value: unknown): ...|
5577
+ |`buildCompactToolInvocationText`|fn||793-804|function buildCompactToolInvocationText(args: Record<stri...|
5578
+ |`summarizeStructuredToolResult`|fn||814-829|function summarizeStructuredToolResult(|
5579
+ |`buildStructuredToolRenderResult`|fn||838-857|function buildStructuredToolRenderResult(toolName: string)|
5580
+ |`executeMonolithicTool`|fn||865-871|function executeMonolithicTool(operation: () => ToolResul...|
5581
+ |`executeStatusTool`|fn||880-909|function executeStatusTool(operation: () => ToolResult): ...|
5582
+ |`deliverPromptCommand`|fn||921-970|function deliverPromptCommand(|
5583
+ |`shouldIgnoreLatePromptDeliveryFailure`|fn||981-997|function shouldIgnoreLatePromptDeliveryFailure(|
5584
+ |`logPromptWorkflowStateChange`|fn||1010-1029|function logPromptWorkflowStateChange(|
5585
+ |`logPromptWorkflowEvent`|fn||1045-1065|function logPromptWorkflowEvent(|
5586
+ |`transitionPromptWorkflowState`|fn||1078-1091|function transitionPromptWorkflowState(|
5587
+ |`resolvePromptCommandDescription`|fn||1099-1103|function resolvePromptCommandDescription(|
5588
+ |`resolveDebugProjectBase`|fn||1112-1116|function resolveDebugProjectBase(cwd: string, statusContr...|
5589
+ |`notifyContextSafely`|fn||1127-1144|function notifyContextSafely(|
5590
+ |`rejectNonIdleReqCommand`|fn||1156-1176|function rejectNonIdleReqCommand(|
5591
+ |`getPiUsereqStartupTools`|fn||1185-1193|function getPiUsereqStartupTools(pi: ExtensionAPI): ToolI...|
5592
+ |`getConfiguredEnabledPiUsereqTools`|fn||1201-1205|function getConfiguredEnabledPiUsereqTools(config: UseReq...|
5593
+ |`applyConfiguredPiUsereqTools`|fn||1215-1232|function applyConfiguredPiUsereqTools(pi: ExtensionAPI, c...|
5594
+ |`handleExtensionStatusEvent`|fn||1245-1516|async function handleExtensionStatusEvent(|
5595
+ |`registerExtensionStatusHooks`|fn||1532-1551|function registerExtensionStatusHooks(|
5596
+ |`setConfiguredPiUsereqTools`|fn||1561-1564|function setConfiguredPiUsereqTools(pi: ExtensionAPI, con...|
5597
+ |`getDebugToolToggleNames`|fn||1572-1574|function getDebugToolToggleNames(): PiUsereqStartupToolNa...|
5598
+ |`resetDebugConfigToDefaults`|fn||1583-1592|function resetDebugConfigToDefaults(config: UseReqConfig)...|
5599
+ |`formatDebugMenuSummary`|fn||1600-1606|function formatDebugMenuSummary(config: UseReqConfig): st...|
5600
+ |`buildDebugMenuChoice`|fn||1616-1629|function buildDebugMenuChoice(|
5601
+ |`selectDebugLogOnStatus`|fn||1638-1666|async function selectDebugLogOnStatus(|
5602
+ |`buildDebugMenuChoices`|fn||1675-1761|function buildDebugMenuChoices(config: UseReqConfig): PiU...|
5603
+ |`configureDebugMenu`|fn||1772-1962|async function configureDebugMenu(|
5604
+ |`updateDebugToolCommandsEnabled`|fn||1778-1785|const updateDebugToolCommandsEnabled = (nextValue: unknow...|
5605
+ |`PiNotifyBooleanConfigKey`|type||1968||
5606
+ |`PiNotifyEventBooleanConfigKey`|type||1985||
5607
+ |`PiNotifyEventId`|type||1994||
5608
+ |`PiNotifyEventRowDefinition`|iface||2000-2004|interface PiNotifyEventRowDefinition|
5609
+ |`PiNotifyEventMenuDefinition`|iface||2010-2016|interface PiNotifyEventMenuDefinition|
5610
+ |`togglePiNotifyFlag`|fn||2025-2028|function togglePiNotifyFlag(config: UseReqConfig, key: Pi...|
5611
+ |`resetPiNotifyConfigToDefaults`|fn||2037-2061|function resetPiNotifyConfigToDefaults(config: UseReqConf...|
5612
+ |`formatPiNotifyPushoverPriority`|fn||2070-2072|function formatPiNotifyPushoverPriority(priority: PiNotif...|
5613
+ |`formatPiNotifyEventMenuSummary`|fn||2156-2164|function formatPiNotifyEventMenuSummary(|
5614
+ |`buildPiNotifyEventLauncherChoice`|fn||2174-2184|function buildPiNotifyEventLauncherChoice(|
5615
+ |`buildPiNotifyEventMenuChoices`|fn||2194-2210|function buildPiNotifyEventMenuChoices(|
5616
+ |`resetPiNotifyEventMenuToDefaults`|fn||2220-2228|function resetPiNotifyEventMenuToDefaults(|
5617
+ |`resolvePiNotifyEventLabel`|fn||2238-2245|function resolvePiNotifyEventLabel(|
5618
+ |`configurePiNotifyEventMenu`|fn||2256-2332|async function configurePiNotifyEventMenu(|
5619
+ |`buildPiNotifyPushoverRows`|fn||2341-2391|function buildPiNotifyPushoverRows(config: UseReqConfig):...|
5620
+ |`selectPiNotifyPushoverPriority`|fn||2401-2429|async function selectPiNotifyPushoverPriority(|
5621
+ |`buildPiNotifyMenuChoices`|fn||2438-2496|function buildPiNotifyMenuChoices(config: UseReqConfig): ...|
5622
+ |`selectPiNotifySoundLevel`|fn||2506-2546|async function selectPiNotifySoundLevel(|
5623
+ |`configurePiNotifyMenu`|fn||2556-2842|async function configurePiNotifyMenu(|
5624
+ |`registerPiNotifyShortcut`|fn||2857-2880|function registerPiNotifyShortcut(|
5625
+ |`resolveReqResetPromptRequest`|fn||2888-2914|function resolveReqResetPromptRequest(|
5626
+ |`isWorktreeBacked`|fn||2891-2898|const isWorktreeBacked = (request: PromptCommandExecution...|
5627
+ |`registerReqResetCommand`|fn||2924-2978|function registerReqResetCommand(|
5628
+ |`registerReqReferencesCommand`|fn||2988-3028|function registerReqReferencesCommand(|
5629
+ |`registerPromptCommands`|fn||3038-3159|function registerPromptCommands(|
5630
+ |`registerAgentTools`|fn||3169-3468|function registerAgentTools(pi: ExtensionAPI): void|
5631
+ |`buildPiUsereqToolsMenuChoices`|fn||3513-3538|function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, ...|
5632
+ |`buildPiUsereqToolToggleChoices`|fn||3548-3562|function buildPiUsereqToolToggleChoices(pi: ExtensionAPI,...|
5633
+ |`configurePiUsereqToolsMenu`|fn||3573-3690|async function configurePiUsereqToolsMenu(|
5634
+ |`getStaticCheckLanguageConfigForMenu`|fn||3699-3704|function getStaticCheckLanguageConfigForMenu(|
5635
+ |`countConfiguredStaticCheckLanguages`|fn||3712-3714|function countConfiguredStaticCheckLanguages(config: UseR...|
5636
+ |`countEnabledStaticCheckLanguages`|fn||3722-3724|function countEnabledStaticCheckLanguages(config: UseReqC...|
5637
+ |`resetStaticCheckConfig`|fn||3733-3735|function resetStaticCheckConfig(config: UseReqConfig): void|
5638
+ |`formatStaticCheckLanguagesSummary`|fn||3743-3745|function formatStaticCheckLanguagesSummary(config: UseReq...|
5639
+ |`buildStaticCheckMenuChoices`|fn||3754-3786|function buildStaticCheckMenuChoices(config: UseReqConfig...|
5640
+ |`buildSupportedStaticCheckLanguageChoices`|fn||3794-3811|function buildSupportedStaticCheckLanguageChoices(config:...|
5641
+ |`buildConfiguredStaticCheckLanguageChoices`|fn||3819-3836|function buildConfiguredStaticCheckLanguageChoices(config...|
5642
+ |`configureStaticCheckMenu`|fn||3846-3992|async function configureStaticCheckMenu(|
5643
+ |`formatContextFilesSummary`|fn||4001-4003|function formatContextFilesSummary(config: UseReqConfig):...|
5644
+ |`buildContextFilesMenuChoices`|fn||4012-4039|function buildContextFilesMenuChoices(config: UseReqConfi...|
5645
+ |`configureContextFilesMenu`|fn||4050-4108|async function configureContextFilesMenu(|
5646
+ |`setFlag`|fn||4055-4059|const setFlag = (flagKey: "context-files-requirements" | ...|
5647
+ |`buildPiUsereqMenuChoices`|fn||4118-4223|function buildPiUsereqMenuChoices(|
5648
+ |`buildSrcDirMenuChoices`|fn||4232-4250|function buildSrcDirMenuChoices(config: UseReqConfig): Pi...|
5649
+ |`buildSrcDirRemovalChoices`|fn||4259-4271|function buildSrcDirRemovalChoices(config: UseReqConfig):...|
5650
+ |`configurePiUsereq`|fn||4282-4540|async function configurePiUsereq(|
5651
+ |`persistConfigChange`|fn||4293-4298|const persistConfigChange = () =>|
5652
+ |`registerConfigCommands`|fn||4550-4560|function registerConfigCommands(|
5653
+ |`piUsereqExtension`|fn||4569-4582|export default function piUsereqExtension(pi: ExtensionAP...|
5595
5654