cli

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package cli holds embeddable Kong commands for the bones binary.

Each command type is a Kong-tagged struct with a Run method. The command tree is assembled in cmd/bones/cli.go alongside libfossil/cli and EdgeSync/cli.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InitCmd

type InitCmd struct{}

InitCmd creates a new bones workspace in the current directory.

func (*InitCmd) Run

func (c *InitCmd) Run(g *libfossilcli.Globals) error

type JoinCmd

type JoinCmd struct{}

JoinCmd locates and verifies an existing workspace from cwd.

func (*JoinCmd) Run

func (c *JoinCmd) Run(g *libfossilcli.Globals) error

type OrchestratorCmd

type OrchestratorCmd struct{}

OrchestratorCmd installs the hub-leaf orchestrator scripts, skills, and Claude Code hooks into an existing workspace.

func (*OrchestratorCmd) Run

type TasksAggregateCmd

type TasksAggregateCmd struct {
	Since time.Duration `name:"since" default:"1h" help:"window size"`
	JSON  bool          `name:"json" help:"emit JSON"`
}

TasksAggregateCmd produces a per-slot summary of tasks within a window.

func (*TasksAggregateCmd) Run

type TasksAutoclaimCmd

type TasksAutoclaimCmd struct {
	Enabled  *bool         `name:"enabled" help:"enable tick (default: env AGENT_INFRA_AUTOCLAIM)"`
	Idle     bool          `name:"idle" default:"true" help:"treat session as idle for this tick"`
	ClaimTTL time.Duration `name:"claim-ttl" default:"1m" help:"claim TTL for auto-claimed task"`
}

TasksAutoclaimCmd runs a single autoclaim tick.

func (*TasksAutoclaimCmd) Run

type TasksClaimCmd

type TasksClaimCmd struct {
	ID   string `arg:"" help:"task id"`
	JSON bool   `name:"json" help:"emit JSON"`
}

TasksClaimCmd claims a task as the current agent.

func (*TasksClaimCmd) Run

type TasksCloseCmd

type TasksCloseCmd struct {
	ID     string `arg:"" help:"task id"`
	Reason string `name:"reason" help:"close reason (optional)"`
	JSON   bool   `name:"json" help:"emit JSON"`
}

TasksCloseCmd closes a task.

func (*TasksCloseCmd) Run

type TasksCmd

type TasksCmd struct {
	Add       TasksCreateCmd    `cmd:"" help:"Alias for create"`
	Create    TasksCreateCmd    `cmd:"" help:"Create a new task"`
	List      TasksListCmd      `cmd:"" help:"List tasks"`
	Show      TasksShowCmd      `cmd:"" help:"Show a task"`
	Update    TasksUpdateCmd    `cmd:"" help:"Update a task"`
	Claim     TasksClaimCmd     `cmd:"" help:"Claim a task"`
	Close     TasksCloseCmd     `cmd:"" help:"Close a task"`
	Ready     TasksReadyCmd     `cmd:"" help:"List tasks ready for claim"`
	Watch     TasksWatchCmd     `cmd:"" help:"Stream task lifecycle events"`
	Status    TasksStatusCmd    `cmd:"" help:"Snapshot of all tasks by status"`
	Link      TasksLinkCmd      `cmd:"" help:"Link two tasks with an edge type"`
	Prime     TasksPrimeCmd     `cmd:"" help:"Print agent-tasks context (prime)"`
	Stale     TasksStaleCmd     `cmd:"" help:"List stale tasks"`
	Orphans   TasksOrphansCmd   `cmd:"" help:"List orphaned (claimed by absent agent) tasks"`
	Preflight TasksPreflightCmd `cmd:"" help:"Combined stale + orphans report"`
	Compact   TasksCompactCmd   `cmd:"" help:"Compact closed tasks"`
	Autoclaim TasksAutoclaimCmd `cmd:"" help:"Run one autoclaim tick"`
	Dispatch  TasksDispatchCmd  `cmd:"" help:"Dispatch parent/worker"`
	Aggregate TasksAggregateCmd `cmd:"" help:"Aggregate per-slot task summary"`
}

TasksCmd groups all `bones tasks <verb>` subcommands.

type TasksCompactCmd

