pi-usereq 0.13.0 → 0.33.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.
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  title: "PI-useReq Requirements"
3
3
  description: Software requirements specification
4
- version: "0.0.66"
5
- date: "2026-04-27"
4
+ version: "0.0.68"
5
+ date: "2026-05-29"
6
6
  author: "OpenAI Codex"
7
7
  scope:
8
8
  paths:
@@ -69,6 +69,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
69
69
  - **CTN-015**: MUST reserve `*-path` names for absolute paths and `*-dir` names for relative paths.
70
70
  - **CTN-016**: MUST NOT modify any path under `docs/` during analysis, implementation, verification, or bug fixing.
71
71
  - **CTN-017**: MUST NOT modify any path under `pi.dev-src/` during analysis, implementation, verification, or bug fixing.
72
+ - **CTN-019**: MUST persist local `DEBUG_TOOL_COMMANDS_ENABLED` with allowed values `enable` and `disable`, defaulting to `disable`.
72
73
 
73
74
  ## 3. Requirements
74
75
 
@@ -87,6 +88,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
87
88
  - **DES-009**: MUST treat `docs/pi.dev/coding-agent-docs/` and documents referenced by `docs/pi.dev/agent-document-manifest.json` as the authoritative read-only contract for new or modified software that interfaces with the pi.dev CLI.
88
89
  - **DES-010**: MUST centralize event-driven context snapshots, run-timing state, prompt-orchestration workflow state, and status-bar rendering through shared extension-status helpers.
89
90
  - **DES-011**: MUST implement `.github/workflows/release-npm.yml` as a two-job GitHub Actions pipeline where `check-branch` gates `build-release`, preserving changelog-driven GitHub Release creation while adding npm publication.
91
+ - **DES-015**: MUST implement config-gated `debug-compress`, `debug-references`, `debug-static-check`, and `debug-tokens` slash-command wrappers in `src/index.ts` that reuse existing tool-runner execution paths.
90
92
 
91
93
  ### 3.2 Functions
92
94
  - **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.
@@ -364,7 +366,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
364
366
  - **REQ-043**: MUST archive repository scenarios for `summarize`, `compress`, `find`, `tokens`, `enable-static-check`, `files-static-check`, and `static-check`.
365
367
  - **REQ-138**: MUST make `.github/workflows/release-npm.yml` trigger release automation from pushed tags matched by the existing workflow filter `v[0-9]+.[0-9]+.[0-9]+`.
366
368
  - **REQ-139**: MUST skip downstream release work unless `check-branch` confirms the tagged commit is contained in `origin/master`.
367
- - **REQ-140**: MUST configure Node.js plus npm registry authentication, run `npm ci`, remove manifest `private`, and publish with provenance and public access using `secrets.NPM_TOKEN`.
369
+ - **REQ-140**: MUST configure `.github/workflows/release-npm.yml` to use Node.js `24.15.0`, npm registry authentication, run `npm ci`, remove manifest `private`, and publish with provenance and public access using `secrets.NPM_TOKEN`.
368
370
  - **REQ-141**: MUST preserve the existing changelog-builder step and use its output as the non-draft non-prerelease GitHub Release body.
369
371
  - **REQ-155**: MUST keep `package.json` `name` equal to `pi-usereq` so npm publication resolves to `https://www.npmjs.com/package/pi-usereq`.
370
372
  - **REQ-157**: MUST declare `package.json` `repository.type` as `git` and `repository.url` as `git+https://github.com/Ogekuri/PI-useReq.git`.
@@ -381,6 +383,11 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
381
383
  - **REQ-152**: MUST render a persistent bottom-line description for the currently selected configuration entry.
382
384
  - **REQ-153**: MUST use scrollable configuration menus when entry count exceeds the visible row budget.
383
385
  - **REQ-154**: MUST wrap configuration-menu selection from last-to-first and first-to-last entries.
