Documentation
¶
Index ¶
Constants ¶
const ( GroupCode = "Code" GroupGo = "Go Tools" GroupPython = "Python Tools" GroupSecurity = "Security" GroupSkills = "Skills" GroupMCP = "MCP & Serve" GroupSystem = "System" )
Group constants.
const ConfigDir = ".config/sin"
ConfigDir is the directory under $HOME holding TUI config. Kept consistent with `sin config` so users can locate it without a flag.
const ConfigFileName = "tui.toml"
ConfigFileName is the TOML file name within ConfigDir.
const MaxHistoryItems = 20
MaxHistoryItems caps the number of past search terms kept in memory. 20 ≈ a session's worth of distinct queries without bloating recall; chosen to match shell HISTSIZE conventions where 10–50 is typical.
Variables ¶
var Commands = []Command{ {Key: "code", Title: "🚀 sin code", Description: "Unified coding workflow hub", Group: GroupCode}, {Key: "code review", Title: "🔍 review", Description: "Semantic review of a change (IBD)", Group: GroupCode, Args: "<files>"}, {Key: "code debt", Title: "🏚️ debt", Description: "Show current architectural debt", Group: GroupCode, Args: "<path>"}, {Key: "code verify", Title: "✅ verify", Description: "Independent execution-based verification", Group: GroupCode, Args: "<target>"}, {Key: "code preflight", Title: "✈️ preflight", Description: "Fresh GitNexus index for coder agents", Group: GroupCode}, {Key: "code codocs", Title: "📚 codocs", Description: "Validate co-located .doc.md companions", Group: GroupCode, Args: "<path>"}, {Key: "code sckg", Title: "🕸️ sckg", Description: "Semantic codebase knowledge graph", Group: GroupCode, Args: "<path>"}, {Key: "code audit", Title: "🛡️ audit", Description: "47-gate CEO-audit (security/perf/quality)", Group: GroupCode, Args: "<path>"}, {Key: "code full", Title: "⚡ full pipeline", Description: "preflight → codocs → debt → sckg → ...", Group: GroupCode, Args: "<path>"}, {Key: "sin-code run discover", Title: "🗂️ discover", Description: "File discovery with relevance scoring", Group: GroupGo, Args: "<path>"}, {Key: "sin-code run map", Title: "🗺️ map", Description: "Architecture map + dependency graph", Group: GroupGo, Args: "<path>"}, {Key: "sin-code run grasp", Title: "🤖 grasp", Description: "Deep single-file analysis", Group: GroupGo, Args: "<file>"}, {Key: "sin-code run scout", Title: "🔭 scout", Description: "Regex/semantic/symbol code search", Group: GroupGo, Args: "<query>"}, {Key: "sin-code run harvest", Title: "🌾 harvest", Description: "URL fetch + cache + structure extract", Group: GroupGo, Args: "<url>"}, {Key: "sin-code run execute", Title: "⚙️ execute", Description: "Safe exec with secret redaction", Group: GroupGo, Args: "<cmd>"}, {Key: "sin-code run orchestrate", Title: "🪄 orchestrate", Description: "Task deps + parallel exec + rollback", Group: GroupGo}, {Key: "ibd", Title: "🧬 ibd", Description: "Intent-Based Diffing (semantic AST)", Group: GroupPython, Args: "<files>"}, {Key: "poc", Title: "📐 poc", Description: "Proof-of-Correctness verification", Group: GroupPython, Args: "<target>"}, {Key: "adw", Title: "🏛️ adw", Description: "Architectural Debt Watchdog", Group: GroupPython, Args: "<path>"}, {Key: "oracle", Title: "🔮 oracle", Description: "Independent Verification Oracle", Group: GroupPython, Args: "<target>"}, {Key: "efm", Title: "🧪 efm", Description: "Ephemeral Full-Stack Mocking", Group: GroupPython, Args: "<spec>"}, {Key: "sckg", Title: "🕸️ sckg", Description: "SCKG — knowledge graph (11 cmds)", Group: GroupPython, Args: "<cmd> [args]"}, {Key: "security secrets", Title: "🔐 secrets", Description: "Scan for hardcoded secrets (regex + entropy)", Group: GroupSecurity, Args: "[path]"}, {Key: "security sast", Title: "🛡️ sast", Description: "Static application security testing", Group: GroupSecurity, Args: "[path]"}, {Key: "security sca", Title: "📦 sca", Description: "Software composition analysis (deps + CVEs)", Group: GroupSecurity, Args: "[path]"}, {Key: "security sbom", Title: "📋 sbom", Description: "Generate SBOM (SPDX + CycloneDX)", Group: GroupSecurity, Args: "[path]"}, {Key: "security container", Title: "🐳 container", Description: "Scan container images", Group: GroupSecurity, Args: "<image>"}, {Key: "security iac", Title: "🏗️ iac", Description: "Scan IaC (Terraform, CloudFormation, K8s)", Group: GroupSecurity, Args: "[path]"}, {Key: "security license", Title: "📜 license", Description: "License compliance check", Group: GroupSecurity, Args: "[path]"}, {Key: "security dast", Title: "🎯 dast", Description: "Dynamic application security testing", Group: GroupSecurity, Args: "<target>"}, {Key: "security full", Title: "🛡️ full", Description: "Run all 8 security tools in sequence", Group: GroupSecurity, Args: "<path>"}, {Key: "brain", Title: "🧠 brain", Description: "Global/project behavioral rules", Group: GroupSkills}, {Key: "context-bridge", Title: "🌉 context-bridge", Description: "Unified SCKG+brain+gitnexus query", Group: GroupSkills, Args: "<query>"}, {Key: "websearch", Title: "🔎 websearch", Description: "SerpAPI multi-key pool", Group: GroupSkills, Args: "<query>"}, {Key: "scheduler", Title: "⏰ scheduler", Description: "Cron/interval job scheduling", Group: GroupSkills}, {Key: "goal-mode", Title: "🎯 goal-mode", Description: "Goal tracking with checkpoints", Group: GroupSkills}, {Key: "grill-me", Title: "🔥 grill-me", Description: "Adversarial design-review interview", Group: GroupSkills, Args: "<topic>"}, {Key: "doc-coauthoring", Title: "📝 doc-coauthoring", Description: "Collaborative README/ADR/SPEC", Group: GroupSkills}, {Key: "codocs", Title: "📘 codocs", Description: "CoDocs standard + sprint", Group: GroupSkills, Args: "<path>"}, {Key: "marketplace", Title: "🛍️ marketplace", Description: "Skill catalog search/install", Group: GroupSkills}, {Key: "browser", Title: "🌐 browser", Description: "106 browser-automation tools", Group: GroupSkills}, {Key: "serve", Title: "📡 serve", Description: "Expose tools as unified MCP server", Group: GroupMCP}, {Key: "serve-mcp", Title: "🛰️ serve-mcp", Description: "Start MCP server (stdio)", Group: GroupMCP}, {Key: "mcp-config", Title: "📋 mcp-config", Description: "Generate ready-to-use MCP config", Group: GroupMCP}, {Key: "simone", Title: "🔬 simone", Description: "Simone-MCP code analysis", Group: GroupMCP}, {Key: "status", Title: "📊 status", Description: "Which subsystems are installed", Group: GroupSystem}, {Key: "doctor", Title: "🩺 doctor", Description: "Diagnose environment + audit chain", Group: GroupSystem}, {Key: "bootstrap", Title: "🎬 bootstrap", Description: "Initialize subsystems for repo", Group: GroupSystem, Args: "<path>"}, {Key: "agents-md", Title: "🤝 agents-md", Description: "Create/update AGENTS.md", Group: GroupSystem}, {Key: "policy", Title: "📜 policy", Description: "Inspect/init SIN policy + audit log", Group: GroupSystem}, {Key: "skills", Title: "🎓 skills", Description: "Compile portable skills to agent fmt", Group: GroupSystem}, {Key: "update", Title: "⬆️ update", Description: "Self-update stack (pipx + Go)", Group: GroupSystem}, {Key: "config", Title: "⚙️ config", Description: "Unified config management", Group: GroupSystem}, }
Commands is the full menu catalog. Order within a group = display order.
Functions ¶
func ConfigPath ¶
ConfigPath returns the absolute path to the TUI config file. Exported so tests and `sin config` can locate it.
func CopyToClipboard ¶
CopyToClipboard writes text to the system clipboard via pbcopy. Returns any I/O or exec error verbatim so the caller can decide whether to log, toast, or silently ignore.
func SaveConfig ¶
SaveConfig writes the config file, creating the parent dir if needed. File mode is 0o644 — config is non-secret and the user may want to read it with `cat`.
Types ¶
type Command ¶
type Command struct {
// Key is the canonical subcommand name, e.g. "sckg", "code", "doctor".
Key string
// Title is shown in the menu, supports emojis and short labels.
Title string
// Description is a one-line explanation shown beside the menu item.
Description string
// Group classifies the command in the menu (Code, Skills, MCP, ...).
Group string
// Args is the raw argument template. If non-empty, the TUI prompts for
// a value before running. The placeholder is rendered as the prompt hint.
Args string
// Danger marks destructive commands (e.g. "policy reset") for red styling.
Danger bool
}
Command describes one callable sin subcommand exposed in the TUI menu.
type Config ¶
type Config struct {
// Theme is "dark" (default) or "light". Other values are rejected
// on load to keep us forward-compatible with future palettes.
Theme string
}
Config holds persisted TUI preferences. Add fields here as they become persistent (window split %, last opened command, etc.).
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the baseline preferences used when no config file is present or it cannot be read.
func LoadConfig ¶
func LoadConfig() Config
LoadConfig reads the config file. Missing file, parse error, or invalid values all degrade silently to DefaultConfig — a corrupt config must never wedge the TUI on launch.
type History ¶
type History struct {
// contains filtered or unexported fields
}
History is an in-memory ring buffer with a single cursor for up/down recall. It is intentionally not persisted — search history can contain PII (paths, secrets typed by accident) and the TUI is a developer tool, not a system shell.
Cursor semantics:
- cursor == -1 → no recall active; Next returns "".
- cursor in [0, len) → currently recalling items[cursor].
func NewHistory ¶
func NewHistory() *History
NewHistory returns an empty history with no active cursor.
func (*History) Items ¶
Items returns a snapshot of stored items, oldest → newest. The slice is a copy so callers cannot mutate the buffer.
func (*History) Next ¶
Next recalls the following (newer) term. Returns "" when stepping past the newest entry, which the UI should treat as "back to a blank input".
func (*History) Prev ¶
Prev recalls the previous (older) term. Returns "" if history is empty. On the first call after Push/Reset, returns the newest entry.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the Bubbletea top-level model.
func NewModel ¶
func NewModel() *Model
NewModel builds a fresh TUI model. Theme preference is loaded from ~/.config/sin/tui.toml so the user's choice survives across sessions.