pi-usereq 0.11.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 +59 -0
- package/README.md +6 -6
- package/package.json +1 -1
- package/pi-usereq/docs/REFERENCES.md +1135 -834
- package/pi-usereq/docs/REQUIREMENTS.md +177 -110
- package/pi-usereq/docs/WORKFLOW.md +244 -79
- package/scripts/lib/extension-debug-harness.ts +2 -2
- package/scripts/tool-args-to-params.ts +2 -2
- package/src/cli.ts +12 -12
- package/src/core/config.ts +541 -180
- package/src/core/extension-status.ts +69 -12
- package/src/core/path-context.ts +19 -4
- package/src/core/pi-notify.ts +5 -5
- package/src/core/pi-usereq-tools.ts +4 -2
- package/src/core/prompt-command-catalog.ts +4 -5
- package/src/core/prompt-command-runtime.ts +183 -44
- package/src/core/prompts.ts +0 -2
- package/src/core/req-references-command.ts +175 -0
- package/src/core/req-reset-command.ts +323 -0
- package/src/core/resources.ts +6 -23
- package/src/core/settings-menu.ts +85 -28
- package/src/core/tool-runner.ts +26 -6
- package/src/index.ts +601 -116
- package/tests/attended-results-scenarios.ts +15 -9
- package/tests/cli-command-option-parity.test.ts +53 -35
- package/tests/debug-extension-harness.test.ts +8 -10
- package/tests/extension-registration.test.ts +1204 -205
- package/tests/helpers.ts +29 -6
- package/tests/oracle-project.test.ts +4 -4
- package/tests/oracle-standalone.test.ts +5 -5
- package/src/core/reference-payload.ts +0 -752
- package/src/resources/prompts/references.md +0 -64
- /package/tests/fixtures_attended_results/project/{references.json → summarize.json} +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_c.c.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_cpp.cpp.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_csharp.cs.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_elixir.ex.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_go.go.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_haskell.hs.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_java.java.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_javascript.js.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_kotlin.kt.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_lua.lua.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_perl.pl.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_php.php.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_python.py.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_ruby.rb.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_rust.rs.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_scala.scala.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_shell.sh.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_swift.swift.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_typescript.ts.json +0 -0
- /package/tests/fixtures_attended_results/standalone/{files-references → files-summarize}/fixture_zig.zig.json +0 -0
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
│ ├── prompt-command-runtime.ts
|
|
24
24
|
│ ├── prompt-command-state.ts
|
|
25
25
|
│ ├── prompts.ts
|
|
26
|
-
│ ├──
|
|
26
|
+
│ ├── req-references-command.ts
|
|
27
|
+
│ ├── req-reset-command.ts
|
|
27
28
|
│ ├── resources.ts
|
|
28
29
|
│ ├── runtime-project-paths.ts
|
|
29
30
|
│ ├── settings-menu.ts
|
|
@@ -580,10 +581,10 @@ import { buildLanguageSpecs } from "./source-analyzer.js";
|
|
|
580
581
|
|
|
581
582
|
---
|
|
582
583
|
|
|
583
|
-
# config.ts | TypeScript |
|
|
584
|
+
# config.ts | TypeScript | 1141L | 43 symbols | 8 imports | 52 comments
|
|
584
585
|
> Path: `src/core/config.ts`
|
|
585
|
-
- @brief Loads, normalizes, and persists pi-usereq
|
|
586
|
-
- @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`.
|
|
587
588
|
|
|
588
589
|
## Imports
|
|
589
590
|
```
|
|
@@ -599,41 +600,87 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
599
600
|
|
|
600
601
|
## Definitions
|
|
601
602
|
|
|
602
|
-
### iface `export interface StaticCheckEntry` (
|
|
603
|
+
### iface `export interface StaticCheckEntry` (L55-59)
|
|
603
604
|
- @brief Describes one static-check module configuration entry.
|
|
604
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.
|
|
605
606
|
|
|
606
|
-
- type `export type StaticCheckEnabled = "enable" | "disable";` (
|
|
607
|
+
- type `export type StaticCheckEnabled = "enable" | "disable";` (L65)
|
|
607
608
|
- @brief Represents the persisted per-language static-check enable flag.
|
|
608
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.
|
|
609
|
-
### iface `export interface StaticCheckLanguageConfig` (
|
|
610
|
+
### iface `export interface StaticCheckLanguageConfig` (L71-74)
|
|
610
611
|
- @brief Describes one persisted per-language static-check configuration object.
|
|
611
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.
|
|
612
613
|
|
|
613
|
-
### iface `export interface UseReqConfig` (
|
|
614
|
-
- @brief Defines the
|
|
615
|
-
- @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.
|
|
616
617
|
|
|
617
|
-
###
|
|
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)
|
|
618
635
|
- @brief Clones one static-check entry into its persisted shape.
|
|
619
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.
|
|
620
637
|
- @param[in] entry {StaticCheckEntry} Source static-check entry.
|
|
621
638
|
- @return {StaticCheckEntry} Persistable static-check entry clone.
|
|
622
639
|
|
|
623
|
-
### fn `export function createStaticCheckLanguageConfig(` (
|
|
640
|
+
### fn `export function createStaticCheckLanguageConfig(` (L321-330)
|
|
624
641
|
- @brief Builds one per-language static-check configuration object.
|
|
625
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.
|
|
626
643
|
- @param[in] checkers {StaticCheckEntry[]} Ordered checker entries.
|
|
627
644
|
- @param[in] enabled {StaticCheckEnabled | undefined} Optional explicit enable flag.
|
|
628
645
|
- @return {StaticCheckLanguageConfig} Normalized per-language config object.
|
|
629
646
|
|
|
630
|
-
### 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)
|
|
631
678
|
- @brief Returns the documented default static-check configuration.
|
|
632
|
-
- @details Emits one per-language config object for every supported language
|
|
633
|
-
- @return {Record<string, StaticCheckLanguageConfig>} Fresh default static-check config.
|
|
634
|
-
- @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
|
|
635
682
|
|
|
636
|
-
### fn `export function normalizeStaticCheckEnabled(` (
|
|
683
|
+
### fn `export function normalizeStaticCheckEnabled(` (L437-442)
|
|
637
684
|
- @brief Normalizes one persisted per-language static-check enable flag.
|
|
638
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.
|
|
639
686
|
- @param[in] value {unknown} Candidate persisted enable flag.
|
|
@@ -641,7 +688,7 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
641
688
|
- @return {StaticCheckEnabled} Canonical per-language enable flag.
|
|
642
689
|
- @satisfies REQ-249
|
|
643
690
|
|
|
644
|
-
### fn `export function getActiveStaticCheckEntries(` (
|
|
691
|
+
### fn `export function getActiveStaticCheckEntries(` (L452-461)
|
|
645
692
|
- @brief Resolves the active checker list for one language.
|
|
646
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.
|
|
647
694
|
- @param[in] staticCheckConfig {Record<string, StaticCheckLanguageConfig>} Effective static-check config.
|
|
@@ -649,21 +696,21 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
649
696
|
- @return {StaticCheckEntry[]} Active checker list for the language.
|
|
650
697
|
- @satisfies REQ-019
|
|
651
698
|
|
|
652
|
-
### fn `export function normalizeAutoGitCommit(value: unknown): "enable" | "disable"` (
|
|
699
|
+
### fn `export function normalizeAutoGitCommit(value: unknown): "enable" | "disable"` (L476-478)
|
|
653
700
|
- @brief Normalizes one persisted automatic git-commit mode value.
|
|
654
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.
|
|
655
702
|
- @param[in] value {unknown} Candidate persisted automatic git-commit payload.
|
|
656
703
|
- @return {"enable" | "disable"} Canonical automatic git-commit mode.
|
|
657
704
|
- @satisfies REQ-212
|
|
658
705
|
|
|
659
|
-
### fn `export function normalizeGitWorktreeEnabled(value: unknown): "enable" | "disable"` (
|
|
706
|
+
### fn `export function normalizeGitWorktreeEnabled(value: unknown): "enable" | "disable"` (L492-494)
|
|
660
707
|
- @brief Normalizes one persisted worktree-enable flag value.
|
|
661
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.
|
|
662
709
|
- @param[in] value {unknown} Candidate persisted worktree-enable payload.
|
|
663
710
|
- @return {"enable" | "disable"} Canonical persisted worktree-enable mode.
|
|
664
711
|
- @satisfies REQ-204
|
|
665
712
|
|
|
666
|
-
### fn `export function resolveEffectiveGitWorktreeEnabled(` (
|
|
713
|
+
### fn `export function resolveEffectiveGitWorktreeEnabled(` (L503-508)
|
|
667
714
|
- @brief Resolves the effective worktree mode after automatic-commit policy is applied.
|
|
668
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.
|
|
669
716
|
- @param[in] autoGitCommit {"enable" | "disable"} Effective automatic git-commit mode.
|
|
@@ -671,70 +718,149 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
671
718
|
- @return {"enable" | "disable"} Effective worktree mode used by menus, persistence, and prompt execution.
|
|
672
719
|
- @satisfies REQ-204, REQ-215
|
|
673
720
|
|
|
674
|
-
### fn `export function normalizeGitWorktreePrefix(value: unknown): string` (
|
|
721
|
+
### fn `export function normalizeGitWorktreePrefix(value: unknown): string` (L522-528)
|
|
675
722
|
- @brief Normalizes one persisted worktree-name prefix value.
|
|
676
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.
|
|
677
724
|
- @param[in] value {unknown} Candidate persisted prefix payload.
|
|
678
725
|
- @return {string} Canonical worktree-name prefix.
|
|
679
726
|
- @satisfies REQ-205
|
|
680
727
|
|
|
681
|
-
### fn `export function getProjectConfigPath(projectBase: string): string` (
|
|
682
|
-
- @brief Computes the per-project config file path.
|
|
683
|
-
- @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.
|
|
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.
|
|
684
731
|
- @param[in] projectBase {string} Absolute project root path.
|
|
685
|
-
- @return {string} Absolute config file path.
|
|
686
|
-
|
|
687
|
-
### fn `export function
|
|
688
|
-
- @brief
|
|
689
|
-
- @details
|
|
690
|
-
- @
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
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)
|
|
695
765
|
- @brief Normalizes one raw checker-entry array from persisted config.
|
|
696
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.
|
|
697
767
|
- @param[in] value {unknown} Candidate persisted checker array.
|
|
698
768
|
- @return {StaticCheckEntry[]} Normalized checker-entry vector.
|
|
699
769
|
|
|
700
|
-
### fn `function
|
|
701
|
-
- @brief
|
|
702
|
-
- @details
|
|
703
|
-
- @param[in]
|
|
704
|
-
- @return {Record<string,
|
|
705
|
-
- @
|
|
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.
|
|
706
776
|
|
|
707
|
-
### fn `
|
|
708
|
-
- @brief
|
|
709
|
-
- @details
|
|
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
|
|
791
|
+
|
|
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.
|
|
710
807
|
- @param[in] projectBase {string} Absolute project root path.
|
|
711
808
|
- @return {UseReqConfig} Sanitized effective configuration.
|
|
712
|
-
- @throws {ReqError} Throws with exit code `11` when
|
|
713
|
-
- @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
|
|
714
811
|
|
|
715
|
-
### fn `function
|
|
716
|
-
- @brief Builds the persisted configuration payload
|
|
717
|
-
- @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.
|
|
718
815
|
- @param[in] config {UseReqConfig} Effective configuration object.
|
|
719
|
-
- @return {
|
|
720
|
-
- @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
|
|
721
818
|
|
|
722
|
-
### fn `
|
|
723
|
-
- @brief
|
|
724
|
-
- @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.
|
|
725
836
|
- @param[in] projectBase {string} Absolute project root path.
|
|
726
|
-
- @param[in] config {UseReqConfig}
|
|
837
|
+
- @param[in] config {UseReqConfig} Effective configuration object to persist.
|
|
727
838
|
- @return {void} No return value.
|
|
728
|
-
- @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
|
|
729
847
|
|
|
730
|
-
### fn `export function
|
|
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
|
|
855
|
+
|
|
856
|
+
### fn `export function normalizeConfigPaths(projectBase: string, config: UseReqConfig): UseReqConfig` (L1071-1089)
|
|
731
857
|
- @brief Normalizes persisted directory fields to project-relative forms.
|
|
732
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.
|
|
733
859
|
- @param[in] projectBase {string} Absolute project root path.
|
|
734
860
|
- @param[in] config {UseReqConfig} Configuration object to normalize.
|
|
735
861
|
- @return {UseReqConfig} Normalized configuration copy.
|
|
736
862
|
|
|
737
|
-
### fn `export function buildPromptReplacementPaths(` (
|
|
863
|
+
### fn `export function buildPromptReplacementPaths(` (L1099-1141)
|
|
738
864
|
- @brief Builds placeholder replacements for bundled prompt rendering.
|
|
739
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.
|
|
740
866
|
- @param[in] projectBase {string} Absolute project root path.
|
|
@@ -745,28 +871,49 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
745
871
|
## Symbol Index
|
|
746
872
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
747
873
|
|---|---|---|---|---|
|
|
748
|
-
|`StaticCheckEntry`|iface||
|
|
749
|
-
|`StaticCheckEnabled`|type||
|
|
750
|
-
|`StaticCheckLanguageConfig`|iface||
|
|
751
|
-
|`UseReqConfig`|iface||
|
|
752
|
-
|`
|
|
753
|
-
|`
|
|
754
|
-
|`
|
|
755
|
-
|`
|
|
756
|
-
|`
|
|
757
|
-
|`
|
|
758
|
-
|`
|
|
759
|
-
|`
|
|
760
|
-
|`
|
|
761
|
-
|`
|
|
762
|
-
|`
|
|
763
|
-
|`
|
|
764
|
-
|`
|
|
765
|
-
|`
|
|
766
|
-
|`
|
|
767
|
-
|`
|
|
768
|
-
|`
|
|
769
|
-
|`
|
|
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(|
|
|
770
917
|
|
|
771
918
|
|
|
772
919
|
---
|
|
@@ -1127,7 +1274,7 @@ import {
|
|
|
1127
1274
|
|
|
1128
1275
|
---
|
|
1129
1276
|
|
|
1130
|
-
# extension-status.ts | TypeScript |
|
|
1277
|
+
# extension-status.ts | TypeScript | 880L | 46 symbols | 6 imports | 48 comments
|
|
1131
1278
|
> Path: `src/core/extension-status.ts`
|
|
1132
1279
|
- @brief Tracks pi-usereq extension status state and renders status-bar telemetry.
|
|
1133
1280
|
- @details Centralizes hook interception, context-usage snapshots, active-branch lookup, run timing, and deterministic status-bar formatting for the pi-usereq extension. Runtime
|
|
@@ -1139,6 +1286,7 @@ scheduling through exported controller helpers.
|
|
|
1139
1286
|
```
|
|
1140
1287
|
import type {
|
|
1141
1288
|
import type { UseReqConfig } from "./config.js";
|
|
1289
|
+
import type { PiNotifySoundLevel } from "./pi-notify.js";
|
|
1142
1290
|
import type { PromptCommandExecutionPlan } from "./prompt-command-runtime.js";
|
|
1143
1291
|
import {
|
|
1144
1292
|
import { resolveRuntimeGitBranchName } from "./runtime-project-paths.js";
|
|
@@ -1146,120 +1294,120 @@ import { resolveRuntimeGitBranchName } from "./runtime-project-paths.js";
|
|
|
1146
1294
|
|
|
1147
1295
|
## Definitions
|
|
1148
1296
|
|
|
1149
|
-
- type `type StatusForegroundColor = Extract<` (
|
|
1297
|
+
- type `type StatusForegroundColor = Extract<` (L31)
|
|
1150
1298
|
- @brief Enumerates the CLI-supported theme tokens consumed by status rendering.
|
|
1151
1299
|
- @details Restricts the status formatter to documented pi theme tokens so the
|
|
1152
1300
|
status bar remains compatible with the active CLI theme schema. Compile-time
|
|
1153
1301
|
only and introduces no runtime cost.
|
|
1154
|
-
### iface `interface RawStatusTheme` (
|
|
1302
|
+
### iface `interface RawStatusTheme` (L41-43)
|
|
1155
1303
|
- @brief Describes the raw theme capabilities required for status rendering.
|
|
1156
1304
|
- @details Accepts the `ctx.ui.theme` foreground renderer used by the
|
|
1157
1305
|
single-line footer. Compile-time only and introduces no runtime cost.
|
|
1158
1306
|
|
|
1159
|
-
### iface `interface StatusThemeAdapter` (
|
|
1307
|
+
### iface `interface StatusThemeAdapter` (L51-56)
|
|
1160
1308
|
- @brief Describes the normalized theme adapter used by status formatters.
|
|
1161
1309
|
- @details Exposes deterministic label, value, foreground, and separator
|
|
1162
1310
|
renderers so status text generation stays independent from the raw theme API.
|
|
1163
1311
|
Compile-time only and introduces no runtime cost.
|
|
1164
1312
|
|
|
1165
|
-
- type `export type PiUsereqStatusHookName = (typeof PI_USEREQ_STATUS_HOOK_NAMES)[number];` (
|
|
1313
|
+
- type `export type PiUsereqStatusHookName = (typeof PI_USEREQ_STATUS_HOOK_NAMES)[number];` (L99)
|
|
1166
1314
|
- @brief Represents one hook name handled by the pi-usereq status controller.
|
|
1167
1315
|
- @details Narrows hook registration and event-update calls to the canonical
|
|
1168
1316
|
intercepted-hook set. Compile-time only and introduces no runtime cost.
|
|
1169
|
-
- type `export type PiUsereqPromptRequest = PromptCommandExecutionPlan;` (
|
|
1317
|
+
- type `export type PiUsereqPromptRequest = PromptCommandExecutionPlan;` (L105)
|
|
1170
1318
|
- @brief Describes one prompt request tracked across extension command delivery and runtime execution.
|
|
1171
1319
|
- @details Reuses the prepared prompt-command execution plan so status rendering and prompt-end side effects can recover the original project base, active execution base, and optional worktree metadata for the current prompt run. The alias is compile-time only and introduces no runtime cost.
|
|
1172
|
-
- type `export type PiUsereqWorkflowState = "idle" | "checking" | "running" | "merging" | "error";` (
|
|
1320
|
+
- type `export type PiUsereqWorkflowState = "idle" | "checking" | "running" | "merging" | "error";` (L111)
|
|
1173
1321
|
- @brief Represents one prompt-orchestration workflow state displayed in the status bar.
|
|
1174
1322
|
- @details Narrows workflow tracking to the documented `idle`, `checking`, `running`, `merging`, and `error` states reused by prompt-command gating, prompt-end orchestration, and status rendering. Compile-time only and introduces no runtime cost.
|
|
1175
|
-
### iface `export interface PiUsereqStatusState` (
|
|
1323
|
+
### iface `export interface PiUsereqStatusState` (L117-126)
|
|
1176
1324
|
- @brief Stores the mutable runtime facts displayed by the status bar.
|
|
1177
|
-
- @details Persists the prompt-orchestration workflow state, the latest context-usage snapshot, the active run start timestamp, the most recent normally completed run duration, the accumulated duration of all normally completed runs, and prompt-request metadata carried from command dispatch into the next runtime execution. Runtime state is mutated in-place by controller helpers. Compile-time only and introduces no runtime cost.
|
|
1325
|
+
- @details Persists the prompt-orchestration workflow state, the latest context-usage snapshot, the active run start timestamp, the most recent normally completed run duration, the accumulated duration of all normally completed runs, the in-memory runtime sound level, and prompt-request metadata carried from command dispatch into the next runtime execution. Runtime state is mutated in-place by controller helpers. Compile-time only and introduces no runtime cost.
|
|
1178
1326
|
|
|
1179
|
-
### iface `export interface PiUsereqStatusController` (
|
|
1327
|
+
### iface `export interface PiUsereqStatusController` (L135-140)
|
|
1180
1328
|
- @brief Stores the controller state required for event-driven status updates.
|
|
1181
1329
|
- @details Keeps the mutable status snapshot, the current configuration, the
|
|
1182
1330
|
latest extension context used for rendering, and the interval handle used
|
|
1183
1331
|
for live elapsed-time refreshes. Compile-time only and introduces no runtime
|
|
1184
1332
|
cost.
|
|
1185
1333
|
|
|
1186
|
-
### iface `interface PiUsereqStatusPersistenceStore` (
|
|
1334
|
+
### iface `interface PiUsereqStatusPersistenceStore` (L146-149)
|
|
1187
1335
|
- @brief Stores the process-scoped elapsed-timer snapshot reused across session replacement.
|
|
1188
1336
|
- @details Preserves only the latest completed duration and accumulated completed runtime so `/new`, `/resume`, and `/fork` can restore elapsed counters after the extension runtime is rebound. Compile-time only and introduces no runtime cost.
|
|
1189
1337
|
|
|
1190
|
-
### fn `function getPiUsereqStatusPersistenceStore(): PiUsereqStatusPersistenceStore` (
|
|
1338
|
+
### fn `function getPiUsereqStatusPersistenceStore(): PiUsereqStatusPersistenceStore` (L163-172)
|
|
1191
1339
|
- @brief Returns the process-scoped elapsed-timer persistence store.
|
|
1192
1340
|
- @details Lazily initializes one internal `globalThis` record because pi rebinds extension modules for `/new`, `/resume`, `/fork`, and `/reload`, but the hosting process persists across those operations. Runtime is O(1). Side effect: initializes internal process-scoped state on first access.
|
|
1193
1341
|
- @return {PiUsereqStatusPersistenceStore} Mutable persistence record.
|
|
1194
1342
|
- @note Design rationale: required to preserve elapsed counters across session replacement without writing session-global menu state into project configuration.
|
|
1195
1343
|
|
|
1196
|
-
### fn `function restorePersistedElapsedState(state: PiUsereqStatusState): void` (
|
|
1344
|
+
### fn `function restorePersistedElapsedState(state: PiUsereqStatusState): void` (L180-184)
|
|
1197
1345
|
- @brief Restores persisted elapsed counters into one mutable status snapshot.
|
|
1198
1346
|
- @details Copies the process-scoped last-run and accumulated completed durations into the supplied controller state so rebinding events can continue showing prior counters. Runtime is O(1). Side effect: mutates `state`.
|
|
1199
1347
|
- @param[in,out] state {PiUsereqStatusState} Mutable status state.
|
|
1200
1348
|
- @return {void} No return value.
|
|
1201
1349
|
|
|
1202
|
-
### fn `function persistElapsedState(state: PiUsereqStatusState): void` (
|
|
1350
|
+
### fn `function persistElapsedState(state: PiUsereqStatusState): void` (L192-196)
|
|
1203
1351
|
- @brief Persists elapsed counters from one mutable status snapshot.
|
|
1204
1352
|
- @details Copies the current last-run and accumulated completed durations into the process-scoped store so later extension instances can restore them after session replacement. Runtime is O(1). Side effect: mutates internal process-scoped state.
|
|
1205
1353
|
- @param[in] state {PiUsereqStatusState} Mutable status state snapshot.
|
|
1206
1354
|
- @return {void} No return value.
|
|
1207
1355
|
|
|
1208
|
-
### fn `function persistPromptCommandState(state: PiUsereqStatusState): void` (
|
|
1356
|
+
### fn `function persistPromptCommandState(state: PiUsereqStatusState): void` (L204-210)
|
|
1209
1357
|
- @brief Mirrors one controller prompt state into the process-scoped persistence store.
|
|
1210
1358
|
- @details Persists the current workflow state plus the pending and active prompt execution plans so prompt orchestration can survive session replacement. Runtime is O(1). Side effect: mutates process-scoped prompt-command persistence state.
|
|
1211
1359
|
- @param[in] state {PiUsereqStatusState} Current controller state snapshot.
|
|
1212
1360
|
- @return {void} No return value.
|
|
1213
1361
|
|
|
1214
|
-
### fn `export function shouldPreservePromptCommandStateOnShutdown(state: PiUsereqStatusState): boolean` (
|
|
1362
|
+
### fn `export function shouldPreservePromptCommandStateOnShutdown(state: PiUsereqStatusState): boolean` (L219-222)
|
|
1215
1363
|
- @brief Detects whether `session_shutdown` must preserve prompt-command state.
|
|
1216
1364
|
- @details Keeps both the in-memory controller prompt state and the process-scoped prompt execution plan intact while pi switches from the original session into the forked execution session, because the old extension instance can keep running the initiating command handler after `session_shutdown` fires and before the replacement session fully takes over. Runtime is O(1). No external state is mutated.
|
|
1217
1365
|
- @param[in] state {PiUsereqStatusState} Controller state before shutdown mutation.
|
|
1218
1366
|
- @return {boolean} `true` when prompt-command state must survive the shutdown event.
|
|
1219
1367
|
- @satisfies REQ-278
|
|
1220
1368
|
|
|
1221
|
-
### fn `function restorePersistedPromptCommandState(` (
|
|
1369
|
+
### fn `function restorePersistedPromptCommandState(` (L231-242)
|
|
1222
1370
|
- @brief Restores prompt-command persistence into one fresh controller when the active session matches.
|
|
1223
1371
|
- @details Rehydrates workflow state plus pending or active prompt execution plans only when the current session file targets the persisted execution session created for prompt orchestration. Runtime is O(1). Side effect: mutates `state` when persisted prompt state is available.
|
|
1224
1372
|
- @param[in] sessionFile {string | undefined} Current active session file.
|
|
1225
1373
|
- @param[in,out] state {PiUsereqStatusState} Mutable controller state.
|
|
1226
1374
|
- @return {void} No return value.
|
|
1227
1375
|
|
|
1228
|
-
### fn `function getContextSessionFile(ctx: ExtensionContext): string | undefined` (
|
|
1376
|
+
### fn `function getContextSessionFile(ctx: ExtensionContext): string | undefined` (L250-254)
|
|
1229
1377
|
- @brief Resolves the active session file exposed by one extension context.
|
|
1230
1378
|
- @details Reads the session-manager session-file getter when available so prompt-command persistence can be resynchronized on every lifecycle hook after session replacement. Runtime is O(1). No external state is mutated.
|
|
1231
1379
|
- @param[in] ctx {ExtensionContext} Active extension context.
|
|
1232
1380
|
- @return {string | undefined} Current session file when available.
|
|
1233
1381
|
|
|
1234
|
-
### fn `export function isStaleExtensionContextError(error: unknown): boolean` (
|
|
1382
|
+
### fn `export function isStaleExtensionContextError(error: unknown): boolean` (L263-266)
|
|
1235
1383
|
- @brief Detects stale extension-context access after session replacement.
|
|
1236
1384
|
- @details Matches the guarded pi runtime error emitted when one invalidated extension context, command context, or replacement-session context is accessed after session replacement or reload. Runtime is O(n) in message length only when an error is supplied. No external state is mutated.
|
|
1237
1385
|
- @param[in] error {unknown} Candidate thrown value.
|
|
1238
1386
|
- @return {boolean} `true` when the value matches the stale-extension-context runtime error.
|
|
1239
1387
|
- @satisfies REQ-280
|
|
1240
1388
|
|
|
1241
|
-
### fn `function resetElapsedState(state: PiUsereqStatusState): void` (
|
|
1389
|
+
### fn `function resetElapsedState(state: PiUsereqStatusState): void` (L275-279)
|
|
1242
1390
|
- @brief Resets the in-memory and persisted elapsed counters.
|
|
1243
1391
|
- @details Clears both completed-duration fields in the supplied state and mirrors that cleared snapshot into the process-scoped store. Runtime is O(1). Side effects include mutable state reset and process-scoped persistence update.
|
|
1244
1392
|
- @param[in,out] state {PiUsereqStatusState} Mutable status state.
|
|
1245
1393
|
- @return {void} No return value.
|
|
1246
1394
|
- @satisfies REQ-217
|
|
1247
1395
|
|
|
1248
|
-
### fn `function shouldResetElapsedStateOnSessionStart(event: unknown): boolean` (
|
|
1396
|
+
### fn `function shouldResetElapsedStateOnSessionStart(event: unknown): boolean` (L288-291)
|
|
1249
1397
|
- @brief Detects whether a `session_start` event must reset elapsed counters.
|
|
1250
1398
|
- @details Treats `startup` and `reload` as hard-reset boundaries while preserving counters for `new`, `resume`, and `fork`. Runtime is O(1). No external state is mutated.
|
|
1251
1399
|
- @param[in] event {unknown} Session-start payload.
|
|
1252
1400
|
- @return {boolean} `true` when elapsed counters must reset.
|
|
1253
1401
|
- @satisfies REQ-217
|
|
1254
1402
|
|
|
1255
|
-
### fn `function shouldResetWorkflowStateOnSessionStart(event: unknown): boolean` (
|
|
1403
|
+
### fn `function shouldResetWorkflowStateOnSessionStart(event: unknown): boolean` (L300-303)
|
|
1256
1404
|
- @brief Detects whether a `session_start` event must reset the workflow state to `idle`.
|
|
1257
1405
|
- @details Treats `startup`, `new`, and `reload` as workflow-reset boundaries so prompt-orchestration state never leaks across boot, explicit session replacement, or extension reload. Runtime is O(1). No external state is mutated.
|
|
1258
1406
|
- @param[in] event {unknown} Session-start payload.
|
|
1259
1407
|
- @return {boolean} `true` when workflow state must reset to `idle`.
|
|
1260
1408
|
- @satisfies REQ-009, REQ-221
|
|
1261
1409
|
|
|
1262
|
-
### fn `function createStatusThemeAdapter(theme: RawStatusTheme): StatusThemeAdapter` (
|
|
1410
|
+
### fn `function createStatusThemeAdapter(theme: RawStatusTheme): StatusThemeAdapter` (L313-322)
|
|
1263
1411
|
- @brief Builds the normalized theme adapter used by pi-usereq status formatters.
|
|
1264
1412
|
- @details Precomputes label, value, foreground, and separator renderers so
|
|
1265
1413
|
status formatting remains stable across real TUI themes and deterministic
|
|
@@ -1267,16 +1415,16 @@ test doubles. Runtime is O(1). No external state is mutated.
|
|
|
1267
1415
|
- @param[in] theme {RawStatusTheme} Raw theme implementation from `ctx.ui.theme`.
|
|
1268
1416
|
- @return {StatusThemeAdapter} Normalized status-theme adapter.
|
|
1269
1417
|
|
|
1270
|
-
### fn `const colorize = (color: StatusForegroundColor, text: string): string =>` (
|
|
1418
|
+
### fn `const colorize = (color: StatusForegroundColor, text: string): string =>` (L314-321)
|
|
1271
1419
|
|
|
1272
|
-
### fn `function resolveStatusBranchValue(ctx: ExtensionContext): string` (
|
|
1420
|
+
### fn `function resolveStatusBranchValue(ctx: ExtensionContext): string` (L331-333)
|
|
1273
1421
|
- @brief Resolves the active git branch value rendered in the status bar.
|
|
1274
1422
|
- @details Reads the current branch from the active context working directory on every status render so worktree switches and restored base-session renders expose the latest branch immediately. Runtime is dominated by git execution when the working directory belongs to a repository. Side effects include subprocess creation.
|
|
1275
1423
|
- @param[in] ctx {ExtensionContext} Active extension context.
|
|
1276
1424
|
- @return {string} Active branch name or `unknown` when unavailable.
|
|
1277
1425
|
- @satisfies REQ-121, REQ-283
|
|
1278
1426
|
|
|
1279
|
-
### fn `function normalizeContextUsage(` (
|
|
1427
|
+
### fn `function normalizeContextUsage(` (L344-361)
|
|
1280
1428
|
- @brief Normalizes one raw context-usage snapshot.
|
|
1281
1429
|
- @details Preserves the runtime token and context-window counts, derives a
|
|
1282
1430
|
percentage when the runtime omits it, clamps negative percentages to `0`,
|
|
@@ -1285,7 +1433,7 @@ external state is mutated.
|
|
|
1285
1433
|
- @param[in] contextUsage {ContextUsage | undefined} Raw runtime snapshot.
|
|
1286
1434
|
- @return {ContextUsage | undefined} Normalized snapshot.
|
|
1287
1435
|
|
|
1288
|
-
### fn `function refreshContextUsage(` (
|
|
1436
|
+
### fn `function refreshContextUsage(` (L373-378)
|
|
1289
1437
|
- @brief Refreshes the stored context-usage snapshot from the active extension context.
|
|
1290
1438
|
- @details Calls `ctx.getContextUsage()` on every intercepted event so the
|
|
1291
1439
|
controller retains the newest context-usage facts available from the pi
|
|
@@ -1295,22 +1443,22 @@ runtime. Runtime is O(1). Side effect: mutates `state.contextUsage`.
|
|
|
1295
1443
|
- @return {void} No return value.
|
|
1296
1444
|
- @satisfies REQ-118, REQ-119
|
|
1297
1445
|
|
|
1298
|
-
### fn `function resolveContextUsageIconText(` (
|
|
1446
|
+
### fn `function resolveContextUsageIconText(` (L387-404)
|
|
1299
1447
|
- @brief Resolves the icon text for one normalized context-usage snapshot.
|
|
1300
1448
|
- @details Maps context usage to one fixed-width icon band so footer rendering remains compact and deterministic across the documented `0`, `>0-<25`, `>=25-<50`, `>=50-<75`, and `>=75` percent bands. Unavailable usage degrades to the `0%` icon. Runtime is O(1). No external state is mutated.
|
|
1301
1449
|
- @param[in] contextUsage {ContextUsage | undefined} Normalized context snapshot.
|
|
1302
1450
|
- @return {string} Fixed-width gauge icon text.
|
|
1303
1451
|
- @satisfies REQ-122, REQ-284
|
|
1304
1452
|
|
|
1305
|
-
### fn `function formatContextUsageBar(` (
|
|
1453
|
+
### fn `function formatContextUsageBar(` (L414-426)
|
|
1306
1454
|
- @brief Formats one icon-based context-usage gauge.
|
|
1307
|
-
- @details Renders the documented gauge icon with theme `
|
|
1455
|
+
- @details Renders the documented gauge icon with the same non-error status-value theme token used by `status` below `90%`, switches to theme `error` for `>=90%`, and enables terminal blink only for `>=100%`. Runtime is O(1). No external state is mutated.
|
|
1308
1456
|
- @param[in] theme {StatusThemeAdapter} Normalized status theme.
|
|
1309
1457
|
- @param[in] contextUsage {ContextUsage | undefined} Normalized context snapshot.
|
|
1310
1458
|
- @return {string} Rendered fixed-width gauge icon.
|
|
1311
1459
|
- @satisfies REQ-122, REQ-126, REQ-127, REQ-128, REQ-233, REQ-284
|
|
1312
1460
|
|
|
1313
|
-
### fn `function formatStatusDuration(durationMs: number): string` (
|
|
1461
|
+
### fn `function formatStatusDuration(durationMs: number): string` (L437-442)
|
|
1314
1462
|
- @brief Formats one elapsed-duration value as `M:SS`.
|
|
1315
1463
|
- @details Floors the input to whole seconds, keeps minutes unbounded above 59,
|
|
1316
1464
|
and zero-pads seconds to two digits. Runtime is O(1). No external state is
|
|
@@ -1319,7 +1467,7 @@ mutated.
|
|
|
1319
1467
|
- @return {string} Duration rendered as `M:SS`.
|
|
1320
1468
|
- @satisfies REQ-125
|
|
1321
1469
|
|
|
1322
|
-
### fn `function formatCompletedStatusDuration(` (
|
|
1470
|
+
### fn `function formatCompletedStatusDuration(` (L453-457)
|
|
1323
1471
|
- @brief Formats one optional completed-duration value.
|
|
1324
1472
|
- @details Returns the canonical unset placeholder `--:--` until the supplied
|
|
1325
1473
|
timer receives a normally completed prompt duration, then delegates to
|
|
@@ -1328,7 +1476,7 @@ timer receives a normally completed prompt duration, then delegates to
|
|
|
1328
1476
|
- @return {string} Rendered duration or unset placeholder.
|
|
1329
1477
|
- @satisfies REQ-124
|
|
1330
1478
|
|
|
1331
|
-
### fn `function formatElapsedStatusValue(` (
|
|
1479
|
+
### fn `function formatElapsedStatusValue(` (L470-480)
|
|
1332
1480
|
- @brief Formats the consolidated `elapsed` status-bar value.
|
|
1333
1481
|
- @details Emits the active prompt segment `⏱︎ <active>`, the latest normally
|
|
1334
1482
|
completed segment `⚑ <last>`, and the accumulated successful-runtime segment
|
|
@@ -1339,7 +1487,7 @@ mutated.
|
|
|
1339
1487
|
- @return {string} Consolidated `elapsed` field value.
|
|
1340
1488
|
- @satisfies REQ-123, REQ-124, REQ-125, REQ-159
|
|
1341
1489
|
|
|
1342
|
-
### fn `function formatStatusField(` (
|
|
1490
|
+
### fn `function formatStatusField(` (L491-497)
|
|
1343
1491
|
- @brief Formats one standard status-bar field.
|
|
1344
1492
|
- @details Renders the field label in accent color and the value in warning
|
|
1345
1493
|
color. Runtime is O(n) in combined text length. No external state is mutated.
|
|
@@ -1348,7 +1496,7 @@ color. Runtime is O(n) in combined text length. No external state is mutated.
|
|
|
1348
1496
|
- @param[in] value {string} Unstyled field value.
|
|
1349
1497
|
- @return {string} Rendered status-field fragment.
|
|
1350
1498
|
|
|
1351
|
-
### fn `function formatRenderedStatusField(` (
|
|
1499
|
+
### fn `function formatRenderedStatusField(` (L509-515)
|
|
1352
1500
|
- @brief Formats one pre-rendered status-bar field value.
|
|
1353
1501
|
- @details Preserves the accent-colored field label while allowing callers to
|
|
1354
1502
|
provide a custom styled value such as the context-usage bar. Runtime is O(n)
|
|
@@ -1358,7 +1506,7 @@ in combined text length. No external state is mutated.
|
|
|
1358
1506
|
- @param[in] renderedValue {string} Pre-rendered field value.
|
|
1359
1507
|
- @return {string} Rendered status-field fragment.
|
|
1360
1508
|
|
|
1361
|
-
### fn `function formatWorkflowStateValue(` (
|
|
1509
|
+
### fn `function formatWorkflowStateValue(` (L525-533)
|
|
1362
1510
|
- @brief Formats the rendered workflow-state value for the `status` field.
|
|
1363
1511
|
- @details Uses the standard warning-colored value renderer for non-error states and emits a blinking `error`-colored value for `status:error` so the footer highlights orchestration failures immediately. Runtime is O(n) in text length. No external state is mutated.
|
|
1364
1512
|
- @param[in] theme {StatusThemeAdapter} Normalized status theme.
|
|
@@ -1366,7 +1514,7 @@ in combined text length. No external state is mutated.
|
|
|
1366
1514
|
- @return {string} Rendered workflow-state value.
|
|
1367
1515
|
- @satisfies REQ-112, REQ-223
|
|
1368
1516
|
|
|
1369
|
-
### fn `function didAgentEndAbort(messages: AgentEndEvent["messages"]): boolean` (
|
|
1517
|
+
### fn `function didAgentEndAbort(messages: AgentEndEvent["messages"]): boolean` (L544-551)
|
|
1370
1518
|
- @brief Detects whether an agent run ended through abort semantics.
|
|
1371
1519
|
- @details Treats any assistant message whose `stopReason` equals `aborted` as
|
|
1372
1520
|
an escape-triggered termination that must not overwrite the `last` timer.
|
|
@@ -1375,9 +1523,17 @@ Runtime is O(n) in message count. No external state is mutated.
|
|
|
1375
1523
|
- @return {boolean} `true` when the run ended in aborted state.
|
|
1376
1524
|
- @satisfies REQ-125
|
|
1377
1525
|
|
|
1378
|
-
### fn `function
|
|
1526
|
+
### fn `function resolvePiUsereqRuntimeSoundLevel(` (L561-566)
|
|
1527
|
+
- @brief Resolves the active runtime sound level used by status and notify flows.
|
|
1528
|
+
- @details Prefers the mutable runtime sound state, then falls back to the cached persisted boot value, and finally defaults to `none` before `session_start` loads configuration. Runtime is O(1). No external state is mutated.
|
|
1529
|
+
- @param[in] state {PiUsereqStatusState} Mutable status state snapshot.
|
|
1530
|
+
- @param[in] config {UseReqConfig | undefined} Cached project configuration.
|
|
1531
|
+
- @return {PiNotifySoundLevel} Active runtime sound level.
|
|
1532
|
+
- @satisfies REQ-180, REQ-285
|
|
1533
|
+
|
|
1534
|
+
### fn `function buildPiUsereqStatusText(` (L579-603)
|
|
1379
1535
|
- @brief Builds the full single-line pi-usereq status-bar payload.
|
|
1380
|
-
- @details Renders status, branch, context, elapsed, and sound fields in the canonical order with dim bullet separators, workflow-state highlighting,
|
|
1536
|
+
- @details Renders status, branch, context, elapsed, and sound fields in the canonical order with dim bullet separators, workflow-state highlighting, the documented icon-based context gauge, and the active runtime sound level instead of the persisted boot value. Runtime is O(1). No external state is mutated.
|
|
1381
1537
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
1382
1538
|
- @param[in] theme {StatusThemeAdapter} Normalized status theme.
|
|
1383
1539
|
- @param[in] state {PiUsereqStatusState} Mutable status state snapshot.
|
|
@@ -1386,7 +1542,7 @@ Runtime is O(n) in message count. No external state is mutated.
|
|
|
1386
1542
|
- @return {string} Single-line status-bar text.
|
|
1387
1543
|
- @satisfies REQ-109, REQ-112, REQ-120, REQ-121, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-156, REQ-159, REQ-180, REQ-222, REQ-223, REQ-233, REQ-283, REQ-284
|
|
1388
1544
|
|
|
1389
|
-
### fn `function stopStatusTicker(controller: PiUsereqStatusController): void` (
|
|
1545
|
+
### fn `function stopStatusTicker(controller: PiUsereqStatusController): void` (L613-618)
|
|
1390
1546
|
- @brief Stops the live elapsed-time ticker when it is active.
|
|
1391
1547
|
- @details Clears the interval handle and resets the stored timer reference so
|
|
1392
1548
|
subsequent runs can reinitialize live status refreshes deterministically.
|
|
@@ -1394,7 +1550,7 @@ Runtime is O(1). Side effect: mutates `controller.tickHandle`.
|
|
|
1394
1550
|
- @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
|
|
1395
1551
|
- @return {void} No return value.
|
|
1396
1552
|
|
|
1397
|
-
### fn `function syncPiUsereqStatusTicker(` (
|
|
1553
|
+
### fn `function syncPiUsereqStatusTicker(` (L630-646)
|
|
1398
1554
|
- @brief Synchronizes the live elapsed-time ticker with the current run state.
|
|
1399
1555
|
- @details Starts a 1-second render ticker while a run is active and stops the
|
|
1400
1556
|
ticker when the run returns to idle. Runtime is O(1). Side effects include
|
|
@@ -1404,31 +1560,48 @@ ticks.
|
|
|
1404
1560
|
- @return {void} No return value.
|
|
1405
1561
|
- @satisfies REQ-123
|
|
1406
1562
|
|
|
1407
|
-
### fn `export function createPiUsereqStatusController(): PiUsereqStatusController` (
|
|
1563
|
+
### fn `export function createPiUsereqStatusController(): PiUsereqStatusController` (L654-670)
|
|
1408
1564
|
- @brief Creates an empty pi-usereq status controller.
|
|
1409
|
-
- @details Initializes the mutable status snapshot, including empty prompt-request tracking
|
|
1565
|
+
- @details Initializes the mutable status snapshot, including empty prompt-request tracking and an unset runtime sound level that later loads from persisted config during `session_start`, and starts with no config, no context, and no live ticker. Runtime is O(1). No external state is mutated.
|
|
1410
1566
|
- @return {PiUsereqStatusController} New status controller.
|
|
1411
1567
|
- @satisfies DES-010
|
|
1412
1568
|
|
|
1413
|
-
### fn `export function setPiUsereqStatusConfig(` (
|
|
1569
|
+
### fn `export function setPiUsereqStatusConfig(` (L683-688)
|
|
1414
1570
|
- @brief Stores the effective project configuration used by status rendering.
|
|
1415
1571
|
- @details Replaces the controller's cached configuration so later status
|
|
1416
|
-
renders reuse the latest docs, tests, source-path, and pi-notify
|
|
1417
|
-
without reading from disk on every event
|
|
1572
|
+
renders reuse the latest docs, tests, source-path, and persisted pi-notify
|
|
1573
|
+
values without reading from disk on every event, while leaving the active
|
|
1574
|
+
runtime sound level in `controller.state`. Runtime is O(1). Side effect:
|
|
1418
1575
|
mutates `controller.config`.
|
|
1419
1576
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
1420
1577
|
- @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
|
|
1421
1578
|
- @return {void} No return value.
|
|
1422
1579
|
|
|
1423
|
-
### fn `export function
|
|
1580
|
+
### fn `export function getPiUsereqRuntimeSoundLevel(` (L697-701)
|
|
1581
|
+
- @brief Returns the active runtime sound level tracked by the status controller.
|
|
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.
|
|
1583
|
+
- @param[in] controller {PiUsereqStatusController} Mutable status controller.
|
|
1584
|
+
- @return {PiNotifySoundLevel} Active runtime sound level.
|
|
1585
|
+
- @satisfies REQ-180, REQ-285
|
|
1586
|
+
|
|
1587
|
+
### fn `export function setPiUsereqRuntimeSoundLevel(` (L712-722)
|
|
1588
|
+
- @brief Stores one new runtime sound level and refreshes the status bar.
|
|
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.
|
|
1590
|
+
- @param[in] runtimeSoundLevel {PiNotifySoundLevel} Next active runtime sound level.
|
|
1591
|
+
- @param[in] ctx {ExtensionContext | undefined} Optional active extension context.
|
|
1592
|
+
- @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
|
|
1593
|
+
- @return {void} No return value.
|
|
1594
|
+
- @satisfies REQ-180, REQ-286, REQ-287
|
|
1595
|
+
|
|
1596
|
+
### fn `export function renderPiUsereqStatus(` (L732-763)
|
|
1424
1597
|
- @brief Renders the current pi-usereq status bar into the active UI context.
|
|
1425
|
-
- @details Updates the controller's latest context pointer and writes the single-line status text only when configuration is available, including the active branch field
|
|
1598
|
+
- @details Updates the controller's latest context pointer, refreshes the live `getContextUsage()` snapshot for direct render call sites that do not pass through `updateExtensionStatus(...)`, and writes the single-line status text only when configuration is available, including the active branch field, documented icon-based context gauge, and active runtime sound level. When pi has already invalidated the supplied context after session replacement or reload, the helper clears the stale cached context and returns without surfacing the stale-instance exception. Runtime is O(1) plus git execution for branch refresh. Side effect: mutates `controller.state.contextUsage` and `ctx.ui` status when the context is still active.
|
|
1426
1599
|
- @param[in] ctx {ExtensionContext} Active extension context.
|
|
1427
1600
|
- @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
|
|
1428
1601
|
- @return {void} No return value.
|
|
1429
|
-
- @satisfies REQ-120, REQ-121, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-159, REQ-180, REQ-233, REQ-280, REQ-283, REQ-284
|
|
1602
|
+
- @satisfies REQ-118, REQ-119, REQ-120, REQ-121, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-159, REQ-180, REQ-233, REQ-280, REQ-283, REQ-284
|
|
1430
1603
|
|
|
1431
|
-
### fn `export function setPiUsereqWorkflowState(` (
|
|
1604
|
+
### fn `export function setPiUsereqWorkflowState(` (L774-785)
|
|
1432
1605
|
- @brief Transitions the prompt-orchestration workflow state and refreshes the status bar.
|
|
1433
1606
|
- @details Mutates the tracked workflow state, preserves the latest extension context when available, and re-renders the single-line footer immediately so internal command transitions and pi lifecycle transitions stay visible to the user. Runtime is O(1). Side effect: mutates workflow state and may update `ctx.ui` status.
|
|
1434
1607
|
- @param[in] workflowState {PiUsereqWorkflowState} Next workflow state.
|
|
@@ -1437,17 +1610,17 @@ mutates `controller.config`.
|
|
|
1437
1610
|
- @return {void} No return value.
|
|
1438
1611
|
- @satisfies REQ-221, REQ-222, REQ-223
|
|
1439
1612
|
|
|
1440
|
-
### fn `export function updateExtensionStatus(` (
|
|
1613
|
+
### fn `export function updateExtensionStatus(` (L797-864)
|
|
1441
1614
|
- @brief Updates mutable status state for one intercepted lifecycle hook.
|
|
1442
|
-
- @details Refreshes stored context usage on every hook, resets or restores persisted elapsed counters during `session_start`, restores persisted prompt-command metadata when the active session matches a forked execution session, resynchronizes that metadata on later lifecycle hooks so post-switch workflow transitions performed by the initiating command handler become visible to the replacement-session runtime, resets workflow state to `idle` for documented session-start reasons, starts run timing on `agent_start`, promotes pending prompt-request metadata into the active run, captures non-aborted run duration on `agent_end`, accumulates successful runtime into `Σ`, preserves in-memory prompt-command state plus process-scoped persistence across switch-triggered `session_shutdown`, tolerates stale post-replacement render contexts, synchronizes the live ticker, and re-renders the status bar when configuration is available. Runtime is O(n) in `agent_end` message count and otherwise O(1). Side effects include in-memory state mutation, interval scheduling, process-scoped persistence mutation, and footer-status updates.
|
|
1615
|
+
- @details Refreshes stored context usage on every hook, resets or restores persisted elapsed counters during `session_start`, loads the active runtime sound level from persisted config during `session_start`, restores persisted prompt-command metadata when the active session matches a forked execution session, resynchronizes that metadata on later lifecycle hooks so post-switch workflow transitions performed by the initiating command handler become visible to the replacement-session runtime, resets workflow state to `idle` for documented session-start reasons, starts run timing on `agent_start`, promotes pending prompt-request metadata into the active run, captures non-aborted run duration on `agent_end`, accumulates successful runtime into `Σ`, preserves in-memory prompt-command state plus process-scoped persistence across switch-triggered `session_shutdown`, tolerates stale post-replacement render contexts, synchronizes the live ticker, and re-renders the status bar when configuration is available. Runtime is O(n) in `agent_end` message count and otherwise O(1). Side effects include in-memory state mutation, interval scheduling, process-scoped persistence mutation, and footer-status updates.
|
|
1443
1616
|
- @param[in] hookName {PiUsereqStatusHookName} Intercepted hook name.
|
|
1444
1617
|
- @param[in] event {unknown} Hook payload forwarded from the wrapper.
|
|
1445
1618
|
- @param[in] ctx {ExtensionContext} Active extension context.
|
|
1446
1619
|
- @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
|
|
1447
1620
|
- @return {void} No return value.
|
|
1448
|
-
- @satisfies REQ-009, REQ-117, REQ-118, REQ-119, REQ-123, REQ-124, REQ-125, REQ-159, REQ-169, REQ-217, REQ-221, REQ-278, REQ-279, REQ-280
|
|
1621
|
+
- @satisfies REQ-009, REQ-117, REQ-118, REQ-119, REQ-123, REQ-124, REQ-125, REQ-159, REQ-169, REQ-217, REQ-221, REQ-278, REQ-279, REQ-280, REQ-285
|
|
1449
1622
|
|
|
1450
|
-
### fn `export function disposePiUsereqStatusController(` (
|
|
1623
|
+
### fn `export function disposePiUsereqStatusController(` (L875-880)
|
|
1451
1624
|
- @brief Disposes the pi-usereq status controller.
|
|
1452
1625
|
- @details Stops the live ticker, clears the cached context pointer, and leaves
|
|
1453
1626
|
the last captured status snapshot available for inspection until the
|
|
@@ -1459,49 +1632,52 @@ limited to interval disposal and in-memory state mutation.
|
|
|
1459
1632
|
## Symbol Index
|
|
1460
1633
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
1461
1634
|
|---|---|---|---|---|
|
|
1462
|
-
|`StatusForegroundColor`|type||
|
|
1463
|
-
|`RawStatusTheme`|iface||
|
|
1464
|
-
|`StatusThemeAdapter`|iface||
|
|
1465
|
-
|`PiUsereqStatusHookName`|type||
|
|
1466
|
-
|`PiUsereqPromptRequest`|type||
|
|
1467
|
-
|`PiUsereqWorkflowState`|type||
|
|
1468
|
-
|`PiUsereqStatusState`|iface||
|
|
1469
|
-
|`PiUsereqStatusController`|iface||
|
|
1470
|
-
|`PiUsereqStatusPersistenceStore`|iface||
|
|
1471
|
-
|`getPiUsereqStatusPersistenceStore`|fn||
|
|
1472
|
-
|`restorePersistedElapsedState`|fn||
|
|
1473
|
-
|`persistElapsedState`|fn||
|
|
1474
|
-
|`persistPromptCommandState`|fn||
|
|
1475
|
-
|`shouldPreservePromptCommandStateOnShutdown`|fn||
|
|
1476
|
-
|`restorePersistedPromptCommandState`|fn||
|
|
1477
|
-
|`getContextSessionFile`|fn||
|
|
1478
|
-
|`isStaleExtensionContextError`|fn||
|
|
1479
|
-
|`resetElapsedState`|fn||
|
|
1480
|
-
|`shouldResetElapsedStateOnSessionStart`|fn||
|
|
1481
|
-
|`shouldResetWorkflowStateOnSessionStart`|fn||
|
|
1482
|
-
|`createStatusThemeAdapter`|fn||
|
|
1483
|
-
|`colorize`|fn||
|
|
1484
|
-
|`resolveStatusBranchValue`|fn||
|
|
1485
|
-
|`normalizeContextUsage`|fn||
|
|
1486
|
-
|`refreshContextUsage`|fn||
|
|
1487
|
-
|`resolveContextUsageIconText`|fn||
|
|
1488
|
-
|`formatContextUsageBar`|fn||
|
|
1489
|
-
|`formatStatusDuration`|fn||
|
|
1490
|
-
|`formatCompletedStatusDuration`|fn||
|
|
1491
|
-
|`formatElapsedStatusValue`|fn||
|
|
1492
|
-
|`formatStatusField`|fn||
|
|
1493
|
-
|`formatRenderedStatusField`|fn||
|
|
1494
|
-
|`formatWorkflowStateValue`|fn||
|
|
1495
|
-
|`didAgentEndAbort`|fn||
|
|
1496
|
-
|`
|
|
1497
|
-
|`
|
|
1498
|
-
|`
|
|
1499
|
-
|`
|
|
1500
|
-
|`
|
|
1501
|
-
|`
|
|
1502
|
-
|`
|
|
1503
|
-
|`
|
|
1504
|
-
|`
|
|
1635
|
+
|`StatusForegroundColor`|type||31||
|
|
1636
|
+
|`RawStatusTheme`|iface||41-43|interface RawStatusTheme|
|
|
1637
|
+
|`StatusThemeAdapter`|iface||51-56|interface StatusThemeAdapter|
|
|
1638
|
+
|`PiUsereqStatusHookName`|type||99||
|
|
1639
|
+
|`PiUsereqPromptRequest`|type||105||
|
|
1640
|
+
|`PiUsereqWorkflowState`|type||111||
|
|
1641
|
+
|`PiUsereqStatusState`|iface||117-126|export interface PiUsereqStatusState|
|
|
1642
|
+
|`PiUsereqStatusController`|iface||135-140|export interface PiUsereqStatusController|
|
|
1643
|
+
|`PiUsereqStatusPersistenceStore`|iface||146-149|interface PiUsereqStatusPersistenceStore|
|
|
1644
|
+
|`getPiUsereqStatusPersistenceStore`|fn||163-172|function getPiUsereqStatusPersistenceStore(): PiUsereqSta...|
|
|
1645
|
+
|`restorePersistedElapsedState`|fn||180-184|function restorePersistedElapsedState(state: PiUsereqStat...|
|
|
1646
|
+
|`persistElapsedState`|fn||192-196|function persistElapsedState(state: PiUsereqStatusState):...|
|
|
1647
|
+
|`persistPromptCommandState`|fn||204-210|function persistPromptCommandState(state: PiUsereqStatusS...|
|
|
1648
|
+
|`shouldPreservePromptCommandStateOnShutdown`|fn||219-222|export function shouldPreservePromptCommandStateOnShutdow...|
|
|
1649
|
+
|`restorePersistedPromptCommandState`|fn||231-242|function restorePersistedPromptCommandState(|
|
|
1650
|
+
|`getContextSessionFile`|fn||250-254|function getContextSessionFile(ctx: ExtensionContext): st...|
|
|
1651
|
+
|`isStaleExtensionContextError`|fn||263-266|export function isStaleExtensionContextError(error: unkno...|
|
|
1652
|
+
|`resetElapsedState`|fn||275-279|function resetElapsedState(state: PiUsereqStatusState): void|
|
|
1653
|
+
|`shouldResetElapsedStateOnSessionStart`|fn||288-291|function shouldResetElapsedStateOnSessionStart(event: unk...|
|
|
1654
|
+
|`shouldResetWorkflowStateOnSessionStart`|fn||300-303|function shouldResetWorkflowStateOnSessionStart(event: un...|
|
|
1655
|
+
|`createStatusThemeAdapter`|fn||313-322|function createStatusThemeAdapter(theme: RawStatusTheme):...|
|
|
1656
|
+
|`colorize`|fn||314-321|const colorize = (color: StatusForegroundColor, text: str...|
|
|
1657
|
+
|`resolveStatusBranchValue`|fn||331-333|function resolveStatusBranchValue(ctx: ExtensionContext):...|
|
|
1658
|
+
|`normalizeContextUsage`|fn||344-361|function normalizeContextUsage(|
|
|
1659
|
+
|`refreshContextUsage`|fn||373-378|function refreshContextUsage(|
|
|
1660
|
+
|`resolveContextUsageIconText`|fn||387-404|function resolveContextUsageIconText(|
|
|
1661
|
+
|`formatContextUsageBar`|fn||414-426|function formatContextUsageBar(|
|
|
1662
|
+
|`formatStatusDuration`|fn||437-442|function formatStatusDuration(durationMs: number): string|
|
|
1663
|
+
|`formatCompletedStatusDuration`|fn||453-457|function formatCompletedStatusDuration(|
|
|
1664
|
+
|`formatElapsedStatusValue`|fn||470-480|function formatElapsedStatusValue(|
|
|
1665
|
+
|`formatStatusField`|fn||491-497|function formatStatusField(|
|
|
1666
|
+
|`formatRenderedStatusField`|fn||509-515|function formatRenderedStatusField(|
|
|
1667
|
+
|`formatWorkflowStateValue`|fn||525-533|function formatWorkflowStateValue(|
|
|
1668
|
+
|`didAgentEndAbort`|fn||544-551|function didAgentEndAbort(messages: AgentEndEvent["messag...|
|
|
1669
|
+
|`resolvePiUsereqRuntimeSoundLevel`|fn||561-566|function resolvePiUsereqRuntimeSoundLevel(|
|
|
1670
|
+
|`buildPiUsereqStatusText`|fn||579-603|function buildPiUsereqStatusText(|
|
|
1671
|
+
|`stopStatusTicker`|fn||613-618|function stopStatusTicker(controller: PiUsereqStatusContr...|
|
|
1672
|
+
|`syncPiUsereqStatusTicker`|fn||630-646|function syncPiUsereqStatusTicker(|
|
|
1673
|
+
|`createPiUsereqStatusController`|fn||654-670|export function createPiUsereqStatusController(): PiUsere...|
|
|
1674
|
+
|`setPiUsereqStatusConfig`|fn||683-688|export function setPiUsereqStatusConfig(|
|
|
1675
|
+
|`getPiUsereqRuntimeSoundLevel`|fn||697-701|export function getPiUsereqRuntimeSoundLevel(|
|
|
1676
|
+
|`setPiUsereqRuntimeSoundLevel`|fn||712-722|export function setPiUsereqRuntimeSoundLevel(|
|
|
1677
|
+
|`renderPiUsereqStatus`|fn||732-763|export function renderPiUsereqStatus(|
|
|
1678
|
+
|`setPiUsereqWorkflowState`|fn||774-785|export function setPiUsereqWorkflowState(|
|
|
1679
|
+
|`updateExtensionStatus`|fn||797-864|export function updateExtensionStatus(|
|
|
1680
|
+
|`disposePiUsereqStatusController`|fn||875-880|export function disposePiUsereqStatusController(|
|
|
1505
1681
|
|
|
1506
1682
|
|
|
1507
1683
|
---
|
|
@@ -1894,7 +2070,7 @@ import { SourceAnalyzer, formatMarkdown } from "./source-analyzer.js";
|
|
|
1894
2070
|
|
|
1895
2071
|
---
|
|
1896
2072
|
|
|
1897
|
-
# path-context.ts | TypeScript |
|
|
2073
|
+
# path-context.ts | TypeScript | 476L | 23 symbols | 5 imports | 28 comments
|
|
1898
2074
|
> Path: `src/core/path-context.ts`
|
|
1899
2075
|
- @brief Derives shared runtime path contracts for prompts, tools, and configuration flows.
|
|
1900
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.
|
|
@@ -1910,122 +2086,127 @@ import type { UseReqConfig } from "./config.js";
|
|
|
1910
2086
|
|
|
1911
2087
|
## Definitions
|
|
1912
2088
|
|
|
1913
|
-
### iface `export interface RuntimePathState` (
|
|
2089
|
+
### iface `export interface RuntimePathState` (L35-43)
|
|
1914
2090
|
- @brief Stores the mutable runtime path state shared across extension callbacks.
|
|
1915
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.
|
|
1916
2092
|
|
|
1917
|
-
### iface `export interface RuntimePathContext extends RuntimePathState` : RuntimePathState (
|
|
2093
|
+
### iface `export interface RuntimePathContext extends RuntimePathState` : RuntimePathState (L49-62)
|
|
1918
2094
|
- @brief Describes the absolute runtime path context shared across extension components.
|
|
1919
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.
|
|
1920
2096
|
|
|
1921
|
-
### iface `export interface RuntimePathFacts` (
|
|
2097
|
+
### iface `export interface RuntimePathFacts` (L68-89)
|
|
1922
2098
|
- @brief Describes the prompt/tool-facing runtime paths rendered for display.
|
|
1923
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.
|
|
1924
2100
|
|
|
1925
|
-
### fn `export function getInstallationPath(): string` (
|
|
2101
|
+
### fn `export function getInstallationPath(): string` (L104-106)
|
|
1926
2102
|
- @brief Resolves the installed extension root that owns `index.ts` and bundled resources.
|
|
1927
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.
|
|
1928
2104
|
- @return {string} Absolute installation path.
|
|
1929
2105
|
|
|
1930
|
-
### fn `export function normalizePathSlashes(value: string): string` (
|
|
2106
|
+
### fn `export function normalizePathSlashes(value: string): string` (L114-116)
|
|
1931
2107
|
- @brief Formats one path with slash separators.
|
|
1932
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.
|
|
1933
2109
|
- @param[in] value {string} Absolute or relative filesystem path.
|
|
1934
2110
|
- @return {string} Slash-normalized path string.
|
|
1935
2111
|
|
|
1936
|
-
### fn `function trimTrailingSeparatorsPreserveRoot(value: string): string` (
|
|
2112
|
+
### fn `function trimTrailingSeparatorsPreserveRoot(value: string): string` (L124-138)
|
|
1937
2113
|
- @brief Removes trailing separators while preserving a filesystem root.
|
|
1938
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.
|
|
1939
2115
|
- @param[in] value {string} Raw path string.
|
|
1940
2116
|
- @return {string} Trailing-slash-free path string.
|
|
1941
2117
|
|
|
1942
|
-
### fn `export function normalizeAbsolutePathContract(value: string): string` (
|
|
2118
|
+
### fn `export function normalizeAbsolutePathContract(value: string): string` (L146-148)
|
|
1943
2119
|
- @brief Normalizes one absolute path contract value.
|
|
1944
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.
|
|
1945
2121
|
- @param[in] value {string} Absolute or relative path candidate.
|
|
1946
2122
|
- @return {string} Canonical trailing-slash-free absolute path.
|
|
1947
2123
|
|
|
1948
|
-
### fn `export function normalizeRelativeDirContract(value: string): string` (
|
|
2124
|
+
### fn `export function normalizeRelativeDirContract(value: string): string` (L156-161)
|
|
1949
2125
|
- @brief Normalizes one relative-directory contract value.
|
|
1950
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.
|
|
1951
2127
|
- @param[in] value {string} Relative-directory candidate.
|
|
1952
2128
|
- @return {string} Canonical trailing-slash-free relative-directory string.
|
|
1953
2129
|
|
|
1954
|
-
### fn `export function getConfigPath(basePath: string): string` (
|
|
1955
|
-
- @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.
|
|
1956
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.
|
|
1957
2133
|
- @param[in] basePath {string} Absolute or relative base path.
|
|
1958
|
-
- @return {string} Absolute config-file path.
|
|
2134
|
+
- @return {string} Absolute local config-file path.
|
|
1959
2135
|
|
|
1960
|
-
### 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)
|
|
1961
2142
|
- @brief Tests whether one path is identical to or an ancestor of another path.
|
|
1962
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.
|
|
1963
2144
|
- @param[in] ancestorPath {string} Candidate ancestor or identical path.
|
|
1964
2145
|
- @param[in] childPath {string} Candidate child or identical path.
|
|
1965
2146
|
- @return {boolean} `true` when `ancestorPath` equals `childPath` or strictly contains it.
|
|
1966
2147
|
|
|
1967
|
-
### fn `function deriveStaticRuntimePathState(` (
|
|
2148
|
+
### fn `function deriveStaticRuntimePathState(` (L212-237)
|
|
1968
2149
|
- @brief Derives repository-relative runtime state from one base path and optional git path.
|
|
1969
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.
|
|
1970
2151
|
- @param[in] basePath {string} Static base path candidate.
|
|
1971
2152
|
- @param[in] gitPath {string | undefined} Optional repository-root candidate.
|
|
1972
2153
|
- @return {{ basePath: string; gitPath?: string; parentPath?: string; baseDir: string }} Derived static path facts.
|
|
1973
2154
|
|
|
1974
|
-
### fn `export function bootstrapRuntimePathState(` (
|
|
2155
|
+
### fn `export function bootstrapRuntimePathState(` (L246-248)
|
|
1975
2156
|
- @brief Bootstraps the shared runtime path state for one extension session or command preflight.
|
|
1976
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.
|
|
1977
2158
|
- @param[in] basePath {string} Bootstrap cwd that becomes the static base path.
|
|
1978
2159
|
- @param[in] options {{ gitPath?: string | undefined } | undefined} Optional repository-root override.
|
|
1979
2160
|
- @return {void} No return value.
|
|
1980
2161
|
|
|
1981
|
-
### fn `export function ensureRuntimePathState(cwd: string): void` (
|
|
2162
|
+
### fn `export function ensureRuntimePathState(cwd: string): void` (L266-272)
|
|
1982
2163
|
- @brief Ensures the shared runtime path state has at least fallback base and context values.
|
|
1983
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.
|
|
1984
2165
|
- @param[in] cwd {string} Fallback cwd.
|
|
1985
2166
|
- @return {void} No return value.
|
|
1986
2167
|
|
|
1987
|
-
### fn `export function getRuntimeBasePath(fallbackPath: string): string` (
|
|
2168
|
+
### fn `export function getRuntimeBasePath(fallbackPath: string): string` (L280-285)
|
|
1988
2169
|
- @brief Returns the current static base path.
|
|
1989
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.
|
|
1990
2171
|
- @param[in] fallbackPath {string} Fallback cwd.
|
|
1991
2172
|
- @return {string} Static base path.
|
|
1992
2173
|
|
|
1993
|
-
### fn `export function getRuntimeContextPath(fallbackPath: string): string` (
|
|
2174
|
+
### fn `export function getRuntimeContextPath(fallbackPath: string): string` (L293-298)
|
|
1994
2175
|
- @brief Returns the current dynamic context path.
|
|
1995
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.
|
|
1996
2177
|
- @param[in] fallbackPath {string} Fallback cwd.
|
|
1997
2178
|
- @return {string} Dynamic context path.
|
|
1998
2179
|
|
|
1999
|
-
### fn `export function setRuntimeGitPath(gitPath?: string): void` (
|
|
2180
|
+
### fn `export function setRuntimeGitPath(gitPath?: string): void` (L306-313)
|
|
2000
2181
|
- @brief Stores the derived git-root facts in the shared runtime path state.
|
|
2001
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.
|
|
2002
2183
|
- @param[in] gitPath {string | undefined} Optional repository-root path.
|
|
2003
2184
|
- @return {void} No return value.
|
|
2004
2185
|
|
|
2005
|
-
### fn `export function setRuntimeContextPath(contextPath: string): void` (
|
|
2186
|
+
### fn `export function setRuntimeContextPath(contextPath: string): void` (L321-323)
|
|
2006
2187
|
- @brief Stores the current dynamic context path.
|
|
2007
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.
|
|
2008
2189
|
- @param[in] contextPath {string} Next context path.
|
|
2009
2190
|
- @return {void} No return value.
|
|
2010
2191
|
|
|
2011
|
-
### fn `export function setRuntimeWorktreePathState(options:` (
|
|
2192
|
+
### fn `export function setRuntimeWorktreePathState(options:` (L331-341)
|
|
2012
2193
|
- @brief Stores the current worktree directory and path facts.
|
|
2013
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.
|
|
2014
2195
|
- @param[in] options {{ worktreeDir?: string | undefined; worktreePath?: string | undefined }} Optional active worktree facts.
|
|
2015
2196
|
- @return {void} No return value.
|
|
2016
2197
|
|
|
2017
|
-
### fn `export function getRuntimePathState(): RuntimePathState` (
|
|
2198
|
+
### fn `export function getRuntimePathState(): RuntimePathState` (L348-359)
|
|
2018
2199
|
- @brief Returns a snapshot of the shared runtime path state.
|
|
2019
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.
|
|
2020
2201
|
- @return {RuntimePathState} Snapshot of the current runtime path state.
|
|
2021
2202
|
|
|
2022
|
-
### fn `export function formatRuntimePathForDisplay(absolutePath: string): string` (
|
|
2203
|
+
### fn `export function formatRuntimePathForDisplay(absolutePath: string): string` (L367-380)
|
|
2023
2204
|
- @brief Formats one absolute path relative to the user home using `~` when possible.
|
|
2024
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.
|
|
2025
2206
|
- @param[in] absolutePath {string} Absolute or relative path candidate.
|
|
2026
2207
|
- @return {string} Home-relative or trailing-slash-free absolute path.
|
|
2027
2208
|
|
|
2028
|
-
### fn `export function buildRuntimePathContext(` (
|
|
2209
|
+
### fn `export function buildRuntimePathContext(` (L391-400)
|
|
2029
2210
|
- @brief Builds the absolute runtime path context for one base path, context path, and configuration.
|
|
2030
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.
|
|
2031
2212
|
- @param[in] basePath {string} Static base path.
|
|
@@ -2034,7 +2215,7 @@ import type { UseReqConfig } from "./config.js";
|
|
|
2034
2215
|
- @param[in] options {{ installationPath?: string; gitPath?: string | undefined; worktreeDir?: string | undefined; worktreePath?: string | undefined } | undefined} Optional installation, repository, and worktree overrides.
|
|
2035
2216
|
- @return {RuntimePathContext} Absolute runtime path context.
|
|
2036
2217
|
|
|
2037
|
-
### fn `export function buildRuntimePathFacts(` (
|
|
2218
|
+
### fn `export function buildRuntimePathFacts(` (L451-476)
|
|
2038
2219
|
- @brief Converts the absolute runtime path context into prompt/tool-facing path facts.
|
|
2039
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.
|
|
2040
2221
|
- @param[in] context {RuntimePathContext} Absolute runtime path context.
|
|
@@ -2043,28 +2224,29 @@ import type { UseReqConfig } from "./config.js";
|
|
|
2043
2224
|
## Symbol Index
|
|
2044
2225
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
2045
2226
|
|---|---|---|---|---|
|
|
2046
|
-
|`RuntimePathState`|iface||
|
|
2047
|
-
|`RuntimePathContext`|iface||
|
|
2048
|
-
|`RuntimePathFacts`|iface||
|
|
2049
|
-
|`getInstallationPath`|fn||
|
|
2050
|
-
|`normalizePathSlashes`|fn||
|
|
2051
|
-
|`trimTrailingSeparatorsPreserveRoot`|fn||
|
|
2052
|
-
|`normalizeAbsolutePathContract`|fn||
|
|
2053
|
-
|`normalizeRelativeDirContract`|fn||
|
|
2054
|
-
|`getConfigPath`|fn||
|
|
2055
|
-
|`
|
|
2056
|
-
|`
|
|
2057
|
-
|`
|
|
2058
|
-
|`
|
|
2059
|
-
|`
|
|
2060
|
-
|`
|
|
2061
|
-
|`
|
|
2062
|
-
|`
|
|
2063
|
-
|`
|
|
2064
|
-
|`
|
|
2065
|
-
|`
|
|
2066
|
-
|`
|
|
2067
|
-
|`
|
|
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(|
|
|
2068
2250
|
|
|
2069
2251
|
|
|
2070
2252
|
---
|
|
@@ -2102,7 +2284,7 @@ import type { UseReqConfig } from "./config.js";
|
|
|
2102
2284
|
|
|
2103
2285
|
- type `export type PiNotifyConfigFields = Pick<` (L115)
|
|
2104
2286
|
- @brief Describes the configuration fields consumed by pi-notify helpers.
|
|
2105
|
-
- @details Narrows the full project config to the
|
|
2287
|
+
- @details Narrows the full project config to the notify, sound, and Pushover fields used by status rendering and prompt-end routing. Callers may override `notify-sound` with the active runtime sound level before dispatch. Compile-time only and introduces no runtime cost.
|
|
2106
2288
|
- type `type PiNotifySpawn = typeof spawn;` (L145)
|
|
2107
2289
|
- @brief Describes the shell-spawn callback used by prompt-end command dispatch.
|
|
2108
2290
|
- @details Narrows the injected spawn surface so deterministic tests can capture detached shell invocations without patching global module state externally. Compile-time only and introduces no runtime cost.
|
|
@@ -2187,10 +2369,10 @@ import type { UseReqConfig } from "./config.js";
|
|
|
2187
2369
|
|
|
2188
2370
|
### fn `export function cyclePiNotifySoundLevel(currentLevel: PiNotifySoundLevel): PiNotifySoundLevel` (L371-377)
|
|
2189
2371
|
- @brief Cycles one sound level through the canonical shortcut order.
|
|
2190
|
-
- @details Advances
|
|
2191
|
-
- @param[in] currentLevel {PiNotifySoundLevel} Current
|
|
2192
|
-
- @return {PiNotifySoundLevel} Next sound level in the cycle.
|
|
2193
|
-
- @satisfies REQ-
|
|
2372
|
+
- @details Advances the active runtime sound state in the exact order `none -> low -> mid -> high -> none`, enabling deterministic shortcut toggling without mutating persisted boot configuration. Runtime is O(1). No external state is mutated.
|
|
2373
|
+
- @param[in] currentLevel {PiNotifySoundLevel} Current active runtime sound level.
|
|
2374
|
+
- @return {PiNotifySoundLevel} Next runtime sound level in the cycle.
|
|
2375
|
+
- @satisfies REQ-286
|
|
2194
2376
|
|
|
2195
2377
|
### fn `function isPiNotifyOutcomeEnabled(` (L388-402)
|
|
2196
2378
|
- @brief Tests whether one outcome-specific toggle is enabled.
|
|
@@ -2445,29 +2627,29 @@ import type { UseReqConfig } from "./config.js";
|
|
|
2445
2627
|
|
|
2446
2628
|
---
|
|
2447
2629
|
|
|
2448
|
-
# pi-usereq-tools.ts | TypeScript |
|
|
2630
|
+
# pi-usereq-tools.ts | TypeScript | 180L | 7 symbols | 0 imports | 17 comments
|
|
2449
2631
|
> Path: `src/core/pi-usereq-tools.ts`
|
|
2450
2632
|
- @brief Declares the configurable pi-usereq active-tool inventory.
|
|
2451
2633
|
- @details Provides canonical custom-tool names, supported embedded-tool names, default enablement subsets, and normalization helpers shared by configuration loading, extension startup, and test doubles. The module is side-effect free. Lookup and normalization costs are linear in configured tool count.
|
|
2452
2634
|
|
|
2453
2635
|
## Definitions
|
|
2454
2636
|
|
|
2455
|
-
- type `export type PiUsereqCustomToolName = (typeof PI_USEREQ_CUSTOM_TOOL_NAMES)[number];` (
|
|
2637
|
+
- type `export type PiUsereqCustomToolName = (typeof PI_USEREQ_CUSTOM_TOOL_NAMES)[number];` (L81)
|
|
2456
2638
|
- @brief Represents one valid extension-owned configurable tool identifier.
|
|
2457
2639
|
- @details Narrows arbitrary strings to the literal union derived from `PI_USEREQ_CUSTOM_TOOL_NAMES`. The alias is compile-time only and introduces no runtime cost.
|
|
2458
|
-
- type `export type PiUsereqEmbeddedToolName = (typeof PI_USEREQ_EMBEDDED_TOOL_NAMES)[number];` (
|
|
2640
|
+
- type `export type PiUsereqEmbeddedToolName = (typeof PI_USEREQ_EMBEDDED_TOOL_NAMES)[number];` (L87)
|
|
2459
2641
|
- @brief Represents one valid embedded configurable tool identifier.
|
|
2460
2642
|
- @details Narrows arbitrary strings to the literal union derived from `PI_USEREQ_EMBEDDED_TOOL_NAMES`. The alias is compile-time only and introduces no runtime cost.
|
|
2461
|
-
- type `export type PiUsereqStartupToolName = (typeof PI_USEREQ_STARTUP_TOOL_NAMES)[number];` (
|
|
2643
|
+
- type `export type PiUsereqStartupToolName = (typeof PI_USEREQ_STARTUP_TOOL_NAMES)[number];` (L93)
|
|
2462
2644
|
- @brief Represents one valid configurable active-tool identifier.
|
|
2463
2645
|
- @details Narrows arbitrary strings to the literal union derived from `PI_USEREQ_STARTUP_TOOL_NAMES`. The alias is compile-time only and introduces no runtime cost.
|
|
2464
|
-
### fn `export function isPiUsereqEmbeddedToolName(name: string): name is PiUsereqEmbeddedToolName` (
|
|
2646
|
+
### fn `export function isPiUsereqEmbeddedToolName(name: string): name is PiUsereqEmbeddedToolName` (L119-121)
|
|
2465
2647
|
- @brief Tests whether one tool name belongs to the supported embedded-tool subset.
|
|
2466
2648
|
- @details Performs one set-membership probe against `PI_USEREQ_EMBEDDED_TOOL_SET`. Runtime is O(1). No external state is mutated.
|
|
2467
2649
|
- @param[in] name {string} Candidate tool name.
|
|
2468
2650
|
- @return {boolean} `true` when the name belongs to the embedded configurable-tool subset.
|
|
2469
2651
|
|
|
2470
|
-
### fn `export function normalizeEnabledPiUsereqTools(value: unknown): PiUsereqStartupToolName[]` (
|
|
2652
|
+
### fn `export function normalizeEnabledPiUsereqTools(value: unknown): PiUsereqStartupToolName[]` (L131-138)
|
|
2471
2653
|
- @brief Normalizes a user-configured active-tool list.
|
|
2472
2654
|
- @details Returns the default enabled-tool tuple when the input is not an array. Otherwise filters to string entries, removes names outside the configurable tool set, and deduplicates while preserving first-seen order. Time complexity is O(n). No external state is mutated.
|
|
2473
2655
|
- @param[in] value {unknown} Raw configuration payload for `enabled-tools`.
|
|
@@ -2475,14 +2657,14 @@ import type { UseReqConfig } from "./config.js";
|
|
|
2475
2657
|
- @satisfies REQ-064
|
|
2476
2658
|
- @post Returned values are members of `PI_USEREQ_STARTUP_TOOL_NAMES` only.
|
|
2477
2659
|
|
|
2478
|
-
### fn `function buildPiUsereqStartupToolSortKey(` (
|
|
2660
|
+
### fn `function buildPiUsereqStartupToolSortKey(` (L147-155)
|
|
2479
2661
|
- @brief Builds the menu-order partition key for one configurable tool name.
|
|
2480
2662
|
- @details Encodes the documented `Enable tools` ordering by grouping custom tools before embedded tools, placing non-`files-*` custom tools before `files-*` custom tools, and moving default-disabled names to the tail of each resolved partition. Runtime is O(1). No external state is mutated.
|
|
2481
2663
|
- @param[in] name {PiUsereqStartupToolName} Canonical configurable tool name.
|
|
2482
2664
|
- @return {[number, number, number, string]} Stable tuple `{group, subgroup, default_state, name}` used for lexicographic ordering.
|
|
2483
2665
|
- @satisfies REQ-007, REQ-231, REQ-232
|
|
2484
2666
|
|
|
2485
|
-
### fn `export function comparePiUsereqStartupToolNames(` (
|
|
2667
|
+
### fn `export function comparePiUsereqStartupToolNames(` (L165-180)
|
|
2486
2668
|
- @brief Compares two configurable tool names using the documented menu order.
|
|
2487
2669
|
- @details Applies the partition key emitted by `buildPiUsereqStartupToolSortKey(...)` and falls back to lexical comparison inside the final key slot so the `Enable tools` submenu stays deterministic across runtimes. Runtime is O(1). No external state is mutated.
|
|
2488
2670
|
- @param[in] left {PiUsereqStartupToolName} Left configurable tool name.
|
|
@@ -2493,28 +2675,28 @@ import type { UseReqConfig } from "./config.js";
|
|
|
2493
2675
|
## Symbol Index
|
|
2494
2676
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
2495
2677
|
|---|---|---|---|---|
|
|
2496
|
-
|`PiUsereqCustomToolName`|type||
|
|
2497
|
-
|`PiUsereqEmbeddedToolName`|type||
|
|
2498
|
-
|`PiUsereqStartupToolName`|type||
|
|
2499
|
-
|`isPiUsereqEmbeddedToolName`|fn||
|
|
2500
|
-
|`normalizeEnabledPiUsereqTools`|fn||
|
|
2501
|
-
|`buildPiUsereqStartupToolSortKey`|fn||
|
|
2502
|
-
|`comparePiUsereqStartupToolNames`|fn||
|
|
2678
|
+
|`PiUsereqCustomToolName`|type||81||
|
|
2679
|
+
|`PiUsereqEmbeddedToolName`|type||87||
|
|
2680
|
+
|`PiUsereqStartupToolName`|type||93||
|
|
2681
|
+
|`isPiUsereqEmbeddedToolName`|fn||119-121|export function isPiUsereqEmbeddedToolName(name: string):...|
|
|
2682
|
+
|`normalizeEnabledPiUsereqTools`|fn||131-138|export function normalizeEnabledPiUsereqTools(value: unkn...|
|
|
2683
|
+
|`buildPiUsereqStartupToolSortKey`|fn||147-155|function buildPiUsereqStartupToolSortKey(|
|
|
2684
|
+
|`comparePiUsereqStartupToolNames`|fn||165-180|export function comparePiUsereqStartupToolNames(|
|
|
2503
2685
|
|
|
2504
2686
|
|
|
2505
2687
|
---
|
|
2506
2688
|
|
|
2507
|
-
# prompt-command-catalog.ts | TypeScript |
|
|
2689
|
+
# prompt-command-catalog.ts | TypeScript | 45L | 2 symbols | 0 imports | 4 comments
|
|
2508
2690
|
> Path: `src/core/prompt-command-catalog.ts`
|
|
2509
|
-
- @brief Declares the canonical bundled `req-*`
|
|
2510
|
-
- @details Centralizes prompt-command names shared by extension registration, configuration normalization, debug-menu rendering, and prompt-runtime orchestration. The module is side-effect free. Lookup cost is O(1) per exported constant access.
|
|
2691
|
+
- @brief Declares the canonical bundled prompt-backed `req-*` command inventory.
|
|
2692
|
+
- @details Centralizes only prompt-template-backed command names shared by extension registration, configuration normalization, debug-menu rendering, and prompt-runtime orchestration. Specialized slash commands such as `req-references` and `req-reset` are registered outside this inventory. The module is side-effect free. Lookup cost is O(1) per exported constant access.
|
|
2511
2693
|
|
|
2512
2694
|
## Definitions
|
|
2513
2695
|
|
|
2514
|
-
- type `export type PromptCommandName = (typeof PROMPT_COMMAND_NAMES)[number];` (
|
|
2696
|
+
- type `export type PromptCommandName = (typeof PROMPT_COMMAND_NAMES)[number];` (L33)
|
|
2515
2697
|
- @brief Narrows prompt-command identifiers to the bundled command set.
|
|
2516
2698
|
- @details Compile-time alias reused by orchestration helpers, debug inventory normalization, and command registration. The alias introduces no runtime cost.
|
|
2517
|
-
### fn `export function formatPromptCommandName(` (
|
|
2699
|
+
### fn `export function formatPromptCommandName(` (L41-45)
|
|
2518
2700
|
- @brief Formats one bundled prompt-command identifier as its slash-command name.
|
|
2519
2701
|
- @details Prefixes the canonical prompt name with `req-` so debug menus and log filters can use the invokable slash-command form without duplicating the underlying inventory. Runtime is O(n) in prompt-name length. No external state is mutated.
|
|
2520
2702
|
- @param[in] promptName {PromptCommandName} Canonical bundled prompt name.
|
|
@@ -2523,16 +2705,16 @@ import type { UseReqConfig } from "./config.js";
|
|
|
2523
2705
|
## Symbol Index
|
|
2524
2706
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
2525
2707
|
|---|---|---|---|---|
|
|
2526
|
-
|`PromptCommandName`|type||
|
|
2527
|
-
|`formatPromptCommandName`|fn||
|
|
2708
|
+
|`PromptCommandName`|type||33||
|
|
2709
|
+
|`formatPromptCommandName`|fn||41-45|export function formatPromptCommandName(|
|
|
2528
2710
|
|
|
2529
2711
|
|
|
2530
2712
|
---
|
|
2531
2713
|
|
|
2532
|
-
# prompt-command-runtime.ts | TypeScript |
|
|
2714
|
+
# prompt-command-runtime.ts | TypeScript | 1955L | 56 symbols | 12 imports | 60 comments
|
|
2533
2715
|
> Path: `src/core/prompt-command-runtime.ts`
|
|
2534
|
-
- @brief Implements prompt-command preflight and worktree orchestration.
|
|
2535
|
-
- @details Centralizes `req-<prompt>` repository validation, prompt-specific required-document checks, slash-command-owned worktree naming and lifecycle handling,
|
|
2716
|
+
- @brief Implements bundled prompt-command preflight and worktree orchestration.
|
|
2717
|
+
- @details Centralizes prompt-template-backed `req-<prompt>` repository validation, prompt-specific required-document checks, slash-command-owned worktree naming and lifecycle handling, reusable transcript-preservation plus session-restoration helpers, persisted replacement-session context reuse for non-command lifecycle handlers, matched-success stash-assisted fast-forward merge finalization, and command-side abort cleanup. Runtime is dominated by git subprocess execution plus bounded filesystem and session-file metadata checks. Side effects include active-session replacement, worktree creation and deletion, branch merges, stash-stack mutation, and filesystem reads and writes.
|
|
2536
2718
|
|
|
2537
2719
|
## Imports
|
|
2538
2720
|
```
|
|
@@ -2543,7 +2725,7 @@ import { ReqError } from "./errors.js";
|
|
|
2543
2725
|
import { classifyPiNotifyOutcome, type PiNotifyOutcome } from "./pi-notify.js";
|
|
2544
2726
|
import {
|
|
2545
2727
|
import {
|
|
2546
|
-
import {
|
|
2728
|
+
import { type PromptCommandName } from "./prompt-command-catalog.js";
|
|
2547
2729
|
import {
|
|
2548
2730
|
import { SessionManager } from "@mariozechner/pi-coding-agent";
|
|
2549
2731
|
import { resolveRuntimeGitPath } from "./runtime-project-paths.js";
|
|
@@ -2552,57 +2734,57 @@ import {
|
|
|
2552
2734
|
|
|
2553
2735
|
## Definitions
|
|
2554
2736
|
|
|
2555
|
-
### iface `export interface PromptRequiredDocSpec` (
|
|
2737
|
+
### iface `export interface PromptRequiredDocSpec` (L42-45)
|
|
2556
2738
|
- @brief Describes one canonical required-document probe.
|
|
2557
2739
|
- @details Binds a canonical doc filename to the remediation prompt command surfaced on failure so prompt-specific doc validation can stay deterministic. The interface is compile-time only and introduces no runtime cost.
|
|
2558
2740
|
|
|
2559
|
-
### iface `export interface PromptCommandExecutionPlan` (
|
|
2741
|
+
### iface `export interface PromptCommandExecutionPlan` (L51-65)
|
|
2560
2742
|
- @brief Describes one prompt-command execution plan tracked across lifecycle hooks.
|
|
2561
2743
|
- @details Stores the prompt identity, runtime git root, associated branch name, original project base, execution context path, persisted origin and execution session files, and optional worktree metadata so the extension can switch all cwd surfaces before prompt dispatch and finalize worktree lifecycle after agent end. The interface is compile-time only and introduces no runtime cost.
|
|
2562
2744
|
|
|
2563
|
-
### iface `interface PromptCommandPostCreateHookContext` (
|
|
2745
|
+
### iface `interface PromptCommandPostCreateHookContext` (L71-76)
|
|
2564
2746
|
- @brief Describes one post-create test hook payload for prompt-command worktrees.
|
|
2565
2747
|
- @details Exposes the git root, generated worktree name, sibling worktree path, and effective execution base so tests can simulate post-create verification failures deterministically. The interface is compile-time only and introduces no runtime cost.
|
|
2566
2748
|
|
|
2567
|
-
- type `type PromptCommandPostCreateHook = (context: PromptCommandPostCreateHookContext) => void;` (
|
|
2749
|
+
- type `type PromptCommandPostCreateHook = (context: PromptCommandPostCreateHookContext) => void;` (L82)
|
|
2568
2750
|
- @brief Represents one synchronous test hook invoked after prompt worktree creation.
|
|
2569
2751
|
- @details Allows tests to mutate or remove newly created worktree artifacts before verification executes. The alias is compile-time only and introduces no runtime cost.
|
|
2570
|
-
### iface `interface PromptCommandDebugOptions` (
|
|
2752
|
+
### iface `interface PromptCommandDebugOptions` (L88-91)
|
|
2571
2753
|
- @brief Describes optional debug logging context for prompt orchestration helpers.
|
|
2572
2754
|
- @details Carries the effective project configuration and current workflow state so prompt-runtime helpers can append selected debug entries without depending on extension UI types. The interface is compile-time only and introduces no runtime cost.
|
|
2573
2755
|
|
|
2574
|
-
### iface `interface PromptCommandSessionMessageOptions` (
|
|
2756
|
+
### iface `interface PromptCommandSessionMessageOptions` (L97-99)
|
|
2575
2757
|
- @brief Describes prompt-delivery options supported by replacement-session callbacks.
|
|
2576
2758
|
- @details Mirrors the documented `sendUserMessage(...)` delivery modes needed when prompt orchestration targets a replacement session after a slash-command-owned session switch. The interface is compile-time only and introduces no runtime cost.
|
|
2577
2759
|
|
|
2578
|
-
### iface `interface PromptCommandSessionSwitchOptions` (
|
|
2760
|
+
### iface `interface PromptCommandSessionSwitchOptions` (L105-107)
|
|
2579
2761
|
- @brief Describes the replacement-session callback options accepted by session switching.
|
|
2580
2762
|
- @details Mirrors the documented pi runtime `withSession(...)` hook so prompt-command orchestration can continue work against the replacement session after the old command context becomes stale. The interface is compile-time only and introduces no runtime cost.
|
|
2581
2763
|
|
|
2582
|
-
### iface `interface PromptCommandActiveContext extends PromptCommandSessionContext` : PromptCommandSessionContext (
|
|
2764
|
+
### iface `interface PromptCommandActiveContext extends PromptCommandSessionContext` : PromptCommandSessionContext (L113-118)
|
|
2583
2765
|
- @brief Describes the minimal session-bound surface available after session replacement.
|
|
2584
2766
|
- @details Extends the shared prompt-command context with `sendUserMessage(...)` so prompt dispatch can target the replacement session without reusing stale pre-switch runtime objects. The interface is compile-time only and introduces no runtime cost.
|
|
2585
2767
|
|
|
2586
|
-
### iface `interface PromptCommandSessionEntry` (
|
|
2768
|
+
### iface `interface PromptCommandSessionEntry` (L124-130)
|
|
2587
2769
|
- @brief Describes one serializable session entry copied into a materialized execution-session file.
|
|
2588
2770
|
- @details Captures the stable tree-entry fields needed to write a JSONL session snapshot for cross-cwd session replacement when the origin session file has not been flushed yet. The interface is compile-time only and introduces no runtime cost.
|
|
2589
2771
|
|
|
2590
|
-
### iface `interface PromptCommandSessionContext` (
|
|
2772
|
+
### iface `interface PromptCommandSessionContext` (L136-148)
|
|
2591
2773
|
- @brief Describes the minimal command-context session surface used by prompt orchestration.
|
|
2592
2774
|
- @details Narrows extension command contexts to the `switchSession(...)` hook, the mutable `cwd` mirror, and the session metadata probes required for cwd verification and session snapshot materialization. The interface is compile-time only and introduces no runtime cost.
|
|
2593
2775
|
|
|
2594
|
-
### iface `interface PromptCommandContextError extends Error` : Error (
|
|
2776
|
+
### iface `interface PromptCommandContextError extends Error` : Error (L154-156)
|
|
2595
2777
|
- @brief Describes one error object enriched with a replacement-session context.
|
|
2596
2778
|
- @details Allows prompt orchestration helpers to preserve the last valid session-bound context across replacement boundaries so callers can continue notifications and status updates after switch-triggered failures. The interface is compile-time only and introduces no runtime cost.
|
|
2597
2779
|
|
|
2598
|
-
### fn `function isUsablePromptSessionFile(` (
|
|
2780
|
+
### fn `function isUsablePromptSessionFile(` (L171-189)
|
|
2599
2781
|
- @brief Tests whether the current session file remains reusable for prompt-command bootstrap.
|
|
2600
2782
|
- @details Accepts only persisted session files whose header cwd is readable, still exists on disk, and remains inside the active project base. This rejects stale execution-session files that still point at deleted or sibling worktrees from earlier prompt runs. Runtime is O(p) plus one session-header read. No external state is mutated.
|
|
2601
2783
|
- @param[in] sessionFile {string | undefined} Candidate current session file.
|
|
2602
2784
|
- @param[in] projectBase {string} Active project base path.
|
|
2603
2785
|
- @return {sessionFile is string} `true` when the session file remains reusable for prompt bootstrap.
|
|
2604
2786
|
|
|
2605
|
-
### fn `function resolvePromptSessionFile(sessionFile: string | undefined, cwd: string): string` (
|
|
2787
|
+
### fn `function resolvePromptSessionFile(sessionFile: string | undefined, cwd: string): string` (L199-209)
|
|
2606
2788
|
- @brief Resolves the session file path used as the origin for prompt-command session switching.
|
|
2607
2789
|
- @details Reuses the current session file only when its persisted header cwd is still readable, exists on disk, and remains inside the active project base. Otherwise allocates a fresh session file path rooted at the supplied cwd so later worktree switching and restoration never inherit stale deleted-worktree session metadata. Runtime is dominated by one optional session-header read plus optional session-file allocation. Side effects include session-file path allocation when the active session metadata is stale or ephemeral.
|
|
2608
2790
|
- @param[in] sessionFile {string | undefined} Current active session file when available.
|
|
@@ -2610,7 +2792,7 @@ import {
|
|
|
2610
2792
|
- @return {string} Session file path reserved for prompt orchestration.
|
|
2611
2793
|
- @throws {ReqError} Throws when a session file path cannot be resolved.
|
|
2612
2794
|
|
|
2613
|
-
### fn `function writePromptExecutionSessionSnapshot(` (
|
|
2795
|
+
### fn `function writePromptExecutionSessionSnapshot(` (L223-249)
|
|
2614
2796
|
- @brief Writes one execution-session snapshot file with the target worktree cwd.
|
|
2615
2797
|
- @details Persists a version-3 JSONL session header whose `cwd` equals the supplied target worktree path, then appends the supplied current-session branch entries unchanged so pi can reopen the replacement session in the correct cwd even when the origin session file has not been flushed yet. Runtime is O(n) in branch-entry count plus serialized byte size. Side effects include directory creation and file overwrite.
|
|
2616
2798
|
- @param[in] sessionFile {string} Target execution-session file path.
|
|
@@ -2622,7 +2804,7 @@ import {
|
|
|
2622
2804
|
- @throws {ReqError} Throws when the execution-session snapshot cannot be written.
|
|
2623
2805
|
- @satisfies REQ-271
|
|
2624
2806
|
|
|
2625
|
-
### fn `function createPromptExecutionSessionFile(` (
|
|
2807
|
+
### fn `function createPromptExecutionSessionFile(` (L262-285)
|
|
2626
2808
|
- @brief Creates the persisted session file used for worktree-backed prompt execution.
|
|
2627
2809
|
- @details Forks the resolved origin session into the target cwd when the origin session file is already persisted. Otherwise allocates a new execution-session path, materializes a JSONL header whose `cwd` equals the target worktree path, and copies the current in-memory session branch so pi can switch into the worktree session with the correct runtime cwd. Runtime is dominated by session-file copy or snapshot-write cost. Side effects include session-file creation under the target cwd session directory.
|
|
2628
2810
|
- @param[in] sourceSessionFile {string} Origin session file path.
|
|
@@ -2633,25 +2815,25 @@ import {
|
|
|
2633
2815
|
- @throws {ReqError} Throws when the execution-session file cannot be created.
|
|
2634
2816
|
- @satisfies REQ-271
|
|
2635
2817
|
|
|
2636
|
-
### fn `function getPromptSessionCwd(ctx?: PromptCommandSessionContext): string | undefined` (
|
|
2818
|
+
### fn `function getPromptSessionCwd(ctx?: PromptCommandSessionContext): string | undefined` (L293-301)
|
|
2637
2819
|
- @brief Reads the current active session cwd from a prompt-command context.
|
|
2638
2820
|
- @details Returns the session-manager cwd only when the supplied context exposes the documented `getCwd()` probe and the probe remains valid after any prior session replacement. Stale or missing probes degrade to `undefined` so verification paths never reuse invalidated pre-switch session objects. Runtime is O(1). No external state is mutated.
|
|
2639
2821
|
- @param[in] ctx {PromptCommandSessionContext | undefined} Candidate prompt-command context.
|
|
2640
2822
|
- @return {string | undefined} Active session cwd when available.
|
|
2641
2823
|
|
|
2642
|
-
### fn `function getPromptSessionFile(ctx?: PromptCommandSessionContext): string | undefined` (
|
|
2824
|
+
### fn `function getPromptSessionFile(ctx?: PromptCommandSessionContext): string | undefined` (L309-317)
|
|
2643
2825
|
- @brief Reads the current active session file from a prompt-command context.
|
|
2644
2826
|
- @details Returns the session-manager file path only when the supplied context exposes the documented `getSessionFile()` probe and the probe remains valid after any prior session replacement. Stale or missing probes degrade to `undefined` so verification paths never reuse invalidated pre-switch session objects. Runtime is O(1). No external state is mutated.
|
|
2645
2827
|
- @param[in] ctx {PromptCommandSessionContext | undefined} Candidate prompt-command context.
|
|
2646
2828
|
- @return {string | undefined} Active session file when available.
|
|
2647
2829
|
|
|
2648
|
-
### fn `function getPromptContextCwd(ctx?: PromptCommandSessionContext): string | undefined` (
|
|
2830
|
+
### fn `function getPromptContextCwd(ctx?: PromptCommandSessionContext): string | undefined` (L325-331)
|
|
2649
2831
|
- @brief Reads the current context cwd from a prompt-command context.
|
|
2650
2832
|
- @details Returns the context `cwd` only when the supplied getter remains valid after any prior session replacement. Stale getters degrade to `undefined` so verification paths never depend on invalidated pre-switch command objects. Runtime is O(1). No external state is mutated.
|
|
2651
2833
|
- @param[in] ctx {PromptCommandSessionContext | undefined} Candidate prompt-command context.
|
|
2652
2834
|
- @return {string | undefined} Context cwd when available.
|
|
2653
2835
|
|
|
2654
|
-
### fn `function resolvePromptCommandSwitchContext(` (
|
|
2836
|
+
### fn `function resolvePromptCommandSwitchContext(` (L341-356)
|
|
2655
2837
|
- @brief Resolves the best available command-capable context for prompt session switching.
|
|
2656
2838
|
- @details Prefers the caller-supplied context when it still exposes `switchSession(...)`, otherwise falls back to the persisted replacement-session context associated with the execution-session file so lifecycle handlers can complete closure when pi emits non-command event contexts. Runtime is O(1). No external state is mutated.
|
|
2657
2839
|
- @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan whose execution-session file keys the persisted context.
|
|
@@ -2659,7 +2841,7 @@ import {
|
|
|
2659
2841
|
- @return {{ context: PromptCommandSessionContext | undefined; source: "provided" | "persisted" | "missing" }} Preferred switch context plus its provenance.
|
|
2660
2842
|
- @satisfies REQ-272, REQ-276
|
|
2661
2843
|
|
|
2662
|
-
### fn `function syncPromptCommandProcessCwd(expectedPath: string, stageLabel: string): void` (
|
|
2844
|
+
### fn `function syncPromptCommandProcessCwd(expectedPath: string, stageLabel: string): void` (L367-387)
|
|
2663
2845
|
- @brief Aligns the host process cwd to one expected prompt-orchestration path.
|
|
2664
2846
|
- @details Applies `process.chdir(...)` only when the host process is still anchored to a different directory than the active prompt session, then re-reads `process.cwd()` and throws a deterministic error when the mutation fails or does not take effect. Runtime is O(p) in path length plus one optional cwd mutation. Side effect: mutates the host process cwd.
|
|
2665
2847
|
- @param[in] expectedPath {string} Path that `process.cwd()` must match.
|
|
@@ -2668,28 +2850,28 @@ import {
|
|
|
2668
2850
|
- @throws {ReqError} Throws when `process.chdir(...)` fails or leaves `process.cwd()` misaligned.
|
|
2669
2851
|
- @satisfies REQ-257, REQ-272
|
|
2670
2852
|
|
|
2671
|
-
### fn `function readPromptSessionFileCwd(sessionFile: string): string | undefined` (
|
|
2853
|
+
### fn `function readPromptSessionFileCwd(sessionFile: string): string | undefined` (L395-419)
|
|
2672
2854
|
- @brief Reads the persisted working directory recorded in one prompt-command session file header.
|
|
2673
2855
|
- @details Opens the JSONL session file, parses the first non-empty line as JSON, and returns the `cwd` field when present as a string so session-target verification can rely on live on-disk session state instead of stale handler-scoped `ctx` references. Runtime is O(n) in header size. No external state is mutated.
|
|
2674
2856
|
- @param[in] sessionFile {string} Absolute session-file path.
|
|
2675
2857
|
- @return {string | undefined} Persisted session cwd when readable; otherwise undefined.
|
|
2676
2858
|
|
|
2677
|
-
### fn `function readPromptSessionJsonLines(` (
|
|
2859
|
+
### fn `function readPromptSessionJsonLines(` (L428-475)
|
|
2678
2860
|
- @brief Reads one persisted session file as ordered parsed JSONL records.
|
|
2679
2861
|
- @details Loads the raw session file, preserves every non-empty serialized line verbatim, parses each line as one JSON object, and rejects unreadable or structurally invalid files so prompt-closure helpers can replay exact execution-session transcript records into the restored base session without reserialization drift. Runtime is O(n) in session-file size. No external state is mutated.
|
|
2680
2862
|
- @param[in] sessionFile {string} Absolute session-file path.
|
|
2681
2863
|
- @return {Array<{ rawLine: string; parsed: Record<string, unknown> }>} Parsed non-empty JSONL lines in file order.
|
|
2682
2864
|
- @throws {ReqError} Throws when the file cannot be read, when it contains no JSONL records, when any record is not a JSON object, or when the header record is missing.
|
|
2683
2865
|
|
|
2684
|
-
### fn `function preservePromptCommandExecutionTranscript(plan: PromptCommandExecutionPlan): void` (
|
|
2866
|
+
### fn `export function preservePromptCommandExecutionTranscript(plan: PromptCommandExecutionPlan): void` (L485-582)
|
|
2685
2867
|
- @brief Copies successful execution-session transcript records into the restored base session file.
|
|
2686
2868
|
- @details Reads the execution session JSONL file, preserves the original base-session header when it already exists, materializes a restored base-session header when the reserved original session file is still pending persistence, appends any execution-session records missing from the original session in original execution order, and re-reads the restored file to verify both `base-path` cwd and copied entry identifiers. Runtime is O(n) in combined session-file size. Side effects include session-file creation or append operations for the restored base session.
|
|
2687
2869
|
- @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan whose original and execution session files must be synchronized.
|
|
2688
2870
|
- @return {void} No return value.
|
|
2689
2871
|
- @throws {ReqError} Throws when either session file is unreadable or when appended execution records are not persisted to the original session file.
|
|
2690
|
-
- @satisfies REQ-208
|
|
2872
|
+
- @satisfies REQ-208, REQ-307
|
|
2691
2873
|
|
|
2692
|
-
### fn `function verifyPromptCommandSessionTarget(` (
|
|
2874
|
+
### fn `function verifyPromptCommandSessionTarget(` (L595-639)
|
|
2693
2875
|
- @brief Verifies that the active session file and cwd surfaces match one expected prompt-orchestration target.
|
|
2694
2876
|
- @details Re-reads the persisted session-file header when present plus the host `process.cwd()` and throws on the first mismatch so prompt commands abort before prompt dispatch or prompt-end handling whenever session switching leaves execution attached to the wrong cwd. A missing persisted session file is treated as a non-fatal lazy-persistence state because pi's `SessionManager` writes session files on first assistant flush rather than eagerly during `ctx.switchSession(sessionPath)`; when the file is absent, pi aligns its internal session cwd to the live `process.cwd()`, so verifying `process.cwd()` alone is authoritative in that state. Reads of `ctx.cwd`, `ctx.sessionManager.getCwd()`, and `ctx.sessionManager.getSessionFile()` are advisory only because the pi `ctx.switchSession(sessionPath)` SDK contract does not mutate the handler-scoped `ctx` object, so those probes stay bound to the pre-switch session and a divergent value alone never triggers abort; they only surface a mismatch when they disagree with both the persisted header cwd and the live `process.cwd()`. Runtime is O(p) in aggregate path length plus one session-file header read. No external state is mutated.
|
|
2695
2877
|
- @param[in] expectedSessionFile {string} Session file that must remain active.
|
|
@@ -2700,7 +2882,7 @@ import {
|
|
|
2700
2882
|
- @throws {ReqError} Throws when the persisted session-file header cwd diverges from the expected target or when `process.cwd()` diverges from the expected target.
|
|
2701
2883
|
- @satisfies REQ-257, REQ-272
|
|
2702
2884
|
|
|
2703
|
-
### fn `function verifyPromptCommandClosureArtifacts(` (
|
|
2885
|
+
### fn `function verifyPromptCommandClosureArtifacts(` (L649-684)
|
|
2704
2886
|
- @brief Verifies persisted prompt execution artifacts before successful closure merge.
|
|
2705
2887
|
- @details Re-reads the persisted execution-session header, verifies the worktree path still exists, confirms the sibling worktree remains registered, and confirms the linked branch is still present before prompt-end closure attempts to restore `base-path` and merge from the original repository. Unlike prompt-start activation checks, this helper intentionally does not require the live process cwd or current session-bound context to remain on `worktree-path`, because pi CLI may already have started end-of-session session replacement or other post-run housekeeping before the extension finishes closure handling. Runtime is dominated by one session-file read, two git subprocess checks, and bounded filesystem probes. No external state is mutated.
|
|
2706
2888
|
- @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan.
|
|
@@ -2708,7 +2890,7 @@ import {
|
|
|
2708
2890
|
- @throws {ReqError} Throws when persisted execution-session metadata or worktree artifacts no longer match the expected worktree target.
|
|
2709
2891
|
- @satisfies REQ-208, REQ-219, REQ-258, REQ-282
|
|
2710
2892
|
|
|
2711
|
-
### fn `async function switchPromptCommandSession(` (
|
|
2893
|
+
### fn `async function switchPromptCommandSession(` (L695-724)
|
|
2712
2894
|
- @brief Switches the active prompt session to one persisted session file when required.
|
|
2713
2895
|
- @details Calls `ctx.switchSession(sessionPath, { withSession })` so current pi runtimes can expose a fresh replacement-session context for every post-switch session-bound operation. When a runtime ignores the callback, the helper falls back to the caller-supplied context and downstream verification continues to rely on the persisted session-file header plus `process.cwd()`. If pi surfaces only the documented stale-extension-context error while invalidating the old execution-session closure, the helper treats that side effect as non-fatal and lets downstream verification confirm whether the target session actually became active. Runtime is dominated by the session switch. Side effects include active-session replacement and cwd mutation by the host runtime.
|
|
2714
2896
|
- @param[in] sessionFile {string} Target persisted session file.
|
|
@@ -2717,47 +2899,63 @@ import {
|
|
|
2717
2899
|
- @throws {ReqError} Throws when the context cannot switch sessions, when the host cancels the switch, or when later verification proves the target session never became active.
|
|
2718
2900
|
- @satisfies REQ-068, REQ-271, REQ-272
|
|
2719
2901
|
|
|
2720
|
-
### fn `function isPromptCommandStaleContextError(error: unknown): boolean` (
|
|
2902
|
+
### fn `function isPromptCommandStaleContextError(error: unknown): boolean` (L733-736)
|
|
2721
2903
|
- @brief Detects the documented stale-extension-context runtime error during prompt-command session switching.
|
|
2722
2904
|
- @details Matches the guarded pi runtime error emitted when the old execution-session closure is invalidated during a session replacement or reload. Prompt-command session-switch helpers use this detector to distinguish a late stale-context side effect from genuine switch failures, then rely on post-switch verification to confirm whether the target session actually became active. Runtime is O(n) in message length only when an error is supplied. No external state is mutated.
|
|
2723
2905
|
- @param[in] error {unknown} Candidate thrown value.
|
|
2724
2906
|
- @return {boolean} `true` when the value matches the stale-extension-context runtime error.
|
|
2725
2907
|
- @satisfies REQ-280
|
|
2726
2908
|
|
|
2727
|
-
### fn `function attachPromptCommandErrorContext(` (
|
|
2909
|
+
### fn `function attachPromptCommandErrorContext(` (L745-753)
|
|
2728
2910
|
- @brief Attaches the last valid prompt-command context to one thrown error.
|
|
2729
2911
|
- @details Preserves the replacement-session context discovered after `ctx.switchSession(...)` so outer callers can continue UI notifications and cleanup without reusing stale pre-switch command objects. Runtime is O(1). Side effect: mutates the error object when it is an `Error` instance.
|
|
2730
2912
|
- @param[in] error {unknown} Thrown value.
|
|
2731
2913
|
- @param[in] ctx {PromptCommandSessionContext | undefined} Last valid prompt-command context.
|
|
2732
2914
|
- @return {unknown} Original thrown value with optional attached prompt context.
|
|
2733
2915
|
|
|
2734
|
-
### fn `export function getPromptCommandErrorContext(` (
|
|
2916
|
+
### fn `export function getPromptCommandErrorContext(` (L761-767)
|
|
2735
2917
|
- @brief Reads an attached prompt-command context from one thrown error.
|
|
2736
2918
|
- @details Returns the replacement-session context captured by prompt orchestration helpers when a switch-triggered failure occurs after the original command context became stale. Runtime is O(1). No external state is mutated.
|
|
2737
2919
|
- @param[in] error {unknown} Thrown value.
|
|
2738
2920
|
- @return {PromptCommandSessionContext | undefined} Attached prompt-command context when available.
|
|
2739
2921
|
|
|
2740
|
-
### fn `function runCapture(command: string[], cwd: string): ReturnType<typeof spawnSync>` (
|
|
2922
|
+
### fn `function runCapture(command: string[], cwd: string): ReturnType<typeof spawnSync>` (L845-850)
|
|
2741
2923
|
- @brief Executes one git subprocess synchronously and captures UTF-8 output.
|
|
2742
2924
|
- @details Delegates to `spawnSync`, preserves the supplied working directory, and returns the raw subprocess result used by prompt-command orchestration. Runtime is dominated by external process execution. Side effects include process spawning.
|
|
2743
2925
|
- @param[in] command {string[]} Executable plus argument vector.
|
|
2744
2926
|
- @param[in] cwd {string} Working directory for the subprocess.
|
|
2745
2927
|
- @return {ReturnType<typeof spawnSync>} Captured subprocess result.
|
|
2746
2928
|
|
|
2747
|
-
### fn `
|
|
2929
|
+
### fn `function listPromptTrackedBasePathChanges(basePath: string): string[]` (L860-878)
|
|
2930
|
+
- @brief Lists tracked `base-path` status rows that require stash-assisted merge handling.
|
|
2931
|
+
- @details Executes `git status --porcelain`, retains only tracked rows whose index or worktree slot reports a change, and excludes untracked or ignored rows because the required `git stash` command does not preserve them. Runtime is dominated by one git subprocess plus O(n) parsing in status-line count. Side effects include process spawning.
|
|
2932
|
+
- @param[in] basePath {string} Restored project base path.
|
|
2933
|
+
- @return {string[]} Tracked status rows requiring stash-assisted merge handling.
|
|
2934
|
+
- @throws {ReqError} Throws when git status cannot be read from `basePath`.
|
|
2935
|
+
- @satisfies REQ-291
|
|
2936
|
+
|
|
2937
|
+
### fn `function finalizePromptCommandMerge(` (L888-1010)
|
|
2938
|
+
- @brief Executes the successful-closure merge sequence from restored `base-path`.
|
|
2939
|
+
- @details Detects tracked staged or unstaged `base-path` changes, wraps the existing fast-forward merge in `git stash` and `git stash pop` when required, preserves the direct merge path when no tracked changes exist, emits a warning-only result after successful local-change restoration, and writes one merge-finalization debug entry when enabled. Runtime is dominated by up to four git subprocesses plus O(n) status parsing. Side effects include stash-stack mutation, branch merge attempts, and optional debug-log writes.
|
|
2940
|
+
- @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan whose branch should be merged.
|
|
2941
|
+
- @param[in] debugOptions {PromptCommandDebugOptions | undefined} Optional prompt debug logging context.
|
|
2942
|
+
- @return {{ mergeAttempted: boolean; mergeSucceeded: boolean; errorMessage?: string; warningMessage?: string }} Merge-attempt facts plus optional warning text.
|
|
2943
|
+
- @satisfies REQ-208, REQ-245, REQ-291, REQ-292
|
|
2944
|
+
|
|
2945
|
+
### fn `export function setPromptCommandPostCreateHookForTests(` (L1018-1022)
|
|
2748
2946
|
- @brief Stores or clears the prompt-command post-create test hook.
|
|
2749
2947
|
- @details Enables deterministic simulation of post-create worktree verification failures without altering production control flow. Runtime is O(1). Side effect: mutates module-local test state.
|
|
2750
2948
|
- @param[in] hook {PromptCommandPostCreateHook | undefined} Optional replacement hook.
|
|
2751
2949
|
- @return {void} No return value.
|
|
2752
2950
|
|
|
2753
|
-
### fn `function resolvePromptDocsRoot(projectBase: string, config: UseReqConfig): string` (
|
|
2951
|
+
### fn `function resolvePromptDocsRoot(projectBase: string, config: UseReqConfig): string` (L1031-1034)
|
|
2754
2952
|
- @brief Resolves the configured docs root for one project base.
|
|
2755
2953
|
- @details Joins the project base with the normalized `docs-dir` value while stripping trailing separators from the persisted config field. Runtime is O(p) in path length. No external state is mutated.
|
|
2756
2954
|
- @param[in] projectBase {string} Absolute project root.
|
|
2757
2955
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
2758
2956
|
- @return {string} Absolute canonical docs root path.
|
|
2759
2957
|
|
|
2760
|
-
### fn `function resolveWorktreePaths(` (
|
|
2958
|
+
### fn `function resolveWorktreePaths(` (L1044-1071)
|
|
2761
2959
|
- @brief Resolves the effective worktree project base relative to the git root.
|
|
2762
2960
|
- @details Reuses the original project-base location relative to the git root so nested repository subdirectories remain aligned inside the sibling worktree. Runtime is O(p) in path length. No external state is mutated.
|
|
2763
2961
|
- @param[in] projectBase {string} Original absolute project base path.
|
|
@@ -2765,51 +2963,51 @@ import {
|
|
|
2765
2963
|
- @param[in] worktreeName {string} Created worktree name.
|
|
2766
2964
|
- @return {{ worktreePath: string; worktreeBasePath: string }} Derived worktree paths.
|
|
2767
2965
|
|
|
2768
|
-
### fn `function sanitizePromptWorktreeBranchName(branch: string): string` (
|
|
2966
|
+
### fn `function sanitizePromptWorktreeBranchName(branch: string): string` (L1079-1081)
|
|
2769
2967
|
- @brief Rewrites a branch name into a filesystem-safe token for prompt worktrees.
|
|
2770
2968
|
- @details Replaces characters invalid for worktree directory and branch-name generation with `-`. Runtime is O(n). No external state is mutated.
|
|
2771
2969
|
- @param[in] branch {string} Raw branch name.
|
|
2772
2970
|
- @return {string} Sanitized token.
|
|
2773
2971
|
|
|
2774
|
-
### fn `function validatePromptWorktreeName(wtName: string): boolean` (
|
|
2972
|
+
### fn `function validatePromptWorktreeName(wtName: string): boolean` (L1089-1094)
|
|
2775
2973
|
- @brief Validates a prompt-command-generated worktree or branch name.
|
|
2776
2974
|
- @details Rejects empty names, dot-path markers, whitespace, and filesystem-invalid characters. Runtime is O(n). No external state is mutated.
|
|
2777
2975
|
- @param[in] wtName {string} Candidate worktree name.
|
|
2778
2976
|
- @return {boolean} `true` when the name is acceptable for worktree creation.
|
|
2779
2977
|
|
|
2780
|
-
### fn `function throwPromptGitStatusError(): never` (
|
|
2978
|
+
### fn `function throwPromptGitStatusError(): never` (L1102-1104)
|
|
2781
2979
|
- @brief Throws the canonical prompt-command git-preflight failure.
|
|
2782
2980
|
- @details Normalizes all repository-validation failures to the contractually stable prompt-command error string consumed by tests and downstream prompt workflows. Runtime is O(1). No external state is mutated.
|
|
2783
2981
|
- @return {never} Always throws.
|
|
2784
2982
|
- @throws {ReqError} Always throws with exit code `1`.
|
|
2785
2983
|
|
|
2786
|
-
### fn `function validatePromptGitState(projectBase: string, config?: UseReqConfig): string` (
|
|
2787
|
-
- @brief Runs
|
|
2788
|
-
- @details Validates work-tree membership, porcelain cleanliness, and symbolic or detached `HEAD` presence without invoking extension custom-tool executors. Runtime is dominated by git subprocess execution. Side effects include process spawning.
|
|
2984
|
+
### fn `export function validatePromptGitState(projectBase: string, config?: UseReqConfig): string` (L1115-1159)
|
|
2985
|
+
- @brief Runs slash-command-owned git validation and returns the runtime git root.
|
|
2986
|
+
- @details Validates work-tree membership, porcelain cleanliness, and symbolic or detached `HEAD` presence for bundled prompt commands and `req-references` without invoking extension custom-tool executors. Runtime is dominated by git subprocess execution. Side effects include process spawning.
|
|
2789
2987
|
- @param[in] projectBase {string} Absolute current project base.
|
|
2790
2988
|
- @param[in] config {UseReqConfig | undefined} Optional effective project configuration used to ignore extension-owned debug-log artifacts.
|
|
2791
2989
|
- @return {string} Absolute runtime git root.
|
|
2792
2990
|
- @throws {ReqError} Throws the canonical prompt-command git-preflight error on any validation failure.
|
|
2793
2991
|
- @satisfies REQ-200, REQ-220
|
|
2794
2992
|
|
|
2795
|
-
### fn `function resolveCurrentPromptBranchName(gitRoot: string): string` (
|
|
2993
|
+
### fn `function resolveCurrentPromptBranchName(gitRoot: string): string` (L1167-1172)
|
|
2796
2994
|
- @brief Resolves the current local branch name used by prompt-command orchestration.
|
|
2797
2995
|
- @details Reads `git branch --show-current`, falls back to `unknown` when git cannot provide a branch name, and preserves the raw branch token for later worktree-name generation and state tracking. Runtime is dominated by one git subprocess. Side effects include process spawning.
|
|
2798
2996
|
- @param[in] gitRoot {string} Absolute runtime git root.
|
|
2799
2997
|
- @return {string} Current branch name or `unknown` when unavailable.
|
|
2800
2998
|
|
|
2801
|
-
### fn `function formatPromptWorktreeExecutionId(timestamp: Date): string` (
|
|
2999
|
+
### fn `function formatPromptWorktreeExecutionId(timestamp: Date): string` (L1186-1188)
|
|
2802
3000
|
- @brief Formats one prompt-worktree execution identifier.
|
|
2803
3001
|
- @details Serializes the supplied timestamp as `YYYYMMDDHHMMSS` with zero-padded calendar and clock fields so generated worktree names remain stable, lexicographically sortable, and requirement-compatible. Runtime is O(1). No external state is mutated.
|
|
2804
3002
|
- @param[in] timestamp {Date} Timestamp to encode.
|
|
2805
3003
|
- @return {string} Formatted execution identifier.
|
|
2806
3004
|
|
|
2807
|
-
### fn `function getNextPromptWorktreeExecutionId(): string` (
|
|
3005
|
+
### fn `function getNextPromptWorktreeExecutionId(): string` (L1195-1208)
|
|
2808
3006
|
- @brief Resolves the next unique prompt-worktree execution identifier.
|
|
2809
3007
|
- @details Formats the current wall-clock second as `YYYYMMDDHHMMSS`, then monotonically advances by one-second steps until the identifier is strictly greater than the last value emitted in the current host process. This preserves the documented timestamp-only name shape while preventing immediate same-process worktree-name reuse after fast back-to-back prompt starts. Runtime is O(1) in the common case and O(k) in repeated same-second collisions. Side effect: mutates process-scoped execution-id persistence.
|
|
2810
3008
|
- @return {string} Unique execution identifier for worktree naming.
|
|
2811
3009
|
|
|
2812
|
-
### fn `function buildPromptWorktreeName(gitRoot: string, config: UseReqConfig): string` (
|
|
3010
|
+
### fn `function buildPromptWorktreeName(gitRoot: string, config: UseReqConfig): string` (L1219-1230)
|
|
2813
3011
|
- @brief Builds the prompt-command worktree name without invoking agent-tool executors.
|
|
2814
3012
|
- @details Combines the normalized persisted worktree prefix, repository basename, sanitized current branch, and timestamp execution identifier into the dedicated prompt-command worktree name. Runtime is O(1) plus git execution cost. Side effects include process spawning.
|
|
2815
3013
|
- @param[in] gitRoot {string} Absolute runtime git root.
|
|
@@ -2818,21 +3016,21 @@ import {
|
|
|
2818
3016
|
- @throws {ReqError} Throws when the generated name is invalid.
|
|
2819
3017
|
- @satisfies REQ-206, REQ-220
|
|
2820
3018
|
|
|
2821
|
-
### fn `function promptWorktreeBranchExists(gitRoot: string, branchName: string): boolean` (
|
|
3019
|
+
### fn `function promptWorktreeBranchExists(gitRoot: string, branchName: string): boolean` (L1239-1248)
|
|
2822
3020
|
- @brief Tests whether the exact prompt-command branch is present in the local branch list.
|
|
2823
3021
|
- @details Queries `git branch --list --format=%(refname:short)` and returns a boolean without mutating repository state. Runtime is dominated by one git subprocess plus O(n) parsing in listed branch count. Side effects include process spawning.
|
|
2824
3022
|
- @param[in] gitRoot {string} Absolute runtime git root.
|
|
2825
3023
|
- @param[in] branchName {string} Candidate local branch name.
|
|
2826
3024
|
- @return {boolean} `true` when the exact local branch is listed.
|
|
2827
3025
|
|
|
2828
|
-
### fn `function promptWorktreeRegistered(gitRoot: string, worktreePath: string): boolean` (
|
|
3026
|
+
### fn `function promptWorktreeRegistered(gitRoot: string, worktreePath: string): boolean` (L1257-1268)
|
|
2829
3027
|
- @brief Tests whether the exact prompt-command worktree is registered.
|
|
2830
3028
|
- @details Scans `git worktree list --porcelain` for the resolved target path so cleanup and verification can distinguish registered worktrees from unrelated sibling directories. Runtime is dominated by one git subprocess plus O(n) parsing in listed worktree count. Side effects include process spawning.
|
|
2831
3029
|
- @param[in] gitRoot {string} Absolute runtime git root.
|
|
2832
3030
|
- @param[in] worktreePath {string} Absolute sibling worktree path.
|
|
2833
3031
|
- @return {boolean} `true` when the exact path is registered as a git worktree.
|
|
2834
3032
|
|
|
2835
|
-
### fn `function cleanupPromptWorktreeCreation(` (
|
|
3033
|
+
### fn `function cleanupPromptWorktreeCreation(` (L1278-1292)
|
|
2836
3034
|
- @brief Removes partially created prompt-command worktree resources.
|
|
2837
3035
|
- @details Force-removes the registered sibling worktree when present, deletes the matching local branch, and falls back to filesystem removal for leftover directories so failed prompt preflight leaves no reusable worktree residue. Runtime is dominated by git subprocess execution. Side effects include branch deletion and directory removal.
|
|
2838
3036
|
- @param[in] gitRoot {string} Absolute runtime git root.
|
|
@@ -2840,7 +3038,7 @@ import {
|
|
|
2840
3038
|
- @param[in] worktreeName {string} Exact worktree and branch name.
|
|
2841
3039
|
- @return {void} No return value.
|
|
2842
3040
|
|
|
2843
|
-
### fn `function createPromptWorktree(` (
|
|
3041
|
+
### fn `function createPromptWorktree(` (L1306-1426)
|
|
2844
3042
|
- @brief Creates and verifies the prompt-command worktree and branch.
|
|
2845
3043
|
- @details Creates the sibling worktree, mirrors project config when present, runs the optional post-create test hook, verifies git worktree registration, verifies git branch listing, verifies filesystem paths before prompt dispatch, and appends selected debug entries for worktree creation. Failed verification triggers immediate rollback. Runtime is dominated by git subprocess execution and filesystem metadata checks. Side effects include worktree creation, branch creation, directory creation, file copying, optional debug-log writes, and rollback on failure.
|
|
2846
3044
|
- @param[in] projectBase {string} Absolute original project base.
|
|
@@ -2852,7 +3050,7 @@ import {
|
|
|
2852
3050
|
- @throws {ReqError} Throws when worktree creation, verification, or rollback finalization fails.
|
|
2853
3051
|
- @satisfies REQ-206, REQ-219, REQ-220, REQ-245
|
|
2854
3052
|
|
|
2855
|
-
### fn `function deletePromptWorktree(` (
|
|
3053
|
+
### fn `export function deletePromptWorktree(` (L1439-1499)
|
|
2856
3054
|
- @brief Deletes prompt-command worktree resources without invoking custom-tool executors.
|
|
2857
3055
|
- @details Force-removes the sibling worktree and matching branch, verifies both are absent so prompt finalization remains independent from agent-tool implementations, and appends selected debug entries for worktree deletion. Runtime is dominated by git subprocess execution plus filesystem probes. Side effects include worktree deletion, branch deletion, and optional debug-log writes.
|
|
2858
3056
|
- @param[in] projectBase {string} Absolute original project base.
|
|
@@ -2861,16 +3059,16 @@ import {
|
|
|
2861
3059
|
- @param[in] debugOptions {PromptCommandDebugOptions | undefined} Optional prompt debug logging context.
|
|
2862
3060
|
- @return {void} No return value.
|
|
2863
3061
|
- @throws {ReqError} Throws when cleanup cannot remove the worktree and branch fully.
|
|
2864
|
-
- @satisfies REQ-208, REQ-220, REQ-245
|
|
3062
|
+
- @satisfies REQ-208, REQ-220, REQ-245, REQ-309
|
|
2865
3063
|
|
|
2866
|
-
### fn `export function getPromptRequiredDocs(promptName: PromptCommandName): readonly PromptRequiredDocSpec[]` (
|
|
3064
|
+
### fn `export function getPromptRequiredDocs(promptName: PromptCommandName): readonly PromptRequiredDocSpec[]` (L1508-1510)
|
|
2867
3065
|
- @brief Returns the canonical required-document probes for one prompt command.
|
|
2868
3066
|
- @details Performs a constant-time lookup in the prompt-doc matrix used by command preflight validation. No filesystem access occurs.
|
|
2869
3067
|
- @param[in] promptName {PromptCommandName} Bundled prompt identifier.
|
|
2870
3068
|
- @return {readonly PromptRequiredDocSpec[]} Required-doc definitions in probe order.
|
|
2871
3069
|
- @satisfies REQ-201, REQ-202
|
|
2872
3070
|
|
|
2873
|
-
### fn `export function validatePromptRequiredDocs(` (
|
|
3071
|
+
### fn `export function validatePromptRequiredDocs(` (L1523-1574)
|
|
2874
3072
|
- @brief Runs prompt-specific required-document validation.
|
|
2875
3073
|
- @details Resolves the configured docs root, verifies the prompt-mapped canonical docs exist as files, throws a deterministic remediation error for the first missing document, and appends selected debug entries for required-doc checks. Runtime is O(d) in required-doc count plus filesystem metadata cost. Side effects are limited to filesystem reads and optional debug-log writes.
|
|
2876
3074
|
- @param[in] promptName {PromptCommandName} Bundled prompt identifier.
|
|
@@ -2881,7 +3079,7 @@ import {
|
|
|
2881
3079
|
- @throws {ReqError} Throws when a required canonical doc is missing.
|
|
2882
3080
|
- @satisfies REQ-201, REQ-202, REQ-203, REQ-245
|
|
2883
3081
|
|
|
2884
|
-
### fn `export function preparePromptCommandExecution(` (
|
|
3082
|
+
### fn `export function preparePromptCommandExecution(` (L1591-1667)
|
|
2885
3083
|
- @brief Prepares prompt-command execution for one bundled prompt.
|
|
2886
3084
|
- @details Runs slash-command-owned git validation, enforces the prompt-specific required-doc matrix, resolves persisted origin and execution session files, applies the effective worktree policy, generates and verifies a dedicated worktree when enabled, and returns the execution plan consumed by prompt rendering plus lifecycle hooks. Worktree-backed execution reuses the active session directory for the forked session file. Runtime is dominated by git subprocesses, worktree creation, and optional session-file cloning. Side effects include worktree creation, session-file creation, filesystem reads, and optional prompt debug-log writes.
|
|
2887
3085
|
- @param[in] promptName {PromptCommandName} Bundled prompt identifier.
|
|
@@ -2896,7 +3094,7 @@ import {
|
|
|
2896
3094
|
- @throws {ReqError} Throws when repository validation, required-doc validation, worktree creation, or session preparation fails.
|
|
2897
3095
|
- @satisfies REQ-200, REQ-203, REQ-206, REQ-207, REQ-215, REQ-219, REQ-220, REQ-245, REQ-256, REQ-271
|
|
2898
3096
|
|
|
2899
|
-
### fn `export async function activatePromptCommandExecution(` (
|
|
3097
|
+
### fn `export async function activatePromptCommandExecution(` (L1678-1711)
|
|
2900
3098
|
- @brief Activates the prepared prompt execution path before prompt dispatch or agent start.
|
|
2901
3099
|
- @details Switches the active session to the execution-session file when worktree routing changed the cwd, re-aligns `process.cwd()` to the execution path, verifies active-session cwd plus cwd mirrors after the switch completes, and stores the verified command-capable replacement-session context for later closure handling. Runtime is dominated by the optional session switch and one optional cwd mutation. Side effects include active-session replacement, host-process cwd mutation, runtime-path state mutation, and process-scoped command-context persistence.
|
|
2902
3100
|
- @param[in] plan {PromptCommandExecutionPlan} Prepared prompt execution plan.
|
|
@@ -2905,7 +3103,7 @@ import {
|
|
|
2905
3103
|
- @throws {ReqError} Throws when the session switch or cwd verification fails.
|
|
2906
3104
|
- @satisfies REQ-206, REQ-207, REQ-257, REQ-272, REQ-276
|
|
2907
3105
|
|
|
2908
|
-
### fn `export async function restorePromptCommandExecution(` (
|
|
3106
|
+
### fn `export async function restorePromptCommandExecution(` (L1723-1787)
|
|
2909
3107
|
- @brief Restores the original project base path before merge or session-closure return.
|
|
2910
3108
|
- @details Switches the active session back to the original session file when worktree routing changed the cwd, re-aligns `process.cwd()` to `base-path`, verifies the restored session target, reuses the persisted replacement-session context when lifecycle handlers receive non-command contexts, tolerates the documented stale-extension-context error when the old replacement-session closure becomes invalid immediately after a successful restore, emits optional workflow restoration debug entries, and clears active worktree path facts before session closure continues. Runtime is dominated by the optional session switch and one optional cwd mutation. Side effects include active-session replacement, host-process cwd mutation, runtime-path state mutation, and optional workflow-debug writes.
|
|
2911
3109
|
- @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan whose original base should be restored.
|
|
@@ -2915,7 +3113,7 @@ import {
|
|
|
2915
3113
|
- @throws {ReqError} Throws when the session switch or cwd verification fails.
|
|
2916
3114
|
- @satisfies REQ-208, REQ-209, REQ-245, REQ-257, REQ-272, REQ-276
|
|
2917
3115
|
|
|
2918
|
-
### fn `export async function abortPromptCommandExecution(` (
|
|
3116
|
+
### fn `export async function abortPromptCommandExecution(` (L1798-1844)
|
|
2919
3117
|
- @brief Aborts one prepared prompt-command execution before pi CLI takes ownership.
|
|
2920
3118
|
- @details Restores the original session-backed cwd and deletes any created worktree plus branch when command-side preflight, prompt rendering, or prompt handoff fails before agent completion. Restoration failures are returned as structured cleanup errors so the original preflight failure is not masked. Runtime is dominated by the optional session switch plus git subprocess execution. Side effects include active-session replacement, optional worktree deletion, and optional debug-log writes.
|
|
2921
3119
|
- @param[in] plan {PromptCommandExecutionPlan} Prepared prompt execution plan.
|
|
@@ -2924,16 +3122,16 @@ import {
|
|
|
2924
3122
|
- @return {Promise<{ cleanupSucceeded: boolean; errorMessage?: string; activeContext?: PromptCommandSessionContext }>} Abort-cleanup facts plus the last valid active prompt-command context.
|
|
2925
3123
|
- @satisfies REQ-226, REQ-220, REQ-245
|
|
2926
3124
|
|
|
2927
|
-
### fn `export async function finalizePromptCommandExecution(` (
|
|
3125
|
+
### fn `export async function finalizePromptCommandExecution(` (L1855-1943)
|
|
2928
3126
|
- @brief Finalizes one matched successful worktree-backed prompt execution.
|
|
2929
|
-
- @details Re-verifies persisted execution-session metadata plus worktree artifacts, copies any execution-session transcript records missing from the original session file, restores the original session-backed `base-path`, fast-forward
|
|
3127
|
+
- @details Re-verifies persisted execution-session metadata plus worktree artifacts, copies any execution-session transcript records missing from the original session file, restores the original session-backed `base-path`, executes the stash-assisted fast-forward merge sequence from `base-path`, deletes the worktree after merge success, and preserves the restored base session across closure failures. Closure intentionally treats `base-path` restoration as authoritative even when pi CLI has already started end-of-session session replacement or other housekeeping that moved the live runtime away from `worktree-path`. Runtime is dominated by session switching plus git subprocess execution. Side effects include session-file appends, active-session replacement, branch merges, stash-stack mutation, worktree deletion, and optional debug-log writes.
|
|
2930
3128
|
- @param[in] plan {PromptCommandExecutionPlan} Prompt execution plan.
|
|
2931
3129
|
- @param[in] ctx {PromptCommandSessionContext | undefined} Optional prompt-command context.
|
|
2932
3130
|
- @param[in] debugOptions {PromptCommandDebugOptions | undefined} Optional prompt debug logging context.
|
|
2933
|
-
- @return {Promise<{ mergeAttempted: boolean; mergeSucceeded: boolean; cleanupSucceeded: boolean; errorMessage?: string; activeContext?: PromptCommandSessionContext }>} Finalization facts plus the last valid active prompt-command context.
|
|
2934
|
-
- @satisfies REQ-208, REQ-209, REQ-220, REQ-245, REQ-282
|
|
3131
|
+
- @return {Promise<{ mergeAttempted: boolean; mergeSucceeded: boolean; cleanupSucceeded: boolean; errorMessage?: string; warningMessage?: string; activeContext?: PromptCommandSessionContext }>} Finalization facts plus the last valid active prompt-command context.
|
|
3132
|
+
- @satisfies REQ-208, REQ-209, REQ-220, REQ-245, REQ-282, REQ-291, REQ-292
|
|
2935
3133
|
|
|
2936
|
-
### fn `export function classifyPromptCommandOutcome(` (
|
|
3134
|
+
### fn `export function classifyPromptCommandOutcome(` (L1951-1955)
|
|
2937
3135
|
- @brief Maps one `agent_end` payload into the canonical prompt-worktree finalization outcome.
|
|
2938
3136
|
- @details Delegates to the shared notification outcome classifier so worktree merge and fork-session retention decisions stay aligned with prompt-end notification routing. Runtime is O(m) in assistant message count. No external state is mutated.
|
|
2939
3137
|
- @param[in] event {Pick<import("@mariozechner/pi-coding-agent").AgentEndEvent, "messages">} Agent-end payload subset.
|
|
@@ -2942,60 +3140,62 @@ import {
|
|
|
2942
3140
|
## Symbol Index
|
|
2943
3141
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
2944
3142
|
|---|---|---|---|---|
|
|
2945
|
-
|`PromptRequiredDocSpec`|iface||45
|
|
2946
|
-
|`PromptCommandExecutionPlan`|iface||
|
|
2947
|
-
|`PromptCommandPostCreateHookContext`|iface||
|
|
2948
|
-
|`PromptCommandPostCreateHook`|type||
|
|
2949
|
-
|`PromptCommandDebugOptions`|iface||91
|
|
2950
|
-
|`PromptCommandSessionMessageOptions`|iface||
|
|
2951
|
-
|`PromptCommandSessionSwitchOptions`|iface||
|
|
2952
|
-
|`PromptCommandActiveContext`|iface||
|
|
2953
|
-
|`PromptCommandSessionEntry`|iface||
|
|
2954
|
-
|`PromptCommandSessionContext`|iface||
|
|
2955
|
-
|`PromptCommandContextError`|iface||
|
|
2956
|
-
|`isUsablePromptSessionFile`|fn||
|
|
2957
|
-
|`resolvePromptSessionFile`|fn||
|
|
2958
|
-
|`writePromptExecutionSessionSnapshot`|fn||
|
|
2959
|
-
|`createPromptExecutionSessionFile`|fn||
|
|
2960
|
-
|`getPromptSessionCwd`|fn||
|
|
2961
|
-
|`getPromptSessionFile`|fn||
|
|
2962
|
-
|`getPromptContextCwd`|fn||
|
|
2963
|
-
|`resolvePromptCommandSwitchContext`|fn||
|
|
2964
|
-
|`syncPromptCommandProcessCwd`|fn||
|
|
2965
|
-
|`readPromptSessionFileCwd`|fn||
|
|
2966
|
-
|`readPromptSessionJsonLines`|fn||
|
|
2967
|
-
|`preservePromptCommandExecutionTranscript`|fn||
|
|
2968
|
-
|`verifyPromptCommandSessionTarget`|fn||
|
|
2969
|
-
|`verifyPromptCommandClosureArtifacts`|fn||
|
|
2970
|
-
|`switchPromptCommandSession`|fn||
|
|
2971
|
-
|`isPromptCommandStaleContextError`|fn||736
|
|
2972
|
-
|`attachPromptCommandErrorContext`|fn||
|
|
2973
|
-
|`getPromptCommandErrorContext`|fn||
|
|
2974
|
-
|`runCapture`|fn||
|
|
2975
|
-
|`
|
|
2976
|
-
|`
|
|
2977
|
-
|`
|
|
2978
|
-
|`
|
|
2979
|
-
|`
|
|
2980
|
-
|`
|
|
2981
|
-
|`
|
|
2982
|
-
|`
|
|
2983
|
-
|`
|
|
2984
|
-
|`
|
|
2985
|
-
|`
|
|
2986
|
-
|`
|
|
2987
|
-
|`
|
|
2988
|
-
|`
|
|
2989
|
-
|`
|
|
2990
|
-
|`
|
|
2991
|
-
|`
|
|
2992
|
-
|`
|
|
2993
|
-
|`
|
|
2994
|
-
|`
|
|
2995
|
-
|`
|
|
2996
|
-
|`
|
|
2997
|
-
|`
|
|
2998
|
-
|`
|
|
3143
|
+
|`PromptRequiredDocSpec`|iface||42-45|export interface PromptRequiredDocSpec|
|
|
3144
|
+
|`PromptCommandExecutionPlan`|iface||51-65|export interface PromptCommandExecutionPlan|
|
|
3145
|
+
|`PromptCommandPostCreateHookContext`|iface||71-76|interface PromptCommandPostCreateHookContext|
|
|
3146
|
+
|`PromptCommandPostCreateHook`|type||82||
|
|
3147
|
+
|`PromptCommandDebugOptions`|iface||88-91|interface PromptCommandDebugOptions|
|
|
3148
|
+
|`PromptCommandSessionMessageOptions`|iface||97-99|interface PromptCommandSessionMessageOptions|
|
|
3149
|
+
|`PromptCommandSessionSwitchOptions`|iface||105-107|interface PromptCommandSessionSwitchOptions|
|
|
3150
|
+
|`PromptCommandActiveContext`|iface||113-118|interface PromptCommandActiveContext extends PromptComman...|
|
|
3151
|
+
|`PromptCommandSessionEntry`|iface||124-130|interface PromptCommandSessionEntry|
|
|
3152
|
+
|`PromptCommandSessionContext`|iface||136-148|interface PromptCommandSessionContext|
|
|
3153
|
+
|`PromptCommandContextError`|iface||154-156|interface PromptCommandContextError extends Error|
|
|
3154
|
+
|`isUsablePromptSessionFile`|fn||171-189|function isUsablePromptSessionFile(|
|
|
3155
|
+
|`resolvePromptSessionFile`|fn||199-209|function resolvePromptSessionFile(sessionFile: string | u...|
|
|
3156
|
+
|`writePromptExecutionSessionSnapshot`|fn||223-249|function writePromptExecutionSessionSnapshot(|
|
|
3157
|
+
|`createPromptExecutionSessionFile`|fn||262-285|function createPromptExecutionSessionFile(|
|
|
3158
|
+
|`getPromptSessionCwd`|fn||293-301|function getPromptSessionCwd(ctx?: PromptCommandSessionCo...|
|
|
3159
|
+
|`getPromptSessionFile`|fn||309-317|function getPromptSessionFile(ctx?: PromptCommandSessionC...|
|
|
3160
|
+
|`getPromptContextCwd`|fn||325-331|function getPromptContextCwd(ctx?: PromptCommandSessionCo...|
|
|
3161
|
+
|`resolvePromptCommandSwitchContext`|fn||341-356|function resolvePromptCommandSwitchContext(|
|
|
3162
|
+
|`syncPromptCommandProcessCwd`|fn||367-387|function syncPromptCommandProcessCwd(expectedPath: string...|
|
|
3163
|
+
|`readPromptSessionFileCwd`|fn||395-419|function readPromptSessionFileCwd(sessionFile: string): s...|
|
|
3164
|
+
|`readPromptSessionJsonLines`|fn||428-475|function readPromptSessionJsonLines(|
|
|
3165
|
+
|`preservePromptCommandExecutionTranscript`|fn||485-582|export function preservePromptCommandExecutionTranscript(...|
|
|
3166
|
+
|`verifyPromptCommandSessionTarget`|fn||595-639|function verifyPromptCommandSessionTarget(|
|
|
3167
|
+
|`verifyPromptCommandClosureArtifacts`|fn||649-684|function verifyPromptCommandClosureArtifacts(|
|
|
3168
|
+
|`switchPromptCommandSession`|fn||695-724|async function switchPromptCommandSession(|
|
|
3169
|
+
|`isPromptCommandStaleContextError`|fn||733-736|function isPromptCommandStaleContextError(error: unknown)...|
|
|
3170
|
+
|`attachPromptCommandErrorContext`|fn||745-753|function attachPromptCommandErrorContext(|
|
|
3171
|
+
|`getPromptCommandErrorContext`|fn||761-767|export function getPromptCommandErrorContext(|
|
|
3172
|
+
|`runCapture`|fn||845-850|function runCapture(command: string[], cwd: string): Retu...|
|
|
3173
|
+
|`listPromptTrackedBasePathChanges`|fn||860-878|function listPromptTrackedBasePathChanges(basePath: strin...|
|
|
3174
|
+
|`finalizePromptCommandMerge`|fn||888-1010|function finalizePromptCommandMerge(|
|
|
3175
|
+
|`setPromptCommandPostCreateHookForTests`|fn||1018-1022|export function setPromptCommandPostCreateHookForTests(|
|
|
3176
|
+
|`resolvePromptDocsRoot`|fn||1031-1034|function resolvePromptDocsRoot(projectBase: string, confi...|
|
|
3177
|
+
|`resolveWorktreePaths`|fn||1044-1071|function resolveWorktreePaths(|
|
|
3178
|
+
|`sanitizePromptWorktreeBranchName`|fn||1079-1081|function sanitizePromptWorktreeBranchName(branch: string)...|
|
|
3179
|
+
|`validatePromptWorktreeName`|fn||1089-1094|function validatePromptWorktreeName(wtName: string): boolean|
|
|
3180
|
+
|`throwPromptGitStatusError`|fn||1102-1104|function throwPromptGitStatusError(): never|
|
|
3181
|
+
|`validatePromptGitState`|fn||1115-1159|export function validatePromptGitState(projectBase: strin...|
|
|
3182
|
+
|`resolveCurrentPromptBranchName`|fn||1167-1172|function resolveCurrentPromptBranchName(gitRoot: string):...|
|
|
3183
|
+
|`formatPromptWorktreeExecutionId`|fn||1186-1188|function formatPromptWorktreeExecutionId(timestamp: Date)...|
|
|
3184
|
+
|`getNextPromptWorktreeExecutionId`|fn||1195-1208|function getNextPromptWorktreeExecutionId(): string|
|
|
3185
|
+
|`buildPromptWorktreeName`|fn||1219-1230|function buildPromptWorktreeName(gitRoot: string, config:...|
|
|
3186
|
+
|`promptWorktreeBranchExists`|fn||1239-1248|function promptWorktreeBranchExists(gitRoot: string, bran...|
|
|
3187
|
+
|`promptWorktreeRegistered`|fn||1257-1268|function promptWorktreeRegistered(gitRoot: string, worktr...|
|
|
3188
|
+
|`cleanupPromptWorktreeCreation`|fn||1278-1292|function cleanupPromptWorktreeCreation(|
|
|
3189
|
+
|`createPromptWorktree`|fn||1306-1426|function createPromptWorktree(|
|
|
3190
|
+
|`deletePromptWorktree`|fn||1439-1499|export function deletePromptWorktree(|
|
|
3191
|
+
|`getPromptRequiredDocs`|fn||1508-1510|export function getPromptRequiredDocs(promptName: PromptC...|
|
|
3192
|
+
|`validatePromptRequiredDocs`|fn||1523-1574|export function validatePromptRequiredDocs(|
|
|
3193
|
+
|`preparePromptCommandExecution`|fn||1591-1667|export function preparePromptCommandExecution(|
|
|
3194
|
+
|`activatePromptCommandExecution`|fn||1678-1711|export async function activatePromptCommandExecution(|
|
|
3195
|
+
|`restorePromptCommandExecution`|fn||1723-1787|export async function restorePromptCommandExecution(|
|
|
3196
|
+
|`abortPromptCommandExecution`|fn||1798-1844|export async function abortPromptCommandExecution(|
|
|
3197
|
+
|`finalizePromptCommandExecution`|fn||1855-1943|export async function finalizePromptCommandExecution(|
|
|
3198
|
+
|`classifyPromptCommandOutcome`|fn||1951-1955|export function classifyPromptCommandOutcome(|
|
|
2999
3199
|
|
|
3000
3200
|
|
|
3001
3201
|
---
|
|
@@ -3093,7 +3293,7 @@ import type { PromptCommandExecutionPlan } from "./prompt-command-runtime.js";
|
|
|
3093
3293
|
|
|
3094
3294
|
---
|
|
3095
3295
|
|
|
3096
|
-
# prompts.ts | TypeScript |
|
|
3296
|
+
# prompts.ts | TypeScript | 314L | 9 symbols | 7 imports | 17 comments
|
|
3097
3297
|
> Path: `src/core/prompts.ts`
|
|
3098
3298
|
- @brief Renders bundled pi-usereq prompts for the current project context.
|
|
3099
3299
|
- @details Applies placeholder substitution, legacy tool-name rewrites, and conditional pi.dev governance guidance before prompt text is sent to the agent. Runtime is linear in prompt size plus replacement count. Side effects are limited to filesystem reads used for manifest checks and bundled prompt loading.
|
|
@@ -3111,7 +3311,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
|
|
|
3111
3311
|
|
|
3112
3312
|
## Definitions
|
|
3113
3313
|
|
|
3114
|
-
### fn `function buildPiDevConformanceBlock(promptName: string, projectBase: string): string` (
|
|
3314
|
+
### fn `function buildPiDevConformanceBlock(promptName: string, projectBase: string): string` (L109-118)
|
|
3115
3315
|
- @brief Builds the conditional pi.dev governance block for one rendered prompt.
|
|
3116
3316
|
- @details Emits the manifest-driven governance rules only when the selected bundled prompt can analyze or mutate source code and the project root contains the pi.dev manifest. Time complexity O(1). No filesystem writes.
|
|
3117
3317
|
- @param[in] promptName {string} Bundled prompt identifier.
|
|
@@ -3119,7 +3319,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
|
|
|
3119
3319
|
- @return {string} Markdown bullet block or the empty string when injection is not applicable.
|
|
3120
3320
|
- @satisfies REQ-032, REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275
|
|
3121
3321
|
|
|
3122
|
-
### fn `function injectPiDevConformanceBlock(text: string, promptName: string, projectBase: string): string` (
|
|
3322
|
+
### fn `function injectPiDevConformanceBlock(text: string, promptName: string, projectBase: string): string` (L129-136)
|
|
3123
3323
|
- @brief Injects the pi.dev governance block into the prompt behavior section.
|
|
3124
3324
|
- @details Inserts the block immediately after the `## Behavior` heading so downstream agents evaluate the rule before workflow steps. Leaves prompts unchanged when no behavior section exists or the block is already present. Time complexity O(n).
|
|
3125
3325
|
- @param[in] text {string} Prompt markdown after placeholder replacement.
|
|
@@ -3128,14 +3328,14 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
|
|
|
3128
3328
|
- @return {string} Prompt markdown with zero or one injected conformance block.
|
|
3129
3329
|
- @satisfies REQ-032, REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275
|
|
3130
3330
|
|
|
3131
|
-
### fn `export function adaptPromptForInternalTools(text: string): string` (
|
|
3331
|
+
### fn `export function adaptPromptForInternalTools(text: string): string` (L145-151)
|
|
3132
3332
|
- @brief Rewrites bundled prompt tool references from legacy `req --...` syntax to internal tool names.
|
|
3133
3333
|
- @details Applies deterministic global regex replacements so prompt text matches the extension-registered tool surface instead of the standalone CLI spelling. Time complexity O(p*r) where p is pattern count and r is prompt length.
|
|
3134
3334
|
- @param[in] text {string} Prompt markdown before tool-reference normalization.
|
|
3135
3335
|
- @return {string} Prompt markdown with internal tool names.
|
|
3136
3336
|
- @satisfies REQ-003
|
|
3137
3337
|
|
|
3138
|
-
### fn `export function applyReplacements(text: string, replacements: Record<string, string>): string` (
|
|
3338
|
+
### fn `export function applyReplacements(text: string, replacements: Record<string, string>): string` (L161-167)
|
|
3139
3339
|
- @brief Applies literal placeholder replacements to bundled prompt markdown.
|
|
3140
3340
|
- @details Replaces every placeholder token using split/join semantics so all occurrences are updated without regex escaping. Time complexity O(t*n) where t is replacement count and n is prompt length.
|
|
3141
3341
|
- @param[in] text {string} Prompt markdown containing placeholder tokens.
|
|
@@ -3143,7 +3343,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
|
|
|
3143
3343
|
- @return {string} Prompt markdown with all placeholder tokens expanded.
|
|
3144
3344
|
- @satisfies REQ-002
|
|
3145
3345
|
|
|
3146
|
-
### fn `function buildPromptExecutionBlock(` (
|
|
3346
|
+
### fn `function buildPromptExecutionBlock(` (L177-199)
|
|
3147
3347
|
- @brief Builds the prompt-command execution block injected at prompt start.
|
|
3148
3348
|
- @details Serializes the already-completed repository validation, prompt-specific required-doc validation, worktree routing decision, and extension-owned lifecycle responsibilities so downstream agents do not repeat command-side orchestration. Time complexity is O(d) in required-doc count. No external state is mutated.
|
|
3149
3349
|
- @param[in] promptName {PromptCommandName} Bundled prompt identifier.
|
|
@@ -3151,7 +3351,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
|
|
|
3151
3351
|
- @return {string} Markdown block or the empty string when runtime execution metadata is unavailable.
|
|
3152
3352
|
- @satisfies REQ-200, REQ-201, REQ-202, REQ-206, REQ-207, REQ-208, REQ-209
|
|
3153
3353
|
|
|
3154
|
-
### fn `function injectPromptExecutionBlock(` (
|
|
3354
|
+
### fn `function injectPromptExecutionBlock(` (L209-220)
|
|
3155
3355
|
- @brief Injects the prompt-command execution block near the start of the rendered prompt.
|
|
3156
3356
|
- @details Inserts the execution block immediately after the first level-1 heading so downstream agents evaluate extension-owned orchestration before workflow steps. Leaves prompts unchanged when no execution block is provided or when the block is already present. Time complexity O(n).
|
|
3157
3357
|
- @param[in] text {string} Prompt markdown after placeholder replacement.
|
|
@@ -3159,7 +3359,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
|
|
|
3159
3359
|
- @param[in] executionPlan {PromptCommandExecutionPlan | undefined} Prepared execution plan.
|
|
3160
3360
|
- @return {string} Prompt markdown with zero or one injected execution block.
|
|
3161
3361
|
|
|
3162
|
-
### fn `function buildPromptReplacements(` (
|
|
3362
|
+
### fn `function buildPromptReplacements(` (L232-244)
|
|
3163
3363
|
- @brief Builds prompt-specific runtime placeholder replacements.
|
|
3164
3364
|
- @details Merges shared path substitutions with prompt-scoped runtime values for `%%ARGS%%` and `%%PROMPT%%`. Time complexity is O(g log g + s) due to delegated path replacement building, where g is guideline count and s is source-directory count. Side effects are limited to filesystem reads delegated to shared path-context helpers.
|
|
3165
3365
|
- @param[in] promptName {string} Bundled prompt identifier without the `req-` prefix.
|
|
@@ -3169,7 +3369,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
|
|
|
3169
3369
|
- @return {Record<string, string>} Prompt-specific placeholder-to-value map.
|
|
3170
3370
|
- @satisfies REQ-002, REQ-211
|
|
3171
3371
|
|
|
3172
|
-
### fn `function renderBundledCommitInstruction(` (
|
|
3372
|
+
### fn `function renderBundledCommitInstruction(` (L256-270)
|
|
3173
3373
|
- @brief Renders the bundled git instruction injected through `%%COMMIT%%`.
|
|
3174
3374
|
- @details Selects `resources/instructions/git_commit.md` when automatic git commit is enabled and `resources/instructions/git_read-only.md` otherwise, then applies the same runtime placeholder substitutions used by bundled prompts before returning the rendered markdown. Time complexity is O(n + g log g + s) where n is instruction size, g is guideline count, and s is source-directory count. Side effects are limited to filesystem reads.
|
|
3175
3375
|
- @param[in] promptName {string} Bundled prompt identifier without the `req-` prefix.
|
|
@@ -3179,7 +3379,7 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
|
|
|
3179
3379
|
- @return {string} Rendered bundled git instruction selected for the current automatic-commit mode.
|
|
3180
3380
|
- @satisfies REQ-211, REQ-213, REQ-214
|
|
3181
3381
|
|
|
3182
|
-
### fn `export function renderPrompt(` (
|
|
3382
|
+
### fn `export function renderPrompt(` (L283-314)
|
|
3183
3383
|
- @brief Renders a bundled prompt for the current project context.
|
|
3184
3384
|
- @details Loads the bundled markdown template, expands configuration-derived placeholders, injects extension-owned execution guidance plus conditional pi.dev governance guidance, expands the optional bundled commit instruction, and rewrites legacy tool references to internal names. Time complexity O(n) relative to prompt size plus delegated commit-instruction rendering. No tracked files are modified.
|
|
3185
3385
|
- @param[in] promptName {string} Bundled prompt identifier.
|
|
@@ -3193,211 +3393,223 @@ import { readBundledInstruction, readBundledPrompt } from "./resources.js";
|
|
|
3193
3393
|
## Symbol Index
|
|
3194
3394
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
3195
3395
|
|---|---|---|---|---|
|
|
3196
|
-
|`buildPiDevConformanceBlock`|fn||
|
|
3197
|
-
|`injectPiDevConformanceBlock`|fn||
|
|
3198
|
-
|`adaptPromptForInternalTools`|fn||
|
|
3199
|
-
|`applyReplacements`|fn||
|
|
3200
|
-
|`buildPromptExecutionBlock`|fn||
|
|
3201
|
-
|`injectPromptExecutionBlock`|fn||
|
|
3202
|
-
|`buildPromptReplacements`|fn||
|
|
3203
|
-
|`renderBundledCommitInstruction`|fn||
|
|
3204
|
-
|`renderPrompt`|fn||
|
|
3396
|
+
|`buildPiDevConformanceBlock`|fn||109-118|function buildPiDevConformanceBlock(promptName: string, p...|
|
|
3397
|
+
|`injectPiDevConformanceBlock`|fn||129-136|function injectPiDevConformanceBlock(text: string, prompt...|
|
|
3398
|
+
|`adaptPromptForInternalTools`|fn||145-151|export function adaptPromptForInternalTools(text: string)...|
|
|
3399
|
+
|`applyReplacements`|fn||161-167|export function applyReplacements(text: string, replaceme...|
|
|
3400
|
+
|`buildPromptExecutionBlock`|fn||177-199|function buildPromptExecutionBlock(|
|
|
3401
|
+
|`injectPromptExecutionBlock`|fn||209-220|function injectPromptExecutionBlock(|
|
|
3402
|
+
|`buildPromptReplacements`|fn||232-244|function buildPromptReplacements(|
|
|
3403
|
+
|`renderBundledCommitInstruction`|fn||256-270|function renderBundledCommitInstruction(|
|
|
3404
|
+
|`renderPrompt`|fn||283-314|export function renderPrompt(|
|
|
3205
3405
|
|
|
3206
3406
|
|
|
3207
3407
|
---
|
|
3208
3408
|
|
|
3209
|
-
#
|
|
3210
|
-
> Path: `src/core/
|
|
3211
|
-
- @brief
|
|
3212
|
-
- @details
|
|
3409
|
+
# req-references-command.ts | TypeScript | 175L | 7 symbols | 6 imports | 10 comments
|
|
3410
|
+
> Path: `src/core/req-references-command.ts`
|
|
3411
|
+
- @brief Implements the specialized `req-references` slash-command workflow.
|
|
3412
|
+
- @details Performs slash-command-owned git validation reuse, reference-file generation, targeted staging, fixed-message commit creation, and post-commit cleanliness verification without creating a worktree or starting an LLM session. Runtime is dominated by git subprocess execution plus source-summary generation and one documentation write. Side effects include filesystem writes and git index/history mutation.
|
|
3213
3413
|
|
|
3214
3414
|
## Imports
|
|
3215
3415
|
```
|
|
3216
|
-
import
|
|
3416
|
+
import { spawnSync } from "node:child_process";
|
|
3217
3417
|
import path from "node:path";
|
|
3218
|
-
import {
|
|
3219
|
-
import {
|
|
3220
|
-
import {
|
|
3418
|
+
import type { UseReqConfig } from "./config.js";
|
|
3419
|
+
import { ReqError } from "./errors.js";
|
|
3420
|
+
import { validatePromptGitState } from "./prompt-command-runtime.js";
|
|
3421
|
+
import { runReferences } from "./tool-runner.js";
|
|
3221
3422
|
```
|
|
3222
3423
|
|
|
3223
3424
|
## Definitions
|
|
3224
3425
|
|
|
3225
|
-
|
|
3226
|
-
- @brief
|
|
3227
|
-
- @details
|
|
3228
|
-
- type `export type ReferenceFileStatus = "analyzed" | "error" | "skipped";` (L33)
|
|
3229
|
-
- @brief Enumerates supported per-file references entry statuses.
|
|
3230
|
-
- @details Separates analyzed files, analysis failures, and skipped inputs so downstream agents can branch without reparsing stderr text. The alias is compile-time only and introduces no runtime cost.
|
|
3231
|
-
### iface `export interface ReferenceLineRange` (L39-43)
|
|
3232
|
-
- @brief Describes one numeric source line range.
|
|
3233
|
-
- @details Exposes start and end line numbers plus the same inclusive range as a numeric tuple for direct agent access. The interface is compile-time only and introduces no runtime cost.
|
|
3234
|
-
|
|
3235
|
-
### iface `export interface ReferenceImportEntry extends ReferenceLineRange` : ReferenceLineRange (L49-52)
|
|
3236
|
-
- @brief Describes one structured import record.
|
|
3237
|
-
- @details Stores the normalized import identity, raw import statement, and declaration line range without requiring agents to parse markdown blocks. The interface is compile-time only and introduces no runtime cost.
|
|
3238
|
-
|
|
3239
|
-
### iface `export interface ReferenceCommentEntry extends ReferenceLineRange` : ReferenceLineRange (L58-61)
|
|
3240
|
-
- @brief Describes one structured standalone or attached comment record.
|
|
3241
|
-
- @details Preserves normalized comment text plus per-line comment fragments so agents can consume comment evidence without reparsing source delimiters. The interface is compile-time only and introduces no runtime cost.
|
|
3242
|
-
|
|
3243
|
-
### iface `export interface ReferenceExitPointEntry` (L67-70)
|
|
3244
|
-
- @brief Describes one structured exit-point annotation.
|
|
3245
|
-
- @details Preserves the normalized exit expression text together with its source line number for downstream reasoning about control flow hints. The interface is compile-time only and introduces no runtime cost.
|
|
3246
|
-
|
|
3247
|
-
### iface `export interface ReferenceSymbolEntry extends ReferenceLineRange` : ReferenceLineRange (L76-96)
|
|
3248
|
-
- @brief Describes one structured symbol record.
|
|
3249
|
-
- @details Orders direct-access identity fields before hierarchy, locations, Doxygen metadata, and comment evidence so agents can branch without reparsing monolithic summaries. The interface is compile-time only and introduces no runtime cost.
|
|
3250
|
-
|
|
3251
|
-
### iface `export interface ReferenceToolFileEntry extends ReferenceLineRange` : ReferenceLineRange (L102-115)
|
|
3252
|
-
- @brief Describes one per-file references payload entry.
|
|
3253
|
-
- @details Stores canonical identity, line metrics, structured imports, structured symbols, structured comment evidence, and optional file-level Doxygen metadata. Derivable identity and filesystem-probe fields are intentionally omitted to reduce token cost. The interface is compile-time only and introduces no runtime cost.
|
|
3254
|
-
|
|
3255
|
-
### iface `export interface ReferenceToolRequestSection` (L121-130)
|
|
3256
|
-
- @brief Describes the request section of the references payload.
|
|
3257
|
-
- @details Captures tool identity, scope, base directory, requested path inventory, and configured source-directory scope so agents can reason about how the file set was selected. The interface is compile-time only and introduces no runtime cost.
|
|
3258
|
-
|
|
3259
|
-
### iface `export interface ReferenceToolSummarySection` (L136-147)
|
|
3260
|
-
- @brief Describes the summary section of the references payload.
|
|
3261
|
-
- @details Exposes aggregate file, symbol, import, comment, and Doxygen counts as numeric fields plus deterministic symbol-kind totals. The interface is compile-time only and introduces no runtime cost.
|
|
3426
|
+
### iface `export interface ReqReferencesCommandPlan` (L30-35)
|
|
3427
|
+
- @brief Describes the prepared execution facts for one `req-references` run.
|
|
3428
|
+
- @details Stores the validated project base, resolved git root, target references path, and fixed commit message needed by the specialized direct-write workflow. The interface is compile-time only and introduces no runtime cost.
|
|
3262
3429
|
|
|
3263
|
-
###
|
|
3264
|
-
- @brief
|
|
3265
|
-
- @details
|
|
3430
|
+
### fn `function runCapture(command: string[], cwd: string): ReturnType<typeof spawnSync>` (L44-49)
|
|
3431
|
+
- @brief Executes one synchronous subprocess and captures UTF-8 output.
|
|
3432
|
+
- @details Delegates to `spawnSync(...)`, preserves the supplied working directory, and returns the raw result so callers can interpret git exit status plus diagnostics deterministically. Runtime is dominated by external process execution. Side effects include subprocess creation.
|
|
3433
|
+
- @param[in] command {string[]} Executable plus argument vector.
|
|
3434
|
+
- @param[in] cwd {string} Working directory for the subprocess.
|
|
3435
|
+
- @return {ReturnType<typeof spawnSync>} Captured subprocess result.
|
|
3266
3436
|
|
|
3267
|
-
###
|
|
3268
|
-
- @brief
|
|
3269
|
-
- @details
|
|
3437
|
+
### fn `function buildIgnoredGitStatusPaths(` (L59-73)
|
|
3438
|
+
- @brief Builds the set of git-status paths ignored for cleanliness checks.
|
|
3439
|
+
- @details Reuses the configured debug-log path exception already honored by prompt-command git validation so extension-owned debug artifacts do not block `req-references` execution or post-commit cleanliness verification. Runtime is O(p) in path length. No external state is mutated.
|
|
3440
|
+
- @param[in] projectBase {string} Absolute project base path.
|
|
3441
|
+
- @param[in] gitRoot {string} Absolute git root path.
|
|
3442
|
+
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
3443
|
+
- @return {Set<string>} Slash-normalized relative paths ignored during git-status evaluation.
|
|
3270
3444
|
|
|
3271
|
-
###
|
|
3272
|
-
- @brief
|
|
3273
|
-
- @details
|
|
3445
|
+
### fn `function listResidualGitStatusLines(` (L84-102)
|
|
3446
|
+
- @brief Lists residual git-status rows after ignored extension-owned paths are filtered out.
|
|
3447
|
+
- @details Executes `git status --porcelain`, drops the configured debug-log path when present inside the active repository, and returns all remaining staged or unstaged rows used for post-commit cleanliness verification. Runtime is dominated by one git subprocess plus O(n) parsing in status-line count. Side effects include subprocess creation.
|
|
3448
|
+
- @param[in] projectBase {string} Absolute project base path.
|
|
3449
|
+
- @param[in] gitRoot {string} Absolute git root path.
|
|
3450
|
+
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
3451
|
+
- @return {string[]} Residual status rows after ignored paths are removed.
|
|
3452
|
+
- @throws {ReqError} Throws when git status cannot be inspected.
|
|
3453
|
+
|
|
3454
|
+
### fn `function getGitAddTargetPath(gitRoot: string, absolutePath: string): string` (L111-117)
|
|
3455
|
+
- @brief Converts one absolute repository path into the preferred git-add target syntax.
|
|
3456
|
+
- @details Emits a slash-normalized relative path when the target is inside the git root and falls back to the absolute path otherwise, preserving deterministic add semantics across nested project-base layouts. Runtime is O(p) in path length. No external state is mutated.
|
|
3457
|
+
- @param[in] gitRoot {string} Absolute git root path.
|
|
3458
|
+
- @param[in] absolutePath {string} Absolute path to stage.
|
|
3459
|
+
- @return {string} Relative or absolute git-add target path.
|
|
3460
|
+
|
|
3461
|
+
### fn `export function prepareReqReferencesCommandExecution(` (L128-141)
|
|
3462
|
+
- @brief Prepares the specialized `req-references` execution plan.
|
|
3463
|
+
- @details Reuses slash-command-owned git validation, resolves the configured references document path, and returns the fixed commit metadata consumed by the direct-write workflow. Runtime is dominated by git validation subprocesses. Side effects include subprocess creation delegated through `validatePromptGitState(...)`.
|
|
3464
|
+
- @param[in] projectBase {string} Absolute project base path.
|
|
3465
|
+
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
3466
|
+
- @return {ReqReferencesCommandPlan} Prepared execution plan for direct references regeneration.
|
|
3467
|
+
- @throws {ReqError} Throws when git validation fails.
|
|
3468
|
+
- @satisfies REQ-200, REQ-299
|
|
3469
|
+
|
|
3470
|
+
### fn `export function executeReqReferencesCommandExecution(` (L152-175)
|
|
3471
|
+
- @brief Executes the specialized `req-references` direct-write workflow.
|
|
3472
|
+
- @details Regenerates `REFERENCES.md` through the same source-summary path used by the `references` tool, stages only the target file, creates the fixed-message commit, and verifies that no residual git-status rows remain after ignored extension-owned debug artifacts are filtered out. Runtime is dominated by summary generation plus three git subprocesses. Side effects include documentation writes, index mutation, commit creation, and subprocess creation.
|
|
3473
|
+
- @param[in] plan {ReqReferencesCommandPlan} Prepared direct-write execution plan.
|
|
3474
|
+
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
3475
|
+
- @return {void} No return value.
|
|
3476
|
+
- @throws {ReqError} Throws when reference generation, staging, commit creation, or cleanliness verification fails.
|
|
3477
|
+
- @satisfies REQ-300, REQ-301, REQ-302, REQ-303
|
|
3274
3478
|
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3479
|
+
## Symbol Index
|
|
3480
|
+
|Symbol|Kind|Vis|Lines|Sig|
|
|
3481
|
+
|---|---|---|---|---|
|
|
3482
|
+
|`ReqReferencesCommandPlan`|iface||30-35|export interface ReqReferencesCommandPlan|
|
|
3483
|
+
|`runCapture`|fn||44-49|function runCapture(command: string[], cwd: string): Retu...|
|
|
3484
|
+
|`buildIgnoredGitStatusPaths`|fn||59-73|function buildIgnoredGitStatusPaths(|
|
|
3485
|
+
|`listResidualGitStatusLines`|fn||84-102|function listResidualGitStatusLines(|
|
|
3486
|
+
|`getGitAddTargetPath`|fn||111-117|function getGitAddTargetPath(gitRoot: string, absolutePat...|
|
|
3487
|
+
|`prepareReqReferencesCommandExecution`|fn||128-141|export function prepareReqReferencesCommandExecution(|
|
|
3488
|
+
|`executeReqReferencesCommandExecution`|fn||152-175|export function executeReqReferencesCommandExecution(|
|
|
3278
3489
|
|
|
3279
|
-
### fn `function canonicalizeReferencePath(targetPath: string, baseDir: string): string` (L201-209)
|
|
3280
|
-
- @brief Canonicalizes one filesystem path relative to the payload base directory.
|
|
3281
|
-
- @details Emits a slash-normalized relative path when the target is under the base directory; otherwise emits the normalized absolute path. Runtime is O(p) in path length. No side effects occur.
|
|
3282
|
-
- @param[in] targetPath {string} Absolute or relative filesystem path.
|
|
3283
|
-
- @param[in] baseDir {string} Base directory used for relative canonicalization.
|
|
3284
|
-
- @return {string} Canonicalized path string.
|
|
3285
3490
|
|
|
3286
|
-
|
|
3287
|
-
- @brief Builds one structured line-range record.
|
|
3288
|
-
- @details Duplicates the inclusive range as start, end, and tuple fields so callers can address whichever shape is most convenient. Runtime is O(1). No side effects occur.
|
|
3289
|
-
- @param[in] startLineNumber {number} Inclusive start line number.
|
|
3290
|
-
- @param[in] endLineNumber {number} Inclusive end line number.
|
|
3291
|
-
- @return {ReferenceLineRange} Structured line-range record.
|
|
3491
|
+
---
|
|
3292
3492
|
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
- @
|
|
3296
|
-
- @
|
|
3297
|
-
- @param[in] maxLength {number} Optional maximum output length; `0` disables truncation.
|
|
3298
|
-
- @return {string} Cleaned comment text.
|
|
3493
|
+
# req-reset-command.ts | TypeScript | 323L | 12 symbols | 7 imports | 14 comments
|
|
3494
|
+
> Path: `src/core/req-reset-command.ts`
|
|
3495
|
+
- @brief Implements the specialized `req-reset` slash-command workflow.
|
|
3496
|
+
- @details Performs non-agentic prompt-orchestration recovery by preserving the current execution-session transcript when available, restoring the original session-backed `base-path`, force-removing every generated sibling worktree and matching branch, and returning deterministic cleanup facts to the extension command handler. Runtime is dominated by session switching plus git subprocess execution. Side effects include session-file reads and writes, active-session replacement, host-process cwd mutation, worktree deletion, branch deletion, and filesystem removal.
|
|
3299
3497
|
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3498
|
+
## Imports
|
|
3499
|
+
```
|
|
3500
|
+
import fs from "node:fs";
|
|
3501
|
+
import path from "node:path";
|
|
3502
|
+
import { spawnSync } from "node:child_process";
|
|
3503
|
+
import {
|
|
3504
|
+
import { ReqError } from "./errors.js";
|
|
3505
|
+
import {
|
|
3506
|
+
import { resolveRuntimeGitPath } from "./runtime-project-paths.js";
|
|
3507
|
+
```
|
|
3305
3508
|
|
|
3306
|
-
|
|
3307
|
-
- @brief Associates nearby comment blocks with definitions and standalone comment groups.
|
|
3308
|
-
- @details Reuses the repository comment-attachment heuristic that binds comments within three lines of a definition while preserving early file-description text. Runtime is O(n log n). No side effects occur.
|
|
3309
|
-
- @param[in] elements {SourceElement[]} Analyzed source elements.
|
|
3310
|
-
- @return {[Record<number, SourceElement[]>, SourceElement[], string]} Attached-comment map, standalone comments, and compact file description.
|
|
3509
|
+
## Definitions
|
|
3311
3510
|
|
|
3312
|
-
###
|
|
3313
|
-
- @brief
|
|
3314
|
-
- @details
|
|
3315
|
-
- @param[in] element {SourceElement} Source element.
|
|
3316
|
-
- @return {string} Stable symbol name.
|
|
3511
|
+
### iface `export interface ReqResetCommandPlan` (L34-40)
|
|
3512
|
+
- @brief Describes the prepared execution facts for one `req-reset` run.
|
|
3513
|
+
- @details Stores the validated project base, resolved git root, sibling-worktree parent directory, generated-name matcher, and optional persisted prompt execution plan used for transcript preservation plus base-path restoration. The interface is compile-time only and introduces no runtime cost.
|
|
3317
3514
|
|
|
3318
|
-
###
|
|
3319
|
-
- @brief
|
|
3320
|
-
- @details
|
|
3321
|
-
- @param[in] definitions {SourceElement[]} Sorted definition elements.
|
|
3322
|
-
- @param[in] child {SourceElement} Candidate child symbol.
|
|
3323
|
-
- @return {SourceElement | undefined} Matched parent definition when available.
|
|
3515
|
+
### iface `export interface ReqResetCommandExecutionResult` (L46-53)
|
|
3516
|
+
- @brief Describes the outcome of one `req-reset` execution attempt.
|
|
3517
|
+
- @details Captures the last valid session-bound context, transcript-preservation and base-path-restoration facts, removed generated worktree and branch names, and one aggregated failure string when any recovery step fails. The interface is compile-time only and introduces no runtime cost.
|
|
3324
3518
|
|
|
3325
|
-
|
|
3326
|
-
- @brief
|
|
3327
|
-
- @details
|
|
3328
|
-
|
|
3329
|
-
- @
|
|
3519
|
+
- type `type ReqResetCommandContext = Parameters<typeof restorePromptCommandExecution>[1];` (L59)
|
|
3520
|
+
- @brief Describes the session-bound context surface reused during `req-reset` recovery.
|
|
3521
|
+
- @details Reuses the session-switching contract already accepted by `restorePromptCommandExecution(...)` so the dedicated reset command can restore the original session without depending on concrete pi runtime classes. The alias is compile-time only and introduces no runtime cost.
|
|
3522
|
+
### fn `function runCapture(command: string[], cwd: string): ReturnType<typeof spawnSync>` (L68-73)
|
|
3523
|
+
- @brief Executes one synchronous subprocess and captures UTF-8 output.
|
|
3524
|
+
- @details Delegates to `spawnSync(...)`, preserves the supplied working directory, and returns the raw result so callers can interpret git exit status plus diagnostics deterministically. Runtime is dominated by external process execution. Side effects include subprocess creation.
|
|
3525
|
+
- @param[in] command {string[]} Executable plus argument vector.
|
|
3526
|
+
- @param[in] cwd {string} Working directory for the subprocess.
|
|
3527
|
+
- @return {ReturnType<typeof spawnSync>} Captured subprocess result.
|
|
3330
3528
|
|
|
3331
|
-
### fn `function
|
|
3332
|
-
- @brief
|
|
3333
|
-
- @details
|
|
3334
|
-
- @param[in]
|
|
3335
|
-
- @return {
|
|
3529
|
+
### fn `function escapeReqResetRegExpLiteral(text: string): string` (L81-83)
|
|
3530
|
+
- @brief Escapes one literal string for safe JavaScript regular-expression reuse.
|
|
3531
|
+
- @details Prefixes every regular-expression metacharacter with `\\` so generated worktree-name patterns can embed persisted prefixes and repository basenames without introducing unintended matcher semantics. Runtime is O(n) in string length. No external state is mutated.
|
|
3532
|
+
- @param[in] text {string} Literal text fragment.
|
|
3533
|
+
- @return {string} Regular-expression-safe literal fragment.
|
|
3336
3534
|
|
|
3337
|
-
### fn `
|
|
3535
|
+
### fn `function buildReqResetWorktreeNamePattern(gitRoot: string, config: UseReqConfig): RegExp` (L93-100)
|
|
3536
|
+
- @brief Builds the generated-worktree name matcher used by `req-reset` cleanup.
|
|
3537
|
+
- @details Reuses the configured worktree prefix plus repository basename, accepts any sanitized branch token between those fixed segments and the final execution identifier, and constrains the timestamp suffix to the documented `YYYYMMDDHHMMSS` shape. Runtime is O(p) in combined prefix and project-name length. No external state is mutated.
|
|
3538
|
+
- @param[in] gitRoot {string} Absolute runtime git root.
|
|
3539
|
+
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
3540
|
+
- @return {RegExp} Matcher for generated prompt-command worktree and branch names.
|
|
3541
|
+
- @satisfies REQ-309, REQ-310, REQ-311
|
|
3338
3542
|
|
|
3339
|
-
### fn `
|
|
3543
|
+
### fn `function listReqResetRegisteredWorktreeRoots(gitRoot: string): string[]` (L109-118)
|
|
3544
|
+
- @brief Lists every registered git worktree root for one repository.
|
|
3545
|
+
- @details Executes `git worktree list --porcelain`, extracts each `worktree <path>` record, resolves every listed path to an absolute form, and returns the ordered list used by generated-worktree cleanup. Runtime is dominated by one git subprocess plus O(n) parsing in listed worktree count. Side effects include subprocess creation.
|
|
3546
|
+
- @param[in] gitRoot {string} Absolute runtime git root.
|
|
3547
|
+
- @return {string[]} Absolute registered worktree-root paths.
|
|
3548
|
+
- @throws {ReqError} Throws when git worktree enumeration fails.
|
|
3549
|
+
|
|
3550
|
+
### fn `function listReqResetSiblingWorktreeRoots(` (L128-146)
|
|
3551
|
+
- @brief Lists sibling directories whose names match the generated-worktree contract.
|
|
3552
|
+
- @details Reads the repository parent directory, keeps only direct child directories whose basenames match the supplied generated-name pattern, and resolves each candidate to an absolute path so `req-reset` can remove unregistered leftover directories as well as registered git worktrees. Runtime is dominated by directory enumeration plus O(n) matcher cost. Side effects are limited to filesystem reads.
|
|
3553
|
+
- @param[in] parentPath {string} Absolute directory containing sibling worktree roots.
|
|
3554
|
+
- @param[in] worktreeNamePattern {RegExp} Generated-worktree name matcher.
|
|
3555
|
+
- @return {string[]} Absolute sibling directory paths whose basenames match the generated-name contract.
|
|
3556
|
+
- @throws {ReqError} Throws when directory enumeration fails.
|
|
3557
|
+
|
|
3558
|
+
### fn `function listReqResetMatchingWorktreeRoots(` (L157-172)
|
|
3559
|
+
- @brief Lists every generated sibling worktree candidate targeted by `req-reset`.
|
|
3560
|
+
- @details Unions registered git-worktree roots with matching sibling directories so cleanup covers both registered worktrees and unregistered leftover directories, then sorts the canonical absolute paths for deterministic deletion order. Runtime is dominated by git worktree enumeration plus sibling-directory scanning. Side effects are limited to subprocess creation and filesystem reads.
|
|
3561
|
+
- @param[in] parentPath {string} Absolute directory containing sibling worktree roots.
|
|
3562
|
+
- @param[in] gitRoot {string} Absolute runtime git root.
|
|
3563
|
+
- @param[in] worktreeNamePattern {RegExp} Generated-worktree name matcher.
|
|
3564
|
+
- @return {string[]} Sorted absolute worktree-root paths targeted for deletion.
|
|
3565
|
+
- @throws {ReqError} Throws when git worktree or sibling-directory enumeration fails.
|
|
3340
3566
|
|
|
3341
|
-
### fn `function
|
|
3342
|
-
- @brief
|
|
3343
|
-
- @details
|
|
3344
|
-
- @param[in]
|
|
3345
|
-
- @param[in]
|
|
3346
|
-
- @
|
|
3347
|
-
- @
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
- @
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
- @
|
|
3354
|
-
- @
|
|
3355
|
-
- @
|
|
3356
|
-
- @
|
|
3357
|
-
- @satisfies REQ-
|
|
3358
|
-
|
|
3359
|
-
### fn `export function
|
|
3360
|
-
- @brief
|
|
3361
|
-
- @details
|
|
3362
|
-
- @param[in]
|
|
3363
|
-
- @
|
|
3567
|
+
### fn `function listReqResetMatchingBranchNames(` (L182-195)
|
|
3568
|
+
- @brief Lists every matching generated branch targeted by `req-reset`.
|
|
3569
|
+
- @details Executes `git branch --list --format=%(refname:short)`, filters the local branch inventory through the generated-name matcher, and returns a sorted list so later forced branch deletion remains deterministic. Runtime is dominated by one git subprocess plus O(n) parsing in listed branch count. Side effects include subprocess creation.
|
|
3570
|
+
- @param[in] gitRoot {string} Absolute runtime git root.
|
|
3571
|
+
- @param[in] worktreeNamePattern {RegExp} Generated-worktree name matcher.
|
|
3572
|
+
- @return {string[]} Sorted local branch names targeted for deletion.
|
|
3573
|
+
- @throws {ReqError} Throws when local branch enumeration fails.
|
|
3574
|
+
|
|
3575
|
+
### fn `export function prepareReqResetCommandExecution(` (L207-230)
|
|
3576
|
+
- @brief Prepares the specialized `req-reset` execution plan.
|
|
3577
|
+
- @details Resolves the active project base into a runtime git root, derives the sibling-worktree parent directory and generated-name matcher from the same prefix plus repository-basename contract used by prompt-command worktree generation, and keeps only worktree-backed persisted prompt execution plans for transcript-preserving base-path restoration. Runtime is O(p) in path length. No external state is mutated.
|
|
3578
|
+
- @param[in] projectBase {string} Absolute project base path.
|
|
3579
|
+
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
3580
|
+
- @param[in] promptRequest {PromptCommandExecutionPlan | undefined} Pending or active prompt execution plan when available.
|
|
3581
|
+
- @return {ReqResetCommandPlan} Prepared recovery and cleanup plan.
|
|
3582
|
+
- @throws {ReqError} Throws when the repository root cannot be resolved.
|
|
3583
|
+
- @satisfies REQ-306, REQ-309, REQ-310, REQ-311
|
|
3584
|
+
|
|
3585
|
+
### fn `export async function executeReqResetCommandExecution(` (L240-323)
|
|
3586
|
+
- @brief Executes the specialized `req-reset` recovery and cleanup workflow.
|
|
3587
|
+
- @details Preserves the execution-session transcript into the original session file when a worktree-backed prompt execution plan is still available, restores the original session-backed `base-path` through the shared prompt-command restoration helper, force-removes every matching sibling worktree directory, force-removes every remaining matching local branch, and aggregates any failure diagnostics without rolling back successful cleanup steps. Runtime is dominated by session switching plus git subprocess execution. Side effects include session-file reads and writes, active-session replacement, host-process cwd mutation, worktree deletion, branch deletion, and filesystem reads.
|
|
3588
|
+
- @param[in] plan {ReqResetCommandPlan} Prepared recovery and cleanup plan.
|
|
3589
|
+
- @param[in] ctx {ReqResetCommandContext | undefined} Optional session-bound command context.
|
|
3590
|
+
- @return {Promise<ReqResetCommandExecutionResult>} Recovery and cleanup outcome facts.
|
|
3591
|
+
- @satisfies REQ-305, REQ-307, REQ-308, REQ-309, REQ-310, REQ-313
|
|
3364
3592
|
|
|
3365
3593
|
## Symbol Index
|
|
3366
3594
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
3367
3595
|
|---|---|---|---|---|
|
|
3368
|
-
|`
|
|
3369
|
-
|`
|
|
3370
|
-
|`
|
|
3371
|
-
|`
|
|
3372
|
-
|`
|
|
3373
|
-
|`
|
|
3374
|
-
|`
|
|
3375
|
-
|`
|
|
3376
|
-
|`
|
|
3377
|
-
|`
|
|
3378
|
-
|`
|
|
3379
|
-
|`
|
|
3380
|
-
|`ReferenceToolPayload`|iface||175-179|export interface ReferenceToolPayload|
|
|
3381
|
-
|`BuildReferenceToolPayloadOptions`|iface||185-192|export interface BuildReferenceToolPayloadOptions|
|
|
3382
|
-
|`canonicalizeReferencePath`|fn||201-209|function canonicalizeReferencePath(targetPath: string, ba...|
|
|
3383
|
-
|`buildLineRange`|fn||218-224|function buildLineRange(startLineNumber: number, endLineN...|
|
|
3384
|
-
|`extractCommentText`|fn||233-253|function extractCommentText(commentElement: SourceElement...|
|
|
3385
|
-
|`extractCommentLines`|fn||261-275|function extractCommentLines(commentElement: SourceElemen...|
|
|
3386
|
-
|`buildCommentMaps`|fn||283-333|function buildCommentMaps(elements: SourceElement[]): [Re...|
|
|
3387
|
-
|`resolveSymbolName`|fn||341-343|function resolveSymbolName(element: SourceElement): string|
|
|
3388
|
-
|`resolveParentElement`|fn||352-361|function resolveParentElement(definitions: SourceElement[...|
|
|
3389
|
-
|`buildCommentEntry`|fn||369-376|function buildCommentEntry(commentElement: SourceElement)...|
|
|
3390
|
-
|`buildRepositoryTree`|fn||384-443|function buildRepositoryTree(canonicalPaths: string[]): R...|
|
|
3391
|
-
|`ensureDirectory`|fn||393-407|const ensureDirectory = (parent: ReferenceRepositoryTreeN...|
|
|
3392
|
-
|`finalizeNode`|fn||429-440|const finalizeNode = (node: ReferenceRepositoryTreeNode):...|
|
|
3393
|
-
|`analyzeReferenceFile`|fn||456-621|function analyzeReferenceFile(|
|
|
3394
|
-
|`buildReferenceToolPayload`|fn||630-730|export function buildReferenceToolPayload(options: BuildR...|
|
|
3395
|
-
|`buildReferenceToolExecutionStderr`|fn||738-752|export function buildReferenceToolExecutionStderr(payload...|
|
|
3596
|
+
|`ReqResetCommandPlan`|iface||34-40|export interface ReqResetCommandPlan|
|
|
3597
|
+
|`ReqResetCommandExecutionResult`|iface||46-53|export interface ReqResetCommandExecutionResult|
|
|
3598
|
+
|`ReqResetCommandContext`|type||59||
|
|
3599
|
+
|`runCapture`|fn||68-73|function runCapture(command: string[], cwd: string): Retu...|
|
|
3600
|
+
|`escapeReqResetRegExpLiteral`|fn||81-83|function escapeReqResetRegExpLiteral(text: string): string|
|
|
3601
|
+
|`buildReqResetWorktreeNamePattern`|fn||93-100|function buildReqResetWorktreeNamePattern(gitRoot: string...|
|
|
3602
|
+
|`listReqResetRegisteredWorktreeRoots`|fn||109-118|function listReqResetRegisteredWorktreeRoots(gitRoot: str...|
|
|
3603
|
+
|`listReqResetSiblingWorktreeRoots`|fn||128-146|function listReqResetSiblingWorktreeRoots(|
|
|
3604
|
+
|`listReqResetMatchingWorktreeRoots`|fn||157-172|function listReqResetMatchingWorktreeRoots(|
|
|
3605
|
+
|`listReqResetMatchingBranchNames`|fn||182-195|function listReqResetMatchingBranchNames(|
|
|
3606
|
+
|`prepareReqResetCommandExecution`|fn||207-230|export function prepareReqResetCommandExecution(|
|
|
3607
|
+
|`executeReqResetCommandExecution`|fn||240-323|export async function executeReqResetCommandExecution(|
|
|
3396
3608
|
|
|
3397
3609
|
|
|
3398
3610
|
---
|
|
3399
3611
|
|
|
3400
|
-
# resources.ts | TypeScript |
|
|
3612
|
+
# resources.ts | TypeScript | 102L | 7 symbols | 3 imports | 8 comments
|
|
3401
3613
|
> Path: `src/core/resources.ts`
|
|
3402
3614
|
- @brief Resolves installation-owned bundled resource locations.
|
|
3403
3615
|
- @details Encapsulates installation-path discovery, bundled-resource validation, prompt enumeration, prompt loading, and bundled instruction loading directly from the installed extension payload. Runtime is proportional to directory-entry enumeration and resource file size. Side effects are limited to filesystem reads.
|
|
@@ -3437,20 +3649,20 @@ import { getInstallationPath, RESOURCE_ROOT_DIRNAME } from "./path-context.js";
|
|
|
3437
3649
|
- @return {string} Raw prompt markdown content.
|
|
3438
3650
|
- @throws {Error} Propagates `fs.readFileSync` errors when the prompt file is missing or unreadable.
|
|
3439
3651
|
|
|
3440
|
-
### fn `export function readBundledPromptDescription(promptName: string): string` (L73-
|
|
3441
|
-
- @brief Extracts the
|
|
3442
|
-
- @details
|
|
3652
|
+
### fn `export function readBundledPromptDescription(promptName: string): string` (L73-78)
|
|
3653
|
+
- @brief Extracts the first Markdown level-one heading from one bundled prompt.
|
|
3654
|
+
- @details Removes one optional leading YAML front-matter block, scans the remaining markdown body for the first line that begins with `# `, and returns the heading payload without the marker or surrounding whitespace. Runtime is O(n) in prompt length. Side effects are limited to filesystem reads delegated through `readBundledPrompt(...)`.
|
|
3443
3655
|
- @param[in] promptName {string} Prompt identifier without the `.md` suffix.
|
|
3444
|
-
- @return {string}
|
|
3656
|
+
- @return {string} First `# ` heading payload, or the empty string when no level-one heading exists.
|
|
3445
3657
|
|
|
3446
|
-
### fn `export function readBundledInstruction(instructionName: string): string` (
|
|
3658
|
+
### fn `export function readBundledInstruction(instructionName: string): string` (L87-89)
|
|
3447
3659
|
- @brief Reads one bundled markdown instruction by logical instruction name.
|
|
3448
3660
|
- @details Resolves the instruction file under the installation-owned `resources/instructions` directory, validates resource accessibility, and loads it as UTF-8 text. Time complexity is O(n) in file size. Side effects are limited to filesystem reads.
|
|
3449
3661
|
- @param[in] instructionName {string} Instruction identifier without the `.md` suffix.
|
|
3450
3662
|
- @return {string} Raw instruction markdown content.
|
|
3451
3663
|
- @throws {Error} Propagates `fs.readFileSync` errors when the instruction file is missing or unreadable.
|
|
3452
3664
|
|
|
3453
|
-
### fn `export function listBundledPromptNames(): string[]` (
|
|
3665
|
+
### fn `export function listBundledPromptNames(): string[]` (L96-102)
|
|
3454
3666
|
- @brief Lists bundled prompt identifiers available in the installed extension payload.
|
|
3455
3667
|
- @details Scans the installation-owned prompt directory, keeps visible markdown files only, strips the `.md` suffix, and returns a lexicographically sorted list. Time complexity is O(n log n). Side effects are limited to filesystem reads.
|
|
3456
3668
|
- @return {string[]} Sorted prompt names without file extensions.
|
|
@@ -3462,9 +3674,9 @@ import { getInstallationPath, RESOURCE_ROOT_DIRNAME } from "./path-context.js";
|
|
|
3462
3674
|
|`ensureBundledResourcesAccessible`|fn||26-38|export function ensureBundledResourcesAccessible(): string|
|
|
3463
3675
|
|`readBundledMarkdownResource`|fn||48-54|function readBundledMarkdownResource(|
|
|
3464
3676
|
|`readBundledPrompt`|fn||63-65|export function readBundledPrompt(promptName: string): st...|
|
|
3465
|
-
|`readBundledPromptDescription`|fn||73-
|
|
3466
|
-
|`readBundledInstruction`|fn||
|
|
3467
|
-
|`listBundledPromptNames`|fn||
|
|
3677
|
+
|`readBundledPromptDescription`|fn||73-78|export function readBundledPromptDescription(promptName: ...|
|
|
3678
|
+
|`readBundledInstruction`|fn||87-89|export function readBundledInstruction(instructionName: s...|
|
|
3679
|
+
|`listBundledPromptNames`|fn||96-102|export function listBundledPromptNames(): string[]|
|
|
3468
3680
|
|
|
3469
3681
|
|
|
3470
3682
|
---
|
|
@@ -3532,7 +3744,7 @@ import { isSameOrAncestorPath } from "./path-context.js";
|
|
|
3532
3744
|
|
|
3533
3745
|
---
|
|
3534
3746
|
|
|
3535
|
-
# settings-menu.ts | TypeScript |
|
|
3747
|
+
# settings-menu.ts | TypeScript | 321L | 15 symbols | 2 imports | 15 comments
|
|
3536
3748
|
> Path: `src/core/settings-menu.ts`
|
|
3537
3749
|
- @brief Renders pi-usereq configuration menus with the shared pi.dev settings style.
|
|
3538
3750
|
- @details Wraps `SettingsList` in one extension-command helper that exposes right-aligned current values, built-in circular scrolling, bottom-line descriptions, and a deterministic bridge for offline test harnesses. Runtime is O(n) in visible choice count plus user interaction cost. Side effects are limited to transient custom-UI rendering.
|
|
@@ -3545,37 +3757,35 @@ import { Container, SettingsList, Text, type Component, type SettingItem, type S
|
|
|
3545
3757
|
|
|
3546
3758
|
## Definitions
|
|
3547
3759
|
|
|
3548
|
-
### iface `export interface PiUsereqSettingsMenuChoice` (L14-
|
|
3760
|
+
### iface `export interface PiUsereqSettingsMenuChoice` (L14-23)
|
|
3549
3761
|
- @brief Describes one selectable pi-usereq settings-menu choice.
|
|
3550
|
-
- @details Stores the stable action identifier, left-column label, optional label and value tone overrides, optional disabled state, right-column current value, and bottom-line description consumed by the shared settings-menu renderer. The interface is compile-time only and introduces no runtime cost.
|
|
3762
|
+
- @details Stores the stable action identifier, left-column label, optional label and value tone overrides, optional disabled state, right-column current value, optional inline-cycle values, and bottom-line description consumed by the shared settings-menu renderer. The interface is compile-time only and introduces no runtime cost.
|
|
3551
3763
|
|
|
3552
|
-
### iface `export interface PiUsereqSettingsMenuBridge` (
|
|
3764
|
+
### iface `export interface PiUsereqSettingsMenuBridge` (L29-35)
|
|
3553
3765
|
- @brief Describes the offline bridge exposed by shared settings-menu components.
|
|
3554
3766
|
- @details Lets deterministic harnesses and unit tests drive the same settings-menu choices by label without simulating raw terminal key streams. The interface is runtime-facing but carries no side effects by itself.
|
|
3555
3767
|
|
|
3556
|
-
### iface `export interface PiUsereqSettingsMenuOptions` (
|
|
3768
|
+
### iface `export interface PiUsereqSettingsMenuOptions` (L41-45)
|
|
3557
3769
|
- @brief Describes optional behavior overrides for one settings-menu render.
|
|
3558
|
-
- @details Carries the caller-selected initial focus row
|
|
3559
|
-
preserve selection after an in-place toggle or value edit. The interface is
|
|
3560
|
-
compile-time only and introduces no runtime cost.
|
|
3770
|
+
- @details Carries the caller-selected initial focus row, the optional dynamic choice supplier used to rebuild dependent rows after inline toggles, and the optional inline-change callback used to persist `SettingsList` value cycles without closing the menu. The interface is compile-time only and introduces no runtime cost.
|
|
3561
3771
|
|
|
3562
|
-
### iface `export interface PiUsereqSettingsMenuComponent extends Component` : Component (
|
|
3772
|
+
### iface `export interface PiUsereqSettingsMenuComponent extends Component` : Component (L51-53)
|
|
3563
3773
|
- @brief Represents a custom menu component augmented with the offline bridge.
|
|
3564
3774
|
- @details Extends the generic TUI `Component` contract with one optional bridge field consumed only by deterministic test and debug harness adapters. The interface is compile-time only and introduces no runtime cost.
|
|
3565
3775
|
|
|
3566
|
-
- type `type PiUsereqSettingsThemeColor = Extract<ThemeColor, "accent" | "muted" | "dim">;` (
|
|
3776
|
+
- type `type PiUsereqSettingsThemeColor = Extract<ThemeColor, "accent" | "muted" | "dim">;` (L61)
|
|
3567
3777
|
- @brief Enumerates the CLI-supported theme tokens consumed by settings menus.
|
|
3568
3778
|
- @details Narrows callback-local theme calls to the documented settings-list
|
|
3569
3779
|
semantics used by the pi CLI. Compile-time only and introduces no runtime
|
|
3570
3780
|
cost.
|
|
3571
|
-
### iface `interface PiUsereqSettingsTheme` (
|
|
3781
|
+
### iface `interface PiUsereqSettingsTheme` (L70-73)
|
|
3572
3782
|
- @brief Describes the callback-local theme surface required by settings menus.
|
|
3573
3783
|
- @details Captures the subset of the custom-UI theme API needed to rebuild
|
|
3574
3784
|
title and fallback settings-list styling when the shared global theme is not
|
|
3575
3785
|
available in tests or offline replay. Compile-time only and introduces no
|
|
3576
3786
|
runtime cost.
|
|
3577
3787
|
|
|
3578
|
-
### fn `function buildFallbackPiUsereqSettingsListTheme(` (
|
|
3788
|
+
### fn `function buildFallbackPiUsereqSettingsListTheme(` (L85-97)
|
|
3579
3789
|
- @brief Builds the fallback settings-list theme matching CLI settings semantics.
|
|
3580
3790
|
- @details Mirrors the shared CLI settings theme token mapping for labels,
|
|
3581
3791
|
values, descriptions, cursor, and hints while avoiding the global theme
|
|
@@ -3585,7 +3795,7 @@ mutated.
|
|
|
3585
3795
|
- @return {SettingsListTheme} Fallback settings-list theme.
|
|
3586
3796
|
- @satisfies REQ-151, REQ-156
|
|
3587
3797
|
|
|
3588
|
-
### fn `function buildPiUsereqSettingsListTheme(` (
|
|
3798
|
+
### fn `function buildPiUsereqSettingsListTheme(` (L110-124)
|
|
3589
3799
|
- @brief Resolves the settings-list theme used by pi-usereq configuration menus.
|
|
3590
3800
|
- @details Prefers the shared CLI `getSettingsListTheme()` API so extension
|
|
3591
3801
|
menus inherit active-theme behavior from pi itself, then falls back to an
|
|
@@ -3596,7 +3806,7 @@ external state is mutated.
|
|
|
3596
3806
|
- @return {SettingsListTheme} Settings-list theme used by pi-usereq menus.
|
|
3597
3807
|
- @satisfies REQ-151, REQ-156
|
|
3598
3808
|
|
|
3599
|
-
### fn `function formatPiUsereqSettingsMenuTitle(` (
|
|
3809
|
+
### fn `function formatPiUsereqSettingsMenuTitle(` (L136-141)
|
|
3600
3810
|
- @brief Formats the settings-menu title with active-theme semantics.
|
|
3601
3811
|
- @details Applies the callback-local `accent` token and bold styling on every
|
|
3602
3812
|
rebuild so custom-menu titles stay synchronized with live theme changes.
|
|
@@ -3606,46 +3816,64 @@ Runtime is O(n) in title length. No external state is mutated.
|
|
|
3606
3816
|
- @return {string} Styled title text.
|
|
3607
3817
|
- @satisfies REQ-151, REQ-156
|
|
3608
3818
|
|
|
3609
|
-
### fn `function createImmediateSelectionComponent(choiceId: string, done: (value?: string) => void): Component` (
|
|
3819
|
+
### fn `function createImmediateSelectionComponent(choiceId: string, done: (value?: string) => void): Component` (L150-162)
|
|
3610
3820
|
- @brief Closes a settings menu immediately with one selected action identifier.
|
|
3611
3821
|
- @details Provides the submenu callback used by `SettingsList` so pressing Enter on any menu row resolves the outer custom UI promise with the row identifier. Runtime is O(1). Side effects are limited to one custom-UI completion callback.
|
|
3612
3822
|
- @param[in] choiceId {string} Stable choice identifier to emit.
|
|
3613
3823
|
- @param[in] done {(value?: string) => void} Outer custom-UI completion callback.
|
|
3614
3824
|
- @return {Component} Immediate-completion submenu component.
|
|
3615
3825
|
|
|
3616
|
-
### fn `function buildSettingItems(` (
|
|
3826
|
+
### fn `function buildSettingItems(` (L172-193)
|
|
3617
3827
|
- @brief Builds `SettingsList` items from one menu-choice vector.
|
|
3618
|
-
- @details Copies labels, current values, label-tone overrides, value-tone overrides, disabled-state semantics, and descriptions into `SettingItem` records
|
|
3828
|
+
- @details Copies labels, current values, label-tone overrides, value-tone overrides, disabled-state semantics, inline-cycle values, and descriptions into `SettingItem` records. Non-disabled rows with `values` cycle inline on `Enter` or `Space`, while other non-disabled rows resolve the outer custom UI through the immediate submenu bridge. Runtime is O(n) in choice count. No external state is mutated.
|
|
3619
3829
|
- @param[in] theme {PiUsereqSettingsTheme} Callback-local pi theme adapter.
|
|
3620
3830
|
- @param[in] choices {PiUsereqSettingsMenuChoice[]} Ordered menu-choice vector.
|
|
3621
3831
|
- @param[in] done {(value?: string) => void} Outer custom-UI completion callback.
|
|
3622
3832
|
- @return {SettingItem[]} `SettingsList` item vector.
|
|
3623
3833
|
|
|
3624
|
-
### fn `
|
|
3834
|
+
### fn `function setSettingsListSelectedIndex(` (L202-207)
|
|
3835
|
+
- @brief Writes one best-effort selected row index into a `SettingsList` instance.
|
|
3836
|
+
- @details Uses reflective access so pi-usereq can preserve focus across menu re-renders without depending on the private field at compile time. Runtime is O(1). Side effect: mutates the underlying `SettingsList` selection state when the field exists.
|
|
3837
|
+
- @param[in] selectedIndex {number} Zero-based row index to restore.
|
|
3838
|
+
- @param[in,out] settingsList {SettingsList} Mutable settings-list instance.
|
|
3839
|
+
- @return {void} No return value.
|
|
3840
|
+
|
|
3841
|
+
### fn `function getSettingsListSelectedIndex(` (L215-220)
|
|
3842
|
+
- @brief Reads the current selected row index from a `SettingsList` instance.
|
|
3843
|
+
- @details Uses reflective access so pi-usereq can report the current focused row through the offline bridge without referencing the private field in the static type system. Runtime is O(1). No external state is mutated.
|
|
3844
|
+
- @param[in] settingsList {SettingsList} Settings-list instance.
|
|
3845
|
+
- @return {number | undefined} Zero-based selected row index when available.
|
|
3846
|
+
|
|
3847
|
+
### fn `export async function showPiUsereqSettingsMenu(` (L232-236)
|
|
3625
3848
|
- @brief Renders one shared pi-usereq settings menu and resolves the selected action.
|
|
3626
|
-
- @details Uses `ctx.ui.custom(...)` plus `SettingsList` so every configuration menu shares pi.dev styling, right-aligned current values, circular scrolling, bottom-line descriptions,
|
|
3849
|
+
- @details Uses `ctx.ui.custom(...)` plus `SettingsList` so every configuration menu shares pi.dev styling, right-aligned current values, circular scrolling, bottom-line descriptions, optional disabled rows, and inline toggle cycles that do not close the menu. When callers provide `getChoices(...)`, dependent rows are rebuilt after inline changes while preserving focus on the changed row. The returned custom component also exposes an offline bridge for deterministic tests and debug harnesses. Runtime is O(n) in visible choice count plus user interaction cost. Side effects are limited to transient custom-UI rendering and caller-owned inline-change callbacks.
|
|
3627
3850
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
3628
3851
|
- @param[in] title {string} Menu title displayed in the heading and offline bridge.
|
|
3629
3852
|
- @param[in] choices {PiUsereqSettingsMenuChoice[]} Ordered menu-choice vector.
|
|
3630
|
-
- @param[in] options {PiUsereqSettingsMenuOptions | undefined} Optional initial-focus override.
|
|
3853
|
+
- @param[in] options {PiUsereqSettingsMenuOptions | undefined} Optional initial-focus override plus inline-change behavior.
|
|
3631
3854
|
- @return {Promise<string | undefined>} Selected choice identifier or `undefined` when cancelled.
|
|
3632
3855
|
- @satisfies REQ-151, REQ-152, REQ-153, REQ-154, REQ-156, REQ-192
|
|
3633
3856
|
|
|
3857
|
+
### fn `const rebuildMenu = (selectedChoiceId?: string): void =>` (L272-279)
|
|
3858
|
+
|
|
3634
3859
|
## Symbol Index
|
|
3635
3860
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
3636
3861
|
|---|---|---|---|---|
|
|
3637
|
-
|`PiUsereqSettingsMenuChoice`|iface||14-
|
|
3638
|
-
|`PiUsereqSettingsMenuBridge`|iface||
|
|
3639
|
-
|`PiUsereqSettingsMenuOptions`|iface||
|
|
3640
|
-
|`PiUsereqSettingsMenuComponent`|iface||
|
|
3641
|
-
|`PiUsereqSettingsThemeColor`|type||
|
|
3642
|
-
|`PiUsereqSettingsTheme`|iface||
|
|
3643
|
-
|`buildFallbackPiUsereqSettingsListTheme`|fn||
|
|
3644
|
-
|`buildPiUsereqSettingsListTheme`|fn||
|
|
3645
|
-
|`formatPiUsereqSettingsMenuTitle`|fn||
|
|
3646
|
-
|`createImmediateSelectionComponent`|fn||
|
|
3647
|
-
|`buildSettingItems`|fn||
|
|
3648
|
-
|`
|
|
3862
|
+
|`PiUsereqSettingsMenuChoice`|iface||14-23|export interface PiUsereqSettingsMenuChoice|
|
|
3863
|
+
|`PiUsereqSettingsMenuBridge`|iface||29-35|export interface PiUsereqSettingsMenuBridge|
|
|
3864
|
+
|`PiUsereqSettingsMenuOptions`|iface||41-45|export interface PiUsereqSettingsMenuOptions|
|
|
3865
|
+
|`PiUsereqSettingsMenuComponent`|iface||51-53|export interface PiUsereqSettingsMenuComponent extends Co...|
|
|
3866
|
+
|`PiUsereqSettingsThemeColor`|type||61||
|
|
3867
|
+
|`PiUsereqSettingsTheme`|iface||70-73|interface PiUsereqSettingsTheme|
|
|
3868
|
+
|`buildFallbackPiUsereqSettingsListTheme`|fn||85-97|function buildFallbackPiUsereqSettingsListTheme(|
|
|
3869
|
+
|`buildPiUsereqSettingsListTheme`|fn||110-124|function buildPiUsereqSettingsListTheme(|
|
|
3870
|
+
|`formatPiUsereqSettingsMenuTitle`|fn||136-141|function formatPiUsereqSettingsMenuTitle(|
|
|
3871
|
+
|`createImmediateSelectionComponent`|fn||150-162|function createImmediateSelectionComponent(choiceId: stri...|
|
|
3872
|
+
|`buildSettingItems`|fn||172-193|function buildSettingItems(|
|
|
3873
|
+
|`setSettingsListSelectedIndex`|fn||202-207|function setSettingsListSelectedIndex(|
|
|
3874
|
+
|`getSettingsListSelectedIndex`|fn||215-220|function getSettingsListSelectedIndex(|
|
|
3875
|
+
|`showPiUsereqSettingsMenu`|fn||232-236|export async function showPiUsereqSettingsMenu(|
|
|
3876
|
+
|`rebuildMenu`|fn||272-279|const rebuildMenu = (selectedChoiceId?: string): void =>|
|
|
3649
3877
|
|
|
3650
3878
|
|
|
3651
3879
|
---
|
|
@@ -4155,7 +4383,7 @@ import { ReqError } from "./errors.js";
|
|
|
4155
4383
|
|
|
4156
4384
|
---
|
|
4157
4385
|
|
|
4158
|
-
# tool-runner.ts | TypeScript |
|
|
4386
|
+
# tool-runner.ts | TypeScript | 458L | 22 symbols | 11 imports | 24 comments
|
|
4159
4387
|
> Path: `src/core/tool-runner.ts`
|
|
4160
4388
|
- @brief Implements the executable back-end for pi-usereq CLI analysis and static-check commands.
|
|
4161
4389
|
- @details Centralizes project discovery, git-backed source-file collection, documentation token generation, compression, construct lookup, and static-check dispatch. Runtime depends on the selected command and may include filesystem reads, config writes, and process spawning.
|
|
@@ -4257,9 +4485,9 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
4257
4485
|
- @return {ToolResult} Tool result containing the formatted summary and warnings.
|
|
4258
4486
|
- @throws {ReqError} Throws when no valid files are provided.
|
|
4259
4487
|
|
|
4260
|
-
### fn `export function
|
|
4261
|
-
- @brief Generates the monolithic
|
|
4262
|
-
- @details Delegates to `generateMarkdown(...)`, keeps output paths relative to the caller cwd, and returns the Python-compatible markdown document through stdout. Runtime is O(F + S). Side effects are limited to filesystem reads and optional stderr logging.
|
|
4488
|
+
### fn `export function runFilesSummarize(files: string[], cwd = process.cwd(), verbose = false): ToolResult` (L250-256)
|
|
4489
|
+
- @brief Generates the monolithic summary markdown for explicit files.
|
|
4490
|
+
- @details Delegates to `generateMarkdown(...)`, keeps output paths relative to the caller cwd, and returns the Python-compatible summary markdown document through stdout. Runtime is O(F + S). Side effects are limited to filesystem reads and optional stderr logging.
|
|
4263
4491
|
- @param[in] files {string[]} Explicit file paths.
|
|
4264
4492
|
- @param[in] cwd {string} Base directory used for relative output paths. Defaults to `process.cwd()`.
|
|
4265
4493
|
- @param[in] verbose {boolean} When `true`, emit per-file progress diagnostics to stderr.
|
|
@@ -4284,9 +4512,9 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
4284
4512
|
- @return {ToolResult} Successful tool result containing construct markdown.
|
|
4285
4513
|
- @throws {ReqError} Throws when required arguments are missing.
|
|
4286
4514
|
|
|
4287
|
-
### fn `export function
|
|
4288
|
-
- @brief Generates the monolithic
|
|
4289
|
-
- @details Resolves the project base, collects configured source files, prepends the repository file-structure markdown block, and returns the Python-compatible
|
|
4515
|
+
### fn `export function runSummarize(projectBase: string, config?: UseReqConfig, verbose = false): ToolResult` (L298-309)
|
|
4516
|
+
- @brief Generates the monolithic summary markdown for configured source directories.
|
|
4517
|
+
- @details Resolves the project base, collects configured source files, prepends the repository file-structure markdown block, and returns the Python-compatible summary document through stdout. Runtime is O(F log F + S). Side effects are limited to filesystem reads and optional stderr logging.
|
|
4290
4518
|
- @param[in] projectBase {string} Candidate project root.
|
|
4291
4519
|
- @param[in] config {UseReqConfig | undefined} Optional preloaded configuration.
|
|
4292
4520
|
- @param[in] verbose {boolean} When `true`, emit per-file diagnostics to stderr.
|
|
@@ -4294,7 +4522,17 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
4294
4522
|
- @throws {ReqError} Throws when no source files are found or no file can be analyzed.
|
|
4295
4523
|
- @satisfies REQ-014, REQ-076, REQ-077, REQ-078, REQ-079
|
|
4296
4524
|
|
|
4297
|
-
### fn `export function
|
|
4525
|
+
### fn `export function runReferences(projectBase: string, config?: UseReqConfig, verbose = false): ToolResult` (L321-329)
|
|
4526
|
+
- @brief Writes configured project references markdown to the canonical docs file.
|
|
4527
|
+
- @details Reuses `runSummarize(...)` to generate the same file-structure-plus-summary markdown, resolves `<docs-dir>/REFERENCES.md` from the effective project configuration, overwrites the target file, and returns the status-only stdout `success`. Runtime is O(F log F + S) plus one file write. Side effects include filesystem writes.
|
|
4528
|
+
- @param[in] projectBase {string} Candidate project root.
|
|
4529
|
+
- @param[in] config {UseReqConfig | undefined} Optional preloaded configuration.
|
|
4530
|
+
- @param[in] verbose {boolean} When `true`, emit per-file diagnostics to stderr during summary generation.
|
|
4531
|
+
- @return {ToolResult} Successful tool result containing the status-only stdout payload.
|
|
4532
|
+
- @throws {ReqError} Throws when source discovery, summary generation, or file writing fails.
|
|
4533
|
+
- @satisfies REQ-293
|
|
4534
|
+
|
|
4535
|
+
### fn `export function runCompress(projectBase: string, config?: UseReqConfig, enableLineNumbers = false, verbose = false): ToolResult` (L341-346)
|
|
4298
4536
|
- @brief Compresses all source files from configured source directories.
|
|
4299
4537
|
- @details Resolves the project base, collects source files, and delegates to `compressFiles`. Runtime is O(F + S). Side effects are limited to filesystem reads and optional stderr logging.
|
|
4300
4538
|
- @param[in] projectBase {string} Candidate project root.
|
|
@@ -4304,7 +4542,7 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
4304
4542
|
- @return {ToolResult} Successful tool result containing compressed output.
|
|
4305
4543
|
- @throws {ReqError} Throws when no source files are found.
|
|
4306
4544
|
|
|
4307
|
-
### fn `export function runSearch(projectBase: string, tagFilter: string, pattern: string, config?: UseReqConfig, enableLineNumbers = false, verbose = false): ToolResult` (
|
|
4545
|
+
### fn `export function runSearch(projectBase: string, tagFilter: string, pattern: string, config?: UseReqConfig, enableLineNumbers = false, verbose = false): ToolResult` (L360-369)
|
|
4308
4546
|
- @brief Searches named constructs across configured project source files.
|
|
4309
4547
|
- @details Resolves the project base, collects source files, delegates to `searchConstructsInFiles`, and converts thrown search errors into structured `ReqError` failures. Runtime is O(F + S + M). Side effects are limited to filesystem reads and optional stderr logging.
|
|
4310
4548
|
- @param[in] projectBase {string} Candidate project root.
|
|
@@ -4316,7 +4554,7 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
4316
4554
|
- @return {ToolResult} Successful tool result containing construct markdown.
|
|
4317
4555
|
- @throws {ReqError} Throws when no source files are found or the search fails.
|
|
4318
4556
|
|
|
4319
|
-
### fn `export function runTokens(projectBase: string, config?: UseReqConfig): ToolResult` (
|
|
4557
|
+
### fn `export function runTokens(projectBase: string, config?: UseReqConfig): ToolResult` (L379-388)
|
|
4320
4558
|
- @brief Counts tokens for canonical documentation files.
|
|
4321
4559
|
- @details Loads the configured docs directory, selects `REQUIREMENTS.md`, `WORKFLOW.md`, and `REFERENCES.md` when present, and delegates to `runFilesTokens`. Runtime is O(F + S). Side effects are limited to filesystem reads.
|
|
4322
4560
|
- @param[in] projectBase {string} Candidate project root.
|
|
@@ -4324,7 +4562,7 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
4324
4562
|
- @return {ToolResult} Tool result containing documentation token metrics.
|
|
4325
4563
|
- @throws {ReqError} Throws when no canonical docs files exist.
|
|
4326
4564
|
|
|
4327
|
-
### fn `export function runFilesStaticCheck(files: string[], projectBase: string, config?: UseReqConfig): ToolResult` (
|
|
4565
|
+
### fn `export function runFilesStaticCheck(files: string[], projectBase: string, config?: UseReqConfig): ToolResult` (L398-434)
|
|
4328
4566
|
- @brief Runs configured static checks for explicit files.
|
|
4329
4567
|
- @details Loads the effective static-check config, resolves the active checker list per file-extension language through the per-language enable flag, captures checker stdout for each dispatched entry, and aggregates stderr warnings for invalid paths. Runtime is O(F * C) plus external checker cost. Side effects include filesystem reads, stdout interception, and process spawning.
|
|
4330
4568
|
- @param[in] files {string[]} Explicit file paths.
|
|
@@ -4332,7 +4570,7 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
4332
4570
|
- @param[in] config {UseReqConfig | undefined} Optional preloaded configuration.
|
|
4333
4571
|
- @return {ToolResult} Aggregated static-check result.
|
|
4334
4572
|
|
|
4335
|
-
### fn `export function runProjectStaticCheck(projectBase: string, config?: UseReqConfig): ToolResult` (
|
|
4573
|
+
### fn `export function runProjectStaticCheck(projectBase: string, config?: UseReqConfig): ToolResult` (L444-457)
|
|
4336
4574
|
- @brief Runs configured static checks for project source and test directories.
|
|
4337
4575
|
- @details Collects source and test files, excludes fixture roots, and delegates to `runFilesStaticCheck`. Runtime is O(F * C) plus external checker cost. Side effects include filesystem reads, stdout interception, and process spawning.
|
|
4338
4576
|
- @param[in] projectBase {string} Candidate project root.
|
|
@@ -4355,15 +4593,16 @@ import { makeRelativeIfContainsProject } from "./utils.js";
|
|
|
4355
4593
|
|`resolveProjectSrcDirs`|fn||196-204|export function resolveProjectSrcDirs(projectBase: string...|
|
|
4356
4594
|
|`loadAndRepairConfig`|fn||213-218|export function loadAndRepairConfig(projectBase: string):...|
|
|
4357
4595
|
|`runFilesTokens`|fn||227-239|export function runFilesTokens(files: string[]): ToolResult|
|
|
4358
|
-
|`
|
|
4596
|
+
|`runFilesSummarize`|fn||250-256|export function runFilesSummarize(files: string[], cwd = ...|
|
|
4359
4597
|
|`runFilesCompress`|fn||267-269|export function runFilesCompress(files: string[], cwd = p...|
|
|
4360
4598
|
|`runFilesSearch`|fn||280-286|export function runFilesSearch(argsList: string[], enable...|
|
|
4361
|
-
|`
|
|
4362
|
-
|`
|
|
4363
|
-
|`
|
|
4364
|
-
|`
|
|
4365
|
-
|`
|
|
4366
|
-
|`
|
|
4599
|
+
|`runSummarize`|fn||298-309|export function runSummarize(projectBase: string, config?...|
|
|
4600
|
+
|`runReferences`|fn||321-329|export function runReferences(projectBase: string, config...|
|
|
4601
|
+
|`runCompress`|fn||341-346|export function runCompress(projectBase: string, config?:...|
|
|
4602
|
+
|`runSearch`|fn||360-369|export function runSearch(projectBase: string, tagFilter:...|
|
|
4603
|
+
|`runTokens`|fn||379-388|export function runTokens(projectBase: string, config?: U...|
|
|
4604
|
+
|`runFilesStaticCheck`|fn||398-434|export function runFilesStaticCheck(files: string[], proj...|
|
|
4605
|
+
|`runProjectStaticCheck`|fn||444-457|export function runProjectStaticCheck(projectBase: string...|
|
|
4367
4606
|
|
|
4368
4607
|
|
|
4369
4608
|
---
|
|
@@ -4450,7 +4689,7 @@ import path from "node:path";
|
|
|
4450
4689
|
|
|
4451
4690
|
---
|
|
4452
4691
|
|
|
4453
|
-
# index.ts | TypeScript |
|
|
4692
|
+
# index.ts | TypeScript | 4250L | 96 symbols | 27 imports | 102 comments
|
|
4454
4693
|
> Path: `src/index.ts`
|
|
4455
4694
|
- @brief Registers the pi-usereq extension commands, tools, and configuration UI.
|
|
4456
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.
|
|
@@ -4472,6 +4711,8 @@ import {
|
|
|
4472
4711
|
import { renderPrompt } from "./core/prompts.js";
|
|
4473
4712
|
import {
|
|
4474
4713
|
import {
|
|
4714
|
+
import {
|
|
4715
|
+
import {
|
|
4475
4716
|
import { PROMPT_COMMAND_NAMES } from "./core/prompt-command-catalog.js";
|
|
4476
4717
|
import { resolveRuntimeGitPath } from "./core/runtime-project-paths.js";
|
|
4477
4718
|
import {
|
|
@@ -4486,78 +4727,84 @@ import { makeRelativeIfContainsProject, shellSplit } from "./core/utils.js";
|
|
|
4486
4727
|
|
|
4487
4728
|
## Definitions
|
|
4488
4729
|
|
|
4489
|
-
### iface `interface PiShortcutRegistrar` (
|
|
4730
|
+
### iface `interface PiShortcutRegistrar` (L178-186)
|
|
4490
4731
|
- @brief Describes the optional shortcut-registration surface used by pi-usereq.
|
|
4491
4732
|
- @details Narrows the runtime API to the documented `registerShortcut(...)`
|
|
4492
4733
|
method so the extension can remain compatible with offline harnesses that do
|
|
4493
4734
|
not implement shortcut capture. Compile-time only and introduces no runtime
|
|
4494
4735
|
cost.
|
|
4495
4736
|
|
|
4496
|
-
### fn `function getProjectBase(cwd: string): string` (
|
|
4737
|
+
### fn `function getProjectBase(cwd: string): string` (L194-203)
|
|
4497
4738
|
- @brief Resolves the effective project base from a working directory.
|
|
4498
4739
|
- @details Normalizes the provided cwd into an absolute path without consulting configuration. Time complexity is O(1). No I/O side effects occur.
|
|
4499
4740
|
- @param[in] cwd {string} Current working directory.
|
|
4500
4741
|
- @return {string} Absolute project base path.
|
|
4501
4742
|
|
|
4502
|
-
### fn `function getProcessCwdSafe(): string` (
|
|
4743
|
+
### fn `function getProcessCwdSafe(): string` (L210-219)
|
|
4503
4744
|
- @brief Resolves a safe process working directory for extension-load paths.
|
|
4504
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.
|
|
4505
4746
|
- @return {string} Absolute fallback-safe process working directory.
|
|
4506
4747
|
|
|
4507
|
-
### fn `function resolveLiveBootstrapCwd(cwd: string): string` (
|
|
4748
|
+
### fn `function resolveLiveBootstrapCwd(cwd: string): string` (L227-239)
|
|
4508
4749
|
- @brief Resolves the live working directory used for bootstrap-sensitive flows.
|
|
4509
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.
|
|
4510
4751
|
- @param[in] cwd {string} Candidate context cwd.
|
|
4511
4752
|
- @return {string} Existing absolute cwd used for bootstrap work.
|
|
4512
4753
|
|
|
4513
|
-
### fn `function syncContextCwdMirror(ctx: { cwd?: string }, cwd: string): void` (
|
|
4754
|
+
### fn `function syncContextCwdMirror(ctx: { cwd?: string }, cwd: string): void` (L248-257)
|
|
4514
4755
|
- @brief Best-effort synchronizes one context `cwd` mirror with bootstrap reality.
|
|
4515
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.
|
|
4516
4757
|
- @param[in] cwd {string} Resolved live cwd.
|
|
4517
4758
|
- @param[in,out] ctx {{ cwd?: string }} Mutable context-like object.
|
|
4518
4759
|
- @return {void} No return value.
|
|
4519
4760
|
|
|
4520
|
-
### fn `function loadProjectConfig(cwd: string): UseReqConfig` (
|
|
4761
|
+
### fn `function loadProjectConfig(cwd: string): UseReqConfig` (L266-269)
|
|
4521
4762
|
- @brief Loads project configuration for the extension runtime.
|
|
4522
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.
|
|
4523
4764
|
- @param[in] cwd {string} Current working directory.
|
|
4524
4765
|
- @return {UseReqConfig} Effective project configuration.
|
|
4525
4766
|
- @satisfies REQ-030, REQ-145, REQ-146
|
|
4526
4767
|
|
|
4527
|
-
### fn `function saveProjectConfig(cwd: string, config: UseReqConfig): void` (
|
|
4528
|
-
- @brief Persists project configuration from the extension runtime.
|
|
4529
|
-
- @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.
|
|
4530
4771
|
- @param[in] cwd {string} Current working directory.
|
|
4531
|
-
- @param[in] config {UseReqConfig}
|
|
4772
|
+
- @param[in] config {UseReqConfig} Effective configuration to persist.
|
|
4532
4773
|
- @return {void} No return value.
|
|
4533
|
-
- @satisfies REQ-146
|
|
4774
|
+
- @satisfies REQ-146, REQ-315
|
|
4534
4775
|
|
|
4535
|
-
### fn `function
|
|
4536
|
-
- @brief Formats the current
|
|
4537
|
-
- @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.
|
|
4538
4779
|
- @param[in] cwd {string} Current working directory.
|
|
4539
|
-
- @return {string} `~`-relative or absolute config
|
|
4780
|
+
- @return {string} `~`-relative or absolute local config-path display value.
|
|
4540
4781
|
- @satisfies REQ-162
|
|
4541
4782
|
|
|
4542
|
-
### 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)
|
|
4543
4790
|
- @brief Builds the standardized terminal rows appended to every configuration menu.
|
|
4544
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.
|
|
4545
4792
|
- @param[in] options {{ resetDefaultsDescription: string }} Menu-specific terminal-row metadata.
|
|
4546
4793
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered terminal menu rows.
|
|
4547
4794
|
- @satisfies REQ-193
|
|
4548
4795
|
|
|
4549
|
-
### iface `interface ResetConfirmationChange` (
|
|
4796
|
+
### iface `interface ResetConfirmationChange` (L331-335)
|
|
4550
4797
|
- @brief Describes one pending reset value change shown in confirmation menus.
|
|
4551
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.
|
|
4552
4799
|
|
|
4553
|
-
### fn `function formatResetConfirmationValue(previousValue: string, nextValue: string): string` (
|
|
4800
|
+
### fn `function formatResetConfirmationValue(previousValue: string, nextValue: string): string` (L344-346)
|
|
4554
4801
|
- @brief Formats one reset-confirmation value pair for menu display.
|
|
4555
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.
|
|
4556
4803
|
- @param[in] previousValue {string} Current persisted value.
|
|
4557
4804
|
- @param[in] nextValue {string} Candidate default value.
|
|
4558
4805
|
- @return {string} Rendered preview string.
|
|
4559
4806
|
|
|
4560
|
-
### fn `function buildResetConfirmationChoices(` (
|
|
4807
|
+
### fn `function buildResetConfirmationChoices(` (L356-395)
|
|
4561
4808
|
- @brief Builds the shared settings-menu choices for one reset-confirmation submenu.
|
|
4562
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.
|
|
4563
4810
|
- @param[in] changes {ResetConfirmationChange[]} Changed-value preview rows.
|
|
@@ -4565,7 +4812,7 @@ cost.
|
|
|
4565
4812
|
- @param[in] abortDescription {string} Description for the abort action.
|
|
4566
4813
|
- @return {PiUsereqSettingsMenuChoice[]} Reset-confirmation submenu choices.
|
|
4567
4814
|
|
|
4568
|
-
### fn `async function confirmResetChanges(` (
|
|
4815
|
+
### fn `async function confirmResetChanges(` (L407-420)
|
|
4569
4816
|
- @brief Opens one explicit reset-confirmation submenu.
|
|
4570
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.
|
|
4571
4818
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
@@ -4575,60 +4822,73 @@ cost.
|
|
|
4575
4822
|
- @param[in] abortDescription {string} Description for the abort action.
|
|
4576
4823
|
- @return {Promise<boolean>} `true` when the reset is explicitly approved.
|
|
4577
4824
|
|
|
4578
|
-
### fn `function
|
|
4579
|
-
- @brief Writes
|
|
4580
|
-
- @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.
|
|
4581
4835
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
4582
4836
|
- @param[in] cwd {string} Current working directory.
|
|
4583
|
-
- @param[in] _config {UseReqConfig} Unused effective project configuration retained for stable call-site shape.
|
|
4584
4837
|
- @return {void} No return value.
|
|
4585
4838
|
- @satisfies REQ-031
|
|
4586
4839
|
|
|
4587
|
-
### 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)
|
|
4588
4848
|
- @brief Builds the supported-tag guidance lines embedded in search-tool registrations.
|
|
4589
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.
|
|
4590
4850
|
- @return {string[]} Supported-tag guidance lines.
|
|
4591
4851
|
|
|
4592
|
-
### fn `function buildSearchToolSchemaDescription(scope: FindToolScope): string` (
|
|
4852
|
+
### fn `function buildSearchToolSchemaDescription(scope: FindToolScope): string` (L536-541)
|
|
4593
4853
|
- @brief Builds the schema description for one search-tool registration.
|
|
4594
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.
|
|
4595
4855
|
- @param[in] scope {FindToolScope} Search-tool scope.
|
|
4596
4856
|
- @return {string} Parameter-schema description.
|
|
4597
4857
|
|
|
4598
|
-
### fn `function buildSearchToolPromptGuidelines(scope: FindToolScope): string[]` (
|
|
4858
|
+
### fn `function buildSearchToolPromptGuidelines(scope: FindToolScope): string[]` (L549-562)
|
|
4599
4859
|
- @brief Builds the prompt-guideline set for one search-tool registration.
|
|
4600
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.
|
|
4601
4861
|
- @param[in] scope {FindToolScope} Search-tool scope.
|
|
4602
4862
|
- @return {string[]} Prompt-guideline strings.
|
|
4603
4863
|
|
|
4604
|
-
- type `type MonolithicToolRenderResult = {` (
|
|
4864
|
+
- type `type MonolithicToolRenderResult = {` (L568)
|
|
4605
4865
|
- @brief Describes the monolithic tool-result surface consumed by tool-row renderers.
|
|
4606
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.
|
|
4607
|
-
### fn `function getMonolithicToolText(result: MonolithicToolRenderResult): string` (
|
|
4867
|
+
### fn `function getMonolithicToolText(result: MonolithicToolRenderResult): string` (L585-588)
|
|
4608
4868
|
- @brief Extracts the primary monolithic text block from one tool result.
|
|
4609
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.
|
|
4610
4870
|
- @param[in] result {MonolithicToolRenderResult} Tool result wrapper.
|
|
4611
4871
|
- @return {string} Primary monolithic content text.
|
|
4612
4872
|
|
|
4613
|
-
### fn `function getMonolithicToolErrorText(result: MonolithicToolRenderResult): string | undefined` (
|
|
4873
|
+
### fn `function getMonolithicToolErrorText(result: MonolithicToolRenderResult): string | undefined` (L596-606)
|
|
4614
4874
|
- @brief Reads the first residual execution error string from one monolithic tool result.
|
|
4615
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.
|
|
4616
4876
|
- @param[in] result {MonolithicToolRenderResult} Tool result wrapper.
|
|
4617
4877
|
- @return {string | undefined} First residual execution error string.
|
|
4618
4878
|
|
|
4619
|
-
### fn `function formatCompactToolArgumentValue(value: unknown): string | undefined` (
|
|
4879
|
+
### fn `function formatCompactToolArgumentValue(value: unknown): string | undefined` (L614-653)
|
|
4620
4880
|
- @brief Formats one scalar or structural tool argument for compact render summaries.
|
|
4621
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.
|
|
4622
4882
|
- @param[in] value {unknown} Candidate tool argument value.
|
|
4623
4883
|
- @return {string | undefined} Compact preview string or `undefined` when the value carries no useful summary.
|
|
4624
4884
|
|
|
4625
|
-
### fn `function buildCompactToolInvocationText(args: Record<string, unknown> | undefined): string` (
|
|
4885
|
+
### fn `function buildCompactToolInvocationText(args: Record<string, unknown> | undefined): string` (L661-672)
|
|
4626
4886
|
- @brief Builds the compact invocation summary appended to collapsed tool rows.
|
|
4627
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.
|
|
4628
4888
|
- @param[in] args {Record<string, unknown> | undefined} Current tool call arguments.
|
|
4629
4889
|
- @return {string} Compact invocation summary prefixed with one separating space, or the empty string when no useful preview exists.
|
|
4630
4890
|
|
|
4631
|
-
### fn `function summarizeStructuredToolResult(` (
|
|
4891
|
+
### fn `function summarizeStructuredToolResult(` (L682-697)
|
|
4632
4892
|
- @brief Builds the compact default text for one monolithic tool result row.
|
|
4633
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.
|
|
4634
4894
|
- @param[in] toolName {string} Registered tool name.
|
|
@@ -4636,20 +4896,27 @@ cost.
|
|
|
4636
4896
|
- @param[in] args {Record<string, unknown> | undefined} Current tool call arguments.
|
|
4637
4897
|
- @return {string} Compact single-line summary.
|
|
4638
4898
|
|
|
4639
|
-
### fn `function buildStructuredToolRenderResult(toolName: string)` (
|
|
4899
|
+
### fn `function buildStructuredToolRenderResult(toolName: string)` (L706-725)
|
|
4640
4900
|
- @brief Builds a custom `renderResult` implementation for one monolithic tool.
|
|
4641
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.
|
|
4642
4902
|
- @param[in] toolName {string} Registered tool name.
|
|
4643
4903
|
- @return {(result: MonolithicToolRenderResult, options: { expanded?: boolean; isPartial?: boolean }, _theme: unknown, context: { args?: Record<string, unknown>; lastComponent?: unknown }) => Text} Custom result renderer.
|
|
4644
4904
|
- @satisfies REQ-210
|
|
4645
4905
|
|
|
4646
|
-
### fn `function executeMonolithicTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (
|
|
4906
|
+
### fn `function executeMonolithicTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (L733-739)
|
|
4647
4907
|
- @brief Executes one CLI-style runner for a monolithic agent tool.
|
|
4648
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.
|
|
4649
4909
|
- @param[in] operation {() => ToolResult} Runner callback.
|
|
4650
4910
|
- @return {ReturnType<typeof buildMonolithicToolExecuteResult>} Monolithic tool execute result.
|
|
4651
4911
|
|
|
4652
|
-
### fn `function
|
|
4912
|
+
### fn `function executeStatusTool(operation: () => ToolResult): ReturnType<typeof buildMonolithicToolExecuteResult>` (L748-777)
|
|
4913
|
+
- @brief Executes one CLI-style runner for a status-only agent tool.
|
|
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.
|
|
4915
|
+
- @param[in] operation {() => ToolResult} Runner callback.
|
|
4916
|
+
- @return {ReturnType<typeof buildMonolithicToolExecuteResult>} Status-only tool execute result.
|
|
4917
|
+
- @satisfies REQ-294, REQ-295, REQ-296
|
|
4918
|
+
|
|
4919
|
+
### fn `function deliverPromptCommand(` (L788-806)
|
|
4653
4920
|
- @brief Starts delivery of one rendered prompt into the current active session.
|
|
4654
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.
|
|
4655
4922
|
- @param[in] pi {ExtensionAPI} Handler-scoped extension API instance retained as the fallback dispatcher.
|
|
@@ -4658,7 +4925,7 @@ cost.
|
|
|
4658
4925
|
- @return {Promise<void>} Promise representing eventual prompt-delivery completion.
|
|
4659
4926
|
- @satisfies REQ-004, REQ-067, REQ-068, REQ-227, REQ-281
|
|
4660
4927
|
|
|
4661
|
-
### fn `function shouldIgnoreLatePromptDeliveryFailure(` (
|
|
4928
|
+
### fn `function shouldIgnoreLatePromptDeliveryFailure(` (L817-833)
|
|
4662
4929
|
- @brief Detects prompt-delivery failures that can be ignored after prompt ownership has moved past the command handler.
|
|
4663
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.
|
|
4664
4931
|
- @param[in] error {unknown} Candidate prompt-delivery failure.
|
|
@@ -4667,7 +4934,7 @@ cost.
|
|
|
4667
4934
|
- @return {boolean} `true` when the failure is a late stale-context delivery rejection that MUST be ignored.
|
|
4668
4935
|
- @satisfies REQ-208, REQ-280, REQ-281, REQ-282
|
|
4669
4936
|
|
|
4670
|
-
### fn `function logPromptWorkflowStateChange(` (
|
|
4937
|
+
### fn `function logPromptWorkflowStateChange(` (L846-865)
|
|
4671
4938
|
- @brief Appends one workflow-state debug entry for a bundled prompt when selected.
|
|
4672
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.
|
|
4673
4940
|
- @param[in] projectBase {string} Absolute original project base path.
|
|
@@ -4678,7 +4945,7 @@ cost.
|
|
|
4678
4945
|
- @return {void} No return value.
|
|
4679
4946
|
- @satisfies REQ-245, REQ-246, REQ-247
|
|
4680
4947
|
|
|
4681
|
-
### fn `function logPromptWorkflowEvent(` (
|
|
4948
|
+
### fn `function logPromptWorkflowEvent(` (L881-901)
|
|
4682
4949
|
- @brief Appends one dedicated prompt workflow debug entry when selected.
|
|
4683
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.
|
|
4684
4951
|
- @param[in] projectBase {string} Absolute original project base path.
|
|
@@ -4692,7 +4959,7 @@ cost.
|
|
|
4692
4959
|
- @return {void} No return value.
|
|
4693
4960
|
- @satisfies REQ-245, REQ-246, REQ-247, REQ-277
|
|
4694
4961
|
|
|
4695
|
-
### fn `function transitionPromptWorkflowState(` (
|
|
4962
|
+
### fn `function transitionPromptWorkflowState(` (L914-927)
|
|
4696
4963
|
- @brief Transitions one prompt workflow state and logs the transition immediately after the state update.
|
|
4697
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.
|
|
4698
4965
|
- @param[in] ctx {ExtensionContext | ExtensionCommandContext} Active extension context.
|
|
@@ -4703,20 +4970,20 @@ cost.
|
|
|
4703
4970
|
- @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
|
|
4704
4971
|
- @return {void} No return value.
|
|
4705
4972
|
|
|
4706
|
-
### fn `function resolvePromptCommandDescription(` (
|
|
4973
|
+
### fn `function resolvePromptCommandDescription(` (L935-939)
|
|
4707
4974
|
- @brief Resolves the runtime slash-command description for one bundled prompt.
|
|
4708
|
-
- @details Reads the bundled prompt
|
|
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.
|
|
4709
4976
|
- @param[in] promptName {import("./core/prompt-command-catalog.js").PromptCommandName} Bundled prompt name.
|
|
4710
4977
|
- @return {string} Runtime command description.
|
|
4711
4978
|
|
|
4712
|
-
### fn `function resolveDebugProjectBase(cwd: string, statusController: PiUsereqStatusController): string` (
|
|
4979
|
+
### fn `function resolveDebugProjectBase(cwd: string, statusController: PiUsereqStatusController): string` (L948-952)
|
|
4713
4980
|
- @brief Resolves the original project base used for debug-log file writes.
|
|
4714
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.
|
|
4715
4982
|
- @param[in] cwd {string} Current extension working directory.
|
|
4716
4983
|
- @param[in] statusController {PiUsereqStatusController} Mutable status controller.
|
|
4717
4984
|
- @return {string} Absolute original project base path for debug logging.
|
|
4718
4985
|
|
|
4719
|
-
### fn `function notifyContextSafely(` (
|
|
4986
|
+
### fn `function notifyContextSafely(` (L963-980)
|
|
4720
4987
|
- @brief Delivers one best-effort UI notification without failing on stale replacement contexts.
|
|
4721
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.
|
|
4722
4989
|
- @param[in] ctx {ExtensionContext | ExtensionCommandContext | undefined} Candidate UI context.
|
|
@@ -4725,20 +4992,30 @@ cost.
|
|
|
4725
4992
|
- @return {boolean} `true` when the notification was delivered and `false` when the context was already stale.
|
|
4726
4993
|
- @satisfies REQ-280
|
|
4727
4994
|
|
|
4728
|
-
### fn `function
|
|
4995
|
+
### fn `function rejectNonIdleReqCommand(` (L992-1012)
|
|
4996
|
+
- @brief Rejects one non-`idle` req-command invocation and records the workflow error state.
|
|
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.
|
|
4998
|
+
- @param[in] ctx {ExtensionContext | ExtensionCommandContext} Active extension context.
|
|
4999
|
+
- @param[in] promptName {import("./core/prompt-command-catalog.js").PromptCommandName | undefined} Optional bundled prompt name used for prompt debug logging.
|
|
5000
|
+
- @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
|
|
5001
|
+
- @return {never} This helper always throws a deterministic `ReqError`.
|
|
5002
|
+
- @throws {ReqError} Always throws because non-`idle` req commands are rejected.
|
|
5003
|
+
- @satisfies REQ-224
|
|
5004
|
+
|
|
5005
|
+
### fn `function getPiUsereqStartupTools(pi: ExtensionAPI): ToolInfo[]` (L1021-1029)
|
|
4729
5006
|
- @brief Returns the configurable active-tool inventory visible to the extension.
|
|
4730
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.
|
|
4731
5008
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
4732
5009
|
- @return {ToolInfo[]} Sorted configurable tool descriptors.
|
|
4733
5010
|
- @satisfies REQ-007, REQ-063, REQ-231, REQ-232
|
|
4734
5011
|
|
|
4735
|
-
### fn `function getConfiguredEnabledPiUsereqTools(config: UseReqConfig): string[]` (
|
|
5012
|
+
### fn `function getConfiguredEnabledPiUsereqTools(config: UseReqConfig): string[]` (L1037-1041)
|
|
4736
5013
|
- @brief Normalizes and returns the configured enabled active tools.
|
|
4737
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"]`.
|
|
4738
5015
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
4739
5016
|
- @return {string[]} Normalized enabled tool names.
|
|
4740
5017
|
|
|
4741
|
-
### fn `function applyConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig): void` (
|
|
5018
|
+
### fn `function applyConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig): void` (L1051-1068)
|
|
4742
5019
|
- @brief Applies the configured active-tool enablement to the current session.
|
|
4743
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(...)`.
|
|
4744
5021
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -4746,18 +5023,18 @@ cost.
|
|
|
4746
5023
|
- @return {void} No return value.
|
|
4747
5024
|
- @satisfies REQ-009, REQ-064
|
|
4748
5025
|
|
|
4749
|
-
### fn `async function handleExtensionStatusEvent(` (
|
|
5026
|
+
### fn `async function handleExtensionStatusEvent(` (L1081-1352)
|
|
4750
5027
|
- @brief Handles one intercepted pi lifecycle hook for pi-usereq status updates.
|
|
4751
|
-
- @details Applies session-start-specific resource validation, project-config refresh, startup-tool enablement, and selected debug-tool logging before forwarding the originating hook name and payload into the shared `updateExtensionStatus(...)` pipeline. Before `agent_start`, re-verifies any prepared prompt execution session switch. On `agent_end`, dispatches configured command-notify, sound, and prompt-specific Pushover effects, logs dedicated workflow-closure diagnostics, restores the original session-backed `base-path` for every matched worktree-backed completion by reusing persisted replacement-session command contexts when event contexts omit `switchSession()`,
|
|
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.
|
|
4752
5029
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
4753
5030
|
- @param[in] hookName {PiUsereqStatusHookName} Intercepted hook name.
|
|
4754
5031
|
- @param[in] event {unknown} Hook payload forwarded by pi.
|
|
4755
5032
|
- @param[in] ctx {ExtensionContext} Active extension context.
|
|
4756
5033
|
- @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
|
|
4757
5034
|
- @return {Promise<void>} Promise resolved when hook processing completes.
|
|
4758
|
-
- @satisfies REQ-117, REQ-118, REQ-119, REQ-131, REQ-132, REQ-133, REQ-166, REQ-167, REQ-168, REQ-169, REQ-172, REQ-176, REQ-178, REQ-184, REQ-185, REQ-186, REQ-187, REQ-208, REQ-209, REQ-221, REQ-228, REQ-229, REQ-230, REQ-244, REQ-245, REQ-246, REQ-247, REQ-276, REQ-277, REQ-278, REQ-279, REQ-280
|
|
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
|
|
4759
5036
|
|
|
4760
|
-
### fn `function registerExtensionStatusHooks(` (
|
|
5037
|
+
### fn `function registerExtensionStatusHooks(` (L1368-1387)
|
|
4761
5038
|
- @brief Registers shared wrappers for every supported pi lifecycle hook.
|
|
4762
5039
|
- @details Installs one generic wrapper per intercepted hook so every resource,
|
|
4763
5040
|
session, agent, model, tool, bash, and input event is routed through the
|
|
@@ -4771,7 +5048,7 @@ registered hook count. Side effects include hook registration.
|
|
|
4771
5048
|
- @return {void} No return value.
|
|
4772
5049
|
- @satisfies DES-002, REQ-113, REQ-114, REQ-115, REQ-116, REQ-117
|
|
4773
5050
|
|
|
4774
|
-
### fn `function setConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig, enabledTools: string[]): void` (
|
|
5051
|
+
### fn `function setConfiguredPiUsereqTools(pi: ExtensionAPI, config: UseReqConfig, enabledTools: string[]): void` (L1397-1400)
|
|
4775
5052
|
- @brief Replaces the configured active-tool selection and applies it immediately.
|
|
4776
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.
|
|
4777
5054
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -4779,26 +5056,26 @@ registered hook count. Side effects include hook registration.
|
|
|
4779
5056
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
4780
5057
|
- @return {void} No return value.
|
|
4781
5058
|
|
|
4782
|
-
### fn `function getDebugToolToggleNames(): PiUsereqStartupToolName[]` (
|
|
5059
|
+
### fn `function getDebugToolToggleNames(): PiUsereqStartupToolName[]` (L1408-1410)
|
|
4783
5060
|
- @brief Returns the canonical debug-tool toggle order.
|
|
4784
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.
|
|
4785
5062
|
- @return {PiUsereqStartupToolName[]} Ordered debug-tool toggle names.
|
|
4786
5063
|
- @satisfies REQ-242
|
|
4787
5064
|
|
|
4788
|
-
### fn `function resetDebugConfigToDefaults(config: UseReqConfig): void` (
|
|
5065
|
+
### fn `function resetDebugConfigToDefaults(config: UseReqConfig): void` (L1419-1427)
|
|
4789
5066
|
- @brief Restores the debug configuration subtree to its documented defaults.
|
|
4790
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`.
|
|
4791
5068
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
4792
5069
|
- @return {void} No return value.
|
|
4793
5070
|
- @satisfies REQ-236, REQ-237, REQ-238, REQ-239, REQ-195, REQ-277
|
|
4794
5071
|
|
|
4795
|
-
### fn `function formatDebugMenuSummary(config: UseReqConfig): string` (
|
|
5072
|
+
### fn `function formatDebugMenuSummary(config: UseReqConfig): string` (L1435-1441)
|
|
4796
5073
|
- @brief Formats the top-level Debug summary value.
|
|
4797
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.
|
|
4798
5075
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
4799
5076
|
- @return {string} Compact debug summary string.
|
|
4800
5077
|
|
|
4801
|
-
### fn `function buildDebugMenuChoice(` (
|
|
5078
|
+
### fn `function buildDebugMenuChoice(` (L1451-1464)
|
|
4802
5079
|
- @brief Builds one debug-menu row with optional disabled styling.
|
|
4803
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.
|
|
4804
5081
|
- @param[in] choice {PiUsereqSettingsMenuChoice} Base debug-menu row.
|
|
@@ -4806,21 +5083,21 @@ registered hook count. Side effects include hook registration.
|
|
|
4806
5083
|
- @return {PiUsereqSettingsMenuChoice} Styled debug-menu row.
|
|
4807
5084
|
- @satisfies REQ-241
|
|
4808
5085
|
|
|
4809
|
-
### fn `async function selectDebugLogOnStatus(` (
|
|
5086
|
+
### fn `async function selectDebugLogOnStatus(` (L1473-1501)
|
|
4810
5087
|
- @brief Opens the workflow-state filter selector used by the Debug submenu.
|
|
4811
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.
|
|
4812
5089
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
4813
5090
|
- @param[in] currentValue {DebugLogOnStatus} Current persisted workflow-state filter.
|
|
4814
5091
|
- @return {Promise<DebugLogOnStatus | undefined>} Selected workflow-state filter or `undefined` when cancelled.
|
|
4815
5092
|
|
|
4816
|
-
### fn `function buildDebugMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5093
|
+
### fn `function buildDebugMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L1510-1586)
|
|
4817
5094
|
- @brief Builds the shared settings-menu choices for debug logging configuration.
|
|
4818
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.
|
|
4819
5096
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
4820
5097
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered debug-menu choices.
|
|
4821
5098
|
- @satisfies REQ-240, REQ-241, REQ-242, REQ-243, REQ-193, REQ-277
|
|
4822
5099
|
|
|
4823
|
-
### fn `async function configureDebugMenu(` (
|
|
5100
|
+
### fn `async function configureDebugMenu(` (L1596-1765)
|
|
4824
5101
|
- @brief Runs the interactive Debug submenu.
|
|
4825
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.
|
|
4826
5103
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
@@ -4828,45 +5105,45 @@ registered hook count. Side effects include hook registration.
|
|
|
4828
5105
|
- @return {Promise<void>} Promise resolved when the submenu closes.
|
|
4829
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
|
|
4830
5107
|
|
|
4831
|
-
- type `type PiNotifyBooleanConfigKey =` (
|
|
5108
|
+
- type `type PiNotifyBooleanConfigKey =` (L1771)
|
|
4832
5109
|
- @brief Represents one persisted boolean notification-setting key.
|
|
4833
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.
|
|
4834
|
-
- type `type PiNotifyEventBooleanConfigKey = Exclude<` (
|
|
5111
|
+
- type `type PiNotifyEventBooleanConfigKey = Exclude<` (L1788)
|
|
4835
5112
|
- @brief Represents one persisted boolean notification event-toggle key.
|
|
4836
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.
|
|
4837
|
-
- type `type PiNotifyEventId = "completed" | "interrupted" | "failed";` (
|
|
5114
|
+
- type `type PiNotifyEventId = "completed" | "interrupted" | "failed";` (L1797)
|
|
4838
5115
|
- @brief Represents one shared prompt-end event identifier used by notification menus.
|
|
4839
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.
|
|
4840
|
-
### iface `interface PiNotifyEventRowDefinition` (
|
|
5117
|
+
### iface `interface PiNotifyEventRowDefinition` (L1803-1807)
|
|
4841
5118
|
- @brief Describes one shared prompt-end event row rendered inside notification event submenus.
|
|
4842
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.
|
|
4843
5120
|
|
|
4844
|
-
### iface `interface PiNotifyEventMenuDefinition` (
|
|
5121
|
+
### iface `interface PiNotifyEventMenuDefinition` (L1813-1819)
|
|
4845
5122
|
- @brief Describes one notification-system event submenu contract.
|
|
4846
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.
|
|
4847
5124
|
|
|
4848
|
-
### fn `function togglePiNotifyFlag(config: UseReqConfig, key: PiNotifyBooleanConfigKey): boolean` (
|
|
5125
|
+
### fn `function togglePiNotifyFlag(config: UseReqConfig, key: PiNotifyBooleanConfigKey): boolean` (L1828-1831)
|
|
4849
5126
|
- @brief Flips one persisted boolean notification setting.
|
|
4850
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`.
|
|
4851
5128
|
- @param[in] key {PiNotifyBooleanConfigKey} Boolean configuration key to toggle.
|
|
4852
5129
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
4853
5130
|
- @return {boolean} Next enabled state.
|
|
4854
5131
|
|
|
4855
|
-
### fn `function resetPiNotifyConfigToDefaults(config: UseReqConfig): void` (
|
|
5132
|
+
### fn `function resetPiNotifyConfigToDefaults(config: UseReqConfig): void` (L1840-1864)
|
|
4856
5133
|
- @brief Restores notification-related settings to their documented defaults.
|
|
4857
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`.
|
|
4858
5135
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
4859
5136
|
- @return {void} No return value.
|
|
4860
5137
|
- @satisfies REQ-174, REQ-178, REQ-184, REQ-195, REQ-196
|
|
4861
5138
|
|
|
4862
|
-
### fn `function formatPiNotifyPushoverPriority(priority: PiNotifyPushoverPriority): string` (
|
|
5139
|
+
### fn `function formatPiNotifyPushoverPriority(priority: PiNotifyPushoverPriority): string` (L1873-1875)
|
|
4863
5140
|
- @brief Formats one persisted Pushover priority for menu display.
|
|
4864
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.
|
|
4865
5142
|
- @param[in] priority {PiNotifyPushoverPriority} Persisted Pushover priority.
|
|
4866
5143
|
- @return {string} Menu-display label.
|
|
4867
5144
|
- @satisfies REQ-172
|
|
4868
5145
|
|
|
4869
|
-
### fn `function formatPiNotifyEventMenuSummary(` (
|
|
5146
|
+
### fn `function formatPiNotifyEventMenuSummary(` (L1959-1967)
|
|
4870
5147
|
- @brief Formats the top-level summary value for one notification event submenu.
|
|
4871
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.
|
|
4872
5149
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
@@ -4874,7 +5151,7 @@ registered hook count. Side effects include hook registration.
|
|
|
4874
5151
|
- @return {string} Compact enabled-toggle summary.
|
|
4875
5152
|
- @satisfies REQ-198
|
|
4876
5153
|
|
|
4877
|
-
### fn `function buildPiNotifyEventLauncherChoice(` (
|
|
5154
|
+
### fn `function buildPiNotifyEventLauncherChoice(` (L1977-1987)
|
|
4878
5155
|
- @brief Builds the top-level launcher row for one notification event submenu.
|
|
4879
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.
|
|
4880
5157
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
@@ -4882,7 +5159,7 @@ registered hook count. Side effects include hook registration.
|
|
|
4882
5159
|
- @return {PiUsereqSettingsMenuChoice} Launcher row for the selected event submenu.
|
|
4883
5160
|
- @satisfies REQ-181, REQ-183, REQ-165, REQ-198
|
|
4884
5161
|
|
|
4885
|
-
### fn `function buildPiNotifyEventMenuChoices(` (
|
|
5162
|
+
### fn `function buildPiNotifyEventMenuChoices(` (L1997-2013)
|
|
4886
5163
|
- @brief Builds the shared settings-menu choices for one notification event submenu.
|
|
4887
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.
|
|
4888
5165
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
@@ -4890,7 +5167,7 @@ registered hook count. Side effects include hook registration.
|
|
|
4890
5167
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered event-submenu choice vector.
|
|
4891
5168
|
- @satisfies REQ-188, REQ-193, REQ-198
|
|
4892
5169
|
|
|
4893
|
-
### fn `function resetPiNotifyEventMenuToDefaults(` (
|
|
5170
|
+
### fn `function resetPiNotifyEventMenuToDefaults(` (L2023-2031)
|
|
4894
5171
|
- @brief Restores one notification event submenu to its documented defaults.
|
|
4895
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`.
|
|
4896
5173
|
- @param[in] eventMenu {PiNotifyEventMenuDefinition} Notification-system event submenu contract.
|
|
@@ -4898,7 +5175,7 @@ registered hook count. Side effects include hook registration.
|
|
|
4898
5175
|
- @return {void} No return value.
|
|
4899
5176
|
- @satisfies REQ-174, REQ-178, REQ-184, REQ-195
|
|
4900
5177
|
|
|
4901
|
-
### fn `function resolvePiNotifyEventLabel(` (
|
|
5178
|
+
### fn `function resolvePiNotifyEventLabel(` (L2041-2048)
|
|
4902
5179
|
- @brief Resolves the human-readable event label for one event-toggle config key.
|
|
4903
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.
|
|
4904
5181
|
- @param[in] key {PiNotifyEventBooleanConfigKey} Event-toggle configuration key.
|
|
@@ -4906,7 +5183,7 @@ registered hook count. Side effects include hook registration.
|
|
|
4906
5183
|
- @return {string} Human-readable event label.
|
|
4907
5184
|
- @satisfies REQ-188, REQ-198
|
|
4908
5185
|
|
|
4909
|
-
### fn `async function configurePiNotifyEventMenu(` (
|
|
5186
|
+
### fn `async function configurePiNotifyEventMenu(` (L2059-2135)
|
|
4910
5187
|
- @brief Runs one dedicated notification event submenu.
|
|
4911
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.
|
|
4912
5189
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
@@ -4915,14 +5192,14 @@ registered hook count. Side effects include hook registration.
|
|
|
4915
5192
|
- @return {Promise<void>} Promise resolved when the submenu closes.
|
|
4916
5193
|
- @satisfies REQ-188, REQ-192, REQ-193, REQ-195, REQ-198
|
|
4917
5194
|
|
|
4918
|
-
### fn `function buildPiNotifyPushoverRows(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5195
|
+
### fn `function buildPiNotifyPushoverRows(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2144-2194)
|
|
4919
5196
|
- @brief Builds the direct Pushover rows rendered inside `Notifications`.
|
|
4920
|
-
- @details Serializes the global enable flag, shared-event submenu launcher, priority, title, text, and credential rows into right-valued menu items appended after the sound-command rows, dims and disables the enable row until both credentials are populated, and escapes control characters for the single-line `Pushover text` value. Runtime is O(n) in the rendered text-template length. No external state is mutated.
|
|
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.
|
|
4921
5198
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
4922
5199
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered direct Pushover rows.
|
|
4923
5200
|
- @satisfies REQ-163, REQ-165, REQ-172, REQ-184, REQ-185, REQ-198, REQ-234, REQ-235
|
|
4924
5201
|
|
|
4925
|
-
### fn `async function selectPiNotifyPushoverPriority(` (
|
|
5202
|
+
### fn `async function selectPiNotifyPushoverPriority(` (L2204-2232)
|
|
4926
5203
|
- @brief Opens the shared settings-menu selector for Pushover priority.
|
|
4927
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.
|
|
4928
5205
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
@@ -4930,58 +5207,82 @@ registered hook count. Side effects include hook registration.
|
|
|
4930
5207
|
- @return {Promise<PiNotifyPushoverPriority | "reset-defaults" | undefined>} Selected priority, reset action, or `undefined` when cancelled.
|
|
4931
5208
|
- @satisfies REQ-172, REQ-192
|
|
4932
5209
|
|
|
4933
|
-
### fn `function buildPiNotifyMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5210
|
+
### fn `function buildPiNotifyMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L2241-2299)
|
|
4934
5211
|
- @brief Builds the shared settings-menu choices for notification configuration.
|
|
4935
|
-
- @details Serializes command-notify, sound, and Pushover blocks with dedicated shared-event submenu launchers so the settings-menu renderer can expose one unified but modular configuration surface, including locked Pushover enablement and escaped single-line rendering for `Pushover text`. Runtime is O(n) in the longest rendered command or text field. No external state is mutated.
|
|
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.
|
|
4936
5213
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
4937
5214
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered notification-menu choice vector.
|
|
4938
|
-
- @satisfies REQ-137, REQ-149, REQ-150, REQ-151, REQ-152, REQ-163, REQ-164, REQ-165, REQ-172, REQ-179, REQ-181, REQ-183, REQ-188, REQ-193, REQ-198, REQ-234, REQ-235
|
|
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
|
|
4939
5216
|
|
|
4940
|
-
### fn `async function selectPiNotifySoundLevel(` (
|
|
4941
|
-
- @brief Opens the shared settings-menu selector for the
|
|
4942
|
-
- @details Reuses the pi-usereq settings-menu renderer so sound
|
|
5217
|
+
### fn `async function selectPiNotifySoundLevel(` (L2309-2349)
|
|
5218
|
+
- @brief Opens the shared settings-menu selector for the persisted boot sound level.
|
|
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.
|
|
4943
5220
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
4944
|
-
- @param[in] currentLevel {PiNotifySoundLevel}
|
|
4945
|
-
- @return {Promise<PiNotifySoundLevel | "reset-defaults" | undefined>} Selected sound level, reset action, or `undefined` when cancelled.
|
|
4946
|
-
- @satisfies REQ-131, REQ-179, REQ-192
|
|
5221
|
+
- @param[in] currentLevel {PiNotifySoundLevel} Persisted boot sound level.
|
|
5222
|
+
- @return {Promise<PiNotifySoundLevel | "reset-defaults" | undefined>} Selected boot sound level, reset action, or `undefined` when cancelled.
|
|
5223
|
+
- @satisfies REQ-131, REQ-179, REQ-192, REQ-289
|
|
4947
5224
|
|
|
4948
|
-
### fn `async function configurePiNotifyMenu(` (
|
|
5225
|
+
### fn `async function configurePiNotifyMenu(` (L2359-2645)
|
|
4949
5226
|
- @brief Runs the interactive notification-configuration menu.
|
|
4950
|
-
- @details Exposes command-notify, sound, and Pushover controls through the shared settings-menu renderer, delegates completed/interrupted/failed toggles to dedicated event submenus, keeps `Enable pushover` locked until both credentials are populated, decodes escaped control-sequence input for `Pushover text`, and preserves row focus across menu re-renders. Runtime depends on user interaction count. Side effects include UI updates and config mutation.
|
|
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.
|
|
4951
5228
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
4952
5229
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
4953
5230
|
- @return {Promise<boolean>} `true` when the sound-toggle shortcut changed.
|
|
4954
|
-
- @satisfies REQ-131, REQ-133, REQ-134, REQ-137, REQ-163, REQ-164, REQ-165, REQ-172, REQ-179, REQ-181, REQ-183, REQ-184, REQ-188, REQ-192, REQ-193, REQ-195, REQ-196, REQ-198, REQ-234, REQ-235
|
|
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
|
|
4955
5232
|
|
|
4956
|
-
### fn `function registerPiNotifyShortcut(` (
|
|
5233
|
+
### fn `function registerPiNotifyShortcut(` (L2660-2683)
|
|
4957
5234
|
- @brief Registers the configurable notification-sound shortcut when supported.
|
|
4958
|
-
- @details Loads the current
|
|
4959
|
-
the runtime exposes `registerShortcut(...)`, cycles
|
|
4960
|
-
|
|
4961
|
-
notification. Runtime is O(1) for registration
|
|
4962
|
-
use. Side effects include shortcut
|
|
4963
|
-
updates.
|
|
5235
|
+
- @details Loads the current effective config, registers one raw pi shortcut when
|
|
5236
|
+
the runtime exposes `registerShortcut(...)`, cycles only the active runtime
|
|
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
|
|
5239
|
+
plus one status update per shortcut use. Side effects include shortcut
|
|
5240
|
+
registration and status updates.
|
|
5241
|
+
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
5242
|
+
- @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
|
|
5243
|
+
- @return {void} No return value.
|
|
5244
|
+
- @satisfies REQ-134, REQ-180, REQ-286, REQ-287
|
|
5245
|
+
|
|
5246
|
+
### fn `function resolveReqResetPromptRequest(` (L2691-2717)
|
|
5247
|
+
- @brief Resolves the prompt execution plan targeted by `req-reset` recovery.
|
|
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.
|
|
5249
|
+
- @param[in] statusController {PiUsereqStatusController} Mutable status controller.
|
|
5250
|
+
- @return {PromptCommandExecutionPlan | undefined} Recoverable prompt execution plan when one remains available.
|
|
5251
|
+
|
|
5252
|
+
### fn `const isWorktreeBacked = (request: PromptCommandExecutionPlan | undefined): request is PromptCommandExecutionPlan =>` (L2694-2701)
|
|
5253
|
+
|
|
5254
|
+
### fn `function registerReqResetCommand(` (L2727-2781)
|
|
5255
|
+
- @brief Registers the specialized `req-reset` slash command.
|
|
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.
|
|
5257
|
+
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
5258
|
+
- @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
|
|
5259
|
+
- @return {void} No return value.
|
|
5260
|
+
- @satisfies REQ-304, REQ-305, REQ-306, REQ-307, REQ-308, REQ-309, REQ-310, REQ-311, REQ-312, REQ-313
|
|
5261
|
+
|
|
5262
|
+
### fn `function registerReqReferencesCommand(` (L2791-2831)
|
|
5263
|
+
- @brief Registers the specialized `req-references` slash command.
|
|
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.
|
|
4964
5265
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
4965
5266
|
- @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
|
|
4966
5267
|
- @return {void} No return value.
|
|
4967
|
-
- @satisfies REQ-
|
|
5268
|
+
- @satisfies REQ-200, REQ-221, REQ-224, REQ-298, REQ-299, REQ-300, REQ-301, REQ-302, REQ-303
|
|
4968
5269
|
|
|
4969
|
-
### fn `function registerPromptCommands(` (
|
|
4970
|
-
- @brief Registers bundled prompt commands with the extension.
|
|
4971
|
-
- @details Creates one `req-<prompt>` command per bundled prompt name. Each handler rejects non-`idle` workflow state, transitions the shared workflow state through `checking`, `error`, and `running`, runs dedicated prompt-command git and required-doc preflight checks, optionally prepares a dedicated worktree execution plan using the active session directory, persists the prompt metadata needed for switch-triggered rebinding, switches the active session to the verified execution cwd before prompt handoff, logs dedicated workflow-activation diagnostics, renders the prompt, starts prompt delivery into the forked active session, records `running` immediately after delivery handoff begins, and then awaits the wrapped prompt-delivery promise whose stale post-restore rejections are suppressed. Runtime is O(p) for registration; handler cost depends on prompt preflight, worktree preparation, session switching, prompt rendering, prompt dispatch, and optional debug logging. Side effects include command registration, status-controller mutation, worktree creation, active-session replacement, optional worktree rollback, user-message delivery during execution, and optional debug-log writes.
|
|
5270
|
+
### fn `function registerPromptCommands(` (L2841-2957)
|
|
5271
|
+
- @brief Registers bundled prompt-backed commands with the extension.
|
|
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.
|
|
4972
5273
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
4973
5274
|
- @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
|
|
4974
5275
|
- @return {void} No return value.
|
|
4975
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
|
|
4976
5277
|
|
|
4977
|
-
### fn `function registerAgentTools(pi: ExtensionAPI): void` (
|
|
5278
|
+
### fn `function registerAgentTools(pi: ExtensionAPI): void` (L2967-3266)
|
|
4978
5279
|
- @brief Registers pi-usereq agent tools exposed to the model.
|
|
4979
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.
|
|
4980
5281
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
4981
5282
|
- @return {void} No return value.
|
|
4982
|
-
- @satisfies REQ-005, REQ-010, REQ-011, REQ-014, REQ-017, REQ-044, REQ-069, REQ-070, REQ-071, REQ-072, REQ-073, REQ-074, REQ-075, REQ-076, REQ-077, REQ-078, REQ-079, REQ-080, REQ-089, REQ-090, REQ-091, REQ-092, REQ-093, REQ-094, REQ-095, REQ-096, REQ-097, REQ-098, REQ-099, REQ-100, REQ-101, REQ-102
|
|
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
|
|
4983
5284
|
|
|
4984
|
-
### fn `function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5285
|
+
### fn `function buildPiUsereqToolsMenuChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3311-3336)
|
|
4985
5286
|
- @brief Builds the shared settings-menu choices for startup-tool management.
|
|
4986
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.
|
|
4987
5288
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -4989,7 +5290,7 @@ updates.
|
|
|
4989
5290
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered startup-tool menu choices.
|
|
4990
5291
|
- @satisfies REQ-007, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193
|
|
4991
5292
|
|
|
4992
|
-
### fn `function buildPiUsereqToolToggleChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5293
|
+
### fn `function buildPiUsereqToolToggleChoices(pi: ExtensionAPI, config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3346-3360)
|
|
4993
5294
|
- @brief Builds the shared settings-menu choices for per-tool startup toggles.
|
|
4994
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.
|
|
4995
5296
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -4997,108 +5298,108 @@ updates.
|
|
|
4997
5298
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered per-tool toggle choices.
|
|
4998
5299
|
- @satisfies REQ-007, REQ-151, REQ-152, REQ-153, REQ-154, REQ-231, REQ-232
|
|
4999
5300
|
|
|
5000
|
-
### fn `async function configurePiUsereqToolsMenu(` (
|
|
5301
|
+
### fn `async function configurePiUsereqToolsMenu(` (L3371-3488)
|
|
5001
5302
|
- @brief Runs the interactive active-tool configuration menu.
|
|
5002
|
-
- @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.
|
|
5003
5304
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
5004
5305
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
5005
5306
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
5006
5307
|
- @return {Promise<void>} Promise resolved when the menu closes.
|
|
5007
5308
|
- @satisfies REQ-007, REQ-063, REQ-064, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193, REQ-231, REQ-232
|
|
5008
5309
|
|
|
5009
|
-
### fn `function getStaticCheckLanguageConfigForMenu(` (
|
|
5310
|
+
### fn `function getStaticCheckLanguageConfigForMenu(` (L3497-3502)
|
|
5010
5311
|
- @brief Resolves one static-check language config for menu rendering.
|
|
5011
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.
|
|
5012
5313
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5013
5314
|
- @param[in] language {string} Canonical language name.
|
|
5014
5315
|
- @return {StaticCheckLanguageConfig} Resolved per-language config object.
|
|
5015
5316
|
|
|
5016
|
-
### fn `function countConfiguredStaticCheckLanguages(config: UseReqConfig): number` (
|
|
5317
|
+
### fn `function countConfiguredStaticCheckLanguages(config: UseReqConfig): number` (L3510-3512)
|
|
5017
5318
|
- @brief Counts languages that currently expose at least one configured checker.
|
|
5018
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.
|
|
5019
5320
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5020
5321
|
- @return {number} Number of languages with at least one configured checker.
|
|
5021
5322
|
|
|
5022
|
-
### fn `function countEnabledStaticCheckLanguages(config: UseReqConfig): number` (
|
|
5323
|
+
### fn `function countEnabledStaticCheckLanguages(config: UseReqConfig): number` (L3520-3522)
|
|
5023
5324
|
- @brief Counts languages whose static-check enable flag is on.
|
|
5024
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.
|
|
5025
5326
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5026
5327
|
- @return {number} Number of enabled languages.
|
|
5027
5328
|
|
|
5028
|
-
### fn `function resetStaticCheckConfig(config: UseReqConfig): void` (
|
|
5329
|
+
### fn `function resetStaticCheckConfig(config: UseReqConfig): void` (L3531-3533)
|
|
5029
5330
|
- @brief Restores the documented static-check default configuration.
|
|
5030
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`.
|
|
5031
5332
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
5032
5333
|
- @return {void} No return value.
|
|
5033
5334
|
- @satisfies REQ-250, REQ-251, REQ-252
|
|
5034
5335
|
|
|
5035
|
-
### fn `function formatStaticCheckLanguagesSummary(config: UseReqConfig): string` (
|
|
5336
|
+
### fn `function formatStaticCheckLanguagesSummary(config: UseReqConfig): string` (L3541-3543)
|
|
5036
5337
|
- @brief Summarizes enabled and configured static-check languages.
|
|
5037
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.
|
|
5038
5339
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5039
5340
|
- @return {string} Compact summary string.
|
|
5040
5341
|
|
|
5041
|
-
### fn `function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5342
|
+
### fn `function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3552-3584)
|
|
5042
5343
|
- @brief Builds the shared settings-menu choices for static-check management.
|
|
5043
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.
|
|
5044
5345
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5045
5346
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered static-check menu choices.
|
|
5046
5347
|
- @satisfies REQ-008, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-248
|
|
5047
5348
|
|
|
5048
|
-
### fn `function buildSupportedStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5349
|
+
### fn `function buildSupportedStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3592-3609)
|
|
5049
5350
|
- @brief Builds the shared settings-menu choices for supported static-check languages.
|
|
5050
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.
|
|
5051
5352
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5052
5353
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered language-choice vector.
|
|
5053
5354
|
|
|
5054
|
-
### fn `function buildConfiguredStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5355
|
+
### fn `function buildConfiguredStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3617-3634)
|
|
5055
5356
|
- @brief Builds the shared settings-menu choices for configured static-check languages.
|
|
5056
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.
|
|
5057
5358
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5058
5359
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered configured-language vector.
|
|
5059
5360
|
|
|
5060
|
-
### fn `async function configureStaticCheckMenu(` (
|
|
5361
|
+
### fn `async function configureStaticCheckMenu(` (L3644-3790)
|
|
5061
5362
|
- @brief Runs the interactive static-check configuration menu.
|
|
5062
|
-
- @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.
|
|
5063
5364
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
5064
5365
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
5065
5366
|
- @return {Promise<void>} Promise resolved when the menu closes.
|
|
5066
5367
|
- @satisfies REQ-008, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-195, REQ-248, REQ-253
|
|
5067
5368
|
|
|
5068
|
-
### fn `function buildPiUsereqMenuChoices(` (
|
|
5369
|
+
### fn `function buildPiUsereqMenuChoices(` (L3800-3899)
|
|
5069
5370
|
- @brief Builds the shared settings-menu choices for the top-level pi-usereq configuration UI.
|
|
5070
|
-
- @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.
|
|
5071
5372
|
- @param[in] cwd {string} Current working directory.
|
|
5072
5373
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5073
5374
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered top-level menu choices.
|
|
5074
|
-
- @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
|
|
5075
5376
|
|
|
5076
|
-
### fn `function buildSrcDirMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5377
|
+
### fn `function buildSrcDirMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3908-3926)
|
|
5077
5378
|
- @brief Builds the shared settings-menu choices for source-directory management.
|
|
5078
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.
|
|
5079
5380
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5080
5381
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered source-directory management choices.
|
|
5081
5382
|
- @satisfies REQ-006, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193
|
|
5082
5383
|
|
|
5083
|
-
### fn `function buildSrcDirRemovalChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5384
|
+
### fn `function buildSrcDirRemovalChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3935-3947)
|
|
5084
5385
|
- @brief Builds the shared settings-menu choices for removing one source-directory entry.
|
|
5085
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.
|
|
5086
5387
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5087
5388
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered removable source-directory choices.
|
|
5088
5389
|
- @satisfies REQ-006, REQ-151, REQ-152, REQ-153, REQ-154
|
|
5089
5390
|
|
|
5090
|
-
### fn `async function configurePiUsereq(` (
|
|
5391
|
+
### fn `async function configurePiUsereq(` (L3958-4211)
|
|
5091
5392
|
- @brief Runs the top-level pi-usereq configuration menu.
|
|
5092
|
-
- @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.
|
|
5093
5394
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
5094
5395
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
5095
5396
|
- @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
|
|
5096
5397
|
- @return {Promise<void>} Promise resolved when configuration is saved and the menu closes.
|
|
5097
|
-
- @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
|
|
5098
5399
|
|
|
5099
|
-
### fn `const persistConfigChange = () =>` (
|
|
5400
|
+
### fn `const persistConfigChange = () =>` (L3969-3974)
|
|
5100
5401
|
|
|
5101
|
-
### fn `function registerConfigCommands(` (
|
|
5402
|
+
### fn `function registerConfigCommands(` (L4221-4231)
|
|
5102
5403
|
- @brief Registers configuration-management commands.
|
|
5103
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.
|
|
5104
5405
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5106,110 +5407,110 @@ updates.
|
|
|
5106
5407
|
- @return {void} No return value.
|
|
5107
5408
|
- @satisfies REQ-006, REQ-031
|
|
5108
5409
|
|
|
5109
|
-
### fn `export default function piUsereqExtension(pi: ExtensionAPI): void` (
|
|
5410
|
+
### fn `export default function piUsereqExtension(pi: ExtensionAPI): void` (L4240-4250)
|
|
5110
5411
|
- @brief Registers the complete pi-usereq extension.
|
|
5111
|
-
- @details Validates installation-owned bundled resources, registers prompt and
|
|
5112
|
-
configuration commands plus agent tools, registers the configurable
|
|
5113
|
-
notification-sound shortcut when the runtime supports shortcuts, and
|
|
5114
|
-
installs shared wrappers for all supported pi lifecycle hooks so status
|
|
5115
|
-
telemetry, context usage, prompt timing, cumulative runtime, prompt-specific
|
|
5116
|
-
Pushover metadata, tool-result debug logging, and prompt-orchestration debug
|
|
5117
|
-
effects remain synchronized with runtime events. Runtime is O(h) in hook
|
|
5118
|
-
count during registration. Side effects include filesystem reads,
|
|
5119
|
-
command/tool/shortcut registration, UI updates, active-tool changes,
|
|
5120
|
-
optional debug-log writes, and timer scheduling.
|
|
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.
|
|
5121
5413
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
5122
5414
|
- @return {void} No return value.
|
|
5123
|
-
- @satisfies DES-002, REQ-004, REQ-005, REQ-009, REQ-044, REQ-067, REQ-068, REQ-109, REQ-111, REQ-112, REQ-113, REQ-114, REQ-115, REQ-116, REQ-117, REQ-118, REQ-119, REQ-120, REQ-121, REQ-122, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-131, REQ-132, REQ-133, REQ-134, REQ-137, REQ-159, REQ-163, REQ-164, REQ-165, REQ-166, REQ-167, REQ-168, REQ-169, REQ-172, REQ-174, REQ-179, REQ-180, REQ-184, REQ-188, REQ-190, REQ-191, REQ-192, REQ-193, REQ-194, REQ-195, REQ-196, REQ-197, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243, REQ-244, REQ-245, REQ-246, REQ-247
|
|
5415
|
+
- @satisfies DES-002, REQ-004, REQ-005, REQ-009, REQ-044, REQ-067, REQ-068, REQ-109, REQ-111, REQ-112, REQ-113, REQ-114, REQ-115, REQ-116, REQ-117, REQ-118, REQ-119, REQ-120, REQ-121, REQ-122, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-131, REQ-132, REQ-133, REQ-134, REQ-137, REQ-159, REQ-163, REQ-164, REQ-165, REQ-166, REQ-167, REQ-168, REQ-169, REQ-172, REQ-174, REQ-179, REQ-180, REQ-184, REQ-188, REQ-190, REQ-191, REQ-192, REQ-193, REQ-194, REQ-195, REQ-196, REQ-197, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243, REQ-244, REQ-245, REQ-246, REQ-247, REQ-298, REQ-299, REQ-300, REQ-301, REQ-302, REQ-303, REQ-304, REQ-305, REQ-306, REQ-312, REQ-313
|
|
5124
5416
|
|
|
5125
5417
|
## Symbol Index
|
|
5126
5418
|
|Symbol|Kind|Vis|Lines|Sig|
|
|
5127
5419
|
|---|---|---|---|---|
|
|
5128
|
-
|`PiShortcutRegistrar`|iface||
|
|
5129
|
-
|`getProjectBase`|fn||
|
|
5130
|
-
|`getProcessCwdSafe`|fn||
|
|
5131
|
-
|`resolveLiveBootstrapCwd`|fn||
|
|
5132
|
-
|`syncContextCwdMirror`|fn||
|
|
5133
|
-
|`loadProjectConfig`|fn||
|
|
5134
|
-
|`saveProjectConfig`|fn||
|
|
5135
|
-
|`
|
|
5136
|
-
|`
|
|
5137
|
-
|`
|
|
5138
|
-
|`
|
|
5139
|
-
|`
|
|
5140
|
-
|`
|
|
5141
|
-
|`
|
|
5142
|
-
|`
|
|
5143
|
-
|`
|
|
5144
|
-
|`
|
|
5145
|
-
|`
|
|
5146
|
-
|`
|
|
5147
|
-
|`
|
|
5148
|
-
|`
|
|
5149
|
-
|`
|
|
5150
|
-
|`
|
|
5151
|
-
|`
|
|
5152
|
-
|`
|
|
5153
|
-
|`
|
|
5154
|
-
|`
|
|
5155
|
-
|`
|
|
5156
|
-
|`
|
|
5157
|
-
|`
|
|
5158
|
-
|`
|
|
5159
|
-
|`
|
|
5160
|
-
|`
|
|
5161
|
-
|`
|
|
5162
|
-
|`
|
|
5163
|
-
|`
|
|
5164
|
-
|`
|
|
5165
|
-
|`
|
|
5166
|
-
|`
|
|
5167
|
-
|`
|
|
5168
|
-
|`
|
|
5169
|
-
|`
|
|
5170
|
-
|`
|
|
5171
|
-
|`
|
|
5172
|
-
|`
|
|
5173
|
-
|`
|
|
5174
|
-
|`
|
|
5175
|
-
|`
|
|
5176
|
-
|`
|
|
5177
|
-
|`
|
|
5178
|
-
|`
|
|
5179
|
-
|`
|
|
5180
|
-
|`
|
|
5181
|
-
|`
|
|
5182
|
-
|`
|
|
5183
|
-
|`
|
|
5184
|
-
|`
|
|
5185
|
-
|`
|
|
5186
|
-
|`
|
|
5187
|
-
|`
|
|
5188
|
-
|`
|
|
5189
|
-
|`
|
|
5190
|
-
|`
|
|
5191
|
-
|`
|
|
5192
|
-
|`
|
|
5193
|
-
|`
|
|
5194
|
-
|`
|
|
5195
|
-
|`
|
|
5196
|
-
|`
|
|
5197
|
-
|`
|
|
5198
|
-
|`
|
|
5199
|
-
|`
|
|
5200
|
-
|`
|
|
5201
|
-
|`
|
|
5202
|
-
|`
|
|
5203
|
-
|`
|
|
5204
|
-
|`
|
|
5205
|
-
|`
|
|
5206
|
-
|`
|
|
5207
|
-
|`
|
|
5208
|
-
|`
|
|
5209
|
-
|`
|
|
5210
|
-
|`
|
|
5211
|
-
|`
|
|
5212
|
-
|`
|
|
5213
|
-
|`
|
|
5214
|
-
|`
|
|
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...|
|
|
5215
5516
|
|