@cloudcare/guance-front-tools 1.0.18 → 1.0.19

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 (170) hide show
  1. package/README.md +32 -23
  2. package/lib/cjs/package.json +3 -0
  3. package/lib/cjs/scripts/convert-grafana-dashboard.js +6 -12
  4. package/lib/esm/package.json +3 -0
  5. package/lib/esm/scripts/convert-grafana-dashboard.js +0 -9
  6. package/lib/scripts/convert-grafana-dashboard.js +0 -10
  7. package/package.json +5 -3
  8. package/scripts/write-module-package-json.mjs +24 -0
  9. package/skills/grafana-to-guance-dashboard/SKILL.md +390 -33
  10. package/skills/grafana-to-guance-dashboard/agents/openai.yaml +2 -2
  11. package/skills/grafana-to-guance-dashboard/fixtures/grafana-dashboard.guance.json +1029 -0
  12. package/skills/grafana-to-guance-dashboard/fixtures/grafana-dashboard.json +878 -0
  13. package/skills/grafana-to-guance-dashboard/package.json +16 -0
  14. package/skills/grafana-to-guance-dashboard/references/conversion-audit-checklist.md +183 -0
  15. package/skills/grafana-to-guance-dashboard/references/converter-notes.md +114 -4
  16. package/skills/grafana-to-guance-dashboard/references/promql-compatibility-cheatsheet.md +172 -0
  17. package/skills/grafana-to-guance-dashboard/references/unit-inference-cheatsheet.md +174 -0
  18. package/skills/grafana-to-guance-dashboard/schemas/charts/chart-schema.json +84 -0
  19. package/skills/grafana-to-guance-dashboard/schemas/charts/common/chart-link-item-schema.json +48 -0
  20. package/skills/grafana-to-guance-dashboard/schemas/charts/common/chart-links-schema.json +9 -0
  21. package/skills/grafana-to-guance-dashboard/schemas/charts/common/common-chart-types-schema.json +39 -0
  22. package/skills/grafana-to-guance-dashboard/schemas/charts/common/common-vars-item-schema.json +117 -0
  23. package/skills/grafana-to-guance-dashboard/schemas/charts/common/common-vars-schema.json +10 -0
  24. package/skills/grafana-to-guance-dashboard/schemas/charts/dashboard-schema.json +80 -0
  25. package/skills/grafana-to-guance-dashboard/schemas/charts/query/queries-schema.json +10 -0
  26. package/skills/grafana-to-guance-dashboard/schemas/charts/query/query-item-schema.json +60 -0
  27. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-connect-null-schema.json +7 -0
  28. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-gradual-color-schema.json +72 -0
  29. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-groupby-schema.json +22 -0
  30. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-legend-position-schema.json +14 -0
  31. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-legend-values-schema.json +19 -0
  32. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-open-stack-schema.json +8 -0
  33. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-show-label-schema.json +8 -0
  34. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-show-line-schema.json +8 -0
  35. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-stack-content-schema.json +12 -0
  36. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-stack-type-schema.json +11 -0
  37. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-alarm-settings-schema.json +48 -0
  38. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-bar-settings-schema.json +69 -0
  39. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-chinamap-settings-schema.json +102 -0
  40. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-funnel-settings-schema.json +34 -0
  41. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-gauge-settings-schema.json +65 -0
  42. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-heatmap-settings-schema.json +50 -0
  43. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-hexgon-settings-schema.json +90 -0
  44. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-histogram-settings-schema.json +47 -0
  45. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-iframe-settings-schema.json +24 -0
  46. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-log-settings-schema.json +84 -0
  47. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-object-settings-schema.json +52 -0
  48. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-picture-settings-schema.json +46 -0
  49. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-pie-settings-schema.json +90 -0
  50. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-sankey-settings-schema.json +34 -0
  51. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-scatter-bubble-settings-schema.json +31 -0
  52. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-sequence-settings-schema.json +76 -0
  53. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-singlestat-settings-schema.json +163 -0
  54. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-table-settings-schema.json +184 -0
  55. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-text-settings-schema.json +20 -0
  56. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-toplist-settings-schema.json +117 -0
  57. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-topology-settings-schema.json +71 -0
  58. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-treemap-settings-schema.json +66 -0
  59. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-worldmap-settings-schema.json +102 -0
  60. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/common-settings-schema.json +82 -0
  61. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-alias-schema.json +47 -0
  62. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-chart-type-schema.json +27 -0
  63. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-colors-schema.json +46 -0
  64. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-compare-schema.json +58 -0
  65. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-fixed-time-schema.json +49 -0
  66. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-levels-schema.json +33 -0
  67. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-schema.json +79 -0
  68. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-time-schema.json +43 -0
  69. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-unit-items-schema.json +228 -0
  70. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-units-schema.json +59 -0
  71. package/skills/grafana-to-guance-dashboard/schemas/dashboard-schema.json +5 -0
  72. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/attribute-mutation-schema.json +21 -0
  73. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/attributes-schema.json +10 -0
  74. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/cdata-node-schema.json +19 -0
  75. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/creation-reason-schema.json +17 -0
  76. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/document-fragment-node-schema.json +35 -0
  77. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/document-node-schema.json +30 -0
  78. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/document-type-node-schema.json +28 -0
  79. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/element-node-schema.json +33 -0
  80. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/frustration-record-schema.json +49 -0
  81. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/full-snapshot-record-schema.json +26 -0
  82. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/incremental-data-schema.json +36 -0
  83. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/incremental-snapshot-record-schema.json +29 -0
  84. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/input-data-schema.json +27 -0
  85. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/input-state-schema.json +27 -0
  86. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/media-interaction-data-schema.json +23 -0
  87. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/media-interaction-schema.json +20 -0
  88. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mouse-interaction-data-schema.json +23 -0
  89. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mouse-interaction-schema.json +47 -0
  90. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mouse-move-data-schema.json +23 -0
  91. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mouse-position-schema.json +26 -0
  92. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mutation-data-schema.json +23 -0
  93. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mutation-payload-schema.json +42 -0
  94. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/node-added-mutation-schema.json +41 -0
  95. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/node-removed-mutation-schema.json +18 -0
  96. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/node-schema.json +28 -0
  97. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/record-schema.json +30 -0
  98. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/scroll-data-schema.json +23 -0
  99. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/scroll-position-schema.json +22 -0
  100. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/segment-metadata-schema.json +28 -0
  101. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/segment-schema.json +25 -0
  102. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/serialized-node-schema.json +15 -0
  103. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/serialized-node-with-id-schema.json +21 -0
  104. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/stylesheet-rule-add-schema.json +28 -0
  105. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/stylesheet-rule-data-schema.json +23 -0
  106. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/stylesheet-rule-delete-schema.json +24 -0
  107. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/stylesheet-rule-schema.json +29 -0
  108. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/stylesheet-schema.json +30 -0
  109. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/text-mutation-schema.json +27 -0
  110. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/text-node-schema.json +23 -0
  111. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/_common-record-schema.json +14 -0
  112. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/_common-segment-metadata-schema.json +30 -0
  113. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/_slot-supported-common-record-schema.json +21 -0
  114. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/focus-record-schema.json +34 -0
  115. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/meta-record-schema.json +42 -0
  116. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/pointer-interaction-data-schema.json +23 -0
  117. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/pointer-interaction-schema.json +34 -0
  118. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/segment-context-schema.json +46 -0
  119. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/view-end-record-schema.json +23 -0
  120. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/viewport-resize-data-schema.json +23 -0
  121. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/viewport-resize-dimension-schema.json +18 -0
  122. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/visual-viewport-record-schema.json +50 -0
  123. package/skills/grafana-to-guance-dashboard/schemas/session-replay/full-snapshot-record-schema.json +14 -0
  124. package/skills/grafana-to-guance-dashboard/schemas/session-replay/incremental-data-schema.json +14 -0
  125. package/skills/grafana-to-guance-dashboard/schemas/session-replay/incremental-snapshot-record-schema.json +14 -0
  126. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/_common-shape-wireframe-schema.json +22 -0
  127. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/_common-shape-wireframe-update-schema.json +22 -0
  128. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/_common-wireframe-schema.json +38 -0
  129. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/_common-wireframe-update-schema.json +38 -0
  130. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/full-snapshot-record-schema.json +38 -0
  131. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/image-wireframe-schema.json +43 -0
  132. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/image-wireframe-update-schema.json +43 -0
  133. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/incremental-data-schema.json +21 -0
  134. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/incremental-snapshot-record-schema.json +26 -0
  135. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/mutation-data-schema.json +23 -0
  136. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/mutation-payload-schema.json +55 -0
  137. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/placeholder-wireframe-schema.json +28 -0
  138. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/placeholder-wireframe-update-schema.json +28 -0
  139. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/record-schema.json +27 -0
  140. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/segment-metadata-schema.json +25 -0
  141. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/segment-schema.json +25 -0
  142. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/shape-border-schema.json +25 -0
  143. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/shape-style-schema.json +29 -0
  144. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/shape-wireframe-schema.json +23 -0
  145. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/shape-wireframe-update-schema.json +23 -0
  146. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/text-position-schema.json +57 -0
  147. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/text-style-schema.json +31 -0
  148. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/text-wireframe-schema.json +34 -0
  149. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/text-wireframe-update-schema.json +34 -0
  150. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/touch-data-schema.json +51 -0
  151. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/webview-wireframe-schema.json +33 -0
  152. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/webview-wireframe-update-schema.json +33 -0
  153. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/wireframe-clip-schema.json +29 -0
  154. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/wireframe-schema.json +24 -0
  155. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/wireframe-update-mutation-schema.json +24 -0
  156. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mutation-data-schema.json +14 -0
  157. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mutation-payload-schema.json +14 -0
  158. package/skills/grafana-to-guance-dashboard/schemas/session-replay/record-schema.json +14 -0
  159. package/skills/grafana-to-guance-dashboard/schemas/session-replay/segment-metadata-schema.json +14 -0
  160. package/skills/grafana-to-guance-dashboard/schemas/session-replay/segment-schema.json +15 -0
  161. package/skills/grafana-to-guance-dashboard/schemas/session-replay-browser-schema.json +5 -0
  162. package/skills/grafana-to-guance-dashboard/schemas/session-replay-mobile-schema.json +5 -0
  163. package/skills/grafana-to-guance-dashboard/schemas/session-replay-schema.json +33 -0
  164. package/skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard.mjs +8 -13
  165. package/skills/grafana-to-guance-dashboard/scripts/validate-file.mjs +62 -0
  166. package/skills/grafana-to-guance-dashboard/test/convert.test.mjs +54 -0
  167. package/test/cli.test.mjs +27 -1
  168. package/tsconfig.cjs.scripts.json +19 -0
  169. package/tsconfig.esm.scripts.json +19 -0
  170. package/scripts/sync-converter.mjs +0 -57
@@ -1,48 +1,368 @@
1
1
  ---
2
2
  name: grafana-to-guance-dashboard
3
- description: Convert Grafana dashboard JSON into Guance dashboard JSON in this repository. Use when the user wants to convert a Grafana dashboard file, adjust mapping logic for panels or variables, preserve settings, groups, and vars as much as possible, validate generated Guance dashboard JSON against local schemas, or debug why a Grafana dashboard does not convert cleanly.
3
+ description: Convert Grafana dashboard JSON into Guance dashboard JSON with a fully self-contained skill package. Use when the user wants to analyze Grafana dashboards before conversion, run conversion, audit conversion gaps, improve units or PromQL compatibility with LLM-assisted review, repair panel or variable mappings, preserve settings, groups, and vars as much as possible, validate generated Guance dashboard JSON against the bundled schemas, or debug why a Grafana dashboard does not convert cleanly.
4
4
  ---
5
5
 
6
6
  # Grafana To Guance Dashboard
7
7
 
8
8
  ## Overview
9
9
 
10
- Use this skill when working on Grafana dashboard to Guance dashboard conversion in this repository.
10
+ Use this skill when working on Grafana dashboard to Guance dashboard conversion as a standalone package.
11
11
 
12
- This skill ships its own standalone converter script under `skills/grafana-to-guance-dashboard/scripts/`. Use that script first. Only inspect the older repository converter when the user explicitly wants comparison or historical behavior.
12
+ This skill is self-contained. Use only the files under `skills/grafana-to-guance-dashboard/` unless the user explicitly asks to compare with older repository code or migrate logic elsewhere.
13
+
14
+ This is not just a script-running skill. Use the LLM before and after conversion to analyze risk, explain missing mappings, compare Grafana and Guance structures, infer likely units when Grafana leaves them implicit, audit PromQL dialect differences, and propose or implement converter fixes.
15
+
16
+ For the default end-to-end operating sequence, also use [references/conversion-audit-checklist.md](references/conversion-audit-checklist.md).
17
+
18
+ The skill directory now includes its own:
19
+
20
+ - converter scripts
21
+ - validation script
22
+ - schema copy
23
+ - fixture input
24
+ - test suite
25
+ - `package.json` for standalone dependency installation
13
26
 
