Skip to content

Conversation

@alvarosabu
Copy link
Contributor

@alvarosabu alvarosabu commented Oct 7, 2025

DRAFT of discovery phase

WDX-181


Note

Introduces a first-class CLI configuration file (defineConfig) that’s resolved at runtime and applied to commands, with global options, defaults, and integration across fetch and filesystem utilities.

  • CLI Config:
    • New defineConfig API and config types (src/config/types.ts) with entrypoints/config.ts export for user config.
    • Runtime config resolution via c12 and pre-action hook; applies resolved config to Commander and sets global options.
    • Logs active config and augments command ancestry during execution.
  • Integration:
    • utils/fetch now reads api.maxRetries from active config.
    • Filesystem: add DEFAULT_STORAGE_DIR and simplify resolvePath (honor relative base path).
  • Utilities/Setup:
    • New utils/object (deep merge, isPlainObject, isEmptyObject); remove duplicate helper.
    • Load dotenv via dotenv/config; minor program bootstrap updates (getConfigDefaults).

Written by Cursor Bugbot for commit 478ae14. This will update automatically on new commits. Configure here.

@alvarosabu alvarosabu marked this pull request as draft October 7, 2025 16:51
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 6, 2025

Open in StackBlitz

@storyblok/astro

npm i https://pkg.pr.new/@storyblok/astro@347

storyblok

npm i https://pkg.pr.new/storyblok@347

@storyblok/eslint-config

npm i https://pkg.pr.new/@storyblok/eslint-config@347

@storyblok/js

npm i https://pkg.pr.new/@storyblok/js@347

storyblok-js-client

npm i https://pkg.pr.new/storyblok-js-client@347

@storyblok/management-api-client

npm i https://pkg.pr.new/@storyblok/management-api-client@347

@storyblok/nuxt

npm i https://pkg.pr.new/@storyblok/nuxt@347

@storyblok/react

npm i https://pkg.pr.new/@storyblok/react@347

@storyblok/region-helper

npm i https://pkg.pr.new/@storyblok/region-helper@347

@storyblok/richtext

npm i https://pkg.pr.new/@storyblok/richtext@347

@storyblok/svelte

npm i https://pkg.pr.new/@storyblok/svelte@347

@storyblok/vue

npm i https://pkg.pr.new/@storyblok/vue@347

commit: 478ae14

@alexjoverm alexjoverm marked this pull request as ready for review November 7, 2025 13:20
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

.command(commands.USER)
.description('Get the current user')
.option('--sf, --separate-files', 'Argument to create a single file for each component')
.option('--su, --suffix <suffix>', 'suffix to add to the file name (e.g. components.<suffix>.json)')
Copy link

Choose a reason for hiding this comment

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

Bug: Misplaced Options in User Command Suite

The user command incorrectly includes --separate-files and --suffix options that are meant for components/datasources pull commands. These options reference creating files for components and have no relevance to the user command, which only fetches and displays user information without creating any files.

Fix in Cursor Fix in Web

@alexjoverm
Copy link
Contributor

Feature is ready for review. Here's a few notes to hopefully help review.

Manual Review Notes

Use this checklist when reviewing the PR to make sure the new config behaviour work as expected.

1. Config Layering

  • Create ~/.storyblok/config.ts with { region: 'us' }.
  • Inside the repo, add .storyblok/config.ts with { region: 'cn' }, and storyblok.config.ts with { region: 'eu' }.
  • Run storyblok user --verbose and confirm the CLI logs each file path and reports region: "eu" (project layer wins).
  • Temporarily delete storyblok.config.ts, rerun, and ensure .storyblok/config.ts takes over (region: "cn").

2. Config vs CLI Overrides

  • Set modules.components.space = <YOUR_SPACE_ID> in storyblok.config.ts.
  • Run storyblok components pull -s <ANOTHER_SPACE_ID> and confirm the CLI respects the explicit flag.
  • Run without the flag; confirm the config value is applied.

3. Environment Variable Support

  • Add STORYBLOK_SPACE_ID=99999 and STORYBLOK_VERBOSE=true to a .env file.
  • Reference those env vars inside storyblok.config.ts (check the example in config/README.md).
  • Run storyblok migrations run --verbose and confirm:
    • The command automatically picks up the space ID from the env var.

4. Config Format Coverage

  • Use a simple config (for example { region: 'us' }) and confirm it is detected as storyblok.config.ts.
  • Repeat by renaming the same file to storyblok.config.js, storyblok.config.mjs, storyblok.config.json, and storyblok.config.yaml (the most common formats we support).
  • For each rename, run storyblok user --verbose and make sure the CLI logs the new file path and applies the region setting.

5. Regression Smoke Tests

  • Execute storyblok login, storyblok components pull, and storyblok migrations run --dry-run to make sure the CLI still authenticates, reads configs, and executes long-running commands without new warnings.
  • Watch for the “Loaded Storyblok config …” lines: they should only appear when verbose mode is active.

# Conflicts:
#	packages/cli/src/commands/types/generate/index.ts
#	pnpm-lock.yaml
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