refactor(cli): remove unused imports and variables

Eliminates no-unused-vars warnings across the CLI package by dropping
dead type imports, unused destructured helpers, and simplifying try/catch
blocks whose caught errors and intermediate results were never read.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-23 17:26:59 -07:00
parent e490a8f35a
commit a1d66878fa
12 changed files with 18 additions and 28 deletions

View File

@@ -10,12 +10,10 @@
import { existsSync, mkdirSync, writeFileSync, readFileSync } from "node:fs"; import { existsSync, mkdirSync, writeFileSync, readFileSync } from "node:fs";
import { join, resolve, basename } from "node:path"; import { join, resolve, basename } from "node:path";
import { homedir } from "node:os";
import { exec } from "node:child_process"; import { exec } from "node:child_process";
import { promisify } from "node:util"; import { promisify } from "node:util";
const execAsync = promisify(exec); const execAsync = promisify(exec);
import { CentralCore, QMD_INSTALL_COMMAND, isQmdAvailable } from "@fusion/core"; import { CentralCore, QMD_INSTALL_COMMAND, isQmdAvailable } from "@fusion/core";
import { resolveGlobalDir } from "@fusion/core";
import { maybeInstallClaudeSkillForNewProject } from "./claude-skills-runner.js"; import { maybeInstallClaudeSkillForNewProject } from "./claude-skills-runner.js";
/** Options for the init command */ /** Options for the init command */

View File

@@ -1,4 +1,4 @@
import { type MissionStatus, type MilestoneStatus, type SliceStatus, type FeatureStatus } from "@fusion/core"; import { type MilestoneStatus, type SliceStatus, type FeatureStatus } from "@fusion/core";
import { createInterface } from "node:readline/promises"; import { createInterface } from "node:readline/promises";
import { getStore } from "../project-resolver.js"; import { getStore } from "../project-resolver.js";

View File

@@ -1,4 +1,4 @@
import { CentralCore, type NodeConfig, type SystemMetrics } from "@fusion/core"; import { CentralCore, type NodeConfig } from "@fusion/core";
import { createInterface } from "node:readline/promises"; import { createInterface } from "node:readline/promises";
// ── Options Interfaces ─────────────────────────────────────────────────────── // ── Options Interfaces ───────────────────────────────────────────────────────

View File

