brief

package module
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 2 Imported by: 0

README

brief

A single-binary CLI tool that detects a software project's toolchain, configuration, and conventions, then outputs a structured report. Written in Go, 54 ecosystems, 355 tool definitions.

brief answers the bootstrap questions every AI coding agent, new contributor, and CI pipeline faces: what language is this, how do I install dependencies, how do I run the tests, what linter is configured.

It does not score, grade, or judge. It reports facts.

Use with AI coding agents

Add this to your CLAUDE.md, agents.md, or equivalent agent instructions file:

Before starting work on this project, run `brief .` to understand the toolchain,
test commands, linters, and project conventions. If on a branch, also run
`brief diff` to see which parts of the toolchain are affected by your changes.

The agent will get back structured information about the project's language, package manager, test runner, linter, formatter, build tools, and more, so it doesn't have to guess or ask you. On a feature branch, brief diff narrows that down to just the tools relevant to what's been changed, so the agent knows which linters to run, which test frameworks matter, and which config files are in play.

To let Claude Code run brief without prompting for approval each time, add this to ~/.claude/settings.json:

{
  "permissions": {
    "allow": ["Bash(brief *)"]
  }
}

Install

go install github.com/git-pkgs/brief/cmd/brief@latest

Or download a binary from releases.

Usage

brief [flags] [path | url]        Detect project toolchain
brief diff [flags] [ref1] [ref2]  Detect only what changed between refs
brief missing [flags] [path]      Show recommended tooling gaps
brief enrich [flags] [path]       Detect and enrich with external data
brief list tools                  All tools in the knowledge base
brief list ecosystems             Supported ecosystems
brief schema                      JSON output schema

Works on local paths, git URLs, and registry packages:

brief .                                       Local directory
brief /path/to/project                        Any local path
brief https://github.com/expressjs/express    Git URL (cloned to temp dir)
brief npm:express                             Registry package (resolved to source repo)
brief gem:rails
brief crate:serde
brief pypi:requests

Remote sources are shallow-cloned by default. Use --depth 0 for a full clone, --keep to preserve the clone, or --dir ./somewhere to clone into a specific directory.

JSON when piped, human-readable on a TTY. Force either with --json or --human. Use --category test to filter to a single category.

brief dev — /home/user/myproject

Language:        Go
Package Manager: Go Modules (go mod download)
                 Lockfile: go.sum
                 9 runtime (223 total)

Test:        go test (go test ./...)
Lint:        golangci-lint (golangci-lint run)  [.golangci.yml]
Format:      gofmt (gofmt -w .)
Docs:        pkgsite (go run golang.org/x/pkgsite/cmd/pkgsite@latest)
Build:       GoReleaser (goreleaser release --clean)  [.goreleaser.yaml]
Security:    govulncheck (govulncheck ./...)
CI:          GitHub Actions  [.github/workflows/]
Coverage:    go test -cover (go test -coverprofile=coverage.out ./...)
Dep Updates: Dependabot  [.github/dependabot.yml]

Style:       tabs (inferred)  LF
Layout:      cmd/

             OS: ubuntu-latest, macos-latest, windows-latest (CI matrix)

Resources:   README.md
Resources:   CONTRIBUTING.md
Resources:   LICENSE (MIT)

Git:         branch main  71 commits
             origin: git@github.com:user/myproject.git

Lines:       9295 code  397 files (scc)

148.7ms  428 files checked  11/355 tools matched

Use --verbose to include homepage, docs, and repo links for each detected tool.

Diff

brief diff runs the same detection but filters the report to only show tools, languages, and configuration relevant to files that changed. Useful for understanding what a branch or PR touches in terms of toolchain.

brief diff                        Compare against default branch + uncommitted
brief diff main                   Compare main to HEAD + uncommitted
brief diff v1.0.0 v2.0.0         Compare between two refs

With no arguments it auto-detects the default branch from origin/HEAD, falling back to main or master. The output lists changed files and only the toolchain entries those files relate to: if you changed a .go file, you'll see Go and its tools but not Python. If you changed .golangci.yml, you'll see golangci-lint. If you changed go.mod, you'll see dependency information.

Same output format as brief -- JSON when piped, human-readable on a TTY.

Missing

brief missing checks which recommended tool categories are absent for the project's detected ecosystems. It compares what's detected against five categories every project benefits from: test, lint, format, typecheck, and docs.

brief missing .
brief missing --json .

For each gap it suggests the canonical tool for that ecosystem, with the command to run and a link to docs.

Detected: python

Missing recommended tooling:

  Test         No test tool configured
               Suggested: pytest (pytest)
               https://docs.pytest.org

  Lint         No lint tool configured
               Suggested: Ruff (ruff check .)
               https://docs.astral.sh/ruff/

  Format       No format tool configured
               Suggested: Black (black .)
               https://black.readthedocs.io/en/stable/

Tools built into the language runtime (go test, gofmt, cargo clippy, dart analyze, deno lint, etc.) are detected automatically when the language is present and won't show as missing.

Enrichment

brief enrich runs the same scan, then fetches metadata from external APIs about the project itself: what packages it publishes, their download counts and dependents, runtime end-of-life status, and OpenSSF Scorecard.

brief enrich .
brief enrich --json .
brief enrich --verbose .

Data sources: ecosyste.ms for published package metadata, endoflife.date for runtime lifecycle, OpenSSF Scorecard for repo security.

What it detects

54 language ecosystems with 355 tool definitions across 20 categories.

Languages (54): Go, Ruby, Python, JavaScript, TypeScript, Rust, Java, Kotlin, Scala, Elixir, PHP, Swift, C#, Dart, Haskell, Clojure, Crystal, Julia, Nim, Zig, Lua, Perl, R, D, Elm, Gleam, Haxe, Nix, Deno, C, C++, Objective-C, Erlang, OCaml, F#, Groovy, Solidity, GDScript, Fortran, COBOL, Ada, VHDL, Verilog, Mojo, Roc, V, Odin, Scheme, Racket, Prolog, Tcl, Common Lisp, Emacs Lisp, plus CocoaPods and Conda ecosystems.

Test (46): go test, Jest, Vitest, Mocha, AVA, RSpec, Minitest, pytest, JUnit, PHPUnit, ExUnit, EUnit, cargo test, Google Test, Catch2, Playwright, Cypress, MSW, Locust, Artillery, axe-core, Lighthouse CI, XCTest, dart test, deno test, kotlin.test, ScalaTest, crystal spec, Hspec, Alcotest, zig test, gleam test, and more.

Lint (31): golangci-lint, ESLint, RuboCop, Ruff, Clippy, clang-tidy, Biome, Stylelint, commitlint, hadolint, ShellCheck, markdownlint, Semgrep, pre-commit, Lefthook, Husky, detekt, PHP_CodeSniffer, SwiftLint, Credo, HLint, elvis, clj-kondo, dart analyze, deno lint, WartRemover, Ameba, and more.

Format (25): gofmt, Prettier, Black, rustfmt, isort, clang-format, ocamlformat, dprint, scalafmt, ktlint, SwiftFormat, StandardRB, PHP CS Fixer, mix format, erlfmt, Ormolu, dart format, deno fmt, dotnet format, zig fmt, crystal tool format, cljfmt, nimpretty, gleam format, google-java-format.

Build (48): Webpack, Vite, esbuild, Rollup, Parcel, tsup, Rspack, GoReleaser, Mage, Rake, CMake, Make, Meson, Autotools, Hardhat, Foundry, Tailwind CSS, PostCSS, Sass, Less, UnoCSS, plus framework detection for Rails, Django, FastAPI, Express, Fastify, Koa, Hono, NestJS, AdonisJS, Gin, Phoenix, Spring Boot, Actix, Next.js, Nuxt, Remix, Angular, Ember.js, SolidJS, Qwik, Astro, Gatsby, SvelteKit, Eleventy.

Database (15): ActiveRecord, Prisma, Alembic, Diesel, Ecto, Flyway, Liquibase, Goose, Dbmate, Drizzle, TypeORM, Sequelize, SQLAlchemy, GORM, SQLite.

Codegen (6): Protobuf, Buf, OpenAPI, GraphQL Code Generator, ent, sqlc.

