-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(core): generate AI files in create-nx-workspace #32442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
8715f7a
to
65e4cb2
Compare
65e4cb2
to
7f328ca
Compare
View your CI Pipeline Execution ↗ for commit 5710028
☁️ Nx Cloud last updated this comment at |
c0d176d
to
34cc4f5
Compare
a833914
to
762aea2
Compare
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx create-nx-workspace@0.0.0-pr-32442-762aea2 my-workspace Or just copy this version and use it in your own command: 0.0.0-pr-32442-762aea2
To request a new release for this pull request, mention someone from the Nx team or the |
try { | ||
const getLatestGeneratorResult = await getLatestGeneratorUsingInstall( | ||
normalizedOptions | ||
); | ||
const { module: latestGeneratorModule, cleanup } = getLatestGeneratorResult; | ||
const setupAiAgentsGeneratorResult = | ||
await latestGeneratorModule.setupAiAgentsGeneratorImpl(tree, options); | ||
await cleanup(); | ||
return setupAiAgentsGeneratorResult; | ||
} catch (error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a potential null reference issue in this code. The getLatestGeneratorUsingInstall
function can return undefined
, but the code immediately destructures the result without checking. If getLatestGeneratorResult
is undefined
, the line const { module: latestGeneratorModule, cleanup } = getLatestGeneratorResult;
will throw a runtime error.
Consider adding a null check before destructuring:
const getLatestGeneratorResult = await getLatestGeneratorUsingInstall(normalizedOptions);
if (getLatestGeneratorResult) {
const { module: latestGeneratorModule, cleanup } = getLatestGeneratorResult;
const setupAiAgentsGeneratorResult =
await latestGeneratorModule.setupAiAgentsGeneratorImpl(tree, options);
await cleanup();
return setupAiAgentsGeneratorResult;
}
try { | |
const getLatestGeneratorResult = await getLatestGeneratorUsingInstall( | |
normalizedOptions | |
); | |
const { module: latestGeneratorModule, cleanup } = getLatestGeneratorResult; | |
const setupAiAgentsGeneratorResult = | |
await latestGeneratorModule.setupAiAgentsGeneratorImpl(tree, options); | |
await cleanup(); | |
return setupAiAgentsGeneratorResult; | |
} catch (error) { | |
try { | |
const getLatestGeneratorResult = await getLatestGeneratorUsingInstall( | |
normalizedOptions | |
); | |
if (getLatestGeneratorResult) { | |
const { module: latestGeneratorModule, cleanup } = getLatestGeneratorResult; | |
const setupAiAgentsGeneratorResult = | |
await latestGeneratorModule.setupAiAgentsGeneratorImpl(tree, options); | |
await cleanup(); | |
return setupAiAgentsGeneratorResult; | |
} | |
} catch (error) { |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
- Remove unused import for non-existent add-mcp-to-codex-config module - Fix setup-ai-agents generator paths from dist to src - Add required schema description for setup-ai-agents generator
6b5cf77
to
e8b491e
Compare
This pull request introduces a new generator to automatically set up AI agent configuration files and Nx MCP server integration when creating a new Nx workspace. It ensures that guidelines and configuration for common AI assistants (Claude and Gemini) are included by default, improving developer experience and AI integration. The changes also update documentation to reflect these enhancements.
AI Agent Setup and Integration
set-up-ai-agents
, topackages/workspace/generators.json
that generates configuration files (CLAUDE.md
,GEMINI.md
,.mcp.json
, and.gemini/settings.json
) with guidelines and Nx MCP server settings for AI assistants. [1] [2] [3] [4] [5]setupAiAgentsGenerator
ingenerate-workspace-files.ts
, ensuring these files are created for every new workspace. [1] [2]Documentation Updates
astro-docs
and shared docs to mention the inclusion of AI agent configuration files (CLAUDE.md
,GEMINI.md
) during workspace creation. [1] [2]Internal Improvements
These changes collectively streamline AI assistant onboarding for Nx users and ensure that new workspaces are ready for advanced AI-powered development workflows.