Skip to content

Conversation

@yilmaztayfun
Copy link
Contributor

@yilmaztayfun yilmaztayfun commented Dec 15, 2025

Major update to CLI documentation in README.md, including detailed usage, command explanations, and vnext.config.json support. Adds new src/lib/vnextConfig.js for reading project config, improves logging and user feedback in check, csx, reset, and sync commands, and updates package metadata. Enhances component discovery, error handling, and summary reporting for all major commands.

Summary by Sourcery

Document vNext CLI configuration via vnext.config.json, tighten component discovery to config-defined paths, and enhance core commands and logging around CSX processing and component publishing.

New Features:

  • Introduce vnext.config.json support for domain and component path configuration, including a new vnextConfig library for reading this project-level config.
  • Add richer command-level summaries and usage guidance in README for check, csx, sync, update, and reset commands, plus a command comparison matrix.

Enhancements:

  • Refine CSX handling to update all referencing JSON files, support both native and Base64 encodings, and restrict scanning to configured component paths.
  • Rework component discovery and JSON/CSX search utilities to operate only within folders defined in vnext.config.json, ignoring meta and non-component files.
  • Modernize sync, update, reset, csx, and check commands to use structured logging, clearer status output, per-component summaries, and more robust error handling.
  • Make PROJECT_ROOT implicit from the current working directory and prevent manual overrides in configuration, exposing a cleaner config API.
  • Unify workflow publishing through a new publishComponent helper and updated re-initialization endpoint, simplifying API interactions.

Build:

  • Update package metadata and dependency ordering in package.json without changing runtime behavior.

Documentation:

  • Revise README with detailed CLI usage, required vnext.config.json format and semantics, configuration variables, common workflows, and a comparison of sync/update/reset/csx commands.

Major update to CLI documentation in README.md, including detailed usage, command explanations, and vnext.config.json support. Adds new src/lib/vnextConfig.js for reading project config, improves logging and user feedback in check, csx, reset, and sync commands, and updates package metadata. Enhances component discovery, error handling, and summary reporting for all major commands.
@coderabbitai
Copy link

coderabbitai bot commented Dec 15, 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 208-support-no-action-transitions-with-external-version-management

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.

@yilmaztayfun yilmaztayfun merged commit 4737f55 into release-v1.0 Dec 15, 2025
1 of 3 checks passed
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 15, 2025

Reviewer's Guide

Revamps the CLI’s configuration and component model around a required vnext.config.json file, updates all major commands (check, csx, sync, reset, update) to use that config and provide richer logging and summaries, refactors discovery/CSX/workflow logic to be path-aware and safer, and refreshes the README and package metadata accordingly.

Sequence diagram for wf update component update flow

