formcmd

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package formcmd provides the "form" parent command, which groups interactive, TUI-based subcommands for issue creation and modification. Form commands prompt the user interactively for field values and produce human-readable output only — they are not suitable for agent automation.

Index

Constants

This section is empty.

Variables

View Source
var ErrUserAborted = huh.ErrUserAborted

ErrUserAborted is returned when the user cancels the interactive form.

Functions

func DefaultFormRunner

func DefaultFormRunner(data *CreateFormData) error

DefaultFormRunner builds and runs the interactive huh form, binding each field to the corresponding CreateFormData pointer. It is exported so that the root-level "create" command can delegate to it in TTY mode.

func NewCmd

func NewCmd(f *cmdutil.Factory) *cli.Command

NewCmd constructs the "form" parent command, which groups interactive, TUI-based subcommands for human-driven issue creation and modification. The parent command has no action of its own — it exists only to namespace the form subcommands.

Form commands prompt the user for input interactively. They produce human-readable text only — there is no --json flag. Agents should use the json command tree instead.

func RunFormComment

func RunFormComment(ctx context.Context, input RunFormCommentInput) error

RunFormComment presents an interactive form for composing a comment, then adds it to the specified issue via the service layer. Output is human-readable text.

func RunFormCreate

func RunFormCreate(ctx context.Context, input RunFormCreateInput) error

RunFormCreate presents an interactive form, collects issue creation fields, and creates the issue via the service layer. Output is human-readable text.

func RunUpdate

func RunUpdate(ctx context.Context, input RunUpdateInput) error

RunUpdate fetches the current issue state, presents an interactive form pre-populated with existing values, detects which fields changed, and sends only the changed fields to the service. Output is human-readable text.

Types

type CommentFormData

type CommentFormData struct {
	Author string
	Body   string
}

CommentFormData holds the values collected by the interactive comment form. Exported so tests can populate it directly without running the TUI.

type CreateFormData

type CreateFormData struct {
	Role               string
	Title              string
	Description        string
	AcceptanceCriteria string
	Priority           string
	Parent             string
	Labels             string
	Author             string
}

CreateFormData holds the values collected by the interactive form. Fields are bound to form controls via pointer accessors. The struct is exported so that tests can populate it directly without running the TUI.

type RunFormCommentInput

type RunFormCommentInput struct {
	Service driving.Service
	IssueID string
	WriteTo io.Writer

	// FormRunner presents the interactive form and populates data. In
	// production this runs the huh TUI; in tests it is replaced with a
	// function that sets fields directly.
	FormRunner func(data *CommentFormData) error
}

RunFormCommentInput holds the parameters for the form comment operation, decoupled from CLI flag parsing so it can be tested directly.

type RunFormCreateInput

type RunFormCreateInput struct {
	Service driving.Service
	WriteTo io.Writer

	// FormRunner presents the interactive form and populates data. In
	// production this runs the huh TUI; in tests it is replaced with a
	// function that sets fields directly.
	FormRunner func(data *CreateFormData) error
}

RunFormCreateInput holds the parameters for the form create operation, decoupled from CLI flag parsing so it can be tested directly.

type RunUpdateInput

type RunUpdateInput struct {
	Service    driving.Service
	IssueID    string
	ClaimID    string
	WriteTo    io.Writer
	FormRunner func(vals *UpdateFormValues) error
}

RunUpdateInput holds the parameters for the form update operation, decoupled from CLI flag parsing so it can be tested directly. FormRunner allows tests to substitute the interactive TUI with a synchronous fake that modifies the values directly.

type UpdateFormValues

type UpdateFormValues struct {
	Title              string
	Description        string
	AcceptanceCriteria string
	Priority           string
	Parent             string
	Labels             string
	Comment            string
}

UpdateFormValues holds the editable field values for the update form. The FormRunner receives a pointer to this struct so that both the TUI form and test fakes can write to the same memory.

Jump to

Keyboard shortcuts

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