[pull] next from storybookjs:next#864
Merged
Merged
Conversation
…n once A second copy of the telemetry module loading in the same process (an addon resolving its own storybook package in a pnpm workspace, or dual CJS/ESM loading) reset SB_TELEMETRY_STATE back to undefined, so every subsequent telemetry() call was queued forever and silently dropped. Guard-initialize the state, move the event queue to globalThis so a late loading module instance flushes into the same queue, and apply the same guard to PAYLOAD_ERROR_HANDLER which had the identical wipe-on-reload bug.
Engine-only open-service commands (_applyGraphSnapshot, _applyGraphUpdate, _bumpGraphRevision, _setStatus, _waitForSettledEngine) are now marked internal: true and prefixed with _ per open-service conventions. Co-authored-by: Jeppe Reinhold <JReinhold@users.noreply.github.com>
…rybook/cli The dispatcher only routed dev/build/index to the bundled core binary; `storybook ai` was proxied to @storybook/cli, falling back to an npx download on version mismatch. Since agent skills invoke `npx storybook ai <tool>` repeatedly, that download sat on a hot path. Move the whole ai command (MCP passthrough + setup) from @storybook/cli into code/core/src/cli/ai, register it in bin/core.ts next to dev/build, and add 'ai' to the dispatcher's bundled list. getStorybookData is reimplemented on top of core's getStorybookInfo; ProjectTypeService keeps the cross-package source import pattern. Closes #35146
…rt, shared story-paths helper - Extract detectLanguage/detectIncompatiblePackageVersions into core (storybook/internal/cli) and delegate from ProjectTypeService, so core no longer imports source from create-storybook (which depends on core). - Move getStoriesPathsFromConfig into core-server as the single shared copy; cli-storybook re-exports it and the ai module imports it, instead of two verbatim duplicates.
… in detectLanguage Addresses the codex thermo-nuclear review: - getStorybookData moves to storybook/internal/cli as the one canonical project-metadata collector; automigrate/doctor/add delegate to it via a re-export instead of keeping a near-duplicate. - detectLanguage takes an explicit workingDir for its js/tsconfig lookup (defaulting to process.cwd() for init), and ai setup passes the target Storybook's working dir instead of relying on the process cwd.
…-export Second thermo-nuclear review pass: detectLanguage's workingDir scoping is an intended fix (config files are found next to the target Storybook, not the invoking cwd) — covered with memfs tests; the re-export in util.ts moves below the import block.
…sper/ai-cli-bundled
`dirname(join(process.cwd(), configDir))` collapsed `--config-dir .` to the project's parent directory, mispointing story-glob resolution and the tsconfig/jsconfig lookup in detectLanguage. Taking dirname before resolving keeps root-level config dirs anchored to the project root. Pre-existing on next, surfaced by the move (CodeRabbit review on #35147).
…internal-ops-df57 Open Service: Mark module-graph engine commands as internal
CLI: Bundle the `ai` command in core so it never downloads `@storybook/cli`
…RROR_HANDLER global The bare PayloadErrorHandler name in typings.d.ts never resolved (declaration files are skipLibCheck'd), so the global was silently typed any. Export the type and reference it the same way as the other telemetry globals.
…ate-guard Telemetry: Preserve state machine when the module loads more than once
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )