@opendesignai/harness 0.2.0-alpha.0 → 0.4.0-alpha.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 +90 -44
- package/dist/THIRD-PARTY-LICENSES.md +63 -0
- package/dist/child-env-cPBUueQI.mjs +17 -0
- package/dist/cli.mjs +4916 -209
- package/dist/config.d.mts +68 -0
- package/dist/config.mjs +12 -0
- package/dist/eslint-comments.mjs +1679 -4
- package/dist/hook.d.mts +19 -0
- package/dist/hook.mjs +9843 -0
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.mjs +283 -27
- package/dist/report.d.mts +40 -0
- package/dist/report.mjs +34 -0
- package/docs/adopting.md +107 -11
- package/docs/agent-setup.md +21 -0
- package/docs/agents.md +42 -0
- package/docs/comments.md +33 -0
- package/docs/decisions/0001-oxlint.md +28 -1
- package/docs/decisions/0002-react-compiler-rules.md +39 -0
- package/docs/decisions/0004-type-aware-rules.md +43 -0
- package/docs/decisions/0005-test-weakening-rules.md +28 -0
- package/docs/diagnostics.md +58 -0
- package/docs/hooks.md +152 -36
- package/docs/ratchet.md +23 -21
- package/docs/rules/no-commented-out-code.md +47 -0
- package/docs/rules/no-swallowed-catch.md +18 -7
- package/docs/size.md +3 -1
- package/docs/verify.md +80 -0
- package/package.json +30 -6
- package/presets/react-compiler.json +2 -1
- package/presets/rules/base.json +5 -0
- package/presets/strict-types.json +5 -0
- package/presets/testing.json +22 -0
- package/presets/type-aware.json +69 -0
- package/skills/od-feature-intake/SKILL.md +22 -0
- package/skills/od-pre-pr-review/SKILL.md +46 -0
- package/dist/cli.d.mts +0 -1
- package/dist/eslint-comments.d.mts +0 -40
- package/dist/paths-DBoYPrGy.mjs +0 -59
package/docs/verify.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Verify a change
|
|
2
|
+
|
|
3
|
+
Run `od-harness verify` from the repository root before sharing a change. Install the repository dependencies first.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
od-harness verify --quick
|
|
7
|
+
od-harness verify
|
|
8
|
+
od-harness verify --format json
|
|
9
|
+
od-harness verify --ci --base "$HARNESS_BASE_REF"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
| Check | Quick | Default | CI |
|
|
13
|
+
| ------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------ | ---------------------------- |
|
|
14
|
+
| Oxlint | Changed JavaScript and TypeScript files | Changed JavaScript and TypeScript files | Entire repository |
|
|
15
|
+
| Lint scope | Entire repository | Entire repository | Entire repository |
|
|
16
|
+
| Size and ratchet | Entire repository | Entire repository | Entire repository |
|
|
17
|
+
| Typecheck | Affected configured projects | Affected configured projects | All configured projects |
|
|
18
|
+
| Agent instructions | If instructions, manifests, ignore rules, config or reference paths change | Same as quick | Every run |
|
|
19
|
+
| Repository commands | Entries marked `quick: true` whose `when` matches | According to `when` | All entries |
|
|
20
|
+
| Clones and unused | Skipped | When enabled | When enabled |
|
|
21
|
+
| Tests | Skipped | Matching tests and changed tests for affected projects | All configured test projects |
|
|
22
|
+
|
|
23
|
+
Quick and default mode compare the working tree with the merge base of `HEAD` and the selected ref. This includes committed, staged, unstaged and unignored untracked changes. Local lint runs on files that still exist. A deleted source file can trigger typecheck, surviving related tests and extras for its path. Verify skips a local test project if its only candidates are deleted and no matching tests survive. Deletions still participate in the ratchet and can trigger a check for broken instruction references. Git compares changed lines as text, including files marked `binary` or `-diff`. When Oxlint reports a rule above its frozen count, verify identifies diagnostics on changed lines and groups the other occurrences.
|
|
24
|
+
|
|
25
|
+
The `lint-scope` check guards alternate lint configs and ignored tracked files in every mode. To omit it for a run, pass `--skip lint-scope`.
|
|
26
|
+
|
|
27
|
+
The local base ref comes from `--base <ref>`, then a nonblank `OD_HARNESS_BASE`, then `verify.base`, then `origin/main`. For example, the pilot branch can commit `"verify": {"base": "origin/pilot/mfe"}` in `.harness/config.json`. An unavailable ref or history without a merge base exits 2 with a fetch hint. CI requires `--base <ref>` and compares directly with that commit, which must be available in the checkout.
|
|
28
|
+
|
|
29
|
+
## Repository configuration
|
|
30
|
+
|
|
31
|
+
Set repository-specific checks in the owner-reviewed `.harness/config.json`. A repository that only needs the built-in gates can omit `verify`.
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"verify": {
|
|
36
|
+
"base": "origin/main",
|
|
37
|
+
"clones": false,
|
|
38
|
+
"unused": false,
|
|
39
|
+
"prepare": [{ "run": "pnpm build", "when": "typecheck|tests" }],
|
|
40
|
+
"typecheck": [
|
|
41
|
+
{ "id": "web", "run": "pnpm typecheck", "paths": ["apps/web/**", "packages/**"] }
|
|
42
|
+
],
|
|
43
|
+
"tests": [
|
|
44
|
+
{
|
|
45
|
+
"id": "web",
|
|
46
|
+
"runner": "vitest",
|
|
47
|
+
"config": "apps/web/vitest.config.ts",
|
|
48
|
+
"paths": ["apps/web/**", "packages/**"],
|
|
49
|
+
"roots": ["apps/web/tests"]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": "backend",
|
|
53
|
+
"runner": "node-test",
|
|
54
|
+
"glob": "tests/backend/*.test.ts",
|
|
55
|
+
"paths": ["apps/backend/**", "tests/backend/**"],
|
|
56
|
+
"roots": ["tests/backend"]
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"agentsDocs": { "paths": ["docs/contributing/**"] },
|
|
60
|
+
"extra": [{ "id": "format", "run": "pnpm format:check", "when": ["docs/**", "src/**"] }]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- `lint`, `size` and `ratchet` default to true. `clones` and `unused` default to false, matching the default workflow inputs. Set the booleans to match the gates enabled in CI.
|
|
66
|
+
- `prepare` commands run in order before selected typechecks and tests. `when` accepts `typecheck`, `tests` and `typecheck|tests` (the default). CI runs all preparation commands.
|
|
67
|
+
- `typecheck[].paths` and `tests[].paths` select affected projects locally and default to all paths. Patterns are repository-relative and accept `*`, `**` and `?`. CI selects all projects.
|
|
68
|
+
- `tests[].roots` adds directories, searched recursively, to the source file's own directory. For each changed JavaScript or TypeScript source, verify takes the basename before the first dot and looks for `<stem>*.test.*`. For example `Dock.view.tsx` matches `DockTabs.test.tsx`. Changed tests must be in project paths or roots and match the glob when one is configured. Verify passes absolute paths to the runner so it can select files below a custom Vitest root. A project with a current test candidate and zero matched files fails, as does a runner that reports zero tests or files.
|
|
69
|
+
- `tests[].config` selects a Vitest configuration. Verify looks for Vitest from the config directory, then from the repository root, then on `PATH`. Vitest evaluates its own include patterns relative to its configured root, which defaults to the repository root. `tests[].glob` filters both changed and discovered test files locally and supplies the CI file selection for the Node runner. Set `tests[].run` to use a specific repository command in CI. Otherwise verify runs the configured runner without the local changed-file selection.
|
|
70
|
+
- Set `verify.agentsDocs` to `{}` to enable the same reference check as [`od-harness agents docs`](agents.md). Changes to instruction files, package manifests, root or nested `.gitignore` files, `.harness/config.json` or referenced paths trigger it locally. `verify.agentsDocs.paths` adds watched paths. Use `verify.extra` for custom repository documentation commands.
|
|
71
|
+
- `extra[].when` is `"always"` by default. It also accepts a path pattern or array of patterns, matched against changed paths including deletions. Quick mode requires both a matching `when` and `quick: true`. CI runs all extras in their listed order.
|
|
72
|
+
- Shell commands run from the repository root with Bash, local package binaries on `PATH`, and the resolved commit in `HARNESS_BASE_REF`. Verify runs at most three checks at a time.
|
|
73
|
+
|
|
74
|
+
## Output
|
|
75
|
+
|
|
76
|
+
Verify uses the [shared CLI diagnostic formats](diagnostics.md). Text is the default and shows up to 20 diagnostics per check. `--format github` prints annotations and check status. Text also emits annotations when `GITHUB_ACTIONS=true`. In CI mode, Oxlint annotations use Oxlint's GitHub formatter, matching the workflow.
|
|
77
|
+
|
|
78
|
+
`--format json` writes one `VerifyReport` on stdout. `--json` is an alias and can be used with `--format json`. The report has the shared `ok`, `diagnostics` and `summary` fields, plus `mode`, `base` (commit SHA), `changedFiles`, `checks`, `exitCode` and `durationMs`. `changedFiles` lists changed files still present on disk. Each check includes the shared diagnostic fields plus `id`, `status` and `durationMs`. The top-level `diagnostics` includes every check's diagnostics in check order. The lint check can include `column` and `isNew` for a known source location and changed-line status. Diagnostics without a file use an empty `file` and line 1.
|
|
79
|
+
|
|
80
|
+
Exit codes are 0 if all selected checks pass or skip, 1 if a check finds a violation and 2 for invalid usage or a check that cannot run. Exit code 2 writes errors to stderr, including when JSON was requested.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendesignai/harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-alpha.0",
|
|
4
4
|
"description": "OpenDesign harness: od/* lint rules for Oxlint (ESLint plugin format), presets, file size budget, baseline ratchet and incremental duplication and unused-code gates",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-plugin",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"dist",
|
|
23
23
|
"presets",
|
|
24
24
|
"docs",
|
|
25
|
+
"skills",
|
|
25
26
|
"!docs/upstream"
|
|
26
27
|
],
|
|
27
28
|
"type": "module",
|
|
@@ -30,6 +31,18 @@
|
|
|
30
31
|
"types": "./dist/plugin.d.mts",
|
|
31
32
|
"default": "./dist/plugin.mjs"
|
|
32
33
|
},
|
|
34
|
+
"./config": {
|
|
35
|
+
"types": "./dist/config.d.mts",
|
|
36
|
+
"default": "./dist/config.mjs"
|
|
37
|
+
},
|
|
38
|
+
"./hook": {
|
|
39
|
+
"types": "./dist/hook.d.mts",
|
|
40
|
+
"default": "./dist/hook.mjs"
|
|
41
|
+
},
|
|
42
|
+
"./report": {
|
|
43
|
+
"types": "./dist/report.d.mts",
|
|
44
|
+
"default": "./dist/report.mjs"
|
|
45
|
+
},
|
|
33
46
|
"./presets/*": "./presets/*",
|
|
34
47
|
"./package.json": "./package.json"
|
|
35
48
|
},
|
|
@@ -38,25 +51,36 @@
|
|
|
38
51
|
"tag": "alpha"
|
|
39
52
|
},
|
|
40
53
|
"dependencies": {
|
|
41
|
-
"@eslint-community/eslint-plugin-eslint-comments": "4.8.1",
|
|
42
54
|
"jscpd": "5.4.3",
|
|
43
55
|
"knip": "6.50.0",
|
|
44
|
-
"oxc-parser": "0.160.0"
|
|
56
|
+
"oxc-parser": "0.160.0",
|
|
57
|
+
"semver": "7.8.6",
|
|
58
|
+
"yaml": "2.9.1"
|
|
45
59
|
},
|
|
46
60
|
"devDependencies": {
|
|
61
|
+
"@arethetypeswrong/core": "0.18.5",
|
|
62
|
+
"@eslint-community/eslint-plugin-eslint-comments": "4.8.1",
|
|
47
63
|
"@od-harness/ts-eslint-parser": "0.0.0",
|
|
48
64
|
"@types/node": "26.6.11",
|
|
65
|
+
"@types/semver": "7.8.0",
|
|
49
66
|
"@typescript-eslint/types": "8.74.0",
|
|
50
67
|
"eslint": "10.16.0",
|
|
51
68
|
"oxfmt": "0.81.0",
|
|
52
69
|
"oxlint": "1.96.0",
|
|
70
|
+
"oxlint-tsgolint": "7.0.2009",
|
|
71
|
+
"publint": "0.3.25",
|
|
53
72
|
"tsdown": "0.23.8",
|
|
54
73
|
"typescript": "7.0.2",
|
|
55
|
-
"vitest": "5.1.2"
|
|
56
|
-
"yaml": "2.9.1"
|
|
74
|
+
"vitest": "5.1.2"
|
|
57
75
|
},
|
|
58
76
|
"peerDependencies": {
|
|
59
|
-
"oxlint": "1.96.0"
|
|
77
|
+
"oxlint": "1.96.0",
|
|
78
|
+
"oxlint-tsgolint": "7.0.2009"
|
|
79
|
+
},
|
|
80
|
+
"peerDependenciesMeta": {
|
|
81
|
+
"oxlint-tsgolint": {
|
|
82
|
+
"optional": true
|
|
83
|
+
}
|
|
60
84
|
},
|
|
61
85
|
"engines": {
|
|
62
86
|
"node": ">=22.18.0"
|
package/presets/rules/base.json
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"od/no-error-message-match": "error",
|
|
16
16
|
"od/no-cjk-literal": "error",
|
|
17
17
|
"od/no-constant-flag": "error",
|
|
18
|
+
"od/no-commented-out-code": "error",
|
|
19
|
+
"typescript/ban-ts-comment": "error",
|
|
18
20
|
"react/rules-of-hooks": "error",
|
|
19
21
|
"react/exhaustive-deps": "error",
|
|
20
22
|
"react/refs": "off",
|
|
@@ -25,6 +27,9 @@
|
|
|
25
27
|
"react/use-memo": "off",
|
|
26
28
|
"react/incompatible-library": "off",
|
|
27
29
|
"react/static-components": "off",
|
|
30
|
+
"react/exhaustive-effect-dependencies": "off",
|
|
31
|
+
"react/hooks": "off",
|
|
32
|
+
"react/memo-dependencies": "off",
|
|
28
33
|
"unicorn/no-abusive-eslint-disable": "error",
|
|
29
34
|
"eslint-comments/no-restricted-disable": [
|
|
30
35
|
"error",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins": ["vitest"],
|
|
3
|
+
"rules": {
|
|
4
|
+
"vitest/expect-expect": "off",
|
|
5
|
+
"vitest/hoisted-apis-on-top": "off",
|
|
6
|
+
"vitest/no-conditional-expect": "off",
|
|
7
|
+
"vitest/no-conditional-tests": "off",
|
|
8
|
+
"vitest/no-disabled-tests": "error",
|
|
9
|
+
"vitest/no-focused-tests": "error",
|
|
10
|
+
"vitest/no-standalone-expect": "off",
|
|
11
|
+
"vitest/prefer-snapshot-hint": "off",
|
|
12
|
+
"vitest/require-awaited-expect-poll": "off",
|
|
13
|
+
"vitest/require-local-test-context-for-concurrent-snapshots": "off",
|
|
14
|
+
"vitest/require-mock-type-parameters": "off",
|
|
15
|
+
"vitest/require-to-throw-message": "off",
|
|
16
|
+
"vitest/valid-describe-callback": "off",
|
|
17
|
+
"vitest/valid-expect": "off",
|
|
18
|
+
"vitest/valid-expect-in-promise": "off",
|
|
19
|
+
"vitest/valid-title": "off",
|
|
20
|
+
"vitest/warn-todo": "off"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"options": {
|
|
3
|
+
"typeAware": true
|
|
4
|
+
},
|
|
5
|
+
"rules": {
|
|
6
|
+
"typescript/await-thenable": "error",
|
|
7
|
+
"typescript/consistent-return": "off",
|
|
8
|
+
"typescript/consistent-type-exports": "off",
|
|
9
|
+
"typescript/dot-notation": "off",
|
|
10
|
+
"typescript/no-array-delete": "off",
|
|
11
|
+
"typescript/no-base-to-string": "off",
|
|
12
|
+
"typescript/no-confusing-void-expression": "off",
|
|
13
|
+
"typescript/no-deprecated": "off",
|
|
14
|
+
"typescript/no-duplicate-type-constituents": "off",
|
|
15
|
+
"typescript/no-floating-promises": "error",
|
|
16
|
+
"typescript/no-for-in-array": "off",
|
|
17
|
+
"typescript/no-generated-empty-object-type": "off",
|
|
18
|
+
"typescript/no-implied-eval": "off",
|
|
19
|
+
"typescript/no-meaningless-void-operator": "off",
|
|
20
|
+
"typescript/no-misused-promises": "error",
|
|
21
|
+
"typescript/no-misused-spread": "off",
|
|
22
|
+
"typescript/no-mixed-enums": "off",
|
|
23
|
+
"typescript/no-redundant-type-constituents": "off",
|
|
24
|
+
"typescript/no-unnecessary-boolean-literal-compare": "off",
|
|
25
|
+
"typescript/no-unnecessary-condition": "off",
|
|
26
|
+
"typescript/no-unnecessary-qualifier": "off",
|
|
27
|
+
"typescript/no-unnecessary-template-expression": "off",
|
|
28
|
+
"typescript/no-unnecessary-type-arguments": "off",
|
|
29
|
+
"typescript/no-unnecessary-type-assertion": "off",
|
|
30
|
+
"typescript/no-unnecessary-type-conversion": "off",
|
|
31
|
+
"typescript/no-unnecessary-type-parameters": "off",
|
|
32
|
+
"typescript/no-unsafe-argument": "off",
|
|
33
|
+
"typescript/no-unsafe-assignment": "off",
|
|
34
|
+
"typescript/no-unsafe-call": "off",
|
|
35
|
+
"typescript/no-unsafe-class-instance-assignment": "off",
|
|
36
|
+
"typescript/no-unsafe-enum-assignment": "off",
|
|
37
|
+
"typescript/no-unsafe-enum-comparison": "off",
|
|
38
|
+
"typescript/no-unsafe-member-access": "off",
|
|
39
|
+
"typescript/no-unsafe-return": "off",
|
|
40
|
+
"typescript/no-unsafe-type-assertion": "off",
|
|
41
|
+
"typescript/no-unsafe-unary-minus": "off",
|
|
42
|
+
"typescript/no-useless-default-assignment": "off",
|
|
43
|
+
"typescript/non-nullable-type-assertion-style": "off",
|
|
44
|
+
"typescript/only-throw-error": "off",
|
|
45
|
+
"typescript/prefer-find": "off",
|
|
46
|
+
"typescript/prefer-includes": "off",
|
|
47
|
+
"typescript/prefer-nullish-coalescing": "off",
|
|
48
|
+
"typescript/prefer-optional-chain": "off",
|
|
49
|
+
"typescript/prefer-promise-reject-errors": "off",
|
|
50
|
+
"typescript/prefer-readonly": "off",
|
|
51
|
+
"typescript/prefer-readonly-parameter-types": "off",
|
|
52
|
+
"typescript/prefer-reduce-type-parameter": "off",
|
|
53
|
+
"typescript/prefer-regexp-exec": "off",
|
|
54
|
+
"typescript/prefer-return-this-type": "off",
|
|
55
|
+
"typescript/prefer-string-starts-ends-with": "off",
|
|
56
|
+
"typescript/promise-function-async": "off",
|
|
57
|
+
"typescript/related-getter-setter-pairs": "off",
|
|
58
|
+
"typescript/require-array-sort-compare": "off",
|
|
59
|
+
"typescript/require-await": "off",
|
|
60
|
+
"typescript/restrict-plus-operands": "off",
|
|
61
|
+
"typescript/restrict-template-expressions": "off",
|
|
62
|
+
"typescript/return-await": "off",
|
|
63
|
+
"typescript/strict-boolean-expressions": "off",
|
|
64
|
+
"typescript/strict-void-return": "off",
|
|
65
|
+
"typescript/switch-exhaustiveness-check": "off",
|
|
66
|
+
"typescript/unbound-method": "off",
|
|
67
|
+
"typescript/use-unknown-in-catch-callback-variable": "off"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: od-feature-intake
|
|
3
|
+
description: Prepare a user-visible feature or changes to entry points, routes, navigation, tracking events, or environment variables in an OpenDesign repository. Use before editing and record the decisions in the PR's Feature intake section.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Feature intake
|
|
7
|
+
|
|
8
|
+
Read the root `AGENTS.md` and use its routing table to find the instructions for each affected directory. Locate registries through those instructions and existing entries in the repository. Read the applicable instructions and trace a similar feature before adding a new entry.
|
|
9
|
+
|
|
10
|
+
1. Find the approved design and record its link. If the approval, scope, or ownership is unclear, resolve it before implementing the affected part.
|
|
11
|
+
2. Identify the feature's rollout tier and source repository using the project's rollout plan. Confirm which product or shared package owns the behavior and reuse its existing implementation where possible.
|
|
12
|
+
3. Register any rollout flag in the feature-flag registry with an owner, an expiry date, and a default of off. Read it through the existing flag API. Declare any new environment variable in the env registry with its type, default, and description, then use the typed accessor.
|
|
13
|
+
4. Add or update entry points, routes, and navigation through the owning registries. Keep product-specific behavior behind the registered product or capability interface.
|
|
14
|
+
5. Add i18n keys and translations for every supported locale. Use the existing translation API for user-visible copy and run the repository's configured i18n check if it has one.
|
|
15
|
+
6. Review added or changed tracking events and payloads with the tracking owner. Reuse the existing event definitions and record the owner's decision.
|
|
16
|
+
7. Add an English **Feature intake** section to the PR draft. Include the design link, rollout tier and source repository, the flag's owner, expiry and default, the route and navigation entries, locale coverage, and the tracking decision. State which items do not apply and flag unresolved decisions.
|
|
17
|
+
|
|
18
|
+
## Check each change locally
|
|
19
|
+
|
|
20
|
+
After editing a source file, run `oxlint --deny-warnings <file>` from the repository root and use the diagnostic's fix and docs to correct the file. Replace `<file>` with the affected path. Use `pnpm exec` in pnpm repositories or `npx --no-install` in npm repositories to run the installed binaries. Rerun the check after the correction.
|
|
21
|
+
|
|
22
|
+
If your installed harness version supports `od-harness verify`, run `od-harness verify --quick` after a group of edits. Run the affected tests through the repository's configured test command. Before opening a PR, use `od-pre-pr-review` to finish the checks and record the results.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: od-pre-pr-review
|
|
3
|
+
description: Review an OpenDesign change before opening a pull request. Run local gates, fix findings, check the diff for issues the gates cannot detect, and draft an English PR body with verification evidence.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pre-PR review
|
|
7
|
+
|
|
8
|
+
From the repository root, use the root `AGENTS.md` routing table to read the instructions for every affected directory. Review the whole change against the PR base, including your local edits. Run the installed harness and Oxlint binaries with `pnpm exec` in pnpm repositories or `npx --no-install` in npm repositories.
|
|
9
|
+
|
|
10
|
+
## Run the local gates
|
|
11
|
+
|
|
12
|
+
If your installed harness version supports `od-harness verify`, run `od-harness verify --quick` after edits for fast feedback. Before opening the PR, run `od-harness verify --json` in default mode to get the full findings and run the configured affected tests. Use `--base <ref>` when the configured base differs from the PR target. Replace `<ref>` with the actual local ref or commit for that target.
|
|
13
|
+
|
|
14
|
+
Until `od-harness verify` is available in your installed version, run `oxlint --deny-warnings`, `od-harness size`, and `od-harness ratchet --base <ref>` for the enabled gates. Use the same base for `od-harness clones --base <ref>` and `od-harness unused --base <ref>` where enabled. Run the repository's configured typecheck, affected tests, and other checks required for the change.
|
|
15
|
+
|
|
16
|
+
For each failure, identify the reported rule and location, follow the fix and docs, then rerun the failed check. If the underlying issue warrants an exemption, use the documented mechanism and get code owner review for gate configuration changes. Fix new violations in code and keep inline disables and new debt out of the diff.
|
|
17
|
+
|
|
18
|
+
- **A file or directory with frozen debt moved.** Run `git mv <from> <to>`, or stage both paths with `git add -- <from> <to>` if already moved. Fix the imports, then run `od-harness baseline move <from> <to>` before committing. Use the actual old and new paths relative to the root. If the rename is already committed, pass `--base <ref>` to compare against a ref before the rename. Include the migrated entries with the rename. If Git cannot pair the files, treat the old one as deleted and fix the new file's violations.
|
|
19
|
+
- **Existing lint violations were removed.** Run `oxlint --prune-suppressions` with the repository's lint configuration to shrink the existing lint baseline.
|
|
20
|
+
- **A frozen file shrank or was deleted.** Run `od-harness size --update` to tighten the existing size baseline. For deleted files in the lint baseline, also run `oxlint --prune-suppressions`.
|
|
21
|
+
- **A file exceeds its size budget.** Split it by responsibility or move code into an existing module, then rerun `od-harness size`.
|
|
22
|
+
- **New duplicated code.** Find an existing implementation or extract a shared function and use it at both call sites. For a legitimate generated or vendored path, use the owner-reviewed `clones.ignore` setting.
|
|
23
|
+
- **Unused file, export, or dependency.** Remove it or connect it to its real caller. For a real entry point the tool cannot see, declare it in the owner-reviewed Knip configuration.
|
|
24
|
+
|
|
25
|
+
Rerun the full local review checks once the findings are resolved. Record checks that could not run and their blockers. CI decides whether the change can merge.
|
|
26
|
+
|
|
27
|
+
## Review what the gates cannot tell you
|
|
28
|
+
|
|
29
|
+
- Check the repository's capability index when one is available. Search for existing implementations and reuse them where they fit.
|
|
30
|
+
- Check that each change belongs in the owning package or directory and uses its public interfaces and registries.
|
|
31
|
+
- Trace user-visible values to their source. Keep fixtures in tests and show appropriate loading, empty, and error states for real data.
|
|
32
|
+
- Check that callers handle or surface failures. Check that changed user-facing copy uses i18n keys present in every supported locale.
|
|
33
|
+
|
|
34
|
+
### Comments
|
|
35
|
+
|
|
36
|
+
Default: no comment. Before you finish, read every comment your change adds; keep one only if it says why and the code cannot.
|
|
37
|
+
|
|
38
|
+
- Keep, in one line: an external constraint, an upstream bug (with link), an invariant, a non-obvious order or tolerance.
|
|
39
|
+
- Delete: comments that restate the next line, number the steps or label sections; JSDoc that only repeats the name and types.
|
|
40
|
+
- Delete: change history ("used to …", "split out of X to stay under the size cap"). It belongs in the commit message.
|
|
41
|
+
- Delete: TODO without an issue link, and commented-out code (`od/no-commented-out-code` fails on it).
|
|
42
|
+
- Exemption markers stay one line: `// fail-open: <reason>`.
|
|
43
|
+
|
|
44
|
+
## Draft the PR body
|
|
45
|
+
|
|
46
|
+
Use the repository's PR template and write in English. Summarize the behavior and scope, the checks run and their results, any unresolved findings, and the change in file-size budget or frozen lint counts. Explain any frozen entries that moved and confirm that the move preserved their limits. Include the **Feature intake** section where applicable. Get authorization before pushing, opening the PR, or merging.
|
package/dist/cli.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
interface Position {
|
|
2
|
-
line: number;
|
|
3
|
-
column: number;
|
|
4
|
-
}
|
|
5
|
-
type Loc = Position | {
|
|
6
|
-
start: Position;
|
|
7
|
-
end?: Position | null;
|
|
8
|
-
};
|
|
9
|
-
interface UpstreamRuleMeta {
|
|
10
|
-
messages?: Record<string, string>;
|
|
11
|
-
[key: string]: unknown;
|
|
12
|
-
}
|
|
13
|
-
interface UpstreamRule {
|
|
14
|
-
meta?: UpstreamRuleMeta;
|
|
15
|
-
create(context: object): object;
|
|
16
|
-
}
|
|
17
|
-
export interface WrappedPlugin {
|
|
18
|
-
meta: {
|
|
19
|
-
name: string;
|
|
20
|
-
};
|
|
21
|
-
rules: Record<string, UpstreamRule>;
|
|
22
|
-
}
|
|
23
|
-
export interface ParsedDirective {
|
|
24
|
-
prefix: "eslint" | "oxlint";
|
|
25
|
-
kind: "disable" | "disable-next-line" | "disable-line" | "enable";
|
|
26
|
-
ruleList: string;
|
|
27
|
-
names: string[];
|
|
28
|
-
}
|
|
29
|
-
/** Moves negative columns to 0; a negative start becomes a zero-width location at column 0. */
|
|
30
|
-
export declare function clampLoc(loc: Loc): Loc;
|
|
31
|
-
/**
|
|
32
|
-
* Parses a comment's inner text the same way Oxlint's Rust side (`disable_directives.rs`) does:
|
|
33
|
-
* leading Unicode whitespace, directive keyword followed by Unicode whitespace or EOL, description
|
|
34
|
-
* cut off at `--` or `<ws>-<ws>`, and rule names split on `,` or Unicode whitespace.
|
|
35
|
-
*/
|
|
36
|
-
export declare function parseRustDirective(commentValue: string): ParsedDirective | null;
|
|
37
|
-
/** The rule with `context.report` locations passed through `clampLoc`. */
|
|
38
|
-
export declare function wrapRule(rule: UpstreamRule): UpstreamRule;
|
|
39
|
-
declare const plugin: WrappedPlugin;
|
|
40
|
-
export { plugin as default };
|
package/dist/paths-DBoYPrGy.mjs
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { realpathSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
// src/plugin/utils/paths.ts
|
|
4
|
-
function toPosix(p) {
|
|
5
|
-
return p.split(path.sep).join("/");
|
|
6
|
-
}
|
|
7
|
-
const realCache = /* @__PURE__ */ new Map();
|
|
8
|
-
function real(p) {
|
|
9
|
-
let cached = realCache.get(p);
|
|
10
|
-
if (cached === void 0) {
|
|
11
|
-
try {
|
|
12
|
-
cached = realpathSync(p);
|
|
13
|
-
} catch {
|
|
14
|
-
cached = p;
|
|
15
|
-
}
|
|
16
|
-
realCache.set(p, cached);
|
|
17
|
-
}
|
|
18
|
-
return cached;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Path of the linted file relative to the working directory the linter was started in (the
|
|
22
|
-
* repository root in CI and hooks), with forward slashes. Both linters report absolute paths, but
|
|
23
|
-
* one of them may have resolved symlinks (for example /tmp → /private/tmp on macOS).
|
|
24
|
-
*/
|
|
25
|
-
function repoRelativePath(context) {
|
|
26
|
-
const cwd = context.cwd;
|
|
27
|
-
const file = path.isAbsolute(context.filename) ? context.filename : path.join(cwd, context.filename);
|
|
28
|
-
let rel = path.relative(cwd, file);
|
|
29
|
-
if (rel.startsWith("..")) rel = path.relative(real(cwd), real(file));
|
|
30
|
-
return toPosix(rel);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Compile repo-relative path patterns. Supported forms:
|
|
34
|
-
* - `dir/` — the directory and everything below it;
|
|
35
|
-
* - globs with `**` (any depth), `*` (one segment) and `?`; `dir/**` also matches `dir` itself;
|
|
36
|
-
* - anything else is an exact path.
|
|
37
|
-
*/
|
|
38
|
-
function compilePathPatterns(patterns) {
|
|
39
|
-
const regexes = patterns.map(patternToRegExp);
|
|
40
|
-
return (rel) => regexes.some((re) => re.test(rel));
|
|
41
|
-
}
|
|
42
|
-
function patternToRegExp(pattern) {
|
|
43
|
-
const glob = pattern.endsWith("/") ? `${pattern}**` : pattern;
|
|
44
|
-
let out = "";
|
|
45
|
-
for (let i = 0; i < glob.length; i++) {
|
|
46
|
-
const ch = glob[i];
|
|
47
|
-
if (ch === "*") {
|
|
48
|
-
if (glob[i + 1] === "*") {
|
|
49
|
-
const slashAfter = glob[i + 2] === "/";
|
|
50
|
-
if (i + 2 === glob.length && out.endsWith("/")) out = `${out.slice(0, -1)}(?:/.*)?`;
|
|
51
|
-
else out += slashAfter ? "(?:.*/)?" : ".*";
|
|
52
|
-
i += slashAfter ? 2 : 1;
|
|
53
|
-
} else out += "[^/]*";
|
|
54
|
-
} else if (ch === "?") out += "[^/]";
|
|
55
|
-
else out += ch.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
56
|
-
}
|
|
57
|
-
return new RegExp(`^${out}$`);
|
|
58
|
-
}
|
|
59
|
-
export { repoRelativePath as n, compilePathPatterns as t };
|