
wecomcli-shared
PopularCommon pre-checks, bot/authorized user identity retrieval, and universal output constraints for wecom-cli business skills. Any wecomcli-* skill must read this skill before executing wecom-cli commands to check if the CLI is installed, the version is at least 1.1.0, and WeCom credentials are authorized; installation or initialization is performed only when missing, outdated, or unauthorized. This skill also defines universal constraints prohibiting the exposure of ID-type fields. This skill does not handle specific business requests.
Related Skills
Common pre-checks, bot/authorized user identity retrieval, and universal output constraints for wecom-cli business skills. Any wecomcli-* skill must read this skill before executing wecom-cli commands to check if the CLI is installed, the version is at least 1.1.0, and WeCom credentials are authorized; installation or initialization is performed only when missing, outdated, or unauthorized. This skill also defines universal constraints prohibiting the exposure of ID-type fields. This skill does not handle specific business requests.
wecom-cli Common Pre-checks
This skill provides CLI installation, version, and authorization checks shared by all wecomcli-* business skills, along with universal output constraints. Complete this skill before executing any wecom-cli command every time; after passing checks, return to the corresponding business skill to execute.
This skill cannot replace specific business skills. When processing requests for contacts, documents, spreadsheets, schedules, meetings, to-dos, emails, WeDrive, messages, or media, you must read the corresponding business skill simultaneously.
Step 1: Check CLI Installation and Version
wecom-cli --version
- Command succeeds, and the version in the output is at least
1.1.0→ Proceed to Step 2. - Command does not exist, errors out, or version is lower than
1.1.0→ Perform installation/upgrade:
npm install -g @wecom/cli
After installation completes, re-run wecom-cli --version; if it still fails or the version remains lower than 1.1.0, stop business operations and inform the user of the error.
Step 2: Check Authorization Status
wecom-cli auth show --status
- Output is
authorized→ Pre-checks complete; you may execute specific business commands. - Output is
unauthorized→ Execute Step 3. - Command errors out or output is not one of the above statuses → Stop business operations and inform the user of the error; do not guess the authorization status.
Step 3: Initialize Credentials (Only When Unauthorized)
wecom-cli auth init --noninteractive
This command will display an authorization link and QR code, waiting for the user to scan with WeCom. Once authorized, the command exits automatically. Initialization is required only once.
After initialization completes, re-run:
wecom-cli auth show --status
Proceed to execute specific business commands only when the output is authorized.
Universal Output Constraints: Prohibition of Exposing ID-Type Fields
This constraint applies to all wecomcli-* skills, takes precedence over the output format of individual business skills, and is not relaxed even if the user explicitly requests them.
- Prohibited: Your final response must not contain ID identifiers such as
userid/open_vid/department_id/chat_id. Any internal identifiers returned by API calls (includingmail_id/media_id/file_id/space_id/folder_id/docid/content_id/msg_id/cursor/next_cursor, or any field ending in_idor semantically belonging to machine identifiers) can only be used internally for subsequent API calls. - Required: Your thinking process and final responses must use readable names, such as content returned in
tool_resultlikename/username/external_username/ department name / email /subject/doc_name/chat_name/title. - If the API returns only an ID without a readable name, call the corresponding skill first (such as
wecomcli-contactto resolve personnel) to exchange for a readable name. If it truly cannot be exchanged, describe the object using natural language (e.g., "the previous daily report email", "the file you just uploaded") and never fall back to displaying the ID. - When the user needs to select among multiple candidates, construct a candidate list using index numbers + readable information (name / subject / time / path, etc.). Do not use IDs as a basis for user identification.
- If the user directly asks to "give me the ID" or "print mail_id", explain that the identifier is an internal field that cannot be provided, and instead use readable information or assist them in completing the actual operation.
- Human-readable links (such as document
doc_urlor WeDrive sharing links) are not subject to this constraint and can be displayed normally according to each business skill's rules, even if the link itself contains identifier strings.
Execution Rules
- Do not repeatedly install or initialize if CLI is installed, the version meets requirements, and it is authorized.
- Do not execute subsequent business commands if installation, upgrade, initialization, or re-check fails.
- This skill does not define any API parameters for contacts, documents, spreadsheets, schedules, meetings, to-dos, emails, WeDrive, messages, or media; specific commands must be retrieved from the corresponding business skills.
- When executing any business command and composing replies, comply with the "Universal Output Constraints: Prohibition of Exposing ID-Type Fields" above.
Retrieve Personal Identity
If the workflow requires getting the identity (name, userid, etc.) of the bot or the authorizing user, invoke wecom-cli identity whoami to retrieve it.





