Initial commit: Product OS platform

- Control Plane API with Gemini integration
- Executors: Deploy, Analytics, Marketing
- MCP Adapter for Continue integration
- VSCode/VSCodium extension
- Tool registry and run tracking
- In-memory storage for local dev
- Terraform infrastructure setup
This commit is contained in:
2026-01-19 20:34:43 -08:00
commit b6d7148ded
58 changed files with 5365 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
{
"name": "@productos/deploy-executor",
"version": "0.1.0",
"private": true,
"type": "module",
"main": "dist/index.js",
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc -p tsconfig.json",
"start": "node dist/index.js"
},
"dependencies": {
"@fastify/cors": "^10.0.0",
"@fastify/sensible": "^6.0.0",
"fastify": "^5.0.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/node": "^22.0.0",
"tsx": "^4.19.0",
"typescript": "^5.5.4"
}
}

View File

@@ -0,0 +1,91 @@
import Fastify from "fastify";
import cors from "@fastify/cors";
import sensible from "@fastify/sensible";
const app = Fastify({ logger: true });
await app.register(cors, { origin: true });
await app.register(sensible);
// Health check
app.get("/healthz", async () => ({ ok: true, executor: "deploy" }));
/**
* Deploy a Cloud Run service
* In production: triggers Cloud Build, deploys to Cloud Run
* In dev: returns mock response
*/
app.post("/execute/cloudrun/deploy", async (req) => {
const body = req.body as any;
const { run_id, tenant_id, input } = body;
console.log(`🚀 Deploy request:`, { run_id, tenant_id, input });
// Simulate deployment time
await new Promise(r => setTimeout(r, 1500));
// In production, this would:
// 1. Clone the repo
// 2. Trigger Cloud Build
// 3. Deploy to Cloud Run
// 4. Return the service URL
const mockRevision = `${input.service_name}-${Date.now().toString(36)}`;
const mockUrl = `https://${input.service_name}-abc123.a.run.app`;
console.log(`✅ Deploy complete:`, { revision: mockRevision, url: mockUrl });
return {
service_url: mockUrl,
revision: mockRevision,
build_id: `build-${Date.now()}`,
deployed_at: new Date().toISOString(),
region: input.region ?? "us-central1",
env: input.env
};
});
/**
* Get Cloud Run service status
*/
app.post("/execute/cloudrun/status", async (req) => {
const body = req.body as any;
const { input } = body;
console.log(`📊 Status request:`, input);
// Mock status response
return {
service_name: input.service_name,
region: input.region,
service_url: `https://${input.service_name}-abc123.a.run.app`,
latest_ready_revision: `${input.service_name}-v1`,
status: "ready",
last_deploy_time: new Date().toISOString(),
traffic: [{ revision: `${input.service_name}-v1`, percent: 100 }]
};
});
/**
* Rollback to a previous revision
*/
app.post("/execute/cloudrun/rollback", async (req) => {
const body = req.body as any;
const { input } = body;
console.log(`⏪ Rollback request:`, input);
await new Promise(r => setTimeout(r, 1000));
return {
service_name: input.service_name,
rolled_back_to: input.target_revision ?? "previous",
status: "ready",
rolled_back_at: new Date().toISOString()
};
});
const port = Number(process.env.PORT ?? 8090);
app.listen({ port, host: "0.0.0.0" }).then(() => {
console.log(`🔧 Deploy Executor running on http://localhost:${port}`);
});

View File

@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "Bundler",
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"types": ["node"]
}
}