feat(tokenless): add npm, curl, and skill installation methods - #2322
feat(tokenless): add npm, curl, and skill installation methods#2322Forrest-ly wants to merge 2 commits into
Conversation
Add three new installation methods alongside the existing anolisa CLI: - npm: `npm install -g anolisa-tokenless` for developers - curl: standalone install script with npm/source-build fallback - skill: os-skills definition for agent-driven installation Update QUICKSTART (zh/en) and user-manual (zh/en) to document all four methods with platform support matrix. Assisted-by: Qoder Signed-off-by: Forrest-ly <forrest.ly@alibaba-inc.com>
There was a problem hiding this comment.
[P1] curl 安装脚本在 musl Linux 上直接退出,文档表述为“仅源码构建”但没有真正 fallback,会让 Alpine 用户误以为脚本可用却无法安装。
[P2] npm 安装路径对 npm prefix 与 PATH 的依赖在脚本中仅有弱提示,权限或 PATH 配置异常时用户难以从输出中明确定位问题。
[P2] Skill 文档中的适配脚本路径和 Agent 名称列表目前假定所有适配器都有统一 scripts/install.sh,若部分适配器尚未提供该脚本会导致用户跟随说明时直接报错。
🤖 Generated by Qoder • View workflow run
| aarch64|arm64) arch="arm64" ;; | ||
| *) die "Unsupported architecture: $(uname -m)" ;; | ||
| esac | ||
| if [ "$os" = "linux" ] && ldd --version 2>&1 | grep -qi musl; then |
There was a problem hiding this comment.
[P1] curl 安装脚本在 musl Linux 上直接退出
src/tokenless/scripts/install.sh:36-38 中通过 ldd --version 检测 musl 并直接 die。在 Alpine 等环境下,这会导致文档中标记为“Source build only”的 curl 安装路径完全不可用,用户没有 fallback。建议在检测到 musl 时提示只支持源码构建,并直接进入 try_source_build,而不是整体退出。
🤖 Generated by Qoder • Fix in Qoder
There was a problem hiding this comment.
Fixed in 7181eec. The musl check in detect_platform now sets a MUSL_LINUX flag and warns instead of calling die(). try_npm_install checks this flag and returns early, so main falls through to try_source_build automatically. TOKENLESS_FORCE_BUILD=1 also continues to work.
| local install_dir="${TOKENLESS_INSTALL_DIR:-$DEFAULT_INSTALL_DIR}" | ||
| mkdir -p "$install_dir" | ||
|
|
||
| local npm_prefix |
There was a problem hiding this comment.
[P2] npm 安装路径对 npm prefix 与 PATH 的耦合存在隐形失败
src/tokenless/scripts/install.sh:66-88 假设 npm_prefix/bin 或 npm_prefix/lib/node_modules/.../bin 中的二进制通过 ln -sf 即可被 PATH 找到,但实际用户 PATH 可能未包含 TOKENLESS_INSTALL_DIR,或 npm_prefix 被设置到 root 目录导致 EACCES。Skill 文档中有前缀修复示例,但安装脚本本身只在尾部追加 PATH 修改,无法覆盖非默认 shell/rc 文件。建议增加显式权限检查和失败提示,引导用户按 Skill 中的前缀修复步骤操作。
🤖 Generated by Qoder • Fix in Qoder
There was a problem hiding this comment.
Fixed in 7181eec. npm install output is now captured with error checking: on non-zero exit, the script warns with the npm prefix fix steps (mkdir -p ~/.npm-global && npm config set prefix '~/.npm-global') and returns 1 to fall through to source build. A separate PATH check after symlinking also warns if install_dir is not in PATH.
| anolisa adapter enable tokenless <agent> | ||
| anolisa adapter status tokenless | ||
|
|
||
| # If installed via npm, adapters are at: |
There was a problem hiding this comment.
[P2] Skill 文档对适配脚本命名的约定与实际资源可能存在偏差
src/os-skills/ai/install-tokenless/SKILL.md:95-112 列出 ~/.local/share/anolisa/adapters/tokenless/<agent>/scripts/install.sh 路径,并给出多种 Agent 名称(cosh、OpenClaw、Hermes、Qoder、Claude Code、Codex、Qwen Code)。如果某些适配器尚未提供对应 scripts/install.sh 或目录命名不同(例如 qwencode vs qwen-code),用户会得到 No such file or directory。建议将这一段明确为“示例路径”,并在缺少脚本时指向框架集成文档或 anolisa adapter enable tokenless <framework> 作为统一入口。
🤖 Generated by Qoder • Fix in Qoder
There was a problem hiding this comment.
Fixed in 7181eec. Added a note above the table clarifying that script paths are examples for npm-installed adapters, that not all frameworks ship a standalone install.sh, and that anolisa adapter enable tokenless <framework> is the recommended path. Users are guided to check ls ~/.local/share/anolisa/adapters/tokenless/ to verify the directory exists before running a script.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba98630336
ℹ️ 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".
|
|
||
| ```bash | ||
| # Install the tokenless Skill via os-skills | ||
| anolisa skill install install-tokenless |
There was a problem hiding this comment.
Use a supported Skill installation path
When users follow the new Skill method, anolisa skill install install-tokenless fails at argument parsing because the ANOLISA CLI only defines the component/management subcommands in src/anolisa/crates/anolisa-cli/src/commands.rs and has no skill surface. This makes the documented Skill install path unusable; document the existing os-skills install/adapter flow or add the CLI command before advertising it.
AGENTS.md reference: AGENTS.md:L319-L325
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7181eec. Removed the anolisa skill install install-tokenless command from the docs — the anolisa CLI does not have a skill subcommand. Method D now describes how to use the Skill file directly: load or pass src/os-skills/ai/install-tokenless/SKILL.md to the agent framework.
| TOKENLESS_VERSION=0.7.4 curl -fsSL https://raw.githubusercontent.com/alibaba/anolisa/main/src/tokenless/scripts/install.sh | bash | ||
| TOKENLESS_INSTALL_DIR=/usr/local/bin curl -fsSL https://raw.githubusercontent.com/alibaba/anolisa/main/src/tokenless/scripts/install.sh | bash |
There was a problem hiding this comment.
Pass installer variables to bash, not curl
When users copy these examples, the TOKENLESS_* assignment is scoped only to the curl process on the left side of the pipeline, so the bash process executing install.sh sees neither variable and silently uses the latest/default install directory. Use a form that exports the variable to the installer shell, such as curl ... | TOKENLESS_VERSION=0.7.4 bash, or the version/directory override examples will not work.
AGENTS.md reference: AGENTS.md:L319-L325
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7181eec. Both env var examples in QUICKSTART.md now place the variables before bash, not before curl, so the install script receives them: curl ... | TOKENLESS_VERSION=0.7.4 bash.
| tar -xzf "${tmpdir}/tokenless-${VERSION}.tar.gz" -C "$tmpdir" | ||
|
|
||
| local src_dir | ||
| src_dir=$(find "$tmpdir" -maxdepth 2 -name 'Cargo.toml' -path '*/tokenless/*' -exec dirname {} \; | head -1) |
There was a problem hiding this comment.
Search deep enough for the tokenless Cargo.toml
When npm is unavailable or the user forces a source build, GitHub archives unpack the component under <archive-root>/src/tokenless/Cargo.toml, but -maxdepth 2 only reaches <archive-root>/src and never the component directory. The fallback then dies with Could not find tokenless source in tarball before Cargo runs, so the curl installer cannot recover from missing/failed npm even though it advertises a source-build fallback.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7181eec. Changed -maxdepth 2 to -maxdepth 3 in the find call inside try_source_build. GitHub tarballs extract to <archive-root>/src/tokenless/Cargo.toml, which is 3 levels deep from $tmpdir, so depth 2 missed it entirely.
| if [ "$os" = "linux" ] && ldd --version 2>&1 | grep -qi musl; then | ||
| die "musl-based Linux distributions (e.g. Alpine) are not supported by prebuilt binaries. Build from source instead." |
There was a problem hiding this comment.
Allow musl users to reach the source-build fallback
On Alpine or other musl-based Linux systems, this check exits during platform detection before main can try try_source_build, so the documented “Source build only” path and TOKENLESS_FORCE_BUILD=1 cannot work. Since only the prebuilt npm binaries are unsupported on musl, mark npm as unavailable and let the source-build path run instead of dying here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7181eec — same fix as the P1 comment. musl detection now sets MUSL_LINUX=1 and warns; try_npm_install skips early when this flag is set, so main proceeds to try_source_build. The source build path and TOKENLESS_FORCE_BUILD=1 are fully reachable on musl.
- install.sh: warn instead of die on musl Linux, allowing source build fallback - install.sh: skip npm install on musl (MUSL_LINUX flag) - install.sh: capture npm install exit code, warn with EACCES/prefix fix steps - install.sh: warn if install_dir is not in PATH after npm install - install.sh: increase find -maxdepth to 3 to locate tokenless/Cargo.toml in tarball - QUICKSTART.md: fix env var placement in curl pipe (vars go before bash, not curl) - QUICKSTART.md: remove non-existent `anolisa skill install` command - SKILL.md: fix env var placement in curl pipe examples - SKILL.md: add note that adapter script paths are examples, not guaranteed to exist
Summary
npm install -g anolisa-tokenless— standalone install with prebuilt binaries and adapter resourcessrc/tokenless/scripts/install.sh) that prefers npm and falls back to source buildsrc/os-skills/ai/install-tokenless/SKILL.md) for agent-driven installationChanges
src/tokenless/scripts/install.shsrc/os-skills/ai/install-tokenless/SKILL.mddocs/user-guide/{zh,en}/token-saving/tokenless/QUICKSTART.mddocs/user-guide/{zh,en}/token-saving/tokenless/user-manual.mdTest plan
npm install -g anolisa-tokenlessworks on Linux x64/arm64 and macOScurl -fsSL ... | bashinstall script detects platform and installs correctly