Refactored, added comprehensive testing.
All checks were successful
Release / release (push) Successful in 3m17s

This commit is contained in:
Jay
2025-10-26 23:23:43 -04:00
parent ec32b75267
commit 1936f055e2
61 changed files with 4678 additions and 769 deletions

26
input/role.go Normal file
View File

@@ -0,0 +1,26 @@
package input
import "git.wisehodl.dev/jay/aicli/config"
// DetermineRole decides how stdin content participates in the query based on
// flags and stdin presence. Per spec §7 rules.
func DetermineRole(cfg config.ConfigData, hasStdin bool) StdinRole {
if !hasStdin {
return StdinAsPrompt // unused, but set for consistency
}
// Explicit -F flag forces stdin as file
if cfg.StdinAsFile {
return StdinAsFile
}
// Any explicit prompt flag (-p or -pf) makes stdin prefixed content
hasExplicitPrompt := len(cfg.PromptFlags) > 0 || len(cfg.PromptPaths) > 0
if hasExplicitPrompt {
return StdinAsPrefixedContent
}
// Default: stdin replaces any default prompt
return StdinAsPrompt
}