-
Notifications
You must be signed in to change notification settings - Fork 106
Add support for structured logs #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Warning Rate limit exceeded@msukkari has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 4 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (5)
WalkthroughThis update introduces a new centralized logging package, Changes
Sequence Diagram(s)sequenceDiagram
participant AppComponent
participant LoggerFactory
participant WinstonLogger
participant Console/File/Logtail
AppComponent->>LoggerFactory: createLogger("context")
LoggerFactory->>WinstonLogger: Configure transports (console, file, Logtail)
AppComponent->>WinstonLogger: logger.info/debug/error(...)
WinstonLogger->>Console/File/Logtail: Output log (structured/human-readable)
Poem
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:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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
CodeRabbit Configuration File (
|
Tip For best results, initiate chat on the files or code changes. @msukkari Hello! I'm here and ready to help. What would you like me to assist you with? Here are some things I can do for you: 🔍 Review & Analysis:
📚 Documentation & Explanation:
📊 Analysis & Insights:
⚙️ Configuration:
Just let me know what you'd like me to focus on! |
Tip For best results, initiate chat on the files or code changes. @msukkari Hi! I see you've tagged me. How can I help you with this PR? Here are some things I can assist with:
What would you like me to help you with? |
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
🔭 Outside diff range comments (1)
packages/web/src/actions.ts (1)
115-122
:⚠️ Potential issueMask email addresses in invite logs to protect PII
Logging raw email addresses (${email}
and${emails.join(", ")}
) may expose PII. Consider logging user IDs or count of skipped addresses instead:- logger.error(`Failed to send invite email to ${email}: ${failed}`); + logger.error("Failed to send invite email", { recipientCount: 1, reason: failed }); ... - logger.warn(`SMTP_CONNECTION_URL or EMAIL_FROM_ADDRESS not set. Skipping invite email to ${emails.join(", ")}`); + logger.warn("Skipping invite emails due to missing SMTP configuration", { count: emails.length });
🧹 Nitpick comments (38)
packages/mcp/README.md (1)
162-162
: Typo: "checkout" should be "check out"
For clarity, update the verb to two words.-For a more detailed guide, checkout [the docs](https://docs.sourcebot.dev/docs/features/mcp-server). +For a more detailed guide, check out [the docs](https://docs.sourcebot.dev/docs/features/mcp-server).packages/backend/src/instrument.ts (2)
3-4
: Reorder imports for consistency
Group external imports together and place local module imports afterward to maintain a clear import ordering.-import * as Sentry from "@sentry/node"; -import { env } from "./env.js"; -import { createLogger } from "@sourcebot/logger"; +import * as Sentry from "@sentry/node"; +import { createLogger } from "@sourcebot/logger"; +import { env } from "./env.js";
14-14
: Enhance Sentry debug message with context
Including which environment variable is missing can speed up troubleshooting. Consider:-logger.debug("Sentry was not initialized"); +const missing = !env.NEXT_PUBLIC_SENTRY_BACKEND_DSN ? "DSN" : "environment"; +logger.debug(`Sentry was not initialized: missing ${missing}`);packages/backend/src/bitbucket.ts (1)
16-16
: Standardize logger name casing
You’ve initialized the logger with'bitbucket'
(lowercase). Confirm that this lowercase naming convention is applied uniformly across all modules (e.g.,'gitlab'
,'github'
) to facilitate consistent log filtering and aggregation.docs/docs/configuration/tenancy.mdx (1)
7-7
: Improve warning grammar for clarity
The current warning reads:<Warning>[Authentication](/docs/configuration/auth/overview) must be enabled to enable multi tenancy mode</Warning>Consider rephrasing to avoid repeating “enable”:
<Warning>Authentication must be enabled to use multi tenancy mode</Warning>packages/backend/src/gitlab.ts (1)
11-11
: Consistent logger name across modules
The logger is instantiated with'gitlab'
. Double-check that this lowercase service identifier matches what other modules use (e.g.,'bitbucket'
,'github'
) for uniform structured log labels.docs/docs/connections/bitbucket-cloud.mdx (1)
4-4
: Quote icon metadata in frontmatter
YAML parsers can misinterpret unquoted values. Update to:icon: "Bitbucket"to ensure reliable parsing across environments.
docs/docs/connections/local-repos.mdx (1)
3-3
: Quote icon metadata for consistency
Frontmatter now includesicon: folder
. For consistency and to prevent YAML parsing issues, wrap the value in quotes:icon: "folder"docs/docs/features/agents/overview.mdx (1)
10-10
: Consider adjusting contraction style for American English.The static analysis tool suggests avoiding "you've" in American English style when not followed by a past participle.
Consider this revision:
- Agents are automations that leverage the code indexed on Sourcebot to perform a specific task. Once you've setup Sourcebot, check out the + Agents are automations that leverage the code indexed on Sourcebot to perform a specific task. Once you have set up Sourcebot, check out the🧰 Tools
🪛 LanguageTool
[style] ~10-~10: In American English, “you” and “have” do not usually form a contraction unless they’re followed by a past participle.
Context: ...rcebot to perform a specific task. Once you've setup Sourcebot, check out the guides b...(IVE_I_HAVE_AMERICAN_STYLE)
packages/backend/src/gerrit.ts (2)
98-98
: Replaceconsole.log
with structured logging
Switching tologger.error
is correct; consider passing the error object as metadata (e.g.,logger.error('Failed to fetch projects...', { err })
) to improve log queryability.
112-112
: Replace fallback console logging withlogger.error
This change aligns error reporting with the structured logging system. For consistency, you might pass the status as structured metadata:logger.error('Failed to fetch projects...', { status })
.packages/web/src/features/entitlements/server.ts (1)
28-30
: Consider graceful shutdown to ensure log flushing.While the structured logging implementation is correct, calling
process.exit(1)
immediately afterlogger.error()
may not allow sufficient time for log buffers to flush, potentially losing error logs.Consider implementing a graceful shutdown pattern:
- logger.error(`Failed to decode license key payload: ${error}`); - process.exit(1); + logger.error(`Failed to decode license key payload: ${error}`); + // Allow time for log flushing before exit + setTimeout(() => process.exit(1), 100);Alternatively, investigate if the logger package provides a synchronous error method or flush mechanism for critical errors.
Also applies to: 55-57
docs/docs/features/search/search-contexts.mdx (1)
18-18
: Documentation URL updated correctly, but minor style improvement needed.The URL update to
/docs/configuration/declarative-config
aligns with the documentation restructuring. However, consider simplifying "inside of" to "inside" for better style.-Search contexts are defined in the `context` object inside of a [declarative config](/docs/configuration/declarative-config). +Search contexts are defined in the `context` object inside a [declarative config](/docs/configuration/declarative-config).🧰 Tools
🪛 LanguageTool
[style] ~18-~18: This phrase is redundant. Consider using “inside”.
Context: ...xts are defined in thecontext
object inside of a [declarative config](/docs/configurat...(OUTSIDE_OF)
packages/backend/src/index.ts (2)
26-29
:❓ Verification inconclusive
Verify the exit code change for SIGTERM handling.
Similar to SIGINT, the exit code was changed from 143 to 0. Ensure this change is intentional and compatible with your orchestration platform expectations.
🏁 Script executed:
#!/bin/bash # Check if there are any process monitoring scripts or deployment configs that expect specific exit codes rg -A 3 -B 3 "143|SIGTERM" --type yaml --type json --type shLength of output: 62
Confirm SIGTERM exit code change
I ran
rg -A3 -B3 '143|SIGTERM' --type yaml --type json --type sh
and found no deployment or monitoring configs that expect exit code 143. Before merging, please manually verify that switching SIGTERM’s exit code from 143 to 0 is intentional and won’t conflict with your orchestration platform (e.g., health checks, restart policies).
21-24
:❓ Verification inconclusive
Verify the exit code change for SIGINT handling.
The exit code was changed from 130 to 0. While this might be intentional for cleaner shutdowns, verify that this aligns with your deployment and monitoring expectations.
🏁 Script executed:
#!/bin/bash # Check if there are any process monitoring scripts or deployment configs that expect specific exit codes rg -A 3 -B 3 "130|SIGINT" --type yaml --type json --type shLength of output: 61
🏁 Script executed:
#!/bin/bash # Search for any SIGINT references in TS/JS source rg -A3 -B3 "SIGINT" -g '*.ts' -g '*.js' # Find explicit uses of process.exit with code 130 rg -n "process.exit\s*\(\s*130\s*\)" -g '*.ts' -g '*.js' # Look for exit 130 in shell scripts rg -n "exit 130" -g '*.sh'Length of output: 523
SIGINT Exit Code Change Verified
I searched the repo for any references to exit code 130 or SIGINT handling and found none outside of the SIGINT handler itself:
- packages/backend/src/index.ts (lines 21–24):
process.on('SIGINT', () => { logger.info('Process interrupted (SIGINT)'); process.exit(0); });No scripts, configs (YAML/JSON), or other source files expect an exit code of 130. However, please double-check any external deployment or monitoring setups (e.g., systemd, Kubernetes liveness/readiness probes, CI/CD pipelines, PM2) to ensure they handle a 0 exit on SIGINT as intended.
.github/workflows/docs-broken-links.yml (1)
21-22
: Consider pinning the Mintlify CLI version
Locking the CLI to a specific version can help avoid unexpected breaking changes in the workflow.- - name: Install Mintlify CLI - run: npm i -g mintlify + - name: Install Mintlify CLI + run: npm i -g mintlify@<fixed-version>docs/docs/configuration/auth/overview.mdx (1)
19-19
: Fix verb usage and spelling in transactional emails note
Use “set up” instead of “setup” for the verb, and correct “configurating” to “configuring.”- You can setup emails to be sent when new join requests are created/approved by configurating [transactional emails](/docs/configuration/transactional-emails) + You can set up emails to be sent when new join requests are created/approved by configuring [transactional emails](/docs/configuration/transactional-emails)🧰 Tools
🪛 LanguageTool
[grammar] ~19-~19: The word “setup” is a noun. The verb is spelled with a space.
Context: ... and approved on registration. You can setup emails to be sent when new join request...(NOUN_VERB_CONFUSION)
packages/logger/tsconfig.json (1)
1-23
: TSConfig aligns with package requirements
The compiler options target ES2022 with strict type-checking and emit declaration maps. Consider adding"noUnusedLocals": true
and"noUnusedParameters": true
for stricter hygiene, but the current setup is solid.packages/mcp/src/index.ts (3)
12-14
: Group external logger import with other third-party imports
Reorder the import from@sourcebot/logger
alongside other external modules (e.g.,escape-string-regexp
,zod
) before your local imports to maintain a consistent import structure.- import { base64Decode, isServiceError } from './utils.js'; - import { createLogger } from "@sourcebot/logger"; + import { createLogger } from "@sourcebot/logger"; + import { base64Decode, isServiceError } from './utils.js';
81-81
: Use structured debug logging
Logging the full query at debug level is useful. Consider masking or truncating sensitive patterns to avoid leaking private data.
225-225
: Include error metadata in structured logs
Pass the caughterror
as metadata for better structure and stack trace capture:- logger.error('Failed to start MCP server:', error); + logger.error('Failed to start MCP server', { error });CHANGELOG.md (2)
20-20
: Fix grammar issues with "Checkout" usage.The word "Checkout" should be "Check out" when used as a verb. Static analysis has flagged this as a grammar issue.
Apply this diff to fix the grammar:
-Sourcebot V4 introduces authentication, performance improvements and code navigation. Checkout the [migration guide](https://docs.sourcebot.dev/docs/upgrade/v3-to-v4-guide) for information on upgrading your instance to v4. +Sourcebot V4 introduces authentication, performance improvements and code navigation. Check out the [migration guide](https://docs.sourcebot.dev/docs/upgrade/v3-to-v4-guide) for information on upgrading your instance to v4. -Added AI code review agent [#298](https://github.com/sourcebot-dev/sourcebot/pull/298). Checkout the [docs](https://docs.sourcebot.dev/docs/features/agents/review-agent) for more information. +Added AI code review agent [#298](https://github.com/sourcebot-dev/sourcebot/pull/298). Check out the [docs](https://docs.sourcebot.dev/docs/features/agents/review-agent) for more information. -Sourcebot v3 is here and brings a number of structural changes to the tool's foundation, including a SQL database, parallelized indexing, authentication support, multitenancy, and more. Checkout the [migration guide](https://docs.sourcebot.dev/docs/upgrade/v2-to-v3-guide) for information on upgrading your instance to v3. +Sourcebot v3 is here and brings a number of structural changes to the tool's foundation, including a SQL database, parallelized indexing, authentication support, multitenancy, and more. Check out the [migration guide](https://docs.sourcebot.dev/docs/upgrade/v2-to-v3-guide) for information on upgrading your instance to v3.Also applies to: 47-47, 116-116
🧰 Tools
🪛 LanguageTool
[grammar] ~20-~20: This sentence should probably be started with a verb instead of the noun ‘Checkout’. If not, consider inserting a comma for better clarity.
Context: ...mance improvements and code navigation. Checkout the [migration guide](https://docs.sour...(SENT_START_NN_DT)
127-127
: Fix article usage.Use "an" instead of "a" before "integrated" since it starts with a vowel sound.
Apply this diff:
- - connection management: create and manage your JSON configs via a integrated web-editor. + - connection management: create and manage your JSON configs via an integrated web-editor.🧰 Tools
🪛 LanguageTool
[misspelling] ~127-~127: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...create and manage your JSON configs via a integrated web-editor. - secrets: imp...(EN_A_VS_AN)
packages/web/src/features/agents/review-agent/nodes/githubPushPrReviews.ts (2)
31-32
: Retain original error context
Thelogger.error
call captures the error string for failures per file; consider passing the Error object as a structured field (e.g.,logger.error("Error pushing pr reviews", { filename: file_diff_review.filename, error })
) to preserve stack traces.
35-37
: Consistent error handling
Logging the error in the outer catch block vialogger.error(...)
is correct. As an enhancement, include contextual metadata (e.g., PR number or owner) to aid debugging.packages/web/src/initialize.ts (2)
79-80
: Log connection upsert events
logger.info
for each upserted connection correctly surfaces connection lifecycle events. Consider adding elapsed time or sync status details if needed for deeper insights.
231-233
: Watch config file changes
Emitting an info log when config changes triggers a re-sync is appropriate. For error resilience, you may want to catch and log failures ofsyncDeclarativeConfig
.packages/web/src/actions.ts (1)
53-57
: Preserve error context in service wrapper
Replacingconsole.error
withlogger.error(e)
ensures errors are logged. For richer context, consider logging a descriptive message along with the error object (e.g.,logger.error("Service wrapper error", e)
).docs/docs/configuration/structured-logging.mdx (2)
5-5
: Hyphenate compound adjective
Use a hyphen for "human-readable" to adhere to standard English compound-adjective rules.🧰 Tools
🪛 LanguageTool
[misspelling] ~5-~5: This word is normally spelled with a hyphen.
Context: ...ot will output logs to the console in a human readable format. If you'd like Sourcebot to outp...(EN_COMPOUNDS_HUMAN_READABLE)
31-36
: Correct ISO timestamp standard reference
The schema notes "ISO 8061"; the correct standard is ISO 8601. Please update the description accordingly.packages/logger/package.json (1)
12-18
: Consider using more restrictive version constraints for production stability.While the current version ranges allow for patch and minor updates, consider using more restrictive constraints for critical dependencies in a production environment to ensure consistency across deployments.
For enhanced stability, consider using exact versions or tilde ranges:
"dependencies": { - "@logtail/node": "^0.5.2", - "@logtail/winston": "^0.5.2", + "@logtail/node": "~0.5.2", + "@logtail/winston": "~0.5.2", "@t3-oss/env-core": "^0.12.0", - "dotenv": "^16.4.5", + "dotenv": "~16.4.5", "triple-beam": "^1.4.1", - "winston": "^3.15.0", + "winston": "~3.15.0", "zod": "^3.24.3" }packages/web/src/app/login/components/loginForm.tsx (1)
142-157
: Consider resetting loading state on error conditions.The current implementation sets
isLoading
to true but doesn't handle cases where the authentication fails or the user navigates away. While this may be acceptable for this use case (since successful auth redirects away), consider if error handling is needed.If error handling is needed, consider this pattern:
const ProviderButton = ({ name, logo, onClick, className, }: { name: string; logo: { src: string, className?: string } | null; onClick: () => void; className?: string; }) => { const [isLoading, setIsLoading] = useState(false); return ( <LoadingButton onClick={() => { setIsLoading(true); - onClick(); + try { + onClick(); + } catch (error) { + setIsLoading(false); + throw error; + } }} className={cn("w-full", className)} variant="outline" loading={isLoading} >packages/logger/src/env.ts (1)
5-6
: Consider using zod's built-in boolean coercion.The current boolean schema implementation is correct, but zod provides built-in boolean coercion that might be more idiomatic.
Consider this alternative approach:
-// Booleans are specified as 'true' or 'false' strings. -const booleanSchema = z.enum(["true", "false"]); +// Booleans are specified as 'true' or 'false' strings. +const booleanSchema = z.string().transform(val => val === 'true');This would automatically convert the string to a boolean, making the usage more natural in the rest of the codebase.
docs/docs/deployment-guide.mdx (1)
36-50
: Consider removing comments from JSON in bash echo command.JSON doesn't support comments natively, and while this might work in some contexts, it could cause parsing issues in strict JSON parsers.
Consider this approach:
echo '{ "$schema": "https://github.com/raw/sourcebot-dev/sourcebot/main/schemas/v3/index.json", "connections": { - // "starter-connection": { "type": "github", "repos": [ "sourcebot-dev/sourcebot" ] } } }' > config.json
docs/docs/configuration/environment-variables.mdx (2)
14-15
: Refine the “Checkout” phrasing.Starting sentences with “Checkout” can read awkwardly. Consider changing to “Check out” or “Refer to”:
- Checkout the [auth docs](/docs/configuration/auth/overview) for more info. + Check out the [auth docs](/docs/configuration/auth/overview) for more info.🧰 Tools
🪛 LanguageTool
[grammar] ~14-~14: This sentence should probably be started with a verb instead of the noun ‘Checkout’. If not, consider inserting a comma for better clarity.
Context: ...d at rest within the postgres database. Checkout the [auth docs](/docs/configuration/aut...(SENT_START_NN_DT)
[grammar] ~15-~15: This sentence should probably be started with a verb instead of the noun ‘Checkout’. If not, consider inserting a comma for better clarity.
Context: ...EMAIL_FROM_ADDRESS
must also be set. Checkout the [auth docs](/docs/configuration/aut...(SENT_START_NN_DT)
18-18
: Fix spelling of “declarative”.The word “declerative” is misspelled. Update for consistency:
- The container relative path to the declerative configuration file. + The container-relative path to the declarative configuration file.docs/docs/overview.mdx (2)
73-75
: Typo in repository indexing description.The word “exaclty” should be corrected:
- ...config format to specify exaclty what repositories to index... + ...config format to specify exactly what repositories to index...
156-156
: Refine “outside of” phrasing.For clarity, replace “run outside of the Sourcebot container” with “run outside the Sourcebot container”:
- services that run outside of the Sourcebot container + services that run outside the Sourcebot container🧰 Tools
🪛 LanguageTool
[style] ~156-~156: This phrase is redundant. Consider using “outside”.
Context: ...aged Redis / Postgres services that run outside of the Sourcebot container by providing th...(OUTSIDE_OF)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (8)
docs/images/bitbucket.png
is excluded by!**/*.png
docs/images/gerrit.png
is excluded by!**/*.png
docs/images/git.png
is excluded by!**/*.png
docs/images/gitea.png
is excluded by!**/*.png
docs/images/github.png
is excluded by!**/*.png
docs/images/gitlab.png
is excluded by!**/*.png
docs/images/local.png
is excluded by!**/*.png
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (96)
.github/workflows/docs-broken-links.yml
(1 hunks)CHANGELOG.md
(3 hunks)Dockerfile
(4 hunks)docs/development.mdx
(0 hunks)docs/docs.json
(5 hunks)docs/docs/configuration/auth/overview.mdx
(3 hunks)docs/docs/configuration/environment-variables.mdx
(1 hunks)docs/docs/configuration/structured-logging.mdx
(1 hunks)docs/docs/configuration/tenancy.mdx
(1 hunks)docs/docs/configuration/transactional-emails.mdx
(1 hunks)docs/docs/connections/bitbucket-cloud.mdx
(1 hunks)docs/docs/connections/bitbucket-data-center.mdx
(1 hunks)docs/docs/connections/generic-git-host.mdx
(1 hunks)docs/docs/connections/gerrit.mdx
(1 hunks)docs/docs/connections/gitea.mdx
(3 hunks)docs/docs/connections/github.mdx
(3 hunks)docs/docs/connections/gitlab.mdx
(3 hunks)docs/docs/connections/local-repos.mdx
(1 hunks)docs/docs/connections/overview.mdx
(1 hunks)docs/docs/connections/request-new.mdx
(1 hunks)docs/docs/deployment-guide.mdx
(1 hunks)docs/docs/features/agents/overview.mdx
(1 hunks)docs/docs/features/agents/review-agent.mdx
(1 hunks)docs/docs/features/code-navigation.mdx
(2 hunks)docs/docs/features/mcp-server.mdx
(6 hunks)docs/docs/features/search/search-contexts.mdx
(4 hunks)docs/docs/features/search/syntax-reference.mdx
(1 hunks)docs/docs/getting-started-selfhost.mdx
(0 hunks)docs/docs/getting-started.mdx
(0 hunks)docs/docs/license-key.mdx
(1 hunks)docs/docs/more/api-keys.mdx
(0 hunks)docs/docs/overview.mdx
(1 hunks)docs/docs/upgrade/v3-to-v4-guide.mdx
(4 hunks)docs/self-hosting/license-key.mdx
(0 hunks)docs/self-hosting/overview.mdx
(0 hunks)docs/snippets/bitbucket-app-password.mdx
(2 hunks)docs/snippets/bitbucket-token.mdx
(2 hunks)docs/snippets/license-key-required.mdx
(1 hunks)docs/snippets/schemas/v3/index.schema.mdx
(1 hunks)packages/backend/package.json
(1 hunks)packages/backend/src/bitbucket.ts
(2 hunks)packages/backend/src/connectionManager.ts
(2 hunks)packages/backend/src/env.ts
(0 hunks)packages/backend/src/gerrit.ts
(4 hunks)packages/backend/src/gitea.ts
(1 hunks)packages/backend/src/github.ts
(2 hunks)packages/backend/src/gitlab.ts
(1 hunks)packages/backend/src/index.ts
(2 hunks)packages/backend/src/instrument.ts
(2 hunks)packages/backend/src/logger.ts
(0 hunks)packages/backend/src/main.ts
(3 hunks)packages/backend/src/promClient.ts
(2 hunks)packages/backend/src/repoCompileUtils.ts
(2 hunks)packages/backend/src/repoManager.ts
(21 hunks)packages/backend/src/zoekt.ts
(1 hunks)packages/db/package.json
(1 hunks)packages/db/tools/scriptRunner.ts
(3 hunks)packages/db/tools/scripts/migrate-duplicate-connections.ts
(4 hunks)packages/db/tools/utils.ts
(1 hunks)packages/logger/.gitignore
(1 hunks)packages/logger/package.json
(1 hunks)packages/logger/src/env.ts
(1 hunks)packages/logger/src/index.ts
(1 hunks)packages/logger/tsconfig.json
(1 hunks)packages/mcp/README.md
(2 hunks)packages/mcp/package.json
(1 hunks)packages/mcp/src/client.ts
(1 hunks)packages/mcp/src/index.ts
(3 hunks)packages/schemas/src/v3/index.schema.ts
(1 hunks)packages/schemas/src/v3/index.type.ts
(1 hunks)packages/web/package.json
(1 hunks)packages/web/sentry.server.config.ts
(2 hunks)packages/web/src/actions.ts
(12 hunks)packages/web/src/app/[domain]/agents/page.tsx
(1 hunks)packages/web/src/app/[domain]/browse/components/bottomPanel.tsx
(1 hunks)packages/web/src/app/[domain]/settings/license/page.tsx
(1 hunks)packages/web/src/app/api/(server)/health/route.ts
(1 hunks)packages/web/src/app/api/(server)/stripe/route.ts
(4 hunks)packages/web/src/app/api/(server)/webhook/route.ts
(5 hunks)packages/web/src/app/login/components/loginForm.tsx
(4 hunks)packages/web/src/app/login/page.tsx
(2 hunks)packages/web/src/auth.ts
(3 hunks)packages/web/src/ee/features/billing/actions.ts
(2 hunks)packages/web/src/ee/features/searchContexts/syncSearchContexts.ts
(3 hunks)packages/web/src/env.mjs
(1 hunks)packages/web/src/features/agents/review-agent/app.ts
(3 hunks)packages/web/src/features/agents/review-agent/nodes/fetchFileContent.ts
(2 hunks)packages/web/src/features/agents/review-agent/nodes/generateDiffReviewPrompt.ts
(2 hunks)packages/web/src/features/agents/review-agent/nodes/generatePrReview.ts
(3 hunks)packages/web/src/features/agents/review-agent/nodes/githubPrParser.ts
(2 hunks)packages/web/src/features/agents/review-agent/nodes/githubPushPrReviews.ts
(2 hunks)packages/web/src/features/agents/review-agent/nodes/invokeDiffReviewLlm.ts
(2 hunks)packages/web/src/features/entitlements/server.ts
(3 hunks)packages/web/src/initialize.ts
(7 hunks)packages/web/src/lib/newsData.ts
(1 hunks)schemas/v3/index.json
(1 hunks)
💤 Files with no reviewable changes (8)
- packages/backend/src/env.ts
- docs/self-hosting/license-key.mdx
- packages/backend/src/logger.ts
- docs/docs/getting-started-selfhost.mdx
- docs/docs/getting-started.mdx
- docs/docs/more/api-keys.mdx
- docs/development.mdx
- docs/self-hosting/overview.mdx
🧰 Additional context used
🧬 Code Graph Analysis (31)
packages/backend/src/main.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/backend/src/gitea.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/src/auth.ts (3)
packages/web/src/lib/constants.ts (1)
SINGLE_TENANT_ORG_DOMAIN
(32-32)packages/web/src/lib/serviceError.ts (1)
ServiceErrorException
(16-20)packages/web/src/actions.ts (1)
createAccountRequest
(1451-1559)
packages/web/src/initialize.ts (3)
packages/logger/src/index.ts (1)
createLogger
(86-86)packages/web/src/lib/constants.ts (2)
SOURCEBOT_SUPPORT_EMAIL
(35-35)SINGLE_TENANT_ORG_DOMAIN
(32-32)packages/logger/src/env.ts (1)
env
(17-28)
packages/db/tools/utils.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/backend/src/instrument.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/backend/src/repoCompileUtils.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/sentry.server.config.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/backend/src/github.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/src/ee/features/billing/actions.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/src/ee/features/searchContexts/syncSearchContexts.ts (2)
packages/logger/src/index.ts (1)
createLogger
(86-86)packages/web/src/lib/constants.ts (1)
SOURCEBOT_SUPPORT_EMAIL
(35-35)
packages/db/tools/scriptRunner.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/backend/src/gerrit.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/src/app/login/page.tsx (2)
packages/logger/src/index.ts (1)
createLogger
(86-86)packages/web/src/auth.ts (1)
session
(242-251)
packages/backend/src/bitbucket.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/src/features/agents/review-agent/nodes/generateDiffReviewPrompt.ts (2)
packages/logger/src/index.ts (1)
createLogger
(86-86)packages/web/src/features/agents/review-agent/types.ts (2)
sourcebot_diff
(10-10)sourcebot_context
(36-36)
packages/backend/src/index.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/src/app/api/(server)/webhook/route.ts (3)
packages/logger/src/index.ts (1)
createLogger
(86-86)packages/backend/src/env.ts (1)
env
(22-53)packages/logger/src/env.ts (1)
env
(17-28)
packages/web/src/features/agents/review-agent/nodes/generatePrReview.ts (2)
packages/logger/src/index.ts (1)
createLogger
(86-86)packages/web/src/features/agents/review-agent/types.ts (2)
sourcebot_pr_payload
(29-29)sourcebot_file_diff_review
(49-49)
packages/backend/src/connectionManager.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/src/features/agents/review-agent/nodes/githubPrParser.ts (2)
packages/logger/src/index.ts (1)
createLogger
(86-86)packages/web/src/features/agents/review-agent/types.ts (3)
GitHubPullRequest
(4-4)sourcebot_pr_payload
(29-29)sourcebot_file_diff
(17-17)
packages/mcp/src/index.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/src/app/api/(server)/stripe/route.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/src/features/agents/review-agent/app.ts (2)
packages/logger/src/index.ts (1)
createLogger
(86-86)packages/logger/src/env.ts (1)
env
(17-28)
packages/backend/src/promClient.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/src/features/entitlements/server.ts (2)
packages/logger/src/index.ts (1)
createLogger
(86-86)packages/web/src/lib/constants.ts (1)
SOURCEBOT_SUPPORT_EMAIL
(35-35)
packages/db/tools/scripts/migrate-duplicate-connections.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/web/src/actions.ts (2)
packages/logger/src/index.ts (1)
createLogger
(86-86)packages/web/src/lib/constants.ts (1)
SOURCEBOT_SUPPORT_EMAIL
(35-35)
packages/web/src/app/api/(server)/health/route.ts (1)
packages/logger/src/index.ts (1)
createLogger
(86-86)
packages/logger/src/index.ts (1)
packages/logger/src/env.ts (1)
env
(17-28)
packages/web/src/app/login/components/loginForm.tsx (1)
packages/web/src/components/ui/loading-button.tsx (1)
LoadingButton
(30-30)
🪛 LanguageTool
docs/docs/configuration/auth/overview.mdx
[grammar] ~19-~19: The word “setup” is a noun. The verb is spelled with a space.
Context: ... and approved on registration. You can setup emails to be sent when new join request...
(NOUN_VERB_CONFUSION)
docs/docs/features/agents/overview.mdx
[style] ~10-~10: In American English, “you” and “have” do not usually form a contraction unless they’re followed by a past participle.
Context: ...rcebot to perform a specific task. Once you've setup Sourcebot, check out the guides b...
(IVE_I_HAVE_AMERICAN_STYLE)
docs/docs/features/search/search-contexts.mdx
[style] ~18-~18: This phrase is redundant. Consider using “inside”.
Context: ...xts are defined in the context
object inside of a [declarative config](/docs/configurat...
(OUTSIDE_OF)
docs/docs/connections/overview.mdx
[uncategorized] ~46-~46: Did you mean “its” (the possessive pronoun)?
Context: ...at is accessible to the container, with it's path specified in the CONFIG_FILE
env...
(ITS_PREMIUM)
CHANGELOG.md
[grammar] ~20-~20: This sentence should probably be started with a verb instead of the noun ‘Checkout’. If not, consider inserting a comma for better clarity.
Context: ...mance improvements and code navigation. Checkout the [migration guide](https://docs.sour...
(SENT_START_NN_DT)
[grammar] ~47-~47: This sentence should probably be started with a verb instead of the noun ‘Checkout’. If not, consider inserting a comma for better clarity.
Context: ....com//pull/298). Checkout the [docs](https://docs.sourcebot.dev/d...
(SENT_START_NN_DT)
[grammar] ~116-~116: This sentence should probably be started with a verb instead of the noun ‘Checkout’. If not, consider inserting a comma for better clarity.
Context: ...cation support, multitenancy, and more. Checkout the [migration guide](https://docs.sour...
(SENT_START_NN_DT)
[duplication] ~122-~122: Possible typo: you repeated a word.
Context: ...tool's color-palette in dark mode. ### Added - Added parallelized repo indexing and connecti...
(ENGLISH_WORD_REPEAT_RULE)
[misspelling] ~127-~127: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...create and manage your JSON configs via a integrated web-editor. - secrets: imp...
(EN_A_VS_AN)
docs/docs/configuration/structured-logging.mdx
[misspelling] ~5-~5: This word is normally spelled with a hyphen.
Context: ...ot will output logs to the console in a human readable format. If you'd like Sourcebot to outp...
(EN_COMPOUNDS_HUMAN_READABLE)
docs/docs/configuration/environment-variables.mdx
[grammar] ~14-~14: This sentence should probably be started with a verb instead of the noun ‘Checkout’. If not, consider inserting a comma for better clarity.
Context: ...d at rest within the postgres database. Checkout the [auth docs](/docs/configuration/aut...
(SENT_START_NN_DT)
[grammar] ~15-~15: This sentence should probably be started with a verb instead of the noun ‘Checkout’. If not, consider inserting a comma for better clarity.
Context: ... EMAIL_FROM_ADDRESS
must also be set. Checkout the [auth docs](/docs/configuration/aut...
(SENT_START_NN_DT)
docs/docs/overview.mdx
[style] ~156-~156: This phrase is redundant. Consider using “outside”.
Context: ...aged Redis / Postgres services that run outside of the Sourcebot container by providing th...
(OUTSIDE_OF)
🪛 Biome (1.9.4)
packages/logger/src/index.ts
[error] 24-24: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
🔇 Additional comments (174)
docs/docs/connections/gerrit.mdx (1)
4-4
: Add icon metadata for consistent UI representation.The new
icon: crow
frontmatter aligns this document with other connection types for consistent visual identification across the docs site.docs/docs/connections/generic-git-host.mdx (1)
3-3
: Add icon metadata for consistent UI representation.The new
icon: git-alt
frontmatter matches other connection docs and enhances visual navigation in the connections overview.packages/mcp/package.json (1)
21-21
: Include structured logger dependency.Adding
@sourcebot/logger
withworkspace:*
ensures this package uses the centralized logging implementation introduced in the monorepo.docs/docs/features/agents/review-agent.mdx (2)
13-13
: Update deployment link to new docs path.Link updated from
/self-hosting/overview
to/docs/deployment-guide
to reflect the consolidated documentation structure.
13-13
:✅ Verification successful
Verify that the new docs route exists.
Please ensure that the
deployment-guide
page exists and that the updated link resolves correctly after the URL restructure.
🏁 Script executed:
#!/bin/bash # Verify that the deployment guide exists in the docs directory rg -n "deployment-guide" docs/docs || echo "❌ deployment-guide not found in docs/docs"Length of output: 1033
🏁 Script executed:
#!/bin/bash # Check for docs file corresponding to the /docs/deployment-guide route find docs/docs -type f \( -iname 'deployment-guide.mdx' -o -path '*/deployment-guide/index.mdx' \)Length of output: 131
Deployment guide route verified
The filedocs/docs/deployment-guide.mdx
exists, so the/docs/deployment-guide
link resolves correctly.packages/backend/src/zoekt.ts (1)
8-8
: Replace local logger import with the shared logger.Switching to
@sourcebot/logger
centralizes logging and ensures structured, leveled logs across backend modules.packages/web/src/app/[domain]/agents/page.tsx (1)
12-12
: Documentation URL updated to new path
TheconfigureUrl
now correctly points to/docs/features/agents/review-agent
, matching the reorganized docs structure.docs/docs/features/search/syntax-reference.mdx (1)
35-35
: Search context link aligned with new docs structure
Thecontext:
keyword example now links to/docs/features/search/search-contexts
, consistent with the broader path updates in this PR.docs/docs/connections/request-new.mdx (1)
5-5
: Added icon metadata to frontmatter
Introducingicon: plus
aligns this page with other connection docs and enhances sidebar visuals.packages/logger/.gitignore (1)
1-2
: Ignore build artifacts in logger package
Excludingdist/
and*.tsbuildinfo
is essential to keep compiled outputs and build info out of version control.packages/web/src/app/[domain]/settings/license/page.tsx (1)
36-36
: Updated license docs link to new path
The anchor now correctly referenceshttps://docs.sourcebot.dev/docs/license-key
, reflecting the relocation of the license-key guide.packages/backend/package.json (1)
33-33
: Added central logger dependency
The new workspace dependency on@sourcebot/logger
correctly centralizes logging for the backend package.docs/snippets/license-key-required.mdx (1)
2-4
: Add license key requirement snippet for Enterprise feature
The<Note>
clearly informs users of the Enterprise license requirement and links to the new centralized license-key docs.packages/mcp/README.md (1)
5-5
: Updated docs badge to new features path
The documentation badge now correctly points to/docs/features/mcp-server
, aligning with the restructured documentation hierarchy.packages/db/package.json (1)
29-31
: Add runtime dependencies for CLI input and structured logging
readline-sync
(with its types) enables interactive CLI prompts.@sourcebot/logger
workspace dependency ensures centralized, structured logging for database operations.packages/backend/src/instrument.ts (1)
5-5
: Structured logger instantiation
Theinstrument
logger namespace is correctly created. Ensure this naming convention aligns with the logger package guidelines.packages/backend/src/repoCompileUtils.ts (2)
12-12
: Introduce structured logging via centralized logger
ImportingcreateLogger
from@sourcebot/logger
aligns this file with the new centralized logging approach. Ensure that this dependency is listed inpackages/backend/package.json
.
23-23
: Initialize logger with descriptive name
Instantiating the logger asrepo-compile-utils
follows the lowercase naming convention adopted across the codebase, which will aid in consistent log filtering.packages/web/src/app/[domain]/browse/components/bottomPanel.tsx (1)
21-21
: Update documentation URL for code navigation feature
The constantCODE_NAV_DOCS_URL
has been updated to the new/docs/features/code-navigation
path, reflecting the reorganized docs. Verify that this URL is live and the anchor resolves correctly to avoid broken links.docs/docs/configuration/transactional-emails.mdx (1)
10-10
: Update internal link to new auth overview path
The link to[email codes]
now points to/docs/configuration/auth/overview#email-codes
, matching the revamped docs structure. Please confirm that the#email-codes
anchor exists in theauth/overview.mdx
.packages/backend/src/gitea.ts (2)
5-5
: Adopt centralized logger import
ImportingcreateLogger
from@sourcebot/logger
standardizes logging across modules. Ensure this new dependency is declared inpackages/backend/package.json
.
12-12
: Initialize Gitea logger with consistent naming
UsingcreateLogger('gitea')
follows the lowercase naming scheme in other components, enabling easy filtering by source.packages/backend/src/github.ts (2)
3-3
: Switch to centralized logging
ImportingcreateLogger
from@sourcebot/logger
replaces the old local logger, aligning this module with the shared logging infrastructure. Confirm that@sourcebot/logger
is added topackages/backend/package.json
.
12-12
: Instantiate GitHub logger consistently
UsingcreateLogger('github')
adheres to the lowercase logger naming convention used across the backend services.packages/backend/src/bitbucket.ts (1)
5-5
: Ensure correct logger import and dependency inclusion
The import ofcreateLogger
from@sourcebot/logger
aligns with the new structured-logging package. Please verify that@sourcebot/logger
has been added topackages/backend/package.json
(or your workspace config) and that any old logger implementations (e.g.,src/logger.ts
) have been removed.packages/backend/src/gitlab.ts (1)
3-3
: Verify logger package import
You’ve switched tocreateLogger
from@sourcebot/logger
. Ensure that the legacypackages/backend/src/logger.ts
file has been deleted and that no lingering imports/reference remain.docs/docs/connections/bitbucket-cloud.mdx (1)
11-13
: Validate navigation link to Data Center docs
The new<Note>
guides users to Bitbucket Data Center docs:<Note> Looking for docs on Bitbucket Data Center? See [this doc](/docs/connections/bitbucket-data-center). </Note>Please confirm that the target page exists at
/docs/connections/bitbucket-data-center
and that your routing configuration will resolve it.packages/web/package.json (1)
77-77
: Ensure workspace dependency alignment.
Adding@sourcebot/logger
as a workspace dependency integrates the structured-logging package into the web project. Verify that your workspace installs and lockfile have been updated (e.g., runnpm install
orpnpm install
) so this dependency is correctly resolved.packages/backend/src/connectionManager.ts (2)
5-5
: Use centralized logger import.
Switching from a local logger to the sharedcreateLogger
import from@sourcebot/logger
centralizes logging across the backend. This aligns with the new structured-logging standard.
35-35
: Instantiate structured logger.
Initializingprivate logger = createLogger('connection-manager')
follows kebab-case naming conventions for log categories and ensures all log entries in this class are structured and leveled.packages/web/sentry.server.config.ts (3)
6-6
: Add centralized logger import.
ImportingcreateLogger
from@sourcebot/logger
correctly replaces direct use ofconsole
calls, preparing for structured output.
8-9
: Initialize module-specific logger.
Creating alogger
instance with the name'sentry-server-config'
adheres to the logging category convention and enables leveled log output from this module.
19-19
: Replaceconsole.debug
withlogger.debug
.
Switching tologger.debug
ensures that debug-level messages are captured by the structured-logging framework rather than silenced or fragmented.schemas/v3/index.json (1)
86-86
: Update documentation URL.
The description URL has been updated to/docs/features/search/search-contexts
, reflecting the reorganized documentation structure. This change is correct and consistent with other schema updates.packages/mcp/src/client.ts (2)
5-7
: Structured logging implementation looks good!The import and logger instantiation follow best practices with a clear context identifier
'mcp-client'
.
10-10
: Review logged request data for sensitive information.While the structured logging implementation is correct, consider whether the full request object should be logged, as it might contain sensitive data like API keys or user information.
Consider adding a sanitized version of the request for logging:
- logger.debug(`Executing search request: ${JSON.stringify(request, null, 2)}`); + logger.debug(`Executing search request`, { + query: request.query, + // other non-sensitive fields + });docs/docs/features/agents/overview.mdx (2)
6-8
: Good change from Note to Warning for experimental features.Using a Warning block appropriately signals to users that agents are experimental, which sets better expectations.
14-14
: URL path update aligns with documentation restructuring.The updated path
/docs/features/agents/review-agent
is consistent with the new documentation organization.docs/docs/upgrade/v3-to-v4-guide.mdx (1)
11-11
: Documentation URL updates look correct and consistent.All the URL path changes from
/self-hosting/
to/docs/
are systematic and align with the documentation restructuring. The updated paths maintain the same logical hierarchy and content organization.Also applies to: 25-25, 30-30, 39-39, 50-50, 54-54
docs/snippets/bitbucket-app-password.mdx (1)
3-3
: Documentation link updates are consistent with restructuring.The URL updates from
/self-hosting/
paths to/docs/
paths are correct and maintain the logical organization of the documentation.Also applies to: 30-30
packages/web/src/ee/features/searchContexts/syncSearchContexts.ts (2)
7-9
: Excellent structured logging implementation!The introduction of the logger with a descriptive namespace
'sync-search-contexts'
follows best practices for observability. This will enable better monitoring and debugging of search context operations.
19-19
: Appropriate logging levels chosen.Using
logger.error
for plan limitation issues andlogger.info
for operational activities like deletion is the correct approach. The error message includes helpful context for troubleshooting, and the info message provides good operational visibility.Also applies to: 107-107
packages/web/src/app/login/page.tsx (2)
6-8
: Clean logger setup for authentication tracking.The logger instance with namespace
'login-page'
is well-named and will provide good visibility into the authentication flow.
18-18
: Good authentication flow tracking.Using
logger.info
for both page load and session redirect events provides excellent observability into the user authentication journey. This will be valuable for monitoring and debugging authentication issues.Also applies to: 21-21
packages/web/src/ee/features/billing/actions.ts (2)
15-17
: Well-structured logging for critical billing operations.The logger instance
'billing-actions'
is appropriately named for this business-critical module. Structured logging will greatly improve monitoring and debugging of subscription creation issues.
104-104
: Appropriate error logging in exception handling.Using
logger.error(e)
in the catch block maintains the existing error handling behavior while providing better structured logging for billing failures. This is crucial for monitoring subscription creation issues.docs/snippets/schemas/v3/index.schema.mdx (1)
191-191
: Documentation URL update aligns with restructuring effort.The URL change from
/docs/search/search-contexts
to/docs/features/search/search-contexts
correctly reflects the documentation reorganization to consolidate feature-related content under the/docs/features/
hierarchy.packages/schemas/src/v3/index.type.ts (1)
19-19
: Updated documentation URL
The link to the search contexts documentation has been updated to the new/docs/features/search/search-contexts
path, aligning with the reorganized docs.docs/docs/connections/bitbucket-data-center.mdx (2)
4-4
: Addicon
metadata for UI consistency
Includingicon: Bitbucket
aligns this page’s frontmatter with other connection docs, improving navigation and visual consistency.
11-13
: Add note directing to Bitbucket Cloud docs
The<Note>
block clearly guides users to the Bitbucket Cloud page with the correct internal link.packages/backend/src/gerrit.ts (2)
3-3
: Switch to centralized logger import
Updating the import to pullcreateLogger
from@sourcebot/logger
ensures all backend services leverage the new structured logging package. Please verify that@sourcebot/logger
is declared as a dependency in this package.
36-36
: Instantiate structured logger instance
UsingcreateLogger('gerrit')
follows the lowercase naming convention and categorizes logs appropriately.docs/docs/features/code-navigation.mdx (3)
7-7
: Import reusable license key note component
AddingLicenseKeyRequired
reduces duplication and standardizes the license requirement message across feature docs.
9-9
: Embed license requirement note
Rendering<LicenseKeyRequired />
ensures the standardized notice appears consistently without manual duplication.
27-27
: Update link to search syntax reference
Correcting the path to/docs/features/search/syntax-reference
aligns with the new docs structure and prevents broken links.packages/backend/src/promClient.ts (3)
3-3
: Switch to structured logger import
ImportingcreateLogger
from@sourcebot/logger
aligns PromClient logging with the new centralized system. Please confirm that this dependency is included inpackage.json
.
5-5
: Instantiate logger for PromClient
UsingcreateLogger('prometheus-client')
ensures logs from this module are easily identifiable and consistent.
102-102
: Uselogger.info
instead ofconsole.log
Replacing the console call withlogger.info
ensures logs adhere to the configured structured format for both JSON and human-readable outputs.packages/db/tools/utils.ts (3)
2-4
: LGTM: Clean structured logging implementationThe logger import and initialization are properly implemented with a meaningful scope name ('db-utils'). This aligns well with the broader structured logging refactor across the codebase.
9-9
: Good replacement of console loggingThe direct console.log call has been properly replaced with structured logging while maintaining the same functionality and message.
14-17
: Well-designed abort utility functionThe new abort function provides a clean abstraction for logging and exiting, following the same pattern as the confirmAction function. This promotes code reusability and consistency.
packages/web/src/app/api/(server)/stripe/route.ts (3)
8-10
: Excellent logger setup for webhook contextThe logger is properly initialized with a descriptive scope ('stripe-webhook') that will be very helpful for filtering and debugging webhook-related logs in production.
58-58
: Consistent structured logging for subscription eventsThe console.log calls have been properly replaced with logger.info for all subscription status updates and unknown events. The log messages remain informative and will now benefit from structured logging capabilities.
Also applies to: 86-86, 102-102
109-109
: Proper error logging implementationThe console.error has been correctly replaced with logger.error, maintaining the same error context while enabling structured error logging.
packages/db/tools/scriptRunner.ts (3)
5-5
: Well-scoped logger for database script executionThe logger import and initialization with 'db-script-runner' scope provides clear context for these utility scripts, making log filtering and debugging more effective.
Also applies to: 20-20
24-24
: Proper error logging for invalid scriptsThe console.error replacement with logger.error maintains the same error handling while enabling structured error logging for script validation failures.
30-32
: Consistent informational loggingThe console.log calls have been systematically replaced with logger.info for confirmation details and completion messages, maintaining the same user experience while adding structured logging benefits.
Also applies to: 42-42
docs/snippets/bitbucket-token.mdx (1)
3-3
: Proper documentation URL updatesThe URL paths have been correctly updated from the old
/self-hosting/
structure to the new/docs/
organization. The new paths (/docs/configuration/declarative-config
and/docs/configuration/auth/overview
) follow a logical hierarchy and align with the broader documentation restructuring effort.Also applies to: 28-28
packages/web/src/env.mjs (1)
29-29
: Excellent formatting improvement for readability.The addition of blank lines between authentication provider groups significantly improves the readability and organization of the environment schema. This makes it easier to understand the different authentication configuration sections.
Also applies to: 33-33, 37-37, 40-40, 44-44, 48-48
packages/web/src/app/api/(server)/health/route.ts (1)
3-10
: Well-implemented structured logging migration.The refactoring successfully replaces console logging with structured logging while maintaining the same functionality. The logger context 'health-check' is descriptive and appropriate for this endpoint. The change from an anonymous arrow function to a named async function also improves code clarity.
packages/web/src/app/api/(server)/webhook/route.ts (2)
12-14
: Proper logger setup for GitHub webhook handling.The logger instance is correctly configured with an appropriate context 'github-webhook' that clearly identifies the source of log messages.
32-32
: Consistent and thorough logging migration.All console logging calls have been systematically replaced with appropriate structured logging methods:
console.warn
→logger.warn
for rate limiting warningsconsole.error
→logger.error
for initialization and processing errorsconsole.log
→logger.info
for informational messagesThe log message content remains unchanged, ensuring no loss of debugging information while gaining the benefits of structured logging.
Also applies to: 41-41, 59-59, 68-68, 73-73, 87-87, 92-92, 95-95
packages/web/src/features/agents/review-agent/app.ts (2)
9-9
: Proper logger integration for review agent.The logger is correctly imported and instantiated with an appropriate context 'review-agent' that clearly identifies log messages from this component.
Also applies to: 21-21
24-24
: Complete migration to structured logging.All console logging calls have been properly replaced with structured logging:
- Pull request processing information uses
logger.info
- Missing API key errors use
logger.error
- Log file path information uses
logger.info
The migration maintains all original log messages while providing the benefits of structured, contextual logging.
Also applies to: 27-27, 48-48
Dockerfile (2)
45-45
: LGTM! Proper integration of logger package in shared-libs-builder stage.The logger package is correctly added to the shared libraries builder stage following the established pattern used by other shared packages.
Also applies to: 51-51
94-94
: LGTM! Logger package correctly propagated to all dependent stages.The logger package is properly copied from the shared-libs-builder to all stages that need it (web-builder, backend-builder, and runner), ensuring availability throughout the build and runtime environments.
Also applies to: 134-134, 216-216
packages/web/src/features/entitlements/server.ts (2)
6-8
: LGTM! Proper structured logging setup.The import and logger instance creation follow the correct pattern for the new centralized logging system.
61-61
: LGTM! Appropriate use of info level logging.The migration from
console.info
tologger.info
correctly preserves the informational nature of this log message about falling back to the OSS plan.packages/web/src/features/agents/review-agent/nodes/generateDiffReviewPrompt.ts (2)
3-5
: LGTM! Proper structured logging setup with appropriate context.The import and logger instance creation correctly follow the established pattern. The logger context name 'generate-diff-review-prompt' is descriptive and matches the function being logged.
8-8
: LGTM! Appropriate use of debug level for execution tracing.The migration from
console.log
tologger.debug
correctly uses the debug level for function execution tracking logs, which is the appropriate log level for development and debugging purposes.Also applies to: 45-45
packages/backend/src/main.ts (3)
2-2
: LGTM! Correct migration to centralized logging package.The import has been properly updated from the local logger implementation to the new centralized
@sourcebot/logger
package.
17-17
: LGTM! Improved logger context naming.The logger context name has been updated from 'main' to 'backend-main', which is more descriptive and clearly identifies this as the backend's main module in log output.
59-59
: LGTM! Proper error logging migration.The replacement of
console.error(err)
withlogger.error(err)
correctly maintains the same error logging behavior while using the structured logging system.packages/web/src/features/agents/review-agent/nodes/fetchFileContent.ts (3)
7-9
: LGTM! Proper structured logging implementation.The logger is correctly initialized with an appropriate context name following kebab-case convention.
12-19
: Appropriate use of debug logging level.The debug logging for execution start and request data is well-placed and uses the appropriate log level for debugging information.
35-35
: Good completion logging.Using debug level for completion logging is appropriate and maintains consistency with the other debug logs in this function.
packages/web/src/auth.ts (3)
22-40
: Well-implemented logger initialization.The logger is properly initialized with a descriptive context name 'web-auth' that clearly identifies the authentication module.
208-209
: Appropriate error logging for JIT provisioning failures.Using logger.error for JIT provisioning failures is correct, and the error message includes helpful context (user ID and domain).
214-215
: Proper error logging for account request failures.The error logging for account request creation failures is appropriately placed and includes necessary context for debugging.
packages/db/tools/scripts/migrate-duplicate-connections.ts (4)
4-6
: Good logger implementation for migration script.The logger is properly initialized with a descriptive context name that clearly identifies this migration script.
21-21
: Appropriate info logging for duplicate count.Using logger.info to report the count of duplicate connections found is the correct log level for this informational message.
43-43
: Good progress logging during migration.The individual connection migration logging provides useful progress information at the appropriate info level.
53-53
: Proper completion logging.The final migration summary using logger.info is appropriate for this informational message about the completed operation.
docs/docs/features/search/search-contexts.mdx (3)
7-9
: Good use of reusable license component.Replacing the manual license note with the
<LicenseKeyRequired />
component improves consistency across documentation.
43-43
: Consistent URL update.The URL update for the config.json reference is consistent with the documentation restructuring.
107-107
: Correct syntax reference link update.The updated link to
/docs/features/search/syntax-reference
properly reflects the new documentation structure.packages/web/src/features/agents/review-agent/nodes/githubPrParser.ts (5)
5-7
: LGTM! Proper structured logging implementation.The logger setup follows best practices with a descriptive module name and proper instantiation.
10-10
: LGTM! Appropriate log level for function entry.Using
debug
level for function execution tracking is appropriate for operational visibility without cluttering production logs.
17-17
: LGTM! Proper error logging with context.The error logging maintains the original context while using the structured logger appropriately.
23-23
: LGTM! Good debug logging for conditional logic.The debug message provides valuable context about why files are being skipped, which aids in troubleshooting.
56-56
: LGTM! Consistent function completion logging.The completion debug log provides a clear boundary for function execution tracking.
packages/web/src/features/agents/review-agent/nodes/generatePrReview.ts (4)
5-7
: LGTM! Consistent logger implementation.The logger setup follows the same pattern as other modules with a descriptive name.
10-10
: LGTM! Appropriate debug logging for function entry.Using debug level for function execution tracking maintains consistency with the logging strategy.
38-38
: LGTM! Enhanced error logging with context.The error message includes the filename context, which is valuable for debugging issues with specific files during review generation.
50-50
: LGTM! Consistent completion logging.The debug log provides clear function execution boundaries for monitoring and debugging.
packages/backend/src/index.ts (4)
11-13
: LGTM! Proper logger setup for main entry point.The logger initialization follows the established pattern with an appropriate module identifier.
16-18
: LGTM! Improved process lifecycle logging.Using structured logging for process exit events provides better monitoring capabilities.
32-40
: LGTM! Proper error logging for exceptional cases.The structured logging for uncaught exceptions and unhandled rejections maintains the original error handling while improving log quality.
66-74
: LGTM! Enhanced application lifecycle logging.The structured logging provides better visibility into application startup and shutdown phases.
docs/docs/connections/github.mdx (3)
4-4
: LGTM! Icon addition enhances documentation metadata.Adding the GitHub icon to the frontmatter improves the documentation UI consistency.
115-115
:✅ Verification successful
Verify the updated documentation link path.
The link was updated from
/self-hosting/configuration/declarative-config
to/docs/configuration/declarative-config
. Please ensure this new path exists and is accessible.
🏁 Script executed:
#!/bin/bash # Check if the new documentation path exists fd "declarative-config" docs/ --type fLength of output: 85
Documentation link path verified
The path
/docs/configuration/declarative-config
correctly maps todocs/docs/configuration/declarative-config.mdx
. No updates are needed.
140-140
:✅ Verification successful
Verify the updated authentication documentation link.
The link was updated from
/self-hosting/configuration/authentication
to/docs/configuration/auth/overview
. Please ensure this new path exists and correctly points to the authentication overview.
🏁 Script executed:
#!/bin/bash # Check if the new authentication documentation path exists fd -p "auth.*overview" docs/ --type f fd -p "overview" docs/ --type f | rg authLength of output: 165
Authentication documentation link verified
The target file
docs/docs/configuration/auth/overview.mdx
exists, so the updated link is correct.
- Location:
docs/docs/connections/github.mdx
, line 140.github/workflows/docs-broken-links.yml (1)
1-27
: Workflow for broken links looks solid
This action correctly targets documentation changes underdocs/**
and uses the Mintlify CLI to validate links. The checkout and Node.js setup steps follow best practices.docs/docs/connections/gitlab.mdx (3)
4-4
: Verify frontmatter icon supports 'GitLab' key
Ensure thaticon: GitLab
matches one of the available icons in your theme’s icon library (e.g.,gitlab
).
120-120
: Confirm declarative config note is accurate
This note clarifies that environment variables only work in a declarative config. Please verify that the web UI truly does not support env vars here.
145-145
: Secrets support note looks good
This correctly informs users that secrets require authentication to be enabled.docs/docs/configuration/auth/overview.mdx (4)
2-2
: Title updated to "Overview"
Renaming the document and sidebar title to “Overview” helps consolidate the authentication docs under a clear entry point.
7-8
: Clarification on first-user ownership moved up
Repositioning the owner-approval note directly under the introduction improves discoverability for new users.
16-17
: Enterprise license JIT provisioning info
Adding the enterprise license link and JIT provisioning instructions here is helpful for enterprise deployments.
43-44
: Authentication warning reposition
Moving theAUTH_URL
warning before the Enterprise Providers section better highlights its importance for deployments behind a domain.packages/mcp/src/index.ts (2)
14-14
: Initialize structured logger
Creating a namespaced logger formcp-server
ensures all logs are identifiable and supports dynamic log levels.
221-221
: Log server readiness
Switching fromconsole.error
tologger.info
is correct for an informational event. Ensure your logging configuration captures this at the appropriate level.CHANGELOG.md (1)
20-20
: LGTM! Documentation URL updates are consistent.The systematic update from
/self-hosting/
to/docs/
paths across all changelog entries is well-executed and maintains consistency in the documentation structure.Also applies to: 25-25, 28-28, 32-32, 47-47, 116-116, 119-119, 123-123, 125-125, 126-126, 129-129
🧰 Tools
🪛 LanguageTool
[grammar] ~20-~20: This sentence should probably be started with a verb instead of the noun ‘Checkout’. If not, consider inserting a comma for better clarity.
Context: ...mance improvements and code navigation. Checkout the [migration guide](https://docs.sour...(SENT_START_NN_DT)
docs/docs/connections/gitea.mdx (2)
4-4
: Good addition of icon metadata.Adding the "mug-tea" icon provides better visual consistency for the Gitea connection documentation.
86-86
: LGTM! Documentation links properly updated.The URL updates from
/self-hosting/
to/docs/
paths are consistent with the broader documentation restructuring and point to the correct new locations.Also applies to: 111-111
packages/web/src/features/agents/review-agent/nodes/invokeDiffReviewLlm.ts (2)
5-7
: Excellent structured logging implementation.The import and logger creation are properly implemented with a meaningful scope name that identifies the specific function.
10-10
: LGTM! Consistent logger usage throughout the function.All console calls have been properly replaced with appropriate logger methods:
logger.debug()
for informational messageslogger.error()
for error conditionsThe logging levels are appropriately chosen and the migration maintains the same information being logged.
Also applies to: 13-13, 45-45, 48-48
packages/web/src/lib/newsData.ts (2)
4-9
: Good addition of structured logging news item.The new news item properly announces the structured logging feature with appropriate header, sub-header, and documentation link that aligns with the PR's purpose.
14-14
: LGTM! News item URLs updated consistently.The URL updates for existing news items correctly reflect the documentation restructuring from
/self-hosting/
and/docs/search/
to the new/docs/features/
and/docs/configuration/
paths.Also applies to: 20-20, 26-26
packages/web/src/features/agents/review-agent/nodes/githubPushPrReviews.ts (3)
3-5
: Use structured logger import and initialization correctly
The newcreateLogger
import and initialization of thelogger
instance are correct and consistent.
8-9
: Structured info log for function start
Usinglogger.info("Executing github_push_pr_reviews")
to mark the start of the operation is clear and helpful.
39-40
: Log completion of operation
The finallogger.info("Completed github_push_pr_reviews")
provides a clear end marker for the process, useful for metrics and observability.packages/web/src/initialize.ts (6)
18-21
: Initialize structured logger
Importing and initializing the structuredlogger
for the'web-initialize'
context ensures that all subsequent logs are captured consistently.
109-111
: Log deletion of removed connections
Usinglogger.info
to record deleted connections is clear and matches the logging strategy used above.
147-150
: Handle public-access entitlement errors
logger.error
clearly indicates a missing entitlement before exiting. This matches error-handling patterns and provides actionable guidance.
152-154
: Log public-access status change
Recording the toggle of public-access status is useful for auditing; logged values are explicit and concise.
183-186
: Prune old guest user logging
logger.info
reports deletion of outdated guest users; helpful for audit trails.
241-245
: Multi-tenancy entitlement error
logger.error
correctly reports missing multi-tenancy entitlement before exiting; message is clear and consistent with the single-tenancy case.docs/docs/features/mcp-server.mdx (4)
12-23
: Add API key step for MCP server authentication
The new “Create an API key” step is a clear and necessary addition. The instructions and screenshot enhance usability.
46-48
: IncludeSOURCEBOT_API_KEY
in MCP client snippets
The example JSON configs for Cursor, Windsurf, and VS Code correctly addSOURCEBOT_API_KEY
. This ensures authentication is explicit and consistent across clients.Also applies to: 70-72, 95-97
112-113
: Update shell command for Claude Code
Including-e SOURCEBOT_API_KEY
in theclaude mcp add
command is accurate and aligns with other examples.
129-131
: Update JSON snippet for Claude Desktop
Adding the API key environment variable in the Claude Desktop config is correct.packages/web/src/actions.ts (6)
36-43
: Initialize structured logger for web actions
The newcreateLogger
import andlogger
instantiation for'web-actions'
are correctly placed at the top and will centralize logs for action handlers.
101-104
: Approve public-access entitlement log
The message for unsupported public-access entitlement is informative and poses no security concerns.
1462-1468
: Approve non-PII user-id warning
LogginguserId
for skipping account-request creation is acceptable, as it's an internal identifier.
1490-1495
: Approve non-PII user-id duplicate-request warning
Again, logging only the internaluserId
for existing requests is safe and useful.
1520-1523
: Approve owner lookup failure log
Logging theorg.id
anduserId
when the owner lookup fails is appropriate and does not expose PII.
1551-1553
: Approve missing-SMTP warning without PII
This warning does not contain sensitive data and clearly indicates why emails are skipped.packages/logger/package.json (1)
1-24
: LGTM! Well-structured logger package configuration.The package configuration looks solid with appropriate dependencies for a centralized logging solution. The combination of winston for core logging, logtail for remote logging, and proper TypeScript support provides a robust foundation.
docs/docs/license-key.mdx (2)
1-43
: Excellent documentation structure and content!The license key documentation is well-organized, informative, and provides clear instructions for users. The feature comparison table effectively communicates the value proposition of licensed features.
7-7
:✅ Verification successful
Verify external contact links are accessible and current.
Ensure that the contact links (https://www.sourcebot.dev/contact) are accessible and lead to the correct contact forms.
Also applies to: 43-43
🏁 Script executed:
#!/bin/bash # Description: Verify that external contact URLs are accessible and return valid responses echo "Checking contact page accessibility..." curl -s -o /dev/null -w "%{http_code}" "https://www.sourcebot.dev/contact" echo "Checking pricing page accessibility..." curl -s -o /dev/null -w "%{http_code}" "https://www.sourcebot.dev/pricing"Length of output: 330
External Contact Links Accessible and Current
Both
https://www.sourcebot.dev/contact
andhttps://www.sourcebot.dev/pricing
return HTTP 200, confirming they’re reachable and up-to-date. No changes required.packages/web/src/app/login/components/loginForm.tsx (3)
5-5
: Good addition of loading state management imports.The addition of
useState
andLoadingButton
imports properly supports the new loading functionality.Also applies to: 16-16
30-33
: Minor formatting improvement in signIn call.The formatting changes to the
signIn
call improve readability without affecting functionality.
142-157
: Excellent UX improvement with loading state management.The addition of loading state to the
ProviderButton
provides valuable user feedback during authentication flows. The implementation correctly:
- Manages loading state with
useState
- Sets loading to true before invoking the callback
- Passes the loading state to the
LoadingButton
componentpackages/backend/src/repoManager.ts (3)
3-3
: Excellent migration to centralized logging system.The change from local logger import to the centralized
@sourcebot/logger
package and creation of a module-level logger instance with a descriptive label ('repo-manager') follows logging best practices.Also applies to: 31-31
117-117
: Consistent logging implementation throughout the class.All logging calls have been systematically updated to use the centralized logger instance. The logging maintains appropriate levels (info, error, debug) and provides meaningful context for operations like repository indexing, garbage collection, and error handling.
Also applies to: 122-122, 232-232, 237-237, 240-240, 245-245, 248-248, 267-267, 272-272, 282-282, 285-285, 289-289, 300-300, 332-332, 337-337, 344-344, 360-360, 400-400, 429-429, 452-452, 462-462, 478-478, 487-487, 493-493, 505-505, 540-540
180-180
: Proper logger parameter passing to utility functions.The logger parameter is correctly passed to
getTokenFromConfig
calls, ensuring consistent logging throughout the authentication flow for different connection types (GitHub, GitLab, Gitea, Bitbucket).Also applies to: 190-190, 201-201, 211-211
docs/docs/connections/overview.mdx (1)
9-75
: Excellent documentation restructuring with comprehensive examples.The new documentation structure provides clear, comprehensive guidance for configuring connections. The JSON configuration examples are well-structured and include helpful comments. The addition of schema references, getting started section, and detailed explanations significantly improves the user experience.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~46-~46: Did you mean “its” (the possessive pronoun)?
Context: ...at is accessible to the container, with it's path specified in theCONFIG_FILE
env...(ITS_PREMIUM)
packages/logger/src/env.ts (2)
8-15
: Good dotenv configuration with proper override behavior.The configuration correctly loads
.env
first, then.env.local
with override enabled, which is the standard pattern for environment configuration.
17-28
: Well-structured environment schema with comprehensive logging options.The environment schema covers all necessary logging configurations including log levels, structured logging options, file output, and Logtail integration. The validation skip option and empty string handling are appropriate.
packages/logger/src/index.ts (3)
7-17
: Excellent documentation explaining the dual logging formats.The JSDoc comment clearly explains the behavior differences between structured and human-readable logging modes, which will be very helpful for developers.
35-41
: Well-designed human-readable format with proper error handling.The printf format function correctly handles both regular messages and error stack traces, providing a clean, readable output format for development.
43-83
: Robust logger factory with dynamic transport configuration.The
createLogger
function is well-designed with:
- Proper environment-based configuration
- Dynamic transport selection based on available credentials
- Consistent formatting across transports
- Support for multiple output destinations
docs/docs/deployment-guide.mdx (1)
7-101
: Comprehensive and well-structured deployment guide.The deployment guide is excellent with:
- Clear step-by-step instructions
- Embedded video walkthrough
- Helpful accordion with command details
- Good use of MDX components (Steps, Cards, etc.)
- Appropriate next steps and references
This significantly improves the user onboarding experience.
docs/docs.json (8)
3-3
: Theme update to “willow” is appropriate.Switching from “mint” to “willow” aligns with the new visual style. Confirm that the new theme exists and is properly loaded by the site generator.
18-18
: Added icon for the “Docs” anchor.Including
"icon": "books"
improves navigational clarity. Ensure that the icon name matches an available icon in the theme.
21-29
: Navigation: renamed “General” to “Getting Started” and introduced “Features” group.The restructure groups initial setup pages under “Getting Started” and surface product capabilities under “Features,” which should improve discoverability.
30-47
: Nested feature pages structure added.You’ve created subgroups for “Search” and “Agents” and included relevant pages. Please verify that all referenced paths (e.g.,
docs/features/search/syntax-reference.mdx
,docs/features/agents/overview.mdx
) actually exist in the repository.
50-79
: Configuration group expanded with new structured-logging page.Great to see structured logging docs added. Ensure that
docs/docs/configuration/structured-logging.mdx
is committed and reachable via the new navigation entry.
109-111
: Updated navbar primary button to “GitHub”.Linking directly to the GitHub repo is more intuitive than “Sourcebot Cloud.” Confirm the URL is correct.
115-119
: Expanded footer social links.Adding Twitter, Discord, and LinkedIn alongside GitHub improves community engagement avenues. Verify each link resolves properly.
128-128
: Relaxed appearance strict mode.Setting
"strict": false
allows more flexible theming; this change should be intentional and tested across light/dark modes.docs/docs/configuration/environment-variables.mdx (1)
7-7
: Added wide mode and deployment-guide recommendation.The new frontmatter
mode: "wide"
and directing users to/docs/deployment-guide
in the note are clear improvements for onboarding.docs/docs/overview.mdx (1)
5-15
: Strong new introduction and “Why Sourcebot?” section.The rewritten overview, feature highlights, and accordions provide a compelling entry point for users. The embedded videos and concise bullet points improve engagement.
https://docs.sourcebot.dev/docs/configuration/structured-logging