pi-usereq 0.44.0 → 0.45.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 +18 -0
- package/README.md +1 -1
- package/package.json +7 -2
- package/pi-usereq/docs/REFERENCES.md +95 -53
- package/pi-usereq/docs/REQUIREMENTS.md +20 -5
- package/pi-usereq/docs/WORKFLOW.md +12 -5
- package/scripts/install-static-checkers.ts +48 -1
- package/src/core/static-check.ts +13 -7
- package/src/index.ts +200 -4
- package/tests/extension-registration.test.ts +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.45.0](https://github.com/Ogekuri/PI-useReq/compare/v0.44.0..v0.45.0) - 2026-07-13
|
|
4
|
+
### 🐛 Bug Fixes
|
|
5
|
+
- Fix packages.
|
|
6
|
+
- Fix packages.
|
|
7
|
+
|
|
8
|
+
### 🚜 Changes
|
|
9
|
+
- add view/reset menu actions, removal confirmation, embedded keyword resolution, approve-scripts [useReq] *(static-check)*
|
|
10
|
+
- REQ-008/248/345-349: add View static code checker (read-only, before
|
|
11
|
+
- Remove), Reset static code checker (after Remove, restores embedded
|
|
12
|
+
- defaults), and require config preview plus confirmation before Remove.
|
|
13
|
+
- DES-019/REQ-350/351: resolveCheckerExecutable substitutes the
|
|
14
|
+
- %%INSTALLATION_PATH%% keyword and fixes hoisted node_modules/.bin probing.
|
|
15
|
+
- DES-020/REQ-352: postinstall best-effort runs npm approve-scripts for
|
|
16
|
+
- bundled checker dependencies before probing.
|
|
17
|
+
- Update REQUIREMENTS/WORKFLOW/REFERENCES and the static-check menu test.
|
|
18
|
+
|
|
3
19
|
## [0.44.0](https://github.com/Ogekuri/PI-useReq/compare/v0.43.0..v0.44.0) - 2026-07-13
|
|
4
20
|
### 🚜 Changes
|
|
5
21
|
- BREAKING CHANGE: park failed worktree runs in error without resuming base-path [useReq] *(prompt-closure)*
|
|
@@ -609,6 +625,7 @@
|
|
|
609
625
|
- \[0.42.0\]: https://github.com/Ogekuri/PI-useReq/releases/tag/v0.42.0
|
|
610
626
|
- \[0.43.0\]: https://github.com/Ogekuri/PI-useReq/releases/tag/v0.43.0
|
|
611
627
|
- \[0.44.0\]: https://github.com/Ogekuri/PI-useReq/releases/tag/v0.44.0
|
|
628
|
+
- \[0.45.0\]: https://github.com/Ogekuri/PI-useReq/releases/tag/v0.45.0
|
|
612
629
|
|
|
613
630
|
[0.1.0]: https://github.com/Ogekuri/PI-useReq/releases/tag/v0.1.0
|
|
614
631
|
[0.2.0]: https://github.com/Ogekuri/PI-useReq/compare/v0.1.0..v0.2.0
|
|
@@ -652,3 +669,4 @@
|
|
|
652
669
|
[0.42.0]: https://github.com/Ogekuri/PI-useReq/compare/v0.41.0..v0.42.0
|
|
653
670
|
[0.43.0]: https://github.com/Ogekuri/PI-useReq/compare/v0.42.0..v0.43.0
|
|
654
671
|
[0.44.0]: https://github.com/Ogekuri/PI-useReq/compare/v0.43.0..v0.44.0
|
|
672
|
+
[0.45.0]: https://github.com/Ogekuri/PI-useReq/compare/v0.44.0..v0.45.0
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-usereq",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/Ogekuri/PI-useReq.git"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@sinclair/typebox": "^0.34.49"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"eslint": "^10.
|
|
37
|
+
"eslint": "^10.7.0",
|
|
38
38
|
"fast-glob": "^3.3.3",
|
|
39
39
|
"js-tiktoken": "^1.0.21",
|
|
40
40
|
"pyright": "^1.1.411",
|
|
@@ -45,5 +45,10 @@
|
|
|
45
45
|
"@eslint/js": "^10.0.1",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"typescript-eslint": "^8.58.2"
|
|
48
|
+
},
|
|
49
|
+
"allowScripts": {
|
|
50
|
+
"esbuild@0.27.7": true,
|
|
51
|
+
"koffi@2.15.6": true,
|
|
52
|
+
"protobufjs@7.5.4": true
|
|
48
53
|
}
|
|
49
54
|
}
|
|
@@ -4091,7 +4091,7 @@ import { formatDoxygenFieldsAsMarkdown, parseDoxygenComment } from "./doxygen-pa
|
|
|
4091
4091
|
|
|
4092
4092
|
---
|
|
4093
4093
|
|
|
4094
|
-
# static-check.ts | TypeScript |
|
|
4094
|
+
# static-check.ts | TypeScript | 601L | 18 symbols | 8 imports | 31 comments
|
|
4095
4095
|
> Path: `src/core/static-check.ts`
|
|
4096
4096
|
- @brief Defines static-check language mappings and checker dispatch implementations.
|
|
4097
4097
|
- @details Parses Command-only user static-check specifications, preserves debug `Dummy` config handling, resolves file targets, and runs modular dummy or command-based analyzers. Runtime is linear in file count plus external tool cost. Side effects include filesystem reads, PATH probing, process spawning, and console output.
|
|
@@ -4173,7 +4173,7 @@ import { getInstallationPath } from "./path-context.js";
|
|
|
4173
4173
|
- @brief Provides the shared and debug-capable base implementation for file-oriented static checks.
|
|
4174
4174
|
- @details Resolves input files once, emits standardized headers, implements the debug `Dummy` checker behavior, and defines overridable `checkFile` plus `emitLine` hooks used by concrete analyzers. Runtime is O(f) plus subclass checker cost. Side effects include console output.
|
|
4175
4175
|
|
|
4176
|
-
### class `export class StaticCheckCommand extends StaticCheckBase` : StaticCheckBase (L389-
|
|
4176
|
+
### class `export class StaticCheckCommand extends StaticCheckBase` : StaticCheckBase (L389-439)
|
|
4177
4177
|
- @brief Runs the user-facing external-command static checker.
|
|
4178
4178
|
- @brief Initializes a command-backed checker instance.
|
|
4179
4179
|
- @details Validates command availability on PATH during construction, then invokes the command with configured extra arguments plus one target file at a time. Runtime is dominated by external command execution. Side effects include PATH probing, process spawning, and console output.
|
|
@@ -4184,33 +4184,33 @@ import { getInstallationPath } from "./path-context.js";
|
|
|
4184
4184
|
- @param[in] failOnly {boolean} When `true`, suppress successful-file output.
|
|
4185
4185
|
- @throws {ReqError} Throws when the executable cannot be found on PATH.
|
|
4186
4186
|
|
|
4187
|
-
### fn `function isExecutableFile(candidate: string): boolean` (
|
|
4187
|
+
### fn `function isExecutableFile(candidate: string): boolean` (L447-457)
|
|
4188
4188
|
- @brief Tests whether one filesystem path is executable.
|
|
4189
4189
|
- @details Requires the candidate to exist, be a regular file, and pass `X_OK` access checks. Runtime is O(1). Side effects are limited to filesystem reads.
|
|
4190
4190
|
- @param[in] candidate {string} Absolute or relative path to inspect.
|
|
4191
4191
|
- @return {boolean} `true` when the candidate is executable by the current process.
|
|
4192
4192
|
|
|
4193
|
-
### fn `export function findExecutable(cmd: string): string | undefined` (
|
|
4193
|
+
### fn `export function findExecutable(cmd: string): string | undefined` (L465-476)
|
|
4194
4194
|
- @brief Locates an executable by scanning the current PATH.
|
|
4195
4195
|
- @details Checks each PATH directory for an executable file named exactly as the requested command. Runtime is O(p) in PATH entry count. Side effects are filesystem reads.
|
|
4196
4196
|
- @param[in] cmd {string} Executable name to locate.
|
|
4197
4197
|
- @return {string | undefined} Absolute executable path, or `undefined` when not found.
|
|
4198
4198
|
|
|
4199
|
-
### fn `export function resolveCheckerExecutable(cmd: string): string | undefined` (
|
|
4200
|
-
- @brief Resolves one checker executable across bundled `node_modules/.bin
|
|
4201
|
-
- @details
|
|
4202
|
-
- @param[in] cmd {string} Executable name or
|
|
4199
|
+
### fn `export function resolveCheckerExecutable(cmd: string): string | undefined` (L485-505)
|
|
4200
|
+
- @brief Resolves one checker executable across installation-keyword, bundled `node_modules/.bin`, and PATH locations.
|
|
4201
|
+
- @details Substitutes the `%%INSTALLATION_PATH%%` keyword with the runtime installation path and verifies the resulting explicit path when present, then probes the installation-owned `node_modules/.bin` directory, the project-scope parent `node_modules/.bin` directory used by `--prefix` layouts, and finally the system PATH scan, returning the first executable match so default configuration requires no target-project module installation. Runtime is O(p) in PATH entry count plus bounded filesystem metadata checks. Side effects are limited to filesystem reads.
|
|
4202
|
+
- @param[in] cmd {string} Executable name, explicit path, or `%%INSTALLATION_PATH%%`-anchored path to resolve.
|
|
4203
4203
|
- @return {string | undefined} Absolute executable path, or `undefined` when not found in any probed location.
|
|
4204
|
-
- @satisfies REQ-023, REQ-037, DES-018
|
|
4204
|
+
- @satisfies REQ-023, REQ-037, DES-018, DES-019, REQ-350, REQ-351
|
|
4205
4205
|
|
|
4206
|
-
### fn `export function checkDefaultCheckersAvailability(config: UseReqConfig): string[]` (
|
|
4206
|
+
### fn `export function checkDefaultCheckersAvailability(config: UseReqConfig): string[]` (L514-534)
|
|
4207
4207
|
- @brief Determines which enabled static-check executables are missing from the runtime environment.
|
|
4208
4208
|
- @details Iterates every enabled language checker entry in the effective config, resolves each `Command` entry executable through `resolveCheckerExecutable`, and collects the missing command names so the caller can surface one consolidated warning. Runtime is O(l * c * p) where l is language count, c is checker count, and p is PATH entry count. Side effects are limited to filesystem reads.
|
|
4209
4209
|
- @param[in] config {UseReqConfig} Effective merged configuration.
|
|
4210
4210
|
- @return {string[]} Unique command names that are enabled but unresolvable.
|
|
4211
4211
|
- @satisfies REQ-341, REQ-343, REQ-344
|
|
4212
4212
|
|
|
4213
|
-
### fn `export function dispatchStaticCheckForFile(` (
|
|
4213
|
+
### fn `export function dispatchStaticCheckForFile(` (L545-548)
|
|
4214
4214
|
- @brief Dispatches one configured static checker for a single file.
|
|
4215
4215
|
- @details Selects the debug `Dummy` or user-facing `Command` implementation by module name, normalizes parameter arrays, and runs exactly one checker instance against the target file. Runtime is dominated by the selected checker. Side effects include console output and possible process spawning.
|
|
4216
4216
|
- @param[in] filePath {string} Absolute or relative file path to check.
|
|
@@ -4219,7 +4219,7 @@ import { getInstallationPath } from "./path-context.js";
|
|
|
4219
4219
|
- @return {number} Checker exit status where `0` means success and non-zero means failure.
|
|
4220
4220
|
- @throws {ReqError} Throws when configuration is incomplete or names an unknown module.
|
|
4221
4221
|
|
|
4222
|
-
### fn `export function runStaticCheck(argv: string[]): number` (
|
|
4222
|
+
### fn `export function runStaticCheck(argv: string[]): number` (L577-601)
|
|
4223
4223
|
- @brief Runs the standalone static-check test driver.
|
|
4224
4224
|
- @details Dispatches debug `dummy` or user-facing `command` subcommands without consulting project configuration. Runtime is O(n) in argument count plus checker cost. Side effects include console output and external process spawning.
|
|
4225
4225
|
- @param[in] argv {string[]} Raw static-check subcommand arguments.
|
|
@@ -4240,13 +4240,13 @@ import { getInstallationPath } from "./path-context.js";
|
|
|
4240
4240
|
|`validateStaticCheckEntry`|fn||260-271|export function validateStaticCheckEntry(entry: StaticChe...|
|
|
4241
4241
|
|`resolveFiles`|fn||279-303|function resolveFiles(inputs: string[]): string[]|
|
|
4242
4242
|
|`StaticCheckBase`|class||309-383|export class StaticCheckBase|
|
|
4243
|
-
|`StaticCheckCommand`|class||389-
|
|
4244
|
-
|`isExecutableFile`|fn||
|
|
4245
|
-
|`findExecutable`|fn||
|
|
4246
|
-
|`resolveCheckerExecutable`|fn||
|
|
4247
|
-
|`checkDefaultCheckersAvailability`|fn||
|
|
4248
|
-
|`dispatchStaticCheckForFile`|fn||
|
|
4249
|
-
|`runStaticCheck`|fn||
|
|
4243
|
+
|`StaticCheckCommand`|class||389-439|export class StaticCheckCommand extends StaticCheckBase|
|
|
4244
|
+
|`isExecutableFile`|fn||447-457|function isExecutableFile(candidate: string): boolean|
|
|
4245
|
+
|`findExecutable`|fn||465-476|export function findExecutable(cmd: string): string | und...|
|
|
4246
|
+
|`resolveCheckerExecutable`|fn||485-505|export function resolveCheckerExecutable(cmd: string): st...|
|
|
4247
|
+
|`checkDefaultCheckersAvailability`|fn||514-534|export function checkDefaultCheckersAvailability(config: ...|
|
|
4248
|
+
|`dispatchStaticCheckForFile`|fn||545-548|export function dispatchStaticCheckForFile(|
|
|
4249
|
+
|`runStaticCheck`|fn||577-601|export function runStaticCheck(argv: string[]): number|
|
|
4250
4250
|
|
|
4251
4251
|
|
|
4252
4252
|
---
|
|
@@ -4769,7 +4769,7 @@ import path from "node:path";
|
|
|
4769
4769
|
|
|
4770
4770
|
---
|
|
4771
4771
|
|
|
4772
|
-
# index.ts | TypeScript |
|
|
4772
|
+
# index.ts | TypeScript | 4820L | 111 symbols | 27 imports | 129 comments
|
|
4773
4773
|
> Path: `src/index.ts`
|
|
4774
4774
|
- @brief Registers the pi-usereq extension commands, tools, and configuration UI.
|
|
4775
4775
|
- @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.
|
|
@@ -5459,48 +5459,85 @@ registration and status updates.
|
|
|
5459
5459
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5460
5460
|
- @return {string} Compact summary string.
|
|
5461
5461
|
|
|
5462
|
-
### fn `function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3796-
|
|
5462
|
+
### fn `function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3796-3840)
|
|
5463
5463
|
- @brief Builds the shared settings-menu choices for static-check management.
|
|
5464
5464
|
- @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.
|
|
5465
5465
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5466
5466
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered static-check menu choices.
|
|
5467
|
-
- @satisfies REQ-008, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-248
|
|
5467
|
+
- @satisfies REQ-008, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-248, REQ-345, REQ-347
|
|
5468
5468
|
|
|
5469
|
-
### fn `function buildSupportedStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5469
|
+
### fn `function buildSupportedStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3848-3865)
|
|
5470
5470
|
- @brief Builds the shared settings-menu choices for supported static-check languages.
|
|
5471
5471
|
- @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.
|
|
5472
5472
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5473
5473
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered language-choice vector.
|
|
5474
5474
|
|
|
5475
|
-
### fn `function buildConfiguredStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5475
|
+
### fn `function buildConfiguredStaticCheckLanguageChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3873-3890)
|
|
5476
5476
|
- @brief Builds the shared settings-menu choices for configured static-check languages.
|
|
5477
5477
|
- @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.
|
|
5478
5478
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5479
5479
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered configured-language vector.
|
|
5480
5480
|
|
|
5481
|
-
### fn `
|
|
5481
|
+
### fn `function formatStaticCheckCheckerEntry(entry: StaticCheckEntry): string` (L3898-3902)
|
|
5482
|
+
- @brief Formats one static-check checker entry as a compact command summary.
|
|
5483
|
+
- @details Joins the module command plus its parameter list into a single shell-like token sequence so inspection and confirmation menus can render checker identity deterministically. Runtime is O(p) in parameter count. No external state is mutated.
|
|
5484
|
+
- @param[in] entry {StaticCheckEntry} Static-check configuration entry.
|
|
5485
|
+
- @return {string} Compact command summary string.
|
|
5486
|
+
|
|
5487
|
+
### fn `function formatStaticCheckLanguageCheckerSummary(config: UseReqConfig, language: string): string` (L3911-3917)
|
|
5488
|
+
- @brief Summarizes every configured checker for one language as a delimited command list.
|
|
5489
|
+
- @details Joins each checker entry summary with `; ` so the value column exposes the full language configuration in one row. Runtime is O(c * p). No external state is mutated.
|
|
5490
|
+
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5491
|
+
- @param[in] language {string} Canonical language name.
|
|
5492
|
+
- @return {string} Delimited checker summary string, or `(none)` when no checkers are configured.
|
|
5493
|
+
|
|
5494
|
+
### fn `function buildStaticCheckViewChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L3926-3971)
|
|
5495
|
+
- @brief Builds the shared settings-menu choices for the read-only static-check inspection submenu.
|
|
5496
|
+
- @details Exposes only configured languages as disabled rows whose value column renders the full checker command list, appends one selectable `Close` row, and emits a disabled placeholder when no language is configured so the submenu never mutates configuration. Runtime is O(l * c * p). No external state is mutated.
|
|
5497
|
+
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5498
|
+
- @return {PiUsereqSettingsMenuChoice[]} Ordered read-only inspection choices.
|
|
5499
|
+
- @satisfies REQ-346
|
|
5500
|
+
|
|
5501
|
+
### fn `function buildStaticCheckRemovalConfirmationChoices(` (L3981-4019)
|
|
5502
|
+
- @brief Builds the confirmation submenu choices for removing one configured static-check language.
|
|
5503
|
+
- @details Renders each configured checker as a disabled preview row, appends explicit approve and abort actions, and falls back to one disabled no-op row when the language has no checkers. Runtime is O(c * p). No external state is mutated.
|
|
5504
|
+
- @param[in] language {string} Canonical language name targeted for removal.
|
|
5505
|
+
- @param[in] checkers {StaticCheckEntry[]} Configured checker entries that removal would clear.
|
|
5506
|
+
- @return {PiUsereqSettingsMenuChoice[]} Ordered removal-confirmation choices.
|
|
5507
|
+
- @satisfies REQ-349
|
|
5508
|
+
|
|
5509
|
+
### fn `async function confirmStaticCheckRemoval(` (L4030-4041)
|
|
5510
|
+
- @brief Opens one explicit removal-confirmation submenu for a configured static-check language.
|
|
5511
|
+
- @details Renders the targeted checker entries before removal 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.
|
|
5512
|
+
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
5513
|
+
- @param[in] language {string} Canonical language name targeted for removal.
|
|
5514
|
+
- @param[in] checkers {StaticCheckEntry[]} Configured checker entries that removal would clear.
|
|
5515
|
+
- @return {Promise<boolean>} `true` when the removal is explicitly approved.
|
|
5516
|
+
- @satisfies REQ-349
|
|
5517
|
+
|
|
5518
|
+
### fn `async function configureStaticCheckMenu(` (L4051-4230)
|
|
5482
5519
|
- @brief Runs the interactive static-check configuration menu.
|
|
5483
|
-
- @details Lets the user add
|
|
5520
|
+
- @details Lets the user add, inspect, confirm-before-remove, and reset 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.
|
|
5484
5521
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
5485
5522
|
- @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
5486
5523
|
- @return {Promise<void>} Promise resolved when the menu closes.
|
|
5487
|
-
- @satisfies REQ-008, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-195, REQ-248, REQ-253
|
|
5524
|
+
- @satisfies REQ-008, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-195, REQ-248, REQ-253, REQ-345, REQ-346, REQ-347, REQ-348, REQ-349
|
|
5488
5525
|
|
|
5489
|
-
### fn `function formatContextFilesSummary(config: UseReqConfig): string` (
|
|
5526
|
+
### fn `function formatContextFilesSummary(config: UseReqConfig): string` (L4239-4241)
|
|
5490
5527
|
- @brief Summarizes the `Context Files` flag state for the top-level menu value column.
|
|
5491
5528
|
- @details Renders the three context-file flags as compact `name:on|off` segments in the documented order so the top-level row reflects the current injection configuration. Runtime is O(1). No external state is mutated.
|
|
5492
5529
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5493
5530
|
- @return {string} Compact `Context Files` summary string.
|
|
5494
5531
|
- @satisfies REQ-327
|
|
5495
5532
|
|
|
5496
|
-
### fn `function buildContextFilesMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5533
|
+
### fn `function buildContextFilesMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L4250-4277)
|
|
5497
5534
|
- @brief Builds the shared settings-menu choices for the `Context Files` submenu.
|
|
5498
5535
|
- @details Exposes one inline on|off toggle row per context file in the documented `REQUIREMENTS.md`, `REFERENCES.md`, `WORKFLOW.md` order plus a value-less subtree-local `Reset defaults` row. Runtime is O(1). No external state is mutated.
|
|
5499
5536
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5500
5537
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered `Context Files` submenu choices.
|
|
5501
5538
|
- @satisfies REQ-327, REQ-328, REQ-333
|
|
5502
5539
|
|
|
5503
|
-
### fn `async function configureContextFilesMenu(` (
|
|
5540
|
+
### fn `async function configureContextFilesMenu(` (L4288-4346)
|
|
5504
5541
|
- @brief Runs the `Context Files` configuration submenu.
|
|
5505
5542
|
- @details Loads the shared settings menu with the three context-file toggle rows, persists each inline toggle immediately through the shared change callback, restores all three flags to enabled on approved subtree reset, preserves focus on the toggled row, and returns to the top-level menu on cancel. Runtime depends on user interaction count. Side effects include config writes and UI notifications.
|
|
5506
5543
|
- @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
@@ -5509,9 +5546,9 @@ registration and status updates.
|
|
|
5509
5546
|
- @return {Promise<void>} Promise resolved when the submenu closes.
|
|
5510
5547
|
- @satisfies REQ-327, REQ-328, REQ-333
|
|
5511
5548
|
|
|
5512
|
-
### fn `const setFlag = (flagKey: "context-files-requirements" | "context-files-references" | "context-files-workflow", enabled: boolean): void =>` (
|
|
5549
|
+
### fn `const setFlag = (flagKey: "context-files-requirements" | "context-files-references" | "context-files-workflow", enabled: boolean): void =>` (L4293-4297)
|
|
5513
5550
|
|
|
5514
|
-
### fn `function buildPiUsereqMenuChoices(` (
|
|
5551
|
+
### fn `function buildPiUsereqMenuChoices(` (L4356-4461)
|
|
5515
5552
|
- @brief Builds the shared settings-menu choices for the top-level pi-usereq configuration UI.
|
|
5516
5553
|
- @details Serializes primary configuration actions into right-valued menu rows consumed by the shared settings-menu renderer, including the `Context Files` injection toggles, automatic git-commit mode, effective prompt-command worktree state, notification summary, debug summary, locked worktree rows when automatic git commit is disabled, and display-only local plus global config paths. Runtime is O(s) in source-directory count. No external state is mutated.
|
|
5517
5554
|
- @param[in] cwd {string} Current working directory.
|
|
@@ -5519,21 +5556,21 @@ registration and status updates.
|
|
|
5519
5556
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered top-level menu choices.
|
|
5520
5557
|
- @satisfies REQ-006, REQ-031, REQ-137, REQ-150, REQ-151, REQ-152, REQ-162, REQ-190, REQ-191, REQ-197, REQ-204, REQ-205, REQ-212, REQ-215, REQ-216, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-314, REQ-318, REQ-319, REQ-320, REQ-326
|
|
5521
5558
|
|
|
5522
|
-
### fn `function buildSrcDirMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5559
|
+
### fn `function buildSrcDirMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L4470-4488)
|
|
5523
5560
|
- @brief Builds the shared settings-menu choices for source-directory management.
|
|
5524
5561
|
- @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.
|
|
5525
5562
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5526
5563
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered source-directory management choices.
|
|
5527
5564
|
- @satisfies REQ-006, REQ-151, REQ-152, REQ-153, REQ-154, REQ-193
|
|
5528
5565
|
|
|
5529
|
-
### fn `function buildSrcDirRemovalChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (
|
|
5566
|
+
### fn `function buildSrcDirRemovalChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[]` (L4497-4509)
|
|
5530
5567
|
- @brief Builds the shared settings-menu choices for removing one source-directory entry.
|
|
5531
5568
|
- @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.
|
|
5532
5569
|
- @param[in] config {UseReqConfig} Effective project configuration.
|
|
5533
5570
|
- @return {PiUsereqSettingsMenuChoice[]} Ordered removable source-directory choices.
|
|
5534
5571
|
- @satisfies REQ-006, REQ-151, REQ-152, REQ-153, REQ-154
|
|
5535
5572
|
|
|
5536
|
-
### fn `async function configurePiUsereq(` (
|
|
5573
|
+
### fn `async function configurePiUsereq(` (L4520-4778)
|
|
5537
5574
|
- @brief Runs the top-level pi-usereq configuration menu.
|
|
5538
5575
|
- @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.
|
|
5539
5576
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5542,9 +5579,9 @@ registration and status updates.
|
|
|
5542
5579
|
- @return {Promise<void>} Promise resolved when configuration is saved and the menu closes.
|
|
5543
5580
|
- @satisfies REQ-006, REQ-031, REQ-137, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-162, REQ-190, REQ-191, REQ-192, REQ-194, REQ-195, REQ-204, REQ-205, REQ-212, REQ-215, REQ-216, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243, REQ-314, REQ-318, REQ-319, REQ-320, REQ-326, REQ-327, REQ-328, REQ-333
|
|
5544
5581
|
|
|
5545
|
-
### fn `const persistConfigChange = () =>` (
|
|
5582
|
+
### fn `const persistConfigChange = () =>` (L4531-4536)
|
|
5546
5583
|
|
|
5547
|
-
### fn `function registerConfigCommands(` (
|
|
5584
|
+
### fn `function registerConfigCommands(` (L4788-4798)
|
|
5548
5585
|
- @brief Registers configuration-management commands.
|
|
5549
5586
|
- @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.
|
|
5550
5587
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5552,7 +5589,7 @@ registration and status updates.
|
|
|
5552
5589
|
- @return {void} No return value.
|
|
5553
5590
|
- @satisfies REQ-006, REQ-031
|
|
5554
5591
|
|
|
5555
|
-
### fn `export default function piUsereqExtension(pi: ExtensionAPI): void` (
|
|
5592
|
+
### fn `export default function piUsereqExtension(pi: ExtensionAPI): void` (L4807-4820)
|
|
5556
5593
|
- @brief Registers the complete pi-usereq extension.
|
|
5557
5594
|
- @details Validates installation-owned bundled resources, registers the specialized `req-reset` and `req-references` commands plus bundled prompt-backed commands and agent tools, conditionally registers config-gated debug tool wrapper commands when the current project enables them, registers configuration commands, registers the configurable notification-sound shortcut when the runtime supports shortcuts, and installs shared wrappers for all supported pi lifecycle hooks so status telemetry, context usage, prompt timing, cumulative runtime, prompt-specific Pushover metadata, tool-result debug logging, and prompt-orchestration effects remain synchronized with runtime events. Runtime is O(h) in hook count during registration. Side effects include filesystem reads, command/tool/shortcut registration, UI updates, active-tool changes, optional debug-log writes, and timer scheduling.
|
|
5558
5595
|
- @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
@@ -5653,19 +5690,24 @@ registration and status updates.
|
|
|
5653
5690
|
|`countEnabledStaticCheckLanguages`|fn||3764-3766|function countEnabledStaticCheckLanguages(config: UseReqC...|
|
|
5654
5691
|
|`resetStaticCheckConfig`|fn||3775-3777|function resetStaticCheckConfig(config: UseReqConfig): void|
|
|
5655
5692
|
|`formatStaticCheckLanguagesSummary`|fn||3785-3787|function formatStaticCheckLanguagesSummary(config: UseReq...|
|
|
5656
|
-
|`buildStaticCheckMenuChoices`|fn||3796-
|
|
5657
|
-
|`buildSupportedStaticCheckLanguageChoices`|fn||
|
|
5658
|
-
|`buildConfiguredStaticCheckLanguageChoices`|fn||
|
|
5659
|
-
|`
|
|
5660
|
-
|`
|
|
5661
|
-
|`
|
|
5662
|
-
|`
|
|
5663
|
-
|`
|
|
5664
|
-
|`
|
|
5665
|
-
|`
|
|
5666
|
-
|`
|
|
5667
|
-
|`
|
|
5668
|
-
|`
|
|
5669
|
-
|`
|
|
5670
|
-
|`
|
|
5693
|
+
|`buildStaticCheckMenuChoices`|fn||3796-3840|function buildStaticCheckMenuChoices(config: UseReqConfig...|
|
|
5694
|
+
|`buildSupportedStaticCheckLanguageChoices`|fn||3848-3865|function buildSupportedStaticCheckLanguageChoices(config:...|
|
|
5695
|
+
|`buildConfiguredStaticCheckLanguageChoices`|fn||3873-3890|function buildConfiguredStaticCheckLanguageChoices(config...|
|
|
5696
|
+
|`formatStaticCheckCheckerEntry`|fn||3898-3902|function formatStaticCheckCheckerEntry(entry: StaticCheck...|
|
|
5697
|
+
|`formatStaticCheckLanguageCheckerSummary`|fn||3911-3917|function formatStaticCheckLanguageCheckerSummary(config: ...|
|
|
5698
|
+
|`buildStaticCheckViewChoices`|fn||3926-3971|function buildStaticCheckViewChoices(config: UseReqConfig...|
|
|
5699
|
+
|`buildStaticCheckRemovalConfirmationChoices`|fn||3981-4019|function buildStaticCheckRemovalConfirmationChoices(|
|
|
5700
|
+
|`confirmStaticCheckRemoval`|fn||4030-4041|async function confirmStaticCheckRemoval(|
|
|
5701
|
+
|`configureStaticCheckMenu`|fn||4051-4230|async function configureStaticCheckMenu(|
|
|
5702
|
+
|`formatContextFilesSummary`|fn||4239-4241|function formatContextFilesSummary(config: UseReqConfig):...|
|
|
5703
|
+
|`buildContextFilesMenuChoices`|fn||4250-4277|function buildContextFilesMenuChoices(config: UseReqConfi...|
|
|
5704
|
+
|`configureContextFilesMenu`|fn||4288-4346|async function configureContextFilesMenu(|
|
|
5705
|
+
|`setFlag`|fn||4293-4297|const setFlag = (flagKey: "context-files-requirements" | ...|
|
|
5706
|
+
|`buildPiUsereqMenuChoices`|fn||4356-4461|function buildPiUsereqMenuChoices(|
|
|
5707
|
+
|`buildSrcDirMenuChoices`|fn||4470-4488|function buildSrcDirMenuChoices(config: UseReqConfig): Pi...|
|
|
5708
|
+
|`buildSrcDirRemovalChoices`|fn||4497-4509|function buildSrcDirRemovalChoices(config: UseReqConfig):...|
|
|
5709
|
+
|`configurePiUsereq`|fn||4520-4778|async function configurePiUsereq(|
|
|
5710
|
+
|`persistConfigChange`|fn||4531-4536|const persistConfigChange = () =>|
|
|
5711
|
+
|`registerConfigCommands`|fn||4788-4798|function registerConfigCommands(|
|
|
5712
|
+
|`piUsereqExtension`|fn||4807-4820|export default function piUsereqExtension(pi: ExtensionAP...|
|
|
5671
5713
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "PI-useReq Requirements"
|
|
3
3
|
description: Software requirements specification
|
|
4
|
-
version: "0.0.
|
|
5
|
-
date: "2026-07-
|
|
4
|
+
version: "0.0.77"
|
|
5
|
+
date: "2026-07-13"
|
|
6
6
|
author: "OpenAI Codex"
|
|
7
7
|
scope:
|
|
8
8
|
paths:
|
|
@@ -93,6 +93,8 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
|
|
|
93
93
|
- **DES-016**: MUST deliver rendered bundled-prompt content to the LLM through `sendMessage` as a `display:false` custom message with `triggerTurn:true` and MUST NOT use `sendUserMessage` when `sendMessage` is available.
|
|
94
94
|
- **DES-017**: MUST declare `pyright`, `ruff`, and `eslint` as pinned caret-range npm dependencies and register a `postinstall` script that installs bundled static checkers.
|
|
95
95
|
- **DES-018**: MUST resolve checker executables by probing bundled `node_modules/.bin` paths relative to the installation path before falling back to `PATH` scan.
|
|
96
|
+
- **DES-019**: MUST resolve the `%%INSTALLATION_PATH%%` keyword inside static-check `Command` `cmd` fields to the runtime installation path within `resolveCheckerExecutable` before executable probing.
|
|
97
|
+
- **DES-020**: MUST extend `scripts/install-static-checkers.ts` to best-effort approve pending npm install scripts for bundled checker dependencies before probing bundled executables.
|
|
96
98
|
|
|
97
99
|
### 3.2 Functions
|
|
98
100
|
- **REQ-001**: MUST access bundled prompts, git execution instructions, templates, and guidelines from `<installation-path>/resources` without requiring user-home resource copies before prompt or tool execution.
|
|
@@ -166,10 +168,10 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
|
|
|
166
168
|
- **REQ-336**: MUST render the command invocation summary with the command name without the `req-` prefix in uppercase and the user request arguments.
|
|
167
169
|
- **REQ-337**: MUST include `docs-dir`, `src-dir`, `tests-dir`, enabled context files, `AUTO_GIT_COMMIT`, effective `GIT_WORKTREE_ENABLED`, `GIT_WORKTREE_PREFIX`, enabled static-check languages, and `enabled-tools` in the command invocation summary.
|
|
168
170
|
- **REQ-338**: MUST render `none` for the command invocation summary `context files`, `static code checks`, and `enabled tools` fields whenever their respective enabled-item list is empty.
|
|
169
|
-
- **REQ-008**: MUST provide a `Language static code checkers` submenu that adds
|
|
171
|
+
- **REQ-008**: MUST provide a `Language static code checkers` submenu that adds, views, confirms-before-removes, and resets global Command checker entries, plus toggles local per-language enablement.
|
|
170
172
|
- **REQ-160**: MUST hardcode `Command` as the only user-configurable static-check module and omit module-selection UI from static-check configuration menus.
|
|
171
173
|
- **REQ-161**: MUST hide `Dummy` from user-configurable static-check menus while preserving existing-config parsing and debug-driver support for `Dummy` entries.
|
|
172
|
-
- **REQ-248**: MUST render 20 per-language static-check toggle rows between `
|
|
174
|
+
- **REQ-248**: MUST render 20 per-language static-check toggle rows between `Reset static code checker` and `Reset defaults`, with right-aligned `on|off` values derived from persisted local enablement.
|
|
173
175
|
- **REQ-249**: MUST persist local `static-check.<language>.enabled` with allowed values `enable|disable` and global `static-check.<language>.checkers` as ordered arrays.
|
|
174
176
|
- **REQ-250**: MUST default global `static-check.C` and `static-check.C++` checker arrays to documented `cppcheck` and `clang-format` Command entries.
|
|
175
177
|
- **REQ-251**: MUST default global `static-check.Python`, `JavaScript`, and `TypeScript` checker arrays to their documented Command entries.
|
|
@@ -411,6 +413,14 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
|
|
|
411
413
|
- **REQ-342**: MUST keep `STATIC_CHECK_MODULES`, `dispatchStaticCheckForFile` signature, and `StaticCheckEntry` shape unchanged when adding bundled executable resolution.
|
|
412
414
|
- **REQ-343**: MUST NOT transition workflow state or abort `session_start` when one or more enabled static checkers are missing.
|
|
413
415
|
- **REQ-344**: MUST place the `session_start` missing-checker helper in `src/core/static-check.ts` so `src/index.ts` remains thin.
|
|
416
|
+
- **REQ-345**: MUST expose `View static code checker` immediately before `Remove static code checker` inside the `Language static code checkers` submenu.
|
|
417
|
+
- **REQ-346**: MUST make `View static code checker` render configured checker entries as read-only disabled inspection rows terminated by a `Close` row without mutating configuration.
|
|
418
|
+
- **REQ-347**: MUST expose `Reset static code checker` immediately after `Remove static code checker` inside the `Language static code checkers` submenu.
|
|
419
|
+
- **REQ-348**: MUST make `Reset static code checker` restore global checker arrays plus derived local enable flags to embedded defaults after explicit user confirmation.
|
|
420
|
+
- **REQ-349**: MUST render the targeted configured checker entries and require explicit user confirmation before `Remove static code checker` removes any global checker entries.
|
|
421
|
+
- **REQ-350**: MUST substitute the `%%INSTALLATION_PATH%%` keyword with the runtime extension installation path inside static-check `Command` `cmd` fields before executable resolution and execution.
|
|
422
|
+
- **REQ-351**: MUST resolve bundled static-check executables from the extension installation `node_modules/.bin` so default configuration requires no target-project module installation.
|
|
423
|
+
- **REQ-352**: MUST best-effort approve pending npm install scripts for bundled checker dependencies during extension install or run so embedded checkers execute without manual approval.
|
|
414
424
|
|
|
415
425
|
## 4. Test Requirements
|
|
416
426
|
- **TST-001**: MUST verify extension activation registers every documented prompt command, agent tool, and configuration command while omitting tool-name slash commands, `test-static-check`, and the removed standalone config-viewer command.
|
|
@@ -421,7 +431,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
|
|
|
421
431
|
- **TST-005**: MUST verify the configuration menu saves `docs-dir` locally and `AUTO_GIT_COMMIT`, `GIT_WORKTREE_ENABLED`, plus `GIT_WORKTREE_PREFIX` globally immediately after each change.
|
|
422
432
|
- **TST-084**: MUST verify local configuration persistence trims trailing `/` and keeps `docs-dir`, `tests-dir`, and `src-dir` relative.
|
|
423
433
|
- **TST-046**: MUST verify `Language static code checkers` omits module selection, raw-spec actions, supported-language reference actions, and hides `Dummy`, `Pylance`, and `Ruff` from user-configurable actions.
|
|
424
|
-
- **TST-077**: MUST verify `Language static code checkers` renders 20 per-language `on|off` toggle rows between `
|
|
434
|
+
- **TST-077**: MUST verify `Language static code checkers` renders 20 per-language `on|off` toggle rows between `Reset static code checker` and `Reset defaults`, and persists toggle changes only in local configuration.
|
|
425
435
|
- **TST-078**: MUST verify default configuration stores documented per-language `enabled` flags locally and checker lists globally for `C`, `C++`, `Python`, `JavaScript`, and `TypeScript`.
|
|
426
436
|
- **TST-108**: MUST verify guided static-check entry addition updates global checker lists and sets the targeted local enable flag to `enable`, and guided removal updates global checker lists.
|
|
427
437
|
- **TST-112**: MUST verify `--enable-static-check` stores checker commands in global configuration and preserves local enablement according to the documented defaulting rules.
|
|
@@ -536,6 +546,11 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
|
|
|
536
546
|
- **TST-123**: MUST verify `resolveCheckerExecutable` probes bundled `node_modules/.bin` paths before `PATH` scan.
|
|
537
547
|
- **TST-124**: MUST verify `scripts/install-static-checkers.ts` always returns exit code `0` regardless of probe or install outcomes.
|
|
538
548
|
- **TST-125**: MUST verify `session_start` emits one warning notification for missing enabled checkers without aborting or transitioning workflow state.
|
|
549
|
+
- **TST-126**: MUST verify `View static code checker` appears before `Remove static code checker` and renders configured checkers as read-only inspection rows.
|
|
550
|
+
- **TST-127**: MUST verify `Reset static code checker` appears after `Remove static code checker` and restores embedded defaults after explicit confirmation.
|
|
551
|
+
- **TST-128**: MUST verify `Remove static code checker` previews targeted checker entries and requires explicit confirmation before removing configured global checker entries.
|
|
552
|
+
- **TST-129**: MUST verify `resolveCheckerExecutable` substitutes `%%INSTALLATION_PATH%%` with the runtime installation path inside static-check `Command` `cmd` fields.
|
|
553
|
+
- **TST-130**: MUST verify `scripts/install-static-checkers.ts` best-effort approves pending npm install scripts and always returns exit code `0`.
|
|
539
554
|
|
|
540
555
|
## 5. Observed Component Model
|
|
541
556
|
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
- Threads: no explicit threads detected
|
|
52
52
|
- ID: `PROC:install-static-checkers`
|
|
53
53
|
- Type: Process
|
|
54
|
-
- Role: Best-effort npm `postinstall` installer that probes bundled static-checker executables, attempts `npm install` on miss, and prints platform guidance for native checkers.
|
|
54
|
+
- Role: Best-effort npm `postinstall` installer that approves pending install scripts, probes bundled static-checker executables, attempts `npm install` on miss, and prints platform guidance for native checkers.
|
|
55
55
|
- Entrypoints:
|
|
56
56
|
- `main(...)` [`scripts/install-static-checkers.ts`]
|
|
57
57
|
- Parent Process: none
|
|
@@ -1191,12 +1191,12 @@
|
|
|
1191
1191
|
- `formatElapsedStatusValue(...)`: compose `⏱︎`, `⚑`, and `⌛︎` timer segments [`src/core/extension-status.ts`]
|
|
1192
1192
|
- `formatCompletedStatusDuration(...)`: render completed timers or the unset placeholder [`src/core/extension-status.ts`]
|
|
1193
1193
|
- `formatStatusDuration(...)`: render `M:SS` durations [`src/core/extension-status.ts`]
|
|
1194
|
-
- `configureStaticCheckMenu(...)`: interactive editor that adds
|
|
1194
|
+
- `configureStaticCheckMenu(...)`: interactive editor that adds, inspects, confirms-before-removes, and resets global Command entries while toggling local per-language enable flags [`src/index.ts`]
|
|
1195
1195
|
- `getStaticCheckLanguageConfigForMenu(...)`: resolve a menu-facing per-language static-check object [`src/index.ts`]
|
|
1196
1196
|
- `countConfiguredStaticCheckLanguages(...)`: count languages that retain global checker entries [`src/index.ts`]
|
|
1197
1197
|
- `countEnabledStaticCheckLanguages(...)`: count languages whose local enable flag is on [`src/index.ts`]
|
|
1198
1198
|
- `formatStaticCheckLanguagesSummary(...)`: summarize enabled languages and configured global checker languages [`src/index.ts`]
|
|
1199
|
-
- `buildStaticCheckMenuChoices(...)`: serialize guided add/remove actions plus direct per-language local toggle rows [`src/index.ts`]
|
|
1199
|
+
- `buildStaticCheckMenuChoices(...)`: serialize guided add/view/remove/reset actions plus direct per-language local toggle rows [`src/index.ts`]
|
|
1200
1200
|
- `getSupportedStaticCheckLanguageSupport(...)`: enumerate supported languages and extensions [`src/core/static-check.ts`]
|
|
1201
1201
|
- `getSupportedStaticCheckLanguages(...)`: enumerate canonical supported languages [`src/core/static-check.ts`]
|
|
1202
1202
|
- `buildTerminalSettingsMenuChoices(...)`: append the canonical value-less `Reset defaults` row to the selector menu [`src/index.ts`]
|
|
@@ -1208,6 +1208,11 @@
|
|
|
1208
1208
|
- `getSupportedStaticCheckLanguageSupport(...)`: enumerate supported languages and extensions [`src/core/static-check.ts`]
|
|
1209
1209
|
- `getSupportedStaticCheckLanguages(...)`: enumerate canonical supported languages [`src/core/static-check.ts`]
|
|
1210
1210
|
- `buildTerminalSettingsMenuChoices(...)`: append the canonical value-less `Reset defaults` row to the selector menu [`src/index.ts`]
|
|
1211
|
+
- `formatStaticCheckCheckerEntry(...)`: format one checker entry as a shell-like command summary for inspection and confirmation menus [`src/index.ts`]
|
|
1212
|
+
- `formatStaticCheckLanguageCheckerSummary(...)`: summarize configured checkers for one language as a delimited command list [`src/index.ts`]
|
|
1213
|
+
- `buildStaticCheckViewChoices(...)`: serialize configured checkers as read-only disabled inspection rows terminated by a `Close` row [`src/index.ts`]
|
|
1214
|
+
- `buildStaticCheckRemovalConfirmationChoices(...)`: serialize targeted checker preview rows plus approve and abort actions for removal confirmation [`src/index.ts`]
|
|
1215
|
+
- `confirmStaticCheckRemoval(...)`: open one explicit removal-confirmation submenu and return the approval result [`src/index.ts`]
|
|
1211
1216
|
- `resetStaticCheckConfig(...)`: restore documented per-language static-check defaults [`src/index.ts`]
|
|
1212
1217
|
- `getDefaultStaticCheckConfig(...)`: build documented per-language static-check defaults [`src/core/config.ts`]
|
|
1213
1218
|
- `createStaticCheckLanguageConfig(...)`: clone checker entries and derive the enable flag [`src/core/config.ts`]
|
|
@@ -1302,8 +1307,10 @@
|
|
|
1302
1307
|
- Looping model: single-pass probe plus optional install with no persistent loop.
|
|
1303
1308
|
- Threads: no explicit threads detected.
|
|
1304
1309
|
- Internal Call-Trace Tree:
|
|
1305
|
-
- `main(...)`: probe each bundled npm checker, attempt best-effort install on miss, print native-checker guidance, and return `0` [`scripts/install-static-checkers.ts`]
|
|
1306
|
-
- `
|
|
1310
|
+
- `main(...)`: best-effort approve pending npm install scripts, probe each bundled npm checker, attempt best-effort install on miss, print native-checker guidance, and return `0` [`scripts/install-static-checkers.ts`]
|
|
1311
|
+
- `approvePendingInstallScripts(...)`: best-effort approve pending npm install scripts for bundled checker dependencies before probing [`scripts/install-static-checkers.ts`]
|
|
1312
|
+
- `hasPendingInstallScriptPackages(...)`: report whether the parsed pending-scripts payload references install-script packages [`scripts/install-static-checkers.ts`]
|
|
1313
|
+
- `resolveCheckerExecutable(...)`: resolve one checker across `%%INSTALLATION_PATH%%` keyword, bundled `node_modules/.bin`, and PATH scan locations [`src/core/static-check.ts`]
|
|
1307
1314
|
- `findExecutable(...)`: resolve executable on PATH or explicit path [`src/core/static-check.ts`]
|
|
1308
1315
|
- `isExecutableFile(...)`: verify executable access bits [`src/core/static-check.ts`]
|
|
1309
1316
|
- `attemptBundledInstall(...)`: best-effort `npm install <pkg>@<range> --no-save --prefix <install-root>` swallowing all errors [`scripts/install-static-checkers.ts`]
|
|
@@ -42,6 +42,52 @@ function bundledCheckerRange(pkg: string): string {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* @brief Reports whether one parsed `npm approve-scripts --allow-scripts-pending` payload references pending install-script packages.
|
|
47
|
+
* @details Accepts an array of package specifiers or a map of package specifiers to pending-script descriptors, treating any non-empty array or non-empty object with at least one entry as pending. Runtime is O(n) in pending entry count. No external state is mutated.
|
|
48
|
+
* @param[in] pending {unknown} Parsed JSON payload emitted by `npm approve-scripts --allow-scripts-pending`.
|
|
49
|
+
* @return {boolean} `true` when at least one pending install-script package is referenced.
|
|
50
|
+
*/
|
|
51
|
+
function hasPendingInstallScriptPackages(pending: unknown): boolean {
|
|
52
|
+
if (Array.isArray(pending)) {
|
|
53
|
+
return pending.length > 0;
|
|
54
|
+
}
|
|
55
|
+
if (pending && typeof pending === "object") {
|
|
56
|
+
return Object.keys(pending as Record<string, unknown>).length > 0;
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @brief Best-effort approves pending npm install scripts for bundled checker dependencies.
|
|
63
|
+
* @details Probes `npm approve-scripts --allow-scripts-pending`, parses the JSON payload when available, and runs `npm approve-scripts --all` only when pending script-bearing packages are detected so bundled checkers and their transitive dependencies execute without manual script approval. Swallows all errors so the postinstall flow never fails. Runtime is dominated by npm execution. Side effects include optional writes to the installation-owned `package.json` allowScripts map and subprocess spawning.
|
|
64
|
+
* @return {void} No return value.
|
|
65
|
+
* @satisfies DES-020, REQ-352
|
|
66
|
+
*/
|
|
67
|
+
function approvePendingInstallScripts(): void {
|
|
68
|
+
const pendingResult = spawnSync(
|
|
69
|
+
"npm",
|
|
70
|
+
["approve-scripts", "--allow-scripts-pending", "--json"],
|
|
71
|
+
{ encoding: "utf8" },
|
|
72
|
+
);
|
|
73
|
+
if (pendingResult.error || (pendingResult.status !== null && pendingResult.status !== 0)) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
let pendingPayload: unknown;
|
|
77
|
+
try {
|
|
78
|
+
pendingPayload = JSON.parse(pendingResult.stdout ?? "");
|
|
79
|
+
} catch {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (!hasPendingInstallScriptPackages(pendingPayload)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const approveResult = spawnSync("npm", ["approve-scripts", "--all"], { encoding: "utf8" });
|
|
86
|
+
if (approveResult.error) {
|
|
87
|
+
process.stderr.write(`Warning: failed to approve pending install scripts: ${approveResult.error.message}\n`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
45
91
|
/**
|
|
46
92
|
* @brief Prints platform-specific install guidance for native checkers.
|
|
47
93
|
* @details Detects the current platform and emits one consolidated stderr line per native checker describing the recommended system package manager command. Runtime is O(1). Side effect: writes to stderr.
|
|
@@ -101,10 +147,11 @@ function attemptBundledInstall(pkg: string): void {
|
|
|
101
147
|
* @details Probes each bundled npm checker through `resolveCheckerExecutable`, attempts a best-effort install on miss, prints native-checker guidance for unresolvable native checkers, and always returns `0` so `npm install` never fails because of missing optional checkers. Runtime is dominated by PATH probing and optional npm execution. Side effects include stdout/stderr writes and best-effort `npm install` subprocess spawning. The script never modifies git-tracked files.
|
|
102
148
|
* @param[in] argv {string[]} Raw CLI arguments (unused, retained for CLI convention parity).
|
|
103
149
|
* @return {number} Always returns `0`.
|
|
104
|
-
* @satisfies REQ-339, DES-017
|
|
150
|
+
* @satisfies REQ-339, DES-017, DES-020, REQ-352
|
|
105
151
|
*/
|
|
106
152
|
export function main(argv = process.argv.slice(2)): number {
|
|
107
153
|
void argv;
|
|
154
|
+
approvePendingInstallScripts();
|
|
108
155
|
for (const checker of BUNDLED_NPM_CHECKERS) {
|
|
109
156
|
if (resolveCheckerExecutable(checker)) {
|
|
110
157
|
process.stdout.write(`Bundled static checker '${checker}' is available.\n`);
|
package/src/core/static-check.ts
CHANGED
|
@@ -399,11 +399,12 @@ export class StaticCheckCommand extends StaticCheckBase {
|
|
|
399
399
|
* @throws {ReqError} Throws when the executable cannot be found on PATH.
|
|
400
400
|
*/
|
|
401
401
|
constructor(cmd: string, inputs: string[], extraArgs?: string[], failOnly = false) {
|
|
402
|
-
|
|
402
|
+
const resolvedCmd = resolveCheckerExecutable(cmd);
|
|
403
|
+
if (!resolvedCmd) {
|
|
403
404
|
throw new ReqError(`Error: external command '${cmd}' not found on PATH.`, 1);
|
|
404
405
|
}
|
|
405
406
|
super(inputs, extraArgs, failOnly);
|
|
406
|
-
this.cmd = cmd;
|
|
407
|
+
this.cmd = cmd.includes("%%INSTALLATION_PATH%%") ? resolvedCmd : cmd;
|
|
407
408
|
this.label = `Command[${cmd}]`;
|
|
408
409
|
}
|
|
409
410
|
|
|
@@ -475,20 +476,25 @@ export function findExecutable(cmd: string): string | undefined {
|
|
|
475
476
|
}
|
|
476
477
|
|
|
477
478
|
/**
|
|
478
|
-
* @brief Resolves one checker executable across bundled `node_modules/.bin
|
|
479
|
-
* @details
|
|
480
|
-
* @param[in] cmd {string} Executable name or
|
|
479
|
+
* @brief Resolves one checker executable across installation-keyword, bundled `node_modules/.bin`, and PATH locations.
|
|
480
|
+
* @details Substitutes the `%%INSTALLATION_PATH%%` keyword with the runtime installation path and verifies the resulting explicit path when present, then probes the installation-owned `node_modules/.bin` directory, the project-scope parent `node_modules/.bin` directory used by `--prefix` layouts, and finally the system PATH scan, returning the first executable match so default configuration requires no target-project module installation. Runtime is O(p) in PATH entry count plus bounded filesystem metadata checks. Side effects are limited to filesystem reads.
|
|
481
|
+
* @param[in] cmd {string} Executable name, explicit path, or `%%INSTALLATION_PATH%%`-anchored path to resolve.
|
|
481
482
|
* @return {string | undefined} Absolute executable path, or `undefined` when not found in any probed location.
|
|
482
|
-
* @satisfies REQ-023, REQ-037, DES-018
|
|
483
|
+
* @satisfies REQ-023, REQ-037, DES-018, DES-019, REQ-350, REQ-351
|
|
483
484
|
*/
|
|
484
485
|
export function resolveCheckerExecutable(cmd: string): string | undefined {
|
|
486
|
+
if (cmd.includes("%%INSTALLATION_PATH%%")) {
|
|
487
|
+
const installationPath = getInstallationPath();
|
|
488
|
+
const resolvedPath = cmd.split("%%INSTALLATION_PATH%%").join(installationPath);
|
|
489
|
+
return isExecutableFile(resolvedPath) ? path.resolve(resolvedPath) : undefined;
|
|
490
|
+
}
|
|
485
491
|
if (cmd.includes(path.sep)) {
|
|
486
492
|
return isExecutableFile(cmd) ? path.resolve(cmd) : undefined;
|
|
487
493
|
}
|
|
488
494
|
const installationPath = getInstallationPath();
|
|
489
495
|
const bundledBinCandidates = [
|
|
490
496
|
path.join(installationPath, "..", "node_modules", ".bin", cmd),
|
|
491
|
-
path.join(installationPath, "..", "..", "
|
|
497
|
+
path.join(installationPath, "..", "..", ".bin", cmd),
|
|
492
498
|
];
|
|
493
499
|
for (const candidate of bundledBinCandidates) {
|
|
494
500
|
if (isExecutableFile(candidate)) {
|
package/src/index.ts
CHANGED
|
@@ -3791,7 +3791,7 @@ function formatStaticCheckLanguagesSummary(config: UseReqConfig): string {
|
|
|
3791
3791
|
* @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.
|
|
3792
3792
|
* @param[in] config {UseReqConfig} Effective project configuration.
|
|
3793
3793
|
* @return {PiUsereqSettingsMenuChoice[]} Ordered static-check menu choices.
|
|
3794
|
-
* @satisfies REQ-008, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-248
|
|
3794
|
+
* @satisfies REQ-008, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-248, REQ-345, REQ-347
|
|
3795
3795
|
*/
|
|
3796
3796
|
function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[] {
|
|
3797
3797
|
const supportedLanguages = getSupportedStaticCheckLanguageSupport();
|
|
@@ -3803,11 +3803,23 @@ function buildStaticCheckMenuChoices(config: UseReqConfig): PiUsereqSettingsMenu
|
|
|
3803
3803
|
value: `${supportedLanguages.length} languages`,
|
|
3804
3804
|
description: "Select a supported language, then configure one Command static-check executable.",
|
|
3805
3805
|
},
|
|
3806
|
+
{
|
|
3807
|
+
id: "view-static-check-entry",
|
|
3808
|
+
label: "View static code checker",
|
|
3809
|
+
value: configuredLanguageCount > 0 ? `${configuredLanguageCount} configured` : "(none)",
|
|
3810
|
+
description: "Inspect the configured Command static-check entries for every language without mutating configuration.",
|
|
3811
|
+
},
|
|
3806
3812
|
{
|
|
3807
3813
|
id: "remove-static-check-entry",
|
|
3808
3814
|
label: "Remove static code checker",
|
|
3809
3815
|
value: configuredLanguageCount > 0 ? `${configuredLanguageCount} configured` : "(none)",
|
|
3810
|
-
description: "
|
|
3816
|
+
description: "Preview and confirm removal of every configured static-check entry for one language.",
|
|
3817
|
+
},
|
|
3818
|
+
{
|
|
3819
|
+
id: "reset-static-check-entry",
|
|
3820
|
+
label: "Reset static code checker",
|
|
3821
|
+
value: "embedded defaults",
|
|
3822
|
+
description: "Restore the documented per-language static-check defaults after explicit confirmation.",
|
|
3811
3823
|
},
|
|
3812
3824
|
...supportedLanguages.map(({ language, extensions }) => {
|
|
3813
3825
|
const languageConfig = getStaticCheckLanguageConfigForMenu(config, language);
|
|
@@ -3877,13 +3889,164 @@ function buildConfiguredStaticCheckLanguageChoices(config: UseReqConfig): PiUser
|
|
|
3877
3889
|
];
|
|
3878
3890
|
}
|
|
3879
3891
|
|
|
3892
|
+
/**
|
|
3893
|
+
* @brief Formats one static-check checker entry as a compact command summary.
|
|
3894
|
+
* @details Joins the module command plus its parameter list into a single shell-like token sequence so inspection and confirmation menus can render checker identity deterministically. Runtime is O(p) in parameter count. No external state is mutated.
|
|
3895
|
+
* @param[in] entry {StaticCheckEntry} Static-check configuration entry.
|
|
3896
|
+
* @return {string} Compact command summary string.
|
|
3897
|
+
*/
|
|
3898
|
+
function formatStaticCheckCheckerEntry(entry: StaticCheckEntry): string {
|
|
3899
|
+
const cmd = typeof entry.cmd === "string" ? entry.cmd.trim() : "";
|
|
3900
|
+
const params = Array.isArray(entry.params) ? entry.params.map(String) : [];
|
|
3901
|
+
return [cmd, ...params].filter((value) => value !== "").join(" ");
|
|
3902
|
+
}
|
|
3903
|
+
|
|
3904
|
+
/**
|
|
3905
|
+
* @brief Summarizes every configured checker for one language as a delimited command list.
|
|
3906
|
+
* @details Joins each checker entry summary with `; ` so the value column exposes the full language configuration in one row. Runtime is O(c * p). No external state is mutated.
|
|
3907
|
+
* @param[in] config {UseReqConfig} Effective project configuration.
|
|
3908
|
+
* @param[in] language {string} Canonical language name.
|
|
3909
|
+
* @return {string} Delimited checker summary string, or `(none)` when no checkers are configured.
|
|
3910
|
+
*/
|
|
3911
|
+
function formatStaticCheckLanguageCheckerSummary(config: UseReqConfig, language: string): string {
|
|
3912
|
+
const checkers = getStaticCheckLanguageConfigForMenu(config, language).checkers;
|
|
3913
|
+
if (checkers.length === 0) {
|
|
3914
|
+
return "(none)";
|
|
3915
|
+
}
|
|
3916
|
+
return checkers.map(formatStaticCheckCheckerEntry).join("; ");
|
|
3917
|
+
}
|
|
3918
|
+
|
|
3919
|
+
/**
|
|
3920
|
+
* @brief Builds the shared settings-menu choices for the read-only static-check inspection submenu.
|
|
3921
|
+
* @details Exposes only configured languages as disabled rows whose value column renders the full checker command list, appends one selectable `Close` row, and emits a disabled placeholder when no language is configured so the submenu never mutates configuration. Runtime is O(l * c * p). No external state is mutated.
|
|
3922
|
+
* @param[in] config {UseReqConfig} Effective project configuration.
|
|
3923
|
+
* @return {PiUsereqSettingsMenuChoice[]} Ordered read-only inspection choices.
|
|
3924
|
+
* @satisfies REQ-346
|
|
3925
|
+
*/
|
|
3926
|
+
function buildStaticCheckViewChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[] {
|
|
3927
|
+
const configured = getSupportedStaticCheckLanguageSupport()
|
|
3928
|
+
.filter(({ language }) => getStaticCheckLanguageConfigForMenu(config, language).checkers.length > 0);
|
|
3929
|
+
if (configured.length === 0) {
|
|
3930
|
+
return [
|
|
3931
|
+
{
|
|
3932
|
+
id: "view-static-check-empty",
|
|
3933
|
+
label: "No configured static checkers",
|
|
3934
|
+
value: "(none)",
|
|
3935
|
+
description: "Configure at least one Command static-check entry before inspecting configuration.",
|
|
3936
|
+
disabled: true,
|
|
3937
|
+
labelTone: "dim",
|
|
3938
|
+
valueTone: "dim",
|
|
3939
|
+
},
|
|
3940
|
+
{
|
|
3941
|
+
id: "view-static-check-close",
|
|
3942
|
+
label: "Close",
|
|
3943
|
+
value: "",
|
|
3944
|
+
description: "Close the static-check inspection view and return to the previous menu.",
|
|
3945
|
+
},
|
|
3946
|
+
];
|
|
3947
|
+
}
|
|
3948
|
+
return [
|
|
3949
|
+
...configured.map(({ language, extensions }) => {
|
|
3950
|
+
const languageConfig = getStaticCheckLanguageConfigForMenu(config, language);
|
|
3951
|
+
const summary = formatStaticCheckLanguageCheckerSummary(config, language);
|
|
3952
|
+
const checkerCount = languageConfig.checkers.length;
|
|
3953
|
+
const suffix = checkerCount === 1 ? "checker" : "checkers";
|
|
3954
|
+
return {
|
|
3955
|
+
id: `view-static-check-language:${language}`,
|
|
3956
|
+
label: language,
|
|
3957
|
+
value: summary,
|
|
3958
|
+
description: `Read-only inspection of the configured Command static-check entries for ${language}. Supported extensions: ${extensions.join(", ")}. ${checkerCount} ${suffix}.`,
|
|
3959
|
+
disabled: true,
|
|
3960
|
+
labelTone: "dim" as const,
|
|
3961
|
+
valueTone: "dim" as const,
|
|
3962
|
+
};
|
|
3963
|
+
}),
|
|
3964
|
+
{
|
|
3965
|
+
id: "view-static-check-close",
|
|
3966
|
+
label: "Close",
|
|
3967
|
+
value: "",
|
|
3968
|
+
description: "Close the static-check inspection view and return to the previous menu.",
|
|
3969
|
+
},
|
|
3970
|
+
];
|
|
3971
|
+
}
|
|
3972
|
+
|
|
3973
|
+
/**
|
|
3974
|
+
* @brief Builds the confirmation submenu choices for removing one configured static-check language.
|
|
3975
|
+
* @details Renders each configured checker as a disabled preview row, appends explicit approve and abort actions, and falls back to one disabled no-op row when the language has no checkers. Runtime is O(c * p). No external state is mutated.
|
|
3976
|
+
* @param[in] language {string} Canonical language name targeted for removal.
|
|
3977
|
+
* @param[in] checkers {StaticCheckEntry[]} Configured checker entries that removal would clear.
|
|
3978
|
+
* @return {PiUsereqSettingsMenuChoice[]} Ordered removal-confirmation choices.
|
|
3979
|
+
* @satisfies REQ-349
|
|
3980
|
+
*/
|
|
3981
|
+
function buildStaticCheckRemovalConfirmationChoices(
|
|
3982
|
+
language: string,
|
|
3983
|
+
checkers: StaticCheckEntry[],
|
|
3984
|
+
): PiUsereqSettingsMenuChoice[] {
|
|
3985
|
+
const previewRows = checkers.length > 0
|
|
3986
|
+
? checkers.map((entry, index) => ({
|
|
3987
|
+
id: `removal-preview:${language}:${index}`,
|
|
3988
|
+
label: formatStaticCheckCheckerEntry(entry),
|
|
3989
|
+
value: `${language} checker`,
|
|
3990
|
+
description: `Remove the configured Command static-check entry ${formatStaticCheckCheckerEntry(entry)} from ${language}.`,
|
|
3991
|
+
disabled: true,
|
|
3992
|
+
labelTone: "dim" as const,
|
|
3993
|
+
valueTone: "dim" as const,
|
|
3994
|
+
}))
|
|
3995
|
+
: [{
|
|
3996
|
+
id: `removal-preview:${language}:none`,
|
|
3997
|
+
label: `No configured checkers for ${language}`,
|
|
3998
|
+
value: "nothing to remove",
|
|
3999
|
+
description: `No configured static-check entries exist for ${language}.`,
|
|
4000
|
+
disabled: true,
|
|
4001
|
+
labelTone: "dim" as const,
|
|
4002
|
+
valueTone: "dim" as const,
|
|
4003
|
+
}];
|
|
4004
|
+
return [
|
|
4005
|
+
...previewRows,
|
|
4006
|
+
{
|
|
4007
|
+
id: "removal-approve",
|
|
4008
|
+
label: "Approve removal",
|
|
4009
|
+
value: `${checkers.length} ${checkers.length === 1 ? "checker" : "checkers"}`,
|
|
4010
|
+
description: `Remove every configured static-check entry for ${language}.`,
|
|
4011
|
+
},
|
|
4012
|
+
{
|
|
4013
|
+
id: "removal-abort",
|
|
4014
|
+
label: "Abort removal",
|
|
4015
|
+
value: "keep current",
|
|
4016
|
+
description: `Keep the configured static-check entries for ${language}.`,
|
|
4017
|
+
},
|
|
4018
|
+
];
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
/**
|
|
4022
|
+
* @brief Opens one explicit removal-confirmation submenu for a configured static-check language.
|
|
4023
|
+
* @details Renders the targeted checker entries before removal 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.
|
|
4024
|
+
* @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
4025
|
+
* @param[in] language {string} Canonical language name targeted for removal.
|
|
4026
|
+
* @param[in] checkers {StaticCheckEntry[]} Configured checker entries that removal would clear.
|
|
4027
|
+
* @return {Promise<boolean>} `true` when the removal is explicitly approved.
|
|
4028
|
+
* @satisfies REQ-349
|
|
4029
|
+
*/
|
|
4030
|
+
async function confirmStaticCheckRemoval(
|
|
4031
|
+
ctx: ExtensionCommandContext,
|
|
4032
|
+
language: string,
|
|
4033
|
+
checkers: StaticCheckEntry[],
|
|
4034
|
+
): Promise<boolean> {
|
|
4035
|
+
const choice = await showPiUsereqSettingsMenu(
|
|
4036
|
+
ctx,
|
|
4037
|
+
`Remove static code checker: ${language}`,
|
|
4038
|
+
buildStaticCheckRemovalConfirmationChoices(language, checkers),
|
|
4039
|
+
);
|
|
4040
|
+
return choice === "removal-approve";
|
|
4041
|
+
}
|
|
4042
|
+
|
|
3880
4043
|
/**
|
|
3881
4044
|
* @brief Runs the interactive static-check configuration menu.
|
|
3882
|
-
* @details Lets the user add
|
|
4045
|
+
* @details Lets the user add, inspect, confirm-before-remove, and reset 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.
|
|
3883
4046
|
* @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
3884
4047
|
* @param[in,out] config {UseReqConfig} Mutable configuration object.
|
|
3885
4048
|
* @return {Promise<void>} Promise resolved when the menu closes.
|
|
3886
|
-
* @satisfies REQ-008, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-195, REQ-248, REQ-253
|
|
4049
|
+
* @satisfies REQ-008, REQ-151, REQ-152, REQ-153, REQ-154, REQ-160, REQ-161, REQ-193, REQ-195, REQ-248, REQ-253, REQ-345, REQ-346, REQ-347, REQ-348, REQ-349
|
|
3887
4050
|
*/
|
|
3888
4051
|
async function configureStaticCheckMenu(
|
|
3889
4052
|
ctx: ExtensionCommandContext,
|
|
@@ -3978,6 +4141,11 @@ async function configureStaticCheckMenu(
|
|
|
3978
4141
|
continue;
|
|
3979
4142
|
}
|
|
3980
4143
|
|
|
4144
|
+
if (staticChoice === "view-static-check-entry") {
|
|
4145
|
+
await showPiUsereqSettingsMenu(ctx, "View static code checker", buildStaticCheckViewChoices(config));
|
|
4146
|
+
continue;
|
|
4147
|
+
}
|
|
4148
|
+
|
|
3981
4149
|
if (staticChoice === "remove-static-check-entry") {
|
|
3982
4150
|
const configuredLanguage = await showPiUsereqSettingsMenu(ctx, "Remove static code checker", buildConfiguredStaticCheckLanguageChoices(config));
|
|
3983
4151
|
if (!configuredLanguage) {
|
|
@@ -4004,12 +4172,40 @@ async function configureStaticCheckMenu(
|
|
|
4004
4172
|
ctx.ui.notify("Restored default static code checker configuration", "info");
|
|
4005
4173
|
continue;
|
|
4006
4174
|
}
|
|
4175
|
+
const targetedCheckers = getStaticCheckLanguageConfigForMenu(config, configuredLanguage).checkers;
|
|
4176
|
+
const removalApproved = await confirmStaticCheckRemoval(ctx, configuredLanguage, targetedCheckers);
|
|
4177
|
+
if (!removalApproved) {
|
|
4178
|
+
ctx.ui.notify(`Aborted removal of static-check entries for ${configuredLanguage}`, "info");
|
|
4179
|
+
continue;
|
|
4180
|
+
}
|
|
4007
4181
|
config["static-check"][configuredLanguage] = createStaticCheckLanguageConfig([]);
|
|
4008
4182
|
onConfigChange();
|
|
4009
4183
|
ctx.ui.notify(`Removed static-check entries for ${configuredLanguage}`, "info");
|
|
4010
4184
|
continue;
|
|
4011
4185
|
}
|
|
4012
4186
|
|
|
4187
|
+
if (staticChoice === "reset-static-check-entry") {
|
|
4188
|
+
const approved = await confirmResetChanges(
|
|
4189
|
+
ctx,
|
|
4190
|
+
"Confirm static-check reset",
|
|
4191
|
+
[{
|
|
4192
|
+
label: "Language static code checkers",
|
|
4193
|
+
previousValue: formatStaticCheckLanguagesSummary(config),
|
|
4194
|
+
nextValue: formatStaticCheckLanguagesSummary({ ...config, "static-check": getDefaultStaticCheckConfig() }),
|
|
4195
|
+
}].filter((change) => change.previousValue !== change.nextValue),
|
|
4196
|
+
"Approve restoring the documented per-language static-check defaults.",
|
|
4197
|
+
"Abort the static-check reset and keep the current values.",
|
|
4198
|
+
);
|
|
4199
|
+
if (!approved) {
|
|
4200
|
+
ctx.ui.notify("Aborted static-check reset", "info");
|
|
4201
|
+
continue;
|
|
4202
|
+
}
|
|
4203
|
+
resetStaticCheckConfig(config);
|
|
4204
|
+
onConfigChange();
|
|
4205
|
+
ctx.ui.notify("Restored default static code checker configuration", "info");
|
|
4206
|
+
continue;
|
|
4207
|
+
}
|
|
4208
|
+
|
|
4013
4209
|
if (staticChoice === "reset-defaults") {
|
|
4014
4210
|
const approved = await confirmResetChanges(
|
|
4015
4211
|
ctx,
|
|
@@ -6692,10 +6692,17 @@ test("configuration menu omits removed static-check raw-spec and reference actio
|
|
|
6692
6692
|
const renderedStaticCheckMenu = (ctx.__state.customRenderLines[1] ?? []).join("\n");
|
|
6693
6693
|
const staticCheckItems = ctx.__state.selectCalls[1]?.items ?? [];
|
|
6694
6694
|
assert.match(renderedStaticCheckMenu, /Add static code checker/);
|
|
6695
|
+
assert.match(renderedStaticCheckMenu, /View static code checker/);
|
|
6695
6696
|
assert.match(renderedStaticCheckMenu, /Remove static code checker/);
|
|
6696
|
-
assert.
|
|
6697
|
+
assert.match(renderedStaticCheckMenu, /Reset static code checker/);
|
|
6698
|
+
assert.deepEqual(staticCheckItems.slice(0, 4), [
|
|
6699
|
+
"Add static code checker",
|
|
6700
|
+
"View static code checker",
|
|
6701
|
+
"Remove static code checker",
|
|
6702
|
+
"Reset static code checker",
|
|
6703
|
+
]);
|
|
6697
6704
|
assert.deepEqual(
|
|
6698
|
-
staticCheckItems.slice(
|
|
6705
|
+
staticCheckItems.slice(4, 24),
|
|
6699
6706
|
getSupportedStaticCheckLanguageSupport().map((entry) => entry.language),
|
|
6700
6707
|
);
|
|
6701
6708
|
assert.deepEqual(staticCheckItems.slice(-1), ["Reset defaults"]);
|