cli

package
v0.0.0-...-137e883 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusSuccess = "✔" // Standardized
	StatusError   = "❗" // Standardized
	StatusWarning = "⚠" // Added
	StatusInfo    = "ℹ" // Added
	StatusArrow   = "→"
	StatusBullet  = "•"
)

Professional CLI status symbols

View Source
const AgentHint = `AI Agent? Run "af agent help" for structured JSON output.`

Variables

View Source
var (
	Green  = color.New(color.FgGreen).SprintFunc()
	Red    = color.New(color.FgRed).SprintFunc()
	Yellow = color.New(color.FgYellow).SprintFunc()
	Blue   = color.New(color.FgBlue).SprintFunc()
	Cyan   = color.New(color.FgCyan).SprintFunc() // Added
	Gray   = color.New(color.FgHiBlack).SprintFunc()
	Bold   = color.New(color.Bold).SprintFunc()
)

Color functions for professional output

Functions

func AgentHintJSON

func AgentHintJSON(errMsg string) string

AgentHintJSON returns a structured JSON hint on stderr for agents that ran a wrong root command.

func GetAPIKey

func GetAPIKey() string

func GetBackendOnlyFlag

func GetBackendOnlyFlag() bool

func GetConfigFilePath

func GetConfigFilePath() string

Getters for flags

func GetOpenBrowserFlag

func GetOpenBrowserFlag() bool

func GetOutputFormat

func GetOutputFormat() string

func GetPortFlag

func GetPortFlag() int

func GetRequestTimeout

func GetRequestTimeout() int

func GetServerURL

func GetServerURL() string

func GetUIDevFlag

func GetUIDevFlag() bool

func NewAddCommand

func NewAddCommand() *cobra.Command

NewAddCommand creates the add command for adding dependencies

func NewAgentCommand

func NewAgentCommand() *cobra.Command

func NewConfigCommand

func NewConfigCommand() *cobra.Command

NewConfigCommand creates the config command

func NewExecutionCommand

func NewExecutionCommand() *cobra.Command

NewExecutionCommand groups execution management subcommands.

func NewInitCommand

func NewInitCommand() *cobra.Command

NewInitCommand builds a fresh Cobra command for initializing a new agent project.

func NewListCommand

func NewListCommand() *cobra.Command

NewListCommand creates the list command

func NewLogsCommand

func NewLogsCommand() *cobra.Command

NewLogsCommand creates the logs command

func NewMCPCommand

func NewMCPCommand() *cobra.Command

NewMCPCommand creates the mcp command for managing MCP servers

func NewMCPDiscoverCommand

func NewMCPDiscoverCommand() *cobra.Command

NewMCPDiscoverCommand creates the mcp discover command

func NewMCPLogsCommand

func NewMCPLogsCommand() *cobra.Command

NewMCPLogsCommand creates the mcp logs command

func NewMCPMigrateCommand

func NewMCPMigrateCommand() *cobra.Command

NewMCPMigrateCommand creates the mcp migrate command

func NewMCPRemoveCommand

func NewMCPRemoveCommand() *cobra.Command

NewMCPRemoveCommand creates the mcp remove command

func NewMCPRestartCommand

func NewMCPRestartCommand() *cobra.Command

NewMCPRestartCommand creates the mcp restart command

func NewMCPSkillsCommand

func NewMCPSkillsCommand() *cobra.Command

NewMCPSkillsCommand creates the mcp skills command

func NewMCPSkillsGenerateCommand

func NewMCPSkillsGenerateCommand() *cobra.Command

NewMCPSkillsGenerateCommand creates the mcp skills generate command

func NewMCPSkillsListCommand

func NewMCPSkillsListCommand() *cobra.Command

NewMCPSkillsListCommand creates the mcp skills list command

func NewMCPSkillsRefreshCommand

func NewMCPSkillsRefreshCommand() *cobra.Command

NewMCPSkillsRefreshCommand creates the mcp skills refresh command

func NewMCPStartCommand

func NewMCPStartCommand() *cobra.Command

NewMCPStartCommand creates the mcp start command

func NewMCPStatusCommand

func NewMCPStatusCommand() *cobra.Command

NewMCPStatusCommand creates the mcp status command

func NewMCPStopCommand

func NewMCPStopCommand() *cobra.Command

NewMCPStopCommand creates the mcp stop command

func NewNodesCommand

func NewNodesCommand() *cobra.Command

NewNodesCommand groups node management subcommands.

func NewRootCommand

func NewRootCommand(runServerFunc func(cmd *cobra.Command, args []string), versionInfo VersionInfo) *cobra.Command

