dsh-source-cnki 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/LICENSE +201 -0
  3. package/README-zh.md +106 -0
  4. package/README.md +105 -2
  5. package/cordis.patch.yml +17 -0
  6. package/lib/cite.d.ts +33 -0
  7. package/lib/cite.d.ts.map +1 -0
  8. package/lib/cite.js +117 -0
  9. package/lib/cite.js.map +1 -0
  10. package/lib/config.d.ts +32 -0
  11. package/lib/config.d.ts.map +1 -0
  12. package/lib/config.js +44 -0
  13. package/lib/config.js.map +1 -0
  14. package/lib/formats.d.ts +61 -0
  15. package/lib/formats.d.ts.map +1 -0
  16. package/lib/formats.js +217 -0
  17. package/lib/formats.js.map +1 -0
  18. package/lib/index.d.ts +39 -0
  19. package/lib/index.d.ts.map +1 -0
  20. package/lib/index.js +51 -0
  21. package/lib/index.js.map +1 -0
  22. package/lib/runtime.d.ts +84 -0
  23. package/lib/runtime.d.ts.map +1 -0
  24. package/lib/runtime.js +228 -0
  25. package/lib/runtime.js.map +1 -0
  26. package/lib/tools/cnki-check.d.ts +12 -0
  27. package/lib/tools/cnki-check.d.ts.map +1 -0
  28. package/lib/tools/cnki-check.js +56 -0
  29. package/lib/tools/cnki-check.js.map +1 -0
  30. package/lib/tools/cnki-cite.d.ts +12 -0
  31. package/lib/tools/cnki-cite.d.ts.map +1 -0
  32. package/lib/tools/cnki-cite.js +62 -0
  33. package/lib/tools/cnki-cite.js.map +1 -0
  34. package/lib/tools/cnki-import.d.ts +12 -0
  35. package/lib/tools/cnki-import.d.ts.map +1 -0
  36. package/lib/tools/cnki-import.js +75 -0
  37. package/lib/tools/cnki-import.js.map +1 -0
  38. package/lib/tools/shared.d.ts +20 -0
  39. package/lib/tools/shared.d.ts.map +1 -0
  40. package/lib/tools/shared.js +14 -0
  41. package/lib/tools/shared.js.map +1 -0
  42. package/lib/validate.d.ts +29 -0
  43. package/lib/validate.d.ts.map +1 -0
  44. package/lib/validate.js +51 -0
  45. package/lib/validate.js.map +1 -0
  46. package/lib/version.d.ts +7 -0
  47. package/lib/version.d.ts.map +1 -0
  48. package/lib/version.js +7 -0
  49. package/lib/version.js.map +1 -0
  50. package/package.json +79 -4
  51. package/src/cite.ts +124 -0
  52. package/src/config.ts +64 -0
  53. package/src/formats.ts +236 -0
  54. package/src/index.ts +62 -0
  55. package/src/runtime.ts +254 -0
  56. package/src/tools/cnki-check.ts +56 -0
  57. package/src/tools/cnki-cite.ts +62 -0
  58. package/src/tools/cnki-import.ts +74 -0
  59. package/src/tools/shared.ts +14 -0
  60. package/src/validate.ts +65 -0
  61. package/src/version.ts +7 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,48 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
