Skip to content

feat(context): enrich context getter to provide project details - #2033

Open
gandie wants to merge 8 commits into
masterfrom
feat/enrich-context-with-project-details
Open

feat(context): enrich context getter to provide project details#2033
gandie wants to merge 8 commits into
masterfrom
feat/enrich-context-with-project-details

Conversation

@gandie

@gandie gandie commented Jul 23, 2026

Copy link
Copy Markdown
Member

Resolves #929

@martin-helmich martin-helmich changed the title Enrich context getter to provide project details feat(context): enrich context getter to provide project details Jul 23, 2026
Comment thread src/commands/context/get.tsx Outdated
Comment thread src/commands/context/get.tsx Outdated
Comment thread src/commands/context/get.tsx Outdated
Comment thread src/commands/context/get.tsx Outdated
Comment thread src/commands/context/get.tsx Outdated
@gandie
gandie requested a review from martin-helmich July 27, 2026 08:00
Comment thread src/lib/context/projectOverview.ts Outdated
Comment thread src/commands/context/get.tsx Outdated
Comment thread src/commands/context/get.tsx Outdated
);
};

const ProjectOverviewSection: FC<{ overview: ProjectOverview }> = ({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component is very long. Consider splitting it into separate subcomponents.

Comment thread src/lib/context/projectOverview.ts Outdated
Comment on lines +123 to +177
const projectResponse = await apiClient.project.getProject({
projectId,
});
assertStatus(projectResponse, 200);

const appInstallationsResponse = await apiClient.app.listAppinstallations({
projectId,
});
assertStatus(appInstallationsResponse, 200);

const appInstallations = appInstallationsResponse.data;
const uniqueAppIds = Array.from(
new Set(appInstallations.map((installation) => installation.appId)),
);

const appNames = new Map<string, string>();
await Promise.all(
uniqueAppIds.map(async (appId) => {
try {
const app = await getAppFromUuid(apiClient, appId);
appNames.set(appId, app.name);
} catch {
appNames.set(appId, appId);
}
}),
);

const databaseById = new Map<
string,
{ name: string; kind: "mysql" | "redis" }
>();

try {
const mysqlResponse = await apiClient.database.listMysqlDatabases({
projectId,
});
assertStatus(mysqlResponse, 200);
for (const db of mysqlResponse.data) {
databaseById.set(db.id, { name: db.name, kind: "mysql" });
}
} catch {
// best effort
}

try {
const redisResponse = await apiClient.database.listRedisDatabases({
projectId,
});
assertStatus(redisResponse, 200);
for (const db of redisResponse.data) {
databaseById.set(db.id, { name: db.name, kind: "redis" });
}
} catch {
// best effort
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function contains many chained await calls, some of which might be run concurrently using Promise.all.

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.

mw context show would be very useful

2 participants