pi-usereq 0.62.0 → 0.63.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 +1 -1
- package/package.json +1 -1
- package/src/core/prompts.ts +18 -6
package/README.md
CHANGED
package/package.json
CHANGED
package/src/core/prompts.ts
CHANGED
|
@@ -81,16 +81,28 @@ const PI_DEV_CODING_AGENT_DOCS_PROMPT_PATH = `${PI_DEV_DOCS_PROMPT_PATH}/coding-
|
|
|
81
81
|
* @details Prompt guidance cites this directory when requiring read-only validation against the pi client implementation. Lookup complexity is O(1).
|
|
82
82
|
*/
|
|
83
83
|
const PI_DEV_SOURCE_PROMPT_PATH = "pi.dev-src/pi-mono";
|
|
84
|
+
/**
|
|
85
|
+
* @brief Stores the repository-relative root directory of the pi CLI client sources.
|
|
86
|
+
* @details Prompt guidance cites this directory when declaring the permanently read-only pi CLI client reference and source-of-truth mandates for new implementations, source-code modifications, and bug fixes. Lookup complexity is O(1).
|
|
87
|
+
*/
|
|
88
|
+
const PI_DEV_SOURCE_ROOT_PROMPT_PATH = "pi.dev-src";
|
|
84
89
|
/**
|
|
85
90
|
* @brief Defines the injected pi.dev governance guidance block.
|
|
86
|
-
* @details The block requires read-only handling for documentation and pi client sources, coding-agent-document review, coding-agent-document compliance, optional manifest-referenced document handling, and pi client source validation for ambiguous or bug-fix interface work. Construction happens once at module load. Access complexity is O(1).
|
|
87
|
-
* @satisfies REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275
|
|
91
|
+
* @details The block requires read-only handling for documentation and pi client sources, mandatory read-only pi CLI client reference usage plus source-of-truth handling for new implementations, source-code modifications, and bug fixes, coding-agent-document review, coding-agent-document compliance, optional manifest-referenced document handling, and pi client source validation for ambiguous or bug-fix interface work. Construction happens once at module load. Access complexity is O(1).
|
|
92
|
+
* @satisfies CTN-017, CTN-023, CTN-024, REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275, REQ-378
|
|
88
93
|
*/
|
|
89
94
|
const PI_DEV_CONFORMANCE_BLOCK = [
|
|
90
95
|
"- Treat every path under `docs/` as read-only; do NOT modify "
|
|
91
96
|
+ "any documentation file, including those under `docs/pi.dev/`.",
|
|
92
97
|
"- Treat every path under `pi.dev-src/` as read-only; do NOT modify "
|
|
93
98
|
+ `\`${PI_DEV_SOURCE_PROMPT_PATH}\` or any other pi client source.`,
|
|
99
|
+
`- Every file under \`${PI_DEV_SOURCE_ROOT_PROMPT_PATH}/\` is a pi CLI client `
|
|
100
|
+
+ "source: it MAY and MUST be used as read-only reference material "
|
|
101
|
+
+ "during analysis, implementation, verification, and bug fixing.",
|
|
102
|
+
`- Treat \`${PI_DEV_SOURCE_ROOT_PROMPT_PATH}/\` as the source-of-truth (SoT) `
|
|
103
|
+
+ "for new implementations, source-code modifications, and bug fixes; "
|
|
104
|
+
+ "derive pi-client-facing behavior from it without modifying it "
|
|
105
|
+
+ "in any way.",
|
|
94
106
|
"- If the task creates or modifies software that interfaces with the "
|
|
95
107
|
+ `pi.dev CLI, review \`${PI_DEV_CODING_AGENT_DOCS_PROMPT_PATH}/\` `
|
|
96
108
|
+ "before analysis, implementation, verification, or bug fixing.",
|
|
@@ -110,11 +122,11 @@ const PI_DEV_CONFORMANCE_BLOCK = [
|
|
|
110
122
|
|
|
111
123
|
/**
|
|
112
124
|
* @brief Builds the conditional pi.dev governance block for one rendered prompt.
|
|
113
|
-
* @details Emits the coding-agent-document-driven governance rules only when the selected bundled prompt can analyze or mutate source code and the project root contains the `docs/pi.dev/coding-agent-docs/` directory; the manifest file is optional and its absence does not suppress the block. Time complexity O(1). No filesystem writes.
|
|
125
|
+
* @details Emits the coding-agent-document-driven governance rules only when the selected bundled prompt can analyze or mutate source code and the project root contains the `docs/pi.dev/coding-agent-docs/` directory; the manifest file is optional and its absence does not suppress the block. The emitted rules declare `pi.dev-src/` the permanently read-only pi CLI client reference and source-of-truth for new implementations, source-code modifications, and bug fixes. Time complexity O(1). No filesystem writes.
|
|
114
126
|
* @param[in] promptName {string} Bundled prompt identifier.
|
|
115
127
|
* @param[in] projectBase {string} Absolute project root used for coding-agent-docs directory existence checks.
|
|
116
128
|
* @return {string} Markdown bullet block or the empty string when injection is not applicable.
|
|
117
|
-
* @satisfies REQ-032, REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275
|
|
129
|
+
* @satisfies CTN-023, CTN-024, REQ-032, REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275, REQ-378
|
|
118
130
|
*/
|
|
119
131
|
function buildPiDevConformanceBlock(promptName: string, projectBase: string): string {
|
|
120
132
|
if (!PI_DEV_AWARE_PROMPT_NAMES.has(promptName)) {
|
|
@@ -134,7 +146,7 @@ function buildPiDevConformanceBlock(promptName: string, projectBase: string): st
|
|
|
134
146
|
* @param[in] promptName {string} Bundled prompt identifier.
|
|
135
147
|
* @param[in] projectBase {string} Absolute project root used for coding-agent-docs directory existence checks.
|
|
136
148
|
* @return {string} Prompt markdown with zero or one injected conformance block.
|
|
137
|
-
* @satisfies REQ-032, REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275
|
|
149
|
+
* @satisfies REQ-032, REQ-033, REQ-034, REQ-108, REQ-273, REQ-274, REQ-275, REQ-378
|
|
138
150
|
*/
|
|
139
151
|
function injectPiDevConformanceBlock(text: string, promptName: string, projectBase: string): string {
|
|
140
152
|
const block = buildPiDevConformanceBlock(promptName, projectBase);
|
|
@@ -326,7 +338,7 @@ function renderBundledCommitInstruction(
|
|
|
326
338
|
* @param[in] config {UseReqConfig} Effective project configuration used for path substitutions.
|
|
327
339
|
* @param[in] executionPlan {PromptCommandExecutionPlan | undefined} Optional prompt-command execution plan used for injected runtime guidance.
|
|
328
340
|
* @return {string} Fully rendered prompt markdown ready for `pi.sendUserMessage(...)`.
|
|
329
|
-
* @satisfies REQ-002, REQ-003, REQ-032, REQ-033, REQ-034, REQ-108, REQ-200, REQ-201, REQ-202, REQ-206, REQ-207, REQ-208, REQ-209, REQ-211, REQ-213, REQ-214, REQ-273, REQ-274, REQ-275, REQ-329, REQ-330, REQ-331, REQ-332
|
|
341
|
+
* @satisfies REQ-002, REQ-003, REQ-032, REQ-033, REQ-034, REQ-108, REQ-200, REQ-201, REQ-202, REQ-206, REQ-207, REQ-208, REQ-209, REQ-211, REQ-213, REQ-214, REQ-273, REQ-274, REQ-275, REQ-378, REQ-329, REQ-330, REQ-331, REQ-332
|
|
330
342
|
*/
|
|
331
343
|
export function renderPrompt(
|
|
332
344
|
promptName: string,
|