milieu-cli 0.2.0 → 0.2.1

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 (2) hide show
  1. package/README.md +32 -11
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -74,22 +74,39 @@ Milieu evaluates your product through five progressive bridges. Each one represe
74
74
  | | Bridge | Question | What milieu checks | Score |
75
75
  |---|---|---|---|---|
76
76
  | 1 | **Reachability** | **Can agents reach you?** | HTTPS, HTTP status, robots.txt (RFC 9309), per-bot crawler policies (GPTBot, ClaudeBot, CCBot, Googlebot, Bingbot, PerplexityBot), meta robots, X-Robots-Tag | 0–100 |
77
- | 2 | **Standards** | **Can agents read you?** | OpenAPI spec, GraphQL introspection, XML sitemap, markdown content negotiation, llms.txt, llms-full.txt, MCP endpoint, JSON-LD, Schema.org, security.txt, ai-plugin.json | 0–100 |
77
+ | 2 | **Standards** | **Can agents read you?** | OpenAPI spec, GraphQL introspection, XML sitemap, markdown content negotiation, llms.txt, llms-full.txt, MCP endpoint, JSON-LD, Schema.org, security.txt, WebMCP, A2A Agent Card | 0–100 |
78
78
  | 3 | **Separation** | **Can agents integrate with you?** | API endpoints, developer docs, SDK/package references, webhook support | Detection only* |
79
- | 4 | **Schema** | **Can agents use you correctly?** | Planned | — |
80
- | 5 | **Context** | **Can agents trust you?** | Planned | — |
79
+ | 4 | **Schema** | **Can agents use your APIs correctly?** | Operation IDs, schema types, error response schemas, required fields, field descriptions | 0–100 |
80
+ | 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 |
81
81
 
82
82
  *Bridge 3 reports what's present rather than scoring quality.
83
83
 
84
- 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 looking for SDK references (Bridge 3) if you don't publish machine-readable standards (Bridge 2). Each bridge builds on the last.
84
+ 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.
85
85
 
86
86
  **Bridge 1 — Reachability** is the front door. Can AI agents get to your content at all? Are you blocking specific crawlers without realizing it? This is the most actionable bridge for most products — many are unknowingly blocking GPTBot or ClaudeBot in their robots.txt.
87
87
 
