Skip to content

Conversation

@ikarakayali
Copy link
Contributor

@ikarakayali ikarakayali commented Dec 2, 2025

Summary by Sourcery

Add configurable API domain support and normalize Docker usage configuration across workflow commands.

Bug Fixes:

  • Ensure the USE_DOCKER configuration is interpreted as a boolean when provided as either a boolean or a string value in all relevant commands.

Enhancements:

  • Introduce API_DOMAIN configuration with a default value and pass it through to workflow API calls instead of using a hard-coded domain.

@coderabbitai
Copy link

coderabbitai bot commented Dec 2, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch f/ApiDomainConfig

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @ikarakayali, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the application's configuration capabilities by introducing a configurable API domain, moving away from a hardcoded value. This change improves the system's adaptability across different environments. Additionally, it refines the handling of the USE_DOCKER setting to ensure consistent and robust interpretation of its value, whether it's a boolean or a string representation of 'true'.

Highlights

  • API Domain Configuration: Introduced a new API_DOMAIN configuration option, allowing the API domain to be dynamically configured instead of being hardcoded.
  • Flexible API Calls: Updated postWorkflow and activateWorkflow functions to accept the domain as a parameter, enabling more flexible API interactions.
  • Robust Docker Usage Flag: Improved the parsing of the USE_DOCKER configuration value to correctly interpret both boolean true and string 'true'.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sourcery-ai
Copy link

sourcery-ai bot commented Dec 2, 2025

Reviewer's Guide

Adds configurable API domain support and normalizes USE_DOCKER handling across commands, wiring the domain through workflow API calls and extending default config.

Sequence diagram for workflow sync with configurable API domain

sequenceDiagram
  actor Developer
  participant CLI as syncCommand
  participant Config as config
  participant Workflow as processWorkflow
  participant API as postWorkflow
  participant Activator as activateWorkflow

  Developer->>CLI: run sync
  CLI->>Config: get API_BASE_URL, API_VERSION, API_DOMAIN
  Config-->>CLI: apiConfig { baseUrl, version, domain }
  CLI->>Workflow: processWorkflow(jsonPath, dbConfig, apiConfig)

  Workflow->>API: postWorkflow(baseUrl, version, domain, flow, data)
  API-->>Workflow: postResult { id }

  Workflow->>Activator: activateWorkflow(baseUrl, version, domain, flow, instanceId, workflowVersion)
  Activator-->>Workflow: activationResult

  Workflow-->>CLI: { key, version, instanceId }
  CLI-->>Developer: sync completed
Loading

Class diagram for config handling and workflow API calls

classDiagram
  class ConfigStore {
    +AUTO_DISCOVER : boolean
    +API_BASE_URL : string
    +API_VERSION : string
    +API_DOMAIN : string
    +DB_HOST : string
    +DB_PORT : number
    +DB_NAME : string
    +DB_USER : string
    +DB_PASSWORD : string
    +USE_DOCKER : boolean|string
    +DOCKER_POSTGRES_CONTAINER : string
    +get(key)
  }

  class DbConfig {
    +host : string
    +port : number
    +database : string
    +user : string
    +password : string
    +useDocker : boolean
    +dockerContainer : string
  }

  class ApiConfig {
    +baseUrl : string
    +version : string
    +domain : string
  }

  class SyncCommand {
    +syncCommand()
  }

  class ResetCommand {
    +resetCommand(options)
  }

  class UpdateCommand {
    +updateCommand(options)
  }

  class CheckCommand {
    +checkCommand()
  }

  class WorkflowLib {
    +processWorkflow(jsonPath, dbConfig, apiConfig)
  }

  class ApiLib {
    +testApiConnection(baseUrl)
    +postWorkflow(baseUrl, version, domain, flow, data)
    +activateWorkflow(baseUrl, version, domain, flow, instanceId, workflowVersion)
  }

  ConfigStore <.. SyncCommand : uses
  ConfigStore <.. ResetCommand : uses
  ConfigStore <.. UpdateCommand : uses
  ConfigStore <.. CheckCommand : uses

  SyncCommand --> DbConfig : builds
  SyncCommand --> ApiConfig : builds
  ResetCommand --> DbConfig : builds
  ResetCommand --> ApiConfig : builds
  UpdateCommand --> DbConfig : builds
  UpdateCommand --> ApiConfig : builds
  CheckCommand --> DbConfig : builds

  SyncCommand --> WorkflowLib : calls processWorkflow
  ResetCommand --> WorkflowLib : calls processWorkflow
  UpdateCommand --> WorkflowLib : calls processWorkflow

  WorkflowLib --> ApiLib : calls postWorkflow
  WorkflowLib --> ApiLib : calls activateWorkflow

  DbConfig --> ConfigStore : derives useDocker from USE_DOCKER
  ApiConfig --> ConfigStore : reads API_BASE_URL, API_VERSION, API_DOMAIN
Loading

File-Level Changes

