MoonshotAI / MoonshotAI/kimi-code
Feature request: git-like user-defined slash-command aliases offers more convenience
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Problem
Frequently used slash commands require typing long, hard-to-memorize inputs in full every time. Examples:
/sessions— browsing/resuming sessions (used constantly)- any command with repeated arguments the user always re-types
There is currently no way to define a shorter name for a slash command. The built-in command set is fixed.
Proposed solution
A [aliases] section in config.toml mapping short slash names to existing commands. The design is modeled on git alias: syntax, naming habits and argument-passing semantics follow git's style as closely as possible, so users familiar with git config alias.* can adopt it with zero learning cost:
[aliases]
"/ss" = "/sessions"
Aliases are configured inside the TUI via the /alias builtin command — no need to edit config files by hand, entering the TUI is all it takes:
/alias /ss "/sessions"— sets/ssto expand to/sessions; persists to config.toml and takes effect immediately (no restart)/alias— lists all configured aliases- Typing
/ssrewrites to/sessionsbefore command resolution; any user args are appended (git-style left-arg concat), e.g./ss <args>→/sessions <args> - Precedence: on name collision, user-defined aliases take precedence over built-in commands (this rule is open for discussion)
- Setting an alias that shadows a built-in command warns and asks for confirmation
Scope
- Schema:
KimiConfigSchema/KimiConfigPatchSchemaaccept thealiasesfield (strict name regex^[a-zA-Z0-9_:/.-]+$) - TOML:
transformTomlDatadoes not drop the[aliases]section - v2 engine:
registerConfigSectionexposesaliaseson the ConfigRegistry - SDK: v2→v1 config mapper whitelist includes
aliases - TUI: alias rewrite in
resolveSlashCommandInput(single-hop, cycle-safe) - TUI:
/aliascommand (list/set), autocomplete entries, help-panel section - TUI: name-collision detection — setting an alias that shadows a built-in command warns and asks for confirmation
- Tests: unit (parse + resolve) + integration (real
parseConfigStringpipeline)
Non-goals (this iteration)
- Deleting aliases via
/alias(config writes are deep-merge; delete requires editing config.toml by hand) - Chained aliases (alias → alias): deliberately single-hop to avoid cycles
- Shell-style aliases with arbitrary expansion semantics: the expansion target is re-fed to the slash parser, not a shell
Related work
Searched existing issues for "alias" in title (12 hits) and "shortcut" (7 hits — keyboard shortcuts, out of scope). No existing proposal covers user-defined slash-command aliases. Closest items:
- #2614 (merged) —
/bugas an alias for/feedback: built-in command aliases are already supported end to end; this proposal opens the same mechanism to user configuration. - #1125 (closed) —
updatealias for theupgradecommand: another built-in command alias precedent. - #2282 (open) — shorthand aliases for managed models in
/model: model-name aliases, a different surface.
Notes
- Precedent: built-in slash commands already support aliases — see Related work above (#2614, #1125). This proposal extends that mechanism to user-defined aliases via config.
- If the maintainers are interested in this direction, I am happy to follow the issue-first process and provide the implementation upon explicit invitation.
- Design reference: modeled on git alias — syntax, naming habits and argument-passing semantics aim to stay compatible with git's usage style.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the named KimiConfigSchema and KimiConfigPatchSchema, transformTomlData, registerConfigSection, the v2-to-v1 config mapper, and TUI resolveSlashCommandInput. Review the existing built-in alias precedents in issues #2614 and #1125, then add the /alias behavior and collision handling with unit and parseConfigString integration tests covering persistence, argument passing, and single-hop resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100