@@ -25,7 +25,6 @@ function toTitleCase(str: string): string {
* Generate package.json template * Generate package.json template
*/ */
function generatePackageJson(name: string): string { function generatePackageJson(name: string): string {
const titleCase = toTitleCase(name);
return JSON.stringify( return JSON.stringify(
{ {
name: `@fusion-plugin-examples/${name}`, name: `@fusion-plugin-examples/${name}`,

View File

@@ -25,7 +25,7 @@ import {
import { resolve, isAbsolute, relative, basename } from "node:path"; import { resolve, isAbsolute, relative, basename } from "node:path";
import { existsSync, statSync } from "node:fs"; import { existsSync, statSync } from "node:fs";
import { createInterface } from "node:readline/promises"; import { createInterface } from "node:readline/promises";
import { formatProjectLine, detectProjectFromCwd, setDefaultProject, resolveProject as resolveProjectContext } from "../project-context.js"; import { detectProjectFromCwd, setDefaultProject } from "../project-context.js";
import { maybeInstallClaudeSkillForNewProject } from "./claude-skills-runner.js"; import { maybeInstallClaudeSkillForNewProject } from "./claude-skills-runner.js";
const VALID_ISOLATION_MODES: IsolationMode[] = ["in-process", "child-process"]; const VALID_ISOLATION_MODES: IsolationMode[] = ["in-process", "child-process"];

View File

@@ -38,7 +38,7 @@ import {
processPullRequestMergeTask, processPullRequestMergeTask,
} from "./task-lifecycle.js"; } from "./task-lifecycle.js";
import { promptForPort } from "./port-prompt.js"; import { promptForPort } from "./port-prompt.js";
import { createReadOnlyProviderSettingsView, createProjectSettingsPersistence } from "./provider-settings.js"; import { createReadOnlyProviderSettingsView } from "./provider-settings.js";
import { createReadOnlyAuthFileStorage, mergeAuthStorageReads, wrapAuthStorageWithApiKeyProviders } from "./provider-auth.js"; import { createReadOnlyAuthFileStorage, mergeAuthStorageReads, wrapAuthStorageWithApiKeyProviders } from "./provider-auth.js";
import { getFusionAuthPath, getLegacyAuthPaths, getModelRegistryModelsPath, getPackageManagerAgentDir } from "./auth-paths.js"; import { getFusionAuthPath, getLegacyAuthPaths, getModelRegistryModelsPath, getPackageManagerAgentDir } from "./auth-paths.js";
import { resolveProject } from "../project-context.js"; import { resolveProject } from "../project-context.js";

View File

@@ -6,7 +6,7 @@
* - fn skills install <owner/repo> - Install skills from a source * - fn skills install <owner/repo> - Install skills from a source
*/ */
import { spawn, type ChildProcess } from "node:child_process"; import { spawn } from "node:child_process";
/** /**
* Skill entry from the skills.sh /api/search endpoint. * Skill entry from the skills.sh /api/search endpoint.

View File

@@ -1,4 +1,4 @@
import { TaskStore, COLUMNS, COLUMN_LABELS, type Column, type MergeResult, type StepStatus, type AgentLogType, type AgentLogEntry, type Task } from "@fusion/core"; import { TaskStore, COLUMNS, COLUMN_LABELS, type Column, type StepStatus, type AgentLogType, type AgentLogEntry } from "@fusion/core";
import { aiMergeTask } from "@fusion/engine"; import { aiMergeTask } from "@fusion/engine";
import { createInterface } from "node:readline/promises"; import { createInterface } from "node:readline/promises";
import type { PlanningQuestion, PlanningSummary } from "@fusion/core"; import type { PlanningQuestion, PlanningSummary } from "@fusion/core";
@@ -60,7 +60,7 @@ async function getCommandContext(projectName?: string): Promise<CommandContext>
projectName: context.projectName, projectName: context.projectName,
explicit: false, explicit: false,
}; };
} catch (error) { } catch {
const store = new TaskStore(process.cwd()); const store = new TaskStore(process.cwd());
await store.init(); await store.init();
return { return {
@@ -331,7 +331,6 @@ export async function runTaskLogs(id: string, options: LogsOptions = {}, project
// Follow mode: watch for new entries // Follow mode: watch for new entries
if (options.follow) { if (options.follow) {
const followStore = store;
const projectPath = projectContext?.projectPath ?? process.cwd(); const projectPath = projectContext?.projectPath ?? process.cwd();
const logPath = join(projectPath, ".fusion", "tasks", id, "agent.log"); const logPath = join(projectPath, ".fusion", "tasks", id, "agent.log");
@@ -666,10 +665,9 @@ export async function runTaskDelete(id: string, force?: boolean, projectName?: s
const store = await getStore(projectName); const store = await getStore(projectName);
// Check if task exists first // Check if task exists first
let task;
try { try {
task = await store.getTask(id); await store.getTask(id);
} catch (err: any) { } catch {
console.error(`✗ Task ${id} not found`); console.error(`✗ Task ${id} not found`);
process.exit(1); process.exit(1);
return; return;

View File

@@ -1,11 +1,10 @@
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent"; import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
import { Type, type Static } from "typebox"; import { Type } from "typebox";
import { StringEnum } from "@mariozechner/pi-ai"; import { StringEnum } from "@mariozechner/pi-ai";
import { import {
TaskStore, TaskStore,
COLUMNS, COLUMNS,
COLUMN_LABELS, COLUMN_LABELS,
type Column,
type Task, type Task,
} from "@fusion/core"; } from "@fusion/core";
import { import {
@@ -235,9 +234,8 @@ export default function kbExtension(pi: ExtensionAPI) {
const store = await getStore(ctx.cwd); const store = await getStore(ctx.cwd);
// Validate task exists // Validate task exists
let task;
try { try {
task = await store.getTask(params.id); await store.getTask(params.id);
} catch { } catch {
return { return {
content: [{ type: "text", text: `Task ${params.id} not found` }], content: [{ type: "text", text: `Task ${params.id} not found` }],
@@ -1018,7 +1016,7 @@ export default function kbExtension(pi: ExtensionAPI) {
), ),
}), }),
async execute(_toolCallId, params, _signal, _onUpdate, ctx) { async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
// Import the planning function dynamically to avoid circular dependencies // Import the planning function dynamically to avoid circular dependencies
const { runTaskPlan } = await import("./commands/task.js"); const { runTaskPlan } = await import("./commands/task.js");
@@ -1685,7 +1683,7 @@ export default function kbExtension(pi: ExtensionAPI) {
), ),
}), }),
async execute(_toolCallId, params, _signal, _onUpdate, ctx) { async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
// Dynamic import to match existing extension patterns // Dynamic import to match existing extension patterns
const { searchSkills, formatInstalls } = await import("./commands/skills.js"); const { searchSkills, formatInstalls } = await import("./commands/skills.js");
@@ -1781,12 +1779,9 @@ export default function kbExtension(pi: ExtensionAPI) {
stdio: "pipe", stdio: "pipe",
}); });
let stdout = "";
let stderr = ""; let stderr = "";
child.stdout?.on("data", (data) => { child.stdout?.on("data", () => {});
stdout += data.toString();
});
child.stderr?.on("data", (data) => { child.stderr?.on("data", (data) => {
stderr += data.toString(); stderr += data.toString();

View File

@@ -6,7 +6,7 @@
*/ */
import { TaskStore, type RegisteredProject, CentralCore, GlobalSettingsStore } from "@fusion/core"; import { TaskStore, type RegisteredProject, CentralCore, GlobalSettingsStore } from "@fusion/core";
import { isAbsolute, resolve, dirname } from "node:path"; import { resolve, dirname } from "node:path";
import { existsSync } from "node:fs"; import { existsSync } from "node:fs";
/** Project context for CLI operations */ /** Project context for CLI operations */

View File

@@ -868,7 +868,7 @@ export async function getProjectSummaryInfo(
lastActivity: string | undefined; lastActivity: string | undefined;
runtimeStatus: import("@fusion/engine").RuntimeStatus | "not_started"; runtimeStatus: import("@fusion/engine").RuntimeStatus | "not_started";
}> { }> {
const central = await getCentralCore(); await getCentralCore();
const pm = await getProjectManager(); const pm = await getProjectManager();
const [taskCounts, lastActivity, runtime] = await Promise.all([ const [taskCounts, lastActivity, runtime] = await Promise.all([

View File

@@ -144,7 +144,7 @@ export function setupNativeResolution(): { success: boolean; nativeDir: string |
symlinkSync(fnDir, bunfsRoot); symlinkSync(fnDir, bunfsRoot);
bunfsSymlinkPath = bunfsRoot; bunfsSymlinkPath = bunfsRoot;
console.log("[fn-native-patch] Created /$bunfs/root symlink for native module resolution"); console.log("[fn-native-patch] Created /$bunfs/root symlink for native module resolution");
} catch (symlinkErr) { } catch {
// Symlink creation failed (likely permission denied) - not fatal // Symlink creation failed (likely permission denied) - not fatal
// The terminal service will try alternative loading methods // The terminal service will try alternative loading methods
console.log("[fn-native-patch] Could not create /$bunfs/root symlink (permissions), using fallback"); console.log("[fn-native-patch] Could not create /$bunfs/root symlink (permissions), using fallback");