type TasksCompactCmd struct {
	MinAge time.Duration `name:"min-age" default:"24h" help:"minimum closed age"`
	Limit  int           `name:"limit" default:"20" help:"maximum tasks per pass"`
	Prune  bool          `name:"prune" help:"archive and purge compacted tasks"`
	Every  time.Duration `name:"every" help:"repeat compaction on this interval"`
	JSON   bool          `name:"json" help:"emit JSON"`
}

TasksCompactCmd compacts (archives + optionally purges) closed tasks.

The underlying compaction primitive moved from *coord.Coord to *coord.Leaf in Task 10 of the EdgeSync refactor; this CLI does not own a Leaf, so the run-once path returns errCompactCLIUnavailable. Flag parsing and the runCompactCadence loop are preserved so the existing test surface continues to compile and pass.

func (*TasksCompactCmd) Run

type TasksCreateCmd

type TasksCreateCmd struct {
	Title      string   `arg:"" help:"task title"`
	Files      string   `name:"files" help:"comma-separated file list"`
	Parent     string   `name:"parent" help:"parent task id"`
	DeferUntil string   `name:"defer-until" help:"RFC3339 time"`
	Context    []string `name:"context" help:"key=value (repeatable)" sep:"none"`
	JSON       bool     `name:"json" help:"emit JSON"`
}

TasksCreateCmd creates a new task.

func (*TasksCreateCmd) Run

type TasksDispatchCmd

type TasksDispatchCmd struct {
	Parent TasksDispatchParentCmd `cmd:"" help:"Run dispatch parent"`
	Worker TasksDispatchWorkerCmd `cmd:"" help:"Run dispatch worker"`
}

TasksDispatchCmd groups dispatch parent/worker subcommands.

type TasksDispatchParentCmd

type TasksDispatchParentCmd struct {
	TaskID             string `name:"task-id" required:"" help:"task id"`
	WorkerBin          string `name:"worker-bin" help:"worker binary path (default: this process)"`
	WorkerResult       string `name:"worker-result" default:"success" help:"worker final result"`
	WorkerSummary      string `name:"worker-summary" default:"done" help:"worker final summary"`
	WorkerClaimHandoff bool   `name:"worker-claim-handoff" help:"worker takes claim ownership"`
}

TasksDispatchParentCmd runs the parent side of the dispatch flow: spawn a worker process, subscribe for its result, then close/fork the claimed task accordingly.

func (*TasksDispatchParentCmd) Run

type TasksDispatchWorkerCmd

type TasksDispatchWorkerCmd struct {
	TaskID           string        `name:"task-id" required:"" help:"task id"`
	TaskThread       string        `name:"task-thread" required:"" help:"task chat thread"`
	WorkerAgentID    string        `name:"worker-agent-id" required:"" help:"worker agent id"`
	ClaimFromAgentID string        `name:"claim-from-agent-id" help:"expected previous claimer"`
	HandoffTTL       time.Duration `name:"handoff-ttl" help:"handoff hold ttl"`
	Result           string        `name:"result" default:"success" help:"success|fork|fail"`
	Summary          string        `name:"summary" default:"done" help:"final summary"`
	Branch           string        `name:"branch" help:"fork branch"`
	Rev              string        `name:"rev" help:"fork rev"`
}

TasksDispatchWorkerCmd runs the worker side of the dispatch flow: optionally take over a claim, post progress to the task thread, then close (on success-with-handoff) or just announce the result.

func (*TasksDispatchWorkerCmd) Run

type TasksLinkCmd

type TasksLinkCmd struct {
	From string `arg:"" help:"from task id"`
	To   string `arg:"" help:"to task id"`
	Type string `name:"type" help:"edge type: blocks|supersedes|duplicates|discovered-from"`
	JSON bool   `name:"json" help:"emit JSON"`
}

TasksLinkCmd links two tasks with a typed edge.

func (*TasksLinkCmd) Run

type TasksListCmd

type TasksListCmd struct {
	All       bool   `name:"all" help:"include closed tasks"`
	Status    string `name:"status" help:"open|claimed|closed"`
	ClaimedBy string `name:"claimed-by" help:"agent id, or - for unclaimed"`
	JSON      bool   `name:"json" help:"emit JSON"`
}

TasksListCmd lists tasks.