NewRootCommand creates and returns the root Cobra command for the AgentField CLI.

func NewStopCommand

func NewStopCommand() *cobra.Command

NewStopCommand creates the stop command

func NewUninstallCommand

func NewUninstallCommand() *cobra.Command

NewUninstallCommand creates the uninstall command

func NewVCCommand

func NewVCCommand() *cobra.Command

NewVCCommand creates the vc command with subcommands

func NewVCVerifyCommand

func NewVCVerifyCommand() *cobra.Command

NewVCVerifyCommand creates the vc verify subcommand

func NewVersionCommand

func NewVersionCommand(versionInfo VersionInfo) *cobra.Command

NewVersionCommand creates the version command

func PrintBullet

func PrintBullet(message string)

PrintBullet prints a bullet point

func PrintError

func PrintError(message string)

PrintError prints an error message with cross mark

func PrintHeader

func PrintHeader(message string)

PrintHeader prints a header message in bold

func PrintInfo

func PrintInfo(message string)

PrintInfo prints an informational message with arrow

func PrintSubheader

func PrintSubheader(message string)

PrintSubheader prints a subheader message

func PrintSuccess

func PrintSuccess(message string)

PrintSuccess prints a success message with checkmark

func PrintWarning

func PrintWarning(message string)

PrintWarning prints a warning message

Types

type AgentError

type AgentError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Hint    string `json:"hint,omitempty"`
}

type AgentMeta

