Skip to content

Commit 4dae787

Browse files
committed
chore(review): add comments/insights
1 parent 96cdbec commit 4dae787

File tree

7 files changed

+26
-4
lines changed

7 files changed

+26
-4
lines changed

server/db.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
// definitely periodically run Prettier or some other formatter on your codebase!
2+
13
import 'dotenv/config';
24
import pkg from 'pg';
35
const { Pool } = pkg;
46

5-
6-
console.log("🔐 DB SSL rejectUnauthorized:", process.env.DB_SSL_REJECT_UNAUTHORIZED);
7+
console.log(
8+
'🔐 DB SSL rejectUnauthorized:',
9+
process.env.DB_SSL_REJECT_UNAUTHORIZED
10+
);
711
export const pool = new Pool({
812
connectionString: process.env.DATABASE_URL,
913
max: parseInt(process.env.DB_POOL_MAX || '8', 10),
@@ -17,7 +21,9 @@ export const pool = new Pool({
1721
},
1822
});
1923

20-
pool.on('error', (err) => console.error('[DB] Unexpected error on idle client', err));
24+
pool.on('error', (err) =>
25+
console.error('[DB] Unexpected error on idle client', err)
26+
);
2127

2228
export async function query(sql, params = []) {
2329
const start = Date.now();

server/lib/github-oauth.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// this file is great, and organized.
2+
13
export function buildAuthorizeUrl({ clientId, redirectUri, scopes, state }) {
24
const params = new URLSearchParams({
35
client_id: clientId,

server/routes/agent.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/* just commenting on this file to say:
2+
in your /routes folder, make sure to keep your router names consistent!
3+
*/
4+
15
import express from 'express';
26
import { runWizardAgent } from '../agent/wizardAgent.js';
37
import { pipeline_generator } from '../tools/pipeline_generator.js';

server/routes/auth.aws.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ import {
1313
} from "@aws-sdk/client-sso-oidc";
1414

1515
const router = Router();
16+
17+
// i'd set up some linting to ensure that you're catching unused variables, like the one below
18+
// this will be important in terms of keeping your codebase organized & professional down the line
1619
const SESSION_SECRET = process.env.SESSION_SECRET;
1720

1821
// ✅ Start AWS connect flow
1922
router.post("/connect", requireSession, async (req, res) => {
2023
const { sso_start_url, sso_region, account_id, role_to_assume } = req.body;
21-
const userId = req.user.id;
24+
25+
// if you want to get fancy with destructuring, i'd do this personally:
26+
const { user: { id: userId } } = req;
2227

2328
// Validate required parameters
2429
if (!sso_start_url || typeof sso_start_url !== 'string' || sso_start_url.trim() === '') {

server/routes/auth.github.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ router.get('/start', (req, res) => {
4141
return res.redirect(url);
4242
});
4343

44+
// remove commented-out code like this if you're not gonna use it
45+
4446
// router.get('/callback', async (req, res) => {
4547
// try {
4648
// const { code, state } = req.query;

server/routes/pipelineCommit.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { upsertWorkflowFile } from '../tools/github_adapter.js';
55

66
const router = Router();
77

8+
// this is nice. consider using JSDoc at some point in the future to document your routes/functions/etc.
9+
// it really elevates a codebase's professionalism
810
/**
911
* POST /mcp/v1/pipeline_commit
1012
* Body:

server/src/config/env.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import dotenv from "dotenv";
22
dotenv.config();
33

4+
// definitely be sure to remove these kinds of logs in production!
45
console.log("🧾 MCP_API_KEY from .env:", process.env.MCP_API_KEY);
56

67
export const config = {

0 commit comments

Comments
 (0)