dsh-hazplan-check 0.0.0-stage → 0.2.1
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 +106 -0
- package/README-hi.md +106 -0
- package/README-pt.md +106 -0
- package/README-zh.md +106 -0
- package/README.md +175 -2
- package/cordis.patch.yml +8 -0
- package/icon.svg +6 -0
- package/lib/index.d.mts +56 -0
- package/lib/index.mjs +1381 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +87 -4
- package/rules/citations-baseline.json +8 -0
- package/rules/evidence/clause-verification-blocked-aqt3049.md +74 -0
- package/rules/evidence/clause-verification-hazop.md +121 -0
- package/rules/evidence/clause-verification.md +823 -0
- package/rules/hazplan-check.yaml +221 -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,106 @@
|
|
|
1
|
+
# dsh-hazplan-check
|
|
2
|
+
|
|
3
|
+
**Boundary:** this plugin checks one **HAZOP worksheet** for what a sheet can be held to — that every row
|
|
4
|
+
records the analysis content your template requires, that each 偏差 actually follows from the 工艺参数 and
|
|
5
|
+
引导词 beside it, that risk levels come from your own vocabulary, that every node has rows, and that
|
|
6
|
+
recommendations carry their closure fields. It does **not** judge whether the causes are complete, whether
|
|
7
|
+
the consequences are analysed far enough, whether the safeguards are adequate, or whether a risk rating is
|
|
8
|
+
correct. **Those four judgements are the study team's, and they are where HAZOP's value lies.**
|
|
9
|
+
|
|
10
|
+
> ### ⚠️ Nothing here is `error`, and the clause wording is why
|
|
11
|
+
>
|
|
12
|
+
> **GB/T 35320-2017《危险与可操作性分析(HAZOP分析)应用指南》** is in force (published and effective
|
|
13
|
+
> 2017-12-29, identical to IEC 61882:2001), and its clause text was obtained verbatim.
|
|
14
|
+
>
|
|
15
|
+
> **The standard is a *recommended* one (the number carries "/T"), and every clause this pack cites uses
|
|
16
|
+
> 宜 — "should" — not 应.** That applies to the two clauses an earlier version of this pack rated as
|
|
17
|
+
> `error`: **6.6.4** reads 「每一个危险和可操作性性问题都**宜**作为单项记录」 and **6.6.3** opens
|
|
18
|
+
> 「HAZOP 分析输出**宜**包括:」. **A recommendation cannot support an error rating**, so both rules are
|
|
19
|
+
> now `warn` and **this plugin reports no error at all** — consistent with how the family treats every
|
|
20
|
+
> other recommended standard. A test pins this so a later edit cannot quietly re-escalate one.
|
|
21
|
+
>
|
|
22
|
+
> **Everything else is capped at `warn` or `info`, for three reasons the pack records:**
|
|
23
|
+
>
|
|
24
|
+
> 1. **Appendix A.2 — the one place a column list appears — is a 资料性附录.** Its wording is "表列的标题
|
|
25
|
+
> **可为**以下各项", it adds "**也可记录**其他信息", and it says outright that "工作表的版面设计**各有不同**".
|
|
26
|
+
> **There is no mandatory column list**, so a missing column can only ever be a suggestion.
|
|
27
|
+
> 2. **Clause 4.2 gives no criterion for node granularity.** It says the size of a node "取决于系统的
|
|
28
|
+
> 复杂性和危险的严重程度" and nothing quantitative follows. This plugin **does not** judge node size.
|
|
29
|
+
> 3. **The standard fixes no risk-level scale.** 6.5 mentions a risk matrix as useful and defers the method
|
|
30
|
+
> to IEC 60300-3-9; GB/T 27921-2023's matrix description is likewise informative. Levels must come from
|
|
31
|
+
> your own risk criteria, so the vocabulary ships **empty**.
|
|
32
|
+
>
|
|
33
|
+
> Two further honesty notes are in the pack. The guide-word vocabulary uses the standard's own wording —
|
|
34
|
+
> **「相反」, not the colloquial "相逆"** — and combines table 1 with table 2; a custom guide word is
|
|
35
|
+
> **not** non-compliant, because 6.4.3 permits one "只要在分析开始前进行了定义". And **SH/T 3240-2025**
|
|
36
|
+
> (the petrochemical HAZOP specification, in force 2025-11-01) had only its identity, status and glossary
|
|
37
|
+
> verified — **its clause text was not obtained, so this pack cites none of it**.
|
|
38
|
+
>
|
|
39
|
+
> The four judgements this plugin does not make: whether the causes are complete, whether the consequences
|
|
40
|
+
> are analysed far enough, whether the safeguards are adequate, whether a risk rating is correct.
|
|
41
|
+
|
|
42
|
+
## Compatibility
|
|
43
|
+
|
|
44
|
+
| Superficie | Estado |
|
|
45
|
+
|---|---|
|
|
46
|
+
| 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 |
|
|
47
|
+
| Node | `^22.19.0 || >=24.0.0` |
|
|
48
|
+
| Plataformas | Todas (ESM puro; sin código nativo, sin red, sin llamada al modelo) |
|
|
49
|
+
| Modo de herramienta | Funciona en `native`, `ptc` y `both`; para un directorio completo use `ptc` |
|
|
50
|
+
|
|
51
|
+
## What it does
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
dsh plugin --profile <name> add dsh-hazplan-check
|
|
59
|
+
dsh --profile <name> --dump-config | grep 'dsh-hazplan-check'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Configuration
|
|
63
|
+
|
|
64
|
+
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/`.
|
|
65
|
+
|
|
66
|
+
| Clave | Tipo | Predeterminado | Descripción |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| `rulesFile` | string | `rules/hazplan-check.yaml` | Ruta del paquete de reglas, relativa a la raíz del paquete |
|
|
69
|
+
| `disabledRules` | string[] | `[]` | Ids de reglas que se dejan de ejecutar; cada una aparece en `skipped` |
|
|
70
|
+
| `onlyRules` | string[] | `[]` | Ejecutar solo estas reglas; vacío ejecuta todas |
|
|
71
|
+
| `skipNotes` | string | `""` | Nota añadida a cada motivo de `skipped` |
|
|
72
|
+
| `timeoutMs` | number | `120000` | Presupuesto de tiempo de espera cooperativo de la herramienta |
|
|
73
|
+
|
|
74
|
+
## Material format
|
|
75
|
+
|
|
76
|
+
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.
|
|
77
|
+
|
|
78
|
+
## Rule sources
|
|
79
|
+
|
|
80
|
+
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`.
|
|
81
|
+
|
|
82
|
+
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/`.
|
|
83
|
+
|
|
84
|
+
## Troubleshooting
|
|
85
|
+
|
|
86
|
+
- **El plugin se instala pero la herramienta no aparece**: compruebe que `main` resuelve a `lib/index.mjs` y que `pnpm run build` lo generó.
|
|
87
|
+
- **`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`.
|
|
88
|
+
- **Una regla no se ejecutó**: lea el arreglo `skipped`.
|
|
89
|
+
- **`check` informa `manifest-peers` como fallo**: es un problema conocido de `dsh-plugin-dev`; el runtime aplica la compatibilidad al instalar.
|
|
90
|
+
- **Los horarios parecen desplazados**: toda la aritmética es de hora local sobre las cadenas entregadas.
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
pnpm install
|
|
96
|
+
pnpm run typecheck
|
|
97
|
+
pnpm test
|
|
98
|
+
pnpm run build
|
|
99
|
+
node ../scripts/sync-shared.mjs dsh-hazplan-check
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
El último comando copia el kit compartido de `../_shared` a `src/shared/`; vuelva a ejecutarlo tras cada cambio compartido.
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-hazplan-check contributors.
|
package/README-hi.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# dsh-hazplan-check
|
|
2
|
+
|
|
3
|
+
**Boundary:** this plugin checks one **HAZOP worksheet** for what a sheet can be held to — that every row
|
|
4
|
+
records the analysis content your template requires, that each 偏差 actually follows from the 工艺参数 and
|
|
5
|
+
引导词 beside it, that risk levels come from your own vocabulary, that every node has rows, and that
|
|
6
|
+
recommendations carry their closure fields. It does **not** judge whether the causes are complete, whether
|
|
7
|
+
the consequences are analysed far enough, whether the safeguards are adequate, or whether a risk rating is
|
|
8
|
+
correct. **Those four judgements are the study team's, and they are where HAZOP's value lies.**
|
|
9
|
+
|
|
10
|
+
> ### ⚠️ Nothing here is `error`, and the clause wording is why
|
|
11
|
+
>
|
|
12
|
+
> **GB/T 35320-2017《危险与可操作性分析(HAZOP分析)应用指南》** is in force (published and effective
|
|
13
|
+
> 2017-12-29, identical to IEC 61882:2001), and its clause text was obtained verbatim.
|
|
14
|
+
>
|
|
15
|
+
> **The standard is a *recommended* one (the number carries "/T"), and every clause this pack cites uses
|
|
16
|
+
> 宜 — "should" — not 应.** That applies to the two clauses an earlier version of this pack rated as
|
|
17
|
+
> `error`: **6.6.4** reads 「每一个危险和可操作性性问题都**宜**作为单项记录」 and **6.6.3** opens
|
|
18
|
+
> 「HAZOP 分析输出**宜**包括:」. **A recommendation cannot support an error rating**, so both rules are
|
|
19
|
+
> now `warn` and **this plugin reports no error at all** — consistent with how the family treats every
|
|
20
|
+
> other recommended standard. A test pins this so a later edit cannot quietly re-escalate one.
|
|
21
|
+
>
|
|
22
|
+
> **Everything else is capped at `warn` or `info`, for three reasons the pack records:**
|
|
23
|
+
>
|
|
24
|
+
> 1. **Appendix A.2 — the one place a column list appears — is a 资料性附录.** Its wording is "表列的标题
|
|
25
|
+
> **可为**以下各项", it adds "**也可记录**其他信息", and it says outright that "工作表的版面设计**各有不同**".
|
|
26
|
+
> **There is no mandatory column list**, so a missing column can only ever be a suggestion.
|
|
27
|
+
> 2. **Clause 4.2 gives no criterion for node granularity.** It says the size of a node "取决于系统的
|
|
28
|
+
> 复杂性和危险的严重程度" and nothing quantitative follows. This plugin **does not** judge node size.
|
|
29
|
+
> 3. **The standard fixes no risk-level scale.** 6.5 mentions a risk matrix as useful and defers the method
|
|
30
|
+
> to IEC 60300-3-9; GB/T 27921-2023's matrix description is likewise informative. Levels must come from
|
|
31
|
+
> your own risk criteria, so the vocabulary ships **empty**.
|
|
32
|
+
>
|
|
33
|
+
> Two further honesty notes are in the pack. The guide-word vocabulary uses the standard's own wording —
|
|
34
|
+
> **「相反」, not the colloquial "相逆"** — and combines table 1 with table 2; a custom guide word is
|
|
35
|
+
> **not** non-compliant, because 6.4.3 permits one "只要在分析开始前进行了定义". And **SH/T 3240-2025**
|
|
36
|
+
> (the petrochemical HAZOP specification, in force 2025-11-01) had only its identity, status and glossary
|
|
37
|
+
> verified — **its clause text was not obtained, so this pack cites none of it**.
|
|
38
|
+
>
|
|
39
|
+
> The four judgements this plugin does not make: whether the causes are complete, whether the consequences
|
|
40
|
+
> are analysed far enough, whether the safeguards are adequate, whether a risk rating is correct.
|
|
41
|
+
|
|
42
|
+
## Compatibility
|
|
43
|
+
|
|
44
|
+
| सतह | स्थिति |
|
|
45
|
+
|---|---|
|
|
46
|
+
| 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` जानबूझकर घोषित नहीं**: इसका कोई पाठक नहीं और यह किसी होस्ट को अस्वीकार नहीं कर सकता |
|
|
47
|
+
| Node | `^22.19.0 || >=24.0.0` |
|
|
48
|
+
| प्लेटफ़ॉर्म | सभी (शुद्ध ESM; कोई नेटिव कोड नहीं, कोई नेटवर्क नहीं, कोई मॉडल कॉल नहीं) |
|
|
49
|
+
| टूल मोड | `native`, `ptc` और `both` में काम करता है; पूरे फ़ोल्डर के लिए `ptc` चुनें |
|
|
50
|
+
|
|
51
|
+
## What it does
|
|
52
|
+
|
|
53
|
+
नियम-सूची, फ़ील्ड और विस्तृत व्यवहार [README.md](README.md#what-it-does) (अंग्रेज़ी मुख्य संस्करण) में हैं। यह प्लगइन केवल उद्धृत धाराओं के सामने शाब्दिक अंतर सूचीबद्ध करता है और हर न चल पाई जाँच को `skipped` में बताता है।
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
dsh plugin --profile <name> add dsh-hazplan-check
|
|
59
|
+
dsh --profile <name> --dump-config | grep 'dsh-hazplan-check'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Configuration
|
|
63
|
+
|
|
64
|
+
सभी समायोज्य पैरामीटर `src/config.ts` की Schemastery स्कीमा में हैं, इसलिए कोड बदले बिना `cordis.yml` से बदले जा सकते हैं; प्रति-नियम सीमाएँ `rules/` के नियम-पैक में हैं।
|
|
65
|
+
|
|
66
|
+
| कुंजी | प्रकार | डिफ़ॉल्ट | विवरण |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| `rulesFile` | string | `rules/hazplan-check.yaml` | नियम-पैक का पथ, पैकेज रूट के सापेक्ष |
|
|
69
|
+
| `disabledRules` | string[] | `[]` | बंद करने वाले नियम id; प्रत्येक `skipped` में दिखता है |
|
|
70
|
+
| `onlyRules` | string[] | `[]` | केवल ये नियम चलाएँ; खाली होने पर सभी नियम चलते हैं |
|
|
71
|
+
| `skipNotes` | string | `""` | हर `skipped` कारण के आगे जोड़ी जाने वाली टिप्पणी |
|
|
72
|
+
| `timeoutMs` | number | `120000` | उपकरण का सहकारी समय-सीमा बजट |
|
|
73
|
+
|
|
74
|
+
## Material format
|
|
75
|
+
|
|
76
|
+
JSON या YAML स्वीकार्य है। पूरा फ़ील्ड उदाहरण [README.md](README.md#material-format) (अंग्रेज़ी मुख्य संस्करण) में है। पढ़ने की परत में फ़ील्ड वैकल्पिक हैं और जाँच इंजन उन्हें सत्यापित करता है, इसलिए आंशिक निर्यात पर क्रैश के बजाय "अनुपस्थित" श्रेणी के निष्कर्ष मिलते हैं।
|
|
77
|
+
|
|
78
|
+
## Rule sources
|
|
79
|
+
|
|
80
|
+
नियम-डेटा कोड से अलग है: प्रत्येक नियम में दस्तावेज़, संख्या, स्रोत की अपनी क्रमांकन-प्रणाली के अनुसार धारा, शब्दशः उद्धरण और स्रोत URL होता है। लोडर लागू करता है कि उद्धरण कम से कम आठ अक्षरों का वास्तविक उद्धरण हो, और जिस जाँच का आधार केवल सामान्य सिद्धांत (`kind: derived-from-principle`, अधिकतम `warn`) या स्थानीय नीति (`kind: institutional-configuration`, अधिकतम `info`) हो, उसे कभी `error` घोषित न किया जाए।
|
|
81
|
+
|
|
82
|
+
सत्यापित सीमाएँ और जान-बूझकर **न** कहे गए निष्कर्ष [README.md](README.md#rule-sources) (अंग्रेज़ी मुख्य संस्करण) और `rules/evidence/` में हैं।
|
|
83
|
+
|
|
84
|
+
## Troubleshooting
|
|
85
|
+
|
|
86
|
+
- **प्लगइन इंस्टॉल हो गया पर टूल दिखता नहीं**: जाँचें कि `main` `lib/index.mjs` पर जाता है और `pnpm run build` ने उसे बनाया है।
|
|
87
|
+
- **`dsh plugin add` असंगत बताकर मना करता है**: peer range `0.1.x` और `0.2.x` दोनों को कवर करती है; बाहर होने पर स्पष्ट छूट दें: `dsh plugin --profile <name> allow-version <pkg@ver> --dsh-version <runtime> --accept-risk`।
|
|
88
|
+
- **कोई नियम नहीं चला**: `skipped` सरणी देखें।
|
|
89
|
+
- **`check` में `manifest-peers` विफल दिखता है**: यह `dsh-plugin-dev` की ज्ञात अपस्ट्रीम समस्या है; रनटाइम इंस्टॉल के समय अनुकूलता लागू करता है।
|
|
90
|
+
- **समय खिसका हुआ लगता है**: सारी गणना दिए गए स्ट्रिंग पर वॉल-क्लॉक है।
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
pnpm install
|
|
96
|
+
pnpm run typecheck
|
|
97
|
+
pnpm test
|
|
98
|
+
pnpm run build
|
|
99
|
+
node ../scripts/sync-shared.mjs dsh-hazplan-check
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
अंतिम कमांड `../_shared` का साझा किट `src/shared/` में कॉपी करता है; हर साझा बदलाव के बाद इसे दोबारा चलाएँ।
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-hazplan-check contributors.
|
package/README-pt.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# dsh-hazplan-check
|
|
2
|
+
|
|
3
|
+
**Boundary:** this plugin checks one **HAZOP worksheet** for what a sheet can be held to — that every row
|
|
4
|
+
records the analysis content your template requires, that each 偏差 actually follows from the 工艺参数 and
|
|
5
|
+
引导词 beside it, that risk levels come from your own vocabulary, that every node has rows, and that
|
|
6
|
+
recommendations carry their closure fields. It does **not** judge whether the causes are complete, whether
|
|
7
|
+
the consequences are analysed far enough, whether the safeguards are adequate, or whether a risk rating is
|
|
8
|
+
correct. **Those four judgements are the study team's, and they are where HAZOP's value lies.**
|
|
9
|
+
|
|
10
|
+
> ### ⚠️ Nothing here is `error`, and the clause wording is why
|
|
11
|
+
>
|
|
12
|
+
> **GB/T 35320-2017《危险与可操作性分析(HAZOP分析)应用指南》** is in force (published and effective
|
|
13
|
+
> 2017-12-29, identical to IEC 61882:2001), and its clause text was obtained verbatim.
|
|
14
|
+
>
|
|
15
|
+
> **The standard is a *recommended* one (the number carries "/T"), and every clause this pack cites uses
|
|
16
|
+
> 宜 — "should" — not 应.** That applies to the two clauses an earlier version of this pack rated as
|
|
17
|
+
> `error`: **6.6.4** reads 「每一个危险和可操作性性问题都**宜**作为单项记录」 and **6.6.3** opens
|
|
18
|
+
> 「HAZOP 分析输出**宜**包括:」. **A recommendation cannot support an error rating**, so both rules are
|
|
19
|
+
> now `warn` and **this plugin reports no error at all** — consistent with how the family treats every
|
|
20
|
+
> other recommended standard. A test pins this so a later edit cannot quietly re-escalate one.
|
|
21
|
+
>
|
|
22
|
+
> **Everything else is capped at `warn` or `info`, for three reasons the pack records:**
|
|
23
|
+
>
|
|
24
|
+
> 1. **Appendix A.2 — the one place a column list appears — is a 资料性附录.** Its wording is "表列的标题
|
|
25
|
+
> **可为**以下各项", it adds "**也可记录**其他信息", and it says outright that "工作表的版面设计**各有不同**".
|
|
26
|
+
> **There is no mandatory column list**, so a missing column can only ever be a suggestion.
|
|
27
|
+
> 2. **Clause 4.2 gives no criterion for node granularity.** It says the size of a node "取决于系统的
|
|
28
|
+
> 复杂性和危险的严重程度" and nothing quantitative follows. This plugin **does not** judge node size.
|
|
29
|
+
> 3. **The standard fixes no risk-level scale.** 6.5 mentions a risk matrix as useful and defers the method
|
|
30
|
+
> to IEC 60300-3-9; GB/T 27921-2023's matrix description is likewise informative. Levels must come from
|
|
31
|
+
> your own risk criteria, so the vocabulary ships **empty**.
|
|
32
|
+
>
|
|
33
|
+
> Two further honesty notes are in the pack. The guide-word vocabulary uses the standard's own wording —
|
|
34
|
+
> **「相反」, not the colloquial "相逆"** — and combines table 1 with table 2; a custom guide word is
|
|
35
|
+
> **not** non-compliant, because 6.4.3 permits one "只要在分析开始前进行了定义". And **SH/T 3240-2025**
|
|
36
|
+
> (the petrochemical HAZOP specification, in force 2025-11-01) had only its identity, status and glossary
|
|
37
|
+
> verified — **its clause text was not obtained, so this pack cites none of it**.
|
|
38
|
+
>
|
|
39
|
+
> The four judgements this plugin does not make: whether the causes are complete, whether the consequences
|
|
40
|
+
> are analysed far enough, whether the safeguards are adequate, whether a risk rating is correct.
|
|
41
|
+
|
|
42
|
+
## Compatibility
|
|
43
|
+
|
|
44
|
+
| Superfície | Estado |
|
|
45
|
+
|---|---|
|
|
46
|
+
| 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 |
|
|
47
|
+
| Node | `^22.19.0 || >=24.0.0` |
|
|
48
|
+
| Plataformas | Todas (ESM puro; sem código nativo, sem rede, sem chamada ao modelo) |
|
|
49
|
+
| Modo de ferramenta | Funciona em `native`, `ptc` e `both`; para um diretório inteiro use `ptc` |
|
|
50
|
+
|
|
51
|
+
## What it does
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
dsh plugin --profile <name> add dsh-hazplan-check
|
|
59
|
+
dsh --profile <name> --dump-config | grep 'dsh-hazplan-check'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Configuration
|
|
63
|
+
|
|
64
|
+
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/`.
|
|
65
|
+
|
|
66
|
+
| Chave | Tipo | Padrão | Descrição |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| `rulesFile` | string | `rules/hazplan-check.yaml` | Caminho do pacote de regras, relativo à raiz do pacote |
|
|
69
|
+
| `disabledRules` | string[] | `[]` | Ids de regras a desativar; cada uma aparece em `skipped` |
|
|
70
|
+
| `onlyRules` | string[] | `[]` | Executar apenas estas regras; vazio executa todas |
|
|
71
|
+
| `skipNotes` | string | `""` | Nota acrescentada a cada motivo de `skipped` |
|
|
72
|
+
| `timeoutMs` | number | `120000` | Orçamento de tempo limite cooperativo da ferramenta |
|
|
73
|
+
|
|
74
|
+
## Material format
|
|
75
|
+
|
|
76
|
+
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.
|
|
77
|
+
|
|
78
|
+
## Rule sources
|
|
79
|
+
|
|
80
|
+
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`.
|
|
81
|
+
|
|
82
|
+
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/`.
|
|
83
|
+
|
|
84
|
+
## Troubleshooting
|
|
85
|
+
|
|
86
|
+
- **O plugin instala mas a ferramenta não aparece**: confirme que `main` resolve para `lib/index.mjs` e que `pnpm run build` o gerou.
|
|
87
|
+
- **`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`.
|
|
88
|
+
- **Uma regra não executou**: leia o arranjo `skipped`.
|
|
89
|
+
- **`check` informa `manifest-peers` como falha**: problema conhecido do `dsh-plugin-dev`; o runtime aplica a compatibilidade na instalação.
|
|
90
|
+
- **Os horários parecem deslocados**: toda a aritmética é de hora local sobre as cadeias fornecidas.
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
pnpm install
|
|
96
|
+
pnpm run typecheck
|
|
97
|
+
pnpm test
|
|
98
|
+
pnpm run build
|
|
99
|
+
node ../scripts/sync-shared.mjs dsh-hazplan-check
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
O último comando copia o kit compartilhado de `../_shared` para `src/shared/`; execute-o novamente após cada alteração compartilhada.
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-hazplan-check contributors.
|
package/README-zh.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# dsh-hazplan-check
|
|
2
|
+
|
|
3
|
+
**Boundary:** this plugin checks one **HAZOP worksheet** for what a sheet can be held to — that every row
|
|
4
|
+
records the analysis content your template requires, that each 偏差 actually follows from the 工艺参数 and
|
|
5
|
+
引导词 beside it, that risk levels come from your own vocabulary, that every node has rows, and that
|
|
6
|
+
recommendations carry their closure fields. It does **not** judge whether the causes are complete, whether
|
|
7
|
+
the consequences are analysed far enough, whether the safeguards are adequate, or whether a risk rating is
|
|
8
|
+
correct. **Those four judgements are the study team's, and they are where HAZOP's value lies.**
|
|
9
|
+
|
|
10
|
+
> ### ⚠️ Nothing here is `error`, and the clause wording is why
|
|
11
|
+
>
|
|
12
|
+
> **GB/T 35320-2017《危险与可操作性分析(HAZOP分析)应用指南》** is in force (published and effective
|
|
13
|
+
> 2017-12-29, identical to IEC 61882:2001), and its clause text was obtained verbatim.
|
|
14
|
+
>
|
|
15
|
+
> **The standard is a *recommended* one (the number carries "/T"), and every clause this pack cites uses
|
|
16
|
+
> 宜 — "should" — not 应.** That applies to the two clauses an earlier version of this pack rated as
|
|
17
|
+
> `error`: **6.6.4** reads 「每一个危险和可操作性性问题都**宜**作为单项记录」 and **6.6.3** opens
|
|
18
|
+
> 「HAZOP 分析输出**宜**包括:」. **A recommendation cannot support an error rating**, so both rules are
|
|
19
|
+
> now `warn` and **this plugin reports no error at all** — consistent with how the family treats every
|
|
20
|
+
> other recommended standard. A test pins this so a later edit cannot quietly re-escalate one.
|
|
21
|
+
>
|
|
22
|
+
> **Everything else is capped at `warn` or `info`, for three reasons the pack records:**
|
|
23
|
+
>
|
|
24
|
+
> 1. **Appendix A.2 — the one place a column list appears — is a 资料性附录.** Its wording is "表列的标题
|
|
25
|
+
> **可为**以下各项", it adds "**也可记录**其他信息", and it says outright that "工作表的版面设计**各有不同**".
|
|
26
|
+
> **There is no mandatory column list**, so a missing column can only ever be a suggestion.
|
|
27
|
+
> 2. **Clause 4.2 gives no criterion for node granularity.** It says the size of a node "取决于系统的
|
|
28
|
+
> 复杂性和危险的严重程度" and nothing quantitative follows. This plugin **does not** judge node size.
|
|
29
|
+
> 3. **The standard fixes no risk-level scale.** 6.5 mentions a risk matrix as useful and defers the method
|
|
30
|
+
> to IEC 60300-3-9; GB/T 27921-2023's matrix description is likewise informative. Levels must come from
|
|
31
|
+
> your own risk criteria, so the vocabulary ships **empty**.
|
|
32
|
+
>
|
|
33
|
+
> Two further honesty notes are in the pack. The guide-word vocabulary uses the standard's own wording —
|
|
34
|
+
> **「相反」, not the colloquial "相逆"** — and combines table 1 with table 2; a custom guide word is
|
|
35
|
+
> **not** non-compliant, because 6.4.3 permits one "只要在分析开始前进行了定义". And **SH/T 3240-2025**
|
|
36
|
+
> (the petrochemical HAZOP specification, in force 2025-11-01) had only its identity, status and glossary
|
|
37
|
+
> verified — **its clause text was not obtained, so this pack cites none of it**.
|
|
38
|
+
>
|
|
39
|
+
> The four judgements this plugin does not make: whether the causes are complete, whether the consequences
|
|
40
|
+
> are analysed far enough, whether the safeguards are adequate, whether a risk rating is correct.
|
|
41
|
+
|
|
42
|
+
## Compatibility
|
|
43
|
+
|
|
44
|
+
| 项目 | 状态 |
|
|
45
|
+
|---|---|
|
|
46
|
+
| 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`**:它没有任何读取者,也无法拒装任何宿主 |
|
|
47
|
+
| Node | `^22.19.0 || >=24.0.0` |
|
|
48
|
+
| 平台 | 全平台(纯 ESM;无原生代码、无联网、不调用模型) |
|
|
49
|
+
| 工具模式 | `native` / `ptc` / `both` 均可;批量校验整个目录时建议 `ptc`,schema 成本只付一次 |
|
|
50
|
+
|
|
51
|
+
## What it does
|
|
52
|
+
|
|
53
|
+
规则表、字段说明与行为细节见 [README.md](README.md#what-it-does)(英文主版本)。本插件只列出材料与所引条款之间的字面差异,并对无法执行的检查在 `skipped` 中逐项说明。
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
dsh plugin --profile <name> add dsh-hazplan-check
|
|
59
|
+
dsh --profile <name> --dump-config | grep 'dsh-hazplan-check'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Configuration
|
|
63
|
+
|
|
64
|
+
全部可调参数都在 `src/config.ts` 的 Schemastery schema 中,只改 `cordis.yml` 即可生效,无需改代码;逐条阈值在 `rules/` 下的规则库文件里。
|
|
65
|
+
|
|
66
|
+
| 键 | 类型 | 默认值 | 说明 |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| `rulesFile` | string | `rules/hazplan-check.yaml` | 规则库文件路径,相对插件包根目录 |
|
|
69
|
+
| `disabledRules` | string[] | `[]` | 要停用的规则 id 列表;每条都会出现在 `skipped` 中 |
|
|
70
|
+
| `onlyRules` | string[] | `[]` | 只执行这些规则 id;留空表示执行全部规则 |
|
|
71
|
+
| `skipNotes` | string | `""` | 附加到每条 `skipped` 说明后的备注 |
|
|
72
|
+
| `timeoutMs` | number | `120000` | 工具协作式超时预算(毫秒) |
|
|
73
|
+
|
|
74
|
+
## Material format
|
|
75
|
+
|
|
76
|
+
支持 JSON 与 YAML。完整字段示例见 [README.md](README.md#material-format)(英文主版本)。字段在读取层是可选的,由检查引擎校验,因此部分导出的材料会产生"缺项"类差异,而不是让程序崩溃。
|
|
77
|
+
|
|
78
|
+
## Rule sources
|
|
79
|
+
|
|
80
|
+
规则数据与代码分离,每条规则都带文件名、文号、按原文自身编号体系的条款号、逐字摘录与来源地址。加载期强制:摘录必须是真实引文且不少于八个字符;依据仅为原则性条款(`kind: derived-from-principle`,严重级上限 `warn`)或本机构配置(`kind: institutional-configuration`,上限 `info`)的检查不得标为 `error`。夸大依据的规则库会在加载期失败,而不会产出一份看起来很有底气的报告。
|
|
81
|
+
|
|
82
|
+
核验中确认的边界与"刻意没有作出的结论"见 [README.md](README.md#rule-sources)(英文主版本)与随包的 `rules/evidence/` 目录。
|
|
83
|
+
|
|
84
|
+
## Troubleshooting
|
|
85
|
+
|
|
86
|
+
- **插件装上了但工具不出现**:确认 `main` 指向 `lib/index.mjs` 且 `pnpm run build` 已生成该文件;`main` 写错会让加载器静默跳过该条目。
|
|
87
|
+
- **`dsh plugin add` 报版本不兼容**:peer 范围覆盖 `0.1.x` 与 `0.2.x`;若运行时在其之外,可显式豁免:`dsh plugin --profile <name> allow-version <包名@版本> --dsh-version <runtime> --accept-risk`
|
|
88
|
+
- **某条规则没有执行**:查看 `skipped` 数组,其中写明了规则 id 与原因。
|
|
89
|
+
- **`check` 报 `manifest-peers` 失败**:静态检查器比对的是一份早于 0.2 世代的硬编码 peer 范围;安装期的 peer 校验以运行时为准。这是 `dsh-plugin-dev` 的已知上游问题。
|
|
90
|
+
- **时间看起来偏移**:全部计算都是对输入字符串做墙上时钟运算,不做时区换算。
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
pnpm install
|
|
96
|
+
pnpm run typecheck
|
|
97
|
+
pnpm test
|
|
98
|
+
pnpm run build
|
|
99
|
+
node ../scripts/sync-shared.mjs dsh-hazplan-check
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
第 4 项把 `../_shared` 的共享件同步进 `src/shared/`;每次改动共享件后都要重跑。
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-hazplan-check contributors.
|
package/README.md
CHANGED
|
@@ -1,3 +1,176 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-hazplan-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Boundary:** this plugin checks one **HAZOP worksheet** for what a sheet can be held to — that every row
|
|
4
|
+
records the analysis content your template requires, that each 偏差 actually follows from the 工艺参数 and
|
|
5
|
+
引导词 beside it, that risk levels come from your own vocabulary, that every node has rows, and that
|
|
6
|
+
recommendations carry their closure fields. It does **not** judge whether the causes are complete, whether
|
|
7
|
+
the consequences are analysed far enough, whether the safeguards are adequate, or whether a risk rating is
|
|
8
|
+
correct. **Those four judgements are the study team's, and they are where HAZOP's value lies.**
|
|
9
|
+
|
|
10
|
+
> ### ⚠️ Nothing here is `error`, and the clause wording is why
|
|
11
|
+
>
|
|
12
|
+
> **GB/T 35320-2017《危险与可操作性分析(HAZOP分析)应用指南》** is in force (published and effective
|
|
13
|
+
> 2017-12-29, identical to IEC 61882:2001), and its clause text was obtained verbatim.
|
|
14
|
+
>
|
|
15
|
+
> **The standard is a *recommended* one (the number carries "/T"), and every clause this pack cites uses
|
|
16
|
+
> 宜 — "should" — not 应.** That applies to the two clauses an earlier version of this pack rated as
|
|
17
|
+
> `error`: **6.6.4** reads 「每一个危险和可操作性性问题都**宜**作为单项记录」 and **6.6.3** opens
|
|
18
|
+
> 「HAZOP 分析输出**宜**包括:」. **A recommendation cannot support an error rating**, so both rules are
|
|
19
|
+
> now `warn` and **this plugin reports no error at all** — consistent with how the family treats every
|
|
20
|
+
> other recommended standard. A test pins this so a later edit cannot quietly re-escalate one.
|
|
21
|
+
>
|
|
22
|
+
> **Everything else is capped at `warn` or `info`, for three reasons the pack records:**
|
|
23
|
+
>
|
|
24
|
+
> 1. **Appendix A.2 — the one place a column list appears — is a 资料性附录.** Its wording is "表列的标题
|
|
25
|
+
> **可为**以下各项", it adds "**也可记录**其他信息", and it says outright that "工作表的版面设计**各有不同**".
|
|
26
|
+
> **There is no mandatory column list**, so a missing column can only ever be a suggestion.
|
|
27
|
+
> 2. **Clause 4.2 gives no criterion for node granularity.** It says the size of a node "取决于系统的
|
|
28
|
+
> 复杂性和危险的严重程度" and nothing quantitative follows. This plugin **does not** judge node size.
|
|
29
|
+
> 3. **The standard fixes no risk-level scale.** 6.5 mentions a risk matrix as useful and defers the method
|
|
30
|
+
> to IEC 60300-3-9; GB/T 27921-2023's matrix description is likewise informative. Levels must come from
|
|
31
|
+
> your own risk criteria, so the vocabulary ships **empty**.
|
|
32
|
+
>
|
|
33
|
+
> Two further honesty notes are in the pack. The guide-word vocabulary uses the standard's own wording —
|
|
34
|
+
> **「相反」, not the colloquial "相逆"** — and combines table 1 with table 2; a custom guide word is
|
|
35
|
+
> **not** non-compliant, because 6.4.3 permits one "只要在分析开始前进行了定义". And **SH/T 3240-2025**
|
|
36
|
+
> (the petrochemical HAZOP specification, in force 2025-11-01) had only its identity, status and glossary
|
|
37
|
+
> verified — **its clause text was not obtained, so this pack cites none of it**.
|
|
38
|
+
>
|
|
39
|
+
> The four judgements this plugin does not make: whether the causes are complete, whether the consequences
|
|
40
|
+
> are analysed far enough, whether the safeguards are adequate, whether a risk rating is correct.
|
|
41
|
+
|
|
42
|
+
## Compatibility
|
|
43
|
+
|
|
44
|
+
| Surface | Status |
|
|
45
|
+
|---|---|
|
|
46
|
+
| 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 |
|
|
47
|
+
| Node | `^22.19.0 || >=24.0.0` |
|
|
48
|
+
| Platforms | All (plain ESM; no native code, no network, no model call) |
|
|
49
|
+
| Tool mode | Works in `native`, `ptc` and `both`; for several worksheets use `ptc` |
|
|
50
|
+
|
|
51
|
+
## What it does
|
|
52
|
+
|
|
53
|
+
Registers the `hazplan_check` tool. It reads one worksheet — rows keyed by the sheet's own column names,
|
|
54
|
+
in Chinese or English — applies a versioned rule pack, and returns a report.
|
|
55
|
+
|
|
56
|
+
| Rule | Check | Severity | Basis |
|
|
57
|
+
|---|---|---|---|
|
|
58
|
+
| `HZ-001` | every problem is its own row, with its cause | warn | 6.6.4 |
|
|
59
|
+
| `HZ-002` | every analysed node is recorded on the sheet | warn | 6.6.3 |
|
|
60
|
+
| `HZ-003` | guide words come from table 1 + table 2, or were declared first | warn | 表1、表2 + 6.4.3 |
|
|
61
|
+
| `HZ-004` | the row shows which element the deviation came from | warn | 3.3 + 6.4.3 |
|
|
62
|
+
| `HZ-005` | risk levels come from your risk criteria (off by default) | info | 6.5 + GB/T 27921 |
|
|
63
|
+
| `HZ-006` | the sheet names its analysis subject | warn | 附录A.2(资料性) |
|
|
64
|
+
| `HZ-007` | the deviation is the parameter read through its guide word | warn | 6.4.3 |
|
|
65
|
+
|
|
66
|
+
## Install
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
dsh plugin --profile <name> add dsh-hazplan-check
|
|
70
|
+
dsh --profile <name> --dump-config | grep 'dsh-hazplan-check'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Configuration
|
|
74
|
+
|
|
75
|
+
| Key | Type | Default | Description |
|
|
76
|
+
|---|---|---|---|
|
|
77
|
+
| `rulesFile` | string | `rules/hazplan-check.yaml` | Rule-pack path, relative to the package root |
|
|
78
|
+
| `disabledRules` | string[] | `[]` | Rule ids to stop running; each appears in `skipped` |
|
|
79
|
+
| `onlyRules` | string[] | `[]` | Run only these rule ids; empty runs every rule |
|
|
80
|
+
| `skipNotes` | string | `""` | Note appended to every `skipped` reason |
|
|
81
|
+
| `timeoutMs` | number | `120000` | Cooperative tool timeout budget |
|
|
82
|
+
|
|
83
|
+
Rule-level parameters worth knowing:
|
|
84
|
+
|
|
85
|
+
- `HZ-001` `requiredFields` — the columns every row must fill. Left empty it falls back to the pair the
|
|
86
|
+
clause itself names: `[偏差, 原因]`.
|
|
87
|
+
- `HZ-005` `riskLevels` — your risk vocabulary, e.g. `[高, 中, 低]` or `[Ⅰ, Ⅱ, Ⅲ, Ⅳ]`. Empty means the
|
|
88
|
+
rule does not run. It can also be passed per call.
|
|
89
|
+
- `HZ-003` `guideWords` — the guide-word list your study declared before the meeting, when it uses its
|
|
90
|
+
own under 6.4.3. Empty means the standard's tables 1 and 2 are used.
|
|
91
|
+
- `HZ-006` `requireHeader` — set to `false` if your sheet legitimately carries no subject line.
|
|
92
|
+
|
|
93
|
+
The plugin's own configuration also accepts `riskLevels` and `guideWords`, so a deployment can set the
|
|
94
|
+
risk vocabulary and the declared guide words once for every call rather than passing them each time.
|
|
95
|
+
|
|
96
|
+
## Material format
|
|
97
|
+
|
|
98
|
+
The tool accepts JSON or YAML. Rows are keyed by the sheet's own column names; **Chinese and English names
|
|
99
|
+
both work**, so an export from a commercial HAZOP tool loads without editing:
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
subject: 某装置 HAZOP 分析
|
|
103
|
+
revision: V1.0
|
|
104
|
+
rows:
|
|
105
|
+
- { 节点: 进料单元, 设计意图: 将原料按设计流量送入反应器, 工艺参数: 流量, 引导词: 无,
|
|
106
|
+
偏差: 无流量, 原因: 进料泵故障, 后果: 反应器液位下降, 现有安全措施: 液位低报警,
|
|
107
|
+
建议措施: 增加进料泵备用泵, 风险等级: 中, 责任人: 张工, 完成期限: 2026-06-30 }
|
|
108
|
+
- { Node: N2, Parameter: Temperature, "Guide Word": High, Deviation: High temperature,
|
|
109
|
+
Causes: Cooling failure, Consequences: Runaway, Safeguards: High-temp trip }
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Column names are matched case-insensitively and ignoring spaces, underscores and hyphens, so `Guide Word`,
|
|
113
|
+
`guide_word` and `guideword` all resolve to the same field.
|
|
114
|
+
|
|
115
|
+
`HZ-002` compares the deviation against the parameter+guide-word combination over a set of separators
|
|
116
|
+
(`, `, `+`, `、`, `/`, `-`, `—`, `的`, `:`) and in both word orders, so `流量无`, `流量 + 无` and `无流量`
|
|
117
|
+
all pass. It reports a mismatch as a likely copy-paste artefact — not as a claim that the deviation is
|
|
118
|
+
technically wrong.
|
|
119
|
+
|
|
120
|
+
## Rule sources
|
|
121
|
+
|
|
122
|
+
Rule data lives in `rules/hazplan-check.yaml`. Every rule carries a document, a document number, a clause
|
|
123
|
+
in the source's own numbering, a verbatim excerpt and the URL the excerpt was read from. The loader
|
|
124
|
+
enforces that an excerpt is a real quotation of at least eight characters, and that a check resting on a
|
|
125
|
+
general principle or a local policy can never be declared `error`.
|
|
126
|
+
|
|
127
|
+
The clauses quoted come from **GB/T 35320-2017** — 3.3, 4.2, 6.4.3, 6.5, 6.6.3, 6.6.4, tables 1 and 2,
|
|
128
|
+
and appendix A.2 — plus **GB/T 27921-2023** appendix B.10.3 for the risk-matrix description. The clause
|
|
129
|
+
text was read from a full-text transcription whose structure cross-checks against the standard's official
|
|
130
|
+
metadata; the pack records that the source is a transcription.
|
|
131
|
+
|
|
132
|
+
Four findings shaped this pack and are recorded in its header:
|
|
133
|
+
|
|
134
|
+
1. **Appendix A.2 is informative**, so its column list is a suggestion and never a requirement.
|
|
135
|
+
2. **Clause 4.2 gives no criterion for node size**, so node granularity is not automatically judged.
|
|
136
|
+
3. **The standard fixes no risk-level scale**, so levels are yours and the vocabulary ships empty.
|
|
137
|
+
4. **SH/T 3240-2025 exists but its clause text was not obtained**, so no article of it is cited — only its
|
|
138
|
+
identity is noted, in the pack header.
|
|
139
|
+
|
|
140
|
+
The full clause-verification report, including the sources that were checked and rejected, is in
|
|
141
|
+
`rules/evidence/clause-verification.md`.
|
|
142
|
+
|
|
143
|
+
## Troubleshooting
|
|
144
|
+
|
|
145
|
+
- **`HZ-001`, `HZ-003` or `HZ-005` report themselves as skipped.** Their lists are empty. Fill in the ones
|
|
146
|
+
your template uses.
|
|
147
|
+
- **`HZ-002` fires on a row that reads fine to me.** Your sheet may write a fuller deviation than
|
|
148
|
+
`参数+引导词`. The rule says "likely a copy-paste artefact"; either normalise the column or accept it as
|
|
149
|
+
noise. It never blocks anything.
|
|
150
|
+
- **`HZ-002` reports nothing.** The sheet does not carry all three of 工艺参数, 引导词 and 偏差 — the rule
|
|
151
|
+
says so in `skipped` rather than guessing.
|
|
152
|
+
- **The reader refuses a worksheet it used to accept.** It found none of the known column names; the error
|
|
153
|
+
names the columns it saw. Rename one column or add the name to `COLUMNS` in `src/model.ts`-adjacent
|
|
154
|
+
configuration.
|
|
155
|
+
- **The plugin installs but the tool never appears.** Check that `main` resolves to `lib/index.mjs` and
|
|
156
|
+
that `pnpm run build` produced it; a wrong `main` makes the loader skip the entry silently.
|
|
157
|
+
- **`dsh plugin add` refuses the package as incompatible.** The peer range covers `0.1.x` and `0.2.x`; if
|
|
158
|
+
your runtime sits outside it, grant an explicit exemption:
|
|
159
|
+
`dsh plugin --profile <name> allow-version dsh-hazplan-check@0.1.0 --dsh-version <runtime> --accept-risk`
|
|
160
|
+
- **`check` reports `manifest-peers` as failed.** The static checker compares against a hard-coded peer
|
|
161
|
+
range that predates the 0.2 line. The runtime enforces peer compatibility at install time, so the
|
|
162
|
+
declared range is the correct one; this is a known upstream issue in `dsh-plugin-dev`.
|
|
163
|
+
|
|
164
|
+
## Development
|
|
165
|
+
|
|
166
|
+
```sh
|
|
167
|
+
pnpm install
|
|
168
|
+
pnpm run typecheck # tsc --noEmit
|
|
169
|
+
pnpm test # vitest, paired fixtures per rule
|
|
170
|
+
pnpm run build # tsdown -> lib/index.mjs + lib/index.d.mts
|
|
171
|
+
node ../scripts/sync-shared.mjs dsh-hazplan-check # refresh src/shared from ../_shared
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-hazplan-check contributors.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# dsh-hazplan-check 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-hazplan-check
|
|
8
|
+
name: dsh-hazplan-check
|
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="HAZOP worksheet 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>
|