@diegovelasquezweb/a11y-engine 0.8.0 → 0.8.1
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/package.json +1 -1
- package/src/ai/claude.mjs +2 -1
- package/src/ai/enrich.mjs +3 -0
- package/src/cli/audit.mjs +1 -0
package/package.json
CHANGED
package/src/ai/claude.mjs
CHANGED
|
@@ -192,6 +192,7 @@ export async function enrichWithAI(findings, context = {}, options = {}) {
|
|
|
192
192
|
if (!enabled) return findings;
|
|
193
193
|
|
|
194
194
|
const model = options.model || DEFAULT_MODEL;
|
|
195
|
+
const customSystemPrompt = options.systemPrompt || null;
|
|
195
196
|
|
|
196
197
|
// Only enrich Critical and Serious findings, cap total
|
|
197
198
|
const targets = findings
|
|
@@ -206,7 +207,7 @@ export async function enrichWithAI(findings, context = {}, options = {}) {
|
|
|
206
207
|
? await fetchSourceFilesForFindings(targets, context.repoUrl, options.githubToken)
|
|
207
208
|
: {};
|
|
208
209
|
|
|
209
|
-
const systemPrompt = buildSystemPrompt({
|
|
210
|
+
const systemPrompt = customSystemPrompt || buildSystemPrompt({
|
|
210
211
|
stack: context.stack,
|
|
211
212
|
hasSourceCode: Object.keys(sourceFiles).length > 0,
|
|
212
213
|
});
|
package/src/ai/enrich.mjs
CHANGED
|
@@ -40,10 +40,13 @@ async function main() {
|
|
|
40
40
|
|
|
41
41
|
log.info(`AI enrichment: processing up to 20 Critical/Serious findings...`);
|
|
42
42
|
|
|
43
|
+
const systemPrompt = process.env.AI_SYSTEM_PROMPT || null;
|
|
44
|
+
|
|
43
45
|
const enriched = await enrichWithAI(findings, { stack, repoUrl }, {
|
|
44
46
|
enabled: true,
|
|
45
47
|
apiKey,
|
|
46
48
|
githubToken,
|
|
49
|
+
...(systemPrompt ? { systemPrompt } : {}),
|
|
47
50
|
});
|
|
48
51
|
|
|
49
52
|
const enrichedWithFlag = enriched.map((f, i) => {
|
package/src/cli/audit.mjs
CHANGED
|
@@ -299,6 +299,7 @@ async function main() {
|
|
|
299
299
|
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
|
|
300
300
|
...(repoUrl ? { A11Y_REPO_URL: repoUrl } : {}),
|
|
301
301
|
...(githubToken ? { GH_TOKEN: githubToken } : {}),
|
|
302
|
+
...(process.env.AI_SYSTEM_PROMPT ? { AI_SYSTEM_PROMPT: process.env.AI_SYSTEM_PROMPT } : {}),
|
|
302
303
|
});
|
|
303
304
|
}
|
|
304
305
|
|