refactor(core): remove unused imports, helpers, and dead migration constant
Drops orphaned imports and the never-referenced V4 migration SQL constant (V4 was inlined into runMigrations). Also drops the unused TypedEventEmitter helper type and unused destructured values from stores. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,15 +62,6 @@ export interface AgentStoreEvents {
|
|||||||
"rating:added": (rating: AgentRating) => void;
|
"rating:added": (rating: AgentRating) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
type TypedEventEmitter<Events extends Record<string, unknown[]>> = {
|
|
||||||
[K in keyof Events]: {
|
|
||||||
emit(event: K, ...args: Events[K]): boolean;
|
|
||||||
on(event: K, listener: (...args: Events[K]) => void): TypedEventEmitter<Events>;
|
|
||||||
once(event: K, listener: (...args: Events[K]) => void): TypedEventEmitter<Events>;
|
|
||||||
off(event: K, listener: (...args: Events[K]) => void): TypedEventEmitter<Events>;
|
|
||||||
};
|
|
||||||
}[keyof Events] & EventEmitter;
|
|
||||||
|
|
||||||
/** Options for AgentStore constructor */
|
/** Options for AgentStore constructor */
|
||||||
export interface AgentStoreOptions {
|
export interface AgentStoreOptions {
|
||||||
/** Root directory for kb data (default: .fusion) */
|
/** Root directory for kb data (default: .fusion) */
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import type {
|
|||||||
} from "./automation.js";
|
} from "./automation.js";
|
||||||
import { AUTOMATION_PRESETS, MAX_RUN_HISTORY } from "./automation.js";
|
import { AUTOMATION_PRESETS, MAX_RUN_HISTORY } from "./automation.js";
|
||||||
import type { ScheduleType } from "./automation.js";
|
import type { ScheduleType } from "./automation.js";
|
||||||
import { Database, toJsonNullable, fromJson } from "./db.js";
|
import { Database, fromJson } from "./db.js";
|
||||||
|
|
||||||
export interface AutomationStoreEvents {
|
export interface AutomationStoreEvents {
|
||||||
"schedule:created": [schedule: ScheduledTask];
|
"schedule:created": [schedule: ScheduledTask];
|
||||||
|
|||||||
@@ -184,10 +184,7 @@ const CENTRAL_SCHEMA_V3_CREATE_PEERS_SQL = CENTRAL_SCHEMA_V3_MIGRATION_SQL
|
|||||||
.filter((line) => !line.trim().startsWith("ALTER TABLE nodes ADD COLUMN"))
|
.filter((line) => !line.trim().startsWith("ALTER TABLE nodes ADD COLUMN"))
|
||||||
.join("\n");
|
.join("\n");
|
||||||
|
|
||||||
const CENTRAL_SCHEMA_V4_MIGRATION_SQL = `
|
// V4 migration is applied inline via ALTER TABLE checks (see runMigrations).
|
||||||
ALTER TABLE nodes ADD COLUMN versionInfo TEXT;
|
|
||||||
ALTER TABLE nodes ADD COLUMN pluginVersions TEXT;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const CENTRAL_SCHEMA_V5_MIGRATION_SQL = `
|
const CENTRAL_SCHEMA_V5_MIGRATION_SQL = `
|
||||||
CREATE TABLE IF NOT EXISTS settingsSyncState (
|
CREATE TABLE IF NOT EXISTS settingsSyncState (
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import type {
|
|||||||
SetupCompletionResult,
|
SetupCompletionResult,
|
||||||
DetectedProject,
|
DetectedProject,
|
||||||
RegisteredProject,
|
RegisteredProject,
|
||||||
GlobalSettings,
|
|
||||||
} from "./types.js";
|
} from "./types.js";
|
||||||
import type { CentralCore } from "./central-core.js";
|
import type { CentralCore } from "./central-core.js";
|
||||||
import { MigrationOrchestrator } from "./migration-orchestrator.js";
|
import { MigrationOrchestrator } from "./migration-orchestrator.js";
|
||||||
|
|||||||
@@ -28,8 +28,7 @@
|
|||||||
|
|
||||||
import { EventEmitter } from "node:events";
|
import { EventEmitter } from "node:events";
|
||||||
import type { Database } from "./db.js";
|
import type { Database } from "./db.js";
|
||||||
import { toJson, toJsonNullable, fromJson } from "./db.js";
|
import { toJsonNullable, fromJson } from "./db.js";
|
||||||
import { randomUUID } from "node:crypto";
|
|
||||||
import type {
|
import type {
|
||||||
Insight,
|
Insight,
|
||||||
InsightCreateInput,
|
InsightCreateInput,
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import type {
|
|||||||
MigrationOptions,
|
MigrationOptions,
|
||||||
MigrationResult,
|
MigrationResult,
|
||||||
RegisteredProject,
|
RegisteredProject,
|
||||||
IsolationMode,
|
|
||||||
} from "./types.js";
|
} from "./types.js";
|
||||||
import type { CentralCore } from "./central-core.js";
|
import type { CentralCore } from "./central-core.js";
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
* - Error isolation (plugin crashes don't crash the loader)
|
* - Error isolation (plugin crashes don't crash the loader)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { join, isAbsolute, resolve } from "node:path";
|
import { isAbsolute, resolve } from "node:path";
|
||||||
import { EventEmitter } from "node:events";
|
import { EventEmitter } from "node:events";
|
||||||
import type { TaskStore } from "./store.js";
|
import type { TaskStore } from "./store.js";
|
||||||
import { PluginStore } from "./plugin-store.js";
|
import { PluginStore } from "./plugin-store.js";
|
||||||
@@ -21,7 +21,6 @@ import type {
|
|||||||
PluginRouteDefinition,
|
PluginRouteDefinition,
|
||||||
PluginUiSlotDefinition,
|
PluginUiSlotDefinition,
|
||||||
PluginRuntimeRegistration,
|
PluginRuntimeRegistration,
|
||||||
PluginState,
|
|
||||||
PluginInstallation,
|
PluginInstallation,
|
||||||
} from "./plugin-types.js";
|
} from "./plugin-types.js";
|
||||||
import { validatePluginManifest } from "./plugin-types.js";
|
import { validatePluginManifest } from "./plugin-types.js";
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ export class PluginStore extends EventEmitter<PluginStoreEvents> {
|
|||||||
id: string,
|
id: string,
|
||||||
updates: PluginUpdateInput,
|
updates: PluginUpdateInput,
|
||||||
): Promise<PluginInstallation> {
|
): Promise<PluginInstallation> {
|
||||||
const plugin = await this.getPlugin(id);
|
await this.getPlugin(id);
|
||||||
const now = new Date().toISOString();
|
const now = new Date().toISOString();
|
||||||
|
|
||||||
const setClauses: string[] = ["updatedAt = ?"];
|
const setClauses: string[] = ["updatedAt = ?"];
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export async function ensureMemoryFileWithBackend(
|
|||||||
const result = await backend.write(rootDir, getDefaultMemoryScaffold());
|
const result = await backend.write(rootDir, getDefaultMemoryScaffold());
|
||||||
refreshQmdIfNeeded();
|
refreshQmdIfNeeded();
|
||||||
return result.success;
|
return result.success;
|
||||||
} catch (err) {
|
} catch {
|
||||||
// Non-writable backends (readonly) don't throw during bootstrap
|
// Non-writable backends (readonly) don't throw during bootstrap
|
||||||
// This is intentional - bootstrap should not fail for non-writable backends
|
// This is intentional - bootstrap should not fail for non-writable backends
|
||||||
// The error is caught and we return false to indicate no action was taken
|
// The error is caught and we return false to indicate no action was taken
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
import { EventEmitter } from "node:events";
|
import { EventEmitter } from "node:events";
|
||||||
import type { Database } from "./db.js";
|
import type { Database } from "./db.js";
|
||||||
import { toJsonNullable } from "./db.js";
|
|
||||||
import type {
|
import type {
|
||||||
Roadmap,
|
Roadmap,
|
||||||
RoadmapMilestone,
|
RoadmapMilestone,
|
||||||
@@ -35,9 +34,7 @@ import type {
|
|||||||
RoadmapFeatureSourceRef,
|
RoadmapFeatureSourceRef,
|
||||||
} from "./roadmap-types.js";
|
} from "./roadmap-types.js";
|
||||||
import {
|
import {
|
||||||
normalizeRoadmapMilestoneOrder,
|
|
||||||
applyRoadmapMilestoneReorder,
|
applyRoadmapMilestoneReorder,
|
||||||
normalizeRoadmapFeatureOrder,
|
|
||||||
applyRoadmapFeatureReorder,
|
applyRoadmapFeatureReorder,
|
||||||
moveRoadmapFeature,
|
moveRoadmapFeature,
|
||||||
} from "./roadmap-ordering.js";
|
} from "./roadmap-ordering.js";
|
||||||
@@ -394,8 +391,6 @@ export class RoadmapStore extends EventEmitter<RoadmapStoreEvents> {
|
|||||||
throw new Error(`Milestone ${id} not found`);
|
throw new Error(`Milestone ${id} not found`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const roadmapId = milestone.roadmapId;
|
|
||||||
|
|
||||||
// SQLite FK cascade will handle features
|
// SQLite FK cascade will handle features
|
||||||
this.db.prepare("DELETE FROM roadmap_milestones WHERE id = ?").run(id);
|
this.db.prepare("DELETE FROM roadmap_milestones WHERE id = ?").run(id);
|
||||||
this.db.bumpLastModified();
|
this.db.bumpLastModified();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
import { EventEmitter } from "node:events";
|
import { EventEmitter } from "node:events";
|
||||||
import { randomUUID } from "node:crypto";
|
import { randomUUID } from "node:crypto";
|
||||||
import { CronExpressionParser } from "cron-parser";
|
import { CronExpressionParser } from "cron-parser";
|
||||||
import { Database, toJson, fromJson } from "./db.js";
|
import { Database, fromJson } from "./db.js";
|
||||||
import {
|
import {
|
||||||
isCronTrigger,
|
isCronTrigger,
|
||||||
type Routine,
|
type Routine,
|
||||||
|
|||||||
@@ -7,11 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { writeFile, readFile, rename } from "node:fs/promises";
|
import { writeFile, readFile, rename } from "node:fs/promises";
|
||||||
import { existsSync } from "node:fs";
|
|
||||||
import { join } from "node:path";
|
|
||||||
import type { Settings, GlobalSettings, ProjectSettings } from "./types.js";
|
import type { Settings, GlobalSettings, ProjectSettings } from "./types.js";
|
||||||
import { TaskStore } from "./store.js";
|
import { TaskStore } from "./store.js";
|
||||||
import { GlobalSettingsStore } from "./global-settings.js";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Structure for exported settings JSON.
|
* Structure for exported settings JSON.
|
||||||
|
|||||||
Reference in New Issue
Block a user