14
27
  ## Core Workflow
15
28
 
16
- 1. Identify the input Grafana dashboard and output path.
17
- 2. Run the standalone skill script.
18
- 3. Validate the generated Guance dashboard against local schemas.
19
- 4. If conversion gaps remain, patch the standalone skill script and re-run validation.
20
- 5. Only inspect the older repository converter if the user asks to compare outputs.
29
+ 1. Change into `skills/grafana-to-guance-dashboard/`.
30
+ 2. Install standalone dependencies with `npm install` when needed.
31
+ 3. Read the input Grafana dashboard and perform a preflight analysis before running the converter.
32
+ 4. Identify the output path and choose conversion flags.
33
+ 5. Run the standalone skill script.
34
+ 6. Validate the generated Guance dashboard against the skill-local schemas.
35
+ 7. Audit the conversion result:
36
+ - compare Grafana panel count to Guance chart count
37
+ - identify dropped or partially converted panels
38
+ - identify variable and query mapping gaps
39
+ - identify missing or suspicious unit mappings
40
+ - identify PromQL expressions that may need Guance-specific normalization
41
+ - explain likely causes
42
+ 8. If conversion gaps remain, patch the standalone skill script in this skill directory and re-run validation.
43
+ 9. Run the skill-local test suite before finishing substantial changes.
44
+ 10. Produce a concise conversion report for the user.
45
+ 11. Only inspect older repository converters if the user explicitly asks to compare outputs or port behavior.
46
+
47
+ ## LLM Responsibilities
48
+
49
+ Use the model for the parts that the deterministic converter cannot do reliably on its own.
50
+
51
+ - Preflight analysis:
52
+ - inspect panel types, datasources, variables, transformations, and likely risk areas before conversion
53
+ - decide whether to recommend `--guance-promql-compatible` or `--keep-grafana-meta`
54
+ - Unit inference:
55
+ - when Grafana does not provide an explicit unit, inspect metric names, PromQL functions, panel titles, legends, and threshold semantics
56
+ - infer likely units such as bytes, percent, ms, s, reqps, ops, or count-like `none`
57
+ - separate high-confidence guesses from low-confidence guesses
58
+ - PromQL compatibility audit:
59
+ - inspect whether Grafana-side PromQL assumes naming or selector conventions that differ from Guance expectations
60
+ - flag queries that may need `measurement:field` normalization, label handling adjustments, or manual rewrite
61
+ - distinguish safe rewrites from suspicious rewrites that need human review
62
+ - Post-conversion audit:
63
+ - compare input Grafana structure to output Guance structure
64
+ - explain which panels converted cleanly, which were dropped, and which are only partially represented
65
+ - explain where units, query semantics, or chart intent were guessed instead of explicitly mapped
66
+ - Repair mode:
67
+ - inspect the original Grafana panel JSON plus the generated Guance chart JSON
68
+ - infer whether the gap belongs in panel type mapping, query classification, settings extraction, variable conversion, or layout conversion
69
+ - propose and, when asked, implement the smallest converter patch that closes the gap
70
+ - Reporting:
71
+ - summarize risk, output quality, missing mappings, and next actions in user-facing language
72
+
73
+ Do not use the LLM to replace deterministic conversion logic when a stable script rule is more appropriate. Use the LLM to analyze, compare, explain, and narrow down the next converter change.
74
+
75
+ When the LLM makes an inference, state the confidence level and reason. Prefer:
76
+
77
+ - `high`
78
+ - strong signal from explicit metric names, titles, units, or standard PromQL patterns
79
+ - `medium`
80
+ - probable signal from multiple weak hints
81
+ - `low`
82
+ - ambiguous cases that should be surfaced for review rather than silently accepted
83
+
84
+ ## Preferred Modes
85
+
86
+ Choose the mode that matches the user request.
87
+
88
+ - `analyze`
89
+ - inspect a Grafana dashboard without converting it yet
90
+ - report likely risks, unsupported panel types, datasource concerns, and recommended flags
91
+ - `convert`
92
+ - run the converter and validate the output
93
+ - `audit`
94
+ - compare Grafana input and Guance output to identify missing or partial mappings
95
+ - `unit-audit`
96
+ - identify panels where unit inference is missing, suspicious, or worth improving
97
+ - `compatibility`
98
+ - inspect PromQL expressions for Grafana-to-Guance dialect mismatches and recommend flags or rewrites
99
+ - `repair`
100
+ - patch the standalone converter to improve one concrete conversion gap
101
+ - `report`
102
+ - produce a concise handoff summary for human review or the next agent
21
103
 
22
104
  ## Commands
23
105
 
24
- Use this command from the repository root.
106
+ Use these commands from `skills/grafana-to-guance-dashboard/`.
25
107
 
26
108
  ```bash
109
+ npm install
110
+
27
111
  # Convert a Grafana dashboard JSON to Guance JSON
28
- node skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard.mjs \
29
- --input path/to/grafana-dashboard.json \
30
- --output path/to/guance-dashboard.json \
112
+ npm run convert -- \
113
+ --input ./fixtures/grafana-dashboard.json \
114
+ --output ./output/guance-dashboard.json \
31
115
  --validate
32
116
 
33
117
  # Convert and normalize PromQL metric names toward Guance measurement:field style
34
- node skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard.mjs \
35
- --input path/to/grafana-dashboard.json \
36
- --output path/to/guance-dashboard.guance-promql.json \
118
+ npm run convert -- \
119
+ --input ./fixtures/grafana-dashboard.json \
120
+ --output ./output/guance-dashboard.guance-promql.json \
37
121
  --validate \
38
122
  --guance-promql-compatible
39
123
 
40
124
  # Convert and keep original Grafana metadata under extend.grafana for debugging
41
- node skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard.mjs \
42
- --input path/to/grafana-dashboard.json \
43
- --output path/to/guance-dashboard.keep-meta.json \
125
+ npm run convert -- \
126
+ --input ./fixtures/grafana-dashboard.json \
127
+ --output ./output/guance-dashboard.keep-meta.json \
44
128
  --validate \
45
129
  --keep-grafana-meta
130
+
131
+ # Validate an already-generated output file against the skill-local schemas
132
+ npm run validate:file -- ./output/guance-dashboard.json
133
+
134
+ # Run the skill-local regression tests
135
+ npm test
136
+ ```
137
+
138
+ ## Preflight Checklist
139
+
140
+ Before converting, inspect:
141
+
142
+ - panel types present in the dashboard
143
+ - datasource types used by variables and targets
144
+ - row panels and collapse behavior
145
+ - transformations, overrides, and panel links
146
+ - built-in Grafana variables versus user-defined variables
147
+ - query fields used by targets such as `expr`, `query`, `queryText`, `expression`, and `rawSql`
148
+ - likely implied units from metric names, panel titles, legends, and query structure
149
+ - likely PromQL dialect mismatches between Grafana usage and Guance usage
150
+
151
+ Call out:
152
+
153
+ - unsupported panel types
154
+ - dashboards likely to need `--keep-grafana-meta`
155
+ - dashboards likely to benefit from `--guance-promql-compatible`
156
+ - panels whose unit is likely implicit and should be inferred during audit
157
+ - dashboards likely to need manual cleanup after conversion
158
+
159
+ ## Post-Conversion Audit
160
+
161
+ After converting, always check:
162
+
163
+ - how many Grafana panels were present
164
+ - how many Guance charts were emitted
165
+ - which Grafana panels were dropped or collapsed into groups
166
+ - whether expected variables were converted
167
+ - whether query text and qtype classification look correct
168
+ - whether unit mapping is explicit, inferred with confidence, or still missing
169
+ - whether PromQL normalization looks safe or suspicious
170
+ - whether important settings were mapped or only preserved under `extend.grafana`
171
+ - whether validation passed cleanly
172
+
173
+ When gaps are found, explain them explicitly instead of only saying the output is invalid or incomplete.
174
+
175
+ ## Conversion Report
176
+
177
+ When the user asks for conversion, audit, or repair work, provide a short report that includes:
178
+
179
+ - input file
180
+ - output file
181
+ - flags used
182
+ - validation result
183
+ - converted successfully
184
+ - dropped or unsupported panels
185
+ - partial mappings or suspicious settings
186
+ - inferred units and their confidence when relevant
187
+ - PromQL compatibility concerns and whether `--guance-promql-compatible` was used
188
+ - recommended next step
189
+
190
+ Use this shape by default:
191
+
192
+ ```md
193
+ Conversion report
194
+
195
+ - input: ...
196
+ - output: ...
197
+ - flags: ...
198
+ - validation: pass | fail
199
+ - panel summary: X Grafana panels -> Y Guance charts
200
+ - dropped: ...
201
+ - partial: ...
202
+ - units inferred: ...
203
+ - compatibility concerns: ...
204
+ - next step: ...
205
+ ```
206
+
207
+ ## Decision Rules
208
+
209
+ Use these defaults unless the user asks otherwise.
210
+
211
+ - Recommend `--guance-promql-compatible` when:
212
+ - most queries are PromQL
213
+ - metric names follow underscore-heavy Prometheus naming
214
+ - the dashboard appears intended for Guance metrics compatibility rather than stock Prometheus naming
215
+ - Do not recommend `--guance-promql-compatible` when:
216
+ - the dashboard already mixes Guance-native metric names
217
+ - query text looks hand-tuned for a non-Guance Prometheus backend
218
+ - normalization would be low-confidence or risky
219
+ - Recommend `--keep-grafana-meta` when:
220
+ - the user is debugging missing settings or dropped panels
221
+ - plugin-specific options or complex transformations are present
222
+ - the conversion result needs a detailed forensic comparison
223
+ - Do not enable `--keep-grafana-meta` by default for final output unless debugging context is explicitly useful
224
+
225
+ ## Confidence Rules
226
+
227
+ When reporting inferred units or compatibility advice, classify each item as:
228
+
229
+ - `high`
230
+ - explicit metric suffixes or standard patterns strongly support the conclusion
231
+ - `medium`
232
+ - multiple hints support the conclusion, but at least one ambiguity remains
233
+ - `low`
234
+ - evidence is weak or conflicting
235
+
236
+ For `low` confidence cases:
237
+
238
+ - surface the issue explicitly
239
+ - avoid presenting the guess as settled fact
240
+ - prefer saying manual review is needed
241
+
242
+ ## Panel Audit Template
243
+
244
+ When the user asks for a deeper audit, summarize per panel using a compact structure:
245
+
246
+ ```md
247
+ - panel: <title>
248
+ status: clean | partial | dropped | suspicious
249
+ chart type: <grafana type> -> <guance type or none>
250
+ query: promql | dql | unknown
251
+ unit: explicit | inferred(high/medium/low) | missing
252
+ notes: <main risk or mapping gap>
253
+ ```
254
+
255
+ Do not enumerate every panel when the dashboard is large unless the user asks for that level of detail. Prefer summarizing only the risky, dropped, or suspicious panels.
256
+
257
+ ## Audit Examples
258
+
259
+ Use outputs like these as style references. Do not copy them blindly; adapt them to the actual dashboard.
260
+
261
+ Example: missing unit, high confidence
262
+
263
+ ```md
264
+ Conversion report
265
+
266
+ - input: ./fixtures/example.json
267
+ - output: ./output/example.guance.json
268
+ - flags: --validate
269
+ - validation: pass
270
+ - panel summary: 12 Grafana panels -> 12 Guance charts
271
+ - dropped: none
272
+ - partial: one latency panel kept its chart but had no explicit unit in Grafana
273
+ - units inferred:
274
+ - API P95 Latency -> ms (high)
275
+ reason: query contains `histogram_quantile`, panel title contains `Latency`, metric names contain `_bucket`
276
+ - compatibility concerns: none
277
+ - next step: accept output and spot-check latency charts in UI
278
+ ```
279
+
280
+ Example: PromQL compatibility concern
281
+
282
+ ```md
283
+ Conversion report
284
+
285
+ - input: ./fixtures/example.json
286
+ - output: ./output/example.guance-promql.json
287
+ - flags: --validate --guance-promql-compatible
288
+ - validation: pass
289
+ - panel summary: 8 Grafana panels -> 8 Guance charts
290
+ - dropped: none
291
+ - partial:
292
+ - one panel marked suspicious because metric names may already be Guance-native
293
+ - units inferred: none
294
+ - compatibility concerns:
295
+ - Request Volume panel -> suspicious
296
+ reason: query mixes underscore-style Prometheus metrics with a recording-rule name that already contains `:`
297
+ - next step: review the rewritten query before using this output as final
298
+ ```
299
+
300
+ Example: dropped panel with repair suggestion
301
+
302
+ ```md
303
+ - panel: JVM Heap Breakdown
304
+ status: dropped
305
+ chart type: state-timeline -> none
306
+ query: promql
307
+ unit: inferred(high) -> bytes
308
+ notes: panel type is unsupported; likely next fix belongs in panel type map plus settings conversion
309
+ ```
310
+
311
+ ## Unit Inference Cheatsheet
312
+
313
+ Use [references/unit-inference-cheatsheet.md](references/unit-inference-cheatsheet.md) when:
314
+
315
+ - unit inference is part of the user request
316
+ - panel units are missing or suspicious
317
+ - you need a quick evidence-based guess before proposing a converter change
318
+
319
+ Treat the cheatsheet as a guide, not a hard rule. If real dashboard context contradicts it, explain why.
320
+
321
+ ## PromQL Compatibility Cheatsheet
322
+
323
+ Use [references/promql-compatibility-cheatsheet.md](references/promql-compatibility-cheatsheet.md) when:
324
+
325
+ - PromQL compatibility is part of the user request
326
+ - you need to decide whether `--guance-promql-compatible` is a good default
327
+ - rewritten queries look suspicious
328
+ - Grafana queries appear to mix Prometheus-native naming with Guance-native naming
329
+
330
+ Treat the cheatsheet as a review aid, not an automatic rewrite mandate.
331
+
332
+ ## Repair Example
333
+
334
+ Use a flow like this when moving from audit to repair.
335
+
336
+ ```md
337
+ Observed issue
338
+
339
+ - panel: Request Volume
340
+ - status: suspicious
341
+ - chart type: timeseries -> sequence
342
+ - query: promql
343
+ - unit: inferred(high) -> reqps
344
+ - notes: query rewrites metric names, but one recording-rule metric already contains `:`
345
+
346
+ Reasoning
347
+
348
+ - base mapping is probably correct
349
+ - the main risk is not panel type
350
+ - the likely gap belongs in PromQL normalization, not in settings conversion
351
+
352
+ Patch plan
353
+
354
+ - inspect the normalization rule that rewrites `metric_name` to `measurement:field`
355
+ - keep underscore-style Prometheus metric names eligible for rewrite
356
+ - skip rewriting tokens that already contain `:`
357
+ - re-run conversion with and without `--guance-promql-compatible`
358
+ - compare the resulting query text and keep the safer variant
359
+
360
+ User-facing summary
361
+
362
+ - the panel was not dropped
363
+ - the chart type is acceptable
364
+ - the risky part is query normalization
365
+ - next step is a small normalization patch, not a broad converter refactor
46
366
  ```
47
367
 
48
368
  ## Script Layout
@@ -58,24 +378,36 @@ The skill script directory contains two files:
58
378
  - pure conversion logic
59
379
  - no file-system or schema-validation responsibilities
60
380
 
381
+ The skill directory also includes:
382
+
383
+ - `skills/grafana-to-guance-dashboard/scripts/validate-file.mjs`
384
+ - standalone validation entrypoint
385
+ - always validates against the skill-local `schemas/`
386
+ - `skills/grafana-to-guance-dashboard/schemas/`
387
+ - local schema copy used for standalone validation
388
+ - `skills/grafana-to-guance-dashboard/fixtures/`
389
+ - bundled sample Grafana dashboard for standalone smoke tests
390
+ - `skills/grafana-to-guance-dashboard/test/`
391
+ - bundled standalone regression tests
392
+ - `skills/grafana-to-guance-dashboard/package.json`
393
+ - standalone runtime dependencies and convenience scripts
394
+
395
+ Treat these two files as the source of truth for this skill.
396
+
61
397
  ## How To Edit
62
398
 
63
- Do not hand-edit the generated skill script copies unless you are explicitly debugging the skill directory itself.
399
+ This skill must remain usable on its own. Do not rely on repository sync/build steps as the default workflow.
64
400
 
