node v2 cli support (#36309)

This commit is contained in:
Simon Klee 2026-07-17 14:45:06 +02:00 committed by GitHub
commit a1b274e6f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
75 changed files with 1502 additions and 367 deletions

View file

@ -1,5 +1,5 @@
import type { BoxRenderable, TextareaRenderable, ScrollBoxRenderable } from "@opentui/core"
import { pathToFileURL } from "bun"
import { pathToFileURL } from "node:url"
import fuzzysort from "fuzzysort"
import path from "path"
import { firstBy } from "remeda"
@ -21,6 +21,7 @@ import { useFrecency } from "../../prompt/frecency"
import { Keymap } from "../../context/keymap"
import { displayCharAt, mentionTriggerIndex } from "../../prompt/display"
import type { FileSystemEntry } from "@opencode-ai/client"
import { stringWidth } from "../../util/string-width"
function removeLineRange(input: string) {
const hashIndex = input.lastIndexOf("#")
@ -188,7 +189,7 @@ export function Autocomplete(props: {
const virtualText = "@" + text
const extmarkStart = store.index
const extmarkEnd = extmarkStart + Bun.stringWidth(virtualText)
const extmarkEnd = extmarkStart + stringWidth(virtualText)
const styleId = part.type === "file" ? props.fileStyleId : props.agentStyleId
@ -431,7 +432,7 @@ export function Autocomplete(props: {
const cursor = props.input().logicalCursor
props.input().deleteRange(0, 0, cursor.row, cursor.col)
props.input().insertText(newText)
props.input().cursorOffset = Bun.stringWidth(newText)
props.input().cursorOffset = stringWidth(newText)
}
const commands = createMemo((): AutocompleteOption[] => {

View file

@ -26,6 +26,7 @@ import { editorSelectionKey, useEditorContext, type EditorSelection } from "../.
import { normalizePromptContent, openEditor } from "../../editor"
import { useExit } from "../../context/exit"
import { promptOffsetWidth } from "../../prompt/display"
import { stringWidth } from "../../util/string-width"
import { createStore, produce, unwrap } from "solid-js/store"
import { emptyPrompt, usePromptHistory, type PromptInfo, type PromptPartRef } from "../../prompt/history"
import { computePromptTraits } from "../../prompt/traits"
@ -529,7 +530,7 @@ export function Prompt(props: PromptProps) {
pasted: [],
})
restoreExtmarksFromPrompt(store.prompt)
input.cursorOffset = Bun.stringWidth(normalized)
input.cursorOffset = stringWidth(normalized)
},
},
{