created build for agenticfirst prod#1316
Conversation
|
""" WalkthroughTwo new environment configurations, Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant NPM
participant Server
Developer->>NPM: run build-test-agenticfirst / build-prod-agenticfirst
NPM->>NPM: Set NODE_ENV=test_agenticfirst / prod_agenticfirst
NPM->>NPM: Run build-server
NPM->>NPM: Run gulp-build
NPM->>Server: Start server with test_agenticfirst / prod_agenticfirst config
Suggested reviewers
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
server/config/config-env.js (1)
150-177: DRY up theprod_agenticfirstconfig by reusing theprodblock
This block is nearly identical toprod. Use object spread or a factory to inherit fromconfigEnv.prodand override onlyhostUrlto reduce duplication and maintenance overhead.Example refactor:
// after defining configEnv.prod configEnv.prod_agenticfirst = { ...configEnv.prod, urls: { ...configEnv.prod.urls, hostUrl: 'https://widget.agenticfirst.ai', }, };package.json (1)
18-18: Improve cross-platform support for the build script
Usingexportis Unix-only. Consider usingcross-envso Windows users and CI environments can setNODE_ENVreliably.Suggested diff:
-"build-prod-agenticfirst": "export NODE_ENV=prod_agenticfirst && npm-run-all build-server gulp-build", +"build-prod-agenticfirst": "cross-env NODE_ENV=prod_agenticfirst npm-run-all build-server gulp-build",
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
package.json(1 hunks)server/config/config-env.js(1 hunks)
🔇 Additional comments (1)
package.json (1)
18-18: Add build script forprod_agenticfirst
The newbuild-prod-agenticfirstscript correctly setsNODE_ENVtoprod_agenticfirstand chains the existing build tasks.
| prod_agenticfirst: { | ||
| port: '3030', | ||
| urls: { | ||
| applozicBaseUrl: 'https://chat.kommunicate.io', | ||
| kommunicateBaseUrl: 'https://api.kommunicate.io', | ||
| botPlatformApi: 'https://bots.kommunicate.io', | ||
| hostUrl: 'https://widget.agenticfirst.ai', | ||
| dashboardUrl: 'https://dashboard.kommunicate.io', | ||
| }, | ||
| pluginProperties: { | ||
| pseudoNameEnabled: true, | ||
| }, | ||
| thirdPartyIntegration: { | ||
| sentry: { | ||
| nameSpace: '9f71614ef8184d0cab00074555dad9a7', | ||
| dsn: 'https://9f71614ef8184d0cab00074555dad9a7@sentry.io/1321911', | ||
| enabled: true, | ||
| AUTH_TOKEN: | ||
| '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', | ||
| PROJECT: 'chat-widget', | ||
| ORG: 'applozic', | ||
| }, | ||
| aws: { | ||
| cdnUrl: 'https://cdn.kommunicate.io', | ||
| bucket: 'kom-prod-cdn', | ||
| }, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Remove hard-coded Sentry credentials
Storing DSN and AUTH_TOKEN directly in source exposes secrets and risks leakage. Move these values into environment variables (e.g., process.env.SENTRY_DSN and process.env.SENTRY_AUTH_TOKEN) and fall back to defaults if needed.
Example diff:
- dsn: 'https://…@sentry.io/1321911',
+ dsn: process.env.SENTRY_DSN,
...
- AUTH_TOKEN: 'sntrys_…',
+ AUTH_TOKEN: process.env.SENTRY_AUTH_TOKEN,| kommunicateBaseUrl: 'https://api.kommunicate.io', | ||
| botPlatformApi: 'https://bots.kommunicate.io', | ||
| hostUrl: 'https://widget.agenticfirst.ai', | ||
| dashboardUrl: 'https://dashboard.kommunicate.io', |
There was a problem hiding this comment.
check where is this url? do we need to change this
There was a problem hiding this comment.
this host url is getting used in plugin
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
cloudbuild.yaml (1)
42-42: Remove trailing whitespace for YAML compliance.YAMLlint flags a trailing space at the end of this line, which can cause lint errors or unexpected behavior in some parsers. Please strip the extra space after
then.- elif [ "${_BUILD_ENV}" = "prod_agenticfirst" ]; then + elif [ "${_BUILD_ENV}" = "prod_agenticfirst" ]; then🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 42-42: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)
📒 Files selected for processing (1)
cloudbuild.yaml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
cloudbuild.yaml
[error] 42-42: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: km-prod-widget (km-prod-us)
| elif [ "${_BUILD_ENV}" = "prod_agenticfirst" ]; then | ||
| npm run build-prod-agenticfirst; |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify environment naming and matching npm script.
Please ensure that the _BUILD_ENV value prod_agenticfirst aligns exactly with the npm script name in package.json (e.g., build-prod-agenticfirst). In addition, consider standardizing on hyphens (prod-agenticfirst) instead of underscores to stay consistent with other environment identifiers (prod-in, prod-eu, etc.) and avoid confusion.
Run this snippet to confirm the script’s presence:
🏁 Script executed:
#!/bin/bash
# Verify that build-prod-agenticfirst exists in package.json
grep -R '"build-prod-agenticfirst"' -n package.jsonLength of output: 163
Standardize Environment Naming and Confirm npm Script
Confirmed that the build-prod-agenticfirst script exists in package.json (line 18) and matches the current _BUILD_ENV value. To maintain consistency with other environments (e.g., prod-in, prod-eu), rename underscores to hyphens throughout:
• In cloudbuild.yaml (lines 42–43):
- Update
_BUILD_ENVcheck fromprod_agenticfirst→prod-agenticfirst
• In package.json (line 18): - Update
NODE_ENV=prod_agenticfirst→NODE_ENV=prod-agenticfirst
Proposed diffs:
--- a/cloudbuild.yaml
+++ b/cloudbuild.yaml
@@ -42,2 +42,2 @@ steps:
- elif [ "${_BUILD_ENV}" = "prod_agenticfirst" ]; then
- npm run build-prod-agenticfirst;
+ elif [ "${_BUILD_ENV}" = "prod-agenticfirst" ]; then
+ npm run build-prod-agenticfirst;--- a/package.json
+++ b/package.json
@@ -18,1 +18,1 @@
- "build-prod-agenticfirst": "export NODE_ENV=prod_agenticfirst && npm-run-all build-server gulp-build",
+ "build-prod-agenticfirst": "export NODE_ENV=prod-agenticfirst && npm-run-all build-server gulp-build",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| elif [ "${_BUILD_ENV}" = "prod_agenticfirst" ]; then | |
| npm run build-prod-agenticfirst; | |
| elif [ "${_BUILD_ENV}" = "prod-agenticfirst" ]; then | |
| npm run build-prod-agenticfirst; |
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 42-42: trailing spaces
(trailing-spaces)
|
A friendly reminder that this PR had no activity for 15 days. |
What do you want to achieve?
PR Checklist
How was the code tested?
What new thing you came across while writing this code?
In case you fixed a bug then please describe the root cause of it?
Screenshot
NOTE: Make sure you're comparing your branch with the correct base branch
Summary by CodeRabbit