Documentation
¶
Overview ¶
Package bridge runs legacy Kite script tasks through the standalone github.com/gookit/taskrun library.
The legacy runner in pkg/kscript stays in place as the rollback point. This package only converts what the legacy configuration already loaded and runs a single task or script file with the new engine; command aliases, extensions, plugins and system command fallback remain owned by Kite.
Index ¶
- Variables
- type Bridge
- func (b *Bridge) Definition(shell string, varNames, envNames []string) (taskrun.Definition, []string, error)
- func (b *Bridge) Run(ctx context.Context, name string, args []string, lctx *kscript.RunCtx) error
- func (b *Bridge) TryRun(ctx context.Context, name string, args []string, lctx *kscript.RunCtx) (bool, error)
- type Option
- func WithBaseDir(dir string) Option
- func WithEnvNames(names ...string) Option
- func WithEventObserver(observer taskrun.Observer) Option
- func WithHandler(name string, handler taskrun.Handler) Option
- func WithIO(io taskrun.IO) Option
- func WithLegacyFallback(enabled bool) Option
- func WithParseEnv(enabled bool) Option
- func WithVarNames(names ...string) Option
Constants ¶
This section is empty.
Variables ¶
var BaseVarNames = []string{
"gvs", "paths", "kite", "time", "workdir", "dirname", "cur_dir", "@", "*",
}
BaseVarNames lists the runtime variable names Kite injects in addition to the caller supplied variables. They mirror the legacy render context.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge converts the legacy runner configuration and runs tasks with the new engine.
func (*Bridge) Definition ¶
func (b *Bridge) Definition(shell string, varNames, envNames []string) (taskrun.Definition, []string, error)
Definition converts the loaded legacy configuration. The shell argument is the legacy per-run shell wrapper (RunCtx.Type); an empty value keeps the definition time conversion.
func (*Bridge) TryRun ¶
func (b *Bridge) TryRun(ctx context.Context, name string, args []string, lctx *kscript.RunCtx) (bool, error)
TryRun runs a script task or script file by name. It reports found=false only when the name matches neither, mirroring the legacy TryRun contract so the caller can continue with system command fallback.
type Option ¶
type Option func(*Bridge)
Option configures a Bridge.
func WithBaseDir ¶
WithBaseDir sets the absolute directory used by the converted definition. It defaults to the current working directory, matching the legacy behavior of resolving relative paths against the process directory.
func WithEnvNames ¶
WithEnvNames adds environment names for ParseEnv substitution.
func WithEventObserver ¶
WithEventObserver receives execution events instead of the default debug logger. Kite binds it when it wants to render progress itself.
func WithHandler ¶
WithHandler registers a host action for converted definitions.
func WithLegacyFallback ¶
WithLegacyFallback makes TryRun fall back to the legacy runner when the conversion fails, so a partially converted configuration never regresses. It logs the conversion error at warning level.
func WithParseEnv ¶
WithParseEnv enables the legacy ParseEnv behavior, where a bare $NAME that matches an environment variable is replaced by its value at render time. When disabled, such references are left for the shell to expand.
func WithVarNames ¶
WithVarNames adds runtime variable names beyond BaseVarNames, so legacy $name and ${name} references to them are rewritten.