585 Commits

Author SHA1 Message Date
若麒 deab3b3841 refactor(flags): scope credential flags by command auth domain
- flags split into GLOBAL_FLAGS (all commands) plus MODEL_AUTH_FLAGS /
  CONSOLE_AUTH_FLAGS, parsed only for commands of the matching auth
  domain; cross-domain flags now fail with "Unknown flag" instead of
  being silently ignored
- all shadow redeclarations removed; the registry guard now rejects any
  own flag named after a reserved (global or visible-domain) flag
- --workspace-id joins the console domain (chain: flag > env > file);
  usage stats drops its private declaration and in-command priority
- auth login declares its credential args as own command parameters
  (--api-key / --base-url / --console-site, original behavior intact);
  auth status no longer accepts credential-domain overrides (use env or
  config set instead)
- command help and the generated reference both show Flags (own + auth
  domain) plus a full Global Flags section, replacing the footer hint
- breaking: pipeline run --timeout renamed to --step-timeout (collided
  with the global request timeout)
2026-07-06 17:42:11 +08:00
若麒 d31b7f83ca refactor(core): split god Config into Identity/Settings/Credential resolved at the dispatch boundary
- commands consume a narrowed context (identity/settings/own flags/client);
  config/auth commands additionally use configStore()/authStore() accessors
- resolution happens once at dispatch: buildSources/buildSettings plus
  per-domain credential resolvers; dry-run tolerates missing credentials
- transport takes structured deps; credentials are injected only by Client;
  console gateway takes a resolved target with optional token (anonymous
  catalog calls); pipeline steps and advisor run against client/settings
- telemetry receives authMethod as a value; global/command flags are split
  at dispatch with a same-type shadowing guard at registry build
- behavior change: base URL resolution now prefers DASHSCOPE_BASE_URL env
  over config file base_url (unified flag > env > file > default chain)
- priority chains, store semantics and command capability boundaries are
  locked by unit tests
