cli

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "dev"
	Commit  = unknownValue
	BuiltAt = unknownValue
)
View Source
var ErrCompletionEmpty = errors.New("completion: nothing to complete")

ErrCompletionEmpty is reserved for future dynamic completions that may return nothing. Kept for API stability.

View Source
var SupportedShells = []string{"bash", "zsh", "pwsh", "powershell"}

SupportedShells lists the shells for which completion scripts exist.

Functions

func Completion

func Completion(shell string, w io.Writer) error

Completion writes a completion script for the named shell to w.

func EnsureHarness

func EnsureHarness(reqs []require.Requirement, flowPath ...string) (string, error)

EnsureHarness builds or reuses a runner binary linked with exactly the external modules declared by reqs.

func EnsureHarnessContext added in v0.15.0

func EnsureHarnessContext(ctx context.Context, reqs []require.Requirement, flowPath ...string) (string, error)

EnsureHarnessContext is EnsureHarness with caller-controlled cancellation.

func ExecHarness

func ExecHarness(bin string, args []string) int

func ExecHarnessContext added in v0.15.0

func ExecHarnessContext(ctx context.Context, bin string, args []string) int

ExecHarnessContext runs a generated harness with caller-controlled cancellation.

func Print

func Print(w interface{ Write([]byte) (int, error) })

Print writes a multi-line build summary to w.

func PrintCommandHelp

func PrintCommandHelp(w io.Writer, command string) bool

func PrintTopHelp

func PrintTopHelp(w io.Writer)

func Run

func Run(args []string) int

Run is the central CLI dispatcher.

func RunContext added in v0.15.0

func RunContext(ctx context.Context, args []string) int

RunContext is Run with a caller-controlled parent context. It also cancels the invocation on Ctrl+C/SIGINT and, where supported, SIGTERM.

func RunEmbedded

func RunEmbedded(ctx context.Context, source string, args []string) int

func RunEmbeddedWithBundleFactoriesForRequirements added in v0.15.0

func RunEmbeddedWithBundleFactoriesForRequirements(ctx context.Context, source string, args, targets []string, construct func(func(core.Bundle) error) error) int

RunEmbeddedWithBundleFactoriesForRequirements adopts each generated bundle as soon as its factory returns, before later factories or Flow dispatch run.

func RunEmbeddedWithBundles

func RunEmbeddedWithBundles(ctx context.Context, source string, args []string, bundles []core.Bundle) int

func RunEmbeddedWithBundlesForRequirements added in v0.15.0

func RunEmbeddedWithBundlesForRequirements(ctx context.Context, source string, args []string, bundles []core.Bundle, targets []string) int

RunEmbeddedWithBundlesForRequirements is the embedded-flow counterpart of RunWithBundlesForRequirements.

func RunPath

func RunPath(ctx context.Context, args []string) int

func RunWithBundleFactoriesForRequirements added in v0.15.0

func RunWithBundleFactoriesForRequirements(args, targets []string, construct func(func(core.Bundle) error) error) int

RunWithBundleFactoriesForRequirements runs generated CLI code in one host scope and adopts each returned bundle before the next factory runs.

func RunWithBundles

func RunWithBundles(args []string, bundles []core.Bundle) int

func RunWithBundlesForRequirements added in v0.15.0

func RunWithBundlesForRequirements(args []string, bundles []core.Bundle, targets []string) int

RunWithBundlesForRequirements injects bundles linked to their original @require targets. This preserves bundle IDs when an explicit package variant has a different import-path suffix.

func SelfBuild

func SelfBuild(ctx context.Context) error

SelfBuild rebuilds the running nexssflow binary in place, injecting VCS metadata from the source directory. It replaces the manual `go install` step for developers who want consistent version output.

func SourceRequires

func SourceRequires(path string) ([]require.Requirement, error)

SourceRequires performs the native-directive bootstrap pass and owns any resources constructed while discovering requirements.