386
+ - **REQ-321**: MUST render `Enable debug commands for tools` in `Debug` after `Log file` and before `Log on status`.
387
+ - **REQ-322**: MUST persist `DEBUG_TOOL_COMMANDS_ENABLED` through the `Debug` submenu with immediate-save, reset, and focus-preserving re-render behavior.
388
+ - **REQ-323**: MUST register `debug-compress`, `debug-references`, `debug-static-check`, and `debug-tokens` only when `DEBUG_TOOL_COMMANDS_ENABLED=enable`.
389
+ - **REQ-324**: MUST make `debug-compress`, `debug-references`, `debug-static-check`, and `debug-tokens` reuse the `compress`, `references`, `static-check`, and `tokens` runner outputs and write `content[0].text` to the editor.
390
+ - **REQ-325**: MUST reject `debug-compress`, `debug-references`, `debug-static-check`, and `debug-tokens` execution when `DEBUG_TOOL_COMMANDS_ENABLED=disable`.
384
391
 
385
392
  ## 4. Test Requirements
386
393
  - **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.
@@ -454,7 +461,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
454
461
  - **TST-027**: MUST verify harness inspection surfaces `files-compress` and `compress` descriptions covering parameters, line-number behavior, monolithic markdown output, and failure details.
455
462
  - **TST-028**: MUST verify `files-static-check` and `static-check` agent-tool outputs place the monolithic static-check report in `content[0].text` and restrict `details` to execution metadata.
456
463
  - **TST-029**: MUST verify harness inspection surfaces `files-static-check` and `static-check` descriptions covering parameters, monolithic output, selection rules, and failure details.
457
- - **TST-039**: MUST verify `.github/workflows/release-npm.yml` keeps the existing tag filter, gates downstream release work on `origin/master`, runs npm publication, and creates the GitHub Release from generated changelog text.
464
+ - **TST-039**: MUST verify `.github/workflows/release-npm.yml` keeps the existing tag filter, gates downstream release work on `origin/master`, uses Node.js `24.15.0`, runs npm publication, and creates the GitHub Release from generated changelog text.
458
465
  - **TST-042**: MUST verify `package.json` keeps `name` equal to `pi-usereq` so npm publication resolves to `https://www.npmjs.com/package/pi-usereq`.
459
466
  - **TST-044**: MUST verify `package.json` keeps npm provenance metadata aligned to the canonical GitHub repository, issues URL, and README homepage.
460
467
  - **TST-040**: MUST verify local and global configuration files omit derived static and dynamic path fields while runtime path context and status rendering still derive them correctly.
@@ -493,6 +500,10 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
493
500
  - **TST-066**: MUST verify `req-<prompt>` commands keep working when extension custom-tool registrations are removed from the runtime inventory.
494
501
  - **TST-059**: MUST verify every agent-tool registration defines custom `renderResult` and that compact rendering shows essential invocation parameters while expanded rendering avoids fallback raw-content display.
495
502
  - **TST-086**: MUST verify bundled prompt-backed `req-<prompt>` commands abort before prompt dispatch when the persisted execution-session header cwd or `process.cwd()` differs from the expected execution path, and abort before merge when persisted execution-session header metadata or verified worktree artifacts diverge, while stale pre-switch context probes alone do not abort.
503
+ - **TST-113**: MUST verify default local configuration persists `DEBUG_TOOL_COMMANDS_ENABLED=disable`, and the `Debug` submenu renders `Enable debug commands for tools` before `Log on status`.
504
+ - **TST-114**: MUST verify the `Debug` submenu persists `DEBUG_TOOL_COMMANDS_ENABLED` through immediate-save, reset, and focus-preserving re-render flows.
505
+ - **TST-115**: MUST verify extension activation registers `debug-compress`, `debug-references`, `debug-static-check`, and `debug-tokens` only when `DEBUG_TOOL_COMMANDS_ENABLED=enable`.
506
+ - **TST-116**: MUST verify `debug-compress`, `debug-references`, `debug-static-check`, and `debug-tokens` write the same `content[0].text` as `compress`, `references`, `static-check`, and `tokens`, and reject execution when disabled.
496
507
 
497
508
  ## 5. Observed Component Model
498
509
 
@@ -521,7 +532,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
521
532
  ### 5.3 Packaging and Tooling Surface
522
533
  - `package.json` declares `type: "module"`, `pi.extensions: ["./src/index.ts"]`, and the scripts `test`, `test:watch`, `cli`, `debug:ext`, `debug:ext:inspect`, `debug:ext:session`, `debug:ext:command`, `debug:ext:tool`, and `debug:ext:sdk`.
