Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HostClaudeCode = "claude-code"
	HostCursor     = "cursor"
	HostCodex      = "codex"
	HostAuto       = "auto"
)

Variables

This section is empty.

Functions

func DetectHosts

func DetectHosts(absRoot string) []string

DetectHosts reports which agent hosts look present for this repo/user.

func EnsureGitignore

func EnsureGitignore(absRoot string) (bool, error)

EnsureGitignore appends ".contextmaxxer/" to the repo's .gitignore when the repo is git-tracked and the entry is missing — the index db and veccache are multi-MB binary artifacts that `git add .` would otherwise commit.

func RunEnrich

func RunEnrich(ctx context.Context, args []string, log *slog.Logger, modelName string) error

RunEnrich generates synthetic purpose docstrings for indexed symbols via an OpenAI-compatible LLM endpoint and stores them in <root>/.contextmaxxer/synthetic-docs.json. Run `index` afterwards (with -force to re-embed unchanged files) so the summaries reach the embeddings.

func RunFeedback

func RunFeedback(ctx context.Context, args []string, log *slog.Logger) error

RunFeedback handles `contextmaxxer feedback <verb>`. Currently the only verb is `export`, which copies the feedback log (optionally redacted) into a single file ready to hand back to the maintainer for ranker training.

func RunHook

func RunHook(args []string) int

RunHook implements the "discovery gate" used as a Claude Code hook. It returns the process exit code directly: 2 blocks a tool call (PreToolUse semantics), 0 allows it. It must stay fast and dependency-free — it runs on every gated tool call (no DB, no model, no app init).

contextmaxxer hook pre-search   # PreToolUse on Grep|Glob
contextmaxxer hook post-find    # PostToolUse on find_context (Claude Code)
contextmaxxer hook search-signal # a search on Cursor/Codex: record, never block

The gate forces an agent to lead with find_context: the first Grep/Glob in a session is blocked until find_context has been called once, after which grep/glob are allowed (for literal-string / filename / refinement searches). It fails open — any misconfiguration or missing session id allows the call.

func RunIndex

func RunIndex(ctx context.Context, args []string, log *slog.Logger, indexPath string, noEmbeddings bool, includeTests bool, modelName string, forceReindex bool) error

func RunInit

func RunInit(ctx context.Context, args []string, log *slog.Logger, noEmbeddings, includeTests bool, modelName string) error

RunInit is the one-shot onboarding command: it indexes a repo, stages the host-agent enrich flow, and WRITES the host configs (MCP registration + adoption hook/rule) for the requested agent hosts. DECISION(2026-07): init used to only print paste-me blocks; the beta flow is now "tell your agent to install this", so the deterministic merge lives here where it is tested, instead of every host agent free-styling JSON edits. -no-write restores the print-only behavior; every writer merges and is idempotent (see hostsetup.go).

func RunMCP

func RunMCP(ctx context.Context, args []string, log *slog.Logger) error

func RunQuery

func RunQuery(ctx context.Context, args []string, log *slog.Logger) error

func RunWarmup

func RunWarmup(ctx context.Context, _ []string, log *slog.Logger, modelName string) error

RunWarmup downloads and initializes the embedding model, reranker and ONNX runtime up front, so the first real `init`/`index`/`mcp` run starts instantly instead of appearing to hang on a ~250MB download. Idempotent: a no-op once everything is cached.

func RunWatch

func RunWatch(_ context.Context, _ []string) error

func WriteHostConfig

func WriteHostConfig(host, absRoot, cmdPath, dbPath string) ([]string, error)

WriteHostConfig applies the writer for one host. Returns touched files.

Types

This section is empty.

Jump to

Keyboard shortcuts

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