1- // import { Router, Request, Response } from "express";
2- // import { ENV_CONFIG } from "../utils/envConfig";
3-
4- // const router = Router();
5-
6- // router.get("/integration-json", (req: Request, res: Response) => {
7- // const integrationData = {
8- // data: {
9- // date: {
10- // created_at: "2025-02-20 22:25:37",
11- // updated_at: "2025-02-20 22:25:37",
12- // },
13- // descriptions: {
14- // app_description:
15- // "Analyzes your codebase for static errors and reports them to Telex channels with prioritized error classification.",
16- // app_logo: "https://example.com/path-to-code-error-agent-logo.png",
17- // app_name: "Code Error Agent",
18- // app_url: ENV_CONFIG.SERVER_URL,
19- // background_color: "#FF4444",
20- // },
21- // integration_category: "AI & Machine Learning",
22- // integration_type: "interval",
23- // is_active: true,
24- // output: [
25- // {
26- // label: "error_notifications",
27- // value: true,
28- // },
29- // ],
30- // key_features: [
31- // "Static code error detection using ESLint",
32- // "Prioritized error classification (High, Medium, Low)",
33- // "Automated error reporting to Telex channels",
34- // "Configurable analysis intervals",
35- // "Integration with development pipelines",
36- // ],
37- // settings: [
38- // {
39- // label: "codeBasePath",
40- // type: "text",
41- // required: true,
42- // default: process.env.CODE_BASE_PATH || "./src",
43- // },
44- // {
45- // label: "errorThreshold",
46- // type: "text",
47- // required: true,
48- // default: "1",
49- // },
50- // {
51- // label: "interval",
52- // type: "text",
53- // required: true,
54- // default: "*/15 * * * *",
55- // },
56- // ],
57- // tick_url: `${ENV_CONFIG.SERVER_URL}/tick`,
58- // target_url: `${ENV_CONFIG.SERVER_URL}/webhook`,
59- // },
60- // };
61-
62- // res.json(integrationData);
63- // });
64-
65- // export default router;
66-
671import { Router , Request , Response } from "express" ;
68- import { ENV_CONFIG } from "../utils/envConfig.js " ;
2+ import { ENV_CONFIG } from "../utils/envConfig" ;
693
704const router = Router ( ) ;
715
726router . get ( "/integration-json" , ( req : Request , res : Response ) => {
73- // Get the host from the request headers
74- const host = req . get ( "host" ) ;
75- const protocol = req . protocol ;
76- const baseUrl = `${ protocol } ://${ host } ` ;
77-
787 const integrationData = {
798 data : {
809 date : {
@@ -86,7 +15,7 @@ router.get("/integration-json", (req: Request, res: Response) => {
8615 "Analyzes your codebase for static errors and reports them to Telex channels with prioritized error classification." ,
8716 app_logo : "https://example.com/path-to-code-error-agent-logo.png" ,
8817 app_name : "Code Error Agent" ,
89- app_url : baseUrl ,
18+ app_url : ENV_CONFIG . SERVER_URL ,
9019 background_color : "#FF4444" ,
9120 } ,
9221 integration_category : "AI & Machine Learning" ,
@@ -125,23 +54,94 @@ router.get("/integration-json", (req: Request, res: Response) => {
12554 default : "*/15 * * * *" ,
12655 } ,
12756 ] ,
128- // Use the ngrok URL for these endpoints
129- tick_url : `${ baseUrl } /code-error-integration/tick` ,
130- target_url : `${ baseUrl } /code-error-integration/webhook` ,
57+ tick_url : `${ ENV_CONFIG . SERVER_URL } /tick` ,
58+ target_url : `${ ENV_CONFIG . SERVER_URL } /webhook` ,
13159 } ,
13260 } ;
13361
13462 res . json ( integrationData ) ;
13563} ) ;
13664
137- // Add webhook handler
138- router . post ( "/webhook" , ( req : Request , res : Response ) => {
139- // console.log("=== WEBHOOK RECEIVED ===");
140- // console.log("Headers:", req.headers);
141- // console.log("Body:", req.body);
142- // console.log("=====================");
65+ export default router ;
14366
144- res . status ( 200 ) . json ( { status : "success" } ) ;
145- } ) ;
67+ // import { Router, Request, Response } from "express" ;
68+ // import { ENV_CONFIG } from "../utils/envConfig.js" ;
14669
147- export default router ;
70+ // const router = Router();
71+
72+ // router.get("/integration-json", (req: Request, res: Response) => {
73+ // // Get the host from the request headers
74+ // const host = req.get("host");
75+ // const protocol = req.protocol;
76+ // const baseUrl = `${protocol}://${host}`;
77+
78+ // const integrationData = {
79+ // data: {
80+ // date: {
81+ // created_at: "2025-02-20 22:25:37",
82+ // updated_at: "2025-02-20 22:25:37",
83+ // },
84+ // descriptions: {
85+ // app_description:
86+ // "Analyzes your codebase for static errors and reports them to Telex channels with prioritized error classification.",
87+ // app_logo: "https://example.com/path-to-code-error-agent-logo.png",
88+ // app_name: "Code Error Agent",
89+ // app_url: baseUrl,
90+ // background_color: "#FF4444",
91+ // },
92+ // integration_category: "AI & Machine Learning",
93+ // integration_type: "interval",
94+ // is_active: true,
95+ // output: [
96+ // {
97+ // label: "error_notifications",
98+ // value: true,
99+ // },
100+ // ],
101+ // key_features: [
102+ // "Static code error detection using ESLint",
103+ // "Prioritized error classification (High, Medium, Low)",
104+ // "Automated error reporting to Telex channels",
105+ // "Configurable analysis intervals",
106+ // "Integration with development pipelines",
107+ // ],
108+ // settings: [
109+ // {
110+ // label: "codeBasePath",
111+ // type: "text",
112+ // required: true,
113+ // default: process.env.CODE_BASE_PATH || "./src",
114+ // },
115+ // {
116+ // label: "errorThreshold",
117+ // type: "text",
118+ // required: true,
119+ // default: "1",
120+ // },
121+ // {
122+ // label: "interval",
123+ // type: "text",
124+ // required: true,
125+ // default: "*/15 * * * *",
126+ // },
127+ // ],
128+ // // Use the ngrok URL for these endpoints
129+ // tick_url: `${baseUrl}/code-error-integration/tick`,
130+ // target_url: `${baseUrl}/code-error-integration/webhook`,
131+ // },
132+ // };
133+
134+ // res.json(integrationData);
135+ // });
136+
137+ // // Add webhook handler
138+ // // router.post("/webhook", (req: Request, res: Response) => {
139+ // // // console.log("=== WEBHOOK RECEIVED ===");
140+ // // // console.log("Headers:", req.headers);
141+ // // // console.log("Body:", req.body);
142+ // // // console.log("=====================");
143+
144+ // // res.status(200).json({ status: "success" });
145+ // // });
146+
147+ // export default router;
0 commit comments