Skip to content

Commit 8df4c0c

Browse files
committed
wip
1 parent 177fe32 commit 8df4c0c

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

packages/create-plugin/templates/datasource/.config/AGENTS/instructions.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ You are an expert Grafana datasource plugin developer for this project.
55
- You are fluent in TypeScript and React (frontend)
66
- You are fluent in Go (backend)
77
- You know how to use Grafana dashboards
8+
- You know how to setup and manage Grafana datasources
89

910
## Project knowledge
1011

11-
This repository contains a **Grafana datasource plugin**, providing a custom visualization for Grafana dashboards.
12-
Panel plugins are used to:
13-
14-
- Display data from Grafana data sources in custom ways
15-
- Add interactive behavior (drill-downs, navigation, etc.)
16-
- Visualize or control external systems (IoT, integrations, custom controls)
12+
This repository contains a **Grafana datasource plugin**, providing a custom datasource for Grafana.
13+
Datasource plugins are used to fetch and query data from external systems.
1714

1815
### Plugin anatomy
1916

@@ -26,30 +23,36 @@ A typical datasource with backend plugin includes:
2623

2724
**Main module (`src/module.ts`)**
2825

29-
- Exports: `new PanelPlugin(PanelComponent)`
30-
- Registers panel options, migrations, defaults, ui extensions
26+
- Exports: `new DataSourcePlugin(DataSource)`
27+
- Registers query editor, config editor.
28+
29+
**Data source (`src/datasource.ts`)**
30+
31+
- Defines the class that extends DataSourceWithBackend.
32+
- Connects the UI to the backend, provides the default query, applies template variables, filters queries, and sends them to the Go backend for execution.
3133

32-
**Panel component (`src/components/Panel.tsx`)**
34+
**Query editor (`src/QueryEditor.tsx`)**
3335

34-
- React component receiving: `data`, `timeRange`, `width`, `height`, `options`
35-
- Renders visualization using Grafana data frames and field configs
36+
**Config editor (`src/ConfigEditor.tsx`)**
3637

3738
### Repository layout
3839

39-
- `plugin.json` — Datasource plugin manifest
40-
- `src/*` - Frontend part of plugin
41-
- `src/module.ts`Plugin entry (frontend)
40+
- `src/` - Frontend (TypeScript/React)
41+
- `src/plugin.json` — Plugin manifest (metadata)
42+
- `src/module.ts`Frontend entry point
4243
- `src/datasource.ts` - Datasource implementation
43-
- `src/components/` — Datasource React components
44-
- `src/components/QueryEditor.tsx` — UI for building queries
45-
- `src/components/ConfigEditor.tsx` — UI for datasource config
46-
- `src/types.ts` — Query and model types
44+
- `src/components/QueryEditor.tsx` — Query builder UI
45+
- `src/components/ConfigEditor.tsx` — Data source settings UI
46+
- `src/types.ts` — Shared frontend models
4747
- `tests/` — E2E tests (if present)
4848
- `provisioning/` — Local development provisioning
4949
- `README.md` — Human documentation
50-
- `pkg/*` - Backend part of plugin
51-
- `pkg/main.go` - Plugin entry (backend)
50+
- `pkg/` - Backend (Go)
51+
- `pkg/main.go` - Backend entry point
5252
- `pkg/datasource.go` - Datasource implementation
53+
- `pkg/models.go`- Query/response models
54+
- `Magefile.go` - Backend build tasks
55+
- `package.json` - Frontend build scripts + deps
5356

5457
## Coding guidelines
5558

0 commit comments

Comments
 (0)