523
534
  - `tsconfig.json` declares `target: "ES2022"`, `module: "NodeNext"`, `moduleResolution: "NodeNext"`, `strict: true`, `noEmit: true`, `skipLibCheck: true`, `resolveJsonModule: true`, and `types: ["node"]`.
524
- - `.github/workflows/release-npm.yml` validates canonical release tags, publishes the package to npm, and creates the matching GitHub Release.
535
+ - `.github/workflows/release-npm.yml` validates canonical release tags, pins Node.js `24.15.0` for release execution, publishes the package to npm, and creates the matching GitHub Release.
525
536
  - `package.json` declares version `0.0.0` while `package-lock.json` resolves the top-level package as version `0.1.0`; this manifest metadata is inconsistent in the current revision.
526
537
 
527
538
  ## 6. Repository Structure
@@ -592,7 +603,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
592
603
  - `tests/prompt-rendering.test.ts` covers home-resource synchronization and placeholder replacement in rendered prompts.
593
604
  - `tests/oracle-standalone.test.ts` compares non-tab-sensitive standalone `files-*` outputs against the Python `usereq.cli` oracle, asserts Go-fixture tab preservation, and compares `--test-static-check` dummy/command outputs against archived fixtures.
594
605
  - `tests/oracle-project.test.ts` compares non-tab-sensitive project commands against the Python oracle, asserts Go-source tab preservation for project extraction commands, and verifies archived `files-static-check` plus `static-check` outputs.
595
- - `tests/release-workflow.test.ts` verifies semver-tag gating, npm publication steps, and GitHub release creation directives in `.github/workflows/release-npm.yml`.
606
+ - `tests/release-workflow.test.ts` verifies semver-tag gating, the pinned Node.js `24.15.0` release runtime, npm publication steps, and GitHub release creation directives in `.github/workflows/release-npm.yml`.
596
607
  - Test business logic focuses on parity with the Python oracle, persistent config mutation, startup-tool activation, prompt-command worktree lifecycle correctness, and npm release workflow structure.
597
608
 
598
609
  ## 8. Evidence Matrix
@@ -685,7 +696,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
685
696
  | REQ-031 | `src/index.ts` :: `registerConfigCommands` :: `pi-usereq-show-config` writes `JSON.stringify(config, null, 2)` into the editor. |
686
697
  | REQ-138 | `.github/workflows/release-npm.yml` :: `on.push.tags` plus release-tag validation restrict automation to canonical `v<major>.<minor>.<patch>` tags. |
687
698
  | REQ-139 | `.github/workflows/release-npm.yml` :: branch-check job fetches `origin/master` and gates downstream jobs on containment of `github.sha`. |
688
- | REQ-140 | `.github/workflows/release-npm.yml` :: publish job uses `actions/setup-node`, `npm ci`, `npm pkg delete private`, and `npm publish --provenance` with `NODE_AUTH_TOKEN`. |
699
+ | REQ-140 | `.github/workflows/release-npm.yml` :: `env.NODE_VERSION` is `24.15.0`; publish job uses `actions/setup-node`, `npm ci`, `npm pkg delete private`, and `npm publish --provenance --access public` with `NODE_AUTH_TOKEN`. |
689
700
  | REQ-141 | `.github/workflows/release-npm.yml` :: release job uses changelog-builder output as `softprops/action-gh-release` body with non-draft and non-prerelease flags. |
690
701
 
691
702
  ### 8.4 TST Evidence
@@ -715,7 +726,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
715
726
  | TST-023 | `tests/extension-registration.test.ts` :: `summary tools register agent-oriented descriptions and schema details`. |
716
727
  | TST-024 | `tests/extension-registration.test.ts` :: `source-extraction agent tools preserve leading tabs in emitted content` plus the explicit `files-search` and `search` monolithic-output tests. |
717
728
  | TST-026 | `tests/extension-registration.test.ts` :: `source-extraction agent tools preserve leading tabs in emitted content` plus the explicit `files-compress` and `compress` monolithic-output tests. |
