Documentation
¶
Index ¶
- func DerefInt(i *int) int
- func DerefStr(p *string) string
- func EnsureStellaCLIInPath(stellaHome string) error
- func HoistFlags(app *ucli.App, argv []string) []string
- func IsJSON(c *ucli.Context) bool
- func JSONFlag() ucli.Flag
- func LoadDotEnv()
- func ParseLogLevel() slog.Level
- func PrintDeleted(c *ucli.Context, id string) error
- func PrintJSON(c *ucli.Context, v any) error
- func ShortID(id string) string
- func Truncate(s string, max int) string
- type LineWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureStellaCLIInPath ¶
EnsureStellaCLIInPath installs the stella CLI binary into $STELLA_HOME/bin/stella for sandbox sessions, whose PATH is intentionally restricted to stella-managed and system directories.
When the running process is stellad (the daemon), the stella CLI binary is located alongside it in the same directory — goreleaser, Homebrew, and nfpm all install both binaries to the same prefix. If the companion binary is not found, the function returns an error rather than copying the daemon.
Do not use a symlink: sandbox path resolution rejects symlink traversal.
func HoistFlags ¶ added in v0.50.0
HoistFlags reorders argv so flags may appear after positional arguments.
urfave/cli v2 parses each command's args with the stdlib flag package, which stops at the first non-flag token: `stella goal get <id> --json` leaves `--json` unparsed and silently falls back to text output. Users (and agents) reasonably expect flags to work in any position, so this walks the command tree, finds the leaf command's argument tail, and moves its flags (with their values) ahead of the positionals before handing argv to the app.
It is value-aware: a flag that takes a value carries the following token with it, so `--title my goal` is not split. A `--` terminator stops reordering, so intentional positional-looking arguments can still be passed verbatim.
func LoadDotEnv ¶ added in v0.43.0
func LoadDotEnv()
LoadDotEnv reads $STELLA_HOME/.env and sets any key that is not already present in the environment. Existing OS/service-injected variables win. Missing file is silently ignored; parse errors are skipped per line.
func ParseLogLevel ¶ added in v0.43.0
ParseLogLevel maps the LOG_LEVEL env var to slog.Level. Supported values: TRACE, DEBUG, INFO, WARN, ERROR (case-insensitive). Defaults to DEBUG if unset or unrecognized.
Types ¶
type LineWriter ¶ added in v0.43.0
type LineWriter struct {
// contains filtered or unexported fields
}
LineWriter is a fmt-style writer bound to a command's stdout that defers error handling: it records the first write error and short-circuits the rest, so human-output helpers check once at the end (via Err) instead of after every line.
func Stderr ¶ added in v0.43.0
func Stderr(c *ucli.Context) *LineWriter
func Stdout ¶ added in v0.43.0
func Stdout(c *ucli.Context) *LineWriter
func (*LineWriter) Err ¶ added in v0.43.0
func (l *LineWriter) Err() error
func (*LineWriter) Printf ¶ added in v0.43.0
func (l *LineWriter) Printf(format string, a ...any)
func (*LineWriter) Println ¶ added in v0.43.0
func (l *LineWriter) Println(a ...any)