feat(tokenless): add init command for community onboarding - #2264
feat(tokenless): add init command for community onboarding#2264Forrest-ly wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
[P1] tokenless init --list 行为与“仅列出状态”预期不完全一致,当前实现仍输出安装提示,建议简化为纯状态输出并将安装引导留给交互模式与显式安装命令。
[P2] run_install 在脚本失败时只暴露退出码而不包含 stderr,用户难以根据 CLI 输出定位安装问题,建议在错误消息中附加脚本输出。
[P2] 文档中新加入的 tokenless init 用法未描述适配器目录缺失时的错误与引导命令,建议在中英文用户指南中补充一句说明增强自助排错能力。
🤖 Generated by Qoder • View workflow run
| if list_only { | ||
| print_install_hints(); |
There was a problem hiding this comment.
[P1] --list 模式仍打印安装提示,易混淆
src/tokenless/crates/tokenless-cli/src/init.rs 第252-255行:list_only 分支调用 print_install_hints() 并返回。该子命令语义为“仅列出状态不进行安装”,但仍输出安装提示文案,可能让用户误以为会执行安装或需要额外操作,破坏文档对 --list 的直观说明。建议 --list 模式只打印状态与目录信息,不再输出安装提示,将安装引导保留给交互模式与 --framework/--all。
🤖 Generated by Qoder • Fix in Qoder
| /// Run `install.sh` for a framework, streaming output to the terminal. | ||
| fn run_install(adapter_dir: &Path, name: &str, install_script: &str) -> Result<(), String> { | ||
| let script = adapter_dir.join(install_script); | ||
| if !script.exists() { | ||
| return Err(format!("install script not found: {}", script.display())); | ||
| } | ||
| let status = Command::new("bash") |
There was a problem hiding this comment.
[P2] install.sh 失败时错误信息不含标准输出
src/tokenless/crates/tokenless-cli/src/init.rs 第134-155行:run_install 通过 Command::status() 仅拿到退出码,构造错误字符串时没有包含脚本的 stdout/stderr。安装脚本通常在输出中提供诊断信息,当前 CLI 只打印“exited with code N”,社区排查适配器安装问题会比较困难。建议改用 Command::output() 或在失败时附带 stderr 片段,保证用户能看到脚本的具体错误提示。
🤖 Generated by Qoder • Fix in Qoder
|
|
||
| ### Quick setup with `tokenless init` | ||
|
|
||
| After installing the npm package or building from source, run `tokenless init` to detect installed agent frameworks and guide adapter installation: |
There was a problem hiding this comment.
[P2] 文档示例未体现适配器目录缺失时的行为
docs/user-guide/en/token-saving/tokenless/framework-integration.md 第124-140行与对应中文文档:新增的 tokenless init 用法示例主要覆盖正常检测和安装流程,但未说明在适配器目录不存在时 CLI 会直接报错并提示安装方式。鉴于社区用户常从 npm 开始使用,适配器目录缺失是高频场景之一,建议在这两处增加一句说明或示例,指出 tokenless init 在找不到目录时的错误消息及推荐的下一步安装命令,以提升故障自助能力。
🤖 Generated by Qoder • Fix in Qoder
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b54762fd58
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| Ok(out) => match out.status.code() { | ||
| Some(0) => DetectStatus::Ready, | ||
| Some(1) => DetectStatus::Installable, | ||
| _ => DetectStatus::MissingPrereqs, |
There was a problem hiding this comment.
Do not treat every zero detect exit as installed
For tokenless init --framework qoder or --framework codex, this mapping makes the command skip installation even when the adapter is not registered: Qoder's detect.sh exits 0 after only finding a compatible qodercli lifecycle, and Codex's detector explicitly exits 0 even for {"installed": false}. Because the Ready branch returns without running install.sh, these advertised onboarding paths can report success while leaving the framework unconfigured.
Useful? React with 👍 / 👎.
| match run_install(&adapter_dir, &fw.name, script) { | ||
| Ok(()) => println!("{} adapter installed successfully.", fw.name), | ||
| Err(e) => eprintln!("{} adapter installation failed: {}", fw.name, e), |
There was a problem hiding this comment.
Propagate failures from --all installs
When tokenless init --all is used in non-interactive setup and any selected install.sh exits non-zero, this branch only prints the failure and the function still returns Ok(()). That makes scripts or package post-install checks treat a failed adapter registration as successful, unlike the --framework path above which returns an error for the same failed install.
Useful? React with 👍 / 👎.
| ### Added | ||
|
|
||
| - `tokenless init` command: detects installed agent frameworks, reports adapter status (ready / installable / missing prerequisites), and runs the appropriate `install.sh` to register the tokenless adapter — providing a single entry point for community onboarding. |
There was a problem hiding this comment.
Remove the feature entry from this changelog
This is a feature commit rather than a release/version-bump PR, so adding a component CHANGELOG entry here violates the repository documentation policy: AGENTS makes specs/documentation-standard.md the mandatory source for CHANGELOG rules, and that standard reserves CHANGELOG aggregation for release version bump PRs rather than daily feature PRs.
AGENTS.md reference: AGENTS.md:L319-L322
Useful? React with 👍 / 👎.
|
Addressed all 6 bot review comments in PR #2318: P1 — Fixed:
P2 — Fixed:
All 25 tokenless-cli tests pass. |
Adds `tokenless init` — a community entry point that detects installed agent frameworks via each adapter's detect.sh, reports status (ready / installable / missing prereqs), and runs install.sh for the selected framework. Supports --framework, --all, --list flags and interactive selection when stdin is a terminal. Community users installing via npm no longer need to manually locate and run adapter install scripts; `tokenless init` guides them through framework detection and adapter registration in one step. Assisted-by: Qoder:1.0.45 Signed-off-by: 林生 <linyan.lin@alibaba-inc.com> Co-authored-by: multica-agent <github@multica.ai>
b54762f to
9e8fb21
Compare
Summary
Adds
tokenless init— a community entry point that detects installed agent frameworks via each adapter'sdetect.sh, reports status (ready / installable / missing prereqs), and runsinstall.shfor the selected framework.Community users installing via npm no longer need to manually locate and run adapter install scripts.
tokenless initguides them through framework detection and adapter registration in one step.Flags
tokenless init— interactive selection (when stdin is a terminal)tokenless init --list— list framework status without installingtokenless init --framework <name>— install a specific adaptertokenless init --all— install all installable adapters (non-interactive)Files changed
crates/tokenless-cli/src/init.rs— new module (320 lines)crates/tokenless-cli/src/main.rs— registerInitcommand and dispatchcrates/tokenless-cli/Cargo.toml— addserdeworkspace dependencyCHANGELOG.md— add unreleased entrydocs/user-guide/{en,zh}/token-saving/tokenless/framework-integration.md— documenttokenless initusageTest plan
cargo build --release -p tokenless-clipassescargo test -p tokenless-cli— 25 tests passcargo clippy -p tokenless-cli— no warningstokenless init --helpshows the new subcommandtokenless init --listshows helpful error when adapter dir not found