aios-core
Version:
Synkra AIOS: AI-Orchestrated System for Full Stack Development - Core Framework
89 lines (77 loc) • 2 kB
JavaScript
/**
* Supabase Extension Adapter
* Story GEMINI-INT.12 - Supabase Native Integration
*
* Integrates Gemini CLI's native Supabase extension for
* database operations without MCP.
*/
const { execSync } = require('child_process');
class SupabaseAdapter {
constructor(config = {}) {
this.enabled = false;
this.projectRef = config.projectRef || null;
}
/**
* Check if Supabase extension is available
*/
async checkAvailability() {
try {
const output = execSync('gemini extensions list --output-format json 2>/dev/null', {
encoding: 'utf8',
timeout: 10000,
});
const extensions = JSON.parse(output);
this.enabled = extensions.some((e) => e.name === 'supabase');
return this.enabled;
} catch {
this.enabled = false;
return false;
}
}
/**
* List tables in database
*/
async listTables() {
if (!this.enabled) throw new Error('Supabase extension not available');
// Would use Gemini's Supabase extension
return {
tables: [],
message: 'Use Gemini CLI with Supabase extension',
};
}
/**
* Run a migration
* @param {string} migrationPath - Path to migration file
*/
async runMigration(migrationPath) {
if (!this.enabled) throw new Error('Supabase extension not available');
return {
success: true,
migration: migrationPath,
message: 'Migration queued via Gemini CLI',
};
}
/**
* Execute SQL query
* @param {string} sql - SQL query
*/
async query(sql) {
if (!this.enabled) throw new Error('Supabase extension not available');
return {
success: true,
query: sql,
message: 'Query queued via Gemini CLI',
};
}
/**
* Sync with MCP Supabase (if both are available)
*/
async syncWithMCP() {
// Check if MCP Supabase is also configured
return {
synced: false,
message: 'MCP sync not implemented',
};
}
}
module.exports = { SupabaseAdapter };