sequenceDiagram
  actor Dev
  participant CLI as wf_update_command
  participant ConfigLib as Config
  participant VnextConfig as VnextConfig
  participant Discover as Discover
  participant Csx as CsxLib
  participant Workflow as WorkflowLib
  participant Db as DbLib
  participant Api as ApiLib
  participant API as Vnext_API
  participant DB as Postgres_DB

  Dev->>CLI: wf update [--all|--file]
  CLI->>ConfigLib: get(PROJECT_ROOT)
  ConfigLib-->>CLI: projectRoot (cwd)
  CLI->>VnextConfig: getDomain(projectRoot)
  VnextConfig-->>CLI: domain

  CLI->>ConfigLib: get(API_BASE_URL, API_VERSION)
  ConfigLib-->>CLI: apiConfig

  alt options.all
    CLI->>Csx: findAllCsx(projectRoot)
  else default
    CLI->>Csx: getGitChangedCsx(projectRoot)
  end
  Csx-->>CLI: csxFiles[]

  loop for each csxFile
    CLI->>Csx: processCsxFile(csxPath, projectRoot)
    Csx->>Discover: discoverComponents(projectRoot)
    Discover-->>Csx: discoveredComponents
    Csx->>Discover: findAllJsonFiles(discoveredComponents)
    Csx-->>CLI: {updatedJsonCount, totalUpdates}
  end

  alt options.file
    CLI->>Workflow: getJsonMetadata(filePath)
    Workflow-->>CLI: metadata
  else options.all
    CLI->>Discover: discoverComponents(projectRoot)
    Discover-->>CLI: discovered
    CLI->>Workflow: findAllJson(discovered)
    Workflow-->>CLI: jsonFiles[]
  else default
    CLI->>Workflow: getGitChangedJson(projectRoot)
    Workflow-->>CLI: jsonFiles[]
  end

  loop for each jsonFile
    CLI->>Workflow: getJsonMetadata(jsonPath)
    Workflow-->>CLI: {key, version, data}
    CLI->>Workflow: detectComponentType(jsonPath, projectRoot)
    Workflow-->>CLI: flowType
    CLI->>Db: getInstanceId(dbConfig, flowType, key, version)
    Db-->>CLI: existingId?
    alt exists
      CLI->>Db: deleteWorkflow(dbConfig, flowType, existingId)
    end
    CLI->>Api: publishComponent(apiBaseUrl, data)
    Api->>API: POST /api/v1/definitions/publish
    API-->>Api: {success|error}
    Api-->>CLI: result
  end

  opt anySuccess
    CLI->>Api: reinitializeSystem(apiBaseUrl, apiVersion)
    Api->>API: GET /api/v1/definitions/re-initialize
    API-->>Api: ok
    Api-->>CLI: true|false
  end

  CLI-->>Dev: summary (per type created/updated/failed, CSX stats)
Loading

Class diagram for vnextConfig-centred libraries

classDiagram
  class ConfigLib {
    +get(key)
    +set(key, value)
    +getAll()
    +clear()
    +path
  }

  class VnextConfigLib {
    +loadVnextConfig(projectRoot)
    +getDomain(projectRoot)
    +getPaths(projectRoot)
    +getComponentsRoot(projectRoot)
    +getComponentTypes(projectRoot)
    +getFullConfig(projectRoot)
    +clearCache()
  }

  class DiscoverLib {
    +discoverComponents(projectRoot)
    +findJsonInComponent(componentDir)
    +findAllJsonFiles(discovered)
    +findAllCsxInComponents(projectRoot)
    +getComponentDir(discovered, component)
    +listDiscovered(discovered, componentTypes)
    +detectComponentTypeFromPath(filePath, componentTypes)
  }

  class CsxLib {
    +encodeToBase64(csxPath)
    +readNativeContent(csxPath)
    +findJsonFilesForCsx(csxPath, projectRoot)
    +getCsxLocation(csxPath, projectRoot)
    +updateCodeInJson(jsonPath, csxLocation, base64Code, nativeCode)
    +processCsxFile(csxPath, projectRoot)
    +getGitChangedCsx(projectRoot)
    +findAllCsx(projectRoot)
  }

  class WorkflowLib {
    +getJsonMetadata(jsonPath)
    +detectComponentType(jsonPath, projectRoot)
    +processComponent(jsonPath, dbConfig, baseUrl, projectRoot)
    +getGitChangedJson(projectRoot)
    +findAllJsonInComponent(componentDir)
    +findAllJson(discovered)
  }

  class ApiLib {
    +testApiConnection(baseUrl)
    +publishComponent(baseUrl, componentData)
    +reinitializeSystem(baseUrl, version)
  }

  class DbLib {
    +testDbConnection(dbConfig)
    +getInstanceId(dbConfig, flow, key, version)
    +deleteWorkflow(dbConfig, flow, instanceId)
  }

  class CheckCommand {
    +checkCommand()
  }

  class CsxCommand {
    +csxCommand(options)
  }

  class SyncCommand {
    +syncCommand()
  }

  class ResetCommand {
    +resetCommand(options)
  }

  class UpdateCommand {
    +updateCommand(options)
  }

  ConfigLib <.. CheckCommand
  ConfigLib <.. CsxCommand
  ConfigLib <.. SyncCommand
  ConfigLib <.. ResetCommand
  ConfigLib <.. UpdateCommand

  VnextConfigLib <.. CheckCommand
  VnextConfigLib <.. CsxCommand
  VnextConfigLib <.. SyncCommand
  VnextConfigLib <.. ResetCommand
  VnextConfigLib <.. UpdateCommand

  DiscoverLib <.. CheckCommand
  DiscoverLib <.. SyncCommand
  DiscoverLib <.. UpdateCommand
  DiscoverLib <.. CsxLib
  DiscoverLib <.. WorkflowLib

  CsxLib <.. CsxCommand
  CsxLib <.. SyncCommand
  CsxLib <.. UpdateCommand

  WorkflowLib <.. SyncCommand
  WorkflowLib <.. ResetCommand
  WorkflowLib <.. UpdateCommand

  ApiLib <.. CheckCommand
  ApiLib <.. SyncCommand
  ApiLib <.. ResetCommand
  ApiLib <.. UpdateCommand

  DbLib <.. SyncCommand
  DbLib <.. ResetCommand
  DbLib <.. UpdateCommand

  VnextConfigLib ..> DiscoverLib : providesPaths
  VnextConfigLib ..> WorkflowLib : providesComponentTypes
Loading

File-Level Changes

Change Details Files
Introduce vnext.config.json as the source of domain and component paths and wire it into discovery and commands.
  • Add a vnextConfig helper module to read, cache, and expose domain, paths, componentsRoot, and component type mappings from vnext.config.json.
  • Update commands (check, csx, sync, reset, update) to resolve domain and component folders from vnext.config.json instead of static config keys.
  • Change discovery helpers to use componentsRoot and componentTypes from vnext.config.json and only scan configured folders for JSON/CSX files.
src/lib/vnextConfig.js
src/lib/discover.js
src/lib/workflow.js
src/commands/check.js
src/commands/csx.js
src/commands/sync.js
src/commands/reset.js
src/commands/update.js
Refine CSX processing so it only touches discovered components and supports both Base64 and native encodings with improved reporting.
  • Limit JSON search for CSX references to discovered component paths and introduce findAllJsonFiles/findAllCsxInComponents helpers.
  • Allow CSX code blocks in JSON to be stored either as Base64 (default) or as plain text when encoding is NAT, updating all matching locations in a file.
  • Add richer logging and summary output for CSX runs, including per-file updates and error aggregation.
src/lib/csx.js
src/lib/discover.js
src/commands/csx.js
Rework sync, update, and reset commands to operate on generic components instead of workflow-specific operations, with clearer behavior and summaries.
  • Replace workflow-specific API calls with a new publishComponent helper and adjust DB interactions to use generic component types derived from file paths or vnext.config.json.
  • Update updateCommand to group JSONs by component type, delete existing DB records before publish, and print detailed per-component and CSX summaries plus re-init status.
  • Update syncCommand to add only missing components, with CSX pre-processing, type-based stats, and error reporting.
  • Update resetCommand to dynamically build menu options from discovered component types, then force delete+re-publish selected components with aggregated stats and errors.
src/commands/update.js
src/commands/sync.js
src/commands/reset.js
src/lib/workflow.js
src/lib/api.js
src/lib/discover.js
src/lib/db.js (indirect usage)
Strengthen system introspection via check and config commands and adjust global configuration semantics.
  • Change PROJECT_ROOT to always resolve to process.cwd(), prevent overriding it via config.set, and expose a getAll wrapper that injects PROJECT_ROOT.
  • Simplify config command messaging and ensure it prints the actual config file path and full effective configuration.
  • Enhance checkCommand to show vnext.config.json status, domain, componentsRoot, API/DB connectivity, and discovered component folders using a common LOG helper.
