← 返回 Skills 市场
jackeylee007

guanyuan data

作者 JackeyLee007 · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ✓ 安全检测通过
178
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install guanyuan-data
功能描述
观远数据API工具 - 支持多种认证方式、Token自动管理、卡片数据获取和CSV导出
使用说明 (SKILL.md)

观远数据 API Skill

Description

This skill provides a command-line interface for GuanYuan Data (观远数据) API. It supports multiple authentication methods, automatic token management, card data retrieval, and CSV export with metadata generation.

Usage Instructions

When a user requests GuanYuan data operations:

  1. Choose authentication method:

    • Method 1: Provide loginId and password in config for automatic login
    • Method 2: Provide token directly in config file
    • Method 3: Use guanyuan token \x3Ctoken> command to set token interactively
  2. Get card data: Use guanyuan card \x3CcardId> to retrieve data in JSON format

  3. Export to CSV: Use guanyuan csv \x3CcardId> --output file.csv to export data

Authentication Methods

Method 1: Automatic Login with Credentials

{
  "baseUrl": "https://your-guanyuan-domain.com",
  "domain": "your-domain",
  "loginId": "your-login-id",
  "password": "your-password"
}

Then run: guanyuan login

Method 2: Direct Token in Config

{
  "baseUrl": "https://your-guanyuan-domain.com",
  "domain": "your-domain",
  "token": "your-token-here"
}

No login needed, directly use commands.

Method 3: Token Command (Interactive)

{
  "baseUrl": "https://your-guanyuan-domain.com",
  "domain": "your-domain"
}

Then run: guanyuan token \x3Cyour-token> or guanyuan token (interactive)

Available Resources

Main Script

  • scripts/guanyuan.js: Main CLI tool
    • login(): Authenticate and save token
    • getCardData(cardId, options): Retrieve card data
    • convertToCSV(cardData, sampleRows): Convert data to CSV format
    • extractMetadata(cardData): Extract field metadata
    • saveCSVWithMetadata(csv, filename, metadata, cardId): Save CSV and metadata files
    • getValidToken(config): Auto-discover and use valid token from multiple sources

Configuration Files

  • ~/.guanyuan/config.json: API credentials and settings
    • Required: baseUrl, domain
    • Optional (one of): loginId + password, token, or none (use token command)
  • ~/.guanyuan/user.token: Stored authentication token (auto-managed)

Export Files

  • \x3Cfilename>.csv: CSV data file
  • \x3Cfilename>_meta.json: Metadata file with field information

References

  • references/README.md: Detailed user documentation in Chinese

Commands Reference

Command Description Example
init Initialize configuration (show setup instructions) guanyuan init
login Login with credentials from config guanyuan login
token [token] Set token (via parameter or interactive) guanyuan token eyJ0eX...
card \x3Cid> Get card data (JSON) guanyuan card abc123 --limit 50
csv \x3Cid> Export to CSV guanyuan csv abc123 --output data.csv
status Show config and token status guanyuan status
help Show help guanyuan help

Options Reference

Common Options

Option Description Default
--view \x3CGRAPH|GRID> Data view type GRAPH
--limit \x3Cnumber> Number of rows 100
--offset \x3Cnumber> Data offset 0

CSV Export Options

Option Description Default
--output \x3Cfilename> Output to file stdout
--sample \x3Cnumber> Sample N rows all rows

Example Prompts

  • "使用账号密码登录观远数据并获取卡片abc123的数据"
  • "使用token设置观远数据认证"
  • "Export card data to CSV with metadata"
  • "Get the first 50 rows of card l059d768f28bd404caf8df3e"
  • "导出卡片数据到CSV文件,只采样前10行"
  • "Check GuanYuan API configuration status"
  • "Save card data as query_data.csv with metadata"
  • "Set token for GuanYuan API without providing credentials"

Authentication Workflow

┌─────────────────────────────────────────────────────────────┐
│  User wants to access GuanYuan data                         │
└────────────────────┬────────────────────────────────────────┘
                     │
                     v
┌─────────────────────────────────────────────────────────────┐
│  Check ~/.guanyuan/user.token                               │
│  Is there a valid token?                                    │
└────────────────────┬────────────────────────────────────────┘
                     │
            ┌────────┴────────┐
            │                 │
         Yes │                 │ No
            │                 │
            v                 v
┌───────────────────┐  ┌──────────────────────────────────┐
│  Use saved token  │  │  Check config.json              │
└───────────────────┘  │  - Has loginId + password?       │
                      │  - Has token?                   │
                      │  - Neither? → Use token command  │
                      └────────────┬─────────────────────┘
                                   │
                    ┌──────────────┼──────────────┐
                    │              │              │
                Has Creds      Has Token    Neither
                    │              │              │
                    v              v              v
            ┌───────────┐  ┌───────────┐  ┌───────────────┐
            │  Auto     │  │  Use      │  │  Prompt user │
            │  Login    │  │  Config   │  │  to run      │
            │           │  │  Token   │  │  'guanyuan    │
            └───────────┘  └───────────┘  │   token'      │
                                         └───────────────┘

Metadata File Format

When exporting CSV with --output, a _meta.json file is automatically generated:

{
  "cardId": "card-id",
  "cardType": "CHART",
  "chartType": "PIVOT_TABLE",
  "view": "GRAPH",
  "exportTime": "2026-03-25T07:52:00.924Z",
  "totalRows": 10,
  "dataLimit": 10,
  "hasMoreData": false,
  "fields": [
    {
      "name": "字段显示名称",
      "originalName": "字段原始名称",
      "type": "STRING/TIMESTAMP/DOUBLE",
      "metaType": "DIM/METRIC",
      "fieldType": "dimension/metric",
      "fieldId": "field-id"
    }
  ]
}

Output Format

JSON Output

  • Full API response with chart data
  • Includes dimensions, metrics, and formatting info
  • Suitable for debugging and data inspection

CSV Output

  • Tabular format with headers
  • Dimensions first, then metrics
  • Proper CSV escaping for special characters
  • Metadata file with field types and descriptions

Token Management

Token Sources (Priority Order)

  1. ~/.guanyuan/user.token - Saved token (highest priority)
  2. config.json - Token field in config
  3. Auto-login - Using loginId + password from config

Token Behavior

  • With expireAt: Automatically validated against expiration time
  • Without expireAt: Used indefinitely (user-manually set tokens)
  • Expired/Invalid: Triggers auto-refresh (if credentials available) or prompts user

Manual Token Setting

# Via parameter
guanyuan token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...

# Interactive mode
guanyuan token
# Then paste your token when prompted

Notes

  • Flexible Authentication: Three authentication methods for different use cases
  • Token Management: Tokens are automatically discovered from multiple sources
  • Auto-Login: Credentials-based auth with automatic token refresh
  • Password Handling: Passwords are automatically Base64 encoded before API call
  • URL Support: baseUrl can include protocol prefix (http:// or https://)
  • CSV Escaping: Special characters (commas, quotes, newlines) are properly escaped
  • File Safety: Existing files are overwritten without warning
  • Data Limits: Use --limit to control API response size
  • Sampling: Use --sample to export only N rows without fetching all data
  • No Credentials Required: Can work with just baseUrl + domain + token command

API References

安全使用建议
This skill appears to do what it says, but exercise normal caution before installing: 1) The source/publisher is unknown and there's no homepage — review the included script yourself before use. 2) The tool stores tokens and (optionally) base64-encoded passwords in ~/.guanyuan; these files are not encrypted by the script, so restrict file permissions (chmod 600 ~/.guanyuan/*) and avoid storing long-lived/high-privilege credentials on shared machines. 3) Verify the configured baseUrl points to your expected GuanYuan instance (default uses api.guandata.com). 4) If you need stronger security, prefer using short-lived or least-privilege tokens rather than storing passwords. 5) Because this is a local CLI script, run it in a controlled environment (or inspect the file) before adding it to PATH or granting it broad access.
功能分析
Type: OpenClaw Skill Name: guanyuan-data Version: 1.1.0 The skill is a legitimate CLI tool designed to interact with the GuanYuan Data (观远数据) API. It provides functionality for authentication, token management, and exporting card data to CSV format. The script (scripts/guanyuan.js) correctly uses HTTPS for API communication and limits network requests to the user-configured 'baseUrl'. While it stores credentials and tokens in the user's home directory (~/.guanyuan/), this is a standard pattern for CLI tools and no evidence of data exfiltration or malicious intent was found.
能力评估
Purpose & Capability
The name/description match the code and SKILL.md. The script implements login/token management, card data retrieval and CSV export and only requests access to ~/.guanyuan config and network to the configured baseUrl — all appropriate for an API client.
Instruction Scope
Runtime instructions explicitly tell the agent to read/write ~/.guanyuan/config.json and ~/.guanyuan/user.token and to call the configured API endpoints; those actions are necessary for the declared features. There is no instruction to read unrelated files or to call unexpected external endpoints.
Install Mechanism
There is no automated install that downloads remote code; the skill is instruction + included script. It relies on Node.js being present (not installed by the skill). No suspicious external install URLs or archive extraction are present.
Credentials
No environment variables or external credentials are requested by the skill manifest. The code asks the user to provide credentials or a token in ~/.guanyuan/config.json — this is proportional to an API client. It uses process.env.HOME to locate the config directory, which is expected.
Persistence & Privilege
The skill persists only under the user's home (~/.guanyuan) and does not request always:true or modify other skill/system configurations. It writes/reads its own token and config files — suitable for this type of CLI tool.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install guanyuan-data
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /guanyuan-data 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
- Added support for multiple authentication methods: use login credentials, set a token directly in config, or set token interactively with a command. - Improved token management: tokens can now be auto-discovered from saved files, config, or obtained via auto-login. - Enhanced documentation with explicit authentication workflows and examples for each method. - Updated main script reference and command descriptions to reflect multi-auth support and better guidance. - Removed the sample file auto_test_meta.json.
v1.0.0
guanyuan-data v1.0.0 – Initial release - Provides a command-line tool for GuanYuan Data API access. - Supports user authentication, automatic token management, and secure credential storage. - Enables retrieval of card data in JSON format and export to CSV with automatic metadata generation. - Includes commands for login, data export, configuration setup, and status checks. - Allows data view, row limits, and sampling options for flexible exports.
元数据
Slug guanyuan-data
版本 1.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

guanyuan data 是什么?

观远数据API工具 - 支持多种认证方式、Token自动管理、卡片数据获取和CSV导出. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 178 次。

如何安装 guanyuan data?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install guanyuan-data」即可一键安装,无需额外配置。

guanyuan data 是免费的吗?

是的,guanyuan data 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

guanyuan data 支持哪些平台?

guanyuan data 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 guanyuan data?

由 JackeyLee007(@jackeylee007)开发并维护,当前版本 v1.1.0。

💬 留言讨论