fix(cli): match managed prompt files by exact path

This commit is contained in:
Tam Nhu Tran
2026-04-13 08:39:59 -04:00
parent 45c231a717
commit 7fc39f7c03
7 changed files with 135 additions and 57 deletions
+3 -13
View File
@@ -7,8 +7,8 @@
import {
buildSteeringArg,
hasManagedPromptFileArg,
PROMPT_FLAG_INLINE,
PROMPT_FLAG_FILE,
} from '../prompt-injection-strategy';
const IMAGE_ANALYSIS_STEERING_PROMPT = {
@@ -41,9 +41,8 @@ function hasExactFlagValue(params: {
args: string[];
flag: string;
expectedValue: string;
allowPartiallyMatch?: boolean;
}): boolean {
const { args, flag, expectedValue, allowPartiallyMatch } = params;
const { args, flag, expectedValue } = params;
for (let index = 0; index < args.length; index += 1) {
const arg = args[index];
@@ -55,10 +54,6 @@ function hasExactFlagValue(params: {
return true;
}
if (allowPartiallyMatch && value?.includes(expectedValue)) {
return true;
}
continue;
}
@@ -88,12 +83,7 @@ function ensureImageAnalysisSteeringPrompt(args: string[]): string[] {
}
if (
hasExactFlagValue({
args: optionArgs,
flag: PROMPT_FLAG_FILE,
expectedValue: IMAGE_ANALYSIS_STEERING_PROMPT.name,
allowPartiallyMatch: true,
})
hasManagedPromptFileArg({ args: optionArgs, promptName: IMAGE_ANALYSIS_STEERING_PROMPT.name })
) {
return args;
}