AiT

module
v1.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0

README

AiT logo

Languages: English (this page) · 简体中文

AiT

AiT — A cross-platform (Linux / macOS / Windows) AI-enhanced command-line toolbox that includes, but is not limited to, terminal and SSH workflows—built to be a practical everyday tool for operations engineers.

Features

While remaining compatible with OpenSSH configuration and connection flags, AiT adds session management, recovery, and in-terminal collaboration beyond a typical interactive ssh session. Interactive login and session load show the remote AiT prompt immediately; in-session !ait get/put accept optional destination defaults and report chain ZMODEM/SFTP progress through done: (details in the user manual).

Session management
Capability AiT Typical SSH client
Session persistence SQLite stores connection parameters, aliases, and authentication TTL (session.auth_ttl) No session store; rely on shell history or external notes
Fast resume ait session --load / --switch; credential-free reconnect within auth TTL (TTL refreshes when you re-enter the password) Must specify user@host and flags on each connect
Suspend and context !ait suspend saves scrollback and remote working directory Terminal context is lost after disconnect
Remote keep-alive
Capability AiT Typical SSH client
Process keep-alive --tmux auto attach/detach ait-<session_id> Manual tmux or screen session management
In-session collaboration
Capability AiT Typical SSH client
AI mode Local ait ai (AiT AI(Agent)>) and in-SSH !ait ai / !! (remote run after confirm); Deepseek + MiniMax + optional tiered Ollama No built-in assistant; separate tools required
Local mode !ait local / !ait remote switch input target while SSH stays connected Local and remote work in separate terminals
File transfer ait get / ait put (SFTP, single file); !ait get / !ait put reuse the live SSH session Must assemble scp/rsync SSH options manually
Local entry point
Capability AiT Typical SSH client
Unified CLI ait shell REPL for login / session --list / session --load; input history and Ctrl+R (see user manual) No equivalent integrated REPL

Installation

Prerequisites: Go 1.25+; OpenSSH client (ssh) on PATH for login/load to resolve ~/.ssh/config.

Build from source (local build and verification):

git clone https://github.com/os-artificer/AiT.git
cd AiT
make build
./bin/ait --help

go install (requires Go 1.25+; ZMODEM support is vendored under pkg/third-party/ — no external github.com/xiwh/zmodem fetch):

go install github.com/os-artificer/AiT/cmd/ait@latest
ait --help

Ensure $(go env GOPATH)/bin is on your PATH.

Configuration and usage: User manual.

Documentation

Document Path
User manual docs/user-manual.md
Changelog CHANGELOG.md
Contributing CONTRIBUTING.md
Code of conduct CODE_OF_CONDUCT.md
Architecture docs/design.md
Code layout AGENTS.md

Directories

