@diegovelasquezweb/a11y-engine 0.7.3 → 0.7.4

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.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "WCAG 2.2 accessibility audit engine — scanner, analyzer, and report builders",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/cli/audit.mjs CHANGED
@@ -143,6 +143,28 @@ async function main() {
143
143
  const repoUrl = getArgValue("repo-url");
144
144
  const githubToken = getArgValue("github-token");
145
145
 
146
+ let remotePackageJson = null;
147
+ let detectedFramework = null;
148
+ if (repoUrl) {
149
+ try {
150
+ const { fetchPackageJson } = await import("../core/github-api.mjs");
151
+ remotePackageJson = await fetchPackageJson(repoUrl, githubToken || undefined);
152
+ if (remotePackageJson) {
153
+ const { detectProjectContext } = await import("../pipeline/dom-scanner.mjs");
154
+ const ctx = detectProjectContext(null, remotePackageJson);
155
+ if (ctx.framework) {
156
+ detectedFramework = ctx.framework;
157
+ log.info(`Detected framework from repository: ${ctx.framework}`);
158
+ }
159
+ if (ctx.uiLibraries.length) {
160
+ log.info(`Detected UI libraries: ${ctx.uiLibraries.join(", ")}`);
161
+ }
162
+ }
163
+ } catch (err) {
164
+ log.warn(`Could not fetch package.json from repo: ${err.message}`);
165
+ }
166
+ }
167
+
146
168
  const sessionFile = getInternalPath("a11y-session.json");
147
169
  let projectDir = getArgValue("project-dir");
148
170
  if (projectDir) {
@@ -268,7 +290,8 @@ async function main() {
268
290
 
269
291
  const analyzerArgs = [];
270
292
  if (ignoreFindings) analyzerArgs.push("--ignore-findings", ignoreFindings);
271
- if (framework) analyzerArgs.push("--framework", framework);
293
+ const resolvedFramework = framework || detectedFramework;
294
+ if (resolvedFramework) analyzerArgs.push("--framework", resolvedFramework);
272
295
  await runScript("../enrichment/analyzer.mjs", analyzerArgs);
273
296
 
274
297
  if ((projectDir || repoUrl) && !skipPatterns) {
@@ -279,7 +302,7 @@ async function main() {
279
302
  patternArgs.push("--repo-url", repoUrl);
280
303
  if (githubToken) patternArgs.push("--github-token", githubToken);
281
304
  }
282
- let resolvedFramework = framework;
305
+ let resolvedFramework = framework || detectedFramework;
283
306
  if (!resolvedFramework) {
284
307
  try {
285
308
  const findings = JSON.parse(fs.readFileSync(getInternalPath("a11y-findings.json"), "utf-8"));
@@ -107,15 +107,7 @@ export function buildIssueCard(finding) {
107
107
  </div>`
108
108
  : "";
109
109
 
110
- const implNotesHtml = finding.fixDifficultyNotes
111
- ? `<div class="mt-4 pt-3 border-t border-indigo-100/50">
112
- <h4 class="text-[10px] font-black text-amber-700 uppercase tracking-widest mb-2 flex items-center gap-1.5">
113
- <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg>
114
- Implementation Notes
115
- </h4>
116
- <p class="text-[12px] text-amber-900/80 leading-relaxed bg-amber-50/60 border border-amber-100/60 rounded-lg p-3">${escapeHtml(finding.fixDifficultyNotes)}</p>
117
- </div>`
118
- : "";
110
+ const implNotesHtml = "";
119
111
 
120
112
  const problemPanelHtml = `
121
113
  <div class="grid grid-cols-1 gap-6">