@ai-ecoverse/slicc-shared-web 2.6.0 → 2.7.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/README.md +2 -1
- package/package.json +4 -2
- package/testing/index.mjs +30 -0
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ Configuration shared by SLICC's web repos ([slicc-bios](https://github.com/ai-ec
|
|
|
13
13
|
| `bin/` | `slicc-lint` runs every check below plus Biome and, if the repo has one, `typecheck`. Every step prints its own `<step>: PASS …` line, and slicc-lint checks for it: a step that exits 0 without one fails the run with exit 70 (`slicc-lint: FAIL <step> (no PASS line from it)`), so a check that silently stops early can't pass. The last line, `slicc-lint: PASS`, comes only after every step has printed its PASS, and a gate can require it. `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 and [`# renovate:` annotations](#versions-pinned-in-workflow-files) in workflow and action files. `slicc-agents-md`, `slicc-no-unit-tests` and `slicc-diff-cover` complete the set, and `slicc-unit-cover` is the diff-coverage hook. `slicc-minidump <file.dmp>...` prints a crash dump's stack, described [below](#crash-dumps). `slicc-memory-peak` prints the job's [memory peak](#memory-peak). `slicc-install-hooks` installs the hooks into [this worktree's own directory](#one-hooks-directory-per-worktree), and on Windows does nothing and exits 0, so `npm ci` works there | `lint`: `slicc-lint`, and the hooks above |
|
|
14
14
|
| `pnpmfile.mjs` | pnpm's counterpart to the Renovate preset: an `updateConfig` hook that adds `@ai-ecoverse/*` to `minimumReleaseAgeExclude`, so pnpm 12 doesn't hold back our own fresh releases (`ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`) while third-party packages keep its age check | in a repo with a pnpm lockfile, as a [config dependency](https://pnpm.io/config-dependencies) in `pnpm-workspace.yaml`: `configDependencies: { '@ai-ecoverse/slicc-shared-web': X.Y.Z }` plus `pnpmfile: node_modules/.pnpm-config/@ai-ecoverse/slicc-shared-web/pnpmfile.mjs` |
|
|
15
15
|
| `harness/` | The CDP integration-test harness, described [below](#integration-test-harness) | `import { launch } from '@ai-ecoverse/slicc-shared-web/harness'`, and `--test-global-setup=node_modules/@ai-ecoverse/slicc-shared-web/harness/global.mjs` |
|
|
16
|
+
| `testing/` | Git fixtures that pass the AI git wrapper: `initFixtureRepo(dir, { hooks })` inits a throwaway repo with its own identity, no signing and no template hooks (`hooks: false` sets `core.hooksPath` to `/dev/null`), `commit(dir, message)` commits what is staged without `--no-verify`, and `commitAll(dir, message)` stages with `git add -A -- :/` first, all ignoring global and system git config, so a global `core.hooksPath` never runs in the fixture. Use them instead of `git add -A`, `git add .` or `--no-verify` in a test, which the wrapper refuses when an AI tool runs the suite | `import { commitAll, initFixtureRepo } from '@ai-ecoverse/slicc-shared-web/testing'` |
|
|
16
17
|
|
|
17
18
|
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, within the major you are on: it never offers a new major of `@ai-ecoverse/slicc-shared-web` or of the `ai-ecoverse/slicc-shared-web` workflow ref, so moving to the next one is a deliberate change:
|
|
18
19
|
|
|
@@ -74,7 +75,7 @@ The caller cancels superseded runs on pull requests only, so a push to `main` ne
|
|
|
74
75
|
|
|
75
76
|
- the pull request's head as the working directory and its base in `$RUNNER_TEMP/base`, each after `npm ci` (claude-code-action needs the working directory to be a checkout, and a base nested inside it would break the head's Biome config);
|
|
76
77
|
- `review/integration/`, every shard's artifact;
|
|
77
|
-
- `review/context/`, from the `context` job: the pull request
|
|
78
|
+
- `review/context/`, from the `context` job: the pull request's diff, files and commits from git and its title, body and labels from the event, which cost no GitHub API call, then its comments and reviews and the repo's issues and recent pull requests from the REST API, each retried once and listed in `missing.txt` when the repo's `GITHUB_TOKEN` quota (1,000 requests an hour, shared by every run in the repo) runs out, rather than failing the job;
|
|
78
79
|
- `review/browsers.json`: four headed Chrome instances on one machine (on Xvfb display `:99` when the runner has no `DISPLAY`, since headless Chrome behaves slightly differently), `head` and `base` each linked through the extension and through slicc-cli, on CDP ports 9301 to 9304. For each one the job runs `review-browser` (by default `npm run --if-present review:browser`) in that side's tree with `SLICC_REVIEW_SIDE` (`head` or `base`), `SLICC_REVIEW_LINK` (`extension` or `cli`) and `SLICC_REVIEW_CDP`, so the repo loads its own build into that browser. Every one of them also runs the [harness extension](#harness-extension) (loaded with `--load-extension`), so the review sees pages the way a user with a content-script extension does;
|
|
79
80
|
- `review-prompt`, appended to the shared prompt.
|
|
80
81
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-shared-web",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "Shared Renovate, Biome, TypeScript, lefthook and GitHub Actions configuration, plus the CDP integration-test harness, for SLICC's web repos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"./mcr.config.mjs": "./mcr.config.mjs",
|
|
30
30
|
"./harness": "./harness/index.mjs",
|
|
31
31
|
"./harness/global": "./harness/global.mjs",
|
|
32
|
-
"./pnpmfile.mjs": "./pnpmfile.mjs"
|
|
32
|
+
"./pnpmfile.mjs": "./pnpmfile.mjs",
|
|
33
|
+
"./testing": "./testing/index.mjs"
|
|
33
34
|
},
|
|
34
35
|
"bin": {
|
|
35
36
|
"slicc-agents-md": "bin/slicc-agents-md.sh",
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
"mcr.config.mjs",
|
|
52
53
|
"tsconfig.json",
|
|
53
54
|
"pnpmfile.mjs",
|
|
55
|
+
"testing",
|
|
54
56
|
"unit"
|
|
55
57
|
],
|
|
56
58
|
"scripts": {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { devNull } from 'node:os';
|
|
3
|
+
|
|
4
|
+
function git(dir, ...args) {
|
|
5
|
+
const env = { ...process.env };
|
|
6
|
+
for (const key of Object.keys(env)) if (key.startsWith('GIT_')) delete env[key];
|
|
7
|
+
env.GIT_CONFIG_GLOBAL = devNull;
|
|
8
|
+
env.GIT_CONFIG_NOSYSTEM = '1';
|
|
9
|
+
const run = spawnSync('git', args, { cwd: dir, encoding: 'utf8', env });
|
|
10
|
+
if (run.status !== 0) {
|
|
11
|
+
throw new Error(`git ${args.join(' ')} failed in ${dir}: ${run.error?.message ?? run.stderr}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function initFixtureRepo(dir, { hooks = true } = {}) {
|
|
16
|
+
git(dir, 'init', '-q', '--template=');
|
|
17
|
+
git(dir, 'config', 'user.name', 'slicc-fixture');
|
|
18
|
+
git(dir, 'config', 'user.email', 'fixture@slicc.invalid');
|
|
19
|
+
git(dir, 'config', 'commit.gpgsign', 'false');
|
|
20
|
+
if (!hooks) git(dir, 'config', 'core.hooksPath', devNull);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function commit(dir, message) {
|
|
24
|
+
git(dir, 'commit', '-q', '--allow-empty', '-m', message);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function commitAll(dir, message) {
|
|
28
|
+
git(dir, 'add', '-A', '--', ':/');
|
|
29
|
+
commit(dir, message);
|
|
30
|
+
}
|