dsh-contract-stance 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 +15 -0
- package/README-es.md +101 -0
- package/README-hi.md +101 -0
- package/README-pt.md +101 -0
- package/README-zh.md +101 -0
- package/README.md +146 -2
- package/cordis.patch.yml +8 -0
- package/icon.svg +6 -0
- package/lib/index.d.mts +52 -0
- package/lib/index.mjs +2715 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +88 -4
- package/rules/citations-baseline.json +4 -0
- package/rules/contract-stance.yaml +206 -0
- package/rules/evidence/clause-verification-civilcode-contract-book.md +115 -0
- package/rules/evidence/clause-verification-civilcode-contract.md +83 -0
- package/rules/evidence/clause-verification.md +108 -0
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,101 @@
|
|
|
1
|
+
# dsh-contract-stance
|
|
2
|
+
|
|
3
|
+
**Boundary:** this plugin checks a **合同条款立场台账** for what a register can be held to — that each clause's
|
|
4
|
+
text is recorded, that your stance comes from your vocabulary, that the risk grade does too, that a must-have
|
|
5
|
+
clause records both a fallback position and an owner, that clause numbers are unique, that the register names
|
|
6
|
+
the contract and your side, and that no placeholder survives. It does **not** decide whether a clause should be
|
|
7
|
+
accepted, whether a risk is bearable, whether to sign, or whether a negotiating strategy is sound. **Those
|
|
8
|
+
depend on the deal, the counterparty's leverage and your own risk appetite.**
|
|
9
|
+
|
|
10
|
+
> ### ⚠️ What the citation rests on — and one thing this plugin must never be given
|
|
11
|
+
>
|
|
12
|
+
> **《中华人民共和国民法典》was obtained and read verbatim**, and `rules/evidence/clause-verification.md`
|
|
13
|
+
> records what was quoted: article 465 (a contract lawfully formed is protected by law), article 470 (contract
|
|
14
|
+
> content **一般包括** the parties, subject matter, quantity, quality, price, performance terms and liability for
|
|
15
|
+
> breach), article 509, article 577 (the consequences of breach) and article 584 (damages include expected
|
|
16
|
+
> profits but are capped by **foreseeability**).
|
|
17
|
+
>
|
|
18
|
+
> **The contract part does not regulate a negotiation register.** It governs formation, validity, performance and
|
|
19
|
+
> liability; the register's columns come from your enterprise's own contract management rules. So the `excerpt`
|
|
20
|
+
> fields still say "本次未取得" and every rule stays `warn` or `info`: **"this column is blank" must not be read
|
|
21
|
+
> as "this breaches the Civil Code".** Note also that article 470 says **一般包括**, not 应当包括 — one more
|
|
22
|
+
> reason `CS-001` does not claim a direct obligation.
|
|
23
|
+
>
|
|
24
|
+
> ⚠️ **Do not add a limitation-period rule to this plugin.** The Code *does* fix numbers — article 188 sets a
|
|
25
|
+
> three-year limitation (twenty years at the outside) and article 203 rolls a period forward off a public
|
|
26
|
+
> holiday — which makes "just compare the dates" look tempting. It is not workable here: the period runs from
|
|
27
|
+
> **when the creditor knew or ought to have known** of the harm and the debtor, a finding of fact the register
|
|
28
|
+
> does not record; the period is also subject to suspension (article 194) and interruption (article 195), and
|
|
29
|
+
> article 196 lists claims the limitation does not apply to at all. A date-arithmetic rule would dress a factual
|
|
30
|
+
> finding up as a calculation, which is precisely the over-claim this family avoids.
|
|
31
|
+
>
|
|
32
|
+
> **No judgement about the substance of a clause is made anywhere in this plugin.** It reads your own columns
|
|
33
|
+
> and checks only that they are filled and drawn from your vocabulary. Two vocabularies ship **empty** — the
|
|
34
|
+
> stance list (`CS-002`) and the risk grades (`CS-003`) — so with nothing configured those rules report
|
|
35
|
+
> themselves in `skipped` rather than passing quietly.
|
|
36
|
+
|
|
37
|
+
## Compatibility
|
|
38
|
+
|
|
39
|
+
| Superficie | Estado |
|
|
40
|
+
|---|---|
|
|
41
|
+
| 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 |
|
|
42
|
+
| Node | `^22.19.0 || >=24.0.0` |
|
|
43
|
+
| Plataformas | Todas (ESM puro; sin código nativo, sin red, sin llamada al modelo) |
|
|
44
|
+
| Modo de herramienta | Funciona en `native`, `ptc` y `both`; para un directorio completo use `ptc` |
|
|
45
|
+
|
|
46
|
+
## What it does
|
|
47
|
+
|
|
48
|
+
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.
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
dsh plugin --profile <name> add dsh-contract-stance
|
|
54
|
+
dsh --profile <name> --dump-config | grep 'dsh-contract-stance'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
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/`.
|
|
60
|
+
|
|
61
|
+
| Clave | Tipo | Predeterminado | Descripción |
|
|
62
|
+
|---|---|---|---|
|
|
63
|
+
| `rulesFile` | string | `rules/contract-stance.yaml` | Ruta del paquete de reglas, relativa a la raíz del paquete |
|
|
64
|
+
| `disabledRules` | string[] | `[]` | Ids de reglas que se dejan de ejecutar; cada una aparece en `skipped` |
|
|
65
|
+
| `onlyRules` | string[] | `[]` | Ejecutar solo estas reglas; vacío ejecuta todas |
|
|
66
|
+
| `skipNotes` | string | `""` | Nota añadida a cada motivo de `skipped` |
|
|
67
|
+
| `timeoutMs` | number | `120000` | Presupuesto de tiempo de espera cooperativo de la herramienta |
|
|
68
|
+
|
|
69
|
+
## Material format
|
|
70
|
+
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
## Rule sources
|
|
74
|
+
|
|
75
|
+
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`.
|
|
76
|
+
|
|
77
|
+
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/`.
|
|
78
|
+
|
|
79
|
+
## Troubleshooting
|
|
80
|
+
|
|
81
|
+
- **El plugin se instala pero la herramienta no aparece**: compruebe que `main` resuelve a `lib/index.mjs` y que `pnpm run build` lo generó.
|
|
82
|
+
- **`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`.
|
|
83
|
+
- **Una regla no se ejecutó**: lea el arreglo `skipped`.
|
|
84
|
+
- **`check` informa `manifest-peers` como fallo**: es un problema conocido de `dsh-plugin-dev`; el runtime aplica la compatibilidad al instalar.
|
|
85
|
+
- **Los horarios parecen desplazados**: toda la aritmética es de hora local sobre las cadenas entregadas.
|
|
86
|
+
|
|
87
|
+
## Development
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
pnpm install
|
|
91
|
+
pnpm run typecheck
|
|
92
|
+
pnpm test
|
|
93
|
+
pnpm run build
|
|
94
|
+
node ../scripts/sync-shared.mjs dsh-contract-stance
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
El último comando copia el kit compartido de `../_shared` a `src/shared/`; vuelva a ejecutarlo tras cada cambio compartido.
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-contract-stance contributors.
|
package/README-hi.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# dsh-contract-stance
|
|
2
|
+
|
|
3
|
+
**Boundary:** this plugin checks a **合同条款立场台账** for what a register can be held to — that each clause's
|
|
4
|
+
text is recorded, that your stance comes from your vocabulary, that the risk grade does too, that a must-have
|
|
5
|
+
clause records both a fallback position and an owner, that clause numbers are unique, that the register names
|
|
6
|
+
the contract and your side, and that no placeholder survives. It does **not** decide whether a clause should be
|
|
7
|
+
accepted, whether a risk is bearable, whether to sign, or whether a negotiating strategy is sound. **Those
|
|
8
|
+
depend on the deal, the counterparty's leverage and your own risk appetite.**
|
|
9
|
+
|
|
10
|
+
> ### ⚠️ What the citation rests on — and one thing this plugin must never be given
|
|
11
|
+
>
|
|
12
|
+
> **《中华人民共和国民法典》was obtained and read verbatim**, and `rules/evidence/clause-verification.md`
|
|
13
|
+
> records what was quoted: article 465 (a contract lawfully formed is protected by law), article 470 (contract
|
|
14
|
+
> content **一般包括** the parties, subject matter, quantity, quality, price, performance terms and liability for
|
|
15
|
+
> breach), article 509, article 577 (the consequences of breach) and article 584 (damages include expected
|
|
16
|
+
> profits but are capped by **foreseeability**).
|
|
17
|
+
>
|
|
18
|
+
> **The contract part does not regulate a negotiation register.** It governs formation, validity, performance and
|
|
19
|
+
> liability; the register's columns come from your enterprise's own contract management rules. So the `excerpt`
|
|
20
|
+
> fields still say "本次未取得" and every rule stays `warn` or `info`: **"this column is blank" must not be read
|
|
21
|
+
> as "this breaches the Civil Code".** Note also that article 470 says **一般包括**, not 应当包括 — one more
|
|
22
|
+
> reason `CS-001` does not claim a direct obligation.
|
|
23
|
+
>
|
|
24
|
+
> ⚠️ **Do not add a limitation-period rule to this plugin.** The Code *does* fix numbers — article 188 sets a
|
|
25
|
+
> three-year limitation (twenty years at the outside) and article 203 rolls a period forward off a public
|
|
26
|
+
> holiday — which makes "just compare the dates" look tempting. It is not workable here: the period runs from
|
|
27
|
+
> **when the creditor knew or ought to have known** of the harm and the debtor, a finding of fact the register
|
|
28
|
+
> does not record; the period is also subject to suspension (article 194) and interruption (article 195), and
|
|
29
|
+
> article 196 lists claims the limitation does not apply to at all. A date-arithmetic rule would dress a factual
|
|
30
|
+
> finding up as a calculation, which is precisely the over-claim this family avoids.
|
|
31
|
+
>
|
|
32
|
+
> **No judgement about the substance of a clause is made anywhere in this plugin.** It reads your own columns
|
|
33
|
+
> and checks only that they are filled and drawn from your vocabulary. Two vocabularies ship **empty** — the
|
|
34
|
+
> stance list (`CS-002`) and the risk grades (`CS-003`) — so with nothing configured those rules report
|
|
35
|
+
> themselves in `skipped` rather than passing quietly.
|
|
36
|
+
|
|
37
|
+
## Compatibility
|
|
38
|
+
|
|
39
|
+
| सतह | स्थिति |
|
|
40
|
+
|---|---|
|
|
41
|
+
| 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` जानबूझकर घोषित नहीं**: इसका कोई पाठक नहीं और यह किसी होस्ट को अस्वीकार नहीं कर सकता |
|
|
42
|
+
| Node | `^22.19.0 || >=24.0.0` |
|
|
43
|
+
| प्लेटफ़ॉर्म | सभी (शुद्ध ESM; कोई नेटिव कोड नहीं, कोई नेटवर्क नहीं, कोई मॉडल कॉल नहीं) |
|
|
44
|
+
| टूल मोड | `native`, `ptc` और `both` में काम करता है; पूरे फ़ोल्डर के लिए `ptc` चुनें |
|
|
45
|
+
|
|
46
|
+
## What it does
|
|
47
|
+
|
|
48
|
+
नियम-सूची, फ़ील्ड और विस्तृत व्यवहार [README.md](README.md#what-it-does) (अंग्रेज़ी मुख्य संस्करण) में हैं। यह प्लगइन केवल उद्धृत धाराओं के सामने शाब्दिक अंतर सूचीबद्ध करता है और हर न चल पाई जाँच को `skipped` में बताता है।
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
dsh plugin --profile <name> add dsh-contract-stance
|
|
54
|
+
dsh --profile <name> --dump-config | grep 'dsh-contract-stance'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
सभी समायोज्य पैरामीटर `src/config.ts` की Schemastery स्कीमा में हैं, इसलिए कोड बदले बिना `cordis.yml` से बदले जा सकते हैं; प्रति-नियम सीमाएँ `rules/` के नियम-पैक में हैं।
|
|
60
|
+
|
|
61
|
+
| कुंजी | प्रकार | डिफ़ॉल्ट | विवरण |
|
|
62
|
+
|---|---|---|---|
|
|
63
|
+
| `rulesFile` | string | `rules/contract-stance.yaml` | नियम-पैक का पथ, पैकेज रूट के सापेक्ष |
|
|
64
|
+
| `disabledRules` | string[] | `[]` | बंद करने वाले नियम id; प्रत्येक `skipped` में दिखता है |
|
|
65
|
+
| `onlyRules` | string[] | `[]` | केवल ये नियम चलाएँ; खाली होने पर सभी नियम चलते हैं |
|
|
66
|
+
| `skipNotes` | string | `""` | हर `skipped` कारण के आगे जोड़ी जाने वाली टिप्पणी |
|
|
67
|
+
| `timeoutMs` | number | `120000` | उपकरण का सहकारी समय-सीमा बजट |
|
|
68
|
+
|
|
69
|
+
## Material format
|
|
70
|
+
|
|
71
|
+
JSON या YAML स्वीकार्य है। पूरा फ़ील्ड उदाहरण [README.md](README.md#material-format) (अंग्रेज़ी मुख्य संस्करण) में है। पढ़ने की परत में फ़ील्ड वैकल्पिक हैं और जाँच इंजन उन्हें सत्यापित करता है, इसलिए आंशिक निर्यात पर क्रैश के बजाय "अनुपस्थित" श्रेणी के निष्कर्ष मिलते हैं।
|
|
72
|
+
|
|
73
|
+
## Rule sources
|
|
74
|
+
|
|
75
|
+
नियम-डेटा कोड से अलग है: प्रत्येक नियम में दस्तावेज़, संख्या, स्रोत की अपनी क्रमांकन-प्रणाली के अनुसार धारा, शब्दशः उद्धरण और स्रोत URL होता है। लोडर लागू करता है कि उद्धरण कम से कम आठ अक्षरों का वास्तविक उद्धरण हो, और जिस जाँच का आधार केवल सामान्य सिद्धांत (`kind: derived-from-principle`, अधिकतम `warn`) या स्थानीय नीति (`kind: institutional-configuration`, अधिकतम `info`) हो, उसे कभी `error` घोषित न किया जाए।
|
|
76
|
+
|
|
77
|
+
सत्यापित सीमाएँ और जान-बूझकर **न** कहे गए निष्कर्ष [README.md](README.md#rule-sources) (अंग्रेज़ी मुख्य संस्करण) और `rules/evidence/` में हैं।
|
|
78
|
+
|
|
79
|
+
## Troubleshooting
|
|
80
|
+
|
|
81
|
+
- **प्लगइन इंस्टॉल हो गया पर टूल दिखता नहीं**: जाँचें कि `main` `lib/index.mjs` पर जाता है और `pnpm run build` ने उसे बनाया है।
|
|
82
|
+
- **`dsh plugin add` असंगत बताकर मना करता है**: peer range `0.1.x` और `0.2.x` दोनों को कवर करती है; बाहर होने पर स्पष्ट छूट दें: `dsh plugin --profile <name> allow-version <pkg@ver> --dsh-version <runtime> --accept-risk`।
|
|
83
|
+
- **कोई नियम नहीं चला**: `skipped` सरणी देखें।
|
|
84
|
+
- **`check` में `manifest-peers` विफल दिखता है**: यह `dsh-plugin-dev` की ज्ञात अपस्ट्रीम समस्या है; रनटाइम इंस्टॉल के समय अनुकूलता लागू करता है।
|
|
85
|
+
- **समय खिसका हुआ लगता है**: सारी गणना दिए गए स्ट्रिंग पर वॉल-क्लॉक है।
|
|
86
|
+
|
|
87
|
+
## Development
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
pnpm install
|
|
91
|
+
pnpm run typecheck
|
|
92
|
+
pnpm test
|
|
93
|
+
pnpm run build
|
|
94
|
+
node ../scripts/sync-shared.mjs dsh-contract-stance
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
अंतिम कमांड `../_shared` का साझा किट `src/shared/` में कॉपी करता है; हर साझा बदलाव के बाद इसे दोबारा चलाएँ।
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-contract-stance contributors.
|
package/README-pt.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# dsh-contract-stance
|
|
2
|
+
|
|
3
|
+
**Boundary:** this plugin checks a **合同条款立场台账** for what a register can be held to — that each clause's
|
|
4
|
+
text is recorded, that your stance comes from your vocabulary, that the risk grade does too, that a must-have
|
|
5
|
+
clause records both a fallback position and an owner, that clause numbers are unique, that the register names
|
|
6
|
+
the contract and your side, and that no placeholder survives. It does **not** decide whether a clause should be
|
|
7
|
+
accepted, whether a risk is bearable, whether to sign, or whether a negotiating strategy is sound. **Those
|
|
8
|
+
depend on the deal, the counterparty's leverage and your own risk appetite.**
|
|
9
|
+
|
|
10
|
+
> ### ⚠️ What the citation rests on — and one thing this plugin must never be given
|
|
11
|
+
>
|
|
12
|
+
> **《中华人民共和国民法典》was obtained and read verbatim**, and `rules/evidence/clause-verification.md`
|
|
13
|
+
> records what was quoted: article 465 (a contract lawfully formed is protected by law), article 470 (contract
|
|
14
|
+
> content **一般包括** the parties, subject matter, quantity, quality, price, performance terms and liability for
|
|
15
|
+
> breach), article 509, article 577 (the consequences of breach) and article 584 (damages include expected
|
|
16
|
+
> profits but are capped by **foreseeability**).
|
|
17
|
+
>
|
|
18
|
+
> **The contract part does not regulate a negotiation register.** It governs formation, validity, performance and
|
|
19
|
+
> liability; the register's columns come from your enterprise's own contract management rules. So the `excerpt`
|
|
20
|
+
> fields still say "本次未取得" and every rule stays `warn` or `info`: **"this column is blank" must not be read
|
|
21
|
+
> as "this breaches the Civil Code".** Note also that article 470 says **一般包括**, not 应当包括 — one more
|
|
22
|
+
> reason `CS-001` does not claim a direct obligation.
|
|
23
|
+
>
|
|
24
|
+
> ⚠️ **Do not add a limitation-period rule to this plugin.** The Code *does* fix numbers — article 188 sets a
|
|
25
|
+
> three-year limitation (twenty years at the outside) and article 203 rolls a period forward off a public
|
|
26
|
+
> holiday — which makes "just compare the dates" look tempting. It is not workable here: the period runs from
|
|
27
|
+
> **when the creditor knew or ought to have known** of the harm and the debtor, a finding of fact the register
|
|
28
|
+
> does not record; the period is also subject to suspension (article 194) and interruption (article 195), and
|
|
29
|
+
> article 196 lists claims the limitation does not apply to at all. A date-arithmetic rule would dress a factual
|
|
30
|
+
> finding up as a calculation, which is precisely the over-claim this family avoids.
|
|
31
|
+
>
|
|
32
|
+
> **No judgement about the substance of a clause is made anywhere in this plugin.** It reads your own columns
|
|
33
|
+
> and checks only that they are filled and drawn from your vocabulary. Two vocabularies ship **empty** — the
|
|
34
|
+
> stance list (`CS-002`) and the risk grades (`CS-003`) — so with nothing configured those rules report
|
|
35
|
+
> themselves in `skipped` rather than passing quietly.
|
|
36
|
+
|
|
37
|
+
## Compatibility
|
|
38
|
+
|
|
39
|
+
| Superfície | Estado |
|
|
40
|
+
|---|---|
|
|
41
|
+
| 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 |
|
|
42
|
+
| Node | `^22.19.0 || >=24.0.0` |
|
|
43
|
+
| Plataformas | Todas (ESM puro; sem código nativo, sem rede, sem chamada ao modelo) |
|
|
44
|
+
| Modo de ferramenta | Funciona em `native`, `ptc` e `both`; para um diretório inteiro use `ptc` |
|
|
45
|
+
|
|
46
|
+
## What it does
|
|
47
|
+
|
|
48
|
+
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.
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
dsh plugin --profile <name> add dsh-contract-stance
|
|
54
|
+
dsh --profile <name> --dump-config | grep 'dsh-contract-stance'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
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/`.
|
|
60
|
+
|
|
61
|
+
| Chave | Tipo | Padrão | Descrição |
|
|
62
|
+
|---|---|---|---|
|
|
63
|
+
| `rulesFile` | string | `rules/contract-stance.yaml` | Caminho do pacote de regras, relativo à raiz do pacote |
|
|
64
|
+
| `disabledRules` | string[] | `[]` | Ids de regras a desativar; cada uma aparece em `skipped` |
|
|
65
|
+
| `onlyRules` | string[] | `[]` | Executar apenas estas regras; vazio executa todas |
|
|
66
|
+
| `skipNotes` | string | `""` | Nota acrescentada a cada motivo de `skipped` |
|
|
67
|
+
| `timeoutMs` | number | `120000` | Orçamento de tempo limite cooperativo da ferramenta |
|
|
68
|
+
|
|
69
|
+
## Material format
|
|
70
|
+
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
## Rule sources
|
|
74
|
+
|
|
75
|
+
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`.
|
|
76
|
+
|
|
77
|
+
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/`.
|
|
78
|
+
|
|
79
|
+
## Troubleshooting
|
|
80
|
+
|
|
81
|
+
- **O plugin instala mas a ferramenta não aparece**: confirme que `main` resolve para `lib/index.mjs` e que `pnpm run build` o gerou.
|
|
82
|
+
- **`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`.
|
|
83
|
+
- **Uma regra não executou**: leia o arranjo `skipped`.
|
|
84
|
+
- **`check` informa `manifest-peers` como falha**: problema conhecido do `dsh-plugin-dev`; o runtime aplica a compatibilidade na instalação.
|
|
85
|
+
- **Os horários parecem deslocados**: toda a aritmética é de hora local sobre as cadeias fornecidas.
|
|
86
|
+
|
|
87
|
+
## Development
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
pnpm install
|
|
91
|
+
pnpm run typecheck
|
|
92
|
+
pnpm test
|
|
93
|
+
pnpm run build
|
|
94
|
+
node ../scripts/sync-shared.mjs dsh-contract-stance
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
O último comando copia o kit compartilhado de `../_shared` para `src/shared/`; execute-o novamente após cada alteração compartilhada.
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-contract-stance contributors.
|
package/README-zh.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# dsh-contract-stance
|
|
2
|
+
|
|
3
|
+
**Boundary:** this plugin checks a **合同条款立场台账** for what a register can be held to — that each clause's
|
|
4
|
+
text is recorded, that your stance comes from your vocabulary, that the risk grade does too, that a must-have
|
|
5
|
+
clause records both a fallback position and an owner, that clause numbers are unique, that the register names
|
|
6
|
+
the contract and your side, and that no placeholder survives. It does **not** decide whether a clause should be
|
|
7
|
+
accepted, whether a risk is bearable, whether to sign, or whether a negotiating strategy is sound. **Those
|
|
8
|
+
depend on the deal, the counterparty's leverage and your own risk appetite.**
|
|
9
|
+
|
|
10
|
+
> ### ⚠️ What the citation rests on — and one thing this plugin must never be given
|
|
11
|
+
>
|
|
12
|
+
> **《中华人民共和国民法典》was obtained and read verbatim**, and `rules/evidence/clause-verification.md`
|
|
13
|
+
> records what was quoted: article 465 (a contract lawfully formed is protected by law), article 470 (contract
|
|
14
|
+
> content **一般包括** the parties, subject matter, quantity, quality, price, performance terms and liability for
|
|
15
|
+
> breach), article 509, article 577 (the consequences of breach) and article 584 (damages include expected
|
|
16
|
+
> profits but are capped by **foreseeability**).
|
|
17
|
+
>
|
|
18
|
+
> **The contract part does not regulate a negotiation register.** It governs formation, validity, performance and
|
|
19
|
+
> liability; the register's columns come from your enterprise's own contract management rules. So the `excerpt`
|
|
20
|
+
> fields still say "本次未取得" and every rule stays `warn` or `info`: **"this column is blank" must not be read
|
|
21
|
+
> as "this breaches the Civil Code".** Note also that article 470 says **一般包括**, not 应当包括 — one more
|
|
22
|
+
> reason `CS-001` does not claim a direct obligation.
|
|
23
|
+
>
|
|
24
|
+
> ⚠️ **Do not add a limitation-period rule to this plugin.** The Code *does* fix numbers — article 188 sets a
|
|
25
|
+
> three-year limitation (twenty years at the outside) and article 203 rolls a period forward off a public
|
|
26
|
+
> holiday — which makes "just compare the dates" look tempting. It is not workable here: the period runs from
|
|
27
|
+
> **when the creditor knew or ought to have known** of the harm and the debtor, a finding of fact the register
|
|
28
|
+
> does not record; the period is also subject to suspension (article 194) and interruption (article 195), and
|
|
29
|
+
> article 196 lists claims the limitation does not apply to at all. A date-arithmetic rule would dress a factual
|
|
30
|
+
> finding up as a calculation, which is precisely the over-claim this family avoids.
|
|
31
|
+
>
|
|
32
|
+
> **No judgement about the substance of a clause is made anywhere in this plugin.** It reads your own columns
|
|
33
|
+
> and checks only that they are filled and drawn from your vocabulary. Two vocabularies ship **empty** — the
|
|
34
|
+
> stance list (`CS-002`) and the risk grades (`CS-003`) — so with nothing configured those rules report
|
|
35
|
+
> themselves in `skipped` rather than passing quietly.
|
|
36
|
+
|
|
37
|
+
## Compatibility
|
|
38
|
+
|
|
39
|
+
| 项目 | 状态 |
|
|
40
|
+
|---|---|
|
|
41
|
+
| 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`**:它没有任何读取者,也无法拒装任何宿主 |
|
|
42
|
+
| Node | `^22.19.0 || >=24.0.0` |
|
|
43
|
+
| 平台 | 全平台(纯 ESM;无原生代码、无联网、不调用模型) |
|
|
44
|
+
| 工具模式 | `native` / `ptc` / `both` 均可;批量校验整个目录时建议 `ptc`,schema 成本只付一次 |
|
|
45
|
+
|
|
46
|
+
## What it does
|
|
47
|
+
|
|
48
|
+
规则表、字段说明与行为细节见 [README.md](README.md#what-it-does)(英文主版本)。本插件只列出材料与所引条款之间的字面差异,并对无法执行的检查在 `skipped` 中逐项说明。
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
dsh plugin --profile <name> add dsh-contract-stance
|
|
54
|
+
dsh --profile <name> --dump-config | grep 'dsh-contract-stance'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
全部可调参数都在 `src/config.ts` 的 Schemastery schema 中,只改 `cordis.yml` 即可生效,无需改代码;逐条阈值在 `rules/` 下的规则库文件里。
|
|
60
|
+
|
|
61
|
+
| 键 | 类型 | 默认值 | 说明 |
|
|
62
|
+
|---|---|---|---|
|
|
63
|
+
| `rulesFile` | string | `rules/contract-stance.yaml` | 规则库文件路径,相对插件包根目录 |
|
|
64
|
+
| `disabledRules` | string[] | `[]` | 要停用的规则 id 列表;每条都会出现在 `skipped` 中 |
|
|
65
|
+
| `onlyRules` | string[] | `[]` | 只执行这些规则 id;留空表示执行全部规则 |
|
|
66
|
+
| `skipNotes` | string | `""` | 附加到每条 `skipped` 说明后的备注 |
|
|
67
|
+
| `timeoutMs` | number | `120000` | 工具协作式超时预算(毫秒) |
|
|
68
|
+
|
|
69
|
+
## Material format
|
|
70
|
+
|
|
71
|
+
支持 JSON 与 YAML。完整字段示例见 [README.md](README.md#material-format)(英文主版本)。字段在读取层是可选的,由检查引擎校验,因此部分导出的材料会产生"缺项"类差异,而不是让程序崩溃。
|
|
72
|
+
|
|
73
|
+
## Rule sources
|
|
74
|
+
|
|
75
|
+
规则数据与代码分离,每条规则都带文件名、文号、按原文自身编号体系的条款号、逐字摘录与来源地址。加载期强制:摘录必须是真实引文且不少于八个字符;依据仅为原则性条款(`kind: derived-from-principle`,严重级上限 `warn`)或本机构配置(`kind: institutional-configuration`,上限 `info`)的检查不得标为 `error`。夸大依据的规则库会在加载期失败,而不会产出一份看起来很有底气的报告。
|
|
76
|
+
|
|
77
|
+
核验中确认的边界与"刻意没有作出的结论"见 [README.md](README.md#rule-sources)(英文主版本)与随包的 `rules/evidence/` 目录。
|
|
78
|
+
|
|
79
|
+
## Troubleshooting
|
|
80
|
+
|
|
81
|
+
- **插件装上了但工具不出现**:确认 `main` 指向 `lib/index.mjs` 且 `pnpm run build` 已生成该文件;`main` 写错会让加载器静默跳过该条目。
|
|
82
|
+
- **`dsh plugin add` 报版本不兼容**:peer 范围覆盖 `0.1.x` 与 `0.2.x`;若运行时在其之外,可显式豁免:`dsh plugin --profile <name> allow-version <包名@版本> --dsh-version <runtime> --accept-risk`
|
|
83
|
+
- **某条规则没有执行**:查看 `skipped` 数组,其中写明了规则 id 与原因。
|
|
84
|
+
- **`check` 报 `manifest-peers` 失败**:静态检查器比对的是一份早于 0.2 世代的硬编码 peer 范围;安装期的 peer 校验以运行时为准。这是 `dsh-plugin-dev` 的已知上游问题。
|
|
85
|
+
- **时间看起来偏移**:全部计算都是对输入字符串做墙上时钟运算,不做时区换算。
|
|
86
|
+
|
|
87
|
+
## Development
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
pnpm install
|
|
91
|
+
pnpm run typecheck
|
|
92
|
+
pnpm test
|
|
93
|
+
pnpm run build
|
|
94
|
+
node ../scripts/sync-shared.mjs dsh-contract-stance
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
第 4 项把 `../_shared` 的共享件同步进 `src/shared/`;每次改动共享件后都要重跑。
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-contract-stance contributors.
|
package/README.md
CHANGED
|
@@ -1,3 +1,147 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-contract-stance
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Boundary:** this plugin checks a **合同条款立场台账** for what a register can be held to — that each clause's
|
|
4
|
+
text is recorded, that your stance comes from your vocabulary, that the risk grade does too, that a must-have
|
|
5
|
+
clause records both a fallback position and an owner, that clause numbers are unique, that the register names
|
|
6
|
+
the contract and your side, and that no placeholder survives. It does **not** decide whether a clause should be
|
|
7
|
+
accepted, whether a risk is bearable, whether to sign, or whether a negotiating strategy is sound. **Those
|
|
8
|
+
depend on the deal, the counterparty's leverage and your own risk appetite.**
|
|
9
|
+
|
|
10
|
+
> ### ⚠️ What the citation rests on — and one thing this plugin must never be given
|
|
11
|
+
>
|
|
12
|
+
> **《中华人民共和国民法典》was obtained and read verbatim**, and `rules/evidence/clause-verification.md`
|
|
13
|
+
> records what was quoted: article 465 (a contract lawfully formed is protected by law), article 470 (contract
|
|
14
|
+
> content **一般包括** the parties, subject matter, quantity, quality, price, performance terms and liability for
|
|
15
|
+
> breach), article 509, article 577 (the consequences of breach) and article 584 (damages include expected
|
|
16
|
+
> profits but are capped by **foreseeability**).
|
|
17
|
+
>
|
|
18
|
+
> **The contract part does not regulate a negotiation register.** It governs formation, validity, performance and
|
|
19
|
+
> liability; the register's columns come from your enterprise's own contract management rules. So the `excerpt`
|
|
20
|
+
> fields still say "本次未取得" and every rule stays `warn` or `info`: **"this column is blank" must not be read
|
|
21
|
+
> as "this breaches the Civil Code".** Note also that article 470 says **一般包括**, not 应当包括 — one more
|
|
22
|
+
> reason `CS-001` does not claim a direct obligation.
|
|
23
|
+
>
|
|
24
|
+
> ⚠️ **Do not add a limitation-period rule to this plugin.** The Code *does* fix numbers — article 188 sets a
|
|
25
|
+
> three-year limitation (twenty years at the outside) and article 203 rolls a period forward off a public
|
|
26
|
+
> holiday — which makes "just compare the dates" look tempting. It is not workable here: the period runs from
|
|
27
|
+
> **when the creditor knew or ought to have known** of the harm and the debtor, a finding of fact the register
|
|
28
|
+
> does not record; the period is also subject to suspension (article 194) and interruption (article 195), and
|
|
29
|
+
> article 196 lists claims the limitation does not apply to at all. A date-arithmetic rule would dress a factual
|
|
30
|
+
> finding up as a calculation, which is precisely the over-claim this family avoids.
|
|
31
|
+
>
|
|
32
|
+
> **No judgement about the substance of a clause is made anywhere in this plugin.** It reads your own columns
|
|
33
|
+
> and checks only that they are filled and drawn from your vocabulary. Two vocabularies ship **empty** — the
|
|
34
|
+
> stance list (`CS-002`) and the risk grades (`CS-003`) — so with nothing configured those rules report
|
|
35
|
+
> themselves in `skipped` rather than passing quietly.
|
|
36
|
+
|
|
37
|
+
## Compatibility
|
|
38
|
+
|
|
39
|
+
| Surface | Status |
|
|
40
|
+
|---|---|
|
|
41
|
+
| 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 |
|
|
42
|
+
| Node | `^22.19.0 || >=24.0.0` |
|
|
43
|
+
| Platforms | All (plain ESM; no native code, no network, no model call) |
|
|
44
|
+
| Tool mode | Works in `native`, `ptc` and `both`; for a full contract use `ptc` |
|
|
45
|
+
|
|
46
|
+
## What it does
|
|
47
|
+
|
|
48
|
+
Registers the `contract_stance` tool. It reads one clause-position register — the contract header plus one row
|
|
49
|
+
per clause — applies a versioned rule pack, and returns a report.
|
|
50
|
+
|
|
51
|
+
| Rule | Check | Severity | Basis kind |
|
|
52
|
+
|---|---|---|---|
|
|
53
|
+
| `CS-001` | every clause's text is recorded | warn | principle |
|
|
54
|
+
| `CS-002` | the stance comes from your vocabulary (off by default) | info | local |
|
|
55
|
+
| `CS-003` | the risk grade comes from your vocabulary (off by default) | info | local |
|
|
56
|
+
| `CS-004` | a must-have clause records a fallback and an owner | warn | principle |
|
|
57
|
+
| `CS-005` | clause numbers are unique | warn | principle |
|
|
58
|
+
| `CS-006` | the register names the contract and your side | warn | principle |
|
|
59
|
+
| `CS-007` | the clause text holds no unreplaced placeholder | warn | principle |
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
dsh plugin --profile <name> add dsh-contract-stance
|
|
65
|
+
dsh --profile <name> --dump-config | grep 'dsh-contract-stance'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Configuration
|
|
69
|
+
|
|
70
|
+
| Key | Type | Default | Description |
|
|
71
|
+
|---|---|---|---|
|
|
72
|
+
| `rulesFile` | string | `rules/contract-stance.yaml` | Rule-pack path, relative to the package root |
|
|
73
|
+
| `disabledRules` | string[] | `[]` | Rule ids to stop running; each appears in `skipped` |
|
|
74
|
+
| `onlyRules` | string[] | `[]` | Run only these rule ids; empty runs every rule |
|
|
75
|
+
| `skipNotes` | string | `""` | Note appended to every `skipped` reason |
|
|
76
|
+
| `timeoutMs` | number | `120000` | Cooperative tool timeout budget |
|
|
77
|
+
|
|
78
|
+
Rule-level parameters worth knowing:
|
|
79
|
+
|
|
80
|
+
- `CS-002` `values` — your stance vocabulary, e.g. `[坚持, 可谈, 接受, 须删除]`. Empty means no check.
|
|
81
|
+
- `CS-003` `values` — your risk grades, e.g. `[高, 中, 低]`. Empty means no check.
|
|
82
|
+
- `CS-004` `conditionValues` — the values in your 是否必保 column that mark a clause must-have, by default
|
|
83
|
+
`[是, Y, yes, true, 必保, √]`.
|
|
84
|
+
- `CS-007` `terms` — the placeholders to look for.
|
|
85
|
+
|
|
86
|
+
## Material format
|
|
87
|
+
|
|
88
|
+
The tool accepts JSON or YAML:
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
contractNo: HT-2026-018
|
|
92
|
+
contractName: 某某设备采购合同
|
|
93
|
+
party: 某某公司
|
|
94
|
+
version: 第 3 轮谈判稿
|
|
95
|
+
rows:
|
|
96
|
+
- { 条款号: 第 8.2 条, 条款主题: 逾期付款违约金,
|
|
97
|
+
条款原文: 买方逾期付款的,每逾期一日按未付金额的万分之五向卖方支付违约金。,
|
|
98
|
+
本方立场: 可谈, 风险等级: 中, 风险说明: 违约金比例高于本方惯例且未设上限,
|
|
99
|
+
退让底线: 比例可降至万分之三,须增加总额不超过合同额 5% 的上限,
|
|
100
|
+
是否必保: 是, 谈判责任人: 王经理 }
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Column names are matched case-insensitively and ignoring spaces, underscores and hyphens; the register's own
|
|
104
|
+
column names are kept, so a finding names the column it read.
|
|
105
|
+
|
|
106
|
+
## Rule sources
|
|
107
|
+
|
|
108
|
+
Rule data lives in `rules/contract-stance.yaml`. The pack's header states the citation gap in full, and each
|
|
109
|
+
rule's `note` repeats the part that matters for that rule. The load-time guard that normally enforces "an
|
|
110
|
+
excerpt must be a real quotation of at least eight characters" cannot tell a quotation from a description —
|
|
111
|
+
so this pack leans on the header, the per-rule notes and a test that asserts every `excerpt` admits the gap.
|
|
112
|
+
|
|
113
|
+
## Troubleshooting
|
|
114
|
+
|
|
115
|
+
- **`CS-002` or `CS-003` reports itself as skipped.** Its vocabulary is empty. Stance and risk wording is your
|
|
116
|
+
institution's convention, and the plugin will not guess it.
|
|
117
|
+
- **`CS-004` fires on a clause marked must-have.** It records no fallback or no owner. A must-have clause
|
|
118
|
+
without a stated floor cannot be negotiated on the spot.
|
|
119
|
+
- **`CS-001` fires although the clause is quoted elsewhere.** The `text` column itself is empty. The check
|
|
120
|
+
reads the register, not the contract document.
|
|
121
|
+
- **`CS-005` fires on one clause twice.** That is legitimate across negotiation rounds — distinguish the rows
|
|
122
|
+
in the version column rather than reusing the clause number.
|
|
123
|
+
- **The plugin installs but the tool never appears.** Check that `main` resolves to `lib/index.mjs` and
|
|
124
|
+
that `pnpm run build` produced it; a wrong `main` makes the loader skip the entry silently.
|
|
125
|
+
- **`dsh plugin add` refuses the package as incompatible.** The peer range covers `0.1.x` and `0.2.x`; if
|
|
126
|
+
your runtime sits outside it, grant an explicit exemption:
|
|
127
|
+
`dsh plugin --profile <name> allow-version dsh-contract-stance@0.1.0 --dsh-version <runtime> --accept-risk`
|
|
128
|
+
- **`check` reports `manifest-peers` as failed.** The static checker compares against a hard-coded peer
|
|
129
|
+
range that predates the 0.2 line. The runtime enforces peer compatibility at install time, so the
|
|
130
|
+
declared range is the correct one; this is a known upstream issue in `dsh-plugin-dev`.
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
pnpm install
|
|
136
|
+
pnpm run typecheck # tsc --noEmit
|
|
137
|
+
pnpm test # vitest, the shared table-plugin suite plus paired fixtures
|
|
138
|
+
pnpm run build # tsdown -> lib/index.mjs + lib/index.d.mts
|
|
139
|
+
node ../scripts/sync-shared.mjs dsh-contract-stance # refresh src/shared from ../_shared
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The plugin is **data-only**: `src/model.ts` declares the table shape, the shared kit supplies the reader and
|
|
143
|
+
the check engine, and the rule pack declares every check.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-contract-stance contributors.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# dsh-contract-stance bundle layer: register this plugin as a bundle row.
|
|
2
|
+
# This file is the `dsh.bundle.patch` layer (see package.json#dsh.bundle.patch).
|
|
3
|
+
# Layer semantics: a YAML array of row verbs; `insert` adds plugin rows to the
|
|
4
|
+
# composed config. A row's `id` must be unique within the layer stack; `name`
|
|
5
|
+
# resolves the plugin module through the installed package (package.json#main).
|
|
6
|
+
- insert:
|
|
7
|
+
- id: dsh-contract-stance
|
|
8
|
+
name: dsh-contract-stance
|
package/icon.svg
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Contract stance check">
|
|
2
|
+
<rect width="64" height="64" rx="12" fill="#0f766e"/>
|
|
3
|
+
<path d="M16 20h32M16 32h22M16 44h26" stroke="#ffffff" stroke-width="4" stroke-linecap="round"/>
|
|
4
|
+
<circle cx="50" cy="46" r="9" fill="#ffffff"/>
|
|
5
|
+
<path d="M46 46l3 3 5-6" stroke="#0f766e" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
|
|
6
|
+
</svg>
|
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Schema from "@deepseek-ai/schemastery";
|
|
2
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
3
|
+
//#region src/config.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Every tunable lives here so an operator can change behaviour from
|
|
6
|
+
* `cordis.yml` without editing code (the family's "no hard-coded tunables"
|
|
7
|
+
* redline). The rule pack itself is data as well and can be pointed elsewhere.
|
|
8
|
+
*/
|
|
9
|
+
interface Config {
|
|
10
|
+
/** Rule-pack path relative to the plugin package root. */
|
|
11
|
+
rulesFile: string;
|
|
12
|
+
/** Rule ids disabled for this deployment. */
|
|
13
|
+
disabledRules: string[];
|
|
14
|
+
/** When non-empty, only these rule ids run. */
|
|
15
|
+
onlyRules: string[];
|
|
16
|
+
/** Extra note appended to every `skipped` reason. */
|
|
17
|
+
skipNotes: string;
|
|
18
|
+
/** Tool timeout budget in milliseconds. */
|
|
19
|
+
timeoutMs: number;
|
|
20
|
+
}
|
|
21
|
+
declare const Config: Schema<Config>;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/index.d.ts
|
|
24
|
+
declare const name = "dsh-contract-stance";
|
|
25
|
+
declare const inject: string[];
|
|
26
|
+
/** Tool id exposed to the model, and the row id in `cordis.patch.yml`. */
|
|
27
|
+
declare const TOOL_NAME = "contract_stance";
|
|
28
|
+
/**
|
|
29
|
+
* Locate a package-owned file such as the rule pack.
|
|
30
|
+
*
|
|
31
|
+
* Resolution order: absolute path, then every ancestor of the module directory,
|
|
32
|
+
* then the process working directory. A wrong silent fallback would build a
|
|
33
|
+
* report from the wrong rule pack, so a miss throws with the paths tried.
|
|
34
|
+
*
|
|
35
|
+
* @param relative - configured path, relative to the plugin package root.
|
|
36
|
+
* @returns the resolved absolute path.
|
|
37
|
+
* @throws Error naming every location tried, when the file is absent.
|
|
38
|
+
*/
|
|
39
|
+
declare function resolvePackageFile(relative: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Register the checker tool.
|
|
42
|
+
*
|
|
43
|
+
* Registration is an effect: `ctx.tools.register` returns the disposer that
|
|
44
|
+
* removes the tool when this plugin unloads, which is what keeps the plugin
|
|
45
|
+
* hot-reloadable.
|
|
46
|
+
*
|
|
47
|
+
* @param ctx - plugin context, with `tools` already available.
|
|
48
|
+
* @param config - validated configuration.
|
|
49
|
+
*/
|
|
50
|
+
declare function apply(ctx: Context, config: Config): () => void;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Config, TOOL_NAME, apply, inject, name, resolvePackageFile };
|