65
401
  - For conversion behavior changes:
66
- - edit `lib/scripts/convert-grafana-dashboard-core.js`
402
+ - edit `skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard-core.js`
67
403
  - For CLI / validation behavior changes:
68
- - edit `lib/scripts/convert-grafana-dashboard.js`
69
- - After editing either one:
70
- - run `node scripts/sync-converter.mjs`
71
- - or run `npm run build`
72
-
73
- The sync step copies the repository wrapper/core into:
404
+ - edit `skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard.mjs`
405
+ - After editing:
406
+ - re-run the standalone converter command from this skill
407
+ - re-run validation against the target output file
408
+ - re-run the post-conversion audit
74
409
 
75
- - `skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard.mjs`
76
- - `skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard-core.js`
77
-
78
- The synced outputs are transpiled to avoid syntax such as `?.` and `??` in published/skill-facing files.
410
+ Only touch repository-level converters or build scripts when the user explicitly asks to keep them in sync.
79
411
 
80
412
  ## What The Standalone Skill Converter Supports
81
413
 
@@ -112,21 +444,46 @@ The synced outputs are transpiled to avoid syntax such as `?.` and `??` in publi
112
444
  - Plugin-specific Grafana options are converted heuristically, not losslessly.
113
445
  - Unsupported panel types are filtered out unless the mapping table is extended.
