Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

1.1 KB
Raw Blame
/**
 * Meta endpoints: repowise version freshness + release changelog.
 * Powers the upgrade banner, what's-new view, and version footer.
 */

import type {
  ChangelogEntryModel,
  ChangelogHighlightModel,
  ChangelogResponse,
  ChangelogSectionModel,
  ReleaseStatsModel,
  VersionResponse,
} from "@repowise-dev/types/generated/http";
import { apiGet } from "./client";

export type MetaVersion = VersionResponse;
export type ChangelogSection = ChangelogSectionModel;
export type ChangelogHighlight = ChangelogHighlightModel;
export type ReleaseStats = ReleaseStatsModel;
/** `version` is `"unreleased"` for the next release's notes in a dev build. */
export type ChangelogEntry = ChangelogEntryModel;
export type ChangelogData = ChangelogResponse;

export async function getMetaVersion(repoId?: string): Promise<MetaVersion> {
  return apiGet<MetaVersion>(
    "/api/meta/version",
    repoId ? { repo_id: repoId } : undefined,
  );
}

export async function getChangelog(limit = 20): Promise<ChangelogData> {
  return apiGet<ChangelogData>("/api/meta/changelog", { limit });
}