Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,25 @@ Each target is updated with its own native updater when it has one (e.g.
`opencode upgrade`, `aider --upgrade`) and re-run through its installer
otherwise — MoshCode never vendors it. In the TUI: `/upgrade [name…]`.

## Shell completion

MoshCode can print context-aware completion scripts for its commands, engines,
workflow tools, options, and file arguments. Load the one for your current
shell:

```sh
# Bash (~/.bashrc)
source <(moshcode completion bash)

# Zsh (~/.zshrc, after any existing compinit/Oh My Zsh setup)
source <(moshcode completion zsh)

# Fish (~/.config/fish/config.fish)
moshcode completion fish | source
```

Put the matching line in your shell profile to enable it in future sessions.

## PRD — plan before you mosh

Write a product requirements doc *first*, then let your coding agents build to it.
Expand Down
14 changes: 13 additions & 1 deletion bin/moshcode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { loginAuto, whoami, logout } from "../src/auth.mjs";
import { tui } from "../src/tui.mjs";
import { consoleCommand } from "../src/console.mjs";
import { dnsCommand } from "../src/dns.mjs";
import { completionScript } from "../src/completion.mjs";
import { CORE_CLI_COMMAND_NAMES } from "../src/cli-schema.mjs";
import { moshcodeVersion } from "../src/ui.mjs";

const HERE = path.dirname(fileURLToPath(import.meta.url));
Expand Down Expand Up @@ -123,7 +125,7 @@ function help() {
// Every workflow tool is exposed as a CLI verb, so derive them from TOOLS
// rather than repeating the roster here — a tool missing from this list gets
// misfiled as a moshscript-only local verb.
const cliVerbs = ["run","agents","start","install","upgrade","mcp","skill","prd","pwd", ...Object.keys(TOOLS)];
const cliVerbs = [...CORE_CLI_COMMAND_NAMES, ...Object.keys(TOOLS)];
const local = vocab.filter((c) => !cliVerbs.includes(c.name));
const cli = vocab.filter((c) => !local.includes(c));
console.log(`moshcode — metal scripting toolkit 🤘
Expand Down Expand Up @@ -167,6 +169,7 @@ usage:
moshcode engines [--json] list engines + install status
moshcode tools [--json] list workflow tools + install status
moshcode commands [--json] list built-in moshscript commands
moshcode completion <bash|zsh|fish> print a shell completion script
moshcode help this

engines (moshcode is a wrapper — it installs/drives these):
Expand Down Expand Up @@ -323,6 +326,15 @@ async function main() {
}
return;
}
if (cmd === "completion") {
try {
process.stdout.write(completionScript(rest[0]));
} catch (e) {
console.error(`usage: moshcode completion <bash|zsh|fish>\n${e.message || e}`);
process.exitCode = 1;
}
return;
}
if (cmd === "login") {
const device = rest.includes("--device") || rest.includes("-d") || !process.stdin.isTTY;
const browser = rest.includes("--browser") || rest.includes("-b");
Expand Down
61 changes: 61 additions & 0 deletions src/cli-schema.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
export const CORE_CLI_COMMANDS = [
{ name: "agents", description: "list engines or launch one autonomously" },
{ name: "start", description: "launch an engine with its native defaults" },
{ name: "install", description: "install an engine or workflow tool" },
{ name: "upgrade", description: "update moshcode, engines, or tools" },
{ name: "update", description: "alias for upgrade" },
{ name: "mcp", description: "register and inspect MCP servers" },
{ name: "skill", description: "install and inspect agent skills" },
{ name: "skills", description: "alias for skill" },
{ name: "prd", description: "create or list product requirement documents" },
{ name: "login", description: "authenticate with app.moshcode.sh" },
{ name: "whoami", description: "show the logged-in account" },
{ name: "logout", description: "clear the logged-in account" },
{ name: "console", description: "serve or connect to the browser terminal" },
{ name: "dns", description: "manage DNS records" },
{ name: "pwd", description: "show the current directory and git context" },
{ name: "where", description: "alias for pwd" },
{ name: "engines", description: "list engines and installation status" },
{ name: "tools", description: "list workflow tools and installation status" },
{ name: "commands", description: "list built-in moshscript commands" },
{ name: "completion", description: "print a shell completion script" },
{ name: "run", description: "run a moshscript" },
{ name: "help", description: "show command help" },
{ name: "version", description: "show the installed version" },
{ name: "--version", description: "show the installed version" },
{ name: "-v", description: "show the installed version" },
];

export const CORE_CLI_COMMAND_NAMES = CORE_CLI_COMMANDS.map(({ name }) => name);

export const MCP_VERBS = [
{
name: "install",
description: "register an MCP server across engines",
acceptsServerSpec: true,
},
{
name: "add",
description: "register a named MCP server",
acceptsServerSpec: true,
},
{ name: "catalog", description: "show known MCP servers" },
{ name: "list", description: "show MCP support and install status" },
];

export const SKILL_VERBS = [
{
name: "install",
description: "install a skill across supported engines",
acceptsSource: true,
},
{ name: "list", description: "show skills support and install status" },
];

export const UPGRADE_TARGETS = [
{ name: "all", description: "update moshcode and all installed integrations" },
{ name: "self", description: "update moshcode itself" },
{ name: "moshcode", description: "alias for self" },
{ name: "engines", description: "update all installed engines" },
{ name: "tools", description: "update all installed workflow tools" },
];
Loading
Loading