pi-usereq 0.40.0 → 0.42.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 +48 -0
- package/README.md +9 -3
- package/package.json +7 -4
- package/pi-usereq/docs/REFERENCES.md +303 -286
- package/pi-usereq/docs/REQUIREMENTS.md +18 -5
- package/pi-usereq/docs/WORKFLOW.md +47 -13
- package/scripts/install-static-checkers.ts +125 -0
- package/src/core/config.ts +5 -5
- package/src/core/prompt-command-runtime.ts +6 -6
- package/src/core/prompts.ts +6 -6
- package/src/core/req-references-command.ts +3 -3
- package/src/core/req-reset-command.ts +3 -3
- package/src/core/runtime-project-paths.ts +3 -3
- package/src/core/static-check.ts +61 -4
- package/src/index.ts +32 -9
- package/tests/extension-registration.test.ts +291 -1
- package/tests/prompt-command-summary.test.ts +36 -0
- package/tests/static-check-bundled.test.ts +100 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "PI-useReq Requirements"
|
|
3
3
|
description: Software requirements specification
|
|
4
|
-
version: "0.0.
|
|
4
|
+
version: "0.0.74"
|
|
5
5
|
date: "2026-07-10"
|
|
6
6
|
author: "OpenAI Codex"
|
|
7
7
|
scope:
|
|
@@ -90,6 +90,8 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
|
|
|
90
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
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.
|
|
92
92
|
- **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.
|
|
93
|
+
- **DES-017**: MUST declare `pyright`, `ruff`, and `eslint` as pinned caret-range npm dependencies and register a `postinstall` script that installs bundled static checkers.
|
|
94
|
+
- **DES-018**: MUST resolve checker executables by probing bundled `node_modules/.bin` paths relative to the installation path before falling back to `PATH` scan.
|
|
93
95
|
|
|
94
96
|
### 3.2 Functions
|
|
95
97
|
- **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.
|
|
@@ -162,6 +164,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
|
|
|
162
164
|
- **REQ-335**: MUST display a command invocation summary on screen for every bundled prompt-backed `req-<prompt>` command containing the command name, passed arguments, and active configuration.
|
|
163
165
|
- **REQ-336**: MUST render the command invocation summary with the command name without the `req-` prefix in uppercase and the user request arguments.
|
|
164
166
|
- **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.
|
|
167
|
+
- **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.
|
|
165
168
|
- **REQ-008**: MUST provide a `Language static code checkers` submenu that adds global Command entries by guided language flow, removes configured global checker entries, toggles local per-language enablement, and resets static-check configuration.
|
|
166
169
|
- **REQ-160**: MUST hardcode `Command` as the only user-configurable static-check module and omit module-selection UI from static-check configuration menus.
|
|
167
170
|
- **REQ-161**: MUST hide `Dummy` from user-configurable static-check menus while preserving existing-config parsing and debug-driver support for `Dummy` entries.
|
|
@@ -337,7 +340,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
|
|
|
337
340
|
- **REQ-020**: MUST parse user `--enable-static-check` specs in `LANG=Command,CMD[,PARAM...]` format and normalize supported language names plus `Command` case-insensitively.
|
|
338
341
|
- **REQ-021**: MUST reject user `--enable-static-check` specs with missing `=`, missing `Command`, missing `cmd`, unknown language, or any module other than `Command`.
|
|
339
342
|
- **REQ-022**: MUST preserve persisted `Dummy` static-check entries during config loading and execute them only when present in configuration or `--test-static-check dummy` input.
|
|
340
|
-
- **REQ-023**: MUST require `Command`-module executables to
|
|
343
|
+
- **REQ-023**: MUST require `Command`-module executables to resolve via bundled `node_modules/.bin` or `PATH` before static-check execution.
|
|
341
344
|
- **REQ-030**: MUST set static `base-path` from the bootstrap cwd and static `local-config-path` to `<base-path>/.pi-usereq.json`.
|
|
342
345
|
- **REQ-317**: MUST set static `global-config-path` to `~/.config/pi-usereq/config.json`.
|
|
343
346
|
- **REQ-259**: MUST set dynamic `context-path` from the bootstrap cwd and keep it aligned with `ctx.cwd`.
|
|
@@ -362,7 +365,7 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
|
|
|
362
365
|
- **REQ-035**: MUST parse repeatable `--enable-static-check LANG=Command,CMD[,PARAM...]` CLI options before command dispatch and merge resulting entries into persisted global checker lists.
|
|
363
366
|
- **REQ-253**: MUST set `static-check.<language>.enabled=enable` whenever guided or CLI `--enable-static-check` entry creation targets that language.
|
|
364
367
|
- **REQ-036**: MUST preserve existing global `static-check` checker entries, append non-duplicate `--enable-static-check` entries in argument order, and treat canonical language, module, cmd, and params as the duplicate identity.
|
|
365
|
-
- **REQ-037**: MUST reject `--enable-static-check` `Command` entries whose executable is
|
|
368
|
+
- **REQ-037**: MUST reject `--enable-static-check` `Command` entries whose executable is unresolvable via bundled `node_modules/.bin` or `PATH` and MUST NOT modify persisted local or global configuration when validation fails.
|
|
366
369
|
- **REQ-038**: MUST honor `--verbose` only for `files-summarize`, `files-compress`, `files-find`, `summarize`, `compress`, and `find`, emitting command progress to stderr while leaving stdout payload format unchanged.
|
|
367
370
|
- **REQ-039**: MUST support `--enable-line-numbers` only for `files-compress`, `compress`, `files-find`, and `find`, and MUST leave corresponding outputs unnumbered when the flag is absent.
|
|
368
371
|
- **REQ-040**: MUST store canonical expected CLI result fixtures as UTF-8 text files under `tests/fixtures_attended_results/`, preserving normalized exit code, stdout, and stderr for each archived scenario.
|
|
@@ -395,12 +398,18 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
|
|
|
395
398
|
- **REQ-325**: MUST reject `debug-compress`, `debug-references`, `debug-static-check`, `debug-summarize`, and `debug-tokens` execution when `DEBUG_TOOL_COMMANDS_ENABLED=disable`.
|
|
396
399
|
- **REQ-326**: MUST add a top-level `Context Files` row to the `pi-usereq` menu between `Unit tests directory` and `Auto git commit`.
|
|
397
400
|
- **REQ-327**: MUST expose a `Context Files` submenu with separate enable toggles for `REQUIREMENTS.md`, `REFERENCES.md`, and `WORKFLOW.md` in that order.
|
|
398
|
-
- **REQ-328**: MUST persist `context-files-requirements`, `context-files-references`, and `context-files-workflow` as boolean flags in local configuration, each defaulting to
|
|
401
|
+
- **REQ-328**: MUST persist `context-files-requirements`, `context-files-references`, and `context-files-workflow` as boolean flags in local configuration, each defaulting to disabled.
|
|
399
402
|
- **REQ-329**: MUST replace the `%%CONTEXT_FILES%%` prompt token with one markdown section per enabled context file in the order `REQUIREMENTS.md`, `REFERENCES.md`, `WORKFLOW.md`.
|
|
400
403
|
- **REQ-330**: MUST render each `%%CONTEXT_FILES%%` section as the file-name heading, an HTML `<file name="<docs-dir>/<filename>">` reference with `%%DOC_PATH%%` pre-substituted, and the raw file content inside four-backtick `markdown` fences.
|
|
401
404
|
- **REQ-331**: MUST omit the `%%CONTEXT_FILES%%` section for any disabled flag or missing context file without surfacing an error.
|
|
402
405
|
- **REQ-332**: MUST inject `%%CONTEXT_FILES%%` content verbatim after every other prompt replacement so literal `%%...%%` tokens inside context files are not substituted.
|
|
403
|
-
- **REQ-333**: MUST restore all three `Context Files` flags to
|
|
406
|
+
- **REQ-333**: MUST restore all three `Context Files` flags to disabled when the `Context Files` subtree `Reset defaults` is approved.
|
|
407
|
+
- **REQ-339**: MUST run `scripts/install-static-checkers.ts` as a best-effort exit-code-0 `postinstall` installer that probes bundled npm checkers, attempts `npm install` on miss, prints platform guidance for native checkers, and never modifies git-tracked files.
|
|
408
|
+
- **REQ-340**: MUST default the `TypeScript` static-check `Command` entry to `cmd: "eslint"` with empty `params`.
|
|
409
|
+
- **REQ-341**: MUST emit one warning notification during `session_start` listing missing enabled static checkers without transitioning workflow state or aborting.
|
|
410
|
+
- **REQ-342**: MUST keep `STATIC_CHECK_MODULES`, `dispatchStaticCheckForFile` signature, and `StaticCheckEntry` shape unchanged when adding bundled executable resolution.
|
|
411
|
+
- **REQ-343**: MUST NOT transition workflow state or abort `session_start` when one or more enabled static checkers are missing.
|
|
412
|
+
- **REQ-344**: MUST place the `session_start` missing-checker helper in `src/core/static-check.ts` so `src/index.ts` remains thin.
|
|
404
413
|
|
|
405
414
|
## 4. Test Requirements
|
|
406
415
|
- **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.
|
|
@@ -522,6 +531,10 @@ PI-useReq is a TypeScript pi extension plus companion Node CLI and standalone ex
|
|
|
522
531
|
- **TST-118**: MUST verify the `Context Files` submenu persists the three context-file flags in local configuration with immediate-save, reset, and focus-preserving re-render behavior.
|
|
523
532
|
- **TST-119**: MUST verify `%%CONTEXT_FILES%%` replacement emits one section per enabled existing file in the documented order and omits disabled or missing files.
|
|
524
533
|
- **TST-120**: MUST verify `%%CONTEXT_FILES%%` sections use the file-name heading, the pre-substituted HTML file reference, and four-backtick `markdown` fences around raw content.
|
|
534
|
+
- **TST-122**: MUST verify the command invocation summary renders `none` for `context files`, `static code checks`, and `enabled tools` when no items are enabled in each respective category.
|
|
535
|
+
- **TST-123**: MUST verify `resolveCheckerExecutable` probes bundled `node_modules/.bin` paths before `PATH` scan.
|
|
536
|
+
- **TST-124**: MUST verify `scripts/install-static-checkers.ts` always returns exit code `0` regardless of probe or install outcomes.
|
|
537
|
+
- **TST-125**: MUST verify `session_start` emits one warning notification for missing enabled checkers without aborting or transitioning workflow state.
|
|
525
538
|
|
|
526
539
|
## 5. Observed Component Model
|
|
527
540
|
|
|
@@ -49,6 +49,13 @@
|
|
|
49
49
|
- `build-release(...)` [`.github/workflows/release-npm.yml`]
|
|
50
50
|
- Parent Process: none
|
|
51
51
|
- Threads: no explicit threads detected
|
|
52
|
+
- ID: `PROC:install-static-checkers`
|
|
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.
|
|
55
|
+
- Entrypoints:
|
|
56
|
+
- `main(...)` [`scripts/install-static-checkers.ts`]
|
|
57
|
+
- Parent Process: none
|
|
58
|
+
- Threads: no explicit threads detected
|
|
52
59
|
|
|
53
60
|
## Execution Units
|
|
54
61
|
### `PROC:main`
|
|
@@ -83,8 +90,9 @@
|
|
|
83
90
|
- `buildStaticCheckEntryIdentity(...)`: normalize entry duplicate identity [`src/core/static-check.ts`]
|
|
84
91
|
- `parseEnableStaticCheck(...)`: parse one static-check enable specification [`src/core/static-check.ts`]
|
|
85
92
|
- `validateStaticCheckEntry(...)`: validate command-backed entry before config write [`src/core/static-check.ts`]
|
|
86
|
-
- `
|
|
87
|
-
- `
|
|
93
|
+
- `resolveCheckerExecutable(...)`: resolve executable via bundled `node_modules/.bin` or PATH scan [`src/core/static-check.ts`]
|
|
94
|
+
- `findExecutable(...)`: resolve executable on PATH or explicit path [`src/core/static-check.ts`]
|
|
95
|
+
- `isExecutableFile(...)`: verify executable access bits [`src/core/static-check.ts`]
|
|
88
96
|
- `saveConfig(...)`: persist split local/global config JSON [`src/core/config.ts`]
|
|
89
97
|
- `saveLocalConfig(...)`: write the local config file [`src/core/config.ts`]
|
|
90
98
|
- `getProjectConfigPath(...)`: resolve local config file path [`src/core/config.ts`]
|
|
@@ -208,8 +216,9 @@
|
|
|
208
216
|
- `StaticCheckBase.headerLine(...)`: format checker header [`src/core/static-check.ts`]
|
|
209
217
|
- `StaticCheckBase.emitLine(...)`: write checker output [`src/core/static-check.ts`]
|
|
210
218
|
- `StaticCheckCommand.run(...)`: iterate resolved files for external command path [`src/core/static-check.ts`]
|
|
211
|
-
- `
|
|
212
|
-
- `
|
|
219
|
+
- `resolveCheckerExecutable(...)`: resolve executable via bundled `node_modules/.bin` or `PATH` scan [`src/core/static-check.ts`]
|
|
220
|
+
- `findExecutable(...)`: resolve executable on `PATH` or explicit path [`src/core/static-check.ts`]
|
|
221
|
+
- `isExecutableFile(...)`: verify executable access bits [`src/core/static-check.ts`]
|
|
213
222
|
- `StaticCheckCommand.checkFile(...)`: run external executable against one file [`src/core/static-check.ts`]
|
|
214
223
|
- `StaticCheckBase.headerLine(...)`: format checker header [`src/core/static-check.ts`]
|
|
215
224
|
- `StaticCheckBase.emitLine(...)`: write checker output [`src/core/static-check.ts`]
|
|
@@ -227,8 +236,9 @@
|
|
|
227
236
|
- `StaticCheckBase.headerLine(...)`: format checker header [`src/core/static-check.ts`]
|
|
228
237
|
- `StaticCheckBase.emitLine(...)`: write checker output [`src/core/static-check.ts`]
|
|
229
238
|
- `StaticCheckCommand.run(...)`: execute external command checker [`src/core/static-check.ts`]
|
|
230
|
-
- `
|
|
231
|
-
- `
|
|
239
|
+
- `resolveCheckerExecutable(...)`: resolve executable via bundled `node_modules/.bin` or `PATH` scan [`src/core/static-check.ts`]
|
|
240
|
+
- `findExecutable(...)`: resolve executable on `PATH` or explicit path [`src/core/static-check.ts`]
|
|
241
|
+
- `isExecutableFile(...)`: verify executable access bits [`src/core/static-check.ts`]
|
|
232
242
|
- `StaticCheckCommand.checkFile(...)`: run external executable against one file [`src/core/static-check.ts`]
|
|
233
243
|
- `StaticCheckBase.headerLine(...)`: format checker header [`src/core/static-check.ts`]
|
|
234
244
|
- `StaticCheckBase.emitLine(...)`: write checker output [`src/core/static-check.ts`]
|
|
@@ -366,8 +376,9 @@
|
|
|
366
376
|
- `StaticCheckBase.headerLine(...)`: format checker header [`src/core/static-check.ts`]
|
|
367
377
|
- `StaticCheckBase.emitLine(...)`: write checker output [`src/core/static-check.ts`]
|
|
368
378
|
- `StaticCheckCommand.run(...)`: execute external command checker [`src/core/static-check.ts`]
|
|
369
|
-
- `
|
|
370
|
-
- `
|
|
379
|
+
- `resolveCheckerExecutable(...)`: resolve executable via bundled `node_modules/.bin` or `PATH` scan [`src/core/static-check.ts`]
|
|
380
|
+
- `findExecutable(...)`: resolve executable on `PATH` or explicit path [`src/core/static-check.ts`]
|
|
381
|
+
- `isExecutableFile(...)`: verify executable access bits [`src/core/static-check.ts`]
|
|
371
382
|
- `StaticCheckCommand.checkFile(...)`: run external executable against one file [`src/core/static-check.ts`]
|
|
372
383
|
- `StaticCheckBase.headerLine(...)`: format checker header [`src/core/static-check.ts`]
|
|
373
384
|
- `StaticCheckBase.emitLine(...)`: write checker output [`src/core/static-check.ts`]
|
|
@@ -494,6 +505,7 @@
|
|
|
494
505
|
- `RecordingExtensionAPI.setActiveTools(...)`: replace active-tool set with runtime-visible names [`scripts/lib/recording-extension-api.ts`]
|
|
495
506
|
- `RecordingExtensionAPI.getAllTools(...)`: expose supported builtin plus extension tool inventory [`scripts/lib/recording-extension-api.ts`]
|
|
496
507
|
- `setPiUsereqStatusConfig(...)`: cache docs/tests/src and pi-notify values for later status renders [`src/core/extension-status.ts`]
|
|
508
|
+
- `checkDefaultCheckersAvailability(...)`: enumerate missing enabled static-check executables and emit one warning notification without aborting [`src/core/static-check.ts`]
|
|
497
509
|
- `updateExtensionStatus(...)`: refresh stored context usage, reset or restore elapsed timers, load the active runtime sound level from persisted config during `session_start`, reset workflow state for startup/new/reload, and render status text [`src/core/extension-status.ts`]
|
|
498
510
|
- `refreshContextUsage(...)`: sync the latest context-usage snapshot [`src/core/extension-status.ts`]
|
|
499
511
|
- `RecordingCommandContext.getContextUsage(...)`: return the offline context-usage placeholder [`scripts/lib/recording-extension-api.ts`]
|
|
@@ -575,8 +587,8 @@
|
|
|
575
587
|
- `buildIgnoredGitStatusPaths(...)`: ignore extension-owned debug-log artifacts during cleanliness verification [`src/core/req-references-command.ts`]
|
|
576
588
|
- `renderPrompt(...)`: render prompt-command payloads with bundled commit-instruction expansion, conditional pi.dev governance guidance, and `%%CONTEXT_FILES%%` context-file injection [`src/core/prompts.ts`]
|
|
577
589
|
- `buildContextFilesBlock(...)`: build the markdown block injected at `%%CONTEXT_FILES%%` from enabled context files in documented order with pre-substituted `%%DOC_PATH%%` file references and four-backtick fences [`src/core/prompts.ts`]
|
|
578
|
-
- `renderPromptCommandSummary(...)`: render the on-screen command invocation summary with command name, user request arguments, and active configuration fields [`src/core/prompts.ts`]
|
|
579
|
-
- `deliverPromptCommand(...)`: dispatch the rendered prompt as a hidden `display:false` custom message plus a `display:true` summary into the current recorded session, falling back to `sendUserMessage(...)` when `sendMessage(...)` is unavailable [`src/index.ts`]
|
|
590
|
+
- `renderPromptCommandSummary(...)`: render the on-screen command invocation summary with command name, user request arguments, and active configuration fields, rendering `none` for empty context-file, static-check-language, and enabled-tool lists [`src/core/prompts.ts`]
|
|
591
|
+
- `deliverPromptCommand(...)`: dispatch the rendered prompt as a hidden `display:false` custom message plus a `display:true` summary into the current recorded session, awaiting and suppressing summary delivery failures before the hidden prompt turn, falling back to `sendUserMessage(...)` when `sendMessage(...)` is unavailable [`src/index.ts`]
|
|
580
592
|
- External boundaries: `RecordingExtensionAPI.sendMessage(...)` or fallback `RecordingExtensionAPI.sendUserMessage(...)` records the delivered prompt payload plus summary.
|
|
581
593
|
- `configurePiUsereq(...)`: execute the interactive configuration menu [`src/index.ts`]
|
|
582
594
|
- `buildPiUsereqMenuChoices(...)`: serialize top-level settings actions including the `Context Files` injection toggle row, effective worktree locking, plus display-only local and global config-path rows [`src/index.ts`]
|
|
@@ -880,8 +892,8 @@
|
|
|
880
892
|
- `writePersistedPromptCommandSessionContext(...)`: store the reusable command-capable replacement-session context for later closure handling [`src/core/prompt-command-state.ts`]
|
|
881
893
|
- `clearPersistedPromptCommandSessionContext(...)`: drop reusable command-context persistence when worktree routing is inactive [`src/core/prompt-command-state.ts`]
|
|
882
894
|
- `logPromptWorkflowEvent(...)`: append selected workflow-activation debug entries [`src/index.ts`]
|
|
883
|
-
- `renderPromptCommandSummary(...)`: render the on-screen command invocation summary with command name without the `req-` prefix in uppercase, user request arguments, and active configuration fields [`src/core/prompts.ts`]
|
|
884
|
-
- `deliverPromptCommand(...)`: start dispatch of the rendered prompt as a hidden `display:false` custom message with `triggerTurn:true` plus a `display:true` command invocation summary into the current active session after execution-session activation is verified, preferring replacement-session `sendMessage(...)` when available, falling back to `sendUserMessage(...)` when `sendMessage(...)` is unavailable, returning the delivery promise so the final `running` transition is recorded immediately after handoff begins instead of after the full prompt run completes, and suppressing the documented stale post-restore rejection once the prompt was already accepted [`src/index.ts`]
|
|
895
|
+
- `renderPromptCommandSummary(...)`: render the on-screen command invocation summary with command name without the `req-` prefix in uppercase, user request arguments, and active configuration fields, rendering `none` for empty context-file, static-check-language, and enabled-tool lists [`src/core/prompts.ts`]
|
|
896
|
+
- `deliverPromptCommand(...)`: start dispatch of the rendered prompt as a hidden `display:false` custom message with `triggerTurn:true` plus a `display:true` command invocation summary into the current active session after execution-session activation is verified, preferring replacement-session `sendMessage(...)` when available, falling back to `sendUserMessage(...)` when `sendMessage(...)` is unavailable, awaiting and suppressing the non-critical summary delivery before the authoritative hidden prompt turn so a rejecting summary never surfaces as an unhandled rejection that could terminate the process before prompt-end closure runs the worktree merge, returning the delivery promise so the final `running` transition is recorded immediately after handoff begins instead of after the full prompt run completes, and suppressing the documented stale post-restore rejection once the prompt was already accepted [`src/index.ts`]
|
|
885
897
|
- `writePersistedPromptCommandRuntimeState(...)`: mirror the prepared prompt execution plan into process-scoped persistence before the worktree session switch returns control [`src/core/prompt-command-state.ts`]
|
|
886
898
|
- `isStaleExtensionContextError(...)`: classify stale post-restore delivery rejections from replacement-session `sendMessage(...)` [`src/core/extension-status.ts`]
|
|
887
899
|
- External boundaries: replacement-session `sendMessage(...)` or `pi.sendMessage(...)` delivers the hidden rendered prompt payload plus the displayed summary into the active `AgentSession`; fallback replacement-session `sendUserMessage(...)` or `pi.sendUserMessage(...)` delivers the rendered prompt payload when `sendMessage(...)` is unavailable.
|
|
@@ -992,6 +1004,7 @@
|
|
|
992
1004
|
- `normalizeEnabledPiUsereqTools(...)`: canonicalize configurable active tools [`src/core/pi-usereq-tools.ts`]
|
|
993
1005
|
- `getPiUsereqStartupTools(...)`: enumerate configurable tools from runtime inventory in documented menu order [`src/index.ts`]
|
|
994
1006
|
- `setPiUsereqStatusConfig(...)`: cache docs/tests/src and pi-notify values for later status renders [`src/core/extension-status.ts`]
|
|
1007
|
+
- `checkDefaultCheckersAvailability(...)`: enumerate missing enabled static-check executables and emit one warning notification without aborting [`src/core/static-check.ts`]
|
|
995
1008
|
- `activatePromptCommandExecution(...)`: re-verify the prepared execution session through replacement-session-aware `ctx.switchSession(sessionPath, { withSession })` handling, reuse persisted replacement-session contexts when lifecycle hooks omit `switchSession()`, re-align `process.cwd()` to the execution path, confirm `process.cwd()` plus the persisted execution-session file header cwd when the file is already persisted before agent start, and refresh reusable command-context persistence [`src/core/prompt-command-runtime.ts`]
|
|
996
1009
|
- `resolveDebugProjectBase(...)`: prefer static `base-path` for debug-log writes during worktree-backed prompt runs and recover a live bootstrap cwd when no prompt plan is active [`src/index.ts`]
|
|
997
1010
|
- `notifyContextSafely(...)`: suppress stale replacement-context notification failures after session replacement while preserving closure progress [`src/index.ts`]
|
|
@@ -1280,6 +1293,27 @@
|
|
|
1280
1293
|
- External Boundaries:
|
|
1281
1294
|
- 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.
|
|
1282
1295
|
|
|
1296
|
+
### `PROC:install-static-checkers`
|
|
1297
|
+
- Entrypoints:
|
|
1298
|
+
- `main(...)`: best-effort bundled-checker installer root [`scripts/install-static-checkers.ts`]
|
|
1299
|
+
- Lifecycle/trigger:
|
|
1300
|
+
- Start trigger: npm invokes the `postinstall` script declared in `package.json` after dependency installation.
|
|
1301
|
+
- Stop trigger: returns numeric exit code `0` unconditionally after probing, optional best-effort installs, and native-checker guidance output.
|
|
1302
|
+
- Looping model: single-pass probe plus optional install with no persistent loop.
|
|
1303
|
+
- Threads: no explicit threads detected.
|
|
1304
|
+
- 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
|
+
- `resolveCheckerExecutable(...)`: resolve one checker across bundled `node_modules/.bin` locations and PATH scan [`src/core/static-check.ts`]
|
|
1307
|
+
- `findExecutable(...)`: resolve executable on PATH or explicit path [`src/core/static-check.ts`]
|
|
1308
|
+
- `isExecutableFile(...)`: verify executable access bits [`src/core/static-check.ts`]
|
|
1309
|
+
- `attemptBundledInstall(...)`: best-effort `npm install <pkg>@<range> --no-save --prefix <install-root>` swallowing all errors [`scripts/install-static-checkers.ts`]
|
|
1310
|
+
- `getInstallationPath(...)`: resolve the installed extension root that owns `scripts/` and `src/` [`src/core/path-context.ts`]
|
|
1311
|
+
- `printNativeCheckerGuidance(...)`: emit platform-specific install guidance for native checkers [`scripts/install-static-checkers.ts`]
|
|
1312
|
+
- External Boundaries:
|
|
1313
|
+
- Node process APIs for argv, stdout, stderr, and exit code.
|
|
1314
|
+
- Filesystem access for executable probing under the installation path.
|
|
1315
|
+
- npm CLI subprocess spawned best-effort for missing bundled checkers.
|
|
1316
|
+
|
|
1283
1317
|
## Communication Edges
|
|
1284
1318
|
- `PROC:req-debug` -> `PROC:tool-args-to-params`
|
|
1285
1319
|
- Mechanism: child-process spawn through resolved `tsx` executable.
|
|
@@ -1294,4 +1328,4 @@
|
|
|
1294
1328
|
- Endpoint/channel: `is_master` job output and shared tag-run context.
|
|
1295
1329
|
- Payload/data-shape: boolean branch-gate flag derived from `origin/master` containment for the tagged commit [`.github/workflows/release-npm.yml`]
|
|
1296
1330
|
- Internal thread communication edges: none.
|
|
1297
|
-
- Relationship note: `PROC:main`, `PROC:req-debug`, `PROC:tool-args-to-params`, `PROC:debug-ext`, `PROC:pi-host`, `PROC:gh-release-check`, and `PROC:gh-release-build` are distinct runtime entry modes; only `PROC:req-debug` directly
|
|
1331
|
+
- Relationship note: `PROC:main`, `PROC:req-debug`, `PROC:tool-args-to-params`, `PROC:debug-ext`, `PROC:pi-host`, `PROC:install-static-checkers`, `PROC:gh-release-check`, and `PROC:gh-release-build` are distinct runtime entry modes; only `PROC:req-debug` and `PROC:install-static-checkers` directly spawn child processes, while the GitHub Actions units coordinate through workflow job dependencies.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
* @brief Implements the best-effort postinstall installer for bundled static checkers.
|
|
5
|
+
* @details Probes bundled npm-backed static-check executables (`pyright`, `ruff`, `eslint`), attempts a best-effort `npm install --no-save --prefix` on miss, and prints platform-specific guidance for native checkers (`cppcheck`, `clang-format`). Runtime is dominated by child-process probing and optional npm execution. Side effects include stdout/stderr writes, filesystem reads, and best-effort `npm install` subprocess spawning. The script always exits with code `0` and never modifies git-tracked files.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import process from "node:process";
|
|
9
|
+
import { spawnSync } from "node:child_process";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { resolveCheckerExecutable } from "../src/core/static-check.js";
|
|
12
|
+
import { getInstallationPath } from "../src/core/path-context.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @brief Lists the npm-bundled static-check package names that the extension ships as dependencies.
|
|
16
|
+
* @details Each entry maps to one executable name resolvable through bundled `node_modules/.bin` after `npm install` completes. Access complexity is O(1).
|
|
17
|
+
*/
|
|
18
|
+
export const BUNDLED_NPM_CHECKERS = ["pyright", "ruff", "eslint"] as const;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @brief Lists the native system-package-manager static-check executables that the extension cannot bundle.
|
|
22
|
+
* @details Each entry maps to one executable name that users must install through their operating system package manager. Access complexity is O(1).
|
|
23
|
+
*/
|
|
24
|
+
export const NATIVE_CHECKERS = ["cppcheck", "clang-format"] as const;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @brief Maps one bundled npm checker name to its pinned caret install range.
|
|
28
|
+
* @details Returns the caret range matching the package manifest so best-effort installs stay aligned with declared dependencies. Runtime is O(1). No side effects occur.
|
|
29
|
+
* @param[in] pkg {string} Bundled npm package name.
|
|
30
|
+
* @return {string} Pinned caret install range.
|
|
31
|
+
*/
|
|
32
|
+
function bundledCheckerRange(pkg: string): string {
|
|
33
|
+
switch (pkg) {
|
|
34
|
+
case "pyright":
|
|
35
|
+
return "^1.1.411";
|
|
36
|
+
case "ruff":
|
|
37
|
+
return "^1.5.4";
|
|
38
|
+
case "eslint":
|
|
39
|
+
return "^10.2.0";
|
|
40
|
+
default:
|
|
41
|
+
return "latest";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @brief Prints platform-specific install guidance for native checkers.
|
|
47
|
+
* @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.
|
|
48
|
+
* @return {void} No return value.
|
|
49
|
+
*/
|
|
50
|
+
function printNativeCheckerGuidance(): void {
|
|
51
|
+
const platform = process.platform;
|
|
52
|
+
let manager: string;
|
|
53
|
+
let installPrefix: string;
|
|
54
|
+
if (platform === "linux") {
|
|
55
|
+
manager = "apt";
|
|
56
|
+
installPrefix = "sudo apt install";
|
|
57
|
+
} else if (platform === "darwin") {
|
|
58
|
+
manager = "brew";
|
|
59
|
+
installPrefix = "brew install";
|
|
60
|
+
} else if (platform === "win32") {
|
|
61
|
+
manager = "choco/scoop";
|
|
62
|
+
installPrefix = "choco install";
|
|
63
|
+
} else {
|
|
64
|
+
manager = "system package manager";
|
|
65
|
+
installPrefix = "install";
|
|
66
|
+
}
|
|
67
|
+
for (const checker of NATIVE_CHECKERS) {
|
|
68
|
+
process.stderr.write(
|
|
69
|
+
`Native checker '${checker}' not found. Install via ${manager}: ${installPrefix} ${checker}\n`,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @brief Attempts a best-effort `npm install` for one missing bundled checker.
|
|
76
|
+
* @details Runs `npm install <pkg>@<range> --no-save --prefix <installation-root>` inside the installation parent directory, swallowing all errors so the postinstall flow never fails. Runtime is dominated by npm execution. Side effects include subprocess spawning and optional writes under the installation root.
|
|
77
|
+
* @param[in] pkg {string} Bundled npm package name.
|
|
78
|
+
* @return {void} No return value.
|
|
79
|
+
*/
|
|
80
|
+
function attemptBundledInstall(pkg: string): void {
|
|
81
|
+
const range = bundledCheckerRange(pkg);
|
|
82
|
+
const installRoot = path.resolve(getInstallationPath(), "..");
|
|
83
|
+
try {
|
|
84
|
+
const result = spawnSync(
|
|
85
|
+
"npm",
|
|
86
|
+
["install", `${pkg}@${range}`, "--no-save", "--prefix", installRoot],
|
|
87
|
+
{ encoding: "utf8" },
|
|
88
|
+
);
|
|
89
|
+
if (result.error) {
|
|
90
|
+
process.stderr.write(`Warning: failed to install bundled checker '${pkg}': ${result.error.message}\n`);
|
|
91
|
+
}
|
|
92
|
+
} catch (error) {
|
|
93
|
+
process.stderr.write(
|
|
94
|
+
`Warning: failed to install bundled checker '${pkg}': ${error instanceof Error ? error.message : String(error)}\n`,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @brief Executes the postinstall static-checker installation flow.
|
|
101
|
+
* @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
|
+
* @param[in] argv {string[]} Raw CLI arguments (unused, retained for CLI convention parity).
|
|
103
|
+
* @return {number} Always returns `0`.
|
|
104
|
+
* @satisfies REQ-339, DES-017
|
|
105
|
+
*/
|
|
106
|
+
export function main(argv = process.argv.slice(2)): number {
|
|
107
|
+
void argv;
|
|
108
|
+
for (const checker of BUNDLED_NPM_CHECKERS) {
|
|
109
|
+
if (resolveCheckerExecutable(checker)) {
|
|
110
|
+
process.stdout.write(`Bundled static checker '${checker}' is available.\n`);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
process.stderr.write(`Bundled static checker '${checker}' not found; attempting best-effort install.\n`);
|
|
114
|
+
attemptBundledInstall(checker);
|
|
115
|
+
}
|
|
116
|
+
const missingNative = NATIVE_CHECKERS.filter((checker) => !resolveCheckerExecutable(checker));
|
|
117
|
+
if (missingNative.length > 0) {
|
|
118
|
+
printNativeCheckerGuidance();
|
|
119
|
+
}
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
124
|
+
process.exitCode = main();
|
|
125
|
+
}
|
package/src/core/config.ts
CHANGED
|
@@ -214,14 +214,14 @@ export const DEFAULT_TESTS_DIR = "tests";
|
|
|
214
214
|
export const DEFAULT_SRC_DIRS = ["src"];
|
|
215
215
|
/**
|
|
216
216
|
* @brief Defines the default value for every persisted context-file injection flag.
|
|
217
|
-
* @details Each `%%CONTEXT_FILES%%` injection toggle defaults to
|
|
217
|
+
* @details Each `%%CONTEXT_FILES%%` injection toggle defaults to disabled so the bundled canonical documents are excluded from the prompt context unless the user explicitly enables one. Lookup complexity is O(1).
|
|
218
218
|
* @satisfies REQ-328
|
|
219
219
|
*/
|
|
220
|
-
export const DEFAULT_CONTEXT_FILES_FLAG =
|
|
220
|
+
export const DEFAULT_CONTEXT_FILES_FLAG = false;
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
223
|
* @brief Normalizes one persisted context-file injection flag.
|
|
224
|
-
* @details Returns the documented default (`
|
|
224
|
+
* @details Returns the documented default (`false`) for missing or non-boolean values and preserves only explicit boolean input, so any malformed persisted entry keeps context-file injection disabled. Runtime is O(1). No external state is mutated.
|
|
225
225
|
* @param[in] value {unknown} Candidate persisted context-file flag.
|
|
226
226
|
* @return {boolean} Normalized context-file injection flag.
|
|
227
227
|
* @satisfies REQ-328
|
|
@@ -316,8 +316,8 @@ const DEFAULT_STATIC_CHECK_CHECKERS: Record<string, StaticCheckEntry[]> = {
|
|
|
316
316
|
TypeScript: [
|
|
317
317
|
{
|
|
318
318
|
module: "Command",
|
|
319
|
-
cmd: "
|
|
320
|
-
params: [
|
|
319
|
+
cmd: "eslint",
|
|
320
|
+
params: [],
|
|
321
321
|
},
|
|
322
322
|
],
|
|
323
323
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import fs from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
|
-
import { spawnSync } from "node:child_process";
|
|
9
|
+
import { spawnSync, type SpawnSyncReturns } from "node:child_process";
|
|
10
10
|
import { ReqError } from "./errors.js";
|
|
11
11
|
import { classifyPiNotifyOutcome, type PiNotifyOutcome } from "./pi-notify.js";
|
|
12
12
|
import {
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
type DebugWorkflowState,
|
|
21
21
|
} from "./debug-runtime.js";
|
|
22
22
|
import { type PromptCommandName } from "./prompt-command-catalog.js";
|
|
23
|
+
export { type PromptCommandName } from "./prompt-command-catalog.js";
|
|
23
24
|
import {
|
|
24
25
|
isSameOrAncestorPath,
|
|
25
26
|
normalizeRelativeDirContract,
|
|
@@ -119,14 +120,13 @@ interface PromptCommandActiveContext extends PromptCommandSessionContext {
|
|
|
119
120
|
|
|
120
121
|
/**
|
|
121
122
|
* @brief Describes one serializable session entry copied into a materialized execution-session file.
|
|
122
|
-
* @details Captures the stable tree-entry fields needed to write a JSONL session snapshot for cross-cwd session replacement when the origin session file has not been flushed yet. The interface is compile-time only and introduces no runtime cost.
|
|
123
|
+
* @details Captures the stable tree-entry fields needed to write a JSONL session snapshot for cross-cwd session replacement when the origin session file has not been flushed yet. Mirrors the SDK `SessionEntryBase` shape without an index signature so the SDK `SessionEntry` union remains structurally assignable for passthrough serialization. The interface is compile-time only and introduces no runtime cost.
|
|
123
124
|
*/
|
|
124
125
|
interface PromptCommandSessionEntry {
|
|
125
126
|
type: string;
|
|
126
127
|
id: string;
|
|
127
128
|
parentId: string | null;
|
|
128
129
|
timestamp: string;
|
|
129
|
-
[key: string]: unknown;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
@@ -705,7 +705,7 @@ async function switchPromptCommandSession(
|
|
|
705
705
|
throw new ReqError(`ERROR: Prompt orchestration requires ctx.switchSession() for ${sessionFile}.`, 1);
|
|
706
706
|
}
|
|
707
707
|
let replacementContext: PromptCommandActiveContext | undefined;
|
|
708
|
-
let switchResult: { cancelled?: boolean } | void;
|
|
708
|
+
let switchResult: { cancelled?: boolean } | void = undefined;
|
|
709
709
|
try {
|
|
710
710
|
switchResult = await ctx.switchSession(sessionFile, {
|
|
711
711
|
withSession: async (activeContext) => {
|
|
@@ -840,9 +840,9 @@ const PROMPT_REQUIRED_DOCS: Record<PromptCommandName, readonly PromptRequiredDoc
|
|
|
840
840
|
* @details Delegates to `spawnSync`, preserves the supplied working directory, and returns the raw subprocess result used by prompt-command orchestration. Runtime is dominated by external process execution. Side effects include process spawning.
|
|
841
841
|
* @param[in] command {string[]} Executable plus argument vector.
|
|
842
842
|
* @param[in] cwd {string} Working directory for the subprocess.
|
|
843
|
-
* @return {
|
|
843
|
+
* @return {SpawnSyncReturns<string>} Captured subprocess result with UTF-8 decoded stdout and stderr.
|
|
844
844
|
*/
|
|
845
|
-
function runCapture(command: string[], cwd: string):
|
|
845
|
+
function runCapture(command: string[], cwd: string): SpawnSyncReturns<string> {
|
|
846
846
|
return spawnSync(command[0]!, command.slice(1), {
|
|
847
847
|
cwd,
|
|
848
848
|
encoding: "utf8",
|
package/src/core/prompts.ts
CHANGED
|
@@ -375,12 +375,12 @@ export const PROMPT_COMMAND_SUMMARY_CUSTOM_TYPE = "pi-usereq-prompt-command";
|
|
|
375
375
|
|
|
376
376
|
/**
|
|
377
377
|
* @brief Builds the on-screen command invocation summary for one bundled prompt-backed `req-<prompt>` command.
|
|
378
|
-
* @details Renders the command name without the `req-` prefix in uppercase, the user request arguments, and the active configuration fields (`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`) so the TUI shows only a compact summary while the full rendered prompt is delivered hidden to the LLM agent. Static-check languages are emitted in canonical `DEFAULT_STATIC_CHECK_LANGUAGES` order; enabled tools are emitted in documented menu order via `comparePiUsereqStartupToolNames`. Runtime is O(l + t log t) where l is language count and t is enabled-tool count. No external state is mutated.
|
|
378
|
+
* @details Renders the command name without the `req-` prefix in uppercase, the user request arguments, and the active configuration fields (`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`) so the TUI shows only a compact summary while the full rendered prompt is delivered hidden to the LLM agent. Static-check languages are emitted in canonical `DEFAULT_STATIC_CHECK_LANGUAGES` order; enabled tools are emitted in documented menu order via `comparePiUsereqStartupToolNames`. The `context files`, `static code checks`, and `enabled tools` fields render the literal `none` placeholder whenever their respective enabled-item list is empty so the summary never shows a blank value. Runtime is O(l + t log t) where l is language count and t is enabled-tool count. No external state is mutated.
|
|
379
379
|
* @param[in] promptName {string} Bundled prompt name without the `req-` prefix.
|
|
380
380
|
* @param[in] args {string} User request arguments passed to the slash command.
|
|
381
381
|
* @param[in] config {UseReqConfig} Effective project configuration supplying directory, git, static-check, and tool fields.
|
|
382
382
|
* @return {string} Multi-line command invocation summary text.
|
|
383
|
-
* @satisfies REQ-335, REQ-336, REQ-337
|
|
383
|
+
* @satisfies REQ-335, REQ-336, REQ-337, REQ-338
|
|
384
384
|
*/
|
|
385
385
|
export function renderPromptCommandSummary(
|
|
386
386
|
promptName: string,
|
|
@@ -390,17 +390,17 @@ export function renderPromptCommandSummary(
|
|
|
390
390
|
const contextFiles = CONTEXT_FILE_DESCRIPTORS
|
|
391
391
|
.filter((descriptor) => config[descriptor.flagKey])
|
|
392
392
|
.map((descriptor) => descriptor.fileName.replace(/\.md$/, "").toLowerCase())
|
|
393
|
-
.join(", ");
|
|
393
|
+
.join(", ") || "none";
|
|
394
394
|
const enabledLanguages = DEFAULT_STATIC_CHECK_LANGUAGES
|
|
395
395
|
.filter((language) => config["static-check"][language]?.enabled === "enable")
|
|
396
|
-
.join(", ");
|
|
397
|
-
const enabledTools = [...config["enabled-tools"]]
|
|
396
|
+
.join(", ") || "none";
|
|
397
|
+
const enabledTools = ([...config["enabled-tools"]]
|
|
398
398
|
.sort((left, right) =>
|
|
399
399
|
comparePiUsereqStartupToolNames(
|
|
400
400
|
left as PiUsereqStartupToolName,
|
|
401
401
|
right as PiUsereqStartupToolName,
|
|
402
402
|
))
|
|
403
|
-
.join(", ");
|
|
403
|
+
.join(", ") || "none");
|
|
404
404
|
const effectiveWorktree = resolveEffectiveGitWorktreeEnabled(
|
|
405
405
|
config.AUTO_GIT_COMMIT,
|
|
406
406
|
config.GIT_WORKTREE_ENABLED,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @details Performs slash-command-owned git validation reuse, reference-file generation, targeted staging, fixed-message commit creation, and post-commit cleanliness verification without creating a worktree or starting an LLM session. Runtime is dominated by git subprocess execution plus source-summary generation and one documentation write. Side effects include filesystem writes and git index/history mutation.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { spawnSync } from "node:child_process";
|
|
7
|
+
import { spawnSync, type SpawnSyncReturns } from "node:child_process";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import type { UseReqConfig } from "./config.js";
|
|
10
10
|
import { ReqError } from "./errors.js";
|
|
@@ -39,9 +39,9 @@ export interface ReqReferencesCommandPlan {
|
|
|
39
39
|
* @details Delegates to `spawnSync(...)`, preserves the supplied working directory, and returns the raw result so callers can interpret git exit status plus diagnostics deterministically. Runtime is dominated by external process execution. Side effects include subprocess creation.
|
|
40
40
|
* @param[in] command {string[]} Executable plus argument vector.
|
|
41
41
|
* @param[in] cwd {string} Working directory for the subprocess.
|
|
42
|
-
* @return {
|
|
42
|
+
* @return {SpawnSyncReturns<string>} Captured subprocess result with UTF-8 stdout and stderr.
|
|
43
43
|
*/
|
|
44
|
-
function runCapture(command: string[], cwd: string):
|
|
44
|
+
function runCapture(command: string[], cwd: string): SpawnSyncReturns<string> {
|
|
45
45
|
return spawnSync(command[0]!, command.slice(1), {
|
|
46
46
|
cwd,
|
|
47
47
|
encoding: "utf8",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import fs from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
|
-
import { spawnSync } from "node:child_process";
|
|
9
|
+
import { spawnSync, type SpawnSyncReturns } from "node:child_process";
|
|
10
10
|
import {
|
|
11
11
|
normalizeGitWorktreePrefix,
|
|
12
12
|
type UseReqConfig,
|
|
@@ -63,9 +63,9 @@ type ReqResetCommandContext = Parameters<typeof restorePromptCommandExecution>[1
|
|
|
63
63
|
* @details Delegates to `spawnSync(...)`, preserves the supplied working directory, and returns the raw result so callers can interpret git exit status plus diagnostics deterministically. Runtime is dominated by external process execution. Side effects include subprocess creation.
|
|
64
64
|
* @param[in] command {string[]} Executable plus argument vector.
|
|
65
65
|
* @param[in] cwd {string} Working directory for the subprocess.
|
|
66
|
-
* @return {
|
|
66
|
+
* @return {SpawnSyncReturns<string>} Captured subprocess result with UTF-8 stdout and stderr.
|
|
67
67
|
*/
|
|
68
|
-
function runCapture(command: string[], cwd: string):
|
|
68
|
+
function runCapture(command: string[], cwd: string): SpawnSyncReturns<string> {
|
|
69
69
|
return spawnSync(command[0]!, command.slice(1), {
|
|
70
70
|
cwd,
|
|
71
71
|
encoding: "utf8",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
import { spawnSync } from "node:child_process";
|
|
8
|
+
import { spawnSync, type SpawnSyncReturns } from "node:child_process";
|
|
9
9
|
import { ReqError } from "./errors.js";
|
|
10
10
|
import { isSameOrAncestorPath } from "./path-context.js";
|
|
11
11
|
|
|
@@ -14,9 +14,9 @@ import { isSameOrAncestorPath } from "./path-context.js";
|
|
|
14
14
|
* @details Delegates to `spawnSync`, keeps execution synchronous for deterministic command flows, and supports an optional working directory. Runtime is dominated by the spawned git process. Side effects include subprocess creation.
|
|
15
15
|
* @param[in] command {string[]} Git executable plus argument vector.
|
|
16
16
|
* @param[in] cwd {string | undefined} Optional working directory.
|
|
17
|
-
* @return {
|
|
17
|
+
* @return {SpawnSyncReturns<string>} Captured subprocess result with UTF-8 stdout and stderr.
|
|
18
18
|
*/
|
|
19
|
-
function runGitCapture(command: string[], cwd?: string):
|
|
19
|
+
function runGitCapture(command: string[], cwd?: string): SpawnSyncReturns<string> {
|
|
20
20
|
return spawnSync(command[0]!, command.slice(1), {
|
|
21
21
|
cwd,
|
|
22
22
|
encoding: "utf8",
|