|
| 1 | +{:project "Scharf" |
| 2 | + :repository "github.com/cybrota/scharf" |
| 3 | + :version "0.1.0" |
| 4 | + :language :go |
| 5 | + :go-version "1.25.0" |
| 6 | + :summary |
| 7 | + "Go CLI that audits GitHub Actions workflows for mutable third-party action references, pins them to immutable SHAs, and upgrades Scharf-managed pinned SHAs." |
| 8 | + |
| 9 | + :preamble |
| 10 | + "Small Go CLI repository. Prefer simple package-level changes, keep command wiring in main.go, keep GitHub/network behavior behind network and scanner helpers, and preserve the existing Scharf pin format `owner/repo@<sha> # <version>`." |
| 11 | + |
| 12 | + :entrypoints |
| 13 | + [{:id :cli |
| 14 | + :path "main.go" |
| 15 | + :description "Cobra command tree and user-facing CLI behavior"} |
| 16 | + {:id :module |
| 17 | + :path "go.mod" |
| 18 | + :description "Go module github.com/cybrota/scharf"}] |
| 19 | + |
| 20 | + :commands |
| 21 | + {:deps-download "go mod download" |
| 22 | + :deps-tidy "go mod tidy" |
| 23 | + :format "gofmt -w ." |
| 24 | + :test "go test ./..." |
| 25 | + :test-verbose "go test -v ./..." |
| 26 | + :test-package "go test ./scanner" |
| 27 | + :vet "go vet ./..." |
| 28 | + :vulncheck "govulncheck ./..." |
| 29 | + :build "go build ./..." |
| 30 | + :build-cli "go build -o scharf ." |
| 31 | + :run-audit "go run . audit ." |
| 32 | + :run-audit-raise-error "go run . audit . --raise-error" |
| 33 | + :run-autofix-dry-run "go run . autofix . --dry-run" |
| 34 | + :run-upgrade-all-dry-run "go run . upgrade-all-sha . --dry-run" |
| 35 | + :release-snapshot "goreleaser release --snapshot --clean" |
| 36 | + :security-semgrep "semgrep scan"} |
| 37 | + |
| 38 | + :verified-commands |
| 39 | + [{:name :test |
| 40 | + :command "go test ./..." |
| 41 | + :description "Primary local and CI test suite"} |
| 42 | + {:name :vet |
| 43 | + :command "go vet ./..." |
| 44 | + :description "Required by AGENTS.md before commits"} |
| 45 | + {:name :vulncheck |
| 46 | + :command "govulncheck ./..." |
| 47 | + :description "Required security check; install golang.org/x/vuln/cmd/govulncheck if missing"} |
| 48 | + {:name :format |
| 49 | + :command "gofmt -w ." |
| 50 | + :description "Formatter for Go source files"} |
| 51 | + {:name :build |
| 52 | + :command "go build ./..." |
| 53 | + :description "Compile all packages"}] |
| 54 | + |
| 55 | + :cli |
| 56 | + {:binary "scharf" |
| 57 | + :commands |
| 58 | + [{:name "audit" |
| 59 | + :example "go run . audit ." |
| 60 | + :description "Scan a local or remote Git repository for mutable GitHub Action references"} |
| 61 | + {:name "autofix" |
| 62 | + :example "go run . autofix . --dry-run" |
| 63 | + :description "Rewrite mutable workflow action refs to immutable SHAs; use --dry-run before writing"} |
| 64 | + {:name "find" |
| 65 | + :example "go run . find --root /path/to/workspace --out csv" |
| 66 | + :description "Scan multiple repositories under a workspace and write findings.csv or findings.json"} |
| 67 | + {:name "list" |
| 68 | + :example "go run . list actions/checkout" |
| 69 | + :description "List tags and SHAs for a GitHub Action repository"} |
| 70 | + {:name "lookup" |
| 71 | + :example "go run . lookup actions/checkout@v4" |
| 72 | + :description "Resolve one action ref to its commit SHA"} |
| 73 | + {:name "upgrade" |
| 74 | + :example "go run . upgrade actions/checkout@v4 --dry-run" |
| 75 | + :description "Compute the next tag/SHA for one action ref"} |
| 76 | + {:name "upgrade-all-sha" |
| 77 | + :example "go run . upgrade-all-sha . --dry-run" |
| 78 | + :description "Upgrade Scharf-formatted pinned SHA refs in workflow files"}]} |
| 79 | + |
| 80 | + :modules |
| 81 | + [{:id :cli |
| 82 | + :path "main.go" |
| 83 | + :tests ["main_test.go"] |
| 84 | + :responsibility "Cobra command setup, CLI flags, output file writers, version display, and high-level orchestration"} |
| 85 | + {:id :scanner |
| 86 | + :path "scanner/**" |
| 87 | + :tests ["scanner/*_test.go"] |
| 88 | + :responsibility "Workflow discovery, mutable-ref scanning, audit formatting, autofix replacement, and pinned-SHA upgrade flows"} |
| 89 | + {:id :network |
| 90 | + :path "network/**" |
| 91 | + :tests ["network/*_test.go"] |
| 92 | + :responsibility "GitHub API calls, action ref resolution, tag listing, next-version lookup, cooldown checks, and optional GITHUB_TOKEN auth"} |
| 93 | + {:id :git |
| 94 | + :path "git/**" |
| 95 | + :tests ["git/*_test.go"] |
| 96 | + :responsibility "Local Git repository inspection, branch enumeration, and remote clone-to-temp helpers"} |
| 97 | + {:id :actcache |
| 98 | + :path "actcache/**" |
| 99 | + :tests ["actcache/*_test.go"] |
| 100 | + :responsibility "Scharf cache file handling under ~/.scharf/cache.json"} |
| 101 | + {:id :logging |
| 102 | + :path "logging/**" |
| 103 | + :tests ["logging/*_test.go" "logging/loggging_test.go"] |
| 104 | + :responsibility "Shared logger construction"} |
| 105 | + {:id :ci |
| 106 | + :path ".github/workflows/**" |
| 107 | + :responsibility "Pinned GitHub Actions CI, release, and security scans"} |
| 108 | + {:id :release |
| 109 | + :path ".goreleaser.yaml" |
| 110 | + :responsibility "Cross-platform release build configuration"} |
| 111 | + {:id :docs |
| 112 | + :path "docs/**" |
| 113 | + :responsibility "Architectural decision records for non-trivial design choices"}] |
| 114 | + |
| 115 | + :rules |
| 116 | + [{:type :allow-edit |
| 117 | + :agent :codex |
| 118 | + :pattern "**/*.go"} |
| 119 | + {:type :allow-edit |
| 120 | + :agent :codex |
| 121 | + :pattern "**/*.yaml"} |
| 122 | + {:type :allow-edit |
| 123 | + :agent :codex |
| 124 | + :pattern "**/*.yml"} |
| 125 | + {:type :allow-edit |
| 126 | + :agent :codex |
| 127 | + :pattern "**/*.md"} |
| 128 | + {:type :allow-edit |
| 129 | + :agent :codex |
| 130 | + :pattern "**/.gitignore"} |
| 131 | + {:type :allow-edit |
| 132 | + :agent :codex |
| 133 | + :pattern "**/*.sh"}] |
| 134 | + |
| 135 | + :quality-gates |
| 136 | + [{:name :required-before-commit |
| 137 | + :commands [:format :test :vet :vulncheck]} |
| 138 | + {:name :ci |
| 139 | + :commands [:deps-download :test]} |
| 140 | + {:name :security |
| 141 | + :commands [:security-semgrep :vulncheck]}] |
| 142 | + |
| 143 | + :conventions |
| 144 | + {:branch-names "Use type/short-topic, for example feat/add-s3-backup." |
| 145 | + :comments "Comment why a non-obvious behavior exists; avoid restating what the code says." |
| 146 | + :errors "Wrap lower-level errors with context using fmt.Errorf and %w where callers need the original error." |
| 147 | + :github-actions "Keep third-party actions pinned to immutable SHAs with version comments." |
| 148 | + :remote-audit "audit, autofix, and upgrade-all-sha may clone remote repositories into /tmp/scharf-repo-*." |
| 149 | + :cache "Resolver cache lives at ~/.scharf/cache.json and may affect local CLI behavior."} |
| 150 | + |
| 151 | + :external-services |
| 152 | + [{:name :github-api |
| 153 | + :base-url "https://api.github.com/repos" |
| 154 | + :env ["GITHUB_TOKEN"] |
| 155 | + :used-by [:network] |
| 156 | + :notes "Use GITHUB_TOKEN for authenticated requests when rate limits matter."}] |
| 157 | + |
| 158 | + :artifacts |
| 159 | + [{:path "findings.csv" |
| 160 | + :producer "scharf find --out csv" |
| 161 | + :notes "Generated report; avoid committing unless intentionally updating examples"} |
| 162 | + {:path "findings.json" |
| 163 | + :producer "scharf find --out json" |
| 164 | + :notes "Generated report; avoid committing unless intentionally updating examples"} |
| 165 | + {:path "scharf" |
| 166 | + :producer "go build -o scharf ." |
| 167 | + :notes "Local binary; should remain ignored/untracked"}]} |
0 commit comments