fix: resolve unsubstituted placeholders in report prompt

Remove unused {{GITHUB_URL}} placeholder and wire up {{AUTH_CONTEXT}}
with structured auth context (login type, username, URL, MFA status).
This commit is contained in:
ezl-keygraph
2026-03-17 03:22:10 +05:30
parent b27fdac0f9
commit ea7c74f33b
2 changed files with 21 additions and 2 deletions
-1
View File
@@ -21,7 +21,6 @@ IMPORTANT: You are MODIFYING an existing file, not creating a new one.
<target>
URL: {{WEB_URL}}
Repository: {{GITHUB_URL}}
</target>
<context>
+21 -1
View File
@@ -123,6 +123,25 @@ async function processIncludes(content: string, baseDir: string): Promise<string
return content;
}
function buildAuthContext(config: DistributedConfig | null): string {
if (!config?.authentication) {
return 'No authentication configured - unauthenticated testing only';
}
const auth = config.authentication;
const lines = [
`- Login type: ${auth.login_type.toUpperCase()}`,
`- Username: ${auth.credentials.username}`,
`- Login URL: ${auth.login_url}`,
];
if (auth.credentials?.totp_secret) {
lines.push('- MFA: TOTP enabled');
}
return lines.join('\n');
}
// Pure function: Variable interpolation
async function interpolateVariables(
template: string,
@@ -147,7 +166,8 @@ async function interpolateVariables(
let result = template
.replace(/{{WEB_URL}}/g, variables.webUrl)
.replace(/{{REPO_PATH}}/g, variables.repoPath)
.replace(/{{MCP_SERVER}}/g, variables.MCP_SERVER || 'playwright-agent1');
.replace(/{{MCP_SERVER}}/g, variables.MCP_SERVER || 'playwright-agent1')
.replace(/{{AUTH_CONTEXT}}/g, buildAuthContext(config));
if (config) {
// Handle rules section - if both are empty, use cleaner messaging