Repository navigation
Development
This page is for people changing the scanner. Using it starts at Getting started.
The module path in go.mod is github.com/vgmartinez/tripcord. The CLI package is ./cmd/tripcord. internal/project.Repository is vgmartinez/tripcord, and a test checks that github.com/ plus that constant matches the module path.
main.version defaults to dev and main.commit to empty. Override them at link time:
go build -ldflags "-X main.version=vX.Y.Z -X main.commit=$(git rev-parse HEAD)" -o tripcord ./cmd/tripcordtripcord version then prints vX.Y.Z (commit <sha>); without a commit it prints the version alone.
release.yml runs scripts/release-build.sh for linux, darwin, and windows on amd64 and arm64: CGO_ENABLED=0, -trimpath, -ldflags "-s -w -buildid= -X main.version=<tag> -X main.commit=<sha>", SOURCE_DATE_EPOCH from the commit, and archives with a fixed mtime, mode, owner, and order, plus SHA256SUMS. Each build fails unless NOTICE and THIRD_PARTY_NOTICES cover every module go version -m lists, and each is rebuilt after go clean -cache and compared byte for byte.
- A
v*tag attests the archives andSHA256SUMSwithactions/attest-build-provenanceand creates a draft GitHub Release whose body is the tag's section of release notes. A maintainer publishes it, and lists it on the Marketplace, in the GitHub UI. The workflow never publishes. - A pull request that changes
release.yml,go.mod,go.sum, orcmd/runs the same build as a dry run, withcontents: readonly, and uploads the archives andSHA256SUMSas run artifacts.
Run make release-gate before tagging.
The Makefile is the development entry point. build is CGO_ENABLED=0. test runs the race detector, which needs a C toolchain and cgo; the module itself does not use cgo.
make fmt # gofmt -s -w .
make lint # go vet ./... and golangci-lint run
make test # go test -race ./...
make build # bin/tripcord, version from VERSION (default dev)
make test-rule ID=TC-CFG-002| Path | Role |
|---|---|
cmd/tripcord |
CLI: help, version, scan, init, preopen, and pr-context
|
cmd/wikigen |
Renders docs/ into the GitHub Wiki. See "Wiki" below |
internal/adapters |
Per-harness discovery. One subdirectory per adapter |
internal/rules |
YAML rules compiled to CEL, and the scan engine |
internal/policy |
Policy file parsing and layer merge |
internal/model |
Config items, findings, harness ids, and related types |
internal/output |
text, json, jsonl, sarif, md, and gha sinks |
internal/exitcode |
Process statuses 0 through 4 |
internal/scriptcheck |
Hook-script and checksum-file annotation for rules |
internal/hiddenchar |
Hidden-code-point scan used by TC-CFG-011 |
internal/fpkey |
Fingerprint key for the k1 discriminator |
internal/wiki |
Page map, link rewriting, and rules catalog for cmd/wikigen
|
rules/ |
Core pack embedded in the binary. See CONTRIBUTING.md |
schemas/ |
JSON Schemas for the event and finding documents. See schemas/README.md |
docs/ |
Design notes. scan.md, policy.md, output.md, fingerprint.md |
Exit statuses live in internal/exitcode: 0 no finding at the threshold, 1 findings, 2 hook-mode block, 3 configuration or incomplete scan, 4 internal or I/O. scan returns 0, 1, 3, or 4. The user-facing table is in Commands.
New rules, fixtures, and the id registry are in CONTRIBUTING.md. Policy layers and the no-policy defaults are in CONTRIBUTING.md and policy.md.
CONTRIBUTING.md covers the Developer Certificate of Origin, rule files, fixtures, and policy layers. Report vulnerabilities as described in SECURITY.md.
docs/ is the source of the GitHub Wiki.
Nobody edits the wiki by hand. cmd/wikigen renders every docs/**/*.md
file to one page, rewrites relative links to wiki pages or to files on
main, and replaces the catalog marker in docs/rules/README.md with
tables built from rules/*.yaml and rules/ADVISORIES.json. It fails on
a docs file with no page, a broken link, or a missing anchor, and it
checks the links in the root README.md.
make wiki # renders into bin/wiki
go test ./internal/wikiA new docs file needs an entry in docPages in internal/wiki (rule
pages under docs/rules/ are named after the rule id). The wiki render and links CI job runs both commands on every pull request. After a merge
to main that touches docs/, rules/, or the generator, the wiki-sync workflow
renders the pages again and pushes them to the wiki repository's
master branch; it makes no commit when nothing changed.
A finding's decision is allow, deny, warn, audit, or ask.
Policy mode (enforce, warn, audit) is a separate vocabulary.
In hook mode, ask maps to the harness's native human-confirmation
prompt where that harness has one (Claude Code PreToolUse, Cursor
beforeShellExecution) and degrades to deny with an explanatory
message elsewhere; each adapter's RenderDecision does the mapping
(Hook). No custom rule produces ask yet.
The GitHub owner and repository name are defined in one place: Repository
in internal/project.
The module path in go.mod is the import path (github.com/ plus that
constant). A test checks that the two stay in sync. To move the project to
another owner, change those two and leave every other file alone.
This wiki is generated from docs/ on main by cmd/wikigen. Do not edit it here: change docs/ and open a pull request. Apache-2.0.
Start
Commands
CI and hooks
Configuration
Adapters
- Claude Code
- Codex
- Cursor
- GitHub Copilot
- Gemini CLI
- OpenCode
- Windsurf
- Devin
- Dev Container
- Shared Files
Project