5
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ### Fixed
10
+
11
+ - `cnki_cite`/`cnki_check` now validate imported record objects and return
12
+ `INVALID_INPUT` for malformed JSON payloads instead of throwing a `TypeError`.
13
+ - `cnki_import` rejects non-string `text` and unknown `format` values at the
14
+ runtime boundary; `cnki_cite` rejects `startIndex < 1`.
15
+ - The implausible-year check used a hard-coded upper bound of 2100; it now
16
+ accepts the current year plus one and rejects genuinely far-future dates.
17
+ - RIS and labeled parsers normalize CRLF/CR line endings and strip a leading
18
+ UTF-8 BOM. Windows-authored exports previously produced zero records (RIS) or
19
+ lost the first field (labeled).
20
+
21
+ ### Added
22
+
23
+ - Tests for malformed records, `null` text, invalid `startIndex`, symlink
24
+ escape, far-future years, CRLF/BOM exports, and the function-plugin mount
25
+ contract (23 tests total).
26
+
27
+ ## [0.1.0] - 2026-11-08
28
+
29
+ First release: Chinese-literature export import and citation formatting.
30
+
31
+ ### Added
32
+
33
+ - `cnki_import`: RIS/EndNote-style and labeled (`题名:`) export parsing,
34
+ stable record ids (DOI-based when available), language detection, and
35
+ structural validation; the export becomes REP evidence when persisted.
36
+ - `cnki_cite`: GB/T 7714-2015 顺序编码制 (with or without `[n]`) and APA 7,
37
+ including the ≤3 / >3 author rules and `等` / `et al` handling.
38
+ - `cnki_check`: structural issues (missing fields, implausible year, malformed
39
+ DOI, odd pages, duplicates).
40
+ - 18 tests.
41
+
42
+ ### Notes
43
+
44
+ - **No CNKI access of any kind**: no login, no scraping, no CNKI API. The user
45
+ exports; the plugin parses. This is a deliberate scope and licensing decision,
46
+ not a missing feature.
47
+ - Missing fields are reported, never invented.
48
+ - GB/T 著者-出版年制 and `[J/OL]`/`[EB/OL]` carriers are out of scope in v0.1.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README-zh.md ADDED
@@ -0,0 +1,106 @@
1
+ # dsh-source-cnki
2
+
3
+ **中文文献记录:导入你自己的导出文件,按 GB/T 7714 引用,检查元数据——全程不抓取 CNKI。**
4
+
5
+ *不登录、不抓取、不调用 CNKI API(该用途没有公开 API)。插件读取 RIS/EndNote 风格或带标签的文本导出,分配稳定的记录 id,按 GB/T 7714-2015(顺序编码制)或 APA 7 排版,并做结构校验。*
6
+
7
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
8
+ [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24.9-brightgreen.svg)]()
9
+
10
+ [English](README.md) · 简体中文
11
+
12
+ ---
13
+
14
+ ## 范围说明(请先阅读)
15
+
16
+ CNKI 没有面向此用途的公开 API。因此本插件**不会**登录、抓取或绕过任何访问控制。记录由你自行导出(RIS/EndNote 风格标签文本,或带 `题名:`/`作者:`/`来源:` 的标签文本),插件只在这份导出上工作。如果导出缺少某个字段,插件会明确说“缺失”,绝不会凭空编造期刊、年份、卷、页码或 DOI。
17
+
18
+ ## 它做什么
19
+
20
+ - **`cnki_import`** — 解析 RIS/EndNote 风格和带标签的文本导出,分配稳定的 `recordId`(有 DOI 时基于 DOI,否则基于标题+年份),识别语言并校验结构。开启 `persist` 时,导出会成为 REP 证据。
21
+ - **`cnki_cite`** — 支持 GB/T 7714-2015 顺序编码制(`[1] 作者. 题名[J]. 刊名, 年, 卷(期): 页码.`)、同样格式但不带编号,或 APA 7。作者规则:GB/T 在作者不超过 3 位时全部列出,否则列前 3 位 + `等`/`et al`;西文姓名转为 `SURNAME I`;APA 转为 `Surname, I.`。
22
+ - **`cnki_check`** — 结构校验:缺少标题/期刊/年份/作者、年份不合理、DOI 格式错误、页码非数字、重复记录,以及有期刊但没有卷或期。
23
+
24
+ ## 它不做什么
25
+
26
+ - **不访问 CNKI。** 不登录、不使用 cookie、不抓取、不调用非官方端点。
27
+ - **不核实内容。** 不检查记录与真实论文是否一致;DOI 核验请用 `dsh-cite-verify`。
28
+ - **不提供语义字段。** 没有被引次数、影响因子或基金编号。
29
+ - **不处理 DOCX/PDF。** 请导出为 RIS/带标签文本(PDF 文本提取用 `dsh-doc-anchor`)。
30
+ - **不宣称覆盖 GB/T 的全部情形。** 该标准存在变体(著者-出版年制、[EB/OL] 载体、带 URL 的 [J/OL]);v0.1 实现常见的期刊/学位论文/会议/图书情形,并如实说明这一点。
31
+
32
+ ## 格式
33
+
34
+ | 格式 | 可识别内容 |
35
+ |---|---|
36
+ | RIS/EndNote | `TY`、`AU`、`TI`、`JO`、`PY`、`VL`、`IS`、`SP`、`EP`、`DO`、`KW`、`AB`、`ER`(每个字段以第一个标签为准,作者累加) |
37
+ | 带标签文本 | `题名`/`标题`/`篇名`、`作者`、`来源`/`刊名`、`年`/`发表时间`、`卷`、`期`、`页码`、`DOI`、`关键词`、`摘要`、`类型`;空行分隔记录 |
38
+
39
+ 未知标签会被忽略,不做猜测。
40
+
41
+ ## 工具
42
+
43
+ ### `cnki_import`
44
+
45
+ `{ text? | path?, format?, persist? }` → `{ ok, records, validation, evidenceId?, recordPath? }`.
46
+
47
+ ### `cnki_cite`
48
+
49
+ `{ records, style?, startIndex? }` → `{ ok, citations, text }`.
50
+
51
+ ### `cnki_check`
52
+
53
+ `{ records }` → `{ ok, validation }`.
54
+
55
+ ### 错误码
56
+
57
+ `INVALID_INPUT` · `NOT_FOUND` · `PATH_ESCAPE` · `NOT_A_FILE` · `TOO_LARGE` · `UNSUPPORTED_FILE` · `NO_RECORDS` · `STORE_ERROR`
58
+
59
+ ## 兼容性与安装
60
+
61
+ | | |
62
+ |---|---|
63
+ | DeepSeek Harness | **`dsh-v0.2.1-rc.5`**(2026-11-08 实测);peer `>=0.2.1-0 <0.3.0 \|\| >=0.2.2-0 <0.3.0` |
64
+ | Node | `^22.19.0 \|\| >=24.9.0`(实测 `24.22.1`),仅 ESM |
65
+ | Peer 依赖 | `@perrylink/dsh-research-core ^0.1.0`、`@deepseek-ai/cordis ^4.0.5-alpha.1`、`@deepseek-ai/dsh-tools`、`@deepseek-ai/schemastery ^3.18.5-alpha.1` |
66
+ | 运行时依赖 | **零** |
67
+
68
+ ```sh
69
+ dsh plugin --profile <name> add @perrylink/dsh-research-core dsh-source-cnki
70
+ dsh --profile <name> --dump-config | grep dsh-source-cnki
71
+ ```
72
+
73
+ ## 配置
74
+
75
+ | 键 | 默认值 | 含义 |
76
+ |---|---|---|
77
+ | `enabled` | `true` | `false` 时不挂载任何内容 |
78
+ | `root` | `.source-cnki` | 存储/记录根目录 |
79
+ | `workspaceRoot` | `process.cwd()` | 路径必须解析到该目录内 |
80
+ | `maxChars` | `2000000` | 导出文件上限(超限即失败,绝不截断) |
81
+ | `persist` | `true` | 把导出存为 REP 证据 + 记录 |
82
+ | `style` | `gbt7714-numeric` | 默认引用格式 |
83
+
84
+ ## 安全边界
85
+
86
+ - 完全无网络:不访问 CNKI,不做 DOI 解析,不上报遥测。
87
+ - 对导出文件只读;只在 `root` 下写入。
88
+ - `realpath` 包含性校验;DOCX/PDF 会被拒绝并给出转换提示。
89
+ - 导出文件视为数据。标题或摘要中的指令性文本永远不会被执行(没有执行器)。
90
+
91
+ ## 评测
92
+
93
+ **23 个测试**:RIS 与带标签解析(中英文记录、CRLF/BOM 导出、基于 DOI 的 id、语言识别)、自动格式识别与空内容/无法识别内容的拒绝、GB/T 期刊引用(页码使用 en dash 连接)、≤3 位与 >3 位作者规则(等 / et al)、缺期刊标记、学位论文标记、顺序编号、APA 的作者/年份/期刊/卷/DOI、校验代码(缺标题/期刊、不合理年份(含极远未来日期)、DOI 格式错误、页码异常、重复)、运行时(有效 REP 记录、cite/check、路径穿越/符号链接/DOCX/超大文件拒绝、畸形记录与 `null` 文本拒绝)、工具 schema、import→cite→check 端到端、失败分支、插件契约、包契约。
94
+
95
+ 不宣称任何基准成绩:基准真值就是你的导出文件;格式化器的正确性按上面的 GB/T 规则用 fixture 校验。
96
+
97
+ ## 已知限制(v0.1)
98
+
99
+ - 未实现 GB/T 7714 著者-出版年制、`[J/OL]`/`[EB/OL]` 载体以及英文期刊缩写规则。
100
+ - 会议与图书记录复用 `journal` 字段存放会议录/出版社信息(导出格式通常没有独立字段)。
101
+ - 解析按行进行;带标签导出中折了很多行的摘要可能并入上一个字段。
102
+ - 除导出文件本身包含的内容外,不保留 CNKI 记录 id(`CNKI:`/`DBID`)。
103
+
104
+ ## 许可
105
+
106
+ Apache-2.0。运行时零第三方代码。
package/README.md CHANGED
@@ -1,3 +1,106 @@
1
- # Temporary Holding Version
1
+ # dsh-source-cnki
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Chinese-literature records: import your export, cite it in GB/T 7714, check the metadata — without scraping CNKI.**
4
+
5
+ *No login, no scraping, no CNKI API (none is public for this purpose). The plugin reads RIS/EndNote-style or labeled text exports, assigns stable record ids, formats GB/T 7714-2015 (顺序编码制) or APA 7, and runs structural validation.*
6
+
7
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
8
+ [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24.9-brightgreen.svg)]()
9
+
10
+ English · [简体中文](README-zh.md)
11
+
12
+ ---
13
+
14
+ ## Scope decision (read first)
15
+
16
+ CNKI has no public API for this purpose. This plugin therefore **does not** log in, scrape, or bypass any access control. You export the records yourself (RIS/EndNote-style tagged text, or labeled text with `题名:`/`作者:`/`来源:`), and the plugin works on that export. If your export lacks a field, the plugin says "missing" — it never invents a journal, year, volume, page range or DOI.
17
+
18
+ ## What it does
19
+
20
+ - **`cnki_import`** — parses RIS/EndNote-style and labeled text exports, assigns a stable `recordId` (DOI-based when present, otherwise title+year), detects language, and validates structure. The export becomes REP evidence when `persist` is on.
21
+ - **`cnki_cite`** — GB/T 7714-2015 顺序编码制 (`[1] 作者. 题名[J]. 刊名, 年, 卷(期): 页码.`), the same without numbering, or APA 7. Author rules: GB/T ≤3 all, otherwise first 3 + `等`/`et al`; Western names become `SURNAME I`; APA becomes `Surname, I.`.
22
+ - **`cnki_check`** — structural validation: missing title/journal/year/authors, implausible year, malformed DOI, non-numeric pages, duplicates, journal without volume or issue.
23
+
24
+ ## What it does not do
25
+
26
+ - **No CNKI access.** No login, no cookies, no scraping, no unofficial endpoints.
27
+ - **No content verification.** It does not check that the record matches the real paper; use `dsh-cite-verify` for DOIs.
28
+ - **No semantic fields.** No cited-by counts, impact factors or fund numbers.
29
+ - **No DOCX/PDF.** Export as RIS/labeled text (PDF text extraction: `dsh-doc-anchor`).
30
+ - **No claim of GB/T completeness.** Variants exist (著者-出版年制, [EB/OL] carriers, [J/OL] with URLs); v0.1 implements the common journal/thesis/conference/book cases and says so.
31
+
32
+ ## Formats
33
+
34
+ | Format | Recognized |
35
+ |---|---|
36
+ | RIS/EndNote | `TY`, `AU`, `TI`, `JO`, `PY`, `VL`, `IS`, `SP`, `EP`, `DO`, `KW`, `AB`, `ER` (first tag wins per field, authors accumulate) |
37
+ | Labeled text | `题名`/`标题`/`篇名`, `作者`, `来源`/`刊名`, `年`/`发表时间`, `卷`, `期`, `页码`, `DOI`, `关键词`, `摘要`, `类型`; blank line separates records |
38
+
39
+ Unknown tags are ignored, not guessed.
40
+
41
+ ## Tools
42
+
43
+ ### `cnki_import`
44
+
45
+ `{ text? | path?, format?, persist? }` → `{ ok, records, validation, evidenceId?, recordPath? }`.
46
+
47
+ ### `cnki_cite`
48
+
49
+ `{ records, style?, startIndex? }` → `{ ok, citations, text }`.
50
+
51
+ ### `cnki_check`
52
+
53
+ `{ records }` → `{ ok, validation }`.
54
+
55
+ ### Error codes
56
+
57
+ `INVALID_INPUT` · `NOT_FOUND` · `PATH_ESCAPE` · `NOT_A_FILE` · `TOO_LARGE` · `UNSUPPORTED_FILE` · `NO_RECORDS` · `STORE_ERROR`
58
+
59
+ ## Compatibility & install
60
+
61
+ | | |
62
+ |---|---|
63
+ | DeepSeek Harness | **`dsh-v0.2.1-rc.5`** (verified 2026-11-08); peer `>=0.2.1-0 <0.3.0 \|\| >=0.2.2-0 <0.3.0` |
64
+ | Node | `^22.19.0 \|\| >=24.9.0` (tested `24.22.1`), ESM only |
65
+ | Peers | `@perrylink/dsh-research-core ^0.1.0`, `@deepseek-ai/cordis ^4.0.5-alpha.1`, `@deepseek-ai/dsh-tools`, `@deepseek-ai/schemastery ^3.18.5-alpha.1` |
66
+ | Runtime dependencies | **zero** |
67
+
68
+ ```sh
69
+ dsh plugin --profile <name> add @perrylink/dsh-research-core dsh-source-cnki
70
+ dsh --profile <name> --dump-config | grep dsh-source-cnki
71
+ ```
72
+
73
+ ## Configuration
74
+
75
+ | Key | Default | Meaning |
76
+ |---|---|---|
77
+ | `enabled` | `true` | `false` mounts nothing |
78
+ | `root` | `.source-cnki` | store/record root |
79
+ | `workspaceRoot` | `process.cwd()` | paths must resolve inside it |
80
+ | `maxChars` | `2000000` | export cap (fails, never truncates) |
81
+ | `persist` | `true` | store the export as REP evidence + record |
82
+ | `style` | `gbt7714-numeric` | default citation style |
83
+
84
+ ## Security boundaries
85
+
86
+ - No network at all: no CNKI, no DOI resolution, no telemetry.
87
+ - Read-only on the export; writes only under `root`.
88
+ - `realpath` containment; DOCX/PDF rejected with a conversion hint.
89
+ - The export is data. Instruction-like text inside a title or abstract is never executed (there is no executor).
90
+
91
+ ## Evaluation
92
+
93
+ **23 tests**: RIS and labeled parsing (Chinese and English records, CRLF/BOM exports, DOI-based ids, language detection), auto-detection and empty/unrecognized rejection, GB/T journal citation with en-dash pages, ≤3 vs >3 author rules (等 / et al), missing-journal marker, thesis marker, sequential numbering, APA author/year/journal/volume/DOI, validation codes (missing title/journal, implausible year including far-future dates, malformed DOI, odd pages, duplicates), runtime (valid REP record, cite/check, traversal/symlink/DOCX/oversize rejection, malformed records and `null` text rejected), tool schemas, import→cite→check end to end, failure branches, plugin contract, package contract.
94
+
95
+ No benchmark is claimed: the ground truth is your export; correctness of the formatter is checked against the GB/T rules above with fixtures.
96
+
97
+ ## Known limitations (v0.1)
98
+
99
+ - GB/T 7714 著者-出版年制, `[J/OL]`/`[EB/OL]` carriers and English journal abbreviation rules are not implemented.
100
+ - Conference and book records reuse the `journal` field for proceedings/publisher (the export formats rarely carry separate fields).
101
+ - Parsing is line-oriented; deeply wrapped multi-line abstracts in labeled exports may merge into the previous field.
102
+ - No CNKI record id (`CNKI:`/`DBID`) retention beyond what the export contains.
103
+
104
+ ## License
105
+
106
+ Apache-2.0. No third-party runtime code.
@@ -0,0 +1,17 @@
1
+ # dsh-source-cnki bundle patch: mount the Chinese-literature tools.
2
+ #
3
+ # Every key below is a Config field (Schemastery schema); invalid values fail the
4
+ # profile load loudly. Local export parsing only: no login, no scraping, no CNKI
5
+ # API (none is public for this purpose).
6
+ - insert:
7
+ - id: dsh-source-cnki
8
+ name: dsh-source-cnki
9
+ config:
10
+ enabled: true
11
+ root: .source-cnki
12
+ # Character cap for an export: over-limit fails, never truncates.
13
+ maxChars: 2000000
14
+ # Store the parsed export as REP evidence + record.
15
+ persist: true
16
+ # Default citation style.
17
+ style: gbt7714-numeric
package/lib/cite.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Citation formatting: GB/T 7714-2015 (顺序编码制) and APA 7th.
3
+ *
4
+ * Only fields present in the record are emitted — nothing is invented (no
5
+ * publisher, place or page range is guessed). The README lists the mapping and
6
+ * the simplifications.
7
+ *
8
+ * @module dsh-source-cnki/cite
9
+ */
10
+ import type { BibRecord } from './formats.ts';
11
+ /** Citation styles. */
12
+ export type CiteStyle = 'gbt7714' | 'gbt7714-numeric' | 'apa';
13
+ /** Formatting options. */
14
+ export interface CiteOptions {
15
+ readonly style?: CiteStyle;
16
+ /** First number for the numeric style (default 1). */
17
+ readonly startIndex?: number;
18
+ }
19
+ /**
20
+ * Format one citation.
21
+ * @param record - the record.
22
+ * @param options - style and starting number.
23
+ * @returns the formatted citation.
24
+ */
25
+ export declare function formatCitation(record: BibRecord, options?: CiteOptions): string;
26
+ /**
27
+ * Format a bibliography.
28
+ * @param records - the records, in citation order.
29
+ * @param options - style and starting number.
30
+ * @returns one formatted string per record.
31
+ */
32
+ export declare function formatBibliography(records: readonly BibRecord[], options?: CiteOptions): string[];
33
+ //# sourceMappingURL=cite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cite.d.ts","sourceRoot":"","sources":["../src/cite.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,uBAAuB;AACvB,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,KAAK,CAAA;AAE7D,0BAA0B;AAC1B,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAC7B;AAqDD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAiCnF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,EAAE,CAGrG"}
package/lib/cite.js ADDED
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Citation formatting: GB/T 7714-2015 (顺序编码制) and APA 7th.
3
+ *
4
+ * Only fields present in the record are emitted — nothing is invented (no
5
+ * publisher, place or page range is guessed). The README lists the mapping and
6
+ * the simplifications.
7
+ *
8
+ * @module dsh-source-cnki/cite
9
+ */
10
+ /** True for a mostly-ASCII name (treated as Western). */
11
+ function isWestern(name) {
12
+ return /^[\x20-\x7E.]+$/u.test(name) && /[A-Za-z]/u.test(name);
13
+ }
14
+ /** Convert "John Smith" to "SMITH J" (GB/T style), otherwise keep. */
15
+ function gbtAuthor(name) {
16
+ const trimmed = name.trim();
17
+ if (!isWestern(trimmed))
18
+ return trimmed;
19
+ const parts = trimmed.split(/\s+/u).filter(Boolean);
20
+ if (parts.length === 1)
21
+ return parts[0].toUpperCase();
22
+ const surname = parts.at(-1);
23
+ const initials = parts.slice(0, -1).map(part => part[0].toUpperCase()).join(' ');
24
+ return `${surname.toUpperCase()} ${initials}`;
25
+ }
26
+ /** Author list for GB/T: ≤3 all, else first 3 + 等 / et al. */
27
+ function gbtAuthors(record) {
28
+ const names = record.authors.map(gbtAuthor);
29
+ if (names.length === 0)
30
+ return '[佚名]';
31
+ if (names.length <= 3)
32
+ return names.join(', ');
33
+ return `${names.slice(0, 3).join(', ')}, ${record.language === 'zh' ? '等' : 'et al'}`;
34
+ }
35
+ /** Author list for APA: "Surname, I. I., & Surname, I. I.". */
36
+ function apaAuthors(record) {
37
+ if (record.authors.length === 0)
38
+ return 'Anonymous';
39
+ const formatted = record.authors.map(name => {
40
+ const trimmed = name.trim();
41
+ if (!isWestern(trimmed))
42
+ return trimmed;
43
+ const parts = trimmed.split(/\s+/u).filter(Boolean);
44
+ const surname = parts.at(-1);
45
+ const initials = parts.slice(0, -1).map(part => `${part[0].toUpperCase()}.`).join(' ');
46
+ return `${surname}, ${initials}`;
47
+ });
48
+ if (formatted.length === 1)
49
+ return formatted[0];
50
+ if (formatted.length === 2)
51
+ return `${formatted[0]}, & ${formatted[1]}`;
52
+ return `${formatted.slice(0, -1).join(', ')}, & ${formatted.at(-1)}`;
53
+ }
54
+ /** Page range with an en dash. */
55
+ function pagesOf(record) {
56
+ if (record.pages === undefined)
57
+ return undefined;
58
+ return record.pages.replace(/-/gu, '–');
59
+ }
60
+ /** GB/T 7714 type marker. */
61
+ function gbtType(record) {
62
+ return record.type === 'journal' ? 'J' : record.type === 'thesis' ? 'D' : record.type === 'conference' ? 'C' : record.type === 'book' ? 'M' : 'Z';
63
+ }
64
+ /**
65
+ * Format one citation.
66
+ * @param record - the record.
67
+ * @param options - style and starting number.
68
+ * @returns the formatted citation.
69
+ */
70
+ export function formatCitation(record, options = {}) {
71
+ const style = options.style ?? 'gbt7714-numeric';
72
+ if (style === 'apa') {
73
+ const year = record.year === undefined ? 'n.d.' : String(record.year);
74
+ const source = record.journal === undefined ? '' : `*${record.journal}*`;
75
+ const volume = record.volume === undefined ? '' : record.volume;
76
+ const issue = record.issue === undefined ? '' : `(${record.issue})`;
77
+ const pages = pagesOf(record) === undefined ? '' : `, ${pagesOf(record)}`;
78
+ const doi = record.doi === undefined ? '' : ` https://doi.org/${record.doi}`;
79
+ const tail = source === '' ? '' : `, ${volume}${issue}${pages}.`;
80
+ return `${apaAuthors(record)} (${year}). ${record.title}.${tail === '' ? '' : ` ${source}${tail}`}${doi}`.replace(/\s+/gu, ' ').trim();
81
+ }
82
+ const authors = gbtAuthors(record);
83
+ const year = record.year === undefined ? '[出版年不详]' : String(record.year);
84
+ let source;
85
+ if (record.type === 'thesis') {
86
+ source = `${record.journal ?? '[学校不详]'}, ${year}`;
87
+ }
88
+ else if (record.type === 'conference') {
89
+ source = `${record.journal ?? '[会议名称不详]'}, ${year}`;
90
+ }
91
+ else if (record.type === 'book') {
92
+ source = `${record.journal ?? '[出版者不详]'}, ${year}`;
93
+ }
94
+ else {
95
+ const volumePart = record.volume === undefined ? '' : `, ${record.volume}`;
96
+ const issuePart = record.issue === undefined ? '' : `(${record.issue})`;
97
+ const pagesPart = record.pages === undefined ? '' : `: ${pagesOf(record)}`;
98
+ const journal = record.journal ?? '[刊名不详]';
99
+ // GB/T order: 刊名, 年, 卷(期): 页码.
100
+ source = `${journal}, ${year}${volumePart}${issuePart}${pagesPart}`;
101
+ }
102
+ const doi = record.doi === undefined ? '' : ` DOI: ${record.doi}.`;
103
+ const base = `${authors}. ${record.title}[${gbtType(record)}]. ${source}.${doi}`;
104
+ const index = options.startIndex ?? 1;
105
+ return style === 'gbt7714-numeric' ? `[${index}] ${base}` : base;
106
+ }
107
+ /**
108
+ * Format a bibliography.
109
+ * @param records - the records, in citation order.
110
+ * @param options - style and starting number.
111
+ * @returns one formatted string per record.
112
+ */
113
+ export function formatBibliography(records, options = {}) {
114
+ const start = options.startIndex ?? 1;
115
+ return records.map((record, index) => formatCitation(record, { ...options, startIndex: start + index }));
116
+ }
117
+ //# sourceMappingURL=cite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cite.js","sourceRoot":"","sources":["../src/cite.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,yDAAyD;AACzD,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAChE,CAAC;AAED,sEAAsE;AACtE,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAC3B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAA;IACvC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACn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