pi-usereq 0.12.0 → 0.32.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/.github/workflows/release-npm.yml +13 -6
- package/.gitignore +1 -2
- package/CHANGELOG.md +145 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/pi-usereq/docs/REFERENCES.md +629 -396
- package/pi-usereq/docs/REQUIREMENTS.md +70 -46
- package/pi-usereq/docs/WORKFLOW.md +83 -42
- package/src/core/config.ts +553 -180
- package/src/core/debug-runtime.ts +24 -0
- package/src/core/extension-status.ts +2 -2
- package/src/core/path-context.ts +19 -4
- package/src/index.ts +248 -44
- package/tests/attended-results-scenarios.ts +10 -4
- package/tests/cli-command-option-parity.test.ts +28 -10
- package/tests/debug-extension-harness.test.ts +7 -9
- package/tests/extension-registration.test.ts +314 -123
- package/tests/helpers.ts +29 -6
- package/tests/release-workflow.test.ts +3 -2
- package/scripts/lib/extension-debug-harness.ts +0 -443
- package/scripts/lib/recording-extension-api.ts +0 -855
- package/scripts/lib/sdk-smoke.ts +0 -503
|
@@ -45,6 +45,13 @@ export const DEFAULT_DEBUG_STATUS_CHANGES = "disable" as const;
|
|
|
45
45
|
*/
|
|
46
46
|
export const DEFAULT_DEBUG_WORKFLOW_EVENTS = "disable" as const;
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @brief Defines the default debug-tool command-wrapper mode.
|
|
50
|
+
* @details New configs suppress debug slash-command wrappers for selected built-in tools until the user explicitly enables them from the `Debug` submenu. Access complexity is O(1).
|
|
51
|
+
* @satisfies CTN-019, REQ-322
|
|
52
|
+
*/
|
|
53
|
+
export const DEFAULT_DEBUG_TOOL_COMMANDS_ENABLED = "disable" as const;
|
|
54
|
+
|
|
48
55
|
/**
|
|
49
56
|
* @brief Defines the default workflow-status filter used by debug logging.
|
|
50
57
|
* @details New configs log only entries whose workflow state equals `running` until the user selects a broader or different workflow-state filter. Access complexity is O(1).
|
|
@@ -98,6 +105,12 @@ export type DebugStatusChanges = "enable" | "disable";
|
|
|
98
105
|
*/
|
|
99
106
|
export type DebugWorkflowEvents = "enable" | "disable";
|
|
100
107
|
|
|
108
|
+
/**
|
|
109
|
+
* @brief Represents one persisted debug-tool command-wrapper flag.
|
|
110
|
+
* @details Restricts debug slash-command wrapper registration to the documented `enable|disable` domain. The alias is compile-time only and introduces no runtime cost.
|
|
111
|
+
*/
|
|
112
|
+
export type DebugToolCommandsEnabled = "enable" | "disable";
|
|
113
|
+
|
|
101
114
|
/**
|
|
102
115
|
* @brief Represents one persisted workflow-status filter value.
|
|
103
116
|
* @details Restricts debug log filtering to `any` or one explicit documented workflow state. The alias is compile-time only and introduces no runtime cost.
|
|
@@ -191,6 +204,17 @@ export function normalizeDebugWorkflowEvents(value: unknown): DebugWorkflowEvent
|
|
|
191
204
|
return value === "enable" ? "enable" : DEFAULT_DEBUG_WORKFLOW_EVENTS;
|
|
192
205
|
}
|
|
193
206
|
|
|
207
|
+
/**
|
|
208
|
+
* @brief Normalizes one persisted debug-tool command-wrapper flag.
|
|
209
|
+
* @details Accepts only the documented `enable|disable` values and falls back to `DEFAULT_DEBUG_TOOL_COMMANDS_ENABLED` for all other payloads. Runtime is O(1). No external state is mutated.
|
|
210
|
+
* @param[in] value {unknown} Candidate persisted debug-tool command-wrapper payload.
|
|
211
|
+
* @return {DebugToolCommandsEnabled} Canonical debug-tool command-wrapper flag.
|
|
212
|
+
* @satisfies CTN-019, REQ-322
|
|
213
|
+
*/
|
|
214
|
+
export function normalizeDebugToolCommandsEnabled(value: unknown): DebugToolCommandsEnabled {
|
|
215
|
+
return value === "enable" ? "enable" : DEFAULT_DEBUG_TOOL_COMMANDS_ENABLED;
|
|
216
|
+
}
|
|
217
|
+
|
|
194
218
|
/**
|
|
195
219
|
* @brief Normalizes one persisted debug workflow-status filter.
|
|
196
220
|
* @details Accepts only the documented `any` token or one explicit workflow state and falls back to `DEFAULT_DEBUG_LOG_ON_STATUS` for all other payloads. Runtime is O(1). No external state is mutated.
|
|
@@ -689,7 +689,7 @@ export function setPiUsereqStatusConfig(
|
|
|
689
689
|
|
|
690
690
|
/**
|
|
691
691
|
* @brief Returns the active runtime sound level tracked by the status controller.
|
|
692
|
-
* @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
|
|
692
|
+
* @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.
|
|
693
693
|
* @param[in] controller {PiUsereqStatusController} Mutable status controller.
|
|
694
694
|
* @return {PiNotifySoundLevel} Active runtime sound level.
|
|
695
695
|
* @satisfies REQ-180, REQ-285
|
|
@@ -702,7 +702,7 @@ export function getPiUsereqRuntimeSoundLevel(
|
|
|
702
702
|
|
|
703
703
|
/**
|
|
704
704
|
* @brief Stores one new runtime sound level and refreshes the status bar.
|
|
705
|
-
* @details Mutates only the in-memory runtime sound state so shortcut-driven sound changes do not update
|
|
705
|
+
* @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.
|
|
706
706
|
* @param[in,out] controller {PiUsereqStatusController} Mutable status controller.
|
|
707
707
|
* @param[in] runtimeSoundLevel {PiNotifySoundLevel} Next active runtime sound level.
|
|
708
708
|
* @param[in] ctx {ExtensionContext | undefined} Optional active extension context.
|
package/src/core/path-context.ts
CHANGED
|
@@ -11,11 +11,17 @@ import { fileURLToPath } from "node:url";
|
|
|
11
11
|
import type { UseReqConfig } from "./config.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @brief Defines the per-project configuration file name.
|
|
15
|
-
* @details The file lives directly under `base-path` and stores only persisted project configuration. Access complexity is O(1).
|
|
14
|
+
* @brief Defines the per-project local configuration file name.
|
|
15
|
+
* @details The file lives directly under `base-path` and stores only persisted project-scoped configuration. Access complexity is O(1).
|
|
16
16
|
*/
|
|
17
17
|
export const PROJECT_CONFIG_FILENAME = ".pi-usereq.json";
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @brief Defines the home-relative global configuration file path.
|
|
21
|
+
* @details The path is resolved against the current user home directory and stores persisted cross-project configuration. Access complexity is O(1).
|
|
22
|
+
*/
|
|
23
|
+
export const GLOBAL_CONFIG_RELATIVE_PATH = ".config/pi-usereq/config.json";
|
|
24
|
+
|
|
19
25
|
/**
|
|
20
26
|
* @brief Defines the bundled resources directory name under the installation path.
|
|
21
27
|
* @details The directory contains prompts, templates, and guidelines shipped with the installed extension payload. Access complexity is O(1).
|
|
@@ -155,15 +161,24 @@ export function normalizeRelativeDirContract(value: string): string {
|
|
|
155
161
|
}
|
|
156
162
|
|
|
157
163
|
/**
|
|
158
|
-
* @brief Computes the absolute project config path for one base path.
|
|
164
|
+
* @brief Computes the absolute local project config path for one base path.
|
|
159
165
|
* @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.
|
|
160
166
|
* @param[in] basePath {string} Absolute or relative base path.
|
|
161
|
-
* @return {string} Absolute config-file path.
|
|
167
|
+
* @return {string} Absolute local config-file path.
|
|
162
168
|
*/
|
|
163
169
|
export function getConfigPath(basePath: string): string {
|
|
164
170
|
return path.join(path.resolve(basePath), PROJECT_CONFIG_FILENAME);
|
|
165
171
|
}
|
|
166
172
|
|
|
173
|
+
/**
|
|
174
|
+
* @brief Computes the absolute global config path for the current user.
|
|
175
|
+
* @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.
|
|
176
|
+
* @return {string} Absolute global config-file path.
|
|
177
|
+
*/
|
|
178
|
+
export function getGlobalConfigPath(): string {
|
|
179
|
+
return path.join(os.homedir(), GLOBAL_CONFIG_RELATIVE_PATH);
|
|
180
|
+
}
|
|
181
|
+
|
|
167
182
|
/**
|
|
168
183
|
* @brief Tests whether one path is identical to or an ancestor of another path.
|
|
169
184
|
* @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.
|