cli

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DerefInt added in v0.43.0

func DerefInt(i *int) int

func DerefStr added in v0.43.0

func DerefStr(p *string) string

func EnsureStellaCLIInPath

func EnsureStellaCLIInPath(stellaHome string) error

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

func HoistFlags(app *ucli.App, argv []string) []string

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 IsJSON added in v0.43.0

func IsJSON(c *ucli.Context) bool

func JSONFlag added in v0.43.0

func JSONFlag() ucli.Flag

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

func ParseLogLevel() slog.Level

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.

func PrintDeleted added in v0.43.0

func PrintDeleted(c *ucli.Context, id string) error

func PrintJSON added in v0.43.0

func PrintJSON(c *ucli.Context, v any) error

func ShortID added in v0.43.0

func ShortID(id string) string

ShortID returns the first 8 chars of an ID for display.

func Truncate added in v0.43.0

func Truncate(s string, max int) string

Truncate shortens s to max runes, appending "…" when trimmed.

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)

Jump to

Keyboard shortcuts

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