Types

type ASTNode added in v0.14.0

type ASTNode struct {
	Kind string       `json:"kind"`
	Pos  *ASTPosition `json:"pos,omitempty"`

	Name string         `json:"name,omitempty"`
	Args map[string]any `json:"args,omitempty"`

	Raw       string `json:"raw,omitempty"`
	Condition string `json:"condition,omitempty"`
	Message   string `json:"message,omitempty"`
	Until     string `json:"until,omitempty"`

	L        *ASTNode   `json:"l,omitempty"`
	R        *ASTNode   `json:"r,omitempty"`
	Cond     *ASTNode   `json:"cond,omitempty"`
	Then     *ASTNode   `json:"then,omitempty"`
	Else     *ASTNode   `json:"else,omitempty"`
	Body     *ASTNode   `json:"body,omitempty"`
	Branches []*ASTNode `json:"branches,omitempty"`
}

ASTNode is the machine-readable form of one AST node. Fields are populated selectively based on Kind:

Atom          — Name, Args
Pipe          — L, R
Parallel      — Branches
Fallback      — L, R
Conditional   — Cond, Then, Else
Projection    — Raw
Loop          — Body, Until
Assert        — Condition, Message

A consumer that switches on Kind only reads the fields the Kind documents. Unknown kinds carry only Kind, which is the extension point: a future AST node type adds a new Kind string and its own fields without breaking existing consumers.

type ASTPipeline added in v0.14.0

type ASTPipeline struct {
	Name string   `json:"name"`
	Body *ASTNode `json:"body"`
}

ASTPipeline is one named pipeline definition.

type ASTPosition added in v0.19.0

type ASTPosition struct {
	File string `json:"file,omitempty"`
	Line int    `json:"line,omitempty"`
	Col  int    `json:"col,omitempty"`
}

type ASTReport added in v0.14.0

type ASTReport struct {
	Path      string        `json:"path"`
	TopLevel  *ASTNode      `json:"top_level,omitempty"`
	Pipelines []ASTPipeline `json:"pipelines,omitempty"`
}

ASTReport is the top-level JSON envelope. TopLevel is omitted when the file contains only @pipeline definitions.

type LintIssue

type LintIssue struct {
	File    string `json:"file"`
	Line    int    `json:"line,omitempty"`
	Kind    string `json:"kind"`
	Message string `json:"message"`
}

LintIssue is one problem found in a .nflow source. The shape is stable — the CLI prints it as JSON so tooling and editors can consume it. File is always a real path (never a synthetic label).

type Step

type Step struct {
	// contains filtered or unexported fields
}

Step is one in-flight build step. Exactly one terminal method should be called; further calls are ignored.

func (*Step) Done

func (s *Step) Done()

Done finishes the step with no suffix.

func (*Step) DoneTimed

func (s *Step) DoneTimed()

DoneTimed finishes the step and appends the elapsed wall clock.

func (*Step) Fail

func (s *Step) Fail(err error)

Fail finishes the step with a red error marker.

type StepLogger

type StepLogger struct {
	// contains filtered or unexported fields
}

StepLogger prints numbered build steps. In an interactive terminal it animates a spinner while a step is running. When stdout is redirected to a file or a pipe, the spinner is disabled so CI logs stay clean.

func NewStepLogger

func NewStepLogger(w io.Writer, total int) *StepLogger

NewStepLogger returns a logger that will print at most total steps.

func (*StepLogger) Start

func (l *StepLogger) Start(label, detail string) *Step

Start begins a step. In a TTY it launches the spinner goroutine.

Directories

Path Synopsis
Package selftest runs the Nexss Flow self-test suite: a feature-by- feature check of every registered bundle, run in-process against the binary's own compiler and runtime.
Package selftest runs the Nexss Flow self-test suite: a feature-by- feature check of every registered bundle, run in-process against the binary's own compiler and runtime.

Jump to

Keyboard shortcuts

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