Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions packages/app/src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,9 @@ export const dict = {
"session.review.noVcs.createGit.action": "Create Git repository",
"session.review.noSnapshot": "Snapshot tracking is disabled in config, so session changes are unavailable",
"session.review.noChanges": "No changes",
"session.review.noUncommittedChanges": "No uncommitted changes yet",
"session.review.noUnstagedChanges": "No unstaged changes yet",
"session.review.noStagedChanges": "No staged changes yet",
"session.review.noGitChanges": "No uncommitted changes yet",
"session.review.noBranchChanges": "No branch changes yet",
"ui.sessionReview.title.unstaged": "Unstaged",
"ui.sessionReview.title.staged": "Staged",
"ui.sessionReview.title.git": "Changes",
"ui.sessionReview.title.branch": "Branch",
"ui.sessionReview.title.lastTurn": "Last Turn",

Expand Down
6 changes: 2 additions & 4 deletions packages/app/src/i18n/parity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ const keys = [
"session.panel.utility",
"session.panel.files",
"session.panel.changes",
"session.review.noUnstagedChanges",
"session.review.noStagedChanges",
"session.review.noGitChanges",
"session.review.noBranchChanges",
"ui.sessionReview.title.unstaged",
"ui.sessionReview.title.staged",
"ui.sessionReview.title.git",
"ui.sessionReview.title.branch",
"ui.sessionReview.title.lastTurn",
] as const
Expand Down
6 changes: 2 additions & 4 deletions packages/app/src/i18n/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,11 +565,9 @@ export const dict = {
"session.review.noVcs": "未检测到 Git 版本控制系统,无法显示更改",
"session.review.noSnapshot": "配置中已禁用快照跟踪,因此会话更改不可用",
"session.review.noChanges": "无更改",
"session.review.noUnstagedChanges": "暂无未暂存变更",
"session.review.noStagedChanges": "暂无已暂存变更",
"session.review.noGitChanges": "暂无文件变更",
"session.review.noBranchChanges": "暂无分支变更",
"ui.sessionReview.title.unstaged": "未暂存变更",
"ui.sessionReview.title.staged": "已暂存变更",
"ui.sessionReview.title.git": "文件变更",
"ui.sessionReview.title.branch": "分支变更",
"ui.sessionReview.title.lastTurn": "上轮变更",
"session.files.selectToOpen": "选择要打开的文件",
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/pages/session/execution-scope.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ describe("execution scope", () => {
})

test("vcs task key includes execution scope", () => {
const oldA = vcsTaskKey({ serverKey: "sidecar", directory: "/repo", epoch: 1 }, "unstaged")
const newA = vcsTaskKey({ serverKey: "sidecar", directory: "/repo", epoch: 3 }, "unstaged")
const oldA = vcsTaskKey({ serverKey: "sidecar", directory: "/repo", epoch: 1 }, "git")
const newA = vcsTaskKey({ serverKey: "sidecar", directory: "/repo", epoch: 3 }, "git")

expect(oldA).not.toBe(newA)
})
Expand Down
14 changes: 5 additions & 9 deletions packages/app/src/pages/session/review-change-mode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("review change mode", () => {
})

test("keeps all review modes selectable for git projects", () => {
expect(reviewChangeOptions({ isGit: true })).toEqual(["unstaged", "staged", "branch", "turn"])
expect(reviewChangeOptions({ isGit: true })).toEqual(["git", "branch", "turn"])
})

test("keeps branch selectable even when the branch diff is empty", () => {
Expand All @@ -31,15 +31,13 @@ describe("review change mode", () => {
})

test("identifies VCS-backed review modes", () => {
expect(isVcsReviewMode("unstaged")).toBe(true)
expect(isVcsReviewMode("staged")).toBe(true)
expect(isVcsReviewMode("git")).toBe(true)
expect(isVcsReviewMode("branch")).toBe(true)
expect(isVcsReviewMode("turn")).toBe(false)
})

test("maps modes to translation keys", () => {
expect(reviewModeLabelKey("unstaged")).toBe("ui.sessionReview.title.unstaged")
expect(reviewModeLabelKey("staged")).toBe("ui.sessionReview.title.staged")
expect(reviewModeLabelKey("git")).toBe("ui.sessionReview.title.git")
expect(reviewModeLabelKey("branch")).toBe("ui.sessionReview.title.branch")
expect(reviewModeLabelKey("turn")).toBe("ui.sessionReview.title.lastTurn")
})
Expand All @@ -51,8 +49,7 @@ describe("review change mode", () => {
test("uses turn diffs without falling back to VCS diffs", () => {
const turn = ["turn diff"]
const vcs = {
unstaged: ["unstaged diff"],
staged: ["staged diff"],
git: ["git diff"],
branch: ["branch diff"],
}

Expand All @@ -61,8 +58,7 @@ describe("review change mode", () => {

test("keeps an empty last turn empty when VCS diffs exist", () => {
const vcs = {
unstaged: ["unstaged diff"],
staged: ["staged diff"],
git: ["git diff"],
branch: ["branch diff"],
}

Expand Down
9 changes: 4 additions & 5 deletions packages/app/src/pages/session/review-change-mode.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export type ReviewChangeMode = "unstaged" | "staged" | "branch" | "turn"
export type ReviewChangeMode = "git" | "branch" | "turn"
export type VcsReviewMode = Exclude<ReviewChangeMode, "turn">

export const DEFAULT_REVIEW_CHANGE_MODE: ReviewChangeMode = "turn"

export const isVcsReviewMode = (mode: ReviewChangeMode): mode is VcsReviewMode =>
mode === "unstaged" || mode === "staged" || mode === "branch"
mode === "git" || mode === "branch"

export const reviewChangeOptions = (input: { isGit: boolean }): ReviewChangeMode[] => {
if (!input.isGit) return [DEFAULT_REVIEW_CHANGE_MODE]
return ["unstaged", "staged", "branch", DEFAULT_REVIEW_CHANGE_MODE]
return ["git", "branch", DEFAULT_REVIEW_CHANGE_MODE]
}

export const coerceReviewChangeMode = (
Expand All @@ -17,8 +17,7 @@ export const coerceReviewChangeMode = (
): ReviewChangeMode => (options.includes(mode) ? mode : DEFAULT_REVIEW_CHANGE_MODE)

export const reviewModeLabelKey = (mode: ReviewChangeMode) => {
if (mode === "unstaged") return "ui.sessionReview.title.unstaged"
if (mode === "staged") return "ui.sessionReview.title.staged"
if (mode === "git") return "ui.sessionReview.title.git"
if (mode === "branch") return "ui.sessionReview.title.branch"
return "ui.sessionReview.title.lastTurn"
}
Expand Down
3 changes: 1 addition & 2 deletions packages/app/src/pages/session/review-panel-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export function createReviewPanelView(input: {

const reviewEmptyText = createMemo(() => {
const changes = input.reviewState.changes()
if (changes === "unstaged") return input.language.t("session.review.noUnstagedChanges")
if (changes === "staged") return input.language.t("session.review.noStagedChanges")
if (changes === "git") return input.language.t("session.review.noGitChanges")
if (changes === "branch") return input.language.t("session.review.noBranchChanges")
return input.language.t("session.review.noChanges")
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ describe("session review state", () => {
})

test("keys pending VCS diff tasks by execution scope and mode", () => {
expect(vcsTaskKey(scope("/repo", 1), "unstaged")).not.toBe(vcsTaskKey(scope("/repo", 3), "unstaged"))
expect(vcsTaskKey(scope("/repo", 3), "unstaged")).not.toBe(vcsTaskKey(scope("/repo", 3), "staged"))
expect(vcsTaskKey(scope("/repo", 1), "git")).not.toBe(vcsTaskKey(scope("/repo", 3), "git"))
expect(vcsTaskKey(scope("/repo", 3), "git")).not.toBe(vcsTaskKey(scope("/repo", 3), "branch"))
})

test("builds review turn diffs from the shared turn-change display", () => {
Expand Down
11 changes: 4 additions & 7 deletions packages/app/src/pages/session/use-session-review-state.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import type { SnapshotFileDiff, VcsFileDiff } from "@opencode-ai/sdk/v2"
import { createEffect, createMemo, createResource, createSignal, on, onCleanup, untrack } from "solid-js"
import { createStore } from "solid-js/store"
Expand Down Expand Up @@ -91,18 +91,15 @@
scope: Record<VcsReviewMode, ExecutionScope | undefined>
}>({
diff: {
unstaged: [],
staged: [],
git: [],
branch: [],
},
ready: {
unstaged: false,
staged: false,
git: false,
branch: false,
},
scope: {
unstaged: undefined,
staged: undefined,
git: undefined,
branch: undefined,
},
})
Expand All @@ -119,7 +116,7 @@

const resetVcs = (mode?: VcsReviewMode) => {
const scope = input.executionScope()
const modes = mode ? [mode] : (["unstaged", "staged", "branch"] as const)
const modes = mode ? [mode] : (["git", "branch"] as const)
modes.forEach((item) => {
const key = vcsTaskKey(scope, item)
bumpVcs(scope, item)
Expand Down
Loading
Loading