@selfcure/cli 0.1.0 → 0.1.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/index.d.ts +0 -1
- package/dist/index.js +9 -25
- package/package.json +13 -11
package/dist/index.d.ts
CHANGED
|
@@ -119,7 +119,6 @@ interface SelfcureConfig {
|
|
|
119
119
|
reportDir: string;
|
|
120
120
|
reportTitle?: string;
|
|
121
121
|
/** Optional Pro flag — enables `selfcure lint --fix` and `--pr` without the env var. */
|
|
122
|
-
pro?: boolean;
|
|
123
122
|
/** Optional linter settings (currently just PR base branch). */
|
|
124
123
|
lint?: LintOptions;
|
|
125
124
|
}
|
package/dist/index.js
CHANGED
|
@@ -554,7 +554,7 @@ function severityCounts(findings) {
|
|
|
554
554
|
};
|
|
555
555
|
}
|
|
556
556
|
function printA11ySection(findings, opts) {
|
|
557
|
-
const {
|
|
557
|
+
const { wcagLevel, cwd } = opts;
|
|
558
558
|
const counts = severityCounts(findings);
|
|
559
559
|
console.log(chalk.bold(`Accessibility WCAG ${wcagLevel}`));
|
|
560
560
|
if (findings.length === 0) {
|
|
@@ -569,12 +569,6 @@ function printA11ySection(findings, opts) {
|
|
|
569
569
|
if (counts.info > 0) parts.push(chalk.dim(`info ${counts.info}`));
|
|
570
570
|
console.log(" " + parts.join(" \xB7 "));
|
|
571
571
|
console.log("");
|
|
572
|
-
if (!isPro) {
|
|
573
|
-
console.log(chalk.bold.yellow(" \u2726 Full accessibility report available on the Pro plan"));
|
|
574
|
-
console.log(chalk.dim(" Enable with SELFCURE_PRO=1 or pro: true in your config."));
|
|
575
|
-
console.log("");
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
572
|
const byFile = /* @__PURE__ */ new Map();
|
|
579
573
|
for (const f of findings) {
|
|
580
574
|
const list = byFile.get(f.sourceFile) ?? [];
|
|
@@ -609,7 +603,7 @@ var DEFAULT_SOURCE_GLOBS = ["**/*.{tsx,jsx,ts,js,vue}"];
|
|
|
609
603
|
var DEFAULT_EXCLUDE = ["**/node_modules/**", "**/dist/**", "**/.next/**", "**/.nuxt/**"];
|
|
610
604
|
function registerA11yCommands(program2) {
|
|
611
605
|
const a11y = program2.command("a11y").description("Accessibility WCAG commands \u2014 scan, audit, and CI gate");
|
|
612
|
-
a11y.command("scan").description("Scan source files for WCAG accessibility issues and update the findings inventory").option("-c, --config <path>", "path to selfcure.config.mjs", "./selfcure.config.mjs").option("--root <dir>", "project root (overrides config.rootDir)").option("--wcag <level>", "WCAG target level: A, AA, or AAA", "AA").option("--out <dir>", "output directory for findings file", ".selfcure").option("--app <name>", "application name for the findings file").option("--dynamic", "
|
|
606
|
+
a11y.command("scan").description("Scan source files for WCAG accessibility issues and update the findings inventory").option("-c, --config <path>", "path to selfcure.config.mjs", "./selfcure.config.mjs").option("--root <dir>", "project root (overrides config.rootDir)").option("--wcag <level>", "WCAG target level: A, AA, or AAA", "AA").option("--out <dir>", "output directory for findings file", ".selfcure").option("--app <name>", "application name for the findings file").option("--dynamic", "also run live Playwright + axe-core scan").option("--base-url <url>", "app base URL for dynamic scan (e.g. http://localhost:3000)").option("--routes <routes>", "comma-separated routes to scan (default: /)", "/").option("--axe-source <path>", "local path or URL to axe-core script (default: CDN)").action(async (opts) => {
|
|
613
607
|
const spinner = ora("Scanning for accessibility issues\u2026").start();
|
|
614
608
|
try {
|
|
615
609
|
const config = await tryLoadConfig(opts.config);
|
|
@@ -706,7 +700,7 @@ function registerA11yCommands(program2) {
|
|
|
706
700
|
return;
|
|
707
701
|
}
|
|
708
702
|
const open = inventory.findings.filter((f) => f.status === "open");
|
|
709
|
-
printA11ySection(open, {
|
|
703
|
+
printA11ySection(open, { wcagLevel: inventory.targetLevel, cwd: process.cwd() });
|
|
710
704
|
if (opts.ci) {
|
|
711
705
|
if (wouldFailCI) {
|
|
712
706
|
console.log(chalk.red.bold(
|
|
@@ -1432,24 +1426,15 @@ program.command("report").description("Generate HTML report from the last run re
|
|
|
1432
1426
|
process.exit(1);
|
|
1433
1427
|
}
|
|
1434
1428
|
});
|
|
1435
|
-
program.command("lint").description("
|
|
1429
|
+
program.command("lint").description("Lint source files for unstable test selectors and suggest data-testid patches").option("-c, --config <path>", "path to selfcure.config.mjs (falls back to selfcure.config.js)", "./selfcure.config.mjs").option("--threshold <n>", "testability score below which an element is flagged", "65").option("--fix", "apply data-testid patches to source files automatically").option("--pr", "create a GitHub PR with the applied fixes (requires --fix)").option("--a11y", "also run WCAG accessibility lint alongside testability").option("--wcag <level>", "WCAG target level when using --a11y: A, AA, or AAA", "AA").option("--prompt", "print a paste-ready prompt for your IDE AI agent (Copilot/Cursor) instead of the report \u2014 no API key needed").action(async (opts) => {
|
|
1436
1430
|
const spinner = ora6("Analysing source files\u2026").start();
|
|
1437
1431
|
try {
|
|
1438
1432
|
const configPath = await resolveConfigPath(opts.config);
|
|
1439
1433
|
const configUrl = pathToFileURL5(configPath).href;
|
|
1440
1434
|
const { default: config } = await import(configUrl);
|
|
1441
1435
|
const threshold = Number(opts.threshold ?? 65);
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1444
|
-
spinner.stop();
|
|
1445
|
-
console.log("");
|
|
1446
|
-
console.log(chalk6.bold.yellow("\u2726 Pro feature"));
|
|
1447
|
-
console.log(chalk6.dim(" --fix and --pr are available on the Pro plan and above."));
|
|
1448
|
-
console.log(chalk6.dim(" Enable Pro by setting SELFCURE_PRO=1 or pro: true in your config."));
|
|
1449
|
-
console.log("");
|
|
1450
|
-
}
|
|
1451
|
-
const fix = opts.fix && isPro;
|
|
1452
|
-
const pr = opts.pr && isPro && fix;
|
|
1436
|
+
const fix = Boolean(opts.fix);
|
|
1437
|
+
const pr = Boolean(opts.pr) && fix;
|
|
1453
1438
|
const a11y = Boolean(opts.a11y);
|
|
1454
1439
|
const summary = await runLint(config, { threshold, fix, pr, a11y, wcag: opts.wcag });
|
|
1455
1440
|
spinner.stop();
|
|
@@ -1507,7 +1492,6 @@ program.command("lint").description("[Pro] Lint source files for unstable test s
|
|
|
1507
1492
|
console.log(chalk6.dim("\u2500".repeat(60)));
|
|
1508
1493
|
console.log("");
|
|
1509
1494
|
printA11ySection(a11yFindings, {
|
|
1510
|
-
isPro,
|
|
1511
1495
|
wcagLevel: opts.wcag ?? "AA",
|
|
1512
1496
|
cwd: process.cwd()
|
|
1513
1497
|
});
|
|
@@ -1521,9 +1505,9 @@ program.command("lint").description("[Pro] Lint source files for unstable test s
|
|
|
1521
1505
|
} else if (pr) {
|
|
1522
1506
|
console.log(chalk6.yellow(" PR creation skipped (no files changed)."));
|
|
1523
1507
|
}
|
|
1524
|
-
} else
|
|
1525
|
-
console.log(chalk6.
|
|
1526
|
-
console.log(chalk6.
|
|
1508
|
+
} else {
|
|
1509
|
+
console.log(chalk6.dim(" Run with --fix to auto-patch source files"));
|
|
1510
|
+
console.log(chalk6.dim(" Run with --fix --pr to open a GitHub PR"));
|
|
1527
1511
|
}
|
|
1528
1512
|
console.log("");
|
|
1529
1513
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selfcure/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "CLI
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Frontend testability maturity CLI — scores components, flags ambiguous locators, and ships data-testid fixes as a PR before Cypress, Playwright, Selenium, TestCafe, or WebdriverIO run.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "ricardofrancocustodio",
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"bin": {
|
|
17
17
|
"selfcure": "dist/index.js"
|
|
18
18
|
},
|
|
19
|
-
"files": [
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
20
22
|
"publishConfig": {
|
|
21
23
|
"access": "public"
|
|
22
24
|
},
|
|
@@ -27,14 +29,14 @@
|
|
|
27
29
|
},
|
|
28
30
|
"dependencies": {
|
|
29
31
|
"@inquirer/prompts": "^8.4.3",
|
|
30
|
-
"@selfcure/analyzer": "^0.1.
|
|
31
|
-
"@selfcure/crawler": "^0.1.
|
|
32
|
-
"@selfcure/generator": "^0.1.
|
|
33
|
-
"@selfcure/mcp": "^0.1.
|
|
34
|
-
"@selfcure/reporter": "^0.1.
|
|
35
|
-
"@selfcure/runner": "^0.1.
|
|
36
|
-
"@selfcure/selfcure": "^0.1.
|
|
37
|
-
"@selfcure/web": "^0.1.
|
|
32
|
+
"@selfcure/analyzer": "^0.1.1",
|
|
33
|
+
"@selfcure/crawler": "^0.1.1",
|
|
34
|
+
"@selfcure/generator": "^0.1.1",
|
|
35
|
+
"@selfcure/mcp": "^0.1.1",
|
|
36
|
+
"@selfcure/reporter": "^0.1.1",
|
|
37
|
+
"@selfcure/runner": "^0.1.1",
|
|
38
|
+
"@selfcure/selfcure": "^0.1.1",
|
|
39
|
+
"@selfcure/web": "^0.1.1",
|
|
38
40
|
"chalk": "^5.6.2",
|
|
39
41
|
"commander": "^14.0.3",
|
|
40
42
|
"ora": "^9.4.0"
|