npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

miaoda-cli

v1.0.2

Published

秒哒 (Miaoda) Node.js CLI — chat-driven full-stack app builder

Readme

miaoda-cli (WorkBuddy skill)

WorkBuddy skill wrapping the 秒哒 (Miaoda) platform. Login uses OAuth2 Device Authorization Grant (RFC 8628), mirroring the cnb-skill / tencentmeeting-cli convention already used by WorkBuddy.

Requirements

  • Node.js ≥ 18 (built-in fetch, AbortController)

Install

cd node-cli
npm install
npm link          # optional: expose `miaoda` globally

Login / status / logout

miaoda login              # opens browser, prints the device code and returns
miaoda login --no-browser # just prints the URL, no auto-open
miaoda login --debug      # verbose device-auth trace

miaoda status             # single-shot token exchange attempt; re-run until approved (auto-refreshes if expired)
miaoda logout             # delete ~/.miaoda/token

Token is stored at ~/.miaoda/token (mode 0600):

{
  "access_token": "...",
  "refresh_token": "...",
  "expires_at": 1770000000,
  "platform_url": "https://www.miaoda.cn",
  "client_id": "miaoda_cli",
  "login_host": "https://www.miaoda.cn"
}

Token resolution order

  1. WorkBuddy sandbox — when AGENTOS_RUNTIME_ID is set, token is fetched from the URL in WORKBUDDY_TOKEN_URL_MIAODA_APP (WorkBuddy-managed, no local file involved).
  2. MIAODA_TOKEN_FOR_CODEBUDDY — set by the CodeBuddy NPC runtime.
  3. MIAODA_TOKEN — plain env var override (CI/automation), no expiry check.
  4. ~/.miaoda/token file — normal interactive login; auto-refreshes via refresh_token when expired, prompts re-login when refresh fails.

Exit codes follow the cnb-skill convention: 0 on success, 1 on any failure (auth required, refresh failed, API error, etc).

Project layout

node-cli/
├── bin/miaoda.js              CLI entry (commander)
├── src/
│   ├── api.js                 Miaoda platform HTTP client (chat/publish/...)
│   ├── exit-code.js           Shared exit-code constants
│   ├── commands/
│   │   ├── login.js           Device authorization grant flow
│   │   ├── logout.js          Delete ~/.miaoda/token
│   │   └── status.js          Check login state, auto-refresh
│   └── utils/
│       ├── token-path.js      ~/.miaoda/token path
│       ├── load-token.js / save-token.js
│       ├── mask-token.js      Redact tokens in --debug output
│       ├── open-browser.js    Cross-platform `open`/`xdg-open`/`start`
│       ├── request-device-code.js   POST /oauth2/device/auth
│       ├── do-token-request.js      Single POST /oauth2/token attempt
│       ├── poll-token.js            RFC 8628 §3.4/3.5 single exchange attempt (no loop)
│       ├── refresh-token.js         POST grant_type=refresh_token
│       ├── get-token.js             Sync token getter (legacy/back-compat)
│       ├── is-workbuddy-sandbox.js  AGENTOS_RUNTIME_ID detection
│       ├── get-token-env-key.js     WORKBUDDY_TOKEN_URL_<CONNECTOR> naming
│       ├── resolve-token-source.js  4-tier token source resolution
│       ├── resolve-token.js         Resolve + auto-refresh + exit(1) on failure
│       ├── resolve-api-domain.js    Pick API domain (login_host vs override)
│       └── device-auth.js           Barrel re-export of the above
└── SKILL.md                   WorkBuddy skill descriptor

Supported commands

login / logout / status
list-apps               [--brief] [--name] [--page] [--size]
app-detail              --app-id [--no-context]
chat                    --text [--app-id --context-id] [--no-stream] [--prompt-generate]
generate-app            [--app-id] [--context-id] [--watch]
trajectory              --app-id [--last-event-id]
fetch-trajectory        --app-id [--last-event-id]
get-context-id          --app-id
conversation-history    --app-id [--full] [--limit]
publish                 --app-id [--wait]
publish-status          --release-id

Each command supports --help.

Application lifecycle (summary)

chat → (PRD refinement) → generate-app --watch → publish --wait
                                                      ↓
                             https://<app_id>.appmiaoda.com

After generation, iterate by re-issuing chat --app-id ... --context-id .... Never re-run generate-app for the same app.

Placeholders to confirm with the platform team

The device-auth endpoints in src/utils/request-device-code.js / poll-token.js / refresh-token.js assume:

  • POST {platformUrl}/oauth2/device/auth returns { device_code, user_code, verification_uri, verification_uri_complete, expires_in, interval }
  • POST {platformUrl}/oauth2/token with grant_type=urn:ietf:params:oauth:grant-type:device_code returns { access_token, refresh_token, expires_in, token_type, scope } on success, or { error, error_description } with authorization_pending / slow_down / access_denied / expired_token while pending.

Update these three files once the real Miaoda OAuth endpoint paths/fields are confirmed — the polling state machine and exit-code behavior do not need to change.