@subhamxcod/apiguard 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -3
- package/dist/{chunk-RQVNHPHC.js → chunk-EJQ5XOY6.js} +1012 -16
- package/dist/cli/main.cjs +1127 -26
- package/dist/cli/main.js +118 -9
- package/dist/index.cjs +171 -168
- package/dist/index.d.cts +54 -2
- package/dist/index.d.ts +54 -2
- package/dist/index.js +9 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -12,7 +12,7 @@ interface ResolvedConfig {
|
|
|
12
12
|
showIgnored: boolean;
|
|
13
13
|
};
|
|
14
14
|
output: {
|
|
15
|
-
format: 'terminal' | 'json' | 'markdown';
|
|
15
|
+
format: 'terminal' | 'json' | 'markdown' | 'html' | 'sarif';
|
|
16
16
|
includeNonBreaking: boolean;
|
|
17
17
|
color: 'auto' | 'always' | 'never';
|
|
18
18
|
};
|
|
@@ -20,8 +20,12 @@ interface ResolvedConfig {
|
|
|
20
20
|
versioning: {
|
|
21
21
|
suggest: boolean;
|
|
22
22
|
};
|
|
23
|
+
profile: 'default' | 'strict-sdk' | 'loose-web';
|
|
23
24
|
loader: {
|
|
24
25
|
allowRemoteRefs: boolean;
|
|
26
|
+
allowExternalFiles: boolean;
|
|
27
|
+
allowPrivateIps: boolean;
|
|
28
|
+
headers: Record<string, string>;
|
|
25
29
|
};
|
|
26
30
|
github: {
|
|
27
31
|
comment: boolean;
|
|
@@ -55,6 +59,12 @@ interface ChangeLocation {
|
|
|
55
59
|
componentName?: string;
|
|
56
60
|
/** Component rules: number of operation usages found. */
|
|
57
61
|
usageCount?: number;
|
|
62
|
+
/** Source file path where change is located (when source mapping is available). */
|
|
63
|
+
file?: string;
|
|
64
|
+
/** 1-based source line number. */
|
|
65
|
+
line?: number;
|
|
66
|
+
/** 1-based source column number. */
|
|
67
|
+
column?: number;
|
|
58
68
|
}
|
|
59
69
|
interface ApiChange {
|
|
60
70
|
/** stable id = sha256(...).slice(0,16) per spec §12. */
|
|
@@ -152,6 +162,8 @@ interface LoadedSpec {
|
|
|
152
162
|
title: string;
|
|
153
163
|
/** sha256 hex digest of the normalized document bytes. */
|
|
154
164
|
sha256: string;
|
|
165
|
+
/** Unparsed raw text for source-mapping line/column numbers. */
|
|
166
|
+
rawText?: string;
|
|
155
167
|
}
|
|
156
168
|
/** Internal representation of a normalized spec used by the diff engine. */
|
|
157
169
|
interface NormalizedSpec extends LoadedSpec {
|
|
@@ -186,6 +198,46 @@ declare function discoverAndLoadConfig(opts?: {
|
|
|
186
198
|
*/
|
|
187
199
|
declare function suggestVersion(changes: ApiChange[]): SemverAdvice;
|
|
188
200
|
|
|
201
|
+
/**
|
|
202
|
+
* HTML reporter for API Guard.
|
|
203
|
+
* Generates an interactive, zero-dependency, single-file HTML report.
|
|
204
|
+
* Conforms strictly to the Hallmark Anti-AI-Slop design floor.
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
/** Render a standalone, interactive HTML dashboard. */
|
|
208
|
+
declare function renderHtml(report: DiffReport): string;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* SARIF 2.1.0 reporter for GitHub Advanced Security / Code Scanning integration.
|
|
212
|
+
* Conforms to OASIS SARIF v2.1.0 specification.
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
/** Render a DiffReport into a SARIF 2.1.0 JSON document. */
|
|
216
|
+
declare function renderSarif(report: DiffReport): string;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Automated API Changelog generator.
|
|
220
|
+
* Produces structured release notes in Keep-a-Changelog Markdown format.
|
|
221
|
+
*/
|
|
222
|
+
|
|
223
|
+
/** Render a DiffReport into Keep-a-Changelog Markdown format. */
|
|
224
|
+
declare function renderChangelog(report: DiffReport): string;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Backward-Compatibility Gateway Shim Generator.
|
|
228
|
+
* Synthesizes edge workers and API gateway middleware to maintain
|
|
229
|
+
* backward compatibility for legacy clients during breaking changes.
|
|
230
|
+
*/
|
|
231
|
+
|
|
232
|
+
type ShimTarget = 'express' | 'cloudflare-worker' | 'envoy-lua';
|
|
233
|
+
interface ShimGenerationResult {
|
|
234
|
+
target: ShimTarget;
|
|
235
|
+
code: string;
|
|
236
|
+
handledChanges: number;
|
|
237
|
+
}
|
|
238
|
+
/** Generate backward compatibility gateway adapter for breaking API changes. */
|
|
239
|
+
declare function generateGatewayShim(report: DiffReport, target?: ShimTarget): ShimGenerationResult;
|
|
240
|
+
|
|
189
241
|
/** Public library API per spec §18. Pure; no stdout; no process.exit. */
|
|
190
242
|
|
|
191
243
|
/**
|
|
@@ -201,4 +253,4 @@ declare function validateSpec(specPath: string, options?: {
|
|
|
201
253
|
validation: ValidationResult;
|
|
202
254
|
}>;
|
|
203
255
|
|
|
204
|
-
export { type AnalyzeOptions, type AnalyzeResult, type ApiChange, type ChangeKind, type ChangeLocation, type Context, type DiffReport, type DiffSummary, type LoadedConfig, type LoadedSpec, type NormalizedSpec, type ResolvedConfig, type SemverAdvice, type Severity, type SpecMeta, type ValidationIssue, type ValidationResult, analyze, discoverAndLoadConfig, loadConfigFrom, suggestVersion, validateSpec };
|
|
256
|
+
export { type AnalyzeOptions, type AnalyzeResult, type ApiChange, type ChangeKind, type ChangeLocation, type Context, type DiffReport, type DiffSummary, type LoadedConfig, type LoadedSpec, type NormalizedSpec, type ResolvedConfig, type SemverAdvice, type Severity, type ShimGenerationResult, type ShimTarget, type SpecMeta, type ValidationIssue, type ValidationResult, analyze, discoverAndLoadConfig, generateGatewayShim, loadConfigFrom, renderChangelog, renderHtml, renderSarif, suggestVersion, validateSpec };
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ interface ResolvedConfig {
|
|
|
12
12
|
showIgnored: boolean;
|
|
13
13
|
};
|
|
14
14
|
output: {
|
|
15
|
-
format: 'terminal' | 'json' | 'markdown';
|
|
15
|
+
format: 'terminal' | 'json' | 'markdown' | 'html' | 'sarif';
|
|
16
16
|
includeNonBreaking: boolean;
|
|
17
17
|
color: 'auto' | 'always' | 'never';
|
|
18
18
|
};
|
|
@@ -20,8 +20,12 @@ interface ResolvedConfig {
|
|
|
20
20
|
versioning: {
|
|
21
21
|
suggest: boolean;
|
|
22
22
|
};
|
|
23
|
+
profile: 'default' | 'strict-sdk' | 'loose-web';
|
|
23
24
|
loader: {
|
|
24
25
|
allowRemoteRefs: boolean;
|
|
26
|
+
allowExternalFiles: boolean;
|
|
27
|
+
allowPrivateIps: boolean;
|
|
28
|
+
headers: Record<string, string>;
|
|
25
29
|
};
|
|
26
30
|
github: {
|
|
27
31
|
comment: boolean;
|
|
@@ -55,6 +59,12 @@ interface ChangeLocation {
|
|
|
55
59
|
componentName?: string;
|
|
56
60
|
/** Component rules: number of operation usages found. */
|
|
57
61
|
usageCount?: number;
|
|
62
|
+
/** Source file path where change is located (when source mapping is available). */
|
|
63
|
+
file?: string;
|
|
64
|
+
/** 1-based source line number. */
|
|
65
|
+
line?: number;
|
|
66
|
+
/** 1-based source column number. */
|
|
67
|
+
column?: number;
|
|
58
68
|
}
|
|
59
69
|
interface ApiChange {
|
|
60
70
|
/** stable id = sha256(...).slice(0,16) per spec §12. */
|
|
@@ -152,6 +162,8 @@ interface LoadedSpec {
|
|
|
152
162
|
title: string;
|
|
153
163
|
/** sha256 hex digest of the normalized document bytes. */
|
|
154
164
|
sha256: string;
|
|
165
|
+
/** Unparsed raw text for source-mapping line/column numbers. */
|
|
166
|
+
rawText?: string;
|
|
155
167
|
}
|
|
156
168
|
/** Internal representation of a normalized spec used by the diff engine. */
|
|
157
169
|
interface NormalizedSpec extends LoadedSpec {
|
|
@@ -186,6 +198,46 @@ declare function discoverAndLoadConfig(opts?: {
|
|
|
186
198
|
*/
|
|
187
199
|
declare function suggestVersion(changes: ApiChange[]): SemverAdvice;
|
|
188
200
|
|
|
201
|
+
/**
|
|
202
|
+
* HTML reporter for API Guard.
|
|
203
|
+
* Generates an interactive, zero-dependency, single-file HTML report.
|
|
204
|
+
* Conforms strictly to the Hallmark Anti-AI-Slop design floor.
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
/** Render a standalone, interactive HTML dashboard. */
|
|
208
|
+
declare function renderHtml(report: DiffReport): string;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* SARIF 2.1.0 reporter for GitHub Advanced Security / Code Scanning integration.
|
|
212
|
+
* Conforms to OASIS SARIF v2.1.0 specification.
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
/** Render a DiffReport into a SARIF 2.1.0 JSON document. */
|
|
216
|
+
declare function renderSarif(report: DiffReport): string;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Automated API Changelog generator.
|
|
220
|
+
* Produces structured release notes in Keep-a-Changelog Markdown format.
|
|
221
|
+
*/
|
|
222
|
+
|
|
223
|
+
/** Render a DiffReport into Keep-a-Changelog Markdown format. */
|
|
224
|
+
declare function renderChangelog(report: DiffReport): string;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Backward-Compatibility Gateway Shim Generator.
|
|
228
|
+
* Synthesizes edge workers and API gateway middleware to maintain
|
|
229
|
+
* backward compatibility for legacy clients during breaking changes.
|
|
230
|
+
*/
|
|
231
|
+
|
|
232
|
+
type ShimTarget = 'express' | 'cloudflare-worker' | 'envoy-lua';
|
|
233
|
+
interface ShimGenerationResult {
|
|
234
|
+
target: ShimTarget;
|
|
235
|
+
code: string;
|
|
236
|
+
handledChanges: number;
|
|
237
|
+
}
|
|
238
|
+
/** Generate backward compatibility gateway adapter for breaking API changes. */
|
|
239
|
+
declare function generateGatewayShim(report: DiffReport, target?: ShimTarget): ShimGenerationResult;
|
|
240
|
+
|
|
189
241
|
/** Public library API per spec §18. Pure; no stdout; no process.exit. */
|
|
190
242
|
|
|
191
243
|
/**
|
|
@@ -201,4 +253,4 @@ declare function validateSpec(specPath: string, options?: {
|
|
|
201
253
|
validation: ValidationResult;
|
|
202
254
|
}>;
|
|
203
255
|
|
|
204
|
-
export { type AnalyzeOptions, type AnalyzeResult, type ApiChange, type ChangeKind, type ChangeLocation, type Context, type DiffReport, type DiffSummary, type LoadedConfig, type LoadedSpec, type NormalizedSpec, type ResolvedConfig, type SemverAdvice, type Severity, type SpecMeta, type ValidationIssue, type ValidationResult, analyze, discoverAndLoadConfig, loadConfigFrom, suggestVersion, validateSpec };
|
|
256
|
+
export { type AnalyzeOptions, type AnalyzeResult, type ApiChange, type ChangeKind, type ChangeLocation, type Context, type DiffReport, type DiffSummary, type LoadedConfig, type LoadedSpec, type NormalizedSpec, type ResolvedConfig, type SemverAdvice, type Severity, type ShimGenerationResult, type ShimTarget, type SpecMeta, type ValidationIssue, type ValidationResult, analyze, discoverAndLoadConfig, generateGatewayShim, loadConfigFrom, renderChangelog, renderHtml, renderSarif, suggestVersion, validateSpec };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
analyze,
|
|
3
3
|
discoverAndLoadConfig,
|
|
4
|
+
generateGatewayShim,
|
|
4
5
|
loadConfigFrom,
|
|
5
6
|
loadSpec,
|
|
7
|
+
renderChangelog,
|
|
8
|
+
renderHtml,
|
|
9
|
+
renderSarif,
|
|
6
10
|
suggestVersion,
|
|
7
11
|
validateSemantics
|
|
8
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EJQ5XOY6.js";
|
|
9
13
|
|
|
10
14
|
// src/index.ts
|
|
11
15
|
async function validateSpec(specPath, options) {
|
|
@@ -16,7 +20,11 @@ async function validateSpec(specPath, options) {
|
|
|
16
20
|
export {
|
|
17
21
|
analyze,
|
|
18
22
|
discoverAndLoadConfig,
|
|
23
|
+
generateGatewayShim,
|
|
19
24
|
loadConfigFrom,
|
|
25
|
+
renderChangelog,
|
|
26
|
+
renderHtml,
|
|
27
|
+
renderSarif,
|
|
20
28
|
suggestVersion,
|
|
21
29
|
validateSpec
|
|
22
30
|
};
|
package/package.json
CHANGED