@hellraisercenobit/ai-engineering-gate 0.8.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/README.md +82 -0
- package/agents/design-pattern-reviewer.md +40 -0
- package/agents/modern-typescript-reviewer.md +24 -0
- package/agents/testing-pattern-reviewer.md +23 -0
- package/bin/ai-engineering-gate.mjs +6 -0
- package/contracts/axi/axi-standard.md +273 -0
- package/contracts/axi/pin.json +36 -0
- package/contracts/members.json +58 -0
- package/contracts/schemas/arbitration.schema.json +45 -0
- package/contracts/schemas/decision-envelope.schema.json +215 -0
- package/contracts/schemas/declaration.schema.json +190 -0
- package/contracts/schemas/dispute.schema.json +67 -0
- package/contracts/schemas/evidence-append.schema.json +72 -0
- package/contracts/schemas/gate-output.schema.json +296 -0
- package/contracts/schemas/marker.schema.json +75 -0
- package/contracts/schemas/review-envelope.schema.json +378 -0
- package/contracts/schemas/verdict-record.schema.json +191 -0
- package/contracts/suite-contract.md +270 -0
- package/dist/ai-engineering-gate.mjs +2762 -0
- package/package.json +47 -0
- package/skills/engineering/review-design-patterns/LICENSE +6 -0
- package/skills/engineering/review-design-patterns/SKILL.md +196 -0
- package/skills/engineering/review-design-patterns/agents/openai.yaml +3 -0
- package/skills/engineering/review-design-patterns/references/smell-signatures.md +117 -0
- package/skills/engineering/review-design-patterns/review-design-patterns.yaml +25 -0
- package/skills/engineering/review-modern-typescript/LICENSE +21 -0
- package/skills/engineering/review-modern-typescript/SKILL.md +88 -0
- package/skills/engineering/review-modern-typescript/agents/openai.yaml +3 -0
- package/skills/engineering/review-modern-typescript/references/smell-signatures.md +36 -0
- package/skills/engineering/review-modern-typescript/review-modern-typescript.yaml +22 -0
- package/skills/engineering/review-testing-patterns/SKILL.md +108 -0
- package/skills/engineering/review-testing-patterns/agents/openai.yaml +4 -0
- package/skills/engineering/review-testing-patterns/references/compiler-profile.mjs +103 -0
- package/skills/engineering/review-testing-patterns/references/smell-signatures.md +30 -0
- package/skills/engineering/review-testing-patterns/review-testing-patterns.yaml +23 -0
- package/skills/engineering/transpose-design-patterns/LICENSE +6 -0
- package/skills/engineering/transpose-design-patterns/SKILL.md +231 -0
- package/skills/engineering/transpose-design-patterns/agents/openai.yaml +3 -0
- package/skills/engineering/transpose-design-patterns/references/arbitration.schema.json +45 -0
- package/skills/engineering/transpose-design-patterns/references/decision-envelope.schema.json +215 -0
- package/skills/engineering/transpose-design-patterns/references/declaration.schema.json +190 -0
- package/skills/engineering/transpose-design-patterns/references/design-decision-record.schema.json +731 -0
- package/skills/engineering/transpose-design-patterns/references/dispute.schema.json +67 -0
- package/skills/engineering/transpose-design-patterns/references/evidence-append.schema.json +72 -0
- package/skills/engineering/transpose-design-patterns/references/marker.schema.json +75 -0
- package/skills/engineering/transpose-design-patterns/references/pattern-catalog.md +305 -0
- package/skills/engineering/transpose-design-patterns/references/record.example.json +120 -0
- package/skills/engineering/transpose-design-patterns/references/review-envelope.schema.json +378 -0
- package/skills/engineering/transpose-design-patterns/references/suite-contract.md +270 -0
- package/skills/engineering/transpose-design-patterns/references/transpose-angular.md +224 -0
- package/skills/engineering/transpose-design-patterns/references/transpose-php.md +561 -0
- package/skills/engineering/transpose-design-patterns/references/transpose-quarkus.md +283 -0
- package/skills/engineering/transpose-design-patterns/references/transpose-react.md +256 -0
- package/skills/engineering/transpose-design-patterns/references/transpose-vanilla.md +204 -0
- package/skills/engineering/transpose-design-patterns/references/transpose-vue.md +234 -0
- package/skills/engineering/transpose-design-patterns/transpose-design-patterns.yaml +24 -0
- package/skills/engineering/transpose-modern-typescript/LICENSE +21 -0
- package/skills/engineering/transpose-modern-typescript/SKILL.md +90 -0
- package/skills/engineering/transpose-modern-typescript/agents/openai.yaml +3 -0
- package/skills/engineering/transpose-modern-typescript/references/arbitration.schema.json +45 -0
- package/skills/engineering/transpose-modern-typescript/references/catalog.md +38 -0
- package/skills/engineering/transpose-modern-typescript/references/collections.md +50 -0
- package/skills/engineering/transpose-modern-typescript/references/compatibility.md +61 -0
- package/skills/engineering/transpose-modern-typescript/references/decision-envelope.schema.json +215 -0
- package/skills/engineering/transpose-modern-typescript/references/decision-record.schema.json +830 -0
- package/skills/engineering/transpose-modern-typescript/references/declaration.schema.json +190 -0
- package/skills/engineering/transpose-modern-typescript/references/dispute.schema.json +67 -0
- package/skills/engineering/transpose-modern-typescript/references/evidence-append.schema.json +72 -0
- package/skills/engineering/transpose-modern-typescript/references/idioms.md +74 -0
- package/skills/engineering/transpose-modern-typescript/references/marker.schema.json +75 -0
- package/skills/engineering/transpose-modern-typescript/references/platform.md +147 -0
- package/skills/engineering/transpose-modern-typescript/references/record.example.json +172 -0
- package/skills/engineering/transpose-modern-typescript/references/record.md +37 -0
- package/skills/engineering/transpose-modern-typescript/references/review-envelope.schema.json +378 -0
- package/skills/engineering/transpose-modern-typescript/references/suite-contract.md +270 -0
- package/skills/engineering/transpose-modern-typescript/references/types.md +97 -0
- package/skills/engineering/transpose-modern-typescript/transpose-modern-typescript.yaml +22 -0
- package/skills/engineering/transpose-testing-patterns/SKILL.md +96 -0
- package/skills/engineering/transpose-testing-patterns/agents/openai.yaml +4 -0
- package/skills/engineering/transpose-testing-patterns/references/arbitration.schema.json +45 -0
- package/skills/engineering/transpose-testing-patterns/references/catalog.md +218 -0
- package/skills/engineering/transpose-testing-patterns/references/decision-envelope.schema.json +215 -0
- package/skills/engineering/transpose-testing-patterns/references/decision-record.schema.json +857 -0
- package/skills/engineering/transpose-testing-patterns/references/declaration.schema.json +190 -0
- package/skills/engineering/transpose-testing-patterns/references/detect-adapter.mjs +98 -0
- package/skills/engineering/transpose-testing-patterns/references/dispute.schema.json +67 -0
- package/skills/engineering/transpose-testing-patterns/references/doubles-data.md +45 -0
- package/skills/engineering/transpose-testing-patterns/references/evidence-append.schema.json +72 -0
- package/skills/engineering/transpose-testing-patterns/references/journal-event.schema.json +115 -0
- package/skills/engineering/transpose-testing-patterns/references/marker.schema.json +75 -0
- package/skills/engineering/transpose-testing-patterns/references/record.example.json +230 -0
- package/skills/engineering/transpose-testing-patterns/references/record.md +25 -0
- package/skills/engineering/transpose-testing-patterns/references/review-envelope.schema.json +378 -0
- package/skills/engineering/transpose-testing-patterns/references/suite-contract.md +270 -0
- package/skills/engineering/transpose-testing-patterns/references/tdd.md +62 -0
- package/skills/engineering/transpose-testing-patterns/references/transpose-codeception.md +84 -0
- package/skills/engineering/transpose-testing-patterns/references/transpose-karma-jasmine-angular.md +73 -0
- package/skills/engineering/transpose-testing-patterns/references/transpose-vitest.md +111 -0
- package/skills/engineering/transpose-testing-patterns/references/typescript.md +42 -0
- package/skills/engineering/transpose-testing-patterns/transpose-testing-patterns.yaml +23 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/hellraisercenobit/skills/blob/main/contracts/schemas/declaration.schema.json",
|
|
4
|
+
"title": "Dimension declaration 1.0.0",
|
|
5
|
+
"description": "One per registered dimension per task, written through `declare` before any decision record. It states whether the dimension applies, on which paths, for which request and under which constraints. A non-applicable dimension has a declaration and nothing else.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"document",
|
|
10
|
+
"documentVersion",
|
|
11
|
+
"dimension",
|
|
12
|
+
"applicability",
|
|
13
|
+
"reason",
|
|
14
|
+
"request",
|
|
15
|
+
"constraints",
|
|
16
|
+
"revision"
|
|
17
|
+
],
|
|
18
|
+
"properties": {
|
|
19
|
+
"document": {
|
|
20
|
+
"const": "declaration"
|
|
21
|
+
},
|
|
22
|
+
"documentVersion": {
|
|
23
|
+
"const": "1.0.0"
|
|
24
|
+
},
|
|
25
|
+
"dimension": {
|
|
26
|
+
"description": "A dimension identifier the member manifest registers.",
|
|
27
|
+
"type": "string",
|
|
28
|
+
"minLength": 1
|
|
29
|
+
},
|
|
30
|
+
"applicability": {
|
|
31
|
+
"enum": [
|
|
32
|
+
"applicable",
|
|
33
|
+
"non-applicable"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"reason": {
|
|
37
|
+
"description": "Why the dimension applies, or why it does not. Never empty: skipping a dimension is a recorded decision.",
|
|
38
|
+
"type": "string",
|
|
39
|
+
"minLength": 1
|
|
40
|
+
},
|
|
41
|
+
"request": {
|
|
42
|
+
"description": "The requester's own wording, without builder choices or rationale. The neutral brief is rendered from it.",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1
|
|
45
|
+
},
|
|
46
|
+
"constraints": {
|
|
47
|
+
"description": "Factual constraints only: project targets, public contracts, independent sources. When tests are TypeScript, name the ES/compiler target as a factual string (example: compiler: TypeScript 4.0.5, target ES2015, lib es2015, strict off). A tsconfig path in scope.configuration is not a substitute. PHP and other non-TypeScript suites omit this constraint rather than invent one.",
|
|
48
|
+
"type": "array",
|
|
49
|
+
"items": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"minLength": 1
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"base": {
|
|
55
|
+
"$ref": "#/$defs/base"
|
|
56
|
+
},
|
|
57
|
+
"scope": {
|
|
58
|
+
"$ref": "#/$defs/scope"
|
|
59
|
+
},
|
|
60
|
+
"revision": {
|
|
61
|
+
"$ref": "#/$defs/revision"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"$defs": {
|
|
65
|
+
"base": {
|
|
66
|
+
"description": "The comparison base. Required when the dimension applies; the change set is the diff from its merge-base with HEAD.",
|
|
67
|
+
"type": "string",
|
|
68
|
+
"minLength": 1
|
|
69
|
+
},
|
|
70
|
+
"scope": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"required": [
|
|
74
|
+
"paths"
|
|
75
|
+
],
|
|
76
|
+
"properties": {
|
|
77
|
+
"paths": {
|
|
78
|
+
"description": "Repository-relative file paths or directory prefixes the dimension protects.",
|
|
79
|
+
"type": "array",
|
|
80
|
+
"minItems": 1,
|
|
81
|
+
"uniqueItems": true,
|
|
82
|
+
"items": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"minLength": 1
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"configuration": {
|
|
88
|
+
"description": "Repository-relative configuration files the decisions depend on. They enter the source fingerprint.",
|
|
89
|
+
"type": "array",
|
|
90
|
+
"uniqueItems": true,
|
|
91
|
+
"items": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"minLength": 1
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"revision": {
|
|
99
|
+
"description": "Same shape as a decision record's revision: revision 1 has no previous, a later one names it.",
|
|
100
|
+
"type": "object",
|
|
101
|
+
"additionalProperties": false,
|
|
102
|
+
"required": [
|
|
103
|
+
"number",
|
|
104
|
+
"previous",
|
|
105
|
+
"reason"
|
|
106
|
+
],
|
|
107
|
+
"properties": {
|
|
108
|
+
"number": {
|
|
109
|
+
"type": "integer",
|
|
110
|
+
"minimum": 1
|
|
111
|
+
},
|
|
112
|
+
"previous": {
|
|
113
|
+
"type": [
|
|
114
|
+
"string",
|
|
115
|
+
"null"
|
|
116
|
+
],
|
|
117
|
+
"minLength": 1
|
|
118
|
+
},
|
|
119
|
+
"reason": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"minLength": 1
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"allOf": [
|
|
125
|
+
{
|
|
126
|
+
"if": {
|
|
127
|
+
"properties": {
|
|
128
|
+
"number": {
|
|
129
|
+
"type": "integer",
|
|
130
|
+
"minimum": 2
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"required": [
|
|
134
|
+
"number"
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"then": {
|
|
138
|
+
"properties": {
|
|
139
|
+
"previous": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"minLength": 1
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"else": {
|
|
146
|
+
"properties": {
|
|
147
|
+
"previous": {
|
|
148
|
+
"type": "null"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"allOf": [
|
|
157
|
+
{
|
|
158
|
+
"if": {
|
|
159
|
+
"properties": {
|
|
160
|
+
"applicability": {
|
|
161
|
+
"const": "applicable"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"required": [
|
|
165
|
+
"applicability"
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
"then": {
|
|
169
|
+
"required": [
|
|
170
|
+
"scope",
|
|
171
|
+
"base"
|
|
172
|
+
],
|
|
173
|
+
"properties": {
|
|
174
|
+
"scope": {
|
|
175
|
+
"$ref": "#/$defs/scope"
|
|
176
|
+
},
|
|
177
|
+
"base": {
|
|
178
|
+
"$ref": "#/$defs/base"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"else": {
|
|
183
|
+
"properties": {
|
|
184
|
+
"scope": false,
|
|
185
|
+
"base": false
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/hellraisercenobit/skills/blob/main/contracts/schemas/dispute.schema.json",
|
|
4
|
+
"title": "Dispute 1.0.0",
|
|
5
|
+
"description": "The builder's second and only other response to a finding, beside addressing it. It contests one finding with a pointer to counter-evidence that already exists; a dispute without such a pointer is refused. It goes to the user and its only exit is an arbitration.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"document",
|
|
10
|
+
"documentVersion",
|
|
11
|
+
"dimension",
|
|
12
|
+
"report",
|
|
13
|
+
"finding",
|
|
14
|
+
"counterEvidence",
|
|
15
|
+
"position"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"document": {
|
|
19
|
+
"const": "dispute"
|
|
20
|
+
},
|
|
21
|
+
"documentVersion": {
|
|
22
|
+
"const": "1.0.0"
|
|
23
|
+
},
|
|
24
|
+
"dimension": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"minLength": 1
|
|
27
|
+
},
|
|
28
|
+
"report": {
|
|
29
|
+
"description": "The identifier of the report that carries the contested finding.",
|
|
30
|
+
"type": "string",
|
|
31
|
+
"minLength": 1
|
|
32
|
+
},
|
|
33
|
+
"finding": {
|
|
34
|
+
"description": "The contested finding's identifier.",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"minLength": 1
|
|
37
|
+
},
|
|
38
|
+
"counterEvidence": {
|
|
39
|
+
"description": "Pointers to artifacts that exist now. Each path is checked; a dangling pointer refuses the dispute.",
|
|
40
|
+
"type": "array",
|
|
41
|
+
"minItems": 1,
|
|
42
|
+
"items": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"additionalProperties": false,
|
|
45
|
+
"required": [
|
|
46
|
+
"path",
|
|
47
|
+
"claim"
|
|
48
|
+
],
|
|
49
|
+
"properties": {
|
|
50
|
+
"path": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"minLength": 1
|
|
53
|
+
},
|
|
54
|
+
"claim": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"minLength": 1
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"position": {
|
|
62
|
+
"description": "The builder's position in one sentence.",
|
|
63
|
+
"type": "string",
|
|
64
|
+
"minLength": 1
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/hellraisercenobit/skills/blob/main/contracts/schemas/evidence-append.schema.json",
|
|
4
|
+
"title": "Evidence append 1.0.0",
|
|
5
|
+
"description": "Append-only. Journal events, check outputs, snapshots and any artifact a record planned are filed through `evidence append`, never written into the gate's index by hand. The gate stamps every append with the content hashes of the record's planned artifacts, by role, so an event proves the state of test and production artifacts at the moment it was filed.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"document",
|
|
10
|
+
"documentVersion",
|
|
11
|
+
"dimension",
|
|
12
|
+
"record",
|
|
13
|
+
"kind",
|
|
14
|
+
"payload"
|
|
15
|
+
],
|
|
16
|
+
"properties": {
|
|
17
|
+
"document": {
|
|
18
|
+
"const": "evidence-append"
|
|
19
|
+
},
|
|
20
|
+
"documentVersion": {
|
|
21
|
+
"const": "1.0.0"
|
|
22
|
+
},
|
|
23
|
+
"dimension": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"minLength": 1
|
|
26
|
+
},
|
|
27
|
+
"record": {
|
|
28
|
+
"description": "The decision record this evidence belongs to.",
|
|
29
|
+
"type": "string",
|
|
30
|
+
"minLength": 1
|
|
31
|
+
},
|
|
32
|
+
"kind": {
|
|
33
|
+
"description": "A kind the member's evidence schemas name, which then validates the payload, or one of the generic kinds.",
|
|
34
|
+
"type": "string",
|
|
35
|
+
"minLength": 1
|
|
36
|
+
},
|
|
37
|
+
"produces": {
|
|
38
|
+
"description": "The planned artifact this append produces or extends. A planned artifact is satisfied by a file in the worktree or by an append that names it here.",
|
|
39
|
+
"type": "string",
|
|
40
|
+
"minLength": 1
|
|
41
|
+
},
|
|
42
|
+
"payload": {
|
|
43
|
+
"description": "Opaque to the envelope. Validated against the member's evidence schema when its kind names one."
|
|
44
|
+
},
|
|
45
|
+
"filedAt": {
|
|
46
|
+
"description": "Stamped by the gate when the append is stored.",
|
|
47
|
+
"type": "string",
|
|
48
|
+
"minLength": 1
|
|
49
|
+
},
|
|
50
|
+
"artifactHashes": {
|
|
51
|
+
"description": "Stamped by the gate: the content hash of every artifact the record planned, grouped by role, at the moment of the append.",
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"additionalProperties": {
|
|
56
|
+
"type": [
|
|
57
|
+
"string",
|
|
58
|
+
"null"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"builder": {
|
|
64
|
+
"description": "Stamped by the gate: the identity it captured for the caller.",
|
|
65
|
+
"type": "object"
|
|
66
|
+
},
|
|
67
|
+
"replayed": {
|
|
68
|
+
"description": "Stamped by the gate: `true` only when the gate itself ran the scenario through `replay`.",
|
|
69
|
+
"type": "boolean"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Everyday idioms
|
|
2
|
+
|
|
3
|
+
Apply MT-23 to every feature's actual target support.
|
|
4
|
+
|
|
5
|
+
## MT-01 - Extract and construct values clearly
|
|
6
|
+
|
|
7
|
+
**Intent/use:** repeated properties from the same stable object, tuples or parameters can
|
|
8
|
+
use shallow destructuring; use shorthand, rest or spread when they express the exact shape
|
|
9
|
+
with less bookkeeping. Prefer `const { id, name } = user` over repeated stable extractions.
|
|
10
|
+
**Alternatives/trade-offs:** direct access preserves provenance; explicit copies expose a
|
|
11
|
+
boundary. Destructuring defaults cover undefined, not null. Spread/rest copy own enumerable
|
|
12
|
+
properties shallowly; they are not cloning or sanitizing arbitrary objects.
|
|
13
|
+
**Avoid:** deep cryptic patterns, extracting a method that needs its receiver, changing getter
|
|
14
|
+
count/order or reactive read timing. Do not blanket-destructure framework state.
|
|
15
|
+
**Invariants:** identical values, identity/copy depth, property evaluation and receiver behavior.
|
|
16
|
+
**Sources/support:** [destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring),
|
|
17
|
+
[spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax);
|
|
18
|
+
check syntax transforms and the project's reactivity contract.
|
|
19
|
+
|
|
20
|
+
## MT-02 - Default only for the intended absence
|
|
21
|
+
|
|
22
|
+
**Intent/use:** choose `value ?? fallback` when only null/undefined mean absent; remove verbose
|
|
23
|
+
nullish ternaries. Preserve 0, false and empty string.
|
|
24
|
+
**Alternatives/trade-offs:** `||` is correct for deliberate falsy fallback; a destructuring
|
|
25
|
+
default applies only to undefined. Explicit branching is appropriate when outcomes differ.
|
|
26
|
+
**Avoid:** replacing a domain truthiness rule mechanically, hiding required data, or changing
|
|
27
|
+
fallback laziness. Parenthesize mixtures with logical operators as required by the grammar.
|
|
28
|
+
**Invariants:** test null, undefined, 0, false and empty string against the original contract.
|
|
29
|
+
**Source/support:** [nullish coalescing](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing);
|
|
30
|
+
parser/transpiler support is separate from library APIs.
|
|
31
|
+
|
|
32
|
+
## MT-03 - Initialize a mutable location once
|
|
33
|
+
|
|
34
|
+
**Intent/use:** `state.items ??= createItems()` expresses intentional nullish initialization.
|
|
35
|
+
**Alternatives/trade-offs:** explicit condition for distinct null/undefined cases; immutable
|
|
36
|
+
replacement when ownership forbids mutation. A getter/setter is observable code.
|
|
37
|
+
**Avoid:** `||=` if false/0/empty string is valid; eager fallback construction; assuming
|
|
38
|
+
`x ??= y` and `x = x ?? y` have the same setter behavior.
|
|
39
|
+
**Invariants:** existing collection identity survives; default is lazy; target evaluation
|
|
40
|
+
and setter calls match the intended contract; mutation is owned by this operation.
|
|
41
|
+
**Source/support:** [nullish assignment](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_assignment);
|
|
42
|
+
check build transform and access effects.
|
|
43
|
+
|
|
44
|
+
## MT-04 - Chain genuinely optional access
|
|
45
|
+
|
|
46
|
+
**Intent/use:** choose `object?.property`, `callback?.()`, `items?.[index]` or
|
|
47
|
+
`items?.[index]?.label` when the corresponding location may legitimately be absent.
|
|
48
|
+
**Alternatives/trade-offs:** required data uses validation or an explicit failure; a branch
|
|
49
|
+
can distinguish absence causes. `items?.map(f) ?? []` is valid only if absent and empty
|
|
50
|
+
collections mean the same thing. Optional calls still require a callable present value.
|
|
51
|
+
**Avoid:** masking a required item, treating optional chaining as external-data validation,
|
|
52
|
+
losing receiver binding or changing side effects in index/call arguments.
|
|
53
|
+
**Invariants:** container/element/property absence are separate; index zero and empty arrays
|
|
54
|
+
work; required absence still fails; short-circuit effects remain intentional.
|
|
55
|
+
**Source/support:** [optional chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining);
|
|
56
|
+
check parser/transpiler and framework reads.
|
|
57
|
+
|
|
58
|
+
## MT-05 - Use a collection operation that states the result
|
|
59
|
+
|
|
60
|
+
**Intent/use:** examine find/some/every for early termination, flatMap for zero-to-many
|
|
61
|
+
results, entries/fromEntries/hasOwn for object operations, groupBy for grouping,
|
|
62
|
+
toSorted/toReversed/toSpliced/with for non-mutating array changes and native Set operations.
|
|
63
|
+
**Alternatives/trade-offs:** loops and reduce are sound for combined passes, custom state or
|
|
64
|
+
clearer control flow. Avoid a chain that creates unnecessary arrays. A transparent helper
|
|
65
|
+
may disappear only after MT-19's public/domain contract check.
|
|
66
|
+
**Avoid:** equating grouping with arbitrary aggregation; changing sparse-array visitation,
|
|
67
|
+
mutation, duplicate order, key coercion or missing-group behavior. Object.groupBy returns a
|
|
68
|
+
null-prototype object with property keys; Map.groupBy preserves arbitrary key identity.
|
|
69
|
+
**Invariants:** output values/order/keys, duplicate policy, own-property/prototype semantics,
|
|
70
|
+
input mutation and empty/missing cases match the contract.
|
|
71
|
+
**Sources/support:** [array methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array),
|
|
72
|
+
[Object.groupBy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/groupBy),
|
|
73
|
+
[Map.groupBy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/groupBy).
|
|
74
|
+
Check each method, not just Array/Map support.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/hellraisercenobit/skills/blob/main/contracts/schemas/marker.schema.json",
|
|
4
|
+
"title": "Suite marker 1.0.0",
|
|
5
|
+
"description": "Committed at the repository root as `.ai-engineering-suite.json`. Its presence is the project's opt-in and the only signal enforcement reads: without it every gate command allows and prints nothing that blocks.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"markerVersion",
|
|
10
|
+
"dimensions"
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"markerVersion": {
|
|
14
|
+
"const": "1.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dimensions": {
|
|
17
|
+
"description": "`all` registers every member of the manifest; a list registers exactly those dimension identifiers.",
|
|
18
|
+
"oneOf": [
|
|
19
|
+
{
|
|
20
|
+
"const": "all"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"type": "array",
|
|
24
|
+
"minItems": 1,
|
|
25
|
+
"uniqueItems": true,
|
|
26
|
+
"items": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"minLength": 1
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"evidenceRoot": {
|
|
34
|
+
"description": "Overrides the default evidence root. `~` expands to the user's home directory. A relative path resolves against the repository root, which the change set then excludes.",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"minLength": 1
|
|
37
|
+
},
|
|
38
|
+
"exportDirectory": {
|
|
39
|
+
"description": "Repository-relative directory `export` writes to. Excluded from the change set and from every fingerprint.",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"minLength": 1
|
|
42
|
+
},
|
|
43
|
+
"ignore": {
|
|
44
|
+
"description": "Repository-relative glob patterns removed from the change set. `*` matches within one segment, `**` across segments.",
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"minLength": 1
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"base": {
|
|
52
|
+
"description": "Default comparison base when a declaration names none.",
|
|
53
|
+
"type": "string",
|
|
54
|
+
"minLength": 1
|
|
55
|
+
},
|
|
56
|
+
"conflictRoundCap": {
|
|
57
|
+
"description": "Consecutive cross-dimension conflict rounds before `can-review` is refused with `arbitration-required`.",
|
|
58
|
+
"type": "integer",
|
|
59
|
+
"minimum": 1
|
|
60
|
+
},
|
|
61
|
+
"roundCap": {
|
|
62
|
+
"description": "Total review rounds for one task before completion ends with `round-cap-reached`.",
|
|
63
|
+
"type": "integer",
|
|
64
|
+
"minimum": 1
|
|
65
|
+
},
|
|
66
|
+
"allowReplay": {
|
|
67
|
+
"description": "`false` forbids the gate-executed replay remedy, leaving a rerun of a full cycle as the only remedy for chronology-bound evidence.",
|
|
68
|
+
"type": "boolean"
|
|
69
|
+
},
|
|
70
|
+
"requireVerifiedIdentity": {
|
|
71
|
+
"description": "`true` refuses an attestation stored `identity-unverified`, for harnesses that provide agent identifiers.",
|
|
72
|
+
"type": "boolean"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Native platform capabilities
|
|
2
|
+
|
|
3
|
+
Apply MT-23 per API and target: browser, worker, server and secure-context support differ.
|
|
4
|
+
Native does not mean interchangeable with a library. Each rule compares the existing
|
|
5
|
+
contract before replacing a mechanism.
|
|
6
|
+
|
|
7
|
+
## MT-09 - Express asynchronous coordination and cancellation
|
|
8
|
+
|
|
9
|
+
**Intent/use:** choose async/await and Promise combinators by failure/concurrency semantics.
|
|
10
|
+
Promise.withResolvers suits bridging an externally settled operation when that lifecycle
|
|
11
|
+
is real; AbortController/AbortSignal can propagate cancellation across supporting APIs.
|
|
12
|
+
**Alternatives/trade-offs:** a plain async function or Promise constructor may suffice.
|
|
13
|
+
Bound concurrency for resource-limited work; Promise.all starts no tasks by itself and
|
|
14
|
+
does not cancel losing operations. AbortSignal.any/timeout need their own support checks.
|
|
15
|
+
**Avoid:** exposed resolvers without settlement ownership, unhandled rejections, races
|
|
16
|
+
mistaken for cancellation, or cleanup only on success.
|
|
17
|
+
**Invariants:** correct success/failure/abort results; release listeners/resources on all
|
|
18
|
+
exit paths; aborted work cannot publish a stale result.
|
|
19
|
+
**Sources:** [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise),
|
|
20
|
+
[withResolvers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers),
|
|
21
|
+
[AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal).
|
|
22
|
+
|
|
23
|
+
## MT-10 - Consume network data with its actual flow contract
|
|
24
|
+
|
|
25
|
+
**Intent/use:** Fetch, Request/Response, Headers and FormData replace redundant HTTP
|
|
26
|
+
plumbing; Readable/Transform/WritableStream suit progressive producers and consumers.
|
|
27
|
+
**Alternatives/trade-offs:** a mature client can carry retries, auth, caching and validation;
|
|
28
|
+
buffering small atomic data is legitimate. Backpressure depends on producer cooperation.
|
|
29
|
+
**Avoid:** forgetting fetch HTTP-status checks, consuming a body twice, retrying a
|
|
30
|
+
non-replayable stream, or canceling a consumer without handling the producer.
|
|
31
|
+
**Invariants:** response/errors/status handling preserved; ownership of body/reader locks,
|
|
32
|
+
abort and cleanup explicit; partial consumption does not silently buffer the whole input.
|
|
33
|
+
**Sources:** [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch),
|
|
34
|
+
[Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API).
|
|
35
|
+
Check the exact runtime's fetch/stream and upload behavior.
|
|
36
|
+
|
|
37
|
+
## MT-11 - Use standard parsing and text services for standard formats
|
|
38
|
+
|
|
39
|
+
**Intent/use:** URL/URLSearchParams for URLs and query data, Intl for locale-aware operations,
|
|
40
|
+
TextEncoder/TextDecoder for byte/text boundaries.
|
|
41
|
+
**Alternatives/trade-offs:** business grammars and nonstandard encodings may require a
|
|
42
|
+
library; URL normalization and locale output can differ from manual strings.
|
|
43
|
+
**Avoid:** treating URL parsing as destination authorization, interpolating unencoded query
|
|
44
|
+
data, or asserting identical locale output across engines without that requirement.
|
|
45
|
+
**Invariants:** origin/base, duplicate/empty query values, locale/time zone and encoding
|
|
46
|
+
error policy are explicit; security checks survive helper removal.
|
|
47
|
+
**Sources:** [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL),
|
|
48
|
+
[Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl),
|
|
49
|
+
[Encoding](https://developer.mozilla.org/en-US/docs/Web/API/Encoding_API).
|
|
50
|
+
Check exact Intl features and deployed locale data.
|
|
51
|
+
|
|
52
|
+
## MT-12 - Make copy and transfer ownership explicit
|
|
53
|
+
|
|
54
|
+
**Intent/use:** structuredClone for supported structured values; ArrayBuffer, typed arrays
|
|
55
|
+
and Blob for binary data; transfer ownership when it avoids a meaningful copy.
|
|
56
|
+
**Alternatives/trade-offs:** shallow spread, serialization or domain-specific copying can
|
|
57
|
+
be the right contract. A transfer's sender loses access to that transferable resource.
|
|
58
|
+
**Avoid:** treating JSON serialization as a general clone, expecting functions/prototypes
|
|
59
|
+
to survive structured cloning, transferring a buffer still owned by another consumer.
|
|
60
|
+
**Invariants:** supported data types, identity, copy depth and source usability are tested;
|
|
61
|
+
serialization format is deliberate; no unsupported universal performance claim.
|
|
62
|
+
**Sources:** [structuredClone](https://developer.mozilla.org/en-US/docs/Web/API/Window/structuredClone),
|
|
63
|
+
[transferables](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects).
|
|
64
|
+
Check API availability in the actual execution context.
|
|
65
|
+
|
|
66
|
+
## MT-13 - Let the browser observe and manage browser state
|
|
67
|
+
|
|
68
|
+
**Intent/use:** EventTarget options (signal/once/passive), event delegation, Intersection/
|
|
69
|
+
Resize/MutationObserver, requestAnimationFrame, Web Animations and semantic HTML controls
|
|
70
|
+
can remove custom listener/polling/rendering mechanisms.
|
|
71
|
+
**Alternatives/trade-offs:** framework effects own DOM/state lifetime; polling can be
|
|
72
|
+
necessary where observation semantics do not cover the requirement. Observers notify
|
|
73
|
+
according to their own timing, not as a synchronous query replacement.
|
|
74
|
+
**Avoid:** DOM writes outside framework ownership, passive listeners calling preventDefault,
|
|
75
|
+
observer feedback loops, inaccessible custom controls or forgotten disconnect/abort/cancel.
|
|
76
|
+
**Invariants:** correct event/notification timing, accessibility, cleanup and no stale work
|
|
77
|
+
after disposal. rAF aligns visual work; it is not a guaranteed background scheduler.
|
|
78
|
+
**Sources:** [addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener),
|
|
79
|
+
[IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API),
|
|
80
|
+
[ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/Resize_Observer_API),
|
|
81
|
+
[MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver),
|
|
82
|
+
[Web Animations](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API).
|
|
83
|
+
Check exact options/components and framework lifecycle.
|
|
84
|
+
|
|
85
|
+
## MT-14 - Choose scheduling by responsiveness and ownership
|
|
86
|
+
|
|
87
|
+
**Intent/use:** workers, message channels, transferable data or supported task scheduling
|
|
88
|
+
can move/split demonstrably blocking work.
|
|
89
|
+
**Alternatives/trade-offs:** startup, serialization and coordination can exceed small work;
|
|
90
|
+
task chunks on the main thread may suffice. Scheduler APIs require specific target checks.
|
|
91
|
+
**Avoid:** synchronous yield or a microtask loop claimed to guarantee rendering time,
|
|
92
|
+
worker use where direct DOM access is required, unbounded queued messages.
|
|
93
|
+
**Invariants:** responsive observable flow, cancellation/termination, data ownership and
|
|
94
|
+
error propagation; measured speed claims include startup/transfer costs.
|
|
95
|
+
**Sources:** [workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers),
|
|
96
|
+
[Scheduler](https://developer.mozilla.org/en-US/docs/Web/API/Scheduler).
|
|
97
|
+
|
|
98
|
+
## MT-15 - Match persistence and coordination guarantees
|
|
99
|
+
|
|
100
|
+
**Intent/use:** IndexedDB for structured transactional storage, Cache Storage for request/
|
|
101
|
+
response caching, BroadcastChannel for cross-context messages and Web Locks for supported
|
|
102
|
+
origin-scoped coordination.
|
|
103
|
+
**Alternatives/trade-offs:** small synchronous storage or a server may satisfy a simpler/
|
|
104
|
+
stronger contract; quotas, eviction, partitioning and private-mode behavior matter.
|
|
105
|
+
**Avoid:** claiming durable delivery from broadcast, treating cache storage as a transactional
|
|
106
|
+
database, assuming a lock spans servers/devices, or blocking UI with large synchronous writes.
|
|
107
|
+
**Invariants:** consistency, error/eviction behavior, transaction lifetime and cleanup are
|
|
108
|
+
explicit; persistence guarantees are no stronger than the actual environment.
|
|
109
|
+
**Sources:** [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API),
|
|
110
|
+
[CacheStorage](https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage),
|
|
111
|
+
[BroadcastChannel](https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API),
|
|
112
|
+
[Web Locks](https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API).
|
|
113
|
+
Check secure contexts, worker exposure and supported versions separately.
|
|
114
|
+
|
|
115
|
+
## MT-16 - Use security primitives for their precise guarantee
|
|
116
|
+
|
|
117
|
+
**Intent/use:** Web Crypto for appropriate cryptographic randomness/operations and textContent
|
|
118
|
+
or native text insertion for plain text.
|
|
119
|
+
**Alternatives/trade-offs:** a vetted library is appropriate when native algorithms/formats
|
|
120
|
+
do not cover the protocol; rich HTML requires a deliberate sanitization/trusted-content policy.
|
|
121
|
+
**Avoid:** Math.random for security-sensitive tokens, handwritten cryptography, URL parsing
|
|
122
|
+
or type brands mistaken for validation/authorization, plain text routed through innerHTML.
|
|
123
|
+
**Invariants:** the threat-relevant contract survives refactoring; randomness/algorithm/
|
|
124
|
+
encoding and trust boundaries are explicit; no broad safety claim from API choice alone.
|
|
125
|
+
**Sources:** [Web Crypto](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API),
|
|
126
|
+
[textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent).
|
|
127
|
+
Check algorithm and secure-context support, not only the crypto global.
|
|
128
|
+
## MT-25 - A wrapper around a platform capability needs a reason beyond its name
|
|
129
|
+
|
|
130
|
+
**Intent/use:** a helper that forwards to a platform or language capability, adding no
|
|
131
|
+
behavior, gives the reader one more indirection and one more thing to keep in step. Admit such
|
|
132
|
+
a wrapper only for a reason that outlives the rename: domain semantics the capability does not
|
|
133
|
+
carry, a compatibility policy the project owns in one place, instrumentation, lifecycle control
|
|
134
|
+
the caller must not manage, or a stable project boundary a future migration crosses once.
|
|
135
|
+
**Alternatives/trade-offs:** call the capability directly; a named domain function that
|
|
136
|
+
computes something is not a wrapper; a thin adapter at a real boundary is one of the reasons
|
|
137
|
+
above and records which one. When the reason is compatibility or instrumentation, the record
|
|
138
|
+
names what the wrapper decides that its callers must not.
|
|
139
|
+
**Avoid:** a function whose body is a single forwarding call with the arguments unchanged and
|
|
140
|
+
no reason on record, a wrapper whose only argument is discoverability or house style, a
|
|
141
|
+
project alias for a global, and a wrapper introduced together with the transposition that
|
|
142
|
+
replaced the code it was meant to hide.
|
|
143
|
+
**Invariants:** the record names the admitted reason for every retained or added wrapper, and
|
|
144
|
+
what it would take to remove it; a wrapper with no admitted reason is removed by the change,
|
|
145
|
+
not documented.
|
|
146
|
+
**Sources:** [Web APIs](https://developer.mozilla.org/en-US/docs/Web/API),
|
|
147
|
+
[Node API](https://nodejs.org/api/), the project's own compatibility record.
|