Skip to content

Conversation

FrozenPandaz
Copy link
Collaborator

@FrozenPandaz FrozenPandaz commented Jul 4, 2025

Current Behavior

Nx-cloud commands are scattered across different directories in the command-line structure, making them harder to find and maintain. Commands like record, start-ci-run, and fix-ci don't exist as direct nx commands. The fix-ci command in CI workflows doesn't run when previous steps fail.

Expected Behavior

All nx-cloud related commands are organized in a dedicated directory with consistent patterns and shared utilities. New commands provide better CI/CD integration. The fix-ci command always runs to provide AI-powered recommendations even when builds fail.

Related Issue(s)

Improves code organization and adds missing CI workflow commands for better developer experience.

Changes Made

🏗️ Reorganized nx-cloud commands

  • Created /packages/nx/src/command-line/nx-cloud/ directory structure
  • Moved existing commands (login, logout, connect) to new location
  • Extracted shared utility function to eliminate code duplication

🆕 Added new nx-cloud commands

  • nx record - Records command execution for distributed task execution
  • nx start-ci-run - Starts new CI run for distributed execution
  • nx fix-ci - Fixes CI configuration issues with AI-powered suggestions

🔧 Code quality improvements

  • Reduced code duplication by 80+ lines across command implementations
  • All commands now follow consistent patterns using shared utilities
  • Fixed import paths throughout codebase after reorganization

🚀 Enhanced CI workflow support

  • Gradle Generator: Added alwaysRun property to Command type for conditional execution
  • Template Updates: GitHub Actions and CircleCI templates now handle alwaysRun property
  • Fix-CI Integration: The fix-ci command now always runs regardless of previous step failures

📚 Comprehensive documentation updates

  • Updated all CI provider documentation (GitHub Actions, Azure DevOps, GitLab, Bitbucket, CircleCI, Jenkins)
  • Updated Nx Cloud tutorial documentation (GitHub Actions, CircleCI)
  • Framework Tutorials: Added if: always() condition to fix-ci commands in:
    • Gradle tutorial (/docs/shared/tutorials/gradle.md)
    • Angular monorepo tutorial (/docs/shared/tutorials/angular-monorepo.md)
    • React monorepo tutorial (/docs/shared/tutorials/react-monorepo.md)
    • TypeScript packages tutorial (/docs/shared/tutorials/typescript-packages.md)
  • Added proper documentation linking for all new commands
  • All validation passes (TypeScript, formatting, documentation)

🎯 Key Technical Improvements

  • Always-Run Logic: Fix-ci command uses platform-specific conditional execution:
    • GitHub Actions: if: always()
    • CircleCI: when: always
    • Azure DevOps: condition: always()
  • Consistent Patterns: All nx-cloud commands follow unified implementation approach
  • Backward Compatibility: All existing functionality preserved during reorganization

All nx-cloud commands now provide a more cohesive experience with better CI integration, ensuring users get AI-powered recommendations even when builds fail.

Extract command generation logic into dedicated functions for better maintainability:
- getNxCloudRecordCommand() for Nx Cloud record instructions
- getNxTasksCommand() for main nx affected/run-many commands
- getNxCloudFixCiCommand() for nx-cloud fix-ci command

This makes the code more modular and easier to test.
@FrozenPandaz FrozenPandaz requested a review from a team as a code owner July 4, 2025 15:34
@FrozenPandaz FrozenPandaz requested a review from Cammisuli July 4, 2025 15:34
Copy link

vercel bot commented Jul 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Jul 4, 2025 8:57pm
Copy link
Contributor

nx-cloud bot commented Jul 4, 2025

View your CI Pipeline Execution ↗ for commit a488577

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 6m 48s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 16s 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 5s View ↗
nx documentation ✅ Succeeded 2m 48s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-04 20:58:14 UTC

…e manager variables

- Replace npx nx-cloud start-ci-run with ./nx start-ci-run in CI templates
- Remove unused packageManager and packageManagerPrefix variables from generator
- Update snapshots to reflect the command changes

This ensures consistency with the nx wrapper approach across all CI templates.
- Create nx-cloud directory structure for better organization
- Move existing commands (login, logout, connect) to nx-cloud subdirectory
- Add new nx-cloud commands: record, start-ci-run, fix-ci
- Extract shared utility function to reduce code duplication
- Update CI workflow generator to use new fix-ci command
- Remove old command directories after successful migration

All nx-cloud commands now follow consistent patterns and use shared utilities.
Copy link
Contributor

github-actions bot commented Jul 4, 2025

🐳 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-31833-c24a922 my-workspace

Or just copy this version and use it in your own command:

0.0.0-pr-31833-c24a922
Release details 📑
Published version 0.0.0-pr-31833-c24a922
Triggered by @FrozenPandaz
Branch add-fix-ci
Commit c24a922
Workflow run 16077879793

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

Add comprehensive documentation for nx record, start-ci-run, and fix-ci commands.
Update all tutorial CI workflow examples to include nx fix-ci command.
Add nx fix-ci to Gradle CI workflow generator templates.
Ensure consistency across all CI documentation and examples.
Update test snapshots to match new Gradle workflow output.

🤖 Generated with [Claude Code](https://claude.ai/code)
Copy link
Contributor

github-actions bot commented Jul 4, 2025

🐳 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-31833-2080c63 my-workspace

Or just copy this version and use it in your own command:

0.0.0-pr-31833-2080c63
Release details 📑
Published version 0.0.0-pr-31833-2080c63
Triggered by @FrozenPandaz
Branch add-fix-ci
Commit 2080c63
Workflow run 16078208068

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

Add alwaysRun property to Command type to make fix-ci always execute even if other steps fail. Update all CI platform templates to support this property.
…orkflows

- Add alwaysRun property to Command type in Gradle CI generator
- Update fix-ci command to always run regardless of previous step failures
- Add conditional execution logic to GitHub Actions and CircleCI templates
- Update all framework tutorials to include if: always() condition for fix-ci
- Ensures users get AI-powered CI recommendations even when builds fail

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

github-actions bot commented Jul 4, 2025

🐳 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-31833-a488577 my-workspace

Or just copy this version and use it in your own command:

0.0.0-pr-31833-a488577
Release details 📑
Published version 0.0.0-pr-31833-a488577
Triggered by @FrozenPandaz
Branch add-fix-ci
Commit a488577
Workflow run 16080894508

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

@FrozenPandaz FrozenPandaz merged commit 13551c9 into master Jul 9, 2025
8 checks passed
@FrozenPandaz FrozenPandaz deleted the add-fix-ci branch July 9, 2025 22:21
FrozenPandaz added a commit that referenced this pull request Jul 11, 2025
## Current Behavior

Nx-cloud commands are scattered across different directories in the
command-line structure, making them harder to find and maintain.
Commands like `record`, `start-ci-run`, and `fix-ci` don't exist as
direct nx commands. The fix-ci command in CI workflows doesn't run when
previous steps fail.

## Expected Behavior

All nx-cloud related commands are organized in a dedicated directory
with consistent patterns and shared utilities. New commands provide
better CI/CD integration. The fix-ci command always runs to provide
AI-powered recommendations even when builds fail.

## Related Issue(s)

Improves code organization and adds missing CI workflow commands for
better developer experience.

## Changes Made

### 🏗️ **Reorganized nx-cloud commands**
- Created `/packages/nx/src/command-line/nx-cloud/` directory structure
- Moved existing commands (`login`, `logout`, `connect`) to new location
- Extracted shared utility function to eliminate code duplication

### 🆕 **Added new nx-cloud commands**
- `nx record` - Records command execution for distributed task execution
- `nx start-ci-run` - Starts new CI run for distributed execution
- `nx fix-ci` - Fixes CI configuration issues with AI-powered
suggestions

### 🔧 **Code quality improvements**
- Reduced code duplication by 80+ lines across command implementations
- All commands now follow consistent patterns using shared utilities
- Fixed import paths throughout codebase after reorganization

### 🚀 **Enhanced CI workflow support**
- **Gradle Generator**: Added `alwaysRun` property to Command type for
conditional execution
- **Template Updates**: GitHub Actions and CircleCI templates now handle
`alwaysRun` property
- **Fix-CI Integration**: The `fix-ci` command now always runs
regardless of previous step failures

### 📚 **Comprehensive documentation updates**
- Updated all CI provider documentation (GitHub Actions, Azure DevOps,
GitLab, Bitbucket, CircleCI, Jenkins)
- Updated Nx Cloud tutorial documentation (GitHub Actions, CircleCI)
- **Framework Tutorials**: Added `if: always()` condition to fix-ci
commands in:
  - Gradle tutorial (`/docs/shared/tutorials/gradle.md`)
- Angular monorepo tutorial
(`/docs/shared/tutorials/angular-monorepo.md`)
  - React monorepo tutorial (`/docs/shared/tutorials/react-monorepo.md`)
- TypeScript packages tutorial
(`/docs/shared/tutorials/typescript-packages.md`)
- Added proper documentation linking for all new commands
- All validation passes (TypeScript, formatting, documentation)

### 🎯 **Key Technical Improvements**
- **Always-Run Logic**: Fix-ci command uses platform-specific
conditional execution:
  - GitHub Actions: `if: always()`
  - CircleCI: `when: always`
  - Azure DevOps: `condition: always()`
- **Consistent Patterns**: All nx-cloud commands follow unified
implementation approach
- **Backward Compatibility**: All existing functionality preserved
during reorganization

All nx-cloud commands now provide a more cohesive experience with better
CI integration, ensuring users get AI-powered recommendations even when
builds fail.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
(cherry picked from commit 13551c9)
Copy link
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants