@ai-ecoverse/slicc-shared-web 0.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/README.md +24 -5
- package/bin/slicc-agents-md.sh +23 -0
- package/bin/slicc-diff-cover.sh +7 -0
- package/bin/slicc-lint-comments.sh +21 -0
- package/bin/slicc-lint.sh +10 -0
- package/bin/slicc-no-unit-tests.sh +7 -0
- package/biome.json +228 -0
- package/default.json +77 -0
- package/lefthook.yml +18 -0
- package/mcr.config.mjs +17 -0
- package/package.json +47 -1
- package/tsconfig.json +17 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright
|
|
52
|
+
owner or by an individual or Legal Entity authorized to submit on
|
|
53
|
+
behalf of the copyright owner. For the purposes of this definition,
|
|
54
|
+
"submitted" means any form of electronic, verbal, or written
|
|
55
|
+
communication sent to the Licensor or its representatives, including
|
|
56
|
+
but not limited to communication on electronic mailing lists, source
|
|
57
|
+
code control systems, and issue tracking systems that are managed by,
|
|
58
|
+
or on behalf of, the Licensor for the purpose of discussing and
|
|
59
|
+
improving the Work, but excluding communication that is conspicuously
|
|
60
|
+
marked or otherwise designated in writing by the copyright owner as
|
|
61
|
+
"Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2025 ai-ecoverse
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# slicc-shared-web
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Configuration shared by SLICC's web repos ([slicc-bios](https://github.com/ai-ecoverse/slicc-bios), [slicc-kernel](https://github.com/ai-ecoverse/slicc-kernel), [slicc-spectrum](https://github.com/ai-ecoverse/slicc-spectrum), and whatever comes next), so a rule changes in one place.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
| File | What it is | How a repo uses it |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `default.json` | Root Renovate preset: automerge on, one dependency per PR, exact pins, 7-day release age (14 for majors, 0 for vulnerability fixes and for our own `@ai-ecoverse` packages, which also jump the PR queue), and a manager for jsDelivr pins inside `src/` | `renovate.json`: `{ "extends": ["github>ai-ecoverse/slicc-shared-web"] }` |
|
|
8
|
+
| `.github/workflows/node-ci.yml` | Reusable CI: `npm ci`, lint, Chromium's system libraries, integration tests, hotspots in the job summary, coverage/profiles/screenshots as artifacts. The browser itself comes from each repo's `pretest` | `jobs: { ci: { uses: ai-ecoverse/slicc-shared-web/.github/workflows/node-ci.yml@vX.Y.Z } }` |
|
|
9
|
+
| `biome.json` | Formatter settings and slicc's strict linter: cognitive complexity ≤ 25, functions ≤ 150 lines, no unused variables or imports, no floating or misused promises, naming conventions, `import type`/`export type`. Test files under `test/` get slicc's test exemptions | `biome.json`: `{ "extends": ["@ai-ecoverse/slicc-shared-web/biome"] }` |
|
|
10
|
+
| `tsconfig.json` | TypeScript base for Node's type stripping | `tsconfig.json`: `{ "extends": "@ai-ecoverse/slicc-shared-web/tsconfig.json", "include": ["src/**/*.ts"] }` |
|
|
11
|
+
| `lefthook.yml` | Pre-commit hooks: Biome, typecheck, no comments, no unit tests in git, AGENTS.md, diff coverage | `lefthook.yml`: `extends: [node_modules/@ai-ecoverse/slicc-shared-web/lefthook.yml]` |
|
|
12
|
+
| `mcr.config.mjs` | Unit-test coverage for JS and TS sources in `src/` (TS types are stripped first), written to `coverage/unit/lcov.info` | `test:unit`: `mcr -c node_modules/@ai-ecoverse/slicc-shared-web/mcr.config.mjs node --test 'test/unit/**/*.test.mjs'` |
|
|
13
|
+
| `bin/` | `slicc-lint` runs every check below plus Biome and, if the repo has one, `typecheck`. `slicc-lint-comments` runs the [slicc no-comment checker](https://github.com/ai-ecoverse/slicc/tree/main/packages/dev-tools/no-comment) at a pinned commit, allowing AGENTS.md. `slicc-agents-md`, `slicc-no-unit-tests` and `slicc-diff-cover` complete the set | `lint`: `slicc-lint`, and the hooks above |
|
|
6
14
|
|
|
7
|
-
|
|
15
|
+
Install it from npm, and pin the reusable workflow to the matching `vX.Y.Z` tag. Renovate keeps both current without the usual waiting period:
|
|
8
16
|
|
|
9
|
-
|
|
17
|
+
```sh
|
|
18
|
+
npm install --save-dev --save-exact @ai-ecoverse/slicc-shared-web
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The hooks expect two scripts in each repo: `test:unit`, which writes `coverage/unit/lcov.info` (unit tests stay out of git), and, in TypeScript repos, `typecheck`. The reusable workflow expects `lint`, plus `test` for the integration tests, with a `pretest` that installs Chromium (`playwright-core install --no-shell chromium`). The diff-coverage hook runs `diff-cover` through `uvx`, so install [uv](https://docs.astral.sh/uv/) once.
|
|
22
|
+
|
|
23
|
+
## Rules every repo follows
|
|
24
|
+
|
|
25
|
+
- No comments anywhere, and no `.md` files except README.md and AGENTS.md.
|
|
26
|
+
- Agent guidance committed to a repo lives in AGENTS.md only, at most 1,000 characters per file. The repo has no CLAUDE.md, not even as a symlink, since Claude reads AGENTS.md. The check covers tracked and untracked files; gitignored local files are personal and stay out of it.
|
|
27
|
+
- Unit tests stay out of git, in a gitignored `test/unit/`. The pre-commit hook requires them to execute every staged line in `src/`.
|
|
28
|
+
- Integration tests are committed and run in CI.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -u
|
|
3
|
+
limit=1000
|
|
4
|
+
failed=0
|
|
5
|
+
list="${TMPDIR:-/tmp}/slicc-agents-md.$$"
|
|
6
|
+
git ls-files --cached --others --exclude-standard | grep -E '(^|/)(AGENTS|CLAUDE)\.md$' > "$list" || true
|
|
7
|
+
while IFS= read -r file; do
|
|
8
|
+
case "$file" in
|
|
9
|
+
CLAUDE.md | */CLAUDE.md)
|
|
10
|
+
printf '%s: agent guidance lives in AGENTS.md only, with no CLAUDE.md file or symlink\n' "$file" >&2
|
|
11
|
+
failed=1
|
|
12
|
+
;;
|
|
13
|
+
*)
|
|
14
|
+
chars=$(node -e "process.stdout.write(String([...require('node:fs').readFileSync(process.argv[1], 'utf8')].length))" "$file")
|
|
15
|
+
if [ "$chars" -gt "$limit" ]; then
|
|
16
|
+
printf '%s: %s characters, the limit is %s\n' "$file" "$chars" "$limit" >&2
|
|
17
|
+
failed=1
|
|
18
|
+
fi
|
|
19
|
+
;;
|
|
20
|
+
esac
|
|
21
|
+
done < "$list"
|
|
22
|
+
rm -f "$list"
|
|
23
|
+
exit "$failed"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
if ! command -v uvx > /dev/null 2>&1; then
|
|
4
|
+
printf 'slicc-diff-cover runs diff-cover through uvx; install uv first: https://docs.astral.sh/uv/getting-started/installation/\n' >&2
|
|
5
|
+
exit 1
|
|
6
|
+
fi
|
|
7
|
+
exec uvx diff-cover@10.6.0 "${1:-coverage/unit/lcov.info}" --compare-branch HEAD --ignore-unstaged --fail-under 100
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
sha=9cc7617c94c24b84c4d6fd8edf92441378257d07
|
|
4
|
+
dir="node_modules/.cache/slicc-no-comment-$sha"
|
|
5
|
+
if [ ! -f "$dir/check.mjs" ]; then
|
|
6
|
+
mkdir -p "$dir"
|
|
7
|
+
for file in lib comments marker check; do
|
|
8
|
+
curl -fsSL -o "$dir/$file.mjs" "https://raw.githubusercontent.com/ai-ecoverse/slicc/$sha/packages/dev-tools/no-comment/$file.mjs"
|
|
9
|
+
done
|
|
10
|
+
fi
|
|
11
|
+
report=$(node "$dir/check.mjs" --force "$@" 2>&1) || true
|
|
12
|
+
if [ -z "$report" ]; then
|
|
13
|
+
printf 'slicc-lint-comments: the no-comment checker produced no report\n' >&2
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
rest=$(printf '%s\n' "$report" | grep -vE '^ok: |^(.+/)?AGENTS\.md: documentation file is not allowed' || true)
|
|
17
|
+
if [ -n "$rest" ]; then
|
|
18
|
+
printf '%s\n' "$rest" >&2
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
printf 'ok: no comments, and no documentation besides README.md and AGENTS.md\n'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
bin=$(dirname "$(readlink -f "$0")")
|
|
4
|
+
npx --no-install biome check .
|
|
5
|
+
if node -e "process.exit(require('./package.json').scripts?.typecheck ? 0 : 1)"; then
|
|
6
|
+
npm run --silent typecheck
|
|
7
|
+
fi
|
|
8
|
+
"$bin/slicc-lint-comments.sh"
|
|
9
|
+
"$bin/slicc-no-unit-tests.sh"
|
|
10
|
+
"$bin/slicc-agents-md.sh"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -u
|
|
3
|
+
found=$(git ls-files --cached --others --exclude-standard | grep -E '(^|/)(tests?|__tests__)/|\.(test|spec)\.' | grep -vE '^test/integration/')
|
|
4
|
+
if [ -n "$found" ]; then
|
|
5
|
+
printf 'Unit tests stay out of git; keep them in the gitignored test/unit/:\n%s\n' "$found" >&2
|
|
6
|
+
exit 1
|
|
7
|
+
fi
|
package/biome.json
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
{
|
|
2
|
+
"vcs": {
|
|
3
|
+
"enabled": true,
|
|
4
|
+
"clientKind": "git",
|
|
5
|
+
"useIgnoreFile": true
|
|
6
|
+
},
|
|
7
|
+
"formatter": {
|
|
8
|
+
"enabled": true,
|
|
9
|
+
"indentStyle": "space",
|
|
10
|
+
"indentWidth": 2,
|
|
11
|
+
"lineWidth": 100,
|
|
12
|
+
"lineEnding": "lf"
|
|
13
|
+
},
|
|
14
|
+
"javascript": {
|
|
15
|
+
"formatter": {
|
|
16
|
+
"quoteStyle": "single",
|
|
17
|
+
"semicolons": "always",
|
|
18
|
+
"trailingCommas": "es5",
|
|
19
|
+
"arrowParentheses": "always",
|
|
20
|
+
"bracketSpacing": true
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"html": {
|
|
24
|
+
"formatter": {
|
|
25
|
+
"enabled": true
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"overrides": [
|
|
29
|
+
{
|
|
30
|
+
"includes": ["test/**", "**/*.test.ts", "**/*.test.mjs"],
|
|
31
|
+
"linter": {
|
|
32
|
+
"rules": {
|
|
33
|
+
"suspicious": {
|
|
34
|
+
"noExplicitAny": "off"
|
|
35
|
+
},
|
|
36
|
+
"correctness": {
|
|
37
|
+
"noEmptyPattern": "off",
|
|
38
|
+
"noUnusedVariables": "off",
|
|
39
|
+
"noConstructorReturn": "off",
|
|
40
|
+
"noUnsafeOptionalChaining": "off"
|
|
41
|
+
},
|
|
42
|
+
"style": {
|
|
43
|
+
"useNamingConvention": "off"
|
|
44
|
+
},
|
|
45
|
+
"complexity": {
|
|
46
|
+
"noExcessiveCognitiveComplexity": "off",
|
|
47
|
+
"noExcessiveLinesPerFunction": "off"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"includes": ["**/*.json", "**/*.jsonc", "**/tsconfig*.json", "**/.releaserc.json"],
|
|
54
|
+
"linter": {
|
|
55
|
+
"enabled": false
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"linter": {
|
|
60
|
+
"enabled": true,
|
|
61
|
+
"rules": {
|
|
62
|
+
"preset": "recommended",
|
|
63
|
+
"complexity": {
|
|
64
|
+
"noExcessiveCognitiveComplexity": {
|
|
65
|
+
"level": "error",
|
|
66
|
+
"options": {
|
|
67
|
+
"maxAllowedComplexity": 25
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"noExcessiveLinesPerFunction": {
|
|
71
|
+
"level": "error",
|
|
72
|
+
"options": {
|
|
73
|
+
"maxLines": 150,
|
|
74
|
+
"skipIifes": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"noForEach": "off",
|
|
78
|
+
"noBannedTypes": "off",
|
|
79
|
+
"noUselessConstructor": "off",
|
|
80
|
+
"noUselessSwitchCase": "off",
|
|
81
|
+
"noStaticOnlyClass": "off",
|
|
82
|
+
"noUselessFragments": "off",
|
|
83
|
+
"useArrowFunction": "off",
|
|
84
|
+
"useOptionalChain": "error",
|
|
85
|
+
"useLiteralKeys": "off",
|
|
86
|
+
"noImportantStyles": "error"
|
|
87
|
+
},
|
|
88
|
+
"correctness": {
|
|
89
|
+
"noUnusedVariables": {
|
|
90
|
+
"level": "error",
|
|
91
|
+
"options": {
|
|
92
|
+
"ignoreRestSiblings": true
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"noUnusedImports": "error",
|
|
96
|
+
"noUnusedFunctionParameters": "off",
|
|
97
|
+
"noUnusedPrivateClassMembers": "off",
|
|
98
|
+
"useExhaustiveDependencies": "off",
|
|
99
|
+
"noNodejsModules": "off",
|
|
100
|
+
"noUndeclaredVariables": "off",
|
|
101
|
+
"noConstantCondition": "error",
|
|
102
|
+
"noInnerDeclarations": "off",
|
|
103
|
+
"noConstAssign": "error",
|
|
104
|
+
"noPrecisionLoss": "error",
|
|
105
|
+
"noSwitchDeclarations": "off",
|
|
106
|
+
"noUnreachable": "error"
|
|
107
|
+
},
|
|
108
|
+
"style": {
|
|
109
|
+
"useNamingConvention": {
|
|
110
|
+
"level": "warn",
|
|
111
|
+
"options": {
|
|
112
|
+
"strictCase": false,
|
|
113
|
+
"requireAscii": true,
|
|
114
|
+
"conventions": [
|
|
115
|
+
{
|
|
116
|
+
"selector": {
|
|
117
|
+
"kind": "function"
|
|
118
|
+
},
|
|
119
|
+
"match": "_*(.+?)_*",
|
|
120
|
+
"formats": ["camelCase", "PascalCase"]
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"selector": {
|
|
124
|
+
"kind": "classMember"
|
|
125
|
+
},
|
|
126
|
+
"match": "_*(.+?)_*",
|
|
127
|
+
"formats": ["camelCase", "PascalCase", "CONSTANT_CASE"]
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"selector": {
|
|
131
|
+
"kind": "objectLiteralProperty"
|
|
132
|
+
},
|
|
133
|
+
"match": ".*"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"selector": {
|
|
137
|
+
"kind": "typeProperty"
|
|
138
|
+
},
|
|
139
|
+
"match": ".*"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"selector": {
|
|
143
|
+
"kind": "enumMember"
|
|
144
|
+
},
|
|
145
|
+
"formats": ["camelCase", "PascalCase", "CONSTANT_CASE"]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"selector": {
|
|
149
|
+
"kind": "typeLike"
|
|
150
|
+
},
|
|
151
|
+
"formats": ["PascalCase"]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"selector": {
|
|
155
|
+
"kind": "variable"
|
|
156
|
+
},
|
|
157
|
+
"match": "_*\\$?(.+?)_*",
|
|
158
|
+
"formats": ["camelCase", "PascalCase", "CONSTANT_CASE"]
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"useImportType": "error",
|
|
164
|
+
"useExportType": "error",
|
|
165
|
+
"useConst": "error",
|
|
166
|
+
"useTemplate": "off",
|
|
167
|
+
"useSingleVarDeclarator": "off",
|
|
168
|
+
"useNumberNamespace": "off",
|
|
169
|
+
"useEnumInitializers": "off",
|
|
170
|
+
"useNodejsImportProtocol": "off",
|
|
171
|
+
"useDefaultParameterLast": "off",
|
|
172
|
+
"useExponentiationOperator": "off",
|
|
173
|
+
"useLiteralEnumMembers": "off",
|
|
174
|
+
"noUselessElse": "off",
|
|
175
|
+
"noNonNullAssertion": "off",
|
|
176
|
+
"noParameterAssign": "off",
|
|
177
|
+
"noUnusedTemplateLiteral": "off",
|
|
178
|
+
"noInferrableTypes": "off"
|
|
179
|
+
},
|
|
180
|
+
"suspicious": {
|
|
181
|
+
"noExplicitAny": "warn",
|
|
182
|
+
"noEmptyBlockStatements": "off",
|
|
183
|
+
"noEmptyInterface": "off",
|
|
184
|
+
"noConfusingVoidType": "off",
|
|
185
|
+
"noAssignInExpressions": "off",
|
|
186
|
+
"noConsole": "off",
|
|
187
|
+
"noShadowRestrictedNames": "off",
|
|
188
|
+
"noImplicitAnyLet": "off",
|
|
189
|
+
"noPrototypeBuiltins": "off",
|
|
190
|
+
"noGlobalIsNan": "off",
|
|
191
|
+
"noControlCharactersInRegex": "off",
|
|
192
|
+
"noSparseArray": "error",
|
|
193
|
+
"noDoubleEquals": {
|
|
194
|
+
"level": "error",
|
|
195
|
+
"options": {
|
|
196
|
+
"ignoreNull": true
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"noDebugger": "error",
|
|
200
|
+
"noDuplicateCase": "error",
|
|
201
|
+
"noIrregularWhitespace": "error",
|
|
202
|
+
"noFunctionAssign": "error",
|
|
203
|
+
"noArrayIndexKey": "off",
|
|
204
|
+
"noEvolvingTypes": "off",
|
|
205
|
+
"noAsyncPromiseExecutor": "error",
|
|
206
|
+
"noThenProperty": "off",
|
|
207
|
+
"noCatchAssign": "off",
|
|
208
|
+
"noFallthroughSwitchClause": "off",
|
|
209
|
+
"noTemplateCurlyInString": "off",
|
|
210
|
+
"useIterableCallbackReturn": "error"
|
|
211
|
+
},
|
|
212
|
+
"performance": {
|
|
213
|
+
"noDelete": "off",
|
|
214
|
+
"noAccumulatingSpread": "off"
|
|
215
|
+
},
|
|
216
|
+
"nursery": {
|
|
217
|
+
"noFloatingPromises": "error",
|
|
218
|
+
"noMisusedPromises": "error"
|
|
219
|
+
},
|
|
220
|
+
"a11y": {
|
|
221
|
+
"preset": "none"
|
|
222
|
+
},
|
|
223
|
+
"security": {
|
|
224
|
+
"preset": "recommended"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
package/default.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
+
"description": [
|
|
4
|
+
"Root Renovate preset for SLICC's web repos. Extend it with github>ai-ecoverse/slicc-shared-web and keep repo-specific rules in the repo's own renovate.json.",
|
|
5
|
+
"Every dependency updates in its own PR so a breaking bump fails in isolation; only purposeful cohesion groups exist, never a catch-all group.",
|
|
6
|
+
"Automerge is on: a PR merges by itself once CI is green and the release is old enough."
|
|
7
|
+
],
|
|
8
|
+
"extends": ["config:recommended"],
|
|
9
|
+
"semanticCommits": "enabled",
|
|
10
|
+
"rebaseWhen": "conflicted",
|
|
11
|
+
"automerge": true,
|
|
12
|
+
"automergeType": "pr",
|
|
13
|
+
"platformAutomerge": true,
|
|
14
|
+
"minimumReleaseAge": "7 days",
|
|
15
|
+
"prHourlyLimit": 4,
|
|
16
|
+
"internalChecksFilter": "strict",
|
|
17
|
+
"vulnerabilityAlerts": {
|
|
18
|
+
"enabled": true,
|
|
19
|
+
"minimumReleaseAge": "0 days"
|
|
20
|
+
},
|
|
21
|
+
"customManagers": [
|
|
22
|
+
{
|
|
23
|
+
"customType": "regex",
|
|
24
|
+
"description": "npm packages pinned by exact version in jsDelivr URLs inside sources, such as the tar library slicc-bios imports at runtime.",
|
|
25
|
+
"managerFilePatterns": ["/(^|/)src/.+\\.(js|mjs|ts)$/"],
|
|
26
|
+
"matchStrings": [
|
|
27
|
+
"https://cdn\\.jsdelivr\\.net/npm/(?<depName>(?:@[^/@\\s'\"`]+/)?[^/@\\s'\"`]+)@(?<currentValue>\\d[^/\\s'\"`]*)"
|
|
28
|
+
],
|
|
29
|
+
"datasourceTemplate": "npm"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"packageRules": [
|
|
33
|
+
{
|
|
34
|
+
"description": "Pin npm dependencies to exact versions so every change is a visible package.json diff in its own PR. engines and peerDependencies keep their ranges.",
|
|
35
|
+
"matchManagers": ["npm"],
|
|
36
|
+
"matchDepTypes": ["dependencies", "devDependencies"],
|
|
37
|
+
"rangeStrategy": "pin"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"description": "Major bumps wait longer: more risk of breaking changes and a more attractive target for malicious releases.",
|
|
41
|
+
"matchUpdateTypes": ["major"],
|
|
42
|
+
"minimumReleaseAge": "14 days"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"description": "Our own packages and shared config ship together: take them as soon as they are released, ahead of the hourly PR limit, whether Renovate sees them by package name (npm, reusable workflows, git URLs) or by dependency name.",
|
|
46
|
+
"matchPackageNames": [
|
|
47
|
+
"@ai-ecoverse/{/,}**",
|
|
48
|
+
"ai-ecoverse/**",
|
|
49
|
+
"https://github.com/ai-ecoverse/**"
|
|
50
|
+
],
|
|
51
|
+
"minimumReleaseAge": "0 days",
|
|
52
|
+
"prPriority": 10
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"matchDepNames": ["@ai-ecoverse/{/,}**"],
|
|
56
|
+
"minimumReleaseAge": "0 days",
|
|
57
|
+
"prPriority": 10
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"matchPackageNames": ["semantic-release", "@semantic-release/{/,}**"],
|
|
61
|
+
"groupName": "semantic-release packages"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"description": "Formatter bumps can reflow existing code and fail the Biome check; label them so they stand out when they do.",
|
|
65
|
+
"matchPackageNames": ["@biomejs/biome"],
|
|
66
|
+
"addLabels": ["formatter-bump"]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"description": "Packages carried with a patch-package patch. A bump orphans the version-pinned patch, so group them and never automerge.",
|
|
70
|
+
"matchPackageNames": ["@zenfs/core", "@zenfs/dom"],
|
|
71
|
+
"groupName": "patched dependencies",
|
|
72
|
+
"groupSlug": "patched-deps",
|
|
73
|
+
"addLabels": ["patched-dependency"],
|
|
74
|
+
"automerge": false
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
package/lefthook.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
pre-commit:
|
|
2
|
+
parallel: true
|
|
3
|
+
jobs:
|
|
4
|
+
- name: biome
|
|
5
|
+
glob: "*.{js,mjs,cjs,ts,json,css,html}"
|
|
6
|
+
run: npx biome check --no-errors-on-unmatched --files-ignore-unknown=true {staged_files}
|
|
7
|
+
- name: typecheck
|
|
8
|
+
glob: "*.ts"
|
|
9
|
+
run: npm run --silent typecheck
|
|
10
|
+
- name: no comments
|
|
11
|
+
run: npx --no-install slicc-lint-comments
|
|
12
|
+
- name: no unit tests in git
|
|
13
|
+
run: npx --no-install slicc-no-unit-tests
|
|
14
|
+
- name: AGENTS.md
|
|
15
|
+
run: npx --no-install slicc-agents-md
|
|
16
|
+
- name: diff coverage
|
|
17
|
+
glob: "src/**.{js,mjs,ts}"
|
|
18
|
+
run: npm run --silent test:unit && npx --no-install slicc-diff-cover
|
package/mcr.config.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { stripTypeScriptTypes } from 'node:module';
|
|
2
|
+
|
|
3
|
+
const strip = (entry) => {
|
|
4
|
+
if (entry.url.endsWith('.ts')) entry.source = stripTypeScriptTypes(entry.source);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const ours = (url) =>
|
|
8
|
+
url.includes('/src/') && !url.includes('/node_modules/') && /\.(m?js|ts)$/.test(url);
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: process.env.npm_package_name ?? 'unit',
|
|
12
|
+
outputDir: 'coverage/unit',
|
|
13
|
+
reports: ['lcovonly', 'console-details'],
|
|
14
|
+
all: { dir: 'src', filter: '**/*.{js,mjs,ts}', transformer: strip },
|
|
15
|
+
entryFilter: (entry) => ours(entry.url),
|
|
16
|
+
onEntry: strip,
|
|
17
|
+
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-shared-web",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Shared Renovate, Biome, TypeScript, lefthook and GitHub Actions configuration for SLICC's web repos",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"license": "Apache-2.0",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "git+https://github.com/ai-ecoverse/slicc-shared-web.git"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=24"
|
|
13
|
+
},
|
|
14
|
+
"fledgling": {
|
|
15
|
+
"provider": "github",
|
|
16
|
+
"workflow": "release.yml",
|
|
17
|
+
"repo": "ai-ecoverse/slicc-shared-web",
|
|
18
|
+
"publish": true
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public",
|
|
22
|
+
"provenance": true
|
|
23
|
+
},
|
|
24
|
+
"exports": {
|
|
25
|
+
"./biome": "./biome.json",
|
|
26
|
+
"./tsconfig.json": "./tsconfig.json",
|
|
27
|
+
"./lefthook.yml": "./lefthook.yml",
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
"./mcr.config.mjs": "./mcr.config.mjs"
|
|
30
|
+
},
|
|
31
|
+
"bin": {
|
|
32
|
+
"slicc-agents-md": "bin/slicc-agents-md.sh",
|
|
33
|
+
"slicc-diff-cover": "bin/slicc-diff-cover.sh",
|
|
34
|
+
"slicc-lint": "bin/slicc-lint.sh",
|
|
35
|
+
"slicc-lint-comments": "bin/slicc-lint-comments.sh",
|
|
36
|
+
"slicc-no-unit-tests": "bin/slicc-no-unit-tests.sh"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"bin",
|
|
40
|
+
"biome.json",
|
|
41
|
+
"default.json",
|
|
42
|
+
"lefthook.yml",
|
|
43
|
+
"mcr.config.mjs",
|
|
44
|
+
"tsconfig.json"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"lint": "bin/slicc-lint.sh && shellcheck bin/*.sh",
|
|
48
|
+
"trust": "npx fledgling sync -y --skip-publish",
|
|
49
|
+
"trust:dry": "npx fledgling sync --dry-run -y --skip-publish",
|
|
50
|
+
"release": "semantic-release"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@biomejs/biome": "2.5.15",
|
|
54
|
+
"semantic-release": "25.0.9"
|
|
9
55
|
}
|
|
10
56
|
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2024",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2024", "DOM", "DOM.Iterable", "WebWorker.ImportScripts"],
|
|
7
|
+
"types": [],
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"verbatimModuleSyntax": true,
|
|
12
|
+
"erasableSyntaxOnly": true,
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"rewriteRelativeImportExtensions": false,
|
|
15
|
+
"noEmit": true
|
|
16
|
+
}
|
|
17
|
+
}
|