Skip to content

chore(integrations/grafana): cleanp code gen#15221

Merged
franklevasseur merged 4 commits into
masterfrom
fl_grafana_geration_cleanup
May 27, 2026
Merged

chore(integrations/grafana): cleanp code gen#15221
franklevasseur merged 4 commits into
masterfrom
fl_grafana_geration_cleanup

Conversation

@franklevasseur
Copy link
Copy Markdown
Member

No description provided.

@franklevasseur franklevasseur requested a review from a team as a code owner May 27, 2026 18:51
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 27, 2026

Greptile Summary

This PR reorganizes the Grafana integration's code-generation setup by relocating hand-written types and API spec files out of the auto-generated src/gen/ tree and into a dedicated grafana-api/ directory, updating all import paths and generate scripts accordingly.

  • Type relocation: GrafanaDashboard.ts (hand-written dashboard type definitions) moved from src/gen/types/ to grafana-api/; tsconfig.json updated to include grafana-api/*.ts.
  • Spec migration: OpenAPI spec JSON files moved from src/gen/specs/ to grafana-api/; package.json generate scripts updated to match. A README.md is added explaining how to re-fetch specs and why two clients exist.
  • Generated client restructure: The @hey-api/openapi-ts output was regenerated with a new client/ subdirectory layout; src/gen/.DS_Store is removed from version control.

Confidence Score: 4/5

Safe to merge with a small follow-up: the gitignore concern should be addressed before the next time someone regenerates the client from a changed spec.

The reorganization is mechanical and correct — imports, generate scripts, and tsconfig all point to their new locations consistently. The one thing that needs attention is that deleting the local .gitignore leaves src/gen/ masked by the root gen exclusion, so any new files produced by a future pnpm run generate run won't surface in git status and can't be staged without -f. There is also a garbled JSDoc sentence in the newly relocated type file.

integrations/grafana/.gitignore (deleted) — the absence of a re-include override for src/gen/** is the main thing worth revisiting before the next spec regeneration cycle.

Important Files Changed

Filename Overview
integrations/grafana/grafana-api/GrafanaDashboard.ts Hand-written Grafana dashboard types moved from src/gen/types/ to grafana-api/; contains a garbled JSDoc comment on line 2 ("AI with").
integrations/grafana/.gitignore Deleted the force-include overrides (!src/gen, !src/gen/**). Without them, the root gen gitignore pattern now masks src/gen/, so new untracked generated files won't be stageable without -f.
integrations/grafana/src/client.ts Single-line import path change: Panel type now imported from ../grafana-api/GrafanaDashboard instead of ./gen/types/GrafanaDashboard. No logic changes.
integrations/grafana/package.json Generate scripts updated to reference ./grafana-api/.json instead of ./src/gen/specs/.json, consistent with the spec file migration.
integrations/grafana/grafana-api/README.md New documentation file explaining how to fetch and update the two API specs (legacy and K8s) and why both clients exist.
integrations/grafana/tsconfig.json Added grafana-api/*.ts to the TypeScript include paths to compile the newly relocated hand-written types.
integrations/grafana/definitions/dashboard-schemas.ts Import path for TextPanel/TimeSeriesPanel updated to ../grafana-api/GrafanaDashboard; no logic changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph grafana-api ["grafana-api/ (source of truth)"]
        SPEC1[grafana-dashboard-k8s.json]
        SPEC2[grafana-folder-k8s.json]
        SPEC3[grafana-legacy.json]
        TYPES[GrafanaDashboard.ts]
        README[README.md]
    end

    subgraph gen ["src/gen/ (auto-generated)"]
        K8S[grafana-k8s-client/]
        LEGACY[grafana-legacy-client/]
    end

    SPEC1 -->|pnpm run generate:k8s| K8S
    SPEC2 -->|pnpm run generate:k8s| K8S
    SPEC3 -->|pnpm run generate:legacy| LEGACY

    K8S --> CLIENT[src/client.ts]
    LEGACY --> CLIENT
    TYPES --> CLIENT
    TYPES --> DEFS[definitions/dashboard-schemas.ts]
Loading

Comments Outside Diff (1)

  1. integrations/grafana/.gitignore

    P1 Missing gitignore override for src/gen

    The root .gitignore has a bare gen pattern that matches any directory named gen at any depth — including integrations/grafana/src/gen. The deleted file was the only thing overriding that exclusion (!src/gen / !src/gen/**). Existing tracked files in src/gen/ will still appear as modified in git status, but any new file produced by pnpm run generate (e.g. when the API spec gains a new schema) will be silently invisible to git and cannot be staged without git add -f. Consider adding a new integrations/grafana/.gitignore that re-includes the generated output, or moving the generated clients to a path not matched by the root gen rule.

Reviews (1): Last reviewed commit: "update" | Re-trigger Greptile

@franklevasseur franklevasseur merged commit c92f4b8 into master May 27, 2026
10 checks passed
@franklevasseur franklevasseur deleted the fl_grafana_geration_cleanup branch May 27, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants