dsh-lawcite-adapter 0.0.0-stage → 0.2.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.
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
package/README-es.md ADDED
@@ -0,0 +1,112 @@
1
+ # dsh-lawcite-adapter
2
+
3
+ **Boundary:** this plugin checks a **法条引用清单** for verifiability and document elements — that each citation
4
+ names its law and article, that the article number follows the Chinese form, that a direct quotation is
5
+ transcribed, that the power status comes from your vocabulary, that the citation states where it is used and what
6
+ it argues, that the document names its title and type, that citation numbers are unique, and that no placeholder
7
+ survives. It does **not** verify that a statute exists, that it is currently in force, that it has not been amended
8
+ or repealed, or that it applies to the case.
9
+
10
+ > ### ⚠️ This plugin does not query a statute database — and that is the point
11
+ >
12
+ > **It cannot find the most consequential error: a citation to a statute or article that does not exist, or that
13
+ > has been repealed.** Confirming that requires the national laws-and-regulations database and the facts of the
14
+ > case, which is a legal professional's work. What this plugin checks is whether a citation left behind the
15
+ > elements needed to verify it — the law, the article, the quoted text, the power status, the purpose.
16
+ >
17
+ > That boundary is stated in the pack's header, in `LC-001`'s, `LC-003`'s and `LC-004`'s notes, and in the
18
+ > troubleshooting section. Read it before acting on any finding: **a clean report from this plugin is not a
19
+ > statement that the citations are correct.**
20
+ >
21
+ > `LC-002` checks the article number's *form* — `第X条` in Chinese or Arabic numerals, allowing `第X条之一` —
22
+ > and nothing about whether the article exists. `LC-003` checks that a quotation is transcribed, not that the
23
+ > transcription matches the statute. `LC-004`'s power-status vocabulary ships **empty** because no statute's
24
+ > current status is built in either.
25
+ >
26
+ > **Every `excerpt` in the rule pack says, in so many words, that the clause text was not obtained.** The regime
27
+ > lives in 《中华人民共和国立法法》, GB/T 9704—2012 and each institution's legal-document review rules. The
28
+ > verification pass could not retrieve verbatim clause text, so the pack states the gap in the `excerpt` field
29
+ > itself and keeps every rule at `warn` or `info`. **When the texts are in hand, replace each `excerpt` with the
30
+ > real clause and raise `kind` to `direct`.**
31
+ >
32
+ > ⚠️ **One basis was corrected rather than completed.** GB/T 9704—2012《党政机关公文格式》 was verified chapter by
33
+ > chapter to be a **layout** standard — paper, typesetting, binding, the placement of document elements and the
34
+ > specimen forms. **It contains no provision about citation management at all.** Six rules had been hung on it
35
+ > anyway ("every citation must name the instrument and the article", "a direct quotation must be transcribed",
36
+ > and so on). Those six now declare **the institution's own legal-document review practice** as their basis, are
37
+ > rated **`institutional-configuration`**, and therefore sit at **`info`** rather than `warn`. Leaving them at
38
+ > `warn` while their own note says "read this as the institution's practice" would have contradicted itself.
39
+ >
40
+ > **`LC-001` was then corrected the same way.** It cited 《中华人民共和国立法法》. That statute was obtained in
41
+ > full and does contain a numbering provision — 第六十五条: 「法律根据内容需要,可以分编、章、节、条、款、项、目」,with
42
+ > numbering rules and an authorisation for the NPC Standing Committee's working body to draft legislative
43
+ > technique rules. But that governs **how a law is itself drafted and numbered**; it says nothing about how an
44
+ > official document cites an existing law. So `LC-001` joins the other seven: **all eight rules in this pack now
45
+ > declare the institution's own review practice as their basis and are rated `institutional-configuration` at
46
+ > `info`.** See `rules/evidence/clause-verification-basis-mismatch.md`.
47
+
48
+ ## Compatibility
49
+
50
+ | Superficie | Estado |
51
+ |---|---|
52
+ | Harness | Rango de peers `>=0.1.2-rc.1 <0.2.0 \|\| >=0.2.0-0 <0.3.0` — verificado para aceptar tanto `0.2.0-rc.2` como `0.2.1-alpha.1`. **No se declara `engines.dsh`**: no tiene lector y no puede rechazar ningún host |
53
+ | Node | `^22.19.0 || >=24.0.0` |
54
+ | Plataformas | Todas (ESM puro; sin código nativo, sin red, sin llamada al modelo) |
55
+ | Modo de herramienta | Funciona en `native`, `ptc` y `both`; para un directorio completo use `ptc` |
56
+
57
+ ## What it does
58
+
59
+ La tabla de reglas, los campos y el comportamiento detallado están en [README.md](README.md#what-it-does) (versión principal en inglés). El plugin sólo enumera divergencias literales frente a las cláusulas citadas e indica en `skipped` cada comprobación que no pudo ejecutarse.
60
+
61
+ ## Install
62
+
63
+ ```sh
64
+ dsh plugin --profile <name> add dsh-lawcite-adapter
65
+ dsh --profile <name> --dump-config | grep 'dsh-lawcite-adapter'
66
+ ```
67
+
68
+ ## Configuration
69
+
70
+ Todos los parámetros ajustables viven en el esquema Schemastery de `src/config.ts`, por lo que se cambian desde `cordis.yml` sin tocar el código; los umbrales por regla están en el paquete de reglas bajo `rules/`.
71
+
72
+ | Clave | Tipo | Predeterminado | Descripción |
73
+ |---|---|---|---|
74
+ | `rulesFile` | string | `rules/lawcite-adapter.yaml` | Ruta del paquete de reglas, relativa a la raíz del paquete |
75
+ | `disabledRules` | string[] | `[]` | Ids de reglas que se dejan de ejecutar; cada una aparece en `skipped` |
76
+ | `onlyRules` | string[] | `[]` | Ejecutar solo estas reglas; vacío ejecuta todas |
77
+ | `skipNotes` | string | `""` | Nota añadida a cada motivo de `skipped` |
78
+ | `timeoutMs` | number | `120000` | Presupuesto de tiempo de espera cooperativo de la herramienta |
79
+
80
+ ## Material format
81
+
82
+ Acepta JSON o YAML. El ejemplo completo de campos está en [README.md](README.md#material-format) (versión principal en inglés). Los campos son opcionales en la capa de lectura y los valida el motor, de modo que una exportación parcial produce hallazgos sobre lo que falta en lugar de un fallo.
83
+
84
+ ## Rule sources
85
+
86
+ Los datos de las reglas están separados del código: cada regla lleva documento, número, cláusula en la numeración propia de la fuente, extracto literal y URL de origen. El cargador impone que el extracto sea una cita real de al menos ocho caracteres y que una comprobación basada sólo en un principio general (`kind: derived-from-principle`, tope `warn`) o en una política local (`kind: institutional-configuration`, tope `info`) nunca se declare `error`.
87
+
88
+ Los límites verificados y las conclusiones deliberadamente **no** afirmadas están en [README.md](README.md#rule-sources) (versión principal en inglés) y en `rules/evidence/`.
89
+
90
+ ## Troubleshooting
91
+
92
+ - **El plugin se instala pero la herramienta no aparece**: compruebe que `main` resuelve a `lib/index.mjs` y que `pnpm run build` lo generó.
93
+ - **`dsh plugin add` rechaza el paquete**: la faixa de peers cubre `0.1.x` y `0.2.x`; fuera de ella, conceda una exención explícita con `dsh plugin --profile <name> allow-version <pkg@ver> --dsh-version <runtime> --accept-risk`.
94
+ - **Una regla no se ejecutó**: lea el arreglo `skipped`.
95
+ - **`check` informa `manifest-peers` como fallo**: es un problema conocido de `dsh-plugin-dev`; el runtime aplica la compatibilidad al instalar.
96
+ - **Los horarios parecen desplazados**: toda la aritmética es de hora local sobre las cadenas entregadas.
97
+
98
+ ## Development
99
+
100
+ ```sh
101
+ pnpm install
102
+ pnpm run typecheck
103
+ pnpm test
104
+ pnpm run build
105
+ node ../scripts/sync-shared.mjs dsh-lawcite-adapter
106
+ ```
107
+
108
+ El último comando copia el kit compartido de `../_shared` a `src/shared/`; vuelva a ejecutarlo tras cada cambio compartido.
109
+
110
+ ## License
111
+
112
+ [Apache License 2.0](LICENSE) © 2026 dsh-lawcite-adapter contributors.
package/README-hi.md ADDED
@@ -0,0 +1,112 @@
1
+ # dsh-lawcite-adapter
2
+
3
+ **Boundary:** this plugin checks a **法条引用清单** for verifiability and document elements — that each citation
4
+ names its law and article, that the article number follows the Chinese form, that a direct quotation is
5
+ transcribed, that the power status comes from your vocabulary, that the citation states where it is used and what
6
+ it argues, that the document names its title and type, that citation numbers are unique, and that no placeholder
7
+ survives. It does **not** verify that a statute exists, that it is currently in force, that it has not been amended
8
+ or repealed, or that it applies to the case.
9
+
10
+ > ### ⚠️ This plugin does not query a statute database — and that is the point
11
+ >
12
+ > **It cannot find the most consequential error: a citation to a statute or article that does not exist, or that
13
+ > has been repealed.** Confirming that requires the national laws-and-regulations database and the facts of the
14
+ > case, which is a legal professional's work. What this plugin checks is whether a citation left behind the
15
+ > elements needed to verify it — the law, the article, the quoted text, the power status, the purpose.
16
+ >
17
+ > That boundary is stated in the pack's header, in `LC-001`'s, `LC-003`'s and `LC-004`'s notes, and in the
18
+ > troubleshooting section. Read it before acting on any finding: **a clean report from this plugin is not a
19
+ > statement that the citations are correct.**
20
+ >
21
+ > `LC-002` checks the article number's *form* — `第X条` in Chinese or Arabic numerals, allowing `第X条之一` —
22
+ > and nothing about whether the article exists. `LC-003` checks that a quotation is transcribed, not that the
23
+ > transcription matches the statute. `LC-004`'s power-status vocabulary ships **empty** because no statute's
24
+ > current status is built in either.
25
+ >
26
+ > **Every `excerpt` in the rule pack says, in so many words, that the clause text was not obtained.** The regime
27
+ > lives in 《中华人民共和国立法法》, GB/T 9704—2012 and each institution's legal-document review rules. The
28
+ > verification pass could not retrieve verbatim clause text, so the pack states the gap in the `excerpt` field
29
+ > itself and keeps every rule at `warn` or `info`. **When the texts are in hand, replace each `excerpt` with the
30
+ > real clause and raise `kind` to `direct`.**
31
+ >
32
+ > ⚠️ **One basis was corrected rather than completed.** GB/T 9704—2012《党政机关公文格式》 was verified chapter by
33
+ > chapter to be a **layout** standard — paper, typesetting, binding, the placement of document elements and the
34
+ > specimen forms. **It contains no provision about citation management at all.** Six rules had been hung on it
35
+ > anyway ("every citation must name the instrument and the article", "a direct quotation must be transcribed",
36
+ > and so on). Those six now declare **the institution's own legal-document review practice** as their basis, are
37
+ > rated **`institutional-configuration`**, and therefore sit at **`info`** rather than `warn`. Leaving them at
38
+ > `warn` while their own note says "read this as the institution's practice" would have contradicted itself.
39
+ >
40
+ > **`LC-001` was then corrected the same way.** It cited 《中华人民共和国立法法》. That statute was obtained in
41
+ > full and does contain a numbering provision — 第六十五条: 「法律根据内容需要,可以分编、章、节、条、款、项、目」,with
42
+ > numbering rules and an authorisation for the NPC Standing Committee's working body to draft legislative
43
+ > technique rules. But that governs **how a law is itself drafted and numbered**; it says nothing about how an
44
+ > official document cites an existing law. So `LC-001` joins the other seven: **all eight rules in this pack now
45
+ > declare the institution's own review practice as their basis and are rated `institutional-configuration` at
46
+ > `info`.** See `rules/evidence/clause-verification-basis-mismatch.md`.
47
+
48
+ ## Compatibility
49
+
50
+ | सतह | स्थिति |
51
+ |---|---|
52
+ | Harness | peer रेंज `>=0.1.2-rc.1 <0.2.0 \|\| >=0.2.0-0 <0.3.0` — `0.2.0-rc.2` और `0.2.1-alpha.1` दोनों को स्वीकार करने के लिए सत्यापित। **`engines.dsh` जानबूझकर घोषित नहीं**: इसका कोई पाठक नहीं और यह किसी होस्ट को अस्वीकार नहीं कर सकता |
53
+ | Node | `^22.19.0 || >=24.0.0` |
54
+ | प्लेटफ़ॉर्म | सभी (शुद्ध ESM; कोई नेटिव कोड नहीं, कोई नेटवर्क नहीं, कोई मॉडल कॉल नहीं) |
55
+ | टूल मोड | `native`, `ptc` और `both` में काम करता है; पूरे फ़ोल्डर के लिए `ptc` चुनें |
56
+
57
+ ## What it does
58
+
59
+ नियम-सूची, फ़ील्ड और विस्तृत व्यवहार [README.md](README.md#what-it-does) (अंग्रेज़ी मुख्य संस्करण) में हैं। यह प्लगइन केवल उद्धृत धाराओं के सामने शाब्दिक अंतर सूचीबद्ध करता है और हर न चल पाई जाँच को `skipped` में बताता है।
60
+
61
+ ## Install
62
+
63
+ ```sh
64
+ dsh plugin --profile <name> add dsh-lawcite-adapter
65
+ dsh --profile <name> --dump-config | grep 'dsh-lawcite-adapter'
66
+ ```
67
+
68
+ ## Configuration
69
+
70
+ सभी समायोज्य पैरामीटर `src/config.ts` की Schemastery स्कीमा में हैं, इसलिए कोड बदले बिना `cordis.yml` से बदले जा सकते हैं; प्रति-नियम सीमाएँ `rules/` के नियम-पैक में हैं।
71
+
72
+ | कुंजी | प्रकार | डिफ़ॉल्ट | विवरण |
73
+ |---|---|---|---|
74
+ | `rulesFile` | string | `rules/lawcite-adapter.yaml` | नियम-पैक का पथ, पैकेज रूट के सापेक्ष |
75
+ | `disabledRules` | string[] | `[]` | बंद करने वाले नियम id; प्रत्येक `skipped` में दिखता है |
76
+ | `onlyRules` | string[] | `[]` | केवल ये नियम चलाएँ; खाली होने पर सभी नियम चलते हैं |
77
+ | `skipNotes` | string | `""` | हर `skipped` कारण के आगे जोड़ी जाने वाली टिप्पणी |
78
+ | `timeoutMs` | number | `120000` | उपकरण का सहकारी समय-सीमा बजट |
79
+
80
+ ## Material format
81
+
82
+ JSON या YAML स्वीकार्य है। पूरा फ़ील्ड उदाहरण [README.md](README.md#material-format) (अंग्रेज़ी मुख्य संस्करण) में है। पढ़ने की परत में फ़ील्ड वैकल्पिक हैं और जाँच इंजन उन्हें सत्यापित करता है, इसलिए आंशिक निर्यात पर क्रैश के बजाय "अनुपस्थित" श्रेणी के निष्कर्ष मिलते हैं।
83
+
84
+ ## Rule sources
85
+
86
+ नियम-डेटा कोड से अलग है: प्रत्येक नियम में दस्तावेज़, संख्या, स्रोत की अपनी क्रमांकन-प्रणाली के अनुसार धारा, शब्दशः उद्धरण और स्रोत URL होता है। लोडर लागू करता है कि उद्धरण कम से कम आठ अक्षरों का वास्तविक उद्धरण हो, और जिस जाँच का आधार केवल सामान्य सिद्धांत (`kind: derived-from-principle`, अधिकतम `warn`) या स्थानीय नीति (`kind: institutional-configuration`, अधिकतम `info`) हो, उसे कभी `error` घोषित न किया जाए।
87
+
88
+ सत्यापित सीमाएँ और जान-बूझकर **न** कहे गए निष्कर्ष [README.md](README.md#rule-sources) (अंग्रेज़ी मुख्य संस्करण) और `rules/evidence/` में हैं।
89
+
90
+ ## Troubleshooting
91
+
92
+ - **प्लगइन इंस्टॉल हो गया पर टूल दिखता नहीं**: जाँचें कि `main` `lib/index.mjs` पर जाता है और `pnpm run build` ने उसे बनाया है।
93
+ - **`dsh plugin add` असंगत बताकर मना करता है**: peer range `0.1.x` और `0.2.x` दोनों को कवर करती है; बाहर होने पर स्पष्ट छूट दें: `dsh plugin --profile <name> allow-version <pkg@ver> --dsh-version <runtime> --accept-risk`।
94
+ - **कोई नियम नहीं चला**: `skipped` सरणी देखें।
95
+ - **`check` में `manifest-peers` विफल दिखता है**: यह `dsh-plugin-dev` की ज्ञात अपस्ट्रीम समस्या है; रनटाइम इंस्टॉल के समय अनुकूलता लागू करता है।
96
+ - **समय खिसका हुआ लगता है**: सारी गणना दिए गए स्ट्रिंग पर वॉल-क्लॉक है।
97
+
98
+ ## Development
99
+
100
+ ```sh
101
+ pnpm install
102
+ pnpm run typecheck
103
+ pnpm test
104
+ pnpm run build
105
+ node ../scripts/sync-shared.mjs dsh-lawcite-adapter
106
+ ```
107
+
108
+ अंतिम कमांड `../_shared` का साझा किट `src/shared/` में कॉपी करता है; हर साझा बदलाव के बाद इसे दोबारा चलाएँ।
109
+
110
+ ## License
111
+
112
+ [Apache License 2.0](LICENSE) © 2026 dsh-lawcite-adapter contributors.
package/README-pt.md ADDED
@@ -0,0 +1,112 @@
1
+ # dsh-lawcite-adapter
2
+
3
+ **Boundary:** this plugin checks a **法条引用清单** for verifiability and document elements — that each citation
4
+ names its law and article, that the article number follows the Chinese form, that a direct quotation is
5
+ transcribed, that the power status comes from your vocabulary, that the citation states where it is used and what
6
+ it argues, that the document names its title and type, that citation numbers are unique, and that no placeholder
7
+ survives. It does **not** verify that a statute exists, that it is currently in force, that it has not been amended
8
+ or repealed, or that it applies to the case.
9
+
10
+ > ### ⚠️ This plugin does not query a statute database — and that is the point
11
+ >
12
+ > **It cannot find the most consequential error: a citation to a statute or article that does not exist, or that
13
+ > has been repealed.** Confirming that requires the national laws-and-regulations database and the facts of the
14
+ > case, which is a legal professional's work. What this plugin checks is whether a citation left behind the
15
+ > elements needed to verify it — the law, the article, the quoted text, the power status, the purpose.
16
+ >
17
+ > That boundary is stated in the pack's header, in `LC-001`'s, `LC-003`'s and `LC-004`'s notes, and in the
18
+ > troubleshooting section. Read it before acting on any finding: **a clean report from this plugin is not a
19
+ > statement that the citations are correct.**
20
+ >
21
+ > `LC-002` checks the article number's *form* — `第X条` in Chinese or Arabic numerals, allowing `第X条之一` —
22
+ > and nothing about whether the article exists. `LC-003` checks that a quotation is transcribed, not that the
23
+ > transcription matches the statute. `LC-004`'s power-status vocabulary ships **empty** because no statute's
24
+ > current status is built in either.
25
+ >
26
+ > **Every `excerpt` in the rule pack says, in so many words, that the clause text was not obtained.** The regime
27
+ > lives in 《中华人民共和国立法法》, GB/T 9704—2012 and each institution's legal-document review rules. The
28
+ > verification pass could not retrieve verbatim clause text, so the pack states the gap in the `excerpt` field
29
+ > itself and keeps every rule at `warn` or `info`. **When the texts are in hand, replace each `excerpt` with the
30
+ > real clause and raise `kind` to `direct`.**
31
+ >
32
+ > ⚠️ **One basis was corrected rather than completed.** GB/T 9704—2012《党政机关公文格式》 was verified chapter by
33
+ > chapter to be a **layout** standard — paper, typesetting, binding, the placement of document elements and the
34
+ > specimen forms. **It contains no provision about citation management at all.** Six rules had been hung on it
35
+ > anyway ("every citation must name the instrument and the article", "a direct quotation must be transcribed",
36
+ > and so on). Those six now declare **the institution's own legal-document review practice** as their basis, are
37
+ > rated **`institutional-configuration`**, and therefore sit at **`info`** rather than `warn`. Leaving them at
38
+ > `warn` while their own note says "read this as the institution's practice" would have contradicted itself.
39
+ >
40
+ > **`LC-001` was then corrected the same way.** It cited 《中华人民共和国立法法》. That statute was obtained in
41
+ > full and does contain a numbering provision — 第六十五条: 「法律根据内容需要,可以分编、章、节、条、款、项、目」,with
42
+ > numbering rules and an authorisation for the NPC Standing Committee's working body to draft legislative
43
+ > technique rules. But that governs **how a law is itself drafted and numbered**; it says nothing about how an
44
+ > official document cites an existing law. So `LC-001` joins the other seven: **all eight rules in this pack now
45
+ > declare the institution's own review practice as their basis and are rated `institutional-configuration` at
46
+ > `info`.** See `rules/evidence/clause-verification-basis-mismatch.md`.
47
+
48
+ ## Compatibility
49
+
50
+ | Superfície | Estado |
51
+ |---|---|
52
+ | Harness | Faixa de peers `>=0.1.2-rc.1 <0.2.0 \|\| >=0.2.0-0 <0.3.0` — verificada para aceitar tanto `0.2.0-rc.2` quanto `0.2.1-alpha.1`. **`engines.dsh` não é declarado**: não tem leitor e não pode recusar nenhum host |
53
+ | Node | `^22.19.0 || >=24.0.0` |
54
+ | Plataformas | Todas (ESM puro; sem código nativo, sem rede, sem chamada ao modelo) |
55
+ | Modo de ferramenta | Funciona em `native`, `ptc` e `both`; para um diretório inteiro use `ptc` |
56
+
57
+ ## What it does
58
+
59
+ A tabela de regras, os campos e o comportamento detalhado estão em [README.md](README.md#what-it-does) (versão principal em inglês). O plugin apenas lista divergências literais frente às cláusulas citadas e indica em `skipped` cada verificação que não pôde ser executada.
60
+
61
+ ## Install
62
+
63
+ ```sh
64
+ dsh plugin --profile <name> add dsh-lawcite-adapter
65
+ dsh --profile <name> --dump-config | grep 'dsh-lawcite-adapter'
66
+ ```
67
+
68
+ ## Configuration
69
+
70
+ Todos os parâmetros ajustáveis ficam no esquema Schemastery de `src/config.ts`, portanto mudam pelo `cordis.yml` sem editar código; os limites por regra ficam no pacote de regras sob `rules/`.
71
+
72
+ | Chave | Tipo | Padrão | Descrição |
73
+ |---|---|---|---|
74
+ | `rulesFile` | string | `rules/lawcite-adapter.yaml` | Caminho do pacote de regras, relativo à raiz do pacote |
75
+ | `disabledRules` | string[] | `[]` | Ids de regras a desativar; cada uma aparece em `skipped` |
76
+ | `onlyRules` | string[] | `[]` | Executar apenas estas regras; vazio executa todas |
77
+ | `skipNotes` | string | `""` | Nota acrescentada a cada motivo de `skipped` |
78
+ | `timeoutMs` | number | `120000` | Orçamento de tempo limite cooperativo da ferramenta |
79
+
80
+ ## Material format
81
+
82
+ Aceita JSON ou YAML. O exemplo completo de campos está em [README.md](README.md#material-format) (versão principal em inglês). Os campos são opcionais na camada de leitura e validados pelo motor, de modo que uma exportação parcial gera achados sobre o que falta em vez de falhar.
83
+
84
+ ## Rule sources
85
+
86
+ Os dados das regras ficam separados do código: cada regra traz documento, número, cláusula na numeração própria da fonte, trecho literal e URL de origem. O carregador impõe que o trecho seja citação real de pelo menos oito caracteres e que uma verificação baseada apenas em princípio geral (`kind: derived-from-principle`, teto `warn`) ou em política local (`kind: institutional-configuration`, teto `info`) nunca seja declarada `error`.
87
+
88
+ Os limites verificados e as conclusões deliberadamente **não** afirmadas estão em [README.md](README.md#rule-sources) (versão principal em inglês) e em `rules/evidence/`.
89
+
90
+ ## Troubleshooting
91
+
92
+ - **O plugin instala mas a ferramenta não aparece**: confirme que `main` resolve para `lib/index.mjs` e que `pnpm run build` o gerou.
93
+ - **`dsh plugin add` recusa o pacote**: a faixa de peers cobre `0.1.x` e `0.2.x`; fora dela, conceda isenção explícita com `dsh plugin --profile <name> allow-version <pkg@ver> --dsh-version <runtime> --accept-risk`.
94
+ - **Uma regra não executou**: leia o arranjo `skipped`.
95
+ - **`check` informa `manifest-peers` como falha**: problema conhecido do `dsh-plugin-dev`; o runtime aplica a compatibilidade na instalação.
96
+ - **Os horários parecem deslocados**: toda a aritmética é de hora local sobre as cadeias fornecidas.
97
+
98
+ ## Development
99
+
100
+ ```sh
101
+ pnpm install
102
+ pnpm run typecheck
103
+ pnpm test
104
+ pnpm run build
105
+ node ../scripts/sync-shared.mjs dsh-lawcite-adapter
106
+ ```
107
+
108
+ O último comando copia o kit compartilhado de `../_shared` para `src/shared/`; execute-o novamente após cada alteração compartilhada.
109
+
110
+ ## License
111
+
112
+ [Apache License 2.0](LICENSE) © 2026 dsh-lawcite-adapter contributors.
package/README-zh.md ADDED
@@ -0,0 +1,112 @@
1
+ # dsh-lawcite-adapter
2
+
3
+ **Boundary:** this plugin checks a **法条引用清单** for verifiability and document elements — that each citation
4
+ names its law and article, that the article number follows the Chinese form, that a direct quotation is
5
+ transcribed, that the power status comes from your vocabulary, that the citation states where it is used and what
6
+ it argues, that the document names its title and type, that citation numbers are unique, and that no placeholder
7
+ survives. It does **not** verify that a statute exists, that it is currently in force, that it has not been amended
8
+ or repealed, or that it applies to the case.
9
+
10
+ > ### ⚠️ This plugin does not query a statute database — and that is the point
11
+ >
12
+ > **It cannot find the most consequential error: a citation to a statute or article that does not exist, or that
13
+ > has been repealed.** Confirming that requires the national laws-and-regulations database and the facts of the
14
+ > case, which is a legal professional's work. What this plugin checks is whether a citation left behind the
15
+ > elements needed to verify it — the law, the article, the quoted text, the power status, the purpose.
16
+ >
17
+ > That boundary is stated in the pack's header, in `LC-001`'s, `LC-003`'s and `LC-004`'s notes, and in the
18
+ > troubleshooting section. Read it before acting on any finding: **a clean report from this plugin is not a
19
+ > statement that the citations are correct.**
20
+ >
21
+ > `LC-002` checks the article number's *form* — `第X条` in Chinese or Arabic numerals, allowing `第X条之一` —
22
+ > and nothing about whether the article exists. `LC-003` checks that a quotation is transcribed, not that the
23
+ > transcription matches the statute. `LC-004`'s power-status vocabulary ships **empty** because no statute's
24
+ > current status is built in either.
25
+ >
26
+ > **Every `excerpt` in the rule pack says, in so many words, that the clause text was not obtained.** The regime
27
+ > lives in 《中华人民共和国立法法》, GB/T 9704—2012 and each institution's legal-document review rules. The
28
+ > verification pass could not retrieve verbatim clause text, so the pack states the gap in the `excerpt` field
29
+ > itself and keeps every rule at `warn` or `info`. **When the texts are in hand, replace each `excerpt` with the
30
+ > real clause and raise `kind` to `direct`.**
31
+ >
32
+ > ⚠️ **One basis was corrected rather than completed.** GB/T 9704—2012《党政机关公文格式》 was verified chapter by
33
+ > chapter to be a **layout** standard — paper, typesetting, binding, the placement of document elements and the
34
+ > specimen forms. **It contains no provision about citation management at all.** Six rules had been hung on it
35
+ > anyway ("every citation must name the instrument and the article", "a direct quotation must be transcribed",
36
+ > and so on). Those six now declare **the institution's own legal-document review practice** as their basis, are
37
+ > rated **`institutional-configuration`**, and therefore sit at **`info`** rather than `warn`. Leaving them at
38
+ > `warn` while their own note says "read this as the institution's practice" would have contradicted itself.
39
+ >
40
+ > **`LC-001` was then corrected the same way.** It cited 《中华人民共和国立法法》. That statute was obtained in
41
+ > full and does contain a numbering provision — 第六十五条: 「法律根据内容需要,可以分编、章、节、条、款、项、目」,with
42
+ > numbering rules and an authorisation for the NPC Standing Committee's working body to draft legislative
43
+ > technique rules. But that governs **how a law is itself drafted and numbered**; it says nothing about how an
44
+ > official document cites an existing law. So `LC-001` joins the other seven: **all eight rules in this pack now
45
+ > declare the institution's own review practice as their basis and are rated `institutional-configuration` at
46
+ > `info`.** See `rules/evidence/clause-verification-basis-mismatch.md`.
47
+
48
+ ## Compatibility
49
+
50
+ | 项目 | 状态 |
51
+ |---|---|
52
+ | Harness | 对等版本范围 `>=0.1.2-rc.1 <0.2.0 \|\| >=0.2.0-0 <0.3.0` —— 已实测同时接受 `0.2.0-rc.2` 与 `0.2.1-alpha.1`。**刻意不声明 `engines.dsh`**:它没有任何读取者,也无法拒装任何宿主 |
53
+ | Node | `^22.19.0 || >=24.0.0` |
54
+ | 平台 | 全平台(纯 ESM;无原生代码、无联网、不调用模型) |
55
+ | 工具模式 | `native` / `ptc` / `both` 均可;批量校验整个目录时建议 `ptc`,schema 成本只付一次 |
56
+
57
+ ## What it does
58
+
59
+ 规则表、字段说明与行为细节见 [README.md](README.md#what-it-does)(英文主版本)。本插件只列出材料与所引条款之间的字面差异,并对无法执行的检查在 `skipped` 中逐项说明。
60
+
61
+ ## Install
62
+
63
+ ```sh
64
+ dsh plugin --profile <name> add dsh-lawcite-adapter
65
+ dsh --profile <name> --dump-config | grep 'dsh-lawcite-adapter'
66
+ ```
67
+
68
+ ## Configuration
69
+
70
+ 全部可调参数都在 `src/config.ts` 的 Schemastery schema 中,只改 `cordis.yml` 即可生效,无需改代码;逐条阈值在 `rules/` 下的规则库文件里。
71
+
72
+ | 键 | 类型 | 默认值 | 说明 |
73
+ |---|---|---|---|
74
+ | `rulesFile` | string | `rules/lawcite-adapter.yaml` | 规则库文件路径,相对插件包根目录 |
75
+ | `disabledRules` | string[] | `[]` | 要停用的规则 id 列表;每条都会出现在 `skipped` 中 |
76
+ | `onlyRules` | string[] | `[]` | 只执行这些规则 id;留空表示执行全部规则 |
77
+ | `skipNotes` | string | `""` | 附加到每条 `skipped` 说明后的备注 |
78
+ | `timeoutMs` | number | `120000` | 工具协作式超时预算(毫秒) |
79
+
80
+ ## Material format
81
+
82
+ 支持 JSON 与 YAML。完整字段示例见 [README.md](README.md#material-format)(英文主版本)。字段在读取层是可选的,由检查引擎校验,因此部分导出的材料会产生"缺项"类差异,而不是让程序崩溃。
83
+
84
+ ## Rule sources
85
+
86
+ 规则数据与代码分离,每条规则都带文件名、文号、按原文自身编号体系的条款号、逐字摘录与来源地址。加载期强制:摘录必须是真实引文且不少于八个字符;依据仅为原则性条款(`kind: derived-from-principle`,严重级上限 `warn`)或本机构配置(`kind: institutional-configuration`,上限 `info`)的检查不得标为 `error`。夸大依据的规则库会在加载期失败,而不会产出一份看起来很有底气的报告。
87
+
88
+ 核验中确认的边界与"刻意没有作出的结论"见 [README.md](README.md#rule-sources)(英文主版本)与随包的 `rules/evidence/` 目录。
89
+
90
+ ## Troubleshooting
91
+
92
+ - **插件装上了但工具不出现**:确认 `main` 指向 `lib/index.mjs` 且 `pnpm run build` 已生成该文件;`main` 写错会让加载器静默跳过该条目。
93
+ - **`dsh plugin add` 报版本不兼容**:peer 范围覆盖 `0.1.x` 与 `0.2.x`;若运行时在其之外,可显式豁免:`dsh plugin --profile <name> allow-version <包名@版本> --dsh-version <runtime> --accept-risk`
94
+ - **某条规则没有执行**:查看 `skipped` 数组,其中写明了规则 id 与原因。
95
+ - **`check` 报 `manifest-peers` 失败**:静态检查器比对的是一份早于 0.2 世代的硬编码 peer 范围;安装期的 peer 校验以运行时为准。这是 `dsh-plugin-dev` 的已知上游问题。
96
+ - **时间看起来偏移**:全部计算都是对输入字符串做墙上时钟运算,不做时区换算。
97
+
98
+ ## Development
99
+
100
+ ```sh
101
+ pnpm install
102
+ pnpm run typecheck
103
+ pnpm test
104
+ pnpm run build
105
+ node ../scripts/sync-shared.mjs dsh-lawcite-adapter
106
+ ```
107
+
108
+ 第 4 项把 `../_shared` 的共享件同步进 `src/shared/`;每次改动共享件后都要重跑。
109
+
110
+ ## License
111
+
112
+ [Apache License 2.0](LICENSE) © 2026 dsh-lawcite-adapter contributors.
package/README.md CHANGED
@@ -1,3 +1,163 @@
1
- # Temporary Holding Version
1
+ # dsh-lawcite-adapter
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
+ **Boundary:** this plugin checks a **法条引用清单** for verifiability and document elements — that each citation
4
+ names its law and article, that the article number follows the Chinese form, that a direct quotation is
5
+ transcribed, that the power status comes from your vocabulary, that the citation states where it is used and what
6
+ it argues, that the document names its title and type, that citation numbers are unique, and that no placeholder
7
+ survives. It does **not** verify that a statute exists, that it is currently in force, that it has not been amended
8
+ or repealed, or that it applies to the case.
9
+
10
+ > ### ⚠️ This plugin does not query a statute database — and that is the point
11
+ >
12
+ > **It cannot find the most consequential error: a citation to a statute or article that does not exist, or that
13
+ > has been repealed.** Confirming that requires the national laws-and-regulations database and the facts of the
14
+ > case, which is a legal professional's work. What this plugin checks is whether a citation left behind the
15
+ > elements needed to verify it — the law, the article, the quoted text, the power status, the purpose.
16
+ >
17
+ > That boundary is stated in the pack's header, in `LC-001`'s, `LC-003`'s and `LC-004`'s notes, and in the
18
+ > troubleshooting section. Read it before acting on any finding: **a clean report from this plugin is not a
19
+ > statement that the citations are correct.**
20
+ >
21
+ > `LC-002` checks the article number's *form* — `第X条` in Chinese or Arabic numerals, allowing `第X条之一` —
22
+ > and nothing about whether the article exists. `LC-003` checks that a quotation is transcribed, not that the
23
+ > transcription matches the statute. `LC-004`'s power-status vocabulary ships **empty** because no statute's
24
+ > current status is built in either.
25
+ >
26
+ > **Every `excerpt` in the rule pack says, in so many words, that the clause text was not obtained.** The regime
27
+ > lives in 《中华人民共和国立法法》, GB/T 9704—2012 and each institution's legal-document review rules. The
28
+ > verification pass could not retrieve verbatim clause text, so the pack states the gap in the `excerpt` field
29
+ > itself and keeps every rule at `warn` or `info`. **When the texts are in hand, replace each `excerpt` with the
30
+ > real clause and raise `kind` to `direct`.**
31
+ >
32
+ > ⚠️ **One basis was corrected rather than completed.** GB/T 9704—2012《党政机关公文格式》 was verified chapter by
33
+ > chapter to be a **layout** standard — paper, typesetting, binding, the placement of document elements and the
34
+ > specimen forms. **It contains no provision about citation management at all.** Six rules had been hung on it
35
+ > anyway ("every citation must name the instrument and the article", "a direct quotation must be transcribed",
36
+ > and so on). Those six now declare **the institution's own legal-document review practice** as their basis, are
37
+ > rated **`institutional-configuration`**, and therefore sit at **`info`** rather than `warn`. Leaving them at
38
+ > `warn` while their own note says "read this as the institution's practice" would have contradicted itself.
39
+ >
40
+ > **`LC-001` was then corrected the same way.** It cited 《中华人民共和国立法法》. That statute was obtained in
41
+ > full and does contain a numbering provision — 第六十五条: 「法律根据内容需要,可以分编、章、节、条、款、项、目」,with
42
+ > numbering rules and an authorisation for the NPC Standing Committee's working body to draft legislative
43
+ > technique rules. But that governs **how a law is itself drafted and numbered**; it says nothing about how an
44
+ > official document cites an existing law. So `LC-001` joins the other seven: **all eight rules in this pack now
45
+ > declare the institution's own review practice as their basis and are rated `institutional-configuration` at
46
+ > `info`.** See `rules/evidence/clause-verification-basis-mismatch.md`.
47
+
48
+ ## Compatibility
49
+
50
+ | Surface | Status |
51
+ |---|---|
52
+ | Harness | Peer range `>=0.1.2-rc.1 <0.2.0 \|\| >=0.2.0-0 <0.3.0` — verified to accept both `0.2.0-rc.2` and `0.2.1-alpha.1`. `engines.dsh` is deliberately not declared: it has no reader and cannot reject a host |
53
+ | Node | `^22.19.0 || >=24.0.0` |
54
+ | Platforms | All (plain ESM; no native code, no network, no model call) |
55
+ | Tool mode | Works in `native`, `ptc` and `both`; for a long submission use `ptc` |
56
+
57
+ ## What it does
58
+
59
+ Registers the `lawcite_adapter` tool. It reads one citation inventory — the document header plus one row per
60
+ citation — applies a versioned rule pack, and returns a report.
61
+
62
+ | Rule | Check | Severity | Basis kind |
63
+ |---|---|---|---|
64
+ | `LC-001` | the law name and article number are stated | warn | principle |
65
+ | `LC-002` | the article number follows the Chinese form | warn | principle |
66
+ | `LC-003` | a direct quotation is transcribed | warn | principle |
67
+ | `LC-004` | the power status comes from your vocabulary (off by default) | info | local |
68
+ | `LC-005` | the citation states its location and purpose | warn | principle |
69
+ | `LC-006` | the document names its title and type | warn | principle |
70
+ | `LC-007` | citation numbers are unique | warn | principle |
71
+ | `LC-008` | the quotation column holds no unreplaced placeholder | warn | principle |
72
+
73
+ ## Install
74
+
75
+ ```sh
76
+ dsh plugin --profile <name> add dsh-lawcite-adapter
77
+ dsh --profile <name> --dump-config | grep 'dsh-lawcite-adapter'
78
+ ```
79
+
80
+ ## Configuration
81
+
82
+ | Key | Type | Default | Description |
83
+ |---|---|---|---|
84
+ | `rulesFile` | string | `rules/lawcite-adapter.yaml` | Rule-pack path, relative to the package root |
85
+ | `disabledRules` | string[] | `[]` | Rule ids to stop running; each appears in `skipped` |
86
+ | `onlyRules` | string[] | `[]` | Run only these rule ids; empty runs every rule |
87
+ | `skipNotes` | string | `""` | Note appended to every `skipped` reason |
88
+ | `timeoutMs` | number | `120000` | Cooperative tool timeout budget |
89
+
90
+ Rule-level parameters worth knowing:
91
+
92
+ - `LC-002` `pattern` — the article number's shape, `第[〇零一二三四五六七八九十百千0-9]+条` plus an optional
93
+ `之一`, by default. Adjust it if your house style writes numbers differently.
94
+ - `LC-004` `values` — your power-status vocabulary, e.g. `[现行有效, 已修订, 已废止, 尚未生效]`. Empty means no
95
+ check, and **no statute's current status is built in either**.
96
+ - `LC-008` `terms` — the placeholders to look for. 「略」 is deliberately absent: `……(略)` is a normal way to
97
+ abridge a long quotation.
98
+
99
+ ## Material format
100
+
101
+ The tool accepts JSON or YAML:
102
+
103
+ ```yaml
104
+ documentTitle: 某某买卖合同纠纷起诉状
105
+ documentType: 民事起诉状
106
+ author: 王律师
107
+ draftedAt: 2026-05-12
108
+ rows:
109
+ - { 序号: '1', 法律法规名称: 《中华人民共和国民法典》, 条号: 第五百七十七条,
110
+ 引用原文: 当事人一方不履行合同义务或者履行合同义务不符合约定的,应当承担继续履行、采取补救措施或者赔偿损失等违约责任。,
111
+ 引用位置: 第 2 部分 诉讼请求的事实与理由(第三段),
112
+ 论证作用: 作为被告违约责任请求权的法律依据,
113
+ 效力状态: 现行有效, 版本说明: 2020 年 5 月 28 日通过,2021 年 1 月 1 日施行, 引用格式: 脚注① }
114
+ ```
115
+
116
+ Column names are matched case-insensitively and ignoring spaces, underscores and hyphens; the inventory's own
117
+ column names are kept, so a finding names the column it read. Article numbers may use Chinese or Arabic numerals;
118
+ a spaced Arabic form like `第 577 条` is reported so the house style stays consistent.
119
+
120
+ ## Rule sources
121
+
122
+ Rule data lives in `rules/lawcite-adapter.yaml`. Its header explains that the plugin holds no statute database and
123
+ verifies neither existence nor validity, and each rule's `note` repeats the part that matters for that rule. The
124
+ load-time guard still requires a document, clause, excerpt and source per rule, and still forbids a
125
+ principle-derived or locally configured check from being `error`.
126
+
127
+ ## Troubleshooting
128
+
129
+ - **It passed a citation to a repealed statute.** By design: it checks that the citation is *verifiable*, never
130
+ that it is *correct*. Verifying needs the national database, which the plugin does not query.
131
+ - **`LC-003` passed a quotation that is not what the statute says.** It checks that a quotation is *present*.
132
+ Comparing it against the statute is the verification step it deliberately omits.
133
+ - **`LC-002` fires on a form I consider acceptable.** Adjust `pattern` to your house style. Note that paragraph
134
+ and item numbers belong in their own columns here, so `第 12 条第 3 款` should put `第 12 条` in the article
135
+ column.
136
+ - **`LC-004` never runs.** Its vocabulary is empty, and no statute's status is built in.
137
+ - **`LC-007` fires on one article cited twice.** Citing the same provision in several sections is normal — give
138
+ each citation its own number, or the footnotes cannot locate them apart.
139
+ - **The plugin installs but the tool never appears.** Check that `main` resolves to `lib/index.mjs` and
140
+ that `pnpm run build` produced it; a wrong `main` makes the loader skip the entry silently.
141
+ - **`dsh plugin add` refuses the package as incompatible.** The peer range covers `0.1.x` and `0.2.x`; if
142
+ your runtime sits outside it, grant an explicit exemption:
143
+ `dsh plugin --profile <name> allow-version dsh-lawcite-adapter@0.1.0 --dsh-version <runtime> --accept-risk`
144
+ - **`check` reports `manifest-peers` as failed.** The static checker compares against a hard-coded peer
145
+ range that predates the 0.2 line. The runtime enforces peer compatibility at install time, so the
146
+ declared range is the correct one; this is a known upstream issue in `dsh-plugin-dev`.
147
+
148
+ ## Development
149
+
150
+ ```sh
151
+ pnpm install
152
+ pnpm run typecheck # tsc --noEmit
153
+ pnpm test # vitest, the shared table-plugin suite plus paired fixtures
154
+ pnpm run build # tsdown -> lib/index.mjs + lib/index.d.mts
155
+ node ../scripts/sync-shared.mjs dsh-lawcite-adapter # refresh src/shared from ../_shared
156
+ ```
157
+
158
+ The plugin is **data-only**: `src/model.ts` declares the table shape, the shared kit supplies the reader and the
159
+ check engine, and the rule pack declares every check.
160
+
161
+ ## License
162
+
163
+ [Apache License 2.0](LICENSE) © 2026 dsh-lawcite-adapter contributors.