Skip to content

Commit f15b7a2

Browse files
committed
refactor: convert exported functions to internal functions for improved encapsulation
1 parent 08c0409 commit f15b7a2

14 files changed

Lines changed: 30 additions & 125 deletions

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"@types/debug": "^4.1.12",
4444
"@types/filesystem": "^0.0.36",
4545
"@types/node": "^25.0.0",
46-
"@types/sinon": "^21.0.0",
4746
"@types/ws": "^8.18.1",
4847
"@types/yargs": "^17.0.33",
4948
"@typescript-eslint/eslint-plugin": "^8.43.0",
@@ -59,7 +58,6 @@
5958
"rollup": "4.57.1",
6059
"rollup-plugin-cleanup": "^3.2.1",
6160
"rollup-plugin-license": "^3.6.0",
62-
"sinon": "^21.0.0",
6361
"typescript": "^5.9.2",
6462
"typescript-eslint": "^8.43.0",
6563
"yargs": "18.0.0",
@@ -70,7 +68,6 @@
7068
},
7169
"dependencies": {
7270
"@modelcontextprotocol/sdk": "1.27.0",
73-
"get-port": "^7.1.0",
7471
"jsonc-parser": "^3.3.0",
7572
"logpare": "^0.1.0",
7673
"ws": "^8.19.0"

pnpm-lock.yaml

Lines changed: 0 additions & 92 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ax-tree.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ export async function fetchAXTree(verbose: boolean): Promise<AXTreeResult> {
526526
/**
527527
* Get the frame ID for a given UID (for cross-frame interactions).
528528
*/
529-
export function getFrameIdForUid(uid: string): string | undefined {
529+
function getFrameIdForUid(uid: string): string | undefined {
530530
return uidToFrameId.get(uid);
531531
}
532532

@@ -587,7 +587,7 @@ export function getBackendNodeId(uid: string): number {
587587
/**
588588
* Resolve a UID to a CDP RemoteObjectId by calling DOM.resolveNode.
589589
*/
590-
export async function resolveNodeToRemoteObject(uid: string): Promise<string> {
590+
async function resolveNodeToRemoteObject(uid: string): Promise<string> {
591591
const backendNodeId = getBackendNodeId(uid);
592592
const sessionId = getSessionIdForUid(uid);
593593
const opts = sessionId ? {sessionId} : undefined;

src/client-pipe.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function sendClientRequest(
208208
/**
209209
* Execute a VS Code command in the Client window.
210210
*/
211-
export async function commandExecute(
211+
async function commandExecute(
212212
command: string,
213213
args?: unknown[],
214214
): Promise<CommandExecuteResult> {
@@ -408,7 +408,7 @@ export async function codebaseGetOverview(
408408
/**
409409
* Get detailed exports from a module/file/directory.
410410
*/
411-
export async function codebaseGetExports(
411+
async function codebaseGetExports(
412412
path: string,
413413
rootDir?: string,
414414
includeTypes?: boolean,
@@ -736,7 +736,7 @@ export interface UnifiedFileSymbol {
736736
modifiers?: string[];
737737
}
738738

739-
export interface UnifiedFileResult {
739+
interface UnifiedFileResult {
740740
symbols: UnifiedFileSymbol[];
741741
content: string;
742742
totalLines: number;
@@ -1000,7 +1000,7 @@ export async function fileApplyCodeAction(
10001000
* Extract orphaned content (imports, exports, comments) from TypeScript/JavaScript files.
10011001
* Supplements VS Code's DocumentSymbol API which doesn't include these constructs.
10021002
*/
1003-
export async function fileExtractOrphanedContent(
1003+
async function fileExtractOrphanedContent(
10041004
filePath: string,
10051005
includeSymbols = true,
10061006
): Promise<OrphanedContentResult> {
@@ -1133,7 +1133,7 @@ export async function ensureClientAvailable(): Promise<void> {
11331133
/**
11341134
* Returns the fixed Client pipe path for this platform.
11351135
*/
1136-
export function getClientPipePath(): string {
1136+
function getClientPipePath(): string {
11371137
return CLIENT_PIPE_PATH;
11381138
}
11391139

src/extension-watcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ export function writeExtSourceFingerprint(extensionDir: string): void {
286286
* @param sessionStartedAtMs Debug session start timestamp in epoch ms
287287
* @deprecated Use isBuildStale instead for proper source vs build comparison
288288
*/
289-
export function hasExtensionChangedSince(
289+
function hasExtensionChangedSince(
290290
extensionDir: string,
291291
sessionStartedAtMs: number,
292292
): boolean {

src/host-pipe.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export async function hotReloadRequired(params: McpReadyParams): Promise<HotRelo
200200
/**
201201
* Query the current state of the Host and Client.
202202
*/
203-
export async function getStatus(): Promise<HostStatus> {
203+
async function getStatus(): Promise<HostStatus> {
204204
const result = await sendHostRequest('getStatus', {});
205205
return result as HostStatus;
206206
}
@@ -218,7 +218,7 @@ export async function teardown(): Promise<TeardownResult> {
218218
* Request a session takeover from the existing Host.
219219
* Used when a new MCP instance wants to control the session.
220220
*/
221-
export async function requestTakeover(): Promise<TakeoverResult> {
221+
async function requestTakeover(): Promise<TakeoverResult> {
222222
const result = await sendHostRequest('takeover', {});
223223
return result as TakeoverResult;
224224
}
@@ -254,7 +254,7 @@ export async function showHostNotification(message: string): Promise<void> {
254254
/**
255255
* Check if the Host pipe is reachable via a system.ping.
256256
*/
257-
export async function pingHost(): Promise<boolean> {
257+
async function pingHost(): Promise<boolean> {
258258
try {
259259
await sendHostRequest('system.ping', {}, 3_000);
260260
return true;
@@ -266,6 +266,6 @@ export async function pingHost(): Promise<boolean> {
266266
/**
267267
* Returns the fixed Host pipe path for this platform.
268268
*/
269-
export function getHostPipePath(): string {
269+
function getHostPipePath(): string {
270270
return HOST_PIPE_PATH;
271271
}

src/issue-descriptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function getIssueDescription(fileName: string): string | null {
4848
return issueDescriptions[fileName] ?? null;
4949
}
5050

51-
export const ISSUE_UTILS = {
51+
const ISSUE_UTILS = {
5252
loadIssueDescriptions,
5353
getIssueDescription,
5454
};

src/log-consolidator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function buildLogpareOptions(format: LogFormat): CompressOptions {
7474
* Consolidate a raw text string (e.g., terminal or task output).
7575
* Returns LogPare's compressed format when meaningful compression is achievable.
7676
*/
77-
export function consolidateOutput(
77+
function consolidateOutput(
7878
text: string,
7979
options?: ConsolidationOptions,
8080
): ConsolidationResult {
@@ -157,7 +157,7 @@ function noCompression(text: string, lineCount: number): ConsolidationResult {
157157
/**
158158
* Convert a ConsolidationResult to a JSON-safe object for API responses.
159159
*/
160-
export function toConsolidatedJson(
160+
function toConsolidatedJson(
161161
result: ConsolidationResult,
162162
): Record<string, unknown> {
163163
return {

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ const cliArgs = parseArguments(VERSION);
273273
export const config: ResolvedConfig = loadConfig(cliArgs);
274274

275275
// Legacy export for backwards compatibility
276-
export const args = cliArgs;
276+
const args = cliArgs;
277277

278278
// ── MCP Server Hot-Reload Marker (detect post-restart) ───
279279
// Check this BEFORE initializing lifecycle service so we can pass the flag

0 commit comments

Comments
 (0)