facts

package
v1.0.64 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandExample

type CommandExample struct {
	Raw          string `json:"raw"`
	SourceFile   string `json:"source_file"`
	Line         int    `json:"line"`
	CommandPath  string `json:"command_path,omitempty"`
	Domain       string `json:"domain,omitempty"`
	Changed      bool   `json:"changed,omitempty"`
	Source       string `json:"source,omitempty"`
	Executable   bool   `json:"executable"`
	SkipReason   string `json:"skip_reason,omitempty"`
	ExitCode     int    `json:"exit_code,omitempty"`
	StdoutBytes  int    `json:"stdout_bytes,omitempty"`
	APICallCount int    `json:"api_call_count,omitempty"`
	// Reserved for future request-shape producers; v1 does not emit it.
	ExpectedRequest *DryRunRequest `json:"expected_request,omitempty"`
	DryRun          *DryRunRequest `json:"dry_run,omitempty"`
}

type CommandFact

type CommandFact struct {
	Path                  string           `json:"path"`
	CanonicalPath         string           `json:"canonical_path,omitempty"`
	Domain                string           `json:"domain,omitempty"`
	Changed               bool             `json:"changed,omitempty"`
	Source                string           `json:"source"`
	Generated             bool             `json:"generated,omitempty"`
	Flags                 []string         `json:"flags,omitempty"`
	Examples              []CommandExample `json:"examples,omitempty"`
	LegacyNaming          bool             `json:"legacy_naming,omitempty"`
	NameConflictsExisting bool             `json:"name_conflicts_existing,omitempty"`
	FlagAliasConflict     bool             `json:"flag_alias_conflict,omitempty"`
}

type DiagnosticFact

type DiagnosticFact struct {
	Rule        string        `json:"rule"`
	Action      report.Action `json:"action"`
	File        string        `json:"file"`
	Line        int           `json:"line"`
	Message     string        `json:"message"`
	Suggestion  string        `json:"suggestion,omitempty"`
	SubjectType string        `json:"subject_type,omitempty"`
	CommandPath string        `json:"command_path,omitempty"`
	FlagName    string        `json:"flag_name,omitempty"`
}

func DiagnosticsFromReport

func DiagnosticsFromReport(ds []report.Diagnostic) []DiagnosticFact

type DryRunRequest

type DryRunRequest struct {
	Method string              `json:"method"`
	URL    string              `json:"url"`
	Query  map[string][]string `json:"query,omitempty"`
	Params map[string]any      `json:"params,omitempty"`
	Body   json.RawMessage     `json:"body,omitempty"`
}

type ErrorFact

type ErrorFact struct {
	File                string `json:"file"`
	Line                int    `json:"line"`
	Command             string `json:"command,omitempty"`
	CommandPath         string `json:"command_path,omitempty"`
	Domain              string `json:"domain,omitempty"`
	Changed             bool   `json:"changed,omitempty"`
	Source              string `json:"source,omitempty"`
	Boundary            bool   `json:"boundary"`
	UsesStructuredError bool   `json:"uses_structured_error"`
	HasHint             bool   `json:"has_hint"`
	HintActionCount     int    `json:"hint_action_count"`
	RequiredHint        bool   `json:"required_hint"`
	Code                string `json:"code,omitempty"`
	Message             string `json:"message,omitempty"`
	Hint                string `json:"hint,omitempty"`
	Retryable           bool   `json:"retryable"`
}

type Facts

type Facts struct {
	SchemaVersion int                 `json:"schema_version"`
	Commands      []CommandFact       `json:"commands,omitempty"`
	Skills        []SkillFact         `json:"skills,omitempty"`
	SkillQuality  []SkillQualityFact  `json:"skill_quality,omitempty"`
	Errors        []ErrorFact         `json:"errors,omitempty"`
	Outputs       []OutputFact        `json:"outputs,omitempty"`
	Examples      []CommandExample    `json:"examples,omitempty"`
	PublicContent []PublicContentFact `json:"public_content,omitempty"`
	Diagnostics   []DiagnosticFact    `json:"diagnostics,omitempty"`
}

func Build

func Build(m manifest.Manifest, skillFacts []SkillFact, skillQualityFacts []SkillQualityFact, errorFacts []ErrorFact, exampleFacts []CommandExample, outputFacts []OutputFact, diags []report.Diagnostic, changedFiles ...map[string]bool) Facts

func BuildWithCommandLookup

func BuildWithCommandLookup(m manifest.Manifest, commandLookup manifest.Manifest, skillFacts []SkillFact, skillQualityFacts []SkillQualityFact, errorFacts []ErrorFact, exampleFacts []CommandExample, outputFacts []OutputFact, diags []report.Diagnostic, changedFiles ...map[string]bool) Facts

func ReadFile

func ReadFile(path string) (Facts, error)

func WithPublicContent added in v1.0.58

func WithPublicContent(f Facts, publicContent []PublicContentFact) Facts

func (Facts) WriteFile

func (f Facts) WriteFile(path string) error

type OutputFact

type OutputFact struct {
	Command          string   `json:"command"`
	Domain           string   `json:"domain,omitempty"`
	Changed          bool     `json:"changed,omitempty"`
	Source           string   `json:"source,omitempty"`
	Fields           []string `json:"fields,omitempty"`
	IsList           bool     `json:"is_list,omitempty"`
	HasDefaultLimit  bool     `json:"has_default_limit,omitempty"`
	HasFieldSelector bool     `json:"has_field_selector,omitempty"`
	HasDecisionField bool     `json:"has_decision_field,omitempty"`
}

type PublicContentFact added in v1.0.58

type PublicContentFact struct {
	Rule       string        `json:"rule"`
	Action     report.Action `json:"action"`
	File       string        `json:"file"`
	Line       int           `json:"line"`
	Source     string        `json:"source,omitempty"`
	Excerpt    string        `json:"excerpt,omitempty"`
	Message    string        `json:"message,omitempty"`
	Suggestion string        `json:"suggestion,omitempty"`
}

type SkillFact

type SkillFact struct {
	SourceFile               string `json:"source_file"`
	Line                     int    `json:"line"`
	Raw                      string `json:"raw"`
	CommandPath              string `json:"command_path,omitempty"`
	Domain                   string `json:"domain,omitempty"`
	Changed                  bool   `json:"changed,omitempty"`
	Source                   string `json:"source,omitempty"`
	ReferencesInvalidCommand bool   `json:"references_invalid_command"`
	DestructiveWithoutGuard  bool   `json:"destructive_without_guard,omitempty"`
	ScopeConflict            bool   `json:"scope_conflict,omitempty"`
}

type SkillQualityFact

type SkillQualityFact struct {
	SourceFile         string `json:"source_file"`
	Domain             string `json:"domain,omitempty"`
	Changed            bool   `json:"changed,omitempty"`
	WordCount          int    `json:"word_count"`
	CriticalCount      int    `json:"critical_count"`
	DescriptionLength  int    `json:"description_length"`
	CriticalOverBudget bool   `json:"critical_over_budget,omitempty"`
}

Jump to

Keyboard shortcuts

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