88
- **Bridge 2 — Standards** is the shared language. Do you speak the protocols AI agents understand? OpenAPI specs, GraphQL endpoints, XML sitemaps, markdown content negotiation, llms.txt, MCP endpoints, structured data — these are the machine-readable standards that let agents go beyond scraping your HTML. milieu also checks if your server returns markdown via HTTP content negotiation (`Accept: text/markdown`), which cuts agent token usage by ~80% compared to raw HTML.
88
+ **Bridge 2 — Standards** is the shared language. Do you speak the protocols AI agents understand? OpenAPI specs, GraphQL endpoints, XML sitemaps, markdown content negotiation, llms.txt, MCP endpoints, structured data — these are the machine-readable standards that let agents go beyond scraping your HTML. milieu also checks for [WebMCP](https://spec.modelcontextprotocol.io/) discovery at `/.well-known/mcp.json` and [A2A Agent Cards](https://google.github.io/A2A/) at `/.well-known/agent.json`.
89
89
 
90
90
  **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.
91
91
 
92
- **Bridges 4-5 — Schema and Context** are deeper evaluations of whether your APIs are well-designed and whether agents can trust the data. These require analysis beyond automated checks.
92
+ **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."
93
+
94
+ **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/`.
95
+
96
+ ### Auth legibility
97
+
98
+ Bridge 5 introduces two checks that together answer: **how well does your API guide an unauthenticated agent toward successful authentication?**
99
+
100
+ An agent's first encounter with any API is unauthenticated. The agent discovers the spec, reads the auth requirements, obtains credentials, then makes authenticated calls. Milieu tests both sides of this:
101
+
102
+ - **Auth clarity** (spec-level): Are `securitySchemes` defined? Do they have descriptions? Are they applied to operations? This tells agents *how* to authenticate before they try.
103
+
104
+ - **Auth legibility** (runtime): When an agent hits a protected endpoint without credentials, how helpful is the 401/403 response? milieu checks for three signals:
105
+ - `WWW-Authenticate` header — tells the agent which auth scheme to use
106
+ - Structured JSON error body — the agent can parse the rejection
107
+ - Documentation URL in the error body — the agent can self-onboard
108
+
109
+ An API that returns `{"error": "unauthorized", "docs_url": "https://docs.example.com/auth"}` with a `WWW-Authenticate: Bearer` header scores full marks. An API that returns an HTML login page scores zero — the agent has no idea what to do next.
93
110
 
94
111
  ### Crawler policies
95
112
 
@@ -147,11 +164,15 @@ These explanations also appear in `--json` output as a `why` field on every chec
147
164
 
148
165
  ## How scoring works
149
166
 
150
- The **overall score** is the average of scored bridges (currently Bridges 1 and 2). Bridge 3 reports detection status only and is excluded from the average.
167
+ The **overall score** is the average of scored bridges (Bridges 1, 2, 4, and 5). Bridge 3 reports detection status only and is excluded from the average.
168
+
169
+ **Bridges 1, 2, and 4** use equal-weight scoring: each check contributes **pass = 1**, **partial = 0.5**, **fail = 0**. Bridge score = `(points / total_checks) * 100`. Thresholds: ≥80 = pass, ≥40 = partial, <40 = fail.
170
+
171
+ **Bridge 5** uses weighted scoring to reflect real-world importance to agents. Rate-limit headers and auth checks carry more weight than contact info. Thresholds are lower (≥60 = pass, ≥30 = partial) because governance signals are nascent — few sites implement all of them today.
151
172
 
152
- Each check within a scored bridge contributes: **pass = 1**, **partial = 0.5**, **fail = 0**. Bridge score = `(points / total_checks) * 100`.
173
+ A "partial" means the signal exists but is incomplete: an OpenAPI spec served as YAML (detected but not fully parseable), 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.
153
174
 
154
- A "partial" means the signal exists but is incomplete: an OpenAPI spec served as YAML (detected but not fully parseable), or a robots.txt with valid structure but no explicit allow/disallow rules.
175
+ Bridge 4 returns all-fail when no OpenAPI spec is detected, with a specific message per check explaining what the agent loses. Bridge 5 still runs most of its checks (rate limits, auth legibility, agents.json, versioning via headers) even without a spec — governance signals exist independently.
155
176
 
156
177
  All checks are reproducible: same product surface state produces the same score every time.
157
178
 
@@ -169,12 +190,12 @@ const options: ScanOptions = {
169
190
 
170
191
  const result = await scan("https://petstore.swagger.io", options);
171
192
 
172
- console.log(result.overallScore); // number (average of scored bridges)
193
+ console.log(result.overallScore); // number (average of Bridges 1, 2, 4, 5)
173
194
  console.log(result.overallScoreLabel); // "pass" | "partial" | "fail"
174
195
  console.log(result.bridges); // 5-element tuple of BridgeResult
175
196
  ```
176
197
 
177
- > **Note:** `result.bridges` always returns 5 elements. Bridges 1-2 have numeric scores. Bridge 3 has `score: null` (detection inventory). Bridges 4-5 have `score: null` (not yet evaluated). Handle nulls when mapping:
198
+ > **Note:** `result.bridges` always returns 5 elements. Bridges 1, 2, 4, and 5 have numeric scores. Bridge 3 has `score: null` (detection inventory). Handle nulls when mapping:
178
199
  >
179
200
  > ```typescript
180
201
  > const scoredBridges = result.bridges.filter(b => b.score !== null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "milieu-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Check if AI agents can discover, understand, and use your product",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",