Infrastructure (7): Terraform, Pulumi, Ansible, Kubernetes, Helm, AWS CDK, Serverless Framework.

CI/Deployment (7): GitHub Actions, GitLab CI, Earthly, Dagger, Cloudflare Workers, Vercel, Netlify.

Container (3): Docker, Docker Compose, Dev Container.

Monorepo (8): Nx, Turborepo, Rush, Bazel, Pants, Lerna, pnpm workspaces, Go workspaces.

Release (6): semantic-release, release-please, cargo-release, Changesets, git-cliff, conventional-changelog.

i18n (5): i18next, gettext, Rails i18n, Crowdin, Transifex.

Docs (18): pkgsite, Sphinx, MkDocs, Javadoc, Docusaurus, VitePress, Storybook, Jekyll, Doxygen, ExDoc, Dokka, phpDocumentor, cargo doc, dart doc, deno doc, Docsify, Starlight, and more.

Security (9): govulncheck, npm audit, pip-audit, bundler-audit, cargo-audit, OWASP Dependency-Check, Snyk, Socket, and more.

Coverage (9): go test -cover, coverage.py, SimpleCov, JaCoCo, c8, cargo-tarpaulin, Codecov, Coveralls, and more.

Also: package managers (39), type checkers (6), dependency update bots (3), environment tools (9).

Run brief list tools for the full list.

How it works

Detection rules are data, not code. Each tool is defined in a TOML file under knowledge/, organized by ecosystem. Adding a new tool is a single TOML file with no Go code changes.

[tool]
name = "RSpec"
category = "test"
default = true
homepage = "https://rspec.info"
description = "BDD testing framework for Ruby"

[detect]
files = ["spec/", ".rspec"]
dependencies = ["rspec", "rspec-core"]

[commands]
run = "bundle exec rspec"
alternatives = ["rake spec", "rspec"]

[config]
files = [".rspec", "spec/spec_helper.rb"]

The default = true flag marks a tool as the canonical choice for its category in that ecosystem. The brief missing command uses this to suggest the right tool when a category is absent.

Detection uses five primitives: file/directory presence, dependency names from parsed manifests, file content matching, structured key existence (JSON/TOML), and ecosystem filtering to prevent cross-language false positives.

Library usage

The detection engine, knowledge base, and reporters are separate Go packages. Import them directly instead of shelling out to the binary:

import (
    "github.com/git-pkgs/brief"
    "github.com/git-pkgs/brief/kb"
    "github.com/git-pkgs/brief/detect"
    "github.com/git-pkgs/brief/report"
)

knowledgeBase, _ := kb.Load(brief.KnowledgeFS)
engine := detect.New(knowledgeBase, "/path/to/project")
r, _ := engine.Run()
report.JSON(os.Stdout, r)

Contributing

Adding a new tool: create a TOML file in the appropriate ecosystem directory under knowledge/, add test fixtures in testdata/, run go test ./....

Adding a new ecosystem: create a directory under knowledge/, add language.toml plus at least a package manager, test framework, and linter.

See CONTRIBUTING.md for detection primitives and category definitions.

License

MIT

Documentation

Overview

Package brief detects a software project's toolchain, configuration, and conventions, then outputs a structured report.

Index

Constants

View Source
const (
	ScopeRuntime     = "runtime"
	ScopeDevelopment = "development"
	ScopeTest        = "test"
	ScopeBuild       = "build"
)

Scope values for DepInfo.

Variables

View Source
var KnowledgeFS embed.FS
View Source
var Version = "dev"

Version is set at build time via ldflags.

Functions

This section is empty.

Types

type Command

type Command struct {
	Run          string   `json:"run"`
	Alternatives []string `json:"alternatives,omitempty"`
	Source       Source   `json:"source"`
	InferredTool string   `json:"inferred_tool,omitempty"`
}

Command is a runnable command with provenance.

type Confidence

type Confidence string

Confidence indicates how reliable a detection signal is.

const (
	ConfidenceHigh   Confidence = "high"
	ConfidenceMedium Confidence = "medium"
	ConfidenceLow    Confidence = "low"
)

type DepInfo added in v0.2.0

type DepInfo struct {
	Name    string `json:"name"`
	Version string `json:"version,omitempty"`
	PURL    string `json:"purl"`
	Scope   string `json:"scope,omitempty"` // "runtime", "development", "test", "build"
	Direct  bool   `json:"direct"`
}

DepInfo is a parsed dependency from a manifest file.

type Detection

type Detection struct {
	Name        string     `json:"name"`
	Category    string     `json:"category"`
	Confidence  Confidence `json:"confidence"`
	Command     *Command   `json:"command,omitempty"`
	ConfigFiles []string   `json:"config_files,omitempty"`
	Lockfile    string     `json:"lockfile,omitempty"`
	Homepage    string     `json:"homepage,omitempty"`
	Docs        string     `json:"docs,omitempty"`
	Repo        string     `json:"repo,omitempty"`
	Description string     `json:"description,omitempty"`
}

Detection is a single detected tool or feature.

type EnrichmentInfo added in v0.2.0

type EnrichmentInfo struct {
	Repo       *RepoEnrichment        `json:"repo,omitempty"`
	Packages   []PublishedPackage     `json:"packages,omitempty"`
	RuntimeEOL map[string]*RuntimeEOL `json:"runtime_eol,omitempty"`
}

EnrichmentInfo holds metadata fetched from external sources about the project itself.

type GitInfo

type GitInfo struct {
	Branch        string            `json:"branch,omitempty"`
	DefaultBranch string            `json:"default_branch,omitempty"`
	Remotes       map[string]string `json:"remotes,omitempty"` // name -> URL
	CommitCount   int               `json:"commit_count,omitempty"`
}

GitInfo describes the git repository state.

type LayoutInfo

type LayoutInfo struct {
	SourceDirs    []string `json:"source_dirs,omitempty"` // e.g. ["src/", "lib/", "app/"]
	TestDirs      []string `json:"test_dirs,omitempty"`   // e.g. ["spec/", "test/"]
	MirrorsSource bool     `json:"mirrors_source,omitempty"`
}

LayoutInfo describes the project's file layout conventions.

type LineCount

type LineCount struct {
	TotalFiles int            `json:"total_files"`
	TotalLines int            `json:"total_lines"`
	ByLanguage map[string]int `json:"by_language,omitempty"`
	Source     string         `json:"source"` // "scc", "tokei", or "fallback"
}

LineCount holds line count information.

type MissingCategory added in v0.4.0

type MissingCategory struct {
	Category     string `json:"category"`
	Label        string `json:"label"`
	Ecosystem    string `json:"ecosystem"`
	Suggested    string `json:"suggested"`
	SuggestedCmd string `json:"suggested_cmd,omitempty"`
	Description  string `json:"description,omitempty"`
	Docs         string `json:"docs,omitempty"`
}

MissingCategory describes a tool category that has no detected tools despite the ecosystem having known tools for it.

type MissingReport added in v0.4.0

type MissingReport struct {
	Version    string            `json:"version"`
	Path       string            `json:"path"`
	Ecosystems []string          `json:"ecosystems"`
	Missing    []MissingCategory `json:"missing"`
}

MissingReport is the output of a brief missing analysis.

type PlatformInfo

type PlatformInfo struct {
	RuntimeVersionFiles map[string]string   `json:"runtime_version_files,omitempty"`
	CIMatrixVersions    map[string][]string `json:"ci_matrix_versions,omitempty"`
	CIMatrixOS          []string            `json:"ci_matrix_os,omitempty"`
}

PlatformInfo describes detected platforms and runtime versions.

type PublishedPackage added in v0.2.0

type PublishedPackage struct {
	Name                   string `json:"name"`
	Ecosystem              string `json:"ecosystem"`
	PURL                   string `json:"purl"`
	LatestVersion          string `json:"latest_version,omitempty"`
	License                string `json:"license,omitempty"`
	Description            string `json:"description,omitempty"`
	Downloads              int    `json:"downloads,omitempty"`
	DownloadsPeriod        string `json:"downloads_period,omitempty"`
	DependentPackagesCount int    `json:"dependent_packages_count,omitempty"`
	DependentReposCount    int    `json:"dependent_repos_count,omitempty"`
	RegistryURL            string `json:"registry_url,omitempty"`
}

PublishedPackage describes a package this repo publishes to a registry.

type RepoEnrichment added in v0.2.0

type RepoEnrichment struct {
	Scorecard     float64 `json:"scorecard,omitempty"`
	ScorecardDate string  `json:"scorecard_date,omitempty"`
}

RepoEnrichment holds metadata about the project's own repository.

type Report

type Report struct {
	Version         string                 `json:"version"`
	Path            string                 `json:"path"`
	DiffRef         string                 `json:"diff_ref,omitempty"`
	DiffCommits     []string               `json:"diff_commits,omitempty"`
	ChangedFiles    []string               `json:"changed_files,omitempty"`
	Languages       []Detection            `json:"languages"`
	PackageManagers []Detection            `json:"package_managers"`
	Scripts         []Script               `json:"scripts,omitempty"`
	Tools           map[string][]Detection `json:"tools"`
	Style           *StyleInfo             `json:"style,omitempty"`
	Layout          *LayoutInfo            `json:"layout,omitempty"`
	Platforms       *PlatformInfo          `json:"platforms,omitempty"`
	Resources       *ResourceInfo          `json:"resources,omitempty"`
	Git             *GitInfo               `json:"git,omitempty"`
	Lines           *LineCount             `json:"lines,omitempty"`
	Dependencies    []DepInfo              `json:"dependencies,omitempty"`
	Enrichment      *EnrichmentInfo        `json:"enrichment,omitempty"`
	Stats           Stats                  `json:"stats"`
}

Report is the complete output of a brief analysis.

type ResourceInfo

type ResourceInfo struct {
	Readme       string `json:"readme,omitempty"`
	Contributing string `json:"contributing,omitempty"`
	Changelog    string `json:"changelog,omitempty"`
	License      string `json:"license,omitempty"`
	LicenseType  string `json:"license_type,omitempty"`
	Security     string `json:"security,omitempty"`
}

ResourceInfo describes project resource files.

type RuntimeEOL added in v0.2.0

type RuntimeEOL struct {
	EOL       string `json:"eol,omitempty"` // date string or "true"/"false"
	Supported bool   `json:"supported"`
	LTS       bool   `json:"lts,omitempty"`
	Latest    string `json:"latest,omitempty"` // latest patch version
}

RuntimeEOL holds end-of-life status for a runtime version.

type Script

type Script struct {
	Name   string `json:"name"`
	Run    string `json:"run"`
	Source string `json:"source"` // e.g. "Makefile", "package.json"
}

Script is a project-defined task (Makefile target, package.json script, etc.).

type Source

type Source string

Source indicates where a detected command came from.

const (
	SourceProjectScript Source = "project_script"
	SourceKnowledgeBase Source = "knowledge_base"
	SourceConfigFile    Source = "config_file"
)

type Stats

type Stats struct {
	Duration     time.Duration `json:"-"`
	DurationMS   float64       `json:"duration_ms"`
	FilesChecked int           `json:"files_checked"`
	ToolsMatched int           `json:"tools_matched"`
	ToolsChecked int           `json:"tools_checked"`
}

Stats holds performance and coverage metrics from the detection run.

type StyleInfo

type StyleInfo struct {
	Indentation     string `json:"indentation,omitempty"`   // e.g. "2-space", "4-space", "tabs"
	IndentSource    string `json:"indent_source,omitempty"` // e.g. "editorconfig", "inferred"
	LineEnding      string `json:"line_ending,omitempty"`   // "LF" or "CRLF"
	TrailingNewline *bool  `json:"trailing_newline,omitempty"`
}

StyleInfo describes detected coding style conventions.

Directories

Path Synopsis
cmd
brief command
Package detect implements the project detection engine.
Package detect implements the project detection engine.
Package kb loads and queries the embedded TOML knowledge base.
Package kb loads and queries the embedded TOML knowledge base.
Package remote resolves remote sources (git URLs, registry packages) to local directories for scanning.
Package remote resolves remote sources (git URLs, registry packages) to local directories for scanning.
Package report formats brief detection results for output.
Package report formats brief detection results for output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL