@ontrails/warden 1.0.0-beta.8 → 1.0.0-beta.9
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/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +26 -0
- package/README.md +20 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/trails/context-no-surface-types.trail.d.ts +13 -0
- package/dist/trails/context-no-surface-types.trail.d.ts.map +1 -0
- package/dist/trails/context-no-surface-types.trail.js +21 -0
- package/dist/trails/context-no-surface-types.trail.js.map +1 -0
- package/dist/trails/follow-declarations.trail.d.ts +13 -0
- package/dist/trails/follow-declarations.trail.d.ts.map +1 -0
- package/dist/trails/follow-declarations.trail.js +22 -0
- package/dist/trails/follow-declarations.trail.js.map +1 -0
- package/dist/trails/implementation-returns-result.trail.d.ts +13 -0
- package/dist/trails/implementation-returns-result.trail.d.ts.map +1 -0
- package/dist/trails/implementation-returns-result.trail.js +20 -0
- package/dist/trails/implementation-returns-result.trail.js.map +1 -0
- package/dist/trails/index.d.ts +14 -0
- package/dist/trails/index.d.ts.map +1 -0
- package/dist/trails/index.js +13 -0
- package/dist/trails/index.js.map +1 -0
- package/dist/trails/no-direct-impl-in-route.trail.d.ts +13 -0
- package/dist/trails/no-direct-impl-in-route.trail.d.ts.map +1 -0
- package/dist/trails/no-direct-impl-in-route.trail.js +22 -0
- package/dist/trails/no-direct-impl-in-route.trail.js.map +1 -0
- package/dist/trails/no-direct-implementation-call.trail.d.ts +13 -0
- package/dist/trails/no-direct-implementation-call.trail.d.ts.map +1 -0
- package/dist/trails/no-direct-implementation-call.trail.js +16 -0
- package/dist/trails/no-direct-implementation-call.trail.js.map +1 -0
- package/dist/trails/no-sync-result-assumption.trail.d.ts +13 -0
- package/dist/trails/no-sync-result-assumption.trail.d.ts.map +1 -0
- package/dist/trails/no-sync-result-assumption.trail.js +19 -0
- package/dist/trails/no-sync-result-assumption.trail.js.map +1 -0
- package/dist/trails/no-throw-in-detour-target.trail.d.ts +14 -0
- package/dist/trails/no-throw-in-detour-target.trail.d.ts.map +1 -0
- package/dist/trails/no-throw-in-detour-target.trail.js +20 -0
- package/dist/trails/no-throw-in-detour-target.trail.js.map +1 -0
- package/dist/trails/no-throw-in-implementation.trail.d.ts +13 -0
- package/dist/trails/no-throw-in-implementation.trail.d.ts.map +1 -0
- package/dist/trails/no-throw-in-implementation.trail.js +20 -0
- package/dist/trails/no-throw-in-implementation.trail.js.map +1 -0
- package/dist/trails/prefer-schema-inference.trail.d.ts +13 -0
- package/dist/trails/prefer-schema-inference.trail.d.ts.map +1 -0
- package/dist/trails/prefer-schema-inference.trail.js +21 -0
- package/dist/trails/prefer-schema-inference.trail.js.map +1 -0
- package/dist/trails/run.d.ts +16 -0
- package/dist/trails/run.d.ts.map +1 -0
- package/dist/trails/run.js +30 -0
- package/dist/trails/run.js.map +1 -0
- package/dist/trails/schema.d.ts +52 -0
- package/dist/trails/schema.d.ts.map +1 -0
- package/dist/trails/schema.js +38 -0
- package/dist/trails/schema.js.map +1 -0
- package/dist/trails/topo.d.ts +3 -0
- package/dist/trails/topo.d.ts.map +1 -0
- package/dist/trails/topo.js +5 -0
- package/dist/trails/topo.js.map +1 -0
- package/dist/trails/valid-describe-refs.trail.d.ts +14 -0
- package/dist/trails/valid-describe-refs.trail.d.ts.map +1 -0
- package/dist/trails/valid-describe-refs.trail.js +18 -0
- package/dist/trails/valid-describe-refs.trail.js.map +1 -0
- package/dist/trails/valid-detour-refs.trail.d.ts +14 -0
- package/dist/trails/valid-detour-refs.trail.d.ts.map +1 -0
- package/dist/trails/valid-detour-refs.trail.js +24 -0
- package/dist/trails/valid-detour-refs.trail.js.map +1 -0
- package/dist/trails/wrap-rule.d.ts +29 -0
- package/dist/trails/wrap-rule.d.ts.map +1 -0
- package/dist/trails/wrap-rule.js +43 -0
- package/dist/trails/wrap-rule.js.map +1 -0
- package/package.json +4 -3
- package/src/__tests__/trails.test.ts +19 -0
- package/src/index.ts +21 -0
- package/src/trails/context-no-surface-types.trail.ts +21 -0
- package/src/trails/follow-declarations.trail.ts +22 -0
- package/src/trails/implementation-returns-result.trail.ts +20 -0
- package/src/trails/index.ts +14 -0
- package/src/trails/no-direct-impl-in-route.trail.ts +22 -0
- package/src/trails/no-direct-implementation-call.trail.ts +16 -0
- package/src/trails/no-sync-result-assumption.trail.ts +19 -0
- package/src/trails/no-throw-in-detour-target.trail.ts +20 -0
- package/src/trails/no-throw-in-implementation.trail.ts +20 -0
- package/src/trails/prefer-schema-inference.trail.ts +21 -0
- package/src/trails/run.ts +40 -0
- package/src/trails/schema.ts +46 -0
- package/src/trails/topo.ts +6 -0
- package/src/trails/valid-describe-refs.trail.ts +18 -0
- package/src/trails/valid-detour-refs.trail.ts +24 -0
- package/src/trails/wrap-rule.ts +84 -0
- package/tsconfig.tsbuildinfo +1 -1
package/.turbo/turbo-lint.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @ontrails/warden
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.9
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Consolidated improvements across all surface packages.
|
|
8
|
+
|
|
9
|
+
**core**: Add `TrailResult<T>` utility type, `topo.ids()` and `topo.count` accessors, `dispatch()` for headless trail execution, and extract shared `executeTrail` pipeline used by CLI/MCP/HTTP.
|
|
10
|
+
|
|
11
|
+
**http**: Detect route path collisions and return `Result` from `buildHttpRoutes()`, wire request `AbortSignal` through to trail context, and make write → POST mapping explicit in intent-to-method lookup.
|
|
12
|
+
|
|
13
|
+
**mcp**: Return `Result` from `buildMcpTools()` on collision instead of throwing.
|
|
14
|
+
|
|
15
|
+
**cli**: Verify exception catching via centralized `executeTrail`.
|
|
16
|
+
|
|
17
|
+
**testing**: Follow context awareness improvements.
|
|
18
|
+
|
|
19
|
+
**warden**: Refactor rules as composable trails with examples.
|
|
20
|
+
|
|
21
|
+
**schema**: Error code and empty body fixes.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
- @ontrails/core@1.0.0-beta.9
|
|
27
|
+
- @ontrails/schema@1.0.0-beta.9
|
|
28
|
+
|
|
3
29
|
## 1.0.0-beta.8
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -71,6 +71,24 @@ CI formatters for structured output:
|
|
|
71
71
|
import { formatGitHubAnnotations, formatJson, formatSummary } from '@ontrails/warden';
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
## Trail-based API
|
|
75
|
+
|
|
76
|
+
Every built-in warden rule is also available as a composable trail. This makes rules queryable, testable, and invocable through any Trails surface.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { wardenTopo, runWardenTrails } from '@ontrails/warden';
|
|
80
|
+
|
|
81
|
+
// Inspect the warden rule trails
|
|
82
|
+
console.log(wardenTopo.ids()); // ['warden.rule.no-throw-in-implementation', ...]
|
|
83
|
+
|
|
84
|
+
// Run all rule trails against a source file
|
|
85
|
+
const diagnostics = await runWardenTrails(filePath, sourceCode, {
|
|
86
|
+
knownTrailIds: myApp.ids(),
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
To wrap a custom rule as a trail, use `wrapRule` (imported from `@ontrails/warden/trails/wrap-rule`). This is the same factory used internally to build all built-in rule trails.
|
|
91
|
+
|
|
74
92
|
## API
|
|
75
93
|
|
|
76
94
|
| Export | What it does |
|
|
@@ -79,6 +97,8 @@ import { formatGitHubAnnotations, formatJson, formatSummary } from '@ontrails/wa
|
|
|
79
97
|
| `formatWardenReport(report)` | Human-readable report |
|
|
80
98
|
| `checkDrift(app)` | Check if `surface.lock` matches the current topo |
|
|
81
99
|
| `wardenRules` | Registry of all built-in rules |
|
|
100
|
+
| `wardenTopo` | `Topo` of all built-in rule trails (one per rule) |
|
|
101
|
+
| `runWardenTrails(filePath, sourceCode, options?)` | Dispatch all rule trails for a file, collect diagnostics |
|
|
82
102
|
| `formatGitHubAnnotations(report)` | GitHub Actions annotation format |
|
|
83
103
|
| `formatJson(report)` | Machine-readable JSON |
|
|
84
104
|
| `formatSummary(report)` | Compact summary line |
|
package/dist/index.d.ts
CHANGED
|
@@ -23,4 +23,8 @@ export { formatWardenReport, runWarden } from './cli.js';
|
|
|
23
23
|
export { formatGitHubAnnotations, formatJson, formatSummary, } from './formatters.js';
|
|
24
24
|
export type { DriftResult } from './drift.js';
|
|
25
25
|
export { checkDrift } from './drift.js';
|
|
26
|
+
export { wardenTopo } from './trails/topo.js';
|
|
27
|
+
export { runWardenTrails } from './trails/run.js';
|
|
28
|
+
export { contextNoSurfaceTypesTrail, diagnosticSchema, followDeclarationsTrail, implementationReturnsResultTrail, noDirectImplInRouteTrail, noDirectImplementationCallTrail, noSyncResultAssumptionTrail, noThrowInDetourTargetTrail, noThrowInImplementationTrail, preferSchemaInferenceTrail, ruleInput, ruleOutput, validDescribeRefsTrail, validDetourRefsTrail, } from './trails/index.js';
|
|
29
|
+
export type { RuleInput, RuleOutput } from './trails/index.js';
|
|
26
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EACV,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,cAAc,GACf,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGzD,OAAO,EACL,uBAAuB,EACvB,UAAU,EACV,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EACV,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,cAAc,GACf,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGzD,OAAO,EACL,uBAAuB,EACvB,UAAU,EACV,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,gCAAgC,EAChC,wBAAwB,EACxB,+BAA+B,EAC/B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,EAC1B,SAAS,EACT,UAAU,EACV,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -23,4 +23,8 @@ export { formatWardenReport, runWarden } from './cli.js';
|
|
|
23
23
|
// CI formatters
|
|
24
24
|
export { formatGitHubAnnotations, formatJson, formatSummary, } from './formatters.js';
|
|
25
25
|
export { checkDrift } from './drift.js';
|
|
26
|
+
// Trail layer
|
|
27
|
+
export { wardenTopo } from './trails/topo.js';
|
|
28
|
+
export { runWardenTrails } from './trails/run.js';
|
|
29
|
+
export { contextNoSurfaceTypesTrail, diagnosticSchema, followDeclarationsTrail, implementationReturnsResultTrail, noDirectImplInRouteTrail, noDirectImplementationCallTrail, noSyncResultAssumptionTrail, noThrowInDetourTargetTrail, noThrowInImplementationTrail, preferSchemaInferenceTrail, ruleInput, ruleOutput, validDescribeRefsTrail, validDetourRefsTrail, } from './trails/index.js';
|
|
26
30
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,mBAAmB;AACnB,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,gBAAgB;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEzD,gBAAgB;AAChB,OAAO,EACL,uBAAuB,EACvB,UAAU,EACV,aAAa,GACd,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,mBAAmB;AACnB,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,gBAAgB;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEzD,gBAAgB;AAChB,OAAO,EACL,uBAAuB,EACvB,UAAU,EACV,aAAa,GACd,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,cAAc;AACd,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,gCAAgC,EAChC,wBAAwB,EACxB,+BAA+B,EAC/B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,EAC1B,SAAS,EACT,UAAU,EACV,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const contextNoSurfaceTypesTrail: import("@ontrails/core").Trail<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
sourceCode: string;
|
|
4
|
+
}, {
|
|
5
|
+
diagnostics: {
|
|
6
|
+
filePath: string;
|
|
7
|
+
line: number;
|
|
8
|
+
message: string;
|
|
9
|
+
rule: string;
|
|
10
|
+
severity: "error" | "warn";
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=context-no-surface-types.trail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-no-surface-types.trail.d.ts","sourceRoot":"","sources":["../../src/trails/context-no-surface-types.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B;;;;;;;;;;;EAiBrC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { contextNoSurfaceTypes } from '../rules/context-no-surface-types.js';
|
|
2
|
+
import { wrapRule } from './wrap-rule.js';
|
|
3
|
+
export const contextNoSurfaceTypesTrail = wrapRule({
|
|
4
|
+
examples: [
|
|
5
|
+
{
|
|
6
|
+
expected: { diagnostics: [] },
|
|
7
|
+
input: {
|
|
8
|
+
filePath: 'clean.ts',
|
|
9
|
+
sourceCode: `import { trail, Result } from "@ontrails/core";
|
|
10
|
+
trail("entity.show", {
|
|
11
|
+
run: async (input, ctx) => {
|
|
12
|
+
return Result.ok({ name: "test" });
|
|
13
|
+
}
|
|
14
|
+
})`,
|
|
15
|
+
},
|
|
16
|
+
name: 'Clean trail without surface imports',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
rule: contextNoSurfaceTypes,
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=context-no-surface-types.trail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-no-surface-types.trail.js","sourceRoot":"","sources":["../../src/trails/context-no-surface-types.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IACjD,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,UAAU,EAAE;;;;;GAKjB;aACI;YACD,IAAI,EAAE,qCAAqC;SAC5C;KACF;IACD,IAAI,EAAE,qBAAqB;CAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const followDeclarationsTrail: import("@ontrails/core").Trail<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
sourceCode: string;
|
|
4
|
+
}, {
|
|
5
|
+
diagnostics: {
|
|
6
|
+
filePath: string;
|
|
7
|
+
line: number;
|
|
8
|
+
message: string;
|
|
9
|
+
rule: string;
|
|
10
|
+
severity: "error" | "warn";
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=follow-declarations.trail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"follow-declarations.trail.d.ts","sourceRoot":"","sources":["../../src/trails/follow-declarations.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB;;;;;;;;;;;EAkBlC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { followDeclarations } from '../rules/follow-declarations.js';
|
|
2
|
+
import { wrapRule } from './wrap-rule.js';
|
|
3
|
+
export const followDeclarationsTrail = wrapRule({
|
|
4
|
+
examples: [
|
|
5
|
+
{
|
|
6
|
+
expected: { diagnostics: [] },
|
|
7
|
+
input: {
|
|
8
|
+
filePath: 'clean.ts',
|
|
9
|
+
sourceCode: `trail("entity.onboard", {
|
|
10
|
+
follow: ["entity.create"],
|
|
11
|
+
run: async (input, ctx) => {
|
|
12
|
+
const result = await ctx.follow("entity.create", input);
|
|
13
|
+
return Result.ok(result);
|
|
14
|
+
}
|
|
15
|
+
})`,
|
|
16
|
+
},
|
|
17
|
+
name: 'Matched follow declarations and calls',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
rule: followDeclarations,
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=follow-declarations.trail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"follow-declarations.trail.js","sourceRoot":"","sources":["../../src/trails/follow-declarations.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC9C,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,UAAU,EAAE;;;;;;GAMjB;aACI;YACD,IAAI,EAAE,uCAAuC;SAC9C;KACF;IACD,IAAI,EAAE,kBAAkB;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const implementationReturnsResultTrail: import("@ontrails/core").Trail<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
sourceCode: string;
|
|
4
|
+
}, {
|
|
5
|
+
diagnostics: {
|
|
6
|
+
filePath: string;
|
|
7
|
+
line: number;
|
|
8
|
+
message: string;
|
|
9
|
+
rule: string;
|
|
10
|
+
severity: "error" | "warn";
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=implementation-returns-result.trail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implementation-returns-result.trail.d.ts","sourceRoot":"","sources":["../../src/trails/implementation-returns-result.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gCAAgC;;;;;;;;;;;EAgB3C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { implementationReturnsResult } from '../rules/implementation-returns-result.js';
|
|
2
|
+
import { wrapRule } from './wrap-rule.js';
|
|
3
|
+
export const implementationReturnsResultTrail = wrapRule({
|
|
4
|
+
examples: [
|
|
5
|
+
{
|
|
6
|
+
expected: { diagnostics: [] },
|
|
7
|
+
input: {
|
|
8
|
+
filePath: 'clean.ts',
|
|
9
|
+
sourceCode: `trail("entity.show", {
|
|
10
|
+
run: async (input, ctx) => {
|
|
11
|
+
return Result.ok({ name: "test" });
|
|
12
|
+
}
|
|
13
|
+
})`,
|
|
14
|
+
},
|
|
15
|
+
name: 'Implementation returning Result.ok()',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
rule: implementationReturnsResult,
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=implementation-returns-result.trail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implementation-returns-result.trail.js","sourceRoot":"","sources":["../../src/trails/implementation-returns-result.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,gCAAgC,GAAG,QAAQ,CAAC;IACvD,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,UAAU,EAAE;;;;GAIjB;aACI;YACD,IAAI,EAAE,sCAAsC;SAC7C;KACF;IACD,IAAI,EAAE,2BAA2B;CAClC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { contextNoSurfaceTypesTrail } from './context-no-surface-types.trail.js';
|
|
2
|
+
export { followDeclarationsTrail } from './follow-declarations.trail.js';
|
|
3
|
+
export { implementationReturnsResultTrail } from './implementation-returns-result.trail.js';
|
|
4
|
+
export { noDirectImplInRouteTrail } from './no-direct-impl-in-route.trail.js';
|
|
5
|
+
export { noDirectImplementationCallTrail } from './no-direct-implementation-call.trail.js';
|
|
6
|
+
export { noSyncResultAssumptionTrail } from './no-sync-result-assumption.trail.js';
|
|
7
|
+
export { noThrowInDetourTargetTrail } from './no-throw-in-detour-target.trail.js';
|
|
8
|
+
export { noThrowInImplementationTrail } from './no-throw-in-implementation.trail.js';
|
|
9
|
+
export { preferSchemaInferenceTrail } from './prefer-schema-inference.trail.js';
|
|
10
|
+
export { validDescribeRefsTrail } from './valid-describe-refs.trail.js';
|
|
11
|
+
export { validDetourRefsTrail } from './valid-detour-refs.trail.js';
|
|
12
|
+
export { ruleInput, ruleOutput, diagnosticSchema } from './schema.js';
|
|
13
|
+
export type { RuleInput, RuleOutput } from './schema.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trails/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACtE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { contextNoSurfaceTypesTrail } from './context-no-surface-types.trail.js';
|
|
2
|
+
export { followDeclarationsTrail } from './follow-declarations.trail.js';
|
|
3
|
+
export { implementationReturnsResultTrail } from './implementation-returns-result.trail.js';
|
|
4
|
+
export { noDirectImplInRouteTrail } from './no-direct-impl-in-route.trail.js';
|
|
5
|
+
export { noDirectImplementationCallTrail } from './no-direct-implementation-call.trail.js';
|
|
6
|
+
export { noSyncResultAssumptionTrail } from './no-sync-result-assumption.trail.js';
|
|
7
|
+
export { noThrowInDetourTargetTrail } from './no-throw-in-detour-target.trail.js';
|
|
8
|
+
export { noThrowInImplementationTrail } from './no-throw-in-implementation.trail.js';
|
|
9
|
+
export { preferSchemaInferenceTrail } from './prefer-schema-inference.trail.js';
|
|
10
|
+
export { validDescribeRefsTrail } from './valid-describe-refs.trail.js';
|
|
11
|
+
export { validDetourRefsTrail } from './valid-detour-refs.trail.js';
|
|
12
|
+
export { ruleInput, ruleOutput, diagnosticSchema } from './schema.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/trails/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const noDirectImplInRouteTrail: import("@ontrails/core").Trail<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
sourceCode: string;
|
|
4
|
+
}, {
|
|
5
|
+
diagnostics: {
|
|
6
|
+
filePath: string;
|
|
7
|
+
line: number;
|
|
8
|
+
message: string;
|
|
9
|
+
rule: string;
|
|
10
|
+
severity: "error" | "warn";
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=no-direct-impl-in-route.trail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-direct-impl-in-route.trail.d.ts","sourceRoot":"","sources":["../../src/trails/no-direct-impl-in-route.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB;;;;;;;;;;;EAkBnC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { noDirectImplInRoute } from '../rules/no-direct-impl-in-route.js';
|
|
2
|
+
import { wrapRule } from './wrap-rule.js';
|
|
3
|
+
export const noDirectImplInRouteTrail = wrapRule({
|
|
4
|
+
examples: [
|
|
5
|
+
{
|
|
6
|
+
expected: { diagnostics: [] },
|
|
7
|
+
input: {
|
|
8
|
+
filePath: 'clean.ts',
|
|
9
|
+
sourceCode: `trail("entity.onboard", {
|
|
10
|
+
follow: ["entity.create"],
|
|
11
|
+
run: async (input, ctx) => {
|
|
12
|
+
const result = await ctx.follow("entity.create", input);
|
|
13
|
+
return Result.ok(result);
|
|
14
|
+
}
|
|
15
|
+
})`,
|
|
16
|
+
},
|
|
17
|
+
name: 'Trail with follow using ctx.follow()',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
rule: noDirectImplInRoute,
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=no-direct-impl-in-route.trail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-direct-impl-in-route.trail.js","sourceRoot":"","sources":["../../src/trails/no-direct-impl-in-route.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC/C,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,UAAU,EAAE;;;;;;GAMjB;aACI;YACD,IAAI,EAAE,sCAAsC;SAC7C;KACF;IACD,IAAI,EAAE,mBAAmB;CAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const noDirectImplementationCallTrail: import("@ontrails/core").Trail<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
sourceCode: string;
|
|
4
|
+
}, {
|
|
5
|
+
diagnostics: {
|
|
6
|
+
filePath: string;
|
|
7
|
+
line: number;
|
|
8
|
+
message: string;
|
|
9
|
+
rule: string;
|
|
10
|
+
severity: "error" | "warn";
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=no-direct-implementation-call.trail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-direct-implementation-call.trail.d.ts","sourceRoot":"","sources":["../../src/trails/no-direct-implementation-call.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,+BAA+B;;;;;;;;;;;EAY1C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { noDirectImplementationCall } from '../rules/no-direct-implementation-call.js';
|
|
2
|
+
import { wrapRule } from './wrap-rule.js';
|
|
3
|
+
export const noDirectImplementationCallTrail = wrapRule({
|
|
4
|
+
examples: [
|
|
5
|
+
{
|
|
6
|
+
expected: { diagnostics: [] },
|
|
7
|
+
input: {
|
|
8
|
+
filePath: 'clean.ts',
|
|
9
|
+
sourceCode: `const data = await ctx.follow("entity.show", { id: "1" });`,
|
|
10
|
+
},
|
|
11
|
+
name: 'Clean code using ctx.follow instead of .run()',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
rule: noDirectImplementationCall,
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=no-direct-implementation-call.trail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-direct-implementation-call.trail.js","sourceRoot":"","sources":["../../src/trails/no-direct-implementation-call.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,+BAA+B,GAAG,QAAQ,CAAC;IACtD,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,UAAU,EAAE,4DAA4D;aACzE;YACD,IAAI,EAAE,+CAA+C;SACtD;KACF;IACD,IAAI,EAAE,0BAA0B;CACjC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const noSyncResultAssumptionTrail: import("@ontrails/core").Trail<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
sourceCode: string;
|
|
4
|
+
}, {
|
|
5
|
+
diagnostics: {
|
|
6
|
+
filePath: string;
|
|
7
|
+
line: number;
|
|
8
|
+
message: string;
|
|
9
|
+
rule: string;
|
|
10
|
+
severity: "error" | "warn";
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=no-sync-result-assumption.trail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-sync-result-assumption.trail.d.ts","sourceRoot":"","sources":["../../src/trails/no-sync-result-assumption.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,2BAA2B;;;;;;;;;;;EAetC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { noSyncResultAssumption } from '../rules/no-sync-result-assumption.js';
|
|
2
|
+
import { wrapRule } from './wrap-rule.js';
|
|
3
|
+
export const noSyncResultAssumptionTrail = wrapRule({
|
|
4
|
+
examples: [
|
|
5
|
+
{
|
|
6
|
+
expected: { diagnostics: [] },
|
|
7
|
+
input: {
|
|
8
|
+
filePath: 'clean.ts',
|
|
9
|
+
sourceCode: `const result = await myTrail.run(input, ctx);
|
|
10
|
+
if (result.isOk()) {
|
|
11
|
+
console.log(result.value);
|
|
12
|
+
}`,
|
|
13
|
+
},
|
|
14
|
+
name: 'Properly awaited .run() call',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
rule: noSyncResultAssumption,
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=no-sync-result-assumption.trail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-sync-result-assumption.trail.js","sourceRoot":"","sources":["../../src/trails/no-sync-result-assumption.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IAClD,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,UAAU,EAAE;;;EAGlB;aACK;YACD,IAAI,EAAE,8BAA8B;SACrC;KACF;IACD,IAAI,EAAE,sBAAsB;CAC7B,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const noThrowInDetourTargetTrail: import("@ontrails/core").Trail<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
sourceCode: string;
|
|
4
|
+
knownTrailIds?: string[] | undefined;
|
|
5
|
+
}, {
|
|
6
|
+
diagnostics: {
|
|
7
|
+
filePath: string;
|
|
8
|
+
line: number;
|
|
9
|
+
message: string;
|
|
10
|
+
rule: string;
|
|
11
|
+
severity: "error" | "warn";
|
|
12
|
+
}[];
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=no-throw-in-detour-target.trail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-throw-in-detour-target.trail.d.ts","sourceRoot":"","sources":["../../src/trails/no-throw-in-detour-target.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B;;;;;;;;;;;;EAgBrC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { noThrowInDetourTarget } from '../rules/no-throw-in-detour-target.js';
|
|
2
|
+
import { wrapRule } from './wrap-rule.js';
|
|
3
|
+
export const noThrowInDetourTargetTrail = wrapRule({
|
|
4
|
+
examples: [
|
|
5
|
+
{
|
|
6
|
+
expected: { diagnostics: [] },
|
|
7
|
+
input: {
|
|
8
|
+
filePath: 'clean.ts',
|
|
9
|
+
sourceCode: `trail("entity.fallback", {
|
|
10
|
+
run: async (input, ctx) => {
|
|
11
|
+
return Result.ok({ recovered: true });
|
|
12
|
+
}
|
|
13
|
+
})`,
|
|
14
|
+
},
|
|
15
|
+
name: 'Detour target without throw',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
rule: noThrowInDetourTarget,
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=no-throw-in-detour-target.trail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-throw-in-detour-target.trail.js","sourceRoot":"","sources":["../../src/trails/no-throw-in-detour-target.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IACjD,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,UAAU,EAAE;;;;GAIjB;aACI;YACD,IAAI,EAAE,6BAA6B;SACpC;KACF;IACD,IAAI,EAAE,qBAAqB;CAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const noThrowInImplementationTrail: import("@ontrails/core").Trail<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
sourceCode: string;
|
|
4
|
+
}, {
|
|
5
|
+
diagnostics: {
|
|
6
|
+
filePath: string;
|
|
7
|
+
line: number;
|
|
8
|
+
message: string;
|
|
9
|
+
rule: string;
|
|
10
|
+
severity: "error" | "warn";
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=no-throw-in-implementation.trail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-throw-in-implementation.trail.d.ts","sourceRoot":"","sources":["../../src/trails/no-throw-in-implementation.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B;;;;;;;;;;;EAgBvC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { noThrowInImplementation } from '../rules/no-throw-in-implementation.js';
|
|
2
|
+
import { wrapRule } from './wrap-rule.js';
|
|
3
|
+
export const noThrowInImplementationTrail = wrapRule({
|
|
4
|
+
examples: [
|
|
5
|
+
{
|
|
6
|
+
expected: { diagnostics: [] },
|
|
7
|
+
input: {
|
|
8
|
+
filePath: 'clean.ts',
|
|
9
|
+
sourceCode: `trail("entity.show", {
|
|
10
|
+
run: async (input, ctx) => {
|
|
11
|
+
return Result.ok({ name: "test" });
|
|
12
|
+
}
|
|
13
|
+
})`,
|
|
14
|
+
},
|
|
15
|
+
name: 'Clean implementation without throw',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
rule: noThrowInImplementation,
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=no-throw-in-implementation.trail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-throw-in-implementation.trail.js","sourceRoot":"","sources":["../../src/trails/no-throw-in-implementation.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,4BAA4B,GAAG,QAAQ,CAAC;IACnD,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,UAAU,EAAE;;;;GAIjB;aACI;YACD,IAAI,EAAE,oCAAoC;SAC3C;KACF;IACD,IAAI,EAAE,uBAAuB;CAC9B,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const preferSchemaInferenceTrail: import("@ontrails/core").Trail<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
sourceCode: string;
|
|
4
|
+
}, {
|
|
5
|
+
diagnostics: {
|
|
6
|
+
filePath: string;
|
|
7
|
+
line: number;
|
|
8
|
+
message: string;
|
|
9
|
+
rule: string;
|
|
10
|
+
severity: "error" | "warn";
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=prefer-schema-inference.trail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-schema-inference.trail.d.ts","sourceRoot":"","sources":["../../src/trails/prefer-schema-inference.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B;;;;;;;;;;;EAiBrC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { preferSchemaInference } from '../rules/prefer-schema-inference.js';
|
|
2
|
+
import { wrapRule } from './wrap-rule.js';
|
|
3
|
+
export const preferSchemaInferenceTrail = wrapRule({
|
|
4
|
+
examples: [
|
|
5
|
+
{
|
|
6
|
+
expected: { diagnostics: [] },
|
|
7
|
+
input: {
|
|
8
|
+
filePath: 'clean.ts',
|
|
9
|
+
sourceCode: `trail("entity.show", {
|
|
10
|
+
input: z.object({ name: z.string() }),
|
|
11
|
+
run: async (input, ctx) => {
|
|
12
|
+
return Result.ok({ name: input.name });
|
|
13
|
+
}
|
|
14
|
+
})`,
|
|
15
|
+
},
|
|
16
|
+
name: 'Trail without redundant field overrides',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
rule: preferSchemaInference,
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=prefer-schema-inference.trail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-schema-inference.trail.js","sourceRoot":"","sources":["../../src/trails/prefer-schema-inference.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IACjD,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,UAAU,EAAE;;;;;GAKjB;aACI;YACD,IAAI,EAAE,yCAAyC;SAChD;KACF;IACD,IAAI,EAAE,qBAAqB;CAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run all warden rule trails against a single source file.
|
|
3
|
+
*
|
|
4
|
+
* Returns a flat array of diagnostics from every rule.
|
|
5
|
+
*/
|
|
6
|
+
import type { WardenDiagnostic } from '../rules/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Dispatch all warden rule trails for a given file and collect diagnostics.
|
|
9
|
+
*
|
|
10
|
+
* Each rule trail runs independently. Errors from individual trails are
|
|
11
|
+
* silently skipped so that one broken rule does not block the rest.
|
|
12
|
+
*/
|
|
13
|
+
export declare const runWardenTrails: (filePath: string, sourceCode: string, options?: {
|
|
14
|
+
readonly knownTrailIds?: readonly string[];
|
|
15
|
+
}) => Promise<readonly WardenDiagnostic[]>;
|
|
16
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/trails/run.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAI1D;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,MAAM,EAChB,YAAY,MAAM,EAClB,UAAU;IAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,KACvD,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAiBrC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run all warden rule trails against a single source file.
|
|
3
|
+
*
|
|
4
|
+
* Returns a flat array of diagnostics from every rule.
|
|
5
|
+
*/
|
|
6
|
+
import { dispatch } from '@ontrails/core';
|
|
7
|
+
import { wardenTopo } from './topo.js';
|
|
8
|
+
/**
|
|
9
|
+
* Dispatch all warden rule trails for a given file and collect diagnostics.
|
|
10
|
+
*
|
|
11
|
+
* Each rule trail runs independently. Errors from individual trails are
|
|
12
|
+
* silently skipped so that one broken rule does not block the rest.
|
|
13
|
+
*/
|
|
14
|
+
export const runWardenTrails = async (filePath, sourceCode, options) => {
|
|
15
|
+
const allDiagnostics = [];
|
|
16
|
+
for (const id of wardenTopo.ids()) {
|
|
17
|
+
const input = options?.knownTrailIds
|
|
18
|
+
? { filePath, knownTrailIds: options.knownTrailIds, sourceCode }
|
|
19
|
+
: { filePath, sourceCode };
|
|
20
|
+
const result = await dispatch(wardenTopo, id, input);
|
|
21
|
+
if (result.isOk()) {
|
|
22
|
+
const { diagnostics } = result.value;
|
|
23
|
+
for (const d of diagnostics) {
|
|
24
|
+
allDiagnostics.push(d);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return allDiagnostics;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/trails/run.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,QAAgB,EAChB,UAAkB,EAClB,OAAwD,EAClB,EAAE;IACxC,MAAM,cAAc,GAAuB,EAAE,CAAC;IAE9C,KAAK,MAAM,EAAE,IAAI,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,OAAO,EAAE,aAAa;YAClC,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,UAAU,EAAE;YAChE,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACrD,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;YAClB,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,KAAmB,CAAC;YACnD,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;gBAC5B,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC"}
|