pi-usereq 0.65.0 → 0.67.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # PI-useReq/pi-usereq (0.65.0)
1
+ # PI-useReq/pi-usereq (0.67.0)
2
2
 
3
3
  <p align="center">
4
4
  <img src="https://img.shields.io/badge/python-3.11%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.11+">
@@ -13,7 +13,7 @@
13
13
  It turns a User Request into a living <em>Software Requirements Specification</em> (SRS), implements the corresponding
14
14
  source code, and keeps the project documentation (<code>WORKFLOW.md</code>, <code>REFERENCES.md</code>, <code>FLOWCHART.md</code>, <code>README.md</code>)
15
15
  in sync with the repository. All capabilities are exposed as slash commands and agent tools inside
16
- <a href="https://pi.dev"><strong>pi</strong></a> (<code>pi-coding-agent</code> 0.80.4+).
16
+ <a href="https://pi.dev"><strong>pi</strong></a> (<code>pi-coding-agent</code> 1.0.0+).
17
17
  </p>
18
18
 
19
19
  <p align="center">
@@ -47,7 +47,7 @@ in sync with the repository. All capabilities are exposed as slash commands and
47
47
 
48
48
  ## Requirements
49
49
 
50
- - **pi CLI** (`pi.dev`) - the extension runs inside pi; requires `@earendil-works/pi-coding-agent` 0.80.4 or newer (Node.js 22.19+, per the pi CLI requirement).
50
+ - **pi CLI** (`pi.dev`) - the extension runs inside pi; requires `@earendil-works/pi-coding-agent` 1.0.0 or newer (Node.js 22.19+, per the pi CLI requirement).
51
51
  - **Git repository** - every `req-*` command runs slash-command-owned git validation: the project must be inside a git work tree, the tracked working tree must be clean, and `HEAD` must resolve (a detached `HEAD` is tolerated; a working branch is recommended because the branch name is embedded in generated worktree names).
52
52
  - **Requirements documentation** - the configured `docs-dir` (default `pi-usereq/docs`) must contain the canonical documents required by each command (`REQUIREMENTS.md`, `WORKFLOW.md`, `REFERENCES.md`); commands such as `/req-write`, `/req-create`, and `/req-workflow` are the entry points that generate them.
