Run Biome formatter and add formatting guidance to CLAUDE.md

This commit is contained in:
Mohamed Boudra
2026-04-12 10:40:14 +07:00
parent 40e27f5a00
commit 56512d852b
7 changed files with 60 additions and 55 deletions
@@ -47,11 +47,11 @@ function createWorkspaceRuntimeSnapshot(
...overrides?.github,
pullRequest:
overrides?.github && "pullRequest" in overrides.github
? overrides.github.pullRequest ?? null
? (overrides.github.pullRequest ?? null)
: base.github.pullRequest,
error:
overrides?.github && "error" in overrides.github
? overrides.github.error ?? null
? (overrides.github.error ?? null)
: base.github.error,
},
};
@@ -309,7 +309,9 @@ describe("workspace git watch targets", () => {
});
expect(workspaceGitService.getSnapshot).toHaveBeenCalledWith("/tmp/repo");
expect(emitted.find((message) => message.type === "checkout_pr_status_response")?.payload).toEqual({
expect(
emitted.find((message) => message.type === "checkout_pr_status_response")?.payload,
).toEqual({
cwd: "/tmp/repo",
status: {
url: "https://github.com/acme/repo/pull/456",
@@ -366,7 +368,9 @@ describe("workspace git watch targets", () => {
expect(workspaceGitService.refresh).toHaveBeenCalledWith("/tmp/repo", {
priority: "high",
});
expect(emitted.find((message) => message.type === "checkout_pr_status_response")?.payload).toEqual({
expect(
emitted.find((message) => message.type === "checkout_pr_status_response")?.payload,
).toEqual({
cwd: "/tmp/repo",
status: {
url: "https://github.com/acme/repo/pull/457",
@@ -165,20 +165,22 @@ function createWorkspaceRuntimeSnapshot(
...overrides?.github,
pullRequest:
overrides?.github && "pullRequest" in overrides.github
? overrides.github.pullRequest ?? null
? (overrides.github.pullRequest ?? null)
: base.github.pullRequest,
error:
overrides?.github && "error" in overrides.github
? overrides.github.error ?? null
? (overrides.github.error ?? null)
: base.github.error,
},
};
}
function createSessionForWorkspaceTests(options: {
appVersion?: string | null;
workspaceGitService?: ReturnType<typeof createNoopWorkspaceGitService>;
} = {}): Session {
function createSessionForWorkspaceTests(
options: {
appVersion?: string | null;
workspaceGitService?: ReturnType<typeof createNoopWorkspaceGitService>;
} = {},
): Session {
const logger = {
child: () => logger,
trace: vi.fn(),
@@ -238,8 +240,8 @@ function createSessionForWorkspaceTests(options: {
checkoutDiffWatcherCount: 0,
checkoutDiffFallbackRefreshTargetCount: 0,
}),
dispose: () => {},
} as any,
dispose: () => {},
} as any,
workspaceGitService: (options.workspaceGitService ?? createNoopWorkspaceGitService()) as any,
mcpBaseUrl: null,
stt: null,
@@ -1,8 +1,5 @@
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import type {
CheckoutStatusGit,
PullRequestStatusResult,
} from "../utils/checkout-git.js";
import type { CheckoutStatusGit, PullRequestStatusResult } from "../utils/checkout-git.js";
import {
WorkspaceGitServiceImpl,
type WorkspaceGitRuntimeSnapshot,
@@ -65,11 +62,11 @@ function createSnapshot(
...overrides?.github,
pullRequest:
overrides?.github && "pullRequest" in overrides.github
? overrides.github.pullRequest ?? null
? (overrides.github.pullRequest ?? null)
: base.github.pullRequest,
error:
overrides?.github && "error" in overrides.github
? overrides.github.error ?? null
? (overrides.github.error ?? null)
: base.github.error,
},
};
@@ -139,7 +136,7 @@ function createService(options?: {
logger: createLogger() as any,
paseoHome: "/tmp/paseo-test",
deps: {
watch: options?.watch ?? (((() => createWatcher()) as unknown) as any),
watch: options?.watch ?? ((() => createWatcher()) as unknown as any),
getCheckoutStatus:
options?.getCheckoutStatus ?? vi.fn(async (cwd: string) => createCheckoutStatus(cwd)),
getCheckoutShortstat:
@@ -149,8 +146,7 @@ function createService(options?: {
deletions: 0,
})),
getPullRequestStatus:
options?.getPullRequestStatus ??
vi.fn(async () => createPullRequestStatusResult()),
options?.getPullRequestStatus ?? vi.fn(async () => createPullRequestStatusResult()),
resolveGhPath: options?.resolveGhPath ?? vi.fn(async () => "/usr/bin/gh"),
resolveAbsoluteGitDir: options?.resolveAbsoluteGitDir ?? vi.fn(async () => "/tmp/repo/.git"),
hasOriginRemote: options?.hasOriginRemote ?? vi.fn(async () => false),
@@ -325,10 +321,7 @@ describe("WorkspaceGitServiceImpl", () => {
}),
);
const nowValues = [
new Date("2026-04-12T00:00:00.000Z"),
new Date("2026-04-12T00:05:00.000Z"),
];
const nowValues = [new Date("2026-04-12T00:00:00.000Z"), new Date("2026-04-12T00:05:00.000Z")];
const service = createService({
getPullRequestStatus,
now: () => nowValues.shift() ?? new Date("2026-04-12T00:05:00.000Z"),
@@ -383,20 +376,18 @@ describe("WorkspaceGitServiceImpl", () => {
aheadOfOrigin: 2,
}),
);
const getPullRequestStatus = vi
.fn<() => Promise<PullRequestStatusResult>>()
.mockResolvedValue(
createPullRequestStatusResult({
status: {
url: "https://github.com/acme/repo/pull/123",
title: "Runtime payloads",
state: "open",
baseRefName: "main",
headRefName: "feature/runtime-payloads",
isMerged: false,
},
}),
);
const getPullRequestStatus = vi.fn<() => Promise<PullRequestStatusResult>>().mockResolvedValue(
createPullRequestStatusResult({
status: {
url: "https://github.com/acme/repo/pull/123",
title: "Runtime payloads",
state: "open",
baseRefName: "main",
headRefName: "feature/runtime-payloads",
isMerged: false,
},
}),
);
const service = createService({
getCheckoutStatus,
@@ -258,7 +258,10 @@ export class WorkspaceGitServiceImpl implements WorkspaceGitService {
this.scheduleWorkspaceRefresh(target);
});
} catch (error) {
this.logger.warn({ err: error, cwd: target.cwd, watchPath }, "Failed to start workspace git watcher");
this.logger.warn(
{ err: error, cwd: target.cwd, watchPath },
"Failed to start workspace git watcher",
);
}
if (!watcher) {
@@ -332,7 +335,10 @@ export class WorkspaceGitServiceImpl implements WorkspaceGitService {
const snapshot = await this.refreshSnapshot(target.cwd);
this.rememberSnapshot(target, snapshot, { notify: true });
} catch (error) {
this.logger.warn({ err: error, cwd: target.cwd }, "Failed to refresh workspace git snapshot");
this.logger.warn(
{ err: error, cwd: target.cwd },
"Failed to refresh workspace git snapshot",
);
}
} while (target.refreshQueued);
})();
@@ -378,7 +384,10 @@ export class WorkspaceGitServiceImpl implements WorkspaceGitService {
}
target.fetchInFlight = true;
this.logger.debug({ repoGitRoot: target.repoGitRoot, cwd: target.cwd }, "Running background git fetch");
this.logger.debug(
{ repoGitRoot: target.repoGitRoot, cwd: target.cwd },
"Running background git fetch",
);
try {
await this.deps.runGitFetch(target.cwd);