Documentation
¶
Index ¶
- Variables
- func ApplyRankScores(files []format.FileEntry, results map[string]rank.FileScoreResult)
- func RankParams(files []format.FileEntry, fanIn map[string]int) []rank.ScoringParams
- func TuningFromScoring(s config.Scoring) selection.Tuning
- func WeightsFromScoring(s config.Scoring) rank.Weights
- type App
- func (a *App) Close()
- func (a *App) Collect() ([]format.FileEntry, []walker.SkippedItem, error)
- func (a *App) CollectPicker() ([]format.FileEntry, []walker.SkippedItem, error)
- func (a *App) EnablePickerVisibility()
- func (a *App) LogError(format string, args ...interface{})
- func (a *App) Output() io.Writer
- func (a *App) OutputPath() string
- func (a *App) ReadEntry(relativePath string) (format.FileEntry, error)
- func (a *App) Render(files []format.FileEntry, skippedItems []walker.SkippedItem, ...) error
- func (a *App) RenderFinal(files []format.FileEntry, skippedItems []walker.SkippedItem, ...) error
- func (a *App) RenderFinalWithPrompt(files []format.FileEntry, skippedItems []walker.SkippedItem, ...) error
- func (a *App) RenderToClipboard(files []format.FileEntry) error
- func (a *App) RenderToClipboardWithPrompt(files []format.FileEntry, prompt string) error
- func (a *App) Run() error
- func (a *App) SkeletonPicker(ctx context.Context) ([]walker.FileMeta, []walker.SkippedItem, error)
- func (a *App) StreamPicker(ctx context.Context, emit func(format.FileEntry) error) ([]walker.SkippedItem, error)
- type Ranker
Constants ¶
This section is empty.
Variables ¶
var ErrFileSkipped = scan.ErrFileSkipped
ErrFileSkipped is returned by ReadEntry when the smart filter rejects the requested file (e.g. a lockfile or generated artifact). It aliases the processor's sentinel so callers can unwrap the underlying reason.
Functions ¶
func ApplyRankScores ¶
func ApplyRankScores(files []format.FileEntry, results map[string]rank.FileScoreResult)
ApplyRankScores writes the computed scores back into the entries.
func RankParams ¶
RankParams maps enriched entries to the ranking boundary. FanInCount is fed from the reverse import fan-in index.
func TuningFromScoring ¶
TuningFromScoring converts a config [scoring] section onto the selection optimizer's tuning. Zero config fields fall back to the engine defaults; the Retention map is copied through verbatim so config can override the lang-default retention for any role.
Types ¶
type App ¶
type App struct {
// OnlyPaths, when non-nil, restricts the walk to these relative paths.
// Used by sift diff to dump a curated set of files.
OnlyPaths map[string]bool
// contains filtered or unexported fields
}
App encapsulates the main application functionality
func New ¶
New creates a new App instance. It resolves color usage from the terminal and output destination and opens the configured output file; an error is returned when the output file cannot be created. Color decisions are passed explicitly to the logger and renderer rather than mutating global state.
func (*App) Close ¶
func (a *App) Close()
Close performs cleanup, such as closing the output file if one was opened.
func (*App) Collect ¶
Collect walks and processes the configured directory, returning the collected file entries ordered by git relevance. The token budget is deliberately not applied here so callers can curate the selection first.
func (*App) CollectPicker ¶
CollectPicker walks the directory for the interactive picker. Unlike Collect it keeps both the full and signature-only content and token counts per file (plus secret counts and git rank scores) so the TUI can show live previews, token tallies, and smart auto-selection. No global compression mode is applied; callers pick the active view per file.
func (*App) EnablePickerVisibility ¶
func (a *App) EnablePickerVisibility()
EnablePickerVisibility lets the interactive picker receive hidden and gitignored metadata so the TUI can reveal it without rescanning.
func (*App) Output ¶
Output returns the writer the rendered document is written to, backing the configured output file or stdout. Callers that produce output outside the standard render path (e.g. delta patches) reuse it to honor --output.
func (*App) OutputPath ¶
OutputPath returns the absolute path of the output file, or "" when writing to stdout.
func (*App) ReadEntry ¶
ReadEntry reads and processes a single relative path exactly as the picker would, returning a fully enriched entry. It backs the picker's fallback when a selected file has not finished streaming in yet, and returns ErrFileSkipped when the smart filter rejects the file.
func (*App) Render ¶
func (a *App) Render(files []format.FileEntry, skippedItems []walker.SkippedItem, duration time.Duration, runErr error) error
Render applies the token budget to files and writes the rendered document. A non-nil runErr from Collect is reported but rendering still happens so the output stays well-formed (e.g. valid JSON on timeout).
func (*App) RenderFinal ¶
func (a *App) RenderFinal(files []format.FileEntry, skippedItems []walker.SkippedItem, duration time.Duration, runErr error) error
RenderFinal renders exactly the given files without re-applying the token budget. It is used by the interactive picker, whose TUI owns budget accounting (including smart auto-selection); nothing is dropped afterwards.
func (*App) RenderFinalWithPrompt ¶
func (a *App) RenderFinalWithPrompt(files []format.FileEntry, skippedItems []walker.SkippedItem, duration time.Duration, runErr error, prompt string) error
RenderFinalWithPrompt renders picker output with a session-specific directive without mutating application configuration.
func (*App) RenderToClipboard ¶
RenderToClipboard renders the given files and copies the result to the system clipboard, without writing to the configured output destination. It backs the picker's live copy action.
func (*App) RenderToClipboardWithPrompt ¶
RenderToClipboardWithPrompt renders clipboard output with a session-specific directive without mutating application configuration.
func (*App) Run ¶
Run executes the main application logic. It returns a non-nil error when the scan failed, including on timeout.
func (*App) SkeletonPicker ¶
SkeletonPicker returns file metadata (no content) for the picker's structure-first launch. It applies the same ignore, extension, prune, and smart name rules as the full walk so the skeleton matches the files that will later be enriched. Smart-skipped entries are folded into the skip list.
func (*App) StreamPicker ¶
func (a *App) StreamPicker(ctx context.Context, emit func(format.FileEntry) error) ([]walker.SkippedItem, error)
StreamPicker walks the directory for the interactive picker without blocking: emit is called for each accepted file as soon as it is processed (possibly concurrently), and rank scores are not applied here so the caller can patch them asynchronously. The returned skip list is complete only after the walk finishes.
type Ranker ¶
type Ranker struct {
// contains filtered or unexported fields
}
Ranker applies the unified relevance scoring to collected entries. It is the application-level adapter between processed FileEntries and the rank package, which stays free of format.FileEntry. Both the blocking collect path and the picker's streaming rank patch go through it.
func NewRankerWithWeights ¶
NewRankerWithWeights returns a Ranker rooted at dir with explicit scoring weights. Zero weight fields fall back to the defaults.
func (*Ranker) Rank ¶
Rank computes unified relevance scores for files, writes them back into the entries, and stably sorts the slice by descending score so equal scores keep their original order. It returns the raw results keyed by path for callers that also need the preferred mode (e.g. the streaming picker patch). Duplicate paths collapse to a single result, which is written back to every matching entry. Fan-in centrality uses the collected content.