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,22 @@
{
"name": "@productos/analytics-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"
},
"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);
app.get("/healthz", async () => ({ ok: true, executor: "analytics" }));
/**
* Get funnel summary
* In production: queries BigQuery
*/
app.post("/execute/analytics/funnel", async (req) => {
const body = req.body as any;
const { input } = body;
console.log(`📊 Funnel request:`, input);
// Mock funnel data
const steps = [
{ event_name: "page_view", users: 10000, conversion_from_prev: 1.0 },
{ event_name: "signup_start", users: 3200, conversion_from_prev: 0.32 },
{ event_name: "signup_complete", users: 2100, conversion_from_prev: 0.66 },
{ event_name: "first_action", users: 1400, conversion_from_prev: 0.67 },
{ event_name: "subscription", users: 420, conversion_from_prev: 0.30 }
];
return {
funnel_name: input.funnel?.name ?? "default_funnel",
range_days: input.range_days,
steps,
overall_conversion: 0.042,
generated_at: new Date().toISOString()
};
});
/**
* Get top drivers for a metric
*/
app.post("/execute/analytics/top_drivers", async (req) => {
const body = req.body as any;
const { input } = body;
console.log(`🔍 Top drivers request:`, input);
// Mock driver analysis
const drivers = [
{ name: "completed_onboarding", score: 0.85, direction: "positive", evidence: "Users who complete onboarding convert 3.2x more", confidence: 0.92 },
{ name: "used_feature_x", score: 0.72, direction: "positive", evidence: "Feature X usage correlates with 2.5x retention", confidence: 0.88 },
{ name: "time_to_first_value", score: 0.68, direction: "negative", evidence: "Each additional day reduces conversion by 12%", confidence: 0.85 },
{ name: "invited_team_member", score: 0.61, direction: "positive", evidence: "Team invites increase stickiness by 40%", confidence: 0.79 },
{ name: "mobile_signup", score: 0.45, direction: "negative", evidence: "Mobile signups have 25% lower activation", confidence: 0.71 }
];
return {
target: input.target,
range_days: input.range_days,
drivers,
generated_at: new Date().toISOString()
};
});
/**
* Write an insight
*/
app.post("/execute/analytics/write_insight", async (req) => {
const body = req.body as any;
const { input, run_id } = body;
console.log(`💡 Write insight:`, input.insight?.title);
const insightId = `insight_${Date.now().toString(36)}`;
return {
insight_id: insightId,
stored: {
bigquery: { dataset: "insights", table: "insights_v1" },
firestore: { collection: "insights", doc_id: insightId },
gcs: { bucket: "productos-artifacts", prefix: `insights/${insightId}` }
},
created_at: new Date().toISOString()
};
});
const port = Number(process.env.PORT ?? 8091);
app.listen({ port, host: "0.0.0.0" }).then(() => {
console.log(`📈 Analytics 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"]
}
}