GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tui): show current location in working copies; order by created; … · isaacfinnegan/whispercode@1c2a2b0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • core
      • src
        • project.ts
      • test
        • project.test.ts
    • opencode/src/cli/cmd/tui
      • component
        • dialog-move-session.tsx
        • prompt
          • move.tsx
      • config
        • keybind.ts
      • feature-plugins/home
        • footer.tsx
      • routes/home
        • session-destination.tsx
      • ui
        • dialog-select.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/core/src/project.ts‎

Copy file name to clipboardExpand all lines: packages/core/src/project.ts
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export * as ProjectV2 from "./project"
22
export * as Project from "./project"
33

44
import { Context, Effect, Layer, Schema } from "effect"
5-
import { eq } from "drizzle-orm"
5+
import { asc, desc, eq } from "drizzle-orm"
66
import path from "path"
77
import { AbsolutePath, withStatics } from "./schema"
88
import { FSUtil } from "./fs-util"
@@ -76,11 +76,10 @@ export const layer = Layer.effect(
7676
.select({ directory: ProjectDirectoryTable.directory })
7777
.from(ProjectDirectoryTable)
7878
.where(eq(ProjectDirectoryTable.project_id, input.projectID))
79+
.orderBy(desc(ProjectDirectoryTable.time_created), asc(ProjectDirectoryTable.directory))
7980
.all()
8081
.pipe(Effect.orDie)
81-
return rows
82-
.toSorted((a, b) => a.directory.localeCompare(b.directory))
83-
.map((row) => AbsolutePath.make(row.directory))
82+
return rows.map((row) => AbsolutePath.make(row.directory))
8483
})
8584

