@webability/cli 1.3.0 → 1.3.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/dist/cli.js +10 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var $e=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof require<"u"?require:t)[o]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});import{readFileSync as Qe}from"fs";import{fileURLToPath as Ze}from"url";import{dirname as et,join as tt}from"path";import{basename as Fe}from"path";var Ee=Fe(process.argv[1]??""),c=Ee==="abilyo"?"abilyo":"webability";import{Command as ot}from"commander";import i from"chalk";import P from"ora";var Ie="https://api.webability.io";async function Ne(e,t={},o){let s=await fetch(`${Ie}${e}`,{...t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`,Origin:"https://app.webability.io",...t.headers}});if(!s.ok){let n=await s.text().catch(()=>"");throw new Error(`API ${s.status}: ${n.slice(0,200)}`)}return s.json()}async function j(e,t,o){let s=await Ne("/graphql",{method:"POST",body:JSON.stringify({query:e,variables:t})},o);if(s.errors?.length)throw new Error(s.errors[0].message);return s.data}async function se(e,t,o){o?.("Starting scan...");let{startAccessibilityReportJob:s}=await j("query($url: String!) { startAccessibilityReportJob(url: $url, use_cache: false) { jobId } }",{url:e},t),n=s.jobId;o?.(`Job ${n.slice(0,8)}... created`);for(let a=0;a<60;a++){await new Promise(r=>setTimeout(r,3e3));let{getAccessibilityReportByJobId:l}=await j("query($jobId: String!) { getAccessibilityReportByJobId(jobId: $jobId) { status error result { savedReport { key } } } }",{jobId:n},t);if(l.status==="done")return{key:l.result.savedReport.key};if(l.status==="error")throw new Error(l.error||"Scan failed");o?.(`Scanning... (${(a+1)*3}s)`)}throw new Error("Scan timed out after 3 minutes")}async function ie(e,t){let{fetchReportByR2Key:o}=await j("query($key: String!) { fetchReportByR2Key(r2_key: $key) { score totalElements siteImg ByFunctions { name count issues { code impact description element } } axe { violations { id impact description nodes { html target } } } } }",{key:e},t);return o}import Re from"conf";var R=new Re({projectName:"webability",schema:{apiKey:{type:"string",default:""},accessCode:{type:"string",default:""},defaultFormat:{type:"string",default:"table",enum:["table","json","csv"]}}});function A(){return process.env.WEBABILITY_API_KEY||R.get("apiKey")||""}function W(e){R.set("apiKey",e)}function Be(){return R.get("accessCode")||""}function q(e){R.set("accessCode",e)}function ne(){return!!Be()||!!A()}function ae(){R.clear()}import{scan as Me,detectFramework as Pe,generateDevSuggestion as Le}from"@webability/core";var De={weak_link_name:"Screen-reader users navigate by pulling up a links list (VoiceOver Rotor / NVDA Insert+F7). They hear: 'Learn more, Learn more, Learn more' \u2014 every link sounds identical. They can't tell where each goes without context.",weak_button_name:"Same problem as weak links \u2014 assistive tech announces 'Submit' or 'Click here' with no context, so users can't tell what each button does.",missing_alt:`Screen readers say 'image' (or skip it entirely) when there's no alt text. A photo of your CEO becomes 'image, image' to a blind user. Decorative images need alt="" so they're skipped intentionally.`,decorative_icon:"Decorative icons next to labelled text get announced twice: 'home icon, Home'. Wastes the user's time and creates audio clutter.",missing_label:"Form inputs without labels are invisible to screen readers \u2014 users hear 'edit text' with no idea what to type. They abandon the form.",contrast_insufficient:"Low-contrast text excludes users with low vision (1 in 12 men have some color-blindness). It's also unreadable on glare-prone screens, in sunlight, and for older eyes.",non_text_contrast_insufficient:"If a button's border or icon doesn't have 3:1 contrast against its background, low-vision users can't see the boundary or recognize the icon at all.",target_too_small:"Touch targets under 24\xD724px are hard to hit accurately for users with motor impairments (Parkinson's, MS, arthritis). Mis-taps trigger wrong actions and frustrate keyboard-only users too.",missing_skip_link:"Keyboard and screen-reader users have to Tab through your entire header (logo, nav, CTAs) on every single page. A skip link lets them jump straight to main content \u2014 a 30-second fix that saves disabled users minutes of navigation per visit.",motion_without_reduced_motion:"Vestibular disorders (~35% of adults over 40) can be triggered by parallax, auto-rotation, and rapid animations \u2014 causing nausea, dizziness, and migraines. Respecting prefers-reduced-motion is non-optional.",heading_skip:"Screen-reader users navigate by heading hierarchy \u2014 they jump h1 \u2192 h2 \u2192 h3 to scan structure. Skipping levels (h2 \u2192 h4) makes the page feel disorganized and content gets missed.",multiple_h1:"Multiple h1 elements confuse the page structure model that screen readers and SEO tools use. Each page should have exactly one h1 \u2014 the page title.",redundant_role:`Adding role="navigation" to a <nav> element is redundant \u2014 screen readers already know it's navigation. Redundant ARIA can cause double-announcements.`,duplicate_id:"Duplicate IDs break aria-labelledby, aria-describedby, and label[for] references \u2014 screen readers may read the wrong content or none at all.",missing_required_indicator:"If users don't know a field is required until they submit, they miss the requirement (especially screen-reader users who skip placeholder text). They get an error after the fact and have to re-enter data.",new_window_link:"Opening links in a new tab without warning disorients screen-reader users \u2014 they think the back button is broken. WCAG requires you announce 'opens in new tab' via aria-label or visible text.",color_only_meaning:"Using only color to indicate state (red = error, green = success) excludes the ~8% of men who are color-blind. Always pair color with an icon, label, or pattern.",insufficient_navigation:"Inconsistent nav across pages forces users to relearn the structure on every page. Especially hard on cognitive disabilities and screen-reader users who memorize tab order.",focus_not_visible:"Without a visible focus ring, keyboard users have no idea which element is selected. Tabbing through your site becomes guesswork \u2014 they hit Enter and trigger the wrong action.",aria_hidden_focusable:`An element with aria-hidden="true" but tabindex="0" creates a 'ghost' focus stop \u2014 keyboard users can focus it but screen readers don't announce it. They press Enter on something invisible to them.`,svg_missing_name:"SVG icons that convey meaning (warning triangle, X close button) need an accessible name. Without it, blind users hear 'graphic' or nothing at all."};function Te(e){return De[e.type]||""}var re={A:["wcag2a"],AA:["wcag2a","wcag2aa","wcag21aa","wcag22aa"],AAA:["wcag2a","wcag2aa","wcag2aaa","wcag21aa","wcag22aa"]},Oe={critical:"#ef4444",serious:"#f97316",moderate:"#eab308",minor:"#6b7280"},_e={critical:"\u2717",serious:"\u25B2",moderate:"\u25CF",minor:"\u25CB"};function ze(e,t,o){let s=o||"plain-css";return`
|
|
3
3
|
(function() {
|
|
4
|
-
const issues = ${JSON.stringify(e.map((a,
|
|
5
|
-
const colors = ${JSON.stringify(
|
|
6
|
-
const icons = ${JSON.stringify(
|
|
4
|
+
const issues = ${JSON.stringify(e.map((a,l)=>{let r=(()=>{try{return Le(a,s)}catch{return null}})();return{id:l,selector:a.selector,impact:a.impact,wcag:a.wcag,type:a.type,message:a.message.slice(0,200),problem:r?.problem||"",recommendedFix:r?.fix||"",wcagLink:r?.wcagLink||`https://www.w3.org/WAI/WCAG21/Understanding/${a.wcag.replace(/\./g,"")}`,whyMatters:Te(a),fixDesc:a.fix?.suggestedValue?`Set ${a.fix.attribute}="${a.fix.suggestedValue}"`:"",fixAttr:a.fix?.attribute||"",fixVal:a.fix?.suggestedValue||"",fixCur:a.fix?.currentValue||"",canApply:!!(a.fix?.suggestedValue&&!a.fix?.needsManualReview)}}))};
|
|
5
|
+
const colors = ${JSON.stringify(Oe)};
|
|
6
|
+
const icons = ${JSON.stringify(_e)};
|
|
7
7
|
const API_KEY = ${JSON.stringify(t||"")};
|
|
8
8
|
const API_URL = 'https://api.webability.io';
|
|
9
9
|
const FRAMEWORK = ${JSON.stringify(o||"plain-css")};
|
|
@@ -697,7 +697,7 @@ var Fe=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(
|
|
|
697
697
|
|
|
698
698
|
renderList();
|
|
699
699
|
})();
|
|
700
|
-
`}async function
|
|
700
|
+
`}async function le(e,t){let o=re[t.wcag.toUpperCase()]??re.AA,s=["mobile","tablet","desktop"].includes(t.viewport??"")?t.viewport:"desktop",a=await(await import("playwright")).chromium.launch({headless:!t.show,ignoreDefaultArgs:t.show?["--enable-automation"]:void 0,args:t.show?["--disable-blink-features=AutomationControlled","--no-default-browser-check","--disable-infobars","--no-first-run","--silent-launch","--disable-features=DialMediaRouteProvider"]:void 0}),r=await(await a.newContext({viewport:s==="mobile"?{width:390,height:844}:s==="tablet"?{width:820,height:1180}:{width:1280,height:720}})).newPage(),p=e.startsWith("http")?e:`https://${e}`;await r.goto(p,{waitUntil:"domcontentloaded",timeout:3e4});let g=await Pe(r),f=await Me(r,{wcagTags:o,includeAxe:t.includeAxe??!0,dismissModals:!0,deep:t.deep,deepApiUrl:t.deep?"https://api.webability.io":void 0,deepApiKey:t.deep?t.apiKey:void 0});return t.show&&f.issues.length>0?(await r.evaluate(ze(f.issues,t.apiKey,g.framework)),await r.evaluate(()=>window.scrollTo(0,0)),{...f,framework:g.framework,_browser:a}):(await a.close(),{...f,framework:g.framework})}async function V(e){e._browser&&(await e._browser.close(),delete e._browser)}import{scan as je,detectFramework as We}from"@webability/core";var ce={A:["wcag2a"],AA:["wcag2a","wcag2aa","wcag21aa","wcag22aa"],AAA:["wcag2a","wcag2aa","wcag2aaa","wcag21aa","wcag22aa"]};async function de(e,t={}){let o=ce[(t.wcag||"AA").toUpperCase()]??ce.AA,s=e.startsWith("http")?e:`https://${e}`,n=Date.now(),l=await(await import("playwright")).chromium.launch({headless:!1}),p=await(await l.newContext({viewport:{width:1280,height:720}})).newPage(),g=[],f="plain-css",d=!1,k=!1,x=new Set,$=async()=>{if(d){k=!0;return}d=!0;try{await p.waitForLoadState("domcontentloaded",{timeout:5e3}).catch(()=>{}),await p.waitForTimeout(800);let m=p.url();if(x.has(m)){d=!1;return}x.add(m),(!f||f==="plain-css")&&(f=(await We(p).catch(()=>({framework:"plain-css"}))).framework);let w=await je(p,{wcagTags:o,includeAxe:!0,dismissModals:!1});g.push({url:m,issues:w.issues,scannedAt:new Date().toISOString()}),t.onPageScan?.(m,w.issues.length)}catch{}finally{d=!1,k&&(k=!1,setTimeout($,100))}};p.on("framenavigated",m=>{m===p.mainFrame()&&setTimeout($,600)}),await p.goto(s,{waitUntil:"domcontentloaded",timeout:3e4}),await new Promise(m=>{l.on("disconnected",()=>m()),process.once("SIGINT",()=>m())}),await l.close().catch(()=>{});let z=new Map;for(let m of g)for(let w of m.issues){let E=`${w.type}::${w.selector}::${w.wcag}`,C=z.get(E);C?C.foundOn.includes(m.url)||(C.foundOn.push(m.url),C.pageCount=C.foundOn.length):z.set(E,{...w,foundOn:[m.url],pageCount:1})}return{pages:g,uniqueIssues:Array.from(z.values()).sort((m,w)=>{let E={critical:0,serious:1,moderate:2,minor:3},C=E[m.impact]??2,oe=E[w.impact]??2;return C!==oe?C-oe:w.pageCount-m.pageCount}),framework:f,totalDuration:Date.now()-n}}import{writeFileSync as qe,existsSync as Ve}from"fs";import K from"chalk";var Ke=`project: my-project
|
|
701
701
|
urls:
|
|
702
702
|
- http://localhost:3000
|
|
703
703
|
standard: WCAG2.1AA
|
|
@@ -706,8 +706,8 @@ ignore: []
|
|
|
706
706
|
threshold:
|
|
707
707
|
critical: 0
|
|
708
708
|
serious: 5
|
|
709
|
-
`;function
|
|
710
|
-
`,{mode:384}),
|
|
711
|
-
`,{mode:384}),
|
|
712
|
-
`)[0],"Check the URL loads in a browser, then run the scan again."),process.exit(1)}});async function
|
|
713
|
-
`)[0],`Check the URL loads in a browser, then run \`${c} flow\` again.`),process.exit(1)}console.log(),console.log(i.bold(" \u2500\u2500\u2500 Flow Report \u2500\u2500\u2500")),console.log(),console.log(` Pages scanned: ${i.cyan(s.pages.length)}`),console.log(` Unique issues: ${i.cyan(s.uniqueIssues.length)}`),console.log(` Total duration: ${i.dim((s.totalDuration/1e3).toFixed(1)+"s")}`),console.log();let n={critical:0,serious:0,moderate:0,minor:0};s.uniqueIssues.forEach(r=>{n[r.impact]++}),D({...n,total:s.uniqueIssues.length});let a=s.uniqueIssues.slice(0,15);for(let r of a){let l=r.pageCount>1?i.yellow(` \xD7${r.pageCount} pages`):"";if(O({severity:r.impact,wcag:r.wcag,problem:r.message,fix:r.fix?.suggestedValue?`Set ${r.fix.attribute}="${r.fix.suggestedValue}"`:"Review this issue",selector:r.selector}),r.pageCount>1){console.log(i.dim(` Found on${l}:`));for(let p of r.foundOn.slice(0,3))console.log(i.dim(" "+p.replace(/^https?:\/\//,"")))}}s.uniqueIssues.length>15&&console.log(i.dim(` ... +${s.uniqueIssues.length-15} more unique issues`)),console.log(),_({hasIssues:s.uniqueIssues.length>0,url:e.replace("https://","")})});x.command("init").description("Create .webability.yml config file").action(()=>{f(),ue(),console.log()});x.command("login").description("Authenticate with your WebAbility account").option("-k, --key <key>","API key directly (for CI/CD)").action(async e=>{if(f(),e.key){q(e.key),console.log(i.green(" \u2713 API key saved.")),console.log(),te(L(e.key)),await oe(e.key);return}let t=B({text:"Starting login...",prefixText:" "}).start();try{let o=await fetch("https://api.webability.io/cli/device-code",{method:"POST",headers:{"Content-Type":"application/json"}});if(!o.ok)return t.fail(`Could not start login (server returned ${o.status}).`),console.log(i.dim(` Try again in a moment: \`${c} login\``)),console.log(i.dim(" Still stuck? support@webability.io")),console.log(),process.exit(1);let{deviceCode:s,userCode:n,verificationUrl:a,expiresIn:r}=await o.json();t.stop(),console.log(` ${i.bold("Login to WebAbility")}`),console.log(),console.log(` Open: ${i.cyan(a)}`),console.log(` Code: ${i.bold.yellow(n)}`),console.log(),Se(a);let l=B({text:"Waiting for approval...",prefixText:" "}).start(),p=3e3,g=Math.floor((r||300)*1e3/p);for(let h=0;h<g;h++){await new Promise(d=>setTimeout(d,p));try{let d=await fetch("https://api.webability.io/cli/device-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:s})});if(d.ok){let{token:w}=await d.json();q(w),l.succeed("Logged in."),console.log(),te(L(w)),await oe(w);return}if((await d.json().catch(()=>({}))).error==="expired")return l.fail(`Login expired. Run \`${c} login\` again.`),process.exit(1)}catch{}}l.fail("Login timed out."),process.exit(1)}catch{return t.fail("Could not reach api.webability.io."),console.log(i.dim(` Check your connection, then run \`${c} login\` again.`)),console.log(),process.exit(1)}});var z=i.dim(" "+"\u2500".repeat(58)),at=["scan webability.io and list the critical issues","fix the colour-contrast failures on this page","check this component for keyboard traps","is this form accessible to a screen reader?"];function te(e){let t=e.filter(o=>o.ok);if(!t.length){console.log(i.yellow(" No supported editor found for automatic setup.")),console.log(` Install Claude Code or Cursor, then run ${i.cyan(`${c} mcp install`)}.`),console.log(i.dim(` Any other MCP client: ${i.cyan(`${c} mcp print`)} gives you the config block.`)),console.log();for(let o of e.filter(s=>!s.ok))console.log(i.dim(` \u26A0 ${o.client}: ${o.detail}`));e.some(o=>!o.ok)&&console.log();return}console.log(z),console.log(i.bold(" Abilyo is now inside your editor")),console.log();for(let o of t)console.log(` ${i.green("\u2713")} ${o.detail}`);console.log(),console.log(i.dim(" Restart the editor, then ask it:"));for(let o of at)console.log(` ${i.cyan(`"${o}"`)}`);console.log(z),console.log();for(let o of e.filter(s=>!s.ok))console.log(i.dim(` \u26A0 ${o.client}: ${o.detail}`))}async function oe(e){let t="free",o="";try{let s=await fetch("https://api.webability.io/cli/verify",{headers:{Authorization:`Bearer ${e}`}});if(s.ok){let n=await s.json();t=n.plan||"free",o=n.email||""}}catch{}if(t==="pro"){console.log(` ${i.green("\u2726 Abilyo Pro")}${o?i.dim(` \u2014 ${o}`):""}`),console.log(i.dim(" Deep scans, AI fixes and unlimited MCP calls are unlocked.")),console.log();return}console.log(z),console.log(` ${i.yellow("You are on Free.")} Free finds the issues. ${i.bold("Pro fixes them.")}`),console.log(),console.log(` ${i.cyan(`${c} scan --deep`)} dynamic content, focus order, keyboard traps`),console.log(` ${i.cyan("AI fixes")} real code edits in your editor, not a to-do list`),console.log(` ${i.cyan("CI reports")} SARIF + HTML, unlimited MCP calls`),console.log(),console.log(` Upgrade in under a minute: ${i.bold.cyan(`${c} upgrade`)}`),console.log(z),console.log()}function Se(e){try{let{execFile:t}=Fe("child_process"),o=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";t(o,[e],()=>{})}catch{}}var $e=x.command("mcp").description("Connect Abilyo to your AI editor (Claude Code, Cursor)");$e.command("install").description("Register the Abilyo MCP server with every editor found").option("-c, --client <client>","Only one client: claude, cursor").action(e=>{f();let t=C();if(!t)return b(`Not logged in. Run \`${c} login\` \u2014 it connects your editor for you.`),process.exit(1);if(e.client&&e.client!=="claude"&&e.client!=="cursor")return b(`Unknown client "${e.client}". Use claude or cursor.`),process.exit(1);te(L(t,e.client))});$e.command("print").description("Print the MCP config block (contains your token \u2014 do not share)").action(()=>{let e=C();if(!e)return f(),b(`Not logged in. Run \`${c} login\` first.`),process.exit(1);console.log(JSON.stringify({mcpServers:{[y]:Y(e)}},null,2))});x.command("upgrade").description("Upgrade to Abilyo Pro \u2014 deep scans and AI fixes").action(async()=>{f();let e=C();if(!e)return b(`Log in first: \`${c} login\``),process.exit(1);let t=B({text:"Opening checkout...",prefixText:" "}).start();try{let o=await fetch("https://api.webability.io/cli/checkout",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({returnUrl:"https://abilyo.com"})});if(!o.ok)return t.fail(`Could not start checkout (server returned ${o.status}).`),console.log(i.dim(" Upgrade in the browser instead: https://webability.io/pricing")),console.log(),process.exit(1);let{url:s}=await o.json();t.succeed("Checkout ready \u2014 opening your browser."),console.log(),console.log(` ${i.cyan(s)}`),console.log(),Se(s)}catch{return t.fail("Could not reach api.webability.io."),console.log(i.dim(" Upgrade in the browser instead: https://webability.io/pricing")),console.log(),process.exit(1)}});x.command("whoami").description("Show auth status and plan").action(async()=>{let e=C();if(f(),!e){console.log(i.yellow(" Not signed in.")),console.log(` Run ${i.cyan(`${c} login`)} \u2014 it signs you in and connects your editor.`),console.log();return}console.log(i.green(" Signed in")),console.log(i.dim(` Key: ${e.slice(0,12)}\u2026`)),console.log(),await oe(e)});x.command("logout").description("Remove saved API key and disconnect editors").action(()=>{let e=we();re(),f(),console.log(i.green(" Logged out. API key removed."));for(let t of e)console.log(t.ok?i.dim(` Disconnected ${t.detail}`):i.yellow(` ${t.detail}`));console.log(i.dim(` Sign back in any time: \`${c} login\``)),console.log()});x.command("activate <code>").description("Activate Abilyo with your early access code").action(async e=>{f();let t=B({text:"Validating access code...",prefixText:" "}).start();try{if((await fetch("https://api.webability.io/cli/activate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e.trim()})})).ok){V(e.trim()),t.succeed("Abilyo activated."),console.log(),console.log(` Next: ${i.cyan(`${c} scan <url>`)} ${i.dim("\u2014 your first scan takes seconds")}`),console.log();return}}catch{}e.trim().length>=8?(V(e.trim()),t.succeed("Abilyo activated."),console.log(),console.log(` Next: ${i.cyan(`${c} scan <url>`)} ${i.dim("\u2014 your first scan takes seconds")}`),console.log()):(t.fail("Invalid access code."),console.log(i.dim(" Request access at https://abilyo.com")),console.log(),process.exit(1))});x.argument("[url]","URL to scan").action(e=>{e?x.parse(["node",c,"scan",e,...process.argv.slice(3)]):(f(),ae()?(console.log(i.bold(" Commands:")),console.log(),console.log(` ${i.cyan(`${c} scan`)} <url> Scan a page for accessibility issues`),console.log(` ${i.cyan(`${c} scan --deep`)} <url> Dynamic content, focus order, keyboard traps ${i.dim("(Pro)")}`),console.log(` ${i.cyan(`${c} scan --exit`)} <url> CI mode \u2014 exit 1 if issues found`),console.log(` ${i.cyan(`${c} flow`)} <url> Scan a whole journey, one report`),console.log(` ${i.cyan(`${c} login`)} Sign in and connect your AI editor`),console.log(` ${i.cyan(`${c} mcp install`)} Re-connect Claude Code / Cursor`),console.log(` ${i.cyan(`${c} init`)} Create .webability.yml config`),console.log(` ${i.cyan(`${c} whoami`)} Show auth status and plan`),console.log(` ${i.cyan(`${c} upgrade`)} Unlock deep scans + AI fixes ${i.dim("(Pro)")}`),console.log(),console.log(i.bold(" Examples:")),console.log(),console.log(i.dim(` ${c} scan localhost:3000 your dev server`)),console.log(i.dim(` ${c} scan example.com --show highlight issues in a browser`)),console.log(i.dim(` ${c} scan example.com --format sarif upload to GitHub code scanning`)),console.log(i.dim(` ${c} scan example.com --exit fail the build on issues`)),console.log(i.dim(` ${c} scan example.com --deep the checks axe-core cannot do`)),console.log(),console.log(i.dim(` In your editor, after \`${c} login\`:`)),console.log(i.dim(' "scan staging.example.com and fix the contrast failures"'))):(console.log(i.yellow(" Abilyo is invite-only during early access.")),console.log(),console.log(` ${i.cyan(`${c} login`)} Already have a WebAbility account? Start here`),console.log(` ${i.cyan(`${c} activate`)} <code> Activate with an early-access code`),console.log(),console.log(i.dim(" Request access at https://abilyo.com"))),console.log())});x.parse();function rt(e){let t=new Map;for(let s of e.issues)t.has(s.type)||t.set(s.type,{id:s.type,shortDescription:{text:s.message}});let o=e.engineWarnings??[];return{$schema:"https://json.schemastore.org/sarif-2.1.0.json",version:"2.1.0",runs:[{...o.length?{invocations:[{executionSuccessful:!0,toolExecutionNotifications:o.map(s=>({level:"warning",message:{text:s}}))}]}:{},tool:{driver:{name:"WebAbility",version:Ae.version,informationUri:"https://webability.io",rules:Array.from(t.values())}},results:e.issues.map(s=>{let a={startLine:Number.isInteger(s.line)&&s.line>0?s.line:1,snippet:{text:s.html||s.selector}};return Number.isInteger(s.column)&&s.column>0&&(a.startColumn=s.column),{ruleId:s.type,level:s.impact==="critical"||s.impact==="serious"?"error":"warning",message:{text:s.message},locations:[{physicalLocation:{artifactLocation:{uri:e.url},region:a}}]}})}]}}
|
|
709
|
+
`;function pe(){let e=".webability.yml";if(Ve(e)){console.log(K.yellow(` ${e} already exists`));return}qe(e,Ke),console.log(K.green(` Created ${e}`)),console.log(K.dim(" Edit it to configure your project URLs and thresholds"))}import{execFileSync as B}from"child_process";import{chmodSync as me,existsSync as U,mkdirSync as Ue,readFileSync as fe,writeFileSync as he}from"fs";import{homedir as G}from"os";import{dirname as Ge,join as J}from"path";var h="webability",I="https://mcp.webability.io/mcp",be="x-webability-token";function H(e){return{url:I,headers:{[be]:e}}}function Y(){let e=process.platform==="win32"?["claude.cmd","claude"]:["claude"];for(let t of e)try{return B(t,["--version"],{stdio:"ignore"}),t}catch{}return null}function Je(){return Y()!==null}function ye(e){try{return B(e,["mcp","get",h],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]})}catch{return null}}function He(){return U(J(G(),".cursor"))}function ue(e){let t=Y();if(!t)return{client:"claude",ok:!1,detail:"Claude Code CLI not found on PATH"};try{let o=ye(t);if(o!==null&&!o.includes(I))return{client:"claude",ok:!1,detail:`Claude Code already has an MCP server named "${h}" that isn't ours \u2014 left untouched. Remove it (claude mcp remove -s user ${h}) and re-run \`${c} mcp install\` to switch to the hosted server.`};if(o!==null)try{B(t,["mcp","remove","-s","user",h],{stdio:"ignore"})}catch{}return B(t,["mcp","add","-s","user","--transport","http",h,I,"--header",`${be}: ${e}`],{stdio:"ignore"}),{client:"claude",ok:!0,detail:"Claude Code"}}catch(o){return{client:"claude",ok:!1,detail:`claude mcp add failed: ${o.message}`}}}function ge(e){let t=J(G(),".cursor","mcp.json");try{let o={};if(U(t)){let n=fe(t,"utf-8").trim();n&&(o=JSON.parse(n))}let s=(o.mcpServers||{})[h];return s&&s.url!==I?{client:"cursor",ok:!1,detail:`~/.cursor/mcp.json already has an MCP server named "${h}" that isn't ours \u2014 left untouched. Remove that entry and re-run \`${c} mcp install\` to switch to the hosted server.`}:(o.mcpServers={...o.mcpServers||{},[h]:H(e)},Ue(Ge(t),{recursive:!0}),he(t,`${JSON.stringify(o,null,2)}
|
|
710
|
+
`,{mode:384}),me(t,384),{client:"cursor",ok:!0,detail:"Cursor (~/.cursor/mcp.json)"})}catch(o){return{client:"cursor",ok:!1,detail:`could not write ${t}: ${o.message}`}}}function xe(){let e=[],t=Y();if(t){let s=ye(t);if(s!==null)if(!s.includes(I))e.push({client:"claude",ok:!1,detail:`left "${h}" in Claude Code alone \u2014 it isn't ours`});else try{B(t,["mcp","remove","-s","user",h],{stdio:"ignore"}),e.push({client:"claude",ok:!0,detail:"Claude Code"})}catch(n){e.push({client:"claude",ok:!1,detail:`claude mcp remove failed: ${n.message}`})}}let o=J(G(),".cursor","mcp.json");if(U(o))try{let s=fe(o,"utf-8").trim(),n=s?JSON.parse(s):{},a=n.mcpServers?.[h];a&&a.url===I?(delete n.mcpServers[h],he(o,`${JSON.stringify(n,null,2)}
|
|
711
|
+
`,{mode:384}),me(o,384),e.push({client:"cursor",ok:!0,detail:"Cursor (~/.cursor/mcp.json)"})):a&&e.push({client:"cursor",ok:!1,detail:`left "${h}" in ~/.cursor/mcp.json alone \u2014 it isn't ours`})}catch(s){e.push({client:"cursor",ok:!1,detail:`could not update ${o}: ${s.message}`})}return e}function L(e,t){if(t==="claude")return[ue(e)];if(t==="cursor")return[ge(e)];let o=[];return Je()&&o.push(ue(e)),He()&&o.push(ge(e)),o}import S from"chalk";var u=S.dim,we=S.bold,X=S.blue,D=S.green,N=S.red,F=S.yellow,M=S.cyan,Ye=S.white;function b(){console.log(),console.log(` ${X("\u25C6")} ${we("Abilyo")} ${u("WCAG Scanner")}`),console.log()}function Q(e,t){let o=e>=80?D:e>=50?F:N,s=e>=80?D("\u2713"):e>=50?F("\u26A0"):N("\u2717"),n=e>=80?"Passing":e>=50?"Needs work":"Failing";console.log(` ${u("URL")} ${Ye(t)}`),console.log(` ${u("Score")} ${o.bold(e+"%")} ${s} ${u(n)}`),console.log(` ${u(" ")}${Xe(e)}`),console.log()}function Xe(e){let o=Math.round(e/100*32),s=32-o;return(e>=80?D:e>=50?F:N)("\u2501".repeat(o))+u("\u2501".repeat(s))}function T(e){let t=[];e.critical>0&&t.push(N.bold(`${e.critical} critical`)),e.serious>0&&t.push(F(`${e.serious} serious`)),e.moderate>0&&t.push(u(`${e.moderate} moderate`)),e.minor>0&&t.push(u(`${e.minor} minor`)),console.log(` ${we(String(e.total))} issues ${t.join(u(" \xB7 "))}`),console.log()}function O(e){let t=e.severity==="critical"?N("\u2717"):e.severity==="serious"?F("\u25B2"):u("\u25CF"),o=u(`${e.wcag}`),s=e.count&&e.count>1?` \xD7${e.count}`:"",n=s?u(s):"",a=80-(6+e.wcag.length+s.length);if(console.log(` ${t} ${o}${n} ${e.problem.slice(0,a)}`),e.contrast?(console.log(` ${M("fix")} ${e.fix.slice(0,70)}`),console.log(` ${u(`${e.contrast.current}:1 \u2192 ${e.contrast.suggested}:1 (min ${e.contrast.required}:1)`)}`)):e.before&&e.after?console.log(` ${M("fix")} ${u(e.before)} ${u("\u2192")} ${D(e.after)}`):console.log(` ${M("fix")} ${e.fix.slice(0,70)}`),e.html&&e.count===1){let l=e.html.slice(0,60).replace(/\n/g," ");console.log(` ${u(l)}`)}if(e.selectors&&e.selectors.length>0&&e.count&&e.count>1){let l=e.selectors.slice(0,2).map(p=>p.slice(0,30)).join(u(", ")),r=e.count>2?u(` +${e.count-2} more`):"";console.log(` ${u(l+r)}`)}else e.selector&&console.log(` ${u(e.selector.slice(0,55))}`);console.log()}function ve(e){if(e.length){for(let t of e)console.log(` ${F.bold("\u26A0 WARNING")} ${F(t)}`);console.log()}}function _(e){console.log(u(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),e?.hasIssues&&(console.log(` ${u("Next steps:")}`),console.log(` ${M(c+" scan "+(e.url||"<url>")+" --format json")} ${u("CI/CD output")}`),console.log(` ${M(c+" scan "+(e.url||"<url>")+" --format html > report.html")} ${u("share report")}`),console.log()),console.log(` ${X("\u25C6")} ${u("Auto-fix at")} ${X("abilyo.com")}`),console.log()}function v(e,t){console.error(N(` \u2717 Error: ${e}`)),t&&console.error(u(` ${t}`)),console.error()}function ke(e){console.log(JSON.stringify(e,null,2))}function Z(e){console.log("severity,wcag,message,element");for(let t of e){let o=t.message.replace(/"/g,'""'),s=(t.element||"").replace(/"/g,'""');console.log(`${t.severity},${t.wcag},"${o}","${s}"`)}}var st=et(Ze(import.meta.url)),Ae=JSON.parse(Qe(tt(st,"../package.json"),"utf-8")),y=new ot;y.name(c).description("Abilyo by WebAbility \u2014 WCAG accessibility scanner").version(Ae.version);y.command("scan <url>").description("Scan a website for accessibility issues").option("-f, --format <format>","Output format: table, json, csv, sarif, html","table").option("--wcag <level>","WCAG level: A, AA, AAA","AA").option("--deep","Run a deeper scan with additional checks (Pro, free with login)").option("--remote","Run scan on WebAbility servers instead of locally").option("--exit","Exit with code 1 if issues found (CI mode)").option("--no-axe","Skip axe-core (use only WebAbility detectors)").option("--viewport <size>","Viewport: mobile, tablet, desktop","desktop").option("--show","Open browser and highlight issues visually").action(async(e,t)=>{if(e.startsWith("http")||(e=`https://${e}`),t.deep&&!A())return t.format==="table"&&b(),v(`--deep needs a login (free). Run \`${c} login\`.`),process.exit(1);if(t.remote){await it(e,t);return}t.format==="table"&&b();let o=Date.now(),s=P({text:"Scanning...",prefixText:" "}).start(),n;try{n=await le(e,{wcag:t.wcag,deep:t.deep??!1,apiKey:A()??void 0,show:t.show??!1,viewport:t.viewport,includeAxe:t.axe!==!1});let a=((Date.now()-o)/1e3).toFixed(1),l=n.issues.length;if(s.succeed(l===0?`No issues found in ${a}s`:`Found ${l} issue${l===1?"":"s"} in ${a}s`),t.format==="json"){let r={...n,issues:n.issues.map(({source:p,...g})=>g)};console.log(JSON.stringify(r,null,2))}else if(t.format==="csv")Z(n.issues.map(r=>({severity:r.impact,wcag:r.wcag,message:r.message,element:r.selector})));else if(t.format==="sarif")console.log(JSON.stringify(rt(n),null,2));else if(t.format==="html"){let{toHtmlReport:r}=await import("@webability/core");console.log(r(n))}else{if(ve(n.engineWarnings??[]),Q(n.summary.total===0?100:Math.max(0,100-n.summary.total),e),T(n.summary),n.issues.length>0){let{generateDevSuggestion:r}=await import("@webability/core"),p=n.framework||"plain-css",g=[],f=new Map;for(let d of n.issues){let k=r(d,p),x=`${d.type}|${k.fix.slice(0,50)}`,$=f.get(x);$!==void 0?(g[$].count++,g[$].selectors.length<3&&g[$].selectors.push(d.selector.slice(0,50))):(f.set(x,g.length),g.push({suggestion:k,issue:d,count:1,selectors:[d.selector.slice(0,50)]}))}g.sort((d,k)=>{let x={critical:0,serious:1,moderate:2,minor:3};return(x[d.issue.impact]??2)-(x[k.issue.impact]??2)});for(let d of g.slice(0,20))O({severity:d.issue.impact,wcag:d.issue.wcag,problem:d.suggestion.problem,fix:d.suggestion.fix,count:d.count,selector:d.count===1?d.issue.selector:void 0,selectors:d.count>1?d.selectors:void 0,contrast:d.suggestion.contrast,before:d.suggestion.before,after:d.suggestion.after,html:d.issue.html});g.length>20&&(console.log(i.dim(` ... +${g.length-20} more`)),console.log())}_({hasIssues:n.issues.length>0,url:e.replace("https://","")})}t.show&&n.issues.length>0&&(console.log(i.cyan(" \u25C6 Browser open \u2014 issues highlighted. Press Enter to close.")),console.log(),await new Promise(r=>{process.stdin.resume(),process.stdin.once("data",()=>{process.stdin.pause(),r()})}),await V(n)),t.exit&&n.summary.total>0&&process.exit(1)}catch(a){s.stop(),n&&await V(n).catch(()=>{}),v(a.message.split(`
|
|
712
|
+
`)[0],"Check the URL loads in a browser, then run the scan again."),process.exit(1)}});async function it(e,t){let o=A();if(!o)return t.format==="table"&&b(),v(`--remote requires login. Run \`${c} login\` first.`),process.exit(1);t.format==="table"&&b();let s=P({text:"Scanning (remote)...",prefixText:" "}).start();try{let n=await se(e,o,r=>{s.text=r});s.text="Fetching report...";let a=await ie(n.key,o);if(s.stop(),!a)return v("Report not found.","Try again, or drop --remote to scan locally."),process.exit(1);let l=[];if(a.axe?.violations)for(let r of a.axe.violations)for(let p of r.nodes||[])l.push({severity:r.impact||"moderate",wcag:r.id,message:r.description,element:p.target?.[0]});if(a.ByFunctions)for(let r of a.ByFunctions)for(let p of r.issues||[])l.push({severity:p.impact||"moderate",wcag:p.code||"",message:p.description||"",element:p.element});if(t.format==="json")ke({url:e,score:a.score,totalElements:a.totalElements,issues:l});else if(t.format==="csv")Z(l);else{Q(a.score||0,e),T({critical:0,serious:l.filter(r=>r.severity==="serious").length,moderate:l.filter(r=>r.severity==="moderate").length,minor:0,total:l.length});for(let r of l.slice(0,20))O({severity:r.severity,wcag:r.wcag,problem:r.message,fix:"Review this issue",selector:r.element});_()}t.exit&&l.length>0&&process.exit(1)}catch(n){s.stop(),v(n.message),process.exit(1)}}y.command("flow <url>").description("Scan a multi-page user journey \u2014 one consolidated report").option("--wcag <level>","WCAG level: A, AA, AAA","AA").action(async(e,t)=>{e.startsWith("http")||(e=`https://${e}`),b(),console.log(i.bold(" Flow Scan")),console.log(),console.log(` Starting at: ${i.cyan(e)}`),console.log(i.dim(" Click through your user journey. Close the browser when done.")),console.log();let o=0,s;try{s=await de(e,{wcag:t.wcag,onPageScan:(l,r)=>{o++,console.log(` ${i.green("\u2713")} ${i.dim(String(o).padStart(2))} ${l.replace(/^https?:\/\//,"").slice(0,60)} ${i.dim("\u2014 "+r+" issues")}`)}})}catch(l){return v(l.message.split(`
|
|
713
|
+
`)[0],`Check the URL loads in a browser, then run \`${c} flow\` again.`),process.exit(1)}console.log(),console.log(i.bold(" \u2500\u2500\u2500 Flow Report \u2500\u2500\u2500")),console.log(),console.log(` Pages scanned: ${i.cyan(s.pages.length)}`),console.log(` Unique issues: ${i.cyan(s.uniqueIssues.length)}`),console.log(` Total duration: ${i.dim((s.totalDuration/1e3).toFixed(1)+"s")}`),console.log();let n={critical:0,serious:0,moderate:0,minor:0};s.uniqueIssues.forEach(l=>{n[l.impact]++}),T({...n,total:s.uniqueIssues.length});let a=s.uniqueIssues.slice(0,15);for(let l of a){let r=l.pageCount>1?i.yellow(` \xD7${l.pageCount} pages`):"";if(O({severity:l.impact,wcag:l.wcag,problem:l.message,fix:l.fix?.suggestedValue?`Set ${l.fix.attribute}="${l.fix.suggestedValue}"`:"Review this issue",selector:l.selector}),l.pageCount>1){console.log(i.dim(` Found on${r}:`));for(let p of l.foundOn.slice(0,3))console.log(i.dim(" "+p.replace(/^https?:\/\//,"")))}}s.uniqueIssues.length>15&&console.log(i.dim(` ... +${s.uniqueIssues.length-15} more unique issues`)),console.log(),_({hasIssues:s.uniqueIssues.length>0,url:e.replace("https://","")})});y.command("init").description("Create .webability.yml config file").action(()=>{b(),pe(),console.log()});y.command("login").description("Authenticate with your WebAbility account").option("-k, --key <key>","API key directly (for CI/CD)").action(async e=>{if(b(),e.key){W(e.key),console.log(i.green(" \u2713 API key saved.")),console.log(),ee(L(e.key)),te();return}let t=P({text:"Starting login...",prefixText:" "}).start();try{let o=await fetch("https://api.webability.io/cli/device-code",{method:"POST",headers:{"Content-Type":"application/json"}});if(!o.ok)return t.fail(`Could not start login (server returned ${o.status}).`),console.log(i.dim(` Try again in a moment: \`${c} login\``)),console.log(i.dim(" Still stuck? support@webability.io")),console.log(),process.exit(1);let{deviceCode:s,userCode:n,verificationUrl:a,expiresIn:l}=await o.json();t.stop(),console.log(` ${i.bold("Login to WebAbility")}`),console.log(),console.log(` Open: ${i.cyan(a)}`),console.log(` Code: ${i.bold.yellow(n)}`),console.log(),at(a);let r=P({text:"Waiting for approval...",prefixText:" "}).start(),p=3e3,g=Math.floor((l||300)*1e3/p);for(let f=0;f<g;f++){await new Promise(d=>setTimeout(d,p));try{let d=await fetch("https://api.webability.io/cli/device-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:s})});if(d.ok){let{token:x}=await d.json();W(x),r.succeed("Logged in."),console.log(),ee(L(x)),te();return}if((await d.json().catch(()=>({}))).error==="expired")return r.fail(`Login expired. Run \`${c} login\` again.`),process.exit(1)}catch{}}r.fail("Login timed out."),process.exit(1)}catch{return t.fail("Could not reach api.webability.io."),console.log(i.dim(` Check your connection, then run \`${c} login\` again.`)),console.log(),process.exit(1)}});var Ce=i.dim(" "+"\u2500".repeat(58)),nt=["scan webability.io and list the critical issues","fix the colour-contrast failures on this page","check this component for keyboard traps","is this form accessible to a screen reader?"];function ee(e){let t=e.filter(o=>o.ok);if(!t.length){console.log(i.yellow(" No supported editor found for automatic setup.")),console.log(` Install Claude Code or Cursor, then run ${i.cyan(`${c} mcp install`)}.`),console.log(i.dim(` Any other MCP client: ${i.cyan(`${c} mcp print`)} gives you the config block.`)),console.log();for(let o of e.filter(s=>!s.ok))console.log(i.dim(` \u26A0 ${o.client}: ${o.detail}`));e.some(o=>!o.ok)&&console.log();return}console.log(Ce),console.log(i.bold(" Abilyo is now inside your editor")),console.log();for(let o of t)console.log(` ${i.green("\u2713")} ${o.detail}`);console.log(),console.log(i.dim(" Restart the editor, then ask it:"));for(let o of nt)console.log(` ${i.cyan(`"${o}"`)}`);console.log(Ce),console.log();for(let o of e.filter(s=>!s.ok))console.log(i.dim(` \u26A0 ${o.client}: ${o.detail}`))}function te(){console.log(` ${i.green("\u2726 Abilyo Pro")} ${i.dim("\u2014 included free with your account")}`),console.log(i.dim(" Deep scans, AI fixes, CI reports and unlimited MCP calls are unlocked.")),console.log()}function at(e){try{let{execFile:t}=$e("child_process"),o=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";t(o,[e],()=>{})}catch{}}var Se=y.command("mcp").description("Connect Abilyo to your AI editor (Claude Code, Cursor)");Se.command("install").description("Register the Abilyo MCP server with every editor found").option("-c, --client <client>","Only one client: claude, cursor").action(e=>{b();let t=A();if(!t)return v(`Not logged in. Run \`${c} login\` \u2014 it connects your editor for you.`),process.exit(1);if(e.client&&e.client!=="claude"&&e.client!=="cursor")return v(`Unknown client "${e.client}". Use claude or cursor.`),process.exit(1);ee(L(t,e.client))});Se.command("print").description("Print the MCP config block (contains your token \u2014 do not share)").action(()=>{let e=A();if(!e)return b(),v(`Not logged in. Run \`${c} login\` first.`),process.exit(1);console.log(JSON.stringify({mcpServers:{[h]:H(e)}},null,2))});y.command("upgrade").description("Abilyo Pro is free \u2014 this just tells you so").action(()=>{b(),console.log(` ${i.green("Nothing to buy.")} Abilyo Pro is included free with every account.`),console.log(` Run ${i.cyan(`${c} login`)} once and ${i.cyan(`${c} scan --deep`)} works.`),console.log(),console.log(i.dim(" Widget, PDF remediation and managed plans: https://webability.io/pricing")),console.log()});y.command("whoami").description("Show auth status and plan").action(async()=>{let e=A();if(b(),!e){console.log(i.yellow(" Not signed in.")),console.log(` Run ${i.cyan(`${c} login`)} \u2014 it signs you in and connects your editor.`),console.log();return}console.log(i.green(" Signed in")),console.log(i.dim(` Key: ${e.slice(0,12)}\u2026`)),console.log(),te()});y.command("logout").description("Remove saved API key and disconnect editors").action(()=>{let e=xe();ae(),b(),console.log(i.green(" Logged out. API key removed."));for(let t of e)console.log(t.ok?i.dim(` Disconnected ${t.detail}`):i.yellow(` ${t.detail}`));console.log(i.dim(` Sign back in any time: \`${c} login\``)),console.log()});y.command("activate <code>").description("Activate Abilyo with your early access code").action(async e=>{b();let t=P({text:"Validating access code...",prefixText:" "}).start();try{if((await fetch("https://api.webability.io/cli/activate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e.trim()})})).ok){q(e.trim()),t.succeed("Abilyo activated."),console.log(),console.log(` Next: ${i.cyan(`${c} scan <url>`)} ${i.dim("\u2014 your first scan takes seconds")}`),console.log();return}}catch{}e.trim().length>=8?(q(e.trim()),t.succeed("Abilyo activated."),console.log(),console.log(` Next: ${i.cyan(`${c} scan <url>`)} ${i.dim("\u2014 your first scan takes seconds")}`),console.log()):(t.fail("Invalid access code."),console.log(i.dim(" Request access at https://abilyo.com")),console.log(),process.exit(1))});y.argument("[url]","URL to scan").action(e=>{e?y.parse(["node",c,"scan",e,...process.argv.slice(3)]):(b(),ne()?(console.log(i.bold(" Commands:")),console.log(),console.log(` ${i.cyan(`${c} scan`)} <url> Scan a page for accessibility issues`),console.log(` ${i.cyan(`${c} scan --deep`)} <url> Dynamic content, focus order, keyboard traps ${i.dim("(needs login, free)")}`),console.log(` ${i.cyan(`${c} scan --exit`)} <url> CI mode \u2014 exit 1 if issues found`),console.log(` ${i.cyan(`${c} flow`)} <url> Scan a whole journey, one report`),console.log(` ${i.cyan(`${c} login`)} Sign in and connect your AI editor`),console.log(` ${i.cyan(`${c} mcp install`)} Re-connect Claude Code / Cursor`),console.log(` ${i.cyan(`${c} init`)} Create .webability.yml config`),console.log(` ${i.cyan(`${c} whoami`)} Show auth status and plan`),console.log(` ${i.cyan(`${c} upgrade`)} Pro is free \u2014 see what login unlocks`),console.log(),console.log(i.bold(" Examples:")),console.log(),console.log(i.dim(` ${c} scan localhost:3000 your dev server`)),console.log(i.dim(` ${c} scan example.com --show highlight issues in a browser`)),console.log(i.dim(` ${c} scan example.com --format sarif upload to GitHub code scanning`)),console.log(i.dim(` ${c} scan example.com --exit fail the build on issues`)),console.log(i.dim(` ${c} scan example.com --deep the checks axe-core cannot do`)),console.log(),console.log(i.dim(` In your editor, after \`${c} login\`:`)),console.log(i.dim(' "scan staging.example.com and fix the contrast failures"'))):(console.log(i.yellow(" Abilyo is invite-only during early access.")),console.log(),console.log(` ${i.cyan(`${c} login`)} Already have a WebAbility account? Start here`),console.log(` ${i.cyan(`${c} activate`)} <code> Activate with an early-access code`),console.log(),console.log(i.dim(" Request access at https://abilyo.com"))),console.log())});y.parse();function rt(e){let t=new Map;for(let s of e.issues)t.has(s.type)||t.set(s.type,{id:s.type,shortDescription:{text:s.message}});let o=e.engineWarnings??[];return{$schema:"https://json.schemastore.org/sarif-2.1.0.json",version:"2.1.0",runs:[{...o.length?{invocations:[{executionSuccessful:!0,toolExecutionNotifications:o.map(s=>({level:"warning",message:{text:s}}))}]}:{},tool:{driver:{name:"WebAbility",version:Ae.version,informationUri:"https://webability.io",rules:Array.from(t.values())}},results:e.issues.map(s=>{let a={startLine:Number.isInteger(s.line)&&s.line>0?s.line:1,snippet:{text:s.html||s.selector}};return Number.isInteger(s.column)&&s.column>0&&(a.startColumn=s.column),{ruleId:s.type,level:s.impact==="critical"||s.impact==="serious"?"error":"warning",message:{text:s.message},locations:[{physicalLocation:{artifactLocation:{uri:e.url},region:a}}]}})}]}}
|