SuperAPI AI Directory

wecomcli-doc

General & other

View repository

Updated 10-16 09:30

About this skill

wecom-cli is a tool provided by the plugin, not a terminal command: all operations are completed by calling this tool, and parameters should be passed using args . It is prohibited to use it through command-line methods such as exec / shell / terminal.

⚠️ Prerequisite: Before calling wecom-cli for the first time, the prerequisite check must be performed according to the wecomcli-preflight skill to ensure the tool has been added to the whitelist.

WeCom doc document management

Resource-type skill, responsible for creating, importing, and reading/writing content of doc documents (doc).

Scope of application

Applicable

  • Create / import WeCom doc documents
  • Read doc document content
  • Append a line to a doc document / overwrite a doc document

Not applicable

  • Search documents / modify document permissions / rename / add members → use wecomcli-doc-manage

Routing for easily confused scenarios

  • User says "create document / write document / organize into a document" and does not specify the doc type → use wecomcli-smartpage(smart document is the default)
  • The link provided by the user is https://doc.weixin.qq.com/smartpage/... or https://page.weixin.qq.com/smartpage/... → use wecomcli-smartpage
  • If the encountered docid starts with a1 or b1 (in the form a1_xxxx, b1_xxxx) → use wecomcli-smartpage

API routing table

If the second column of the routing table is a references/xxx.md link → you must first use the read tool to finish reading the file, and then construct the command.

User intent Reference location
Create a doc document (online) See "Create doc document" below
Import a local file as a WeCom doc document See "Import doc document" below
Read doc document content See "Read doc document content" below
Append text to the end of a doc document +contents-append
Fully overwrite doc document content +contents-overwrite

Write semantics determination (append vs overwrite)

  • Default append: when the user uses neutral verbs such as "write / write to / record / supplement / add in / make a note", and does not explicitly require clearing or replacing, always use append(append, without destroying the original content).
  • Explicit overwrite only: only when the user explicitly uses strong semantic words such as "overwrite / rewrite / replace / clear and rewrite / replace the whole thing" should overwrite。

API details

Create doc document

Creating a WeCom doc document uniformly follows the two-step process of "generate .docx → import":

  1. Generate .docx file: generate the +doc-create file according to .docx .
  2. Import as a WeCom doc document: use the "Import doc document" API below to import the generated .docx file as a WeCom doc document. Note that during import, file_name should be consistent with the document title.

Import doc document

Import a local file (.doc / .docx / .txt) as a WeCom doc document.

How to call

Use the wecom-cli tool to call in the following format

wecom-cli doc import --json '<JSON 参数>'

Parameter

Field Type Required Default value Description
doc_type string Yes doc Fixed to doc(doc document)
file_name string Yes — Binary file name (including extension), used for business determination of the source file type
file_path string Yes — Local absolute path of the source file
passwd string No — Office file encryption password (if any)

Returns

Field Type Description
docid string Document ID after import is complete
url string Access link after import is complete
task_status string Task status enum, e.g., succ success

Read doc document content

Readdoc document's document content.

How to call

Use the wecom-cli tool to call in the following format

wecom-cli doc contents get --json '<JSON 参数>'

Parameter

Field Type Required Default value Description
docid string Yes — doc document ID
content_type string No markdown Returned content format enum:text / markdown / ooxml;

Returns

Field Type Description
url string Document access link
name string Document name
content string Original text returned directly when the document content is short
file_path string Automatically saved to disk when the document content is longLocal file path; the text in the path must be read with the Read tool before display
document object content_type=ooxml document object returned when
version int Document version number

Cross-skill dependency

Dependent skill When to trigger What to do with the depended-on skill
wecomcli-doc-manage The user only provides a document name/keyword, and it is necessary to first get docid before reading or writing content Use the wecomcli-doc-manage skill to search documents and get the docid
wecomcli-smartpage After reading doc document content, the user requests \"make it a smart document / format it as a smartpage\" Use the wecomcli-smartpage skill to generate a smart document

Missing parameters / docid ambiguous scenarios such as multiple search candidates; use concise natural language to ask only about missing or ambiguous information; when there are candidates, list them in the text for the user to choose, and do not guess on your own.

docid Usage rules

docidFor CLI use only. When finally displaying to the user, do not show docid, but use the document URL:

[doc_name](doc_url)

docid is the unique identifier of the document and must be provided when calling any skill that operates on document content. Creating docidon your own is prohibited; obtain it in the following priority order:

  1. Extract from the document link (preferred): when the user provides a WeCom document URL, parse it directly from the URL. The URL format is https://doc.weixin.qq.com/<type>/<docid>?scode=..., take the part after /<type>/ and before? as the docid.
  2. Obtain through document search (alternative): when the user only provides a document name or keyword and no link, first call wecomcli-doc-manage to search documents, and take from the returned results the docid。
  3. User directly provides: The user explicitly gave the complete docid, which can be used directly without further extraction or search.