8685
const cached = Effect.fnUntraced(function* (dir: string) {
Collapse file

‎packages/core/test/project.test.ts‎

Copy file name to clipboardExpand all lines: packages/core/test/project.test.ts
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe("Project directories schemas", () => {
6565
}),
6666
)
6767

68-
it.effect("lists stored project directories only for the requested project", () =>
68+
it.effect("lists stored project directories newest first for the requested project", () =>
6969
Effect.gen(function* () {
7070
const project = yield* ProjectV2.Service
7171
const { db } = yield* Database.Service
@@ -82,16 +82,16 @@ describe("Project directories schemas", () => {
8282
yield* db
8383
.insert(ProjectDirectoryTable)
8484
.values([
85-
{ project_id: projectID, directory: AbsolutePath.make("/repo/z"), type: "root" },
86-
{ project_id: projectID, directory: AbsolutePath.make("/repo/a"), type: "main" },
87-
{ project_id: otherID, directory: AbsolutePath.make("/other"), type: "main" },
85+
{ project_id: projectID, directory: AbsolutePath.make("/repo/z"), type: "root", time_created: 2 },
86+
{ project_id: projectID, directory: AbsolutePath.make("/repo/a"), type: "main", time_created: 1 },
87+
{ project_id: otherID, directory: AbsolutePath.make("/other"), type: "main", time_created: 3 },
8888
])
8989
.run()
9090
.pipe(Effect.orDie)
9191

9292
expect(yield* project.directories({ projectID })).toEqual([
93-
AbsolutePath.make("/repo/a"),
9493
AbsolutePath.make("/repo/z"),
94+
AbsolutePath.make("/repo/a"),
9595
])
9696
}),
9797
)
Collapse file

‎packages/opencode/src/cli/cmd/tui/component/dialog-move-session.tsx‎

Copy file name to clipboardExpand all lines: packages/opencode/src/cli/cmd/tui/component/dialog-move-session.tsx
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ const REFRESH_FRAMES = ["■", "⬝"]
1515

1616
export type MoveSessionSelection = { type: "directory"; directory: string } | { type: "new" }
1717

18-
export function DialogMoveSession(props: { projectID: string; onSelect: (selection: MoveSessionSelection) => void }) {
18+
export function DialogMoveSession(props: {
19+
projectID: string
20+
current?: MoveSessionSelection
21+
onSelect: (selection: MoveSessionSelection) => void
22+
}) {
1923
const dialog = useDialog()
2024
const sdk = useSDK()
2125
const dimensions = useTerminalDimensions()
@@ -42,7 +46,7 @@ export function DialogMoveSession(props: { projectID: string; onSelect: (selecti
4246
},
4347
)
4448

45-
const options = createMemo<DialogSelectOption<string | undefined>[]>(() => {
49+
const options = createMemo<DialogSelectOption<MoveSessionSelection | undefined>[]>(() => {
4650
if (directories.loading) return [{ title: "Loading project directories...", value: undefined }]
4751
if (directories.error) return [{ title: "Failed to load project directories", value: undefined }]
4852
const data = directories()
@@ -88,7 +92,7 @@ export function DialogMoveSession(props: { projectID: string; onSelect: (selecti
8892
<span style={{ fg: theme.textMuted }}>{visible.slice(split)}</span>
8993
</>
9094
) : undefined,
91-
value: item.location,
95+
value: { type: "directory", directory: item.location } as const,
9296
category: item.root === data?.main ? "Project" : "Working copies",
9397
titleWidth,
9498
truncateTitle: "left" as const,
@@ -103,8 +107,9 @@ export function DialogMoveSession(props: { projectID: string; onSelect: (selecti
103107
<DialogSelect
104108
title="Move session"
105109
options={options()}
110+
current={props.current}
106111
onSelect={(option) => {
107-
if (option.value) props.onSelect({ type: "directory", directory: option.value })
112+
if (option.value) props.onSelect(option.value)
108113
}}
109114
actions={[
110115
{
Collapse file

‎packages/opencode/src/cli/cmd/tui/component/prompt/move.tsx‎

Copy file name to clipboardExpand all lines: packages/opencode/src/cli/cmd/tui/component/prompt/move.tsx
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ export function usePromptMove(input: { projectID: () => string | undefined; sess
5151
function open() {
5252
const projectID = input.projectID()
5353
if (!projectID) return
54+
const sessionID = input.sessionID()
55+
const session = sessionID ? sync.session.get(sessionID) : undefined
5456
dialog.replace(() => (
5557
<DialogMoveSession
5658
projectID={projectID}
59+
current={homeDestination?.destination() ?? (session ? { type: "directory", directory: session.directory } : undefined)}
5760
onSelect={(selection) => {
5861
const sessionID = input.sessionID()
5962
if (!sessionID) {
Collapse file

‎packages/opencode/src/cli/cmd/tui/config/keybind.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/cli/cmd/tui/config/keybind.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export const Definitions = {
207207
"dialog.select.submit": keybind("return", "Submit selected dialog item"),
208208
"dialog.prompt.submit": keybind("return", "Submit dialog prompt"),
209209
"dialog.mcp.toggle": keybind("space", "Toggle MCP in MCP dialog"),
210-
"dialog.move_session.new": keybind("ctrl+w", "New project copy"),
210+
"dialog.move_session.new": keybind("ctrl+m", "New project copy"),
211211
"prompt.autocomplete.prev": keybind("up,ctrl+p", "Move to previous autocomplete item"),
212212
"prompt.autocomplete.next": keybind("down,ctrl+n", "Move to next autocomplete item"),
213213
"prompt.autocomplete.hide": keybind("escape", "Hide autocomplete"),
Collapse file

‎packages/opencode/src/cli/cmd/tui/feature-plugins/home/footer.tsx‎

Copy file name to clipboardExpand all lines: packages/opencode/src/cli/cmd/tui/feature-plugins/home/footer.tsx
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ function Directory(props: { api: TuiPluginApi }) {
1111
const destination = useHomeSessionDestination()
1212
const dir = createMemo(() => {
1313
const selected = destination?.destination()
14-
if (selected?.type === "new") return
15-
if (selected?.type === "directory") return selected.directory.replace(Global.Path.home, "~")
16-
const dir = props.api.state.path.directory || process.cwd()
17-
const out = dir.replace(Global.Path.home, "~")
18-
const branch = props.api.state.vcs?.branch
14+
if (!selected || selected.type === "new") return
15+
const out = selected.directory.replace(Global.Path.home, "~")
16+
const branch =
17+
selected.directory === (props.api.state.path.directory || process.cwd()) ? props.api.state.vcs?.branch : undefined
1918
if (branch) return out + ":" + branch
2019
return out
2120
})
Collapse file

‎packages/opencode/src/cli/cmd/tui/routes/home/session-destination.tsx‎

Copy file name to clipboardExpand all lines: packages/opencode/src/cli/cmd/tui/routes/home/session-destination.tsx
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { createContext, createSignal, useContext, type Accessor, type ParentProps, type Setter } from "solid-js"
1+
import { createContext, createMemo, createSignal, useContext, type Accessor, type ParentProps, type Setter } from "solid-js"
2+
import { useSync } from "../../context/sync"
23

34
export type HomeSessionDestination = { type: "directory"; directory: string } | { type: "new" }
45

@@ -11,7 +12,11 @@ type Context = {
1112
const HomeSessionDestinationContext = createContext<Context>()
1213

1314
export function HomeSessionDestinationProvider(props: ParentProps) {
14-
const [destination, setDestination] = createSignal<HomeSessionDestination>()
15+
const sync = useSync()
16+
const [selected, setDestination] = createSignal<HomeSessionDestination>()
17+
const destination = createMemo<HomeSessionDestination>(() =>
18+
selected() ?? { type: "directory", directory: sync.path.directory || process.cwd() },
19+
)
1520
return (
1621
<HomeSessionDestinationContext.Provider
1722
value={{ destination, setDestination, clear: () => setDestination(undefined) }}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.