Skip to content

feat(commands): 堆叠 slash-skill 调用 (最多 5 前导) #72

Closed

Description

@dahai80

动机

来源: architecture/fusion-code-enhance-0819.md Part A Tier 1, CC 2.1.199。

CC 2.1.199 支持 /skill-a /skill-b do XYZ 堆叠 slash-skill (最多 5 前导技能)。fusion-code 当前仅跑首个 /command, 余下作字面量 args 塞进技能 prompt, 从不重新解析。

现状 (调查定位)

  • src/utils/slashCommandParsing.ts:25 parseSlashCommand — 单一 chokepoint, split 首空格, args 原样保留
  • trace /skill-a /skill-b do XYZ:
    • slashCommandParsing.ts:41 commandName=skill-a
    • slashCommandParsing.ts:53 args=/skill-b do XYZ (原样)
    • argumentSubstitution.ts:136 $ARGUMENTS → /skill-b do XYZ (字面文本进 skill-a prompt body)
    • 无第二 / 检测, 无第二 dispatch
  • skills = commands (type:"prompt"), 直接 /<name> <args> 调用, 无独立 /skill dispatcher

方案

  • slashCommandParsing.ts:25 parseSlashCommand 改返回前导 slash 命令列表 + 终末 free-text
    • 解析逻辑: 从输入开头连续提取 leading /token 命令, 最多 5 (超 5 报错), 遇到首个非 / 起始 token 或 free-text 停止
    • 保持向后兼容: 单 /cmd args 行为不变 (列表长 1)
  • src/utils/processUserInput/processSlashCommand.tsx:391 循环: 依次执行前导技能, 把终末 free-text 作最后一条命令的 args
    • 前导技能仅注入 system/context (prompt type), 不各自生 turn; 终末命令 (技能或 free-text) 生实际 turn
    • 或: 全部前导技能 prompt 串联 + 终末 args 一起送模型 (CC 语义: 前导技能叠 context, 终末是任务)
  • 超过 5 前导: 报错提示 (CC 2.1.199 "最多 5 前导技能")
  • src/screens/REPL.tsx:4326-4332 immediate-command inline parser 同步处理 (immediate:true local-jsx, 但技能 type:prompt 不走此路 — 低优先, 验证后决定)

验收

  • typecheck 0 / build + build:dev:full / 514 tests
  • 单测: parseSlashCommand 单命令不变 + 多前导返回列表 + 超 5 报错 + free-text 作终末 args
  • 手测: /skill-a /skill-b do task 两技能 context 叠加, task 作 args
  • CI + lint 绿
  • doc 更新
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions