pi-usereq 0.74.0 → 0.75.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.74.0)
1
+ # PI-useReq/pi-usereq (0.75.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+">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-usereq",
3
- "version": "0.74.0",
3
+ "version": "0.75.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Ogekuri/PI-useReq.git"
@@ -195,23 +195,6 @@ function buildContextFilesBlock(projectBase: string, config: UseReqConfig): stri
195
195
  return sections.join("\n\n");
196
196
  }
197
197
 
198
- /**
199
- * @brief Injects the context-files block in place of the dedicated trailing `%%CONTEXT_FILES%%` placeholder.
200
- * @details Replaces only the last occurrence of the `%%CONTEXT_FILES%%` token, which every bundled prompt places as the dedicated injection point at the end of its `## Context Files` section, so inline backticked references to the token inside prompt prose stay verbatim and no prompt content is overwritten by the injected block. Returns the input unchanged when the token is absent. Runs after every other prompt replacement so literal `%%...%%` tokens inside context-file content are never substituted. Time complexity O(n) in prompt length. No external state is mutated.
201
- * @param[in] text {string} Prompt markdown after every other replacement, block injection, and tool-reference rewrite.
202
- * @param[in] block {string} Rendered context-files markdown block, or the empty string when no enabled context file exists.
203
- * @return {string} Prompt markdown whose dedicated trailing placeholder is replaced by the supplied block while all earlier occurrences of the token remain untouched.
204
- * @satisfies REQ-329, REQ-331, REQ-332
205
- */
206
- function injectContextFilesBlock(text: string, block: string): string {
207
- const token = "%%CONTEXT_FILES%%";
208
- const lastIndex = text.lastIndexOf(token);
209
- if (lastIndex === -1) {
210
- return text;
211
- }
212
- return text.slice(0, lastIndex) + block + text.slice(lastIndex + token.length);
213
- }
214
-
215
198
  /**
216
199
  * @brief Rewrites bundled prompt tool references from legacy `req --...` syntax to internal tool names.
217
200
  * @details Applies deterministic global regex replacements so prompt text matches the extension-registered tool surface instead of the standalone CLI spelling. Time complexity O(p*r) where p is pattern count and r is prompt length.
@@ -388,7 +371,11 @@ export function renderPrompt(
388
371
  projectBase,
389
372
  );
390
373
  const adapted = adaptPromptForInternalTools(withPiDevConformance);
391
- return injectContextFilesBlock(adapted, buildContextFilesBlock(projectBase, config));
374
+ const contextFilesBlock = buildContextFilesBlock(projectBase, config);
375
+ if (contextFilesBlock) {
376
+ return adapted.split("%%CONTEXT_FILES%%").join(contextFilesBlock);
377
+ }
378
+ return adapted.split("%%CONTEXT_FILES%%").join("");
392
379
  }
393
380
 
394
381
  /**