specscore 0.1.4__tar.gz

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.
Files changed (45) hide show
  1. specscore-0.1.4/.github/workflows/deploy-pages.yml +37 -0
  2. specscore-0.1.4/.github/workflows/publish.yml +55 -0
  3. specscore-0.1.4/.gitignore +10 -0
  4. specscore-0.1.4/.python-version +1 -0
  5. specscore-0.1.4/LICENSE +193 -0
  6. specscore-0.1.4/NOTICE +14 -0
  7. specscore-0.1.4/PKG-INFO +193 -0
  8. specscore-0.1.4/README.md +160 -0
  9. specscore-0.1.4/clitic/__init__.py +0 -0
  10. specscore-0.1.4/clitic/analyzer.py +158 -0
  11. specscore-0.1.4/clitic/cli.py +63 -0
  12. specscore-0.1.4/clitic/dimensions/__init__.py +0 -0
  13. specscore-0.1.4/clitic/dimensions/arg_design.py +100 -0
  14. specscore-0.1.4/clitic/dimensions/discoverability.py +107 -0
  15. specscore-0.1.4/clitic/dimensions/error_handling.py +94 -0
  16. specscore-0.1.4/clitic/dimensions/exit_codes.py +71 -0
  17. specscore-0.1.4/clitic/dimensions/output_format.py +112 -0
  18. specscore-0.1.4/clitic/models.py +46 -0
  19. specscore-0.1.4/clitic/report.py +185 -0
  20. specscore-0.1.4/clitic/scorer.py +36 -0
  21. specscore-0.1.4/index.html +1126 -0
  22. specscore-0.1.4/main.py +4 -0
  23. specscore-0.1.4/pyproject.toml +53 -0
  24. specscore-0.1.4/sandbox/__init__.py +0 -0
  25. specscore-0.1.4/sandbox/cli.py +155 -0
  26. specscore-0.1.4/sandbox/data/sample_spec.yaml +163 -0
  27. specscore-0.1.4/sandbox/generator.py +107 -0
  28. specscore-0.1.4/sandbox/models.py +46 -0
  29. specscore-0.1.4/sandbox/prober.py +199 -0
  30. specscore-0.1.4/sandbox/report.py +153 -0
  31. specscore-0.1.4/sandbox/server.py +158 -0
  32. specscore-0.1.4/scorecard/__init__.py +0 -0
  33. specscore-0.1.4/scorecard/cli.py +71 -0
  34. specscore-0.1.4/scorecard/dimensions/__init__.py +31 -0
  35. specscore-0.1.4/scorecard/dimensions/agent_usability.py +97 -0
  36. specscore-0.1.4/scorecard/dimensions/ai_readiness.py +102 -0
  37. specscore-0.1.4/scorecard/dimensions/developer_experience.py +103 -0
  38. specscore-0.1.4/scorecard/dimensions/discoverability.py +113 -0
  39. specscore-0.1.4/scorecard/dimensions/foundational.py +63 -0
  40. specscore-0.1.4/scorecard/dimensions/security.py +99 -0
  41. specscore-0.1.4/scorecard/models.py +48 -0
  42. specscore-0.1.4/scorecard/parser.py +25 -0
  43. specscore-0.1.4/scorecard/report.py +110 -0
  44. specscore-0.1.4/scorecard/scorer.py +52 -0
  45. specscore-0.1.4/uv.lock +882 -0
