包含电池的与POSIX相容的基因外壳
gsh
A battery-included, POSIX-compatible, Generative Shell.
gsh will automatically complete the next command you're likely to run based on your context and history.
Chat with AI agents directly in your shell using the # prefix:
gsh> # look at my unstaged changes and write test cases for themAgents can:
See the complete guide: Agents in the REPL
Compose intelligent agents and deterministic workflows using the gsh scripting language.
#!/usr/bin/env gsh
# Generate a commit message from staged changes
agent CommitWriter {
model: gsh.models.workhorse,
systemPrompt: "Write concise, conventional commit messages. Output only the message.",
}
diff = exec("git diff --cached")
if (diff.stdout == "") {
print("No staged changes")
} else {
result = diff.stdout | CommitWriter
print(result.lastMessage.content)
}gsh can delegate to powerful external agents via the Agent Client Protocol (ACP).
# ~/.gsh/repl.gsh
acp ClaudeCode {
command: "npx",
args: ["-y", "@zed-industries/claude-code-acp"],
}
__claudeCodeSession = null
tool mentionClaude(ctx, next) {
if (ctx.input.includes("@claude")) {
if (__claudeCodeSession == null) {
__claudeCodeSession = ctx.input | ClaudeCode
} else {
__claudeCodeSession = __claudeCodeSession | ctx.input
}
return { handled: true }
}
return next(ctx)
}
gsh.use("command.input", mentionClaude)You will then be able to invoke Claude Code directly in gsh using the @claude keyword:
gsh> @claude Please analyze the current directory and suggest improvements.gsh can run with either
See the Getting Started Guide.
gsh collects anonymous usage statistics to help improve the product.
You can opt out of telemetry at any time:
# Check current status
gsh telemetry status
# Disable telemetry
gsh telemetry off
# Re-enable telemetry
gsh telemetry on
# Or use environment variable
export GSH_NO_TELEMETRY=1This project is in early development stage. Use at your own risk! Please expect bugs, incomplete features, and breaking changes. The v1.0 version number reflects our first major breaking change, not stability—we follow Semantic Versioning.
That said, if you try it out and provide feedback, that would help make gsh more useful!
If you're upgrading from v0.x, note that configuration has changed since v1.0:
~/.gsh/repl.gsh for gsh-specific features (models, agents, prompts, middleware)~/.gshrc still works as a POSIX-compatible config file, but it no longer includes gsh-specific featuresSee ROADMAP.md for what's planned. Feel free to suggest new features by opening an issue!
gsh is built on top of many great open source projects. Most notably:
暂无开放 Issues,或尚未同步最近议题。