Skip to content

Conversation

MaxKless
Copy link
Collaborator

@MaxKless MaxKless commented Aug 21, 2025

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

  • Added a new hidden generator, set-up-ai-agents, to packages/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]
  • Integrated the new generator into the workspace creation flow by invoking setupAiAgentsGenerator in generate-workspace-files.ts, ensuring these files are created for every new workspace. [1] [2]

Documentation Updates

  • Enhanced documentation in both astro-docs and shared docs to mention the inclusion of AI agent configuration files (CLAUDE.md, GEMINI.md) during workspace creation. [1] [2]
  • Added a new reference entry for the AI agent setup generator in the documentation sitemap.

Internal Improvements

  • Refactored package manager utilities to allow skipping configuration file copying when creating a workspace from scratch, supporting the new generator's requirements.

These changes collectively streamline AI assistant onboarding for Nx users and ensure that new workspaces are ready for advanced AI-powered development workflows.

Copy link

vercel bot commented Aug 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Aug 29, 2025 11:16am

@MaxKless MaxKless force-pushed the ai-files-generation branch from 8715f7a to 65e4cb2 Compare August 21, 2025 11:33
@MaxKless MaxKless changed the title feat(core): generate AI files on create-nx-workspace feat(core): generate AI files in create-nx-workspace Aug 21, 2025
@MaxKless MaxKless force-pushed the ai-files-generation branch from 65e4cb2 to 7f328ca Compare August 21, 2025 12:30
Copy link
Contributor

nx-cloud bot commented Aug 21, 2025

View your CI Pipeline Execution ↗ for commit 5710028

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 34m 23s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 1m 53s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 8s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 6s View ↗
nx documentation ✅ Succeeded 45s View ↗

☁️ Nx Cloud last updated this comment at 2025-08-29 11:44:58 UTC

Copy link
Contributor

🐳 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
Release details 📑
Published version 0.0.0-pr-32442-762aea2
Triggered by @MaxKless
Branch ai-files-generation
Commit 762aea2
Workflow run 17159589491

To request a new release for this pull request, mention someone from the Nx team or the @nrwl/nx-pipelines-reviewers.

@MaxKless MaxKless marked this pull request as ready for review August 25, 2025 12:03
Comment on lines +27 to +36
try {
const getLatestGeneratorResult = await getLatestGeneratorUsingInstall(
normalizedOptions
);
const { module: latestGeneratorModule, cleanup } = getLatestGeneratorResult;
const setupAiAgentsGeneratorResult =
await latestGeneratorModule.setupAiAgentsGeneratorImpl(tree, options);
await cleanup();
return setupAiAgentsGeneratorResult;
} catch (error) {
Copy link
Contributor

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;
}
Suggested change
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

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@MaxKless MaxKless added the PR status: do not merge This will block a PR from being merged until this tag is removed. label Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR status: do not merge This will block a PR from being merged until this tag is removed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant