steering

package
v0.2.49 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: GPL-2.0, GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package steering generates the environment.md steering file kiro-cli reads on every session. Regenerated at startup, before each bridge spawn (so every session reads fresh content), when the MCP runtime registry changes, and when the composition-layer forge snapshot cache observes a change (login/disconnect or TTL revalidation). The generator itself must stay fast and network-free: it runs synchronously on the session-start path, so anything slow (forge CLI repo listings) is cached upstream and handed in via snapshot callbacks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseInclusion added in v0.1.165

func ParseInclusion(data []byte) string

ParseInclusion returns the validated inclusion mode ("always", "fileMatch", or "manual") from a steering markdown file's YAML front-matter, folding unknown or absent values to "always". It tolerates a leading UTF-8 BOM and CRLF line endings. Exported so the REST kiro-config scanner (internal/server) classifies steering docs through this single parser rather than a divergent copy.

Types

type AgentEntry

type AgentEntry struct {
	Filename string
	Name     string // from JSON "name" field
}

AgentEntry is a custom agent config found in `.kiro/agents/`.

type Doc

type Doc struct {
	Filename    string // basename, e.g. "architecture.md"
	Inclusion   string // "always" | "fileMatch" | "manual"; defaults to "always"
	FileMatch   string // glob pattern when Inclusion == "fileMatch"; empty otherwise
	Description string // human-readable description from the description field
}

Doc is one classified per-repo steering markdown file. The `Filename` is the basename (e.g. "conventions.md"); the `Inclusion` + `FileMatch` + `Description` are parsed from YAML frontmatter (or defaulted when absent). Used by writeWorkspace to render the per-repo steering inventory in environment.md grouped by trigger type.

type ForgeProvider

type ForgeProvider struct {
	Kind  string   // "github", "gitlab", etc.
	Host  string   // "github.com", "gitlab.company.com"
	User  string   // authenticated username
	Email string   // authenticated email (best-effort, may be "")
	Repos []string // top repo names (capped for brevity)
}

ForgeProvider is one connected forge with its repos.

type ForgeSnapshot

type ForgeSnapshot struct {
	Providers []ForgeProvider
}

ForgeSnapshot describes connected forge providers for the steering file.

type Generator

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

Generator produces steering files for kiro-cli.

func New

func New(workDir, configDir string) *Generator

New returns a Generator that writes steering files for the given workDir and configDir.

func (*Generator) CustomPath

func (g *Generator) CustomPath() string

CustomPath returns the path to the custom.md steering file in the kiro home directory.

func (*Generator) Generate

func (g *Generator) Generate(ctx context.Context)

Generate renders environment.md and writes it atomically. Holds g.mu across the full write so concurrent Generate calls serialise rather than racing. Skips the write when the rendered content is byte-identical to the existing file (avoids mtime bumps from frequent MCP-event triggered regenerations).

func (*Generator) SetForgeSnapshot

func (g *Generator) SetForgeSnapshot(fn func() ForgeSnapshot)

SetForgeSnapshot wires a callback that returns connected forge info. Called once after construction. If unset, the forge section is omitted.

func (*Generator) SetMCPSnapshot

func (g *Generator) SetMCPSnapshot(fn func() MCPSnapshot)

SetMCPSnapshot wires a snapshot callback. Called once after construction. If unset, the generator omits the MCP section entirely. The callback runs OUTSIDE the generator's mutex (so it may safely take hub locks without re-entry risk); only the pointer assignment and read are lock-guarded. Generate enforces this by snapshotting g.mcpSnapshot under g.mu, then releasing the lock around the call.

type HookEntry

type HookEntry struct {
	Filename string
	Name     string // hook name from the v1 envelope
	Trigger  string // PascalCase trigger: "SessionStart", "PreToolUse", "PostFileSave", …
	Command  string // truncated action preview (command, or prompt for agent hooks)
}

HookEntry is one hook from a `.kiro/hooks/*.json` document.

type MCPSnapshot

type MCPSnapshot struct {
	Servers []api.MCPSnapshotServer
}

MCPSnapshot is the subset of the MCP runtime registry the steering generator uses. Returned by the snapshot function wired at construct time; steering has no direct dependency on hub internals.

Jump to

Keyboard shortcuts

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