Telemetry: Record known CLI integrations#32448
Merged
Merged
Conversation
|
View your CI Pipeline Execution ↗ for commit dac9e9c
☁️ Nx Cloud last updated this comment at |
Comment on lines
+238
to
+241
| it('returns the CLI integration if found', () => { | ||
| const ancestry = [{ command: 'node' }, { command: 'npx sv@latest add' }]; | ||
| expect(getCliIntegrationFromAncestry(ancestry as any)).toBe('sv add'); | ||
| }); |
Contributor
There was a problem hiding this comment.
style: Duplicate test description - both test cases have identical descriptions but test different scenarios
Suggested change
| it('returns the CLI integration if found', () => { | |
| const ancestry = [{ command: 'node' }, { command: 'npx sv@latest add' }]; | |
| expect(getCliIntegrationFromAncestry(ancestry as any)).toBe('sv add'); | |
| }); | |
| it('returns the CLI integration if found with version stripped', () => { | |
| const ancestry = [{ command: 'node' }, { command: 'npx sv@latest add' }]; | |
| expect(getCliIntegrationFromAncestry(ancestry as any)).toBe('sv add'); | |
| }); |
ndelangen
approved these changes
Sep 15, 2025
This was referenced Sep 15, 2025
Merged
ndelangen
added a commit
that referenced
this pull request
Sep 15, 2025
…lemetry Telemetry: Record known CLI integrations (cherry picked from commit 1e65c88)
23 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes N/A
What I did
Record whether an install came from a known integration, such as
sv createorsv addby inspecting the process ancestry.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Did not manual test. Will verify the results once we release.
🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>Greptile Summary
Updated On: 2025-09-14 18:35:03 UTC
This PR implements telemetry tracking for CLI integrations that invoke Storybook initialization, specifically detecting usage of
sv createandsv addcommands. The implementation adds a newgetCliIntegrationFromAncestry()function that analyzes the process ancestry chain to identify these known integration patterns, similar to the existinggetStorybookVersionFromAncestry()function.The change introduces minimal code additions to the initialization flow in
code/lib/create-storybook/src/initiate.ts. The new function uses regex pattern matching to detectsv createandsv addcommands in the process chain, handling version specifiers (like@latest) and prioritizing nested calls. The detected integration information is then passed to the existing telemetry system as an optionalcliIntegrationparameter.This enhancement allows the Storybook team to understand adoption patterns and usage statistics for third-party integrations that leverage their initialization tooling. The implementation follows established patterns in the codebase, reuses existing infrastructure for process ancestry inspection, and maintains backward compatibility. Error handling ensures that telemetry failures never impact the core initialization process.
The change includes comprehensive unit tests covering various scenarios: detecting nested CLI calls, handling version specifiers, and gracefully handling cases where no integration is found. The tests follow the same pattern as existing tests for the similar
getStorybookVersionFromAncestryfunction.Confidence score: 5/5