Skip to content

v1.0.3#9

Merged
yilmaztayfun merged 5 commits intorelease-v1.0from
master
Feb 24, 2026
Merged

v1.0.3#9
yilmaztayfun merged 5 commits intorelease-v1.0from
master

Conversation

@yilmaztayfun
Copy link
Copy Markdown
Contributor

@yilmaztayfun yilmaztayfun commented Feb 23, 2026

Summary by Sourcery

Add multidomain configuration support to the CLI and migrate existing single-domain configs to a new domain-aware format.

New Features:

  • Introduce domain-aware configuration with an ACTIVE_DOMAIN and per-domain settings stored under DOMAINS.
  • Add CLI domain management commands (wf domain) to list, add, use, and remove domains, including option-based domain configuration.
  • Expose helpers in the config library for managing domains and retrieving the active domain configuration.

Enhancements:

  • Update config get/set behavior to operate on the active domain and prevent direct modification of reserved keys like PROJECT_ROOT, DOMAIN_NAME, and ACTIVE_DOMAIN.
  • Improve config and domain-related CLI output, including active domain display, applied settings summaries, and usage hints.
  • Clarify and Anglicize CLI command descriptions and comments for API, DB, and workflow operations.

Documentation:

  • Extend README with multidomain usage documentation, domain command reference, config file domain-aware format description, and migration details from the old flat config format.
  • Document the new domain.js command module in the project structure overview.

yilmaztayfun and others added 5 commits December 16, 2025 01:18
…nagement

Closes #7

This change introduces a structured multidomain configuration model
to eliminate manual environment switching and reduce operational risk
during domain transitions.

Previously, switching domains required manual updates to critical
runtime parameters such as API_BASE_URL and DB_NAME. This approach
was error-prone and operationally inefficient. The new implementation
provides centralized, domain-scoped configuration management with
automatic activation and backward compatibility.

Architectural Enhancements

Config Layer Refactor (src/lib/config.js)
- Transitioned from a flat configuration model to a structured
  ACTIVE_DOMAIN + DOMAINS[] architecture
- Implemented automatic migration from legacy single-domain format
- Updated get/set operations to resolve against the active domain context
- Introduced domain lifecycle management methods:
  - addDomain()
  - useDomain()
  - listDomains()
  - removeDomain()
- Enhanced clear() to safely reset to the default domain
- Preserved full backward compatibility for existing installations

CLI Capabilities (src/commands/domain.js)
- Added a dedicated `domain` command namespace with:
  - active      → displays current active domain
  - list        → enumerates configured domains
  - add         → registers a new domain (inherits missing defaults)
  - use         → switches active domain and applies configuration atomically
  - remove      → removes a domain (default domain protected)

Config Command Improvements (src/commands/config.js)
- Enriched `config get` output with active domain visibility
- Filtered internal metadata fields from user-facing output

CLI Registration (bin/workflow.js)
- Fully registered domain command with complete option definitions
  and contextual help messaging

Documentation Updates (README.md)
- Added comprehensive “Multidomain Support” section
- Documented migration behavior and backward compatibility guarantees
- Updated configuration file schema documentation
- Added usage examples and workflow scenarios
- Reflected structural changes in project layout

Impact
- Reduces configuration-related operational errors
- Improves environment isolation and runtime consistency
- Enables scalable multi-environment workflows
- Maintains backward compatibility with zero-breaking changes
Address code review findings from #7 to improve robustness and safety:

- Use conf API (config.delete/config.set/config.clear) instead of
  directly replacing config.store in migrateConfig() and clear(),
  avoiding bypass of conf internals (schema, encryption, migrations)

- Replace generic parseValue() with key-aware coerceValue() that only
  converts known numeric keys (DB_PORT) to number and known boolean
  keys (AUTO_DISCOVER, USE_DOCKER, DEBUG_MODE) to boolean, preventing
  unintended type coercion on values like DB_PASSWORD=1234

- Protect reserved keys (PROJECT_ROOT, DOMAIN_NAME, ACTIVE_DOMAIN) in
  set() by throwing an error instead of silently succeeding, ensuring
  active-domain lookup remains consistent

- Add try/catch in configCommand for set action so reserved key errors
  are displayed cleanly instead of crashing

- Use Commander's Argument.choices() for domain action validation,
  providing automatic error messages for invalid actions

- Expand README migration example to show all 11 default config keys
  instead of only 2, giving readers the full picture of the migration

Closes #7
Address PR review feedback requesting English help descriptions.
Translated all CLI --help descriptions, options, and examples in
workflow.js to English for consistency. Also translated Turkish
JSDoc and inline comments in api.js and db.js (comment-only changes).

Co-authored-by: Cursor <cursoragent@cursor.com>
…switching-for-multidomain-runtime-usage

