Other Panel and Datasource Plugins
Show the whole prompt
Read https://intentius.io/chant/lexicons/grafana/custom-plugins/.
Declare the panel plugin or datasource query class I name with `definePanel` or `defineQuery`, typed from the plugin's own options, in this chant project's src/.
Use it in a dashboard, run `npx chant build src --lexicon grafana -o dist/grafana/index.json` and `npx chant lint src` until both are clean, and open a pull request.
In its description, say that GRAF107 does not check the new definition's options.
Never deploy to a real cloud account or shared environment (with `chant run`, `chant components` or a platform's own CLI), approve (a pull request review, `chant approve` or `chant run approve`), override a policy denial (`chant approve policy-override`), or merge; never cut or publish a release (`chant release cut --yes` or `chant release publish`), push or delete a `ci/*` tag (`chant ci tick` pushes them), or change the value of an existing flag; never touch `.chant/allowed_signers` or `chant/lifecycle`.Optional: hand this page to your coding agent
Read https://intentius.io/chant/lexicons/grafana/custom-plugins/.Declare the panel plugin or datasource query class I name with `definePanel` or `defineQuery`, typed from the plugin's own options, in this chant project's src/.Use it in a dashboard, run `npx chant build src --lexicon grafana -o dist/grafana/index.json` and `npx chant lint src` until both are clean, and open a pull request.In its description, say that GRAF107 does not check the new definition's options.Never deploy to a real cloud account or shared environment (with `chant run`, `chant components` or a platform's own CLI), approve (a pull request review, `chant approve` or `chant run approve`), override a policy denial (`chant approve policy-override`), or merge; never cut or publish a release (`chant release cut --yes` or `chant release publish`), push or delete a `ci/*` tag (`chant ci tick` pushes them), or change the value of an existing flag; never touch `.chant/allowed_signers` or `chant/lifecycle`.The built-in panels and query classes are defined through definePanel and defineQuery. A plugin chant doesn’t ship uses the same two functions and gets the same layout, serialization and checks.
A panel plugin
Section titled “A panel plugin”import { definePanel } from "@intentius/chant-lexicon-grafana";
interface ClockOptions { mode?: "time" | "countdown"; clockType?: "24 hour" | "12 hour"; countdownSettings?: { endCountdownTime?: string; endText?: string };}
export const ClockPanel = definePanel<ClockOptions>()({ type: "grafana-clock-panel", className: "ClockPanel", description: "Clock", defaultSize: { w: 6, h: 4 },});The second type parameter types fieldConfig.defaults.custom. type is the plugin id Grafana stores; redefining a built-in id throws.
A datasource’s queries
Section titled “A datasource’s queries”import { defineQuery } from "@intentius/chant-lexicon-grafana";
interface SplunkQueryModel { rawQuery: string; queryType?: "search" | "metrics"; refId?: string;}
export const SplunkQuery = defineQuery<SplunkQueryModel>()({ datasourceType: "grafana-splunk-datasource", className: "SplunkQuery", expressionField: "rawQuery",});new SplunkQuery({ datasource }) accepts only a grafana-splunk-datasource datasource, and GRAF101 to GRAF103 check its targets like any other. A datasource type chant ships a class for (see Queries and Datasources) cannot be redefined.
What is not checked
Section titled “What is not checked”A definition without a schema gets no GRAF107 check for its options or queries, since the lexicon has nothing pinned to check them against. Its TypeScript type is the only contract.