CommandCodeAI / CommandCodeAI/command-code

ModApi gap: mods cannot read or write the live input field (blocks ghost-text / prefill / Space-to-accept)

未关闭
#658 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
没有语言数据
星标
4k
派生
350
PR 合并指标
30 天内没有已合并 PR

描述

ModApi gap: mods cannot read or write the live input field

Summary

The ModApi gives mods no way to read the current text in the input field or set/prefill it. transformInput only intercepts submitted text — it never sees what's being typed, and there's no cmd.ui.setInputText-style API. This blocks a whole class of UX (ghost-text suggestions, inline completion, input prefill) that pi-prompt-suggester and similar tools rely on.

Context

I built a prompt-suggester mod (https://github.com/burningportra/cmd-prompt-suggester) that aims to suggest the user's next prompt after each response — the pi-prompt-suggester UX. The core interaction I cannot implement:

  1. Show a suggestion as ghost text inside the input box — impossible; rendering is line-based only (cmd.ui.notify / cmd.ui.setStatus / cmd.ui.widget, and widget is explicitly "not wired into the TUI yet").
  2. Prefill the input field so the user can edit before sending — impossible; no input-write API.
  3. Press Space to accept the suggestion into the field — impossible; transformInput fires on submit, not on keystroke, so I can't fill the field or bind a key.
What I had to ship instead
  • Suggestion rendered as a 💡 next: notice (line-based).
  • Accept via /j slash command or typing 1 — because there's no way to inject text into the field.

This works, but it's a strict downgrade from pi's UX (ghost text + Space-to-accept), and it's the single most-requested feature for this kind of mod.

Proposed API (open to alternatives)
  • cmd.ui.getInputText(): string — read the current input field contents.
  • cmd.ui.setInputText(text: string): void — replace/prefill the input field.
  • Optionally a keybinding hook (hooks.onKeypress) so mods can respond to Space/Tab/arrows while typing.
Why it matters

The ModApi docs advertise "typed-input interception" as a first-class capability, but it only covers submitted input. Interactive suggestion/prefill is the natural next step, and it's what users expect from a "prompt suggester" mod.

Environment
  • Command Code 1.15.0, macOS
  • Docs read: commandcode.ai/docs/mods (ModApi reference, UI surface)

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 commandcode.ai/docs/mods 的 ModApi 参考开始,检查现有的 cmd.ui.notify、cmd.ui.setStatus、cmd.ui.widget 和 transformInput 接口。定义输入读取和写入行为,并确定是否需要处理按键;完成标准是 mods 无需依赖通知或斜杠命令即可支持所请求的预填充或交互式建议工作流。

由索引模型根据 Issue 内容生成。

评估

领域
api, cli, developer-experience
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。