feat(config): introduce enterprise-grade multidomain configuration management
@yilmaztayfun yilmaztayfun self-assigned this Feb 23, 2026
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Feb 23, 2026

Reviewer's Guide

Introduce domain-aware configuration with multi-domain CLI support, including automatic migration from the old flat config format, new domain management commands, and updated documentation and messaging in English.

Sequence diagram for wf domain add and use with domain-aware config

sequenceDiagram
  actor User
  participant WorkflowCLI
  participant DomainCommand
  participant ConfigLib
  participant ConfStore

  User->>WorkflowCLI: wf domain add staging --API_BASE_URL ...
  WorkflowCLI->>DomainCommand: domainCommand(add, "staging", options)
  DomainCommand->>DomainCommand: extractOptions(options)
  DomainCommand->>ConfigLib: addDomain("staging", parsedOptions)
  ConfigLib->>ConfStore: get(DOMAINS)
  ConfStore-->>ConfigLib: domains[] or []
  ConfigLib->>ConfStore: set(DOMAINS, updatedDomains)
  ConfigLib-->>DomainCommand: newDomain
  DomainCommand->>User: print success and domain config

  User->>WorkflowCLI: wf domain use staging
  WorkflowCLI->>DomainCommand: domainCommand(use, "staging", options)
  DomainCommand->>ConfigLib: useDomain("staging")
  ConfigLib->>ConfStore: get(DOMAINS)
  ConfStore-->>ConfigLib: domains[]
  ConfigLib->>ConfStore: set(ACTIVE_DOMAIN, "staging")
  ConfigLib-->>DomainCommand: void
  DomainCommand->>ConfigLib: getActiveDomainConfig()
  ConfigLib->>ConfStore: get(ACTIVE_DOMAIN), get(DOMAINS)
  ConfStore-->>ConfigLib: activeDomain, domains[]
  ConfigLib-->>DomainCommand: activeDomainConfig
  DomainCommand->>User: show applied API_BASE_URL and DB_NAME
Loading

Class diagram for domain-aware config and domain command modules

classDiagram
  class ConfStore {
    +store
    +get(key)
    +set(key, value)
    +delete(key)
    +clear()
    +path
  }

  class ConfigLib {
    +DEFAULT_DOMAIN_CONFIG
    +getActiveDomainConfig()
    +get(key)
    +set(key, value)
    +getAll()
    +clear()
    +addDomain(name, options)
    +useDomain(name)
    +listDomains()
    +removeDomain(name)
  }

  class DomainCommand {
    +domainCommand(action, name, options)
    +showActiveDomain()
    +addDomain(name, options)
    +useDomain(name)
    +listDomains()
    +removeDomain(name)
    +printDomainConfig(domain)
  }

  class WorkflowCLI {
    +checkCommand()
    +csxCommand()
    +updateCommand()
    +syncCommand()
    +resetCommand()
    +configCommand(action, key, value)
    +domainCommand(action, name, options)
  }

  class ConfigFile {
    +ACTIVE_DOMAIN
    +DOMAINS
    +DOMAIN_NAME
    +AUTO_DISCOVER
    +API_BASE_URL
    +API_VERSION
    +DB_HOST
    +DB_PORT
    +DB_NAME
    +DB_USER
    +DB_PASSWORD
    +USE_DOCKER
    +DOCKER_POSTGRES_CONTAINER
    +DEBUG_MODE
  }

  ConfigLib --> ConfStore : wraps
  DomainCommand --> ConfigLib : uses
  WorkflowCLI --> DomainCommand : invokes
  WorkflowCLI --> ConfigLib : uses
  ConfigLib --> ConfigFile : persists
Loading

File-Level Changes

Change Details Files
Refactor config storage to be domain-aware with automatic migration from legacy flat format and helpers for domain CRUD operations.
  • Define DEFAULT_DOMAIN_CONFIG and derive DOMAIN_CONFIG_KEYS for standard per-domain settings.
  • Implement migrateConfig to convert legacy flat keys into { ACTIVE_DOMAIN, DOMAINS[] } structure on module load.
  • Change get/set/getAll to operate on the active domain, reserving PROJECT_ROOT, DOMAIN_NAME, and ACTIVE_DOMAIN with validation and clearer error messages.
  • Add clear, addDomain, useDomain, listDomains, removeDomain, getActiveDomainConfig, and export DEFAULT_DOMAIN_CONFIG for external use.
src/lib/config.js
Add a new domain CLI command to manage multiple domain configurations from the workflow CLI.
  • Register a new domain subcommand in the CLI entrypoint with supported actions (active, add, use, list, remove) and domain option flags.
  • Implement domain command handler with parsing/coercion of option types, and user-facing output for listing, switching, adding, and removing domains.
  • Support wf domain --list shorthand and provide extended help text and usage hints.
