Implements the full PRD (docs/prds/yaegi-plugin-system.md): repos can now define .archie/gate.go for diff-inspecting quality rules shell commands can't express, .archie/stages/*.go for custom pipeline steps, and skills can ship Go scripts run via a new run_go_script agent tool — all interpreted in-process with Yaegi, with panics recovered so a bad script can't take down the daemon. Hot reload (phase 4) needed no code: every loader reads from disk per call and every task gets a fresh clone, so nothing is ever cached to go stale.
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
// Package gate defines the runtime-evaluated custom gate surface: a
|
|
// per-repo .archie/gate.go, interpreted via Yaegi after the shell-based
|
|
// gate passes, that inspects the diff and worktree for project-specific
|
|
// rules shell commands can't express (AST checks, diff scanning, and
|
|
// the like).
|
|
package gate
|
|
|
|
// GateContext carries everything a custom gate function can inspect.
|
|
type GateContext struct {
|
|
// Diff is the unified diff of all changes against BaseRef.
|
|
Diff string
|
|
// ChangedFiles lists changed file paths, repo-relative.
|
|
ChangedFiles []string
|
|
// Dir is the absolute worktree path.
|
|
Dir string
|
|
// BaseRef is the base branch the diff is against (e.g. "origin/main").
|
|
BaseRef string
|
|
// Repo is "owner/name".
|
|
Repo string
|
|
}
|
|
|
|
// Finding is one gate violation.
|
|
type Finding struct {
|
|
// Level is "error" (blocks the gate) or "warn" (advisory, logged only).
|
|
Level string
|
|
// File is the optional file path the finding applies to.
|
|
File string
|
|
// Line is the optional line number within File.
|
|
Line int
|
|
Message string
|
|
}
|
|
|
|
// Blocking reports whether any finding has Level "error".
|
|
func Blocking(findings []Finding) bool {
|
|
for _, f := range findings {
|
|
if f.Level == "error" {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|