@harness-engineering/cli 1.6.2 → 1.8.0
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/agents/personas/documentation-maintainer.yaml +3 -1
- package/dist/agents/personas/performance-guardian.yaml +23 -0
- package/dist/agents/personas/planner.yaml +27 -0
- package/dist/agents/personas/verifier.yaml +30 -0
- package/dist/agents/skills/claude-code/align-documentation/SKILL.md +13 -0
- package/dist/agents/skills/claude-code/cleanup-dead-code/SKILL.md +25 -1
- package/dist/agents/skills/claude-code/cleanup-dead-code/skill.yaml +5 -2
- package/dist/agents/skills/claude-code/detect-doc-drift/SKILL.md +12 -0
- package/dist/agents/skills/claude-code/enforce-architecture/SKILL.md +67 -1
- package/dist/agents/skills/claude-code/enforce-architecture/skill.yaml +5 -2
- package/dist/agents/skills/claude-code/harness-accessibility/SKILL.md +281 -0
- package/dist/agents/skills/claude-code/harness-accessibility/skill.yaml +51 -0
- package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +119 -72
- package/dist/agents/skills/claude-code/harness-autopilot/skill.yaml +4 -2
- package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +76 -4
- package/dist/agents/skills/claude-code/harness-brainstorming/skill.yaml +2 -0
- package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +487 -234
- package/dist/agents/skills/claude-code/harness-code-review/skill.yaml +15 -2
- package/dist/agents/skills/claude-code/harness-codebase-cleanup/SKILL.md +226 -0
- package/dist/agents/skills/claude-code/harness-codebase-cleanup/skill.yaml +64 -0
- package/dist/agents/skills/claude-code/harness-dependency-health/SKILL.md +35 -6
- package/dist/agents/skills/claude-code/harness-dependency-health/skill.yaml +1 -1
- package/dist/agents/skills/claude-code/harness-design/SKILL.md +265 -0
- package/dist/agents/skills/claude-code/harness-design/skill.yaml +53 -0
- package/dist/agents/skills/claude-code/harness-design-mobile/SKILL.md +336 -0
- package/dist/agents/skills/claude-code/harness-design-mobile/skill.yaml +49 -0
- package/dist/agents/skills/claude-code/harness-design-system/SKILL.md +282 -0
- package/dist/agents/skills/claude-code/harness-design-system/skill.yaml +50 -0
- package/dist/agents/skills/claude-code/harness-design-web/SKILL.md +360 -0
- package/dist/agents/skills/claude-code/harness-design-web/skill.yaml +52 -0
- package/dist/agents/skills/claude-code/harness-docs-pipeline/SKILL.md +460 -0
- package/dist/agents/skills/claude-code/harness-docs-pipeline/skill.yaml +69 -0
- package/dist/agents/skills/claude-code/harness-execution/SKILL.md +73 -8
- package/dist/agents/skills/claude-code/harness-execution/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-hotspot-detector/SKILL.md +32 -6
- package/dist/agents/skills/claude-code/harness-hotspot-detector/skill.yaml +1 -1
- package/dist/agents/skills/claude-code/harness-i18n/SKILL.md +484 -0
- package/dist/agents/skills/claude-code/harness-i18n/skill.yaml +54 -0
- package/dist/agents/skills/claude-code/harness-i18n-process/SKILL.md +388 -0
- package/dist/agents/skills/claude-code/harness-i18n-process/skill.yaml +43 -0
- package/dist/agents/skills/claude-code/harness-i18n-workflow/SKILL.md +512 -0
- package/dist/agents/skills/claude-code/harness-i18n-workflow/skill.yaml +53 -0
- package/dist/agents/skills/claude-code/harness-impact-analysis/SKILL.md +51 -6
- package/dist/agents/skills/claude-code/harness-integrity/SKILL.md +35 -1
- package/dist/agents/skills/claude-code/harness-knowledge-mapper/SKILL.md +46 -5
- package/dist/agents/skills/claude-code/harness-knowledge-mapper/skill.yaml +1 -1
- package/dist/agents/skills/claude-code/harness-onboarding/SKILL.md +19 -1
- package/dist/agents/skills/claude-code/harness-perf/SKILL.md +37 -8
- package/dist/agents/skills/claude-code/harness-perf/skill.yaml +3 -0
- package/dist/agents/skills/claude-code/harness-perf-tdd/SKILL.md +17 -4
- package/dist/agents/skills/claude-code/harness-planning/SKILL.md +57 -3
- package/dist/agents/skills/claude-code/harness-planning/skill.yaml +2 -0
- package/dist/agents/skills/claude-code/harness-release-readiness/SKILL.md +29 -9
- package/dist/agents/skills/claude-code/harness-roadmap/SKILL.md +562 -0
- package/dist/agents/skills/claude-code/harness-roadmap/skill.yaml +43 -0
- package/dist/agents/skills/claude-code/harness-security-review/SKILL.md +36 -2
- package/dist/agents/skills/claude-code/harness-security-review/skill.yaml +8 -6
- package/dist/agents/skills/claude-code/harness-security-scan/skill.yaml +1 -1
- package/dist/agents/skills/claude-code/harness-soundness-review/SKILL.md +1267 -0
- package/dist/agents/skills/claude-code/harness-soundness-review/skill.yaml +48 -0
- package/dist/agents/skills/claude-code/harness-test-advisor/SKILL.md +35 -6
- package/dist/agents/skills/claude-code/harness-verification/SKILL.md +66 -0
- package/dist/agents/skills/claude-code/harness-verification/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-verify/SKILL.md +37 -0
- package/dist/agents/skills/claude-code/initialize-harness-project/SKILL.md +15 -1
- package/dist/agents/skills/claude-code/validate-context-engineering/SKILL.md +12 -0
- package/dist/agents/skills/gemini-cli/harness-accessibility/SKILL.md +281 -0
- package/dist/agents/skills/gemini-cli/harness-accessibility/skill.yaml +51 -0
- package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +119 -72
- package/dist/agents/skills/gemini-cli/harness-autopilot/skill.yaml +4 -2
- package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/SKILL.md +226 -0
- package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/skill.yaml +64 -0
- package/dist/agents/skills/gemini-cli/harness-dependency-health/SKILL.md +35 -6
- package/dist/agents/skills/gemini-cli/harness-dependency-health/skill.yaml +1 -1
- package/dist/agents/skills/gemini-cli/harness-design/SKILL.md +265 -0
- package/dist/agents/skills/gemini-cli/harness-design/skill.yaml +53 -0
- package/dist/agents/skills/gemini-cli/harness-design-mobile/SKILL.md +336 -0
- package/dist/agents/skills/gemini-cli/harness-design-mobile/skill.yaml +49 -0
- package/dist/agents/skills/gemini-cli/harness-design-system/SKILL.md +282 -0
- package/dist/agents/skills/gemini-cli/harness-design-system/skill.yaml +50 -0
- package/dist/agents/skills/gemini-cli/harness-design-web/SKILL.md +360 -0
- package/dist/agents/skills/gemini-cli/harness-design-web/skill.yaml +52 -0
- package/dist/agents/skills/gemini-cli/harness-docs-pipeline/SKILL.md +460 -0
- package/dist/agents/skills/gemini-cli/harness-docs-pipeline/skill.yaml +69 -0
- package/dist/agents/skills/gemini-cli/harness-hotspot-detector/SKILL.md +32 -6
- package/dist/agents/skills/gemini-cli/harness-hotspot-detector/skill.yaml +1 -1
- package/dist/agents/skills/gemini-cli/harness-i18n/SKILL.md +484 -0
- package/dist/agents/skills/gemini-cli/harness-i18n/skill.yaml +54 -0
- package/dist/agents/skills/gemini-cli/harness-i18n-process/SKILL.md +388 -0
- package/dist/agents/skills/gemini-cli/harness-i18n-process/skill.yaml +43 -0
- package/dist/agents/skills/gemini-cli/harness-i18n-workflow/SKILL.md +512 -0
- package/dist/agents/skills/gemini-cli/harness-i18n-workflow/skill.yaml +53 -0
- package/dist/agents/skills/gemini-cli/harness-impact-analysis/SKILL.md +51 -6
- package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/SKILL.md +46 -5
- package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/skill.yaml +1 -1
- package/dist/agents/skills/gemini-cli/harness-perf/SKILL.md +37 -8
- package/dist/agents/skills/gemini-cli/harness-perf/skill.yaml +3 -0
- package/dist/agents/skills/gemini-cli/harness-perf-tdd/SKILL.md +17 -4
- package/dist/agents/skills/gemini-cli/harness-release-readiness/SKILL.md +29 -9
- package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +562 -0
- package/dist/agents/skills/gemini-cli/harness-roadmap/skill.yaml +43 -0
- package/dist/agents/skills/gemini-cli/harness-security-review/skill.yaml +8 -6
- package/dist/agents/skills/gemini-cli/harness-security-scan/skill.yaml +1 -1
- package/dist/agents/skills/gemini-cli/harness-soundness-review/SKILL.md +1267 -0
- package/dist/agents/skills/gemini-cli/harness-soundness-review/skill.yaml +48 -0
- package/dist/agents/skills/gemini-cli/harness-test-advisor/SKILL.md +35 -6
- package/dist/agents/skills/node_modules/.bin/vitest +2 -2
- package/dist/agents/skills/shared/design-knowledge/anti-patterns/color.yaml +106 -0
- package/dist/agents/skills/shared/design-knowledge/anti-patterns/layout.yaml +109 -0
- package/dist/agents/skills/shared/design-knowledge/anti-patterns/motion.yaml +109 -0
- package/dist/agents/skills/shared/design-knowledge/anti-patterns/typography.yaml +112 -0
- package/dist/agents/skills/shared/design-knowledge/industries/creative.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/ecommerce.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/emerging-tech.yaml +83 -0
- package/dist/agents/skills/shared/design-knowledge/industries/fintech.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/healthcare.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/lifestyle.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/saas.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/services.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/palettes/curated.yaml +234 -0
- package/dist/agents/skills/shared/design-knowledge/platform-rules/android.yaml +125 -0
- package/dist/agents/skills/shared/design-knowledge/platform-rules/flutter.yaml +144 -0
- package/dist/agents/skills/shared/design-knowledge/platform-rules/ios.yaml +106 -0
- package/dist/agents/skills/shared/design-knowledge/platform-rules/web.yaml +102 -0
- package/dist/agents/skills/shared/design-knowledge/typography/pairings.yaml +274 -0
- package/dist/agents/skills/shared/i18n-knowledge/accessibility/intersection.yaml +142 -0
- package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/encoding.yaml +67 -0
- package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/formatting.yaml +106 -0
- package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/layout.yaml +80 -0
- package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/pluralization.yaml +80 -0
- package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/string-handling.yaml +106 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/android-resources.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/apple-strings.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/backend-patterns.yaml +50 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/flutter-intl.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/i18next.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/react-intl.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/frameworks/vue-i18n.yaml +47 -0
- package/dist/agents/skills/shared/i18n-knowledge/industries/ecommerce.yaml +66 -0
- package/dist/agents/skills/shared/i18n-knowledge/industries/fintech.yaml +66 -0
- package/dist/agents/skills/shared/i18n-knowledge/industries/gaming.yaml +69 -0
- package/dist/agents/skills/shared/i18n-knowledge/industries/healthcare.yaml +66 -0
- package/dist/agents/skills/shared/i18n-knowledge/industries/legal.yaml +66 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/ar.yaml +41 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/de.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/en.yaml +32 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/es.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/fi.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/fr.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/he.yaml +41 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/hi.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/it.yaml +32 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/ja.yaml +38 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/ko.yaml +38 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/nl.yaml +32 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/pl.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/pt.yaml +32 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/ru.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/sv.yaml +32 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/th.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/tr.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hans.yaml +38 -0
- package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hant.yaml +35 -0
- package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/i18next-mcp.yaml +56 -0
- package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lingo-dev.yaml +56 -0
- package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lokalise.yaml +60 -0
- package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/tolgee.yaml +60 -0
- package/dist/agents/skills/shared/i18n-knowledge/testing/locale-testing.yaml +107 -0
- package/dist/agents/skills/shared/i18n-knowledge/testing/pseudo-localization.yaml +86 -0
- package/dist/bin/harness.js +64 -4
- package/dist/{chunk-UDWGSL3T.js → chunk-3JWCBVUZ.js} +3 -3
- package/dist/{chunk-IUFFBBYV.js → chunk-LNI4T7R6.js} +179 -61
- package/dist/{chunk-USEYPS7F.js → chunk-SJECMKSS.js} +2250 -40
- package/dist/{dist-4MYPT3OE.js → dist-BDO5GFEM.js} +295 -14
- package/dist/{dist-RBZXXJHG.js → dist-NT3GXHQZ.js} +95 -1
- package/dist/index.d.ts +266 -7
- package/dist/index.js +7 -3
- package/dist/validate-cross-check-2OPGCGGU.js +7 -0
- package/package.json +7 -7
- package/dist/validate-cross-check-CPEPNLOD.js +0 -7
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
version: 1
|
|
2
2
|
name: Documentation Maintainer
|
|
3
3
|
description: Keeps documentation in sync with source code
|
|
4
|
-
role: Detect documentation drift, validate doc coverage, align docs with code changes
|
|
4
|
+
role: Detect documentation drift, validate doc coverage, align docs with code changes, run full documentation health pipeline
|
|
5
5
|
skills:
|
|
6
6
|
- detect-doc-drift
|
|
7
7
|
- align-documentation
|
|
8
8
|
- harness-knowledge-mapper
|
|
9
|
+
- validate-context-engineering
|
|
10
|
+
- harness-docs-pipeline
|
|
9
11
|
commands:
|
|
10
12
|
- check-docs
|
|
11
13
|
- validate
|
|
@@ -5,6 +5,7 @@ role: Run structural complexity checks, coupling analysis, benchmark regression
|
|
|
5
5
|
skills:
|
|
6
6
|
- harness-perf
|
|
7
7
|
- harness-tdd
|
|
8
|
+
- harness-perf-tdd
|
|
8
9
|
commands:
|
|
9
10
|
- check-perf
|
|
10
11
|
- perf
|
|
@@ -20,6 +21,28 @@ config:
|
|
|
20
21
|
severity: error
|
|
21
22
|
autoFix: false
|
|
22
23
|
timeout: 300000
|
|
24
|
+
steps:
|
|
25
|
+
- command: validate
|
|
26
|
+
when: always
|
|
27
|
+
- command: check-deps
|
|
28
|
+
when: always
|
|
29
|
+
- command: check-perf --structural
|
|
30
|
+
when: always
|
|
31
|
+
- command: check-perf --coupling
|
|
32
|
+
when: always
|
|
33
|
+
- skill: harness-perf
|
|
34
|
+
phases: [BENCHMARK, REPORT, ENFORCE]
|
|
35
|
+
when: on_pr
|
|
36
|
+
- check: missing-benchmarks
|
|
37
|
+
when: on_pr
|
|
38
|
+
missing_benchmark_detection:
|
|
39
|
+
description: Detect new/modified source files without co-located benchmarks
|
|
40
|
+
logic:
|
|
41
|
+
- step: Identify new/modified source files in the PR diff
|
|
42
|
+
- step: For each file, check if a co-located .bench.ts file exists
|
|
43
|
+
- step: "If file is on a @perf-critical path (via get_critical_paths) and has no benchmark: flag Tier 2 warning"
|
|
44
|
+
- step: "If file is not critical but is new: flag Tier 3 info suggesting harness-perf-tdd"
|
|
45
|
+
- step: 'Output example: "New file src/core/parser.ts is on a critical path but has no benchmark. Consider using harness-perf-tdd to add one."'
|
|
23
46
|
outputs:
|
|
24
47
|
agents-md: true
|
|
25
48
|
ci-workflow: true
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
name: Planner
|
|
3
|
+
description: Creates executable phase plans with task breakdown and dependency analysis
|
|
4
|
+
role: >
|
|
5
|
+
Create detailed implementation plans from approved specs using harness methodology.
|
|
6
|
+
Breaks work into atomic tasks with explicit file paths, dependency ordering,
|
|
7
|
+
and checkpoint placement. Writes plans and handoff context for execution.
|
|
8
|
+
skills:
|
|
9
|
+
- harness-planning
|
|
10
|
+
steps:
|
|
11
|
+
- command: validate
|
|
12
|
+
when: always
|
|
13
|
+
- command: check-deps
|
|
14
|
+
when: always
|
|
15
|
+
- skill: harness-planning
|
|
16
|
+
when: manual
|
|
17
|
+
output: auto
|
|
18
|
+
triggers:
|
|
19
|
+
- event: manual
|
|
20
|
+
config:
|
|
21
|
+
severity: error
|
|
22
|
+
autoFix: false
|
|
23
|
+
timeout: 600000
|
|
24
|
+
outputs:
|
|
25
|
+
agents-md: true
|
|
26
|
+
ci-workflow: false
|
|
27
|
+
runtime-config: true
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
name: Verifier
|
|
3
|
+
description: Comprehensive verification of implementation against spec and plan
|
|
4
|
+
role: >
|
|
5
|
+
Verify that implementation matches the approved spec and plan using harness methodology.
|
|
6
|
+
Checks at three tiers — EXISTS (files present), SUBSTANTIVE (real implementation,
|
|
7
|
+
not stubs), and WIRED (connected to the rest of the system). Reports pass/fail
|
|
8
|
+
with evidence-based findings.
|
|
9
|
+
skills:
|
|
10
|
+
- harness-verification
|
|
11
|
+
steps:
|
|
12
|
+
- command: validate
|
|
13
|
+
when: always
|
|
14
|
+
- command: check-deps
|
|
15
|
+
when: always
|
|
16
|
+
- command: check-phase-gate
|
|
17
|
+
when: always
|
|
18
|
+
- skill: harness-verification
|
|
19
|
+
when: manual
|
|
20
|
+
output: auto
|
|
21
|
+
triggers:
|
|
22
|
+
- event: manual
|
|
23
|
+
config:
|
|
24
|
+
severity: error
|
|
25
|
+
autoFix: false
|
|
26
|
+
timeout: 600000
|
|
27
|
+
outputs:
|
|
28
|
+
agents-md: true
|
|
29
|
+
ci-workflow: false
|
|
30
|
+
runtime-config: true
|
|
@@ -40,6 +40,19 @@ When a knowledge graph exists at `.harness/graph/`, use graph queries for faster
|
|
|
40
40
|
|
|
41
41
|
Replaces manual doc-to-code correlation. Fall back to file-based commands if no graph is available.
|
|
42
42
|
|
|
43
|
+
### Pipeline Context (when orchestrated)
|
|
44
|
+
|
|
45
|
+
When invoked by `harness-docs-pipeline`, check for a `pipeline` field in `.harness/handoff.json`:
|
|
46
|
+
|
|
47
|
+
- If `pipeline` field exists: read `DocPipelineContext` from it
|
|
48
|
+
- Read `pipeline.driftFindings` to know which fixes to apply (pre-classified by safety)
|
|
49
|
+
- If `pipeline.fixBatch` is set, apply only those specific fixes rather than running full detection
|
|
50
|
+
- Write applied fixes as `DocFix[]` back to `pipeline.fixesApplied`
|
|
51
|
+
- This enables the convergence loop to track fix verification status
|
|
52
|
+
- If `pipeline` field does not exist: behave exactly as today (standalone mode)
|
|
53
|
+
|
|
54
|
+
No changes to the skill's interface or output format — the pipeline field is purely additive.
|
|
55
|
+
|
|
43
56
|
### Phase 2: Map — Connect Code Changes to Documentation
|
|
44
57
|
|
|
45
58
|
For each changed file, identify all documentation that references it:
|
|
@@ -43,7 +43,9 @@ Graph reachability reduces false positives compared to static analysis alone, si
|
|
|
43
43
|
|
|
44
44
|
- Exports that are not imported anywhere AND not referenced in any config file
|
|
45
45
|
- Files that are not imported anywhere AND have no side effects (no top-level execution)
|
|
46
|
-
-
|
|
46
|
+
- Dead exports (non-public, zero importers) -- remove `export` keyword or delete entirely if zero internal callers
|
|
47
|
+
- Commented-out code blocks -- delete commented block (dead by definition, code is in git history)
|
|
48
|
+
- Orphaned npm dependencies -- remove from package.json (probably safe; needs install+test verification)
|
|
47
49
|
- Unused local variables and imports within a file (linter can catch these)
|
|
48
50
|
|
|
49
51
|
**Needs human review before removal:**
|
|
@@ -70,6 +72,28 @@ For each item categorized as safe:
|
|
|
70
72
|
|
|
71
73
|
5. **Commit the cleanup.** Group related removals into logical commits (e.g., "remove unused shipping utilities" not "delete dead code").
|
|
72
74
|
|
|
75
|
+
**New fix types:**
|
|
76
|
+
|
|
77
|
+
- **Dead exports (non-public):** Use `apply_fixes` with `fixTypes: ['dead-exports']`. The tool removes the `export` keyword. If the function/class has zero internal callers too, delete the entire declaration.
|
|
78
|
+
- **Commented-out code:** Use `apply_fixes` with `fixTypes: ['commented-code']`. The tool deletes commented-out code blocks. This is cosmetic and only needs lint verification.
|
|
79
|
+
- **Orphaned dependencies:** Use `apply_fixes` with `fixTypes: ['orphaned-deps']`. The tool removes the dep from package.json. **Must run `pnpm install && pnpm test` after** to verify nothing breaks.
|
|
80
|
+
|
|
81
|
+
### Phase 3.5: Convergence Loop (Standalone)
|
|
82
|
+
|
|
83
|
+
When running standalone (not through the orchestrator), apply a single-concern convergence loop:
|
|
84
|
+
|
|
85
|
+
1. **Re-run detection.** After applying all safe fixes, run `harness cleanup --type dead-code` again.
|
|
86
|
+
2. **Check if issue count decreased.** Compare the new count to the previous count.
|
|
87
|
+
3. **If decreased: loop.** New dead code may have been exposed by the fixes (e.g., removing a dead export made a file fully unused). Go back to Phase 2 (Categorize) with the new report.
|
|
88
|
+
4. **If unchanged: stop.** No more cascading fixes are possible. Proceed to Phase 4 (Report).
|
|
89
|
+
5. **Maximum iterations: 5.** To prevent infinite loops, stop after 5 convergence cycles regardless.
|
|
90
|
+
|
|
91
|
+
**Why convergence matters:** Removing dead code can create more dead code. For example:
|
|
92
|
+
|
|
93
|
+
- Removing a dead export may make all remaining exports in a file dead, making the file itself dead.
|
|
94
|
+
- Removing a dead file removes its imports, which may make other files' exports dead.
|
|
95
|
+
- Removing an orphaned dep may cause lint warnings that reveal unused imports.
|
|
96
|
+
|
|
73
97
|
### Phase 4: Report Remaining Items
|
|
74
98
|
|
|
75
99
|
### Graph Refresh
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
name: cleanup-dead-code
|
|
2
|
-
version: "1.
|
|
3
|
-
description: Detect
|
|
2
|
+
version: "1.1.0"
|
|
3
|
+
description: Detect and auto-fix dead code including dead exports, commented-out code, and orphaned dependencies
|
|
4
4
|
cognitive_mode: diagnostic-investigator
|
|
5
5
|
triggers:
|
|
6
6
|
- manual
|
|
@@ -18,6 +18,9 @@ cli:
|
|
|
18
18
|
- name: path
|
|
19
19
|
description: Project root path
|
|
20
20
|
required: false
|
|
21
|
+
- name: fix
|
|
22
|
+
description: Enable auto-fix with convergence loop
|
|
23
|
+
required: false
|
|
21
24
|
mcp:
|
|
22
25
|
tool: run_skill
|
|
23
26
|
input:
|
|
@@ -30,6 +30,18 @@ When a knowledge graph exists at `.harness/graph/`, use graph queries for faster
|
|
|
30
30
|
|
|
31
31
|
When a graph is available, drift is simply stale edges: doc-to-code edges where the code side has been modified more recently than the doc side. This replaces regex pattern matching and catches semantic drift that text search misses. Fall back to file-based commands if no graph is available.
|
|
32
32
|
|
|
33
|
+
### Pipeline Context (when orchestrated)
|
|
34
|
+
|
|
35
|
+
When invoked by `harness-docs-pipeline`, check for a `pipeline` field in `.harness/handoff.json`:
|
|
36
|
+
|
|
37
|
+
- If `pipeline` field exists: read `DocPipelineContext` from it
|
|
38
|
+
- Use `pipeline.exclusions` to skip findings that were already addressed in a previous phase
|
|
39
|
+
- Write `DriftFinding[]` results back to `pipeline.driftFindings` in handoff.json
|
|
40
|
+
- This enables the orchestrator to track findings across phases and avoid double-counting
|
|
41
|
+
- If `pipeline` field does not exist: behave exactly as today (standalone mode)
|
|
42
|
+
|
|
43
|
+
No changes to the skill's interface or output format — the pipeline field is purely additive.
|
|
44
|
+
|
|
33
45
|
### Phase 2: Identify — Classify Drift Types
|
|
34
46
|
|
|
35
47
|
Categorize each finding into one of these drift types:
|
|
@@ -22,6 +22,12 @@
|
|
|
22
22
|
- **Forbidden imports** — specific import paths that are never allowed in certain contexts
|
|
23
23
|
- **Boundary definitions** — which directories/packages belong to which layer
|
|
24
24
|
|
|
25
|
+
- **Design constraints** — when `design` config exists, also load design constraint rules:
|
|
26
|
+
- Token compliance — components must reference design tokens, not hardcoded values
|
|
27
|
+
- Accessibility compliance — color pairs must meet WCAG contrast ratios
|
|
28
|
+
- Anti-pattern enforcement — project-specific anti-patterns from `design-system/DESIGN.md`
|
|
29
|
+
- Platform binding — tokens must have appropriate platform bindings for enabled platforms
|
|
30
|
+
|
|
25
31
|
2. **Understand the layer model.** In a typical layered architecture:
|
|
26
32
|
- Higher layers depend on lower layers (UI depends on Service, Service depends on Repository)
|
|
27
33
|
- Lower layers NEVER depend on higher layers (Repository must not import from UI)
|
|
@@ -58,12 +64,64 @@ For each violation, determine:
|
|
|
58
64
|
- **Skip-layer dependency** — a layer reaches past its immediate neighbor (e.g., UI importing directly from Repository, bypassing Service). This breaks encapsulation and makes the middle layer pointless.
|
|
59
65
|
- **Circular dependency** — two modules or layers depend on each other. This creates fragile coupling where changing either module risks breaking the other.
|
|
60
66
|
- **Forbidden import** — a specific import that is explicitly banned (e.g., importing a database driver outside the repository layer). This prevents implementation details from leaking.
|
|
67
|
+
- **Design constraint violation** — a component uses hardcoded values instead of design tokens, or violates a declared anti-pattern. Severity depends on `design.strictness` in config. These violations surface as DESIGN-xxx codes:
|
|
68
|
+
- `DESIGN-001` [warn] — Hardcoded color/font/spacing instead of token reference
|
|
69
|
+
- `DESIGN-002` [warn] — Value matches a project anti-pattern
|
|
70
|
+
- `DESIGN-003` [error] — WCAG contrast ratio failure (error in strict mode)
|
|
71
|
+
- `DESIGN-004` [info] — Missing platform binding for enabled platform
|
|
61
72
|
|
|
62
73
|
3. **Explain the impact.** For each violation, state:
|
|
63
74
|
- WHY the constraint exists (what architectural property it protects)
|
|
64
75
|
- WHAT would happen if the violation were allowed to persist
|
|
65
76
|
- HOW it affects testability, maintainability, and changeability
|
|
66
77
|
|
|
78
|
+
### Phase 3.5: Apply Safe Architecture Fixes
|
|
79
|
+
|
|
80
|
+
Some architecture violations can be auto-fixed. Apply these before surfacing remaining violations.
|
|
81
|
+
|
|
82
|
+
**Import ordering violations:**
|
|
83
|
+
|
|
84
|
+
1. Identify files where imports are not ordered according to the project's layer convention.
|
|
85
|
+
2. Reorder imports: external packages first, then by layer (lowest to highest), then relative imports.
|
|
86
|
+
3. Verify with lint + typecheck. This is a safe, mechanical fix.
|
|
87
|
+
|
|
88
|
+
**Forbidden import replacement (with configured alternative):**
|
|
89
|
+
|
|
90
|
+
1. Check `harness.config.json` for `forbiddenImports` entries that include an `alternative` field.
|
|
91
|
+
2. For each violation where an alternative exists, replace the import path with the alternative.
|
|
92
|
+
3. Verify with typecheck + test. This is "probably safe" -- present as a diff for approval in interactive mode, apply silently in CI mode.
|
|
93
|
+
|
|
94
|
+
**Design token substitution (unambiguous mapping):**
|
|
95
|
+
|
|
96
|
+
1. When a hardcoded value has exactly one matching design token, replace the literal with the token reference.
|
|
97
|
+
2. Verify with typecheck + test.
|
|
98
|
+
3. If the mapping is ambiguous (multiple candidate tokens), surface to user.
|
|
99
|
+
|
|
100
|
+
**Never auto-fix these (always surface to user):**
|
|
101
|
+
|
|
102
|
+
- Upward dependencies
|
|
103
|
+
- Skip-layer dependencies
|
|
104
|
+
- Circular dependencies
|
|
105
|
+
- Forbidden imports without a configured alternative
|
|
106
|
+
|
|
107
|
+
### Phase 3.6: Convergence Loop (Standalone)
|
|
108
|
+
|
|
109
|
+
When running standalone (not through the orchestrator), apply a single-concern convergence loop:
|
|
110
|
+
|
|
111
|
+
1. **Re-run detection.** After applying all safe/probably-safe fixes, run `harness check-deps` again.
|
|
112
|
+
2. **Check if violation count decreased.** Compare the new count to the previous count.
|
|
113
|
+
3. **If decreased: loop.** Fixing one violation can resolve others (e.g., replacing a forbidden import may eliminate a transitive skip-layer violation). Go back to Phase 2 with the new results.
|
|
114
|
+
4. **If unchanged: stop.** Proceed to Phase 4 (Guide Resolution) for remaining violations.
|
|
115
|
+
5. **Maximum iterations: 5.** To prevent infinite loops.
|
|
116
|
+
|
|
117
|
+
**Verification gate:** After each fix batch, run:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
pnpm lint && pnpm tsc --noEmit && pnpm test
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
If any command fails, revert the batch and reclassify those findings as unsafe.
|
|
124
|
+
|
|
67
125
|
### Phase 4: Guide Resolution
|
|
68
126
|
|
|
69
127
|
For each violation, provide a specific fix:
|
|
@@ -71,7 +129,8 @@ For each violation, provide a specific fix:
|
|
|
71
129
|
- **Upward dependency:** Introduce an interface or abstraction in the lower layer. The higher layer implements it; the lower layer depends only on the abstraction. Alternatively, use dependency injection.
|
|
72
130
|
- **Skip-layer dependency:** Route the call through the intermediate layer. Add a method to the Service layer that delegates to the Repository, then have the UI call the Service.
|
|
73
131
|
- **Circular dependency:** Break the cycle by extracting shared types into a common module that both can depend on, or restructure so the dependency flows in one direction only.
|
|
74
|
-
- **Forbidden import:**
|
|
132
|
+
- **Forbidden import:** Check `harness.config.json` for an `alternative` field. If present, this should have been auto-fixed in Phase 3.5. If not present, replace the forbidden import with the approved alternative or restructure the code.
|
|
133
|
+
- **Design constraint violation:** Replace hardcoded values with token references from `design-system/tokens.json`. For anti-pattern violations, consult `design-system/DESIGN.md` for the project's aesthetic intent and approved alternatives. For contrast failures, use `harness-accessibility` to find compliant color pairs.
|
|
75
134
|
|
|
76
135
|
## Common Violation Patterns
|
|
77
136
|
|
|
@@ -87,6 +146,10 @@ Two layers both need the same type definition. Fix: place shared types in the lo
|
|
|
87
146
|
|
|
88
147
|
Test helpers import across layer boundaries for convenience. Fix: each layer's tests should only import from that layer and below. Test utilities should follow the same constraints as production code.
|
|
89
148
|
|
|
149
|
+
### Pattern: "Hardcoded colors in components"
|
|
150
|
+
|
|
151
|
+
A component uses `#3b82f6` directly instead of referencing `color.primary` from the design token system. Fix: import and reference the token. In Tailwind: use the token-mapped utility class. In CSS: use the custom property `var(--color-primary)`.
|
|
152
|
+
|
|
90
153
|
### Pattern: "Circular dependency through re-exports"
|
|
91
154
|
|
|
92
155
|
Module A re-exports from Module B, and Module B imports from Module A. The circular dependency is hidden by the re-export. Fix: identify the true dependency direction and remove the reverse path.
|
|
@@ -96,6 +159,9 @@ Module A re-exports from Module B, and Module B imports from Module A. The circu
|
|
|
96
159
|
- **`harness check-deps`** — Primary tool. Analyzes all imports against the layer model defined in `harness.config.json`. Returns structured violation data including file, line, source layer, target layer, and rule violated.
|
|
97
160
|
- **`harness check-deps --json`** — Machine-readable output for automated pipelines. Use this when parsing results programmatically.
|
|
98
161
|
- **`harness validate`** — Includes dependency checking as part of full project validation. Use when you want a complete health check, not just architecture.
|
|
162
|
+
- **`harness-design-system`** — Provides the design token source of truth (`tokens.json`) that constraints validate against.
|
|
163
|
+
- **`harness-accessibility`** — Provides WCAG contrast validation used by DESIGN-003 constraints.
|
|
164
|
+
- **Design constraint category** — Controlled by `design.strictness` in `harness.config.json`. Design violations surface alongside architectural violations in the same report.
|
|
99
165
|
|
|
100
166
|
## Success Criteria
|
|
101
167
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
name: enforce-architecture
|
|
2
|
-
version: "1.
|
|
3
|
-
description: Validate architectural layer boundaries and
|
|
2
|
+
version: "1.1.0"
|
|
3
|
+
description: Validate architectural layer boundaries, detect violations, and auto-fix import ordering and forbidden import replacement
|
|
4
4
|
cognitive_mode: meticulous-verifier
|
|
5
5
|
triggers:
|
|
6
6
|
- manual
|
|
@@ -19,6 +19,9 @@ cli:
|
|
|
19
19
|
- name: path
|
|
20
20
|
description: Project root path
|
|
21
21
|
required: false
|
|
22
|
+
- name: fix
|
|
23
|
+
description: Enable auto-fix with convergence loop
|
|
24
|
+
required: false
|
|
22
25
|
mcp:
|
|
23
26
|
tool: run_skill
|
|
24
27
|
input:
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# Harness Accessibility
|
|
2
|
+
|
|
3
|
+
> WCAG compliance verification and remediation. Scan components for accessibility violations, evaluate severity against design strictness, generate actionable reports, and apply automated fixes for mechanical issues.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Auditing new or existing UI components for WCAG AA accessibility compliance
|
|
8
|
+
- Before PR merge to catch accessibility regressions in UI changes
|
|
9
|
+
- When `on_new_feature` triggers fire and the feature includes UI components
|
|
10
|
+
- When design tokens change (color updates may break contrast compliance)
|
|
11
|
+
- After running harness-design-system to validate the generated palette
|
|
12
|
+
- When `on_project_init` triggers fire to establish an accessibility baseline
|
|
13
|
+
- NOT for design token generation or palette selection (use harness-design-system)
|
|
14
|
+
- NOT for visual design review or aesthetic direction (use harness-design, Phase 4)
|
|
15
|
+
- NOT for non-UI code (backend services, CLI tools, data pipelines)
|
|
16
|
+
|
|
17
|
+
## Process
|
|
18
|
+
|
|
19
|
+
### Phase 1: SCAN -- Detect Accessibility Violations
|
|
20
|
+
|
|
21
|
+
1. **Load design tokens.** Read `design-system/tokens.json` (if it exists) to identify declared color values and contrast pairs. Token-defined colors are the source of truth -- hardcoded colors in components are themselves a violation.
|
|
22
|
+
|
|
23
|
+
2. **Read design strictness.** Check `harness.config.json` for `design.strictness`:
|
|
24
|
+
- `strict` -- all findings are errors that block (CI fails, PR cannot merge)
|
|
25
|
+
- `standard` -- warnings are visible, errors block (default behavior)
|
|
26
|
+
- `permissive` -- all findings are informational (nothing blocks, but everything is reported)
|
|
27
|
+
|
|
28
|
+
2.5. **Check for i18n skill overlap.** Read `harness.config.json` for `i18n.enabled`:
|
|
29
|
+
|
|
30
|
+
- If `i18n.enabled: true`, **defer** `lang` and `dir` attribute checks to `harness-i18n`. Do not scan for missing `lang` on `<html>` or missing `dir` on user-content containers -- those checks are covered by the i18n skill's scan phase with more context (locale-aware, RTL-aware).
|
|
31
|
+
- If `i18n.enabled` is false or absent, scan for `lang`/`dir` as normal (these remain part of the accessibility audit).
|
|
32
|
+
- This deduplication prevents the same finding from appearing in both the accessibility report and the i18n report.
|
|
33
|
+
|
|
34
|
+
3. **Scan component files.** Search all files matching `.tsx`, `.jsx`, `.vue`, `.svelte`, `.html` for the following violations:
|
|
35
|
+
|
|
36
|
+
**Images and media:**
|
|
37
|
+
- `<img>` tags without `alt` attribute (`A11Y-001`)
|
|
38
|
+
- `<img>` tags with empty `alt=""` on non-decorative images (`A11Y-002`)
|
|
39
|
+
- `<video>` and `<audio>` without captions/transcripts (`A11Y-003`)
|
|
40
|
+
|
|
41
|
+
**ARIA and semantics:**
|
|
42
|
+
- Interactive elements (`<button>`, `<a>`, `<input>`) without accessible labels (`A11Y-010`)
|
|
43
|
+
- Icon-only buttons without `aria-label` or visually hidden text (`A11Y-011`)
|
|
44
|
+
- Clickable `<div>` or `<span>` without `role="button"` and keyboard handler (`A11Y-012`)
|
|
45
|
+
- Missing `role` attributes on custom interactive widgets (`A11Y-013`)
|
|
46
|
+
- `aria-hidden="true"` on focusable elements (`A11Y-014`)
|
|
47
|
+
|
|
48
|
+
**Heading structure:**
|
|
49
|
+
- Non-sequential heading levels (e.g., `<h1>` followed by `<h3>`, skipping `<h2>`) (`A11Y-020`)
|
|
50
|
+
- Multiple `<h1>` elements on a single page/component (`A11Y-021`)
|
|
51
|
+
- Empty headings (`A11Y-022`)
|
|
52
|
+
|
|
53
|
+
**Color and contrast:**
|
|
54
|
+
- Hardcoded color values not from the token set (`A11Y-030`)
|
|
55
|
+
- Inline styles with color/background-color that may fail contrast (`A11Y-031`)
|
|
56
|
+
|
|
57
|
+
**Keyboard navigation:**
|
|
58
|
+
- `onClick` handlers without corresponding `onKeyDown`/`onKeyUp` (`A11Y-040`)
|
|
59
|
+
- Missing `tabIndex` on custom interactive elements (`A11Y-041`)
|
|
60
|
+
- Positive `tabIndex` values (disrupts natural tab order) (`A11Y-042`)
|
|
61
|
+
- Missing focus indicators (`:focus` or `:focus-visible` styles) (`A11Y-043`)
|
|
62
|
+
|
|
63
|
+
**Forms:**
|
|
64
|
+
- `<input>`, `<select>`, `<textarea>` without associated `<label>` or `aria-label` (`A11Y-050`)
|
|
65
|
+
- Missing `id` attributes on form controls (needed for label association) (`A11Y-051`)
|
|
66
|
+
- Missing error messages or `aria-invalid` on validation states (`A11Y-052`)
|
|
67
|
+
|
|
68
|
+
4. **Load anti-pattern catalogs.** Read additional detection rules from `agents/skills/shared/design-knowledge/` if available. These catalogs contain industry-specific accessibility patterns (e.g., healthcare forms require higher contrast, fintech requires screen reader-compatible data tables).
|
|
69
|
+
|
|
70
|
+
5. **Record all findings.** Each finding includes:
|
|
71
|
+
- File path
|
|
72
|
+
- Line number (approximate, from Grep output)
|
|
73
|
+
- Violation code (e.g., `A11Y-001`)
|
|
74
|
+
- Element or pattern that triggered the finding
|
|
75
|
+
- Raw evidence (the matching line of code)
|
|
76
|
+
|
|
77
|
+
### Phase 2: EVALUATE -- Assess Severity and Categorize
|
|
78
|
+
|
|
79
|
+
1. **Assign severity based on `design.strictness`:**
|
|
80
|
+
- `strict` mode: all violations are `error` severity
|
|
81
|
+
- `standard` mode: missing alt, missing labels, contrast failures are `error`; heading order, tabIndex are `warn`; informational patterns are `info`
|
|
82
|
+
- `permissive` mode: contrast failures and missing labels are `warn`; everything else is `info`
|
|
83
|
+
|
|
84
|
+
2. **Calculate contrast ratios.** For every color pair found in scanned code:
|
|
85
|
+
- Extract foreground and background colors (from inline styles, class mappings, or token references)
|
|
86
|
+
- Calculate relative luminance for each color using the WCAG 2.1 formula:
|
|
87
|
+
- `L = 0.2126 * R + 0.7152 * G + 0.0722 * B` (where R, G, B are linearized sRGB values)
|
|
88
|
+
- Calculate contrast ratio: `(L1 + 0.05) / (L2 + 0.05)` where L1 is the lighter color
|
|
89
|
+
- Compare against thresholds:
|
|
90
|
+
- Normal text (< 18px regular, < 14px bold): 4.5:1 minimum (WCAG AA)
|
|
91
|
+
- Large text (>= 18px regular, >= 14px bold): 3:1 minimum (WCAG AA)
|
|
92
|
+
|
|
93
|
+
3. **Cross-reference with design tokens.** If `design-system/tokens.json` exists:
|
|
94
|
+
- Map hardcoded colors in code to their nearest token equivalents
|
|
95
|
+
- If a token-based color pair fails contrast, flag the **token definition** (not just the component usage) -- the fix belongs in harness-design-system, not here
|
|
96
|
+
- If a hardcoded color fails contrast, flag both the contrast issue and the non-token usage
|
|
97
|
+
|
|
98
|
+
4. **Check graph constraints.** If a graph exists at `.harness/graph/`, use `DesignConstraintAdapter` from `packages/graph/src/constraints/DesignConstraintAdapter.ts` to:
|
|
99
|
+
- Query for existing `VIOLATES` edges (violations already recorded in the graph)
|
|
100
|
+
- Add new `VIOLATES` edges for findings from this scan
|
|
101
|
+
- The adapter reads `design.strictness` to control which violations produce edges
|
|
102
|
+
|
|
103
|
+
5. **Categorize findings.** Group into categories:
|
|
104
|
+
- **Contrast** (A11Y-030, A11Y-031): color-related violations
|
|
105
|
+
- **ARIA** (A11Y-010 through A11Y-014): attribute and role violations
|
|
106
|
+
- **Semantics** (A11Y-020 through A11Y-022): heading and structure violations
|
|
107
|
+
- **Keyboard** (A11Y-040 through A11Y-043): navigation and focus violations
|
|
108
|
+
- **Forms** (A11Y-050 through A11Y-052): form control violations
|
|
109
|
+
- **Media** (A11Y-001 through A11Y-003): image, video, audio violations
|
|
110
|
+
|
|
111
|
+
### Phase 3: REPORT -- Generate Accessibility Report
|
|
112
|
+
|
|
113
|
+
1. **Generate summary header:**
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Accessibility Report
|
|
117
|
+
====================
|
|
118
|
+
Scanned: 42 component files
|
|
119
|
+
Findings: 18 total (6 error, 8 warn, 4 info)
|
|
120
|
+
Strictness: standard
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
2. **List findings grouped by category.** Each finding follows this format:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
A11Y-001 [error] Missing alt attribute on <img>
|
|
127
|
+
File: src/components/UserAvatar.tsx
|
|
128
|
+
Line: 24
|
|
129
|
+
Element: <img src={user.avatarUrl} className="avatar" />
|
|
130
|
+
WCAG: 1.1.1 Non-text Content
|
|
131
|
+
Fix: Add alt={user.name} or alt="" if decorative
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
A11Y-031 [error] Contrast ratio 2.8:1 fails WCAG AA (requires 4.5:1)
|
|
136
|
+
File: src/components/Button.tsx
|
|
137
|
+
Line: 15
|
|
138
|
+
Element: color: #999 on background: #fff
|
|
139
|
+
WCAG: 1.4.3 Contrast (Minimum)
|
|
140
|
+
Fix: Use color token "neutral.600" (#475569, ratio 4.9:1) instead
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
3. **Provide category summaries** with counts and severity breakdown.
|
|
144
|
+
|
|
145
|
+
4. **List actionable next steps:**
|
|
146
|
+
- Errors that can be auto-fixed (Phase 4)
|
|
147
|
+
- Errors that require human judgment
|
|
148
|
+
- Warnings to address in next iteration
|
|
149
|
+
- Token-level issues to escalate to harness-design-system
|
|
150
|
+
|
|
151
|
+
### Phase 4: FIX -- Apply Automated Remediation (Optional)
|
|
152
|
+
|
|
153
|
+
This phase is optional. It applies fixes only for **mechanical issues** -- violations with a single, unambiguous correct fix. Subjective issues (color choices, layout decisions, content writing) are never auto-fixed.
|
|
154
|
+
|
|
155
|
+
1. **Fixable violations:**
|
|
156
|
+
- `A11Y-001`: Add `alt=""` to `<img>` tags that are decorative (inside `<button>`, `<a>`, or with `role="presentation"`)
|
|
157
|
+
- `A11Y-011`: Add `aria-label` to icon-only `<button>` elements (using the icon name as label)
|
|
158
|
+
- `A11Y-012`: Add `role="button"` and `tabIndex={0}` to clickable `<div>` elements
|
|
159
|
+
- `A11Y-041`: Add `tabIndex={0}` to custom interactive elements missing it
|
|
160
|
+
- `A11Y-051`: Generate `id` attributes for form controls and link them to labels
|
|
161
|
+
|
|
162
|
+
2. **Apply each fix as a minimal, targeted edit.** Use the Edit tool. Do not refactor surrounding code. Do not change formatting. The fix should be the smallest possible change that resolves the violation.
|
|
163
|
+
|
|
164
|
+
3. **Show before/after diff for each fix.** Present the exact change to the user. This is a hard gate -- no fix is applied without showing the diff first.
|
|
165
|
+
|
|
166
|
+
4. **Re-scan after fixes.** Run the scan phase again on fixed files to confirm violations are resolved. Report:
|
|
167
|
+
- Fixes applied: N
|
|
168
|
+
- Violations resolved: N
|
|
169
|
+
- Remaining violations (require human judgment): M
|
|
170
|
+
|
|
171
|
+
5. **Do NOT fix:**
|
|
172
|
+
- Color choices (subjective -- escalate to harness-design-system)
|
|
173
|
+
- Content for alt text on meaningful images (requires human judgment about image meaning)
|
|
174
|
+
- Layout and heading structure changes (may affect design intent)
|
|
175
|
+
- Any fix that would change the visual appearance of the component
|
|
176
|
+
|
|
177
|
+
## Harness Integration
|
|
178
|
+
|
|
179
|
+
- **`harness validate`** -- Accessibility findings surface as design constraint violations when `design.strictness` is `strict` or `standard`. Running validate after a scan reflects the current a11y state.
|
|
180
|
+
- **`harness scan`** -- Refresh the knowledge graph after fixes to update `VIOLATES` edges. Ensures impact analysis stays current.
|
|
181
|
+
- **`DesignConstraintAdapter`** (`packages/graph/src/constraints/DesignConstraintAdapter.ts`) -- Reads `design.strictness` from project config to control violation severity. Manages `VIOLATES` edges in the graph for design and accessibility constraints.
|
|
182
|
+
- **`DesignIngestor`** (`packages/graph/src/ingest/DesignIngestor.ts`) -- Provides token data used for contrast checking. The ingestor parses `tokens.json` so the accessibility scanner can compare code colors against declared tokens.
|
|
183
|
+
- **`harness-impact-analysis`** -- When tokens change (palette update, new colors), impact analysis traces affected components. The accessibility skill uses this to determine which components need re-scanning.
|
|
184
|
+
- **`harness-design-system`** -- Dependency. When contrast failures originate from token definitions (not component code), escalate to harness-design-system to fix at the source.
|
|
185
|
+
- **`harness-i18n` deduplication** -- When `i18n.enabled: true` in config, `lang` and `dir` attribute checks are deferred to the i18n skill. This prevents duplicate findings across the accessibility and i18n reports. When i18n is not enabled, these checks remain part of the accessibility scan.
|
|
186
|
+
|
|
187
|
+
## Success Criteria
|
|
188
|
+
|
|
189
|
+
- All scanned component files have findings categorized by severity (`error`, `warn`, `info`)
|
|
190
|
+
- Contrast failures detected with correct ratios and WCAG criterion references
|
|
191
|
+
- Missing ARIA attributes flagged with specific file paths and line numbers
|
|
192
|
+
- Non-sequential heading hierarchy violations identified
|
|
193
|
+
- Keyboard navigation gaps (missing handlers, broken tab order) detected
|
|
194
|
+
- Form accessibility issues (missing labels, missing error states) found
|
|
195
|
+
- Report generated with violation codes, WCAG references, and actionable remediation
|
|
196
|
+
- Automated fixes applied without breaking existing functionality or tests
|
|
197
|
+
- `harness validate` reflects accessibility findings at the configured strictness level
|
|
198
|
+
- Token-level contrast issues escalated to harness-design-system (not fixed locally)
|
|
199
|
+
|
|
200
|
+
## Examples
|
|
201
|
+
|
|
202
|
+
### Example: Scanning a React Dashboard Component
|
|
203
|
+
|
|
204
|
+
**Context:** A React component `DashboardCard.tsx` with known accessibility issues.
|
|
205
|
+
|
|
206
|
+
**Source file:**
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
// src/components/DashboardCard.tsx
|
|
210
|
+
export function DashboardCard({ title, value, icon, onClick }) {
|
|
211
|
+
return (
|
|
212
|
+
<div className="card" onClick={onClick}>
|
|
213
|
+
<img src={icon} />
|
|
214
|
+
<h3>{title}</h3>
|
|
215
|
+
<span style={{ color: '#999', fontSize: '14px' }}>{value}</span>
|
|
216
|
+
</div>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**SCAN findings:**
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
A11Y-001 [error] Missing alt attribute on <img>
|
|
225
|
+
File: src/components/DashboardCard.tsx
|
|
226
|
+
Line: 5
|
|
227
|
+
Element: <img src={icon} />
|
|
228
|
+
WCAG: 1.1.1 Non-text Content
|
|
229
|
+
|
|
230
|
+
A11Y-012 [error] Clickable <div> without role="button" and keyboard handler
|
|
231
|
+
File: src/components/DashboardCard.tsx
|
|
232
|
+
Line: 4
|
|
233
|
+
Element: <div className="card" onClick={onClick}>
|
|
234
|
+
WCAG: 2.1.1 Keyboard
|
|
235
|
+
|
|
236
|
+
A11Y-031 [warn] Contrast ratio 2.8:1 for #999 on #fff fails WCAG AA
|
|
237
|
+
File: src/components/DashboardCard.tsx
|
|
238
|
+
Line: 7
|
|
239
|
+
Element: <span style={{ color: '#999' }}>
|
|
240
|
+
WCAG: 1.4.3 Contrast (Minimum)
|
|
241
|
+
Note: Hardcoded color -- not from token set
|
|
242
|
+
|
|
243
|
+
A11Y-030 [info] Hardcoded color value not from design token set
|
|
244
|
+
File: src/components/DashboardCard.tsx
|
|
245
|
+
Line: 7
|
|
246
|
+
Element: color: '#999'
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**FIX phase (auto-fixable only):**
|
|
250
|
+
|
|
251
|
+
```diff
|
|
252
|
+
- <img src={icon} />
|
|
253
|
+
+ <img src={icon} alt="" />
|
|
254
|
+
|
|
255
|
+
- <div className="card" onClick={onClick}>
|
|
256
|
+
+ <div className="card" role="button" tabIndex={0} onClick={onClick} onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') onClick?.(); }}>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
**Remaining (requires human judgment):**
|
|
260
|
+
|
|
261
|
+
- `A11Y-031`: Contrast failure -- fix requires choosing a darker color. Escalate to design tokens or get human input on replacement color.
|
|
262
|
+
- `A11Y-001`: The `alt=""` fix assumes decorative. If the icon conveys meaning, human must write descriptive alt text.
|
|
263
|
+
|
|
264
|
+
## Gates
|
|
265
|
+
|
|
266
|
+
These are hard stops. Violating any gate means the process has broken down.
|
|
267
|
+
|
|
268
|
+
- **No component marked "accessible" without passing WCAG AA contrast checks.** A passing scan means zero `error`-severity contrast violations, not zero findings overall.
|
|
269
|
+
- **No automated fix applied without showing the before/after diff.** Every fix must be presented to the user with the exact code change before being written to disk.
|
|
270
|
+
- **No severity downgrade below what `design.strictness` config specifies.** If the project is in `strict` mode, a missing alt attribute is an error. The scanner does not get to decide it is a warning.
|
|
271
|
+
- **The scan phase must complete before evaluate.** No partial evaluations on incomplete scan results. All files must be scanned before severity assignment begins.
|
|
272
|
+
- **No fixes that change visual appearance.** Automated fixes are structural (adding attributes, roles, handlers). If a fix would visibly change the rendered output, it requires human approval.
|
|
273
|
+
|
|
274
|
+
## Escalation
|
|
275
|
+
|
|
276
|
+
- **When contrast ratio is borderline (4.5:1 to 5:1):** Flag for human review rather than auto-passing. Report: "Contrast ratio 4.6:1 technically passes WCAG AA but is borderline. Consider using a higher-contrast alternative for better readability."
|
|
277
|
+
- **When a component has more than 10 findings:** Suggest architectural refactoring rather than piecemeal fixes. The component likely has systemic accessibility issues that individual fixes will not adequately address. Recommend: "This component has 14 accessibility findings. Consider refactoring to use accessible base components rather than fixing each issue individually."
|
|
278
|
+
- **When design tokens themselves have contrast failures:** Do not fix at the usage site. Escalate to harness-design-system: "Token pair primary-500 on neutral-50 has contrast ratio 3.2:1. This must be fixed in design-system/tokens.json, not in individual components. Run harness-design-system to update the palette."
|
|
279
|
+
- **When automated fix would change visual appearance:** Require explicit human approval. Present the fix with a note: "This fix changes the rendered output. The current <div> will become keyboard-focusable with a visible focus ring. Approve this change?"
|
|
280
|
+
- **When `design.strictness` is not configured:** Default to `standard` mode. Report: "No design.strictness found in harness.config.json. Using 'standard' (warnings visible, errors block). Set design.strictness in config to customize."
|
|
281
|
+
- **After 3 failed attempts to resolve a contrast issue:** The color pair may be fundamentally incompatible. Suggest: "Consider using a different color combination. The current pair cannot achieve WCAG AA compliance without changing one of the colors significantly."
|