discover

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package discover provides command discovery and auto-rewrite functionality. This package implements RTK-style command rewriting for transparent tokman integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearCache added in v0.28.0

func ClearCache()

ClearCache clears the rewrite cache

func DetectCommand added in v0.28.0

func DetectCommand(cmd string) bool

DetectCommand detects if a command is known and can be rewritten.

func GetCacheStats added in v0.28.0

func GetCacheStats() (hits, misses int64)

GetCacheStats returns cache hit/miss statistics

func KnownCommands added in v0.28.0

func KnownCommands() []string

KnownCommands returns list of known command patterns.

func RewriteCommand

func RewriteCommand(cmd string, opts interface{}) (string, bool)

RewriteCommand rewrites a command using tokman equivalents (RTK-style). Returns the rewritten command and true if a rewrite occurred. Results are cached for performance.

func ShouldRewriteFile added in v0.28.0

func ShouldRewriteFile(filename string) bool

ShouldRewriteFile checks if a file should trigger rewrite detection

Types

type CommandPattern added in v0.28.0

type CommandPattern struct {
	Name        string
	Pattern     *regexp.Regexp
	Rewrite     string
	Description string
	Priority    int // Higher priority patterns are checked first
}

CommandPattern defines a command pattern for rewriting

type RewriteOptions added in v0.28.0

type RewriteOptions struct {
	// DisableTestRunner disables automatic test-runner detection
	DisableTestRunner bool
	// PreferExplicit prefers explicit tokman commands over test-runner
	PreferExplicit bool
	// DisableCache disables caching for this rewrite
	DisableCache bool
}

RewriteOptions provides options for command rewriting

Jump to

Keyboard shortcuts

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