Restructure Project Architecture with Modular Routes and Configuration

- Refactored main application entry point to use centralized configuration
- Created modular route structure with separate files for different API endpoints
- Introduced app.config.ts for centralized environment variable management
- Moved tools and route logic into dedicated files
- Simplified index.ts and improved overall project organization
- Added comprehensive type definitions for tools and API interactions
This commit is contained in:
jango-blockchained
2025-02-03 15:39:19 +01:00
parent 18f09bb5ce
commit 397355c1ad
20 changed files with 1664 additions and 1341 deletions

View File

@@ -1,5 +1,17 @@
import { z } from 'zod';
import { get_hass } from '../hass/index.js';
import { Tool } from '../types/index.js';
import { listDevicesTool } from './list-devices.tool.js';
import { controlTool } from './control.tool.js';
import { historyTool } from './history.tool.js';
import { sceneTool } from './scene.tool.js';
import { notifyTool } from './notify.tool.js';
import { automationTool } from './automation.tool.js';
import { addonTool } from './addon.tool.js';
import { packageTool } from './package.tool.js';
import { automationConfigTool } from './automation-config.tool.js';
import { subscribeEventsTool } from './subscribe-events.tool.js';
import { getSSEStatsTool } from './sse-stats.tool.js';
// Tool category types
export enum ToolCategory {
@@ -188,4 +200,44 @@ export class LightControlTool implements EnhancedTool {
// Implementation here
return { success: true };
}
}
}
// Array to track all tools
const tools: Tool[] = [
listDevicesTool,
controlTool,
historyTool,
sceneTool,
notifyTool,
automationTool,
addonTool,
packageTool,
automationConfigTool,
subscribeEventsTool,
getSSEStatsTool
];
// Function to get a tool by name
export function getToolByName(name: string): Tool | undefined {
return tools.find(tool => tool.name === name);
}
// Function to get all tools
export function getAllTools(): Tool[] {
return [...tools];
}
// Export all tools individually
export {
listDevicesTool,
controlTool,
historyTool,
sceneTool,
notifyTool,
automationTool,
addonTool,
packageTool,
automationConfigTool,
subscribeEventsTool,
getSSEStatsTool
};