rebrand: 将 opencode 改造为 zmo CLI 并隐藏非 CLI 命令
为打造自有纯 CLI 产品 zmo(类 Claude Code),在保留上游同步能力的前提下做套壳改造: - 入口隐藏 9 个非 CLI 命令(console/web/github/pr/stats/export/import/db/debug) - 全面 rebrand:scriptName、Logo、配置目录(~/.config/zmo)、bin 名、构建产物、可见文案 - env 双读兼容(ZMO_* 优先,回退 OPENCODE_*),配置文件名新增 zmo.json - 刻意保留 @opencode-ai/* 内部包名与 opencode provider,避免破坏功能与上游同步 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -484,7 +484,7 @@
|
|||||||
"name": "opencode",
|
"name": "opencode",
|
||||||
"version": "1.15.13",
|
"version": "1.15.13",
|
||||||
"bin": {
|
"bin": {
|
||||||
"opencode": "./bin/opencode",
|
"zmo": "./bin/opencode",
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.11.1",
|
"@actions/core": "1.11.1",
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ export const layer = Layer.effect(
|
|||||||
const global = yield* Global.Service
|
const global = yield* Global.Service
|
||||||
const location = yield* Location.Service
|
const location = yield* Location.Service
|
||||||
const policy = yield* Policy.Service
|
const policy = yield* Policy.Service
|
||||||
const names = ["config.json", "opencode.json", "opencode.jsonc"]
|
const names = ["config.json", "zmo.json", "zmo.jsonc", "opencode.json", "opencode.jsonc"]
|
||||||
|
|
||||||
const loadFile = Effect.fnUntraced(function* (filepath: string) {
|
const loadFile = Effect.fnUntraced(function* (filepath: string) {
|
||||||
const text = yield* fs.readFileStringSafe(filepath)
|
const text = yield* fs.readFileStringSafe(filepath)
|
||||||
|
|||||||
@@ -1,14 +1,25 @@
|
|||||||
import { Config } from "effect"
|
import { Config } from "effect"
|
||||||
|
|
||||||
|
// zmo: 双读兼容 —— 优先读 ZMO_* 前缀,回退到原 OPENCODE_* 前缀。
|
||||||
|
// 这样旧的 OPENCODE_* 环境变量仍然有效,同时支持新的 ZMO_* 前缀。
|
||||||
|
function envOf(key: string): string | undefined {
|
||||||
|
if (key.startsWith("OPENCODE_")) {
|
||||||
|
const zmoKey = "ZMO_" + key.slice("OPENCODE_".length)
|
||||||
|
const zmoValue = process.env[zmoKey]
|
||||||
|
if (zmoValue !== undefined) return zmoValue
|
||||||
|
}
|
||||||
|
return process.env[key]
|
||||||
|
}
|
||||||
|
|
||||||
export function truthy(key: string) {
|
export function truthy(key: string) {
|
||||||
const value = process.env[key]?.toLowerCase()
|
const value = envOf(key)?.toLowerCase()
|
||||||
return value === "true" || value === "1"
|
return value === "true" || value === "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
const copy = process.env["OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT"]
|
const copy = envOf("OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT")
|
||||||
|
|
||||||
function enabledByExperimental(key: string) {
|
function enabledByExperimental(key: string) {
|
||||||
return process.env[key] === undefined ? truthy("OPENCODE_EXPERIMENTAL") : truthy(key)
|
return envOf(key) === undefined ? truthy("OPENCODE_EXPERIMENTAL") : truthy(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Flag = {
|
export const Flag = {
|
||||||
@@ -16,9 +27,9 @@ export const Flag = {
|
|||||||
OTEL_EXPORTER_OTLP_HEADERS: process.env["OTEL_EXPORTER_OTLP_HEADERS"],
|
OTEL_EXPORTER_OTLP_HEADERS: process.env["OTEL_EXPORTER_OTLP_HEADERS"],
|
||||||
|
|
||||||
OPENCODE_AUTO_HEAP_SNAPSHOT: truthy("OPENCODE_AUTO_HEAP_SNAPSHOT"),
|
OPENCODE_AUTO_HEAP_SNAPSHOT: truthy("OPENCODE_AUTO_HEAP_SNAPSHOT"),
|
||||||
OPENCODE_GIT_BASH_PATH: process.env["OPENCODE_GIT_BASH_PATH"],
|
OPENCODE_GIT_BASH_PATH: envOf("OPENCODE_GIT_BASH_PATH"),
|
||||||
OPENCODE_CONFIG: process.env["OPENCODE_CONFIG"],
|
OPENCODE_CONFIG: envOf("OPENCODE_CONFIG"),
|
||||||
OPENCODE_CONFIG_CONTENT: process.env["OPENCODE_CONFIG_CONTENT"],
|
OPENCODE_CONFIG_CONTENT: envOf("OPENCODE_CONFIG_CONTENT"),
|
||||||
OPENCODE_DISABLE_AUTOUPDATE: truthy("OPENCODE_DISABLE_AUTOUPDATE"),
|
OPENCODE_DISABLE_AUTOUPDATE: truthy("OPENCODE_DISABLE_AUTOUPDATE"),
|
||||||
OPENCODE_ALWAYS_NOTIFY_UPDATE: truthy("OPENCODE_ALWAYS_NOTIFY_UPDATE"),
|
OPENCODE_ALWAYS_NOTIFY_UPDATE: truthy("OPENCODE_ALWAYS_NOTIFY_UPDATE"),
|
||||||
OPENCODE_DISABLE_PRUNE: truthy("OPENCODE_DISABLE_PRUNE"),
|
OPENCODE_DISABLE_PRUNE: truthy("OPENCODE_DISABLE_PRUNE"),
|
||||||
@@ -27,9 +38,9 @@ export const Flag = {
|
|||||||
OPENCODE_DISABLE_AUTOCOMPACT: truthy("OPENCODE_DISABLE_AUTOCOMPACT"),
|
OPENCODE_DISABLE_AUTOCOMPACT: truthy("OPENCODE_DISABLE_AUTOCOMPACT"),
|
||||||
OPENCODE_DISABLE_MODELS_FETCH: truthy("OPENCODE_DISABLE_MODELS_FETCH"),
|
OPENCODE_DISABLE_MODELS_FETCH: truthy("OPENCODE_DISABLE_MODELS_FETCH"),
|
||||||
OPENCODE_DISABLE_MOUSE: truthy("OPENCODE_DISABLE_MOUSE"),
|
OPENCODE_DISABLE_MOUSE: truthy("OPENCODE_DISABLE_MOUSE"),
|
||||||
OPENCODE_FAKE_VCS: process.env["OPENCODE_FAKE_VCS"],
|
OPENCODE_FAKE_VCS: envOf("OPENCODE_FAKE_VCS"),
|
||||||
OPENCODE_SERVER_PASSWORD: process.env["OPENCODE_SERVER_PASSWORD"],
|
OPENCODE_SERVER_PASSWORD: envOf("OPENCODE_SERVER_PASSWORD"),
|
||||||
OPENCODE_SERVER_USERNAME: process.env["OPENCODE_SERVER_USERNAME"],
|
OPENCODE_SERVER_USERNAME: envOf("OPENCODE_SERVER_USERNAME"),
|
||||||
|
|
||||||
// Experimental
|
// Experimental
|
||||||
OPENCODE_EXPERIMENTAL_FILEWATCHER: Config.boolean("OPENCODE_EXPERIMENTAL_FILEWATCHER").pipe(
|
OPENCODE_EXPERIMENTAL_FILEWATCHER: Config.boolean("OPENCODE_EXPERIMENTAL_FILEWATCHER").pipe(
|
||||||
@@ -40,11 +51,11 @@ export const Flag = {
|
|||||||
),
|
),
|
||||||
OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT:
|
OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT:
|
||||||
copy === undefined ? process.platform === "win32" : truthy("OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT"),
|
copy === undefined ? process.platform === "win32" : truthy("OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT"),
|
||||||
OPENCODE_MODELS_URL: process.env["OPENCODE_MODELS_URL"],
|
OPENCODE_MODELS_URL: envOf("OPENCODE_MODELS_URL"),
|
||||||
OPENCODE_MODELS_PATH: process.env["OPENCODE_MODELS_PATH"],
|
OPENCODE_MODELS_PATH: envOf("OPENCODE_MODELS_PATH"),
|
||||||
OPENCODE_DB: process.env["OPENCODE_DB"],
|
OPENCODE_DB: envOf("OPENCODE_DB"),
|
||||||
|
|
||||||
OPENCODE_WORKSPACE_ID: process.env["OPENCODE_WORKSPACE_ID"],
|
OPENCODE_WORKSPACE_ID: envOf("OPENCODE_WORKSPACE_ID"),
|
||||||
OPENCODE_EXPERIMENTAL_WORKSPACES: enabledByExperimental("OPENCODE_EXPERIMENTAL_WORKSPACES"),
|
OPENCODE_EXPERIMENTAL_WORKSPACES: enabledByExperimental("OPENCODE_EXPERIMENTAL_WORKSPACES"),
|
||||||
OPENCODE_EXPERIMENTAL_SESSION_SWITCHER: enabledByExperimental("OPENCODE_EXPERIMENTAL_SESSION_SWITCHER"),
|
OPENCODE_EXPERIMENTAL_SESSION_SWITCHER: enabledByExperimental("OPENCODE_EXPERIMENTAL_SESSION_SWITCHER"),
|
||||||
|
|
||||||
@@ -57,21 +68,21 @@ export const Flag = {
|
|||||||
return enabledByExperimental("OPENCODE_EXPERIMENTAL_REFERENCES")
|
return enabledByExperimental("OPENCODE_EXPERIMENTAL_REFERENCES")
|
||||||
},
|
},
|
||||||
get OPENCODE_TUI_CONFIG() {
|
get OPENCODE_TUI_CONFIG() {
|
||||||
return process.env["OPENCODE_TUI_CONFIG"]
|
return envOf("OPENCODE_TUI_CONFIG")
|
||||||
},
|
},
|
||||||
get OPENCODE_CONFIG_DIR() {
|
get OPENCODE_CONFIG_DIR() {
|
||||||
return process.env["OPENCODE_CONFIG_DIR"]
|
return envOf("OPENCODE_CONFIG_DIR")
|
||||||
},
|
},
|
||||||
get OPENCODE_PURE() {
|
get OPENCODE_PURE() {
|
||||||
return truthy("OPENCODE_PURE")
|
return truthy("OPENCODE_PURE")
|
||||||
},
|
},
|
||||||
get OPENCODE_PERMISSION() {
|
get OPENCODE_PERMISSION() {
|
||||||
return process.env["OPENCODE_PERMISSION"]
|
return envOf("OPENCODE_PERMISSION")
|
||||||
},
|
},
|
||||||
get OPENCODE_PLUGIN_META_FILE() {
|
get OPENCODE_PLUGIN_META_FILE() {
|
||||||
return process.env["OPENCODE_PLUGIN_META_FILE"]
|
return envOf("OPENCODE_PLUGIN_META_FILE")
|
||||||
},
|
},
|
||||||
get OPENCODE_CLIENT() {
|
get OPENCODE_CLIENT() {
|
||||||
return process.env["OPENCODE_CLIENT"] ?? "cli"
|
return envOf("OPENCODE_CLIENT") ?? "cli"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Context, Effect, Layer } from "effect"
|
|||||||
import { Flock } from "./util/flock"
|
import { Flock } from "./util/flock"
|
||||||
import { Flag } from "./flag/flag"
|
import { Flag } from "./flag/flag"
|
||||||
|
|
||||||
const app = "opencode"
|
const app = "zmo"
|
||||||
const data = path.join(xdgData!, app)
|
const data = path.join(xdgData!, app)
|
||||||
const cache = path.join(xdgCache!, app)
|
const cache = path.join(xdgCache!, app)
|
||||||
const config = path.join(xdgConfig!, app)
|
const config = path.join(xdgConfig!, app)
|
||||||
@@ -15,7 +15,7 @@ const tmp = path.join(os.tmpdir(), app)
|
|||||||
|
|
||||||
const paths = {
|
const paths = {
|
||||||
get home() {
|
get home() {
|
||||||
return process.env.OPENCODE_TEST_HOME ?? os.homedir()
|
return process.env.ZMO_TEST_HOME ?? process.env.OPENCODE_TEST_HOME ?? os.homedir()
|
||||||
},
|
},
|
||||||
data,
|
data,
|
||||||
bin: path.join(cache, "bin"),
|
bin: path.join(cache, "bin"),
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
"dev:temporary": "bun run --conditions=browser ./src/temporary.ts"
|
"dev:temporary": "bun run --conditions=browser ./src/temporary.ts"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"opencode": "./bin/opencode"
|
"zmo": "./bin/opencode"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
"./*": "./src/*.ts"
|
"./*": "./src/*.ts"
|
||||||
|
|||||||
@@ -179,8 +179,8 @@ for (const item of targets) {
|
|||||||
autoloadTsconfig: true,
|
autoloadTsconfig: true,
|
||||||
autoloadPackageJson: true,
|
autoloadPackageJson: true,
|
||||||
target: name.replace(pkg.name, "bun") as any,
|
target: name.replace(pkg.name, "bun") as any,
|
||||||
outfile: `dist/${name}/bin/opencode`,
|
outfile: `dist/${name}/bin/zmo`,
|
||||||
execArgv: [`--user-agent=opencode/${Script.version}`, "--use-system-ca", "--"],
|
execArgv: [`--user-agent=zmo/${Script.version}`, "--use-system-ca", "--"],
|
||||||
windows: {},
|
windows: {},
|
||||||
},
|
},
|
||||||
files: embeddedFileMap ? { "opencode-web-ui.gen.ts": embeddedFileMap } : {},
|
files: embeddedFileMap ? { "opencode-web-ui.gen.ts": embeddedFileMap } : {},
|
||||||
@@ -197,7 +197,7 @@ for (const item of targets) {
|
|||||||
|
|
||||||
// Smoke test: only run if binary is for current platform
|
// Smoke test: only run if binary is for current platform
|
||||||
if (item.os === process.platform && item.arch === process.arch && !item.abi) {
|
if (item.os === process.platform && item.arch === process.arch && !item.abi) {
|
||||||
const binaryPath = `dist/${name}/bin/opencode`
|
const binaryPath = `dist/${name}/bin/zmo`
|
||||||
console.log(`Running smoke test: ${binaryPath} --version`)
|
console.log(`Running smoke test: ${binaryPath} --version`)
|
||||||
try {
|
try {
|
||||||
const versionOutput = await $`${binaryPath} --version`.text()
|
const versionOutput = await $`${binaryPath} --version`.text()
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ async function toolError(part: ToolPart) {
|
|||||||
|
|
||||||
export const RunCommand = effectCmd({
|
export const RunCommand = effectCmd({
|
||||||
command: "run [message..]",
|
command: "run [message..]",
|
||||||
describe: "run opencode with a message",
|
describe: "run zmo with a message",
|
||||||
// --attach connects to a remote server (no local instance needed); the
|
// --attach connects to a remote server (no local instance needed); the
|
||||||
// default path runs an in-process server and needs the project instance.
|
// default path runs an in-process server and needs the project instance.
|
||||||
instance: (args) => !args.attach,
|
instance: (args) => !args.attach,
|
||||||
@@ -185,7 +185,7 @@ export const RunCommand = effectCmd({
|
|||||||
})
|
})
|
||||||
.option("attach", {
|
.option("attach", {
|
||||||
type: "string",
|
type: "string",
|
||||||
describe: "attach to a running opencode server (e.g., http://localhost:4096)",
|
describe: "attach to a running zmo server (e.g., http://localhost:4096)",
|
||||||
})
|
})
|
||||||
.option("password", {
|
.option("password", {
|
||||||
alias: ["p"],
|
alias: ["p"],
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Flag } from "@opencode-ai/core/flag/flag"
|
|||||||
export const ServeCommand = effectCmd({
|
export const ServeCommand = effectCmd({
|
||||||
command: "serve",
|
command: "serve",
|
||||||
builder: (yargs) => withNetworkOptions(yargs),
|
builder: (yargs) => withNetworkOptions(yargs),
|
||||||
describe: "starts a headless opencode server",
|
describe: "starts a headless zmo server",
|
||||||
// Server loads instances per-request via x-opencode-directory header — no
|
// Server loads instances per-request via x-opencode-directory header — no
|
||||||
// need for an ambient project InstanceContext at startup.
|
// need for an ambient project InstanceContext at startup.
|
||||||
instance: false,
|
instance: false,
|
||||||
@@ -17,7 +17,7 @@ export const ServeCommand = effectCmd({
|
|||||||
}
|
}
|
||||||
const opts = yield* resolveNetworkOptions(args)
|
const opts = yield* resolveNetworkOptions(args)
|
||||||
const server = yield* Effect.promise(() => Server.listen(opts))
|
const server = yield* Effect.promise(() => Server.listen(opts))
|
||||||
console.log(`opencode server listening on http://${server.hostname}:${server.port}`)
|
console.log(`zmo server listening on http://${server.hostname}:${server.port}`)
|
||||||
|
|
||||||
yield* Effect.never
|
yield* Effect.never
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { ServerAuth } from "@/server/auth"
|
|||||||
|
|
||||||
export const AttachCommand = cmd({
|
export const AttachCommand = cmd({
|
||||||
command: "attach <url>",
|
command: "attach <url>",
|
||||||
describe: "attach to a running opencode server",
|
describe: "attach to a running zmo server",
|
||||||
builder: (yargs) =>
|
builder: (yargs) =>
|
||||||
yargs
|
yargs
|
||||||
.positional("url", {
|
.positional("url", {
|
||||||
|
|||||||
@@ -77,12 +77,12 @@ export function resolveThreadDirectory(project?: string, envPWD = process.env.PW
|
|||||||
|
|
||||||
export const TuiThreadCommand = cmd({
|
export const TuiThreadCommand = cmd({
|
||||||
command: "$0 [project]",
|
command: "$0 [project]",
|
||||||
describe: "start opencode tui",
|
describe: "start zmo tui",
|
||||||
builder: (yargs) =>
|
builder: (yargs) =>
|
||||||
withNetworkOptions(yargs)
|
withNetworkOptions(yargs)
|
||||||
.positional("project", {
|
.positional("project", {
|
||||||
type: "string",
|
type: "string",
|
||||||
describe: "path to start opencode in",
|
describe: "path to start zmo in",
|
||||||
})
|
})
|
||||||
.option("model", {
|
.option("model", {
|
||||||
type: "string",
|
type: "string",
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ interface RemovalTargets {
|
|||||||
|
|
||||||
export const UninstallCommand = {
|
export const UninstallCommand = {
|
||||||
command: "uninstall",
|
command: "uninstall",
|
||||||
describe: "uninstall opencode and remove all related files",
|
describe: "uninstall zmo and remove all related files",
|
||||||
builder: (yargs: Argv) =>
|
builder: (yargs: Argv) =>
|
||||||
yargs
|
yargs
|
||||||
.option("keep-config", {
|
.option("keep-config", {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { InstallationVersion } from "@opencode-ai/core/installation/version"
|
|||||||
|
|
||||||
export const UpgradeCommand = {
|
export const UpgradeCommand = {
|
||||||
command: "upgrade [target]",
|
command: "upgrade [target]",
|
||||||
describe: "upgrade opencode to the latest or a specific version",
|
describe: "upgrade zmo to the latest or a specific version",
|
||||||
builder: (yargs: Argv) => {
|
builder: (yargs: Argv) => {
|
||||||
return yargs
|
return yargs
|
||||||
.positional("target", {
|
.positional("target", {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export function FormatError(input: unknown): string | undefined {
|
|||||||
// MCPFailed: { name: string }
|
// MCPFailed: { name: string }
|
||||||
if (NamedError.hasName(input, "MCPFailed")) {
|
if (NamedError.hasName(input, "MCPFailed")) {
|
||||||
const data = isRecord(input) && isRecord(input.data) ? stringField(input.data, "name") : undefined
|
const data = isRecord(input) && isRecord(input.data) ? stringField(input.data, "name") : undefined
|
||||||
return `MCP server "${data}" failed. Note, opencode does not support MCP authentication yet.`
|
return `MCP server "${data}" failed. Note, zmo does not support MCP authentication yet.`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AccountServiceError, AccountTransportError: TaggedErrorClass
|
// AccountServiceError, AccountTransportError: TaggedErrorClass
|
||||||
@@ -64,8 +64,8 @@ export function FormatError(input: unknown): string | undefined {
|
|||||||
return [
|
return [
|
||||||
`Model not found: ${stringField(providerModelNotFound, "providerID")}/${stringField(providerModelNotFound, "modelID")}`,
|
`Model not found: ${stringField(providerModelNotFound, "providerID")}/${stringField(providerModelNotFound, "modelID")}`,
|
||||||
...(suggestions.length ? ["Did you mean: " + suggestions.join(", ")] : []),
|
...(suggestions.length ? ["Did you mean: " + suggestions.join(", ")] : []),
|
||||||
`Try: \`opencode models\` to list available models`,
|
`Try: \`zmo models\` to list available models`,
|
||||||
`Or check your config (opencode.json) provider/model names`,
|
`Or check your config (zmo.json) provider/model names`,
|
||||||
].join("\n")
|
].join("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export const logo = {
|
export const logo = {
|
||||||
left: [" ", "█▀▀█ █▀▀█ █▀▀█ █▀▀▄", "█__█ █__█ █^^^ █__█", "▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀~~▀"],
|
left: ["▀▀▀▀", " ▄▀", "▄▀ ", "▄▄▄▄"],
|
||||||
right: [" ▄ ", "█▀▀▀ █▀▀█ █▀▀█ █▀▀█", "█___ █__█ █__█ █^^^", "▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀"],
|
right: ["█▄ ▄█ ▄▀▀▄", "█ ▀ █ █ █", "█ █ █ █", "█ █ ▀▄▄▀"],
|
||||||
}
|
}
|
||||||
|
|
||||||
export const go = {
|
export const go = {
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import { Schema } from "effect"
|
|||||||
import { logo as glyphs } from "./logo"
|
import { logo as glyphs } from "./logo"
|
||||||
|
|
||||||
const wordmark = [
|
const wordmark = [
|
||||||
`⠀ ▄ `,
|
`▀▀▀▀ █▄ ▄█ ▄▀▀▄`,
|
||||||
`█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█`,
|
` ▄▀ █ ▀ █ █ █`,
|
||||||
`█ █ █ █ █▀▀▀ █ █ █ █ █ █ █ █▀▀▀`,
|
`▄▀ █ █ █ █`,
|
||||||
`▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀`,
|
`▄▄▄▄ █ █ ▀▄▄▀`,
|
||||||
]
|
]
|
||||||
|
|
||||||
export class CancelledError extends Schema.TaggedErrorClass<CancelledError>()("UICancelledError", {}) {}
|
export class CancelledError extends Schema.TaggedErrorClass<CancelledError>()("UICancelledError", {}) {}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { hideBin } from "yargs/helpers"
|
|||||||
import { RunCommand } from "./cli/cmd/run"
|
import { RunCommand } from "./cli/cmd/run"
|
||||||
import { GenerateCommand } from "./cli/cmd/generate"
|
import { GenerateCommand } from "./cli/cmd/generate"
|
||||||
import * as Log from "@opencode-ai/core/util/log"
|
import * as Log from "@opencode-ai/core/util/log"
|
||||||
import { ConsoleCommand } from "./cli/cmd/account"
|
// import { ConsoleCommand } from "./cli/cmd/account" // zmo: 隐藏云账户命令
|
||||||
import { ProvidersCommand } from "./cli/cmd/providers"
|
import { ProvidersCommand } from "./cli/cmd/providers"
|
||||||
import { AgentCommand } from "./cli/cmd/agent"
|
import { AgentCommand } from "./cli/cmd/agent"
|
||||||
import { UpgradeCommand } from "./cli/cmd/upgrade"
|
import { UpgradeCommand } from "./cli/cmd/upgrade"
|
||||||
@@ -15,20 +15,20 @@ import { InstallationVersion } from "@opencode-ai/core/installation/version"
|
|||||||
import { NamedError } from "@opencode-ai/core/util/error"
|
import { NamedError } from "@opencode-ai/core/util/error"
|
||||||
import { FormatError } from "./cli/error"
|
import { FormatError } from "./cli/error"
|
||||||
import { ServeCommand } from "./cli/cmd/serve"
|
import { ServeCommand } from "./cli/cmd/serve"
|
||||||
import { DebugCommand } from "./cli/cmd/debug"
|
// import { DebugCommand } from "./cli/cmd/debug" // zmo: 隐藏 debug 命令
|
||||||
import { StatsCommand } from "./cli/cmd/stats"
|
// import { StatsCommand } from "./cli/cmd/stats" // zmo: 隐藏统计命令
|
||||||
import { McpCommand } from "./cli/cmd/mcp"
|
import { McpCommand } from "./cli/cmd/mcp"
|
||||||
import { GithubCommand } from "./cli/cmd/github"
|
// import { GithubCommand } from "./cli/cmd/github" // zmo: 隐藏 github 命令
|
||||||
import { ExportCommand } from "./cli/cmd/export"
|
// import { ExportCommand } from "./cli/cmd/export" // zmo: 隐藏导出命令
|
||||||
import { ImportCommand } from "./cli/cmd/import"
|
// import { ImportCommand } from "./cli/cmd/import" // zmo: 隐藏导入命令
|
||||||
import { AttachCommand } from "./cli/cmd/tui/attach"
|
import { AttachCommand } from "./cli/cmd/tui/attach"
|
||||||
import { TuiThreadCommand } from "./cli/cmd/tui/thread"
|
import { TuiThreadCommand } from "./cli/cmd/tui/thread"
|
||||||
import { AcpCommand } from "./cli/cmd/acp"
|
import { AcpCommand } from "./cli/cmd/acp"
|
||||||
import { EOL } from "os"
|
import { EOL } from "os"
|
||||||
import { WebCommand } from "./cli/cmd/web"
|
// import { WebCommand } from "./cli/cmd/web" // zmo: 隐藏 web 命令
|
||||||
import { PrCommand } from "./cli/cmd/pr"
|
// import { PrCommand } from "./cli/cmd/pr" // zmo: 隐藏 pr 命令
|
||||||
import { SessionCommand } from "./cli/cmd/session"
|
import { SessionCommand } from "./cli/cmd/session"
|
||||||
import { DbCommand } from "./cli/cmd/db"
|
// import { DbCommand } from "./cli/cmd/db" // zmo: 隐藏 db 命令
|
||||||
import { errorMessage } from "./util/error"
|
import { errorMessage } from "./util/error"
|
||||||
import { PluginCommand } from "./cli/cmd/plug"
|
import { PluginCommand } from "./cli/cmd/plug"
|
||||||
import { Heap } from "./cli/heap"
|
import { Heap } from "./cli/heap"
|
||||||
@@ -53,7 +53,7 @@ const args = hideBin(process.argv)
|
|||||||
|
|
||||||
function show(out: string) {
|
function show(out: string) {
|
||||||
const text = out.trimStart()
|
const text = out.trimStart()
|
||||||
if (!text.startsWith("opencode ")) {
|
if (!text.startsWith("zmo ")) {
|
||||||
process.stderr.write(UI.logo() + EOL + EOL)
|
process.stderr.write(UI.logo() + EOL + EOL)
|
||||||
process.stderr.write(text)
|
process.stderr.write(text)
|
||||||
return
|
return
|
||||||
@@ -63,7 +63,7 @@ function show(out: string) {
|
|||||||
|
|
||||||
const cli = yargs(args)
|
const cli = yargs(args)
|
||||||
.parserConfiguration({ "populate--": true })
|
.parserConfiguration({ "populate--": true })
|
||||||
.scriptName("opencode")
|
.scriptName("zmo")
|
||||||
.wrap(100)
|
.wrap(100)
|
||||||
.help("help", "show help")
|
.help("help", "show help")
|
||||||
.alias("help", "h")
|
.alias("help", "h")
|
||||||
@@ -102,6 +102,8 @@ const cli = yargs(args)
|
|||||||
process.env.AGENT = "1"
|
process.env.AGENT = "1"
|
||||||
process.env.OPENCODE = "1"
|
process.env.OPENCODE = "1"
|
||||||
process.env.OPENCODE_PID = String(process.pid)
|
process.env.OPENCODE_PID = String(process.pid)
|
||||||
|
process.env.ZMO = "1"
|
||||||
|
process.env.ZMO_PID = String(process.pid)
|
||||||
|
|
||||||
Log.Default.info("opencode", {
|
Log.Default.info("opencode", {
|
||||||
version: InstallationVersion,
|
version: InstallationVersion,
|
||||||
@@ -118,23 +120,14 @@ const cli = yargs(args)
|
|||||||
.command(AttachCommand)
|
.command(AttachCommand)
|
||||||
.command(RunCommand)
|
.command(RunCommand)
|
||||||
.command(GenerateCommand)
|
.command(GenerateCommand)
|
||||||
.command(DebugCommand)
|
|
||||||
.command(ConsoleCommand)
|
|
||||||
.command(ProvidersCommand)
|
.command(ProvidersCommand)
|
||||||
.command(AgentCommand)
|
.command(AgentCommand)
|
||||||
.command(UpgradeCommand)
|
.command(UpgradeCommand)
|
||||||
.command(UninstallCommand)
|
.command(UninstallCommand)
|
||||||
.command(ServeCommand)
|
.command(ServeCommand)
|
||||||
.command(WebCommand)
|
|
||||||
.command(ModelsCommand)
|
.command(ModelsCommand)
|
||||||
.command(StatsCommand)
|
|
||||||
.command(ExportCommand)
|
|
||||||
.command(ImportCommand)
|
|
||||||
.command(GithubCommand)
|
|
||||||
.command(PrCommand)
|
|
||||||
.command(SessionCommand)
|
.command(SessionCommand)
|
||||||
.command(PluginCommand)
|
.command(PluginCommand)
|
||||||
.command(DbCommand)
|
|
||||||
.fail((msg, err) => {
|
.fail((msg, err) => {
|
||||||
if (
|
if (
|
||||||
msg?.startsWith("Unknown argument") ||
|
msg?.startsWith("Unknown argument") ||
|
||||||
|
|||||||
Reference in New Issue
Block a user