Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/mcp/apps/init/mcp-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
let filteredProjects: Project[] = [];
let selectedProjectId: string | null = null;

function setStatus(message: string, type: "info" | "success" | "error" = "info") {

Check warning on line 31 in src/mcp/apps/init/mcp-app.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing return type on function
statusBox.className = `status ${type}`;
statusBox.textContent = message;
statusBox.style.display = "block";
}

function renderProjects() {

Check warning on line 37 in src/mcp/apps/init/mcp-app.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing return type on function
projectListContainer.innerHTML = "";

if (filteredProjects.length === 0) {
Expand Down Expand Up @@ -196,7 +196,7 @@
if (res.isError) {
setStatus(`Failed to initialize: ${JSON.stringify(res.content)}`, "error");
} else {
setStatus(`Successfully initialized ${selectedProduct}!`, "success");

Check warning on line 199 in src/mcp/apps/init/mcp-app.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Invalid type "string | undefined" of template literal expression
}
} catch (err: unknown) {
const message = err instanceof Error ? err.message : String(err);
Expand All @@ -222,7 +222,8 @@
}
};

(async () => {
// Initial connection and project load catch all errors and report status via setStatus
void (async () => {
Comment on lines +225 to +226

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This comment narrates self-evident code, which is discouraged by the repository style guide. Comments should focus on explaining why rather than what.

void (async () => {
References
  1. Write high-signal comments that explain why, not what. Do not narrate self-evident code. (link)

const envDirEl = document.getElementById("env-dir") as HTMLSpanElement;
try {
await app.connect();
Expand Down
3 changes: 2 additions & 1 deletion src/mcp/apps/update_environment/mcp-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
const envProjectIdEl = document.getElementById("env-project-id") as HTMLSpanElement;
const envUserEl = document.getElementById("env-user") as HTMLSpanElement;

function showStatus(message: string, type: "success" | "error" | "info") {

Check warning on line 28 in src/mcp/apps/update_environment/mcp-app.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing return type on function
statusBox.textContent = message;
statusBox.className = `status ${type}`;
statusBox.style.display = "block";
}

function renderProjects() {

Check warning on line 34 in src/mcp/apps/update_environment/mcp-app.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing return type on function
projectListContainer.innerHTML = "";

if (filteredProjects.length === 0) {
Expand Down Expand Up @@ -119,7 +119,8 @@
}
};

(async () => {
// Initial connection and project load catch all errors and report status via showStatus
void (async () => {
Comment on lines +122 to +123

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This comment narrates self-evident code, which is discouraged by the repository style guide. Comments should focus on explaining why rather than what.

void (async () => {
References
  1. Write high-signal comments that explain why, not what. Do not narrate self-evident code. (link)

try {
await app.connect();
showStatus("Connecting to server...", "info");
Expand Down
18 changes: 12 additions & 6 deletions src/mcp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
}

/** Wait until initialization has finished. */
ready() {

Check warning on line 166 in src/mcp/index.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing return type on function
if (this._ready) return Promise.resolve();
return new Promise((resolve, reject) => {
this._readyPromises.push({ resolve: resolve as () => void, reject });
Expand All @@ -174,16 +174,16 @@
return this.clientInfo?.name ?? (isFirebaseStudio() ? "Firebase Studio" : "<unknown-client>");
}

private get clientConfigKey() {

Check warning on line 177 in src/mcp/index.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing return type on function
return `mcp.clientConfigs.${this.clientName}:${this.startupRoot || process.cwd()}`;
}

getStoredClientConfig(): ClientConfig {
return configstore.get(this.clientConfigKey) || {};

Check warning on line 182 in src/mcp/index.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe return of an `any` typed value
}

updateStoredClientConfig(update: Partial<ClientConfig>) {

Check warning on line 185 in src/mcp/index.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing return type on function
const config = configstore.get(this.clientConfigKey) || {};

Check warning on line 186 in src/mcp/index.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe assignment of an `any` value
const newConfig = { ...config, ...update };
configstore.set(this.clientConfigKey, newConfig);
return newConfig;
Expand Down Expand Up @@ -647,13 +647,19 @@
while (this._pendingMessages.length) {
const message = this._pendingMessages.shift();
if (!message) continue;
this.server.sendLoggingMessage({
level: message.level,
data: message.data,
});
this.server
.sendLoggingMessage({
level: message.level,
data: message.data,
})
.catch(() => {
// Logging must never throw; the transport may already be closed.
});
}

void this.server.sendLoggingMessage({ level, data });
this.server.sendLoggingMessage({ level, data }).catch(() => {
// Logging must never throw; the transport may already be closed.
});
} else {
this._pendingMessages.push({ level, data });
}
Expand All @@ -664,6 +670,6 @@
logLevel,
(message: unknown) => logAtLevel(logLevel, message),
]),
) as Record<LoggingLevel, (message: unknown) => Promise<void>>;
) as Record<LoggingLevel, (message: unknown) => void>;
}
}
Loading