53
53
  - **Static code checkers** - the bundled checkers (`pyright`, `ruff`, `eslint`) install automatically through the `postinstall` script; the native C/C++ checkers (`cppcheck`, `clang-format`) require a one-line system install (see [Install](#install)). Default configured languages: C, C++, JavaScript, Python, TypeScript.
@@ -63,6 +63,7 @@ in sync with the repository. All capabilities are exposed as slash commands and
63
63
  - **Automatic commit guidance** - `AUTO_GIT_COMMIT=enable` (default) injects structured commit instructions (`<TYPE>(<COMPONENT>): <DESCRIPTION> [useReq]`) into every prompt; disabling it forces read-only git behavior and turns worktree orchestration off.
64
64
  - **Notifications** - desktop notify command, sound effects (levels `none`/`low`/`mid`/`high`, default `alt+s` toggle) and Pushover push messages on prompt completion, interruption, or failure.
65
65
  - **Runtime status bar** - the extension renders its workflow state, current branch, context usage, elapsed time, and sound level in the pi status line.
66
+ - **Context-occupancy guardrails** - the `Context Files` settings row and every command invocation summary show the measured `[<percent>% context]` occupancy of the enabled context files against the selected model's max input context (or the documented 1,000,000-token fallback); prompt dispatch is aborted before worktree creation when the enabled context files exceed that limit.
66
67
  - **Debug surface** - config-gated `debug-*` slash commands and a standalone debug harness (`scripts/debug-extension.ts`, `scripts/pi-usereq-debug.sh`) for offline inspection and replay.
67
68
 
68
69
 
@@ -83,7 +84,9 @@ creating a worktree.
83
84
  > reference, and workflow documents in the prompt context by enabling the `Context Files` toggles for `REQUIREMENTS.md`,
84
85
  > `REFERENCES.md`, and `WORKFLOW.md` (the settings-menu row then reads `Context Files requirements:on • references:on • workflow:on`).
85
86
  > The enabled canonical documents are injected into every bundled prompt through `%%CONTEXT_FILES%%`, so the agent analyzes
86
- > the requirements, the reference index, and the workflow documentation together with the source code.
87
+ > the requirements, the reference index, and the workflow documentation together with the source code. When at least one
88
+ > context file is enabled, the measured occupancy is reported as a `[<percent>% context]` suffix, and prompt dispatch aborts
89
+ > before worktree creation if the enabled context files exceed the selected model's max input context (or the 1,000,000-token fallback).
87
90
 
88
91
  | Command | Description | Required docs |
89
92
  | --- | --- | --- |
@@ -279,13 +282,13 @@ Project-scoped commands (`--summarize`, `--compress`, `--tokens`, `--find`, `--s
279
282
  The interactive configuration menu exposes every user-facing setting; changes are persisted automatically:
280
283
 
281
284
  - **Documentation directory** — `docs-dir` (default `pi-usereq/docs`) used for the canonical documents.
282
- - **Unit tests directory** — `tests-dir` (default `tests`).
283
285
  - **Source directories** — `src-dir` (default `["src"]`) used by the analysis tools.
284
- - **Context Files** — toggles to inject `REQUIREMENTS.md`, `WORKFLOW.md`, and `REFERENCES.md` into the prompt context through `%%CONTEXT_FILES%%`. It is recommended to keep all three toggles enabled (`requirements:on • references:on • workflow:on`) so the analysis commands receive the canonical documents in their context.
286
+ - **Unit tests directory** — `tests-dir` (default `tests`).
287
+ - **Context Files** — toggles to inject `REQUIREMENTS.md`, `WORKFLOW.md`, and `REFERENCES.md` into the prompt context through `%%CONTEXT_FILES%%`. Each toggle shows the measured file size (`<chars>c/<tokens>t`) plus its occupancy share, and the summary row appends the overall `[<percent>% context]` suffix. It is recommended to keep all three toggles enabled (`requirements:on • references:on • workflow:on`) so the analysis commands receive the canonical documents in their context.
285
288
  - **Auto git commit** — `enable` (default) injects git commit instructions into every prompt; `disable` forces read-only git behavior (`git_read-only.md`) and turns worktree orchestration off.
286
289
  - **Git worktree** / **Worktree prefix** — enable/disable prompt-command worktree isolation and set the name prefix (default `PI-useReq-`).
287
290
  - **Language static code checkers** — per-language `enable`/`disable` flags and the global `Command`-module checker definitions (view/remove/reset with confirmation).
288
- - **Enable tools** — the subset of configurable startup tools activated for the project (`files-*` and project tools plus the embedded `read`, `bash`, `edit`, `write` quartet).
291
+ - **Enable tools** — the subset of configurable startup tools activated for the project: the `files-*` and project tools plus the embedded pi tools (`read`, `bash`, `edit`, `write` enabled by default; `find`, `grep`, `ls` configurable and disabled by default).
289
292
  - **Notifications** — command-notify, sound, and Pushover settings with per-event routing (completed/interrupted/failed).
290
293
  - **Debug** — local debug logging: log file, log-on-status filter, status-change/workflow-event toggles, enabled tools/prompts, and `Enable debug commands for tools`.
291
294
  - **Show local/global configuration** — write the exact config file contents into the editor.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-usereq",
3
- "version": "0.65.0",
3
+ "version": "0.67.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Ogekuri/PI-useReq.git"
package/src/index.ts CHANGED
@@ -4578,27 +4578,26 @@ function formatContextFilesSummary(
4578
4578
 
4579
4579
  /**
4580
4580
  * @brief Builds the shared settings-menu choices for the `Context Files` submenu.
4581
- * @details Exposes one inline toggle row per context file in the documented `REQUIREMENTS.md`, `REFERENCES.md`, `WORKFLOW.md` order whose value renders `on|off • <chars>c/<tokens>t` measured size facts plus the context-occupancy suffix computed from the enabled existing token total against the selected model max input context, followed by a value-less subtree-local `Reset defaults` row. Cycle values embed the same measured facts and occupancy suffix so inline toggling keeps the size estimate visible while persisting the on|off state. Runtime is O(1) in row count. No external state is mutated.
4581
+ * @details Exposes one inline toggle row per context file in the documented `REQUIREMENTS.md`, `REFERENCES.md`, `WORKFLOW.md` order whose value renders `on|off • <chars>c/<tokens>t` measured size facts plus a per-file context-occupancy suffix computed from that row's measured token count against the selected model max input context (or the documented 1,000,000-token fallback), omitted for rows whose measured token count is zero, followed by a value-less subtree-local `Reset defaults` row. Cycle values embed the same measured facts and per-file occupancy suffix so inline toggling keeps the size estimate visible while persisting the on|off state. Runtime is O(1) in row count. No external state is mutated.
4582
4582
  * @param[in] config {UseReqConfig} Effective project configuration.
4583
4583
  * @param[in] sizes {Record<ContextFileName, ContextFileSizeFacts>} Measured context-file size facts keyed by canonical file name.
4584
4584
  * @param[in] maxContextTokens {number | undefined} Selected model max input context tokens; undefined selects the documented 1,000,000-token fallback.
4585
4585
  * @return {PiUsereqSettingsMenuChoice[]} Ordered `Context Files` submenu choices.
4586
- * @satisfies REQ-327, REQ-328, REQ-333, REQ-375, REQ-403, REQ-404, REQ-406
4586
+ * @satisfies REQ-327, REQ-328, REQ-333, REQ-375, REQ-403, REQ-404, REQ-406, REQ-412
4587
4587
  */
4588
4588
  function buildContextFilesMenuChoices(
4589
4589
  config: UseReqConfig,
4590
4590
  sizes: Record<ContextFileName, ContextFileSizeFacts>,
4591
4591
  maxContextTokens?: number | undefined,
4592
4592
  ): PiUsereqSettingsMenuChoice[] {
4593
- const totalTokens = sumEnabledContextFileTokens(config, sizes);
4594
- const occupancySuffix = totalTokens > 0
4595
- ? ` ${computeContextOccupancyFacts(totalTokens, maxContextTokens).suffix}`
4596
- : "";
4597
4593
  const buildRow = (
4598
4594
  id: "context-files-requirements" | "context-files-references" | "context-files-workflow",
4599
4595
  fileName: ContextFileName,
4600
4596
  description: string,
4601
4597
  ): PiUsereqSettingsMenuChoice => {
4598
+ const occupancySuffix = sizes[fileName].tokens > 0
4599
+ ? ` ${computeContextOccupancyFacts(sizes[fileName].tokens, maxContextTokens).suffix}`
4600
+ : "";
4602
4601
  const sizedOn = `on \u2022 ${formatContextFileSize(sizes[fileName])}${occupancySuffix}`;
4603
4602
  const sizedOff = `off \u2022 ${formatContextFileSize(sizes[fileName])}${occupancySuffix}`;
4604
4603
  return {