utils

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSystemInfo

func GetSystemInfo() string

func GetWorkDir

func GetWorkDir() string

func OpenURL added in v0.5.2

func OpenURL(url string) error

OpenURL opens the given URL in the user's default browser. It returns the error from launching the platform-specific opener (the command is started, not waited on).

func ScrubbedGitEnv added in v0.9.2

func ScrubbedGitEnv() []string

ScrubbedGitEnv returns the process environment with repo-targeting GIT_* variables removed. git exports these to hook subprocesses (GIT_DIR is an absolute path when the hook runs in a linked worktree), and a git command that inherits them silently operates on THAT repository instead of the one selected by -C/cwd — e.g. a `git init` under an inherited GIT_DIR re-initializes the outer repo as bare. Every git subprocess jcode spawns against a caller-chosen directory must use this env.

Types

type EnvInfo

type EnvInfo struct {
	GitBranch   string // empty if not a git repo
	GitDirty    bool
	LastCommit  string // one-line: hash + subject
	ProjectType string // comma-joined list of detected project markers
	DirTree     string // shallow directory tree
}

EnvInfo is collected once at session start and injected into the system prompt.

func CollectEnvInfo

func CollectEnvInfo(pwd string) *EnvInfo

CollectEnvInfo gathers environment facts for pwd. All errors are suppressed — missing data is represented as empty strings/false.

func CollectEnvInfoLight added in v0.9.2

func CollectEnvInfoLight(pwd string) *EnvInfo

CollectEnvInfoLight gathers the cheap-to-refresh subset of environment facts for pwd: git state (branch/dirty/last commit, each with the usual 2s timeout) and project type. It skips buildDirTree — expensive, and never serialized into env snapshots anyway. Used for periodic in-session refresh.

Jump to

Keyboard shortcuts

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