407 Commits

Author SHA1 Message Date
gujieye 07875c309e Merge pull request #77 from modelstudioai/feat/auto-update
feat: auto-update CLI on major version gap
2026-06-30 14:15:45 +08:00
故璃 7d05649f8d Merge branch 'main' into feat/auto-update 2026-06-30 14:13:29 +08:00
gujieye fd9bba77a9 Merge pull request #80 from modelstudioai/feat/model-train
feat: add model finetune/deploy/dataset commend to support one step model training by Agent
2026-06-30 14:12:40 +08:00
故璃 0593c7eb28 Merge branch 'main' into feat/model-train 2026-06-30 14:10:47 +08:00
zeyu.fz 7c9ad7d6ce feat(packages): 添加 runtime 和 commands 包配置
- 在包列表中新增 runtime 包配置
- 在包列表中新增 commands 包配置
- 确保新包路径和名称正确设置
2026-06-29 18:18:44 +08:00
若麒 ae88f7a4ad refactor(runtime): group process-lifecycle setup into installProcessHandlers 2026-06-29 16:08:14 +08:00
若麒 bd431d769f feat(update-checker): surface update notice to non-TTY/agent runs
- drop the CI / non-TTY early-return so agents see "Update available" too
- widen check interval 4h→24h; stay silent inside the window (no per-command repeat)
- remove orphan isCI() helper (zero callers)
- versioning.md: drop the now-false "banner suppressed under agent" rationale
2026-06-29 15:45:34 +08:00
若麒 df89ededc2 test(e2e): align with UsageError validation contract
Missing required flags now throw UsageError (exit code 2, error on
stderr, JSON under --output json) instead of printing help and exiting
0. Update assertions and titles accordingly:

- missing-flag cases: exitCode 0/1 -> 2, retitle to "errors as usage error (2)"
- auth / video-task-get under --output json: assert the error JSON on stderr
- proxy probe: import setupProxyFromEnv from runtime/src/proxy.ts
- drop tests for the removed config export-schema command
- fix t2v dry-run: cliTimeoutPrefix misplaced between --model and its value
2026-06-29 14:53:24 +08:00
zeyu.fz 2ec2f34763 feat(cli): 支持多模态消息内容及图片URL数组
- 扩展聊天消息内容类型,支持文本和图片URL的数组形式
- 处理 --image 参数,将图片URL作为多模态内容附加到最后一条用户消息
- 若无用户消息且指定图片URL,自动创建空用户消息以承载图片内容
- 禁止同时使用内嵌图片内容和 --image 参数,避免冲突
- 将知识搜索接口请求的图片参数字段 image_list 重命名为 images
- 单元测试覆盖多模态内容及图片数组行为验证
- 优化消息解析,支持JSON结构化消息和 role:content 格式
- 更新API类型声明,明确多模态消息结构与字段类型
2026-06-29 13:36:32 +08:00
若麒 1f56feab24 refactor(commands): route all exits through the central error handler
Commands no longer call process.exit() directly. Every failure now throws
UsageError (bad input → exit 2) or BailianError (runtime failure, with
AUTH/TIMEOUT codes), so the runtime's handleError stays the single exit
point and telemetry always flushes.

- convert 27 process.exit() sites across 15 commands to throws
- move cross-flag/value checks into validate(); use flag `choices` for
  --events / --sort; drop dead --model required check
- keep pipeline's process.exitCode for lint-style soft failures
- enforce with unicorn/no-process-exit, allowed only in runtime/tools/tests
- fix incidental lint: void floating run(), narrow console errorCode,
  align generate-reference type imports to source
2026-06-29 09:07:12 +08:00
若麒 2f9558c161 refactor(auth): remove deprecated AK/SK auth for knowledge retrieve
AK/SK signing was used only by `knowledge retrieve`'s deprecated fallback,
which the api-key auth gate now makes unreachable. Drop it; the command is
pure api-key.

- knowledge/retrieve: remove the AK/SK path + --access-key-id/secret/workspace-id
  flags; api-key only
- delete client/ak-sign.ts and its signRequest/AkSignConfig exports
- drop access_key_id/access_key_secret from config schema, loader, and
  `config show` / `config set`
- remove the now-unused PascalCase KnowledgeRetrieve request/response types
2026-06-28 22:24:59 +08:00
若麒 95eb07d04a refactor(auth): centralize credential resolution into authStage + Client
Move all credential handling out of commands into one place. authStage
resolves the credential for the command's declared `auth` and bakes it into
`ctx.client`, gating (throw) when missing; commands reach the network only
through `ctx.client` and never touch tokens or baseUrl.

- add Client (request/requestJson/uploadFile/mcp/console/url) wrapping the
  token + baseUrl; commands call it instead of self-resolving