func (*TasksListCmd) Run

type TasksOrphansCmd

type TasksOrphansCmd struct {
	JSON bool `name:"json" help:"emit JSON"`
}

TasksOrphansCmd lists claimed tasks whose claimer is not currently online.

func (*TasksOrphansCmd) Run

type TasksPreflightCmd

type TasksPreflightCmd struct {
	Days int  `name:"days" default:"7" help:"minimum stale age in days"`
	JSON bool `name:"json" help:"emit JSON"`
}

TasksPreflightCmd runs both stale and orphans, returning a combined report.

func (*TasksPreflightCmd) Run

type TasksPrimeCmd

type TasksPrimeCmd struct {
	JSON bool `name:"json" help:"emit JSON"`
}

TasksPrimeCmd prints an agent context summary (open/ready/claimed tasks, recent threads, peers online).

func (*TasksPrimeCmd) Run

type TasksReadyCmd

type TasksReadyCmd struct {
	JSON bool `name:"json" help:"emit JSON"`
}

TasksReadyCmd lists tasks that are ready to claim.

func (*TasksReadyCmd) Run

type TasksShowCmd

type TasksShowCmd struct {
	ID   string `arg:"" help:"task id"`
	JSON bool   `name:"json" help:"emit JSON"`
}

TasksShowCmd prints a single task.

func (*TasksShowCmd) Run

type TasksStaleCmd

type TasksStaleCmd struct {
	Days int  `name:"days" default:"7" help:"minimum age in days"`
	JSON bool `name:"json" help:"emit JSON"`
}

TasksStaleCmd lists open/claimed tasks not updated within --days.

func (*TasksStaleCmd) Run

type TasksStatusCmd

type TasksStatusCmd struct{}

TasksStatusCmd prints a one-shot snapshot of hub and backlog state.

Output:

hub:      http://127.0.0.1:8765 (pid 12345)
nats:     nats://127.0.0.1:4222
backlog:  3 open · 1 claimed · 2 closed (last 24h)

func (*TasksStatusCmd) Run

type TasksUpdateCmd

type TasksUpdateCmd struct {
	ID         string   `arg:"" help:"task id"`
	Status     string   `name:"status" help:"open|claimed|closed"`
	Title      *string  `name:"title" help:"new title"`
	Files      *string  `name:"files" help:"comma-separated file list (replaces existing)"`
	Parent     *string  `name:"parent" help:"parent task id"`
	DeferUntil *string  `name:"defer-until" help:"RFC3339 time (empty clears)"`
	Context    []string `name:"context" help:"key=value (repeatable; merges)" sep:"none"`
	ClaimedBy  *string  `name:"claimed-by" help:"agent id to claim as"`
	JSON       bool     `name:"json" help:"emit JSON"`
}

TasksUpdateCmd updates a task. Flags are pointer-typed so we can detect "flag absent" vs "flag set to empty string" — a distinction the underlying mutator depends on (only set fields get applied).

func (*TasksUpdateCmd) Run

type TasksWatchCmd

type TasksWatchCmd struct{}

TasksWatchCmd subscribes to the tasks KV bucket and streams human-readable lifecycle events to stdout until Ctrl-C or context cancellation.

func (*TasksWatchCmd) Run

type UpCmd

type UpCmd struct{}

UpCmd performs full bootstrap from a fresh clone: workspace init, orchestrator scaffold, leaf binary resolution, and hub bootstrap.

func (*UpCmd) Run

func (c *UpCmd) Run(g *libfossilcli.Globals) error

type ValidatePlanCmd

type ValidatePlanCmd struct {
	Path      string `arg:"" type:"existingfile" help:"Markdown plan path"`
	ListSlots bool   `name:"list-slots" help:"emit JSON slot→task list (still runs validation)"`
}

ValidatePlanCmd parses a Markdown plan, extracts [slot: name] annotations, and verifies:

  1. Every Task heading has a [slot: name].
  2. Slots are directory-disjoint (no two slots share a directory prefix).
  3. Each task's Files: paths begin with the slot's owned directory.

Exits 0 if valid, 1 if violations are reported. With --list-slots, also emits a JSON slot→task mapping to stdout on success.

func (*ValidatePlanCmd) Run

Jump to

Keyboard shortcuts

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