feat(spec): support tool aliases (#107)

closes #57

IRIS now automatically read and suggest internal configuration aliases
for Git (`.gitconfig`, `.git/config`) and Cargo (`.cargo/config.toml`)

- Added the `Provider` interface and extended registry for CLI tools
that define aliases
- Git: parse aliases via `git config --show-scope`, supporting raw
tab/space separation and scope differentiation
- Cargo: traverse the directory tree upwards to root to read the
`.cargo/config.toml` configuration
- 0ms hot-path caching: key caching is calculated entirely via `os.Stat`
mtime (no subprocess spawn) combined with a 2-second TTL window to
ensure 0ms latency when typing
- Lookup integration: display alias suggestions at the subcommand level
and automatically expand aliases as the user enters further arguments
(ignore shell pipeline commands starting with `!`)
This commit is contained in:
VERSE
2026-08-02 14:30:46 +07:00
committed by GitHub
parent 476ca3946b
commit 6faa2e3274
10 changed files with 732 additions and 2 deletions
+10
View File
@@ -0,0 +1,10 @@
package root
import "github.com/versenilvis/iris/spec/alias"
type mockGitProvider struct{}
func (m *mockGitProvider) ToolName() string { return "git" }
func (m *mockGitProvider) GetAliases(cwd string) []alias.AliasEntry {
return []alias.AliasEntry{{Name: "co", Expansion: "checkout", Scope: "local"}}
}