Преглед изворни кода

cli: redesign run command output flow and disable todo read tool

- Show run message at execution start with UI formatting
- Remove unused show() function and simplify output logic
- Add agent/model display when assistant messages begin
- Comment out TodoReadTool from registry
- Remove mcp context7 configuration
Dax Raad пре 2 месеци
родитељ
комит
2c2b1ea90a
3 измењених фајлова са 13 додато и 18 уклоњено
  1. 1 6
      .opencode/opencode.jsonc
  2. 11 11
      packages/opencode/src/cli/cmd/run.ts
  3. 1 1
      packages/opencode/src/tool/registry.ts

+ 1 - 6
.opencode/opencode.jsonc

@@ -9,12 +9,7 @@
       "options": {},
     },
   },
-  "mcp": {
-    "context7": {
-      "type": "remote",
-      "url": "https://mcp.context7.com/mcp",
-    },
-  },
+  "mcp": {},
   "tools": {
     "github-triage": false,
     "github-pr-search": false,

+ 11 - 11
packages/opencode/src/cli/cmd/run.ts

@@ -367,15 +367,6 @@ export const RunCommand = cmd({
     }
 
     async function execute(sdk: OpencodeClient) {
-      function show() {
-        if (args.format === "json") return
-        if (!process.stdout.isTTY) return
-        const text = message.trimEnd()
-        if (!text) return
-        UI.empty()
-        text.split("\n").forEach((line) => UI.println(`> ${line}`))
-        UI.empty()
-      }
       const seen = new Set<string>()
 
       function head(info: Message) {
@@ -418,7 +409,18 @@ export const RunCommand = cmd({
       let error: string | undefined
 
       async function loop() {
+        UI.empty()
+        UI.println(`> ${args.message}`)
+        UI.empty()
+        let start = false
         for await (const event of events.stream) {
+          if (event.type === "message.updated" && event.properties.info.role === "assistant" && !start) {
+            start = true
+            UI.empty()
+            UI.println(`# ${event.properties.info.agent} · ${event.properties.info.modelID}`)
+            UI.empty()
+          }
+
           if (event.type === "message.part.updated") {
             const part = event.properties.part
             if (part.sessionID !== sessionID) continue
@@ -530,8 +532,6 @@ export const RunCommand = cmd({
       }
       await share(sdk, sessionID)
 
-      if (!args.command) show()
-
       loop().catch((e) => {
         console.error(e)
         process.exit(1)

+ 1 - 1
packages/opencode/src/tool/registry.ts

@@ -110,7 +110,7 @@ export namespace ToolRegistry {
       TaskTool,
       WebFetchTool,
       TodoWriteTool,
-      TodoReadTool,
+      // TodoReadTool,
       WebSearchTool,
       CodeSearchTool,
       SkillTool,