MoonshotAI / MoonshotAI/kimi-code

Feature request: git-like user-defined slash-command aliases offers more convenience

Open
#3,158 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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 /ss to expand to /sessions; persists to config.toml and takes effect immediately (no restart)
  • /alias — lists all configured aliases
  • Typing /ss rewrites to /sessions before 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 / KimiConfigPatchSchema accept the aliases field (strict name regex ^[a-zA-Z0-9_:/.-]+$)
  • TOML: transformTomlData does not drop the [aliases] section
  • v2 engine: registerConfigSection exposes aliases on the ConfigRegistry
  • SDK: v2→v1 config mapper whitelist includes aliases
  • TUI: alias rewrite in resolveSlashCommandInput (single-hop, cycle-safe)
  • TUI: /alias command (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 parseConfigString pipeline)

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) — /bug as 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) — update alias for the upgrade command: 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.