← 返回
数据分析 Key

SubsTracker

Manage SubsTracker subscriptions and configuration via CLI scripts. Handles login, subscription CRUD, config updates, notifications, and dashboard queries. U...
通过CLI脚本管理SubsTracker订阅和配置。处理登录、订阅增删改查、配置更新、通知和仪表板查询等功能。
ianchenx
数据分析 clawhub v1.1.0 1 版本 99845 Key: 需要
★ 0
Stars
📥 644
下载
💾 7
安装
1
版本
#latest

概述

SubsTracker API Skill

Manage subscriptions via CLI scripts that wrap the SubsTracker REST API. The scripts handle authentication, cookie management, and retries — you just call a command and get JSON back.

Skill Structure

substracker-skills/
├── SKILL.md              ← You are here
└── scripts/
    ├── main.ts           ← CLI entry point (routing only)
    ├── client.ts         ← HTTP client, env loading, auth
    ├── types.ts          ← TypeScript interfaces (canonical schema + docs)
    ├── subscriptions.ts  ← Subscription commands
    ├── payments.ts       ← Payment commands
    ├── config.ts         ← Config commands
    ├── dashboard.ts      ← Dashboard command
    └── notifications.ts  ← Notification test command

Read scripts/types.ts for all field names, types, defaults, and descriptions (TSDoc comments).

Configuration

Scripts auto-load credentials from .env files. No manual setup in the session.

Load priority (first found wins):

  1. System environment variables
  2. /.substracker-skills/.env
  3. ~/.substracker-skills/.env

Required variables in .env:

SUBSTRACKER_URL=https://sub.example.com
SUBSTRACKER_USER=admin
SUBSTRACKER_PASS=your_password

If variables are missing, the script exits with a clear error. Ask the user to create their .env file.

Running Commands

Resolve the runtime: use bun if installed, otherwise npx -y bun.

All commands follow the same pattern:

bun <SKILL_DIR>/scripts/main.ts <command> [subcommand] [--flags]

Scripts output JSON to stdout (for you to parse) and log to stderr (for debugging). Authentication and session cookies are handled automatically — if a session expires, the script re-logs in and retries.

Command Reference

Login

bun scripts/main.ts login

Usually not needed — all commands auto-login when no session exists. Use this to verify credentials.

Subscriptions

bun scripts/main.ts s list
bun scripts/main.ts s create --name "Netflix" --expiry-date 2026-04-07 --amount 15.99
bun scripts/main.ts s get <id>
bun scripts/main.ts s update <id> --amount 19.99
bun scripts/main.ts s delete <id>
bun scripts/main.ts s toggle <id> --active false
bun scripts/main.ts s renew <id> --amount 15.99 --note "March renewal"
bun scripts/main.ts s test-notify <id>

Subscription Flags (create / update)

FlagTypeRequiredDescription
-----------------------------------
--namestringcreate onlySubscription name
--expiry-datestringcreate onlyExpiration date (ISO format)
--amountnumber-Cost per billing cycle
--currencystring-Currency code, default CNY
--period-unit`day\month\year`-Billing cycle unit, default month
--period-valuenumber-Billing cycle length, default 1
--categorystring-Category label (e.g. 娱乐)
--custom-typestring-Custom type (e.g. 视频流媒体)
--mode`cycle\reset`-Subscription mode
--start-datestring-Start date (ISO format)
--auto-renew`true\false`-Auto-renew flag, default true
--active`true\false`-Active status
--reminder-unit`day\hour`-Reminder unit
--reminder-valuenumber-Reminder value
--reminder-daysnumber-Reminder days before expiry
--lunar`true\false`-Use lunar calendar
--notesstring-Notes / memo

Toggle Flags

FlagTypeDescription
-------------------------
--active`true\false`Set active or inactive

Renew Flags

FlagTypeDescription
-------------------------
--amountnumberPayment amount
--period-multipliernumberMultiply billing cycle
--payment-datestringPayment date
--notestringPayment note

Payments

bun scripts/main.ts p list <sub-id>
bun scripts/main.ts p edit <sub-id> <payment-id> --amount 19.99 --note "adjusted"
bun scripts/main.ts p delete <sub-id> <payment-id>

Payment Edit Flags

FlagTypeDescription
-------------------------
--datestringPayment date
--amountnumberPayment amount
--notestringPayment note

Dashboard

bun scripts/main.ts d

Returns monthly/yearly spend, active count, upcoming renewals, expense breakdown.

Config

bun scripts/main.ts c get
bun scripts/main.ts c update --timezone Asia/Shanghai --notifiers telegram,bark

Config Flags

FlagTypeDescription
-------------------------
--usernamestringAdmin username
--passwordstringAdmin password
--timezonestringTimezone (e.g. Asia/Shanghai)
--show-lunar`true\false`Show lunar calendar dates
--themestringTheme mode
--notifiersstringComma-separated: telegram,bark,email,webhook,wechatbot,gotify
--tg-bot-tokenstringTelegram bot token
--tg-chat-idstringTelegram chat ID
--bark-keystringBark device key
--bark-serverstringBark server URL
--webhook-urlstringWebhook URL
--webhook-methodstringWebhook HTTP method
--webhook-templatestringWebhook body template
--wechat-webhookstringWeChat bot webhook URL
--gotify-urlstringGotify server URL
--gotify-tokenstringGotify app token
--email-fromstringSender email
--email-tostringRecipient email
--resend-keystringResend API key
--clear-secretsstringComma-separated fields to clear
--debug`true\false`Enable debug logs
--payment-history-limitnumberMax payment history entries

Test Notification

bun scripts/main.ts t --type telegram
FlagTypeRequiredDescription
-----------------------------------
--typestring`telegram\notifyx\webhook\wechatbot\email\bark\gotify`
Other flags--Passed as config overrides (e.g. --tg-bot-tokenTG_BOT_TOKEN)

Presenting Results

When showing subscription data to the user, format JSON responses as readable tables or summaries — don't dump raw JSON. For example, a subscription list should look like a table with name, amount, cycle, next renewal date, and status.

Error Handling

  • Missing env vars: script exits with instructions to create .env
  • 401 Unauthorized: auto re-login and retry (once)
  • API errors: response includes success: false and message explaining what went wrong

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-03-30 16:32 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,480
data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 165 📥 60,029
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 198 📥 65,127