src/lib/config.js
src/commands/config.js
src/commands/check.js
Update documentation and package metadata to match the new configuration model and command behaviors.
  • Rewrite README sections for Quick Start, Commands, Configuration, Usage Scenarios, and Troubleshooting to center on vnext.config.json, automatic PROJECT_ROOT handling, and the revised sync/update/reset/csx semantics.
  • Document component discovery rules, command comparisons, and the new config variables including DEBUG_MODE and AUTO_DISCOVER defaults.
  • Normalize dependency ordering in package.json and ensure conf is explicitly declared as a dependency.
README.md
package.json

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

@gemini-code-assist
Copy link

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 introduces a foundational change to how the CLI manages project configurations by implementing a vnext.config.json file. This new approach centralizes project domain and component path definitions, leading to a more robust and predictable CLI experience. Concurrently, all major CLI commands have been upgraded with enhanced user feedback, improved error reporting, and better integration with the new configuration system, alongside a comprehensive update to the project documentation.

Highlights

  • Introduction of vnext.config.json: A new configuration file, vnext.config.json, is now required in the project root to define domain and component paths. This centralizes project-specific settings and replaces previous CLI configuration methods for project structure.
  • Major CLI Command Enhancements: The check, csx, reset, sync, and update commands have been significantly revamped. They now integrate with vnext.config.json, feature improved logging, better error handling, and provide detailed summary reports for clearer user feedback.
  • Documentation Overhaul: The README.md has been extensively updated to reflect the new vnext.config.json structure, provide detailed explanations for all CLI commands, introduce new usage scenarios, and include a command comparison table for better clarity.
  • Refactored Component Discovery and Processing: The internal logic for discovering components (src/lib/discover.js) and processing workflows/components (src/lib/workflow.js) has been refactored to leverage the vnext.config.json for path definitions and component type identification. API interactions have been streamlined into a single publishComponent function.
  • CSX File Handling Improvements: The csx command and related library functions (src/lib/csx.js) now more intelligently find and update JSON files that reference CSX, supporting both Base64 and native (plain text) encoding for code blocks, and updating all matching references within a JSON file.
  • Configuration Management Update: The PROJECT_ROOT configuration variable is no longer manually set but automatically defaults to the current working directory (process.cwd()), simplifying setup and ensuring commands operate within the correct project context.
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

@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 LOG helper (separator/header/component/etc.) is duplicated across multiple command files; consider centralizing this in a shared utility (e.g., lib/log.js) to avoid repetition and keep formatting changes consistent.
  • There are a few imports that appear unused after the refactor (e.g., findAllJsonFiles in update.js, detectComponentTypeFromPath or related helpers in discover/workflow); a quick pass to remove unused symbols would simplify the modules and reduce cognitive load.
  • publishComponent now only uses baseUrl and a fixed /api/v1/definitions/publish route while several callers still construct apiConfig with version/domain fields; you might want to either remove those unused fields or wire them into the API client to keep configuration semantics consistent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The LOG helper (separator/header/component/etc.) is duplicated across multiple command files; consider centralizing this in a shared utility (e.g., lib/log.js) to avoid repetition and keep formatting changes consistent.
- There are a few imports that appear unused after the refactor (e.g., findAllJsonFiles in update.js, detectComponentTypeFromPath or related helpers in discover/workflow); a quick pass to remove unused symbols would simplify the modules and reduce cognitive load.
- publishComponent now only uses baseUrl and a fixed /api/v1/definitions/publish route while several callers still construct apiConfig with version/domain fields; you might want to either remove those unused fields or wire them into the API client to keep configuration semantics consistent.

## Individual Comments