718
- | TST-039 | `tests/release-workflow.test.ts` :: workflow-content assertions cover semver gating, `origin/master` containment, npm publication, and GitHub release generation. |
729
+ | TST-039 | `tests/release-workflow.test.ts` :: workflow-content assertions cover semver gating, `origin/master` containment, Node.js `24.15.0`, npm publication, and GitHub release generation. |
719
730
 
720
731
  ## 9. Performance Notes
721
732
  No explicit performance optimizations identified.
@@ -44,7 +44,7 @@
44
44
  - Threads: no explicit threads detected
45
45
  - ID: `PROC:gh-release-build`
46
46
  - Type: Process
47
- - Role: GitHub Actions release runner that publishes the npm package, builds changelog text, and creates the GitHub Release after branch gating succeeds.
47
+ - Role: GitHub Actions release runner that configures Node.js `24.15.0`, publishes the npm package, builds changelog text, and creates the GitHub Release after branch gating succeeds.
48
48
  - Entrypoints:
49
49
  - `build-release(...)` [`.github/workflows/release-npm.yml`]
50
50
  - Parent Process: none
@@ -880,6 +880,15 @@
880
880
  - `cleanupPromptWorktreeCreation(...)`: remove registered worktree entries, leftover directories, and matching branches [`src/core/prompt-command-runtime.ts`]
881
881
  - `promptWorktreeRegistered(...)`: test whether the sibling worktree remains registered [`src/core/prompt-command-runtime.ts`]
882
882
  - `promptWorktreeBranchExists(...)`: test whether the matching branch remains present [`src/core/prompt-command-runtime.ts`]
883
+ - `getProcessCwdSafe(...)`: resolve a fallback-safe activation cwd before optional debug command registration [`src/index.ts`]
884
+ - `shouldRegisterDebugToolCommands(...)`: load local config and decide whether debug tool wrapper commands should register during activation [`src/index.ts`]
885
+ - `loadProjectConfig(...)`: load config and normalize persisted directory paths for activation-time debug command gating [`src/index.ts`]
886
+ - `getProjectBase(...)`: resolve project base from the activation cwd [`src/index.ts`]
887
+ - `loadConfig(...)`: load config or defaults [`src/core/config.ts`]
888
+ - `getProjectConfigPath(...)`: resolve config file path [`src/core/config.ts`]
889
+ - `getDefaultConfig(...)`: build default config [`src/core/config.ts`]
890
+ - `normalizeEnabledPiUsereqTools(...)`: canonicalize startup tools [`src/core/pi-usereq-tools.ts`]
891
+ - `registerDebugToolCommands(...)`: register config-gated debug slash-command wrappers for `compress`, `references`, `static-check`, and `tokens` [`src/index.ts`]
883
892
  - `registerAgentTools(...)`: register structured pi tools whose execute callbacks reuse internal runner families, the status-only references writer, token-optimized payload builders, and compact-plus-expanded custom result renderers [`src/index.ts`]
884
893
  - `ensureBundledResourcesAccessible(...)`: validate installation-owned bundled resources for tool executes that need bundled assets [`src/core/resources.ts`]
885
894
  - `getBundledResourceRoot(...)`: resolve installation-owned resource root [`src/core/resources.ts`]
@@ -1183,10 +1192,11 @@
1183
1192
  - `getPiUsereqStartupTools(...)`: enumerate configurable tools from runtime inventory in documented menu order [`src/index.ts`]
1184
1193
  - `buildPiUsereqToolToggleChoices(...)`: serialize per-tool startup-toggle rows plus the value-less terminal reset action [`src/index.ts`]
1185
1194
  - `buildTerminalSettingsMenuChoices(...)`: append the canonical value-less `Reset defaults` row to the selector menu [`src/index.ts`]
1186
- - `configureDebugMenu(...)`: interactive debug editor with in-place enable or disable toggles, workflow filters, reset confirmation, and per-tool plus per-prompt selectors [`src/index.ts`]
1187
- - `buildDebugMenuChoices(...)`: serialize global debug controls, workflow-event toggles, canonical tool and prompt toggles, and the value-less terminal reset row [`src/index.ts`]
1195
+ - `configureDebugMenu(...)`: interactive debug editor with in-place enable or disable toggles, tool-wrapper command registration, workflow filters, reset confirmation, and per-tool plus per-prompt selectors [`src/index.ts`]
1196
+ - `buildDebugMenuChoices(...)`: serialize global debug controls, the `Enable debug commands for tools` row, workflow-event toggles, canonical tool and prompt toggles, and the value-less terminal reset row [`src/index.ts`]
1188
1197
  - `buildDebugMenuChoice(...)`: dim and disable locked debug rows while global debug is off [`src/index.ts`]
