grafana / grafana/plugin-tools

Feat: Experimental support for Kinds via grafana-app-sdk

Closed
#2,842 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
89
Forks
57
Avg merge
3d 17h
Merged PRs (30d)
37

Description

### Which areas does this feature request relate to

- [x] Create Plugin
- [ ] Sign Plugin
- [ ] Plugin E2E
- [ ] Plugin Meta Extractor
- [ ] Documentation

### Problem

Support is being added to Grafana for processing "app manifest" embedded in plugins, generated by `grafana-app-sdk`. It would be valuable to have support in `create-plugin` to setup the scaffolding to enhance the user experience.

### Solution

Whilst this is considered experimental and not for general consumption, we can hide the extra scaffolding:

```
create-plugin add experimental-app-sdk
```

The extra scaffolding would include:
1. A directory for storing the `.cue` files, and some skeleton files:
`/kinds/...`
2. A command to run the app-sdk code generator
`npm run generate:kinds`
3. An extra hint in `AGENTS/instructions.md` about app-sdk/kinds and how/when to run code generation
4. For backend plugins, some Go code modifications

### Alternatives

- Variation on this is to add it to Go codegen/Magefile instead of npm (= e.g. mage `generate-kinds`), but frontend-only apps that define kinds are feasible and sensible.
- Creating or adding the functionality an external tool is another option (e.g. the app-sdk itself)

### Task List

- [x] Support for manifest generation from .cue files (https://github.com/grafana/plugin-tools/pull/2853)
- [x] Support scaffolding backends too to support validation/mutation/conversion/routes (https://github.com/grafana/plugin-tools/pull/2856)

Improvements:
- [ ] Think about ways for plugins to use generated API clients for custom resources
- [x] Catch drift between the cue kinds and the generated types/manifest (CI? Build step?)
https://github.com/grafana/plugin-tools/pull/2862
- [ ] Warns if a plugin ships a manifest while its grafanaDependency includes versions that can't serve it
- [ ] Documented best-practice on how to manage versioning
- [ ] Iterate on AGENTS.md for how to use various SDK features
- [x] Print "Next steps" at end
- [ ] Simplify injecting "sdkplugin.Run" by extending "plugin.Manage" instead
- [x] Automate `go mod tidy`

Contributor guide

Open the contributing guide

Research direction

Start with the create-plugin scaffolding entry point and review the linked manifest-generation, backend-scaffolding, and drift-detection pull requests. Check how /kinds, npm run generate:kinds, AGENTS/instructions.md, and backend Go changes are assembled. Done means the experimental command produces the requested scaffolding and the remaining task-list behavior is defined and covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, typescript
Domain
backend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.