@jentic/api-scorecard-cli 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ Jentic API Scorecard
2
+ Copyright (c) 2026 Jentic
3
+ Jentic API Scorecard is licensed under Apache 2.0 license.
4
+ Copy of the Apache 2.0 license can be found in `LICENSE` file.
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # Jentic API Scorecard
2
+
3
+ ![Jentic API Scorecard preview](https://github.com/jentic/jentic-api-scorecard/raw/main/assets/scorecard-preview.jpg)
4
+
5
+ An OpenAPI document that passes validation isn't necessarily one an AI agent can use. Grammar is
6
+ one thing; semantic clarity, safety, and discoverability are another. The **Jentic API Scorecard**
7
+ scores your OpenAPI document against the
8
+ [Jentic API AI Readiness Framework (JAIRF)](https://github.com/jentic/api-ai-readiness-framework)
9
+ across six dimensions and returns a single grade — so you know exactly where to improve.
10
+
11
+ ## What it scores
12
+
13
+ Each OpenAPI document is evaluated across six lenses — small, targeted improvements in any of them
14
+ tend to produce outsized gains for both human developers and AI agents:
15
+
16
+ - **Foundational Compliance (FC)** — structural validity and conformance to OpenAPI itself.
17
+ - **Developer Experience & Jentic Compatibility (DXJ)** — documentation quality and how well the
18
+ OpenAPI document plays with downstream tooling.
19
+ - **AI-Readiness & Agent Experience (ARAX)** — semantic clarity and the context an LLM needs to
20
+ reason about each operation.
21
+ - **Agent Usability (AU)** — predictable, safe multi-step orchestration.
22
+ - **Security (SEC)** — declared auth schemes and trust boundaries.
23
+ - **AI Discoverability (AID)** — how easily an AI system can find and parse the OpenAPI document.
24
+
25
+ ## How it works
26
+
27
+ Scoring runs locally inside a Docker container in two phases. **Analysis** runs a battery of
28
+ validators and structural checks against the OpenAPI document to produce a set of diagnostics and
29
+ observations.
30
+ **Scoring** maps those into ~35 signals across the six JAIRF dimensions, aggregates them into
31
+ per-dimension scores, and rolls those up into a single weighted score and grade.
32
+
33
+ ## Requirements
34
+
35
+ - **Node.js** >= 20.10.0 with npm/npx. See [Node.js downloads](https://nodejs.org/).
36
+ - **Docker** installed and running. See [Docker installation](https://docs.docker.com/get-docker/).
37
+ The CLI pulls the scoring image automatically on first run.
38
+ - Network access to [`ghcr.io`](https://ghcr.io) (to pull the image) and to whatever URL hosts the
39
+ OpenAPI document you're scoring (the engine fetches it from inside the container).
40
+
41
+ ## Try it now
42
+
43
+ OpenAPI documents from [Jentic Public APIs (OAK)](https://github.com/jentic/jentic-public-apis)
44
+ score without any key or limit — no signup, no config:
45
+
46
+ ```bash
47
+ npx @jentic/api-scorecard-cli@alpha score \
48
+ https://raw.githubusercontent.com/jentic/jentic-public-apis/refs/heads/main/apis/openapi/swagger-api/petstore/1.0.27/openapi.json
49
+ ```
50
+
51
+ For URLs outside OAK or local files, set the API key:
52
+
53
+ ```bash
54
+ JENTIC_API_KEY=mvp-preview npx @jentic/api-scorecard-cli@alpha score \
55
+ https://petstore3.swagger.io/api/v3/openapi.json
56
+ ```
57
+
58
+ ```bash
59
+ JENTIC_API_KEY=mvp-preview npx @jentic/api-scorecard-cli@alpha score ./openapi.yaml
60
+ ```
61
+
62
+ That's it. The CLI pulls the scoring engine automatically on first run.
63
+
64
+ ![CLI score output](https://github.com/jentic/jentic-api-scorecard/raw/main/assets/cli-screenshot.png)
65
+
66
+
67
+
68
+ ## Control output depth
69
+
70
+ The `--detail` flag lets you zoom in:
71
+
72
+ ```bash
73
+ # Just the headline score and grade
74
+ npx @jentic/api-scorecard-cli@alpha score --detail summary ./openapi.yaml
75
+
76
+ # Per-dimension breakdown (default)
77
+ npx @jentic/api-scorecard-cli@alpha score --detail dimensions ./openapi.yaml
78
+
79
+ # Individual signals within each dimension
80
+ npx @jentic/api-scorecard-cli@alpha score --detail signals ./openapi.yaml
81
+
82
+ # Full diagnostics with top 5 findings per severity
83
+ npx @jentic/api-scorecard-cli@alpha score --detail diagnostics ./openapi.yaml
84
+ ```
85
+
86
+ ## Anonymous vs keyed access
87
+
88
+ OpenAPI documents hosted under [jentic-public-apis](https://github.com/jentic/jentic-public-apis)
89
+ score without any key. For everything else, set the MVP preview key:
90
+
91
+ ```bash
92
+ export JENTIC_API_KEY=mvp-preview
93
+ ```
94
+
95
+ This is a documented public placeholder for the alpha preview — not a secret. Real key issuance
96
+ arrives in a future release.
97
+
98
+ ## Status
99
+
100
+ This project is in **alpha**. Track progress in
101
+ [`specs/roadmap.md`](https://github.com/jentic/jentic-api-scorecard/blob/main/specs/roadmap.md).
102
+
103
+ The `:unstable` Docker image is rebuilt on every push to `main` for direct `docker run` users.
104
+ Versioned images are published alongside each alpha CLI release.
105
+
106
+ ## License
107
+
108
+ Jentic API Scorecard is licensed under the
109
+ [Apache 2.0](https://github.com/jentic/jentic-api-scorecard/blob/main/LICENSE) license.
110
+ Jentic API Scorecard comes with an explicit
111
+ [NOTICE](https://github.com/jentic/jentic-api-scorecard/blob/main/NOTICE) file containing
112
+ additional legal notices and information.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { main } from '../dist/index.js';
4
+
5
+ main().catch((err) => {
6
+ process.stderr.write(`error: ${err instanceof Error ? err.message : String(err)}\n`);
7
+ process.exit(1);
8
+ });
@@ -0,0 +1 @@
1
+ export declare function bundleSpec(ref: string): Promise<string>;
package/dist/bundle.js ADDED
@@ -0,0 +1,7 @@
1
+ import { bundle, createConfig } from '@redocly/openapi-core';
2
+ export async function bundleSpec(ref) {
3
+ const config = await createConfig({});
4
+ const result = await bundle({ ref, config, dereference: false });
5
+ return JSON.stringify(result.bundle.parsed);
6
+ }
7
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW;IAC1C,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,EAAE,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IACjE,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { DetailLevel } from '../detail.ts';
2
+ export interface ScoreOptions {
3
+ withLlm?: boolean;
4
+ detail?: DetailLevel;
5
+ }
6
+ export declare function runScore(input: string, options: ScoreOptions): Promise<number>;
@@ -0,0 +1,103 @@
1
+ import { existsSync, statSync } from 'node:fs';
2
+ import { bundleSpec } from "../bundle.js";
3
+ import { DEFAULT_DETAIL, filterByDetail } from "../detail.js";
4
+ import { imageExists, imageRef, pullImage, runDocker } from "../docker.js";
5
+ import { ExitCode } from "../exit-codes.js";
6
+ import { formatPretty } from "../formatters/pretty.js";
7
+ import { spin, done, clearSpinner } from "../spinner.js";
8
+ function isURL(input) {
9
+ return /^https:\/\//i.test(input);
10
+ }
11
+ function isExistingFile(input) {
12
+ try {
13
+ return existsSync(input) && statSync(input).isFile();
14
+ }
15
+ catch {
16
+ return false;
17
+ }
18
+ }
19
+ export async function runScore(input, options) {
20
+ const containerArgs = ['score'];
21
+ if (options.withLlm) {
22
+ containerArgs.push('--with-llm');
23
+ }
24
+ const apiKey = process.env['JENTIC_API_KEY'];
25
+ const forwardJenticKey = apiKey !== undefined && apiKey !== '';
26
+ let stdinPayload;
27
+ const startTime = Date.now();
28
+ if (isURL(input)) {
29
+ containerArgs.push('--url', input);
30
+ }
31
+ else if (isExistingFile(input)) {
32
+ spin(`Bundling ${input}…`);
33
+ try {
34
+ stdinPayload = await bundleSpec(input);
35
+ }
36
+ catch (err) {
37
+ clearSpinner();
38
+ const message = err instanceof Error ? err.message : String(err);
39
+ process.stderr.write(`error: failed to bundle ${input}: ${message}\n`);
40
+ return ExitCode.SPEC_FAILURE;
41
+ }
42
+ }
43
+ else {
44
+ process.stderr.write(`error: input '${input}' is neither an https:// URL nor an existing file.\n`);
45
+ return ExitCode.GENERIC_ERROR;
46
+ }
47
+ const ref = imageRef();
48
+ const present = await imageExists(ref);
49
+ if (!present) {
50
+ spin(`Pulling ${ref}…`);
51
+ const pullResult = await pullImage(ref);
52
+ if (pullResult.exitCode !== 0) {
53
+ clearSpinner();
54
+ process.stderr.write(`error: failed to pull image ${ref}\n`);
55
+ if (pullResult.stderr) {
56
+ process.stderr.write(pullResult.stderr);
57
+ }
58
+ return pullResult.exitCode === ExitCode.DOCKER_MISSING
59
+ ? ExitCode.DOCKER_MISSING
60
+ : ExitCode.GENERIC_ERROR;
61
+ }
62
+ }
63
+ spin(`Scoring…`);
64
+ let result;
65
+ try {
66
+ result = await runDocker({
67
+ args: containerArgs,
68
+ stdinPayload,
69
+ forwardJenticKey,
70
+ });
71
+ }
72
+ catch (err) {
73
+ clearSpinner();
74
+ const message = err instanceof Error ? err.message : String(err);
75
+ process.stderr.write(`error: failed to run docker: ${message}\n`);
76
+ return ExitCode.GENERIC_ERROR;
77
+ }
78
+ if (result.exitCode !== 0) {
79
+ clearSpinner();
80
+ if (result.stdout) {
81
+ process.stdout.write(result.stdout);
82
+ }
83
+ return result.exitCode;
84
+ }
85
+ let parsed;
86
+ try {
87
+ parsed = JSON.parse(result.stdout);
88
+ }
89
+ catch {
90
+ clearSpinner();
91
+ process.stderr.write('warning: engine output was not valid JSON; passing through raw output.\n');
92
+ process.stdout.write(result.stdout);
93
+ return ExitCode.SUCCESS;
94
+ }
95
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
96
+ done(`Scoring done in ${elapsed}s`);
97
+ const detail = options.detail ?? DEFAULT_DETAIL;
98
+ const filtered = filterByDetail(parsed, detail);
99
+ const output = formatPretty(filtered, input, { detail });
100
+ process.stdout.write(output);
101
+ return ExitCode.SUCCESS;
102
+ }
103
+ //# sourceMappingURL=score.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"score.js","sourceRoot":"","sources":["../../src/commands/score.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAe,cAAc,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAOzD,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,IAAI,CAAC;QACH,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,KAAa,EAAE,OAAqB;IACjE,MAAM,aAAa,GAAa,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC7C,MAAM,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xD,CAAC;IAAC,MAAM,CAAC;QACP,YAAY,EAAE,CAAC;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,0EAA0E,CAC3E,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7D,IAAI,CAAC,mBAAmB,OAAO,GAAG,CAAC,CAAC;IAEpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,cAAc,CAAC;IAChD,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACzD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE7B,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { ScorecardResult } from './result.ts';
2
+ export declare const DetailLevel: {
3
+ readonly SUMMARY: "summary";
4
+ readonly DIMENSIONS: "dimensions";
5
+ readonly SIGNALS: "signals";
6
+ readonly DIAGNOSTICS: "diagnostics";
7
+ };
8
+ export type DetailLevel = (typeof DetailLevel)[keyof typeof DetailLevel];
9
+ export declare const DETAIL_LEVELS: readonly DetailLevel[];
10
+ export declare const DEFAULT_DETAIL: DetailLevel;
11
+ export declare function isDetailLevel(value: string): value is DetailLevel;
12
+ export declare function filterByDetail(result: ScorecardResult, level: DetailLevel): ScorecardResult;
package/dist/detail.js ADDED
@@ -0,0 +1,39 @@
1
+ export const DetailLevel = {
2
+ SUMMARY: 'summary',
3
+ DIMENSIONS: 'dimensions',
4
+ SIGNALS: 'signals',
5
+ DIAGNOSTICS: 'diagnostics',
6
+ };
7
+ export const DETAIL_LEVELS = [
8
+ DetailLevel.SUMMARY,
9
+ DetailLevel.DIMENSIONS,
10
+ DetailLevel.SIGNALS,
11
+ DetailLevel.DIAGNOSTICS,
12
+ ];
13
+ export const DEFAULT_DETAIL = DetailLevel.DIMENSIONS;
14
+ export function isDetailLevel(value) {
15
+ return DETAIL_LEVELS.includes(value);
16
+ }
17
+ export function filterByDetail(result, level) {
18
+ const { summary, details, diagnostics, ...rest } = result;
19
+ const filtered = { ...rest, summary };
20
+ if (level === DetailLevel.SUMMARY) {
21
+ const { dimensions: _dimensions, ...summaryRest } = summary;
22
+ filtered.summary = summaryRest;
23
+ return filtered;
24
+ }
25
+ if (level === DetailLevel.DIMENSIONS) {
26
+ return filtered;
27
+ }
28
+ if (level === DetailLevel.SIGNALS) {
29
+ if (details !== undefined)
30
+ filtered.details = details;
31
+ return filtered;
32
+ }
33
+ if (details !== undefined)
34
+ filtered.details = details;
35
+ if (diagnostics !== undefined)
36
+ filtered.diagnostics = diagnostics;
37
+ return filtered;
38
+ }
39
+ //# sourceMappingURL=detail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detail.js","sourceRoot":"","sources":["../src/detail.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,aAAa;CAClB,CAAC;AAIX,MAAM,CAAC,MAAM,aAAa,GAA2B;IACnD,WAAW,CAAC,OAAO;IACnB,WAAW,CAAC,UAAU;IACtB,WAAW,CAAC,OAAO;IACnB,WAAW,CAAC,WAAW;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAgB,WAAW,CAAC,UAAU,CAAC;AAElE,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAQ,aAAmC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAuB,EAAE,KAAkB;IACxE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAE1D,MAAM,QAAQ,GAAoB,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC;IAEvD,IAAI,KAAK,KAAK,WAAW,CAAC,OAAO,EAAE,CAAC;QAClC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC;QAC5D,QAAQ,CAAC,OAAO,GAAG,WAAW,CAAC;QAC/B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,KAAK,KAAK,WAAW,CAAC,UAAU,EAAE,CAAC;QACrC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,KAAK,KAAK,WAAW,CAAC,OAAO,EAAE,CAAC;QAClC,IAAI,OAAO,KAAK,SAAS;YAAE,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;QACtD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,OAAO,KAAK,SAAS;QAAE,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;IACtD,IAAI,WAAW,KAAK,SAAS;QAAE,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;IAClE,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,18 @@
1
+ export declare const IMAGE_NAME = "ghcr.io/jentic/jentic-api-scorecard";
2
+ export declare function imageRef(): string;
3
+ export declare function imageExists(ref: string): Promise<boolean>;
4
+ export interface PullResult {
5
+ exitCode: number;
6
+ stderr: string;
7
+ }
8
+ export declare function pullImage(ref: string): Promise<PullResult>;
9
+ export interface DockerRunOptions {
10
+ args: string[];
11
+ stdinPayload?: string;
12
+ forwardJenticKey: boolean;
13
+ }
14
+ export interface DockerRunResult {
15
+ exitCode: number;
16
+ stdout: string;
17
+ }
18
+ export declare function runDocker(opts: DockerRunOptions): Promise<DockerRunResult>;
package/dist/docker.js ADDED
@@ -0,0 +1,108 @@
1
+ import { execFile, spawn } from 'node:child_process';
2
+ import { constants as osConstants } from 'node:os';
3
+ import { ExitCode } from "./exit-codes.js";
4
+ import { cliVersion } from "./version.js";
5
+ export const IMAGE_NAME = 'ghcr.io/jentic/jentic-api-scorecard';
6
+ export function imageRef() {
7
+ return `${IMAGE_NAME}:${cliVersion}`;
8
+ }
9
+ export function imageExists(ref) {
10
+ return new Promise((resolve) => {
11
+ execFile('docker', ['image', 'inspect', ref], (err) => {
12
+ resolve(err === null);
13
+ });
14
+ });
15
+ }
16
+ export function pullImage(ref) {
17
+ return new Promise((resolve) => {
18
+ const child = spawn('docker', ['pull', ref], {
19
+ stdio: ['ignore', 'ignore', 'pipe'],
20
+ });
21
+ const stderrChunks = [];
22
+ if (child.stderr) {
23
+ child.stderr.on('data', (chunk) => {
24
+ stderrChunks.push(chunk);
25
+ });
26
+ }
27
+ child.on('error', (err) => {
28
+ const exitCode = err.code === 'ENOENT' ? ExitCode.DOCKER_MISSING : ExitCode.GENERIC_ERROR;
29
+ resolve({ exitCode, stderr: err.message });
30
+ });
31
+ child.on('close', (code) => {
32
+ resolve({
33
+ exitCode: code ?? ExitCode.GENERIC_ERROR,
34
+ stderr: Buffer.concat(stderrChunks).toString('utf8'),
35
+ });
36
+ });
37
+ });
38
+ }
39
+ const FORWARDED_SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP'];
40
+ export function runDocker(opts) {
41
+ const dockerArgs = ['run', '--rm'];
42
+ if (opts.stdinPayload !== undefined) {
43
+ dockerArgs.push('-i');
44
+ }
45
+ if (opts.forwardJenticKey) {
46
+ dockerArgs.push('-e', 'JENTIC_API_KEY');
47
+ }
48
+ dockerArgs.push(imageRef());
49
+ dockerArgs.push(...opts.args);
50
+ return new Promise((resolve, reject) => {
51
+ const child = spawn('docker', dockerArgs, {
52
+ stdio: [opts.stdinPayload !== undefined ? 'pipe' : 'inherit', 'pipe', 'inherit'],
53
+ });
54
+ let settled = false;
55
+ const signalHandlers = new Map();
56
+ const stdoutChunks = [];
57
+ const cleanup = () => {
58
+ for (const [sig, handler] of signalHandlers) {
59
+ process.off(sig, handler);
60
+ }
61
+ signalHandlers.clear();
62
+ };
63
+ const settle = (fn) => {
64
+ if (settled)
65
+ return;
66
+ settled = true;
67
+ cleanup();
68
+ fn();
69
+ };
70
+ for (const sig of FORWARDED_SIGNALS) {
71
+ const handler = () => {
72
+ child.kill(sig);
73
+ };
74
+ signalHandlers.set(sig, handler);
75
+ process.on(sig, handler);
76
+ }
77
+ if (child.stdout) {
78
+ child.stdout.on('data', (chunk) => {
79
+ stdoutChunks.push(chunk);
80
+ });
81
+ }
82
+ child.on('error', (err) => {
83
+ if (err.code === 'ENOENT') {
84
+ process.stderr.write("error: 'docker' command not found.\n" +
85
+ ' Install Docker: https://docs.docker.com/get-docker/\n');
86
+ settle(() => resolve({ exitCode: ExitCode.DOCKER_MISSING, stdout: '' }));
87
+ return;
88
+ }
89
+ settle(() => reject(err));
90
+ });
91
+ child.on('close', (code, signal) => {
92
+ const stdout = Buffer.concat(stdoutChunks).toString('utf8');
93
+ if (signal !== null) {
94
+ const signo = osConstants.signals[signal] ?? 0;
95
+ settle(() => resolve({ exitCode: 128 + signo, stdout }));
96
+ return;
97
+ }
98
+ settle(() => resolve({ exitCode: code ?? ExitCode.GENERIC_ERROR, stdout }));
99
+ });
100
+ if (opts.stdinPayload !== undefined && child.stdin) {
101
+ child.stdin.on('error', () => {
102
+ /* swallow EPIPE if container exits early */
103
+ });
104
+ child.stdin.end(opts.stdinPayload);
105
+ }
106
+ });
107
+ }
108
+ //# sourceMappingURL=docker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docker.js","sourceRoot":"","sources":["../src/docker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC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+1,10 @@
1
+ export declare const ExitCode: {
2
+ readonly SUCCESS: 0;
3
+ readonly GENERIC_ERROR: 1;
4
+ readonly AUTH_INVALID_KEY: 2;
5
+ readonly GATE_REJECTED: 3;
6
+ readonly DOCKER_MISSING: 4;
7
+ readonly SPEC_FAILURE: 5;
8
+ readonly ENGINE_FAILURE: 6;
9
+ };
10
+ export type ExitCode = (typeof ExitCode)[keyof typeof ExitCode];
@@ -0,0 +1,10 @@
1
+ export const ExitCode = {
2
+ SUCCESS: 0,
3
+ GENERIC_ERROR: 1,
4
+ AUTH_INVALID_KEY: 2,
5
+ GATE_REJECTED: 3,
6
+ DOCKER_MISSING: 4,
7
+ SPEC_FAILURE: 5,
8
+ ENGINE_FAILURE: 6,
9
+ };
10
+ //# sourceMappingURL=exit-codes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,CAAC;IACV,aAAa,EAAE,CAAC;IAChB,gBAAgB,EAAE,CAAC;IACnB,aAAa,EAAE,CAAC;IAChB,cAAc,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC;IACf,cAAc,EAAE,CAAC;CACT,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { DetailLevel } from '../detail.ts';
2
+ import { ScorecardResult } from '../result.ts';
3
+ export type { ScorecardResult } from '../result.ts';
4
+ export interface FormatPrettyOptions {
5
+ detail?: DetailLevel;
6
+ }
7
+ export declare function formatPretty(result: ScorecardResult, source: string, options?: FormatPrettyOptions): string;
@@ -0,0 +1,273 @@
1
+ import chalk from 'chalk';
2
+ import { DEFAULT_DETAIL, DetailLevel } from "../detail.js";
3
+ import { cliVersion } from "../version.js";
4
+ const BANNER = ` ██╗███████╗███╗ ██╗████████╗██╗ ██████╗
5
+ ██║██╔════╝████╗ ██║╚══██╔══╝██║██╔════╝
6
+ ██║█████╗ ██╔██╗ ██║ ██║ ██║██║
7
+ ██ ██║██╔══╝ ██║╚██╗██║ ██║ ██║██║
8
+ ╚█████╔╝███████╗██║ ╚████║ ██║ ██║╚██████╗
9
+ ╚════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝`;
10
+ function gradeColor(grade) {
11
+ if (grade.startsWith('A') || grade.startsWith('B'))
12
+ return chalk.green;
13
+ if (grade.startsWith('C'))
14
+ return chalk.yellow;
15
+ return chalk.red;
16
+ }
17
+ function colorGrade(grade) {
18
+ return gradeColor(grade)(grade);
19
+ }
20
+ function colorScore(grade, formatted) {
21
+ return gradeColor(grade)(formatted);
22
+ }
23
+ const BAR_WIDTH = 20;
24
+ function scoreBar(score) {
25
+ const filled = Math.round((score / 100) * BAR_WIDTH);
26
+ const empty = BAR_WIDTH - filled;
27
+ return chalk.white('▄'.repeat(filled)) + chalk.blackBright('▄'.repeat(empty));
28
+ }
29
+ // Signal scores are [0, 1] with no engine-emitted grade, so we band by raw
30
+ // threshold rather than reusing gradeColor (which keys off a grade letter).
31
+ function signalScoreColor(score) {
32
+ if (score >= 0.8)
33
+ return chalk.green;
34
+ if (score >= 0.5)
35
+ return chalk.yellow;
36
+ return chalk.red;
37
+ }
38
+ const SEVERITY_LABELS = {
39
+ 1: 'error',
40
+ 2: 'warning',
41
+ 3: 'info',
42
+ 4: 'hint',
43
+ };
44
+ function severityLabel(sev) {
45
+ return SEVERITY_LABELS[sev] ?? `severity ${sev}`;
46
+ }
47
+ function severityColor(sev) {
48
+ if (sev === 1)
49
+ return chalk.red;
50
+ if (sev === 2)
51
+ return chalk.yellow;
52
+ return chalk.dim;
53
+ }
54
+ export function formatPretty(result, source, options = {}) {
55
+ const detail = options.detail ?? DEFAULT_DETAIL;
56
+ const { summary, apiMetadata, metadata, details, diagnostics } = result;
57
+ const lines = [];
58
+ lines.push('');
59
+ lines.push(chalk.cyan(BANNER));
60
+ lines.push(`${chalk.bold(' API Readiness Scorecard')} ${chalk.dim(`v${cliVersion}`)}`);
61
+ const engineRaw = metadata?.engine?.version;
62
+ if (engineRaw) {
63
+ const match = /^([^+]+)(?:\+jairf\.(.+))?$/.exec(engineRaw);
64
+ const engineVer = match?.[1] ?? engineRaw;
65
+ const frameworkVer = match?.[2];
66
+ const parts = [];
67
+ if (frameworkVer)
68
+ parts.push(`Scoring Framework ${frameworkVer}`);
69
+ parts.push(`Scoring Engine ${engineVer}`);
70
+ lines.push(chalk.dim(` ${parts.join(' | ')}`));
71
+ }
72
+ lines.push('');
73
+ if (apiMetadata?.name) {
74
+ const version = apiMetadata.apiDescriptionVersion
75
+ ? chalk.dim(` v${apiMetadata.apiDescriptionVersion}`)
76
+ : '';
77
+ const heading = `${apiMetadata.name}${apiMetadata.apiDescriptionVersion ? ` v${apiMetadata.apiDescriptionVersion}` : ''}`;
78
+ const divider = chalk.dim('─'.repeat(heading.length));
79
+ lines.push(` ${divider}`);
80
+ lines.push(` ${chalk.bold(apiMetadata.name)}${version}`);
81
+ lines.push(` ${divider}`);
82
+ lines.push('');
83
+ }
84
+ lines.push(` ${chalk.dim('OpenAPI Document:')} ${source}`);
85
+ const finalScore = colorScore(summary.grade, Math.round(summary.score).toString());
86
+ lines.push(` Final score: ${chalk.bold(finalScore)} ${chalk.dim('/ 100')}`);
87
+ lines.push(` Readiness: ${chalk.bold(summary.level.toUpperCase())} (${colorGrade(summary.grade)})`);
88
+ const showDimensions = detail !== DetailLevel.SUMMARY;
89
+ if (showDimensions && summary.dimensions && summary.dimensions.length > 0) {
90
+ lines.push('');
91
+ lines.push(` ${chalk.bold.underline('Dimensions')}`);
92
+ lines.push('');
93
+ const kindWidth = Math.max(...summary.dimensions.map((d) => d.kind.length));
94
+ const nameWidth = Math.max(...summary.dimensions.map((d) => d.name.length));
95
+ for (const dim of summary.dimensions) {
96
+ const kind = chalk.cyan(dim.kind.padEnd(kindWidth));
97
+ const name = dim.name.padEnd(nameWidth);
98
+ const bar = scoreBar(dim.score);
99
+ const score = Math.round(dim.score).toString().padStart(3);
100
+ const grade = colorGrade(dim.grade.padEnd(2));
101
+ lines.push(` ${kind} ${name} ${bar} ${score} ${grade}`);
102
+ }
103
+ }
104
+ if (apiMetadata) {
105
+ const stat = (n, label) => `${chalk.bold(n)} ${chalk.dim(label)}`;
106
+ const stats = [];
107
+ if (apiMetadata.operationCount !== undefined) {
108
+ stats.push(stat(apiMetadata.operationCount, 'operations'));
109
+ }
110
+ if (apiMetadata.schemaCount !== undefined) {
111
+ stats.push(stat(apiMetadata.schemaCount, 'schemas'));
112
+ }
113
+ if (apiMetadata.tagCount !== undefined) {
114
+ stats.push(stat(apiMetadata.tagCount, 'tags'));
115
+ }
116
+ if (apiMetadata.securitySchemeCount !== undefined) {
117
+ stats.push(stat(apiMetadata.securitySchemeCount, 'security schemes'));
118
+ }
119
+ if (apiMetadata.securitySchemeTypes && apiMetadata.securitySchemeTypes.length > 0) {
120
+ stats.push(stat(apiMetadata.securitySchemeTypes.length, 'security types'));
121
+ }
122
+ if (stats.length > 0) {
123
+ lines.push('');
124
+ lines.push(` ${stats.join(chalk.dim(' · '))}`);
125
+ }
126
+ }
127
+ if (detail === DetailLevel.SIGNALS || detail === DetailLevel.DIAGNOSTICS) {
128
+ appendSignals(lines, details);
129
+ }
130
+ if (detail === DetailLevel.DIAGNOSTICS) {
131
+ appendDiagnostics(lines, diagnostics);
132
+ }
133
+ appendHint(lines, detail);
134
+ lines.push('');
135
+ return lines.join('\n');
136
+ }
137
+ function appendSignals(lines, details) {
138
+ if (!details || details.length === 0)
139
+ return;
140
+ lines.push('');
141
+ lines.push(` ${chalk.bold.underline('Signals')}`);
142
+ const allSignals = details.flatMap((g) => (g.dimensions ?? []).flatMap((d) => d.signals ?? []));
143
+ if (allSignals.length === 0)
144
+ return;
145
+ const nameWidth = Math.max(...allSignals.map((s) => s.name.length));
146
+ let firstDim = true;
147
+ for (const group of details) {
148
+ const groupDimensions = group.dimensions ?? [];
149
+ for (const dim of groupDimensions) {
150
+ const signals = dim.signals ?? [];
151
+ if (signals.length === 0)
152
+ continue;
153
+ lines.push('');
154
+ if (!firstDim)
155
+ lines.push('');
156
+ firstDim = false;
157
+ const stats = [];
158
+ if (dim.score !== undefined)
159
+ stats.push(Math.round(dim.score).toString());
160
+ if (dim.grade)
161
+ stats.push(colorGrade(dim.grade));
162
+ const trailer = stats.length > 0 ? ` (${stats.join(' / ')})` : '';
163
+ lines.push(` ${chalk.cyan(dim.kind)} ${chalk.bold(dim.name)}${trailer}`);
164
+ const indent = 4;
165
+ const termCols = process.stdout.columns ?? Number.POSITIVE_INFINITY;
166
+ const maxRowWidth = Math.max(0, termCols - indent);
167
+ const rows = [];
168
+ let widest = 0;
169
+ for (const signal of signals) {
170
+ const name = signal.name.padEnd(nameWidth);
171
+ const scoreNum = Math.round(signal.score * 100)
172
+ .toString()
173
+ .padStart(3);
174
+ const scoreText = `${scoreNum}%`;
175
+ const score = signalScoreColor(signal.score)(scoreText);
176
+ const fixedWidth = name.length + 2 + scoreText.length;
177
+ let descRaw = signal.description ?? '';
178
+ let descSegment = '';
179
+ if (descRaw) {
180
+ const descBudget = maxRowWidth - fixedWidth - 2;
181
+ if (descBudget <= 1) {
182
+ descRaw = '';
183
+ }
184
+ else if (descRaw.length > descBudget) {
185
+ descRaw = descRaw.slice(0, descBudget - 1) + '…';
186
+ }
187
+ descSegment = descRaw ? ` ${chalk.dim(descRaw)}` : '';
188
+ }
189
+ const visible = fixedWidth + (descRaw ? 2 + descRaw.length : 0);
190
+ if (visible > widest)
191
+ widest = visible;
192
+ rows.push(` ${name} ${score}${descSegment}`);
193
+ }
194
+ const rule = chalk.dim('─'.repeat(widest));
195
+ lines.push(` ${rule}`);
196
+ lines.push(...rows);
197
+ lines.push(` ${rule}`);
198
+ }
199
+ }
200
+ }
201
+ const DIAGNOSTIC_PREVIEW_LIMIT = 5;
202
+ function appendDiagnostics(lines, diagnostics) {
203
+ lines.push('');
204
+ if (!diagnostics || diagnostics.length === 0) {
205
+ lines.push(` ${chalk.bold.underline('Diagnostics')} ${chalk.dim('0')}`);
206
+ return;
207
+ }
208
+ const grouped = new Map();
209
+ for (const diag of diagnostics) {
210
+ const list = grouped.get(diag.severity) ?? [];
211
+ list.push(diag);
212
+ grouped.set(diag.severity, list);
213
+ }
214
+ lines.push(` ${chalk.bold.underline('Diagnostics')} ${chalk.dim(diagnostics.length.toString())}`);
215
+ const pluralizableSeverities = { 1: true, 2: true, 4: true };
216
+ const order = [1, 2, 3, 4];
217
+ const tallyParts = [];
218
+ for (const sev of order) {
219
+ const items = grouped.get(sev);
220
+ if (!items?.length)
221
+ continue;
222
+ const base = severityLabel(sev);
223
+ const label = pluralizableSeverities[sev] && items.length !== 1 ? `${base}s` : base;
224
+ tallyParts.push(severityColor(sev)(`${items.length} ${label}`));
225
+ }
226
+ if (tallyParts.length > 0) {
227
+ lines.push(` ${tallyParts.join(chalk.dim(' · '))}`);
228
+ }
229
+ const indent = 4;
230
+ const termCols = process.stdout.columns ?? Number.POSITIVE_INFINITY;
231
+ const maxRowWidth = Math.max(0, termCols - indent);
232
+ for (const sev of order) {
233
+ const items = grouped.get(sev);
234
+ if (!items?.length)
235
+ continue;
236
+ const shown = items.slice(0, DIAGNOSTIC_PREVIEW_LIMIT);
237
+ const codeWidth = Math.max(...shown.map((d) => (d.code ?? '').length));
238
+ lines.push('');
239
+ const base = severityLabel(sev);
240
+ const label = pluralizableSeverities[sev] && items.length !== 1 ? `${base}s` : base;
241
+ lines.push(` ${severityColor(sev)(label)} ${chalk.dim(`(${items.length})`)}`);
242
+ for (const diag of shown) {
243
+ const code = (diag.code ?? '').padEnd(codeWidth);
244
+ const fixed = code.length + 2;
245
+ const budget = maxRowWidth - fixed;
246
+ let message = diag.message;
247
+ if (budget > 1 && message.length > budget) {
248
+ message = message.slice(0, budget - 1) + '…';
249
+ }
250
+ lines.push(` ${chalk.bold(code)} ${chalk.dim(message)}`);
251
+ }
252
+ if (items.length > shown.length) {
253
+ lines.push(chalk.dim(` … +${items.length - shown.length} more`));
254
+ }
255
+ }
256
+ }
257
+ function appendHint(lines, detail) {
258
+ if (detail === DetailLevel.SUMMARY) {
259
+ lines.push('');
260
+ lines.push(chalk.dim(' Run with --detail dimensions for the dimension table.'));
261
+ return;
262
+ }
263
+ if (detail === DetailLevel.DIMENSIONS) {
264
+ lines.push('');
265
+ lines.push(chalk.dim(' Run with --detail signals for signal breakdown.'));
266
+ return;
267
+ }
268
+ if (detail === DetailLevel.SIGNALS) {
269
+ lines.push('');
270
+ lines.push(chalk.dim(' Run with --detail diagnostics for severity counts and a preview of findings.'));
271
+ }
272
+ }
273
+ //# sourceMappingURL=pretty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pretty.js","sourceRoot":"","sources":["../../src/formatters/pretty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,MAAM,GAAG;;;;;+CAKgC,CAAC;AAIhD,SAAS,UAAU,CAAC,KAAa;IAC/B,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC;IACvE,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC;IAC/C,OAAO,KAAK,CAAC,GAAG,CAAC;AACnB,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,UAAU,CAAC,KAAa,EAAE,SAAiB;IAClD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,SAAS,QAAQ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0,0 +1 @@
1
+ export declare function main(argv?: string[]): Promise<void>;
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ import { Command, Option } from 'commander';
2
+ import { runScore } from "./commands/score.js";
3
+ import { DEFAULT_DETAIL, DETAIL_LEVELS } from "./detail.js";
4
+ import { cliVersion } from "./version.js";
5
+ export async function main(argv = process.argv) {
6
+ const program = new Command();
7
+ program
8
+ .name('jentic-api-scorecard')
9
+ .description('Score an OpenAPI document against the Jentic API AI Readiness Framework (JAIRF).')
10
+ .version(cliVersion);
11
+ program
12
+ .command('score')
13
+ .description('Score an OpenAPI document by URL or local file path.')
14
+ .argument('<input>', 'https:// URL or local file path to an OpenAPI document')
15
+ .option('--with-llm', 'Enable LLM-backed analysis in the engine', false)
16
+ .addOption(new Option('-d, --detail <level>', 'Payload depth')
17
+ .choices([...DETAIL_LEVELS])
18
+ .default(DEFAULT_DETAIL))
19
+ .action(async (input, opts) => {
20
+ const exitCode = await runScore(input, { withLlm: opts.withLlm, detail: opts.detail });
21
+ process.exitCode = exitCode;
22
+ });
23
+ await program.parseAsync(argv);
24
+ }
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAe,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAiB,OAAO,CAAC,IAAI;IACtD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,OAAO;SACJ,IAAI,CAAC,sBAAsB,CAAC;SAC5B,WAAW,CAAC,kFAAkF,CAAC;SAC/F,OAAO,CAAC,UAAU,CAAC,CAAC;IAEvB,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,sDAAsD,CAAC;SACnE,QAAQ,CAAC,SAAS,EAAE,wDAAwD,CAAC;SAC7E,MAAM,CAAC,YAAY,EAAE,0CAA0C,EAAE,KAAK,CAAC;SACvE,SAAS,CACR,IAAI,MAAM,CAAC,sBAAsB,EAAE,eAAe,CAAC;SAChD,OAAO,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC;SAC3B,OAAO,CAAC,cAAc,CAAC,CAC3B;SACA,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,IAAgD,EAAE,EAAE;QAChF,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACvF,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEL,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,62 @@
1
+ export interface Dimension {
2
+ kind: string;
3
+ name: string;
4
+ score: number;
5
+ grade: string;
6
+ }
7
+ export interface ScorecardSummary {
8
+ score: number;
9
+ level: string;
10
+ grade: string;
11
+ dimensions?: Dimension[];
12
+ }
13
+ export interface ApiMetadata {
14
+ name?: string;
15
+ apiDescriptionVersion?: string;
16
+ operationCount?: number;
17
+ schemaCount?: number;
18
+ tagCount?: number;
19
+ securitySchemeCount?: number;
20
+ securitySchemeTypes?: string[];
21
+ }
22
+ export interface EngineMetadata {
23
+ version?: string;
24
+ }
25
+ export interface Metadata {
26
+ engine?: EngineMetadata;
27
+ }
28
+ export interface Signal {
29
+ kind: string;
30
+ name: string;
31
+ score: number;
32
+ description?: string;
33
+ metadata?: Record<string, unknown>;
34
+ }
35
+ export interface DetailDimension {
36
+ kind: string;
37
+ name: string;
38
+ score?: number;
39
+ grade?: string;
40
+ signals?: Signal[];
41
+ }
42
+ export interface DetailGroup {
43
+ kind: string;
44
+ name: string;
45
+ score?: number;
46
+ grade?: string;
47
+ dimensions?: DetailDimension[];
48
+ }
49
+ export interface Diagnostic {
50
+ source: string;
51
+ severity: number;
52
+ message: string;
53
+ code?: string;
54
+ data?: Record<string, unknown>;
55
+ }
56
+ export interface ScorecardResult {
57
+ summary: ScorecardSummary;
58
+ apiMetadata?: ApiMetadata;
59
+ metadata?: Metadata;
60
+ details?: DetailGroup[];
61
+ diagnostics?: Diagnostic[];
62
+ }
package/dist/result.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export declare function spin(message: string): void;
2
+ export declare function done(message: string): void;
3
+ export declare function clearSpinner(): void;
@@ -0,0 +1,25 @@
1
+ import ora from 'ora';
2
+ // Single process-wide spinner — concurrent score invocations would interleave.
3
+ let spinner = null;
4
+ export function spin(message) {
5
+ if (spinner) {
6
+ spinner.text = message;
7
+ return;
8
+ }
9
+ spinner = ora({ text: message, stream: process.stderr }).start();
10
+ }
11
+ export function done(message) {
12
+ if (spinner) {
13
+ spinner.succeed(message);
14
+ spinner = null;
15
+ return;
16
+ }
17
+ process.stderr.write(`${message}\n`);
18
+ }
19
+ export function clearSpinner() {
20
+ if (spinner) {
21
+ spinner.stop();
22
+ spinner = null;
23
+ }
24
+ }
25
+ //# sourceMappingURL=spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../src/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,GAAiB,MAAM,KAAK,CAAC;AAEpC,+EAA+E;AAC/E,IAAI,OAAO,GAAe,IAAI,CAAC;AAE/B,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC;QACvB,OAAO;IACT,CAAC;IACD,OAAO,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,GAAG,IAAI,CAAC;QACf,OAAO;IACT,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const cliVersion: string;
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'node:module';
2
+ const require = createRequire(import.meta.url);
3
+ const pkg = require('../package.json');
4
+ export const cliVersion = pkg.version;
5
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAE9D,MAAM,CAAC,MAAM,UAAU,GAAW,GAAG,CAAC,OAAO,CAAC"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@jentic/api-scorecard-cli",
3
+ "version": "1.0.0-alpha.0",
4
+ "description": "Score an OpenAPI document against the Jentic API AI Readiness Framework (JAIRF).",
5
+ "keywords": [
6
+ "openapi",
7
+ "jentic",
8
+ "jairf",
9
+ "score",
10
+ "scorecard",
11
+ "ai-readiness"
12
+ ],
13
+ "license": "Apache-2.0",
14
+ "author": "Jentic <hello@jentic.com>",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/jentic/jentic-api-scorecard.git",
18
+ "directory": "packages/cli"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public",
22
+ "registry": "https://registry.npmjs.org",
23
+ "provenance": false,
24
+ "tag": "alpha"
25
+ },
26
+ "type": "module",
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ }
34
+ },
35
+ "bin": {
36
+ "jentic-api-scorecard": "./bin/jentic-api-scorecard.mjs"
37
+ },
38
+ "files": [
39
+ "bin/",
40
+ "dist/",
41
+ "LICENSE",
42
+ "NOTICE",
43
+ "README.md"
44
+ ],
45
+ "scripts": {
46
+ "build": "npm run build:typescript",
47
+ "build:typescript": "tsc -p tsconfig.json",
48
+ "clean": "rimraf dist *.tsbuildinfo",
49
+ "prepack": "copyfiles -u 2 ../../LICENSE . && copyfiles -u 2 ../../NOTICE . && copyfiles -u 2 ../../README.md .",
50
+ "postpack": "rimraf NOTICE LICENSE README.md",
51
+ "lint": "eslint src",
52
+ "lint:fix": "eslint src --fix",
53
+ "typescript:check-types": "tsc --noEmit"
54
+ },
55
+ "dependencies": {
56
+ "@redocly/openapi-core": "^1.30.0",
57
+ "chalk": "^4.1.2",
58
+ "commander": "^14.0.0",
59
+ "ora": "^9.4.0"
60
+ },
61
+ "engines": {
62
+ "node": ">=20.10.0"
63
+ }
64
+ }