@@ -0,0 +1,37 @@
1
+ name: Deploy GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - web
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+
13
+ concurrency:
14
+ group: pages
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ deploy:
19
+ environment:
20
+ name: github-pages
21
+ url: ${{ steps.deployment.outputs.page_url }}
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - name: Checkout
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Setup Pages
28
+ uses: actions/configure-pages@v5
29
+
30
+ - name: Upload artifact
31
+ uses: actions/upload-pages-artifact@v3
32
+ with:
33
+ path: "."
34
+
35
+ - name: Deploy to GitHub Pages
36
+ id: deployment
37
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,55 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ name: Build distribution
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v5
20
+ with:
21
+ enable-cache: true
22
+
23
+ - name: Set up Python
24
+ run: uv python install 3.11
25
+
26
+ - name: Install dependencies
27
+ run: uv sync
28
+
29
+ - name: Build wheel and sdist
30
+ run: uv build
31
+
32
+ - name: Upload build artifacts
33
+ uses: actions/upload-artifact@v4
34
+ with:
35
+ name: dist
36
+ path: dist/
37
+
38
+ publish:
39
+ name: Publish to PyPI
40
+ needs: build
41
+ runs-on: ubuntu-latest
42
+ environment:
43
+ name: pypi
44
+ url: https://pypi.org/project/specscore/
45
+ steps:
46
+ - name: Download build artifacts
47
+ uses: actions/download-artifact@v4
48
+ with:
49
+ name: dist
50
+ path: dist/
51
+
52
+ - name: Publish to PyPI
53
+ uses: pypa/gh-action-pypi-publish@release/v1
54
+ with:
55
+ password: ${{ secrets.PYPI_TOKEN }}
@@ -0,0 +1,10 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,193 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and derivative works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any
81
+ Contribution embodied within the Work constitutes direct or contributory
82
+ patent infringement, then any patent licenses granted to You under
83
+ this License for that Work shall terminate as of the date such
84
+ litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or
92
+ Derivative Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or as an addendum to
115
+ the NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the License.
117
+
118
+ You may add Your own license statement for Your contributions and
119
+ may provide additional grant of rights to use, copy, modify, and
120
+ distribute those contributions under terms of Your choice, provided
121
+ Your use, reproduction, and distribution of the Work otherwise
122
+ complies with the conditions stated in this License.
123
+
124
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
125
+ any Contribution intentionally submitted for inclusion in the Work
126
+ by You to the Licensor shall be under the terms and conditions of
127
+ this License, without any additional terms or conditions.
128
+ Notwithstanding the above, nothing herein shall supersede or modify
129
+ the terms of any separate license agreement you may have executed
130
+ with Licensor regarding such Contributions.
131
+
132
+ 6. Trademarks. This License does not grant permission to use the trade
133
+ names, trademarks, service marks, or product names of the Licensor,
134
+ except as required for reasonable and customary use in describing the
135
+ origin of the Work and reproducing the content of the NOTICE file.
136
+
137
+ 7. Disclaimer of Warranty. Unless required by applicable law or
138
+ agreed to in writing, Licensor provides the Work (and each
139
+ Contributor provides its Contributions) on an "AS IS" BASIS,
140
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
141
+ implied, including, without limitation, any warranties or conditions
142
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
143
+ PARTICULAR PURPOSE. You are solely responsible for determining the
144
+ appropriateness of using or reproducing the Work and assume any
145
+ risks associated with Your exercise of permissions under this License.
146
+
147
+ 8. Limitation of Liability. In no event and under no legal theory,
148
+ whether in tort (including negligence), contract, or otherwise,
149
+ unless required by applicable law (such as deliberate and grossly
150
+ negligent acts) or agreed to in writing, shall any Contributor be
151
+ liable to You for damages, including any direct, indirect, special,
152
+ incidental, or exemplary damages of any character arising as a
153
+ result of this License or out of the use or inability to use the
154
+ Work (including but not limited to damages for loss of goodwill,
155
+ work stoppage, computer failure or malfunction, or all other
156
+ commercial damages or losses), even if such Contributor has been
157
+ advised of the possibility of such damages.
158
+
159
+ 9. Accepting Warranty or Liability. While redistributing the Work or
160
+ Derivative Works thereof, You may choose to offer, and charge a fee
161
+ for, acceptance of support, warranty, indemnity, or other liability
162
+ obligations and/or rights consistent with this License. However, in
163
+ accepting such obligations, You may offer such obligations only on
164
+ Your own behalf and on Your sole responsibility, not on behalf of
165
+ any other Contributor, and only if You agree to indemnify, defend,
166
+ and hold each Contributor harmless for any liability incurred by, or
167
+ claims asserted against, such Contributor by reason of your accepting
168
+ any such warranty or additional liability.
169
+
170
+ END OF TERMS AND CONDITIONS
171
+
172
+ APPENDIX: How to apply the Apache License to your work.
173
+
174
+ To apply the Apache License to your work, attach the following
175
+ boilerplate notice, with the fields enclosed by brackets "[]"
176
+ replaced with your own identifying information. (Don't include
177
+ the brackets!) The text should be enclosed in the appropriate
178
+ comment syntax for the format in question. Please also include a
179
+ full copy of this License with any redistribution.
180
+
181
+ Copyright [yyyy] [name of copyright owner]
182
+
183
+ Licensed under the Apache License, Version 2.0 (the "License");
184
+ you may not use this file except in compliance with the License.
185
+ You may obtain a copy of the License at
186
+
187
+ http://www.apache.org/licenses/LICENSE-2.0
188
+
189
+ Unless required by applicable law or agreed to in writing, software
190
+ distributed under the License is distributed on an "AS IS" BASIS,
191
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
192
+ See the License for the specific language governing permissions and
193
+ limitations under the License.
specscore-0.1.4/NOTICE ADDED
@@ -0,0 +1,14 @@
1
+ Jentic API AI-Readiness Framework (JAIRF)
2
+ Copyright (c) 2025-2026 Jentic
3
+ Jentic API AI-Readiness Framework (JAIRF) is licensed under Apache 2.0 license.
4
+
5
+ cli-jentic is a derivative CLI implementation of the Jentic API AI-Readiness
6
+ Framework (JAIRF). The scorecard scoring model, dimension definitions, and
7
+ grading logic in the scorecard/ package are derived from JAIRF.
8
+
9
+ Original contributions in cli-jentic (sandbox/, clitic/, and the GitHub Pages
10
+ site) are copyright (c) 2025-2026 SheepSeb and are also made available under
11
+ the Apache License, Version 2.0.
12
+
13
+ You may obtain a copy of the Apache License at:
14
+ http://www.apache.org/licenses/LICENSE-2.0
@@ -0,0 +1,193 @@
1
+ Metadata-Version: 2.4
2
+ Name: specscore
3
+ Version: 0.1.4
4
+ Summary: OpenAPI scoring, sandbox, and CLI tool scoring for AI-ready agents — specscore
5
+ Project-URL: Homepage, https://sheepseb.github.io/specscore
6
+ Project-URL: Repository, https://github.com/SheepSeb/specscore
7
+ Project-URL: Bug Tracker, https://github.com/SheepSeb/specscore/issues
8
+ Author: SheepSeb
9
+ License: Apache-2.0
10
+ License-File: LICENSE
11
+ License-File: NOTICE
12
+ Keywords: agentic,agents,ai,api,cli,clitic,llm,mock-server,openapi,sandbox,scorecard
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Internet :: WWW/HTTP
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Topic :: Utilities
25
+ Requires-Python: >=3.11
26
+ Requires-Dist: flask>=3
27
+ Requires-Dist: openapi-spec-validator>=0.7
28
+ Requires-Dist: pydantic>=2
29
+ Requires-Dist: pyyaml>=6
30
+ Requires-Dist: requests>=2.31
31
+ Requires-Dist: typer[all]>=0.9
32
+ Description-Content-Type: text/markdown
33
+
34
+ # specscore
35
+
36
+ A CLI tool that scores OpenAPI specs for AI-readiness across 6 dimensions — giving APIs a letter grade and actionable recommendations so they work well with AI agents and LLM tooling.
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ # With uv (recommended)
42
+ uv pip install -e .
43
+
44
+ # Or with pip
45
+ pip install -e .
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ### Scorecard
51
+
52
+ ```bash
53
+ # Score an OpenAPI spec
54
+ specscore score path/to/openapi.yaml
55
+
56
+ # Output as JSON
57
+ specscore score path/to/openapi.yaml --json
58
+
59
+ # Run against the built-in sample spec to see how scoring works
60
+ specscore demo
61
+ specscore demo --json
62
+ ```
63
+
64
+ ### Sandbox
65
+
66
+ The sandbox spins up a local mock server from your spec and auto-probes every endpoint, reporting a **feasibility score** — how well the spec can actually be exercised by an agent.
67
+
68
+ ```bash
69
+ # Start a persistent mock server (press Ctrl+C to stop)
70
+ specscore sandbox start path/to/openapi.yaml
71
+ specscore sandbox start path/to/openapi.yaml --port 9000
72
+
73
+ # Probe all endpoints and get a report
74
+ specscore sandbox probe path/to/openapi.yaml
75
+ specscore sandbox probe path/to/openapi.yaml --json
76
+
77
+ # Run against the built-in sample spec
78
+ specscore sandbox demo
79
+ specscore sandbox demo --json
80
+ ```
81
+
82
+ The `probe` command:
83
+ 1. Starts an internal mock server
84
+ 2. Generates synthetic request payloads and path parameters from the spec's schemas
85
+ 3. Fires requests at every operation
86
+ 4. Reports per-endpoint status codes, response times, and any issues found
87
+ 5. Exits with code `2` if the feasibility score is below 50%
88
+
89
+ ### Exit codes
90
+
91
+ | Code | Meaning |
92
+ |------|---------|
93
+ | `0` | Success / score ≥ threshold |
94
+ | `1` | Error reading or parsing the spec |
95
+ | `2` | Score below threshold (< 60 for scorecard, < 50% for sandbox) |
96
+
97
+ ## What gets scored
98
+
99
+ Each spec is evaluated across 6 weighted dimensions:
100
+
101
+ | Dimension | Weight | What it checks |
102
+ |-----------|--------|----------------|
103
+ | **Foundational Compliance** | 20% | OpenAPI version, `info` object, paths defined, spec validity |
104
+ | **Developer Experience** | 15% | Operation IDs, summaries, request/response examples, parameter descriptions |
105
+ | **AI-Readiness & Agent Experience** | 20% | Meaningful descriptions, error responses (4xx/5xx), response schemas, schema property descriptions |
106
+ | **Agent Usability** | 20% | Semantic operation IDs, tag usage, parameter schemas, request body documentation |
107
+ | **Security & Governance** | 15% | Security schemes defined, operations secured, auth documentation |
108
+ | **AI Discoverability** | 10% | API-level description, tags defined, external docs |
109
+
110
+ ### Grading
111
+
112
+ | Score | Grade |
113
+ |-------|-------|
114
+ | 90–100 | A |
115
+ | 80–89 | B |
116
+ | 70–79 | C |
117
+ | 60–69 | D |
118
+ | < 60 | F |
119
+
120
+ ## Example output
121
+
122
+ ```
123
+ ╭─ specscore · OpenAPI AI readiness ───────────────────────────╮
124
+ │ Task Manager API v1.0.0 │
125
+ │ sample_spec.yaml │
126
+ │ │
127
+ │ Overall Score: 42.3/100 Grade: F │
128
+ ╰────────────────────────────────────────────────────────────────╯
129
+
130
+ ╭──────────────────────────────────┬───────────┬───────┬──────────────────────────┬────────╮
131
+ │ Dimension │ Score │ Grade │ Progress │ Issues │
132
+ ├──────────────────────────────────┼───────────┼───────┼──────────────────────────┼────────┤
133
+ │ Foundational Compliance │ 75.0/100 │ C │ ███████████████░░░░░ │ 1 │
134
+ │ Developer Experience │ 38.5/100 │ F │ ███████░░░░░░░░░░░░░░ │ 3 │
135
+ │ AI-Readiness & Agent Experience │ 31.2/100 │ F │ ██████░░░░░░░░░░░░░░░ │ 4 │
136
+ │ ... │ ... │ ... │ ... │ ... │
137
+ ╰──────────────────────────────────┴───────────┴───────┴──────────────────────────┴────────╯
138
+
139
+ Issues & Recommendations
140
+
141
+ AI-Readiness & Agent Experience
142
+ x 4/6 operations lack descriptive intent (need >30 char description)
143
+ paths.*.*.description
144
+ ! 5/6 operations have no documented error responses (4xx/5xx) — agents cannot handle failure gracefully
145
+ paths.*.*.responses
146
+ ```
147
+
148
+ ## JSON output
149
+
150
+ Pass `--json` to get a machine-readable report:
151
+
152
+ ```bash
153
+ specscore score openapi.yaml --json | jq '.overall_score'
154
+ ```
155
+
156
+ ```json
157
+ {
158
+ "api_name": "Task Manager API",
159
+ "api_version": "1.0.0",
160
+ "spec_path": "openapi.yaml",
161
+ "overall_score": 42.3,
162
+ "grade": "F",
163
+ "dimensions": [
164
+ {
165
+ "name": "Foundational Compliance",
166
+ "score": 75.0,
167
+ "grade": "C",
168
+ "issues": [...]
169
+ }
170
+ ]
171
+ }
172
+ ```
173
+
174
+ ## Development
175
+
176
+ ```bash
177
+ # Install with dev dependencies
178
+ uv pip install -e .
179
+
180
+ # Run directly without installing
181
+ python main.py score path/to/spec.yaml
182
+ ```
183
+
184
+ ## License
185
+
186
+ The scorecard scoring model in this project (`scorecard/` package) is derived from the
187
+ [Jentic API AI-Readiness Framework (JAIRF)](https://jentic.com), which is licensed under
188
+ the Apache License, Version 2.0. See the [NOTICE](NOTICE) file for the required upstream
189
+ attribution.
190
+
191
+ Original contributions (sandbox, clitic, GitHub Pages site) are copyright (c) 2025-2026
192
+ SheepSeb. The project as a whole is distributed under the Apache License, Version 2.0 —
193
+ see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,160 @@
1
+ # specscore
2
+
3
+ A CLI tool that scores OpenAPI specs for AI-readiness across 6 dimensions — giving APIs a letter grade and actionable recommendations so they work well with AI agents and LLM tooling.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # With uv (recommended)
9
+ uv pip install -e .
10
+
11
+ # Or with pip
12
+ pip install -e .
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ### Scorecard
18
+
19
+ ```bash
20
+ # Score an OpenAPI spec
21
+ specscore score path/to/openapi.yaml
22
+
23
+ # Output as JSON
24
+ specscore score path/to/openapi.yaml --json
25
+
26
+ # Run against the built-in sample spec to see how scoring works
27
+ specscore demo
28
+ specscore demo --json
29
+ ```
30
+
31
+ ### Sandbox
32
+
33
+ The sandbox spins up a local mock server from your spec and auto-probes every endpoint, reporting a **feasibility score** — how well the spec can actually be exercised by an agent.
34
+
35
+ ```bash
36
+ # Start a persistent mock server (press Ctrl+C to stop)
37
+ specscore sandbox start path/to/openapi.yaml
38
+ specscore sandbox start path/to/openapi.yaml --port 9000
39
+
40
+ # Probe all endpoints and get a report
41
+ specscore sandbox probe path/to/openapi.yaml
42
+ specscore sandbox probe path/to/openapi.yaml --json
43
+
44
+ # Run against the built-in sample spec
45
+ specscore sandbox demo
46
+ specscore sandbox demo --json
47
+ ```
48
+
49
+ The `probe` command:
50
+ 1. Starts an internal mock server
51
+ 2. Generates synthetic request payloads and path parameters from the spec's schemas
52
+ 3. Fires requests at every operation
53
+ 4. Reports per-endpoint status codes, response times, and any issues found
54
+ 5. Exits with code `2` if the feasibility score is below 50%
55
+
56
+ ### Exit codes
57
+
58
+ | Code | Meaning |
59
+ |------|---------|
60
+ | `0` | Success / score ≥ threshold |
61
+ | `1` | Error reading or parsing the spec |
62
+ | `2` | Score below threshold (< 60 for scorecard, < 50% for sandbox) |
63
+
64
+ ## What gets scored
65
+
66
+ Each spec is evaluated across 6 weighted dimensions:
67
+
68
+ | Dimension | Weight | What it checks |
69
+ |-----------|--------|----------------|
70
+ | **Foundational Compliance** | 20% | OpenAPI version, `info` object, paths defined, spec validity |
71
+ | **Developer Experience** | 15% | Operation IDs, summaries, request/response examples, parameter descriptions |
72
+ | **AI-Readiness & Agent Experience** | 20% | Meaningful descriptions, error responses (4xx/5xx), response schemas, schema property descriptions |
73
+ | **Agent Usability** | 20% | Semantic operation IDs, tag usage, parameter schemas, request body documentation |
74
+ | **Security & Governance** | 15% | Security schemes defined, operations secured, auth documentation |
75
+ | **AI Discoverability** | 10% | API-level description, tags defined, external docs |
76
+
77
+ ### Grading
78
+
79
+ | Score | Grade |
80
+ |-------|-------|
81
+ | 90–100 | A |
82
+ | 80–89 | B |
83
+ | 70–79 | C |
84
+ | 60–69 | D |
85
+ | < 60 | F |
86
+
87
+ ## Example output
88
+
89
+ ```
90
+ ╭─ specscore · OpenAPI AI readiness ───────────────────────────╮
91
+ │ Task Manager API v1.0.0 │
92
+ │ sample_spec.yaml │
93
+ │ │
94
+ │ Overall Score: 42.3/100 Grade: F │
95
+ ╰────────────────────────────────────────────────────────────────╯
96
+
97
+ ╭──────────────────────────────────┬───────────┬───────┬──────────────────────────┬────────╮
98
+ │ Dimension │ Score │ Grade │ Progress │ Issues │
99
+ ├──────────────────────────────────┼───────────┼───────┼──────────────────────────┼────────┤
100
+ │ Foundational Compliance │ 75.0/100 │ C │ ███████████████░░░░░ │ 1 │
101
+ │ Developer Experience │ 38.5/100 │ F │ ███████░░░░░░░░░░░░░░ │ 3 │
102
+ │ AI-Readiness & Agent Experience │ 31.2/100 │ F │ ██████░░░░░░░░░░░░░░░ │ 4 │
103
+ │ ... │ ... │ ... │ ... │ ... │
104
+ ╰──────────────────────────────────┴───────────┴───────┴──────────────────────────┴────────╯
105
+
106
+ Issues & Recommendations
107
+
108
+ AI-Readiness & Agent Experience
109
+ x 4/6 operations lack descriptive intent (need >30 char description)
110
+ paths.*.*.description
111
+ ! 5/6 operations have no documented error responses (4xx/5xx) — agents cannot handle failure gracefully
112
+ paths.*.*.responses
113
+ ```
114
+
115
+ ## JSON output
116
+
117
+ Pass `--json` to get a machine-readable report:
118
+
119
+ ```bash
120
+ specscore score openapi.yaml --json | jq '.overall_score'
121
+ ```
122
+
123
+ ```json
124
+ {
125
+ "api_name": "Task Manager API",
126
+ "api_version": "1.0.0",
127
+ "spec_path": "openapi.yaml",
128
+ "overall_score": 42.3,
129
+ "grade": "F",
130
+ "dimensions": [
131
+ {
132
+ "name": "Foundational Compliance",
133
+ "score": 75.0,
134
+ "grade": "C",
135
+ "issues": [...]
136
+ }
137
+ ]
138
+ }
139
+ ```
140
+
141
+ ## Development
142
+
143
+ ```bash
144
+ # Install with dev dependencies
145
+ uv pip install -e .
146
+
147
+ # Run directly without installing
148
+ python main.py score path/to/spec.yaml
149
+ ```
150
+
151
+ ## License
152
+
153
+ The scorecard scoring model in this project (`scorecard/` package) is derived from the
154
+ [Jentic API AI-Readiness Framework (JAIRF)](https://jentic.com), which is licensed under
155
+ the Apache License, Version 2.0. See the [NOTICE](NOTICE) file for the required upstream
156
+ attribution.
157
+
158
+ Original contributions (sandbox, clitic, GitHub Pages site) are copyright (c) 2025-2026
159
+ SheepSeb. The project as a whole is distributed under the Apache License, Version 2.0 —
160
+ see the [LICENSE](LICENSE) file for details.
File without changes