bin/workflow.js
src/commands/domain.js
Adjust existing config command behavior and docs to be domain-aware and safer around reserved keys.
  • Update wf config get to show active domain, hide internal domain keys in the iteration, and hint at wf domain list.
  • Wrap config.set in try/catch to display friendly error messages when attempting to modify reserved keys.
  • Revise README examples and sections to explain domain-aware config format, per-domain settings semantics, multi-domain workflows, and migration behavior.
src/commands/config.js
README.md
Standardize comments and descriptions to English and clarify DB/API helper behavior.
  • Translate and clarify comments in db.js functions for testing connections, fetching IDs, and deleting workflows, including Docker-specific behavior.
  • Translate and clarify comments and JSDoc in api.js for testing API connections, publishing components, and reinitializing the system.
  • Update CLI command descriptions for check, csx, update, sync, and reset to English for consistency.
src/lib/db.js
src/lib/api.js
bin/workflow.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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 23, 2026

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.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch master

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
Copy Markdown

Summary of Changes

Hello @yilmaztayfun, 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 significantly enhances the CLI by integrating robust multidomain capabilities. Users can now define and effortlessly switch between various configuration environments, streamlining workflow management across different stages of development or deployment. The changes include a new command for domain operations, a refactored configuration system to support this structure, and automatic migration for existing setups, ensuring a smooth transition for all users.

Highlights

  • Multidomain Support: Introduced comprehensive multidomain support, allowing users to manage and switch between different environment configurations (e.g., staging, production) within the CLI.
  • New wf domain Command: Added a new wf domain command with subcommands for active, add, use, list, and remove to facilitate domain management.
  • Automatic Configuration Migration: Implemented automatic migration for existing single-domain configurations to the new domain-aware format upon first run, ensuring backward compatibility.
  • Updated wf config Command: Modified the wf config command to explicitly operate on the active domain and display active domain information when listing all settings.
  • Enhanced Documentation: Updated the README.md with extensive documentation covering the new multidomain features, command usage, config file format, and migration process.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README.md
    • Updated wf config command descriptions to clarify operation on the active domain.
    • Added detailed documentation for the new wf domain command, including usage examples and notes.
    • Documented the new domain-aware configuration file format with a JSON example.
    • Included sections on backward compatibility and automatic migration from old config formats.
    • Added a new 'Multidomain Workflow' example to demonstrate switching between domains.
    • Introduced a dedicated 'Multidomain Support' section providing an overview, migration details, and a table of domain commands and options.
    • Updated the file structure diagram to include domain.js.
  • bin/workflow.js
    • Imported Argument from commander for advanced command argument parsing.
    • Imported the new domainCommand module.
    • Added the domain command definition with its various actions (active, add, use, list, remove), options, and comprehensive help text.
    • Translated command descriptions for check, csx, update, sync, reset, and config from Turkish to English.
    • Updated config command arguments to use English terms ('set or get').
  • src/commands/config.js
    • Modified config get to display the active domain name and filter out internal domain keys when showing all settings.
    • Added a tip to use wf domain list for comprehensive domain viewing.
    • Implemented try-catch block for config set to provide better error messages for invalid key modifications.
  • src/commands/domain.js
    • Added a new file implementing the domainCommand logic.
    • Defined VALID_KEYS, NUMERIC_KEYS, and BOOLEAN_KEYS for configuration validation and type coercion.
    • Implemented coerceValue to convert string inputs to appropriate types (boolean, number).
    • Created extractOptions to parse and validate command-line options for domain creation.
    • Developed functions for showActiveDomain, addDomain, useDomain, listDomains, and removeDomain to handle respective domain operations.
    • Included printDomainConfig for formatted output of domain settings.
  • src/lib/api.js
    • Translated JSDoc comments for testApiConnection, publishComponent, and reinitializeSystem from Turkish to English.
    • Updated an inline comment related to API error details from Turkish to English.
  • src/lib/config.js
    • Defined DEFAULT_DOMAIN_CONFIG to standardize default settings for new domains.
    • Implemented migrateConfig to automatically convert old flat configuration files into the new domain-aware structure.
    • Refactored get and set functions to operate on the currently active domain's configuration.
    • Updated getAll to return the active domain's full configuration, including PROJECT_ROOT and ACTIVE_DOMAIN.
    • Modified clear to reset the configuration to a default domain-aware state.
    • Added new functions: getActiveDomainConfig, addDomain, useDomain, listDomains, and removeDomain for comprehensive domain management.
    • Exported new domain-related functions and DEFAULT_DOMAIN_CONFIG.
  • src/lib/db.js
    • Translated JSDoc comments for testDbConnection, getInstanceId, and deleteWorkflow from Turkish to English.
    • Updated inline comments related to Docker and direct connection logic from Turkish to English.
Activity
  • A new domain command has been introduced to the CLI, enabling multidomain configuration management.
  • The core configuration logic in src/lib/config.js has been significantly refactored to support domain-specific settings and automatic migration.
  • Extensive documentation has been added and updated in README.md to guide users through the new multidomain features.
  • Minor localization efforts were made across several utility files, translating comments and descriptions from Turkish to English.
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.

Copy link
Copy Markdown

@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 - I've left some high level feedback:

  • In migrateConfig, the early-return check only verifies that ACTIVE_DOMAIN is not undefined and DOMAINS is an array, which means a partially-written or corrupted new-format config (e.g. ACTIVE_DOMAIN set but missing/empty DOMAINS) will skip migration and then cause runtime errors in getActiveDomainConfig; consider tightening this guard (e.g. also ensuring there is a matching domain for ACTIVE_DOMAIN) or falling back to a safe default migration when DOMAINS is missing or does not contain the active domain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `migrateConfig`, the early-return check only verifies that `ACTIVE_DOMAIN` is not `undefined` and `DOMAINS` is an array, which means a partially-written or corrupted new-format config (e.g. `ACTIVE_DOMAIN` set but missing/empty `DOMAINS`) will skip migration and then cause runtime errors in `getActiveDomainConfig`; consider tightening this guard (e.g. also ensuring there is a matching domain for `ACTIVE_DOMAIN`) or falling back to a safe default migration when `DOMAINS` is missing or does not contain the active domain.

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.

Copy link
Copy Markdown

@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

The pull request introduces a robust multidomain support system, allowing the CLI to manage multiple environment configurations seamlessly. The inclusion of an automatic migration path for existing single-domain setups is a thoughtful touch for backward compatibility. The transition to English for CLI descriptions and internal documentation is also a positive step for broader usability. I have identified a few areas for improvement, primarily focused on ensuring data integrity during migration, maintaining consistency in domain naming, and reducing code duplication for better maintainability.

Comment thread src/lib/config.js
Comment on lines +38 to +55
const existingValues = {};
for (const key of DOMAIN_CONFIG_KEYS) {
if (store[key] !== undefined) {
existingValues[key] = store[key];
}
}

// Create default domain: defaults + any existing overrides
const defaultDomain = {
DOMAIN_NAME: 'default',
...DEFAULT_DOMAIN_CONFIG,
...existingValues
};

// Clear old keys and set new format via conf API
for (const key of DOMAIN_CONFIG_KEYS) {
config.delete(key);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The migration logic currently only preserves known configuration keys. Any custom keys previously set by users (e.g., via wf config set CUSTOM_KEY value) will be lost during migration because they are neither moved into the new default domain object nor deleted from the root (where they are no longer accessible by the new domain-aware get() logic). It is recommended to migrate all existing keys from the root store to the default domain.

References
  1. Ensure data integrity during configuration migrations by preserving user-defined custom keys.

Comment thread src/lib/config.js
Comment on lines +155 to +170
function addDomain(name, options) {
const domains = config.get('DOMAINS') || [];

if (domains.find(d => d.DOMAIN_NAME === name)) {
throw new Error(`Domain "${name}" already exists.`);
}

// Use default domain as base, fall back to DEFAULT_DOMAIN_CONFIG
const defaultDomain = domains.find(d => d.DOMAIN_NAME === 'default');
const base = defaultDomain
? { ...defaultDomain }
: { ...DEFAULT_DOMAIN_CONFIG };
delete base.DOMAIN_NAME;

const newDomain = {
DOMAIN_NAME: name,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Domain names are currently handled case-sensitively. This allows for the creation of confusingly similar domains (e.g., 'default' and 'Default') and may lead to unexpected behavior when using commands like wf domain use or wf domain remove if the user doesn't match the case exactly. Normalizing domain names to lowercase during creation and lookup would improve consistency.

References
  1. Normalize identifiers like domain names to ensure consistent behavior across CLI commands.

Comment thread src/commands/domain.js
Comment on lines +4 to +8
const VALID_KEYS = [
'API_BASE_URL', 'API_VERSION', 'DB_HOST', 'DB_PORT', 'DB_NAME',
'DB_USER', 'DB_PASSWORD', 'AUTO_DISCOVER', 'USE_DOCKER',
'DOCKER_POSTGRES_CONTAINER', 'DEBUG_MODE'
];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The VALID_KEYS array duplicates the configuration keys already defined in src/lib/config.js. This creates a maintenance burden as any new configuration setting must be manually added to both files. Since DEFAULT_DOMAIN_CONFIG is already exported from the config library, you can derive these keys dynamically.

References
  1. Avoid hardcoding duplicate lists of configuration keys to improve maintainability.

@yilmaztayfun yilmaztayfun merged commit c710e38 into release-v1.0 Feb 24, 2026
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.

3 participants