cli

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StyleBrandMark = lipgloss.NewStyle().
					Foreground(colorAmber).
					Bold(true)

	StyleDim = lipgloss.NewStyle().
				Foreground(colorDim)

	StyleValue = lipgloss.NewStyle().
				Foreground(colorWhite).
				Bold(true)

	StyleTree = lipgloss.NewStyle().
				Foreground(colorAmber)

	StyleStage = lipgloss.NewStyle().
				Foreground(colorWhite).
				Bold(true)

	StyleSuccess = lipgloss.NewStyle().
					Foreground(colorAmber)

	StyleError = lipgloss.NewStyle().
				Foreground(colorTerracotta)

	StyleSection = lipgloss.NewStyle().
					Foreground(colorAmber)

	StyleHint = lipgloss.NewStyle().
				Foreground(colorDim)

	StyleDesc = lipgloss.NewStyle().
				Foreground(colorDimLight)
)
View Source
var Version = ""

Version is the release a binary reports when set at link time, as a release build does with -ldflags "-X github.com/CtrlAltDelete-Ops/opentuple/internal/cli.Version=v0.2.0". It is a variable only because the linker can set nothing else; nothing assigns it at run time.

Functions

func Brand

func Brand()

func BrandWith

func BrandWith(verb string, subject string)

func ClosestCommand

func ClosestCommand(input string) (string, bool)

func Error

func Error(msg string)

func FormatNumber

func FormatNumber(n int) string

func Hint

func Hint(msg string)

func HuhTheme

func HuhTheme() *huh.Theme

func RunCheck

func RunCheck(ctx context.Context, args []string) error

RunCheck is `opentuple check <file>...`: parse each file, compare its functions against the mined conventions of their subsystem, and print every violation to stderr as a plain-text block an agent can act on. Clean code prints nothing. Exit status: 0 clean, 1 violations, 2 error.

--hook reads a Claude Code PostToolUse event from stdin and checks the edited file instead, exiting 2 on violations — the status that shows stderr to the agent after an edit — and 1 on error, which Claude Code treats as non-blocking. --staged checks the source files staged in git, for the pre-commit hook.

func RunGenerate

func RunGenerate(ctx context.Context, args []string) error

RunGenerate emits curated conventions from an existing index as agent context files (per-directory CLAUDE.md shards and/or a flat AGENTS.md).

func RunHelp

func RunHelp()

func RunIndex

func RunIndex(ctx context.Context, args []string, mode string) error

func RunInit

func RunInit(ctx context.Context, args []string) error

RunInit sets a repository up in one step: index it if needed, write the convention files, and install the Claude Code hook that checks every edited file. Running it again is safe: files it owns are rewritten in place, everything else is left alone.

func RunLauncher

func RunLauncher(ctx context.Context) error

RunLauncher is the interactive experience behind bare `opentuple` on a TTY.

func RunRules

func RunRules(ctx context.Context, args []string) error

RunRules is `opentuple rules <path>`: list the conventions check would enforce on a file, or on files in a directory, with the evidence behind each — the way to see why a check said what it said, or what it would say.

func RunStatus

func RunStatus(ctx context.Context, args []string) error

func RunVersion

func RunVersion()

RunVersion prints the version this binary was built from.

func Section

func Section(name string)

func Stage

func Stage(name string, value string, detail string, dur time.Duration, last bool)

func Success

func Success(msg string)

func TreeLine

func TreeLine()

Types

type IndexedRepo

type IndexedRepo struct {
	Name      string    // dir basename minus the -hash suffix
	Dir       string    // full path under ~/.opentuple/repos
	IndexedAt time.Time // mtime of index.db
}

IndexedRepo describes one repository index under ~/.opentuple/repos.

func ListIndexedRepos

func ListIndexedRepos() ([]IndexedRepo, error)

ListIndexedRepos scans ~/.opentuple/repos for directories containing an index.db, newest first. It never opens the databases, so it stays instant regardless of how many repos are indexed.

Jump to

Keyboard shortcuts

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