Path Synopsis
cmd
ait command
internal
ait
Package ait implements the AiT CLI application entry.
Package ait implements the AiT CLI application entry.
ait/ai
Package ai builds the `ait ai` Cobra subtree (chat, provider, model) and the local/remote AI REPL runners injected into shell and SSH packages.
Package ai builds the `ait ai` Cobra subtree (chat, provider, model) and the local/remote AI REPL runners injected into shell and SSH packages.
ait/ai/deps
Package deps holds shared dependencies for the ait ai command subtree.
Package deps holds shared dependencies for the ait ai command subtree.
ait/ai/mode/agent
Package agent represents the AI agent loop's parsed actions and the local capture runner used to feed shell output back into the model.
Package agent represents the AI agent loop's parsed actions and the local capture runner used to feed shell output back into the model.
ait/ai/mode/approve
Package approve provides command confirmation, pattern/session trust, and risk-aware policy for the AI mode REPL.
Package approve provides command confirmation, pattern/session trust, and risk-aware policy for the AI mode REPL.
ait/ai/mode/chat
Package chat exposes the one-shot AI ask path that powers `ait ai ask <message>` and the `ask …` meta-REPL command.
Package chat exposes the one-shot AI ask path that powers `ait ai ask <message>` and the `ask …` meta-REPL command.
ait/ai/mode/risk
Package risk classifies AI-mode commands by execution risk so callers can gate confirmation, denylist TUI programs, and apply pattern/session trust.
Package risk classifies AI-mode commands by execution risk so callers can gate confirmation, denylist TUI programs, and apply pattern/session trust.
ait/ai/ollama
Package ollama builds the `ait ai ollama` Cobra subtree (status/setup/start/stop/disable).
Package ollama builds the `ait ai ollama` Cobra subtree (status/setup/start/stop/disable).
ait/ai/ollama/subregistry
Package subregistry collects ait ai ollama subcommands registered from init hooks.
Package subregistry collects ait ai ollama subcommands registered from init hooks.
ait/ai/provider
Package provider builds the `ait ai provider` Cobra subtree.
Package provider builds the `ait ai provider` Cobra subtree.
ait/ai/provider/subregistry
Package subregistry collects ait ai provider subcommands registered from init hooks.
Package subregistry collects ait ai provider subcommands registered from init hooks.
ait/ai/runner
Package runner holds shared one-shot AI command helpers (no subcommand imports).
Package runner holds shared one-shot AI command helpers (no subcommand imports).
ait/ai/subregistry
Package subregistry collects ait ai subcommands registered from init hooks.
Package subregistry collects ait ai subcommands registered from init hooks.
ait/config
Package config implements the `ait config` Cobra subtree (set/get/init/view/edit/validate).
Package config implements the `ait config` Cobra subtree (set/get/init/view/edit/validate).
ait/config/shared
Package shared holds helpers shared by ait config subcommands.
Package shared holds helpers shared by ait config subcommands.
ait/config/subregistry
Package subregistry collects ait config subcommands registered from init hooks.
Package subregistry collects ait config subcommands registered from init hooks.
ait/registry
Package registry collects top-level ait subcommands registered from init hooks.
Package registry collects top-level ait subcommands registered from init hooks.
ait/registry/all
Package all blank-imports every top-level command registrar (breaks import cycles with cli).
Package all blank-imports every top-level command registrar (breaks import cycles with cli).
ait/registry/gen command
Command gen regenerates internal/ait/registry/all/imports.go from top-level register.go packages.
Command gen regenerates internal/ait/registry/all/imports.go from top-level register.go packages.
ait/session
Package session implements the `ait session` Cobra command (list/load/suspend/switch/delete).
Package session implements the `ait session` Cobra command (list/load/suspend/switch/delete).
pkg/ai
Package ai is the public facade for AiT AI features.
Package ai is the public facade for AiT AI features.
pkg/ai/agent
Package agent declares the function-calling tool definitions and the adapter from OpenAI tool_calls to the AiT internal Agent-mode JSON action envelope (run_shell / ait_cli / answer).
Package agent declares the function-calling tool definitions and the adapter from OpenAI tool_calls to the AiT internal Agent-mode JSON action envelope (run_shell / ait_cli / answer).
pkg/ai/models
Package models declares the data row for `ait ai model list` and the receiver-free formatting helpers used to render it.
Package models declares the data row for `ait ai model list` and the receiver-free formatting helpers used to render it.
pkg/ai/provider
Package provider declares the public AI provider identifiers and user-visible errors (sentinel + Try-block hints) shared by the multi-provider router, agent loop, and CLI surface.
Package provider declares the public AI provider identifiers and user-visible errors (sentinel + Try-block hints) shared by the multi-provider router, agent loop, and CLI surface.
pkg/ai/router
Package router contains the receiver-free building blocks of the AiT AI multi-provider router: the failover Chain of Responsibility helpers (ResolveTryOrder, AggregateErrors, LogFailover, APIKeyHint, IsRetryable) and the tiered routing classifier (ClassifyPrompt) shared by the cloud and local-first paths.
Package router contains the receiver-free building blocks of the AiT AI multi-provider router: the failover Chain of Responsibility helpers (ResolveTryOrder, AggregateErrors, LogFailover, APIKeyHint, IsRetryable) and the tiered routing classifier (ClassifyPrompt) shared by the cloud and local-first paths.
pkg/clihints
Package clihints holds shared errhint Try-block example command lines.
Package clihints holds shared errhint Try-block example command lines.
pkg/helpdoc
Package helpdoc provides shared login-style CLI help layout and Cobra bind helpers.
Package helpdoc provides shared login-style CLI help layout and Cobra bind helpers.
pkg/pathsafe
Package pathsafe validates strings that will be embedded in remote shell commands.
Package pathsafe validates strings that will be embedded in remote shell commands.
pkg/ssh/client/dial
Package dial holds receiver-free helpers shared by the SSH dialer in the parent ssh/client package: jump-host parsing, ProxyCommand stdio wiring, and SSH private-key loading.
Package dial holds receiver-free helpers shared by the SSH dialer in the parent ssh/client package: jump-host parsing, ProxyCommand stdio wiring, and SSH private-key loading.
pkg/ssh/client/hostkeys
Package hostkeys manages SSH known_hosts verification callbacks and file I/O.
Package hostkeys manages SSH known_hosts verification callbacks and file I/O.
pkg/ssh/client/localmode
Package localmode runs the !ait local PTY shell that an SSH user can spawn without dropping their remote connection.
Package localmode runs the !ait local PTY shell that an SSH user can spawn without dropping their remote connection.
pkg/ssh/client/meta
Package meta is the byte-level state machine that detects in-session AiT meta commands (!ait <subcmd>, !!) on a remote PTY stream.
Package meta is the byte-level state machine that detects in-session AiT meta commands (!ait <subcmd>, !!) on a remote PTY stream.
pkg/ssh/client/prompt
Package prompt provides AiT's display prompt strings and the shell setup fragments needed to install them on a remote PTY.
Package prompt provides AiT's display prompt strings and the shell setup fragments needed to install them on a remote PTY.
pkg/ssh/client/pty
Package pty hosts the PTY-side helpers used by an interactive SSH session: the single-goroutine stdin Reader that routes bytes between SSH forwarding and the local AI REPL, a one-byte-per-channel ReplReader, and the cross- platform terminal resize watcher.
Package pty hosts the PTY-side helpers used by an interactive SSH session: the single-goroutine stdin Reader that routes bytes between SSH forwarding and the local AI REPL, a one-byte-per-channel ReplReader, and the cross- platform terminal resize watcher.
pkg/ssh/client/scrollback
Package scrollback contains receiver-free helpers that compute new output captured from the remote PTY scrollback buffer.
Package scrollback contains receiver-free helpers that compute new output captured from the remote PTY scrollback buffer.
pkg/ssh/client/transfer
Package transfer holds receiver-free helpers for the in-session !ait get / !ait put meta commands: meta-line argv parsing and the user-visible usage hint.
Package transfer holds receiver-free helpers for the in-session !ait get / !ait put meta commands: meta-line argv parsing and the user-visible usage hint.
pkg/ssh/stricthostkey
Package stricthostkey normalizes OpenSSH StrictHostKeyChecking option values.
Package stricthostkey normalizes OpenSSH StrictHostKeyChecking option values.
pkg/subregistry
Package subregistry provides a generic Cobra subcommand registry for nested CLI parents.
Package subregistry provides a generic Cobra subcommand registry for nested CLI parents.
pkg/terminal/crlf
Package crlf provides an io.Writer adapter that translates LF to CRLF so shell/meta output renders correctly on raw TTYs and remote PTYs.
Package crlf provides an io.Writer adapter that translates LF to CRLF so shell/meta output renders correctly on raw TTYs and remote PTYs.
pkg/terminal/history
Package history implements the bash-style REPL input history model used by `ait shell` and `ait ai`: bounded in-memory ring, optional file backing (load/append/write/reload), reverse search, and the `history` command.
Package history implements the bash-style REPL input history model used by `ait shell` and `ait ai`: bounded in-memory ring, optional file backing (load/append/write/reload), reverse search, and the `history` command.
pkg/terminal/lineedit
Package lineedit implements the Emacs-style raw-TTY line editor used by `ait shell` and `ait ai`: ReadLine reads one edited line with history recall, Ctrl+R reverse search, kill keys, UTF-8 input, and Ctrl+L screen clear.
Package lineedit implements the Emacs-style raw-TTY line editor used by `ait shell` and `ait ai`: ReadLine reads one edited line with history recall, Ctrl+R reverse search, kill keys, UTF-8 input, and Ctrl+L screen clear.
pkg/terminal/screen
Package screen provides ANSI VT100 screen primitives such as clear-screen sequences shared by the local shell REPL and AI mode.
Package screen provides ANSI VT100 screen primitives such as clear-screen sequences shared by the local shell REPL and AI mode.
pkg/terminal/scrollback
Package scrollback implements a bounded ring buffer that captures terminal output for replay (`ait session --load`) and AI assist context.
Package scrollback implements a bounded ring buffer that captures terminal output for replay (`ait session --load`) and AI assist context.
pkg/transfer/route
Package route selects get/put backends (ZMODEM vs SFTP) for in-session transfer.
Package route selects get/put backends (ZMODEM vs SFTP) for in-session transfer.
pkg/transfer/zmodem
Package zmodem wraps the vendored xiwh ZMODEM stack for lrzsz-compatible PTY file transfer.
Package zmodem wraps the vendored xiwh ZMODEM stack for lrzsz-compatible PTY file transfer.
pkg

Jump to

Keyboard shortcuts

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