Jay V 8 месяцев назад
Родитель
Сommit
fa991920bc

+ 2 - 2
bun.lock

@@ -458,7 +458,7 @@
 
     "@types/babel__traverse": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.20.7" } }, "sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng=="],
 
-    "@types/bun": ["@types/[email protected]6", "", { "dependencies": { "bun-types": "1.2.16" } }, "sha512-1aCZJ/6nSiViw339RsaNhkNoEloLaPzZhxMOYEa7OzRzO41IGg5n/7I43/ZIAW/c+Q6cT12Vf7fOZOoVIzb5BQ=="],
+    "@types/bun": ["@types/[email protected]7", "", { "dependencies": { "bun-types": "1.2.17" } }, "sha512-l/BYs/JYt+cXA/0+wUhulYJB6a6p//GTPiJ7nV+QHa8iiId4HZmnu/3J/SowP5g0rTiERY2kfGKXEK5Ehltx4Q=="],
 
     "@types/debug": ["@types/[email protected]", "", { "dependencies": { "@types/ms": "*" } }, "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ=="],
 
@@ -596,7 +596,7 @@
 
     "buffer": ["[email protected]", "", { "dependencies": { "base64-js": "^1.0.2", "ieee754": "^1.1.4", "isarray": "^1.0.0" } }, "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg=="],
 
-    "bun-types": ["[email protected]6", "", { "dependencies": { "@types/node": "*" } }, "sha512-ciXLrHV4PXax9vHvUrkvun9VPVGOVwbbbBF/Ev1cXz12lyEZMoJpIJABOfPcN9gDJRaiKF9MVbSygLg4NXu3/A=="],
+    "bun-types": ["[email protected]7", "", { "dependencies": { "@types/node": "*" } }, "sha512-ElC7ItwT3SCQwYZDYoAH+q6KT4Fxjl8DtZ6qDulUFBmXA8YB4xo+l54J9ZJN+k2pphfn9vk7kfubeSd5QfTVJQ=="],
 
     "bundle-name": ["[email protected]", "", { "dependencies": { "run-applescript": "^7.0.0" } }, "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q=="],
 

+ 4 - 4
packages/opencode/src/cli/cmd/auth.ts

@@ -10,14 +10,14 @@ import { map, pipe, sortBy, values } from "remeda"
 
 export const AuthCommand = cmd({
   command: "auth",
-  describe: "Manage credentials",
+  describe: "manage credentials",
   builder: (yargs) =>
     yargs
       .command(AuthLoginCommand)
       .command(AuthLogoutCommand)
       .command(AuthListCommand)
       .demandCommand(),
-  async handler() {},
+  async handler() { },
 })
 
 export const AuthListCommand = cmd({
@@ -41,7 +41,7 @@ export const AuthListCommand = cmd({
 
 export const AuthLoginCommand = cmd({
   command: "login",
-  describe: "login to a provider",
+  describe: "log in to a provider",
   async handler() {
     UI.empty()
     prompts.intro("Add credential")
@@ -195,7 +195,7 @@ export const AuthLoginCommand = cmd({
 
 export const AuthLogoutCommand = cmd({
   command: "logout",
-  describe: "logout from a configured provider",
+  describe: "log out from a configured provider",
   async handler() {
     UI.empty()
     const credentials = await Auth.all().then((x) => Object.entries(x))

+ 4 - 4
packages/opencode/src/cli/cmd/run.ts

@@ -25,7 +25,7 @@ const TOOL: Record<string, [string, string]> = {
 
 export const RunCommand = cmd({
   command: "run [message..]",
-  describe: "Run opencode with a message",
+  describe: "run opencode with a message",
   builder: (yargs: Argv) => {
     return yargs
       .positional("message", {
@@ -36,12 +36,12 @@ export const RunCommand = cmd({
       })
       .option("continue", {
         alias: ["c"],
-        describe: "Continue the last session",
+        describe: "continue the last session",
         type: "boolean",
       })
       .option("session", {
         alias: ["s"],
-        describe: "Session ID to continue",
+        describe: "session id to continue",
         type: "string",
       })
       .option("share", {
@@ -51,7 +51,7 @@ export const RunCommand = cmd({
       .option("model", {
         type: "string",
         alias: ["m"],
-        describe: "Model to use in the format of provider/model",
+        describe: "model to use in the format of provider/model",
       })
   },
   handler: async (args) => {

+ 3 - 3
packages/opencode/src/cli/cmd/upgrade.ts

@@ -5,16 +5,16 @@ import { Installation } from "../../installation"
 
 export const UpgradeCommand = {
   command: "upgrade [target]",
-  describe: "upgrade opencode to the latest version or a specific version",
+  describe: "upgrade opencode to the latest or a specific version",
   builder: (yargs: Argv) => {
     return yargs
       .positional("target", {
-        describe: "specific version to upgrade to (e.g., '0.1.48' or 'v0.1.48')",
+        describe: "version to upgrade to, for ex '0.1.48' or 'v0.1.48'",
         type: "string",
       })
       .option("method", {
         alias: "m",
-        describe: "installation method to use (curl, npm, pnpm, bun, brew)",
+        describe: "installation method to use",
         type: "string",
         choices: ["curl", "npm", "pnpm", "bun", "brew"],
       })

+ 21 - 18
packages/opencode/src/index.ts

@@ -25,9 +25,12 @@ const cancel = new AbortController()
 
 const cli = yargs(hideBin(process.argv))
   .scriptName("opencode")
-  .version(Installation.VERSION)
+  .help("help", "show help")
+  .alias("help", "h")
+  .version("version", "show version number", Installation.VERSION)
+  .alias("version", "v")
   .option("print-logs", {
-    describe: "Print logs to stderr",
+    describe: "print logs to stderr",
     type: "boolean",
   })
   .middleware(async () => {
@@ -40,7 +43,7 @@ const cli = yargs(hideBin(process.argv))
   .usage("\n" + UI.logo())
   .command({
     command: "$0 [project]",
-    describe: "start opencode TUI",
+    describe: "start opencode tui",
     builder: (yargs) =>
       yargs.positional("project", {
         type: "string",
@@ -89,21 +92,21 @@ const cli = yargs(hideBin(process.argv))
             },
           })
 
-          ;(async () => {
-            if (Installation.VERSION === "dev") return
-            if (Installation.isSnapshot()) return
-            const config = await Config.global()
-            if (config.autoupdate === false) return
-            const latest = await Installation.latest()
-            if (Installation.VERSION === latest) return
-            const method = await Installation.method()
-            if (method === "unknown") return
-            await Installation.upgrade(method, latest)
-              .then(() => {
-                Bus.publish(Installation.Event.Updated, { version: latest })
-              })
-              .catch(() => {})
-          })()
+            ; (async () => {
+              if (Installation.VERSION === "dev") return
+              if (Installation.isSnapshot()) return
+              const config = await Config.global()
+              if (config.autoupdate === false) return
+              const latest = await Installation.latest()
+              if (Installation.VERSION === latest) return
+              const method = await Installation.method()
+              if (method === "unknown") return
+              await Installation.upgrade(method, latest)
+                .then(() => {
+                  Bus.publish(Installation.Event.Updated, { version: latest })
+                })
+                .catch(() => { })
+            })()
 
           await proc.exited
           server.stop()