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
@@ -1,7 +1,6 @@
1
- export declare function green(text: string): string;
2
- export declare function yellow(text: string): string;
3
- export declare function red(text: string): string;
4
- export declare function cyan(text: string): string;
5
- export declare function dim(text: string): string;
6
- export declare function bold(text: string): string;
7
- //# sourceMappingURL=colors.d.ts.map
1
+ export declare const green: (text: string) => string;
2
+ export declare const yellow: (text: string) => string;
3
+ export declare const red: (text: string) => string;
4
+ export declare const cyan: (text: string) => string;
5
+ export declare const dim: (text: string) => string;
6
+ export declare const bold: (text: string) => string;
@@ -1,28 +1,19 @@
1
- import chalk from "chalk";
2
- function isColorEnabled() {
3
- const noColor = process.env["NO_COLOR"];
4
- if (noColor !== undefined && noColor !== "") {
1
+ import { Chalk } from "chalk";
2
+ const palette = new Chalk({ level: 1 });
3
+ function colorEnabled() {
4
+ if (process.env.NO_COLOR)
5
5
  return false;
6
- }
7
- return true;
6
+ const force = process.env.FORCE_COLOR;
7
+ if (force !== undefined)
8
+ return force !== "0" && force !== "false";
9
+ return Boolean(process.stdout.isTTY && process.env.TERM !== "dumb" && process.stdout.hasColors?.(16));
8
10
  }
9
- const colorEnabled = isColorEnabled();
10
- export function green(text) {
11
- return colorEnabled ? chalk.green(text) : text;
11
+ function style(render) {
12
+ return (text) => colorEnabled() ? render(text) : text;
12
13
  }
13
- export function yellow(text) {
14
- return colorEnabled ? chalk.yellow(text) : text;
15
- }
16
- export function red(text) {
17
- return colorEnabled ? chalk.red(text) : text;
18
- }
19
- export function cyan(text) {
20
- return colorEnabled ? chalk.cyan(text) : text;
21
- }
22
- export function dim(text) {
23
- return colorEnabled ? chalk.dim(text) : text;
24
- }
25
- export function bold(text) {
26
- return colorEnabled ? chalk.bold(text) : text;
27
- }
28
- //# sourceMappingURL=colors.js.map
14
+ export const green = style(palette.green);
15
+ export const yellow = style(palette.yellow);
16
+ export const red = style(palette.red);
17
+ export const cyan = style(palette.cyan);
18
+ export const dim = style(palette.dim);
19
+ export const bold = style(palette.bold);
@@ -0,0 +1,3 @@
1
+ import type { Check } from "../core/types.js";
2
+ /** Additional observations and operator actions for the verbose discovery report. */
3
+ export declare function discoveryGuidance(check: Check): string[];
@@ -0,0 +1,66 @@
1
+ import { isRecord } from "../utils/record.js";
2
+ import { terminalText } from "./terminal-text.js";
3
+ /** Additional observations and operator actions for the verbose discovery report. */
4
+ export function discoveryGuidance(check) {
5
+ const data = check.data;
6
+ if (!data)
7
+ return [];
8
+ if (check.id === "mcp_endpoint" && typeof data.probeState === "string") {
9
+ const lines = [];
10
+ if (data.declaration) {
11
+ if (isRecord(data.capabilities) && data.capabilities.productActions)
12
+ lines.push("The declaration advertises product actions.");
13
+ if (isRecord(data.capabilities) && data.capabilities.docsSearch)
14
+ lines.push("The declaration advertises documentation search.");
15
+ lines.push("Verify the advertised transport using an MCP client. This scan did not initialize a connection.");
16
+ }
17
+ else if (data.probeState === "unmeasured") {
18
+ lines.push("Repeat the declaration check with a complete response and sufficient request budget.");
19
+ }
20
+ else {
21
+ lines.push("Publish a populated MCP declaration at /.well-known/mcp.json and document the transport or supported tools.");
22
+ }
23
+ return lines.map(terminalText);
24
+ }
25
+ if (check.id !== "developer_docs" || !Array.isArray(data.observations))
26
+ return [];
27
+ const lines = [];
28
+ for (const item of data.observations) {
29
+ if (!isRecord(item) || typeof item.requestedUrl !== "string" || typeof item.state !== "string" || item.state === "absent")
30
+ continue;
31
+ const destination = typeof item.finalUrl === "string" && item.finalUrl !== item.requestedUrl ? " → " + item.finalUrl : "";
32
+ const action = {
33
+ "homepage-fallback": "Update the docs route to serve its own documentation page.",
34
+ "login-interstitial": "Link to public integration instructions or document the required sign-in.",
35
+ incomplete: "Repeat this fetch and inspect the complete response.",
36
+ unverified: "Inspect the returned page and publish a clearly identified developer guide.",
37
+ };
38
+ lines.push(item.requestedUrl + destination + " (" + item.state + ")." + (Object.hasOwn(action, item.state) ? " " + action[String(item.state)] : ""));
39
+ }
40
+ if (!lines.length)
41
+ lines.push("Check the published docs link and serve developer documentation at its destination.");
42
+ if (isRecord(data.supplementary)) {
43
+ for (const key of ["index", "markdown"]) {
44
+ const item = data.supplementary[key];
45
+ if (!isRecord(item) || typeof item.url !== "string" || typeof item.source !== "string" || typeof item.state !== "string")
46
+ continue;
47
+ const label = key === "index" ? "Docs llms.txt" : "Docs Markdown";
48
+ const action = item.state === "verified" ? "" : key === "index"
49
+ ? " Link a readable llms.txt with a heading and guide links." : " Serve the alternate as text/markdown.";
50
+ lines.push(label + " " + item.url + " (" + item.source + ", " + item.state + ")." + action);
51
+ }
52
+ }
53
+ if (Array.isArray(data.externalOrigins)) {
54
+ for (const origin of data.externalOrigins) {
55
+ if (typeof origin !== "string")
56
+ continue;
57
+ const safeOrigin = /^https?:\/\/(?:[a-z0-9.-]+|\[[a-f0-9:]+\])(?::[0-9]+)?$/i.test(origin) && URL.parse(origin)?.origin === origin;
58
+ lines.push(safeOrigin ? "Inspect the published external docs origin with milieu scan " + (origin.includes("[") ? '"' + origin + '"' : origin)
59
+ : "Published external docs origin: " + origin);
60
+ }
61
+ const omitted = typeof data.externalOriginsTotal === "number" ? data.externalOriginsTotal - data.externalOrigins.length : 0;
62
+ if (omitted > 0)
63
+ lines.push(omitted + " more published external docs " + (omitted === 1 ? "origin" : "origins") + " not listed.");
64
+ }
65
+ return lines.map(terminalText);
66
+ }
@@ -1,3 +1,2 @@
1
1
  import type { BridgeResult } from "../core/types.js";
2
- export declare function formatBridge(bridge: BridgeResult, verbose: boolean): string;
3
- //# sourceMappingURL=format-bridge.d.ts.map
2
+ export declare function formatBridge(bridge: BridgeResult, _verbose?: boolean): string;
@@ -1,5 +1,8 @@
1
+ import { stripVTControlCharacters } from "node:util";
2
+ import { checkCoverage } from "../core/scoring.js";
1
3
  import { cyan, dim, bold } from "./colors.js";
2
4
  import { progressBar } from "./progress-bar.js";
5
+ import { terminalText } from "./terminal-text.js";
3
6
  const BRIDGE_QUESTIONS = {
4
7
  1: "Is my product surface accessible to AI agents?",
5
8
  2: "Does my product surface publish machine-readable standards?",
@@ -10,27 +13,29 @@ const BRIDGE_QUESTIONS = {
10
13
  function bridgeLabel(bridge) {
11
14
  return `${bridge.name}: ${BRIDGE_QUESTIONS[bridge.id]}`;
12
15
  }
13
- export function formatBridge(bridge, verbose) {
16
+ // The optional second argument is retained for callers of the render module.
17
+ export function formatBridge(bridge, _verbose) {
14
18
  if (bridge.status === "not_evaluated") {
15
- return ` ${bold(bridgeLabel(bridge))} ${dim("Skipped")}`;
19
+ const reason = bridge.message ? " · " + terminalText(bridge.message) : "";
20
+ return ` ${bold(bridgeLabel(bridge))} ${dim("Skipped" + reason)}`;
16
21
  }
17
- if (bridge.score !== null) {
18
- return formatScoredBridge(bridge, verbose);
22
+ const { measured, eligible } = checkCoverage(bridge.checks);
23
+ const coverage = measured < eligible ? dim(` · ${measured} of ${eligible} checks measured`) : "";
24
+ if (bridge.id === 3) {
25
+ const summary = terminalText(bridge.message ?? "Integration evidence unavailable");
26
+ return ` ${bold(bridgeLabel(bridge))} ${cyan(summary)} ${dim(`(${bridge.durationMs}ms)`)}${coverage}`;
19
27
  }
20
- return formatDetectionBridge(bridge, verbose);
28
+ if (bridge.score === null)
29
+ return ` ${bold(bridgeLabel(bridge))} ${dim("Unmeasured")}${coverage}`;
30
+ return formatScoredBridge(bridge, bridge.score, coverage);
21
31
  }
22
- function formatScoredBridge(bridge, _verbose) {
23
- const bar = progressBar(bridge.score);
32
+ function formatScoredBridge(bridge, score, coverage) {
33
+ const bar = progressBar(score, bridge.scoreLabel ?? undefined);
24
34
  const label = bridgeLabel(bridge);
25
35
  const timing = dim(`(${bridge.durationMs}ms)`);
26
- return ` ${bold(label)} ${bar} ${bridge.score} ${timing}`;
36
+ const columns = process.stdout.isTTY ? process.stdout.columns : undefined;
37
+ const summary = `${bar} ${score} ${timing}${coverage}`;
38
+ const lineWidth = 4 + label.length + stripVTControlCharacters(summary).length;
39
+ const separator = columns && columns < lineWidth ? "\n " : " ";
40
+ return ` ${bold(label)}${separator}${summary}`;
27
41
  }
28
- function formatDetectionBridge(bridge, _verbose) {
29
- const detected = bridge.checks.filter((c) => c.status === "pass").length;
30
- const total = bridge.checks.length;
31
- const countText = `${detected} of ${total} signals detected`;
32
- const label = bridgeLabel(bridge);
33
- const timing = dim(`(${bridge.durationMs}ms)`);
34
- return ` ${bold(label)} ${cyan(countText)} ${timing}`;
35
- }
36
- //# sourceMappingURL=format-bridge.js.map
@@ -0,0 +1,2 @@
1
+ import type { ReportDiff } from "../core/diff.js";
2
+ export declare function formatReportDiff(diff: ReportDiff, markdown?: boolean): string;
@@ -0,0 +1,169 @@
1
+ import { linkedRegistry } from "../utils/package-registry.js";
2
+ import { BRIDGE_NAMES } from "../core/types.js";
3
+ import { CHECK_EXPLANATIONS } from "../core/explanations.js";
4
+ import { terminalText } from "./terminal-text.js";
5
+ // Leave room for other output in a 1 MiB GitHub step summary.
6
+ const MARKDOWN_BYTES = 256 * 1024;
7
+ const MARKDOWN_FENCE = String.fromCharCode(96).repeat(3);
8
+ const PRIORITY = ["regression", "inconclusive", "improvement", "inventory"];
9
+ function publicHttpUrl(url) {
10
+ return url !== null && (url.protocol === "https:" || url.protocol === "http:") &&
11
+ /^[a-z0-9.-]+$|^\[[0-9a-f:]+\]$/i.test(url.hostname) && !url.username && !url.password && !url.search && !url.hash;
12
+ }
13
+ function publicOrigin(raw) {
14
+ if (raw.length > 320)
15
+ return "withheld";
16
+ const url = URL.parse(raw);
17
+ return publicHttpUrl(url) && raw === url.origin ? url.origin : "withheld";
18
+ }
19
+ /** Publish only canonical HTTP resources with an ordinary literal path. Omit ambiguous identities in full. */
20
+ function publicTarget(raw, packageLink = false) {
21
+ if (!raw || raw.length > 512)
22
+ return;
23
+ const local = raw.startsWith("/") && !raw.startsWith("//");
24
+ const url = URL.parse(raw, local ? "https://example.invalid" : undefined);
25
+ if (!publicHttpUrl(url) || !/^\/[A-Za-z0-9._~@/-]*$/.test(url.pathname))
26
+ return;
27
+ if (packageLink && (local || !linkedRegistry(url)))
28
+ return;
29
+ if (raw === (local ? url.pathname : url.origin + url.pathname))
30
+ return raw;
31
+ }
32
+ function statusDescription(finding, evidence) {
33
+ const summary = [(evidence.before ?? "unreported") + " → " + (evidence.after ?? "unreported")];
34
+ if (finding.checkId === "context_rate_limit_headers") {
35
+ if (finding.kind === "inconclusive")
36
+ summary.push("Comparable rate-limit evidence was not established.");
37
+ return { summary, target: getTarget(finding), verify: "Compare the declared GET operation, final responder, HTTP status and rate-limit headers." };
38
+ }
39
+ const target = finding.checkId === "standards_a2a_agent_card" || finding.checkId === "context_agents_json" ?
40
+ publicTarget(finding.target) : undefined;
41
+ return { summary, target, verify: "Repeat both scans with the same settings and compare this check in the local reports." };
42
+ }
43
+ function getTarget(finding) {
44
+ return finding.target?.startsWith("GET ") ? publicTarget(finding.target.slice(4)) : undefined;
45
+ }
46
+ function authState(state) {
47
+ const parts = [state.httpStatus === undefined ? "HTTP status unknown" : "HTTP " + state.httpStatus];
48
+ if (state.challenged)
49
+ parts.push(state.guidance === undefined ? "guidance unverified" : state.guidance.join(", ") || "no guidance signals");
50
+ return parts.join(" · ");
51
+ }
52
+ function routeState(state) {
53
+ return state === null ? "unverified" : String(state.count) + (state.complete ? "" : " (coverage incomplete)");
54
+ }
55
+ function coverageState(state, rawTarget) {
56
+ const resource = publicTarget(rawTarget);
57
+ return resource ? state + " (" + resource + ")" : state;
58
+ }
59
+ function describeFinding(finding, evidence) {
60
+ switch (evidence.kind) {
61
+ case "status": return statusDescription(finding, evidence);
62
+ case "coverage": {
63
+ const subject = { bridge: "Bridge", docs: "Documentation", linked: "Homepage link", fetched: "Docs-path response",
64
+ package: "Package link" }[evidence.source];
65
+ return {
66
+ summary: [subject + " coverage: " + coverageState(evidence.before, evidence.beforeTarget) + " → " +
67
+ coverageState(evidence.after, evidence.afterTarget)],
68
+ verify: finding.bridgeId === 4 ? "Confirm both scans parsed the same OpenAPI document." :
69
+ "Compare source availability in the local reports before interpreting the change.",
70
+ };
71
+ }
72
+ case "auth": return { summary: [authState(evidence.before) + " → " + authState(evidence.after)], target: getTarget(finding),
73
+ verify: "Compare the unauthenticated responses for the same GET operation." };
74
+ case "routes": return {
75
+ summary: ["Published routes to the OpenAPI contract: " + routeState(evidence.before) + " → " + routeState(evidence.after)],
76
+ target: publicTarget(evidence.contract),
77
+ verify: "Look for a link to the contract in the homepage, linked developer docs and observed API catalog.",
78
+ };
79
+ case "link": {
80
+ const subject = { linked: "Homepage documentation link", fetched: "Docs-path response", package: "Package registry link" }[evidence.channel];
81
+ const absent = finding.kind === "inconclusive" ? "unverified" : "not observed";
82
+ return { summary: [subject + ": " + (evidence.before ? "observed" : absent) + " → " + (evidence.after ? "observed" : absent)],
83
+ target: publicTarget(finding.target, evidence.channel === "package"),
84
+ verify: {
85
+ linked: "Compare the homepage links to developer documentation.",
86
+ fetched: "Compare the final HTTP responses and the verified documentation inventory in both local reports.",
87
+ package: "Compare the package links in both homepages and fetched developer docs.",
88
+ }[evidence.channel],
89
+ };
90
+ }
91
+ }
92
+ }
93
+ function findingRow(finding) {
94
+ // Only the scanner's known check IDs identify a check in a shared summary.
95
+ const known = finding.checkId !== null && Object.hasOwn(CHECK_EXPLANATIONS, finding.checkId);
96
+ const label = known ? finding.checkId : finding.checkId === null ? "Bridge coverage" : "Unrecognized check";
97
+ const lines = ["Bridge " + finding.bridgeId + " · " + BRIDGE_NAMES[finding.bridgeId - 1] + " · " + finding.kind, String(label)];
98
+ const description = finding.evidence && (known || finding.checkId === null) ? describeFinding(finding, finding.evidence) :
99
+ { summary: [], verify: "Inspect this bridge in both local scan reports." };
100
+ lines.push(...description.summary);
101
+ if (description.target)
102
+ lines.push("Target " + description.target);
103
+ lines.push("Verify " + description.verify);
104
+ return lines.join("\n");
105
+ }
106
+ function settingsLines(diff) {
107
+ if (!diff.settingsChanges?.length)
108
+ return [];
109
+ const labels = { timeoutMs: "Request timeout (ms)", maxConcurrency: "Maximum concurrency", maxRequests: "Request cap",
110
+ deadlineMs: "Overall deadline (ms)", registryLookup: "APIs.guru lookup" };
111
+ return ["Scanner configuration (base → candidate)", ...diff.settingsChanges.map(({ setting, before, after }) => " " + labels[setting] + ": " + (before ?? "unrecorded") + " → " + (after ?? "unrecorded"))];
112
+ }
113
+ function markdownSummary(diff) {
114
+ const version = /^\d{1,8}\.\d{1,8}\.\d{1,8}(?:-(?:rc|alpha|beta|next)\.\d{1,8})?$/.test(diff.version) ? diff.version : "unverified";
115
+ const lines = ["## Milieu release comparison", "", MARKDOWN_FENCE + "text", "Base " + publicOrigin(diff.baseOrigin),
116
+ "Candidate " + publicOrigin(diff.headOrigin), "Scanner " + version];
117
+ lines.push(...settingsLines(diff));
118
+ if (diff.baseIncomplete || diff.headIncomplete) {
119
+ const which = [diff.baseIncomplete && "base", diff.headIncomplete && "candidate"].filter(Boolean).join(" and ");
120
+ lines.push("Request budget exhausted in " + which + ". Coverage is incomplete.");
121
+ }
122
+ if (!diff.findings.length)
123
+ lines.push("No differences in comparable observations.");
124
+ // Reserve the omission notice, closing fence and CLI newline. Select regressions before inventory
125
+ // and preserve the five-bridge order in the displayed rows.
126
+ let remaining = MARKDOWN_BYTES - Buffer.byteLength(lines.join("\n")) - 128;
127
+ const selected = new Map();
128
+ for (const kind of PRIORITY) {
129
+ for (let index = 0; index < diff.findings.length; index++) {
130
+ const finding = diff.findings[index];
131
+ if (finding.kind !== kind)
132
+ continue;
133
+ const row = findingRow(finding);
134
+ const cost = Buffer.byteLength(row) + 2;
135
+ // Keep a prefix of each priority class, preserving its original row order.
136
+ if (cost > remaining)
137
+ break;
138
+ selected.set(index, row);
139
+ remaining -= cost;
140
+ }
141
+ }
142
+ for (const index of [...selected.keys()].sort((a, b) => a - b))
143
+ lines.push("", selected.get(index));
144
+ const omitted = diff.findings.length - selected.size;
145
+ if (omitted)
146
+ lines.push("", omitted + " additional findings omitted. Use the local diff for the full comparison.");
147
+ lines.push(MARKDOWN_FENCE);
148
+ return lines.join("\n");
149
+ }
150
+ export function formatReportDiff(diff, markdown = false) {
151
+ if (markdown)
152
+ return markdownSummary(diff);
153
+ const lines = [
154
+ "Base " + terminalText(diff.baseOrigin),
155
+ "Candidate " + terminalText(diff.headOrigin),
156
+ "Scanner " + terminalText(diff.version),
157
+ ];
158
+ lines.push(...settingsLines(diff));
159
+ if (diff.baseIncomplete || diff.headIncomplete) {
160
+ const reports = [diff.baseIncomplete && "base", diff.headIncomplete && "candidate"].filter(Boolean);
161
+ lines.push("Request budget exhausted in " + reports.join(" and ") + ". Coverage is incomplete.");
162
+ }
163
+ for (const finding of diff.findings) {
164
+ lines.push("", "Bridge " + finding.bridgeId + " · " + finding.bridgeName + " · " + finding.kind, terminalText(finding.label) + (finding.target ? " (" + terminalText(finding.target) + ")" : ""), "Base " + terminalText(finding.before), "Candidate " + terminalText(finding.after), "Verify " + terminalText(finding.verification));
165
+ }
166
+ if (!diff.findings.length)
167
+ lines.push("", "No differences in comparable observations.");
168
+ return lines.join("\n");
169
+ }
@@ -1,3 +1,2 @@
1
1
  import type { ScanResult } from "../core/types.js";
2
2
  export declare function formatScanOutput(result: ScanResult, verbose: boolean, explainAll?: boolean): string;
3
- //# sourceMappingURL=format-scan.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import { green, yellow, red, bold, dim } from "./colors.js";
2
+ import { asciiTerminal } from "./symbols.js";
2
3
  import { formatBridge } from "./format-bridge.js";
3
4
  import { formatVerboseChecks } from "./format-verbose.js";
4
5
  import { terminalText } from "./terminal-text.js";
@@ -32,7 +33,7 @@ export function formatScanOutput(result, verbose, explainAll = false) {
32
33
  lines.push("");
33
34
  // Bridges
34
35
  for (const bridge of result.bridges) {
35
- lines.push(formatBridge(bridge, verbose));
36
+ lines.push(formatBridge(bridge));
36
37
  if (verbose && bridge.checks.length > 0) {
37
38
  lines.push(formatVerboseChecks(bridge.checks, explainAll));
38
39
  }
@@ -40,13 +41,14 @@ export function formatScanOutput(result, verbose, explainAll = false) {
40
41
  lines.push("");
41
42
  // Overall score (colored by score label)
42
43
  const colorize = scoreColorFn(result.overallScoreLabel);
43
- const scoreLine = `Overall Score: ${colorize(String(result.overallScore))} (${result.overallScoreLabel})`;
44
+ const scoredBridges = result.bridges.filter(b => b.id !== 3);
45
+ const scoredCount = scoredBridges.filter(b => b.score !== null).length;
46
+ const scoreLine = `Overall Score: ${colorize(String(result.overallScore))} (${result.overallScoreLabel}) · ${scoredCount} of ${scoredBridges.length} bridges scored`;
44
47
  lines.push(bold(scoreLine));
45
48
  if (result.incomplete) {
46
- lines.push(yellow("⚠ Scan incomplete: request budget exhausted — some checks were skipped, not failed. Raise --max-requests to cover the full scan."));
49
+ lines.push(yellow((asciiTerminal() ? "! " : "⚠ ") + "Scan incomplete: request budget exhausted — some checks were skipped, not failed. Raise --max-requests to cover the full scan."));
47
50
  }
48
51
  // Total time
49
52
  lines.push(dim(`Total: ${formatTotalTime(result.durationMs)}`));
50
53
  return lines.join("\n");
51
54
  }
52
- //# sourceMappingURL=format-scan.js.map
@@ -1,3 +1,2 @@
1
1
  import type { Check } from "../core/types.js";
2
2
  export declare function formatVerboseChecks(checks: Check[], explainAll?: boolean): string;
3
- //# sourceMappingURL=format-verbose.d.ts.map
@@ -1,3 +1,6 @@
1
+ import { oauthObservationLines } from "./oauth-observations.js";
2
+ import { robotsInventoryLines } from "./robots-inventory.js";
3
+ import { discoveryGuidance } from "./discovery-guidance.js";
1
4
  import { statusSymbol } from "./symbols.js";
2
5
  import { dim } from "./colors.js";
3
6
  import { terminalText } from "./terminal-text.js";
@@ -6,10 +9,10 @@ export function formatVerboseChecks(checks, explainAll = false) {
6
9
  .map((check) => {
7
10
  const symbol = statusSymbol(check.status);
8
11
  const detail = check.detail ? dim(` (${terminalText(check.detail)})`) : "";
9
- const showWhy = check.why && (explainAll || check.status !== "pass");
10
- const why = showWhy ? `\n ${dim(terminalText(check.why))}` : "";
11
- return ` ${symbol} ${terminalText(check.label)}${detail}${why}`;
12
+ const why = check.why && (explainAll || check.status !== "pass") ? `\n ${dim(terminalText(check.why))}` : "";
13
+ const observations = [...robotsInventoryLines(check), ...oauthObservationLines(check), ...discoveryGuidance(check)];
14
+ return [` ${symbol} ${terminalText(check.label)}${detail}${why}`,
15
+ ...observations.map(line => " " + dim(terminalText(line)))].join("\n");
12
16
  })
13
17
  .join("\n");
14
18
  }
15
- //# sourceMappingURL=format-verbose.js.map
@@ -4,4 +4,3 @@ export { statusSymbol } from "./symbols.js";
4
4
  export { formatBridge } from "./format-bridge.js";
5
5
  export { formatVerboseChecks } from "./format-verbose.js";
6
6
  export { formatScanOutput } from "./format-scan.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,7 @@
1
- // Terminal rendering and output formatting (Phase 6)
1
+ // Terminal rendering and output formatting
2
2
  export { green, yellow, red, cyan, dim, bold } from "./colors.js";
3
3
  export { progressBar } from "./progress-bar.js";
4
4
  export { statusSymbol } from "./symbols.js";
5
5
  export { formatBridge } from "./format-bridge.js";
6
6
  export { formatVerboseChecks } from "./format-verbose.js";
7
7
  export { formatScanOutput } from "./format-scan.js";
8
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,4 @@
1
+ export declare function oauthObservationLines(check: {
2
+ id: string;
3
+ data?: Record<string, unknown>;
4
+ }): string[];
@@ -0,0 +1,27 @@
1
+ import { terminalText } from "./terminal-text.js";
2
+ export function oauthObservationLines(check) {
3
+ if (check.id !== "context_auth_legibility" || !check.data?.oauth)
4
+ return [];
5
+ const observation = check.data.oauth;
6
+ if (typeof observation !== "object" || !("resourceMetadata" in observation) ||
7
+ typeof observation.resourceMetadata !== "string" || !("verification" in observation) || typeof observation.verification !== "string")
8
+ return [];
9
+ const fields = { ...observation };
10
+ const status = {
11
+ verified: "Matched protected resource and issuer metadata.",
12
+ external: "External metadata link. Verification is pending on that origin.",
13
+ invalid_binding: "Verify that the metadata resource and issuer exactly identify the advertised locations.",
14
+ unavailable: "Repeat the scan after the metadata document is available as complete HTTP 200 JSON.",
15
+ };
16
+ if (!Object.hasOwn(status, observation.verification))
17
+ return [];
18
+ const location = (path, hasQuery) => path + (hasQuery ? " (query omitted)" : "");
19
+ const rows = ["Advertised resource metadata: " + location(observation.resourceMetadata, fields.resourceMetadataHasQuery), status[observation.verification] ?? "Unknown verification status."];
20
+ if (typeof fields.issuer === "string")
21
+ rows.push("Advertised issuer: " + fields.issuer);
22
+ if (typeof fields.registrationEndpoint === "string")
23
+ rows.push("Advertised registration endpoint: " + location(fields.registrationEndpoint, fields.registrationHasQuery));
24
+ if (typeof fields.deviceAuthorizationEndpoint === "string")
25
+ rows.push("Advertised device authorization endpoint: " + location(fields.deviceAuthorizationEndpoint, fields.deviceAuthorizationHasQuery));
26
+ return rows.map(terminalText);
27
+ }
@@ -6,5 +6,4 @@
6
6
  * - U+2588 (full block) for filled
7
7
  * - U+2591 (light shade) for empty
8
8
  */
9
- export declare function progressBar(score: number): string;
10
- //# sourceMappingURL=progress-bar.d.ts.map
9
+ export declare function progressBar(score: number, label?: string): string;
@@ -1,3 +1,5 @@
1
+ import { asciiTerminal } from "./symbols.js";
2
+ import { scoreLabel } from "../core/scoring.js";
1
3
  import { green, yellow, red } from "./colors.js";
2
4
  /**
3
5
  * Render a 12-character progress bar for a scored bridge.
@@ -7,15 +9,15 @@ import { green, yellow, red } from "./colors.js";
7
9
  * - U+2588 (full block) for filled
8
10
  * - U+2591 (light shade) for empty
9
11
  */
10
- export function progressBar(score) {
12
+ export function progressBar(score, label = scoreLabel(Number.isFinite(score) ? score : 0)) {
11
13
  const width = 12;
12
- const filled = Math.round((score / 100) * width);
14
+ const filled = Number.isFinite(score) ? Math.round(Math.max(0, Math.min(100, score)) * width / 100) : 0;
13
15
  const empty = width - filled;
14
- const bar = "\u2588".repeat(filled) + "\u2591".repeat(empty);
15
- if (score >= 80)
16
+ const ascii = asciiTerminal();
17
+ const bar = (ascii ? "#" : "█").repeat(filled) + (ascii ? "-" : "░").repeat(empty);
18
+ if (label === "pass")
16
19
  return green(bar);
17
- if (score >= 40)
20
+ if (label === "partial")
18
21
  return yellow(bar);
19
22
  return red(bar);
20
23
  }
21
- //# sourceMappingURL=progress-bar.js.map
@@ -0,0 +1,3 @@
1
+ import type { Check } from "../core/types.js";
2
+ /** Supplementary robots directives in the local verbose report. */
3
+ export declare function robotsInventoryLines(check: Check): string[];
@@ -0,0 +1,38 @@
1
+ import { isRecord } from "../utils/record.js";
2
+ import { terminalText } from "./terminal-text.js";
3
+ const MAX_AGENTS = 6;
4
+ const MAX_RULES = 8;
5
+ const MAX_PATH_CHARS = 256;
6
+ /** Supplementary robots directives in the local verbose report. */
7
+ export function robotsInventoryLines(check) {
8
+ if (check.id !== "robots_txt")
9
+ return [];
10
+ const inventory = check.data?.directiveInventory;
11
+ if (!isRecord(inventory))
12
+ return [];
13
+ switch (inventory.coverage) {
14
+ case "absent": return ["No robots file available at this origin" + (typeof check.data?.statusCode === "number" ? " (HTTP " + check.data.statusCode + ")." : ".")];
15
+ case "unavailable": return ["Robots directives unavailable. Verify /robots.txt at the scanned origin and rescan."];
16
+ case "incomplete": return ["Incomplete robots file. Fetch the complete /robots.txt and rescan to verify the directives."];
17
+ case "parsed": {
18
+ if (!Array.isArray(inventory.agents))
19
+ return [];
20
+ const lines = ["Declared robots directives by purpose"];
21
+ for (const agent of inventory.agents.slice(0, MAX_AGENTS)) {
22
+ if (!isRecord(agent) || typeof agent.token !== "string" || typeof agent.purpose !== "string" ||
23
+ !Array.isArray(agent.rules) || typeof agent.ruleCount !== "number" || !Number.isSafeInteger(agent.ruleCount) || agent.ruleCount < 0)
24
+ continue;
25
+ const rules = agent.rules.slice(0, MAX_RULES).flatMap((rule) => isRecord(rule) && typeof rule.path === "string" && (rule.type === "allow" || rule.type === "disallow") ?
26
+ [rule.type + " " + terminalText(rule.path.slice(0, MAX_PATH_CHARS)) + (rule.clipped === true ? " [path clipped]" : "")] : []);
27
+ const omitted = agent.ruleCount - rules.length;
28
+ if (omitted > 0)
29
+ rules.push(omitted + " additional directives");
30
+ const source = agent.matchedToken === "*" ? " (wildcard group)" : "";
31
+ lines.push(terminalText(agent.purpose) + " · " + terminalText(agent.token) + source + ": " + (rules.join(", ") || "no applicable directives"));
32
+ }
33
+ lines.push("Actual access depends on the fetcher and serving infrastructure.");
34
+ return lines;
35
+ }
36
+ default: return [];
37
+ }
38
+ }
@@ -1,10 +1,4 @@
1
- /**
2
- * Return a colored status symbol for verbose check display.
3
- *
4
- * pass -> green checkmark
5
- * partial -> yellow warning
6
- * fail -> red x
7
- * error -> red x
8
- */
9
- export declare function statusSymbol(status: "pass" | "partial" | "fail" | "error"): string;
10
- //# sourceMappingURL=symbols.d.ts.map
1
+ import type { CheckStatus } from "../core/types.js";
2
+ /** Pipes retain UTF-8. The Linux console and older Windows consoles have limited glyph sets. */
3
+ export declare function asciiTerminal(): boolean;
4
+ export declare function statusSymbol(status: CheckStatus): string;
@@ -1,21 +1,19 @@
1
- import { green, red, yellow } from "./colors.js";
2
- /**
3
- * Return a colored status symbol for verbose check display.
4
- *
5
- * pass -> green checkmark
6
- * partial -> yellow warning
7
- * fail -> red x
8
- * error -> red x
9
- */
1
+ import { dim, green, red, yellow } from "./colors.js";
2
+ /** Pipes retain UTF-8. The Linux console and older Windows consoles have limited glyph sets. */
3
+ export function asciiTerminal() {
4
+ if (process.env.TERM === "linux")
5
+ return true;
6
+ if (!process.stdout.isTTY)
7
+ return false;
8
+ return process.env.TERM === "dumb" ||
9
+ (process.platform === "win32" && !process.env.WT_SESSION && !process.env.TERM_PROGRAM && !process.env.TERM);
10
+ }
10
11
  export function statusSymbol(status) {
12
+ const ascii = asciiTerminal();
11
13
  switch (status) {
12
- case "pass":
13
- return green("\u2714");
14
- case "partial":
15
- return yellow("\u26A0");
16
- case "fail":
17
- case "error":
18
- return red("\u2718");
14
+ case "pass": return green(ascii ? "+" : "✔");
15
+ case "partial": return yellow(ascii ? "!" : "⚠");
16
+ case "fail": return red(ascii ? "x" : "✘");
17
+ case "error": return dim("? unmeasured");
19
18
  }
20
19
  }
21
- //# sourceMappingURL=symbols.js.map
@@ -1,3 +1 @@
1
- /** Keep untrusted report fields on one line and prevent terminal control sequences. */
2
- export declare function terminalText(value: string): string;
3
- //# sourceMappingURL=terminal-text.d.ts.map
1
+ export { terminalText } from "../utils/terminal-text.js";