Introduction¶
When handling government-related conversations or workflows in DSH, the interface and prompt can be set up quickly. However, the drafts often remain in a “plain text + manual memory of national standards” state: remembering to add parentheses for document numbers, colons for the main recipient, paragraph indentation, title font size, and page numbers still requires manually checking against GB/T 9704 National Standard for the Format of Official Documents of Party and Government Organs item by item. dsh-gov-doc-router is a host-side workflow plugin that registers a tool named gov_doc_check for the model: it reads the draft body, checks item by item against high-frequency rules in the national standard, automatically fixes issues that can be determined (without fabricating content, entity names, or dates), and exports a properly formatted .docx. It does not generate the body text, does not handle approval workflows, and does not connect to government intranet interfaces.
Plugin Positioning¶
- Name:
@liuhange/dsh-gov-doc-router(Repository: liuhange789/dsh-gov-doc-router) - Maintainer: liuhange789
- Category: Workflow (DSH Community Directory: skillhub plugin page)
- Current Version (package.json): 0.1.1
- License: MIT
In a nutshell: Format Check + Auto Fix + Compliant Word Export, targeting GB/T 9704, rather than a generic official document writing assistant.
Core Features¶
Tool gov_doc_check¶
After the plugin is installed, the model can call gov_doc_check to perform two tasks on the official document draft you provide:
- Text Layer: Identify headers, document numbers, addressees, body text, attachment descriptions, signatures, and CCs line by line. Write format problems into
issues, and writefixed_contentandfix_summarywithout fabricating content. - Export Layer: Generate a
.docxthat complies with rules for the content area, fonts, line spacing, page numbers, etc. Since these items cannot be reliably determined in plain text, they do not appear inissuesbut are explained by the return fieldapplied_export_rulesindicating “applied during export.”
Supported document types (doc_type): Request (请示) / Report (报告) / Notice (通知) / Letter (函) / Minutes (纪要) / Bulletin (通报). Used to validate whether the title contains the document type and to participate in the export filename.
Text layer rule examples (excerpt): Document number years use six-angle brackets 〔〕, the date of enactment uses Arabic numerals without zero-padding for months and days, full-width colons for addressee/attachments/CCs, left indentation of two characters at the beginning of paragraphs in the body, hierarchy numbering formats, etc.; if the signature is missing the entity or date, only an error is reported, not a fix. Export layer examples include the No. 2 Xiaobiaosong header centered, the No. 3 FangSong_GB2312 body with a fixed 28pt line spacing, and page numbers (odd right, even left), etc. As stated in the README, “Upper document” alignment (e.g., “indented one character from the left, same line as the approver”) has not yet been implemented.
Explicitly Not Supported Capabilities¶
Does not check for typos, appropriateness of document type selection, content logic, or secrecy levels and urgency; does not generate body text, fill in entity names or dates, or guess attachment names. Drafts formatted with “first line indent 2 characters” in Word may trigger a body.indent error in pure text conversion, but the exported docx format is still set according to national standards.
The date of enactment follows GB/T 9704-2012 7.3.5, in the format 2026年11月16日, etc. If your unit has an internal standard, you need to modify formatDate in the source code yourself (see repository src/core/parse.js).
Installation and Activation¶
The official installation command is as follows (do not use the github:owner/repo concatenation method not appearing in the documentation):
dsh plugin --profile default add @liuhange/dsh-gov-doc-router
For local development, you can create a soft link to a local directory (the README example is a Windows path; replace with your actual path):
dsh plugin --profile default add D:\dsh-gov-doc-router
The plugin comes with cordis.patch.yml. Once installed, the plugin is registered automatically; manual modification of the patch is generally not required:
- insert:
- id: gov-doc-router
name: '@liuhange/dsh-gov-doc-router'
Optional Configuration: Output directory. If left empty, it writes to the current working directory; ~ can be expanded to the user’s home directory.
- id: gov-doc-router
config:
outputDir: '~/Documents/公文'
Runtime environment: Node >=20; peer dependencies include @deepseek-ai/dsh-tools and @deepseek-ai/schemastery (version ranges see package.json).
Typical Usage¶
After installation, you can use natural language to let the model process it, for example:
Help me check the format of this request and export a docx.
And attach the draft body, for example:
窗口标题:关于开展2026年度安全生产大检查的请示
应急〔2026〕08号
各街道办事处:
为深入贯彻……
The main parameters when the model calls gov_doc_check are as follows:
| Parameter | Required | Description |
|---|---|---|
content |
Yes | Draft of the official document, plain text or Markdown |
doc_type |
Yes | One of the six document types mentioned above |
output_path |
No | Full path ending in .docx, otherwise a directory; empty uses outputDir. Supports ~; files with the same name will be suffixed with (1), (2), etc., and will not silently overwrite |
The returned JSON contains issues, fixed_content, fix_summary, download_url (local absolute path, forward slashes), applied_export_rules, stats, etc. download_url can be opened directly in Word; the default filename uses the local time down to the millisecond to avoid duplicate names during short-term multiple exports.
Applicable Scenarios and Notes¶
Suitable for: Developers or implementation staff who have already written government/format related workflows in DSH, need to apply GB/T 9704 formatting to drafts produced by the model, and wish to reduce manual work on font sizes, indentation, and page numbers.
Please be aware before use:
- The plugin reads and writes local files under the permissions of the current DSH process; before installing, you should read the source code and the MIT license in the repository to ensure the output directory and data processing method comply with your organization’s security requirements.
- Parsing uses heuristic line-based splitting for structure;
Shift+Enterline breaks in Word are treated as independent paragraphs. For complex layouts, it is recommended to organize them into clear line-based plain text before checking. - The DSH Community Directory (such as skillhub.cn) is an independent ecosystem site with no official affiliation with DeepSeek or Huafang; plugin stars and versions follow the repository and directory page (0 stars on GitHub at the time of writing).
Development and Verification¶
Maintainers can run:
npm test
This will first esbuild bundle lib/index.js, and then run 31 tests, covering text rules, idempotent auto-fix and “no fabrication” constraints, and assertions for unpacking the .docx XML.
Separating the “draft alignment with national standards + exporting docx” from manual typesetting is a common step in such government workflows; dsh-gov-doc-router binds the text repair checklist and Word formatting together with a single tool call. For more details, see GitHub README and Community Directory Page.