Skip to content

feat(tokenless): add init command for community onboarding - #2264

Open
Forrest-ly wants to merge 1 commit into
alibaba:mainfrom
Forrest-ly:feat/tokenless-community-init
Open

feat(tokenless): add init command for community onboarding#2264
Forrest-ly wants to merge 1 commit into
alibaba:mainfrom
Forrest-ly:feat/tokenless-community-init

Conversation

@Forrest-ly

Copy link
Copy Markdown
Collaborator

Summary

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.

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.

Flags

  • tokenless init — interactive selection (when stdin is a terminal)
  • tokenless init --list — list framework status without installing
  • tokenless init --framework <name> — install a specific adapter
  • tokenless 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 — register Init command and dispatch
  • crates/tokenless-cli/Cargo.toml — add serde workspace dependency
  • CHANGELOG.md — add unreleased entry
  • docs/user-guide/{en,zh}/token-saving/tokenless/framework-integration.md — document tokenless init usage

Test plan

  • cargo build --release -p tokenless-cli passes
  • cargo test -p tokenless-cli — 25 tests pass
  • cargo clippy -p tokenless-cli — no warnings
  • tokenless init --help shows the new subcommand
  • tokenless init --list shows helpful error when adapter dir not found

@github-actions github-actions Bot added component:tokenless src/tokenless/ scope:documentation ./docs/|./*.md|./NOTICE labels Aug 6, 2026

@qoderai qoderai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] tokenless init --list 行为与“仅列出状态”预期不完全一致,当前实现仍输出安装提示,建议简化为纯状态输出并将安装引导留给交互模式与显式安装命令。

[P2] run_install 在脚本失败时只暴露退出码而不包含 stderr,用户难以根据 CLI 输出定位安装问题,建议在错误消息中附加脚本输出。

[P2] 文档中新加入的 tokenless init 用法未描述适配器目录缺失时的错误与引导命令,建议在中英文用户指南中补充一句说明增强自助排错能力。


🤖 Generated by QoderView workflow run

Comment on lines +252 to +253
if list_only {
print_install_hints();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] --list 模式仍打印安装提示,易混淆

src/tokenless/crates/tokenless-cli/src/init.rs 第252-255行:list_only 分支调用 print_install_hints() 并返回。该子命令语义为“仅列出状态不进行安装”,但仍输出安装提示文案,可能让用户误以为会执行安装或需要额外操作,破坏文档对 --list 的直观说明。建议 --list 模式只打印状态与目录信息,不再输出安装提示,将安装引导保留给交互模式与 --framework/--all


🤖 Generated by QoderFix in Qoder

Comment on lines +134 to +140
/// 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")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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 QoderFix 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:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 文档示例未体现适配器目录缺失时的行为

docs/user-guide/en/token-saving/tokenless/framework-integration.md 第124-140行与对应中文文档:新增的 tokenless init 用法示例主要覆盖正常检测和安装流程,但未说明在适配器目录不存在时 CLI 会直接报错并提示安装方式。鉴于社区用户常从 npm 开始使用,适配器目录缺失是高频场景之一,建议在这两处增加一句说明或示例,指出 tokenless init 在找不到目录时的错误消息及推荐的下一步安装命令,以提升故障自助能力。


🤖 Generated by QoderFix in Qoder

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +125 to +128
Ok(out) => match out.status.code() {
Some(0) => DetectStatus::Ready,
Some(1) => DetectStatus::Installable,
_ => DetectStatus::MissingPrereqs,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +308 to +310
match run_install(&adapter_dir, &fw.name, script) {
Ok(()) => println!("{} adapter installed successfully.", fw.name),
Err(e) => eprintln!("{} adapter installation failed: {}", fw.name, e),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +10 to +12
### 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Forrest-ly

Copy link
Copy Markdown
Collaborator Author

Addressed all 6 bot review comments in PR #2318:

P1 — Fixed:

  • --list mode: removed print_install_hints() call — the flag now returns after the status table with no install guidance
  • Detect exit-0 false-ready: run_detect now parses stdout JSON; if output is {"installed": false}, status is mapped to Installable rather than Ready, fixing Codex (fail-open detector) and Qoder (lifecycle-check-only detector)

P2 — Fixed:

  • run_install now uses Command::output() and appends captured stderr to error messages
  • --all install loop now collects failures and returns Err at the end (consistent with --framework)
  • Removed [Unreleased] CHANGELOG entry (belongs in release/version-bump PR only)
  • Added "adapter directory not found" error and recovery docs to EN + ZH framework-integration.md

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>
@Forrest-ly
Forrest-ly force-pushed the feat/tokenless-community-init branch from b54762f to 9e8fb21 Compare August 9, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:tokenless src/tokenless/ scope:documentation ./docs/|./*.md|./NOTICE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant