소스 검색

Fix issue: Option to update username shown in conversations. (#975)

Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: thdxr <[email protected]>
opencode-agent[bot] 7 달 전
부모
커밋
d8bcf4f4e7
3개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 0
      opencode.json
  2. 5 1
      packages/opencode/src/app/app.ts
  3. 1 0
      packages/opencode/src/config/config.ts

+ 1 - 0
opencode.json

@@ -1,5 +1,6 @@
 {
   "$schema": "https://opencode.ai/config.json",
+  "username": "testuser",
   "mcp": {
     "weather": {
       "type": "local",

+ 5 - 1
packages/opencode/src/app/app.ts

@@ -69,8 +69,12 @@ export namespace App {
 
     const root = git ?? input.cwd
 
+    // Load config to get custom username if set
+    const { Config } = await import("../config/config")
+    const config = await Config.global()
+    
     const info: Info = {
-      user: os.userInfo().username,
+      user: config.username || os.userInfo().username,
       hostname: os.hostname(),
       time: {
         initialized: state.initialized,

+ 1 - 0
packages/opencode/src/config/config.ts

@@ -122,6 +122,7 @@ export namespace Config {
       autoupdate: z.boolean().optional().describe("Automatically update to the latest version"),
       disabled_providers: z.array(z.string()).optional().describe("Disable providers that are loaded automatically"),
       model: z.string().describe("Model to use in the format of provider/model, eg anthropic/claude-2").optional(),
+      username: z.string().optional().describe("Custom username to display in conversations instead of system username"),
       mode: z
         .object({
           build: Mode.optional(),