@cisco_open/linting-orchestrator 1.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +5 -0
- package/README.md +43 -0
- package/build/cli/api-client.d.ts +170 -0
- package/build/cli/api-client.d.ts.map +1 -0
- package/build/cli/api-client.js +284 -0
- package/build/cli/api-client.js.map +1 -0
- package/build/cli/commands/agents.d.ts +7 -0
- package/build/cli/commands/agents.d.ts.map +1 -0
- package/build/cli/commands/agents.js +694 -0
- package/build/cli/commands/agents.js.map +1 -0
- package/build/cli/commands/completion.d.ts +9 -0
- package/build/cli/commands/completion.d.ts.map +1 -0
- package/build/cli/commands/completion.js +177 -0
- package/build/cli/commands/completion.js.map +1 -0
- package/build/cli/commands/config.d.ts +10 -0
- package/build/cli/commands/config.d.ts.map +1 -0
- package/build/cli/commands/config.js +284 -0
- package/build/cli/commands/config.js.map +1 -0
- package/build/cli/commands/health.d.ts +11 -0
- package/build/cli/commands/health.d.ts.map +1 -0
- package/build/cli/commands/health.js +38 -0
- package/build/cli/commands/health.js.map +1 -0
- package/build/cli/commands/help.d.ts +6 -0
- package/build/cli/commands/help.d.ts.map +1 -0
- package/build/cli/commands/help.js +20 -0
- package/build/cli/commands/help.js.map +1 -0
- package/build/cli/commands/history.d.ts +11 -0
- package/build/cli/commands/history.d.ts.map +1 -0
- package/build/cli/commands/history.js +50 -0
- package/build/cli/commands/history.js.map +1 -0
- package/build/cli/commands/jobs.d.ts +12 -0
- package/build/cli/commands/jobs.d.ts.map +1 -0
- package/build/cli/commands/jobs.js +84 -0
- package/build/cli/commands/jobs.js.map +1 -0
- package/build/cli/commands/lint.d.ts +15 -0
- package/build/cli/commands/lint.d.ts.map +1 -0
- package/build/cli/commands/lint.js +384 -0
- package/build/cli/commands/lint.js.map +1 -0
- package/build/cli/commands/ps.d.ts +8 -0
- package/build/cli/commands/ps.d.ts.map +1 -0
- package/build/cli/commands/ps.js +74 -0
- package/build/cli/commands/ps.js.map +1 -0
- package/build/cli/commands/reproduce.d.ts +9 -0
- package/build/cli/commands/reproduce.d.ts.map +1 -0
- package/build/cli/commands/reproduce.js +31 -0
- package/build/cli/commands/reproduce.js.map +1 -0
- package/build/cli/commands/reset.d.ts +5 -0
- package/build/cli/commands/reset.d.ts.map +1 -0
- package/build/cli/commands/reset.js +13 -0
- package/build/cli/commands/reset.js.map +1 -0
- package/build/cli/commands/results.d.ts +13 -0
- package/build/cli/commands/results.d.ts.map +1 -0
- package/build/cli/commands/results.js +129 -0
- package/build/cli/commands/results.js.map +1 -0
- package/build/cli/commands/rulesets/check.d.ts +12 -0
- package/build/cli/commands/rulesets/check.d.ts.map +1 -0
- package/build/cli/commands/rulesets/check.js +226 -0
- package/build/cli/commands/rulesets/check.js.map +1 -0
- package/build/cli/commands/rulesets/index.d.ts +5 -0
- package/build/cli/commands/rulesets/index.d.ts.map +1 -0
- package/build/cli/commands/rulesets/index.js +6 -0
- package/build/cli/commands/rulesets/index.js.map +1 -0
- package/build/cli/commands/rulesets/view.d.ts +16 -0
- package/build/cli/commands/rulesets/view.d.ts.map +1 -0
- package/build/cli/commands/rulesets/view.js +100 -0
- package/build/cli/commands/rulesets/view.js.map +1 -0
- package/build/cli/commands/start.d.ts +16 -0
- package/build/cli/commands/start.d.ts.map +1 -0
- package/build/cli/commands/start.js +167 -0
- package/build/cli/commands/start.js.map +1 -0
- package/build/cli/commands/status.d.ts +9 -0
- package/build/cli/commands/status.d.ts.map +1 -0
- package/build/cli/commands/status.js +46 -0
- package/build/cli/commands/status.js.map +1 -0
- package/build/cli/commands/stop.d.ts +11 -0
- package/build/cli/commands/stop.d.ts.map +1 -0
- package/build/cli/commands/stop.js +78 -0
- package/build/cli/commands/stop.js.map +1 -0
- package/build/cli/config-manager.d.ts +134 -0
- package/build/cli/config-manager.d.ts.map +1 -0
- package/build/cli/config-manager.js +288 -0
- package/build/cli/config-manager.js.map +1 -0
- package/build/cli/formatters.d.ts +62 -0
- package/build/cli/formatters.d.ts.map +1 -0
- package/build/cli/formatters.js +715 -0
- package/build/cli/formatters.js.map +1 -0
- package/build/cli/history-manager.d.ts +97 -0
- package/build/cli/history-manager.d.ts.map +1 -0
- package/build/cli/history-manager.js +201 -0
- package/build/cli/history-manager.js.map +1 -0
- package/build/cli/index.d.ts +16 -0
- package/build/cli/index.d.ts.map +1 -0
- package/build/cli/index.js +335 -0
- package/build/cli/index.js.map +1 -0
- package/build/cli/list-rulesets.d.ts +15 -0
- package/build/cli/list-rulesets.d.ts.map +1 -0
- package/build/cli/list-rulesets.js +193 -0
- package/build/cli/list-rulesets.js.map +1 -0
- package/build/cli/utils/connection-error.d.ts +9 -0
- package/build/cli/utils/connection-error.d.ts.map +1 -0
- package/build/cli/utils/connection-error.js +30 -0
- package/build/cli/utils/connection-error.js.map +1 -0
- package/build/cli/utils/embedded-server.d.ts +21 -0
- package/build/cli/utils/embedded-server.d.ts.map +1 -0
- package/build/cli/utils/embedded-server.js +61 -0
- package/build/cli/utils/embedded-server.js.map +1 -0
- package/build/cli/utils/mode-validator.d.ts +13 -0
- package/build/cli/utils/mode-validator.d.ts.map +1 -0
- package/build/cli/utils/mode-validator.js +31 -0
- package/build/cli/utils/mode-validator.js.map +1 -0
- package/build/cli/utils/port-checker.d.ts +20 -0
- package/build/cli/utils/port-checker.d.ts.map +1 -0
- package/build/cli/utils/port-checker.js +49 -0
- package/build/cli/utils/port-checker.js.map +1 -0
- package/build/config.d.ts +57 -0
- package/build/config.d.ts.map +1 -0
- package/build/config.js +527 -0
- package/build/config.js.map +1 -0
- package/build/document-accessor.d.ts +79 -0
- package/build/document-accessor.d.ts.map +1 -0
- package/build/document-accessor.js +148 -0
- package/build/document-accessor.js.map +1 -0
- package/build/formatters/reproduce-markdown.d.ts +14 -0
- package/build/formatters/reproduce-markdown.d.ts.map +1 -0
- package/build/formatters/reproduce-markdown.js +182 -0
- package/build/formatters/reproduce-markdown.js.map +1 -0
- package/build/formatters/sarif-builder.d.ts +86 -0
- package/build/formatters/sarif-builder.d.ts.map +1 -0
- package/build/formatters/sarif-builder.js +276 -0
- package/build/formatters/sarif-builder.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +174 -0
- package/build/index.js.map +1 -0
- package/build/logger.d.ts +38 -0
- package/build/logger.d.ts.map +1 -0
- package/build/logger.js +105 -0
- package/build/logger.js.map +1 -0
- package/build/mock-server.d.ts +2 -0
- package/build/mock-server.d.ts.map +1 -0
- package/build/mock-server.js +290 -0
- package/build/mock-server.js.map +1 -0
- package/build/orchestrator.d.ts +149 -0
- package/build/orchestrator.d.ts.map +1 -0
- package/build/orchestrator.js +874 -0
- package/build/orchestrator.js.map +1 -0
- package/build/ruleset-loader.d.ts +79 -0
- package/build/ruleset-loader.d.ts.map +1 -0
- package/build/ruleset-loader.js +514 -0
- package/build/ruleset-loader.js.map +1 -0
- package/build/schemas.d.ts +2568 -0
- package/build/schemas.d.ts.map +1 -0
- package/build/schemas.js +674 -0
- package/build/schemas.js.map +1 -0
- package/build/server.d.ts +39 -0
- package/build/server.d.ts.map +1 -0
- package/build/server.js +834 -0
- package/build/server.js.map +1 -0
- package/build/storage/memory-storage.d.ts +190 -0
- package/build/storage/memory-storage.d.ts.map +1 -0
- package/build/storage/memory-storage.js +629 -0
- package/build/storage/memory-storage.js.map +1 -0
- package/build/storage/redis-storage.d.ts +134 -0
- package/build/storage/redis-storage.d.ts.map +1 -0
- package/build/storage/redis-storage.js +236 -0
- package/build/storage/redis-storage.js.map +1 -0
- package/build/storage/storage-adapter.d.ts +189 -0
- package/build/storage/storage-adapter.d.ts.map +1 -0
- package/build/storage/storage-adapter.js +36 -0
- package/build/storage/storage-adapter.js.map +1 -0
- package/build/types.d.ts +981 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +5 -0
- package/build/types.js.map +1 -0
- package/build/utils/version.d.ts +40 -0
- package/build/utils/version.d.ts.map +1 -0
- package/build/utils/version.js +94 -0
- package/build/utils/version.js.map +1 -0
- package/build/validation.d.ts +95 -0
- package/build/validation.d.ts.map +1 -0
- package/build/validation.js +150 -0
- package/build/validation.js.map +1 -0
- package/build/worker-pool.d.ts +137 -0
- package/build/worker-pool.d.ts.map +1 -0
- package/build/worker-pool.js +549 -0
- package/build/worker-pool.js.map +1 -0
- package/build/worker.d.ts +2 -0
- package/build/worker.d.ts.map +1 -0
- package/build/worker.js +427 -0
- package/build/worker.js.map +1 -0
- package/package.json +110 -0
- package/rulesets/CHANGELOG.md +25 -0
- package/rulesets/config/rulesets.yaml +96 -0
- package/rulesets/sources/README.md +47 -0
- package/rulesets/sources/example/oas-recommended/v1.0.0/ruleset.yaml +6 -0
- package/rulesets/sources/example/oas-recommended/v2.0.0/ruleset.yaml +14 -0
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,981 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Complete TypeScript type definitions for OpenAPI Lint Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* @module types
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* orchestrator deployment mode
|
|
8
|
+
*/
|
|
9
|
+
export type SpectifyMode = 'standalone' | 'embedded' | 'companion' | 'mcp';
|
|
10
|
+
export interface OrchestratorConfig {
|
|
11
|
+
mode?: SpectifyMode;
|
|
12
|
+
server: {
|
|
13
|
+
port: number;
|
|
14
|
+
host: string;
|
|
15
|
+
maxDocumentSizeMB: number;
|
|
16
|
+
};
|
|
17
|
+
workerPool: WorkerPoolConfig;
|
|
18
|
+
rulesets: RulesetConfig;
|
|
19
|
+
storage: StorageConfig;
|
|
20
|
+
logging: LoggingConfig;
|
|
21
|
+
documentStore: DocumentStoreConfig;
|
|
22
|
+
reportService?: ReportServiceConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Custom $ref resolver module name (filename without .js extension)
|
|
25
|
+
* loaded from the `resolvers/` directory. Passed to every Spectral
|
|
26
|
+
* worker as `new Spectral({ resolver })`.
|
|
27
|
+
*
|
|
28
|
+
* Default: `"ignore-external-refs"` — ships with the repo, skips all
|
|
29
|
+
* HTTP/HTTPS external $ref resolution to prevent network timeouts.
|
|
30
|
+
*
|
|
31
|
+
* Set to empty string `""` to disable (use Spectral's built-in
|
|
32
|
+
* resolver that fetches all external references).
|
|
33
|
+
*
|
|
34
|
+
* Env override: `SPECTIFYD_RESOLVER`
|
|
35
|
+
*/
|
|
36
|
+
resolver?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Report Service configuration (optional)
|
|
40
|
+
* Enables sending job completion notifications to Report Service for persistent storage
|
|
41
|
+
*/
|
|
42
|
+
export interface ReportServiceConfig {
|
|
43
|
+
/** Enable/disable reporting (default: false) */
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
/** Report Service URL (e.g., 'http://localhost:3010') */
|
|
46
|
+
url: string;
|
|
47
|
+
/** API key for authentication (Bearer token) */
|
|
48
|
+
apiKey: string;
|
|
49
|
+
/** Request timeout in ms (default: 5000) */
|
|
50
|
+
timeout?: number;
|
|
51
|
+
/** Maximum retry attempts (default: 3) */
|
|
52
|
+
maxRetries?: number;
|
|
53
|
+
/** Base delay for exponential backoff in ms (default: 1000) */
|
|
54
|
+
baseRetryDelay?: number;
|
|
55
|
+
/** Directory for failed notifications (default: './pending-reports') */
|
|
56
|
+
pendingDir?: string;
|
|
57
|
+
/** orchestrator deployment mode for audit context (auto-detected or manual) */
|
|
58
|
+
mode?: SpectifyMode;
|
|
59
|
+
/** Enable background retry job (default: false in test, true in prod) */
|
|
60
|
+
enableRetryJob?: boolean;
|
|
61
|
+
/** Retry job interval in ms (default: 300000 = 5 minutes) */
|
|
62
|
+
retryJobInterval?: number;
|
|
63
|
+
/** Stop server startup if Report Service unavailable (default: false) */
|
|
64
|
+
stopIfUnavailable?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface WorkerPoolConfig {
|
|
67
|
+
minWorkersPerRuleset: number;
|
|
68
|
+
maxWorkersPerRuleset: number;
|
|
69
|
+
totalMaxWorkers: number;
|
|
70
|
+
taskTimeout: number;
|
|
71
|
+
maxRetries: number;
|
|
72
|
+
workerWaitTimeout: number;
|
|
73
|
+
scaleUpThreshold: number;
|
|
74
|
+
scaleDownThreshold: number;
|
|
75
|
+
exponentialBackoff: {
|
|
76
|
+
initialDelay: number;
|
|
77
|
+
maxDelay: number;
|
|
78
|
+
multiplier: number;
|
|
79
|
+
};
|
|
80
|
+
documentCache: {
|
|
81
|
+
enabled: boolean;
|
|
82
|
+
maxDocumentsPerWorker: number;
|
|
83
|
+
maxCacheSizePerWorker: number;
|
|
84
|
+
evictAfterMinutes: number;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export interface RulesetConfig {
|
|
88
|
+
directory: string;
|
|
89
|
+
defaultVersion: string;
|
|
90
|
+
cacheEnabled: boolean;
|
|
91
|
+
}
|
|
92
|
+
export interface StorageConfig {
|
|
93
|
+
type: 'memory' | 'redis' | 'custom';
|
|
94
|
+
connectionString?: string;
|
|
95
|
+
options?: Record<string, any>;
|
|
96
|
+
}
|
|
97
|
+
export interface LoggingConfig {
|
|
98
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
99
|
+
format: 'json' | 'text';
|
|
100
|
+
destination: 'console' | 'file' | 'both';
|
|
101
|
+
filePath?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface DocumentStoreConfig {
|
|
104
|
+
type: 'local' | 'passthrough' | 'filesystem' | 'http' | 'hybrid';
|
|
105
|
+
baseDir: string;
|
|
106
|
+
fallbackHttp?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Category classification for rulesets
|
|
110
|
+
*/
|
|
111
|
+
export type RulesetCategory = 'publishing' | 'contract' | 'security' | 'documentation' | 'validation' | 'other';
|
|
112
|
+
/**
|
|
113
|
+
* Origin classification for rulesets.
|
|
114
|
+
*
|
|
115
|
+
* Classifies *who controls the source files*. Drives both display
|
|
116
|
+
* (`spectify rulesets <name>`, `/rulesets` API) and toolchain behaviour
|
|
117
|
+
* (the catalogue template's `vendor.sh` / `validate.sh` / `install.sh`
|
|
118
|
+
* are origin-aware; the orchestrator loader treats `embedded` entries
|
|
119
|
+
* specially — see RulesetVersionConfig).
|
|
120
|
+
*
|
|
121
|
+
* Decision rule: *who wrote and ships these rules, and where do the
|
|
122
|
+
* files live?*
|
|
123
|
+
*
|
|
124
|
+
* 1. Bundled inside an npm package the consumer already installs
|
|
125
|
+
* (e.g. `spectral:oas` from `@stoplight/spectral-rulesets`)?
|
|
126
|
+
* → `embedded`.
|
|
127
|
+
* 2. Written by your team in a repo you control? → `internal`.
|
|
128
|
+
* 3. Anything else (public OSS, partner, vendor)? → `external`.
|
|
129
|
+
*
|
|
130
|
+
* - `embedded` — Rules bundled inside an npm package the consumer
|
|
131
|
+
* already depends on. No `sources/` tree is vendored;
|
|
132
|
+
* the loader resolves the entrypoint via a Spectral
|
|
133
|
+
* built-in token (`spectral:oas`, etc.). The effective
|
|
134
|
+
* version tracks the installed package and is surfaced
|
|
135
|
+
* at runtime as `resolvedVersion`.
|
|
136
|
+
* - `internal` — Rules authored and maintained by the team that owns
|
|
137
|
+
* this catalogue. Source repo is under your control.
|
|
138
|
+
* - `external` — Rules sourced from a repository you do **not** own
|
|
139
|
+
* (public OSS, partner, vendor). You vendor a snapshot
|
|
140
|
+
* for reproducibility.
|
|
141
|
+
*
|
|
142
|
+
* If an `embedded` ruleset needs to be pinned to a specific historical
|
|
143
|
+
* version, change the entry's origin to `external` and vendor the
|
|
144
|
+
* snapshot — mixing both models inside a single entry is not supported.
|
|
145
|
+
*/
|
|
146
|
+
export type RulesetOrigin = 'embedded' | 'internal' | 'external';
|
|
147
|
+
/**
|
|
148
|
+
* Configuration for a single ruleset (from rulesets/config/rulesets.yaml)
|
|
149
|
+
* Maps logical rulesets to source repositories
|
|
150
|
+
*/
|
|
151
|
+
export interface RulesetConfigEntry {
|
|
152
|
+
name: string;
|
|
153
|
+
displayName: string;
|
|
154
|
+
category: RulesetCategory;
|
|
155
|
+
origin: RulesetOrigin;
|
|
156
|
+
description: string;
|
|
157
|
+
tags: string[];
|
|
158
|
+
metadata: {
|
|
159
|
+
team: string;
|
|
160
|
+
/**
|
|
161
|
+
* Person, team, or organisation accountable for the ruleset.
|
|
162
|
+
* Free-form (e.g. "API Council", "Jane Doe <jane@acme.com>",
|
|
163
|
+
* "Stoplight"). Required even for `embedded` entries — names the
|
|
164
|
+
* upstream so consumers know who to contact.
|
|
165
|
+
*/
|
|
166
|
+
maintainer: string;
|
|
167
|
+
/** Optional URL or `mailto:` for reaching the maintainer (issues, mailing list). */
|
|
168
|
+
contact?: string;
|
|
169
|
+
repository: string;
|
|
170
|
+
license: string;
|
|
171
|
+
documentation?: string;
|
|
172
|
+
};
|
|
173
|
+
versions: RulesetVersionConfig[];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Configuration for a specific version of a ruleset
|
|
177
|
+
* Links Orchestrator version to source repository version
|
|
178
|
+
*
|
|
179
|
+
* Path resolution rules:
|
|
180
|
+
* - If the parent entry has `origin: embedded`, the loader bypasses
|
|
181
|
+
* `sources/` path construction and resolves `entrypoint` as a
|
|
182
|
+
* Spectral built-in token (e.g. `spectral:oas`). `sourceVersion`
|
|
183
|
+
* is optional; `sourceRepo` is informational. If `package` is
|
|
184
|
+
* set, the loader populates `resolvedVersion` from the installed
|
|
185
|
+
* npm package's `package.json` at runtime.
|
|
186
|
+
* - Else if `absolutePath` is set, the loader uses that path directly
|
|
187
|
+
* and `sourceRepo` / `sourceVersion` are optional.
|
|
188
|
+
* - Otherwise all three of `sourceRepo`, `sourceVersion`, and
|
|
189
|
+
* `entrypoint` must be present and are combined as:
|
|
190
|
+
* `sources/{sourceRepo}/{sourceVersion}/{entrypoint}`
|
|
191
|
+
*/
|
|
192
|
+
export interface RulesetVersionConfig {
|
|
193
|
+
version: string;
|
|
194
|
+
sourceRepo?: string;
|
|
195
|
+
sourceVersion?: string;
|
|
196
|
+
entrypoint: string;
|
|
197
|
+
/**
|
|
198
|
+
* ISO 8601 release date. Required for `internal` and `external`
|
|
199
|
+
* entries (pins the vendored snapshot to a known date). Not
|
|
200
|
+
* applicable for `origin: embedded` entries — the effective
|
|
201
|
+
* version of an embedded ruleset is determined by the installed npm
|
|
202
|
+
* package at runtime, not by the catalogue, so there is no
|
|
203
|
+
* catalogue-controlled release date to record.
|
|
204
|
+
*/
|
|
205
|
+
releaseDate?: string;
|
|
206
|
+
deprecated: boolean;
|
|
207
|
+
changelog?: string;
|
|
208
|
+
/**
|
|
209
|
+
* npm package providing the rules for `origin: embedded` entries.
|
|
210
|
+
* Used by the loader to read the installed package's `package.json`
|
|
211
|
+
* and populate `resolvedVersion`. Ignored for non-embedded entries.
|
|
212
|
+
*/
|
|
213
|
+
package?: string;
|
|
214
|
+
/**
|
|
215
|
+
* Runtime-populated. For `origin: embedded` entries, the version of
|
|
216
|
+
* the installed `package` at load time (e.g. "1.22.0"). Surfaced via
|
|
217
|
+
* `spectify rulesets <name>` and the /rulesets API. Never persisted
|
|
218
|
+
* to config; always derived at load time.
|
|
219
|
+
*/
|
|
220
|
+
resolvedVersion?: string;
|
|
221
|
+
/**
|
|
222
|
+
* When set, overrides the sourceRepo/sourceVersion/entrypoint path
|
|
223
|
+
* construction. The loader will load this path directly (resolved relative
|
|
224
|
+
* to cwd if not absolute). Useful for rulesets installed outside the
|
|
225
|
+
* sources/ tree (e.g. via OS package manager or a separate monorepo
|
|
226
|
+
* checkout).
|
|
227
|
+
*/
|
|
228
|
+
absolutePath?: string;
|
|
229
|
+
/**
|
|
230
|
+
* Which mechanism to use when loading the ruleset file.
|
|
231
|
+
*
|
|
232
|
+
* - `'bundler'` (default) — Spectral's Rollup-based
|
|
233
|
+
* `@stoplight/spectral-ruleset-bundler`. Handles YAML, ESM JS,
|
|
234
|
+
* `extends: 'spectral:oas'` token resolution, and named imports
|
|
235
|
+
* from CJS npm packages (via Rollup interop). The right choice
|
|
236
|
+
* for almost every ruleset.
|
|
237
|
+
*
|
|
238
|
+
* - `'native'` — Node's built-in `await import()`. Use when the
|
|
239
|
+
* entrypoint is a CommonJS dist file (typically Babel/`tsc`
|
|
240
|
+
* output of a TypeScript ruleset) that the bundler chokes on
|
|
241
|
+
* with `exports is not defined`. Only valid for `.js` / `.cjs`
|
|
242
|
+
* / `.mjs` entrypoints — not YAML, not `spectral:*` tokens.
|
|
243
|
+
*
|
|
244
|
+
* Ignored for `origin: embedded` entries (they always go through the
|
|
245
|
+
* bundler shim).
|
|
246
|
+
*/
|
|
247
|
+
loader?: 'bundler' | 'native';
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Master configuration file structure (rulesets/config/rulesets.yaml)
|
|
251
|
+
*/
|
|
252
|
+
export interface RulesetsConfig {
|
|
253
|
+
rulesets: RulesetConfigEntry[];
|
|
254
|
+
defaults: Record<string, string>;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* User-facing ruleset metadata (returned by API)
|
|
258
|
+
* Includes computed fields like ruleCount
|
|
259
|
+
*/
|
|
260
|
+
export interface RulesetMetadata {
|
|
261
|
+
name: string;
|
|
262
|
+
displayName: string;
|
|
263
|
+
category: RulesetCategory;
|
|
264
|
+
origin: RulesetOrigin;
|
|
265
|
+
description: string;
|
|
266
|
+
versions: string[];
|
|
267
|
+
defaultVersion: string;
|
|
268
|
+
ruleCount: number;
|
|
269
|
+
tags: string[];
|
|
270
|
+
metadata: {
|
|
271
|
+
team: string;
|
|
272
|
+
maintainer: string;
|
|
273
|
+
contact?: string;
|
|
274
|
+
repository: string;
|
|
275
|
+
license: string;
|
|
276
|
+
documentation?: string;
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* @deprecated Use RulesetVersionConfig instead
|
|
281
|
+
* Legacy interface, kept for backward compatibility
|
|
282
|
+
*/
|
|
283
|
+
export interface RulesetVersionInfo {
|
|
284
|
+
version: string;
|
|
285
|
+
releaseDate: string;
|
|
286
|
+
entrypoint: string;
|
|
287
|
+
deprecated?: boolean;
|
|
288
|
+
changelog?: string;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Loaded ruleset version with extracted rules
|
|
292
|
+
* Returned by RulesetLoader after parsing Spectral files
|
|
293
|
+
*/
|
|
294
|
+
export interface RulesetVersion {
|
|
295
|
+
metadata: RulesetMetadata;
|
|
296
|
+
version: string;
|
|
297
|
+
sourceRepo: string;
|
|
298
|
+
sourceVersion: string;
|
|
299
|
+
entrypoint: string;
|
|
300
|
+
rulesetPath: string;
|
|
301
|
+
releaseDate?: string;
|
|
302
|
+
deprecated: boolean;
|
|
303
|
+
changelog?: string;
|
|
304
|
+
rules: RuleDefinition[];
|
|
305
|
+
spectralRuleset: any;
|
|
306
|
+
/** For `origin: embedded`: the npm package providing the rules (e.g. `@stoplight/spectral-rulesets`). */
|
|
307
|
+
package?: string;
|
|
308
|
+
/** For `origin: embedded`: the installed version of `package` resolved at load time (e.g. `1.22.0`). */
|
|
309
|
+
resolvedVersion?: string;
|
|
310
|
+
/** Resolved loader (`bundler` | `native`). Mirrors `RulesetVersionConfig.loader`; defaulted to `'bundler'` at load time and threaded down to the worker. */
|
|
311
|
+
loader?: 'bundler' | 'native';
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Rule definition - scoped to ruleset
|
|
315
|
+
* Rules are uniquely identified by: {rulesetName}:{rulesetVersion}:{name}
|
|
316
|
+
*
|
|
317
|
+
* Design Decision: Rules are scoped to rulesets, not global entities.
|
|
318
|
+
* See docs/RULESET_MANAGEMENT.md "Rule Management Philosophy"
|
|
319
|
+
*/
|
|
320
|
+
export interface RuleDefinition {
|
|
321
|
+
name: string;
|
|
322
|
+
rulesetName: string;
|
|
323
|
+
rulesetVersion: string;
|
|
324
|
+
severity: RuleSeverity;
|
|
325
|
+
message: string;
|
|
326
|
+
description?: string;
|
|
327
|
+
given: string | string[];
|
|
328
|
+
then: any;
|
|
329
|
+
recommended?: boolean;
|
|
330
|
+
formats?: string[];
|
|
331
|
+
}
|
|
332
|
+
export type RuleEngine = 'spectral' | 'llm' | 'custom';
|
|
333
|
+
export type RuleSeverity = 'error' | 'warn' | 'info' | 'hint';
|
|
334
|
+
/**
|
|
335
|
+
* Rule override severity levels.
|
|
336
|
+
* 'off' disables the rule entirely; other values change its severity.
|
|
337
|
+
*/
|
|
338
|
+
export type RuleOverrideSeverity = 'off' | 'error' | 'warn' | 'info' | 'hint';
|
|
339
|
+
/**
|
|
340
|
+
* Map of rule IDs to override severity.
|
|
341
|
+
* Used to exclude rules or change their severity at lint-request time.
|
|
342
|
+
*/
|
|
343
|
+
export type RuleOverrides = Record<string, RuleOverrideSeverity>;
|
|
344
|
+
/**
|
|
345
|
+
* Source metadata for reproducing a lint job with native Spectral CLI.
|
|
346
|
+
* Contains everything needed to generate clone + install + run instructions.
|
|
347
|
+
*/
|
|
348
|
+
export interface RulesetSourceMetadata {
|
|
349
|
+
rulesetName: string;
|
|
350
|
+
displayName: string;
|
|
351
|
+
version: string;
|
|
352
|
+
repositoryUrl: string;
|
|
353
|
+
sourceRepo: string;
|
|
354
|
+
sourceVersion: string;
|
|
355
|
+
entrypoint: string;
|
|
356
|
+
hasPackageJson: boolean;
|
|
357
|
+
license: string;
|
|
358
|
+
}
|
|
359
|
+
export interface LintJobRequest {
|
|
360
|
+
documentId: string;
|
|
361
|
+
rulesetName: string;
|
|
362
|
+
rulesetVersion?: string;
|
|
363
|
+
callbackUrl?: string;
|
|
364
|
+
ruleOverrides?: RuleOverrides;
|
|
365
|
+
options?: {
|
|
366
|
+
forceRun?: boolean;
|
|
367
|
+
priority?: 'low' | 'normal' | 'high';
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
export interface LintJob {
|
|
371
|
+
jobId: string;
|
|
372
|
+
documentId: string;
|
|
373
|
+
rulesetName: string;
|
|
374
|
+
rulesetVersion: string;
|
|
375
|
+
callbackUrl?: string;
|
|
376
|
+
ruleOverrides?: RuleOverrides;
|
|
377
|
+
status: JobStatus;
|
|
378
|
+
progress: JobProgress;
|
|
379
|
+
startTime: Date;
|
|
380
|
+
endTime?: Date;
|
|
381
|
+
estimatedCompletion?: Date;
|
|
382
|
+
priority: 'low' | 'normal' | 'high';
|
|
383
|
+
tasks: RuleTask[];
|
|
384
|
+
}
|
|
385
|
+
export type JobStatus = 'queued' | 'running' | 'completed' | 'completed_with_errors' | 'failed' | 'timeout' | 'cancelled';
|
|
386
|
+
export interface JobProgress {
|
|
387
|
+
totalTasks: number;
|
|
388
|
+
completedTasks: number;
|
|
389
|
+
failedTasks: number;
|
|
390
|
+
timeoutTasks: number;
|
|
391
|
+
runningTasks: number;
|
|
392
|
+
queuedTasks: number;
|
|
393
|
+
}
|
|
394
|
+
export interface RuleTask {
|
|
395
|
+
taskId: string;
|
|
396
|
+
jobId: string;
|
|
397
|
+
documentId: string;
|
|
398
|
+
documentPath: string;
|
|
399
|
+
rulesetName: string;
|
|
400
|
+
rulesetVersion: string;
|
|
401
|
+
ruleOverrides?: RuleOverrides;
|
|
402
|
+
status: 'queued' | 'running' | 'completed' | 'failed' | 'timeout' | 'retry';
|
|
403
|
+
attempt: number;
|
|
404
|
+
maxAttempts: number;
|
|
405
|
+
assignedWorker?: string;
|
|
406
|
+
startTime?: Date;
|
|
407
|
+
endTime?: Date;
|
|
408
|
+
result?: RulesetExecutionResult;
|
|
409
|
+
error?: string;
|
|
410
|
+
}
|
|
411
|
+
export interface WorkerInfo {
|
|
412
|
+
workerId: string;
|
|
413
|
+
rulesetName: string;
|
|
414
|
+
rulesetVersion: string;
|
|
415
|
+
status: WorkerStatus;
|
|
416
|
+
taskCount: number;
|
|
417
|
+
averageExecutionTime: number;
|
|
418
|
+
lastHeartbeat: Date;
|
|
419
|
+
createdAt: Date;
|
|
420
|
+
cachedDocumentId?: string;
|
|
421
|
+
cachedAt?: Date;
|
|
422
|
+
}
|
|
423
|
+
export type WorkerStatus = 'initializing' | 'ready' | 'busy' | 'failed' | 'terminated';
|
|
424
|
+
export interface WorkerMessage {
|
|
425
|
+
type: 'init' | 'execute' | 'shutdown' | 'heartbeat' | 'evict-cache';
|
|
426
|
+
payload?: any;
|
|
427
|
+
}
|
|
428
|
+
export interface WorkerInitMessage extends WorkerMessage {
|
|
429
|
+
type: 'init';
|
|
430
|
+
payload: {
|
|
431
|
+
workerId: string;
|
|
432
|
+
rulesetName: string;
|
|
433
|
+
rulesetVersion: string;
|
|
434
|
+
rulesetPath: string;
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
export interface WorkerExecuteMessage extends WorkerMessage {
|
|
438
|
+
type: 'execute';
|
|
439
|
+
payload: {
|
|
440
|
+
taskId: string;
|
|
441
|
+
documentId: string;
|
|
442
|
+
documentPath: string;
|
|
443
|
+
timeout: number;
|
|
444
|
+
ruleOverrides?: RuleOverrides;
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
export interface WorkerResponse {
|
|
448
|
+
type: 'ready' | 'result' | 'error' | 'heartbeat' | 'cache-evicted';
|
|
449
|
+
taskId?: string;
|
|
450
|
+
success?: boolean;
|
|
451
|
+
executionTime?: number;
|
|
452
|
+
error?: string;
|
|
453
|
+
result?: RulesetExecutionResult;
|
|
454
|
+
cacheHit?: boolean;
|
|
455
|
+
}
|
|
456
|
+
export interface RulesetExecutionResult {
|
|
457
|
+
rulesetName: string;
|
|
458
|
+
rulesetVersion: string;
|
|
459
|
+
executionTime: number;
|
|
460
|
+
success: boolean;
|
|
461
|
+
error?: string;
|
|
462
|
+
issueCount: number;
|
|
463
|
+
issues: LintIssue[];
|
|
464
|
+
metadata: {
|
|
465
|
+
ruleEngine: string;
|
|
466
|
+
documentId: string;
|
|
467
|
+
cacheHit?: boolean;
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
export interface LintIssue {
|
|
471
|
+
ruleId: string;
|
|
472
|
+
code: string;
|
|
473
|
+
message: string;
|
|
474
|
+
severity: 0 | 1 | 2 | 3;
|
|
475
|
+
path: (string | number)[];
|
|
476
|
+
range?: {
|
|
477
|
+
start: {
|
|
478
|
+
line: number;
|
|
479
|
+
character: number;
|
|
480
|
+
};
|
|
481
|
+
end: {
|
|
482
|
+
line: number;
|
|
483
|
+
character: number;
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
suggestions?: string[];
|
|
487
|
+
}
|
|
488
|
+
export interface LintJobResult {
|
|
489
|
+
jobId: string;
|
|
490
|
+
documentId: string;
|
|
491
|
+
rulesetName: string;
|
|
492
|
+
rulesetVersion: string;
|
|
493
|
+
ruleOverrides?: RuleOverrides;
|
|
494
|
+
status: JobStatus;
|
|
495
|
+
timestamp: Date;
|
|
496
|
+
totalExecutionTime: number;
|
|
497
|
+
summary: {
|
|
498
|
+
totalIssues: number;
|
|
499
|
+
errorCount: number;
|
|
500
|
+
warningCount: number;
|
|
501
|
+
infoCount: number;
|
|
502
|
+
hintCount: number;
|
|
503
|
+
};
|
|
504
|
+
results: LintIssue[];
|
|
505
|
+
executionDetails: RulesetExecutionResult;
|
|
506
|
+
/** Set when maxIssuesPerJob limit was reached during linting */
|
|
507
|
+
truncated?: boolean;
|
|
508
|
+
truncationInfo?: {
|
|
509
|
+
limit: number;
|
|
510
|
+
actualCount: number;
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Options for querying lint results with pagination and filtering
|
|
515
|
+
*/
|
|
516
|
+
export interface LintResultQueryOptions {
|
|
517
|
+
/** Skip first N issues (default: 0) */
|
|
518
|
+
offset?: number;
|
|
519
|
+
/** Max issues to return (default: all) */
|
|
520
|
+
limit?: number;
|
|
521
|
+
/** Filter by severity: 0=error, 1=warn, 2=info, 3=hint */
|
|
522
|
+
severity?: number;
|
|
523
|
+
/** Filter by rule ID (exact match) */
|
|
524
|
+
rule?: string;
|
|
525
|
+
/** Filter by path prefix (dot-separated, e.g. "paths./pets") */
|
|
526
|
+
pathPrefix?: string;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Paginated lint result response from orchestrator API
|
|
530
|
+
*/
|
|
531
|
+
export interface PaginatedLintResult {
|
|
532
|
+
jobId: string;
|
|
533
|
+
documentId: string;
|
|
534
|
+
rulesetName: string;
|
|
535
|
+
rulesetVersion: string;
|
|
536
|
+
status: JobStatus;
|
|
537
|
+
timestamp: Date;
|
|
538
|
+
totalExecutionTime: number;
|
|
539
|
+
/** Always the full job summary, regardless of filters */
|
|
540
|
+
summary: {
|
|
541
|
+
totalIssues: number;
|
|
542
|
+
errorCount: number;
|
|
543
|
+
warningCount: number;
|
|
544
|
+
infoCount: number;
|
|
545
|
+
hintCount: number;
|
|
546
|
+
};
|
|
547
|
+
/** The (possibly filtered and paginated) issues */
|
|
548
|
+
results: LintIssue[];
|
|
549
|
+
/** Pagination metadata — present when offset or limit is used */
|
|
550
|
+
pagination?: {
|
|
551
|
+
offset: number;
|
|
552
|
+
limit: number;
|
|
553
|
+
returned: number;
|
|
554
|
+
totalMatching: number;
|
|
555
|
+
hasMore: boolean;
|
|
556
|
+
};
|
|
557
|
+
/** Active filters — present when severity, rule, or pathPrefix is used */
|
|
558
|
+
filters?: {
|
|
559
|
+
severity: number | null;
|
|
560
|
+
rule: string | null;
|
|
561
|
+
pathPrefix: string | null;
|
|
562
|
+
};
|
|
563
|
+
/** Truncation info — present when maxIssuesPerJob limit was hit */
|
|
564
|
+
truncated?: boolean;
|
|
565
|
+
truncationInfo?: {
|
|
566
|
+
limit: number;
|
|
567
|
+
actualCount: number;
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Rule breakdown entry for lint result statistics
|
|
572
|
+
*/
|
|
573
|
+
export interface RuleBreakdownEntry {
|
|
574
|
+
rule: string;
|
|
575
|
+
count: number;
|
|
576
|
+
severity: 0 | 1 | 2 | 3;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Aggregated statistics for a lint job result
|
|
580
|
+
*/
|
|
581
|
+
export interface LintResultStats {
|
|
582
|
+
jobId: string;
|
|
583
|
+
documentId: string;
|
|
584
|
+
rulesetName: string;
|
|
585
|
+
rulesetVersion: string;
|
|
586
|
+
status: JobStatus;
|
|
587
|
+
summary: {
|
|
588
|
+
totalIssues: number;
|
|
589
|
+
errorCount: number;
|
|
590
|
+
warningCount: number;
|
|
591
|
+
infoCount: number;
|
|
592
|
+
hintCount: number;
|
|
593
|
+
};
|
|
594
|
+
/** Issue counts grouped by rule ID, sorted by count descending */
|
|
595
|
+
ruleBreakdown: RuleBreakdownEntry[];
|
|
596
|
+
/** Top path prefixes with most issues */
|
|
597
|
+
topPaths: {
|
|
598
|
+
pathPrefix: string;
|
|
599
|
+
count: number;
|
|
600
|
+
}[];
|
|
601
|
+
/** Truncation info if result was truncated */
|
|
602
|
+
truncated?: boolean;
|
|
603
|
+
truncationInfo?: {
|
|
604
|
+
limit: number;
|
|
605
|
+
actualCount: number;
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
export interface LintResultStorage {
|
|
609
|
+
/**
|
|
610
|
+
* Store complete job result
|
|
611
|
+
*/
|
|
612
|
+
storeJob(result: LintJobResult): Promise<void>;
|
|
613
|
+
/**
|
|
614
|
+
* Retrieve job result by job ID
|
|
615
|
+
*/
|
|
616
|
+
retrieveJobById(jobId: string): Promise<LintJobResult | null>;
|
|
617
|
+
/**
|
|
618
|
+
* Retrieve job result by document + ruleset
|
|
619
|
+
*/
|
|
620
|
+
retrieveJob(documentId: string, rulesetName: string, rulesetVersion: string): Promise<LintJobResult | null>;
|
|
621
|
+
/**
|
|
622
|
+
* Check if cached results exist
|
|
623
|
+
*/
|
|
624
|
+
exists(documentId: string, rulesetName: string, rulesetVersion: string): Promise<boolean>;
|
|
625
|
+
/**
|
|
626
|
+
* Invalidate all results for a document
|
|
627
|
+
*/
|
|
628
|
+
invalidate(documentId: string): Promise<void>;
|
|
629
|
+
/**
|
|
630
|
+
* Get storage statistics
|
|
631
|
+
*/
|
|
632
|
+
getStats(): Promise<{
|
|
633
|
+
totalJobs: number;
|
|
634
|
+
totalResults: number;
|
|
635
|
+
storageSize?: number;
|
|
636
|
+
}>;
|
|
637
|
+
}
|
|
638
|
+
export interface IWorkerPoolManager {
|
|
639
|
+
/**
|
|
640
|
+
* Initialize the worker pool
|
|
641
|
+
*/
|
|
642
|
+
initialize(config: WorkerPoolConfig): Promise<void>;
|
|
643
|
+
/**
|
|
644
|
+
* Get or create worker for specific ruleset
|
|
645
|
+
*/
|
|
646
|
+
getWorkerForRuleset(rulesetName: string, rulesetVersion: string, ruleset: RulesetVersion): Promise<string>;
|
|
647
|
+
/**
|
|
648
|
+
* Assign task to worker with document affinity
|
|
649
|
+
*/
|
|
650
|
+
assignTask(task: RuleTask): Promise<void>;
|
|
651
|
+
/**
|
|
652
|
+
* Get workers that have a specific document cached
|
|
653
|
+
*/
|
|
654
|
+
getWorkersWithDocument(documentId: string): WorkerInfo[];
|
|
655
|
+
/**
|
|
656
|
+
* Update document cache tracking
|
|
657
|
+
*/
|
|
658
|
+
updateDocumentCache(workerId: string, documentId: string): void;
|
|
659
|
+
/**
|
|
660
|
+
* Get pool status
|
|
661
|
+
*/
|
|
662
|
+
getStatus(): {
|
|
663
|
+
activeWorkers: number;
|
|
664
|
+
idleWorkers: number;
|
|
665
|
+
busyWorkers: number;
|
|
666
|
+
totalWorkers: number;
|
|
667
|
+
workersByRuleset: Record<string, number>;
|
|
668
|
+
};
|
|
669
|
+
/**
|
|
670
|
+
* Shutdown all workers
|
|
671
|
+
*/
|
|
672
|
+
shutdown(): Promise<void>;
|
|
673
|
+
}
|
|
674
|
+
export interface IDocumentAccessor {
|
|
675
|
+
/**
|
|
676
|
+
* Get the file path for a document
|
|
677
|
+
*/
|
|
678
|
+
getDocumentPath(documentId: string): string;
|
|
679
|
+
/**
|
|
680
|
+
* Check if document exists
|
|
681
|
+
*/
|
|
682
|
+
exists(documentId: string): Promise<boolean>;
|
|
683
|
+
/**
|
|
684
|
+
* Get document content (for fallback scenarios)
|
|
685
|
+
*/
|
|
686
|
+
getDocumentContent(documentId: string): Promise<any>;
|
|
687
|
+
}
|
|
688
|
+
export interface IOrchestrator {
|
|
689
|
+
/**
|
|
690
|
+
* Submit a new lint job
|
|
691
|
+
*/
|
|
692
|
+
submitJob(request: LintJobRequest): Promise<string>;
|
|
693
|
+
/**
|
|
694
|
+
* Get job status
|
|
695
|
+
*/
|
|
696
|
+
getJobStatus(jobId: string): Promise<LintJob | null>;
|
|
697
|
+
/**
|
|
698
|
+
* Get job results
|
|
699
|
+
*/
|
|
700
|
+
getJobResults(jobId: string): Promise<LintJobResult | null>;
|
|
701
|
+
/**
|
|
702
|
+
* Cancel a job
|
|
703
|
+
*/
|
|
704
|
+
cancelJob(jobId: string): Promise<void>;
|
|
705
|
+
}
|
|
706
|
+
export interface IRulesetLoader {
|
|
707
|
+
/**
|
|
708
|
+
* Initialize ruleset loader
|
|
709
|
+
*/
|
|
710
|
+
initialize(): Promise<void>;
|
|
711
|
+
/**
|
|
712
|
+
* Load ruleset metadata
|
|
713
|
+
*/
|
|
714
|
+
loadRuleset(name: string): Promise<RulesetMetadata>;
|
|
715
|
+
/**
|
|
716
|
+
* Load specific version of ruleset
|
|
717
|
+
*/
|
|
718
|
+
loadVersion(name: string, version?: string): Promise<RulesetVersion>;
|
|
719
|
+
/**
|
|
720
|
+
* Get all available rulesets
|
|
721
|
+
*/
|
|
722
|
+
listRulesets(): Promise<RulesetMetadata[]>;
|
|
723
|
+
/**
|
|
724
|
+
* Get default version for a ruleset
|
|
725
|
+
*/
|
|
726
|
+
getDefaultVersion(name: string): Promise<string>;
|
|
727
|
+
}
|
|
728
|
+
export interface HealthCheckResponse {
|
|
729
|
+
status: 'healthy' | 'degraded' | 'unhealthy';
|
|
730
|
+
timestamp: string;
|
|
731
|
+
version: string;
|
|
732
|
+
workerPool: {
|
|
733
|
+
activeWorkers: number;
|
|
734
|
+
maxWorkers: number;
|
|
735
|
+
idleWorkers: number;
|
|
736
|
+
busyWorkers: number;
|
|
737
|
+
queueDepth: number;
|
|
738
|
+
};
|
|
739
|
+
storage: {
|
|
740
|
+
connected: boolean;
|
|
741
|
+
type: string;
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
export interface LintJobResponse {
|
|
745
|
+
jobId: string;
|
|
746
|
+
status: JobStatus;
|
|
747
|
+
estimatedCompletion?: string;
|
|
748
|
+
message: string;
|
|
749
|
+
}
|
|
750
|
+
export interface JobStatusResponse {
|
|
751
|
+
jobId: string;
|
|
752
|
+
documentId: string;
|
|
753
|
+
rulesetName: string;
|
|
754
|
+
rulesetVersion: string;
|
|
755
|
+
status: JobStatus;
|
|
756
|
+
progress: JobProgress;
|
|
757
|
+
startTime: string;
|
|
758
|
+
endTime?: string;
|
|
759
|
+
estimatedCompletion?: string;
|
|
760
|
+
}
|
|
761
|
+
export interface JobResultsResponse extends LintJobResult {
|
|
762
|
+
}
|
|
763
|
+
export interface RulesetsListResponse {
|
|
764
|
+
rulesets: RulesetMetadata[];
|
|
765
|
+
}
|
|
766
|
+
export interface RulesetDetailsResponse extends RulesetVersion {
|
|
767
|
+
}
|
|
768
|
+
export interface ErrorResponse {
|
|
769
|
+
error: string;
|
|
770
|
+
details?: Record<string, any>;
|
|
771
|
+
timestamp: string;
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* SARIF Report (top-level structure)
|
|
775
|
+
* Spec: https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html
|
|
776
|
+
*/
|
|
777
|
+
export interface SarifReport {
|
|
778
|
+
$schema: 'https://json.schemastore.org/sarif-2.1.0.json';
|
|
779
|
+
version: '2.1.0';
|
|
780
|
+
runs: SarifRun[];
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* SARIF Run - represents one execution of an analysis tool
|
|
784
|
+
*/
|
|
785
|
+
export interface SarifRun {
|
|
786
|
+
tool: SarifTool;
|
|
787
|
+
artifacts?: SarifArtifact[];
|
|
788
|
+
results: SarifResult[];
|
|
789
|
+
properties?: Record<string, any>;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* SARIF Tool - analysis tool metadata
|
|
793
|
+
*/
|
|
794
|
+
export interface SarifTool {
|
|
795
|
+
driver: SarifToolDriver;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* SARIF Tool Driver - analysis tool details
|
|
799
|
+
*/
|
|
800
|
+
export interface SarifToolDriver {
|
|
801
|
+
name: string;
|
|
802
|
+
version?: string;
|
|
803
|
+
informationUri?: string;
|
|
804
|
+
rules?: SarifRule[];
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* SARIF Rule - rule catalog entry
|
|
808
|
+
*/
|
|
809
|
+
export interface SarifRule {
|
|
810
|
+
id: string;
|
|
811
|
+
name?: string;
|
|
812
|
+
shortDescription?: SarifMessage;
|
|
813
|
+
fullDescription?: SarifMessage;
|
|
814
|
+
defaultConfiguration?: SarifRuleConfiguration;
|
|
815
|
+
helpUri?: string;
|
|
816
|
+
properties?: Record<string, any>;
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* SARIF Rule Configuration
|
|
820
|
+
*/
|
|
821
|
+
export interface SarifRuleConfiguration {
|
|
822
|
+
level?: SarifLevel;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* SARIF Message
|
|
826
|
+
*/
|
|
827
|
+
export interface SarifMessage {
|
|
828
|
+
text: string;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* SARIF Result - a single finding/issue
|
|
832
|
+
*/
|
|
833
|
+
export interface SarifResult {
|
|
834
|
+
ruleId: string;
|
|
835
|
+
level: SarifLevel;
|
|
836
|
+
message: SarifMessage;
|
|
837
|
+
locations?: SarifLocation[];
|
|
838
|
+
fingerprints?: Record<string, string>;
|
|
839
|
+
properties?: Record<string, any>;
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* SARIF Level (severity)
|
|
843
|
+
*/
|
|
844
|
+
export type SarifLevel = 'error' | 'warning' | 'note' | 'none';
|
|
845
|
+
/**
|
|
846
|
+
* SARIF Location
|
|
847
|
+
*/
|
|
848
|
+
export interface SarifLocation {
|
|
849
|
+
physicalLocation?: SarifPhysicalLocation;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* SARIF Physical Location
|
|
853
|
+
*/
|
|
854
|
+
export interface SarifPhysicalLocation {
|
|
855
|
+
artifactLocation: SarifArtifactLocation;
|
|
856
|
+
region?: SarifRegion;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* SARIF Artifact Location
|
|
860
|
+
*/
|
|
861
|
+
export interface SarifArtifactLocation {
|
|
862
|
+
uri: string;
|
|
863
|
+
index?: number;
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* SARIF Region (line/column range)
|
|
867
|
+
*/
|
|
868
|
+
export interface SarifRegion {
|
|
869
|
+
startLine?: number;
|
|
870
|
+
startColumn?: number;
|
|
871
|
+
endLine?: number;
|
|
872
|
+
endColumn?: number;
|
|
873
|
+
snippet?: SarifArtifactContent;
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* SARIF Artifact Content (code snippet)
|
|
877
|
+
*/
|
|
878
|
+
export interface SarifArtifactContent {
|
|
879
|
+
text: string;
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* SARIF Artifact - file metadata
|
|
883
|
+
*/
|
|
884
|
+
export interface SarifArtifact {
|
|
885
|
+
location: SarifArtifactLocation;
|
|
886
|
+
properties?: Record<string, any>;
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Report generation request
|
|
890
|
+
*/
|
|
891
|
+
export interface ReportGenerationRequest {
|
|
892
|
+
format: 'sarif';
|
|
893
|
+
options?: ReportGenerationOptions;
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Report generation options
|
|
897
|
+
*/
|
|
898
|
+
export interface ReportGenerationOptions {
|
|
899
|
+
includeSnippets?: boolean;
|
|
900
|
+
fingerprintSchemes?: string[];
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Options for listing jobs
|
|
904
|
+
*/
|
|
905
|
+
export interface ListJobsOptions {
|
|
906
|
+
status?: JobStatus | JobStatus[];
|
|
907
|
+
documentId?: string;
|
|
908
|
+
rulesetName?: string;
|
|
909
|
+
startDate?: Date;
|
|
910
|
+
endDate?: Date;
|
|
911
|
+
sessionId?: string;
|
|
912
|
+
limit?: number;
|
|
913
|
+
offset?: number;
|
|
914
|
+
sortBy?: 'timestamp' | 'status' | 'documentId' | 'rulesetName';
|
|
915
|
+
sortOrder?: 'asc' | 'desc';
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Lightweight job summary (without document metadata)
|
|
919
|
+
*/
|
|
920
|
+
export interface JobSummary {
|
|
921
|
+
jobId: string;
|
|
922
|
+
documentId: string;
|
|
923
|
+
rulesetName: string;
|
|
924
|
+
rulesetVersion: string;
|
|
925
|
+
status: JobStatus;
|
|
926
|
+
timestamp: Date;
|
|
927
|
+
totalExecutionTime?: number;
|
|
928
|
+
summary: {
|
|
929
|
+
totalIssues: number;
|
|
930
|
+
errorCount: number;
|
|
931
|
+
warningCount: number;
|
|
932
|
+
infoCount: number;
|
|
933
|
+
hintCount: number;
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Job summary with enriched document metadata
|
|
938
|
+
*/
|
|
939
|
+
export interface JobDetailed extends JobSummary {
|
|
940
|
+
document: DocumentMetadata;
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* Document metadata from document store
|
|
944
|
+
*/
|
|
945
|
+
export interface DocumentMetadata {
|
|
946
|
+
documentId: string;
|
|
947
|
+
name: string;
|
|
948
|
+
version?: string;
|
|
949
|
+
organization?: string;
|
|
950
|
+
tags?: string[];
|
|
951
|
+
format?: 'json' | 'yaml';
|
|
952
|
+
operationCount?: number;
|
|
953
|
+
uploadedAt?: Date;
|
|
954
|
+
updatedAt?: Date;
|
|
955
|
+
uploadedBy?: string;
|
|
956
|
+
size?: number;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Paginated response for job listing
|
|
960
|
+
*/
|
|
961
|
+
export interface ListJobsResponse {
|
|
962
|
+
jobs: JobSummary[] | JobDetailed[];
|
|
963
|
+
pagination: {
|
|
964
|
+
total: number;
|
|
965
|
+
limit: number;
|
|
966
|
+
offset: number;
|
|
967
|
+
hasMore: boolean;
|
|
968
|
+
};
|
|
969
|
+
sessionId: string;
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Document lint activity summary
|
|
973
|
+
*/
|
|
974
|
+
export interface DocumentLintActivity {
|
|
975
|
+
documentId: string;
|
|
976
|
+
totalJobs: number;
|
|
977
|
+
lastLintedAt?: Date;
|
|
978
|
+
jobsByStatus: Record<JobStatus, number>;
|
|
979
|
+
jobsByRuleset: Record<string, number>;
|
|
980
|
+
}
|
|
981
|
+
//# sourceMappingURL=types.d.ts.map
|