Skip to content

CSlawyer1985/legal-skillhub / skills/1688-common-cha88-company-risk

1688-common-cha88-company-risk

Verified

88查企业风险查询与分析工具 —— 专注于中国大陆企业的法务风险查询与分析,覆盖经营异常、行政处罚、监管措施、被执行人、失信被执行人、司法案件等风险类型。支持公司名称、统一社会信用代码、companyId 三种输入方式,自动完成风险查询并输出结构化风险分析总结。 触发场景:仅当用户意图为查询企业风险/法务风险时触发。包括但不限于:企业风险查询、公司风险、经营异常、行政处罚、监管措施、被执行人、失信被执行人、司法风险、风险扫描、风险评估、企业合规审查、风险报告、XX公司有什么风险、XX公司安全吗、XX公司有没有处罚、XX公司被执行过吗。 不触发场景:纯粹的企业信息查询(如查公司、搜企业、工商信息、注册资本、法人代表、股东结构、专利商标等)不应触发本技能,请使用其他 cha88 系列工具。

scripts/_tracker.py

View on GitHub
#!/usr/bin/env python3
"""
Skill 埋点上报

职责:每次 CLI 命令执行时,向 skill 网关上报一次调用记录,用于统计 skill 调用次数。
上报失败不影响主流程,静默处理。

环境变量(从项目根目录 .env 读取):
    SKILL_NAME     skill 名称,默认 cha88-base
    SKILL_VERSION  skill 版本,默认 1.0.0
    SKILL_CHANNEL  发布渠道,默认 clawhub
"""

import json
import logging
import os
from pathlib import Path

logger = logging.getLogger("cha88_tracker")

# 项目根目录(scripts/ 的上一级)
_ROOT_DIR = Path(__file__).parent.parent


def _load_env_file() -> None:
    """解析项目根目录的 .env 文件,将变量注入 os.environ(已有环境变量不覆盖)。"""
    env_path = _ROOT_DIR / ".env"
    if not env_path.exists():
        return
    with open(env_path, encoding="utf-8") as f:
        for line in f:
            line = line.strip()
            if not line or line.startswith("#") or "=" not in line:
                continue
            key, _, value = line.partition("=")
            key = key.strip()
            value = value.strip()
            # 已存在的环境变量(如 CI 注入)优先,不覆盖
            if key and key not in os.environ:
                os.environ[key] = value


# 模块加载时解析一次 .env
_load_env_file()


def _get_skill_env() -> tuple[str, str, str]:
    """读取 skill 基础信息,返回 (skill_name, skill_version, channel)。"""
    skill_name = os.environ.get("SKILL_NAME", "1688-common-cha88-company-risk")
    skill_version = os.environ.get("SKILL_VERSION", "1.0.0")
    channel = os.environ.get("SKILL_CHANNEL", "clawhub")
    return skill_name, skill_version, channel


def report_skill_usage() -> None:
    """
    上报 skill 调用次数到网关。

    调用时机:每次 CLI 命令执行时调用一次(在 cli.py 的 main() 中触发)。
    失败时静默处理,不抛出异常,不影响主流程。
    """
    try:
        from _http import api_post
        skill_name, skill_version, channel = _get_skill_env()
        api_post(
            "/api/reportSkillsUsage/1.0.0",
            {
                "apiName": None,
                "skillsName": skill_name,
                "version": skill_version,
                "scene": "CLI",
                "channel": channel,
            },
        )
    except Exception as exc:
        logger.debug("埋点上报失败(已忽略): %s", exc)
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall