Skip to content

Commit 62f4049

Browse files
committed
refactor: split core into cli, storage and vscode modules
`core/` mixed four concerns. Give each its own home: - `cli/`: CLI binary lifecycle and invocation (`cliManager`, `cliBinary`, `binaryLock`, `downloadProgress`, `cliExec`, `cliCredentialManager`) - `storage/`: persisted state (`secretsManager`, `mementoManager`, `pathResolver`) - `vscode/`: typed wrappers over VS Code registration APIs (`commandManager`, `contextManager`, and `proposed`, formerly `src/vscodeProposed.ts`) - `container.ts` moves next to `extension.ts` as the composition root, and `sessionId` joins the other OTel-format ids in `telemetry/ids`
1 parent 4095c2d commit 62f4049

66 files changed

Lines changed: 168 additions & 174 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.oxlintrc.jsonc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@
267267
}
268268
},
269269
{
270-
"files": ["src/core/contextManager.ts", "src/core/commandManager.ts"],
270+
"files": ["src/vscode/contextManager.ts", "src/vscode/commandManager.ts"],
271271
"rules": {
272272
"eslint-js/no-restricted-syntax": "off"
273273
}

‎src/announcements/manager.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import {
1616
import { AnnouncementsPreview } from "./preview";
1717

1818
import type { CoderApi } from "../api/coderApi";
19-
import type { MementoManager } from "../core/mementoManager";
2019
import type { SessionState } from "../deployment/sessionStore";
2120
import type { Logger } from "../logging/logger";
21+
import type { MementoManager } from "../storage/mementoManager";
2222

2323
/** Background poll interval; sign-in and manual refresh happen immediately either way. */
2424
export const REFRESH_INTERVAL_MS = 30 * 60 * 1000;

‎src/api/authInterceptor.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { HttpStatusCode } from "./httpStatusCode";
88

99
import type * as vscode from "vscode";
1010

11-
import type { ServiceContainer } from "../core/container";
12-
import type { SecretsManager } from "../core/secretsManager";
11+
import type { ServiceContainer } from "../container";
1312
import type { Logger } from "../logging/logger";
1413
import type { OAuthSessionManager } from "../oauth/sessionManager";
14+
import type { SecretsManager } from "../storage/secretsManager";
1515

1616
import type { CoderApi } from "./coderApi";
1717

‎src/api/coderApi.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
CONFIG_CHANGE_DEBOUNCE_MS,
1313
watchConfigurationChanges,
1414
} from "../configWatcher";
15-
import { sessionId } from "../core/sessionId";
1615
import { ClientCertificateError } from "../error/clientCertificateError";
1716
import { toError } from "../error/normalize";
1817
import { ServerCertificateError } from "../error/serverCertificateError";
@@ -33,6 +32,7 @@ import {
3332
import { AuthConfigTracker } from "../settings/authConfig";
3433
import { getHeaderCommand } from "../settings/headers";
3534
import { readHttpClientLogLevel } from "../settings/logger";
35+
import { sessionId } from "../telemetry/ids";
3636
import {
3737
NOOP_TELEMETRY_REPORTER,
3838
type TelemetryReporter,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as lockfile from "proper-lockfile";
33
import * as vscode from "vscode";
44

55
import { type Logger } from "../logging/logger";
6-
import { vscodeProposed } from "../vscodeProposed";
6+
import { vscodeProposed } from "../vscode/proposed";
77

88
import * as downloadProgress from "./downloadProgress";
99

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ import { version } from "./cliExec";
2525
import type { WorkspaceConfiguration } from "vscode";
2626

2727
import type { Logger } from "../logging/logger";
28+
import type { PathResolver } from "../storage/pathResolver";
2829
import type { Span } from "../telemetry/span";
2930

30-
import type { PathResolver } from "./pathResolver";
31-
3231
const execFileAsync = promisify(execFile);
3332

3433
const EXEC_TIMEOUT_MS = 60_000;
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
import { showStoreCredentialsError } from "../login/credentials";
2727
import * as pgp from "../pgp";
2828
import { withCancellableProgress, withOptionalProgress } from "../ui/progress";
29-
import { vscodeProposed } from "../vscodeProposed";
29+
import { vscodeProposed } from "../vscode/proposed";
3030

3131
import { BinaryLock } from "./binaryLock";
3232
import * as cliBinary from "./cliBinary";
@@ -37,11 +37,11 @@ import type { Api } from "coder/site/src/api/api";
3737
import type { IncomingMessage } from "node:http";
3838

3939
import type { Logger } from "../logging/logger";
40+
import type { PathResolver } from "../storage/pathResolver";
4041
import type { TelemetryService } from "../telemetry/service";
4142
import type { Span } from "../telemetry/span";
4243

4344
import type { CliCredentialManager } from "./cliCredentialManager";
44-
import type { PathResolver } from "./pathResolver";
4545

4646
type ResolvedBinary =
4747
| { binPath: string; stat: Stats; source: "file_path" | "directory" }

0 commit comments

Comments
 (0)