- run(config, flags) → run(ctx) + CommandContext; migrate all 45 commands
- split domains: model = pure api-key (drop access-token fallback), console =
  config.json only (drop DASHSCOPE_ACCESS_TOKEN env)
- consolidate env reads in loadConfig; CredentialSource = flag | env | config;
  priority flag > env > config
- endpoints return paths (xxxPath) instead of full URLs; baseUrl owned by Client
- auth status now uses describeAuth
- video/download: auth "none" → "apiKey" (it needs the model API)
- dedupe fetchModelList behind an injected console-call function
- remove ensureApiKey/ensure-key.ts, prompt.ts + isInteractive, and the old
  resolveCredential/resolveConsoleGatewayCredential resolvers
- tests: adapt auth.e2e to the new auth status shape; drop the
  DASHSCOPE_ACCESS_TOKEN branch from console-readiness gates
2026-06-28 20:42:33 +08:00
若麒 f9bf36c242 refactor(flags): keyed type-inferred flag schema; option→flag rename
Replace the positional `OptionDef[]` array (key/type regex-parsed from
"--x <v>" strings) with a keyed `FlagsDef` record whose `type` drives both
runtime parsing and compile-time flag-type inference (`Flags<typeof DEF>`).
GLOBAL_FLAGS becomes the single source; the hand-kept GlobalFlags interface
(types/flags.ts) is deleted.

- core: SwitchFlag|ValueFlag union, ParsedFlags/Flags inference, defineCommand
  infers F from spec.flags
- runtime: parseFlags dispatches on def.type (switch/string/number/boolean/
  array/choices) with declarative required-flag enforcement
- commands: migrate every flag declaration to the keyed form
- naming: option→flag throughout (OptionDef→FlagDef, OptionsDef→FlagsDef,
  GLOBAL_OPTIONS→GLOBAL_FLAGS, command field options→flags), plus user-facing
  "Options:"→"Flags:" in help and the regenerated skill reference docs

Behavior-preserving aside from the intentional Options→Flags wording:
vp check clean across all packages, 29 parser tests pass, reference regen
byte-identical before the terminology swap.
2026-06-28 11:19:21 +08:00
若麒 cbd3c1232c refactor(runtime): unify validation into UsageError; bare command shows help
- drop IncompleteCommandError: missing-required, failed validate, and bad/unknown
  flags are all UsageError now
- error boundary keys on bareness — bare command that fails → help (exit 0);
  non-bare invalid → error + message (exit 2)
- login: drop config.apiKey fallback, --api-key required-unless-console via validate
- speech: drop empty --text-file guard (empty content is the API's concern)
2026-06-27 10:56:28 +08:00
zeyu.fz d2aa8cac17 docs(cli): 统一所有参考文档表格格式及添加全局参数说明
- 统一调整所有命令参考文档中的表格格式,使用简洁markdown表格语法替换旧格式
- 规范所有命令详情中的字段表头格式,保持一致性
- 在索引中添加全局参数列表,列出所有命令通用的全局标志选项
- 修正配置键名称中的小错误(例如base_url写法统一)
- 优化目录索引部分格式,更加规范排列和对齐
- 未改变命令内容及描述,保证文档信息一致性
2026-06-26 19:15:26 +08:00
zeyu.fz ead1bc0f5f refactor(release): 重构发布流程并合并知识库发布逻辑
- 删除独立的 publish-knowledge.yml 工作流
- 在 publish.yml 中新增 package 选择,支持 bailian-cli 和 knowledge-studio-cli
- 发布脚本根据 package 参数传递 --knowledge 标志
- 修改发布任务并发组以包含 package 参数,避免冲突
- 调整发布稳定版与频道版任务名称显示 package 信息
- 精简发布依赖顺序注释,去除冗余部分
- 优化构建步骤,仅构建 bailian-cli-core 包
- 更新包管理代码,整合知识库相关包到统一发布流程
2026-06-26 18:12:35 +08:00
clark-fc c303b51b9e Merge pull request #82 from modelstudioai/feat/knowledge-publish-ci
refactor(ci): 合并知识库发布流程并支持多包发布
2026-06-26 18:04:07 +08:00
zeyu.fz 780ca6addb refactor(ci): 合并知识库发布流程并支持多包发布
- 删除了单独的 publish-knowledge.yml 工作流
- 在 publish.yml 中添加 package 输入以支持多包发布
- 根据 package 选择性传递 --knowledge 标志给发布脚本
- 更新并重命名发布任务以反映 package 区别
- 修改并扩展并发组以包含 package 维度
- 注释更新,说明 knowledge-studio-cli 通过主工作流发布并共享依赖
2026-06-26 18:01:58 +08:00
clark-fc 3375fca2f8 Merge pull request #81 from modelstudioai/feat/knowledge-publish-ci
feat(release): add --knowledge flag and publish-knowledge.yml workflow
2026-06-26 17:23:33 +08:00
zeyu.fz a966b4077f feat(release): add --knowledge flag and publish-knowledge.yml workflow
- packages.mjs: export KSCLI_PACKAGE and ALL_PACKAGES for knowledge-studio-cli
- check.mjs: support knowledge option to build/validate kscli
- validate.mjs: accept packages param, validate all packages in lockstep
- pack-scan.mjs: accept packages param
- publish-stable.mjs: refactor to iterate PACKAGES array; add --knowledge flag
- publish-channel.mjs: refactor to iterate PACKAGES array; add --knowledge flag
- New workflow publish-knowledge.yml: triggers publish with --knowledge flag

The original publish.yml (without --knowledge) publishes only core + cli.
The new publish-knowledge.yml publishes core + cli + knowledge-studio-cli.
2026-06-26 17:20:25 +08:00
zeyu.fz 4745d70587 feat(release): 支持 knowledge-studio-cli 的构建与发布流程
- 新增发布工作流 publish-knowledge.yml,支持 stable 和 channel 模式发布含 knowledge 的包
- runCheck 函数增加 knowledge 参数,支持同时构建和验证 knowledge-studio-cli 包
- publish-stable 和 publish-channel 脚本支持传入 knowledge 参数,调整发布的包列表
- packAndScan 函数支持指定发布包列表,增强灵活性
- 扩展 packages 模块,新增 ALL_PACKAGES 常量包含所有包(基础包加 knowledge-studio-cli)
- loadAndValidate
2026-06-26 16:53:59 +08:00
若麒 91e6c6f553 refactor(runtime): resolve/middleware kernel + declarative arg validation
把 main 从一堆 if + process.exit 重构为「argv 解析成数据 → 交给统一管线执行」。

内核
- resolve(argv) → Resolution(version/help/run/usageError):路由即数据,dispatch 只 switch
- compose 洋葱中间件 (versionCheck/telemetry/auth/runCommand),命令仍收 (config, flags)
- registry.locate() 统一 leaf/group/unknown,取代 isGroupPath + 抛异常的 resolve
- 删除 command-help.ts 全局可变单例:help 渲染收口到错误边界

错误模型
- 新增 UsageError(写错了 → exit 2) 与 IncompleteCommandError(没写完 → 打 help、exit 0)
- version / help / onboarding / 组帮助统一由 resolve 产出、dispatch 分派

参数与校验
- parseFlags 重写:无 positional、新增 switch 类型、值/类型/重复校验
- 无条件必填 → 解析器声明式强制 (OptionDef.required)
- 跨 flag / 条件约束 → 新增 command.validate(flags) 钩子
  (text-chat / search-web / speech / vision / video-ref)
- 移除全部交互式输入 (promptText/Select/Confirm),缺输入直接打 help

输出
- detectOutputFormat 默认 text,不再按 TTY 切 json

测试
- 删除 3 个 stale cli 测试,runtime 单测重写 (29 passed),e2e 适配新行为
2026-06-26 16:50:12 +08:00
zeyu.fz eaa6b07c7d build(kscli): 构建并发布 knowledge-studio-cli 包
- 将 knowledge-studio-cli 版本更新至 1.4.0
- 在发布脚本中新增 knowledge-studio-cli 构建步骤
- 更新包依赖顺序,加入 knowledge-studio-cli 包
- 确保知识库检索相关 CLI 正确构建发布
2026-06-26 16:24:17 +08:00
zeyu.fz ca69316446 feat(cli): 新增 knowledge search 和 knowledge chat 命令支持
- 在 CLI 命令中添加 knowledgeSearch 和 knowledgeChat 两个新命令
- 新增 knowledge 搜索命令,支持多模态图像检索及对话历史上下文传递
- 新增 knowledge 问答命令,支持多轮消息流式回答及多模态输入
- 在核心客户端库(core)中添加对应的 API 端点和类型定义
- 知识库检索接口 retrieve 标注为弃用,推荐使用 search 命令替代
- 更新 kscli 主程序入口,接入新命令并兼容旧命令
- 补充 e2e 测试覆盖 knowledge search 和 knowledge chat 的各类边界与流程
- 更新文档及命令示例,实现使用说明同步最新功能
- 增加测试配置,改善 E2E 测试环境与超时设置
2026-06-26 15:52:44 +08:00
若麒 9c8fe96a1f build(release): publish runtime + commands alongside core/cli; minify library builds 2026-06-26 14:17:27 +08:00
故璃 18d5c420df feat: add cpt dataset type 2026-06-25 19:59:17 +08:00
故璃 9ad85b6278 fix: test issue 2026-06-25 19:26:55 +08:00
故璃 82bdf9ed78 fix: resolve cr issue 2026-06-25 17:48:52 +08:00
故璃 4383eeb416 fix: fix variable name 2026-06-25 16:16:55 +08:00
zeyu.fz 46d8474ec1 feat(kscli): 新增 Knowledge Studio CLI 轻量级 RAG 命令行工具
- 用于阿里云 Model Studio 的知识库检索,支持 RAG(检索增强生成)场景
- 提供配置查看与设置、知识库检索、自更新功能
- 替换原 rag 子包,移除 rag 相关代码及配置
- 新增独立 package,包含完整的构建、启动和发布配置
- 添加详细的中英文 README 文档说明安装、使用与认证方式
- 配置 TypeScript 和 Vite 构建支持,确保开发体验和构建质量
- 更新根 package.json 脚本,将 rag dev 命令替换为 kscli dev
- 新增 Git 忽略文件,排除日志、构建输出等无关文件
2026-06-25 15:08:35 +08:00
故璃 1851ec85f0 feat: sync readme 2026-06-25 14:22:26 +08:00
故璃 0797b0767f Merge branch 'main' into feat/model-train 2026-06-25 14:02:23 +08:00
故璃 17f4454df4 feat: refact validator to support dpo dataset 2026-06-25 13:56:15 +08:00
故璃 e67615eabd feat: auto update 2026-06-24 20:50:30 +08:00
ls 39513200bc Merge pull request #79 from modelstudioai/token-plan-openapi
Token plan openapi
2026-06-24 17:39:00 +08:00
ls 7b5bb1c341 Merge pull request #76 from budiga/token-plan-openapi
Token plan openapi
2026-06-24 17:38:25 +08:00
故璃 e0a7c86f05 feat: update doc 2026-06-24 17:29:12 +08:00
ls 908439e3f9 Merge pull request #75 from modelstudioai/token-plan-openapi
feat(token-plan): add Token Plan organization & seats commands
2026-06-24 17:28:22 +08:00
若麒 7a0a083b2e refactor(core): replace skipDefaultApiKeySetup with required auth field
Commands now declare their credential requirement explicitly via a
required `auth: "apiKey" | "console" | "none"` field instead of the
boolean `skipDefaultApiKeySetup`. The runtime prepares credentials
based on this declaration and skips API-key setup under --dry-run.

- core: add AuthRequirement type and required `auth` field to
  Command/CommandSpec; drop skipDefaultApiKeySetup
- runtime: gate API-key setup on `auth === "apiKey" && !dryRun`
- commands: annotate all 45 commands (apiKey 25 / console 11 / none 9)
2026-06-24 16:41:09 +08:00
若麒 61689ec0da build: jump to source across packages via @bailian-cli/source export condition 2026-06-24 16:14:20 +08:00
雷骏 ba78d13a52 feat: add auto update cli 2026-06-24 15:31:24 +08:00
若麒 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
故璃 cbffe6c541 Merge branch 'main' into feat/model-train 2026-06-24 14:19:58 +08:00
故璃 d567d6af0c feat: setup model train/deploy cli commend 2026-06-24 14:01:28 +08:00
wb-liuxuehuan 33b1df01cc Merge remote-tracking branch 'upstream/token-plan-openapi' into token-plan-openapi 2026-06-24 13:02:35 +08:00
lisheng.lisheng 0ba705f194 refactor(token-plan): rename top-level command tokenplan -> token-plan
Rename the public command group from `bl tokenplan` to `bl token-plan`
for kebab-case consistency. Source directory and reference doc renamed
accordingly; remote API paths (/tokenplan/...) and internal TS
identifiers are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-24 12:48:19 +08:00
wb-liuxuehuan 23d409f9ff Merge remote-tracking branch 'upstream/token-plan-openapi' into token-plan-openapi 2026-06-24 12:46:53 +08:00
wb-liuxuehuan 70ccc6a447 feat(tokenplan): 修改Token Plan 命令名称及相关优化
新增 `token-plan` 相关命令,包括 `add-member`、`assign-seats`、`create-key` 和 `list-seats`,支持管理 Token Plan 组织成员和 API 密钥。更新了命令的参数处理逻辑,确保对输入参数的验证更加严格,提升了代码的可读性和健壮性。同时,更新了相关文档,提供使用示例和参数说明。
2026-06-24 12:44:14 +08:00
lisheng.lisheng b7fba7679e chore: update Node.js version to 24 2026-06-24 12:34:43 +08:00
ls 88e5b903bc Merge pull request #74 from budiga/token-plan-openapi
Token plan openapi
2026-06-24 12:33:51 +08:00