From b0b33e074c79ecc523dbaed54a11747c26c30976 Mon Sep 17 00:00:00 2001 From: Andrew Nesbitt Date: Tue, 6 Oct 2026 09:50:09 +0200 Subject: [PATCH] Detect accessibility statements as community resources --- README.md | 4 +- cmd/brief/accessibility_test.go | 63 +++++++++++++++++++++++++++++++ knowledge/_shared/_resources.toml | 8 ++++ 3 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 cmd/brief/accessibility_test.go diff --git a/README.md b/README.md index 82b721e..e8885a8 100644 --- a/README.md +++ b/README.md @@ -277,9 +277,9 @@ Data sources: [ecosyste.ms](https://ecosyste.ms) for published package metadata, ## Resources -Alongside the toolchain, brief picks up the conventional documents that describe how a project is run. README, changelog, roadmap, and license (with detected SPDX identifier) are reported at the top level. Everything else is grouped: legal covers copyright, NOTICE, DCO, and CLA files; community covers contributing guides, code of conduct, support, governance, maintainers, authors, CODEOWNERS, and DEI statements; security covers the security policy, threat model, and audit reports; metadata covers machine-readable files like FUNDING, CITATION.cff, publiccode.yml, codemeta.json, and .zenodo.json; agents covers AI coding tool instruction files including AGENTS.md, CLAUDE.md, GEMINI.md, .cursorrules, .windsurfrules, .github/copilot-instructions.md, .aider.conf.yml, .clinerules, .rules, .junie/guidelines.md, replit.md, .continuerules, .augment-guidelines, and .roorules. +Alongside the toolchain, brief picks up the conventional documents that describe how a project is run. README, changelog, roadmap, and license (with detected SPDX identifier) are reported at the top level. Everything else is grouped: legal covers copyright, NOTICE, DCO, and CLA files; community covers accessibility statements, contributing guides, code of conduct, support, governance, maintainers, authors, CODEOWNERS, and DEI statements; security covers the security policy, threat model, and audit reports; metadata covers machine-readable files like FUNDING, CITATION.cff, publiccode.yml, codemeta.json, and .zenodo.json; agents covers AI coding tool instruction files including AGENTS.md, CLAUDE.md, GEMINI.md, .cursorrules, .windsurfrules, .github/copilot-instructions.md, .aider.conf.yml, .clinerules, .rules, .junie/guidelines.md, replit.md, .continuerules, .augment-guidelines, and .roorules. -Matching is case-insensitive and checks the repo root first, then `docs/`, `.github/`, and `.gitlab/`. Paths in the output are repo-relative, so a funding file found under `.github/` is reported as `.github/FUNDING.yml` rather than just the basename. In JSON the groups appear as nested objects under `resources.legal`, `resources.community`, `resources.security`, `resources.metadata`, and `resources.agents`. +Matching is case-insensitive and checks the repo root first, then each resource's configured directories, usually `docs/`, `.github/`, and `.gitlab/`. Accessibility documents are checked in the root, `.github/`, `docs/`, and `.gitlab/`, in that order, and reported as `resources.community.accessibility`. Supported names are `ACCESSIBILITY`, `ACCESSIBILITY.md`, `ACCESSIBILITY.txt`, `ACCESSIBILITY.rst`, and `ACCESSIBILITY.adoc`. Paths in the output are repo-relative, so a funding file found under `.github/` is reported as `.github/FUNDING.yml` rather than just the basename. In JSON the groups appear as nested objects under `resources.legal`, `resources.community`, `resources.security`, `resources.metadata`, and `resources.agents`. Issue and pull request templates are reported under `resources.templates` so that contributors and coding agents can find and follow them. Unlike the single-path resources above this is a list: every template file found is included, split into `issue` and `pull_request` arrays plus a `config` path for the issue chooser. Detection covers the locations recognised by GitHub, GitLab, Gitea, and Forgejo, which means the repo root, `docs/`, `.github/`, `.gitea/`, `.forgejo/`, and `.gitlab/`, in both single-file form (`PULL_REQUEST_TEMPLATE.md`, `issue_template.md`) and directory form (`ISSUE_TEMPLATE/`, `PULL_REQUEST_TEMPLATE/`, GitLab's `issue_templates/` and `merge_request_templates/`). Merge request templates are reported under `pull_request` rather than getting their own field. diff --git a/cmd/brief/accessibility_test.go b/cmd/brief/accessibility_test.go new file mode 100644 index 0000000..a88057c --- /dev/null +++ b/cmd/brief/accessibility_test.go @@ -0,0 +1,63 @@ +package main + +import ( + "encoding/json" + "os" + "os/exec" + "testing" + + "github.com/git-pkgs/brief" +) + +func TestScanAccessibility(t *testing.T) { + const helperEnv = "BRIEF_ACCESSIBILITY_HELPER_ROOT" + if root := os.Getenv(helperEnv); root != "" { + cmdScan([]string{"-json", root}) + return + } + for _, tt := range []struct { + name string + files []string + want string + }{ + {"root", []string{"ACCESSIBILITY.md"}, "ACCESSIBILITY.md"}, + {"github", []string{".github/ACCESSIBILITY.md"}, ".github/ACCESSIBILITY.md"}, + {"docs", []string{"docs/ACCESSIBILITY.md"}, "docs/ACCESSIBILITY.md"}, + {"gitlab", []string{".gitlab/ACCESSIBILITY.md"}, ".gitlab/ACCESSIBILITY.md"}, + {"no extension", []string{"ACCESSIBILITY"}, "ACCESSIBILITY"}, + {"text", []string{".github/ACCESSIBILITY.txt"}, ".github/ACCESSIBILITY.txt"}, + {"restructuredtext", []string{"docs/ACCESSIBILITY.rst"}, "docs/ACCESSIBILITY.rst"}, + {"asciidoc", []string{".gitlab/ACCESSIBILITY.adoc"}, ".gitlab/ACCESSIBILITY.adoc"}, + {"mixed case", []string{"docs/Accessibility.MD"}, "docs/Accessibility.MD"}, + {"root precedence", []string{"ACCESSIBILITY.md", ".github/ACCESSIBILITY.md", "docs/ACCESSIBILITY.md"}, "ACCESSIBILITY.md"}, + {"github precedence", []string{".github/ACCESSIBILITY.md", "docs/ACCESSIBILITY.md"}, ".github/ACCESSIBILITY.md"}, + {"docs precedence", []string{"docs/ACCESSIBILITY.md", ".gitlab/ACCESSIBILITY.md"}, "docs/ACCESSIBILITY.md"}, + {"similar names", []string{"ACCESSIBILITY.md.bak", "docs/Accessibility-Testing.md"}, ""}, + {"unrelated directory", []string{"src/ACCESSIBILITY.md"}, ""}, + {"absent", nil, ""}, + } { + t.Run(tt.name, func(t *testing.T) { + root := t.TempDir() + writeScanFixture(t, root, "README.md", "# Example project\n") + for _, path := range tt.files { + writeScanFixture(t, root, path, "# Accessibility\n\nReport accessibility barriers through the issue tracker.\n") + } + cmd := exec.Command(os.Args[0], "-test.run=^TestScanAccessibility$") + cmd.Env = append(os.Environ(), helperEnv+"="+root, "PATH=") + out, err := cmd.Output() + if err != nil { + t.Fatalf("scan failed: %v", err) + } + var report brief.Report + if err := json.Unmarshal(out, &report); err != nil { + t.Fatalf("parsing scan output: %v\n%s", err, out) + } + if report.Resources == nil { + t.Fatal("expected resources") + } + if got := report.Resources.Community["accessibility"]; got != tt.want { + t.Errorf("community.accessibility = %q, want %q", got, tt.want) + } + }) + } +} diff --git a/knowledge/_shared/_resources.toml b/knowledge/_shared/_resources.toml index ec433bf..e7e4c18 100644 --- a/knowledge/_shared/_resources.toml +++ b/knowledge/_shared/_resources.toml @@ -64,6 +64,14 @@ dirs = ["docs", ".github", ".gitlab"] # Community +[[resources]] +[resources.resource] +name = "Accessibility" +field = "accessibility" +group = "community" +patterns = ["accessibility", "accessibility.md", "accessibility.txt", "accessibility.rst", "accessibility.adoc"] +dirs = [".github", "docs", ".gitlab"] + [[resources]] [resources.resource] name = "Contributing"