service

package
v1.0.67 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdServiceMethod

func NewCmdServiceMethod(f *cmdutil.Factory, svc meta.Service, m meta.Method, name, resName string, runF func(*ServiceMethodOptions) error) *cobra.Command

NewCmdServiceMethod creates a command for a dynamically registered service method.

func NewCmdServiceMethodWithContext added in v1.0.16

func NewCmdServiceMethodWithContext(ctx context.Context, f *cmdutil.Factory, svc meta.Service, m meta.Method, name, resName string, runF func(*ServiceMethodOptions) error) *cobra.Command

NewCmdServiceMethodWithContext builds the command for one service method from its (service, resource, method) coordinates, deriving the methodCommandSpec via an apicatalog.MethodRef so direct callers and the catalog-driven registration assemble the command identically.

func PrepareDomainHelp added in v1.0.60

func PrepareDomainHelp(cmd *cobra.Command, skillFS fs.FS) bool

PrepareDomainHelp appends navigational guidance (routing line, risk legend, skill pointer) to a top-level Lark domain's description, returning false for anything that is not such a domain. Built lazily at help time because shortcuts attach after service registration. skillFS (nil-safe) gates the skill pointer.

A hand-authored Long is preserved as the base (e.g. event's "Use 'event consume <EventKey>'…"); service domains carry only a Short at this point, so we fall back to it. The pristine base is captured once into an annotation so re-rendering does not append the guidance twice.

func PrepareMethodHelp added in v1.0.60

func PrepareMethodHelp(cmd *cobra.Command, skillFS fs.FS) bool

PrepareMethodHelp rebuilds a generated method command's Long with the agent guidance at the TOP (Risk, then the affordance block, then the schema pointer), returning false for non-method commands. The overlay is parsed here — only when help is rendered. skillFS (nil-safe) gates the related-skill pointers: each is emitted only when it resolves in the skill tree (see affordance.SkillStatPath), so a typo or a build without embedded skills never prints a `skills read` that cannot be opened.

func PrepareShortcutHelp added in v1.0.67

func PrepareShortcutHelp(cmd *cobra.Command, skillFS fs.FS) bool

PrepareShortcutHelp composes a +-prefixed shortcut's Long from its affordance overlay — the same top layout as method help (description, Risk, guidance block, related skills) minus the schema pointer, which shortcuts have none of. Returns false when the command is not a shortcut or carries no overlay entry, so shortcuts without guidance keep the default help plus the bottom risk/tips append.

The lead is the command's pristine base (captureHelpBase): a shortcut that set a hand-authored Long in PostMount (e.g. the docs shortcuts' "agents MUST read the skill" directive) keeps it — the affordance block is appended below, never clobbering it.

Tips precedence (intentional, not a bug): the overlay's ### Tips win. The shortcut's declarative Tips (the Go Tips field) are only a fallback used when the overlay declares none; when the overlay has tips, the Go tips are dropped (replaced, not merged) so tips never render twice. Authoring a ### Tips block therefore silently retires that shortcut's Go Tips — consolidate into one.

func RegisterServiceCommands

func RegisterServiceCommands(parent *cobra.Command, f *cmdutil.Factory)

RegisterServiceCommands registers all service commands from from_meta specs.

func RegisterServiceCommandsFromCatalog added in v1.0.56

func RegisterServiceCommandsFromCatalog(ctx context.Context, parent *cobra.Command, f *cmdutil.Factory, catalog apicatalog.Catalog)

func RegisterServiceCommandsWithContext added in v1.0.16

func RegisterServiceCommandsWithContext(ctx context.Context, parent *cobra.Command, f *cmdutil.Factory)

func RenderAffordanceForCmd added in v1.0.60

func RenderAffordanceForCmd(cmd *cobra.Command) string

RenderAffordanceForCmd renders a method command's affordance block, or "" when it carries none.

Types

type ServiceMethodOptions

type ServiceMethodOptions struct {
	Factory     *cmdutil.Factory
	Cmd         *cobra.Command
	Ctx         context.Context
	ServicePath string
	Method      meta.Method
	SchemaPath  string

	// Flags
	Params     string
	Data       string
	As         core.Identity
	Output     string
	PageAll    bool
	PageLimit  int
	PageDelay  int
	Format     string
	JqExpr     string
	DryRun     bool
	File       string   // --file flag value
	FileFields []string // auto-detected file field names from metadata
	// contains filtered or unexported fields
}

ServiceMethodOptions holds all inputs for a dynamically registered service method command.

Jump to

Keyboard shortcuts

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