common

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ToolManifestName = "TOOL.md"

Variables

This section is empty.

Functions

func EnsureUserPathContains

func EnsureUserPathContains(dir string) error

func ExpandHome

func ExpandHome(path string) (string, error)

func LoadSecretsFile

func LoadSecretsFile(path string) (map[string]string, error)

LoadSecretsFile reads a simple env-style secrets file. Lines are KEY=VALUE. Empty lines and lines starting with '#' are ignored.

func LooksLikePath

func LooksLikePath(s string) bool

LooksLikePath checks if a string looks like a file or directory path. Cross-platform support for both Unix and Windows paths. Returns true if the string: - Is an absolute path (Unix: /root, Windows: C:\) - Starts with "~", "~/" or "~\" (home directory path) - Starts with "./" or ".\" or "../" or "..\" (relative path) - Contains path separator "/" or "\" Returns false for command-line flags (strings starting with "-")

func OpagentBinDir

func OpagentBinDir() string

func ProjectSystemToolBins

func ProjectSystemToolBins(baseDir string) error

func RemoveProjectedPaths

func RemoveProjectedPaths(paths []string) error

func ResolveAbsolutePath

func ResolveAbsolutePath(workDir, path string) (string, error)

ResolveAbsolutePath returns a reliable absolute path based on workDir and path. - Supports ~ and ~/ prefix expansion - If workDir is empty, uses current working directory - If path is absolute, returns the cleaned result - Otherwise, joins workDir with path and returns the cleaned result

func ResolveSecretRefs

func ResolveSecretRefs(value string, secrets map[string]string) (string, error)

ResolveSecretRefs replaces @id tokens using the provided secrets map.

func StripJSONComments

func StripJSONComments(raw []byte) ([]byte, error)

func SyncToolBinProjection

func SyncToolBinProjection(baseDir string, toolRoot string, previousPaths []string) ([]string, error)

func UnmarshalJSONC

func UnmarshalJSONC(raw []byte, out any) error

UnmarshalJSONC unmarshals JSON after stripping JavaScript-style comments. It supports // line comments and /* block comments */. Other JSONC features such as trailing commas are intentionally not supported.

func WithPrependedPath

func WithPrependedPath(env []string, dirs ...string) []string

Types

This section is empty.

Jump to

Keyboard shortcuts

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