1189
1198
  - `getDebugToolToggleNames(...)`: enumerate debuggable tool names in canonical grouped order [`src/index.ts`]
1199
+ - `registerDebugToolCommands(...)`: register debug slash-command wrappers immediately when the tool-wrapper row transitions to `enable` [`src/index.ts`]
1190
1200
  - `selectDebugLogOnStatus(...)`: select one explicit workflow-state filter or `any` [`src/index.ts`]
1191
1201
  - `confirmResetChanges(...)`: require explicit approval before applying reset mutations [`src/index.ts`]
1192
1202
  - `resetDebugConfigToDefaults(...)`: restore the debug configuration subtree to documented defaults [`src/index.ts`]
@@ -1227,7 +1237,7 @@
1227
1237
  - Threads: no explicit threads detected.
1228
1238
  - Internal Call-Trace Tree:
1229
1239
  - `check-branch(...)`: fetch `origin/master`, evaluate tagged-commit containment, and export the downstream gate flag [`.github/workflows/release-npm.yml`]
1230
- - External boundaries: `actions/checkout@v4`, GitHub Actions runner shell, `git` CLI, `grep`, and `$GITHUB_OUTPUT`.
1240
+ - External boundaries: `actions/checkout@v5`, GitHub Actions runner shell, `git` CLI, `grep`, and `$GITHUB_OUTPUT`.
1231
1241
  - External Boundaries:
1232
1242
  - GitHub Actions event routing, hosted-runner lifecycle, checkout action, git subprocesses, and runner output channels.
1233
1243
 
@@ -1240,8 +1250,8 @@
1240
1250
  - Looping model: single-pass job with sequential step execution.
1241
1251
  - Threads: no explicit threads detected.
1242
1252
  - Internal Call-Trace Tree:
1243
- - `build-release(...)`: checkout repository content, configure Node.js for npm, install dependencies, remove manifest `private`, publish the package, build changelog text, and create the GitHub Release [`.github/workflows/release-npm.yml`]
1244
- - External boundaries: `actions/checkout@v4`, `actions/setup-node@v4`, npm CLI, npm registry, OIDC token issuance, `mikepenz/release-changelog-builder-action@v6`, `softprops/action-gh-release@v2`, `secrets.NPM_TOKEN`, and `secrets.GITHUB_TOKEN`.
1253
+ - `build-release(...)`: checkout repository content, configure Node.js `24.15.0` for npm publication, install dependencies, remove manifest `private`, publish the package, build changelog text, and create the GitHub Release [`.github/workflows/release-npm.yml`]
1254
+ - External boundaries: `actions/checkout@v5`, `actions/setup-node@v5`, npm CLI, npm registry, OIDC token issuance, `mikepenz/release-changelog-builder-action@v6`, `softprops/action-gh-release@v2`, `secrets.NPM_TOKEN`, and `secrets.GITHUB_TOKEN`.
1245
1255
  - External Boundaries:
1246
1256
  - GitHub Actions event routing, hosted-runner lifecycle, checkout action, setup-node action, npm CLI, npm registry, changelog-builder action, GitHub Releases API, and repository secrets.
1247
1257
 
