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.
Files changed (330) hide show
  1. package/README.md +177 -76
  2. package/dist/bridges/context/agents-json.d.ts +0 -1
  3. package/dist/bridges/context/agents-json.js +21 -12
  4. package/dist/bridges/context/auth-clarity.d.ts +0 -1
  5. package/dist/bridges/context/auth-clarity.js +11 -9
  6. package/dist/bridges/context/auth-legibility.d.ts +2 -2
  7. package/dist/bridges/context/auth-legibility.js +67 -60
  8. package/dist/bridges/context/index.d.ts +1 -2
  9. package/dist/bridges/context/index.js +19 -40
  10. package/dist/bridges/context/oauth-metadata.d.ts +14 -0
  11. package/dist/bridges/context/oauth-metadata.js +127 -0
  12. package/dist/bridges/context/probe.d.ts +33 -0
  13. package/dist/bridges/context/probe.js +157 -0
  14. package/dist/bridges/context/rate-limits.d.ts +5 -2
  15. package/dist/bridges/context/rate-limits.js +27 -51
  16. package/dist/bridges/context/tos-contact.d.ts +13 -4
  17. package/dist/bridges/context/tos-contact.js +108 -46
  18. package/dist/bridges/context/versioning.d.ts +1 -2
  19. package/dist/bridges/context/versioning.js +42 -7
  20. package/dist/bridges/index.d.ts +0 -1
  21. package/dist/bridges/index.js +0 -1
  22. package/dist/bridges/reachability/crawler-policy.d.ts +30 -10
  23. package/dist/bridges/reachability/crawler-policy.js +41 -56
  24. package/dist/bridges/reachability/http-status.d.ts +3 -2
  25. package/dist/bridges/reachability/http-status.js +18 -3
  26. package/dist/bridges/reachability/https-check.d.ts +2 -2
  27. package/dist/bridges/reachability/https-check.js +6 -3
  28. package/dist/bridges/reachability/index.d.ts +1 -2
  29. package/dist/bridges/reachability/index.js +34 -43
  30. package/dist/bridges/reachability/meta-robots.d.ts +0 -13
  31. package/dist/bridges/reachability/meta-robots.js +89 -101
  32. package/dist/bridges/reachability/robots-parser.d.ts +7 -7
  33. package/dist/bridges/reachability/robots-parser.js +65 -15
  34. package/dist/bridges/reachability/robots-txt.d.ts +4 -2
  35. package/dist/bridges/reachability/robots-txt.js +33 -60
  36. package/dist/bridges/schema/descriptions.d.ts +2 -2
  37. package/dist/bridges/schema/descriptions.js +79 -44
  38. package/dist/bridges/schema/error-schemas.d.ts +2 -2
  39. package/dist/bridges/schema/error-schemas.js +31 -18
  40. package/dist/bridges/schema/index.d.ts +2 -2
  41. package/dist/bridges/schema/index.js +48 -30
  42. package/dist/bridges/schema/oas-types.d.ts +65 -26
  43. package/dist/bridges/schema/oas-types.js +37 -7
  44. package/dist/bridges/schema/operation-ids.d.ts +2 -2
  45. package/dist/bridges/schema/operation-ids.js +2 -3
  46. package/dist/bridges/schema/required-fields.d.ts +2 -2
  47. package/dist/bridges/schema/required-fields.js +12 -10
  48. package/dist/bridges/schema/schema-sources.d.ts +19 -0
  49. package/dist/bridges/schema/schema-sources.js +182 -0
  50. package/dist/bridges/schema/schema-types.d.ts +2 -2
  51. package/dist/bridges/schema/schema-types.js +20 -21
  52. package/dist/bridges/separation/api-presence.d.ts +3 -15
  53. package/dist/bridges/separation/api-presence.js +34 -85
  54. package/dist/bridges/separation/developer-docs.d.ts +6 -18
  55. package/dist/bridges/separation/developer-docs.js +100 -99
  56. package/dist/bridges/separation/docs-discovery.d.ts +28 -0
  57. package/dist/bridges/separation/docs-discovery.js +95 -0
  58. package/dist/bridges/separation/evidence-summary.d.ts +2 -0
  59. package/dist/bridges/separation/evidence-summary.js +67 -0
  60. package/dist/bridges/separation/index.d.ts +2 -19
  61. package/dist/bridges/separation/index.js +35 -39
  62. package/dist/bridges/separation/published-routes.d.ts +69 -0
  63. package/dist/bridges/separation/published-routes.js +271 -0
  64. package/dist/bridges/separation/sdk-references.d.ts +8 -3
  65. package/dist/bridges/separation/sdk-references.js +86 -61
  66. package/dist/bridges/separation/webhook-support.d.ts +3 -23
  67. package/dist/bridges/separation/webhook-support.js +61 -162
  68. package/dist/bridges/standards/a2a-agent-card.d.ts +0 -1
  69. package/dist/bridges/standards/a2a-agent-card.js +24 -9
  70. package/dist/bridges/standards/graphql.d.ts +3 -4
  71. package/dist/bridges/standards/graphql.js +70 -66
  72. package/dist/bridges/standards/index.d.ts +1 -2
  73. package/dist/bridges/standards/index.js +57 -47
  74. package/dist/bridges/standards/json-ld.d.ts +25 -11
  75. package/dist/bridges/standards/json-ld.js +114 -56
  76. package/dist/bridges/standards/llms-txt.d.ts +4 -2
  77. package/dist/bridges/standards/llms-txt.js +46 -32
  78. package/dist/bridges/standards/markdown-negotiation.d.ts +4 -1
  79. package/dist/bridges/standards/markdown-negotiation.js +16 -11
  80. package/dist/bridges/standards/mcp.d.ts +3 -12
  81. package/dist/bridges/standards/mcp.js +89 -132
  82. package/dist/bridges/standards/openapi.d.ts +7 -15
  83. package/dist/bridges/standards/openapi.js +657 -207
  84. package/dist/bridges/standards/probe-evidence.d.ts +30 -0
  85. package/dist/bridges/standards/probe-evidence.js +90 -0
  86. package/dist/bridges/standards/schema-org.d.ts +15 -9
  87. package/dist/bridges/standards/schema-org.js +38 -64
  88. package/dist/bridges/standards/sitemap.d.ts +2 -3
  89. package/dist/bridges/standards/sitemap.js +161 -169
  90. package/dist/bridges/standards/well-known.d.ts +3 -7
  91. package/dist/bridges/standards/well-known.js +28 -12
  92. package/dist/cli/index.d.ts +1 -1
  93. package/dist/cli/index.js +107 -22
  94. package/dist/cli/journey-commands.d.ts +3 -0
  95. package/dist/cli/journey-commands.js +35 -0
  96. package/dist/cli/read-report.d.ts +2 -0
  97. package/dist/cli/read-report.js +11 -0
  98. package/dist/core/bridge-output.d.ts +11 -0
  99. package/dist/core/bridge-output.js +86 -0
  100. package/dist/core/bridge-session.d.ts +28 -0
  101. package/dist/core/bridge-session.js +58 -0
  102. package/dist/core/bridge-worker.d.ts +1 -0
  103. package/dist/core/bridge-worker.js +66 -0
  104. package/dist/core/diff.d.ts +79 -0
  105. package/dist/core/diff.js +499 -0
  106. package/dist/core/explanations.d.ts +1 -3
  107. package/dist/core/explanations.js +36 -59
  108. package/dist/core/index.d.ts +4 -2
  109. package/dist/core/index.js +2 -3
  110. package/dist/core/scan-options.d.ts +0 -1
  111. package/dist/core/scan-options.js +14 -6
  112. package/dist/core/scan.d.ts +0 -1
  113. package/dist/core/scan.js +91 -41
  114. package/dist/core/scoring.d.ts +6 -0
  115. package/dist/core/scoring.js +27 -0
  116. package/dist/core/types.d.ts +97 -61
  117. package/dist/core/types.js +9 -3
  118. package/dist/core/validate-report.d.ts +5 -0
  119. package/dist/core/validate-report.js +95 -0
  120. package/dist/core/version.d.ts +0 -1
  121. package/dist/core/version.js +0 -1
  122. package/dist/index.d.ts +0 -1
  123. package/dist/index.js +0 -1
  124. package/dist/journey/body-worker.d.ts +27 -0
  125. package/dist/journey/body-worker.js +140 -0
  126. package/dist/journey/case.d.ts +74 -0
  127. package/dist/journey/case.js +187 -0
  128. package/dist/journey/cli.d.ts +14 -0
  129. package/dist/journey/cli.js +226 -0
  130. package/dist/journey/compare.d.ts +43 -0
  131. package/dist/journey/compare.js +83 -0
  132. package/dist/journey/contracts.d.ts +143 -0
  133. package/dist/journey/contracts.js +37 -0
  134. package/dist/journey/decision.d.ts +72 -0
  135. package/dist/journey/decision.js +121 -0
  136. package/dist/journey/demo.d.ts +36 -0
  137. package/dist/journey/demo.js +137 -0
  138. package/dist/journey/document.d.ts +8 -0
  139. package/dist/journey/document.js +113 -0
  140. package/dist/journey/excerpt.d.ts +6 -0
  141. package/dist/journey/excerpt.js +54 -0
  142. package/dist/journey/name-guidance.d.ts +2 -0
  143. package/dist/journey/name-guidance.js +41 -0
  144. package/dist/journey/providers.d.ts +34 -0
  145. package/dist/journey/providers.js +197 -0
  146. package/dist/journey/report-validation.d.ts +3 -0
  147. package/dist/journey/report-validation.js +457 -0
  148. package/dist/journey/runner.d.ts +12 -0
  149. package/dist/journey/runner.js +321 -0
  150. package/dist/journey/scope.d.ts +8 -0
  151. package/dist/journey/scope.js +50 -0
  152. package/dist/journey/transport.d.ts +3 -0
  153. package/dist/journey/transport.js +45 -0
  154. package/dist/journey/verify.d.ts +21 -0
  155. package/dist/journey/verify.js +213 -0
  156. package/dist/render/colors.d.ts +6 -7
  157. package/dist/render/colors.js +16 -25
  158. package/dist/render/discovery-guidance.d.ts +3 -0
  159. package/dist/render/discovery-guidance.js +66 -0
  160. package/dist/render/format-bridge.d.ts +1 -2
  161. package/dist/render/format-bridge.js +22 -17
  162. package/dist/render/format-diff.d.ts +2 -0
  163. package/dist/render/format-diff.js +169 -0
  164. package/dist/render/format-scan.d.ts +0 -1
  165. package/dist/render/format-scan.js +6 -4
  166. package/dist/render/format-verbose.d.ts +0 -1
  167. package/dist/render/format-verbose.js +7 -4
  168. package/dist/render/index.d.ts +0 -1
  169. package/dist/render/index.js +1 -2
  170. package/dist/render/oauth-observations.d.ts +4 -0
  171. package/dist/render/oauth-observations.js +27 -0
  172. package/dist/render/progress-bar.d.ts +1 -2
  173. package/dist/render/progress-bar.js +8 -6
  174. package/dist/render/robots-inventory.d.ts +3 -0
  175. package/dist/render/robots-inventory.js +38 -0
  176. package/dist/render/symbols.d.ts +4 -10
  177. package/dist/render/symbols.js +15 -17
  178. package/dist/render/terminal-text.d.ts +1 -3
  179. package/dist/render/terminal-text.js +1 -5
  180. package/dist/utils/analysis-worker-entry.d.ts +3 -0
  181. package/dist/utils/analysis-worker-entry.js +12 -0
  182. package/dist/utils/analysis-worker.d.ts +12 -0
  183. package/dist/utils/analysis-worker.js +54 -0
  184. package/dist/utils/html.d.ts +39 -0
  185. package/dist/utils/html.js +261 -0
  186. package/dist/utils/http-client.d.ts +24 -17
  187. package/dist/utils/http-client.js +166 -200
  188. package/dist/utils/http-types.d.ts +43 -0
  189. package/dist/utils/http-types.js +11 -0
  190. package/dist/utils/index.d.ts +0 -1
  191. package/dist/utils/index.js +0 -1
  192. package/dist/utils/package-registry.d.ts +11 -0
  193. package/dist/utils/package-registry.js +69 -0
  194. package/dist/utils/read-json-file.d.ts +3 -0
  195. package/dist/utils/read-json-file.js +41 -0
  196. package/dist/utils/record.d.ts +1 -0
  197. package/dist/utils/record.js +3 -0
  198. package/dist/utils/response-body.d.ts +7 -0
  199. package/dist/utils/response-body.js +71 -0
  200. package/dist/utils/ssrf.d.ts +11 -15
  201. package/dist/utils/ssrf.js +80 -44
  202. package/dist/utils/terminal-text.d.ts +2 -0
  203. package/dist/utils/terminal-text.js +4 -0
  204. package/dist/utils/url.d.ts +29 -1
  205. package/dist/utils/url.js +147 -17
  206. package/docs/examples/onboarding/account-claim.json +25 -0
  207. package/docs/examples/onboarding/pages/account-claim.html +3 -0
  208. package/docs/examples/onboarding/pages/production-activation.html +3 -0
  209. package/docs/examples/onboarding/pages/test-credential.html +3 -0
  210. package/docs/examples/onboarding/production-activation.json +25 -0
  211. package/docs/examples/onboarding/test-credential.json +25 -0
  212. package/docs/journey-qualification.md +46 -0
  213. package/docs/journeys.md +83 -0
  214. package/package.json +28 -8
  215. package/dist/bridges/context/agents-json.d.ts.map +0 -1
  216. package/dist/bridges/context/agents-json.js.map +0 -1
  217. package/dist/bridges/context/auth-clarity.d.ts.map +0 -1
  218. package/dist/bridges/context/auth-clarity.js.map +0 -1
  219. package/dist/bridges/context/auth-legibility.d.ts.map +0 -1
  220. package/dist/bridges/context/auth-legibility.js.map +0 -1
  221. package/dist/bridges/context/index.d.ts.map +0 -1
  222. package/dist/bridges/context/index.js.map +0 -1
  223. package/dist/bridges/context/rate-limits.d.ts.map +0 -1
  224. package/dist/bridges/context/rate-limits.js.map +0 -1
  225. package/dist/bridges/context/tos-contact.d.ts.map +0 -1
  226. package/dist/bridges/context/tos-contact.js.map +0 -1
  227. package/dist/bridges/context/versioning.d.ts.map +0 -1
  228. package/dist/bridges/context/versioning.js.map +0 -1
  229. package/dist/bridges/index.d.ts.map +0 -1
  230. package/dist/bridges/index.js.map +0 -1
  231. package/dist/bridges/reachability/crawler-policy.d.ts.map +0 -1
  232. package/dist/bridges/reachability/crawler-policy.js.map +0 -1
  233. package/dist/bridges/reachability/http-status.d.ts.map +0 -1
  234. package/dist/bridges/reachability/http-status.js.map +0 -1
  235. package/dist/bridges/reachability/https-check.d.ts.map +0 -1
  236. package/dist/bridges/reachability/https-check.js.map +0 -1
  237. package/dist/bridges/reachability/index.d.ts.map +0 -1
  238. package/dist/bridges/reachability/index.js.map +0 -1
  239. package/dist/bridges/reachability/meta-robots.d.ts.map +0 -1
  240. package/dist/bridges/reachability/meta-robots.js.map +0 -1
  241. package/dist/bridges/reachability/robots-parser.d.ts.map +0 -1
  242. package/dist/bridges/reachability/robots-parser.js.map +0 -1
  243. package/dist/bridges/reachability/robots-txt.d.ts.map +0 -1
  244. package/dist/bridges/reachability/robots-txt.js.map +0 -1
  245. package/dist/bridges/schema/descriptions.d.ts.map +0 -1
  246. package/dist/bridges/schema/descriptions.js.map +0 -1
  247. package/dist/bridges/schema/error-schemas.d.ts.map +0 -1
  248. package/dist/bridges/schema/error-schemas.js.map +0 -1
  249. package/dist/bridges/schema/index.d.ts.map +0 -1
  250. package/dist/bridges/schema/index.js.map +0 -1
  251. package/dist/bridges/schema/oas-types.d.ts.map +0 -1
  252. package/dist/bridges/schema/oas-types.js.map +0 -1
  253. package/dist/bridges/schema/operation-ids.d.ts.map +0 -1
  254. package/dist/bridges/schema/operation-ids.js.map +0 -1
  255. package/dist/bridges/schema/required-fields.d.ts.map +0 -1
  256. package/dist/bridges/schema/required-fields.js.map +0 -1
  257. package/dist/bridges/schema/schema-types.d.ts.map +0 -1
  258. package/dist/bridges/schema/schema-types.js.map +0 -1
  259. package/dist/bridges/separation/api-presence.d.ts.map +0 -1
  260. package/dist/bridges/separation/api-presence.js.map +0 -1
  261. package/dist/bridges/separation/developer-docs.d.ts.map +0 -1
  262. package/dist/bridges/separation/developer-docs.js.map +0 -1
  263. package/dist/bridges/separation/index.d.ts.map +0 -1
  264. package/dist/bridges/separation/index.js.map +0 -1
  265. package/dist/bridges/separation/sdk-references.d.ts.map +0 -1
  266. package/dist/bridges/separation/sdk-references.js.map +0 -1
  267. package/dist/bridges/separation/webhook-support.d.ts.map +0 -1
  268. package/dist/bridges/separation/webhook-support.js.map +0 -1
  269. package/dist/bridges/standards/a2a-agent-card.d.ts.map +0 -1
  270. package/dist/bridges/standards/a2a-agent-card.js.map +0 -1
  271. package/dist/bridges/standards/graphql.d.ts.map +0 -1
  272. package/dist/bridges/standards/graphql.js.map +0 -1
  273. package/dist/bridges/standards/index.d.ts.map +0 -1
  274. package/dist/bridges/standards/index.js.map +0 -1
  275. package/dist/bridges/standards/json-ld.d.ts.map +0 -1
  276. package/dist/bridges/standards/json-ld.js.map +0 -1
  277. package/dist/bridges/standards/llms-txt.d.ts.map +0 -1
  278. package/dist/bridges/standards/llms-txt.js.map +0 -1
  279. package/dist/bridges/standards/markdown-negotiation.d.ts.map +0 -1
  280. package/dist/bridges/standards/markdown-negotiation.js.map +0 -1
  281. package/dist/bridges/standards/mcp.d.ts.map +0 -1
  282. package/dist/bridges/standards/mcp.js.map +0 -1
  283. package/dist/bridges/standards/openapi.d.ts.map +0 -1
  284. package/dist/bridges/standards/openapi.js.map +0 -1
  285. package/dist/bridges/standards/schema-org.d.ts.map +0 -1
  286. package/dist/bridges/standards/schema-org.js.map +0 -1
  287. package/dist/bridges/standards/sitemap.d.ts.map +0 -1
  288. package/dist/bridges/standards/sitemap.js.map +0 -1
  289. package/dist/bridges/standards/well-known.d.ts.map +0 -1
  290. package/dist/bridges/standards/well-known.js.map +0 -1
  291. package/dist/cli/index.d.ts.map +0 -1
  292. package/dist/cli/index.js.map +0 -1
  293. package/dist/core/explanations.d.ts.map +0 -1
  294. package/dist/core/explanations.js.map +0 -1
  295. package/dist/core/index.d.ts.map +0 -1
  296. package/dist/core/index.js.map +0 -1
  297. package/dist/core/scan-options.d.ts.map +0 -1
  298. package/dist/core/scan-options.js.map +0 -1
  299. package/dist/core/scan.d.ts.map +0 -1
  300. package/dist/core/scan.js.map +0 -1
  301. package/dist/core/types.d.ts.map +0 -1
  302. package/dist/core/types.js.map +0 -1
  303. package/dist/core/version.d.ts.map +0 -1
  304. package/dist/core/version.js.map +0 -1
  305. package/dist/index.d.ts.map +0 -1
  306. package/dist/index.js.map +0 -1
  307. package/dist/render/colors.d.ts.map +0 -1
  308. package/dist/render/colors.js.map +0 -1
  309. package/dist/render/format-bridge.d.ts.map +0 -1
  310. package/dist/render/format-bridge.js.map +0 -1
  311. package/dist/render/format-scan.d.ts.map +0 -1
  312. package/dist/render/format-scan.js.map +0 -1
  313. package/dist/render/format-verbose.d.ts.map +0 -1
  314. package/dist/render/format-verbose.js.map +0 -1
  315. package/dist/render/index.d.ts.map +0 -1
  316. package/dist/render/index.js.map +0 -1
  317. package/dist/render/progress-bar.d.ts.map +0 -1
  318. package/dist/render/progress-bar.js.map +0 -1
  319. package/dist/render/symbols.d.ts.map +0 -1
  320. package/dist/render/symbols.js.map +0 -1
  321. package/dist/render/terminal-text.d.ts.map +0 -1
  322. package/dist/render/terminal-text.js.map +0 -1
  323. package/dist/utils/http-client.d.ts.map +0 -1
  324. package/dist/utils/http-client.js.map +0 -1
  325. package/dist/utils/index.d.ts.map +0 -1
  326. package/dist/utils/index.js.map +0 -1
  327. package/dist/utils/ssrf.d.ts.map +0 -1
  328. package/dist/utils/ssrf.js.map +0 -1
  329. package/dist/utils/url.d.ts.map +0 -1
  330. package/dist/utils/url.js.map +0 -1