114
446
  - Complex transformations and non-standard datasource payloads may still need manual cleanup.
447
+ - Standalone validation depends on installing the skill-local `package.json` dependencies.
448
+ - The bundled tests cover conversion plus schema validation for the bundled fixture dashboard.
449
+ - LLM-based audit and repair suggestions are heuristic; confirm proposed fixes against a real dashboard sample and schema validation.
450
+ - LLM-based unit inference and PromQL compatibility advice should be treated as guided review, not silent truth, unless confidence is high.
115
451
 
116
452
  When conversion fails or output is incomplete, read [references/converter-notes.md](references/converter-notes.md).
117
453
 
118
454
  ## Editing Rules
119
455
 
120
456
  - Only change schemas when the generated Guance JSON is valid real data but the schema is too strict.
121
- - Keep validation green:
122
- - `npm run validate`
123
- - `npm run validate:dashboard`
457
+ - Prefer changing the standalone converter before relaxing schemas.
458
+ - Prefer validating the concrete output file first:
459
+ - `npm run validate:file -- ./output/guance-dashboard.json`
460
+ - For substantial converter changes, also run:
461
+ - `npm test`
124
462
  - When adding support for a new Grafana panel type, update the standalone script's panel type map first, then validate an example dashboard.
463
+ - When debugging a missing panel, compare the original Grafana panel JSON and the generated Guance chart JSON before changing code.
464
+ - When debugging a wrong query or setting, identify whether the gap is in extraction, classification, or setting-mapping logic before editing.
465
+ - When a panel is missing a unit, inspect query names, panel title, legend, and thresholds before deciding whether the converter should infer one.
466
+ - When a query looks valid in Grafana but suspicious in Guance, audit naming conventions and selector syntax before changing classification rules.
467
+
468
+ ## Standalone Use Rules
469
+
470
+ - Default to the standalone converter shipped in this skill.
471
+ - Keep all conversion logic needed by the skill inside `skills/grafana-to-guance-dashboard/scripts/`.
472
+ - Keep validation schemas needed by the skill inside `skills/grafana-to-guance-dashboard/schemas/`.
473
+ - Keep smoke-test inputs and regression tests inside this skill directory.
474
+ - Do not make the skill depend on `lib/scripts/*`, sync steps, root-level schemas, repository fixtures, or build steps for normal use.
475
+ - If behavior is duplicated elsewhere in the repository, treat that as optional follow-up work, not part of the default skill workflow.
125
476
 
126
477
  ## Typical Requests This Skill Should Handle
127
478
 
479
+ - "Analyze this Grafana dashboard and tell me the conversion risks before you run anything."
128
480
  - "Convert this Grafana dashboard JSON to Guance format."
129
481
  - "Why did this Grafana panel disappear after conversion?"
482
+ - "Compare this Grafana dashboard and generated Guance dashboard, then list missing panels and likely causes."
483
+ - "Decide whether this dashboard should use `--guance-promql-compatible`."
484
+ - "Infer missing units for these panels and tell me which guesses are high confidence."
485
+ - "Audit these PromQL queries for Grafana-to-Guance compatibility problems."
486
+ - "Patch the converter so this Grafana panel type maps correctly."
130
487
  - "Add support for Grafana panel type `xyz`."
131
488
  - "Map Grafana variables into Guance vars correctly."
132
489
  - "Validate the converted Guance dashboard against the local schema."
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "Grafana to Guance"
3
- short_description: "Convert Grafana dashboards to Guance format"
4
- default_prompt: "Use $grafana-to-guance-dashboard to convert a Grafana dashboard JSON into a Guance dashboard and validate the result."
3
+ short_description: "Analyze, convert, audit, infer units, and repair Grafana-to-Guance dashboard mappings"
4
+ default_prompt: "Use $grafana-to-guance-dashboard to analyze a Grafana dashboard, choose conversion flags, run conversion, audit the Guance output, infer likely units when Grafana leaves them implicit, inspect PromQL compatibility differences between Grafana and Guance, explain missing mappings with confidence, and repair the standalone converter when needed."