### Comment 1
<location> `src/lib/csx.js:55-56` </location>
<code_context>
-function getCsxLocation(csxPath) {
-  // ./src/Rules/MyRule.csx formatına çevir
-  const parts = csxPath.split('/');
+function getCsxLocation(csxPath, projectRoot) {
+  // Convert to ./src/Rules/MyRule.csx format
+  const parts = csxPath.split(path.sep);
   const srcIndex = parts.lastIndexOf('src');
</code_context>

<issue_to_address>
**issue (bug_risk):** The new `projectRoot` parameter in `getCsxLocation` is unused and the implementation still hardcodes a `src`-based heuristic.

`projectRoot` is accepted but never used; the function still relies on finding the last `src` segment to build the path. If components are no longer guaranteed to live under `src`, this resolution can fail. Either drop `projectRoot` from the signature, or update the logic to resolve relative to the configured components root (e.g. via `getComponentsRoot`) so it matches the vnext.config-driven layout.
</issue_to_address>

### Comment 2
<location> `src/lib/csx.js:101` </location>
<code_context>
-      obj.code = base64Code;
-      return true;
+      // Check encoding type: NAT = Native (plain text), B64 or empty = Base64 (default)
+      const encoding = obj.encoding ? obj.encoding.toUpperCase() : 'B64';
+      
+      if (encoding === 'NAT') {
</code_context>

<issue_to_address>
**issue (bug_risk):** Encoding handling assumes `encoding` is a string, which can throw if the field is present but non‑string.

Since this parses arbitrary JSON, `obj.encoding.toUpperCase()` can throw when `encoding` is present but not a string (boolean, number, object, etc.). Please add a type guard, e.g.:

```js
const encoding = typeof obj.encoding === 'string'
  ? obj.encoding.toUpperCase()
  : 'B64';
```

This preserves current behavior for valid strings while avoiding runtime errors on malformed data.
</issue_to_address>

### Comment 3
<location> `src/lib/config.js:29-38` </location>
<code_context>
+ */
+function get(key) {
+  // PROJECT_ROOT is always the current working directory
+  if (key === 'PROJECT_ROOT') {
+    return process.cwd();
+  }
+  return config.get(key);
+}
+
+/**
+ * Sets a config value
+ * PROJECT_ROOT cannot be set (ignored)
+ * @param {string} key - Config key
+ * @param {any} value - Config value
+ */
+function set(key, value) {
+  // PROJECT_ROOT cannot be saved - always uses cwd
+  if (key === 'PROJECT_ROOT') {
+    console.log('Note: PROJECT_ROOT is always the current working directory and cannot be changed.');
+    return;
+  }
</code_context>

<issue_to_address>
**suggestion:** Having `config.set` log to the console for `PROJECT_ROOT` introduces a side effect in a library API that might be used programmatically.

This `console.log` causes unexpected stdout output for any code that calls `config.set('PROJECT_ROOT', ...)`, which is problematic for scripts and tests. To avoid side effects in the library API, consider either throwing for this key or silently ignoring it, and move any explanatory messaging to the CLI layer (e.g. `configCommand`) where stdout output is expected.

Suggested implementation:

```javascript
function get(key) {
  // PROJECT_ROOT is always the current working directory
  if (key === 'PROJECT_ROOT') {
    // PROJECT_ROOT is always derived from the current working directory
    return process.cwd();
  }
  return config.get(key);

```

You’ll also want to adjust the `set` implementation in this same file to avoid console side effects:

1. Find the `set` function that currently looks like:

```js
function set(key, value) {
  // PROJECT_ROOT cannot be saved - always uses cwd
  if (key === 'PROJECT_ROOT') {
    console.log('Note: PROJECT_ROOT is always the current working directory and cannot be changed.');
    return;
  }

  // ... probably existing logic here ...
}
```

2. Change it to silently ignore attempts to set `PROJECT_ROOT`:

```js
function set(key, value) {
  // PROJECT_ROOT cannot be saved - always uses cwd
  if (key === 'PROJECT_ROOT') {
    // Silently ignore attempts to set PROJECT_ROOT from library code
    return;
  }

  return config.set(key, value);
}
```

This removes the stdout side effect from the library API while still preventing `PROJECT_ROOT` from being set. If your existing `set` logic differs, keep the existing behavior for non-`PROJECT_ROOT` keys and only replace the `console.log` branch with the early `return`.
</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 +29 to +38
if (key === 'PROJECT_ROOT') {
return process.cwd();
}
return config.get(key);
}

/**
* Sets a config value
* PROJECT_ROOT cannot be set (ignored)
* @param {string} key - Config key
Copy link

Choose a reason for hiding this comment

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

suggestion: Having config.set log to the console for PROJECT_ROOT introduces a side effect in a library API that might be used programmatically.

This console.log causes unexpected stdout output for any code that calls config.set('PROJECT_ROOT', ...), which is problematic for scripts and tests. To avoid side effects in the library API, consider either throwing for this key or silently ignoring it, and move any explanatory messaging to the CLI layer (e.g. configCommand) where stdout output is expected.

Suggested implementation:

function get(key) {
  // PROJECT_ROOT is always the current working directory
  if (key === 'PROJECT_ROOT') {
    // PROJECT_ROOT is always derived from the current working directory
    return process.cwd();
  }
  return config.get(key);

You’ll also want to adjust the set implementation in this same file to avoid console side effects:

  1. Find the set function that currently looks like:
function set(key, value) {
  // PROJECT_ROOT cannot be saved - always uses cwd
  if (key === 'PROJECT_ROOT') {
    console.log('Note: PROJECT_ROOT is always the current working directory and cannot be changed.');
    return;
  }

  // ... probably existing logic here ...
}
  1. Change it to silently ignore attempts to set PROJECT_ROOT:
function set(key, value) {
  // PROJECT_ROOT cannot be saved - always uses cwd
  if (key === 'PROJECT_ROOT') {
    // Silently ignore attempts to set PROJECT_ROOT from library code
    return;
  }

  return config.set(key, value);
}

This removes the stdout side effect from the library API while still preventing PROJECT_ROOT from being set. If your existing set logic differs, keep the existing behavior for non-PROJECT_ROOT keys and only replace the console.log branch with the early return.

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 significant refactoring and feature enhancements to the vNext workflow CLI. Key changes include updating the README.md to detail a new vnext.config.json file for project configuration, revising command descriptions (check, sync, update, reset, csx, config), and providing a comprehensive command comparison table. The CLI's internal logic has been updated to dynamically read configuration from vnext.config.json, removing the need to manually set PROJECT_ROOT and API_DOMAIN via wf config. The package.json and package-lock.json files reflect a package name change from @vnext/workflow-cli to @burgan-tech/vnext-workflow-cli. Core functionalities in src/commands and src/lib have been refactored to use a new publishComponent API endpoint, improve error handling, and standardize console output with a new LOG helper. The csx processing now supports both Base64 and native text encoding for CSX files within JSONs, and component discovery is now strictly based on paths defined in vnext.config.json. Review comments highlighted a typo in the wf reset menu example, suggesting ALL instead of TUMU, and requested moving require statements to the top of src/lib/csx.js and src/lib/workflow.js for better code clarity.

schemas (Schemas/)
──────────────
🔴 ALL (All folders)
TUMU (All folders)

Choose a reason for hiding this comment

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

medium

There appears to be a typo in the menu example. TUMU should likely be ALL to be consistent with the value it represents and the other English-language menu options.

Suggested change
TUMU (All folders)
ALL (All folders)

const { exec } = require('child_process');
const util = require('util');
const execPromise = util.promisify(exec);
const fsSync = require('fs');

Choose a reason for hiding this comment

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

medium

For better code clarity and to follow common JavaScript best practices, all require statements should be at the top of the file. This makes dependencies easier to see at a glance. Please move this require statement to the top of src/lib/csx.js.

const util = require('util');
const execPromise = util.promisify(exec);
const fs = require('fs');
const fsSync = require('fs');

Choose a reason for hiding this comment

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

medium

For better code clarity and to follow common JavaScript best practices, all require statements should be at the top of the file. This makes dependencies easier to see at a glance. Please move this require statement to the top of src/lib/workflow.js.

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.

2 participants