Documentation
¶
Overview ¶
Error formatting
Filesystem helpers ¶
Git workflow-artifact exclusion ¶
Local context: typed values carried on an explicit context.Context, the native propagation mechanism across goroutines.
Named schema error ¶
Process helpers ¶
Record predicate.
What codeaf froze about a run's folder before it started
Index ¶
- Constants
- Variables
- func CaptureStack() string
- func Contains(parent, child string) bool
- func EnsureSeniorDevExcluded(ctx context.Context, workspace string) (bool, error)
- func ErrorData(value any) map[string]any
- func ErrorFormat(value any) string
- func ErrorMessage(value any) string
- func Exists(path string) bool
- func FileMimeType(path string) string
- func FindUp(targets []string, start string, stop string, options ...FindUpOptions) []string
- func GeneratedRunPath(path string) bool
- func GitArgv(args ...string) []string
- func GlobUp(pattern, start, stop string) []string
- func InitialIgnoredPaths() ([]string, error)
- func InitialInputs() (gitidentity.Inputs, error)
- func IsDir(path string) bool
- func IsRecord(value any) bool
- func NormalizePath(path string) string
- func NormalizePathPattern(path string) string
- func Overlaps(a, b string) bool
- func PathIgnoredAtStart(path string, paths []string) bool
- func ProcessLines(ctx context.Context, command []string, options ...RunOptions) ([]string, error)
- func ReadBytes(path string) ([]byte, error)
- func ReadJSON(path string, dst any) error
- func ReadText(path string) (string, error)
- func ResolvePath(path string) (string, error)
- func Size(path string) int64
- func Stat(path string) (os.FileInfo, bool)
- func StatAsync(path string) (os.FileInfo, bool, error)
- func StopProcess(ctx context.Context, child *Child)
- func Up(targets []string, start, stop string) []string
- func WindowsPath(path string) string
- func Write(path string, content []byte, mode ...fs.FileMode) error
- func WriteJSON(path string, data any, mode ...fs.FileMode) error
- func WriteStream(path string, stream io.Reader, mode ...fs.FileMode) error
- func WriteText(path, content string, mode ...fs.FileMode) error
- type Child
- type ContextNotFound
- type FindUpOptions
- type LocalContext
- type NamedErrorFactory
- type NamedSchemaError
- type ProcessOptions
- type ProcessResult
- type RunFailedError
- type RunOptions
- type StackError
- type TextResult
Constants ¶
const ( CommitterName = gitidentity.EngineName CommitterEmail = gitidentity.EngineEmail )
The values live in internal/gitidentity, which codeaf's own side of a run reads on every platform.
const GeneratedRunPaths = gitidentity.GeneratedRunPaths
GeneratedRunPaths and GeneratedRunPath are internal/gitidentity's, where codeaf's own side of a run reads them on every platform.
Variables ¶
var ExcludedPaths = []string{
".senior-dev/",
}
Functions ¶
func CaptureStack ¶
func CaptureStack() string
CaptureStack provides a convenient StackError stack for callers that need ErrorFormat's stack branch.
func EnsureSeniorDevExcluded ¶
EnsureSeniorDevExcluded adds senior-dev's own folder to the exclude file git reads for workspace, once.
THE FILE IS THE ONE GIT READS, which is not always <git-dir>/info/exclude. In a linked worktree the git dir is .git/worktrees/<name>, and git ignores an info/ folder there in favour of the common dir's. An exclude written beside the git dir changed nothing: `.senior-dev/` stayed untracked, and a commit of the tree's own status would have taken senior-dev's database, spec and tool logs with it. `rev-parse --git-path` names the file git actually consults, which for a linked worktree is the repository's shared one.
func ErrorFormat ¶
func ErrorMessage ¶
func FileMimeType ¶
func FindUp ¶
func FindUp(targets []string, start string, stop string, options ...FindUpOptions) []string
func GeneratedRunPath ¶
func InitialIgnoredPaths ¶
InitialIgnoredPaths reads the one list codeaf captured before the run.
func InitialInputs ¶
func InitialInputs() (gitidentity.Inputs, error)
InitialInputs reads the list of inputs codeaf copied into the run's copy, with their fingerprints; none for a run started any other way.
func NormalizePath ¶
func NormalizePathPattern ¶
func PathIgnoredAtStart ¶
PathIgnoredAtStart matches a file or a child of an ignored directory.
func ProcessLines ¶
func ResolvePath ¶
func StopProcess ¶
func WindowsPath ¶
Types ¶
type Child ¶
type Child struct {
Cmd *exec.Cmd
Stdin io.WriteCloser
Stdout io.ReadCloser
Stderr io.ReadCloser
Exited <-chan int
// contains filtered or unexported fields
}
func SpawnProcess ¶
type ContextNotFound ¶
type ContextNotFound struct{ Name string }
func (*ContextNotFound) Error ¶
func (e *ContextNotFound) Error() string
type FindUpOptions ¶
type FindUpOptions struct {
RootFirst bool
}
type LocalContext ¶
func CreateLocalContext ¶
func CreateLocalContext[T any](name string) *LocalContext[T]
func (*LocalContext[T]) MustUse ¶
func (l *LocalContext[T]) MustUse(ctx context.Context) T
type NamedErrorFactory ¶
type NamedErrorFactory struct {
Tag string
}
func NamedSchemaErrorFactory ¶
func NamedSchemaErrorFactory(tag string) NamedErrorFactory
func (NamedErrorFactory) IsInstance ¶
func (f NamedErrorFactory) IsInstance(value any) bool
func (NamedErrorFactory) New ¶
func (f NamedErrorFactory) New(data map[string]any, cause ...error) *NamedSchemaError
type NamedSchemaError ¶
type NamedSchemaError struct {
Name string `json:"name"`
Data map[string]any `json:"data"`
Cause error `json:"-"`
}
func (*NamedSchemaError) Error ¶
func (e *NamedSchemaError) Error() string
func (*NamedSchemaError) ToObject ¶
func (e *NamedSchemaError) ToObject() map[string]any
func (*NamedSchemaError) Unwrap ¶
func (e *NamedSchemaError) Unwrap() error
type ProcessOptions ¶
type ProcessResult ¶
type ProcessResult struct {
Code int `json:"code"`
Stdout []byte `json:"-"`
Stderr []byte `json:"-"`
}
func RunProcess ¶
func RunProcess(ctx context.Context, command []string, options ...RunOptions) (ProcessResult, error)
type RunFailedError ¶
func (*RunFailedError) Error ¶
func (e *RunFailedError) Error() string
func (*RunFailedError) ErrorName ¶
func (e *RunFailedError) ErrorName() string
type RunOptions ¶
type RunOptions struct {
ProcessOptions
NoThrow bool
}
type StackError ¶
StackError may supply a pre-recorded stack trace.
type TextResult ¶
type TextResult struct {
ProcessResult
Text string `json:"text"`
}
func TextProcess ¶
func TextProcess(ctx context.Context, command []string, options ...RunOptions) (TextResult, error)