mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-29 03:44:06 +08:00
fix: add RemoteCommand to barrel, recursive subcommands, include $0 commands in help --all
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
| `kilo import <file>` | import session data from JSON file or URL |
|
||||
| `kilo pr <number>` | fetch and checkout a GitHub PR branch, then run kilo |
|
||||
| `kilo session` | manage sessions |
|
||||
| `kilo remote` | enable remote connection for real-time session relay |
|
||||
| `kilo db` | database tools |
|
||||
| `kilo help [command]` | show full CLI reference |
|
||||
| `kilo completion` | generate shell completion script |
|
||||
|
||||
@@ -18,7 +18,7 @@ Options:
|
||||
--port port to listen on [number] [default: 0]
|
||||
--hostname hostname to listen on [string] [default: "127.0.0.1"]
|
||||
--mdns enable mDNS service discovery (defaults hostname to 0.0.0.0) [boolean] [default: false]
|
||||
--mdns-domain custom domain name for mDNS service (default: opencode.local) [string] [default: "opencode.local"]
|
||||
--mdns-domain custom domain name for mDNS service (default: kilo.local) [string] [default: "kilo.local"]
|
||||
--cors additional domains to allow for CORS [array] [default: []]
|
||||
--cwd working directory [string] [default: "."]
|
||||
```
|
||||
@@ -76,6 +76,16 @@ Options:
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo mcp auth list
|
||||
|
||||
```
|
||||
list OAuth-capable MCP servers and their auth status
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo mcp logout
|
||||
|
||||
```
|
||||
@@ -102,14 +112,48 @@ Options:
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
## kilo [project]
|
||||
|
||||
```
|
||||
start kilo tui
|
||||
|
||||
Positionals:
|
||||
project path to start kilo in [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
--port port to listen on [number] [default: 0]
|
||||
--hostname hostname to listen on [string] [default: "127.0.0.1"]
|
||||
--mdns enable mDNS service discovery (defaults hostname to 0.0.0.0) [boolean] [default: false]
|
||||
--mdns-domain custom domain name for mDNS service (default: kilo.local) [string] [default: "kilo.local"]
|
||||
--cors additional domains to allow for CORS [array] [default: []]
|
||||
-m, --model model to use in the format of provider/model [string]
|
||||
-c, --continue continue the last session [boolean]
|
||||
-s, --session session id to continue [string]
|
||||
--fork fork the session when continuing (use with --continue or --session) [boolean]
|
||||
--cloud-fork fetch session from cloud and continue locally (use with --session) [boolean]
|
||||
--prompt prompt to use [string]
|
||||
--agent agent to use [string]
|
||||
```
|
||||
|
||||
## kilo attach
|
||||
|
||||
```
|
||||
attach to a running kilo server
|
||||
|
||||
Positionals:
|
||||
url http://localhost:4096 [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
--dir directory to run in [string]
|
||||
-c, --continue continue the last session [boolean]
|
||||
-s, --session session id to continue [string]
|
||||
--fork fork the session when continuing (use with --continue or --session) [boolean]
|
||||
--cloud-fork fetch session from cloud and continue locally (use with --session) [boolean]
|
||||
-p, --password basic auth password (defaults to KILO_SERVER_PASSWORD) [string]
|
||||
```
|
||||
|
||||
## kilo run
|
||||
@@ -121,24 +165,26 @@ Positionals:
|
||||
message message to send [string] [default: []]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
--command the command to run, use message for args [string]
|
||||
-c, --continue continue the last session [boolean]
|
||||
-s, --session session id to continue [string]
|
||||
--fork fork the session before continuing (requires --continue or --session) [boolean]
|
||||
--share share the session [boolean]
|
||||
-m, --model model to use in the format of provider/model [string]
|
||||
--agent agent to use [string]
|
||||
--format format: default (formatted) or json (raw JSON events) [string] [choices: "default", "json"] [default: "default"]
|
||||
-f, --file file(s) to attach to message [array]
|
||||
--title title for the session (uses truncated prompt if no value provided) [string]
|
||||
--attach attach to a running opencode server (e.g., http://localhost:4096) [string]
|
||||
--dir directory to run in, path on remote server if attaching [string]
|
||||
--port port for the local server (defaults to random port if no value provided) [number]
|
||||
--variant model variant (provider-specific reasoning effort, e.g., high, max, minimal) [string]
|
||||
--thinking show thinking blocks [boolean] [default: false]
|
||||
--auto auto-approve all permissions (for autonomous/pipeline usage) [boolean] [default: false]
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
--command the command to run, use message for args [string]
|
||||
-c, --continue continue the last session [boolean]
|
||||
-s, --session session id to continue [string]
|
||||
--fork fork the session before continuing (requires --continue or --session) [boolean]
|
||||
--cloud-fork fetch session from cloud and continue locally (requires --session) [boolean]
|
||||
--share share the session [boolean]
|
||||
-m, --model model to use in the format of provider/model [string]
|
||||
--agent agent to use [string]
|
||||
--format format: default (formatted) or json (raw JSON events) [string] [choices: "default", "json"] [default: "default"]
|
||||
-f, --file file(s) to attach to message [array]
|
||||
--title title for the session (uses truncated prompt if no value provided) [string]
|
||||
--attach attach to a running opencode server (e.g., http://localhost:4096) [string]
|
||||
-p, --password basic auth password (defaults to KILO_SERVER_PASSWORD) [string]
|
||||
--dir directory to run in, path on remote server if attaching [string]
|
||||
--port port for the local server (defaults to random port if no value provided) [number]
|
||||
--variant model variant (provider-specific reasoning effort, e.g., high, max, minimal) [string]
|
||||
--thinking show thinking blocks [boolean] [default: false]
|
||||
--auto auto-approve all permissions (for autonomous/pipeline usage) [boolean] [default: false]
|
||||
```
|
||||
|
||||
## kilo debug
|
||||
@@ -188,6 +234,45 @@ Options:
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug lsp diagnostics
|
||||
|
||||
```
|
||||
get diagnostics for a file
|
||||
|
||||
Positionals:
|
||||
file [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug lsp symbols
|
||||
|
||||
```
|
||||
search workspace symbols
|
||||
|
||||
Positionals:
|
||||
query [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug lsp document-symbols
|
||||
|
||||
```
|
||||
get symbols from a document
|
||||
|
||||
Positionals:
|
||||
uri [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug rg
|
||||
|
||||
```
|
||||
@@ -203,6 +288,45 @@ Options:
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug rg tree
|
||||
|
||||
```
|
||||
show file tree using ripgrep
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
--limit [number]
|
||||
```
|
||||
|
||||
### kilo debug rg files
|
||||
|
||||
```
|
||||
list files using ripgrep
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
--query Filter files by query [string]
|
||||
--glob Glob pattern to match files [string]
|
||||
--limit Limit number of results [number]
|
||||
```
|
||||
|
||||
### kilo debug rg search
|
||||
|
||||
```
|
||||
search file contents using ripgrep
|
||||
|
||||
Positionals:
|
||||
pattern Search pattern [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
--glob File glob patterns [array]
|
||||
--limit Limit number of results [number]
|
||||
```
|
||||
|
||||
### kilo debug file
|
||||
|
||||
```
|
||||
@@ -220,6 +344,68 @@ Options:
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug file read
|
||||
|
||||
```
|
||||
read file contents as JSON
|
||||
|
||||
Positionals:
|
||||
path File path to read [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug file status
|
||||
|
||||
```
|
||||
show file status information
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug file list
|
||||
|
||||
```
|
||||
list files in a directory
|
||||
|
||||
Positionals:
|
||||
path File path to list [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug file search
|
||||
|
||||
```
|
||||
search files by query
|
||||
|
||||
Positionals:
|
||||
query Search query [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug file tree
|
||||
|
||||
```
|
||||
show directory tree
|
||||
|
||||
Positionals:
|
||||
dir Directory to tree [string] [default: "."]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug scrap
|
||||
|
||||
```
|
||||
@@ -255,6 +441,42 @@ Options:
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug snapshot track
|
||||
|
||||
```
|
||||
track current snapshot state
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug snapshot patch
|
||||
|
||||
```
|
||||
show patch for a snapshot hash
|
||||
|
||||
Positionals:
|
||||
hash hash [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug snapshot diff
|
||||
|
||||
```
|
||||
show diff for a snapshot hash
|
||||
|
||||
Positionals:
|
||||
hash hash [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
### kilo debug agent
|
||||
|
||||
```
|
||||
@@ -314,8 +536,10 @@ Positionals:
|
||||
url kilo auth provider [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
-p, --provider provider id or name to log in to (skips provider selection) [string]
|
||||
-m, --method login method label (skips method selection) [string]
|
||||
```
|
||||
|
||||
### kilo auth logout
|
||||
@@ -416,7 +640,7 @@ Options:
|
||||
--port port to listen on [number] [default: 0]
|
||||
--hostname hostname to listen on [string] [default: "127.0.0.1"]
|
||||
--mdns enable mDNS service discovery (defaults hostname to 0.0.0.0) [boolean] [default: false]
|
||||
--mdns-domain custom domain name for mDNS service (default: opencode.local) [string] [default: "opencode.local"]
|
||||
--mdns-domain custom domain name for mDNS service (default: kilo.local) [string] [default: "kilo.local"]
|
||||
--cors additional domains to allow for CORS [array] [default: []]
|
||||
```
|
||||
|
||||
@@ -431,7 +655,7 @@ Options:
|
||||
--port port to listen on [number] [default: 0]
|
||||
--hostname hostname to listen on [string] [default: "127.0.0.1"]
|
||||
--mdns enable mDNS service discovery (defaults hostname to 0.0.0.0) [boolean] [default: false]
|
||||
--mdns-domain custom domain name for mDNS service (default: opencode.local) [string] [default: "opencode.local"]
|
||||
--mdns-domain custom domain name for mDNS service (default: kilo.local) [string] [default: "kilo.local"]
|
||||
--cors additional domains to allow for CORS [array] [default: []]
|
||||
```
|
||||
|
||||
@@ -542,6 +766,16 @@ Options:
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
## kilo remote
|
||||
|
||||
```
|
||||
enable remote connection for real-time session relay
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
|
||||
## kilo db
|
||||
|
||||
```
|
||||
|
||||
@@ -18,6 +18,7 @@ import { ExportCommand } from "./cmd/export"
|
||||
import { ImportCommand } from "./cmd/import"
|
||||
import { PrCommand } from "./cmd/pr"
|
||||
import { SessionCommand } from "./cmd/session"
|
||||
import { RemoteCommand } from "./cmd/remote" // kilocode_change
|
||||
import { DbCommand } from "./cmd/db"
|
||||
import { HelpCommand } from "../kilocode/help-command" // kilocode_change
|
||||
|
||||
@@ -41,6 +42,7 @@ export const commands = [
|
||||
ImportCommand,
|
||||
PrCommand,
|
||||
SessionCommand,
|
||||
RemoteCommand, // kilocode_change
|
||||
DbCommand,
|
||||
HelpCommand, // kilocode_change
|
||||
]
|
||||
|
||||
@@ -13,12 +13,14 @@ function strip(text: string): string {
|
||||
function extractCommandName(cmd: Cmd): string | undefined {
|
||||
const raw = typeof cmd.command === "string" ? cmd.command : cmd.command?.[0]
|
||||
if (!raw) return undefined
|
||||
if (raw.startsWith("$0")) return undefined
|
||||
if (raw.startsWith("$0")) return raw.slice(2).trim() || ""
|
||||
return raw.split(/[\s[<]/)[0]
|
||||
}
|
||||
|
||||
async function getHelpText(name: string, cmd: Cmd): Promise<string> {
|
||||
const inst = yargs([]).scriptName(`kilo ${name}`).wrap(null)
|
||||
const inst = yargs([])
|
||||
.scriptName(name ? `kilo ${name}` : "kilo")
|
||||
.wrap(null)
|
||||
if (cmd.builder) {
|
||||
if (typeof cmd.builder === "function") {
|
||||
;(cmd.builder as any)(inst)
|
||||
@@ -33,11 +35,16 @@ async function getHelpText(name: string, cmd: Cmd): Promise<string> {
|
||||
return strip(help)
|
||||
}
|
||||
|
||||
async function getSubcommands(name: string, cmd: Cmd): Promise<Array<{ name: string; hidden: boolean; help: string }>> {
|
||||
if (!cmd.builder || typeof cmd.builder !== "function") return []
|
||||
async function getSubcommands(
|
||||
name: string,
|
||||
builder: ((y: any) => any) | undefined,
|
||||
depth = 0,
|
||||
): Promise<Array<{ name: string; hidden: boolean; help: string }>> {
|
||||
if (!builder || typeof builder !== "function") return []
|
||||
if (depth > 4) return [] // guard against infinite recursion
|
||||
|
||||
const inst = yargs([]).scriptName(`kilo ${name}`).wrap(null)
|
||||
;(cmd.builder as any)(inst)
|
||||
builder(inst)
|
||||
|
||||
const result: Array<{ name: string; hidden: boolean; help: string }> = []
|
||||
|
||||
@@ -71,6 +78,14 @@ async function getSubcommands(name: string, cmd: Cmd): Promise<Array<{ name: str
|
||||
hidden: handler.description === false,
|
||||
help,
|
||||
})
|
||||
|
||||
// recurse into sub-subcommands
|
||||
const deeper = await getSubcommands(
|
||||
full,
|
||||
typeof handler.builder === "function" ? handler.builder : undefined,
|
||||
depth + 1,
|
||||
)
|
||||
result.push(...deeper)
|
||||
}
|
||||
} catch (err) {
|
||||
Log.Default.warn("failed to extract subcommands via yargs internals", { err })
|
||||
@@ -90,7 +105,7 @@ function formatMarkdown(
|
||||
const parts: string[] = []
|
||||
|
||||
for (const section of sections) {
|
||||
parts.push(`## kilo ${section.name}`)
|
||||
parts.push(`## ${section.name ? `kilo ${section.name}` : "kilo"}`)
|
||||
parts.push("")
|
||||
if (section.hidden) {
|
||||
parts.push("> **Internal command** — not intended for direct use.")
|
||||
@@ -131,7 +146,8 @@ function formatText(
|
||||
|
||||
for (const section of sections) {
|
||||
parts.push(rule)
|
||||
const label = section.hidden ? `kilo ${section.name} [internal]` : `kilo ${section.name}`
|
||||
const display = section.name ? `kilo ${section.name}` : "kilo"
|
||||
const label = section.hidden ? `${display} [internal]` : display
|
||||
parts.push(label)
|
||||
parts.push(rule)
|
||||
parts.push("")
|
||||
@@ -185,7 +201,7 @@ export async function generateHelp(options: {
|
||||
const name = extractCommandName(cmd)!
|
||||
const help = await getHelpText(name, cmd)
|
||||
const hidden = (cmd as any).hidden === true
|
||||
const subs = await getSubcommands(name, cmd)
|
||||
const subs = await getSubcommands(name, typeof cmd.builder === "function" ? cmd.builder : undefined)
|
||||
|
||||
sections.push({ name, hidden, help, subs })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user