2026-07-06 15:59:33 +08:00
gujieye 7b08b8863e Merge pull request #88 from modelstudioai/feat/update-recommend
feat: update model recommend by using intent model & using soft / hard score in model recall
2026-07-06 14:03:23 +08:00
故璃 d118875772 Merge branch 'main' into feat/update-recommend 2026-07-06 13:40:41 +08:00
故璃 d2312847eb feat: update model recommend 2026-07-06 13:40:00 +08:00
clark-fc b5f2b8b691 Merge pull request #87 from modelstudioai/feat/update-version
Feat/update version
v1.6.1
2026-07-03 18:19:54 +08:00
qcq01083097 acfbc58516 feat: update skill version to 1.6.1 2026-07-03 18:15:53 +08:00
qcq01083097 e4849224c4 feat: update version to 1.6.1 2026-07-03 18:12:51 +08:00
clark-fc 3aa08e5d79 Merge pull request #86 from modelstudioai/feat/change-model
feat: change vision describe example model
2026-07-03 17:52:02 +08:00
qcq01083097 4914c5258b feat: change vision describe example model 2026-07-03 16:23:50 +08:00
clark-fc a20ab54406 Merge pull request #85 from modelstudioai/feat/knowledge-cli
Feat/knowledge cli
v1.6.0
2026-07-02 16:45:13 +08:00
zeyu.fz e6a8bf09e7 test(knowledge): 添加条件跳过无法执行的e2e错误场景测试
- 根据isDashScopeE2EReady函数动态跳过错误场景测试集
- 修改测试注释明确标注环境变量可能泄露风险
- 将BAILIAN_CONFIG_DIR改为固定临时目录路径以稳定测试
- 在知识检索命令新增dry-run支持,绕过凭证直接使用API-KEY路径执行请求体输出
2026-07-02 16:42:52 +08:00
zeyu.fz c6426e9e94 test(cli): 更新测试用例以模拟空环境变量场景
- 在 knowledge chat 相关测试中加入 BAILIAN_WORKSPACE_ID 为空的环境变量模拟
- 在 knowledge search 相关测试中加入 BAILIAN_WORKSPACE_ID 为空的环境变量模拟
- 将 knowledge 相关测试中的部分环境变量由 undefined 改为空字符串以更准确模拟环境场景
- 保持测试逻辑不变,确保非零退出码及错误提示的正确性
2026-07-02 16:31:00 +08:00
zeyu.fz 03541b4fd1 test(e2e): 移除多处测试调试信息并优化 runCli 调用参数
- 从 file-upload.e2e.test.ts 中删除无用的调试日志代码
- global-setup.ts 中清理环境变量调试打印信息
- knowledge-chat.e2e.test.ts 和 knowledge-search.e2e.test.ts 中去除多余的环境变量传入
- knowledge.e2e.test.ts 中调整 runCli 调用,统一简化测试参数
- commands/knowledge 下 chat.ts 与 search.ts 增加 skipDefaultApiKeySetup 标记,避免默认 API Key 初始化
2026-07-02 16:28:42 +08:00
zeyu.fz 6dd206eda9 debug(cli): 增加文件上传测试对配置文件读取的调试日志
- 添加对用户主目录下配置文件路径的打印和存在性检查
- 打印环境变量 HOME 及 BAILIAN_CONFIG_DIR 的值
- 调用 readConfigFile 并打印返回内容及 api_key 相关信息
- 捕获并打印 readConfigFile 的异常信息
- 如果配置文件存在,读取并打印其原始内容
- 保留现有环境变量和功能状态的调试输出
2026-07-02 16:08:36 +08:00
zeyu.fz e2efcfda77 test(cli): 添加文件上传E2E测试的环境变量调试信息
- 引入 isBailianE2EEnabled 方法用于调试
- 在 worker 进程中打印关键环境变量 DASHSCOPE_API_KEY
- 打印 isDashScopeE2EReady 与 isBailianE2EEnabled 的返回结果
- 方便排查文件上传相关E2E测试环境状态问题
2026-07-02 15:58:14 +08:00
zeyu.fz a078670445 Merge remote-tracking branch 'origin/feat/composable-cli' into feat/knowledge-cli 2026-07-02 15:51:40 +08:00
zeyu.fz 8fc2fc54fb test(e2e): 添加全局设置调试日志,排查CI环境变量问题
- 增加日志输出,详细打印CI环境中的关键变量值
- 检查并打印本地配置文件内容及其API Key长度
- 引入新的辅助函数,支持更全面的环境就绪状态检测
- 提升对DashScope和Console等E2E测试环境的诊断能力
- 便于排查CI中DASHSCOPE_API_KEY及相关环境变量的来源和状态
2026-07-02 15:49:48 +08:00
zeyu.fz 9bf6c6d9af refactor(release): 移除未使用的导入以简化代码
- 从 publish-stable.mjs 中删除了未使用的 findPackage 导入
- 仅保留 ALL_PACKAGES 和 PACKAGES 的导入
- 提升代码的清晰度和维护性
2026-07-02 15:36:48 +08:00
zeyu.fz 892ae300ae feat(knowledge): 新增基于 workspace 的知识库语义检索与问答功能
- 新增 `bl knowledge search` 命令,支持语义检索及多模态检索参数
- 新增 `bl knowledge chat` 命令,支持知识库 SSE 流式问答及多轮历史对话
- 在 `bailian-cli-core` 中添加相应的知识 API 类型和端点支持
- `kscli` 新增 `search` 和 `chat` 两个命令,`retrieve` 标记为废弃
- 更新 `kscli` README,调整主推命令并标记 `retrieve` 废弃
- 补充完善 E2E 测试覆盖检索与问答功能的多种用例
- 修正若干缺少必要参数时的 CLI 行为,确保打印帮助并正常退出
- 升级各相关包版本至 1.6.0,更新 CHANGELOG 及相关文档说明
2026-07-02 15:19:38 +08:00
zeyu.fz 6c4f31ddb2 test(e2e): 删除kscli的chat和search端到端测试
- 移除chat命令的多种输出模式测试(JSON、文本、流模式)
- 删除多轮对话上下文感知回答的测试用例
- 删除chat命令无效agent_id时的容错测试
- 移除search命令的JSON和文本模式搜索测试
- 删除带查询历史的搜索功能测试
- 删除search命令无效agent_id时的错误处理测试
- 清理与测试相关的类型定义和辅助函数调用
2026-07-02 14:38:20 +08:00
zeyu.fz 9ff8c53d53 feat: merge 2026-07-02 14:22:50 +08:00
Gong Shiqi a8652f350d Merge pull request #84 from modelstudioai/chore/kscli-version-1.5.0
chore(release): align knowledge-studio-cli to 1.5.0
v1.5.0
2026-07-01 16:08:40 +08:00
若麒 b1a0c0005d chore(release): align knowledge-studio-cli to 1.5.0
kscli joins the family lockstep version so the --knowledge stable publish
passes (validate.mjs asserts every package in ALL_PACKAGES matches
bailian-cli-core). Was 0.0.1, which blocked publish-stable --knowledge.
2026-07-01 16:06:20 +08:00
Gong Shiqi f597b94c46 Merge pull request #83 from modelstudioai/feat/composable-cli
Release 1.5.0: finetune / deploy / dataset / token-plan + composable CLI
2026-07-01 15:54:13 +08:00
若麒 750641dd0e chore(release): 1.5.0 2026-07-01 14:22:17 +08:00
若麒 11ed19723a fix(kscli): build entry key rag→kscli to fix publint path mismatch 2026-06-30 23:23:32 +08:00
若麒 848e44eb44 Merge branch 'main' into feat/composable-cli 2026-06-30 23:07:18 +08:00
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