@diegovelasquezweb/a11y-engine 0.11.24 → 0.11.26

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegovelasquezweb/a11y-engine",
3
- "version": "0.11.24",
3
+ "version": "0.11.26",
4
4
  "description": "WCAG 2.2 accessibility audit engine — scanner, analyzer, and report builders",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -201,7 +201,7 @@ function buildExecution(ruleId, intelligenceRule, finding) {
201
201
  };
202
202
  }
203
203
 
204
- function buildAiFixInput({ finding, intelligenceRule, execution, candidates }) {
204
+ function buildAiFixInput({ finding, intelligenceRule, execution, candidates, projectHints }) {
205
205
  return {
206
206
  finding: {
207
207
  id: finding.id,
@@ -223,6 +223,7 @@ function buildAiFixInput({ finding, intelligenceRule, execution, candidates }) {
223
223
  fixDifficultyNotes: intelligenceRule.fix_difficulty_notes || "",
224
224
  },
225
225
  execution,
226
+ projectContext: projectHints || "",
226
227
  files: candidates.map((c) => ({ filePath: c.rel, content: c.content.slice(0, 12000) })),
227
228
  };
228
229
  }
@@ -249,9 +250,9 @@ async function callClaudeForPatch({ apiKey, model, aiInput }) {
249
250
  const system = [
250
251
  "You are an accessibility fix engine.",
251
252
  "Return JSON only.",
252
- "Apply the fix described in finding.fixDescription and finding.fixCode.",
253
- "Follow all instructions in execution.constraints.must. Avoid all in execution.constraints.must_not.",
254
- "Use search/replace pairs on the provided files. For insertions (no existing element to replace), use the nearest parent element as the search anchor and prepend the new content in replace.",
253
+ "Generate deterministic text replacements for provided files.",
254
+ "Use finding.fixDescription and execution.constraints.must as guidance for what to fix and how.",
255
+ "For insertions (new element that does not yet exist in the file), use the nearest existing parent element as the search anchor. The replace value must include that anchor plus the new content.",
255
256
  "Do not create files. Do not modify paths outside provided filePath values.",
256
257
  "Schema:",
257
258
  "{\"changes\":[{\"filePath\":\"...\",\"search\":\"...\",\"replace\":\"...\"}],\"verifyRule\":\"...\",\"verifyRoute\":\"...\",\"notes\":\"...\"}",
@@ -362,6 +363,7 @@ export async function applyFindingFix(input) {
362
363
 
363
364
  const findingId = typeof input.findingId === "string" ? input.findingId.trim() : "";
364
365
  const projectDir = typeof input.projectDir === "string" ? input.projectDir.trim() : "";
366
+ const projectHints = typeof input.projectHints === "string" ? input.projectHints.trim() : "";
365
367
 
366
368
  if (!findingId || !projectDir) {
367
369
  return buildResult({
@@ -528,7 +530,7 @@ export async function applyFindingFix(input) {
528
530
  });
529
531
  }
530
532
 
531
- const aiInput = buildAiFixInput({ finding, intelligenceRule, execution, candidates });
533
+ const aiInput = buildAiFixInput({ finding, intelligenceRule, execution, candidates, projectHints });
532
534
  const candidateSet = new Set(candidates.map((c) => c.rel));
533
535
 
534
536
  let patchOutput = null;