Files
modelstudioai__cli/packages/rag/src/main.ts
T
若麒 24abdbf450 refactor(commands): decouple command paths from binary name; drop path presets
Commands no longer hardcode "bl" or their path — the runtime renders the
`<bin> <path>` prefix from each product's registry key, so shared commands
show `bl knowledge retrieve` / `rag retrieve` from one codebase. commands
package now exports only individual commands (no groups/catalog); bl and rag
each spell out their own path map. Also removes the unused export-schema command.
2026-06-24 14:40:08 +08:00

51 lines
1.4 KiB
TypeScript

import { createCli } from "bailian-cli-runtime";
import type { Command } from "bailian-cli-core";
import {
authLogin,
authStatus,
authLogout,
configShow,
configSet,
update,
fileUpload,
usageFree,
usageFreetier,
usageStats,
quotaList,
quotaRequest,
quotaHistory,
quotaCheck,
knowledgeRetrieve,
} from "bailian-cli-commands";
import pkg from "../package.json" with { type: "json" };
// rag-cli: knowledge-base product. Ships the base infrastructure commands
// (auth, config, usage, quota, update, file upload) plus knowledge retrieval,
// remapped to a flat `rag retrieve` path. Routing is driven entirely by these
// keys, and usage/examples/errors render the path from the key — so the same
// shared command shows `rag retrieve` here and `bl knowledge retrieve` in bl.
const commands: Record<string, Command> = {
"auth login": authLogin,
"auth status": authStatus,
"auth logout": authLogout,
"config show": configShow,
"config set": configSet,
update,
"file upload": fileUpload,
"usage free": usageFree,
"usage freetier": usageFreetier,
"usage stats": usageStats,
"quota list": quotaList,
"quota request": quotaRequest,
"quota history": quotaHistory,
"quota check": quotaCheck,
retrieve: knowledgeRetrieve,
};
createCli(commands, {
binName: "rag",
version: pkg.version,
clientName: "rag-cli",
npmPackage: "bailian-cli-rag",
}).run();