@gobing-ai/ts-rule-engine 0.3.5 → 0.3.6
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 +4 -4
- package/dist/config/extensions.d.ts +1 -1
- package/dist/config/extensions.js +2 -2
- package/dist/evaluators/test-location-evaluator.d.ts +1 -1
- package/dist/evaluators/test-location-evaluator.d.ts.map +1 -1
- package/dist/fixers/test-stub-fixer.d.ts +1 -1
- package/dist/fixers/test-stub-fixer.d.ts.map +1 -1
- package/dist/host/rule-engine-host.d.ts +1 -1
- package/dist/host/rule-engine-host.d.ts.map +1 -1
- package/dist/host/rule-engine-host.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/types.js +1 -1
- package/package.json +4 -4
- package/src/config/extensions.ts +3 -3
- package/src/evaluators/test-location-evaluator.ts +1 -1
- package/src/fixers/test-stub-fixer.ts +1 -1
- package/src/host/rule-engine-host.ts +1 -1
- package/src/index.ts +4 -4
- package/src/types.ts +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ erDiagram
|
|
|
32
32
|
| Entity | One-line Description |
|
|
33
33
|
|--------|----------------------|
|
|
34
34
|
| `RuleEngine` | Orchestrates evaluation of enabled rules against a workspace directory. Supports opt-in early exit via `stopOnFirst` parameter. Accepts an optional `EventBus<RuleEngineEvents>` for structured in-process observability. |
|
|
35
|
-
| `RuleEngineHost` | Capability host backed by `CapabilityRegistry` from `@gobing-ai/ts-runtime/
|
|
35
|
+
| `RuleEngineHost` | Capability host backed by `CapabilityRegistry` from `@gobing-ai/ts-runtime/extension` — holds evaluators, resolvers, formatters, and fixer providers, each with origin tracking for safe override detection. |
|
|
36
36
|
| `CapabilityRegistry<T>` | Generic named registry (shared with `ts-rule-engine`, `ts-dual-workflow-engine`) that tags each entry with its `origin` (`'builtin'`, `'extension'`, `'caller'`). |
|
|
37
37
|
| `ConstraintRule` | Declarative policy unit: id, severity, include/exclude globs, evaluator type + config, and optional fix config. |
|
|
38
38
|
| `Preset` | YAML/JSON composition: extends rule categories and other presets, declares `disable`/`overrides`, and exposes extension modules. |
|
|
@@ -66,7 +66,7 @@ Core concepts:
|
|
|
66
66
|
|
|
67
67
|
- `ConstraintRule`: one policy check. It has an `id`, `severity`, evaluator type/config, optional include/exclude globs, and optional fix config.
|
|
68
68
|
- `RuleEngine`: runs enabled rules against a `workdir`. The constructor auto-registers built-in evaluators, formatters, resolvers, and fixer providers.
|
|
69
|
-
- `RuleEngineHost`: capability container backed by four `CapabilityRegistry` instances from `@gobing-ai/ts-runtime/
|
|
69
|
+
- `RuleEngineHost`: capability container backed by four `CapabilityRegistry` instances from `@gobing-ai/ts-runtime/extension`. Each entry tracks its origin (`'builtin'` / `'extension'` / `'caller'`) so the engine can detect and report conflicting registrations.
|
|
70
70
|
- `RuleEvaluator`: implementation of one rule type, such as `regex`, `path`, or `coverage-gate`.
|
|
71
71
|
- `Fix`: byte-range replacement candidate. Fixes are collected separately from findings and only written when you call `applyFixes()`.
|
|
72
72
|
- Preset: YAML/JSON file that composes rule categories and can expose extension modules.
|
|
@@ -698,7 +698,7 @@ const fixer: RuleFixerProvider & { name: string } = {
|
|
|
698
698
|
export default fixer;
|
|
699
699
|
```
|
|
700
700
|
|
|
701
|
-
Load extensions (uses the shared `loadExtensionModules` from `@gobing-ai/ts-runtime/
|
|
701
|
+
Load extensions (uses the shared `loadExtensionModules` from `@gobing-ai/ts-runtime/extension`):
|
|
702
702
|
|
|
703
703
|
```ts
|
|
704
704
|
const loaded = await loadPreset('local', { roots: ['.spur/rules'] });
|
|
@@ -821,7 +821,7 @@ When no `events` option is provided, the engine incurs zero observability overhe
|
|
|
821
821
|
|
|
822
822
|
## Package Boundary
|
|
823
823
|
|
|
824
|
-
This package owns rule definitions, preset loading, evaluators, formatters, test-path resolvers, fixer providers, extension loading, the `CapabilityRegistry` re-export from `@gobing-ai/ts-runtime/
|
|
824
|
+
This package owns rule definitions, preset loading, evaluators, formatters, test-path resolvers, fixer providers, extension loading, the `CapabilityRegistry` re-export from `@gobing-ai/ts-runtime/extension`, and bundled rule presets.
|
|
825
825
|
|
|
826
826
|
It does **not** own:
|
|
827
827
|
|
|
@@ -37,7 +37,7 @@ export declare function collectExtensions(sourceName: string, sourceDir: string,
|
|
|
37
37
|
* registry.
|
|
38
38
|
*
|
|
39
39
|
* Delegates generic loading (trust gate, path guard, module import, export-shape
|
|
40
|
-
* validation) to the shared ``loadExtensionModules`` from ts-runtime/
|
|
40
|
+
* validation) to the shared ``loadExtensionModules`` from ts-runtime/extension, then
|
|
41
41
|
* routes each capability to the correct host registry based on ``ref.kind``.
|
|
42
42
|
*
|
|
43
43
|
* A module must default-export (or named-export ``extension``) an object with a
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url';
|
|
2
2
|
import { basenamePath, dirnamePath, resolvePath, SEP } from '@gobing-ai/ts-runtime';
|
|
3
|
-
import { loadExtensionModules } from '@gobing-ai/ts-runtime/
|
|
3
|
+
import { loadExtensionModules } from '@gobing-ai/ts-runtime/extension';
|
|
4
4
|
/** Host registries that can receive extension capabilities (all four kinds). */
|
|
5
5
|
const HOST_REGISTRY_BY_KIND = {
|
|
6
6
|
resolvers: 'resolvers',
|
|
@@ -31,7 +31,7 @@ export function collectExtensions(sourceName, sourceDir, extensions) {
|
|
|
31
31
|
* registry.
|
|
32
32
|
*
|
|
33
33
|
* Delegates generic loading (trust gate, path guard, module import, export-shape
|
|
34
|
-
* validation) to the shared ``loadExtensionModules`` from ts-runtime/
|
|
34
|
+
* validation) to the shared ``loadExtensionModules`` from ts-runtime/extension, then
|
|
35
35
|
* routes each capability to the correct host registry based on ``ref.kind``.
|
|
36
36
|
*
|
|
37
37
|
* A module must default-export (or named-export ``extension``) an object with a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CapabilityRegistry } from '@gobing-ai/ts-runtime/
|
|
1
|
+
import type { CapabilityRegistry } from '@gobing-ai/ts-runtime/extension';
|
|
2
2
|
import { type TestPathResolver } from '../resolvers/test-path-resolver';
|
|
3
3
|
import { type ConstraintRule, type RuleContext, type RuleEvaluationResult, type RuleEvaluator } from '../types';
|
|
4
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-location-evaluator.d.ts","sourceRoot":"","sources":["../../src/evaluators/test-location-evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"test-location-evaluator.d.ts","sourceRoot":"","sources":["../../src/evaluators/test-location-evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,KAAK,gBAAgB,EAA8B,MAAM,iCAAiC,CAAC;AACpG,OAAO,EACH,KAAK,cAAc,EAEnB,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EACrB,MAAM,UAAU,CAAC;AAWlB;;;;;;;;;;;;;GAaG;AACH,qBAAa,qBAAsB,YAAW,aAAa;IAE3C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;IADvC,kFAAkF;gBACrD,SAAS,CAAC,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,YAAA;IAE7E,0EAA0E;IACpE,QAAQ,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAyDzF;;;;;OAKG;IACH,OAAO,CAAC,cAAc;CASzB"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @module rule-engine/fixers/test-stub-fixer
|
|
12
12
|
*/
|
|
13
13
|
import { type ProcessExecutor } from '@gobing-ai/ts-runtime';
|
|
14
|
-
import type { CapabilityRegistry } from '@gobing-ai/ts-runtime/
|
|
14
|
+
import type { CapabilityRegistry } from '@gobing-ai/ts-runtime/extension';
|
|
15
15
|
import type { TestPathResolver } from '../resolvers/test-path-resolver';
|
|
16
16
|
import type { Fix } from '../types';
|
|
17
17
|
import type { RuleFixerInput, RuleFixerProvider } from './fixers';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-stub-fixer.d.ts","sourceRoot":"","sources":["../../src/fixers/test-stub-fixer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAA4C,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACvG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"test-stub-fixer.d.ts","sourceRoot":"","sources":["../../src/fixers/test-stub-fixer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAA4C,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACvG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElE,0DAA0D;AAC1D,MAAM,WAAW,kBAAkB;IAC/B,kDAAkD;IAClD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C;AAED,6EAA6E;AAC7E,eAAO,MAAM,cAAc,EAAE,kBAAyC,CAAC;AAEvE,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAC9B,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IACzD,+DAA+D;IAC/D,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,iDAAiD;IACjD,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;CAC5C;AAUD;;;;;;;GAOG;AACH,qBAAa,aAAc,YAAW,iBAAiB;IACnD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAuC;IACjE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAqB;gBAE5B,IAAI,EAAE,iBAAiB;IAOnC,wDAAwD;IAClD,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;CAkD3D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CapabilityRegistry } from '@gobing-ai/ts-runtime/
|
|
1
|
+
import { CapabilityRegistry } from '@gobing-ai/ts-runtime/extension';
|
|
2
2
|
import type { TestPathResolver } from '../resolvers/test-path-resolver';
|
|
3
3
|
import type { ResultFormatter, RuleEvaluator, RuleFixerProvider } from '../types';
|
|
4
4
|
/** Host container for rule-engine capabilities. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-engine-host.d.ts","sourceRoot":"","sources":["../../src/host/rule-engine-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"rule-engine-host.d.ts","sourceRoot":"","sources":["../../src/host/rule-engine-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElF,mDAAmD;AACnD,qBAAa,cAAc;IACvB,kDAAkD;IAClD,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACvD,kDAAkD;IAClD,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACzD,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IACzD,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;;CAQ1D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CapabilityRegistry } from '@gobing-ai/ts-runtime/
|
|
1
|
+
import { CapabilityRegistry } from '@gobing-ai/ts-runtime/extension';
|
|
2
2
|
/** Host container for rule-engine capabilities. */
|
|
3
3
|
export class RuleEngineHost {
|
|
4
4
|
/** Evaluator registry keyed by evaluator type. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type CapabilityEntry, type CapabilityOrigin, CapabilityRegistry } from '@gobing-ai/ts-runtime/
|
|
1
|
+
export { type CapabilityEntry, type CapabilityOrigin, CapabilityRegistry } from '@gobing-ai/ts-runtime/extension';
|
|
2
2
|
export * from './config/extensions';
|
|
3
3
|
export * from './config/loader';
|
|
4
4
|
export * from './engine';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAClH,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AAGzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Public re-export of the shared
|
|
2
|
-
// the shared
|
|
3
|
-
// once the one-release back-compat window closed.
|
|
4
|
-
export { CapabilityRegistry } from '@gobing-ai/ts-runtime/
|
|
1
|
+
// Public re-export of the shared extension registry (ADR-010). Sourced directly from
|
|
2
|
+
// the shared extension core (`@gobing-ai/ts-runtime/extension`); the former
|
|
3
|
+
// host/capability-registry.ts shim was removed once the one-release back-compat window closed.
|
|
4
|
+
export { CapabilityRegistry } from '@gobing-ai/ts-runtime/extension';
|
|
5
5
|
export * from './config/extensions.js';
|
|
6
6
|
export * from './config/loader.js';
|
|
7
7
|
export * from './engine.js';
|
package/dist/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assertRelativeExtensionPath } from '@gobing-ai/ts-runtime/
|
|
1
|
+
import { assertRelativeExtensionPath } from '@gobing-ai/ts-runtime/extension';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
/** Numeric rank for severity comparison; higher = more severe. */
|
|
4
4
|
export const SEVERITY_RANK = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobing-ai/ts-rule-engine",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "@gobing-ai/ts-rule-engine — Constraint rule schemas, loading, evaluation, and result formatting.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-rule-engine-v<version> && git push --tags' && exit 1"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@gobing-ai/ts-ai-runner": "^0.3.
|
|
53
|
-
"@gobing-ai/ts-infra": "^0.3.
|
|
54
|
-
"@gobing-ai/ts-runtime": "^0.3.
|
|
52
|
+
"@gobing-ai/ts-ai-runner": "^0.3.6",
|
|
53
|
+
"@gobing-ai/ts-infra": "^0.3.6",
|
|
54
|
+
"@gobing-ai/ts-runtime": "^0.3.6",
|
|
55
55
|
"yaml": "^2.7.0",
|
|
56
56
|
"zod": "^4.1.0"
|
|
57
57
|
},
|
package/src/config/extensions.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { basenamePath, dirnamePath, resolvePath, SEP } from '@gobing-ai/ts-runti
|
|
|
4
4
|
import type {
|
|
5
5
|
ExtensionRef as SharedExtensionRef,
|
|
6
6
|
LoadExtensionsOptions as SharedLoadExtensionsOptions,
|
|
7
|
-
} from '@gobing-ai/ts-runtime/
|
|
8
|
-
import { loadExtensionModules } from '@gobing-ai/ts-runtime/
|
|
7
|
+
} from '@gobing-ai/ts-runtime/extension';
|
|
8
|
+
import { loadExtensionModules } from '@gobing-ai/ts-runtime/extension';
|
|
9
9
|
import type { RuleEngineHost } from '../host/rule-engine-host';
|
|
10
10
|
/** A capability kind a preset extension can contribute. */
|
|
11
11
|
export type ExtensionKind = 'resolvers' | 'evaluators' | 'fixers' | 'formatters';
|
|
@@ -69,7 +69,7 @@ export function collectExtensions(
|
|
|
69
69
|
* registry.
|
|
70
70
|
*
|
|
71
71
|
* Delegates generic loading (trust gate, path guard, module import, export-shape
|
|
72
|
-
* validation) to the shared ``loadExtensionModules`` from ts-runtime/
|
|
72
|
+
* validation) to the shared ``loadExtensionModules`` from ts-runtime/extension, then
|
|
73
73
|
* routes each capability to the correct host registry based on ``ref.kind``.
|
|
74
74
|
*
|
|
75
75
|
* A module must default-export (or named-export ``extension``) an object with a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CapabilityRegistry } from '@gobing-ai/ts-runtime/
|
|
1
|
+
import type { CapabilityRegistry } from '@gobing-ai/ts-runtime/extension';
|
|
2
2
|
import { type TestPathResolver, TypeScriptTestPathResolver } from '../resolvers/test-path-resolver';
|
|
3
3
|
import {
|
|
4
4
|
type ConstraintRule,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { isAbsolutePath, joinPath, NodeFileSystem, type ProcessExecutor } from '@gobing-ai/ts-runtime';
|
|
15
|
-
import type { CapabilityRegistry } from '@gobing-ai/ts-runtime/
|
|
15
|
+
import type { CapabilityRegistry } from '@gobing-ai/ts-runtime/extension';
|
|
16
16
|
import type { TestPathResolver } from '../resolvers/test-path-resolver';
|
|
17
17
|
import type { Fix } from '../types';
|
|
18
18
|
import type { RuleFixerInput, RuleFixerProvider } from './fixers';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CapabilityRegistry } from '@gobing-ai/ts-runtime/
|
|
1
|
+
import { CapabilityRegistry } from '@gobing-ai/ts-runtime/extension';
|
|
2
2
|
import type { TestPathResolver } from '../resolvers/test-path-resolver';
|
|
3
3
|
import type { ResultFormatter, RuleEvaluator, RuleFixerProvider } from '../types';
|
|
4
4
|
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Public re-export of the shared
|
|
2
|
-
// the shared
|
|
3
|
-
// once the one-release back-compat window closed.
|
|
4
|
-
export { type CapabilityEntry, type CapabilityOrigin, CapabilityRegistry } from '@gobing-ai/ts-runtime/
|
|
1
|
+
// Public re-export of the shared extension registry (ADR-010). Sourced directly from
|
|
2
|
+
// the shared extension core (`@gobing-ai/ts-runtime/extension`); the former
|
|
3
|
+
// host/capability-registry.ts shim was removed once the one-release back-compat window closed.
|
|
4
|
+
export { type CapabilityEntry, type CapabilityOrigin, CapabilityRegistry } from '@gobing-ai/ts-runtime/extension';
|
|
5
5
|
export * from './config/extensions';
|
|
6
6
|
export * from './config/loader';
|
|
7
7
|
export * from './engine';
|
package/src/types.ts
CHANGED