Skip to content

Commit 7706f5b

Browse files
committed
core: switch commit command to kimi-k2.5 and improve worktree test reliability
1 parent 63e3855 commit 7706f5b

2 files changed

Lines changed: 40 additions & 27 deletions

File tree

.opencode/command/commit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: git commit and push
3-
model: opencode/glm-4.7
3+
model: opencode/kimi-k2.5
44
subtask: true
55
---
66

packages/opencode/test/project/project.test.ts

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -54,37 +54,50 @@ describe("Project.fromDirectory with worktrees", () => {
5454
test("should set worktree to root when called from a worktree", async () => {
5555
await using tmp = await tmpdir({ git: true })
5656

57-
const worktreePath = path.join(tmp.path, "..", "worktree-test")
58-
await $`git worktree add ${worktreePath} -b test-branch`.cwd(tmp.path).quiet()
59-
60-
const { project, sandbox } = await Project.fromDirectory(worktreePath)
61-
62-
expect(project.worktree).toBe(tmp.path)
63-
expect(sandbox).toBe(worktreePath)
64-
expect(project.sandboxes).toContain(worktreePath)
65-
expect(project.sandboxes).not.toContain(tmp.path)
66-
67-
await $`git worktree remove ${worktreePath}`.cwd(tmp.path).quiet()
57+
const worktreePath = path.join(tmp.path, "..", path.basename(tmp.path) + "-worktree")
58+
try {
59+
await $`git worktree add ${worktreePath} -b test-branch-${Date.now()}`.cwd(tmp.path).quiet()
60+
61+
const { project, sandbox } = await Project.fromDirectory(worktreePath)
62+
63+
expect(project.worktree).toBe(tmp.path)
64+
expect(sandbox).toBe(worktreePath)
65+
expect(project.sandboxes).toContain(worktreePath)
66+
expect(project.sandboxes).not.toContain(tmp.path)
67+
} finally {
68+
await $`git worktree remove ${worktreePath}`
69+
.cwd(tmp.path)
70+
.quiet()
71+
.catch(() => {})
72+
}
6873
})
6974

7075
test("should accumulate multiple worktrees in sandboxes", async () => {
7176
await using tmp = await tmpdir({ git: true })
7277

73-
const worktree1 = path.join(tmp.path, "..", "worktree-1")
74-
const worktree2 = path.join(tmp.path, "..", "worktree-2")
75-
await $`git worktree add ${worktree1} -b branch-1`.cwd(tmp.path).quiet()
76-
await $`git worktree add ${worktree2} -b branch-2`.cwd(tmp.path).quiet()
77-
78-
await Project.fromDirectory(worktree1)
79-
const { project } = await Project.fromDirectory(worktree2)
80-
81-
expect(project.worktree).toBe(tmp.path)
82-
expect(project.sandboxes).toContain(worktree1)
83-
expect(project.sandboxes).toContain(worktree2)
84-
expect(project.sandboxes).not.toContain(tmp.path)
85-
86-
await $`git worktree remove ${worktree1}`.cwd(tmp.path).quiet()
87-
await $`git worktree remove ${worktree2}`.cwd(tmp.path).quiet()
78+
const worktree1 = path.join(tmp.path, "..", path.basename(tmp.path) + "-wt1")
79+
const worktree2 = path.join(tmp.path, "..", path.basename(tmp.path) + "-wt2")
80+
try {
81+
await $`git worktree add ${worktree1} -b branch-${Date.now()}`.cwd(tmp.path).quiet()
82+
await $`git worktree add ${worktree2} -b branch-${Date.now() + 1}`.cwd(tmp.path).quiet()
83+
84+
await Project.fromDirectory(worktree1)
85+
const { project } = await Project.fromDirectory(worktree2)
86+
87+
expect(project.worktree).toBe(tmp.path)
88+
expect(project.sandboxes).toContain(worktree1)
89+
expect(project.sandboxes).toContain(worktree2)
90+
expect(project.sandboxes).not.toContain(tmp.path)
91+
} finally {
92+
await $`git worktree remove ${worktree1}`
93+
.cwd(tmp.path)
94+
.quiet()
95+
.catch(() => {})
96+
await $`git worktree remove ${worktree2}`
97+
.cwd(tmp.path)
98+
.quiet()
99+
.catch(() => {})
100+
}
88101
})
89102
})
90103

0 commit comments

Comments
 (0)