@intentius/chant-lexicon-prometheus 0.96.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 (237) hide show
  1. package/README.md +58 -0
  2. package/dist/alertmanager.d.ts +81 -0
  3. package/dist/alertmanager.d.ts.map +1 -0
  4. package/dist/build.d.ts +33 -0
  5. package/dist/build.d.ts.map +1 -0
  6. package/dist/catalog.d.ts +17 -0
  7. package/dist/catalog.d.ts.map +1 -0
  8. package/dist/codegen/docs-cli.d.ts +3 -0
  9. package/dist/codegen/docs-cli.d.ts.map +1 -0
  10. package/dist/codegen/docs.d.ts +9 -0
  11. package/dist/codegen/docs.d.ts.map +1 -0
  12. package/dist/codegen/generate-cli.d.ts +3 -0
  13. package/dist/codegen/generate-cli.d.ts.map +1 -0
  14. package/dist/codegen/generate.d.ts +19 -0
  15. package/dist/codegen/generate.d.ts.map +1 -0
  16. package/dist/codegen/package.d.ts +7 -0
  17. package/dist/codegen/package.d.ts.map +1 -0
  18. package/dist/composites/catalog.d.ts +3 -0
  19. package/dist/composites/catalog.d.ts.map +1 -0
  20. package/dist/composites/index.d.ts +6 -0
  21. package/dist/composites/index.d.ts.map +1 -0
  22. package/dist/composites/slo.d.ts +205 -0
  23. package/dist/composites/slo.d.ts.map +1 -0
  24. package/dist/detect.d.ts +2 -0
  25. package/dist/detect.d.ts.map +1 -0
  26. package/dist/duration.d.ts +16 -0
  27. package/dist/duration.d.ts.map +1 -0
  28. package/dist/index.d.ts +14 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/init-templates.d.ts +13 -0
  31. package/dist/init-templates.d.ts.map +1 -0
  32. package/dist/integrity.json +33 -0
  33. package/dist/lint/audit-catalog.d.ts +13 -0
  34. package/dist/lint/audit-catalog.d.ts.map +1 -0
  35. package/dist/lint/post-synth/index.d.ts +3 -0
  36. package/dist/lint/post-synth/index.d.ts.map +1 -0
  37. package/dist/lint/post-synth/prom-helpers.d.ts +33 -0
  38. package/dist/lint/post-synth/prom-helpers.d.ts.map +1 -0
  39. package/dist/lint/post-synth/prom101.d.ts +8 -0
  40. package/dist/lint/post-synth/prom101.d.ts.map +1 -0
  41. package/dist/lint/post-synth/prom102.d.ts +8 -0
  42. package/dist/lint/post-synth/prom102.d.ts.map +1 -0
  43. package/dist/lint/post-synth/prom103.d.ts +8 -0
  44. package/dist/lint/post-synth/prom103.d.ts.map +1 -0
  45. package/dist/lint/post-synth/prom104.d.ts +8 -0
  46. package/dist/lint/post-synth/prom104.d.ts.map +1 -0
  47. package/dist/lint/post-synth/prom105.d.ts +8 -0
  48. package/dist/lint/post-synth/prom105.d.ts.map +1 -0
  49. package/dist/lint/post-synth/prom106.d.ts +8 -0
  50. package/dist/lint/post-synth/prom106.d.ts.map +1 -0
  51. package/dist/lint/post-synth/prom107.d.ts +8 -0
  52. package/dist/lint/post-synth/prom107.d.ts.map +1 -0
  53. package/dist/lint/post-synth/prom201.d.ts +8 -0
  54. package/dist/lint/post-synth/prom201.d.ts.map +1 -0
  55. package/dist/lint/post-synth/prom202.d.ts +8 -0
  56. package/dist/lint/post-synth/prom202.d.ts.map +1 -0
  57. package/dist/lint/post-synth/prom203.d.ts +8 -0
  58. package/dist/lint/post-synth/prom203.d.ts.map +1 -0
  59. package/dist/lint/post-synth/prom204.d.ts +8 -0
  60. package/dist/lint/post-synth/prom204.d.ts.map +1 -0
  61. package/dist/lint/post-synth/prom205.d.ts +8 -0
  62. package/dist/lint/post-synth/prom205.d.ts.map +1 -0
  63. package/dist/lint/post-synth/prom206.d.ts +8 -0
  64. package/dist/lint/post-synth/prom206.d.ts.map +1 -0
  65. package/dist/lint/post-synth/prom207.d.ts +8 -0
  66. package/dist/lint/post-synth/prom207.d.ts.map +1 -0
  67. package/dist/lint/post-synth/prom208.d.ts +8 -0
  68. package/dist/lint/post-synth/prom208.d.ts.map +1 -0
  69. package/dist/lint/post-synth/prom209.d.ts +8 -0
  70. package/dist/lint/post-synth/prom209.d.ts.map +1 -0
  71. package/dist/lint/rules/index.d.ts +7 -0
  72. package/dist/lint/rules/index.d.ts.map +1 -0
  73. package/dist/lint/rules/literal-credential.d.ts +18 -0
  74. package/dist/lint/rules/literal-credential.d.ts.map +1 -0
  75. package/dist/lint/rules/prom-ast.d.ts +14 -0
  76. package/dist/lint/rules/prom-ast.d.ts.map +1 -0
  77. package/dist/lint/rules/promql-literal.d.ts +11 -0
  78. package/dist/lint/rules/promql-literal.d.ts.map +1 -0
  79. package/dist/lint/rules/slo-literal.d.ts +13 -0
  80. package/dist/lint/rules/slo-literal.d.ts.map +1 -0
  81. package/dist/lsp/completions.d.ts +4 -0
  82. package/dist/lsp/completions.d.ts.map +1 -0
  83. package/dist/lsp/hover.d.ts +4 -0
  84. package/dist/lsp/hover.d.ts.map +1 -0
  85. package/dist/manifest.json +8 -0
  86. package/dist/matchers.d.ts +29 -0
  87. package/dist/matchers.d.ts.map +1 -0
  88. package/dist/meta.json +32 -0
  89. package/dist/model.d.ts +262 -0
  90. package/dist/model.d.ts.map +1 -0
  91. package/dist/okf/index.md +34 -0
  92. package/dist/okf/rules/PROM001.md +16 -0
  93. package/dist/okf/rules/PROM002.md +15 -0
  94. package/dist/okf/rules/PROM003.md +11 -0
  95. package/dist/okf/rules/PROM101.md +11 -0
  96. package/dist/okf/rules/PROM102.md +11 -0
  97. package/dist/okf/rules/PROM103.md +11 -0
  98. package/dist/okf/rules/PROM104.md +11 -0
  99. package/dist/okf/rules/PROM105.md +11 -0
  100. package/dist/okf/rules/PROM106.md +11 -0
  101. package/dist/okf/rules/PROM107.md +11 -0
  102. package/dist/okf/rules/PROM201.md +11 -0
  103. package/dist/okf/rules/PROM202.md +11 -0
  104. package/dist/okf/rules/PROM203.md +11 -0
  105. package/dist/okf/rules/PROM204.md +11 -0
  106. package/dist/okf/rules/PROM205.md +11 -0
  107. package/dist/okf/rules/PROM206.md +11 -0
  108. package/dist/okf/rules/PROM207.md +11 -0
  109. package/dist/okf/rules/PROM208.md +11 -0
  110. package/dist/okf/rules/PROM209.md +11 -0
  111. package/dist/okf/types/AlertmanagerSettings.md +13 -0
  112. package/dist/okf/types/InhibitRule.md +9 -0
  113. package/dist/okf/types/Receiver.md +13 -0
  114. package/dist/okf/types/Route.md +9 -0
  115. package/dist/okf/types/RuleGroup.md +13 -0
  116. package/dist/okf/types/TimeInterval.md +9 -0
  117. package/dist/package-cli.d.ts +3 -0
  118. package/dist/package-cli.d.ts.map +1 -0
  119. package/dist/pin.d.ts +20 -0
  120. package/dist/pin.d.ts.map +1 -0
  121. package/dist/plugin.d.ts +10 -0
  122. package/dist/plugin.d.ts.map +1 -0
  123. package/dist/promql.d.ts +25 -0
  124. package/dist/promql.d.ts.map +1 -0
  125. package/dist/rule-eval.d.ts +67 -0
  126. package/dist/rule-eval.d.ts.map +1 -0
  127. package/dist/rules/literal-credential.ts +84 -0
  128. package/dist/rules/prom-ast.ts +30 -0
  129. package/dist/rules/prom-helpers.ts +89 -0
  130. package/dist/rules/prom101.ts +17 -0
  131. package/dist/rules/prom102.ts +17 -0
  132. package/dist/rules/prom103.ts +17 -0
  133. package/dist/rules/prom104.ts +17 -0
  134. package/dist/rules/prom105.ts +17 -0
  135. package/dist/rules/prom106.ts +17 -0
  136. package/dist/rules/prom107.ts +17 -0
  137. package/dist/rules/prom201.ts +17 -0
  138. package/dist/rules/prom202.ts +17 -0
  139. package/dist/rules/prom203.ts +17 -0
  140. package/dist/rules/prom204.ts +17 -0
  141. package/dist/rules/prom205.ts +17 -0
  142. package/dist/rules/prom206.ts +17 -0
  143. package/dist/rules/prom207.ts +17 -0
  144. package/dist/rules/prom208.ts +17 -0
  145. package/dist/rules/prom209.ts +17 -0
  146. package/dist/rules/promql-literal.ts +55 -0
  147. package/dist/rules/slo-literal.ts +81 -0
  148. package/dist/rules.d.ts +59 -0
  149. package/dist/rules.d.ts.map +1 -0
  150. package/dist/serializer.d.ts +27 -0
  151. package/dist/serializer.d.ts.map +1 -0
  152. package/dist/skill-defs.d.ts +3 -0
  153. package/dist/skill-defs.d.ts.map +1 -0
  154. package/dist/skills/chant-prometheus-alertmanager.md +58 -0
  155. package/dist/skills/chant-prometheus-kubernetes.md +48 -0
  156. package/dist/skills/chant-prometheus.md +91 -0
  157. package/dist/tools.d.ts +30 -0
  158. package/dist/tools.d.ts.map +1 -0
  159. package/dist/types/index.d.ts +3 -0
  160. package/dist/validate-cli.d.ts +3 -0
  161. package/dist/validate-cli.d.ts.map +1 -0
  162. package/dist/validate-config.d.ts +35 -0
  163. package/dist/validate-config.d.ts.map +1 -0
  164. package/dist/validate.d.ts +11 -0
  165. package/dist/validate.d.ts.map +1 -0
  166. package/package.json +77 -0
  167. package/src/alertmanager.ts +143 -0
  168. package/src/build.ts +199 -0
  169. package/src/catalog.ts +65 -0
  170. package/src/codegen/docs-cli.ts +4 -0
  171. package/src/codegen/docs.ts +104 -0
  172. package/src/codegen/generate-cli.ts +8 -0
  173. package/src/codegen/generate.ts +49 -0
  174. package/src/codegen/package.ts +41 -0
  175. package/src/composites/catalog.test.ts +37 -0
  176. package/src/composites/catalog.ts +65 -0
  177. package/src/composites/composites.test.ts +256 -0
  178. package/src/composites/index.ts +23 -0
  179. package/src/composites/slo-burn.test.ts +289 -0
  180. package/src/composites/slo.ts +471 -0
  181. package/src/detect.ts +12 -0
  182. package/src/duration.ts +51 -0
  183. package/src/generated/lexicon-prometheus.json +32 -0
  184. package/src/index.ts +97 -0
  185. package/src/init-templates.test.ts +29 -0
  186. package/src/init-templates.ts +76 -0
  187. package/src/lint/audit-catalog.ts +123 -0
  188. package/src/lint/post-synth/index.ts +37 -0
  189. package/src/lint/post-synth/post-synth.test.ts +256 -0
  190. package/src/lint/post-synth/prom-helpers.ts +89 -0
  191. package/src/lint/post-synth/prom101.ts +17 -0
  192. package/src/lint/post-synth/prom102.ts +17 -0
  193. package/src/lint/post-synth/prom103.ts +17 -0
  194. package/src/lint/post-synth/prom104.ts +17 -0
  195. package/src/lint/post-synth/prom105.ts +17 -0
  196. package/src/lint/post-synth/prom106.ts +17 -0
  197. package/src/lint/post-synth/prom107.ts +17 -0
  198. package/src/lint/post-synth/prom201.ts +17 -0
  199. package/src/lint/post-synth/prom202.ts +17 -0
  200. package/src/lint/post-synth/prom203.ts +17 -0
  201. package/src/lint/post-synth/prom204.ts +17 -0
  202. package/src/lint/post-synth/prom205.ts +17 -0
  203. package/src/lint/post-synth/prom206.ts +17 -0
  204. package/src/lint/post-synth/prom207.ts +17 -0
  205. package/src/lint/post-synth/prom208.ts +17 -0
  206. package/src/lint/post-synth/prom209.ts +17 -0
  207. package/src/lint/rules/index.ts +11 -0
  208. package/src/lint/rules/literal-credential.ts +84 -0
  209. package/src/lint/rules/prom-ast.ts +30 -0
  210. package/src/lint/rules/promql-literal.ts +55 -0
  211. package/src/lint/rules/rules.test.ts +114 -0
  212. package/src/lint/rules/slo-literal.ts +81 -0
  213. package/src/lsp/completions.test.ts +23 -0
  214. package/src/lsp/completions.ts +15 -0
  215. package/src/lsp/hover.test.ts +27 -0
  216. package/src/lsp/hover.ts +26 -0
  217. package/src/matchers.ts +132 -0
  218. package/src/model.test.ts +104 -0
  219. package/src/model.ts +290 -0
  220. package/src/package-cli.ts +17 -0
  221. package/src/pin.ts +13 -0
  222. package/src/plugin.test.ts +73 -0
  223. package/src/plugin.ts +129 -0
  224. package/src/promql.ts +46 -0
  225. package/src/rule-eval.ts +397 -0
  226. package/src/rules.ts +127 -0
  227. package/src/serializer.test.ts +179 -0
  228. package/src/serializer.ts +55 -0
  229. package/src/skill-defs.ts +43 -0
  230. package/src/skills/chant-prometheus-alertmanager.md +58 -0
  231. package/src/skills/chant-prometheus-kubernetes.md +48 -0
  232. package/src/skills/chant-prometheus.md +91 -0
  233. package/src/tools.test.ts +119 -0
  234. package/src/tools.ts +70 -0
  235. package/src/validate-cli.ts +7 -0
  236. package/src/validate-config.ts +400 -0
  237. package/src/validate.ts +66 -0
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The prometheus lexicon's chant audit catalog, contributed via
3
+ * `prometheusPlugin.auditCatalog()` (#687, #1346).
4
+ *
5
+ * Every post-synth check reads the emitted rule file or `alertmanager.yml`
6
+ * (or any output document shaped like one), so they are all `yamlBased` and
7
+ * fire on an audit of standalone files too. The three source-level lint rules
8
+ * read TypeScript, so they are constructed with `yamlBased: false`; they are
9
+ * listed for a reader who meets them in a lint report.
10
+ */
11
+ import { type RuleMeta } from "@intentius/chant/audit/catalog";
12
+ export declare const prometheusAuditCatalog: Record<string, RuleMeta>;
13
+ //# sourceMappingURL=audit-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-catalog.d.ts","sourceRoot":"","sources":["../../src/lint/audit-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAgB1E,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CA+F3D,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
2
+ export declare const postSynthChecks: PostSynthCheck[];
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAkBvE,eAAO,MAAM,eAAe,EAAE,cAAc,EAiB3C,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Shared plumbing for the prometheus post-synth checks: find the rule files
3
+ * and `alertmanager.yml` documents in a build's output, and run the
4
+ * plain-function checks over them.
5
+ *
6
+ * Documents are recognized by shape, not by which lexicon emitted them, so a
7
+ * rule file that reaches the output some other way (a hand-written YAML
8
+ * sidecar) is checked too. `PrometheusRule` manifests are not read here;
9
+ * their groups are the same `RuleGroup`s and are checked where they are
10
+ * declared.
11
+ */
12
+ import type { PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
13
+ import { type AlertmanagerConfig, type RuleFileConfig } from "../../model.js";
14
+ import { type PrometheusIssueCode } from "../../validate-config.js";
15
+ export interface FoundDocs {
16
+ ruleFiles: Array<{
17
+ source: string;
18
+ config: RuleFileConfig;
19
+ }>;
20
+ alertmanager: Array<{
21
+ source: string;
22
+ config: AlertmanagerConfig;
23
+ }>;
24
+ }
25
+ /** Every rule file and Alertmanager config in the output. Parsed with js-yaml rather than `ctx.docs`, which keeps block scalars and flow lists as strings. */
26
+ export declare function prometheusDocs(ctx: PostSynthContext): FoundDocs;
27
+ /** Diagnostics for one rule-file code (PROM101-PROM107) across every rule file in the output. */
28
+ export declare function ruleFileDiagnostics(ctx: PostSynthContext, code: PrometheusIssueCode): PostSynthDiagnostic[];
29
+ /** Diagnostics for one Alertmanager code (PROM201, PROM203-PROM209) across every `alertmanager.yml` in the output. */
30
+ export declare function alertmanagerDiagnostics(ctx: PostSynthContext, code: PrometheusIssueCode): PostSynthDiagnostic[];
31
+ /** PROM202: joins every rule file in the output against every Alertmanager config in it. Silent when either is absent. */
32
+ export declare function routingDiagnostics(ctx: PostSynthContext): PostSynthDiagnostic[];
33
+ //# sourceMappingURL=prom-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom-helpers.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAG9F,OAAO,EAAkD,KAAK,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3H,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,cAAc,CAAA;KAAE,CAAC,CAAC;IAC7D,YAAY,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;CACrE;AAED,8JAA8J;AAC9J,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG,SAAS,CAsB/D;AAYD,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,mBAAmB,GAAG,mBAAmB,EAAE,CAM3G;AAED,sHAAsH;AACtH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,mBAAmB,GAAG,mBAAmB,EAAE,CAM/G;AAED,0HAA0H;AAC1H,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,GAAG,mBAAmB,EAAE,CAK/E"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM101: Two rule groups in one rule file share a name
3
+ *
4
+ * Prometheus refuses to load a rule file whose group names repeat.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom101: PostSynthCheck;
8
+ //# sourceMappingURL=prom101.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom101.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom101.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM102: Two rules share a name and label set
3
+ *
4
+ * Two recording rules (or two alerts) with the same name and labels produce the same series and overwrite each other. This follows promtool's duplicate-rules lint: alerts that share a name and differ by a label, such as severity, are fine.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom102: PostSynthCheck;
8
+ //# sourceMappingURL=prom102.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom102.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom102.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM103: A rule or group duration is not a Prometheus duration
3
+ *
4
+ * for, keep_firing_for, interval and query_offset take durations such as 30s, 5m or 1h30m. Prometheus refuses the rule file otherwise.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom103: PostSynthCheck;
8
+ //# sourceMappingURL=prom103.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom103.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom103.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM104: A rule expression is not valid PromQL
3
+ *
4
+ * Every expr is parsed with the PromQL grammar the Prometheus project publishes. A syntax error fails the rule file at load time.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom104: PostSynthCheck;
8
+ //# sourceMappingURL=prom104.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom104.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom104.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM105: A rule or group is malformed
3
+ *
4
+ * A rule sets exactly one of record and alert, has a non-empty name, and a recording rule takes no for, keep_firing_for or annotations. A group has a name.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom105: PostSynthCheck;
8
+ //# sourceMappingURL=prom105.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom105.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom105.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM106: An alerting rule has no severity label
3
+ *
4
+ * Alertmanager routes on labels, and severity is the one every route in this lexicon's examples and checks keys on. Without it the alert can only be routed by name.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom106: PostSynthCheck;
8
+ //# sourceMappingURL=prom106.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom106.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom106.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM107: An alerting rule has no summary or description annotation
3
+ *
4
+ * A notification carries only the alert's labels unless an annotation says what is wrong.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom107: PostSynthCheck;
8
+ //# sourceMappingURL=prom107.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom107.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom107.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM201: A route sends to a receiver that is not declared
3
+ *
4
+ * Alertmanager refuses a config whose routes name an undefined receiver.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom201: PostSynthCheck;
8
+ //# sourceMappingURL=prom201.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom201.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom201.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM202: An alert severity is not routed by any route
3
+ *
4
+ * Joins the rule files and the Alertmanager config in one build root. An alert whose severity no route below the root matches falls through to the root's default receiver. Silent when the rules and the Alertmanager config are built in different build roots (chant #1939).
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom202: PostSynthCheck;
8
+ //# sourceMappingURL=prom202.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom202.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom202.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM203: Two receivers or two time intervals share a name
3
+ *
4
+ * Alertmanager refuses a config with repeated receiver or time interval names.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom203: PostSynthCheck;
8
+ //# sourceMappingURL=prom203.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom203.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom203.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM204: A route names a time interval that is not declared
3
+ *
4
+ * mute_time_intervals and active_time_intervals must name entries under time_intervals.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom204: PostSynthCheck;
8
+ //# sourceMappingURL=prom204.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom204.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom204.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM205: The root route is missing, has no receiver, or has matchers
3
+ *
4
+ * The root route is the default for every alert: it must exist, name a receiver and match everything.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom205: PostSynthCheck;
8
+ //# sourceMappingURL=prom205.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom205.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom205.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM206: A route or inhibit rule matcher does not parse
3
+ *
4
+ * Matchers are label, operator (=, !=, =~, !~) and value, e.g. severity="page".
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom206: PostSynthCheck;
8
+ //# sourceMappingURL=prom206.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom206.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom206.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM207: A receiver is declared but no route sends to it
3
+ *
4
+ * An unused receiver usually means a route names the wrong one.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom207: PostSynthCheck;
8
+ //# sourceMappingURL=prom207.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom207.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom207.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM208: An Alertmanager duration is not a duration
3
+ *
4
+ * group_wait, group_interval, repeat_interval, resolve_timeout and webhook timeout take durations such as 30s or 4h.
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom208: PostSynthCheck;
8
+ //# sourceMappingURL=prom208.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom208.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom208.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PROM209: A receiver integration is missing its destination or credential
3
+ *
4
+ * A webhook needs url or url_file, Slack an api_url (or the global one), PagerDuty a routing_key or service_key, and email a to address, a smarthost and a from address (or their global defaults).
5
+ */
6
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
7
+ export declare const prom209: PostSynthCheck;
8
+ //# sourceMappingURL=prom209.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom209.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/prom209.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAOrB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { LintRule } from "@intentius/chant/lint/rule";
2
+ export { literalCredentialRule, SECRET_FIELDS } from "./literal-credential.js";
3
+ export { promqlLiteralRule } from "./promql-literal.js";
4
+ export { sloLiteralRule } from "./slo-literal.js";
5
+ /** All lint rules provided by this lexicon (imported by plugin.ts's lintRules()). */
6
+ export declare const rules: LintRule[];
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAK3D,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,qFAAqF;AACrF,eAAO,MAAM,KAAK,EAAE,QAAQ,EAA+D,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { LintRule } from "@intentius/chant/lint/rule";
2
+ /**
3
+ * Alertmanager fields that hold a secret, each with a `*_file` sibling that
4
+ * reads it from a mounted file instead.
5
+ */
6
+ export declare const SECRET_FIELDS: Set<string>;
7
+ /**
8
+ * PROM001: a credential written as a literal in a `Receiver` or
9
+ * `AlertmanagerSettings`.
10
+ *
11
+ * A literal there is a secret in the repository and in the emitted
12
+ * `alertmanager.yml`. Alertmanager does not expand environment variables in
13
+ * its config, so the fix is the field's `*_file` sibling (`api_url_file`,
14
+ * `routing_key_file`, `auth_password_file`, `credentials_file`), pointing at
15
+ * a file mounted from a secret store.
16
+ */
17
+ export declare const literalCredentialRule: LintRule;
18
+ //# sourceMappingURL=literal-credential.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"literal-credential.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/literal-credential.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAA+B,MAAM,4BAA4B,CAAC;AAGxF;;;GAGG;AACH,eAAO,MAAM,aAAa,aAaxB,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAkDnC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import * as ts from "typescript";
2
+ /** The constructor name of a `new X(...)` or `X(...)` expression, if it is a plain or dotted name. */
3
+ export declare function calleeName(node: ts.CallExpression | ts.NewExpression): string | undefined;
4
+ /** The classes whose props hold Alertmanager credentials. */
5
+ export declare const CREDENTIAL_CLASS: RegExp;
6
+ /** A property's key as text, for identifier and string-literal keys. */
7
+ export declare function propertyName(prop: ts.ObjectLiteralElementLike): string | undefined;
8
+ /** The text of a string literal or substitution-free template, else undefined. */
9
+ export declare function literalText(node: ts.Expression): string | undefined;
10
+ export declare function position(source: ts.SourceFile, node: ts.Node): {
11
+ line: number;
12
+ column: number;
13
+ };
14
+ //# sourceMappingURL=prom-ast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prom-ast.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/prom-ast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,sGAAsG;AACtG,wBAAgB,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,GAAG,EAAE,CAAC,aAAa,GAAG,MAAM,GAAG,SAAS,CAKzF;AAED,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,QAAsC,CAAC;AAEpE,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,wBAAwB,GAAG,MAAM,GAAG,SAAS,CAIlF;AAED,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,GAAG,MAAM,GAAG,SAAS,CAGnE;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAG/F"}
@@ -0,0 +1,11 @@
1
+ import type { LintRule } from "@intentius/chant/lint/rule";
2
+ /**
3
+ * PROM002: a rule's `expr`, written as a string literal inside a
4
+ * `RuleGroup`, is not valid PromQL.
5
+ *
6
+ * The same parse runs after the build as PROM104, over every rule in the
7
+ * emitted rule file. This rule reports it in the editor, at the expression,
8
+ * for the literals it can see; an `expr` built at runtime is left to PROM104.
9
+ */
10
+ export declare const promqlLiteralRule: LintRule;
11
+ //# sourceMappingURL=promql-literal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promql-literal.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/promql-literal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAA+B,MAAM,4BAA4B,CAAC;AAIxF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAyC/B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { LintRule } from "@intentius/chant/lint/rule";
2
+ /**
3
+ * PROM003: an `Slo` whose literal objective, window or SLI expression can
4
+ * not build.
5
+ *
6
+ * `Slo()` throws on the same problems when the build runs it; this rule
7
+ * reports them in the editor, at the literal: an objective outside (0, 1),
8
+ * a window that is not a positive Prometheus duration, and an SLI
9
+ * expression without `{{window}}` or that is not PromQL once it is filled
10
+ * in. Values built at runtime are left to the constructor.
11
+ */
12
+ export declare const sloLiteralRule: LintRule;
13
+ //# sourceMappingURL=slo-literal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slo-literal.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/slo-literal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAA+B,MAAM,4BAA4B,CAAC;AAwBxF;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,EAAE,QA6C5B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { CompletionContext, CompletionItem } from "@intentius/chant/lsp/types";
2
+ /** Completions for the prometheus entity classes: RuleGroup and the Alertmanager kinds. */
3
+ export declare function completions(ctx: CompletionContext): CompletionItem[];
4
+ //# sourceMappingURL=completions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completions.d.ts","sourceRoot":"","sources":["../../src/lsp/completions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAWpF,2FAA2F;AAC3F,wBAAgB,WAAW,CAAC,GAAG,EAAE,iBAAiB,GAAG,cAAc,EAAE,CAEpE"}
@@ -0,0 +1,4 @@
1
+ import type { HoverContext, HoverInfo } from "@intentius/chant/lsp/types";
2
+ /** Hover for prometheus entity classes: what the entity is and which file it lands in. */
3
+ export declare function hover(ctx: HoverContext): HoverInfo | undefined;
4
+ //# sourceMappingURL=hover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../src/lsp/hover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAY1E,0FAA0F;AAC1F,wBAAgB,KAAK,CAAC,GAAG,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS,CAE9D"}
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "prometheus",
3
+ "version": "0.96.0",
4
+ "chantVersion": ">=0.1.0",
5
+ "namespace": "Prometheus",
6
+ "intrinsics": [],
7
+ "pseudoParameters": {}
8
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Alertmanager label matchers: `severity="critical"`, `team=~"db|infra"`,
3
+ * `env!="dev"`.
4
+ *
5
+ * A matcher is a label name, an operator (`=`, `!=`, `=~`, `!~`) and a value,
6
+ * quoted or not. One list entry may also hold several comma-separated
7
+ * matchers in braces (`{a="1", b="2"}`), which Alertmanager accepts too.
8
+ * Regex values are anchored at both ends, as Alertmanager anchors them.
9
+ */
10
+ export type MatchOp = "=" | "!=" | "=~" | "!~";
11
+ export interface Matcher {
12
+ name: string;
13
+ op: MatchOp;
14
+ value: string;
15
+ }
16
+ export type ParsedMatchers = {
17
+ ok: true;
18
+ matchers: Matcher[];
19
+ } | {
20
+ ok: false;
21
+ error: string;
22
+ };
23
+ /** Parse one entry of a `matchers:` list. */
24
+ export declare function parseMatchers(entry: string): ParsedMatchers;
25
+ /** Whether one matcher matches a label set (a missing label reads as the empty string, as in Alertmanager). */
26
+ export declare function matcherMatches(m: Matcher, labels: Record<string, string>): boolean;
27
+ /** Build the matcher string for `name op value`, quoting the value. */
28
+ export declare function matcher(name: string, op: MatchOp, value: string): string;
29
+ //# sourceMappingURL=matchers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matchers.d.ts","sourceRoot":"","sources":["../src/matchers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AA6E9F,6CAA6C;AAC7C,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAe3D;AAED,+GAA+G;AAC/G,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAYlF;AAED,uEAAuE;AACvE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAExE"}
package/dist/meta.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "AlertmanagerSettings": {
3
+ "resourceType": "Prometheus::Alertmanager::Settings",
4
+ "kind": "resource",
5
+ "lexicon": "prometheus"
6
+ },
7
+ "InhibitRule": {
8
+ "resourceType": "Prometheus::Alertmanager::InhibitRule",
9
+ "kind": "resource",
10
+ "lexicon": "prometheus"
11
+ },
12
+ "Receiver": {
13
+ "resourceType": "Prometheus::Alertmanager::Receiver",
14
+ "kind": "resource",
15
+ "lexicon": "prometheus"
16
+ },
17
+ "Route": {
18
+ "resourceType": "Prometheus::Alertmanager::Route",
19
+ "kind": "resource",
20
+ "lexicon": "prometheus"
21
+ },
22
+ "RuleGroup": {
23
+ "resourceType": "Prometheus::Rules::RuleGroup",
24
+ "kind": "resource",
25
+ "lexicon": "prometheus"
26
+ },
27
+ "TimeInterval": {
28
+ "resourceType": "Prometheus::Alertmanager::TimeInterval",
29
+ "kind": "resource",
30
+ "lexicon": "prometheus"
31
+ }
32
+ }