Chukonu search CLI — OAuth-gated access to se4ai general search and patent search via api-gateway.
Project description
chukonu-cli
Python CLI for Chukonu 搜索网关 (api-gateway),基于 Typer。
安装
python -m venv .venv
.venv/bin/pip install -e .
命令
| 命令 | 说明 |
|---|---|
chukonu-cli auth login [--provider {google,wechat}] |
OAuth Authorization Code Flow + PKCE + loopback 回调 |
chukonu-cli auth logout [--provider X] [--all] [--remote] |
清理凭据,可同时在网关撤销 refresh token |
chukonu-cli auth status [--json] |
查看登录状态;未登录 exit 1 |
chukonu-cli doctor [--json] |
健康检查 (config / 凭据 / 网关 / token / 上游) |
chukonu-cli api <METHOD> <PATH> [flags] |
通用 API 调用,自动注入 Bearer |
chukonu-cli search <query> [flags] |
通用搜索,薄封装 POST /se4ai/api/search |
chukonu-cli patent {keyword,similar,advanced,get,stats} |
专利搜索 |
文件布局
- 配置:
~/.chukonu-cli/config.toml - 文件锁:
~/.chukonu-cli/locks/ - 明文凭据:
~/.local/share/chukonu-cli/credentials.json(0600)
登录安全模型
CLI ↔ 网关采用 OAuth 2.0 Authorization Code Flow + PKCE (RFC 7636, S256):
- CLI 生成高熵
code_verifier与code_challenge = BASE64URL(SHA256(verifier)) - CLI 启动
127.0.0.1:<port>loopback HTTP server 作为redirect_uri - 浏览器访问
{gateway}/auth/{provider}/login?redirect_uri=...&state=...&code_challenge=...&code_challenge_method=S256 - 网关重定向到上游 provider,用户授权后回网关
/auth/{provider}/callback - 网关仅回
?code=<一次性码>&state=...给 loopback (access_token 不再进浏览器 URL) - CLI 立刻
POST /auth/token带上code+code_verifier+redirect_uri换取 session (access/refresh token) - 凭据写入
credentials.json(明文,0600)
支持的 provider:
google—— 标准 OIDC,网关验 id_token (RS256 via JWKS),subject = Googlesubwechat—— 微信开放平台网站应用snsapi_login扫码,网关调sns/oauth2/access_token拿 openid/unionid,subject 优先 unionid 回退 openid
两条路径在 CLI 侧完全对称,凭据文件可同时保留多个 provider,current 字段决定默认使用哪个。
切换默认 provider
编辑 ~/.chukonu-cli/config.toml:
default_provider = "wechat"
或每次用 --provider wechat 临时覆盖。
Skills
skills/chukonu-search-general/ 与 skills/chukonu-search-patent/ 为 AI Agent (例如 Claude Code) 接入搜索能力。
作为 Claude Code 插件安装
本仓库本身即是一个 Claude Code 插件 marketplace,内含 chukonu-cli 插件(含 chukonu-search-general / chukonu-search-patent 两个 skill)。
前置:已 pip install -e . 或 pip install chukonu-cli,并完成 chukonu-cli auth login。
# 在 Claude Code 中
claude plugin marketplace add chukonu-team/chukonu-cli
claude plugin install chukonu-cli@chukonu
安装后 skill 会以 chukonu-cli:chukonu-search-general 与 chukonu-cli:chukonu-search-patent 暴露,Claude 会按需自动调用。
本地开发调试:
claude plugin marketplace add /absolute/path/to/chukonu-cli
claude plugin install chukonu-cli@chukonu
# 修改 SKILL.md 后
/plugin marketplace update chukonu
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chukonu_cli-0.1.0.tar.gz.
File metadata
- Download URL: chukonu_cli-0.1.0.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9796edacd022d91d19fc105cd6ae2eb553e4d97d9d1b9e5175850b69feceeb6
|
|
| MD5 |
2fb5851ec2550afe153930f8ab1cb7c5
|
|
| BLAKE2b-256 |
5e8e4e4d0fde36a342b69d8d5f3baad15181e17fa7fd8363d8f45f8d4623d304
|
File details
Details for the file chukonu_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chukonu_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21e5d6ac6ca064b692451dacb64056477edf661f26439bbaeb283899f6d8c849
|
|
| MD5 |
e3e58c37886f321733e204dd6b049862
|
|
| BLAKE2b-256 |
f8f2feac1d99055bc92a10d83061a7a3863e0ad8c6f7ec0bd4daa29f3f81e908
|