package/README.md CHANGED
@@ -1,73 +1,83 @@
1
1
  # milieu-cli
2
2
 
3
+ [![Total npm downloads](https://img.shields.io/badge/dynamic/xml.svg?url=https%3A%2F%2Fnpminsights.vercel.app%2Fpackage%2Fmilieu-cli&query=%2F%2Fh3%5B.%3D%22All-time+downloads%22%5D%2Ffollowing-sibling%3A%3Ap%5B1%5D%2Ftext%28%29&label=total+npm+downloads&color=blue)](https://npminsights.vercel.app/package/milieu-cli)
4
+ [![Stable npm version](https://img.shields.io/npm/v/milieu-cli/latest?label=npm+stable)](https://www.npmjs.com/package/milieu-cli?activeTab=versions)
5
+ [![License](https://img.shields.io/github/license/simplyarun/milieu-cli)](LICENSE)
6
+ [![CI status on main](https://github.com/simplyarun/milieu-cli/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](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
- ## What is milieu?
38
+ ## Journeys
21
39
 
22
- *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.
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
- Good design made products usable for humans. Good milieu design makes products usable for agents.
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
- ```bash
29
- npx milieu-cli scan petstore.swagger.io
44
+ ```sh
45
+ npx milieu-cli journey demo
30
46
  ```
31
47
 
32
- ```bash
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
- ## Quick start
50
+ **Try it on your own product**
38
51
 
39
- Run your first scan in under a minute:
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
- ```bash
42
- npx milieu-cli scan petstore.swagger.io
56
+ ```sh
57
+ npx milieu-cli journey run catalog.json --target baseline --provider ollama --model YOUR_MODEL
43
58
  ```
44
59
 
45
- No config, no API keys. You'll get a scored report showing what AI agents can see when they visit that product surface.
46
-
47
- Scans are **origin-scoped**: whatever URL you pass, milieu scans the site's origin (`https://domain`). Paths and query strings do not narrow the scan — `milieu scan stripe.com/docs` scans `https://stripe.com`, and the report's `scannedOrigin` field records exactly what was scanned.
48
-
49
- ### Example products to try
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
- Each of these exercises different parts of the scanner:
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
- # Rich structured data — JSON-LD and Schema.org markup
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
- # Minimal API service — clean reachability, few standards signals
61
- npx milieu-cli scan httpbin.org
62
- ```
74
+ ## What is milieu?
63
75
 
64
- Add `--verbose` to any scan to see individual check results and explanations:
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
- ```bash
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
- Once you've seen how these score, scan your own product surface and compare.
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, Googlebot, Bingbot, PerplexityBot), meta robots, X-Robots-Tag | 0–100 |
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 reports what's present rather than scoring quality.
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. An API that returns an HTML login page scores zero — the agent has no idea what to do next.
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
- The single most actionable finding for most products: are you blocking AI agents? milieu checks your robots.txt for policies on six specific bots:
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
- - **GPTBot** (OpenAI) · **ClaudeBot** (Anthropic) · **CCBot** (Common Crawl)
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
- ```bash
125
- npx milieu-cli scan petstore.swagger.io # one-off, no install
126
- npm install -g milieu-cli # global install
127
- milieu scan petstore.swagger.io # short alias after install
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
- > Both `milieu` and `milieu-cli` work as commands after global install.
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
- Track agent-readiness over time and prevent regressions:
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
- # Fail the build if score drops below 70
138
- milieu scan api.mycompany.com --threshold 70 --quiet
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
- # Capture structured results
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
- # Pretty-print for debugging
144
- milieu scan api.mycompany.com --json --pretty
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
- Exit codes: `0` = score meets threshold (or no threshold set), `1` = score below threshold or scan error.
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>` | Per-request timeout in whole milliseconds, from 1 to 2147483647 | 10000 |
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 average of Bridges 1, 2, 4, and 5. Bridge 3 reports detection status only (`score: null`) and is the sole bridge excluded from the average.
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
- Scoring is **monotone**: adding a machine-readable signal can only raise your score, never lower it. Bridge 4 scores `0` (not "not applicable") when no OpenAPI spec is found, and every Bridge-5 check counts toward a fixed denominator whether or not you publish a spec — so publishing one can only help. Deleting signals to game the number doesn't work.
236
+ Schema distinguishes three cases.
174
237
 
175
- **Bridges 1 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.
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. Reachability, Standards, and Context exclude these checks from their scoring denominators. The result also sets `incomplete` when the request budget denies a probe.
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
- 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.
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
- When no OpenAPI spec is detected, Bridge 4's five checks all `fail` — each with a message explaining what the agent loses — and the bridge scores `0` (included in the average). Bridge 5 still runs all of its checks even without a spec; the spec-dependent ones (auth clarity, versioning) simply fail rather than being excused, keeping the score monotone.
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
- All checks are reproducible: same product surface state produces the same score every time.
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 { ScanResult, ScanOutcome, ScanOptions, BridgeResult, Check, CheckStatus } from "milieu-cli";
288
+ import type { ScanOutcome, ScanOptions } from "milieu-cli";
192
289
 
193
290
  const options: ScanOptions = {
194
- timeout: 15000, // per-request timeout in ms (default: 10000)
195
- silent: true, // suppress spinner output (recommended for library use)
291
+ timeout: 15000,
292
+ deadlineMs: 90000,
293
+ registryLookup: false,
196
294
  };
197
295
 
198
- // scan() never throws. It returns a discriminated union — narrow on `.ok`,
199
- // exactly like the HTTP client's HttpResponse.
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); // "invalid_url" | "scan_failed"
300
+ console.error(outcome.error.kind, outcome.error.message);
204
301
  } else {
205
- console.log(outcome.overallScore); // number (average of Bridges 1, 2, 4, 5)
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
- > **Note:** `result.bridges` always returns 5 elements. Only Bridge 3 has `score: null` (detection inventory); Bridges 1, 2, 4, and 5 are always numeric. Handle the null when mapping:
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
- Check explanations are available as a separate export for library consumers:
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
- // → "Without robots.txt, AI agents have no guidance on what they can access..."
325
+ console.log(why);
225
326
  ```
226
327
 
227
328
  ## Requirements
@@ -1,3 +1,2 @@
1
1
  import type { Check } from "../../core/types.js";
2
2
  export declare function checkAgentsJson(baseUrl: string, timeout?: number): Promise<Check>;
3
- //# sourceMappingURL=agents-json.d.ts.map
@@ -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
- if (!result.ok) {
8
- if (result.error.kind === "request_budget_exhausted") {
9
- return { id, label, status: "error", detail: "agents.json probe skipped: scan request budget exhausted", data: { url } };
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
- return { id, label, status: "fail", detail: "No agents.json found at /.well-known/agents.json", data: { url, statusCode: result.error.statusCode ?? null } };
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,4 +1,3 @@
1
1
  import type { Check } from "../../core/types.js";
2
2
  import type { ParsedOpenApiSpec } from "../schema/oas-types.js";
3
3
  export declare function checkAuthClarity(spec: ParsedOpenApiSpec | undefined): Check;
4
- //# sourceMappingURL=auth-clarity.d.ts.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 hasGlobalSecurity = Array.isArray(spec.security) && spec.security.length > 0;
16
- let hasPerOpSecurity = false;
17
- if (!hasGlobalSecurity) {
18
- const ops = collectOperations(spec);
19
- hasPerOpSecurity = ops.some(([, , op]) => Array.isArray(op.security) && op.security.length > 0);
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
- export declare function checkAuthLegibility(ctx: ScanContext): Promise<Check>;
3
- //# sourceMappingURL=auth-legibility.d.ts.map
2
+ import { type ProbeCache } from "./probe.js";
3
+ export declare function checkAuthLegibility(ctx: ScanContext, cache?: ProbeCache): Promise<Check>;