chore: codebase audit — remove dead code, unused deps, clean configs

Phase 1: Delete 19 dead component/service/tool files (4,200+ lines)
Phase 2: Remove 13 unused npm packages (Radix UI, shadcn utilities, ytdl-core, etc.)
Phase 3: Database schema — drop agent_delegations, add performance indexes
Phase 4: Remove 12 dead types from database.ts/analytics.ts/helpers.ts
Phase 5: Strip shadcn/ui theme from tailwind config
Phase 6: Clean env vars, fix broken imports (LocalKeyGate, MapViewer)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
“BeeRad”
2026-01-29 08:52:15 +11:00
co-authored by Claude Opus 4.5
parent 65d22315e1
commit 9b2db68751
33 changed files with 13 additions and 5683 deletions
-62
View File
@@ -1,62 +0,0 @@
import { tool } from 'ai';
import { z } from 'zod';
export const lockDimensionTool = tool({
description: 'Lock a dimension to enable auto-assignment to new nodes',
inputSchema: z.object({
name: z.string().describe('Dimension name to lock')
}),
execute: async (params) => {
console.log('🔒 LockDimension tool called with params:', JSON.stringify(params, null, 2));
try {
const trimmedName = params.name.trim();
if (!trimmedName) {
return {
success: false,
error: 'Dimension name is required',
data: null
};
}
const response = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000'}/api/dimensions`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: trimmedName,
isPriority: true
})
});
if (!response.ok) {
let errorMessage = 'Failed to lock dimension';
try {
const errorResult = await response.json();
errorMessage = errorResult.error || errorMessage;
} catch {
// If response is not JSON (e.g., HTML error page), use status text
errorMessage = `Failed to lock dimension: ${response.status} ${response.statusText}`;
}
return {
success: false,
error: errorMessage,
data: null
};
}
const result = await response.json();
return {
success: true,
data: result.data,
message: `Locked dimension "${trimmedName}" - it will now be auto-assigned to new nodes`
};
} catch (error) {
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to lock dimension',
data: null
};
}
}
});
-62
View File
@@ -1,62 +0,0 @@
import { tool } from 'ai';
import { z } from 'zod';
export const unlockDimensionTool = tool({
description: 'Unlock a dimension to disable auto-assignment to new nodes',
inputSchema: z.object({
name: z.string().describe('Dimension name to unlock')
}),
execute: async (params) => {
console.log('🔓 UnlockDimension tool called with params:', JSON.stringify(params, null, 2));
try {
const trimmedName = params.name.trim();
if (!trimmedName) {
return {
success: false,
error: 'Dimension name is required',
data: null
};
}
const response = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000'}/api/dimensions`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: trimmedName,
isPriority: false
})
});
if (!response.ok) {
let errorMessage = 'Failed to unlock dimension';
try {
const errorResult = await response.json();
errorMessage = errorResult.error || errorMessage;
} catch {
// If response is not JSON (e.g., HTML error page), use status text
errorMessage = `Failed to unlock dimension: ${response.status} ${response.statusText}`;
}
return {
success: false,
error: errorMessage,
data: null
};
}
const result = await response.json();
return {
success: true,
data: result.data,
message: `Unlocked dimension "${trimmedName}" - it will no longer be auto-assigned to new nodes`
};
} catch (error) {
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to unlock dimension',
data: null
};
}
}
});
-41
View File
@@ -1,41 +0,0 @@
import { tool } from 'ai';
import { z } from 'zod';
export const embedContentTool = tool({
description: 'Chunk and embed a nodes content so semantic search stays current',
inputSchema: z.object({
nodeId: z.number().describe('The ID of the node to process')
}),
execute: async ({ nodeId }) => {
try {
// Call the same API endpoint that the manual embed button uses
const response = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000'}/api/ingestion`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ nodeId })
});
const result = await response.json();
if (!response.ok) {
return {
success: false,
error: result.error || 'Failed to embed content',
data: null
};
}
return {
success: true,
message: result.message || `Successfully chunked and embedded content for node ${nodeId}`,
data: { nodeId }
};
} catch (error) {
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to embed content',
data: null
};
}
}
});