milieu-cli 0.3.2 → 0.4.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 +177 -76
- package/dist/bridges/context/agents-json.d.ts +0 -1
- package/dist/bridges/context/agents-json.js +21 -12
- package/dist/bridges/context/auth-clarity.d.ts +0 -1
- package/dist/bridges/context/auth-clarity.js +11 -9
- package/dist/bridges/context/auth-legibility.d.ts +2 -2
- package/dist/bridges/context/auth-legibility.js +67 -60
- package/dist/bridges/context/index.d.ts +1 -2
- package/dist/bridges/context/index.js +19 -40
- package/dist/bridges/context/oauth-metadata.d.ts +14 -0
- package/dist/bridges/context/oauth-metadata.js +127 -0
- package/dist/bridges/context/probe.d.ts +33 -0
- package/dist/bridges/context/probe.js +157 -0
- package/dist/bridges/context/rate-limits.d.ts +5 -2
- package/dist/bridges/context/rate-limits.js +27 -51
- package/dist/bridges/context/tos-contact.d.ts +13 -4
- package/dist/bridges/context/tos-contact.js +108 -46
- package/dist/bridges/context/versioning.d.ts +1 -2
- package/dist/bridges/context/versioning.js +42 -7
- package/dist/bridges/index.d.ts +0 -1
- package/dist/bridges/index.js +0 -1
- package/dist/bridges/reachability/crawler-policy.d.ts +30 -10
- package/dist/bridges/reachability/crawler-policy.js +41 -56
- package/dist/bridges/reachability/http-status.d.ts +3 -2
- package/dist/bridges/reachability/http-status.js +18 -3
- package/dist/bridges/reachability/https-check.d.ts +2 -2
- package/dist/bridges/reachability/https-check.js +6 -3
- package/dist/bridges/reachability/index.d.ts +1 -2
- package/dist/bridges/reachability/index.js +34 -43
- package/dist/bridges/reachability/meta-robots.d.ts +0 -13
- package/dist/bridges/reachability/meta-robots.js +89 -101
- package/dist/bridges/reachability/robots-parser.d.ts +7 -7
- package/dist/bridges/reachability/robots-parser.js +65 -15
- package/dist/bridges/reachability/robots-txt.d.ts +4 -2
- package/dist/bridges/reachability/robots-txt.js +33 -60
- package/dist/bridges/schema/descriptions.d.ts +2 -2
- package/dist/bridges/schema/descriptions.js +79 -44
- package/dist/bridges/schema/error-schemas.d.ts +2 -2
- package/dist/bridges/schema/error-schemas.js +31 -18
- package/dist/bridges/schema/index.d.ts +2 -2
- package/dist/bridges/schema/index.js +48 -30
- package/dist/bridges/schema/oas-types.d.ts +65 -26
- package/dist/bridges/schema/oas-types.js +37 -7
- package/dist/bridges/schema/operation-ids.d.ts +2 -2
- package/dist/bridges/schema/operation-ids.js +2 -3
- package/dist/bridges/schema/required-fields.d.ts +2 -2
- package/dist/bridges/schema/required-fields.js +12 -10
- package/dist/bridges/schema/schema-sources.d.ts +19 -0
- package/dist/bridges/schema/schema-sources.js +182 -0
- package/dist/bridges/schema/schema-types.d.ts +2 -2
- package/dist/bridges/schema/schema-types.js +20 -21
- package/dist/bridges/separation/api-presence.d.ts +3 -15
- package/dist/bridges/separation/api-presence.js +34 -85
- package/dist/bridges/separation/developer-docs.d.ts +6 -18
- package/dist/bridges/separation/developer-docs.js +100 -99
- package/dist/bridges/separation/docs-discovery.d.ts +28 -0
- package/dist/bridges/separation/docs-discovery.js +95 -0
- package/dist/bridges/separation/evidence-summary.d.ts +2 -0
- package/dist/bridges/separation/evidence-summary.js +67 -0
- package/dist/bridges/separation/index.d.ts +2 -19
- package/dist/bridges/separation/index.js +35 -39
- package/dist/bridges/separation/published-routes.d.ts +69 -0
- package/dist/bridges/separation/published-routes.js +271 -0
- package/dist/bridges/separation/sdk-references.d.ts +8 -3
- package/dist/bridges/separation/sdk-references.js +86 -61
- package/dist/bridges/separation/webhook-support.d.ts +3 -23
- package/dist/bridges/separation/webhook-support.js +61 -162
- package/dist/bridges/standards/a2a-agent-card.d.ts +0 -1
- package/dist/bridges/standards/a2a-agent-card.js +24 -9
- package/dist/bridges/standards/graphql.d.ts +3 -4
- package/dist/bridges/standards/graphql.js +70 -66
- package/dist/bridges/standards/index.d.ts +1 -2
- package/dist/bridges/standards/index.js +57 -47
- package/dist/bridges/standards/json-ld.d.ts +25 -11
- package/dist/bridges/standards/json-ld.js +114 -56
- package/dist/bridges/standards/llms-txt.d.ts +4 -2
- package/dist/bridges/standards/llms-txt.js +46 -32
- package/dist/bridges/standards/markdown-negotiation.d.ts +4 -1
- package/dist/bridges/standards/markdown-negotiation.js +16 -11
- package/dist/bridges/standards/mcp.d.ts +3 -12
- package/dist/bridges/standards/mcp.js +89 -132
- package/dist/bridges/standards/openapi.d.ts +7 -15
- package/dist/bridges/standards/openapi.js +657 -207
- package/dist/bridges/standards/probe-evidence.d.ts +30 -0
- package/dist/bridges/standards/probe-evidence.js +90 -0
- package/dist/bridges/standards/schema-org.d.ts +15 -9
- package/dist/bridges/standards/schema-org.js +38 -64
- package/dist/bridges/standards/sitemap.d.ts +2 -3
- package/dist/bridges/standards/sitemap.js +161 -169
- package/dist/bridges/standards/well-known.d.ts +3 -7
- package/dist/bridges/standards/well-known.js +28 -12
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +107 -22
- package/dist/cli/journey-commands.d.ts +3 -0
- package/dist/cli/journey-commands.js +35 -0
- package/dist/cli/read-report.d.ts +2 -0
- package/dist/cli/read-report.js +11 -0
- package/dist/core/bridge-output.d.ts +11 -0
- package/dist/core/bridge-output.js +86 -0
- package/dist/core/bridge-session.d.ts +28 -0
- package/dist/core/bridge-session.js +58 -0
- package/dist/core/bridge-worker.d.ts +1 -0
- package/dist/core/bridge-worker.js +66 -0
- package/dist/core/diff.d.ts +79 -0
- package/dist/core/diff.js +499 -0
- package/dist/core/explanations.d.ts +1 -3
- package/dist/core/explanations.js +36 -59
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.js +2 -3
- package/dist/core/scan-options.d.ts +0 -1
- package/dist/core/scan-options.js +14 -6
- package/dist/core/scan.d.ts +0 -1
- package/dist/core/scan.js +91 -41
- package/dist/core/scoring.d.ts +6 -0
- package/dist/core/scoring.js +27 -0
- package/dist/core/types.d.ts +97 -61
- package/dist/core/types.js +9 -3
- package/dist/core/validate-report.d.ts +5 -0
- package/dist/core/validate-report.js +95 -0
- package/dist/core/version.d.ts +0 -1
- package/dist/core/version.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/journey/body-worker.d.ts +27 -0
- package/dist/journey/body-worker.js +140 -0
- package/dist/journey/case.d.ts +74 -0
- package/dist/journey/case.js +187 -0
- package/dist/journey/cli.d.ts +14 -0
- package/dist/journey/cli.js +226 -0
- package/dist/journey/compare.d.ts +43 -0
- package/dist/journey/compare.js +83 -0
- package/dist/journey/contracts.d.ts +143 -0
- package/dist/journey/contracts.js +37 -0
- package/dist/journey/decision.d.ts +72 -0
- package/dist/journey/decision.js +121 -0
- package/dist/journey/demo.d.ts +36 -0
- package/dist/journey/demo.js +137 -0
- package/dist/journey/document.d.ts +8 -0
- package/dist/journey/document.js +113 -0
- package/dist/journey/excerpt.d.ts +6 -0
- package/dist/journey/excerpt.js +54 -0
- package/dist/journey/name-guidance.d.ts +2 -0
- package/dist/journey/name-guidance.js +41 -0
- package/dist/journey/providers.d.ts +34 -0
- package/dist/journey/providers.js +197 -0
- package/dist/journey/report-validation.d.ts +3 -0
- package/dist/journey/report-validation.js +457 -0
- package/dist/journey/runner.d.ts +12 -0
- package/dist/journey/runner.js +321 -0
- package/dist/journey/scope.d.ts +8 -0
- package/dist/journey/scope.js +50 -0
- package/dist/journey/transport.d.ts +3 -0
- package/dist/journey/transport.js +45 -0
- package/dist/journey/verify.d.ts +21 -0
- package/dist/journey/verify.js +213 -0
- package/dist/render/colors.d.ts +6 -7
- package/dist/render/colors.js +16 -25
- package/dist/render/discovery-guidance.d.ts +3 -0
- package/dist/render/discovery-guidance.js +66 -0
- package/dist/render/format-bridge.d.ts +1 -2
- package/dist/render/format-bridge.js +22 -17
- package/dist/render/format-diff.d.ts +2 -0
- package/dist/render/format-diff.js +169 -0
- package/dist/render/format-scan.d.ts +0 -1
- package/dist/render/format-scan.js +6 -4
- package/dist/render/format-verbose.d.ts +0 -1
- package/dist/render/format-verbose.js +7 -4
- package/dist/render/index.d.ts +0 -1
- package/dist/render/index.js +1 -2
- package/dist/render/oauth-observations.d.ts +4 -0
- package/dist/render/oauth-observations.js +27 -0
- package/dist/render/progress-bar.d.ts +1 -2
- package/dist/render/progress-bar.js +8 -6
- package/dist/render/robots-inventory.d.ts +3 -0
- package/dist/render/robots-inventory.js +38 -0
- package/dist/render/symbols.d.ts +4 -10
- package/dist/render/symbols.js +15 -17
- package/dist/render/terminal-text.d.ts +1 -3
- package/dist/render/terminal-text.js +1 -5
- package/dist/utils/analysis-worker-entry.d.ts +3 -0
- package/dist/utils/analysis-worker-entry.js +12 -0
- package/dist/utils/analysis-worker.d.ts +12 -0
- package/dist/utils/analysis-worker.js +54 -0
- package/dist/utils/html.d.ts +39 -0
- package/dist/utils/html.js +261 -0
- package/dist/utils/http-client.d.ts +24 -17
- package/dist/utils/http-client.js +166 -200
- package/dist/utils/http-types.d.ts +43 -0
- package/dist/utils/http-types.js +11 -0
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/package-registry.d.ts +11 -0
- package/dist/utils/package-registry.js +69 -0
- package/dist/utils/read-json-file.d.ts +3 -0
- package/dist/utils/read-json-file.js +41 -0
- package/dist/utils/record.d.ts +1 -0
- package/dist/utils/record.js +3 -0
- package/dist/utils/response-body.d.ts +7 -0
- package/dist/utils/response-body.js +71 -0
- package/dist/utils/ssrf.d.ts +11 -15
- package/dist/utils/ssrf.js +80 -44
- package/dist/utils/terminal-text.d.ts +2 -0
- package/dist/utils/terminal-text.js +4 -0
- package/dist/utils/url.d.ts +29 -1
- package/dist/utils/url.js +147 -17
- package/docs/examples/onboarding/account-claim.json +25 -0
- package/docs/examples/onboarding/pages/account-claim.html +3 -0
- package/docs/examples/onboarding/pages/production-activation.html +3 -0
- package/docs/examples/onboarding/pages/test-credential.html +3 -0
- package/docs/examples/onboarding/production-activation.json +25 -0
- package/docs/examples/onboarding/test-credential.json +25 -0
- package/docs/journey-qualification.md +46 -0
- package/docs/journeys.md +83 -0
- package/package.json +28 -8
- package/dist/bridges/context/agents-json.d.ts.map +0 -1
- package/dist/bridges/context/agents-json.js.map +0 -1
- package/dist/bridges/context/auth-clarity.d.ts.map +0 -1
- package/dist/bridges/context/auth-clarity.js.map +0 -1
- package/dist/bridges/context/auth-legibility.d.ts.map +0 -1
- package/dist/bridges/context/auth-legibility.js.map +0 -1
- package/dist/bridges/context/index.d.ts.map +0 -1
- package/dist/bridges/context/index.js.map +0 -1
- package/dist/bridges/context/rate-limits.d.ts.map +0 -1
- package/dist/bridges/context/rate-limits.js.map +0 -1
- package/dist/bridges/context/tos-contact.d.ts.map +0 -1
- package/dist/bridges/context/tos-contact.js.map +0 -1
- package/dist/bridges/context/versioning.d.ts.map +0 -1
- package/dist/bridges/context/versioning.js.map +0 -1
- package/dist/bridges/index.d.ts.map +0 -1
- package/dist/bridges/index.js.map +0 -1
- package/dist/bridges/reachability/crawler-policy.d.ts.map +0 -1
- package/dist/bridges/reachability/crawler-policy.js.map +0 -1
- package/dist/bridges/reachability/http-status.d.ts.map +0 -1
- package/dist/bridges/reachability/http-status.js.map +0 -1
- package/dist/bridges/reachability/https-check.d.ts.map +0 -1
- package/dist/bridges/reachability/https-check.js.map +0 -1
- package/dist/bridges/reachability/index.d.ts.map +0 -1
- package/dist/bridges/reachability/index.js.map +0 -1
- package/dist/bridges/reachability/meta-robots.d.ts.map +0 -1
- package/dist/bridges/reachability/meta-robots.js.map +0 -1
- package/dist/bridges/reachability/robots-parser.d.ts.map +0 -1
- package/dist/bridges/reachability/robots-parser.js.map +0 -1
- package/dist/bridges/reachability/robots-txt.d.ts.map +0 -1
- package/dist/bridges/reachability/robots-txt.js.map +0 -1
- package/dist/bridges/schema/descriptions.d.ts.map +0 -1
- package/dist/bridges/schema/descriptions.js.map +0 -1
- package/dist/bridges/schema/error-schemas.d.ts.map +0 -1
- package/dist/bridges/schema/error-schemas.js.map +0 -1
- package/dist/bridges/schema/index.d.ts.map +0 -1
- package/dist/bridges/schema/index.js.map +0 -1
- package/dist/bridges/schema/oas-types.d.ts.map +0 -1
- package/dist/bridges/schema/oas-types.js.map +0 -1
- package/dist/bridges/schema/operation-ids.d.ts.map +0 -1
- package/dist/bridges/schema/operation-ids.js.map +0 -1
- package/dist/bridges/schema/required-fields.d.ts.map +0 -1
- package/dist/bridges/schema/required-fields.js.map +0 -1
- package/dist/bridges/schema/schema-types.d.ts.map +0 -1
- package/dist/bridges/schema/schema-types.js.map +0 -1
- package/dist/bridges/separation/api-presence.d.ts.map +0 -1
- package/dist/bridges/separation/api-presence.js.map +0 -1
- package/dist/bridges/separation/developer-docs.d.ts.map +0 -1
- package/dist/bridges/separation/developer-docs.js.map +0 -1
- package/dist/bridges/separation/index.d.ts.map +0 -1
- package/dist/bridges/separation/index.js.map +0 -1
- package/dist/bridges/separation/sdk-references.d.ts.map +0 -1
- package/dist/bridges/separation/sdk-references.js.map +0 -1
- package/dist/bridges/separation/webhook-support.d.ts.map +0 -1
- package/dist/bridges/separation/webhook-support.js.map +0 -1
- package/dist/bridges/standards/a2a-agent-card.d.ts.map +0 -1
- package/dist/bridges/standards/a2a-agent-card.js.map +0 -1
- package/dist/bridges/standards/graphql.d.ts.map +0 -1
- package/dist/bridges/standards/graphql.js.map +0 -1
- package/dist/bridges/standards/index.d.ts.map +0 -1
- package/dist/bridges/standards/index.js.map +0 -1
- package/dist/bridges/standards/json-ld.d.ts.map +0 -1
- package/dist/bridges/standards/json-ld.js.map +0 -1
- package/dist/bridges/standards/llms-txt.d.ts.map +0 -1
- package/dist/bridges/standards/llms-txt.js.map +0 -1
- package/dist/bridges/standards/markdown-negotiation.d.ts.map +0 -1
- package/dist/bridges/standards/markdown-negotiation.js.map +0 -1
- package/dist/bridges/standards/mcp.d.ts.map +0 -1
- package/dist/bridges/standards/mcp.js.map +0 -1
- package/dist/bridges/standards/openapi.d.ts.map +0 -1
- package/dist/bridges/standards/openapi.js.map +0 -1
- package/dist/bridges/standards/schema-org.d.ts.map +0 -1
- package/dist/bridges/standards/schema-org.js.map +0 -1
- package/dist/bridges/standards/sitemap.d.ts.map +0 -1
- package/dist/bridges/standards/sitemap.js.map +0 -1
- package/dist/bridges/standards/well-known.d.ts.map +0 -1
- package/dist/bridges/standards/well-known.js.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/core/explanations.d.ts.map +0 -1
- package/dist/core/explanations.js.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/scan-options.d.ts.map +0 -1
- package/dist/core/scan-options.js.map +0 -1
- package/dist/core/scan.d.ts.map +0 -1
- package/dist/core/scan.js.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js.map +0 -1
- package/dist/core/version.d.ts.map +0 -1
- package/dist/core/version.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/render/colors.d.ts.map +0 -1
- package/dist/render/colors.js.map +0 -1
- package/dist/render/format-bridge.d.ts.map +0 -1
- package/dist/render/format-bridge.js.map +0 -1
- package/dist/render/format-scan.d.ts.map +0 -1
- package/dist/render/format-scan.js.map +0 -1
- package/dist/render/format-verbose.d.ts.map +0 -1
- package/dist/render/format-verbose.js.map +0 -1
- package/dist/render/index.d.ts.map +0 -1
- package/dist/render/index.js.map +0 -1
- package/dist/render/progress-bar.d.ts.map +0 -1
- package/dist/render/progress-bar.js.map +0 -1
- package/dist/render/symbols.d.ts.map +0 -1
- package/dist/render/symbols.js.map +0 -1
- package/dist/render/terminal-text.d.ts.map +0 -1
- package/dist/render/terminal-text.js.map +0 -1
- package/dist/utils/http-client.d.ts.map +0 -1
- package/dist/utils/http-client.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/ssrf.d.ts.map +0 -1
- package/dist/utils/ssrf.js.map +0 -1
- package/dist/utils/url.d.ts.map +0 -1
- package/dist/utils/url.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,73 +1,83 @@
|
|
|
1
1
|
# milieu-cli
|
|
2
2
|
|
|
3
|
+
[](https://npminsights.vercel.app/package/milieu-cli)
|
|
4
|
+
[](https://www.npmjs.com/package/milieu-cli?activeTab=versions)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://github.com/simplyarun/milieu-cli/actions/workflows/ci.yml?query=branch%3Amain+event%3Apush)
|
|
7
|
+
|
|
3
8
|
The API is the new product UI. Your customers are no longer just humans. They're AI agents, LLM pipelines, and automated workflows. These customers don't browse your marketing site or read your docs the way people do. They parse your machine-readable signals, probe your endpoints, and decide in milliseconds whether your product is usable.
|
|
4
9
|
|
|
5
10
|
As an industry, we've spent decades perfecting UI & UX design for humans. Now we need the same rigor for the interface AI agents actually see: your product's **milieu**.
|
|
6
11
|
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
Use Node.js 22.19.0 or newer. Replace the example URL with your own public site.
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npx milieu-cli scan https://your-site.example
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
You'll get a scored report showing what agents can discover about your product. Add `--verbose` to see the individual checks. No API key is required. To see what happens when an agent tries to use a product, try the [Journeys demo](#journeys).
|
|
21
|
+
|
|
7
22
|
## Table of contents
|
|
8
23
|
|
|
9
|
-
- [What is milieu?](#what-is-milieu)
|
|
10
24
|
- [Quick start](#quick-start)
|
|
25
|
+
- [Journeys](#journeys)
|
|
26
|
+
- [What is milieu?](#what-is-milieu)
|
|
11
27
|
- [The 5 Bridges](#the-5-bridges)
|
|
12
28
|
- [Install](#install)
|
|
13
29
|
- [CI/CD integration](#cicd-integration)
|
|
30
|
+
- [Use scan JSON from an agent](#use-scan-json-from-an-agent)
|
|
31
|
+
- [Compare two releases](#compare-two-releases)
|
|
14
32
|
- [Options](#options)
|
|
15
33
|
- [How scoring works](#how-scoring-works)
|
|
16
34
|
- [Programmatic API](#programmatic-api)
|
|
17
35
|
- [Requirements](#requirements)
|
|
18
36
|
- [License](#license)
|
|
19
37
|
|
|
20
|
-
##
|
|
38
|
+
## Journeys
|
|
21
39
|
|
|
22
|
-
|
|
40
|
+
**Can an agent follow your quickstart and retrieve its first catalog item?** A Journey tests a task like this against your docs and API. You define what success looks like. Milieu records the pages and responses the agent used and shows which checks passed or failed.
|
|
23
41
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
milieu-cli measures this. It scans your product surface and tells you what AI agents can actually see.
|
|
42
|
+
**Try the demo.** Run a scripted agent through a sample quickstart.
|
|
27
43
|
|
|
28
|
-
```
|
|
29
|
-
npx milieu-cli
|
|
44
|
+
```sh
|
|
45
|
+
npx milieu-cli journey demo
|
|
30
46
|
```
|
|
31
47
|
|
|
32
|
-
|
|
33
|
-
# Gate your pipeline on agent-readiness
|
|
34
|
-
milieu scan api.example.com --threshold 70
|
|
35
|
-
```
|
|
48
|
+
`npx` fetches Milieu if needed. The demo then runs offline. Look for `catalog-quickstart / docs-missing`. The agent gets stuck because the guide omits `GET /v1/items`. The line `Direct API control: pass` tells you the endpoint works. Adding the missing instruction fixes the guide.
|
|
36
49
|
|
|
37
|
-
|
|
50
|
+
**Try it on your own product**
|
|
38
51
|
|
|
39
|
-
|
|
52
|
+
1. Create a case with `npx milieu-cli journey init catalog.json --kind api_read`.
|
|
53
|
+
2. Edit `catalog.json`. Write the task in `prompt`. Point `targets.baseline` and `startPath` at your public test deployment and its starting page. Set the permitted paths in `scope` and the expected result in `expect`. Use synthetic data.
|
|
54
|
+
3. With [Ollama set up](docs/journeys.md#run-with-a-model), replace `YOUR_MODEL` with an installed model name and run the case. Rerun it after a docs or API change to see whether the task still passes.
|
|
40
55
|
|
|
41
|
-
```
|
|
42
|
-
npx milieu-cli
|
|
56
|
+
```sh
|
|
57
|
+
npx milieu-cli journey run catalog.json --target baseline --provider ollama --model YOUR_MODEL
|
|
43
58
|
```
|
|
44
59
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
| Journey command | Purpose and options |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| `demo` | Run scripted fixtures offline. |
|
|
63
|
+
| `init <file> --kind <kind>` | Create a new case of kind `grounded_answer` or `api_read`. |
|
|
64
|
+
| `validate <file>` | Check a case and its targets offline. |
|
|
65
|
+
| `doctor` | Check setup. Supply `--provider`, `--model` and `--probe` to send a synthetic request. |
|
|
66
|
+
| `run <file>` | Select `--target`, `--model` and either `--provider ollama` or `--provider openai`. Use `--repeat <n>` for 1 to 10 fresh attempts. The default is one. |
|
|
67
|
+
| `inspect <report>` | Read a saved run. Add `--verbose` for its assertion and event trace. |
|
|
68
|
+
| `compare <base> <candidate>` | Compare compatible reports. Add `--gate` to enforce the direct API control. |
|
|
50
69
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
# The classic OpenAPI demo — Swagger spec at a well-known path
|
|
55
|
-
npx milieu-cli scan petstore.swagger.io
|
|
70
|
+
Every Journey command accepts `--json`. For example, `milieu journey run --help --json` returns a version 1 `journey_help` document with the help text in its `help` field. A live run with measured outcomes exits 0 even when an assertion fails. Ineligible comparisons, setup errors and entirely inconclusive runs exit 2. A gated direct-control regression exits 1. An interrupted live run exits 130 for SIGINT or 143 for SIGTERM.
|
|
56
71
|
|
|
57
|
-
|
|
58
|
-
npx milieu-cli scan schema.org
|
|
72
|
+
The [Journey guide](docs/journeys.md) covers case authoring and includes three credential-onboarding examples. The [maintainer qualification guide](docs/journey-qualification.md) covers fixture deployment, model runs and release checks.
|
|
59
73
|
|
|
60
|
-
|
|
61
|
-
npx milieu-cli scan httpbin.org
|
|
62
|
-
```
|
|
74
|
+
## What is milieu?
|
|
63
75
|
|
|
64
|
-
|
|
76
|
+
*Milieu* is the totality of machine-readable signals that surround your product — the environment an AI agent encounters when it tries to discover, understand, and integrate with what you've built. It's not any single file or endpoint. It's robots.txt and OpenAPI specs and llms.txt and JSON-LD and developer docs and SDK references, all working together. It's the difference between a product that AI agents can use and one they walk past.
|
|
65
77
|
|
|
66
|
-
|
|
67
|
-
npx milieu-cli scan petstore.swagger.io --verbose
|
|
68
|
-
```
|
|
78
|
+
Good design made products usable for humans. Good milieu design makes products usable for agents.
|
|
69
79
|
|
|
70
|
-
|
|
80
|
+
milieu-cli measures this. It scans your product surface and tells you what AI agents can actually see.
|
|
71
81
|
|
|
72
82
|
## The 5 Bridges
|
|
73
83
|
|
|
@@ -75,13 +85,13 @@ Milieu evaluates your product through five progressive bridges. Each one represe
|
|
|
75
85
|
|
|
76
86
|
| | Bridge | Question | What milieu checks | Score |
|
|
77
87
|
|---|---|---|---|---|
|
|
78
|
-
| 1 | **Reachability** | **Can agents reach you?** | HTTPS, HTTP status, robots.txt (RFC 9309), per-bot crawler policies (GPTBot, ClaudeBot, CCBot,
|
|
88
|
+
| 1 | **Reachability** | **Can agents reach you?** | HTTPS, HTTP status, robots.txt (RFC 9309), per-bot crawler policies (GPTBot, ClaudeBot, CCBot, Google-Extended, Applebot-Extended, PerplexityBot), meta robots, X-Robots-Tag | 0–100 |
|
|
79
89
|
| 2 | **Standards** | **Can agents read you?** | OpenAPI spec, GraphQL introspection, XML sitemap, markdown content negotiation, llms.txt, llms-full.txt, MCP discovery, JSON-LD, Schema.org, security.txt, A2A Agent Card | 0–100 |
|
|
80
90
|
| 3 | **Separation** | **Can agents integrate with you?** | API endpoints, developer docs, SDK/package references, webhook support | Detection only* |
|
|
81
91
|
| 4 | **Schema** | **Can agents use your APIs correctly?** | Operation IDs, schema types, error response schemas, required fields, field descriptions | 0–100 |
|
|
82
92
|
| 5 | **Context** | **Can agents trust and operate your APIs?** | Rate-limit headers, auth clarity, auth legibility, Terms of Service, API versioning, contact info, agents.json | 0–100 |
|
|
83
93
|
|
|
84
|
-
*Bridge 3
|
|
94
|
+
*Bridge 3 is unscored. Its evidence summary identifies inspected contracts, published links, successful fetches, and inferred signals.
|
|
85
95
|
|
|
86
96
|
The bridges are progressive: there's no point checking your OpenAPI spec (Bridge 2) if agents can't even reach your product surface (Bridge 1). There's no point evaluating schema quality (Bridge 4) if no spec was found (Bridge 2). Each bridge builds on the last.
|
|
87
97
|
|
|
@@ -91,10 +101,20 @@ The bridges are progressive: there's no point checking your OpenAPI spec (Bridge
|
|
|
91
101
|
|
|
92
102
|
**Bridge 3 — Separation** is the developer surface. Do you have a clear API boundary? Developer docs? SDKs? Webhooks? This is where agents look to determine if your product is something they can build with, not just read from.
|
|
93
103
|
|
|
104
|
+
Use SDK and webhook detections as leads. A package registry link may name a dependency, an install command can appear in explanatory prose, and a webhook heading or link may describe an external integration. API and webhook link detection in Markdown recognizes simple inline links. Reference-style links, linked badges, titles and paths with parentheses can be missed. When scanning `app.acme.com`, a link to `docs.acme.com` appears in the external docs inventory. The scan credits links on the scanned hostname and its subdomains, treating a leading `www.` as optional.
|
|
105
|
+
|
|
94
106
|
**Bridge 4 — Schema** evaluates the quality of your OpenAPI spec from an agent's perspective. Having a spec is necessary (Bridge 2), but having a *good* spec is what lets agents actually call your API correctly. milieu checks whether your operations have `operationId` (the function name agents use), whether request/response schemas define types, whether error responses have structured schemas, whether required fields are declared, and whether fields have descriptions. When no spec is found, each check explains what the agent loses — for example, "without operation IDs, agents cannot map API capabilities to callable functions."
|
|
95
107
|
|
|
96
108
|
**Bridge 5 — Context** assesses the operational signals an agent needs to use your API reliably. This includes rate-limit headers (so agents can pace requests), API versioning (so agents can target a stable version), Terms of Service (so agents can verify permitted use), contact info, and `agents.json` at `/.well-known/`.
|
|
97
109
|
|
|
110
|
+
### Read the scanner evidence
|
|
111
|
+
|
|
112
|
+
In verbose and JSON output, a populated MCP declaration identifies advertised support. Editorial mentions appear as references. Developer documentation findings record the published link, final response and verified pages. Bridge 3 can also find an index or Markdown alternate for the docs page the homepage links, when that page is verified on the scan origin or, after a homepage redirect, its counterpart. Unrelated external docs links remain visible as external origins. On their own they do not establish developer documentation for the product.
|
|
113
|
+
|
|
114
|
+
The robots inventory groups declared rules for user-directed fetchers, search crawlers and training crawlers. The unscored OAuth inventory checks resource and issuer bindings before reporting advertised registration or device endpoints. These checks describe what the origin publishes.
|
|
115
|
+
|
|
116
|
+
Successful scan JSON includes `requestContext` with the effective timeout, concurrency limit, request cap and actual started and denied counts. Terminal, Markdown and JSON diffs identify configuration changes separately from product findings.
|
|
117
|
+
|
|
98
118
|
### Auth legibility
|
|
99
119
|
|
|
100
120
|
Bridge 5 introduces two checks that together answer: **how well does your API guide an unauthenticated agent toward successful authentication?**
|
|
@@ -108,43 +128,82 @@ An agent's first encounter with any API is unauthenticated. The agent discovers
|
|
|
108
128
|
- Structured JSON error body — the agent can parse the rejection
|
|
109
129
|
- Documentation URL in the error body — the agent can self-onboard
|
|
110
130
|
|
|
111
|
-
An API that returns `{"error": "unauthorized", "docs_url": "https://docs.example.com/auth"}` with a `WWW-Authenticate: Bearer` header scores full marks.
|
|
131
|
+
An API that returns `{"error": "unauthorized", "docs_url": "https://docs.example.com/auth"}` with a `WWW-Authenticate: Bearer` header scores full marks. A direct 401 or 403 with an HTML body and none of the three guidance signals earns zero for this check. A successful response without a challenge and an unreadable probe have different outcomes.
|
|
112
132
|
|
|
113
133
|
### Crawler policies
|
|
114
134
|
|
|
115
|
-
|
|
135
|
+
Reachability scores six robots.txt product tokens: GPTBot, ClaudeBot, CCBot, Google-Extended, Applebot-Extended and PerplexityBot. Each token uses its matching groups, with the wildcard group as fallback. The most specific matching path rule wins, with Allow winning ties. A missing robots.txt supplies no policy checks to the denominator. An unreadable or incomplete file leaves those checks unmeasured. Directory restrictions earn partial credit for each affected token, even if the directory holds no public content. With the other Reachability checks passing, a wildcard restriction on `/wp-admin/` scores 73 because it affects all six tokens. A blanket block on GPTBot alone scores 91 because it affects one. Node combines repeated X-Robots-Tag headers. If a scoped header precedes an unscoped one, the scanner can attribute both to the first agent.
|
|
116
136
|
|
|
117
|
-
|
|
118
|
-
- **Googlebot** (Google) · **Bingbot** (Microsoft) · **PerplexityBot** (Perplexity)
|
|
119
|
-
|
|
120
|
-
Each policy is checked individually — you might be allowing Googlebot but blocking GPTBot without realizing it. Use `--verbose` to see per-bot results.
|
|
137
|
+
GPTBot and ClaudeBot collect training material. CCBot collects material for Common Crawl. PerplexityBot supports search. Google-Extended controls use of crawled content for eligible training and grounding. Applebot-Extended controls use for model training. The verbose inventory also shows declarations for user-directed and search fetchers. [Google product-token documentation](https://developers.google.com/crawling/docs/google-extended) and [Applebot documentation](https://support.apple.com/en-ie/119829).
|
|
121
138
|
|
|
122
139
|
## Install
|
|
123
140
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
141
|
+
For a one-off run, use `npx milieu-cli` as in the quick start. To use the same version for baseline scans, comparisons and CI, pin it in your project.
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
npm install --save-dev --save-exact milieu-cli@0.4.0
|
|
128
145
|
```
|
|
129
146
|
|
|
130
|
-
|
|
147
|
+
After installation, `npx milieu-cli` uses the project’s copy. Commit the package manifest and lockfile, then run `npm ci` in CI. For a global install, use `npm install -g milieu-cli`. Both `milieu` and `milieu-cli` work as commands after installation.
|
|
131
148
|
|
|
132
149
|
## CI/CD integration
|
|
133
150
|
|
|
134
|
-
|
|
151
|
+
After installing Milieu in your project, set `ORIGIN` to your public site and choose a minimum score for your product.
|
|
135
152
|
|
|
136
153
|
```bash
|
|
137
|
-
|
|
138
|
-
milieu scan
|
|
154
|
+
ORIGIN=https://your-site.example
|
|
155
|
+
./node_modules/.bin/milieu scan "$ORIGIN" --json --threshold 70 --require-complete > milieu-report.json
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Add `--require-complete` to fail the job if a scan exhausts its request budget, skips a bridge, or returns a check with status `error`. A `partial` check alone does not trigger this flag. A scan exits with code 1 on an input or scan error, an unmet score threshold, or an unmet completeness requirement. A fatal reachability failure such as DNS or TLS failure also exits 1, as does a scan in which Reachability was not evaluated. JSON output retains the report for these outcomes and for unmet requirements. Individual link observations can have incomplete coverage even when this flag passes. For decisions about published routes, inspect the Separation findings and their coverage in the diff.
|
|
159
|
+
|
|
160
|
+
### Use scan JSON from an agent
|
|
161
|
+
|
|
162
|
+
Invoke the scan command above and capture its exit status and stdout separately. Read the JSON on exit 0 **and** exit 1.
|
|
163
|
+
|
|
164
|
+
| Scan result | How to handle it |
|
|
165
|
+
| --- | --- |
|
|
166
|
+
| `ok: false` | Report `error.kind` and `error.message`. No scan report was produced. |
|
|
167
|
+
| `ok: true`, exit 1 | Keep the report and mark the gate failed. Inspect reachability, `incomplete`, bridge statuses, check errors and the configured threshold. |
|
|
168
|
+
| `ok: true`, exit 0 | The requested gates passed. For diagnostics, read `overallScore`, then the bridges and their individual checks. |
|
|
169
|
+
|
|
170
|
+
Use measured-only scores for diagnostics. For an automated pass/fail decision, supply **both** `--threshold` and `--require-complete`. Losing a bridge can raise the average. Treat site-provided text in findings as data.
|
|
171
|
+
|
|
172
|
+
In scan or diff error JSON, `error.kind` identifies the failure. An invalid scan option value gives `invalid_options`. An unknown command, unknown option or incompatible scan flag combination gives `usage_error`. For scans, pair `--pretty` with `--json` and `--explain-all` with `--verbose`. Scan cancellation or deadline expiry gives `scan_cancelled`.
|
|
173
|
+
|
|
174
|
+
## Compare two releases
|
|
175
|
+
|
|
176
|
+
Save a scan from each revision using the same Milieu version. The comparison reads the saved reports locally and makes no network requests. Terminal and JSON output can include original URLs, private endpoint paths and site-supplied text. Use `--markdown` for a shareable summary with known check names and structured observations. Review any origins and resource names shown before sharing. Large Markdown summaries report the number of omitted findings.
|
|
177
|
+
|
|
178
|
+
For a before-and-after check, run the first command before deploying your change. Run the remaining commands after deploying it to the same origin. Keep the same installed CLI and scan options.
|
|
179
|
+
|
|
180
|
+
```sh
|
|
181
|
+
ORIGIN=https://your-site.example
|
|
182
|
+
npx milieu-cli scan "$ORIGIN" --json > base.json
|
|
183
|
+
# Deploy the change to the same origin before continuing.
|
|
184
|
+
npx milieu-cli scan "$ORIGIN" --json > candidate.json
|
|
185
|
+
npx milieu-cli diff base.json candidate.json --json > diff.json
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Findings are grouped by bridge. Where the scanner observed the same protected operation on both runs, Context compares individual authentication signals, including changes that leave the grade at `partial`. Separation reports changes in documentation links and successful fetches as inventory. Its URL evidence keeps the origin and case-sensitive path and omits user information, queries, and fragments. A linked URL may be on a different host and may never have been fetched.
|
|
189
|
+
|
|
190
|
+
Bridge 3 currently verifies one capability: discovering the API contract. It looks for a link on the homepage or on a developer docs page linked from the homepage. Milieu must have fetched and parsed the contract. A published API catalog also counts as a route when its link led Milieu to the document. Guessing a conventional spec URL verifies the document but supplies no evidence of a published link. If both scans inspect the same contract and cover those entry pages, losing the last observed route is a Separation regression. Losing an SDK reference or one of several routes changes the inventory. An unread linked page or change of contract identity makes the route comparison inconclusive. This check describes discovery of the contract. It does not exercise its business operations.
|
|
191
|
+
|
|
192
|
+
Use the same origin by default. To compare equivalent public previews with different hostnames, explicitly supply both origins in base-to-candidate order. The mapping applies only to the two origins you name. External docs hosts keep their own identity. Configure preview auth and indexing consistently.
|
|
139
193
|
|
|
140
|
-
|
|
141
|
-
milieu scan api.mycompany.com --json > milieu-report.json
|
|
194
|
+
For a GitHub Actions job with `milieu-cli` pinned in the project's lockfile, run this step after `npm ci`. Set `BASE_ORIGIN` and `CANDIDATE_ORIGIN` to the public origins of the two deployments.
|
|
142
195
|
|
|
143
|
-
|
|
144
|
-
|
|
196
|
+
```yaml
|
|
197
|
+
- name: Compare Milieu observations
|
|
198
|
+
shell: bash
|
|
199
|
+
run: |
|
|
200
|
+
./node_modules/.bin/milieu scan "$BASE_ORIGIN" --json > "$RUNNER_TEMP/milieu-base.json"
|
|
201
|
+
./node_modules/.bin/milieu scan "$CANDIDATE_ORIGIN" --json > "$RUNNER_TEMP/milieu-candidate.json"
|
|
202
|
+
./node_modules/.bin/milieu diff "$RUNNER_TEMP/milieu-base.json" "$RUNNER_TEMP/milieu-candidate.json" \
|
|
203
|
+
--map-origin "$BASE_ORIGIN=$CANDIDATE_ORIGIN" --markdown >> "$GITHUB_STEP_SUMMARY"
|
|
145
204
|
```
|
|
146
205
|
|
|
147
|
-
|
|
206
|
+
A valid comparison is advisory and exits with code 0, including when it reports regressions. Invalid files, version mismatches and undeclared origin changes exit with code 1. Each input must be a regular JSON file of up to 32 MiB. Compare older reports in same-version pairs. Missing evidence, skipped bridges and changed probe targets can make a finding inconclusive. A score or a timestamp changing on its own produces no finding.
|
|
148
207
|
|
|
149
208
|
## Options
|
|
150
209
|
|
|
@@ -154,8 +213,12 @@ Exit codes: `0` = score meets threshold (or no threshold set), `1` = score below
|
|
|
154
213
|
| `--pretty` | Pretty-print JSON (use with --json) | off |
|
|
155
214
|
| `--verbose` | Show individual check details with explanations | off |
|
|
156
215
|
| `--explain-all` | Show explanations on all checks, not just failures (use with --verbose) | off |
|
|
157
|
-
| `--timeout <ms>` |
|
|
216
|
+
| `--timeout <ms>` | Timeout for each HTTP attempt, in whole milliseconds from 1 to 2147483647. Redirects and retries can extend total elapsed time. | 10000 |
|
|
217
|
+
| `--deadline <ms>` | Maximum elapsed time for the whole scan, including retries and redirects | off |
|
|
218
|
+
| `--no-registry-lookup` | Disable sending the target hostname to APIs.guru after local OpenAPI discovery | off |
|
|
219
|
+
| `--require-complete` | Exit non-zero for request-budget exhaustion, a skipped bridge or an errored check | off |
|
|
158
220
|
| `--threshold <n>` | Exit non-zero if the score falls below n. Accepts values from 0 to 100 | off |
|
|
221
|
+
| `--no-color` | Disable colored terminal output | off |
|
|
159
222
|
| `--quiet` | Suppress terminal output | off |
|
|
160
223
|
| `--max-concurrency <n>` | Maximum simultaneous outbound requests | 8 |
|
|
161
224
|
| `--max-requests <n>` | Maximum request attempts for the whole scan, counting every redirect hop and retry. If the budget runs out, affected checks report `error` (skipped, not failed) and the result is marked `incomplete` | 150 |
|
|
@@ -168,60 +231,98 @@ These explanations also appear in `--json` output as a `why` field on every chec
|
|
|
168
231
|
|
|
169
232
|
## How scoring works
|
|
170
233
|
|
|
171
|
-
The **overall score** is the
|
|
234
|
+
The **overall score** is the rounded mean of the available numeric scores for Reachability, Standards, Schema, and Context. The terminal reports how many of those four contributed. JSON consumers can read each bridge's `score` and `status`. Separation always has `score: null`.
|
|
172
235
|
|
|
173
|
-
|
|
236
|
+
Schema distinguishes three cases.
|
|
174
237
|
|
|
175
|
-
|
|
238
|
+
| What the scan observed | Schema result | Contribution to overall |
|
|
239
|
+
|---|---|---|
|
|
240
|
+
| A parsed OpenAPI or Swagger document with readable path items | Score based on the applicable checks Milieu could evaluate | Included |
|
|
241
|
+
| Completed discovery found no valid contract | Five failed checks, score 0 | Included |
|
|
242
|
+
| A registry listing, a protected spec path, incomplete discovery, or an unreadable referenced path item | `not_evaluated`, score and label both `null` | Excluded |
|
|
243
|
+
|
|
244
|
+
A score based on three bridges can rise when a fourth becomes unmeasurable. Check coverage when comparing runs. Use `--require-complete` alongside `--threshold` when CI also requires every bridge to run, every check to return a measured status, and the scan to stay within budget.
|
|
245
|
+
|
|
246
|
+
**Bridges 1 and 4** use equal-weight scoring: each check contributes **pass = 1**, **partial = 0.5**, **fail = 0**. Bridge score = `(points / measured_applicable_checks) * 100`. Thresholds: ≥80 = pass, ≥40 = partial, <40 = fail.
|
|
176
247
|
|
|
177
248
|
**Bridges 2 and 5** use weighted scoring to reflect real-world importance to agents. In Bridge 2, core standards carry weight 2 (`openapi_spec`, `sitemap`, `llms_txt`, `security_txt`, `json_ld`, `schema_org`) and emerging standards weight 1 (GraphQL, markdown negotiation, llms-full.txt, MCP, A2A). In Bridge 5, rate-limit headers and auth checks carry more weight than contact info. Thresholds for both: ≥60 = pass, ≥30 = partial — lower because these signals are nascent.
|
|
178
249
|
|
|
179
|
-
An `error` means the scanner could not measure a check. For example, it cannot read crawler directives from an unavailable page.
|
|
250
|
+
An `error` means the scanner could not measure a check or the check had no applicable input. A read-only contract without request fields, for example, has no required-field evidence. For example, it cannot read crawler directives from an unavailable page. The scored bridges exclude these checks from their scoring denominators. The result also sets `incomplete` when the request budget denies a probe.
|
|
251
|
+
|
|
252
|
+
In JSON output, each evaluated bridge records `measurement: { measured, eligible }`, including the unscored Separation bridge. Eligible checks exclude policy skips. Measured counts the remaining checks with a status other than `error`. A bridge can score 100 with only one measured check. Use `--require-complete` when every bridge and eligible check must be measured. `incomplete` tracks request-budget exhaustion. Saved reports may omit measurement counts.
|
|
253
|
+
|
|
254
|
+
Each scan bridge has up to 60 seconds, including its HTTP requests. A bridge that exceeds its analysis time, heap or output limit is marked `not_evaluated`. The scan deadline and cancellation apply across all bridges.
|
|
255
|
+
|
|
256
|
+
Standards, Separation and Context end their HTTP requests 50 seconds into that limit and report what they measured. A request with no response by then fails as a timeout and is graded like any other request timeout, which most checks report as unmeasured. Reachability keeps the full 60 seconds for its requests, because it reads a timeout as the site being unreachable.
|
|
257
|
+
|
|
258
|
+
A value the site controls is meant to affect only the check that reads it. A reference longer than 8,192 characters is not a URL to the scanner: it is not requested, and a link, sitemap entry or declared endpoint that long is not counted. A scan target that long and otherwise valid is refused with an error that names the limit. A redirect to one is not followed. The check that sent the request is unmeasured, as it is past the five-redirect limit, and a homepage that redirects to one fails `http_status`. A request that follows no redirects, such as the API catalog probe, still reports the redirect's status. Lists the site controls are stored as bounded samples. Each has a `<field>Total` count and, when the stored list is shorter, `<field>Truncated: true`: `sitemaps` and robots `directives` in Reachability, `apiRelevantUrls` in the sitemap check, and `linkedUrls`, `externalOrigins`, `apiLinks` and `packageLinks` in Separation. Checks are graded on the full lists, with one exception. The sitemap check receives the robots.txt Sitemap lines from the start of the file that fit 1,048,576 characters together. When a URL left out is not among those it received and no sitemap is found, it reports `Sitemap discovery incomplete` instead of a miss, unless the URLs it received already used all three robots.txt sitemap probes. It reports the same when the robots.txt check is itself unmeasured: robots.txt is read to 500 KiB, and a file that is longer, interrupted or not read at all may declare a sitemap the scan did not see. A robots.txt that is absent or is not a text file still leaves a missing sitemap a measured miss. A Context value longer than 2,048 characters, such as a contact URL, keeps its finding and is left out of the report, marked with `valueOmitted`, `urlOmitted` or `emailOmitted`. `milieu diff` treats a shortened link inventory as inconclusive.
|
|
259
|
+
|
|
260
|
+
A JSON body is counted before it is parsed. One that opens more than 250,000 objects and arrays is not parsed, and the check that reads it is unmeasured: the agent card, the MCP declaration, a GraphQL answer, a JSON-LD block, the API catalog, `agents.json` or an authentication rejection. Keys that are whole numbers add to the count, so an object keyed by status codes counts as two. Context parses a JSON body of at most 262,144 characters.
|
|
261
|
+
|
|
262
|
+
An OpenAPI document that holds more than 250,000 objects and arrays by that count, or nests past about 100 levels, is too large to inspect in JSON or YAML. A YAML document is counted as the JSON it is read into, where a subtree repeated through an alias appears at every use. One of more than 393,216 nodes is too large as well, which a spec of ordinary shape reaches at about 5 MiB. `openapi_spec` is then unmeasured unless a readable spec is found at another path, and Schema is not evaluated. A body that opens with `{` is read as JSON at a YAML path too.
|
|
263
|
+
|
|
264
|
+
A page is read up to 200,000 nodes by weight: an element counts as one, an attribute as half and a text node as a quarter. A page past that, or one with a tag that holds more than 262,144 characters of names, leaves the checks that read its markup unmeasured. Separation keeps the resolved links of one page up to 2 MiB, or 16 MiB for the homepage. Past that it sets `developer_docs.linksMeasured` to false and reports a miss in `api_presence` or `sdk_references` as unmeasured.
|
|
180
265
|
|
|
181
|
-
|
|
266
|
+
Across 8,530 recorded stress scans, the scanner process completed every run. Some runs exhausted a worker and returned a partial report. A stage that exceeds its limit, and any later stage that depends on its evidence, reports `not_evaluated`. The score then averages only the measured stages. For release gates, pair `--require-complete` with `--threshold` so a partial result cannot pass on its score alone.
|
|
182
267
|
|
|
183
|
-
|
|
268
|
+
A "partial" means the signal exists but is incomplete: a 401 response with a JSON body but no `WWW-Authenticate` header, or a robots.txt with valid structure but no explicit allow/disallow rules.
|
|
184
269
|
|
|
185
|
-
|
|
270
|
+
When a contract is indicated but cannot be read, Context still credits evidence from other sources, such as an API version header. It marks unresolved contract-dependent checks as unmeasured. When completed discovery finds no contract, the existing missing-contract checks still apply.
|
|
271
|
+
|
|
272
|
+
Bridge 2 parses JSON and YAML OpenAPI documents and uses the same Schema and Context checks for both. When self-hosted discovery finds no contract, the scanner may send the hostname to the public APIs.guru registry. The lookup uses one direct request from the shared scan budget. A listing earns partial credit. A missing or unreadable registry entry preserves the first-party result. Set `--no-registry-lookup` or the library option `registryLookup: false` to disable the lookup.
|
|
273
|
+
|
|
274
|
+
JSON-LD reports count all typed graph nodes and retain a bounded sample of types and context vocabularies. The Schema.org check inspects nodes beyond that sample.
|
|
275
|
+
|
|
276
|
+
OpenAPI discovery also supports the JSON Linkset form of `/.well-known/api-catalog`. Milieu fetches up to three same-origin `service-desc` targets within the scan budget. Catalog and catalog-target requests accept direct responses only, so a redirected catalog counts as absent and a redirected target is skipped. Catalog presence adds no score of its own.
|
|
277
|
+
|
|
278
|
+
A site often answers on two origins, such as `example.com` and `www.example.com`. Milieu treats the scan origin and its counterpart as one site: the same host with or without a leading `www.`, on the same port, over the same scheme or upgraded from HTTP to HTTPS. Sitemap entries, robots.txt sitemap directives, spec links on documentation pages and the MCP declaration count on either origin. When the homepage redirects to the counterpart, developer docs discovery and the Context probes follow it. Another subdomain, another port and a downgrade to HTTP stay outside the site. `scannedOrigin` remains the origin you supplied.
|
|
279
|
+
|
|
280
|
+
Schema reads Swagger 2.0 and OpenAPI 3 request and response schemas, including supported document-local references. For operations without explicit 4xx responses, it evaluates the `default` response as the error contract. Unsupported schema composition leaves the affected checks unmeasured. A reference to another document can leave a check unmeasured. Milieu reads field evidence locally without fetching external references. JSON and YAML use the same scoring rules.
|
|
281
|
+
|
|
282
|
+
Context selects an input-free GET on the scan origin, taking the declared server into account. If the homepage redirected to the counterpart origin, the conventional `/api` fallback moves there. Documented operations move there too when the OpenAPI document was served there. A server on that origin is preferred; a contract whose servers name only the scan origin is still probed on the scan origin. The rate-limit check prefers a public operation. If rate and authentication checks select the same URL, they share the response. Rate-limit comparisons require the same declared operation, final resource and HTTP status. When a suitable operation is unavailable, the report identifies the conventional `/api` probe as a fallback.
|
|
186
283
|
|
|
187
284
|
## Programmatic API
|
|
188
285
|
|
|
189
286
|
```typescript
|
|
190
287
|
import { scan } from "milieu-cli";
|
|
191
|
-
import type {
|
|
288
|
+
import type { ScanOutcome, ScanOptions } from "milieu-cli";
|
|
192
289
|
|
|
193
290
|
const options: ScanOptions = {
|
|
194
|
-
timeout: 15000,
|
|
195
|
-
|
|
291
|
+
timeout: 15000,
|
|
292
|
+
deadlineMs: 90000,
|
|
293
|
+
registryLookup: false,
|
|
196
294
|
};
|
|
197
295
|
|
|
198
|
-
//
|
|
199
|
-
|
|
200
|
-
const outcome: ScanOutcome = await scan("https://petstore.swagger.io", options);
|
|
296
|
+
// Narrow on .ok before reading the report.
|
|
297
|
+
const outcome: ScanOutcome = await scan("https://your-site.example", options);
|
|
201
298
|
|
|
202
299
|
if (!outcome.ok) {
|
|
203
|
-
console.error(outcome.error.kind, outcome.error.message);
|
|
300
|
+
console.error(outcome.error.kind, outcome.error.message);
|
|
204
301
|
} else {
|
|
205
|
-
console.log(outcome.overallScore); // number (
|
|
302
|
+
console.log(outcome.overallScore); // number (rounded mean of available bridge scores)
|
|
206
303
|
console.log(outcome.overallScoreLabel); // "pass" | "partial" | "fail"
|
|
207
304
|
console.log(outcome.bridges); // 5-element tuple of BridgeResult
|
|
208
305
|
}
|
|
209
306
|
```
|
|
210
307
|
|
|
211
|
-
>
|
|
308
|
+
> A completed scan returns all five bridges. Filter for numeric scores to reproduce the overall denominator. Separation and unmeasured bridges have a null score.
|
|
212
309
|
>
|
|
213
310
|
> ```typescript
|
|
214
311
|
> const scoredBridges = result.bridges.filter(b => b.score !== null);
|
|
215
312
|
> ```
|
|
216
313
|
|
|
217
|
-
|
|
314
|
+
Library scans run silently by default. Pass an `AbortSignal` as `signal` for cancellation or an `onProgress(message)` callback for bridge updates. Errors thrown by the callback, and rejections of a promise it returns, are ignored. Invalid option values return `invalid_options`. Cancellation and deadline expiry return `scan_cancelled`. A reachability abort preserves the report and records `abortReason` on the first bridge.
|
|
315
|
+
|
|
316
|
+
The library includes check explanations on the scan result. Import `compareReports` to compare two successful `ScanResult` values in memory. It returns the origins, scanner version, budget flags and findings. Incompatible versions or origins raise an error. For paired previews, pass `{ originMap: { base: baseOrigin, head: candidateOrigin } }` as the third argument.
|
|
317
|
+
|
|
318
|
+
Check explanations are also available as a separate export:
|
|
218
319
|
|
|
219
320
|
```typescript
|
|
220
321
|
import { resolveExplanation } from "milieu-cli";
|
|
221
322
|
|
|
222
323
|
// Get the status-aware explanation for a check
|
|
223
324
|
const why = resolveExplanation("robots_txt", "fail");
|
|
224
|
-
|
|
325
|
+
console.log(why);
|
|
225
326
|
```
|
|
226
327
|
|
|
227
328
|
## Requirements
|
|
@@ -1,21 +1,30 @@
|
|
|
1
|
+
import { mediaType } from "../../utils/http-types.js";
|
|
2
|
+
import { OVERSIZED, isRecord, readJson, unmeasured } from "../standards/probe-evidence.js";
|
|
3
|
+
import { looksLikeHtml } from "../../utils/html.js";
|
|
1
4
|
import { httpGet } from "../../utils/http-client.js";
|
|
5
|
+
import { CONTEXT_JSON_SIZE } from "./probe.js";
|
|
2
6
|
export async function checkAgentsJson(baseUrl, timeout) {
|
|
3
7
|
const id = "context_agents_json";
|
|
4
8
|
const label = "agents.json";
|
|
5
9
|
const url = `${baseUrl}/.well-known/agents.json`;
|
|
6
10
|
const result = await httpGet(url, { timeout: Math.min(timeout ?? 10000, 3000), headers: { Accept: "application/json" } });
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
const data = { url, measured: !unmeasured(result), statusCode: result.ok ? result.status : result.error.statusCode ?? null };
|
|
12
|
+
if (unmeasured(result))
|
|
13
|
+
return { id, label, status: "error", detail: "agents.json could not be fully measured", data };
|
|
14
|
+
if (!result.ok)
|
|
15
|
+
return { id, label, status: "fail", detail: "No agents.json found at /.well-known/agents.json", data };
|
|
16
|
+
const mime = mediaType(result.headers);
|
|
17
|
+
if (mime !== "text/html" && mime !== "application/xhtml+xml" && !looksLikeHtml(result.body)) {
|
|
18
|
+
try {
|
|
19
|
+
const value = readJson(result.body, CONTEXT_JSON_SIZE);
|
|
20
|
+
// A body too large to parse may be the object, if it opens one. Any other body is not the object, whatever its length.
|
|
21
|
+
if (value === OVERSIZED && /^[ \t\n\r]*\{/.test(result.body)) {
|
|
22
|
+
return { id, label, status: "error", detail: "agents.json could not be fully measured", data: { ...data, measured: false } };
|
|
23
|
+
}
|
|
24
|
+
if (isRecord(value))
|
|
25
|
+
return { id, label, status: "pass", detail: "agents.json found with a JSON object", data };
|
|
10
26
|
}
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
JSON.parse(result.body);
|
|
15
|
-
return { id, label, status: "pass", detail: "agents.json found with valid JSON", data: { url, statusCode: result.status } };
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return { id, label, status: "partial", detail: "agents.json found but response is not valid JSON", data: { url, statusCode: result.status } };
|
|
27
|
+
catch { /* The published body must parse as JSON. */ }
|
|
19
28
|
}
|
|
29
|
+
return { id, label, status: "fail", detail: "agents.json did not contain a JSON object", data };
|
|
20
30
|
}
|
|
21
|
-
//# sourceMappingURL=agents-json.js.map
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import { collectOperations } from "../schema/oas-types.js";
|
|
1
|
+
import { collectOperations, unreadPathItemCount } from "../schema/oas-types.js";
|
|
2
2
|
export function checkAuthClarity(spec) {
|
|
3
3
|
const id = "context_auth_clarity";
|
|
4
4
|
const label = "Auth Clarity";
|
|
5
5
|
if (!spec) {
|
|
6
6
|
return { id, label, status: "fail", detail: "No spec available — agents cannot discover how to authenticate without documented security schemes", data: { schemesCount: 0, withDescription: 0, securityApplied: false } };
|
|
7
7
|
}
|
|
8
|
-
const schemes = spec.components?.securitySchemes ?? spec.securityDefinitions ?? {};
|
|
8
|
+
const schemes = (spec.swagger === "2.0" ? spec.securityDefinitions : spec.components?.securitySchemes ?? spec.securityDefinitions) ?? {};
|
|
9
9
|
const entries = Object.entries(schemes).filter(([, s]) => s && typeof s === "object" && !Array.isArray(s));
|
|
10
10
|
const schemesCount = entries.length;
|
|
11
11
|
if (schemesCount === 0) {
|
|
12
12
|
return { id, label, status: "fail", detail: "No security schemes defined in spec", data: { schemesCount: 0, withDescription: 0, securityApplied: false } };
|
|
13
13
|
}
|
|
14
14
|
const withDescription = entries.filter(([, s]) => typeof s.description === "string" && s.description.trim() !== "").length;
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const namesScheme = (requirements) => Array.isArray(requirements) && requirements.some(requirement => requirement && typeof requirement === "object" && Object.keys(requirement).some(name => Object.hasOwn(schemes, name)));
|
|
16
|
+
const ops = collectOperations(spec);
|
|
17
|
+
const unreadPaths = unreadPathItemCount(spec);
|
|
18
|
+
const globallyApplied = namesScheme(spec.security);
|
|
19
|
+
const securityApplied = ops.some(([, , op]) => op.security === undefined ? globallyApplied : namesScheme(op.security)) ||
|
|
20
|
+
(!ops.length && !unreadPaths && globallyApplied);
|
|
21
|
+
if (!securityApplied && unreadPaths) {
|
|
22
|
+
return { id, label, status: "error", detail: "An unreadable OpenAPI Path Item prevents checking where security schemes are applied",
|
|
23
|
+
data: { schemesCount, withDescription, securityApplied: null } };
|
|
20
24
|
}
|
|
21
|
-
const securityApplied = hasGlobalSecurity || hasPerOpSecurity;
|
|
22
25
|
if (securityApplied && withDescription === schemesCount) {
|
|
23
26
|
return { id, label, status: "pass", detail: `${schemesCount} auth schemes defined, all with descriptions, security applied`, data: { schemesCount, withDescription, securityApplied } };
|
|
24
27
|
}
|
|
@@ -27,4 +30,3 @@ export function checkAuthClarity(spec) {
|
|
|
27
30
|
}
|
|
28
31
|
return { id, label, status: "partial", detail: `${schemesCount} auth schemes defined but security not applied to operations`, data: { schemesCount, withDescription, securityApplied: false } };
|
|
29
32
|
}
|
|
30
|
-
//# sourceMappingURL=auth-clarity.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Check, ScanContext } from "../../core/types.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { type ProbeCache } from "./probe.js";
|
|
3
|
+
export declare function checkAuthLegibility(ctx: ScanContext, cache?: ProbeCache): Promise<Check>;
|