pi-usereq 0.12.0 → 0.13.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.
- package/CHANGELOG.md +11 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/pi-usereq/docs/REFERENCES.md +509 -335
- package/pi-usereq/docs/REQUIREMENTS.md +53 -40
- package/pi-usereq/docs/WORKFLOW.md +67 -36
- package/src/core/config.ts +541 -180
- package/src/core/extension-status.ts +2 -2
- package/src/core/path-context.ts +19 -4
- package/src/index.ts +82 -35
- package/tests/attended-results-scenarios.ts +10 -4
- package/tests/cli-command-option-parity.test.ts +28 -10
- package/tests/debug-extension-harness.test.ts +7 -9
- package/tests/extension-registration.test.ts +170 -118
- package/tests/helpers.ts +29 -6
|
@@ -581,10 +581,10 @@ import { buildLanguageSpecs } from "./source-analyzer.js";
|
|
|
581
581
|
|
|
582
582
|
---
|
|
583
583
|
|
|
584
|
-
# config.ts | TypeScript |
|
|
584
|
+
# config.ts | TypeScript | 1141L | 43 symbols | 8 imports | 52 comments
|
|
585
585
|
> Path: `src/core/config.ts`
|
|
586
|
-
- @brief Loads, normalizes, and persists pi-usereq
|
|
587
|
-
- @details Defines the configuration schema,
|
|
586
|
+
- @brief Loads, normalizes, merges, and persists pi-usereq configuration.
|
|
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`.
|
|
588
588
|
|
|
589
589
|
## Imports
|
|
590
590
|
```
|
|
@@ -600,41 +600,87 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
600
600
|
|
|
601
601
|
## Definitions
|
|
602
602
|
|
|
603
|
-
### iface `export interface StaticCheckEntry` (
|
|
603
|
+
### iface `export interface StaticCheckEntry` (L55-59)
|
|
604
604
|
- @brief Describes one static-check module configuration entry.
|
|
605
605
|
- @details Each record identifies the checker module and optional command or parameter list used during per-language static analysis dispatch. The interface is type-only and has no runtime cost.
|
|
606
606
|
|
|
607
|
-
- type `export type StaticCheckEnabled = "enable" | "disable";` (
|
|
607
|
+
- type `export type StaticCheckEnabled = "enable" | "disable";` (L65)
|
|
608
608
|
- @brief Represents the persisted per-language static-check enable flag.
|
|
609
609
|
- @details Narrows persisted per-language enablement to the documented `enable|disable` domain reused by configuration loading, menu toggles, and static-check dispatch. The alias is compile-time only and introduces no runtime cost.
|
|
610
|
-
### iface `export interface StaticCheckLanguageConfig` (
|
|
610
|
+
### iface `export interface StaticCheckLanguageConfig` (L71-74)
|
|
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` (
|
|
615
|
-
- @brief Defines the
|
|
616
|
-
- @details Captures documentation paths, source/test directory selection, per-language static-check enablement
|
|
614
|
+
### iface `export interface UseReqConfig` (L80-118)
|
|
615
|
+
- @brief Defines the effective pi-usereq configuration schema.
|
|
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
|
-
###
|
|
618
|
+
### iface `interface LocalStaticCheckLanguageConfig` (L124-126)
|
|
619
|
+
- @brief Defines one persisted local static-check language configuration.
|
|
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
|
+
|
|
622
|
+
### iface `interface GlobalStaticCheckLanguageConfig` (L132-134)
|
|
623
|
+
- @brief Defines one persisted global static-check language configuration.
|
|
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
|
+
|
|
626
|
+
### iface `interface UseReqLocalConfig` (L140-152)
|
|
627
|
+
- @brief Defines the persisted local pi-usereq configuration schema.
|
|
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
|
+
|
|
630
|
+
### iface `interface UseReqGlobalConfig` (L158-186)
|
|
631
|
+
- @brief Defines the persisted global pi-usereq configuration schema.
|
|
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
|
+
|
|
634
|
+
### fn `function cloneStaticCheckEntry(entry: StaticCheckEntry): StaticCheckEntry` (L303-312)
|
|
619
635
|
- @brief Clones one static-check entry into its persisted shape.
|
|
620
636
|
- @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.
|
|
621
637
|
- @param[in] entry {StaticCheckEntry} Source static-check entry.
|
|
622
638
|
- @return {StaticCheckEntry} Persistable static-check entry clone.
|
|
623
639
|
|
|
624
|
-
### fn `export function createStaticCheckLanguageConfig(` (
|
|
640
|
+
### fn `export function createStaticCheckLanguageConfig(` (L321-330)
|
|
625
641
|
- @brief Builds one per-language static-check configuration object.
|
|
626
642
|
- @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.
|
|
627
643
|
- @param[in] checkers {StaticCheckEntry[]} Ordered checker entries.
|
|
628
644
|
- @param[in] enabled {StaticCheckEnabled | undefined} Optional explicit enable flag.
|
|
629
645
|
- @return {StaticCheckLanguageConfig} Normalized per-language config object.
|
|
630
646
|
|
|
631
|
-
### fn `
|
|
647
|
+
### fn `function createLocalStaticCheckLanguageConfig(` (L338-342)
|
|
648
|
+
- @brief Builds one persisted local static-check language configuration object.
|
|
649
|
+
- @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
|
+
- @param[in] enabled {StaticCheckEnabled} Canonical per-language enable flag.
|
|
651
|
+
- @return {LocalStaticCheckLanguageConfig} Persistable local static-check language config.
|
|
652
|
+
|
|
653
|
+
### fn `function createGlobalStaticCheckLanguageConfig(` (L350-356)
|
|
654
|
+
- @brief Builds one persisted global static-check language configuration object.
|
|
655
|
+
- @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
|
+
- @param[in] checkers {StaticCheckEntry[]} Ordered checker entries.
|
|
657
|
+
- @return {GlobalStaticCheckLanguageConfig} Persistable global static-check language config.
|
|
658
|
+
|
|
659
|
+
### fn `function getDefaultGlobalStaticCheckConfig(): Record<string, GlobalStaticCheckLanguageConfig>` (L363-368)
|
|
660
|
+
- @brief Returns the documented default global static-check checker map.
|
|
661
|
+
- @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
|
+
- @return {Record<string, GlobalStaticCheckLanguageConfig>} Fresh default global checker map.
|
|
663
|
+
|
|
664
|
+
### fn `function getDefaultLocalStaticCheckConfig(` (L376-385)
|
|
665
|
+
- @brief Returns the documented default local static-check enable map.
|
|
666
|
+
- @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
|
+
- @param[in] globalStaticCheckConfig {Record<string, GlobalStaticCheckLanguageConfig>} Global checker map used to derive default enablement.
|
|
668
|
+
- @return {Record<string, LocalStaticCheckLanguageConfig>} Fresh default local enable map.
|
|
669
|
+
|
|
670
|
+
### fn `function mergeStaticCheckConfig(` (L394-413)
|
|
671
|
+
- @brief Merges local enable flags with global checker definitions into the effective static-check map.
|
|
672
|
+
- @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
|
+
- @param[in] localStaticCheckConfig {Record<string, LocalStaticCheckLanguageConfig>} Persisted local enable map.
|
|
674
|
+
- @param[in] globalStaticCheckConfig {Record<string, GlobalStaticCheckLanguageConfig>} Persisted global checker map.
|
|
675
|
+
- @return {Record<string, StaticCheckLanguageConfig>} Effective per-language static-check config.
|
|
676
|
+
|
|
677
|
+
### fn `export function getDefaultStaticCheckConfig(): Record<string, StaticCheckLanguageConfig>` (L421-427)
|
|
632
678
|
- @brief Returns the documented default static-check configuration.
|
|
633
|
-
- @details Emits one per-language config object for every supported language
|
|
634
|
-
- @return {Record<string, StaticCheckLanguageConfig>} Fresh default static-check config.
|
|
635
|
-
- @satisfies REQ-249, REQ-250, REQ-251, REQ-252
|
|
679
|
+
- @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
|
+
- @return {Record<string, StaticCheckLanguageConfig>} Fresh default effective static-check config.
|
|
681
|
+
- @satisfies REQ-249, REQ-250, REQ-251, REQ-252, REQ-316
|
|
636
682
|
|
|
637
|
-
### fn `export function normalizeStaticCheckEnabled(` (
|
|
683
|
+
### fn `export function normalizeStaticCheckEnabled(` (L437-442)
|
|
638
684
|
- @brief Normalizes one persisted per-language static-check enable flag.
|
|
639
685
|
- @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.
|
|
640
686
|
- @param[in] value {unknown} Candidate persisted enable flag.
|
|
@@ -642,7 +688,7 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
642
688
|
- @return {StaticCheckEnabled} Canonical per-language enable flag.
|
|
643
689
|
- @satisfies REQ-249
|
|
644
690
|
|
|
645
|
-
### fn `export function getActiveStaticCheckEntries(` (
|
|
691
|
+
### fn `export function getActiveStaticCheckEntries(` (L452-461)
|
|
646
692
|
- @brief Resolves the active checker list for one language.
|
|
647
693
|
- @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.
|
|
648
694
|
- @param[in] staticCheckConfig {Record<string, StaticCheckLanguageConfig>} Effective static-check config.
|
|
@@ -650,21 +696,21 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
650
696
|
- @return {StaticCheckEntry[]} Active checker list for the language.
|
|
651
697
|
- @satisfies REQ-019
|
|
652
698
|
|
|
653
|
-
### fn `export function normalizeAutoGitCommit(value: unknown): "enable" | "disable"` (
|
|
699
|
+
### fn `export function normalizeAutoGitCommit(value: unknown): "enable" | "disable"` (L476-478)
|
|
654
700
|
- @brief Normalizes one persisted automatic git-commit mode value.
|
|
655
701
|
- @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.
|
|
656
702
|
- @param[in] value {unknown} Candidate persisted automatic git-commit payload.
|
|
657
703
|
- @return {"enable" | "disable"} Canonical automatic git-commit mode.
|
|
658
704
|
- @satisfies REQ-212
|
|
659
705
|
|
|
660
|
-
### fn `export function normalizeGitWorktreeEnabled(value: unknown): "enable" | "disable"` (
|
|
706
|
+
### fn `export function normalizeGitWorktreeEnabled(value: unknown): "enable" | "disable"` (L492-494)
|
|
661
707
|
- @brief Normalizes one persisted worktree-enable flag value.
|
|
662
708
|
- @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.
|
|
663
709
|
- @param[in] value {unknown} Candidate persisted worktree-enable payload.
|
|
664
710
|
- @return {"enable" | "disable"} Canonical persisted worktree-enable mode.
|
|
665
711
|
- @satisfies REQ-204
|
|
666
712
|
|
|
667
|
-
### fn `export function resolveEffectiveGitWorktreeEnabled(` (
|
|
713
|
+
### fn `export function resolveEffectiveGitWorktreeEnabled(` (L503-508)
|
|
668
714
|
- @brief Resolves the effective worktree mode after automatic-commit policy is applied.
|
|
669
715
|
- @details Forces `disable` whenever `AUTO_GIT_COMMIT` is disabled; otherwise preserves the normalized persisted worktree flag. Runtime is O(1). No side effects occur.
|
|
670
716
|
- @param[in] autoGitCommit {"enable" | "disable"} Effective automatic git-commit mode.
|
|
@@ -672,70 +718,149 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
672
718
|
- @return {"enable" | "disable"} Effective worktree mode used by menus, persistence, and prompt execution.
|
|
673
719
|
- @satisfies REQ-204, REQ-215
|
|
674
720
|
|
|
675
|
-
### fn `export function normalizeGitWorktreePrefix(value: unknown): string` (
|
|
721
|
+
### fn `export function normalizeGitWorktreePrefix(value: unknown): string` (L522-528)
|
|
676
722
|
- @brief Normalizes one persisted worktree-name prefix value.
|
|
677
723
|
- @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.
|
|
678
724
|
- @param[in] value {unknown} Candidate persisted prefix payload.
|
|
679
725
|
- @return {string} Canonical worktree-name prefix.
|
|
680
726
|
- @satisfies REQ-205
|
|
681
727
|
|
|
682
|
-
### fn `export function getProjectConfigPath(projectBase: string): string` (
|
|
683
|
-
- @brief Computes the per-project config file path.
|
|
684
|
-
- @details Joins the project base with `.pi-usereq.json`, producing the canonical persistence location used by CLI and extension code. Time complexity is O(1). No I/O side effects occur.
|
|
685
|
-
- @param[in] projectBase {string} Absolute project root path.
|
|
686
|
-
- @return {string} Absolute config file path.
|
|
687
|
-
|
|
688
|
-
### fn `export function getDefaultConfig(_projectBase: string): UseReqConfig` (L393-433)
|
|
689
|
-
- @brief Builds the default project configuration.
|
|
690
|
-
- @details Populates canonical docs/test/source directories, documented per-language static-check defaults, default prompt-command worktree settings, default debug fields including dedicated workflow-event logging, the default startup tool set, default command-notify, sound, and Pushover fields, and excludes runtime-derived path metadata. Time complexity is O(n) in default selector count plus default static-check entry count. No filesystem side effects occur.
|
|
728
|
+
### fn `export function getProjectConfigPath(projectBase: string): string` (L535-537)
|
|
729
|
+
- @brief Computes the per-project local config file path.
|
|
730
|
+
- @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.
|
|
691
731
|
- @param[in] projectBase {string} Absolute project root path.
|
|
692
|
-
- @return {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
732
|
+
- @return {string} Absolute local config file path.
|
|
733
|
+
|
|
734
|
+
### fn `export function getGlobalConfigPath(): string` (L544-546)
|
|
735
|
+
- @brief Computes the cross-project global config file path.
|
|
736
|
+
- @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
|
+
- @return {string} Absolute global config file path.
|
|
738
|
+
|
|
739
|
+
### fn `function getDefaultLocalConfig(` (L554-570)
|
|
740
|
+
- @brief Builds the default persisted local configuration.
|
|
741
|
+
- @details Populates canonical docs/test/source directories, derives local static-check enable defaults from the supplied global checker definitions, and seeds documented debug defaults without any cross-project fields. Runtime is O(l). No filesystem side effects occur.
|
|
742
|
+
- @param[in] globalStaticCheckConfig {Record<string, GlobalStaticCheckLanguageConfig>} Global checker definitions used to derive local enable defaults.
|
|
743
|
+
- @return {UseReqLocalConfig} Fresh default local configuration object.
|
|
744
|
+
|
|
745
|
+
### fn `function getDefaultGlobalConfig(): UseReqGlobalConfig` (L577-607)
|
|
746
|
+
- @brief Builds the default persisted global configuration.
|
|
747
|
+
- @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.
|
|
748
|
+
- @return {UseReqGlobalConfig} Fresh default global configuration object.
|
|
749
|
+
|
|
750
|
+
### fn `function mergeConfigScopes(` (L616-682)
|
|
751
|
+
- @brief Merges persisted local and global configuration scopes into the effective runtime config.
|
|
752
|
+
- @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, and disables Pushover until both credentials are populated. Runtime is O(l + c + p). No external state is mutated.
|
|
753
|
+
- @param[in] localConfig {UseReqLocalConfig} Persisted local configuration.
|
|
754
|
+
- @param[in] globalConfig {UseReqGlobalConfig} Persisted global configuration.
|
|
755
|
+
- @return {UseReqConfig} Effective merged configuration.
|
|
756
|
+
|
|
757
|
+
### fn `export function getDefaultConfig(_projectBase: string): UseReqConfig` (L691-697)
|
|
758
|
+
- @brief Builds the default effective configuration.
|
|
759
|
+
- @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.
|
|
760
|
+
- @param[in] _projectBase {string} Absolute project root path retained for stable call sites.
|
|
761
|
+
- @return {UseReqConfig} Fresh default effective configuration object.
|
|
762
|
+
- @satisfies CTN-001, CTN-012, CTN-013, CTN-018, 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
|
|
763
|
+
|
|
764
|
+
### fn `function normalizeStaticCheckEntries(value: unknown): StaticCheckEntry[]` (L705-725)
|
|
696
765
|
- @brief Normalizes one raw checker-entry array from persisted config.
|
|
697
766
|
- @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.
|
|
698
767
|
- @param[in] value {unknown} Candidate persisted checker array.
|
|
699
768
|
- @return {StaticCheckEntry[]} Normalized checker-entry vector.
|
|
700
769
|
|
|
701
|
-
### fn `function
|
|
702
|
-
- @brief
|
|
703
|
-
- @details
|
|
704
|
-
- @param[in]
|
|
705
|
-
- @return {Record<string,
|
|
706
|
-
- @
|
|
770
|
+
### fn `function readConfigPayload(configPath: string): Record<string, unknown> | undefined` (L734-750)
|
|
771
|
+
- @brief Reads and validates one persisted config payload.
|
|
772
|
+
- @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.
|
|
773
|
+
- @param[in] configPath {string} Absolute config file path.
|
|
774
|
+
- @return {Record<string, unknown> | undefined} Parsed object payload or `undefined` when the file is absent.
|
|
775
|
+
- @throws {ReqError} Throws with exit code `11` when the config file contains invalid JSON or a non-object payload.
|
|
776
|
+
|
|
777
|
+
### fn `function normalizeLocalStaticCheckConfig(` (L760-784)
|
|
778
|
+
- @brief Normalizes the persisted local static-check enable map.
|
|
779
|
+
- @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.
|
|
780
|
+
- @param[in] value {unknown} Candidate persisted local static-check payload.
|
|
781
|
+
- @param[in] defaultConfig {Record<string, LocalStaticCheckLanguageConfig>} Default enable map derived from global checker definitions.
|
|
782
|
+
- @return {Record<string, LocalStaticCheckLanguageConfig>} Normalized local static-check enable map.
|
|
783
|
+
- @satisfies REQ-249, REQ-316
|
|
784
|
+
|
|
785
|
+
### fn `function normalizeGlobalStaticCheckConfig(` (L793-810)
|
|
786
|
+
- @brief Normalizes the persisted global static-check checker map.
|
|
787
|
+
- @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.
|
|
788
|
+
- @param[in] value {unknown} Candidate persisted global static-check payload.
|
|
789
|
+
- @return {Record<string, GlobalStaticCheckLanguageConfig>} Normalized global static-check checker map.
|
|
790
|
+
- @satisfies REQ-249, REQ-250, REQ-251, REQ-252
|
|
707
791
|
|
|
708
|
-
### fn `
|
|
709
|
-
- @brief Loads and sanitizes the persisted
|
|
710
|
-
- @details Returns defaults when
|
|
792
|
+
### fn `function loadLocalConfig(` (L819-865)
|
|
793
|
+
- @brief Loads and sanitizes the persisted local configuration.
|
|
794
|
+
- @details Returns defaults when `<base-path>/.pi-usereq.json` is absent. Otherwise parses the local JSON payload, normalizes project-scoped directory, debug, 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.
|
|
795
|
+
- @param[in] projectBase {string} Absolute project root path.
|
|
796
|
+
- @param[in] defaultStaticCheckConfig {Record<string, LocalStaticCheckLanguageConfig>} Local static-check enable defaults derived from the current global checker map.
|
|
797
|
+
- @return {UseReqLocalConfig} Sanitized local configuration.
|
|
798
|
+
|
|
799
|
+
### fn `function loadGlobalConfig(): UseReqGlobalConfig` (L872-913)
|
|
800
|
+
- @brief Loads and sanitizes the persisted global configuration.
|
|
801
|
+
- @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.
|
|
802
|
+
- @return {UseReqGlobalConfig} Sanitized global configuration.
|
|
803
|
+
|
|
804
|
+
### fn `export function loadConfig(projectBase: string): UseReqConfig` (L923-930)
|
|
805
|
+
- @brief Loads and sanitizes the effective merged configuration.
|
|
806
|
+
- @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.
|
|
711
807
|
- @param[in] projectBase {string} Absolute project root path.
|
|
712
808
|
- @return {UseReqConfig} Sanitized effective configuration.
|
|
713
|
-
- @throws {ReqError} Throws with exit code `11` when
|
|
714
|
-
- @satisfies CTN-012, CTN-013, REQ-066, 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
|
|
809
|
+
- @throws {ReqError} Throws with exit code `11` when either persisted config file contains invalid JSON or a non-object payload.
|
|
810
|
+
- @satisfies CTN-012, CTN-013, CTN-018, 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
|
|
715
811
|
|
|
716
|
-
### fn `function
|
|
717
|
-
- @brief Builds the persisted configuration payload
|
|
718
|
-
- @details Copies only
|
|
812
|
+
### fn `function buildPersistedLocalConfig(config: UseReqConfig): UseReqLocalConfig` (L939-966)
|
|
813
|
+
- @brief Builds the persisted local configuration payload.
|
|
814
|
+
- @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`. Runtime is O(n) in config size. No external state is mutated.
|
|
719
815
|
- @param[in] config {UseReqConfig} Effective configuration object.
|
|
720
|
-
- @return {
|
|
721
|
-
- @satisfies CTN-012, CTN-013, REQ-
|
|
816
|
+
- @return {UseReqLocalConfig} Persistable local configuration payload.
|
|
817
|
+
- @satisfies CTN-012, CTN-013, REQ-104, REQ-146, REQ-249, REQ-316, REQ-277
|
|
722
818
|
|
|
723
|
-
### fn `
|
|
724
|
-
- @brief
|
|
725
|
-
- @details
|
|
819
|
+
### fn `function buildPersistedGlobalConfig(config: UseReqConfig): UseReqGlobalConfig` (L975-1014)
|
|
820
|
+
- @brief Builds the persisted global configuration payload.
|
|
821
|
+
- @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.
|
|
822
|
+
- @param[in] config {UseReqConfig} Effective configuration object.
|
|
823
|
+
- @return {UseReqGlobalConfig} Persistable global configuration payload.
|
|
824
|
+
- @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
|
|
825
|
+
|
|
826
|
+
### fn `function writeConfigFile(configPath: string, payload: object): void` (L1023-1026)
|
|
827
|
+
- @brief Writes one normalized config payload to disk.
|
|
828
|
+
- @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.
|
|
829
|
+
- @param[in] configPath {string} Absolute destination config path.
|
|
830
|
+
- @param[in] payload {object} Persistable config payload.
|
|
831
|
+
- @return {void} No return value.
|
|
832
|
+
|
|
833
|
+
### fn `export function saveLocalConfig(projectBase: string, config: UseReqConfig): void` (L1036-1038)
|
|
834
|
+
- @brief Persists the local configuration scope to disk.
|
|
835
|
+
- @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.
|
|
726
836
|
- @param[in] projectBase {string} Absolute project root path.
|
|
727
|
-
- @param[in] config {UseReqConfig}
|
|
837
|
+
- @param[in] config {UseReqConfig} Effective configuration object to persist.
|
|
728
838
|
- @return {void} No return value.
|
|
729
|
-
- @satisfies CTN-012, REQ-146
|
|
839
|
+
- @satisfies CTN-012, REQ-104, REQ-146
|
|
840
|
+
|
|
841
|
+
### fn `export function saveGlobalConfig(config: UseReqConfig): void` (L1047-1049)
|
|
842
|
+
- @brief Persists the global configuration scope to disk.
|
|
843
|
+
- @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.
|
|
844
|
+
- @param[in] config {UseReqConfig} Effective configuration object to persist.
|
|
845
|
+
- @return {void} No return value.
|
|
846
|
+
- @satisfies CTN-012, CTN-018, REQ-137, REQ-146, REQ-315
|
|
847
|
+
|
|
848
|
+
### fn `export function saveConfig(projectBase: string, config: UseReqConfig): void` (L1059-1062)
|
|
849
|
+
- @brief Persists the effective configuration to local and global config files.
|
|
850
|
+
- @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.
|
|
851
|
+
- @param[in] projectBase {string} Absolute project root path.
|
|
852
|
+
- @param[in] config {UseReqConfig} Effective configuration object to persist.
|
|
853
|
+
- @return {void} No return value.
|
|
854
|
+
- @satisfies CTN-012, CTN-018, REQ-137, REQ-146, REQ-315
|
|
730
855
|
|
|
731
|
-
### fn `export function normalizeConfigPaths(projectBase: string, config: UseReqConfig): UseReqConfig` (
|
|
856
|
+
### fn `export function normalizeConfigPaths(projectBase: string, config: UseReqConfig): UseReqConfig` (L1071-1089)
|
|
732
857
|
- @brief Normalizes persisted directory fields to project-relative forms.
|
|
733
858
|
- @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.
|
|
734
859
|
- @param[in] projectBase {string} Absolute project root path.
|
|
735
860
|
- @param[in] config {UseReqConfig} Configuration object to normalize.
|
|
736
861
|
- @return {UseReqConfig} Normalized configuration copy.
|
|
737
862
|
|
|
738
|
-
### fn `export function buildPromptReplacementPaths(` (
|
|
863
|
+
### fn `export function buildPromptReplacementPaths(` (L1099-1141)
|
|
739
864
|
- @brief Builds placeholder replacements for bundled prompt rendering.
|
|
740
865
|
- @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.
|
|
741
866
|
- @param[in] projectBase {string} Absolute project root path.
|
|
@@ -746,28 +871,49 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
746
871
|
## Symbol Index
|
|
747
872
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
748
873
|
|---|---|---|---|---|
|
|
749
|
-
|`StaticCheckEntry`|iface||
|
|
750
|
-
|`StaticCheckEnabled`|type||
|
|
751
|
-
|`StaticCheckLanguageConfig`|iface||
|
|
752
|
-
|`UseReqConfig`|iface||
|
|
753
|
-
|`
|
|
754
|
-
|`
|
|
755
|
-
|`
|
|
756
|
-
|`
|
|
757
|
-
|`
|
|
758
|
-
|`
|
|
759
|
-
|`
|
|
760
|
-
|`
|
|
761
|
-
|`
|
|
762
|
-
|`
|
|
763
|
-
|`
|
|
764
|
-
|`
|
|
765
|
-
|`
|
|
766
|
-
|`
|
|
767
|
-
|`
|
|
768
|
-
|`
|
|
769
|
-
|`
|
|
770
|
-
|`
|
|
874
|
+
|`StaticCheckEntry`|iface||55-59|export interface StaticCheckEntry|
|
|
875
|
+
|`StaticCheckEnabled`|type||65||
|
|
876
|
+
|`StaticCheckLanguageConfig`|iface||71-74|export interface StaticCheckLanguageConfig|
|
|
877
|
+
|`UseReqConfig`|iface||80-118|export interface UseReqConfig|
|
|
878
|
+
|`LocalStaticCheckLanguageConfig`|iface||124-126|interface LocalStaticCheckLanguageConfig|
|
|
879
|
+
|`GlobalStaticCheckLanguageConfig`|iface||132-134|interface GlobalStaticCheckLanguageConfig|
|
|
880
|
+
|`UseReqLocalConfig`|iface||140-152|interface UseReqLocalConfig|
|
|
881
|
+
|`UseReqGlobalConfig`|iface||158-186|interface UseReqGlobalConfig|
|
|
882
|
+
|`cloneStaticCheckEntry`|fn||303-312|function cloneStaticCheckEntry(entry: StaticCheckEntry): ...|
|
|
883
|
+
|`createStaticCheckLanguageConfig`|fn||321-330|export function createStaticCheckLanguageConfig(|
|
|
884
|
+
|`createLocalStaticCheckLanguageConfig`|fn||338-342|function createLocalStaticCheckLanguageConfig(|
|
|
885
|
+
|`createGlobalStaticCheckLanguageConfig`|fn||350-356|function createGlobalStaticCheckLanguageConfig(|
|
|
886
|
+
|`getDefaultGlobalStaticCheckConfig`|fn||363-368|function getDefaultGlobalStaticCheckConfig(): Record<stri...|
|
|
887
|
+
|`getDefaultLocalStaticCheckConfig`|fn||376-385|function getDefaultLocalStaticCheckConfig(|
|
|
888
|
+
|`mergeStaticCheckConfig`|fn||394-413|function mergeStaticCheckConfig(|
|
|
889
|
+
|`getDefaultStaticCheckConfig`|fn||421-427|export function getDefaultStaticCheckConfig(): Record<str...|
|
|
890
|
+
|`normalizeStaticCheckEnabled`|fn||437-442|export function normalizeStaticCheckEnabled(|
|
|
891
|
+
|`getActiveStaticCheckEntries`|fn||452-461|export function getActiveStaticCheckEntries(|
|
|
892
|
+
|`normalizeAutoGitCommit`|fn||476-478|export function normalizeAutoGitCommit(value: unknown): "...|
|
|
893
|
+
|`normalizeGitWorktreeEnabled`|fn||492-494|export function normalizeGitWorktreeEnabled(value: unknow...|
|
|
894
|
+
|`resolveEffectiveGitWorktreeEnabled`|fn||503-508|export function resolveEffectiveGitWorktreeEnabled(|
|
|
895
|
+
|`normalizeGitWorktreePrefix`|fn||522-528|export function normalizeGitWorktreePrefix(value: unknown...|
|
|
896
|
+
|`getProjectConfigPath`|fn||535-537|export function getProjectConfigPath(projectBase: string)...|
|
|
897
|
+
|`getGlobalConfigPath`|fn||544-546|export function getGlobalConfigPath(): string|
|
|
898
|
+
|`getDefaultLocalConfig`|fn||554-570|function getDefaultLocalConfig(|
|
|
899
|
+
|`getDefaultGlobalConfig`|fn||577-607|function getDefaultGlobalConfig(): UseReqGlobalConfig|
|
|
900
|
+
|`mergeConfigScopes`|fn||616-682|function mergeConfigScopes(|
|
|
901
|
+
|`getDefaultConfig`|fn||691-697|export function getDefaultConfig(_projectBase: string): U...|
|
|
902
|
+
|`normalizeStaticCheckEntries`|fn||705-725|function normalizeStaticCheckEntries(value: unknown): Sta...|
|
|
903
|
+
|`readConfigPayload`|fn||734-750|function readConfigPayload(configPath: string): Record<st...|
|
|
904
|
+
|`normalizeLocalStaticCheckConfig`|fn||760-784|function normalizeLocalStaticCheckConfig(|
|
|
905
|
+
|`normalizeGlobalStaticCheckConfig`|fn||793-810|function normalizeGlobalStaticCheckConfig(|
|
|
906
|
+
|`loadLocalConfig`|fn||819-865|function loadLocalConfig(|
|
|
907
|
+
|`loadGlobalConfig`|fn||872-913|function loadGlobalConfig(): UseReqGlobalConfig|
|
|
908
|
+
|`loadConfig`|fn||923-930|export function loadConfig(projectBase: string): UseReqCo...|
|
|
909
|
+
|`buildPersistedLocalConfig`|fn||939-966|function buildPersistedLocalConfig(config: UseReqConfig):...|
|
|
910
|
+
|`buildPersistedGlobalConfig`|fn||975-1014|function buildPersistedGlobalConfig(config: UseReqConfig)...|
|
|
911
|
+
|`writeConfigFile`|fn||1023-1026|function writeConfigFile(configPath: string, payload: obj...|
|
|
912
|
+
|`saveLocalConfig`|fn||1036-1038|export function saveLocalConfig(projectBase: string, conf...|
|
|
913
|
+
|`saveGlobalConfig`|fn||1047-1049|export function saveGlobalConfig(config: UseReqConfig): void|
|
|
914
|
+
|`saveConfig`|fn||1059-1062|export function saveConfig(projectBase: string, config: U...|
|
|
915
|
+
|`normalizeConfigPaths`|fn||1071-1089|export function normalizeConfigPaths(projectBase: string,...|
|
|
916
|
+
|`buildPromptReplacementPaths`|fn||1099-1141|export function buildPromptReplacementPaths(|
|
|
771
917
|
|
|
772
918
|
|
|
773
919
|
---
|
|
@@ -1433,14 +1579,14 @@ mutates `controller.config`.
|
|
|
1433
1579
|
|
|
1434
1580
|
### fn `export function getPiUsereqRuntimeSoundLevel(` (L697-701)
|
|
1435
1581
|
- @brief Returns the active runtime sound level tracked by the status controller.
|
|
1436
|
-
- @details Exposes the in-memory runtime sound state so shortcut handlers and prompt-end notification dispatch can stay decoupled from the persisted boot value stored in
|
|
1582
|
+
- @details Exposes the in-memory runtime sound state so shortcut handlers and prompt-end notification dispatch can stay decoupled from the persisted boot value stored in global configuration. Runtime is O(1). No external state is mutated.
|
|
1437
1583
|
- @param[in] controller {PiUsereqStatusController} Mutable status controller.
|
|
1438
1584
|
- @return {PiNotifySoundLevel} Active runtime sound level.
|
|
1439
1585
|
- @satisfies REQ-180, REQ-285
|
|
1440
1586
|
|
|
1441
1587
|
### fn `export function setPiUsereqRuntimeSoundLevel(` (L712-722)
|
|
1442
1588
|
- @brief Stores one new runtime sound level and refreshes the status bar.
|
|
1443
|
-
- @details Mutates only the in-memory runtime sound state so shortcut-driven sound changes do not update
|
|
1589
|
+
- @details Mutates only the in-memory runtime sound state so shortcut-driven sound changes do not update persisted local or global configuration, then re-renders the footer when an active extension context is available. Runtime is O(1). Side effect: mutates `controller.state.runtimeSoundLevel` and may update `ctx.ui` status.
|
|
1444
1590
|
- @param[in] runtimeSoundLevel {PiNotifySoundLevel} Next active runtime sound level.
|
|
1445
1591
|
- @param[in] ctx {ExtensionContext | undefined} Optional active extension context.
|
|
1446
1592
|
- @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
|
|
@@ -1924,7 +2070,7 @@ import { SourceAnalyzer, formatMarkdown } from "./source-analyzer.js";
|
|
|
1924
2070
|
|
|
1925
2071
|
---
|
|
1926
2072
|
|
|
1927
|
-
# path-context.ts | TypeScript |
|
|
2073
|
+
# path-context.ts | TypeScript | 476L | 23 symbols | 5 imports | 28 comments
|
|
1928
2074
|
> Path: `src/core/path-context.ts`
|
|
1929
2075
|
- @brief Derives shared runtime path contracts for prompts, tools, and configuration flows.
|
|
1930
2076
|
- @details Centralizes the static bootstrap paths and dynamic cwd-aligned paths used across the extension runtime. The module also exposes home-relative display formatting, trailing-slash-free normalization, and prompt-facing path facts. Runtime is O(s + p) where s is the configured source-directory count and p is aggregate path length. Side effects are limited to module-local runtime-path state mutation.
|
|
@@ -1940,122 +2086,127 @@ import type { UseReqConfig } from "./config.js";
|
|
|
1940
2086
|
|
|
1941
2087
|
## Definitions
|
|
1942
2088
|
|
|
1943
|
-
### iface `export interface RuntimePathState` (
|
|
2089
|
+
### iface `export interface RuntimePathState` (L35-43)
|
|
1944
2090
|
- @brief Stores the mutable runtime path state shared across extension callbacks.
|
|
1945
2091
|
- @details Persists the static bootstrap `base-path`, the dynamic `context-path`, the optional repository-derived `git-path`, the derived `parent-path` and `base-dir`, and the optional active worktree facts. The interface is compile-time only and introduces no runtime cost.
|
|
1946
2092
|
|
|
1947
|
-
### iface `export interface RuntimePathContext extends RuntimePathState` : RuntimePathState (
|
|
2093
|
+
### iface `export interface RuntimePathContext extends RuntimePathState` : RuntimePathState (L49-62)
|
|
1948
2094
|
- @brief Describes the absolute runtime path context shared across extension components.
|
|
1949
2095
|
- @details Aggregates the static installation, base, git, parent, and config paths with the dynamic context and optional worktree paths plus execution-resolved docs/tests/source absolute paths. The interface is compile-time only and introduces no runtime cost.
|
|
1950
2096
|
|
|
1951
|
-
### iface `export interface RuntimePathFacts` (
|
|
2097
|
+
### iface `export interface RuntimePathFacts` (L68-89)
|
|
1952
2098
|
- @brief Describes the prompt/tool-facing runtime paths rendered for display.
|
|
1953
2099
|
- @details Mirrors `RuntimePathContext` in a serialization-oriented shape so downstream agents can consume stable `~`-relative absolute paths and trailing-slash-free relative directories without reparsing platform-specific separators. The interface is compile-time only and introduces no runtime cost.
|
|
1954
2100
|
|
|
1955
|
-
### fn `export function getInstallationPath(): string` (
|
|
2101
|
+
### fn `export function getInstallationPath(): string` (L104-106)
|
|
1956
2102
|
- @brief Resolves the installed extension root that owns `index.ts` and bundled resources.
|
|
1957
2103
|
- @details Uses the current module location under `src/core` or its installed equivalent, then moves one directory upward so the returned path is the runtime installation root containing `resources/`. Runtime is O(1). No external state is mutated.
|
|
1958
2104
|
- @return {string} Absolute installation path.
|
|
1959
2105
|
|
|
1960
|
-
### fn `export function normalizePathSlashes(value: string): string` (
|
|
2106
|
+
### fn `export function normalizePathSlashes(value: string): string` (L114-116)
|
|
1961
2107
|
- @brief Formats one path with slash separators.
|
|
1962
2108
|
- @details Rewrites backslashes to `/` without changing semantic path identity so serialized payloads remain stable across operating systems. Runtime is O(p) in path length. No external state is mutated.
|
|
1963
2109
|
- @param[in] value {string} Absolute or relative filesystem path.
|
|
1964
2110
|
- @return {string} Slash-normalized path string.
|
|
1965
2111
|
|
|
1966
|
-
### fn `function trimTrailingSeparatorsPreserveRoot(value: string): string` (
|
|
2112
|
+
### fn `function trimTrailingSeparatorsPreserveRoot(value: string): string` (L124-138)
|
|
1967
2113
|
- @brief Removes trailing separators while preserving a filesystem root.
|
|
1968
2114
|
- @details Keeps `/`, drive roots, and UNC roots intact while trimming redundant trailing separators from every other absolute or relative path string. Runtime is O(p) in path length. No external state is mutated.
|
|
1969
2115
|
- @param[in] value {string} Raw path string.
|
|
1970
2116
|
- @return {string} Trailing-slash-free path string.
|
|
1971
2117
|
|
|
1972
|
-
### fn `export function normalizeAbsolutePathContract(value: string): string` (
|
|
2118
|
+
### fn `export function normalizeAbsolutePathContract(value: string): string` (L146-148)
|
|
1973
2119
|
- @brief Normalizes one absolute path contract value.
|
|
1974
2120
|
- @details Resolves the supplied value to an absolute path, removes trailing separators except for the filesystem root, and rewrites separators to `/`. Runtime is O(p) in path length. No external state is mutated.
|
|
1975
2121
|
- @param[in] value {string} Absolute or relative path candidate.
|
|
1976
2122
|
- @return {string} Canonical trailing-slash-free absolute path.
|
|
1977
2123
|
|
|
1978
|
-
### fn `export function normalizeRelativeDirContract(value: string): string` (
|
|
2124
|
+
### fn `export function normalizeRelativeDirContract(value: string): string` (L156-161)
|
|
1979
2125
|
- @brief Normalizes one relative-directory contract value.
|
|
1980
2126
|
- @details Trims whitespace, rewrites separators to `/`, removes a leading `./`, and removes trailing separators so persisted `*-dir` values stay relative and trailing-slash-free. Runtime is O(p) in path length. No external state is mutated.
|
|
1981
2127
|
- @param[in] value {string} Relative-directory candidate.
|
|
1982
2128
|
- @return {string} Canonical trailing-slash-free relative-directory string.
|
|
1983
2129
|
|
|
1984
|
-
### fn `export function getConfigPath(basePath: string): string` (
|
|
1985
|
-
- @brief Computes the absolute project config path for one base path.
|
|
2130
|
+
### fn `export function getConfigPath(basePath: string): string` (L169-171)
|
|
2131
|
+
- @brief Computes the absolute local project config path for one base path.
|
|
1986
2132
|
- @details Appends `.pi-usereq.json` to the supplied base path using the canonical repository-local configuration layout. Runtime is O(1). No external state is mutated.
|
|
1987
2133
|
- @param[in] basePath {string} Absolute or relative base path.
|
|
1988
|
-
- @return {string} Absolute config-file path.
|
|
2134
|
+
- @return {string} Absolute local config-file path.
|
|
1989
2135
|
|
|
1990
|
-
### fn `export function
|
|
2136
|
+
### fn `export function getGlobalConfigPath(): string` (L178-180)
|
|
2137
|
+
- @brief Computes the absolute global config path for the current user.
|
|
2138
|
+
- @details Resolves `~/.config/pi-usereq/config.json` from the current user home directory without consulting project state. Runtime is O(1). No external state is mutated.
|
|
2139
|
+
- @return {string} Absolute global config-file path.
|
|
2140
|
+
|
|
2141
|
+
### fn `export function isSameOrAncestorPath(` (L189-203)
|
|
1991
2142
|
- @brief Tests whether one path is identical to or an ancestor of another path.
|
|
1992
2143
|
- @details Resolves both inputs, computes a relative traversal from the candidate ancestor to the candidate child, and accepts only exact matches or descendant traversals that stay within the ancestor subtree. Runtime is O(p) in path length. No external state is mutated.
|
|
1993
2144
|
- @param[in] ancestorPath {string} Candidate ancestor or identical path.
|
|
1994
2145
|
- @param[in] childPath {string} Candidate child or identical path.
|
|
1995
2146
|
- @return {boolean} `true` when `ancestorPath` equals `childPath` or strictly contains it.
|
|
1996
2147
|
|
|
1997
|
-
### fn `function deriveStaticRuntimePathState(` (
|
|
2148
|
+
### fn `function deriveStaticRuntimePathState(` (L212-237)
|
|
1998
2149
|
- @brief Derives repository-relative runtime state from one base path and optional git path.
|
|
1999
2150
|
- @details Normalizes `base-path`, keeps `git-path` only when it is identical to or an ancestor of `base-path`, derives `parent-path` from `git-path`, and derives `base-dir` as `base-path` relative to `git-path`. Runtime is O(p) in path length. No external state is mutated.
|
|
2000
2151
|
- @param[in] basePath {string} Static base path candidate.
|
|
2001
2152
|
- @param[in] gitPath {string | undefined} Optional repository-root candidate.
|
|
2002
2153
|
- @return {{ basePath: string; gitPath?: string; parentPath?: string; baseDir: string }} Derived static path facts.
|
|
2003
2154
|
|
|
2004
|
-
### fn `export function bootstrapRuntimePathState(` (
|
|
2155
|
+
### fn `export function bootstrapRuntimePathState(` (L246-248)
|
|
2005
2156
|
- @brief Bootstraps the shared runtime path state for one extension session or command preflight.
|
|
2006
2157
|
- @details Sets static `base-path`, initializes dynamic `context-path` to the same value, stores derived `git-path`, `parent-path`, and `base-dir`, and clears any prior worktree facts. Runtime is O(p) in path length. Side effect: mutates module-local runtime-path state.
|
|
2007
2158
|
- @param[in] basePath {string} Bootstrap cwd that becomes the static base path.
|
|
2008
2159
|
- @param[in] options {{ gitPath?: string | undefined } | undefined} Optional repository-root override.
|
|
2009
2160
|
- @return {void} No return value.
|
|
2010
2161
|
|
|
2011
|
-
### fn `export function ensureRuntimePathState(cwd: string): void` (
|
|
2162
|
+
### fn `export function ensureRuntimePathState(cwd: string): void` (L266-272)
|
|
2012
2163
|
- @brief Ensures the shared runtime path state has at least fallback base and context values.
|
|
2013
2164
|
- @details Lazily bootstraps the module-local state from the supplied cwd only when no prior bootstrap has occurred, preserving any already-established static or dynamic path state. Runtime is O(1). Side effect: may initialize module-local runtime-path state.
|
|
2014
2165
|
- @param[in] cwd {string} Fallback cwd.
|
|
2015
2166
|
- @return {void} No return value.
|
|
2016
2167
|
|
|
2017
|
-
### fn `export function getRuntimeBasePath(fallbackPath: string): string` (
|
|
2168
|
+
### fn `export function getRuntimeBasePath(fallbackPath: string): string` (L280-285)
|
|
2018
2169
|
- @brief Returns the current static base path.
|
|
2019
2170
|
- @details Falls back to the supplied path only when the runtime path state has not been bootstrapped yet. Runtime is O(1). No external state is mutated.
|
|
2020
2171
|
- @param[in] fallbackPath {string} Fallback cwd.
|
|
2021
2172
|
- @return {string} Static base path.
|
|
2022
2173
|
|
|
2023
|
-
### fn `export function getRuntimeContextPath(fallbackPath: string): string` (
|
|
2174
|
+
### fn `export function getRuntimeContextPath(fallbackPath: string): string` (L293-298)
|
|
2024
2175
|
- @brief Returns the current dynamic context path.
|
|
2025
2176
|
- @details Falls back to the supplied path only when the runtime path state has not been bootstrapped yet. Runtime is O(1). No external state is mutated.
|
|
2026
2177
|
- @param[in] fallbackPath {string} Fallback cwd.
|
|
2027
2178
|
- @return {string} Dynamic context path.
|
|
2028
2179
|
|
|
2029
|
-
### fn `export function setRuntimeGitPath(gitPath?: string): void` (
|
|
2180
|
+
### fn `export function setRuntimeGitPath(gitPath?: string): void` (L306-313)
|
|
2030
2181
|
- @brief Stores the derived git-root facts in the shared runtime path state.
|
|
2031
2182
|
- @details Re-derives `parent-path` and `base-dir` from the stored static `base-path` plus the supplied `git-path`, preserving the existing dynamic context path. Runtime is O(p) in path length. Side effect: mutates module-local runtime-path state.
|
|
2032
2183
|
- @param[in] gitPath {string | undefined} Optional repository-root path.
|
|
2033
2184
|
- @return {void} No return value.
|
|
2034
2185
|
|
|
2035
|
-
### fn `export function setRuntimeContextPath(contextPath: string): void` (
|
|
2186
|
+
### fn `export function setRuntimeContextPath(contextPath: string): void` (L321-323)
|
|
2036
2187
|
- @brief Stores the current dynamic context path.
|
|
2037
2188
|
- @details Replaces the module-local `context-path` with the supplied trailing-slash-free absolute path. Runtime is O(1). Side effect: mutates module-local runtime-path state.
|
|
2038
2189
|
- @param[in] contextPath {string} Next context path.
|
|
2039
2190
|
- @return {void} No return value.
|
|
2040
2191
|
|
|
2041
|
-
### fn `export function setRuntimeWorktreePathState(options:` (
|
|
2192
|
+
### fn `export function setRuntimeWorktreePathState(options:` (L331-341)
|
|
2042
2193
|
- @brief Stores the current worktree directory and path facts.
|
|
2043
2194
|
- @details Normalizes the supplied relative `worktree-dir` and absolute `worktree-path` so later prompt rendering and tool execution can reuse the derived values across modules. Runtime is O(p) in path length. Side effect: mutates module-local runtime-path state.
|
|
2044
2195
|
- @param[in] options {{ worktreeDir?: string | undefined; worktreePath?: string | undefined }} Optional active worktree facts.
|
|
2045
2196
|
- @return {void} No return value.
|
|
2046
2197
|
|
|
2047
|
-
### fn `export function getRuntimePathState(): RuntimePathState` (
|
|
2198
|
+
### fn `export function getRuntimePathState(): RuntimePathState` (L348-359)
|
|
2048
2199
|
- @brief Returns a snapshot of the shared runtime path state.
|
|
2049
2200
|
- @details Materializes the current static and dynamic path facts into a read-only copy suitable for prompt rendering, tool execution, and tests. Runtime is O(1). No external state is mutated.
|
|
2050
2201
|
- @return {RuntimePathState} Snapshot of the current runtime path state.
|
|
2051
2202
|
|
|
2052
|
-
### fn `export function formatRuntimePathForDisplay(absolutePath: string): string` (
|
|
2203
|
+
### fn `export function formatRuntimePathForDisplay(absolutePath: string): string` (L367-380)
|
|
2053
2204
|
- @brief Formats one absolute path relative to the user home using `~` when possible.
|
|
2054
2205
|
- @details Returns `~` when the path equals the current home directory and returns `~/...` when the path descends from it; otherwise returns the normalized absolute path unchanged. Runtime is O(p) in path length. No external state is mutated.
|
|
2055
2206
|
- @param[in] absolutePath {string} Absolute or relative path candidate.
|
|
2056
2207
|
- @return {string} Home-relative or trailing-slash-free absolute path.
|
|
2057
2208
|
|
|
2058
|
-
### fn `export function buildRuntimePathContext(` (
|
|
2209
|
+
### fn `export function buildRuntimePathContext(` (L391-400)
|
|
2059
2210
|
- @brief Builds the absolute runtime path context for one base path, context path, and configuration.
|
|
2060
2211
|
- @details Derives static `install-path`, `git-path`, `parent-path`, and `base-dir`, resolves the static `config-path`, preserves the dynamic `context-path`, and resolves docs/tests/source absolute paths against `context-path` so worktree-backed execution uses the active checkout. Runtime is O(s + p) where s is configured source-directory count and p is aggregate path length. No external state is mutated.
|
|
2061
2212
|
- @param[in] basePath {string} Static base path.
|
|
@@ -2064,7 +2215,7 @@ import type { UseReqConfig } from "./config.js";
|
|
|
2064
2215
|
- @param[in] options {{ installationPath?: string; gitPath?: string | undefined; worktreeDir?: string | undefined; worktreePath?: string | undefined } | undefined} Optional installation, repository, and worktree overrides.
|
|
2065
2216
|
- @return {RuntimePathContext} Absolute runtime path context.
|
|
2066
2217
|
|
|
2067
|
-
### fn `export function buildRuntimePathFacts(` (
|
|
2218
|
+
### fn `export function buildRuntimePathFacts(` (L451-476)
|
|
2068
2219
|
- @brief Converts the absolute runtime path context into prompt/tool-facing path facts.
|
|
2069
2220
|
- @details Re-encodes every absolute path with the home-relative formatter while preserving trailing-slash-free relative directories for `base-dir` and `worktree-dir`. Runtime is O(s + p) where s is source-directory count and p is aggregate path length. No external state is mutated.
|
|
2070
2221
|
- @param[in] context {RuntimePathContext} Absolute runtime path context.
|
|
@@ -2073,28 +2224,29 @@ import type { UseReqConfig } from "./config.js";
|
|
|
2073
2224
|
## Symbol Index
|
|
2074
2225
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
2075
2226
|
|---|---|---|---|---|
|
|
2076
|
-
|`RuntimePathState`|iface||
|
|
2077
|
-
|`RuntimePathContext`|iface||
|
|
2078
|
-
|`RuntimePathFacts`|iface||
|
|
2079
|
-
|`getInstallationPath`|fn||
|
|
2080
|
-
|`normalizePathSlashes`|fn||
|
|
2081
|
-
|`trimTrailingSeparatorsPreserveRoot`|fn||
|
|
2082
|
-
|`normalizeAbsolutePathContract`|fn||
|
|
2083
|
-
|`normalizeRelativeDirContract`|fn||
|
|
2084
|
-
|`getConfigPath`|fn||
|
|
2085
|
-
|`
|
|
2086
|
-
|`
|
|
2087
|
-
|`
|
|
2088
|
-
|`
|
|
2089
|
-
|`
|
|
2090
|
-
|`
|
|
2091
|
-
|`
|
|
2092
|
-
|`
|
|
2093
|
-
|`
|
|
2094
|
-
|`
|
|
2095
|
-
|`
|
|
2096
|
-
|`
|
|
2097
|
-
|`
|
|
2227
|
+
|`RuntimePathState`|iface||35-43|export interface RuntimePathState|
|
|
2228
|
+
|`RuntimePathContext`|iface||49-62|export interface RuntimePathContext extends RuntimePathState|
|
|
2229
|
+
|`RuntimePathFacts`|iface||68-89|export interface RuntimePathFacts|
|
|
2230
|
+
|`getInstallationPath`|fn||104-106|export function getInstallationPath(): string|
|
|
2231
|
+
|`normalizePathSlashes`|fn||114-116|export function normalizePathSlashes(value: string): string|
|
|
2232
|
+
|`trimTrailingSeparatorsPreserveRoot`|fn||124-138|function trimTrailingSeparatorsPreserveRoot(value: string...|
|
|
2233
|
+
|`normalizeAbsolutePathContract`|fn||146-148|export function normalizeAbsolutePathContract(value: stri...|
|
|
2234
|
+
|`normalizeRelativeDirContract`|fn||156-161|export function normalizeRelativeDirContract(value: strin...|
|
|
2235
|
+
|`getConfigPath`|fn||169-171|export function getConfigPath(basePath: string): string|
|
|
2236
|
+
|`getGlobalConfigPath`|fn||178-180|export function getGlobalConfigPath(): string|
|
|
2237
|
+
|`isSameOrAncestorPath`|fn||189-203|export function isSameOrAncestorPath(|
|
|
2238
|
+
|`deriveStaticRuntimePathState`|fn||212-237|function deriveStaticRuntimePathState(|
|
|
2239
|
+
|`bootstrapRuntimePathState`|fn||246-248|export function bootstrapRuntimePathState(|
|
|
2240
|
+
|`ensureRuntimePathState`|fn||266-272|export function ensureRuntimePathState(cwd: string): void|
|
|
2241
|
+
|`getRuntimeBasePath`|fn||280-285|export function getRuntimeBasePath(fallbackPath: string):...|
|
|
2242
|
+
|`getRuntimeContextPath`|fn||293-298|export function getRuntimeContextPath(fallbackPath: strin...|
|
|
2243
|
+
|`setRuntimeGitPath`|fn||306-313|export function setRuntimeGitPath(gitPath?: string): void|
|
|
2244
|
+
|`setRuntimeContextPath`|fn||321-323|export function setRuntimeContextPath(contextPath: string...|
|
|
2245
|
+
|`setRuntimeWorktreePathState`|fn||331-341|export function setRuntimeWorktreePathState(options:|
|
|
2246
|
+
|`getRuntimePathState`|fn||348-359|export function getRuntimePathState(): RuntimePathState|
|
|
2247
|
+
|`formatRuntimePathForDisplay`|fn||367-380|export function formatRuntimePathForDisplay(absolutePath:...|
|
|
2248
|
+
|`buildRuntimePathContext`|fn||391-400|export function buildRuntimePathContext(|
|
|
2249
|
+
|`buildRuntimePathFacts`|fn||451-476|export function buildRuntimePathFacts(|
|
|
2098
2250
|
|
|
2099
2251
|
|
|
2100
2252
|
---
|
|
@@ -4537,7 +4689,7 @@ import path from "node:path";
|
|
|
4537
4689
|
|
|
4538
4690
|
---
|
|
4539
4691
|
|
|
4540
|
-
# index.ts | TypeScript |
|
|
4692
|
+
# index.ts | TypeScript | 4250L | 96 symbols | 27 imports | 102 comments
|
|
4541
4693
|
> Path: `src/index.ts`
|
|
4542
4694
|
- @brief Registers the pi-usereq extension commands, tools, and configuration UI.
|
|
4543
4695
|
- @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.
|
|
@@ -4575,78 +4727,84 @@ import { makeRelativeIfContainsProject, shellSplit } from "./core/utils.js";
|
|
|
4575
4727
|
|
|
4576
4728
|
## Definitions
|
|
4577
4729
|
|
|
4578
|
-
### iface `interface PiShortcutRegistrar` (
|
|
4730
|
+
### iface `interface PiShortcutRegistrar` (L178-186)
|
|
4579
4731
|
- @brief Describes the optional shortcut-registration surface used by pi-usereq.
|
|
4580
4732
|
- @details Narrows the runtime API to the documented `registerShortcut(...)`
|
|
4581
4733
|
method so the extension can remain compatible with offline harnesses that do
|
|
4582
4734
|
not implement shortcut capture. Compile-time only and introduces no runtime
|
|
4583
4735
|
cost.
|
|
4584
4736
|
|
|
4585
|
-
### fn `function getProjectBase(cwd: string): string` (
|
|
4737
|
+
### fn `function getProjectBase(cwd: string): string` (L194-203)
|
|
4586
4738
|
- @brief Resolves the effective project base from a working directory.
|
|
4587
4739
|
- @details Normalizes the provided cwd into an absolute path without consulting configuration. Time complexity is O(1). No I/O side effects occur.
|
|
4588
4740
|
- @param[in] cwd {string} Current working directory.
|
|
4589
4741
|
- @return {string} Absolute project base path.
|
|
4590
4742
|
|
|
4591
|
-
### fn `function getProcessCwdSafe(): string` (
|
|
4743
|
+
### fn `function getProcessCwdSafe(): string` (L210-219)
|
|
4592
4744
|
- @brief Resolves a safe process working directory for extension-load paths.
|
|
4593
4745
|
- @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.
|
|
4594
4746
|
- @return {string} Absolute fallback-safe process working directory.
|
|
4595
4747
|
|
|
4596
|
-
### fn `function resolveLiveBootstrapCwd(cwd: string): string` (
|
|
4748
|
+
### fn `function resolveLiveBootstrapCwd(cwd: string): string` (L227-239)
|
|
4597
4749
|
- @brief Resolves the live working directory used for bootstrap-sensitive flows.
|
|
4598
4750
|
- @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.
|
|
4599
4751
|
- @param[in] cwd {string} Candidate context cwd.
|
|
4600
4752
|
- @return {string} Existing absolute cwd used for bootstrap work.
|
|
4601
4753
|
|
|
4602
|
-
### fn `function syncContextCwdMirror(ctx: { cwd?: string }, cwd: string): void` (
|
|
4754
|
+
### fn `function syncContextCwdMirror(ctx: { cwd?: string }, cwd: string): void` (L248-257)
|
|
4603
4755
|
- @brief Best-effort synchronizes one context `cwd` mirror with bootstrap reality.
|
|
4604
4756
|
- @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.
|
|
4605
4757
|
- @param[in] cwd {string} Resolved live cwd.
|
|
4606
4758
|
- @param[in,out] ctx {{ cwd?: string }} Mutable context-like object.
|
|
4607
4759
|
- @return {void} No return value.
|
|
4608
4760
|
|
|
4609
|
-
### fn `function loadProjectConfig(cwd: string): UseReqConfig` (
|
|
4761
|
+
### fn `function loadProjectConfig(cwd: string): UseReqConfig` (L266-269)
|
|
4610
4762
|
- @brief Loads project configuration for the extension runtime.
|
|
4611
4763
|
- @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.
|
|
4612
4764
|
- @param[in] cwd {string} Current working directory.
|
|
4613
4765
|
- @return {UseReqConfig} Effective project configuration.
|
|
4614
4766
|
- @satisfies REQ-030, REQ-145, REQ-146
|
|
4615
4767
|
|
|
4616
|
-
### fn `function saveProjectConfig(cwd: string, config: UseReqConfig): void` (
|
|
4617
|
-
- @brief Persists project configuration from the extension runtime.
|
|
4618
|
-
- @details Resolves the project base, normalizes configured directory paths into project-relative form, and delegates persistence to `saveConfig` without serializing runtime-derived path metadata. Runtime is O(n) in config size. Side effects include config-file writes.
|
|
4768
|
+
### fn `function saveProjectConfig(cwd: string, config: UseReqConfig): void` (L279-282)
|
|
4769
|
+
- @brief Persists effective project configuration from the extension runtime.
|
|
4770
|
+
- @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.
|
|
4619
4771
|
- @param[in] cwd {string} Current working directory.
|
|
4620
|
-
- @param[in] config {UseReqConfig}
|
|
4772
|
+
- @param[in] config {UseReqConfig} Effective configuration to persist.
|
|
4621
4773
|
- @return {void} No return value.
|
|
4622
|
-
- @satisfies REQ-146
|
|
4774
|
+
- @satisfies REQ-146, REQ-315
|
|
4623
4775
|
|
|
4624
|
-
### fn `function
|
|
4625
|
-
- @brief Formats the current
|
|
4626
|
-
- @details Resolves `<base-path>/.pi-usereq.json` from the cwd-derived project base
|
|
4776
|
+
### fn `function formatLocalConfigPathForMenu(cwd: string): string` (L291-295)
|
|
4777
|
+
- @brief Formats the current local config path for top-level menu display.
|
|
4778
|
+
- @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.
|
|
4627
4779
|
- @param[in] cwd {string} Current working directory.
|
|
4628
|
-
- @return {string} `~`-relative or absolute config
|
|
4780
|
+
- @return {string} `~`-relative or absolute local config-path display value.
|
|
4629
4781
|
- @satisfies REQ-162
|
|
4630
4782
|
|
|
4631
|
-
### fn `function
|
|
4783
|
+
### fn `function formatGlobalConfigPathForMenu(): string` (L303-305)
|
|
4784
|
+
- @brief Formats the current global config path for top-level menu display.
|
|
4785
|
+
- @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.
|
|
4786
|
+
- @return {string} `~`-relative or absolute global config-path display value.
|
|
4787
|
+
- @satisfies REQ-319
|
|
4788
|
+
|
|
4789
|
+
### fn `function buildTerminalSettingsMenuChoices(options:` (L314-325)
|
|
4632
4790
|
- @brief Builds the standardized terminal rows appended to every configuration menu.
|
|
4633
4791
|
- @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.
|
|
4634
4792
|
- @param[in] options {{ resetDefaultsDescription: string }} Menu-specific terminal-row metadata.
|
|
4635
4793
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered terminal menu rows.
|
|
4636
4794
|
- @satisfies REQ-193
|
|
4637
4795
|
|
|
4638
|
-
### iface `interface ResetConfirmationChange` (
|
|
4796
|
+
### iface `interface ResetConfirmationChange` (L331-335)
|
|
4639
4797
|
- @brief Describes one pending reset value change shown in confirmation menus.
|
|
4640
4798
|
- @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.
|
|
4641
4799
|
|
|
4642
|
-
### fn `function formatResetConfirmationValue(previousValue: string, nextValue: string): string` (
|
|
4800
|
+
### fn `function formatResetConfirmationValue(previousValue: string, nextValue: string): string` (L344-346)
|
|
4643
4801
|
- @brief Formats one reset-confirmation value pair for menu display.
|
|
4644
4802
|
- @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.
|
|
4645
4803
|
- @param[in] previousValue {string} Current persisted value.
|
|
4646
4804
|
- @param[in] nextValue {string} Candidate default value.
|
|
4647
4805
|
- @return {string} Rendered preview string.
|
|
4648
4806
|
|
|
4649
|
-
### fn `function buildResetConfirmationChoices(` (
|
|
4807
|
+
### fn `function buildResetConfirmationChoices(` (L356-395)
|
|
4650
4808
|
- @brief Builds the shared settings-menu choices for one reset-confirmation submenu.
|
|
4651
4809
|
- @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.
|
|
4652
4810
|
- @param[in] changes {ResetConfirmationChange[]} Changed-value preview rows.
|
|
@@ -4654,7 +4812,7 @@ cost.
|
|
|
4654
4812
|
- @param[in] abortDescription {string} Description for the abort action.
|
|
4655
4813
|
- @return {PiUsereqSettingsMenuChoice[]} Reset-confirmation submenu choices.
|
|
4656
4814
|
|
|
4657
|
-
### fn `async function confirmResetChanges(` (
|
|
4815
|
+
### fn `async function confirmResetChanges(` (L407-420)
|
|
4658
4816
|
- @brief Opens one explicit reset-confirmation submenu.
|
|
4659
4817
|
- @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.
|
|
4660
4818
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
@@ -4664,60 +4822,73 @@ cost.
|
|
|
4664
4822
|
- @param[in] abortDescription {string} Description for the abort action.
|
|
4665
4823
|
- @return {Promise<boolean>} `true` when the reset is explicitly approved.
|
|
4666
4824
|
|
|
4667
|
-
### fn `function
|
|
4668
|
-
- @brief Writes
|
|
4669
|
-
- @details Reads the
|
|
4825
|
+
### fn `function writePersistedConfigToEditor(` (L429-434)
|
|
4826
|
+
- @brief Writes one already-persisted config file text into the editor.
|
|
4827
|
+
- @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.
|
|
4828
|
+
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
4829
|
+
- @param[in] configPath {string} Absolute persisted config path.
|
|
4830
|
+
- @return {void} No return value.
|
|
4831
|
+
|
|
4832
|
+
### fn `function writePersistedLocalConfigToEditor(` (L444-450)
|
|
4833
|
+
- @brief Writes the already-persisted local configuration file text into the editor.
|
|
4834
|
+
- @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.
|
|
4670
4835
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
4671
4836
|
- @param[in] cwd {string} Current working directory.
|
|
4672
|
-
- @param[in] _config {UseReqConfig} Unused effective project configuration retained for stable call-site shape.
|
|
4673
4837
|
- @return {void} No return value.
|
|
4674
4838
|
- @satisfies REQ-031
|
|
4675
4839
|
|
|
4676
|
-
### fn `function
|
|
4840
|
+
### fn `function writePersistedGlobalConfigToEditor(` (L459-463)
|
|
4841
|
+
- @brief Writes the already-persisted global configuration file text into the editor.
|
|
4842
|
+
- @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.
|
|
4843
|
+
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
4844
|
+
- @return {void} No return value.
|
|
4845
|
+
- @satisfies REQ-318
|
|
4846
|
+
|
|
4847
|
+
### fn `function buildSearchToolSupportedTagGuidelines(): string[]` (L524-528)
|
|
4677
4848
|
- @brief Builds the supported-tag guidance lines embedded in search-tool registrations.
|
|
4678
4849
|
- @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.
|
|
4679
4850
|
- @return {string[]} Supported-tag guidance lines.
|
|
4680
4851
|
|
|
4681
|
-
### fn `function buildSearchToolSchemaDescription(scope: FindToolScope): string` (
|
|
4852
|
+
### fn `function buildSearchToolSchemaDescription(scope: FindToolScope): string` (L536-541)
|
|
4682
4853
|
- @brief Builds the schema description for one search-tool registration.
|
|
4683
4854
|
- @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.
|
|
4684
4855
|
- @param[in] scope {FindToolScope} Search-tool scope.
|
|
4685
4856
|
- @return {string} Parameter-schema description.
|
|
4686
4857
|
|
|
4687
|
-
### fn `function buildSearchToolPromptGuidelines(scope: FindToolScope): string[]` (
|
|
4858
|
+
### fn `function buildSearchToolPromptGuidelines(scope: FindToolScope): string[]` (L549-562)
|
|
4688
4859
|
- @brief Builds the prompt-guideline set for one search-tool registration.
|
|
4689
4860
|
- @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.
|
|
4690
4861
|
- @param[in] scope {FindToolScope} Search-tool scope.
|
|
4691
4862
|
- @return {string[]} Prompt-guideline strings.
|
|
4692
4863
|
|
|
4693
|
-
- type `type MonolithicToolRenderResult = {` (
|
|
4864
|
+
- type `type MonolithicToolRenderResult = {` (L568)
|
|
4694
4865
|
- @brief Describes the monolithic tool-result surface consumed by tool-row renderers.
|
|
4695
4866
|
- @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.
|
|
4696
|
-
### fn `function getMonolithicToolText(result: MonolithicToolRenderResult): string` (
|
|
4867
|
+
### fn `function getMonolithicToolText(result: MonolithicToolRenderResult): string` (L585-588)
|
|
4697
4868
|
- @brief Extracts the primary monolithic text block from one tool result.
|
|
4698
4869
|
- @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.
|
|
4699
4870
|
- @param[in] result {MonolithicToolRenderResult} Tool result wrapper.
|
|
4700
4871
|
- @return {string} Primary monolithic content text.
|
|
4701
4872
|
|
|
4702
|
-
### fn `function getMonolithicToolErrorText(result: MonolithicToolRenderResult): string | undefined` (
|
|
4873
|
+
### fn `function getMonolithicToolErrorText(result: MonolithicToolRenderResult): string | undefined` (L596-606)
|
|
4703
4874
|
- @brief Reads the first residual execution error string from one monolithic tool result.
|
|
4704
4875
|
- @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.
|
|
4705
4876
|
- @param[in] result {MonolithicToolRenderResult} Tool result wrapper.
|
|
4706
4877
|
- @return {string | undefined} First residual execution error string.
|
|
4707
4878
|
|
|
4708
|
-
### fn `function formatCompactToolArgumentValue(value: unknown): string | undefined` (
|
|
4879
|
+
### fn `function formatCompactToolArgumentValue(value: unknown): string | undefined` (L614-653)
|
|
4709
4880
|
- @brief Formats one scalar or structural tool argument for compact render summaries.
|
|
4710
4881
|
- @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.
|
|
4711
4882
|
- @param[in] value {unknown} Candidate tool argument value.
|
|
4712
4883
|
- @return {string | undefined} Compact preview string or `undefined` when the value carries no useful summary.
|
|
4713
4884
|
|
|
4714
|
-
### fn `function buildCompactToolInvocationText(args: Record<string, unknown> | undefined): string` (
|
|
4885
|
+
### fn `function buildCompactToolInvocationText(args: Record<string, unknown> | undefined): string` (L661-672)
|
|
4715
4886
|
- @brief Builds the compact invocation summary appended to collapsed tool rows.
|
|
4716
4887
|
- @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.
|
|
4717
4888
|
- @param[in] args {Record<string, unknown> | undefined} Current tool call arguments.
|
|
4718
4889
|
- @return {string} Compact invocation summary prefixed with one separating space, or the empty string when no useful preview exists.
|
|
4719
4890
|
|
|
4720
|
-
### fn `function summarizeStructuredToolResult(` (
|
|
4891
|
+
### fn `function summarizeStructuredToolResult(` (L682-697)
|
|
4721
4892
|
- @brief Builds the compact default text for one monolithic tool result row.
|
|
4722
4893
|
- @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.
|
|
4723
4894
|
- @param[in] toolName {string} Registered tool name.
|
|
@@ -4725,27 +4896,27 @@ cost.
|
|
|
4725
4896
|
- @param[in] args {Record<string, unknown> | undefined} Current tool call arguments.
|
|
4726
4897
|
- @return {string} Compact single-line summary.
|
|
4727
4898
|
|
|
4728
|
-
### fn `function buildStructuredToolRenderResult(toolName: string)` (
|
|
4899
|
+
### fn `function buildStructuredToolRenderResult(toolName: string)` (L706-725)
|
|
4729
4900
|
- @brief Builds a custom `renderResult` implementation for one monolithic tool.
|
|
4730
4901
|
- @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.
|
|
4731
4902
|
- @param[in] toolName {string} Registered tool name.
|
|
4732
4903
|
- @return {(result: MonolithicToolRenderResult, options: { expanded?: boolean; isPartial?: boolean }, _theme: unknown, context: { args?: Record<string, unknown>; lastComponent?: unknown }) => Text} Custom result renderer.
|
|
4733
4904
|
- @satisfies REQ-210
|
|
4734
4905
|
|
|
4735
|
-
### fn `function executeMonolithicTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (
|
|
4906
|
+
### fn `function executeMonolithicTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (L733-739)
|
|
4736
4907
|
- @brief Executes one CLI-style runner for a monolithic agent tool.
|
|
4737
4908
|
- @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.
|
|
4738
4909
|
- @param[in] operation {() => ToolResult} Runner callback.
|
|
4739
4910
|
- @return {ReturnType<typeof buildMonolithicToolExecuteResult>} Monolithic tool execute result.
|
|
4740
4911
|
|
|
4741
|
-
### fn `function executeStatusTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (
|
|
4912
|
+
### fn `function executeStatusTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (L748-777)
|
|
4742
4913
|
- @brief Executes one CLI-style runner for a status-only agent tool.
|
|
4743
4914
|
- @details Reuses the standalone tool-runner contract, preserves `content[0].text` as the status-only `success` or `error: <diagnostic>` payload, and strips success-path `stdout_lines` so `details.execution` stays limited to the numeric code plus optional residual stderr diagnostics. Runtime is dominated by the delegated runner. Side effects depend on the selected tool.
|
|
4744
4915
|
- @param[in] operation {() => ToolResult} Runner callback.
|
|
4745
4916
|
- @return {ReturnType<typeof buildMonolithicToolExecuteResult>} Status-only tool execute result.
|
|
4746
4917
|
- @satisfies REQ-294, REQ-295, REQ-296
|
|
4747
4918
|
|
|
4748
|
-
### fn `function deliverPromptCommand(` (
|
|
4919
|
+
### fn `function deliverPromptCommand(` (L788-806)
|
|
4749
4920
|
- @brief Starts delivery of one rendered prompt into the current active session.
|
|
4750
4921
|
- @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.
|
|
4751
4922
|
- @param[in] pi {ExtensionAPI} Handler-scoped extension API instance retained as the fallback dispatcher.
|
|
@@ -4754,7 +4925,7 @@ cost.
|
|
|
4754
4925
|
- @return {Promise<void>} Promise representing eventual prompt-delivery completion.
|
|
4755
4926
|
- @satisfies REQ-004, REQ-067, REQ-068, REQ-227, REQ-281
|
|
4756
4927
|
|
|
4757
|
-
### fn `function shouldIgnoreLatePromptDeliveryFailure(` (
|
|
4928
|
+
### fn `function shouldIgnoreLatePromptDeliveryFailure(` (L817-833)
|
|
4758
4929
|
- @brief Detects prompt-delivery failures that can be ignored after prompt ownership has moved past the command handler.
|
|
4759
4930
|
- @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.
|
|
4760
4931
|
- @param[in] error {unknown} Candidate prompt-delivery failure.
|
|
@@ -4763,7 +4934,7 @@ cost.
|
|
|
4763
4934
|
- @return {boolean} `true` when the failure is a late stale-context delivery rejection that MUST be ignored.
|
|
4764
4935
|
- @satisfies REQ-208, REQ-280, REQ-281, REQ-282
|
|
4765
4936
|
|
|
4766
|
-
### fn `function logPromptWorkflowStateChange(` (
|
|
4937
|
+
### fn `function logPromptWorkflowStateChange(` (L846-865)
|
|
4767
4938
|
- @brief Appends one workflow-state debug entry for a bundled prompt when selected.
|
|
4768
4939
|
- @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.
|
|
4769
4940
|
- @param[in] projectBase {string} Absolute original project base path.
|
|
@@ -4774,7 +4945,7 @@ cost.
|
|
|
4774
4945
|
- @return {void} No return value.
|
|
4775
4946
|
- @satisfies REQ-245, REQ-246, REQ-247
|
|
4776
4947
|
|
|
4777
|
-
### fn `function logPromptWorkflowEvent(` (
|
|
4948
|
+
### fn `function logPromptWorkflowEvent(` (L881-901)
|
|
4778
4949
|
- @brief Appends one dedicated prompt workflow debug entry when selected.
|
|
4779
4950
|
- @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.
|
|
4780
4951
|
- @param[in] projectBase {string} Absolute original project base path.
|
|
@@ -4788,7 +4959,7 @@ cost.
|
|
|
4788
4959
|
- @return {void} No return value.
|
|
4789
4960
|
- @satisfies REQ-245, REQ-246, REQ-247, REQ-277
|
|
4790
4961
|
|
|
4791
|
-
### fn `function transitionPromptWorkflowState(` (
|
|
4962
|
+
### fn `function transitionPromptWorkflowState(` (L914-927)
|
|
4792
4963
|
- @brief Transitions one prompt workflow state and logs the transition immediately after the state update.
|
|
4793
4964
|
- @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.
|
|
4794
4965
|
- @param[in] ctx {ExtensionContext | ExtensionCommandContext} Active extension context.
|
|
@@ -4799,20 +4970,20 @@ cost.
|
|
|
4799
4970
|
- @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
|
|
4800
4971
|
- @return {void} No return value.
|
|
4801
4972
|
|
|
4802
|
-
### fn `function resolvePromptCommandDescription(` (
|
|
4973
|
+
### fn `function resolvePromptCommandDescription(` (L935-939)
|
|
4803
4974
|
- @brief Resolves the runtime slash-command description for one bundled prompt.
|
|
4804
4975
|
- @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.
|
|
4805
4976
|
- @param[in] promptName {import("./core/prompt-command-catalog.js").PromptCommandName} Bundled prompt name.
|
|
4806
4977
|
- @return {string} Runtime command description.
|
|
4807
4978
|
|
|
4808
|
-
### fn `function resolveDebugProjectBase(cwd: string, statusController: PiUsereqStatusController): string` (
|
|
4979
|
+
### fn `function resolveDebugProjectBase(cwd: string, statusController: PiUsereqStatusController): string` (L948-952)
|
|
4809
4980
|
- @brief Resolves the original project base used for debug-log file writes.
|
|
4810
4981
|
- @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.
|
|
4811
4982
|
- @param[in] cwd {string} Current extension working directory.
|
|
4812
4983
|
- @param[in] statusController {PiUsereqStatusController} Mutable status controller.
|
|
4813
4984
|
- @return {string} Absolute original project base path for debug logging.
|
|
4814
4985
|
|
|
4815
|
-
### fn `function notifyContextSafely(` (
|
|
4986
|
+
### fn `function notifyContextSafely(` (L963-980)
|
|
4816
4987
|
- @brief Delivers one best-effort UI notification without failing on stale replacement contexts.
|
|
4817
4988
|
- @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.
|
|
4818
4989
|
- @param[in] ctx {ExtensionContext | ExtensionCommandContext | undefined} Candidate UI context.
|
|
@@ -4821,7 +4992,7 @@ cost.
|
|
|
4821
4992
|
- @return {boolean} `true` when the notification was delivered and `false` when the context was already stale.
|
|
4822
4993
|
- @satisfies REQ-280
|
|
4823
4994
|
|
|
4824
|
-
### fn `function rejectNonIdleReqCommand(` (
|
|
4995
|
+
### fn `function rejectNonIdleReqCommand(` (L992-1012)
|
|
4825
4996
|
- @brief Rejects one non-`idle` req-command invocation and records the workflow error state.
|
|
4826
4997
|
- @details Builds a deterministic busy-state diagnostic from the current workflow state, transitions the shared workflow state to `error`, preserves any pending or active prompt execution metadata for later closure handling, emits an error notification, and throws `ReqError`. Bundled prompt commands reuse `transitionPromptWorkflowState(...)` when cached configuration is available so prompt debug logging captures the actual state transition; specialized non-prompt commands fall back to direct status mutation. Runtime is O(1). Side effects include workflow-state mutation, status-bar rendering, optional debug-log writes, and user notification delivery.
|
|
4827
4998
|
- @param[in] ctx {ExtensionContext | ExtensionCommandContext} Active extension context.
|
|
@@ -4831,20 +5002,20 @@ cost.
|
|
|
4831
5002
|
- @throws {ReqError} Always throws because non-`idle` req commands are rejected.
|
|
4832
5003
|
- @satisfies REQ-224
|
|
4833
5004
|
|
|
4834
|
-
### fn `function getPiUsereqStartupTools(pi: ExtensionAPI): ToolInfo[]` (
|
|
5005
|
+
### fn `function getPiUsereqStartupTools(pi: ExtensionAPI): ToolInfo[]` (L1021-1029)
|
|
4835
5006
|
- @brief Returns the configurable active-tool inventory visible to the extension.
|
|
4836
5007
|
- @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.
|
|
4837
5008
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
4838
5009
|
- @return {ToolInfo[]} Sorted configurable tool descriptors.
|
|
4839
5010
|
- @satisfies REQ-007, REQ-063, REQ-231, REQ-232
|
|
4840
5011
|
|
|
4841
|
-
### fn `function getConfiguredEnabledPiUsereqTools(config: UseReqConfig): string[]` (
|
|
5012
|
+
### fn `function getConfiguredEnabledPiUsereqTools(config: UseReqConfig): string[]` (L1037-1041)
|
|
4842
5013
|
- @brief Normalizes and returns the configured enabled active tools.
|
|
4843
5014
|
- @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"]`.
|
|
4844
5015
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
4845
5016
|
- @return {string[]} Normalized enabled tool names.
|
|
4846
5017
|
|
|
4847
|
-
### fn `function applyConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig): void` (
|
|
5018
|
+
### fn `function applyConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig): void` (L1051-1068)
|
|
4848
5019
|
- @brief Applies the configured active-tool enablement to the current session.
|
|
4849
5020
|
- @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(...)`.
|
|
4850
5021
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -4852,7 +5023,7 @@ cost.
|
|
|
4852
5023
|
- @return {void} No return value.
|
|
4853
5024
|
- @satisfies REQ-009, REQ-064
|
|
4854
5025
|
|
|
4855
|
-
### fn `async function handleExtensionStatusEvent(` (
|
|
5026
|
+
### fn `async function handleExtensionStatusEvent(` (L1081-1352)
|
|
4856
5027
|
- @brief Handles one intercepted pi lifecycle hook for pi-usereq status updates.
|
|
4857
5028
|
- @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.
|
|
4858
5029
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -4863,7 +5034,7 @@ cost.
|
|
|
4863
5034
|
- @return {Promise<void>} Promise resolved when hook processing completes.
|
|
4864
5035
|
- @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
|
|
4865
5036
|
|
|
4866
|
-
### fn `function registerExtensionStatusHooks(` (
|
|
5037
|
+
### fn `function registerExtensionStatusHooks(` (L1368-1387)
|
|
4867
5038
|
- @brief Registers shared wrappers for every supported pi lifecycle hook.
|
|
4868
5039
|
- @details Installs one generic wrapper per intercepted hook so every resource,
|
|
4869
5040
|
session, agent, model, tool, bash, and input event is routed through the
|
|
@@ -4877,7 +5048,7 @@ registered hook count. Side effects include hook registration.
|
|
|
4877
5048
|
- @return {void} No return value.
|
|
4878
5049
|
- @satisfies DES-002, REQ-113, REQ-114, REQ-115, REQ-116, REQ-117
|
|
4879
5050
|
|
|
4880
|
-
### fn `function setConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig, enabledTools: string[]): void` (
|
|
5051
|
+
### fn `function setConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig, enabledTools: string[]): void` (L1397-1400)
|
|
4881
5052
|
- @brief Replaces the configured active-tool selection and applies it immediately.
|
|
4882
5053
|
- @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.
|
|
4883
5054
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -4885,26 +5056,26 @@ registered hook count. Side effects include hook registration.
|
|
|
4885
5056
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
4886
5057
|
- @return {void} No return value.
|
|
4887
5058
|
|
|
4888
|
-
### fn `function getDebugToolToggleNames(): PiUsereqStartupToolName[]` (
|
|
5059
|
+
### fn `function getDebugToolToggleNames(): PiUsereqStartupToolName[]` (L1408-1410)
|
|
4889
5060
|
- @brief Returns the canonical debug-tool toggle order.
|
|
4890
5061
|
- @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.
|
|
4891
5062
|
- @return {PiUsereqStartupToolName[]} Ordered debug-tool toggle names.
|
|
4892
5063
|
- @satisfies REQ-242
|
|
4893
5064
|
|
|
4894
|
-
### fn `function resetDebugConfigToDefaults(config: UseReqConfig): void` (
|
|
5065
|
+
### fn `function resetDebugConfigToDefaults(config: UseReqConfig): void` (L1419-1427)
|
|
4895
5066
|
- @brief Restores the debug configuration subtree to its documented defaults.
|
|
4896
5067
|
- @details Resets global debug enablement, log path, workflow-state filter, dedicated workflow-event logging, and selected tool plus prompt debug toggles without mutating unrelated settings. Runtime is O(1). Side effect: mutates `config`.
|
|
4897
5068
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
4898
5069
|
- @return {void} No return value.
|
|
4899
5070
|
- @satisfies REQ-236, REQ-237, REQ-238, REQ-239, REQ-195, REQ-277
|
|
4900
5071
|
|
|
4901
|
-
### fn `function formatDebugMenuSummary(config: UseReqConfig): string` (
|
|
5072
|
+
### fn `function formatDebugMenuSummary(config: UseReqConfig): string` (L1435-1441)
|
|
4902
5073
|
- @brief Formats the top-level Debug summary value.
|
|
4903
5074
|
- @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.
|
|
4904
5075
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
4905
5076
|
- @return {string} Compact debug summary string.
|
|
4906
5077
|
|
|
4907
|
-
### fn `function buildDebugMenuChoice(` (
|
|
5078
|
+
### fn `function buildDebugMenuChoice(` (L1451-1464)
|
|
4908
5079
|
- @brief Builds one debug-menu row with optional disabled styling.
|
|
4909
5080
|
- @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.
|
|
4910
5081
|
- @param[in] choice {PiUsereqSettingsMenuChoice} Base debug-menu row.
|
|
@@ -4912,21 +5083,21 @@ registered hook count. Side effects include hook registration.
|
|
|
4912
5083
|
- @return {PiUsereqSettingsMenuChoice} Styled debug-menu row.
|
|
4913
5084
|
- @satisfies REQ-241
|
|
4914
5085
|
|
|
4915
|
-
### fn `async function selectDebugLogOnStatus(` (
|
|
5086
|
+
### fn `async function selectDebugLogOnStatus(` (L1473-1501)
|
|
4916
5087
|
- @brief Opens the workflow-state filter selector used by the Debug submenu.
|
|
4917
5088
|
- @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.
|
|
4918
5089
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
4919
5090
|
- @param[in] currentValue {DebugLogOnStatus} Current persisted workflow-state filter.
|
|
4920
5091
|
- @return {Promise<DebugLogOnStatus | undefined>} Selected workflow-state filter or `undefined` when cancelled.
|
|
4921
5092
|
|
|
4922
|
-
### fn `function buildDebugMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5093
|
+
### fn `function buildDebugMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L1510-1586)
|
|
4923
5094
|
- @brief Builds the shared settings-menu choices for debug logging configuration.
|
|
4924
5095
|
- @details Serializes global debug controls plus workflow-state, dedicated workflow-event, per-tool, and per-prompt toggles into one submenu, deriving inventories from the canonical tool and prompt lists and dimming locked rows while debug is disabled. Runtime is O(t + p). No external state is mutated.
|
|
4925
5096
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
4926
5097
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered debug-menu choices.
|
|
4927
5098
|
- @satisfies REQ-240, REQ-241, REQ-242, REQ-243, REQ-193, REQ-277
|
|
4928
5099
|
|
|
4929
|
-
### fn `async function configureDebugMenu(` (
|
|
5100
|
+
### fn `async function configureDebugMenu(` (L1596-1765)
|
|
4930
5101
|
- @brief Runs the interactive Debug submenu.
|
|
4931
5102
|
- @details Lets the user toggle global debug enablement, edit debug file and workflow filters, toggle dedicated workflow-event logging, mutate per-tool and per-prompt debug selectors, and restore subtree defaults while preserving row focus across re-renders. Runtime depends on user interaction count. Side effects include UI updates and config mutation.
|
|
4932
5103
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
@@ -4934,45 +5105,45 @@ registered hook count. Side effects include hook registration.
|
|
|
4934
5105
|
- @return {Promise<void>} Promise resolved when the submenu closes.
|
|
4935
5106
|
- @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
|
|
4936
5107
|
|
|
4937
|
-
- type `type PiNotifyBooleanConfigKey =` (
|
|
5108
|
+
- type `type PiNotifyBooleanConfigKey =` (L1771)
|
|
4938
5109
|
- @brief Represents one persisted boolean notification-setting key.
|
|
4939
5110
|
- @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.
|
|
4940
|
-
- type `type PiNotifyEventBooleanConfigKey = Exclude<` (
|
|
5111
|
+
- type `type PiNotifyEventBooleanConfigKey = Exclude<` (L1788)
|
|
4941
5112
|
- @brief Represents one persisted boolean notification event-toggle key.
|
|
4942
5113
|
- @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.
|
|
4943
|
-
- type `type PiNotifyEventId = "completed" | "interrupted" | "failed";` (
|
|
5114
|
+
- type `type PiNotifyEventId = "completed" | "interrupted" | "failed";` (L1797)
|
|
4944
5115
|
- @brief Represents one shared prompt-end event identifier used by notification menus.
|
|
4945
5116
|
- @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.
|
|
4946
|
-
### iface `interface PiNotifyEventRowDefinition` (
|
|
5117
|
+
### iface `interface PiNotifyEventRowDefinition` (L1803-1807)
|
|
4947
5118
|
- @brief Describes one shared prompt-end event row rendered inside notification event submenus.
|
|
4948
5119
|
- @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.
|
|
4949
5120
|
|
|
4950
|
-
### iface `interface PiNotifyEventMenuDefinition` (
|
|
5121
|
+
### iface `interface PiNotifyEventMenuDefinition` (L1813-1819)
|
|
4951
5122
|
- @brief Describes one notification-system event submenu contract.
|
|
4952
5123
|
- @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.
|
|
4953
5124
|
|
|
4954
|
-
### fn `function togglePiNotifyFlag(config: UseReqConfig, key: PiNotifyBooleanConfigKey): boolean` (
|
|
5125
|
+
### fn `function togglePiNotifyFlag(config: UseReqConfig, key: PiNotifyBooleanConfigKey): boolean` (L1828-1831)
|
|
4955
5126
|
- @brief Flips one persisted boolean notification setting.
|
|
4956
5127
|
- @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`.
|
|
4957
5128
|
- @param[in] key {PiNotifyBooleanConfigKey} Boolean configuration key to toggle.
|
|
4958
5129
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
4959
5130
|
- @return {boolean} Next enabled state.
|
|
4960
5131
|
|
|
4961
|
-
### fn `function resetPiNotifyConfigToDefaults(config: UseReqConfig): void` (
|
|
5132
|
+
### fn `function resetPiNotifyConfigToDefaults(config: UseReqConfig): void` (L1840-1864)
|
|
4962
5133
|
- @brief Restores notification-related settings to their documented defaults.
|
|
4963
5134
|
- @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`.
|
|
4964
5135
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
4965
5136
|
- @return {void} No return value.
|
|
4966
5137
|
- @satisfies REQ-174, REQ-178, REQ-184, REQ-195, REQ-196
|
|
4967
5138
|
|
|
4968
|
-
### fn `function formatPiNotifyPushoverPriority(priority: PiNotifyPushoverPriority): string` (
|
|
5139
|
+
### fn `function formatPiNotifyPushoverPriority(priority: PiNotifyPushoverPriority): string` (L1873-1875)
|
|
4969
5140
|
- @brief Formats one persisted Pushover priority for menu display.
|
|
4970
5141
|
- @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.
|
|
4971
5142
|
- @param[in] priority {PiNotifyPushoverPriority} Persisted Pushover priority.
|
|
4972
5143
|
- @return {string} Menu-display label.
|
|
4973
5144
|
- @satisfies REQ-172
|
|
4974
5145
|
|
|
4975
|
-
### fn `function formatPiNotifyEventMenuSummary(` (
|
|
5146
|
+
### fn `function formatPiNotifyEventMenuSummary(` (L1959-1967)
|
|
4976
5147
|
- @brief Formats the top-level summary value for one notification event submenu.
|
|
4977
5148
|
- @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.
|
|
4978
5149
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
@@ -4980,7 +5151,7 @@ registered hook count. Side effects include hook registration.
|
|
|
4980
5151
|
- @return {string} Compact enabled-toggle summary.
|
|
4981
5152
|
- @satisfies REQ-198
|
|
4982
5153
|
|
|
4983
|
-
### fn `function buildPiNotifyEventLauncherChoice(` (
|
|
5154
|
+
### fn `function buildPiNotifyEventLauncherChoice(` (L1977-1987)
|
|
4984
5155
|
- @brief Builds the top-level launcher row for one notification event submenu.
|
|
4985
5156
|
- @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.
|
|
4986
5157
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
@@ -4988,7 +5159,7 @@ registered hook count. Side effects include hook registration.
|
|
|
4988
5159
|
- @return {PiUsereqSettingsMenuChoice} Launcher row for the selected event submenu.
|
|
4989
5160
|
- @satisfies REQ-181, REQ-183, REQ-165, REQ-198
|
|
4990
5161
|
|
|
4991
|
-
### fn `function buildPiNotifyEventMenuChoices(` (
|
|
5162
|
+
### fn `function buildPiNotifyEventMenuChoices(` (L1997-2013)
|
|
4992
5163
|
- @brief Builds the shared settings-menu choices for one notification event submenu.
|
|
4993
5164
|
- @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.
|
|
4994
5165
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
@@ -4996,7 +5167,7 @@ registered hook count. Side effects include hook registration.
|
|
|
4996
5167
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered event-submenu choice vector.
|
|
4997
5168
|
- @satisfies REQ-188, REQ-193, REQ-198
|
|
4998
5169
|
|
|
4999
|
-
### fn `function resetPiNotifyEventMenuToDefaults(` (
|
|
5170
|
+
### fn `function resetPiNotifyEventMenuToDefaults(` (L2023-2031)
|
|
5000
5171
|
- @brief Restores one notification event submenu to its documented defaults.
|
|
5001
5172
|
- @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`.
|
|
5002
5173
|
- @param[in] eventMenu {PiNotifyEventMenuDefinition} Notification-system event submenu contract.
|
|
@@ -5004,7 +5175,7 @@ registered hook count. Side effects include hook registration.
|
|
|
5004
5175
|
- @return {void} No return value.
|
|
5005
5176
|
- @satisfies REQ-174, REQ-178, REQ-184, REQ-195
|
|
5006
5177
|
|
|
5007
|
-
### fn `function resolvePiNotifyEventLabel(` (
|
|
5178
|
+
### fn `function resolvePiNotifyEventLabel(` (L2041-2048)
|
|
5008
5179
|
- @brief Resolves the human-readable event label for one event-toggle config key.
|
|
5009
5180
|
- @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.
|
|
5010
5181
|
- @param[in] key {PiNotifyEventBooleanConfigKey} Event-toggle configuration key.
|
|
@@ -5012,7 +5183,7 @@ registered hook count. Side effects include hook registration.
|
|
|
5012
5183
|
- @return {string} Human-readable event label.
|
|
5013
5184
|
- @satisfies REQ-188, REQ-198
|
|
5014
5185
|
|
|
5015
|
-
### fn `async function configurePiNotifyEventMenu(` (
|
|
5186
|
+
### fn `async function configurePiNotifyEventMenu(` (L2059-2135)
|
|
5016
5187
|
- @brief Runs one dedicated notification event submenu.
|
|
5017
5188
|
- @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.
|
|
5018
5189
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
@@ -5021,14 +5192,14 @@ registered hook count. Side effects include hook registration.
|
|
|
5021
5192
|
- @return {Promise<void>} Promise resolved when the submenu closes.
|
|
5022
5193
|
- @satisfies REQ-188, REQ-192, REQ-193, REQ-195, REQ-198
|
|
5023
5194
|
|
|
5024
|
-
### fn `function buildPiNotifyPushoverRows(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5195
|
+
### fn `function buildPiNotifyPushoverRows(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2144-2194)
|
|
5025
5196
|
- @brief Builds the direct Pushover rows rendered inside `Notifications`.
|
|
5026
5197
|
- @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.
|
|
5027
5198
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5028
5199
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered direct Pushover rows.
|
|
5029
5200
|
- @satisfies REQ-163, REQ-165, REQ-172, REQ-184, REQ-185, REQ-198, REQ-234, REQ-235
|
|
5030
5201
|
|
|
5031
|
-
### fn `async function selectPiNotifyPushoverPriority(` (
|
|
5202
|
+
### fn `async function selectPiNotifyPushoverPriority(` (L2204-2232)
|
|
5032
5203
|
- @brief Opens the shared settings-menu selector for Pushover priority.
|
|
5033
5204
|
- @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.
|
|
5034
5205
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
@@ -5036,14 +5207,14 @@ registered hook count. Side effects include hook registration.
|
|
|
5036
5207
|
- @return {Promise<PiNotifyPushoverPriority | "reset-defaults" | undefined>} Selected priority, reset action, or `undefined` when cancelled.
|
|
5037
5208
|
- @satisfies REQ-172, REQ-192
|
|
5038
5209
|
|
|
5039
|
-
### fn `function buildPiNotifyMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5210
|
+
### fn `function buildPiNotifyMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2241-2299)
|
|
5040
5211
|
- @brief Builds the shared settings-menu choices for notification configuration.
|
|
5041
5212
|
- @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.
|
|
5042
5213
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5043
5214
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered notification-menu choice vector.
|
|
5044
5215
|
- @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
|
|
5045
5216
|
|
|
5046
|
-
### fn `async function selectPiNotifySoundLevel(` (
|
|
5217
|
+
### fn `async function selectPiNotifySoundLevel(` (L2309-2349)
|
|
5047
5218
|
- @brief Opens the shared settings-menu selector for the persisted boot sound level.
|
|
5048
5219
|
- @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.
|
|
5049
5220
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
@@ -5051,20 +5222,20 @@ registered hook count. Side effects include hook registration.
|
|
|
5051
5222
|
- @return {Promise<PiNotifySoundLevel | "reset-defaults" | undefined>} Selected boot sound level, reset action, or `undefined` when cancelled.
|
|
5052
5223
|
- @satisfies REQ-131, REQ-179, REQ-192, REQ-289
|
|
5053
5224
|
|
|
5054
|
-
### fn `async function configurePiNotifyMenu(` (
|
|
5225
|
+
### fn `async function configurePiNotifyMenu(` (L2359-2645)
|
|
5055
5226
|
- @brief Runs the interactive notification-configuration menu.
|
|
5056
|
-
- @details Exposes command-notify, sound, and Pushover controls through the shared settings-menu renderer, delegates completed/interrupted/failed toggles to dedicated event submenus,
|
|
5227
|
+
- @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.
|
|
5057
5228
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
5058
5229
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
5059
5230
|
- @return {Promise<boolean>} `true` when the sound-toggle shortcut changed.
|
|
5060
5231
|
- @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
|
|
5061
5232
|
|
|
5062
|
-
### fn `function registerPiNotifyShortcut(` (
|
|
5233
|
+
### fn `function registerPiNotifyShortcut(` (L2660-2683)
|
|
5063
5234
|
- @brief Registers the configurable notification-sound shortcut when supported.
|
|
5064
|
-
- @details Loads the current
|
|
5235
|
+
- @details Loads the current effective config, registers one raw pi shortcut when
|
|
5065
5236
|
the runtime exposes `registerShortcut(...)`, cycles only the active runtime
|
|
5066
|
-
sound level on invocation, leaves
|
|
5067
|
-
status bar, and emits one info notification. Runtime is O(1) for registration
|
|
5237
|
+
sound level on invocation, leaves persisted local and global configuration
|
|
5238
|
+
unchanged, refreshes the status bar, and emits one info notification. Runtime is O(1) for registration
|
|
5068
5239
|
plus one status update per shortcut use. Side effects include shortcut
|
|
5069
5240
|
registration and status updates.
|
|
5070
5241
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5072,15 +5243,15 @@ registration and status updates.
|
|
|
5072
5243
|
- @return {void} No return value.
|
|
5073
5244
|
- @satisfies REQ-134, REQ-180, REQ-286, REQ-287
|
|
5074
5245
|
|
|
5075
|
-
### fn `function resolveReqResetPromptRequest(` (
|
|
5246
|
+
### fn `function resolveReqResetPromptRequest(` (L2691-2717)
|
|
5076
5247
|
- @brief Resolves the prompt execution plan targeted by `req-reset` recovery.
|
|
5077
5248
|
- @details Prefers the current in-memory active request, then the current in-memory pending request, then the process-scoped persisted prompt runtime state so the dedicated reset command can recover from same-host unclean prompt termination after session replacement. Runtime is O(1). No external state is mutated.
|
|
5078
5249
|
- @param[in] statusController {PiUsereqStatusController} Mutable status controller.
|
|
5079
5250
|
- @return {PromptCommandExecutionPlan | undefined} Recoverable prompt execution plan when one remains available.
|
|
5080
5251
|
|
|
5081
|
-
### fn `const isWorktreeBacked = (request: PromptCommandExecutionPlan | undefined): request is PromptCommandExecutionPlan =>` (
|
|
5252
|
+
### fn `const isWorktreeBacked = (request: PromptCommandExecutionPlan | undefined): request is PromptCommandExecutionPlan =>` (L2694-2701)
|
|
5082
5253
|
|
|
5083
|
-
### fn `function registerReqResetCommand(` (
|
|
5254
|
+
### fn `function registerReqResetCommand(` (L2727-2781)
|
|
5084
5255
|
- @brief Registers the specialized `req-reset` slash command.
|
|
5085
5256
|
- @details Registers the non-agentic prompt-recovery command that accepts any current workflow state, reuses persisted prompt runtime state when available, restores the original session-backed `base-path`, force-removes matching generated worktrees plus branches, clears recoverable prompt state when restoration succeeds, and notifies pi without starting an LLM session or creating a worktree. Runtime is dominated by session restoration plus git cleanup. Side effects include command registration, status-controller mutation, active-session replacement, worktree deletion, branch deletion, and user notifications.
|
|
5086
5257
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5088,7 +5259,7 @@ registration and status updates.
|
|
|
5088
5259
|
- @return {void} No return value.
|
|
5089
5260
|
- @satisfies REQ-304, REQ-305, REQ-306, REQ-307, REQ-308, REQ-309, REQ-310, REQ-311, REQ-312, REQ-313
|
|
5090
5261
|
|
|
5091
|
-
### fn `function registerReqReferencesCommand(` (
|
|
5262
|
+
### fn `function registerReqReferencesCommand(` (L2791-2831)
|
|
5092
5263
|
- @brief Registers the specialized `req-references` slash command.
|
|
5093
5264
|
- @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.
|
|
5094
5265
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5096,7 +5267,7 @@ registration and status updates.
|
|
|
5096
5267
|
- @return {void} No return value.
|
|
5097
5268
|
- @satisfies REQ-200, REQ-221, REQ-224, REQ-298, REQ-299, REQ-300, REQ-301, REQ-302, REQ-303
|
|
5098
5269
|
|
|
5099
|
-
### fn `function registerPromptCommands(` (
|
|
5270
|
+
### fn `function registerPromptCommands(` (L2841-2957)
|
|
5100
5271
|
- @brief Registers bundled prompt-backed commands with the extension.
|
|
5101
5272
|
- @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.
|
|
5102
5273
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5104,14 +5275,14 @@ registration and status updates.
|
|
|
5104
5275
|
- @return {void} No return value.
|
|
5105
5276
|
- @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
|
|
5106
5277
|
|
|
5107
|
-
### fn `function registerAgentTools(pi: ExtensionAPI): void` (
|
|
5278
|
+
### fn `function registerAgentTools(pi: ExtensionAPI): void` (L2967-3266)
|
|
5108
5279
|
- @brief Registers pi-usereq agent tools exposed to the model.
|
|
5109
5280
|
- @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.
|
|
5110
5281
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
5111
5282
|
- @return {void} No return value.
|
|
5112
5283
|
- @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
|
|
5113
5284
|
|
|
5114
|
-
### fn `function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5285
|
+
### fn `function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3311-3336)
|
|
5115
5286
|
- @brief Builds the shared settings-menu choices for startup-tool management.
|
|
5116
5287
|
- @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.
|
|
5117
5288
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5119,7 +5290,7 @@ registration and status updates.
|
|
|
5119
5290
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered startup-tool menu choices.
|
|
5120
5291
|
- @satisfies REQ-007, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193
|
|
5121
5292
|
|
|
5122
|
-
### fn `function buildPiUsereqToolToggleChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5293
|
+
### fn `function buildPiUsereqToolToggleChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3346-3360)
|
|
5123
5294
|
- @brief Builds the shared settings-menu choices for per-tool startup toggles.
|
|
5124
5295
|
- @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.
|
|
5125
5296
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5127,108 +5298,108 @@ registration and status updates.
|
|
|
5127
5298
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered per-tool toggle choices.
|
|
5128
5299
|
- @satisfies REQ-007, REQ-151, REQ-152, REQ-153, REQ-154, REQ-231, REQ-232
|
|
5129
5300
|
|
|
5130
|
-
### fn `async function configurePiUsereqToolsMenu(` (
|
|
5301
|
+
### fn `async function configurePiUsereqToolsMenu(` (L3371-3488)
|
|
5131
5302
|
- @brief Runs the interactive active-tool configuration menu.
|
|
5132
|
-
- @details Synchronizes runtime active tools with
|
|
5303
|
+
- @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.
|
|
5133
5304
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
5134
5305
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
5135
5306
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
5136
5307
|
- @return {Promise<void>} Promise resolved when the menu closes.
|
|
5137
5308
|
- @satisfies REQ-007, REQ-063, REQ-064, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193, REQ-231, REQ-232
|
|
5138
5309
|
|
|
5139
|
-
### fn `function getStaticCheckLanguageConfigForMenu(` (
|
|
5310
|
+
### fn `function getStaticCheckLanguageConfigForMenu(` (L3497-3502)
|
|
5140
5311
|
- @brief Resolves one static-check language config for menu rendering.
|
|
5141
5312
|
- @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.
|
|
5142
5313
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5143
5314
|
- @param[in] language {string} Canonical language name.
|
|
5144
5315
|
- @return {StaticCheckLanguageConfig} Resolved per-language config object.
|
|
5145
5316
|
|
|
5146
|
-
### fn `function countConfiguredStaticCheckLanguages(config: UseReqConfig): number` (
|
|
5317
|
+
### fn `function countConfiguredStaticCheckLanguages(config: UseReqConfig): number` (L3510-3512)
|
|
5147
5318
|
- @brief Counts languages that currently expose at least one configured checker.
|
|
5148
5319
|
- @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.
|
|
5149
5320
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5150
5321
|
- @return {number} Number of languages with at least one configured checker.
|
|
5151
5322
|
|
|
5152
|
-
### fn `function countEnabledStaticCheckLanguages(config: UseReqConfig): number` (
|
|
5323
|
+
### fn `function countEnabledStaticCheckLanguages(config: UseReqConfig): number` (L3520-3522)
|
|
5153
5324
|
- @brief Counts languages whose static-check enable flag is on.
|
|
5154
5325
|
- @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.
|
|
5155
5326
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5156
5327
|
- @return {number} Number of enabled languages.
|
|
5157
5328
|
|
|
5158
|
-
### fn `function resetStaticCheckConfig(config: UseReqConfig): void` (
|
|
5329
|
+
### fn `function resetStaticCheckConfig(config: UseReqConfig): void` (L3531-3533)
|
|
5159
5330
|
- @brief Restores the documented static-check default configuration.
|
|
5160
5331
|
- @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`.
|
|
5161
5332
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
5162
5333
|
- @return {void} No return value.
|
|
5163
5334
|
- @satisfies REQ-250, REQ-251, REQ-252
|
|
5164
5335
|
|
|
5165
|
-
### fn `function formatStaticCheckLanguagesSummary(config: UseReqConfig): string` (
|
|
5336
|
+
### fn `function formatStaticCheckLanguagesSummary(config: UseReqConfig): string` (L3541-3543)
|
|
5166
5337
|
- @brief Summarizes enabled and configured static-check languages.
|
|
5167
5338
|
- @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.
|
|
5168
5339
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5169
5340
|
- @return {string} Compact summary string.
|
|
5170
5341
|
|
|
5171
|
-
### fn `function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5342
|
+
### fn `function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3552-3584)
|
|
5172
5343
|
- @brief Builds the shared settings-menu choices for static-check management.
|
|
5173
5344
|
- @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.
|
|
5174
5345
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5175
5346
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered static-check menu choices.
|
|
5176
5347
|
- @satisfies REQ-008, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-248
|
|
5177
5348
|
|
|
5178
|
-
### fn `function buildSupportedStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5349
|
+
### fn `function buildSupportedStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3592-3609)
|
|
5179
5350
|
- @brief Builds the shared settings-menu choices for supported static-check languages.
|
|
5180
5351
|
- @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.
|
|
5181
5352
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5182
5353
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered language-choice vector.
|
|
5183
5354
|
|
|
5184
|
-
### fn `function buildConfiguredStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5355
|
+
### fn `function buildConfiguredStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3617-3634)
|
|
5185
5356
|
- @brief Builds the shared settings-menu choices for configured static-check languages.
|
|
5186
5357
|
- @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.
|
|
5187
5358
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5188
5359
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered configured-language vector.
|
|
5189
5360
|
|
|
5190
|
-
### fn `async function configureStaticCheckMenu(` (
|
|
5361
|
+
### fn `async function configureStaticCheckMenu(` (L3644-3790)
|
|
5191
5362
|
- @brief Runs the interactive static-check configuration menu.
|
|
5192
|
-
- @details Lets the user add
|
|
5363
|
+
- @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.
|
|
5193
5364
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
5194
5365
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
5195
5366
|
- @return {Promise<void>} Promise resolved when the menu closes.
|
|
5196
5367
|
- @satisfies REQ-008, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-195, REQ-248, REQ-253
|
|
5197
5368
|
|
|
5198
|
-
### fn `function buildPiUsereqMenuChoices(` (
|
|
5369
|
+
### fn `function buildPiUsereqMenuChoices(` (L3800-3899)
|
|
5199
5370
|
- @brief Builds the shared settings-menu choices for the top-level pi-usereq configuration UI.
|
|
5200
|
-
- @details Serializes primary configuration actions into right-valued menu rows consumed by the shared settings-menu renderer, including automatic git-commit mode, effective prompt-command worktree state, notification summary, debug summary, locked worktree rows when automatic git commit is disabled, and
|
|
5371
|
+
- @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.
|
|
5201
5372
|
- @param[in] cwd {string} Current working directory.
|
|
5202
5373
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5203
5374
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered top-level menu choices.
|
|
5204
|
-
- @satisfies REQ-006, REQ-031, REQ-137, REQ-150, REQ-151, REQ-152, REQ-162, REQ-190, REQ-191, REQ-197, REQ-204, REQ-205, REQ-212, REQ-215, REQ-216, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240
|
|
5375
|
+
- @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
|
|
5205
5376
|
|
|
5206
|
-
### fn `function buildSrcDirMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5377
|
+
### fn `function buildSrcDirMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3908-3926)
|
|
5207
5378
|
- @brief Builds the shared settings-menu choices for source-directory management.
|
|
5208
5379
|
- @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.
|
|
5209
5380
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5210
5381
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered source-directory management choices.
|
|
5211
5382
|
- @satisfies REQ-006, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193
|
|
5212
5383
|
|
|
5213
|
-
### fn `function buildSrcDirRemovalChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5384
|
+
### fn `function buildSrcDirRemovalChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3935-3947)
|
|
5214
5385
|
- @brief Builds the shared settings-menu choices for removing one source-directory entry.
|
|
5215
5386
|
- @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.
|
|
5216
5387
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5217
5388
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered removable source-directory choices.
|
|
5218
5389
|
- @satisfies REQ-006, REQ-151, REQ-152, REQ-153, REQ-154
|
|
5219
5390
|
|
|
5220
|
-
### fn `async function configurePiUsereq(` (
|
|
5391
|
+
### fn `async function configurePiUsereq(` (L3958-4211)
|
|
5221
5392
|
- @brief Runs the top-level pi-usereq configuration menu.
|
|
5222
|
-
- @details Loads
|
|
5393
|
+
- @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.
|
|
5223
5394
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
5224
5395
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
5225
5396
|
- @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
|
|
5226
5397
|
- @return {Promise<void>} Promise resolved when configuration is saved and the menu closes.
|
|
5227
|
-
- @satisfies REQ-006, REQ-031, REQ-137, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-162, REQ-190, REQ-191, REQ-192, REQ-194, REQ-195, REQ-204, REQ-205, REQ-212, REQ-215, REQ-216, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243
|
|
5398
|
+
- @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
|
|
5228
5399
|
|
|
5229
|
-
### fn `const persistConfigChange = () =>` (
|
|
5400
|
+
### fn `const persistConfigChange = () =>` (L3969-3974)
|
|
5230
5401
|
|
|
5231
|
-
### fn `function registerConfigCommands(` (
|
|
5402
|
+
### fn `function registerConfigCommands(` (L4221-4231)
|
|
5232
5403
|
- @brief Registers configuration-management commands.
|
|
5233
5404
|
- @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.
|
|
5234
5405
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5236,7 +5407,7 @@ registration and status updates.
|
|
|
5236
5407
|
- @return {void} No return value.
|
|
5237
5408
|
- @satisfies REQ-006, REQ-031
|
|
5238
5409
|
|
|
5239
|
-
### fn `export default function piUsereqExtension(pi: ExtensionAPI): void` (
|
|
5410
|
+
### fn `export default function piUsereqExtension(pi: ExtensionAPI): void` (L4240-4250)
|
|
5240
5411
|
- @brief Registers the complete pi-usereq extension.
|
|
5241
5412
|
- @details Validates installation-owned bundled resources, registers the specialized `req-reset` and `req-references` commands plus bundled prompt-backed commands and agent tools, registers configuration commands, registers the configurable notification-sound shortcut when the runtime supports shortcuts, and installs shared wrappers for all supported pi lifecycle hooks so status telemetry, context usage, prompt timing, cumulative runtime, prompt-specific Pushover metadata, tool-result debug logging, and prompt-orchestration effects remain synchronized with runtime events. Runtime is O(h) in hook count during registration. Side effects include filesystem reads, command/tool/shortcut registration, UI updates, active-tool changes, optional debug-log writes, and timer scheduling.
|
|
5242
5413
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5246,97 +5417,100 @@ registration and status updates.
|
|
|
5246
5417
|
## Symbol Index
|
|
5247
5418
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
5248
5419
|
|---|---|---|---|---|
|
|
5249
|
-
|`PiShortcutRegistrar`|iface||
|
|
5250
|
-
|`getProjectBase`|fn||
|
|
5251
|
-
|`getProcessCwdSafe`|fn||
|
|
5252
|
-
|`resolveLiveBootstrapCwd`|fn||
|
|
5253
|
-
|`syncContextCwdMirror`|fn||
|
|
5254
|
-
|`loadProjectConfig`|fn||
|
|
5255
|
-
|`saveProjectConfig`|fn||
|
|
5256
|
-
|`
|
|
5257
|
-
|`
|
|
5258
|
-
|`
|
|
5259
|
-
|`
|
|
5260
|
-
|`
|
|
5261
|
-
|`
|
|
5262
|
-
|`
|
|
5263
|
-
|`
|
|
5264
|
-
|`
|
|
5265
|
-
|`
|
|
5266
|
-
|`
|
|
5267
|
-
|`
|
|
5268
|
-
|`
|
|
5269
|
-
|`
|
|
5270
|
-
|`
|
|
5271
|
-
|`
|
|
5272
|
-
|`
|
|
5273
|
-
|`
|
|
5274
|
-
|`
|
|
5275
|
-
|`
|
|
5276
|
-
|`
|
|
5277
|
-
|`
|
|
5278
|
-
|`
|
|
5279
|
-
|`
|
|
5280
|
-
|`
|
|
5281
|
-
|`
|
|
5282
|
-
|`
|
|
5283
|
-
|`
|
|
5284
|
-
|`
|
|
5285
|
-
|`
|
|
5286
|
-
|`
|
|
5287
|
-
|`
|
|
5288
|
-
|`
|
|
5289
|
-
|`
|
|
5290
|
-
|`
|
|
5291
|
-
|`
|
|
5292
|
-
|`
|
|
5293
|
-
|`
|
|
5294
|
-
|`
|
|
5295
|
-
|`
|
|
5296
|
-
|`
|
|
5297
|
-
|`
|
|
5298
|
-
|`
|
|
5299
|
-
|`
|
|
5300
|
-
|`
|
|
5301
|
-
|`
|
|
5302
|
-
|`
|
|
5303
|
-
|`
|
|
5304
|
-
|`
|
|
5305
|
-
|`
|
|
5306
|
-
|`
|
|
5307
|
-
|`
|
|
5308
|
-
|`
|
|
5309
|
-
|`
|
|
5310
|
-
|`
|
|
5311
|
-
|`
|
|
5312
|
-
|`
|
|
5313
|
-
|`
|
|
5314
|
-
|`
|
|
5315
|
-
|`
|
|
5316
|
-
|`
|
|
5317
|
-
|`
|
|
5318
|
-
|`
|
|
5319
|
-
|`
|
|
5320
|
-
|`
|
|
5321
|
-
|`
|
|
5322
|
-
|`
|
|
5323
|
-
|`
|
|
5324
|
-
|`
|
|
5325
|
-
|`
|
|
5326
|
-
|`
|
|
5327
|
-
|`
|
|
5328
|
-
|`
|
|
5329
|
-
|`
|
|
5330
|
-
|`
|
|
5331
|
-
|`
|
|
5332
|
-
|`
|
|
5333
|
-
|`
|
|
5334
|
-
|`
|
|
5335
|
-
|`
|
|
5336
|
-
|`
|
|
5337
|
-
|`
|
|
5338
|
-
|`
|
|
5339
|
-
|`
|
|
5340
|
-
|`
|
|
5341
|
-
|`
|
|
5420
|
+
|`PiShortcutRegistrar`|iface||178-186|interface PiShortcutRegistrar|
|
|
5421
|
+
|`getProjectBase`|fn||194-203|function getProjectBase(cwd: string): string|
|
|
5422
|
+
|`getProcessCwdSafe`|fn||210-219|function getProcessCwdSafe(): string|
|
|
5423
|
+
|`resolveLiveBootstrapCwd`|fn||227-239|function resolveLiveBootstrapCwd(cwd: string): string|
|
|
5424
|
+
|`syncContextCwdMirror`|fn||248-257|function syncContextCwdMirror(ctx: { cwd?: string }, cwd:...|
|
|
5425
|
+
|`loadProjectConfig`|fn||266-269|function loadProjectConfig(cwd: string): UseReqConfig|
|
|
5426
|
+
|`saveProjectConfig`|fn||279-282|function saveProjectConfig(cwd: string, config: UseReqCon...|
|
|
5427
|
+
|`formatLocalConfigPathForMenu`|fn||291-295|function formatLocalConfigPathForMenu(cwd: string): string|
|
|
5428
|
+
|`formatGlobalConfigPathForMenu`|fn||303-305|function formatGlobalConfigPathForMenu(): string|
|
|
5429
|
+
|`buildTerminalSettingsMenuChoices`|fn||314-325|function buildTerminalSettingsMenuChoices(options:|
|
|
5430
|
+
|`ResetConfirmationChange`|iface||331-335|interface ResetConfirmationChange|
|
|
5431
|
+
|`formatResetConfirmationValue`|fn||344-346|function formatResetConfirmationValue(previousValue: stri...|
|
|
5432
|
+
|`buildResetConfirmationChoices`|fn||356-395|function buildResetConfirmationChoices(|
|
|
5433
|
+
|`confirmResetChanges`|fn||407-420|async function confirmResetChanges(|
|
|
5434
|
+
|`writePersistedConfigToEditor`|fn||429-434|function writePersistedConfigToEditor(|
|
|
5435
|
+
|`writePersistedLocalConfigToEditor`|fn||444-450|function writePersistedLocalConfigToEditor(|
|
|
5436
|
+
|`writePersistedGlobalConfigToEditor`|fn||459-463|function writePersistedGlobalConfigToEditor(|
|
|
5437
|
+
|`buildSearchToolSupportedTagGuidelines`|fn||524-528|function buildSearchToolSupportedTagGuidelines(): string[]|
|
|
5438
|
+
|`buildSearchToolSchemaDescription`|fn||536-541|function buildSearchToolSchemaDescription(scope: FindTool...|
|
|
5439
|
+
|`buildSearchToolPromptGuidelines`|fn||549-562|function buildSearchToolPromptGuidelines(scope: FindToolS...|
|
|
5440
|
+
|`MonolithicToolRenderResult`|type||568||
|
|
5441
|
+
|`getMonolithicToolText`|fn||585-588|function getMonolithicToolText(result: MonolithicToolRend...|
|
|
5442
|
+
|`getMonolithicToolErrorText`|fn||596-606|function getMonolithicToolErrorText(result: MonolithicToo...|
|
|
5443
|
+
|`formatCompactToolArgumentValue`|fn||614-653|function formatCompactToolArgumentValue(value: unknown): ...|
|
|
5444
|
+
|`buildCompactToolInvocationText`|fn||661-672|function buildCompactToolInvocationText(args: Record<stri...|
|
|
5445
|
+
|`summarizeStructuredToolResult`|fn||682-697|function summarizeStructuredToolResult(|
|
|
5446
|
+
|`buildStructuredToolRenderResult`|fn||706-725|function buildStructuredToolRenderResult(toolName: string)|
|
|
5447
|
+
|`executeMonolithicTool`|fn||733-739|function executeMonolithicTool(operation: () => ToolResul...|
|
|
5448
|
+
|`executeStatusTool`|fn||748-777|function executeStatusTool(operation: () => ToolResult): ...|
|
|
5449
|
+
|`deliverPromptCommand`|fn||788-806|function deliverPromptCommand(|
|
|
5450
|
+
|`shouldIgnoreLatePromptDeliveryFailure`|fn||817-833|function shouldIgnoreLatePromptDeliveryFailure(|
|
|
5451
|
+
|`logPromptWorkflowStateChange`|fn||846-865|function logPromptWorkflowStateChange(|
|
|
5452
|
+
|`logPromptWorkflowEvent`|fn||881-901|function logPromptWorkflowEvent(|
|
|
5453
|
+
|`transitionPromptWorkflowState`|fn||914-927|function transitionPromptWorkflowState(|
|
|
5454
|
+
|`resolvePromptCommandDescription`|fn||935-939|function resolvePromptCommandDescription(|
|
|
5455
|
+
|`resolveDebugProjectBase`|fn||948-952|function resolveDebugProjectBase(cwd: string, statusContr...|
|
|
5456
|
+
|`notifyContextSafely`|fn||963-980|function notifyContextSafely(|
|
|
5457
|
+
|`rejectNonIdleReqCommand`|fn||992-1012|function rejectNonIdleReqCommand(|
|
|
5458
|
+
|`getPiUsereqStartupTools`|fn||1021-1029|function getPiUsereqStartupTools(pi: ExtensionAPI): ToolI...|
|
|
5459
|
+
|`getConfiguredEnabledPiUsereqTools`|fn||1037-1041|function getConfiguredEnabledPiUsereqTools(config: UseReq...|
|
|
5460
|
+
|`applyConfiguredPiUsereqTools`|fn||1051-1068|function applyConfiguredPiUsereqTools(pi: ExtensionAPI, c...|
|
|
5461
|
+
|`handleExtensionStatusEvent`|fn||1081-1352|async function handleExtensionStatusEvent(|
|
|
5462
|
+
|`registerExtensionStatusHooks`|fn||1368-1387|function registerExtensionStatusHooks(|
|
|
5463
|
+
|`setConfiguredPiUsereqTools`|fn||1397-1400|function setConfiguredPiUsereqTools(pi: ExtensionAPI, con...|
|
|
5464
|
+
|`getDebugToolToggleNames`|fn||1408-1410|function getDebugToolToggleNames(): PiUsereqStartupToolNa...|
|
|
5465
|
+
|`resetDebugConfigToDefaults`|fn||1419-1427|function resetDebugConfigToDefaults(config: UseReqConfig)...|
|
|
5466
|
+
|`formatDebugMenuSummary`|fn||1435-1441|function formatDebugMenuSummary(config: UseReqConfig): st...|
|
|
5467
|
+
|`buildDebugMenuChoice`|fn||1451-1464|function buildDebugMenuChoice(|
|
|
5468
|
+
|`selectDebugLogOnStatus`|fn||1473-1501|async function selectDebugLogOnStatus(|
|
|
5469
|
+
|`buildDebugMenuChoices`|fn||1510-1586|function buildDebugMenuChoices(config: UseReqConfig): PiU...|
|
|
5470
|
+
|`configureDebugMenu`|fn||1596-1765|async function configureDebugMenu(|
|
|
5471
|
+
|`PiNotifyBooleanConfigKey`|type||1771||
|
|
5472
|
+
|`PiNotifyEventBooleanConfigKey`|type||1788||
|
|
5473
|
+
|`PiNotifyEventId`|type||1797||
|
|
5474
|
+
|`PiNotifyEventRowDefinition`|iface||1803-1807|interface PiNotifyEventRowDefinition|
|
|
5475
|
+
|`PiNotifyEventMenuDefinition`|iface||1813-1819|interface PiNotifyEventMenuDefinition|
|
|
5476
|
+
|`togglePiNotifyFlag`|fn||1828-1831|function togglePiNotifyFlag(config: UseReqConfig, key: Pi...|
|
|
5477
|
+
|`resetPiNotifyConfigToDefaults`|fn||1840-1864|function resetPiNotifyConfigToDefaults(config: UseReqConf...|
|
|
5478
|
+
|`formatPiNotifyPushoverPriority`|fn||1873-1875|function formatPiNotifyPushoverPriority(priority: PiNotif...|
|
|
5479
|
+
|`formatPiNotifyEventMenuSummary`|fn||1959-1967|function formatPiNotifyEventMenuSummary(|
|
|
5480
|
+
|`buildPiNotifyEventLauncherChoice`|fn||1977-1987|function buildPiNotifyEventLauncherChoice(|
|
|
5481
|
+
|`buildPiNotifyEventMenuChoices`|fn||1997-2013|function buildPiNotifyEventMenuChoices(|
|
|
5482
|
+
|`resetPiNotifyEventMenuToDefaults`|fn||2023-2031|function resetPiNotifyEventMenuToDefaults(|
|
|
5483
|
+
|`resolvePiNotifyEventLabel`|fn||2041-2048|function resolvePiNotifyEventLabel(|
|
|
5484
|
+
|`configurePiNotifyEventMenu`|fn||2059-2135|async function configurePiNotifyEventMenu(|
|
|
5485
|
+
|`buildPiNotifyPushoverRows`|fn||2144-2194|function buildPiNotifyPushoverRows(config: UseReqConfig):...|
|
|
5486
|
+
|`selectPiNotifyPushoverPriority`|fn||2204-2232|async function selectPiNotifyPushoverPriority(|
|
|
5487
|
+
|`buildPiNotifyMenuChoices`|fn||2241-2299|function buildPiNotifyMenuChoices(config: UseReqConfig): ...|
|
|
5488
|
+
|`selectPiNotifySoundLevel`|fn||2309-2349|async function selectPiNotifySoundLevel(|
|
|
5489
|
+
|`configurePiNotifyMenu`|fn||2359-2645|async function configurePiNotifyMenu(|
|
|
5490
|
+
|`registerPiNotifyShortcut`|fn||2660-2683|function registerPiNotifyShortcut(|
|
|
5491
|
+
|`resolveReqResetPromptRequest`|fn||2691-2717|function resolveReqResetPromptRequest(|
|
|
5492
|
+
|`isWorktreeBacked`|fn||2694-2701|const isWorktreeBacked = (request: PromptCommandExecution...|
|
|
5493
|
+
|`registerReqResetCommand`|fn||2727-2781|function registerReqResetCommand(|
|
|
5494
|
+
|`registerReqReferencesCommand`|fn||2791-2831|function registerReqReferencesCommand(|
|
|
5495
|
+
|`registerPromptCommands`|fn||2841-2957|function registerPromptCommands(|
|
|
5496
|
+
|`registerAgentTools`|fn||2967-3266|function registerAgentTools(pi: ExtensionAPI): void|
|
|
5497
|
+
|`buildPiUsereqToolsMenuChoices`|fn||3311-3336|function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, ...|
|
|
5498
|
+
|`buildPiUsereqToolToggleChoices`|fn||3346-3360|function buildPiUsereqToolToggleChoices(pi: ExtensionAPI,...|
|
|
5499
|
+
|`configurePiUsereqToolsMenu`|fn||3371-3488|async function configurePiUsereqToolsMenu(|
|
|
5500
|
+
|`getStaticCheckLanguageConfigForMenu`|fn||3497-3502|function getStaticCheckLanguageConfigForMenu(|
|
|
5501
|
+
|`countConfiguredStaticCheckLanguages`|fn||3510-3512|function countConfiguredStaticCheckLanguages(config: UseR...|
|
|
5502
|
+
|`countEnabledStaticCheckLanguages`|fn||3520-3522|function countEnabledStaticCheckLanguages(config: UseReqC...|
|
|
5503
|
+
|`resetStaticCheckConfig`|fn||3531-3533|function resetStaticCheckConfig(config: UseReqConfig): void|
|
|
5504
|
+
|`formatStaticCheckLanguagesSummary`|fn||3541-3543|function formatStaticCheckLanguagesSummary(config: UseReq...|
|
|
5505
|
+
|`buildStaticCheckMenuChoices`|fn||3552-3584|function buildStaticCheckMenuChoices(config: UseReqConfig...|
|
|
5506
|
+
|`buildSupportedStaticCheckLanguageChoices`|fn||3592-3609|function buildSupportedStaticCheckLanguageChoices(config:...|
|
|
5507
|
+
|`buildConfiguredStaticCheckLanguageChoices`|fn||3617-3634|function buildConfiguredStaticCheckLanguageChoices(config...|
|
|
5508
|
+
|`configureStaticCheckMenu`|fn||3644-3790|async function configureStaticCheckMenu(|
|
|
5509
|
+
|`buildPiUsereqMenuChoices`|fn||3800-3899|function buildPiUsereqMenuChoices(|
|
|
5510
|
+
|`buildSrcDirMenuChoices`|fn||3908-3926|function buildSrcDirMenuChoices(config: UseReqConfig): Pi...|
|
|
5511
|
+
|`buildSrcDirRemovalChoices`|fn||3935-3947|function buildSrcDirRemovalChoices(config: UseReqConfig):...|
|
|
5512
|
+
|`configurePiUsereq`|fn||3958-4211|async function configurePiUsereq(|
|
|
5513
|
+
|`persistConfigChange`|fn||3969-3974|const persistConfigChange = () =>|
|
|
5514
|
+
|`registerConfigCommands`|fn||4221-4231|function registerConfigCommands(|
|
|
5515
|
+
|`piUsereqExtension`|fn||4240-4250|export default function piUsereqExtension(pi: ExtensionAP...|
|
|
5342
5516
|
|