Skip to content

Commit 95d0d4e

Browse files
committed
Fix forked session titles (Issue anomalyco#10105)
- Forked sessions now inherit parent title with (fork #N) numbering - Added getForkedTitle helper function to handle title increment logic - Modified fork() to pass inherited title to createNext() - Resolves issue where forks got generic 'New session - ...' titles
2 parents 6675c2a + 407f34f commit 95d0d4e

50 files changed

Lines changed: 760 additions & 485 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.opencode/opencode.jsonc‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// "enterprise": {
55
// "url": "https://enterprise.dev.opencode.ai",
66
// },
7-
"instructions": ["STYLE_GUIDE.md"],
87
"provider": {
98
"opencode": {
109
"options": {},

‎AGENTS.md‎

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,75 @@
1-
- To test opencode in `packages/opencode`, run `bun dev`.
21
- To regenerate the JavaScript SDK, run `./packages/sdk/js/script/build.ts`.
32
- ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE.
43
- The default branch in this repo is `dev`.
4+
5+
## Style Guide
6+
7+
- Keep things in one function unless composable or reusable
8+
- Avoid unnecessary destructuring. Instead of `const { a, b } = obj`, use `obj.a` and `obj.b` to preserve context
9+
- Avoid `try`/`catch` where possible
10+
- Avoid using the `any` type
11+
- Prefer single word variable names where possible
12+
- Use Bun APIs when possible, like `Bun.file()`
13+
14+
# Avoid let statements
15+
16+
We don't like `let` statements, especially combined with if/else statements.
17+
Prefer `const`.
18+
19+
Good:
20+
21+
```ts
22+
const foo = condition ? 1 : 2
23+
```
24+
25+
Bad:
26+
27+
```ts
28+
let foo
29+
30+
if (condition) foo = 1
31+
else foo = 2
32+
```
33+
34+
# Avoid else statements
35+
36+
Prefer early returns or using an `iife` to avoid else statements.
37+
38+
Good:
39+
40+
```ts
41+
function foo() {
42+
if (condition) return 1
43+
return 2
44+
}
45+
```
46+
47+
Bad:
48+
49+
```ts
50+
function foo() {
51+
if (condition) return 1
52+
else return 2
53+
}
54+
```
55+
56+
# Prefer single word naming
57+
58+
Try your best to find a single word name for your variables, functions, etc.
59+
Only use multiple words if you cannot.
60+
61+
Good:
62+
63+
```ts
64+
const foo = 1
65+
const bar = 2
66+
const baz = 3
67+
```
68+
69+
Bad:
70+
71+
```ts
72+
const fooBar = 1
73+
const barBaz = 2
74+
const bazFoo = 3
75+
```

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ This runs `bun run --cwd packages/desktop build` automatically via Tauri’s `be
148148
> [!NOTE]
149149
> If you make changes to the API or SDK (e.g. `packages/opencode/src/server/server.ts`), run `./script/generate.ts` to regenerate the SDK and related files.
150150
151-
Please try to follow the [style guide](./STYLE_GUIDE.md)
151+
Please try to follow the [style guide](./AGENTS.md)
152152

153153
### Setting up a Debugger
154154

‎STATS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,4 @@
210210
| 2026-01-22 | 5,766,340 (+321,498) | 2,029,487 (+66,956) | 7,795,827 (+388,454) |
211211
| 2026-01-23 | 6,096,236 (+329,896) | 2,096,235 (+66,748) | 8,192,471 (+396,644) |
212212
| 2026-01-24 | 6,371,019 (+274,783) | 2,156,870 (+60,635) | 8,527,889 (+335,418) |
213+
| 2026-01-25 | 6,639,082 (+268,063) | 2,187,853 (+30,983) | 8,826,935 (+299,046) |

‎STYLE_GUIDE.md‎

Lines changed: 0 additions & 71 deletions
This file was deleted.

‎bun.lock‎

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/app/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opencode-ai/app",
3-
"version": "1.1.35",
3+
"version": "1.1.36",
44
"description": "",
55
"type": "module",
66
"exports": {

‎packages/app/src/components/prompt-input.tsx‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
137137
let scrollRef!: HTMLDivElement
138138
let slashPopoverRef!: HTMLDivElement
139139

140+
const mirror = { input: false }
141+
140142
const scrollCursorIntoView = () => {
141143
const container = scrollRef
142144
const selection = window.getSelection()
@@ -183,23 +185,26 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
183185
const openComment = (item: { path: string; commentID?: string; commentOrigin?: "review" | "file" }) => {
184186
if (!item.commentID) return
185187

186-
comments.setFocus({ file: item.path, id: item.commentID })
187-
comments.setActive({ file: item.path, id: item.commentID })
188+
const focus = { file: item.path, id: item.commentID }
189+
comments.setActive(focus)
188190
view().reviewPanel.open()
189191

190192
if (item.commentOrigin === "review") {
191193
tabs().open("review")
194+
requestAnimationFrame(() => comments.setFocus(focus))
192195
return
193196
}
194197

195198
if (item.commentOrigin !== "file" && commentInReview(item.path)) {
196199
tabs().open("review")
200+
requestAnimationFrame(() => comments.setFocus(focus))
197201
return
198202
}
199203

200204
const tab = files.tab(item.path)
201205
tabs().open(tab)
202206
files.load(item.path)
207+
requestAnimationFrame(() => comments.setFocus(focus))
203208
}
204209

205210
const recent = createMemo(() => {
@@ -651,6 +656,25 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
651656
() => prompt.current(),
652657
(currentParts) => {
653658
const inputParts = currentParts.filter((part) => part.type !== "image") as Prompt
659+
660+
if (mirror.input) {
661+
mirror.input = false
662+
if (isNormalizedEditor()) return
663+
664+
const selection = window.getSelection()
665+
let cursorPosition: number | null = null
666+
if (selection && selection.rangeCount > 0 && editorRef.contains(selection.anchorNode)) {
667+
cursorPosition = getCursorPosition(editorRef)
668+
}
669+
670+
renderEditor(inputParts)
671+
672+
if (cursorPosition !== null) {
673+
setCursorPosition(editorRef, cursorPosition)
674+
}
675+
return
676+
}
677+
654678
const domParts = parseFromDOM()
655679
if (isNormalizedEditor() && isPromptEqual(inputParts, domParts)) return
656680

@@ -765,6 +789,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
765789
setStore("savedPrompt", null)
766790
}
767791
if (prompt.dirty()) {
792+
mirror.input = true
768793
prompt.set(DEFAULT_PROMPT, 0)
769794
}
770795
queueScroll()
@@ -795,6 +820,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
795820
setStore("savedPrompt", null)
796821
}
797822

823+
mirror.input = true
798824
prompt.set([...rawParts, ...images], cursorPosition)
799825
queueScroll()
800826
}

0 commit comments

Comments
 (0)