mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 06:12:26 +00:00
lsp progress
This commit is contained in:
5
packages/opencode/src/cli/cmd/cmd.ts
Normal file
5
packages/opencode/src/cli/cmd/cmd.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { CommandModule } from "yargs"
|
||||
|
||||
export function cmd<T, U>(input: CommandModule<T, U>) {
|
||||
return input
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { Argv } from "yargs"
|
||||
import { App } from "../../app/app"
|
||||
import { version } from "bun"
|
||||
import { Bus } from "../../bus"
|
||||
import { Provider } from "../../provider/provider"
|
||||
import { Session } from "../../session"
|
||||
import { Share } from "../../share/share"
|
||||
import { Message } from "../../session/message"
|
||||
import { UI } from "../ui"
|
||||
import { VERSION } from "../version"
|
||||
|
||||
export const RunCommand = {
|
||||
command: "run [message..]",
|
||||
@@ -26,15 +26,13 @@ export const RunCommand = {
|
||||
},
|
||||
handler: async (args: { message: string[]; session?: string }) => {
|
||||
const message = args.message.join(" ")
|
||||
await App.provide({ cwd: process.cwd(), version }, async () => {
|
||||
await App.provide({ cwd: process.cwd(), version: "0.0.0" }, async () => {
|
||||
await Share.init()
|
||||
const session = args.session
|
||||
? await Session.get(args.session)
|
||||
: await Session.create()
|
||||
|
||||
|
||||
|
||||
UI.print(UI.Style.TEXT_HIGHLIGHT_BOLD + "◍ OpenCode", version)
|
||||
UI.print(UI.Style.TEXT_HIGHLIGHT_BOLD + "◍ OpenCode", VERSION)
|
||||
UI.empty()
|
||||
UI.print(UI.Style.TEXT_NORMAL_BOLD + "> ", message)
|
||||
UI.empty()
|
||||
|
||||
21
packages/opencode/src/cli/cmd/scrap.ts
Normal file
21
packages/opencode/src/cli/cmd/scrap.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { App } from "../../app/app"
|
||||
import { VERSION } from "../version"
|
||||
import { LSP } from "../../lsp"
|
||||
import { cmd } from "./cmd"
|
||||
|
||||
export const ScrapCommand = cmd({
|
||||
command: "scrap <file>",
|
||||
builder: (yargs) =>
|
||||
yargs.positional("file", { type: "string", demandOption: true }),
|
||||
describe: "test command",
|
||||
async handler(args) {
|
||||
await App.provide(
|
||||
{ cwd: process.cwd(), version: VERSION, printLogs: true },
|
||||
async () => {
|
||||
await LSP.file(args.file)
|
||||
const diagnostics = await LSP.diagnostics()
|
||||
console.log(diagnostics)
|
||||
},
|
||||
)
|
||||
},
|
||||
})
|
||||
6
packages/opencode/src/cli/version.ts
Normal file
6
packages/opencode/src/cli/version.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
declare global {
|
||||
const OPENCODE_VERSION: string
|
||||
}
|
||||
|
||||
export const VERSION =
|
||||
typeof OPENCODE_VERSION === "string" ? OPENCODE_VERSION : "dev"
|
||||
Reference in New Issue
Block a user