7 listGoals,
8 deleteGoal
9} from "../../database/queries.ts";
10
11export const goalTools: MCPTool[] = [
325 if (goal.subGoals.length === 0 && goal.tasks.length > 0) {
326 // Import task queries here to avoid circular dependency
327 const { getTask } = await import("../../database/queries.ts");
328
329 for (const taskId of goal.tasks) {
374
375 // Delete all tasks associated with this goal
376 const { listTasks, deleteTask } = await import("../../database/queries.ts");
377 const tasks = await listTasks({ goalId }, userId);
378 for (const task of tasks) {
10 deleteThoughtFork,
11 deleteThoughtExploration
12} from "../../database/queries.ts";
13
14const openai = new OpenAI();
1import type { Context } from "https://esm.sh/hono@3.11.7";
2import { getUserByAccessToken } from "../database/user-queries.ts";
3import type { User } from "../../shared/types.ts";
4
29
30export async function runMigrations() {
31 console.log("Running MCP database migrations...");
32
33 // Users table
344 await sqlite.execute(`CREATE INDEX IF NOT EXISTS idx_user_skill_executions_skill ON ${TABLES.USER_SKILL_EXECUTIONS}(skillId)`);
345
346 console.log("MCP database migrations completed successfully");
347}
12});
13
14// Initialize database
15await initializeDatabase();
16
17// Serve static files
93
94 // Create user
95 console.log("Inserting user into database...");
96 const result = await sqlite.execute(`
97 INSERT INTO users (email, nome, empresa, cargo, telefone, como_conheceu, tipo_empresa, num_funcionarios, site, contratar_seo, password_hash)
180});
181
182// Debug route to view database
183app.get("/debug/db", async c => {
184 try {
197 <html>
198 <head>
199 <title>Database Debug</title>
200 <style>
201 body { font-family: Arial, sans-serif; margin: 20px; }
209 </head>
210 <body>
211 <h1>Database Debug View</h1>
212
213 <h2>Users (${Array.isArray(users) ? users.length : 0} records)</h2>
295 </table>
296
297 <h2>Test Database Connection</h2>
298 <p class="success">β
Database connection successful</p>
299
300 <h2>Actions</h2>
324 <html>
325 <body>
326 <h1>Database Error</h1>
327 <p class="error">Error: ${error.message}</p>
328 <pre>${error.stack}</pre>
463
464// Helper functions
465async function initializeDatabase() {
466 // Users table
467 await sqlite.execute(`
516 `);
517
518 console.log("Database initialized successfully");
519}
520
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import todos from "./routes/todos.ts";
5import ai from "./routes/ai.ts";
12});
13
14// Initialize database on startup
15await runMigrations();
16
7 updateTodo,
8 deleteTodo,
9} from "../database/queries.ts";
10
11const todos = new Hono();
17 )`);
18
19 console.log('Database migrations completed');
20}
21
8- π€ AI-powered task prioritization using OpenAI
9- π± Responsive web interface
10- πΎ SQLite database storage
11- π― Priority scoring and recommendations
12
15```
16βββ backend/
17β βββ database/
18β β βββ migrations.ts # Database schema
19β β βββ queries.ts # Database operations
20β βββ routes/
21β β βββ todos.ts # TODO CRUD operations
16- **Backend**: Hono framework
17- **Frontend**: HTML/CSS/JavaScript com TailwindCSS
18- **Database**: SQLite
19- **IA**: Google Gemini 2.5 Flash Preview
20- **AutenticaΓ§Γ£o**: Google OAuth + sessΓ΅es customizadas