@@ -36,6 +36,7 @@ import {
36
36
  DEFAULT_DEBUG_LOG_FILE,
37
37
  DEFAULT_DEBUG_LOG_ON_STATUS,
38
38
  DEFAULT_DEBUG_STATUS_CHANGES,
39
+ DEFAULT_DEBUG_TOOL_COMMANDS_ENABLED,
39
40
  DEFAULT_DEBUG_WORKFLOW_EVENTS,
40
41
  normalizeDebugEnabled,
41
42
  normalizeDebugEnabledPrompts,
@@ -43,7 +44,9 @@ import {
43
44
  normalizeDebugLogFile,
44
45
  normalizeDebugLogOnStatus,
45
46
  normalizeDebugStatusChanges,
47
+ normalizeDebugToolCommandsEnabled,
46
48
  normalizeDebugWorkflowEvents,
49
+ type DebugToolCommandsEnabled,
47
50
  } from "./debug-runtime.js";
48
51
  import { normalizeEnabledPiUsereqTools } from "./pi-usereq-tools.js";
49
52
  import { makeRelativeIfContainsProject } from "./utils.js";
@@ -90,6 +93,7 @@ export interface UseReqConfig {
90
93
  DEBUG_LOG_FILE: string;
91
94
  DEBUG_STATUS_CHANGES: "enable" | "disable";
92
95
  DEBUG_WORKFLOW_EVENTS: "enable" | "disable";
96
+ DEBUG_TOOL_COMMANDS_ENABLED: DebugToolCommandsEnabled;
93
97
  DEBUG_LOG_ON_STATUS: "any" | "idle" | "checking" | "running" | "merging" | "error";
94
98
  DEBUG_ENABLED_TOOLS: string[];
95
99
  DEBUG_ENABLED_PROMPTS: string[];
@@ -146,6 +150,7 @@ interface UseReqLocalConfig {
146
150
  DEBUG_LOG_FILE: string;
147
151
  DEBUG_STATUS_CHANGES: "enable" | "disable";
148
152
  DEBUG_WORKFLOW_EVENTS: "enable" | "disable";
153
+ DEBUG_TOOL_COMMANDS_ENABLED: DebugToolCommandsEnabled;
149
154
  DEBUG_LOG_ON_STATUS: "any" | "idle" | "checking" | "running" | "merging" | "error";
150
155
  DEBUG_ENABLED_TOOLS: string[];
151
156
  DEBUG_ENABLED_PROMPTS: string[];
@@ -547,9 +552,10 @@ export function getGlobalConfigPath(): string {
547
552
 
548
553
  /**
549
554
  * @brief Builds the default persisted local configuration.
550
- * @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.
555
+ * @details Populates canonical docs/test/source directories, derives local static-check enable defaults from the supplied global checker definitions, and seeds documented debug defaults including tool-wrapper command registration without any cross-project fields. Runtime is O(l). No filesystem side effects occur.
551
556
  * @param[in] globalStaticCheckConfig {Record<string, GlobalStaticCheckLanguageConfig>} Global checker definitions used to derive local enable defaults.
552
557
  * @return {UseReqLocalConfig} Fresh default local configuration object.
558
+ * @satisfies CTN-019
553
559
  */
554
560
  function getDefaultLocalConfig(
555
561
  globalStaticCheckConfig: Record<string, GlobalStaticCheckLanguageConfig>,
@@ -563,6 +569,7 @@ function getDefaultLocalConfig(
563
569
  DEBUG_LOG_FILE: DEFAULT_DEBUG_LOG_FILE,
564
570
  DEBUG_STATUS_CHANGES: DEFAULT_DEBUG_STATUS_CHANGES,
565
571
  DEBUG_WORKFLOW_EVENTS: DEFAULT_DEBUG_WORKFLOW_EVENTS,
572
+ DEBUG_TOOL_COMMANDS_ENABLED: DEFAULT_DEBUG_TOOL_COMMANDS_ENABLED,
566
573
  DEBUG_LOG_ON_STATUS: DEFAULT_DEBUG_LOG_ON_STATUS,
567
574
  DEBUG_ENABLED_TOOLS: [],
568
575
  DEBUG_ENABLED_PROMPTS: [],
@@ -608,7 +615,7 @@ function getDefaultGlobalConfig(): UseReqGlobalConfig {
608
615
 
609
616
  /**
610
617
  * @brief Merges persisted local and global configuration scopes into the effective runtime config.
611
- * @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.
618
+ * @details Normalizes local directories, combines local static-check enable flags with global checker arrays, resolves effective worktree disablement when automatic git commit is off, normalizes debug and notification fields including tool-wrapper command registration, and disables Pushover until both credentials are populated. Runtime is O(l + c + p). No external state is mutated.
612
619
  * @param[in] localConfig {UseReqLocalConfig} Persisted local configuration.
613
620
  * @param[in] globalConfig {UseReqGlobalConfig} Persisted global configuration.
614
621
  * @return {UseReqConfig} Effective merged configuration.
@@ -647,6 +654,7 @@ function mergeConfigScopes(
647
654
  DEBUG_LOG_FILE: normalizeDebugLogFile(localConfig.DEBUG_LOG_FILE),
648
655
  DEBUG_STATUS_CHANGES: normalizeDebugStatusChanges(localConfig.DEBUG_STATUS_CHANGES),
649
656
  DEBUG_WORKFLOW_EVENTS: normalizeDebugWorkflowEvents(localConfig.DEBUG_WORKFLOW_EVENTS),
657
+ DEBUG_TOOL_COMMANDS_ENABLED: normalizeDebugToolCommandsEnabled(localConfig.DEBUG_TOOL_COMMANDS_ENABLED),
650
658
  DEBUG_LOG_ON_STATUS: normalizeDebugLogOnStatus(localConfig.DEBUG_LOG_ON_STATUS),
651
659
  DEBUG_ENABLED_TOOLS: normalizeDebugEnabledTools(localConfig.DEBUG_ENABLED_TOOLS),
652
660
  DEBUG_ENABLED_PROMPTS: normalizeDebugEnabledPrompts(localConfig.DEBUG_ENABLED_PROMPTS),
@@ -686,7 +694,7 @@ function mergeConfigScopes(
686
694
  * @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.
687
695
  * @param[in] _projectBase {string} Absolute project root path retained for stable call sites.
688
696
  * @return {UseReqConfig} Fresh default effective configuration object.
689
- * @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
697
+ * @satisfies CTN-001, CTN-012, CTN-013, CTN-018, CTN-019, REQ-066, REQ-137, REQ-146, REQ-163, REQ-174, REQ-178, REQ-184, REQ-185, REQ-196, REQ-204, REQ-205, REQ-212, REQ-236, REQ-237, REQ-238, REQ-239, REQ-249, REQ-250, REQ-251, REQ-252, REQ-277, REQ-315, REQ-316
690
698
  */
691
699
  export function getDefaultConfig(_projectBase: string): UseReqConfig {
692
700
  const globalConfig = getDefaultGlobalConfig();
@@ -811,10 +819,11 @@ function normalizeGlobalStaticCheckConfig(
811
819
 
812
820
  /**
813
821
  * @brief Loads and sanitizes the persisted local configuration.
814
- * @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.
822
+ * @details Returns defaults when `<base-path>/.pi-usereq.json` is absent. Otherwise parses the local JSON payload, normalizes project-scoped directory, debug, tool-wrapper command registration, and static-check enable fields, and ignores misplaced global keys without migration. Runtime is O(n) in file size. Side effects are limited to filesystem reads.
815
823
  * @param[in] projectBase {string} Absolute project root path.
816
824
  * @param[in] defaultStaticCheckConfig {Record<string, LocalStaticCheckLanguageConfig>} Local static-check enable defaults derived from the current global checker map.
817
825
  * @return {UseReqLocalConfig} Sanitized local configuration.
826
+ * @satisfies CTN-019
818
827
  */
819
828
  function loadLocalConfig(
820
829
  projectBase: string,
@@ -832,6 +841,7 @@ function loadLocalConfig(
832
841
  DEBUG_LOG_FILE: DEFAULT_DEBUG_LOG_FILE,
833
842
  DEBUG_STATUS_CHANGES: DEFAULT_DEBUG_STATUS_CHANGES,
834
843
  DEBUG_WORKFLOW_EVENTS: DEFAULT_DEBUG_WORKFLOW_EVENTS,
844
+ DEBUG_TOOL_COMMANDS_ENABLED: DEFAULT_DEBUG_TOOL_COMMANDS_ENABLED,
835
845
  DEBUG_LOG_ON_STATUS: DEFAULT_DEBUG_LOG_ON_STATUS,
836
846
  DEBUG_ENABLED_TOOLS: [],
837
847
  DEBUG_ENABLED_PROMPTS: [],
@@ -858,6 +868,7 @@ function loadLocalConfig(
858
868
  DEBUG_LOG_FILE: normalizeDebugLogFile(data.DEBUG_LOG_FILE),
859
869
  DEBUG_STATUS_CHANGES: normalizeDebugStatusChanges(data.DEBUG_STATUS_CHANGES),
860
870
  DEBUG_WORKFLOW_EVENTS: normalizeDebugWorkflowEvents(data.DEBUG_WORKFLOW_EVENTS),
871
+ DEBUG_TOOL_COMMANDS_ENABLED: normalizeDebugToolCommandsEnabled(data.DEBUG_TOOL_COMMANDS_ENABLED),
861
872
  DEBUG_LOG_ON_STATUS: normalizeDebugLogOnStatus(data.DEBUG_LOG_ON_STATUS),
862
873
  DEBUG_ENABLED_TOOLS: normalizeDebugEnabledTools(data.DEBUG_ENABLED_TOOLS),
863
874
  DEBUG_ENABLED_PROMPTS: normalizeDebugEnabledPrompts(data.DEBUG_ENABLED_PROMPTS),
@@ -918,7 +929,7 @@ function loadGlobalConfig(): UseReqGlobalConfig {
918
929
  * @param[in] projectBase {string} Absolute project root path.
919
930
  * @return {UseReqConfig} Sanitized effective configuration.
920
931
  * @throws {ReqError} Throws with exit code `11` when either persisted config file contains invalid JSON or a non-object payload.
921
- * @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
932
+ * @satisfies CTN-012, CTN-013, CTN-018, CTN-019, REQ-066, REQ-137, REQ-146, REQ-163, REQ-174, REQ-178, REQ-184, REQ-185, REQ-196, REQ-204, REQ-205, REQ-212, REQ-215, REQ-234, REQ-235, REQ-236, REQ-237, REQ-238, REQ-239, REQ-249, REQ-277, REQ-315, REQ-316
922
933
  */
923
934
  export function loadConfig(projectBase: string): UseReqConfig {
924
935
  const globalConfig = loadGlobalConfig();
@@ -931,10 +942,10 @@ export function loadConfig(projectBase: string): UseReqConfig {
931
942
 
932
943
  /**
933
944
  * @brief Builds the persisted local configuration payload.
934
- * @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.
945
+ * @details Copies only project-scoped keys into a fresh object so runtime-derived metadata plus global checker, tool, git, and notification fields never reach `.pi-usereq.json`, while preserving the debug tool-wrapper command flag beside other local debug settings. Runtime is O(n) in config size. No external state is mutated.
935
946
  * @param[in] config {UseReqConfig} Effective configuration object.
936
947
  * @return {UseReqLocalConfig} Persistable local configuration payload.
937
- * @satisfies CTN-012, CTN-013, REQ-104, REQ-146, REQ-249, REQ-316, REQ-277
948
+ * @satisfies CTN-012, CTN-013, CTN-019, REQ-104, REQ-146, REQ-249, REQ-316, REQ-277
938
949
  */
939
950
  function buildPersistedLocalConfig(config: UseReqConfig): UseReqLocalConfig {
940
951
  const normalizedSrcDir = config["src-dir"]
@@ -959,6 +970,7 @@ function buildPersistedLocalConfig(config: UseReqConfig): UseReqLocalConfig {
959
970
  DEBUG_LOG_FILE: normalizeDebugLogFile(config.DEBUG_LOG_FILE),
960
971
  DEBUG_STATUS_CHANGES: normalizeDebugStatusChanges(config.DEBUG_STATUS_CHANGES),
961
972
  DEBUG_WORKFLOW_EVENTS: normalizeDebugWorkflowEvents(config.DEBUG_WORKFLOW_EVENTS),
973
+ DEBUG_TOOL_COMMANDS_ENABLED: normalizeDebugToolCommandsEnabled(config.DEBUG_TOOL_COMMANDS_ENABLED),
962
974
  DEBUG_LOG_ON_STATUS: normalizeDebugLogOnStatus(config.DEBUG_LOG_ON_STATUS),
963
975
  DEBUG_ENABLED_TOOLS: normalizeDebugEnabledTools(config.DEBUG_ENABLED_TOOLS),
964
976
  DEBUG_ENABLED_PROMPTS: normalizeDebugEnabledPrompts(config.DEBUG_ENABLED_PROMPTS),
@@ -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.