Change Details Files
Make USE_DOCKER config robust by treating both boolean true and string 'true' as enabled across commands and DB checks.
  • Introduce a local useDockerValue variable in sync, reset, update, and check commands.
  • Set dbConfig/useDocker and testDbConnection/useDocker based on a boolean expression checking for true or 'true' instead of passing the raw config value.
src/commands/sync.js
src/commands/reset.js
src/commands/update.js
src/commands/check.js
Add configurable API domain and propagate it through workflow-related API calls instead of hard-coding the domain.
  • Extend apiConfig to include a domain taken from API_DOMAIN config in sync, reset, update, and workflow processing.
  • Update postWorkflow and activateWorkflow signatures to accept a domain parameter and remove the hard-coded 'core' domain.
  • Adjust all call sites (sync, workflow) to pass apiConfig.domain into postWorkflow and activateWorkflow.
  • Add API_DOMAIN with default value 'core' to the configuration defaults.
src/commands/sync.js
src/commands/reset.js
src/commands/update.js
src/lib/workflow.js
src/lib/api.js
src/lib/config.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • The USE_DOCKER normalization logic (useDockerValue === true || useDockerValue === 'true') is duplicated across multiple commands; consider extracting a small helper or normalizing this once in the config layer to avoid repetition and keep the boolean parsing consistent.
  • Now that API_DOMAIN is part of the configuration and passed through multiple layers, it may be worth centralizing URL construction (e.g., a helper that builds the full workflow URL from baseUrl, version, and domain) to reduce the risk of future inconsistencies in API endpoint paths.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `USE_DOCKER` normalization logic (`useDockerValue === true || useDockerValue === 'true'`) is duplicated across multiple commands; consider extracting a small helper or normalizing this once in the config layer to avoid repetition and keep the boolean parsing consistent.
- Now that `API_DOMAIN` is part of the configuration and passed through multiple layers, it may be worth centralizing URL construction (e.g., a helper that builds the full workflow URL from `baseUrl`, `version`, and `domain`) to reduce the risk of future inconsistencies in API endpoint paths.

## Individual Comments

### Comment 1
<location> `src/commands/sync.js:32-39` </location>
<code_context>
   // DB kontrolü
   let dbSpinner = ora('Veritabanı kontrolü...').start();
   try {
+    const useDockerValue = config.get('USE_DOCKER');
     const isDbOk = await testDbConnection({
       host: config.get('DB_HOST'),
       port: config.get('DB_PORT'),
       database: config.get('DB_NAME'),
       user: config.get('DB_USER'),
       password: config.get('DB_PASSWORD'),
-      useDocker: config.get('USE_DOCKER'),
+      useDocker: useDockerValue === true || useDockerValue === 'true',
       dockerContainer: config.get('DOCKER_POSTGRES_CONTAINER')
     });
</code_context>

<issue_to_address>
**suggestion:** Normalize USE_DOCKER in a shared helper instead of repeating logic across commands.

This normalization (`value === true || value === 'true'`) now appears in `sync.js`, `reset.js`, `update.js`, and `check.js`. Consider moving it into a shared helper (e.g., in `config.js` or a `getUseDockerFlag()` function) so the interpretation of `USE_DOCKER` is defined in one place.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +32 to +39
const useDockerValue = config.get('USE_DOCKER');
const dbConfig = {
host: config.get('DB_HOST'),
port: config.get('DB_PORT'),
database: config.get('DB_NAME'),
user: config.get('DB_USER'),
password: config.get('DB_PASSWORD'),
useDocker: config.get('USE_DOCKER'),
useDocker: useDockerValue === true || useDockerValue === 'true',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Normalize USE_DOCKER in a shared helper instead of repeating logic across commands.

This normalization (value === true || value === 'true') now appears in sync.js, reset.js, update.js, and check.js. Consider moving it into a shared helper (e.g., in config.js or a getUseDockerFlag() function) so the interpretation of USE_DOCKER is defined in one place.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a configuration for the API domain, which is a great improvement for flexibility. The implementation is solid, correctly propagating the new API_DOMAIN config value through the different layers of the application.

I've also noticed a change to handle both boolean and string values for the USE_DOCKER configuration. While this is a good defensive measure, the implementation is duplicated across four different files (check.js, reset.js, sync.js, update.js). I've left a comment with a suggestion to simplify the logic and centralize it to improve code maintainability.

user: config.get('DB_USER'),
password: config.get('DB_PASSWORD'),
useDocker: config.get('USE_DOCKER'),
useDocker: useDockerValue === true || useDockerValue === 'true',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This check for a boolean or string 'true' can be simplified. By performing the conversion inline, you can also remove the temporary useDockerValue variable. This same pattern is repeated in reset.js, sync.js, and update.js. Consider refactoring this logic into a shared utility function to improve maintainability and avoid code duplication.

Suggested change
useDocker: useDockerValue === true || useDockerValue === 'true',
useDocker: String(config.get('USE_DOCKER')) === 'true',

@ikarakayali ikarakayali merged commit 45d9696 into release-v1.0 Dec 9, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants