cli

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Package cli provides the event-driven integration layer that connects the Git adapter, Workspace Engine, Knowledge Engine, and Event Bus.

This is the "glue" that makes the system feel cohesive: commits automatically update workspace activity, branches get tracked, and knowledge artifacts get linked to the right commits. Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Package cli implements the got command-line interface. It is the only package that should depend on Cobra; the rest of the codebase stays Cobra-agnostic so domain logic can be unit-tested without spinning up a command tree.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Copyright 2026 The GOT Authors. MIT License.

Index

Constants

View Source
const (
	// PluginDirName is the subdirectory inside .got/ where plugins are stored.
	PluginDirName = "plugins"

	// DefaultManifestFile is the default manifest filename to look for.
	DefaultManifestFile = "manifest.json"
)

Variables

This section is empty.

Functions

func AutoLinkOnCommit

func AutoLinkOnCommit(ctx context.Context, ks *store.KnowledgeStore, adapter *git.ExecAdapter, commitSHA string) error

AutoLinkOnCommit finds decisions and notes created since the last commit and links them to the new commit.

func Execute

func Execute() error

Execute runs the root command. It is the single entry point used by cmd/got/main.go. Errors are written to stderr and returned for tests to assert against; main() translates the error into a non-zero exit code.

func NewRootCmd

func NewRootCmd() *cobra.Command

NewRootCmd builds the root `got` command with all persistent flags and the v0.1 subcommand stubs. It is exposed for tests that want to drive the command tree without going through main().

func ParseManifestFile

func ParseManifestFile(pluginDir string) (*store.PluginManifest, error)

ParseManifestFile reads and parses a manifest.json from the given directory.

Types

type IntegrationService

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

IntegrationService ties the event bus to the store layer. It subscribes to relevant events and performs automatic updates (e.g., updating workspace last_activity when a commit is made on a tracked branch).

func NewIntegrationService

func NewIntegrationService(bus *events.Bus, ks *store.KnowledgeStore, repoPath string) *IntegrationService

NewIntegrationService creates an integration service and subscribes to all relevant events. Call Close() to unsubscribe.

func (*IntegrationService) Close

func (s *IntegrationService) Close()

Close unsubscribes all handlers.

type PluginCommand

type PluginCommand struct {
	PluginName  string
	CommandName string
	Description string
	ExecPath    string // absolute path to the executable
}

PluginCommand describes a command registered by a plugin.

type PluginRuntime

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

PluginRuntime manages plugin lifecycle: loading, hook subscriptions, and command registration. It operates on the .got/plugins/<name>/ directory structure and the plugins table in the SQLite store.

func NewPluginRuntime

func NewPluginRuntime(ks *store.KnowledgeStore, bus *events.Bus, pluginsDir string) *PluginRuntime

NewPluginRuntime creates a PluginRuntime for the given store, bus, and plugins directory. It does not load plugins — call Load() to do that.

func (*PluginRuntime) Close

func (pr *PluginRuntime) Close()

Close unsubscribes all plugin event hooks and clears internal state.

func (*PluginRuntime) Commands

func (pr *PluginRuntime) Commands() []PluginCommand

Commands returns the list of plugin-registered commands.

func (*PluginRuntime) ExecuteCommand

func (pr *PluginRuntime) ExecuteCommand(ctx context.Context, pluginName, commandName string, args []string, timeout time.Duration) (string, string, error)

ExecuteCommand runs a plugin command with the given arguments.

func (*PluginRuntime) Load

func (pr *PluginRuntime) Load(ctx context.Context) error

Load reads all installed and enabled plugins from the store, validates their manifests, and subscribes their event hooks to the bus. It returns any validation errors but always loads all valid plugins (best-effort).

func (*PluginRuntime) Plugins

func (pr *PluginRuntime) Plugins() []store.Plugin

Plugins returns the currently loaded plugins.

func (*PluginRuntime) RunAction

func (pr *PluginRuntime) RunAction(ctx context.Context, pluginName, action string, timeout time.Duration) (string, string, error)

RunAction manually triggers a plugin's action (from hooks or a named action). It looks for an executable at hooks/<actionName> (or the literal path from the hook's entry). Returns stdout, stderr, error.

Jump to

Keyboard shortcuts

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