type AgentMeta struct {
	Server     string `json:"server"`
	Latency    string `json:"latency,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
}

type AgentNodeStopper

type AgentNodeStopper struct {
	AgentFieldHome string
}

AgentNodeStopper handles stopping agent nodes

func (*AgentNodeStopper) StopAgentNode

func (as *AgentNodeStopper) StopAgentNode(agentNodeName string) error

StopAgentNode stops a running agent node

type AgentResponse

type AgentResponse struct {
	OK    bool        `json:"ok"`
	Data  interface{} `json:"data,omitempty"`
	Error *AgentError `json:"error,omitempty"`
	Meta  *AgentMeta  `json:"meta,omitempty"`
}

type ComplianceChecks

type ComplianceChecks struct {
	W3CCompliance                bool                `json:"w3c_compliance"`
	AgentFieldStandardCompliance bool                `json:"agentfield_standard_compliance"`
	AuditTrailIntegrity          bool                `json:"audit_trail_integrity"`
	DataIntegrityChecks          bool                `json:"data_integrity_checks"`
	Issues                       []VerificationIssue `json:"issues"`
}

ComplianceChecks represents compliance and audit verification results

type ComponentVerification

type ComponentVerification struct {
	VCID           string `json:"vc_id"`
	ExecutionID    string `json:"execution_id"`
	IssuerDID      string `json:"issuer_did"`
	Valid          bool   `json:"valid"`
	SignatureValid bool   `json:"signature_valid"`
	FormatValid    bool   `json:"format_valid"`
	Status         string `json:"status"`
	DurationMS     int    `json:"duration_ms"`
	Timestamp      string `json:"timestamp"`
	Error          string `json:"error,omitempty"`
}

ComponentVerification represents verification result for a single component

type ComprehensiveVerificationResult

type ComprehensiveVerificationResult struct {
	Valid                 bool                    `json:"valid"`
	OverallScore          float64                 `json:"overall_score"` // 0-100
	CriticalIssues        []VerificationIssue     `json:"critical_issues"`
	Warnings              []VerificationIssue     `json:"warnings"`
	ComponentResults      []ComponentVerification `json:"component_results"`
	WorkflowVerification  *WorkflowVerification   `json:"workflow_verification,omitempty"`
	IntegrityChecks       IntegrityCheckResults   `json:"integrity_checks"`
	SecurityAnalysis      SecurityAnalysis        `json:"security_analysis"`
	ComplianceChecks      ComplianceChecks        `json:"compliance_checks"`
	VerificationTimestamp string                  `json:"verification_timestamp"`
}

ComprehensiveVerificationResult provides detailed verification results

type DIDResolutionInfo

type DIDResolutionInfo struct {
	DID          string                 `json:"did"`
	Method       string                 `json:"method"`
	PublicKeyJWK map[string]interface{} `json:"public_key_jwk"`
	WebURL       string                 `json:"web_url,omitempty"`
	CachedAt     string                 `json:"cached_at,omitempty"`
	ResolvedFrom string                 `json:"resolved_from"`
}

DIDResolutionInfo represents DID resolution information

type DIDResolutionResult

type DIDResolutionResult struct {
	DID          string `json:"did"`
	Method       string `json:"method"`
	ResolvedFrom string `json:"resolved_from"`
	Success      bool   `json:"success"`
	Error        string `json:"error,omitempty"`
	WebURL       string `json:"web_url,omitempty"`
}

DIDResolutionResult represents the result of DID resolution

type EnhancedVCChain

type EnhancedVCChain struct {
	WorkflowID           string                       `json:"workflow_id"`
	GeneratedAt          string                       `json:"generated_at"`
	TotalExecutions      int                          `json:"total_executions"`
	CompletedExecutions  int                          `json:"completed_executions"`
	WorkflowStatus       string                       `json:"workflow_status"`
	ExecutionVCs         []types.ExecutionVC          `json:"execution_vcs"`
	ComponentVCs         []types.ExecutionVC          `json:"component_vcs,omitempty"`
	WorkflowVC           types.WorkflowVC             `json:"workflow_vc"`
	DIDResolutionBundle  map[string]DIDResolutionInfo `json:"did_resolution_bundle,omitempty"`
	VerificationMetadata VerificationMetadata         `json:"verification_metadata,omitempty"`
}

EnhancedVCChain represents a VC chain with DID resolution bundle

type EnhancedVCVerifier

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

EnhancedVCVerifier provides comprehensive VC verification with all integrity checks

func NewEnhancedVCVerifier

func NewEnhancedVCVerifier(didResolutions map[string]DIDResolutionInfo, verbose bool) *EnhancedVCVerifier

NewEnhancedVCVerifier creates a new enhanced VC verifier

func (*EnhancedVCVerifier) VerifyEnhancedVCChain

func (v *EnhancedVCVerifier) VerifyEnhancedVCChain(chain EnhancedVCChain) *ComprehensiveVerificationResult

VerifyEnhancedVCChain performs comprehensive verification of a VC chain

type IntegrityCheckResults

type IntegrityCheckResults struct {
	MetadataConsistency bool                `json:"metadata_consistency"`
	FieldConsistency    bool                `json:"field_consistency"`
	TimestampValidation bool                `json:"timestamp_validation"`
	HashValidation      bool                `json:"hash_validation"`
	StructuralIntegrity bool                `json:"structural_integrity"`
	Issues              []VerificationIssue `json:"issues"`
}

IntegrityCheckResults represents various integrity verification results

type LogViewer

type LogViewer struct {
	AgentFieldHome string
	Follow         bool
	Tail           int
}

LogViewer handles viewing agent node logs

func (*LogViewer) ViewLogs

func (lv *LogViewer) ViewLogs(agentNodeName string) error

ViewLogs displays logs for an agent node

type MCPAddCommand

type MCPAddCommand struct {
	ProjectDir string
	Opts       *MCPAddOptions
	Verbose    bool
	AppConfig  *config.Config
	Manager    *mcp.MCPManager // Initialized in the builder or Execute
}

MCPAddCommand encapsulates the logic for adding an MCP server.

func NewMCPAddCommand

func NewMCPAddCommand(projectDir string, opts *MCPAddOptions, verboseFlag bool) (*MCPAddCommand, error)

NewMCPAddCommand acts as a builder for MCPAddCommand. It performs initial processing and validation.

func (*MCPAddCommand) Execute

func (cmd *MCPAddCommand) Execute() error

Execute performs the MCP server addition.

type MCPAddOptions

type MCPAddOptions struct {
	Source      string   // Positional argument
	Alias       string   // Positional argument or --alias flag
	MCP         bool     // --mcp flag
	Force       bool     // --force flag
	URL         string   // --url flag (for remote MCP servers)
	RunCmd      string   // --run flag (command to run the server)
	SetupCmds   []string // --setup flags (setup commands, repeatable)
	WorkingDir  string   // --working-dir flag
	EnvVars     []string // --env flags (raw "KEY=VALUE")
	Description string   // --description flag
	Tags        []string // --tags flags (repeatable)
	HealthCheck string   // --health-check flag
	Timeout     int      // --timeout flag (in seconds)
	Version     string   // --version flag
}

MCPAddOptions holds all the flag-based options for the 'add --mcp' command.

type PackageConfigManager

type PackageConfigManager struct {
	AgentFieldHome string
}

PackageConfigManager handles environment configuration for packages

func (*PackageConfigManager) InteractiveConfig

func (pcm *PackageConfigManager) InteractiveConfig(packageName string) error

InteractiveConfig runs interactive configuration for a package

func (*PackageConfigManager) ListConfig

func (pcm *PackageConfigManager) ListConfig(packageName string) error

ListConfig lists current environment configuration for a package

func (*PackageConfigManager) SetVariable

func (pcm *PackageConfigManager) SetVariable(packageName, key, value string) error

SetVariable sets a specific environment variable

func (*PackageConfigManager) UnsetVariable

func (pcm *PackageConfigManager) UnsetVariable(packageName, key string) error

UnsetVariable removes an environment variable

type SecurityAnalysis

type SecurityAnalysis struct {
	SignatureStrength string              `json:"signature_strength"`
	KeyValidation     bool                `json:"key_validation"`
	DIDAuthenticity   bool                `json:"did_authenticity"`
	ReplayProtection  bool                `json:"replay_protection"`
	TamperEvidence    []string            `json:"tamper_evidence"`
	SecurityScore     float64             `json:"security_score"`
	Issues            []VerificationIssue `json:"issues"`
}

SecurityAnalysis represents security-focused verification results

type Spinner

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

Spinner represents a CLI spinner for progress indication

func NewSpinner

func NewSpinner(message string) *Spinner

NewSpinner creates a new spinner with the given message

func (*Spinner) Error

func (s *Spinner) Error(message string)

Error stops the spinner and shows an error message

func (*Spinner) Start

func (s *Spinner) Start()

Start begins the spinner animation

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop stops the spinner and clears the line

func (*Spinner) Success

func (s *Spinner) Success(message string)

Success stops the spinner and shows a success message

func (*Spinner) UpdateMessage

func (s *Spinner) UpdateMessage(message string)

UpdateMessage updates the spinner message while it's running

type VCVerificationResult

type VCVerificationResult struct {
	Valid             bool                    `json:"valid"`
	Type              string                  `json:"type"`
	WorkflowID        string                  `json:"workflow_id,omitempty"`
	SignatureValid    bool                    `json:"signature_valid"`
	FormatValid       bool                    `json:"format_valid"`
	Message           string                  `json:"message"`
	Error             string                  `json:"error,omitempty"`
	VerifiedAt        string                  `json:"verified_at"`
	ComponentResults  []ComponentVerification `json:"component_results,omitempty"`
	DIDResolutions    []DIDResolutionResult   `json:"did_resolutions,omitempty"`
	VerificationSteps []VerificationStep      `json:"verification_steps,omitempty"`
	Summary           VerificationSummary     `json:"summary"`
}

VCVerificationResult represents the comprehensive verification result

type VerificationIssue

type VerificationIssue struct {
	Type        string `json:"type"`
	Severity    string `json:"severity"` // "critical", "warning", "info"
	Component   string `json:"component"`
	Field       string `json:"field"`
	Expected    string `json:"expected"`
	Actual      string `json:"actual"`
	Description string `json:"description"`
}

VerificationIssue represents a specific verification problem

type VerificationMetadata

type VerificationMetadata struct {
	ExportVersion   string `json:"export_version"`
	TotalSignatures int    `json:"total_signatures"`
	BundledDIDs     int    `json:"bundled_dids"`
	ExportTimestamp string `json:"export_timestamp"`
}

VerificationMetadata contains metadata about the verification process

type VerificationStep

type VerificationStep struct {
	Step        int    `json:"step"`
	Description string `json:"description"`
	Success     bool   `json:"success"`
	Details     string `json:"details,omitempty"`
	Error       string `json:"error,omitempty"`
}

VerificationStep represents a single step in the verification process

type VerificationSummary

type VerificationSummary struct {
	TotalComponents int `json:"total_components"`
	ValidComponents int `json:"valid_components"`
	TotalDIDs       int `json:"total_dids"`
	ResolvedDIDs    int `json:"resolved_dids"`
	TotalSignatures int `json:"total_signatures"`
	ValidSignatures int `json:"valid_signatures"`
}

VerificationSummary provides a high-level summary

type VerifyOptions

type VerifyOptions struct {
	OutputFormat string
	ResolveWeb   bool
	Resolver     string
	Verbose      bool
}

VerifyOptions holds verification configuration

type VersionInfo

type VersionInfo struct {
	Version string
	Commit  string
	Date    string
}

VersionInfo holds build-time version information

type WorkflowVerification

type WorkflowVerification struct {
	WorkflowID           string              `json:"workflow_id"`
	Valid                bool                `json:"valid"`
	SignatureValid       bool                `json:"signature_valid"`
	ComponentConsistency bool                `json:"component_consistency"`
	TimestampConsistency bool                `json:"timestamp_consistency"`
	StatusConsistency    bool                `json:"status_consistency"`
	ChainIntegrity       bool                `json:"chain_integrity"`
	Issues               []VerificationIssue `json:"issues"`
}

WorkflowVerification represents workflow-level verification results

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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