- 
                Notifications
    You must be signed in to change notification settings 
- Fork 24
fix: update model ID persistence and related chat components #553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Closed
      
      
    
  
     Closed
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            11 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      052601c
              
                feat(vscode): support open task for worktree
              
              
                zhanba b2ecb4a
              
                feat(task): introduce task management interfaces and update VSCode in…
              
              
                zhanba 81c4713
              
                refactor(tasks): remove OpenInTabButton component and related imports
              
              
                zhanba 322fef4
              
                feat(task): refactor task-related types and integrate git information…
              
              
                zhanba 0f3721b
              
                feat(git): refactor git status handling and integrate into task runner
              
              
                zhanba aaf48d3
              
                feat(vscode): add readGitStatus method to VSCodeHostApi and implement…
              
              
                zhanba 8630836
              
                refactor(git): streamline git status handling and update related inte…
              
              
                zhanba 8f2da6f
              
                feat(task): add getTaskWorktreeName utility and integrate into task h…
              
              
                zhanba 31005bf
              
                refactor(git): update worktreeGitdir to worktree structure across the…
              
              
                zhanba 9466f4f
              
                fix(queries): update label in makeTasksQuery to reflect cwd dependency
              
              
                zhanba c01ed36
              
                fix: update model ID persistence and related chat components
              
              
                zhanba File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -2,6 +2,10 @@ import { afterEach, describe, expect, it, vi } from "vitest"; | |
| import { GitStatusReader } from "../git-status"; | ||
|  | ||
| const execMocks = vi.hoisted(() => new Map<string, string>()); | ||
| const fsMocks = vi.hoisted(() => ({ | ||
| stat: vi.fn(), | ||
| readFile: vi.fn(), | ||
| })); | ||
|  | ||
| vi.mock("node:child_process", () => ({ | ||
| exec: vi.fn((command: string, _, callback) => { | ||
|  | @@ -14,9 +18,19 @@ vi.mock("node:child_process", () => ({ | |
| }), | ||
| })); | ||
|  | ||
| vi.mock("node:fs/promises", async (importOriginal) => { | ||
| const original = await importOriginal<typeof import("node:fs/promises")>(); | ||
| return { | ||
| ...original, | ||
| stat: fsMocks.stat, | ||
| readFile: fsMocks.readFile, | ||
| }; | ||
| }); | ||
|  | ||
| describe("GitStatusReader", () => { | ||
| afterEach(() => { | ||
| execMocks.clear(); | ||
| vi.resetAllMocks(); | ||
| }); | ||
|  | ||
| it("should correctly read and parse git status", async () => { | ||
|  | @@ -33,6 +47,11 @@ describe("GitStatusReader", () => { | |
| ); | ||
| execMocks.set("config user.name", "Test User"); | ||
| execMocks.set("config user.email", "[email protected]"); | ||
| execMocks.set("rev-parse --path-format=absolute --git-common-dir", "/test/repo/.git"); | ||
| execMocks.set("rev-parse --path-format=absolute --show-toplevel", "/test/repo"); | ||
|  | ||
| fsMocks.stat.mockResolvedValue({ isFile: () => true }); | ||
| fsMocks.readFile.mockResolvedValue("gitdir: /test/repo/.git/worktrees/feature-branch"); | ||
|  | ||
| const reader = new GitStatusReader({ cwd: "/test/repo" }); | ||
| const status = await reader.readGitStatus(); | ||
|  | @@ -45,6 +64,7 @@ describe("GitStatusReader", () => { | |
| recentCommits: ["abc1234 feat: new feature", "def5678 fix: a bug"], | ||
| userName: "Test User", | ||
| userEmail: "[email protected]", | ||
| worktree: {gitdir: "/test/repo/.git/worktrees/feature-branch"}, | ||
| }); | ||
| }); | ||
|  | ||
|  | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            15 changes: 0 additions & 15 deletions
          
          15 
        
  packages/common/src/vscode-webui-bridge/types/task-params.ts
  
  
      
      
   
        
      
      
    This file was deleted.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| export type FileUIPart = { | ||
| name: string; | ||
| contentType: string; | ||
| url: string; | ||
| }; | ||
|  | ||
| export interface TaskIdParams { | ||
| uid: string; | ||
| prompt?: string; | ||
| files?: FileUIPart[]; | ||
| } | ||
|  | ||
| export interface NewTaskParams { | ||
| uid: undefined; | ||
| } | ||
|  | ||
| export interface TaskDataParams<T extends TaskData = TaskData> { | ||
| uid: string; | ||
| /** | ||
| * @link packages/vscode-webui/src/livestore-provider.tsx#TaskSyncData | ||
| */ | ||
| task: T; | ||
| } | ||
|  | ||
| /** | ||
| * only include fields that are used in the webview and node process | ||
| */ | ||
| export interface TaskData { | ||
| id: string; | ||
| cwd?: string | null; | ||
| git?: { | ||
| worktree?: { gitdir?: string } | null; | ||
| } | null; | ||
| } | ||
|  | ||
| export const getTaskWorktreeName = ( | ||
| task: TaskData | undefined, | ||
| ): string | undefined => { | ||
| return task?.git?.worktree?.gitdir?.split(/[\/\\]/).pop(); | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.