pi-usereq 0.38.0 → 0.40.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 +30 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/pi-usereq/docs/REFERENCES.md +377 -318
- package/pi-usereq/docs/REQUIREMENTS.md +23 -5
- package/pi-usereq/docs/WORKFLOW.md +21 -10
- package/src/core/config.ts +42 -3
- package/src/core/prompts.ts +115 -4
- package/src/index.ts +177 -8
- package/src/resources/prompts/analyze.md +22 -10
- package/src/resources/prompts/change.md +19 -8
- package/src/resources/prompts/check.md +21 -10
- package/src/resources/prompts/cover.md +19 -8
- package/src/resources/prompts/create.md +18 -8
- package/src/resources/prompts/fix.md +22 -11
- package/src/resources/prompts/flowchart.md +21 -10
- package/src/resources/prompts/implement.md +19 -8
- package/src/resources/prompts/new.md +19 -8
- package/src/resources/prompts/readme.md +20 -9
- package/src/resources/prompts/recreate.md +19 -8
- package/src/resources/prompts/refactor.md +19 -8
- package/src/resources/prompts/renumber.md +19 -8
- package/src/resources/prompts/workflow.md +19 -8
- package/src/resources/prompts/write.md +18 -8
- package/src/resources/templates/Requirements_Template.md +2 -22
- package/tests/extension-registration.test.ts +7 -3
- package/tests/prompt-rendering.test.ts +6 -0
package/src/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
} from "./core/agent-tool-json.js";
|
|
28
28
|
import type { FindToolScope } from "./core/find-payload.js";
|
|
29
29
|
import {
|
|
30
|
+
DEFAULT_CONTEXT_FILES_FLAG,
|
|
30
31
|
DEFAULT_GIT_WORKTREE_PREFIX,
|
|
31
32
|
DEFAULT_SRC_DIRS,
|
|
32
33
|
createStaticCheckLanguageConfig,
|
|
@@ -82,7 +83,11 @@ import {
|
|
|
82
83
|
normalizeEnabledPiUsereqTools,
|
|
83
84
|
type PiUsereqStartupToolName,
|
|
84
85
|
} from "./core/pi-usereq-tools.js";
|
|
85
|
-
import {
|
|
86
|
+
import {
|
|
87
|
+
PROMPT_COMMAND_SUMMARY_CUSTOM_TYPE,
|
|
88
|
+
renderPrompt,
|
|
89
|
+
renderPromptCommandSummary,
|
|
90
|
+
} from "./core/prompts.js";
|
|
86
91
|
import {
|
|
87
92
|
abortPromptCommandExecution,
|
|
88
93
|
activatePromptCommandExecution,
|
|
@@ -905,21 +910,53 @@ function executeStatusTool(operation: () => ToolResult): ReturnType<typeof build
|
|
|
905
910
|
|
|
906
911
|
/**
|
|
907
912
|
* @brief Starts delivery of one rendered prompt into the current active session.
|
|
908
|
-
* @details Prefers the replacement-session `
|
|
913
|
+
* @details Prefers the replacement-session `sendMessage(...)` helper exposed by `withSession(...)` callbacks after session replacement so post-switch prompt delivery never reuses stale pre-switch session-bound extension objects. Delivers the rendered prompt as a `display:false` custom message with `triggerTurn:true` so the full content reaches the LLM agent without appearing on screen, and emits a `display:true` command invocation summary so the TUI shows only the compact summary. Returns the underlying hidden-delivery promise without awaiting it so callers can record the `running` workflow transition as soon as prompt handoff is accepted instead of waiting for the full agent turn to complete on runtimes whose async replacement-session helpers resolve only after `agent_end`. When pi later invalidates that replacement-session context during successful prompt-end restoration, the helper suppresses the documented stale-extension-context rejection because the prompt was already accepted and late rethrow would surface a false orchestration failure. Falls back to `sendUserMessage(...)` only for non-replacement flows or runtimes that do not expose `sendMessage`. Runtime is O(n) in prompt length. Side effects are limited to hidden prompt delivery plus on-screen summary display.
|
|
909
914
|
* @param[in] pi {ExtensionAPI} Handler-scoped extension API instance retained as the fallback dispatcher.
|
|
910
915
|
* @param[in] content {string} Rendered prompt markdown.
|
|
916
|
+
* @param[in] summary {string} Command invocation summary text displayed on screen.
|
|
911
917
|
* @param[in] context {unknown} Optional replacement-session helper context.
|
|
912
918
|
* @return {Promise<void>} Promise representing eventual prompt-delivery completion.
|
|
913
|
-
* @satisfies REQ-004, REQ-067, REQ-068, REQ-227, REQ-281
|
|
919
|
+
* @satisfies REQ-004, REQ-067, REQ-068, REQ-227, REQ-281, REQ-334, REQ-335, DES-016
|
|
914
920
|
*/
|
|
915
921
|
function deliverPromptCommand(
|
|
916
922
|
pi: ExtensionAPI,
|
|
917
923
|
content: string,
|
|
924
|
+
summary: string,
|
|
918
925
|
context?: unknown,
|
|
919
926
|
): Promise<void> {
|
|
920
927
|
const replacementContext = context as {
|
|
928
|
+
sendMessage?: (
|
|
929
|
+
message: { customType: string; content: string; display: boolean },
|
|
930
|
+
options?: { triggerTurn?: boolean; deliverAs?: "steer" | "followUp" | "nextTurn" },
|
|
931
|
+
) => Promise<void> | void;
|
|
921
932
|
sendUserMessage?: (message: string) => Promise<void> | void;
|
|
922
933
|
} | undefined;
|
|
934
|
+
const summaryMessage = {
|
|
935
|
+
customType: PROMPT_COMMAND_SUMMARY_CUSTOM_TYPE,
|
|
936
|
+
content: summary,
|
|
937
|
+
display: true,
|
|
938
|
+
};
|
|
939
|
+
const hiddenPromptMessage = {
|
|
940
|
+
customType: PROMPT_COMMAND_SUMMARY_CUSTOM_TYPE,
|
|
941
|
+
content,
|
|
942
|
+
display: false,
|
|
943
|
+
};
|
|
944
|
+
if (typeof replacementContext?.sendMessage === "function") {
|
|
945
|
+
replacementContext.sendMessage(summaryMessage);
|
|
946
|
+
return Promise.resolve(
|
|
947
|
+
replacementContext.sendMessage(hiddenPromptMessage, { triggerTurn: true }),
|
|
948
|
+
).catch((error) => {
|
|
949
|
+
if (isStaleExtensionContextError(error)) {
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
throw error;
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
if (typeof pi.sendMessage === "function") {
|
|
956
|
+
pi.sendMessage(summaryMessage);
|
|
957
|
+
pi.sendMessage(hiddenPromptMessage, { triggerTurn: true });
|
|
958
|
+
return Promise.resolve();
|
|
959
|
+
}
|
|
923
960
|
if (typeof replacementContext?.sendUserMessage === "function") {
|
|
924
961
|
return Promise.resolve(replacementContext.sendUserMessage(content)).catch((error) => {
|
|
925
962
|
if (isStaleExtensionContextError(error)) {
|
|
@@ -3072,7 +3109,12 @@ function registerPromptCommands(
|
|
|
3072
3109
|
},
|
|
3073
3110
|
);
|
|
3074
3111
|
renderPiUsereqStatus(statusController, promptContext);
|
|
3075
|
-
const
|
|
3112
|
+
const commandSummary = renderPromptCommandSummary(
|
|
3113
|
+
promptName,
|
|
3114
|
+
args,
|
|
3115
|
+
config,
|
|
3116
|
+
);
|
|
3117
|
+
const promptDelivery = deliverPromptCommand(pi, content, commandSummary, promptContext);
|
|
3076
3118
|
transitionPromptWorkflowState(
|
|
3077
3119
|
statusController,
|
|
3078
3120
|
promptContext,
|
|
@@ -3949,13 +3991,129 @@ async function configureStaticCheckMenu(
|
|
|
3949
3991
|
}
|
|
3950
3992
|
}
|
|
3951
3993
|
|
|
3994
|
+
/**
|
|
3995
|
+
* @brief Summarizes the `Context Files` flag state for the top-level menu value column.
|
|
3996
|
+
* @details Renders the three context-file flags as compact `name:on|off` segments in the documented order so the top-level row reflects the current injection configuration. Runtime is O(1). No external state is mutated.
|
|
3997
|
+
* @param[in] config {UseReqConfig} Effective project configuration.
|
|
3998
|
+
* @return {string} Compact `Context Files` summary string.
|
|
3999
|
+
* @satisfies REQ-327
|
|
4000
|
+
*/
|
|
4001
|
+
function formatContextFilesSummary(config: UseReqConfig): string {
|
|
4002
|
+
return `requirements:${config["context-files-requirements"] ? "on" : "off"} \u2022 references:${config["context-files-references"] ? "on" : "off"} \u2022 workflow:${config["context-files-workflow"] ? "on" : "off"}`;
|
|
4003
|
+
}
|
|
4004
|
+
|
|
4005
|
+
/**
|
|
4006
|
+
* @brief Builds the shared settings-menu choices for the `Context Files` submenu.
|
|
4007
|
+
* @details Exposes one inline on|off toggle row per context file in the documented `REQUIREMENTS.md`, `REFERENCES.md`, `WORKFLOW.md` order plus a value-less subtree-local `Reset defaults` row. Runtime is O(1). No external state is mutated.
|
|
4008
|
+
* @param[in] config {UseReqConfig} Effective project configuration.
|
|
4009
|
+
* @return {PiUsereqSettingsMenuChoice[]} Ordered `Context Files` submenu choices.
|
|
4010
|
+
* @satisfies REQ-327, REQ-328, REQ-333
|
|
4011
|
+
*/
|
|
4012
|
+
function buildContextFilesMenuChoices(config: UseReqConfig): PiUsereqSettingsMenuChoice[] {
|
|
4013
|
+
return [
|
|
4014
|
+
{
|
|
4015
|
+
id: "context-files-requirements",
|
|
4016
|
+
label: "REQUIREMENTS.md",
|
|
4017
|
+
value: config["context-files-requirements"] ? "on" : "off",
|
|
4018
|
+
values: ["on", "off"],
|
|
4019
|
+
description: "Toggle injection of REQUIREMENTS.md into the prompt context through `%%CONTEXT_FILES%%`.",
|
|
4020
|
+
},
|
|
4021
|
+
{
|
|
4022
|
+
id: "context-files-references",
|
|
4023
|
+
label: "REFERENCES.md",
|
|
4024
|
+
value: config["context-files-references"] ? "on" : "off",
|
|
4025
|
+
values: ["on", "off"],
|
|
4026
|
+
description: "Toggle injection of REFERENCES.md into the prompt context through `%%CONTEXT_FILES%%`.",
|
|
4027
|
+
},
|
|
4028
|
+
{
|
|
4029
|
+
id: "context-files-workflow",
|
|
4030
|
+
label: "WORKFLOW.md",
|
|
4031
|
+
value: config["context-files-workflow"] ? "on" : "off",
|
|
4032
|
+
values: ["on", "off"],
|
|
4033
|
+
description: "Toggle injection of WORKFLOW.md into the prompt context through `%%CONTEXT_FILES%%`.",
|
|
4034
|
+
},
|
|
4035
|
+
...buildTerminalSettingsMenuChoices({
|
|
4036
|
+
resetDefaultsDescription: "Restore the default Context Files configuration (all three files enabled).",
|
|
4037
|
+
}),
|
|
4038
|
+
];
|
|
4039
|
+
}
|
|
4040
|
+
|
|
4041
|
+
/**
|
|
4042
|
+
* @brief Runs the `Context Files` configuration submenu.
|
|
4043
|
+
* @details Loads the shared settings menu with the three context-file toggle rows, persists each inline toggle immediately through the shared change callback, restores all three flags to enabled on approved subtree reset, preserves focus on the toggled row, and returns to the top-level menu on cancel. Runtime depends on user interaction count. Side effects include config writes and UI notifications.
|
|
4044
|
+
* @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
4045
|
+
* @param[in,out] config {UseReqConfig} Mutable effective project configuration.
|
|
4046
|
+
* @param[in] onConfigChange {() => void} Shared persistence-plus-status callback.
|
|
4047
|
+
* @return {Promise<void>} Promise resolved when the submenu closes.
|
|
4048
|
+
* @satisfies REQ-327, REQ-328, REQ-333
|
|
4049
|
+
*/
|
|
4050
|
+
async function configureContextFilesMenu(
|
|
4051
|
+
ctx: ExtensionCommandContext,
|
|
4052
|
+
config: UseReqConfig,
|
|
4053
|
+
onConfigChange: () => void,
|
|
4054
|
+
): Promise<void> {
|
|
4055
|
+
const setFlag = (flagKey: "context-files-requirements" | "context-files-references" | "context-files-workflow", enabled: boolean): void => {
|
|
4056
|
+
config[flagKey] = enabled;
|
|
4057
|
+
onConfigChange();
|
|
4058
|
+
ctx.ui.notify(`${flagKey.replace("context-files-", "").replace("-", " ")} context file ${enabled ? "enabled" : "disabled"}`, "info");
|
|
4059
|
+
};
|
|
4060
|
+
let focusedChoiceId: string | undefined;
|
|
4061
|
+
while (true) {
|
|
4062
|
+
const choice = await showPiUsereqSettingsMenu(ctx, "Context Files", buildContextFilesMenuChoices(config), {
|
|
4063
|
+
initialSelectedId: focusedChoiceId,
|
|
4064
|
+
getChoices: () => buildContextFilesMenuChoices(config),
|
|
4065
|
+
onChange: (choiceId, newValue) => {
|
|
4066
|
+
if (choiceId === "context-files-requirements") {
|
|
4067
|
+
setFlag("context-files-requirements", newValue === "on");
|
|
4068
|
+
return;
|
|
4069
|
+
}
|
|
4070
|
+
if (choiceId === "context-files-references") {
|
|
4071
|
+
setFlag("context-files-references", newValue === "on");
|
|
4072
|
+
return;
|
|
4073
|
+
}
|
|
4074
|
+
if (choiceId === "context-files-workflow") {
|
|
4075
|
+
setFlag("context-files-workflow", newValue === "on");
|
|
4076
|
+
}
|
|
4077
|
+
},
|
|
4078
|
+
});
|
|
4079
|
+
if (!choice) {
|
|
4080
|
+
return;
|
|
4081
|
+
}
|
|
4082
|
+
focusedChoiceId = choice;
|
|
4083
|
+
if (choice === "reset-defaults") {
|
|
4084
|
+
const resetPreview: ResetConfirmationChange[] = [
|
|
4085
|
+
{ label: "REQUIREMENTS.md", previousValue: config["context-files-requirements"] ? "on" : "off", nextValue: DEFAULT_CONTEXT_FILES_FLAG ? "on" : "off" },
|
|
4086
|
+
{ label: "REFERENCES.md", previousValue: config["context-files-references"] ? "on" : "off", nextValue: DEFAULT_CONTEXT_FILES_FLAG ? "on" : "off" },
|
|
4087
|
+
{ label: "WORKFLOW.md", previousValue: config["context-files-workflow"] ? "on" : "off", nextValue: DEFAULT_CONTEXT_FILES_FLAG ? "on" : "off" },
|
|
4088
|
+
].filter((change) => change.previousValue !== change.nextValue);
|
|
4089
|
+
const approved = await confirmResetChanges(
|
|
4090
|
+
ctx,
|
|
4091
|
+
"Confirm Context Files reset",
|
|
4092
|
+
resetPreview,
|
|
4093
|
+
"Approve restoring the default Context Files configuration (all three files enabled).",
|
|
4094
|
+
"Abort the Context Files reset and keep the current values.",
|
|
4095
|
+
);
|
|
4096
|
+
if (!approved) {
|
|
4097
|
+
ctx.ui.notify("Aborted Context Files reset", "info");
|
|
4098
|
+
continue;
|
|
4099
|
+
}
|
|
4100
|
+
config["context-files-requirements"] = DEFAULT_CONTEXT_FILES_FLAG;
|
|
4101
|
+
config["context-files-references"] = DEFAULT_CONTEXT_FILES_FLAG;
|
|
4102
|
+
config["context-files-workflow"] = DEFAULT_CONTEXT_FILES_FLAG;
|
|
4103
|
+
onConfigChange();
|
|
4104
|
+
ctx.ui.notify("Restored default Context Files configuration", "info");
|
|
4105
|
+
continue;
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
4109
|
+
|
|
3952
4110
|
/**
|
|
3953
4111
|
* @brief Builds the shared settings-menu choices for the top-level pi-usereq configuration UI.
|
|
3954
|
-
* @details Serializes primary configuration actions into right-valued menu rows consumed by the shared settings-menu renderer, including automatic git-commit mode, effective prompt-command worktree state, notification summary, debug summary, locked worktree rows when automatic git commit is disabled, and display-only local plus global config paths. Runtime is O(s) in source-directory count. No external state is mutated.
|
|
4112
|
+
* @details Serializes primary configuration actions into right-valued menu rows consumed by the shared settings-menu renderer, including the `Context Files` injection toggles, automatic git-commit mode, effective prompt-command worktree state, notification summary, debug summary, locked worktree rows when automatic git commit is disabled, and display-only local plus global config paths. Runtime is O(s) in source-directory count. No external state is mutated.
|
|
3955
4113
|
* @param[in] cwd {string} Current working directory.
|
|
3956
4114
|
* @param[in] config {UseReqConfig} Effective project configuration.
|
|
3957
4115
|
* @return {PiUsereqSettingsMenuChoice[]} Ordered top-level menu choices.
|
|
3958
|
-
* @satisfies REQ-006, REQ-031, REQ-137, REQ-150, REQ-151, REQ-152, REQ-162, REQ-190, REQ-191, REQ-197, REQ-204, REQ-205, REQ-212, REQ-215, REQ-216, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-314, REQ-318, REQ-319, REQ-320
|
|
4116
|
+
* @satisfies REQ-006, REQ-031, REQ-137, REQ-150, REQ-151, REQ-152, REQ-162, REQ-190, REQ-191, REQ-197, REQ-204, REQ-205, REQ-212, REQ-215, REQ-216, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-314, REQ-318, REQ-319, REQ-320, REQ-326
|
|
3959
4117
|
*/
|
|
3960
4118
|
function buildPiUsereqMenuChoices(
|
|
3961
4119
|
cwd: string,
|
|
@@ -3985,6 +4143,12 @@ function buildPiUsereqMenuChoices(
|
|
|
3985
4143
|
value: config["tests-dir"],
|
|
3986
4144
|
description: "Edit the repository-relative directory used for project test assets and static-check selection.",
|
|
3987
4145
|
},
|
|
4146
|
+
{
|
|
4147
|
+
id: "context-files",
|
|
4148
|
+
label: "Context Files",
|
|
4149
|
+
value: formatContextFilesSummary(config),
|
|
4150
|
+
description: "Toggle injection of REQUIREMENTS.md, REFERENCES.md, and WORKFLOW.md into prompt context through `%%CONTEXT_FILES%%`.",
|
|
4151
|
+
},
|
|
3988
4152
|
{
|
|
3989
4153
|
id: "auto-git-commit",
|
|
3990
4154
|
label: "Auto git commit",
|
|
@@ -4113,7 +4277,7 @@ function buildSrcDirRemovalChoices(config: UseReqConfig): PiUsereqSettingsMenuCh
|
|
|
4113
4277
|
* @param[in] ctx {ExtensionCommandContext} Active command context.
|
|
4114
4278
|
* @param[in,out] statusController {PiUsereqStatusController} Mutable status controller.
|
|
4115
4279
|
* @return {Promise<void>} Promise resolved when configuration is saved and the menu closes.
|
|
4116
|
-
* @satisfies REQ-006, REQ-031, REQ-137, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-162, REQ-190, REQ-191, REQ-192, REQ-194, REQ-195, REQ-204, REQ-205, REQ-212, REQ-215, REQ-216, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243, REQ-314, REQ-318, REQ-319, REQ-320
|
|
4280
|
+
* @satisfies REQ-006, REQ-031, REQ-137, REQ-150, REQ-151, REQ-152, REQ-153, REQ-154, REQ-162, REQ-190, REQ-191, REQ-192, REQ-194, REQ-195, REQ-204, REQ-205, REQ-212, REQ-215, REQ-216, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243, REQ-314, REQ-318, REQ-319, REQ-320, REQ-326, REQ-327, REQ-328, REQ-333
|
|
4117
4281
|
*/
|
|
4118
4282
|
async function configurePiUsereq(
|
|
4119
4283
|
pi: ExtensionAPI,
|
|
@@ -4193,6 +4357,10 @@ async function configurePiUsereq(
|
|
|
4193
4357
|
}
|
|
4194
4358
|
continue;
|
|
4195
4359
|
}
|
|
4360
|
+
if (choice === "context-files") {
|
|
4361
|
+
await configureContextFilesMenu(ctx, config, persistConfigChange);
|
|
4362
|
+
continue;
|
|
4363
|
+
}
|
|
4196
4364
|
if (choice === "auto-git-commit") {
|
|
4197
4365
|
const nextAutoGitCommit = config.AUTO_GIT_COMMIT === "enable"
|
|
4198
4366
|
? "disable"
|
|
@@ -4335,6 +4503,7 @@ async function configurePiUsereq(
|
|
|
4335
4503
|
{ label: "Document directory", previousValue: config["docs-dir"], nextValue: defaultConfig["docs-dir"] },
|
|
4336
4504
|
{ label: "Source-code directories", previousValue: config["src-dir"].join(", "), nextValue: defaultConfig["src-dir"].join(", ") },
|
|
4337
4505
|
{ label: "Unit tests directory", previousValue: config["tests-dir"], nextValue: defaultConfig["tests-dir"] },
|
|
4506
|
+
{ label: "Context Files", previousValue: formatContextFilesSummary(config), nextValue: formatContextFilesSummary(defaultConfig) },
|
|
4338
4507
|
{ label: "Auto git commit", previousValue: config.AUTO_GIT_COMMIT, nextValue: defaultConfig.AUTO_GIT_COMMIT },
|
|
4339
4508
|
{ label: "Git worktree", previousValue: config.GIT_WORKTREE_ENABLED, nextValue: defaultConfig.GIT_WORKTREE_ENABLED },
|
|
4340
4509
|
{ label: "Worktree prefix", previousValue: config.GIT_WORKTREE_PREFIX, nextValue: defaultConfig.GIT_WORKTREE_PREFIX },
|
|
@@ -4395,7 +4564,7 @@ function registerConfigCommands(
|
|
|
4395
4564
|
* @details Validates installation-owned bundled resources, registers the specialized `req-reset` and `req-references` commands plus bundled prompt-backed commands and agent tools, conditionally registers config-gated debug tool wrapper commands when the current project enables them, registers configuration commands, registers the configurable notification-sound shortcut when the runtime supports shortcuts, and installs shared wrappers for all supported pi lifecycle hooks so status telemetry, context usage, prompt timing, cumulative runtime, prompt-specific Pushover metadata, tool-result debug logging, and prompt-orchestration effects remain synchronized with runtime events. Runtime is O(h) in hook count during registration. Side effects include filesystem reads, command/tool/shortcut registration, UI updates, active-tool changes, optional debug-log writes, and timer scheduling.
|
|
4396
4565
|
* @param[in] pi {ExtensionAPI} Active extension API instance.
|
|
4397
4566
|
* @return {void} No return value.
|
|
4398
|
-
* @satisfies DES-002, DES-015, REQ-004, REQ-005, REQ-009, REQ-044, REQ-067, REQ-068, REQ-109, REQ-111, REQ-112, REQ-113, REQ-114, REQ-115, REQ-116, REQ-117, REQ-118, REQ-119, REQ-120, REQ-121, REQ-122, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-131, REQ-132, REQ-133, REQ-134, REQ-137, REQ-159, REQ-163, REQ-164, REQ-165, REQ-166, REQ-167, REQ-168, REQ-169, REQ-172, REQ-174, REQ-179, REQ-180, REQ-184, REQ-188, REQ-190, REQ-191, REQ-192, REQ-193, REQ-194, REQ-195, REQ-196, REQ-197, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243, REQ-244, REQ-245, REQ-246, REQ-247, REQ-298, REQ-299, REQ-300, REQ-301, REQ-302, REQ-303, REQ-304, REQ-305, REQ-306, REQ-312, REQ-313, REQ-323, REQ-324, REQ-325
|
|
4567
|
+
* @satisfies DES-002, DES-015, REQ-004, REQ-005, REQ-009, REQ-044, REQ-067, REQ-068, REQ-109, REQ-111, REQ-112, REQ-113, REQ-114, REQ-115, REQ-116, REQ-117, REQ-118, REQ-119, REQ-120, REQ-121, REQ-122, REQ-123, REQ-124, REQ-125, REQ-126, REQ-127, REQ-128, REQ-131, REQ-132, REQ-133, REQ-134, REQ-137, REQ-159, REQ-163, REQ-164, REQ-165, REQ-166, REQ-167, REQ-168, REQ-169, REQ-172, REQ-174, REQ-179, REQ-180, REQ-184, REQ-188, REQ-190, REQ-191, REQ-192, REQ-193, REQ-194, REQ-195, REQ-196, REQ-197, REQ-236, REQ-237, REQ-238, REQ-239, REQ-240, REQ-241, REQ-242, REQ-243, REQ-244, REQ-245, REQ-246, REQ-247, REQ-298, REQ-299, REQ-300, REQ-301, REQ-302, REQ-303, REQ-304, REQ-305, REQ-306, REQ-312, REQ-313, REQ-323, REQ-324, REQ-325, REQ-326, REQ-327
|
|
4399
4568
|
*/
|
|
4400
4569
|
export default function piUsereqExtension(pi: ExtensionAPI): void {
|
|
4401
4570
|
const statusController = createPiUsereqStatusController();
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Produce an analysis report"
|
|
3
|
-
argument-hint: "Description of the analysis/investigation to perform"
|
|
4
|
-
usage: >
|
|
5
|
-
Select this prompt if you need a read-only, evidence-backed investigation/triage of the current state (SRS in %%DOC_PATH%%/REQUIREMENTS.md, runtime model in %%DOC_PATH%%/WORKFLOW.md, references in %%DOC_PATH%%/REFERENCES.md, and code under %%SRC_PATHS%%) to answer a question or decide which follow-up workflow to run. Use when you must NOT change any files and the deliverable is an analysis report with concrete evidence pointers. Do NOT select if you must, (a) produce an OK/FAIL verdict for every requirement ID (use /req-check), (b) modify requirements (use /req-new or /req-change), (c) implement code/tests (use /req-fix, /req-refactor, /req-cover, /req-implement), or (d) regenerate only WORKFLOW/REFERENCES docs (use /req-workflow or /req-references).
|
|
6
|
-
---
|
|
7
|
-
|
|
8
1
|
# Produce an analysis report
|
|
9
2
|
|
|
10
3
|
## Purpose
|
|
@@ -23,19 +16,32 @@ In scope: read-only analysis of the above documents plus source under %%SRC_PATH
|
|
|
23
16
|
- **Act as an Expert Debugger** when you identify a failure symptom with concrete evidence (failure evidence, stack trace, reproducible output). Only explain the root cause, not propose or implement fixes.
|
|
24
17
|
|
|
25
18
|
|
|
19
|
+
## Iteration and Context Economy
|
|
20
|
+
- **CRITICAL**: Plan every Step to complete in the minimum number of iterations; batch independent reads, searches, and edits into a single response and dispatch parallel tool calls whenever no dependency forces sequencing.
|
|
21
|
+
- **CRITICAL**: MUST NOT re-read, re-search, or re-fetch any file already provided as injected `%%CONTEXT_FILES%%` context or already read in the current session; reuse prior tool-output evidence instead.
|
|
22
|
+
- **CRITICAL**: MUST NOT restate requirement text, prior tool output, or unchanged file contents into the context; cite them by file path, symbol, and line range, quoting only the minimal changed snippet.
|
|
23
|
+
- **CRITICAL**: MUST add only information required by the active Step, a requirement ID, or explicit user-request text; omit narration, filler, restatements, and speculative commentary.
|
|
24
|
+
- **CRITICAL**: MUST choose the most token-efficient evidence path in order: `%%DOC_PATH%%/REQUIREMENTS.md`, `%%DOC_PATH%%/WORKFLOW.md`, `%%DOC_PATH%%/REFERENCES.md`, then `search`/`files-search`, then `rg`/`grep` fallback, reading only targeted constructs and line ranges.
|
|
25
|
+
- **CRITICAL**: MUST gather all evidence a Step needs before producing its output and MUST NOT split a single logical operation across multiple iterations when one suffices.
|
|
26
|
+
- **CRITICAL**: MUST pause and wait for a tool response only when a Step explicitly depends on it; otherwise proceed autonomously to the next Step without requesting confirmation.
|
|
27
|
+
- **CRITICAL**: These rules MUST govern how the agent organizes and sequences the work described in the `## Steps` section.
|
|
28
|
+
|
|
29
|
+
|
|
26
30
|
## Absolute Rules, Non-Negotiable
|
|
27
|
-
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
31
|
+
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `git grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
28
32
|
- **CRITICAL**: NEVER write, modify, edit, or delete files outside of the project’s home directory, except under `/tmp`, where creating temporary files and writing outputs is allowed (the only permitted location outside the project).
|
|
29
33
|
- You MUST read `%%DOC_PATH%%/REQUIREMENTS.md`, but you MUST NOT modify it in this workflow.
|
|
30
34
|
- Treat static analysis as safe. Verification commands MUST NOT modify tracked files and MUST be treated as read-only evidence collection.
|
|
31
35
|
- **CRITICAL**: Do not modify any git tracked files (i.e., returned by `git ls-files`). You may run commands that create untracked artifacts ONLY if: (a) they are confined to standard disposable locations (e.g., `tmp/`, `temp/`, `.cache/`, `.pytest_cache/`, `node_modules/.cache`, `/tmp`), (b) they do not change any tracked file contents, and (c) you do NOT rely on those artifacts as permanent outputs. If unsure, run tools in a temporary directory (e.g., `tmp/`, `temp/`, `/tmp`) or use tool flags that disable caches.
|
|
32
|
-
|
|
36
|
+
**CRITICAL**: Git Read-Only Restriction
|
|
37
|
+
- Only read-only access to the git repository is allowed. You may inspect files, history, diffs, status, and other repository metadata, but you MUST NOT execute any command or action that modifies the repository state, the index, refs, history, branches, tags, remotes, or the .git directory. Any repository write or state-changing action is forbidden.
|
|
38
|
+
- Allowed git commands in this workflow (read-only only): `git status`, `git diff`, `git ls-files`, `grep`, `git rev-parse`, `git branch --show-current`. Do NOT run any other git commands.
|
|
33
39
|
|
|
34
40
|
## Behavior
|
|
35
41
|
- Only analyze the code and present the results; make no changes.
|
|
36
42
|
- Do NOT create or modify tests in this workflow.
|
|
37
43
|
- Report facts: for each finding include file paths and, when useful, line numbers or short code excerpts.
|
|
38
|
-
- Allowed git commands in this workflow (read-only only): `git status`, `git diff`, `git ls-files`, `grep`, `git rev-parse`, `git branch --show-current`. Do NOT run any other git commands.
|
|
44
|
+
- Allowed git commands in this workflow (read-only only): `git status`, `git diff`, `git ls-files`, `git grep`, `git rev-parse`, `git branch --show-current`. Do NOT run any other git commands.
|
|
39
45
|
- If `.venv/bin/python` exists in the project root, use it for Python executions (eg, `PYTHONPATH=src .venv/bin/python -m <program name>`).
|
|
40
46
|
- Non-Python tooling should use the project's standard commands.
|
|
41
47
|
- Use filesystem/shell tools to read files as needed (read-only only; e.g., `cat`, `sed -n`, `head`, `tail`, `rg`, `less`). Do NOT use in-place editing flags (e.g., `-i`, `perl -pi`) in this workflow.
|
|
@@ -127,3 +133,9 @@ Create internally a *check-list* for the **Global Roadmap** including all the nu
|
|
|
127
133
|
|
|
128
134
|
<h2 id="users-request">User's Request</h2>
|
|
129
135
|
%%ARGS%%
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## Context Files
|
|
139
|
+
The content under this section is pre-loaded reference material for this workflow, already present in full in your context. Treat it as authoritative ground truth and reason over it directly; do NOT re-read, search, locate, or fetch it with `read`, `search`, `files-search`, `grep`, `ls`, or any discovery tool. If this section contains no file content, treat it as empty and proceed without context-file assumptions.
|
|
140
|
+
|
|
141
|
+
%%CONTEXT_FILES%%
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Update the requirements and implement the corresponding changes"
|
|
3
|
-
argument-hint: "Description of the requirements changes to implement"
|
|
4
|
-
usage: >
|
|
5
|
-
Select this prompt if and only if the request requires changing existing requirements/behavior, you must edit/replace/remove existing requirement IDs in %%DOC_PATH%%/REQUIREMENTS.md (not just append), then implement the corresponding code/tests under %%SRC_PATHS%% and %%TEST_PATH%% with verification and traceability, and update %%DOC_PATH%%/WORKFLOW.md and %%DOC_PATH%%/REFERENCES.md. Do NOT select if the SRS must remain unchanged (use /req-fix, /req-refactor, /req-cover, or /req-implement). Do NOT select if the change is strictly additive/backwards-compatible and can be expressed only by appending new requirement IDs (use /req-new). Do NOT select for read-only auditing/triage (use /req-check or /req-analyze) or docs-only maintenance (use /req-workflow or /req-references).
|
|
6
|
-
---
|
|
7
|
-
|
|
8
1
|
# Update the requirements and implement the corresponding changes
|
|
9
2
|
|
|
10
3
|
## Purpose
|
|
@@ -20,10 +13,22 @@ In scope: patch-style edits to `%%DOC_PATH%%/REQUIREMENTS.md`, an implementation
|
|
|
20
13
|
- **Act as a Senior System Architect** when generating the **Implementation Delta**: translate requirements into a robust, modular, and non-breaking technical implementation plan.
|
|
21
14
|
- **Act as a Senior Software Developer** during implementation: implement the planned changes with high-quality, idiomatic code that maps strictly to Requirement IDs.
|
|
22
15
|
- **Act as a QA Engineer** during verification and testing: verify compliance with zero leniency, using mandatory code evidence and strict fix loops based on static-analysis findings to ensure stability.
|
|
16
|
+
- **Act as an Expert GitOps Engineer** when executing git workflows.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Iteration and Context Economy
|
|
20
|
+
- **CRITICAL**: Plan every Step to complete in the minimum number of iterations; batch independent reads, searches, and edits into a single response and dispatch parallel tool calls whenever no dependency forces sequencing.
|
|
21
|
+
- **CRITICAL**: MUST NOT re-read, re-search, or re-fetch any file already provided as injected `%%CONTEXT_FILES%%` context or already read in the current session; reuse prior tool-output evidence instead.
|
|
22
|
+
- **CRITICAL**: MUST NOT restate requirement text, prior tool output, or unchanged file contents into the context; cite them by file path, symbol, and line range, quoting only the minimal changed snippet.
|
|
23
|
+
- **CRITICAL**: MUST add only information required by the active Step, a requirement ID, or explicit user-request text; omit narration, filler, restatements, and speculative commentary.
|
|
24
|
+
- **CRITICAL**: MUST choose the most token-efficient evidence path in order: `%%DOC_PATH%%/REQUIREMENTS.md`, `%%DOC_PATH%%/WORKFLOW.md`, `%%DOC_PATH%%/REFERENCES.md`, then `search`/`files-search`, then `rg`/`grep` fallback, reading only targeted constructs and line ranges.
|
|
25
|
+
- **CRITICAL**: MUST gather all evidence a Step needs before producing its output and MUST NOT split a single logical operation across multiple iterations when one suffices.
|
|
26
|
+
- **CRITICAL**: MUST pause and wait for a tool response only when a Step explicitly depends on it; otherwise proceed autonomously to the next Step without requesting confirmation.
|
|
27
|
+
- **CRITICAL**: These rules MUST govern how the agent organizes and sequences the work described in the `## Steps` section.
|
|
23
28
|
|
|
24
29
|
|
|
25
30
|
## Absolute Rules, Non-Negotiable
|
|
26
|
-
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
31
|
+
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `git grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
27
32
|
- **CRITICAL**: NEVER write, modify, edit, or delete files outside of the active repository directory, except under `/tmp`.
|
|
28
33
|
- You can read, write, or edit `%%DOC_PATH%%/REQUIREMENTS.md`.
|
|
29
34
|
- Treat static analysis as safe. Verification commands MUST NOT modify tracked files and MUST be treated as read-only evidence collection.
|
|
@@ -187,3 +192,9 @@ Create internally a *check-list* for the **Global Roadmap** including all the nu
|
|
|
187
192
|
|
|
188
193
|
<h2 id="users-request">User's Request</h2>
|
|
189
194
|
%%ARGS%%
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
## Context Files
|
|
198
|
+
The content under this section is pre-loaded reference material for this workflow, already present in full in your context. Treat it as authoritative ground truth and reason over it directly; do NOT re-read, search, locate, or fetch it with `read`, `search`, `files-search`, `grep`, `ls`, or any discovery tool. If this section contains no file content, treat it as empty and proceed without context-file assumptions.
|
|
199
|
+
|
|
200
|
+
%%CONTEXT_FILES%%
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Run the requirements check"
|
|
3
|
-
argument-hint: "Optional, context to focus the audit (can be empty)"
|
|
4
|
-
usage: >
|
|
5
|
-
Select this prompt if you need a complete, repository-read-only compliance audit that outputs an OK/FAIL verdict for EVERY requirement ID in %%DOC_PATH%%/REQUIREMENTS.md, backed by concrete code evidence and static-analysis evidence. Use after requirements/code changes to measure coverage and to produce a gap list + implementation-only technical report when FAILs exist. Do NOT select if you will modify any files (requirements/code/docs) or implement fixes; downstream implementation should be done via /req-cover (small set of uncovered IDs), /req-implement (large/greenfield gaps), /req-fix, /req-refactor, /req-new, or /req-change depending on intent.
|
|
6
|
-
---
|
|
7
|
-
|
|
8
1
|
# Run the requirements check
|
|
9
2
|
|
|
10
3
|
## Purpose
|
|
@@ -22,14 +15,26 @@ In scope: read `%%DOC_PATH%%/REQUIREMENTS.md` (and related docs), run static-ana
|
|
|
22
15
|
- **Act as a QA Auditor** when reporting facts, requiring concrete evidence (file paths, line numbers) for every finding.
|
|
23
16
|
|
|
24
17
|
|
|
18
|
+
## Iteration and Context Economy
|
|
19
|
+
- **CRITICAL**: Plan every Step to complete in the minimum number of iterations; batch independent reads, searches, and edits into a single response and dispatch parallel tool calls whenever no dependency forces sequencing.
|
|
20
|
+
- **CRITICAL**: MUST NOT re-read, re-search, or re-fetch any file already provided as injected `%%CONTEXT_FILES%%` context or already read in the current session; reuse prior tool-output evidence instead.
|
|
21
|
+
- **CRITICAL**: MUST NOT restate requirement text, prior tool output, or unchanged file contents into the context; cite them by file path, symbol, and line range, quoting only the minimal changed snippet.
|
|
22
|
+
- **CRITICAL**: MUST add only information required by the active Step, a requirement ID, or explicit user-request text; omit narration, filler, restatements, and speculative commentary.
|
|
23
|
+
- **CRITICAL**: MUST choose the most token-efficient evidence path in order: `%%DOC_PATH%%/REQUIREMENTS.md`, `%%DOC_PATH%%/WORKFLOW.md`, `%%DOC_PATH%%/REFERENCES.md`, then `search`/`files-search`, then `rg`/`grep` fallback, reading only targeted constructs and line ranges.
|
|
24
|
+
- **CRITICAL**: MUST gather all evidence a Step needs before producing its output and MUST NOT split a single logical operation across multiple iterations when one suffices.
|
|
25
|
+
- **CRITICAL**: MUST pause and wait for a tool response only when a Step explicitly depends on it; otherwise proceed autonomously to the next Step without requesting confirmation.
|
|
26
|
+
- **CRITICAL**: These rules MUST govern how the agent organizes and sequences the work described in the `## Steps` section.
|
|
27
|
+
|
|
28
|
+
|
|
25
29
|
## Absolute Rules, Non-Negotiable
|
|
26
|
-
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
30
|
+
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `git grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
27
31
|
- **CRITICAL**: NEVER write, modify, edit, or delete files outside of the project’s home directory, except under `/tmp`, where creating temporary files and writing outputs is allowed (the only permitted location outside the project).
|
|
28
32
|
- You MUST read `%%DOC_PATH%%/REQUIREMENTS.md`, but you MUST NOT modify it in this workflow.
|
|
29
33
|
- Treat static analysis as safe. Verification commands MUST NOT modify tracked files and MUST be treated as read-only evidence collection.
|
|
30
34
|
- **CRITICAL**: Do not modify any git tracked files (i.e., returned by `git ls-files`). You may run commands that create untracked artifacts ONLY if: (a) they are confined to standard disposable locations (e.g., `tmp/`, `temp/`, `.cache/`, `.pytest_cache/`, `node_modules/.cache`, `/tmp`), (b) they do not change any tracked file contents, and (c) you do NOT rely on those artifacts as permanent outputs. If unsure, run tools in a temporary directory (e.g., `tmp/`, `temp/`, `/tmp`) or use tool flags that disable caches.
|
|
31
|
-
|
|
32
|
-
-
|
|
35
|
+
**CRITICAL**: Git Read-Only Restriction
|
|
36
|
+
- Only read-only access to the git repository is allowed. You may inspect files, history, diffs, status, and other repository metadata, but you MUST NOT execute any command or action that modifies the repository state, the index, refs, history, branches, tags, remotes, or the .git directory. Any repository write or state-changing action is forbidden.
|
|
37
|
+
- Allowed git commands in this workflow (read-only only): `git status`, `git diff`, `git ls-files`, `grep`, `git rev-parse`, `git branch --show-current`. Do NOT run any other git commands.
|
|
33
38
|
|
|
34
39
|
## Behavior
|
|
35
40
|
- Only analyze the code and static-analysis execution results and present the results; make no changes.
|
|
@@ -135,3 +140,9 @@ Create internally a *check-list* for the **Global Roadmap** including all the nu
|
|
|
135
140
|
|
|
136
141
|
<h2 id="users-request">User's Request</h2>
|
|
137
142
|
%%ARGS%%
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
## Context Files
|
|
146
|
+
The content under this section is pre-loaded reference material for this workflow, already present in full in your context. Treat it as authoritative ground truth and reason over it directly; do NOT re-read, search, locate, or fetch it with `read`, `search`, `files-search`, `grep`, `ls`, or any discovery tool. If this section contains no file content, treat it as empty and proceed without context-file assumptions.
|
|
147
|
+
|
|
148
|
+
%%CONTEXT_FILES%%
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Implement minimal changes to cover uncovered existing requirements"
|
|
3
|
-
argument-hint: "Optional, context to focus coverage work (can be empty)"
|
|
4
|
-
usage: >
|
|
5
|
-
Select this prompt when specific uncovered requirement IDs already exist (typically identified by /req-check) and the goal is to implement the minimal deltas needed to satisfy those IDs WITHOUT changing %%DOC_PATH%%/REQUIREMENTS.md. Use for targeted gap-closure in an otherwise existing codebase (small/known missing surface), including adding/adjusting tests under %%TEST_PATH%%, verifying, updating %%DOC_PATH%%/WORKFLOW.md and %%DOC_PATH%%/REFERENCES.md, and committing. Do NOT select if you must change or add requirements (use /req-change or /req-new), if the request is primarily a defect fix relative to already-covered requirements (use /req-fix), or if the implementation is largely absent and needs end-to-end build-out from the SRS (use /req-implement).
|
|
6
|
-
---
|
|
7
|
-
|
|
8
1
|
# Implement minimal changes to cover uncovered existing requirements
|
|
9
2
|
|
|
10
3
|
## Purpose
|
|
@@ -21,10 +14,22 @@ In scope: identify uncovered requirement IDs, implement minimal code changes und
|
|
|
21
14
|
- **Act as a Senior System Architect** when generating the **Implementation Delta** and planning the coverage strategy: ensure the new implementation integrates perfectly with the existing architecture without regressions.
|
|
22
15
|
- **Act as a Senior Software Developer** when implementing the missing logic: focus on satisfying the Requirement IDs previously marked as uncovered.
|
|
23
16
|
- **Act as a QA Engineer** during verification and testing Steps: verify compliance with zero leniency, using mandatory code evidence and strict fix loops based on static-analysis findings to ensure stability.
|
|
17
|
+
- **Act as an Expert GitOps Engineer** when executing git workflows.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Iteration and Context Economy
|
|
21
|
+
- **CRITICAL**: Plan every Step to complete in the minimum number of iterations; batch independent reads, searches, and edits into a single response and dispatch parallel tool calls whenever no dependency forces sequencing.
|
|
22
|
+
- **CRITICAL**: MUST NOT re-read, re-search, or re-fetch any file already provided as injected `%%CONTEXT_FILES%%` context or already read in the current session; reuse prior tool-output evidence instead.
|
|
23
|
+
- **CRITICAL**: MUST NOT restate requirement text, prior tool output, or unchanged file contents into the context; cite them by file path, symbol, and line range, quoting only the minimal changed snippet.
|
|
24
|
+
- **CRITICAL**: MUST add only information required by the active Step, a requirement ID, or explicit user-request text; omit narration, filler, restatements, and speculative commentary.
|
|
25
|
+
- **CRITICAL**: MUST choose the most token-efficient evidence path in order: `%%DOC_PATH%%/REQUIREMENTS.md`, `%%DOC_PATH%%/WORKFLOW.md`, `%%DOC_PATH%%/REFERENCES.md`, then `search`/`files-search`, then `rg`/`grep` fallback, reading only targeted constructs and line ranges.
|
|
26
|
+
- **CRITICAL**: MUST gather all evidence a Step needs before producing its output and MUST NOT split a single logical operation across multiple iterations when one suffices.
|
|
27
|
+
- **CRITICAL**: MUST pause and wait for a tool response only when a Step explicitly depends on it; otherwise proceed autonomously to the next Step without requesting confirmation.
|
|
28
|
+
- **CRITICAL**: These rules MUST govern how the agent organizes and sequences the work described in the `## Steps` section.
|
|
24
29
|
|
|
25
30
|
|
|
26
31
|
## Absolute Rules, Non-Negotiable
|
|
27
|
-
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
32
|
+
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `git grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
28
33
|
- **CRITICAL**: NEVER write, modify, edit, or delete files outside of the active repository directory, except under `/tmp`.
|
|
29
34
|
- You MUST read `%%DOC_PATH%%/REQUIREMENTS.md`, but you MUST NOT modify it in this workflow.
|
|
30
35
|
- Treat static analysis as safe. Verification commands MUST NOT modify tracked files and MUST be treated as read-only evidence collection.
|
|
@@ -179,3 +184,9 @@ Create internally a *check-list* for the **Global Roadmap** including all the nu
|
|
|
179
184
|
|
|
180
185
|
<h2 id="users-request">User's Request</h2>
|
|
181
186
|
%%ARGS%%
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
## Context Files
|
|
190
|
+
The content under this section is pre-loaded reference material for this workflow, already present in full in your context. Treat it as authoritative ground truth and reason over it directly; do NOT re-read, search, locate, or fetch it with `read`, `search`, `files-search`, `grep`, `ls`, or any discovery tool. If this section contains no file content, treat it as empty and proceed without context-file assumptions.
|
|
191
|
+
|
|
192
|
+
%%CONTEXT_FILES%%
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Write a Software Requirements Specification using the project's source code"
|
|
3
|
-
argument-hint: "No arguments utilized by the prompt logic (English only)"
|
|
4
|
-
usage: >
|
|
5
|
-
Select this prompt when an implementation already exists under %%SRC_PATHS%% but %%DOC_PATH%%/REQUIREMENTS.md is missing or incomplete, and you need to bootstrap/update the SRS to reflect the code’s true current behavior (with evidence) BEFORE any SRS-driven change work. Output is only an updated SRS; source code, tests, %%DOC_PATH%%/WORKFLOW.md, and %%DOC_PATH%%/REFERENCES.md must remain unchanged. Do NOT select if you must draft the SRS from a user description without relying on code (use /req-write), if you must reorganize/renumber an existing SRS with an explicit old→new ID mapping (use /req-recreate), or if you intend to implement/fix/refactor anything (use /req-change, /req-new, /req-fix, /req-refactor, /req-cover, /req-implement).
|
|
6
|
-
---
|
|
7
|
-
|
|
8
1
|
# Write a Software Requirements Specification using the project's source code
|
|
9
2
|
|
|
10
3
|
## Purpose
|
|
@@ -21,8 +14,19 @@ In scope: static analysis of source under %%SRC_PATHS%% (and targeted tests only
|
|
|
21
14
|
- **Act as a Business Analyst** when verifying the "True State": ensure the draft accurately reflects implemented logic, including limitations or bugs.
|
|
22
15
|
|
|
23
16
|
|
|
17
|
+
## Iteration and Context Economy
|
|
18
|
+
- **CRITICAL**: Plan every Step to complete in the minimum number of iterations; batch independent reads, searches, and edits into a single response and dispatch parallel tool calls whenever no dependency forces sequencing.
|
|
19
|
+
- **CRITICAL**: MUST NOT re-read, re-search, or re-fetch any file already provided as injected `%%CONTEXT_FILES%%` context or already read in the current session; reuse prior tool-output evidence instead.
|
|
20
|
+
- **CRITICAL**: MUST NOT restate requirement text, prior tool output, or unchanged file contents into the context; cite them by file path, symbol, and line range, quoting only the minimal changed snippet.
|
|
21
|
+
- **CRITICAL**: MUST add only information required by the active Step, a requirement ID, or explicit user-request text; omit narration, filler, restatements, and speculative commentary.
|
|
22
|
+
- **CRITICAL**: MUST choose the most token-efficient evidence path in order: `%%DOC_PATH%%/REQUIREMENTS.md`, `%%DOC_PATH%%/WORKFLOW.md`, `%%DOC_PATH%%/REFERENCES.md`, then `search`/`files-search`, then `rg`/`grep` fallback, reading only targeted constructs and line ranges.
|
|
23
|
+
- **CRITICAL**: MUST gather all evidence a Step needs before producing its output and MUST NOT split a single logical operation across multiple iterations when one suffices.
|
|
24
|
+
- **CRITICAL**: MUST pause and wait for a tool response only when a Step explicitly depends on it; otherwise proceed autonomously to the next Step without requesting confirmation.
|
|
25
|
+
- **CRITICAL**: These rules MUST govern how the agent organizes and sequences the work described in the `## Steps` section.
|
|
26
|
+
|
|
27
|
+
|
|
24
28
|
## Absolute Rules, Non-Negotiable
|
|
25
|
-
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
29
|
+
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `git grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
26
30
|
- **CRITICAL**: NEVER write, modify, edit, or delete files outside of the project’s home directory, except under `/tmp`, where creating temporary files and writing outputs is allowed (the only permitted location outside the project).
|
|
27
31
|
- You can read, write, or edit `%%DOC_PATH%%/REQUIREMENTS.md`.
|
|
28
32
|
- Treat static analysis as safe. Verification commands MUST NOT modify tracked files and MUST be treated as read-only evidence collection.
|
|
@@ -103,3 +107,9 @@ Create internally a *check-list* for the **Global Roadmap** including all the nu
|
|
|
103
107
|
3. %%COMMIT%%
|
|
104
108
|
4. Present results
|
|
105
109
|
- PRINT, in the response, the results for a human reader using clear, easily understandable sentences and readable Markdown formatting that highlight key findings, file paths, and concise evidence. Use the fixed report schema: ## **Outcome**, ## **Requirement Delta**, ## **Design Delta**, ## **Implementation Delta**, ## **Verification Delta**, ## **Evidence**, ## **Assumptions**, ## **Next Workflow**. Final line MUST be exactly: STATUS: OK or STATUS: ERROR.
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
## Context Files
|
|
113
|
+
The content under this section is pre-loaded reference material for this workflow, already present in full in your context. Treat it as authoritative ground truth and reason over it directly; do NOT re-read, search, locate, or fetch it with `read`, `search`, `files-search`, `grep`, `ls`, or any discovery tool. If this section contains no file content, treat it as empty and proceed without context-file assumptions.
|
|
114
|
+
|
|
115
|
+
%%CONTEXT_FILES%%
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Fix a defect without changing the requirements"
|
|
3
|
-
argument-hint: "Description of the defect/bug to fix"
|
|
4
|
-
usage: >
|
|
5
|
-
Select this prompt when behavior is wrong relative to already-existing requirement IDs in %%DOC_PATH%%/REQUIREMENTS.md (a defect), and the intent is to restore compliance without changing the SRS. Use a test-first evidence-oriented flow when relevant unit-test suites exist, analyze defect -> create one failing reproducer unit test -> implement the smallest safe fix -> verify reproducer success with requirement evidence, static analysis, and conditional execution of existing unit tests via language-specific test-suite priority policy. Then update %%DOC_PATH%%/WORKFLOW.md and %%DOC_PATH%%/REFERENCES.md, and commit. Do NOT select if the requested outcome changes requirements/behavior (use /req-change or /req-new), if the goal is structural/performance improvement with no behavioral change (use /req-refactor), or if the primary task is satisfying a set of uncovered requirement IDs (use /req-cover or /req-implement).
|
|
6
|
-
---
|
|
7
|
-
|
|
8
1
|
# Fix a defect without changing the requirements
|
|
9
2
|
|
|
10
3
|
## Purpose
|
|
@@ -20,10 +13,22 @@ In scope: reproduce/triage the defect with concrete evidence and prefer an evide
|
|
|
20
13
|
- **Act as a Senior Software Developer** when implementing a defect fix: apply the smallest safe change that restores required behavior while preserving public interfaces.
|
|
21
14
|
- **Act as a Business Analyst** when reading `%%DOC_PATH%%/REQUIREMENTS.md` to ensure that fixes or refactors never violate or change existing documented behaviors.
|
|
22
15
|
- **Act as a QA Automation Engineer** when validating the fix/refactor: ensure that static-analysis results are clean (or no-source positive) and no regressions in documented behavior are introduced.
|
|
16
|
+
- **Act as an Expert GitOps Engineer** when executing git workflows.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Iteration and Context Economy
|
|
20
|
+
- **CRITICAL**: Plan every Step to complete in the minimum number of iterations; batch independent reads, searches, and edits into a single response and dispatch parallel tool calls whenever no dependency forces sequencing.
|
|
21
|
+
- **CRITICAL**: MUST NOT re-read, re-search, or re-fetch any file already provided as injected `%%CONTEXT_FILES%%` context or already read in the current session; reuse prior tool-output evidence instead.
|
|
22
|
+
- **CRITICAL**: MUST NOT restate requirement text, prior tool output, or unchanged file contents into the context; cite them by file path, symbol, and line range, quoting only the minimal changed snippet.
|
|
23
|
+
- **CRITICAL**: MUST add only information required by the active Step, a requirement ID, or explicit user-request text; omit narration, filler, restatements, and speculative commentary.
|
|
24
|
+
- **CRITICAL**: MUST choose the most token-efficient evidence path in order: `%%DOC_PATH%%/REQUIREMENTS.md`, `%%DOC_PATH%%/WORKFLOW.md`, `%%DOC_PATH%%/REFERENCES.md`, then `search`/`files-search`, then `rg`/`grep` fallback, reading only targeted constructs and line ranges.
|
|
25
|
+
- **CRITICAL**: MUST gather all evidence a Step needs before producing its output and MUST NOT split a single logical operation across multiple iterations when one suffices.
|
|
26
|
+
- **CRITICAL**: MUST pause and wait for a tool response only when a Step explicitly depends on it; otherwise proceed autonomously to the next Step without requesting confirmation.
|
|
27
|
+
- **CRITICAL**: These rules MUST govern how the agent organizes and sequences the work described in the `## Steps` section.
|
|
23
28
|
|
|
24
29
|
|
|
25
30
|
## Absolute Rules, Non-Negotiable
|
|
26
|
-
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
31
|
+
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `git grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
27
32
|
- **CRITICAL**: NEVER write, modify, edit, or delete files outside of the active repository directory, except under `/tmp`.
|
|
28
33
|
- You MUST read `%%DOC_PATH%%/REQUIREMENTS.md`, but you MUST NOT modify it in this workflow.
|
|
29
34
|
- Treat static analysis as safe. Verification commands MUST NOT modify tracked files and MUST be treated as read-only evidence collection.
|
|
@@ -130,7 +135,7 @@ Create internally a *check-list* for the **Global Roadmap** including all the nu
|
|
|
130
135
|
- **CRITICAL**: All tests MUST implement these instructions: `%%TEMPLATE_PATH%%/HDT_Test_Authoring_Guide.md`.
|
|
131
136
|
- Read %%GUIDELINES_FILES%% files and apply those **guidelines**; ensure the proposed code changes conform to those **guidelines**, and adjust the **Implementation Delta** if needed. Do not apply unrelated **guidelines**.
|
|
132
137
|
- A change is allowed ONLY if it corrects behavior that is: (a) explicitly required by `%%DOC_PATH%%/REQUIREMENTS.md` (cite requirement ID/section) OR (b) a defect with concrete evidence (crash, security flaw, data corruption, failure evidence, or incorrect output that contradicts a specific documented behavior). If the request implies new requirements or changing documented behavior, recommend `/req-new` or `/req-change`; before terminating, OUTPUT a Markdown table with exactly three columns in this order: `Requirement ID`, `Conflicting Excerpt`, `Conflict Reason + Interrupted Implementation Intent`; each row MUST map one conflicting requirement to the implementation-contrast rationale and intended interrupted modification; then OUTPUT exactly "ERROR: Defect fix failed due to incompatible requirements!", and then terminate the execution.
|
|
133
|
-
- Preferred execution order for Step
|
|
138
|
+
- Preferred execution order for Step 1 when relevant suites exist: analyze and identify defect -> create one failing reproducer unit test -> design and implement source fix -> verify reproducer and full selected suites.
|
|
134
139
|
- IMPLEMENT the **Implementation Delta** in the source code (creating new files/directories if necessary). You may make minimal mechanical adjustments needed to fit the actual codebase (file paths, symbol names), but you MUST NOT add new features or scope beyond the **Implementation Delta**.
|
|
135
140
|
2. Generate **Verification Delta** by verifying static-analysis results and implementing needed bug fixes
|
|
136
141
|
- Read `%%DOC_PATH%%/REQUIREMENTS.md` and cross-reference with the source code from %%SRC_PATHS%%, %%TEST_PATH%% to check ALL requirements, but use progressive disclosure: provide full evidence only for `FAIL` items and a compact pointer-only index for `OK` items. For each requirement, prefer the `search` and `files-search` tools to locate named symbols, declarations, constructs, and already-known files used as evidence. Use `rg` / `grep` only for supplementary free-text/body-content searches, fallback cases that construct extraction cannot express, or confirmation inside already targeted files. Read only the identified files to verify compliance and do not assume compliance without locating the specific code implementation.
|
|
@@ -140,9 +145,9 @@ Create internally a *check-list* for the **Global Roadmap** including all the nu
|
|
|
140
145
|
- Perform a static analysis check by executing the `static-check` tool.
|
|
141
146
|
- Review the produced output and fix every reported issue in source code.
|
|
142
147
|
- Re-run the `static-check` tool until it produces no issues. If output is exactly `Error: no source files found in configured directories.`, treat it as successful no-source completion and continue without retries.
|
|
143
|
-
- If relevant unit tests already exist in the repository, run them during verification using language-specific test-suite priority policy: project-defined test command first, language-default unit-test command second; if a reproducer unit test was created in Step
|
|
148
|
+
- If relevant unit tests already exist in the repository, run them during verification using language-specific test-suite priority policy: project-defined test command first, language-default unit-test command second; if a reproducer unit test was created in Step 1, require explicit evidence that it now passes; if no relevant tests exist, record test execution as N/A and continue.
|
|
144
149
|
- Verify that the implemented changes satisfy requirements evidence, static-analysis output, and unit-test outputs when tests are executed.
|
|
145
|
-
- For Step
|
|
150
|
+
- For Step 1, include before/after evidence that links the observed defect to the applied source fix.
|
|
146
151
|
- Provide explicit concrete verification evidence that the defect is resolved, using requirement evidence and static-analysis output.
|
|
147
152
|
- If static analysis reports issues or executed unit tests fail, analyze whether they are caused by source defects or requirement-implementation mismatch. Assume requirement evidence is authoritative; when static analysis reports issues, fix source code unless requirements explicitly justify alternative handling.
|
|
148
153
|
- Fix the source code to resolve valid verification findings autonomously without asking for user intervention. Execute a strict fix loop: 1) analyze static-check output and unit-test failures (when tests ran), 2) determine root cause from evidence, 3) fix code, 4) re-run the `static-check` tool and re-run the selected unit-test suites when applicable. Repeat up to 2 times. If static analysis still reports issues after the second attempt, report the failure, OUTPUT exactly "ERROR: Defect fix failed due to inability to complete static analysis!", and then terminate the execution.
|
|
@@ -181,3 +186,9 @@ Create internally a *check-list* for the **Global Roadmap** including all the nu
|
|
|
181
186
|
|
|
182
187
|
<h2 id="users-request">User's Request</h2>
|
|
183
188
|
%%ARGS%%
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
## Context Files
|
|
192
|
+
The content under this section is pre-loaded reference material for this workflow, already present in full in your context. Treat it as authoritative ground truth and reason over it directly; do NOT re-read, search, locate, or fetch it with `read`, `search`, `files-search`, `grep`, `ls`, or any discovery tool. If this section contains no file content, treat it as empty and proceed without context-file assumptions.
|
|
193
|
+
|
|
194
|
+
%%CONTEXT_FILES%%
|