MCPcopy Create free account
hub / github.com/ShipSecAI/studio / main

Function main

worker/scripts/workflow-execute-inline.ts:27–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25}
26
27async function main() {
28 const workflowId = process.argv[2] ?? 'f38c93d7-e0fb-47b1-bbfc-fdb6cd19a325';
29 const fileId = process.argv[3] ?? '3a21f08e-5ea1-47fd-b0f8-3a057ce24321';
30
31 const __dirname = dirname(fileURLToPath(import.meta.url));
32 config({ path: join(__dirname, '..', '.env') });
33
34 const connectionString =
35 process.env.DATABASE_URL ?? 'postgresql://shipsec:shipsec@localhost:5433/shipsec';
36 const pool = new Pool({ connectionString });
37 const db = drizzle(pool, { schema });
38
39 const minioBucket = process.env.MINIO_BUCKET_NAME ?? 'shipsec-files';
40 const minioEndpoint = process.env.MINIO_ENDPOINT ?? 'localhost';
41 const minioPort = parseInt(process.env.MINIO_PORT ?? '9000', 10);
42 const minioAccessKey = process.env.MINIO_ACCESS_KEY ?? 'minioadmin';
43 const minioSecretKey = process.env.MINIO_SECRET_KEY ?? 'minioadmin';
44 const minioUseSSL = process.env.MINIO_USE_SSL === 'true';
45
46 const { Client: MinioClient } = await import('minio');
47 const minioClient = new MinioClient({
48 endPoint: minioEndpoint,
49 port: minioPort,
50 useSSL: minioUseSSL,
51 accessKey: minioAccessKey,
52 secretKey: minioSecretKey,
53 });
54
55 const storage = new FileStorageAdapter(minioClient, db, minioBucket);
56 const trace = new TraceAdapter(db);
57 const secrets = new SecretsAdapter(db);
58
59 const definition = await loadDefinition(pool, workflowId);
60
61 const runId = `inline-${randomUUID()}`;
62 trace.setRunMetadata(runId, { workflowId });
63 const result = await executeWorkflow(
64 definition,
65 { inputs: { input1: fileId } },
66 { runId, storage, trace, secrets },
67 );
68
69 console.log(JSON.stringify({ runId, result }, null, 2));
70
71 trace.finalizeRun(runId);
72
73 await pool.end();
74}
75
76main().catch((error) => {
77 console.error(error);

Callers 1

Calls 4

setRunMetadataMethod · 0.95
finalizeRunMethod · 0.95
executeWorkflowFunction · 0.90
loadDefinitionFunction · 0.70

Tested by

no test coverage detected