brief

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 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, 30 ecosystems, 95 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.

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 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/forge

Language:        Go
Package Manager: Go Modules (go mod download)
                 Lockfile: go.sum

Test:        go test (go test ./...)
Lint:        golangci-lint (golangci-lint run)  [.golangci.yml]
Format:      gofmt (gofmt -w .)
Typecheck:   —
Docs:        —
Build:       —
Security:    —
CI:          GitHub Actions  [.github/workflows/]
Container:   —
Dep Updates: Dependabot  [.github/dependabot.yml]

Style:       tabs (inferred)  LF
Layout:      internal/ cmd/

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

Resources:   README.md
Resources:   LICENSE (MIT)

Git:         branch add-commit-statuses (default: main)  58 commits
             origin: git@github.com:git-pkgs/forge.git

Lines:       22912 code  191 files (scc)

164.0ms  184 files checked  7/95 tools matched

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

How it works

Detection rules are data, not code. Each tool is defined in a TOML file under knowledge/, organized by ecosystem:

knowledge/
├── ruby/       language, bundler, rspec, minitest, rubocop, sorbet
├── python/     language, pip, uv, poetry, pipenv, pdm, pytest, ruff, mypy, black
├── go/         language, gomod, gotest, golangci-lint, gofmt
├── node/       language, typescript, npm, pnpm, yarn, bun, jest, vitest, eslint, prettier, biome
├── rust/       language, cargo, clippy, rustfmt
├── java/       language, maven, gradle, junit, checkstyle, spotbugs
├── elixir/     language, mix, exunit, credo, dialyzer
├── php/        language, composer, phpunit, phpstan, php-cs-fixer
├── deno/       language, deno
├── gleam/      language, gleam
├── nix/        language, flakes
├── + csharp, swift, kotlin, haskell, scala, dart, crystal, julia
├── + clojure, r, lua, perl, zig, nim, d, elm, haxe, conda, cocoapods
└── _shared/    github-actions, gitlab-ci, docker, devcontainer, dependabot, renovate, pre-commit

A tool definition looks like this:

[tool]
name = "RSpec"
category = "test"
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"]

Adding support for a new tool is a single TOML file. No Go code changes needed.

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.

License

MIT

Documentation

Overview

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

Index

Constants

This section is empty.

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 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 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 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 Report

type Report struct {
	Version         string                 `json:"version"`
	Path            string                 `json:"path"`
	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"`
	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 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