feat: add file-system routed studio config (studio.ts singleton)#18889
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughThis PR adds support for a file-system routed ChangesStudio singleton auto-registration
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR triageLinked issue check skipped for excluded profile @devin-ai-integration[bot]. PR complexity score
Applied label: Changed test gateChanged tests failed against the base branch as expected. Label: |
721341b to
2608e75
Compare
6b38809 to
466aaf6
Compare
🦋 Changeset detectedLatest commit: f47c342 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
2608e75 to
4811a1d
Compare
466aaf6 to
effc6d9
Compare
4811a1d to
595eb5f
Compare
788b03f to
d440059
Compare
51d2dbb to
1fccba7
Compare
d440059 to
c4404b7
Compare
1fccba7 to
de5faaf
Compare
c4404b7 to
d37c7fc
Compare
de5faaf to
62f2871
Compare
d37c7fc to
23fdcca
Compare
62f2871 to
283dc14
Compare
283dc14 to
22bec18
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.changeset/tidy-nails-repeat.md (1)
1-7: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winAdd a short code example for this new feature.
The entry describes a new public-facing convention (
studio.tsauto-discovery) but doesn't show what the file looks like. As per path instructions, "If the change is a breaking change or is adding a new feature, ensure that a short code example is provided. This code example should show the public API usage."📝 Suggested addition
Added file-system routed studio config singleton. Place a studio.ts file in your mastra directory that default-exports a StudioConfig object, and it will be auto-discovered and registered when running mastra dev or mastra build. Code-registered studio config takes precedence if both are present. + +```ts +// mastra/studio.ts +import type { StudioConfig } from '`@mastra/core`'; + +export default { + auth: new MastraAuthStudio(), +} satisfies StudioConfig; +```🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.changeset/tidy-nails-repeat.md around lines 1 - 7, The changeset entry for the new studio.ts auto-discovery feature is missing a short public API example. Update the markdown content to include a concise code snippet showing the expected default export from a studio.ts file in the Mastra directory, using the StudioConfig type and a realistic exported config object so users can see how to adopt the feature.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.changeset/tidy-nails-repeat.md:
- Around line 1-7: The changeset entry for the new studio.ts auto-discovery
feature is missing a short public API example. Update the markdown content to
include a concise code snippet showing the expected default export from a
studio.ts file in the Mastra directory, using the StudioConfig type and a
realistic exported config object so users can see how to adopt the feature.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ba55ff57-8bba-462b-b411-b724eb43c610
📒 Files selected for processing (5)
.changeset/tidy-nails-repeat.mdpackages/core/src/mastra/index.tspackages/deployer/src/build/fs-routing/codegen.tspackages/deployer/src/build/fs-routing/fs-routing.test.tspackages/deployer/src/build/fs-routing/prepare.ts
Co-Authored-By: Abhi Aiyer <abhi@mastra.ai>
22bec18 to
f47c342
Compare
Description
Extends the file-system routing pipeline to discover a
studio.tssingleton file under the mastra directory and register it on the Mastra instance. This is the fifth PR in a stack that removes the need fornew Mastra()when users fully embrace the file-based paradigm.Stacked on #18888 (file-based server).
Changes
Core (
packages/core/src/mastra/index.ts):#studioExplicitflag — set when user passesstudiotonew Mastra({studio})__registerFsStudio(fsStudio)— callssetStudio()only if no explicit studio config was provided; otherwise logs a warning (code wins)Codegen (
codegen.ts):Prepare (
prepare.ts):hasStudio: booleanadded toPrepareFsAgentsEntryResultFull file-based project structure now supported
With this PR, the complete set of infrastructure singletons is discoverable:
Related issue(s)
Part of the file-based primitives MVP stack (eliminates
new Mastra()boilerplate).Type of change
Checklist
Link to Devin session: https://app.devin.ai/sessions/b9e3b35378b54413b9931e8f2499ab8c
ELI5
This PR teaches Mastra to notice a new
studio.tsfile in themastrafolder and wire it up automatically. That means people can keep more of their app in files instead of hand-writing setup code, while still letting an explicitly configured studio win if both exist.What changed
studio.tsfile-system routing support in@mastra/core.Mastranow tracks whetherstudiowas set directly in the constructor.__registerFsStudio()to register a discovered studio config only when one wasn’t explicitly provided.studio.tsin generated wrappers.studio.tsalongside agents, workflows, storage, and observability.@mastra/coreand@mastra/deployerfor minor release.