Internal

internal/adapters/cli/finalize

import "github.com/nilstate/scafld/v2/internal/adapters/cli/finalize"

Package finalize composes the scafld finalize CLI boundary.

Functions

func Handler(stdin io.Reader) func(context.Context, []string, io.Writer, io.Writer) int

Source: internal/adapters/cli/finalize/run.go:48

Handler returns a CLI-compatible handler for the host-facing finalize command.

func Run(ctx context.Context, args []string, stdin io.Reader, stdout io.Writer) error

Source: internal/adapters/cli/finalize/run.go:99

Run handles the public scafld finalize <task_id> command and the scafld finalize --json --stdin child process invoked by the finalize MCP transport. It composes deterministic snapshot, acceptance, and signing adapters around the accepted review evidence already sealed in the session ledger, then persists the signed receipt and archives the matching spec.

Types

type Request

Source: internal/adapters/cli/finalize/run.go:86

Request is the finalize stdin payload sent by the MCP transport.

HookEventName is never sent by the MCP transport. It is populated only when a host hook (a Claude Code Stop hook) pipes its own event payload into finalize --stdin, which is how a taskless hook invocation is told apart from an agent that called the finalize tool and simply forgot the task_id.

type Request struct {
	TaskID        string   `json:"task_id"`
	Root          string   `json:"root,omitempty"`
	BaseRef       string   `json:"base_ref,omitempty"`
	ScopeHint     []string `json:"scope_hint,omitempty"`
	HookEventName string   `json:"hook_event_name,omitempty"`
}
Fields
  • TaskID string `json:"task_id"`
  • Root string `json:"root,omitempty"`
  • BaseRef string `json:"base_ref,omitempty"`
  • ScopeHint []string `json:"scope_hint,omitempty"`
  • HookEventName string `json:"hook_event_name,omitempty"`